Skip to content

Commit ec47ccc

Browse files
committed
Rename the minimal idle task to passive idle task
* Rename vApplicationMinimalIdleTask to vApplicationPassiveIdleTask * Rename the macro configUSE_MINIMAL_IDLE_HOOK to configUSE_PASSIVE_IDLE_HOOK * Update xTaskGetIdleTaskHandle for SMP
1 parent c20e5ae commit ec47ccc

File tree

3 files changed

+64
-46
lines changed

3 files changed

+64
-46
lines changed

include/FreeRTOS.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@
170170
#endif
171171

172172
#if ( configNUMBER_OF_CORES > 1 )
173-
#ifndef configUSE_MINIMAL_IDLE_HOOK
174-
#error Missing definition: configUSE_MINIMAL_IDLE_HOOK must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
173+
#ifndef configUSE_PASSIVE_IDLE_HOOK
174+
#error Missing definition: configUSE_PASSIVE_IDLE_HOOK must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
175175
#endif
176176
#endif
177177

@@ -476,9 +476,9 @@
476476
#define configUSE_CORE_AFFINITY 0
477477
#endif /* configUSE_CORE_AFFINITY */
478478

479-
#ifndef configUSE_MINIMAL_IDLE_HOOK
480-
#define configUSE_MINIMAL_IDLE_HOOK 0
481-
#endif /* configUSE_MINIMAL_IDLE_HOOK */
479+
#ifndef configUSE_PASSIVE_IDLE_HOOK
480+
#define configUSE_PASSIVE_IDLE_HOOK 0
481+
#endif /* configUSE_PASSIVE_IDLE_HOOK */
482482

483483
/* The timers module relies on xTaskGetSchedulerState(). */
484484
#if configUSE_TIMERS == 1

