Skip to main content

atsams70j21/icm/
icm_cfg.rs

1#[doc = "Register `ICM_CFG` reader"]
2pub struct R(crate::R<ICM_CFG_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<ICM_CFG_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<ICM_CFG_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<ICM_CFG_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `ICM_CFG` writer"]
17pub struct W(crate::W<ICM_CFG_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<ICM_CFG_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<ICM_CFG_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<ICM_CFG_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `WBDIS` reader - Write Back Disable"]
38pub struct WBDIS_R(crate::FieldReader<bool, bool>);
39impl WBDIS_R {
40    #[inline(always)]
41    pub(crate) fn new(bits: bool) -> Self {
42        WBDIS_R(crate::FieldReader::new(bits))
43    }
44}
45impl core::ops::Deref for WBDIS_R {
46    type Target = crate::FieldReader<bool, bool>;
47    #[inline(always)]
48    fn deref(&self) -> &Self::Target {
49        &self.0
50    }
51}
52#[doc = "Field `WBDIS` writer - Write Back Disable"]
53pub struct WBDIS_W<'a> {
54    w: &'a mut W,
55}
56impl<'a> WBDIS_W<'a> {
57    #[doc = r"Sets the field bit"]
58    #[inline(always)]
59    pub fn set_bit(self) -> &'a mut W {
60        self.bit(true)
61    }
62    #[doc = r"Clears the field bit"]
63    #[inline(always)]
64    pub fn clear_bit(self) -> &'a mut W {
65        self.bit(false)
66    }
67    #[doc = r"Writes raw bits to the field"]
68    #[inline(always)]
69    pub fn bit(self, value: bool) -> &'a mut W {
70        self.w.bits = (self.w.bits & !0x01) | (value as u32 & 0x01);
71        self.w
72    }
73}
74#[doc = "Field `EOMDIS` reader - End of Monitoring Disable"]
75pub struct EOMDIS_R(crate::FieldReader<bool, bool>);
76impl EOMDIS_R {
77    #[inline(always)]
78    pub(crate) fn new(bits: bool) -> Self {
79        EOMDIS_R(crate::FieldReader::new(bits))
80    }
81}
82impl core::ops::Deref for EOMDIS_R {
83    type Target = crate::FieldReader<bool, bool>;
84    #[inline(always)]
85    fn deref(&self) -> &Self::Target {
86        &self.0
87    }
88}
89#[doc = "Field `EOMDIS` writer - End of Monitoring Disable"]
90pub struct EOMDIS_W<'a> {
91    w: &'a mut W,
92}
93impl<'a> EOMDIS_W<'a> {
94    #[doc = r"Sets the field bit"]
95    #[inline(always)]
96    pub fn set_bit(self) -> &'a mut W {
97        self.bit(true)
98    }
99    #[doc = r"Clears the field bit"]
100    #[inline(always)]
101    pub fn clear_bit(self) -> &'a mut W {
102        self.bit(false)
103    }
104    #[doc = r"Writes raw bits to the field"]
105    #[inline(always)]
106    pub fn bit(self, value: bool) -> &'a mut W {
107        self.w.bits = (self.w.bits & !(0x01 << 1)) | ((value as u32 & 0x01) << 1);
108        self.w
109    }
110}
111#[doc = "Field `SLBDIS` reader - Secondary List Branching Disable"]
112pub struct SLBDIS_R(crate::FieldReader<bool, bool>);
113impl SLBDIS_R {
114    #[inline(always)]
115    pub(crate) fn new(bits: bool) -> Self {
116        SLBDIS_R(crate::FieldReader::new(bits))
117    }
118}
119impl core::ops::Deref for SLBDIS_R {
120    type Target = crate::FieldReader<bool, bool>;
121    #[inline(always)]
122    fn deref(&self) -> &Self::Target {
123        &self.0
124    }
125}
126#[doc = "Field `SLBDIS` writer - Secondary List Branching Disable"]
127pub struct SLBDIS_W<'a> {
128    w: &'a mut W,
129}
130impl<'a> SLBDIS_W<'a> {
131    #[doc = r"Sets the field bit"]
132    #[inline(always)]
133    pub fn set_bit(self) -> &'a mut W {
134        self.bit(true)
135    }
136    #[doc = r"Clears the field bit"]
137    #[inline(always)]
138    pub fn clear_bit(self) -> &'a mut W {
139        self.bit(false)
140    }
141    #[doc = r"Writes raw bits to the field"]
142    #[inline(always)]
143    pub fn bit(self, value: bool) -> &'a mut W {
144        self.w.bits = (self.w.bits & !(0x01 << 2)) | ((value as u32 & 0x01) << 2);
145        self.w
146    }
147}
148#[doc = "Field `BBC` reader - Bus Burden Control"]
149pub struct BBC_R(crate::FieldReader<u8, u8>);
150impl BBC_R {
151    #[inline(always)]
152    pub(crate) fn new(bits: u8) -> Self {
153        BBC_R(crate::FieldReader::new(bits))
154    }
155}
156impl core::ops::Deref for BBC_R {
157    type Target = crate::FieldReader<u8, u8>;
158    #[inline(always)]
159    fn deref(&self) -> &Self::Target {
160        &self.0
161    }
162}
163#[doc = "Field `BBC` writer - Bus Burden Control"]
164pub struct BBC_W<'a> {
165    w: &'a mut W,
166}
167impl<'a> BBC_W<'a> {
168    #[doc = r"Writes raw bits to the field"]
169    #[inline(always)]
170    pub unsafe fn bits(self, value: u8) -> &'a mut W {
171        self.w.bits = (self.w.bits & !(0x0f << 4)) | ((value as u32 & 0x0f) << 4);
172        self.w
173    }
174}
175#[doc = "Field `ASCD` reader - Automatic Switch To Compare Digest"]
176pub struct ASCD_R(crate::FieldReader<bool, bool>);
177impl ASCD_R {
178    #[inline(always)]
179    pub(crate) fn new(bits: bool) -> Self {
180        ASCD_R(crate::FieldReader::new(bits))
181    }
182}
183impl core::ops::Deref for ASCD_R {
184    type Target = crate::FieldReader<bool, bool>;
185    #[inline(always)]
186    fn deref(&self) -> &Self::Target {
187        &self.0
188    }
189}
190#[doc = "Field `ASCD` writer - Automatic Switch To Compare Digest"]
191pub struct ASCD_W<'a> {
192    w: &'a mut W,
193}
194impl<'a> ASCD_W<'a> {
195    #[doc = r"Sets the field bit"]
196    #[inline(always)]
197    pub fn set_bit(self) -> &'a mut W {
198        self.bit(true)
199    }
200    #[doc = r"Clears the field bit"]
201    #[inline(always)]
202    pub fn clear_bit(self) -> &'a mut W {
203        self.bit(false)
204    }
205    #[doc = r"Writes raw bits to the field"]
206    #[inline(always)]
207    pub fn bit(self, value: bool) -> &'a mut W {
208        self.w.bits = (self.w.bits & !(0x01 << 8)) | ((value as u32 & 0x01) << 8);
209        self.w
210    }
211}
212#[doc = "Field `DUALBUFF` reader - Dual Input Buffer"]
213pub struct DUALBUFF_R(crate::FieldReader<bool, bool>);
214impl DUALBUFF_R {
215    #[inline(always)]
216    pub(crate) fn new(bits: bool) -> Self {
217        DUALBUFF_R(crate::FieldReader::new(bits))
218    }
219}
220impl core::ops::Deref for DUALBUFF_R {
221    type Target = crate::FieldReader<bool, bool>;
222    #[inline(always)]
223    fn deref(&self) -> &Self::Target {
224        &self.0
225    }
226}
227#[doc = "Field `DUALBUFF` writer - Dual Input Buffer"]
228pub struct DUALBUFF_W<'a> {
229    w: &'a mut W,
230}
231impl<'a> DUALBUFF_W<'a> {
232    #[doc = r"Sets the field bit"]
233    #[inline(always)]
234    pub fn set_bit(self) -> &'a mut W {
235        self.bit(true)
236    }
237    #[doc = r"Clears the field bit"]
238    #[inline(always)]
239    pub fn clear_bit(self) -> &'a mut W {
240        self.bit(false)
241    }
242    #[doc = r"Writes raw bits to the field"]
243    #[inline(always)]
244    pub fn bit(self, value: bool) -> &'a mut W {
245        self.w.bits = (self.w.bits & !(0x01 << 9)) | ((value as u32 & 0x01) << 9);
246        self.w
247    }
248}
249#[doc = "Field `UIHASH` reader - User Initial Hash Value"]
250pub struct UIHASH_R(crate::FieldReader<bool, bool>);
251impl UIHASH_R {
252    #[inline(always)]
253    pub(crate) fn new(bits: bool) -> Self {
254        UIHASH_R(crate::FieldReader::new(bits))
255    }
256}
257impl core::ops::Deref for UIHASH_R {
258    type Target = crate::FieldReader<bool, bool>;
259    #[inline(always)]
260    fn deref(&self) -> &Self::Target {
261        &self.0
262    }
263}
264#[doc = "Field `UIHASH` writer - User Initial Hash Value"]
265pub struct UIHASH_W<'a> {
266    w: &'a mut W,
267}
268impl<'a> UIHASH_W<'a> {
269    #[doc = r"Sets the field bit"]
270    #[inline(always)]
271    pub fn set_bit(self) -> &'a mut W {
272        self.bit(true)
273    }
274    #[doc = r"Clears the field bit"]
275    #[inline(always)]
276    pub fn clear_bit(self) -> &'a mut W {
277        self.bit(false)
278    }
279    #[doc = r"Writes raw bits to the field"]
280    #[inline(always)]
281    pub fn bit(self, value: bool) -> &'a mut W {
282        self.w.bits = (self.w.bits & !(0x01 << 12)) | ((value as u32 & 0x01) << 12);
283        self.w
284    }
285}
286#[doc = "User SHA Algorithm\n\nValue on reset: 0"]
287#[derive(Clone, Copy, Debug, PartialEq)]
288#[repr(u8)]
289pub enum UALGO_A {
290    #[doc = "0: SHA1 algorithm processed"]
291    SHA1 = 0,
292    #[doc = "1: SHA256 algorithm processed"]
293    SHA256 = 1,
294    #[doc = "4: SHA224 algorithm processed"]
295    SHA224 = 4,
296}
297impl From<UALGO_A> for u8 {
298    #[inline(always)]
299    fn from(variant: UALGO_A) -> Self {
300        variant as _
301    }
302}
303#[doc = "Field `UALGO` reader - User SHA Algorithm"]
304pub struct UALGO_R(crate::FieldReader<u8, UALGO_A>);
305impl UALGO_R {
306    #[inline(always)]
307    pub(crate) fn new(bits: u8) -> Self {
308        UALGO_R(crate::FieldReader::new(bits))
309    }
310    #[doc = r"Get enumerated values variant"]
311    #[inline(always)]
312    pub fn variant(&self) -> Option<UALGO_A> {
313        match self.bits {
314            0 => Some(UALGO_A::SHA1),
315            1 => Some(UALGO_A::SHA256),
316            4 => Some(UALGO_A::SHA224),
317            _ => None,
318        }
319    }
320    #[doc = "Checks if the value of the field is `SHA1`"]
321    #[inline(always)]
322    pub fn is_sha1(&self) -> bool {
323        **self == UALGO_A::SHA1
324    }
325    #[doc = "Checks if the value of the field is `SHA256`"]
326    #[inline(always)]
327    pub fn is_sha256(&self) -> bool {
328        **self == UALGO_A::SHA256
329    }
330    #[doc = "Checks if the value of the field is `SHA224`"]
331    #[inline(always)]
332    pub fn is_sha224(&self) -> bool {
333        **self == UALGO_A::SHA224
334    }
335}
336impl core::ops::Deref for UALGO_R {
337    type Target = crate::FieldReader<u8, UALGO_A>;
338    #[inline(always)]
339    fn deref(&self) -> &Self::Target {
340        &self.0
341    }
342}
343#[doc = "Field `UALGO` writer - User SHA Algorithm"]
344pub struct UALGO_W<'a> {
345    w: &'a mut W,
346}
347impl<'a> UALGO_W<'a> {
348    #[doc = r"Writes `variant` to the field"]
349    #[inline(always)]
350    pub fn variant(self, variant: UALGO_A) -> &'a mut W {
351        unsafe { self.bits(variant.into()) }
352    }
353    #[doc = "SHA1 algorithm processed"]
354    #[inline(always)]
355    pub fn sha1(self) -> &'a mut W {
356        self.variant(UALGO_A::SHA1)
357    }
358    #[doc = "SHA256 algorithm processed"]
359    #[inline(always)]
360    pub fn sha256(self) -> &'a mut W {
361        self.variant(UALGO_A::SHA256)
362    }
363    #[doc = "SHA224 algorithm processed"]
364    #[inline(always)]
365    pub fn sha224(self) -> &'a mut W {
366        self.variant(UALGO_A::SHA224)
367    }
368    #[doc = r"Writes raw bits to the field"]
369    #[inline(always)]
370    pub unsafe fn bits(self, value: u8) -> &'a mut W {
371        self.w.bits = (self.w.bits & !(0x07 << 13)) | ((value as u32 & 0x07) << 13);
372        self.w
373    }
374}
375impl R {
376    #[doc = "Bit 0 - Write Back Disable"]
377    #[inline(always)]
378    pub fn wbdis(&self) -> WBDIS_R {
379        WBDIS_R::new((self.bits & 0x01) != 0)
380    }
381    #[doc = "Bit 1 - End of Monitoring Disable"]
382    #[inline(always)]
383    pub fn eomdis(&self) -> EOMDIS_R {
384        EOMDIS_R::new(((self.bits >> 1) & 0x01) != 0)
385    }
386    #[doc = "Bit 2 - Secondary List Branching Disable"]
387    #[inline(always)]
388    pub fn slbdis(&self) -> SLBDIS_R {
389        SLBDIS_R::new(((self.bits >> 2) & 0x01) != 0)
390    }
391    #[doc = "Bits 4:7 - Bus Burden Control"]
392    #[inline(always)]
393    pub fn bbc(&self) -> BBC_R {
394        BBC_R::new(((self.bits >> 4) & 0x0f) as u8)
395    }
396    #[doc = "Bit 8 - Automatic Switch To Compare Digest"]
397    #[inline(always)]
398    pub fn ascd(&self) -> ASCD_R {
399        ASCD_R::new(((self.bits >> 8) & 0x01) != 0)
400    }
401    #[doc = "Bit 9 - Dual Input Buffer"]
402    #[inline(always)]
403    pub fn dualbuff(&self) -> DUALBUFF_R {
404        DUALBUFF_R::new(((self.bits >> 9) & 0x01) != 0)
405    }
406    #[doc = "Bit 12 - User Initial Hash Value"]
407    #[inline(always)]
408    pub fn uihash(&self) -> UIHASH_R {
409        UIHASH_R::new(((self.bits >> 12) & 0x01) != 0)
410    }
411    #[doc = "Bits 13:15 - User SHA Algorithm"]
412    #[inline(always)]
413    pub fn ualgo(&self) -> UALGO_R {
414        UALGO_R::new(((self.bits >> 13) & 0x07) as u8)
415    }
416}
417impl W {
418    #[doc = "Bit 0 - Write Back Disable"]
419    #[inline(always)]
420    pub fn wbdis(&mut self) -> WBDIS_W {
421        WBDIS_W { w: self }
422    }
423    #[doc = "Bit 1 - End of Monitoring Disable"]
424    #[inline(always)]
425    pub fn eomdis(&mut self) -> EOMDIS_W {
426        EOMDIS_W { w: self }
427    }
428    #[doc = "Bit 2 - Secondary List Branching Disable"]
429    #[inline(always)]
430    pub fn slbdis(&mut self) -> SLBDIS_W {
431        SLBDIS_W { w: self }
432    }
433    #[doc = "Bits 4:7 - Bus Burden Control"]
434    #[inline(always)]
435    pub fn bbc(&mut self) -> BBC_W {
436        BBC_W { w: self }
437    }
438    #[doc = "Bit 8 - Automatic Switch To Compare Digest"]
439    #[inline(always)]
440    pub fn ascd(&mut self) -> ASCD_W {
441        ASCD_W { w: self }
442    }
443    #[doc = "Bit 9 - Dual Input Buffer"]
444    #[inline(always)]
445    pub fn dualbuff(&mut self) -> DUALBUFF_W {
446        DUALBUFF_W { w: self }
447    }
448    #[doc = "Bit 12 - User Initial Hash Value"]
449    #[inline(always)]
450    pub fn uihash(&mut self) -> UIHASH_W {
451        UIHASH_W { w: self }
452    }
453    #[doc = "Bits 13:15 - User SHA Algorithm"]
454    #[inline(always)]
455    pub fn ualgo(&mut self) -> UALGO_W {
456        UALGO_W { w: self }
457    }
458    #[doc = "Writes raw bits to the register."]
459    #[inline(always)]
460    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
461        self.0.bits(bits);
462        self
463    }
464}
465#[doc = "Configuration 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 [icm_cfg](index.html) module"]
466pub struct ICM_CFG_SPEC;
467impl crate::RegisterSpec for ICM_CFG_SPEC {
468    type Ux = u32;
469}
470#[doc = "`read()` method returns [icm_cfg::R](R) reader structure"]
471impl crate::Readable for ICM_CFG_SPEC {
472    type Reader = R;
473}
474#[doc = "`write(|w| ..)` method takes [icm_cfg::W](W) writer structure"]
475impl crate::Writable for ICM_CFG_SPEC {
476    type Writer = W;
477}
478#[doc = "`reset()` method sets ICM_CFG to value 0"]
479impl crate::Resettable for ICM_CFG_SPEC {
480    #[inline(always)]
481    fn reset_value() -> Self::Ux {
482        0
483    }
484}