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.rs35
1 files changed, 34 insertions, 1 deletions
diff --git a/src/peripheral/mod.rs b/src/peripheral/mod.rs
index 14ae7f7..04fae31 100644
--- a/src/peripheral/mod.rs
+++ b/src/peripheral/mod.rs
@@ -57,7 +57,6 @@
// TODO stand-alone registers: ICTR, ACTLR and STIR
-
use core::marker::PhantomData;
use core::ops;
@@ -77,6 +76,8 @@ pub mod fpu;
pub mod itm;
pub mod mpu;
pub mod nvic;
+#[cfg(armv8m)]
+pub mod sau;
pub mod scb;
pub mod syst;
#[cfg(not(armv6m))]
@@ -120,6 +121,9 @@ pub struct Peripherals {
/// Nested Vector Interrupt Controller
pub NVIC: NVIC,
+ /// Security Attribution Unit
+ pub SAU: SAU,
+
/// System Control Block
pub SCB: SCB,
@@ -186,6 +190,9 @@ impl Peripherals {
NVIC: NVIC {
_marker: PhantomData,
},
+ SAU: SAU {
+ _marker: PhantomData,
+ },
SCB: SCB {
_marker: PhantomData,
},
@@ -439,6 +446,32 @@ impl ops::Deref for NVIC {
}
}
+/// Security Attribution Unit
+pub struct SAU {
+ _marker: PhantomData<*const ()>,
+}
+
+unsafe impl Send for SAU {}
+
+#[cfg(armv8m)]
+impl SAU {
+ /// Returns a pointer to the register block
+ #[inline(always)]
+ pub fn ptr() -> *const sau::RegisterBlock {
+ 0xE000_EDD0 as *const _
+ }
+}
+
+#[cfg(armv8m)]
+impl ops::Deref for SAU {
+ type Target = self::sau::RegisterBlock;
+
+ #[inline(always)]
+ fn deref(&self) -> &Self::Target {
+ unsafe { &*Self::ptr() }
+ }
+}
+
/// System Control Block
pub struct SCB {
_marker: PhantomData<*const ()>,