This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit d26212bd39ec5893e28732da343f7a1dfe290a1f
Author: Tiago Medicci Serrano <[email protected]>
AuthorDate: Wed Aug 23 16:44:54 2023 -0300

    esp32s3/dma: Fix loading the DMA descriptor address
    
    The macro `SET_BITS` only sets the bits according to the bit mask
    and, once it's being used to set the address field of the GDMA
    inlink/outlink register, it's necessary to clean all the bits
    corresponding to that field that were eventually setup previously
    to avoid messing with the bits that correspond to the current
    address being setup.
---
 arch/xtensa/src/esp32s3/esp32s3_dma.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/xtensa/src/esp32s3/esp32s3_dma.c 
b/arch/xtensa/src/esp32s3/esp32s3_dma.c
index 1db65f1cb7..6381459c5f 100644
--- a/arch/xtensa/src/esp32s3/esp32s3_dma.c
+++ b/arch/xtensa/src/esp32s3/esp32s3_dma.c
@@ -242,6 +242,7 @@ uint32_t esp32s3_dma_setup(int chan, bool tx,
       /* Set the descriptor link base address for TX channel */
 
       regval = (uint32_t)dmadesc & DMA_OUTLINK_ADDR_CH0;
+      CLR_BITS(DMA_OUT_LINK_CH0_REG, chan, DMA_OUTLINK_ADDR_CH0);
       SET_BITS(DMA_OUT_LINK_CH0_REG, chan, regval);
     }
   else
@@ -254,6 +255,7 @@ uint32_t esp32s3_dma_setup(int chan, bool tx,
       /* Set the descriptor link base address for RX channel */
 
       regval = (uint32_t)dmadesc & DMA_INLINK_ADDR_CH0;
+      CLR_BITS(DMA_IN_LINK_CH0_REG, chan, DMA_INLINK_ADDR_CH0);
       SET_BITS(DMA_IN_LINK_CH0_REG, chan, regval);
     }
 

Reply via email to