2.47 ARM Cortex A Generic timer (GENERIC_TIMER)

The Generic Timer:

  1. Provides a system counter, that measures the passing of time in real-time

  2. Provides timers, that can assert a timer output signal after a period of time has passed.

  3. The timers can be used as a count-up or count-down timers

Using The Library

  • Generic Timer plib implements uses the counter view of the generic timer, wherein it is used as 64 bit up-counter

  • Timer is initialized using GENERIC_TIMER_Initialize() function which configures the timer registers with values based on the MCC GUI settings for this plib

  • Timer can be started using GENERIC_TIMER_Start() function and stopped using GENERIC_TIMER_Stop() APIs

  • Timer period can be set using GENERIC_TIMER_PeriodSet() function

  • If a callback is registered using GENERIC_TIMER_CallbackRegister() function, when the timer period expires (i.e. when the interrupt occurs), the callback function will be executed

Library Interface

ARM Cortex A Generic timer peripheral library provides the following interfaces:

Functions

NameDescription
GENERIC_TIMER_InitializeInitialize Generic Timer registers per user config
GENERIC_TIMER_CounterValueGetReturns 64 bit counter value
GENERIC_TIMER_CounterFrequencyGetReturns counter frequency
GENERIC_TIMER_StartStart the Generic timer
GENERIC_TIMER_StopStop Generic timer
GENERIC_TIMER_PeriodSetSet the timer period value
GENERIC_TIMER_PeriodGetGet the timer period value
GENERIC_TIMER_DelayMsDelays processing for x milliseconds
GENERIC_TIMER_DelayUsDelays processing for x microseconds
GENERIC_TIMER_CallbackRegisterRegister callback for generic timer interrupt

Data types and constants

NameTypeDescription
GENERIC_TIMER_CALLBACKTypedefGeneric Timer Interrupt Callback Function definition
Note: Not all APIs maybe implemented. See the specific device family section for available APIs.