Functions
Timer_api

Functions

void TimerEnable (uint32_t ui32Base, uint32_t ui32Timer)
 
void TimerDisable (uint32_t ui32Base, uint32_t ui32Timer)
 
void TimerConfigure (uint32_t ui32Base, uint32_t ui32Config)
 
void TimerControlLevel (uint32_t ui32Base, uint32_t ui32Timer, bool bInvert)
 
void TimerControlTrigger (uint32_t ui32Base, uint32_t ui32Timer, bool bEnable)
 
void TimerControlEvent (uint32_t ui32Base, uint32_t ui32Timer, uint32_t ui32Event)
 
void TimerControlStall (uint32_t ui32Base, uint32_t ui32Timer, bool bStall)
 
void TimerControlWaitOnTrigger (uint32_t ui32Base, uint32_t ui32Timer, bool bWait)
 
void TimerRTCEnable (uint32_t ui32Base)
 
void TimerRTCDisable (uint32_t ui32Base)
 
void TimerClockSourceSet (uint32_t ui32Base, uint32_t ui32Source)
 
uint32_t TimerClockSourceGet (uint32_t ui32Base)
 
void TimerPrescaleSet (uint32_t ui32Base, uint32_t ui32Timer, uint32_t ui32Value)
 
uint32_t TimerPrescaleGet (uint32_t ui32Base, uint32_t ui32Timer)
 
void TimerPrescaleMatchSet (uint32_t ui32Base, uint32_t ui32Timer, uint32_t ui32Value)
 
uint32_t TimerPrescaleMatchGet (uint32_t ui32Base, uint32_t ui32Timer)
 
void TimerLoadSet (uint32_t ui32Base, uint32_t ui32Timer, uint32_t ui32Value)
 
uint32_t TimerLoadGet (uint32_t ui32Base, uint32_t ui32Timer)
 
uint32_t TimerValueGet (uint32_t ui32Base, uint32_t ui32Timer)
 
void TimerMatchSet (uint32_t ui32Base, uint32_t ui32Timer, uint32_t ui32Value)
 
uint32_t TimerMatchGet (uint32_t ui32Base, uint32_t ui32Timer)
 
void TimerIntRegister (uint32_t ui32Base, uint32_t ui32Timer, void(*pfnHandler)(void))
 
void TimerIntUnregister (uint32_t ui32Base, uint32_t ui32Timer)
 
void TimerIntEnable (uint32_t ui32Base, uint32_t ui32IntFlags)
 
void TimerIntDisable (uint32_t ui32Base, uint32_t ui32IntFlags)
 
uint32_t TimerIntStatus (uint32_t ui32Base, bool bMasked)
 
void TimerIntClear (uint32_t ui32Base, uint32_t ui32IntFlags)
 
void TimerSynchronize (uint32_t ui32Base, uint32_t ui32Timers)
 
void TimerADCEventSet (uint32_t ui32Base, uint32_t ui32ADCEvent)
 
uint32_t TimerADCEventGet (uint32_t ui32Base)
 
void TimerDMAEventSet (uint32_t ui32Base, uint32_t ui32DMAEvent)
 
uint32_t TimerDMAEventGet (uint32_t ui32Base)
 
void TimerUpdateMode (uint32_t ui32Base, uint32_t ui32Timer, uint32_t ui32Config)
 

Detailed Description

Function Documentation

§ TimerEnable()

void TimerEnable ( uint32_t  ui32Base,
uint32_t  ui32Timer 
)

Enables the timer(s).

Parameters
ui32Baseis the base address of the timer module.
ui32Timerspecifies the timer(s) to enable; must be one of TIMER_A, TIMER_B, or TIMER_BOTH.

This function enables operation of the timer module. The timer must be configured before it is enabled.

Returns
None.

References ASSERT, HWREG, TIMER_A, TIMER_B, TIMER_BOTH, TIMER_CTL_TAEN, TIMER_CTL_TBEN, and TIMER_O_CTL.

§ TimerDisable()

void TimerDisable ( uint32_t  ui32Base,
uint32_t  ui32Timer 
)

Disables the timer(s).

Parameters
ui32Baseis the base address of the timer module.
ui32Timerspecifies the timer(s) to disable; must be one of TIMER_A, TIMER_B, or TIMER_BOTH.

This function disables operation of the timer module.

Returns
None.

References ASSERT, HWREG, TIMER_A, TIMER_B, TIMER_BOTH, TIMER_CTL_TAEN, TIMER_CTL_TBEN, and TIMER_O_CTL.

§ TimerConfigure()

void TimerConfigure ( uint32_t  ui32Base,
uint32_t  ui32Config 
)

Configures the timer(s).

