ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_systick.h
Go to the documentation of this file.
1
42
43#pragma once
44
45#ifdef __cplusplus
46extern "C" {
47#endif
48
49#include <stdint.h>
50
51#include "ra8_err.h"
52
61typedef enum : uint32_t {
62 k_ra8_systick_rvr_max = 0x00FFFFFFUL,
64
77
119[[nodiscard]] ra8_err_t
120ra8_systick_reload_for(uint32_t cpu_hz, uint32_t tick_hz, uint32_t* out_reload);
121
156[[nodiscard]] ra8_err_t
157ra8_systick_configure(uint32_t reload, ra8_systick_clock_source_t src, bool tick_irq);
158
186[[nodiscard]] ra8_err_t ra8_systick_set_reload(uint32_t reload);
187
207[[nodiscard]] uint32_t ra8_systick_current_value(void);
208
231void ra8_dwt_cyccnt_enable(void);
232
252void ra8_dwt_cyccnt_reset(void);
253
276[[nodiscard]] uint32_t ra8_dwt_cyccnt_read(void);
277
278#ifdef __cplusplus
279}
280#endif
Error Code Definitions for ra8-firmware.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Definition ra8_err.h:546
ra8_err_t ra8_systick_reload_for(uint32_t cpu_hz, uint32_t tick_hz, uint32_t *out_reload)
Compute the SysTick reload for a given core clock and tick rate.
Definition ra8_systick.c:92
ra8_systick_limit_t
Architectural range limit of the Cortex-M SysTick reload register.
Definition ra8_systick.h:61
@ k_ra8_systick_rvr_max
Max SYST_RVR reload (24-bit).
Definition ra8_systick.h:62
uint32_t ra8_systick_current_value(void)
Read the live SysTick current-value register (SYST_CVR).
ra8_err_t ra8_systick_set_reload(uint32_t reload)
Re-arm SysTick with a new reload, leaving the control bits untouched.
void ra8_dwt_cyccnt_reset(void)
Zero the DWT cycle counter (DWT_CYCCNT).
ra8_systick_clock_source_t
Selects the SysTick counter clock (SYST_CSR.CLKSOURCE).
Definition ra8_systick.h:73
@ k_ra8_systick_clk_external
CLKSOURCE = 0: external reference clock.
Definition ra8_systick.h:74
@ k_ra8_systick_clk_cpu
CLKSOURCE = 1: processor (CPU) clock.
Definition ra8_systick.h:75
ra8_err_t ra8_systick_configure(uint32_t reload, ra8_systick_clock_source_t src, bool tick_irq)
Arm and start SysTick with a reload value and clock source.
uint32_t ra8_dwt_cyccnt_read(void)
Sample the DWT cycle counter (DWT_CYCCNT).
void ra8_dwt_cyccnt_enable(void)
Enable the DWT free-running cycle counter (DWT_CYCCNT).