- Attention
- This module is not applicable for NO RTOS environment
Features Supported
- APIs to create and destroy tasks
- APIs to yeild a task
- Ability to specify task priority, task entry function, stack pointer, stack size
- Ability to get task and CPU load
Features NOT Supported
NA
Important Usage Guidelines
- On R5F, and M4F, make sure memory provided as stack is 32b aligned and size is also multiple of 32b
- Stack and stack size MUST be provided by application and is not allocated internally
Example Usage
Include the below file to access the APIs,
Example usage to define task objects and parameters
#define MY_TASK_PRI (8U)
#define MY_TASK_STACK_SIZE (4*1024U)
uint8_t gMyTaskStack[MY_TASK_STACK_SIZE]
__attribute__((aligned(32)));
typedef struct {
} MyTask_Args;
MyTask_Args gMyTask_args;
Example task main function
void myTaskMain(void *args)
{
MyTask_Args *myArgs = (MyTask_Args*)args;
}
Example usage to create a task
myTaskParams.
name =
"MY_TASK";
myTaskParams.
stack = gMyTaskStack;
myTaskParams.
args = &gMyTask_args;
Example usage to get task and CPU load
uint32_t cpuLoad;
DebugP_log(
" LOAD: CPU = %2d.%2d %%\r\n", cpuLoad/100, cpuLoad%100 );
API
APIs for Task