-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplatform.h
39 lines (29 loc) · 1.04 KB
/
platform.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef __PLATFORM_H__
#define __PLATFORM_H__
/*
* QEMU RISC-V Virt machine with 16550a UART and VirtIO MMIO
*/
/*
* maximum number of CPUs
* #define VIRT_CPUS_MAX 8
*/
#define MAXNUM_CPU 8
/* Memory map*/
// UART Registers
#define UART0 0x10000000L
#define UART0_IRQ 10
#define PLIC_BASE 0x0c000000L
#define PLIC_BASE 0x0c000000L
#define PLIC_PRIORITY(id) (PLIC_BASE + (id) * 4)
#define PLIC_PENDING(id) (PLIC_BASE + 0x1000 + ((id) / 32) * 4)
#define PLIC_MENABLE(hart, id) (PLIC_BASE + 0x2000 + (hart) * 0x80 + ((id) / 32) * 4)
#define PLIC_MTHRESHOLD(hart) (PLIC_BASE + 0x200000 + (hart) * 0x1000)
#define PLIC_MCLAIM(hart) (PLIC_BASE + 0x200004 + (hart) * 0x1000)
#define PLIC_MCOMPLETE(hart) (PLIC_BASE + 0x200004 + (hart) * 0x1000)
#define CLINT_BASE 0x2000000L
#define CLINT_MSIP(hartid) (CLINT_BASE + 4 * (hartid))
#define CLINT_MTIMECMP(hartid) (CLINT_BASE + 0x4000 + 8 * (hartid))
#define CLINT_MTIME (CLINT_BASE + 0xBFF8) // cycles since boot.
/* 10000000 ticks per-second */
#define CLINT_TIMEBASE_FREQ 10000000
#endif /* __PLATFORM_H__ */