xmc4700/scu_pll/
usbpllstat.rs

1#[doc = "Register `USBPLLSTAT` reader"]
2pub type R = crate::R<USBPLLSTAT_SPEC>;
3#[doc = "VCO Bypass Status\n\nValue on reset: 0"]
4#[derive(Clone, Copy, Debug, PartialEq, Eq)]
5pub enum VCOBYST_A {
6    #[doc = "0: Normal Mode is entered"]
7    VALUE1 = 0,
8    #[doc = "1: Prescaler Mode is entered"]
9    VALUE2 = 1,
10}
11impl From<VCOBYST_A> for bool {
12    #[inline(always)]
13    fn from(variant: VCOBYST_A) -> Self {
14        variant as u8 != 0
15    }
16}
17#[doc = "Field `VCOBYST` reader - VCO Bypass Status"]
18pub type VCOBYST_R = crate::BitReader<VCOBYST_A>;
19impl VCOBYST_R {
20    #[doc = "Get enumerated values variant"]
21    #[inline(always)]
22    pub const fn variant(&self) -> VCOBYST_A {
23        match self.bits {
24            false => VCOBYST_A::VALUE1,
25            true => VCOBYST_A::VALUE2,
26        }
27    }
28    #[doc = "Normal Mode is entered"]
29    #[inline(always)]
30    pub fn is_value1(&self) -> bool {
31        *self == VCOBYST_A::VALUE1
32    }
33    #[doc = "Prescaler Mode is entered"]
34    #[inline(always)]
35    pub fn is_value2(&self) -> bool {
36        *self == VCOBYST_A::VALUE2
37    }
38}
39#[doc = "PLL Power-saving Mode Status\n\nValue on reset: 1"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41pub enum PWDSTAT_A {
42    #[doc = "0: PLL Power-saving Mode was not entered"]
43    VALUE1 = 0,
44    #[doc = "1: PLL Power-saving Mode was entered"]
45    VALUE2 = 1,
46}
47impl From<PWDSTAT_A> for bool {
48    #[inline(always)]
49    fn from(variant: PWDSTAT_A) -> Self {
50        variant as u8 != 0
51    }
52}
53#[doc = "Field `PWDSTAT` reader - PLL Power-saving Mode Status"]
54pub type PWDSTAT_R = crate::BitReader<PWDSTAT_A>;
55impl PWDSTAT_R {
56    #[doc = "Get enumerated values variant"]
57    #[inline(always)]
58    pub const fn variant(&self) -> PWDSTAT_A {
59        match self.bits {
60            false => PWDSTAT_A::VALUE1,
61            true => PWDSTAT_A::VALUE2,
62        }
63    }
64    #[doc = "PLL Power-saving Mode was not entered"]
65    #[inline(always)]
66    pub fn is_value1(&self) -> bool {
67        *self == PWDSTAT_A::VALUE1
68    }
69    #[doc = "PLL Power-saving Mode was entered"]
70    #[inline(always)]
71    pub fn is_value2(&self) -> bool {
72        *self == PWDSTAT_A::VALUE2
73    }
74}
75#[doc = "PLL VCO Lock Status\n\nValue on reset: 0"]
76#[derive(Clone, Copy, Debug, PartialEq, Eq)]
77pub enum VCOLOCK_A {
78    #[doc = "0: The frequency difference of fREF and fDIV is greater than allowed. The VCO part of the PLL can not lock on a target frequency."]
79    VALUE1 = 0,
80    #[doc = "1: The frequency difference of fREF and fDIV is small enough to enable a stable VCO operation"]
81    VALUE2 = 1,
82}
83impl From<VCOLOCK_A> for bool {
84    #[inline(always)]
85    fn from(variant: VCOLOCK_A) -> Self {
86        variant as u8 != 0
87    }
88}
89#[doc = "Field `VCOLOCK` reader - PLL VCO Lock Status"]
90pub type VCOLOCK_R = crate::BitReader<VCOLOCK_A>;
91impl VCOLOCK_R {
92    #[doc = "Get enumerated values variant"]
93    #[inline(always)]
94    pub const fn variant(&self) -> VCOLOCK_A {
95        match self.bits {
96            false => VCOLOCK_A::VALUE1,
97            true => VCOLOCK_A::VALUE2,
98        }
99    }
100    #[doc = "The frequency difference of fREF and fDIV is greater than allowed. The VCO part of the PLL can not lock on a target frequency."]
101    #[inline(always)]
102    pub fn is_value1(&self) -> bool {
103        *self == VCOLOCK_A::VALUE1
104    }
105    #[doc = "The frequency difference of fREF and fDIV is small enough to enable a stable VCO operation"]
106    #[inline(always)]
107    pub fn is_value2(&self) -> bool {
108        *self == VCOLOCK_A::VALUE2
109    }
110}
111#[doc = "Bypass Mode Status\n\nValue on reset: 0"]
112#[derive(Clone, Copy, Debug, PartialEq, Eq)]
113pub enum BY_A {
114    #[doc = "0: Bypass Mode is not entered"]
115    VALUE1 = 0,
116    #[doc = "1: Bypass Mode is entered. Input fOSC is selected as output fPLL."]
117    VALUE2 = 1,
118}
119impl From<BY_A> for bool {
120    #[inline(always)]
121    fn from(variant: BY_A) -> Self {
122        variant as u8 != 0
123    }
124}
125#[doc = "Field `BY` reader - Bypass Mode Status"]
126pub type BY_R = crate::BitReader<BY_A>;
127impl BY_R {
128    #[doc = "Get enumerated values variant"]
129    #[inline(always)]
130    pub const fn variant(&self) -> BY_A {
131        match self.bits {
132            false => BY_A::VALUE1,
133            true => BY_A::VALUE2,
134        }
135    }
136    #[doc = "Bypass Mode is not entered"]
137    #[inline(always)]
138    pub fn is_value1(&self) -> bool {
139        *self == BY_A::VALUE1
140    }
141    #[doc = "Bypass Mode is entered. Input fOSC is selected as output fPLL."]
142    #[inline(always)]
143    pub fn is_value2(&self) -> bool {
144        *self == BY_A::VALUE2
145    }
146}
147#[doc = "PLL LOCK Status\n\nValue on reset: 0"]
148#[derive(Clone, Copy, Debug, PartialEq, Eq)]
149pub enum VCOLOCKED_A {
150    #[doc = "0: PLL not locked"]
151    VALUE1 = 0,
152    #[doc = "1: PLL locked"]
153    VALUE2 = 1,
154}
155impl From<VCOLOCKED_A> for bool {
156    #[inline(always)]
157    fn from(variant: VCOLOCKED_A) -> Self {
158        variant as u8 != 0
159    }
160}
161#[doc = "Field `VCOLOCKED` reader - PLL LOCK Status"]
162pub type VCOLOCKED_R = crate::BitReader<VCOLOCKED_A>;
163impl VCOLOCKED_R {
164    #[doc = "Get enumerated values variant"]
165    #[inline(always)]
166    pub const fn variant(&self) -> VCOLOCKED_A {
167        match self.bits {
168            false => VCOLOCKED_A::VALUE1,
169            true => VCOLOCKED_A::VALUE2,
170        }
171    }
172    #[doc = "PLL not locked"]
173    #[inline(always)]
174    pub fn is_value1(&self) -> bool {
175        *self == VCOLOCKED_A::VALUE1
176    }
177    #[doc = "PLL locked"]
178    #[inline(always)]
179    pub fn is_value2(&self) -> bool {
180        *self == VCOLOCKED_A::VALUE2
181    }
182}
183impl R {
184    #[doc = "Bit 0 - VCO Bypass Status"]
185    #[inline(always)]
186    pub fn vcobyst(&self) -> VCOBYST_R {
187        VCOBYST_R::new((self.bits & 1) != 0)
188    }
189    #[doc = "Bit 1 - PLL Power-saving Mode Status"]
190    #[inline(always)]
191    pub fn pwdstat(&self) -> PWDSTAT_R {
192        PWDSTAT_R::new(((self.bits >> 1) & 1) != 0)
193    }
194    #[doc = "Bit 2 - PLL VCO Lock Status"]
195    #[inline(always)]
196    pub fn vcolock(&self) -> VCOLOCK_R {
197        VCOLOCK_R::new(((self.bits >> 2) & 1) != 0)
198    }
199    #[doc = "Bit 6 - Bypass Mode Status"]
200    #[inline(always)]
201    pub fn by(&self) -> BY_R {
202        BY_R::new(((self.bits >> 6) & 1) != 0)
203    }
204    #[doc = "Bit 7 - PLL LOCK Status"]
205    #[inline(always)]
206    pub fn vcolocked(&self) -> VCOLOCKED_R {
207        VCOLOCKED_R::new(((self.bits >> 7) & 1) != 0)
208    }
209}
210#[doc = "USB PLL Status Register\n\nYou can [`read`](crate::Reg::read) this register and get [`usbpllstat::R`](R). See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
211pub struct USBPLLSTAT_SPEC;
212impl crate::RegisterSpec for USBPLLSTAT_SPEC {
213    type Ux = u32;
214}
215#[doc = "`read()` method returns [`usbpllstat::R`](R) reader structure"]
216impl crate::Readable for USBPLLSTAT_SPEC {}
217#[doc = "`reset()` method sets USBPLLSTAT to value 0x02"]
218impl crate::Resettable for USBPLLSTAT_SPEC {
219    const RESET_VALUE: u32 = 0x02;
220}