summaryrefslogtreecommitdiff
path: root/nuttx/arch/arm/src
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-05-08 09:00:33 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-05-08 09:00:33 -0600
commit3c423e7dff566512144a1ce15501512ad5426360 (patch)
tree84b7f36b211209c04986941e0a408105d7381cf9 /nuttx/arch/arm/src
parent8b312b8c3a30807a4633943c31f154e496fe6de8 (diff)
downloadnuttx-3c423e7dff566512144a1ce15501512ad5426360.tar.gz
nuttx-3c423e7dff566512144a1ce15501512ad5426360.tar.bz2
nuttx-3c423e7dff566512144a1ce15501512ad5426360.zip
Add serial method so that lower half driver can provide RX flow control information. From Jussi Kivilinna
Diffstat (limited to 'nuttx/arch/arm/src')
-rw-r--r--nuttx/arch/arm/src/a1x/a1x_serial.c3
-rw-r--r--nuttx/arch/arm/src/c5471/c5471_serial.c3
-rw-r--r--nuttx/arch/arm/src/calypso/calypso_serial.c3
-rw-r--r--nuttx/arch/arm/src/dm320/dm320_serial.c3
-rw-r--r--nuttx/arch/arm/src/imx/imx_serial.c3
-rw-r--r--nuttx/arch/arm/src/kinetis/kinetis_serial.c3
-rw-r--r--nuttx/arch/arm/src/kl/kl_serial.c3
-rw-r--r--nuttx/arch/arm/src/lpc17xx/lpc17_serial.c3
-rw-r--r--nuttx/arch/arm/src/lpc214x/lpc214x_serial.c3
-rw-r--r--nuttx/arch/arm/src/lpc2378/lpc23xx_serial.c3
-rw-r--r--nuttx/arch/arm/src/lpc31xx/lpc31_serial.c3
-rw-r--r--nuttx/arch/arm/src/lpc43xx/lpc43_serial.c3
-rw-r--r--nuttx/arch/arm/src/nuc1xx/nuc_serial.c3
-rw-r--r--nuttx/arch/arm/src/sam34/sam_serial.c3
-rw-r--r--nuttx/arch/arm/src/sama5/sam_dbgu.c3
-rw-r--r--nuttx/arch/arm/src/sama5/sam_serial.c3
-rw-r--r--nuttx/arch/arm/src/samd/sam_serial.c3
-rw-r--r--nuttx/arch/arm/src/stm32/stm32_serial.c186
-rw-r--r--nuttx/arch/arm/src/str71x/str71x_serial.c3
-rw-r--r--nuttx/arch/arm/src/tiva/tiva_serial.c3
20 files changed, 217 insertions, 26 deletions
diff --git a/nuttx/arch/arm/src/a1x/a1x_serial.c b/nuttx/arch/arm/src/a1x/a1x_serial.c
index 1c93fb1a2..d2cc36642 100644
--- a/nuttx/arch/arm/src/a1x/a1x_serial.c
+++ b/nuttx/arch/arm/src/a1x/a1x_serial.c
@@ -157,6 +157,9 @@ static const struct uart_ops_s g_uart_ops =
.receive = up_receive,
.rxint = up_rxint,
.rxavailable = up_rxavailable,
+#ifdef CONFIG_SERIAL_IFLOWCONTROL
+ .rxflowcontrol = NULL,
+#endif
.send = up_send,
.txint = up_txint,
.txready = up_txready,
diff --git a/nuttx/arch/arm/src/c5471/c5471_serial.c b/nuttx/arch/arm/src/c5471/c5471_serial.c
index b993ee8bc..f1b9f7b70 100644
--- a/nuttx/arch/arm/src/c5471/c5471_serial.c
+++ b/nuttx/arch/arm/src/c5471/c5471_serial.c
@@ -133,6 +133,9 @@ static const struct uart_ops_s g_uart_ops =
.receive = up_receive,
.rxint = up_rxint,
.rxavailable = up_rxavailable,
+#ifdef CONFIG_SERIAL_IFLOWCONTROL
+ .rxflowcontrol = NULL,
+#endif
.send = up_send,
.txint = up_txint,
.txready = up_txready,
diff --git a/nuttx/arch/arm/src/calypso/calypso_serial.c b/nuttx/arch/arm/src/calypso/calypso_serial.c
index ddb37201d..d3f9cf590 100644
--- a/nuttx/arch/arm/src/calypso/calypso_serial.c
+++ b/nuttx/arch/arm/src/calypso/calypso_serial.c
@@ -147,6 +147,9 @@ static const struct uart_ops_s g_uart_ops =
.receive = up_receive,
.rxint = up_rxint,
.rxavailable = up_rxavailable,
+#ifdef CONFIG_SERIAL_IFLOWCONTROL
+ .rxflowcontrol = NULL,
+#endif
.send = up_send,
.txint = up_txint,
.txready = up_txready,
diff --git a/nuttx/arch/arm/src/dm320/dm320_serial.c b/nuttx/arch/arm/src/dm320/dm320_serial.c
index daf711d69..be74e227f 100644
--- a/nuttx/arch/arm/src/dm320/dm320_serial.c
+++ b/nuttx/arch/arm/src/dm320/dm320_serial.c
@@ -114,6 +114,9 @@ static const struct uart_ops_s g_uart_ops =
.receive = up_receive,
.rxint = up_rxint,
.rxavailable = up_rxavailable,
+#ifdef CONFIG_SERIAL_IFLOWCONTROL
+ .rxflowcontrol = NULL,
+#endif
.send = up_send,
.txint = up_txint,
.txready = up_txready,
diff --git a/nuttx/arch/arm/src/imx/imx_serial.c b/nuttx/arch/arm/src/imx/imx_serial.c
index d5423ff4a..b5939fad7 100644
--- a/nuttx/arch/arm/src/imx/imx_serial.c
+++ b/nuttx/arch/arm/src/imx/imx_serial.c
@@ -136,6 +136,9 @@ static const struct uart_ops_s g_uart_ops =
.receive = up_receive,
.rxint = up_rxint,
.rxavailable = up_rxavailable,
+#ifdef CONFIG_SERIAL_IFLOWCONTROL
+ .rxflowcontrol = NULL,
+#endif
.send = up_send,
.txint = up_txint,
.txready = up_txready,
diff --git a/nuttx/arch/arm/src/kinetis/kinetis_serial.c b/nuttx/arch/arm/src/kinetis/kinetis_serial.c
index 4cf414fd6..5446ffe80 100644
--- a/nuttx/arch/arm/src/kinetis/kinetis_serial.c
+++ b/nuttx/arch/arm/src/kinetis/kinetis_serial.c
@@ -280,6 +280,9 @@ static const struct uart_ops_s g_uart_ops =
.receive = up_receive,
.rxint = up_rxint,
.rxavailable = up_rxavailable,
+#ifdef CONFIG_SERIAL_IFLOWCONTROL
+ .rxflowcontrol = NULL,
+#endif
.send = up_send,
.txint = up_txint,
.txready = up_txready,
diff --git a/nuttx/arch/arm/src/kl/kl_serial.c b/nuttx/arch/arm/src/kl/kl_serial.c
index 2622e0db0..262167e1f 100644
--- a/nuttx/arch/arm/src/kl/kl_serial.c
+++ b/nuttx/arch/arm/src/kl/kl_serial.c
@@ -196,6 +196,9 @@ static const struct uart_ops_s g_uart_ops =
.receive = up_receive,
.rxint = up_rxint,
.rxavailable = up_rxavailable,
+#ifdef CONFIG_SERIAL_IFLOWCONTROL
+ .rxflowcontrol = NULL,
+#endif
.send = up_send,
.txint = up_txint,
.txready = up_txready,
diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_serial.c b/nuttx/arch/arm/src/lpc17xx/lpc17_serial.c
index 7c0f0e04a..86e5b2187 100644
--- a/nuttx/arch/arm/src/lpc17xx/lpc17_serial.c
+++ b/nuttx/arch/arm/src/lpc17xx/lpc17_serial.c
@@ -129,6 +129,9 @@ static const struct uart_ops_s g_uart_ops =
.receive = up_receive,
.rxint = up_rxint,
.rxavailable = up_rxavailable,
+#ifdef CONFIG_SERIAL_IFLOWCONTROL
+ .rxflowcontrol = NULL,
+#endif
.send = up_send,
.txint = up_txint,
.txready = up_txready,
diff --git a/nuttx/arch/arm/src/lpc214x/lpc214x_serial.c b/nuttx/arch/arm/src/lpc214x/lpc214x_serial.c
index 5df5264fe..214eb0347 100644
--- a/nuttx/arch/arm/src/lpc214x/lpc214x_serial.c
+++ b/nuttx/arch/arm/src/lpc214x/lpc214x_serial.c
@@ -113,6 +113,9 @@ static const struct uart_ops_s g_uart_ops =
.receive = up_receive,
.rxint = up_rxint,
.rxavailable = up_rxavailable,
+#ifdef CONFIG_SERIAL_IFLOWCONTROL
+ .rxflowcontrol = NULL,
+#endif
.send = up_send,
.txint = up_txint,
.txready = up_txready,
diff --git a/nuttx/arch/arm/src/lpc2378/lpc23xx_serial.c b/nuttx/arch/arm/src/lpc2378/lpc23xx_serial.c
index dcd630eee..17b6bc0b2 100644
--- a/nuttx/arch/arm/src/lpc2378/lpc23xx_serial.c
+++ b/nuttx/arch/arm/src/lpc2378/lpc23xx_serial.c
@@ -121,6 +121,9 @@ static const struct uart_ops_s g_uart_ops =
.receive = up_receive,
.rxint = up_rxint,
.rxavailable = up_rxavailable,
+#ifdef CONFIG_SERIAL_IFLOWCONTROL
+ .rxflowcontrol = NULL,
+#endif
.send = up_send,
.txint = up_txint,
.txready = up_txready,
diff --git a/nuttx/arch/arm/src/lpc31xx/lpc31_serial.c b/nuttx/arch/arm/src/lpc31xx/lpc31_serial.c
index 46e91aba4..e4d6941ca 100644
--- a/nuttx/arch/arm/src/lpc31xx/lpc31_serial.c
+++ b/nuttx/arch/arm/src/lpc31xx/lpc31_serial.c
@@ -113,6 +113,9 @@ static const struct uart_ops_s g_uart_ops =
.receive = up_receive,
.rxint = up_rxint,
.rxavailable = up_rxavailable,
+#ifdef CONFIG_SERIAL_IFLOWCONTROL
+ .rxflowcontrol = NULL,
+#endif
.send = up_send,
.txint = up_txint,
.txready = up_txready,
diff --git a/nuttx/arch/arm/src/lpc43xx/lpc43_serial.c b/nuttx/arch/arm/src/lpc43xx/lpc43_serial.c
index df68c1301..896e1f738 100644
--- a/nuttx/arch/arm/src/lpc43xx/lpc43_serial.c
+++ b/nuttx/arch/arm/src/lpc43xx/lpc43_serial.c
@@ -126,6 +126,9 @@ static const struct uart_ops_s g_uart_ops =
.receive = up_receive,
.rxint = up_rxint,
.rxavailable = up_rxavailable,
+#ifdef CONFIG_SERIAL_IFLOWCONTROL
+ .rxflowcontrol = NULL,
+#endif
.send = up_send,
.txint = up_txint,
.txready = up_txready,
diff --git a/nuttx/arch/arm/src/nuc1xx/nuc_serial.c b/nuttx/arch/arm/src/nuc1xx/nuc_serial.c
index ee774b9ae..25b7f6060 100644
--- a/nuttx/arch/arm/src/nuc1xx/nuc_serial.c
+++ b/nuttx/arch/arm/src/nuc1xx/nuc_serial.c
@@ -126,6 +126,9 @@ static const struct uart_ops_s g_uart_ops =
.receive = up_receive,
.rxint = up_rxint,
.rxavailable = up_rxavailable,
+#ifdef CONFIG_SERIAL_IFLOWCONTROL
+ .rxflowcontrol = NULL,
+#endif
.send = up_send,
.txint = up_txint,
.txready = up_txready,
diff --git a/nuttx/arch/arm/src/sam34/sam_serial.c b/nuttx/arch/arm/src/sam34/sam_serial.c
index f74d9be71..aa1e56db8 100644
--- a/nuttx/arch/arm/src/sam34/sam_serial.c
+++ b/nuttx/arch/arm/src/sam34/sam_serial.c
@@ -381,6 +381,9 @@ static const struct uart_ops_s g_uart_ops =
.receive = up_receive,
.rxint = up_rxint,
.rxavailable = up_rxavailable,
+#ifdef CONFIG_SERIAL_IFLOWCONTROL
+ .rxflowcontrol = NULL,
+#endif
.send = up_send,
.txint = up_txint,
.txready = up_txready,
diff --git a/nuttx/arch/arm/src/sama5/sam_dbgu.c b/nuttx/arch/arm/src/sama5/sam_dbgu.c
index f86cd89a0..919260616 100644
--- a/nuttx/arch/arm/src/sama5/sam_dbgu.c
+++ b/nuttx/arch/arm/src/sama5/sam_dbgu.c
@@ -116,6 +116,9 @@ static const struct uart_ops_s g_uart_ops =
.receive = dbgu_receive,
.rxint = dbgu_rxint,
.rxavailable = dbgu_rxavailable,
+#ifdef CONFIG_SERIAL_IFLOWCONTROL
+ .rxflowcontrol = NULL,
+#endif
.send = dbgu_send,
.txint = dbgu_txint,
.txready = dbgu_txready,
diff --git a/nuttx/arch/arm/src/sama5/sam_serial.c b/nuttx/arch/arm/src/sama5/sam_serial.c
index 4cbcf5f50..26c3b9acb 100644
--- a/nuttx/arch/arm/src/sama5/sam_serial.c
+++ b/nuttx/arch/arm/src/sama5/sam_serial.c
@@ -376,6 +376,9 @@ static const struct uart_ops_s g_uart_ops =
.receive = up_receive,
.rxint = up_rxint,
.rxavailable = up_rxavailable,
+#ifdef CONFIG_SERIAL_IFLOWCONTROL
+ .rxflowcontrol = NULL,
+#endif
.send = up_send,
.txint = up_txint,
.txready = up_txready,
diff --git a/nuttx/arch/arm/src/samd/sam_serial.c b/nuttx/arch/arm/src/samd/sam_serial.c
index 65092a0db..d6c448e56 100644
--- a/nuttx/arch/arm/src/samd/sam_serial.c
+++ b/nuttx/arch/arm/src/samd/sam_serial.c
@@ -300,6 +300,9 @@ static const struct uart_ops_s g_uart_ops =
.receive = sam_receive,
.rxint = sam_rxint,
.rxavailable = sam_rxavailable,
+#ifdef CONFIG_SERIAL_IFLOWCONTROL
+ .rxflowcontrol = NULL,
+#endif
.send = sam_send,
.txint = sam_txint,
.txready = sam_txempty,
diff --git a/nuttx/arch/arm/src/stm32/stm32_serial.c b/nuttx/arch/arm/src/stm32/stm32_serial.c
index ef624b870..d5333de90 100644
--- a/nuttx/arch/arm/src/stm32/stm32_serial.c
+++ b/nuttx/arch/arm/src/stm32/stm32_serial.c
@@ -161,7 +161,7 @@
# if defined(CONFIG_UART4_RXDMA)
# ifndef CONFIG_STM32_DMA2
-# error STM32 USART4 receive DMA requires CONFIG_STM32_DMA2
+# error STM32 UART4 receive DMA requires CONFIG_STM32_DMA2
# endif
# endif
@@ -170,7 +170,7 @@
# define DMAMAP_USART1_RX DMACHAN_USART1_RX
# define DMAMAP_USART2_RX DMACHAN_USART2_RX
# define DMAMAP_USART3_RX DMACHAN_USART3_RX
-# define DMAMAP_UART4_RX DMACHAN_USART4_RX
+# define DMAMAP_UART4_RX DMACHAN_UART4_RX
# endif
@@ -326,6 +326,9 @@ static int up_receive(struct uart_dev_s *dev, uint32_t *status);
static void up_rxint(struct uart_dev_s *dev, bool enable);
static bool up_rxavailable(struct uart_dev_s *dev);
#endif
+#ifdef CONFIG_SERIAL_IFLOWCONTROL
+static bool up_rxflowcontrol(struct uart_dev_s *dev);
+#endif
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);
@@ -385,6 +388,11 @@ static const struct uart_ops_s g_uart_ops =
.receive = up_receive,
.rxint = up_rxint,
.rxavailable = up_rxavailable,
+#ifdef CONFIG_SERIAL_IFLOWCONTROL
+ .rxflowcontrol = up_rxflowcontrol,
+#else
+ .rxflowcontrol = NULL,
+#endif
.send = up_send,
.txint = up_txint,
.txready = up_txready,
@@ -508,21 +516,17 @@ static struct up_dev_s g_usart1priv =
.parity = CONFIG_USART1_PARITY,
.bits = CONFIG_USART1_BITS,
.stopbits2 = CONFIG_USART1_2STOP,
-#ifdef CONFIG_SERIAL_IFLOWCONTROL
- .iflow = false,
-#endif
-#ifdef CONFIG_SERIAL_OFLOWCONTROL
- .oflow = false,
-#endif
.baud = CONFIG_USART1_BAUD,
.apbclock = STM32_PCLK2_FREQUENCY,
.usartbase = STM32_USART1_BASE,
.tx_gpio = GPIO_USART1_TX,
.rx_gpio = GPIO_USART1_RX,
#if defined(CONFIG_SERIAL_OFLOWCONTROL) && defined(CONFIG_USART1_OFLOWCONTROL)
+ .oflow = true,
.cts_gpio = GPIO_USART1_CTS,
#endif
#if defined(CONFIG_SERIAL_IFLOWCONTROL) && defined(CONFIG_USART1_IFLOWCONTROL)
+ .iflow = true,
.rts_gpio = GPIO_USART1_RTS,
#endif
#ifdef CONFIG_USART1_RXDMA
@@ -574,21 +578,17 @@ static struct up_dev_s g_usart2priv =
.parity = CONFIG_USART2_PARITY,
.bits = CONFIG_USART2_BITS,
.stopbits2 = CONFIG_USART2_2STOP,
-#ifdef CONFIG_SERIAL_IFLOWCONTROL
- .iflow = false,
-#endif
-#ifdef CONFIG_SERIAL_OFLOWCONTROL
- .oflow = false,
-#endif
.baud = CONFIG_USART2_BAUD,
.apbclock = STM32_PCLK1_FREQUENCY,
.usartbase = STM32_USART2_BASE,
.tx_gpio = GPIO_USART2_TX,
.rx_gpio = GPIO_USART2_RX,
#if defined(CONFIG_SERIAL_OFLOWCONTROL) && defined(CONFIG_USART2_OFLOWCONTROL)
+ .oflow = true,
.cts_gpio = GPIO_USART2_CTS,
#endif
#if defined(CONFIG_SERIAL_IFLOWCONTROL) && defined(CONFIG_USART2_IFLOWCONTROL)
+ .iflow = true,
.rts_gpio = GPIO_USART2_RTS,
#endif
#ifdef CONFIG_USART2_RXDMA
@@ -640,21 +640,17 @@ static struct up_dev_s g_usart3priv =
.parity = CONFIG_USART3_PARITY,
.bits = CONFIG_USART3_BITS,
.stopbits2 = CONFIG_USART3_2STOP,
-#ifdef CONFIG_SERIAL_IFLOWCONTROL
- .iflow = false,
-#endif
-#ifdef CONFIG_SERIAL_OFLOWCONTROL
- .oflow = false,
-#endif
.baud = CONFIG_USART3_BAUD,
.apbclock = STM32_PCLK1_FREQUENCY,
.usartbase = STM32_USART3_BASE,
.tx_gpio = GPIO_USART3_TX,
.rx_gpio = GPIO_USART3_RX,
#if defined(CONFIG_SERIAL_OFLOWCONTROL) && defined(CONFIG_USART3_OFLOWCONTROL)
+ .oflow = true,
.cts_gpio = GPIO_USART3_CTS,
#endif
#if defined(CONFIG_SERIAL_IFLOWCONTROL) && defined(CONFIG_USART3_IFLOWCONTROL)
+ .iflow = true,
.rts_gpio = GPIO_USART3_RTS,
#endif
#ifdef CONFIG_USART3_RXDMA
@@ -838,21 +834,17 @@ static struct up_dev_s g_usart6priv =
.parity = CONFIG_USART6_PARITY,
.bits = CONFIG_USART6_BITS,
.stopbits2 = CONFIG_USART6_2STOP,
-#ifdef CONFIG_SERIAL_IFLOWCONTROL
- .iflow = false,
-#endif
-#ifdef CONFIG_SERIAL_OFLOWCONTROL
- .oflow = false,
-#endif
.baud = CONFIG_USART6_BAUD,
.apbclock = STM32_PCLK2_FREQUENCY,
.usartbase = STM32_USART6_BASE,
.tx_gpio = GPIO_USART6_TX,
.rx_gpio = GPIO_USART6_RX,
#if defined(CONFIG_SERIAL_OFLOWCONTROL) && defined(CONFIG_USART6_OFLOWCONTROL)
+ .oflow = true,
.cts_gpio = GPIO_USART6_CTS,
#endif
#if defined(CONFIG_SERIAL_IFLOWCONTROL) && defined(CONFIG_USART6_IFLOWCONTROL)
+ .iflow = true,
.rts_gpio = GPIO_USART6_RTS,
#endif
#ifdef CONFIG_USART6_RXDMA
@@ -910,9 +902,11 @@ static struct up_dev_s g_uart7priv =
.tx_gpio = GPIO_UART7_TX,
.rx_gpio = GPIO_UART7_RX,
#if defined(CONFIG_SERIAL_OFLOWCONTROL) && defined(CONFIG_USART7_OFLOWCONTROL)
+ .oflow = true,
.cts_gpio = GPIO_UART7_CTS,
#endif
#if defined(CONFIG_SERIAL_IFLOWCONTROL) && defined(CONFIG_USART7_IFLOWCONTROL)
+ .iflow = true,
.rts_gpio = GPIO_UART7_RTS,
#endif
#ifdef CONFIG_UART7_RXDMA
@@ -970,9 +964,11 @@ static struct up_dev_s g_uart8priv =
.tx_gpio = GPIO_UART8_TX,
.rx_gpio = GPIO_UART8_RX,
#if defined(CONFIG_SERIAL_OFLOWCONTROL) && defined(CONFIG_USART8_OFLOWCONTROL)
+ .oflow = true,
.cts_gpio = GPIO_UART8_CTS,
#endif
#if defined(CONFIG_SERIAL_IFLOWCONTROL) && defined(CONFIG_USART8_IFLOWCONTROL)
+ .iflow = true,
.rts_gpio = GPIO_UART8_RTS,
#endif
#ifdef CONFIG_UART8_RXDMA
@@ -1309,6 +1305,92 @@ static void up_set_format(struct uart_dev_s *dev)
#endif /* CONFIG_SUPPRESS_UART_CONFIG */
/****************************************************************************
+ * Name: up_set_apb_clock
+ *
+ * Description:
+ * Enable or disable APB clock for the USART peripheral
+ *
+ * Input parameters:
+ * dev - A reference to the UART driver state structure
+ * on - Enable clock if 'on' is 'true' and disable if 'false'
+ *
+ ****************************************************************************/
+
+static void up_set_apb_clock(struct uart_dev_s *dev, bool on)
+{
+ struct up_dev_s *priv = (struct up_dev_s*)dev->priv;
+ uint32_t rcc_en;
+ uint32_t regaddr;
+
+ /* Determine which USART to configure */
+
+ switch (priv->usartbase)
+ {
+ default:
+ return;
+#ifdef CONFIG_STM32_USART1
+ case STM32_USART1_BASE:
+ rcc_en = RCC_APB2ENR_USART1EN;
+ regaddr = STM32_RCC_APB2ENR;
+ break;
+#endif
+#ifdef CONFIG_STM32_USART2
+ case STM32_USART2_BASE:
+ rcc_en = RCC_APB1ENR_USART2EN;
+ regaddr = STM32_RCC_APB1ENR;
+ break;
+#endif
+#ifdef CONFIG_STM32_USART3
+ case STM32_USART3_BASE:
+ rcc_en = RCC_APB1ENR_USART3EN;
+ regaddr = STM32_RCC_APB1ENR;
+ break;
+#endif
+#ifdef CONFIG_STM32_UART4
+ case STM32_UART4_BASE:
+ rcc_en = RCC_APB1ENR_UART4EN;
+ regaddr = STM32_RCC_APB1ENR;
+ break;
+#endif
+#ifdef CONFIG_STM32_UART5
+ case STM32_UART5_BASE:
+ rcc_en = RCC_APB1ENR_UART5EN;
+ regaddr = STM32_RCC_APB1ENR;
+ break;
+#endif
+#ifdef CONFIG_STM32_USART6
+ case STM32_USART6_BASE:
+ rcc_en = RCC_APB2ENR_USART6EN;
+ regaddr = STM32_RCC_APB2ENR;
+ break;
+#endif
+#ifdef CONFIG_STM32_UART7
+ case STM32_UART7_BASE:
+ rcc_en = RCC_APB1ENR_USART5EN;
+ regaddr = STM32_RCC_APB1ENR;
+ break;
+#endif
+#ifdef CONFIG_STM32_UART8
+ case STM32_UART8_BASE:
+ rcc_en = RCC_APB1ENR_USART5EN;
+ regaddr = STM32_RCC_APB1ENR;
+ break;
+#endif
+ }
+
+ /* Enable/disable APB 1/2 clock for USART */
+
+ if (on)
+ {
+ modifyreg32(regaddr, 0, rcc_en);
+ }
+ else
+ {
+ modifyreg32(regaddr, rcc_en, 0);
+ }
+}
+
+/****************************************************************************
* Name: up_setup
*
* Description:
@@ -1328,6 +1410,10 @@ static int up_setup(struct uart_dev_s *dev)
* was enabled in stm32_lowsetup().
*/
+ /* Enable USART APB1/2 clock */
+
+ up_set_apb_clock(dev, true);
+
/* Configure pins for USART use */
stm32_configgpio(priv->tx_gpio);
@@ -1404,6 +1490,8 @@ static int up_setup(struct uart_dev_s *dev)
regval |= (USART_CR1_UE|USART_CR1_TE|USART_CR1_RE);
up_serialout(priv, STM32_USART_CR1_OFFSET, regval);
+#endif /* CONFIG_SUPPRESS_UART_CONFIG */
+
/* Set up the cached interrupt enables value */
priv->ie = 0;
@@ -1490,6 +1578,10 @@ static void up_shutdown(struct uart_dev_s *dev)
up_disableusartint(priv, NULL);
+ /* Disable USART APB1/2 clock */
+
+ up_set_apb_clock(dev, false);
+
/* Disable Rx, Tx, and the UART */
regval = up_serialin(priv, STM32_USART_CR1_OFFSET);
@@ -2007,6 +2099,46 @@ static bool up_rxavailable(struct uart_dev_s *dev)
#endif
/****************************************************************************
+ * Name: up_rxflowcontrol
+ *
+ * Description:
+ * Called when Rx buffer is full. Return true if the Rx interrupt was
+ * disabled.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_SERIAL_IFLOWCONTROL
+static bool up_rxflowcontrol(struct uart_dev_s *dev)
+{
+ struct up_dev_s *priv = (struct up_dev_s*)dev->priv;
+ uint16_t ie;
+
+ if (priv->iflow)
+ {
+ /* Disable Rx interrupt to prevent more data being from peripheral.
+ * When hardware RTS is enabled, this will prevent more data from
+ * coming in.
+ *
+ * This function is only called when UART recv buffer is full, that
+ * is: "dev->recv.head + 1 == dev->recv.tail".
+ *
+ * Logic in "uart_read" will automatically toggle Rx interrupts when
+ * buffer is read empty and thus we do not have to re-enable Rx
+ * interrupts in any other place.
+ */
+
+ ie = priv->ie;
+ ie &= ~USART_CR1_RXNEIE;
+ up_restoreusartint(priv, ie);
+
+ return true;
+ }
+
+ return false;
+}
+#endif
+
+/****************************************************************************
* Name: up_dma_receive
*
* Description:
@@ -2568,6 +2700,8 @@ void stm32_serial_dma_poll(void)
*
****************************************************************************/
+#ifdef USE_SERIALDRIVER
+
int up_putc(int ch)
{
#if CONSOLE_UART > 0
diff --git a/nuttx/arch/arm/src/str71x/str71x_serial.c b/nuttx/arch/arm/src/str71x/str71x_serial.c
index a3351eb5f..d4599574d 100644
--- a/nuttx/arch/arm/src/str71x/str71x_serial.c
+++ b/nuttx/arch/arm/src/str71x/str71x_serial.c
@@ -279,6 +279,9 @@ static const struct uart_ops_s g_uart_ops =
.receive = up_receive,
.rxint = up_rxint,
.rxavailable = up_rxavailable,
+#ifdef CONFIG_SERIAL_IFLOWCONTROL
+ .rxflowcontrol = NULL,
+#endif
.send = up_send,
.txint = up_txint,
.txready = up_txready,
diff --git a/nuttx/arch/arm/src/tiva/tiva_serial.c b/nuttx/arch/arm/src/tiva/tiva_serial.c
index c14edfad0..868976b8a 100644
--- a/nuttx/arch/arm/src/tiva/tiva_serial.c
+++ b/nuttx/arch/arm/src/tiva/tiva_serial.c
@@ -344,6 +344,9 @@ static const struct uart_ops_s g_uart_ops =
.receive = up_receive,
.rxint = up_rxint,
.rxavailable = up_rxavailable,
+#ifdef CONFIG_SERIAL_IFLOWCONTROL
+ .rxflowcontrol = NULL,
+#endif
.send = up_send,
.txint = up_txint,
.txready = up_txready,