36
timers.c
36
timers.c
@ -43,11 +43,10 @@
|
||||
#error configUSE_TIMERS must be set to 1 to make the xTimerPendFunctionCall() function available.
|
||||
#endif
|
||||
|
||||
/* Lint e9021, e961 and e750 are suppressed as a MISRA exception justified
|
||||
* because the MPU ports require MPU_WRAPPERS_INCLUDED_FROM_API_FILE to be defined
|
||||
/* The MPU ports require MPU_WRAPPERS_INCLUDED_FROM_API_FILE to be defined
|
||||
* for the header files above, but not in this file, in order to generate the
|
||||
* correct privileged Vs unprivileged linkage and placement. */
|
||||
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE /*lint !e9021 !e961 !e750. */
|
||||
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
|
||||
|
||||
|
||||
/* This entire source file will be skipped if the application is not configured
|
||||
@ -83,7 +82,7 @@
|
||||
/* The definition of the timers themselves. */
|
||||
typedef struct tmrTimerControl /* The old naming convention is used to prevent breaking kernel aware debuggers. */
|
||||
{
|
||||
const char * pcTimerName; /**< Text name. This is not used by the kernel, it is included simply to make debugging easier. */ /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||
const char * pcTimerName; /**< Text name. This is not used by the kernel, it is included simply to make debugging easier. */
|
||||
ListItem_t xTimerListItem; /**< Standard linked list item as used by all kernel features for event management. */
|
||||
TickType_t xTimerPeriodInTicks; /**< How quickly and often the timer expires. */
|
||||
void * pvTimerID; /**< An ID to identify the timer. This allows the timer to be identified when the same callback is used for multiple timers. */
|
||||
@ -135,9 +134,6 @@
|
||||
} u;
|
||||
} DaemonTaskMessage_t;
|
||||
|
||||
/*lint -save -e956 A manual analysis and inspection has been used to determine
|
||||
* which static variables must be declared volatile. */
|
||||
|
||||
/* The list in which active timers are stored. Timers are referenced in expire
|
||||
* time order, with the nearest expiry time at the front of the list. Only the
|
||||
* timer service task is allowed to access these lists.
|
||||
@ -153,8 +149,6 @@
|
||||
PRIVILEGED_DATA static QueueHandle_t xTimerQueue = NULL;
|
||||
PRIVILEGED_DATA static TaskHandle_t xTimerTaskHandle = NULL;
|
||||
|
||||
/*lint -restore */
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
@ -232,7 +226,7 @@
|
||||
* Called after a Timer_t structure has been allocated either statically or
|
||||
* dynamically to fill in the structure's members.
|
||||
*/
|
||||
static void prvInitialiseNewTimer( const char * const pcTimerName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||
static void prvInitialiseNewTimer( const char * const pcTimerName,
|
||||
const TickType_t xTimerPeriodInTicks,
|
||||
const BaseType_t xAutoReload,
|
||||
void * const pvTimerID,
|
||||
@ -339,7 +333,7 @@
|
||||
|
||||
#if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
|
||||
|
||||
TimerHandle_t xTimerCreate( const char * const pcTimerName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||
TimerHandle_t xTimerCreate( const char * const pcTimerName,
|
||||
const TickType_t xTimerPeriodInTicks,
|
||||
const BaseType_t xAutoReload,
|
||||
void * const pvTimerID,
|
||||
@ -373,7 +367,7 @@
|
||||
|
||||
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
|
||||
|
||||
TimerHandle_t xTimerCreateStatic( const char * const pcTimerName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||
TimerHandle_t xTimerCreateStatic( const char * const pcTimerName,
|
||||
const TickType_t xTimerPeriodInTicks,
|
||||
const BaseType_t xAutoReload,
|
||||
void * const pvTimerID,
|
||||
@ -391,7 +385,7 @@
|
||||
* structure. */
|
||||
volatile size_t xSize = sizeof( StaticTimer_t );
|
||||
configASSERT( xSize == sizeof( Timer_t ) );
|
||||
( void ) xSize; /* Keeps lint quiet when configASSERT() is not defined. */
|
||||
( void ) xSize; /* Prevent unused variable warning when configASSERT() is not defined. */
|
||||
}
|
||||
#endif /* configASSERT_DEFINED */
|
||||
|
||||
@ -420,7 +414,7 @@
|
||||
#endif /* configSUPPORT_STATIC_ALLOCATION */
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static void prvInitialiseNewTimer( const char * const pcTimerName, /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||
static void prvInitialiseNewTimer( const char * const pcTimerName,
|
||||
const TickType_t xTimerPeriodInTicks,
|
||||
const BaseType_t xAutoReload,
|
||||
void * const pvTimerID,
|
||||
@ -688,7 +682,7 @@
|
||||
#endif /* configSUPPORT_STATIC_ALLOCATION */
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
const char * pcTimerGetName( TimerHandle_t xTimer ) /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
|
||||
const char * pcTimerGetName( TimerHandle_t xTimer )
|
||||
{
|
||||
Timer_t * pxTimer = xTimer;
|
||||
|
||||
@ -877,7 +871,7 @@
|
||||
static TickType_t prvSampleTimeNow( BaseType_t * const pxTimerListsWereSwitched )
|
||||
{
|
||||
TickType_t xTimeNow;
|
||||
PRIVILEGED_DATA static TickType_t xLastTime = ( TickType_t ) 0U; /*lint !e956 Variable is only accessible to one task. */
|
||||
PRIVILEGED_DATA static TickType_t xLastTime = ( TickType_t ) 0U;
|
||||
|
||||
xTimeNow = xTaskGetTickCount();
|
||||
|
||||
@ -911,7 +905,7 @@
|
||||
{
|
||||
/* Has the expiry time elapsed between the command to start/reset a
|
||||
* timer was issued, and the time the command was processed? */
|
||||
if( ( ( TickType_t ) ( xTimeNow - xCommandTime ) ) >= pxTimer->xTimerPeriodInTicks ) /*lint !e961 MISRA exception as the casts are only redundant for some ports. */
|
||||
if( ( ( TickType_t ) ( xTimeNow - xCommandTime ) ) >= pxTimer->xTimerPeriodInTicks )
|
||||
{
|
||||
/* The time between a command being issued and the command being
|
||||
* processed actually exceeds the timers period. */
|
||||
@ -980,7 +974,7 @@
|
||||
* software timer. */
|
||||
pxTimer = xMessage.u.xTimerParameters.pxTimer;
|
||||
|
||||
if( listIS_CONTAINED_WITHIN( NULL, &( pxTimer->xTimerListItem ) ) == pdFALSE ) /*lint !e961. The cast is only redundant when NULL is passed into the macro. */
|
||||
if( listIS_CONTAINED_WITHIN( NULL, &( pxTimer->xTimerListItem ) ) == pdFALSE )
|
||||
{
|
||||
/* The timer is in a list, remove it. */
|
||||
( void ) uxListRemove( &( pxTimer->xTimerListItem ) );
|
||||
@ -1132,8 +1126,8 @@
|
||||
{
|
||||
/* The timer queue is allocated statically in case
|
||||
* configSUPPORT_DYNAMIC_ALLOCATION is 0. */
|
||||
PRIVILEGED_DATA static StaticQueue_t xStaticTimerQueue; /*lint !e956 Ok to declare in this manner to prevent additional conditional compilation guards in other locations. */
|
||||
PRIVILEGED_DATA static uint8_t ucStaticTimerQueueStorage[ ( size_t ) configTIMER_QUEUE_LENGTH * sizeof( DaemonTaskMessage_t ) ]; /*lint !e956 Ok to declare in this manner to prevent additional conditional compilation guards in other locations. */
|
||||
PRIVILEGED_DATA static StaticQueue_t xStaticTimerQueue;
|
||||
PRIVILEGED_DATA static uint8_t ucStaticTimerQueueStorage[ ( size_t ) configTIMER_QUEUE_LENGTH * sizeof( DaemonTaskMessage_t ) ];
|
||||
|
||||
xTimerQueue = xQueueCreateStatic( ( UBaseType_t ) configTIMER_QUEUE_LENGTH, ( UBaseType_t ) sizeof( DaemonTaskMessage_t ), &( ucStaticTimerQueueStorage[ 0 ] ), &xStaticTimerQueue );
|
||||
}
|
||||
@ -1191,7 +1185,7 @@
|
||||
traceRETURN_xTimerIsTimerActive( xReturn );
|
||||
|
||||
return xReturn;
|
||||
} /*lint !e818 Can't be pointer to const due to the typedef. */
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
void * pvTimerGetTimerID( const TimerHandle_t xTimer )
|
||||
|
Reference in New Issue
Block a user