RV32 SoC DS UG
High-Perf RV32 SoC DS UG
RV64 SoC DS UG API and Examples
Embedded IDE UG
Loading...
Searching...
No Matches
clint.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 CLINT_H
7#define CLINT_H
8
9
20
21#include "type.h"
22#include "soc.h"
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
86
87/* ========================================================================== */
88/* SUB-GROUP : Data Types */
89/* ========================================================================== */
90
97
98 typedef enum {
101 } clint_msip_t;
102
104
105/* ========================================================================== */
106/* SUB-GROUP : DATA STRUCTS */
107/* ========================================================================== */
117
121 typedef volatile struct
122 {
125
127
131 typedef volatile struct
132 {
133 u32 MSIP[SYSTEM_NUMBER_OF_HARTS];
134 u32 reserved0[(0x4000 - 4*SYSTEM_NUMBER_OF_HARTS)/4U];
135 clint_mtimecmp_hwreg_t MTIMECMP[SYSTEM_NUMBER_OF_HARTS];
136 u32 reserved1[(0xBFF8U - 0x4000 - 8*SYSTEM_NUMBER_OF_HARTS)/4U];
139
141 // End of CLINT_Types group
143
144
145/* ========================================================================== */
146/* SUB-GROUP: FUNCTIONS */
147/* ========================================================================== */
148
155
170 void clint_uDelay(u32 usec, u32 hz);
171
182 double clint_getTimeDiff(u64 t0, u64 t1);
195
201
212 u32 clint_getSoftInterrupt(u32 hart_id); //End of CLINT Get Functions group
214
219
232 void clint_setCmp(u64 cmp, u32 hart_id);
238 void clint_setSoftInterrupt(clint_msip_t enable, u32 hart_id); //End of CLINT Set Functions group
240 // End of CLINT_Funcs group
242
243#ifdef __cplusplus
244}
245#endif
246 // End of MAIN CLINT Group
248
249#endif // CLINT_H
250
251
252
clint_msip_t
Definition clint.h:98
@ MSIP_ENABLE
Enable Software Interrupt *‍/.
Definition clint.h:100
@ MSIP_DISABLE
Disable Software Interrupt *‍/.
Definition clint.h:99
u32 clint_getSoftInterrupt(u32 hart_id)
Obtain the current state of the software interrupt for a specific hart.
Definition clint.c:39
u32 clint_getTimeHigh()
Reads the high part of the current time.
Definition clint.c:33
void clint_setCmp(u64 cmp, u32 hart_id)
This function sets the compare value for the CLINT CMP register for a specific hardware thread.
Definition clint.c:56
u64 clint_getTime()
Reads the current time value from the CLINT TIME register.
Definition clint.c:45
double clint_getTimeDiff(u64 t0, u64 t1)
Get the time difference between t0 and t1.
Definition clint.c:77
u32 clint_getTimeLow()
Reads the low part of the current time.
Definition clint.c:27
void clint_setSoftInterrupt(clint_msip_t enable, u32 hart_id)
Sets the software interrupt state for a specific hart.
Definition clint.c:72
void clint_uDelay(u32 usec, u32 hz)
This function introduces a microsecond delay using the CLINT TIME register.
Definition clint.c:64
CLINT hardware register map.
Definition clint.h:132
u32 MTIME_HIGH
Offset: 0xBFFC, MTIME High.
Definition clint.h:138
clint_mtimecmp_hwreg_t MTIMECMP[SYSTEM_NUMBER_OF_HARTS]
Offset: 0x4000, MTIMECMP for each hart.
Definition clint.h:135
u32 MTIME_LOW
Offset: 0xBFF8, MTIME Low.
Definition clint.h:137
u32 reserved0[(0x4000 - 4 *SYSTEM_NUMBER_OF_HARTS)/4U]
Reserved Space (0x0C to 0x3FFF).
Definition clint.h:134
u32 MSIP[SYSTEM_NUMBER_OF_HARTS]
Offset: 0x0000, Software Interrupt Pending for each hart.
Definition clint.h:133
u32 reserved1[(0xBFF8U - 0x4000 - 8 *SYSTEM_NUMBER_OF_HARTS)/4U]
Reserved Space (0x4000 to 0xBFF7).
Definition clint.h:136
CLINT MTIMECMP hardware register map.
Definition clint.h:122
u32 MTIMECMP_LOW
Offset: 0x00, MTIMECMP Low *‍/.
Definition clint.h:123
u32 MTIMECMP_HIGH
Offset: 0x04, MTIMECMP High *‍/.
Definition clint.h:124
uint64_t u64
Definition type.h:24
uint32_t u32
Definition type.h:26