Parameters
ui32Baseis the base address of the timer module.
ui32Configis the configuration for the timer.

This function configures the operating mode of the timer(s). The timer module is disabled before being configured and is left in the disabled state. The timer can be configured to be a single full-width timer by using the TIMER_CFG_* values or a pair of half-width timers using the TIMER_CFG_A_* and TIMER_CFG_B_* values passed in the ui32Config parameter.

The configuration is specified in ui32Config as one of the following values:

  • TIMER_CFG_ONE_SHOT - Full-width one-shot timer
  • TIMER_CFG_ONE_SHOT_UP - Full-width one-shot timer that counts up instead of down
  • TIMER_CFG_PERIODIC - Full-width periodic timer
  • TIMER_CFG_PERIODIC_UP - Full-width periodic timer that counts up instead of down
  • TIMER_CFG_RTC - Full-width real time clock timer
  • TIMER_CFG_SPLIT_PAIR - Two half-width timers

When configured for a pair of half-width timers, each timer is separately configured. The first timer is configured by setting ui32Config to the result of a logical OR operation between one of the following values and ui32Config:

  • TIMER_CFG_A_ONE_SHOT - Half-width one-shot timer
  • TIMER_CFG_A_ONE_SHOT_UP - Half-width one-shot timer that counts up instead of down
  • TIMER_CFG_A_PERIODIC - Half-width periodic timer
  • TIMER_CFG_A_PERIODIC_UP - Half-width periodic timer that counts up instead of down
  • TIMER_CFG_A_CAP_COUNT - Half-width edge count capture
  • TIMER_CFG_A_CAP_COUNT_UP - Half-width edge count capture that counts up instead of down
  • TIMER_CFG_A_CAP_TIME - Half-width edge time capture
  • TIMER_CFG_A_CAP_TIME_UP - Half-width edge time capture that counts up instead of down
  • TIMER_CFG_A_PWM - Half-width PWM output

One of the following can be combined with the TIMER_CFG_* values to enable an action on timer A:

  • TIMER_CFG_A_ACT_TOINTD - masks the timeout interrupt of timer A.
  • TIMER_CFG_A_ACT_NONE - no additional action on timeout of timer A.
  • TIMER_CFG_A_ACT_TOGGLE - toggle CCP on timeout of timer A.
  • TIMER_CFG_A_ACT_SETTO - set CCP on timeout of timer A.
  • TIMER_CFG_A_ACT_CLRTO - clear CCP on timeout of timer A.
  • TIMER_CFG_A_ACT_SETTOGTO - set CCP immediately and then toggle it on timeout of timer A.
  • TIMER_CFG_A_ACT_CLRTOGTO - clear CCP immediately and then toggle it on timeout of timer A.
  • TIMER_CFG_A_ACT_SETCLRTO - set CCP immediately and then clear it on timeout of timer A.
  • TIMER_CFG_A_ACT_CLRSETTO - clear CCP immediately and then set it on timeout of timer A.

One of the following can be combined with the TIMER_CFG_* values to enable an action on timer B:

  • TIMER_CFG_B_ACT_TOINTD - masks the timeout interrupt of timer B.
  • TIMER_CFG_B_ACT_NONE - no additional action on timeout of timer B.
  • TIMER_CFG_B_ACT_TOGGLE - toggle CCP on timeout of timer B.
  • TIMER_CFG_B_ACT_SETTO - set CCP on timeout of timer B.
  • TIMER_CFG_B_ACT_CLRTO - clear CCP on timeout of timer B.
  • TIMER_CFG_B_ACT_SETTOGTO - set CCP immediately and then toggle it on timeout of timer B.
  • TIMER_CFG_B_ACT_CLRTOGTO - clear CCP immediately and then toggle it on timeout of timer B.
  • TIMER_CFG_B_ACT_SETCLRTO - set CCP immediately and then clear it on timeout of timer B.
  • TIMER_CFG_B_ACT_CLRSETTO - clear CCP immediately and then set it on timeout of timer B.

Similarly, the second timer is configured by setting ui32Config to the result of a logical OR operation between one of the corresponding TIMER_CFG_B_* values and ui32Config.

Returns
None.

