summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2021-12-10 14:25:30 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2021-12-13 07:32:58 +0100
commit044701eb8b9ec604bf78cfc7d905b3ae92b10bad (patch)
tree210e32beb7e56ffa533fdbb8a4b3fb62525695eb
parentbsp/leon3: Use interrupt entry for the SMP support (diff)
downloadrtems-044701eb8b9ec604bf78cfc7d905b3ae92b10bad.tar.bz2
bsp/leon3: Use interrupt entry for tm27 support
Using rtems_interrupt_entry_install() instead of rtems_interrupt_handler_install() avoids a dependency on the dynamic memory allocation. Use Interrupt Manager directives instead of a BSP-specific API. Use inline functions. In SMP configurations, set an affinity to all online processors and raise the interrupt on the current processor.
-rw-r--r--bsps/sparc/leon3/include/tm27.h77
1 files changed, 57 insertions, 20 deletions
diff --git a/bsps/sparc/leon3/include/tm27.h b/bsps/sparc/leon3/include/tm27.h
index dda21f558f..99c79012bd 100644
--- a/bsps/sparc/leon3/include/tm27.h
+++ b/bsps/sparc/leon3/include/tm27.h
@@ -21,7 +21,11 @@
#define __tm27_h
#include <bsp.h>
-#include <leon.h>
+#include <bsp/irq.h>
+
+#if defined(RTEMS_SMP)
+#include <rtems/score/smpimpl.h>
+#endif
/*
* Define the interrupt mechanism for Time Test 27
@@ -59,40 +63,73 @@
#else /* use a regular asynchronous trap */
-#define TEST_INTERRUPT_SOURCE LEON_INTERRUPT_EXTERNAL_1
-#define TEST_INTERRUPT_SOURCE2 LEON_INTERRUPT_EXTERNAL_1+1
+extern uint32_t Interrupt_nest;
+
+#define TEST_INTERRUPT_SOURCE 5
+#define TEST_INTERRUPT_SOURCE2 6
#define MUST_WAIT_FOR_INTERRUPT 1
static inline void Install_tm27_vector(
void ( *handler )( rtems_vector_number )
)
{
- (void) rtems_interrupt_handler_install(
+ static rtems_interrupt_entry entry_low;
+ static rtems_interrupt_entry entry_high;
+
+#if defined(RTEMS_SMP)
+ bsp_interrupt_set_affinity(
+ TEST_INTERRUPT_SOURCE,
+ _SMP_Get_online_processors()
+ );
+ bsp_interrupt_set_affinity(
+ TEST_INTERRUPT_SOURCE2,
+ _SMP_Get_online_processors()
+ );
+#endif
+
+ rtems_interrupt_entry_initialize(
+ &entry_low,
+ (rtems_interrupt_handler) handler,
+ NULL,
+ "tm27 low"
+ );
+ (void) rtems_interrupt_entry_install(
TEST_INTERRUPT_SOURCE,
- "tm27 low",
RTEMS_INTERRUPT_SHARED,
+ &entry_low
+ );
+ rtems_interrupt_entry_initialize(
+ &entry_high,
(rtems_interrupt_handler) handler,
- NULL
+ NULL,
+ "tm27 high"
);
- (void) rtems_interrupt_handler_install(
+ (void) rtems_interrupt_entry_install(
TEST_INTERRUPT_SOURCE2,
- "tm27 high",
RTEMS_INTERRUPT_SHARED,
- (rtems_interrupt_handler) handler,
- NULL
+ &entry_high
);
}
-#define Cause_tm27_intr() \
- do { \
- LEON_Force_interrupt( TEST_INTERRUPT_SOURCE+(Interrupt_nest>>1)); \
- nop(); \
- nop(); \
- nop(); \
- } while (0)
-
-#define Clear_tm27_intr() \
- LEON_Clear_interrupt( TEST_INTERRUPT_SOURCE )
+static inline void Cause_tm27_intr( void )
+{
+ rtems_vector_number vector;
+
+ vector = TEST_INTERRUPT_SOURCE + ( Interrupt_nest >> 1 );
+#if defined(RTEMS_SMP)
+ (void) rtems_interrupt_raise_on( vector, rtems_scheduler_get_processor() );
+#else
+ (void) rtems_interrupt_raise( vector );
+#endif
+ nop();
+ nop();
+ nop();
+}
+
+static inline void Clear_tm27_intr( void )
+{
+ (void) rtems_interrupt_clear( TEST_INTERRUPT_SOURCE );
+}
#define Lower_tm27_intr() /* empty */