Skip to content

Initial ARMv8-M MPU support. #225

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 10, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 36 additions & 1 deletion src/peripheral/mpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

use volatile_register::{RO, RW};

/// Register block
/// Register block for ARMv7-M
#[cfg(any(armv6m, armv7m, target_arch = "x86_64"))] // x86-64 is for rustdoc
#[repr(C)]
pub struct RegisterBlock {
/// Type
Expand All @@ -28,3 +29,37 @@ pub struct RegisterBlock {
/// Alias 3 of RSAR
pub rsar_a3: RW<u32>,
}

/// Register block for ARMv8-M
#[cfg(armv8m)]
#[repr(C)]
pub struct RegisterBlock {
/// Type
pub _type: RO<u32>,
/// Control
pub ctrl: RW<u32>,
/// Region Number
pub rnr: RW<u32>,
/// Region Base Address
pub rbar: RW<u32>,
/// Region Limit Address
pub rlar: RW<u32>,
/// Alias 1 of RBAR
pub rbar_a1: RW<u32>,
/// Alias 1 of RLAR
pub rlar_a1: RW<u32>,
/// Alias 2 of RBAR
pub rbar_a2: RW<u32>,
/// Alias 2 of RLAR
pub rlar_a2: RW<u32>,
/// Alias 3 of RBAR
pub rbar_a3: RW<u32>,
/// Alias 3 of RLAR
pub rlar_a3: RW<u32>,

// Reserved word at offset 0xBC
_reserved: u32,

/// Memory Attribute Indirection register 0 and 1
pub mair: [RW<u32>; 2],
}