struct i2c_algorithm
master_xfer
具有用于 i2c 总线实现的函数指针模板。我在哪里可以找到master_xfer
linux内核源代码中的默认函数例程。?请有人指导我..
问问题
1728 次
2 回答
1
master_xfer 的设置取决于您的平台和总线。在 drivers/i2c/busses/ 下查找该函数指针的设置位置。请注意,它可以设置为 NULL。
在 drivers/i2c/busses/i2c-pxa.c 中设置了一个示例:
static const struct i2c_algorithm i2c_pxa_algorithm = {
.master_xfer = i2c_pxa_xfer,
.functionality = i2c_pxa_functionality,
};
另请查看 include/linux/i2c.h:
struct i2c_algorithm {
/* If an adapter algorithm can't do I2C-level access, set master_xfer
to NULL. If an adapter algorithm can do SMBus access, set
smbus_xfer. If set to NULL, the SMBus protocol is simulated
using common I2C messages */
/* master_xfer should return the number of messages successfully
processed, or a negative value on error */
int (*master_xfer)(struct i2c_adapter *adap, struct i2c_msg *msgs,
int num);
int (*smbus_xfer) (struct i2c_adapter *adap, u16 addr,
unsigned short flags, char read_write,
u8 command, int size, union i2c_smbus_data *data);
/* To determine what the adapter supports */
u32 (*functionality) (struct i2c_adapter *);
};
:
* An i2c_msg is the low level representation of one segment of an I2C
* transaction. It is visible to drivers in the @i2c_transfer() procedure,
* to userspace from i2c-dev, and to I2C adapter drivers through the
* @i2c_adapter.@master_xfer() method.
*
于 2013-08-01T17:38:12.080 回答
0
/driver/i2c/busses/ 中有 i2c-gpio.c 文件。我们正在用 填充master_xfer
函数bit_xfer
。它确实有点猛烈的实施。
于 2013-08-01T18:00:17.687 回答