You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2021/06/14 12:05:33 UTC

[incubator-nuttx] 04/04: arm/rp2040: Fix warnings when UART console is not used

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

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

commit 9b8e81ebc1f29408a6429c3eb80281845045fe29
Author: Yuichi Nakamura <y....@gmail.com>
AuthorDate: Mon Jun 14 08:16:48 2021 +0900

    arm/rp2040: Fix warnings when UART console is not used
---
 arch/arm/src/rp2040/rp2040_uart.c | 40 ++++++++++++++++++++++-----------------
 1 file changed, 23 insertions(+), 17 deletions(-)

diff --git a/arch/arm/src/rp2040/rp2040_uart.c b/arch/arm/src/rp2040/rp2040_uart.c
index f37e073..0ab2021 100644
--- a/arch/arm/src/rp2040/rp2040_uart.c
+++ b/arch/arm/src/rp2040/rp2040_uart.c
@@ -64,30 +64,36 @@
 
 /* Get word length setting for the console */
 
-#if CONSOLE_BITS >= 5 && CONSOLE_BITS <= 8
- #define CONSOLE_LCR_WLS RP2040_UART_LCR_H_WLEN(CONSOLE_BITS)
-#elif defined(HAVE_CONSOLE)
- #error "Invalid CONFIG_UARTn_BITS setting for console "
+#if defined(HAVE_CONSOLE)
+ #if CONSOLE_BITS >= 5 && CONSOLE_BITS <= 8
+  #define CONSOLE_LCR_WLS RP2040_UART_LCR_H_WLEN(CONSOLE_BITS)
+ #else
+  #error "Invalid CONFIG_UARTn_BITS setting for console "
+ #endif
 #endif
 
 /* Get parity setting for the console */
 
-#if CONSOLE_PARITY == 0
- #define CONSOLE_LCR_PAR 0
-#elif CONSOLE_PARITY == 1
- #define CONSOLE_LCR_PAR (RP2040_UART_UARTLCR_H_PEN)
-#elif CONSOLE_PARITY == 2
- #define CONSOLE_LCR_PAR (RP2040_UART_UARTLCR_H_PEN | RP2040_UART_UARTLCR_H_EPS)
-#elif defined(HAVE_CONSOLE)
- #error "Invalid CONFIG_UARTn_PARITY setting for CONSOLE"
+#if defined(HAVE_CONSOLE)
+ #if CONSOLE_PARITY == 0
+  #define CONSOLE_LCR_PAR 0
+ #elif CONSOLE_PARITY == 1
+  #define CONSOLE_LCR_PAR (RP2040_UART_UARTLCR_H_PEN)
+ #elif CONSOLE_PARITY == 2
+  #define CONSOLE_LCR_PAR (RP2040_UART_UARTLCR_H_PEN | RP2040_UART_UARTLCR_H_EPS)
+ #else
+  #error "Invalid CONFIG_UARTn_PARITY setting for CONSOLE"
+ #endif
 #endif
 
-/* Get stop-bit setting for the console and UART0/1/2 */
+/* Get stop-bit setting for the console and UART0/1 */
 
-#if CONSOLE_2STOP != 0
- #define CONSOLE_LCR_STOP RP2040_UART_UARTLCR_H_STP2
-#else
- #define CONSOLE_LCR_STOP 0
+#if defined(HAVE_CONSOLE)
+ #if CONSOLE_2STOP != 0
+  #define CONSOLE_LCR_STOP RP2040_UART_UARTLCR_H_STP2
+ #else
+  #define CONSOLE_LCR_STOP 0
+ #endif
 #endif
 
 /* LCR and FCR values for the console */