-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplic.h
More file actions
33 lines (29 loc) · 1.2 KB
/
plic.h
File metadata and controls
33 lines (29 loc) · 1.2 KB
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
#ifndef __PLIC_H__
#define __PLIC_H__
#include "platform.h"
/*
* This machine puts platform-level interrupt controller (PLIC) here.
* Here only list PLIC registers in Machine mode.
* see https://github.com/qemu/qemu/blob/master/include/hw/riscv/virt.h
* #define VIRT_PLIC_HART_CONFIG "MS"
* #define VIRT_PLIC_NUM_SOURCES 127
* #define VIRT_PLIC_NUM_PRIORITIES 7
* #define VIRT_PLIC_PRIORITY_BASE 0x04
* #define VIRT_PLIC_PENDING_BASE 0x1000
* #define VIRT_PLIC_ENABLE_BASE 0x2000
* #define VIRT_PLIC_ENABLE_STRIDE 0x80
* #define VIRT_PLIC_CONTEXT_BASE 0x200000
* #define VIRT_PLIC_CONTEXT_STRIDE 0x1000
* #define VIRT_PLIC_SIZE(__num_context) \
* (VIRT_PLIC_CONTEXT_BASE + (__num_context) * VIRT_PLIC_CONTEXT_STRIDE)
*/
#define PLIC_PRIORITY(id) (PLIC_BASE + (id) * 4)
#define PLIC_PENDING(id) (PLIC_BASE + 0x1000 + ((id) / 32) * 4)
#define PLIC_MENABLE(hart) (PLIC_BASE + 0x2000 + (hart) * 0x80)
#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)
void plic_init(void);
int plic_claim(void);
void plic_complete(int irq);
#endif /* __PLIC_H__ */