R_RTOS
0.1
DistributedRealTimeOperatingSystemfortheARMCortexMArchitecture
|
Functions for creating, initializing, maintaining and handling a task timers. More...
Data Structures | |
struct | sysTimerStruc |
Struct for system timer maintenance. More... | |
struct | tskTimerStruc |
Struct for task timer maintenance. More... | |
struct | timerStruc |
Struct for timer maintenance. More... | |
Macros | |
#define | TMR_INVALID_TIME (LifeTime)0xFFFFFFFFu |
Value for an invalid LifeTime. | |
#define | TMR_PIT_DELAY (uint32_t)0x3u |
Delay compensation between PIT and TPM timers. More... | |
#define | MEM_OBJECTS_TMR ((uint8_t)0x4u) |
Number of SyncEle that will be allocated by the Timer mechanism in its memory pool. More... | |
Typedefs | |
typedef uint16_t | WaitTime |
Time to wait for a Timer. | |
typedef uint32_t | SysTime |
Used to describe a systemtime. | |
typedef uint8_t | SysTicks |
Amount of SysTicks. | |
typedef uint16_t | TmrTime |
Used to describe the time of a software timer. | |
typedef uint32_t | LifeTime |
Used to describe time in the system as a timestamp. | |
typedef enum timerTypeEn | TimerType |
Enumeration of all the different types of software timers. | |
typedef struct sysTimerStruc | SysTimer |
Struct for system timer maintenance. | |
typedef struct tskTimerStruc | TskTimer |
Struct for task timer maintenance. | |
typedef struct timerStruc | Timer |
Struct for timer maintenance. | |
Enumerations |
Functions | |
void | os_SCHEDULE (void) |
Schedules the next ready task according to its priority. More... | |
static RetCode | tmr_InsertSysTmrQ (TmrFktCall *sysFktTmr, LifeTime expires) |
Insert the given TmrFktCall object into the system timer queue according to its expiration time. More... | |
static RetCode | tmr_InsertTskTmrQ (PTskTCB tsk, LifeTime expires) |
Insert the given TskTCB object into the task timer queue according to its expiration time. More... | |
RetCode | tmr_INIT (void) |
Calibrate the PIT Timer periodically. More... | |
RetCode | tmr_setSysTimer (SysFktID fktID, TmrTime msToWait, uint8_t periodicity) |
Sets up a Timer to call a SysFkt corresponding to the given SysFktID as soon as the timer expires. More... | |
RetCode | tmr_setTskTimer (PTskTCB tsk, TmrTime msToWait) |
Sets up a Timer for a task and queues it into the Timer queue according to its WaitTime relative to the current PIT value. More... | |
void | tmr_SysTimerElapsed (void) |
Function to be called as soon as a system Timer expires. More... | |
void | tmr_TskTimerElapsed (void) |
Function to be called as soon as a task Timer expires. More... | |
RetCode | tmr_GiveUpOnTMR (PTskTCB const tsk) |
Forces the deletion of a task's Timer from the Timer queue and adjusts the queue accordingly. More... | |
Variables | |
SysFkt | sys_SysFkt [] |
System function array to hold various kinds of system functions. System functions can be referenced by their index in this array. | |
static MemPoolID | memPoolID_TMR |
Memory Pool ID for the timer's memory pool. More... | |
static Timer | tskTMR |
The start node for the task Timer queue. More... | |
static Timer | sysTMR |
The start node for the system Timer queue. More... | |
Functions for creating, initializing, maintaining and handling a task timers.
#define MEM_OBJECTS_TMR ((uint8_t)0x4u) |
Number of SyncEle that will be allocated by the Timer mechanism in its memory pool.
#define TMR_PIT_DELAY (uint32_t)0x3u |
Delay compensation between PIT and TPM timers.
Since the PIT and TPM timers are driven by different clock sources (BusClock for PIT; OSCERCLK for TPM) they might suffer from a desynchronization. In order to overcome this issue, a small delay is allowed.
enum timerTypeEn |
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.
Forces the deletion of a task's Timer from the Timer queue and adjusts the queue accordingly.
[in] | tsk | Pointer to the task's TskTcb |
If a task is destroyed, which still has a Timer, this Timer needs to be deleted from the queue and the timer might need to be adjusted accordingly.
Triggers the scheduler!
RetCode tmr_INIT | ( | void | ) |
Calibrate the PIT Timer periodically.
Since the PIT timer is clocked by the Bus clock whereas the TPM module has various clock sources the two timers drift away from each other. To compensate this behavior the PIT timer is calibrated in intervals according to a TPM timer.
|
static |
Insert the given TmrFktCall object into the system timer queue according to its expiration time.
[in] | sysFktTmr | Pointer to the TmrFktCall object to insert |
[in] | expires | Expiration time |
Sets up a Timer to call a SysFkt corresponding to the given SysFktID as soon as the timer expires.
[in] | fktID | SysFktID of the function to call upon expiration |
[in] | msToWait | Period of time to wait in ms |
[in] | periodicity | Periodicity of the timer (if set to 1 the timer will reset itself) |
Sets up a Timer for a task and queues it into the Timer queue according to its WaitTime relative to the current PIT value.
[in] | tsk | Pointer to the task's TskTcb |
[in] | msToWait | Period of time to wait in ms. |
Sets up a Timer for the given task and queues the Timer into the Timer queue. The Timer, which expires the earliest is always the start of the list. Might adjust the startTMRNode.
void tmr_SysTimerElapsed | ( | void | ) |
Function to be called as soon as a system Timer expires.
Calls the system function and re-sets it according to its periodicty settings.
void tmr_TskTimerElapsed | ( | void | ) |
Function to be called as soon as a task Timer expires.
Adjusts the TskEvtFlags and sets the task ready (if it is not waiting on any other event). Also maintains the Timer queue and automatically scans for more Timers to be expired. Resets the timer which triggers the next Timer.
Triggers the scheduler!
|
static |
|
static |
The start node for the system Timer queue.
Initialized to NULL.
|
static |
The start node for the task Timer queue.
Initialized to NULL.