Skip to content

Commit 1c35cb3

Browse files
authored
Enable xTaskGetCurrentTaskHandleForCore() for single core builds (FreeRTOS#978)
Enable xTaskGetCurrentTaskHandleForCore() for single core builds --------- Co-authored-by: Paul Bartell <[email protected]> Co-authored-by: Ching-Hsin Lee <[email protected]>
1 parent 1189198 commit 1c35cb3

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

include/task.h

+1-3
Original file line numberDiff line numberDiff line change
@@ -3574,9 +3574,7 @@ TaskHandle_t xTaskGetCurrentTaskHandle( void ) PRIVILEGED_FUNCTION;
35743574
/*
35753575
* Return the handle of the task running on specified core.
35763576
*/
3577-
#if ( configNUMBER_OF_CORES > 1 )
3578-
TaskHandle_t xTaskGetCurrentTaskHandleForCore( BaseType_t xCoreID ) PRIVILEGED_FUNCTION;
3579-
#endif
3577+
TaskHandle_t xTaskGetCurrentTaskHandleForCore( BaseType_t xCoreID ) PRIVILEGED_FUNCTION;
35803578

35813579
/*
35823580
* Shortcut used by the queue implementation to prevent unnecessary call to

tasks.c

+15-11
Original file line numberDiff line numberDiff line change
@@ -6559,23 +6559,27 @@ static void prvResetNextTaskUnblockTime( void )
65596559

65606560
return xReturn;
65616561
}
6562+
#endif /* #if ( configNUMBER_OF_CORES == 1 ) */
65626563

6563-
TaskHandle_t xTaskGetCurrentTaskHandleForCore( BaseType_t xCoreID )
6564-
{
6565-
TaskHandle_t xReturn = NULL;
6564+
TaskHandle_t xTaskGetCurrentTaskHandleForCore( BaseType_t xCoreID )
6565+
{
6566+
TaskHandle_t xReturn = NULL;
65666567

6567-
traceENTER_xTaskGetCurrentTaskHandleForCore( xCoreID );
6568+
traceENTER_xTaskGetCurrentTaskHandleForCore( xCoreID );
65686569

6569-
if( taskVALID_CORE_ID( xCoreID ) != pdFALSE )
6570-
{
6570+
if( taskVALID_CORE_ID( xCoreID ) != pdFALSE )
6571+
{
6572+
#if ( configNUMBER_OF_CORES == 1 )
6573+
xReturn = pxCurrentTCB;
6574+
#else /* #if ( configNUMBER_OF_CORES == 1 ) */
65716575
xReturn = pxCurrentTCBs[ xCoreID ];
6572-
}
6576+
#endif /* #if ( configNUMBER_OF_CORES == 1 ) */
6577+
}
65736578

6574-
traceRETURN_xTaskGetCurrentTaskHandleForCore( xReturn );
6579+
traceRETURN_xTaskGetCurrentTaskHandleForCore( xReturn );
65756580

6576-
return xReturn;
6577-
}
6578-
#endif /* #if ( configNUMBER_OF_CORES == 1 ) */
6581+
return xReturn;
6582+
}
65796583

65806584
#endif /* ( ( INCLUDE_xTaskGetCurrentTaskHandle == 1 ) || ( configUSE_MUTEXES == 1 ) ) */
65816585
/*-----------------------------------------------------------*/

0 commit comments

Comments
 (0)