mcxa_pac/edma_0_tcd0/tcd/
tcd_nbytes_mloffyes.rs

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