git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2916 35acf78f-673a-0410-8e92-d51de3d6d3f4

master
gdisirio 2011-05-02 19:49:35 +00:00
parent 31456cb4fe
commit f6ed2f2a84
3 changed files with 18 additions and 5 deletions

View File

@ -75,6 +75,7 @@ CH_IRQ_HANDLER(SDIO_IRQHandler) {
void sdc_lld_init(void) {
sdcObjectInit(&SDCD1);
SDCD1.thread = NULL;
}
/**
@ -315,8 +316,16 @@ bool_t sdc_lld_send_cmd_long_crc(SDCDriver *sdcp, uint8_t cmd, uint32_t arg,
* @notapi
*/
bool_t sdc_lld_read_blocks(SDCDriver *sdcp, uint8_t *buf, uint32_t n) {
msg_t msg;
return TRUE;
chSysLock();
chDbgAssert(sdcp->thread == NULL, "sdc_lld_read_blocks(), #1", "not NULL");
sdcp->thread = chThdSelf();
chSchGoSleepS(THD_STATE_SUSPENDED);
chDbgAssert(sdcp->thread == NULL, "sdc_lld_read_blocks(), #2", "not NULL");
msg = chThdSelf()->p_u.rdymsg;
chSysUnlock();
return msg != RDY_OK;
}
/**

View File

@ -141,6 +141,10 @@ struct SDCDriver {
*/
uint32_t csd[4];
/* End of the mandatory fields.*/
/**
* @brief Tthread waiting for I/O completion IRQ.
*/
Thread *thread;
};
/*===========================================================================*/

View File

@ -270,7 +270,7 @@ bool_t sdcRead(SDCDriver *sdcp, uint32_t startblk,
bool_t sts;
uint32_t resp[1];
chDbgCheck((sdcp != NULL) && (buffer != NULL) && (n > 0), "sdcRead");
chDbgCheck((sdcp != NULL) && (buf != NULL) && (n > 0), "sdcRead");
if ((sdcp->cardmode & SDC_MODE_HIGH_CAPACITY) == 0)
startblk *= SDC_BLOCK_SIZE;
@ -279,7 +279,7 @@ bool_t sdcRead(SDCDriver *sdcp, uint32_t startblk,
startblk, resp))
return TRUE;
sts = sdc_lld_read_blocks(sdcp, buffer, n);
sts = sdc_lld_read_blocks(sdcp, buf, n);
sts = sts || sdc_lld_send_cmd_short_crc(sdcp, SDC_CMD_STOP_TRANSMISSION,
0, resp);
return sts;
@ -306,7 +306,7 @@ bool_t sdcWrite(SDCDriver *sdcp, uint32_t startblk,
bool_t sts;
uint32_t resp[1];
chDbgCheck((sdcp != NULL) && (buffer != NULL) && (n > 0), "sdcWrite");
chDbgCheck((sdcp != NULL) && (buf != NULL) && (n > 0), "sdcWrite");
if ((sdcp->cardmode & SDC_MODE_HIGH_CAPACITY) == 0)
startblk *= SDC_BLOCK_SIZE;
@ -315,7 +315,7 @@ bool_t sdcWrite(SDCDriver *sdcp, uint32_t startblk,
startblk, resp))
return TRUE;
sts = sdc_lld_write_blocks(sdcp, buffer, n);
sts = sdc_lld_write_blocks(sdcp, buf, n);
sts = sts || sdc_lld_send_cmd_short_crc(sdcp, SDC_CMD_STOP_TRANSMISSION,
0, resp);
return sts;