底层之旅 —— Linux下的I2c体系结构(二)

2014-11-24 11:20:26 · 作者: · 浏览: 4

unsigned short addr;/* chip address - NOTE: 7bit*/
/* addresses are stored in the*/
/* _LOWER_ 7 bits*/

char name[I2C_NAME_SIZE];
struct i2c_adapter *adapter;/* the adapter we sit on*/
struct i2c_driver *driver;/* and our access routines*/
struct device dev;/* the device structure*/
int irq; /* irq issued by device*/
struct list_head detected;
};


这四个数据结构之间又有密切联系。一个I2C适配器需要i2c_algorithm中提供的通信函数来控制适配器上产生特定的访问周期。缺少i2c_algorithmi2c_adapter什么也做不了,因此i2c_adapter中包含其使用的 i2c_algorithm的指针。i2c_driver与i2c_client的关系是一对多,一个i2c_driver上可以支持多个同类型的i2c_client。