| 929 | /*-----------------------------------------------------------*/ |
| 930 | |
| 931 | static void prvSwitchTimerLists( void ) |
| 932 | { |
| 933 | TickType_t xNextExpireTime, xReloadTime; |
| 934 | List_t * pxTemp; |
| 935 | Timer_t * pxTimer; |
| 936 | BaseType_t xResult; |
| 937 | |
| 938 | /* The tick count has overflowed. The timer lists must be switched. |
| 939 | * If there are any timers still referenced from the current timer list |
| 940 | * then they must have expired and should be processed before the lists |
| 941 | * are switched. */ |
| 942 | while( listLIST_IS_EMPTY( pxCurrentTimerList ) == pdFALSE ) |
| 943 | { |
| 944 | xNextExpireTime = listGET_ITEM_VALUE_OF_HEAD_ENTRY( pxCurrentTimerList ); |
| 945 | |
| 946 | /* Remove the timer from the list. */ |
| 947 | 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. */ |
| 948 | ( void ) uxListRemove( &( pxTimer->xTimerListItem ) ); |
| 949 | traceTIMER_EXPIRED( pxTimer ); |
| 950 | |
| 951 | /* Execute its callback, then send a command to restart the timer if |
| 952 | * it is an auto-reload timer. It cannot be restarted here as the lists |
| 953 | * have not yet been switched. */ |
| 954 | pxTimer->pxCallbackFunction( ( TimerHandle_t ) pxTimer ); |
| 955 | |
| 956 | if( ( pxTimer->ucStatus & tmrSTATUS_IS_AUTORELOAD ) != 0 ) |
| 957 | { |
| 958 | /* Calculate the reload value, and if the reload value results in |
| 959 | * the timer going into the same timer list then it has already expired |
| 960 | * and the timer should be re-inserted into the current list so it is |
| 961 | * processed again within this loop. Otherwise a command should be sent |
| 962 | * to restart the timer to ensure it is only inserted into a list after |
| 963 | * the lists have been swapped. */ |
| 964 | xReloadTime = ( xNextExpireTime + pxTimer->xTimerPeriodInTicks ); |
| 965 | |
| 966 | if( xReloadTime > xNextExpireTime ) |
| 967 | { |
| 968 | listSET_LIST_ITEM_VALUE( &( pxTimer->xTimerListItem ), xReloadTime ); |
| 969 | listSET_LIST_ITEM_OWNER( &( pxTimer->xTimerListItem ), pxTimer ); |
| 970 | vListInsert( pxCurrentTimerList, &( pxTimer->xTimerListItem ) ); |
| 971 | } |
| 972 | else |
| 973 | { |
| 974 | xResult = xTimerGenericCommand( pxTimer, tmrCOMMAND_START_DONT_TRACE, xNextExpireTime, NULL, tmrNO_DELAY ); |
| 975 | configASSERT( xResult ); |
| 976 | ( void ) xResult; |
| 977 | } |
| 978 | } |
| 979 | else |
| 980 | { |
| 981 | mtCOVERAGE_TEST_MARKER(); |
| 982 | } |
| 983 | } |
| 984 | |
| 985 | pxTemp = pxCurrentTimerList; |
| 986 | pxCurrentTimerList = pxOverflowTimerList; |
| 987 | pxOverflowTimerList = pxTemp; |
| 988 | } |
no test coverage detected