summaryrefslogtreecommitdiffstats
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.tar.bz2
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)
{
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;
}