[ac7d5ef0] | 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 | |
---|
[5e9b32b] | 31 | #include <rtems/score/object.h> |
---|
[3a4ae6c] | 32 | #include <rtems/rtems/types.h> |
---|
| 33 | #include <rtems/rtems/options.h> |
---|
[5e9b32b] | 34 | #include <rtems/score/thread.h> |
---|
| 35 | #include <rtems/score/watchdog.h> |
---|
[3a4ae6c] | 36 | #include <rtems/rtems/eventset.h> |
---|
[ac7d5ef0] | 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 | * _Event_Manager_initialization |
---|
| 47 | * |
---|
| 48 | * DESCRIPTION: |
---|
| 49 | * |
---|
| 50 | * This routine performs the initialization necessary for this manager. |
---|
| 51 | */ |
---|
| 52 | |
---|
| 53 | STATIC INLINE void _Event_Manager_initialization( void ); |
---|
| 54 | |
---|
| 55 | /* |
---|
| 56 | * rtems_event_send |
---|
| 57 | * |
---|
| 58 | * DESCRIPTION: |
---|
| 59 | * |
---|
| 60 | * This routine implements the rtems_event_send directive. It sends |
---|
| 61 | * event_in to the task specified by ID. If the task is blocked |
---|
| 62 | * waiting to receive events and the posting of event_in satisfies |
---|
| 63 | * the task's event condition, then it is unblocked. |
---|
| 64 | */ |
---|
| 65 | |
---|
| 66 | rtems_status_code rtems_event_send ( |
---|
| 67 | Objects_Id id, |
---|
| 68 | rtems_event_set event_in |
---|
| 69 | ); |
---|
| 70 | |
---|
| 71 | /* |
---|
| 72 | * rtems_event_receive |
---|
| 73 | * |
---|
| 74 | * DESCRIPTION: |
---|
| 75 | * |
---|
| 76 | * This routine implements the rtems_event_receive directive. This |
---|
| 77 | * directive is invoked when the calling task wishes to receive |
---|
| 78 | * the event_in event condition. One of the fields in the option_set |
---|
| 79 | * parameter determines whether the receive request is satisfied if |
---|
| 80 | * any or all of the events are pending. If the event condition |
---|
| 81 | * is not satisfied immediately, then the task may block with an |
---|
| 82 | * optional timeout of TICKS clock ticks or return immediately. |
---|
| 83 | * This determination is based on another field in the option_set |
---|
| 84 | * parameter. This directive returns the events received in the |
---|
| 85 | * event_out parameter. |
---|
| 86 | */ |
---|
| 87 | |
---|
| 88 | rtems_status_code rtems_event_receive ( |
---|
| 89 | rtems_event_set event_in, |
---|
| 90 | rtems_option option_set, |
---|
| 91 | rtems_interval ticks, |
---|
| 92 | rtems_event_set *event_out |
---|
| 93 | ); |
---|
| 94 | |
---|
| 95 | /* |
---|
| 96 | * _Event_Seize |
---|
| 97 | * |
---|
| 98 | * DESCRIPTION: |
---|
| 99 | * |
---|
| 100 | * This routine determines if the event condition event_in is |
---|
| 101 | * satisfied. If so or if the no_wait option is enabled in option_set, |
---|
| 102 | * then the procedure returns immediately. If neither of these |
---|
| 103 | * conditions is true, then the calling task is blocked with an |
---|
| 104 | * optional timeout of ticks clock ticks. |
---|
| 105 | */ |
---|
| 106 | |
---|
| 107 | void _Event_Seize ( |
---|
[3a4ae6c] | 108 | rtems_event_set event_in, |
---|
| 109 | rtems_option option_set, |
---|
| 110 | rtems_interval ticks, |
---|
| 111 | rtems_event_set *event_out |
---|
[ac7d5ef0] | 112 | ); |
---|
| 113 | |
---|
| 114 | /* |
---|
| 115 | * _Event_Surrender |
---|
| 116 | * |
---|
| 117 | * DESCRIPTION: |
---|
| 118 | * |
---|
| 119 | * This routine determines if the event condition of the_thread |
---|
| 120 | * has been satisfied. If so, it unblocks the_thread. |
---|
| 121 | */ |
---|
| 122 | |
---|
| 123 | void _Event_Surrender ( |
---|
| 124 | Thread_Control *the_thread |
---|
| 125 | ); |
---|
| 126 | |
---|
| 127 | /* |
---|
| 128 | * _Event_Timeout |
---|
| 129 | * |
---|
| 130 | * DESCRIPTION: |
---|
| 131 | * |
---|
| 132 | * This routine is invoked when a task's event receive request |
---|
| 133 | * has not been satisfied after the specified timeout interval. |
---|
| 134 | * The task represented by ID will be unblocked and its status |
---|
| 135 | * code will be set in it's control block to indicate that a timeout |
---|
| 136 | * has occurred. |
---|
| 137 | */ |
---|
| 138 | |
---|
| 139 | void _Event_Timeout ( |
---|
| 140 | Objects_Id id, |
---|
| 141 | void *ignored |
---|
| 142 | ); |
---|
| 143 | |
---|
| 144 | /* |
---|
| 145 | * The following defines the synchronization flag used by the |
---|
| 146 | * Event Manager to insure that signals sent to the currently |
---|
| 147 | * executing thread are received properly. |
---|
| 148 | */ |
---|
| 149 | |
---|
| 150 | EXTERN boolean _Event_Sync; /* event manager sync flag */ |
---|
| 151 | |
---|
[3a4ae6c] | 152 | #include <rtems/rtems/eventmp.h> |
---|
| 153 | #include <rtems/rtems/event.inl> |
---|
[ac7d5ef0] | 154 | |
---|
| 155 | #ifdef __cplusplus |
---|
| 156 | } |
---|
| 157 | #endif |
---|
| 158 | |
---|
| 159 | #endif |
---|
| 160 | /* end of include file */ |
---|