[PATCH 4/4] sparc: Add SPARC_INTERRUPT_SOURCE_TO_TRAP()

Sebastian Huber sebastian.huber at embedded-brains.de
Thu Nov 5 15:09:04 UTC 2020


Update #4171.
---
 bsps/sparc/erc32/include/erc32.h                   | 2 +-
 bsps/sparc/leon2/include/leon.h                    | 2 +-
 bsps/sparc/leon3/include/leon.h                    | 2 +-
 cpukit/score/cpu/sparc/include/rtems/score/sparc.h | 9 +++++++++
 4 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/bsps/sparc/erc32/include/erc32.h b/bsps/sparc/erc32/include/erc32.h
index 6d79772cc7..a677b13d25 100644
--- a/bsps/sparc/erc32/include/erc32.h
+++ b/bsps/sparc/erc32/include/erc32.h
@@ -83,7 +83,7 @@ extern "C" {
  *        significant nibble of the trap type.
  */
 
-#define ERC32_TRAP_TYPE( _source ) SPARC_ASYNCHRONOUS_TRAP((_source) + 0x10)
+#define ERC32_TRAP_TYPE( _source ) SPARC_INTERRUPT_SOURCE_TO_TRAP( _source )
 
 #define ERC32_TRAP_SOURCE( _trap ) SPARC_INTERRUPT_TRAP_TO_SOURCE( _trap )
 
diff --git a/bsps/sparc/leon2/include/leon.h b/bsps/sparc/leon2/include/leon.h
index 1d58aa7d39..fc90e1f7e6 100644
--- a/bsps/sparc/leon2/include/leon.h
+++ b/bsps/sparc/leon2/include/leon.h
@@ -80,7 +80,7 @@ extern "C" {
  *        significant nibble of the trap type.
  */
 
-#define LEON_TRAP_TYPE( _source ) SPARC_ASYNCHRONOUS_TRAP((_source) + 0x10)
+#define LEON_TRAP_TYPE( _source ) SPARC_INTERRUPT_SOURCE_TO_TRAP( _source )
 
 #define LEON_TRAP_SOURCE( _trap ) SPARC_INTERRUPT_TRAP_TO_SOURCE( _trap )
 
diff --git a/bsps/sparc/leon3/include/leon.h b/bsps/sparc/leon3/include/leon.h
index 0e86dbefe1..7eed5894c6 100644
--- a/bsps/sparc/leon3/include/leon.h
+++ b/bsps/sparc/leon3/include/leon.h
@@ -42,7 +42,7 @@ extern "C" {
  *        significant nibble of the trap type.
  */
 
-#define LEON_TRAP_TYPE( _source ) SPARC_ASYNCHRONOUS_TRAP((_source) + 0x10)
+#define LEON_TRAP_TYPE( _source ) SPARC_INTERRUPT_SOURCE_TO_TRAP( _source )
 
 #define LEON_TRAP_SOURCE( _trap ) SPARC_INTERRUPT_TRAP_TO_SOURCE( _trap )
 
diff --git a/cpukit/score/cpu/sparc/include/rtems/score/sparc.h b/cpukit/score/cpu/sparc/include/rtems/score/sparc.h
index 553ead38d8..3d9c333efa 100644
--- a/cpukit/score/cpu/sparc/include/rtems/score/sparc.h
+++ b/cpukit/score/cpu/sparc/include/rtems/score/sparc.h
@@ -225,6 +225,15 @@ extern "C" {
 #define SPARC_INTERRUPT_TRAP_TO_SOURCE( _trap ) \
   ( SPARC_REAL_TRAP_NUMBER( _trap ) - 0x10 )
 
+/**
+ * @brief Returns the asynchronous trap number associated with the specified
+ * interrupt source number.
+ *
+ * @brief _source is the interrupt source number to map.
+ */
+#define SPARC_INTERRUPT_SOURCE_TO_TRAP( _source ) \
+  ( SPARC_ASYNCHRONOUS_TRAP( _source ) + 0x10 )
+
 #ifndef ASM
 
 /**
-- 
2.26.2



More information about the devel mailing list