efm32pg12_pac/ldma/
ch3_cfg.rs1#[doc = "Reader of register CH3_CFG"]
2pub type R = crate::R<u32, super::CH3_CFG>;
3#[doc = "Writer for register CH3_CFG"]
4pub type W = crate::W<u32, super::CH3_CFG>;
5#[doc = "Register CH3_CFG `reset()`'s with value 0"]
6impl crate::ResetValue for super::CH3_CFG {
7 type Type = u32;
8 #[inline(always)]
9 fn reset_value() -> Self::Type {
10 0
11 }
12}
13#[doc = "Arbitration Slot Number Select\n\nValue on reset: 0"]
14#[derive(Clone, Copy, Debug, PartialEq)]
15#[repr(u8)]
16pub enum ARBSLOTS_A {
17 #[doc = "0: One arbitration slot selected"]
18 ONE = 0,
19 #[doc = "1: Two arbitration slots selected"]
20 TWO = 1,
21 #[doc = "2: Four arbitration slots selected"]
22 FOUR = 2,
23 #[doc = "3: Eight arbitration slots selected"]
24 EIGHT = 3,
25}
26impl From<ARBSLOTS_A> for u8 {
27 #[inline(always)]
28 fn from(variant: ARBSLOTS_A) -> Self {
29 variant as _
30 }
31}
32#[doc = "Reader of field `ARBSLOTS`"]
33pub type ARBSLOTS_R = crate::R<u8, ARBSLOTS_A>;
34impl ARBSLOTS_R {
35 #[doc = r"Get enumerated values variant"]
36 #[inline(always)]
37 pub fn variant(&self) -> ARBSLOTS_A {
38 match self.bits {
39 0 => ARBSLOTS_A::ONE,
40 1 => ARBSLOTS_A::TWO,
41 2 => ARBSLOTS_A::FOUR,
42 3 => ARBSLOTS_A::EIGHT,
43 _ => unreachable!(),
44 }
45 }
46 #[doc = "Checks if the value of the field is `ONE`"]
47 #[inline(always)]
48 pub fn is_one(&self) -> bool {
49 *self == ARBSLOTS_A::ONE
50 }
51 #[doc = "Checks if the value of the field is `TWO`"]
52 #[inline(always)]
53 pub fn is_two(&self) -> bool {
54 *self == ARBSLOTS_A::TWO
55 }
56 #[doc = "Checks if the value of the field is `FOUR`"]
57 #[inline(always)]
58 pub fn is_four(&self) -> bool {
59 *self == ARBSLOTS_A::FOUR
60 }
61 #[doc = "Checks if the value of the field is `EIGHT`"]
62 #[inline(always)]
63 pub fn is_eight(&self) -> bool {
64 *self == ARBSLOTS_A::EIGHT
65 }
66}
67#[doc = "Write proxy for field `ARBSLOTS`"]
68pub struct ARBSLOTS_W<'a> {
69 w: &'a mut W,
70}
71impl<'a> ARBSLOTS_W<'a> {
72 #[doc = r"Writes `variant` to the field"]
73 #[inline(always)]
74 pub fn variant(self, variant: ARBSLOTS_A) -> &'a mut W {
75 {
76 self.bits(variant.into())
77 }
78 }
79 #[doc = "One arbitration slot selected"]
80 #[inline(always)]
81 pub fn one(self) -> &'a mut W {
82 self.variant(ARBSLOTS_A::ONE)
83 }
84 #[doc = "Two arbitration slots selected"]
85 #[inline(always)]
86 pub fn two(self) -> &'a mut W {
87 self.variant(ARBSLOTS_A::TWO)
88 }
89 #[doc = "Four arbitration slots selected"]
90 #[inline(always)]
91 pub fn four(self) -> &'a mut W {
92 self.variant(ARBSLOTS_A::FOUR)
93 }
94 #[doc = "Eight arbitration slots selected"]
95 #[inline(always)]
96 pub fn eight(self) -> &'a mut W {
97 self.variant(ARBSLOTS_A::EIGHT)
98 }
99 #[doc = r"Writes raw bits to the field"]
100 #[inline(always)]
101 pub fn bits(self, value: u8) -> &'a mut W {
102 self.w.bits = (self.w.bits & !(0x03 << 16)) | (((value as u32) & 0x03) << 16);
103 self.w
104 }
105}
106#[doc = "Reader of field `SRCINCSIGN`"]
107pub type SRCINCSIGN_R = crate::R<bool, bool>;
108#[doc = "Write proxy for field `SRCINCSIGN`"]
109pub struct SRCINCSIGN_W<'a> {
110 w: &'a mut W,
111}
112impl<'a> SRCINCSIGN_W<'a> {
113 #[doc = r"Sets the field bit"]
114 #[inline(always)]
115 pub fn set_bit(self) -> &'a mut W {
116 self.bit(true)
117 }
118 #[doc = r"Clears the field bit"]
119 #[inline(always)]
120 pub fn clear_bit(self) -> &'a mut W {
121 self.bit(false)
122 }
123 #[doc = r"Writes raw bits to the field"]
124 #[inline(always)]
125 pub fn bit(self, value: bool) -> &'a mut W {
126 self.w.bits = (self.w.bits & !(0x01 << 20)) | (((value as u32) & 0x01) << 20);
127 self.w
128 }
129}
130#[doc = "Reader of field `DSTINCSIGN`"]
131pub type DSTINCSIGN_R = crate::R<bool, bool>;
132#[doc = "Write proxy for field `DSTINCSIGN`"]
133pub struct DSTINCSIGN_W<'a> {
134 w: &'a mut W,
135}
136impl<'a> DSTINCSIGN_W<'a> {
137 #[doc = r"Sets the field bit"]
138 #[inline(always)]
139 pub fn set_bit(self) -> &'a mut W {
140 self.bit(true)
141 }
142 #[doc = r"Clears the field bit"]
143 #[inline(always)]
144 pub fn clear_bit(self) -> &'a mut W {
145 self.bit(false)
146 }
147 #[doc = r"Writes raw bits to the field"]
148 #[inline(always)]
149 pub fn bit(self, value: bool) -> &'a mut W {
150 self.w.bits = (self.w.bits & !(0x01 << 21)) | (((value as u32) & 0x01) << 21);
151 self.w
152 }
153}
154impl R {
155 #[doc = "Bits 16:17 - Arbitration Slot Number Select"]
156 #[inline(always)]
157 pub fn arbslots(&self) -> ARBSLOTS_R {
158 ARBSLOTS_R::new(((self.bits >> 16) & 0x03) as u8)
159 }
160 #[doc = "Bit 20 - Source Address Increment Sign"]
161 #[inline(always)]
162 pub fn srcincsign(&self) -> SRCINCSIGN_R {
163 SRCINCSIGN_R::new(((self.bits >> 20) & 0x01) != 0)
164 }
165 #[doc = "Bit 21 - Destination Address Increment Sign"]
166 #[inline(always)]
167 pub fn dstincsign(&self) -> DSTINCSIGN_R {
168 DSTINCSIGN_R::new(((self.bits >> 21) & 0x01) != 0)
169 }
170}
171impl W {
172 #[doc = "Bits 16:17 - Arbitration Slot Number Select"]
173 #[inline(always)]
174 pub fn arbslots(&mut self) -> ARBSLOTS_W {
175 ARBSLOTS_W { w: self }
176 }
177 #[doc = "Bit 20 - Source Address Increment Sign"]
178 #[inline(always)]
179 pub fn srcincsign(&mut self) -> SRCINCSIGN_W {
180 SRCINCSIGN_W { w: self }
181 }
182 #[doc = "Bit 21 - Destination Address Increment Sign"]
183 #[inline(always)]
184 pub fn dstincsign(&mut self) -> DSTINCSIGN_W {
185 DSTINCSIGN_W { w: self }
186 }
187}