CPU Timer Module¶
The CPU timer API provides a set of functions for configuring and using the CPU Timer module. Functions are provided to setup and configure the timer module operating conditions along with functions to get the status of the module and to clear overflow flag.
-
group
cputimer_api Enums
-
enum
CPUTimer_EmulationMode¶ Values that can be passed to CPUTimer_setEmulationMode() as the mode parameter.
Values:
-
enumerator
CPUTIMER_EMULATIONMODE_STOPAFTERNEXTDECREMENT= 0x0000¶ Denotes that the timer will stop after the next decrement.
-
enumerator
CPUTIMER_EMULATIONMODE_STOPATZERO= 0x0400¶ Denotes that the timer will stop when it reaches zero.
-
enumerator
CPUTIMER_EMULATIONMODE_RUNFREE= 0x0800¶ Denotes that the timer will run free.
-
enumerator
-
enum
CPUTimer_Prescaler¶ The following are values that can be passed to CPUTimer_selectClockSource() as the prescaler parameter.
Values:
-
enumerator
CPUTIMER_CLOCK_PRESCALER_1= 0¶ Prescaler value of / 1.
-
enumerator
CPUTIMER_CLOCK_PRESCALER_2= 1¶ Prescaler value of / 2.
-
enumerator
CPUTIMER_CLOCK_PRESCALER_4= 2¶ Prescaler value of / 4.
-
enumerator
CPUTIMER_CLOCK_PRESCALER_8= 3¶ Prescaler value of / 8.
-
enumerator
CPUTIMER_CLOCK_PRESCALER_16= 4¶ Prescaler value of / 16.
-
enumerator
Functions
-
void
CPUTimer_clearOverflowFlag(uint32_t base)¶ Clears CPU timer overflow flag.
This function clears the CPU timer overflow flag.
- Parameters
base: is the base address of the timer module.
- Return
None.
-
void
CPUTimer_disableInterrupt(uint32_t base)¶ Disables CPU timer interrupt.
This function disables the CPU timer interrupt.
- Parameters
base: is the base address of the timer module.
- Return
None.
-
void
CPUTimer_enableInterrupt(uint32_t base)¶ Enables CPU timer interrupt.
This function enables the CPU timer interrupt.
- Parameters
base: is the base address of the timer module.
- Return
None.
-
void
CPUTimer_reloadTimerCounter(uint32_t base)¶ Reloads CPU timer counter.
This function reloads the CPU timer counter with the values contained in the CPU timer period register.
- Parameters
base: is the base address of the timer module.
- Return
None.
-
void
CPUTimer_stopTimer(uint32_t base)¶ Stops CPU timer.
This function stops the CPU timer.
- Parameters
base: is the base address of the timer module.
- Return
None.
-
void
CPUTimer_resumeTimer(uint32_t base)¶ Starts(restarts) CPU timer.
This function starts (restarts) the CPU timer.
- Parameters
base: is the base address of the timer module.
Note: This function doesn’t reset the timer counter.
- Return
None.
-
void
CPUTimer_startTimer(uint32_t base)¶ Starts(restarts) CPU timer.
This function starts (restarts) the CPU timer.
- Parameters
base: is the base address of the timer module.
Note: This function reloads the timer counter.
- Return
None.
-
void
CPUTimer_setPeriod(uint32_t base, uint32_t periodCount)¶ Sets CPU timer period.
This function sets the CPU timer period count.
- Parameters
base: is the base address of the timer module.periodCount: is the CPU timer period count.
- Return
None.
-
uint32_t
CPUTimer_getTimerCount(uint32_t base)¶ Returns the current CPU timer counter value.
This function returns the current CPU timer counter value.
- Parameters
base: is the base address of the timer module.
- Return
Returns the current CPU timer count value.
-
void
CPUTimer_setPreScaler(uint32_t base, uint16_t prescaler)¶ Set CPU timer pre-scaler value.
This function sets the pre-scaler value for the CPU timer. For every value of (prescaler + 1), the CPU timer counter decrements by 1.
- Parameters
base: is the base address of the timer module.prescaler: is the CPU timer pre-scaler value.
- Return
None.
-
bool
CPUTimer_getTimerOverflowStatus(uint32_t base)¶ Return the CPU timer overflow status.
This function returns the CPU timer overflow status.
- Parameters
base: is the base address of the timer module.
- Return
Returns true if the CPU timer has overflowed, false if not.
-
void
CPUTimer_setEmulationMode(uint32_t base, CPUTimer_EmulationMode mode)¶ Sets Emulation mode for CPU timer.
This function sets the behaviour of CPU timer during emulation. Valid values mode are: CPUTIMER_EMULATIONMODE_STOPAFTERNEXTDECREMENT, CPUTIMER_EMULATIONMODE_STOPATZERO and CPUTIMER_EMULATIONMODE_RUNFREE.
- Parameters
base: is the base address of the timer module.mode: is the emulation mode of the timer.
- Return
None.
-
enum
The code for this module is contained in driverlib_cm/cputimer.c, with driverlib_cm/cputimer.h containing the API declarations for use by applications.