i2c_driver结构体
时间: 2023-09-16 21:08:28 浏览: 105
i2c_driver结构体是Linux内核中用于描述I2C总线设备驱动程序的数据结构。它定义在<linux/i2c.h>头文件中,包含以下成员:
- struct module *owner:指向驱动程序所属的模块的指针。
- const char *driver_name:驱动程序的名称。
- const struct i2c_device_id *id_table:指向一个数组,每个元素表示一个支持的I2C设备,包含设备的名称和ID。
- int (*probe)(struct i2c_client *client, const struct i2c_device_id *id):当I2C设备被探测到时,该函数被调用。该函数返回0表示成功,返回其他值表示错误。
- int (*remove)(struct i2c_client *client):当I2C设备被移除时,该函数被调用。该函数返回0表示成功,返回其他值表示错误。
- void (*shutdown)(struct i2c_client *client):当系统关闭时,该函数被调用,用于释放资源。
- int (*suspend)(struct i2c_client *client, pm_message_t mesg):当系统进入挂起状态时,该函数被调用,用于保存设备状态。
- int (*resume)(struct i2c_client *client):当系统恢复正常工作时,该函数被调用,用于恢复设备状态。
- const struct of_device_id *of_match_table:指向一个数组,每个元素表示一个支持的设备节点,包含设备的名称和ID。
通过填充i2c_driver结构体中的成员,可以实现对I2C设备的控制和管理。
阅读全文
相关推荐
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)