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

Function xTimerCreateTimerTask

timers.c:223–273  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

221/*-----------------------------------------------------------*/
222
223 BaseType_t xTimerCreateTimerTask( void )
224 {
225 BaseType_t xReturn = pdFAIL;
226
227 /* This function is called when the scheduler is started if
228 * configUSE_TIMERS is set to 1. Check that the infrastructure used by the
229 * timer service task has been created/initialised. If timers have already
230 * been created then the initialisation will already have been performed. */
231 prvCheckForValidListAndQueue();
232
233 if( xTimerQueue != NULL )
234 {
235 #if ( configSUPPORT_STATIC_ALLOCATION == 1 )
236 {
237 StaticTask_t * pxTimerTaskTCBBuffer = NULL;
238 StackType_t * pxTimerTaskStackBuffer = NULL;
239 uint32_t ulTimerTaskStackSize;
240
241 vApplicationGetTimerTaskMemory( &pxTimerTaskTCBBuffer, &pxTimerTaskStackBuffer, &ulTimerTaskStackSize );
242 xTimerTaskHandle = xTaskCreateStatic( prvTimerTask,
243 configTIMER_SERVICE_TASK_NAME,
244 ulTimerTaskStackSize,
245 NULL,
246 ( ( UBaseType_t ) configTIMER_TASK_PRIORITY ) | portPRIVILEGE_BIT,
247 pxTimerTaskStackBuffer,
248 pxTimerTaskTCBBuffer );
249
250 if( xTimerTaskHandle != NULL )
251 {
252 xReturn = pdPASS;
253 }
254 }
255 #else /* if ( configSUPPORT_STATIC_ALLOCATION == 1 ) */
256 {
257 xReturn = xTaskCreate( prvTimerTask,
258 configTIMER_SERVICE_TASK_NAME,
259 configTIMER_TASK_STACK_DEPTH,
260 NULL,
261 ( ( UBaseType_t ) configTIMER_TASK_PRIORITY ) | portPRIVILEGE_BIT,
262 &xTimerTaskHandle );
263 }
264 #endif /* configSUPPORT_STATIC_ALLOCATION */
265 }
266 else
267 {
268 mtCOVERAGE_TEST_MARKER();
269 }
270
271 configASSERT( xReturn );
272 return xReturn;
273 }
274/*-----------------------------------------------------------*/
275
276 #if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )

Callers 1

vTaskStartSchedulerFunction · 0.85

Calls 3

xTaskCreateStaticFunction · 0.85
xTaskCreateFunction · 0.85

Tested by

no test coverage detected