The calling convention for sbsControl is:
int sbsControl(char procID, char cmd);where procID is an index to a module returned by sbsSpawn() and cmd is one of the pre-defined constants SBS_ON, SBS_OFF, or SBS_KILL.
When a module is turned ON, sbsControl() calls the xxx_on() function, if it has been defined by the module author and the appropriate pointer assigned in the xxx_init() routine. The xxx_on() function is called only once, before the xxx_cycle() function is put on the "ready queue". Once ON, the module begins cycling as a periodic task, calling xxx_cycle() at the appropriate frequency. When turned OFF, sbsControl() calls the xxx_off() function, if it has been defined by the module author and the appropriate pointer assigned in the xxx_init() routine. The xxx_off() function is called only once, though certain pathological cases can cause a warning that make it appear to be called more than once. When a module is OFF, it is not executing at all, but it is ready to be turned ON. When it has been KILLed, it has been removed from the spawn queue and ceases to be recognized by the sched2 system. Once a module is killed, it can only be used again after initializing it with sbsSpawn(). Upon killing a module, sbsControl() calls xxx_kill().
The module methods have the form:
char xxx_on(uint8_t index) char xxx_cycle(uint8_t index) char xxx_off(uint8_t index) char xxx_kill(uint8_t index)where index is an index into an array of processT structures. Valid return values include:
Note that the only required methods of a module are the xxx_init() and xxx_cycle() functions. xxx_on(), xxx_off(), xxx_kill(), xxx_set(), and xxx_get() are all optional at the discretion of the module author.
Copyright: © 2001,2003,2008,2009 by Richard Voyles. All rights reserved.
Department of Electrical and Computer Engineering,
University of Denver.
Maintained by Richard Voyles
Last modified: Nov. 19, 2009