mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 13:12:37 -05:00
Sansa Connect: Use deviceid in USB Serial Number
Atmel AT88SC6416C CryptoMemory is almost I2C compatible. The device is connected to bitbanged I2C bus shared with compliant I2C devices. Change-Id: Iec54702db1bdfb93c01291eef18ec60391c63b16
This commit is contained in:
parent
663539619c
commit
b4ecd612f7
8 changed files with 183 additions and 0 deletions
|
|
@ -198,6 +198,40 @@ end:
|
|||
return ret;
|
||||
}
|
||||
|
||||
int i2c_write_read_data(int bus_index, int bus_address,
|
||||
const unsigned char* buf_write, int count_write,
|
||||
unsigned char* buf_read, int count_read)
|
||||
{
|
||||
int i;
|
||||
int ret = 0;
|
||||
const struct i2c_interface *iface = i2c_if[bus_index];
|
||||
|
||||
i2c_start(iface);
|
||||
if (!i2c_outb(iface, bus_address))
|
||||
{
|
||||
ret = -2;
|
||||
goto end;
|
||||
}
|
||||
|
||||
for(i = 0;i < count_write;i++)
|
||||
{
|
||||
if (!i2c_outb(iface, buf_write[i]))
|
||||
{
|
||||
ret = -3;
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
for(i = 0;i < count_read-1;i++)
|
||||
buf_read[i] = i2c_inb(iface, true);
|
||||
|
||||
buf_read[i] = i2c_inb(iface, false);
|
||||
|
||||
end:
|
||||
i2c_stop(iface);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* returns bus index which can be used as a handle, or <0 on error */
|
||||
int i2c_add_node(const struct i2c_interface *iface)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue