* The tick count has overflowed. Switch the timer lists after ensuring the\r
* current timer list does not still reference some timers.\r
*/\r
-static void prvSwitchTimerLists( portTickType xTimeNow, portTickType xLastTime ) PRIVILEGED_FUNCTION;\r
+static void prvSwitchTimerLists( portTickType xLastTime ) PRIVILEGED_FUNCTION;\r
\r
/*\r
* Obtain the current tick count, setting *pxTimerListsWereSwitched to pdTRUE\r
if( prvInsertTimerInActiveList( pxTimer, ( xNextExpireTime + pxTimer->xTimerPeriodInTicks ), xTimeNow, xNextExpireTime ) == pdTRUE )\r
{\r
/* The timer expired before it was added to the active timer\r
- list. Reload it now. The callback will get executed before\r
- this function exits. */\r
- if( pxTimer->uxAutoReload == pdTRUE )\r
- {\r
- xTimerGenericCommand( pxTimer, tmrCOMMAND_START, xNextExpireTime, NULL, tmrNO_DELAY ); /* Should it be xNextExpireTime or ( xNextExpireTime + pxTimer->xTimerPeriodInTicks )? I think the former. */\r
- }\r
+ list. Reload it now. */\r
+ xTimerGenericCommand( pxTimer, tmrCOMMAND_START, xNextExpireTime, NULL, tmrNO_DELAY );\r
}\r
}\r
\r
\r
if( xTimeNow < xLastTime )\r
{\r
- prvSwitchTimerLists( xTimeNow, xLastTime );\r
+ prvSwitchTimerLists( xLastTime );\r
*pxTimerListsWereSwitched = pdTRUE;\r
}\r
else\r
}\r
/*-----------------------------------------------------------*/\r
\r
-static void prvSwitchTimerLists( portTickType xTimeNow, portTickType xLastTime )\r
+static void prvSwitchTimerLists( portTickType xLastTime )\r
{\r
portTickType xNextExpireTime;\r
xList *pxTemp;\r
+xTIMER *pxTimer;\r
\r
/* Remove compiler warnings if configASSERT() is not defined. */\r
( void ) xLastTime;\r
{\r
xNextExpireTime = listGET_ITEM_VALUE_OF_HEAD_ENTRY( pxCurrentTimerList );\r
configASSERT( ( xNextExpireTime >= xLastTime ) );\r
- prvProcessExpiredTimer( xNextExpireTime, xTimeNow );\r
+\r
+ /* Remove the timer from the list. */\r
+ pxTimer = ( xTIMER * ) listGET_OWNER_OF_HEAD_ENTRY( pxCurrentTimerList );\r
+ vListRemove( &( pxTimer->xTimerListItem ) );\r
+\r
+ /* Execute its callback, then send a command to restart the timer if\r
+ it is an auto-reload timer. It cannot be restarted here as the lists\r
+ have not yet been switched. */\r
+ pxTimer->pxCallbackFunction( ( xTimerHandle ) pxTimer );\r
+ if( pxTimer->uxAutoReload == pdTRUE )\r
+ {\r
+ xTimerGenericCommand( pxTimer, tmrCOMMAND_START, xNextExpireTime, NULL, tmrNO_DELAY );\r
+ }\r
}\r
\r
pxTemp = pxCurrentTimerList;\r