This source file includes following definitions.
- plicinit
- plicinithart
- plic_claim
- plic_complete
1 #include "types.h"
2 #include "param.h"
3 #include "memlayout.h"
4 #include "riscv.h"
5 #include "defs.h"
6
7
8
9
10
11 void
12 plicinit(void)
13 {
14
15 *(uint32*)(PLIC + UART0_IRQ*4) = 1;
16 *(uint32*)(PLIC + VIRTIO0_IRQ*4) = 1;
17 }
18
19 void
20 plicinithart(void)
21 {
22 int hart = cpuid();
23
24
25
26 *(uint32*)PLIC_SENABLE(hart) = (1 << UART0_IRQ) | (1 << VIRTIO0_IRQ);
27
28
29 *(uint32*)PLIC_SPRIORITY(hart) = 0;
30 }
31
32
33 int
34 plic_claim(void)
35 {
36 int hart = cpuid();
37 int irq = *(uint32*)PLIC_SCLAIM(hart);
38 return irq;
39 }
40
41
42 void
43 plic_complete(int irq)
44 {
45 int hart = cpuid();
46 *(uint32*)PLIC_SCLAIM(hart) = irq;
47 }