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

Function prvInsertTimerInActiveList

timers.c:737–778  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

735/*-----------------------------------------------------------*/
736
737 static BaseType_t prvInsertTimerInActiveList( Timer_t * const pxTimer,
738 const TickType_t xNextExpiryTime,
739 const TickType_t xTimeNow,
740 const TickType_t xCommandTime )
741 {
742 BaseType_t xProcessTimerNow = pdFALSE;
743
744 listSET_LIST_ITEM_VALUE( &( pxTimer->xTimerListItem ), xNextExpiryTime );
745 listSET_LIST_ITEM_OWNER( &( pxTimer->xTimerListItem ), pxTimer );
746
747 if( xNextExpiryTime <= xTimeNow )
748 {
749 /* Has the expiry time elapsed between the command to start/reset a
750 * timer was issued, and the time the command was processed? */
751 if( ( ( TickType_t ) ( xTimeNow - xCommandTime ) ) >= pxTimer->xTimerPeriodInTicks ) /*lint !e961 MISRA exception as the casts are only redundant for some ports. */
752 {
753 /* The time between a command being issued and the command being
754 * processed actually exceeds the timers period. */
755 xProcessTimerNow = pdTRUE;
756 }
757 else
758 {
759 vListInsert( pxOverflowTimerList, &( pxTimer->xTimerListItem ) );
760 }
761 }
762 else
763 {
764 if( ( xTimeNow < xCommandTime ) && ( xNextExpiryTime >= xCommandTime ) )
765 {
766 /* If, since the command was issued, the tick count has overflowed
767 * but the expiry time has not, then the timer must have already passed
768 * its expiry time and should be processed immediately. */
769 xProcessTimerNow = pdTRUE;
770 }
771 else
772 {
773 vListInsert( pxCurrentTimerList, &( pxTimer->xTimerListItem ) );
774 }
775 }
776
777 return xProcessTimerNow;
778 }
779/*-----------------------------------------------------------*/
780
781 static void prvProcessReceivedCommands( void )

Callers 2

prvProcessExpiredTimerFunction · 0.85

Calls 1

vListInsertFunction · 0.85

Tested by

no test coverage detected