References ASSERT, HWREG, TIMER_CFG_A_CAP_COUNT, TIMER_CFG_A_CAP_COUNT_UP, TIMER_CFG_A_CAP_TIME, TIMER_CFG_A_CAP_TIME_UP, TIMER_CFG_A_ONE_SHOT, TIMER_CFG_A_ONE_SHOT_UP, TIMER_CFG_A_PERIODIC, TIMER_CFG_A_PERIODIC_UP, TIMER_CFG_A_PWM, TIMER_CFG_B_CAP_COUNT, TIMER_CFG_B_CAP_COUNT_UP, TIMER_CFG_B_CAP_TIME, TIMER_CFG_B_CAP_TIME_UP, TIMER_CFG_B_ONE_SHOT, TIMER_CFG_B_ONE_SHOT_UP, TIMER_CFG_B_PERIODIC, TIMER_CFG_B_PERIODIC_UP, TIMER_CFG_B_PWM, TIMER_CFG_ONE_SHOT, TIMER_CFG_ONE_SHOT_UP, TIMER_CFG_PERIODIC, TIMER_CFG_PERIODIC_UP, TIMER_CFG_RTC, TIMER_CFG_SPLIT_PAIR, TIMER_CTL_TAEN, TIMER_CTL_TBEN, TIMER_O_CFG, TIMER_O_CTL, TIMER_O_TAMR, TIMER_O_TBMR, TIMER_TAMR_TAPWMIE, and TIMER_TBMR_TBPWMIE.

§ TimerControlLevel()

void TimerControlLevel ( uint32_t  ui32Base,
uint32_t  ui32Timer,
bool  bInvert 
)

Controls the output level.

Parameters
ui32Baseis the base address of the timer module.
ui32Timerspecifies the timer(s) to adjust; must be one of TIMER_A, TIMER_B, or TIMER_BOTH.
bInvertspecifies the output level.

This function configures the PWM output level for the specified timer. If the bInvert parameter is true, then the timer's output is made active low; otherwise, it is made active high.

Returns
None.

References ASSERT, HWREG, TIMER_A, TIMER_B, TIMER_BOTH, TIMER_CTL_TAPWML, TIMER_CTL_TBPWML, and TIMER_O_CTL.

§ TimerControlTrigger()

void TimerControlTrigger ( uint32_t  ui32Base,
uint32_t  ui32Timer,
bool  bEnable 
)

Enables or disables the ADC trigger output.

Parameters
ui32Baseis the base address of the timer module.
ui32Timerspecifies the timer to adjust; must be one of TIMER_A, TIMER_B, or TIMER_BOTH.
bEnablespecifies the desired ADC trigger state.

This function controls the ADC trigger output for the specified timer. If the bEnable parameter is true, then the timer's ADC output trigger is enabled; otherwise it is disabled.

Returns
None.

References ASSERT, HWREG, TIMER_A, TIMER_ADCEV_TATOADCEN, TIMER_ADCEV_TBTOADCEN, TIMER_B, TIMER_BOTH, TIMER_CTL_TAOTE, TIMER_CTL_TBOTE, TIMER_O_ADCEV, and TIMER_O_CTL.

§ TimerControlEvent()

void TimerControlEvent ( uint32_t  ui32Base,
uint32_t  ui32Timer,
uint32_t  ui32Event 
)

Controls the event type.

Parameters
ui32Baseis the base address of the timer module.
ui32Timerspecifies the timer(s) to be adjusted; must be one of TIMER_A, TIMER_B, or TIMER_BOTH.
ui32Eventspecifies the type of event; must be one of TIMER_EVENT_POS_EDGE, TIMER_EVENT_NEG_EDGE, or TIMER_EVENT_BOTH_EDGES.

This function configures the signal edge(s) that triggers the timer when in capture mode.

Returns
None.

References ASSERT, HWREG, TIMER_A, TIMER_B, TIMER_BOTH, TIMER_CTL_TAEVENT_M, TIMER_CTL_TBEVENT_M, and TIMER_O_CTL.

§ TimerControlStall()

void TimerControlStall ( uint32_t  ui32Base,
uint32_t  ui32Timer,
bool  bStall 
)

Controls the stall handling.

Parameters
ui32Baseis the base address of the timer module.
ui32Timerspecifies the timer(s) to be adjusted; must be one of TIMER_A, TIMER_B, or TIMER_BOTH.
bStallspecifies the response to a stall signal.

This function controls the stall response for the specified timer. If the bStall parameter is true, then the timer stops counting if the processor enters debug mode; otherwise the timer keeps running while in debug mode.

Returns
None.

References ASSERT, HWREG, TIMER_A, TIMER_B, TIMER_BOTH, TIMER_CTL_TASTALL, TIMER_CTL_TBSTALL, and TIMER_O_CTL.

§ TimerControlWaitOnTrigger()

void TimerControlWaitOnTrigger ( uint32_t  ui32Base,
uint32_t  ui32Timer,
bool  bWait 
)

Controls the wait on trigger handling.

Parameters
ui32Baseis the base address of the timer module.
ui32Timerspecifies the timer(s) to be adjusted; must be one of TIMER_A, TIMER_B, or TIMER_BOTH.
bWaitspecifies if the timer should wait for a trigger input.

