libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
Cortex-M SysTick Defines

libopencm3 Defined Constants and Types for the Cortex SysTick More...

Collaboration diagram for Cortex-M SysTick Defines:

Modules

 STK_CSR Values
 
 STK_RVR Values
 
 STK_CALIB Values
 

Macros

#define STK_CSR   MMIO32(SYS_TICK_BASE + 0x00)
 SysTick Control and Status Register (CSR). More...
 
#define STK_RVR   MMIO32(SYS_TICK_BASE + 0x04)
 SysTick Reload Value Register (RVR). More...
 
#define STK_CVR   MMIO32(SYS_TICK_BASE + 0x08)
 SysTick Current Value Register (CVR). More...
 
#define STK_CALIB   MMIO32(SYS_TICK_BASE + 0x0C)
 SysTick Calibration Value Register(Read Only) (CALIB) Reads the calibration value and parameters for SysTick. More...
 

Functions

void systick_set_reload (uint32_t value)
 
bool systick_set_frequency (uint32_t freq, uint32_t ahb)
 
uint32_t systick_get_reload (void)
 
uint32_t systick_get_value (void)
 
void systick_set_clocksource (uint8_t clocksource)
 
void systick_interrupt_enable (void)
 
void systick_interrupt_disable (void)
 
void systick_counter_enable (void)
 
void systick_counter_disable (void)
 
uint8_t systick_get_countflag (void)
 
void systick_clear (void)
 
uint32_t systick_get_calib (void)
 

Detailed Description

libopencm3 Defined Constants and Types for the Cortex SysTick

Version
1.0.0
Author
© 2010 Thomas Otto tommi.nosp@m.@via.nosp@m.dmin..nosp@m.org
Date
19 August 2012

System Control Space (SCS) => System timer register support in the SCS. To configure SysTick, load the interval required between SysTick events to the SysTick Reload Value register. The timer interrupt, or COUNTFLAG bit in the SysTick Control and Status register, is activated on the transition from 1 to 0, therefore it activates every n+1 clock ticks. If you require a period of 100, write 99 to the SysTick Reload Value register. The SysTick Reload Value register supports values between 0x1 and 0x00FFFFFF.

If you want to use SysTick to generate an event at a timed interval, for example 1ms, you can use the SysTick Calibration Value Register to scale your value for the Reload register. The SysTick Calibration Value Register is a read-only register that contains the number of pulses for a period of 10ms, in the TENMS field, bits[23:0].

This register also has a SKEW bit. Bit[30] == 1 indicates that the calibration for 10ms in the TENMS section is not exactly 10ms due to clock frequency. Bit[31] == 1 indicates that the reference clock is not provided.

LGPL License Terms libopencm3 License

Macro Definition Documentation

◆ STK_CALIB

#define STK_CALIB   MMIO32(SYS_TICK_BASE + 0x0C)

SysTick Calibration Value Register(Read Only) (CALIB) Reads the calibration value and parameters for SysTick.

Usage constraints: There are no usage constraints. Configurations Always implemented.

Definition at line 90 of file systick.h.

◆ STK_CSR

#define STK_CSR   MMIO32(SYS_TICK_BASE + 0x00)

SysTick Control and Status Register (CSR).

Controls the system timer and provides status data. Usage constraints: There are no usage constraints. Configurations Always implemented.

Definition at line 66 of file systick.h.

◆ STK_CVR

#define STK_CVR   MMIO32(SYS_TICK_BASE + 0x08)

SysTick Current Value Register (CVR).

Holds the current value of the counter. Usage constraints: There are no usage constraints. Configurations Always implemented.

Definition at line 83 of file systick.h.

◆ STK_RVR

#define STK_RVR   MMIO32(SYS_TICK_BASE + 0x04)

SysTick Reload Value Register (RVR).

Reads or clears the value that will be loaded to the counter. Usage constraints:

  • Any write to the register clears the register to zero.
  • The counter does not provide read-modify-write protection.
  • Unsupported bits are read as zero Configurations Always implemented.

Definition at line 76 of file systick.h.

Function Documentation

◆ systick_clear()

void systick_clear ( void  )

◆ systick_counter_disable()

void systick_counter_disable ( void  )

◆ systick_counter_enable()

void systick_counter_enable ( void  )

◆ systick_get_calib()

uint32_t systick_get_calib ( void  )

◆ systick_get_countflag()

uint8_t systick_get_countflag ( void  )

◆ systick_get_reload()

uint32_t systick_get_reload ( void  )

◆ systick_get_value()

uint32_t systick_get_value ( void  )

◆ systick_interrupt_disable()

void systick_interrupt_disable ( void  )

◆ systick_interrupt_enable()

void systick_interrupt_enable ( void  )

◆ systick_set_clocksource()

void systick_set_clocksource ( uint8_t  clocksource)

◆ systick_set_frequency()

bool systick_set_frequency ( uint32_t  freq,
uint32_t  ahb 
)

◆ systick_set_reload()

void systick_set_reload ( uint32_t  value)