Fixed bug 3005628.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1947 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
gdisirio 2010-05-22 06:32:02 +00:00
parent 42476118ad
commit b14c34d67d
2 changed files with 11 additions and 4 deletions

View File

@ -343,8 +343,9 @@ bool_t mmcConnect(MMCDriver *mmcp) {
* @retval TRUE the operation failed. * @retval TRUE the operation failed.
*/ */
bool_t mmcDisconnect(MMCDriver *mmcp) { bool_t mmcDisconnect(MMCDriver *mmcp) {
bool_t status;
chDbgCheck(mmcp != NULL, "mmcConnect"); chDbgCheck(mmcp != NULL, "mmcDisconnect");
chDbgAssert((mmcp->mmc_state != MMC_UNINIT) && chDbgAssert((mmcp->mmc_state != MMC_UNINIT) &&
(mmcp->mmc_state != MMC_STOP), (mmcp->mmc_state != MMC_STOP),
@ -359,10 +360,12 @@ bool_t mmcDisconnect(MMCDriver *mmcp) {
mmcp->mmc_state = MMC_INSERTED; mmcp->mmc_state = MMC_INSERTED;
chSysUnlock(); chSysUnlock();
case MMC_INSERTED: case MMC_INSERTED:
return FALSE; status = FALSE;
default: 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; mmcp->mmc_state = MMC_READING;
chSysUnlock(); chSysUnlock();
spiStart(mmcp->mmc_spip, mmcp->mmc_hscfg);
spiSelect(mmcp->mmc_spip); spiSelect(mmcp->mmc_spip);
send_hdr(mmcp, MMC_CMDREADMULTIPLE, startblk * MMC_SECTOR_SIZE); send_hdr(mmcp, MMC_CMDREADMULTIPLE, startblk * MMC_SECTOR_SIZE);
if (recvr1(mmcp) != 0x00) { if (recvr1(mmcp) != 0x00) {
@ -494,6 +498,7 @@ bool_t mmcStartSequentialWrite(MMCDriver *mmcp, uint32_t startblk) {
mmcp->mmc_state = MMC_WRITING; mmcp->mmc_state = MMC_WRITING;
chSysUnlock(); chSysUnlock();
spiStart(mmcp->mmc_spip, mmcp->mmc_hscfg);
spiSelect(mmcp->mmc_spip); spiSelect(mmcp->mmc_spip);
send_hdr(mmcp, MMC_CMDWRITEMULTIPLE, startblk * MMC_SECTOR_SIZE); send_hdr(mmcp, MMC_CMDWRITEMULTIPLE, startblk * MMC_SECTOR_SIZE);
if (recvr1(mmcp) != 0x00) { if (recvr1(mmcp) != 0x00) {
@ -520,7 +525,7 @@ bool_t mmcSequentialWrite(MMCDriver *mmcp, const uint8_t *buffer) {
static const uint8_t start[] = {0xFF, 0xFC}; static const uint8_t start[] = {0xFF, 0xFC};
uint8_t b[1]; uint8_t b[1];
chDbgCheck((mmcp != NULL) && (buffer != NULL), "mmcSequentialRead"); chDbgCheck((mmcp != NULL) && (buffer != NULL), "mmcSequentialWrite");
chSysLock(); chSysLock();
if (mmcp->mmc_state != MMC_WRITING) { if (mmcp->mmc_state != MMC_WRITING) {

View File

@ -59,6 +59,8 @@
***************************************************************************** *****************************************************************************
*** 1.5.7 *** *** 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 - FIX: Fixed wrong inclusion order of board.h and halconf.h into hal.h
(bug 3005041)(backported in 1.4.4). (bug 3005041)(backported in 1.4.4).
- FIX: Fixed wrong GPIO ports size in the STM8 PAL driver (bug 3001528). - FIX: Fixed wrong GPIO ports size in the STM8 PAL driver (bug 3001528).