This function controls whether or not a timer waits for a trigger input to start counting. When enabled, the previous timer in the trigger chain must count to its timeout in order for this timer to start counting. Refer to the TRM/data sheet for a description of the trigger chain.

Note
This function should not be used for Timer 0A.
Returns
None.

References ASSERT, HWREG, TIMER_A, TIMER_B, TIMER_BOTH, TIMER_O_TAMR, TIMER_O_TBMR, TIMER_TAMR_TAWOT, and TIMER_TBMR_TBWOT.

§ TimerRTCEnable()

void TimerRTCEnable ( uint32_t  ui32Base)

Enables RTC counting.

Parameters
ui32Baseis the base address of the timer module.

This function causes the timer to start counting when in RTC mode. If not configured for RTC mode, this function does nothing.

Returns
None.

References ASSERT, HWREG, TIMER_CTL_RTCEN, and TIMER_O_CTL.

§ TimerRTCDisable()

void TimerRTCDisable ( uint32_t  ui32Base)

Disables RTC counting.

Parameters
ui32Baseis the base address of the timer module.

This function causes the timer to stop counting when in RTC mode.

Returns
None.

References ASSERT, HWREG, TIMER_CTL_RTCEN, and TIMER_O_CTL.

§ TimerClockSourceSet()

void TimerClockSourceSet ( uint32_t  ui32Base,
uint32_t  ui32Source 
)

Sets the clock source for the specified timer module.

Parameters
ui32Baseis the base address of the timer module.
ui32Sourceis the clock source for the timer module.

This function sets the clock source for both timer A and timer B for the given timer module. The possible clock sources are the system clock (TIMER_CLOCK_SYSTEM) or the precision internal oscillator (TIMER_CLOCK_PIOSC).

Returns
None.

References ASSERT, HWREG, TIMER_CLOCK_PIOSC, TIMER_CLOCK_SYSTEM, and TIMER_O_CC.

§ TimerClockSourceGet()

uint32_t TimerClockSourceGet ( uint32_t  ui32Base)

Returns the clock source for the specified timer module.

Parameters
ui32Baseis the base address of the timer module.

This function returns the clock source for the specified timer module. The possible clock sources are the system clock (TIMER_CLOCK_SYSTEM) or the precision internal oscillator (TIMER_CLOCK_PIOSC).

Returns
Returns either TIMER_CLOCK_SYSTEM or TIMER_CLOCK_PIOSC.

References ASSERT, HWREG, and TIMER_O_CC.

§ TimerPrescaleSet()

void TimerPrescaleSet ( uint32_t  ui32Base,
uint32_t  ui32Timer,
uint32_t  ui32Value 
)

Sets the timer prescale value.

Parameters
ui32Baseis the base address of the timer module.
ui32Timerspecifies the timer(s) to adjust; must be one of TIMER_A, TIMER_B, or TIMER_BOTH.
ui32Valueis the timer prescale value which must be between 0 and 255 (inclusive) for 16/32-bit timers.

This function configures the value of the input clock prescaler. The prescaler is only operational when in half-width mode and is used to extend the range of the half-width timer modes. The prescaler provides the least significant bits when counting down in periodic and one-shot modes; in all other modes, the prescaler provides the most significant bits.

Returns
None.

References ASSERT, HWREG, TIMER_A, TIMER_B, TIMER_BOTH, TIMER_O_TAPR, and TIMER_O_TBPR.

§ TimerPrescaleGet()

uint32_t TimerPrescaleGet ( uint32_t  ui32Base,
uint32_t  ui32Timer 
)

Gets the timer prescale value.

Parameters
ui32Baseis the base address of the timer module.
ui32Timerspecifies the timer; must be one of TIMER_A or TIMER_B.

This function gets the value of the input clock prescaler. The prescaler is only operational when in half-width mode and is used to extend the range of the half-width timer modes. The prescaler provides the least significant bits when counting down in periodic and one-shot modes; in all other modes, the prescaler provides the most significant bits.

Returns
The value of the timer prescaler.

References ASSERT, HWREG, TIMER_A, TIMER_B, TIMER_BOTH, TIMER_O_TAPR, and TIMER_O_TBPR.

§ TimerPrescaleMatchSet()

void TimerPrescaleMatchSet ( uint32_t  ui32Base,
uint32_t  ui32Timer,
uint32_t  ui32Value 
)

Sets the timer prescale match value.

Parameters
ui32Baseis the base address of the timer module.
ui32Timerspecifies the timer(s) to adjust; must be one of TIMER_A, TIMER_B, or TIMER_BOTH.
ui32Valueis the timer prescale match value which must be between 0 and 255 (inclusive) for 16/32-bit timers.

