STM32 RTOS 0.2.3
Bare-metal preemptive RTOS for STM32F446RE
Loading...
Searching...
No Matches
SysTick

The system tick timer. More...

Collaboration diagram for SysTick:

Functions

DRIVER_MUST_CHECK DriverStatus_e systickInit (SysTickRegisters_t *systick, uint32_t core_hz, uint32_t tick_hz)
 Start SysTick at tick_hz from the processor clock, with its interrupt on.
void systickDeinit (SysTickRegisters_t *systick)
 Stop SysTick and zero CTRL, LOAD and VAL.

Detailed Description

The system tick timer.

Function Documentation

◆ systickInit()

DriverStatus_e systickInit ( SysTickRegisters_t * systick,
uint32_t core_hz,
uint32_t tick_hz )

Start SysTick at tick_hz from the processor clock, with its interrupt on.

Stops the timer, sets LOAD to core_hz / tick_hz - 1, clears VAL, then sets CLKSOURCE, TICKINT and ENABLE together. The division truncates, so the period is exact only when tick_hz divides core_hz, as 1 kHz does at 16 and 180 MHz.

Parameters
systickSysTick block (e.g. SYSTICK).
core_hzProcessor clock (HCLK), in Hz.
tick_hzTick rate, in Hz.
Precondition
The SysTick priority is set (nvicSetSystemHandlerPriority()).
Return values
DRIVER_STATUS_OKRunning.
DRIVER_STATUS_ERR_INVALID_PARAMA frequency is 0, or the period is under 2 or over 2^24 clocks. Nothing is written.
Warning
The first tick can arrive as soon as this returns. Until the kernel defines SysTick_Handler, it lands in Default_Handler and hangs.

Definition at line 12 of file systick.c.

References SysTickRegisters_t::CTRL, DRIVER_STATUS_ERR_INVALID_PARAM, DRIVER_STATUS_OK, SysTickRegisters_t::LOAD, SYSTICK_CTRL_CLKSOURCE, SYSTICK_CTRL_ENABLE, SYSTICK_CTRL_TICKINT, SYSTICK_LOAD_RELOAD_Msk, systickInit(), and SysTickRegisters_t::VAL.

Referenced by systickInit().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ systickDeinit()

void systickDeinit ( SysTickRegisters_t * systick)

Stop SysTick and zero CTRL, LOAD and VAL.

Leaves its priority and any pending SysTick exception alone.

Parameters
systickSysTick block (e.g. SYSTICK).

Definition at line 52 of file systick.c.

References SysTickRegisters_t::CTRL, SysTickRegisters_t::LOAD, systickDeinit(), and SysTickRegisters_t::VAL.

Referenced by systickDeinit().

Here is the call graph for this function:
Here is the caller graph for this function: