Chapter 2. API Reference
(continued from previous page)
{ 0, 0, 0 }
};
void vATask( void *pvParameters )
{
// This task was created such that it has access to certain regions of
// memory as defined by the MPU configuration. At some point it is
// desired that these MPU regions are replaced with that defined in the
// xAltRegions const struct above. Use a call to vTaskAllocateMPURegions()
// for this purpose. NULL is used as the task handle to indicate that this
// function should modify the MPU regions of the calling task.
vTaskAllocateMPURegions( NULL, xAltRegions );
// Now the task can continue its function, but from this point on can only
// access its stack and the ucOneKByte array (unless any other statically
// defined or shared regions have been declared elsewhere).
}
Parameters
• xTask: The handle of the task being updated.
• pxRegions: A pointer to an MemoryRegion_t structure that contains the new memory region
definitions.
void vTaskDelete(TaskHandle_t xTaskToDelete)
INCLUDE_vTaskDelete must be defined as 1 for this function to be available. See the configuration section
for more information.
Remove a task from the RTOS real time kernel’s management. The task being deleted will be removed from
all ready, blocked, suspended and event lists.
NOTE: The idle task is responsible for freeing the kernel allocated memory from tasks that have been deleted.
It is therefore important that the idle task is not starved of microcontroller processing time if your application
makes any calls to vTaskDelete (). Memory allocated by the task code is not automatically freed, and should
be freed before the task is deleted.
See the demo application file death.c for sample code that utilises vTaskDelete ().
Example usage:
void vOtherFunction( void )
{
TaskHandle_t xHandle;
// Create the task, storing the handle.
xTaskCreate( vTaskCode, "NAME", STACK_SIZE, NULL, tskIDLE_PRIORITY, &xHandle␣
,→);
// Use the handle to delete the task.
vTaskDelete( xHandle );
}
Parameters
• xTaskToDelete: The handle of the task to be deleted. Passing NULL will cause the calling task
to be deleted.
void vTaskDelay(const TickType_t xTicksToDelay)
Delay a task for a given number of ticks. The actual time that the task remains blocked depends on the tick
rate. The constant portTICK_PERIOD_MS can be used to calculate real time from the tick rate - with the
resolution of one tick period.
INCLUDE_vTaskDelay must be defined as 1 for this function to be available. See the configuration section
for more information.
Espressif Systems 858
Submit Document Feedback
Release v4.4