The olimex-efm32g880f128-stk now defaults to use LEUART1 as the serial console. Also fixes lots of compile bugs from the original LEUART checkin

This commit is contained in:
Gregory Nutt 2014-10-21 11:38:51 -06:00
parent d273686d42
commit 37e08c3b49
10 changed files with 72 additions and 35 deletions

View File

@ -102,6 +102,7 @@ config EFM32_UART
config EFM32_LEUART
bool
default n
select MCU_SERIAL
# Then, these are the actual, selectable peripheral options
@ -139,12 +140,14 @@ config EFM32_UART1
config EFM32_LEUART0
bool "Low energy UART0"
default n
select ARCH_HAVE_OTHER_UART
select EFM32_LEUART
config EFM32_LEUART1
bool "Low energy UART1"
default n
select EFM32_HAVE_LEUART1
depends on EFM32_HAVE_LEUART1
select ARCH_HAVE_OTHER_UART
select EFM32_LEUART
endmenu # EFM32 Peripheral Support
@ -174,7 +177,7 @@ config LEUART1_SERIAL_CONSOLE
Use the LEUART0 device as the serial console
config NO_LEUART_SERIAL_CONSOLE
bool "Other serial console"
bool "No LEUART serial console"
---help---
No serial console OR some other serial device provides the serial console

View File

@ -109,7 +109,7 @@ CHIP_CSRCS += efm32_serial.c
endif
endif
ifeq ($(CONFIG_EFM32_LEART),y)
ifeq ($(CONFIG_EFM32_LEUART),y)
CHIP_CSRCS += efm32_leserial.c
endif

View File

