efm32tg11b120_pac/trng0/
control.rs

1#[doc = "Register `CONTROL` reader"]
2pub struct R(crate::R<CONTROL_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<CONTROL_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<CONTROL_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<CONTROL_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `CONTROL` writer"]
17pub struct W(crate::W<CONTROL_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<CONTROL_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<CONTROL_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<CONTROL_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `ENABLE` reader - TRNG Module Enable"]
38pub type ENABLE_R = crate::BitReader<bool>;
39#[doc = "Field `ENABLE` writer - TRNG Module Enable"]
40pub type ENABLE_W<'a> = crate::BitWriter<'a, u32, CONTROL_SPEC, bool, 0>;
41#[doc = "Field `TESTEN` reader - Test Enable"]
42pub type TESTEN_R = crate::BitReader<bool>;
43#[doc = "Field `TESTEN` writer - Test Enable"]
44pub type TESTEN_W<'a> = crate::BitWriter<'a, u32, CONTROL_SPEC, bool, 2>;
45#[doc = "Field `CONDBYPASS` reader - Conditioning Bypass"]
46pub type CONDBYPASS_R = crate::BitReader<bool>;
47#[doc = "Field `CONDBYPASS` writer - Conditioning Bypass"]
48pub type CONDBYPASS_W<'a> = crate::BitWriter<'a, u32, CONTROL_SPEC, bool, 3>;
49#[doc = "Field `REPCOUNTIEN` reader - Interrupt Enable for Repetition Count Test Failure"]
50pub type REPCOUNTIEN_R = crate::BitReader<bool>;
51#[doc = "Field `REPCOUNTIEN` writer - Interrupt Enable for Repetition Count Test Failure"]
52pub type REPCOUNTIEN_W<'a> = crate::BitWriter<'a, u32, CONTROL_SPEC, bool, 4>;
53#[doc = "Field `APT64IEN` reader - Interrupt Enable for Adaptive Proportion Test Failure (64-sample Window)"]
54pub type APT64IEN_R = crate::BitReader<bool>;
55#[doc = "Field `APT64IEN` writer - Interrupt Enable for Adaptive Proportion Test Failure (64-sample Window)"]
56pub type APT64IEN_W<'a> = crate::BitWriter<'a, u32, CONTROL_SPEC, bool, 5>;
57#[doc = "Field `APT4096IEN` reader - Interrupt Enable for Adaptive Proportion Test Failure (4096-sample Window)"]
58pub type APT4096IEN_R = crate::BitReader<bool>;
59#[doc = "Field `APT4096IEN` writer - Interrupt Enable for Adaptive Proportion Test Failure (4096-sample Window)"]
60pub type APT4096IEN_W<'a> = crate::BitWriter<'a, u32, CONTROL_SPEC, bool, 6>;
61#[doc = "Field `FULLIEN` reader - Interrupt Enable for FIFO Full"]
62pub type FULLIEN_R = crate::BitReader<bool>;
63#[doc = "Field `FULLIEN` writer - Interrupt Enable for FIFO Full"]
64pub type FULLIEN_W<'a> = crate::BitWriter<'a, u32, CONTROL_SPEC, bool, 7>;
65#[doc = "Field `SOFTRESET` reader - Software Reset"]
66pub type SOFTRESET_R = crate::BitReader<bool>;
67#[doc = "Field `SOFTRESET` writer - Software Reset"]
68pub type SOFTRESET_W<'a> = crate::BitWriter<'a, u32, CONTROL_SPEC, bool, 8>;
69#[doc = "Field `PREIEN` reader - Interrupt enable for AIS31 preliminary noise alarm"]
70pub type PREIEN_R = crate::BitReader<bool>;
71#[doc = "Field `PREIEN` writer - Interrupt enable for AIS31 preliminary noise alarm"]
72pub type PREIEN_W<'a> = crate::BitWriter<'a, u32, CONTROL_SPEC, bool, 9>;
73#[doc = "Field `ALMIEN` reader - Interrupt enable for AIS31 noise alarm"]
74pub type ALMIEN_R = crate::BitReader<bool>;
75#[doc = "Field `ALMIEN` writer - Interrupt enable for AIS31 noise alarm"]
76pub type ALMIEN_W<'a> = crate::BitWriter<'a, u32, CONTROL_SPEC, bool, 10>;
77#[doc = "Field `FORCERUN` reader - Oscillator Force Run"]
78pub type FORCERUN_R = crate::BitReader<bool>;
79#[doc = "Field `FORCERUN` writer - Oscillator Force Run"]
80pub type FORCERUN_W<'a> = crate::BitWriter<'a, u32, CONTROL_SPEC, bool, 11>;
81#[doc = "Field `BYPNIST` reader - NIST Start-up Test Bypass."]
82pub type BYPNIST_R = crate::BitReader<bool>;
83#[doc = "Field `BYPNIST` writer - NIST Start-up Test Bypass."]
84pub type BYPNIST_W<'a> = crate::BitWriter<'a, u32, CONTROL_SPEC, bool, 12>;
85#[doc = "Field `BYPAIS31` reader - AIS31 Start-up Test Bypass."]
86pub type BYPAIS31_R = crate::BitReader<bool>;
87#[doc = "Field `BYPAIS31` writer - AIS31 Start-up Test Bypass."]
88pub type BYPAIS31_W<'a> = crate::BitWriter<'a, u32, CONTROL_SPEC, bool, 13>;
89impl R {
90    #[doc = "Bit 0 - TRNG Module Enable"]
91    #[inline(always)]
92    pub fn enable(&self) -> ENABLE_R {
93        ENABLE_R::new((self.bits & 1) != 0)
94    }
95    #[doc = "Bit 2 - Test Enable"]
96    #[inline(always)]
97    pub fn testen(&self) -> TESTEN_R {
98        TESTEN_R::new(((self.bits >> 2) & 1) != 0)
99    }
100    #[doc = "Bit 3 - Conditioning Bypass"]
101    #[inline(always)]
102    pub fn condbypass(&self) -> CONDBYPASS_R {
103        CONDBYPASS_R::new(((self.bits >> 3) & 1) != 0)
104    }
105    #[doc = "Bit 4 - Interrupt Enable for Repetition Count Test Failure"]
106    #[inline(always)]
107    pub fn repcountien(&self) -> REPCOUNTIEN_R {
108        REPCOUNTIEN_R::new(((self.bits >> 4) & 1) != 0)
109    }
110    #[doc = "Bit 5 - Interrupt Enable for Adaptive Proportion Test Failure (64-sample Window)"]
111    #[inline(always)]
112    pub fn apt64ien(&self) -> APT64IEN_R {
113        APT64IEN_R::new(((self.bits >> 5) & 1) != 0)
114    }
115    #[doc = "Bit 6 - Interrupt Enable for Adaptive Proportion Test Failure (4096-sample Window)"]
116    #[inline(always)]
117    pub fn apt4096ien(&self) -> APT4096IEN_R {
118        APT4096IEN_R::new(((self.bits >> 6) & 1) != 0)
119    }
120    #[doc = "Bit 7 - Interrupt Enable for FIFO Full"]
121    #[inline(always)]
122    pub fn fullien(&self) -> FULLIEN_R {
123        FULLIEN_R::new(((self.bits >> 7) & 1) != 0)
124    }
125    #[doc = "Bit 8 - Software Reset"]
126    #[inline(always)]
127    pub fn softreset(&self) -> SOFTRESET_R {
128        SOFTRESET_R::new(((self.bits >> 8) & 1) != 0)
129    }
130    #[doc = "Bit 9 - Interrupt enable for AIS31 preliminary noise alarm"]
131    #[inline(always)]
132    pub fn preien(&self) -> PREIEN_R {
133        PREIEN_R::new(((self.bits >> 9) & 1) != 0)
134    }
135    #[doc = "Bit 10 - Interrupt enable for AIS31 noise alarm"]
136    #[inline(always)]
137    pub fn almien(&self) -> ALMIEN_R {
138        ALMIEN_R::new(((self.bits >> 10) & 1) != 0)
139    }
140    #[doc = "Bit 11 - Oscillator Force Run"]
141    #[inline(always)]
142    pub fn forcerun(&self) -> FORCERUN_R {
143        FORCERUN_R::new(((self.bits >> 11) & 1) != 0)
144    }
145    #[doc = "Bit 12 - NIST Start-up Test Bypass."]
146    #[inline(always)]
147    pub fn bypnist(&self) -> BYPNIST_R {
148        BYPNIST_R::new(((self.bits >> 12) & 1) != 0)
149    }
150    #[doc = "Bit 13 - AIS31 Start-up Test Bypass."]
151    #[inline(always)]
152    pub fn bypais31(&self) -> BYPAIS31_R {
153        BYPAIS31_R::new(((self.bits >> 13) & 1) != 0)
154    }
155}
156impl W {
157    #[doc = "Bit 0 - TRNG Module Enable"]
158    #[inline(always)]
159    pub fn enable(&mut self) -> ENABLE_W {
160        ENABLE_W::new(self)
161    }
162    #[doc = "Bit 2 - Test Enable"]
163    #[inline(always)]
164    pub fn testen(&mut self) -> TESTEN_W {
165        TESTEN_W::new(self)
166    }
167    #[doc = "Bit 3 - Conditioning Bypass"]
168    #[inline(always)]
169    pub fn condbypass(&mut self) -> CONDBYPASS_W {
170        CONDBYPASS_W::new(self)
171    }
172    #[doc = "Bit 4 - Interrupt Enable for Repetition Count Test Failure"]
173    #[inline(always)]
174    pub fn repcountien(&mut self) -> REPCOUNTIEN_W {
175        REPCOUNTIEN_W::new(self)
176    }
177    #[doc = "Bit 5 - Interrupt Enable for Adaptive Proportion Test Failure (64-sample Window)"]
178    #[inline(always)]
179    pub fn apt64ien(&mut self) -> APT64IEN_W {
180        APT64IEN_W::new(self)
181    }
182    #[doc = "Bit 6 - Interrupt Enable for Adaptive Proportion Test Failure (4096-sample Window)"]
183    #[inline(always)]
184    pub fn apt4096ien(&mut self) -> APT4096IEN_W {
185        APT4096IEN_W::new(self)
186    }
187    #[doc = "Bit 7 - Interrupt Enable for FIFO Full"]
188    #[inline(always)]
189    pub fn fullien(&mut self) -> FULLIEN_W {
190        FULLIEN_W::new(self)
191    }
192    #[doc = "Bit 8 - Software Reset"]
193    #[inline(always)]
194    pub fn softreset(&mut self) -> SOFTRESET_W {
195        SOFTRESET_W::new(self)
196    }
197    #[doc = "Bit 9 - Interrupt enable for AIS31 preliminary noise alarm"]
198    #[inline(always)]
199    pub fn preien(&mut self) -> PREIEN_W {
200        PREIEN_W::new(self)
201    }
202    #[doc = "Bit 10 - Interrupt enable for AIS31 noise alarm"]
203    #[inline(always)]
204    pub fn almien(&mut self) -> ALMIEN_W {
205        ALMIEN_W::new(self)
206    }
207    #[doc = "Bit 11 - Oscillator Force Run"]
208    #[inline(always)]
209    pub fn forcerun(&mut self) -> FORCERUN_W {
210        FORCERUN_W::new(self)
211    }
212    #[doc = "Bit 12 - NIST Start-up Test Bypass."]
213    #[inline(always)]
214    pub fn bypnist(&mut self) -> BYPNIST_W {
215        BYPNIST_W::new(self)
216    }
217    #[doc = "Bit 13 - AIS31 Start-up Test Bypass."]
218    #[inline(always)]
219    pub fn bypais31(&mut self) -> BYPAIS31_W {
220        BYPAIS31_W::new(self)
221    }
222    #[doc = "Writes raw bits to the register."]
223    #[inline(always)]
224    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
225        self.0.bits(bits);
226        self
227    }
228}
229#[doc = "Main Control Register\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 [control](index.html) module"]
230pub struct CONTROL_SPEC;
231impl crate::RegisterSpec for CONTROL_SPEC {
232    type Ux = u32;
233}
234#[doc = "`read()` method returns [control::R](R) reader structure"]
235impl crate::Readable for CONTROL_SPEC {
236    type Reader = R;
237}
238#[doc = "`write(|w| ..)` method takes [control::W](W) writer structure"]
239impl crate::Writable for CONTROL_SPEC {
240    type Writer = W;
241}
242#[doc = "`reset()` method sets CONTROL to value 0"]
243impl crate::Resettable for CONTROL_SPEC {
244    #[inline(always)]
245    fn reset_value() -> Self::Ux {
246        0
247    }
248}