Sapphire SoC DS Sapphire SoC UG Sapphire HP SoC DS Sapphire HP SoC UG RISC-V Embedded IDE UG Board Support Package
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
36
37/* ========================================================================== */
38/* SUB-GROUP : REGISTER DEFINITIONS */
39/* ========================================================================== */
46 #define TIMER_CONFIG_WITH_PRESCALER 0x2
47 #define TIMER_CONFIG_WITHOUT_PRESCALER 0x1
48 #define TIMER_CONFIG_SELF_RESTART 0x10000 // End of TIMER_Macros group
50
51/* ========================================================================== */
52/* SUB-GROUP : DATA STRUCTS */
53/* ========================================================================== */
84 typedef volatile struct
85 {
87 u32 reserved0[(0x0040U-0x4U)/4U];
92
112 // End of TIMER_Types group
114
115/* ========================================================================== */
116/* SUB-GROUP: FUNCTIONS */
117/* ========================================================================== */
118
139
169
175
195 // End of TIMER_Funcs group
197
198#ifdef __cplusplus
199}
200#endif
201 // End of MAIN UserTimer Group
203
204#endif // TIMER_H
void utimer_applyConfig(utimer_instance_t *inst)
Apply the software configuration to the hardware.
Definition timer.c:93
u32 utimer_setConfig(utimer_instance_t *inst, u32 value)
Set Timer Configuration.
Definition timer.c:33
u32 utimer_getConfig(utimer_instance_t *inst)
Get stored Timer Configuration.
Definition timer.c:25
u32 utimer_getLimit(utimer_instance_t *inst)
Get stored Timer Limit (Reload Value).
Definition timer.c:57
void utimer_clearValue(utimer_instance_t *inst)
Clear Timer Value to zero.
Definition timer.c:81
u32 utimer_getPrescalerValue(utimer_instance_t *inst)
Get stored Prescaler Value.
Definition timer.c:41
u32 utimer_setPrescalerValue(utimer_instance_t *inst, u32 value)
Set Prescaler Value.
Definition timer.c:49
u32 utimer_setLimit(utimer_instance_t *inst, u32 value)
Get stored Timer Limit (Reload Value).
Definition timer.c:65
u32 utimer_getValue(utimer_instance_t *inst)
Get current Timer Value.
Definition timer.c:73
Timer hardware register map.
Definition timer.h:85
u32 reserved0[(0x0040U-0x4U)/4U]
Reserved Space (0x04 to 0x3F) *‍/.
Definition timer.h:87
u32 PRESCALER
Address Offset: 0x00 - Prescaler Register *‍/.
Definition timer.h:86
u32 TIMER_VALUE
Address Offset: 0x48 - Timer Current Value Register *‍/.
Definition timer.h:90
u32 TIMER_CONFIG
Address Offset: 0x40 - Timer Configuration Register *‍/.
Definition timer.h:88
u32 TIMER_LIMIT
Address Offset: 0x44 - Timer Limit Register *‍/.
Definition timer.h:89
Timer instance. Holds the software registers and hardware pointer.
Definition timer.h:105
u32 timer_limit
Timer limit value *‍/.
Definition timer.h:110
u32 self_restart
Self restart enable flag *‍/.
Definition timer.h:109
u32 prescaler_value
Prescaler value *‍/.
Definition timer.h:107
u32 prescaler_enable
Prescaler enable flag *‍/.
Definition timer.h:108
utimer_hwreg_t * hwreg
Pointer to Hardware Register Map *‍/.
Definition timer.h:106
uint32_t u32
Definition type.h:22