cortex_ar/register/
iracr.rs

1//! Code for managing IRACR (*Instruction Region Access Control Register*)
2
3use arbitrary_int::u3;
4
5use crate::register::{SysReg, SysRegRead, SysRegWrite};
6
7/// IRACR (*Instruction Region Access Control Register*)
8#[bitbybit::bitfield(u32, debug, defmt_bitfields(feature = "defmt"))]
9#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
10pub struct Iracr {
11    /// Execute Never
12    #[bits(12..=12, rw)]
13    nx: bool,
14    /// Access Permission bits
15    #[bits(8..=10, rw)]
16    ap: u3,
17    /// TEX bits
18    #[bits(3..=5, rw)]
19    tex: u3,
20    /// S bit
21    #[bits(2..=2, rw)]
22    s: bool,
23    /// C bit
24    #[bits(1..=1, rw)]
25    c: bool,
26    /// B bit
27    #[bits(0..=0, rw)]
28    b: bool,
29}
30
31impl SysReg for Iracr {
32    const CP: u32 = 15;
33    const CRN: u32 = 6;
34    const OP1: u32 = 0;
35    const CRM: u32 = 1;
36    const OP2: u32 = 5;
37}
38impl crate::register::SysRegRead for Iracr {}
39impl Iracr {
40    #[inline]
41    /// Reads IRACR (*Instruction Region Access Control Register*)
42    ///
43    /// Set RGNR to control which region this reads.
44    pub fn read() -> Iracr {
45        unsafe { Self::new_with_raw_value(<Self as SysRegRead>::read_raw()) }
46    }
47}
48
49impl crate::register::SysRegWrite for Iracr {}
50impl Iracr {
51    #[inline]
52    /// Writes IRACR (*Instruction Region Access Control Register*)
53    ///
54    /// Set RGNR to control which region this affects.
55    pub fn write(value: Iracr) {
56        unsafe { <Self as SysRegWrite>::write_raw(value.raw_value()) }
57    }
58}