From 7526cf70c33fd82da40c8d51108c16db63097a23 Mon Sep 17 00:00:00 2001 From: Björn Stenberg Date: Wed, 25 Sep 2002 14:10:50 +0000 Subject: Improved retry handling git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2415 a1c6a512-1295-4272-9138-f99709370657 --- firmware/drivers/ata.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'firmware') diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c index 8e9ec942cd..11ce50bc1f 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); -- cgit v1.2.3