RTEMS
tc-event-send.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 #ifdef HAVE_CONFIG_H
35 #include "config.h"
36 #endif
37 
38 #include <rtems/rtems/eventimpl.h>
39 #include <rtems/rtems/tasksdata.h>
40 
41 #include "tr-event-send.h"
42 
43 #include <rtems/test.h>
44 
60 static rtems_status_code EventSend(
61  rtems_id id,
62  rtems_event_set event_in
63 )
64 {
65  return rtems_event_send( id, event_in );
66 }
67 
68 static rtems_status_code EventReceive(
69  rtems_id event_in,
70  rtems_option option_set,
71  rtems_interval ticks,
72  rtems_event_set *event_out
73 )
74 {
75  return rtems_event_receive( event_in, option_set, ticks, event_out );
76 }
77 
78 static rtems_event_set GetPendingEvents( Thread_Control *thread )
79 {
80  RTEMS_API_Control *api;
81 
82  api = thread->API_Extensions[ THREAD_API_RTEMS ];
83  return api->Event.pending_events;
84 }
85 
89 T_TEST_CASE( ReqRtemsEventValClassicSend )
90 {
91  ReqRtemsEventSendReceive_Run( EventSend, EventReceive, GetPendingEvents );
92 }
93 
uint32_t rtems_option
This type is used to represent an option set.
Definition: options.h:121
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
void ReqRtemsEventSendReceive_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 *))
Runs the parameterized test case.
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
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
Classic Tasks Manager Data Structures.