RTEMS
tc-event-send-receive.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-2-Clause */
2 
10 /*
11  * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
12  *
13  * Redistribution and use in source and binary forms, with or without
14  * modification, are permitted provided that the following conditions
15  * are met:
16  * 1. Redistributions of source code must retain the above copyright
17  * notice, this list of conditions and the following disclaimer.
18  * 2. Redistributions in binary form must reproduce the above copyright
19  * notice, this list of conditions and the following disclaimer in the
20  * documentation and/or other materials provided with the distribution.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
26  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  */
34 
35 /*
36  * Do not manually edit this file. It is part of the RTEMS quality process
37  * and was automatically generated.
38  *
39  * If you find something that needs to be fixed or worded better please
40  * post a report to an RTEMS mailing list or raise a bug report:
41  *
42  * https://docs.rtems.org/branches/master/user/support/bugs.html
43  *
44  * For information on updating and regenerating please refer to:
45  *
46  * https://docs.rtems.org/branches/master/eng/req/howto.html
47  */
48 
49 #ifdef HAVE_CONFIG_H
50 #include "config.h"
51 #endif
52 
53 #include <rtems/rtems/eventimpl.h>
54 #include <rtems/rtems/tasksdata.h>
55 #include <rtems/score/statesimpl.h>
56 #include <rtems/score/threadimpl.h>
57 
58 #include "tr-event-send-receive.h"
59 
60 #include <rtems/test.h>
61 
78 static rtems_status_code EventSend(
79  rtems_id id,
80  rtems_event_set event_in
81 )
82 {
83  return rtems_event_send( id, event_in );
84 }
85 
86 static rtems_status_code EventReceive(
87  rtems_id event_in,
88  rtems_option option_set,
89  rtems_interval ticks,
90  rtems_event_set *event_out
91 )
92 {
93  return rtems_event_receive( event_in, option_set, ticks, event_out );
94 }
95 
96 static rtems_event_set GetPendingEvents( Thread_Control *thread )
97 {
98  RTEMS_API_Control *api;
99 
100  api = thread->API_Extensions[ THREAD_API_RTEMS ];
101  return api->Event.pending_events;
102 }
103 
107 T_TEST_CASE( RtemsEventValSendReceive )
108 {
110  EventSend,
111  EventReceive,
112  GetPendingEvents,
115  );
116 }
117 
137 static rtems_status_code EventSystemSend(
138  rtems_id id,
139  rtems_event_set event_in
140 )
141 {
142  return rtems_event_system_send( id, event_in );
143 }
144 
145 static rtems_status_code EventSystemReceive(
146  rtems_id event_in,
147  rtems_option option_set,
148  rtems_interval ticks,
149  rtems_event_set *event_out
150 )
151 {
153  event_in,
154  option_set,
155  ticks,
156  event_out
157  );
158 }
159 
160 static rtems_event_set GetPendingSystemEvents( Thread_Control *thread )
161 {
162  RTEMS_API_Control *api;
163 
164  api = thread->API_Extensions[ THREAD_API_RTEMS ];
165  return api->System_event.pending_events;
166 }
167 
171 T_TEST_CASE( RtemsEventValSystemSendReceive )
172 {
174  EventSystemSend,
175  EventSystemReceive,
176  GetPendingSystemEvents,
179  );
180 }
181 
rtems_status_code rtems_event_system_send(rtems_id id, rtems_event_set event_in)
Sends a system event set to a task.
uint32_t rtems_option
This type is used to represent an option set.
Definition: options.h:121
#define STATES_WAITING_FOR_SYSTEM_EVENT
Definition: statesimpl.h:57
Event_Control System_event
Definition: tasksdata.h:45
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.
Event_Control Event
Definition: tasksdata.h:43
Classic Event Manager Implementation.
rtems_status_code
This enumeration provides status codes for directives of the Classic API.
Definition: status.h:82
Inlined Routines Associated with Thread State Information.
void * API_Extensions[THREAD_API_LAST+1]
Definition: thread.h:840
Watchdog_Interval rtems_interval
This type is used to represent clock tick intervals.
Definition: types.h:90
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
Objects_Id rtems_id
Values of this type identify an RTEMS object.
Definition: types.h:99
Inlined Routines from the Thread Handler.
#define THREAD_WAIT_CLASS_SYSTEM_EVENT
Indicates that the thread waits for a system event.
Definition: threadimpl.h:2178
#define STATES_WAITING_FOR_EVENT
Definition: statesimpl.h:54
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
#define THREAD_WAIT_CLASS_EVENT
Indicates that the thread waits for an event.
Definition: threadimpl.h:2173
void RtemsEventReqSendReceive_Run(rtems_status_code(*send)(rtems_id, rtems_event_set), rtems_status_code(*receive)(rtems_event_set, rtems_option, rtems_interval, rtems_event_set *), rtems_event_set(*get_pending_events)(Thread_Control *), unsigned int wait_class, int waiting_for_event)
Runs the parameterized test case.
Classic Tasks Manager Data Structures.