RTEMS
Files | Macros | Typedefs | Functions
Event Manager

The Event Manager provides a high performance method of inter-task communication and synchronization. More...

Files

file  event.h
 This header file defines the Event Manager API.
 

Macros

#define RTEMS_EVENT_31   0x80000000
 This constant defines the bit in the event set associated with event 31.
 
#define RTEMS_EVENT_26   0x04000000
 This constant defines the bit in the event set associated with event 26.
 
#define RTEMS_EVENT_24   0x01000000
 This constant defines the bit in the event set associated with event 24.
 
#define RTEMS_EVENT_25   0x02000000
 This constant defines the bit in the event set associated with event 25.
 
#define RTEMS_EVENT_30   0x40000000
 This constant defines the bit in the event set associated with event 30.
 
#define RTEMS_EVENT_29   0x20000000
 This constant defines the bit in the event set associated with event 29.
 
#define RTEMS_EVENT_SYSTEM_TRANSIENT   RTEMS_EVENT_31
 This is a reserved system event for transient usage.
 
#define RTEMS_ALL_EVENTS   0xffffffff
 This constant contains all events in an event set. More...
 
#define RTEMS_EVENT_0   0x00000001
 This constant defines the bit in the event set associated with event 0.
 
#define RTEMS_EVENT_1   0x00000002
 This constant defines the bit in the event set associated with event 1.
 
#define RTEMS_EVENT_10   0x00000400
 This constant defines the bit in the event set associated with event 10.
 
#define RTEMS_EVENT_11   0x00000800
 This constant defines the bit in the event set associated with event 11.
 
#define RTEMS_EVENT_12   0x00001000
 This constant defines the bit in the event set associated with event 12.
 
#define RTEMS_EVENT_13   0x00002000
 This constant defines the bit in the event set associated with event 13.
 
#define RTEMS_EVENT_14   0x00004000
 This constant defines the bit in the event set associated with event 14.
 
#define RTEMS_EVENT_15   0x00008000
 This constant defines the bit in the event set associated with event 15.
 
#define RTEMS_EVENT_16   0x00010000
 This constant defines the bit in the event set associated with event 16.
 
#define RTEMS_EVENT_17   0x00020000
 This constant defines the bit in the event set associated with event 17.
 
#define RTEMS_EVENT_18   0x00040000
 This constant defines the bit in the event set associated with event 18.
 
#define RTEMS_EVENT_19   0x00080000
 This constant defines the bit in the event set associated with event 19.
 
#define RTEMS_EVENT_2   0x00000004
 This constant defines the bit in the event set associated with event 2.
 
#define RTEMS_EVENT_20   0x00100000
 This constant defines the bit in the event set associated with event 20.
 
#define RTEMS_EVENT_21   0x00200000
 This constant defines the bit in the event set associated with event 21.
 
#define RTEMS_EVENT_22   0x00400000
 This constant defines the bit in the event set associated with event 22.
 
#define RTEMS_EVENT_23   0x00800000
 This constant defines the bit in the event set associated with event 23.
 
#define RTEMS_EVENT_27   0x08000000
 This constant defines the bit in the event set associated with event 27.
 
#define RTEMS_EVENT_28   0x10000000
 This constant defines the bit in the event set associated with event 28.
 
#define RTEMS_EVENT_3   0x00000008
 This constant defines the bit in the event set associated with event 3.
 
#define RTEMS_EVENT_4   0x00000010
 This constant defines the bit in the event set associated with event 4.
 
#define RTEMS_EVENT_5   0x00000020
 This constant defines the bit in the event set associated with event 5.
 
#define RTEMS_EVENT_6   0x00000040
 This constant defines the bit in the event set associated with event 6.
 
#define RTEMS_EVENT_7   0x00000080
 This constant defines the bit in the event set associated with event 7.
 
#define RTEMS_EVENT_8   0x00000100
 This constant defines the bit in the event set associated with event 8.
 
#define RTEMS_EVENT_9   0x00000200
 This constant defines the bit in the event set associated with event 9.
 
#define RTEMS_PENDING_EVENTS   0
 This constant used to get the set of pending events in rtems_event_receive().
 

Typedefs

typedef uint32_t rtems_event_set
 This integer type can hold an event set of up to 32 events represented as a bit field.
 

Functions

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. More...
 
rtems_status_code rtems_event_send (rtems_id id, rtems_event_set event_in)
 Sends an event set to a task. More...
 

Detailed Description

The Event Manager provides a high performance method of inter-task communication and synchronization.

