mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-09 05:05:20 -05:00
sd-as3525v2: Include time spent yielding when figuring timeout in sd_wait_for_tran_state()
(apply r23738 to as3525v2 code) extend the arbitrary delay to 5 seconds, we never know git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26342 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
6b6123444e
commit
9ff986cdca
1 changed files with 4 additions and 8 deletions
|
|
@ -759,26 +759,22 @@ int sd_init(void)
|
|||
static int sd_wait_for_tran_state(const int drive)
|
||||
{
|
||||
unsigned long response;
|
||||
unsigned int timeout = 100; /* ticks */
|
||||
long t = current_tick;
|
||||
unsigned int timeout = current_tick + 5*HZ;
|
||||
|
||||
while (1)
|
||||
{
|
||||
long tick;
|
||||
|
||||
while(!(send_cmd(drive, SD_SEND_STATUS, card_info[drive].rca, MCI_RESP, &response)));
|
||||
|
||||
if (((response >> 9) & 0xf) == SD_TRAN)
|
||||
return 0;
|
||||
|
||||
if(TIME_AFTER(current_tick, t + timeout))
|
||||
if(TIME_AFTER(current_tick, timeout))
|
||||
return -10 * ((response >> 9) & 0xf);
|
||||
|
||||
if (TIME_AFTER((tick = current_tick), next_yield))
|
||||
if (TIME_AFTER(current_tick, next_yield))
|
||||
{
|
||||
yield();
|
||||
timeout += current_tick - tick;
|
||||
next_yield = tick + MIN_YIELD_PERIOD;
|
||||
next_yield = current_tick + MIN_YIELD_PERIOD;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue