diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2010-05-22 06:32:02 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2010-05-22 06:32:02 +0000 |
commit | b14c34d67db82417b171dbfe052be9ceacdf17e4 (patch) | |
tree | f5e7413617ef4163252605df35393402a6ae3e44 /os/hal/src | |
parent | 42476118ad82557a6acf94b61fdf396986531493 (diff) | |
download | ChibiOS-b14c34d67db82417b171dbfe052be9ceacdf17e4.tar.gz ChibiOS-b14c34d67db82417b171dbfe052be9ceacdf17e4.tar.bz2 ChibiOS-b14c34d67db82417b171dbfe052be9ceacdf17e4.zip |
Fixed bug 3005628.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1947 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/src')
-rw-r--r-- | os/hal/src/mmc_spi.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/os/hal/src/mmc_spi.c b/os/hal/src/mmc_spi.c index fd63d7838..e5070de02 100644 --- a/os/hal/src/mmc_spi.c +++ b/os/hal/src/mmc_spi.c @@ -343,8 +343,9 @@ bool_t mmcConnect(MMCDriver *mmcp) { * @retval TRUE the operation failed.
*/
bool_t mmcDisconnect(MMCDriver *mmcp) {
+ bool_t status;
- chDbgCheck(mmcp != NULL, "mmcConnect");
+ chDbgCheck(mmcp != NULL, "mmcDisconnect");
chDbgAssert((mmcp->mmc_state != MMC_UNINIT) &&
(mmcp->mmc_state != MMC_STOP),
@@ -359,10 +360,12 @@ bool_t mmcDisconnect(MMCDriver *mmcp) { mmcp->mmc_state = MMC_INSERTED;
chSysUnlock();
case MMC_INSERTED:
- return FALSE;
+ status = FALSE;
default:
- return TRUE;
+ status = TRUE;
}
+ spiStop(mmcp->mmc_spip);
+ return status;
}
/**
@@ -386,6 +389,7 @@ bool_t mmcStartSequentialRead(MMCDriver *mmcp, uint32_t startblk) { mmcp->mmc_state = MMC_READING;
chSysUnlock();
+ spiStart(mmcp->mmc_spip, mmcp->mmc_hscfg);
spiSelect(mmcp->mmc_spip);
send_hdr(mmcp, MMC_CMDREADMULTIPLE, startblk * MMC_SECTOR_SIZE);
if (recvr1(mmcp) != 0x00) {
@@ -494,6 +498,7 @@ bool_t mmcStartSequentialWrite(MMCDriver *mmcp, uint32_t startblk) { mmcp->mmc_state = MMC_WRITING;
chSysUnlock();
+ spiStart(mmcp->mmc_spip, mmcp->mmc_hscfg);
spiSelect(mmcp->mmc_spip);
send_hdr(mmcp, MMC_CMDWRITEMULTIPLE, startblk * MMC_SECTOR_SIZE);
if (recvr1(mmcp) != 0x00) {
@@ -520,7 +525,7 @@ bool_t mmcSequentialWrite(MMCDriver *mmcp, const uint8_t *buffer) { static const uint8_t start[] = {0xFF, 0xFC};
uint8_t b[1];
- chDbgCheck((mmcp != NULL) && (buffer != NULL), "mmcSequentialRead");
+ chDbgCheck((mmcp != NULL) && (buffer != NULL), "mmcSequentialWrite");
chSysLock();
if (mmcp->mmc_state != MMC_WRITING) {
|