mirror of
https://github.com/apache/nuttx.git
synced 2026-06-07 01:05:54 +08:00
SAMA5D2: Add Flexcom UART serial driver
This commit is contained in:
@@ -208,6 +208,7 @@ config ARCH_CHIP_SAMA5D2
|
||||
select SAMA5_HAVE_FLEXCOM1
|
||||
select SAMA5_HAVE_FLEXCOM2
|
||||
select SAMA5_HAVE_FLEXCOM3
|
||||
select SAMA5_HAVE_FLEXCOM4
|
||||
select SAMA5_HAVE_QSPI
|
||||
select SAMA5_HAVE_XDMA
|
||||
select SAMA5_HAVE_SAIC
|
||||
|
||||
@@ -133,7 +133,7 @@ CHIP_ASRCS =
|
||||
|
||||
CHIP_CSRCS = sam_allocateheap.c sam_boot.c sam_clockconfig.c sam_irq.c
|
||||
CHIP_CSRCS += sam_lowputc.c sam_memories.c sam_memorymap.c sam_pck.c
|
||||
CHIP_CSRCS += sam_pio.c sam_pmc.c sam_sckc.c sam_serial.c
|
||||
CHIP_CSRCS += sam_pio.c sam_pmc.c sam_sckc.c sam_serial.c sam_serialinit.c
|
||||
|
||||
# Configuration dependent C and assembly language files
|
||||
|
||||
@@ -181,6 +181,10 @@ ifeq ($(CONFIG_SAMA5_TRNG),y)
|
||||
CHIP_CSRCS += sam_trng.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_SAMA5_FLEXCOM_USART),y)
|
||||
CHIP_CSRCS += sam_flexcom_serial.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_SAMA5_SPI0),y)
|
||||
CHIP_CSRCS += sam_spi.c
|
||||
else
|
||||
|
||||
@@ -502,7 +502,7 @@
|
||||
# define FLEXUS_LINBRR_LINCD(n) ((uint32_t)(n) << FLEXUS_LINBRR_LINCD_SHIFT)
|
||||
#define FLEXUS_LINBRR_LINFP_SHIFT (16) /* Bits 16-18: Fractional Part after Synchronization */
|
||||
#define FLEXUS_LINBRR_LINFP_MASK (7 << FLEXUS_LINBRR_LINFP_SHIFT)
|
||||
# define FLEXUS_LINBRR_LINFP_MASK ((uint32_t)(n) << FLEXUS_LINBRR_LINFP_SHIFT)
|
||||
# define FLEXUS_LINBRR_LINFP(n) ((uint32_t)(n) << FLEXUS_LINBRR_LINFP_SHIFT)
|
||||
|
||||
/* USART Comparison Register */
|
||||
|
||||
|
||||
+262
-162
@@ -52,24 +52,29 @@
|
||||
* for our purposes.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_SAMA5_USART0
|
||||
# undef CONFIG_USART0_ISUART
|
||||
#ifndef CONFIG_USART0_ISUART
|
||||
# undef CONFIG_SAMA5_USART0
|
||||
# undef CONFIG_SAMA5_FLEXCOM0_USART
|
||||
# undef CONFIG_USART0_SERIAL_CONSOLE
|
||||
#endif
|
||||
#ifndef CONFIG_SAMA5_USART1
|
||||
# undef CONFIG_USART1_ISUART
|
||||
#ifndef CONFIG_USART1_ISUART
|
||||
# undef CONFIG_SAMA5_USART1
|
||||
# undef CONFIG_SAMA5_FLEXCOM1_USART
|
||||
# undef CONFIG_USART1_SERIAL_CONSOLE
|
||||
#endif
|
||||
#ifndef CONFIG_SAMA5_USART2
|
||||
# undef CONFIG_USART2_ISUART
|
||||
#ifndef CONFIG_USART2_ISUART
|
||||
# undef CONFIG_SAMA5_USART2
|
||||
# undef CONFIG_SAMA5_FLEXCOM2_USART
|
||||
# undef CONFIG_USART2_SERIAL_CONSOLE
|
||||
#endif
|
||||
#ifndef CONFIG_SAMA5_USART3
|
||||
# undef CONFIG_USART3_ISUART
|
||||
#ifndef CONFIG_USART3_ISUART
|
||||
# undef CONFIG_SAMA5_USART3
|
||||
# undef CONFIG_SAMA5_FLEXCOM3_USART
|
||||
# undef CONFIG_USART3_SERIAL_CONSOLE
|
||||
#endif
|
||||
#ifndef CONFIG_SAMA5_USART4
|
||||
# undef CONFIG_USART4_ISUART
|
||||
#ifndef CONFIG_USART4_ISUART
|
||||
# undef CONFIG_SAMA4_USART4
|
||||
# undef CONFIG_SAMA5_FLEXCOM4_USART
|
||||
# undef CONFIG_USART4_SERIAL_CONSOLE
|
||||
#endif
|
||||
|
||||
@@ -81,9 +86,9 @@
|
||||
# define SAMA5_HAVE_UART
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_USART0_ISUART) || defined(CONFIG_USART1_ISUART) || \
|
||||
defined(CONFIG_USART2_ISUART) || defined(CONFIG_USART3_ISUART) || \
|
||||
defined(CONFIG_USART4_ISUART)
|
||||
#if defined(CONFIG_SAMA0_USART4) || defined(CONFIG_SAMA1_USART4) || \
|
||||
defined(CONFIG_SAMA2_USART4) || defined(CONFIG_SAMA3_USART4) || \
|
||||
defined(CONFIG_SAMA4_USART4)
|
||||
# define SAMA5_HAVE_USART
|
||||
#endif
|
||||
|
||||
@@ -101,22 +106,6 @@
|
||||
# undef CONFIG_SAMA5_FLEXCOM4_USART
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_USART0_ISUART
|
||||
# undef CONFIG_SAMA5_FLEXCOM0_USART
|
||||
#endif
|
||||
#ifndef CONFIG_USART1_ISUART
|
||||
# undef CONFIG_SAMA5_FLEXCOM1_USART
|
||||
#endif
|
||||
#ifndef CONFIG_USART2_ISUART
|
||||
# undef CONFIG_SAMA5_FLEXCOM2_USART
|
||||
#endif
|
||||
#ifndef CONFIG_USART3_ISUART
|
||||
# undef CONFIG_SAMA5_FLEXCOM3_USART
|
||||
#endif
|
||||
#ifndef CONFIG_USART4_ISUART
|
||||
# undef CONFIG_SAMA5_FLEXCOM4_USART
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_SAMA5_FLEXCOM0_USART) || defined(CONFIG_SAMA5_FLEXCOM1_USART) || \
|
||||
defined(CONFIG_SAMA5_FLEXCOM2_USART) || defined(CONFIG_SAMA5_FLEXCOM3_USART) || \
|
||||
defined(CONFIG_SAMA5_FLEXCOM4_USART)
|
||||
@@ -135,150 +124,261 @@
|
||||
/* Is there a serial console? It could be on UART0-4 or USART0-3 */
|
||||
|
||||
#if defined(CONFIG_SAMA5_DBGU_CONSOLE) && defined(CONFIG_SAMA5_DBGU)
|
||||
# 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_USART0_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART1_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART2_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART3_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART4_SERIAL_CONSOLE
|
||||
# undef SAMA5_HAVE_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_USART0_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART1_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART2_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART3_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART4_SERIAL_CONSOLE
|
||||
# define SAMA5_HAVE_DBGU_CONSOLE 1
|
||||
# undef SAMA5_HAVE_UART_CONSOLE
|
||||
# undef SAMA5_HAVE_USART_CONSOLE
|
||||
# undef SAMA5_HAVE_FLEXCOM_CONSOLE
|
||||
#elif defined(CONFIG_UART0_SERIAL_CONSOLE) && defined(CONFIG_SAMA5_UART0)
|
||||
# undef CONFIG_SAMA5_DBGU_CONSOLE
|
||||
# undef CONFIG_UART1_SERIAL_CONSOLE
|
||||
# undef CONFIG_UART2_SERIAL_CONSOLE
|
||||
# undef CONFIG_UART3_SERIAL_CONSOLE
|
||||
# undef CONFIG_UART4_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART0_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART1_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART2_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART3_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART4_SERIAL_CONSOLE
|
||||
# define SAMA5_HAVE_SERIAL_CONSOLE 1
|
||||
# undef CONFIG_SAMA5_DBGU_CONSOLE
|
||||
# undef CONFIG_UART1_SERIAL_CONSOLE
|
||||
# undef CONFIG_UART2_SERIAL_CONSOLE
|
||||
# undef CONFIG_UART3_SERIAL_CONSOLE
|
||||
# undef CONFIG_UART4_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART0_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART1_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART2_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART3_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART4_SERIAL_CONSOLE
|
||||
# undef SAMA5_HAVE_DBGU_CONSOLE
|
||||
# define SAMA5_HAVE_UART_CONSOLE 1
|
||||
# undef SAMA5_HAVE_USART_CONSOLE
|
||||
# undef SAMA5_HAVE_FLEXCOM_CONSOLE
|
||||
#elif defined(CONFIG_UART1_SERIAL_CONSOLE) && defined(CONFIG_SAMA5_UART1)
|
||||
# undef CONFIG_SAMA5_DBGU_CONSOLE
|
||||
# undef CONFIG_UART0_SERIAL_CONSOLE
|
||||
# undef CONFIG_UART2_SERIAL_CONSOLE
|
||||
# undef CONFIG_UART3_SERIAL_CONSOLE
|
||||
# undef CONFIG_UART4_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART0_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART1_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART2_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART3_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART4_SERIAL_CONSOLE
|
||||
# define SAMA5_HAVE_SERIAL_CONSOLE 1
|
||||
# undef CONFIG_SAMA5_DBGU_CONSOLE
|
||||
# undef CONFIG_UART0_SERIAL_CONSOLE
|
||||
# undef CONFIG_UART2_SERIAL_CONSOLE
|
||||
# undef CONFIG_UART3_SERIAL_CONSOLE
|
||||
# undef CONFIG_UART4_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART0_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART1_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART2_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART3_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART4_SERIAL_CONSOLE
|
||||
# undef SAMA5_HAVE_DBGU_CONSOLE
|
||||
# define SAMA5_HAVE_UART_CONSOLE 1
|
||||
# undef SAMA5_HAVE_USART_CONSOLE
|
||||
# undef SAMA5_HAVE_FLEXCOM_CONSOLE
|
||||
#elif defined(CONFIG_UART2_SERIAL_CONSOLE) && defined(CONFIG_SAMA5_UART2)
|
||||
# undef CONFIG_SAMA5_DBGU_CONSOLE
|
||||
# undef CONFIG_UART0_SERIAL_CONSOLE
|
||||
# undef CONFIG_UART1_SERIAL_CONSOLE
|
||||
# undef CONFIG_UART3_SERIAL_CONSOLE
|
||||
# undef CONFIG_UART4_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART0_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART1_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART2_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART3_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART4_SERIAL_CONSOLE
|
||||
# define SAMA5_HAVE_SERIAL_CONSOLE 1
|
||||
# undef CONFIG_SAMA5_DBGU_CONSOLE
|
||||
# undef CONFIG_UART0_SERIAL_CONSOLE
|
||||
# undef CONFIG_UART1_SERIAL_CONSOLE
|
||||
# undef CONFIG_UART3_SERIAL_CONSOLE
|
||||
# undef CONFIG_UART4_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART0_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART1_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART2_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART3_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART4_SERIAL_CONSOLE
|
||||
# undef SAMA5_HAVE_DBGU_CONSOLE
|
||||
# define SAMA5_HAVE_UART_CONSOLE 1
|
||||
# undef SAMA5_HAVE_USART_CONSOLE
|
||||
# undef SAMA5_HAVE_FLEXCOM_CONSOLE
|
||||
#elif defined(CONFIG_UART3_SERIAL_CONSOLE) && defined(CONFIG_SAMA5_UART3)
|
||||
# undef CONFIG_SAMA5_DBGU_CONSOLE
|
||||
# undef CONFIG_UART0_SERIAL_CONSOLE
|
||||
# undef CONFIG_UART1_SERIAL_CONSOLE
|
||||
# undef CONFIG_UART2_SERIAL_CONSOLE
|
||||
# undef CONFIG_UART4_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART0_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART1_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART2_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART3_SERIAL_CONSOLE
|
||||
# define SAMA5_HAVE_SERIAL_CONSOLE 1
|
||||
# undef CONFIG_SAMA5_DBGU_CONSOLE
|
||||
# undef CONFIG_UART0_SERIAL_CONSOLE
|
||||
# undef CONFIG_UART1_SERIAL_CONSOLE
|
||||
# undef CONFIG_UART2_SERIAL_CONSOLE
|
||||
# undef CONFIG_UART4_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART0_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART1_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART2_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART3_SERIAL_CONSOLE
|
||||
# undef SAMA5_HAVE_DBGU_CONSOLE
|
||||
# define SAMA5_HAVE_UART_CONSOLE 1
|
||||
# undef SAMA5_HAVE_USART_CONSOLE
|
||||
# undef SAMA5_HAVE_FLEXCOM_CONSOLE
|
||||
#elif defined(CONFIG_UART4_SERIAL_CONSOLE) && defined(CONFIG_SAMA5_UART4)
|
||||
# undef CONFIG_SAMA5_DBGU_CONSOLE
|
||||
# undef CONFIG_UART0_SERIAL_CONSOLE
|
||||
# undef CONFIG_UART1_SERIAL_CONSOLE
|
||||
# undef CONFIG_UART2_SERIAL_CONSOLE
|
||||
# undef CONFIG_UART3_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART0_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART1_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART2_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART3_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART4_SERIAL_CONSOLE
|
||||
# define SAMA5_HAVE_SERIAL_CONSOLE 1
|
||||
# undef CONFIG_SAMA5_DBGU_CONSOLE
|
||||
# undef CONFIG_UART0_SERIAL_CONSOLE
|
||||
# undef CONFIG_UART1_SERIAL_CONSOLE
|
||||
# undef CONFIG_UART2_SERIAL_CONSOLE
|
||||
# undef CONFIG_UART3_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART0_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART1_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART2_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART3_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART4_SERIAL_CONSOLE
|
||||
# undef SAMA5_HAVE_DBGU_CONSOLE
|
||||
# define SAMA5_HAVE_UART_CONSOLE 1
|
||||
# undef SAMA5_HAVE_USART_CONSOLE
|
||||
# undef SAMA5_HAVE_FLEXCOM_CONSOLE
|
||||
#elif defined(CONFIG_USART0_SERIAL_CONSOLE) && defined(CONFIG_USART0_ISUART)
|
||||
# undef CONFIG_SAMA5_DBGU_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_USART1_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART2_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART3_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART4_SERIAL_CONSOLE
|
||||
# define SAMA5_HAVE_SERIAL_CONSOLE 1
|
||||
# undef CONFIG_SAMA5_DBGU_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_USART1_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART2_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART3_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART4_SERIAL_CONSOLE
|
||||
# undef SAMA5_HAVE_DBGU_CONSOLE
|
||||
# undef SAMA5_HAVE_UART_CONSOLE
|
||||
# define SAMA5_HAVE_USART_CONSOLE 1
|
||||
# undef SAMA5_HAVE_FLEXCOM_CONSOLE
|
||||
#elif defined(CONFIG_USART1_SERIAL_CONSOLE) && defined(CONFIG_USART1_ISUART)
|
||||
# undef CONFIG_SAMA5_DBGU_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_USART0_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART2_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART3_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART4_SERIAL_CONSOLE
|
||||
# define SAMA5_HAVE_SERIAL_CONSOLE 1
|
||||
# undef CONFIG_SAMA5_DBGU_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_USART0_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART2_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART3_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART4_SERIAL_CONSOLE
|
||||
# undef SAMA5_HAVE_DBGU_CONSOLE
|
||||
# undef SAMA5_HAVE_UART_CONSOLE
|
||||
# define SAMA5_HAVE_USART_CONSOLE 1
|
||||
# undef SAMA5_HAVE_FLEXCOM_CONSOLE
|
||||
#elif defined(CONFIG_USART2_SERIAL_CONSOLE) && defined(CONFIG_USART2_ISUART)
|
||||
# undef CONFIG_SAMA5_DBGU_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_USART0_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART1_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART3_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART4_SERIAL_CONSOLE
|
||||
# define SAMA5_HAVE_SERIAL_CONSOLE 1
|
||||
# undef CONFIG_SAMA5_DBGU_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_USART0_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART1_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART3_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART4_SERIAL_CONSOLE
|
||||
# undef SAMA5_HAVE_DBGU_CONSOLE
|
||||
# undef SAMA5_HAVE_UART_CONSOLE
|
||||
# define SAMA5_HAVE_USART_CONSOLE 1
|
||||
# undef SAMA5_HAVE_FLEXCOM_CONSOLE
|
||||
#elif defined(CONFIG_USART3_SERIAL_CONSOLE) && defined(CONFIG_USART3_ISUART)
|
||||
# undef CONFIG_SAMA5_DBGU_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_USART0_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART1_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART2_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART4_SERIAL_CONSOLE
|
||||
# define SAMA5_HAVE_SERIAL_CONSOLE 1
|
||||
# undef CONFIG_SAMA5_DBGU_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_USART0_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART1_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART2_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART4_SERIAL_CONSOLE
|
||||
# undef SAMA5_HAVE_DBGU_CONSOLE
|
||||
# undef SAMA5_HAVE_UART_CONSOLE
|
||||
# define SAMA5_HAVE_USART_CONSOLE 1
|
||||
# undef SAMA5_HAVE_FLEXCOM_CONSOLE
|
||||
#elif defined(CONFIG_USART4_SERIAL_CONSOLE) && defined(CONFIG_USART4_ISUART)
|
||||
# undef CONFIG_SAMA5_DBGU_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_USART0_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART1_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART2_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART3_SERIAL_CONSOLE
|
||||
# define SAMA5_HAVE_SERIAL_CONSOLE 1
|
||||
# undef CONFIG_SAMA5_DBGU_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_USART0_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART1_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART2_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART3_SERIAL_CONSOLE
|
||||
# undef SAMA5_HAVE_DBGU_CONSOLE
|
||||
# undef SAMA5_HAVE_UART_CONSOLE
|
||||
# define SAMA5_HAVE_USART_CONSOLE 1
|
||||
# undef SAMA5_HAVE_FLEXCOM_CONSOLE
|
||||
#elif defined(CONFIG_USART0_SERIAL_CONSOLE) && defined(CONFIG_SAMA5_FLEXCOM0_USART)
|
||||
# undef CONFIG_SAMA5_DBGU_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_USART1_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART2_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART3_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART4_SERIAL_CONSOLE
|
||||
# undef SAMA5_HAVE_DBGU_CONSOLE
|
||||
# undef SAMA5_HAVE_UART_CONSOLE
|
||||
# undef SAMA5_HAVE_USART_CONSOLE
|
||||
# define SAMA5_HAVE_FLEXCOM_CONSOLE 1
|
||||
#elif defined(CONFIG_USART1_SERIAL_CONSOLE) && defined(CONFIG_SAMA5_FLEXCOM1_USART)
|
||||
# undef CONFIG_SAMA5_DBGU_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_USART0_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART2_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART3_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART4_SERIAL_CONSOLE
|
||||
# undef SAMA5_HAVE_DBGU_CONSOLE
|
||||
# undef SAMA5_HAVE_UART_CONSOLE
|
||||
# undef SAMA5_HAVE_USART_CONSOLE
|
||||
# define SAMA5_HAVE_FLEXCOM_CONSOLE 1
|
||||
#elif defined(CONFIG_USART2_SERIAL_CONSOLE) && defined(CONFIG_SAMA5_FLEXCOM2_USART)
|
||||
# undef CONFIG_SAMA5_DBGU_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_USART0_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART1_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART3_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART4_SERIAL_CONSOLE
|
||||
# undef SAMA5_HAVE_DBGU_CONSOLE
|
||||
# undef SAMA5_HAVE_UART_CONSOLE
|
||||
# undef SAMA5_HAVE_USART_CONSOLE
|
||||
# define SAMA5_HAVE_FLEXCOM_CONSOLE 1
|
||||
#elif defined(CONFIG_USART3_SERIAL_CONSOLE) && defined(CONFIG_SAMA5_FLEXCOM3_USART)
|
||||
# undef CONFIG_SAMA5_DBGU_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_USART0_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART1_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART2_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART4_SERIAL_CONSOLE
|
||||
# undef SAMA5_HAVE_DBGU_CONSOLE
|
||||
# undef SAMA5_HAVE_UART_CONSOLE
|
||||
# undef SAMA5_HAVE_USART_CONSOLE
|
||||
# define SAMA5_HAVE_FLEXCOM_CONSOLE 1
|
||||
#elif defined(CONFIG_USART4_SERIAL_CONSOLE) && defined(CONFIG_SAMA5_FLEXCOM4_USART)
|
||||
# undef CONFIG_SAMA5_DBGU_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_USART0_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART1_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART2_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART3_SERIAL_CONSOLE
|
||||
# undef SAMA5_HAVE_DBGU_CONSOLE
|
||||
# undef SAMA5_HAVE_UART_CONSOLE
|
||||
# undef SAMA5_HAVE_USART_CONSOLE
|
||||
# define SAMA5_HAVE_FLEXCOM_CONSOLE 1
|
||||
#else
|
||||
# warning "No valid CONFIG_USARTn_SERIAL_CONSOLE Setting"
|
||||
# undef CONFIG_SAMA5_DBGU_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_USART0_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART1_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART2_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART3_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART4_SERIAL_CONSOLE
|
||||
# undef SAMA5_HAVE_SERIAL_CONSOLE
|
||||
# warning "No valid CONFIG_UARTn/USARTn_SERIAL_CONSOLE Setting"
|
||||
# undef CONFIG_SAMA5_DBGU_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_USART0_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART1_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART2_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART3_SERIAL_CONSOLE
|
||||
# undef CONFIG_USART4_SERIAL_CONSOLE
|
||||
# undef SAMA5_HAVE_DBGU_CONSOLE
|
||||
# undef SAMA5_HAVE_UART_CONSOLE
|
||||
# undef SAMA5_HAVE_USART_CONSOLE
|
||||
# undef SAMA5_HAVE_FLEXCOM_CONSOLE
|
||||
#endif
|
||||
|
||||
#endif /* __ARCH_ARM_SRC_SAMA5_SAM_CONFIG_H */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -54,6 +54,7 @@
|
||||
#include "sam_lowputc.h"
|
||||
|
||||
#include "chip/sam_uart.h"
|
||||
#include "chip/sam_flexcom.h"
|
||||
#include "chip/sam_dbgu.h"
|
||||
#include "chip/sam_pinmap.h"
|
||||
|
||||
@@ -63,8 +64,13 @@
|
||||
|
||||
/* The UART/USART modules are driven by the peripheral clock (MCK or MCK2). */
|
||||
|
||||
#define SAM_USART_CLOCK BOARD_USART_FREQUENCY /* Frequency of the USART clock */
|
||||
#define SAM_MR_USCLKS UART_MR_USCLKS_MCK /* Source = Main clock */
|
||||
#ifdef SAMA5_HAVE_FLEXCOM_CONSOLE
|
||||
# define SAM_USART_CLOCK BOARD_FLEXCOM_FREQUENCY /* Frequency of the FLEXCOM clock */
|
||||
# define SAM_MR_USCLKS FLEXUS_MR_USCLKS_MCK /* Source = Main clock */
|
||||
#else
|
||||
# define SAM_USART_CLOCK BOARD_USART_FREQUENCY /* Frequency of the USART clock */
|
||||
# define SAM_MR_USCLKS UART_MR_USCLKS_MCK /* Source = Main clock */
|
||||
#endif
|
||||
|
||||
/* Select USART parameters for the selected console */
|
||||
|
||||
@@ -81,84 +87,93 @@
|
||||
# define SAM_CONSOLE_BAUD CONFIG_SAMA5_DBGU_BAUD
|
||||
# define SAM_CONSOLE_PARITY CONFIG_SAMA5_DBGU_PARITY
|
||||
# endif
|
||||
# undef SAM_CONSOLE_ISUART
|
||||
#elif defined(CONFIG_UART0_SERIAL_CONSOLE)
|
||||
# define SAM_CONSOLE_VBASE SAM_UART0_VBASE
|
||||
# define SAM_CONSOLE_BAUD CONFIG_UART0_BAUD
|
||||
# define SAM_CONSOLE_BITS CONFIG_UART0_BITS
|
||||
# define SAM_CONSOLE_PARITY CONFIG_UART0_PARITY
|
||||
# define SAM_CONSOLE_2STOP CONFIG_UART0_2STOP
|
||||
# define SAM_CONSOLE_ISUART 1
|
||||
#elif defined(CONFIG_UART1_SERIAL_CONSOLE)
|
||||
# define SAM_CONSOLE_VBASE SAM_UART1_VBASE
|
||||
# define SAM_CONSOLE_BAUD CONFIG_UART1_BAUD
|
||||
# define SAM_CONSOLE_BITS CONFIG_UART1_BITS
|
||||
# define SAM_CONSOLE_PARITY CONFIG_UART1_PARITY
|
||||
# define SAM_CONSOLE_2STOP CONFIG_UART1_2STOP
|
||||
# define SAM_CONSOLE_ISUART 1
|
||||
#elif defined(CONFIG_UART2_SERIAL_CONSOLE)
|
||||
# define SAM_CONSOLE_VBASE SAM_UART2_VBASE
|
||||
# define SAM_CONSOLE_BAUD CONFIG_UART2_BAUD
|
||||
# define SAM_CONSOLE_BITS CONFIG_UART2_BITS
|
||||
# define SAM_CONSOLE_PARITY CONFIG_UART2_PARITY
|
||||
# define SAM_CONSOLE_2STOP CONFIG_UART2_2STOP
|
||||
# define SAM_CONSOLE_ISUART 1
|
||||
#elif defined(CONFIG_UART3_SERIAL_CONSOLE)
|
||||
# define SAM_CONSOLE_VBASE SAM_UART3_VBASE
|
||||
# define SAM_CONSOLE_BAUD CONFIG_UART3_BAUD
|
||||
# define SAM_CONSOLE_BITS CONFIG_UART3_BITS
|
||||
# define SAM_CONSOLE_PARITY CONFIG_UART3_PARITY
|
||||
# define SAM_CONSOLE_2STOP CONFIG_UART3_2STOP
|
||||
# define SAM_CONSOLE_ISUART 1
|
||||
#elif defined(CONFIG_UART4_SERIAL_CONSOLE)
|
||||
# define SAM_CONSOLE_VBASE SAM_UART4_VBASE
|
||||
# define SAM_CONSOLE_BAUD CONFIG_UART4_BAUD
|
||||
# define SAM_CONSOLE_BITS CONFIG_UART4_BITS
|
||||
# define SAM_CONSOLE_PARITY CONFIG_UART4_PARITY
|
||||
# define SAM_CONSOLE_2STOP CONFIG_UART4_2STOP
|
||||
# define SAM_CONSOLE_ISUART 1
|
||||
#elif defined(CONFIG_USART0_SERIAL_CONSOLE)
|
||||
# define SAM_CONSOLE_VBASE SAM_USART0_VBASE
|
||||
# ifdef CONFIG_SAMA5_FLEXCOM0_USART
|
||||
# define SAM_CONSOLE_VBASE SAM_FLEXUS0_VBASE
|
||||
# else
|
||||
# define SAM_CONSOLE_VBASE SAM_USART0_VBASE
|
||||
# endif
|
||||
# define SAM_CONSOLE_BAUD CONFIG_USART0_BAUD
|
||||
# define SAM_CONSOLE_BITS CONFIG_USART0_BITS
|
||||
# define SAM_CONSOLE_PARITY CONFIG_USART0_PARITY
|
||||
# define SAM_CONSOLE_2STOP CONFIG_USART0_2STOP
|
||||
# undef SAM_CONSOLE_ISUART
|
||||
#elif defined(CONFIG_USART1_SERIAL_CONSOLE)
|
||||
# define SAM_CONSOLE_VBASE SAM_USART1_VBASE
|
||||
# ifdef CONFIG_SAMA5_FLEXCOM1_USART
|
||||
# define SAM_CONSOLE_VBASE SAM_FLEXUS1_VBASE
|
||||
# else
|
||||
# define SAM_CONSOLE_VBASE SAM_USART1_VBASE
|
||||
# endif
|
||||
# define SAM_CONSOLE_BAUD CONFIG_USART1_BAUD
|
||||
# define SAM_CONSOLE_BITS CONFIG_USART1_BITS
|
||||
# define SAM_CONSOLE_PARITY CONFIG_USART1_PARITY
|
||||
# define SAM_CONSOLE_2STOP CONFIG_USART1_2STOP
|
||||
# undef SAM_CONSOLE_ISUART
|
||||
#elif defined(CONFIG_USART2_SERIAL_CONSOLE)
|
||||
# define SAM_CONSOLE_VBASE SAM_USART2_VBASE
|
||||
# ifdef CONFIG_SAMA5_FLEXCOM2_USART
|
||||
# define SAM_CONSOLE_VBASE SAM_FLEXUS2_VBASE
|
||||
# else
|
||||
# define SAM_CONSOLE_VBASE SAM_USART2_VBASE
|
||||
# endif
|
||||
# define SAM_CONSOLE_BAUD CONFIG_USART2_BAUD
|
||||
# define SAM_CONSOLE_BITS CONFIG_USART2_BITS
|
||||
# define SAM_CONSOLE_PARITY CONFIG_USART2_PARITY
|
||||
# define SAM_CONSOLE_2STOP CONFIG_USART2_2STOP
|
||||
# undef SAM_CONSOLE_ISUART
|
||||
#elif defined(CONFIG_USART3_SERIAL_CONSOLE)
|
||||
# define SAM_CONSOLE_VBASE SAM_USART3_VBASE
|
||||
# ifdef CONFIG_SAMA5_FLEXCOM3_USART
|
||||
# define SAM_CONSOLE_VBASE SAM_FLEXUS3_VBASE
|
||||
# else
|
||||
# define SAM_CONSOLE_VBASE SAM_USART3_VBASE
|
||||
# endif
|
||||
# define SAM_CONSOLE_BAUD CONFIG_USART3_BAUD
|
||||
# define SAM_CONSOLE_BITS CONFIG_USART3_BITS
|
||||
# define SAM_CONSOLE_PARITY CONFIG_USART3_PARITY
|
||||
# define SAM_CONSOLE_2STOP CONFIG_USART3_2STOP
|
||||
# undef SAM_CONSOLE_ISUART
|
||||
#elif defined(CONFIG_USART4_SERIAL_CONSOLE)
|
||||
# define SAM_CONSOLE_VBASE SAM_USART4_VBASE
|
||||
# ifdef CONFIG_SAMA5_FLEXCOM4_USART
|
||||
# define SAM_CONSOLE_VBASE SAM_FLEXUS4_VBASE
|
||||
# else
|
||||
# define SAM_CONSOLE_VBASE SAM_USART4_VBASE
|
||||
# endif
|
||||
# define SAM_CONSOLE_BAUD CONFIG_USART4_BAUD
|
||||
# define SAM_CONSOLE_BITS CONFIG_USART4_BITS
|
||||
# define SAM_CONSOLE_PARITY CONFIG_USART4_PARITY
|
||||
# define SAM_CONSOLE_2STOP CONFIG_USART4_2STOP
|
||||
# undef SAM_CONSOLE_ISUART
|
||||
#else
|
||||
# error "No CONFIG_U[S]ARTn_SERIAL_CONSOLE Setting"
|
||||
#endif
|
||||
|
||||
/* Select the settings for the mode register */
|
||||
|
||||
#if defined(SAM_CONSOLE_ISUART)
|
||||
#if defined(SAMA5_HAVE_UART_CONSOLE)
|
||||
# if SAM_CONSOLE_BITS == 8 && SAM_CONSOLE_PARITY == 0
|
||||
# elif SAM_CONSOLE_BITS == 7 && SAM_CONSOLE_PARITY != 0
|
||||
# else
|
||||
@@ -222,7 +237,7 @@
|
||||
|
||||
void up_lowputc(char ch)
|
||||
{
|
||||
#if defined(SAMA5_HAVE_SERIAL_CONSOLE)
|
||||
#if defined(SAMA5_HAVE_UART_CONSOLE) || defined(SAMA5_HAVE_USART_CONSOLE)
|
||||
irqstate_t flags;
|
||||
|
||||
for (;;)
|
||||
@@ -249,6 +264,35 @@ void up_lowputc(char ch)
|
||||
|
||||
irqrestore(flags);
|
||||
}
|
||||
|
||||
#elif defined(SAMA5_HAVE_FLEXCOM_CONSOLE)
|
||||
irqstate_t flags;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
/* Wait for the transmitter to be available */
|
||||
|
||||
while ((getreg32(SAM_CONSOLE_VBASE + SAM_FLEXUS_CSR_OFFSET) &
|
||||
FLEXUS_INT_TXEMPTY) == 0);
|
||||
|
||||
/* Disable interrupts so that the test and the transmission are
|
||||
* atomic.
|
||||
*/
|
||||
|
||||
flags = irqsave();
|
||||
if ((getreg32(SAM_CONSOLE_VBASE + SAM_FLEXUS_CSR_OFFSET) &
|
||||
FLEXUS_INT_TXEMPTY) != 0)
|
||||
{
|
||||
/* Send the character */
|
||||
|
||||
putreg32((uint32_t)ch, SAM_CONSOLE_VBASE + SAM_FLEXUS_THR_OFFSET);
|
||||
irqrestore(flags);
|
||||
return;
|
||||
}
|
||||
|
||||
irqrestore(flags);
|
||||
}
|
||||
|
||||
#elif defined(CONFIG_SAMA5_DBGU_CONSOLE)
|
||||
irqstate_t flags;
|
||||
|
||||
@@ -287,7 +331,8 @@ void up_lowputc(char ch)
|
||||
|
||||
int up_putc(int ch)
|
||||
{
|
||||
#if defined(SAMA5_HAVE_SERIAL_CONSOLE) || defined(CONFIG_SAMA5_DBGU_CONSOLE)
|
||||
#if defined(SAMA5_HAVE_UART_CONSOLE) || defined(SAMA5_HAVE_USART_CONSOLE) || \
|
||||
defined(SAMA5_HAVE_FLEXCOM_CONSOLE) || defined(CONFIG_SAMA5_DBGU_CONSOLE)
|
||||
/* Check for LF */
|
||||
|
||||
if (ch == '\n')
|
||||
@@ -432,7 +477,8 @@ void sam_lowsetup(void)
|
||||
|
||||
/* Configure the console (only) */
|
||||
|
||||
#if defined(SAMA5_HAVE_SERIAL_CONSOLE) && !defined(SUPPRESS_CONSOLE_CONFIG)
|
||||
#if (defined(SAMA5_HAVE_UART_CONSOLE) || defined(SAMA5_HAVE_USART_CONSOLE)) && \
|
||||
!defined(SUPPRESS_CONSOLE_CONFIG)
|
||||
/* Reset and disable receiver and transmitter */
|
||||
|
||||
putreg32((UART_CR_RSTRX | UART_CR_RSTTX | UART_CR_RXDIS | UART_CR_TXDIS),
|
||||
@@ -457,6 +503,33 @@ void sam_lowsetup(void)
|
||||
|
||||
putreg32((UART_CR_RXEN | UART_CR_TXEN),
|
||||
SAM_CONSOLE_VBASE + SAM_UART_CR_OFFSET);
|
||||
|
||||
#elif defined(SAMA5_HAVE_FLEXCOM_CONSOLE) && !defined(SUPPRESS_CONSOLE_CONFIG)
|
||||
/* Reset and disable receiver and transmitter */
|
||||
|
||||
putreg32((FLEXUS_CR_RSTRX | FLEXUS_CR_RSTTX | FLEXUS_CR_RXDIS | FLEXUS_CR_TXDIS),
|
||||
SAM_CONSOLE_VBASE + SAM_FLEXUS_CR_OFFSET);
|
||||
|
||||
/* Disable all interrupts */
|
||||
|
||||
putreg32(0xffffffff, SAM_CONSOLE_VBASE + SAM_FLEXUS_IDR_OFFSET);
|
||||
|
||||
/* Set up the mode register */
|
||||
|
||||
putreg32(MR_VALUE, SAM_CONSOLE_VBASE + SAM_FLEXUS_MR_OFFSET);
|
||||
|
||||
/* Configure the console baud. NOTE: Oversampling by 8 is not supported.
|
||||
* This may limit BAUD rates for lower USART clocks.
|
||||
*/
|
||||
|
||||
putreg32(((SAM_USART_CLOCK + (SAM_CONSOLE_BAUD << 3)) / (SAM_CONSOLE_BAUD << 4)),
|
||||
SAM_CONSOLE_VBASE + SAM_FLEXUS_BRGR_OFFSET);
|
||||
|
||||
/* Enable receiver & transmitter */
|
||||
|
||||
putreg32((FLEXUS_CR_RXEN | FLEXUS_CR_TXEN),
|
||||
SAM_CONSOLE_VBASE + SAM_FLEXUS_CR_OFFSET);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SAMA5_DBGU
|
||||
|
||||
+194
-169
File diff suppressed because it is too large
Load Diff
@@ -43,6 +43,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include "up_internal.h"
|
||||
#include "sam_config.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
@@ -89,6 +90,60 @@ extern "C"
|
||||
void sam_earlyserialinit(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: uart_earlyserialinit
|
||||
*
|
||||
* Description:
|
||||
* Performs the low level USART initialization early in debug so that the
|
||||
* serial console will be available during bootup. This must be called
|
||||
* before up_serialinit.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(USE_EARLYSERIALINIT) && (defined(SAMA5_HAVE_UART) || defined(SAMA5_HAVE_USART))
|
||||
void uart_earlyserialinit(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: flexus_earlyserialinit
|
||||
*
|
||||
* Description:
|
||||
* Performs the low level Flexcom USART initialization early so that the
|
||||
* Flexcom serial console will be available during bootup. This must be
|
||||
* called before flexus_serialinit.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(USE_EARLYSERIALINIT) && defined(SAMA5_HAVE_FLEXCOM_USART)
|
||||
void flexus_earlyserialinit(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: uart_serialinit
|
||||
*
|
||||
* Description:
|
||||
* Register UART/USART serial console and serial ports. This assumes that
|
||||
* uart_earlyserialinit was called previously.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(SAMA5_HAVE_UART) || defined(SAMA5_HAVE_USART)
|
||||
void uart_serialinit(void);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Name: flexus_serialinit
|
||||
*
|
||||
* Description:
|
||||
* Register Flexcom serial console and serial ports. This assumes that
|
||||
* flexus_earlyserialinit was called previously.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(USE_EARLYSERIALINIT) && defined(SAMA5_HAVE_FLEXCOM_USART)
|
||||
void flexus_serialinit(void);
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
/****************************************************************************
|
||||
* arch/arm/src/sama5/sam_serialinit.c
|
||||
*
|
||||
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include "sam_config.h"
|
||||
#include "sam_dbgu.h"
|
||||
#include "sam_serial.h"
|
||||
|
||||
#ifdef USE_SERIALDRIVER
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: sam_earlyserialinit
|
||||
*
|
||||
* Description:
|
||||
* Performs the low level serial initialization early so that the serial
|
||||
* console will be available during bootup. This must be called
|
||||
* before up_serialinit.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void sam_earlyserialinit(void)
|
||||
{
|
||||
/* NOTE: All PIO configuration for the USARTs was performed in
|
||||
* sam_lowsetup
|
||||
*/
|
||||
|
||||
#if defined(SAMA5_HAVE_UART) || defined(SAMA5_HAVE_USART)
|
||||
/* Initialize UART/USART drivers */
|
||||
|
||||
uart_serialinit();
|
||||
#endif
|
||||
|
||||
#ifdef SAMA5_HAVE_FLEXCOM_USART
|
||||
/* Initialize Flexcom USARTs */
|
||||
|
||||
flexus_earlyserialinit();
|
||||
#endif
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_serialinit
|
||||
*
|
||||
* Description:
|
||||
* Register all serial console and serial ports. This assumes
|
||||
* that up_earlyserialinit was called previously.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void up_serialinit(void)
|
||||
{
|
||||
#if defined(SAMA5_HAVE_UART) || defined(SAMA5_HAVE_USART)
|
||||
/* Register UART/USART drivers */
|
||||
|
||||
uart_serialinit();
|
||||
#endif
|
||||
|
||||
#ifdef SAMA5_HAVE_FLEXCOM_USART
|
||||
/* Register Flexcom USARTs */
|
||||
|
||||
flexus_earlyserialinit();
|
||||
#endif
|
||||
|
||||
/* Register the DBGU as well */
|
||||
|
||||
#ifdef CONFIG_SAMA5_DBGU
|
||||
sam_dbgu_register();
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* USE_SERIALDRIVER */
|
||||
Reference in New Issue
Block a user