summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Sparmann <theseven@rockbox.org>2009-10-05 12:29:14 +0000
committerMichael Sparmann <theseven@rockbox.org>2009-10-05 12:29:14 +0000
commit57b51830d62ccdf55bcce96b6956219288592dfa (patch)
treeea32f230c980452ab05de6807ec06d4c7580a30b
parent385e821d04b4e0fbd87a163123759995f6e8e9f1 (diff)
downloadrockbox-57b51830d62ccdf55bcce96b6956219288592dfa.tar.gz
rockbox-57b51830d62ccdf55bcce96b6956219288592dfa.zip
Reduce impact of lost interrupts on S5L8700 I2C
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22953 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/target/arm/s5l8700/i2c-s5l8700.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/firmware/target/arm/s5l8700/i2c-s5l8700.c b/firmware/target/arm/s5l8700/i2c-s5l8700.c
index 762db9abc2..5b55334b25 100644
--- a/firmware/target/arm/s5l8700/i2c-s5l8700.c
+++ b/firmware/target/arm/s5l8700/i2c-s5l8700.c
@@ -85,20 +85,20 @@ int i2c_write(unsigned char slave, int address, int len, const unsigned char *da
85 IICDS = slave & ~1; 85 IICDS = slave & ~1;
86 IICSTAT = 0xF0; 86 IICSTAT = 0xF0;
87 IICCON = 0xF3; 87 IICCON = 0xF3;
88 wakeup_wait(&i2c_wakeup, TIMEOUT_BLOCK); 88 while ((IICCON & 0x10) == 0) wakeup_wait(&i2c_wakeup, 1);
89 89
90 if (address >= 0) { 90 if (address >= 0) {
91 /* write address */ 91 /* write address */
92 IICDS = address; 92 IICDS = address;
93 IICCON = 0xF3; 93 IICCON = 0xF3;
94 wakeup_wait(&i2c_wakeup, TIMEOUT_BLOCK); 94 while ((IICCON & 0x10) == 0) wakeup_wait(&i2c_wakeup, 1);
95 } 95 }
96 96
97 /* write data */ 97 /* write data */
98 while (len--) { 98 while (len--) {
99 IICDS = *data++; 99 IICDS = *data++;
100 IICCON = 0xF3; 100 IICCON = 0xF3;
101 wakeup_wait(&i2c_wakeup, TIMEOUT_BLOCK); 101 while ((IICCON & 0x10) == 0) wakeup_wait(&i2c_wakeup, 1);
102 } 102 }
103 103
104 /* STOP */ 104 /* STOP */
@@ -119,23 +119,23 @@ int i2c_read(unsigned char slave, int address, int len, unsigned char *data)
119 IICDS = slave & ~1; 119 IICDS = slave & ~1;
120 IICSTAT = 0xF0; 120 IICSTAT = 0xF0;
121 IICCON = 0xF3; 121 IICCON = 0xF3;
122 wakeup_wait(&i2c_wakeup, TIMEOUT_BLOCK); 122 while ((IICCON & 0x10) == 0) wakeup_wait(&i2c_wakeup, 1);
123 123
124 /* write address */ 124 /* write address */
125 IICDS = address; 125 IICDS = address;
126 IICCON = 0xF3; 126 IICCON = 0xF3;
127 wakeup_wait(&i2c_wakeup, TIMEOUT_BLOCK); 127 while ((IICCON & 0x10) == 0) wakeup_wait(&i2c_wakeup, 1);
128 } 128 }
129 129
130 /* (repeated) START */ 130 /* (repeated) START */
131 IICDS = slave | 1; 131 IICDS = slave | 1;
132 IICSTAT = 0xB0; 132 IICSTAT = 0xB0;
133 IICCON = 0xF3; 133 IICCON = 0xF3;
134 wakeup_wait(&i2c_wakeup, TIMEOUT_BLOCK); 134 while ((IICCON & 0x10) == 0) wakeup_wait(&i2c_wakeup, 1);
135 135
136 while (len--) { 136 while (len--) {
137 IICCON = (len == 0) ? 0x73 : 0xF3; /* NACK or ACK */ 137 IICCON = (len == 0) ? 0x73 : 0xF3; /* NACK or ACK */
138 wakeup_wait(&i2c_wakeup, TIMEOUT_BLOCK); 138 while ((IICCON & 0x10) == 0) wakeup_wait(&i2c_wakeup, 1);
139 *data++ = IICDS; 139 *data++ = IICDS;
140 } 140 }
141 141