s32k142_pac/dma/
dma_tcd7_nbytes_mloffyes.rs

1#[doc = "Register `TCD7_NBYTES_MLOFFYES` reader"]
2pub struct R(crate::R<DMA_TCD7_NBYTES_MLOFFYES_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<DMA_TCD7_NBYTES_MLOFFYES_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<DMA_TCD7_NBYTES_MLOFFYES_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<DMA_TCD7_NBYTES_MLOFFYES_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `TCD7_NBYTES_MLOFFYES` writer"]
17pub struct W(crate::W<DMA_TCD7_NBYTES_MLOFFYES_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<DMA_TCD7_NBYTES_MLOFFYES_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<DMA_TCD7_NBYTES_MLOFFYES_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<DMA_TCD7_NBYTES_MLOFFYES_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `NBYTES` reader - Minor Byte Transfer Count"]
38pub struct NBYTES_R(crate::FieldReader<u16, u16>);
39impl NBYTES_R {
40    #[inline(always)]
41    pub(crate) fn new(bits: u16) -> Self {
42        NBYTES_R(crate::FieldReader::new(bits))
43    }
44}
45impl core::ops::Deref for NBYTES_R {
46    type Target = crate::FieldReader<u16, u16>;
47    #[inline(always)]
48    fn deref(&self) -> &Self::Target {
49        &self.0
50    }
51}
52#[doc = "Field `NBYTES` writer - Minor Byte Transfer Count"]
53pub struct NBYTES_W<'a> {
54    w: &'a mut W,
55}
56impl<'a> NBYTES_W<'a> {
57    #[doc = r"Writes raw bits to the field"]
58    #[inline(always)]
59    pub unsafe fn bits(self, value: u16) -> &'a mut W {
60        self.w.bits = (self.w.bits & !0x03ff) | (value as u32 & 0x03ff);
61        self.w
62    }
63}
64#[doc = "Field `MLOFF` reader - If SMLOE or DMLOE is set, this field represents a sign-extended offset applied to the source or destination address to form the next-state value after the minor loop completes."]
65pub struct MLOFF_R(crate::FieldReader<u32, u32>);
66impl MLOFF_R {
67    #[inline(always)]
68    pub(crate) fn new(bits: u32) -> Self {
69        MLOFF_R(crate::FieldReader::new(bits))
70    }
71}
72impl core::ops::Deref for MLOFF_R {
73    type Target = crate::FieldReader<u32, u32>;
74    #[inline(always)]
75    fn deref(&self) -> &Self::Target {
76        &self.0
77    }
78}
79#[doc = "Field `MLOFF` writer - If SMLOE or DMLOE is set, this field represents a sign-extended offset applied to the source or destination address to form the next-state value after the minor loop completes."]
80pub struct MLOFF_W<'a> {
81    w: &'a mut W,
82}
83impl<'a> MLOFF_W<'a> {
84    #[doc = r"Writes raw bits to the field"]
85    #[inline(always)]
86    pub unsafe fn bits(self, value: u32) -> &'a mut W {
87        self.w.bits = (self.w.bits & !(0x000f_ffff << 10)) | ((value as u32 & 0x000f_ffff) << 10);
88        self.w
89    }
90}
91#[doc = "Destination Minor Loop Offset enable\n\nValue on reset: 0"]
92#[derive(Clone, Copy, Debug, PartialEq)]
93pub enum DMLOE_A {
94    #[doc = "0: The minor loop offset is not applied to the DADDR"]
95    _0 = 0,
96    #[doc = "1: The minor loop offset is applied to the DADDR"]
97    _1 = 1,
98}
99impl From<DMLOE_A> for bool {
100    #[inline(always)]
101    fn from(variant: DMLOE_A) -> Self {
102        variant as u8 != 0
103    }
104}
105#[doc = "Field `DMLOE` reader - Destination Minor Loop Offset enable"]
106pub struct DMLOE_R(crate::FieldReader<bool, DMLOE_A>);
107impl DMLOE_R {
108    #[inline(always)]
109    pub(crate) fn new(bits: bool) -> Self {
110        DMLOE_R(crate::FieldReader::new(bits))
111    }
112    #[doc = r"Get enumerated values variant"]
113    #[inline(always)]
114    pub fn variant(&self) -> DMLOE_A {
115        match self.bits {
116            false => DMLOE_A::_0,
117            true => DMLOE_A::_1,
118        }
119    }
120    #[doc = "Checks if the value of the field is `_0`"]
121    #[inline(always)]
122    pub fn is_0(&self) -> bool {
123        **self == DMLOE_A::_0
124    }
125    #[doc = "Checks if the value of the field is `_1`"]
126    #[inline(always)]
127    pub fn is_1(&self) -> bool {
128        **self == DMLOE_A::_1
129    }
130}
131impl core::ops::Deref for DMLOE_R {
132    type Target = crate::FieldReader<bool, DMLOE_A>;
133    #[inline(always)]
134    fn deref(&self) -> &Self::Target {
135        &self.0
136    }
137}
138#[doc = "Field `DMLOE` writer - Destination Minor Loop Offset enable"]
139pub struct DMLOE_W<'a> {
140    w: &'a mut W,
141}
142impl<'a> DMLOE_W<'a> {
143    #[doc = r"Writes `variant` to the field"]
144    #[inline(always)]
145    pub fn variant(self, variant: DMLOE_A) -> &'a mut W {
146        self.bit(variant.into())
147    }
148    #[doc = "The minor loop offset is not applied to the DADDR"]
149    #[inline(always)]
150    pub fn _0(self) -> &'a mut W {
151        self.variant(DMLOE_A::_0)
152    }
153    #[doc = "The minor loop offset is applied to the DADDR"]
154    #[inline(always)]
155    pub fn _1(self) -> &'a mut W {
156        self.variant(DMLOE_A::_1)
157    }
158    #[doc = r"Sets the field bit"]
159    #[inline(always)]
160    pub fn set_bit(self) -> &'a mut W {
161        self.bit(true)
162    }
163    #[doc = r"Clears the field bit"]
164    #[inline(always)]
165    pub fn clear_bit(self) -> &'a mut W {
166        self.bit(false)
167    }
168    #[doc = r"Writes raw bits to the field"]
169    #[inline(always)]
170    pub fn bit(self, value: bool) -> &'a mut W {
171        self.w.bits = (self.w.bits & !(0x01 << 30)) | ((value as u32 & 0x01) << 30);
172        self.w
173    }
174}
175#[doc = "Source Minor Loop Offset Enable\n\nValue on reset: 0"]
176#[derive(Clone, Copy, Debug, PartialEq)]
177pub enum SMLOE_A {
178    #[doc = "0: The minor loop offset is not applied to the SADDR"]
179    _0 = 0,
180    #[doc = "1: The minor loop offset is applied to the SADDR"]
181    _1 = 1,
182}
183impl From<SMLOE_A> for bool {
184    #[inline(always)]
185    fn from(variant: SMLOE_A) -> Self {
186        variant as u8 != 0
187    }
188}
189#[doc = "Field `SMLOE` reader - Source Minor Loop Offset Enable"]
190pub struct SMLOE_R(crate::FieldReader<bool, SMLOE_A>);
191impl SMLOE_R {
192    #[inline(always)]
193    pub(crate) fn new(bits: bool) -> Self {
194        SMLOE_R(crate::FieldReader::new(bits))
195    }
196    #[doc = r"Get enumerated values variant"]
197    #[inline(always)]
198    pub fn variant(&self) -> SMLOE_A {
199        match self.bits {
200            false => SMLOE_A::_0,
201            true => SMLOE_A::_1,
202        }
203    }
204    #[doc = "Checks if the value of the field is `_0`"]
205    #[inline(always)]
206    pub fn is_0(&self) -> bool {
207        **self == SMLOE_A::_0
208    }
209    #[doc = "Checks if the value of the field is `_1`"]
210    #[inline(always)]
211    pub fn is_1(&self) -> bool {
212        **self == SMLOE_A::_1
213    }
214}
215impl core::ops::Deref for SMLOE_R {
216    type Target = crate::FieldReader<bool, SMLOE_A>;
217    #[inline(always)]
218    fn deref(&self) -> &Self::Target {
219        &self.0
220    }
221}
222#[doc = "Field `SMLOE` writer - Source Minor Loop Offset Enable"]
223pub struct SMLOE_W<'a> {
224    w: &'a mut W,
225}
226impl<'a> SMLOE_W<'a> {
227    #[doc = r"Writes `variant` to the field"]
228    #[inline(always)]
229    pub fn variant(self, variant: SMLOE_A) -> &'a mut W {
230        self.bit(variant.into())
231    }
232    #[doc = "The minor loop offset is not applied to the SADDR"]
233    #[inline(always)]
234    pub fn _0(self) -> &'a mut W {
235        self.variant(SMLOE_A::_0)
236    }
237    #[doc = "The minor loop offset is applied to the SADDR"]
238    #[inline(always)]
239    pub fn _1(self) -> &'a mut W {
240        self.variant(SMLOE_A::_1)
241    }
242    #[doc = r"Sets the field bit"]
243    #[inline(always)]
244    pub fn set_bit(self) -> &'a mut W {
245        self.bit(true)
246    }
247    #[doc = r"Clears the field bit"]
248    #[inline(always)]
249    pub fn clear_bit(self) -> &'a mut W {
250        self.bit(false)
251    }
252    #[doc = r"Writes raw bits to the field"]
253    #[inline(always)]
254    pub fn bit(self, value: bool) -> &'a mut W {
255        self.w.bits = (self.w.bits & !(0x01 << 31)) | ((value as u32 & 0x01) << 31);
256        self.w
257    }
258}
259impl R {
260    #[doc = "Bits 0:9 - Minor Byte Transfer Count"]
261    #[inline(always)]
262    pub fn nbytes(&self) -> NBYTES_R {
263        NBYTES_R::new((self.bits & 0x03ff) as u16)
264    }
265    #[doc = "Bits 10:29 - If SMLOE or DMLOE is set, this field represents a sign-extended offset applied to the source or destination address to form the next-state value after the minor loop completes."]
266    #[inline(always)]
267    pub fn mloff(&self) -> MLOFF_R {
268        MLOFF_R::new(((self.bits >> 10) & 0x000f_ffff) as u32)
269    }
270    #[doc = "Bit 30 - Destination Minor Loop Offset enable"]
271    #[inline(always)]
272    pub fn dmloe(&self) -> DMLOE_R {
273        DMLOE_R::new(((self.bits >> 30) & 0x01) != 0)
274    }
275    #[doc = "Bit 31 - Source Minor Loop Offset Enable"]
276    #[inline(always)]
277    pub fn smloe(&self) -> SMLOE_R {
278        SMLOE_R::new(((self.bits >> 31) & 0x01) != 0)
279    }
280}
281impl W {
282    #[doc = "Bits 0:9 - Minor Byte Transfer Count"]
283    #[inline(always)]
284    pub fn nbytes(&mut self) -> NBYTES_W {
285        NBYTES_W { w: self }
286    }
287    #[doc = "Bits 10:29 - If SMLOE or DMLOE is set, this field represents a sign-extended offset applied to the source or destination address to form the next-state value after the minor loop completes."]
288    #[inline(always)]
289    pub fn mloff(&mut self) -> MLOFF_W {
290        MLOFF_W { w: self }
291    }
292    #[doc = "Bit 30 - Destination Minor Loop Offset enable"]
293    #[inline(always)]
294    pub fn dmloe(&mut self) -> DMLOE_W {
295        DMLOE_W { w: self }
296    }
297    #[doc = "Bit 31 - Source Minor Loop Offset Enable"]
298    #[inline(always)]
299    pub fn smloe(&mut self) -> SMLOE_W {
300        SMLOE_W { w: self }
301    }
302    #[doc = "Writes raw bits to the register."]
303    #[inline(always)]
304    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
305        self.0.bits(bits);
306        self
307    }
308}
309#[doc = "TCD Signed Minor Loop Offset (Minor Loop Mapping and Offset Enabled)\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 [dma_tcd7_nbytes_mloffyes](index.html) module"]
310pub struct DMA_TCD7_NBYTES_MLOFFYES_SPEC;
311impl crate::RegisterSpec for DMA_TCD7_NBYTES_MLOFFYES_SPEC {
312    type Ux = u32;
313}
314#[doc = "`read()` method returns [dma_tcd7_nbytes_mloffyes::R](R) reader structure"]
315impl crate::Readable for DMA_TCD7_NBYTES_MLOFFYES_SPEC {
316    type Reader = R;
317}
318#[doc = "`write(|w| ..)` method takes [dma_tcd7_nbytes_mloffyes::W](W) writer structure"]
319impl crate::Writable for DMA_TCD7_NBYTES_MLOFFYES_SPEC {
320    type Writer = W;
321}
322#[doc = "`reset()` method sets TCD7_NBYTES_MLOFFYES to value 0"]
323impl crate::Resettable for DMA_TCD7_NBYTES_MLOFFYES_SPEC {
324    #[inline(always)]
325    fn reset_value() -> Self::Ux {
326        0
327    }
328}