Update xTaskGetIdleTaskHandle() For SMP (#868)

* Update xTaskGetIdleTaskHandle() in SMP

This commit updates xTaskGetIdleTaskHandle() for SMP in the following ways:

- xTaskGetIdleTaskHandle() no longer accepts xCoreID argument in SMP so that
there is not change in API between single-core and SMP
- xTaskGetIdleTaskHandle() now returns the Active idle task handle in SMP,
which matches the behavior in single-core.
- Added xTaskGetIdleTaskHandleForCore() in SMP which accepts an xCoreID
argument. This function can be used to obtain the Passive idle task handles.

* Update xTaskGetIdleTaskHandle

---------

Co-authored-by: Ching-Hsin Lee <chinglee@amazon.com>
Co-authored-by: chinglee-iot <61685396+chinglee-iot@users.noreply.github.com>
Co-authored-by: Rahul Kar <118818625+kar-rahul-aws@users.noreply.github.com>
Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
This commit is contained in:
Darian 2023-12-05 14:31:11 +08:00 committed by GitHub
parent c0ce725293
commit cd5c774b2b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 35 additions and 34 deletions

36
tasks.c
View file

@ -4472,7 +4472,6 @@ char * pcTaskGetName( TaskHandle_t xTaskToQuery ) /*lint !e971 Unqualified char
#if ( INCLUDE_xTaskGetIdleTaskHandle == 1 )
#if ( configNUMBER_OF_CORES == 1 )
TaskHandle_t xTaskGetIdleTaskHandle( void )
{
traceENTER_xTaskGetIdleTaskHandle();
@ -4485,27 +4484,24 @@ char * pcTaskGetName( TaskHandle_t xTaskToQuery ) /*lint !e971 Unqualified char
return xIdleTaskHandles[ 0 ];
}
#else /* if ( configNUMBER_OF_CORES == 1 ) */
TaskHandle_t xTaskGetIdleTaskHandle( BaseType_t xCoreID )
{
traceENTER_xTaskGetIdleTaskHandle( xCoreID );
/* Ensure the core ID is valid. */
configASSERT( taskVALID_CORE_ID( xCoreID ) == pdTRUE );
/* If xTaskGetIdleTaskHandle() is called before the scheduler has been
* started, then xIdleTaskHandles will be NULL. */
configASSERT( ( xIdleTaskHandles[ xCoreID ] != NULL ) );
traceRETURN_xTaskGetIdleTaskHandle( xIdleTaskHandles[ xCoreID ] );
return xIdleTaskHandles[ xCoreID ];
}
#endif /* if ( configNUMBER_OF_CORES == 1 ) */
TaskHandle_t xTaskGetIdleTaskHandleForCore( BaseType_t xCoreID )
{
traceENTER_xTaskGetIdleTaskHandleForCore( xCoreID );
/* Ensure the core ID is valid. */
configASSERT( taskVALID_CORE_ID( xCoreID ) == pdTRUE );
/* If xTaskGetIdleTaskHandle() is called before the scheduler has been
* started, then xIdleTaskHandles will be NULL. */
configASSERT( ( xIdleTaskHandles[ xCoreID ] != NULL ) );
traceRETURN_xTaskGetIdleTaskHandleForCore( xIdleTaskHandles[ xCoreID ] );
return xIdleTaskHandles[ xCoreID ];
}
#endif /* INCLUDE_xTaskGetIdleTaskHandle */
/*----------------------------------------------------------*/