efm32pg12_pac/crypto0/
seqctrl.rs

1#[doc = "Reader of register SEQCTRL"]
2pub type R = crate::R<u32, super::SEQCTRL>;
3#[doc = "Writer for register SEQCTRL"]
4pub type W = crate::W<u32, super::SEQCTRL>;
5#[doc = "Register SEQCTRL `reset()`'s with value 0"]
6impl crate::ResetValue for super::SEQCTRL {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `LENGTHA`"]
14pub type LENGTHA_R = crate::R<u16, u16>;
15#[doc = "Write proxy for field `LENGTHA`"]
16pub struct LENGTHA_W<'a> {
17    w: &'a mut W,
18}
19impl<'a> LENGTHA_W<'a> {
20    #[doc = r"Writes raw bits to the field"]
21    #[inline(always)]
22    pub unsafe fn bits(self, value: u16) -> &'a mut W {
23        self.w.bits = (self.w.bits & !0x3fff) | ((value as u32) & 0x3fff);
24        self.w
25    }
26}
27#[doc = "Size of Data Blocks\n\nValue on reset: 0"]
28#[derive(Clone, Copy, Debug, PartialEq)]
29#[repr(u8)]
30pub enum BLOCKSIZE_A {
31    #[doc = "0: A block is 16 bytes long"]
32    _16BYTES = 0,
33    #[doc = "1: A block is 32 bytes long"]
34    _32BYTES = 1,
35    #[doc = "2: A block is 64 bytes long"]
36    _64BYTES = 2,
37}
38impl From<BLOCKSIZE_A> for u8 {
39    #[inline(always)]
40    fn from(variant: BLOCKSIZE_A) -> Self {
41        variant as _
42    }
43}
44#[doc = "Reader of field `BLOCKSIZE`"]
45pub type BLOCKSIZE_R = crate::R<u8, BLOCKSIZE_A>;
46impl BLOCKSIZE_R {
47    #[doc = r"Get enumerated values variant"]
48    #[inline(always)]
49    pub fn variant(&self) -> crate::Variant<u8, BLOCKSIZE_A> {
50        use crate::Variant::*;
51        match self.bits {
52            0 => Val(BLOCKSIZE_A::_16BYTES),
53            1 => Val(BLOCKSIZE_A::_32BYTES),
54            2 => Val(BLOCKSIZE_A::_64BYTES),
55            i => Res(i),
56        }
57    }
58    #[doc = "Checks if the value of the field is `_16BYTES`"]
59    #[inline(always)]
60    pub fn is_16bytes(&self) -> bool {
61        *self == BLOCKSIZE_A::_16BYTES
62    }
63    #[doc = "Checks if the value of the field is `_32BYTES`"]
64    #[inline(always)]
65    pub fn is_32bytes(&self) -> bool {
66        *self == BLOCKSIZE_A::_32BYTES
67    }
68    #[doc = "Checks if the value of the field is `_64BYTES`"]
69    #[inline(always)]
70    pub fn is_64bytes(&self) -> bool {
71        *self == BLOCKSIZE_A::_64BYTES
72    }
73}
74#[doc = "Write proxy for field `BLOCKSIZE`"]
75pub struct BLOCKSIZE_W<'a> {
76    w: &'a mut W,
77}
78impl<'a> BLOCKSIZE_W<'a> {
79    #[doc = r"Writes `variant` to the field"]
80    #[inline(always)]
81    pub fn variant(self, variant: BLOCKSIZE_A) -> &'a mut W {
82        unsafe { self.bits(variant.into()) }
83    }
84    #[doc = "A block is 16 bytes long"]
85    #[inline(always)]
86    pub fn _16bytes(self) -> &'a mut W {
87        self.variant(BLOCKSIZE_A::_16BYTES)
88    }
89    #[doc = "A block is 32 bytes long"]
90    #[inline(always)]
91    pub fn _32bytes(self) -> &'a mut W {
92        self.variant(BLOCKSIZE_A::_32BYTES)
93    }
94    #[doc = "A block is 64 bytes long"]
95    #[inline(always)]
96    pub fn _64bytes(self) -> &'a mut W {
97        self.variant(BLOCKSIZE_A::_64BYTES)
98    }
99    #[doc = r"Writes raw bits to the field"]
100    #[inline(always)]
101    pub unsafe fn bits(self, value: u8) -> &'a mut W {
102        self.w.bits = (self.w.bits & !(0x03 << 20)) | (((value as u32) & 0x03) << 20);
103        self.w
104    }
105}
106#[doc = "Reader of field `DMA0SKIP`"]
107pub type DMA0SKIP_R = crate::R<u8, u8>;
108#[doc = "Write proxy for field `DMA0SKIP`"]
109pub struct DMA0SKIP_W<'a> {
110    w: &'a mut W,
111}
112impl<'a> DMA0SKIP_W<'a> {
113    #[doc = r"Writes raw bits to the field"]
114    #[inline(always)]
115    pub unsafe fn bits(self, value: u8) -> &'a mut W {
116        self.w.bits = (self.w.bits & !(0x03 << 24)) | (((value as u32) & 0x03) << 24);
117        self.w
118    }
119}
120#[doc = "Reader of field `DMA1SKIP`"]
121pub type DMA1SKIP_R = crate::R<u8, u8>;
122#[doc = "Write proxy for field `DMA1SKIP`"]
123pub struct DMA1SKIP_W<'a> {
124    w: &'a mut W,
125}
126impl<'a> DMA1SKIP_W<'a> {
127    #[doc = r"Writes raw bits to the field"]
128    #[inline(always)]
129    pub unsafe fn bits(self, value: u8) -> &'a mut W {
130        self.w.bits = (self.w.bits & !(0x03 << 26)) | (((value as u32) & 0x03) << 26);
131        self.w
132    }
133}
134#[doc = "Reader of field `DMA0PRESA`"]
135pub type DMA0PRESA_R = crate::R<bool, bool>;
136#[doc = "Write proxy for field `DMA0PRESA`"]
137pub struct DMA0PRESA_W<'a> {
138    w: &'a mut W,
139}
140impl<'a> DMA0PRESA_W<'a> {
141    #[doc = r"Sets the field bit"]
142    #[inline(always)]
143    pub fn set_bit(self) -> &'a mut W {
144        self.bit(true)
145    }
146    #[doc = r"Clears the field bit"]
147    #[inline(always)]
148    pub fn clear_bit(self) -> &'a mut W {
149        self.bit(false)
150    }
151    #[doc = r"Writes raw bits to the field"]
152    #[inline(always)]
153    pub fn bit(self, value: bool) -> &'a mut W {
154        self.w.bits = (self.w.bits & !(0x01 << 28)) | (((value as u32) & 0x01) << 28);
155        self.w
156    }
157}
158#[doc = "Reader of field `DMA1PRESA`"]
159pub type DMA1PRESA_R = crate::R<bool, bool>;
160#[doc = "Write proxy for field `DMA1PRESA`"]
161pub struct DMA1PRESA_W<'a> {
162    w: &'a mut W,
163}
164impl<'a> DMA1PRESA_W<'a> {
165    #[doc = r"Sets the field bit"]
166    #[inline(always)]
167    pub fn set_bit(self) -> &'a mut W {
168        self.bit(true)
169    }
170    #[doc = r"Clears the field bit"]
171    #[inline(always)]
172    pub fn clear_bit(self) -> &'a mut W {
173        self.bit(false)
174    }
175    #[doc = r"Writes raw bits to the field"]
176    #[inline(always)]
177    pub fn bit(self, value: bool) -> &'a mut W {
178        self.w.bits = (self.w.bits & !(0x01 << 29)) | (((value as u32) & 0x01) << 29);
179        self.w
180    }
181}
182#[doc = "Reader of field `HALT`"]
183pub type HALT_R = crate::R<bool, bool>;
184#[doc = "Write proxy for field `HALT`"]
185pub struct HALT_W<'a> {
186    w: &'a mut W,
187}
188impl<'a> HALT_W<'a> {
189    #[doc = r"Sets the field bit"]
190    #[inline(always)]
191    pub fn set_bit(self) -> &'a mut W {
192        self.bit(true)
193    }
194    #[doc = r"Clears the field bit"]
195    #[inline(always)]
196    pub fn clear_bit(self) -> &'a mut W {
197        self.bit(false)
198    }
199    #[doc = r"Writes raw bits to the field"]
200    #[inline(always)]
201    pub fn bit(self, value: bool) -> &'a mut W {
202        self.w.bits = (self.w.bits & !(0x01 << 31)) | (((value as u32) & 0x01) << 31);
203        self.w
204    }
205}
206impl R {
207    #[doc = "Bits 0:13 - Buffer Length a in Bytes"]
208    #[inline(always)]
209    pub fn lengtha(&self) -> LENGTHA_R {
210        LENGTHA_R::new((self.bits & 0x3fff) as u16)
211    }
212    #[doc = "Bits 20:21 - Size of Data Blocks"]
213    #[inline(always)]
214    pub fn blocksize(&self) -> BLOCKSIZE_R {
215        BLOCKSIZE_R::new(((self.bits >> 20) & 0x03) as u8)
216    }
217    #[doc = "Bits 24:25 - DMA0 Skip"]
218    #[inline(always)]
219    pub fn dma0skip(&self) -> DMA0SKIP_R {
220        DMA0SKIP_R::new(((self.bits >> 24) & 0x03) as u8)
221    }
222    #[doc = "Bits 26:27 - DMA1 Skip"]
223    #[inline(always)]
224    pub fn dma1skip(&self) -> DMA1SKIP_R {
225        DMA1SKIP_R::new(((self.bits >> 26) & 0x03) as u8)
226    }
227    #[doc = "Bit 28 - DMA0 Preserve a"]
228    #[inline(always)]
229    pub fn dma0presa(&self) -> DMA0PRESA_R {
230        DMA0PRESA_R::new(((self.bits >> 28) & 0x01) != 0)
231    }
232    #[doc = "Bit 29 - DMA1 Preserve a"]
233    #[inline(always)]
234    pub fn dma1presa(&self) -> DMA1PRESA_R {
235        DMA1PRESA_R::new(((self.bits >> 29) & 0x01) != 0)
236    }
237    #[doc = "Bit 31 - Halt Sequence"]
238    #[inline(always)]
239    pub fn halt(&self) -> HALT_R {
240        HALT_R::new(((self.bits >> 31) & 0x01) != 0)
241    }
242}
243impl W {
244    #[doc = "Bits 0:13 - Buffer Length a in Bytes"]
245    #[inline(always)]
246    pub fn lengtha(&mut self) -> LENGTHA_W {
247        LENGTHA_W { w: self }
248    }
249    #[doc = "Bits 20:21 - Size of Data Blocks"]
250    #[inline(always)]
251    pub fn blocksize(&mut self) -> BLOCKSIZE_W {
252        BLOCKSIZE_W { w: self }
253    }
254    #[doc = "Bits 24:25 - DMA0 Skip"]
255    #[inline(always)]
256    pub fn dma0skip(&mut self) -> DMA0SKIP_W {
257        DMA0SKIP_W { w: self }
258    }
259    #[doc = "Bits 26:27 - DMA1 Skip"]
260    #[inline(always)]
261    pub fn dma1skip(&mut self) -> DMA1SKIP_W {
262        DMA1SKIP_W { w: self }
263    }
264    #[doc = "Bit 28 - DMA0 Preserve a"]
265    #[inline(always)]
266    pub fn dma0presa(&mut self) -> DMA0PRESA_W {
267        DMA0PRESA_W { w: self }
268    }
269    #[doc = "Bit 29 - DMA1 Preserve a"]
270    #[inline(always)]
271    pub fn dma1presa(&mut self) -> DMA1PRESA_W {
272        DMA1PRESA_W { w: self }
273    }
274    #[doc = "Bit 31 - Halt Sequence"]
275    #[inline(always)]
276    pub fn halt(&mut self) -> HALT_W {
277        HALT_W { w: self }
278    }
279}