Fixed bug 3605794.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5306 35acf78f-673a-0410-8e92-d51de3d6d3f4master
parent
54e9e02607
commit
5a6b1e42b0
|
@ -39,28 +39,28 @@
|
||||||
|
|
||||||
stop [label="BLK_STOP\nLow Power"];
|
stop [label="BLK_STOP\nLow Power"];
|
||||||
uninit [label="BLK_UNINIT", style="bold"];
|
uninit [label="BLK_UNINIT", style="bold"];
|
||||||
ready [label="BLK_READY\nClock Enabled"];
|
active [label="BLK_ACTIVE\nClock Enabled"];
|
||||||
connecting [label="BLK_CONN.ING\nConnecting"];
|
connecting [label="BLK_CONN.ING\nConnecting"];
|
||||||
disconnecting [label="BLK_DISC.ING\nDisconnecting"];
|
disconnecting [label="BLK_DISC.ING\nDisconnecting"];
|
||||||
active [label="BLK_ACTIVE\nCard Ready"];
|
ready [label="BLK_READY\nCard Ready"];
|
||||||
reading [label="BLK_READING\nReading"];
|
reading [label="BLK_READING\nReading"];
|
||||||
writing [label="BLK_WRITING\nWriting"];
|
writing [label="BLK_WRITING\nWriting"];
|
||||||
|
|
||||||
uninit -> stop [label=" blkInit()", constraint=false];
|
uninit -> stop [label=" blkInit()", constraint=false];
|
||||||
stop -> stop [label="\nblkStop()"];
|
stop -> stop [label="\nblkStop()"];
|
||||||
stop -> ready [label="\nblkStart()"];
|
stop -> active [label="\nblkStart()"];
|
||||||
ready -> stop [label="\nblkStop()"];
|
active -> stop [label="\nblkStop()"];
|
||||||
ready -> ready [label="\nblkStart()\nblkDisconnect()"];
|
active -> active [label="\nblkStart()\nblkDisconnect()"];
|
||||||
ready -> connecting [label="\nblkConnect()"];
|
active -> connecting [label="\nblkConnect()"];
|
||||||
connecting -> active [label="\nconnection\nsuccessful"];
|
connecting -> ready [label="\nconnection\nsuccessful"];
|
||||||
connecting -> active [label="\nblkConnect()", dir="back"];
|
connecting -> ready [label="\nblkConnect()", dir="back"];
|
||||||
connecting -> ready [label="\nconnection\nfailed"];
|
connecting -> active [label="\nconnection\nfailed"];
|
||||||
disconnecting -> active [label="\nblkDisconnect()", dir="back"];
|
disconnecting -> ready [label="\nblkDisconnect()", dir="back"];
|
||||||
ready -> disconnecting [label="\ndisconnection\nfinished", dir="back"];
|
active -> disconnecting [label="\ndisconnection\nfinished", dir="back"];
|
||||||
active -> reading [label="\nblkRead()"];
|
ready -> reading [label="\nblkRead()"];
|
||||||
reading -> active [label="\nread finished\nread error"];
|
reading -> ready [label="\nread finished\nread error"];
|
||||||
active -> writing [label="\nblkWrite()"];
|
ready -> writing [label="\nblkWrite()"];
|
||||||
writing -> active [label="\nwrite finished\nwrite error"];
|
writing -> ready [label="\nwrite finished\nwrite error"];
|
||||||
}
|
}
|
||||||
* @enddot
|
* @enddot
|
||||||
* @else
|
* @else
|
||||||
|
@ -73,28 +73,31 @@
|
||||||
|
|
||||||
stop [label="BLK_STOP\nLow Power"];
|
stop [label="BLK_STOP\nLow Power"];
|
||||||
uninit [label="BLK_UNINIT", style="bold"];
|
uninit [label="BLK_UNINIT", style="bold"];
|
||||||
ready [label="BLK_READY\nClock Enabled"];
|
active [label="BLK_ACTIVE\nClock Enabled"];
|
||||||
connecting [label="BLK_CONN.ING\nConnecting"];
|
connecting [label="BLK_CONN.ING\nConnecting"];
|
||||||
disconnecting [label="BLK_DISC.ING\nDisconnecting"];
|
disconnecting [label="BLK_DISC.ING\nDisconnecting"];
|
||||||
active [label="BLK_ACTIVE\nCard Ready"];
|
ready [label="BLK_READY\nCard Ready"];
|
||||||
reading [label="BLK_READING\nReading"];
|
reading [label="BLK_READING\nReading"];
|
||||||
writing [label="BLK_WRITING\nWriting"];
|
writing [label="BLK_WRITING\nWriting"];
|
||||||
|
syncing [label="BLK_SYNCING\nSynchronizing"];
|
||||||
|
|
||||||
uninit -> stop [label=" blkInit()", constraint=false];
|
uninit -> stop [label=" blkInit()", constraint=false];
|
||||||
stop -> stop [label="\nblkStop()"];
|
stop -> stop [label="\nblkStop()"];
|
||||||
stop -> ready [label="\nblkStart()"];
|
stop -> active [label="\nblkStart()"];
|
||||||
ready -> stop [label="\nblkStop()"];
|
active -> stop [label="\nblkStop()"];
|
||||||
ready -> ready [label="\nblkStart()\nblkDisconnect()"];
|
active -> active [label="\nblkStart()\nblkDisconnect()"];
|
||||||
ready -> connecting [label="\nblkConnect()"];
|
active -> connecting [label="\nblkConnect()"];
|
||||||
connecting -> active [label="\nconnection\nsuccessful"];
|
connecting -> ready [label="\nconnection\nsuccessful"];
|
||||||
connecting -> active [label="\nblkConnect()", dir="back"];
|
connecting -> ready [label="\nblkConnect()", dir="back"];
|
||||||
connecting -> ready [label="\nconnection\nfailed"];
|
connecting -> active [label="\nconnection\nfailed"];
|
||||||
disconnecting -> active [label="\nblkDisconnect()", dir="back"];
|
disconnecting -> ready [label="\nblkDisconnect()", dir="back"];
|
||||||
ready -> disconnecting [label="\ndisconnection\nfinished", dir="back"];
|
active -> disconnecting [label="\ndisconnection\nfinished", dir="back"];
|
||||||
active -> reading [label="\nblkRead()"];
|
ready -> reading [label="\nblkRead()"];
|
||||||
reading -> active [label="\nread finished\nread error"];
|
reading -> ready [label="\nread finished\nread error"];
|
||||||
active -> writing [label="\nblkWrite()"];
|
ready -> writing [label="\nblkWrite()"];
|
||||||
writing -> active [label="\nwrite finished\nwrite error"];
|
writing -> ready [label="\nwrite finished\nwrite error"];
|
||||||
|
ready -> syncing [label="\nblkSync()"];
|
||||||
|
syncing -> ready [label="\nsynchronization finished"];
|
||||||
}
|
}
|
||||||
* @enddot
|
* @enddot
|
||||||
* @endif
|
* @endif
|
||||||
|
|
|
@ -49,7 +49,8 @@ typedef enum {
|
||||||
BLK_DISCONNECTING = 4, /**< Disconnection in progress. */
|
BLK_DISCONNECTING = 4, /**< Disconnection in progress. */
|
||||||
BLK_READY = 5, /**< Device ready. */
|
BLK_READY = 5, /**< Device ready. */
|
||||||
BLK_READING = 6, /**< Read operation in progress. */
|
BLK_READING = 6, /**< Read operation in progress. */
|
||||||
BLK_WRITING = 7 /**< Write operation in progress. */
|
BLK_WRITING = 7, /**< Write operation in progress. */
|
||||||
|
BLK_SYNCING = 8 /**< Sync. operation in progress. */
|
||||||
} blkstate_t;
|
} blkstate_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -600,6 +600,7 @@ bool_t mmcStartSequentialRead(MMCDriver *mmcp, uint32_t startblk) {
|
||||||
|
|
||||||
if (recvr1(mmcp) != 0x00) {
|
if (recvr1(mmcp) != 0x00) {
|
||||||
spiStop(mmcp->config->spip);
|
spiStop(mmcp->config->spip);
|
||||||
|
mmcp->state = BLK_READY;
|
||||||
return CH_FAILED;
|
return CH_FAILED;
|
||||||
}
|
}
|
||||||
return CH_SUCCESS;
|
return CH_SUCCESS;
|
||||||
|
@ -637,6 +638,7 @@ bool_t mmcSequentialRead(MMCDriver *mmcp, uint8_t *buffer) {
|
||||||
/* Timeout.*/
|
/* Timeout.*/
|
||||||
spiUnselect(mmcp->config->spip);
|
spiUnselect(mmcp->config->spip);
|
||||||
spiStop(mmcp->config->spip);
|
spiStop(mmcp->config->spip);
|
||||||
|
mmcp->state = BLK_READY;
|
||||||
return CH_FAILED;
|
return CH_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -702,6 +704,7 @@ bool_t mmcStartSequentialWrite(MMCDriver *mmcp, uint32_t startblk) {
|
||||||
|
|
||||||
if (recvr1(mmcp) != 0x00) {
|
if (recvr1(mmcp) != 0x00) {
|
||||||
spiStop(mmcp->config->spip);
|
spiStop(mmcp->config->spip);
|
||||||
|
mmcp->state = BLK_READY;
|
||||||
return CH_FAILED;
|
return CH_FAILED;
|
||||||
}
|
}
|
||||||
return CH_SUCCESS;
|
return CH_SUCCESS;
|
||||||
|
@ -740,6 +743,7 @@ bool_t mmcSequentialWrite(MMCDriver *mmcp, const uint8_t *buffer) {
|
||||||
/* Error.*/
|
/* Error.*/
|
||||||
spiUnselect(mmcp->config->spip);
|
spiUnselect(mmcp->config->spip);
|
||||||
spiStop(mmcp->config->spip);
|
spiStop(mmcp->config->spip);
|
||||||
|
mmcp->state = BLK_READY;
|
||||||
return CH_FAILED;
|
return CH_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -788,8 +792,14 @@ bool_t mmcSync(MMCDriver *mmcp) {
|
||||||
if (mmcp->state != BLK_READY)
|
if (mmcp->state != BLK_READY)
|
||||||
return CH_FAILED;
|
return CH_FAILED;
|
||||||
|
|
||||||
|
/* Synchronization operation in progress.*/
|
||||||
|
mmcp->state = BLK_SYNCING;
|
||||||
|
|
||||||
spiStart(mmcp->config->spip, mmcp->config->hscfg);
|
spiStart(mmcp->config->spip, mmcp->config->hscfg);
|
||||||
sync(mmcp);
|
sync(mmcp);
|
||||||
|
|
||||||
|
/* Synchronization operation finished.*/
|
||||||
|
mmcp->state = BLK_READY;
|
||||||
return CH_SUCCESS;
|
return CH_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -835,6 +845,9 @@ bool_t mmcErase(MMCDriver *mmcp, uint32_t startblk, uint32_t endblk) {
|
||||||
|
|
||||||
chDbgCheck((mmcp != NULL), "mmcErase");
|
chDbgCheck((mmcp != NULL), "mmcErase");
|
||||||
|
|
||||||
|
/* Erase operation in progress.*/
|
||||||
|
mmcp->state = BLK_WRITING;
|
||||||
|
|
||||||
/* Handling command differences between HC and normal cards.*/
|
/* Handling command differences between HC and normal cards.*/
|
||||||
if (!mmcp->block_addresses) {
|
if (!mmcp->block_addresses) {
|
||||||
startblk *= MMCSD_BLOCK_SIZE;
|
startblk *= MMCSD_BLOCK_SIZE;
|
||||||
|
@ -850,11 +863,13 @@ bool_t mmcErase(MMCDriver *mmcp, uint32_t startblk, uint32_t endblk) {
|
||||||
if (send_command_R1(mmcp, MMCSD_CMD_ERASE, 0))
|
if (send_command_R1(mmcp, MMCSD_CMD_ERASE, 0))
|
||||||
goto failed;
|
goto failed;
|
||||||
|
|
||||||
|
mmcp->state = BLK_READY;
|
||||||
return CH_SUCCESS;
|
return CH_SUCCESS;
|
||||||
|
|
||||||
/* Command failed, state reset to BLK_ACTIVE.*/
|
/* Command failed, state reset to BLK_ACTIVE.*/
|
||||||
failed:
|
failed:
|
||||||
spiStop(mmcp->config->spip);
|
spiStop(mmcp->config->spip);
|
||||||
|
mmcp->state = BLK_READY;
|
||||||
return CH_FAILED;
|
return CH_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -468,13 +468,21 @@ sdcflags_t sdcGetAndClearErrors(SDCDriver *sdcp) {
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
bool_t sdcSync(SDCDriver *sdcp) {
|
bool_t sdcSync(SDCDriver *sdcp) {
|
||||||
|
bool_t result;
|
||||||
|
|
||||||
chDbgCheck(sdcp != NULL, "sdcSync");
|
chDbgCheck(sdcp != NULL, "sdcSync");
|
||||||
|
|
||||||
if (sdcp->state != BLK_READY)
|
if (sdcp->state != BLK_READY)
|
||||||
return CH_FAILED;
|
return CH_FAILED;
|
||||||
|
|
||||||
return sdc_lld_sync(sdcp);
|
/* Synchronization operation in progress.*/
|
||||||
|
sdcp->state = BLK_SYNCING;
|
||||||
|
|
||||||
|
result = sdc_lld_sync(sdcp);
|
||||||
|
|
||||||
|
/* Synchronization operation finished.*/
|
||||||
|
sdcp->state = BLK_READY;
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -522,6 +530,9 @@ bool_t sdcErase(SDCDriver *sdcp, uint32_t startblk, uint32_t endblk) {
|
||||||
chDbgCheck((sdcp != NULL), "sdcErase");
|
chDbgCheck((sdcp != NULL), "sdcErase");
|
||||||
chDbgAssert(sdcp->state == BLK_READY, "sdcErase(), #1", "invalid state");
|
chDbgAssert(sdcp->state == BLK_READY, "sdcErase(), #1", "invalid state");
|
||||||
|
|
||||||
|
/* Erase operation in progress.*/
|
||||||
|
sdcp->state = BLK_WRITING;
|
||||||
|
|
||||||
/* Handling command differences between HC and normal cards.*/
|
/* Handling command differences between HC and normal cards.*/
|
||||||
if (!(sdcp->cardmode & SDC_MODE_HIGH_CAPACITY)) {
|
if (!(sdcp->cardmode & SDC_MODE_HIGH_CAPACITY)) {
|
||||||
startblk *= MMCSD_BLOCK_SIZE;
|
startblk *= MMCSD_BLOCK_SIZE;
|
||||||
|
@ -533,17 +544,17 @@ bool_t sdcErase(SDCDriver *sdcp, uint32_t startblk, uint32_t endblk) {
|
||||||
if ((sdc_lld_send_cmd_short_crc(sdcp, MMCSD_CMD_ERASE_RW_BLK_START,
|
if ((sdc_lld_send_cmd_short_crc(sdcp, MMCSD_CMD_ERASE_RW_BLK_START,
|
||||||
startblk, resp) != CH_SUCCESS) ||
|
startblk, resp) != CH_SUCCESS) ||
|
||||||
MMCSD_R1_ERROR(resp[0]))
|
MMCSD_R1_ERROR(resp[0]))
|
||||||
return CH_FAILED;
|
goto failed;
|
||||||
|
|
||||||
if ((sdc_lld_send_cmd_short_crc(sdcp, MMCSD_CMD_ERASE_RW_BLK_END,
|
if ((sdc_lld_send_cmd_short_crc(sdcp, MMCSD_CMD_ERASE_RW_BLK_END,
|
||||||
endblk, resp) != CH_SUCCESS) ||
|
endblk, resp) != CH_SUCCESS) ||
|
||||||
MMCSD_R1_ERROR(resp[0]))
|
MMCSD_R1_ERROR(resp[0]))
|
||||||
return CH_FAILED;
|
goto failed;
|
||||||
|
|
||||||
if ((sdc_lld_send_cmd_short_crc(sdcp, MMCSD_CMD_ERASE,
|
if ((sdc_lld_send_cmd_short_crc(sdcp, MMCSD_CMD_ERASE,
|
||||||
0, resp) != CH_SUCCESS) ||
|
0, resp) != CH_SUCCESS) ||
|
||||||
MMCSD_R1_ERROR(resp[0]))
|
MMCSD_R1_ERROR(resp[0]))
|
||||||
return CH_FAILED;
|
goto failed;
|
||||||
|
|
||||||
/* Quick sleep to allow it to transition to programming or receiving state */
|
/* Quick sleep to allow it to transition to programming or receiving state */
|
||||||
/* TODO: ??????????????????????????? */
|
/* TODO: ??????????????????????????? */
|
||||||
|
@ -552,6 +563,10 @@ bool_t sdcErase(SDCDriver *sdcp, uint32_t startblk, uint32_t endblk) {
|
||||||
_sdc_wait_for_transfer_state(sdcp);
|
_sdc_wait_for_transfer_state(sdcp);
|
||||||
|
|
||||||
return CH_SUCCESS;
|
return CH_SUCCESS;
|
||||||
|
|
||||||
|
failed:
|
||||||
|
sdcp->state = BLK_READY;
|
||||||
|
return CH_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* HAL_USE_SDC */
|
#endif /* HAL_USE_SDC */
|
||||||
|
|
|
@ -85,6 +85,7 @@
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
|
|
||||||
*** 2.5.2 ***
|
*** 2.5.2 ***
|
||||||
|
- FIX: Fixed errors in MMC_SPI driver state machine (bug 3605794).
|
||||||
- FIX: Fixed deadlock in Serial_USB driver (bug 3605793).
|
- FIX: Fixed deadlock in Serial_USB driver (bug 3605793).
|
||||||
- FIX: Fixed compile Error OLIMEX_SAM7_EX256/board.c (bug 3605058).
|
- FIX: Fixed compile Error OLIMEX_SAM7_EX256/board.c (bug 3605058).
|
||||||
- FIX: Fixed bug prevents calling adcStartConversionI() within ISR (bug
|
- FIX: Fixed bug prevents calling adcStartConversionI() within ISR (bug
|
||||||
|
|
Loading…
Reference in New Issue