Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - resource manager. i2c - possible file system. : (1 Item)
   
resource manager. i2c - possible file system.  
Hello,

Trying to think of the best way to implement the i2c driver, in general a serial driver that would/may get a device as a
 "file". For instance /dev/i2c/slave1 .. n. 
_io_read / write would be common in terms of the actual code, however, I'd need to know which device/slave is, in fact, 
accessed. 
I'm just starting working with qnx and I'm trying to think of the best strategy to design an i2c driver. 
How would i know, inside "io_read", which slave is this call about? Or should I even care? 
I'd need this since each slave has its own address and the decision to access one piece of hw or another depends on this
 address. I could go further and split this up into "internal addresses" but the idea stays the same. 

I understand I can access pid/gid inside _io_read, but how do I make the connection to the actual slave? Should I save 
these values when open is called and this way make the connection with the slave? But even in this case, how do I know 
the actual path name? Is it passed into io_open or io_read?

A small example:
open (/dev/i2c/slave1) and open(/dev/i2c/slave2).
Then _io_read would be called for either of them. 
slave1 and slave2 have different addresses so how would I know if io_read was called for the opened slave1 or slave2?

Thanks,
Virgil