FreeROTS task creation and deletion functions

xTaskCreat() creates a task with a dynamic method

xTaskCreateStatic() creates a task with a static method

xTaskCreateRestricted() creates a task that is restricted using the MPU, and the associated memory uses dynamic memory allocation

vTaskDelete() deletes a task


xTaskCreat(): used to create a task, function prototype

    BaseType_t xTaskCreate( TaskFunction_t pxTaskCode, //Task function

                                                  const char * const pcName //task name

                                                   const uint16_t usStackDepth //task stack size

                                                    void *const pvParameters //Task function parameters

                                                    UBaseType_t uxPriority //Task priority (0~configMAX_PRIORITIES-1)

                                                    TaskHandle_t*const pxCreatedTask //task handle)   

TaskHandle_t xTaskCreateStatic( TaskFunction_t pxTaskCode, //task function
const char * const pcName,       //task name
const uint32_t ulStackDepth, //task stack size
void * const pvParameters, //task function parameter
UBaseType_t uxPriority, //task priority (0~ configMAX_PRIORITIES-1)
StackType_t * const puxStackBuffer, //task stack, usually an array

StaticTask_t * const pxTaskBuffer //task control block)

//To use static compilation, you need to set configSUPPORT_STATIC_ALLOCATION to 1, and provide memory yourself.

xTaskCreatRestricted()

This function is also used to create tasks, but requires mcu to have mpu (memory protection)

vTaskShare ()

Task delete function, compiled when INCLUDE_vTaskDelete is set to 1,

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324832344&siteId=291194637