MCPcopy Index your code
hub / github.com/FreeRTOS/FreeRTOS-Kernel / xTaskIncrementTick

Function xTaskIncrementTick

tasks.c:3465–3680  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3463/*----------------------------------------------------------*/
3464
3465BaseType_t xTaskIncrementTick( void )
3466{
3467 TCB_t * pxTCB;
3468 TickType_t xItemValue;
3469 BaseType_t xSwitchRequired = pdFALSE;
3470
3471 #if ( configUSE_PREEMPTION == 1 )
3472 UBaseType_t x;
3473 BaseType_t xCoreYieldList[ configNUM_CORES ] = { pdFALSE };
3474 #endif /* configUSE_PREEMPTION */
3475
3476 taskENTER_CRITICAL();
3477 {
3478 /* Called by the portable layer each time a tick interrupt occurs.
3479 * Increments the tick then checks to see if the new tick value will cause any
3480 * tasks to be unblocked. */
3481 traceTASK_INCREMENT_TICK( xTickCount );
3482
3483 /* Tick increment should occur on every kernel timer event. Core 0 has the
3484 * responsibility to increment the tick, or increment the pended ticks if the
3485 * scheduler is suspended. If pended ticks is greater than zero, the core that
3486 * calls xTaskResumeAll has the responsibility to increment the tick. */
3487 if( uxSchedulerSuspended == ( UBaseType_t ) pdFALSE )
3488 {
3489 /* Minor optimisation. The tick count cannot change in this
3490 * block. */
3491 const TickType_t xConstTickCount = xTickCount + ( TickType_t ) 1;
3492
3493 /* Increment the RTOS tick, switching the delayed and overflowed
3494 * delayed lists if it wraps to 0. */
3495 xTickCount = xConstTickCount;
3496
3497 if( xConstTickCount == ( TickType_t ) 0U ) /*lint !e774 'if' does not always evaluate to false as it is looking for an overflow. */
3498 {
3499 taskSWITCH_DELAYED_LISTS();
3500 }
3501 else
3502 {
3503 mtCOVERAGE_TEST_MARKER();
3504 }
3505
3506 /* See if this tick has made a timeout expire. Tasks are stored in
3507 * the queue in the order of their wake time - meaning once one task
3508 * has been found whose block time has not expired there is no need to
3509 * look any further down the list. */
3510 if( xConstTickCount >= xNextTaskUnblockTime )
3511 {
3512 for( ; ; )
3513 {
3514 if( listLIST_IS_EMPTY( pxDelayedTaskList ) != pdFALSE )
3515 {
3516 /* The delayed list is empty. Set xNextTaskUnblockTime
3517 * to the maximum possible value so it is extremely
3518 * unlikely that the
3519 * if( xTickCount >= xNextTaskUnblockTime ) test will pass
3520 * next time through. */
3521 xNextTaskUnblockTime = portMAX_DELAY; /*lint !e961 MISRA exception as the casts are only redundant for some ports. */
3522 break;

Callers 15

xTaskResumeAllFunction · 0.85
xPortSysTickHandlerFunction · 0.85
vPortNonPreemptiveTickFunction · 0.85
xPortSysTickHandlerFunction · 0.85
ReloadTimer0_IRQHandlerFunction · 0.85
prvRLT0_TICKISRFunction · 0.85
port.cFile · 0.85
port.cFile · 0.85
vPortSystemTickHandlerFunction · 0.85
vKernelTickFunction · 0.85
xPortSysTickHandlerFunction · 0.85
vPortYieldFromTickFunction · 0.85

Calls 3

uxListRemoveFunction · 0.85
prvYieldForTaskFunction · 0.85
prvYieldCoreFunction · 0.85

Tested by

no test coverage detected