static int i2c_transfer(I2cOps *me, I2cSeg *segments, int seg_count) { RkI2c *bus = container_of(me, RkI2c, ops); int res = 0; int i; I2cSeg *seg = segments; for (i = 0; i < seg_count; i++, seg++) { res = i2c_do_xfer(bus->reg_addr, *seg); if (res) break; } return res; }
int platform_i2c_transfer(unsigned bus, struct i2c_msg *segments, int seg_count) { int i; int res = 0; struct rk_i2c_regs *regs = (struct rk_i2c_regs *)(i2c_bus[bus]); struct i2c_msg *seg = segments; for (i = 0; i < seg_count; i++, seg++) { res = i2c_do_xfer(regs, *seg); if (res) break; } return res; }
/*===========================================================================*/ int i2c3_transfer(struct i2c_msg_s msgs[], int num) { int ret ; int retries ; int i; int delay = 1000; retries = retry_time ; for (i = retries ; i > 0; i--) { ret = i2c_do_xfer(msgs, num); if (ret > 0) return ret ; PRINTD("%s:i2c_test: retrying transmission\n\r", __func__); delay = 1000; while (delay == 0) delay--; } wmt_delayus(100) ; PRINTD("i2c_err : retried %i times\n\r", retries); return -1 ; }