From 3491147fd0be9684261b1cd8e8e9c909a8fb26ce Mon Sep 17 00:00:00 2001 From: Miika Pekkarinen Date: Fri, 11 Aug 2006 19:02:23 +0000 Subject: 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 --- firmware/drivers/eeprom_24cxx.c | 32 +++++++++++++++++--------------- 1 file 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) { int ret; char byte; - int count = 10; + int count = 0; if (address >= EEPROM_SIZE) { @@ -287,19 +287,20 @@ int eeprom_24cxx_read_byte(unsigned int address, char *c) do { ret = sw_i2c_read(address, &byte); - if (ret < 0) - { - /* keep between {} as logf is whitespace in normal builds */ - logf("EEPROM rFail: %d/%d", ret, address); - } - } while (ret < 0 && count--); + } while (ret < 0 && count++ < 200); if (ret < 0) { - logf("EEPROM RFail: %d/%d", ret, address); + logf("EEPROM RFail: %d/%d/%d", ret, address, count); return ret; } + if (count) + { + /* keep between {} as logf is whitespace in normal builds */ + logf("EEPROM rOK: %d retries", count); + } + *c = byte; return 0; } @@ -307,7 +308,7 @@ int eeprom_24cxx_read_byte(unsigned int address, char *c) int eeprom_24cxx_write_byte(unsigned int address, char c) { int ret; - int count = 100; + int count = 0; if (address >= EEPROM_SIZE) { @@ -318,12 +319,7 @@ int eeprom_24cxx_write_byte(unsigned int address, char c) do { ret = sw_i2c_write_byte(address, c); - if (ret < 0) - { - /* keep between {} as logf is whitespace in normal builds */ - logf("EEPROM wFail: %d/%d", ret, address); - } - } while (ret < 0 && count--) ; + } while (ret < 0 && count++ < 200) ; if (ret < 0) { @@ -331,6 +327,12 @@ int eeprom_24cxx_write_byte(unsigned int address, char c) return ret; } + if (count) + { + /* keep between {} as logf is whitespace in normal builds */ + logf("EEPROM wOK: %d retries", count); + } + return 0; } -- cgit v1.2.3