summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-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}