diff options
author | 2021-09-05 19:29:31 +1200 | |
---|---|---|
committer | 2021-09-06 21:17:48 +1200 | |
commit | 7887d6d5415ab401d4ada96cc9ab44f35730da0b (patch) | |
tree | 365fc219d6129bf6f6c97b1bea17490fc172bfe3 /src/peripheral/mod.rs | |
parent | 5e01de8fba064cf8b72d6fb60e6467d0ff9d4da9 (diff) | |
download | cortex-m-7887d6d5415ab401d4ada96cc9ab44f35730da0b.tar.gz cortex-m-7887d6d5415ab401d4ada96cc9ab44f35730da0b.tar.zst cortex-m-7887d6d5415ab401d4ada96cc9ab44f35730da0b.zip |
Add the Cortex-M7 TCM and cache access control registers.
These registers appear to specific to the Cortex-M7, so add a feature gate
"cm7".
Diffstat (limited to 'src/peripheral/mod.rs')
-rw-r--r-- | src/peripheral/mod.rs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/peripheral/mod.rs b/src/peripheral/mod.rs index 8f5678d..463a6ec 100644 --- a/src/peripheral/mod.rs +++ b/src/peripheral/mod.rs @@ -60,6 +60,8 @@ use core::ops; use crate::interrupt; +#[cfg(cm7)] +pub mod ac; #[cfg(not(armv6m))] pub mod cbp; pub mod cpuid; @@ -91,6 +93,10 @@ mod test; #[allow(non_snake_case)] #[allow(clippy::manual_non_exhaustive)] pub struct Peripherals { + /// Cortex-M7 TCM and cache access control. + #[cfg(cm7)] + pub AC: AC, + /// Cache and branch predictor maintenance operations. /// Not available on Armv6-M. pub CBP: CBP, @@ -172,6 +178,10 @@ impl Peripherals { TAKEN = true; Peripherals { + #[cfg(cm7)] + AC: AC { + _marker: PhantomData, + }, CBP: CBP { _marker: PhantomData, }, @@ -219,6 +229,27 @@ impl Peripherals { } } +/// Access control +#[cfg(cm7)] +pub struct AC { + _marker: PhantomData<*const ()>, +} + +#[cfg(cm7)] +unsafe impl Send for AC {} + +#[cfg(cm7)] +impl AC { + /// Pointer to the register block + pub const PTR: *const self::ac::RegisterBlock = 0xE000_EF90 as *const _; + + /// Returns a pointer to the register block (to be deprecated in 0.7) + #[inline(always)] + pub const fn ptr() -> *const self::ac::RegisterBlock { + Self::PTR + } +} + /// Cache and branch predictor maintenance operations pub struct CBP { _marker: PhantomData<*const ()>, |