summaryrefslogtreecommitdiffstats
path: root/spec/rtems/mode/val/modes.yml
blob: bcbb32a2140d592cd569dcf628d6192b4e4bc453 (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
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
copyrights:
- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
enabled-by: true
links: []
test-actions:
- action: |
    /* No action */
  checks:
  - check: |
      T_step_true( ${step}, IsPowerOfTwo( RTEMS_NO_ASR ) );
    description: |
      Check that RTEMS_NO_ASR is a power of two representable as an integer of
      type rtems_mode.
    links:
    - role: validation
      uid: ../req/bit-set
    - role: validation
      uid: ../if/no-asr
  - check: |
      T_step_true( ${step}, IsPowerOfTwo( RTEMS_NO_PREEMPT ) );
    description: |
      Check that RTEMS_NO_PREEMPT is a power of two representable as an integer
      of type rtems_mode.
    links:
    - role: validation
      uid: ../req/bit-set
    - role: validation
      uid: ../if/no-preempt
  - check: |
      T_step_true( ${step}, IsPowerOfTwo( RTEMS_TIMESLICE ) );
    description: |
      Check that RTEMS_TIMESLICE is a power of two representable as an integer
      of type rtems_mode.
    links:
    - role: validation
      uid: ../req/bit-set
    - role: validation
      uid: ../if/timeslice
  description: |
    Validate the non-default task mode constants.
  links: []
- action: |
    /* No action */
  checks:
  - check: |
      T_step_eq_u32( ${step}, RTEMS_ASR, 0 );
    description: |
      Check that RTEMS_ASR is equal to zero.
    links:
    - role: validation
      uid: ../req/default
    - role: validation
      uid: ../if/asr
  - check: |
      T_step_eq_u32( ${step}, RTEMS_DEFAULT_MODES, 0 );
    description: |
      Check that RTEMS_DEFAULT_MODES is equal to zero.
    links:
    - role: validation
      uid: ../req/default
    - role: validation
      uid: ../if/default
  - check: |
      T_step_eq_u32( ${step}, RTEMS_NO_TIMESLICE, 0 );
    description: |
      Check that RTEMS_NO_TIMESLICE is equal to zero.
    links:
    - role: validation
      uid: ../req/default
    - role: validation
      uid: ../if/no-timeslice
  - check: |
      T_step_eq_u32( ${step}, RTEMS_PREEMPT, 0 );
    description: |
      Check that RTEMS_PREEMPT is equal to zero.
    links:
    - role: validation
      uid: ../req/default
    - role: validation
      uid: ../if/preempt
  description: |
    Validate the default task mode constants.
  links: []
- action: |
    /* No action */
  checks:
  - check: |
      T_step_eq_u32(
        ${step},
        RTEMS_ASR_MASK & RTEMS_ALL_MODE_MASKS,
        RTEMS_ASR_MASK
      );
    description: |
      Check that the bitwise and of RTEMS_ASR_MASK and RTEMS_ALL_MODE_MASKS is
      equal to RTEMS_ASR_MASK.
    links:
    - role: validation
      uid: ../req/masks-all
    - role: validation
      uid: ../if/asr-mask
  - check: |
      T_step_eq_u32(
        ${step},
        RTEMS_PREEMPT_MASK & RTEMS_ALL_MODE_MASKS,
        RTEMS_PREEMPT_MASK
      );
    description: |
      Check that the bitwise and of RTEMS_PREEMPT_MASK and RTEMS_ALL_MODE_MASKS
      is equal to RTEMS_PREEMPT_MASK.
    links:
    - role: validation
      uid: ../req/masks-all
    - role: validation
      uid: ../if/preempt-mask
  - check: |
      T_step_eq_u32(
        ${step},
        RTEMS_TIMESLICE_MASK & RTEMS_ALL_MODE_MASKS,
        RTEMS_TIMESLICE_MASK
      );
    description: |
      Check that the bitwise and of RTEMS_TIMESLICE_MASK and
      RTEMS_ALL_MODE_MASKS is equal to RTEMS_TIMESLICE_MASK.
    links:
    - role: validation
      uid: ../req/masks-all
    - role: validation
      uid: ../if/timeslice-mask
  - check: |
      T_step_eq_u32(
        ${step},
        RTEMS_INTERRUPT_MASK & RTEMS_ALL_MODE_MASKS,
        RTEMS_INTERRUPT_MASK
      );
    description: |
      Check that the bitwise and of RTEMS_INTERRUPT_MASK and
      RTEMS_ALL_MODE_MASKS is equal to RTEMS_INTERRUPT_MASK.
    links:
    - role: validation
      uid: ../req/masks-all
    - role: validation
      uid: ../if/interrupt-mask
  description: |
    Validate RTEMS_ALL_MODE_MASKS.
  links: []
- action: |
    /* No action */
  checks:
  - check: |
      T_step_true( ${step}, IsPowerOfTwo( RTEMS_ASR_MASK ) );
    description: |
      Check that RTEMS_ASR_MASK is a power of two representable as an integer
      of type rtems_mode.
    links:
    - role: validation
      uid: ../req/masks
    - role: validation
      uid: ../if/asr-mask
  - check: |
      T_step_true( ${step}, IsPowerOfTwo( RTEMS_PREEMPT_MASK ) );
    description: |
      Check that RTEMS_PREEMPT_MASK is a power of two representable as an
      integer of type rtems_mode.
    links:
    - role: validation
      uid: ../req/masks
    - role: validation
      uid: ../if/preempt-mask
  - check: |
      T_step_true( ${step}, IsPowerOfTwo( RTEMS_TIMESLICE_MASK ) );
    description: |
      Check that RTEMS_TIMESLICE_MASK is a power of two representable as an
      integer of type rtems_mode.
    links:
    - role: validation
      uid: ../req/masks
    - role: validation
      uid: ../if/timeslice-mask
  description: |
    Validate the task mode mask constants except RTEMS_INTERRUPT_MASK.
  links: []
- action: |
    modes = 0;
    modes |= 0xff;
    modes |= RTEMS_ASR_MASK;
    modes |= RTEMS_PREEMPT_MASK;
    modes |= RTEMS_TIMESLICE_MASK;
  checks:
  - check: |
      T_step_eq_int( ${step}, PopCount( modes ), 11 );
    description: |
      Check that the count of set bits in the calculated value is equal to the
      count of task mode mask constants except RTEMS_INTERRUPT_MASK plus eight.
      Since each task mode mask constants except RTEMS_INTERRUPT_MASK is a
      power of two and the bitwise and of 0xff and RTEMS_INTERRUPT_MASK is
      equal to RTEMS_INTERRUPT_MASK this proves that each constant and 0xff has
      a unique value.
    links:
    - role: validation
      uid: ../req/unique
    - role: validation
      uid: ../if/asr-mask
    - role: validation
      uid: ../if/preempt-mask
    - role: validation
      uid: ../if/timeslice-mask
  description: |
    Calculate the bitwise or of all task mode mask constants and 0xff.
  links: []
test-brief: |
  Tests the task mode constants and function-like macros of the Classic API.
test-description: null
test-epilogue: null
test-fixture: null
test-header: null
test-includes:
- rtems.h
test-local-includes: []
test-prologue: |
  rtems_mode modes;
test-support: |
  static bool IsPowerOfTwo( rtems_mode mode )
  {
    return mode != 0 && ( mode & ( mode - 1 ) ) == 0;
  }

  static int PopCount( rtems_mode modes )
  {
    int count;

    count = 0;

    while ( modes != 0 ) {
      ++count;
      modes &= modes - 1;
    }

    return count;
  }
test-target: testsuites/validation/tc-modes.c
type: test-case