console/uart: use device name instead of index
Use device name to find the UART device for console usage, instead of relying on an arbitrary index. Change-Id: Iebe01c9bf392dfee6d8284367f67647f7d47561a Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
parent
1d816afcc0
commit
08b4fd431b
25 changed files with 173 additions and 143 deletions
|
@ -65,4 +65,15 @@ config UART_NSIM_PORT_0_BASE_ADDR
|
||||||
default 0x4242
|
default 0x4242
|
||||||
depends on NSIM
|
depends on NSIM
|
||||||
|
|
||||||
|
if UART_CONSOLE
|
||||||
|
|
||||||
|
config UART_CONSOLE_ON_DEV_NAME
|
||||||
|
default "UART_0"
|
||||||
|
config UART_CONSOLE_IRQ
|
||||||
|
default 41
|
||||||
|
config UART_CONSOLE_IRQ_PRI
|
||||||
|
default 0
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -133,11 +133,7 @@
|
||||||
* - only polled mode is supported (interrupt-driven mode is NOT supported); and
|
* - only polled mode is supported (interrupt-driven mode is NOT supported); and
|
||||||
* - only the target console is supported (hostserver driver is NOT supported).
|
* - only the target console is supported (hostserver driver is NOT supported).
|
||||||
*/
|
*/
|
||||||
#define CONFIG_UART_CONSOLE_CLK_FREQ SYSCLK_DEFAULT_IOSC_HZ
|
|
||||||
#define CONFIG_UART_CONSOLE_BAUDRATE 115200
|
|
||||||
#define CONFIG_UART_CONSOLE_REGS PERIPH_ADDR_BASE_UART0
|
#define CONFIG_UART_CONSOLE_REGS PERIPH_ADDR_BASE_UART0
|
||||||
#define CONFIG_UART_CONSOLE_IRQ IRQ_UART0_INTR
|
|
||||||
#define CONFIG_UART_CONSOLE_INT_PRI 0
|
|
||||||
|
|
||||||
#endif /* !_ASMLANGUAGE */
|
#endif /* !_ASMLANGUAGE */
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,7 @@ CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=12000000
|
||||||
CONFIG_PLATFORM_TI_LM3S6965=y
|
CONFIG_PLATFORM_TI_LM3S6965=y
|
||||||
CONFIG_CONSOLE=y
|
CONFIG_CONSOLE=y
|
||||||
CONFIG_UART_CONSOLE=y
|
CONFIG_UART_CONSOLE=y
|
||||||
CONFIG_UART_CONSOLE_INDEX=0
|
CONFIG_UART_CONSOLE_ON_DEV_NAME="UART_0"
|
||||||
CONFIG_UART_CONSOLE_BAUDRATE=115200
|
|
||||||
CONFIG_SERIAL=y
|
CONFIG_SERIAL=y
|
||||||
CONFIG_CORTEX_M_SYSTICK=y
|
CONFIG_CORTEX_M_SYSTICK=y
|
||||||
CONFIG_FLASH_SIZE=256
|
CONFIG_FLASH_SIZE=256
|
||||||
|
|
|
@ -135,4 +135,15 @@ endif
|
||||||
|
|
||||||
endif # UART_K20
|
endif # UART_K20
|
||||||
|
|
||||||
|
if UART_CONSOLE
|
||||||
|
|
||||||
|
config UART_CONSOLE_ON_DEV_NAME
|
||||||
|
default "UART_0"
|
||||||
|
config UART_CONSOLE_IRQ
|
||||||
|
default 31
|
||||||
|
config UART_CONSOLE_IRQ_PRI
|
||||||
|
default 3
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -166,10 +166,6 @@ extern struct device * const uart_devs[];
|
||||||
#define CONFIG_UART_CONSOLE_PORT_TX_PIN 17
|
#define CONFIG_UART_CONSOLE_PORT_TX_PIN 17
|
||||||
#define CONFIG_UART_CONSOLE_PORT_MUX_FUNC PCR_MUX_ALT3
|
#define CONFIG_UART_CONSOLE_PORT_MUX_FUNC PCR_MUX_ALT3
|
||||||
#define CONFIG_UART_CONSOLE_CLK_FREQ SYSCLK_DEFAULT_IOSC_HZ
|
#define CONFIG_UART_CONSOLE_CLK_FREQ SYSCLK_DEFAULT_IOSC_HZ
|
||||||
#define CONFIG_UART_CONSOLE_IRQ IRQ_UART0_STATUS
|
|
||||||
#define CONFIG_UART_CONSOLE_INT_PRI 3
|
|
||||||
|
|
||||||
#define UART_CONSOLE_DEV (uart_devs[CONFIG_UART_CONSOLE_INDEX])
|
|
||||||
|
|
||||||
#endif /* CONFIG_UART_CONSOLE */
|
#endif /* CONFIG_UART_CONSOLE */
|
||||||
|
|
||||||
|
|
|
@ -100,4 +100,15 @@ endif
|
||||||
|
|
||||||
endif # UART_STELLARIS
|
endif # UART_STELLARIS
|
||||||
|
|
||||||
|
if UART_CONSOLE
|
||||||
|
|
||||||
|
config UART_CONSOLE_ON_DEV_NAME
|
||||||
|
default "UART_0"
|
||||||
|
config UART_CONSOLE_IRQ
|
||||||
|
default 5
|
||||||
|
config UART_CONSOLE_IRQ_PRI
|
||||||
|
default 3
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -96,16 +96,6 @@
|
||||||
|
|
||||||
extern struct device * const uart_devs[];
|
extern struct device * const uart_devs[];
|
||||||
|
|
||||||
/* Uart console configuration */
|
|
||||||
#if defined(CONFIG_UART_CONSOLE)
|
|
||||||
|
|
||||||
#define CONFIG_UART_CONSOLE_IRQ IRQ_UART0
|
|
||||||
#define CONFIG_UART_CONSOLE_INT_PRI 3
|
|
||||||
|
|
||||||
#define UART_CONSOLE_DEV (uart_devs[CONFIG_UART_CONSOLE_INDEX])
|
|
||||||
|
|
||||||
#endif /* CONFIG_UART_CONSOLE */
|
|
||||||
|
|
||||||
/* Bluetooth UART definitions */
|
/* Bluetooth UART definitions */
|
||||||
#if defined(CONFIG_BLUETOOTH_UART)
|
#if defined(CONFIG_BLUETOOTH_UART)
|
||||||
|
|
||||||
|
|
|
@ -43,12 +43,6 @@ by x86 platforms.
|
||||||
#endif /* CONFIG_IOAPIC */
|
#endif /* CONFIG_IOAPIC */
|
||||||
#endif /* CONFIG_BLUETOOTH_UART */
|
#endif /* CONFIG_BLUETOOTH_UART */
|
||||||
|
|
||||||
#if defined(CONFIG_CONSOLE_HANDLER)
|
|
||||||
#if defined(CONFIG_IOAPIC)
|
|
||||||
ioapic_mkstub console uart_console_isr 0
|
|
||||||
#endif /* CONFIG_IOAPIC */
|
|
||||||
#endif /* CONFIG_CONSOLE_HANDLER */
|
|
||||||
|
|
||||||
#if defined(CONFIG_UART_PIPE)
|
#if defined(CONFIG_UART_PIPE)
|
||||||
#if defined(CONFIG_IOAPIC)
|
#if defined(CONFIG_IOAPIC)
|
||||||
ioapic_mkstub uart_pipe uart_pipe_isr 0
|
ioapic_mkstub uart_pipe uart_pipe_isr 0
|
||||||
|
|
|
@ -39,9 +39,6 @@ config ROM_SIZE
|
||||||
config SYS_CLOCK_HW_CYCLES_PER_SEC
|
config SYS_CLOCK_HW_CYCLES_PER_SEC
|
||||||
default 25000000 if HPET_TIMER
|
default 25000000 if HPET_TIMER
|
||||||
|
|
||||||
config UART_CONSOLE_INDEX
|
|
||||||
default 1
|
|
||||||
|
|
||||||
config PINMUX
|
config PINMUX
|
||||||
def_bool y
|
def_bool y
|
||||||
|
|
||||||
|
@ -410,7 +407,6 @@ config ETH_DW_0_IRQ_SHARED_NAME
|
||||||
default SHARED_IRQ_0_NAME if SHARED_IRQ
|
default SHARED_IRQ_0_NAME if SHARED_IRQ
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
config KERNEL_INIT_PRIORITY_DEFAULT
|
config KERNEL_INIT_PRIORITY_DEFAULT
|
||||||
default 40
|
default 40
|
||||||
|
|
||||||
|
@ -464,4 +460,15 @@ config PINMUX_INIT_PRIORITY
|
||||||
config UART_CONSOLE_PRIORITY
|
config UART_CONSOLE_PRIORITY
|
||||||
default 70
|
default 70
|
||||||
|
|
||||||
|
if UART_CONSOLE
|
||||||
|
|
||||||
|
config UART_CONSOLE_ON_DEV_NAME
|
||||||
|
default "UART_1"
|
||||||
|
config UART_CONSOLE_IRQ
|
||||||
|
default 17
|
||||||
|
config UART_CONSOLE_IRQ_PRI
|
||||||
|
default 3
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
endif # PLATFORM_GALILEO
|
endif # PLATFORM_GALILEO
|
||||||
|
|
|
@ -59,15 +59,6 @@
|
||||||
extern struct device * const uart_devs[];
|
extern struct device * const uart_devs[];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_UART_CONSOLE)
|
|
||||||
|
|
||||||
#define CONFIG_UART_CONSOLE_IRQ CONFIG_UART_NS16550_PORT_1_IRQ
|
|
||||||
#define CONFIG_UART_CONSOLE_INT_PRI CONFIG_UART_NS16550_PORT_1_IRQ_PRI
|
|
||||||
|
|
||||||
#define UART_CONSOLE_DEV (uart_devs[CONFIG_UART_CONSOLE_INDEX])
|
|
||||||
|
|
||||||
#endif /* CONFIG_UART_CONSOLE */
|
|
||||||
|
|
||||||
#ifdef CONFIG_GPIO_DW_0
|
#ifdef CONFIG_GPIO_DW_0
|
||||||
#if defined(CONFIG_GPIO_DW_0_FALLING_EDGE)
|
#if defined(CONFIG_GPIO_DW_0_FALLING_EDGE)
|
||||||
#define GPIO_DW_0_IRQ_FLAGS (IOAPIC_EDGE | IOAPIC_LOW)
|
#define GPIO_DW_0_IRQ_FLAGS (IOAPIC_EDGE | IOAPIC_LOW)
|
||||||
|
|
|
@ -105,4 +105,15 @@ endif # UART_NS16550_PORT_1
|
||||||
|
|
||||||
endif # UART_NS16550
|
endif # UART_NS16550
|
||||||
|
|
||||||
|
if UART_CONSOLE
|
||||||
|
|
||||||
|
config UART_CONSOLE_ON_DEV_NAME
|
||||||
|
default "UART_0"
|
||||||
|
config UART_CONSOLE_IRQ
|
||||||
|
default 4
|
||||||
|
config UART_CONSOLE_IRQ_PRI
|
||||||
|
default 3
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -66,16 +66,6 @@
|
||||||
extern struct device * const uart_devs[];
|
extern struct device * const uart_devs[];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Console definitions */
|
|
||||||
#if defined(CONFIG_UART_CONSOLE)
|
|
||||||
|
|
||||||
#define CONFIG_UART_CONSOLE_IRQ CONFIG_UART_NS16550_PORT_0_IRQ
|
|
||||||
#define CONFIG_UART_CONSOLE_INT_PRI CONFIG_UART_NS16550_PORT_0_IRQ_PRI
|
|
||||||
|
|
||||||
#define UART_CONSOLE_DEV (uart_devs[CONFIG_UART_CONSOLE_INDEX])
|
|
||||||
|
|
||||||
#endif /* CONFIG_UART_CONSOLE */
|
|
||||||
|
|
||||||
/* Bluetooth UART definitions */
|
/* Bluetooth UART definitions */
|
||||||
#if defined(CONFIG_BLUETOOTH_UART)
|
#if defined(CONFIG_BLUETOOTH_UART)
|
||||||
|
|
||||||
|
|
|
@ -42,9 +42,6 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC
|
||||||
default 150000000 if LOAPIC_TIMER
|
default 150000000 if LOAPIC_TIMER
|
||||||
default 25000000 if HPET_TIMER
|
default 25000000 if HPET_TIMER
|
||||||
|
|
||||||
config UART_CONSOLE_INDEX
|
|
||||||
default 1
|
|
||||||
|
|
||||||
config KERNEL_INIT_PRIORITY_DEFAULT
|
config KERNEL_INIT_PRIORITY_DEFAULT
|
||||||
default 40
|
default 40
|
||||||
|
|
||||||
|
@ -137,4 +134,15 @@ endif # UART_NS16550_PORT_1
|
||||||
|
|
||||||
endif # UART_NS16550
|
endif # UART_NS16550
|
||||||
|
|
||||||
|
if UART_CONSOLE
|
||||||
|
|
||||||
|
config UART_CONSOLE_ON_DEV_NAME
|
||||||
|
default "UART_1"
|
||||||
|
config UART_CONSOLE_IRQ
|
||||||
|
default 17
|
||||||
|
config UART_CONSOLE_IRQ_PRI
|
||||||
|
default 3
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -60,15 +60,6 @@
|
||||||
extern struct device * const uart_devs[];
|
extern struct device * const uart_devs[];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_UART_CONSOLE)
|
|
||||||
|
|
||||||
#define CONFIG_UART_CONSOLE_IRQ CONFIG_UART_NS16550_PORT_1_IRQ
|
|
||||||
#define CONFIG_UART_CONSOLE_INT_PRI CONFIG_UART_NS16550_PORT_1_IRQ_PRI
|
|
||||||
|
|
||||||
#define UART_CONSOLE_DEV (uart_devs[CONFIG_UART_CONSOLE_INDEX])
|
|
||||||
|
|
||||||
#endif /* CONFIG_UART_CONSOLE */
|
|
||||||
|
|
||||||
#ifdef CONFIG_GPIO_DW_0
|
#ifdef CONFIG_GPIO_DW_0
|
||||||
#if defined(CONFIG_GPIO_DW_0_FALLING_EDGE)
|
#if defined(CONFIG_GPIO_DW_0_FALLING_EDGE)
|
||||||
#define GPIO_DW_0_IRQ_FLAGS (IOAPIC_EDGE | IOAPIC_LOW)
|
#define GPIO_DW_0_IRQ_FLAGS (IOAPIC_EDGE | IOAPIC_LOW)
|
||||||
|
|
|
@ -107,4 +107,15 @@ endif # UART_NS16550_PORT_1
|
||||||
|
|
||||||
endif # UART_NS16550
|
endif # UART_NS16550
|
||||||
|
|
||||||
|
if UART_CONSOLE
|
||||||
|
|
||||||
|
config UART_CONSOLE_ON_DEV_NAME
|
||||||
|
default "UART_0"
|
||||||
|
config UART_CONSOLE_IRQ
|
||||||
|
default 40
|
||||||
|
config UART_CONSOLE_IRQ_PRI
|
||||||
|
default 3
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -126,35 +126,10 @@ struct scss_interrupt {
|
||||||
/* UART uses level triggered interrupt, low level */
|
/* UART uses level triggered interrupt, low level */
|
||||||
#define UART_IOAPIC_FLAGS (IOAPIC_LEVEL)
|
#define UART_IOAPIC_FLAGS (IOAPIC_LEVEL)
|
||||||
|
|
||||||
/* uart configuration settings */
|
|
||||||
|
|
||||||
#define CONFIG_UART0_CONSOLE_IRQ CONFIG_UART_NS16550_PORT_0_IRQ
|
|
||||||
#define CONFIG_UART0_CONSOLE_INT_PRI CONFIG_UART_NS16550_PORT_0_IRQ_PRI
|
|
||||||
|
|
||||||
#define CONFIG_UART1_CONSOLE_IRQ CONFIG_UART_NS16550_PORT_1_IRQ
|
|
||||||
#define CONFIG_UART1_CONSOLE_INT_PRI CONFIG_UART_NS16550_PORT_1_IRQ_PRI
|
|
||||||
|
|
||||||
#ifndef _ASMLANGUAGE
|
#ifndef _ASMLANGUAGE
|
||||||
extern struct device * const uart_devs[];
|
extern struct device * const uart_devs[];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Setup console from config value, */
|
|
||||||
#if defined(CONFIG_UART_CONSOLE)
|
|
||||||
|
|
||||||
#if (CONFIG_UART_CONSOLE_INDEX == 0)
|
|
||||||
#define CONFIG_UART_BAUDRATE CONFIG_UART_NS16550_PORT_0_BAUD_RATE
|
|
||||||
#define CONFIG_UART_CONSOLE_INT_PRI CONFIG_UART0_CONSOLE_INT_PRI
|
|
||||||
#define CONFIG_UART_CONSOLE_IRQ CONFIG_UART0_CONSOLE_IRQ
|
|
||||||
#elif (CONFIG_UART_CONSOLE_INDEX == 1)
|
|
||||||
#define CONFIG_UART_BAUDRATE CONFIG_UART_NS16550_PORT_1_BAUD_RATE
|
|
||||||
#define CONFIG_UART_CONSOLE_IRQ CONFIG_UART1_CONSOLE_IRQ
|
|
||||||
#define CONFIG_UART_CONSOLE_INT_PRI CONFIG_UART1_CONSOLE_INT_PRI
|
|
||||||
#endif /* CONFIG_UART_CONSOLE_INDEX */
|
|
||||||
|
|
||||||
#define UART_CONSOLE_DEV (uart_devs[CONFIG_UART_CONSOLE_INDEX])
|
|
||||||
|
|
||||||
#endif /* CONFIG_UART_CONSOLE */
|
|
||||||
|
|
||||||
/* Watchdog */
|
/* Watchdog */
|
||||||
#define WDT_BASE_ADDR 0xB0000000
|
#define WDT_BASE_ADDR 0xB0000000
|
||||||
#define INT_WDT_IRQ 0x10
|
#define INT_WDT_IRQ 0x10
|
||||||
|
|
|
@ -233,4 +233,15 @@ endif # UART_NS16550_PORT_1
|
||||||
|
|
||||||
endif # UART_NS16550
|
endif # UART_NS16550
|
||||||
|
|
||||||
|
if UART_CONSOLE
|
||||||
|
|
||||||
|
config UART_CONSOLE_ON_DEV_NAME
|
||||||
|
default "UART_1"
|
||||||
|
config UART_CONSOLE_IRQ
|
||||||
|
default 38
|
||||||
|
config UART_CONSOLE_IRQ_PRI
|
||||||
|
default 3
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
endif #PLATFORM_QUARK_SE_X86
|
endif #PLATFORM_QUARK_SE_X86
|
||||||
|
|
|
@ -93,14 +93,6 @@
|
||||||
|
|
||||||
extern struct device * const uart_devs[];
|
extern struct device * const uart_devs[];
|
||||||
|
|
||||||
/* Console definitions */
|
|
||||||
#if defined(CONFIG_UART_CONSOLE)
|
|
||||||
|
|
||||||
#define CONFIG_UART_CONSOLE_INT_PRI CONFIG_UART_NS16550_PORT1_IRQ
|
|
||||||
#define UART_CONSOLE_DEV (uart_devs[CONFIG_UART_CONSOLE_INDEX])
|
|
||||||
|
|
||||||
#endif /* CONFIG_UART_CONSOLE */
|
|
||||||
|
|
||||||
#endif /* CONFIG_UART_NS16550 */
|
#endif /* CONFIG_UART_NS16550 */
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,6 @@ CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=12000000
|
||||||
CONFIG_PLATFORM_TI_LM3S6965=y
|
CONFIG_PLATFORM_TI_LM3S6965=y
|
||||||
CONFIG_CONSOLE=y
|
CONFIG_CONSOLE=y
|
||||||
CONFIG_UART_CONSOLE=y
|
CONFIG_UART_CONSOLE=y
|
||||||
CONFIG_UART_CONSOLE_INDEX=0
|
|
||||||
CONFIG_UART_CONSOLE_BAUDRATE=115200
|
|
||||||
CONFIG_SERIAL=y
|
CONFIG_SERIAL=y
|
||||||
CONFIG_CORTEX_M_SYSTICK=y
|
CONFIG_CORTEX_M_SYSTICK=y
|
||||||
CONFIG_FLASH_SIZE=256
|
CONFIG_FLASH_SIZE=256
|
||||||
|
|
|
@ -3,8 +3,6 @@ CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=120000000
|
||||||
CONFIG_PLATFORM_FSL_FRDM_K64F=y
|
CONFIG_PLATFORM_FSL_FRDM_K64F=y
|
||||||
CONFIG_CONSOLE=y
|
CONFIG_CONSOLE=y
|
||||||
CONFIG_UART_CONSOLE=y
|
CONFIG_UART_CONSOLE=y
|
||||||
CONFIG_UART_CONSOLE_INDEX=0
|
|
||||||
CONFIG_UART_CONSOLE_BAUDRATE=115200
|
|
||||||
CONFIG_SERIAL=y
|
CONFIG_SERIAL=y
|
||||||
CONFIG_CORTEX_M_SYSTICK=y
|
CONFIG_CORTEX_M_SYSTICK=y
|
||||||
CONFIG_FLASH_SIZE=1024
|
CONFIG_FLASH_SIZE=1024
|
||||||
|
|
|
@ -11,4 +11,3 @@ CONFIG_IPI_QUARK_SE=y
|
||||||
CONFIG_IPI_QUARK_SE_MASTER=y
|
CONFIG_IPI_QUARK_SE_MASTER=y
|
||||||
CONFIG_IPI_CONSOLE_RECEIVER=y
|
CONFIG_IPI_CONSOLE_RECEIVER=y
|
||||||
CONFIG_ARC_INIT=y
|
CONFIG_ARC_INIT=y
|
||||||
CONFIG_UART_CONSOLE_INDEX=1
|
|
||||||
|
|
|
@ -63,25 +63,29 @@ config UART_CONSOLE
|
||||||
select CONSOLE_HAS_DRIVER
|
select CONSOLE_HAS_DRIVER
|
||||||
help
|
help
|
||||||
Enable this option to use one UART for console. Make sure
|
Enable this option to use one UART for console. Make sure
|
||||||
CONFIG_UART_CONSOLE_INDEX is also set correctly.
|
CONFIG_UART_CONSOLE_ON_DEV_NAME is also set correctly.
|
||||||
|
|
||||||
config UART_CONSOLE_INDEX
|
config UART_CONSOLE_ON_DEV_NAME
|
||||||
int "UART Console Index"
|
string "Device Name of UART Device for UART Console"
|
||||||
default 0
|
default "UART_0"
|
||||||
range 0 6
|
|
||||||
depends on UART_CONSOLE
|
depends on UART_CONSOLE
|
||||||
help
|
help
|
||||||
This option specifies index for the console uart port.
|
This option specifies the name of UART device to be used for
|
||||||
|
UART console.
|
||||||
|
|
||||||
config UART_CONSOLE_BAUDRATE
|
config UART_CONSOLE_IRQ
|
||||||
int "UART Console Baud Rate"
|
int "IRQ of UART Device for UART Console"
|
||||||
default 115200
|
|
||||||
depends on UART_CONSOLE
|
depends on UART_CONSOLE
|
||||||
help
|
help
|
||||||
This specifies the baud rate for the UART console.
|
This option specifies the IRQ of UART device to be used for
|
||||||
|
UART console.
|
||||||
|
|
||||||
Default is 115200, which should be usable for most RS232
|
config UART_CONSOLE_IRQ_PRI
|
||||||
and USB adapters.
|
int "IRQ of UART Device for UART Console"
|
||||||
|
depends on UART_CONSOLE
|
||||||
|
help
|
||||||
|
This option specifies the IRQ priorityof UART device to be
|
||||||
|
used for UART console.
|
||||||
|
|
||||||
config UART_CONSOLE_PRIORITY
|
config UART_CONSOLE_PRIORITY
|
||||||
int
|
int
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
obj-$(CONFIG_UART_CONSOLE) = uart_console.o
|
|
||||||
obj-$(CONFIG_CONSOLE_HANDLER_SHELL) += console_handler_shell.o
|
obj-$(CONFIG_CONSOLE_HANDLER_SHELL) += console_handler_shell.o
|
||||||
|
obj-$(CONFIG_UART_CONSOLE) += uart_console.o uart_console_static_irq_stubs.o
|
||||||
obj-$(CONFIG_RAM_CONSOLE) += ram_console.o
|
obj-$(CONFIG_RAM_CONSOLE) += ram_console.o
|
||||||
obj-$(CONFIG_IPI_CONSOLE_RECEIVER) += ipi_console_receiver.o
|
obj-$(CONFIG_IPI_CONSOLE_RECEIVER) += ipi_console_receiver.o
|
||||||
obj-$(CONFIG_IPI_CONSOLE_SENDER) += ipi_console_sender.o
|
obj-$(CONFIG_IPI_CONSOLE_SENDER) += ipi_console_sender.o
|
||||||
|
|
|
@ -39,6 +39,8 @@
|
||||||
#include <toolchain.h>
|
#include <toolchain.h>
|
||||||
#include <sections.h>
|
#include <sections.h>
|
||||||
|
|
||||||
|
static struct device *uart_console_dev;
|
||||||
|
|
||||||
#if 0 /* NOTUSED */
|
#if 0 /* NOTUSED */
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -47,18 +49,14 @@
|
||||||
* @return the character or EOF if nothing present
|
* @return the character or EOF if nothing present
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int consoleIn(void)
|
static int console_in(void)
|
||||||
{
|
{
|
||||||
#ifdef UART_CONSOLE_DEV
|
|
||||||
unsigned char c;
|
unsigned char c;
|
||||||
|
|
||||||
if (uart_poll_in(UART_CONSOLE_DEV, &c) < 0)
|
if (uart_poll_in(uart_console_dev, &c) < 0)
|
||||||
return EOF;
|
return EOF;
|
||||||
else
|
else
|
||||||
return (int)c;
|
return (int)c;
|
||||||
#else
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -69,22 +67,20 @@ static int consoleIn(void)
|
||||||
*
|
*
|
||||||
* Outputs both line feed and carriage return in the case of a '\n'.
|
* Outputs both line feed and carriage return in the case of a '\n'.
|
||||||
*
|
*
|
||||||
|
* @param c Character to output
|
||||||
|
*
|
||||||
* @return The character passed as input.
|
* @return The character passed as input.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int consoleOut(int c /* character to output */
|
static int console_out(int c)
|
||||||
)
|
|
||||||
{
|
{
|
||||||
#ifdef UART_CONSOLE_DEV
|
uart_poll_out(uart_console_dev, (unsigned char)c);
|
||||||
uart_poll_out(UART_CONSOLE_DEV, (unsigned char)c);
|
|
||||||
if ('\n' == c) {
|
if ('\n' == c) {
|
||||||
uart_poll_out(UART_CONSOLE_DEV, (unsigned char)'\r');
|
uart_poll_out(uart_console_dev, (unsigned char)'\r');
|
||||||
}
|
}
|
||||||
return c;
|
return c;
|
||||||
#else
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_STDOUT_CONSOLE)
|
#if defined(CONFIG_STDOUT_CONSOLE)
|
||||||
|
@ -128,20 +124,20 @@ void uart_console_isr(void *unused)
|
||||||
{
|
{
|
||||||
ARG_UNUSED(unused);
|
ARG_UNUSED(unused);
|
||||||
|
|
||||||
while (uart_irq_update(UART_CONSOLE_DEV)
|
while (uart_irq_update(uart_console_dev)
|
||||||
&& uart_irq_is_pending(UART_CONSOLE_DEV)) {
|
&& uart_irq_is_pending(uart_console_dev)) {
|
||||||
/* Character(s) have been received */
|
/* Character(s) have been received */
|
||||||
if (uart_irq_rx_ready(UART_CONSOLE_DEV)) {
|
if (uart_irq_rx_ready(uart_console_dev)) {
|
||||||
static struct uart_console_input *cmd;
|
static struct uart_console_input *cmd;
|
||||||
uint8_t byte;
|
uint8_t byte;
|
||||||
int rx;
|
int rx;
|
||||||
|
|
||||||
rx = read_uart(UART_CONSOLE_DEV, &byte, 1);
|
rx = read_uart(uart_console_dev, &byte, 1);
|
||||||
if (rx < 0) {
|
if (rx < 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (uart_irq_input_hook(UART_CONSOLE_DEV, byte) != 0) {
|
if (uart_irq_input_hook(uart_console_dev, byte) != 0) {
|
||||||
/*
|
/*
|
||||||
* The input hook indicates that no further processing
|
* The input hook indicates that no further processing
|
||||||
* should be done by this handler.
|
* should be done by this handler.
|
||||||
|
@ -156,12 +152,12 @@ void uart_console_isr(void *unused)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Echo back to console */
|
/* Echo back to console */
|
||||||
uart_poll_out(UART_CONSOLE_DEV, byte);
|
uart_poll_out(uart_console_dev, byte);
|
||||||
|
|
||||||
if (byte == '\r' || byte == '\n' ||
|
if (byte == '\r' || byte == '\n' ||
|
||||||
pos == sizeof(cmd->line) - 1) {
|
pos == sizeof(cmd->line) - 1) {
|
||||||
cmd->line[pos] = '\0';
|
cmd->line[pos] = '\0';
|
||||||
uart_poll_out(UART_CONSOLE_DEV, '\n');
|
uart_poll_out(uart_console_dev, '\n');
|
||||||
pos = 0;
|
pos = 0;
|
||||||
|
|
||||||
nano_isr_fifo_put(lines_queue, cmd);
|
nano_isr_fifo_put(lines_queue, cmd);
|
||||||
|
@ -175,24 +171,24 @@ void uart_console_isr(void *unused)
|
||||||
}
|
}
|
||||||
|
|
||||||
IRQ_CONNECT_STATIC(console, CONFIG_UART_CONSOLE_IRQ,
|
IRQ_CONNECT_STATIC(console, CONFIG_UART_CONSOLE_IRQ,
|
||||||
CONFIG_UART_CONSOLE_INT_PRI, uart_console_isr, 0,
|
CONFIG_UART_CONSOLE_IRQ_PRI, uart_console_isr, 0,
|
||||||
UART_IRQ_FLAGS);
|
UART_IRQ_FLAGS);
|
||||||
|
|
||||||
static void console_input_init(void)
|
static void console_input_init(void)
|
||||||
{
|
{
|
||||||
uint8_t c;
|
uint8_t c;
|
||||||
|
|
||||||
uart_irq_rx_disable(UART_CONSOLE_DEV);
|
uart_irq_rx_disable(uart_console_dev);
|
||||||
uart_irq_tx_disable(UART_CONSOLE_DEV);
|
uart_irq_tx_disable(uart_console_dev);
|
||||||
IRQ_CONFIG(console, uart_irq_get(UART_CONSOLE_DEV), 0);
|
IRQ_CONFIG(console, uart_irq_get(uart_console_dev), 0);
|
||||||
irq_enable(uart_irq_get(UART_CONSOLE_DEV));
|
irq_enable(uart_irq_get(uart_console_dev));
|
||||||
|
|
||||||
/* Drain the fifo */
|
/* Drain the fifo */
|
||||||
while (uart_irq_rx_ready(UART_CONSOLE_DEV)) {
|
while (uart_irq_rx_ready(uart_console_dev)) {
|
||||||
uart_fifo_read(UART_CONSOLE_DEV, &c, 1);
|
uart_fifo_read(uart_console_dev, &c, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
uart_irq_rx_enable(UART_CONSOLE_DEV);
|
uart_irq_rx_enable(uart_console_dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
void uart_register_input(struct nano_fifo *avail, struct nano_fifo *lines)
|
void uart_register_input(struct nano_fifo *avail, struct nano_fifo *lines)
|
||||||
|
@ -220,8 +216,8 @@ void uart_register_input(struct nano_fifo *avail, struct nano_fifo *lines)
|
||||||
|
|
||||||
void uart_console_hook_install(void)
|
void uart_console_hook_install(void)
|
||||||
{
|
{
|
||||||
__stdout_hook_install(consoleOut);
|
__stdout_hook_install(console_out);
|
||||||
__printk_hook_install(consoleOut);
|
__printk_hook_install(console_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -234,6 +230,8 @@ static int uart_console_init(struct device *arg)
|
||||||
{
|
{
|
||||||
ARG_UNUSED(arg);
|
ARG_UNUSED(arg);
|
||||||
|
|
||||||
|
uart_console_dev = device_get_binding(CONFIG_UART_CONSOLE_ON_DEV_NAME);
|
||||||
|
|
||||||
uart_console_hook_install();
|
uart_console_hook_install();
|
||||||
|
|
||||||
return DEV_OK;
|
return DEV_OK;
|
||||||
|
|
38
drivers/console/uart_console_static_irq_stubs.S
Normal file
38
drivers/console/uart_console_static_irq_stubs.S
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2015, Intel Corporation
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* @brief UART console interrupt stubs
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef CONFIG_X86
|
||||||
|
|
||||||
|
#define _ASMLANGUAGE
|
||||||
|
|
||||||
|
#include <arch/x86/asm.h>
|
||||||
|
#include <drivers/ioapic.h>
|
||||||
|
#include <drivers/loapic.h>
|
||||||
|
|
||||||
|
#if defined(CONFIG_CONSOLE_HANDLER)
|
||||||
|
#if defined(CONFIG_IOAPIC)
|
||||||
|
ioapic_mkstub console uart_console_isr 0
|
||||||
|
#endif /* CONFIG_IOAPIC */
|
||||||
|
#endif /* CONFIG_CONSOLE_HANDLER */
|
||||||
|
|
||||||
|
#undef _ASMLANGUAGE
|
||||||
|
|
||||||
|
#endif /* CONFIG_X86 */
|
Loading…
Add table
Add a link
Reference in a new issue