efm32gg12b830_pac/usb/
gahbcfg.rs1#[doc = "Register `GAHBCFG` reader"]
2pub struct R(crate::R<GAHBCFG_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<GAHBCFG_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<GAHBCFG_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<GAHBCFG_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `GAHBCFG` writer"]
17pub struct W(crate::W<GAHBCFG_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<GAHBCFG_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<GAHBCFG_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<GAHBCFG_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `GLBLINTRMSK` reader - Global Interrupt Mask"]
38pub type GLBLINTRMSK_R = crate::BitReader<bool>;
39#[doc = "Field `GLBLINTRMSK` writer - Global Interrupt Mask"]
40pub type GLBLINTRMSK_W<'a> = crate::BitWriter<'a, u32, GAHBCFG_SPEC, bool, 0>;
41#[doc = "Burst Length/Type\n\nValue on reset: 0"]
42#[derive(Clone, Copy, Debug, PartialEq)]
43#[repr(u8)]
44pub enum HBSTLEN_A {
45 #[doc = "0: Single transfer."]
46 SINGLE = 0,
47 #[doc = "1: Incrementing burst of unspecified length."]
48 INCR = 1,
49 #[doc = "3: 4-beat incrementing burst."]
50 INCR4 = 3,
51 #[doc = "5: 8-beat incrementing burst."]
52 INCR8 = 5,
53 #[doc = "7: 16-beat incrementing burst."]
54 INCR16 = 7,
55}
56impl From<HBSTLEN_A> for u8 {
57 #[inline(always)]
58 fn from(variant: HBSTLEN_A) -> Self {
59 variant as _
60 }
61}
62#[doc = "Field `HBSTLEN` reader - Burst Length/Type"]
63pub type HBSTLEN_R = crate::FieldReader<u8, HBSTLEN_A>;
64impl HBSTLEN_R {
65 #[doc = "Get enumerated values variant"]
66 #[inline(always)]
67 pub fn variant(&self) -> Option<HBSTLEN_A> {
68 match self.bits {
69 0 => Some(HBSTLEN_A::SINGLE),
70 1 => Some(HBSTLEN_A::INCR),
71 3 => Some(HBSTLEN_A::INCR4),
72 5 => Some(HBSTLEN_A::INCR8),
73 7 => Some(HBSTLEN_A::INCR16),
74 _ => None,
75 }
76 }
77 #[doc = "Checks if the value of the field is `SINGLE`"]
78 #[inline(always)]
79 pub fn is_single(&self) -> bool {
80 *self == HBSTLEN_A::SINGLE
81 }
82 #[doc = "Checks if the value of the field is `INCR`"]
83 #[inline(always)]
84 pub fn is_incr(&self) -> bool {
85 *self == HBSTLEN_A::INCR
86 }
87 #[doc = "Checks if the value of the field is `INCR4`"]
88 #[inline(always)]
89 pub fn is_incr4(&self) -> bool {
90 *self == HBSTLEN_A::INCR4
91 }
92 #[doc = "Checks if the value of the field is `INCR8`"]
93 #[inline(always)]
94 pub fn is_incr8(&self) -> bool {
95 *self == HBSTLEN_A::INCR8
96 }
97 #[doc = "Checks if the value of the field is `INCR16`"]
98 #[inline(always)]
99 pub fn is_incr16(&self) -> bool {
100 *self == HBSTLEN_A::INCR16
101 }
102}
103#[doc = "Field `HBSTLEN` writer - Burst Length/Type"]
104pub type HBSTLEN_W<'a> = crate::FieldWriter<'a, u32, GAHBCFG_SPEC, u8, HBSTLEN_A, 4, 1>;
105impl<'a> HBSTLEN_W<'a> {
106 #[doc = "Single transfer."]
107 #[inline(always)]
108 pub fn single(self) -> &'a mut W {
109 self.variant(HBSTLEN_A::SINGLE)
110 }
111 #[doc = "Incrementing burst of unspecified length."]
112 #[inline(always)]
113 pub fn incr(self) -> &'a mut W {
114 self.variant(HBSTLEN_A::INCR)
115 }
116 #[doc = "4-beat incrementing burst."]
117 #[inline(always)]
118 pub fn incr4(self) -> &'a mut W {
119 self.variant(HBSTLEN_A::INCR4)
120 }
121 #[doc = "8-beat incrementing burst."]
122 #[inline(always)]
123 pub fn incr8(self) -> &'a mut W {
124 self.variant(HBSTLEN_A::INCR8)
125 }
126 #[doc = "16-beat incrementing burst."]
127 #[inline(always)]
128 pub fn incr16(self) -> &'a mut W {
129 self.variant(HBSTLEN_A::INCR16)
130 }
131}
132#[doc = "Field `DMAEN` reader - DMA Enable"]
133pub type DMAEN_R = crate::BitReader<bool>;
134#[doc = "Field `DMAEN` writer - DMA Enable"]
135pub type DMAEN_W<'a> = crate::BitWriter<'a, u32, GAHBCFG_SPEC, bool, 5>;
136#[doc = "Field `NPTXFEMPLVL` reader - Non-Periodic TxFIFO Empty Level"]
137pub type NPTXFEMPLVL_R = crate::BitReader<bool>;
138#[doc = "Field `NPTXFEMPLVL` writer - Non-Periodic TxFIFO Empty Level"]
139pub type NPTXFEMPLVL_W<'a> = crate::BitWriter<'a, u32, GAHBCFG_SPEC, bool, 7>;
140#[doc = "Field `PTXFEMPLVL` reader - Periodic TxFIFO Empty Level"]
141pub type PTXFEMPLVL_R = crate::BitReader<bool>;
142#[doc = "Field `PTXFEMPLVL` writer - Periodic TxFIFO Empty Level"]
143pub type PTXFEMPLVL_W<'a> = crate::BitWriter<'a, u32, GAHBCFG_SPEC, bool, 8>;
144#[doc = "Field `REMMEMSUPP` reader - Remote Memory Support"]
145pub type REMMEMSUPP_R = crate::BitReader<bool>;
146#[doc = "Field `REMMEMSUPP` writer - Remote Memory Support"]
147pub type REMMEMSUPP_W<'a> = crate::BitWriter<'a, u32, GAHBCFG_SPEC, bool, 21>;
148#[doc = "Field `NOTIALLDMAWRIT` reader - Notify All Dma Write Transactions"]
149pub type NOTIALLDMAWRIT_R = crate::BitReader<bool>;
150#[doc = "Field `NOTIALLDMAWRIT` writer - Notify All Dma Write Transactions"]
151pub type NOTIALLDMAWRIT_W<'a> = crate::BitWriter<'a, u32, GAHBCFG_SPEC, bool, 22>;
152#[doc = "Field `AHBSINGLE` reader - AHB Single Support"]
153pub type AHBSINGLE_R = crate::BitReader<bool>;
154#[doc = "Field `AHBSINGLE` writer - AHB Single Support"]
155pub type AHBSINGLE_W<'a> = crate::BitWriter<'a, u32, GAHBCFG_SPEC, bool, 23>;
156impl R {
157 #[doc = "Bit 0 - Global Interrupt Mask"]
158 #[inline(always)]
159 pub fn glblintrmsk(&self) -> GLBLINTRMSK_R {
160 GLBLINTRMSK_R::new((self.bits & 1) != 0)
161 }
162 #[doc = "Bits 1:4 - Burst Length/Type"]
163 #[inline(always)]
164 pub fn hbstlen(&self) -> HBSTLEN_R {
165 HBSTLEN_R::new(((self.bits >> 1) & 0x0f) as u8)
166 }
167 #[doc = "Bit 5 - DMA Enable"]
168 #[inline(always)]
169 pub fn dmaen(&self) -> DMAEN_R {
170 DMAEN_R::new(((self.bits >> 5) & 1) != 0)
171 }
172 #[doc = "Bit 7 - Non-Periodic TxFIFO Empty Level"]
173 #[inline(always)]
174 pub fn nptxfemplvl(&self) -> NPTXFEMPLVL_R {
175 NPTXFEMPLVL_R::new(((self.bits >> 7) & 1) != 0)
176 }
177 #[doc = "Bit 8 - Periodic TxFIFO Empty Level"]
178 #[inline(always)]
179 pub fn ptxfemplvl(&self) -> PTXFEMPLVL_R {
180 PTXFEMPLVL_R::new(((self.bits >> 8) & 1) != 0)
181 }
182 #[doc = "Bit 21 - Remote Memory Support"]
183 #[inline(always)]
184 pub fn remmemsupp(&self) -> REMMEMSUPP_R {
185 REMMEMSUPP_R::new(((self.bits >> 21) & 1) != 0)
186 }
187 #[doc = "Bit 22 - Notify All Dma Write Transactions"]
188 #[inline(always)]
189 pub fn notialldmawrit(&self) -> NOTIALLDMAWRIT_R {
190 NOTIALLDMAWRIT_R::new(((self.bits >> 22) & 1) != 0)
191 }
192 #[doc = "Bit 23 - AHB Single Support"]
193 #[inline(always)]
194 pub fn ahbsingle(&self) -> AHBSINGLE_R {
195 AHBSINGLE_R::new(((self.bits >> 23) & 1) != 0)
196 }
197}
198impl W {
199 #[doc = "Bit 0 - Global Interrupt Mask"]
200 #[inline(always)]
201 pub fn glblintrmsk(&mut self) -> GLBLINTRMSK_W {
202 GLBLINTRMSK_W::new(self)
203 }
204 #[doc = "Bits 1:4 - Burst Length/Type"]
205 #[inline(always)]
206 pub fn hbstlen(&mut self) -> HBSTLEN_W {
207 HBSTLEN_W::new(self)
208 }
209 #[doc = "Bit 5 - DMA Enable"]
210 #[inline(always)]
211 pub fn dmaen(&mut self) -> DMAEN_W {
212 DMAEN_W::new(self)
213 }
214 #[doc = "Bit 7 - Non-Periodic TxFIFO Empty Level"]
215 #[inline(always)]
216 pub fn nptxfemplvl(&mut self) -> NPTXFEMPLVL_W {
217 NPTXFEMPLVL_W::new(self)
218 }
219 #[doc = "Bit 8 - Periodic TxFIFO Empty Level"]
220 #[inline(always)]
221 pub fn ptxfemplvl(&mut self) -> PTXFEMPLVL_W {
222 PTXFEMPLVL_W::new(self)
223 }
224 #[doc = "Bit 21 - Remote Memory Support"]
225 #[inline(always)]
226 pub fn remmemsupp(&mut self) -> REMMEMSUPP_W {
227 REMMEMSUPP_W::new(self)
228 }
229 #[doc = "Bit 22 - Notify All Dma Write Transactions"]
230 #[inline(always)]
231 pub fn notialldmawrit(&mut self) -> NOTIALLDMAWRIT_W {
232 NOTIALLDMAWRIT_W::new(self)
233 }
234 #[doc = "Bit 23 - AHB Single Support"]
235 #[inline(always)]
236 pub fn ahbsingle(&mut self) -> AHBSINGLE_W {
237 AHBSINGLE_W::new(self)
238 }
239 #[doc = "Writes raw bits to the register."]
240 #[inline(always)]
241 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
242 self.0.bits(bits);
243 self
244 }
245}
246#[doc = "AHB Configuration Register\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 [gahbcfg](index.html) module"]
247pub struct GAHBCFG_SPEC;
248impl crate::RegisterSpec for GAHBCFG_SPEC {
249 type Ux = u32;
250}
251#[doc = "`read()` method returns [gahbcfg::R](R) reader structure"]
252impl crate::Readable for GAHBCFG_SPEC {
253 type Reader = R;
254}
255#[doc = "`write(|w| ..)` method takes [gahbcfg::W](W) writer structure"]
256impl crate::Writable for GAHBCFG_SPEC {
257 type Writer = W;
258}
259#[doc = "`reset()` method sets GAHBCFG to value 0"]
260impl crate::Resettable for GAHBCFG_SPEC {
261 #[inline(always)]
262 fn reset_value() -> Self::Ux {
263 0
264 }
265}