mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-26 21:52:44 +08:00
bsp/sparc: Move BSP_ISR_handler to a separate file and rename it
This allows it to be wrapped by another function at link-time and can be used to trace interrupts. If not placed in a separate file, the function pointer address used in BSP_shared_interrupt_init will be resolved at compile-time, and the function will not be wrappable.
This commit is contained in:
committed by
Daniel Hellstrom
parent
1c7ee732fc
commit
0c94a46fa3
@@ -11,6 +11,7 @@ EXTRA_DIST += shared/start/start.S
|
||||
|
||||
# Interrupt
|
||||
EXTRA_DIST += shared/irq/irq-shared.c
|
||||
EXTRA_DIST += shared/irq/bsp_isr_handler.c
|
||||
|
||||
# AMBA Plug&Play bus
|
||||
EXTRA_DIST += shared/include/ambapp.h
|
||||
|
||||
@@ -71,6 +71,7 @@ include_bsp_HEADERS += \
|
||||
include/bsp/irq.h
|
||||
libbsp_a_SOURCES += \
|
||||
../../sparc/shared/irq/irq-shared.c \
|
||||
../../sparc/shared/irq/bsp_isr_handler.c \
|
||||
../../shared/src/irq-default-handler.c \
|
||||
../../shared/src/irq-generic.c \
|
||||
../../shared/src/irq-info.c \
|
||||
|
||||
@@ -106,6 +106,9 @@ typedef void (*bsp_shared_isr)(void *arg);
|
||||
/* Initializes the Shared System Interrupt service */
|
||||
extern void BSP_shared_interrupt_init(void);
|
||||
|
||||
/* Called directly from IRQ trap handler TRAP[0x10..0x1F] = IRQ[0..15] */
|
||||
void bsp_isr_handler(rtems_vector_number vector);
|
||||
|
||||
/* Registers a shared IRQ handler, and enable it at IRQ controller. Multiple
|
||||
* interrupt handlers may use the same IRQ number, all ISRs will be called
|
||||
* when an interrupt on that line is fired.
|
||||
|
||||
@@ -80,6 +80,7 @@ include_bsp_HEADERS += \
|
||||
include/bsp/irq.h
|
||||
libbsp_a_SOURCES += \
|
||||
../../sparc/shared/irq/irq-shared.c \
|
||||
../../sparc/shared/irq/bsp_isr_handler.c \
|
||||
../../shared/src/irq-default-handler.c \
|
||||
../../shared/src/irq-generic.c \
|
||||
../../shared/src/irq-info.c \
|
||||
|
||||
@@ -130,6 +130,9 @@ typedef void (*bsp_shared_isr)(void *arg);
|
||||
/* Initializes the Shared System Interrupt service */
|
||||
extern void BSP_shared_interrupt_init(void);
|
||||
|
||||
/* Called directly from IRQ trap handler TRAP[0x10..0x1F] = IRQ[0..15] */
|
||||
void bsp_isr_handler(rtems_vector_number vector);
|
||||
|
||||
/* Registers a shared IRQ handler, and enable it at IRQ controller. Multiple
|
||||
* interrupt handlers may use the same IRQ number, all ISRs will be called
|
||||
* when an interrupt on that line is fired.
|
||||
|
||||
@@ -82,6 +82,7 @@ include_bsp_HEADERS += \
|
||||
libbsp_a_SOURCES += \
|
||||
startup/eirq.c \
|
||||
../../sparc/shared/irq/irq-shared.c \
|
||||
../../sparc/shared/irq/bsp_isr_handler.c \
|
||||
../../shared/src/irq-default-handler.c \
|
||||
../../shared/src/irq-generic.c \
|
||||
../../shared/src/irq-info.c \
|
||||
|
||||
@@ -153,6 +153,9 @@ typedef void (*bsp_shared_isr)(void *arg);
|
||||
/* Initializes the Shared System Interrupt service */
|
||||
extern void BSP_shared_interrupt_init(void);
|
||||
|
||||
/* Called directly from IRQ trap handler TRAP[0x10..0x1F] = IRQ[0..15] */
|
||||
void bsp_isr_handler(rtems_vector_number vector);
|
||||
|
||||
/* Registers a shared IRQ handler, and enable it at IRQ controller. Multiple
|
||||
* interrupt handlers may use the same IRQ number, all ISRs will be called
|
||||
* when an interrupt on that line is fired.
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* COPYRIGHT (c) 2015
|
||||
* Cobham Gaisler
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rtems.org/license/LICENSE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <rtems.h>
|
||||
#include <bsp.h>
|
||||
#include <bsp/irq-generic.h>
|
||||
|
||||
static inline void bsp_dispatch_irq(int irq)
|
||||
{
|
||||
bsp_interrupt_handler_entry *e =
|
||||
&bsp_interrupt_handler_table[bsp_interrupt_handler_index(irq)];
|
||||
|
||||
while (e != NULL) {
|
||||
(*e->handler)(e->arg);
|
||||
e = e->next;
|
||||
}
|
||||
}
|
||||
|
||||
/* Called directly from IRQ trap handler TRAP[0x10..0x1F] = IRQ[0..15] */
|
||||
void bsp_isr_handler(rtems_vector_number vector)
|
||||
{
|
||||
int irq = vector - 0x10;
|
||||
|
||||
/* Let BSP fixup and/or handle incomming IRQ */
|
||||
irq = bsp_irq_fixup(irq);
|
||||
|
||||
bsp_dispatch_irq(irq);
|
||||
}
|
||||
@@ -1,3 +1,13 @@
|
||||
/*
|
||||
* COPYRIGHT (c) 2012-2015
|
||||
* Cobham Gaisler
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rtems.org/license/LICENSE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <rtems.h>
|
||||
#include <bsp.h>
|
||||
#include <bsp/irq-generic.h>
|
||||
@@ -27,28 +37,6 @@ static inline int bsp_irq_cpu(int irq)
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline void bsp_dispatch_irq(int irq)
|
||||
{
|
||||
bsp_interrupt_handler_entry *e =
|
||||
&bsp_interrupt_handler_table[bsp_interrupt_handler_index(irq)];
|
||||
|
||||
while (e != NULL) {
|
||||
(*e->handler)(e->arg);
|
||||
e = e->next;
|
||||
}
|
||||
}
|
||||
|
||||
/* Called directly from IRQ trap handler TRAP[0x10..0x1F] = IRQ[0..15] */
|
||||
static void BSP_ISR_handler(rtems_vector_number vector)
|
||||
{
|
||||
int irq = vector - 0x10;
|
||||
|
||||
/* Let BSP fixup and/or handle incomming IRQ */
|
||||
irq = bsp_irq_fixup(irq);
|
||||
|
||||
bsp_dispatch_irq(irq);
|
||||
}
|
||||
|
||||
/* Initialize interrupts */
|
||||
void BSP_shared_interrupt_init(void)
|
||||
{
|
||||
@@ -64,7 +52,7 @@ void BSP_shared_interrupt_init(void)
|
||||
continue;
|
||||
#endif
|
||||
vector = SPARC_ASYNCHRONOUS_TRAP(i) + 0x10;
|
||||
rtems_interrupt_catch(BSP_ISR_handler, vector, &previous_isr);
|
||||
rtems_interrupt_catch(bsp_isr_handler, vector, &previous_isr);
|
||||
}
|
||||
|
||||
/* Initalize interrupt support */
|
||||
|
||||
Reference in New Issue
Block a user