This is my first (useful) resource manager so please bare with me. I’m writing a resource manager for an IO card that has 8 input and 8 output channels.
I am wanting to register multiple devices so you will be able to see:
Now my problem starts with how does the resmgr_io_funcs_ functions figure out which one was opened (in0, or out3 etc). My thought was to extend the IOFUNC_ATTR_T structure to contain an “io channel id” and create an array of these structures that is initialized with a different “io channel id” value for each element. This way whenever the _io_read function runs, it will be able to look up the value of ocb->attr->io_channel_id and know exactly which device is being used.
First question is: Is there a more standard way of figuring out which device was sent a open/read/write/etc request for a resource manager with multiple registered devices??
The next thing I wanted to do is create two different extenstions of IOFUNC_ATTR_T (one for the input channels and one for the output channels), but by using the #define statement I don’t think theres another way. I guess I could add a in/out flag to the extended attribute structure, but this seems messy.
Second question: Is there a way of overriding the IOFUNC_ATTR_T with multiple functions?
I hope this made sense.