SAMV7 XDMA: Fix a problem with invalidating the cache on RX DMA

This commit is contained in:
Gregory Nutt 2015-03-14 15:25:32 -06:00
parent f8aa0ec741
commit 9e2587ffe9
1 changed files with 15 additions and 3 deletions

View File

@ -1503,11 +1503,11 @@ static void sam_dmaterminate(struct sam_xdmach_s *xdmach, int result)
sam_freelinklist(xdmach);
#ifdef HAVE_INVALIDATE_DCACHE_RANGE /* Revisit */
/* If this was an RX DMA (peripheral-to-memory), then invalidate the cache
* to force reloads from memory.
*/
#ifdef HAVE_INVALIDATE_DCACHE_RANGE /* Revisit */
if (xdmach->rx)
{
arch_invalidate_dcache(xdmach->rxaddr, xdmach->rxaddr + xdmach->rxsize);
@ -1988,12 +1988,24 @@ int sam_dmastart(DMA_HANDLE handle, dma_callback_t callback, void *arg)
if (xdmach->llhead)
{
/* Save the callback info. This will be invoked whent the DMA commpletes */
/* Save the callback info. This will be invoked when the DMA completes */
xdmach->callback = callback;
xdmach->arg = arg;
/* Is this a single block transfer? Or a multiple block tranfer? */
#ifndef HAVE_INVALIDATE_DCACHE_RANGE /* Revisit */
/* If this is an RX DMA (peripheral-to-memory), then flush and
* invalidate the data cache to force reloading from memory when the
* DMA completes.
*/
if (xdmach->rx)
{
arch_flush_dcache_all();
}
#endif
/* Is this a single block transfer? Or a multiple block transfer? */
if (xdmach->llhead == xdmach->lltail)
{