mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-19 21:11:57 -04:00
Uncrustified tasks.c
This commit is contained in:
parent
87279a3dc7
commit
106e15ea6b
70
tasks.c
70
tasks.c
|
@ -290,7 +290,6 @@ typedef struct tskTaskControlBlock /* The old naming convention is used to
|
|||
#endif
|
||||
|
||||
#if ( configUSE_NEWLIB_REENTRANT == 1 )
|
||||
|
||||
/* Allocate a Newlib reent structure that is specific to this task.
|
||||
* Note Newlib support has been included by popular demand, but is not
|
||||
* used by the FreeRTOS maintainers themselves. FreeRTOS is not
|
||||
|
@ -469,7 +468,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
|
||||
|
||||
/*
|
||||
|
@ -761,7 +760,7 @@ static void prvYieldForTask( TCB_t * pxTCB,
|
|||
{
|
||||
if( xTaskPriority <= xLowestPriority )
|
||||
{
|
||||
#if( configNUM_CORES > 1 )
|
||||
#if ( configNUM_CORES > 1 )
|
||||
#if ( configUSE_CORE_AFFINITY == 1 )
|
||||
if( ( pxTCB->uxCoreAffinityMask & ( 1 << x ) ) != 0 )
|
||||
#endif
|
||||
|
@ -914,7 +913,7 @@ static void prvYieldForTask( TCB_t * pxTCB,
|
|||
else if( pxTCB == pxCurrentTCBs[ xCoreID ] )
|
||||
{
|
||||
configASSERT( ( pxTCB->xTaskRunState == xCoreID ) || ( pxTCB->xTaskRunState == taskTASK_YIELDING ) );
|
||||
#if( configNUM_CORES > 1 )
|
||||
#if ( configNUM_CORES > 1 )
|
||||
#if ( configUSE_CORE_AFFINITY == 1 )
|
||||
if( ( pxTCB->uxCoreAffinityMask & ( 1 << xCoreID ) ) != 0 )
|
||||
#endif
|
||||
|
@ -1557,12 +1556,13 @@ 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;
|
||||
}
|
||||
#if(configNUM_CORES > 1)
|
||||
else if(pxTaskCode == prvMinimalIdleTask)
|
||||
|
||||
#if ( configNUM_CORES > 1 )
|
||||
else if( pxTaskCode == prvMinimalIdleTask )
|
||||
{
|
||||
pxNewTCB->xIsIdle = pdTRUE;
|
||||
}
|
||||
|
@ -1617,11 +1617,12 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB )
|
|||
if( pxCurrentTCBs[ xCoreID ] == NULL )
|
||||
{
|
||||
pxNewTCB->xTaskRunState = xCoreID;
|
||||
|
||||
/* This section of code pins the idle tasks to cores.
|
||||
#if ( configUSE_CORE_AFFINITY == 1 )
|
||||
{
|
||||
pxNewTCB->uxCoreAffinityMask = ( 1 << xCoreID );
|
||||
}
|
||||
* {
|
||||
* pxNewTCB->uxCoreAffinityMask = ( 1 << xCoreID );
|
||||
* }
|
||||
#endif
|
||||
*/
|
||||
pxCurrentTCBs[ xCoreID ] = pxNewTCB;
|
||||
|
@ -1713,7 +1714,6 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB )
|
|||
* no longer running. */
|
||||
if( xTaskRunningOnCore != taskTASK_NOT_RUNNING )
|
||||
{
|
||||
|
||||
/* A running task is being deleted. This cannot complete within the
|
||||
* task itself, as a context switch to another task is required.
|
||||
* Place the task in the termination list. The idle task will
|
||||
|
@ -1755,7 +1755,6 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB )
|
|||
|
||||
xCoreID = portGET_CORE_ID();
|
||||
|
||||
|
||||
if( xTaskRunningOnCore == xCoreID )
|
||||
{
|
||||
configASSERT( uxSchedulerSuspended == 0 );
|
||||
|
@ -2232,7 +2231,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB )
|
|||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if ( configNUM_CORES > 1 )
|
||||
#if ( configUSE_CORE_AFFINITY == 1 )
|
||||
#if ( configUSE_CORE_AFFINITY == 1 )
|
||||
|
||||
void vTaskCoreAffinitySet( const TaskHandle_t xTask,
|
||||
UBaseType_t uxCoreAffinityMask )
|
||||
|
@ -2262,12 +2261,12 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB )
|
|||
taskEXIT_CRITICAL();
|
||||
}
|
||||
|
||||
#endif /* configUSE_CORE_AFFINITY */
|
||||
#endif
|
||||
#endif /* configUSE_CORE_AFFINITY */
|
||||
#endif /* if ( configNUM_CORES > 1 ) */
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
#if ( configNUM_CORES > 1 )
|
||||
#if ( configUSE_CORE_AFFINITY == 1 )
|
||||
#if ( configUSE_CORE_AFFINITY == 1 )
|
||||
|
||||
UBaseType_t vTaskCoreAffinityGet( const TaskHandle_t xTask )
|
||||
{
|
||||
|
@ -2284,8 +2283,8 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB )
|
|||
return uxCoreAffinityMask;
|
||||
}
|
||||
|
||||
#endif /* configUSE_CORE_AFFINITY */
|
||||
#endif
|
||||
#endif /* configUSE_CORE_AFFINITY */
|
||||
#endif /* if ( configNUM_CORES > 1 ) */
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
@ -2688,7 +2687,7 @@ static BaseType_t prvCreateIdleTasks( void )
|
|||
|
||||
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
|
||||
{
|
||||
if(xCoreID == 0)
|
||||
if( xCoreID == 0 )
|
||||
{
|
||||
StaticTask_t * pxIdleTaskTCBBuffer = NULL;
|
||||
StackType_t * pxIdleTaskStackBuffer = NULL;
|
||||
|
@ -2705,21 +2704,23 @@ 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)
|
||||
|
||||
#if ( configNUM_CORES > 1 )
|
||||
else
|
||||
{
|
||||
static StaticTask_t xIdleTCBBuffers[configNUM_CORES-1];
|
||||
static StackType_t xIdleTaskStackBuffers[configNUM_CORES-1][configMINIMAL_STACK_SIZE];
|
||||
static StaticTask_t xIdleTCBBuffers[ configNUM_CORES - 1 ];
|
||||
static StackType_t xIdleTaskStackBuffers[ configNUM_CORES - 1 ][ configMINIMAL_STACK_SIZE ];
|
||||
|
||||
xIdleTaskHandle[ xCoreID ] = xTaskCreateStatic( prvMinimalIdleTask,
|
||||
cIdleName,
|
||||
configMINIMAL_STACK_SIZE,
|
||||
( void * ) NULL, /*lint !e961. The cast is not redundant for all compilers. */
|
||||
portPRIVILEGE_BIT, /* In effect ( tskIDLE_PRIORITY | portPRIVILEGE_BIT ), but tskIDLE_PRIORITY is zero. */
|
||||
xIdleTaskStackBuffers[xCoreID-1],
|
||||
&xIdleTCBBuffers[xCoreID-1] ); /*lint !e961 MISRA exception, justified as it is not a redundant explicit cast to all supported compilers. */
|
||||
xIdleTaskStackBuffers[ xCoreID - 1 ],
|
||||
&xIdleTCBBuffers[ xCoreID - 1 ] ); /*lint !e961 MISRA exception, justified as it is not a redundant explicit cast to all supported compilers. */
|
||||
}
|
||||
#endif
|
||||
#endif /* if ( configNUM_CORES > 1 ) */
|
||||
|
||||
if( xIdleTaskHandle[ xCoreID ] != NULL )
|
||||
{
|
||||
xReturn = pdPASS;
|
||||
|
@ -2731,7 +2732,7 @@ static BaseType_t prvCreateIdleTasks( void )
|
|||
}
|
||||
#else /* if ( configSUPPORT_STATIC_ALLOCATION == 1 ) */
|
||||
{
|
||||
if(xCoreID == 0)
|
||||
if( xCoreID == 0 )
|
||||
{
|
||||
/* The Idle task is being created using dynamically allocated RAM. */
|
||||
xReturn = xTaskCreate( prvIdleTask,
|
||||
|
@ -2741,7 +2742,8 @@ static BaseType_t prvCreateIdleTasks( void )
|
|||
portPRIVILEGE_BIT, /* In effect ( tskIDLE_PRIORITY | portPRIVILEGE_BIT ), but tskIDLE_PRIORITY is zero. */
|
||||
&xIdleTaskHandle[ xCoreID ] ); /*lint !e961 MISRA exception, justified as it is not a redundant explicit cast to all supported compilers. */
|
||||
}
|
||||
#if( configNUM_CORES > 1 )
|
||||
|
||||
#if ( configNUM_CORES > 1 )
|
||||
else
|
||||
{
|
||||
xReturn = xTaskCreate( prvMinimalIdleTask,
|
||||
|
@ -2755,6 +2757,7 @@ static BaseType_t prvCreateIdleTasks( void )
|
|||
}
|
||||
#endif /* configSUPPORT_STATIC_ALLOCATION */
|
||||
}
|
||||
|
||||
return xReturn;
|
||||
}
|
||||
|
||||
|
@ -4225,10 +4228,10 @@ void vTaskMissedYield( void )
|
|||
*
|
||||
* @todo additional conditional compiles to remove this function.
|
||||
*/
|
||||
#if (configNUM_CORES > 1)
|
||||
static portTASK_FUNCTION( prvMinimalIdleTask, pvParameters )
|
||||
{
|
||||
for(;;)
|
||||
#if ( configNUM_CORES > 1 )
|
||||
static portTASK_FUNCTION( prvMinimalIdleTask, pvParameters )
|
||||
{
|
||||
for( ; ; )
|
||||
{
|
||||
#if ( configUSE_PREEMPTION == 0 )
|
||||
{
|
||||
|
@ -4263,8 +4266,9 @@ static portTASK_FUNCTION( prvMinimalIdleTask, pvParameters )
|
|||
}
|
||||
#endif /* ( ( configUSE_PREEMPTION == 1 ) && ( configIDLE_SHOULD_YIELD == 1 ) ) */
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif /* if ( configNUM_CORES > 1 ) */
|
||||
|
||||
/*
|
||||
* -----------------------------------------------------------
|
||||
* The Idle task.
|
||||
|
|
Loading…
Reference in a new issue