AM64x MCU+ SDK  08.02.00
Timer

Features Supported

  • APIs to setup timer configuration
  • APIs to start and stop the timer
  • APIs to get the current timer count
  • APIs to check for counter overflow and clear timer overflow interrupt

Features NOT Supported

NA

Important Usage Guidelines

  • Support configuration for DM timer
  • Supports continues and oneshot mode
  • When configuring the timer period in micro second the 'periodInNsec' should be set to 0

Example Usage

Include the below file to access the APIs,

Example usage to initialize the timer

TimerP_Params timerParams;
/* setup timer but dont start it */
TimerP_Params_init(&timerParams);
timerParams.inputPreScaler = 1u;
timerParams.inputClkHz = 250u*1000u*1000u;
timerParams.periodInUsec = 10u*1000u;
timerParams.oneshotMode = 0;
timerParams.enableOverflowInt = 1;
TimerP_setup(timerBaseAddr, &timerParams);

Example usage to start the timer

/* start the tick timer */
TimerP_start(timerBaseAddr);

Example usage to get the current count value

uint32_t count;
/* start the tick timer */
count = TimerP_getCount(timerBaseAddr);

Example usage to stop the timer

/* stop the tick timer */
TimerP_stop(timerBaseAddr);

API

APIs for timer setup and control

TimerP_setup
void TimerP_setup(uint32_t baseAddr, TimerP_Params *params)
Setup timer but does not start it.
TimerP_Params::enableOverflowInt
uint32_t enableOverflowInt
Definition: TimerP.h:94
count
uint32_t count
Definition: tisci_rm_ra.h:6
TimerP_stop
void TimerP_stop(uint32_t baseAddr)
Stop timer.
TimerP.h
TimerP_start
void TimerP_start(uint32_t baseAddr)
Start timer.
TimerP_Params
Parameters for TimerP_setup.
Definition: TimerP.h:64
TimerP_getCount
uint32_t TimerP_getCount(uint32_t baseAddr)
Get timer current count.
TimerP_Params_init
void TimerP_Params_init(TimerP_Params *params)
Set default value for TimerP_Params.
TimerP_Params::oneshotMode
uint32_t oneshotMode
Definition: TimerP.h:90
TimerP_Params::inputClkHz
uint32_t inputClkHz
Definition: TimerP.h:73
TimerP_Params::inputPreScaler
uint32_t inputPreScaler
Definition: TimerP.h:66
TimerP_Params::periodInUsec
uint32_t periodInUsec
Definition: TimerP.h:78