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

Function prvProcessExpiredTimer

timers.c:546–586  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

544/*-----------------------------------------------------------*/
545
546 static void prvProcessExpiredTimer( const TickType_t xNextExpireTime,
547 const TickType_t xTimeNow )
548 {
549 BaseType_t xResult;
550 Timer_t * const pxTimer = ( Timer_t * ) listGET_OWNER_OF_HEAD_ENTRY( pxCurrentTimerList ); /*lint !e9087 !e9079 void * is used as this macro is used with tasks and co-routines too. Alignment is known to be fine as the type of the pointer stored and retrieved is the same. */
551
552 /* Remove the timer from the list of active timers. A check has already
553 * been performed to ensure the list is not empty. */
554
555 ( void ) uxListRemove( &( pxTimer->xTimerListItem ) );
556 traceTIMER_EXPIRED( pxTimer );
557
558 /* If the timer is an auto-reload timer then calculate the next
559 * expiry time and re-insert the timer in the list of active timers. */
560 if( ( pxTimer->ucStatus & tmrSTATUS_IS_AUTORELOAD ) != 0 )
561 {
562 /* The timer is inserted into a list using a time relative to anything
563 * other than the current time. It will therefore be inserted into the
564 * correct list relative to the time this task thinks it is now. */
565 if( prvInsertTimerInActiveList( pxTimer, ( xNextExpireTime + pxTimer->xTimerPeriodInTicks ), xTimeNow, xNextExpireTime ) != pdFALSE )
566 {
567 /* The timer expired before it was added to the active timer
568 * list. Reload it now. */
569 xResult = xTimerGenericCommand( pxTimer, tmrCOMMAND_START_DONT_TRACE, xNextExpireTime, NULL, tmrNO_DELAY );
570 configASSERT( xResult );
571 ( void ) xResult;
572 }
573 else
574 {
575 mtCOVERAGE_TEST_MARKER();
576 }
577 }
578 else
579 {
580 pxTimer->ucStatus &= ~tmrSTATUS_IS_ACTIVE;
581 mtCOVERAGE_TEST_MARKER();
582 }
583
584 /* Call the timer callback. */
585 pxTimer->pxCallbackFunction( ( TimerHandle_t ) pxTimer );
586 }
587/*-----------------------------------------------------------*/
588
589 static portTASK_FUNCTION( prvTimerTask, pvParameters )

Callers 1

Calls 2

uxListRemoveFunction · 0.85

Tested by

no test coverage detected