include/task.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1999,8 +1999,18 @@ BaseType_t xTaskCallApplicationTaskHook( TaskHandle_t xTask,
19991999
*
20002000
* Simply returns the handle of the idle task. It is not valid to call
20012001
* xTaskGetIdleTaskHandle() before the scheduler has been started.
2002+
*
2003+
* In the FreeRTOS SMP, configNUMBER_OF_CORES - 1 idle tasks which do the minimal job
2004+
* are also created to ensure that each core has an idle task to run when no other
2005+
* task is available to run. Set xCoreID to 0 to return the active idle task handle.
2006+
* Set xCoreID to 1 ~ ( configNUMBER_OF_CORES - 1 ) to return the passive idle task
2007+
* handle.
20022008
*/
2003-
TaskHandle_t xTaskGetIdleTaskHandle( void ) PRIVILEGED_FUNCTION;
2009+
#if ( configNUMBER_OF_CORES == 1 )
2010+
TaskHandle_t xTaskGetIdleTaskHandle( void ) PRIVILEGED_FUNCTION;
2011+
#else /* #if ( configNUMBER_OF_CORES == 1 ) */
2012+
TaskHandle_t xTaskGetIdleTaskHandle( BaseType_t xCoreID ) PRIVILEGED_FUNCTION;
2013+
#endif /* #if ( configNUMBER_OF_CORES == 1 ) */
20042014

20052015
/**
20062016
* configUSE_TRACE_FACILITY must be defined as 1 in FreeRTOSConfig.h for

tasks.c

Lines changed: 48 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -530,20 +530,20 @@ static void prvInitialiseTaskLists( void ) PRIVILEGED_FUNCTION;
530530
* The idle task is automatically created and added to the ready lists upon
531531
* creation of the first user task.
532532
*
533-
* In the FreeRTOS SMP, configNUMBER_OF_CORES - 1 minimal idle tasks are also
533+
* In the FreeRTOS SMP, configNUMBER_OF_CORES - 1 passive idle tasks are also
534534
* created to ensure that each core has an idle task to run when no other
535535
* task is available to run.
536536
*
537537
* The portTASK_FUNCTION_PROTO() macro is used to allow port/compiler specific
538538
* language extensions. The equivalent prototype for these functions are:
539539
*
540-
* void prvIdleTask( void *pvParameters );
541-
* void prvMinimalIdleTask( void *pvParameters );
540+
* void prvActiveIdleTask( void *pvParameters );
541+
* void prvPassiveIdleTask( void *pvParameters );
542542
*
543543
*/
544-
static portTASK_FUNCTION_PROTO( prvIdleTask, pvParameters ) PRIVILEGED_FUNCTION;
544+
static portTASK_FUNCTION_PROTO( prvActiveIdleTask, pvParameters ) PRIVILEGED_FUNCTION;
545545
#if ( configNUMBER_OF_CORES > 1 )
546-
static portTASK_FUNCTION_PROTO( prvMinimalIdleTask, pvParameters ) PRIVILEGED_FUNCTION;
546+
static portTASK_FUNCTION_PROTO( prvPassiveIdleTask, pvParameters ) PRIVILEGED_FUNCTION;
547547
#endif
548548

549549
/*
@@ -673,9 +673,9 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION;
673673

674674
#endif
675675

676-
#if ( configUSE_MINIMAL_IDLE_HOOK == 1 )
677-
extern void vApplicationMinimalIdleHook( void );
678-
#endif /* #if ( configUSE_MINIMAL_IDLE_HOOK == 1 ) */
676+
#if ( configUSE_PASSIVE_IDLE_HOOK == 1 )
677+
extern void vApplicationPassiveIdleHook( void );
678+
#endif /* #if ( configUSE_PASSIVE_IDLE_HOOK == 1 ) */
679679

680680
/*-----------------------------------------------------------*/
681681

@@ -1677,7 +1677,7 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
16771677
pxNewTCB->xTaskRunState = taskTASK_NOT_RUNNING;
16781678

16791679
/* Is this an idle task? */
1680-
if( ( ( TaskFunction_t ) pxTaskCode == ( TaskFunction_t ) prvIdleTask ) || ( ( TaskFunction_t ) pxTaskCode == ( TaskFunction_t ) prvMinimalIdleTask ) )
1680+
if( ( ( TaskFunction_t ) pxTaskCode == ( TaskFunction_t ) prvActiveIdleTask ) || ( ( TaskFunction_t ) pxTaskCode == ( TaskFunction_t ) prvPassiveIdleTask ) )
16811681
{
16821682
pxNewTCB->uxTaskAttributes |= taskATTRIBUTE_IS_IDLE;
16831683
}
@@ -3081,20 +3081,20 @@ static BaseType_t prvCreateIdleTasks( void )
30813081
{
30823082
#if ( configNUMBER_OF_CORES == 1 )
30833083
{
3084-
pxIdleTaskFunction = prvIdleTask;
3084+
pxIdleTaskFunction = prvActiveIdleTask;
30853085
}
30863086
#else /* #if ( configNUMBER_OF_CORES == 1 ) */
30873087
{
3088-
/* In the FreeRTOS SMP, configNUMBER_OF_CORES - 1 idle tasks with minimal
3089-
* effort are also created to ensure that each core has an idle task to
3088+
/* In the FreeRTOS SMP, configNUMBER_OF_CORES - 1 passive idle tasks
3089+
* are also created to ensure that each core has an idle task to
30903090
* run when no other task is available to run. */
30913091
if( xCoreID == 0 )
30923092
{
3093-
pxIdleTaskFunction = prvIdleTask;
3093+
pxIdleTaskFunction = prvActiveIdleTask;
30943094
}
30953095
else
30963096
{
3097-
pxIdleTaskFunction = prvMinimalIdleTask;
3097+
pxIdleTaskFunction = prvPassiveIdleTask;
30983098
}
30993099
}
31003100
#endif /* #if ( configNUMBER_OF_CORES == 1 ) */
@@ -3989,15 +3989,23 @@ char * pcTaskGetName( TaskHandle_t xTaskToQuery ) /*lint !e971 Unqualified char
39893989

39903990
#if ( INCLUDE_xTaskGetIdleTaskHandle == 1 )
39913991

3992-
/* SMP_TODO : This function returns only idle task handle for core 0.
3993-
* Consider to add another function to return the idle task handles. */
3994-
TaskHandle_t xTaskGetIdleTaskHandle( void )
3995-
{
3996-
/* If xTaskGetIdleTaskHandle() is called before the scheduler has been
3997-
* started, then xIdleTaskHandles will be NULL. */
3998-
configASSERT( ( xIdleTaskHandles[ 0 ] != NULL ) );
3999-
return xIdleTaskHandles[ 0 ];
4000-
}
3992+
#if ( configNUMBER_OF_CORES == 1 )
3993+
TaskHandle_t xTaskGetIdleTaskHandle( void )
3994+
{
3995+
/* If xTaskGetIdleTaskHandle() is called before the scheduler has been
3996+
* started, then xIdleTaskHandles will be NULL. */
3997+
configASSERT( ( xIdleTaskHandles[ 0 ] != NULL ) );
3998+
return xIdleTaskHandles[ 0 ];
3999+
}
4000+
#else
4001+
TaskHandle_t xTaskGetIdleTaskHandle( BaseType_t xCoreID )
4002+
{
4003+
/* If xTaskGetIdleTaskHandle() is called before the scheduler has been
4004+
* started, then xIdleTaskHandles will be NULL. */
4005+
configASSERT( ( xIdleTaskHandles[ xCoreID ] != NULL ) );
4006+
return xIdleTaskHandles[ xCoreID ];
4007+
}
4008+
#endif /* if ( configNUMBER_OF_CORES == 1 ) */
40014009

40024010
#endif /* INCLUDE_xTaskGetIdleTaskHandle */
40034011
/*----------------------------------------------------------*/
@@ -5057,21 +5065,21 @@ void vTaskMissedYield( void )
50575065

50585066
/*
50595067
* -----------------------------------------------------------
5060-
* The MinimalIdle task.
5068+
* The passive idle task.
50615069
* ----------------------------------------------------------
50625070
*
5063-
* The minimal idle task is used for all the additional cores in a SMP
5064-
* system. There must be only 1 idle task and the rest are minimal idle
5065-
* tasks.
5071+
* The passive idle task is used for all the additional cores in a SMP
5072+
* system. There must be only 1 active idle task and the rest are passive
5073+
* idle tasks.
50665074
*
50675075
* The portTASK_FUNCTION() macro is used to allow port/compiler specific
50685076
* language extensions. The equivalent prototype for this function is:
50695077
*
5070-
* void prvMinimalIdleTask( void *pvParameters );
5078+
* void prvPassiveIdleTask( void *pvParameters );
50715079
*/
50725080

50735081
#if ( configNUMBER_OF_CORES > 1 )
5074-
static portTASK_FUNCTION( prvMinimalIdleTask, pvParameters )
5082+
static portTASK_FUNCTION( prvPassiveIdleTask, pvParameters )
50755083
{
50765084
( void ) pvParameters;
50775085

@@ -5112,36 +5120,36 @@ void vTaskMissedYield( void )
51125120
}
51135121
#endif /* ( ( configUSE_PREEMPTION == 1 ) && ( configIDLE_SHOULD_YIELD == 1 ) ) */
51145122

5115-
#if ( configUSE_MINIMAL_IDLE_HOOK == 1 )
5123+
#if ( configUSE_PASSIVE_IDLE_HOOK == 1 )
51165124
{
51175125
/* Call the user defined function from within the idle task. This
51185126
* allows the application designer to add background functionality
51195127
* without the overhead of a separate task.
51205128
*
51215129
* This hook is intended to manage core activity such as disabling cores that go idle.
51225130
*
5123-
* NOTE: vApplicationMinimalIdleHook() MUST NOT, UNDER ANY CIRCUMSTANCES,
5131+
* NOTE: vApplicationPassiveIdleHook() MUST NOT, UNDER ANY CIRCUMSTANCES,
51245132
* CALL A FUNCTION THAT MIGHT BLOCK. */
5125-
vApplicationMinimalIdleHook();
5133+
vApplicationPassiveIdleHook();
51265134
}
5127-
#endif /* configUSE_MINIMAL_IDLE_HOOK */
5135+
#endif /* configUSE_PASSIVE_IDLE_HOOK */
51285136
}
51295137
}
51305138
#endif /* #if ( configNUMBER_OF_CORES > 1 ) */
51315139