This function configures the value of the input clock prescaler match value. When in a half-width mode that uses the counter match and the prescaler, the prescale match effectively extends the range of the match. The prescaler provides the least significant bits when counting down in periodic and one-shot modes; in all other modes, the prescaler provides the most significant bits.

Returns
None.

References ASSERT, HWREG, TIMER_A, TIMER_B, TIMER_BOTH, TIMER_O_TAPMR, and TIMER_O_TBPMR.

§ TimerPrescaleMatchGet()

uint32_t TimerPrescaleMatchGet ( uint32_t  ui32Base,
uint32_t  ui32Timer 
)

Gets the timer prescale match value.

Parameters
ui32Baseis the base address of the timer module.
ui32Timerspecifies the timer; must be one of TIMER_A or TIMER_B.

This function gets the value of the input clock prescaler match value. When in a half-width mode that uses the counter match and prescaler, the prescale match effectively extends the range of the match. The prescaler provides the least significant bits when counting down in periodic and one-shot modes; in all other modes, the prescaler provides the most significant bits.

Returns
The value of the timer prescale match.

References ASSERT, HWREG, TIMER_A, TIMER_B, TIMER_BOTH, TIMER_O_TAPMR, and TIMER_O_TBPMR.

§ TimerLoadSet()

void TimerLoadSet ( uint32_t  ui32Base,
uint32_t  ui32Timer,
uint32_t  ui32Value 
)

Sets the timer load value.

Parameters
ui32Baseis the base address of the timer module.
ui32Timerspecifies the timer(s) to adjust; must be one of TIMER_A, TIMER_B, or TIMER_BOTH. Only TIMER_A should be used when the timer is configured for full-width operation.
ui32Valueis the load value.

This function configures the timer load value; if the timer is running then the value is immediately loaded into the timer.

Note
This function can be used for both full- and half-width modes of 16/32-bit timers.
Returns
None.

References ASSERT, HWREG, TIMER_A, TIMER_B, TIMER_BOTH, TIMER_O_TAILR, and TIMER_O_TBILR.

§ TimerLoadGet()

uint32_t TimerLoadGet ( uint32_t  ui32Base,
uint32_t  ui32Timer 
)

Gets the timer load value.

Parameters
ui32Baseis the base address of the timer module.
ui32Timerspecifies the timer; must be one of TIMER_A or TIMER_B. Only TIMER_A should be used when the timer is configured for full-width operation.

This function gets the currently programmed interval load value for the specified timer.

Note
This function can be used for both full- and half-width modes of 16/32-bit timers.
Returns
Returns the load value for the timer.

References ASSERT, HWREG, TIMER_A, TIMER_B, TIMER_O_TAILR, and TIMER_O_TBILR.

§ TimerValueGet()

uint32_t TimerValueGet ( uint32_t  ui32Base,
uint32_t  ui32Timer 
)

Gets the current timer value.

Parameters
ui32Baseis the base address of the timer module.
ui32Timerspecifies the timer; must be one of TIMER_A or TIMER_B. Only TIMER_A should be used when the timer is configured for full-width operation.

This function reads the current value of the specified timer.

Note
This function can be used for both full- and half-width modes of 16/32-bit timers.
Returns
Returns the current value of the timer.

References ASSERT, HWREG, TIMER_A, TIMER_B, TIMER_O_TAR, and TIMER_O_TBR.

§ TimerMatchSet()

void TimerMatchSet ( uint32_t  ui32Base,
uint32_t  ui32Timer,
uint32_t  ui32Value 
)

Sets the timer match value.

Parameters
ui32Baseis the base address of the timer module.
ui32Timerspecifies the timer(s) to adjust; must be one of TIMER_A, TIMER_B, or TIMER_BOTH. Only TIMER_A should be used when the timer is configured for full-width operation.
ui32Valueis the match value.

This function configures the match value for a timer. This value is used in capture count mode to determine when to interrupt the processor and in PWM mode to determine the duty cycle of the output signal. Match interrupts can also be generated in periodic and one-shot modes.

Note
This function can be used for both full- and half-width modes of 16/32-bit timers.
Returns
None.

References ASSERT, HWREG, TIMER_A, TIMER_B, TIMER_BOTH, TIMER_O_TAMATCHR, and TIMER_O_TBMATCHR.

§ TimerMatchGet()

uint32_t TimerMatchGet ( uint32_t  ui32Base,
uint32_t  ui32Timer 
)

Gets the timer match value.

