atsamd51g/aes/
ctrla.rs

1#[doc = "Register `CTRLA` reader"]
2pub type R = crate::R<CtrlaSpec>;
3#[doc = "Register `CTRLA` writer"]
4pub type W = crate::W<CtrlaSpec>;
5#[doc = "Field `SWRST` reader - Software Reset"]
6pub type SwrstR = crate::BitReader;
7#[doc = "Field `SWRST` writer - Software Reset"]
8pub type SwrstW<'a, REG> = crate::BitWriter<'a, REG>;
9#[doc = "Field `ENABLE` reader - Enable"]
10pub type EnableR = crate::BitReader;
11#[doc = "Field `ENABLE` writer - Enable"]
12pub type EnableW<'a, REG> = crate::BitWriter<'a, REG>;
13#[doc = "AES Modes of operation\n\nValue on reset: 0"]
14#[derive(Clone, Copy, Debug, PartialEq, Eq)]
15#[repr(u8)]
16pub enum Aesmodeselect {
17    #[doc = "0: Electronic code book mode"]
18    Ecb = 0,
19    #[doc = "1: Cipher block chaining mode"]
20    Cbc = 1,
21    #[doc = "2: Output feedback mode"]
22    Ofb = 2,
23    #[doc = "3: Cipher feedback mode"]
24    Cfb = 3,
25    #[doc = "4: Counter mode"]
26    Counter = 4,
27    #[doc = "5: CCM mode"]
28    Ccm = 5,
29    #[doc = "6: Galois counter mode"]
30    Gcm = 6,
31}
32impl From<Aesmodeselect> for u8 {
33    #[inline(always)]
34    fn from(variant: Aesmodeselect) -> Self {
35        variant as _
36    }
37}
38impl crate::FieldSpec for Aesmodeselect {
39    type Ux = u8;
40}
41impl crate::IsEnum for Aesmodeselect {}
42#[doc = "Field `AESMODE` reader - AES Modes of operation"]
43pub type AesmodeR = crate::FieldReader<Aesmodeselect>;
44impl AesmodeR {
45    #[doc = "Get enumerated values variant"]
46    #[inline(always)]
47    pub const fn variant(&self) -> Option<Aesmodeselect> {
48        match self.bits {
49            0 => Some(Aesmodeselect::Ecb),
50            1 => Some(Aesmodeselect::Cbc),
51            2 => Some(Aesmodeselect::Ofb),
52            3 => Some(Aesmodeselect::Cfb),
53            4 => Some(Aesmodeselect::Counter),
54            5 => Some(Aesmodeselect::Ccm),
55            6 => Some(Aesmodeselect::Gcm),
56            _ => None,
57        }
58    }
59    #[doc = "Electronic code book mode"]
60    #[inline(always)]
61    pub fn is_ecb(&self) -> bool {
62        *self == Aesmodeselect::Ecb
63    }
64    #[doc = "Cipher block chaining mode"]
65    #[inline(always)]
66    pub fn is_cbc(&self) -> bool {
67        *self == Aesmodeselect::Cbc
68    }
69    #[doc = "Output feedback mode"]
70    #[inline(always)]
71    pub fn is_ofb(&self) -> bool {
72        *self == Aesmodeselect::Ofb
73    }
74    #[doc = "Cipher feedback mode"]
75    #[inline(always)]
76    pub fn is_cfb(&self) -> bool {
77        *self == Aesmodeselect::Cfb
78    }
79    #[doc = "Counter mode"]
80    #[inline(always)]
81    pub fn is_counter(&self) -> bool {
82        *self == Aesmodeselect::Counter
83    }
84    #[doc = "CCM mode"]
85    #[inline(always)]
86    pub fn is_ccm(&self) -> bool {
87        *self == Aesmodeselect::Ccm
88    }
89    #[doc = "Galois counter mode"]
90    #[inline(always)]
91    pub fn is_gcm(&self) -> bool {
92        *self == Aesmodeselect::Gcm
93    }
94}
95#[doc = "Field `AESMODE` writer - AES Modes of operation"]
96pub type AesmodeW<'a, REG> = crate::FieldWriter<'a, REG, 3, Aesmodeselect>;
97impl<'a, REG> AesmodeW<'a, REG>
98where
99    REG: crate::Writable + crate::RegisterSpec,
100    REG::Ux: From<u8>,
101{
102    #[doc = "Electronic code book mode"]
103    #[inline(always)]
104    pub fn ecb(self) -> &'a mut crate::W<REG> {
105        self.variant(Aesmodeselect::Ecb)
106    }
107    #[doc = "Cipher block chaining mode"]
108    #[inline(always)]
109    pub fn cbc(self) -> &'a mut crate::W<REG> {
110        self.variant(Aesmodeselect::Cbc)
111    }
112    #[doc = "Output feedback mode"]
113    #[inline(always)]
114    pub fn ofb(self) -> &'a mut crate::W<REG> {
115        self.variant(Aesmodeselect::Ofb)
116    }
117    #[doc = "Cipher feedback mode"]
118    #[inline(always)]
119    pub fn cfb(self) -> &'a mut crate::W<REG> {
120        self.variant(Aesmodeselect::Cfb)
121    }
122    #[doc = "Counter mode"]
123    #[inline(always)]
124    pub fn counter(self) -> &'a mut crate::W<REG> {
125        self.variant(Aesmodeselect::Counter)
126    }
127    #[doc = "CCM mode"]
128    #[inline(always)]
129    pub fn ccm(self) -> &'a mut crate::W<REG> {
130        self.variant(Aesmodeselect::Ccm)
131    }
132    #[doc = "Galois counter mode"]
133    #[inline(always)]
134    pub fn gcm(self) -> &'a mut crate::W<REG> {
135        self.variant(Aesmodeselect::Gcm)
136    }
137}
138#[doc = "Cipher Feedback Block Size\n\nValue on reset: 0"]
139#[derive(Clone, Copy, Debug, PartialEq, Eq)]
140#[repr(u8)]
141pub enum Cfbsselect {
142    #[doc = "0: 128-bit Input data block for Encryption/Decryption in Cipher Feedback mode"]
143    _128bit = 0,
144    #[doc = "1: 64-bit Input data block for Encryption/Decryption in Cipher Feedback mode"]
145    _64bit = 1,
146    #[doc = "2: 32-bit Input data block for Encryption/Decryption in Cipher Feedback mode"]
147    _32bit = 2,
148    #[doc = "3: 16-bit Input data block for Encryption/Decryption in Cipher Feedback mode"]
149    _16bit = 3,
150    #[doc = "4: 8-bit Input data block for Encryption/Decryption in Cipher Feedback mode"]
151    _8bit = 4,
152}
153impl From<Cfbsselect> for u8 {
154    #[inline(always)]
155    fn from(variant: Cfbsselect) -> Self {
156        variant as _
157    }
158}
159impl crate::FieldSpec for Cfbsselect {
160    type Ux = u8;
161}
162impl crate::IsEnum for Cfbsselect {}
163#[doc = "Field `CFBS` reader - Cipher Feedback Block Size"]
164pub type CfbsR = crate::FieldReader<Cfbsselect>;
165impl CfbsR {
166    #[doc = "Get enumerated values variant"]
167    #[inline(always)]
168    pub const fn variant(&self) -> Option<Cfbsselect> {
169        match self.bits {
170            0 => Some(Cfbsselect::_128bit),
171            1 => Some(Cfbsselect::_64bit),
172            2 => Some(Cfbsselect::_32bit),
173            3 => Some(Cfbsselect::_16bit),
174            4 => Some(Cfbsselect::_8bit),
175            _ => None,
176        }
177    }
178    #[doc = "128-bit Input data block for Encryption/Decryption in Cipher Feedback mode"]
179    #[inline(always)]
180    pub fn is_128bit(&self) -> bool {
181        *self == Cfbsselect::_128bit
182    }
183    #[doc = "64-bit Input data block for Encryption/Decryption in Cipher Feedback mode"]
184    #[inline(always)]
185    pub fn is_64bit(&self) -> bool {
186        *self == Cfbsselect::_64bit
187    }
188    #[doc = "32-bit Input data block for Encryption/Decryption in Cipher Feedback mode"]
189    #[inline(always)]
190    pub fn is_32bit(&self) -> bool {
191        *self == Cfbsselect::_32bit
192    }
193    #[doc = "16-bit Input data block for Encryption/Decryption in Cipher Feedback mode"]
194    #[inline(always)]
195    pub fn is_16bit(&self) -> bool {
196        *self == Cfbsselect::_16bit
197    }
198    #[doc = "8-bit Input data block for Encryption/Decryption in Cipher Feedback mode"]
199    #[inline(always)]
200    pub fn is_8bit(&self) -> bool {
201        *self == Cfbsselect::_8bit
202    }
203}
204#[doc = "Field `CFBS` writer - Cipher Feedback Block Size"]
205pub type CfbsW<'a, REG> = crate::FieldWriter<'a, REG, 3, Cfbsselect>;
206impl<'a, REG> CfbsW<'a, REG>
207where
208    REG: crate::Writable + crate::RegisterSpec,
209    REG::Ux: From<u8>,
210{
211    #[doc = "128-bit Input data block for Encryption/Decryption in Cipher Feedback mode"]
212    #[inline(always)]
213    pub fn _128bit(self) -> &'a mut crate::W<REG> {
214        self.variant(Cfbsselect::_128bit)
215    }
216    #[doc = "64-bit Input data block for Encryption/Decryption in Cipher Feedback mode"]
217    #[inline(always)]
218    pub fn _64bit(self) -> &'a mut crate::W<REG> {
219        self.variant(Cfbsselect::_64bit)
220    }
221    #[doc = "32-bit Input data block for Encryption/Decryption in Cipher Feedback mode"]
222    #[inline(always)]
223    pub fn _32bit(self) -> &'a mut crate::W<REG> {
224        self.variant(Cfbsselect::_32bit)
225    }
226    #[doc = "16-bit Input data block for Encryption/Decryption in Cipher Feedback mode"]
227    #[inline(always)]
228    pub fn _16bit(self) -> &'a mut crate::W<REG> {
229        self.variant(Cfbsselect::_16bit)
230    }
231    #[doc = "8-bit Input data block for Encryption/Decryption in Cipher Feedback mode"]
232    #[inline(always)]
233    pub fn _8bit(self) -> &'a mut crate::W<REG> {
234        self.variant(Cfbsselect::_8bit)
235    }
236}
237#[doc = "Encryption Key Size\n\nValue on reset: 0"]
238#[derive(Clone, Copy, Debug, PartialEq, Eq)]
239#[repr(u8)]
240pub enum Keysizeselect {
241    #[doc = "0: 128-bit Key for Encryption / Decryption"]
242    _128bit = 0,
243    #[doc = "1: 192-bit Key for Encryption / Decryption"]
244    _192bit = 1,
245    #[doc = "2: 256-bit Key for Encryption / Decryption"]
246    _256bit = 2,
247}
248impl From<Keysizeselect> for u8 {
249    #[inline(always)]
250    fn from(variant: Keysizeselect) -> Self {
251        variant as _
252    }
253}
254impl crate::FieldSpec for Keysizeselect {
255    type Ux = u8;
256}
257impl crate::IsEnum for Keysizeselect {}
258#[doc = "Field `KEYSIZE` reader - Encryption Key Size"]
259pub type KeysizeR = crate::FieldReader<Keysizeselect>;
260impl KeysizeR {
261    #[doc = "Get enumerated values variant"]
262    #[inline(always)]
263    pub const fn variant(&self) -> Option<Keysizeselect> {
264        match self.bits {
265            0 => Some(Keysizeselect::_128bit),
266            1 => Some(Keysizeselect::_192bit),
267            2 => Some(Keysizeselect::_256bit),
268            _ => None,
269        }
270    }
271    #[doc = "128-bit Key for Encryption / Decryption"]
272    #[inline(always)]
273    pub fn is_128bit(&self) -> bool {
274        *self == Keysizeselect::_128bit
275    }
276    #[doc = "192-bit Key for Encryption / Decryption"]
277    #[inline(always)]
278    pub fn is_192bit(&self) -> bool {
279        *self == Keysizeselect::_192bit
280    }
281    #[doc = "256-bit Key for Encryption / Decryption"]
282    #[inline(always)]
283    pub fn is_256bit(&self) -> bool {
284        *self == Keysizeselect::_256bit
285    }
286}
287#[doc = "Field `KEYSIZE` writer - Encryption Key Size"]
288pub type KeysizeW<'a, REG> = crate::FieldWriter<'a, REG, 2, Keysizeselect>;
289impl<'a, REG> KeysizeW<'a, REG>
290where
291    REG: crate::Writable + crate::RegisterSpec,
292    REG::Ux: From<u8>,
293{
294    #[doc = "128-bit Key for Encryption / Decryption"]
295    #[inline(always)]
296    pub fn _128bit(self) -> &'a mut crate::W<REG> {
297        self.variant(Keysizeselect::_128bit)
298    }
299    #[doc = "192-bit Key for Encryption / Decryption"]
300    #[inline(always)]
301    pub fn _192bit(self) -> &'a mut crate::W<REG> {
302        self.variant(Keysizeselect::_192bit)
303    }
304    #[doc = "256-bit Key for Encryption / Decryption"]
305    #[inline(always)]
306    pub fn _256bit(self) -> &'a mut crate::W<REG> {
307        self.variant(Keysizeselect::_256bit)
308    }
309}
310#[doc = "Cipher Mode\n\nValue on reset: 0"]
311#[derive(Clone, Copy, Debug, PartialEq, Eq)]
312pub enum Cipherselect {
313    #[doc = "0: Decryption"]
314    Dec = 0,
315    #[doc = "1: Encryption"]
316    Enc = 1,
317}
318impl From<Cipherselect> for bool {
319    #[inline(always)]
320    fn from(variant: Cipherselect) -> Self {
321        variant as u8 != 0
322    }
323}
324#[doc = "Field `CIPHER` reader - Cipher Mode"]
325pub type CipherR = crate::BitReader<Cipherselect>;
326impl CipherR {
327    #[doc = "Get enumerated values variant"]
328    #[inline(always)]
329    pub const fn variant(&self) -> Cipherselect {
330        match self.bits {
331            false => Cipherselect::Dec,
332            true => Cipherselect::Enc,
333        }
334    }
335    #[doc = "Decryption"]
336    #[inline(always)]
337    pub fn is_dec(&self) -> bool {
338        *self == Cipherselect::Dec
339    }
340    #[doc = "Encryption"]
341    #[inline(always)]
342    pub fn is_enc(&self) -> bool {
343        *self == Cipherselect::Enc
344    }
345}
346#[doc = "Field `CIPHER` writer - Cipher Mode"]
347pub type CipherW<'a, REG> = crate::BitWriter<'a, REG, Cipherselect>;
348impl<'a, REG> CipherW<'a, REG>
349where
350    REG: crate::Writable + crate::RegisterSpec,
351{
352    #[doc = "Decryption"]
353    #[inline(always)]
354    pub fn dec(self) -> &'a mut crate::W<REG> {
355        self.variant(Cipherselect::Dec)
356    }
357    #[doc = "Encryption"]
358    #[inline(always)]
359    pub fn enc(self) -> &'a mut crate::W<REG> {
360        self.variant(Cipherselect::Enc)
361    }
362}
363#[doc = "Start Mode Select\n\nValue on reset: 0"]
364#[derive(Clone, Copy, Debug, PartialEq, Eq)]
365pub enum Startmodeselect {
366    #[doc = "0: Start Encryption / Decryption in Manual mode"]
367    Manual = 0,
368    #[doc = "1: Start Encryption / Decryption in Auto mode"]
369    Auto = 1,
370}
371impl From<Startmodeselect> for bool {
372    #[inline(always)]
373    fn from(variant: Startmodeselect) -> Self {
374        variant as u8 != 0
375    }
376}
377#[doc = "Field `STARTMODE` reader - Start Mode Select"]
378pub type StartmodeR = crate::BitReader<Startmodeselect>;
379impl StartmodeR {
380    #[doc = "Get enumerated values variant"]
381    #[inline(always)]
382    pub const fn variant(&self) -> Startmodeselect {
383        match self.bits {
384            false => Startmodeselect::Manual,
385            true => Startmodeselect::Auto,
386        }
387    }
388    #[doc = "Start Encryption / Decryption in Manual mode"]
389    #[inline(always)]
390    pub fn is_manual(&self) -> bool {
391        *self == Startmodeselect::Manual
392    }
393    #[doc = "Start Encryption / Decryption in Auto mode"]
394    #[inline(always)]
395    pub fn is_auto(&self) -> bool {
396        *self == Startmodeselect::Auto
397    }
398}
399#[doc = "Field `STARTMODE` writer - Start Mode Select"]
400pub type StartmodeW<'a, REG> = crate::BitWriter<'a, REG, Startmodeselect>;
401impl<'a, REG> StartmodeW<'a, REG>
402where
403    REG: crate::Writable + crate::RegisterSpec,
404{
405    #[doc = "Start Encryption / Decryption in Manual mode"]
406    #[inline(always)]
407    pub fn manual(self) -> &'a mut crate::W<REG> {
408        self.variant(Startmodeselect::Manual)
409    }
410    #[doc = "Start Encryption / Decryption in Auto mode"]
411    #[inline(always)]
412    pub fn auto(self) -> &'a mut crate::W<REG> {
413        self.variant(Startmodeselect::Auto)
414    }
415}
416#[doc = "Last Output Data Mode\n\nValue on reset: 0"]
417#[derive(Clone, Copy, Debug, PartialEq, Eq)]
418pub enum Lodselect {
419    #[doc = "0: No effect"]
420    None = 0,
421    #[doc = "1: Start encryption in Last Output Data mode"]
422    Last = 1,
423}
424impl From<Lodselect> for bool {
425    #[inline(always)]
426    fn from(variant: Lodselect) -> Self {
427        variant as u8 != 0
428    }
429}
430#[doc = "Field `LOD` reader - Last Output Data Mode"]
431pub type LodR = crate::BitReader<Lodselect>;
432impl LodR {
433    #[doc = "Get enumerated values variant"]
434    #[inline(always)]
435    pub const fn variant(&self) -> Lodselect {
436        match self.bits {
437            false => Lodselect::None,
438            true => Lodselect::Last,
439        }
440    }
441    #[doc = "No effect"]
442    #[inline(always)]
443    pub fn is_none(&self) -> bool {
444        *self == Lodselect::None
445    }
446    #[doc = "Start encryption in Last Output Data mode"]
447    #[inline(always)]
448    pub fn is_last(&self) -> bool {
449        *self == Lodselect::Last
450    }
451}
452#[doc = "Field `LOD` writer - Last Output Data Mode"]
453pub type LodW<'a, REG> = crate::BitWriter<'a, REG, Lodselect>;
454impl<'a, REG> LodW<'a, REG>
455where
456    REG: crate::Writable + crate::RegisterSpec,
457{
458    #[doc = "No effect"]
459    #[inline(always)]
460    pub fn none(self) -> &'a mut crate::W<REG> {
461        self.variant(Lodselect::None)
462    }
463    #[doc = "Start encryption in Last Output Data mode"]
464    #[inline(always)]
465    pub fn last(self) -> &'a mut crate::W<REG> {
466        self.variant(Lodselect::Last)
467    }
468}
469#[doc = "Last Key Generation\n\nValue on reset: 0"]
470#[derive(Clone, Copy, Debug, PartialEq, Eq)]
471pub enum Keygenselect {
472    #[doc = "0: No effect"]
473    None = 0,
474    #[doc = "1: Start Computation of the last NK words of the expanded key"]
475    Last = 1,
476}
477impl From<Keygenselect> for bool {
478    #[inline(always)]
479    fn from(variant: Keygenselect) -> Self {
480        variant as u8 != 0
481    }
482}
483#[doc = "Field `KEYGEN` reader - Last Key Generation"]
484pub type KeygenR = crate::BitReader<Keygenselect>;
485impl KeygenR {
486    #[doc = "Get enumerated values variant"]
487    #[inline(always)]
488    pub const fn variant(&self) -> Keygenselect {
489        match self.bits {
490            false => Keygenselect::None,
491            true => Keygenselect::Last,
492        }
493    }
494    #[doc = "No effect"]
495    #[inline(always)]
496    pub fn is_none(&self) -> bool {
497        *self == Keygenselect::None
498    }
499    #[doc = "Start Computation of the last NK words of the expanded key"]
500    #[inline(always)]
501    pub fn is_last(&self) -> bool {
502        *self == Keygenselect::Last
503    }
504}
505#[doc = "Field `KEYGEN` writer - Last Key Generation"]
506pub type KeygenW<'a, REG> = crate::BitWriter<'a, REG, Keygenselect>;
507impl<'a, REG> KeygenW<'a, REG>
508where
509    REG: crate::Writable + crate::RegisterSpec,
510{
511    #[doc = "No effect"]
512    #[inline(always)]
513    pub fn none(self) -> &'a mut crate::W<REG> {
514        self.variant(Keygenselect::None)
515    }
516    #[doc = "Start Computation of the last NK words of the expanded key"]
517    #[inline(always)]
518    pub fn last(self) -> &'a mut crate::W<REG> {
519        self.variant(Keygenselect::Last)
520    }
521}
522#[doc = "XOR Key Operation\n\nValue on reset: 0"]
523#[derive(Clone, Copy, Debug, PartialEq, Eq)]
524pub enum Xorkeyselect {
525    #[doc = "0: No effect"]
526    None = 0,
527    #[doc = "1: The user keyword gets XORed with the previous keyword register content."]
528    Xor = 1,
529}
530impl From<Xorkeyselect> for bool {
531    #[inline(always)]
532    fn from(variant: Xorkeyselect) -> Self {
533        variant as u8 != 0
534    }
535}
536#[doc = "Field `XORKEY` reader - XOR Key Operation"]
537pub type XorkeyR = crate::BitReader<Xorkeyselect>;
538impl XorkeyR {
539    #[doc = "Get enumerated values variant"]
540    #[inline(always)]
541    pub const fn variant(&self) -> Xorkeyselect {
542        match self.bits {
543            false => Xorkeyselect::None,
544            true => Xorkeyselect::Xor,
545        }
546    }
547    #[doc = "No effect"]
548    #[inline(always)]
549    pub fn is_none(&self) -> bool {
550        *self == Xorkeyselect::None
551    }
552    #[doc = "The user keyword gets XORed with the previous keyword register content."]
553    #[inline(always)]
554    pub fn is_xor(&self) -> bool {
555        *self == Xorkeyselect::Xor
556    }
557}
558#[doc = "Field `XORKEY` writer - XOR Key Operation"]
559pub type XorkeyW<'a, REG> = crate::BitWriter<'a, REG, Xorkeyselect>;
560impl<'a, REG> XorkeyW<'a, REG>
561where
562    REG: crate::Writable + crate::RegisterSpec,
563{
564    #[doc = "No effect"]
565    #[inline(always)]
566    pub fn none(self) -> &'a mut crate::W<REG> {
567        self.variant(Xorkeyselect::None)
568    }
569    #[doc = "The user keyword gets XORed with the previous keyword register content."]
570    #[inline(always)]
571    pub fn xor(self) -> &'a mut crate::W<REG> {
572        self.variant(Xorkeyselect::Xor)
573    }
574}
575#[doc = "Field `CTYPE` reader - Counter Measure Type"]
576pub type CtypeR = crate::FieldReader;
577#[doc = "Field `CTYPE` writer - Counter Measure Type"]
578pub type CtypeW<'a, REG> = crate::FieldWriter<'a, REG, 4>;
579impl R {
580    #[doc = "Bit 0 - Software Reset"]
581    #[inline(always)]
582    pub fn swrst(&self) -> SwrstR {
583        SwrstR::new((self.bits & 1) != 0)
584    }
585    #[doc = "Bit 1 - Enable"]
586    #[inline(always)]
587    pub fn enable(&self) -> EnableR {
588        EnableR::new(((self.bits >> 1) & 1) != 0)
589    }
590    #[doc = "Bits 2:4 - AES Modes of operation"]
591    #[inline(always)]
592    pub fn aesmode(&self) -> AesmodeR {
593        AesmodeR::new(((self.bits >> 2) & 7) as u8)
594    }
595    #[doc = "Bits 5:7 - Cipher Feedback Block Size"]
596    #[inline(always)]
597    pub fn cfbs(&self) -> CfbsR {
598        CfbsR::new(((self.bits >> 5) & 7) as u8)
599    }
600    #[doc = "Bits 8:9 - Encryption Key Size"]
601    #[inline(always)]
602    pub fn keysize(&self) -> KeysizeR {
603        KeysizeR::new(((self.bits >> 8) & 3) as u8)
604    }
605    #[doc = "Bit 10 - Cipher Mode"]
606    #[inline(always)]
607    pub fn cipher(&self) -> CipherR {
608        CipherR::new(((self.bits >> 10) & 1) != 0)
609    }
610    #[doc = "Bit 11 - Start Mode Select"]
611    #[inline(always)]
612    pub fn startmode(&self) -> StartmodeR {
613        StartmodeR::new(((self.bits >> 11) & 1) != 0)
614    }
615    #[doc = "Bit 12 - Last Output Data Mode"]
616    #[inline(always)]
617    pub fn lod(&self) -> LodR {
618        LodR::new(((self.bits >> 12) & 1) != 0)
619    }
620    #[doc = "Bit 13 - Last Key Generation"]
621    #[inline(always)]
622    pub fn keygen(&self) -> KeygenR {
623        KeygenR::new(((self.bits >> 13) & 1) != 0)
624    }
625    #[doc = "Bit 14 - XOR Key Operation"]
626    #[inline(always)]
627    pub fn xorkey(&self) -> XorkeyR {
628        XorkeyR::new(((self.bits >> 14) & 1) != 0)
629    }
630    #[doc = "Bits 16:19 - Counter Measure Type"]
631    #[inline(always)]
632    pub fn ctype(&self) -> CtypeR {
633        CtypeR::new(((self.bits >> 16) & 0x0f) as u8)
634    }
635}
636impl W {
637    #[doc = "Bit 0 - Software Reset"]
638    #[inline(always)]
639    #[must_use]
640    pub fn swrst(&mut self) -> SwrstW<CtrlaSpec> {
641        SwrstW::new(self, 0)
642    }
643    #[doc = "Bit 1 - Enable"]
644    #[inline(always)]
645    #[must_use]
646    pub fn enable(&mut self) -> EnableW<CtrlaSpec> {
647        EnableW::new(self, 1)
648    }
649    #[doc = "Bits 2:4 - AES Modes of operation"]
650    #[inline(always)]
651    #[must_use]
652    pub fn aesmode(&mut self) -> AesmodeW<CtrlaSpec> {
653        AesmodeW::new(self, 2)
654    }
655    #[doc = "Bits 5:7 - Cipher Feedback Block Size"]
656    #[inline(always)]
657    #[must_use]
658    pub fn cfbs(&mut self) -> CfbsW<CtrlaSpec> {
659        CfbsW::new(self, 5)
660    }
661    #[doc = "Bits 8:9 - Encryption Key Size"]
662    #[inline(always)]
663    #[must_use]
664    pub fn keysize(&mut self) -> KeysizeW<CtrlaSpec> {
665        KeysizeW::new(self, 8)
666    }
667    #[doc = "Bit 10 - Cipher Mode"]
668    #[inline(always)]
669    #[must_use]
670    pub fn cipher(&mut self) -> CipherW<CtrlaSpec> {
671        CipherW::new(self, 10)
672    }
673    #[doc = "Bit 11 - Start Mode Select"]
674    #[inline(always)]
675    #[must_use]
676    pub fn startmode(&mut self) -> StartmodeW<CtrlaSpec> {
677        StartmodeW::new(self, 11)
678    }
679    #[doc = "Bit 12 - Last Output Data Mode"]
680    #[inline(always)]
681    #[must_use]
682    pub fn lod(&mut self) -> LodW<CtrlaSpec> {
683        LodW::new(self, 12)
684    }
685    #[doc = "Bit 13 - Last Key Generation"]
686    #[inline(always)]
687    #[must_use]
688    pub fn keygen(&mut self) -> KeygenW<CtrlaSpec> {
689        KeygenW::new(self, 13)
690    }
691    #[doc = "Bit 14 - XOR Key Operation"]
692    #[inline(always)]
693    #[must_use]
694    pub fn xorkey(&mut self) -> XorkeyW<CtrlaSpec> {
695        XorkeyW::new(self, 14)
696    }
697    #[doc = "Bits 16:19 - Counter Measure Type"]
698    #[inline(always)]
699    #[must_use]
700    pub fn ctype(&mut self) -> CtypeW<CtrlaSpec> {
701        CtypeW::new(self, 16)
702    }
703}
704#[doc = "Control A\n\nYou can [`read`](crate::Reg::read) this register and get [`ctrla::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`ctrla::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
705pub struct CtrlaSpec;
706impl crate::RegisterSpec for CtrlaSpec {
707    type Ux = u32;
708}
709#[doc = "`read()` method returns [`ctrla::R`](R) reader structure"]
710impl crate::Readable for CtrlaSpec {}
711#[doc = "`write(|w| ..)` method takes [`ctrla::W`](W) writer structure"]
712impl crate::Writable for CtrlaSpec {
713    type Safety = crate::Unsafe;
714    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
715    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
716}
717#[doc = "`reset()` method sets CTRLA to value 0"]
718impl crate::Resettable for CtrlaSpec {
719    const RESET_VALUE: u32 = 0;
720}