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:
Darian Leung
2023-03-21 21:29:52 +08:00
parent 7b41d6004a
commit 3562cb8051
25 changed files with 775 additions and 2 deletions

View File

@@ -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,