#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum Faultmask {
Active,
Inactive,
}
impl Faultmask {
pub fn is_active(&self) -> bool {
*self == Faultmask::Active
}
pub fn is_inactive(&self) -> bool {
*self == Faultmask::Inactive
}
}
#[inline(always)]
pub fn read() -> Faultmask {
let r: u32;
unsafe {
asm!("mrs $0, FAULTMASK"
: "=r"(r)
:
:
: "volatile");
}
if r & (1 << 0) == (1 << 0) {
Faultmask::Inactive
} else {
Faultmask::Active
}
}