lpc550x/syscon/
cpstat.rs

1#[doc = "Register `CPSTAT` reader"]
2pub struct R(crate::R<CPSTAT_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<CPSTAT_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<CPSTAT_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<CPSTAT_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `CPSTAT` writer"]
17pub struct W(crate::W<CPSTAT_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<CPSTAT_SPEC>;
20    #[inline(always)]
21    fn deref(&self) -> &Self::Target {
22        &self.0
23    }
24}
25impl core::ops::DerefMut for W {
26    #[inline(always)]
27    fn deref_mut(&mut self) -> &mut Self::Target {
28        &mut self.0
29    }
30}
31impl From<crate::W<CPSTAT_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<CPSTAT_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `CPU0SLEEPING` reader - The CPU0 sleeping state."]
38pub type CPU0SLEEPING_R = crate::BitReader<CPU0SLEEPING_A>;
39#[doc = "The CPU0 sleeping state.\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41pub enum CPU0SLEEPING_A {
42    #[doc = "0: the CPU is not sleeping."]
43    AWAKE = 0,
44    #[doc = "1: the CPU is sleeping."]
45    SLEEPING = 1,
46}
47impl From<CPU0SLEEPING_A> for bool {
48    #[inline(always)]
49    fn from(variant: CPU0SLEEPING_A) -> Self {
50        variant as u8 != 0
51    }
52}
53impl CPU0SLEEPING_R {
54    #[doc = "Get enumerated values variant"]
55    #[inline(always)]
56    pub fn variant(&self) -> CPU0SLEEPING_A {
57        match self.bits {
58            false => CPU0SLEEPING_A::AWAKE,
59            true => CPU0SLEEPING_A::SLEEPING,
60        }
61    }
62    #[doc = "Checks if the value of the field is `AWAKE`"]
63    #[inline(always)]
64    pub fn is_awake(&self) -> bool {
65        *self == CPU0SLEEPING_A::AWAKE
66    }
67    #[doc = "Checks if the value of the field is `SLEEPING`"]
68    #[inline(always)]
69    pub fn is_sleeping(&self) -> bool {
70        *self == CPU0SLEEPING_A::SLEEPING
71    }
72}
73#[doc = "Field `CPU0LOCKUP` reader - The CPU0 lockup state."]
74pub type CPU0LOCKUP_R = crate::BitReader<CPU0LOCKUP_A>;
75#[doc = "The CPU0 lockup state.\n\nValue on reset: 0"]
76#[derive(Clone, Copy, Debug, PartialEq, Eq)]
77pub enum CPU0LOCKUP_A {
78    #[doc = "0: the CPU is not in lockup."]
79    AWAKE = 0,
80    #[doc = "1: the CPU is in lockup."]
81    SLEEPING = 1,
82}
83impl From<CPU0LOCKUP_A> for bool {
84    #[inline(always)]
85    fn from(variant: CPU0LOCKUP_A) -> Self {
86        variant as u8 != 0
87    }
88}
89impl CPU0LOCKUP_R {
90    #[doc = "Get enumerated values variant"]
91    #[inline(always)]
92    pub fn variant(&self) -> CPU0LOCKUP_A {
93        match self.bits {
94            false => CPU0LOCKUP_A::AWAKE,
95            true => CPU0LOCKUP_A::SLEEPING,
96        }
97    }
98    #[doc = "Checks if the value of the field is `AWAKE`"]
99    #[inline(always)]
100    pub fn is_awake(&self) -> bool {
101        *self == CPU0LOCKUP_A::AWAKE
102    }
103    #[doc = "Checks if the value of the field is `SLEEPING`"]
104    #[inline(always)]
105    pub fn is_sleeping(&self) -> bool {
106        *self == CPU0LOCKUP_A::SLEEPING
107    }
108}
109impl R {
110    #[doc = "Bit 0 - The CPU0 sleeping state."]
111    #[inline(always)]
112    pub fn cpu0sleeping(&self) -> CPU0SLEEPING_R {
113        CPU0SLEEPING_R::new((self.bits & 1) != 0)
114    }
115    #[doc = "Bit 2 - The CPU0 lockup state."]
116    #[inline(always)]
117    pub fn cpu0lockup(&self) -> CPU0LOCKUP_R {
118        CPU0LOCKUP_R::new(((self.bits >> 2) & 1) != 0)
119    }
120}
121impl W {
122    #[doc = "Writes raw bits to the register."]
123    #[inline(always)]
124    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
125        self.0.bits(bits);
126        self
127    }
128}
129#[doc = "CPU Status.\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [cpstat](index.html) module"]
130pub struct CPSTAT_SPEC;
131impl crate::RegisterSpec for CPSTAT_SPEC {
132    type Ux = u32;
133}
134#[doc = "`read()` method returns [cpstat::R](R) reader structure"]
135impl crate::Readable for CPSTAT_SPEC {
136    type Reader = R;
137}
138#[doc = "`write(|w| ..)` method takes [cpstat::W](W) writer structure"]
139impl crate::Writable for CPSTAT_SPEC {
140    type Writer = W;
141}
142#[doc = "`reset()` method sets CPSTAT to value 0"]
143impl crate::Resettable for CPSTAT_SPEC {
144    #[inline(always)]
145    fn reset_value() -> Self::Ux {
146        0
147    }
148}