1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
#[doc = "Register `GNPTXSTS` reader"]
pub type R = crate::R<GnptxstsSpec>;
#[doc = "Non-periodic TxFIFO Space Avail\n\nValue on reset: 16"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u16)]
pub enum NptxFspcAvail {
    #[doc = "0: Non-periodic TxFIFO is full"]
    Value1 = 0,
    #[doc = "1: 1 word available"]
    Value2 = 1,
    #[doc = "2: 2 words available"]
    Value3 = 2,
}
impl From<NptxFspcAvail> for u16 {
    #[inline(always)]
    fn from(variant: NptxFspcAvail) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for NptxFspcAvail {
    type Ux = u16;
}
#[doc = "Field `NPTxFSpcAvail` reader - Non-periodic TxFIFO Space Avail"]
pub type NptxFspcAvailR = crate::FieldReader<NptxFspcAvail>;
impl NptxFspcAvailR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Option<NptxFspcAvail> {
        match self.bits {
            0 => Some(NptxFspcAvail::Value1),
            1 => Some(NptxFspcAvail::Value2),
            2 => Some(NptxFspcAvail::Value3),
            _ => None,
        }
    }
    #[doc = "Non-periodic TxFIFO is full"]
    #[inline(always)]
    pub fn is_value1(&self) -> bool {
        *self == NptxFspcAvail::Value1
    }
    #[doc = "1 word available"]
    #[inline(always)]
    pub fn is_value2(&self) -> bool {
        *self == NptxFspcAvail::Value2
    }
    #[doc = "2 words available"]
    #[inline(always)]
    pub fn is_value3(&self) -> bool {
        *self == NptxFspcAvail::Value3
    }
}
#[doc = "Non-periodic Transmit Request Queue Space Available\n\nValue on reset: 8"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum NptxQspcAvail {
    #[doc = "0: Non-periodic Transmit Request Queue is full"]
    Value1 = 0,
    #[doc = "1: 1 location available"]
    Value2 = 1,
    #[doc = "2: 2 locations available"]
    Value3 = 2,
}
impl From<NptxQspcAvail> for u8 {
    #[inline(always)]
    fn from(variant: NptxQspcAvail) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for NptxQspcAvail {
    type Ux = u8;
}
#[doc = "Field `NPTxQSpcAvail` reader - Non-periodic Transmit Request Queue Space Available"]
pub type NptxQspcAvailR = crate::FieldReader<NptxQspcAvail>;
impl NptxQspcAvailR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Option<NptxQspcAvail> {
        match self.bits {
            0 => Some(NptxQspcAvail::Value1),
            1 => Some(NptxQspcAvail::Value2),
            2 => Some(NptxQspcAvail::Value3),
            _ => None,
        }
    }
    #[doc = "Non-periodic Transmit Request Queue is full"]
    #[inline(always)]
    pub fn is_value1(&self) -> bool {
        *self == NptxQspcAvail::Value1
    }
    #[doc = "1 location available"]
    #[inline(always)]
    pub fn is_value2(&self) -> bool {
        *self == NptxQspcAvail::Value2
    }
    #[doc = "2 locations available"]
    #[inline(always)]
    pub fn is_value3(&self) -> bool {
        *self == NptxQspcAvail::Value3
    }
}
#[doc = "Top of the Non-periodic Transmit Request Queue\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum NptxQtop {
    #[doc = "0: IN/OUT token"]
    Value1 = 0,
    #[doc = "1: Zero-length transmit packet (device IN/host OUT)"]
    Value2 = 1,
    #[doc = "3: Channel halt command"]
    Value4 = 3,
}
impl From<NptxQtop> for u8 {
    #[inline(always)]
    fn from(variant: NptxQtop) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for NptxQtop {
    type Ux = u8;
}
#[doc = "Field `NPTxQTop` reader - Top of the Non-periodic Transmit Request Queue"]
pub type NptxQtopR = crate::FieldReader<NptxQtop>;
impl NptxQtopR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Option<NptxQtop> {
        match self.bits {
            0 => Some(NptxQtop::Value1),
            1 => Some(NptxQtop::Value2),
            3 => Some(NptxQtop::Value4),
            _ => None,
        }
    }
    #[doc = "IN/OUT token"]
    #[inline(always)]
    pub fn is_value1(&self) -> bool {
        *self == NptxQtop::Value1
    }
    #[doc = "Zero-length transmit packet (device IN/host OUT)"]
    #[inline(always)]
    pub fn is_value2(&self) -> bool {
        *self == NptxQtop::Value2
    }
    #[doc = "Channel halt command"]
    #[inline(always)]
    pub fn is_value4(&self) -> bool {
        *self == NptxQtop::Value4
    }
}
impl R {
    #[doc = "Bits 0:15 - Non-periodic TxFIFO Space Avail"]
    #[inline(always)]
    pub fn nptx_fspc_avail(&self) -> NptxFspcAvailR {
        NptxFspcAvailR::new((self.bits & 0xffff) as u16)
    }
    #[doc = "Bits 16:23 - Non-periodic Transmit Request Queue Space Available"]
    #[inline(always)]
    pub fn nptx_qspc_avail(&self) -> NptxQspcAvailR {
        NptxQspcAvailR::new(((self.bits >> 16) & 0xff) as u8)
    }
    #[doc = "Bits 24:30 - Top of the Non-periodic Transmit Request Queue"]
    #[inline(always)]
    pub fn nptx_qtop(&self) -> NptxQtopR {
        NptxQtopR::new(((self.bits >> 24) & 0x7f) as u8)
    }
}
#[doc = "Non-Periodic Transmit FIFO/Queue Status Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`gnptxsts::R`](R).  See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct GnptxstsSpec;
impl crate::RegisterSpec for GnptxstsSpec {
    type Ux = u32;
}
#[doc = "`read()` method returns [`gnptxsts::R`](R) reader structure"]
impl crate::Readable for GnptxstsSpec {}
#[doc = "`reset()` method sets GNPTXSTS to value 0x0008_0010"]
impl crate::Resettable for GnptxstsSpec {
    const RESET_VALUE: u32 = 0x0008_0010;
}