efm32gg_pac/efm32gg995/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, const O: u8> = crate::BitWriter<'a, u32, GAHBCFG_SPEC, bool, O>;
41#[doc = "Field `HBSTLEN` reader - Burst Length/Type host and device"]
42pub type HBSTLEN_R = crate::FieldReader<u8, HBSTLEN_A>;
43#[doc = "Burst Length/Type host and device\n\nValue on reset: 0"]
44#[derive(Clone, Copy, Debug, PartialEq, Eq)]
45#[repr(u8)]
46pub enum HBSTLEN_A {
47 #[doc = "0: Single transfer."]
48 SINGLE = 0,
49 #[doc = "1: Incrementing burst of unspecified length."]
50 INCR = 1,
51 #[doc = "3: 4-beat incrementing burst."]
52 INCR4 = 3,
53 #[doc = "5: 8-beat incrementing burst."]
54 INCR8 = 5,
55 #[doc = "7: 16-beat incrementing burst."]
56 INCR16 = 7,
57}
58impl From<HBSTLEN_A> for u8 {
59 #[inline(always)]
60 fn from(variant: HBSTLEN_A) -> Self {
61 variant as _
62 }
63}
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, const O: u8> =
105 crate::FieldWriter<'a, u32, GAHBCFG_SPEC, u8, HBSTLEN_A, 4, O>;
106impl<'a, const O: u8> HBSTLEN_W<'a, O> {
107 #[doc = "Single transfer."]
108 #[inline(always)]
109 pub fn single(self) -> &'a mut W {
110 self.variant(HBSTLEN_A::SINGLE)
111 }
112 #[doc = "Incrementing burst of unspecified length."]
113 #[inline(always)]
114 pub fn incr(self) -> &'a mut W {
115 self.variant(HBSTLEN_A::INCR)
116 }
117 #[doc = "4-beat incrementing burst."]
118 #[inline(always)]
119 pub fn incr4(self) -> &'a mut W {
120 self.variant(HBSTLEN_A::INCR4)
121 }
122 #[doc = "8-beat incrementing burst."]
123 #[inline(always)]
124 pub fn incr8(self) -> &'a mut W {
125 self.variant(HBSTLEN_A::INCR8)
126 }
127 #[doc = "16-beat incrementing burst."]
128 #[inline(always)]
129 pub fn incr16(self) -> &'a mut W {
130 self.variant(HBSTLEN_A::INCR16)
131 }
132}
133#[doc = "Field `DMAEN` reader - DMA Enable host and device"]
134pub type DMAEN_R = crate::BitReader<bool>;
135#[doc = "Field `DMAEN` writer - DMA Enable host and device"]
136pub type DMAEN_W<'a, const O: u8> = crate::BitWriter<'a, u32, GAHBCFG_SPEC, bool, O>;
137#[doc = "Field `NPTXFEMPLVL` reader - Non-Periodic TxFIFO Empty Level host and device"]
138pub type NPTXFEMPLVL_R = crate::BitReader<bool>;
139#[doc = "Field `NPTXFEMPLVL` writer - Non-Periodic TxFIFO Empty Level host and device"]
140pub type NPTXFEMPLVL_W<'a, const O: u8> = crate::BitWriter<'a, u32, GAHBCFG_SPEC, bool, O>;
141#[doc = "Field `PTXFEMPLVL` reader - Periodic TxFIFO Empty Level host only"]
142pub type PTXFEMPLVL_R = crate::BitReader<bool>;
143#[doc = "Field `PTXFEMPLVL` writer - Periodic TxFIFO Empty Level host only"]
144pub type PTXFEMPLVL_W<'a, const O: u8> = crate::BitWriter<'a, u32, GAHBCFG_SPEC, bool, O>;
145#[doc = "Field `REMMEMSUPP` reader - Remote Memory Support"]
146pub type REMMEMSUPP_R = crate::BitReader<bool>;
147#[doc = "Field `REMMEMSUPP` writer - Remote Memory Support"]
148pub type REMMEMSUPP_W<'a, const O: u8> = crate::BitWriter<'a, u32, GAHBCFG_SPEC, bool, O>;
149#[doc = "Field `NOTIALLDMAWRIT` reader - Notify All DMA Writes"]
150pub type NOTIALLDMAWRIT_R = crate::BitReader<bool>;
151#[doc = "Field `NOTIALLDMAWRIT` writer - Notify All DMA Writes"]
152pub type NOTIALLDMAWRIT_W<'a, const O: u8> = crate::BitWriter<'a, u32, GAHBCFG_SPEC, bool, O>;
153impl R {
154 #[doc = "Bit 0 - Global Interrupt Mask host and device"]
155 #[inline(always)]
156 pub fn glblintrmsk(&self) -> GLBLINTRMSK_R {
157 GLBLINTRMSK_R::new((self.bits & 1) != 0)
158 }
159 #[doc = "Bits 1:4 - Burst Length/Type host and device"]
160 #[inline(always)]
161 pub fn hbstlen(&self) -> HBSTLEN_R {
162 HBSTLEN_R::new(((self.bits >> 1) & 0x0f) as u8)
163 }
164 #[doc = "Bit 5 - DMA Enable host and device"]
165 #[inline(always)]
166 pub fn dmaen(&self) -> DMAEN_R {
167 DMAEN_R::new(((self.bits >> 5) & 1) != 0)
168 }
169 #[doc = "Bit 7 - Non-Periodic TxFIFO Empty Level host and device"]
170 #[inline(always)]
171 pub fn nptxfemplvl(&self) -> NPTXFEMPLVL_R {
172 NPTXFEMPLVL_R::new(((self.bits >> 7) & 1) != 0)
173 }
174 #[doc = "Bit 8 - Periodic TxFIFO Empty Level host only"]
175 #[inline(always)]
176 pub fn ptxfemplvl(&self) -> PTXFEMPLVL_R {
177 PTXFEMPLVL_R::new(((self.bits >> 8) & 1) != 0)
178 }
179 #[doc = "Bit 21 - Remote Memory Support"]
180 #[inline(always)]
181 pub fn remmemsupp(&self) -> REMMEMSUPP_R {
182 REMMEMSUPP_R::new(((self.bits >> 21) & 1) != 0)
183 }
184 #[doc = "Bit 22 - Notify All DMA Writes"]
185 #[inline(always)]
186 pub fn notialldmawrit(&self) -> NOTIALLDMAWRIT_R {
187 NOTIALLDMAWRIT_R::new(((self.bits >> 22) & 1) != 0)
188 }
189}
190impl W {
191 #[doc = "Bit 0 - Global Interrupt Mask host and device"]
192 #[inline(always)]
193 #[must_use]
194 pub fn glblintrmsk(&mut self) -> GLBLINTRMSK_W<0> {
195 GLBLINTRMSK_W::new(self)
196 }
197 #[doc = "Bits 1:4 - Burst Length/Type host and device"]
198 #[inline(always)]
199 #[must_use]
200 pub fn hbstlen(&mut self) -> HBSTLEN_W<1> {
201 HBSTLEN_W::new(self)
202 }
203 #[doc = "Bit 5 - DMA Enable host and device"]
204 #[inline(always)]
205 #[must_use]
206 pub fn dmaen(&mut self) -> DMAEN_W<5> {
207 DMAEN_W::new(self)
208 }
209 #[doc = "Bit 7 - Non-Periodic TxFIFO Empty Level host and device"]
210 #[inline(always)]
211 #[must_use]
212 pub fn nptxfemplvl(&mut self) -> NPTXFEMPLVL_W<7> {
213 NPTXFEMPLVL_W::new(self)
214 }
215 #[doc = "Bit 8 - Periodic TxFIFO Empty Level host only"]
216 #[inline(always)]
217 #[must_use]
218 pub fn ptxfemplvl(&mut self) -> PTXFEMPLVL_W<8> {
219 PTXFEMPLVL_W::new(self)
220 }
221 #[doc = "Bit 21 - Remote Memory Support"]
222 #[inline(always)]
223 #[must_use]
224 pub fn remmemsupp(&mut self) -> REMMEMSUPP_W<21> {
225 REMMEMSUPP_W::new(self)
226 }
227 #[doc = "Bit 22 - Notify All DMA Writes"]
228 #[inline(always)]
229 #[must_use]
230 pub fn notialldmawrit(&mut self) -> NOTIALLDMAWRIT_W<22> {
231 NOTIALLDMAWRIT_W::new(self)
232 }
233 #[doc = "Writes raw bits to the register."]
234 #[inline(always)]
235 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
236 self.0.bits(bits);
237 self
238 }
239}
240#[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"]
241pub struct GAHBCFG_SPEC;
242impl crate::RegisterSpec for GAHBCFG_SPEC {
243 type Ux = u32;
244}
245#[doc = "`read()` method returns [gahbcfg::R](R) reader structure"]
246impl crate::Readable for GAHBCFG_SPEC {
247 type Reader = R;
248}
249#[doc = "`write(|w| ..)` method takes [gahbcfg::W](W) writer structure"]
250impl crate::Writable for GAHBCFG_SPEC {
251 type Writer = W;
252 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
253 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
254}
255#[doc = "`reset()` method sets GAHBCFG to value 0"]
256impl crate::Resettable for GAHBCFG_SPEC {
257 const RESET_VALUE: Self::Ux = 0;
258}