aarch32_cpu/register/armv8r/
hactlr2.rs

1//! Code for managing HACTLR2 (*Hyp Auxiliary Control Register 2*)
2
3use crate::register::{SysReg, SysRegRead, SysRegWrite};
4
5/// HACTLR2 (*Hyp Auxiliary Control Register 2*)
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 Hactlr2(pub u32);
10
11impl SysReg for Hactlr2 {
12    const CP: u32 = 15;
13    const CRN: u32 = 1;
14    const OP1: u32 = 4;
15    const CRM: u32 = 0;
16    const OP2: u32 = 3;
17}
18
19impl crate::register::SysRegRead for Hactlr2 {}
20
21impl Hactlr2 {
22    #[inline]
23    /// Reads HACTLR2 (*Hyp Auxiliary Control Register 2*)
24    pub fn read() -> Hactlr2 {
25        unsafe { Self(<Self as SysRegRead>::read_raw()) }
26    }
27}
28
29impl crate::register::SysRegWrite for Hactlr2 {}
30
31impl Hactlr2 {
32    #[inline]
33    /// Writes HACTLR2 (*Hyp Auxiliary Control Register 2*)
34    ///
35    /// # Safety
36    ///
37    /// Ensure that this value is appropriate for this register
38    pub unsafe fn write(value: Self) {
39        unsafe {
40            <Self as SysRegWrite>::write_raw(value.0);
41        }
42    }
43}