atsamv71n21/usbhs/
usbhs_hstpipisr.rs

1#[doc = "Register `USBHS_HSTPIPISR[%s]` reader"]
2pub struct R(crate::R<USBHS_HSTPIPISR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<USBHS_HSTPIPISR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<USBHS_HSTPIPISR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<USBHS_HSTPIPISR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Field `RXINI` reader - Received IN Data Interrupt"]
17pub struct RXINI_R(crate::FieldReader<bool, bool>);
18impl RXINI_R {
19    #[inline(always)]
20    pub(crate) fn new(bits: bool) -> Self {
21        RXINI_R(crate::FieldReader::new(bits))
22    }
23}
24impl core::ops::Deref for RXINI_R {
25    type Target = crate::FieldReader<bool, bool>;
26    #[inline(always)]
27    fn deref(&self) -> &Self::Target {
28        &self.0
29    }
30}
31#[doc = "Field `TXOUTI` reader - Transmitted OUT Data Interrupt"]
32pub struct TXOUTI_R(crate::FieldReader<bool, bool>);
33impl TXOUTI_R {
34    #[inline(always)]
35    pub(crate) fn new(bits: bool) -> Self {
36        TXOUTI_R(crate::FieldReader::new(bits))
37    }
38}
39impl core::ops::Deref for TXOUTI_R {
40    type Target = crate::FieldReader<bool, bool>;
41    #[inline(always)]
42    fn deref(&self) -> &Self::Target {
43        &self.0
44    }
45}
46#[doc = "Field `TXSTPI` reader - Transmitted SETUP Interrupt"]
47pub struct TXSTPI_R(crate::FieldReader<bool, bool>);
48impl TXSTPI_R {
49    #[inline(always)]
50    pub(crate) fn new(bits: bool) -> Self {
51        TXSTPI_R(crate::FieldReader::new(bits))
52    }
53}
54impl core::ops::Deref for TXSTPI_R {
55    type Target = crate::FieldReader<bool, bool>;
56    #[inline(always)]
57    fn deref(&self) -> &Self::Target {
58        &self.0
59    }
60}
61#[doc = "Field `PERRI` reader - Pipe Error Interrupt"]
62pub struct PERRI_R(crate::FieldReader<bool, bool>);
63impl PERRI_R {
64    #[inline(always)]
65    pub(crate) fn new(bits: bool) -> Self {
66        PERRI_R(crate::FieldReader::new(bits))
67    }
68}
69impl core::ops::Deref for PERRI_R {
70    type Target = crate::FieldReader<bool, bool>;
71    #[inline(always)]
72    fn deref(&self) -> &Self::Target {
73        &self.0
74    }
75}
76#[doc = "Field `NAKEDI` reader - NAKed Interrupt"]
77pub struct NAKEDI_R(crate::FieldReader<bool, bool>);
78impl NAKEDI_R {
79    #[inline(always)]
80    pub(crate) fn new(bits: bool) -> Self {
81        NAKEDI_R(crate::FieldReader::new(bits))
82    }
83}
84impl core::ops::Deref for NAKEDI_R {
85    type Target = crate::FieldReader<bool, bool>;
86    #[inline(always)]
87    fn deref(&self) -> &Self::Target {
88        &self.0
89    }
90}
91#[doc = "Field `OVERFI` reader - Overflow Interrupt"]
92pub struct OVERFI_R(crate::FieldReader<bool, bool>);
93impl OVERFI_R {
94    #[inline(always)]
95    pub(crate) fn new(bits: bool) -> Self {
96        OVERFI_R(crate::FieldReader::new(bits))
97    }
98}
99impl core::ops::Deref for OVERFI_R {
100    type Target = crate::FieldReader<bool, bool>;
101    #[inline(always)]
102    fn deref(&self) -> &Self::Target {
103        &self.0
104    }
105}
106#[doc = "Field `RXSTALLDI` reader - Received STALLed Interrupt"]
107pub struct RXSTALLDI_R(crate::FieldReader<bool, bool>);
108impl RXSTALLDI_R {
109    #[inline(always)]
110    pub(crate) fn new(bits: bool) -> Self {
111        RXSTALLDI_R(crate::FieldReader::new(bits))
112    }
113}
114impl core::ops::Deref for RXSTALLDI_R {
115    type Target = crate::FieldReader<bool, bool>;
116    #[inline(always)]
117    fn deref(&self) -> &Self::Target {
118        &self.0
119    }
120}
121#[doc = "Field `SHORTPACKETI` reader - Short Packet Interrupt"]
122pub struct SHORTPACKETI_R(crate::FieldReader<bool, bool>);
123impl SHORTPACKETI_R {
124    #[inline(always)]
125    pub(crate) fn new(bits: bool) -> Self {
126        SHORTPACKETI_R(crate::FieldReader::new(bits))
127    }
128}
129impl core::ops::Deref for SHORTPACKETI_R {
130    type Target = crate::FieldReader<bool, bool>;
131    #[inline(always)]
132    fn deref(&self) -> &Self::Target {
133        &self.0
134    }
135}
136#[doc = "Data Toggle Sequence\n\nValue on reset: 0"]
137#[derive(Clone, Copy, Debug, PartialEq)]
138#[repr(u8)]
139pub enum DTSEQ_A {
140    #[doc = "0: Data0 toggle sequence"]
141    DATA0 = 0,
142    #[doc = "1: Data1 toggle sequence"]
143    DATA1 = 1,
144}
145impl From<DTSEQ_A> for u8 {
146    #[inline(always)]
147    fn from(variant: DTSEQ_A) -> Self {
148        variant as _
149    }
150}
151#[doc = "Field `DTSEQ` reader - Data Toggle Sequence"]
152pub struct DTSEQ_R(crate::FieldReader<u8, DTSEQ_A>);
153impl DTSEQ_R {
154    #[inline(always)]
155    pub(crate) fn new(bits: u8) -> Self {
156        DTSEQ_R(crate::FieldReader::new(bits))
157    }
158    #[doc = r"Get enumerated values variant"]
159    #[inline(always)]
160    pub fn variant(&self) -> Option<DTSEQ_A> {
161        match self.bits {
162            0 => Some(DTSEQ_A::DATA0),
163            1 => Some(DTSEQ_A::DATA1),
164            _ => None,
165        }
166    }
167    #[doc = "Checks if the value of the field is `DATA0`"]
168    #[inline(always)]
169    pub fn is_data0(&self) -> bool {
170        **self == DTSEQ_A::DATA0
171    }
172    #[doc = "Checks if the value of the field is `DATA1`"]
173    #[inline(always)]
174    pub fn is_data1(&self) -> bool {
175        **self == DTSEQ_A::DATA1
176    }
177}
178impl core::ops::Deref for DTSEQ_R {
179    type Target = crate::FieldReader<u8, DTSEQ_A>;
180    #[inline(always)]
181    fn deref(&self) -> &Self::Target {
182        &self.0
183    }
184}
185#[doc = "Number of Busy Banks\n\nValue on reset: 0"]
186#[derive(Clone, Copy, Debug, PartialEq)]
187#[repr(u8)]
188pub enum NBUSYBK_A {
189    #[doc = "0: 0 busy bank (all banks free)"]
190    _0_BUSY = 0,
191    #[doc = "1: 1 busy bank"]
192    _1_BUSY = 1,
193    #[doc = "2: 2 busy banks"]
194    _2_BUSY = 2,
195    #[doc = "3: 3 busy banks"]
196    _3_BUSY = 3,
197}
198impl From<NBUSYBK_A> for u8 {
199    #[inline(always)]
200    fn from(variant: NBUSYBK_A) -> Self {
201        variant as _
202    }
203}
204#[doc = "Field `NBUSYBK` reader - Number of Busy Banks"]
205pub struct NBUSYBK_R(crate::FieldReader<u8, NBUSYBK_A>);
206impl NBUSYBK_R {
207    #[inline(always)]
208    pub(crate) fn new(bits: u8) -> Self {
209        NBUSYBK_R(crate::FieldReader::new(bits))
210    }
211    #[doc = r"Get enumerated values variant"]
212    #[inline(always)]
213    pub fn variant(&self) -> NBUSYBK_A {
214        match self.bits {
215            0 => NBUSYBK_A::_0_BUSY,
216            1 => NBUSYBK_A::_1_BUSY,
217            2 => NBUSYBK_A::_2_BUSY,
218            3 => NBUSYBK_A::_3_BUSY,
219            _ => unreachable!(),
220        }
221    }
222    #[doc = "Checks if the value of the field is `_0_BUSY`"]
223    #[inline(always)]
224    pub fn is_0_busy(&self) -> bool {
225        **self == NBUSYBK_A::_0_BUSY
226    }
227    #[doc = "Checks if the value of the field is `_1_BUSY`"]
228    #[inline(always)]
229    pub fn is_1_busy(&self) -> bool {
230        **self == NBUSYBK_A::_1_BUSY
231    }
232    #[doc = "Checks if the value of the field is `_2_BUSY`"]
233    #[inline(always)]
234    pub fn is_2_busy(&self) -> bool {
235        **self == NBUSYBK_A::_2_BUSY
236    }
237    #[doc = "Checks if the value of the field is `_3_BUSY`"]
238    #[inline(always)]
239    pub fn is_3_busy(&self) -> bool {
240        **self == NBUSYBK_A::_3_BUSY
241    }
242}
243impl core::ops::Deref for NBUSYBK_R {
244    type Target = crate::FieldReader<u8, NBUSYBK_A>;
245    #[inline(always)]
246    fn deref(&self) -> &Self::Target {
247        &self.0
248    }
249}
250#[doc = "Current Bank\n\nValue on reset: 0"]
251#[derive(Clone, Copy, Debug, PartialEq)]
252#[repr(u8)]
253pub enum CURRBK_A {
254    #[doc = "0: Current bank is bank0"]
255    BANK0 = 0,
256    #[doc = "1: Current bank is bank1"]
257    BANK1 = 1,
258    #[doc = "2: Current bank is bank2"]
259    BANK2 = 2,
260}
261impl From<CURRBK_A> for u8 {
262    #[inline(always)]
263    fn from(variant: CURRBK_A) -> Self {
264        variant as _
265    }
266}
267#[doc = "Field `CURRBK` reader - Current Bank"]
268pub struct CURRBK_R(crate::FieldReader<u8, CURRBK_A>);
269impl CURRBK_R {
270    #[inline(always)]
271    pub(crate) fn new(bits: u8) -> Self {
272        CURRBK_R(crate::FieldReader::new(bits))
273    }
274    #[doc = r"Get enumerated values variant"]
275    #[inline(always)]
276    pub fn variant(&self) -> Option<CURRBK_A> {
277        match self.bits {
278            0 => Some(CURRBK_A::BANK0),
279            1 => Some(CURRBK_A::BANK1),
280            2 => Some(CURRBK_A::BANK2),
281            _ => None,
282        }
283    }
284    #[doc = "Checks if the value of the field is `BANK0`"]
285    #[inline(always)]
286    pub fn is_bank0(&self) -> bool {
287        **self == CURRBK_A::BANK0
288    }
289    #[doc = "Checks if the value of the field is `BANK1`"]
290    #[inline(always)]
291    pub fn is_bank1(&self) -> bool {
292        **self == CURRBK_A::BANK1
293    }
294    #[doc = "Checks if the value of the field is `BANK2`"]
295    #[inline(always)]
296    pub fn is_bank2(&self) -> bool {
297        **self == CURRBK_A::BANK2
298    }
299}
300impl core::ops::Deref for CURRBK_R {
301    type Target = crate::FieldReader<u8, CURRBK_A>;
302    #[inline(always)]
303    fn deref(&self) -> &Self::Target {
304        &self.0
305    }
306}
307#[doc = "Field `RWALL` reader - Read/Write Allowed"]
308pub struct RWALL_R(crate::FieldReader<bool, bool>);
309impl RWALL_R {
310    #[inline(always)]
311    pub(crate) fn new(bits: bool) -> Self {
312        RWALL_R(crate::FieldReader::new(bits))
313    }
314}
315impl core::ops::Deref for RWALL_R {
316    type Target = crate::FieldReader<bool, bool>;
317    #[inline(always)]
318    fn deref(&self) -> &Self::Target {
319        &self.0
320    }
321}
322#[doc = "Field `CFGOK` reader - Configuration OK Status"]
323pub struct CFGOK_R(crate::FieldReader<bool, bool>);
324impl CFGOK_R {
325    #[inline(always)]
326    pub(crate) fn new(bits: bool) -> Self {
327        CFGOK_R(crate::FieldReader::new(bits))
328    }
329}
330impl core::ops::Deref for CFGOK_R {
331    type Target = crate::FieldReader<bool, bool>;
332    #[inline(always)]
333    fn deref(&self) -> &Self::Target {
334        &self.0
335    }
336}
337#[doc = "Field `PBYCT` reader - Pipe Byte Count"]
338pub struct PBYCT_R(crate::FieldReader<u16, u16>);
339impl PBYCT_R {
340    #[inline(always)]
341    pub(crate) fn new(bits: u16) -> Self {
342        PBYCT_R(crate::FieldReader::new(bits))
343    }
344}
345impl core::ops::Deref for PBYCT_R {
346    type Target = crate::FieldReader<u16, u16>;
347    #[inline(always)]
348    fn deref(&self) -> &Self::Target {
349        &self.0
350    }
351}
352impl R {
353    #[doc = "Bit 0 - Received IN Data Interrupt"]
354    #[inline(always)]
355    pub fn rxini(&self) -> RXINI_R {
356        RXINI_R::new((self.bits & 0x01) != 0)
357    }
358    #[doc = "Bit 1 - Transmitted OUT Data Interrupt"]
359    #[inline(always)]
360    pub fn txouti(&self) -> TXOUTI_R {
361        TXOUTI_R::new(((self.bits >> 1) & 0x01) != 0)
362    }
363    #[doc = "Bit 2 - Transmitted SETUP Interrupt"]
364    #[inline(always)]
365    pub fn txstpi(&self) -> TXSTPI_R {
366        TXSTPI_R::new(((self.bits >> 2) & 0x01) != 0)
367    }
368    #[doc = "Bit 3 - Pipe Error Interrupt"]
369    #[inline(always)]
370    pub fn perri(&self) -> PERRI_R {
371        PERRI_R::new(((self.bits >> 3) & 0x01) != 0)
372    }
373    #[doc = "Bit 4 - NAKed Interrupt"]
374    #[inline(always)]
375    pub fn nakedi(&self) -> NAKEDI_R {
376        NAKEDI_R::new(((self.bits >> 4) & 0x01) != 0)
377    }
378    #[doc = "Bit 5 - Overflow Interrupt"]
379    #[inline(always)]
380    pub fn overfi(&self) -> OVERFI_R {
381        OVERFI_R::new(((self.bits >> 5) & 0x01) != 0)
382    }
383    #[doc = "Bit 6 - Received STALLed Interrupt"]
384    #[inline(always)]
385    pub fn rxstalldi(&self) -> RXSTALLDI_R {
386        RXSTALLDI_R::new(((self.bits >> 6) & 0x01) != 0)
387    }
388    #[doc = "Bit 7 - Short Packet Interrupt"]
389    #[inline(always)]
390    pub fn shortpacketi(&self) -> SHORTPACKETI_R {
391        SHORTPACKETI_R::new(((self.bits >> 7) & 0x01) != 0)
392    }
393    #[doc = "Bits 8:9 - Data Toggle Sequence"]
394    #[inline(always)]
395    pub fn dtseq(&self) -> DTSEQ_R {
396        DTSEQ_R::new(((self.bits >> 8) & 0x03) as u8)
397    }
398    #[doc = "Bits 12:13 - Number of Busy Banks"]
399    #[inline(always)]
400    pub fn nbusybk(&self) -> NBUSYBK_R {
401        NBUSYBK_R::new(((self.bits >> 12) & 0x03) as u8)
402    }
403    #[doc = "Bits 14:15 - Current Bank"]
404    #[inline(always)]
405    pub fn currbk(&self) -> CURRBK_R {
406        CURRBK_R::new(((self.bits >> 14) & 0x03) as u8)
407    }
408    #[doc = "Bit 16 - Read/Write Allowed"]
409    #[inline(always)]
410    pub fn rwall(&self) -> RWALL_R {
411        RWALL_R::new(((self.bits >> 16) & 0x01) != 0)
412    }
413    #[doc = "Bit 18 - Configuration OK Status"]
414    #[inline(always)]
415    pub fn cfgok(&self) -> CFGOK_R {
416        CFGOK_R::new(((self.bits >> 18) & 0x01) != 0)
417    }
418    #[doc = "Bits 20:30 - Pipe Byte Count"]
419    #[inline(always)]
420    pub fn pbyct(&self) -> PBYCT_R {
421        PBYCT_R::new(((self.bits >> 20) & 0x07ff) as u16)
422    }
423}
424#[doc = "Host Pipe Status Register (n = 0) 0\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [usbhs_hstpipisr](index.html) module"]
425pub struct USBHS_HSTPIPISR_SPEC;
426impl crate::RegisterSpec for USBHS_HSTPIPISR_SPEC {
427    type Ux = u32;
428}
429#[doc = "`read()` method returns [usbhs_hstpipisr::R](R) reader structure"]
430impl crate::Readable for USBHS_HSTPIPISR_SPEC {
431    type Reader = R;
432}
433#[doc = "`reset()` method sets USBHS_HSTPIPISR[%s]
434to value 0"]
435impl crate::Resettable for USBHS_HSTPIPISR_SPEC {
436    #[inline(always)]
437    fn reset_value() -> Self::Ux {
438        0
439    }
440}