uart: remove uart_devs[]
Since all the necessary bits utilizing UART by index have moved to use device name instead, the uart_devs[] can finally be removed. Change-Id: Idbae6b46c0af9eef6c22c59e121e9d6a6b52426a Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
parent
5cdd4584fe
commit
ba6f2d9617
11 changed files with 7 additions and 98 deletions
|
@ -156,8 +156,6 @@
|
|||
|
||||
#define UART_IRQ_FLAGS 0
|
||||
|
||||
extern struct device * const uart_devs[];
|
||||
|
||||
/* Uart console settings */
|
||||
#if defined(CONFIG_UART_CONSOLE)
|
||||
|
||||
|
|
|
@ -94,8 +94,6 @@
|
|||
|
||||
#define UART_IRQ_FLAGS 0
|
||||
|
||||
extern struct device * const uart_devs[];
|
||||
|
||||
#endif /* !_ASMLANGUAGE */
|
||||
|
||||
#endif /* _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)
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
};
|
||||
|
|
|
@ -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
|
||||
};
|
||||
|
|
|
@ -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
|
||||
};
|
||||
|
|
|
@ -22,11 +22,12 @@
|
|||
#include <board.h>
|
||||
#include <uart.h>
|
||||
|
||||
#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));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue