summaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorRafaël Carré <rafael.carre@gmail.com>2010-05-27 23:32:29 +0000
committerRafaël Carré <rafael.carre@gmail.com>2010-05-27 23:32:29 +0000
commit9ff986cdca896cc3ea7f8b2b46806b508f849c34 (patch)
tree02d9df856e3fb7b37e5a85eaf16f38a30a443a50 /firmware
parent6b6123444e5f1e75eb6167e8f061164f57408f66 (diff)
downloadrockbox-9ff986cdca896cc3ea7f8b2b46806b508f849c34.tar.gz
rockbox-9ff986cdca896cc3ea7f8b2b46806b508f849c34.tar.bz2
rockbox-9ff986cdca896cc3ea7f8b2b46806b508f849c34.zip
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
Diffstat (limited to 'firmware')
-rw-r--r--firmware/target/arm/as3525/sd-as3525v2.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/firmware/target/arm/as3525/sd-as3525v2.c b/firmware/target/arm/as3525/sd-as3525v2.c
index 061be8d1c2..2d796c63cb 100644
--- a/firmware/target/arm/as3525/sd-as3525v2.c
+++ b/firmware/target/arm/as3525/sd-as3525v2.c
@@ -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;
}
}
}