@ -57,7 +57,7 @@
#include "up_arch.h"
#include "up_internal.h"
#include "chip/efm32_leart.h"
#include "chip/efm32_leuart.h"
#include "efm32_config.h"
#include "efm32_lowputc.h"
@ -364,7 +364,6 @@ static void efm32_disableuartint(struct efm32_leuart_s *priv, uint32_t *ien)
static int efm32_setup(struct uart_dev_s *dev)
{
struct efm32_leuart_s *priv = (struct efm32_leuart_s*)dev->priv;
uint32_t regval;
#ifndef CONFIG_SUPPRESS_LEUART_CONFIG
const struct efm32_config_s *config = priv->config;

View File

@ -277,7 +277,7 @@ static void efm32_leuart_setbaud(uintptr_t base, uint32_t baud)
void efm32_lowsetup(void)
{
#if defined(HAVE_UART_DEVICE) || defined(HAVE_UART_DEVICE)
#if defined(HAVE_UART_DEVICE) || defined(HAVE_LEUART_DEVICE)
uint32_t regval;
#endif
@ -327,7 +327,7 @@ void efm32_lowsetup(void)
regval = getreg32(EFM32_CMU_LFBCLKEN0);
regval &= ~(CMU_LFBCLKEN0_LEUART0
#ifdef CONFIG_EFM32_LEUART1
| CMU_HFPERCLKEN0_UART1
| CMU_LFBCLKEN0_LEUART1
#endif
);
@ -578,11 +578,11 @@ void efm32_leuartconfigure(uintptr_t base, uint32_t baud, unsigned int parity,
{
uint32_t regval = 0;
/* Make sure that the U[S]ART registers are in the reset state (except for
/* Make sure that the LEUART registers are in the reset state (except for
* ROUTE information which must be preserved).
*/
efm32_uart_reset(base);
efm32_leuart_reset(base);
/* Configure number of data bits */
@ -634,7 +634,7 @@ void efm32_leuartconfigure(uintptr_t base, uint32_t baud, unsigned int parity,
efm32_leuart_setbaud(base, baud);
/* Enable the U[S]ART */
/* Enable the LEUART */
putreg32(LEUART_CMD_RXEN | LEUART_CMD_TXEN, base + EFM32_LEUART_CMD_OFFSET);
}

View File

@ -71,7 +71,7 @@ void efm32_lowsetup(void);
*
*****************************************************************************/
#ifdef HAVE_UART_CONSOLE
#if defined(HAVE_UART_CONSOLE) || defined(HAVE_LEUART_CONSOLE)
void efm32_lowputc(uint32_t ch);
#endif
@ -98,7 +98,7 @@ void efm32_uartconfigure(uintptr_t base, uint32_t baud, unsigned int parity,
#ifdef HAVE_LEUART_DEVICE
void efm32_leuartconfigure(uintptr_t base, uint32_t baud, unsigned int parity,
unsigned int nbits, bool stop2)
unsigned int nbits, bool stop2);
#endif
/*****************************************************************************
@ -115,4 +115,18 @@ void efm32_leuartconfigure(uintptr_t base, uint32_t baud, unsigned int parity,
void efm32_uart_reset(uintptr_t base);
#endif
/*****************************************************************************
* Name: efm32_uart_reset
*
* Description:
* Reset the USART/UART by disabling it and restoring all of the registers
* to the initial, reset value. Only the ROUTE data set by efm32_lowsetup
* is preserved.
*
*****************************************************************************/
#ifdef HAVE_LEUART_DEVICE
void efm32_leuart_reset(uintptr_t base);
#endif
#endif /* __ARCH_ARM_SRC_EFM32_EFM32_LOWPUTC_H */

View File

@ -138,7 +138,9 @@ CONFIG_EFM32_HAVE_USART2=y
CONFIG_EFM32_HAVE_UART0=y
# CONFIG_EFM32_HAVE_UART1 is not set
CONFIG_EFM32_HAVE_LEUART1=y
# CONFIG_EFM32_USART is not set
CONFIG_EFM32_UART=y
# CONFIG_EFM32_LEUART is not set
# CONFIG_EFM32_USART0 is not set
# CONFIG_EFM32_USART1 is not set
# CONFIG_EFM32_USART2 is not set
@ -384,6 +386,7 @@ CONFIG_ARCH_HAVE_UART0=y
# CONFIG_ARCH_HAVE_USART6 is not set
# CONFIG_ARCH_HAVE_USART7 is not set
# CONFIG_ARCH_HAVE_USART8 is not set
# CONFIG_ARCH_HAVE_OTHER_UART is not set
#
# USART Configuration
@ -391,6 +394,7 @@ CONFIG_ARCH_HAVE_UART0=y
CONFIG_MCU_SERIAL=y
CONFIG_STANDARD_SERIAL=y
CONFIG_UART0_SERIAL_CONSOLE=y
# CONFIG_OTHER_SERIAL_CONSOLE is not set
# CONFIG_NO_SERIAL_CONSOLE is not set
#

View File

@ -110,8 +110,8 @@ Serial Console
Default Serial Console
----------------------
UART0 is configured as the default serial console at 115200 8N1
on pins PE0 and PE1.
LEUART1 is configured as the default serial console at 2400 8N1
on pins PC6 and PC7.
Configurations
==============
@ -133,7 +133,7 @@ Configurations
nsh:
---
Configures the NuttShell (nsh) located at apps/examples/nsh. The
Configuration enables the serial interfaces on UART0. Support for
Configuration enables the serial interfaces on LEUART1. Support for
builtin applications is enabled, but in the base configuration no
builtin applications are selected (see NOTES below).

View File

@ -207,12 +207,20 @@
/* Pin routing **************************************************************/
/* UART0:
*
* U0_RX #1 PE1 **AVAILABLE at TP130**
* U0_TX #1 PE0 **AVAILABLE at TP129**
* U0_RX #1 PE1 **AVAILABLE at EXT-19**
* U0_TX #1 PE0 **AVAILABLE at EXT-18**
*/
#define BOARD_UART0_ROUTE_LOCATION _USART_ROUTE_LOCATION_LOC1
/* LEUART1:
*
* LEU1_RX #0 PC7 LEU1_RX to DB-9 connector
* LEU1_TX #0 PC6 LEU1_TX to DB-9 connector
*/
#define BOARD_LEUART1_ROUTE_LOCATION _LEUART_ROUTE_LOCATION_LOC0
/****************************************************************************
* Public Function Prototypes
****************************************************************************/

View File

@ -138,15 +138,29 @@ CONFIG_EFM32_HAVE_USART2=y
CONFIG_EFM32_HAVE_UART0=y
# CONFIG_EFM32_HAVE_UART1 is not set
CONFIG_EFM32_HAVE_LEUART1=y
CONFIG_EFM32_UART=y
# CONFIG_EFM32_USART is not set
# CONFIG_EFM32_UART is not set
CONFIG_EFM32_LEUART=y
# CONFIG_EFM32_USART0 is not set
# CONFIG_EFM32_USART1 is not set
# CONFIG_EFM32_USART2 is not set
CONFIG_EFM32_UART0=y
# CONFIG_EFM32_UART0 is not set
# CONFIG_EFM32_UART1 is not set
# CONFIG_EFM32_LEUART0 is not set
# CONFIG_EFM32_LEUART1 is not set
CONFIG_EFM32_LEUART1=y
CONFIG_EFM32_GPIO_IRQ=y
CONFIG_LEUART1_SERIAL_CONSOLE=y
# CONFIG_NO_LEUART_SERIAL_CONSOLE is not set
#
# LEUART1 Configuration
#
CONFIG_LEUART1_RXBUFSIZE=64
CONFIG_LEUART1_TXBUFSIZE=64
CONFIG_LEUART1_BAUD=2400
CONFIG_LEUART1_BITS=8
CONFIG_LEUART1_PARITY=0
CONFIG_LEUART1_2STOP=0
#
# Architecture Options
@ -362,7 +376,7 @@ CONFIG_SERIAL=y
# CONFIG_DEV_LOWCONSOLE is not set
# CONFIG_16550_UART is not set
# CONFIG_ARCH_HAVE_UART is not set
CONFIG_ARCH_HAVE_UART0=y
# CONFIG_ARCH_HAVE_UART0 is not set
# CONFIG_ARCH_HAVE_UART1 is not set
# CONFIG_ARCH_HAVE_UART2 is not set
# CONFIG_ARCH_HAVE_UART3 is not set
@ -382,26 +396,16 @@ CONFIG_ARCH_HAVE_UART0=y
# CONFIG_ARCH_HAVE_USART6 is not set
# CONFIG_ARCH_HAVE_USART7 is not set
# CONFIG_ARCH_HAVE_USART8 is not set
CONFIG_ARCH_HAVE_OTHER_UART=y
#
# USART Configuration
#
CONFIG_MCU_SERIAL=y
CONFIG_STANDARD_SERIAL=y
CONFIG_UART0_SERIAL_CONSOLE=y
# CONFIG_UART0_SERIAL_CONSOLE is not set
CONFIG_OTHER_SERIAL_CONSOLE=y
# CONFIG_NO_SERIAL_CONSOLE is not set
#
# UART0 Configuration
#
CONFIG_UART0_RXBUFSIZE=64
CONFIG_UART0_TXBUFSIZE=64
CONFIG_UART0_BAUD=115200
CONFIG_UART0_BITS=8
CONFIG_UART0_PARITY=0
CONFIG_UART0_2STOP=0
# CONFIG_UART0_IFLOWCONTROL is not set
# CONFIG_UART0_OFLOWCONTROL is not set
# CONFIG_SERIAL_IFLOWCONTROL is not set
# CONFIG_SERIAL_OFLOWCONTROL is not set
# CONFIG_USBDEV is not set

View File

@ -434,6 +434,10 @@ config ARCH_HAVE_USART8
bool
default n
config ARCH_HAVE_OTHER_UART
bool
default n
#
# USARTn configuration. Is the USART configured to behave like a UART?
#
@ -535,8 +539,9 @@ config SERIAL_TIOCSERGSTRUCT
choice
prompt "Serial console"
default NO_SERIAL_CONSOLE if !ARCH_HAVE_OTHER_UART
default OTHER_SERIAL_CONSOLE if ARCH_HAVE_OTHER_UART
depends on MCU_SERIAL
default NO_SERIAL_CONSOLE
depends on DEV_CONSOLE
config UART_SERIAL_CONSOLE