|
STM32 RTOS 0.2.3
Bare-metal preemptive RTOS for STM32F446RE
|
The system tick timer. More...
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. | |
The system tick timer.
| 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.
| systick | SysTick block (e.g. SYSTICK). |
| core_hz | Processor clock (HCLK), in Hz. |
| tick_hz | Tick rate, in Hz. |
| DRIVER_STATUS_OK | Running. |
| DRIVER_STATUS_ERR_INVALID_PARAM | A frequency is 0, or the period is under 2 or over 2^24 clocks. Nothing is written. |
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().
| void systickDeinit | ( | SysTickRegisters_t * | systick | ) |
Stop SysTick and zero CTRL, LOAD and VAL.
Leaves its priority and any pending SysTick exception alone.
| systick | SysTick 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().