adding a minimal idle hook to the SMP port (#329)

* adjusting the kernel checks repo

* Added a minimal idle hook for all idle tasks
This commit is contained in:
Joseph Julicher 2021-05-19 16:19:57 -07:00 committed by GitHub
parent 0c1381311b
commit b515641e0a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 174 additions and 139 deletions

View file

@ -21,7 +21,7 @@ jobs:
uses: actions/checkout@v2
with:
repository: FreeRTOS/FreeRTOS
ref: master
ref: smp
path: tools
# Checkout user pull request changes

51
tasks.c
View file

@ -467,7 +467,7 @@ static void prvInitialiseTaskLists( void ) PRIVILEGED_FUNCTION;
*/
static portTASK_FUNCTION_PROTO( prvIdleTask, pvParameters ) PRIVILEGED_FUNCTION;
#if ( configNUM_CORES > 1 )
static portTASK_FUNCTION_PROTO( prvMinimalIdleTask, pvParameters ) PRIVILEGED_FUNCTION;
static portTASK_FUNCTION_PROTO( prvMinimalIdleTask, pvParameters ) PRIVILEGED_FUNCTION;
#endif
/*
@ -1000,8 +1000,7 @@ static void prvYieldForTask( TCB_t * pxTCB,
}
else
{
/* The ready task that was removed from this core is excluded from it.
* @todo See if we can schedule it on any of the cores where it is not excluded from. */
/* The ready task that was removed from this core is excluded from it. */
}
uxCoreMap &= ( ( 1 << configNUM_CORES ) - 1 );
@ -1555,7 +1554,7 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
pxNewTCB->xTaskRunState = taskTASK_NOT_RUNNING;
/* Is this an idle task? */
if(pxTaskCode == prvIdleTask)
if( pxTaskCode == prvIdleTask )
{
pxNewTCB->xIsIdle = pdTRUE;
}
@ -2242,7 +2241,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB )
{
xCoreID = ( BaseType_t ) pxTCB->xTaskRunState;
if( ( uxCoreAffinityMask & ( 1 << xCoreID ) ) != 0 )
if( ( uxCoreAffinityMask & ( 1 << xCoreID ) ) == 0 )
{
prvYieldCore( xCoreID );
}
@ -2695,6 +2694,7 @@ static BaseType_t prvCreateIdleTasks( void )
pxIdleTaskStackBuffer,
pxIdleTaskTCBBuffer ); /*lint !e961 MISRA exception, justified as it is not a redundant explicit cast to all supported compilers. */
}
#if ( configNUM_CORES > 1 )
else
{
@ -2747,6 +2747,7 @@ static BaseType_t prvCreateIdleTasks( void )
}
#endif /* configSUPPORT_STATIC_ALLOCATION */
}
return xReturn;
}
@ -4219,9 +4220,10 @@ void vTaskMissedYield( void )
*/
#if ( configNUM_CORES > 1 )
static portTASK_FUNCTION( prvMinimalIdleTask, pvParameters )
{
static portTASK_FUNCTION( prvMinimalIdleTask, pvParameters )
{
taskYIELD();
for( ; ; )
{
#if ( configUSE_PREEMPTION == 0 )
@ -4256,8 +4258,24 @@ static portTASK_FUNCTION( prvMinimalIdleTask, pvParameters )
}
}
#endif /* ( ( configUSE_PREEMPTION == 1 ) && ( configIDLE_SHOULD_YIELD == 1 ) ) */
#if ( configUSE_MINIMAL_IDLE_HOOK == 1 )
{
extern void vApplicationMinimalIdleHook( void );
/* Call the user defined function from within the idle task. This
* allows the application designer to add background functionality
* without the overhead of a separate task.
*
* This hook is intended to manage core activity such as disabling cores that go idle.
*
* NOTE: vApplicationMinimalIdleHook() MUST NOT, UNDER ANY CIRCUMSTANCES,
* CALL A FUNCTION THAT MIGHT BLOCK. */
vApplicationMinimalIdleHook();
}
#endif /* configUSE_MINIMAL_IDLE_HOOK */
}
}
}
#endif /* if ( configNUM_CORES > 1 ) */
/*
@ -4330,6 +4348,7 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters )
/* Call the user defined function from within the idle task. This
* allows the application designer to add background functionality
* without the overhead of a separate task.
*
* NOTE: vApplicationIdleHook() MUST NOT, UNDER ANY CIRCUMSTANCES,
* CALL A FUNCTION THAT MIGHT BLOCK. */
vApplicationIdleHook();
@ -4385,6 +4404,22 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters )
}
}
#endif /* configUSE_TICKLESS_IDLE */
#if ( configUSE_MINIMAL_IDLE_HOOK == 1 )
{
extern void vApplicationMinimalIdleHook( void );
/* Call the user defined function from within the idle task. This
* allows the application designer to add background functionality
* without the overhead of a separate task.
*
* This hook is intended to manage core activity such as disabling cores that go idle.
*
* NOTE: vApplicationMinimalIdleHook() MUST NOT, UNDER ANY CIRCUMSTANCES,
* CALL A FUNCTION THAT MIGHT BLOCK. */
vApplicationMinimalIdleHook();
}
#endif /* configUSE_MINIMAL_IDLE_HOOK */
}
}
/*-----------------------------------------------------------*/