|
SRTOS
|
#include "task.h"Go to the source code of this file.
Functions | |
| uint32_t * | initTaskStackFrame (uint32_t taskStack[], void(*taskFunc)(void)) |
| Initializes a task's stack frame. | |
| STATUS | createTask (uint32_t taskStack[], void(*taskFunc)(void), unsigned int priority, TCB *userAllocatedTCB, TaskNode *userAllocatedTaskNode) |
| Add a task to the scheduler's ready list. | |
| void | SysTick_Handler () |
| This interrupt handler will be called every 1 ms, checking if any tasks need to be unblocked or blocked, and whether a context switch is needed. | |
| void | PendSV_Handler () |
| This interrupt will be pended when a context switch is needed. | |
| void | SVC_Handler () |
| This interrupt will be executed when the scheduler is started. | |
| void | startScheduler () |
| Start the scheduler. | |
| void | setPendSVPending () |
| This function will be called when a context-switch is needed. | |
| void | taskDelay (uint32_t ticksToDelay) |
| This function will delay a task's execution for ticksToDelay ms. | |
| void | __attribute__ ((weak)) |
| uint32_t | getCurTaskWordsAvailable () |
| This function will return the minimum number of words left on the stack. | |
Variables | |
| volatile uint32_t | msTicks = 0 |
| msTicks contains the amount of ticks that have occured since the scheduler started. | |
| TaskNode * | curTask = NULL |
| TaskNode * | readyTasksList [MAX_PRIORITIES] = { NULL } |
| This is a list of linked lists that contain the ready tasks. | |
| void __attribute__ | ( | (weak) | ) |
| STATUS createTask | ( | uint32_t | taskStack[], |
| void(* | taskFunc )(void), | ||
| unsigned int | priority, | ||
| TCB * | userAllocatedTCB, | ||
| TaskNode * | userAllocatedTaskNode ) |
Add a task to the scheduler's ready list.
| taskStack | The user-defined array of size STACK_SIZE |
| taskAddress | The address of the task function |
| priority | The task's priority which must be between 0 and MAX_PRIORITIES - 1, inclusive |
| userAllocatedTCB | The address of the task's TCB allocated by the user |
| userAllocatedTaskNode | The address of the task's TaskNode allocated by the user |
Definition at line 77 of file task.c.
| uint32_t getCurTaskWordsAvailable | ( | ) |
This function will return the minimum number of words left on the stack.
Definition at line 503 of file task.c.
| uint32_t * initTaskStackFrame | ( | uint32_t | taskStack[], |
| void(* | taskFunc )(void) ) |
Initializes a task's stack frame.
This will populate the stack with a dummy xPSR and LR value to allow the task to begin execution. These values will be overwritten once the task starts executing. Also, this will fill the bottom of the stack with canary values so that stack overflows can be detected. The stack is also populated with usage watermarks.
| taskStack | The array created by the user |
| taskFunc | The address of the task function |
Definition at line 46 of file task.c.
| void PendSV_Handler | ( | ) |
This interrupt will be pended when a context switch is needed.
Definition at line 166 of file task.c.
| void setPendSVPending | ( | ) |
| void startScheduler | ( | ) |
Start the scheduler.
Definition at line 218 of file task.c.
| void SVC_Handler | ( | ) |
This interrupt will be executed when the scheduler is started.
Definition at line 203 of file task.c.
| void SysTick_Handler | ( | ) |
This interrupt handler will be called every 1 ms, checking if any tasks need to be unblocked or blocked, and whether a context switch is needed.
Definition at line 115 of file task.c.
| void taskDelay | ( | uint32_t | ticksToDelay | ) |
This function will delay a task's execution for ticksToDelay ms.
This function will move the current task to the blocked list for ticksToDelay ms. If there are no other tasks available to execute, the idleTask will execute.
| ticksToDelay | The number of milliseconds to delay a task's execution. |
Definition at line 237 of file task.c.
| volatile uint32_t msTicks = 0 |
| TaskNode* readyTasksList[MAX_PRIORITIES] = { NULL } |