RV32 SoC DS UG
High-Perf RV32 SoC DS UG
RV64 SoC DS UG API and Examples
Embedded IDE UG
Loading...
Searching...
No Matches
timer.h
Go to the documentation of this file.
1
2// Copyright (C) 2013-2026 Efinix Inc. All rights reserved.
3// Full license header bsp/efinix/EfxSapphireSocRV64/include/LICENSE.MD
5
6#ifndef TIMER_H
7#define TIMER_H
8
19
20#include "type.h"
21#include "io.h"
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
80
81/* ========================================================================== */
82/* SUB-GROUP : REGISTER DEFINITIONS */
83/* ========================================================================== */
90 #define TIMER_CONFIG_WITH_PRESCALER 0x2
91 #define TIMER_CONFIG_WITHOUT_PRESCALER 0x1
92 #define TIMER_CONFIG_SELF_RESTART 0x10000 // End of TIMER_Macros group
94
95/* ========================================================================== */
96/* SUB-GROUP : DATA STRUCTS */
97/* ========================================================================== */
128 typedef volatile struct
129 {
131 u32 reserved0[(0x0040U-0x4U)/4U];
136
156 // End of TIMER_Types group
158
159/* ========================================================================== */
160/* SUB-GROUP: FUNCTIONS */
161/* ========================================================================== */
162
183
213
219
239 // End of TIMER_Funcs group
241
242#ifdef __cplusplus
243}
244#endif
245 // End of MAIN UserTimer Group
247
248#endif // TIMER_H
u32 timer_getConfig(timer_instance_t *inst)
Get stored Timer Configuration.
Definition timer.c:25
u32 timer_setPrescalerValue(timer_instance_t *inst, u32 value)
Set Prescaler Value.
Definition timer.c:49
u32 timer_getValue(timer_instance_t *inst)
Get current Timer Value.
Definition timer.c:73
u32 timer_setConfig(timer_instance_t *inst, u32 value)
Set Timer Configuration.
Definition timer.c:33
void timer_applyConfig(timer_instance_t *inst)
Apply the software configuration to the hardware.
Definition timer.c:93
void timer_clearValue(timer_instance_t *inst)
Clear Timer Value to zero.
Definition timer.c:81
u32 timer_setLimit(timer_instance_t *inst, u32 value)
Get stored Timer Limit (Reload Value).
Definition timer.c:65
u32 timer_getLimit(timer_instance_t *inst)
Get stored Timer Limit (Reload Value).
Definition timer.c:57
u32 timer_getPrescalerValue(timer_instance_t *inst)
Get stored Prescaler Value.
Definition timer.c:41
UserTimer hardware register map.
Definition timer.h:129
u32 reserved0[(0x0040U-0x4U)/4U]
Reserved Space (0x04 to 0x3F) *‍/.
Definition timer.h:131
u32 TIMER_CONFIG
Address Offset: 0x40 - Timer Configuration Register *‍/.
Definition timer.h:132
u32 PRESCALER
Address Offset: 0x00 - Prescaler Register *‍/.
Definition timer.h:130
u32 TIMER_VALUE
Address Offset: 0x48 - Timer Current Value Register *‍/.
Definition timer.h:134
u32 TIMER_LIMIT
Address Offset: 0x44 - Timer Limit Register *‍/.
Definition timer.h:133
UserTimer instance. Holds the software registers and hardware pointer.
Definition timer.h:149
u32 prescaler_value
Prescaler value *‍/.
Definition timer.h:151
u32 self_restart
Self restart enable flag *‍/.
Definition timer.h:153
timer_hwreg_t * hwreg
Pointer to Hardware Register Map *‍/.
Definition timer.h:150
u32 prescaler_enable
Prescaler enable flag *‍/.
Definition timer.h:152
u32 timer_limit
Timer limit value *‍/.
Definition timer.h:154
uint32_t u32
Definition type.h:26