summaryrefslogtreecommitdiff
path: root/firmware/drivers/ata.c
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2003-07-10 13:32:15 +0000
committerBjörn Stenberg <bjorn@haxx.se>2003-07-10 13:32:15 +0000
commitc695f26c9ff190285e06a58fa82410fe275c5439 (patch)
tree7603e4e97dbb61273289fafa8617bffd7837f8a5 /firmware/drivers/ata.c
parent4b392cd105b0904790c0f7c694c382096963fe42 (diff)
Fixed spindown bug: last_disk_activity was set 10 seconds into the future, which resulted in too long spindown delays.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3826 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers/ata.c')
-rw-r--r--firmware/drivers/ata.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c
index d3ccf0e662..88b57d033e 100644
--- a/firmware/drivers/ata.c
+++ b/firmware/drivers/ata.c
@@ -110,9 +110,10 @@ static int wait_for_bsy(void) __attribute__ ((section (".icode")));
static int wait_for_bsy(void)
{
int timeout = current_tick + HZ*10;
- last_disk_activity = timeout;
- while (TIME_BEFORE(current_tick, timeout) && (ATA_STATUS & STATUS_BSY))
+ while (TIME_BEFORE(current_tick, timeout) && (ATA_STATUS & STATUS_BSY)) {
+ last_disk_activity = current_tick;
yield();
+ }
if (TIME_BEFORE(current_tick, timeout))
return 1;
@@ -129,10 +130,12 @@ static int wait_for_rdy(void)
return 0;
timeout = current_tick + HZ*10;
- last_disk_activity = timeout;
- while (TIME_BEFORE(current_tick, timeout) && !(ATA_ALT_STATUS & STATUS_RDY))
+ while (TIME_BEFORE(current_tick, timeout) &&
+ !(ATA_ALT_STATUS & STATUS_RDY)) {
+ last_disk_activity = current_tick;
yield();
+ }
if (TIME_BEFORE(current_tick, timeout))
return STATUS_RDY;