Skip to content

Commit 4f32c35

Browse files
committed
Add tracing macros for core scheduling functions and enhance documentation
1 parent eb5f4ad commit 4f32c35

3 files changed

Lines changed: 36 additions & 3 deletions

File tree

include/FreeRTOS.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1854,6 +1854,22 @@
18541854
#define traceRETURN_vTaskCoreAffinityGet( uxCoreAffinityMask )
18551855
#endif
18561856

1857+
#ifndef traceENTER_vTaskSetSchedulerCoreMask
1858+
#define traceENTER_vTaskSetSchedulerCoreMask( uxCoreMask )
1859+
#endif
1860+
1861+
#ifndef traceRETURN_vTaskSetSchedulerCoreMask
1862+
#define traceRETURN_vTaskSetSchedulerCoreMask()
1863+
#endif
1864+
1865+
#ifndef traceENTER_uxTaskGetSchedulerCoreMask
1866+
#define traceENTER_uxTaskGetSchedulerCoreMask()
1867+
#endif
1868+
1869+
#ifndef traceRETURN_uxTaskGetSchedulerCoreMask
1870+
#define traceRETURN_uxTaskGetSchedulerCoreMask( uxCoreMask )
1871+
#endif
1872+
18571873
#ifndef traceENTER_vTaskPreemptionDisable
18581874
#define traceENTER_vTaskPreemptionDisable( xTask )
18591875
#endif

include/task.h

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,9 +1425,18 @@ BaseType_t xTaskResumeFromISR( TaskHandle_t xTaskToResume ) PRIVILEGED_FUNCTION;
14251425
/**
14261426
*
14271427
* Controls which cores are allowed to run non-idle tasks system-wide.
1428-
* Bit N = 1 means core N may run tasks; bit N = 0 means core N will only
1429-
* run its idle task. configNUMBER_OF_CORES must be greater than 1 for this
1430-
* function to be available.
1428+
* Bit N = 1 means core N may run non-idle tasks; bit N = 0 means core N will
1429+
* only run its idle task. configNUMBER_OF_CORES must be greater than 1 for
1430+
* this function to be available.
1431+
*
1432+
* Masking a core (including core 0) does NOT power it off or stop its tick
1433+
* ISR and scheduler from executing. All cores remain active; the mask only
1434+
* controls whether the scheduler may dispatch a non-idle task onto a core.
1435+
* A masked core continues to service its tick interrupt and enters the
1436+
* scheduler normally, but will always be assigned the idle task.
1437+
*
1438+
* Passing 0 as the mask is valid; every core will run only its idle task
1439+
* until a new mask is applied.
14311440
*
14321441
* If a core that is currently running a non-idle task becomes disabled by
14331442
* the new mask, it is yielded immediately so the scheduler can replace the

tasks.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3135,6 +3135,8 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
31353135
UBaseType_t uxOldMask;
31363136
UBaseType_t uxDisabledCores;
31373137

3138+
traceENTER_vTaskSetSchedulerCoreMask( uxCoreMask );
3139+
31383140
taskENTER_CRITICAL();
31393141
{
31403142
uxOldMask = uxSchedulerCoreMask;
@@ -3162,6 +3164,8 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
31623164
}
31633165
}
31643166
taskEXIT_CRITICAL();
3167+
3168+
traceRETURN_vTaskSetSchedulerCoreMask();
31653169
}
31663170
#endif /* #if ( ( configNUMBER_OF_CORES > 1 ) && ( configUSE_SCHEDULER_CORE_MASK == 1 ) ) */
31673171

@@ -3172,12 +3176,16 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
31723176
{
31733177
UBaseType_t uxCoreMask;
31743178

3179+
traceENTER_uxTaskGetSchedulerCoreMask();
3180+
31753181
portBASE_TYPE_ENTER_CRITICAL();
31763182
{
31773183
uxCoreMask = uxSchedulerCoreMask;
31783184
}
31793185
portBASE_TYPE_EXIT_CRITICAL();
31803186

3187+
traceRETURN_uxTaskGetSchedulerCoreMask( uxCoreMask );
3188+
31813189
return uxCoreMask;
31823190
}
31833191
#endif /* #if ( ( configNUMBER_OF_CORES > 1 ) && ( configUSE_SCHEDULER_CORE_MASK == 1 ) ) */

0 commit comments

Comments
 (0)