I2C interface.
Definition in file i2c.h.
Check presence of I2C device.
- Parameters
-
i2c | I2C interface |
i2cdev | I2C device |
- Return values
-
Checks for the presence of the device on the I2C bus by attempting a zero-length write.
Definition at line 135 of file i2c.h.
137 return i2c->
write ( i2c, i2cdev, 0,
NULL, 0 );
int(* write)(struct i2c_interface *i2c, struct i2c_device *i2cdev, unsigned int offset, const uint8_t *data, unsigned int len)
Write data to I2C device.
#define NULL
NULL pointer (VOID *)
References NULL, and i2c_interface::write.
Referenced by exanic_try_init_eeprom(), linda_init_i2c(), and qib7322_init_i2c().
Initialise I2C bit-bashing interface.
- Parameters
-
i2cbit | I2C bit-bashing interface |
bash_op | Bit-basher operations |
Definition at line 387 of file i2c_bit.c.
393 basher->
op = bash_op;
401 DBGC ( basher,
"I2CBIT %p could not reset I2C bus: %s\n",
struct arbelprm_rc_send_wqe rc
int(* write)(struct i2c_interface *i2c, struct i2c_device *i2cdev, unsigned int offset, const uint8_t *data, unsigned int len)
Write data to I2C device.
static int i2c_reset(struct bit_basher *basher)
Reset I2C bus.
struct bit_basher_operations * op
Bit-bashing operations.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
struct i2c_interface i2c
I2C interface.
static int i2c_bit_write(struct i2c_interface *i2c, struct i2c_device *i2cdev, unsigned int offset, const uint8_t *data, unsigned int len)
Write data to I2C device via bit-bashing interface.
struct bit_basher basher
Bit-bashing interface.
int(* read)(struct bit_basher *basher, unsigned int bit_id)
Read input bit.
char * strerror(int errno)
Retrieve string representation of error number.
int(* read)(struct i2c_interface *i2c, struct i2c_device *i2cdev, unsigned int offset, uint8_t *data, unsigned int len)
Read data from I2C device.
void(* write)(struct bit_basher *basher, unsigned int bit_id, unsigned long data)
Set/clear output bit.
#define NULL
NULL pointer (VOID *)
static int i2c_bit_read(struct i2c_interface *i2c, struct i2c_device *i2cdev, unsigned int offset, uint8_t *data, unsigned int len)
Read data from I2C device via bit-bashing interface.
References assert(), i2c_bit_basher::basher, DBGC, i2c_bit_basher::i2c, i2c_bit_read(), i2c_bit_write(), i2c_reset(), NULL, bit_basher::op, rc, bit_basher_operations::read, i2c_interface::read, strerror(), bit_basher_operations::write, and i2c_interface::write.
Referenced by exanic_try_init_eeprom(), falcon_probe_spi(), linda_init_i2c(), and qib7322_init_i2c().