diff options
author | Björn Stenberg <bjorn@haxx.se> | 2002-09-25 14:10:50 +0000 |
---|---|---|
committer | Björn Stenberg <bjorn@haxx.se> | 2002-09-25 14:10:50 +0000 |
commit | 7526cf70c33fd82da40c8d51108c16db63097a23 (patch) | |
tree | 9d3f4ff4f6ef481cae8dac3223bbac28f639f695 /firmware/drivers | |
parent | d3d342dc27eb1497838f6079d92ee95f9875c3ed (diff) | |
download | rockbox-7526cf70c33fd82da40c8d51108c16db63097a23.tar.gz rockbox-7526cf70c33fd82da40c8d51108c16db63097a23.zip |
Improved retry handling
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2415 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers')
-rw-r--r-- | firmware/drivers/ata.c | 17 |
1 files changed, 12 insertions, 5 deletions
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, | |||
165 | int count, | 165 | int count, |
166 | void* buf) __attribute__ ((section (".icode"))); | 166 | void* buf) __attribute__ ((section (".icode"))); |
167 | int ata_read_sectors(unsigned long start, | 167 | int ata_read_sectors(unsigned long start, |
168 | int count, | 168 | int incount, |
169 | void* buf) | 169 | void* inbuf) |
170 | { | 170 | { |
171 | int ret = 0; | 171 | int ret = 0; |
172 | int timeout; | 172 | int timeout; |
173 | int count; | ||
174 | void* buf; | ||
173 | 175 | ||
174 | last_disk_activity = current_tick; | 176 | last_disk_activity = current_tick; |
175 | 177 | ||
@@ -201,6 +203,10 @@ int ata_read_sectors(unsigned long start, | |||
201 | led(true); | 203 | led(true); |
202 | 204 | ||
203 | timeout = current_tick + READ_TIMEOUT; | 205 | timeout = current_tick + READ_TIMEOUT; |
206 | |||
207 | retry: | ||
208 | buf = inbuf; | ||
209 | count = incount; | ||
204 | while (TIME_BEFORE(current_tick, timeout)) { | 210 | while (TIME_BEFORE(current_tick, timeout)) { |
205 | 211 | ||
206 | if ( count == 256 ) | 212 | if ( count == 256 ) |
@@ -221,11 +227,11 @@ int ata_read_sectors(unsigned long start, | |||
221 | 227 | ||
222 | if (!wait_for_start_of_transfer()) { | 228 | if (!wait_for_start_of_transfer()) { |
223 | ret = -4; | 229 | ret = -4; |
224 | continue; | 230 | goto retry; |
225 | } | 231 | } |
226 | 232 | ||
227 | if ( ATA_ALT_STATUS & (STATUS_ERR | STATUS_DF) ) | 233 | if ( ATA_ALT_STATUS & (STATUS_ERR | STATUS_DF) ) |
228 | continue; | 234 | goto retry; |
229 | 235 | ||
230 | /* if destination address is odd, use byte copying, | 236 | /* if destination address is odd, use byte copying, |
231 | otherwise use word copying */ | 237 | otherwise use word copying */ |
@@ -259,9 +265,10 @@ int ata_read_sectors(unsigned long start, | |||
259 | 265 | ||
260 | if(!wait_for_end_of_transfer()) { | 266 | if(!wait_for_end_of_transfer()) { |
261 | ret = -3; | 267 | ret = -3; |
262 | continue; | 268 | goto retry; |
263 | } | 269 | } |
264 | 270 | ||
271 | ret = 0; | ||
265 | break; | 272 | break; |
266 | } | 273 | } |
267 | led(false); | 274 | led(false); |