efm32tg11b120_pac/crypto0/
seqctrl.rs

1#[doc = "Register `SEQCTRL` reader"]
2pub struct R(crate::R<SEQCTRL_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<SEQCTRL_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<SEQCTRL_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<SEQCTRL_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `SEQCTRL` writer"]
17pub struct W(crate::W<SEQCTRL_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<SEQCTRL_SPEC>;
20    #[inline(always)]
21    fn deref(&self) -> &Self::Target {
22        &self.0
23    }
24}
25impl core::ops::DerefMut for W {
26    #[inline(always)]
27    fn deref_mut(&mut self) -> &mut Self::Target {
28        &mut self.0
29    }
30}
31impl From<crate::W<SEQCTRL_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<SEQCTRL_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `LENGTHA` reader - Buffer Length a in Bytes"]
38pub type LENGTHA_R = crate::FieldReader<u16, u16>;
39#[doc = "Field `LENGTHA` writer - Buffer Length a in Bytes"]
40pub type LENGTHA_W<'a> = crate::FieldWriter<'a, u32, SEQCTRL_SPEC, u16, u16, 14, 0>;
41#[doc = "Size of Data Blocks\n\nValue on reset: 0"]
42#[derive(Clone, Copy, Debug, PartialEq)]
43#[repr(u8)]
44pub enum BLOCKSIZE_A {
45    #[doc = "0: A block is 16 bytes long"]
46    _16BYTES = 0,
47    #[doc = "1: A block is 32 bytes long"]
48    _32BYTES = 1,
49    #[doc = "2: A block is 64 bytes long"]
50    _64BYTES = 2,
51}
52impl From<BLOCKSIZE_A> for u8 {
53    #[inline(always)]
54    fn from(variant: BLOCKSIZE_A) -> Self {
55        variant as _
56    }
57}
58#[doc = "Field `BLOCKSIZE` reader - Size of Data Blocks"]
59pub type BLOCKSIZE_R = crate::FieldReader<u8, BLOCKSIZE_A>;
60impl BLOCKSIZE_R {
61    #[doc = "Get enumerated values variant"]
62    #[inline(always)]
63    pub fn variant(&self) -> Option<BLOCKSIZE_A> {
64        match self.bits {
65            0 => Some(BLOCKSIZE_A::_16BYTES),
66            1 => Some(BLOCKSIZE_A::_32BYTES),
67            2 => Some(BLOCKSIZE_A::_64BYTES),
68            _ => None,
69        }
70    }
71    #[doc = "Checks if the value of the field is `_16BYTES`"]
72    #[inline(always)]
73    pub fn is_16bytes(&self) -> bool {
74        *self == BLOCKSIZE_A::_16BYTES
75    }
76    #[doc = "Checks if the value of the field is `_32BYTES`"]
77    #[inline(always)]
78    pub fn is_32bytes(&self) -> bool {
79        *self == BLOCKSIZE_A::_32BYTES
80    }
81    #[doc = "Checks if the value of the field is `_64BYTES`"]
82    #[inline(always)]
83    pub fn is_64bytes(&self) -> bool {
84        *self == BLOCKSIZE_A::_64BYTES
85    }
86}
87#[doc = "Field `BLOCKSIZE` writer - Size of Data Blocks"]
88pub type BLOCKSIZE_W<'a> = crate::FieldWriter<'a, u32, SEQCTRL_SPEC, u8, BLOCKSIZE_A, 2, 20>;
89impl<'a> BLOCKSIZE_W<'a> {
90    #[doc = "A block is 16 bytes long"]
91    #[inline(always)]
92    pub fn _16bytes(self) -> &'a mut W {
93        self.variant(BLOCKSIZE_A::_16BYTES)
94    }
95    #[doc = "A block is 32 bytes long"]
96    #[inline(always)]
97    pub fn _32bytes(self) -> &'a mut W {
98        self.variant(BLOCKSIZE_A::_32BYTES)
99    }
100    #[doc = "A block is 64 bytes long"]
101    #[inline(always)]
102    pub fn _64bytes(self) -> &'a mut W {
103        self.variant(BLOCKSIZE_A::_64BYTES)
104    }
105}
106#[doc = "Field `DMA0SKIP` reader - DMA0 Skip"]
107pub type DMA0SKIP_R = crate::FieldReader<u8, u8>;
108#[doc = "Field `DMA0SKIP` writer - DMA0 Skip"]
109pub type DMA0SKIP_W<'a> = crate::FieldWriter<'a, u32, SEQCTRL_SPEC, u8, u8, 2, 24>;
110#[doc = "Field `DMA1SKIP` reader - DMA1 Skip"]
111pub type DMA1SKIP_R = crate::FieldReader<u8, u8>;
112#[doc = "Field `DMA1SKIP` writer - DMA1 Skip"]
113pub type DMA1SKIP_W<'a> = crate::FieldWriter<'a, u32, SEQCTRL_SPEC, u8, u8, 2, 26>;
114#[doc = "Field `DMA0PRESA` reader - DMA0 Preserve a"]
115pub type DMA0PRESA_R = crate::BitReader<bool>;
116#[doc = "Field `DMA0PRESA` writer - DMA0 Preserve a"]
117pub type DMA0PRESA_W<'a> = crate::BitWriter<'a, u32, SEQCTRL_SPEC, bool, 28>;
118#[doc = "Field `DMA1PRESA` reader - DMA1 Preserve a"]
119pub type DMA1PRESA_R = crate::BitReader<bool>;
120#[doc = "Field `DMA1PRESA` writer - DMA1 Preserve a"]
121pub type DMA1PRESA_W<'a> = crate::BitWriter<'a, u32, SEQCTRL_SPEC, bool, 29>;
122#[doc = "Field `HALT` reader - Halt Sequence"]
123pub type HALT_R = crate::BitReader<bool>;
124#[doc = "Field `HALT` writer - Halt Sequence"]
125pub type HALT_W<'a> = crate::BitWriter<'a, u32, SEQCTRL_SPEC, bool, 31>;
126impl R {
127    #[doc = "Bits 0:13 - Buffer Length a in Bytes"]
128    #[inline(always)]
129    pub fn lengtha(&self) -> LENGTHA_R {
130        LENGTHA_R::new((self.bits & 0x3fff) as u16)
131    }
132    #[doc = "Bits 20:21 - Size of Data Blocks"]
133    #[inline(always)]
134    pub fn blocksize(&self) -> BLOCKSIZE_R {
135        BLOCKSIZE_R::new(((self.bits >> 20) & 3) as u8)
136    }
137    #[doc = "Bits 24:25 - DMA0 Skip"]
138    #[inline(always)]
139    pub fn dma0skip(&self) -> DMA0SKIP_R {
140        DMA0SKIP_R::new(((self.bits >> 24) & 3) as u8)
141    }
142    #[doc = "Bits 26:27 - DMA1 Skip"]
143    #[inline(always)]
144    pub fn dma1skip(&self) -> DMA1SKIP_R {
145        DMA1SKIP_R::new(((self.bits >> 26) & 3) as u8)
146    }
147    #[doc = "Bit 28 - DMA0 Preserve a"]
148    #[inline(always)]
149    pub fn dma0presa(&self) -> DMA0PRESA_R {
150        DMA0PRESA_R::new(((self.bits >> 28) & 1) != 0)
151    }
152    #[doc = "Bit 29 - DMA1 Preserve a"]
153    #[inline(always)]
154    pub fn dma1presa(&self) -> DMA1PRESA_R {
155        DMA1PRESA_R::new(((self.bits >> 29) & 1) != 0)
156    }
157    #[doc = "Bit 31 - Halt Sequence"]
158    #[inline(always)]
159    pub fn halt(&self) -> HALT_R {
160        HALT_R::new(((self.bits >> 31) & 1) != 0)
161    }
162}
163impl W {
164    #[doc = "Bits 0:13 - Buffer Length a in Bytes"]
165    #[inline(always)]
166    pub fn lengtha(&mut self) -> LENGTHA_W {
167        LENGTHA_W::new(self)
168    }
169    #[doc = "Bits 20:21 - Size of Data Blocks"]
170    #[inline(always)]
171    pub fn blocksize(&mut self) -> BLOCKSIZE_W {
172        BLOCKSIZE_W::new(self)
173    }
174    #[doc = "Bits 24:25 - DMA0 Skip"]
175    #[inline(always)]
176    pub fn dma0skip(&mut self) -> DMA0SKIP_W {
177        DMA0SKIP_W::new(self)
178    }
179    #[doc = "Bits 26:27 - DMA1 Skip"]
180    #[inline(always)]
181    pub fn dma1skip(&mut self) -> DMA1SKIP_W {
182        DMA1SKIP_W::new(self)
183    }
184    #[doc = "Bit 28 - DMA0 Preserve a"]
185    #[inline(always)]
186    pub fn dma0presa(&mut self) -> DMA0PRESA_W {
187        DMA0PRESA_W::new(self)
188    }
189    #[doc = "Bit 29 - DMA1 Preserve a"]
190    #[inline(always)]
191    pub fn dma1presa(&mut self) -> DMA1PRESA_W {
192        DMA1PRESA_W::new(self)
193    }
194    #[doc = "Bit 31 - Halt Sequence"]
195    #[inline(always)]
196    pub fn halt(&mut self) -> HALT_W {
197        HALT_W::new(self)
198    }
199    #[doc = "Writes raw bits to the register."]
200    #[inline(always)]
201    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
202        self.0.bits(bits);
203        self
204    }
205}
206#[doc = "Sequence Control\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [seqctrl](index.html) module"]
207pub struct SEQCTRL_SPEC;
208impl crate::RegisterSpec for SEQCTRL_SPEC {
209    type Ux = u32;
210}
211#[doc = "`read()` method returns [seqctrl::R](R) reader structure"]
212impl crate::Readable for SEQCTRL_SPEC {
213    type Reader = R;
214}
215#[doc = "`write(|w| ..)` method takes [seqctrl::W](W) writer structure"]
216impl crate::Writable for SEQCTRL_SPEC {
217    type Writer = W;
218}
219#[doc = "`reset()` method sets SEQCTRL to value 0"]
220impl crate::Resettable for SEQCTRL_SPEC {
221    #[inline(always)]
222    fn reset_value() -> Self::Ux {
223        0
224    }
225}