Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/i2c/i2c.c
Show First 20 Lines • Show All 584 Lines • ▼ Show 20 Lines | i2c_rdwr_transfer(char *dev, struct options i2c_opt, char *i2c_buf) | ||||
/* | /* | ||||
* If the transfer direction is write and we did a write of the offset | * If the transfer direction is write and we did a write of the offset | ||||
* above, then we need to elide the start; this transfer is just more | * above, then we need to elide the start; this transfer is just more | ||||
* writing that follows the one started above. For a read, we always do | * writing that follows the one started above. For a read, we always do | ||||
* a start; if we did an offset write above it'll be a repeat-start | * a start; if we did an offset write above it'll be a repeat-start | ||||
* because of the NOSTOP flag used above. | * because of the NOSTOP flag used above. | ||||
*/ | */ | ||||
if (i2c_opt.dir == 'w') | if (i2c_opt.dir == 'w') | ||||
msgs[i].flags = IIC_M_WR | (i > 0) ? IIC_M_NOSTART : 0; | msgs[i].flags = IIC_M_WR | ((i > 0) ? IIC_M_NOSTART : 0); | ||||
else | else | ||||
msgs[i].flags = IIC_M_RD; | msgs[i].flags = IIC_M_RD; | ||||
msgs[i].slave = i2c_opt.addr; | msgs[i].slave = i2c_opt.addr; | ||||
msgs[i].len = i2c_opt.count; | msgs[i].len = i2c_opt.count; | ||||
msgs[i].buf = i2c_buf; | msgs[i].buf = i2c_buf; | ||||
++i; | ++i; | ||||
xfer.msgs = msgs; | xfer.msgs = msgs; | ||||
▲ Show 20 Lines • Show All 198 Lines • Show Last 20 Lines |