e310x_hal/core/
mod.rs

1//! E31 core peripherals
2
3pub mod counters;
4
5pub use e310x::{CLINT, PLIC};
6
7/// Core peripherals
8pub struct CorePeripherals {
9    /// Performance counters
10    pub counters: counters::PerformanceCounters,
11}
12
13impl CorePeripherals {
14    pub(crate) fn new() -> Self {
15        Self {
16            counters: counters::PerformanceCounters::new(),
17        }
18    }
19
20    /// Steal the peripherals
21    ///
22    /// # Safety
23    ///
24    /// Using this function may break the guarantees of the singleton pattern.
25    pub unsafe fn steal() -> Self {
26        Self::new()
27    }
28}