mcxa_pac/edma_0_tcd0/tcd/
tcd_nbytes_mloffno.rs

1#[doc = "Register `TCD_NBYTES_MLOFFNO` reader"]
2pub type R = crate::R<TcdNbytesMloffnoSpec>;
3#[doc = "Register `TCD_NBYTES_MLOFFNO` writer"]
4pub type W = crate::W<TcdNbytesMloffnoSpec>;
5#[doc = "Field `NBYTES` reader - Number of Bytes To Transfer Per Service Request"]
6pub type NbytesR = crate::FieldReader<u32>;
7#[doc = "Field `NBYTES` writer - Number of Bytes To Transfer Per Service Request"]
8pub type NbytesW<'a, REG> = crate::FieldWriter<'a, REG, 30, u32>;
9#[doc = "Destination Minor Loop Offset Enable\n\nValue on reset: 0"]
10#[cfg_attr(feature = "defmt", derive(defmt::Format))]
11#[derive(Clone, Copy, Debug, PartialEq, Eq)]
12pub enum Dmloe {
13    #[doc = "0: Minor loop offset not applied to DADDR"]
14    OffsetNotApplied = 0,
15    #[doc = "1: Minor loop offset applied to DADDR"]
16    OffsetApplied = 1,
17}
18impl From<Dmloe> for bool {
19    #[inline(always)]
20    fn from(variant: Dmloe) -> Self {
21        variant as u8 != 0
22    }
23}
24#[doc = "Field `DMLOE` reader - Destination Minor Loop Offset Enable"]
25pub type DmloeR = crate::BitReader<Dmloe>;
26impl DmloeR {
27    #[doc = "Get enumerated values variant"]
28    #[inline(always)]
29    pub const fn variant(&self) -> Dmloe {
30        match self.bits {
31            false => Dmloe::OffsetNotApplied,
32            true => Dmloe::OffsetApplied,
33        }
34    }
35    #[doc = "Minor loop offset not applied to DADDR"]
36    #[inline(always)]
37    pub fn is_offset_not_applied(&self) -> bool {
38        *self == Dmloe::OffsetNotApplied
39    }
40    #[doc = "Minor loop offset applied to DADDR"]
41    #[inline(always)]
42    pub fn is_offset_applied(&self) -> bool {
43        *self == Dmloe::OffsetApplied
44    }
45}
46#[doc = "Field `DMLOE` writer - Destination Minor Loop Offset Enable"]
47pub type DmloeW<'a, REG> = crate::BitWriter<'a, REG, Dmloe>;
48impl<'a, REG> DmloeW<'a, REG>
49where
50    REG: crate::Writable + crate::RegisterSpec,
51{
52    #[doc = "Minor loop offset not applied to DADDR"]
53    #[inline(always)]
54    pub fn offset_not_applied(self) -> &'a mut crate::W<REG> {
55        self.variant(Dmloe::OffsetNotApplied)
56    }
57    #[doc = "Minor loop offset applied to DADDR"]
58    #[inline(always)]
59    pub fn offset_applied(self) -> &'a mut crate::W<REG> {
60        self.variant(Dmloe::OffsetApplied)
61    }
62}
63#[doc = "Source Minor Loop Offset Enable\n\nValue on reset: 0"]
64#[cfg_attr(feature = "defmt", derive(defmt::Format))]
65#[derive(Clone, Copy, Debug, PartialEq, Eq)]
66pub enum Smloe {
67    #[doc = "0: Minor loop offset not applied to SADDR"]
68    OffsetNotApplied = 0,
69    #[doc = "1: Minor loop offset applied to SADDR"]
70    OffsetApplied = 1,
71}
72impl From<Smloe> for bool {
73    #[inline(always)]
74    fn from(variant: Smloe) -> Self {
75        variant as u8 != 0
76    }
77}
78#[doc = "Field `SMLOE` reader - Source Minor Loop Offset Enable"]
79pub type SmloeR = crate::BitReader<Smloe>;
80impl SmloeR {
81    #[doc = "Get enumerated values variant"]
82    #[inline(always)]
83    pub const fn variant(&self) -> Smloe {
84        match self.bits {
85            false => Smloe::OffsetNotApplied,
86            true => Smloe::OffsetApplied,
87        }
88    }
89    #[doc = "Minor loop offset not applied to SADDR"]
90    #[inline(always)]
91    pub fn is_offset_not_applied(&self) -> bool {
92        *self == Smloe::OffsetNotApplied
93    }
94    #[doc = "Minor loop offset applied to SADDR"]
95    #[inline(always)]
96    pub fn is_offset_applied(&self) -> bool {
97        *self == Smloe::OffsetApplied
98    }
99}
100#[doc = "Field `SMLOE` writer - Source Minor Loop Offset Enable"]
101pub type SmloeW<'a, REG> = crate::BitWriter<'a, REG, Smloe>;
102impl<'a, REG> SmloeW<'a, REG>
103where
104    REG: crate::Writable + crate::RegisterSpec,
105{
106    #[doc = "Minor loop offset not applied to SADDR"]
107    #[inline(always)]
108    pub fn offset_not_applied(self) -> &'a mut crate::W<REG> {
109        self.variant(Smloe::OffsetNotApplied)
110    }
111    #[doc = "Minor loop offset applied to SADDR"]
112    #[inline(always)]
113    pub fn offset_applied(self) -> &'a mut crate::W<REG> {
114        self.variant(Smloe::OffsetApplied)
115    }
116}
117impl R {
118    #[doc = "Bits 0:29 - Number of Bytes To Transfer Per Service Request"]
119    #[inline(always)]
120    pub fn nbytes(&self) -> NbytesR {
121        NbytesR::new(self.bits & 0x3fff_ffff)
122    }
123    #[doc = "Bit 30 - Destination Minor Loop Offset Enable"]
124    #[inline(always)]
125    pub fn dmloe(&self) -> DmloeR {
126        DmloeR::new(((self.bits >> 30) & 1) != 0)
127    }
128    #[doc = "Bit 31 - Source Minor Loop Offset Enable"]
129    #[inline(always)]
130    pub fn smloe(&self) -> SmloeR {
131        SmloeR::new(((self.bits >> 31) & 1) != 0)
132    }
133}
134#[cfg(feature = "debug")]
135impl core::fmt::Debug for R {
136    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
137        f.debug_struct("TCD_NBYTES_MLOFFNO")
138            .field("nbytes", &self.nbytes())
139            .field("dmloe", &self.dmloe())
140            .field("smloe", &self.smloe())
141            .finish()
142    }
143}
144impl W {
145    #[doc = "Bits 0:29 - Number of Bytes To Transfer Per Service Request"]
146    #[inline(always)]
147    pub fn nbytes(&mut self) -> NbytesW<'_, TcdNbytesMloffnoSpec> {
148        NbytesW::new(self, 0)
149    }
150    #[doc = "Bit 30 - Destination Minor Loop Offset Enable"]
151    #[inline(always)]
152    pub fn dmloe(&mut self) -> DmloeW<'_, TcdNbytesMloffnoSpec> {
153        DmloeW::new(self, 30)
154    }
155    #[doc = "Bit 31 - Source Minor Loop Offset Enable"]
156    #[inline(always)]
157    pub fn smloe(&mut self) -> SmloeW<'_, TcdNbytesMloffnoSpec> {
158        SmloeW::new(self, 31)
159    }
160}
161#[doc = "TCD Transfer Size Without Minor Loop Offsets\n\nYou can [`read`](crate::Reg::read) this register and get [`tcd_nbytes_mloffno::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`tcd_nbytes_mloffno::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
162pub struct TcdNbytesMloffnoSpec;
163impl crate::RegisterSpec for TcdNbytesMloffnoSpec {
164    type Ux = u32;
165}
166#[doc = "`read()` method returns [`tcd_nbytes_mloffno::R`](R) reader structure"]
167impl crate::Readable for TcdNbytesMloffnoSpec {}
168#[doc = "`write(|w| ..)` method takes [`tcd_nbytes_mloffno::W`](W) writer structure"]
169impl crate::Writable for TcdNbytesMloffnoSpec {
170    type Safety = crate::Unsafe;
171}
172#[doc = "`reset()` method sets TCD_NBYTES_MLOFFNO to value 0"]
173impl crate::Resettable for TcdNbytesMloffnoSpec {}