efm32pg22_pac/efm32pg22c200/ldma_s/
ch0_cfg.rs1#[doc = "Register `CH0_CFG` reader"]
2pub struct R(crate::R<CH0_CFG_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<CH0_CFG_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<CH0_CFG_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<CH0_CFG_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `CH0_CFG` writer"]
17pub struct W(crate::W<CH0_CFG_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<CH0_CFG_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<CH0_CFG_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<CH0_CFG_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `ARBSLOTS` reader - Arbitration Slot Number Select"]
38pub type ARBSLOTS_R = crate::FieldReader<u8, ARBSLOTS_A>;
39#[doc = "Arbitration Slot Number Select\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum ARBSLOTS_A {
43 #[doc = "0: One arbitration slot selected"]
44 ONE = 0,
45 #[doc = "1: Two arbitration slots selected"]
46 TWO = 1,
47 #[doc = "2: Four arbitration slots selected"]
48 FOUR = 2,
49 #[doc = "3: Eight arbitration slots selected"]
50 EIGHT = 3,
51}
52impl From<ARBSLOTS_A> for u8 {
53 #[inline(always)]
54 fn from(variant: ARBSLOTS_A) -> Self {
55 variant as _
56 }
57}
58impl ARBSLOTS_R {
59 #[doc = "Get enumerated values variant"]
60 #[inline(always)]
61 pub fn variant(&self) -> ARBSLOTS_A {
62 match self.bits {
63 0 => ARBSLOTS_A::ONE,
64 1 => ARBSLOTS_A::TWO,
65 2 => ARBSLOTS_A::FOUR,
66 3 => ARBSLOTS_A::EIGHT,
67 _ => unreachable!(),
68 }
69 }
70 #[doc = "Checks if the value of the field is `ONE`"]
71 #[inline(always)]
72 pub fn is_one(&self) -> bool {
73 *self == ARBSLOTS_A::ONE
74 }
75 #[doc = "Checks if the value of the field is `TWO`"]
76 #[inline(always)]
77 pub fn is_two(&self) -> bool {
78 *self == ARBSLOTS_A::TWO
79 }
80 #[doc = "Checks if the value of the field is `FOUR`"]
81 #[inline(always)]
82 pub fn is_four(&self) -> bool {
83 *self == ARBSLOTS_A::FOUR
84 }
85 #[doc = "Checks if the value of the field is `EIGHT`"]
86 #[inline(always)]
87 pub fn is_eight(&self) -> bool {
88 *self == ARBSLOTS_A::EIGHT
89 }
90}
91#[doc = "Field `ARBSLOTS` writer - Arbitration Slot Number Select"]
92pub type ARBSLOTS_W<'a, const O: u8> =
93 crate::FieldWriterSafe<'a, u32, CH0_CFG_SPEC, u8, ARBSLOTS_A, 2, O>;
94impl<'a, const O: u8> ARBSLOTS_W<'a, O> {
95 #[doc = "One arbitration slot selected"]
96 #[inline(always)]
97 pub fn one(self) -> &'a mut W {
98 self.variant(ARBSLOTS_A::ONE)
99 }
100 #[doc = "Two arbitration slots selected"]
101 #[inline(always)]
102 pub fn two(self) -> &'a mut W {
103 self.variant(ARBSLOTS_A::TWO)
104 }
105 #[doc = "Four arbitration slots selected"]
106 #[inline(always)]
107 pub fn four(self) -> &'a mut W {
108 self.variant(ARBSLOTS_A::FOUR)
109 }
110 #[doc = "Eight arbitration slots selected"]
111 #[inline(always)]
112 pub fn eight(self) -> &'a mut W {
113 self.variant(ARBSLOTS_A::EIGHT)
114 }
115}
116#[doc = "Field `SRCINCSIGN` reader - Source Address Increment Sign"]
117pub type SRCINCSIGN_R = crate::BitReader<SRCINCSIGN_A>;
118#[doc = "Source Address Increment Sign\n\nValue on reset: 0"]
119#[derive(Clone, Copy, Debug, PartialEq, Eq)]
120pub enum SRCINCSIGN_A {
121 #[doc = "0: Increment source address"]
122 POSITIVE = 0,
123 #[doc = "1: Decrement source address"]
124 NEGATIVE = 1,
125}
126impl From<SRCINCSIGN_A> for bool {
127 #[inline(always)]
128 fn from(variant: SRCINCSIGN_A) -> Self {
129 variant as u8 != 0
130 }
131}
132impl SRCINCSIGN_R {
133 #[doc = "Get enumerated values variant"]
134 #[inline(always)]
135 pub fn variant(&self) -> SRCINCSIGN_A {
136 match self.bits {
137 false => SRCINCSIGN_A::POSITIVE,
138 true => SRCINCSIGN_A::NEGATIVE,
139 }
140 }
141 #[doc = "Checks if the value of the field is `POSITIVE`"]
142 #[inline(always)]
143 pub fn is_positive(&self) -> bool {
144 *self == SRCINCSIGN_A::POSITIVE
145 }
146 #[doc = "Checks if the value of the field is `NEGATIVE`"]
147 #[inline(always)]
148 pub fn is_negative(&self) -> bool {
149 *self == SRCINCSIGN_A::NEGATIVE
150 }
151}
152#[doc = "Field `SRCINCSIGN` writer - Source Address Increment Sign"]
153pub type SRCINCSIGN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CH0_CFG_SPEC, SRCINCSIGN_A, O>;
154impl<'a, const O: u8> SRCINCSIGN_W<'a, O> {
155 #[doc = "Increment source address"]
156 #[inline(always)]
157 pub fn positive(self) -> &'a mut W {
158 self.variant(SRCINCSIGN_A::POSITIVE)
159 }
160 #[doc = "Decrement source address"]
161 #[inline(always)]
162 pub fn negative(self) -> &'a mut W {
163 self.variant(SRCINCSIGN_A::NEGATIVE)
164 }
165}
166#[doc = "Field `DSTINCSIGN` reader - Destination Address Increment Sign"]
167pub type DSTINCSIGN_R = crate::BitReader<DSTINCSIGN_A>;
168#[doc = "Destination Address Increment Sign\n\nValue on reset: 0"]
169#[derive(Clone, Copy, Debug, PartialEq, Eq)]
170pub enum DSTINCSIGN_A {
171 #[doc = "0: Increment destination address"]
172 POSITIVE = 0,
173 #[doc = "1: Decrement destination address"]
174 NEGATIVE = 1,
175}
176impl From<DSTINCSIGN_A> for bool {
177 #[inline(always)]
178 fn from(variant: DSTINCSIGN_A) -> Self {
179 variant as u8 != 0
180 }
181}
182impl DSTINCSIGN_R {
183 #[doc = "Get enumerated values variant"]
184 #[inline(always)]
185 pub fn variant(&self) -> DSTINCSIGN_A {
186 match self.bits {
187 false => DSTINCSIGN_A::POSITIVE,
188 true => DSTINCSIGN_A::NEGATIVE,
189 }
190 }
191 #[doc = "Checks if the value of the field is `POSITIVE`"]
192 #[inline(always)]
193 pub fn is_positive(&self) -> bool {
194 *self == DSTINCSIGN_A::POSITIVE
195 }
196 #[doc = "Checks if the value of the field is `NEGATIVE`"]
197 #[inline(always)]
198 pub fn is_negative(&self) -> bool {
199 *self == DSTINCSIGN_A::NEGATIVE
200 }
201}
202#[doc = "Field `DSTINCSIGN` writer - Destination Address Increment Sign"]
203pub type DSTINCSIGN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CH0_CFG_SPEC, DSTINCSIGN_A, O>;
204impl<'a, const O: u8> DSTINCSIGN_W<'a, O> {
205 #[doc = "Increment destination address"]
206 #[inline(always)]
207 pub fn positive(self) -> &'a mut W {
208 self.variant(DSTINCSIGN_A::POSITIVE)
209 }
210 #[doc = "Decrement destination address"]
211 #[inline(always)]
212 pub fn negative(self) -> &'a mut W {
213 self.variant(DSTINCSIGN_A::NEGATIVE)
214 }
215}
216impl R {
217 #[doc = "Bits 16:17 - Arbitration Slot Number Select"]
218 #[inline(always)]
219 pub fn arbslots(&self) -> ARBSLOTS_R {
220 ARBSLOTS_R::new(((self.bits >> 16) & 3) as u8)
221 }
222 #[doc = "Bit 20 - Source Address Increment Sign"]
223 #[inline(always)]
224 pub fn srcincsign(&self) -> SRCINCSIGN_R {
225 SRCINCSIGN_R::new(((self.bits >> 20) & 1) != 0)
226 }
227 #[doc = "Bit 21 - Destination Address Increment Sign"]
228 #[inline(always)]
229 pub fn dstincsign(&self) -> DSTINCSIGN_R {
230 DSTINCSIGN_R::new(((self.bits >> 21) & 1) != 0)
231 }
232}
233impl W {
234 #[doc = "Bits 16:17 - Arbitration Slot Number Select"]
235 #[inline(always)]
236 #[must_use]
237 pub fn arbslots(&mut self) -> ARBSLOTS_W<16> {
238 ARBSLOTS_W::new(self)
239 }
240 #[doc = "Bit 20 - Source Address Increment Sign"]
241 #[inline(always)]
242 #[must_use]
243 pub fn srcincsign(&mut self) -> SRCINCSIGN_W<20> {
244 SRCINCSIGN_W::new(self)
245 }
246 #[doc = "Bit 21 - Destination Address Increment Sign"]
247 #[inline(always)]
248 #[must_use]
249 pub fn dstincsign(&mut self) -> DSTINCSIGN_W<21> {
250 DSTINCSIGN_W::new(self)
251 }
252 #[doc = "Writes raw bits to the register."]
253 #[inline(always)]
254 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
255 self.0.bits(bits);
256 self
257 }
258}
259#[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 [ch0_cfg](index.html) module"]
260pub struct CH0_CFG_SPEC;
261impl crate::RegisterSpec for CH0_CFG_SPEC {
262 type Ux = u32;
263}
264#[doc = "`read()` method returns [ch0_cfg::R](R) reader structure"]
265impl crate::Readable for CH0_CFG_SPEC {
266 type Reader = R;
267}
268#[doc = "`write(|w| ..)` method takes [ch0_cfg::W](W) writer structure"]
269impl crate::Writable for CH0_CFG_SPEC {
270 type Writer = W;
271 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
272 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
273}
274#[doc = "`reset()` method sets CH0_CFG to value 0"]
275impl crate::Resettable for CH0_CFG_SPEC {
276 const RESET_VALUE: Self::Ux = 0;
277}