diff options
Diffstat (limited to 'src/peripheral/mod.rs')
-rw-r--r-- | src/peripheral/mod.rs | 36 |
1 files changed, 2 insertions, 34 deletions
diff --git a/src/peripheral/mod.rs b/src/peripheral/mod.rs index f297ab8..97c1762 100644 --- a/src/peripheral/mod.rs +++ b/src/peripheral/mod.rs @@ -5,12 +5,12 @@ //! - ARMv7-M Architecture Reference Manual (Issue E.b) - Chapter B3 use core::cell::UnsafeCell; -use core::marker::PhantomData; use core::ptr; +pub use mcu::Peripheral; use volatile_register::{RO, RW, WO}; -use interrupt::{CriticalSection, Nr}; +use interrupt::Nr; #[cfg(test)] mod test; @@ -54,38 +54,6 @@ pub const CBP: Peripheral<CBP> = unsafe { Peripheral::new(0xE000_EF50) }; // TODO stand-alone registers: ICTR, ACTLR and STIR -/// A peripheral -#[derive(Debug)] -pub struct Peripheral<T> -where - T: 'static, -{ - address: usize, - _marker: PhantomData<&'static mut T>, -} - -impl<T> Peripheral<T> { - /// Creates a new peripheral - /// - /// `address` is the base address of the register block - pub const unsafe fn new(address: usize) -> Self { - Peripheral { - address: address, - _marker: PhantomData, - } - } - - /// Borrows the peripheral for the duration of a critical section - pub fn borrow<'cs>(&self, _ctxt: &'cs CriticalSection) -> &'cs T { - unsafe { &*self.get() } - } - - /// Returns a pointer to the register block - pub fn get(&self) -> *mut T { - self.address as *mut T - } -} - /// CPUID register block #[repr(C)] pub struct CPUID { |