ra4e1/dmac0/
dmtmd.rs

1#[doc = "Register `DMTMD` reader"]
2pub struct R(crate::R<DMTMD_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<DMTMD_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<DMTMD_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<DMTMD_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `DMTMD` writer"]
17pub struct W(crate::W<DMTMD_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<DMTMD_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<DMTMD_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<DMTMD_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `DCTG` reader - Transfer Request Source Select"]
38pub type DCTG_R = crate::FieldReader<u8, DCTG_A>;
39#[doc = "Transfer Request Source Select\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum DCTG_A {
43    #[doc = "0: Software request"]
44    _00 = 0,
45    #[doc = "1: Hardware request"]
46    _01 = 1,
47    #[doc = "2: Setting prohibited"]
48    _10 = 2,
49    #[doc = "3: Setting prohibited"]
50    _11 = 3,
51}
52impl From<DCTG_A> for u8 {
53    #[inline(always)]
54    fn from(variant: DCTG_A) -> Self {
55        variant as _
56    }
57}
58impl DCTG_R {
59    #[doc = "Get enumerated values variant"]
60    #[inline(always)]
61    pub fn variant(&self) -> DCTG_A {
62        match self.bits {
63            0 => DCTG_A::_00,
64            1 => DCTG_A::_01,
65            2 => DCTG_A::_10,
66            3 => DCTG_A::_11,
67            _ => unreachable!(),
68        }
69    }
70    #[doc = "Checks if the value of the field is `_00`"]
71    #[inline(always)]
72    pub fn is_00(&self) -> bool {
73        *self == DCTG_A::_00
74    }
75    #[doc = "Checks if the value of the field is `_01`"]
76    #[inline(always)]
77    pub fn is_01(&self) -> bool {
78        *self == DCTG_A::_01
79    }
80    #[doc = "Checks if the value of the field is `_10`"]
81    #[inline(always)]
82    pub fn is_10(&self) -> bool {
83        *self == DCTG_A::_10
84    }
85    #[doc = "Checks if the value of the field is `_11`"]
86    #[inline(always)]
87    pub fn is_11(&self) -> bool {
88        *self == DCTG_A::_11
89    }
90}
91#[doc = "Field `DCTG` writer - Transfer Request Source Select"]
92pub type DCTG_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u16, DMTMD_SPEC, u8, DCTG_A, 2, O>;
93impl<'a, const O: u8> DCTG_W<'a, O> {
94    #[doc = "Software request"]
95    #[inline(always)]
96    pub fn _00(self) -> &'a mut W {
97        self.variant(DCTG_A::_00)
98    }
99    #[doc = "Hardware request"]
100    #[inline(always)]
101    pub fn _01(self) -> &'a mut W {
102        self.variant(DCTG_A::_01)
103    }
104    #[doc = "Setting prohibited"]
105    #[inline(always)]
106    pub fn _10(self) -> &'a mut W {
107        self.variant(DCTG_A::_10)
108    }
109    #[doc = "Setting prohibited"]
110    #[inline(always)]
111    pub fn _11(self) -> &'a mut W {
112        self.variant(DCTG_A::_11)
113    }
114}
115#[doc = "Field `SZ` reader - Transfer Data Size Select"]
116pub type SZ_R = crate::FieldReader<u8, SZ_A>;
117#[doc = "Transfer Data Size Select\n\nValue on reset: 0"]
118#[derive(Clone, Copy, Debug, PartialEq, Eq)]
119#[repr(u8)]
120pub enum SZ_A {
121    #[doc = "0: 8 bits"]
122    _00 = 0,
123    #[doc = "1: 16 bits"]
124    _01 = 1,
125    #[doc = "2: 32 bits"]
126    _10 = 2,
127    #[doc = "3: Setting prohibited"]
128    _11 = 3,
129}
130impl From<SZ_A> for u8 {
131    #[inline(always)]
132    fn from(variant: SZ_A) -> Self {
133        variant as _
134    }
135}
136impl SZ_R {
137    #[doc = "Get enumerated values variant"]
138    #[inline(always)]
139    pub fn variant(&self) -> SZ_A {
140        match self.bits {
141            0 => SZ_A::_00,
142            1 => SZ_A::_01,
143            2 => SZ_A::_10,
144            3 => SZ_A::_11,
145            _ => unreachable!(),
146        }
147    }
148    #[doc = "Checks if the value of the field is `_00`"]
149    #[inline(always)]
150    pub fn is_00(&self) -> bool {
151        *self == SZ_A::_00
152    }
153    #[doc = "Checks if the value of the field is `_01`"]
154    #[inline(always)]
155    pub fn is_01(&self) -> bool {
156        *self == SZ_A::_01
157    }
158    #[doc = "Checks if the value of the field is `_10`"]
159    #[inline(always)]
160    pub fn is_10(&self) -> bool {
161        *self == SZ_A::_10
162    }
163    #[doc = "Checks if the value of the field is `_11`"]
164    #[inline(always)]
165    pub fn is_11(&self) -> bool {
166        *self == SZ_A::_11
167    }
168}
169#[doc = "Field `SZ` writer - Transfer Data Size Select"]
170pub type SZ_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u16, DMTMD_SPEC, u8, SZ_A, 2, O>;
171impl<'a, const O: u8> SZ_W<'a, O> {
172    #[doc = "8 bits"]
173    #[inline(always)]
174    pub fn _00(self) -> &'a mut W {
175        self.variant(SZ_A::_00)
176    }
177    #[doc = "16 bits"]
178    #[inline(always)]
179    pub fn _01(self) -> &'a mut W {
180        self.variant(SZ_A::_01)
181    }
182    #[doc = "32 bits"]
183    #[inline(always)]
184    pub fn _10(self) -> &'a mut W {
185        self.variant(SZ_A::_10)
186    }
187    #[doc = "Setting prohibited"]
188    #[inline(always)]
189    pub fn _11(self) -> &'a mut W {
190        self.variant(SZ_A::_11)
191    }
192}
193#[doc = "Field `TKP` reader - Transfer Keeping"]
194pub type TKP_R = crate::BitReader<TKP_A>;
195#[doc = "Transfer Keeping\n\nValue on reset: 0"]
196#[derive(Clone, Copy, Debug, PartialEq, Eq)]
197pub enum TKP_A {
198    #[doc = "0: Transfer is stopped by completion of specified total number of transfer operations."]
199    _0 = 0,
200    #[doc = "1: Transfer is not stopped by completion of specified total number of transfer operations. (free-running)"]
201    _1 = 1,
202}
203impl From<TKP_A> for bool {
204    #[inline(always)]
205    fn from(variant: TKP_A) -> Self {
206        variant as u8 != 0
207    }
208}
209impl TKP_R {
210    #[doc = "Get enumerated values variant"]
211    #[inline(always)]
212    pub fn variant(&self) -> TKP_A {
213        match self.bits {
214            false => TKP_A::_0,
215            true => TKP_A::_1,
216        }
217    }
218    #[doc = "Checks if the value of the field is `_0`"]
219    #[inline(always)]
220    pub fn is_0(&self) -> bool {
221        *self == TKP_A::_0
222    }
223    #[doc = "Checks if the value of the field is `_1`"]
224    #[inline(always)]
225    pub fn is_1(&self) -> bool {
226        *self == TKP_A::_1
227    }
228}
229#[doc = "Field `TKP` writer - Transfer Keeping"]
230pub type TKP_W<'a, const O: u8> = crate::BitWriter<'a, u16, DMTMD_SPEC, TKP_A, O>;
231impl<'a, const O: u8> TKP_W<'a, O> {
232    #[doc = "Transfer is stopped by completion of specified total number of transfer operations."]
233    #[inline(always)]
234    pub fn _0(self) -> &'a mut W {
235        self.variant(TKP_A::_0)
236    }
237    #[doc = "Transfer is not stopped by completion of specified total number of transfer operations. (free-running)"]
238    #[inline(always)]
239    pub fn _1(self) -> &'a mut W {
240        self.variant(TKP_A::_1)
241    }
242}
243#[doc = "Field `DTS` reader - Repeat Area Select"]
244pub type DTS_R = crate::FieldReader<u8, DTS_A>;
245#[doc = "Repeat Area Select\n\nValue on reset: 0"]
246#[derive(Clone, Copy, Debug, PartialEq, Eq)]
247#[repr(u8)]
248pub enum DTS_A {
249    #[doc = "0: The destination is specified as the repeat area or block area"]
250    _00 = 0,
251    #[doc = "1: The source is specified as the repeat area or block area"]
252    _01 = 1,
253    #[doc = "2: The repeat area or block area is not specified"]
254    _10 = 2,
255    #[doc = "3: Setting prohibited"]
256    _11 = 3,
257}
258impl From<DTS_A> for u8 {
259    #[inline(always)]
260    fn from(variant: DTS_A) -> Self {
261        variant as _
262    }
263}
264impl DTS_R {
265    #[doc = "Get enumerated values variant"]
266    #[inline(always)]
267    pub fn variant(&self) -> DTS_A {
268        match self.bits {
269            0 => DTS_A::_00,
270            1 => DTS_A::_01,
271            2 => DTS_A::_10,
272            3 => DTS_A::_11,
273            _ => unreachable!(),
274        }
275    }
276    #[doc = "Checks if the value of the field is `_00`"]
277    #[inline(always)]
278    pub fn is_00(&self) -> bool {
279        *self == DTS_A::_00
280    }
281    #[doc = "Checks if the value of the field is `_01`"]
282    #[inline(always)]
283    pub fn is_01(&self) -> bool {
284        *self == DTS_A::_01
285    }
286    #[doc = "Checks if the value of the field is `_10`"]
287    #[inline(always)]
288    pub fn is_10(&self) -> bool {
289        *self == DTS_A::_10
290    }
291    #[doc = "Checks if the value of the field is `_11`"]
292    #[inline(always)]
293    pub fn is_11(&self) -> bool {
294        *self == DTS_A::_11
295    }
296}
297#[doc = "Field `DTS` writer - Repeat Area Select"]
298pub type DTS_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u16, DMTMD_SPEC, u8, DTS_A, 2, O>;
299impl<'a, const O: u8> DTS_W<'a, O> {
300    #[doc = "The destination is specified as the repeat area or block area"]
301    #[inline(always)]
302    pub fn _00(self) -> &'a mut W {
303        self.variant(DTS_A::_00)
304    }
305    #[doc = "The source is specified as the repeat area or block area"]
306    #[inline(always)]
307    pub fn _01(self) -> &'a mut W {
308        self.variant(DTS_A::_01)
309    }
310    #[doc = "The repeat area or block area is not specified"]
311    #[inline(always)]
312    pub fn _10(self) -> &'a mut W {
313        self.variant(DTS_A::_10)
314    }
315    #[doc = "Setting prohibited"]
316    #[inline(always)]
317    pub fn _11(self) -> &'a mut W {
318        self.variant(DTS_A::_11)
319    }
320}
321#[doc = "Field `MD` reader - Transfer Mode Select"]
322pub type MD_R = crate::FieldReader<u8, MD_A>;
323#[doc = "Transfer Mode Select\n\nValue on reset: 0"]
324#[derive(Clone, Copy, Debug, PartialEq, Eq)]
325#[repr(u8)]
326pub enum MD_A {
327    #[doc = "0: Normal transfer"]
328    _00 = 0,
329    #[doc = "1: Repeat transfer"]
330    _01 = 1,
331    #[doc = "2: Block transfer"]
332    _10 = 2,
333    #[doc = "3: Repeat-block transfer"]
334    _11 = 3,
335}
336impl From<MD_A> for u8 {
337    #[inline(always)]
338    fn from(variant: MD_A) -> Self {
339        variant as _
340    }
341}
342impl MD_R {
343    #[doc = "Get enumerated values variant"]
344    #[inline(always)]
345    pub fn variant(&self) -> MD_A {
346        match self.bits {
347            0 => MD_A::_00,
348            1 => MD_A::_01,
349            2 => MD_A::_10,
350            3 => MD_A::_11,
351            _ => unreachable!(),
352        }
353    }
354    #[doc = "Checks if the value of the field is `_00`"]
355    #[inline(always)]
356    pub fn is_00(&self) -> bool {
357        *self == MD_A::_00
358    }
359    #[doc = "Checks if the value of the field is `_01`"]
360    #[inline(always)]
361    pub fn is_01(&self) -> bool {
362        *self == MD_A::_01
363    }
364    #[doc = "Checks if the value of the field is `_10`"]
365    #[inline(always)]
366    pub fn is_10(&self) -> bool {
367        *self == MD_A::_10
368    }
369    #[doc = "Checks if the value of the field is `_11`"]
370    #[inline(always)]
371    pub fn is_11(&self) -> bool {
372        *self == MD_A::_11
373    }
374}
375#[doc = "Field `MD` writer - Transfer Mode Select"]
376pub type MD_W<'a, const O: u8> = crate::FieldWriterSafe<'a, u16, DMTMD_SPEC, u8, MD_A, 2, O>;
377impl<'a, const O: u8> MD_W<'a, O> {
378    #[doc = "Normal transfer"]
379    #[inline(always)]
380    pub fn _00(self) -> &'a mut W {
381        self.variant(MD_A::_00)
382    }
383    #[doc = "Repeat transfer"]
384    #[inline(always)]
385    pub fn _01(self) -> &'a mut W {
386        self.variant(MD_A::_01)
387    }
388    #[doc = "Block transfer"]
389    #[inline(always)]
390    pub fn _10(self) -> &'a mut W {
391        self.variant(MD_A::_10)
392    }
393    #[doc = "Repeat-block transfer"]
394    #[inline(always)]
395    pub fn _11(self) -> &'a mut W {
396        self.variant(MD_A::_11)
397    }
398}
399impl R {
400    #[doc = "Bits 0:1 - Transfer Request Source Select"]
401    #[inline(always)]
402    pub fn dctg(&self) -> DCTG_R {
403        DCTG_R::new((self.bits & 3) as u8)
404    }
405    #[doc = "Bits 8:9 - Transfer Data Size Select"]
406    #[inline(always)]
407    pub fn sz(&self) -> SZ_R {
408        SZ_R::new(((self.bits >> 8) & 3) as u8)
409    }
410    #[doc = "Bit 10 - Transfer Keeping"]
411    #[inline(always)]
412    pub fn tkp(&self) -> TKP_R {
413        TKP_R::new(((self.bits >> 10) & 1) != 0)
414    }
415    #[doc = "Bits 12:13 - Repeat Area Select"]
416    #[inline(always)]
417    pub fn dts(&self) -> DTS_R {
418        DTS_R::new(((self.bits >> 12) & 3) as u8)
419    }
420    #[doc = "Bits 14:15 - Transfer Mode Select"]
421    #[inline(always)]
422    pub fn md(&self) -> MD_R {
423        MD_R::new(((self.bits >> 14) & 3) as u8)
424    }
425}
426impl W {
427    #[doc = "Bits 0:1 - Transfer Request Source Select"]
428    #[inline(always)]
429    #[must_use]
430    pub fn dctg(&mut self) -> DCTG_W<0> {
431        DCTG_W::new(self)
432    }
433    #[doc = "Bits 8:9 - Transfer Data Size Select"]
434    #[inline(always)]
435    #[must_use]
436    pub fn sz(&mut self) -> SZ_W<8> {
437        SZ_W::new(self)
438    }
439    #[doc = "Bit 10 - Transfer Keeping"]
440    #[inline(always)]
441    #[must_use]
442    pub fn tkp(&mut self) -> TKP_W<10> {
443        TKP_W::new(self)
444    }
445    #[doc = "Bits 12:13 - Repeat Area Select"]
446    #[inline(always)]
447    #[must_use]
448    pub fn dts(&mut self) -> DTS_W<12> {
449        DTS_W::new(self)
450    }
451    #[doc = "Bits 14:15 - Transfer Mode Select"]
452    #[inline(always)]
453    #[must_use]
454    pub fn md(&mut self) -> MD_W<14> {
455        MD_W::new(self)
456    }
457    #[doc = "Writes raw bits to the register."]
458    #[inline(always)]
459    pub unsafe fn bits(&mut self, bits: u16) -> &mut Self {
460        self.0.bits(bits);
461        self
462    }
463}
464#[doc = "DMA Transfer Mode Register\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 [dmtmd](index.html) module"]
465pub struct DMTMD_SPEC;
466impl crate::RegisterSpec for DMTMD_SPEC {
467    type Ux = u16;
468}
469#[doc = "`read()` method returns [dmtmd::R](R) reader structure"]
470impl crate::Readable for DMTMD_SPEC {
471    type Reader = R;
472}
473#[doc = "`write(|w| ..)` method takes [dmtmd::W](W) writer structure"]
474impl crate::Writable for DMTMD_SPEC {
475    type Writer = W;
476    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
477    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
478}
479#[doc = "`reset()` method sets DMTMD to value 0"]
480impl crate::Resettable for DMTMD_SPEC {
481    const RESET_VALUE: Self::Ux = 0;
482}