aarch32_cpu/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, Clone, Copy, PartialEq, Eq)]
7#[repr(transparent)]
8#[cfg_attr(feature = "defmt", derive(defmt::Format))]
9#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
10pub struct Irbar(pub u32);
11
12impl SysReg for Irbar {
13    const CP: u32 = 15;
14    const CRN: u32 = 6;
15    const OP1: u32 = 0;
16    const CRM: u32 = 1;
17    const OP2: u32 = 1;
18}
19
20impl crate::register::SysRegRead for Irbar {}
21
22impl Irbar {
23    #[inline]
24    /// Reads IRBAR (*Instruction Region Base Address Register*)
25    ///
26    /// Set RGNR to control which region this reads.
27    pub fn read() -> Irbar {
28        unsafe { Self(<Self as SysRegRead>::read_raw()) }
29    }
30}
31
32impl crate::register::SysRegWrite for Irbar {}
33
34impl Irbar {
35    #[inline]
36    /// Writes IRBAR (*Instruction Region Base Address Register*)
37    ///
38    /// Set RGNR to control which region this affects.
39    pub fn write(value: Irbar) {
40        unsafe { <Self as SysRegWrite>::write_raw(value.0) }
41    }
42}