Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:53

0001 /* SPDX-License-Identifier: BSD-2-Clause */
0002 
0003 /**
0004  * @file
0005  *
0006  * @ingroup RtemsTimerReqCancel
0007  */
0008 
0009 /*
0010  * Copyright (C) 2021 embedded brains GmbH & Co. KG
0011  *
0012  * Redistribution and use in source and binary forms, with or without
0013  * modification, are permitted provided that the following conditions
0014  * are met:
0015  * 1. Redistributions of source code must retain the above copyright
0016  *    notice, this list of conditions and the following disclaimer.
0017  * 2. Redistributions in binary form must reproduce the above copyright
0018  *    notice, this list of conditions and the following disclaimer in the
0019  *    documentation and/or other materials provided with the distribution.
0020  *
0021  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0022  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0023  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0024  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0025  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0026  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0027  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0028  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0029  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0030  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0031  * POSSIBILITY OF SUCH DAMAGE.
0032  */
0033 
0034 /*
0035  * This file is part of the RTEMS quality process and was automatically
0036  * generated.  If you find something that needs to be fixed or
0037  * worded better please post a report or patch to an RTEMS mailing list
0038  * or raise a bug report:
0039  *
0040  * https://www.rtems.org/bugs.html
0041  *
0042  * For information on updating and regenerating please refer to the How-To
0043  * section in the Software Requirements Engineering chapter of the
0044  * RTEMS Software Engineering manual.  The manual is provided as a part of
0045  * a release.  For development sources please refer to the online
0046  * documentation at:
0047  *
0048  * https://docs.rtems.org
0049  */
0050 
0051 #ifdef HAVE_CONFIG_H
0052 #include "config.h"
0053 #endif
0054 
0055 #include <rtems.h>
0056 
0057 #include "tx-support.h"
0058 
0059 #include <rtems/test.h>
0060 
0061 /**
0062  * @defgroup RtemsTimerReqCancel spec:/rtems/timer/req/cancel
0063  *
0064  * @ingroup TestsuitesValidationNoClock0
0065  *
0066  * @{
0067  */
0068 
0069 typedef enum {
0070   RtemsTimerReqCancel_Pre_Id_Valid,
0071   RtemsTimerReqCancel_Pre_Id_Invalid,
0072   RtemsTimerReqCancel_Pre_Id_NA
0073 } RtemsTimerReqCancel_Pre_Id;
0074 
0075 typedef enum {
0076   RtemsTimerReqCancel_Pre_Context_None,
0077   RtemsTimerReqCancel_Pre_Context_Interrupt,
0078   RtemsTimerReqCancel_Pre_Context_Server,
0079   RtemsTimerReqCancel_Pre_Context_NA
0080 } RtemsTimerReqCancel_Pre_Context;
0081 
0082 typedef enum {
0083   RtemsTimerReqCancel_Pre_Clock_None,
0084   RtemsTimerReqCancel_Pre_Clock_Ticks,
0085   RtemsTimerReqCancel_Pre_Clock_Realtime,
0086   RtemsTimerReqCancel_Pre_Clock_NA
0087 } RtemsTimerReqCancel_Pre_Clock;
0088 
0089 typedef enum {
0090   RtemsTimerReqCancel_Pre_State_Inactive,
0091   RtemsTimerReqCancel_Pre_State_Scheduled,
0092   RtemsTimerReqCancel_Pre_State_Pending,
0093   RtemsTimerReqCancel_Pre_State_NA
0094 } RtemsTimerReqCancel_Pre_State;
0095 
0096 typedef enum {
0097   RtemsTimerReqCancel_Post_Status_Ok,
0098   RtemsTimerReqCancel_Post_Status_InvId,
0099   RtemsTimerReqCancel_Post_Status_NA
0100 } RtemsTimerReqCancel_Post_Status;
0101 
0102 typedef enum {
0103   RtemsTimerReqCancel_Post_Context_None,
0104   RtemsTimerReqCancel_Post_Context_Interrupt,
0105   RtemsTimerReqCancel_Post_Context_Server,
0106   RtemsTimerReqCancel_Post_Context_Nop,
0107   RtemsTimerReqCancel_Post_Context_NA
0108 } RtemsTimerReqCancel_Post_Context;
0109 
0110 typedef enum {
0111   RtemsTimerReqCancel_Post_Clock_None,
0112   RtemsTimerReqCancel_Post_Clock_Ticks,
0113   RtemsTimerReqCancel_Post_Clock_Realtime,
0114   RtemsTimerReqCancel_Post_Clock_Nop,
0115   RtemsTimerReqCancel_Post_Clock_NA
0116 } RtemsTimerReqCancel_Post_Clock;
0117 
0118 typedef enum {
0119   RtemsTimerReqCancel_Post_State_Inactive,
0120   RtemsTimerReqCancel_Post_State_Nop,
0121   RtemsTimerReqCancel_Post_State_NA
0122 } RtemsTimerReqCancel_Post_State;
0123 
0124 typedef struct {
0125   uint16_t Skip : 1;
0126   uint16_t Pre_Id_NA : 1;
0127   uint16_t Pre_Context_NA : 1;
0128   uint16_t Pre_Clock_NA : 1;
0129   uint16_t Pre_State_NA : 1;
0130   uint16_t Post_Status : 2;
0131   uint16_t Post_Context : 3;
0132   uint16_t Post_Clock : 3;
0133   uint16_t Post_State : 2;
0134 } RtemsTimerReqCancel_Entry;
0135 
0136 typedef enum {
0137   PRE_NONE = 0,
0138   PRE_INTERRUPT = 1,
0139   PRE_SERVER = 2
0140 } PreConditionContext;
0141 
0142 /**
0143  * @brief Test context for spec:/rtems/timer/req/cancel test case.
0144  */
0145 typedef struct {
0146   /**
0147    * @brief This member contains a valid id of a timer.
0148    */
0149   rtems_id timer_id;
0150 
0151   /**
0152    * @brief This member specifies the ``id`` parameter for the action.
0153    */
0154   rtems_id id_param;
0155 
0156   /**
0157    * @brief This member contains the return status of the action.
0158    */
0159   rtems_status_code status;
0160 
0161   /**
0162    * @brief This member contains the counter for invocations of the Timer
0163    *   Service Routine.
0164    */
0165   int invocations;
0166 
0167   /**
0168    * @brief This member specifies which pre-condition context (none, interrupt
0169    *   context, server context) must be created before the cancel action gets
0170    *   executed.
0171    */
0172   PreConditionContext pre_cond_contex;
0173 
0174   /**
0175    * @brief This member stores RTEMS internal clock and context settings of the
0176    *   timer before the execution of the test action.
0177    */
0178   Timer_Classes pre_class;
0179 
0180   /**
0181    * @brief This member stores the state of the timer before the execution of
0182    *   the test action.
0183    */
0184   Timer_States pre_state;
0185 
0186   /**
0187    * @brief This member stores the state of the timer after the execution of
0188    *   the test action.
0189    */
0190   Timer_States post_state;
0191 
0192   struct {
0193     /**
0194      * @brief This member defines the pre-condition states for the next action.
0195      */
0196     size_t pcs[ 4 ];
0197 
0198     /**
0199      * @brief If this member is true, then the test action loop is executed.
0200      */
0201     bool in_action_loop;
0202 
0203     /**
0204      * @brief This member contains the next transition map index.
0205      */
0206     size_t index;
0207 
0208     /**
0209      * @brief This member contains the current transition map entry.
0210      */
0211     RtemsTimerReqCancel_Entry entry;
0212 
0213     /**
0214      * @brief If this member is true, then the current transition variant
0215      *   should be skipped.
0216      */
0217     bool skip;
0218   } Map;
0219 } RtemsTimerReqCancel_Context;
0220 
0221 static RtemsTimerReqCancel_Context
0222   RtemsTimerReqCancel_Instance;
0223 
0224 static const char * const RtemsTimerReqCancel_PreDesc_Id[] = {
0225   "Valid",
0226   "Invalid",
0227   "NA"
0228 };
0229 
0230 static const char * const RtemsTimerReqCancel_PreDesc_Context[] = {
0231   "None",
0232   "Interrupt",
0233   "Server",
0234   "NA"
0235 };
0236 
0237 static const char * const RtemsTimerReqCancel_PreDesc_Clock[] = {
0238   "None",
0239   "Ticks",
0240   "Realtime",
0241   "NA"
0242 };
0243 
0244 static const char * const RtemsTimerReqCancel_PreDesc_State[] = {
0245   "Inactive",
0246   "Scheduled",
0247   "Pending",
0248   "NA"
0249 };
0250 
0251 static const char * const * const RtemsTimerReqCancel_PreDesc[] = {
0252   RtemsTimerReqCancel_PreDesc_Id,
0253   RtemsTimerReqCancel_PreDesc_Context,
0254   RtemsTimerReqCancel_PreDesc_Clock,
0255   RtemsTimerReqCancel_PreDesc_State,
0256   NULL
0257 };
0258 
0259 static const rtems_time_of_day tod_now      = { 2000, 1, 1, 0, 0, 0, 0 };
0260 static const rtems_time_of_day tod_schedule = { 2000, 1, 1, 1, 0, 0, 0 };
0261 static const rtems_time_of_day tod_fire     = { 2000, 1, 2, 0, 0, 0, 0 };
0262 
0263 static void TriggerTimer( void )
0264 {
0265   /* Fire the timer service routine for ticks and realtime clock */
0266   int i;
0267   for ( i = 0; i < 5; i++ ) {
0268     ClockTick();
0269   }
0270   T_rsc_success( rtems_clock_set( &tod_fire ) );
0271 }
0272 
0273 static void TimerServiceRoutine(
0274   rtems_id timer_id,
0275   void *user_data
0276 )
0277 {
0278   RtemsTimerReqCancel_Context *ctx = user_data;
0279   ++( ctx->invocations );
0280 }
0281 
0282 static void RtemsTimerReqCancel_Pre_Id_Prepare(
0283   RtemsTimerReqCancel_Context *ctx,
0284   RtemsTimerReqCancel_Pre_Id   state
0285 )
0286 {
0287   switch ( state ) {
0288     case RtemsTimerReqCancel_Pre_Id_Valid: {
0289       /*
0290        * While the ``id`` parameter is valid.
0291        */
0292       ctx->id_param = ctx->timer_id;
0293       break;
0294     }
0295 
0296     case RtemsTimerReqCancel_Pre_Id_Invalid: {
0297       /*
0298        * While the ``id`` parameter is invalid.
0299        */
0300       ctx->id_param = RTEMS_ID_NONE;
0301       break;
0302     }
0303 
0304     case RtemsTimerReqCancel_Pre_Id_NA:
0305       break;
0306   }
0307 }
0308 
0309 static void RtemsTimerReqCancel_Pre_Context_Prepare(
0310   RtemsTimerReqCancel_Context    *ctx,
0311   RtemsTimerReqCancel_Pre_Context state
0312 )
0313 {
0314   switch ( state ) {
0315     case RtemsTimerReqCancel_Pre_Context_None: {
0316       /*
0317        * While the Timer Service Routine has never been scheduled since
0318        * creation of the timer. See also none.
0319        */
0320       ctx->pre_cond_contex = PRE_NONE;
0321       break;
0322     }
0323 
0324     case RtemsTimerReqCancel_Pre_Context_Interrupt: {
0325       /*
0326        * While the timer is in interrupt context.
0327        */
0328       ctx->pre_cond_contex = PRE_INTERRUPT;
0329       break;
0330     }
0331 
0332     case RtemsTimerReqCancel_Pre_Context_Server: {
0333       /*
0334        * While the timer is in server context.
0335        */
0336       ctx->pre_cond_contex = PRE_SERVER;
0337       break;
0338     }
0339 
0340     case RtemsTimerReqCancel_Pre_Context_NA:
0341       break;
0342   }
0343 }
0344 
0345 static void RtemsTimerReqCancel_Pre_Clock_Prepare(
0346   RtemsTimerReqCancel_Context  *ctx,
0347   RtemsTimerReqCancel_Pre_Clock state
0348 )
0349 {
0350   switch ( state ) {
0351     case RtemsTimerReqCancel_Pre_Clock_None: {
0352       /*
0353        * While the timer has never been scheduled since creation of the timer.
0354        */
0355       T_eq_int( ctx->pre_cond_contex, PRE_NONE );
0356       break;
0357     }
0358 
0359     case RtemsTimerReqCancel_Pre_Clock_Ticks: {
0360       /*
0361        * While the clock used to determine when the timer will fire is the
0362        * ticks based clock.
0363        */
0364       rtems_status_code status;
0365 
0366       if ( ctx->pre_cond_contex == PRE_INTERRUPT ) {
0367         status = rtems_timer_fire_after(
0368           ctx->timer_id,
0369           1,
0370           TimerServiceRoutine,
0371           ctx
0372         );
0373       } else {
0374          status = rtems_timer_server_fire_after(
0375           ctx->timer_id,
0376           1,
0377           TimerServiceRoutine,
0378           ctx
0379         );
0380       }
0381       T_rsc_success( status );
0382       break;
0383     }
0384 
0385     case RtemsTimerReqCancel_Pre_Clock_Realtime: {
0386       /*
0387        * While the clock used to determine when the timer will fire is the
0388        * realtime clock.
0389        */
0390       rtems_status_code status;
0391 
0392       if ( ctx->pre_cond_contex == PRE_INTERRUPT ) {
0393         status = rtems_timer_fire_when(
0394           ctx->timer_id,
0395           &tod_schedule,
0396           TimerServiceRoutine,
0397           ctx
0398         );
0399       } else {
0400         status = rtems_timer_server_fire_when(
0401           ctx->timer_id,
0402           &tod_schedule,
0403           TimerServiceRoutine,
0404           ctx
0405         );
0406       }
0407       T_rsc_success( status );
0408       break;
0409     }
0410 
0411     case RtemsTimerReqCancel_Pre_Clock_NA:
0412       break;
0413   }
0414 }
0415 
0416 static void RtemsTimerReqCancel_Pre_State_Prepare(
0417   RtemsTimerReqCancel_Context  *ctx,
0418   RtemsTimerReqCancel_Pre_State state
0419 )
0420 {
0421   switch ( state ) {
0422     case RtemsTimerReqCancel_Pre_State_Inactive: {
0423       /*
0424        * While the timer is in inactive state.
0425        */
0426       TriggerTimer();
0427       T_eq_int(
0428         ctx->invocations,
0429         ( ctx->pre_cond_contex == PRE_NONE ) ? 0 : 1
0430       );
0431       ctx->invocations = 0;
0432       ctx->pre_state = TIMER_INACTIVE;
0433       break;
0434     }
0435 
0436     case RtemsTimerReqCancel_Pre_State_Scheduled: {
0437       /*
0438        * While the timer is in scheduled state.
0439        */
0440       /* The timer was already scheduled in the "Clock" pre-conditions. */
0441       ctx->pre_state = TIMER_SCHEDULED;
0442       break;
0443     }
0444 
0445     case RtemsTimerReqCancel_Pre_State_Pending: {
0446       /*
0447        * While the timer is in pending state.
0448        */
0449       T_rsc_success( rtems_task_suspend( GetTimerServerTaskId() ) );
0450       TriggerTimer();
0451       T_eq_int( ctx->invocations, 0 );
0452       ctx->pre_state = TIMER_PENDING;
0453       break;
0454     }
0455 
0456     case RtemsTimerReqCancel_Pre_State_NA:
0457       break;
0458   }
0459 }
0460 
0461 static void RtemsTimerReqCancel_Post_Status_Check(
0462   RtemsTimerReqCancel_Context    *ctx,
0463   RtemsTimerReqCancel_Post_Status state
0464 )
0465 {
0466   switch ( state ) {
0467     case RtemsTimerReqCancel_Post_Status_Ok: {
0468       /*
0469        * The return status of rtems_timer_cancel() shall be RTEMS_SUCCESSFUL.
0470        */
0471       T_rsc_success( ctx->status );
0472       break;
0473     }
0474 
0475     case RtemsTimerReqCancel_Post_Status_InvId: {
0476       /*
0477        * The return status of rtems_timer_cancel() shall be RTEMS_INVALID_ID.
0478        */
0479       T_rsc( ctx->status, RTEMS_INVALID_ID );
0480       break;
0481     }
0482 
0483     case RtemsTimerReqCancel_Post_Status_NA:
0484       break;
0485   }
0486 }
0487 
0488 static void RtemsTimerReqCancel_Post_Context_Check(
0489   RtemsTimerReqCancel_Context     *ctx,
0490   RtemsTimerReqCancel_Post_Context state
0491 )
0492 {
0493   Timer_Classes class;
0494   class = GetTimerClass( ctx->timer_id );
0495 
0496   switch ( state ) {
0497     case RtemsTimerReqCancel_Post_Context_None: {
0498       /*
0499        * The timer shall have never been scheduled. See also none.
0500        */
0501       T_eq_int( class, TIMER_DORMANT );
0502       break;
0503     }
0504 
0505     case RtemsTimerReqCancel_Post_Context_Interrupt: {
0506       /*
0507        * The timer shall be in interrupt context.
0508        */
0509       T_eq_int( class & TIMER_CLASS_BIT_ON_TASK, 0 );
0510       break;
0511     }
0512 
0513     case RtemsTimerReqCancel_Post_Context_Server: {
0514       /*
0515        * The timer shall be in server context.
0516        */
0517       T_eq_int( class & TIMER_CLASS_BIT_ON_TASK, TIMER_CLASS_BIT_ON_TASK );
0518       break;
0519     }
0520 
0521     case RtemsTimerReqCancel_Post_Context_Nop: {
0522       /*
0523        * Objects referenced by the ``id`` parameter in past call to
0524        * rtems_timer_cancel() shall not be accessed by the rtems_timer_cancel()
0525        * call. See also Nop.
0526        */
0527       T_eq_int( class, ctx->pre_class );
0528       break;
0529     }
0530 
0531     case RtemsTimerReqCancel_Post_Context_NA:
0532       break;
0533   }
0534 }
0535 
0536 static void RtemsTimerReqCancel_Post_Clock_Check(
0537   RtemsTimerReqCancel_Context   *ctx,
0538   RtemsTimerReqCancel_Post_Clock state
0539 )
0540 {
0541   Timer_Classes class;
0542   class = GetTimerClass( ctx->timer_id );
0543 
0544   switch ( state ) {
0545     case RtemsTimerReqCancel_Post_Clock_None: {
0546       /*
0547        * The timer shall have never been scheduled.
0548        */
0549       T_eq_int( class, TIMER_DORMANT );
0550       break;
0551     }
0552 
0553     case RtemsTimerReqCancel_Post_Clock_Ticks: {
0554       /*
0555        * The timer shall use the ticks based clock.
0556        */
0557       T_eq_int( class & TIMER_CLASS_BIT_TIME_OF_DAY, 0 );
0558       break;
0559     }
0560 
0561     case RtemsTimerReqCancel_Post_Clock_Realtime: {
0562       /*
0563        * The timer shall use the realtime clock.
0564        */
0565       T_eq_int(
0566         class & TIMER_CLASS_BIT_TIME_OF_DAY,
0567         TIMER_CLASS_BIT_TIME_OF_DAY
0568       );
0569       break;
0570     }
0571 
0572     case RtemsTimerReqCancel_Post_Clock_Nop: {
0573       /*
0574        * Objects referenced by the ``id`` parameter in past call to
0575        * rtems_timer_cancel() shall not be accessed by the rtems_timer_cancel()
0576        * call.
0577        */
0578       T_eq_int( class, ctx->pre_class );
0579       break;
0580     }
0581 
0582     case RtemsTimerReqCancel_Post_Clock_NA:
0583       break;
0584   }
0585 }
0586 
0587 static void RtemsTimerReqCancel_Post_State_Check(
0588   RtemsTimerReqCancel_Context   *ctx,
0589   RtemsTimerReqCancel_Post_State state
0590 )
0591 {
0592   switch ( state ) {
0593     case RtemsTimerReqCancel_Post_State_Inactive: {
0594       /*
0595        * The timer shall be in inactive state.
0596        */
0597       /* Try to fire the timer service routine - which should not fire. */
0598       TriggerTimer();
0599       T_eq_int( ctx->invocations, 0 );
0600       break;
0601     }
0602 
0603     case RtemsTimerReqCancel_Post_State_Nop: {
0604       /*
0605        * Objects referenced by the ``id`` parameter in past call to
0606        * rtems_timer_cancel() shall not be accessed by the rtems_timer_cancel()
0607        * call.
0608        */
0609       T_eq_int( ctx->post_state, ctx->pre_state );
0610       break;
0611     }
0612 
0613     case RtemsTimerReqCancel_Post_State_NA:
0614       break;
0615   }
0616 }
0617 
0618 static void RtemsTimerReqCancel_Setup( RtemsTimerReqCancel_Context *ctx )
0619 {
0620   rtems_status_code status;
0621   status = rtems_timer_initiate_server(
0622     RTEMS_TIMER_SERVER_DEFAULT_PRIORITY,
0623     RTEMS_MINIMUM_STACK_SIZE,
0624     RTEMS_DEFAULT_ATTRIBUTES
0625   );
0626   T_rsc_success( status );
0627 }
0628 
0629 static void RtemsTimerReqCancel_Setup_Wrap( void *arg )
0630 {
0631   RtemsTimerReqCancel_Context *ctx;
0632 
0633   ctx = arg;
0634   ctx->Map.in_action_loop = false;
0635   RtemsTimerReqCancel_Setup( ctx );
0636 }
0637 
0638 /**
0639  * @brief Make sure the timer server is not running and the realtime clock is
0640  *   not set after this test.
0641  */
0642 static void RtemsTimerReqCancel_Teardown( RtemsTimerReqCancel_Context *ctx )
0643 {
0644   DeleteTimerServer();
0645   UnsetClock();
0646 }
0647 
0648 static void RtemsTimerReqCancel_Teardown_Wrap( void *arg )
0649 {
0650   RtemsTimerReqCancel_Context *ctx;
0651 
0652   ctx = arg;
0653   ctx->Map.in_action_loop = false;
0654   RtemsTimerReqCancel_Teardown( ctx );
0655 }
0656 
0657 static void RtemsTimerReqCancel_Prepare( RtemsTimerReqCancel_Context *ctx )
0658 {
0659   rtems_status_code status;
0660   status = rtems_timer_create(
0661     rtems_build_name( 'T', 'I', 'M', 'E' ),
0662     &ctx->timer_id
0663   );
0664   T_rsc_success( status );
0665 
0666   ctx->invocations = 0;
0667   T_rsc_success( rtems_clock_set( &tod_now ) );
0668 }
0669 
0670 static void RtemsTimerReqCancel_Action( RtemsTimerReqCancel_Context *ctx )
0671 {
0672   ctx->pre_class = GetTimerClass( ctx->timer_id );
0673   ctx->status = rtems_timer_cancel( ctx->id_param );
0674   ctx->post_state = GetTimerState( ctx->timer_id );
0675   /* Ignoring return status: the timer server task may be suspended or not. */
0676   rtems_task_resume( GetTimerServerTaskId() );
0677 }
0678 
0679 static void RtemsTimerReqCancel_Cleanup( RtemsTimerReqCancel_Context *ctx )
0680 {
0681   T_rsc_success( rtems_timer_delete( ctx->timer_id ) );
0682 }
0683 
0684 static const RtemsTimerReqCancel_Entry
0685 RtemsTimerReqCancel_Entries[] = {
0686   { 1, 0, 0, 0, 0, RtemsTimerReqCancel_Post_Status_NA,
0687     RtemsTimerReqCancel_Post_Context_NA, RtemsTimerReqCancel_Post_Clock_NA,
0688     RtemsTimerReqCancel_Post_State_NA },
0689   { 0, 0, 0, 0, 0, RtemsTimerReqCancel_Post_Status_InvId,
0690     RtemsTimerReqCancel_Post_Context_Nop, RtemsTimerReqCancel_Post_Clock_Nop,
0691     RtemsTimerReqCancel_Post_State_Nop },
0692   { 0, 0, 0, 0, 0, RtemsTimerReqCancel_Post_Status_Ok,
0693     RtemsTimerReqCancel_Post_Context_Server,
0694     RtemsTimerReqCancel_Post_Clock_Ticks,
0695     RtemsTimerReqCancel_Post_State_Inactive },
0696   { 0, 0, 0, 0, 0, RtemsTimerReqCancel_Post_Status_Ok,
0697     RtemsTimerReqCancel_Post_Context_Server,
0698     RtemsTimerReqCancel_Post_Clock_Realtime,
0699     RtemsTimerReqCancel_Post_State_Inactive },
0700   { 0, 0, 0, 0, 0, RtemsTimerReqCancel_Post_Status_Ok,
0701     RtemsTimerReqCancel_Post_Context_Interrupt,
0702     RtemsTimerReqCancel_Post_Clock_Ticks,
0703     RtemsTimerReqCancel_Post_State_Inactive },
0704   { 0, 0, 0, 0, 0, RtemsTimerReqCancel_Post_Status_Ok,
0705     RtemsTimerReqCancel_Post_Context_Interrupt,
0706     RtemsTimerReqCancel_Post_Clock_Realtime,
0707     RtemsTimerReqCancel_Post_State_Inactive },
0708   { 0, 0, 0, 0, 0, RtemsTimerReqCancel_Post_Status_Ok,
0709     RtemsTimerReqCancel_Post_Context_None, RtemsTimerReqCancel_Post_Clock_None,
0710     RtemsTimerReqCancel_Post_State_Inactive }
0711 };
0712 
0713 static const uint8_t
0714 RtemsTimerReqCancel_Map[] = {
0715   6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 0, 5, 5, 0, 0, 0, 0, 2, 2, 2, 3, 3,
0716   3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1,
0717   1, 1
0718 };
0719 
0720 static size_t RtemsTimerReqCancel_Scope( void *arg, char *buf, size_t n )
0721 {
0722   RtemsTimerReqCancel_Context *ctx;
0723 
0724   ctx = arg;
0725 
0726   if ( ctx->Map.in_action_loop ) {
0727     return T_get_scope( RtemsTimerReqCancel_PreDesc, buf, n, ctx->Map.pcs );
0728   }
0729 
0730   return 0;
0731 }
0732 
0733 static T_fixture RtemsTimerReqCancel_Fixture = {
0734   .setup = RtemsTimerReqCancel_Setup_Wrap,
0735   .stop = NULL,
0736   .teardown = RtemsTimerReqCancel_Teardown_Wrap,
0737   .scope = RtemsTimerReqCancel_Scope,
0738   .initial_context = &RtemsTimerReqCancel_Instance
0739 };
0740 
0741 static inline RtemsTimerReqCancel_Entry RtemsTimerReqCancel_PopEntry(
0742   RtemsTimerReqCancel_Context *ctx
0743 )
0744 {
0745   size_t index;
0746 
0747   index = ctx->Map.index;
0748   ctx->Map.index = index + 1;
0749   return RtemsTimerReqCancel_Entries[
0750     RtemsTimerReqCancel_Map[ index ]
0751   ];
0752 }
0753 
0754 static void RtemsTimerReqCancel_TestVariant( RtemsTimerReqCancel_Context *ctx )
0755 {
0756   RtemsTimerReqCancel_Pre_Id_Prepare( ctx, ctx->Map.pcs[ 0 ] );
0757   RtemsTimerReqCancel_Pre_Context_Prepare( ctx, ctx->Map.pcs[ 1 ] );
0758   RtemsTimerReqCancel_Pre_Clock_Prepare( ctx, ctx->Map.pcs[ 2 ] );
0759   RtemsTimerReqCancel_Pre_State_Prepare( ctx, ctx->Map.pcs[ 3 ] );
0760   RtemsTimerReqCancel_Action( ctx );
0761   RtemsTimerReqCancel_Post_Status_Check( ctx, ctx->Map.entry.Post_Status );
0762   RtemsTimerReqCancel_Post_Context_Check( ctx, ctx->Map.entry.Post_Context );
0763   RtemsTimerReqCancel_Post_Clock_Check( ctx, ctx->Map.entry.Post_Clock );
0764   RtemsTimerReqCancel_Post_State_Check( ctx, ctx->Map.entry.Post_State );
0765 }
0766 
0767 /**
0768  * @fn void T_case_body_RtemsTimerReqCancel( void )
0769  */
0770 T_TEST_CASE_FIXTURE( RtemsTimerReqCancel, &RtemsTimerReqCancel_Fixture )
0771 {
0772   RtemsTimerReqCancel_Context *ctx;
0773 
0774   ctx = T_fixture_context();
0775   ctx->Map.in_action_loop = true;
0776   ctx->Map.index = 0;
0777 
0778   for (
0779     ctx->Map.pcs[ 0 ] = RtemsTimerReqCancel_Pre_Id_Valid;
0780     ctx->Map.pcs[ 0 ] < RtemsTimerReqCancel_Pre_Id_NA;
0781     ++ctx->Map.pcs[ 0 ]
0782   ) {
0783     for (
0784       ctx->Map.pcs[ 1 ] = RtemsTimerReqCancel_Pre_Context_None;
0785       ctx->Map.pcs[ 1 ] < RtemsTimerReqCancel_Pre_Context_NA;
0786       ++ctx->Map.pcs[ 1 ]
0787     ) {
0788       for (
0789         ctx->Map.pcs[ 2 ] = RtemsTimerReqCancel_Pre_Clock_None;
0790         ctx->Map.pcs[ 2 ] < RtemsTimerReqCancel_Pre_Clock_NA;
0791         ++ctx->Map.pcs[ 2 ]
0792       ) {
0793         for (
0794           ctx->Map.pcs[ 3 ] = RtemsTimerReqCancel_Pre_State_Inactive;
0795           ctx->Map.pcs[ 3 ] < RtemsTimerReqCancel_Pre_State_NA;
0796           ++ctx->Map.pcs[ 3 ]
0797         ) {
0798           ctx->Map.entry = RtemsTimerReqCancel_PopEntry( ctx );
0799 
0800           if ( ctx->Map.entry.Skip ) {
0801             continue;
0802           }
0803 
0804           RtemsTimerReqCancel_Prepare( ctx );
0805           RtemsTimerReqCancel_TestVariant( ctx );
0806           RtemsTimerReqCancel_Cleanup( ctx );
0807         }
0808       }
0809     }
0810   }
0811 }
0812 
0813 /** @} */