1 | /* event.h |
---|
2 | * |
---|
3 | * This include file contains the information pertaining to the Event |
---|
4 | * Manager. This manager provides a high performance method of communication |
---|
5 | * and synchronization. |
---|
6 | * |
---|
7 | * Directives provided are: |
---|
8 | * |
---|
9 | * + send an event set to a task |
---|
10 | * + receive event condition |
---|
11 | * |
---|
12 | * |
---|
13 | * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. |
---|
14 | * On-Line Applications Research Corporation (OAR). |
---|
15 | * All rights assigned to U.S. Government, 1994. |
---|
16 | * |
---|
17 | * This material may be reproduced by or for the U.S. Government pursuant |
---|
18 | * to the copyright license under the clause at DFARS 252.227-7013. This |
---|
19 | * notice must appear in all copies of this file and its derivatives. |
---|
20 | * |
---|
21 | * $Id$ |
---|
22 | */ |
---|
23 | |
---|
24 | #ifndef __RTEMS_EVENT_h |
---|
25 | #define __RTEMS_EVENT_h |
---|
26 | |
---|
27 | #ifdef __cplusplus |
---|
28 | extern "C" { |
---|
29 | #endif |
---|
30 | |
---|
31 | #include <rtems/score/object.h> |
---|
32 | #include <rtems/rtems/types.h> |
---|
33 | #include <rtems/rtems/options.h> |
---|
34 | #include <rtems/score/thread.h> |
---|
35 | #include <rtems/score/watchdog.h> |
---|
36 | #include <rtems/rtems/eventset.h> |
---|
37 | |
---|
38 | /* |
---|
39 | * This constant is passed as the event_in to the |
---|
40 | * rtems_event_receive directive to determine which events are pending. |
---|
41 | */ |
---|
42 | |
---|
43 | #define EVENT_CURRENT 0 |
---|
44 | |
---|
45 | /* |
---|
46 | * The following enumerated types indicate what happened while the event |
---|
47 | * manager was in the synchronization window. |
---|
48 | */ |
---|
49 | |
---|
50 | typedef enum { |
---|
51 | EVENT_SYNC_NOTHING_HAPPENED, |
---|
52 | EVENT_SYNC_TIMEOUT, |
---|
53 | EVENT_SYNC_SATISFIED |
---|
54 | } Event_Sync_states; |
---|
55 | |
---|
56 | /* |
---|
57 | * _Event_Manager_initialization |
---|
58 | * |
---|
59 | * DESCRIPTION: |
---|
60 | * |
---|
61 | * This routine performs the initialization necessary for this manager. |
---|
62 | */ |
---|
63 | |
---|
64 | STATIC INLINE void _Event_Manager_initialization( void ); |
---|
65 | |
---|
66 | /* |
---|
67 | * rtems_event_send |
---|
68 | * |
---|
69 | * DESCRIPTION: |
---|
70 | * |
---|
71 | * This routine implements the rtems_event_send directive. It sends |
---|
72 | * event_in to the task specified by ID. If the task is blocked |
---|
73 | * waiting to receive events and the posting of event_in satisfies |
---|
74 | * the task's event condition, then it is unblocked. |
---|
75 | */ |
---|
76 | |
---|
77 | rtems_status_code rtems_event_send ( |
---|
78 | Objects_Id id, |
---|
79 | rtems_event_set event_in |
---|
80 | ); |
---|
81 | |
---|
82 | /* |
---|
83 | * rtems_event_receive |
---|
84 | * |
---|
85 | * DESCRIPTION: |
---|
86 | * |
---|
87 | * This routine implements the rtems_event_receive directive. This |
---|
88 | * directive is invoked when the calling task wishes to receive |
---|
89 | * the event_in event condition. One of the fields in the option_set |
---|
90 | * parameter determines whether the receive request is satisfied if |
---|
91 | * any or all of the events are pending. If the event condition |
---|
92 | * is not satisfied immediately, then the task may block with an |
---|
93 | * optional timeout of TICKS clock ticks or return immediately. |
---|
94 | * This determination is based on another field in the option_set |
---|
95 | * parameter. This directive returns the events received in the |
---|
96 | * event_out parameter. |
---|
97 | */ |
---|
98 | |
---|
99 | rtems_status_code rtems_event_receive ( |
---|
100 | rtems_event_set event_in, |
---|
101 | rtems_option option_set, |
---|
102 | rtems_interval ticks, |
---|
103 | rtems_event_set *event_out |
---|
104 | ); |
---|
105 | |
---|
106 | /* |
---|
107 | * _Event_Seize |
---|
108 | * |
---|
109 | * DESCRIPTION: |
---|
110 | * |
---|
111 | * This routine determines if the event condition event_in is |
---|
112 | * satisfied. If so or if the no_wait option is enabled in option_set, |
---|
113 | * then the procedure returns immediately. If neither of these |
---|
114 | * conditions is true, then the calling task is blocked with an |
---|
115 | * optional timeout of ticks clock ticks. |
---|
116 | */ |
---|
117 | |
---|
118 | void _Event_Seize ( |
---|
119 | rtems_event_set event_in, |
---|
120 | rtems_option option_set, |
---|
121 | rtems_interval ticks, |
---|
122 | rtems_event_set *event_out |
---|
123 | ); |
---|
124 | |
---|
125 | /* |
---|
126 | * _Event_Surrender |
---|
127 | * |
---|
128 | * DESCRIPTION: |
---|
129 | * |
---|
130 | * This routine determines if the event condition of the_thread |
---|
131 | * has been satisfied. If so, it unblocks the_thread. |
---|
132 | */ |
---|
133 | |
---|
134 | void _Event_Surrender ( |
---|
135 | Thread_Control *the_thread |
---|
136 | ); |
---|
137 | |
---|
138 | /* |
---|
139 | * _Event_Timeout |
---|
140 | * |
---|
141 | * DESCRIPTION: |
---|
142 | * |
---|
143 | * This routine is invoked when a task's event receive request |
---|
144 | * has not been satisfied after the specified timeout interval. |
---|
145 | * The task represented by ID will be unblocked and its status |
---|
146 | * code will be set in it's control block to indicate that a timeout |
---|
147 | * has occurred. |
---|
148 | */ |
---|
149 | |
---|
150 | void _Event_Timeout ( |
---|
151 | Objects_Id id, |
---|
152 | void *ignored |
---|
153 | ); |
---|
154 | |
---|
155 | /* |
---|
156 | * The following defines the synchronization flags used by the |
---|
157 | * Event Manager to insure that signals sent to the currently |
---|
158 | * executing thread are received properly. |
---|
159 | */ |
---|
160 | |
---|
161 | EXTERN volatile boolean _Event_Sync; |
---|
162 | EXTERN volatile Event_Sync_states _Event_Sync_state; |
---|
163 | |
---|
164 | #include <rtems/rtems/eventmp.h> |
---|
165 | #include <rtems/rtems/event.inl> |
---|
166 | |
---|
167 | #ifdef __cplusplus |
---|
168 | } |
---|
169 | #endif |
---|
170 | |
---|
171 | #endif |
---|
172 | /* end of include file */ |
---|