arch/sim: Replace uart_[xmit|recv]chars_dma with uart_dma[txavail|rxfree]

to follow the original dma design

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2023-06-03 20:46:24 +08:00 committed by Mateusz Szafoni
parent 694c0f0b7f
commit add569d0e5

View File

@ -421,19 +421,19 @@ static void tty_work(void *arg)
return; return;
} }
if (priv->txint && host_uart_checkout(dev->isconsole ? 1 : priv->fd)) if (priv->txint)
{ {
#ifdef CONFIG_SIM_UART_DMA #ifdef CONFIG_SIM_UART_DMA
uart_xmitchars_dma(dev); uart_dmatxavail(dev);
#else #else
uart_xmitchars(dev); uart_xmitchars(dev);
#endif #endif
} }
if (priv->rxint && host_uart_checkin(priv->fd)) if (priv->rxint)
{ {
#ifdef CONFIG_SIM_UART_DMA #ifdef CONFIG_SIM_UART_DMA
uart_recvchars_dma(dev); uart_dmarxfree(dev);
#else #else
uart_recvchars(dev); uart_recvchars(dev);
#endif #endif
@ -511,6 +511,10 @@ static bool tty_rxflowcontrol(struct uart_dev_s *dev,
static void tty_dmatxavail(FAR 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) 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 #endif
return 0; return 0;
} }