Parameters
ui32Baseis the base address of the timer module.
ui32Timerspecifies the timer; must be one of TIMER_A or TIMER_B. Only TIMER_A should be used when the timer is configured for full-width operation.

This function gets the match value for the specified timer.

Note
This function can be used for both full- and half-width modes of 16/32-bit timers.
Returns
Returns the match value for the timer.

References ASSERT, HWREG, TIMER_A, TIMER_B, TIMER_O_TAMATCHR, and TIMER_O_TBMATCHR.

§ TimerIntRegister()

void TimerIntRegister ( uint32_t  ui32Base,
uint32_t  ui32Timer,
void(*)(void)  pfnHandler 
)

Registers an interrupt handler for the timer interrupt.

Parameters
ui32Baseis the base address of the timer module.
ui32Timerspecifies the timer(s); must be one of TIMER_A, TIMER_B, or TIMER_BOTH.
pfnHandleris a pointer to the function to be called when the timer interrupt occurs.

This function registers the handler to be called when a timer interrupt occurs. In addition, this function enables the global interrupt in the interrupt controller; specific timer interrupts must be enabled via TimerIntEnable(). It is the interrupt handler's responsibility to clear the interrupt source via TimerIntClear().

See also
IntRegister() for important information about registering interrupt handlers.
Returns
None.

References ASSERT, TIMER_A, TIMER_B, and TIMER_BOTH.

§ TimerIntUnregister()

void TimerIntUnregister ( uint32_t  ui32Base,
uint32_t  ui32Timer 
)

Unregisters an interrupt handler for the timer interrupt.

Parameters
ui32Baseis the base address of the timer module.
ui32Timerspecifies the timer(s); must be one of TIMER_A, TIMER_B, or TIMER_BOTH.

This function unregisters the handler to be called when a timer interrupt occurs. This function also masks off the interrupt in the interrupt controller so that the interrupt handler is no longer called.

See also
IntRegister() for important information about registering interrupt handlers.
Returns
None.

References ASSERT, TIMER_A, TIMER_B, and TIMER_BOTH.

§ TimerIntEnable()

void TimerIntEnable ( uint32_t  ui32Base,
uint32_t  ui32IntFlags 
)

Enables individual timer interrupt sources.

Parameters
ui32Baseis the base address of the timer module.
ui32IntFlagsis the bit mask of the interrupt sources to be enabled.

This function enables the indicated timer interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor.

The ui32IntFlags parameter must be the logical OR of any combination of the following:

  • TIMER_TIMB_DMA - Timer B uDMA complete
  • TIMER_TIMA_DMA - Timer A uDMA complete
  • TIMER_CAPB_EVENT - Capture B event interrupt
  • TIMER_CAPB_MATCH - Capture B match interrupt
  • TIMER_TIMB_TIMEOUT - Timer B timeout interrupt
  • TIMER_RTC_MATCH - RTC interrupt mask
  • TIMER_CAPA_EVENT - Capture A event interrupt
  • TIMER_CAPA_MATCH - Capture A match interrupt
  • TIMER_TIMA_TIMEOUT - Timer A timeout interrupt
Returns
None.

References ASSERT, HWREG, and TIMER_O_IMR.

§ TimerIntDisable()

void TimerIntDisable ( uint32_t  ui32Base,
uint32_t  ui32IntFlags 
)

Disables individual timer interrupt sources.

Parameters
ui32Baseis the base address of the timer module.
ui32IntFlagsis the bit mask of the interrupt sources to be disabled.

This function disables the indicated timer interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor.

The ui32IntFlags parameter has the same definition as the ui32IntFlags parameter to TimerIntEnable().

Returns
None.

References ASSERT, HWREG, and TIMER_O_IMR.

§ TimerIntStatus()

uint32_t TimerIntStatus ( uint32_t  ui32Base,
bool  bMasked 
)

Gets the current interrupt status.

Parameters
ui32Baseis the base address of the timer module.
bMaskedis false if the raw interrupt status is required and true if the masked interrupt status is required.

This function returns the interrupt status for the timer module. Either the raw interrupt status or the status of interrupts that are allowed to reflect to the processor can be returned.

Returns
The current interrupt status, enumerated as a bit field of values described in TimerIntEnable().

References ASSERT, HWREG, TIMER_O_MIS, and TIMER_O_RIS.

§ TimerIntClear()

void TimerIntClear ( uint32_t  ui32Base,
uint32_t  ui32IntFlags 
)

Clears timer interrupt sources.

Parameters
ui32Baseis the base address of the timer module.
ui32IntFlagsis a bit mask of the interrupt sources to be cleared.

The specified timer interrupt sources are cleared, so that they no longer assert. This function must be called in the interrupt handler to keep the interrupt from being triggered again immediately upon exit.

