coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
clint.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <mcall.h>
4 #include <device/mmio.h>
5 
6 #define SPIKE_CLINT_BASE 0x02000000
7 
8 /* This function is used to initialize HLS()->time/HLS()->timecmp */
9 void mtime_init(void)
10 {
11  long hart_id = read_csr(mhartid);
12  HLS()->time = (uint64_t *)(SPIKE_CLINT_BASE + 0xbff8);
13  HLS()->timecmp = (uint64_t *)(SPIKE_CLINT_BASE + 0x4000 + 8 * hart_id);
14 }
15 
16 void set_msip(int hartid, int val)
17 {
18  write32((void *)(SPIKE_CLINT_BASE + 4 * (uintptr_t)hartid), !!val);
19 }
static void write32(void *addr, uint32_t val)
Definition: mmio.h:40
void set_msip(int hartid, int val)
Definition: clint.c:15
void mtime_init(void)
Definition: clint.c:8
#define SPIKE_CLINT_BASE
Definition: clint.c:6
#define HLS()
Definition: mcall.h:63
unsigned long uintptr_t
Definition: stdint.h:21
unsigned long long uint64_t
Definition: stdint.h:17
u8 val
Definition: sys.c:300