1 | /** |
---|
2 | * @file rtems/rtems/event.h |
---|
3 | * |
---|
4 | * This include file contains the information pertaining to the Event |
---|
5 | * Manager. This manager provides a high performance method of communication |
---|
6 | * and synchronization. |
---|
7 | * |
---|
8 | * Directives provided are: |
---|
9 | * |
---|
10 | * - send an event set to a task |
---|
11 | * - receive event condition |
---|
12 | * |
---|
13 | */ |
---|
14 | |
---|
15 | /* COPYRIGHT (c) 1989-2008. |
---|
16 | * On-Line Applications Research Corporation (OAR). |
---|
17 | * |
---|
18 | * The license and distribution terms for this file may be |
---|
19 | * found in the file LICENSE in this distribution or at |
---|
20 | * http://www.rtems.com/license/LICENSE. |
---|
21 | * |
---|
22 | * $Id$ |
---|
23 | */ |
---|
24 | |
---|
25 | #ifndef _RTEMS_RTEMS_EVENT_H |
---|
26 | #define _RTEMS_RTEMS_EVENT_H |
---|
27 | |
---|
28 | #ifndef RTEMS_EVENT_EXTERN |
---|
29 | #define RTEMS_EVENT_EXTERN extern |
---|
30 | #endif |
---|
31 | |
---|
32 | #ifdef __cplusplus |
---|
33 | extern "C" { |
---|
34 | #endif |
---|
35 | |
---|
36 | #include <rtems/score/object.h> |
---|
37 | #include <rtems/rtems/status.h> |
---|
38 | #include <rtems/rtems/types.h> |
---|
39 | #include <rtems/rtems/options.h> |
---|
40 | #include <rtems/score/thread.h> |
---|
41 | #include <rtems/score/threadsync.h> |
---|
42 | #include <rtems/score/watchdog.h> |
---|
43 | #include <rtems/rtems/eventset.h> |
---|
44 | |
---|
45 | /** |
---|
46 | * @defgroup ClassicEvent Classic API Event |
---|
47 | * |
---|
48 | * This encapsulates functionality which XXX |
---|
49 | */ |
---|
50 | /**@{*/ |
---|
51 | |
---|
52 | /** |
---|
53 | * This constant is passed as the event_in to the |
---|
54 | * rtems_event_receive directive to determine which events are pending. |
---|
55 | */ |
---|
56 | #define EVENT_CURRENT 0 |
---|
57 | |
---|
58 | /** |
---|
59 | * @brief Event_Manager_initialization |
---|
60 | * |
---|
61 | * This routine performs the initialization necessary for this manager. |
---|
62 | */ |
---|
63 | void _Event_Manager_initialization( void ); |
---|
64 | |
---|
65 | /** |
---|
66 | * @brief rtems_event_send |
---|
67 | * |
---|
68 | * This routine implements the rtems_event_send directive. It sends |
---|
69 | * event_in to the task specified by ID. If the task is blocked |
---|
70 | * waiting to receive events and the posting of event_in satisfies |
---|
71 | * the task's event condition, then it is unblocked. |
---|
72 | */ |
---|
73 | rtems_status_code rtems_event_send ( |
---|
74 | Objects_Id id, |
---|
75 | rtems_event_set event_in |
---|
76 | ); |
---|
77 | |
---|
78 | /** |
---|
79 | * @brief rtems_event_receive |
---|
80 | * |
---|
81 | * This routine implements the rtems_event_receive directive. This |
---|
82 | * directive is invoked when the calling task wishes to receive |
---|
83 | * the event_in event condition. One of the fields in the option_set |
---|
84 | * parameter determines whether the receive request is satisfied if |
---|
85 | * any or all of the events are pending. If the event condition |
---|
86 | * is not satisfied immediately, then the task may block with an |
---|
87 | * optional timeout of TICKS clock ticks or return immediately. |
---|
88 | * This determination is based on another field in the option_set |
---|
89 | * parameter. This directive returns the events received in the |
---|
90 | * event_out parameter. |
---|
91 | */ |
---|
92 | rtems_status_code rtems_event_receive ( |
---|
93 | rtems_event_set event_in, |
---|
94 | rtems_option option_set, |
---|
95 | rtems_interval ticks, |
---|
96 | rtems_event_set *event_out |
---|
97 | ); |
---|
98 | |
---|
99 | /** |
---|
100 | * @brief Event_Seize |
---|
101 | * |
---|
102 | * This routine determines if the event condition event_in is |
---|
103 | * satisfied. If so or if the no_wait option is enabled in option_set, |
---|
104 | * then the procedure returns immediately. If neither of these |
---|
105 | * conditions is true, then the calling task is blocked with an |
---|
106 | * optional timeout of ticks clock ticks. |
---|
107 | */ |
---|
108 | void _Event_Seize ( |
---|
109 | rtems_event_set event_in, |
---|
110 | rtems_option option_set, |
---|
111 | rtems_interval ticks, |
---|
112 | rtems_event_set *event_out |
---|
113 | ); |
---|
114 | |
---|
115 | /** |
---|
116 | * @brief Event_Surrender |
---|
117 | * |
---|
118 | * This routine determines if the event condition of the_thread |
---|
119 | * has been satisfied. If so, it unblocks the_thread. |
---|
120 | */ |
---|
121 | void _Event_Surrender ( |
---|
122 | Thread_Control *the_thread |
---|
123 | ); |
---|
124 | |
---|
125 | /** |
---|
126 | * @brief Event_Timeout |
---|
127 | * |
---|
128 | * This routine is invoked when a task's event receive request |
---|
129 | * has not been satisfied after the specified timeout interval. |
---|
130 | * The task represented by ID will be unblocked and its status |
---|
131 | * code will be set in it's control block to indicate that a timeout |
---|
132 | * has occurred. |
---|
133 | */ |
---|
134 | void _Event_Timeout ( |
---|
135 | Objects_Id id, |
---|
136 | void *ignored |
---|
137 | ); |
---|
138 | |
---|
139 | /** |
---|
140 | * @brief he following defines the synchronization flag used by the |
---|
141 | */ |
---|
142 | RTEMS_EVENT_EXTERN volatile Thread_blocking_operation_States _Event_Sync_state; |
---|
143 | |
---|
144 | #if defined(RTEMS_MULTIPROCESSING) |
---|
145 | #include <rtems/rtems/eventmp.h> |
---|
146 | #endif |
---|
147 | #ifndef __RTEMS_APPLICATION__ |
---|
148 | #include <rtems/rtems/event.inl> |
---|
149 | #endif |
---|
150 | |
---|
151 | #ifdef __cplusplus |
---|
152 | } |
---|
153 | #endif |
---|
154 | |
---|
155 | /**@}*/ |
---|
156 | |
---|
157 | #endif |
---|
158 | /* end of include file */ |
---|