atsaml22j/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 = "Field `AESMODE` reader - AES Modes of operation"]
14pub type AesmodeR = crate::FieldReader;
15#[doc = "Field `AESMODE` writer - AES Modes of operation"]
16pub type AesmodeW<'a, REG> = crate::FieldWriter<'a, REG, 3>;
17#[doc = "Field `CFBS` reader - CFB Types"]
18pub type CfbsR = crate::FieldReader;
19#[doc = "Field `CFBS` writer - CFB Types"]
20pub type CfbsW<'a, REG> = crate::FieldWriter<'a, REG, 3>;
21#[doc = "Field `KEYSIZE` reader - Keysize"]
22pub type KeysizeR = crate::FieldReader;
23#[doc = "Field `KEYSIZE` writer - Keysize"]
24pub type KeysizeW<'a, REG> = crate::FieldWriter<'a, REG, 2>;
25#[doc = "Field `CIPHER` reader - Cipher mode"]
26pub type CipherR = crate::BitReader;
27#[doc = "Field `CIPHER` writer - Cipher mode"]
28pub type CipherW<'a, REG> = crate::BitWriter<'a, REG>;
29#[doc = "Field `STARTMODE` reader - Start mode"]
30pub type StartmodeR = crate::BitReader;
31#[doc = "Field `STARTMODE` writer - Start mode"]
32pub type StartmodeW<'a, REG> = crate::BitWriter<'a, REG>;
33#[doc = "Field `LOD` reader - LOD Enable"]
34pub type LodR = crate::BitReader;
35#[doc = "Field `LOD` writer - LOD Enable"]
36pub type LodW<'a, REG> = crate::BitWriter<'a, REG>;
37#[doc = "Field `KEYGEN` reader - Last key generation"]
38pub type KeygenR = crate::BitReader;
39#[doc = "Field `KEYGEN` writer - Last key generation"]
40pub type KeygenW<'a, REG> = crate::BitWriter<'a, REG>;
41#[doc = "Field `XORKEY` reader - Xor Key operation"]
42pub type XorkeyR = crate::BitReader;
43#[doc = "Field `XORKEY` writer - Xor Key operation"]
44pub type XorkeyW<'a, REG> = crate::BitWriter<'a, REG>;
45#[doc = "Field `CTYPE` reader - Counter measure types"]
46pub type CtypeR = crate::FieldReader;
47#[doc = "Field `CTYPE` writer - Counter measure types"]
48pub type CtypeW<'a, REG> = crate::FieldWriter<'a, REG, 4>;
49impl R {
50    #[doc = "Bit 0 - Software Reset"]
51    #[inline(always)]
52    pub fn swrst(&self) -> SwrstR {
53        SwrstR::new((self.bits & 1) != 0)
54    }
55    #[doc = "Bit 1 - Enable"]
56    #[inline(always)]
57    pub fn enable(&self) -> EnableR {
58        EnableR::new(((self.bits >> 1) & 1) != 0)
59    }
60    #[doc = "Bits 2:4 - AES Modes of operation"]
61    #[inline(always)]
62    pub fn aesmode(&self) -> AesmodeR {
63        AesmodeR::new(((self.bits >> 2) & 7) as u8)
64    }
65    #[doc = "Bits 5:7 - CFB Types"]
66    #[inline(always)]
67    pub fn cfbs(&self) -> CfbsR {
68        CfbsR::new(((self.bits >> 5) & 7) as u8)
69    }
70    #[doc = "Bits 8:9 - Keysize"]
71    #[inline(always)]
72    pub fn keysize(&self) -> KeysizeR {
73        KeysizeR::new(((self.bits >> 8) & 3) as u8)
74    }
75    #[doc = "Bit 10 - Cipher mode"]
76    #[inline(always)]
77    pub fn cipher(&self) -> CipherR {
78        CipherR::new(((self.bits >> 10) & 1) != 0)
79    }
80    #[doc = "Bit 11 - Start mode"]
81    #[inline(always)]
82    pub fn startmode(&self) -> StartmodeR {
83        StartmodeR::new(((self.bits >> 11) & 1) != 0)
84    }
85    #[doc = "Bit 12 - LOD Enable"]
86    #[inline(always)]
87    pub fn lod(&self) -> LodR {
88        LodR::new(((self.bits >> 12) & 1) != 0)
89    }
90    #[doc = "Bit 13 - Last key generation"]
91    #[inline(always)]
92    pub fn keygen(&self) -> KeygenR {
93        KeygenR::new(((self.bits >> 13) & 1) != 0)
94    }
95    #[doc = "Bit 14 - Xor Key operation"]
96    #[inline(always)]
97    pub fn xorkey(&self) -> XorkeyR {
98        XorkeyR::new(((self.bits >> 14) & 1) != 0)
99    }
100    #[doc = "Bits 16:19 - Counter measure types"]
101    #[inline(always)]
102    pub fn ctype(&self) -> CtypeR {
103        CtypeR::new(((self.bits >> 16) & 0x0f) as u8)
104    }
105}
106impl W {
107    #[doc = "Bit 0 - Software Reset"]
108    #[inline(always)]
109    pub fn swrst(&mut self) -> SwrstW<CtrlaSpec> {
110        SwrstW::new(self, 0)
111    }
112    #[doc = "Bit 1 - Enable"]
113    #[inline(always)]
114    pub fn enable(&mut self) -> EnableW<CtrlaSpec> {
115        EnableW::new(self, 1)
116    }
117    #[doc = "Bits 2:4 - AES Modes of operation"]
118    #[inline(always)]
119    pub fn aesmode(&mut self) -> AesmodeW<CtrlaSpec> {
120        AesmodeW::new(self, 2)
121    }
122    #[doc = "Bits 5:7 - CFB Types"]
123    #[inline(always)]
124    pub fn cfbs(&mut self) -> CfbsW<CtrlaSpec> {
125        CfbsW::new(self, 5)
126    }
127    #[doc = "Bits 8:9 - Keysize"]
128    #[inline(always)]
129    pub fn keysize(&mut self) -> KeysizeW<CtrlaSpec> {
130        KeysizeW::new(self, 8)
131    }
132    #[doc = "Bit 10 - Cipher mode"]
133    #[inline(always)]
134    pub fn cipher(&mut self) -> CipherW<CtrlaSpec> {
135        CipherW::new(self, 10)
136    }
137    #[doc = "Bit 11 - Start mode"]
138    #[inline(always)]
139    pub fn startmode(&mut self) -> StartmodeW<CtrlaSpec> {
140        StartmodeW::new(self, 11)
141    }
142    #[doc = "Bit 12 - LOD Enable"]
143    #[inline(always)]
144    pub fn lod(&mut self) -> LodW<CtrlaSpec> {
145        LodW::new(self, 12)
146    }
147    #[doc = "Bit 13 - Last key generation"]
148    #[inline(always)]
149    pub fn keygen(&mut self) -> KeygenW<CtrlaSpec> {
150        KeygenW::new(self, 13)
151    }
152    #[doc = "Bit 14 - Xor Key operation"]
153    #[inline(always)]
154    pub fn xorkey(&mut self) -> XorkeyW<CtrlaSpec> {
155        XorkeyW::new(self, 14)
156    }
157    #[doc = "Bits 16:19 - Counter measure types"]
158    #[inline(always)]
159    pub fn ctype(&mut self) -> CtypeW<CtrlaSpec> {
160        CtypeW::new(self, 16)
161    }
162}
163#[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)."]
164pub struct CtrlaSpec;
165impl crate::RegisterSpec for CtrlaSpec {
166    type Ux = u32;
167}
168#[doc = "`read()` method returns [`ctrla::R`](R) reader structure"]
169impl crate::Readable for CtrlaSpec {}
170#[doc = "`write(|w| ..)` method takes [`ctrla::W`](W) writer structure"]
171impl crate::Writable for CtrlaSpec {
172    type Safety = crate::Unsafe;
173    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
174    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
175}
176#[doc = "`reset()` method sets CTRLA to value 0"]
177impl crate::Resettable for CtrlaSpec {
178    const RESET_VALUE: u32 = 0;
179}