ESOS32
ESOSOn32-bitProcessors
Functions | Variables
esos.c File Reference

Central code for Embedded Systems Operating System 32-bit (ESOS32) More...

#include "esos.h"
Include dependency graph for esos.c:

Go to the source code of this file.

Functions

ESOS_TASK_HANDLE esos_RegisterTask (uint8_t(*taskname)(ESOS_TASK_HANDLE pstTask))
 
uint8_t esos_UnregisterTask (uint8_t(*taskname)(ESOS_TASK_HANDLE pstTask))
 
ESOS_TASK_HANDLE esos_GetTaskHandle (uint8_t(*taskname)(ESOS_TASK_HANDLE pstTask))
 
ESOS_TASK_HANDLE esos_GetTaskHandleFromID (uint16_t u16_TaskID)
 
ESOS_TASK_HANDLE esos_GetFreeChildTaskStruct ()
 
uint8_t esos_GetMaxNumberTasks (void)
 
uint16_t __esos_hasTickDurationPassed (uint32_t u32_startTick, uint32_t u32_period)
 
void __esos_tmrSvcsExecute (void)
 
ESOS_TMR_HANDLE esos_RegisterTimer (void(*timername)(void), uint32_t u32_period)
 
uint8_t esos_UnregisterTimer (ESOS_TMR_HANDLE hnd_timer)
 
ESOS_TMR_HANDLE esos_GetTimerHandle (void(*pfnTmrFcn)(void))
 
uint8_t esos_ChangeTimerPeriod (ESOS_TMR_HANDLE hnd_timer, uint32_t u32_period)
 
void __esosInit (void)
 
main_t main (void)
 

Variables

struct stTask __astUserTaskPool [MAX_NUM_USER_TASKS]
 
uint8_t __au8UserTaskStructIndex [MAX_NUM_USER_TASKS]
 
struct stTask __astChildTaskPool [MAX_NUM_CHILD_TASKS]
 
uint8_t __u8UserTasksRegistered
 
uint8_t __u8ChildTasksRegistered
 
uint16_t __u16NumTasksEverCreated
 
struct stTimer __astTmrSvcs [MAX_NUM_TMRS]
 
uint8_t __esos_u8TmrSvcsRegistered
 
uint32_t __esos_u32TmrActiveFlags
 
MAILBOX __astMailbox [MAX_NUM_USER_TASKS]
 
uint8_t __au8_MBData [MAX_NUM_USER_TASKS][MAX_SIZE_TASK_MAILBOX]
 
CBUFFER __astCircularBuffers [MAX_NUM_USER_TASKS]
 
uint32_t __esos_u32UserFlags
 
uint32_t __esos_u32SystemFlags
 

Detailed Description

Central code for Embedded Systems Operating System 32-bit (ESOS32)

Definition in file esos.c.

Function Documentation

◆ esos_ChangeTimerPeriod()

uint8_t esos_ChangeTimerPeriod ( ESOS_TMR_HANDLE  hnd_timer,
uint32_t  u32_period 
)

Change a timer period.

Parameters
hnd_timerhandle to timer whose period is to be changed
u32_periodnew period for timer selected by mask
Return values
FALSEif timer is not currently running
TRUEif timer period was changed
See also
esos_RegisterTimer
esos_UnregisterTimer
esos_GetTimerHandle
esos_IsTimerRunning

Definition at line 499 of file esos.c.

◆ esos_GetFreeChildTaskStruct()

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
TaskHandleif a child task structure is available
ESOS_BAD_CHILD_TASK_HANDLEif no structures are available at this time

Definition at line 338 of file esos.c.

◆ esos_GetMaxNumberTasks()

uint8_t esos_GetMaxNumberTasks ( void  )

Returns the number of tasks we can execute

Return values
Nthe number of tasks this version of ESOS can execute

Definition at line 355 of file esos.c.

◆ esos_GetTaskHandle()

ESOS_TASK_HANDLE esos_GetTaskHandle ( uint8_t(*)(ESOS_TASK_HANDLE pstTask)  taskname)

Find the (active) task handle for a given task function

Parameters
tasknamename of task (argument to ESOS_USER_TASK declaration
Return values
NULLPTRif task is not found among the active tasks
TaskHandlethe handle to the task function requested
See also
ESOS_USER_TASK
esos_RegisterTask
esos_UnregisterTask

Definition at line 259 of file esos.c.

◆ esos_GetTaskHandleFromID()

ESOS_TASK_HANDLE esos_GetTaskHandleFromID ( uint16_t  u16_TaskID)

Find the (active) task handle for a given task function

Parameters
u16_TaskIDname of task (argument to ESOS_USER_TASK declaration)
Return values
NULLPTRif task is not found among the active tasks
TaskHandlethe handle to the task function requested
See also
ESOS_USER_TASK
esos_RegisterTask
esos_UnregisterTask

Definition at line 295 of file esos.c.

◆ esos_GetTimerHandle()

ESOS_TMR_HANDLE esos_GetTimerHandle ( void(*)(void)  pfnTmrFcn)

Finds the timer handle to the provided and ACTIVE timer function

Parameters
pfnTmrFcnpointer to timer function (will execute each time timer expires)
Return values
ESOS_TMR_FAILUREcould not find the function in the active timer list
timerHandlehandle to timer
See also
esos_RegisterTimer
esos_UnregisterTimer
esos_ChangeTimerPeriod
esos_IsTimerRunning

Definition at line 472 of file esos.c.

◆ esos_RegisterTask()

ESOS_TASK_HANDLE esos_RegisterTask ( uint8_t(*)(ESOS_TASK_HANDLE pstTask)  taskname)

Adds a task to the scheduler. Task will start executing at the next opportunity. (almost immediately)

Parameters
tasknamename of task (argument to ESOS_USER_TASK declaration
Return values
NULLPTRif no more tasks can execute at this time (scheduler is full)
TaskHandlethe handle of the just registered and scheduled task
See also
ESOS_USER_TASK
esos_UnregisterTask

Definition at line 126 of file esos.c.

◆ esos_RegisterTimer()

ESOS_TMR_HANDLE esos_RegisterTimer ( void(*)(void)  timername,
uint32_t  u32_period 
)

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
timernamename under which timer was declared in ESOS_USER_TIMER. and contains the code to run when software timer expires
u32_periodperiod of timer in system ticks (currently, milliseconds)
Return values
ESOS_TMR_FAILUREif no more timers can added at this time
timerhandleif timer service was registered
See also
ESOS_USER_TIMER
esos_UnregisterTimer
esos_GetTimerHandle
esos_ChangeTimerPeriod
esos_IsTimerRunning

Definition at line 422 of file esos.c.

◆ esos_UnregisterTask()

uint8_t esos_UnregisterTask ( uint8_t(*)(ESOS_TASK_HANDLE pstTask)  taskname)

Removes the task from the scheduler

Parameters
tasknamename of task (argument to ESOS_USER_TASK declaration
Return values
TRUEif task was found in scheduler and removed
FALSEotherwise
See also
ESOS_USER_TASK
esos_RegisterTask

Definition at line 218 of file esos.c.

◆ esos_UnregisterTimer()

uint8_t esos_UnregisterTimer ( ESOS_TMR_HANDLE  hnd_timer)

Removes a timer from the ESOS timer service.

Parameters
hnd_timerhandle to timer to remove
Return values
FALSEif timer wasn't active in the first place
TRUEif timer was stopped and removed
See also
esos_RegisterTimer
esos_GetTimerHandle
esos_ChangeTimerPeriod

Definition at line 451 of file esos.c.