From c695f26c9ff190285e06a58fa82410fe275c5439 Mon Sep 17 00:00:00 2001 From: Björn Stenberg Date: Thu, 10 Jul 2003 13:32:15 +0000 Subject: 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 --- firmware/drivers/ata.c | 11 +++++++---- 1 file 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; -- cgit v1.2.3