diff options
Diffstat (limited to 'testsuites/validation/tx-interrupt.c')
-rw-r--r-- | testsuites/validation/tx-interrupt.c | 46 |
1 files changed, 38 insertions, 8 deletions
diff --git a/testsuites/validation/tx-interrupt.c b/testsuites/validation/tx-interrupt.c index e75c7a2aa0..c5ea4142c2 100644 --- a/testsuites/validation/tx-interrupt.c +++ b/testsuites/validation/tx-interrupt.c @@ -3,14 +3,14 @@ /** * @file * - * @ingroup RTEMSTestSuites + * @ingroup RTEMSTestSuitesValidation * * @brief This source file contains the implementation of * HasInterruptVectorEntriesInstalled(). */ /* - * Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de) + * Copyright (C) 2021 embedded brains GmbH & Co. KG * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -45,6 +45,30 @@ #include <bsp/irq-generic.h> +static bool HasRequiredAttributes( + const rtems_interrupt_attributes *required, + const rtems_interrupt_attributes *actual +) +{ + if ( required == NULL ) { + return true; + } + + if ( required->can_get_affinity && !actual->can_get_affinity ) { + return false; + } + + if ( required->can_raise && !actual->can_raise ) { + return false; + } + + if ( required->can_raise_on && !actual->can_raise_on ) { + return false; + } + + return true; +} + rtems_vector_number GetValidInterruptVectorNumber( const rtems_interrupt_attributes *required ) @@ -57,11 +81,7 @@ rtems_vector_number GetValidInterruptVectorNumber( sc = rtems_interrupt_get_attributes( vector, &attr ); - if ( - sc == RTEMS_SUCCESSFUL && - ( required == NULL || - !required->can_get_affinity || attr.can_get_affinity ) - ) { + if ( sc == RTEMS_SUCCESSFUL && HasRequiredAttributes( required, &attr ) ) { break; } } @@ -69,7 +89,9 @@ rtems_vector_number GetValidInterruptVectorNumber( return vector; } -rtems_vector_number GetTestableInterruptVector( void ) +rtems_vector_number GetTestableInterruptVector( + const rtems_interrupt_attributes *required +) { rtems_vector_number vector; @@ -87,6 +109,10 @@ rtems_vector_number GetTestableInterruptVector( void ) continue; } + if ( !HasRequiredAttributes( required, &attr ) ) { + continue; + } + if ( HasInterruptVectorEntriesInstalled( vector ) ) { continue; } @@ -113,6 +139,10 @@ rtems_vector_number GetTestableInterruptVector( void ) } } + if ( vector == BSP_INTERRUPT_VECTOR_COUNT ) { + vector = GetSoftwareInterruptVector(); + } + return vector; } |