Use static interrupt registration in device drivers

Make device drivers use static interrupt registration procedure.

DYNAMIC_INT_STUBS configuration parameter was used only by device
drivers to switch between static and dynamic interrupt registration
procedures. Now it is obsolete and is removed.

uart_int_connect() function is removed. If UART device driver still
needs to register interrupt dynamically, it should use
irq_connect(uart_irq_get()).

Change-Id: I80c695f337456e9b0c1b0fd56716e35794f7bdb7
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
This commit is contained in:
Dmitriy Korovkin 2015-06-04 11:42:35 -04:00 committed by Anas Nashif
commit 8d065343c2
24 changed files with 39 additions and 144 deletions

View file

@ -223,17 +223,9 @@ config CACHE_LINE_SIZE
endmenu
menu "Specific BSP Capability Support"
config DYNAMIC_INT_STUBS
bool "Dynamic INT stubs"
default n
help
This option allows a BSP's drivers to install interrupt handlers
at run time, if desired. If not enabled, interrupt handlers can only
be installed statically when the image is created.
config NUM_DYNAMIC_STUBS
int "Number of dynamic int stubs"
default 10 if DYNAMIC_INT_STUBS
default 0
help
This option specifies the number of interrupt handlers that can be

View file

@ -120,7 +120,6 @@ CONFIG_CACHE_LINE_SIZE=64
#
# Specific BSP Capability Support
#
# CONFIG_DYNAMIC_INT_STUBS is not set
# CONFIG_PROT_MODE_SWITCH_PROMPT is not set
# CONFIG_ADVANCED_IDLE_SUPPORTED is not set
CONFIG_BOOTLOADER_UNKNOWN=y

View file

@ -120,7 +120,6 @@ CONFIG_CACHE_LINE_SIZE=64
#
# Specific BSP Capability Support
#
# CONFIG_DYNAMIC_INT_STUBS is not set
# CONFIG_PROT_MODE_SWITCH_PROMPT is not set
# CONFIG_ADVANCED_IDLE_SUPPORTED is not set
CONFIG_BOOTLOADER_UNKNOWN=y

View file

@ -122,7 +122,6 @@ CONFIG_CACHE_LINE_SIZE=0
#
# Specific BSP Capability Support
#
# CONFIG_DYNAMIC_INT_STUBS is not set
# CONFIG_PROT_MODE_SWITCH_PROMPT is not set
# CONFIG_ADVANCED_IDLE_SUPPORTED is not set
CONFIG_BOOTLOADER_UNKNOWN=y

View file

@ -120,7 +120,6 @@ CONFIG_CACHE_LINE_SIZE=64
#
# Specific BSP Capability Support
#
# CONFIG_DYNAMIC_INT_STUBS is not set
# CONFIG_PROT_MODE_SWITCH_PROMPT is not set
# CONFIG_ADVANCED_IDLE_SUPPORTED is not set
CONFIG_BOOTLOADER_UNKNOWN=y

View file

@ -122,7 +122,6 @@ CONFIG_CACHE_LINE_SIZE=0
#
# Specific BSP Capability Support
#
# CONFIG_DYNAMIC_INT_STUBS is not set
# CONFIG_PROT_MODE_SWITCH_PROMPT is not set
# CONFIG_ADVANCED_IDLE_SUPPORTED is not set
CONFIG_BOOTLOADER_UNKNOWN=y

View file

@ -99,7 +99,6 @@ CONFIG_CACHE_LINE_SIZE=64
#
# Specific BSP Capability Support
#
# CONFIG_DYNAMIC_INT_STUBS is not set
# CONFIG_PROT_MODE_SWITCH_PROMPT is not set
# CONFIG_ADVANCED_IDLE_SUPPORTED is not set
CONFIG_BOOTLOADER_UNKNOWN=y

View file

@ -99,7 +99,6 @@ CONFIG_CACHE_LINE_SIZE=64
#
# Specific BSP Capability Support
#
# CONFIG_DYNAMIC_INT_STUBS is not set
# CONFIG_PROT_MODE_SWITCH_PROMPT is not set
# CONFIG_ADVANCED_IDLE_SUPPORTED is not set
CONFIG_BOOTLOADER_UNKNOWN=y

View file

@ -101,7 +101,6 @@ CONFIG_CACHE_LINE_SIZE=0
#
# Specific BSP Capability Support
#
# CONFIG_DYNAMIC_INT_STUBS is not set
# CONFIG_PROT_MODE_SWITCH_PROMPT is not set
# CONFIG_ADVANCED_IDLE_SUPPORTED is not set
CONFIG_BOOTLOADER_UNKNOWN=y

View file

