efm32jg12b_pac/efm32jg12b500/crypto1/
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, const O: u8> = crate::FieldWriter<'a, u32, SEQCTRL_SPEC, u16, u16, 14, O>;
41#[doc = "Field `BLOCKSIZE` reader - Size of Data Blocks"]
42pub type BLOCKSIZE_R = crate::FieldReader<u8, BLOCKSIZE_A>;
43#[doc = "Size of Data Blocks\n\nValue on reset: 0"]
44#[derive(Clone, Copy, Debug, PartialEq, Eq)]
45#[repr(u8)]
46pub enum BLOCKSIZE_A {
47    #[doc = "0: A block is 16 bytes long"]
48    _16BYTES = 0,
49    #[doc = "1: A block is 32 bytes long"]
50    _32BYTES = 1,
51    #[doc = "2: A block is 64 bytes long"]
52    _64BYTES = 2,
53}
54impl From<BLOCKSIZE_A> for u8 {
55    #[inline(always)]
56    fn from(variant: BLOCKSIZE_A) -> Self {
57        variant as _
58    }
59}
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, const O: u8> =
89    crate::FieldWriter<'a, u32, SEQCTRL_SPEC, u8, BLOCKSIZE_A, 2, O>;
90impl<'a, const O: u8> BLOCKSIZE_W<'a, O> {
91    #[doc = "A block is 16 bytes long"]
92    #[inline(always)]
93    pub fn _16bytes(self) -> &'a mut W {
94        self.variant(BLOCKSIZE_A::_16BYTES)
95    }
96    #[doc = "A block is 32 bytes long"]
97    #[inline(always)]
98    pub fn _32bytes(self) -> &'a mut W {
99        self.variant(BLOCKSIZE_A::_32BYTES)
100    }
101    #[doc = "A block is 64 bytes long"]
102    #[inline(always)]
103    pub fn _64bytes(self) -> &'a mut W {
104        self.variant(BLOCKSIZE_A::_64BYTES)
105    }
106}
107#[doc = "Field `DMA0SKIP` reader - DMA0 Skip"]
108pub type DMA0SKIP_R = crate::FieldReader<u8, u8>;
109#[doc = "Field `DMA0SKIP` writer - DMA0 Skip"]
110pub type DMA0SKIP_W<'a, const O: u8> = crate::FieldWriter<'a, u32, SEQCTRL_SPEC, u8, u8, 2, O>;
111#[doc = "Field `DMA1SKIP` reader - DMA1 Skip"]
112pub type DMA1SKIP_R = crate::FieldReader<u8, u8>;
113#[doc = "Field `DMA1SKIP` writer - DMA1 Skip"]
114pub type DMA1SKIP_W<'a, const O: u8> = crate::FieldWriter<'a, u32, SEQCTRL_SPEC, u8, u8, 2, O>;
115#[doc = "Field `DMA0PRESA` reader - DMA0 Preserve a"]
116pub type DMA0PRESA_R = crate::BitReader<bool>;
117#[doc = "Field `DMA0PRESA` writer - DMA0 Preserve a"]
118pub type DMA0PRESA_W<'a, const O: u8> = crate::BitWriter<'a, u32, SEQCTRL_SPEC, bool, O>;
119#[doc = "Field `DMA1PRESA` reader - DMA1 Preserve a"]
120pub type DMA1PRESA_R = crate::BitReader<bool>;
121#[doc = "Field `DMA1PRESA` writer - DMA1 Preserve a"]
122pub type DMA1PRESA_W<'a, const O: u8> = crate::BitWriter<'a, u32, SEQCTRL_SPEC, bool, O>;
123#[doc = "Field `HALT` reader - Halt Sequence"]
124pub type HALT_R = crate::BitReader<bool>;
125#[doc = "Field `HALT` writer - Halt Sequence"]
126pub type HALT_W<'a, const O: u8> = crate::BitWriter<'a, u32, SEQCTRL_SPEC, bool, O>;
127impl R {
128    #[doc = "Bits 0:13 - Buffer Length a in Bytes"]
129    #[inline(always)]
130    pub fn lengtha(&self) -> LENGTHA_R {
131        LENGTHA_R::new((self.bits & 0x3fff) as u16)
132    }
133    #[doc = "Bits 20:21 - Size of Data Blocks"]
134    #[inline(always)]
135    pub fn blocksize(&self) -> BLOCKSIZE_R {
136        BLOCKSIZE_R::new(((self.bits >> 20) & 3) as u8)
137    }
138    #[doc = "Bits 24:25 - DMA0 Skip"]
139    #[inline(always)]
140    pub fn dma0skip(&self) -> DMA0SKIP_R {
141        DMA0SKIP_R::new(((self.bits >> 24) & 3) as u8)
142    }
143    #[doc = "Bits 26:27 - DMA1 Skip"]
144    #[inline(always)]
145    pub fn dma1skip(&self) -> DMA1SKIP_R {
146        DMA1SKIP_R::new(((self.bits >> 26) & 3) as u8)
147    }
148    #[doc = "Bit 28 - DMA0 Preserve a"]
149    #[inline(always)]
150    pub fn dma0presa(&self) -> DMA0PRESA_R {
151        DMA0PRESA_R::new(((self.bits >> 28) & 1) != 0)
152    }
153    #[doc = "Bit 29 - DMA1 Preserve a"]
154    #[inline(always)]
155    pub fn dma1presa(&self) -> DMA1PRESA_R {
156        DMA1PRESA_R::new(((self.bits >> 29) & 1) != 0)
157    }
158    #[doc = "Bit 31 - Halt Sequence"]
159    #[inline(always)]
160    pub fn halt(&self) -> HALT_R {
161        HALT_R::new(((self.bits >> 31) & 1) != 0)
162    }
163}
164impl W {
165    #[doc = "Bits 0:13 - Buffer Length a in Bytes"]
166    #[inline(always)]
167    #[must_use]
168    pub fn lengtha(&mut self) -> LENGTHA_W<0> {
169        LENGTHA_W::new(self)
170    }
171    #[doc = "Bits 20:21 - Size of Data Blocks"]
172    #[inline(always)]
173    #[must_use]
174    pub fn blocksize(&mut self) -> BLOCKSIZE_W<20> {
175        BLOCKSIZE_W::new(self)
176    }
177    #[doc = "Bits 24:25 - DMA0 Skip"]
178    #[inline(always)]
179    #[must_use]
180    pub fn dma0skip(&mut self) -> DMA0SKIP_W<24> {
181        DMA0SKIP_W::new(self)
182    }
183    #[doc = "Bits 26:27 - DMA1 Skip"]
184    #[inline(always)]
185    #[must_use]
186    pub fn dma1skip(&mut self) -> DMA1SKIP_W<26> {
187        DMA1SKIP_W::new(self)
188    }
189    #[doc = "Bit 28 - DMA0 Preserve a"]
190    #[inline(always)]
191    #[must_use]
192    pub fn dma0presa(&mut self) -> DMA0PRESA_W<28> {
193        DMA0PRESA_W::new(self)
194    }
195    #[doc = "Bit 29 - DMA1 Preserve a"]
196    #[inline(always)]
197    #[must_use]
198    pub fn dma1presa(&mut self) -> DMA1PRESA_W<29> {
199        DMA1PRESA_W::new(self)
200    }
201    #[doc = "Bit 31 - Halt Sequence"]
202    #[inline(always)]
203    #[must_use]
204    pub fn halt(&mut self) -> HALT_W<31> {
205        HALT_W::new(self)
206    }
207    #[doc = "Writes raw bits to the register."]
208    #[inline(always)]
209    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
210        self.0.bits(bits);
211        self
212    }
213}
214#[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"]
215pub struct SEQCTRL_SPEC;
216impl crate::RegisterSpec for SEQCTRL_SPEC {
217    type Ux = u32;
218}
219#[doc = "`read()` method returns [seqctrl::R](R) reader structure"]
220impl crate::Readable for SEQCTRL_SPEC {
221    type Reader = R;
222}
223#[doc = "`write(|w| ..)` method takes [seqctrl::W](W) writer structure"]
224impl crate::Writable for SEQCTRL_SPEC {
225    type Writer = W;
226    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
227    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
228}
229#[doc = "`reset()` method sets SEQCTRL to value 0"]
230impl crate::Resettable for SEQCTRL_SPEC {
231    const RESET_VALUE: Self::Ux = 0;
232}