diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2013-10-23 14:05:26 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2013-10-23 14:05:26 -0600 |
commit | ea1d13c06259f41abdd00ce73a0a32a25ef56d34 (patch) | |
tree | 27e837916d77d783986cdfc5d15f113b8c54edd0 | |
parent | ff5a167b644b5974017a4758f3d38f9bb522b012 (diff) | |
download | px4-nuttx-ea1d13c06259f41abdd00ce73a0a32a25ef56d34.tar.gz px4-nuttx-ea1d13c06259f41abdd00ce73a0a32a25ef56d34.tar.bz2 px4-nuttx-ea1d13c06259f41abdd00ce73a0a32a25ef56d34.zip |
STM32 F1 DAM fix from David Sidrane
-rw-r--r-- | nuttx/ChangeLog | 3 | ||||
-rw-r--r-- | nuttx/arch/arm/src/stm32/stm32f10xxx_dma.c | 15 |
2 files changed, 15 insertions, 3 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 027d1639c..46dc95a2e 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -5854,4 +5854,7 @@ ARCH_HAVE_NET that determines if a network is present or not. This currently can happen if CONFIG_NET is set or if CONFIG_WL_CC3000 is is set (23013-10-23). + * arch/arm/src/stm32/stm32f10xxx_dma.c: DMA fix from David Sidrane: + The DMA_CNDTRx register cannot be modified if the DMA channel is + disabled (2013-10-23). diff --git a/nuttx/arch/arm/src/stm32/stm32f10xxx_dma.c b/nuttx/arch/arm/src/stm32/stm32f10xxx_dma.c index 01d697e87..c92db5dce 100644 --- a/nuttx/arch/arm/src/stm32/stm32f10xxx_dma.c +++ b/nuttx/arch/arm/src/stm32/stm32f10xxx_dma.c @@ -457,11 +457,20 @@ void stm32_dmafree(DMA_HANDLE handle) * ****************************************************************************/ -void stm32_dmasetup(DMA_HANDLE handle, uint32_t paddr, uint32_t maddr, size_t ntransfers, uint32_t ccr) +void stm32_dmasetup(DMA_HANDLE handle, uint32_t paddr, uint32_t maddr, + size_t ntransfers, uint32_t ccr) { struct stm32_dma_s *dmach = (struct stm32_dma_s *)handle; uint32_t regval; + /* Then DMA_CNDTRx register can only be modified if the DMA channel is + * disabled. + */ + + regval = dmachan_getreg(dmach, STM32_DMACHAN_CCR_OFFSET); + regval &= ~(DMA_CCR_EN); + dmachan_putreg(dmach, STM32_DMACHAN_CCR_OFFSET, regval); + /* Set the peripheral register address in the DMA_CPARx register. The data * will be moved from/to this address to/from the memory after the * peripheral event. @@ -508,7 +517,8 @@ void stm32_dmasetup(DMA_HANDLE handle, uint32_t paddr, uint32_t maddr, size_t nt * ****************************************************************************/ -void stm32_dmastart(DMA_HANDLE handle, dma_callback_t callback, void *arg, bool half) +void stm32_dmastart(DMA_HANDLE handle, dma_callback_t callback, + void *arg, bool half) { struct stm32_dma_s *dmach = (struct stm32_dma_s *)handle; uint32_t ccr; @@ -542,7 +552,6 @@ void stm32_dmastart(DMA_HANDLE handle, dma_callback_t callback, void *arg, bool */ ccr |= (half ? (DMA_CCR_HTIE|DMA_CCR_TEIE) : (DMA_CCR_TCIE|DMA_CCR_TEIE)); - } else { |