summaryrefslogtreecommitdiffstats
path: root/spec/rtems/intr/val/intr-smp-only.yml
blob: 363386754208c1f94ce3c12d1c8cd279a412aaa8 (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
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
copyrights:
- Copyright (C) 2021 embedded brains GmbH & Co. KG
enabled-by: RTEMS_SMP
links: []
test-actions:
- action-brief: |
    Validate the interrupt lock directives.
  action-code: |
    struct {
      int a;
      RTEMS_INTERRUPT_LOCK_MEMBER( member )
      int b;
    } lock = {
      .member = RTEMS_INTERRUPT_LOCK_INITIALIZER( "name" )
    };

    RTEMS_INTERRUPT_LOCK_REFERENCE( ref, &the_lock )
    rtems_interrupt_lock_context lock_context;
  checks:
  - brief: |
      Check that ${../if/lock-reference:/name} expanded to a lock reference
      definition.  Check that the lock is available after static
      initialization.
    code: |
      T_true( ISRLockIsAvailable( ref ) );
    links:
    - role: validation
      uid: ../req/lock-reference-identifier
    - role: validation
      uid: ../req/lock-reference-target
    - role: validation
      uid: ../req/lock-reference-type
  - brief: |
      Check that the lock is available after initialization.
    code: |
      T_true( ISRLockIsAvailable( &lock.member ) );
    links:
    - role: validation
      uid: ../req/lock-initializer
  - brief: |
      Check that maskable interrupts are disabled before the call to
      ${../if/lock-isr-disable:/name} and disabled afterwards.
    code: |
      T_true( AreInterruptsEnabled() );
      T_true( ISRLockIsAvailable( &lock.member ) );
      rtems_interrupt_lock_interrupt_disable( &lock_context );
      T_false( AreInterruptsEnabled() );
      T_true( ISRLockIsAvailable( &lock.member ) );
    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.  Check that the lock is no longer
      available.
    code: |
      T_false( AreInterruptsEnabled() );
      T_true( ISRLockIsAvailable( &lock.member ) );
      rtems_interrupt_lock_acquire_isr( &lock.member, &lock_context );
      T_false( AreInterruptsEnabled() );
      T_false( ISRLockIsAvailable( &lock.member ) );
    links:
    - role: validation
      uid: ../req/lock-acquire
  - 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.  Check that the lock is
      available afterwards.
    code: |
      T_false( AreInterruptsEnabled() );
      T_false( ISRLockIsAvailable( &lock.member ) );
      rtems_interrupt_lock_release( &lock.member, &lock_context );
      T_true( AreInterruptsEnabled() );
      T_true( ISRLockIsAvailable( &lock.member ) );
    links:
    - role: validation
      uid: ../req/lock-release
    - 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.member );
      T_true( AreInterruptsEnabled() );
    links:
    - role: validation
      uid: ../req/lock-destroy
  - brief: |
      Initialize the lock using ${../if/lock-initialize:/name}.  Check that the
      lock is available after initialization.
    code: |
      rtems_interrupt_lock_initialize( &lock.member, "name" );
      T_true( ISRLockIsAvailable( &lock.member ) );
    links:
    - role: validation
      uid: ../req/lock-initialize
  - brief: |
      Check that maskable interrupts are disabled before the call to
      ${../if/lock-acquire:/name} and disabled afterwards.  Check that the lock
      is no longer available.
    code: |
      T_true( AreInterruptsEnabled() );
      T_true( ISRLockIsAvailable( &lock.member ) );
      rtems_interrupt_lock_acquire( &lock.member, &lock_context );
      T_false( AreInterruptsEnabled() );
      T_false( ISRLockIsAvailable( &lock.member ) );
    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.  Check that the lock is
      available afterwards.
    code: |
      T_false( AreInterruptsEnabled() );
      T_false( ISRLockIsAvailable( &lock.member ) );
      rtems_interrupt_lock_release( &lock.member, &lock_context );
      T_true( AreInterruptsEnabled() );
      T_true( ISRLockIsAvailable( &lock.member ) );
    links:
    - role: validation
      uid: ../req/lock-release
    - 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.member );
      T_true( AreInterruptsEnabled() );
    links:
    - role: validation
      uid: ../req/lock-destroy
  links:
  - role: validation
    uid: ../req/lock-declare-identifier
  - role: validation
    uid: ../req/lock-declare-specifier
  - role: validation
    uid: ../req/lock-define-identifier
  - role: validation
    uid: ../req/lock-define-specifier
  - role: validation
    uid: ../req/lock-member-identifier
  - role: validation
    uid: ../req/lock-member-type
test-brief: |
  Tests some ${../if/group:/name} directives.
test-context: []
test-context-support: null
test-description: null
test-header: null
test-includes:
- rtems.h
test-local-includes:
- tx-support.h
test-setup: null
test-stop: null
test-support: |
  RTEMS_INTERRUPT_LOCK_DECLARE( static, the_lock )
  RTEMS_INTERRUPT_LOCK_DEFINE( static, the_lock, "name " )
test-target: testsuites/validation/tc-intr-smp-only.c
test-teardown: null
type: test-case