[PATCH 2/2] tm27: Add TM27_INTERRUPT_VECTOR_ALTERNATIVE
Sebastian Huber
sebastian.huber at embedded-brains.de
Mon Dec 18 11:02:31 UTC 2023
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.
---
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..501855e8b9 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 = ClearTestableInterrupt( 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 = RaiseTestableInterrupt( 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..b2a53eb2b9 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 RaiseTestableInterrupt( 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 ClearTestableInterrupt( 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..b955dbd194 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 RaiseTestableInterrupt( rtems_vector_number vector );
+
+rtems_status_code ClearTestableInterrupt( rtems_vector_number vector );
+
bool HasInterruptVectorEntriesInstalled( rtems_vector_number vector );
/**
--
2.35.3
More information about the devel
mailing list