diff options
Diffstat (limited to 'interrupt/plic.h')
-rw-r--r-- | interrupt/plic.h | 25 |
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) {} +}; |