MCPcopy Create free account
hub / github.com/FreeRTOS/FreeRTOS-Kernel / xTaskCreateRestrictedStatic

Function xTaskCreateRestrictedStatic

tasks.c:1112–1152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1110#if ( ( portUSING_MPU_WRAPPERS == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) )
1111
1112 BaseType_t xTaskCreateRestrictedStatic( const TaskParameters_t * const pxTaskDefinition,
1113 TaskHandle_t * pxCreatedTask )
1114 {
1115 TCB_t * pxNewTCB;
1116 BaseType_t xReturn = errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY;
1117
1118 configASSERT( pxTaskDefinition->puxStackBuffer != NULL );
1119 configASSERT( pxTaskDefinition->pxTaskBuffer != NULL );
1120
1121 if( ( pxTaskDefinition->puxStackBuffer != NULL ) && ( pxTaskDefinition->pxTaskBuffer != NULL ) )
1122 {
1123 /* Allocate space for the TCB. Where the memory comes from depends
1124 * on the implementation of the port malloc function and whether or
1125 * not static allocation is being used. */
1126 pxNewTCB = ( TCB_t * ) pxTaskDefinition->pxTaskBuffer;
1127
1128 /* Store the stack location in the TCB. */
1129 pxNewTCB->pxStack = pxTaskDefinition->puxStackBuffer;
1130
1131 #if ( tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE != 0 )
1132 {
1133 /* Tasks can be created statically or dynamically, so note this
1134 * task was created statically in case the task is later deleted. */
1135 pxNewTCB->ucStaticallyAllocated = tskSTATICALLY_ALLOCATED_STACK_AND_TCB;
1136 }
1137 #endif /* tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE */
1138
1139 prvInitialiseNewTask( pxTaskDefinition->pvTaskCode,
1140 pxTaskDefinition->pcName,
1141 ( uint32_t ) pxTaskDefinition->usStackDepth,
1142 pxTaskDefinition->pvParameters,
1143 pxTaskDefinition->uxPriority,
1144 pxCreatedTask, pxNewTCB,
1145 pxTaskDefinition->xRegions );
1146
1147 prvAddNewTaskToReadyList( pxNewTCB );
1148 xReturn = pdPASS;
1149 }
1150
1151 return xReturn;
1152 }
1153
1154#endif /* ( portUSING_MPU_WRAPPERS == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) */
1155/*-----------------------------------------------------------*/

Callers

nothing calls this directly

Calls 2

prvInitialiseNewTaskFunction · 0.85
prvAddNewTaskToReadyListFunction · 0.85

Tested by

no test coverage detected