aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-05-22 06:32:02 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-05-22 06:32:02 +0000
commitb14c34d67db82417b171dbfe052be9ceacdf17e4 (patch)
treef5e7413617ef4163252605df35393402a6ae3e44
parent42476118ad82557a6acf94b61fdf396986531493 (diff)
downloadChibiOS-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
-rw-r--r--os/hal/src/mmc_spi.c13
-rw-r--r--readme.txt2
2 files changed, 11 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) {
diff --git a/readme.txt b/readme.txt
index f59955e86..5d8f57945 100644
--- a/readme.txt
+++ b/readme.txt
@@ -59,6 +59,8 @@
*****************************************************************************
*** 1.5.7 ***
+- FIX: Fixed missing SPI driver reinitialization in the MMC driver (bug
+ 3005628)(backported in 1.4.4).
- FIX: Fixed wrong inclusion order of board.h and halconf.h into hal.h
(bug 3005041)(backported in 1.4.4).
- FIX: Fixed wrong GPIO ports size in the STM8 PAL driver (bug 3001528).