refactor(freertos/idf): Move IDF task utility functions to API addition headers

This commit combines various task utility API additions in IDF FreeRTOS and with
their Amazon SMP FreeRTOS addition counterparts. The folloiwng functions have
been moved to freertos_tasks_c_additions.h and idf_additions.h as these API
are considered public:

- xTaskGetCurrentTaskHandleForCPU()
- xTaskGetIdleTaskHandleForCPU()
- xTaskGetAffinity()
- pxTaskGetStackStart()

Also fixed in missing #if macros when vTaskCoreAffinityGet() is called in
Amazon SMP FreerTOS tests.
This commit is contained in:
Darian Leung
2023-08-29 02:07:52 +08:00
parent db9d9658f9
commit 0db40f9e6c
9 changed files with 126 additions and 163 deletions

View File

@@ -3016,12 +3016,6 @@ char * pcTaskGetName( TaskHandle_t xTaskToQuery ) /*lint !e971 Unqualified char
return xIdleTaskHandle[ xPortGetCoreID() ];
}
TaskHandle_t xTaskGetIdleTaskHandleForCPU( UBaseType_t cpuid )
{
configASSERT( cpuid < configNUM_CORES );
configASSERT( ( xIdleTaskHandle[ cpuid ] != NULL ) );
return xIdleTaskHandle[ cpuid ];
}
#endif /* INCLUDE_xTaskGetIdleTaskHandle */
/*----------------------------------------------------------*/
@@ -4677,16 +4671,6 @@ static void prvCheckTasksWaitingTermination( void )
#endif /* configUSE_TRACE_FACILITY */
/*-----------------------------------------------------------*/
BaseType_t xTaskGetAffinity( TaskHandle_t xTask )
{
TCB_t * pxTCB;
pxTCB = prvGetTCBFromHandle( xTask );
return pxTCB->xCoreID;
}
/*-----------------------------------------------------------*/
#if ( configUSE_TRACE_FACILITY == 1 )
static UBaseType_t prvListTasksWithinSingleList( TaskStatus_t * pxTaskStatusArray,
@@ -4809,20 +4793,6 @@ BaseType_t xTaskGetAffinity( TaskHandle_t xTask )
#endif /* INCLUDE_uxTaskGetStackHighWaterMark */
/*-----------------------------------------------------------*/
#if ( INCLUDE_pxTaskGetStackStart == 1 )
uint8_t * pxTaskGetStackStart( TaskHandle_t xTask )
{
TCB_t * pxTCB;
uint8_t * uxReturn;
pxTCB = prvGetTCBFromHandle( xTask );
uxReturn = ( uint8_t * ) pxTCB->pxStack;
return uxReturn;
}
#endif /* INCLUDE_pxTaskGetStackStart */
#if ( INCLUDE_vTaskDelete == 1 )
@@ -4910,7 +4880,7 @@ static void prvResetNextTaskUnblockTime( void )
}
/*-----------------------------------------------------------*/
#if ( ( INCLUDE_xTaskGetCurrentTaskHandle == 1 ) || ( configUSE_MUTEXES == 1 ) || ( configNUM_CORES > 1 ) )
#if ( ( INCLUDE_xTaskGetCurrentTaskHandle == 1 ) || ( configUSE_MUTEXES == 1 ) )
TaskHandle_t xTaskGetCurrentTaskHandle( void )
{
@@ -4924,19 +4894,6 @@ static void prvResetNextTaskUnblockTime( void )
return xReturn;
}
TaskHandle_t xTaskGetCurrentTaskHandleForCPU( BaseType_t cpuid )
{
TaskHandle_t xReturn = NULL;
/*Xtensa-specific: the pxCurrentPCB pointer is atomic so we shouldn't need a lock. */
if( cpuid < configNUM_CORES )
{
xReturn = pxCurrentTCB[ cpuid ];
}
return xReturn;
}
#endif /* ( ( INCLUDE_xTaskGetCurrentTaskHandle == 1 ) || ( configUSE_MUTEXES == 1 ) ) */
/*-----------------------------------------------------------*/