<sys/ioccom.h> {CALLING all C/C++ buffs!; }



Page 1 of 1 [ 4 posts ] 

15 Nov 2012, 12:31 pm

So the <sys/ioccom.h> header package contains low level I/O functions. I downloaded and compiled it as I am trying to write an implement some low(er) level network socket subfunctions that actually write data frames to the ethernet adapter. I am not writing an actual driver as one is already installed and those are device specific. You can have a look at it Here as it's open source Unix code.

It defines 2 constants which serve as parameters to the general IOC(input/ouput/control) function macro:

#define IOC_OUT 0x40000000 /* copy out parameters */
#define IOC_IN 0x80000000 /* copy in parameters */

The IOC function(s):

#define _IOC(inout,group,num,len) ((unsigned long) \ ((inout) | (((len) & IOCPARM_MASK) << 16) | ((group) << 8 ) | (num)))
#define _IOR(g,n,t) _IOC(IOC_OUT, (g), (n), sizeof(t))
#define _IOW(g,n,t) _IOC(IOC_IN, (g), (n), sizeof(t))




So my question is are these defined hex parameters interrupt codes? Or memory addresses? If the latter I am eager seeking how to incorporate interrupt codes into low level function macros.



Trencher93
Velociraptor
Velociraptor

User avatar

Joined: Jun 23, 2008
Posts: 465

15 Nov 2012, 2:27 pm

Wouldn't the documentation for whatever this is tell you what the parameters are? Or a forum with people who actually use this library? The probability of finding a user of this library on this site seems low.



Ancalagon
Veteran
Veteran

User avatar

Joined: Dec 25, 2007
Posts: 2525

15 Nov 2012, 7:11 pm

Those are bitmasks. They're being put in the inout parameter and then binary or'ed with a bunch of other stuff. They set a particular bit in the output, which marks whether we're doing a 'copy out' or a 'copy in', whatever those are. You should definitely look up bitwise operators if you're going to do much low level C stuff.


_________________
"A dead thing can go with the stream, but only a living thing can go against it." --G. K. Chesterton


AngelKnight
Veteran
Veteran

User avatar

Joined: May 03, 2011
Posts: 748
Location: This is not my home; I'm just passing through

16 Nov 2012, 12:47 am

AspieRogue wrote:
So the <sys/ioccom.h> header package contains low level I/O functions. I downloaded and compiled it as I am trying to write an implement some low(er) level network socket subfunctions that actually write data frames to the ethernet adapter. I am not writing an actual driver as one is already installed and those are device specific. You can have a look at it Here as it's open source Unix code.


I'm guessing you're going to actually run this stuff within a BSD of some description? If so, why not use the provided interfaces, why try to bitbang the registers on a device by hand while running within BSD?



Display posts from previous:  Sort by  


Page 1 of 1 [ 4 posts ] 



 Similar Topics 
To all the transportation buffs...

in Random Discussion

01 Mar 2008, 12:15 pm

ClosetAspy View the latest post

Any WWII buffs?

[ Go to page: 1 ... 4, 5, 6 ]

in Random Discussion

11 Aug 2008, 5:38 pm

Prof_Pretorius View the latest post

Movie buffs, help me out

in Random Discussion

24 Mar 2011, 11:30 am

shadowboxer View the latest post

History buffs unite!

[ Go to page: 1, 2, 3, 4 ]

in Random Discussion

22 Sep 2012, 6:30 am

NewDawn View the latest post



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum
Jump to: