From f82f7c34bce17f40a6a0a32311bfb9eabe7bd6e3 Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Wed, 5 Dec 2012 11:01:36 -0300 Subject: [PATCH] tornado/fw/mmc.c (mmc_wait): return success or failure (timeout) --- tornado/fw/mmc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tornado/fw/mmc.c b/tornado/fw/mmc.c index d023d6c..51a6345 100644 --- a/tornado/fw/mmc.c +++ b/tornado/fw/mmc.c @@ -76,16 +76,17 @@ static uint8_t mmc_r1(void) } -static void mmc_wait(void) +static bool mmc_wait(void) { uint8_t v, tries = 0xff; do { v = mmc_recv(); if (v == MMC_START_SINGLE_BLOCK) - return; + return 1; } while (--tries); + return 0; } @@ -97,8 +98,7 @@ bool mmc_begin_read(uint32_t sector) mmc_end(); return 0; } else { - mmc_wait(); - return 1; + return mmc_wait(); } }