summaryrefslogtreecommitdiff
path: root/interrupt/plic.h
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2021-09-15 23:16:11 +0200
committerVegard Storheil Eriksen <zyp@jvnv.net>2021-09-15 23:16:11 +0200
commit968937d0d937487ab301f017c145889fc0e94692 (patch)
treea62e27423fdc515c71624def636b63b12f06cf57 /interrupt/plic.h
parent9194e871a4590d1118f40ea8dbf1d34e45bc759c (diff)
platforms: Add initial RISC-V/GD32V support.
Diffstat (limited to 'interrupt/plic.h')
-rw-r--r--interrupt/plic.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/interrupt/plic.h b/interrupt/plic.h
new file mode 100644
index 0000000..46ade92
--- /dev/null
+++ b/interrupt/plic.h
@@ -0,0 +1,25 @@
+#pragma once
+
+class PLIC_t {
+ private:
+ struct PLIC_ctx_reg_t {
+ volatile uint32_t THRESHOLD;
+ volatile uint32_t CLAIM;
+ uint32_t _reserved[1022];
+ };
+
+ struct PLIC_reg_t {
+ volatile uint32_t PRIO[1024];
+ volatile uint32_t PEND[32];
+ uint32_t _reserved[992];
+ volatile uint32_t ENABLE[15872][32];
+ uint32_t _reserved2[14336];
+ PLIC_ctx_reg_t CTX[15872];
+ };
+
+ public:
+ PLIC_reg_t& reg;
+
+ PLIC_t(uint32_t reg_addr) :
+ reg(*(PLIC_reg_t*)reg_addr) {}
+};