summaryrefslogtreecommitdiffstats
path: root/spec/rtems/ratemon/req/period.yml
blob: 326496ce7f89a48d604cafcc5ff6f9552976c354 (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
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
copyrights:
- Copyright (C) 2021 embedded brains GmbH & Co. KG
enabled-by: true
functional-type: action
links:
- role: interface-function
  uid: ../if/period
- role: interface-function
  uid: ../if/period-status-define
post-conditions:
- name: Status
  states:
  - name: Ok
    test-code: |
      T_rsc_success( ctx->status );
    text: |
      The return status of ${../if/period:/name} shall be
      ${../../status/if/successful:/name}
  - name: InvId
    test-code: |
      T_rsc( ctx->status, RTEMS_INVALID_ID );
    text: |
      The return status of ${../if/period:/name} shall be
      ${../../status/if/invalid-id:/name}.
  - name: NotOwn
    test-code: |
      T_rsc( ctx->status, RTEMS_NOT_OWNER_OF_RESOURCE );
    text: |
      The return status of ${../if/period:/name} shall be
      ${../../status/if/not-owner-of-resource:/name}.
  - name: NotDef
    test-code: |
      T_rsc( ctx->status, RTEMS_NOT_DEFINED );
    text: |
      The return status of ${../if/period:/name} shall be
      ${../../status/if/not-defined:/name}.
  - name: TimeOut
    test-code: |
      T_rsc( ctx->status, RTEMS_TIMEOUT );
    text: |
      The return status of ${../if/period:/name} shall be
      ${../../status/if/timeout:/name}.
  test-epilogue: null
  test-prologue: null
- name: State
  states:
  - name: Inactive
    test-code: |
      T_eq_int( ctx->period_status.state, RATE_MONOTONIC_INACTIVE );
    text: |
      The ${../glossary/state:/term} of the period shall be
      ${../glossary/inactive:/term} after the return of the
      ${../if/period:/name} call.
  - name: Active
    test-code: |
      T_eq_int( ctx->period_status.state, RATE_MONOTONIC_ACTIVE );
    text: |
      The ${../glossary/state:/term} of the period shall be
      ${../if/active:/name} after the return of the
      ${../if/period:/name} call.
  - name: Expired
    test-code: |
      T_eq_int( ctx->period_status.state, RATE_MONOTONIC_EXPIRED );
    text: |
      The ${../glossary/state:/term} of the period shall be
      ${../if/expired:/name} after the return of the
      ${../if/period:/name} call.
  - name: Nop
    test-code: |
      T_eq_u32( ctx->period_status.state, ctx->previous_state );
    text: |
      Objects referenced by the ${../if/period:/params[0]/name}
      parameter in past calls to ${../if/period:/name} shall not be
      accessed by the ${../if/period:/name} call (see also
      ${../glossary/nop:/term}).
  test-epilogue: null
  test-prologue: null
- name: Postponed
  states:
  - name: Zero
    test-code: |
      T_eq_u32( ctx->period_status.postponed_jobs_count, 0 );
    text: |
      There shall be no ${../glossary/postponedjob:/plural}
      after the return of the ${../if/period:/name} call.
  - name: OneOrMore
    test-code: |
      T_eq_u32(
        ctx->period_status.postponed_jobs_count,
        ( ctx->test_duration / period_length + 1 ) - ctx->period_calls
      );
    text: |
      The number of ${../glossary/postponedjob:/plural} shall be
      the number of ${../glossary/deadline:/plural} passed
      minus the number of returned calls to ${../if/period:/name}.

      The last call to ${../if/period:/name} where the
      ${../glossary/state:/term} changes from ${../glossary/inactive:/term}
      to ${../if/active:/name} is counted as the first returned call.
      The first deadline occurred at a point in time during that call
      to ${../if/period:/name}.
  - name: Nop
    test-code: |
      T_eq_u32(
        ctx->period_status.postponed_jobs_count,
        ctx->postponed_jobs_count
      );
    text: |
      Objects referenced by the ${../if/period:/params[0]/name}
      parameter in past calls to ${../if/period:/name} shall not be
      accessed by the ${../if/period:/name} call (see also
      ${../glossary/nop:/term}).
  test-epilogue: null
  test-prologue: null
- name: Delay
  states:
  - name: None
    test-code: |
      T_eq_u32( ctx->action_duration, 0 );
    text: |
      The last call to ${../if/period:/name} shall return without delay.
  - name: TillDeadline
    test-code: |
      T_eq_u32(
        ctx->action_duration,
        ( ctx->test_duration_till_action % period_length + 1 ) * period_length -
        ctx->test_duration_till_action
      );
    text: |
      The last call to ${../if/period:/name} shall block the
      ${../glossary/ownertask:/term} till the next ${../glossary/deadline:/term}
      and return afterwards.
  test-epilogue: null
  test-prologue: null
- name: Scheduler
  states:
  - name: Called
    test-code: |
      /* Cannot be tested as the effect is unknown. */
    text: |
      The last call of the ${../if/period:/name} function shall execute
      the ``release_job`` ${../glossary/scheduleroperation:/term} of the
      ${/glossary/scheduler-home:/term}.
  - name: Nop
    test-code: |
      /* Cannot be tested as the effect is unknown. */
    text: |
      The last call of the ${../if/period:/name} function shall not execute
      any ${../glossary/scheduleroperation:/term}.
  test-epilogue: null
  test-prologue: null
pre-conditions:
- name: Id
  states:
  - name: Valid
    test-code: |
      ctx->id_param = ctx->period_id;
    text: |
      While the ${../if/period:/params[0]/name} parameter is valid.
  - name: Invalid
    test-code: |
      ctx->id_param = RTEMS_ID_NONE;
    text: |
      While the ${../if/period:/params[0]/name} parameter is invalid.
  test-epilogue: null
  test-prologue: null
- name: Caller
  states:
  - name: OwnerTask
    test-code: |
      ctx->do_action = OwnerDoWork;
    text: |
      While the ${/glossary/task:/term} invoking ${../if/period:/name} is the
      ${/glossary/task:/term} which created the period
      - the ${../glossary/ownertask:/term}.
  - name: OtherTask
    test-code: |
      ctx->do_action = OtherDoWork;
    text: |
      While the ${/glossary/task:/term} invoking ${../if/period:/name} is not
      the ${../glossary/ownertask:/term}.
  test-epilogue: null
  test-prologue: null
- name: Length
  states:
  - name: Ticks
    test-code: |
      ctx->length_param = period_length;
    text: |
      While the ${../if/period:/params[1]/name} parameter is a number larger
      than 0.

      Note:

      * ${../if/period-status-define:/name} == 0

      * The ${../if/period:/params[1]/name} parameter of all calls to
        ${../if/period:/name} must have the same value (see
        ${../glossary/interval:/term}).
  - name: Status
    test-code: |
      ctx->length_param = RTEMS_PERIOD_STATUS;
    text: |
      While the ${../if/period:/params[1]/name} parameter is
      ${../if/period-status-define:/name}.
  test-epilogue: null
  test-prologue: null
- name: State
  states:
  - name: Inactive
    test-code: |
      /* Nothing to do here as the period is newly created. */
      ctx->previous_state = RATE_MONOTONIC_INACTIVE;
    text: |
      While the ${../if/period:/params[0]/name} parameter references an
      period object in ${../glossary/inactive:/term}
      ${../glossary/state:/term}.
  - name: Active
    test-code: |
      OwnerDoWork( ctx, CallPeriod );
      ctx->previous_state = RATE_MONOTONIC_ACTIVE;
    text: |
      While the ${../if/period:/params[0]/name} parameter references an
      period object in ${../glossary/active:/term} ${../glossary/state:/term}.
  - name: Expired
    test-code: |
      OwnerDoWork( ctx, CallPeriod );
      ctx->previous_state = RATE_MONOTONIC_EXPIRED;
    text: |
      While the ${../if/period:/params[0]/name} parameter references an
      period object in ${../glossary/expired:/term}
      ${../glossary/state:/term}.
  test-epilogue: null
  test-prologue: null
- name: Postponed
  states:
  - name: Zero
    test-code:  |
      ctx->postponed_jobs_count = 0;
    text: |
      While there is no ${../glossary/postponedjob:/term}.
  - name: One
    test-code: |
      CreatePostponedJobs( ctx, 1 );
    text: |
      While there is one ${../glossary/postponedjob:/term}.
  - name: Several
    test-code: |
      CreatePostponedJobs( ctx, 5 );
    text: |
      While there are two or more ${../glossary/postponedjob:/plural}.
  test-epilogue: null
  test-prologue: null
- name: InactiveCause
  states:
  - name: New
    test-code:  |
      /* Nothing to do here as the period is newly created. */
      ctx->postponed_jobs_count = 0;
    text: |
      While ${../if/period:/name} has never been invoked with result
      ${../../status/if/successful:/name} on the period object referenced
      by the ${../if/period:/params[0]/name} parameter since that
      period object has been created.
  - name: Canceled
    test-code: |
      if ( ctx->period_calls == 0 ) {
        OwnerDoWork( ctx, CallPeriod );
        TickTheClock( ctx, ctx->postponed_jobs_count * period_length );
      }
      OwnerDoWork( ctx, CancelPeriod );
      ctx->postponed_jobs_count = 0;
    text: |
      While ${../if/period:/name} has never been invoked with result
      ${../../status/if/successful:/name} on the period object referenced
      by the ${../if/period:/params[0]/name} parameter since that
      period object has been canceled using ${../if/cancel:/name}.
  test-epilogue: null
  test-prologue: null
rationale: null
references: []
requirement-type: functional
skip-reasons:
  NeverInExpiredState: |
    There must be ${../glossary/postponedjob:/plural} in
    ${../glossary/expired:/term} ${../glossary/state:/term}.
test-action: |
  rtems_status_code status;

  ctx->test_duration_till_action = ctx->test_duration;
  ctx->action_duration = ctx->do_action( ctx, DoAction );

  status = rtems_rate_monotonic_get_status(
    ctx->period_id,
    &ctx->period_status
  );
  T_rsc_success( status );
test-brief: null
test-cleanup: |
  OwnerDoWork( ctx, DeletePeriod );
test-context:
- brief: |
    This member contains a valid identifier of a period.
  description: null
  member: |
    rtems_id period_id
- brief: |
    This member is used to receive the ${../if/period-status:/name}
    after the action.
  description: null
  member: |
    rtems_rate_monotonic_period_status period_status
- brief: |
    This member specifies the ${../if/period:/params[0]/name} parameter
    for the action.
  description: null
  member: |
    rtems_id id_param
- brief: |
    This member specifies the ${../if/period:/params[1]/name} parameter
    for the action.
  description: null
  member: |
    rtems_interval length_param
- brief: |
    This member contains the returned ${/glossary/statuscode:/term}
    of the action.
  description: null
  member: |
    rtems_status_code status
- brief: |
    This member contains the pointer to the function which executes the action.
  description: |
    The action is either executed by the ${../glossary/ownertask:/term}
    or by the worker ${/glossary/task:/term} depending on the function
    pointer used here.  ``ctx_arg`` must be a pointer to this context
    structure.
  member: |
    uint32_t ( *do_action )( void *ctx, void (*todo)( void *ctx_arg ) )
- brief: |
    This member serves to pass the pointer to the function
    which the work ${../glossary/ownertask:/term} shall execute from
    function ``OwnerDoWork`` to function ``WorkerTask``.
  description: null
  member: |
    void (*worker_todo)( void *ctx )
- brief: |
    This member contains the ${../glossary/ownertask:/term} identifier of the
    ${../glossary/ownertask:/term}.
  description: null
  member: |
    rtems_id task_id
- brief: |
    This member contains the ${../glossary/ownertask:/term} identifier of the
    worker task (which is not the ${../glossary/ownertask:/term}).
  description: null
  member: |
    rtems_id worker_id
- brief: |
    This member contains a backup of the ${/glossary/priority-task:/term}
    before the execution of this test.
  description: null
  member: |
    rtems_id original_priority
- brief: |
    This member contains the number of ${../glossary/postponedjob:/plural}
    before the action.
  description: null
  member: |
    uint32_t postponed_jobs_count
- brief: |
    This member contains the ${../glossary/state:/term}
    before the action.
  description: null
  member: |
    rtems_rate_monotonic_period_states previous_state
- brief: |
    This member contains the number of ${/glossary/clock-tick:/plural} passed
    since the test started.
  description: null
  member: |
    uint32_t test_duration
- brief: |
    This member contains the number of ${/glossary/clock-tick:/plural} passed
    since the test started till (before) the ${../if/period:/name} action
    is invoked.
  description: null
  member: |
    uint32_t test_duration_till_action
- brief: |
     This member contains the number of times the ${../if/period:/name}
     function returned since the test started.
  description: null
  member: |
    uint32_t period_calls
- brief: |
    This member contains the number of ${/glossary/clock-tick:/plural}
    which passed in the action till the ${../if/period:/name}
    function returned.
  description: null
  member: |
    uint32_t action_duration
test-context-support: null
test-description: null
test-header: null
test-includes:
- rtems.h
test-local-includes:
- tx-support.h
test-prepare: |
  rtems_status_code status;
  rtems_rate_monotonic_period_status period_status;
  ctx->test_duration = 0;
  ctx->period_calls = 0;
  OwnerDoWork( ctx, CreatePeriod );

  /*
   * In case of a new period the postponed jobs count is arbitrary
   * (what ever value happens to be stored in that field of the internal data
   * structure) until period() is called.
   */
  status = rtems_rate_monotonic_get_status(
    ctx->period_id,
    &period_status
  );
  T_rsc_success( status );
test-setup:
  brief: null
  code: |
    rtems_status_code status;
    rtems_task_priority priority;
    rtems_event_set event_set;
    ctx->worker_id = RTEMS_INVALID_ID;

    status = rtems_task_ident(
      RTEMS_SELF,
      RTEMS_SEARCH_ALL_NODES,
      &ctx->task_id
    );
    T_rsc_success( status );

    status = rtems_task_set_priority(
      RTEMS_SELF,
      RTEMS_CURRENT_PRIORITY,
      &ctx->original_priority
    );
    T_rsc_success( status );

    status = rtems_task_set_priority(
      RTEMS_SELF,
      background_task_priority,
      &priority
    );
    T_rsc_success( status );

    status = rtems_task_create(
      rtems_build_name( 'W', 'O', 'R', 'K' ),
      foreground_task_priority,
      RTEMS_MINIMUM_STACK_SIZE,
      RTEMS_DEFAULT_MODES,
      RTEMS_DEFAULT_ATTRIBUTES,
      &ctx->worker_id
    );
    T_rsc_success( status );

    /* Defensive programming: clean away any pending events */
    status = rtems_event_receive(
      RTEMS_ALL_EVENTS,
      RTEMS_NO_WAIT | RTEMS_EVENT_ANY,
      RTEMS_NO_TIMEOUT,
      &event_set
    );
    T_true( status == RTEMS_SUCCESSFUL || status == RTEMS_UNSATISFIED );

    status = rtems_task_start(
      ctx->worker_id,
      WorkerTask,
      (rtems_task_argument) NULL
    );
    T_rsc_success( status );
  description: null
test-stop: null
test-support: |
  static const rtems_interval period_length = 5;
  static const rtems_task_priority background_task_priority = 100;
  static const rtems_task_priority foreground_task_priority = 10;
  static const rtems_event_set wake_main_task_event = RTEMS_EVENT_17;

  static void TickTheClock(
    RtemsRatemonReqPeriod_Context *ctx,
    uint32_t ticks
  )
  {
    uint32_t i;
    for ( i = 0; i < ticks; ++i ) {
      TimecounterTick();
      ctx->test_duration++;
    }
  }

  static rtems_status_code CallPeriodFunction(
    RtemsRatemonReqPeriod_Context *ctx,
    rtems_id id,
    rtems_interval length
  )
  {
    rtems_status_code status;
    status = rtems_rate_monotonic_period( id, length );
    ctx->period_calls++;
    return status;
  }

  static void CreatePeriod( void *ctx_in )
  {
    RtemsRatemonReqPeriod_Context *ctx = ctx_in;
    rtems_status_code status;
    status =  rtems_rate_monotonic_create(
      rtems_build_name( 'R', 'M', 'O', 'N' ),
      &ctx->period_id
    );
    T_rsc_success( status );
  }

  static void DeletePeriod( void *ctx_in )
  {
    RtemsRatemonReqPeriod_Context *ctx = ctx_in;
    T_rsc_success( rtems_rate_monotonic_delete( ctx->period_id ) );
  }

  static void CancelPeriod( void *ctx_in )
  {
    RtemsRatemonReqPeriod_Context *ctx = ctx_in;
    T_rsc_success( rtems_rate_monotonic_cancel( ctx->period_id ) );
  }

  static void CallPeriod( void *ctx_in )
  {
    RtemsRatemonReqPeriod_Context *ctx = ctx_in;
    T_rsc_success( CallPeriodFunction( ctx, ctx->period_id, period_length ) );
  }

  static void CallPeriodTimeout( void *ctx_in )
  {
    RtemsRatemonReqPeriod_Context *ctx = ctx_in;
    rtems_status_code status;
    status = CallPeriodFunction( ctx, ctx->period_id, period_length );
    T_rsc( status, RTEMS_TIMEOUT );
  }

  static void DoAction( void *ctx_in )
  {
    RtemsRatemonReqPeriod_Context *ctx = ctx_in;
    ctx->status = CallPeriodFunction( ctx, ctx->id_param, ctx->length_param );
  }

  static void WorkerTask( rtems_task_argument argument )
  {
    RtemsRatemonReqPeriod_Context *ctx =
      (RtemsRatemonReqPeriod_Context *) argument;
    if ( ctx != NULL ) {
      ctx->worker_todo( ctx );
      T_rsc_success( rtems_event_send( ctx->task_id, wake_main_task_event ) );
    }
    T_rsc_success( rtems_task_suspend( RTEMS_SELF ) );
  }

  static uint32_t OwnerDoWork( void *ctx_in, void (*todo)( void *ctx_arg ) )
  {
    RtemsRatemonReqPeriod_Context *ctx = ctx_in;
    uint32_t ticks_to_wait = period_length + 1;
    rtems_status_code status;
    rtems_event_set event_set;

    ctx->worker_todo = todo;
    status = rtems_task_restart( ctx->worker_id, (rtems_task_argument) ctx );
    T_rsc_success( status );

    for ( ; ticks_to_wait > 0; --ticks_to_wait ) {
      /* Check whether the worker finished executing the action */
      status = rtems_event_receive(
        RTEMS_PENDING_EVENTS,
        RTEMS_NO_WAIT | RTEMS_EVENT_ANY,
        RTEMS_NO_TIMEOUT,
        &event_set
      );
      T_rsc_success( status );

      if ( ( event_set & wake_main_task_event ) == wake_main_task_event ) {
        break;
      }
      TickTheClock( ctx, 1 );
    }

    /* Wait till the worker task finishes */
    status = rtems_event_receive(
      wake_main_task_event,
      RTEMS_DEFAULT_OPTIONS,
      RTEMS_NO_TIMEOUT,
      &event_set
    );
    T_rsc_success( status );

    return period_length + 1 - ticks_to_wait;
  }

  static uint32_t OtherDoWork( void *ctx_in, void (*todo)( void *ctx_arg ) )
  {
    RtemsRatemonReqPeriod_Context *ctx = ctx_in;
    todo( ctx );
    /* Duration = 0 ticks as DoAction() does not call TickTheClock() */
    return 0;
  }

  static void CreatePostponedJobs(
    RtemsRatemonReqPeriod_Context *ctx,
    uint32_t jobs_count
  )
  {
    ctx->postponed_jobs_count = jobs_count;
    if ( ctx->previous_state == RATE_MONOTONIC_ACTIVE ) {
      TickTheClock( ctx, ( jobs_count + 1 ) * period_length );
      OwnerDoWork( ctx, CallPeriodTimeout );
    } else {
      /* ctx->previous_state == RATE_MONOTONIC_INACTIVE || _EXPIRED */
      TickTheClock( ctx, jobs_count * period_length );
    }
  }
test-target: testsuites/validation/tc-ratemon-period.c
test-teardown:
  brief: null
  code: |
    rtems_status_code status;
    rtems_task_priority priority;

    T_rsc_success( rtems_task_delete( ctx->worker_id ) );

    status = rtems_task_set_priority(
      RTEMS_SELF,
      ctx->original_priority,
      &priority
    );
    T_rsc_success( status );
  description: null
text: ${.:text-template}
transition-map:
# ---- RTEMS_PERIOD_STATUS - OK ----
- enabled-by: true
  post-conditions:
    Status: Ok
    State: Nop
    Postponed: Nop
    Delay: None
    Scheduler: Nop
  pre-conditions:
    Id:
      - Valid
    Caller:
      - OwnerTask
    Length:
      - Status
    State:
      - Active
    Postponed: all
    InactiveCause: 'N/A'
# ---- RTEMS_PERIOD_STATUS - NotDef ----
- enabled-by: true
  post-conditions:
    Status: NotDef
    State: Nop
    Postponed: Nop
    Delay: None
    Scheduler: Nop
  pre-conditions:
    Id:
      - Valid
    Caller:
      - OwnerTask
    Length:
      - Status
    State:
      - Inactive
    Postponed: all
    InactiveCause:
      - Canceled
- enabled-by: true
  post-conditions:
    Status: NotDef
    State: Nop
    Postponed: Nop
    Delay: None
    Scheduler: Nop
  pre-conditions:
    Id:
      - Valid
    Caller:
      - OwnerTask
    Length:
      - Status
    State:
      - Inactive
    Postponed: 'N/A'
    InactiveCause:
      - New
# ---- RTEMS_PERIOD_STATUS - TimeOut ----
- enabled-by: true
  post-conditions:
    Status: TimeOut
    State: Nop
    Postponed: Nop
    Delay: None
    Scheduler: Nop
  pre-conditions:
    Id:
      - Valid
    Caller:
      - OwnerTask
    Length:
      - Status
    State:
      - Expired
    Postponed:
      - One
      - Several
    InactiveCause: 'N/A'
# ---- Period: Inactive->Active - OK ----
- enabled-by: true
  post-conditions:
    Status: Ok
    State: Active
    Postponed: Zero
    Delay: None
    Scheduler: Called
  pre-conditions:
    Id:
      - Valid
    Caller:
      - OwnerTask
    Length:
      - Ticks
    State:
      - Inactive
    Postponed: all
    InactiveCause:
      - Canceled
- enabled-by: true
  post-conditions:
    Status: Ok
    State: Active
    Postponed: Zero
    Delay: None
    Scheduler: Called
  pre-conditions:
    Id:
      - Valid
    Caller:
      - OwnerTask
    Length:
      - Ticks
    State:
      - Inactive
    Postponed: 'N/A'
    InactiveCause:
       - New
# ---- Period: Active->Active - OK ----
- enabled-by: true
  post-conditions:
    Status: Ok
    State: Active
    Postponed: Zero
    Delay: TillDeadline
    Scheduler: Called
  pre-conditions:
    Id:
      - Valid
    Caller:
      - OwnerTask
    Length:
      - Ticks
    State:
      - Active
    Postponed:
      - Zero
    InactiveCause: 'N/A'
# ---- Period: Active/Expired->Active - TimeOut ----
- enabled-by: true
  post-conditions:
    Status: TimeOut
    State: Active
    Postponed:
      - if:
          pre-conditions:
            Postponed: One
        then: Zero
      - else: OneOrMore
    Delay: None
    Scheduler: Called
  pre-conditions:
    Id:
      - Valid
    Caller:
      - OwnerTask
    Length:
      - Ticks
    State:
      - Active
      - Expired
    Postponed:
      - One
      - Several
    InactiveCause: 'N/A'
# ---- Error Case - InvId ----
- enabled-by: true
  post-conditions:
    Status: InvId
    State: Nop
    Postponed: Nop
    Delay: None
    Scheduler: Nop
  pre-conditions:
    Id:
      - Invalid
    Caller: all
    Length: all
    State:
      - Inactive
    Postponed: all
    InactiveCause:
      - Canceled
- enabled-by: true
  post-conditions:
    Status: InvId
    State: Nop
    Postponed: Nop
    Delay: None
    Scheduler: Nop
  pre-conditions:
    Id:
      - Invalid
    Caller: all
    Length: all
    State:
      - Inactive
    Postponed: 'N/A'
    InactiveCause:
      - New
- enabled-by: true
  post-conditions:
    Status: InvId
    State: Nop
    Postponed: Nop
    Delay: None
    Scheduler: Nop
  pre-conditions:
    Id:
      - Invalid
    Caller: all
    Length: all
    State:
      - Active
      - Expired
    Postponed: all
    InactiveCause: 'N/A'
# ---- Error Case - NotOwn ----
- enabled-by: true
  post-conditions:
    Status: NotOwn
    State: Nop
    Postponed: Nop
    Delay: None
    Scheduler: Nop
  pre-conditions:
    Id:
      - Valid
    Caller:
      - OtherTask
    Length: all
    State:
      - Inactive
    Postponed: all
    InactiveCause:
      - Canceled
- enabled-by: true
  post-conditions:
    Status: NotOwn
    State: Nop
    Postponed: Nop
    Delay: None
    Scheduler: Nop
  pre-conditions:
    Id:
      - Valid
    Caller:
      - OtherTask
    Length: all
    State:
      - Inactive
    Postponed: 'N/A'
    InactiveCause:
      - New
- enabled-by: true
  post-conditions:
    Status: NotOwn
    State: Nop
    Postponed: Nop
    Delay: None
    Scheduler: Nop
  pre-conditions:
    Id:
      - Valid
    Caller:
      - OtherTask
    Length: all
    State:
      - Active
      - Expired
    Postponed: all
    InactiveCause: 'N/A'
# ---- NA ----
- enabled-by: true
  post-conditions: NeverInExpiredState
  pre-conditions:
    Id: all
    Caller: all
    Length: all
    State:
      - Expired
    Postponed:
      - Zero
    InactiveCause: 'N/A'
type: requirement