|
|
|
@ -706,6 +706,53 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
|
|
|
|
|
*/
|
|
|
|
|
static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Create a task with static buffer for both TCB and stack. Returns a handle to
|
|
|
|
|
* the task if it is created successfully. Otherwise, returns NULL.
|
|
|
|
|
*/
|
|
|
|
|
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
|
|
|
|
|
static TCB_t * prvCreateStaticTask( TaskFunction_t pxTaskCode,
|
|
|
|
|
const char * const pcName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
|
|
|
|
const uint32_t ulStackDepth,
|
|
|
|
|
void * const pvParameters,
|
|
|
|
|
UBaseType_t uxPriority,
|
|
|
|
|
StackType_t * const puxStackBuffer,
|
|
|
|
|
StaticTask_t * const pxTaskBuffer,
|
|
|
|
|
TaskHandle_t * const pxCreatedTask ) PRIVILEGED_FUNCTION;
|
|
|
|
|
#endif /* #if ( configSUPPORT_STATIC_ALLOCATION == 1 ) */
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Create a restricted task with static buffer for both TCB and stack. Returns
|
|
|
|
|
* a handle to the task if it is created successfully. Otherwise, returns NULL.
|
|
|
|
|
*/
|
|
|
|
|
#if ( ( portUSING_MPU_WRAPPERS == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) )
|
|
|
|
|
static TCB_t * prvCreateRestrictedStaticTask( const TaskParameters_t * const pxTaskDefinition,
|
|
|
|
|
TaskHandle_t * const pxCreatedTask ) PRIVILEGED_FUNCTION;
|
|
|
|
|
#endif /* #if ( ( portUSING_MPU_WRAPPERS == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) ) */
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Create a restricted task with static buffer for task stack and allocated buffer
|
|
|
|
|
* for TCB. Returns a handle to the task if it is created successfully. Otherwise,
|
|
|
|
|
* returns NULL.
|
|
|
|
|
*/
|
|
|
|
|
#if ( ( portUSING_MPU_WRAPPERS == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
|
|
|
|
|
static TCB_t * prvCreateRestrictedTask( const TaskParameters_t * const pxTaskDefinition,
|
|
|
|
|
TaskHandle_t * const pxCreatedTask ) PRIVILEGED_FUNCTION;
|
|
|
|
|
#endif /* #if ( ( portUSING_MPU_WRAPPERS == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) ) */
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Create a task with allocated buffer for both TCB and stack. Returns a handle to
|
|
|
|
|
* the task if it is created successfully. Otherwise, returns NULL.
|
|
|
|
|
*/
|
|
|
|
|
#if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
|
|
|
|
|
static TCB_t * prvCreateTask( TaskFunction_t pxTaskCode,
|
|
|
|
|
const char * const pcName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
|
|
|
|
const configSTACK_DEPTH_TYPE usStackDepth,
|
|
|
|
|
void * const pvParameters,
|
|
|
|
|
UBaseType_t uxPriority,
|
|
|
|
|
TaskHandle_t * const pxCreatedTask ) PRIVILEGED_FUNCTION;
|
|
|
|
|
#endif /* #if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) */
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* freertos_tasks_c_additions_init() should only be called if the user definable
|
|
|
|
|
* macro FREERTOS_TASKS_C_ADDITIONS_INIT() is defined, as that is the only macro
|
|
|
|
@ -1195,32 +1242,16 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION;
|
|
|
|
|
|
|
|
|
|
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
|
|
|
|
|
|
|
|
|
|
TaskHandle_t xTaskCreateStatic( TaskFunction_t pxTaskCode,
|
|
|
|
|
const char * const pcName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
|
|
|
|
const uint32_t ulStackDepth,
|
|
|
|
|
void * const pvParameters,
|
|
|
|
|
UBaseType_t uxPriority,
|
|
|
|
|
StackType_t * const puxStackBuffer,
|
|
|
|
|
StaticTask_t * const pxTaskBuffer )
|
|
|
|
|
#if ( ( configNUMBER_OF_CORES > 1 ) && ( configUSE_CORE_AFFINITY == 1 ) )
|
|
|
|
|
{
|
|
|
|
|
return xTaskCreateStaticAffinitySet( pxTaskCode, pcName, ulStackDepth, pvParameters, uxPriority, puxStackBuffer, pxTaskBuffer, tskNO_AFFINITY );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TaskHandle_t xTaskCreateStaticAffinitySet( TaskFunction_t pxTaskCode,
|
|
|
|
|
const char * const pcName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
|
|
|
|
const uint32_t ulStackDepth,
|
|
|
|
|
void * const pvParameters,
|
|
|
|
|
UBaseType_t uxPriority,
|
|
|
|
|
StackType_t * const puxStackBuffer,
|
|
|
|
|
StaticTask_t * const pxTaskBuffer,
|
|
|
|
|
UBaseType_t uxCoreAffinityMask )
|
|
|
|
|
#endif /* #if ( ( configNUMBER_OF_CORES > 1 ) && ( configUSE_CORE_AFFINITY == 1 ) ) */
|
|
|
|
|
static TCB_t * prvCreateStaticTask( TaskFunction_t pxTaskCode,
|
|
|
|
|
const char * const pcName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
|
|
|
|
const uint32_t ulStackDepth,
|
|
|
|
|
void * const pvParameters,
|
|
|
|
|
UBaseType_t uxPriority,
|
|
|
|
|
StackType_t * const puxStackBuffer,
|
|
|
|
|
StaticTask_t * const pxTaskBuffer,
|
|
|
|
|
TaskHandle_t * const pxCreatedTask )
|
|
|
|
|
{
|
|
|
|
|
TCB_t * pxNewTCB;
|
|
|
|
|
TaskHandle_t xReturn;
|
|
|
|
|
|
|
|
|
|
traceENTER_xTaskCreateStatic( pxTaskCode, pcName, ulStackDepth, pvParameters, uxPriority, puxStackBuffer, pxTaskBuffer );
|
|
|
|
|
|
|
|
|
|
configASSERT( puxStackBuffer != NULL );
|
|
|
|
|
configASSERT( pxTaskBuffer != NULL );
|
|
|
|
@ -1252,12 +1283,38 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION;
|
|
|
|
|
}
|
|
|
|
|
#endif /* tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE */
|
|
|
|
|
|
|
|
|
|
prvInitialiseNewTask( pxTaskCode, pcName, ulStackDepth, pvParameters, uxPriority, &xReturn, pxNewTCB, NULL );
|
|
|
|
|
prvInitialiseNewTask( pxTaskCode, pcName, ulStackDepth, pvParameters, uxPriority, pxCreatedTask, pxNewTCB, NULL );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
pxNewTCB = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return pxNewTCB;
|
|
|
|
|
}
|
|
|
|
|
/*-----------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
TaskHandle_t xTaskCreateStatic( TaskFunction_t pxTaskCode,
|
|
|
|
|
const char * const pcName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
|
|
|
|
const uint32_t ulStackDepth,
|
|
|
|
|
void * const pvParameters,
|
|
|
|
|
UBaseType_t uxPriority,
|
|
|
|
|
StackType_t * const puxStackBuffer,
|
|
|
|
|
StaticTask_t * const pxTaskBuffer )
|
|
|
|
|
{
|
|
|
|
|
TaskHandle_t xReturn = NULL;
|
|
|
|
|
TCB_t * pxNewTCB;
|
|
|
|
|
|
|
|
|
|
traceENTER_xTaskCreateStatic( pxTaskCode, pcName, ulStackDepth, pvParameters, uxPriority, puxStackBuffer, pxTaskBuffer );
|
|
|
|
|
|
|
|
|
|
pxNewTCB = prvCreateStaticTask( pxTaskCode, pcName, ulStackDepth, pvParameters, uxPriority, puxStackBuffer, pxTaskBuffer, &xReturn );
|
|
|
|
|
|
|
|
|
|
if( pxNewTCB != NULL )
|
|
|
|
|
{
|
|
|
|
|
#if ( ( configNUMBER_OF_CORES > 1 ) && ( configUSE_CORE_AFFINITY == 1 ) )
|
|
|
|
|
{
|
|
|
|
|
/* Set the task's affinity before scheduling it. */
|
|
|
|
|
pxNewTCB->uxCoreAffinityMask = uxCoreAffinityMask;
|
|
|
|
|
pxNewTCB->uxCoreAffinityMask = tskNO_AFFINITY;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
@ -1265,35 +1322,58 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
xReturn = NULL;
|
|
|
|
|
mtCOVERAGE_TEST_MARKER();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
traceRETURN_xTaskCreateStatic( xReturn );
|
|
|
|
|
|
|
|
|
|
return xReturn;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif /* SUPPORT_STATIC_ALLOCATION */
|
|
|
|
|
/*-----------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
#if ( ( portUSING_MPU_WRAPPERS == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) )
|
|
|
|
|
|
|
|
|
|
BaseType_t xTaskCreateRestrictedStatic( const TaskParameters_t * const pxTaskDefinition,
|
|
|
|
|
TaskHandle_t * pxCreatedTask )
|
|
|
|
|
#if ( ( configNUMBER_OF_CORES > 1 ) && ( configUSE_CORE_AFFINITY == 1 ) )
|
|
|
|
|
{
|
|
|
|
|
return xTaskCreateRestrictedStaticAffinitySet( pxTaskDefinition, tskNO_AFFINITY, pxCreatedTask );
|
|
|
|
|
}
|
|
|
|
|
TaskHandle_t xTaskCreateStaticAffinitySet( TaskFunction_t pxTaskCode,
|
|
|
|
|
const char * const pcName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
|
|
|
|
const uint32_t ulStackDepth,
|
|
|
|
|
void * const pvParameters,
|
|
|
|
|
UBaseType_t uxPriority,
|
|
|
|
|
StackType_t * const puxStackBuffer,
|
|
|
|
|
StaticTask_t * const pxTaskBuffer,
|
|
|
|
|
UBaseType_t uxCoreAffinityMask )
|
|
|
|
|
{
|
|
|
|
|
TaskHandle_t xReturn = NULL;
|
|
|
|
|
TCB_t * pxNewTCB;
|
|
|
|
|
|
|
|
|
|
traceENTER_xTaskCreateStaticAffinitySet( pxTaskCode, pcName, ulStackDepth, pvParameters, uxPriority, puxStackBuffer, pxTaskBuffer, uxCoreAffinityMask );
|
|
|
|
|
|
|
|
|
|
pxNewTCB = prvCreateStaticTask( pxTaskCode, pcName, ulStackDepth, pvParameters, uxPriority, puxStackBuffer, pxTaskBuffer, &xReturn );
|
|
|
|
|
|
|
|
|
|
if( pxNewTCB != NULL )
|
|
|
|
|
{
|
|
|
|
|
/* Set the task's affinity before scheduling it. */
|
|
|
|
|
pxNewTCB->uxCoreAffinityMask = uxCoreAffinityMask;
|
|
|
|
|
|
|
|
|
|
prvAddNewTaskToReadyList( pxNewTCB );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
mtCOVERAGE_TEST_MARKER();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
traceRETURN_xTaskCreateStaticAffinitySet( xReturn );
|
|
|
|
|
|
|
|
|
|
BaseType_t xTaskCreateRestrictedStaticAffinitySet( const TaskParameters_t * const pxTaskDefinition,
|
|
|
|
|
UBaseType_t uxCoreAffinityMask,
|
|
|
|
|
TaskHandle_t * pxCreatedTask )
|
|
|
|
|
return xReturn;
|
|
|
|
|
}
|
|
|
|
|
#endif /* #if ( ( configNUMBER_OF_CORES > 1 ) && ( configUSE_CORE_AFFINITY == 1 ) ) */
|
|
|
|
|
|
|
|
|
|
#endif /* SUPPORT_STATIC_ALLOCATION */
|
|
|
|
|
/*-----------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
#if ( ( portUSING_MPU_WRAPPERS == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) )
|
|
|
|
|
static TCB_t * prvCreateRestrictedStaticTask( const TaskParameters_t * const pxTaskDefinition,
|
|
|
|
|
TaskHandle_t * const pxCreatedTask )
|
|
|
|
|
{
|
|
|
|
|
TCB_t * pxNewTCB;
|
|
|
|
|
BaseType_t xReturn = errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY;
|
|
|
|
|
|
|
|
|
|
traceENTER_xTaskCreateRestrictedStatic( pxTaskDefinition, pxCreatedTask );
|
|
|
|
|
|
|
|
|
|
configASSERT( pxTaskDefinition->puxStackBuffer != NULL );
|
|
|
|
|
configASSERT( pxTaskDefinition->pxTaskBuffer != NULL );
|
|
|
|
@ -1324,44 +1404,92 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION;
|
|
|
|
|
pxTaskDefinition->uxPriority,
|
|
|
|
|
pxCreatedTask, pxNewTCB,
|
|
|
|
|
pxTaskDefinition->xRegions );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
pxNewTCB = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return pxNewTCB;
|
|
|
|
|
}
|
|
|
|
|
/*-----------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
BaseType_t xTaskCreateRestrictedStatic( const TaskParameters_t * const pxTaskDefinition,
|
|
|
|
|
TaskHandle_t * pxCreatedTask )
|
|
|
|
|
{
|
|
|
|
|
TCB_t * pxNewTCB;
|
|
|
|
|
BaseType_t xReturn;
|
|
|
|
|
|
|
|
|
|
traceENTER_xTaskCreateRestrictedStatic( pxTaskDefinition, pxCreatedTask );
|
|
|
|
|
|
|
|
|
|
configASSERT( pxTaskDefinition != NULL );
|
|
|
|
|
|
|
|
|
|
pxNewTCB = prvCreateRestrictedStaticTask( pxTaskDefinition, pxCreatedTask );
|
|
|
|
|
|
|
|
|
|
if( pxNewTCB != NULL )
|
|
|
|
|
{
|
|
|
|
|
#if ( ( configNUMBER_OF_CORES > 1 ) && ( configUSE_CORE_AFFINITY == 1 ) )
|
|
|
|
|
{
|
|
|
|
|
/* Set the task's affinity before scheduling it. */
|
|
|
|
|
pxNewTCB->uxCoreAffinityMask = uxCoreAffinityMask;
|
|
|
|
|
pxNewTCB->uxCoreAffinityMask = tskNO_AFFINITY;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
prvAddNewTaskToReadyList( pxNewTCB );
|
|
|
|
|
xReturn = pdPASS;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
xReturn = errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
traceRETURN_xTaskCreateRestrictedStatic( xReturn );
|
|
|
|
|
|
|
|
|
|
return xReturn;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif /* ( portUSING_MPU_WRAPPERS == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) */
|
|
|
|
|
/*-----------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
#if ( ( portUSING_MPU_WRAPPERS == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
|
|
|
|
|
|
|
|
|
|
BaseType_t xTaskCreateRestricted( const TaskParameters_t * const pxTaskDefinition,
|
|
|
|
|
TaskHandle_t * pxCreatedTask )
|
|
|
|
|
#if ( ( configNUMBER_OF_CORES > 1 ) && ( configUSE_CORE_AFFINITY == 1 ) )
|
|
|
|
|
{
|
|
|
|
|
return xTaskCreateRestrictedAffinitySet( pxTaskDefinition, tskNO_AFFINITY, pxCreatedTask );
|
|
|
|
|
}
|
|
|
|
|
BaseType_t xTaskCreateRestrictedStaticAffinitySet( const TaskParameters_t * const pxTaskDefinition,
|
|
|
|
|
UBaseType_t uxCoreAffinityMask,
|
|
|
|
|
TaskHandle_t * pxCreatedTask )
|
|
|
|
|
{
|
|
|
|
|
TCB_t * pxNewTCB;
|
|
|
|
|
BaseType_t xReturn;
|
|
|
|
|
|
|
|
|
|
traceENTER_xTaskCreateRestrictedStaticAffinitySet( pxTaskDefinition, uxCoreAffinityMask, pxCreatedTask );
|
|
|
|
|
|
|
|
|
|
configASSERT( pxTaskDefinition != NULL );
|
|
|
|
|
|
|
|
|
|
pxNewTCB = prvCreateRestrictedStaticTask( pxTaskDefinition, pxCreatedTask );
|
|
|
|
|
|
|
|
|
|
if( pxNewTCB != NULL )
|
|
|
|
|
{
|
|
|
|
|
/* Set the task's affinity before scheduling it. */
|
|
|
|
|
pxNewTCB->uxCoreAffinityMask = uxCoreAffinityMask;
|
|
|
|
|
|
|
|
|
|
prvAddNewTaskToReadyList( pxNewTCB );
|
|
|
|
|
xReturn = pdPASS;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
xReturn = errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
traceRETURN_xTaskCreateRestrictedStaticAffinitySet( xReturn );
|
|
|
|
|
|
|
|
|
|
BaseType_t xTaskCreateRestrictedAffinitySet( const TaskParameters_t * const pxTaskDefinition,
|
|
|
|
|
UBaseType_t uxCoreAffinityMask,
|
|
|
|
|
TaskHandle_t * pxCreatedTask )
|
|
|
|
|
return xReturn;
|
|
|
|
|
}
|
|
|
|
|
#endif /* #if ( ( configNUMBER_OF_CORES > 1 ) && ( configUSE_CORE_AFFINITY == 1 ) ) */
|
|
|
|
|
|
|
|
|
|
#endif /* ( portUSING_MPU_WRAPPERS == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) */
|
|
|
|
|
/*-----------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
#if ( ( portUSING_MPU_WRAPPERS == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
|
|
|
|
|
static TCB_t * prvCreateRestrictedTask( const TaskParameters_t * const pxTaskDefinition,
|
|
|
|
|
TaskHandle_t * const pxCreatedTask )
|
|
|
|
|
{
|
|
|
|
|
TCB_t * pxNewTCB;
|
|
|
|
|
BaseType_t xReturn = errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY;
|
|
|
|
|
|
|
|
|
|
traceENTER_xTaskCreateRestricted( pxTaskDefinition, pxCreatedTask );
|
|
|
|
|
|
|
|
|
|
configASSERT( pxTaskDefinition->puxStackBuffer );
|
|
|
|
|
|
|
|
|
@ -1392,53 +1520,96 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION;
|
|
|
|
|
pxTaskDefinition->uxPriority,
|
|
|
|
|
pxCreatedTask, pxNewTCB,
|
|
|
|
|
pxTaskDefinition->xRegions );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
pxNewTCB = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if ( ( configNUMBER_OF_CORES > 1 ) && ( configUSE_CORE_AFFINITY == 1 ) )
|
|
|
|
|
{
|
|
|
|
|
/* Set the task's affinity before scheduling it. */
|
|
|
|
|
pxNewTCB->uxCoreAffinityMask = uxCoreAffinityMask;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
return pxNewTCB;
|
|
|
|
|
}
|
|
|
|
|
/*-----------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
prvAddNewTaskToReadyList( pxNewTCB );
|
|
|
|
|
xReturn = pdPASS;
|
|
|
|
|
BaseType_t xTaskCreateRestricted( const TaskParameters_t * const pxTaskDefinition,
|
|
|
|
|
TaskHandle_t * pxCreatedTask )
|
|
|
|
|
{
|
|
|
|
|
TCB_t * pxNewTCB;
|
|
|
|
|
BaseType_t xReturn;
|
|
|
|
|
|
|
|
|
|
traceENTER_xTaskCreateRestricted( pxTaskDefinition, pxCreatedTask );
|
|
|
|
|
|
|
|
|
|
pxNewTCB = prvCreateRestrictedTask( pxTaskDefinition, pxCreatedTask );
|
|
|
|
|
|
|
|
|
|
if( pxNewTCB != NULL )
|
|
|
|
|
{
|
|
|
|
|
#if ( ( configNUMBER_OF_CORES > 1 ) && ( configUSE_CORE_AFFINITY == 1 ) )
|
|
|
|
|
{
|
|
|
|
|
/* Set the task's affinity before scheduling it. */
|
|
|
|
|
pxNewTCB->uxCoreAffinityMask = tskNO_AFFINITY;
|
|
|
|
|
}
|
|
|
|
|
#endif /* #if ( ( configNUMBER_OF_CORES > 1 ) && ( configUSE_CORE_AFFINITY == 1 ) ) */
|
|
|
|
|
|
|
|
|
|
prvAddNewTaskToReadyList( pxNewTCB );
|
|
|
|
|
|
|
|
|
|
xReturn = pdPASS;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
xReturn = errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
traceRETURN_xTaskCreateRestricted( xReturn );
|
|
|
|
|
|
|
|
|
|
return xReturn;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif /* portUSING_MPU_WRAPPERS */
|
|
|
|
|
/*-----------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
#if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
|
|
|
|
|
|
|
|
|
|
BaseType_t xTaskCreate( TaskFunction_t pxTaskCode,
|
|
|
|
|
const char * const pcName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
|
|
|
|
const configSTACK_DEPTH_TYPE usStackDepth,
|
|
|
|
|
void * const pvParameters,
|
|
|
|
|
UBaseType_t uxPriority,
|
|
|
|
|
TaskHandle_t * const pxCreatedTask )
|
|
|
|
|
#if ( ( configNUMBER_OF_CORES > 1 ) && ( configUSE_CORE_AFFINITY == 1 ) )
|
|
|
|
|
{
|
|
|
|
|
return xTaskCreateAffinitySet( pxTaskCode, pcName, usStackDepth, pvParameters, uxPriority, tskNO_AFFINITY, pxCreatedTask );
|
|
|
|
|
}
|
|
|
|
|
BaseType_t xTaskCreateRestrictedAffinitySet( const TaskParameters_t * const pxTaskDefinition,
|
|
|
|
|
UBaseType_t uxCoreAffinityMask,
|
|
|
|
|
TaskHandle_t * pxCreatedTask )
|
|
|
|
|
{
|
|
|
|
|
TCB_t * pxNewTCB;
|
|
|
|
|
BaseType_t xReturn;
|
|
|
|
|
|
|
|
|
|
traceENTER_xTaskCreateRestrictedAffinitySet( pxTaskDefinition, uxCoreAffinityMask, pxCreatedTask );
|
|
|
|
|
|
|
|
|
|
pxNewTCB = prvCreateRestrictedTask( pxTaskDefinition, pxCreatedTask );
|
|
|
|
|
|
|
|
|
|
BaseType_t xTaskCreateAffinitySet( TaskFunction_t pxTaskCode,
|
|
|
|
|
const char * const pcName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
|
|
|
|
const configSTACK_DEPTH_TYPE usStackDepth,
|
|
|
|
|
void * const pvParameters,
|
|
|
|
|
UBaseType_t uxPriority,
|
|
|
|
|
UBaseType_t uxCoreAffinityMask,
|
|
|
|
|
TaskHandle_t * const pxCreatedTask )
|
|
|
|
|
if( pxNewTCB != NULL )
|
|
|
|
|
{
|
|
|
|
|
/* Set the task's affinity before scheduling it. */
|
|
|
|
|
pxNewTCB->uxCoreAffinityMask = uxCoreAffinityMask;
|
|
|
|
|
|
|
|
|
|
prvAddNewTaskToReadyList( pxNewTCB );
|
|
|
|
|
|
|
|
|
|
xReturn = pdPASS;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
xReturn = errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
traceRETURN_xTaskCreateRestrictedAffinitySet( xReturn );
|
|
|
|
|
|
|
|
|
|
return xReturn;
|
|
|
|
|
}
|
|
|
|
|
#endif /* #if ( ( configNUMBER_OF_CORES > 1 ) && ( configUSE_CORE_AFFINITY == 1 ) ) */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* portUSING_MPU_WRAPPERS */
|
|
|
|
|
/*-----------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
#if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
|
|
|
|
|
static TCB_t * prvCreateTask( TaskFunction_t pxTaskCode,
|
|
|
|
|
const char * const pcName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
|
|
|
|
const configSTACK_DEPTH_TYPE usStackDepth,
|
|
|
|
|
void * const pvParameters,
|
|
|
|
|
UBaseType_t uxPriority,
|
|
|
|
|
TaskHandle_t * const pxCreatedTask )
|
|
|
|
|
{
|
|
|
|
|
TCB_t * pxNewTCB;
|
|
|
|
|
BaseType_t xReturn;
|
|
|
|
|
|
|
|
|
|
traceENTER_xTaskCreate( pxTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pxCreatedTask );
|
|
|
|
|
|
|
|
|
|
/* If the stack grows down then allocate the stack then the TCB so the stack
|
|
|
|
|
* does not grow into the TCB. Likewise if the stack grows up then allocate
|
|
|
|
@ -1511,11 +1682,32 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION;
|
|
|
|
|
#endif /* tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE */
|
|
|
|
|
|
|
|
|
|
prvInitialiseNewTask( pxTaskCode, pcName, ( uint32_t ) usStackDepth, pvParameters, uxPriority, pxCreatedTask, pxNewTCB, NULL );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return pxNewTCB;
|
|
|
|
|
}
|
|
|
|
|
/*-----------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
BaseType_t xTaskCreate( TaskFunction_t pxTaskCode,
|
|
|
|
|
const char * const pcName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
|
|
|
|
const configSTACK_DEPTH_TYPE usStackDepth,
|
|
|
|
|
void * const pvParameters,
|
|
|
|
|
UBaseType_t uxPriority,
|
|
|
|
|
TaskHandle_t * const pxCreatedTask )
|
|
|
|
|
{
|
|
|
|
|
TCB_t * pxNewTCB;
|
|
|
|
|
BaseType_t xReturn;
|
|
|
|
|
|
|
|
|
|
traceENTER_xTaskCreate( pxTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pxCreatedTask );
|
|
|
|
|
|
|
|
|
|
pxNewTCB = prvCreateTask( pxTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pxCreatedTask );
|
|
|
|
|
|
|
|
|
|
if( pxNewTCB != NULL )
|
|
|
|
|
{
|
|
|
|
|
#if ( ( configNUMBER_OF_CORES > 1 ) && ( configUSE_CORE_AFFINITY == 1 ) )
|
|
|
|
|
{
|
|
|
|
|
/* Set the task's affinity before scheduling it. */
|
|
|
|
|
pxNewTCB->uxCoreAffinityMask = uxCoreAffinityMask;
|
|
|
|
|
pxNewTCB->uxCoreAffinityMask = tskNO_AFFINITY;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
@ -1531,6 +1723,42 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB ) PRIVILEGED_FUNCTION;
|
|
|
|
|
|
|
|
|
|
return xReturn;
|
|
|
|
|
}
|
|
|
|
|
/*-----------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
#if ( ( configNUMBER_OF_CORES > 1 ) && ( configUSE_CORE_AFFINITY == 1 ) )
|
|
|
|
|
BaseType_t xTaskCreateAffinitySet( TaskFunction_t pxTaskCode,
|
|
|
|
|
const char * const pcName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
|
|
|
|
const configSTACK_DEPTH_TYPE usStackDepth,
|
|
|
|
|
void * const pvParameters,
|
|
|
|
|
UBaseType_t uxPriority,
|
|
|
|
|
UBaseType_t uxCoreAffinityMask,
|
|
|
|
|
TaskHandle_t * const pxCreatedTask )
|
|
|
|
|
{
|
|
|
|
|
TCB_t * pxNewTCB;
|
|
|
|
|
BaseType_t xReturn;
|
|
|
|
|
|
|
|
|
|
traceENTER_xTaskCreateAffinitySet( pxTaskCode, pcName, usStackDepth, pvParameters, uxPriority, uxCoreAffinityMask, pxCreatedTask );
|
|
|
|
|
|
|
|
|
|
pxNewTCB = prvCreateTask( pxTaskCode, pcName, usStackDepth, pvParameters, uxPriority, pxCreatedTask );
|
|
|
|
|
|
|
|
|
|
if( pxNewTCB != NULL )
|
|
|
|
|
{
|
|
|
|
|
/* Set the task's affinity before scheduling it. */
|
|
|
|
|
pxNewTCB->uxCoreAffinityMask = uxCoreAffinityMask;
|
|
|
|
|
|
|
|
|
|
prvAddNewTaskToReadyList( pxNewTCB );
|
|
|
|
|
xReturn = pdPASS;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
xReturn = errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
traceRETURN_xTaskCreateAffinitySet( xReturn );
|
|
|
|
|
|
|
|
|
|
return xReturn;
|
|
|
|
|
}
|
|
|
|
|
#endif /* #if ( ( configNUMBER_OF_CORES > 1 ) && ( configUSE_CORE_AFFINITY == 1 ) ) */
|
|
|
|
|
|
|
|
|
|
#endif /* configSUPPORT_DYNAMIC_ALLOCATION */
|
|
|
|
|
/*-----------------------------------------------------------*/
|
|
|
|
@ -1681,18 +1909,6 @@ static void prvInitialiseNewTask( TaskFunction_t pxTaskCode,
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if ( ( configNUMBER_OF_CORES > 1 ) && ( configUSE_CORE_AFFINITY == 1 ) )
|
|
|
|
|
{
|
|
|
|
|
pxNewTCB->uxCoreAffinityMask = tskNO_AFFINITY;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if ( configUSE_TASK_PREEMPTION_DISABLE == 1 )
|
|
|
|
|
{
|
|
|
|
|
pxNewTCB->xPreemptionDisable = 0;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* Initialize the TCB stack to look as if the task was already running,
|
|
|
|
|
* but had been interrupted by the scheduler. The return address is set
|
|
|
|
|
* to the start of the task function. Once the stack has been initialised
|
|
|
|
|