Add functions to get the buffers of statically created objects (#641)
Added various ...GetStaticBuffer() functions to get the buffers of statically created objects. --------- Co-authored-by: Paul Bartell <pbartell@amazon.com> Co-authored-by: Nikhil Kamath <110539926+amazonKamath@users.noreply.github.com> Co-authored-by: Gaurav Aggarwal <aggarg@amazon.com>
This commit is contained in:
47
tasks.c
47
tasks.c
@ -2489,6 +2489,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