summaryrefslogtreecommitdiffstats
path: root/spec/rtems/intr/req/entry-install.yml
blob: 6c7260ba0c37494261fb7c86bb91487da2e5fd7e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
copyrights:
- Copyright (C) 2021 embedded brains GmbH (http://www.embedded-brains.de)
enabled-by: true
functional-type: action
links:
- role: interface-function
  uid: ../if/entry-install
- role: interface-function
  uid: ../if/replace
- role: interface-function
  uid: ../if/shared
- role: interface-function
  uid: ../if/unique
post-conditions:
- name: Status
  states:
  - name: Ok
    test-code: |
      T_rsc_success( ctx->status );
    text: |
      The return status of ${../if/entry-install:/name} shall be
      ${../../status/if/successful:/name}.
  - name: InvAddr
    test-code: |
      T_rsc( ctx->status, RTEMS_INVALID_ADDRESS );
    text: |
      The return status of ${../if/entry-install:/name} shall be
      ${../../status/if/invalid-address:/name}.
  - name: IncStat
    test-code: |
      T_rsc( ctx->status, RTEMS_INCORRECT_STATE );
    text: |
      The return status of ${../if/entry-install:/name} shall be
      ${../../status/if/incorrect-state:/name}.
  - name: InvId
    test-code: |
      T_rsc( ctx->status, RTEMS_INVALID_ID );
    text: |
      The return status of ${../if/entry-install:/name} shall be
      ${../../status/if/invalid-id:/name}.
  - name: InvNum
    test-code: |
      T_rsc( ctx->status, RTEMS_INVALID_NUMBER );
    text: |
      The return status of ${../if/entry-install:/name} shall be
      ${../../status/if/invalid-number:/name}.
  - name: CalledFromISR
    test-code: |
      T_rsc( ctx->status, RTEMS_CALLED_FROM_ISR );
    text: |
      The return status of ${../if/entry-install:/name} shall be
      ${../../status/if/called-from-isr:/name}.
  - name: InUse
    test-code: |
      T_rsc( ctx->status, RTEMS_RESOURCE_IN_USE  );
    text: |
      The return status of ${../if/entry-install:/name} shall be
      ${../../status/if/resource-in-use:/name}.
  - name: TooMany
    test-code: |
      T_rsc( ctx->status, RTEMS_TOO_MANY );
    text: |
      The return status of ${../if/entry-install:/name} shall be
      ${../../status/if/too-many:/name}.
  test-epilogue: null
  test-prologue: null
- name: Enable
  states:
  - name: Nop
    test-code: |
      if ( ctx->handler_counter == 0 ) {
        T_eq( ctx->enabled_before, ctx->enabled_after );
      }
    text: |
      The enabled status of the interrupt vector specified by
      ${../if/entry-install:/params[0]/name} shall not be modified by the
      ${../if/entry-install:/name} call.
  - name: 'Yes'
    test-code: |
      T_true( ctx->enabled_after || ctx->handler_counter > 3 );
    text: |
      The interrupt vector specified by ${../if/entry-install:/params[0]/name}
      shall be enabled.
  - name: Maybe
    test-code: |
      /*
       * Interrupt vectors which cannot be enabled are not selected as a
       * testable interrupt vector by GetTestableInterruptVector(), so this
       * path is not validated by this test.  See also comment for
       * ``CanEnable`` pre-condition state ``Yes``.
       */
      T_true( ctx->enabled_after || ctx->handler_counter > 3 );
    text: |
      The interrupt vector specified by ${../if/entry-remove:/params[0]/name}
      may be enabled.
  - name: 'No'
    test-code: |
      /*
       * Interrupt vectors which cannot be enabled are not selected as a
       * testable interrupt vector by GetTestableInterruptVector(), so this
       * path is not validated by this test.  See also comment for
       * ``CanEnable`` pre-condition state ``Yes``.
       */
      T_true( ctx->enabled_after || ctx->handler_counter > 3 );
    text: |
      The interrupt vector specified by ${../if/entry-remove:/params[0]/name}
      shall not be enabled.
  test-epilogue: null
  test-prologue: null
- name: Installed
  states:
  - name: 'No'
    test-code: |
      if ( ctx->other_installed && ctx->third_installed ) {
        T_eq_u32( ctx->visited_entries, 2 );
      } else if ( ctx->other_installed ) {
        T_eq_u32( ctx->visited_entries, 1 );
      } else {
        T_eq_u32( ctx->visited_entries, 0 );
      }
    text: |
      The entry referenced by ${../if/entry-install:/params[2]/name} shall not
      be installed at the interrupt vector specified by
      ${../if/entry-install:/params[0]/name}.
  - name: Last
    test-code: |
      if ( ctx->other_installed && ctx->third_installed ) {
        T_eq_u32( ctx->visited_entries, 3 );
      } else if ( ctx->other_installed ) {
        T_eq_u32( ctx->visited_entries, 2 );
      } else {
        T_eq_u32( ctx->visited_entries, 1 );
      }
    text: |
      The entry referenced by ${../if/entry-install:/params[2]/name} shall be
      installed as the last entry at the interrupt vector specified by
      ${../if/entry-install:/params[0]/name}.
  test-epilogue: null
  test-prologue: |
    rtems_status_code sc;

    ctx->visited_entries = 0;
    sc = rtems_interrupt_handler_iterate(
      ctx->test_vector,
      VisitInstalled,
      ctx
    );
    T_rsc_success( sc );

    if ( ctx->status == RTEMS_SUCCESSFUL ) {
      uint32_t counter;

      counter = 1;

      if ( ctx->other_installed ) {
        T_eq_u32( ctx->counter_by_entry[ 1 ], counter );
        ++counter;
      }

      if ( ctx->third_installed ) {
        T_eq_u32( ctx->counter_by_entry[ 2 ], counter );
        ++counter;
      }

      T_eq_u32( ctx->counter_by_entry[ 0 ], counter );
    }
pre-conditions:
- name: Vector
  states:
  - name: Valid
    test-code: |
      ctx->vector = ctx->test_vector;
    text: |
      While the ${../if/entry-install:/params[0]/name} parameter is
      associated with an interrupt vector.
  - name: Invalid
    test-code: |
      ctx->vector = BSP_INTERRUPT_VECTOR_COUNT;
    text: |
      While the ${../if/entry-install:/params[0]/name} parameter is
      not associated with an interrupt vector.
  test-epilogue: null
  test-prologue: null
- name: Options
  states:
  - name: Unique
    test-code: |
      ctx->options = RTEMS_INTERRUPT_UNIQUE;
    text: |
      While the ${../if/entry-install:/params[1]/name} indicates that an unique
      entry shall be installed.
  - name: Shared
    test-code: |
      ctx->options = RTEMS_INTERRUPT_SHARED;
    text: |
      While the ${../if/entry-install:/params[1]/name} indicates that a shared
      entry shall be installed.
  - name: Replace
    test-code: |
      ctx->options = RTEMS_INTERRUPT_REPLACE;
    text: |
      While the ${../if/entry-install:/params[1]/name} indicates that the entry
      handler routine shall be replaced.
  test-epilogue: null
  test-prologue: null
- name: Entry
  states:
  - name: Obj
    test-code: |
      ctx->entry = &ctx->entry_obj;
    text: |
      While the ${../if/entry-install:/params[2]/name} parameter references an
      object of type ${../if/entry:/name}.
  - name: 'Null'
    test-code: |
      ctx->entry = NULL;
    text: |
      While the ${../if/entry-install:/params[2]/name} parameter is equal to
      ${/c/if/null:/name}.
  test-epilogue: null
  test-prologue: null
- name: Routine
  states:
  - name: Valid
    test-code: |
      rtems_interrupt_entry_initialize(
        &ctx->entry_obj,
        EntryRoutine,
        &entry_arg,
        entry_info
      );
    text: |
      While the handler routine of the object referenced by the
      ${../if/entry-install:/params[2]/name} parameter is valid.
  - name: 'Null'
    test-code: |
      rtems_interrupt_entry_initialize(
        &ctx->entry_obj,
        NULL,
        &entry_arg,
        entry_info
      );
    text: |
      While the handler routine of the object referenced by the
      ${../if/entry-install:/params[2]/name} parameter is equal to
      ${/c/if/null:/name}.
  test-epilogue: null
  test-prologue: null
- name: Init
  states:
  - name: 'Yes'
    test-code: |
      ctx->initialized = true;
    text: |
      While the service is initialized.
  - name: 'No'
    test-code: |
      ctx->initialized = false;
    text: |
      While the service is not initialized.
  test-epilogue: null
  test-prologue: null
- name: ISR
  states:
  - name: 'Yes'
    test-code: |
      ctx->isr = true;
    text: |
      While ${../if/entry-install:/name} is called from within interrupt
      context.
  - name: 'No'
    test-code: |
      ctx->isr = false;
    text: |
      While ${../if/entry-install:/name} is not called from within interrupt
      context.
  test-epilogue: null
  test-prologue: null
- name: CanEnable
  states:
  - name: 'Yes'
    test-code: |
      /*
       * This pre-condition depends on the attributes of an interrupt vector.
       * For the validation test of ${../if/entry-install:/name} a testable
       * interrupt vector is determined by GetTestableInterruptVector().  The
       * implementation of ${../if/entry-install:/name} uses
       * ${../if/vector-enable:/name} which is validated separately in detail.
       */
    text: |
      While the interrupt vector associated with the
      ${../if/entry-remove:/params[0]/name} parameter can be enabled.
  - name: Maybe
    test-code: |
      /* See comment for ``Yes`` state */
    text: |
      While the interrupt vector associated with the
      ${../if/entry-remove:/params[0]/name} parameter may be enabled.
  - name: 'No'
    test-code: |
      /* See comment for ``Yes`` state */
    text: |
      While the interrupt vector associated with the
      ${../if/entry-remove:/params[0]/name} parameter cannot be enabled.
  test-epilogue: null
  test-prologue: null
- name: Installed
  states:
  - name: None
    test-code: |
      /* Nothing to do */
    text: |
      While the no entry is installed at the interrupt vector specified by the
      ${../if/entry-install:/params[0]/name} parameter.
  - name: Unique
    test-code: |
      Install( ctx, RTEMS_INTERRUPT_UNIQUE, EntryRoutine, &entry_arg );
    text: |
      While a unique entry is installed at the interrupt vector specified by
      the ${../if/entry-install:/params[0]/name} parameter.
  - name: Other
    test-code: |
      Install( ctx, RTEMS_INTERRUPT_SHARED, OtherRoutine, &other_arg );
      InstallThird( ctx );
    text: |
      While at least one non-unique entry is installed at the interrupt vector
      specified by the ${../if/entry-install:/params[0]/name} parameter,
      while all entries installed at the interrupt vector specified by the
      ${../if/entry-install:/params[0]/name} parameter have a handler routine
      which is not equal to the handler routine of the object referenced by the
      ${../if/entry-install:/params[2]/name} parameter,
      while all entries installed at the interrupt vector specified by the
      ${../if/entry-install:/params[0]/name} parameter have a handler argument
      which is not equal to the handler argument of the object referenced by
      the ${../if/entry-install:/params[2]/name} parameter.
  - name: EqRoutine
    test-code: |
      Install( ctx, RTEMS_INTERRUPT_SHARED, EntryRoutine, &other_arg );
    text: |
      While at least one non-unique entry is installed at the interrupt vector
      specified by the ${../if/entry-install:/params[0]/name} parameter,
      while at least one entry installed at the interrupt vector specified by
      the ${../if/entry-install:/params[0]/name} parameter has a handler
      routine which is equal to the handler routine of the object referenced by
      the ${../if/entry-install:/params[2]/name} parameter,
      while all entries installed at the interrupt vector specified by the
      ${../if/entry-install:/params[0]/name} parameter have a handler argument
      which is not equal to the handler argument of the object referenced by
      the ${../if/entry-install:/params[2]/name} parameter.
  - name: EqArg
    test-code: |
      Install( ctx, RTEMS_INTERRUPT_SHARED, OtherRoutine, &other_arg );
    text: |
      While at least one non-unique entry is installed at the interrupt vector
      specified by the ${../if/entry-install:/params[0]/name} parameter,
      while all entries installed at the interrupt vector specified by the
      ${../if/entry-install:/params[0]/name} parameter have a handler routine
      which is not equal to the handler routine of the object referenced by the
      ${../if/entry-install:/params[2]/name} parameter,
      while at least one entry installed at the interrupt vector specified by
      the ${../if/entry-install:/params[0]/name} parameter has a handler
      argument which is equal to the handler argument of the object referenced
      by the ${../if/entry-install:/params[2]/name} parameter.
  - name: Match
    test-code: |
      Install( ctx, RTEMS_INTERRUPT_SHARED, EntryRoutine, &entry_arg );
    text: |
      While at least one non-unique entry with a handler routine which is equal
      to the handler routine of the object referenced by the
      ${../if/entry-install:/params[2]/name} parameter and with a handler
      argument which is equal to the handler argument of the object referenced
      by the ${../if/entry-install:/params[2]/name} parameter is installed at
      the interrupt vector specified by the
      ${../if/entry-install:/params[0]/name} parameter.
  test-epilogue: null
  test-prologue: null
rationale: null
references: []
requirement-type: functional
skip-reasons: {}
test-action: |
  if ( ctx->isr ) {
    CallWithinISR( Action, ctx );
  } else {
    Action( ctx );
  }
test-brief: null
test-cleanup: |
  rtems_status_code sc;

  if ( ctx->third_installed ) {
    sc = rtems_interrupt_entry_remove( ctx->test_vector, &ctx->third_entry );
    T_rsc_success( sc );
  }

  if ( ctx->other_installed ) {
    sc = rtems_interrupt_entry_remove( ctx->test_vector, &ctx->other_entry );
    T_rsc_success( sc );
  }

  if ( ctx->status == RTEMS_SUCCESSFUL ) {
    sc = rtems_interrupt_entry_remove( ctx->test_vector, ctx->entry );
    T_rsc_success( sc );
  }
test-context:
- brief: |
    If this member is true, then the service was initialized during setup.
  description: null
  member: |
    bool initialized_during_setup
- brief: |
    This member provides a counter for handler invocations.
  description: null
  member: |
    uint32_t handler_counter
- brief: |
    This member provides a counter snapshot for each entry.
  description: null
  member: |
    uint32_t counter_by_entry[ 3 ];
- brief: |
    This member provides the vector number of a testable interrupt vector.
  description: null
  member: |
    rtems_vector_number test_vector
- brief: |
    If this member is true, then the testable interrupt vector was enabled at
    the test case begin.
  description: null
  member: |
    bool test_vector_was_enabled
- brief: |
    This member provides the attributes of the testable interrupt vector.
  description: null
  member: |
    rtems_interrupt_attributes attributes
- brief: |
    If this member is true, then the service shall be initialized.
  description: null
  member: |
    bool initialized
- brief: |
    If this member is true, then ${../if/entry-install:/name} shall be called
    from within interrupt context.
  description: null
  member: |
    bool isr
- brief: |
    This member contains the enabled status before the
    ${../if/entry-install:/name} call.
  description: null
  member: |
    bool enabled_before
- brief: |
    This member contains the enabled status after the
    ${../if/entry-install:/name} call.
  description: null
  member: |
    bool enabled_after
- brief: |
    This member provides the count of visited entries.
  description: null
  member: |
    uint32_t visited_entries
- brief: |
    This member provides another ${../if/entry:/name} object.
  description: null
  member: |
    rtems_interrupt_entry other_entry
- brief: |
    If this member is true, then another entry was installed.
  description: null
  member: |
    bool other_installed
- brief: |
    This member provides a third ${../if/entry:/name} object.
  description: null
  member: |
    rtems_interrupt_entry third_entry
- brief: |
    If this member is true, then the third entry was installed.
  description: null
  member: |
    bool third_installed
- brief: |
    This member provides the options used to install the other
    ${../if/entry:/name} object.
  description: null
  member: |
    rtems_option other_options
- brief: |
    This member provides the ${../if/entry:/name} object.
  description: null
  member: |
    rtems_interrupt_entry entry_obj
- brief: |
    This member specifies if the ${../if/entry-install:/params[0]/name}
    parameter value.
  description: null
  member: |
    rtems_vector_number vector
- brief: |
    This member specifies if the ${../if/entry-install:/params[1]/name}
    parameter value.
  description: null
  member: |
    rtems_option options
- brief: |
    This member specifies if the ${../if/entry-install:/params[2]/name}
    parameter value.
  description: null
  member: |
    rtems_interrupt_entry *entry;
- brief: |
    This member contains the return value of the ${../if/entry-install:/name}
    call.
  description: null
  member: |
    rtems_status_code status
test-context-support: null
test-description: null
test-header: null
test-includes:
- rtems/irq-extension.h
- bsp/irq-generic.h
test-local-includes:
- tx-support.h
test-prepare: |
  size_t i;

  for ( i = 0; i < RTEMS_ARRAY_SIZE( ctx->counter_by_entry ); ++i ) {
    ctx->counter_by_entry[ i ] = 0;
  }

  ctx->handler_counter = 0;
  ctx->other_installed = false;
  ctx->third_installed = false;
test-setup:
  brief: null
  code: |
    rtems_interrupt_attributes required = {
      .can_raise = true
    };
    rtems_status_code sc;

    ctx->initialized_during_setup = bsp_interrupt_is_initialized();
    ctx->test_vector = GetTestableInterruptVector( &required );
    ctx->test_vector_was_enabled = false;
    (void) rtems_interrupt_vector_is_enabled(
      ctx->test_vector,
      &ctx->test_vector_was_enabled
    );
    sc = rtems_interrupt_get_attributes( ctx->test_vector, &ctx->attributes );
    T_rsc_success( sc );
  description: null
test-stop: null
test-support: |
  typedef ${.:/test-context-type} Context;

  static char entry_arg;

  static char other_arg;

  static char third_arg;

  static const char entry_info[] = "Entry";

  static const char other_info[] = "Other";

  static const char third_info[] = "Third";

  static void Install(
    Context                *ctx,
    rtems_option            options,
    rtems_interrupt_handler routine,
    void                   *arg
  )
  {
    rtems_status_code sc;

    ctx->other_options = options;
    rtems_interrupt_entry_initialize(
      &ctx->other_entry,
      routine,
      arg,
      other_info
    );

    sc = rtems_interrupt_entry_install(
      ctx->test_vector,
      options,
      &ctx->other_entry
    );
    T_rsc_success( sc );

    ctx->other_installed = true;
  }

  static void Routine( Context *ctx, uint32_t counter )
  {
    rtems_status_code sc;

    ctx->handler_counter = counter;

    if (
      ctx->attributes.can_clear &&
      !ctx->attributes.cleared_by_acknowledge
    ) {
      sc = rtems_interrupt_clear( ctx->test_vector );
      T_rsc_success( sc );
    }

    if ( counter > 3 ) {
      sc = rtems_interrupt_vector_disable( ctx->test_vector );
      T_rsc_success( sc );
    }
  }

  static void EntryRoutine( void *arg )
  {
    Context *ctx;
    uint32_t counter;

    ctx = T_fixture_context();
    counter = ctx->handler_counter + 1;

    if ( arg == &other_arg ) {
      ctx->counter_by_entry[ 1 ] = counter;
    } else {
      ctx->counter_by_entry[ 0 ] = counter;
      T_eq_ptr( arg, &entry_arg );
    }

    Routine( ctx, counter );
  }

  static void OtherRoutine( void *arg )
  {
    Context *ctx;
    uint32_t counter;

    (void) arg;
    ctx = T_fixture_context();
    counter = ctx->handler_counter + 1;
    ctx->counter_by_entry[ 1 ] = counter;
    Routine( ctx, counter );
  }

  static void ThirdRoutine( void *arg )
  {
    Context *ctx;
    uint32_t counter;

    ctx = T_fixture_context();
    counter = ctx->handler_counter + 1;
    ctx->counter_by_entry[ 2 ] = counter;
    T_eq_ptr( arg, &third_arg );
    Routine( ctx, counter );
  }

  static void InstallThird( Context *ctx )
  {
    rtems_status_code sc;

    rtems_interrupt_entry_initialize(
      &ctx->third_entry,
      ThirdRoutine,
      &third_arg,
      third_info
    );

    sc = rtems_interrupt_entry_install(
      ctx->test_vector,
      RTEMS_INTERRUPT_SHARED,
      &ctx->third_entry
    );
    T_rsc_success( sc );

    ctx->third_installed = true;
  }

  static void Action( void *arg )
  {
    Context          *ctx;
    rtems_status_code sc;

    ctx = arg;

    sc = rtems_interrupt_vector_is_enabled(
      ctx->test_vector,
      &ctx->enabled_before
    );
    T_rsc_success( sc );

    bsp_interrupt_set_handler_unique(
      BSP_INTERRUPT_DISPATCH_TABLE_SIZE,
      ctx->initialized
    );

    ctx->status = rtems_interrupt_entry_install(
      ctx->vector,
      ctx->options,
      ctx->entry
    );

    bsp_interrupt_set_handler_unique(
      BSP_INTERRUPT_DISPATCH_TABLE_SIZE,
      ctx->initialized_during_setup
    );

    sc = rtems_interrupt_vector_is_enabled(
      ctx->test_vector,
      &ctx->enabled_after
    );
    T_rsc_success( sc );

    if ( ctx->status == RTEMS_SUCCESSFUL ) {
      sc = rtems_interrupt_raise( ctx->test_vector );
      T_rsc_success( sc );
    }
  }

  static void VisitInstalled(
    void                   *arg,
    const char             *info,
    rtems_option            options,
    rtems_interrupt_handler handler_routine,
    void                   *handler_arg
  )
  {
    Context *ctx;
    uint32_t visited_entries;

    ctx = arg;
    visited_entries = ctx->visited_entries;

    if ( visited_entries == 0 && ctx->other_installed ) {
      T_eq_ptr( info, other_info );
      T_eq_u32( options, ctx->other_options );
      T_eq_ptr( handler_routine, ctx->other_entry.handler );
      T_eq_ptr( handler_arg, ctx->other_entry.arg );
    } else if ( visited_entries == 1 && ctx->third_installed ) {
      T_eq_ptr( info, third_info );
      T_eq_u32( options, RTEMS_INTERRUPT_SHARED );
      T_eq_ptr( handler_routine, ThirdRoutine );
      T_eq_ptr( handler_arg, &third_arg );
    } else {
      T_eq_ptr( info, entry_info );
      T_eq_u32( options, ctx->options );
      T_eq_ptr( handler_routine, ctx->entry_obj.handler );
      T_eq_ptr( handler_arg, ctx->entry_obj.arg );
    }

    ctx->visited_entries = visited_entries + 1;
  }
test-target: testsuites/validation/tc-intr-entry-install.c
test-teardown:
  brief: null
  code: |
    if ( ctx->test_vector_was_enabled ) {
      (void) rtems_interrupt_vector_enable( ctx->test_vector );
    }
  description: null
text: ${.:text-template}
transition-map:
- enabled-by: true
  post-conditions:
    Status: Ok
    Enable:
    - specified-by: CanEnable
    Installed: Last
  pre-conditions:
    Vector:
    - Valid
    Options:
    - Unique
    Entry:
    - Obj
    Routine:
    - Valid
    Init:
    - 'Yes'
    ISR:
    - 'No'
    CanEnable: all
    Installed:
    - None
- enabled-by: true
  post-conditions:
    Status: Ok
    Enable:
    - specified-by: CanEnable
    Installed: Last
  pre-conditions:
    Vector:
    - Valid
    Options:
    - Shared
    Entry:
    - Obj
    Routine:
    - Valid
    Init:
    - 'Yes'
    ISR:
    - 'No'
    CanEnable: all
    Installed:
    - None
    - Other
    - EqRoutine
    - EqArg
- enabled-by: true
  post-conditions:
    Status: InvAddr
    Enable: Nop
    Installed: N/A
  pre-conditions:
    Vector:
    - Valid
    Options: all
    Entry:
    - 'Null'
    Routine: N/A
    Init: all
    ISR: all
    CanEnable: all
    Installed: all
- enabled-by: true
  post-conditions:
    Status: InvAddr
    Enable: N/A
    Installed: N/A
  pre-conditions:
    Vector:
    - Invalid
    Options: all
    Entry:
    - 'Null'
    Routine: N/A
    Init: all
    ISR: all
    CanEnable: N/A
    Installed: N/A
- enabled-by: true
  post-conditions:
    Status: IncStat
    Enable: Nop
    Installed: 'No'
  pre-conditions:
    Vector:
    - Valid
    Options: all
    Entry:
    - Obj
    Routine: all
    Init:
    - 'No'
    ISR: all
    CanEnable: all
    Installed: all
- enabled-by: true
  post-conditions:
    Status: IncStat
    Enable: N/A
    Installed: N/A
  pre-conditions:
    Vector:
    - Invalid
    Options: all
    Entry:
    - Obj
    Routine: all
    Init:
    - 'No'
    ISR: all
    CanEnable: N/A
    Installed: N/A
- enabled-by: true
  post-conditions:
    Status: InvAddr
    Enable: Nop
    Installed: 'No'
  pre-conditions:
    Vector:
    - Valid
    Options: all
    Entry:
    - Obj
    Routine:
    - 'Null'
    Init:
    - 'Yes'
    ISR: all
    CanEnable: all
    Installed: all
- enabled-by: true
  post-conditions:
    Status: InvAddr
    Enable: N/A
    Installed: N/A
  pre-conditions:
    Vector:
    - Invalid
    Options: all
    Entry:
    - Obj
    Routine:
    - 'Null'
    Init:
    - 'Yes'
    ISR: all
    CanEnable: N/A
    Installed: N/A
- enabled-by: true
  post-conditions:
    Status: InvId
    Enable: N/A
    Installed: N/A
  pre-conditions:
    Vector:
    - Invalid
    Options: all
    Entry:
    - Obj
    Routine:
    - Valid
    Init:
    - 'Yes'
    ISR: all
    CanEnable: N/A
    Installed: N/A
- enabled-by: true
  post-conditions:
    Status: CalledFromISR
    Enable: Nop
    Installed: 'No'
  pre-conditions:
    Vector:
    - Valid
    Options: all
    Entry:
    - Obj
    Routine:
    - Valid
    Init:
    - 'Yes'
    ISR:
    - 'Yes'
    CanEnable: all
    Installed: all
- enabled-by: true
  post-conditions:
    Status: InvNum
    Enable: Nop
    Installed: 'No'
  pre-conditions:
    Vector:
    - Valid
    Options:
    - Replace
    Entry:
    - Obj
    Routine:
    - Valid
    Init:
    - 'Yes'
    ISR:
    - 'No'
    CanEnable: all
    Installed: all
- enabled-by: true
  post-conditions:
    Status: InUse
    Enable: Nop
    Installed: 'No'
  pre-conditions:
    Vector:
    - Valid
    Options:
    - Unique
    Entry:
    - Obj
    Routine:
    - Valid
    Init:
    - 'Yes'
    ISR:
    - 'No'
    CanEnable: all
    Installed:
    - Unique
    - Other
    - EqRoutine
    - EqArg
    - Match
- enabled-by: true
  post-conditions:
    Status: InUse
    Enable: Nop
    Installed: 'No'
  pre-conditions:
    Vector:
    - Valid
    Options:
    - Shared
    Entry:
    - Obj
    Routine:
    - Valid
    Init:
    - 'Yes'
    ISR:
    - 'No'
    CanEnable: all
    Installed:
    - Unique
- enabled-by: true
  post-conditions:
    Status: TooMany
    Enable: Nop
    Installed: 'No'
  pre-conditions:
    Vector:
    - Valid
    Options:
    - Shared
    Entry:
    - Obj
    Routine:
    - Valid
    Init:
    - 'Yes'
    ISR:
    - 'No'
    CanEnable: all
    Installed:
    - Match
type: requirement