mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 00:14:22 +08:00
Squashed commit of the following:
drivers/serial/uart_16550.c: Add a configuration, analogous to the STM32 configuration option, to suppress the NuttX standard re-ordering for /dev/ttySN for special case of the 16550 UART.
config/serial: UART 16550: Add CONFIG_SERIAL_UART_ARCH_MMIO option so the a memory mapped device doesn't need to provide uart_getreg() and uart_putreg() implementations.
u16550_txempty() should check UART_LSR_TEMT to avoid some data left in the transmit FIFO
This commit is contained in:
@@ -58,16 +58,6 @@
|
|||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
uart_datawidth_t uart_getreg(uart_addrwidth_t base, unsigned int offset)
|
|
||||||
{
|
|
||||||
return *((volatile uart_addrwidth_t *)base + offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
void uart_putreg(uart_addrwidth_t base, unsigned int offset, uart_datawidth_t value)
|
|
||||||
{
|
|
||||||
*((volatile uart_addrwidth_t *)base + offset) = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
void uart_decodeirq(int irq, FAR void *context)
|
void uart_decodeirq(int irq, FAR void *context)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ CONFIG_SCHED_CHILD_STATUS=y
|
|||||||
CONFIG_SCHED_HAVE_PARENT=y
|
CONFIG_SCHED_HAVE_PARENT=y
|
||||||
CONFIG_SCHED_HPWORK=y
|
CONFIG_SCHED_HPWORK=y
|
||||||
CONFIG_SCHED_WAITPID=y
|
CONFIG_SCHED_WAITPID=y
|
||||||
|
CONFIG_SERIAL_UART_ARCH_MMIO=y
|
||||||
CONFIG_STANDARD_SERIAL=y
|
CONFIG_STANDARD_SERIAL=y
|
||||||
CONFIG_START_DAY=28
|
CONFIG_START_DAY=28
|
||||||
CONFIG_START_MONTH=6
|
CONFIG_START_MONTH=6
|
||||||
|
|||||||
@@ -5,6 +5,16 @@
|
|||||||
|
|
||||||
if 16550_UART
|
if 16550_UART
|
||||||
|
|
||||||
|
config 16550_SERIAL_DISABLE_REORDERING
|
||||||
|
bool "Disable reordering of ttySx devices."
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
NuttX per default reorders the serial ports (/dev/ttySx) so that the
|
||||||
|
console is always on /dev/ttyS0. If more than one UART is in use this
|
||||||
|
can, however, have the side-effect that all port mappings
|
||||||
|
(hardware USART1 -> /dev/ttyS0) change if the console is moved to another
|
||||||
|
UART. This option disables that re-ordering for 16550 UARTs.
|
||||||
|
|
||||||
config 16550_UART0
|
config 16550_UART0
|
||||||
bool "16550 UART0"
|
bool "16550 UART0"
|
||||||
default n
|
default n
|
||||||
@@ -307,6 +317,10 @@ config 16550_SUPRESS_CONFIG
|
|||||||
that configures the 16550_UART. In that case, you may want to
|
that configures the 16550_UART. In that case, you may want to
|
||||||
just leave the existing console configuration in place. Default: n
|
just leave the existing console configuration in place. Default: n
|
||||||
|
|
||||||
|
config SERIAL_UART_ARCH_MMIO
|
||||||
|
bool "Platform access register through the memory mapping"
|
||||||
|
default n
|
||||||
|
|
||||||
config SERIAL_UART_ARCH_IOCTL
|
config SERIAL_UART_ARCH_IOCTL
|
||||||
bool "Platform has own custom IOCTL"
|
bool "Platform has own custom IOCTL"
|
||||||
default n
|
default n
|
||||||
|
|||||||
+185
-142
@@ -2,7 +2,7 @@
|
|||||||
* drivers/serial/uart_16550.c
|
* drivers/serial/uart_16550.c
|
||||||
* Serial driver for 16550 UART
|
* Serial driver for 16550 UART
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011, 2013, 2017 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2011, 2013, 2017-2018 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -143,7 +143,7 @@ static char g_uart3rxbuffer[CONFIG_16550_UART3_RXBUFSIZE];
|
|||||||
static char g_uart3txbuffer[CONFIG_16550_UART3_TXBUFSIZE];
|
static char g_uart3txbuffer[CONFIG_16550_UART3_TXBUFSIZE];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* This describes the state of the LPC17xx uart0 port. */
|
/* This describes the state of the 16550 uart0 port. */
|
||||||
|
|
||||||
#ifdef CONFIG_16550_UART0
|
#ifdef CONFIG_16550_UART0
|
||||||
static struct u16550_s g_uart0priv =
|
static struct u16550_s g_uart0priv =
|
||||||
@@ -178,7 +178,7 @@ static uart_dev_t g_uart0port =
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* This describes the state of the LPC17xx uart1 port. */
|
/* This describes the state of the 16550 uart1 port. */
|
||||||
|
|
||||||
#ifdef CONFIG_16550_UART1
|
#ifdef CONFIG_16550_UART1
|
||||||
static struct u16550_s g_uart1priv =
|
static struct u16550_s g_uart1priv =
|
||||||
@@ -213,7 +213,7 @@ static uart_dev_t g_uart1port =
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* This describes the state of the LPC17xx uart1 port. */
|
/* This describes the state of the 16550 uart1 port. */
|
||||||
|
|
||||||
#ifdef CONFIG_16550_UART2
|
#ifdef CONFIG_16550_UART2
|
||||||
static struct u16550_s g_uart2priv =
|
static struct u16550_s g_uart2priv =
|
||||||
@@ -248,7 +248,7 @@ static uart_dev_t g_uart2port =
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* This describes the state of the LPC17xx uart1 port. */
|
/* This describes the state of the 16550 uart1 port. */
|
||||||
|
|
||||||
#ifdef CONFIG_16550_UART3
|
#ifdef CONFIG_16550_UART3
|
||||||
static struct u16550_s g_uart3priv =
|
static struct u16550_s g_uart3priv =
|
||||||
@@ -283,166 +283,201 @@ static uart_dev_t g_uart3port =
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Which UART with be tty0/console and which tty1? tty2? tty3? */
|
/* Which UART with be tty0/console and which tty1? tty2? tty3? */
|
||||||
|
|
||||||
#if defined(CONFIG_16550_UART0_SERIAL_CONSOLE)
|
#ifdef CONFIG_16550_SERIAL_DISABLE_REORDERING
|
||||||
# define CONSOLE_DEV g_uart0port /* UART0=console */
|
|
||||||
# define TTYS0_DEV g_uart0port /* UART0=ttyS0 */
|
# if defined(CONFIG_16550_UART0_SERIAL_CONSOLE)
|
||||||
|
# define CONSOLE_DEV g_uart0port /* UART0=console */
|
||||||
|
# elif defined(CONFIG_16550_UART1_SERIAL_CONSOLE)
|
||||||
|
# define CONSOLE_DEV g_uart1port /* UART1=console */
|
||||||
|
# elif defined(CONFIG_16550_UART2_SERIAL_CONSOLE)
|
||||||
|
# define CONSOLE_DEV g_uart2port /* UART2=console */
|
||||||
|
# elif defined(CONFIG_16550_UART3_SERIAL_CONSOLE)
|
||||||
|
# define CONSOLE_DEV g_uart3port /* UART3=console */
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef CONFIG_16550_UART0
|
||||||
|
# define TTYS0_DEV g_uart0port
|
||||||
|
# endif
|
||||||
|
|
||||||
# ifdef CONFIG_16550_UART1
|
# ifdef CONFIG_16550_UART1
|
||||||
# define TTYS1_DEV g_uart1port /* UART0=ttyS0;UART1=ttyS1 */
|
# define TTYS1_DEV g_uart1port
|
||||||
# ifdef CONFIG_16550_UART2
|
|
||||||
# define TTYS2_DEV g_uart2port /* UART0=ttyS0;UART1=ttyS1;UART2=ttyS2 */
|
|
||||||
# ifdef CONFIG_16550_UART3
|
|
||||||
# define TTYS3_DEV g_uart3port /* UART0=ttyS0;UART1=ttyS1;UART2=ttyS2;UART3=ttyS3 */
|
|
||||||
# else
|
|
||||||
# undef TTYS3_DEV /* UART0=ttyS0;UART1=ttyS1;UART2=ttyS;No ttyS3 */
|
|
||||||
# endif
|
|
||||||
# else
|
|
||||||
# ifdef CONFIG_16550_UART3
|
|
||||||
# define TTYS2_DEV g_uart3port /* UART0=ttyS0;UART1=ttyS1;UART3=ttys2;No ttyS3 */
|
|
||||||
# else
|
|
||||||
# undef TTYS2_DEV /* UART0=ttyS0;UART1=ttyS1;No ttyS2;No ttyS3 */
|
|
||||||
# endif
|
|
||||||
# undef TTYS3_DEV /* No ttyS3 */
|
|
||||||
# endif
|
|
||||||
# else
|
|
||||||
# ifdef CONFIG_16550_UART2
|
|
||||||
# define TTYS1_DEV g_uart2port /* UART0=ttyS0;UART2=ttyS1;No ttyS3 */
|
|
||||||
# ifdef CONFIG_16550_UART3
|
|
||||||
# define TTYS2_DEV g_uart3port /* UART0=ttyS0;UART2=ttyS1;UART3=ttyS2;No ttyS3 */
|
|
||||||
# else
|
|
||||||
# undef TTYS2_DEV /* UART0=ttyS0;UART2=ttyS1;No ttyS2;No ttyS3 */
|
|
||||||
# endif
|
|
||||||
# undef TTYS3_DEV /* No ttyS3 */
|
|
||||||
# else
|
|
||||||
# ifdef CONFIG_16550_UART3
|
|
||||||
# define TTYS1_DEV g_uart3port /* UART0=ttyS0;UART3=ttyS1;No ttyS2;No ttyS3 */
|
|
||||||
# else
|
|
||||||
# undef TTYS1_DEV /* UART0=ttyS0;No ttyS1;No ttyS2;No ttyS3 */
|
|
||||||
# endif
|
|
||||||
# undef TTYS2_DEV /* No ttyS2 */
|
|
||||||
# undef TTYS3_DEV /* No ttyS3 */
|
|
||||||
# endif
|
|
||||||
# endif
|
# endif
|
||||||
#elif defined(CONFIG_16550_UART1_SERIAL_CONSOLE)
|
|
||||||
# define CONSOLE_DEV g_uart1port /* UART1=console */
|
# ifdef CONFIG_16550_UART2
|
||||||
# define TTYS0_DEV g_uart1port /* UART1=ttyS0 */
|
# define TTYS2_DEV g_uart2port
|
||||||
# ifdef CONFIG_16550_UART
|
|
||||||
# define TTYS1_DEV g_uart0port /* UART1=ttyS0;UART0=ttyS1 */
|
|
||||||
# ifdef CONFIG_16550_UART2
|
|
||||||
# define TTYS2_DEV g_uart2port /* UART1=ttyS0;UART0=ttyS1;UART2=ttyS2 */
|
|
||||||
# ifdef CONFIG_16550_UART3
|
|
||||||
# define TTYS3_DEV g_uart3port /* UART1=ttyS0;UART0=ttyS1;UART2=ttyS2;UART3=ttyS3 */
|
|
||||||
# else
|
|
||||||
# undef TTYS3_DEV /* UART1=ttyS0;UART0=ttyS1;UART2=ttyS;No ttyS3 */
|
|
||||||
# endif
|
|
||||||
# else
|
|
||||||
# ifdef CONFIG_16550_UART3
|
|
||||||
# define TTYS2_DEV g_uart3port /* UART1=ttyS0;UART0=ttyS1;UART3=ttys2;No ttyS3 */
|
|
||||||
# else
|
|
||||||
# undef TTYS2_DEV /* UART1=ttyS0;UART0=ttyS1;No ttyS2;No ttyS3 */
|
|
||||||
# endif
|
|
||||||
# undef TTYS3_DEV /* No ttyS3 */
|
|
||||||
# endif
|
|
||||||
# else
|
|
||||||
# ifdef CONFIG_16550_UART2
|
|
||||||
# define TTYS1_DEV g_uart2port /* UART1=ttyS0;UART2=ttyS1 */
|
|
||||||
# ifdef CONFIG_16550_UART3
|
|
||||||
# define TTYS2_DEV g_uart3port /* UART1=ttyS0;UART2=ttyS1;UART3=ttyS2;No ttyS3 */
|
|
||||||
# else
|
|
||||||
# undef TTYS2_DEV /* UART1=ttyS0;UART2=ttyS1;No ttyS2;No ttyS3 */
|
|
||||||
# endif
|
|
||||||
# undef TTYS3_DEV /* No ttyS3 */
|
|
||||||
# else
|
|
||||||
# ifdef CONFIG_16550_UART3
|
|
||||||
# define TTYS1_DEV g_uart3port /* UART1=ttyS0;UART3=ttyS1;No ttyS2;No ttyS3 */
|
|
||||||
# else
|
|
||||||
# undef TTYS1_DEV /* UART1=ttyS0;No ttyS1;No ttyS2;No ttyS3 */
|
|
||||||
# endif
|
|
||||||
# undef TTYS2_DEV /* No ttyS2 */
|
|
||||||
# undef TTYS3_DEV /* No ttyS3 */
|
|
||||||
# endif
|
|
||||||
# endif
|
# endif
|
||||||
#elif defined(CONFIG_16550_UART2_SERIAL_CONSOLE)
|
|
||||||
# define CONSOLE_DEV g_uart2port /* UART2=console */
|
# ifdef CONFIG_16550_UART3
|
||||||
# define TTYS0_DEV g_uart2port /* UART2=ttyS0 */
|
# define TTYS3_DEV g_uart3port
|
||||||
# ifdef CONFIG_16550_UART
|
|
||||||
# define TTYS1_DEV g_uart0port /* UART2=ttyS0;UART0=ttyS1 */
|
|
||||||
# ifdef CONFIG_16550_UART1
|
|
||||||
# define TTYS2_DEV g_uart1port /* UART2=ttyS0;UART0=ttyS1;UART1=ttyS2 */
|
|
||||||
# ifdef CONFIG_16550_UART3
|
|
||||||
# define TTYS3_DEV g_uart3port /* UART2=ttyS0;UART0=ttyS1;UART1=ttyS2;UART3=ttyS3 */
|
|
||||||
# else
|
|
||||||
# undef TTYS3_DEV /* UART2=ttyS0;UART0=ttyS1;UART1=ttyS;No ttyS3 */
|
|
||||||
# endif
|
|
||||||
# else
|
|
||||||
# ifdef CONFIG_16550_UART3
|
|
||||||
# define TTYS2_DEV g_uart3port /* UART2=ttyS0;UART0=ttyS1;UART3=ttys2;No ttyS3 */
|
|
||||||
# else
|
|
||||||
# undef TTYS2_DEV /* UART2=ttyS0;UART0=ttyS1;No ttyS2;No ttyS3 */
|
|
||||||
# endif
|
|
||||||
# undef TTYS3_DEV /* No ttyS3 */
|
|
||||||
# endif
|
|
||||||
# else
|
|
||||||
# ifdef CONFIG_16550_UART1
|
|
||||||
# define TTYS1_DEV g_uart1port /* UART2=ttyS0;UART1=ttyS1 */
|
|
||||||
# ifdef CONFIG_16550_UART3
|
|
||||||
# define TTYS2_DEV g_uart3port /* UART2=ttyS0;UART1=ttyS1;UART3=ttyS2 */
|
|
||||||
# else
|
|
||||||
# undef TTYS2_DEV /* UART2=ttyS0;UART1=ttyS1;No ttyS2;No ttyS3 */
|
|
||||||
# endif
|
|
||||||
# undef TTYS3_DEV /* No ttyS3 */
|
|
||||||
# else
|
|
||||||
# ifdef CONFIG_16550_UART3
|
|
||||||
# define TTYS1_DEV g_uart3port /* UART2=ttyS0;UART3=ttyS1;No ttyS3 */
|
|
||||||
# else
|
|
||||||
# undef TTYS1_DEV /* UART2=ttyS0;No ttyS1;No ttyS2;No ttyS3 */
|
|
||||||
# endif
|
|
||||||
# undef TTYS2_DEV /* No ttyS2 */
|
|
||||||
# undef TTYS3_DEV /* No ttyS3 */
|
|
||||||
# endif
|
|
||||||
# endif
|
# endif
|
||||||
#elif defined(CONFIG_16550_UART3_SERIAL_CONSOLE)
|
|
||||||
# define CONSOLE_DEV g_uart3port /* UART3=console */
|
#else /* CONFIG_16550_SERIAL_DISABLE_REORDERING */
|
||||||
# define TTYS0_DEV g_uart3port /* UART3=ttyS0 */
|
|
||||||
# ifdef CONFIG_16550_UART
|
/* Which UART with be tty0/console and which tty1? tty2? tty3? */
|
||||||
# define TTYS1_DEV g_uart0port /* UART3=ttyS0;UART0=ttyS1 */
|
|
||||||
|
# if defined(CONFIG_16550_UART0_SERIAL_CONSOLE)
|
||||||
|
# define CONSOLE_DEV g_uart0port /* UART0=console */
|
||||||
|
# define TTYS0_DEV g_uart0port /* UART0=ttyS0 */
|
||||||
# ifdef CONFIG_16550_UART1
|
# ifdef CONFIG_16550_UART1
|
||||||
# define TTYS2_DEV g_uart1port /* UART3=ttyS0;UART0=ttyS1;UART1=ttyS2 */
|
# define TTYS1_DEV g_uart1port /* UART0=ttyS0;UART1=ttyS1 */
|
||||||
# ifdef CONFIG_16550_UART2
|
# ifdef CONFIG_16550_UART2
|
||||||
# define TTYS3_DEV g_uart2port /* UART3=ttyS0;UART0=ttyS1;UART1=ttyS2;UART2=ttyS3 */
|
# define TTYS2_DEV g_uart2port /* UART0=ttyS0;UART1=ttyS1;UART2=ttyS2 */
|
||||||
|
# ifdef CONFIG_16550_UART3
|
||||||
|
# define TTYS3_DEV g_uart3port /* UART0=ttyS0;UART1=ttyS1;UART2=ttyS2;UART3=ttyS3 */
|
||||||
|
# else
|
||||||
|
# undef TTYS3_DEV /* UART0=ttyS0;UART1=ttyS1;UART2=ttyS;No ttyS3 */
|
||||||
|
# endif
|
||||||
# else
|
# else
|
||||||
# undef TTYS3_DEV /* UART3=ttyS0;UART0=ttyS1;UART1=ttyS;No ttyS3 */
|
# ifdef CONFIG_16550_UART3
|
||||||
|
# define TTYS2_DEV g_uart3port /* UART0=ttyS0;UART1=ttyS1;UART3=ttys2;No ttyS3 */
|
||||||
|
# else
|
||||||
|
# undef TTYS2_DEV /* UART0=ttyS0;UART1=ttyS1;No ttyS2;No ttyS3 */
|
||||||
|
# endif
|
||||||
|
# undef TTYS3_DEV /* No ttyS3 */
|
||||||
# endif
|
# endif
|
||||||
# else
|
# else
|
||||||
# ifdef CONFIG_16550_UART2
|
# ifdef CONFIG_16550_UART2
|
||||||
# define TTYS2_DEV g_uart2port /* UART3=ttyS0;UART0=ttyS1;UART2=ttys2;No ttyS3 */
|
# define TTYS1_DEV g_uart2port /* UART0=ttyS0;UART2=ttyS1;No ttyS3 */
|
||||||
|
# ifdef CONFIG_16550_UART3
|
||||||
|
# define TTYS2_DEV g_uart3port /* UART0=ttyS0;UART2=ttyS1;UART3=ttyS2;No ttyS3 */
|
||||||
|
# else
|
||||||
|
# undef TTYS2_DEV /* UART0=ttyS0;UART2=ttyS1;No ttyS2;No ttyS3 */
|
||||||
|
# endif
|
||||||
|
# undef TTYS3_DEV /* No ttyS3 */
|
||||||
# else
|
# else
|
||||||
# undef TTYS2_DEV /* UART3=ttyS0;UART0=ttyS1;No ttyS2;No ttyS3 */
|
# ifdef CONFIG_16550_UART3
|
||||||
|
# define TTYS1_DEV g_uart3port /* UART0=ttyS0;UART3=ttyS1;No ttyS2;No ttyS3 */
|
||||||
|
# else
|
||||||
|
# undef TTYS1_DEV /* UART0=ttyS0;No ttyS1;No ttyS2;No ttyS3 */
|
||||||
|
# endif
|
||||||
|
# undef TTYS2_DEV /* No ttyS2 */
|
||||||
|
# undef TTYS3_DEV /* No ttyS3 */
|
||||||
# endif
|
# endif
|
||||||
# undef TTYS3_DEV /* No ttyS3 */
|
|
||||||
# endif
|
# endif
|
||||||
# else
|
# elif defined(CONFIG_16550_UART1_SERIAL_CONSOLE)
|
||||||
# ifdef CONFIG_16550_UART1
|
# define CONSOLE_DEV g_uart1port /* UART1=console */
|
||||||
# define TTYS1_DEV g_uart1port /* UART3=ttyS0;UART1=ttyS1 */
|
# define TTYS0_DEV g_uart1port /* UART1=ttyS0 */
|
||||||
|
# ifdef CONFIG_16550_UART
|
||||||
|
# define TTYS1_DEV g_uart0port /* UART1=ttyS0;UART0=ttyS1 */
|
||||||
# ifdef CONFIG_16550_UART2
|
# ifdef CONFIG_16550_UART2
|
||||||
# define TTYS2_DEV g_uart2port /* UART3=ttyS0;UART1=ttyS1;UART2=ttyS2;No ttyS3 */
|
# define TTYS2_DEV g_uart2port /* UART1=ttyS0;UART0=ttyS1;UART2=ttyS2 */
|
||||||
|
# ifdef CONFIG_16550_UART3
|
||||||
|
# define TTYS3_DEV g_uart3port /* UART1=ttyS0;UART0=ttyS1;UART2=ttyS2;UART3=ttyS3 */
|
||||||
|
# else
|
||||||
|
# undef TTYS3_DEV /* UART1=ttyS0;UART0=ttyS1;UART2=ttyS;No ttyS3 */
|
||||||
|
# endif
|
||||||
# else
|
# else
|
||||||
# undef TTYS2_DEV /* UART3=ttyS0;UART1=ttyS1;No ttyS2;No ttyS3 */
|
# ifdef CONFIG_16550_UART3
|
||||||
|
# define TTYS2_DEV g_uart3port /* UART1=ttyS0;UART0=ttyS1;UART3=ttys2;No ttyS3 */
|
||||||
|
# else
|
||||||
|
# undef TTYS2_DEV /* UART1=ttyS0;UART0=ttyS1;No ttyS2;No ttyS3 */
|
||||||
|
# endif
|
||||||
|
# undef TTYS3_DEV /* No ttyS3 */
|
||||||
# endif
|
# endif
|
||||||
# undef TTYS3_DEV /* No ttyS3 */
|
|
||||||
# else
|
# else
|
||||||
# ifdef CONFIG_16550_UART2
|
# ifdef CONFIG_16550_UART2
|
||||||
# define TTYS1_DEV g_uart2port /* UART3=ttyS0;UART2=ttyS1;No ttyS3;No ttyS3 */
|
# define TTYS1_DEV g_uart2port /* UART1=ttyS0;UART2=ttyS1 */
|
||||||
# undef TTYS3_DEV /* UART3=ttyS0;UART2=ttyS1;No ttyS2;No ttyS3 */
|
# ifdef CONFIG_16550_UART3
|
||||||
|
# define TTYS2_DEV g_uart3port /* UART1=ttyS0;UART2=ttyS1;UART3=ttyS2;No ttyS3 */
|
||||||
|
# else
|
||||||
|
# undef TTYS2_DEV /* UART1=ttyS0;UART2=ttyS1;No ttyS2;No ttyS3 */
|
||||||
|
# endif
|
||||||
|
# undef TTYS3_DEV /* No ttyS3 */
|
||||||
# else
|
# else
|
||||||
# undef TTYS1_DEV /* UART3=ttyS0;No ttyS1;No ttyS2;No ttyS3 */
|
# ifdef CONFIG_16550_UART3
|
||||||
|
# define TTYS1_DEV g_uart3port /* UART1=ttyS0;UART3=ttyS1;No ttyS2;No ttyS3 */
|
||||||
|
# else
|
||||||
|
# undef TTYS1_DEV /* UART1=ttyS0;No ttyS1;No ttyS2;No ttyS3 */
|
||||||
|
# endif
|
||||||
|
# undef TTYS2_DEV /* No ttyS2 */
|
||||||
|
# undef TTYS3_DEV /* No ttyS3 */
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
# elif defined(CONFIG_16550_UART2_SERIAL_CONSOLE)
|
||||||
|
# define CONSOLE_DEV g_uart2port /* UART2=console */
|
||||||
|
# define TTYS0_DEV g_uart2port /* UART2=ttyS0 */
|
||||||
|
# ifdef CONFIG_16550_UART
|
||||||
|
# define TTYS1_DEV g_uart0port /* UART2=ttyS0;UART0=ttyS1 */
|
||||||
|
# ifdef CONFIG_16550_UART1
|
||||||
|
# define TTYS2_DEV g_uart1port /* UART2=ttyS0;UART0=ttyS1;UART1=ttyS2 */
|
||||||
|
# ifdef CONFIG_16550_UART3
|
||||||
|
# define TTYS3_DEV g_uart3port /* UART2=ttyS0;UART0=ttyS1;UART1=ttyS2;UART3=ttyS3 */
|
||||||
|
# else
|
||||||
|
# undef TTYS3_DEV /* UART2=ttyS0;UART0=ttyS1;UART1=ttyS;No ttyS3 */
|
||||||
|
# endif
|
||||||
|
# else
|
||||||
|
# ifdef CONFIG_16550_UART3
|
||||||
|
# define TTYS2_DEV g_uart3port /* UART2=ttyS0;UART0=ttyS1;UART3=ttys2;No ttyS3 */
|
||||||
|
# else
|
||||||
|
# undef TTYS2_DEV /* UART2=ttyS0;UART0=ttyS1;No ttyS2;No ttyS3 */
|
||||||
|
# endif
|
||||||
|
# undef TTYS3_DEV /* No ttyS3 */
|
||||||
|
# endif
|
||||||
|
# else
|
||||||
|
# ifdef CONFIG_16550_UART1
|
||||||
|
# define TTYS1_DEV g_uart1port /* UART2=ttyS0;UART1=ttyS1 */
|
||||||
|
# ifdef CONFIG_16550_UART3
|
||||||
|
# define TTYS2_DEV g_uart3port /* UART2=ttyS0;UART1=ttyS1;UART3=ttyS2 */
|
||||||
|
# else
|
||||||
|
# undef TTYS2_DEV /* UART2=ttyS0;UART1=ttyS1;No ttyS2;No ttyS3 */
|
||||||
|
# endif
|
||||||
|
# undef TTYS3_DEV /* No ttyS3 */
|
||||||
|
# else
|
||||||
|
# ifdef CONFIG_16550_UART3
|
||||||
|
# define TTYS1_DEV g_uart3port /* UART2=ttyS0;UART3=ttyS1;No ttyS3 */
|
||||||
|
# else
|
||||||
|
# undef TTYS1_DEV /* UART2=ttyS0;No ttyS1;No ttyS2;No ttyS3 */
|
||||||
|
# endif
|
||||||
|
# undef TTYS2_DEV /* No ttyS2 */
|
||||||
|
# undef TTYS3_DEV /* No ttyS3 */
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
# elif defined(CONFIG_16550_UART3_SERIAL_CONSOLE)
|
||||||
|
# define CONSOLE_DEV g_uart3port /* UART3=console */
|
||||||
|
# define TTYS0_DEV g_uart3port /* UART3=ttyS0 */
|
||||||
|
# ifdef CONFIG_16550_UART
|
||||||
|
# define TTYS1_DEV g_uart0port /* UART3=ttyS0;UART0=ttyS1 */
|
||||||
|
# ifdef CONFIG_16550_UART1
|
||||||
|
# define TTYS2_DEV g_uart1port /* UART3=ttyS0;UART0=ttyS1;UART1=ttyS2 */
|
||||||
|
# ifdef CONFIG_16550_UART2
|
||||||
|
# define TTYS3_DEV g_uart2port /* UART3=ttyS0;UART0=ttyS1;UART1=ttyS2;UART2=ttyS3 */
|
||||||
|
# else
|
||||||
|
# undef TTYS3_DEV /* UART3=ttyS0;UART0=ttyS1;UART1=ttyS;No ttyS3 */
|
||||||
|
# endif
|
||||||
|
# else
|
||||||
|
# ifdef CONFIG_16550_UART2
|
||||||
|
# define TTYS2_DEV g_uart2port /* UART3=ttyS0;UART0=ttyS1;UART2=ttys2;No ttyS3 */
|
||||||
|
# else
|
||||||
|
# undef TTYS2_DEV /* UART3=ttyS0;UART0=ttyS1;No ttyS2;No ttyS3 */
|
||||||
|
# endif
|
||||||
|
# undef TTYS3_DEV /* No ttyS3 */
|
||||||
|
# endif
|
||||||
|
# else
|
||||||
|
# ifdef CONFIG_16550_UART1
|
||||||
|
# define TTYS1_DEV g_uart1port /* UART3=ttyS0;UART1=ttyS1 */
|
||||||
|
# ifdef CONFIG_16550_UART2
|
||||||
|
# define TTYS2_DEV g_uart2port /* UART3=ttyS0;UART1=ttyS1;UART2=ttyS2;No ttyS3 */
|
||||||
|
# else
|
||||||
|
# undef TTYS2_DEV /* UART3=ttyS0;UART1=ttyS1;No ttyS2;No ttyS3 */
|
||||||
|
# endif
|
||||||
|
# undef TTYS3_DEV /* No ttyS3 */
|
||||||
|
# else
|
||||||
|
# ifdef CONFIG_16550_UART2
|
||||||
|
# define TTYS1_DEV g_uart2port /* UART3=ttyS0;UART2=ttyS1;No ttyS3;No ttyS3 */
|
||||||
|
# undef TTYS3_DEV /* UART3=ttyS0;UART2=ttyS1;No ttyS2;No ttyS3 */
|
||||||
|
# else
|
||||||
|
# undef TTYS1_DEV /* UART3=ttyS0;No ttyS1;No ttyS2;No ttyS3 */
|
||||||
|
# endif
|
||||||
|
# undef TTYS2_DEV /* No ttyS2 */
|
||||||
|
# undef TTYS3_DEV /* No ttyS3 */
|
||||||
# endif
|
# endif
|
||||||
# undef TTYS2_DEV /* No ttyS2 */
|
|
||||||
# undef TTYS3_DEV /* No ttyS3 */
|
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
#endif
|
|
||||||
|
#endif /* CONFIG_16550_SERIAL_DISABLE_REORDERING */
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Functions
|
||||||
@@ -454,7 +489,11 @@ static uart_dev_t g_uart3port =
|
|||||||
|
|
||||||
static inline uart_datawidth_t u16550_serialin(FAR struct u16550_s *priv, int offset)
|
static inline uart_datawidth_t u16550_serialin(FAR struct u16550_s *priv, int offset)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_SERIAL_UART_ARCH_MMIO
|
||||||
|
return *((FAR volatile uart_addrwidth_t *)priv->uartbase + offset);
|
||||||
|
#else
|
||||||
return uart_getreg(priv->uartbase, offset);
|
return uart_getreg(priv->uartbase, offset);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -464,7 +503,11 @@ static inline uart_datawidth_t u16550_serialin(FAR struct u16550_s *priv, int of
|
|||||||
static inline void u16550_serialout(FAR struct u16550_s *priv, int offset,
|
static inline void u16550_serialout(FAR struct u16550_s *priv, int offset,
|
||||||
uart_datawidth_t value)
|
uart_datawidth_t value)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_SERIAL_UART_ARCH_MMIO
|
||||||
|
*((FAR volatile uart_addrwidth_t *)priv->uartbase + offset) = value;
|
||||||
|
#else
|
||||||
uart_putreg(priv->uartbase, offset, value);
|
uart_putreg(priv->uartbase, offset, value);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -1000,7 +1043,7 @@ static bool u16550_txready(struct uart_dev_s *dev)
|
|||||||
static bool u16550_txempty(struct uart_dev_s *dev)
|
static bool u16550_txempty(struct uart_dev_s *dev)
|
||||||
{
|
{
|
||||||
FAR struct u16550_s *priv = (FAR struct u16550_s *)dev->priv;
|
FAR struct u16550_s *priv = (FAR struct u16550_s *)dev->priv;
|
||||||
return ((u16550_serialin(priv, UART_LSR_OFFSET) & UART_LSR_THRE) != 0);
|
return ((u16550_serialin(priv, UART_LSR_OFFSET) & UART_LSR_TEMT) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
@@ -345,8 +345,11 @@ typedef uint32_t uart_addrwidth_t;
|
|||||||
*
|
*
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
|
#ifndef CONFIG_SERIAL_UART_ARCH_MMIO
|
||||||
uart_datawidth_t uart_getreg(uart_addrwidth_t base, unsigned int offset);
|
uart_datawidth_t uart_getreg(uart_addrwidth_t base, unsigned int offset);
|
||||||
void uart_putreg(uart_addrwidth_t base, unsigned int offset, uart_datawidth_t value);
|
void uart_putreg(uart_addrwidth_t base, unsigned int offset, uart_datawidth_t value);
|
||||||
|
#endif
|
||||||
|
|
||||||
int uart_ioctl(struct file *filep, int cmd, unsigned long arg);
|
int uart_ioctl(struct file *filep, int cmd, unsigned long arg);
|
||||||
|
|
||||||
#endif /* CONFIG_16550_UART */
|
#endif /* CONFIG_16550_UART */
|
||||||
|
|||||||
Reference in New Issue
Block a user