1
0
mirror of git://projects.qi-hardware.com/antorcha.git synced 2024-11-22 07:09:23 +02:00

tornado/fw/mmc.c (mmc_wait): return success or failure (timeout)

This commit is contained in:
Werner Almesberger 2012-12-05 11:01:36 -03:00
parent 9bf1f83597
commit f82f7c34bc

View File

@ -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; uint8_t v, tries = 0xff;
do { do {
v = mmc_recv(); v = mmc_recv();
if (v == MMC_START_SINGLE_BLOCK) if (v == MMC_START_SINGLE_BLOCK)
return; return 1;
} }
while (--tries); while (--tries);
return 0;
} }
@ -97,8 +98,7 @@ bool mmc_begin_read(uint32_t sector)
mmc_end(); mmc_end();
return 0; return 0;
} else { } else {
mmc_wait(); return mmc_wait();
return 1;
} }
} }