1#[doc = "Register `CKSTAT` reader"]
2pub type R = crate::R<CkstatSpec>;
3#[doc = "Register `CKSTAT` writer"]
4pub type W = crate::W<CkstatSpec>;
5#[doc = "Low Power Status\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8#[repr(u8)]
9pub enum Ckmode {
10 #[doc = "0: Core clock is on"]
11 Ckmode0000 = 0,
12 #[doc = "1: Core clock is off"]
13 Ckmode0001 = 1,
14 #[doc = "15: Core, platform, and peripheral clocks are off, and core enters Low-Power mode"]
15 Ckmode1111 = 15,
16}
17impl From<Ckmode> for u8 {
18 #[inline(always)]
19 fn from(variant: Ckmode) -> Self {
20 variant as _
21 }
22}
23impl crate::FieldSpec for Ckmode {
24 type Ux = u8;
25}
26impl crate::IsEnum for Ckmode {}
27#[doc = "Field `CKMODE` reader - Low Power Status"]
28pub type CkmodeR = crate::FieldReader<Ckmode>;
29impl CkmodeR {
30 #[doc = "Get enumerated values variant"]
31 #[inline(always)]
32 pub const fn variant(&self) -> Option<Ckmode> {
33 match self.bits {
34 0 => Some(Ckmode::Ckmode0000),
35 1 => Some(Ckmode::Ckmode0001),
36 15 => Some(Ckmode::Ckmode1111),
37 _ => None,
38 }
39 }
40 #[doc = "Core clock is on"]
41 #[inline(always)]
42 pub fn is_ckmode0000(&self) -> bool {
43 *self == Ckmode::Ckmode0000
44 }
45 #[doc = "Core clock is off"]
46 #[inline(always)]
47 pub fn is_ckmode0001(&self) -> bool {
48 *self == Ckmode::Ckmode0001
49 }
50 #[doc = "Core, platform, and peripheral clocks are off, and core enters Low-Power mode"]
51 #[inline(always)]
52 pub fn is_ckmode1111(&self) -> bool {
53 *self == Ckmode::Ckmode1111
54 }
55}
56#[doc = "Field `WAKEUP` reader - Wake-up Source"]
57pub type WakeupR = crate::FieldReader;
58#[doc = "Clock Status Valid\n\nValue on reset: 0"]
59#[cfg_attr(feature = "defmt", derive(defmt::Format))]
60#[derive(Clone, Copy, Debug, PartialEq, Eq)]
61pub enum Valid {
62 #[doc = "0: Core clock not gated"]
63 Disabled = 0,
64 #[doc = "1: Core clock was gated due to Low-Power mode entry"]
65 Enabled = 1,
66}
67impl From<Valid> for bool {
68 #[inline(always)]
69 fn from(variant: Valid) -> Self {
70 variant as u8 != 0
71 }
72}
73#[doc = "Field `VALID` reader - Clock Status Valid"]
74pub type ValidR = crate::BitReader<Valid>;
75impl ValidR {
76 #[doc = "Get enumerated values variant"]
77 #[inline(always)]
78 pub const fn variant(&self) -> Valid {
79 match self.bits {
80 false => Valid::Disabled,
81 true => Valid::Enabled,
82 }
83 }
84 #[doc = "Core clock not gated"]
85 #[inline(always)]
86 pub fn is_disabled(&self) -> bool {
87 *self == Valid::Disabled
88 }
89 #[doc = "Core clock was gated due to Low-Power mode entry"]
90 #[inline(always)]
91 pub fn is_enabled(&self) -> bool {
92 *self == Valid::Enabled
93 }
94}
95#[doc = "Field `VALID` writer - Clock Status Valid"]
96pub type ValidW<'a, REG> = crate::BitWriter1C<'a, REG, Valid>;
97impl<'a, REG> ValidW<'a, REG>
98where
99 REG: crate::Writable + crate::RegisterSpec,
100{
101 #[doc = "Core clock not gated"]
102 #[inline(always)]
103 pub fn disabled(self) -> &'a mut crate::W<REG> {
104 self.variant(Valid::Disabled)
105 }
106 #[doc = "Core clock was gated due to Low-Power mode entry"]
107 #[inline(always)]
108 pub fn enabled(self) -> &'a mut crate::W<REG> {
109 self.variant(Valid::Enabled)
110 }
111}
112impl R {
113 #[doc = "Bits 0:3 - Low Power Status"]
114 #[inline(always)]
115 pub fn ckmode(&self) -> CkmodeR {
116 CkmodeR::new((self.bits & 0x0f) as u8)
117 }
118 #[doc = "Bits 8:15 - Wake-up Source"]
119 #[inline(always)]
120 pub fn wakeup(&self) -> WakeupR {
121 WakeupR::new(((self.bits >> 8) & 0xff) as u8)
122 }
123 #[doc = "Bit 31 - Clock Status Valid"]
124 #[inline(always)]
125 pub fn valid(&self) -> ValidR {
126 ValidR::new(((self.bits >> 31) & 1) != 0)
127 }
128}
129#[cfg(feature = "debug")]
130impl core::fmt::Debug for R {
131 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
132 f.debug_struct("CKSTAT")
133 .field("ckmode", &self.ckmode())
134 .field("wakeup", &self.wakeup())
135 .field("valid", &self.valid())
136 .finish()
137 }
138}
139impl W {
140 #[doc = "Bit 31 - Clock Status Valid"]
141 #[inline(always)]
142 pub fn valid(&mut self) -> ValidW<'_, CkstatSpec> {
143 ValidW::new(self, 31)
144 }
145}
146#[doc = "Clock Status\n\nYou can [`read`](crate::Reg::read) this register and get [`ckstat::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`ckstat::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
147pub struct CkstatSpec;
148impl crate::RegisterSpec for CkstatSpec {
149 type Ux = u32;
150}
151#[doc = "`read()` method returns [`ckstat::R`](R) reader structure"]
152impl crate::Readable for CkstatSpec {}
153#[doc = "`write(|w| ..)` method takes [`ckstat::W`](W) writer structure"]
154impl crate::Writable for CkstatSpec {
155 type Safety = crate::Unsafe;
156 const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0x8000_0000;
157}
158#[doc = "`reset()` method sets CKSTAT to value 0"]
159impl crate::Resettable for CkstatSpec {}