@ -99,7 +99,6 @@ CONFIG_CACHE_LINE_SIZE=64
#
# Specific BSP Capability Support
#
# CONFIG_DYNAMIC_INT_STUBS is not set
# CONFIG_PROT_MODE_SWITCH_PROMPT is not set
# CONFIG_ADVANCED_IDLE_SUPPORTED is not set
CONFIG_BOOTLOADER_UNKNOWN=y

View file

@ -101,7 +101,6 @@ CONFIG_CACHE_LINE_SIZE=0
#
# Specific BSP Capability Support
#
# CONFIG_DYNAMIC_INT_STUBS is not set
# CONFIG_PROT_MODE_SWITCH_PROMPT is not set
# CONFIG_ADVANCED_IDLE_SUPPORTED is not set
CONFIG_BOOTLOADER_UNKNOWN=y

View file

@ -122,7 +122,6 @@ CONFIG_CACHE_LINE_SIZE=0
#
# Specific BSP Capability Support
#
# CONFIG_DYNAMIC_INT_STUBS is not set
# CONFIG_PROT_MODE_SWITCH_PROMPT is not set
# CONFIG_ADVANCED_IDLE_SUPPORTED is not set
CONFIG_BOOTLOADER_UNKNOWN=y

View file

@ -38,8 +38,6 @@ by x86 BSPs.
#define _ASMLANGUAGE
#ifndef CONFIG_DYNAMIC_INT_STUBS
#include <arch/x86/asm.h>
#include <drivers/ioapic.h>
#include <drivers/loapic.h>
@ -79,6 +77,14 @@ by x86 BSPs.
#endif /* CONFIG_PIC */
#endif /* CONFIG_CONSOLE_HANDLER */
#if defined(CONFIG_UART_SIMPLE)
#if defined(CONFIG_PIC)
pic_master_mkstub uart_simple uart_simple_isr
#elif defined(CONFIG_IOAPIC)
ioapic_mkstub uart_simple uart_simple_isr
#endif /* CONFIG_PIC */
#endif /* CONFIG_UART_SIMPLE */
/* externs (internal APIs) */
GTEXT(_IntEnt)
@ -126,5 +132,3 @@ SECTION_FUNC(TEXT, _pic_slave__i8259_boi_slave_stub)
* jmp _IntExit /+ Inform kernel interrupt is done +/
*/
#endif /* CONFIG_PIC */
#endif /* !CONFIG_DYNAMIC_INT_STUBS */

View file

