summaryrefslogtreecommitdiffstats
path: root/spec/rtems/intr/val/intr.yml
blob: df34ffbc8e5fd9c67ea8022c854a6ff9b20d3b4f (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
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
links: []
test-actions:
- action-brief: |
    Validate ${../if/local-disable:/name} and ${../if/local-enable:/name}.
  action-code: |
    rtems_interrupt_level level;
    rtems_interrupt_level level_2;
  checks:
  - brief: |
      Check that maskable interrupts are enabled before the call to
      ${../if/local-disable:/name} and disabled afterwards.
    code: |
      T_true( AreInterruptsEnabled() );
      rtems_interrupt_local_disable( level );
      T_false( AreInterruptsEnabled() );
    links:
    - role: validation
      uid: ../if/local-disable
    - role: validation
      uid: ../req/disable-interrupts
    - role: validation
      uid: ../req/local-disable-assign
  - brief: |
      Check that maskable interrupts are disabled before the call to
      ${../if/local-disable:/name} and disabled afterwards.
    code: |
      T_false( AreInterruptsEnabled() );
      rtems_interrupt_local_disable( level_2 );
      T_false( AreInterruptsEnabled() );
    links:
    - role: validation
      uid: ../if/local-disable
    - role: validation
      uid: ../req/disable-interrupts
    - role: validation
      uid: ../req/local-disable-assign
  - brief: |
      Check that the maskable interrupt status is restored by the call to
      ${../if/local-enable:/name} according to the
      ${../if/local-enable:/params[0]/name} parameter.  In this case maskable
      interrupts are still disabled afterwards.
    code: |
      T_false( AreInterruptsEnabled() );
      rtems_interrupt_local_enable( level_2 );
      T_false( AreInterruptsEnabled() );
    links:
    - role: validation
      uid: ../if/local-enable
    - role: validation
      uid: ../req/local-disable-assign
    - role: validation
      uid: ../req/local-enable
  - brief: |
      Check that the maskable interrupt status is restored by the call to
      ${../if/local-enable:/name} according to the
      ${../if/local-enable:/params[0]/name} parameter.  In this case maskable
      interrupts are enabled afterwards.
    code: |
      T_false( AreInterruptsEnabled() );
      rtems_interrupt_local_enable( level );
      T_true( AreInterruptsEnabled() );
    links:
    - role: validation
      uid: ../if/local-enable
    - role: validation
      uid: ../req/local-disable-assign
    - role: validation
      uid: ../req/local-enable
  links: []
- action-brief: |
    Validate the interrupt lock directives.
  action-code: |
    RTEMS_INTERRUPT_LOCK_DEFINE( , lock, "name" );
    rtems_interrupt_lock_context lock_context;
  checks:
  - brief: |
      Check that maskable interrupts are disabled before the call to
      ${../if/lock-isr-disable:/name} and disabled afterwards.
    code: |
      T_true( AreInterruptsEnabled() );
      rtems_interrupt_lock_interrupt_disable( &lock_context );
      T_false( AreInterruptsEnabled() );
    links:
    - role: validation
      uid: ../if/lock-isr-disable
    - role: validation
      uid: ../req/disable-interrupts
    - role: validation
      uid: ../req/lock-store-interrupt-status
  - brief: |
      Check that the maskable interrupt status is not changed by the
      ${../if/lock-acquire-isr:/name} call.
    code: |
      T_false( AreInterruptsEnabled() );
      rtems_interrupt_lock_acquire_isr( &lock, &lock_context );
      T_false( AreInterruptsEnabled() );
    links: []
  - brief: |
      Check that the maskable interrupt status is restored by the call to
      ${../if/lock-release:/name} according to the
      ${../if/lock-release:/params[1]/name} parameter.
    code: |
      T_false( AreInterruptsEnabled() );
      rtems_interrupt_lock_release( &lock, &lock_context );
      T_true( AreInterruptsEnabled() );
    links:
    - role: validation
      uid: ../req/lock-restore-interrupts
  - brief: |
      Check that maskable interrupts are disabled before the call to
      ${../if/lock-acquire:/name} and disabled afterwards.
    code: |
      T_true( AreInterruptsEnabled() );
      rtems_interrupt_lock_acquire( &lock, &lock_context );
      T_false( AreInterruptsEnabled() );
    links:
    - role: validation
      uid: ../if/lock-acquire
    - role: validation
      uid: ../req/disable-interrupts
    - role: validation
      uid: ../req/lock-store-interrupt-status
  - brief: |
      Check that the maskable interrupt status is restored by the call to
      ${../if/lock-release:/name} according to the
      ${../if/lock-release:/params[1]/name} parameter.
    code: |
      T_false( AreInterruptsEnabled() );
      rtems_interrupt_lock_release( &lock, &lock_context );
      T_true( AreInterruptsEnabled() );
    links:
    - role: validation
      uid: ../req/lock-restore-interrupts
  - brief: |
      Check that the maskable interrupt status is not changed by the
      ${../if/lock-destroy:/name} call.
    code: |
      T_true( AreInterruptsEnabled() );
      rtems_interrupt_lock_destroy( &lock );
      T_true( AreInterruptsEnabled() );
    links: []
  links: []
- action-brief: |
    Validate the interrupt entry initialization.
  action-code: |
    int entry_arg;
    int entry_arg_2;
    const char entry_info[] = "1";
    const char entry_info_2[] = "1";
    rtems_interrupt_entry entry = RTEMS_INTERRUPT_ENTRY_INITIALIZER(
      EntryRoutine,
      &entry_arg,
      entry_info
    );
  checks:
  - brief: |
      Check that the entry is properly initialized by
      ${../if/entry-initializer:/name}.
    code: |
      T_eq_ptr( entry.handler, EntryRoutine );
      T_eq_ptr( entry.arg, &entry_arg );
      T_eq_ptr( entry.next, NULL );
      T_eq_ptr( entry.info, entry_info );
    links:
    - role: validation
      uid: ../req/entry-initializer-handler
    - role: validation
      uid: ../req/entry-initializer-arg
    - role: validation
      uid: ../req/entry-initializer-next
    - role: validation
      uid: ../req/entry-initializer-info
  - brief: |
      Call ${../if/entry-initialize:/name}.  Check that the entry is properly
      initialized by ${../if/entry-initialize:/name}.
    code: |
      entry.next = &entry;
      rtems_interrupt_entry_initialize(
        &entry,
        EntryRoutine2,
        &entry_arg_2,
        entry_info_2
      );
      T_eq_ptr( entry.handler, EntryRoutine2 );
      T_eq_ptr( entry.arg, &entry_arg_2 );
      T_eq_ptr( entry.next, NULL );
      T_eq_ptr( entry.info, entry_info_2 );
    links:
    - role: validation
      uid: ../req/entry-initialize-handler
    - role: validation
      uid: ../req/entry-initialize-arg
    - role: validation
      uid: ../req/entry-initialize-next
    - role: validation
      uid: ../req/entry-initialize-info
  links: []
test-brief: |
  Tests some ${../if/group:/name} directives.
test-context: []
test-context-support: null
test-description: null
test-header: null
test-includes:
- rtems.h
- rtems/irq-extension.h
test-local-includes:
- tx-support.h
test-setup: null
test-stop: null
test-support: |
  static void EntryRoutine( void *arg )
  {
    (void) arg;
  }

  static void EntryRoutine2( void *arg )
  {
    (void) arg;
  }
test-target: testsuites/validation/tc-intr.c
test-teardown: null
type: test-case