use crate::register::{SysReg, SysRegRead};
#[bitbybit::bitfield(u32)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct Mpuir {
#[bits(16..=23, r)]
iregions: u8,
#[bits(8..=15, r)]
dregions: u8,
#[bits(0..=0, r)]
non_unified: bool,
}
impl SysReg for Mpuir {
const CP: u32 = 15;
const CRN: u32 = 0;
const OP1: u32 = 0;
const CRM: u32 = 0;
const OP2: u32 = 4;
}
impl crate::register::SysRegRead for Mpuir {}
impl Mpuir {
#[inline]
pub fn read() -> Mpuir {
unsafe { Self::new_with_raw_value(<Self as SysRegRead>::read_raw()) }
}
}
impl core::fmt::Debug for Mpuir {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.debug_struct("Mpuir")
.field("iregions", &self.iregions())
.field("dregions", &self.dregions())
.field("non_unified", &self.non_unified())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Mpuir {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"MPUIR {{ iregions={=u8}, dregions={=u8}, non_unified={=bool} }}",
self.iregions(),
self.dregions(),
self.non_unified()
)
}
}