mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-12 05:17:38 +00:00
freertos: Add GetStaticBuffer functions
This commit adds the various ...GetStaticBuffer() functions from upstream FreeRTOS. See https://github.com/FreeRTOS/FreeRTOS-Kernel/pull/641 for more details.
This commit is contained in:
@@ -2899,6 +2899,53 @@ char * pcTaskGetName( TaskHandle_t xTaskToQuery ) /*lint !e971 Unqualified char
|
||||
#endif /* INCLUDE_xTaskGetHandle */
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
|
||||
|
||||
BaseType_t xTaskGetStaticBuffers( TaskHandle_t xTask,
|
||||
StackType_t ** ppuxStackBuffer,
|
||||
StaticTask_t ** ppxTaskBuffer )
|
||||
{
|
||||
BaseType_t xReturn;
|
||||
TCB_t * pxTCB;
|
||||
|
||||
configASSERT( ppuxStackBuffer != NULL );
|
||||
configASSERT( ppxTaskBuffer != NULL );
|
||||
|
||||
pxTCB = prvGetTCBFromHandle( xTask );
|
||||
|
||||
#if ( tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE == 1 )
|
||||
{
|
||||
if( pxTCB->ucStaticallyAllocated == tskSTATICALLY_ALLOCATED_STACK_AND_TCB )
|
||||
{
|
||||
*ppuxStackBuffer = pxTCB->pxStack;
|
||||
*ppxTaskBuffer = ( StaticTask_t * ) pxTCB;
|
||||
xReturn = pdTRUE;
|
||||
}
|
||||
else if( pxTCB->ucStaticallyAllocated == tskSTATICALLY_ALLOCATED_STACK_ONLY )
|
||||
{
|
||||
*ppuxStackBuffer = pxTCB->pxStack;
|
||||
*ppxTaskBuffer = NULL;
|
||||
xReturn = pdTRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
xReturn = pdFALSE;
|
||||
}
|
||||
}
|
||||
#else /* tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE == 1 */
|
||||
{
|
||||
*ppuxStackBuffer = pxTCB->pxStack;
|
||||
*ppxTaskBuffer = ( StaticTask_t * ) pxTCB;
|
||||
xReturn = pdTRUE;
|
||||
}
|
||||
#endif /* tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE == 1 */
|
||||
|
||||
return xReturn;
|
||||
}
|
||||
|
||||
#endif /* configSUPPORT_STATIC_ALLOCATION */
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if ( configUSE_TRACE_FACILITY == 1 )
|
||||
|
||||
UBaseType_t uxTaskGetSystemState( TaskStatus_t * const pxTaskStatusArray,
|
||||
|
Reference in New Issue
Block a user