1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//! Low level access to MIPS MCU cores
//!
//! This crate includes Rust function to deal with low level aspects related to
//! the MIPS MCU cores (e.g. the M4K core). Routines requiring special or
//! privileged instructions are included in a binary library, thereby avoiding
//! inline assembly.

#![no_std]

pub mod core_timer;
pub mod fmt;
pub mod interrupt;

#[cfg(feature = "critical-section-single-core")]
pub mod critical_section;

/// Physical address
#[derive(Clone, Copy, Debug, Default)]
pub struct PhysicalAddress {
    addr: usize,
}

impl PhysicalAddress {
    /// Create a PhysicalAddress by specifying its value directly
    pub const fn from_usize(addr: usize) -> Self {
        Self { addr }
    }

    /// get the value of the DmaAddress. Useful for programming of bus master
    /// peripherals, which typically access physical memory
    pub fn address(&self) -> usize {
        self.addr
    }
}