mod.rs 768 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. use core::pin::Pin;
  2. use super::config::platform::virt::*;
  3. use riscv_peripheral::{
  4. aclint::{Clint, CLINT},
  5. plic::{Plic, PLIC},
  6. };
  7. use sbi::SbiError;
  8. #[derive(Clone, Copy)]
  9. struct ArchPlic;
  10. #[derive(Clone, Copy)]
  11. struct ArchClint;
  12. unsafe impl Plic for ArchPlic {
  13. const BASE: usize = PLIC_BASE;
  14. }
  15. unsafe impl Clint for ArchClint {
  16. const BASE: usize = CLINT_BASE;
  17. const MTIME_FREQ: usize = CPU_FREQ_HZ as usize;
  18. }
  19. /// Architecture-specific interrupt control block.
  20. pub struct InterruptControl {
  21. clint: CLINT<ArchClint>,
  22. }
  23. impl InterruptControl {
  24. /// # Safety
  25. /// should be called only once.
  26. pub(crate) fn new() -> Self {
  27. Self {
  28. clint: CLINT::new(),
  29. }
  30. }
  31. pub fn init(self: Pin<&mut Self>) {}
  32. }