efm32gg900_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 host and device"]
38pub type GLBLINTRMSK_R = crate::BitReader<bool>;
39#[doc = "Field `GLBLINTRMSK` writer - Global Interrupt Mask host and device"]
40pub type GLBLINTRMSK_W<'a> = crate::BitWriter<'a, u32, GAHBCFG_SPEC, bool, 0>;
41#[doc = "Burst Length/Type host and device\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 host and device"]
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 host and device"]
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 host and device"]
133pub type DMAEN_R = crate::BitReader<bool>;
134#[doc = "Field `DMAEN` writer - DMA Enable host and device"]
135pub type DMAEN_W<'a> = crate::BitWriter<'a, u32, GAHBCFG_SPEC, bool, 5>;
136#[doc = "Field `NPTXFEMPLVL` reader - Non-Periodic TxFIFO Empty Level host and device"]
137pub type NPTXFEMPLVL_R = crate::BitReader<bool>;
138#[doc = "Field `NPTXFEMPLVL` writer - Non-Periodic TxFIFO Empty Level host and device"]
139pub type NPTXFEMPLVL_W<'a> = crate::BitWriter<'a, u32, GAHBCFG_SPEC, bool, 7>;
140#[doc = "Field `PTXFEMPLVL` reader - Periodic TxFIFO Empty Level host only"]
141pub type PTXFEMPLVL_R = crate::BitReader<bool>;
142#[doc = "Field `PTXFEMPLVL` writer - Periodic TxFIFO Empty Level host only"]
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 Writes"]
149pub type NOTIALLDMAWRIT_R = crate::BitReader<bool>;
150#[doc = "Field `NOTIALLDMAWRIT` writer - Notify All DMA Writes"]
151pub type NOTIALLDMAWRIT_W<'a> = crate::BitWriter<'a, u32, GAHBCFG_SPEC, bool, 22>;
152impl R {
153 #[doc = "Bit 0 - Global Interrupt Mask host and device"]
154 #[inline(always)]
155 pub fn glblintrmsk(&self) -> GLBLINTRMSK_R {
156 GLBLINTRMSK_R::new((self.bits & 1) != 0)
157 }
158 #[doc = "Bits 1:4 - Burst Length/Type host and device"]
159 #[inline(always)]
160 pub fn hbstlen(&self) -> HBSTLEN_R {
161 HBSTLEN_R::new(((self.bits >> 1) & 0x0f) as u8)
162 }
163 #[doc = "Bit 5 - DMA Enable host and device"]
164 #[inline(always)]
165 pub fn dmaen(&self) -> DMAEN_R {
166 DMAEN_R::new(((self.bits >> 5) & 1) != 0)
167 }
168 #[doc = "Bit 7 - Non-Periodic TxFIFO Empty Level host and device"]
169 #[inline(always)]
170 pub fn nptxfemplvl(&self) -> NPTXFEMPLVL_R {
171 NPTXFEMPLVL_R::new(((self.bits >> 7) & 1) != 0)
172 }
173 #[doc = "Bit 8 - Periodic TxFIFO Empty Level host only"]
174 #[inline(always)]
175 pub fn ptxfemplvl(&self) -> PTXFEMPLVL_R {
176 PTXFEMPLVL_R::new(((self.bits >> 8) & 1) != 0)
177 }
178 #[doc = "Bit 21 - Remote Memory Support"]
179 #[inline(always)]
180 pub fn remmemsupp(&self) -> REMMEMSUPP_R {
181 REMMEMSUPP_R::new(((self.bits >> 21) & 1) != 0)
182 }
183 #[doc = "Bit 22 - Notify All DMA Writes"]
184 #[inline(always)]
185 pub fn notialldmawrit(&self) -> NOTIALLDMAWRIT_R {
186 NOTIALLDMAWRIT_R::new(((self.bits >> 22) & 1) != 0)
187 }
188}
189impl W {
190 #[doc = "Bit 0 - Global Interrupt Mask host and device"]
191 #[inline(always)]
192 pub fn glblintrmsk(&mut self) -> GLBLINTRMSK_W {
193 GLBLINTRMSK_W::new(self)
194 }
195 #[doc = "Bits 1:4 - Burst Length/Type host and device"]
196 #[inline(always)]
197 pub fn hbstlen(&mut self) -> HBSTLEN_W {
198 HBSTLEN_W::new(self)
199 }
200 #[doc = "Bit 5 - DMA Enable host and device"]
201 #[inline(always)]
202 pub fn dmaen(&mut self) -> DMAEN_W {
203 DMAEN_W::new(self)
204 }
205 #[doc = "Bit 7 - Non-Periodic TxFIFO Empty Level host and device"]
206 #[inline(always)]
207 pub fn nptxfemplvl(&mut self) -> NPTXFEMPLVL_W {
208 NPTXFEMPLVL_W::new(self)
209 }
210 #[doc = "Bit 8 - Periodic TxFIFO Empty Level host only"]
211 #[inline(always)]
212 pub fn ptxfemplvl(&mut self) -> PTXFEMPLVL_W {
213 PTXFEMPLVL_W::new(self)
214 }
215 #[doc = "Bit 21 - Remote Memory Support"]
216 #[inline(always)]
217 pub fn remmemsupp(&mut self) -> REMMEMSUPP_W {
218 REMMEMSUPP_W::new(self)
219 }
220 #[doc = "Bit 22 - Notify All DMA Writes"]
221 #[inline(always)]
222 pub fn notialldmawrit(&mut self) -> NOTIALLDMAWRIT_W {
223 NOTIALLDMAWRIT_W::new(self)
224 }
225 #[doc = "Writes raw bits to the register."]
226 #[inline(always)]
227 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
228 self.0.bits(bits);
229 self
230 }
231}
232#[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"]
233pub struct GAHBCFG_SPEC;
234impl crate::RegisterSpec for GAHBCFG_SPEC {
235 type Ux = u32;
236}
237#[doc = "`read()` method returns [gahbcfg::R](R) reader structure"]
238impl crate::Readable for GAHBCFG_SPEC {
239 type Reader = R;
240}
241#[doc = "`write(|w| ..)` method takes [gahbcfg::W](W) writer structure"]
242impl crate::Writable for GAHBCFG_SPEC {
243 type Writer = W;
244}
245#[doc = "`reset()` method sets GAHBCFG to value 0"]
246impl crate::Resettable for GAHBCFG_SPEC {
247 #[inline(always)]
248 fn reset_value() -> Self::Ux {
249 0
250 }
251}