summaryrefslogtreecommitdiff
path: root/firmware/drivers
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 /firmware/drivers
parentdd937dcfaf99a0eee4f9b37fe350fba10d757ba8 (diff)
downloadrockbox-0660105af276058befa41311d50432dcf9453f47.tar.gz
rockbox-0660105af276058befa41311d50432dcf9453f47.zip
Fixed busy timeout handling; better comments
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5240 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers')
-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 54cb275a0d..487339292b 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)
246 *buf = fliptable[(signed char)(RDR1)]; /* read & bitswap */ 246 *buf = fliptable[(signed char)(RDR1)]; /* read & bitswap */
247} 247}
248 248
249static unsigned char poll_byte(int timeout) /* timeout is in bytes */ 249/* returns 0xFF on timeout, timeout is in bytes */
250static unsigned char poll_byte(int timeout)
250{ 251{
251 int i; 252 int i;
252 unsigned char data = 0; /* stop the compiler complaining */ 253 unsigned char data = 0; /* stop the compiler complaining */
@@ -264,7 +265,8 @@ static unsigned char poll_byte(int timeout) /* timeout is in bytes */
264 return fliptable[(signed char)data]; 265 return fliptable[(signed char)data];
265} 266}
266 267
267static unsigned char poll_busy(int timeout) /* timeout is in bytes */ 268/* returns 0 on timeout, timeout is in bytes */
269static unsigned char poll_busy(int timeout)
268{ 270{
269 int i; 271 int i;
270 unsigned char data, dummy; 272 unsigned char data, dummy;
@@ -285,7 +287,7 @@ static unsigned char poll_busy(int timeout) /* timeout is in bytes */
285 dummy = RDR1; /* read byte */ 287 dummy = RDR1; /* read byte */
286 } while ((dummy != 0xFF) && (++i < timeout)); 288 } while ((dummy != 0xFF) && (++i < timeout));
287 289
288 return data; 290 return (dummy == 0xFF) ? data : 0;
289} 291}
290 292
291/* Send MMC command and get response */ 293/* Send MMC command and get response */
@@ -734,7 +736,7 @@ void ata_spindown(int seconds)
734} 736}
735 737
736bool ata_disk_is_active(void) 738bool ata_disk_is_active(void)
737{ 739{
738 /* this is correct unless early return from write gets implemented */ 740 /* this is correct unless early return from write gets implemented */
739 return mmc_mutex.locked; 741 return mmc_mutex.locked;
740} 742}