mirror of
https://github.com/apache/nuttx.git
synced 2026-08-07 13:37:18 +00:00
imxrt:Serial overcome race where DMA has not fetched TCD again"
With TCD set to loop, there is a window where the
DMA has raised Done, but not reloaded the TCD, resetting
count and clearing Done.
In this window imxrt_dmach_getcount could then return 0.
Resulting in imxrt_dma_nextrx returning RXDMA_BUFFER_SIZE.
Which is not a valid index in the FIFO.
Since the count will be set to RXDMA_BUFFER_SIZE. When the DMA
engine completes the TCD reload. The imxrt_dma_nextrx would
return 0. Therefore:
(RXDMA_BUFFER_SIZE - dmaresidual) % RXDMA_BUFFER_SIZE
accomplishes this.
This commit is contained in:
parent
18819b6b24
commit
892fe45900
1 changed files with 1 additions and 1 deletions
|
|
@ -1375,7 +1375,7 @@ static int imxrt_dma_nextrx(struct imxrt_uart_s *priv)
|
|||
int dmaresidual = imxrt_dmach_getcount(priv->rxdma);
|
||||
DEBUGASSERT(dmaresidual <= RXDMA_BUFFER_SIZE);
|
||||
|
||||
return RXDMA_BUFFER_SIZE - dmaresidual;
|
||||
return (RXDMA_BUFFER_SIZE - dmaresidual) % RXDMA_BUFFER_SIZE;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue