1#[doc = "Reader of register CR"]
2pub type R = crate::R<u32, super::CR>;
3#[doc = "Writer for register CR"]
4pub type W = crate::W<u32, super::CR>;
5#[doc = "Register CR `reset()`'s with value 0"]
6impl crate::ResetValue for super::CR {
7 type Type = u32;
8 #[inline(always)]
9 fn reset_value() -> Self::Type {
10 0
11 }
12}
13#[doc = "Reader of field `NPBLB`"]
14pub type NPBLB_R = crate::R<u8, u8>;
15#[doc = "Write proxy for field `NPBLB`"]
16pub struct NPBLB_W<'a> {
17 w: &'a mut W,
18}
19impl<'a> NPBLB_W<'a> {
20 #[doc = r"Writes raw bits to the field"]
21 #[inline(always)]
22 pub unsafe fn bits(self, value: u8) -> &'a mut W {
23 self.w.bits = (self.w.bits & !(0x0f << 20)) | (((value as u32) & 0x0f) << 20);
24 self.w
25 }
26}
27#[doc = "Reader of field `KEYSIZE`"]
28pub type KEYSIZE_R = crate::R<bool, bool>;
29#[doc = "Write proxy for field `KEYSIZE`"]
30pub struct KEYSIZE_W<'a> {
31 w: &'a mut W,
32}
33impl<'a> KEYSIZE_W<'a> {
34 #[doc = r"Sets the field bit"]
35 #[inline(always)]
36 pub fn set_bit(self) -> &'a mut W {
37 self.bit(true)
38 }
39 #[doc = r"Clears the field bit"]
40 #[inline(always)]
41 pub fn clear_bit(self) -> &'a mut W {
42 self.bit(false)
43 }
44 #[doc = r"Writes raw bits to the field"]
45 #[inline(always)]
46 pub fn bit(self, value: bool) -> &'a mut W {
47 self.w.bits = (self.w.bits & !(0x01 << 18)) | (((value as u32) & 0x01) << 18);
48 self.w
49 }
50}
51#[doc = "Reader of field `CHMOD2`"]
52pub type CHMOD2_R = crate::R<bool, bool>;
53#[doc = "Write proxy for field `CHMOD2`"]
54pub struct CHMOD2_W<'a> {
55 w: &'a mut W,
56}
57impl<'a> CHMOD2_W<'a> {
58 #[doc = r"Sets the field bit"]
59 #[inline(always)]
60 pub fn set_bit(self) -> &'a mut W {
61 self.bit(true)
62 }
63 #[doc = r"Clears the field bit"]
64 #[inline(always)]
65 pub fn clear_bit(self) -> &'a mut W {
66 self.bit(false)
67 }
68 #[doc = r"Writes raw bits to the field"]
69 #[inline(always)]
70 pub fn bit(self, value: bool) -> &'a mut W {
71 self.w.bits = (self.w.bits & !(0x01 << 16)) | (((value as u32) & 0x01) << 16);
72 self.w
73 }
74}
75#[doc = "Reader of field `GCMPH`"]
76pub type GCMPH_R = crate::R<u8, u8>;
77#[doc = "Write proxy for field `GCMPH`"]
78pub struct GCMPH_W<'a> {
79 w: &'a mut W,
80}
81impl<'a> GCMPH_W<'a> {
82 #[doc = r"Writes raw bits to the field"]
83 #[inline(always)]
84 pub unsafe fn bits(self, value: u8) -> &'a mut W {
85 self.w.bits = (self.w.bits & !(0x03 << 13)) | (((value as u32) & 0x03) << 13);
86 self.w
87 }
88}
89#[doc = "Reader of field `DMAOUTEN`"]
90pub type DMAOUTEN_R = crate::R<bool, bool>;
91#[doc = "Write proxy for field `DMAOUTEN`"]
92pub struct DMAOUTEN_W<'a> {
93 w: &'a mut W,
94}
95impl<'a> DMAOUTEN_W<'a> {
96 #[doc = r"Sets the field bit"]
97 #[inline(always)]
98 pub fn set_bit(self) -> &'a mut W {
99 self.bit(true)
100 }
101 #[doc = r"Clears the field bit"]
102 #[inline(always)]
103 pub fn clear_bit(self) -> &'a mut W {
104 self.bit(false)
105 }
106 #[doc = r"Writes raw bits to the field"]
107 #[inline(always)]
108 pub fn bit(self, value: bool) -> &'a mut W {
109 self.w.bits = (self.w.bits & !(0x01 << 12)) | (((value as u32) & 0x01) << 12);
110 self.w
111 }
112}
113#[doc = "Reader of field `DMAINEN`"]
114pub type DMAINEN_R = crate::R<bool, bool>;
115#[doc = "Write proxy for field `DMAINEN`"]
116pub struct DMAINEN_W<'a> {
117 w: &'a mut W,
118}
119impl<'a> DMAINEN_W<'a> {
120 #[doc = r"Sets the field bit"]
121 #[inline(always)]
122 pub fn set_bit(self) -> &'a mut W {
123 self.bit(true)
124 }
125 #[doc = r"Clears the field bit"]
126 #[inline(always)]
127 pub fn clear_bit(self) -> &'a mut W {
128 self.bit(false)
129 }
130 #[doc = r"Writes raw bits to the field"]
131 #[inline(always)]
132 pub fn bit(self, value: bool) -> &'a mut W {
133 self.w.bits = (self.w.bits & !(0x01 << 11)) | (((value as u32) & 0x01) << 11);
134 self.w
135 }
136}
137#[doc = "Reader of field `ERRIE`"]
138pub type ERRIE_R = crate::R<bool, bool>;
139#[doc = "Write proxy for field `ERRIE`"]
140pub struct ERRIE_W<'a> {
141 w: &'a mut W,
142}
143impl<'a> ERRIE_W<'a> {
144 #[doc = r"Sets the field bit"]
145 #[inline(always)]
146 pub fn set_bit(self) -> &'a mut W {
147 self.bit(true)
148 }
149 #[doc = r"Clears the field bit"]
150 #[inline(always)]
151 pub fn clear_bit(self) -> &'a mut W {
152 self.bit(false)
153 }
154 #[doc = r"Writes raw bits to the field"]
155 #[inline(always)]
156 pub fn bit(self, value: bool) -> &'a mut W {
157 self.w.bits = (self.w.bits & !(0x01 << 10)) | (((value as u32) & 0x01) << 10);
158 self.w
159 }
160}
161#[doc = "Reader of field `CCFIE`"]
162pub type CCFIE_R = crate::R<bool, bool>;
163#[doc = "Write proxy for field `CCFIE`"]
164pub struct CCFIE_W<'a> {
165 w: &'a mut W,
166}
167impl<'a> CCFIE_W<'a> {
168 #[doc = r"Sets the field bit"]
169 #[inline(always)]
170 pub fn set_bit(self) -> &'a mut W {
171 self.bit(true)
172 }
173 #[doc = r"Clears the field bit"]
174 #[inline(always)]
175 pub fn clear_bit(self) -> &'a mut W {
176 self.bit(false)
177 }
178 #[doc = r"Writes raw bits to the field"]
179 #[inline(always)]
180 pub fn bit(self, value: bool) -> &'a mut W {
181 self.w.bits = (self.w.bits & !(0x01 << 9)) | (((value as u32) & 0x01) << 9);
182 self.w
183 }
184}
185#[doc = "Reader of field `ERRC`"]
186pub type ERRC_R = crate::R<bool, bool>;
187#[doc = "Write proxy for field `ERRC`"]
188pub struct ERRC_W<'a> {
189 w: &'a mut W,
190}
191impl<'a> ERRC_W<'a> {
192 #[doc = r"Sets the field bit"]
193 #[inline(always)]
194 pub fn set_bit(self) -> &'a mut W {
195 self.bit(true)
196 }
197 #[doc = r"Clears the field bit"]
198 #[inline(always)]
199 pub fn clear_bit(self) -> &'a mut W {
200 self.bit(false)
201 }
202 #[doc = r"Writes raw bits to the field"]
203 #[inline(always)]
204 pub fn bit(self, value: bool) -> &'a mut W {
205 self.w.bits = (self.w.bits & !(0x01 << 8)) | (((value as u32) & 0x01) << 8);
206 self.w
207 }
208}
209#[doc = "Reader of field `CCFC`"]
210pub type CCFC_R = crate::R<bool, bool>;
211#[doc = "Write proxy for field `CCFC`"]
212pub struct CCFC_W<'a> {
213 w: &'a mut W,
214}
215impl<'a> CCFC_W<'a> {
216 #[doc = r"Sets the field bit"]
217 #[inline(always)]
218 pub fn set_bit(self) -> &'a mut W {
219 self.bit(true)
220 }
221 #[doc = r"Clears the field bit"]
222 #[inline(always)]
223 pub fn clear_bit(self) -> &'a mut W {
224 self.bit(false)
225 }
226 #[doc = r"Writes raw bits to the field"]
227 #[inline(always)]
228 pub fn bit(self, value: bool) -> &'a mut W {
229 self.w.bits = (self.w.bits & !(0x01 << 7)) | (((value as u32) & 0x01) << 7);
230 self.w
231 }
232}
233#[doc = "Reader of field `CHMOD10`"]
234pub type CHMOD10_R = crate::R<u8, u8>;
235#[doc = "Write proxy for field `CHMOD10`"]
236pub struct CHMOD10_W<'a> {
237 w: &'a mut W,
238}
239impl<'a> CHMOD10_W<'a> {
240 #[doc = r"Writes raw bits to the field"]
241 #[inline(always)]
242 pub unsafe fn bits(self, value: u8) -> &'a mut W {
243 self.w.bits = (self.w.bits & !(0x03 << 5)) | (((value as u32) & 0x03) << 5);
244 self.w
245 }
246}
247#[doc = "Reader of field `MODE`"]
248pub type MODE_R = crate::R<u8, u8>;
249#[doc = "Write proxy for field `MODE`"]
250pub struct MODE_W<'a> {
251 w: &'a mut W,
252}
253impl<'a> MODE_W<'a> {
254 #[doc = r"Writes raw bits to the field"]
255 #[inline(always)]
256 pub unsafe fn bits(self, value: u8) -> &'a mut W {
257 self.w.bits = (self.w.bits & !(0x03 << 3)) | (((value as u32) & 0x03) << 3);
258 self.w
259 }
260}
261#[doc = "Reader of field `DATATYPE`"]
262pub type DATATYPE_R = crate::R<u8, u8>;
263#[doc = "Write proxy for field `DATATYPE`"]
264pub struct DATATYPE_W<'a> {
265 w: &'a mut W,
266}
267impl<'a> DATATYPE_W<'a> {
268 #[doc = r"Writes raw bits to the field"]
269 #[inline(always)]
270 pub unsafe fn bits(self, value: u8) -> &'a mut W {
271 self.w.bits = (self.w.bits & !(0x03 << 1)) | (((value as u32) & 0x03) << 1);
272 self.w
273 }
274}
275#[doc = "Reader of field `EN`"]
276pub type EN_R = crate::R<bool, bool>;
277#[doc = "Write proxy for field `EN`"]
278pub struct EN_W<'a> {
279 w: &'a mut W,
280}
281impl<'a> EN_W<'a> {
282 #[doc = r"Sets the field bit"]
283 #[inline(always)]
284 pub fn set_bit(self) -> &'a mut W {
285 self.bit(true)
286 }
287 #[doc = r"Clears the field bit"]
288 #[inline(always)]
289 pub fn clear_bit(self) -> &'a mut W {
290 self.bit(false)
291 }
292 #[doc = r"Writes raw bits to the field"]
293 #[inline(always)]
294 pub fn bit(self, value: bool) -> &'a mut W {
295 self.w.bits = (self.w.bits & !0x01) | ((value as u32) & 0x01);
296 self.w
297 }
298}
299impl R {
300 #[doc = "Bits 20:23 - Number of padding bytes in last block of payload"]
301 #[inline(always)]
302 pub fn npblb(&self) -> NPBLB_R {
303 NPBLB_R::new(((self.bits >> 20) & 0x0f) as u8)
304 }
305 #[doc = "Bit 18 - Key size selection"]
306 #[inline(always)]
307 pub fn keysize(&self) -> KEYSIZE_R {
308 KEYSIZE_R::new(((self.bits >> 18) & 0x01) != 0)
309 }
310 #[doc = "Bit 16 - AES chaining mode Bit2"]
311 #[inline(always)]
312 pub fn chmod2(&self) -> CHMOD2_R {
313 CHMOD2_R::new(((self.bits >> 16) & 0x01) != 0)
314 }
315 #[doc = "Bits 13:14 - Used only for GCM, CCM and GMAC algorithms and has no effect when other algorithms are selected"]
316 #[inline(always)]
317 pub fn gcmph(&self) -> GCMPH_R {
318 GCMPH_R::new(((self.bits >> 13) & 0x03) as u8)
319 }
320 #[doc = "Bit 12 - Enable DMA management of data output phase"]
321 #[inline(always)]
322 pub fn dmaouten(&self) -> DMAOUTEN_R {
323 DMAOUTEN_R::new(((self.bits >> 12) & 0x01) != 0)
324 }
325 #[doc = "Bit 11 - Enable DMA management of data input phase"]
326 #[inline(always)]
327 pub fn dmainen(&self) -> DMAINEN_R {
328 DMAINEN_R::new(((self.bits >> 11) & 0x01) != 0)
329 }
330 #[doc = "Bit 10 - Error interrupt enable"]
331 #[inline(always)]
332 pub fn errie(&self) -> ERRIE_R {
333 ERRIE_R::new(((self.bits >> 10) & 0x01) != 0)
334 }
335 #[doc = "Bit 9 - CCF flag interrupt enable"]
336 #[inline(always)]
337 pub fn ccfie(&self) -> CCFIE_R {
338 CCFIE_R::new(((self.bits >> 9) & 0x01) != 0)
339 }
340 #[doc = "Bit 8 - Error clear"]
341 #[inline(always)]
342 pub fn errc(&self) -> ERRC_R {
343 ERRC_R::new(((self.bits >> 8) & 0x01) != 0)
344 }
345 #[doc = "Bit 7 - Computation Complete Flag Clear"]
346 #[inline(always)]
347 pub fn ccfc(&self) -> CCFC_R {
348 CCFC_R::new(((self.bits >> 7) & 0x01) != 0)
349 }
350 #[doc = "Bits 5:6 - AES chaining mode Bit1 Bit0"]
351 #[inline(always)]
352 pub fn chmod10(&self) -> CHMOD10_R {
353 CHMOD10_R::new(((self.bits >> 5) & 0x03) as u8)
354 }
355 #[doc = "Bits 3:4 - AES operating mode"]
356 #[inline(always)]
357 pub fn mode(&self) -> MODE_R {
358 MODE_R::new(((self.bits >> 3) & 0x03) as u8)
359 }
360 #[doc = "Bits 1:2 - Data type selection (for data in and data out to/from the cryptographic block)"]
361 #[inline(always)]
362 pub fn datatype(&self) -> DATATYPE_R {
363 DATATYPE_R::new(((self.bits >> 1) & 0x03) as u8)
364 }
365 #[doc = "Bit 0 - AES enable"]
366 #[inline(always)]
367 pub fn en(&self) -> EN_R {
368 EN_R::new((self.bits & 0x01) != 0)
369 }
370}
371impl W {
372 #[doc = "Bits 20:23 - Number of padding bytes in last block of payload"]
373 #[inline(always)]
374 pub fn npblb(&mut self) -> NPBLB_W {
375 NPBLB_W { w: self }
376 }
377 #[doc = "Bit 18 - Key size selection"]
378 #[inline(always)]
379 pub fn keysize(&mut self) -> KEYSIZE_W {
380 KEYSIZE_W { w: self }
381 }
382 #[doc = "Bit 16 - AES chaining mode Bit2"]
383 #[inline(always)]
384 pub fn chmod2(&mut self) -> CHMOD2_W {
385 CHMOD2_W { w: self }
386 }
387 #[doc = "Bits 13:14 - Used only for GCM, CCM and GMAC algorithms and has no effect when other algorithms are selected"]
388 #[inline(always)]
389 pub fn gcmph(&mut self) -> GCMPH_W {
390 GCMPH_W { w: self }
391 }
392 #[doc = "Bit 12 - Enable DMA management of data output phase"]
393 #[inline(always)]
394 pub fn dmaouten(&mut self) -> DMAOUTEN_W {
395 DMAOUTEN_W { w: self }
396 }
397 #[doc = "Bit 11 - Enable DMA management of data input phase"]
398 #[inline(always)]
399 pub fn dmainen(&mut self) -> DMAINEN_W {
400 DMAINEN_W { w: self }
401 }
402 #[doc = "Bit 10 - Error interrupt enable"]
403 #[inline(always)]
404 pub fn errie(&mut self) -> ERRIE_W {
405 ERRIE_W { w: self }
406 }
407 #[doc = "Bit 9 - CCF flag interrupt enable"]
408 #[inline(always)]
409 pub fn ccfie(&mut self) -> CCFIE_W {
410 CCFIE_W { w: self }
411 }
412 #[doc = "Bit 8 - Error clear"]
413 #[inline(always)]
414 pub fn errc(&mut self) -> ERRC_W {
415 ERRC_W { w: self }
416 }
417 #[doc = "Bit 7 - Computation Complete Flag Clear"]
418 #[inline(always)]
419 pub fn ccfc(&mut self) -> CCFC_W {
420 CCFC_W { w: self }
421 }
422 #[doc = "Bits 5:6 - AES chaining mode Bit1 Bit0"]
423 #[inline(always)]
424 pub fn chmod10(&mut self) -> CHMOD10_W {
425 CHMOD10_W { w: self }
426 }
427 #[doc = "Bits 3:4 - AES operating mode"]
428 #[inline(always)]
429 pub fn mode(&mut self) -> MODE_W {
430 MODE_W { w: self }
431 }
432 #[doc = "Bits 1:2 - Data type selection (for data in and data out to/from the cryptographic block)"]
433 #[inline(always)]
434 pub fn datatype(&mut self) -> DATATYPE_W {
435 DATATYPE_W { w: self }
436 }
437 #[doc = "Bit 0 - AES enable"]
438 #[inline(always)]
439 pub fn en(&mut self) -> EN_W {
440 EN_W { w: self }
441 }
442}