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

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

commit 49f153abb13f411e1ba3b8345b9e0b86b44bfbf4
Author: Michal Lenc <[email protected]>
AuthorDate: Mon Jul 3 12:42:06 2023 +0200

    samv7/sam_xdmac.c: use sam_freelinklist only if circular buffer not used
    
    Circular buffer does not use DMA linked list therefore function
    sam_freelinklist() cannot be called as it would fail on assertion (csa
    not defined). Peripheral that calls DMA should care of buffer invalidation
    instead.
    
    Signed-off-by: Michal Lenc <[email protected]>
---
 arch/arm/src/samv7/sam_xdmac.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/arm/src/samv7/sam_xdmac.c b/arch/arm/src/samv7/sam_xdmac.c
index 21b8b00704..1daa39cc6a 100644
--- a/arch/arm/src/samv7/sam_xdmac.c
+++ b/arch/arm/src/samv7/sam_xdmac.c
@@ -1427,9 +1427,14 @@ static void sam_dmaterminate(struct sam_xdmach_s 
*xdmach, int result)
   sam_putdmac(xdmac, chanbit, SAM_XDMAC_GD_OFFSET);
   while ((sam_getdmac(xdmac, SAM_XDMAC_GS_OFFSET) & chanbit) != 0);
 
-  /* Free the linklist */
+  /* Free the linklist. Circular buffers do not use link list so any free
+   * operation should be handled in peripheral driver that calls DMA.
+   */
 
-  sam_freelinklist(xdmach);
+  if (!xdmach->circular)
+    {
+      sam_freelinklist(xdmach);
+    }
 
   /* Perform the DMA complete callback */
 

Reply via email to