CC23x0R5DriverLibrary
[systick.h] System Tick
Collaboration diagram for [systick.h] System Tick:

Functions

__STATIC_INLINE void SysTickEnable (void)
 Enables the SysTick counter. More...
 
__STATIC_INLINE void SysTickDisable (void)
 Disables the SysTick counter. More...
 
__STATIC_INLINE void SysTickRegisterInt (void(*pfnHandler)(void))
 Registers an interrupt handler for the SysTick interrupt in the dynamic interrupt table. More...
 
__STATIC_INLINE void SysTickUnregisterInt (void)
 Unregisters the interrupt handler for the SysTick interrupt in the dynamic interrupt table. More...
 
__STATIC_INLINE void SysTickEnableInt (void)
 Enables the SysTick interrupt. More...
 
__STATIC_INLINE void SysTickDisableInt (void)
 Disables the SysTick interrupt. More...
 
__STATIC_INLINE void SysTickSetPeriod (uint32_t period)
 Sets the period of the SysTick counter. More...
 
__STATIC_INLINE uint32_t SysTickGetPeriod (void)
 Gets the period of the SysTick counter. More...
 
__STATIC_INLINE uint32_t SysTickGetValue (void)
 Gets the current value of the SysTick counter. More...
 

Detailed Description

Introduction

The system CPU includes a system timer, SysTick, integrated in the NVIC which provides a simple, 24-bit, clear-on-write, decrementing, wrap-on-zero counter with a flexible control mechanism. When enabled, the timer counts down on each clock from the reload value to 0, reloads (wraps) on the next clock edge, then decrements on subsequent clocks.

The SysTick counter runs on the system clock. If this clock signal is stopped for low-power mode, the SysTick counter stops.

When the processor is halted for debugging, the counter does not decrement.

API

The API functions can be grouped like this:

Configuration and status:

Enable and disable:

Interrupt configuration:

Function Documentation

§ SysTickEnable()

__STATIC_INLINE void SysTickEnable ( void  )

Enables the SysTick counter.

This will start the SysTick counter. If an interrupt handler has been registered, it will be called when the SysTick counter rolls over.

Note
Calling this function will cause the SysTick counter to (re)commence counting from its current value. The counter is not automatically reloaded with the period as specified in a previous call to SysTickSetPeriod(). If an immediate reload is required, the SYSTICK_O_CVR register must be written to force this. Any write to this register clears the SysTick counter to 0 and will cause a reload with the supplied period on the next clock.
Returns
None

References HWREG, SYSTICK_BASE, SYSTICK_CSR_CLKSOURCE, SYSTICK_CSR_ENABLE, and SYSTICK_O_CSR.

§ SysTickDisable()

__STATIC_INLINE void SysTickDisable ( void  )

Disables the SysTick counter.

This will stop the SysTick counter. If an interrupt handler has been registered, it will no longer be called until SysTick is restarted.

Returns
None

References HWREG, SYSTICK_BASE, SYSTICK_CSR_ENABLE, and SYSTICK_O_CSR.

§ SysTickRegisterInt()

__STATIC_INLINE void SysTickRegisterInt ( void(*)(void)  pfnHandler)

Registers an interrupt handler for the SysTick interrupt in the dynamic interrupt table.

Note
Only use this function if you want to use the dynamic vector table (in SRAM)!

This function registers a function as the interrupt handler for a specific interrupt and enables the corresponding interrupt in the interrupt controller.

Parameters
pfnHandleris a pointer to the function to be called when the SysTick interrupt occurs.
Returns
None
See also
IntRegister() for important information about registering interrupt handlers.

References HWREG, INT_SYSTICK, IntRegister(), SYSTICK_BASE, SYSTICK_CSR_TICKINT, and SYSTICK_O_CSR.

§ SysTickUnregisterInt()

__STATIC_INLINE void SysTickUnregisterInt ( void  )

Unregisters the interrupt handler for the SysTick interrupt in the dynamic interrupt table.

This function will clear the handler to be called when a SysTick interrupt occurs.

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

References HWREG, INT_SYSTICK, IntUnregister(), SYSTICK_BASE, SYSTICK_CSR_TICKINT, and SYSTICK_O_CSR.

§ SysTickEnableInt()

__STATIC_INLINE void SysTickEnableInt ( void  )

Enables the SysTick interrupt.

This function will enable the SysTick interrupt, allowing it to be reflected to the processor.

Note
The SysTick interrupt handler does not need to clear the SysTick interrupt source as this is done automatically when the interrupt handler is called.
Returns
None

References HWREG, SYSTICK_BASE, SYSTICK_CSR_TICKINT, and SYSTICK_O_CSR.

§ SysTickDisableInt()

__STATIC_INLINE void SysTickDisableInt ( void  )

Disables the SysTick interrupt.

This function will disable the SysTick interrupt, preventing it from being reflected to the processor.

Returns
None

References HWREG, SYSTICK_BASE, SYSTICK_CSR_TICKINT, and SYSTICK_O_CSR.

§ SysTickSetPeriod()

__STATIC_INLINE void SysTickSetPeriod ( uint32_t  period)

Sets the period of the SysTick counter.

This function sets the rate at which the SysTick counter wraps; this equals to the number of processor clocks between interrupts.

Note
Calling this function does not cause the SysTick counter to reload immediately. If an immediate reload is required, the SYSTICK_O_CVR register must be written. Any write to this register clears the SysTick counter to 0 and will cause a reload with the period supplied here on the next clock after the SysTick is enabled.
Parameters
periodis the number of clock ticks in each period of the SysTick counter; must be between 1 and 16,777,216 (0x1000000), both included.
Returns
None

References ASSERT, HWREG, SYSTICK_BASE, and SYSTICK_O_RVR.

§ SysTickGetPeriod()

__STATIC_INLINE uint32_t SysTickGetPeriod ( void  )

Gets the period of the SysTick counter.

This function returns the rate at which the SysTick counter wraps; this equals to the number of processor clocks between interrupts.

Returns
Returns the period of the SysTick counter.

References HWREG, SYSTICK_BASE, and SYSTICK_O_RVR.

§ SysTickGetValue()

__STATIC_INLINE uint32_t SysTickGetValue ( void  )

Gets the current value of the SysTick counter.

This function returns the current value of the SysTick counter; this will be a value between the (period - 1) and zero, both included.

Returns
Returns the current value of the SysTick counter

References HWREG, SYSTICK_BASE, and SYSTICK_O_CVR.