summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiika Pekkarinen <miipekk@ihme.org>2006-08-11 19:02:23 +0000
committerMiika Pekkarinen <miipekk@ihme.org>2006-08-11 19:02:23 +0000
commit3491147fd0be9684261b1cd8e8e9c909a8fb26ce (patch)
tree7d3efb780b69fa7e5035f33656d172e0966c2967
parente1c804f4d36ba9b1f8d5bb2719ac88e1959954d3 (diff)
downloadrockbox-3491147fd0be9684261b1cd8e8e9c909a8fb26ce.tar.gz
rockbox-3491147fd0be9684261b1cd8e8e9c909a8fb26ce.zip
Delay loops were too short for non-logf enabled builds @ 120 MHz.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10532 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/drivers/eeprom_24cxx.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/firmware/drivers/eeprom_24cxx.c b/firmware/drivers/eeprom_24cxx.c
index 03e5a3d620..9a8fa5d86d 100644
--- a/firmware/drivers/eeprom_24cxx.c
+++ b/firmware/drivers/eeprom_24cxx.c
@@ -275,7 +275,7 @@ int eeprom_24cxx_read_byte(unsigned int address, char *c)
275{ 275{
276 int ret; 276 int ret;
277 char byte; 277 char byte;
278 int count = 10; 278 int count = 0;
279 279
280 if (address >= EEPROM_SIZE) 280 if (address >= EEPROM_SIZE)
281 { 281 {
@@ -287,19 +287,20 @@ int eeprom_24cxx_read_byte(unsigned int address, char *c)
287 do 287 do
288 { 288 {
289 ret = sw_i2c_read(address, &byte); 289 ret = sw_i2c_read(address, &byte);
290 if (ret < 0) 290 } while (ret < 0 && count++ < 200);
291 {
292 /* keep between {} as logf is whitespace in normal builds */
293 logf("EEPROM rFail: %d/%d", ret, address);
294 }
295 } while (ret < 0 && count--);
296 291
297 if (ret < 0) 292 if (ret < 0)
298 { 293 {
299 logf("EEPROM RFail: %d/%d", ret, address); 294 logf("EEPROM RFail: %d/%d/%d", ret, address, count);
300 return ret; 295 return ret;
301 } 296 }
302 297
298 if (count)
299 {
300 /* keep between {} as logf is whitespace in normal builds */
301 logf("EEPROM rOK: %d retries", count);
302 }
303
303 *c = byte; 304 *c = byte;
304 return 0; 305 return 0;
305} 306}
@@ -307,7 +308,7 @@ int eeprom_24cxx_read_byte(unsigned int address, char *c)
307int eeprom_24cxx_write_byte(unsigned int address, char c) 308int eeprom_24cxx_write_byte(unsigned int address, char c)
308{ 309{
309 int ret; 310 int ret;
310 int count = 100; 311 int count = 0;
311 312
312 if (address >= EEPROM_SIZE) 313 if (address >= EEPROM_SIZE)
313 { 314 {
@@ -318,12 +319,7 @@ int eeprom_24cxx_write_byte(unsigned int address, char c)
318 do 319 do
319 { 320 {
320 ret = sw_i2c_write_byte(address, c); 321 ret = sw_i2c_write_byte(address, c);
321 if (ret < 0) 322 } while (ret < 0 && count++ < 200) ;
322 {
323 /* keep between {} as logf is whitespace in normal builds */
324 logf("EEPROM wFail: %d/%d", ret, address);
325 }
326 } while (ret < 0 && count--) ;
327 323
328 if (ret < 0) 324 if (ret < 0)
329 { 325 {
@@ -331,6 +327,12 @@ int eeprom_24cxx_write_byte(unsigned int address, char c)
331 return ret; 327 return ret;
332 } 328 }
333 329
330 if (count)
331 {
332 /* keep between {} as logf is whitespace in normal builds */
333 logf("EEPROM wOK: %d retries", count);
334 }
335
334 return 0; 336 return 0;
335} 337}
336 338