[PATCH 29/41] validation: GetValidInterruptVectorNumber()

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Jul 12 12:49:51 UTC 2021


Update #3269.
---
 testsuites/validation/tx-interrupt.c | 26 ++++++++++++++++++++++++++
 testsuites/validation/tx-support.h   |  5 +++++
 2 files changed, 31 insertions(+)

diff --git a/testsuites/validation/tx-interrupt.c b/testsuites/validation/tx-interrupt.c
index d056af5abc..0ff5ec017f 100644
--- a/testsuites/validation/tx-interrupt.c
+++ b/testsuites/validation/tx-interrupt.c
@@ -43,6 +43,32 @@
 #include <rtems/irq-extension.h>
 #include <rtems/test.h>
 
+#include <bsp/irq-generic.h>
+
+rtems_vector_number GetValidInterruptVectorNumber(
+  const rtems_interrupt_attributes *required
+)
+{
+  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 &&
+        ( required == NULL ||
+          !required->can_get_affinity || attr.can_get_affinity )
+      ) {
+      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 378e98ee3f..20006f5dd8 100644
--- a/testsuites/validation/tx-support.h
+++ b/testsuites/validation/tx-support.h
@@ -38,6 +38,7 @@
 #define _TX_SUPPORT_H
 
 #include <rtems.h>
+#include <rtems/irq-extension.h>
 #include <rtems/score/atomic.h>
 
 #ifdef __cplusplus
@@ -113,6 +114,10 @@ void CallWithinISRSubmit( CallWithinISRRequest *request );
 
 void CallWithinISRWait( const CallWithinISRRequest *request );
 
+rtems_vector_number GetValidInterruptVectorNumber(
+  const rtems_interrupt_attributes *required
+);
+
 bool HasInterruptVectorEntriesInstalled( rtems_vector_number vector );
 
 /** @} */
-- 
2.26.2



More information about the devel mailing list