SDC optimizations.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2935 35acf78f-673a-0410-8e92-d51de3d6d3f4
master
gdisirio 2011-05-08 10:02:48 +00:00
parent 82f529d70e
commit d3af6e7b16
1 changed files with 4 additions and 8 deletions

View File

@ -375,6 +375,7 @@ bool_t sdc_lld_read(SDCDriver *sdcp, uint32_t startblk,
} }
} }
else { else {
SDIO->MASK = 0;
if ((SDIO->STA & SDIO_STA_DATAEND) == 0) { if ((SDIO->STA & SDIO_STA_DATAEND) == 0) {
chSysUnlock(); chSysUnlock();
goto error; goto error;
@ -382,13 +383,10 @@ bool_t sdc_lld_read(SDCDriver *sdcp, uint32_t startblk,
} }
dmaDisableChannel(STM32_DMA2, STM32_DMA_CHANNEL_4); dmaDisableChannel(STM32_DMA2, STM32_DMA_CHANNEL_4);
SDIO->ICR = 0xFFFFFFFF; SDIO->ICR = 0xFFFFFFFF;
SDIO->MASK = 0;
SDIO->DCTRL = 0; SDIO->DCTRL = 0;
chSysUnlock(); chSysUnlock();
if (sdc_lld_send_cmd_short_crc(sdcp, SDC_CMD_STOP_TRANSMISSION, 0, resp)) return sdc_lld_send_cmd_short_crc(sdcp, SDC_CMD_STOP_TRANSMISSION, 0, resp);
goto error;
return FALSE;
error: error:
dmaDisableChannel(STM32_DMA2, STM32_DMA_CHANNEL_4); dmaDisableChannel(STM32_DMA2, STM32_DMA_CHANNEL_4);
SDIO->ICR = 0xFFFFFFFF; SDIO->ICR = 0xFFFFFFFF;
@ -454,6 +452,7 @@ bool_t sdc_lld_write(SDCDriver *sdcp, uint32_t startblk,
} }
} }
else { else {
SDIO->MASK = 0;
if ((SDIO->STA & SDIO_STA_DATAEND) == 0) { if ((SDIO->STA & SDIO_STA_DATAEND) == 0) {
chSysUnlock(); chSysUnlock();
goto error; goto error;
@ -461,13 +460,10 @@ bool_t sdc_lld_write(SDCDriver *sdcp, uint32_t startblk,
} }
dmaDisableChannel(STM32_DMA2, STM32_DMA_CHANNEL_4); dmaDisableChannel(STM32_DMA2, STM32_DMA_CHANNEL_4);
SDIO->ICR = 0xFFFFFFFF; SDIO->ICR = 0xFFFFFFFF;
SDIO->MASK = 0;
SDIO->DCTRL = 0; SDIO->DCTRL = 0;
chSysUnlock(); chSysUnlock();
if (sdc_lld_send_cmd_short_crc(sdcp, SDC_CMD_STOP_TRANSMISSION, 0, resp)) return sdc_lld_send_cmd_short_crc(sdcp, SDC_CMD_STOP_TRANSMISSION, 0, resp);
goto error;
return FALSE;
error: error:
dmaDisableChannel(STM32_DMA2, STM32_DMA_CHANNEL_4); dmaDisableChannel(STM32_DMA2, STM32_DMA_CHANNEL_4);
SDIO->ICR = 0xFFFFFFFF; SDIO->ICR = 0xFFFFFFFF;