diff options
Diffstat (limited to '')
-rw-r--r-- | testsuites/validation/tc-intr-raise.c | 69 |
1 files changed, 43 insertions, 26 deletions
diff --git a/testsuites/validation/tc-intr-raise.c b/testsuites/validation/tc-intr-raise.c index 81e8f8e856..1faa48fc79 100644 --- a/testsuites/validation/tc-intr-raise.c +++ b/testsuites/validation/tc-intr-raise.c @@ -3,11 +3,11 @@ /** * @file * - * @ingroup RTEMSTestCaseRtemsIntrReqRaise + * @ingroup RtemsIntrReqRaise */ /* - * 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 @@ -61,9 +61,9 @@ #include <rtems/test.h> /** - * @defgroup RTEMSTestCaseRtemsIntrReqRaise spec:/rtems/intr/req/raise + * @defgroup RtemsIntrReqRaise spec:/rtems/intr/req/raise * - * @ingroup RTEMSTestSuiteTestsuitesValidation0 + * @ingroup TestsuitesValidationIntr * * @{ */ @@ -134,6 +134,12 @@ typedef struct { struct { /** + * @brief This member defines the pre-condition indices for the next + * action. + */ + size_t pci[ 2 ]; + + /** * @brief This member defines the pre-condition states for the next action. */ size_t pcs[ 2 ]; @@ -304,21 +310,21 @@ static void CheckRaise( T_rsc_success( sc ); if ( !IsPending( ctx) && ( attr->can_enable || IsEnabled( ctx ) ) ) { - T_false( IsPending( ctx ) ); + Disable( ctx ); + Raise( ctx ); - if ( attr->can_disable ) { - Disable( ctx ); - Raise( ctx ); - T_true( IsPending( ctx ) ); + /* + * Some interrupt controllers will signal a pending interrupt if it is + * disabled (for example ARM GIC), others will not signal a pending + * interrupt if it is disabled (for example Freescale/NXP MPIC). + */ + (void) IsPending( ctx ); - sc = rtems_interrupt_vector_enable( ctx->vector ); - T_rsc_success( sc ); + sc = rtems_interrupt_vector_enable( ctx->vector ); + T_rsc_success( sc ); - while ( ctx->interrupt_count < 1 ) { - /* Wait */ - } - } else { - ++ctx->interrupt_count; + while ( ctx->interrupt_count < 1 ) { + /* Wait */ } T_false( IsPending( ctx ) ); @@ -550,13 +556,23 @@ static inline RtemsIntrReqRaise_Entry RtemsIntrReqRaise_PopEntry( ]; } +static void RtemsIntrReqRaise_SetPreConditionStates( + RtemsIntrReqRaise_Context *ctx +) +{ + ctx->Map.pcs[ 0 ] = ctx->Map.pci[ 0 ]; + + if ( ctx->Map.entry.Pre_CanRaise_NA ) { + ctx->Map.pcs[ 1 ] = RtemsIntrReqRaise_Pre_CanRaise_NA; + } else { + ctx->Map.pcs[ 1 ] = ctx->Map.pci[ 1 ]; + } +} + static void RtemsIntrReqRaise_TestVariant( RtemsIntrReqRaise_Context *ctx ) { RtemsIntrReqRaise_Pre_Vector_Prepare( ctx, ctx->Map.pcs[ 0 ] ); - RtemsIntrReqRaise_Pre_CanRaise_Prepare( - ctx, - ctx->Map.entry.Pre_CanRaise_NA ? RtemsIntrReqRaise_Pre_CanRaise_NA : ctx->Map.pcs[ 1 ] - ); + RtemsIntrReqRaise_Pre_CanRaise_Prepare( ctx, ctx->Map.pcs[ 1 ] ); RtemsIntrReqRaise_Action( ctx ); RtemsIntrReqRaise_Post_Status_Check( ctx, ctx->Map.entry.Post_Status ); RtemsIntrReqRaise_Post_Pending_Check( ctx, ctx->Map.entry.Post_Pending ); @@ -574,16 +590,17 @@ T_TEST_CASE_FIXTURE( RtemsIntrReqRaise, &RtemsIntrReqRaise_Fixture ) ctx->Map.index = 0; for ( - ctx->Map.pcs[ 0 ] = RtemsIntrReqRaise_Pre_Vector_Valid; - ctx->Map.pcs[ 0 ] < RtemsIntrReqRaise_Pre_Vector_NA; - ++ctx->Map.pcs[ 0 ] + ctx->Map.pci[ 0 ] = RtemsIntrReqRaise_Pre_Vector_Valid; + ctx->Map.pci[ 0 ] < RtemsIntrReqRaise_Pre_Vector_NA; + ++ctx->Map.pci[ 0 ] ) { for ( - ctx->Map.pcs[ 1 ] = RtemsIntrReqRaise_Pre_CanRaise_Yes; - ctx->Map.pcs[ 1 ] < RtemsIntrReqRaise_Pre_CanRaise_NA; - ++ctx->Map.pcs[ 1 ] + ctx->Map.pci[ 1 ] = RtemsIntrReqRaise_Pre_CanRaise_Yes; + ctx->Map.pci[ 1 ] < RtemsIntrReqRaise_Pre_CanRaise_NA; + ++ctx->Map.pci[ 1 ] ) { ctx->Map.entry = RtemsIntrReqRaise_PopEntry( ctx ); + RtemsIntrReqRaise_SetPreConditionStates( ctx ); RtemsIntrReqRaise_TestVariant( ctx ); } } |