about porting i2c device to cboot


We try to porting our i2c device to cboot.
We have questions about the third parameter and the fourth in tegrabl_i2c_dev_read/tegrabl_i2c_dev_write function.

take the eeprom as an example “tegrabl_i2c_dev_read(hi2c_dev, eeprom->data, 0, eeprom->size);”

Is the third parameter the start address of the read data point ? and the fourth parameter is the
offset of the third parameter ?

Is my understanding correct ?


Yes, the third is the address and fourth is the size(counter).


Thank your response, another question about the eeprom struct below,
Is the i2c instance the same meaning of i2c bus ?

struct tegrabl_eeprom {
char *name;
char *bus_node_name;
tegrabl_instance_i2c_t instance;
uint8_t slave_addr;
uint32_t size;
bool crc_valid;
uint8_t *data;
bool data_valid;

Yes, correct.

That’s a terrible struct. So much unused padding!
Why not put the uint8_t and bool elements at the end of the struct?
(In general, sort struct members from biggest to smallest, with pointers between int64 and int32 size)