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

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

commit add569d0e5f8d0af5a53af217c0ba2fb31ffddfb
Author: Xiang Xiao <[email protected]>
AuthorDate: Sat Jun 3 20:46:24 2023 +0800

    arch/sim: Replace uart_[xmit|recv]chars_dma with uart_dma[txavail|rxfree]
    
    to follow the original dma design
    
    Signed-off-by: Xiang Xiao <[email protected]>
---
 arch/sim/src/sim/sim_uart.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/arch/sim/src/sim/sim_uart.c b/arch/sim/src/sim/sim_uart.c
index ee8d71ef79..f2e2d97263 100644
--- a/arch/sim/src/sim/sim_uart.c
+++ b/arch/sim/src/sim/sim_uart.c
@@ -421,19 +421,19 @@ static void tty_work(void *arg)
       return;
     }
 
-  if (priv->txint && host_uart_checkout(dev->isconsole ? 1 : priv->fd))
+  if (priv->txint)
     {
 #ifdef CONFIG_SIM_UART_DMA
-      uart_xmitchars_dma(dev);
+      uart_dmatxavail(dev);
 #else
       uart_xmitchars(dev);
 #endif
     }
 
-  if (priv->rxint && host_uart_checkin(priv->fd))
+  if (priv->rxint)
     {
 #ifdef CONFIG_SIM_UART_DMA
-      uart_recvchars_dma(dev);
+      uart_dmarxfree(dev);
 #else
       uart_recvchars(dev);
 #endif
@@ -511,6 +511,10 @@ static bool tty_rxflowcontrol(struct uart_dev_s *dev,
 
 static void tty_dmatxavail(FAR struct uart_dev_s *dev)
 {
+  if (uart_txready(dev))
+    {
+      uart_xmitchars_dma(dev);
+    }
 }
 
 /****************************************************************************
@@ -557,6 +561,10 @@ static void tty_dmasend(FAR struct uart_dev_s *dev)
 
 static void tty_dmarxfree(FAR struct uart_dev_s *dev)
 {
+  if (uart_rxavailable(dev))
+    {
+      uart_recvchars_dma(dev);
+    }
 }
 
 /****************************************************************************
@@ -730,4 +738,3 @@ int up_putc(int ch)
 #endif
   return 0;
 }
-

Reply via email to