[rtems commit] tm27: Add TM27_INTERRUPT_VECTOR_ALTERNATIVE

Sebastian Huber sebh at rtems.org
Tue Dec 19 07:01:18 UTC 2023


Module:    rtems
Branch:    master
Commit:    93f927de26d9e5504e548c99533f2de197682a83
Changeset: http://git.rtems.org/rtems/commit/?id=93f927de26d9e5504e548c99533f2de197682a83

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Mon Dec 18 12:02:31 2023 +0100

tm27: Add TM27_INTERRUPT_VECTOR_ALTERNATIVE

The TM27 support may define TM27_INTERRUPT_VECTOR_ALTERNATIVE to provide
an alternative software generated interrupt request which is raised by
_TM27_Raise_alternative() and cleared by _TM27_Clear_alternative().
Both functions shall return an RTEMS status code.  This interrupt vector
may be used to test the interrupt controller support on targets which do
not provide generic software generated interrupts.

Update #3716.

---

 cpukit/doxygen.h                              |  7 ++++++
 testsuites/validation/tc-intr-entry-install.c |  9 +++-----
 testsuites/validation/tx-call-within-isr.c    | 31 +++++++++++++++++++++++++++
 testsuites/validation/tx-interrupt.c          |  4 ++++
 testsuites/validation/tx-support.h            |  6 ++++++
 5 files changed, 51 insertions(+), 6 deletions(-)

diff --git a/cpukit/doxygen.h b/cpukit/doxygen.h
index e61b207a7a..a1ba3ece4a 100644
--- a/cpukit/doxygen.h
+++ b/cpukit/doxygen.h
@@ -60,6 +60,13 @@
  *
  * The TM27 support may define TM27_INTERRUPT_VECTOR_DEFAULT to indicate the
  * interrupt vector of the interrupt request raised by Cause_tm27_intr().
+ *
+ * The TM27 support may define TM27_INTERRUPT_VECTOR_ALTERNATIVE to provide an
+ * alternative software generated interrupt request which is raised by
+ * _TM27_Raise_alternative() and cleared by _TM27_Clear_alternative().  Both
+ * functions shall return an RTEMS status code.  This interrupt vector may be
+ * used to test the interrupt controller support on targets which do not
+ * provide generic software generated interrupts.
  */
 
 /**
diff --git a/testsuites/validation/tc-intr-entry-install.c b/testsuites/validation/tc-intr-entry-install.c
index d1fa470d0c..58c7989dbe 100644
--- a/testsuites/validation/tc-intr-entry-install.c
+++ b/testsuites/validation/tc-intr-entry-install.c
@@ -431,11 +431,8 @@ static void Routine( Context *ctx, uint32_t counter )
 
   ctx->handler_counter = counter;
 
-  if (
-    ctx->attributes.can_clear &&
-    !ctx->attributes.cleared_by_acknowledge
-  ) {
-    sc = rtems_interrupt_clear( ctx->test_vector );
+  if ( !ctx->attributes.cleared_by_acknowledge ) {
+    sc = ClearSoftwareInterrupt( ctx->test_vector );
     T_rsc_success( sc );
   }
 
@@ -544,7 +541,7 @@ static void Action( void *arg )
   T_rsc_success( sc );
 
   if ( ctx->status == RTEMS_SUCCESSFUL ) {
-    sc = rtems_interrupt_raise( ctx->test_vector );
+    sc = RaiseSoftwareInterrupt( ctx->test_vector );
     T_rsc_success( sc );
   }
 }
diff --git a/testsuites/validation/tx-call-within-isr.c b/testsuites/validation/tx-call-within-isr.c
index a7fce4368d..8bbe0e7c29 100644
--- a/testsuites/validation/tx-call-within-isr.c
+++ b/testsuites/validation/tx-call-within-isr.c
@@ -185,6 +185,37 @@ rtems_vector_number CallWithinISRGetVector( void )
 #endif
 }
 
+rtems_vector_number GetSoftwareInterruptVector( void )
+{
+#if defined( TM27_INTERRUPT_VECTOR_ALTERNATIVE )
+  return TM27_INTERRUPT_VECTOR_ALTERNATIVE;
+#else
+  return UINT32_MAX;
+#endif
+}
+
+rtems_status_code RaiseSoftwareInterrupt( rtems_vector_number vector )
+{
+#if defined( TM27_INTERRUPT_VECTOR_ALTERNATIVE )
+  if ( vector == TM27_INTERRUPT_VECTOR_ALTERNATIVE ) {
+    return _TM27_Raise_alternative();
+  }
+#endif
+
+  return rtems_interrupt_raise( vector );
+}
+
+rtems_status_code ClearSoftwareInterrupt( rtems_vector_number vector )
+{
+#if defined( TM27_INTERRUPT_VECTOR_ALTERNATIVE )
+  if ( vector == TM27_INTERRUPT_VECTOR_ALTERNATIVE ) {
+    return _TM27_Clear_alternative();
+  }
+#endif
+
+  return rtems_interrupt_clear( vector );
+}
+
 static void CallWithinISRInitialize( void )
 {
   Install_tm27_vector( CallWithinISRHandler );
diff --git a/testsuites/validation/tx-interrupt.c b/testsuites/validation/tx-interrupt.c
index 400ccdf070..c5ea4142c2 100644
--- a/testsuites/validation/tx-interrupt.c
+++ b/testsuites/validation/tx-interrupt.c
@@ -139,6 +139,10 @@ rtems_vector_number GetTestableInterruptVector(
     }
   }
 
+  if ( vector == BSP_INTERRUPT_VECTOR_COUNT ) {
+    vector = GetSoftwareInterruptVector();
+  }
+
   return vector;
 }
 
diff --git a/testsuites/validation/tx-support.h b/testsuites/validation/tx-support.h
index e83b461e2b..378bc4c466 100644
--- a/testsuites/validation/tx-support.h
+++ b/testsuites/validation/tx-support.h
@@ -396,6 +396,8 @@ void CallWithinISRClear( void );
 
 rtems_vector_number CallWithinISRGetVector( void );
 
+rtems_vector_number GetSoftwareInterruptVector( void );
+
 typedef struct {
   Thread_queue_Operations        tq_ops;
   const Thread_queue_Operations *wrapped_ops;
@@ -437,6 +439,10 @@ rtems_vector_number GetTestableInterruptVector(
   const rtems_interrupt_attributes *required
 );
 
+rtems_status_code RaiseSoftwareInterrupt( rtems_vector_number vector );
+
+rtems_status_code ClearSoftwareInterrupt( rtems_vector_number vector );
+
 bool HasInterruptVectorEntriesInstalled( rtems_vector_number vector );
 
 /**



More information about the vc mailing list