diff --git a/arch/arm/src/tiva/tiva_lowputc.c b/arch/arm/src/tiva/tiva_lowputc.c index e355fce67a..3674450f61 100644 --- a/arch/arm/src/tiva/tiva_lowputc.c +++ b/arch/arm/src/tiva/tiva_lowputc.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/tiva/tiva_lowputc.c * - * Copyright (C) 2009-2010, 2014 Gregory Nutt. All rights reserved. + * Copyright (C) 2009-2010, 2014, 2018 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -117,41 +117,44 @@ # define TIVA_CONSOLE_BITS CONFIG_UART7_BITS # define TIVA_CONSOLE_PARITY CONFIG_UART7_PARITY # define TIVA_CONSOLE_2STOP CONFIG_UART7_2STOP -#else +#elif !defined(CONFIG_NO_SERIAL_CONSOLE) # error "No CONFIG_UARTn_SERIAL_CONSOLE Setting" #endif /* Get LCRH settings */ +#ifndef CONFIG_NO_SERIAL_CONSOLE -#if TIVA_CONSOLE_BITS == 5 -# define UART_LCRH_NBITS UART_LCRH_WLEN_5BITS -#elif TIVA_CONSOLE_BITS == 6 -# define UART_LCRH_NBITS UART_LCRH_WLEN_6BITS -#elif TIVA_CONSOLE_BITS == 7 -# define UART_LCRH_NBITS UART_LCRH_WLEN_7BITS -#elif TIVA_CONSOLE_BITS == 8 -# define UART_LCRH_NBITS UART_LCRH_WLEN_8BITS -#else -# error "Number of bits not supported" -#endif +# if TIVA_CONSOLE_BITS == 5 +# define UART_LCRH_NBITS UART_LCRH_WLEN_5BITS +# elif TIVA_CONSOLE_BITS == 6 +# define UART_LCRH_NBITS UART_LCRH_WLEN_6BITS +# elif TIVA_CONSOLE_BITS == 7 +# define UART_LCRH_NBITS UART_LCRH_WLEN_7BITS +# elif TIVA_CONSOLE_BITS == 8 +# define UART_LCRH_NBITS UART_LCRH_WLEN_8BITS +# else +# error "Number of bits not supported" +# endif -#if TIVA_CONSOLE_PARITY == 0 -# define UART_LCRH_PARITY (0) -#elif TIVA_CONSOLE_PARITY == 1 -# define UART_LCRH_PARITY UART_LCRH_PEN -#elif TIVA_CONSOLE_PARITY == 2 -# define UART_LCRH_PARITY (UART_LCRH_PEN|UART_LCRH_EPS) -#else -# error "Invalid parity selection" -#endif +# if TIVA_CONSOLE_PARITY == 0 +# define UART_LCRH_PARITY (0) +# elif TIVA_CONSOLE_PARITY == 1 +# define UART_LCRH_PARITY UART_LCRH_PEN +# elif TIVA_CONSOLE_PARITY == 2 +# define UART_LCRH_PARITY (UART_LCRH_PEN|UART_LCRH_EPS) +# else +# error "Invalid parity selection" +# endif -#if TIVA_CONSOLE_2STOP != 0 -# define UART_LCRH_NSTOP UART_LCRH_STP2 -#else -# define UART_LCRH_NSTOP (0) -#endif +# if TIVA_CONSOLE_2STOP != 0 +# define UART_LCRH_NSTOP UART_LCRH_STP2 +# else +# define UART_LCRH_NSTOP (0) +# endif -#define UART_LCRH_VALUE (UART_LCRH_NBITS|UART_LCRH_PARITY|UART_LCRH_NSTOP|UART_LCRH_FEN) +# define UART_LCRH_VALUE (UART_LCRH_NBITS|UART_LCRH_PARITY|UART_LCRH_NSTOP|UART_LCRH_FEN) + +#endif /* !CONFIG_NO_SERIAL_CONSOLE */ /* Calculate BAUD rate from the SYS clock: * diff --git a/arch/arm/src/tiva/tiva_lowputc.h b/arch/arm/src/tiva/tiva_lowputc.h index 405813ee8f..6e4c8dfbdc 100644 --- a/arch/arm/src/tiva/tiva_lowputc.h +++ b/arch/arm/src/tiva/tiva_lowputc.h @@ -151,6 +151,16 @@ # undef CONFIG_UART5_SERIAL_CONSOLE # undef CONFIG_UART6_SERIAL_CONSOLE # define HAVE_SERIAL_CONSOLE 1 +#elif defined(CONFIG_NO_SERIAL_CONSOLE) +# undef CONFIG_UART0_SERIAL_CONSOLE +# undef CONFIG_UART1_SERIAL_CONSOLE +# undef CONFIG_UART2_SERIAL_CONSOLE +# undef CONFIG_UART3_SERIAL_CONSOLE +# undef CONFIG_UART4_SERIAL_CONSOLE +# undef CONFIG_UART5_SERIAL_CONSOLE +# undef CONFIG_UART6_SERIAL_CONSOLE +# undef CONFIG_UART7_SERIAL_CONSOLE +# undef HAVE_SERIAL_CONSOLE #else # warning "No valid CONFIG_UARTn_SERIAL_CONSOLE Setting" # undef CONFIG_UART0_SERIAL_CONSOLE diff --git a/arch/arm/src/tiva/tiva_serial.c b/arch/arm/src/tiva/tiva_serial.c index da2aedf70f..1118e67284 100644 --- a/arch/arm/src/tiva/tiva_serial.c +++ b/arch/arm/src/tiva/tiva_serial.c @@ -1196,7 +1196,7 @@ static bool up_txempty(struct uart_dev_s *dev) ****************************************************************************/ /**************************************************************************** - * Name: up_serialinit + * Name: up_earlyserialinit * * Description: * Performs the low level UART initialization early in @@ -1205,6 +1205,7 @@ static bool up_txempty(struct uart_dev_s *dev) * ****************************************************************************/ +#ifndef CONFIG_NO_SERIAL_CONSOLE void up_earlyserialinit(void) { /* NOTE: All GPIO configuration for the UARTs was performed in @@ -1243,6 +1244,7 @@ void up_earlyserialinit(void) up_setup(&CONSOLE_DEV); #endif } +#endif /* !CONFIG_NO_SERIAL_CONSOLE */ /**************************************************************************** * Name: up_serialinit