mips_mcu/
lib.rs

1//! Low level access to MIPS MCU cores
2//!
3//! This crate includes Rust function to deal with low level aspects related to
4//! the MIPS MCU cores (e.g. the M4K core). Routines requiring special or
5//! privileged instructions are included in a binary library, thereby avoiding
6//! inline assembly.
7
8#![no_std]
9
10pub mod core_timer;
11pub mod fmt;
12pub mod interrupt;
13
14#[cfg(feature = "critical-section-single-core")]
15pub mod critical_section;
16
17/// Physical address
18#[derive(Clone, Copy, Debug, Default)]
19pub struct PhysicalAddress {
20    addr: usize,
21}
22
23impl PhysicalAddress {
24    /// Create a PhysicalAddress by specifying its value directly
25    pub const fn from_usize(addr: usize) -> Self {
26        Self { addr }
27    }
28
29    /// get the value of the DmaAddress. Useful for programming of bus master
30    /// peripherals, which typically access physical memory
31    pub fn address(&self) -> usize {
32        self.addr
33    }
34}