#[cfg(cortex_m)]
use core::arch::asm;
use cortex_m_macros::asm_cfg;
#[inline]
#[asm_cfg(cortex_m)]
pub fn read() -> u32 {
let r;
unsafe { asm!("mrs {}, MSP", out(reg) r, options(nomem, nostack, preserves_flags)) };
r
}
#[inline]
#[deprecated = "calling this function invokes Undefined Behavior, consider asm::bootstrap as an alternative"]
#[asm_cfg(cortex_m)]
pub unsafe fn write(bits: u32) {
unsafe { asm!("msr MSP, {}", in(reg) bits, options(nomem, nostack, preserves_flags)) };
}
#[inline]
#[asm_cfg(armv8m)]
pub fn read_ns() -> u32 {
let r;
unsafe { asm!("mrs {}, MSP_NS", out(reg) r, options(nomem, nostack, preserves_flags)) };
r
}
#[inline]
#[asm_cfg(armv8m)]
pub unsafe fn write_ns(bits: u32) {
unsafe { asm!("msr MSP_NS, {}", in(reg) bits, options(nomem, nostack, preserves_flags)) };
}