Overview of ECROS Events API

An ECROS event is a single bit (boolean) and is either set (one, true) or clear (zero, false).  Each ECROS task has eight such events.  A task is ready when the pattern of its set events meets the ready condition.  When a task becomes ready, that is it transitions from not being ready to being ready due to one or more events being set, ECROS queues it to be run at the priority it was asigned when it was created.

ECROS provides API functions to:

The Ready Condition

The default ready condition for ECROS is as follows:  Any of events 4, 5, 6 or 7 when set is alone sufficient to ready the task.  If event 0 and event 2 are both set, this is sufficient to ready the task.  Similarly, if event 1 and event 3 are both set, this is also sufficient to ready the task.  The ready condition can be changed only by recompiling ECROS from source.

Inspecting Events

ECROS passes a task's event pattern to its task function as an argument when it is run.  This may be inspected to determine which events are set.  Alternatively, a task can call any of a number of API functions to get information about its events.  For descriptions of these functions, see their individual reference pages.

Accepting Events

The only way for an event to become cleared is for the task to run.  Its task function must call OsAcceptEvents() with the appropriate bit set in the argument.  For an event sent to a task to be "lost" it is therefore necessary to make an error in the task function itself.  No other task can clear the event.

A task is not obliged to accept/clear all its events when its task function runs.  It can leave events set so as to be ready to run again immediately on termination or to enable a single event in one or both of the paired events to ready the task.  A task can test events independently of accepting/clearing them.

Scheduling

The only way that a task becomes queued to be run is by having its events set so as to meet the ready condition.  A task can set its own events, other tasks can send events to it and tasks can receive events indirectly from timers, message queues and interrupt service routines.  When a task that is not ready becomes ready, it is queued to be run by the ECROS scheduler.  For more information on scheduling, see Overview of Tasks.


Last edited December 10, 2002.  All material Copyright © 2002 Graham Davies, ECROS Technology.