The ui32IntFlags parameter has the same definition as the ui32IntFlags parameter to TimerIntEnable().

Note
Because there is a write buffer in the Cortex-M processor, it may take several clock cycles before the interrupt source is actually cleared. Therefore, it is recommended that the interrupt source be cleared early in the interrupt handler (as opposed to the very last action) to avoid returning from the interrupt handler before the interrupt source is actually cleared. Failure to do so may result in the interrupt handler being immediately reentered (because the interrupt controller still sees the interrupt source asserted).
Returns
None.

References ASSERT, HWREG, and TIMER_O_ICR.

§ TimerSynchronize()

void TimerSynchronize ( uint32_t  ui32Base,
uint32_t  ui32Timers 
)

Synchronizes the counters in a set of timers.

Parameters
ui32Baseis the base address of the timer module. This parameter must be the base address of Timer0 (in other words, TIMER0_BASE).
ui32Timersis the set of timers to synchronize.

This function synchronizes the counters in a specified set of timers. When a timer is running in half-width mode, each half can be included or excluded in the synchronization event. When a timer is running in full-width mode, only the A timer can be synchronized (specifying the B timer has no effect).

The ui32Timers parameter is the logical OR of any of the following defines:

  • TIMER_0A_SYNC
  • TIMER_0B_SYNC
  • TIMER_1A_SYNC
  • TIMER_1B_SYNC
  • TIMER_2A_SYNC
  • TIMER_2B_SYNC
  • TIMER_3A_SYNC
  • TIMER_3B_SYNC
  • TIMER_4A_SYNC
  • TIMER_4B_SYNC
  • TIMER_5A_SYNC
  • TIMER_5B_SYNC
  • TIMER_6A_SYNC
  • TIMER_6B_SYNC
  • TIMER_7A_SYNC
  • TIMER_7B_SYNC
Returns
None.

References ASSERT, HWREG, and TIMER_O_SYNC.

§ TimerADCEventSet()

void TimerADCEventSet ( uint32_t  ui32Base,
uint32_t  ui32ADCEvent 
)

Enables the events that can cause an ADC trigger event.

Parameters
ui32Baseis the base address of the timer module.
ui32ADCEventis a bit mask of the events that can cause an ADC trigger event.

This function enables the timer events that can cause an ADC trigger event. The ADC trigger events are specified in the ui32ADCEvent parameter by passing in the logical OR of any of the following values:

  • TIMER_ADC_MODEMATCH_B - Enables the mode match ADC trigger for timer B.
  • TIMER_ADC_CAPEVENT_B - Enables the capture event ADC trigger for timer B.
  • TIMER_ADC_CAPMATCH_B - Enables the capture match ADC trigger for timer B.
  • TIMER_ADC_TIMEOUT_B - Enables the timeout ADC trigger for timer B.
  • TIMER_ADC_MODEMATCH_A - Enables the mode match ADC trigger for timer A.
  • TIMER_ADC_RTC_A - Enables the RTC ADC trigger for timer A.
  • TIMER_ADC_CAPEVENT_A - Enables the capture event ADC trigger for timer A.
  • TIMER_ADC_CAPMATCH_A - Enables the capture match ADC trigger for timer A.
  • TIMER_ADC_TIMEOUT_A - Enables the timeout ADC trigger for timer A.
Returns
None.

References ASSERT, HWREG, and TIMER_O_ADCEV.

§ TimerADCEventGet()

uint32_t TimerADCEventGet ( uint32_t  ui32Base)

Returns the events that can cause an ADC trigger event.

Parameters
ui32Baseis the base address of the timer module.

This function returns the timer events that can cause an ADC trigger event. The ADC trigger events are the logical OR of any of the following values:

  • TIMER_ADC_MODEMATCH_B - The mode match ADC trigger for timer B is enabled.
  • TIMER_ADC_CAPEVENT_B - The capture event ADC trigger for timer B is enabled.
  • TIMER_ADC_CAPMATCH_B - The capture match ADC trigger for timer B is enabled.
  • TIMER_ADC_TIMEOUT_B - The timeout ADC trigger for timer B is enabled.
  • TIMER_ADC_MODEMATCH_A - The mode match ADC trigger for timer A is enabled.
  • TIMER_ADC_RTC_A - The RTC ADC trigger for timer A is enabled.
  • TIMER_ADC_CAPEVENT_A - The capture event ADC trigger for timer A is enabled.
  • TIMER_ADC_CAPMATCH_A - The capture match ADC trigger for timer A is enabled.
  • TIMER_ADC_TIMEOUT_A - The timeout ADC trigger for timer A is enabled.
