Skip to content

Commit

Permalink
Enable xTaskGetCurrentTaskHandleForCore() for single core builds (#978)
Browse files Browse the repository at this point in the history
Enable xTaskGetCurrentTaskHandleForCore() for single core builds

---------
Co-authored-by: Paul Bartell <pbartell@amazon.com>
Co-authored-by: Ching-Hsin Lee <chinglee@amazon.com>
  • Loading branch information
Dazza0 committed Feb 2, 2024
1 parent 1189198 commit 1c35cb3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
4 changes: 1 addition & 3 deletions include/task.h
Original file line number Diff line number Diff line change
Expand Up @@ -3574,9 +3574,7 @@ TaskHandle_t xTaskGetCurrentTaskHandle( void ) PRIVILEGED_FUNCTION;
/*
* Return the handle of the task running on specified core.
*/
#if ( configNUMBER_OF_CORES > 1 )
TaskHandle_t xTaskGetCurrentTaskHandleForCore( BaseType_t xCoreID ) PRIVILEGED_FUNCTION;
#endif
TaskHandle_t xTaskGetCurrentTaskHandleForCore( BaseType_t xCoreID ) PRIVILEGED_FUNCTION;

/*
* Shortcut used by the queue implementation to prevent unnecessary call to
Expand Down
26 changes: 15 additions & 11 deletions tasks.c
Original file line number Diff line number Diff line change
Expand Up @@ -6559,23 +6559,27 @@ static void prvResetNextTaskUnblockTime( void )

return xReturn;
}
#endif /* #if ( configNUMBER_OF_CORES == 1 ) */

TaskHandle_t xTaskGetCurrentTaskHandleForCore( BaseType_t xCoreID )
{
TaskHandle_t xReturn = NULL;
TaskHandle_t xTaskGetCurrentTaskHandleForCore( BaseType_t xCoreID )
{
TaskHandle_t xReturn = NULL;

traceENTER_xTaskGetCurrentTaskHandleForCore( xCoreID );
traceENTER_xTaskGetCurrentTaskHandleForCore( xCoreID );

if( taskVALID_CORE_ID( xCoreID ) != pdFALSE )
{
if( taskVALID_CORE_ID( xCoreID ) != pdFALSE )
{
#if ( configNUMBER_OF_CORES == 1 )
xReturn = pxCurrentTCB;
#else /* #if ( configNUMBER_OF_CORES == 1 ) */
xReturn = pxCurrentTCBs[ xCoreID ];
}
#endif /* #if ( configNUMBER_OF_CORES == 1 ) */
}

traceRETURN_xTaskGetCurrentTaskHandleForCore( xReturn );
traceRETURN_xTaskGetCurrentTaskHandleForCore( xReturn );

return xReturn;
}
#endif /* #if ( configNUMBER_OF_CORES == 1 ) */
return xReturn;
}

#endif /* ( ( INCLUDE_xTaskGetCurrentTaskHandle == 1 ) || ( configUSE_MUTEXES == 1 ) ) */
/*-----------------------------------------------------------*/
Expand Down

0 comments on commit 1c35cb3

Please sign in to comment.