[rtems commit] validation: GetTestableInterruptVector()
Sebastian Huber
sebh at rtems.org
Tue Jul 27 05:42:40 UTC 2021
Module: rtems
Branch: master
Commit: 9e1fc366928429437310bd7fcc40bf2e79cc742a
Changeset: http://git.rtems.org/rtems/commit/?id=9e1fc366928429437310bd7fcc40bf2e79cc742a
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Wed Jul 14 10:50:25 2021 +0200
validation: GetTestableInterruptVector()
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 0ff5ec0..e75c7a2 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 20006f5..b0e466f 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 );
/** @} */
More information about the vc
mailing list