diff --git a/arch/arm/src/stm32/Kconfig b/arch/arm/src/stm32/Kconfig index b02203c7bd..e4c26d8801 100644 --- a/arch/arm/src/stm32/Kconfig +++ b/arch/arm/src/stm32/Kconfig @@ -8020,6 +8020,14 @@ config USART1_RXDMA ---help--- In high data rate usage, Rx DMA may eliminate Rx overrun errors +config USART1_TXDMA + bool "USART1 Tx DMA" + default n + depends on (((STM32_STM32F10XX || STM32_STM32L15XX) && STM32_DMA1) || (!STM32_STM32F10XX && STM32_DMA2)) + select STM32_USART_TXDMA + ---help--- + In high data rate usage, Tx DMA may reduce CPU load + endif # STM32_USART1_SERIALDRIVER if STM32_USART1_HCIUART @@ -8107,6 +8115,14 @@ config USART2_RXDMA ---help--- In high data rate usage, Rx DMA may eliminate Rx overrun errors +config USART2_TXDMA + bool "USART. Tx DMA" + default n + depends on STM32_DMA1 + select STM32_USART_TXDMA + ---help--- + In high data rate usage, Tx DMA may reduce CPU load + endif # STM32_USART2_SERIALDRIVER if STM32_USART2_HCIUART @@ -8194,6 +8210,14 @@ config USART3_RXDMA ---help--- In high data rate usage, Rx DMA may eliminate Rx overrun errors +config USART3_TXDMA + bool "USART. Tx DMA" + default n + depends on STM32_DMA1 + select STM32_USART_TXDMA + ---help--- + In high data rate usage, Tx DMA may reduce CPU load + endif # STM32_USART3_SERIALDRIVER if STM32_USART3_HCIUART @@ -8276,6 +8300,14 @@ config UART4_RXDMA ---help--- In high data rate usage, Rx DMA may eliminate Rx overrun errors +config UART4_TXDMA + bool "UART. Tx DMA" + default n + depends on STM32_DMA1 + select STM32_USART_TXDMA + ---help--- + In high data rate usage, Tx DMA may reduce CPU load + endif # STM32_UART4_SERIALDRIVER choice @@ -8322,6 +8354,14 @@ config UART5_RXDMA ---help--- In high data rate usage, Rx DMA may eliminate Rx overrun errors +config UART5_TXDMA + bool "UART. Tx DMA" + default n + depends on STM32_DMA1 + select STM32_USART_TXDMA + ---help--- + In high data rate usage, Tx DMA may reduce CPU load + endif # STM32_UART5_SERIALDRIVER choice @@ -8373,6 +8413,14 @@ config USART6_RXDMA ---help--- In high data rate usage, Rx DMA may eliminate Rx overrun errors +config USART6_TXDMA + bool "USART6 Tx DMA" + default n + depends on STM32_DMA2 + select STM32_USART_TXDMA + ---help--- + In high data rate usage, Tx DMA may reduce CPU load + endif # STM32_USART6_SERIALDRIVER if STM32_USART6_HCIUART @@ -8455,11 +8503,19 @@ config UART7_RS485_DIR_POLARITY config UART7_RXDMA bool "UART7 Rx DMA" default n - depends on STM32_DMA2 + depends on STM32_DMA1 select STM32_USART_RXDMA ---help--- In high data rate usage, Rx DMA may eliminate Rx overrun errors +config UART7_TXDMA + bool "UART. Tx DMA" + default n + depends on STM32_DMA1 + select STM32_USART_TXDMA + ---help--- + In high data rate usage, Tx DMA may reduce CPU load + endif # STM32_UART7_SERIALDRIVER if STM32_UART7_HCIUART @@ -8542,11 +8598,19 @@ config UART8_RS485_DIR_POLARITY config UART8_RXDMA bool "UART8 Rx DMA" default n - depends on STM32_DMA2 + depends on STM32_DMA1 select STM32_USART_RXDMA ---help--- In high data rate usage, Rx DMA may eliminate Rx overrun errors +config UART8_TXDMA + bool "UART. Tx DMA" + default n + depends on STM32_DMA1 + select STM32_USART_TXDMA + ---help--- + In high data rate usage, Tx DMA may reduce CPU load + endif # STM32_UART8_SERIALDRIVER if STM32_UART8_HCIUART diff --git a/arch/arm/src/stm32/stm32_serial.c b/arch/arm/src/stm32/stm32_serial.c index 038598ca64..603f785997 100644 --- a/arch/arm/src/stm32/stm32_serial.c +++ b/arch/arm/src/stm32/stm32_serial.c @@ -79,7 +79,7 @@ * have also been selected. */ -#ifdef SERIAL_HAVE_DMA +#ifdef SERIAL_HAVE_RXDMA # if defined(CONFIG_STM32_STM32F20XX) || defined(CONFIG_STM32_STM32F4XXX) /* Verify that DMA has been enabled and the DMA channel has been defined. @@ -324,13 +324,13 @@ struct up_dev_s const uint32_t cts_gpio; /* U[S]ART CTS GPIO pin configuration */ #endif -#ifdef SERIAL_HAVE_DMA +#ifdef SERIAL_HAVE_RXDMA const unsigned int rxdma_channel; /* DMA channel assigned */ #endif /* RX DMA state */ -#ifdef SERIAL_HAVE_DMA +#ifdef SERIAL_HAVE_RXDMA DMA_HANDLE rxdma; /* currently-open receive DMA stream */ bool rxenable; /* DMA-based reception en/disable */ uint32_t rxdmanext; /* Next byte in the DMA buffer to be read */ @@ -367,7 +367,7 @@ static void up_send(struct uart_dev_s *dev, int ch); static void up_txint(struct uart_dev_s *dev, bool enable); static bool up_txready(struct uart_dev_s *dev); -#ifdef SERIAL_HAVE_DMA +#ifdef SERIAL_HAVE_RXDMA static int up_dma_setup(struct uart_dev_s *dev); static void up_dma_shutdown(struct uart_dev_s *dev); static int up_dma_receive(struct uart_dev_s *dev, unsigned int *status); @@ -409,7 +409,7 @@ static const struct uart_ops_s g_uart_ops = }; #endif -#ifdef SERIAL_HAVE_DMA +#ifdef SERIAL_HAVE_RXDMA static const struct uart_ops_s g_uart_dma_ops = { .setup = up_dma_setup, @@ -1149,7 +1149,7 @@ static void up_disableusartint(struct up_dev_s *priv, uint16_t *ie) * ****************************************************************************/ -#ifdef SERIAL_HAVE_DMA +#ifdef SERIAL_HAVE_RXDMA static int up_dma_nextrx(struct up_dev_s *priv) { size_t dmaresidual; @@ -1576,7 +1576,7 @@ static int up_setup(struct uart_dev_s *dev) * ****************************************************************************/ -#ifdef SERIAL_HAVE_DMA +#ifdef SERIAL_HAVE_RXDMA static int up_dma_setup(struct uart_dev_s *dev) { struct up_dev_s *priv = (struct up_dev_s *)dev->priv; @@ -1703,7 +1703,7 @@ static void up_shutdown(struct uart_dev_s *dev) * ****************************************************************************/ -#ifdef SERIAL_HAVE_DMA +#ifdef SERIAL_HAVE_RXDMA static void up_dma_shutdown(struct uart_dev_s *dev) { struct up_dev_s *priv = (struct up_dev_s *)dev->priv; @@ -2371,7 +2371,7 @@ static bool up_rxflowcontrol(struct uart_dev_s *dev, * ****************************************************************************/ -#ifdef SERIAL_HAVE_DMA +#ifdef SERIAL_HAVE_RXDMA static int up_dma_receive(struct uart_dev_s *dev, unsigned int *status) { struct up_dev_s *priv = (struct up_dev_s *)dev->priv; @@ -2400,7 +2400,7 @@ static int up_dma_receive(struct uart_dev_s *dev, unsigned int *status) * ****************************************************************************/ -#ifdef SERIAL_HAVE_DMA +#ifdef SERIAL_HAVE_RXDMA static void up_dma_rxint(struct uart_dev_s *dev, bool enable) { struct up_dev_s *priv = (struct up_dev_s *)dev->priv; @@ -2425,7 +2425,7 @@ static void up_dma_rxint(struct uart_dev_s *dev, bool enable) * ****************************************************************************/ -#ifdef SERIAL_HAVE_DMA +#ifdef SERIAL_HAVE_RXDMA static bool up_dma_rxavailable(struct uart_dev_s *dev) { struct up_dev_s *priv = (struct up_dev_s *)dev->priv; @@ -2546,7 +2546,7 @@ static bool up_txready(struct uart_dev_s *dev) * ****************************************************************************/ -#ifdef SERIAL_HAVE_DMA +#ifdef SERIAL_HAVE_RXDMA static void up_dma_rxcallback(DMA_HANDLE handle, uint8_t status, void *arg) { struct up_dev_s *priv = (struct up_dev_s *)arg; @@ -2824,7 +2824,7 @@ void up_serialinit(void) * ****************************************************************************/ -#ifdef SERIAL_HAVE_DMA +#ifdef SERIAL_HAVE_RXDMA void stm32_serial_dma_poll(void) { irqstate_t flags; diff --git a/arch/arm/src/stm32/stm32_uart.h b/arch/arm/src/stm32/stm32_uart.h index df47938493..99e950c9a1 100644 --- a/arch/arm/src/stm32/stm32_uart.h +++ b/arch/arm/src/stm32/stm32_uart.h @@ -325,12 +325,12 @@ /* Is DMA available on any (enabled) USART? */ -#undef SERIAL_HAVE_DMA +#undef SERIAL_HAVE_RXDMA #if defined(CONFIG_USART1_RXDMA) || defined(CONFIG_USART2_RXDMA) || \ defined(CONFIG_USART3_RXDMA) || defined(CONFIG_UART4_RXDMA) || \ defined(CONFIG_UART5_RXDMA) || defined(CONFIG_USART6_RXDMA) || \ defined(CONFIG_UART7_RXDMA) || defined(CONFIG_UART8_RXDMA) -# define SERIAL_HAVE_DMA 1 +# define SERIAL_HAVE_RXDMA 1 #endif /* Is DMA used on the console UART? */ @@ -436,7 +436,7 @@ FAR uart_dev_t *stm32_serial_get_uart(int uart_num); * ************************************************************************************/ -#ifdef SERIAL_HAVE_DMA +#ifdef SERIAL_HAVE_RXDMA void stm32_serial_dma_poll(void); #endif