efm32tg11b_pac/efm32tg11b540/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, const O: u8> = crate::BitWriter<'a, u32, CONTROL_SPEC, bool, O>;
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, const O: u8> = crate::BitWriter<'a, u32, CONTROL_SPEC, bool, O>;
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, const O: u8> = crate::BitWriter<'a, u32, CONTROL_SPEC, bool, O>;
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, const O: u8> = crate::BitWriter<'a, u32, CONTROL_SPEC, bool, O>;
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, const O: u8> = crate::BitWriter<'a, u32, CONTROL_SPEC, bool, O>;
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, const O: u8> = crate::BitWriter<'a, u32, CONTROL_SPEC, bool, O>;
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, const O: u8> = crate::BitWriter<'a, u32, CONTROL_SPEC, bool, O>;
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, const O: u8> = crate::BitWriter<'a, u32, CONTROL_SPEC, bool, O>;
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, const O: u8> = crate::BitWriter<'a, u32, CONTROL_SPEC, bool, O>;
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, const O: u8> = crate::BitWriter<'a, u32, CONTROL_SPEC, bool, O>;
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, const O: u8> = crate::BitWriter<'a, u32, CONTROL_SPEC, bool, O>;
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, const O: u8> = crate::BitWriter<'a, u32, CONTROL_SPEC, bool, O>;
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, const O: u8> = crate::BitWriter<'a, u32, CONTROL_SPEC, bool, O>;
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    #[must_use]
160    pub fn enable(&mut self) -> ENABLE_W<0> {
161        ENABLE_W::new(self)
162    }
163    #[doc = "Bit 2 - Test Enable"]
164    #[inline(always)]
165    #[must_use]
166    pub fn testen(&mut self) -> TESTEN_W<2> {
167        TESTEN_W::new(self)
168    }
169    #[doc = "Bit 3 - Conditioning Bypass"]
170    #[inline(always)]
171    #[must_use]
172    pub fn condbypass(&mut self) -> CONDBYPASS_W<3> {
173        CONDBYPASS_W::new(self)
174    }
175    #[doc = "Bit 4 - Interrupt Enable for Repetition Count Test Failure"]
176    #[inline(always)]
177    #[must_use]
178    pub fn repcountien(&mut self) -> REPCOUNTIEN_W<4> {
179        REPCOUNTIEN_W::new(self)
180    }
181    #[doc = "Bit 5 - Interrupt Enable for Adaptive Proportion Test Failure (64-sample Window)"]
182    #[inline(always)]
183    #[must_use]
184    pub fn apt64ien(&mut self) -> APT64IEN_W<5> {
185        APT64IEN_W::new(self)
186    }
187    #[doc = "Bit 6 - Interrupt Enable for Adaptive Proportion Test Failure (4096-sample Window)"]
188    #[inline(always)]
189    #[must_use]
190    pub fn apt4096ien(&mut self) -> APT4096IEN_W<6> {
191        APT4096IEN_W::new(self)
192    }
193    #[doc = "Bit 7 - Interrupt Enable for FIFO Full"]
194    #[inline(always)]
195    #[must_use]
196    pub fn fullien(&mut self) -> FULLIEN_W<7> {
197        FULLIEN_W::new(self)
198    }
199    #[doc = "Bit 8 - Software Reset"]
200    #[inline(always)]
201    #[must_use]
202    pub fn softreset(&mut self) -> SOFTRESET_W<8> {
203        SOFTRESET_W::new(self)
204    }
205    #[doc = "Bit 9 - Interrupt enable for AIS31 preliminary noise alarm"]
206    #[inline(always)]
207    #[must_use]
208    pub fn preien(&mut self) -> PREIEN_W<9> {
209        PREIEN_W::new(self)
210    }
211    #[doc = "Bit 10 - Interrupt enable for AIS31 noise alarm"]
212    #[inline(always)]
213    #[must_use]
214    pub fn almien(&mut self) -> ALMIEN_W<10> {
215        ALMIEN_W::new(self)
216    }
217    #[doc = "Bit 11 - Oscillator Force Run"]
218    #[inline(always)]
219    #[must_use]
220    pub fn forcerun(&mut self) -> FORCERUN_W<11> {
221        FORCERUN_W::new(self)
222    }
223    #[doc = "Bit 12 - NIST Start-up Test Bypass."]
224    #[inline(always)]
225    #[must_use]
226    pub fn bypnist(&mut self) -> BYPNIST_W<12> {
227        BYPNIST_W::new(self)
228    }
229    #[doc = "Bit 13 - AIS31 Start-up Test Bypass."]
230    #[inline(always)]
231    #[must_use]
232    pub fn bypais31(&mut self) -> BYPAIS31_W<13> {
233        BYPAIS31_W::new(self)
234    }
235    #[doc = "Writes raw bits to the register."]
236    #[inline(always)]
237    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
238        self.0.bits(bits);
239        self
240    }
241}
242#[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"]
243pub struct CONTROL_SPEC;
244impl crate::RegisterSpec for CONTROL_SPEC {
245    type Ux = u32;
246}
247#[doc = "`read()` method returns [control::R](R) reader structure"]
248impl crate::Readable for CONTROL_SPEC {
249    type Reader = R;
250}
251#[doc = "`write(|w| ..)` method takes [control::W](W) writer structure"]
252impl crate::Writable for CONTROL_SPEC {
253    type Writer = W;
254    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
255    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
256}
257#[doc = "`reset()` method sets CONTROL to value 0"]
258impl crate::Resettable for CONTROL_SPEC {
259    const RESET_VALUE: Self::Ux = 0;
260}