Macro Definition Documentation

◆ RTEMS_ALL_EVENTS

#define RTEMS_ALL_EVENTS   0xffffffff

This constant contains all events in an event set.

The value of this constant is identical to RTEMS_EVENT_0 | ... | RTEMS_EVENT_31.

Definition at line 207 of file event.h.

Function Documentation

◆ rtems_event_receive()

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.

This directive can be used to

  • get the pending events of the calling task, or
  • receive events.

To get the pending events use the constant RTEMS_PENDING_EVENTS for the event_in parameter. The pending events are returned to the calling task but the event set of the task is left unaltered. The option_set and ticks parameters are ignored in this case. The directive returns immediately and does not block.

To receive events you have to define an input event condition and some options. The option set specified in option_set defines

  • if the task will wait or poll for the events, and
  • if the task wants to receive all or any of the input events.

The option set is built through a bitwise or of the option constants described below.

The task can wait or poll for the events.

  • Waiting for events is the default and can be emphasized through the use of the RTEMS_WAIT option. The ticks parameter defines how long the task is willing to wait. Use RTEMS_NO_TIMEOUT to wait potentially forever, otherwise set a timeout interval in clock ticks.
  • Not waiting for events (polling) is selected by the RTEMS_NO_WAIT option. If this option is defined, then the ticks parameter is ignored.

The task can receive all or any of the input events specified in event_in.

  • Receiving all input events is the default and can be emphasized through the use of the RTEMS_EVENT_ALL option.
  • Receiving any of the input events is selected by the RTEMS_EVENT_ANY option.

This directive shall be called by a task. Calling this directive from interrupt context is undefined behaviour.

This directive only affects the events specified in event_in. Any pending events that do not correspond to any of the events specified in event_in will be left pending.

To receive all events use the constant RTEMS_ALL_EVENTS for the event_in parameter. This constant is identical to RTEMS_EVENT_0 | ... | RTEMS_EVENT_31 and should not be confused with the option RTEMS_EVENT_ALL.

A task can receive all of the pending events by calling the directive with a value of RTEMS_ALL_EVENTS for the event_in parameter and RTEMS_NO_WAIT | RTEMS_EVENT_ANY for the option_set parameter. The pending events are returned to the calling task and the event set of the task is cleared. If no events are pending then the RTEMS_UNSATISFIED status code will be returned.

Parameters
event_inis the event set of interest. Use RTEMS_PENDING_EVENTS to get the pending events.
option_setis the option set.
ticksis the timeout in clock ticks if the RTEMS_WAIT option was set. Use RTEMS_NO_TIMEOUT to wait potentially forever.
event_outis the pointer to an event set. The received or pending events are stored in the referenced event set if the operation was successful.
Return values
RTEMS_SUCCESSFULThe requested operation was successful.
RTEMS_INVALID_ADDRESSThe event_out parameter was NULL.
RTEMS_UNSATISFIEDThe events of interest were not immediately available.
RTEMS_TIMEOUTThe events of interest were not available within the specified timeout interval.

Definition at line 27 of file eventreceive.c.

◆ rtems_event_send()

rtems_status_code rtems_event_send ( rtems_id  id,
rtems_event_set  event_in 
)

Sends an event set to a task.

This directive sends an event set, event_in, to the task specified by id. Based upon the state of the target task, one of the following situations applies:

  • The target task is blocked waiting for events, then
    • if the waiting task's input event condition is satisfied, then the task is made ready for execution, or
    • otherwise, the event set is posted but left pending and the task remains blocked.
  • The target task is not waiting for events, then the event set is posted and left pending.

Events can be sent by tasks or an ISR.

Specifying RTEMS_SELF for id results in the event set being sent to the calling task.

The event set to send shall be built by a bitwise or of the desired events. The set of valid events is RTEMS_EVENT_0 through RTEMS_EVENT_31. If an event is not explicitly specified in the set, then it is not present.

Identical events sent to a task are not queued. In other words, the second, and subsequent, posting of an event to a task before it can perform an rtems_event_receive() has no effect.

The calling task will be preempted if it has preemption enabled and a higher priority task is unblocked as the result of this directive.

Sending an event set to a global task which does not reside on the local node will generate a request telling the remote node to send the event set to the appropriate task.

Parameters
idis the identifier of the target task to receive the event set.
event_inis the event set to send.
Return values
RTEMS_SUCCESSFULThe requested operation was successful.
RTEMS_INVALID_IDThere was no task with the specified identifier.

Definition at line 25 of file eventsend.c.