summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2004-10-09 22:48:10 +0000
committerJens Arnold <amiconn@rockbox.org>2004-10-09 22:48:10 +0000
commit0660105af276058befa41311d50432dcf9453f47 (patch)
tree0b7843a6c1a7f95310387fc1c71e26310dc22f84
parentdd937dcfaf99a0eee4f9b37fe350fba10d757ba8 (diff)
downloadrockbox-0660105af276058befa41311d50432dcf9453f47.zip
rockbox-0660105af276058befa41311d50432dcf9453f47.tar.gz
rockbox-0660105af276058befa41311d50432dcf9453f47.tar.bz2
rockbox-0660105af276058befa41311d50432dcf9453f47.tar.xz
Fixed busy timeout handling; better comments
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5240 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/drivers/ata_mmc.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/firmware/drivers/ata_mmc.c b/firmware/drivers/ata_mmc.c
index 54cb275..4873392 100644
--- a/firmware/drivers/ata_mmc.c
+++ b/firmware/drivers/ata_mmc.c
@@ -246,7 +246,8 @@ static void read_transfer(unsigned char *buf, int len)
*buf = fliptable[(signed char)(RDR1)]; /* read & bitswap */
}
-static unsigned char poll_byte(int timeout) /* timeout is in bytes */
+/* returns 0xFF on timeout, timeout is in bytes */
+static unsigned char poll_byte(int timeout)
{
int i;
unsigned char data = 0; /* stop the compiler complaining */
@@ -264,7 +265,8 @@ static unsigned char poll_byte(int timeout) /* timeout is in bytes */
return fliptable[(signed char)data];
}
-static unsigned char poll_busy(int timeout) /* timeout is in bytes */
+/* returns 0 on timeout, timeout is in bytes */
+static unsigned char poll_busy(int timeout)
{
int i;
unsigned char data, dummy;
@@ -285,7 +287,7 @@ static unsigned char poll_busy(int timeout) /* timeout is in bytes */
dummy = RDR1; /* read byte */
} while ((dummy != 0xFF) && (++i < timeout));
- return data;
+ return (dummy == 0xFF) ? data : 0;
}
/* Send MMC command and get response */
@@ -734,7 +736,7 @@ void ata_spindown(int seconds)
}
bool ata_disk_is_active(void)
-{
+{
/* this is correct unless early return from write gets implemented */
return mmc_mutex.locked;
}