xiaoxiang781216 commented on code in PR #9057:
URL: https://github.com/apache/nuttx/pull/9057#discussion_r1196866420
##########
drivers/serial/Kconfig-16550:
##########
@@ -79,6 +83,52 @@ config 16550_UART0_OFLOWCONTROL
---help---
Enable 16550 UART0 CTS flow control
+config 16550_UART0_DMA
+ bool "16550 UART0 DMA support"
+ default n
+ #depends on ARCH_DMA
Review Comment:
```suggestion
select ARCH_DMA
```
##########
drivers/serial/Kconfig-16550:
##########
@@ -79,6 +83,52 @@ config 16550_UART0_OFLOWCONTROL
---help---
Enable 16550 UART0 CTS flow control
+config 16550_UART0_DMA
+ bool "16550 UART0 DMA support"
+ default n
+ #depends on ARCH_DMA
+ select SERIAL_DMA
+ ---help---
+ Enable DMA transfers on 16550 UART0
+
+if 16550_UART0_DMA
+
+config 16550_UART0_DMA_TX
+ int "16550 UART0 DMA Tx channel identity"
+ default -1
+ ---help---
+ -1 means don't use DMA for sending
+
+config 16550_UART0_DMA_RX
+ int "16550 UART0 DMA Rx channel identity"
+ default -1
+ ---help---
+ -1 means don't use DMA for receiving
+
+config 16550_UART0_DMA_RXBUFSIZE
+ int "16550 UART0 DMA Rx buffer size"
+ depends on 16550_UART0_DMA_RX != -1
+ default 16550_UART0_RXBUFSIZE
+ ---help---
+ 16550 UART0 DMA Rx buffer size.
+
+config 16550_UART0_DMA_RXTIMEOUT
+ int "16550 UART0 DMA Rx timeout(char)"
+ depends on 16550_UART0_DMA_RX != -1
+ default 1
+ ---help---
+ 0 means DMA has no timeout for receiving
+
+endif
+
+config 16550_UART0_TX_WORKAROUND
Review Comment:
remove the unused 16550_UART0_TX_WORKAROUND
##########
drivers/serial/uart_16550.c:
##########
@@ -56,9 +62,24 @@
struct u16550_s
{
uart_addrwidth_t uartbase; /* Base address of UART registers */
-#ifndef CONFIG_16550_SUPRESS_CONFIG
+#ifdef HAVE_16550_UART_DMA
+ int32_t dmatx;
+ FAR struct dma_chan_s *chantx;
+ int32_t dmarx;
+ FAR struct dma_chan_s *chanrx;
+ FAR char *dmarxbuf;
+ size_t dmarxsize;
+ volatile size_t dmarxhead;
+ volatile size_t dmarxtail;
+ int32_t dmarxtimeout;
+#endif
+#if !defined(CONFIG_16550_SUPRESS_CONFIG) || defined(HAVE_16550_UART_DMA)
uint32_t baud; /* Configured baud */
uint32_t uartclk; /* UART clock frequency */
+#endif
+#ifdef CONFIG_CLK
+ const char *clk_name; /* UART clock name */
Review Comment:
FAR
##########
drivers/serial/Kconfig-16550:
##########
@@ -277,6 +415,44 @@ config 16550_UART3_OFLOWCONTROL
---help---
Enable 16550 UART3 CTS flow control
+config 16550_UART3_DMA
+ bool "16550 UART3 DMA support"
+ default n
+ #depends on ARCH_DMA
Review Comment:
```suggestion
select ARCH_DMA
```
##########
drivers/serial/Kconfig-16550:
##########
@@ -145,6 +199,44 @@ config 16550_UART1_OFLOWCONTROL
---help---
Enable 16550 UART1 CTS flow control
+config 16550_UART1_DMA
+ bool "16550 UART1 DMA support"
+ default n
+ #depends on ARCH_DMA
Review Comment:
```suggestion
select ARCH_DMA
```
##########
drivers/serial/Kconfig-16550:
##########
@@ -211,6 +307,44 @@ config 16550_UART2_OFLOWCONTROL
---help---
Enable 16550 UART2 CTS flow control
+config 16550_UART2_DMA
+ bool "16550 UART2 DMA support"
+ default n
+ #depends on ARCH_DMA
Review Comment:
```suggestion
select ARCH_DMA
```
##########
drivers/serial/uart_16550.c:
##########
@@ -160,9 +177,24 @@ static char g_uart3txbuffer[CONFIG_16550_UART3_TXBUFSIZE];
static struct u16550_s g_uart0priv =
{
.uartbase = CONFIG_16550_UART0_BASE,
-#ifndef CONFIG_16550_SUPRESS_CONFIG
+#ifdef CONFIG_16550_UART0_DMA
+ .dmatx = CONFIG_16550_UART0_DMA_TX,
+ .dmarx = CONFIG_16550_UART0_DMA_RX,
+# if CONFIG_16550_UART0_DMA_RX != -1
+ .dmarxbuf = g_uart0dmarxbuf,
Review Comment:
where we defefine g_uart0dmarxbuf?
##########
drivers/serial/uart_16550.c:
##########
@@ -56,9 +62,24 @@
struct u16550_s
{
uart_addrwidth_t uartbase; /* Base address of UART registers */
-#ifndef CONFIG_16550_SUPRESS_CONFIG
+#ifdef HAVE_16550_UART_DMA
+ int32_t dmatx;
+ FAR struct dma_chan_s *chantx;
+ int32_t dmarx;
+ FAR struct dma_chan_s *chanrx;
+ FAR char *dmarxbuf;
+ size_t dmarxsize;
+ volatile size_t dmarxhead;
+ volatile size_t dmarxtail;
+ int32_t dmarxtimeout;
+#endif
+#if !defined(CONFIG_16550_SUPRESS_CONFIG) || defined(HAVE_16550_UART_DMA)
uint32_t baud; /* Configured baud */
uint32_t uartclk; /* UART clock frequency */
+#endif
+#ifdef CONFIG_CLK
+ const char *clk_name; /* UART clock name */
+ struct clk *mclk; /* UART clock descriptor */
Review Comment:
add FAR
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]