cortex_ar/register/armv8r/
hprselr.rs

1//! Code for managing HPRSELR (*Hyp Protection Region Selection Register*)
2
3use crate::register::{SysReg, SysRegRead, SysRegWrite};
4
5/// HPRSELR (*Hyp Protection Region Selection Register*)
6#[derive(Debug, Copy, Clone)]
7#[cfg_attr(feature = "defmt", derive(defmt::Format))]
8#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
9pub struct Hprselr(pub u32);
10impl SysReg for Hprselr {
11    const CP: u32 = 15;
12    const CRN: u32 = 6;
13    const OP1: u32 = 4;
14    const CRM: u32 = 2;
15    const OP2: u32 = 1;
16}
17impl crate::register::SysRegRead for Hprselr {}
18impl Hprselr {
19    #[inline]
20    /// Reads HPRSELR (*Hyp Protection Region Selection Register*)
21    pub fn read() -> Hprselr {
22        unsafe { Self(<Self as SysRegRead>::read_raw()) }
23    }
24}
25impl crate::register::SysRegWrite for Hprselr {}
26impl Hprselr {
27    #[inline]
28    /// Writes HPRSELR (*Hyp Protection Region Selection Register*)
29    ///
30    /// Controls what appears in HPRLAR and HPRBAR
31    pub fn write(value: Self) {
32        unsafe {
33            <Self as SysRegWrite>::write_raw(value.0);
34        }
35    }
36}