AM64x MCU+ SDK  07.03.00
Task

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

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

/* Task priority, stack, stack size and task objects, these MUST be global's */
#define MY_TASK_PRI (8U)
#define MY_TASK_STACK_SIZE (4*1024U)
uint8_t gMyTaskStack[MY_TASK_STACK_SIZE] __attribute__((aligned(32)));
TaskP_Object gMyTask;
/* Application specific task arguments */
typedef struct {
uint32_t value;
} MyTask_Args;
MyTask_Args gMyTask_args;

Example task main function

/* Task entry point or main function for this task */
void myTaskMain(void *args)
{
MyTask_Args *myArgs = (MyTask_Args*)args;
DebugP_assert(myArgs != NULL);
/* myArgs points to structure pointer passed during TaskP_construct */
/* do something in the task */
/* when done call below function, DO NOT 'return` from this function */
}

Example usage to create a task

int32_t status;
TaskP_Params myTaskParams; /* this need not be global variable */
TaskP_Params_init(&myTaskParams);
myTaskParams.name = "MY_TASK";
myTaskParams.stackSize = MY_TASK_STACK_SIZE;
myTaskParams.stack = gMyTaskStack;
myTaskParams.priority = MY_TASK_PRI;
myTaskParams.args = &gMyTask_args;
myTaskParams.taskMain = myTaskMain;
status = TaskP_construct(&gMyTask, &myTaskParams);

API

APIs for Task

TaskP_Params
Parameters passed during TaskP_construct.
Definition: TaskP.h:83
TaskP_Object
Opaque task object used with the task APIs.
Definition: TaskP.h:74
TaskP_Params::args
void * args
Definition: TaskP.h:89
TaskP_construct
int32_t TaskP_construct(TaskP_Object *obj, TaskP_Params *params)
Create a task object.
TaskP_Params::name
const char * name
Definition: TaskP.h:85
TaskP_Params::taskMain
TaskP_FxnMain taskMain
Definition: TaskP.h:90
SystemP_SUCCESS
#define SystemP_SUCCESS
Return status when the API execution was successful.
Definition: SystemP.h:56
TaskP_Params::stackSize
uint32_t stackSize
Definition: TaskP.h:86
TaskP.h
__attribute__
struct tisci_boardcfg_sa2ul_cfg __attribute__
TaskP_Params::priority
uint32_t priority
Definition: TaskP.h:88
TaskP_exit
void TaskP_exit()
Exit current task.
DebugP_assert
#define DebugP_assert(expression)
Function to call for assert check.
Definition: DebugP.h:154
TaskP_Params::stack
uint8_t * stack
Definition: TaskP.h:87
TaskP_Params_init
void TaskP_Params_init(TaskP_Params *params)
Set default values to TaskP_Params.