Function esp_idf_sys::vTaskAllocateMPURegions

source ยท
pub unsafe extern "C" fn vTaskAllocateMPURegions(
    xTask: TaskHandle_t,
    pxRegions: *const MemoryRegion_t,
)
Expand description

@cond !DOC_EXCLUDE_HEADER_SECTION task. h @code{c} void vTaskAllocateMPURegions( TaskHandle_t xTask, const MemoryRegion_t * const pxRegions ); @endcode @endcond

Memory regions are assigned to a restricted task when the task is created by a call to xTaskCreateRestricted(). These regions can be redefined using vTaskAllocateMPURegions().

@param xTask The handle of the task being updated.

@param pxRegions A pointer to an MemoryRegion_t structure that contains the new memory region definitions.

Example usage: @code{c} // Define an array of MemoryRegion_t structures that configures an MPU region // allowing read/write access for 1024 bytes starting at the beginning of the // ucOneKByte array. The other two of the maximum 3 definable regions are // unused so set to zero. static const MemoryRegion_t xAltRegions portNUM_CONFIGURABLE_REGIONS = { // Base address Length Parameters { ucOneKByte, 1024, portMPU_REGION_READ_WRITE }, { 0, 0, 0 }, { 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). } @endcode @cond !DOC_SINGLE_GROUP \defgroup xTaskCreateRestricted xTaskCreateRestricted @endcond \ingroup Tasks