Back to home page

LXR

 
 

    


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

0001 /* SPDX-License-Identifier: BSD-2-Clause */
0002 
0003 /**
0004  * @file
0005  *
0006  * @ingroup RtemsIntrReqEntryInstall
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 <bsp/irq-generic.h>
0056 #include <rtems/irq-extension.h>
0057 
0058 #include "tx-support.h"
0059 
0060 #include <rtems/test.h>
0061 
0062 /**
0063  * @defgroup RtemsIntrReqEntryInstall spec:/rtems/intr/req/entry-install
0064  *
0065  * @ingroup TestsuitesValidationIntr
0066  *
0067  * @{
0068  */
0069 
0070 typedef enum {
0071   RtemsIntrReqEntryInstall_Pre_Vector_Valid,
0072   RtemsIntrReqEntryInstall_Pre_Vector_Invalid,
0073   RtemsIntrReqEntryInstall_Pre_Vector_NA
0074 } RtemsIntrReqEntryInstall_Pre_Vector;
0075 
0076 typedef enum {
0077   RtemsIntrReqEntryInstall_Pre_Options_Unique,
0078   RtemsIntrReqEntryInstall_Pre_Options_Shared,
0079   RtemsIntrReqEntryInstall_Pre_Options_Replace,
0080   RtemsIntrReqEntryInstall_Pre_Options_NA
0081 } RtemsIntrReqEntryInstall_Pre_Options;
0082 
0083 typedef enum {
0084   RtemsIntrReqEntryInstall_Pre_Entry_Obj,
0085   RtemsIntrReqEntryInstall_Pre_Entry_Null,
0086   RtemsIntrReqEntryInstall_Pre_Entry_NA
0087 } RtemsIntrReqEntryInstall_Pre_Entry;
0088 
0089 typedef enum {
0090   RtemsIntrReqEntryInstall_Pre_Routine_Valid,
0091   RtemsIntrReqEntryInstall_Pre_Routine_Null,
0092   RtemsIntrReqEntryInstall_Pre_Routine_NA
0093 } RtemsIntrReqEntryInstall_Pre_Routine;
0094 
0095 typedef enum {
0096   RtemsIntrReqEntryInstall_Pre_Init_Yes,
0097   RtemsIntrReqEntryInstall_Pre_Init_No,
0098   RtemsIntrReqEntryInstall_Pre_Init_NA
0099 } RtemsIntrReqEntryInstall_Pre_Init;
0100 
0101 typedef enum {
0102   RtemsIntrReqEntryInstall_Pre_ISR_Yes,
0103   RtemsIntrReqEntryInstall_Pre_ISR_No,
0104   RtemsIntrReqEntryInstall_Pre_ISR_NA
0105 } RtemsIntrReqEntryInstall_Pre_ISR;
0106 
0107 typedef enum {
0108   RtemsIntrReqEntryInstall_Pre_CanEnable_Yes,
0109   RtemsIntrReqEntryInstall_Pre_CanEnable_Maybe,
0110   RtemsIntrReqEntryInstall_Pre_CanEnable_No,
0111   RtemsIntrReqEntryInstall_Pre_CanEnable_NA
0112 } RtemsIntrReqEntryInstall_Pre_CanEnable;
0113 
0114 typedef enum {
0115   RtemsIntrReqEntryInstall_Pre_Installed_None,
0116   RtemsIntrReqEntryInstall_Pre_Installed_Unique,
0117   RtemsIntrReqEntryInstall_Pre_Installed_Other,
0118   RtemsIntrReqEntryInstall_Pre_Installed_EqRoutine,
0119   RtemsIntrReqEntryInstall_Pre_Installed_EqArg,
0120   RtemsIntrReqEntryInstall_Pre_Installed_Match,
0121   RtemsIntrReqEntryInstall_Pre_Installed_NA
0122 } RtemsIntrReqEntryInstall_Pre_Installed;
0123 
0124 typedef enum {
0125   RtemsIntrReqEntryInstall_Post_Status_Ok,
0126   RtemsIntrReqEntryInstall_Post_Status_InvAddr,
0127   RtemsIntrReqEntryInstall_Post_Status_IncStat,
0128   RtemsIntrReqEntryInstall_Post_Status_InvId,
0129   RtemsIntrReqEntryInstall_Post_Status_InvNum,
0130   RtemsIntrReqEntryInstall_Post_Status_CalledFromISR,
0131   RtemsIntrReqEntryInstall_Post_Status_InUse,
0132   RtemsIntrReqEntryInstall_Post_Status_TooMany,
0133   RtemsIntrReqEntryInstall_Post_Status_NA
0134 } RtemsIntrReqEntryInstall_Post_Status;
0135 
0136 typedef enum {
0137   RtemsIntrReqEntryInstall_Post_Enable_Nop,
0138   RtemsIntrReqEntryInstall_Post_Enable_Yes,
0139   RtemsIntrReqEntryInstall_Post_Enable_Maybe,
0140   RtemsIntrReqEntryInstall_Post_Enable_No,
0141   RtemsIntrReqEntryInstall_Post_Enable_NA
0142 } RtemsIntrReqEntryInstall_Post_Enable;
0143 
0144 typedef enum {
0145   RtemsIntrReqEntryInstall_Post_Installed_No,
0146   RtemsIntrReqEntryInstall_Post_Installed_Last,
0147   RtemsIntrReqEntryInstall_Post_Installed_NA
0148 } RtemsIntrReqEntryInstall_Post_Installed;
0149 
0150 typedef struct {
0151   uint32_t Skip : 1;
0152   uint32_t Pre_Vector_NA : 1;
0153   uint32_t Pre_Options_NA : 1;
0154   uint32_t Pre_Entry_NA : 1;
0155   uint32_t Pre_Routine_NA : 1;
0156   uint32_t Pre_Init_NA : 1;
0157   uint32_t Pre_ISR_NA : 1;
0158   uint32_t Pre_CanEnable_NA : 1;
0159   uint32_t Pre_Installed_NA : 1;
0160   uint32_t Post_Status : 4;
0161   uint32_t Post_Enable : 3;
0162   uint32_t Post_Installed : 2;
0163 } RtemsIntrReqEntryInstall_Entry;
0164 
0165 /**
0166  * @brief Test context for spec:/rtems/intr/req/entry-install test case.
0167  */
0168 typedef struct {
0169   /**
0170    * @brief If this member is true, then the service was initialized during
0171    *   setup.
0172    */
0173   bool initialized_during_setup;
0174 
0175   /**
0176    * @brief This member provides a counter for handler invocations.
0177    */
0178   uint32_t handler_counter;
0179 
0180   /**
0181    * @brief This member provides a counter snapshot for each entry.
0182    */
0183   uint32_t counter_by_entry[ 3 ];
0184 
0185   /**
0186    * @brief This member provides the vector number of a testable interrupt
0187    *   vector.
0188    */
0189   rtems_vector_number test_vector;
0190 
0191   /**
0192    * @brief If this member is true, then the testable interrupt vector was
0193    *   enabled at the test case begin.
0194    */
0195   bool test_vector_was_enabled;
0196 
0197   /**
0198    * @brief This member provides the attributes of the testable interrupt
0199    *   vector.
0200    */
0201   rtems_interrupt_attributes attributes;
0202 
0203   /**
0204    * @brief If this member is true, then the service shall be initialized.
0205    */
0206   bool initialized;
0207 
0208   /**
0209    * @brief If this member is true, then rtems_interrupt_entry_install() shall
0210    *   be called from within interrupt context.
0211    */
0212   bool isr;
0213 
0214   /**
0215    * @brief This member contains the enabled status before the
0216    *   rtems_interrupt_entry_install() call.
0217    */
0218   bool enabled_before;
0219 
0220   /**
0221    * @brief This member contains the enabled status after the
0222    *   rtems_interrupt_entry_install() call.
0223    */
0224   bool enabled_after;
0225 
0226   /**
0227    * @brief This member provides the count of visited entries.
0228    */
0229   uint32_t visited_entries;
0230 
0231   /**
0232    * @brief This member provides another rtems_interrupt_entry object.
0233    */
0234   rtems_interrupt_entry other_entry;
0235 
0236   /**
0237    * @brief If this member is true, then another entry was installed.
0238    */
0239   bool other_installed;
0240 
0241   /**
0242    * @brief This member provides a third rtems_interrupt_entry object.
0243    */
0244   rtems_interrupt_entry third_entry;
0245 
0246   /**
0247    * @brief If this member is true, then the third entry was installed.
0248    */
0249   bool third_installed;
0250 
0251   /**
0252    * @brief This member provides the options used to install the other
0253    *   rtems_interrupt_entry object.
0254    */
0255   rtems_option other_options;
0256 
0257   /**
0258    * @brief This member provides the rtems_interrupt_entry object.
0259    */
0260   rtems_interrupt_entry entry_obj;
0261 
0262   /**
0263    * @brief This member specifies if the ``vector`` parameter value.
0264    */
0265   rtems_vector_number vector;
0266 
0267   /**
0268    * @brief This member specifies if the ``options`` parameter value.
0269    */
0270   rtems_option options;
0271 
0272   /**
0273    * @brief This member specifies if the ``entry`` parameter value.
0274    */
0275   rtems_interrupt_entry *entry;
0276 
0277   /**
0278    * @brief This member contains the return value of the
0279    *   rtems_interrupt_entry_install() call.
0280    */
0281   rtems_status_code status;
0282 
0283   struct {
0284     /**
0285      * @brief This member defines the pre-condition indices for the next
0286      *   action.
0287      */
0288     size_t pci[ 8 ];
0289 
0290     /**
0291      * @brief This member defines the pre-condition states for the next action.
0292      */
0293     size_t pcs[ 8 ];
0294 
0295     /**
0296      * @brief If this member is true, then the test action loop is executed.
0297      */
0298     bool in_action_loop;
0299 
0300     /**
0301      * @brief This member contains the next transition map index.
0302      */
0303     size_t index;
0304 
0305     /**
0306      * @brief This member contains the current transition map entry.
0307      */
0308     RtemsIntrReqEntryInstall_Entry entry;
0309 
0310     /**
0311      * @brief If this member is true, then the current transition variant
0312      *   should be skipped.
0313      */
0314     bool skip;
0315   } Map;
0316 } RtemsIntrReqEntryInstall_Context;
0317 
0318 static RtemsIntrReqEntryInstall_Context
0319   RtemsIntrReqEntryInstall_Instance;
0320 
0321 static const char * const RtemsIntrReqEntryInstall_PreDesc_Vector[] = {
0322   "Valid",
0323   "Invalid",
0324   "NA"
0325 };
0326 
0327 static const char * const RtemsIntrReqEntryInstall_PreDesc_Options[] = {
0328   "Unique",
0329   "Shared",
0330   "Replace",
0331   "NA"
0332 };
0333 
0334 static const char * const RtemsIntrReqEntryInstall_PreDesc_Entry[] = {
0335   "Obj",
0336   "Null",
0337   "NA"
0338 };
0339 
0340 static const char * const RtemsIntrReqEntryInstall_PreDesc_Routine[] = {
0341   "Valid",
0342   "Null",
0343   "NA"
0344 };
0345 
0346 static const char * const RtemsIntrReqEntryInstall_PreDesc_Init[] = {
0347   "Yes",
0348   "No",
0349   "NA"
0350 };
0351 
0352 static const char * const RtemsIntrReqEntryInstall_PreDesc_ISR[] = {
0353   "Yes",
0354   "No",
0355   "NA"
0356 };
0357 
0358 static const char * const RtemsIntrReqEntryInstall_PreDesc_CanEnable[] = {
0359   "Yes",
0360   "Maybe",
0361   "No",
0362   "NA"
0363 };
0364 
0365 static const char * const RtemsIntrReqEntryInstall_PreDesc_Installed[] = {
0366   "None",
0367   "Unique",
0368   "Other",
0369   "EqRoutine",
0370   "EqArg",
0371   "Match",
0372   "NA"
0373 };
0374 
0375 static const char * const * const RtemsIntrReqEntryInstall_PreDesc[] = {
0376   RtemsIntrReqEntryInstall_PreDesc_Vector,
0377   RtemsIntrReqEntryInstall_PreDesc_Options,
0378   RtemsIntrReqEntryInstall_PreDesc_Entry,
0379   RtemsIntrReqEntryInstall_PreDesc_Routine,
0380   RtemsIntrReqEntryInstall_PreDesc_Init,
0381   RtemsIntrReqEntryInstall_PreDesc_ISR,
0382   RtemsIntrReqEntryInstall_PreDesc_CanEnable,
0383   RtemsIntrReqEntryInstall_PreDesc_Installed,
0384   NULL
0385 };
0386 
0387 typedef RtemsIntrReqEntryInstall_Context Context;
0388 
0389 static char entry_arg;
0390 
0391 static char other_arg;
0392 
0393 static char third_arg;
0394 
0395 static const char entry_info[] = "Entry";
0396 
0397 static const char other_info[] = "Other";
0398 
0399 static const char third_info[] = "Third";
0400 
0401 static void Install(
0402   Context                *ctx,
0403   rtems_option            options,
0404   rtems_interrupt_handler routine,
0405   void                   *arg
0406 )
0407 {
0408   rtems_status_code sc;
0409 
0410   ctx->other_options = options;
0411   rtems_interrupt_entry_initialize(
0412     &ctx->other_entry,
0413     routine,
0414     arg,
0415     other_info
0416   );
0417 
0418   sc = rtems_interrupt_entry_install(
0419     ctx->test_vector,
0420     options,
0421     &ctx->other_entry
0422   );
0423   T_rsc_success( sc );
0424 
0425   ctx->other_installed = true;
0426 }
0427 
0428 static void Routine( Context *ctx, uint32_t counter )
0429 {
0430   rtems_status_code sc;
0431 
0432   ctx->handler_counter = counter;
0433 
0434   if ( !ctx->attributes.cleared_by_acknowledge ) {
0435     sc = ClearSoftwareInterrupt( ctx->test_vector );
0436     T_rsc_success( sc );
0437   }
0438 
0439   if ( counter > 3 ) {
0440     sc = rtems_interrupt_vector_disable( ctx->test_vector );
0441     T_rsc_success( sc );
0442   }
0443 }
0444 
0445 static void EntryRoutine( void *arg )
0446 {
0447   Context *ctx;
0448   uint32_t counter;
0449 
0450   ctx = T_fixture_context();
0451   counter = ctx->handler_counter + 1;
0452 
0453   if ( arg == &other_arg ) {
0454     ctx->counter_by_entry[ 1 ] = counter;
0455   } else {
0456     ctx->counter_by_entry[ 0 ] = counter;
0457     T_eq_ptr( arg, &entry_arg );
0458   }
0459 
0460   Routine( ctx, counter );
0461 }
0462 
0463 static void OtherRoutine( void *arg )
0464 {
0465   Context *ctx;
0466   uint32_t counter;
0467 
0468   (void) arg;
0469   ctx = T_fixture_context();
0470   counter = ctx->handler_counter + 1;
0471   ctx->counter_by_entry[ 1 ] = counter;
0472   Routine( ctx, counter );
0473 }
0474 
0475 static void ThirdRoutine( void *arg )
0476 {
0477   Context *ctx;
0478   uint32_t counter;
0479 
0480   ctx = T_fixture_context();
0481   counter = ctx->handler_counter + 1;
0482   ctx->counter_by_entry[ 2 ] = counter;
0483   T_eq_ptr( arg, &third_arg );
0484   Routine( ctx, counter );
0485 }
0486 
0487 static void InstallThird( Context *ctx )
0488 {
0489   rtems_status_code sc;
0490 
0491   rtems_interrupt_entry_initialize(
0492     &ctx->third_entry,
0493     ThirdRoutine,
0494     &third_arg,
0495     third_info
0496   );
0497 
0498   sc = rtems_interrupt_entry_install(
0499     ctx->test_vector,
0500     RTEMS_INTERRUPT_SHARED,
0501     &ctx->third_entry
0502   );
0503   T_rsc_success( sc );
0504 
0505   ctx->third_installed = true;
0506 }
0507 
0508 static void Action( void *arg )
0509 {
0510   Context          *ctx;
0511   rtems_status_code sc;
0512 
0513   ctx = arg;
0514 
0515   sc = rtems_interrupt_vector_is_enabled(
0516     ctx->test_vector,
0517     &ctx->enabled_before
0518   );
0519   T_rsc_success( sc );
0520 
0521   bsp_interrupt_set_handler_unique(
0522     BSP_INTERRUPT_DISPATCH_TABLE_SIZE,
0523     ctx->initialized
0524   );
0525 
0526   ctx->status = rtems_interrupt_entry_install(
0527     ctx->vector,
0528     ctx->options,
0529     ctx->entry
0530   );
0531 
0532   bsp_interrupt_set_handler_unique(
0533     BSP_INTERRUPT_DISPATCH_TABLE_SIZE,
0534     ctx->initialized_during_setup
0535   );
0536 
0537   sc = rtems_interrupt_vector_is_enabled(
0538     ctx->test_vector,
0539     &ctx->enabled_after
0540   );
0541   T_rsc_success( sc );
0542 
0543   if ( ctx->status == RTEMS_SUCCESSFUL ) {
0544     sc = RaiseSoftwareInterrupt( ctx->test_vector );
0545     T_rsc_success( sc );
0546   }
0547 }
0548 
0549 static void VisitInstalled(
0550   void                   *arg,
0551   const char             *info,
0552   rtems_option            options,
0553   rtems_interrupt_handler handler_routine,
0554   void                   *handler_arg
0555 )
0556 {
0557   Context *ctx;
0558   uint32_t visited_entries;
0559 
0560   ctx = arg;
0561   visited_entries = ctx->visited_entries;
0562 
0563   if ( visited_entries == 0 && ctx->other_installed ) {
0564     T_eq_ptr( info, other_info );
0565     T_eq_u32( options, ctx->other_options );
0566     T_eq_ptr( handler_routine, ctx->other_entry.handler );
0567     T_eq_ptr( handler_arg, ctx->other_entry.arg );
0568   } else if ( visited_entries == 1 && ctx->third_installed ) {
0569     T_eq_ptr( info, third_info );
0570     T_eq_u32( options, RTEMS_INTERRUPT_SHARED );
0571     T_eq_ptr( handler_routine, ThirdRoutine );
0572     T_eq_ptr( handler_arg, &third_arg );
0573   } else {
0574     T_eq_ptr( info, entry_info );
0575     T_eq_u32( options, ctx->options );
0576     T_eq_ptr( handler_routine, ctx->entry_obj.handler );
0577     T_eq_ptr( handler_arg, ctx->entry_obj.arg );
0578   }
0579 
0580   ctx->visited_entries = visited_entries + 1;
0581 }
0582 
0583 static void RtemsIntrReqEntryInstall_Pre_Vector_Prepare(
0584   RtemsIntrReqEntryInstall_Context   *ctx,
0585   RtemsIntrReqEntryInstall_Pre_Vector state
0586 )
0587 {
0588   switch ( state ) {
0589     case RtemsIntrReqEntryInstall_Pre_Vector_Valid: {
0590       /*
0591        * While the ``vector`` parameter is associated with an interrupt vector.
0592        */
0593       ctx->vector = ctx->test_vector;
0594       break;
0595     }
0596 
0597     case RtemsIntrReqEntryInstall_Pre_Vector_Invalid: {
0598       /*
0599        * While the ``vector`` parameter is not associated with an interrupt
0600        * vector.
0601        */
0602       ctx->vector = BSP_INTERRUPT_VECTOR_COUNT;
0603       break;
0604     }
0605 
0606     case RtemsIntrReqEntryInstall_Pre_Vector_NA:
0607       break;
0608   }
0609 }
0610 
0611 static void RtemsIntrReqEntryInstall_Pre_Options_Prepare(
0612   RtemsIntrReqEntryInstall_Context    *ctx,
0613   RtemsIntrReqEntryInstall_Pre_Options state
0614 )
0615 {
0616   switch ( state ) {
0617     case RtemsIntrReqEntryInstall_Pre_Options_Unique: {
0618       /*
0619        * While the ``options`` indicates that an unique entry shall be
0620        * installed.
0621        */
0622       ctx->options = RTEMS_INTERRUPT_UNIQUE;
0623       break;
0624     }
0625 
0626     case RtemsIntrReqEntryInstall_Pre_Options_Shared: {
0627       /*
0628        * While the ``options`` indicates that a shared entry shall be
0629        * installed.
0630        */
0631       ctx->options = RTEMS_INTERRUPT_SHARED;
0632       break;
0633     }
0634 
0635     case RtemsIntrReqEntryInstall_Pre_Options_Replace: {
0636       /*
0637        * While the ``options`` indicates that the entry handler routine shall
0638        * be replaced.
0639        */
0640       ctx->options = RTEMS_INTERRUPT_REPLACE;
0641       break;
0642     }
0643 
0644     case RtemsIntrReqEntryInstall_Pre_Options_NA:
0645       break;
0646   }
0647 }
0648 
0649 static void RtemsIntrReqEntryInstall_Pre_Entry_Prepare(
0650   RtemsIntrReqEntryInstall_Context  *ctx,
0651   RtemsIntrReqEntryInstall_Pre_Entry state
0652 )
0653 {
0654   switch ( state ) {
0655     case RtemsIntrReqEntryInstall_Pre_Entry_Obj: {
0656       /*
0657        * While the ``entry`` parameter references an object of type
0658        * rtems_interrupt_entry.
0659        */
0660       ctx->entry = &ctx->entry_obj;
0661       break;
0662     }
0663 
0664     case RtemsIntrReqEntryInstall_Pre_Entry_Null: {
0665       /*
0666        * While the ``entry`` parameter is equal to NULL.
0667        */
0668       ctx->entry = NULL;
0669       break;
0670     }
0671 
0672     case RtemsIntrReqEntryInstall_Pre_Entry_NA:
0673       break;
0674   }
0675 }
0676 
0677 static void RtemsIntrReqEntryInstall_Pre_Routine_Prepare(
0678   RtemsIntrReqEntryInstall_Context    *ctx,
0679   RtemsIntrReqEntryInstall_Pre_Routine state
0680 )
0681 {
0682   switch ( state ) {
0683     case RtemsIntrReqEntryInstall_Pre_Routine_Valid: {
0684       /*
0685        * While the handler routine of the object referenced by the ``entry``
0686        * parameter is valid.
0687        */
0688       rtems_interrupt_entry_initialize(
0689         &ctx->entry_obj,
0690         EntryRoutine,
0691         &entry_arg,
0692         entry_info
0693       );
0694       break;
0695     }
0696 
0697     case RtemsIntrReqEntryInstall_Pre_Routine_Null: {
0698       /*
0699        * While the handler routine of the object referenced by the ``entry``
0700        * parameter is equal to NULL.
0701        */
0702       rtems_interrupt_entry_initialize(
0703         &ctx->entry_obj,
0704         NULL,
0705         &entry_arg,
0706         entry_info
0707       );
0708       break;
0709     }
0710 
0711     case RtemsIntrReqEntryInstall_Pre_Routine_NA:
0712       break;
0713   }
0714 }
0715 
0716 static void RtemsIntrReqEntryInstall_Pre_Init_Prepare(
0717   RtemsIntrReqEntryInstall_Context *ctx,
0718   RtemsIntrReqEntryInstall_Pre_Init state
0719 )
0720 {
0721   switch ( state ) {
0722     case RtemsIntrReqEntryInstall_Pre_Init_Yes: {
0723       /*
0724        * While the service is initialized.
0725        */
0726       ctx->initialized = true;
0727       break;
0728     }
0729 
0730     case RtemsIntrReqEntryInstall_Pre_Init_No: {
0731       /*
0732        * While the service is not initialized.
0733        */
0734       ctx->initialized = false;
0735       break;
0736     }
0737 
0738     case RtemsIntrReqEntryInstall_Pre_Init_NA:
0739       break;
0740   }
0741 }
0742 
0743 static void RtemsIntrReqEntryInstall_Pre_ISR_Prepare(
0744   RtemsIntrReqEntryInstall_Context *ctx,
0745   RtemsIntrReqEntryInstall_Pre_ISR  state
0746 )
0747 {
0748   switch ( state ) {
0749     case RtemsIntrReqEntryInstall_Pre_ISR_Yes: {
0750       /*
0751        * While rtems_interrupt_entry_install() is called from within interrupt
0752        * context.
0753        */
0754       ctx->isr = true;
0755       break;
0756     }
0757 
0758     case RtemsIntrReqEntryInstall_Pre_ISR_No: {
0759       /*
0760        * While rtems_interrupt_entry_install() is not called from within
0761        * interrupt context.
0762        */
0763       ctx->isr = false;
0764       break;
0765     }
0766 
0767     case RtemsIntrReqEntryInstall_Pre_ISR_NA:
0768       break;
0769   }
0770 }
0771 
0772 static void RtemsIntrReqEntryInstall_Pre_CanEnable_Prepare(
0773   RtemsIntrReqEntryInstall_Context      *ctx,
0774   RtemsIntrReqEntryInstall_Pre_CanEnable state
0775 )
0776 {
0777   switch ( state ) {
0778     case RtemsIntrReqEntryInstall_Pre_CanEnable_Yes: {
0779       /*
0780        * While the interrupt vector associated with the ``vector`` parameter
0781        * can be enabled.
0782        */
0783       /*
0784        * This pre-condition depends on the attributes of an interrupt vector.
0785        * For the validation test of rtems_interrupt_entry_install() a testable
0786        * interrupt vector is determined by GetTestableInterruptVector().  The
0787        * implementation of rtems_interrupt_entry_install() uses
0788        * rtems_interrupt_vector_enable() which is validated separately in detail.
0789        */
0790       break;
0791     }
0792 
0793     case RtemsIntrReqEntryInstall_Pre_CanEnable_Maybe: {
0794       /*
0795        * While the interrupt vector associated with the ``vector`` parameter
0796        * may be enabled.
0797        */
0798       /* See comment for ``Yes`` state */
0799       break;
0800     }
0801 
0802     case RtemsIntrReqEntryInstall_Pre_CanEnable_No: {
0803       /*
0804        * While the interrupt vector associated with the ``vector`` parameter
0805        * cannot be enabled.
0806        */
0807       /* See comment for ``Yes`` state */
0808       break;
0809     }
0810 
0811     case RtemsIntrReqEntryInstall_Pre_CanEnable_NA:
0812       break;
0813   }
0814 }
0815 
0816 static void RtemsIntrReqEntryInstall_Pre_Installed_Prepare(
0817   RtemsIntrReqEntryInstall_Context      *ctx,
0818   RtemsIntrReqEntryInstall_Pre_Installed state
0819 )
0820 {
0821   switch ( state ) {
0822     case RtemsIntrReqEntryInstall_Pre_Installed_None: {
0823       /*
0824        * While the no entry is installed at the interrupt vector specified by
0825        * the ``vector`` parameter.
0826        */
0827       /* Nothing to do */
0828       break;
0829     }
0830 
0831     case RtemsIntrReqEntryInstall_Pre_Installed_Unique: {
0832       /*
0833        * While a unique entry is installed at the interrupt vector specified by
0834        * the ``vector`` parameter.
0835        */
0836       Install( ctx, RTEMS_INTERRUPT_UNIQUE, EntryRoutine, &entry_arg );
0837       break;
0838     }
0839 
0840     case RtemsIntrReqEntryInstall_Pre_Installed_Other: {
0841       /*
0842        * While at least one non-unique entry is installed at the interrupt
0843        * vector specified by the ``vector`` parameter, while all entries
0844        * installed at the interrupt vector specified by the ``vector``
0845        * parameter have a handler routine which is not equal to the handler
0846        * routine of the object referenced by the ``entry`` parameter, while all
0847        * entries installed at the interrupt vector specified by the ``vector``
0848        * parameter have a handler argument which is not equal to the handler
0849        * argument of the object referenced by the ``entry`` parameter.
0850        */
0851       Install( ctx, RTEMS_INTERRUPT_SHARED, OtherRoutine, &other_arg );
0852       InstallThird( ctx );
0853       break;
0854     }
0855 
0856     case RtemsIntrReqEntryInstall_Pre_Installed_EqRoutine: {
0857       /*
0858        * While at least one non-unique entry is installed at the interrupt
0859        * vector specified by the ``vector`` parameter, while at least one entry
0860        * installed at the interrupt vector specified by the ``vector``
0861        * parameter has a handler routine which is equal to the handler routine
0862        * of the object referenced by the ``entry`` parameter, while all entries
0863        * installed at the interrupt vector specified by the ``vector``
0864        * parameter have a handler argument which is not equal to the handler
0865        * argument of the object referenced by the ``entry`` parameter.
0866        */
0867       Install( ctx, RTEMS_INTERRUPT_SHARED, EntryRoutine, &other_arg );
0868       break;
0869     }
0870 
0871     case RtemsIntrReqEntryInstall_Pre_Installed_EqArg: {
0872       /*
0873        * While at least one non-unique entry is installed at the interrupt
0874        * vector specified by the ``vector`` parameter, while all entries
0875        * installed at the interrupt vector specified by the ``vector``
0876        * parameter have a handler routine which is not equal to the handler
0877        * routine of the object referenced by the ``entry`` parameter, while at
0878        * least one entry installed at the interrupt vector specified by the
0879        * ``vector`` parameter has a handler argument which is equal to the
0880        * handler argument of the object referenced by the ``entry`` parameter.
0881        */
0882       Install( ctx, RTEMS_INTERRUPT_SHARED, OtherRoutine, &other_arg );
0883       break;
0884     }
0885 
0886     case RtemsIntrReqEntryInstall_Pre_Installed_Match: {
0887       /*
0888        * While at least one non-unique entry with a handler routine which is
0889        * equal to the handler routine of the object referenced by the ``entry``
0890        * parameter and with a handler argument which is equal to the handler
0891        * argument of the object referenced by the ``entry`` parameter is
0892        * installed at the interrupt vector specified by the ``vector``
0893        * parameter.
0894        */
0895       Install( ctx, RTEMS_INTERRUPT_SHARED, EntryRoutine, &entry_arg );
0896       break;
0897     }
0898 
0899     case RtemsIntrReqEntryInstall_Pre_Installed_NA:
0900       break;
0901   }
0902 }
0903 
0904 static void RtemsIntrReqEntryInstall_Post_Status_Check(
0905   RtemsIntrReqEntryInstall_Context    *ctx,
0906   RtemsIntrReqEntryInstall_Post_Status state
0907 )
0908 {
0909   switch ( state ) {
0910     case RtemsIntrReqEntryInstall_Post_Status_Ok: {
0911       /*
0912        * The return status of rtems_interrupt_entry_install() shall be
0913        * RTEMS_SUCCESSFUL.
0914        */
0915       T_rsc_success( ctx->status );
0916       break;
0917     }
0918 
0919     case RtemsIntrReqEntryInstall_Post_Status_InvAddr: {
0920       /*
0921        * The return status of rtems_interrupt_entry_install() shall be
0922        * RTEMS_INVALID_ADDRESS.
0923        */
0924       T_rsc( ctx->status, RTEMS_INVALID_ADDRESS );
0925       break;
0926     }
0927 
0928     case RtemsIntrReqEntryInstall_Post_Status_IncStat: {
0929       /*
0930        * The return status of rtems_interrupt_entry_install() shall be
0931        * RTEMS_INCORRECT_STATE.
0932        */
0933       T_rsc( ctx->status, RTEMS_INCORRECT_STATE );
0934       break;
0935     }
0936 
0937     case RtemsIntrReqEntryInstall_Post_Status_InvId: {
0938       /*
0939        * The return status of rtems_interrupt_entry_install() shall be
0940        * RTEMS_INVALID_ID.
0941        */
0942       T_rsc( ctx->status, RTEMS_INVALID_ID );
0943       break;
0944     }
0945 
0946     case RtemsIntrReqEntryInstall_Post_Status_InvNum: {
0947       /*
0948        * The return status of rtems_interrupt_entry_install() shall be
0949        * RTEMS_INVALID_NUMBER.
0950        */
0951       T_rsc( ctx->status, RTEMS_INVALID_NUMBER );
0952       break;
0953     }
0954 
0955     case RtemsIntrReqEntryInstall_Post_Status_CalledFromISR: {
0956       /*
0957        * The return status of rtems_interrupt_entry_install() shall be
0958        * RTEMS_CALLED_FROM_ISR.
0959        */
0960       T_rsc( ctx->status, RTEMS_CALLED_FROM_ISR );
0961       break;
0962     }
0963 
0964     case RtemsIntrReqEntryInstall_Post_Status_InUse: {
0965       /*
0966        * The return status of rtems_interrupt_entry_install() shall be
0967        * RTEMS_RESOURCE_IN_USE.
0968        */
0969       T_rsc( ctx->status, RTEMS_RESOURCE_IN_USE  );
0970       break;
0971     }
0972 
0973     case RtemsIntrReqEntryInstall_Post_Status_TooMany: {
0974       /*
0975        * The return status of rtems_interrupt_entry_install() shall be
0976        * RTEMS_TOO_MANY.
0977        */
0978       T_rsc( ctx->status, RTEMS_TOO_MANY );
0979       break;
0980     }
0981 
0982     case RtemsIntrReqEntryInstall_Post_Status_NA:
0983       break;
0984   }
0985 }
0986 
0987 static void RtemsIntrReqEntryInstall_Post_Enable_Check(
0988   RtemsIntrReqEntryInstall_Context    *ctx,
0989   RtemsIntrReqEntryInstall_Post_Enable state
0990 )
0991 {
0992   switch ( state ) {
0993     case RtemsIntrReqEntryInstall_Post_Enable_Nop: {
0994       /*
0995        * The enabled status of the interrupt vector specified by ``vector``
0996        * shall not be modified by the rtems_interrupt_entry_install() call.
0997        */
0998       if ( ctx->handler_counter == 0 ) {
0999         T_eq( ctx->enabled_before, ctx->enabled_after );
1000       }
1001       break;
1002     }
1003 
1004     case RtemsIntrReqEntryInstall_Post_Enable_Yes: {
1005       /*
1006        * The interrupt vector specified by ``vector`` shall be enabled.
1007        */
1008       T_true( ctx->enabled_after || ctx->handler_counter > 3 );
1009       break;
1010     }
1011 
1012     case RtemsIntrReqEntryInstall_Post_Enable_Maybe: {
1013       /*
1014        * The interrupt vector specified by ``vector`` may be enabled.
1015        */
1016       /*
1017        * Interrupt vectors which cannot be enabled are not selected as a
1018        * testable interrupt vector by GetTestableInterruptVector(), so this
1019        * path is not validated by this test.  See also comment for
1020        * ``CanEnable`` pre-condition state ``Yes``.
1021        */
1022       T_true( ctx->enabled_after || ctx->handler_counter > 3 );
1023       break;
1024     }
1025 
1026     case RtemsIntrReqEntryInstall_Post_Enable_No: {
1027       /*
1028        * The interrupt vector specified by ``vector`` shall not be enabled.
1029        */
1030       /*
1031        * Interrupt vectors which cannot be enabled are not selected as a
1032        * testable interrupt vector by GetTestableInterruptVector(), so this
1033        * path is not validated by this test.  See also comment for
1034        * ``CanEnable`` pre-condition state ``Yes``.
1035        */
1036       T_true( ctx->enabled_after || ctx->handler_counter > 3 );
1037       break;
1038     }
1039 
1040     case RtemsIntrReqEntryInstall_Post_Enable_NA:
1041       break;
1042   }
1043 }
1044 
1045 static void RtemsIntrReqEntryInstall_Post_Installed_Check(
1046   RtemsIntrReqEntryInstall_Context       *ctx,
1047   RtemsIntrReqEntryInstall_Post_Installed state
1048 )
1049 {
1050   rtems_status_code sc;
1051 
1052   ctx->visited_entries = 0;
1053   sc = rtems_interrupt_handler_iterate(
1054     ctx->test_vector,
1055     VisitInstalled,
1056     ctx
1057   );
1058   T_rsc_success( sc );
1059 
1060   if ( ctx->status == RTEMS_SUCCESSFUL ) {
1061     uint32_t counter;
1062 
1063     counter = 1;
1064 
1065     if ( ctx->other_installed ) {
1066       T_eq_u32( ctx->counter_by_entry[ 1 ], counter );
1067       ++counter;
1068     }
1069 
1070     if ( ctx->third_installed ) {
1071       T_eq_u32( ctx->counter_by_entry[ 2 ], counter );
1072       ++counter;
1073     }
1074 
1075     T_eq_u32( ctx->counter_by_entry[ 0 ], counter );
1076   }
1077 
1078   switch ( state ) {
1079     case RtemsIntrReqEntryInstall_Post_Installed_No: {
1080       /*
1081        * The entry referenced by ``entry`` shall not be installed at the
1082        * interrupt vector specified by ``vector``.
1083        */
1084       if ( ctx->other_installed && ctx->third_installed ) {
1085         T_eq_u32( ctx->visited_entries, 2 );
1086       } else if ( ctx->other_installed ) {
1087         T_eq_u32( ctx->visited_entries, 1 );
1088       } else {
1089         T_eq_u32( ctx->visited_entries, 0 );
1090       }
1091       break;
1092     }
1093 
1094     case RtemsIntrReqEntryInstall_Post_Installed_Last: {
1095       /*
1096        * The entry referenced by ``entry`` shall be installed as the last entry
1097        * at the interrupt vector specified by ``vector``.
1098        */
1099       if ( ctx->other_installed && ctx->third_installed ) {
1100         T_eq_u32( ctx->visited_entries, 3 );
1101       } else if ( ctx->other_installed ) {
1102         T_eq_u32( ctx->visited_entries, 2 );
1103       } else {
1104         T_eq_u32( ctx->visited_entries, 1 );
1105       }
1106       break;
1107     }
1108 
1109     case RtemsIntrReqEntryInstall_Post_Installed_NA:
1110       break;
1111   }
1112 }
1113 
1114 static void RtemsIntrReqEntryInstall_Setup(
1115   RtemsIntrReqEntryInstall_Context *ctx
1116 )
1117 {
1118   rtems_interrupt_attributes required = {
1119     .can_raise = true
1120   };
1121   rtems_status_code sc;
1122 
1123   ctx->initialized_during_setup = bsp_interrupt_is_initialized();
1124   ctx->test_vector = GetTestableInterruptVector( &required );
1125   ctx->test_vector_was_enabled = false;
1126   (void) rtems_interrupt_vector_is_enabled(
1127     ctx->test_vector,
1128     &ctx->test_vector_was_enabled
1129   );
1130   sc = rtems_interrupt_get_attributes( ctx->test_vector, &ctx->attributes );
1131   T_rsc_success( sc );
1132 }
1133 
1134 static void RtemsIntrReqEntryInstall_Setup_Wrap( void *arg )
1135 {
1136   RtemsIntrReqEntryInstall_Context *ctx;
1137 
1138   ctx = arg;
1139   ctx->Map.in_action_loop = false;
1140   RtemsIntrReqEntryInstall_Setup( ctx );
1141 }
1142 
1143 static void RtemsIntrReqEntryInstall_Teardown(
1144   RtemsIntrReqEntryInstall_Context *ctx
1145 )
1146 {
1147   if ( ctx->test_vector_was_enabled ) {
1148     (void) rtems_interrupt_vector_enable( ctx->test_vector );
1149   }
1150 }
1151 
1152 static void RtemsIntrReqEntryInstall_Teardown_Wrap( void *arg )
1153 {
1154   RtemsIntrReqEntryInstall_Context *ctx;
1155 
1156   ctx = arg;
1157   ctx->Map.in_action_loop = false;
1158   RtemsIntrReqEntryInstall_Teardown( ctx );
1159 }
1160 
1161 static void RtemsIntrReqEntryInstall_Prepare(
1162   RtemsIntrReqEntryInstall_Context *ctx
1163 )
1164 {
1165   size_t i;
1166 
1167   for ( i = 0; i < RTEMS_ARRAY_SIZE( ctx->counter_by_entry ); ++i ) {
1168     ctx->counter_by_entry[ i ] = 0;
1169   }
1170 
1171   ctx->handler_counter = 0;
1172   ctx->other_installed = false;
1173   ctx->third_installed = false;
1174 }
1175 
1176 static void RtemsIntrReqEntryInstall_Action(
1177   RtemsIntrReqEntryInstall_Context *ctx
1178 )
1179 {
1180   if ( ctx->isr ) {
1181     CallWithinISR( Action, ctx );
1182   } else {
1183     Action( ctx );
1184   }
1185 }
1186 
1187 static void RtemsIntrReqEntryInstall_Cleanup(
1188   RtemsIntrReqEntryInstall_Context *ctx
1189 )
1190 {
1191   rtems_status_code sc;
1192 
1193   if ( ctx->third_installed ) {
1194     sc = rtems_interrupt_entry_remove( ctx->test_vector, &ctx->third_entry );
1195     T_rsc_success( sc );
1196   }
1197 
1198   if ( ctx->other_installed ) {
1199     sc = rtems_interrupt_entry_remove( ctx->test_vector, &ctx->other_entry );
1200     T_rsc_success( sc );
1201   }
1202 
1203   if ( ctx->status == RTEMS_SUCCESSFUL ) {
1204     sc = rtems_interrupt_entry_remove( ctx->test_vector, ctx->entry );
1205     T_rsc_success( sc );
1206   }
1207 }
1208 
1209 static const RtemsIntrReqEntryInstall_Entry
1210 RtemsIntrReqEntryInstall_Entries[] = {
1211   { 0, 0, 0, 0, 1, 0, 0, 0, 0, RtemsIntrReqEntryInstall_Post_Status_InvAddr,
1212     RtemsIntrReqEntryInstall_Post_Enable_Nop,
1213     RtemsIntrReqEntryInstall_Post_Installed_NA },
1214   { 0, 0, 0, 0, 1, 0, 0, 1, 1, RtemsIntrReqEntryInstall_Post_Status_InvAddr,
1215     RtemsIntrReqEntryInstall_Post_Enable_NA,
1216     RtemsIntrReqEntryInstall_Post_Installed_NA },
1217   { 0, 0, 0, 0, 0, 0, 0, 0, 0, RtemsIntrReqEntryInstall_Post_Status_IncStat,
1218     RtemsIntrReqEntryInstall_Post_Enable_Nop,
1219     RtemsIntrReqEntryInstall_Post_Installed_No },
1220   { 0, 0, 0, 0, 0, 0, 0, 1, 1, RtemsIntrReqEntryInstall_Post_Status_IncStat,
1221     RtemsIntrReqEntryInstall_Post_Enable_NA,
1222     RtemsIntrReqEntryInstall_Post_Installed_NA },
1223   { 0, 0, 0, 0, 0, 0, 0, 0, 0, RtemsIntrReqEntryInstall_Post_Status_InvAddr,
1224     RtemsIntrReqEntryInstall_Post_Enable_Nop,
1225     RtemsIntrReqEntryInstall_Post_Installed_No },
1226   { 0, 0, 0, 0, 0, 0, 0, 1, 1, RtemsIntrReqEntryInstall_Post_Status_InvId,
1227     RtemsIntrReqEntryInstall_Post_Enable_NA,
1228     RtemsIntrReqEntryInstall_Post_Installed_NA },
1229   { 0, 0, 0, 0, 0, 0, 0, 1, 1, RtemsIntrReqEntryInstall_Post_Status_InvAddr,
1230     RtemsIntrReqEntryInstall_Post_Enable_NA,
1231     RtemsIntrReqEntryInstall_Post_Installed_NA },
1232   { 0, 0, 0, 0, 0, 0, 0, 0, 0,
1233     RtemsIntrReqEntryInstall_Post_Status_CalledFromISR,
1234     RtemsIntrReqEntryInstall_Post_Enable_Nop,
1235     RtemsIntrReqEntryInstall_Post_Installed_No },
1236   { 0, 0, 0, 0, 0, 0, 0, 0, 0, RtemsIntrReqEntryInstall_Post_Status_InUse,
1237     RtemsIntrReqEntryInstall_Post_Enable_Nop,
1238     RtemsIntrReqEntryInstall_Post_Installed_No },
1239   { 0, 0, 0, 0, 0, 0, 0, 0, 0, RtemsIntrReqEntryInstall_Post_Status_InvNum,
1240     RtemsIntrReqEntryInstall_Post_Enable_Nop,
1241     RtemsIntrReqEntryInstall_Post_Installed_No },
1242   { 0, 0, 0, 0, 0, 0, 0, 0, 0, RtemsIntrReqEntryInstall_Post_Status_Ok,
1243     RtemsIntrReqEntryInstall_Post_Enable_Yes,
1244     RtemsIntrReqEntryInstall_Post_Installed_Last },
1245   { 0, 0, 0, 0, 0, 0, 0, 0, 0, RtemsIntrReqEntryInstall_Post_Status_Ok,
1246     RtemsIntrReqEntryInstall_Post_Enable_Maybe,
1247     RtemsIntrReqEntryInstall_Post_Installed_Last },
1248   { 0, 0, 0, 0, 0, 0, 0, 0, 0, RtemsIntrReqEntryInstall_Post_Status_Ok,
1249     RtemsIntrReqEntryInstall_Post_Enable_No,
1250     RtemsIntrReqEntryInstall_Post_Installed_Last },
1251   { 0, 0, 0, 0, 0, 0, 0, 0, 0, RtemsIntrReqEntryInstall_Post_Status_TooMany,
1252     RtemsIntrReqEntryInstall_Post_Enable_Nop,
1253     RtemsIntrReqEntryInstall_Post_Installed_No }
1254 };
1255 
1256 static const uint8_t
1257 RtemsIntrReqEntryInstall_Map[] = {
1258   7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 10, 8, 8, 8, 8, 8, 11,
1259   8, 8, 8, 8, 8, 12, 8, 8, 8, 8, 8, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1260   2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4,
1261   4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
1262   4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
1263   2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1264   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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 3, 3, 3, 3, 3, 3, 3,
1316   3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
1317   6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 3, 3,
1318   3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
1319   3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1320   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1321   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1322   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1323   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1324   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
1325 };
1326 
1327 static size_t RtemsIntrReqEntryInstall_Scope( void *arg, char *buf, size_t n )
1328 {
1329   RtemsIntrReqEntryInstall_Context *ctx;
1330 
1331   ctx = arg;
1332 
1333   if ( ctx->Map.in_action_loop ) {
1334     return T_get_scope(
1335       RtemsIntrReqEntryInstall_PreDesc,
1336       buf,
1337       n,
1338       ctx->Map.pcs
1339     );
1340   }
1341 
1342   return 0;
1343 }
1344 
1345 static T_fixture RtemsIntrReqEntryInstall_Fixture = {
1346   .setup = RtemsIntrReqEntryInstall_Setup_Wrap,
1347   .stop = NULL,
1348   .teardown = RtemsIntrReqEntryInstall_Teardown_Wrap,
1349   .scope = RtemsIntrReqEntryInstall_Scope,
1350   .initial_context = &RtemsIntrReqEntryInstall_Instance
1351 };
1352 
1353 static inline RtemsIntrReqEntryInstall_Entry RtemsIntrReqEntryInstall_PopEntry(
1354   RtemsIntrReqEntryInstall_Context *ctx
1355 )
1356 {
1357   size_t index;
1358 
1359   index = ctx->Map.index;
1360   ctx->Map.index = index + 1;
1361   return RtemsIntrReqEntryInstall_Entries[
1362     RtemsIntrReqEntryInstall_Map[ index ]
1363   ];
1364 }
1365 
1366 static void RtemsIntrReqEntryInstall_SetPreConditionStates(
1367   RtemsIntrReqEntryInstall_Context *ctx
1368 )
1369 {
1370   ctx->Map.pcs[ 0 ] = ctx->Map.pci[ 0 ];
1371   ctx->Map.pcs[ 1 ] = ctx->Map.pci[ 1 ];
1372   ctx->Map.pcs[ 2 ] = ctx->Map.pci[ 2 ];
1373 
1374   if ( ctx->Map.entry.Pre_Routine_NA ) {
1375     ctx->Map.pcs[ 3 ] = RtemsIntrReqEntryInstall_Pre_Routine_NA;
1376   } else {
1377     ctx->Map.pcs[ 3 ] = ctx->Map.pci[ 3 ];
1378   }
1379 
1380   ctx->Map.pcs[ 4 ] = ctx->Map.pci[ 4 ];
1381   ctx->Map.pcs[ 5 ] = ctx->Map.pci[ 5 ];
1382 
1383   if ( ctx->Map.entry.Pre_CanEnable_NA ) {
1384     ctx->Map.pcs[ 6 ] = RtemsIntrReqEntryInstall_Pre_CanEnable_NA;
1385   } else {
1386     ctx->Map.pcs[ 6 ] = ctx->Map.pci[ 6 ];
1387   }
1388 
1389   if ( ctx->Map.entry.Pre_Installed_NA ) {
1390     ctx->Map.pcs[ 7 ] = RtemsIntrReqEntryInstall_Pre_Installed_NA;
1391   } else {
1392     ctx->Map.pcs[ 7 ] = ctx->Map.pci[ 7 ];
1393   }
1394 }
1395 
1396 static void RtemsIntrReqEntryInstall_TestVariant(
1397   RtemsIntrReqEntryInstall_Context *ctx
1398 )
1399 {
1400   RtemsIntrReqEntryInstall_Pre_Vector_Prepare( ctx, ctx->Map.pcs[ 0 ] );
1401   RtemsIntrReqEntryInstall_Pre_Options_Prepare( ctx, ctx->Map.pcs[ 1 ] );
1402   RtemsIntrReqEntryInstall_Pre_Entry_Prepare( ctx, ctx->Map.pcs[ 2 ] );
1403   RtemsIntrReqEntryInstall_Pre_Routine_Prepare( ctx, ctx->Map.pcs[ 3 ] );
1404   RtemsIntrReqEntryInstall_Pre_Init_Prepare( ctx, ctx->Map.pcs[ 4 ] );
1405   RtemsIntrReqEntryInstall_Pre_ISR_Prepare( ctx, ctx->Map.pcs[ 5 ] );
1406   RtemsIntrReqEntryInstall_Pre_CanEnable_Prepare( ctx, ctx->Map.pcs[ 6 ] );
1407   RtemsIntrReqEntryInstall_Pre_Installed_Prepare( ctx, ctx->Map.pcs[ 7 ] );
1408   RtemsIntrReqEntryInstall_Action( ctx );
1409   RtemsIntrReqEntryInstall_Post_Status_Check(
1410     ctx,
1411     ctx->Map.entry.Post_Status
1412   );
1413   RtemsIntrReqEntryInstall_Post_Enable_Check(
1414     ctx,
1415     ctx->Map.entry.Post_Enable
1416   );
1417   RtemsIntrReqEntryInstall_Post_Installed_Check(
1418     ctx,
1419     ctx->Map.entry.Post_Installed
1420   );
1421 }
1422 
1423 /**
1424  * @fn void T_case_body_RtemsIntrReqEntryInstall( void )
1425  */
1426 T_TEST_CASE_FIXTURE(
1427   RtemsIntrReqEntryInstall,
1428   &RtemsIntrReqEntryInstall_Fixture
1429 )
1430 {
1431   RtemsIntrReqEntryInstall_Context *ctx;
1432 
1433   ctx = T_fixture_context();
1434   ctx->Map.in_action_loop = true;
1435   ctx->Map.index = 0;
1436 
1437   for (
1438     ctx->Map.pci[ 0 ] = RtemsIntrReqEntryInstall_Pre_Vector_Valid;
1439     ctx->Map.pci[ 0 ] < RtemsIntrReqEntryInstall_Pre_Vector_NA;
1440     ++ctx->Map.pci[ 0 ]
1441   ) {
1442     for (
1443       ctx->Map.pci[ 1 ] = RtemsIntrReqEntryInstall_Pre_Options_Unique;
1444       ctx->Map.pci[ 1 ] < RtemsIntrReqEntryInstall_Pre_Options_NA;
1445       ++ctx->Map.pci[ 1 ]
1446     ) {
1447       for (
1448         ctx->Map.pci[ 2 ] = RtemsIntrReqEntryInstall_Pre_Entry_Obj;
1449         ctx->Map.pci[ 2 ] < RtemsIntrReqEntryInstall_Pre_Entry_NA;
1450         ++ctx->Map.pci[ 2 ]
1451       ) {
1452         for (
1453           ctx->Map.pci[ 3 ] = RtemsIntrReqEntryInstall_Pre_Routine_Valid;
1454           ctx->Map.pci[ 3 ] < RtemsIntrReqEntryInstall_Pre_Routine_NA;
1455           ++ctx->Map.pci[ 3 ]
1456         ) {
1457           for (
1458             ctx->Map.pci[ 4 ] = RtemsIntrReqEntryInstall_Pre_Init_Yes;
1459             ctx->Map.pci[ 4 ] < RtemsIntrReqEntryInstall_Pre_Init_NA;
1460             ++ctx->Map.pci[ 4 ]
1461           ) {
1462             for (
1463               ctx->Map.pci[ 5 ] = RtemsIntrReqEntryInstall_Pre_ISR_Yes;
1464               ctx->Map.pci[ 5 ] < RtemsIntrReqEntryInstall_Pre_ISR_NA;
1465               ++ctx->Map.pci[ 5 ]
1466             ) {
1467               for (
1468                 ctx->Map.pci[ 6 ] = RtemsIntrReqEntryInstall_Pre_CanEnable_Yes;
1469                 ctx->Map.pci[ 6 ] < RtemsIntrReqEntryInstall_Pre_CanEnable_NA;
1470                 ++ctx->Map.pci[ 6 ]
1471               ) {
1472                 for (
1473                   ctx->Map.pci[ 7 ] = RtemsIntrReqEntryInstall_Pre_Installed_None;
1474                   ctx->Map.pci[ 7 ] < RtemsIntrReqEntryInstall_Pre_Installed_NA;
1475                   ++ctx->Map.pci[ 7 ]
1476                 ) {
1477                   ctx->Map.entry = RtemsIntrReqEntryInstall_PopEntry( ctx );
1478                   RtemsIntrReqEntryInstall_SetPreConditionStates( ctx );
1479                   RtemsIntrReqEntryInstall_Prepare( ctx );
1480                   RtemsIntrReqEntryInstall_TestVariant( ctx );
1481                   RtemsIntrReqEntryInstall_Cleanup( ctx );
1482                 }
1483               }
1484             }
1485           }
1486         }
1487       }
1488     }
1489   }
1490 }
1491 
1492 /** @} */