[PATCH 1/2] tm27: Add optional TM27_INTERRUPT_VECTOR_DEFAULT

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Dec 18 11:02:30 UTC 2023


Let the BSP define TM27_INTERRUPT_VECTOR_DEFAULT to more efficiently and
reliably get the TM27 default interrupt vector.
---
 bsps/include/dev/irq/arm-gic-tm27.h        |  2 ++
 bsps/sparc/leon3/include/tm27.h            |  1 +
 cpukit/doxygen.h                           | 18 +++++++++++++++++-
 testsuites/validation/tx-call-within-isr.c |  8 +++++++-
 4 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/bsps/include/dev/irq/arm-gic-tm27.h b/bsps/include/dev/irq/arm-gic-tm27.h
index ad2c5e812c..f2a16afae3 100644
--- a/bsps/include/dev/irq/arm-gic-tm27.h
+++ b/bsps/include/dev/irq/arm-gic-tm27.h
@@ -55,6 +55,8 @@
 #define ARM_GIC_TM27_IRQ_HIGH ARM_GIC_IRQ_SGI_13
 #endif
 
+#define TM27_INTERRUPT_VECTOR_DEFAULT ARM_GIC_TM27_IRQ_LOW
+
 #define ARM_GIC_TM27_PRIO_LOW 0x80
 
 #define ARM_GIC_TM27_PRIO_HIGH 0x00
diff --git a/bsps/sparc/leon3/include/tm27.h b/bsps/sparc/leon3/include/tm27.h
index df30b738b2..3de349f363 100644
--- a/bsps/sparc/leon3/include/tm27.h
+++ b/bsps/sparc/leon3/include/tm27.h
@@ -89,6 +89,7 @@ extern uint32_t Interrupt_nest;
 #define TEST_INTERRUPT_SOURCE 5
 #define TEST_INTERRUPT_SOURCE2 6
 #define MUST_WAIT_FOR_INTERRUPT 1
+#define TM27_INTERRUPT_VECTOR_DEFAULT TEST_INTERRUPT_SOURCE
 
 static inline void Install_tm27_vector( rtems_interrupt_handler handler )
 {
diff --git a/cpukit/doxygen.h b/cpukit/doxygen.h
index 661955a501..e61b207a7a 100644
--- a/cpukit/doxygen.h
+++ b/cpukit/doxygen.h
@@ -43,7 +43,23 @@
  *
  * @ingroup RTEMSDeviceDrivers
  *
- * @brief Time Test 27 Support
+ * @brief The Time Test 27 (TM27) support is used to measure the timing of
+ *   the interrupt processing.
+ *
+ * The TMS27 support should provide two software generated interrupt requests,
+ * one low priority request raised by Cause_tm27_intr() and one higher priority
+ * request raised by Lower_tm27_intr().  Both requests should be cleared by
+ * Clear_tm27_intr().  A handler provided by the test should be installed
+ * through Install_tm27_vector().  This function should initialize the system
+ * so that the software generated interrupt requests can be raised and cleared.
+ *
+ * If the raise functions Cause_tm27_intr() and Lower_tm27_intr() do not
+ * trigger the interrupt immediately, then the TM27 support shall define
+ * MUST_WAIT_FOR_INTERRUPT to one, otherwise MUST_WAIT_FOR_INTERRUPT shall be
+ * defined to zero.
+ *
+ * The TM27 support may define TM27_INTERRUPT_VECTOR_DEFAULT to indicate the
+ * interrupt vector of the interrupt request raised by Cause_tm27_intr().
  */
 
 /**
diff --git a/testsuites/validation/tx-call-within-isr.c b/testsuites/validation/tx-call-within-isr.c
index 63a9a6dc26..a7fce4368d 100644
--- a/testsuites/validation/tx-call-within-isr.c
+++ b/testsuites/validation/tx-call-within-isr.c
@@ -140,6 +140,7 @@ void CallWithinISRWait( const CallWithinISRRequest *request )
   }
 }
 
+#if !defined( TM27_INTERRUPT_VECTOR_DEFAULT )
 static void CallWithinISRIsHandlerInstalled(
   void                   *arg,
   const char             *info,
@@ -152,13 +153,17 @@ static void CallWithinISRIsHandlerInstalled(
   (void) option;
   (void) handler_arg;
 
-  if ( handler == CallWithinISRHandler ) {
+  if ( handler == CallWithinISRHandler && handler_arg == NULL ) {
     *(bool *) arg = true;
   }
 }
+#endif
 
 rtems_vector_number CallWithinISRGetVector( void )
 {
+#if defined( TM27_INTERRUPT_VECTOR_DEFAULT )
+  return TM27_INTERRUPT_VECTOR_DEFAULT;
+#else
   rtems_vector_number vector;
 
   for ( vector = 0; vector < BSP_INTERRUPT_VECTOR_COUNT; ++vector ) {
@@ -177,6 +182,7 @@ rtems_vector_number CallWithinISRGetVector( void )
   }
 
   return UINT32_MAX;
+#endif
 }
 
 static void CallWithinISRInitialize( void )
-- 
2.35.3



More information about the devel mailing list