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
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#include "smp.h"
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
38
39/* ========================================================================== */
40/* SUB-GROUP : Data Types */
41/* ========================================================================== */
42
49
50 typedef enum {
54
56
57/* ========================================================================== */
58/* SUB-GROUP : DATA STRUCTS */
59/* ========================================================================== */
69
73 typedef volatile struct
74 {
77
79
83 typedef volatile struct
84 {
86 u32 reserved0[(0x4000 - 4*HART_COUNT)/4U];
88 u32 reserved1[(0xBFF8U - 0x4000 - 8*HART_COUNT)/4U];
91
93 // End of CLINT_Types group
95
96
97/* ========================================================================== */
98/* SUB-GROUP: FUNCTIONS */
99/* ========================================================================== */
100
107
122 void clint_uDelay(u32 usec, u32 hz);
123
134 double clint_timerSub(u64 t0, u64 t1);
147
153
164 u32 clint_get_SoftInterrupt(u32 hart_id); //End of CLINT Get Functions group
166
171
184 void clint_setCmp(u64 cmp, u32 hart_id);
190 void clint_set_SoftInterrupt(clint_msip_t enable, u32 hart_id); //End of CLINT Set Functions group
192 // End of CLINT_Funcs group
194
195#ifdef __cplusplus
196}
197#endif
198 // End of MAIN CLINT Group
200
201#endif // CLINT_H
202
203
204
clint_msip_t
Definition clint.h:50
@ MSIP_ENABLE
Enable Software Interrupt *‍/.
Definition clint.h:52
@ MSIP_DISABLE
Disable Software Interrupt *‍/.
Definition clint.h:51
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_timerSub(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_set_SoftInterrupt(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
u32 clint_get_SoftInterrupt(u32 hart_id)
Obtain the current state of the software interrupt for a specific hart.
Definition clint.c:39
#define HART_COUNT
Definition smp.h:24
CLINT hardware register map.
Definition clint.h:84
u32 reserved1[(0xBFF8U - 0x4000 - 8 *HART_COUNT)/4U]
Reserved Space (0x4000 to 0xBFF7) *‍/.
Definition clint.h:88
u32 MSIP[HART_COUNT]
Offset: 0x0000, Software Interrupt Pending for each hart *‍/.
Definition clint.h:85
u32 MTIME_HIGH
Definition clint.h:90
clint_mtimecmp_hwreg_t MTIMECMP[HART_COUNT]
Offset: 0x4000, MTIMECMP for each hart *‍/.
Definition clint.h:87
u32 reserved0[(0x4000 - 4 *HART_COUNT)/4U]
Reserved Space (0x0C to 0x3FFF) *‍/.
Definition clint.h:86
u32 MTIME_LOW
Offset: 0xBFF8, MTIME Low *‍/.
Definition clint.h:89
CLINT MTIMECMP hardware register map.
Definition clint.h:74
u32 MTIMECMP_LOW
Offset: 0x00, MTIMECMP Low *‍/.
Definition clint.h:75
u32 MTIMECMP_HIGH
Offset: 0x04, MTIMECMP High *‍/.
Definition clint.h:76
uint64_t u64
Definition type.h:20
uint32_t u32
Definition type.h:22