[PATCH v3 30/42] validation: GetTestableInterruptVector()
Sebastian Huber
sebastian.huber at embedded-brains.de
Fri Jul 23 13:56:38 UTC 2021
Update #3269.
---
testsuites/validation/tx-interrupt.c | 47 ++++++++++++++++++++++++++++
testsuites/validation/tx-support.h | 2 ++
2 files changed, 49 insertions(+)
diff --git a/testsuites/validation/tx-interrupt.c b/testsuites/validation/tx-interrupt.c
index 0ff5ec017f..e75c7a2aa0 100644
--- a/testsuites/validation/tx-interrupt.c
+++ b/testsuites/validation/tx-interrupt.c
@@ -69,6 +69,53 @@ rtems_vector_number GetValidInterruptVectorNumber(
return vector;
}
+rtems_vector_number GetTestableInterruptVector( void )
+{
+ rtems_vector_number vector;
+
+ for ( vector = 0; vector < BSP_INTERRUPT_VECTOR_COUNT; ++vector ) {
+ rtems_status_code sc;
+ rtems_interrupt_attributes attr;
+
+ sc = rtems_interrupt_get_attributes( vector, &attr );
+
+ if ( sc != RTEMS_SUCCESSFUL ) {
+ continue;
+ }
+
+ if ( !attr.is_maskable ) {
+ continue;
+ }
+
+ if ( HasInterruptVectorEntriesInstalled( vector ) ) {
+ continue;
+ }
+
+ if ( attr.can_enable && attr.can_disable ) {
+ break;
+ }
+
+ if (
+ attr.maybe_enable && attr.maybe_disable &&
+ !attr.can_be_triggered_by_message &&
+ attr.trigger_signal == RTEMS_INTERRUPT_NO_SIGNAL
+ ) {
+ rtems_status_code sc;
+ bool enabled;
+
+ (void) rtems_interrupt_vector_enable( vector );
+ sc = rtems_interrupt_vector_is_enabled( vector, &enabled );
+
+ if ( sc == RTEMS_SUCCESSFUL && enabled ) {
+ (void) rtems_interrupt_vector_disable( vector );
+ break;
+ }
+ }
+ }
+
+ return vector;
+}
+
static void HasInstalled(
void *arg,
const char *info,
diff --git a/testsuites/validation/tx-support.h b/testsuites/validation/tx-support.h
index 20006f5dd8..b0e466fda1 100644
--- a/testsuites/validation/tx-support.h
+++ b/testsuites/validation/tx-support.h
@@ -118,6 +118,8 @@ rtems_vector_number GetValidInterruptVectorNumber(
const rtems_interrupt_attributes *required
);
+rtems_vector_number GetTestableInterruptVector( void );
+
bool HasInterruptVectorEntriesInstalled( rtems_vector_number vector );
/** @} */
--
2.26.2
More information about the devel
mailing list