cortex_ar/register/
irbar.rs

1//! Code for managing IRBAR (*Instruction Region Base Address Register*)
2
3use crate::register::{SysReg, SysRegRead, SysRegWrite};
4
5/// IRBAR (*Instruction Region Base Address Register*)
6#[derive(Debug, Copy, Clone)]
7#[cfg_attr(feature = "defmt", derive(defmt::Format))]
8pub struct Irbar(pub *mut u8);
9impl SysReg for Irbar {
10    const CP: u32 = 15;
11    const CRN: u32 = 6;
12    const OP1: u32 = 0;
13    const CRM: u32 = 1;
14    const OP2: u32 = 1;
15}
16impl crate::register::SysRegRead for Irbar {}
17impl Irbar {
18    #[inline]
19    /// Reads IRBAR (*Instruction Region Base Address Register*)
20    ///
21    /// Set RGNR to control which region this reads.
22    pub fn read() -> Irbar {
23        unsafe { Self(<Self as SysRegRead>::read_raw() as *mut u8) }
24    }
25}
26
27impl crate::register::SysRegWrite for Irbar {}
28impl Irbar {
29    #[inline]
30    /// Writes IRBAR (*Instruction Region Base Address Register*)
31    ///
32    /// Set RGNR to control which region this affects.
33    pub fn write(value: Irbar) {
34        unsafe { <Self as SysRegWrite>::write_raw(value.0 as u32) }
35    }
36}