stm32l4x2_pac/aes/
cr.rs

1#[doc = r" Value read from the register"]
2pub struct R {
3    bits: u32,
4}
5#[doc = r" Value to write to the register"]
6pub struct W {
7    bits: u32,
8}
9impl super::CR {
10    #[doc = r" Modifies the contents of the register"]
11    #[inline]
12    pub fn modify<F>(&self, f: F)
13    where
14        for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
15    {
16        let bits = self.register.get();
17        let r = R { bits: bits };
18        let mut w = W { bits: bits };
19        f(&r, &mut w);
20        self.register.set(w.bits);
21    }
22    #[doc = r" Reads the contents of the register"]
23    #[inline]
24    pub fn read(&self) -> R {
25        R {
26            bits: self.register.get(),
27        }
28    }
29    #[doc = r" Writes to the register"]
30    #[inline]
31    pub fn write<F>(&self, f: F)
32    where
33        F: FnOnce(&mut W) -> &mut W,
34    {
35        let mut w = W::reset_value();
36        f(&mut w);
37        self.register.set(w.bits);
38    }
39    #[doc = r" Writes the reset value to the register"]
40    #[inline]
41    pub fn reset(&self) {
42        self.write(|w| w)
43    }
44}
45#[doc = r" Value of the field"]
46pub struct DMAOUTENR {
47    bits: bool,
48}
49impl DMAOUTENR {
50    #[doc = r" Value of the field as raw bits"]
51    #[inline]
52    pub fn bit(&self) -> bool {
53        self.bits
54    }
55    #[doc = r" Returns `true` if the bit is clear (0)"]
56    #[inline]
57    pub fn bit_is_clear(&self) -> bool {
58        !self.bit()
59    }
60    #[doc = r" Returns `true` if the bit is set (1)"]
61    #[inline]
62    pub fn bit_is_set(&self) -> bool {
63        self.bit()
64    }
65}
66#[doc = r" Value of the field"]
67pub struct DMAINENR {
68    bits: bool,
69}
70impl DMAINENR {
71    #[doc = r" Value of the field as raw bits"]
72    #[inline]
73    pub fn bit(&self) -> bool {
74        self.bits
75    }
76    #[doc = r" Returns `true` if the bit is clear (0)"]
77    #[inline]
78    pub fn bit_is_clear(&self) -> bool {
79        !self.bit()
80    }
81    #[doc = r" Returns `true` if the bit is set (1)"]
82    #[inline]
83    pub fn bit_is_set(&self) -> bool {
84        self.bit()
85    }
86}
87#[doc = r" Value of the field"]
88pub struct ERRIER {
89    bits: bool,
90}
91impl ERRIER {
92    #[doc = r" Value of the field as raw bits"]
93    #[inline]
94    pub fn bit(&self) -> bool {
95        self.bits
96    }
97    #[doc = r" Returns `true` if the bit is clear (0)"]
98    #[inline]
99    pub fn bit_is_clear(&self) -> bool {
100        !self.bit()
101    }
102    #[doc = r" Returns `true` if the bit is set (1)"]
103    #[inline]
104    pub fn bit_is_set(&self) -> bool {
105        self.bit()
106    }
107}
108#[doc = r" Value of the field"]
109pub struct CCFIER {
110    bits: bool,
111}
112impl CCFIER {
113    #[doc = r" Value of the field as raw bits"]
114    #[inline]
115    pub fn bit(&self) -> bool {
116        self.bits
117    }
118    #[doc = r" Returns `true` if the bit is clear (0)"]
119    #[inline]
120    pub fn bit_is_clear(&self) -> bool {
121        !self.bit()
122    }
123    #[doc = r" Returns `true` if the bit is set (1)"]
124    #[inline]
125    pub fn bit_is_set(&self) -> bool {
126        self.bit()
127    }
128}
129#[doc = r" Value of the field"]
130pub struct ERRCR {
131    bits: bool,
132}
133impl ERRCR {
134    #[doc = r" Value of the field as raw bits"]
135    #[inline]
136    pub fn bit(&self) -> bool {
137        self.bits
138    }
139    #[doc = r" Returns `true` if the bit is clear (0)"]
140    #[inline]
141    pub fn bit_is_clear(&self) -> bool {
142        !self.bit()
143    }
144    #[doc = r" Returns `true` if the bit is set (1)"]
145    #[inline]
146    pub fn bit_is_set(&self) -> bool {
147        self.bit()
148    }
149}
150#[doc = r" Value of the field"]
151pub struct CCFCR {
152    bits: bool,
153}
154impl CCFCR {
155    #[doc = r" Value of the field as raw bits"]
156    #[inline]
157    pub fn bit(&self) -> bool {
158        self.bits
159    }
160    #[doc = r" Returns `true` if the bit is clear (0)"]
161    #[inline]
162    pub fn bit_is_clear(&self) -> bool {
163        !self.bit()
164    }
165    #[doc = r" Returns `true` if the bit is set (1)"]
166    #[inline]
167    pub fn bit_is_set(&self) -> bool {
168        self.bit()
169    }
170}
171#[doc = r" Value of the field"]
172pub struct CHMODR {
173    bits: u8,
174}
175impl CHMODR {
176    #[doc = r" Value of the field as raw bits"]
177    #[inline]
178    pub fn bits(&self) -> u8 {
179        self.bits
180    }
181}
182#[doc = r" Value of the field"]
183pub struct MODER {
184    bits: u8,
185}
186impl MODER {
187    #[doc = r" Value of the field as raw bits"]
188    #[inline]
189    pub fn bits(&self) -> u8 {
190        self.bits
191    }
192}
193#[doc = r" Value of the field"]
194pub struct DATATYPER {
195    bits: u8,
196}
197impl DATATYPER {
198    #[doc = r" Value of the field as raw bits"]
199    #[inline]
200    pub fn bits(&self) -> u8 {
201        self.bits
202    }
203}
204#[doc = r" Value of the field"]
205pub struct ENR {
206    bits: bool,
207}
208impl ENR {
209    #[doc = r" Value of the field as raw bits"]
210    #[inline]
211    pub fn bit(&self) -> bool {
212        self.bits
213    }
214    #[doc = r" Returns `true` if the bit is clear (0)"]
215    #[inline]
216    pub fn bit_is_clear(&self) -> bool {
217        !self.bit()
218    }
219    #[doc = r" Returns `true` if the bit is set (1)"]
220    #[inline]
221    pub fn bit_is_set(&self) -> bool {
222        self.bit()
223    }
224}
225#[doc = r" Proxy"]
226pub struct _DMAOUTENW<'a> {
227    w: &'a mut W,
228}
229impl<'a> _DMAOUTENW<'a> {
230    #[doc = r" Sets the field bit"]
231    pub fn set_bit(self) -> &'a mut W {
232        self.bit(true)
233    }
234    #[doc = r" Clears the field bit"]
235    pub fn clear_bit(self) -> &'a mut W {
236        self.bit(false)
237    }
238    #[doc = r" Writes raw bits to the field"]
239    #[inline]
240    pub fn bit(self, value: bool) -> &'a mut W {
241        const MASK: bool = true;
242        const OFFSET: u8 = 12;
243        self.w.bits &= !((MASK as u32) << OFFSET);
244        self.w.bits |= ((value & MASK) as u32) << OFFSET;
245        self.w
246    }
247}
248#[doc = r" Proxy"]
249pub struct _DMAINENW<'a> {
250    w: &'a mut W,
251}
252impl<'a> _DMAINENW<'a> {
253    #[doc = r" Sets the field bit"]
254    pub fn set_bit(self) -> &'a mut W {
255        self.bit(true)
256    }
257    #[doc = r" Clears the field bit"]
258    pub fn clear_bit(self) -> &'a mut W {
259        self.bit(false)
260    }
261    #[doc = r" Writes raw bits to the field"]
262    #[inline]
263    pub fn bit(self, value: bool) -> &'a mut W {
264        const MASK: bool = true;
265        const OFFSET: u8 = 11;
266        self.w.bits &= !((MASK as u32) << OFFSET);
267        self.w.bits |= ((value & MASK) as u32) << OFFSET;
268        self.w
269    }
270}
271#[doc = r" Proxy"]
272pub struct _ERRIEW<'a> {
273    w: &'a mut W,
274}
275impl<'a> _ERRIEW<'a> {
276    #[doc = r" Sets the field bit"]
277    pub fn set_bit(self) -> &'a mut W {
278        self.bit(true)
279    }
280    #[doc = r" Clears the field bit"]
281    pub fn clear_bit(self) -> &'a mut W {
282        self.bit(false)
283    }
284    #[doc = r" Writes raw bits to the field"]
285    #[inline]
286    pub fn bit(self, value: bool) -> &'a mut W {
287        const MASK: bool = true;
288        const OFFSET: u8 = 10;
289        self.w.bits &= !((MASK as u32) << OFFSET);
290        self.w.bits |= ((value & MASK) as u32) << OFFSET;
291        self.w
292    }
293}
294#[doc = r" Proxy"]
295pub struct _CCFIEW<'a> {
296    w: &'a mut W,
297}
298impl<'a> _CCFIEW<'a> {
299    #[doc = r" Sets the field bit"]
300    pub fn set_bit(self) -> &'a mut W {
301        self.bit(true)
302    }
303    #[doc = r" Clears the field bit"]
304    pub fn clear_bit(self) -> &'a mut W {
305        self.bit(false)
306    }
307    #[doc = r" Writes raw bits to the field"]
308    #[inline]
309    pub fn bit(self, value: bool) -> &'a mut W {
310        const MASK: bool = true;
311        const OFFSET: u8 = 9;
312        self.w.bits &= !((MASK as u32) << OFFSET);
313        self.w.bits |= ((value & MASK) as u32) << OFFSET;
314        self.w
315    }
316}
317#[doc = r" Proxy"]
318pub struct _ERRCW<'a> {
319    w: &'a mut W,
320}
321impl<'a> _ERRCW<'a> {
322    #[doc = r" Sets the field bit"]
323    pub fn set_bit(self) -> &'a mut W {
324        self.bit(true)
325    }
326    #[doc = r" Clears the field bit"]
327    pub fn clear_bit(self) -> &'a mut W {
328        self.bit(false)
329    }
330    #[doc = r" Writes raw bits to the field"]
331    #[inline]
332    pub fn bit(self, value: bool) -> &'a mut W {
333        const MASK: bool = true;
334        const OFFSET: u8 = 8;
335        self.w.bits &= !((MASK as u32) << OFFSET);
336        self.w.bits |= ((value & MASK) as u32) << OFFSET;
337        self.w
338    }
339}
340#[doc = r" Proxy"]
341pub struct _CCFCW<'a> {
342    w: &'a mut W,
343}
344impl<'a> _CCFCW<'a> {
345    #[doc = r" Sets the field bit"]
346    pub fn set_bit(self) -> &'a mut W {
347        self.bit(true)
348    }
349    #[doc = r" Clears the field bit"]
350    pub fn clear_bit(self) -> &'a mut W {
351        self.bit(false)
352    }
353    #[doc = r" Writes raw bits to the field"]
354    #[inline]
355    pub fn bit(self, value: bool) -> &'a mut W {
356        const MASK: bool = true;
357        const OFFSET: u8 = 7;
358        self.w.bits &= !((MASK as u32) << OFFSET);
359        self.w.bits |= ((value & MASK) as u32) << OFFSET;
360        self.w
361    }
362}
363#[doc = r" Proxy"]
364pub struct _CHMODW<'a> {
365    w: &'a mut W,
366}
367impl<'a> _CHMODW<'a> {
368    #[doc = r" Writes raw bits to the field"]
369    #[inline]
370    pub unsafe fn bits(self, value: u8) -> &'a mut W {
371        const MASK: u8 = 3;
372        const OFFSET: u8 = 5;
373        self.w.bits &= !((MASK as u32) << OFFSET);
374        self.w.bits |= ((value & MASK) as u32) << OFFSET;
375        self.w
376    }
377}
378#[doc = r" Proxy"]
379pub struct _MODEW<'a> {
380    w: &'a mut W,
381}
382impl<'a> _MODEW<'a> {
383    #[doc = r" Writes raw bits to the field"]
384    #[inline]
385    pub unsafe fn bits(self, value: u8) -> &'a mut W {
386        const MASK: u8 = 3;
387        const OFFSET: u8 = 3;
388        self.w.bits &= !((MASK as u32) << OFFSET);
389        self.w.bits |= ((value & MASK) as u32) << OFFSET;
390        self.w
391    }
392}
393#[doc = r" Proxy"]
394pub struct _DATATYPEW<'a> {
395    w: &'a mut W,
396}
397impl<'a> _DATATYPEW<'a> {
398    #[doc = r" Writes raw bits to the field"]
399    #[inline]
400    pub unsafe fn bits(self, value: u8) -> &'a mut W {
401        const MASK: u8 = 3;
402        const OFFSET: u8 = 1;
403        self.w.bits &= !((MASK as u32) << OFFSET);
404        self.w.bits |= ((value & MASK) as u32) << OFFSET;
405        self.w
406    }
407}
408#[doc = r" Proxy"]
409pub struct _ENW<'a> {
410    w: &'a mut W,
411}
412impl<'a> _ENW<'a> {
413    #[doc = r" Sets the field bit"]
414    pub fn set_bit(self) -> &'a mut W {
415        self.bit(true)
416    }
417    #[doc = r" Clears the field bit"]
418    pub fn clear_bit(self) -> &'a mut W {
419        self.bit(false)
420    }
421    #[doc = r" Writes raw bits to the field"]
422    #[inline]
423    pub fn bit(self, value: bool) -> &'a mut W {
424        const MASK: bool = true;
425        const OFFSET: u8 = 0;
426        self.w.bits &= !((MASK as u32) << OFFSET);
427        self.w.bits |= ((value & MASK) as u32) << OFFSET;
428        self.w
429    }
430}
431impl R {
432    #[doc = r" Value of the register as raw bits"]
433    #[inline]
434    pub fn bits(&self) -> u32 {
435        self.bits
436    }
437    #[doc = "Bit 12 - Enable DMA management of data output phase"]
438    #[inline]
439    pub fn dmaouten(&self) -> DMAOUTENR {
440        let bits = {
441            const MASK: bool = true;
442            const OFFSET: u8 = 12;
443            ((self.bits >> OFFSET) & MASK as u32) != 0
444        };
445        DMAOUTENR { bits }
446    }
447    #[doc = "Bit 11 - Enable DMA management of data input phase"]
448    #[inline]
449    pub fn dmainen(&self) -> DMAINENR {
450        let bits = {
451            const MASK: bool = true;
452            const OFFSET: u8 = 11;
453            ((self.bits >> OFFSET) & MASK as u32) != 0
454        };
455        DMAINENR { bits }
456    }
457    #[doc = "Bit 10 - Error interrupt enable"]
458    #[inline]
459    pub fn errie(&self) -> ERRIER {
460        let bits = {
461            const MASK: bool = true;
462            const OFFSET: u8 = 10;
463            ((self.bits >> OFFSET) & MASK as u32) != 0
464        };
465        ERRIER { bits }
466    }
467    #[doc = "Bit 9 - CCF flag interrupt enable"]
468    #[inline]
469    pub fn ccfie(&self) -> CCFIER {
470        let bits = {
471            const MASK: bool = true;
472            const OFFSET: u8 = 9;
473            ((self.bits >> OFFSET) & MASK as u32) != 0
474        };
475        CCFIER { bits }
476    }
477    #[doc = "Bit 8 - Error clear"]
478    #[inline]
479    pub fn errc(&self) -> ERRCR {
480        let bits = {
481            const MASK: bool = true;
482            const OFFSET: u8 = 8;
483            ((self.bits >> OFFSET) & MASK as u32) != 0
484        };
485        ERRCR { bits }
486    }
487    #[doc = "Bit 7 - Computation Complete Flag Clear"]
488    #[inline]
489    pub fn ccfc(&self) -> CCFCR {
490        let bits = {
491            const MASK: bool = true;
492            const OFFSET: u8 = 7;
493            ((self.bits >> OFFSET) & MASK as u32) != 0
494        };
495        CCFCR { bits }
496    }
497    #[doc = "Bits 5:6 - AES chaining mode"]
498    #[inline]
499    pub fn chmod(&self) -> CHMODR {
500        let bits = {
501            const MASK: u8 = 3;
502            const OFFSET: u8 = 5;
503            ((self.bits >> OFFSET) & MASK as u32) as u8
504        };
505        CHMODR { bits }
506    }
507    #[doc = "Bits 3:4 - AES operating mode"]
508    #[inline]
509    pub fn mode(&self) -> MODER {
510        let bits = {
511            const MASK: u8 = 3;
512            const OFFSET: u8 = 3;
513            ((self.bits >> OFFSET) & MASK as u32) as u8
514        };
515        MODER { bits }
516    }
517    #[doc = "Bits 1:2 - Data type selection (for data in and data out to/from the cryptographic block)"]
518    #[inline]
519    pub fn datatype(&self) -> DATATYPER {
520        let bits = {
521            const MASK: u8 = 3;
522            const OFFSET: u8 = 1;
523            ((self.bits >> OFFSET) & MASK as u32) as u8
524        };
525        DATATYPER { bits }
526    }
527    #[doc = "Bit 0 - AES enable"]
528    #[inline]
529    pub fn en(&self) -> ENR {
530        let bits = {
531            const MASK: bool = true;
532            const OFFSET: u8 = 0;
533            ((self.bits >> OFFSET) & MASK as u32) != 0
534        };
535        ENR { bits }
536    }
537}
538impl W {
539    #[doc = r" Reset value of the register"]
540    #[inline]
541    pub fn reset_value() -> W {
542        W { bits: 0 }
543    }
544    #[doc = r" Writes raw bits to the register"]
545    #[inline]
546    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
547        self.bits = bits;
548        self
549    }
550    #[doc = "Bit 12 - Enable DMA management of data output phase"]
551    #[inline]
552    pub fn dmaouten(&mut self) -> _DMAOUTENW {
553        _DMAOUTENW { w: self }
554    }
555    #[doc = "Bit 11 - Enable DMA management of data input phase"]
556    #[inline]
557    pub fn dmainen(&mut self) -> _DMAINENW {
558        _DMAINENW { w: self }
559    }
560    #[doc = "Bit 10 - Error interrupt enable"]
561    #[inline]
562    pub fn errie(&mut self) -> _ERRIEW {
563        _ERRIEW { w: self }
564    }
565    #[doc = "Bit 9 - CCF flag interrupt enable"]
566    #[inline]
567    pub fn ccfie(&mut self) -> _CCFIEW {
568        _CCFIEW { w: self }
569    }
570    #[doc = "Bit 8 - Error clear"]
571    #[inline]
572    pub fn errc(&mut self) -> _ERRCW {
573        _ERRCW { w: self }
574    }
575    #[doc = "Bit 7 - Computation Complete Flag Clear"]
576    #[inline]
577    pub fn ccfc(&mut self) -> _CCFCW {
578        _CCFCW { w: self }
579    }
580    #[doc = "Bits 5:6 - AES chaining mode"]
581    #[inline]
582    pub fn chmod(&mut self) -> _CHMODW {
583        _CHMODW { w: self }
584    }
585    #[doc = "Bits 3:4 - AES operating mode"]
586    #[inline]
587    pub fn mode(&mut self) -> _MODEW {
588        _MODEW { w: self }
589    }
590    #[doc = "Bits 1:2 - Data type selection (for data in and data out to/from the cryptographic block)"]
591    #[inline]
592    pub fn datatype(&mut self) -> _DATATYPEW {
593        _DATATYPEW { w: self }
594    }
595    #[doc = "Bit 0 - AES enable"]
596    #[inline]
597    pub fn en(&mut self) -> _ENW {
598        _ENW { w: self }
599    }
600}