[rtems commit] bsp/sparc: Move BSP_ISR_handler to a separate file and rename it
Daniel Hellstrom
danielh at rtems.org
Wed Feb 11 15:34:28 UTC 2015
Module: rtems
Branch: master
Commit: 0c94a46fa3938922481f06e8c64d8caba6d753b3
Changeset: http://git.rtems.org/rtems/commit/?id=0c94a46fa3938922481f06e8c64d8caba6d753b3
Author: Daniel Cederman <cederman at gaisler.com>
Date: Fri Jan 9 09:03:59 2015 +0100
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.
---
c/src/lib/libbsp/sparc/Makefile.am | 1 +
c/src/lib/libbsp/sparc/erc32/Makefile.am | 1 +
c/src/lib/libbsp/sparc/erc32/include/bsp.h | 3 ++
c/src/lib/libbsp/sparc/leon2/Makefile.am | 1 +
c/src/lib/libbsp/sparc/leon2/include/bsp.h | 3 ++
c/src/lib/libbsp/sparc/leon3/Makefile.am | 1 +
c/src/lib/libbsp/sparc/leon3/include/bsp.h | 3 ++
.../lib/libbsp/sparc/shared/irq/bsp_isr_handler.c | 35 ++++++++++++++++++++++
c/src/lib/libbsp/sparc/shared/irq/irq-shared.c | 34 +++++++--------------
9 files changed, 59 insertions(+), 23 deletions(-)
diff --git a/c/src/lib/libbsp/sparc/Makefile.am b/c/src/lib/libbsp/sparc/Makefile.am
index 3d433fb..615aea7 100644
--- a/c/src/lib/libbsp/sparc/Makefile.am
+++ b/c/src/lib/libbsp/sparc/Makefile.am
@@ -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
diff --git a/c/src/lib/libbsp/sparc/erc32/Makefile.am b/c/src/lib/libbsp/sparc/erc32/Makefile.am
index c99d2fb..8dcdd32 100644
--- a/c/src/lib/libbsp/sparc/erc32/Makefile.am
+++ b/c/src/lib/libbsp/sparc/erc32/Makefile.am
@@ -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 \
diff --git a/c/src/lib/libbsp/sparc/erc32/include/bsp.h b/c/src/lib/libbsp/sparc/erc32/include/bsp.h
index 3393910..6984c9e 100644
--- a/c/src/lib/libbsp/sparc/erc32/include/bsp.h
+++ b/c/src/lib/libbsp/sparc/erc32/include/bsp.h
@@ -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.
diff --git a/c/src/lib/libbsp/sparc/leon2/Makefile.am b/c/src/lib/libbsp/sparc/leon2/Makefile.am
index d1e3817..efcb286 100644
--- a/c/src/lib/libbsp/sparc/leon2/Makefile.am
+++ b/c/src/lib/libbsp/sparc/leon2/Makefile.am
@@ -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 \
diff --git a/c/src/lib/libbsp/sparc/leon2/include/bsp.h b/c/src/lib/libbsp/sparc/leon2/include/bsp.h
index 41a1e43..bd8587f 100644
--- a/c/src/lib/libbsp/sparc/leon2/include/bsp.h
+++ b/c/src/lib/libbsp/sparc/leon2/include/bsp.h
@@ -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.
diff --git a/c/src/lib/libbsp/sparc/leon3/Makefile.am b/c/src/lib/libbsp/sparc/leon3/Makefile.am
index c894095..cec0b34 100644
--- a/c/src/lib/libbsp/sparc/leon3/Makefile.am
+++ b/c/src/lib/libbsp/sparc/leon3/Makefile.am
@@ -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 \
diff --git a/c/src/lib/libbsp/sparc/leon3/include/bsp.h b/c/src/lib/libbsp/sparc/leon3/include/bsp.h
index 2514190..47cf701 100644
--- a/c/src/lib/libbsp/sparc/leon3/include/bsp.h
+++ b/c/src/lib/libbsp/sparc/leon3/include/bsp.h
@@ -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.
diff --git a/c/src/lib/libbsp/sparc/shared/irq/bsp_isr_handler.c b/c/src/lib/libbsp/sparc/shared/irq/bsp_isr_handler.c
new file mode 100644
index 0000000..a4d33b0
--- /dev/null
+++ b/c/src/lib/libbsp/sparc/shared/irq/bsp_isr_handler.c
@@ -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);
+}
diff --git a/c/src/lib/libbsp/sparc/shared/irq/irq-shared.c b/c/src/lib/libbsp/sparc/shared/irq/irq-shared.c
index 79dbe55..174324f 100644
--- a/c/src/lib/libbsp/sparc/shared/irq/irq-shared.c
+++ b/c/src/lib/libbsp/sparc/shared/irq/irq-shared.c
@@ -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 */
More information about the vc
mailing list