R_RTOS  0.1
DistributedRealTimeOperatingSystemfortheARMCortexMArchitecture
Multidimensional Priority-based Task Scheduler

Scheduler and related functions. More...

Data Structures

struct  tskPrioArEle
 Task priority element for the second dimension of the scheduler. More...
 

Typedefs

typedef struct tskPrioArEle TskPrioArEle
 tskPrioArEle
 
typedef struct tskPrioArElePTskPrioArEle
 Pointer to a tskPrioArEle.
 
typedef uint16_t PrioARFlgs
 Used for priority array flags.
 

Functions

RetCode tsk_rmvTskActvTskLst (PTskTCB const tsk)
 Delete a Task from the active task list. More...
 
RetCode tsk_insrtTskActvTskLst (PTskTCB const tsk)
 Insert a task into the active task list. More...
 
void os_INIT_Scheduler (void)
 Initialize the Scheduler mechanism. More...
 
void os_SCHEDULE (void)
 Schedules the next ready task according to its priority. More...
 

Variables

volatile PTskTCB p_cur_tsk_tcb = NULL
 Pointer to currently running task's tskTCB. More...
 
volatile PTskTCB p_nxt_tsk_tcb = NULL
 Pointer to task's tskTCB, which is scheduled to run next. More...
 
volatile BitsOSFlags gOS_FLAGS
 Flags used for maintaining the OS. More...
 

Detailed Description

Scheduler and related functions.

Function Documentation

void os_INIT_Scheduler ( void  )

Initialize the Scheduler mechanism.

Warning
MUST BE CALLED BEFORE THE SCHEDULER CAN BE USED!
void os_SCHEDULE ( void  )

Schedules the next ready task according to its priority.

The task queue is scanned until a task ready to run is found. The queue is sorted according to the tasks' priority beforehand.

Postcondition
p_nxt_tsk_tcb A pointer to the chosen task's tskTCB is stored to this global variable.
If the next task does not equal the current task a context switch is initiated by setting PendSV to pending
RetCode tsk_insrtTskActvTskLst ( PTskTCB const  tsk)

Insert a task into the active task list.

Parameters
[in]tskTask to insert into the active task list
Returns
Return the success of the operation
Precondition
The task has to be ready to be run when queued into the active task list.
Warning
The task must not already be in the active task list.
Note
The active task list is always started by the IDLE task as the root node. THIS MUST NOT CHANGE.
RetCode tsk_rmvTskActvTskLst ( PTskTCB const  tsk)

Delete a Task from the active task list.

Parameters
[in]tskTask to delete from the active task list
Returns
Return the success of the operation

Variable Documentation

gOS_FLAGS

Flags used for maintaining the OS.

Contains various flags for the operation of the OS.

might be obsolete

volatile PTskTCB p_cur_tsk_tcb = NULL

Pointer to currently running task's tskTCB.

To keep track of the currently running task this pointer stores it. Is set to NULL when the currently running task is ended/killed, which is then acknowledged by the context switch (No saving of the current task's context).

Initialized to NULL

volatile PTskTCB p_nxt_tsk_tcb = NULL

Pointer to task's tskTCB, which is scheduled to run next.

The scheduler sets this pointer to the task which is to be run after the context switch. The context switch automatically assigns its value to p_cur_tst_tcb once the context is switched.

Initialized to NULL