1pub type R = crate::R<CRrs>;
3pub type W = crate::W<CRrs>;
5#[cfg_attr(feature = "defmt", derive(defmt::Format))]
9#[derive(Clone, Copy, Debug, PartialEq, Eq)]
10pub enum EN {
11 Disabled = 0,
13 Enabled = 1,
15}
16impl From<EN> for bool {
17 #[inline(always)]
18 fn from(variant: EN) -> Self {
19 variant as u8 != 0
20 }
21}
22pub type EN_R = crate::BitReader<EN>;
24impl EN_R {
25 #[inline(always)]
27 pub const fn variant(&self) -> EN {
28 match self.bits {
29 false => EN::Disabled,
30 true => EN::Enabled,
31 }
32 }
33 #[inline(always)]
35 pub fn is_disabled(&self) -> bool {
36 *self == EN::Disabled
37 }
38 #[inline(always)]
40 pub fn is_enabled(&self) -> bool {
41 *self == EN::Enabled
42 }
43}
44pub type EN_W<'a, REG> = crate::BitWriter<'a, REG, EN>;
46impl<'a, REG> EN_W<'a, REG>
47where
48 REG: crate::Writable + crate::RegisterSpec,
49{
50 #[inline(always)]
52 pub fn disabled(self) -> &'a mut crate::W<REG> {
53 self.variant(EN::Disabled)
54 }
55 #[inline(always)]
57 pub fn enabled(self) -> &'a mut crate::W<REG> {
58 self.variant(EN::Enabled)
59 }
60}
61#[cfg_attr(feature = "defmt", derive(defmt::Format))]
65#[derive(Clone, Copy, Debug, PartialEq, Eq)]
66#[repr(u8)]
67pub enum DATATYPE {
68 None = 0,
70 HalfWord = 1,
72 Byte = 2,
74 Bit = 3,
76}
77impl From<DATATYPE> for u8 {
78 #[inline(always)]
79 fn from(variant: DATATYPE) -> Self {
80 variant as _
81 }
82}
83impl crate::FieldSpec for DATATYPE {
84 type Ux = u8;
85}
86impl crate::IsEnum for DATATYPE {}
87pub type DATATYPE_R = crate::FieldReader<DATATYPE>;
89impl DATATYPE_R {
90 #[inline(always)]
92 pub const fn variant(&self) -> DATATYPE {
93 match self.bits {
94 0 => DATATYPE::None,
95 1 => DATATYPE::HalfWord,
96 2 => DATATYPE::Byte,
97 3 => DATATYPE::Bit,
98 _ => unreachable!(),
99 }
100 }
101 #[inline(always)]
103 pub fn is_none(&self) -> bool {
104 *self == DATATYPE::None
105 }
106 #[inline(always)]
108 pub fn is_half_word(&self) -> bool {
109 *self == DATATYPE::HalfWord
110 }
111 #[inline(always)]
113 pub fn is_byte(&self) -> bool {
114 *self == DATATYPE::Byte
115 }
116 #[inline(always)]
118 pub fn is_bit(&self) -> bool {
119 *self == DATATYPE::Bit
120 }
121}
122pub type DATATYPE_W<'a, REG> = crate::FieldWriter<'a, REG, 2, DATATYPE, crate::Safe>;
124impl<'a, REG> DATATYPE_W<'a, REG>
125where
126 REG: crate::Writable + crate::RegisterSpec,
127 REG::Ux: From<u8>,
128{
129 #[inline(always)]
131 pub fn none(self) -> &'a mut crate::W<REG> {
132 self.variant(DATATYPE::None)
133 }
134 #[inline(always)]
136 pub fn half_word(self) -> &'a mut crate::W<REG> {
137 self.variant(DATATYPE::HalfWord)
138 }
139 #[inline(always)]
141 pub fn byte(self) -> &'a mut crate::W<REG> {
142 self.variant(DATATYPE::Byte)
143 }
144 #[inline(always)]
146 pub fn bit_(self) -> &'a mut crate::W<REG> {
147 self.variant(DATATYPE::Bit)
148 }
149}
150#[cfg_attr(feature = "defmt", derive(defmt::Format))]
154#[derive(Clone, Copy, Debug, PartialEq, Eq)]
155#[repr(u8)]
156pub enum MODE {
157 Mode1 = 0,
159 Mode2 = 1,
161 Mode3 = 2,
163 Mode4 = 3,
165}
166impl From<MODE> for u8 {
167 #[inline(always)]
168 fn from(variant: MODE) -> Self {
169 variant as _
170 }
171}
172impl crate::FieldSpec for MODE {
173 type Ux = u8;
174}
175impl crate::IsEnum for MODE {}
176pub type MODE_R = crate::FieldReader<MODE>;
178impl MODE_R {
179 #[inline(always)]
181 pub const fn variant(&self) -> MODE {
182 match self.bits {
183 0 => MODE::Mode1,
184 1 => MODE::Mode2,
185 2 => MODE::Mode3,
186 3 => MODE::Mode4,
187 _ => unreachable!(),
188 }
189 }
190 #[inline(always)]
192 pub fn is_mode1(&self) -> bool {
193 *self == MODE::Mode1
194 }
195 #[inline(always)]
197 pub fn is_mode2(&self) -> bool {
198 *self == MODE::Mode2
199 }
200 #[inline(always)]
202 pub fn is_mode3(&self) -> bool {
203 *self == MODE::Mode3
204 }
205 #[inline(always)]
207 pub fn is_mode4(&self) -> bool {
208 *self == MODE::Mode4
209 }
210}
211pub type MODE_W<'a, REG> = crate::FieldWriter<'a, REG, 2, MODE, crate::Safe>;
213impl<'a, REG> MODE_W<'a, REG>
214where
215 REG: crate::Writable + crate::RegisterSpec,
216 REG::Ux: From<u8>,
217{
218 #[inline(always)]
220 pub fn mode1(self) -> &'a mut crate::W<REG> {
221 self.variant(MODE::Mode1)
222 }
223 #[inline(always)]
225 pub fn mode2(self) -> &'a mut crate::W<REG> {
226 self.variant(MODE::Mode2)
227 }
228 #[inline(always)]
230 pub fn mode3(self) -> &'a mut crate::W<REG> {
231 self.variant(MODE::Mode3)
232 }
233 #[inline(always)]
235 pub fn mode4(self) -> &'a mut crate::W<REG> {
236 self.variant(MODE::Mode4)
237 }
238}
239#[cfg_attr(feature = "defmt", derive(defmt::Format))]
243#[derive(Clone, Copy, Debug, PartialEq, Eq)]
244#[repr(u8)]
245pub enum CHMOD {
246 Ecb = 0,
248 Cbc = 1,
250 Ctr = 2,
252 Gcm = 3,
254}
255impl From<CHMOD> for u8 {
256 #[inline(always)]
257 fn from(variant: CHMOD) -> Self {
258 variant as _
259 }
260}
261impl crate::FieldSpec for CHMOD {
262 type Ux = u8;
263}
264impl crate::IsEnum for CHMOD {}
265pub type CHMOD_R = crate::FieldReader<CHMOD>;
267impl CHMOD_R {
268 #[inline(always)]
270 pub const fn variant(&self) -> CHMOD {
271 match self.bits {
272 0 => CHMOD::Ecb,
273 1 => CHMOD::Cbc,
274 2 => CHMOD::Ctr,
275 3 => CHMOD::Gcm,
276 _ => unreachable!(),
277 }
278 }
279 #[inline(always)]
281 pub fn is_ecb(&self) -> bool {
282 *self == CHMOD::Ecb
283 }
284 #[inline(always)]
286 pub fn is_cbc(&self) -> bool {
287 *self == CHMOD::Cbc
288 }
289 #[inline(always)]
291 pub fn is_ctr(&self) -> bool {
292 *self == CHMOD::Ctr
293 }
294 #[inline(always)]
296 pub fn is_gcm(&self) -> bool {
297 *self == CHMOD::Gcm
298 }
299}
300pub type CHMOD_W<'a, REG> = crate::FieldWriter<'a, REG, 2, CHMOD, crate::Safe>;
302impl<'a, REG> CHMOD_W<'a, REG>
303where
304 REG: crate::Writable + crate::RegisterSpec,
305 REG::Ux: From<u8>,
306{
307 #[inline(always)]
309 pub fn ecb(self) -> &'a mut crate::W<REG> {
310 self.variant(CHMOD::Ecb)
311 }
312 #[inline(always)]
314 pub fn cbc(self) -> &'a mut crate::W<REG> {
315 self.variant(CHMOD::Cbc)
316 }
317 #[inline(always)]
319 pub fn ctr(self) -> &'a mut crate::W<REG> {
320 self.variant(CHMOD::Ctr)
321 }
322 #[inline(always)]
324 pub fn gcm(self) -> &'a mut crate::W<REG> {
325 self.variant(CHMOD::Gcm)
326 }
327}
328#[cfg_attr(feature = "defmt", derive(defmt::Format))]
332#[derive(Clone, Copy, Debug, PartialEq, Eq)]
333pub enum DMAINEN {
334 Disabled = 0,
336 Enabled = 1,
338}
339impl From<DMAINEN> for bool {
340 #[inline(always)]
341 fn from(variant: DMAINEN) -> Self {
342 variant as u8 != 0
343 }
344}
345pub type DMAINEN_R = crate::BitReader<DMAINEN>;
347impl DMAINEN_R {
348 #[inline(always)]
350 pub const fn variant(&self) -> DMAINEN {
351 match self.bits {
352 false => DMAINEN::Disabled,
353 true => DMAINEN::Enabled,
354 }
355 }
356 #[inline(always)]
358 pub fn is_disabled(&self) -> bool {
359 *self == DMAINEN::Disabled
360 }
361 #[inline(always)]
363 pub fn is_enabled(&self) -> bool {
364 *self == DMAINEN::Enabled
365 }
366}
367pub type DMAINEN_W<'a, REG> = crate::BitWriter<'a, REG, DMAINEN>;
369impl<'a, REG> DMAINEN_W<'a, REG>
370where
371 REG: crate::Writable + crate::RegisterSpec,
372{
373 #[inline(always)]
375 pub fn disabled(self) -> &'a mut crate::W<REG> {
376 self.variant(DMAINEN::Disabled)
377 }
378 #[inline(always)]
380 pub fn enabled(self) -> &'a mut crate::W<REG> {
381 self.variant(DMAINEN::Enabled)
382 }
383}
384#[cfg_attr(feature = "defmt", derive(defmt::Format))]
388#[derive(Clone, Copy, Debug, PartialEq, Eq)]
389pub enum DMAOUTEN {
390 Disabled = 0,
392 Enabled = 1,
394}
395impl From<DMAOUTEN> for bool {
396 #[inline(always)]
397 fn from(variant: DMAOUTEN) -> Self {
398 variant as u8 != 0
399 }
400}
401pub type DMAOUTEN_R = crate::BitReader<DMAOUTEN>;
403impl DMAOUTEN_R {
404 #[inline(always)]
406 pub const fn variant(&self) -> DMAOUTEN {
407 match self.bits {
408 false => DMAOUTEN::Disabled,
409 true => DMAOUTEN::Enabled,
410 }
411 }
412 #[inline(always)]
414 pub fn is_disabled(&self) -> bool {
415 *self == DMAOUTEN::Disabled
416 }
417 #[inline(always)]
419 pub fn is_enabled(&self) -> bool {
420 *self == DMAOUTEN::Enabled
421 }
422}
423pub type DMAOUTEN_W<'a, REG> = crate::BitWriter<'a, REG, DMAOUTEN>;
425impl<'a, REG> DMAOUTEN_W<'a, REG>
426where
427 REG: crate::Writable + crate::RegisterSpec,
428{
429 #[inline(always)]
431 pub fn disabled(self) -> &'a mut crate::W<REG> {
432 self.variant(DMAOUTEN::Disabled)
433 }
434 #[inline(always)]
436 pub fn enabled(self) -> &'a mut crate::W<REG> {
437 self.variant(DMAOUTEN::Enabled)
438 }
439}
440#[cfg_attr(feature = "defmt", derive(defmt::Format))]
444#[derive(Clone, Copy, Debug, PartialEq, Eq)]
445#[repr(u8)]
446pub enum GCMPH {
447 Init = 0,
449 Header = 1,
451 Payload = 2,
453 Final = 3,
455}
456impl From<GCMPH> for u8 {
457 #[inline(always)]
458 fn from(variant: GCMPH) -> Self {
459 variant as _
460 }
461}
462impl crate::FieldSpec for GCMPH {
463 type Ux = u8;
464}
465impl crate::IsEnum for GCMPH {}
466pub type GCMPH_R = crate::FieldReader<GCMPH>;
468impl GCMPH_R {
469 #[inline(always)]
471 pub const fn variant(&self) -> GCMPH {
472 match self.bits {
473 0 => GCMPH::Init,
474 1 => GCMPH::Header,
475 2 => GCMPH::Payload,
476 3 => GCMPH::Final,
477 _ => unreachable!(),
478 }
479 }
480 #[inline(always)]
482 pub fn is_init(&self) -> bool {
483 *self == GCMPH::Init
484 }
485 #[inline(always)]
487 pub fn is_header(&self) -> bool {
488 *self == GCMPH::Header
489 }
490 #[inline(always)]
492 pub fn is_payload(&self) -> bool {
493 *self == GCMPH::Payload
494 }
495 #[inline(always)]
497 pub fn is_final(&self) -> bool {
498 *self == GCMPH::Final
499 }
500}
501pub type GCMPH_W<'a, REG> = crate::FieldWriter<'a, REG, 2, GCMPH, crate::Safe>;
503impl<'a, REG> GCMPH_W<'a, REG>
504where
505 REG: crate::Writable + crate::RegisterSpec,
506 REG::Ux: From<u8>,
507{
508 #[inline(always)]
510 pub fn init(self) -> &'a mut crate::W<REG> {
511 self.variant(GCMPH::Init)
512 }
513 #[inline(always)]
515 pub fn header(self) -> &'a mut crate::W<REG> {
516 self.variant(GCMPH::Header)
517 }
518 #[inline(always)]
520 pub fn payload(self) -> &'a mut crate::W<REG> {
521 self.variant(GCMPH::Payload)
522 }
523 #[inline(always)]
525 pub fn final_(self) -> &'a mut crate::W<REG> {
526 self.variant(GCMPH::Final)
527 }
528}
529#[cfg_attr(feature = "defmt", derive(defmt::Format))]
533#[derive(Clone, Copy, Debug, PartialEq, Eq)]
534pub enum CHMOD_2 {
535 Chmod = 0,
537 Ccm = 1,
539}
540impl From<CHMOD_2> for bool {
541 #[inline(always)]
542 fn from(variant: CHMOD_2) -> Self {
543 variant as u8 != 0
544 }
545}
546pub type CHMOD_2_R = crate::BitReader<CHMOD_2>;
548impl CHMOD_2_R {
549 #[inline(always)]
551 pub const fn variant(&self) -> CHMOD_2 {
552 match self.bits {
553 false => CHMOD_2::Chmod,
554 true => CHMOD_2::Ccm,
555 }
556 }
557 #[inline(always)]
559 pub fn is_chmod(&self) -> bool {
560 *self == CHMOD_2::Chmod
561 }
562 #[inline(always)]
564 pub fn is_ccm(&self) -> bool {
565 *self == CHMOD_2::Ccm
566 }
567}
568pub type CHMOD_2_W<'a, REG> = crate::BitWriter<'a, REG, CHMOD_2>;
570impl<'a, REG> CHMOD_2_W<'a, REG>
571where
572 REG: crate::Writable + crate::RegisterSpec,
573{
574 #[inline(always)]
576 pub fn chmod(self) -> &'a mut crate::W<REG> {
577 self.variant(CHMOD_2::Chmod)
578 }
579 #[inline(always)]
581 pub fn ccm(self) -> &'a mut crate::W<REG> {
582 self.variant(CHMOD_2::Ccm)
583 }
584}
585#[cfg_attr(feature = "defmt", derive(defmt::Format))]
589#[derive(Clone, Copy, Debug, PartialEq, Eq)]
590pub enum KEYSIZE {
591 Aes128 = 0,
593 Aes256 = 1,
595}
596impl From<KEYSIZE> for bool {
597 #[inline(always)]
598 fn from(variant: KEYSIZE) -> Self {
599 variant as u8 != 0
600 }
601}
602pub type KEYSIZE_R = crate::BitReader<KEYSIZE>;
604impl KEYSIZE_R {
605 #[inline(always)]
607 pub const fn variant(&self) -> KEYSIZE {
608 match self.bits {
609 false => KEYSIZE::Aes128,
610 true => KEYSIZE::Aes256,
611 }
612 }
613 #[inline(always)]
615 pub fn is_aes128(&self) -> bool {
616 *self == KEYSIZE::Aes128
617 }
618 #[inline(always)]
620 pub fn is_aes256(&self) -> bool {
621 *self == KEYSIZE::Aes256
622 }
623}
624pub type KEYSIZE_W<'a, REG> = crate::BitWriter<'a, REG, KEYSIZE>;
626impl<'a, REG> KEYSIZE_W<'a, REG>
627where
628 REG: crate::Writable + crate::RegisterSpec,
629{
630 #[inline(always)]
632 pub fn aes128(self) -> &'a mut crate::W<REG> {
633 self.variant(KEYSIZE::Aes128)
634 }
635 #[inline(always)]
637 pub fn aes256(self) -> &'a mut crate::W<REG> {
638 self.variant(KEYSIZE::Aes256)
639 }
640}
641pub type NPBLB_R = crate::FieldReader;
643pub type NPBLB_W<'a, REG> = crate::FieldWriter<'a, REG, 4, u8, crate::Safe>;
645#[cfg_attr(feature = "defmt", derive(defmt::Format))]
649#[derive(Clone, Copy, Debug, PartialEq, Eq)]
650#[repr(u8)]
651pub enum KMOD {
652 NormalKey = 0,
654 SharedKey = 2,
656}
657impl From<KMOD> for u8 {
658 #[inline(always)]
659 fn from(variant: KMOD) -> Self {
660 variant as _
661 }
662}
663impl crate::FieldSpec for KMOD {
664 type Ux = u8;
665}
666impl crate::IsEnum for KMOD {}
667pub type KMOD_R = crate::FieldReader<KMOD>;
669impl KMOD_R {
670 #[inline(always)]
672 pub const fn variant(&self) -> Option<KMOD> {
673 match self.bits {
674 0 => Some(KMOD::NormalKey),
675 2 => Some(KMOD::SharedKey),
676 _ => None,
677 }
678 }
679 #[inline(always)]
681 pub fn is_normal_key(&self) -> bool {
682 *self == KMOD::NormalKey
683 }
684 #[inline(always)]
686 pub fn is_shared_key(&self) -> bool {
687 *self == KMOD::SharedKey
688 }
689}
690pub type KMOD_W<'a, REG> = crate::FieldWriter<'a, REG, 2, KMOD>;
692impl<'a, REG> KMOD_W<'a, REG>
693where
694 REG: crate::Writable + crate::RegisterSpec,
695 REG::Ux: From<u8>,
696{
697 #[inline(always)]
699 pub fn normal_key(self) -> &'a mut crate::W<REG> {
700 self.variant(KMOD::NormalKey)
701 }
702 #[inline(always)]
704 pub fn shared_key(self) -> &'a mut crate::W<REG> {
705 self.variant(KMOD::SharedKey)
706 }
707}
708pub type IPRST_R = crate::BitReader;
710pub type IPRST_W<'a, REG> = crate::BitWriter<'a, REG>;
712impl R {
713 #[inline(always)]
715 pub fn en(&self) -> EN_R {
716 EN_R::new((self.bits & 1) != 0)
717 }
718 #[inline(always)]
720 pub fn datatype(&self) -> DATATYPE_R {
721 DATATYPE_R::new(((self.bits >> 1) & 3) as u8)
722 }
723 #[inline(always)]
725 pub fn mode(&self) -> MODE_R {
726 MODE_R::new(((self.bits >> 3) & 3) as u8)
727 }
728 #[inline(always)]
730 pub fn chmod(&self) -> CHMOD_R {
731 CHMOD_R::new(((self.bits >> 5) & 3) as u8)
732 }
733 #[inline(always)]
735 pub fn dmainen(&self) -> DMAINEN_R {
736 DMAINEN_R::new(((self.bits >> 11) & 1) != 0)
737 }
738 #[inline(always)]
740 pub fn dmaouten(&self) -> DMAOUTEN_R {
741 DMAOUTEN_R::new(((self.bits >> 12) & 1) != 0)
742 }
743 #[inline(always)]
745 pub fn gcmph(&self) -> GCMPH_R {
746 GCMPH_R::new(((self.bits >> 13) & 3) as u8)
747 }
748 #[inline(always)]
750 pub fn chmod_2(&self) -> CHMOD_2_R {
751 CHMOD_2_R::new(((self.bits >> 16) & 1) != 0)
752 }
753 #[inline(always)]
755 pub fn keysize(&self) -> KEYSIZE_R {
756 KEYSIZE_R::new(((self.bits >> 18) & 1) != 0)
757 }
758 #[inline(always)]
760 pub fn npblb(&self) -> NPBLB_R {
761 NPBLB_R::new(((self.bits >> 20) & 0x0f) as u8)
762 }
763 #[inline(always)]
765 pub fn kmod(&self) -> KMOD_R {
766 KMOD_R::new(((self.bits >> 24) & 3) as u8)
767 }
768 #[inline(always)]
770 pub fn iprst(&self) -> IPRST_R {
771 IPRST_R::new(((self.bits >> 31) & 1) != 0)
772 }
773}
774impl core::fmt::Debug for R {
775 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
776 f.debug_struct("CR")
777 .field("iprst", &self.iprst())
778 .field("kmod", &self.kmod())
779 .field("npblb", &self.npblb())
780 .field("keysize", &self.keysize())
781 .field("chmod_2", &self.chmod_2())
782 .field("gcmph", &self.gcmph())
783 .field("dmaouten", &self.dmaouten())
784 .field("dmainen", &self.dmainen())
785 .field("chmod", &self.chmod())
786 .field("mode", &self.mode())
787 .field("datatype", &self.datatype())
788 .field("en", &self.en())
789 .finish()
790 }
791}
792impl W {
793 #[inline(always)]
795 pub fn en(&mut self) -> EN_W<CRrs> {
796 EN_W::new(self, 0)
797 }
798 #[inline(always)]
800 pub fn datatype(&mut self) -> DATATYPE_W<CRrs> {
801 DATATYPE_W::new(self, 1)
802 }
803 #[inline(always)]
805 pub fn mode(&mut self) -> MODE_W<CRrs> {
806 MODE_W::new(self, 3)
807 }
808 #[inline(always)]
810 pub fn chmod(&mut self) -> CHMOD_W<CRrs> {
811 CHMOD_W::new(self, 5)
812 }
813 #[inline(always)]
815 pub fn dmainen(&mut self) -> DMAINEN_W<CRrs> {
816 DMAINEN_W::new(self, 11)
817 }
818 #[inline(always)]
820 pub fn dmaouten(&mut self) -> DMAOUTEN_W<CRrs> {
821 DMAOUTEN_W::new(self, 12)
822 }
823 #[inline(always)]
825 pub fn gcmph(&mut self) -> GCMPH_W<CRrs> {
826 GCMPH_W::new(self, 13)
827 }
828 #[inline(always)]
830 pub fn chmod_2(&mut self) -> CHMOD_2_W<CRrs> {
831 CHMOD_2_W::new(self, 16)
832 }
833 #[inline(always)]
835 pub fn keysize(&mut self) -> KEYSIZE_W<CRrs> {
836 KEYSIZE_W::new(self, 18)
837 }
838 #[inline(always)]
840 pub fn npblb(&mut self) -> NPBLB_W<CRrs> {
841 NPBLB_W::new(self, 20)
842 }
843 #[inline(always)]
845 pub fn kmod(&mut self) -> KMOD_W<CRrs> {
846 KMOD_W::new(self, 24)
847 }
848 #[inline(always)]
850 pub fn iprst(&mut self) -> IPRST_W<CRrs> {
851 IPRST_W::new(self, 31)
852 }
853}
854pub struct CRrs;
860impl crate::RegisterSpec for CRrs {
861 type Ux = u32;
862}
863impl crate::Readable for CRrs {}
865impl crate::Writable for CRrs {
867 type Safety = crate::Unsafe;
868}
869impl crate::Resettable for CRrs {}