aarch32_cpu/register/armv8r/
cnthp_ctl.rs1use crate::register::{SysReg, SysRegRead, SysRegWrite};
4
5#[bitbybit::bitfield(u32, debug, defmt_bitfields(feature = "defmt"))]
7#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
8pub struct CnthpCtl {
9 #[bit(2, r)]
11 istatus: bool,
12 #[bit(1, rw)]
17 imask: bool,
18 #[bit(0, rw)]
20 enable: bool,
21}
22
23impl SysReg for CnthpCtl {
24 const CP: u32 = 15;
25 const CRN: u32 = 14;
26 const OP1: u32 = 4;
27 const CRM: u32 = 2;
28 const OP2: u32 = 1;
29}
30
31impl SysRegRead for CnthpCtl {}
32
33impl CnthpCtl {
34 #[inline]
35 pub fn read() -> CnthpCtl {
37 unsafe { Self::new_with_raw_value(<Self as SysRegRead>::read_raw()) }
38 }
39}
40
41impl SysRegWrite for CnthpCtl {}
42
43impl CnthpCtl {
44 #[inline]
45 pub fn write(value: Self) {
47 unsafe {
48 <Self as SysRegWrite>::write_raw(value.raw_value());
49 }
50 }
51
52 #[inline]
54 pub fn modify<F>(f: F)
55 where
56 F: FnOnce(&mut Self),
57 {
58 let mut value = Self::read();
59 f(&mut value);
60 Self::write(value);
61 }
62}