From 67faf9224512b9fd56a46de5e78dc537fc58eb07 Mon Sep 17 00:00:00 2001 From: "bernard.xiong" Date: Mon, 29 Mar 2010 12:45:02 +0000 Subject: [PATCH] change SD_DATATIMEOUT to 0xFFFFFFFF. git-svn-id: https://rt-thread.googlecode.com/svn/trunk@548 bbd45198-f89e-11dd-88c7-29a3b14d5316 --- bsp/stm3210/sdcard.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/bsp/stm3210/sdcard.c b/bsp/stm3210/sdcard.c index 2a8aa35c71..c09bc201b5 100644 --- a/bsp/stm3210/sdcard.c +++ b/bsp/stm3210/sdcard.c @@ -80,7 +80,7 @@ #define SD_CARD_LOCKED ((uint32_t)0x02000000) #define SD_CARD_PROGRAMMING ((uint32_t)0x00000007) #define SD_CARD_RECEIVING ((uint32_t)0x00000006) -#define SD_DATATIMEOUT ((uint32_t)0x000FFFFF) +#define SD_DATATIMEOUT ((uint32_t)0xFFFFFFFF) #define SD_0TO7BITS ((uint32_t)0x000000FF) #define SD_8TO15BITS ((uint32_t)0x0000FF00) #define SD_16TO23BITS ((uint32_t)0x00FF0000) @@ -956,16 +956,16 @@ SD_Error SD_ReadBlock(uint32_t addr, uint32_t *readbuff, uint16_t BlockSize) else if (DeviceMode == SD_DMA_MODE) { rt_tick_t tick; - + SDIO_ITConfig(SDIO_IT_DCRCFAIL | SDIO_IT_DTIMEOUT | SDIO_IT_DATAEND | SDIO_IT_RXOVERR | SDIO_IT_STBITERR, ENABLE); SDIO_DMACmd(ENABLE); tick = rt_tick_get(); DMA_RxConfiguration(readbuff, BlockSize); while (DMA_GetFlagStatus(DMA2_FLAG_TC4) == RESET) - { + { if ((TransferError != SD_OK) || (rt_tick_get() - tick > 10)) - { - errorstatus = SD_ERROR; + { + errorstatus = SD_ERROR; // rt_kprintf("sd error\n"); break; } @@ -1164,16 +1164,16 @@ SD_Error SD_ReadMultiBlocks(uint32_t addr, uint32_t *readbuff, uint16_t BlockSiz else if (DeviceMode == SD_DMA_MODE) { rt_tick_t tick; - + SDIO_ITConfig(SDIO_IT_DCRCFAIL | SDIO_IT_DTIMEOUT | SDIO_IT_DATAEND | SDIO_IT_RXOVERR | SDIO_IT_STBITERR, ENABLE); SDIO_DMACmd(ENABLE); tick = rt_tick_get(); DMA_RxConfiguration(readbuff, (NumberOfBlocks * BlockSize)); while (DMA_GetFlagStatus(DMA2_FLAG_TC4) == RESET) - { + { if ((TransferError != SD_OK) || (rt_tick_get() - tick > 10)) - { - errorstatus = SD_ERROR; + { + errorstatus = SD_ERROR; // rt_kprintf("sd error\n"); return errorstatus; }