efm32pg22_pac/efm32pg22c200/ldma_s/
ch2_ctrl.rs

1#[doc = "Register `CH2_CTRL` reader"]
2pub struct R(crate::R<CH2_CTRL_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<CH2_CTRL_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<CH2_CTRL_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<CH2_CTRL_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `CH2_CTRL` writer"]
17pub struct W(crate::W<CH2_CTRL_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<CH2_CTRL_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<CH2_CTRL_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<CH2_CTRL_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `STRUCTTYPE` reader - DMA Structure Type"]
38pub type STRUCTTYPE_R = crate::FieldReader<u8, STRUCTTYPE_A>;
39#[doc = "DMA Structure Type\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum STRUCTTYPE_A {
43    #[doc = "0: DMA transfer structure type selected."]
44    TRANSFER = 0,
45    #[doc = "1: Synchronization structure type selected."]
46    SYNCHRONIZE = 1,
47    #[doc = "2: Write immediate value structure type selected."]
48    WRITE = 2,
49}
50impl From<STRUCTTYPE_A> for u8 {
51    #[inline(always)]
52    fn from(variant: STRUCTTYPE_A) -> Self {
53        variant as _
54    }
55}
56impl STRUCTTYPE_R {
57    #[doc = "Get enumerated values variant"]
58    #[inline(always)]
59    pub fn variant(&self) -> Option<STRUCTTYPE_A> {
60        match self.bits {
61            0 => Some(STRUCTTYPE_A::TRANSFER),
62            1 => Some(STRUCTTYPE_A::SYNCHRONIZE),
63            2 => Some(STRUCTTYPE_A::WRITE),
64            _ => None,
65        }
66    }
67    #[doc = "Checks if the value of the field is `TRANSFER`"]
68    #[inline(always)]
69    pub fn is_transfer(&self) -> bool {
70        *self == STRUCTTYPE_A::TRANSFER
71    }
72    #[doc = "Checks if the value of the field is `SYNCHRONIZE`"]
73    #[inline(always)]
74    pub fn is_synchronize(&self) -> bool {
75        *self == STRUCTTYPE_A::SYNCHRONIZE
76    }
77    #[doc = "Checks if the value of the field is `WRITE`"]
78    #[inline(always)]
79    pub fn is_write(&self) -> bool {
80        *self == STRUCTTYPE_A::WRITE
81    }
82}
83#[doc = "Field `STRUCTTYPE` writer - DMA Structure Type"]
84pub type STRUCTTYPE_W<'a, const O: u8> =
85    crate::FieldWriter<'a, u32, CH2_CTRL_SPEC, u8, STRUCTTYPE_A, 2, O>;
86impl<'a, const O: u8> STRUCTTYPE_W<'a, O> {
87    #[doc = "DMA transfer structure type selected."]
88    #[inline(always)]
89    pub fn transfer(self) -> &'a mut W {
90        self.variant(STRUCTTYPE_A::TRANSFER)
91    }
92    #[doc = "Synchronization structure type selected."]
93    #[inline(always)]
94    pub fn synchronize(self) -> &'a mut W {
95        self.variant(STRUCTTYPE_A::SYNCHRONIZE)
96    }
97    #[doc = "Write immediate value structure type selected."]
98    #[inline(always)]
99    pub fn write(self) -> &'a mut W {
100        self.variant(STRUCTTYPE_A::WRITE)
101    }
102}
103#[doc = "Field `STRUCTREQ` reader - Structure DMA Transfer Request"]
104pub type STRUCTREQ_R = crate::BitReader<bool>;
105#[doc = "Field `XFERCNT` reader - DMA Unit Data Transfer Count"]
106pub type XFERCNT_R = crate::FieldReader<u16, u16>;
107#[doc = "Field `XFERCNT` writer - DMA Unit Data Transfer Count"]
108pub type XFERCNT_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CH2_CTRL_SPEC, u16, u16, 11, O>;
109#[doc = "Field `BYTESWAP` reader - Endian Byte Swap"]
110pub type BYTESWAP_R = crate::BitReader<bool>;
111#[doc = "Field `BYTESWAP` writer - Endian Byte Swap"]
112pub type BYTESWAP_W<'a, const O: u8> = crate::BitWriter<'a, u32, CH2_CTRL_SPEC, bool, O>;
113#[doc = "Field `BLOCKSIZE` reader - Block Transfer Size"]
114pub type BLOCKSIZE_R = crate::FieldReader<u8, BLOCKSIZE_A>;
115#[doc = "Block Transfer Size\n\nValue on reset: 0"]
116#[derive(Clone, Copy, Debug, PartialEq, Eq)]
117#[repr(u8)]
118pub enum BLOCKSIZE_A {
119    #[doc = "0: One unit transfer per arbitration"]
120    UNIT1 = 0,
121    #[doc = "1: Two unit transfers per arbitration"]
122    UNIT2 = 1,
123    #[doc = "2: Three unit transfers per arbitration"]
124    UNIT3 = 2,
125    #[doc = "3: Four unit transfers per arbitration"]
126    UNIT4 = 3,
127    #[doc = "4: Six unit transfers per arbitration"]
128    UNIT6 = 4,
129    #[doc = "5: Eight unit transfers per arbitration"]
130    UNIT8 = 5,
131    #[doc = "7: Sixteen unit transfers per arbitration"]
132    UNIT16 = 7,
133    #[doc = "9: 32 unit transfers per arbitration"]
134    UNIT32 = 9,
135    #[doc = "10: 64 unit transfers per arbitration"]
136    UNIT64 = 10,
137    #[doc = "11: 128 unit transfers per arbitration"]
138    UNIT128 = 11,
139    #[doc = "12: 256 unit transfers per arbitration"]
140    UNIT256 = 12,
141    #[doc = "13: 512 unit transfers per arbitration"]
142    UNIT512 = 13,
143    #[doc = "14: 1024 unit transfers per arbitration"]
144    UNIT1024 = 14,
145    #[doc = "15: Transfer all units as specified by the XFRCNT field"]
146    ALL = 15,
147}
148impl From<BLOCKSIZE_A> for u8 {
149    #[inline(always)]
150    fn from(variant: BLOCKSIZE_A) -> Self {
151        variant as _
152    }
153}
154impl BLOCKSIZE_R {
155    #[doc = "Get enumerated values variant"]
156    #[inline(always)]
157    pub fn variant(&self) -> Option<BLOCKSIZE_A> {
158        match self.bits {
159            0 => Some(BLOCKSIZE_A::UNIT1),
160            1 => Some(BLOCKSIZE_A::UNIT2),
161            2 => Some(BLOCKSIZE_A::UNIT3),
162            3 => Some(BLOCKSIZE_A::UNIT4),
163            4 => Some(BLOCKSIZE_A::UNIT6),
164            5 => Some(BLOCKSIZE_A::UNIT8),
165            7 => Some(BLOCKSIZE_A::UNIT16),
166            9 => Some(BLOCKSIZE_A::UNIT32),
167            10 => Some(BLOCKSIZE_A::UNIT64),
168            11 => Some(BLOCKSIZE_A::UNIT128),
169            12 => Some(BLOCKSIZE_A::UNIT256),
170            13 => Some(BLOCKSIZE_A::UNIT512),
171            14 => Some(BLOCKSIZE_A::UNIT1024),
172            15 => Some(BLOCKSIZE_A::ALL),
173            _ => None,
174        }
175    }
176    #[doc = "Checks if the value of the field is `UNIT1`"]
177    #[inline(always)]
178    pub fn is_unit1(&self) -> bool {
179        *self == BLOCKSIZE_A::UNIT1
180    }
181    #[doc = "Checks if the value of the field is `UNIT2`"]
182    #[inline(always)]
183    pub fn is_unit2(&self) -> bool {
184        *self == BLOCKSIZE_A::UNIT2
185    }
186    #[doc = "Checks if the value of the field is `UNIT3`"]
187    #[inline(always)]
188    pub fn is_unit3(&self) -> bool {
189        *self == BLOCKSIZE_A::UNIT3
190    }
191    #[doc = "Checks if the value of the field is `UNIT4`"]
192    #[inline(always)]
193    pub fn is_unit4(&self) -> bool {
194        *self == BLOCKSIZE_A::UNIT4
195    }
196    #[doc = "Checks if the value of the field is `UNIT6`"]
197    #[inline(always)]
198    pub fn is_unit6(&self) -> bool {
199        *self == BLOCKSIZE_A::UNIT6
200    }
201    #[doc = "Checks if the value of the field is `UNIT8`"]
202    #[inline(always)]
203    pub fn is_unit8(&self) -> bool {
204        *self == BLOCKSIZE_A::UNIT8
205    }
206    #[doc = "Checks if the value of the field is `UNIT16`"]
207    #[inline(always)]
208    pub fn is_unit16(&self) -> bool {
209        *self == BLOCKSIZE_A::UNIT16
210    }
211    #[doc = "Checks if the value of the field is `UNIT32`"]
212    #[inline(always)]
213    pub fn is_unit32(&self) -> bool {
214        *self == BLOCKSIZE_A::UNIT32
215    }
216    #[doc = "Checks if the value of the field is `UNIT64`"]
217    #[inline(always)]
218    pub fn is_unit64(&self) -> bool {
219        *self == BLOCKSIZE_A::UNIT64
220    }
221    #[doc = "Checks if the value of the field is `UNIT128`"]
222    #[inline(always)]
223    pub fn is_unit128(&self) -> bool {
224        *self == BLOCKSIZE_A::UNIT128
225    }
226    #[doc = "Checks if the value of the field is `UNIT256`"]
227    #[inline(always)]
228    pub fn is_unit256(&self) -> bool {
229        *self == BLOCKSIZE_A::UNIT256
230    }
231    #[doc = "Checks if the value of the field is `UNIT512`"]
232    #[inline(always)]
233    pub fn is_unit512(&self) -> bool {
234        *self == BLOCKSIZE_A::UNIT512
235    }
236    #[doc = "Checks if the value of the field is `UNIT1024`"]
237    #[inline(always)]
238    pub fn is_unit1024(&self) -> bool {
239        *self == BLOCKSIZE_A::UNIT1024
240    }
241    #[doc = "Checks if the value of the field is `ALL`"]
242    #[inline(always)]
243    pub fn is_all(&self) -> bool {
244        *self == BLOCKSIZE_A::ALL
245    }
246}
247#[doc = "Field `BLOCKSIZE` writer - Block Transfer Size"]
248pub type BLOCKSIZE_W<'a, const O: u8> =
249    crate::FieldWriter<'a, u32, CH2_CTRL_SPEC, u8, BLOCKSIZE_A, 4, O>;
250impl<'a, const O: u8> BLOCKSIZE_W<'a, O> {
251    #[doc = "One unit transfer per arbitration"]
252    #[inline(always)]
253    pub fn unit1(self) -> &'a mut W {
254        self.variant(BLOCKSIZE_A::UNIT1)
255    }
256    #[doc = "Two unit transfers per arbitration"]
257    #[inline(always)]
258    pub fn unit2(self) -> &'a mut W {
259        self.variant(BLOCKSIZE_A::UNIT2)
260    }
261    #[doc = "Three unit transfers per arbitration"]
262    #[inline(always)]
263    pub fn unit3(self) -> &'a mut W {
264        self.variant(BLOCKSIZE_A::UNIT3)
265    }
266    #[doc = "Four unit transfers per arbitration"]
267    #[inline(always)]
268    pub fn unit4(self) -> &'a mut W {
269        self.variant(BLOCKSIZE_A::UNIT4)
270    }
271    #[doc = "Six unit transfers per arbitration"]
272    #[inline(always)]
273    pub fn unit6(self) -> &'a mut W {
274        self.variant(BLOCKSIZE_A::UNIT6)
275    }
276    #[doc = "Eight unit transfers per arbitration"]
277    #[inline(always)]
278    pub fn unit8(self) -> &'a mut W {
279        self.variant(BLOCKSIZE_A::UNIT8)
280    }
281    #[doc = "Sixteen unit transfers per arbitration"]
282    #[inline(always)]
283    pub fn unit16(self) -> &'a mut W {
284        self.variant(BLOCKSIZE_A::UNIT16)
285    }
286    #[doc = "32 unit transfers per arbitration"]
287    #[inline(always)]
288    pub fn unit32(self) -> &'a mut W {
289        self.variant(BLOCKSIZE_A::UNIT32)
290    }
291    #[doc = "64 unit transfers per arbitration"]
292    #[inline(always)]
293    pub fn unit64(self) -> &'a mut W {
294        self.variant(BLOCKSIZE_A::UNIT64)
295    }
296    #[doc = "128 unit transfers per arbitration"]
297    #[inline(always)]
298    pub fn unit128(self) -> &'a mut W {
299        self.variant(BLOCKSIZE_A::UNIT128)
300    }
301    #[doc = "256 unit transfers per arbitration"]
302    #[inline(always)]
303    pub fn unit256(self) -> &'a mut W {
304        self.variant(BLOCKSIZE_A::UNIT256)
305    }
306    #[doc = "512 unit transfers per arbitration"]
307    #[inline(always)]
308    pub fn unit512(self) -> &'a mut W {
309        self.variant(BLOCKSIZE_A::UNIT512)
310    }
311    #[doc = "1024 unit transfers per arbitration"]
312    #[inline(always)]
313    pub fn unit1024(self) -> &'a mut W {
314        self.variant(BLOCKSIZE_A::UNIT1024)
315    }
316    #[doc = "Transfer all units as specified by the XFRCNT field"]
317    #[inline(always)]
318    pub fn all(self) -> &'a mut W {
319        self.variant(BLOCKSIZE_A::ALL)
320    }
321}
322#[doc = "Field `DONEIEN` reader - DMA Operation Done Interrupt Flag Set En"]
323pub type DONEIEN_R = crate::BitReader<bool>;
324#[doc = "Field `DONEIEN` writer - DMA Operation Done Interrupt Flag Set En"]
325pub type DONEIEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CH2_CTRL_SPEC, bool, O>;
326#[doc = "Field `REQMODE` reader - DMA Request Transfer Mode Select"]
327pub type REQMODE_R = crate::BitReader<REQMODE_A>;
328#[doc = "DMA Request Transfer Mode Select\n\nValue on reset: 0"]
329#[derive(Clone, Copy, Debug, PartialEq, Eq)]
330pub enum REQMODE_A {
331    #[doc = "0: The LDMA transfers one BLOCKSIZE per transfer request."]
332    BLOCK = 0,
333    #[doc = "1: One transfer request transfers all units as defined by the XFRCNT field."]
334    ALL = 1,
335}
336impl From<REQMODE_A> for bool {
337    #[inline(always)]
338    fn from(variant: REQMODE_A) -> Self {
339        variant as u8 != 0
340    }
341}
342impl REQMODE_R {
343    #[doc = "Get enumerated values variant"]
344    #[inline(always)]
345    pub fn variant(&self) -> REQMODE_A {
346        match self.bits {
347            false => REQMODE_A::BLOCK,
348            true => REQMODE_A::ALL,
349        }
350    }
351    #[doc = "Checks if the value of the field is `BLOCK`"]
352    #[inline(always)]
353    pub fn is_block(&self) -> bool {
354        *self == REQMODE_A::BLOCK
355    }
356    #[doc = "Checks if the value of the field is `ALL`"]
357    #[inline(always)]
358    pub fn is_all(&self) -> bool {
359        *self == REQMODE_A::ALL
360    }
361}
362#[doc = "Field `REQMODE` writer - DMA Request Transfer Mode Select"]
363pub type REQMODE_W<'a, const O: u8> = crate::BitWriter<'a, u32, CH2_CTRL_SPEC, REQMODE_A, O>;
364impl<'a, const O: u8> REQMODE_W<'a, O> {
365    #[doc = "The LDMA transfers one BLOCKSIZE per transfer request."]
366    #[inline(always)]
367    pub fn block(self) -> &'a mut W {
368        self.variant(REQMODE_A::BLOCK)
369    }
370    #[doc = "One transfer request transfers all units as defined by the XFRCNT field."]
371    #[inline(always)]
372    pub fn all(self) -> &'a mut W {
373        self.variant(REQMODE_A::ALL)
374    }
375}
376#[doc = "Field `DECLOOPCNT` reader - Decrement Loop Count"]
377pub type DECLOOPCNT_R = crate::BitReader<bool>;
378#[doc = "Field `DECLOOPCNT` writer - Decrement Loop Count"]
379pub type DECLOOPCNT_W<'a, const O: u8> = crate::BitWriter<'a, u32, CH2_CTRL_SPEC, bool, O>;
380#[doc = "Field `IGNORESREQ` reader - Ignore Sreq"]
381pub type IGNORESREQ_R = crate::BitReader<bool>;
382#[doc = "Field `IGNORESREQ` writer - Ignore Sreq"]
383pub type IGNORESREQ_W<'a, const O: u8> = crate::BitWriter<'a, u32, CH2_CTRL_SPEC, bool, O>;
384#[doc = "Field `SRCINC` reader - Source Address Increment Size"]
385pub type SRCINC_R = crate::FieldReader<u8, SRCINC_A>;
386#[doc = "Source Address Increment Size\n\nValue on reset: 0"]
387#[derive(Clone, Copy, Debug, PartialEq, Eq)]
388#[repr(u8)]
389pub enum SRCINC_A {
390    #[doc = "0: Increment source address by one unit data size after each read"]
391    ONE = 0,
392    #[doc = "1: Increment source address by two unit data sizes after each read"]
393    TWO = 1,
394    #[doc = "2: Increment source address by four unit data sizes after each read"]
395    FOUR = 2,
396    #[doc = "3: Do not increment the source address. In this mode reads are made from a fixed source address, for example reading FIFO."]
397    NONE = 3,
398}
399impl From<SRCINC_A> for u8 {
400    #[inline(always)]
401    fn from(variant: SRCINC_A) -> Self {
402        variant as _
403    }
404}
405impl SRCINC_R {
406    #[doc = "Get enumerated values variant"]
407    #[inline(always)]
408    pub fn variant(&self) -> SRCINC_A {
409        match self.bits {
410            0 => SRCINC_A::ONE,
411            1 => SRCINC_A::TWO,
412            2 => SRCINC_A::FOUR,
413            3 => SRCINC_A::NONE,
414            _ => unreachable!(),
415        }
416    }
417    #[doc = "Checks if the value of the field is `ONE`"]
418    #[inline(always)]
419    pub fn is_one(&self) -> bool {
420        *self == SRCINC_A::ONE
421    }
422    #[doc = "Checks if the value of the field is `TWO`"]
423    #[inline(always)]
424    pub fn is_two(&self) -> bool {
425        *self == SRCINC_A::TWO
426    }
427    #[doc = "Checks if the value of the field is `FOUR`"]
428    #[inline(always)]
429    pub fn is_four(&self) -> bool {
430        *self == SRCINC_A::FOUR
431    }
432    #[doc = "Checks if the value of the field is `NONE`"]
433    #[inline(always)]
434    pub fn is_none(&self) -> bool {
435        *self == SRCINC_A::NONE
436    }
437}
438#[doc = "Field `SRCINC` writer - Source Address Increment Size"]
439pub type SRCINC_W<'a, const O: u8> =
440    crate::FieldWriterSafe<'a, u32, CH2_CTRL_SPEC, u8, SRCINC_A, 2, O>;
441impl<'a, const O: u8> SRCINC_W<'a, O> {
442    #[doc = "Increment source address by one unit data size after each read"]
443    #[inline(always)]
444    pub fn one(self) -> &'a mut W {
445        self.variant(SRCINC_A::ONE)
446    }
447    #[doc = "Increment source address by two unit data sizes after each read"]
448    #[inline(always)]
449    pub fn two(self) -> &'a mut W {
450        self.variant(SRCINC_A::TWO)
451    }
452    #[doc = "Increment source address by four unit data sizes after each read"]
453    #[inline(always)]
454    pub fn four(self) -> &'a mut W {
455        self.variant(SRCINC_A::FOUR)
456    }
457    #[doc = "Do not increment the source address. In this mode reads are made from a fixed source address, for example reading FIFO."]
458    #[inline(always)]
459    pub fn none(self) -> &'a mut W {
460        self.variant(SRCINC_A::NONE)
461    }
462}
463#[doc = "Field `SIZE` reader - Unit Data Transfer Size"]
464pub type SIZE_R = crate::FieldReader<u8, SIZE_A>;
465#[doc = "Unit Data Transfer Size\n\nValue on reset: 0"]
466#[derive(Clone, Copy, Debug, PartialEq, Eq)]
467#[repr(u8)]
468pub enum SIZE_A {
469    #[doc = "0: Each unit transfer is a byte"]
470    BYTE = 0,
471    #[doc = "1: Each unit transfer is a half-word"]
472    HALFWORD = 1,
473    #[doc = "2: Each unit transfer is a word"]
474    WORD = 2,
475}
476impl From<SIZE_A> for u8 {
477    #[inline(always)]
478    fn from(variant: SIZE_A) -> Self {
479        variant as _
480    }
481}
482impl SIZE_R {
483    #[doc = "Get enumerated values variant"]
484    #[inline(always)]
485    pub fn variant(&self) -> Option<SIZE_A> {
486        match self.bits {
487            0 => Some(SIZE_A::BYTE),
488            1 => Some(SIZE_A::HALFWORD),
489            2 => Some(SIZE_A::WORD),
490            _ => None,
491        }
492    }
493    #[doc = "Checks if the value of the field is `BYTE`"]
494    #[inline(always)]
495    pub fn is_byte(&self) -> bool {
496        *self == SIZE_A::BYTE
497    }
498    #[doc = "Checks if the value of the field is `HALFWORD`"]
499    #[inline(always)]
500    pub fn is_halfword(&self) -> bool {
501        *self == SIZE_A::HALFWORD
502    }
503    #[doc = "Checks if the value of the field is `WORD`"]
504    #[inline(always)]
505    pub fn is_word(&self) -> bool {
506        *self == SIZE_A::WORD
507    }
508}
509#[doc = "Field `SIZE` writer - Unit Data Transfer Size"]
510pub type SIZE_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CH2_CTRL_SPEC, u8, SIZE_A, 2, O>;
511impl<'a, const O: u8> SIZE_W<'a, O> {
512    #[doc = "Each unit transfer is a byte"]
513    #[inline(always)]
514    pub fn byte(self) -> &'a mut W {
515        self.variant(SIZE_A::BYTE)
516    }
517    #[doc = "Each unit transfer is a half-word"]
518    #[inline(always)]
519    pub fn halfword(self) -> &'a mut W {
520        self.variant(SIZE_A::HALFWORD)
521    }
522    #[doc = "Each unit transfer is a word"]
523    #[inline(always)]
524    pub fn word(self) -> &'a mut W {
525        self.variant(SIZE_A::WORD)
526    }
527}
528#[doc = "Field `DSTINC` reader - Destination Address Increment Size"]
529pub type DSTINC_R = crate::FieldReader<u8, DSTINC_A>;
530#[doc = "Destination Address Increment Size\n\nValue on reset: 0"]
531#[derive(Clone, Copy, Debug, PartialEq, Eq)]
532#[repr(u8)]
533pub enum DSTINC_A {
534    #[doc = "0: Increment destination address by one unit data size after each write"]
535    ONE = 0,
536    #[doc = "1: Increment destination address by two unit data sizes after each write"]
537    TWO = 1,
538    #[doc = "2: Increment destination address by four unit data sizes after each write"]
539    FOUR = 2,
540    #[doc = "3: Do not increment the destination address. Writes are made to a fixed destination address, for example writing to a FIFO."]
541    NONE = 3,
542}
543impl From<DSTINC_A> for u8 {
544    #[inline(always)]
545    fn from(variant: DSTINC_A) -> Self {
546        variant as _
547    }
548}
549impl DSTINC_R {
550    #[doc = "Get enumerated values variant"]
551    #[inline(always)]
552    pub fn variant(&self) -> DSTINC_A {
553        match self.bits {
554            0 => DSTINC_A::ONE,
555            1 => DSTINC_A::TWO,
556            2 => DSTINC_A::FOUR,
557            3 => DSTINC_A::NONE,
558            _ => unreachable!(),
559        }
560    }
561    #[doc = "Checks if the value of the field is `ONE`"]
562    #[inline(always)]
563    pub fn is_one(&self) -> bool {
564        *self == DSTINC_A::ONE
565    }
566    #[doc = "Checks if the value of the field is `TWO`"]
567    #[inline(always)]
568    pub fn is_two(&self) -> bool {
569        *self == DSTINC_A::TWO
570    }
571    #[doc = "Checks if the value of the field is `FOUR`"]
572    #[inline(always)]
573    pub fn is_four(&self) -> bool {
574        *self == DSTINC_A::FOUR
575    }
576    #[doc = "Checks if the value of the field is `NONE`"]
577    #[inline(always)]
578    pub fn is_none(&self) -> bool {
579        *self == DSTINC_A::NONE
580    }
581}
582#[doc = "Field `DSTINC` writer - Destination Address Increment Size"]
583pub type DSTINC_W<'a, const O: u8> =
584    crate::FieldWriterSafe<'a, u32, CH2_CTRL_SPEC, u8, DSTINC_A, 2, O>;
585impl<'a, const O: u8> DSTINC_W<'a, O> {
586    #[doc = "Increment destination address by one unit data size after each write"]
587    #[inline(always)]
588    pub fn one(self) -> &'a mut W {
589        self.variant(DSTINC_A::ONE)
590    }
591    #[doc = "Increment destination address by two unit data sizes after each write"]
592    #[inline(always)]
593    pub fn two(self) -> &'a mut W {
594        self.variant(DSTINC_A::TWO)
595    }
596    #[doc = "Increment destination address by four unit data sizes after each write"]
597    #[inline(always)]
598    pub fn four(self) -> &'a mut W {
599        self.variant(DSTINC_A::FOUR)
600    }
601    #[doc = "Do not increment the destination address. Writes are made to a fixed destination address, for example writing to a FIFO."]
602    #[inline(always)]
603    pub fn none(self) -> &'a mut W {
604        self.variant(DSTINC_A::NONE)
605    }
606}
607#[doc = "Field `SRCMODE` reader - Source Addressing Mode"]
608pub type SRCMODE_R = crate::BitReader<SRCMODE_A>;
609#[doc = "Source Addressing Mode\n\nValue on reset: 0"]
610#[derive(Clone, Copy, Debug, PartialEq, Eq)]
611pub enum SRCMODE_A {
612    #[doc = "0: The SRCADDR field of LDMA_CHx_SRC contains the absolute address of the source data."]
613    ABSOLUTE = 0,
614    #[doc = "1: The SRCADDR field of LDMA_CHx_SRC contains the relative offset of the source data."]
615    RELATIVE = 1,
616}
617impl From<SRCMODE_A> for bool {
618    #[inline(always)]
619    fn from(variant: SRCMODE_A) -> Self {
620        variant as u8 != 0
621    }
622}
623impl SRCMODE_R {
624    #[doc = "Get enumerated values variant"]
625    #[inline(always)]
626    pub fn variant(&self) -> SRCMODE_A {
627        match self.bits {
628            false => SRCMODE_A::ABSOLUTE,
629            true => SRCMODE_A::RELATIVE,
630        }
631    }
632    #[doc = "Checks if the value of the field is `ABSOLUTE`"]
633    #[inline(always)]
634    pub fn is_absolute(&self) -> bool {
635        *self == SRCMODE_A::ABSOLUTE
636    }
637    #[doc = "Checks if the value of the field is `RELATIVE`"]
638    #[inline(always)]
639    pub fn is_relative(&self) -> bool {
640        *self == SRCMODE_A::RELATIVE
641    }
642}
643#[doc = "Field `DSTMODE` reader - Destination Addressing Mode"]
644pub type DSTMODE_R = crate::BitReader<DSTMODE_A>;
645#[doc = "Destination Addressing Mode\n\nValue on reset: 0"]
646#[derive(Clone, Copy, Debug, PartialEq, Eq)]
647pub enum DSTMODE_A {
648    #[doc = "0: The DSTADDR field of LDMA_CHx_DST contains the absolute address of the destination data."]
649    ABSOLUTE = 0,
650    #[doc = "1: The DSTADDR field of LDMA_CHx_DST contains the relative offset of the destination data."]
651    RELATIVE = 1,
652}
653impl From<DSTMODE_A> for bool {
654    #[inline(always)]
655    fn from(variant: DSTMODE_A) -> Self {
656        variant as u8 != 0
657    }
658}
659impl DSTMODE_R {
660    #[doc = "Get enumerated values variant"]
661    #[inline(always)]
662    pub fn variant(&self) -> DSTMODE_A {
663        match self.bits {
664            false => DSTMODE_A::ABSOLUTE,
665            true => DSTMODE_A::RELATIVE,
666        }
667    }
668    #[doc = "Checks if the value of the field is `ABSOLUTE`"]
669    #[inline(always)]
670    pub fn is_absolute(&self) -> bool {
671        *self == DSTMODE_A::ABSOLUTE
672    }
673    #[doc = "Checks if the value of the field is `RELATIVE`"]
674    #[inline(always)]
675    pub fn is_relative(&self) -> bool {
676        *self == DSTMODE_A::RELATIVE
677    }
678}
679impl R {
680    #[doc = "Bits 0:1 - DMA Structure Type"]
681    #[inline(always)]
682    pub fn structtype(&self) -> STRUCTTYPE_R {
683        STRUCTTYPE_R::new((self.bits & 3) as u8)
684    }
685    #[doc = "Bit 3 - Structure DMA Transfer Request"]
686    #[inline(always)]
687    pub fn structreq(&self) -> STRUCTREQ_R {
688        STRUCTREQ_R::new(((self.bits >> 3) & 1) != 0)
689    }
690    #[doc = "Bits 4:14 - DMA Unit Data Transfer Count"]
691    #[inline(always)]
692    pub fn xfercnt(&self) -> XFERCNT_R {
693        XFERCNT_R::new(((self.bits >> 4) & 0x07ff) as u16)
694    }
695    #[doc = "Bit 15 - Endian Byte Swap"]
696    #[inline(always)]
697    pub fn byteswap(&self) -> BYTESWAP_R {
698        BYTESWAP_R::new(((self.bits >> 15) & 1) != 0)
699    }
700    #[doc = "Bits 16:19 - Block Transfer Size"]
701    #[inline(always)]
702    pub fn blocksize(&self) -> BLOCKSIZE_R {
703        BLOCKSIZE_R::new(((self.bits >> 16) & 0x0f) as u8)
704    }
705    #[doc = "Bit 20 - DMA Operation Done Interrupt Flag Set En"]
706    #[inline(always)]
707    pub fn doneien(&self) -> DONEIEN_R {
708        DONEIEN_R::new(((self.bits >> 20) & 1) != 0)
709    }
710    #[doc = "Bit 21 - DMA Request Transfer Mode Select"]
711    #[inline(always)]
712    pub fn reqmode(&self) -> REQMODE_R {
713        REQMODE_R::new(((self.bits >> 21) & 1) != 0)
714    }
715    #[doc = "Bit 22 - Decrement Loop Count"]
716    #[inline(always)]
717    pub fn decloopcnt(&self) -> DECLOOPCNT_R {
718        DECLOOPCNT_R::new(((self.bits >> 22) & 1) != 0)
719    }
720    #[doc = "Bit 23 - Ignore Sreq"]
721    #[inline(always)]
722    pub fn ignoresreq(&self) -> IGNORESREQ_R {
723        IGNORESREQ_R::new(((self.bits >> 23) & 1) != 0)
724    }
725    #[doc = "Bits 24:25 - Source Address Increment Size"]
726    #[inline(always)]
727    pub fn srcinc(&self) -> SRCINC_R {
728        SRCINC_R::new(((self.bits >> 24) & 3) as u8)
729    }
730    #[doc = "Bits 26:27 - Unit Data Transfer Size"]
731    #[inline(always)]
732    pub fn size(&self) -> SIZE_R {
733        SIZE_R::new(((self.bits >> 26) & 3) as u8)
734    }
735    #[doc = "Bits 28:29 - Destination Address Increment Size"]
736    #[inline(always)]
737    pub fn dstinc(&self) -> DSTINC_R {
738        DSTINC_R::new(((self.bits >> 28) & 3) as u8)
739    }
740    #[doc = "Bit 30 - Source Addressing Mode"]
741    #[inline(always)]
742    pub fn srcmode(&self) -> SRCMODE_R {
743        SRCMODE_R::new(((self.bits >> 30) & 1) != 0)
744    }
745    #[doc = "Bit 31 - Destination Addressing Mode"]
746    #[inline(always)]
747    pub fn dstmode(&self) -> DSTMODE_R {
748        DSTMODE_R::new(((self.bits >> 31) & 1) != 0)
749    }
750}
751impl W {
752    #[doc = "Bits 0:1 - DMA Structure Type"]
753    #[inline(always)]
754    #[must_use]
755    pub fn structtype(&mut self) -> STRUCTTYPE_W<0> {
756        STRUCTTYPE_W::new(self)
757    }
758    #[doc = "Bits 4:14 - DMA Unit Data Transfer Count"]
759    #[inline(always)]
760    #[must_use]
761    pub fn xfercnt(&mut self) -> XFERCNT_W<4> {
762        XFERCNT_W::new(self)
763    }
764    #[doc = "Bit 15 - Endian Byte Swap"]
765    #[inline(always)]
766    #[must_use]
767    pub fn byteswap(&mut self) -> BYTESWAP_W<15> {
768        BYTESWAP_W::new(self)
769    }
770    #[doc = "Bits 16:19 - Block Transfer Size"]
771    #[inline(always)]
772    #[must_use]
773    pub fn blocksize(&mut self) -> BLOCKSIZE_W<16> {
774        BLOCKSIZE_W::new(self)
775    }
776    #[doc = "Bit 20 - DMA Operation Done Interrupt Flag Set En"]
777    #[inline(always)]
778    #[must_use]
779    pub fn doneien(&mut self) -> DONEIEN_W<20> {
780        DONEIEN_W::new(self)
781    }
782    #[doc = "Bit 21 - DMA Request Transfer Mode Select"]
783    #[inline(always)]
784    #[must_use]
785    pub fn reqmode(&mut self) -> REQMODE_W<21> {
786        REQMODE_W::new(self)
787    }
788    #[doc = "Bit 22 - Decrement Loop Count"]
789    #[inline(always)]
790    #[must_use]
791    pub fn decloopcnt(&mut self) -> DECLOOPCNT_W<22> {
792        DECLOOPCNT_W::new(self)
793    }
794    #[doc = "Bit 23 - Ignore Sreq"]
795    #[inline(always)]
796    #[must_use]
797    pub fn ignoresreq(&mut self) -> IGNORESREQ_W<23> {
798        IGNORESREQ_W::new(self)
799    }
800    #[doc = "Bits 24:25 - Source Address Increment Size"]
801    #[inline(always)]
802    #[must_use]
803    pub fn srcinc(&mut self) -> SRCINC_W<24> {
804        SRCINC_W::new(self)
805    }
806    #[doc = "Bits 26:27 - Unit Data Transfer Size"]
807    #[inline(always)]
808    #[must_use]
809    pub fn size(&mut self) -> SIZE_W<26> {
810        SIZE_W::new(self)
811    }
812    #[doc = "Bits 28:29 - Destination Address Increment Size"]
813    #[inline(always)]
814    #[must_use]
815    pub fn dstinc(&mut self) -> DSTINC_W<28> {
816        DSTINC_W::new(self)
817    }
818    #[doc = "Writes raw bits to the register."]
819    #[inline(always)]
820    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
821        self.0.bits(bits);
822        self
823    }
824}
825#[doc = "No Description\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 [ch2_ctrl](index.html) module"]
826pub struct CH2_CTRL_SPEC;
827impl crate::RegisterSpec for CH2_CTRL_SPEC {
828    type Ux = u32;
829}
830#[doc = "`read()` method returns [ch2_ctrl::R](R) reader structure"]
831impl crate::Readable for CH2_CTRL_SPEC {
832    type Reader = R;
833}
834#[doc = "`write(|w| ..)` method takes [ch2_ctrl::W](W) writer structure"]
835impl crate::Writable for CH2_CTRL_SPEC {
836    type Writer = W;
837    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
838    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
839}
840#[doc = "`reset()` method sets CH2_CTRL to value 0"]
841impl crate::Resettable for CH2_CTRL_SPEC {
842    const RESET_VALUE: Self::Ux = 0;
843}