1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @ingroup ClassicEventImpl |
---|
5 | * |
---|
6 | * @brief Classic Event Implementation |
---|
7 | */ |
---|
8 | |
---|
9 | /* COPYRIGHT (c) 1989-2008. |
---|
10 | * On-Line Applications Research Corporation (OAR). |
---|
11 | * |
---|
12 | * The license and distribution terms for this file may be |
---|
13 | * found in the file LICENSE in this distribution or at |
---|
14 | * http://www.rtems.org/license/LICENSE. |
---|
15 | */ |
---|
16 | |
---|
17 | #ifndef _RTEMS_RTEMS_EVENTIMPL_H |
---|
18 | #define _RTEMS_RTEMS_EVENTIMPL_H |
---|
19 | |
---|
20 | #include <rtems/rtems/event.h> |
---|
21 | #include <rtems/score/thread.h> |
---|
22 | |
---|
23 | #ifdef __cplusplus |
---|
24 | extern "C" { |
---|
25 | #endif |
---|
26 | |
---|
27 | /** |
---|
28 | * @defgroup ClassicEventImpl Classic Event Implementation |
---|
29 | * |
---|
30 | * @ingroup ClassicEvent |
---|
31 | * |
---|
32 | * @{ |
---|
33 | */ |
---|
34 | |
---|
35 | /** |
---|
36 | * This constant is defined to extern most of the time when using |
---|
37 | * this header file. However by defining it to nothing, the data |
---|
38 | * declared in this header file can be instantiated. This is done |
---|
39 | * in a single per manager file. |
---|
40 | */ |
---|
41 | #ifndef RTEMS_EVENT_EXTERN |
---|
42 | #define RTEMS_EVENT_EXTERN extern |
---|
43 | #endif |
---|
44 | |
---|
45 | /** |
---|
46 | * This constant is passed as the event_in to the |
---|
47 | * rtems_event_receive directive to determine which events are pending. |
---|
48 | */ |
---|
49 | #define EVENT_CURRENT 0 |
---|
50 | |
---|
51 | /** |
---|
52 | * The following constant is the value of an event set which |
---|
53 | * has no events pending. |
---|
54 | */ |
---|
55 | #define EVENT_SETS_NONE_PENDING 0 |
---|
56 | |
---|
57 | RTEMS_EVENT_EXTERN Thread_blocking_operation_States _Event_Sync_state; |
---|
58 | |
---|
59 | RTEMS_EVENT_EXTERN Thread_blocking_operation_States _System_event_Sync_state; |
---|
60 | |
---|
61 | /** |
---|
62 | * @brief Event Manager Initialization |
---|
63 | * |
---|
64 | * Event Manager |
---|
65 | * |
---|
66 | * This routine performs the initialization necessary for this manager. |
---|
67 | * |
---|
68 | * - INTERRUPT LATENCY: |
---|
69 | * + single case |
---|
70 | */ |
---|
71 | void _Event_Manager_initialization( void ); |
---|
72 | |
---|
73 | void _Event_Seize( |
---|
74 | rtems_event_set event_in, |
---|
75 | rtems_option option_set, |
---|
76 | rtems_interval ticks, |
---|
77 | rtems_event_set *event_out, |
---|
78 | Thread_Control *executing, |
---|
79 | Event_Control *event, |
---|
80 | Thread_blocking_operation_States *sync_state, |
---|
81 | States_Control wait_state |
---|
82 | ); |
---|
83 | |
---|
84 | /** |
---|
85 | * @brief Surrender Event |
---|
86 | * |
---|
87 | * - INTERRUPT LATENCY: |
---|
88 | * + before flash |
---|
89 | * + after flash |
---|
90 | * + check sync |
---|
91 | */ |
---|
92 | void _Event_Surrender( |
---|
93 | Thread_Control *the_thread, |
---|
94 | rtems_event_set event_in, |
---|
95 | Event_Control *event, |
---|
96 | Thread_blocking_operation_States *sync_state, |
---|
97 | States_Control wait_state |
---|
98 | ); |
---|
99 | |
---|
100 | /** |
---|
101 | * @brief Timeout Event |
---|
102 | */ |
---|
103 | void _Event_Timeout( |
---|
104 | Objects_Id id, |
---|
105 | void *arg |
---|
106 | ); |
---|
107 | |
---|
108 | RTEMS_INLINE_ROUTINE void _Event_Initialize( Event_Control *event ) |
---|
109 | { |
---|
110 | event->pending_events = EVENT_SETS_NONE_PENDING; |
---|
111 | } |
---|
112 | |
---|
113 | /** |
---|
114 | * @brief Checks if on events are posted in the event_set. |
---|
115 | * |
---|
116 | * This function returns TRUE if on events are posted in the event_set, |
---|
117 | * and FALSE otherwise. |
---|
118 | */ |
---|
119 | RTEMS_INLINE_ROUTINE bool _Event_sets_Is_empty( |
---|
120 | rtems_event_set the_event_set |
---|
121 | ) |
---|
122 | { |
---|
123 | return ( the_event_set == 0 ); |
---|
124 | } |
---|
125 | |
---|
126 | /** |
---|
127 | * @brief Posts the given new_events into the event_set passed in. |
---|
128 | * |
---|
129 | * This routine posts the given new_events into the event_set |
---|
130 | * passed in. The result is returned to the user in event_set. |
---|
131 | */ |
---|
132 | RTEMS_INLINE_ROUTINE void _Event_sets_Post( |
---|
133 | rtems_event_set the_new_events, |
---|
134 | rtems_event_set *the_event_set |
---|
135 | ) |
---|
136 | { |
---|
137 | *the_event_set |= the_new_events; |
---|
138 | } |
---|
139 | |
---|
140 | /** |
---|
141 | * @brief Returns the events in event_condition that are set in event_set. |
---|
142 | * |
---|
143 | * This function returns the events in event_condition which are |
---|
144 | * set in event_set. |
---|
145 | */ |
---|
146 | RTEMS_INLINE_ROUTINE rtems_event_set _Event_sets_Get( |
---|
147 | rtems_event_set the_event_set, |
---|
148 | rtems_event_set the_event_condition |
---|
149 | ) |
---|
150 | { |
---|
151 | return ( the_event_set & the_event_condition ); |
---|
152 | } |
---|
153 | |
---|
154 | /** |
---|
155 | * @brief Removes the events in mask from the event_set passed in. |
---|
156 | * |
---|
157 | * This function removes the events in mask from the event_set |
---|
158 | * passed in. The result is returned to the user in event_set. |
---|
159 | */ |
---|
160 | RTEMS_INLINE_ROUTINE rtems_event_set _Event_sets_Clear( |
---|
161 | rtems_event_set the_event_set, |
---|
162 | rtems_event_set the_mask |
---|
163 | ) |
---|
164 | { |
---|
165 | return ( the_event_set & ~(the_mask) ); |
---|
166 | } |
---|
167 | |
---|
168 | /**@}*/ |
---|
169 | |
---|
170 | #ifdef __cplusplus |
---|
171 | } |
---|
172 | #endif |
---|
173 | |
---|
174 | #if defined(RTEMS_MULTIPROCESSING) |
---|
175 | #include <rtems/rtems/eventmp.h> |
---|
176 | #endif |
---|
177 | |
---|
178 | #endif |
---|
179 | /* end of include file */ |
---|