mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-09 13:15:18 -05:00
Reduce impact of lost interrupts on S5L8700 I2C
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22953 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
385e821d04
commit
57b51830d6
1 changed files with 7 additions and 7 deletions
|
|
@ -85,20 +85,20 @@ int i2c_write(unsigned char slave, int address, int len, const unsigned char *da
|
||||||
IICDS = slave & ~1;
|
IICDS = slave & ~1;
|
||||||
IICSTAT = 0xF0;
|
IICSTAT = 0xF0;
|
||||||
IICCON = 0xF3;
|
IICCON = 0xF3;
|
||||||
wakeup_wait(&i2c_wakeup, TIMEOUT_BLOCK);
|
while ((IICCON & 0x10) == 0) wakeup_wait(&i2c_wakeup, 1);
|
||||||
|
|
||||||
if (address >= 0) {
|
if (address >= 0) {
|
||||||
/* write address */
|
/* write address */
|
||||||
IICDS = address;
|
IICDS = address;
|
||||||
IICCON = 0xF3;
|
IICCON = 0xF3;
|
||||||
wakeup_wait(&i2c_wakeup, TIMEOUT_BLOCK);
|
while ((IICCON & 0x10) == 0) wakeup_wait(&i2c_wakeup, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* write data */
|
/* write data */
|
||||||
while (len--) {
|
while (len--) {
|
||||||
IICDS = *data++;
|
IICDS = *data++;
|
||||||
IICCON = 0xF3;
|
IICCON = 0xF3;
|
||||||
wakeup_wait(&i2c_wakeup, TIMEOUT_BLOCK);
|
while ((IICCON & 0x10) == 0) wakeup_wait(&i2c_wakeup, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* STOP */
|
/* STOP */
|
||||||
|
|
@ -119,23 +119,23 @@ int i2c_read(unsigned char slave, int address, int len, unsigned char *data)
|
||||||
IICDS = slave & ~1;
|
IICDS = slave & ~1;
|
||||||
IICSTAT = 0xF0;
|
IICSTAT = 0xF0;
|
||||||
IICCON = 0xF3;
|
IICCON = 0xF3;
|
||||||
wakeup_wait(&i2c_wakeup, TIMEOUT_BLOCK);
|
while ((IICCON & 0x10) == 0) wakeup_wait(&i2c_wakeup, 1);
|
||||||
|
|
||||||
/* write address */
|
/* write address */
|
||||||
IICDS = address;
|
IICDS = address;
|
||||||
IICCON = 0xF3;
|
IICCON = 0xF3;
|
||||||
wakeup_wait(&i2c_wakeup, TIMEOUT_BLOCK);
|
while ((IICCON & 0x10) == 0) wakeup_wait(&i2c_wakeup, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (repeated) START */
|
/* (repeated) START */
|
||||||
IICDS = slave | 1;
|
IICDS = slave | 1;
|
||||||
IICSTAT = 0xB0;
|
IICSTAT = 0xB0;
|
||||||
IICCON = 0xF3;
|
IICCON = 0xF3;
|
||||||
wakeup_wait(&i2c_wakeup, TIMEOUT_BLOCK);
|
while ((IICCON & 0x10) == 0) wakeup_wait(&i2c_wakeup, 1);
|
||||||
|
|
||||||
while (len--) {
|
while (len--) {
|
||||||
IICCON = (len == 0) ? 0x73 : 0xF3; /* NACK or ACK */
|
IICCON = (len == 0) ? 0x73 : 0xF3; /* NACK or ACK */
|
||||||
wakeup_wait(&i2c_wakeup, TIMEOUT_BLOCK);
|
while ((IICCON & 0x10) == 0) wakeup_wait(&i2c_wakeup, 1);
|
||||||
*data++ = IICDS;
|
*data++ = IICDS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue