[PATCH 3/4] sparc: Add SPARC_INTERRUPT_TRAP_TO_SOURCE()
Sebastian Huber
sebastian.huber at embedded-brains.de
Thu Nov 5 15:09:03 UTC 2020
Update #4171.
---
bsps/sparc/erc32/include/erc32.h | 2 +-
bsps/sparc/erc32/start/setvec.c | 2 +-
bsps/sparc/leon2/include/leon.h | 2 +-
bsps/sparc/leon2/start/setvec.c | 2 +-
bsps/sparc/leon3/include/leon.h | 2 +-
bsps/sparc/leon3/start/setvec.c | 2 +-
cpukit/score/cpu/sparc/include/rtems/score/sparc.h | 14 ++++++++++++++
7 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/bsps/sparc/erc32/include/erc32.h b/bsps/sparc/erc32/include/erc32.h
index 2d278fc669..6d79772cc7 100644
--- a/bsps/sparc/erc32/include/erc32.h
+++ b/bsps/sparc/erc32/include/erc32.h
@@ -85,7 +85,7 @@ extern "C" {
#define ERC32_TRAP_TYPE( _source ) SPARC_ASYNCHRONOUS_TRAP((_source) + 0x10)
-#define ERC32_TRAP_SOURCE( _trap ) ((_trap) - 0x10)
+#define ERC32_TRAP_SOURCE( _trap ) SPARC_INTERRUPT_TRAP_TO_SOURCE( _trap )
#define ERC32_Is_MEC_Trap( _trap ) SPARC_IS_INTERRUPT_TRAP( _trap )
diff --git a/bsps/sparc/erc32/start/setvec.c b/bsps/sparc/erc32/start/setvec.c
index 73bcc99083..50b6266f86 100644
--- a/bsps/sparc/erc32/start/setvec.c
+++ b/bsps/sparc/erc32/start/setvec.c
@@ -51,7 +51,7 @@ rtems_isr_entry set_vector( /* returns old vector */
if ( SPARC_IS_INTERRUPT_TRAP( vector ) ) {
uint32_t source;
- source = ERC32_TRAP_SOURCE( SPARC_REAL_TRAP_NUMBER( vector ) );
+ source = SPARC_INTERRUPT_TRAP_TO_SOURCE( vector );
ERC32_Clear_interrupt( source );
ERC32_Unmask_interrupt( source );
diff --git a/bsps/sparc/leon2/include/leon.h b/bsps/sparc/leon2/include/leon.h
index 49af3086ed..1d58aa7d39 100644
--- a/bsps/sparc/leon2/include/leon.h
+++ b/bsps/sparc/leon2/include/leon.h
@@ -82,7 +82,7 @@ extern "C" {
#define LEON_TRAP_TYPE( _source ) SPARC_ASYNCHRONOUS_TRAP((_source) + 0x10)
-#define LEON_TRAP_SOURCE( _trap ) ((_trap) - 0x10)
+#define LEON_TRAP_SOURCE( _trap ) SPARC_INTERRUPT_TRAP_TO_SOURCE( _trap )
#define LEON_INT_TRAP( _trap ) SPARC_IS_INTERRUPT_TRAP( _trap )
diff --git a/bsps/sparc/leon2/start/setvec.c b/bsps/sparc/leon2/start/setvec.c
index 51647e3ee4..1557c77942 100644
--- a/bsps/sparc/leon2/start/setvec.c
+++ b/bsps/sparc/leon2/start/setvec.c
@@ -52,7 +52,7 @@ rtems_isr_entry set_vector( /* returns old vector */
if ( SPARC_IS_INTERRUPT_TRAP( vector ) ) {
uint32_t source;
- source = LEON_TRAP_SOURCE( SPARC_REAL_TRAP_NUMBER( vector ) );
+ source = SPARC_INTERRUPT_TRAP_TO_SOURCE( vector );
LEON_Clear_interrupt( source );
LEON_Unmask_interrupt( source );
diff --git a/bsps/sparc/leon3/include/leon.h b/bsps/sparc/leon3/include/leon.h
index 5ab0d45125..0e86dbefe1 100644
--- a/bsps/sparc/leon3/include/leon.h
+++ b/bsps/sparc/leon3/include/leon.h
@@ -44,7 +44,7 @@ extern "C" {
#define LEON_TRAP_TYPE( _source ) SPARC_ASYNCHRONOUS_TRAP((_source) + 0x10)
-#define LEON_TRAP_SOURCE( _trap ) ((_trap) - 0x10)
+#define LEON_TRAP_SOURCE( _trap ) SPARC_INTERRUPT_TRAP_TO_SOURCE( _trap )
#define LEON_INT_TRAP( _trap ) SPARC_IS_INTERRUPT_TRAP( _trap )
diff --git a/bsps/sparc/leon3/start/setvec.c b/bsps/sparc/leon3/start/setvec.c
index 987e505c35..f9bccd490a 100644
--- a/bsps/sparc/leon3/start/setvec.c
+++ b/bsps/sparc/leon3/start/setvec.c
@@ -51,7 +51,7 @@ rtems_isr_entry set_vector( /* returns old vector */
if ( SPARC_IS_INTERRUPT_TRAP( vector ) ) {
uint32_t source;
- source = LEON_TRAP_SOURCE( SPARC_REAL_TRAP_NUMBER( vector ) );
+ source = SPARC_INTERRUPT_TRAP_TO_SOURCE( vector );
LEON_Clear_interrupt( source );
LEON_Unmask_interrupt( source );
diff --git a/cpukit/score/cpu/sparc/include/rtems/score/sparc.h b/cpukit/score/cpu/sparc/include/rtems/score/sparc.h
index c2b6aeea6b..553ead38d8 100644
--- a/cpukit/score/cpu/sparc/include/rtems/score/sparc.h
+++ b/cpukit/score/cpu/sparc/include/rtems/score/sparc.h
@@ -211,6 +211,20 @@ extern "C" {
( SPARC_REAL_TRAP_NUMBER( _trap ) >= 0x11 \
&& SPARC_REAL_TRAP_NUMBER( _trap) <= 0x1f )
+/**
+ * @brief Returns the interrupt source number associated with the specified
+ * interrupt trap number.
+ *
+ * Interrupt trap numbers are real hardware vector numbers, synchronous trap
+ * numbers, and asynchronous trap numbers for which SPARC_IS_INTERRUPT_TRAP()
+ * returns true.
+ *
+ * @brief _trap is the real hardware vector number, synchronous trap number, or
+ * asynchronous trap number to map.
+ */
+#define SPARC_INTERRUPT_TRAP_TO_SOURCE( _trap ) \
+ ( SPARC_REAL_TRAP_NUMBER( _trap ) - 0x10 )
+
#ifndef ASM
/**
--
2.26.2
More information about the devel
mailing list