Lines 78-102
Link Here
|
78 |
static int |
78 |
static int |
79 |
isl_read_byte(device_t dev, uint8_t reg, uint8_t *val) |
79 |
isl_read_byte(device_t dev, uint8_t reg, uint8_t *val) |
80 |
{ |
80 |
{ |
81 |
uint16_t addr = iicbus_get_addr(dev); |
81 |
return (iicdev_readfrom(dev, reg, val, 1, IIC_INTRWAIT)); |
82 |
struct iic_msg msgs[] = { |
|
|
83 |
{ addr, IIC_M_WR | IIC_M_NOSTOP, 1, ® }, |
84 |
{ addr, IIC_M_RD, 1, val }, |
85 |
}; |
86 |
|
87 |
return (iicbus_transfer(dev, msgs, nitems(msgs))); |
88 |
} |
82 |
} |
89 |
|
83 |
|
90 |
static int |
84 |
static int |
91 |
isl_write_byte(device_t dev, uint8_t reg, uint8_t val) |
85 |
isl_write_byte(device_t dev, uint8_t reg, uint8_t val) |
92 |
{ |
86 |
{ |
93 |
uint16_t addr = iicbus_get_addr(dev); |
87 |
return (iicdev_writeto(dev, reg, &val, 1, IIC_INTRWAIT)); |
94 |
uint8_t bytes[] = { reg, val }; |
|
|
95 |
struct iic_msg msgs[] = { |
96 |
{ addr, IIC_M_WR, nitems(bytes), bytes }, |
97 |
}; |
98 |
|
99 |
return (iicbus_transfer(dev, msgs, nitems(msgs))); |
100 |
} |
88 |
} |
101 |
|
89 |
|
102 |
/* |
90 |
/* |