diff --git a/arch/arm/platforms/fsl_frdm_k64f/board.h b/arch/arm/platforms/fsl_frdm_k64f/board.h index 44a58136cb6..2f8e728ffaa 100644 --- a/arch/arm/platforms/fsl_frdm_k64f/board.h +++ b/arch/arm/platforms/fsl_frdm_k64f/board.h @@ -156,8 +156,6 @@ #define UART_IRQ_FLAGS 0 -extern struct device * const uart_devs[]; - /* Uart console settings */ #if defined(CONFIG_UART_CONSOLE) diff --git a/arch/arm/platforms/ti_lm3s6965/board.h b/arch/arm/platforms/ti_lm3s6965/board.h index 9a2abb4a046..2e6a7a70701 100644 --- a/arch/arm/platforms/ti_lm3s6965/board.h +++ b/arch/arm/platforms/ti_lm3s6965/board.h @@ -94,8 +94,6 @@ #define UART_IRQ_FLAGS 0 -extern struct device * const uart_devs[]; - #endif /* !_ASMLANGUAGE */ #endif /* _BOARD__H_ */ diff --git a/arch/x86/platforms/galileo/board.h b/arch/x86/platforms/galileo/board.h index 9d3f8a8ced1..ede50f6dcc4 100644 --- a/arch/x86/platforms/galileo/board.h +++ b/arch/x86/platforms/galileo/board.h @@ -54,11 +54,6 @@ #define NUM_STD_IRQS 16 /* number of "standard" IRQs on an x86 platform */ #define INT_VEC_IRQ0 0x20 /* Vector number for IRQ0 */ -/* UART console */ -#ifndef _ASMLANGUAGE -extern struct device * const uart_devs[]; -#endif - #ifdef CONFIG_GPIO_DW_0 #if defined(CONFIG_GPIO_DW_0_FALLING_EDGE) #define GPIO_DW_0_IRQ_FLAGS (IOAPIC_EDGE | IOAPIC_LOW) diff --git a/arch/x86/platforms/ia32/board.h b/arch/x86/platforms/ia32/board.h index bf18a6c1213..3210a1344a4 100644 --- a/arch/x86/platforms/ia32/board.h +++ b/arch/x86/platforms/ia32/board.h @@ -53,14 +53,4 @@ #define INT_VEC_IRQ0 0x20 /* vector number for IRQ0 */ -/* uart configuration settings */ - -#ifdef CONFIG_UART_NS16550 - -#ifndef _ASMLANGUAGE -extern struct device * const uart_devs[]; -#endif - -#endif /* CONFIG_UART_NS16550 */ - #endif /* __INCboardh */ diff --git a/arch/x86/platforms/ia32_pci/board.h b/arch/x86/platforms/ia32_pci/board.h index 9c7c328dbed..8c1a69f7e20 100644 --- a/arch/x86/platforms/ia32_pci/board.h +++ b/arch/x86/platforms/ia32_pci/board.h @@ -54,12 +54,6 @@ #define NUM_STD_IRQS 16 /* number of "standard" IRQs on an x86 platform */ #define INT_VEC_IRQ0 0x20 /* Vector number for IRQ0 */ -/* uart configuration settings */ - -#ifndef _ASMLANGUAGE -extern struct device * const uart_devs[]; -#endif - #ifdef CONFIG_GPIO_DW_0 #if defined(CONFIG_GPIO_DW_0_FALLING_EDGE) #define GPIO_DW_0_IRQ_FLAGS (IOAPIC_EDGE | IOAPIC_LOW) diff --git a/arch/x86/platforms/quark_d2000/board.h b/arch/x86/platforms/quark_d2000/board.h index 9bb4b61a54a..5cfb9c8f403 100644 --- a/arch/x86/platforms/quark_d2000/board.h +++ b/arch/x86/platforms/quark_d2000/board.h @@ -126,10 +126,6 @@ struct scss_interrupt { /* UART uses level triggered interrupt, low level */ #define UART_IOAPIC_FLAGS (IOAPIC_LEVEL) -#ifndef _ASMLANGUAGE -extern struct device * const uart_devs[]; -#endif - /* Watchdog */ #define WDT_BASE_ADDR 0xB0000000 #define INT_WDT_IRQ 0x10 diff --git a/arch/x86/platforms/quark_se/board.h b/arch/x86/platforms/quark_se/board.h index 8545dd290ae..fd030de2c41 100644 --- a/arch/x86/platforms/quark_se/board.h +++ b/arch/x86/platforms/quark_se/board.h @@ -89,10 +89,6 @@ /* UART uses level triggered interrupt, low level */ #define UART_IOAPIC_FLAGS (IOAPIC_LEVEL | IOAPIC_LOW) -/* uart configuration settings */ - -extern struct device * const uart_devs[]; - #endif /* CONFIG_UART_NS16550 */ diff --git a/drivers/serial/uart_k20.c b/drivers/serial/uart_k20.c index 2921169bb39..63259200115 100644 --- a/drivers/serial/uart_k20.c +++ b/drivers/serial/uart_k20.c @@ -506,31 +506,3 @@ SYS_DEFINE_DEVICE(uart_k20_4, &uart_k20_dev_data_4, PRIMARY, CONFIG_KERNEL_INIT_PRIORITY_DEVICE); #endif /* CONFIG_UART_K20_PORT_4 */ - -struct device * const uart_devs[] = { -#ifdef CONFIG_UART_K20_PORT_0 - SYS_GET_DEVICE(uart_k20_0), -#else - NULL, -#endif -#ifdef CONFIG_UART_K20_PORT_1 - SYS_GET_DEVICE(uart_k20_1), -#else - NULL, -#endif -#ifdef CONFIG_UART_K20_PORT_2 - SYS_GET_DEVICE(uart_k20_2), -#else - NULL, -#endif -#ifdef CONFIG_UART_K20_PORT_3 - SYS_GET_DEVICE(uart_k20_3), -#else - NULL, -#endif -#ifdef CONFIG_UART_K20_PORT_4 - SYS_GET_DEVICE(uart_k20_4), -#else - NULL, -#endif -}; diff --git a/drivers/serial/uart_ns16550.c b/drivers/serial/uart_ns16550.c index 2bbe9abb1a8..c734056a9c7 100644 --- a/drivers/serial/uart_ns16550.c +++ b/drivers/serial/uart_ns16550.c @@ -621,17 +621,3 @@ SYS_DEFINE_DEVICE(uart_ns16550_1, &uart_ns16550_dev_data_1, PRIMARY, CONFIG_KERNEL_INIT_PRIORITY_DEVICE); #endif /* CONFIG_UART_NS16550_PORT_1 */ - -/**< UART Devices */ -struct device * const uart_devs[] = { -#ifdef CONFIG_UART_NS16550_PORT_0 - SYS_GET_DEVICE(uart_ns16550_0), -#else - NULL, -#endif -#ifdef CONFIG_UART_NS16550_PORT_1 - SYS_GET_DEVICE(uart_ns16550_1), -#else - NULL, -#endif -}; diff --git a/drivers/serial/uart_stellaris.c b/drivers/serial/uart_stellaris.c index feed981ddbc..c5ece7f9915 100644 --- a/drivers/serial/uart_stellaris.c +++ b/drivers/serial/uart_stellaris.c @@ -659,22 +659,3 @@ SYS_DEFINE_DEVICE(uart_stellaris2, NULL, PRIMARY, CONFIG_KERNEL_INIT_PRIORITY_DEVICE); #endif /* CONFIG_UART_STELLARIS_PORT_2 */ - -/**< UART Devices */ -struct device * const uart_devs[] = { -#ifdef CONFIG_UART_STELLARIS_PORT_0 - SYS_GET_DEVICE(uart_stellaris0), -#else - NULL, -#endif -#ifdef CONFIG_UART_STELLARIS_PORT_1 - SYS_GET_DEVICE(uart_stellaris1), -#else - NULL, -#endif -#ifdef CONFIG_UART_STELLARIS_PORT_2 - SYS_GET_DEVICE(uart_stellaris2), -#else - NULL, -#endif -}; diff --git a/samples/microkernel/apps/nfc_hello/src/main.c b/samples/microkernel/apps/nfc_hello/src/main.c index 90b2f56fa47..91ac9f71591 100644 --- a/samples/microkernel/apps/nfc_hello/src/main.c +++ b/samples/microkernel/apps/nfc_hello/src/main.c @@ -22,11 +22,12 @@ #include #include -#define UART1 (uart_devs[1]) #define UART1_IRQ CONFIG_UART_NS16550_PORT_1_IRQ #define UART1_IRQ_PRI CONFIG_UART_NS16550_PORT_1_IRQ_PRI #define BUF_MAXSIZE 256 +struct device *uart1_dev; + #define D(fmt, args...) \ do { \ printf("%s() " fmt "\n", __func__, ## args); \ @@ -54,18 +55,20 @@ static void msg_dump(const char *s, uint8_t *data, unsigned len) static void uart1_isr(void *x) { - int len = uart_fifo_read(UART1, buf, BUF_MAXSIZE); + int len = uart_fifo_read(uart1_dev, buf, BUF_MAXSIZE); ARG_UNUSED(x); msg_dump(__func__, buf, len); } static void uart1_init(void) { + uart1_dev = device_get_binding("UART_1"); + irq_connect(UART1_IRQ, UART1_IRQ_PRI, uart1_isr, 0, UART_IRQ_FLAGS); irq_enable(UART1_IRQ); - uart_irq_rx_enable(UART1); + uart_irq_rx_enable(uart1_dev); D("done"); } @@ -85,7 +88,7 @@ void main(void) memcpy(pdu + sizeof(*len), nci_reset, sizeof(nci_reset)); - uart_fifo_fill(UART1, pdu, sizeof(*len) + sizeof(nci_reset)); + uart_fifo_fill(uart1_dev, pdu, sizeof(*len) + sizeof(nci_reset)); while (1) { nano_task_timer_start(&t, MSEC(500));