mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-24 15:31:56 -04:00
Continue testing timers module. Still a work in progress.
This commit is contained in:
parent
8a9fb9554d
commit
8b5a004be1
|
@ -135,7 +135,7 @@ static void prvProcessExpiredTimer( portTickType xNextExpireTime, portTickType x
|
||||||
* The tick count has overflowed. Switch the timer lists after ensuring the
|
* The tick count has overflowed. Switch the timer lists after ensuring the
|
||||||
* current timer list does not still reference some timers.
|
* current timer list does not still reference some timers.
|
||||||
*/
|
*/
|
||||||
static void prvSwitchTimerLists( portTickType xTimeNow, portTickType xLastTime ) PRIVILEGED_FUNCTION;
|
static void prvSwitchTimerLists( portTickType xLastTime ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Obtain the current tick count, setting *pxTimerListsWereSwitched to pdTRUE
|
* Obtain the current tick count, setting *pxTimerListsWereSwitched to pdTRUE
|
||||||
|
@ -270,12 +270,8 @@ xTIMER *pxTimer;
|
||||||
if( prvInsertTimerInActiveList( pxTimer, ( xNextExpireTime + pxTimer->xTimerPeriodInTicks ), xTimeNow, xNextExpireTime ) == pdTRUE )
|
if( prvInsertTimerInActiveList( pxTimer, ( xNextExpireTime + pxTimer->xTimerPeriodInTicks ), xTimeNow, xNextExpireTime ) == pdTRUE )
|
||||||
{
|
{
|
||||||
/* The timer expired before it was added to the active timer
|
/* The timer expired before it was added to the active timer
|
||||||
list. Reload it now. The callback will get executed before
|
list. Reload it now. */
|
||||||
this function exits. */
|
xTimerGenericCommand( pxTimer, tmrCOMMAND_START, xNextExpireTime, NULL, tmrNO_DELAY );
|
||||||
if( pxTimer->uxAutoReload == pdTRUE )
|
|
||||||
{
|
|
||||||
xTimerGenericCommand( pxTimer, tmrCOMMAND_START, xNextExpireTime, NULL, tmrNO_DELAY ); /* Should it be xNextExpireTime or ( xNextExpireTime + pxTimer->xTimerPeriodInTicks )? I think the former. */
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -386,7 +382,7 @@ static portTickType xLastTime = ( portTickType ) 0U;
|
||||||
|
|
||||||
if( xTimeNow < xLastTime )
|
if( xTimeNow < xLastTime )
|
||||||
{
|
{
|
||||||
prvSwitchTimerLists( xTimeNow, xLastTime );
|
prvSwitchTimerLists( xLastTime );
|
||||||
*pxTimerListsWereSwitched = pdTRUE;
|
*pxTimerListsWereSwitched = pdTRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -510,10 +506,11 @@ portTickType xTimeNow;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
static void prvSwitchTimerLists( portTickType xTimeNow, portTickType xLastTime )
|
static void prvSwitchTimerLists( portTickType xLastTime )
|
||||||
{
|
{
|
||||||
portTickType xNextExpireTime;
|
portTickType xNextExpireTime;
|
||||||
xList *pxTemp;
|
xList *pxTemp;
|
||||||
|
xTIMER *pxTimer;
|
||||||
|
|
||||||
/* Remove compiler warnings if configASSERT() is not defined. */
|
/* Remove compiler warnings if configASSERT() is not defined. */
|
||||||
( void ) xLastTime;
|
( void ) xLastTime;
|
||||||
|
@ -526,7 +523,19 @@ xList *pxTemp;
|
||||||
{
|
{
|
||||||
xNextExpireTime = listGET_ITEM_VALUE_OF_HEAD_ENTRY( pxCurrentTimerList );
|
xNextExpireTime = listGET_ITEM_VALUE_OF_HEAD_ENTRY( pxCurrentTimerList );
|
||||||
configASSERT( ( xNextExpireTime >= xLastTime ) );
|
configASSERT( ( xNextExpireTime >= xLastTime ) );
|
||||||
prvProcessExpiredTimer( xNextExpireTime, xTimeNow );
|
|
||||||
|
/* Remove the timer from the list. */
|
||||||
|
pxTimer = ( xTIMER * ) listGET_OWNER_OF_HEAD_ENTRY( pxCurrentTimerList );
|
||||||
|
vListRemove( &( pxTimer->xTimerListItem ) );
|
||||||
|
|
||||||
|
/* Execute its callback, then send a command to restart the timer if
|
||||||
|
it is an auto-reload timer. It cannot be restarted here as the lists
|
||||||
|
have not yet been switched. */
|
||||||
|
pxTimer->pxCallbackFunction( ( xTimerHandle ) pxTimer );
|
||||||
|
if( pxTimer->uxAutoReload == pdTRUE )
|
||||||
|
{
|
||||||
|
xTimerGenericCommand( pxTimer, tmrCOMMAND_START, xNextExpireTime, NULL, tmrNO_DELAY );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pxTemp = pxCurrentTimerList;
|
pxTemp = pxCurrentTimerList;
|
||||||
|
|
Loading…
Reference in a new issue