esos/src/esos.c File Reference
Central code for Embedded Systems Operating System (ESOS).
More...
#include "esos.h"
Go to the source code of this file.
Detailed Description
Central code for Embedded Systems Operating System (ESOS).
Definition in file esos.c.
Define Documentation
#define MAX_NUM_USER_TASKS 16 |
Define the maximum number of user tasks in the system
- Note:
- Technically, this is actually the maximum number of tasks that will be running "concurrently". Usually, this number is the maximum number of tasks that the user has defined, UNLESS they are absolutely sure that two (or more) tasks are mutually exclusive in execution.
BOTH "parent" and "child" tasks use this NUMBER to allocate their pool of tasks. So this number should be equal to or greater than the MAXIMUM number of concurrently running child --OR-- parent tasks.
Definition at line 57 of file esos.c.
Function Documentation
ESOS_TASK_HANDLE esos_GetFreeChildTaskStruct |
( |
|
) |
|
Searches child task pool to find a free child task structure and returns a handle (pst) back to the caller
- Return values:
-
| TaskHandle | if a child task structure is available |
| ESOS_BAD_CHILD_TASK_HANDLE | if no structures are available at this time |
Definition at line 186 of file esos.c.
uint8 esos_GetMaxNumberTasks |
( |
void |
|
) |
|
Returns the number of tasks we can execute
- Return values:
-
| N | the number of tasks this version of ESOS can execute |
Definition at line 235 of file esos.c.
uint32 esos_GetRandomUint32 |
( |
void |
|
) |
|
ESOS_TASK_HANDLE esos_RegisterTask |
( |
uint8(*)(ESOS_TASK_HANDLE pstTask) |
taskname |
) |
|
Adds a task to the scheduler. Task will start executing at the next opportunity. (almost immediately)
- Parameters:
-
- Return values:
-
| NULLPTR | if no more tasks can execute at this time (scheduler is full) |
| TaskHandle | the handle of the just registered and scheduled task |
- See also:
- ESOS_USER_TASK
esos_UnregisterTask
Definition at line 94 of file esos.c.
Adds a timer to the ESOS timer service. Timer function will execute at its next opportunity. Timer functions must have void arguments and void returns.
- Parameters:
-
| timername | name under which timer was declared in ESOS_USER_TIMER. and contains the code to run when software timer expires |
| u32_period | period of timer in system ticks (currently, milliseconds) |
- Return values:
-
| ESOS_TMR_FAILURE | if no more timers can added at this time |
| timerhandle | if timer service was registered |
- See also:
- ESOS_USER_TIMER
esos_UnregisterTimer
esos_GetTimerHandle
esos_ChangeTimerPeriod
esos_IsTimerRunning
Definition at line 302 of file esos.c.
void esos_SetRandomUint32Seed |
( |
uint32 |
u32_in |
) |
|
Sets the seed value in the ESOS pseudo-random number generator (PRNG).
- Note:
- ESOS init code sets a seed value for the PRNG. If the application desires a sequence that is not predictable at each execution run, then the seed should be set ONCE with some value that is different with each execution. An idea is to have the user press a key during startup. The value of the ESOS tick when the user presses the key will be different each time. This number would make an ideal PRNG seed.
- See also:
- esos_GetRandomUint32 See http://www.firstpr.com.au/dsp/rand31/ for more information
Definition at line 210 of file esos.c.
uint8 esos_UnregisterTask |
( |
uint8(*)(ESOS_TASK_HANDLE pstTask) |
taskname |
) |
|
Removes the task from the scheduler
- Parameters:
-
- Return values:
-
| TRUE | if task was found in scheduler and removed |
| FALSE | otherwise |
- See also:
- ESOS_USER_TASK
esos_RegisterTask
Definition at line 147 of file esos.c.