summaryrefslogtreecommitdiffstats
path: root/spec/bsp/req/interrupt-spurious.yml
blob: ebdd53c1c2f62d1b82655f9dfc04c73ee4ab3829 (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
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: RTEMS_SMP
functional-type: action
links:
- role: interface-function
  uid: ../if/interrupt-spurious
post-conditions:
- name: Result
  states:
  - name: FatalError
    test-code: |
      T_eq_u32( ctx->entry_counter, 0 );
      T_eq_u32( ctx->fatal_counter, 1 );
    text: |
      A fatal error shall occur.
  - name: Dispatch
    test-code: |
      T_eq_u32( ctx->entry_counter, 1 );
      T_eq_u32( ctx->fatal_counter, 0 );
    text: |
      The interrupt entries installed at the interrupt vector specified by the
      ``vector`` parameter shall be dispatched.
  test-epilogue: null
  test-prologue: null
- name: FatalSource
  states:
  - name: SpuriousInterrupt
    test-code: |
      T_eq_int( ctx->fatal_source, RTEMS_FATAL_SOURCE_SPURIOUS_INTERRUPT );
    text: |
      The fatal source shall be equal to
      ${/score/interr/if/source-spurious-interrupt:/name}.
  test-epilogue: null
  test-prologue: null
- name: FatalCode
  states:
  - name: Vector
    test-code: |
      T_eq_ulong( ctx->fatal_code, ctx->vector );
    text: |
      The fatal code shall be equal to the ``vector`` parameter.
  test-epilogue: null
  test-prologue: null
pre-conditions:
- name: First
  states:
  - name: 'Null'
    test-code: |
      *ctx->first = NULL;
    text: |
      While the pointer to the first interrupt entry of the interrupt vector
      specified by the ``vector`` parameter is equal to ${/c/if/null:/name}.
  - name: Entry
    test-code: |
      *ctx->first = &ctx->entry;
    text: |
      While the pointer to the first interrupt entry of the interrupt vector
      specified by the ``vector`` parameter references an object of type
      ${/rtems/intr/if/entry:/name}.
  test-epilogue: null
  test-prologue: null
rationale: null
references: []
requirement-type: functional
skip-reasons: {}
test-action: |
  ctx->entry_counter = 0;
  ctx->fatal_counter = 0;
  ctx->fatal_source = RTEMS_FATAL_SOURCE_LAST;
  ctx->fatal_code = UINT32_MAX;

  if ( setjmp( ctx->before_call ) == 0 ) {
    bsp_interrupt_spurious( ctx->vector );
  }
test-brief: null
test-cleanup: null
test-context:
- brief: |
    This member provides a jump buffer to return from the fatal error.
  description: null
  member: |
    jmp_buf before_call
- brief: |
    This member provides an interrupt entry to be dispatched.
  description: null
  member: |
    rtems_interrupt_entry entry
- brief: |
    This member provides an entry dispatch counter.
  description: null
  member: |
    uint32_t entry_counter
- brief: |
    This member provides a fatal error counter.
  description: null
  member: |
    uint32_t fatal_counter
- brief: |
    This member contains the fatal source.
  description: null
  member: |
    rtems_fatal_source fatal_source
- brief: |
    This member contains a fatal code.
  description: null
  member: |
    rtems_fatal_code fatal_code
- brief: |
    This member contains a valid vector number.
  description: null
  member: |
    rtems_vector_number vector
- brief: |
    This member references the pointer to the first entry of the interrupt
    vector.
  description: null
  member: |
    rtems_interrupt_entry **first
test-context-support: null
test-description: null
test-header: null
test-includes:
- bsp/irq-generic.h
- setjmp.h
test-local-includes:
- tx-support.h
test-prepare: null
test-setup:
  brief: null
  code: |
    ctx->vector = GetValidInterruptVectorNumber( NULL );
    T_assert_lt_u32( ctx->vector, BSP_INTERRUPT_VECTOR_COUNT );

    ctx->first = &bsp_interrupt_handler_table[
      bsp_interrupt_handler_index( ctx->vector )
    ];

    rtems_interrupt_entry_initialize( &ctx->entry, EntryRoutine, ctx, "Info" );
    SetFatalExtension( FatalExtension );
  description: null
test-stop: null
test-support: |
  typedef BspReqInterruptSpurious_Context Context;

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

    ctx = arg;
    ++ctx->entry_counter;
  }

  static void FatalExtension(
    rtems_fatal_source source,
    bool               always_set_to_false,
    rtems_fatal_code   code
  )
  {
    Context *ctx;

    ctx = T_fixture_context();
    T_false( always_set_to_false );
    ctx->fatal_source = source;
    ctx->fatal_code = code;
    ++ctx->fatal_counter;
    longjmp( ctx->before_call, 1 );
  }
test-target: testsuites/validation/tc-bsp-interrupt-spurious.c
test-teardown:
  brief: null
  code: |
    SetFatalExtension( NULL );
  description: null
text: ${.:text-template}
transition-map:
- enabled-by: true
  post-conditions:
    Result: FatalError
    FatalSource: SpuriousInterrupt
    FatalCode: Vector
  pre-conditions:
    First:
    - 'Null'
- enabled-by: true
  post-conditions:
    Result: Dispatch
    FatalSource: N/A
    FatalCode: N/A
  pre-conditions:
    First:
    - Entry
type: requirement