efm32hg309f64_pac/usb/
gahbcfg.rs

1#[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, const O: u8> = crate::BitWriter<'a, u32, GAHBCFG_SPEC, bool, O>;
41#[doc = "Field `HBSTLEN` reader - Burst Length/Type"]
42pub type HBSTLEN_R = crate::FieldReader<u8, HBSTLEN_A>;
43#[doc = "Burst Length/Type\n\nValue on reset: 0"]
44#[derive(Clone, Copy, Debug, PartialEq)]
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"]
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"]
134pub type DMAEN_R = crate::BitReader<bool>;
135#[doc = "Field `DMAEN` writer - DMA Enable"]
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"]
138pub type NPTXFEMPLVL_R = crate::BitReader<bool>;
139#[doc = "Field `NPTXFEMPLVL` writer - Non-Periodic TxFIFO Empty Level"]
140pub type NPTXFEMPLVL_W<'a, const O: u8> = crate::BitWriter<'a, u32, GAHBCFG_SPEC, bool, O>;
141#[doc = "Field `REMMEMSUPP` reader - Remote Memory Support"]
142pub type REMMEMSUPP_R = crate::BitReader<bool>;
143#[doc = "Field `REMMEMSUPP` writer - Remote Memory Support"]
144pub type REMMEMSUPP_W<'a, const O: u8> = crate::BitWriter<'a, u32, GAHBCFG_SPEC, bool, O>;
145#[doc = "Field `NOTIALLDMAWRIT` reader - Notify All DMA Writes"]
146pub type NOTIALLDMAWRIT_R = crate::BitReader<bool>;
147#[doc = "Field `NOTIALLDMAWRIT` writer - Notify All DMA Writes"]
148pub type NOTIALLDMAWRIT_W<'a, const O: u8> = crate::BitWriter<'a, u32, GAHBCFG_SPEC, bool, O>;
149#[doc = "Field `AHBSINGLE` reader - AHB Single Support"]
150pub type AHBSINGLE_R = crate::BitReader<bool>;
151#[doc = "Field `AHBSINGLE` writer - AHB Single Support"]
152pub type AHBSINGLE_W<'a, const O: u8> = crate::BitWriter<'a, u32, GAHBCFG_SPEC, bool, O>;
153impl R {
154    #[doc = "Bit 0 - Global Interrupt Mask"]
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"]
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"]
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"]
170    #[inline(always)]
171    pub fn nptxfemplvl(&self) -> NPTXFEMPLVL_R {
172        NPTXFEMPLVL_R::new(((self.bits >> 7) & 1) != 0)
173    }
174    #[doc = "Bit 21 - Remote Memory Support"]
175    #[inline(always)]
176    pub fn remmemsupp(&self) -> REMMEMSUPP_R {
177        REMMEMSUPP_R::new(((self.bits >> 21) & 1) != 0)
178    }
179    #[doc = "Bit 22 - Notify All DMA Writes"]
180    #[inline(always)]
181    pub fn notialldmawrit(&self) -> NOTIALLDMAWRIT_R {
182        NOTIALLDMAWRIT_R::new(((self.bits >> 22) & 1) != 0)
183    }
184    #[doc = "Bit 23 - AHB Single Support"]
185    #[inline(always)]
186    pub fn ahbsingle(&self) -> AHBSINGLE_R {
187        AHBSINGLE_R::new(((self.bits >> 23) & 1) != 0)
188    }
189}
190impl W {
191    #[doc = "Bit 0 - Global Interrupt Mask"]
192    #[inline(always)]
193    pub fn glblintrmsk(&mut self) -> GLBLINTRMSK_W<0> {
194        GLBLINTRMSK_W::new(self)
195    }
196    #[doc = "Bits 1:4 - Burst Length/Type"]
197    #[inline(always)]
198    pub fn hbstlen(&mut self) -> HBSTLEN_W<1> {
199        HBSTLEN_W::new(self)
200    }
201    #[doc = "Bit 5 - DMA Enable"]
202    #[inline(always)]
203    pub fn dmaen(&mut self) -> DMAEN_W<5> {
204        DMAEN_W::new(self)
205    }
206    #[doc = "Bit 7 - Non-Periodic TxFIFO Empty Level"]
207    #[inline(always)]
208    pub fn nptxfemplvl(&mut self) -> NPTXFEMPLVL_W<7> {
209        NPTXFEMPLVL_W::new(self)
210    }
211    #[doc = "Bit 21 - Remote Memory Support"]
212    #[inline(always)]
213    pub fn remmemsupp(&mut self) -> REMMEMSUPP_W<21> {
214        REMMEMSUPP_W::new(self)
215    }
216    #[doc = "Bit 22 - Notify All DMA Writes"]
217    #[inline(always)]
218    pub fn notialldmawrit(&mut self) -> NOTIALLDMAWRIT_W<22> {
219        NOTIALLDMAWRIT_W::new(self)
220    }
221    #[doc = "Bit 23 - AHB Single Support"]
222    #[inline(always)]
223    pub fn ahbsingle(&mut self) -> AHBSINGLE_W<23> {
224        AHBSINGLE_W::new(self)
225    }
226    #[doc = "Writes raw bits to the register."]
227    #[inline(always)]
228    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
229        self.0.bits(bits);
230        self
231    }
232}
233#[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"]
234pub struct GAHBCFG_SPEC;
235impl crate::RegisterSpec for GAHBCFG_SPEC {
236    type Ux = u32;
237}
238#[doc = "`read()` method returns [gahbcfg::R](R) reader structure"]
239impl crate::Readable for GAHBCFG_SPEC {
240    type Reader = R;
241}
242#[doc = "`write(|w| ..)` method takes [gahbcfg::W](W) writer structure"]
243impl crate::Writable for GAHBCFG_SPEC {
244    type Writer = W;
245}
246#[doc = "`reset()` method sets GAHBCFG to value 0"]
247impl crate::Resettable for GAHBCFG_SPEC {
248    #[inline(always)]
249    fn reset_value() -> Self::Ux {
250        0
251    }
252}