@ -104,11 +104,6 @@ static void uartGenericInfoInit(struct uart_init_info *p_info)
#endif /* DO_CONSOLE_INIT */
#if defined(CONFIG_CONSOLE_HANDLER)
IRQ_CONNECT_STATIC(console, CONFIG_UART_CONSOLE_IRQ,
CONFIG_UART_CONSOLE_INT_PRI, uart_console_isr, 0);
#endif /* CONFIG_CONSOLE_HANDLER */
#if defined(DO_CONSOLE_INIT)
/*******************************************************************************
@ -141,9 +136,6 @@ static void consoleInit(void)
#if defined(CONFIG_BLUETOOTH)
#if defined(CONFIG_BLUETOOTH_UART)
#include <bluetooth/uart.h>
/* Interrupt handling */
IRQ_CONNECT_STATIC(bluetooth, CONFIG_BLUETOOTH_UART_IRQ,
CONFIG_BLUETOOTH_UART_INT_PRI, bt_uart_isr, 0);
#endif /* CONFIG_BLUETOOTH_UART */
static void bluetooth_init(void)
{

View file

@ -250,6 +250,9 @@ static int bt_uart_send(struct bt_buf *buf)
return uart_fifo_fill(UART, buf->data, buf->len);
}
IRQ_CONNECT_STATIC(bluetooth, CONFIG_BLUETOOTH_UART_IRQ,
CONFIG_BLUETOOTH_UART_INT_PRI, bt_uart_isr, 0);
static void bt_uart_setup(int uart, struct uart_init_info *info)
{
BT_DBG("\n");
@ -258,7 +261,8 @@ static void bt_uart_setup(int uart, struct uart_init_info *info)
uart_irq_rx_disable(uart);
uart_irq_tx_disable(uart);
uart_int_connect(uart, bt_uart_isr, NULL, NULL);
IRQ_CONFIG(bluetooth, uart_irq_get(uart));
irq_enable(uart_irq_get(uart));
/* Drain the fifo */
while (uart_irq_rx_ready(uart)) {

View file

@ -174,13 +174,17 @@ void uart_console_isr(void *unused)
}
}
IRQ_CONNECT_STATIC(console, CONFIG_UART_CONSOLE_IRQ,
CONFIG_UART_CONSOLE_INT_PRI, uart_console_isr, 0);
static void console_input_init(void)
{
uint8_t c;
uart_irq_rx_disable(UART);
uart_irq_tx_disable(UART);
uart_int_connect(UART, uart_console_isr, NULL, NULL);
IRQ_CONFIG(console, uart_irq_get(UART));
irq_enable(uart_irq_get(UART));
/* Drain the fifo */
while (uart_irq_rx_ready(UART))

View file

@ -369,32 +369,16 @@ int uart_irq_update(int port)
/*******************************************************************************
*
* uart_int_connect - connect an ISR to an interrupt line
* uart_irq_get - returns UART interrupt number
*
* The kernel configuration allows to setup an interrupt line for a particular
* DUART. This routine installs the ISR of a UART user to the interrupt line
* chosen for the hardware at configuration time.
* Returns the IRQ number used by the specified UART port
*
* RETURNS: N/A
*/
void uart_int_connect(int port, /* UART to port to connect */
void (*isr)(void *), /* interrupt handler */
void *arg, /* argument to pass to handler */
void *stub /* ptr to interrupt stub code */
)
unsigned int uart_irq_get(int port /* UART port */
)
{
#if !defined(CONFIG_SW_ISR_TABLE_DYNAMIC)
ARG_UNUSED(isr);
ARG_UNUSED(arg);
ARG_UNUSED(stub);
#else
irq_connect((unsigned int)uart[port].irq,
(unsigned int)uart[port].intPri,
isr,
arg);
#endif
irq_enable((unsigned int)uart[port].irq);
return (unsigned int)uart[port].irq;
}
#endif /* CONFIG_UART_INTERRUPT_DRIVEN */

View file

@ -534,29 +534,16 @@ int uart_irq_update(int port /* UART to update */
/*******************************************************************************
*
* uart_int_connect - connect an ISR to an interrupt line
* uart_irq_get - returns UART interrupt number
*
* The kernel configuration allows to setup an interrupt line for a particular
* DUART. This routine installs the ISR of a UART user to the interrupt line
* chosen for the hardware at configuration time.
* Returns the IRQ number used by the specified UART port
*
* RETURNS: N/A
*/
void uart_int_connect(int port, /* UART to port to connect */
void (*isr)(void *), /* interrupt handler */
void *arg, /* argument to pass to handler */
void *stub /* ptr to interrupt stub code */
)
unsigned int uart_irq_get(int port /* UART port */
)
{
#if !defined(CONFIG_DYNAMIC_INT_STUBS)
ARG_UNUSED(isr);
ARG_UNUSED(arg);
ARG_UNUSED(stub);
#else
irq_connect(port, isr, arg);
#endif /* CONFIG_DYNAMIC_INT_STUBS */
irq_enable((unsigned int)uart[port].irq);
return (unsigned int)uart[port].irq;
}
#endif /* CONFIG_UART_INTERRUPT_DRIVEN */

View file

@ -567,32 +567,16 @@ int uart_irq_update(int port)
/*******************************************************************************
*
* uart_int_connect - connect an ISR to an interrupt line
* uart_irq_get - returns UART interrupt number
*
* The kernel configuration allows to setup an interrupt line for a particular
* UART. This routine installs the ISR of a UART user to the interrupt line
* chosen for the hardware at configuration time.
* Returns the IRQ number used by the specified UART port
*
* RETURNS: N/A
*/
void uart_int_connect(int port, /* UART port to connect to */
void (*isr)(void *), /* interrupt handler */
void *arg, /* argument to pass to handler */
void *stub /* ptr to interrupt stub code */
)
unsigned int uart_irq_get(int port /* UART port */
)
{
#if !defined(CONFIG_SW_ISR_TABLE_DYNAMIC)
ARG_UNUSED(isr);
ARG_UNUSED(arg);
ARG_UNUSED(stub);
#else
irq_connect((unsigned int)ports[port].irq,
(unsigned int)ports[port].intPri,
isr,
arg);
#endif
irq_enable((unsigned int)ports[port].irq);
return (unsigned int)ports[port].irq;
}
#endif /* CONFIG_UART_INTERRUPT_DRIVEN */

View file

@ -81,13 +81,17 @@ int uart_simple_send(const uint8_t *data, int len)
return uart_fifo_fill(UART, data, len);
}
IRQ_CONNECT_STATIC(uart_simple, CONFIG_UART_SIMPLE_IRQ,
CONFIG_UART_SIMPLE_INT_PRI, uart_simple_isr, 0);
static void uart_simple_setup(int uart, struct uart_init_info *info)
{
uart_init(uart, info);
uart_irq_rx_disable(uart);
uart_irq_tx_disable(uart);
uart_int_connect(uart, uart_simple_isr, NULL, NULL);
IRQ_CONFIG(uart_simple, uart_irq_get(uart));
irq_enable(uart_irq_get(uart));
/* Drain the fifo */
while (uart_irq_rx_ready(uart)) {

View file

@ -192,12 +192,8 @@ extern struct nano_stack _k_command_stack;
#define HPET_COMP_DELAY 192
#ifdef CONFIG_DYNAMIC_INT_STUBS
static NANO_CPU_INT_STUB_DECL(_hpetIntStub); /* interrupt stub memory */
#else /* !CONFIG_DYNAMIC_INT_STUBS */
IRQ_CONNECT_STATIC(hpet, HPET_TIMER0_IRQ, HPET_TIMER0_INT_PRI,
_timer_int_handler, 0);
#endif
#ifdef CONFIG_INT_LATENCY_BENCHMARK
static uint32_t main_count_first_irq_value = 0;
@ -606,19 +602,6 @@ void timer_driver(int priority /* priority parameter is ignored by this driver
;
#endif
#ifdef CONFIG_DYNAMIC_INT_STUBS
/*
* Connect specified routine/parameter to LOAPIC interrupt vector.
* The "connect" will result in the LOAPIC interrupt controller being
* programmed with the allocated vector, i.e. there is no need for
* an explicit setting of the interrupt vector in this driver.
*/
irq_connect(HPET_TIMER0_IRQ,
HPET_TIMER0_INT_PRI,
_timer_int_handler,
0);
#else
/*
* Although the stub has already been "connected", the vector number
* still
@ -626,7 +609,6 @@ void timer_driver(int priority /* priority parameter is ignored by this driver
*/
IRQ_CONFIG(hpet, HPET_TIMER0_IRQ);
#endif
/* enable the IRQ in the interrupt controller */

View file

@ -115,9 +115,7 @@ extern int32_t _sys_idle_elapsed_ticks;
/* interrupt stub memory for irq_connect() */
#ifndef CONFIG_DYNAMIC_INT_STUBS
IRQ_CONNECT_STATIC(i8253, PIT_INT_LVL, PIT_INT_PRI, _timer_int_handler, 0);
#endif
static uint16_t __noinit counterLoadVal; /* computed counter */
static volatile uint32_t clock_accumulated_count = 0;
@ -494,17 +492,7 @@ void timer_driver(int priority /* priority parameter ignored by this driver */
_i8253CounterPeriodic(counterLoadVal);
#ifndef CONFIG_DYNAMIC_INT_STUBS
IRQ_CONFIG(i8253, PIT_INT_LVL);
#else
/* connect specified routine/parameter to PIT interrupt vector */
(void)irq_connect(PIT_INT_LVL,
PIT_INT_PRI,
_timer_int_handler,
0);
#endif /* CONFIG_DYNAMIC_INT_STUBS */
_i8253TicklessIdleSkew();

View file

@ -110,14 +110,8 @@ After reset, the timer is initialized to zero.
extern int32_t _sys_idle_elapsed_ticks;
#endif /* TIMER_SUPPORTS_TICKLESS */
#ifdef CONFIG_DYNAMIC_INT_STUBS
static NANO_CPU_INT_STUB_DECL(
_loapic_timer_irq_stub); /* interrupt stub memory for */
/* irq_connect() */
#else /* !CONFIG_DYNAMIC_INT_STUBS */
IRQ_CONNECT_STATIC(loapic, LOAPIC_TIMER_IRQ, LOAPIC_TIMER_INT_PRI,
_timer_int_handler, 0);
#endif
static uint32_t __noinit counterLoadVal; /* computed counter 0
initial count value */
@ -562,25 +556,12 @@ void timer_driver(int priority /* priority parameter ignored by this driver */
_loApicTimerSetCount(counterLoadVal);
_loApicTimerPeriodic();
#ifdef CONFIG_DYNAMIC_INT_STUBS
/*
* Connect specified routine/parameter to LOAPIC interrupt vector.
* The "connect" will result in the LOAPIC interrupt controller being
* programmed with the allocated vector, i.e. there is no need for
* an explicit setting of the interrupt vector in this driver.
*/
irq_connect(LOAPIC_TIMER_IRQ,
LOAPIC_TIMER_INT_PRI,
_timer_int_handler,
0);
#else /* !CONFIG_DYNAMIC_INT_STUBS */
/*
* Although the stub has already been "connected", the vector number
* still
* has to be programmed into the interrupt controller.
*/
IRQ_CONFIG(loapic, LOAPIC_TIMER_IRQ);
#endif /* CONFIG_DYNAMIC_INT_STUBS */
_loApicTimerTicklessIdleSkew();

View file

@ -65,7 +65,7 @@ void uart_irq_err_enable(int port);
void uart_irq_err_disable(int port);
int uart_irq_is_pending(int port);
int uart_irq_update(int port);
void uart_int_connect(int port, void (*isr)(void *), void *arg, void *stub);
unsigned int uart_irq_get(int port);
#ifdef __cplusplus
}