RTEMS
tr-event-constant.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-2-Clause */
2 
9 /*
10  * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
11  *
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions
14  * are met:
15  * 1. Redistributions of source code must retain the above copyright
16  * notice, this list of conditions and the following disclaimer.
17  * 2. Redistributions in binary form must reproduce the above copyright
18  * notice, this list of conditions and the following disclaimer in the
19  * documentation and/or other materials provided with the distribution.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 /*
35  * Do not manually edit this file. It is part of the RTEMS quality process
36  * and was automatically generated.
37  *
38  * If you find something that needs to be fixed or worded better please
39  * post a report to an RTEMS mailing list or raise a bug report:
40  *
41  * https://docs.rtems.org/branches/master/user/support/bugs.html
42  *
43  * For information on updating and regenerating please refer to:
44  *
45  * https://docs.rtems.org/branches/master/eng/req/howto.html
46  */
47 
48 #ifdef HAVE_CONFIG_H
49 #include "config.h"
50 #endif
51 
52 #include <rtems.h>
53 
54 #include "tr-event-constant.h"
55 
56 #include <rtems/test.h>
57 
176 static void RtemsEventReqEventConstant_Wrap(
177  rtems_event_set event,
178  int number
179 )
180 {
182  rtems_event_set out;
183 
184  T_plan(32);
185 
186  /* No action */
187  T_step_eq_u32( 0, event, ( (rtems_event_set) 1 ) << number );
188  T_step_eq_u32( 1, event & RTEMS_PENDING_EVENTS, 0 );
189 
190  out = RTEMS_ALL_EVENTS;
191  sc = rtems_event_receive(
194  0,
195  &out
196  );
197  T_step_rsc_success( 2, sc );
198  T_step_eq_u32( 3, out, 0 );
199 
200  out = RTEMS_ALL_EVENTS;
204  0,
205  &out
206  );
207  T_step_rsc_success( 4, sc );
208  T_step_eq_u32( 5, out, 0 );
209 
210  out = RTEMS_ALL_EVENTS;
211  sc = rtems_event_receive(
214  0,
215  &out
216  );
217  T_step_rsc( 6, sc, RTEMS_UNSATISFIED );
218  T_step_eq_u32( 7, out, 0 );
219 
220  out = RTEMS_ALL_EVENTS;
224  0,
225  &out
226  );
227  T_step_rsc( 8, sc, RTEMS_UNSATISFIED );
228  T_step_eq_u32( 9, out, 0 );
229 
230  sc = rtems_event_send( RTEMS_SELF, event );
231  T_step_rsc_success( 10, sc );
232 
233  out = RTEMS_ALL_EVENTS;
234  sc = rtems_event_receive(
237  0,
238  &out
239  );
240  T_step_rsc_success( 11, sc );
241  T_step_eq_u32( 12, out, event );
242 
243  out = RTEMS_ALL_EVENTS;
247  0,
248  &out
249  );
250  T_step_rsc_success( 13, sc );
251  T_step_eq_u32( 14, out, 0 );
252 
253  out = 0;
254  sc = rtems_event_receive(
257  0,
258  &out
259  );
260  T_step_rsc_success( 15, sc );
261  T_step_eq_u32( 16, out, event );
262 
263  out = RTEMS_ALL_EVENTS;
267  0,
268  &out
269  );
270  T_step_rsc( 17, sc, RTEMS_UNSATISFIED );
271  T_step_eq_u32( 18, out, 0 );
272 
273  sc = rtems_event_system_send( RTEMS_SELF, event );
274  T_step_rsc_success( 19, sc );
275 
276  out = RTEMS_ALL_EVENTS;
277  sc = rtems_event_receive(
280  0,
281  &out
282  );
283  T_step_rsc_success( 20, sc );
284  T_step_eq_u32( 21, out, 0 );
285 
286  out = RTEMS_ALL_EVENTS;
290  0,
291  &out
292  );
293  T_step_rsc_success( 22, sc );
294  T_step_eq_u32( 23, out, event );
295 
296  out = RTEMS_ALL_EVENTS;
297  sc = rtems_event_receive(
300  0,
301  &out
302  );
303  T_step_rsc( 24, sc, RTEMS_UNSATISFIED );
304  T_step_eq_u32( 25, out, 0 );
305 
306  out = 0;
310  0,
311  &out
312  );
313  T_step_rsc_success( 26, sc );
314  T_step_eq_u32( 27, out, event );
315 
316  out = RTEMS_ALL_EVENTS;
317  sc = rtems_event_receive(
320  0,
321  &out
322  );
323  T_step_rsc_success( 28, sc );
324  T_step_eq_u32( 29, out, 0 );
325 
326  out = RTEMS_ALL_EVENTS;
330  0,
331  &out
332  );
333  T_step_rsc_success( 30, sc );
334  T_step_eq_u32( 31, out, 0 );
335 }
336 
337 static T_fixture_node RtemsEventReqEventConstant_Node;
338 
340 {
341  T_push_fixture( &RtemsEventReqEventConstant_Node, &T_empty_fixture );
342  RtemsEventReqEventConstant_Wrap( event, number );
343  T_pop_fixture();
344 }
345 
#define RTEMS_NO_WAIT
This option constant indicates that the task does not want to wait on the resource.
Definition: options.h:112
#define RTEMS_DEFAULT_OPTIONS
This option constant is the default option set.
Definition: options.h:79
rtems_status_code rtems_event_system_send(rtems_id id, rtems_event_set event_in)
Sends a system event set to a task.
This status code indicates that the request was not satisfied.
Definition: status.h:154
#define RTEMS_ALL_EVENTS
This constant contains all events in an event set.
Definition: event.h:207
rtems_status_code rtems_event_system_receive(rtems_event_set event_in, rtems_option option_set, rtems_interval ticks, rtems_event_set *event_out)
Receives or gets a system event set.
#define RTEMS_SELF
%
Definition: tasks.h:1046
#define RTEMS_PENDING_EVENTS
This constant used to get the set of pending events in rtems_event_receive().
Definition: event.h:477
rtems_status_code
This enumeration provides status codes for directives of the Classic API.
Definition: status.h:82
void RtemsEventReqEventConstant_Run(rtems_event_set event, int number)
Runs the parameterized test case.
#define RTEMS_EVENT_ANY
This option constant indicates that the task wishes to wait until at least one of the events of inter...
Definition: options.h:99
This header file defines the RTEMS Classic API.
rtems_status_code rtems_event_receive(rtems_event_set event_in, rtems_option option_set, rtems_interval ticks, rtems_event_set *event_out)
Receives or gets an event set.
Definition: eventreceive.c:27
uint32_t rtems_event_set
This integer type can hold an event set of up to 32 events represented as a bit field.
Definition: event.h:94
rtems_status_code rtems_event_send(rtems_id id, rtems_event_set event_in)
Sends an event set to a task.
Definition: eventsend.c:25