mirror of
https://github.com/apache/nuttx.git
synced 2026-05-27 03:05:40 +08:00
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:
@@ -102,6 +102,7 @@ config EFM32_UART
|
|||||||
config EFM32_LEUART
|
config EFM32_LEUART
|
||||||
bool
|
bool
|
||||||
default n
|
default n
|
||||||
|
select MCU_SERIAL
|
||||||
|
|
||||||
# Then, these are the actual, selectable peripheral options
|
# Then, these are the actual, selectable peripheral options
|
||||||
|
|
||||||
@@ -139,12 +140,14 @@ config EFM32_UART1
|
|||||||
config EFM32_LEUART0
|
config EFM32_LEUART0
|
||||||
bool "Low energy UART0"
|
bool "Low energy UART0"
|
||||||
default n
|
default n
|
||||||
|
select ARCH_HAVE_OTHER_UART
|
||||||
select EFM32_LEUART
|
select EFM32_LEUART
|
||||||
|
|
||||||
config EFM32_LEUART1
|
config EFM32_LEUART1
|
||||||
bool "Low energy UART1"
|
bool "Low energy UART1"
|
||||||
default n
|
default n
|
||||||
select EFM32_HAVE_LEUART1
|
depends on EFM32_HAVE_LEUART1
|
||||||
|
select ARCH_HAVE_OTHER_UART
|
||||||
select EFM32_LEUART
|
select EFM32_LEUART
|
||||||
|
|
||||||
endmenu # EFM32 Peripheral Support
|
endmenu # EFM32 Peripheral Support
|
||||||
@@ -174,7 +177,7 @@ config LEUART1_SERIAL_CONSOLE
|
|||||||
Use the LEUART0 device as the serial console
|
Use the LEUART0 device as the serial console
|
||||||
|
|
||||||
config NO_LEUART_SERIAL_CONSOLE
|
config NO_LEUART_SERIAL_CONSOLE
|
||||||
bool "Other serial console"
|
bool "No LEUART serial console"
|
||||||
---help---
|
---help---
|
||||||
No serial console OR some other serial device provides the serial console
|
No serial console OR some other serial device provides the serial console
|
||||||
|
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ CHIP_CSRCS += efm32_serial.c
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(CONFIG_EFM32_LEART),y)
|
ifeq ($(CONFIG_EFM32_LEUART),y)
|
||||||
CHIP_CSRCS += efm32_leserial.c
|
CHIP_CSRCS += efm32_leserial.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,7 @@
|
|||||||
#include "up_arch.h"
|
#include "up_arch.h"
|
||||||
#include "up_internal.h"
|
#include "up_internal.h"
|
||||||
|
|
||||||
#include "chip/efm32_leart.h"
|
#include "chip/efm32_leuart.h"
|
||||||
#include "efm32_config.h"
|
#include "efm32_config.h"
|
||||||
#include "efm32_lowputc.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)
|
static int efm32_setup(struct uart_dev_s *dev)
|
||||||
{
|
{
|
||||||
struct efm32_leuart_s *priv = (struct efm32_leuart_s*)dev->priv;
|
struct efm32_leuart_s *priv = (struct efm32_leuart_s*)dev->priv;
|
||||||
uint32_t regval;
|
|
||||||
|
|
||||||
#ifndef CONFIG_SUPPRESS_LEUART_CONFIG
|
#ifndef CONFIG_SUPPRESS_LEUART_CONFIG
|
||||||
const struct efm32_config_s *config = priv->config;
|
const struct efm32_config_s *config = priv->config;
|
||||||
|
|||||||
@@ -277,7 +277,7 @@ static void efm32_leuart_setbaud(uintptr_t base, uint32_t baud)
|
|||||||
|
|
||||||
void efm32_lowsetup(void)
|
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;
|
uint32_t regval;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -327,7 +327,7 @@ void efm32_lowsetup(void)
|
|||||||
regval = getreg32(EFM32_CMU_LFBCLKEN0);
|
regval = getreg32(EFM32_CMU_LFBCLKEN0);
|
||||||
regval &= ~(CMU_LFBCLKEN0_LEUART0
|
regval &= ~(CMU_LFBCLKEN0_LEUART0
|
||||||
#ifdef CONFIG_EFM32_LEUART1
|
#ifdef CONFIG_EFM32_LEUART1
|
||||||
| CMU_HFPERCLKEN0_UART1
|
| CMU_LFBCLKEN0_LEUART1
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -578,11 +578,11 @@ void efm32_leuartconfigure(uintptr_t base, uint32_t baud, unsigned int parity,
|
|||||||
{
|
{
|
||||||
uint32_t regval = 0;
|
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).
|
* ROUTE information which must be preserved).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
efm32_uart_reset(base);
|
efm32_leuart_reset(base);
|
||||||
|
|
||||||
/* Configure number of data bits */
|
/* 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);
|
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);
|
putreg32(LEUART_CMD_RXEN | LEUART_CMD_TXEN, base + EFM32_LEUART_CMD_OFFSET);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
void efm32_lowputc(uint32_t ch);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -98,7 +98,7 @@ void efm32_uartconfigure(uintptr_t base, uint32_t baud, unsigned int parity,
|
|||||||
|
|
||||||
#ifdef HAVE_LEUART_DEVICE
|
#ifdef HAVE_LEUART_DEVICE
|
||||||
void efm32_leuartconfigure(uintptr_t base, uint32_t baud, unsigned int parity,
|
void efm32_leuartconfigure(uintptr_t base, uint32_t baud, unsigned int parity,
|
||||||
unsigned int nbits, bool stop2)
|
unsigned int nbits, bool stop2);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
@@ -115,4 +115,18 @@ void efm32_leuartconfigure(uintptr_t base, uint32_t baud, unsigned int parity,
|
|||||||
void efm32_uart_reset(uintptr_t base);
|
void efm32_uart_reset(uintptr_t base);
|
||||||
#endif
|
#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 */
|
#endif /* __ARCH_ARM_SRC_EFM32_EFM32_LOWPUTC_H */
|
||||||
|
|||||||
@@ -138,7 +138,9 @@ CONFIG_EFM32_HAVE_USART2=y
|
|||||||
CONFIG_EFM32_HAVE_UART0=y
|
CONFIG_EFM32_HAVE_UART0=y
|
||||||
# CONFIG_EFM32_HAVE_UART1 is not set
|
# CONFIG_EFM32_HAVE_UART1 is not set
|
||||||
CONFIG_EFM32_HAVE_LEUART1=y
|
CONFIG_EFM32_HAVE_LEUART1=y
|
||||||
|
# CONFIG_EFM32_USART is not set
|
||||||
CONFIG_EFM32_UART=y
|
CONFIG_EFM32_UART=y
|
||||||
|
# CONFIG_EFM32_LEUART is not set
|
||||||
# CONFIG_EFM32_USART0 is not set
|
# CONFIG_EFM32_USART0 is not set
|
||||||
# CONFIG_EFM32_USART1 is not set
|
# CONFIG_EFM32_USART1 is not set
|
||||||
# CONFIG_EFM32_USART2 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_USART6 is not set
|
||||||
# CONFIG_ARCH_HAVE_USART7 is not set
|
# CONFIG_ARCH_HAVE_USART7 is not set
|
||||||
# CONFIG_ARCH_HAVE_USART8 is not set
|
# CONFIG_ARCH_HAVE_USART8 is not set
|
||||||
|
# CONFIG_ARCH_HAVE_OTHER_UART is not set
|
||||||
|
|
||||||
#
|
#
|
||||||
# USART Configuration
|
# USART Configuration
|
||||||
@@ -391,6 +394,7 @@ CONFIG_ARCH_HAVE_UART0=y
|
|||||||
CONFIG_MCU_SERIAL=y
|
CONFIG_MCU_SERIAL=y
|
||||||
CONFIG_STANDARD_SERIAL=y
|
CONFIG_STANDARD_SERIAL=y
|
||||||
CONFIG_UART0_SERIAL_CONSOLE=y
|
CONFIG_UART0_SERIAL_CONSOLE=y
|
||||||
|
# CONFIG_OTHER_SERIAL_CONSOLE is not set
|
||||||
# CONFIG_NO_SERIAL_CONSOLE is not set
|
# CONFIG_NO_SERIAL_CONSOLE is not set
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -110,8 +110,8 @@ Serial Console
|
|||||||
|
|
||||||
Default Serial Console
|
Default Serial Console
|
||||||
----------------------
|
----------------------
|
||||||
UART0 is configured as the default serial console at 115200 8N1
|
LEUART1 is configured as the default serial console at 2400 8N1
|
||||||
on pins PE0 and PE1.
|
on pins PC6 and PC7.
|
||||||
|
|
||||||
Configurations
|
Configurations
|
||||||
==============
|
==============
|
||||||
@@ -133,7 +133,7 @@ Configurations
|
|||||||
nsh:
|
nsh:
|
||||||
---
|
---
|
||||||
Configures the NuttShell (nsh) located at apps/examples/nsh. The
|
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 is enabled, but in the base configuration no
|
||||||
builtin applications are selected (see NOTES below).
|
builtin applications are selected (see NOTES below).
|
||||||
|
|
||||||
|
|||||||
@@ -207,12 +207,20 @@
|
|||||||
/* Pin routing **************************************************************/
|
/* Pin routing **************************************************************/
|
||||||
/* UART0:
|
/* UART0:
|
||||||
*
|
*
|
||||||
* U0_RX #1 PE1 **AVAILABLE at TP130**
|
* U0_RX #1 PE1 **AVAILABLE at EXT-19**
|
||||||
* U0_TX #1 PE0 **AVAILABLE at TP129**
|
* U0_TX #1 PE0 **AVAILABLE at EXT-18**
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define BOARD_UART0_ROUTE_LOCATION _USART_ROUTE_LOCATION_LOC1
|
#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
|
* Public Function Prototypes
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|||||||
@@ -138,15 +138,29 @@ CONFIG_EFM32_HAVE_USART2=y
|
|||||||
CONFIG_EFM32_HAVE_UART0=y
|
CONFIG_EFM32_HAVE_UART0=y
|
||||||
# CONFIG_EFM32_HAVE_UART1 is not set
|
# CONFIG_EFM32_HAVE_UART1 is not set
|
||||||
CONFIG_EFM32_HAVE_LEUART1=y
|
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_USART0 is not set
|
||||||
# CONFIG_EFM32_USART1 is not set
|
# CONFIG_EFM32_USART1 is not set
|
||||||
# CONFIG_EFM32_USART2 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_UART1 is not set
|
||||||
# CONFIG_EFM32_LEUART0 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_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
|
# Architecture Options
|
||||||
@@ -362,7 +376,7 @@ CONFIG_SERIAL=y
|
|||||||
# CONFIG_DEV_LOWCONSOLE is not set
|
# CONFIG_DEV_LOWCONSOLE is not set
|
||||||
# CONFIG_16550_UART is not set
|
# CONFIG_16550_UART is not set
|
||||||
# CONFIG_ARCH_HAVE_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_UART1 is not set
|
||||||
# CONFIG_ARCH_HAVE_UART2 is not set
|
# CONFIG_ARCH_HAVE_UART2 is not set
|
||||||
# CONFIG_ARCH_HAVE_UART3 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_USART6 is not set
|
||||||
# CONFIG_ARCH_HAVE_USART7 is not set
|
# CONFIG_ARCH_HAVE_USART7 is not set
|
||||||
# CONFIG_ARCH_HAVE_USART8 is not set
|
# CONFIG_ARCH_HAVE_USART8 is not set
|
||||||
|
CONFIG_ARCH_HAVE_OTHER_UART=y
|
||||||
|
|
||||||
#
|
#
|
||||||
# USART Configuration
|
# USART Configuration
|
||||||
#
|
#
|
||||||
CONFIG_MCU_SERIAL=y
|
CONFIG_MCU_SERIAL=y
|
||||||
CONFIG_STANDARD_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
|
# 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_IFLOWCONTROL is not set
|
||||||
# CONFIG_SERIAL_OFLOWCONTROL is not set
|
# CONFIG_SERIAL_OFLOWCONTROL is not set
|
||||||
# CONFIG_USBDEV is not set
|
# CONFIG_USBDEV is not set
|
||||||
|
|||||||
@@ -434,6 +434,10 @@ config ARCH_HAVE_USART8
|
|||||||
bool
|
bool
|
||||||
default n
|
default n
|
||||||
|
|
||||||
|
config ARCH_HAVE_OTHER_UART
|
||||||
|
bool
|
||||||
|
default n
|
||||||
|
|
||||||
#
|
#
|
||||||
# USARTn configuration. Is the USART configured to behave like a UART?
|
# USARTn configuration. Is the USART configured to behave like a UART?
|
||||||
#
|
#
|
||||||
@@ -535,8 +539,9 @@ config SERIAL_TIOCSERGSTRUCT
|
|||||||
|
|
||||||
choice
|
choice
|
||||||
prompt "Serial console"
|
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
|
depends on MCU_SERIAL
|
||||||
default NO_SERIAL_CONSOLE
|
|
||||||
depends on DEV_CONSOLE
|
depends on DEV_CONSOLE
|
||||||
|
|
||||||
config UART_SERIAL_CONSOLE
|
config UART_SERIAL_CONSOLE
|
||||||
|
|||||||
Reference in New Issue
Block a user