forked from len0rd/rockbox
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
This commit is contained in:
parent
e1c804f4d3
commit
3491147fd0
1 changed files with 17 additions and 15 deletions
|
|
@ -275,7 +275,7 @@ int eeprom_24cxx_read_byte(unsigned int address, char *c)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
char byte;
|
char byte;
|
||||||
int count = 10;
|
int count = 0;
|
||||||
|
|
||||||
if (address >= EEPROM_SIZE)
|
if (address >= EEPROM_SIZE)
|
||||||
{
|
{
|
||||||
|
|
@ -287,19 +287,20 @@ int eeprom_24cxx_read_byte(unsigned int address, char *c)
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
ret = sw_i2c_read(address, &byte);
|
ret = sw_i2c_read(address, &byte);
|
||||||
if (ret < 0)
|
} while (ret < 0 && count++ < 200);
|
||||||
{
|
|
||||||
/* keep between {} as logf is whitespace in normal builds */
|
|
||||||
logf("EEPROM rFail: %d/%d", ret, address);
|
|
||||||
}
|
|
||||||
} while (ret < 0 && count--);
|
|
||||||
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
logf("EEPROM RFail: %d/%d", ret, address);
|
logf("EEPROM RFail: %d/%d/%d", ret, address, count);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (count)
|
||||||
|
{
|
||||||
|
/* keep between {} as logf is whitespace in normal builds */
|
||||||
|
logf("EEPROM rOK: %d retries", count);
|
||||||
|
}
|
||||||
|
|
||||||
*c = byte;
|
*c = byte;
|
||||||
return 0;
|
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 eeprom_24cxx_write_byte(unsigned int address, char c)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
int count = 100;
|
int count = 0;
|
||||||
|
|
||||||
if (address >= EEPROM_SIZE)
|
if (address >= EEPROM_SIZE)
|
||||||
{
|
{
|
||||||
|
|
@ -318,12 +319,7 @@ int eeprom_24cxx_write_byte(unsigned int address, char c)
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
ret = sw_i2c_write_byte(address, c);
|
ret = sw_i2c_write_byte(address, c);
|
||||||
if (ret < 0)
|
} while (ret < 0 && count++ < 200) ;
|
||||||
{
|
|
||||||
/* keep between {} as logf is whitespace in normal builds */
|
|
||||||
logf("EEPROM wFail: %d/%d", ret, address);
|
|
||||||
}
|
|
||||||
} while (ret < 0 && count--) ;
|
|
||||||
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
|
|
@ -331,6 +327,12 @@ int eeprom_24cxx_write_byte(unsigned int address, char c)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (count)
|
||||||
|
{
|
||||||
|
/* keep between {} as logf is whitespace in normal builds */
|
||||||
|
logf("EEPROM wOK: %d retries", count);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue