@ -259,14 +259,11 @@
# define taskEVENT_LIST_ITEM_VALUE_IN_USE 0x8000000000000000ULL
# endif
/* Task state. */
typedef BaseType_t TaskRunning_t ;
/* Indicates that the task is not actively running on any core. */
# define taskTASK_NOT_RUNNING ( TaskRunning_t ) ( -1 )
# define taskTASK_NOT_RUNNING ( ( BaseType_t ) ( -1 ) )
/* Indicates that the task is actively running but scheduled to yield. */
# define taskTASK_ YIELDING ( TaskRunning_t ) ( -2 )
# define taskTASK_ SCHEDULED_TO_YIELD ( ( BaseType_t ) ( -2 ) )
/* Returns pdTRUE if the task is actively running and not scheduled to yield. */
# if ( configNUMBER_OF_CORES == 1 )
@ -313,7 +310,7 @@ typedef struct tskTaskControlBlock /* The old naming convention is used to
UBaseType_t uxPriority ; /**< The priority of the task. 0 is the lowest priority. */
StackType_t * pxStack ; /**< Points to the start of the stack. */
# if ( configNUMBER_OF_CORES > 1 )
volatile TaskRunning_t xTaskRunState ; /**< Used to identify the core the task is running on, if the task is running. Otherwise, identifies the task's state - not running or yielding. */
volatile BaseType_t xTaskRunState ; /**< Used to identify the core the task is running on, if the task is running. Otherwise, identifies the task's state - not running or yielding. */
UBaseType_t uxTaskAttributes ; /**< Task's attributes - currently used to identify the idle tasks. */
# endif
char pcTaskName [ configMAX_TASK_NAME_LEN ] ; /**< Descriptive name given to the task when created. Facilitates debugging only. */ /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
@ -700,7 +697,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION;
* so this is safe . */
pxThisTCB = pxCurrentTCBs [ portGET_CORE_ID ( ) ] ;
while ( pxThisTCB - > xTaskRunState = = taskTASK_ YIELDING )
while ( pxThisTCB - > xTaskRunState = = taskTASK_ SCHEDULED_TO_ YIELD )
{
/* We are only here if we just entered a critical section
* or if we just suspended the scheduler , and another task
@ -725,16 +722,15 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION;
}
portRELEASE_TASK_LOCK ( ) ;
portMEMORY_BARRIER ( ) ;
configASSERT ( pxThisTCB - > xTaskRunState = = taskTASK_ YIELDING ) ;
configASSERT ( pxThisTCB - > xTaskRunState = = taskTASK_ SCHEDULED_TO_ YIELD ) ;
portENABLE_INTERRUPTS ( ) ;
/* Enabling interrupts should cause this core to immediately
* service the pending interrupt and yield . If the run state is still
* yielding here then that is a problem . */
configASSERT ( pxThisTCB - > xTaskRunState ! = taskTASK_ YIELDING ) ;
configASSERT ( pxThisTCB - > xTaskRunState ! = taskTASK_ SCHEDULED_TO_ YIELD ) ;
portDISABLE_INTERRUPTS ( ) ;
portGET_TASK_LOCK ( ) ;
@ -762,7 +758,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION;
}
else
{
if ( pxCurrentTCBs [ xCoreID ] - > xTaskRunState ! = taskTASK_ YIELDING )
if ( pxCurrentTCBs [ xCoreID ] - > xTaskRunState ! = taskTASK_ SCHEDULED_TO_ YIELD )
{
if ( xCoreID = = ( BaseType_t ) portGET_CORE_ID ( ) )
{
@ -771,7 +767,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION;
else
{
portYIELD_CORE ( xCoreID ) ;
pxCurrentTCBs [ xCoreID ] - > xTaskRunState = taskTASK_ YIELDING ;
pxCurrentTCBs [ xCoreID ] - > xTaskRunState = taskTASK_ SCHEDULED_TO_ YIELD;
}
}
}
@ -982,21 +978,21 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION;
# if ( configUSE_CORE_AFFINITY == 1 )
pxPreviousTCB = pxCurrentTCBs [ xCoreID ] ;
# endif
pxTCB - > xTaskRunState = ( TaskRunning_t ) xCoreID ;
pxTCB - > xTaskRunState = xCoreID ;
pxCurrentTCBs [ xCoreID ] = pxTCB ;
xTaskScheduled = pdTRUE ;
}
}
else if ( pxTCB = = pxCurrentTCBs [ xCoreID ] )
{
configASSERT ( ( pxTCB - > xTaskRunState = = xCoreID ) | | ( pxTCB - > xTaskRunState = = taskTASK_ YIELDING ) ) ;
configASSERT ( ( pxTCB - > xTaskRunState = = xCoreID ) | | ( pxTCB - > xTaskRunState = = taskTASK_ SCHEDULED_TO_ YIELD ) ) ;
# if ( configUSE_CORE_AFFINITY == 1 )
if ( ( pxTCB - > uxCoreAffinityMask & ( ( UBaseType_t ) 1U < < ( UBaseType_t ) xCoreID ) ) ! = 0U )
# endif
{
/* The task is already running on this core, mark it as scheduled. */
pxTCB - > xTaskRunState = ( TaskRunning_t ) xCoreID ;
pxTCB - > xTaskRunState = xCoreID ;
xTaskScheduled = pdTRUE ;
}
}
@ -1999,7 +1995,7 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
/* Force a reschedule if the task that has just been deleted was running. */
if ( ( xSchedulerRunning ! = pdFALSE ) & & ( taskTASK_IS_RUNNING ( pxTCB ) = = pdTRUE ) )
{
if ( pxTCB - > xTaskRunState = = ( TaskRunning _t ) portGET_CORE_ID ( ) )
if ( pxTCB - > xTaskRunState = = ( BaseType _t ) portGET_CORE_ID ( ) )
{
configASSERT ( uxSchedulerSuspended = = 0 ) ;
vTaskYieldWithinAPI ( ) ;
@ -2704,7 +2700,7 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
TCB_t * pxTCB ;
# if ( configNUMBER_OF_CORES > 1 )
TaskRunning _t xTaskRunningOnCore ;
BaseType _t xTaskRunningOnCore ;
# endif
taskENTER_CRITICAL ( ) ;
@ -2827,7 +2823,7 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
{
if ( xSchedulerRunning ! = pdFALSE )
{
if ( xTaskRunningOnCore = = ( TaskRunning _t ) portGET_CORE_ID ( ) )
if ( xTaskRunningOnCore = = ( BaseType _t ) portGET_CORE_ID ( ) )
{
/* The current task has just been suspended. */
configASSERT ( uxSchedulerSuspended = = 0 ) ;