EFM32: Add configuration option to use USARTs as SPI

This commit is contained in:
Gregory Nutt 2014-10-23 08:25:37 -06:00
parent 1ade9198c1
commit 85834ac1f1
2 changed files with 72 additions and 6 deletions

View File

@ -157,6 +157,48 @@ config EFM32_GPIO_IRQ
---help---
Enable support for interrupting GPIO pins
choice
prompt "USART0 Mode"
default EFM32_USART0_ISUART
depends on EFM32_USART0
config EFM32_USART0_ISUART
bool "USART0 is a UART"
select USART0_ISUART
config EFM32_USART0_ISSPI
bool "USART0 is SPI"
endchoice # USART0 Mode
choice
prompt "USART1 Mode"
default EFM32_USART1_ISUART
depends on EFM32_USART1
config EFM32_USART1_ISUART
bool "USART1 is a UART"
select USART1_ISUART
config EFM32_USART1_ISSPI
bool "USART1 is SPI"
endchoice # USART1 Mode
choice
prompt "USART2 Mode"
default EFM32_USART2_ISUART
depends on EFM32_USART2
config EFM32_USART2_ISUART
bool "USART2 is a UART"
select USART2_ISUART
config EFM32_USART2_ISSPI
bool "USART2 is SPI"
endchoice # USART2 Mode
choice
prompt "LEUART Serial Console"
default NO_LEUART_SERIAL_CONSOLE

View File

@ -82,15 +82,39 @@
# undef CONFIG_EFM32_LEUART1
#endif
/* Is there a UART device? */
/* Is there a UART device? Or an SPI device? */
#ifndef CONFIG_EFM32_USART0
# undef CONFIG_EFM32_USART0_ISUART
# undef CONFIG_EFM32_USART0_ISSPI
#endif
#ifndef CONFIG_EFM32_USART1
# undef CONFIG_EFM32_USART1_ISUART
# undef CONFIG_EFM32_USART1_ISSPI
#endif
#ifndef CONFIG_EFM32_USART2
# undef CONFIG_EFM32_USART2_ISUART
# undef CONFIG_EFM32_USART2_ISSPI
#endif
#undef HAVE_UART_DEVICE
#if defined(CONFIG_EFM32_USART0) || defined(CONFIG_EFM32_USART1) || \
defined(CONFIG_EFM32_USART2) || defined(CONFIG_EFM32_UART0) || \
#if defined(CONFIG_EFM32_USART0_ISUART) || \
defined(CONFIG_EFM32_USART1_ISUART) || \
defined(CONFIG_EFM32_USART2_ISUART) || \
defined(CONFIG_EFM32_UART0) || \
defined(CONFIG_EFM32_UART1)
# define HAVE_UART_DEVICE 1
#endif
#undef HAVE_SPI_DEVICE
#if defined(CONFIG_EFM32_USART0_ISSPI) || \
defined(CONFIG_EFM32_USART1_ISSPI) || \
defined(CONFIG_EFM32_USART2_ISSPI)
# define HAVE_SPI_DEVICE 1
#endif
/* Is there an LEUART device? */
#undef HAVE_LEUART_DEVICE
@ -103,7 +127,7 @@
#undef HAVE_UART_CONSOLE
#undef HAVE_LEUART_CONSOLE
#if defined(CONFIG_USART0_SERIAL_CONSOLE) && defined(CONFIG_EFM32_USART0)
#if defined(CONFIG_USART0_SERIAL_CONSOLE) && defined(CONFIG_EFM32_USART0_ISUART)
# undef CONFIG_USART1_SERIAL_CONSOLE
# undef CONFIG_USART2_SERIAL_CONSOLE
# undef CONFIG_UART0_SERIAL_CONSOLE
@ -111,7 +135,7 @@
# undef CONFIG_LEUART0_SERIAL_CONSOLE
# undef CONFIG_LEUART1_SERIAL_CONSOLE
# define HAVE_UART_CONSOLE 1
#elif defined(CONFIG_USART1_SERIAL_CONSOLE) && defined(CONFIG_EFM32_USART1)
#elif defined(CONFIG_USART1_SERIAL_CONSOLE) && defined(CONFIG_EFM32_USART1_ISUART)
# undef CONFIG_USART0_SERIAL_CONSOLE
# undef CONFIG_USART2_SERIAL_CONSOLE
# undef CONFIG_UART0_SERIAL_CONSOLE
@ -119,7 +143,7 @@
# undef CONFIG_LEUART0_SERIAL_CONSOLE
# undef CONFIG_LEUART1_SERIAL_CONSOLE
# define HAVE_UART_CONSOLE 1
#elif defined(CONFIG_USART2_SERIAL_CONSOLE) && defined(CONFIG_EFM32_USART2)
#elif defined(CONFIG_USART2_SERIAL_CONSOLE) && defined(CONFIG_EFM32_USART2_ISUART)
# undef CONFIG_USART0_SERIAL_CONSOLE
# undef CONFIG_USART1_SERIAL_CONSOLE
# undef CONFIG_UART0_SERIAL_CONSOLE