diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-07-14 10:50:25 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-07-26 19:57:31 +0200 |
commit | 9e1fc366928429437310bd7fcc40bf2e79cc742a (patch) | |
tree | 86d621dae942f5b76e00ffb70b71ab49ab0a00d5 | |
parent | validation: GetValidInterruptVectorNumber() (diff) | |
download | rtems-9e1fc366928429437310bd7fcc40bf2e79cc742a.tar.bz2 |
validation: GetTestableInterruptVector()
Update #3269.
-rw-r--r-- | testsuites/validation/tx-interrupt.c | 47 | ||||
-rw-r--r-- | testsuites/validation/tx-support.h | 2 |
2 files changed, 49 insertions, 0 deletions
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 ); /** @} */ |