mcxa_pac/syscon/
cpustat.rs1#[doc = "Register `CPUSTAT` reader"]
2pub type R = crate::R<CpustatSpec>;
3#[doc = "CPU0 sleeping state\n\nValue on reset: 0"]
4#[cfg_attr(feature = "defmt", derive(defmt::Format))]
5#[derive(Clone, Copy, Debug, PartialEq, Eq)]
6pub enum Cpu0sleeping {
7 #[doc = "0: CPU is not sleeping"]
8 Awake = 0,
9 #[doc = "1: CPU is sleeping"]
10 Sleeping = 1,
11}
12impl From<Cpu0sleeping> for bool {
13 #[inline(always)]
14 fn from(variant: Cpu0sleeping) -> Self {
15 variant as u8 != 0
16 }
17}
18#[doc = "Field `CPU0SLEEPING` reader - CPU0 sleeping state"]
19pub type Cpu0sleepingR = crate::BitReader<Cpu0sleeping>;
20impl Cpu0sleepingR {
21 #[doc = "Get enumerated values variant"]
22 #[inline(always)]
23 pub const fn variant(&self) -> Cpu0sleeping {
24 match self.bits {
25 false => Cpu0sleeping::Awake,
26 true => Cpu0sleeping::Sleeping,
27 }
28 }
29 #[doc = "CPU is not sleeping"]
30 #[inline(always)]
31 pub fn is_awake(&self) -> bool {
32 *self == Cpu0sleeping::Awake
33 }
34 #[doc = "CPU is sleeping"]
35 #[inline(always)]
36 pub fn is_sleeping(&self) -> bool {
37 *self == Cpu0sleeping::Sleeping
38 }
39}
40#[doc = "CPU0 lockup state\n\nValue on reset: 0"]
41#[cfg_attr(feature = "defmt", derive(defmt::Format))]
42#[derive(Clone, Copy, Debug, PartialEq, Eq)]
43pub enum Cpu0lockup {
44 #[doc = "0: CPU is not in lockup"]
45 Awake = 0,
46 #[doc = "1: CPU is in lockup"]
47 Sleeping = 1,
48}
49impl From<Cpu0lockup> for bool {
50 #[inline(always)]
51 fn from(variant: Cpu0lockup) -> Self {
52 variant as u8 != 0
53 }
54}
55#[doc = "Field `CPU0LOCKUP` reader - CPU0 lockup state"]
56pub type Cpu0lockupR = crate::BitReader<Cpu0lockup>;
57impl Cpu0lockupR {
58 #[doc = "Get enumerated values variant"]
59 #[inline(always)]
60 pub const fn variant(&self) -> Cpu0lockup {
61 match self.bits {
62 false => Cpu0lockup::Awake,
63 true => Cpu0lockup::Sleeping,
64 }
65 }
66 #[doc = "CPU is not in lockup"]
67 #[inline(always)]
68 pub fn is_awake(&self) -> bool {
69 *self == Cpu0lockup::Awake
70 }
71 #[doc = "CPU is in lockup"]
72 #[inline(always)]
73 pub fn is_sleeping(&self) -> bool {
74 *self == Cpu0lockup::Sleeping
75 }
76}
77impl R {
78 #[doc = "Bit 0 - CPU0 sleeping state"]
79 #[inline(always)]
80 pub fn cpu0sleeping(&self) -> Cpu0sleepingR {
81 Cpu0sleepingR::new((self.bits & 1) != 0)
82 }
83 #[doc = "Bit 2 - CPU0 lockup state"]
84 #[inline(always)]
85 pub fn cpu0lockup(&self) -> Cpu0lockupR {
86 Cpu0lockupR::new(((self.bits >> 2) & 1) != 0)
87 }
88}
89#[cfg(feature = "debug")]
90impl core::fmt::Debug for R {
91 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
92 f.debug_struct("CPUSTAT")
93 .field("cpu0sleeping", &self.cpu0sleeping())
94 .field("cpu0lockup", &self.cpu0lockup())
95 .finish()
96 }
97}
98#[doc = "CPU Status\n\nYou can [`read`](crate::Reg::read) this register and get [`cpustat::R`](R). See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
99pub struct CpustatSpec;
100impl crate::RegisterSpec for CpustatSpec {
101 type Ux = u32;
102}
103#[doc = "`read()` method returns [`cpustat::R`](R) reader structure"]
104impl crate::Readable for CpustatSpec {}
105#[doc = "`reset()` method sets CPUSTAT to value 0"]
106impl crate::Resettable for CpustatSpec {}