diff options
| author | Bernard Xiong <[email protected]> | 2017-09-15 14:00:04 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2017-09-15 14:00:04 +0800 |
| commit | 7b4e7224e4fba7080c33ebf11b45dc9b093a73d6 (patch) | |
| tree | 21031711721589307d66d12ca2b840e36756c434 | |
| parent | 0d193254f8600a36b5df604974beccf7491572e2 (diff) | |
| parent | 44e3a56d91674b727dc3c97feb66833c42072523 (diff) | |
Merge pull request #846 from liu2guang/master
[BSP] Fix the int type range issue of SD in stm32f429 bsp.
| -rw-r--r-- | bsp/stm32f429-apollo/drivers/drv_sdio_sd.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/bsp/stm32f429-apollo/drivers/drv_sdio_sd.c b/bsp/stm32f429-apollo/drivers/drv_sdio_sd.c index 5e160ae669..e1716be0de 100644 --- a/bsp/stm32f429-apollo/drivers/drv_sdio_sd.c +++ b/bsp/stm32f429-apollo/drivers/drv_sdio_sd.c @@ -242,10 +242,10 @@ static rt_size_t rt_sdcard_read(rt_device_t dev, rt_off_t pos, void* buffer, rt_ { /* non-aligned. */ uint32_t i; - rt_size_t sector_adr; + uint64_t sector_adr; uint8_t* copy_buffer; - sector_adr = pos*SECTOR_SIZE; + sector_adr = (uint64_t)pos*SECTOR_SIZE; copy_buffer = (uint8_t*)buffer; for(i=0; i<size; i++) @@ -263,9 +263,9 @@ static rt_size_t rt_sdcard_read(rt_device_t dev, rt_off_t pos, void* buffer, rt_ else { #if (SD_DMA_MODE==1) - status=SD_ReadBlocks_DMA(buffer,pos*SECTOR_SIZE,size);//ͨ��DMAдSD��һ������ + status=SD_ReadBlocks_DMA(buffer,(uint64_t)pos*SECTOR_SIZE,size);//ͨ��DMAдSD��һ������ #else - SD_ReadBlocks(buffer,pos*SECTOR_SIZE,size); + SD_ReadBlocks(buffer,(uint64_t)pos*SECTOR_SIZE,size); #endif } @@ -286,10 +286,10 @@ static rt_size_t rt_sdcard_write (rt_device_t dev, rt_off_t pos, const void* buf { /* non-aligned. */ uint32_t i; - rt_size_t sector_adr; + uint64_t sector_adr; uint8_t* copy_buffer; - sector_adr = pos*SECTOR_SIZE; + sector_adr = (uint64_t)pos*SECTOR_SIZE; copy_buffer = (uint8_t*)buffer; for(i=0; i<size; i++) @@ -308,9 +308,9 @@ static rt_size_t rt_sdcard_write (rt_device_t dev, rt_off_t pos, const void* buf else { #if (SD_DMA_MODE==1) - status=SD_WriteBlocks_DMA((uint32_t*)buffer,pos*SECTOR_SIZE,size); + status=SD_WriteBlocks_DMA((uint32_t*)buffer,(uint64_t)pos*SECTOR_SIZE,size); #else - status=SD_WriteBlocks((uint32_t*)buffer,pos*SECTOR_SIZE,size); + status=SD_WriteBlocks((uint32_t*)buffer,(uint64_t)pos*SECTOR_SIZE,size); #endif } // } |