51325140
/*
51335141
* -----------------------------------------------------------
5134-
* The Idle task.
5142+
* The active idle task.
51355143
* ----------------------------------------------------------
51365144
*
51375145
* The portTASK_FUNCTION() macro is used to allow port/compiler specific
51385146
* language extensions. The equivalent prototype for this function is:
51395147
*
5140-
* void prvIdleTask( void *pvParameters );
5148+
* void prvActiveIdleTask( void *pvParameters );
51415149
*
51425150
*/
51435151

5144-
static portTASK_FUNCTION( prvIdleTask, pvParameters )
5152+
static portTASK_FUNCTION( prvActiveIdleTask, pvParameters )
51455153
{
51465154
/* Stop warnings. */
51475155
( void ) pvParameters;
@@ -5258,19 +5266,19 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters )
52585266
}
52595267
#endif /* configUSE_TICKLESS_IDLE */
52605268

5261-
#if ( ( configNUMBER_OF_CORES > 1 ) && ( configUSE_MINIMAL_IDLE_HOOK == 1 ) )
5269+
#if ( ( configNUMBER_OF_CORES > 1 ) && ( configUSE_PASSIVE_IDLE_HOOK == 1 ) )
52625270
{
52635271
/* Call the user defined function from within the idle task. This
52645272
* allows the application designer to add background functionality
52655273
* without the overhead of a separate task.
52665274
*
52675275
* This hook is intended to manage core activity such as disabling cores that go idle.
52685276
*
5269-
* NOTE: vApplicationMinimalIdleHook() MUST NOT, UNDER ANY CIRCUMSTANCES,
5277+
* NOTE: vApplicationPassiveIdleHook() MUST NOT, UNDER ANY CIRCUMSTANCES,
52705278
* CALL A FUNCTION THAT MIGHT BLOCK. */
5271-
vApplicationMinimalIdleHook();
5279+
vApplicationPassiveIdleHook();
52725280
}
5273-
#endif /* #if ( ( configNUMBER_OF_CORES > 1 ) && ( configUSE_MINIMAL_IDLE_HOOK == 1 ) ) */
5281+
#endif /* #if ( ( configNUMBER_OF_CORES > 1 ) && ( configUSE_PASSIVE_IDLE_HOOK == 1 ) ) */
52745282
}
52755283
}
52765284
/*-----------------------------------------------------------*/

0 commit comments

Comments
 (0)