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 <michallenc@seznam.cz>
This commit is contained in:
Michal Lenc 2023-07-03 12:42:06 +02:00 committed by Petro Karashchenko
parent 63ac8fbdfd
commit 49f153abb1

View File

@ -1427,9 +1427,14 @@ static void sam_dmaterminate(struct sam_xdmach_s *xdmach, int result)
sam_putdmac(xdmac, chanbit, SAM_XDMAC_GD_OFFSET); sam_putdmac(xdmac, chanbit, SAM_XDMAC_GD_OFFSET);
while ((sam_getdmac(xdmac, SAM_XDMAC_GS_OFFSET) & chanbit) != 0); 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 */ /* Perform the DMA complete callback */