aboutsummaryrefslogtreecommitdiffstats
path: root/os/io/mmc_spi.c
diff options
context:
space:
mode:
Diffstat (limited to 'os/io/mmc_spi.c')
-rw-r--r--os/io/mmc_spi.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/os/io/mmc_spi.c b/os/io/mmc_spi.c
index 6a2407a6a..42100bb61 100644
--- a/os/io/mmc_spi.c
+++ b/os/io/mmc_spi.c
@@ -372,6 +372,8 @@ bool_t mmcSequentialRead(MMCDriver *mmcp, uint8_t *buffer) {
* @retval TRUE the operation failed.
*/
bool_t mmcStopSequentialRead(MMCDriver *mmcp) {
+ static const uint8_t stopcmd[] = {0x40 | MMC_CMDSTOP, 0, 0, 0, 0, 1, 0xFF};
+ bool_t result;
chDbgCheck(mmcp != NULL, "mmcStopSequentialRead");
@@ -382,11 +384,15 @@ bool_t mmcStopSequentialRead(MMCDriver *mmcp) {
}
chSysUnlock();
+ spiSend(mmcp->mmc_spip, sizeof(stopcmd), stopcmd);
+ result = recvr1(mmcp) != 0x00;
+ spiUnselect(mmcp->mmc_spip);
+
chSysLock();
if (mmcp->mmc_state == MMC_READING)
mmcp->mmc_state = MMC_READY;
chSysUnlock();
- return FALSE;
+ return result;
}
/** @} */