diff options
| author | Damien George <damien.p.george@gmail.com> | 2018-09-11 17:23:03 +1000 |
|---|---|---|
| committer | Damien George <damien.p.george@gmail.com> | 2018-09-11 17:23:27 +1000 |
| commit | c26516d40fc8bda4e083e3f8c222fccd358a957a (patch) | |
| tree | e53743ae88239f1e8a5c543bb75fa2cf4daa9cb8 | |
| parent | e4f7001d9c4880a4f60349aef0b0786ca95584d4 (diff) | |
stm32/sdcard: Move temporary DMA state from BSS to stack.
| -rw-r--r-- | ports/stm32/sdcard.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/ports/stm32/sdcard.c b/ports/stm32/sdcard.c index 2282624cf..f8450da9e 100644 --- a/ports/stm32/sdcard.c +++ b/ports/stm32/sdcard.c @@ -129,9 +129,6 @@ // if an sd card is detected. This will save approx 260 bytes of RAM // when no sdcard was being used. static SD_HandleTypeDef sd_handle; -#if SDIO_USE_GPDMA -static DMA_HandleTypeDef sd_rx_dma, sd_tx_dma; -#endif void sdcard_init(void) { // invalidate the sd_handle @@ -334,8 +331,9 @@ mp_uint_t sdcard_read_blocks(uint8_t *dest, uint32_t block_num, uint32_t num_blo uint32_t basepri = raise_irq_pri(IRQ_PRI_OTG_FS); #if SDIO_USE_GPDMA - dma_init(&sd_rx_dma, &SDMMC_DMA, DMA_PERIPH_TO_MEMORY, &sd_handle); - sd_handle.hdmarx = &sd_rx_dma; + DMA_HandleTypeDef sd_dma; + dma_init(&sd_dma, &SDMMC_DMA, DMA_PERIPH_TO_MEMORY, &sd_handle); + sd_handle.hdmarx = &sd_dma; #endif // make sure cache is flushed and invalidated so when DMA updates the RAM @@ -400,8 +398,9 @@ mp_uint_t sdcard_write_blocks(const uint8_t *src, uint32_t block_num, uint32_t n uint32_t basepri = raise_irq_pri(IRQ_PRI_OTG_FS); #if SDIO_USE_GPDMA - dma_init(&sd_tx_dma, &SDMMC_DMA, DMA_MEMORY_TO_PERIPH, &sd_handle); - sd_handle.hdmatx = &sd_tx_dma; + DMA_HandleTypeDef sd_dma; + dma_init(&sd_dma, &SDMMC_DMA, DMA_MEMORY_TO_PERIPH, &sd_handle); + sd_handle.hdmatx = &sd_dma; #endif // make sure cache is flushed to RAM so the DMA can read the correct data |
