* Remove support for tmrCOMMAND_START_DONT_TRACE
Prior to this commit, the timer task used tmrCOMMAND_START_DONT_TRACE
to reload a "backlogged" auto-reload timer -- one for which a reload
operation would have started a period that had already elapsed. If the
command queue contained a stop or delete command when
tmrCOMMAND_START_DONT_TRACE was put into the queue for a reload, the
timer unexpectedly restarted when the timer task processed
tmrCOMMAND_START_DONT_TRACE. This commit implements a new method of
reloading auto-reload timers and eliminates support for
tmrCOMMAND_START_DONT_TRACE. No other code sends this private command.
However, the symbol tmrCOMMAND_START_DONT_TRACE remains defined, with
its original command value, so as not to impact trace applications.
Also fix one-shot timers that were not reliably being marked as not
active:
- when they expired before the start command could be processed
- when the expiration was processed during the timer list switch
Also improve consistency:
- Always reload auto-reload timers *before* calling the callback.
- Always call traceTIMER_EXPIRED() just prior to the callback.
* fix indent
* Revert unnecessary change to prvTimerTask()
Change was intended to faithfully work through a backlog that spanned a
list switch, and before processing a stop or delete command. But, (1)
it isn't important to do that, and (2) the code didn't accomplish the
intention when *two* auto-reload timers were backlogged across a list
switch. Best to simply leave this part of the code as it was before.
* fix style
Co-authored-by: Joseph Julicher <jjulicher@mac.com>
Timer_t*constpxTimer=(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. */
Timer_t*constpxTimer=(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. */
/* Remove the timer from the list of active timers. A check has already
/* Remove the timer from the list of active timers. A check has already
*beenperformedtoensurethelistisnotempty.*/
*beenperformedtoensurethelistisnotempty.*/
(void)uxListRemove(&(pxTimer->xTimerListItem));
(void)uxListRemove(&(pxTimer->xTimerListItem));
traceTIMER_EXPIRED(pxTimer);
/* If the timer is an auto-reload timer then calculate the next
/* If the timer is an auto-reload timer then calculate the next
while(xQueueReceive(xTimerQueue,&xMessage,tmrNO_DELAY)!=pdFAIL)/*lint !e603 xMessage does not have to be initialised as it is passed out, not in, and it is not used unless xQueueReceive() returns pdTRUE. */
while(xQueueReceive(xTimerQueue,&xMessage,tmrNO_DELAY)!=pdFAIL)/*lint !e603 xMessage does not have to be initialised as it is passed out, not in, and it is not used unless xQueueReceive() returns pdTRUE. */
@ -802,7 +814,6 @@
casetmrCOMMAND_START_FROM_ISR:
casetmrCOMMAND_START_FROM_ISR:
casetmrCOMMAND_RESET:
casetmrCOMMAND_RESET:
casetmrCOMMAND_RESET_FROM_ISR:
casetmrCOMMAND_RESET_FROM_ISR:
casetmrCOMMAND_START_DONT_TRACE:
/* Start or restart a timer. */
/* Start or restart a timer. */
pxTimer->ucStatus|=tmrSTATUS_IS_ACTIVE;
pxTimer->ucStatus|=tmrSTATUS_IS_ACTIVE;
@ -810,19 +821,18 @@
{
{
/* The timer expired before it was added to the active
/* The timer expired before it was added to the active
/* Process the expired timer. For auto-reload timers, be careful to
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. */