[PATCH 07/10] bsps/sparc: Use rtems_interrupt_handler_install()
Sebastian Huber
sebastian.huber at embedded-brains.de
Wed Jun 23 06:49:33 UTC 2021
Avoid using set_vector() which depends on _ISR_Vector_table(). Prepare for a
statically initialized trap table.
Update #4458.
---
bsps/sparc/erc32/clock/ckinit.c | 10 ++++++++--
bsps/sparc/erc32/include/bsp.h | 2 ++
bsps/sparc/erc32/include/tm27.h | 24 +++++++++++++++++++-----
bsps/sparc/leon2/clock/ckinit.c | 14 +++++++-------
bsps/sparc/leon2/include/bsp.h | 2 ++
bsps/sparc/leon2/include/tm27.h | 24 +++++++++++++++++++-----
bsps/sparc/leon3/include/bsp.h | 2 ++
bsps/sparc/leon3/include/tm27.h | 24 +++++++++++++++++++-----
bsps/sparc/leon3/mpci/mpisr.c | 9 +++++++--
bsps/sparc/leon3/start/bspsmp.c | 18 +++++++++++++-----
10 files changed, 98 insertions(+), 31 deletions(-)
diff --git a/bsps/sparc/erc32/clock/ckinit.c b/bsps/sparc/erc32/clock/ckinit.c
index 6d6a335fed..83cafb73c3 100644
--- a/bsps/sparc/erc32/clock/ckinit.c
+++ b/bsps/sparc/erc32/clock/ckinit.c
@@ -23,7 +23,7 @@
*/
#include <bsp.h>
-#include <bspopts.h>
+#include <rtems/irq-extension.h>
#include <rtems/sysinit.h>
#include <rtems/timecounter.h>
#include <rtems/score/sparcimpl.h>
@@ -105,7 +105,13 @@ RTEMS_SYSINIT_ITEM(
#define CLOCK_VECTOR ERC32_TRAP_TYPE( ERC32_INTERRUPT_REAL_TIME_CLOCK )
#define Clock_driver_support_install_isr( _new ) \
- set_vector( _new, CLOCK_VECTOR, 1 )
+ (void) rtems_interrupt_handler_install( \
+ ERC32_INTERRUPT_REAL_TIME_CLOCK, \
+ "Clock", \
+ RTEMS_INTERRUPT_SHARED, \
+ _new, \
+ NULL \
+ )
#define Clock_driver_support_set_interrupt_affinity( _online_processors ) \
do { \
diff --git a/bsps/sparc/erc32/include/bsp.h b/bsps/sparc/erc32/include/bsp.h
index 300202bff5..7fb2fa9d72 100644
--- a/bsps/sparc/erc32/include/bsp.h
+++ b/bsps/sparc/erc32/include/bsp.h
@@ -46,6 +46,8 @@
extern "C" {
#endif
+#define BSP_FEATURE_IRQ_EXTENSION
+
/*
* BSP provides its own Idle thread body
*/
diff --git a/bsps/sparc/erc32/include/tm27.h b/bsps/sparc/erc32/include/tm27.h
index 958036fbf0..2ed4f2b78c 100644
--- a/bsps/sparc/erc32/include/tm27.h
+++ b/bsps/sparc/erc32/include/tm27.h
@@ -58,14 +58,28 @@
#define TEST_INTERRUPT_SOURCE ERC32_INTERRUPT_EXTERNAL_1
#define TEST_INTERRUPT_SOURCE2 (ERC32_INTERRUPT_EXTERNAL_1+1)
-#define TEST_VECTOR ERC32_TRAP_TYPE( TEST_INTERRUPT_SOURCE )
-#define TEST_VECTOR2 ERC32_TRAP_TYPE( TEST_INTERRUPT_SOURCE2 )
#define MUST_WAIT_FOR_INTERRUPT 1
-#define Install_tm27_vector( handler ) \
- set_vector( (handler), TEST_VECTOR, 1 ); \
- set_vector( (handler), TEST_VECTOR2, 1 );
+static inline void Install_tm27_vector(
+ void ( *handler )( rtems_vector_number )
+)
+{
+ (void) rtems_interrupt_handler_install(
+ TEST_INTERRUPT_SOURCE,
+ "tm27 low",
+ RTEMS_INTERRUPT_SHARED,
+ (rtems_interrupt_handler) handler,
+ NULL
+ );
+ (void) rtems_interrupt_handler_install(
+ TEST_INTERRUPT_SOURCE2,
+ "tm27 high",
+ RTEMS_INTERRUPT_SHARED,
+ (rtems_interrupt_handler) handler,
+ NULL
+ );
+}
#define Cause_tm27_intr() \
do { \
diff --git a/bsps/sparc/leon2/clock/ckinit.c b/bsps/sparc/leon2/clock/ckinit.c
index ba97894861..8b6ce9a00b 100644
--- a/bsps/sparc/leon2/clock/ckinit.c
+++ b/bsps/sparc/leon2/clock/ckinit.c
@@ -93,14 +93,14 @@ uint32_t _CPU_Counter_frequency(void)
return LEON2_TIMER_1_FREQUENCY;
}
-/*
- * The Real Time Clock Counter Timer uses this trap type.
- */
-
-#define CLOCK_VECTOR LEON_TRAP_TYPE( LEON_INTERRUPT_TIMER1 )
-
#define Clock_driver_support_install_isr( _new ) \
- set_vector( _new, CLOCK_VECTOR, 1 )
+ (void) rtems_interrupt_handler_install( \
+ LEON_INTERRUPT_TIMER1, \
+ "Clock", \
+ RTEMS_INTERRUPT_SHARED, \
+ _new, \
+ NULL \
+ )
#define Clock_driver_support_at_tick() leon2_clock_at_tick()
diff --git a/bsps/sparc/leon2/include/bsp.h b/bsps/sparc/leon2/include/bsp.h
index f97d78ba80..bdd9c1ca70 100644
--- a/bsps/sparc/leon2/include/bsp.h
+++ b/bsps/sparc/leon2/include/bsp.h
@@ -52,6 +52,8 @@ extern "C" {
/* SPARC CPU variant: LEON2 */
#define LEON2 1
+#define BSP_FEATURE_IRQ_EXTENSION
+
/*
* BSP provides its own Idle thread body
*/
diff --git a/bsps/sparc/leon2/include/tm27.h b/bsps/sparc/leon2/include/tm27.h
index 7b1afe96af..8d29607c86 100644
--- a/bsps/sparc/leon2/include/tm27.h
+++ b/bsps/sparc/leon2/include/tm27.h
@@ -57,14 +57,28 @@
#else /* use a regular asynchronous trap */
#define TEST_INTERRUPT_SOURCE LEON_INTERRUPT_EXTERNAL_1
-#define TEST_VECTOR LEON_TRAP_TYPE( TEST_INTERRUPT_SOURCE )
#define TEST_INTERRUPT_SOURCE2 LEON_INTERRUPT_EXTERNAL_1+1
-#define TEST_VECTOR2 LEON_TRAP_TYPE( TEST_INTERRUPT_SOURCE2 )
#define MUST_WAIT_FOR_INTERRUPT 1
-#define Install_tm27_vector( handler ) \
- set_vector( (handler), TEST_VECTOR, 1 ); \
- set_vector( (handler), TEST_VECTOR2, 1 );
+static inline void Install_tm27_vector(
+ void ( *handler )( rtems_vector_number )
+)
+{
+ (void) rtems_interrupt_handler_install(
+ TEST_INTERRUPT_SOURCE,
+ "tm27 low",
+ RTEMS_INTERRUPT_SHARED,
+ (rtems_interrupt_handler) handler,
+ NULL
+ );
+ (void) rtems_interrupt_handler_install(
+ TEST_INTERRUPT_SOURCE2,
+ "tm27 high",
+ RTEMS_INTERRUPT_SHARED,
+ (rtems_interrupt_handler) handler,
+ NULL
+ );
+}
#define Cause_tm27_intr() \
do { \
diff --git a/bsps/sparc/leon3/include/bsp.h b/bsps/sparc/leon3/include/bsp.h
index 6a96b91bf6..82f1f9f8ac 100644
--- a/bsps/sparc/leon3/include/bsp.h
+++ b/bsps/sparc/leon3/include/bsp.h
@@ -52,6 +52,8 @@ extern "C" {
/* SPARC CPU variant: LEON3 */
#define LEON3 1
+#define BSP_FEATURE_IRQ_EXTENSION
+
/*
* BSP provides its own Idle thread body
*/
diff --git a/bsps/sparc/leon3/include/tm27.h b/bsps/sparc/leon3/include/tm27.h
index 00921d4880..7b73bc4dbd 100644
--- a/bsps/sparc/leon3/include/tm27.h
+++ b/bsps/sparc/leon3/include/tm27.h
@@ -57,14 +57,28 @@
#else /* use a regular asynchronous trap */
#define TEST_INTERRUPT_SOURCE LEON_INTERRUPT_EXTERNAL_1
-#define TEST_VECTOR LEON_TRAP_TYPE( TEST_INTERRUPT_SOURCE )
#define TEST_INTERRUPT_SOURCE2 LEON_INTERRUPT_EXTERNAL_1+1
-#define TEST_VECTOR2 LEON_TRAP_TYPE( TEST_INTERRUPT_SOURCE2 )
#define MUST_WAIT_FOR_INTERRUPT 1
-#define Install_tm27_vector( handler ) \
- set_vector( (handler), TEST_VECTOR, 1 ); \
- set_vector( (handler), TEST_VECTOR2, 1 );
+static inline void Install_tm27_vector(
+ void ( *handler )( rtems_vector_number )
+)
+{
+ (void) rtems_interrupt_handler_install(
+ TEST_INTERRUPT_SOURCE,
+ "tm27 low",
+ RTEMS_INTERRUPT_SHARED,
+ (rtems_interrupt_handler) handler,
+ NULL
+ );
+ (void) rtems_interrupt_handler_install(
+ TEST_INTERRUPT_SOURCE2,
+ "tm27 high",
+ RTEMS_INTERRUPT_SHARED,
+ (rtems_interrupt_handler) handler,
+ NULL
+ );
+}
#define Cause_tm27_intr() \
do { \
diff --git a/bsps/sparc/leon3/mpci/mpisr.c b/bsps/sparc/leon3/mpci/mpisr.c
index cdf05293f1..d97b24a87c 100644
--- a/bsps/sparc/leon3/mpci/mpisr.c
+++ b/bsps/sparc/leon3/mpci/mpisr.c
@@ -45,6 +45,11 @@ void Shm_setvec( void )
* Interrupt driven mode is not currently supported.
* This is thought to be the interrupt to use.
*/
- LEON_Unmask_interrupt(LEON3_mp_irq);
- set_vector((rtems_isr_entry) Shm_isr, LEON_TRAP_TYPE(LEON3_mp_irq), 1);
+ (void) rtems_interrupt_handler_install(
+ LEON3_mp_irq,
+ "MPCI",
+ RTEMS_INTERRUPT_SHARED,
+ (rtems_interrupt_handler) Shm_isr,
+ NULL
+ );
}
diff --git a/bsps/sparc/leon3/start/bspsmp.c b/bsps/sparc/leon3/start/bspsmp.c
index ba41a1fca1..c73c3fd5d0 100644
--- a/bsps/sparc/leon3/start/bspsmp.c
+++ b/bsps/sparc/leon3/start/bspsmp.c
@@ -18,6 +18,7 @@
#include <bsp/fatal.h>
#include <leon.h>
#include <rtems/bspIo.h>
+#include <rtems/score/assert.h>
#include <rtems/score/smpimpl.h>
#include <stdlib.h>
@@ -28,10 +29,9 @@ uint32_t _CPU_SMP_Get_current_processor( void )
}
#endif
-static rtems_isr bsp_inter_processor_interrupt(
- rtems_vector_number vector
-)
+static void bsp_inter_processor_interrupt( void *arg )
{
+ (void) arg;
_SMP_Inter_processor_interrupt_handler(_Per_CPU_Get());
}
@@ -57,11 +57,19 @@ void bsp_start_on_secondary_processor(Per_CPU_Control *cpu_self)
uint32_t _CPU_SMP_Initialize( void )
{
+ rtems_status_code sc;
+
if ( !leon3_data_cache_snooping_enabled() )
bsp_fatal( LEON3_FATAL_INVALID_CACHE_CONFIG_MAIN_PROCESSOR );
- LEON_Unmask_interrupt(LEON3_mp_irq);
- set_vector(bsp_inter_processor_interrupt, LEON_TRAP_TYPE(LEON3_mp_irq), 1);
+ sc = rtems_interrupt_handler_install(
+ LEON3_mp_irq,
+ "IPI",
+ RTEMS_INTERRUPT_SHARED,
+ bsp_inter_processor_interrupt,
+ NULL
+ );
+ _Assert_Unused_variable_equals( sc, RTEMS_SUCCESSFUL );
return leon3_get_cpu_count(LEON3_IrqCtrl_Regs);
}
--
2.26.2
More information about the devel
mailing list