mirror of
https://github.com/apache/nuttx.git
synced 2026-10-01 19:36:28 +00:00
arch/arm/imxrt: LPUART DMA fixes
- Only submit and account for a wrapped second TX segment when scatter/gather descriptors are available. Without in-memory TCDs, submitting the second segment overwrites the active hardware descriptor and incorrectly advances the serial buffer past unsent data. - Invalidate DMA RX buffer initially Signed-off-by: Jukka Laitinen <jukka.laitinen@tii.ae>
This commit is contained in:
parent
b59d3aadf5
commit
6b0f85b768
1 changed files with 12 additions and 1 deletions
|
|
@ -2465,7 +2465,13 @@ static int imxrt_dma_setup(struct uart_dev_s *dev)
|
|||
*/
|
||||
|
||||
priv->rxdmanext = 0;
|
||||
|
||||
#ifdef CONFIG_ARMV7M_DCACHE
|
||||
|
||||
/* Make sure the rx buffer area is all invalid or clean */
|
||||
|
||||
up_invalidate_dcache((uintptr_t)priv->rxfifo,
|
||||
(uintptr_t)priv->rxfifo + RXDMA_BUFFER_SIZE);
|
||||
priv->rxdmaavail = 0;
|
||||
#endif
|
||||
|
||||
|
|
@ -3509,7 +3515,10 @@ static void imxrt_dma_txcallback(DMACH_HANDLE handle, void *arg, bool done,
|
|||
* This is important to free TX buffer space by 'uart_xmitchars_done'.
|
||||
*/
|
||||
|
||||
priv->dev.dmatx.nbytes = priv->dev.dmatx.length + priv->dev.dmatx.nlength;
|
||||
priv->dev.dmatx.nbytes = priv->dev.dmatx.length;
|
||||
#if CONFIG_IMXRT_EDMA_NTCD > 1
|
||||
priv->dev.dmatx.nbytes += priv->dev.dmatx.nlength;
|
||||
#endif
|
||||
|
||||
/* Adjust the pointers and unblock writers */
|
||||
|
||||
|
|
@ -3592,6 +3601,7 @@ static void imxrt_dma_send(struct uart_dev_s *dev)
|
|||
|
||||
imxrt_dmach_xfrsetup(priv->txdma, &config);
|
||||
|
||||
#if CONFIG_IMXRT_EDMA_NTCD > 1
|
||||
/* Is this a split transfer? */
|
||||
|
||||
if (dev->dmatx.nbuffer)
|
||||
|
|
@ -3606,6 +3616,7 @@ static void imxrt_dma_send(struct uart_dev_s *dev)
|
|||
|
||||
imxrt_dmach_xfrsetup(priv->txdma, &config);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Start transmission with the callback on DMA completion */
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue