summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2002-09-25 14:10:50 +0000
committerBjörn Stenberg <bjorn@haxx.se>2002-09-25 14:10:50 +0000
commit7526cf70c33fd82da40c8d51108c16db63097a23 (patch)
tree9d3f4ff4f6ef481cae8dac3223bbac28f639f695
parentd3d342dc27eb1497838f6079d92ee95f9875c3ed (diff)
downloadrockbox-7526cf70c33fd82da40c8d51108c16db63097a23.zip
rockbox-7526cf70c33fd82da40c8d51108c16db63097a23.tar.gz
rockbox-7526cf70c33fd82da40c8d51108c16db63097a23.tar.bz2
rockbox-7526cf70c33fd82da40c8d51108c16db63097a23.tar.xz
Improved retry handling
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2415 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/drivers/ata.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c
index 8e9ec94..11ce50b 100644
--- a/firmware/drivers/ata.c
+++ b/firmware/drivers/ata.c
@@ -165,11 +165,13 @@ int ata_read_sectors(unsigned long start,
int count,
void* buf) __attribute__ ((section (".icode")));
int ata_read_sectors(unsigned long start,
- int count,
- void* buf)
+ int incount,
+ void* inbuf)
{
int ret = 0;
int timeout;
+ int count;
+ void* buf;
last_disk_activity = current_tick;
@@ -201,6 +203,10 @@ int ata_read_sectors(unsigned long start,
led(true);
timeout = current_tick + READ_TIMEOUT;
+
+ retry:
+ buf = inbuf;
+ count = incount;
while (TIME_BEFORE(current_tick, timeout)) {
if ( count == 256 )
@@ -221,11 +227,11 @@ int ata_read_sectors(unsigned long start,
if (!wait_for_start_of_transfer()) {
ret = -4;
- continue;
+ goto retry;
}
if ( ATA_ALT_STATUS & (STATUS_ERR | STATUS_DF) )
- continue;
+ goto retry;
/* if destination address is odd, use byte copying,
otherwise use word copying */
@@ -259,9 +265,10 @@ int ata_read_sectors(unsigned long start,
if(!wait_for_end_of_transfer()) {
ret = -3;
- continue;
+ goto retry;
}
+ ret = 0;
break;
}
led(false);