Returns
The timer events that trigger the ADC.

References ASSERT, HWREG, and TIMER_O_ADCEV.

§ TimerDMAEventSet()

void TimerDMAEventSet ( uint32_t  ui32Base,
uint32_t  ui32DMAEvent 
)

Enables the events that can trigger a uDMA request.

Parameters
ui32Baseis the base address of the timer module.
ui32DMAEventis a bit mask of the events that can trigger uDMA.

This function enables the timer events that can trigger the start of a uDMA sequence. The uDMA trigger events are specified in the ui32DMAEvent parameter by passing in the logical OR of the following values:

  • TIMER_DMA_MODEMATCH_B - The mode match uDMA trigger for timer B is enabled.
  • TIMER_DMA_CAPEVENT_B - The capture event uDMA trigger for timer B is enabled.
  • TIMER_DMA_CAPMATCH_B - The capture match uDMA trigger for timer B is enabled.
  • TIMER_DMA_TIMEOUT_B - The timeout uDMA trigger for timer B is enabled.
  • TIMER_DMA_MODEMATCH_A - The mode match uDMA trigger for timer A is enabled.
  • TIMER_DMA_RTC_A - The RTC uDMA trigger for timer A is enabled.
  • TIMER_DMA_CAPEVENT_A - The capture event uDMA trigger for timer A is enabled.
  • TIMER_DMA_CAPMATCH_A - The capture match uDMA trigger for timer A is enabled.
  • TIMER_DMA_TIMEOUT_A - The timeout uDMA trigger for timer A is enabled.
Returns
None.

References ASSERT, HWREG, and TIMER_O_DMAEV.

§ TimerDMAEventGet()

uint32_t TimerDMAEventGet ( uint32_t  ui32Base)

Returns the events that can trigger a uDMA request.

Parameters
ui32Baseis the base address of the timer module.

This function returns the timer events that can trigger the start of a uDMA sequence. The uDMA trigger events are the logical OR of the following values:

  • TIMER_DMA_MODEMATCH_B - Enables the mode match uDMA trigger for timer B.
  • TIMER_DMA_CAPEVENT_B - Enables the capture event uDMA trigger for timer B.
  • TIMER_DMA_CAPMATCH_B - Enables the capture match uDMA trigger for timer B.
  • TIMER_DMA_TIMEOUT_B - Enables the timeout uDMA trigger for timer B.
  • TIMER_DMA_MODEMATCH_A - Enables the mode match uDMA trigger for timer A.
  • TIMER_DMA_RTC_A - Enables the RTC uDMA trigger for timer A.
  • TIMER_DMA_CAPEVENT_A - Enables the capture event uDMA trigger for timer A.
  • TIMER_DMA_CAPMATCH_A - Enables the capture match uDMA trigger for timer A.
  • TIMER_DMA_TIMEOUT_A - Enables the timeout uDMA trigger for timer A.
Returns
The timer events that trigger the uDMA.

References ASSERT, HWREG, and TIMER_O_DMAEV.

§ TimerUpdateMode()

void TimerUpdateMode ( uint32_t  ui32Base,
uint32_t  ui32Timer,
uint32_t  ui32Config 
)

This function configures the update of timer load and match settings.

Parameters
ui32Baseis the base address of the timer module.
ui32Timerspecifies the timer(s); must be one of TIMER_A, TIMER_B, or TIMER_BOTH.
ui32Configis a combination of the updates methods for the timers specified in the ui32Timer parameter.

This function configures how the timer updates the timer load and match values for the timers. The ui32Timer values can be TIMER_A, TIMER_B, or TIMER_BOTH to apply the settings in ui32Config to either timer or both timers. If the timer is not split then the TIMER_A should be used. The ui32Config values affects when the TimerLoadSet() values take effect.

  • TIMER_UP_LOAD_IMMEDIATE is the default mode that causes the TimerLoadSet() to update the timer counter immediately.
  • TIMER_UP_LOAD_TIMEOUT causes the TimerLoadSet() to update the timer when it counts down to zero.

Similarly the ui32Config value affects when the TimerMatchSet() values take effect.

  • TIMER_UP_MATCH_IMMEDIATE is the default mode that causes the TimerMatchSet() to update the timer match value immediately.
  • TIMER_UP_MATCH_TIMEOUT causes the TimerMatchSet() to update the timer match value when it counts down to zero.
Note
These settings have no effect if the timer is not in count down mode and are mostly useful when operating in PWM mode to allow for synchronous update of timer match and load values.
Returns
None.

References HWREG, TIMER_A, TIMER_B, TIMER_O_TAMR, and TIMER_O_TBMR.

Copyright 2017, Texas Instruments Incorporated