R_RTOS  0.1
DistributedRealTimeOperatingSystemfortheARMCortexMArchitecture
System Maintenance

Functions for system functionality (system maintenance). More...

Functions

void updateTimersAfterSleep (void)
 Updates all used timers after a wake up. More...
 
RetCode __initOS (void)
 Initialize the operating system. More...
 
void tskIdle (void)
 IDLE Task, that must always be ready to run and must not finish execution. More...
 
void tsk_EndTheTask (void)
 Default function to be jumped to after a task finished its execution. More...
 
RetCode SVC_HandlerMain (uint32_t *svc_args)
 Is called by the SVC Exception. More...
 

Variables

PTskTCB const pIDLETsk
 Constant pointer to the IDLE Task's tskTCB. More...
 
volatile PTskTCB p_cur_tsk_tcb
 Pointer to currently running task's tskTCB. More...
 
volatile PTskTCB p_nxt_tsk_tcb
 Pointer to task's tskTCB, which is scheduled to run next. More...
 
volatile BitsOSFlags gOS_FLAGS
 Flags used for maintaining the OS. More...
 
const uint8_t offsetOfTskState = OFFSETOF( TskTCB, tskState )
 Offset of the TskState property inside a TskTCB. More...
 
SysFkt sys_SysFkt [AMOUNT_SYS_FKT]
 System function array to hold various kinds of system functions. System functions can be referenced by their index in this array.
 
volatile uint32_t svc_EXCReturn
 EXC_RETURN value for the SVC Call. More...
 

Detailed Description

Functions for system functionality (system maintenance).

Function Documentation

RetCode __initOS ( void  )

Initialize the operating system.

RetCode __initOS( void );

Returns
RetCode Return the success of the operation

initializes all needed HW and SW components for the operating system to function properly.

RetCode SVC_HandlerMain ( uint32_t *  svc_args)

Is called by the SVC Exception.

Parameters
[in]svc_argsPointer to the function arguments passed alongside the SVC Call
Returns
RetCode Return the success of the operation

According to the svcCode used to call the SVC exception various functions are executed further on. The function parameters are extracted from the stack frame.

void tsk_EndTheTask ( void  )

Default function to be jumped to after a task finished its execution.

Simply an endless loop.

void tskIdle ( void  )

IDLE Task, that must always be ready to run and must not finish execution.

The IDLE Task must always be available to be chosen by the scheduler. If no other task is ready to run the IDLE Task will be scheduled and switched to. System maintenance and activating low power modes might be done in this task.

void updateTimersAfterSleep ( void  )

Updates all used timers after a wake up.

Every HW timer in use is updated/adjusted according to the time spent in the low power mode.

Variable Documentation

volatile BitsOSFlags gOS_FLAGS

Flags used for maintaining the OS.

Contains various flags for the operation of the OS.

might be obsolete

offsetOfTskState = OFFSETOF( TskTCB, tskState )

Offset of the TskState property inside a TskTCB.

The offset is calculated dynamically to exclude compiler optimization errors.

volatile PTskTCB p_cur_tsk_tcb

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

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

PTskTCB const pIDLETsk

Constant pointer to the IDLE Task's tskTCB.

Since the IDLE Task is not allocated dynamically its location in the memory will not change during runtime. This Pointer is used to always reference the IDLE Task and thus the start of the list containing all tasks in the System.

Initialized to the address of the IDLE Task's tskTCB.

svc_EXCReturn

EXC_RETURN value for the SVC Call.

The return of the SVC Call can be influenced by setting this variable. According to its value the stack pointer used for unstacking and the mode to return to are altered.

Possible Values (ARM Cortex M0+):

VALUE MEANING
0xFFFFFFF1 Return to Handler mode ( e.g. for nested exceptions )
0xFFFFFFF9 Return to Thread mode using Main Stack Pointer
0xFFFFFFFD Return to Thread mode using Process Stack Pointer