i2c_driver结构体 /* @ 定义在include/linux/i2c.h文件中 @ i2c_driver结构体 */ struct i2c_driver { unsigned int class; /* Notifies the driver that a new bus has appeared. You should * avoid using this, it will be removed in a near future. */ int (*attach_adapter)(struct i2c_adapte...
int (*probe)(struct i2c_client * , const struct i2c_device_id *); int (*remove)(struct i2c_client *); struct device_driver driver; const struct i2c_device_id *id_table; }; //注册与注销: int i2c_add_driver(struct i2c_driver *driver); void i2c_del_driver(struct i2c_driver *driver...
i2c_driver 类似 platform_driver,是编写 I2C 设备驱动重点要处理的内容, i2c_driver 结构体定义在 include/linux/i2c.h 文件中 structi2c_driver{unsignedintclass;/* Notifies the driver that a new bus has appeared. You should* avoid using this, it will be removed in a near future.*/int(*attach_...
7. 48 * 8. 49 * Systems using the Linux I2C driverstack can declare tables of board info 9. 50 * while they initialize. This should be done in board-specific initcode 10. 51 * near arch_initcall() time, orequivalent, before any I2C adapter driver is 11. 52 * registered. For examp...
2. I2C总线驱动(I2C Bus Driver)功能:I2C总线驱动是对I2C硬件体系结构中适配器端的实现。适配器可由...
i2c_driver 类似 platform_driver,是我们编写 I2C 设备驱动重点要处理的内容, i2c_driver 结构体定义在 include/linux/i2c.h 文件中,内容如下: 代码语言:javascript 复制 struct i2c_driver{unsigned intclass;/* Notifies the driver that a new bus has appeared. You should avoid ...
i2c_driver 类似 platform_driver,是我们编写 I2C 设备驱动重点要处理的内容, i2c_driver 结构体定义在 include/linux/i2c.h 文件中,内容如下: structi2c_driver{ unsignedintclass; /*Notifiesthedriverthatanewbushasappeared.Youshouldavoid *usingthis,itwillberemovedinanearfuture. ...
③实现I2C设备驱动与i2c_driver接口,用具体设备yyy的yyy_attach_adapter()函数指针、yyy_detach_client()函数指针和yyy_command()函数指针的赋值给i2c_driver的attach_adapter、datach_adapter和datach_client指针。 ④实现i2c设备驱动的文件操作接口,即实现具体设备yyy的yyy_read()、yyy_write()和yyy_ioctl()等。
这4种结构的定义见include/linux/i2c.h文件。 对于i2c_driver和i2c_client,i2c_driver对应一套驱动方法,是纯粹的用于辅助作用的数据结构,它不对应于任何的物理实体。 i2c_client对应于真实的物理设备,每个I2C设备都需要一个i2c_client来描述。i2c_client 一般被包含在i2c字符设备的私有信息结构体中。i2c_driver 与i2...
在xilinx-linux中,i2c从设备是通过dts文件传递给内核的,内核通过zynq_init_machine函数注册所有的i2c从设备,i2c_client.I2C的linux必须知道4个结构体:i2c_adapter,i2c_algorithm,i2c_client,i2c_driverstruct i2c_adapter {struct module owner;unsigned int class; / classes to allow probing for /const struct i2c...