riscv_peripheral/
lib.rs

1//! Standard RISC-V peripherals for embedded systems written in Rust.
2
3#![deny(missing_docs)]
4#![no_std]
5
6pub use riscv_pac::result; // re-export the result module
7
8pub mod common; // common definitions for all peripherals
9pub mod hal; // trait implementations for embedded-hal
10pub mod macros; // macros for easing the definition of peripherals in PACs
11
12pub mod aclint; // ACLINT and CLINT peripherals
13pub mod plic; // PLIC peripheral
14
15#[cfg(test)]
16mod test {
17    #[derive(Clone, Copy, Debug, Eq, PartialEq)]
18    #[riscv::pac_enum(unsafe ExternalInterruptNumber)]
19    pub(crate) enum Interrupt {
20        I1 = 1,
21        I2 = 2,
22        I3 = 3,
23        I4 = 4,
24    }
25
26    #[derive(Clone, Copy, Debug, Eq, PartialEq)]
27    #[riscv::pac_enum(unsafe PriorityNumber)]
28    pub(crate) enum Priority {
29        P0 = 0,
30        P1 = 1,
31        P2 = 2,
32        P3 = 3,
33    }
34
35    #[derive(Clone, Copy, Debug, Eq, PartialEq)]
36    #[riscv::pac_enum(unsafe HartIdNumber)]
37    pub(crate) enum HartId {
38        H0 = 0,
39        H1 = 1,
40        H2 = 2,
41    }
42}