Create minor optimisations (just an asm instruction or two) by using consts in a few places where previously a volatile variable that didn't change was used.

Add the simple xTimerGetPeriod() and xTimerGetExpiryTime() functions.
This commit is contained in:
Richard Barry 2016-03-29 13:07:27 +00:00
parent 26d3770fad
commit aeb03e5fa0
5 changed files with 217 additions and 140 deletions

View file

@ -433,6 +433,26 @@ TaskHandle_t xTimerGetTimerDaemonTaskHandle( void )
}
/*-----------------------------------------------------------*/
TickType_t xTimerGetPeriod( TimerHandle_t xTimer )
{
const Timer_t * const pxTimer = ( const Timer_t * const ) xTimer;
configASSERT( xTimer );
return pxTimer->xTimerPeriodInTicks;
}
/*-----------------------------------------------------------*/
TickType_t xTimerGetExpiryTime( TimerHandle_t xTimer )
{
const Timer_t * const pxTimer = ( const Timer_t * const ) xTimer;
TickType_t xReturn;
configASSERT( xTimer );
xReturn = listGET_LIST_ITEM_VALUE( &( pxTimer->xTimerListItem ) );
return xReturn;
}
/*-----------------------------------------------------------*/
const char * pcTimerGetTimerName( TimerHandle_t xTimer ) /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
{
Timer_t *pxTimer = ( Timer_t * ) xTimer;