aboutsummaryrefslogtreecommitdiff
path: root/src/peripheral/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/peripheral/mod.rs')
-rw-r--r--src/peripheral/mod.rs27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/peripheral/mod.rs b/src/peripheral/mod.rs
index 9432dea..8854830 100644
--- a/src/peripheral/mod.rs
+++ b/src/peripheral/mod.rs
@@ -159,6 +159,7 @@ impl Peripherals {
}
/// Unchecked version of `Peripherals::take`
+ #[inline]
pub unsafe fn steal() -> Self {
CORE_PERIPHERALS = true;
@@ -212,6 +213,7 @@ unsafe impl Send for CBP {}
#[cfg(not(armv6m))]
impl CBP {
+ #[inline(always)]
pub(crate) unsafe fn new() -> Self {
CBP {
_marker: PhantomData,
@@ -219,6 +221,7 @@ impl CBP {
}
/// Returns a pointer to the register block
+ #[inline(always)]
pub fn ptr() -> *const self::cbp::RegisterBlock {
0xE000_EF50 as *const _
}
@@ -228,6 +231,7 @@ impl CBP {
impl ops::Deref for CBP {
type Target = self::cbp::RegisterBlock;
+ #[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::ptr() }
}
@@ -242,6 +246,7 @@ unsafe impl Send for CPUID {}
impl CPUID {
/// Returns a pointer to the register block
+ #[inline(always)]
pub fn ptr() -> *const self::cpuid::RegisterBlock {
0xE000_ED00 as *const _
}
@@ -250,6 +255,7 @@ impl CPUID {
impl ops::Deref for CPUID {
type Target = self::cpuid::RegisterBlock;
+ #[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::ptr() }
}
@@ -264,6 +270,7 @@ unsafe impl Send for DCB {}
impl DCB {
/// Returns a pointer to the register block
+ #[inline(always)]
pub fn ptr() -> *const dcb::RegisterBlock {
0xE000_EDF0 as *const _
}
@@ -272,6 +279,7 @@ impl DCB {
impl ops::Deref for DCB {
type Target = self::dcb::RegisterBlock;
+ #[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*DCB::ptr() }
}
@@ -286,6 +294,7 @@ unsafe impl Send for DWT {}
impl DWT {
/// Returns a pointer to the register block
+ #[inline(always)]
pub fn ptr() -> *const dwt::RegisterBlock {
0xE000_1000 as *const _
}
@@ -294,6 +303,7 @@ impl DWT {
impl ops::Deref for DWT {
type Target = self::dwt::RegisterBlock;
+ #[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::ptr() }
}
@@ -309,6 +319,7 @@ unsafe impl Send for FPB {}
#[cfg(not(armv6m))]
impl FPB {
/// Returns a pointer to the register block
+ #[inline(always)]
pub fn ptr() -> *const fpb::RegisterBlock {
0xE000_2000 as *const _
}
@@ -318,6 +329,7 @@ impl FPB {
impl ops::Deref for FPB {
type Target = self::fpb::RegisterBlock;
+ #[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::ptr() }
}
@@ -333,6 +345,7 @@ unsafe impl Send for FPU {}
#[cfg(any(has_fpu, target_arch = "x86_64"))]
impl FPU {
/// Returns a pointer to the register block
+ #[inline(always)]
pub fn ptr() -> *const fpu::RegisterBlock {
0xE000_EF30 as *const _
}
@@ -342,6 +355,7 @@ impl FPU {
impl ops::Deref for FPU {
type Target = self::fpu::RegisterBlock;
+ #[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::ptr() }
}
@@ -357,6 +371,7 @@ unsafe impl Send for ITM {}
#[cfg(not(armv6m))]
impl ITM {
/// Returns a pointer to the register block
+ #[inline(always)]
pub fn ptr() -> *mut itm::RegisterBlock {
0xE000_0000 as *mut _
}
@@ -366,6 +381,7 @@ impl ITM {
impl ops::Deref for ITM {
type Target = self::itm::RegisterBlock;
+ #[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::ptr() }
}
@@ -373,6 +389,7 @@ impl ops::Deref for ITM {
#[cfg(not(armv6m))]
impl ops::DerefMut for ITM {
+ #[inline(always)]
fn deref_mut(&mut self) -> &mut Self::Target {
unsafe { &mut *Self::ptr() }
}
@@ -387,6 +404,7 @@ unsafe impl Send for MPU {}
impl MPU {
/// Returns a pointer to the register block
+ #[inline(always)]
pub fn ptr() -> *const mpu::RegisterBlock {
0xE000_ED90 as *const _
}
@@ -395,6 +413,7 @@ impl MPU {
impl ops::Deref for MPU {
type Target = self::mpu::RegisterBlock;
+ #[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::ptr() }
}
@@ -409,6 +428,7 @@ unsafe impl Send for NVIC {}
impl NVIC {
/// Returns a pointer to the register block
+ #[inline(always)]
pub fn ptr() -> *const nvic::RegisterBlock {
0xE000_E100 as *const _
}
@@ -417,6 +437,7 @@ impl NVIC {
impl ops::Deref for NVIC {
type Target = self::nvic::RegisterBlock;
+ #[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::ptr() }
}
@@ -431,6 +452,7 @@ unsafe impl Send for SCB {}
impl SCB {
/// Returns a pointer to the register block
+ #[inline(always)]
pub fn ptr() -> *const scb::RegisterBlock {
0xE000_ED04 as *const _
}
@@ -439,6 +461,7 @@ impl SCB {
impl ops::Deref for SCB {
type Target = self::scb::RegisterBlock;
+ #[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::ptr() }
}
@@ -453,6 +476,7 @@ unsafe impl Send for SYST {}
impl SYST {
/// Returns a pointer to the register block
+ #[inline(always)]
pub fn ptr() -> *const syst::RegisterBlock {
0xE000_E010 as *const _
}
@@ -461,6 +485,7 @@ impl SYST {
impl ops::Deref for SYST {
type Target = self::syst::RegisterBlock;
+ #[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::ptr() }
}
@@ -476,6 +501,7 @@ unsafe impl Send for TPIU {}
#[cfg(not(armv6m))]
impl TPIU {
/// Returns a pointer to the register block
+ #[inline(always)]
pub fn ptr() -> *const tpiu::RegisterBlock {
0xE004_0000 as *const _
}
@@ -485,6 +511,7 @@ impl TPIU {
impl ops::Deref for TPIU {
type Target = self::tpiu::RegisterBlock;
+ #[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::ptr() }
}