ECROS API Function OsStart()

OsResultE OsStart( Int8T tickSize );

Function OsStart() should be called by the client application to hand over control of the CPU to ECROS.  The function does not normally return.  After calling it, application code runs only as task functions under control of the ECROS scheduler.  Enough application initialization must have been performed prior to calling OsStart() to ensure that one or more task functions will be run.  At minimum, a task function must have been bound to a task and provision made to ready that task directly via an event or indirectly via a timer or message.  If this is not done, ECROS will not find a client task ready and no application activity will take place.  Further initialization may be performed in task functions, although most applications will perform all initialization prior to calling OsStart().

The argument to OsStart() controls the duration of a time tick.  If it is zero, the default time tick (usually 1 ms, but may depend on the platform) will be used.  An argument value of 1 doubles the tick size, 2 quadruples it, etc.  Negative values also successively halve the tick size to 0.5, 0.25 ms, etc.  See Overview of Timers for more information and check the platform for the default tick size and what range of tick sizes can be selected.

Example

The example below shows the initialization of a simple application.  It has a single task that is readied at intervals of 25 ticks by a repeating timer using event 4.  OsStart() is called after all application initialization.  The default time tick size is selected by passing zero as the argument value.


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