stm32g0/stm32g0c1/usb/
chepr.rs

1///Register `CHEP%sR` reader
2pub type R = crate::R<CHEPRrs>;
3///Register `CHEP%sR` writer
4pub type W = crate::W<CHEPRrs>;
5///Field `EA` reader - endpoint/channel address Device mode Software must write in this field the 4-bit address used to identify the transactions directed to this endpoint. A value must be written before enabling the corresponding endpoint. Host mode Software must write in this field the 4-bit address used to identify the channel addressed by the host transaction.
6pub type EA_R = crate::FieldReader;
7///Field `EA` writer - endpoint/channel address Device mode Software must write in this field the 4-bit address used to identify the transactions directed to this endpoint. A value must be written before enabling the corresponding endpoint. Host mode Software must write in this field the 4-bit address used to identify the channel addressed by the host transaction.
8pub type EA_W<'a, REG> = crate::FieldWriter<'a, REG, 4>;
9/**Status bits, for transmission transfers Device mode These bits contain the information about the endpoint status, listed in . These bits can be toggled by the software to initialize their value. When the application software writes '0, the value remains unchanged, while writing '1 makes the bit value toggle. Hardware sets the STTX bits to NAK, when a correct transfer has occurred (VTTX=1) corresponding to a IN or SETUP (control only) transaction addressed to this channel/endpoint. It then waits for the software to prepare the next set of data to be transmitted. Double-buffered bulk endpoints implement a special transaction flow control, which controls the status based on buffer availability condition (Refer to endpoints). If the endpoint is defined as Isochronous, its status can only be 'VALID' or 'DISABLED'. Therefore, the hardware cannot change the status of the channel/endpoint/channel after a successful transaction. If the software sets the STTX bits to 'STALL' or 'NAK' for an Isochronous channel/endpoint, the USB peripheral behavior is not defined. These bits are read/write but they can be only toggled by writing '1. Host mode Same as STRX behaviour but for IN transactions (TBC)
10
11Value on reset: 0*/
12#[cfg_attr(feature = "defmt", derive(defmt::Format))]
13#[derive(Clone, Copy, Debug, PartialEq, Eq)]
14#[repr(u8)]
15pub enum STATTXR {
16    ///0: All transmission requests addressed to this endpoint/channel are ignored.
17    Disabled = 0,
18    ///1: Device mode: the endpoint is stalled and all transmission requests result in a STALL handshake. Host mode: this indicates that the device has STALLed the channel.
19    Stall = 1,
20    ///2: Device mode: the endpoint is NAKed and all transmission requests result in a NAK handshake. Host mode: this indicates that the device has NAKed the transmission request.
21    Nak = 2,
22    ///3: This endpoint/channel is enabled for transmission.
23    Valid = 3,
24}
25impl From<STATTXR> for u8 {
26    #[inline(always)]
27    fn from(variant: STATTXR) -> Self {
28        variant as _
29    }
30}
31impl crate::FieldSpec for STATTXR {
32    type Ux = u8;
33}
34impl crate::IsEnum for STATTXR {}
35///Field `STATTX` reader - Status bits, for transmission transfers Device mode These bits contain the information about the endpoint status, listed in . These bits can be toggled by the software to initialize their value. When the application software writes '0, the value remains unchanged, while writing '1 makes the bit value toggle. Hardware sets the STTX bits to NAK, when a correct transfer has occurred (VTTX=1) corresponding to a IN or SETUP (control only) transaction addressed to this channel/endpoint. It then waits for the software to prepare the next set of data to be transmitted. Double-buffered bulk endpoints implement a special transaction flow control, which controls the status based on buffer availability condition (Refer to endpoints). If the endpoint is defined as Isochronous, its status can only be 'VALID' or 'DISABLED'. Therefore, the hardware cannot change the status of the channel/endpoint/channel after a successful transaction. If the software sets the STTX bits to 'STALL' or 'NAK' for an Isochronous channel/endpoint, the USB peripheral behavior is not defined. These bits are read/write but they can be only toggled by writing '1. Host mode Same as STRX behaviour but for IN transactions (TBC)
36pub type STATTX_R = crate::FieldReader<STATTXR>;
37impl STATTX_R {
38    ///Get enumerated values variant
39    #[inline(always)]
40    pub const fn variant(&self) -> STATTXR {
41        match self.bits {
42            0 => STATTXR::Disabled,
43            1 => STATTXR::Stall,
44            2 => STATTXR::Nak,
45            3 => STATTXR::Valid,
46            _ => unreachable!(),
47        }
48    }
49    ///All transmission requests addressed to this endpoint/channel are ignored.
50    #[inline(always)]
51    pub fn is_disabled(&self) -> bool {
52        *self == STATTXR::Disabled
53    }
54    ///Device mode: the endpoint is stalled and all transmission requests result in a STALL handshake. Host mode: this indicates that the device has STALLed the channel.
55    #[inline(always)]
56    pub fn is_stall(&self) -> bool {
57        *self == STATTXR::Stall
58    }
59    ///Device mode: the endpoint is NAKed and all transmission requests result in a NAK handshake. Host mode: this indicates that the device has NAKed the transmission request.
60    #[inline(always)]
61    pub fn is_nak(&self) -> bool {
62        *self == STATTXR::Nak
63    }
64    ///This endpoint/channel is enabled for transmission.
65    #[inline(always)]
66    pub fn is_valid(&self) -> bool {
67        *self == STATTXR::Valid
68    }
69}
70/**Status bits, for transmission transfers Device mode These bits contain the information about the endpoint status, listed in . These bits can be toggled by the software to initialize their value. When the application software writes '0, the value remains unchanged, while writing '1 makes the bit value toggle. Hardware sets the STTX bits to NAK, when a correct transfer has occurred (VTTX=1) corresponding to a IN or SETUP (control only) transaction addressed to this channel/endpoint. It then waits for the software to prepare the next set of data to be transmitted. Double-buffered bulk endpoints implement a special transaction flow control, which controls the status based on buffer availability condition (Refer to endpoints). If the endpoint is defined as Isochronous, its status can only be 'VALID' or 'DISABLED'. Therefore, the hardware cannot change the status of the channel/endpoint/channel after a successful transaction. If the software sets the STTX bits to 'STALL' or 'NAK' for an Isochronous channel/endpoint, the USB peripheral behavior is not defined. These bits are read/write but they can be only toggled by writing '1. Host mode Same as STRX behaviour but for IN transactions (TBC)
71
72Value on reset: 0*/
73#[cfg_attr(feature = "defmt", derive(defmt::Format))]
74#[derive(Clone, Copy, Debug, PartialEq, Eq)]
75#[repr(u8)]
76pub enum STATTXW {
77    ///0: Do not change bits
78    Keep = 0,
79}
80impl From<STATTXW> for u8 {
81    #[inline(always)]
82    fn from(variant: STATTXW) -> Self {
83        variant as _
84    }
85}
86impl crate::FieldSpec for STATTXW {
87    type Ux = u8;
88}
89impl crate::IsEnum for STATTXW {}
90///Field `STATTX` writer - Status bits, for transmission transfers Device mode These bits contain the information about the endpoint status, listed in . These bits can be toggled by the software to initialize their value. When the application software writes '0, the value remains unchanged, while writing '1 makes the bit value toggle. Hardware sets the STTX bits to NAK, when a correct transfer has occurred (VTTX=1) corresponding to a IN or SETUP (control only) transaction addressed to this channel/endpoint. It then waits for the software to prepare the next set of data to be transmitted. Double-buffered bulk endpoints implement a special transaction flow control, which controls the status based on buffer availability condition (Refer to endpoints). If the endpoint is defined as Isochronous, its status can only be 'VALID' or 'DISABLED'. Therefore, the hardware cannot change the status of the channel/endpoint/channel after a successful transaction. If the software sets the STTX bits to 'STALL' or 'NAK' for an Isochronous channel/endpoint, the USB peripheral behavior is not defined. These bits are read/write but they can be only toggled by writing '1. Host mode Same as STRX behaviour but for IN transactions (TBC)
91pub type STATTX_W<'a, REG> = crate::FieldWriter<'a, REG, 2, STATTXW>;
92impl<'a, REG> STATTX_W<'a, REG>
93where
94    REG: crate::Writable + crate::RegisterSpec,
95    REG::Ux: From<u8>,
96{
97    ///Do not change bits
98    #[inline(always)]
99    pub fn keep(self) -> &'a mut crate::W<REG> {
100        self.variant(STATTXW::Keep)
101    }
102}
103/**Data Toggle, for transmission transfers If the endpoint/channel is non-isochronous, this bit contains the required value of the data toggle bit (0=DATA0, 1=DATA1) for the next data packet to be transmitted. Hardware toggles this bit when the ACK handshake is received from the USB host, following a data packet transmission. If the endpoint/channel is defined as a control one, hardware sets this bit to 1 at the reception of a SETUP PID addressed to this endpoint. If the endpoint/channel is using the double buffer feature, this bit is used to support packet buffer swapping too (Refer to ) If the endpoint/channel is Isochronous, this bit is used to support packet buffer swapping since no data toggling is used for this sort of endpoints and only DATA0 packet are transmitted (Refer to ). Hardware toggles this bit just after the end of data packet transmission, since no handshake is used for Isochronous transfers. This bit can also be toggled by the software to initialize its value (mandatory when the endpoint/channel is not a control one) or to force a specific data toggle/packet buffer usage. When the application software writes '0, the value of DTOGTX remains unchanged, while writing '1 makes the bit value toggle. This bit is read/write but it can only be toggled by writing 1.
104
105Value on reset: 0*/
106#[cfg_attr(feature = "defmt", derive(defmt::Format))]
107#[derive(Clone, Copy, Debug, PartialEq, Eq)]
108pub enum DTOGTXW {
109    ///1: Flip bit
110    Toggle = 1,
111}
112impl From<DTOGTXW> for bool {
113    #[inline(always)]
114    fn from(variant: DTOGTXW) -> Self {
115        variant as u8 != 0
116    }
117}
118///Field `DTOGTX` writer - Data Toggle, for transmission transfers If the endpoint/channel is non-isochronous, this bit contains the required value of the data toggle bit (0=DATA0, 1=DATA1) for the next data packet to be transmitted. Hardware toggles this bit when the ACK handshake is received from the USB host, following a data packet transmission. If the endpoint/channel is defined as a control one, hardware sets this bit to 1 at the reception of a SETUP PID addressed to this endpoint. If the endpoint/channel is using the double buffer feature, this bit is used to support packet buffer swapping too (Refer to ) If the endpoint/channel is Isochronous, this bit is used to support packet buffer swapping since no data toggling is used for this sort of endpoints and only DATA0 packet are transmitted (Refer to ). Hardware toggles this bit just after the end of data packet transmission, since no handshake is used for Isochronous transfers. This bit can also be toggled by the software to initialize its value (mandatory when the endpoint/channel is not a control one) or to force a specific data toggle/packet buffer usage. When the application software writes '0, the value of DTOGTX remains unchanged, while writing '1 makes the bit value toggle. This bit is read/write but it can only be toggled by writing 1.
119pub type DTOGTX_W<'a, REG> = crate::BitWriter1T<'a, REG, DTOGTXW>;
120impl<'a, REG> DTOGTX_W<'a, REG>
121where
122    REG: crate::Writable + crate::RegisterSpec,
123{
124    ///Flip bit
125    #[inline(always)]
126    pub fn toggle(self) -> &'a mut crate::W<REG> {
127        self.variant(DTOGTXW::Toggle)
128    }
129}
130/**Valid USB transaction transmitted Device mode This bit is set by the hardware when an IN transaction is successfully completed on this endpoint; the software can only clear this bit. If the CTRM bit in the USB_CNTR register is set accordingly, a generic interrupt condition is generated together with the endpoint related interrupt condition, which is always activated. A transaction ended with a NAK or STALL handshake does not set this bit, since no data is actually transferred, as in the case of protocol errors or data toggle mismatches. This bit is read/write but only '0 can be written. Host mode Same of VTRX behaviour but for USB OUT and SETUP transactions.
131
132Value on reset: 0*/
133#[cfg_attr(feature = "defmt", derive(defmt::Format))]
134#[derive(Clone, Copy, Debug, PartialEq, Eq)]
135pub enum VTTXW {
136    ///0: Clear flag
137    Clear = 0,
138}
139impl From<VTTXW> for bool {
140    #[inline(always)]
141    fn from(variant: VTTXW) -> Self {
142        variant as u8 != 0
143    }
144}
145///Field `VTTX` reader - Valid USB transaction transmitted Device mode This bit is set by the hardware when an IN transaction is successfully completed on this endpoint; the software can only clear this bit. If the CTRM bit in the USB_CNTR register is set accordingly, a generic interrupt condition is generated together with the endpoint related interrupt condition, which is always activated. A transaction ended with a NAK or STALL handshake does not set this bit, since no data is actually transferred, as in the case of protocol errors or data toggle mismatches. This bit is read/write but only '0 can be written. Host mode Same of VTRX behaviour but for USB OUT and SETUP transactions.
146pub type VTTX_R = crate::BitReader<VTTXW>;
147impl VTTX_R {
148    ///Get enumerated values variant
149    #[inline(always)]
150    pub const fn variant(&self) -> Option<VTTXW> {
151        match self.bits {
152            false => Some(VTTXW::Clear),
153            _ => None,
154        }
155    }
156    ///Clear flag
157    #[inline(always)]
158    pub fn is_clear(&self) -> bool {
159        *self == VTTXW::Clear
160    }
161}
162///Field `VTTX` writer - Valid USB transaction transmitted Device mode This bit is set by the hardware when an IN transaction is successfully completed on this endpoint; the software can only clear this bit. If the CTRM bit in the USB_CNTR register is set accordingly, a generic interrupt condition is generated together with the endpoint related interrupt condition, which is always activated. A transaction ended with a NAK or STALL handshake does not set this bit, since no data is actually transferred, as in the case of protocol errors or data toggle mismatches. This bit is read/write but only '0 can be written. Host mode Same of VTRX behaviour but for USB OUT and SETUP transactions.
163pub type VTTX_W<'a, REG> = crate::BitWriter0C<'a, REG, VTTXW>;
164impl<'a, REG> VTTX_W<'a, REG>
165where
166    REG: crate::Writable + crate::RegisterSpec,
167{
168    ///Clear flag
169    #[inline(always)]
170    pub fn clear(self) -> &'a mut crate::W<REG> {
171        self.variant(VTTXW::Clear)
172    }
173}
174///Field `EPKIND` reader - endpoint/channel kind The meaning of this bit depends on the endpoint/channel type configured by the EP_TYPE bits. summarizes the different meanings. DBL_BUF: This bit is set by the software to enable the double-buffering feature for this bulk endpoint. The usage of double-buffered bulk endpoints is explained in Double-buffered endpoints. STATUS_OUT: This bit is set by the software to indicate that a status out transaction is expected: in this case all OUT transactions containing more than zero data bytes are answered 'STALL' instead of 'ACK'. This bit may be used to improve the robustness of the application to protocol errors during control transfers and its usage is intended for control endpoints only. When STATUS_OUT is reset, OUT transactions can have any number of bytes, as required.
175pub type EPKIND_R = crate::BitReader;
176///Field `EPKIND` writer - endpoint/channel kind The meaning of this bit depends on the endpoint/channel type configured by the EP_TYPE bits. summarizes the different meanings. DBL_BUF: This bit is set by the software to enable the double-buffering feature for this bulk endpoint. The usage of double-buffered bulk endpoints is explained in Double-buffered endpoints. STATUS_OUT: This bit is set by the software to indicate that a status out transaction is expected: in this case all OUT transactions containing more than zero data bytes are answered 'STALL' instead of 'ACK'. This bit may be used to improve the robustness of the application to protocol errors during control transfers and its usage is intended for control endpoints only. When STATUS_OUT is reset, OUT transactions can have any number of bytes, as required.
177pub type EPKIND_W<'a, REG> = crate::BitWriter<'a, REG>;
178/**USB type of transaction These bits configure the behavior of this endpoint/channel as described in endpoint/channel type encoding on page2001. Channel0/Endpoint0 must always be a control endpoint/channel and each USB function must have at least one control endpoint/channel which has address 0, but there may be other control channels/endpoints if required. Only control channels/endpoints handle SETUP transactions, which are ignored by endpoints of other kinds. SETUP transactions cannot be answered with NAK or STALL. If a control endpoint/channel is defined as NAK, the USB peripheral will not answer, simulating a receive error, in the receive direction when a SETUP transaction is received. If the control endpoint/channel is defined as STALL in the receive direction, then the SETUP packet will be accepted anyway, transferring data and issuing the CTR interrupt. The reception of OUT transactions is handled in the normal way, even if the endpoint/channel is a control one. Bulk and interrupt endpoints have very similar behavior and they differ only in the special feature available using the EPKIND configuration bit. The usage of Isochronous channels/endpoints is explained in transfers
179
180Value on reset: 0*/
181#[cfg_attr(feature = "defmt", derive(defmt::Format))]
182#[derive(Clone, Copy, Debug, PartialEq, Eq)]
183#[repr(u8)]
184pub enum UTYPE {
185    ///0: Bulk endpoint
186    Bulk = 0,
187    ///1: Control endpoint
188    Control = 1,
189    ///2: Isochronous endpoint
190    Iso = 2,
191    ///3: Interrupt endpoint
192    Interrupt = 3,
193}
194impl From<UTYPE> for u8 {
195    #[inline(always)]
196    fn from(variant: UTYPE) -> Self {
197        variant as _
198    }
199}
200impl crate::FieldSpec for UTYPE {
201    type Ux = u8;
202}
203impl crate::IsEnum for UTYPE {}
204///Field `UTYPE` reader - USB type of transaction These bits configure the behavior of this endpoint/channel as described in endpoint/channel type encoding on page2001. Channel0/Endpoint0 must always be a control endpoint/channel and each USB function must have at least one control endpoint/channel which has address 0, but there may be other control channels/endpoints if required. Only control channels/endpoints handle SETUP transactions, which are ignored by endpoints of other kinds. SETUP transactions cannot be answered with NAK or STALL. If a control endpoint/channel is defined as NAK, the USB peripheral will not answer, simulating a receive error, in the receive direction when a SETUP transaction is received. If the control endpoint/channel is defined as STALL in the receive direction, then the SETUP packet will be accepted anyway, transferring data and issuing the CTR interrupt. The reception of OUT transactions is handled in the normal way, even if the endpoint/channel is a control one. Bulk and interrupt endpoints have very similar behavior and they differ only in the special feature available using the EPKIND configuration bit. The usage of Isochronous channels/endpoints is explained in transfers
205pub type UTYPE_R = crate::FieldReader<UTYPE>;
206impl UTYPE_R {
207    ///Get enumerated values variant
208    #[inline(always)]
209    pub const fn variant(&self) -> UTYPE {
210        match self.bits {
211            0 => UTYPE::Bulk,
212            1 => UTYPE::Control,
213            2 => UTYPE::Iso,
214            3 => UTYPE::Interrupt,
215            _ => unreachable!(),
216        }
217    }
218    ///Bulk endpoint
219    #[inline(always)]
220    pub fn is_bulk(&self) -> bool {
221        *self == UTYPE::Bulk
222    }
223    ///Control endpoint
224    #[inline(always)]
225    pub fn is_control(&self) -> bool {
226        *self == UTYPE::Control
227    }
228    ///Isochronous endpoint
229    #[inline(always)]
230    pub fn is_iso(&self) -> bool {
231        *self == UTYPE::Iso
232    }
233    ///Interrupt endpoint
234    #[inline(always)]
235    pub fn is_interrupt(&self) -> bool {
236        *self == UTYPE::Interrupt
237    }
238}
239///Field `UTYPE` writer - USB type of transaction These bits configure the behavior of this endpoint/channel as described in endpoint/channel type encoding on page2001. Channel0/Endpoint0 must always be a control endpoint/channel and each USB function must have at least one control endpoint/channel which has address 0, but there may be other control channels/endpoints if required. Only control channels/endpoints handle SETUP transactions, which are ignored by endpoints of other kinds. SETUP transactions cannot be answered with NAK or STALL. If a control endpoint/channel is defined as NAK, the USB peripheral will not answer, simulating a receive error, in the receive direction when a SETUP transaction is received. If the control endpoint/channel is defined as STALL in the receive direction, then the SETUP packet will be accepted anyway, transferring data and issuing the CTR interrupt. The reception of OUT transactions is handled in the normal way, even if the endpoint/channel is a control one. Bulk and interrupt endpoints have very similar behavior and they differ only in the special feature available using the EPKIND configuration bit. The usage of Isochronous channels/endpoints is explained in transfers
240pub type UTYPE_W<'a, REG> = crate::FieldWriter<'a, REG, 2, UTYPE, crate::Safe>;
241impl<'a, REG> UTYPE_W<'a, REG>
242where
243    REG: crate::Writable + crate::RegisterSpec,
244    REG::Ux: From<u8>,
245{
246    ///Bulk endpoint
247    #[inline(always)]
248    pub fn bulk(self) -> &'a mut crate::W<REG> {
249        self.variant(UTYPE::Bulk)
250    }
251    ///Control endpoint
252    #[inline(always)]
253    pub fn control(self) -> &'a mut crate::W<REG> {
254        self.variant(UTYPE::Control)
255    }
256    ///Isochronous endpoint
257    #[inline(always)]
258    pub fn iso(self) -> &'a mut crate::W<REG> {
259        self.variant(UTYPE::Iso)
260    }
261    ///Interrupt endpoint
262    #[inline(always)]
263    pub fn interrupt(self) -> &'a mut crate::W<REG> {
264        self.variant(UTYPE::Interrupt)
265    }
266}
267///Field `SETUP` reader - Setup transaction completed Device mode This bit is read-only and it is set by the hardware when the last completed transaction is a SETUP. This bit changes its value only for control endpoints. It must be examined, in the case of a successful receive transaction (VTRX event), to determine the type of transaction occurred. To protect the interrupt service routine from the changes in SETUP bits due to next incoming tokens, this bit is kept frozen while VTRX bit is at 1; its state changes when VTRX is at 0. This bit is read-only. Host mode This bit is set by the software to send a SETUP transaction on a control endpoint. This bit changes its value only for control endpoints. It is cleared by hardware when the SETUP transaction is acknowledged and VTTX interrupt generated.
268pub type SETUP_R = crate::BitReader;
269/**Status bits, for reception transfers Device mode These bits contain information about the endpoint status, which are listed in Reception status encoding on page2000.These bits can be toggled by software to initialize their value. When the application software writes '0, the value remains unchanged, while writing '1 makes the bit value toggle. Hardware sets the STRX bits to NAK when a correct transfer has occurred (VTRX=1) corresponding to a OUT or SETUP (control only) transaction addressed to this endpoint, so the software has the time to elaborate the received data before it acknowledge a new transaction Double-buffered bulk endpoints implement a special transaction flow control, which control the status based upon buffer availability condition (Refer to endpoints). If the endpoint is defined as Isochronous, its status can be only 'VALID' or 'DISABLED', so that the hardware cannot change the status of the endpoint after a successful transaction. If the software sets the STRX bits to 'STALL' or 'NAK' for an Isochronous endpoint, the USB peripheral behavior is not defined. These bits are read/write but they can be only toggled by writing '1. Host mode These bits are the host application controls to start, retry, or abort host transactions driven by the channel. These bits also contain information about the device answer to the last IN channel transaction and report the current status of the channel according to the following STRX table of states: - DISABLE DISABLE value is reported in case of ACK acknowledge is received on a single-buffer channel. When in DISABLE state the channel is unused or not active waiting for application to restart it by writing VALID. Application can reset a VALID channel to DISABLE to abort a transaction. In this case the transaction is immediately removed from the Host execution list. If the aborted transaction was already under execution it will be regularly terminated on the USB but the relative VTRX interrupt is not generated. - VALID An Host channel is actively trying to submit USB transaction to device only when in VALID state.VALID state can be set by software or automatically by hardware on a NAKED channel at the start of a new frame. When set to VALID, an host channel enters the host execution queue and waits permission from the Host Frame Schedure to submit its configured transaction. VALID value is also reported in case of ACK acknowledge is received on a double-buffered channel. In this case the channel remains active on the alternate buffer while application needs to read the current buffer and toggle DTOGTX. In case software is late in reading and the alternate buffer is not ready, the host channel is automatically suspended transparently to the application. The suspended double buffered channel will be re-activated as soon as delay is recovered and DTOGTX is toggled. - NAK NAK value is reported in case of NAK acknowledge received. When in NAK state the channel is suspended and does not try to transmit. NAK state is moved to VALID by hardware at the start of the next frame, or software can change it to immediately retry transmission by writing it to VALID, or can disable it and abort the transaction by writing DISABLE - STALL STALL value is reported in case of STALL acknowledge received. When in STALL state the channel behaves as disabled. Application should not retry transmission but reset the USB and re-enumerate.
270
271Value on reset: 0*/
272#[cfg_attr(feature = "defmt", derive(defmt::Format))]
273#[derive(Clone, Copy, Debug, PartialEq, Eq)]
274#[repr(u8)]
275pub enum STATRXR {
276    ///0: All reception requests addressed to this endpoint/channel are ignored.
277    Disabled = 0,
278    ///1: Device mode: the endpoint is stalled and all reception requests result in a STALL handshake. Host mode: this indicates that the device has STALLed the channel.
279    Stall = 1,
280    ///2: Device mode: the endpoint is NAKed and all reception requests result in a NAK handshake. Host mode: this indicates that the device has NAKed the reception request.
281    Nak = 2,
282    ///3: This endpoint/channel is enabled for reception.
283    Valid = 3,
284}
285impl From<STATRXR> for u8 {
286    #[inline(always)]
287    fn from(variant: STATRXR) -> Self {
288        variant as _
289    }
290}
291impl crate::FieldSpec for STATRXR {
292    type Ux = u8;
293}
294impl crate::IsEnum for STATRXR {}
295///Field `STATRX` reader - Status bits, for reception transfers Device mode These bits contain information about the endpoint status, which are listed in Reception status encoding on page2000.These bits can be toggled by software to initialize their value. When the application software writes '0, the value remains unchanged, while writing '1 makes the bit value toggle. Hardware sets the STRX bits to NAK when a correct transfer has occurred (VTRX=1) corresponding to a OUT or SETUP (control only) transaction addressed to this endpoint, so the software has the time to elaborate the received data before it acknowledge a new transaction Double-buffered bulk endpoints implement a special transaction flow control, which control the status based upon buffer availability condition (Refer to endpoints). If the endpoint is defined as Isochronous, its status can be only 'VALID' or 'DISABLED', so that the hardware cannot change the status of the endpoint after a successful transaction. If the software sets the STRX bits to 'STALL' or 'NAK' for an Isochronous endpoint, the USB peripheral behavior is not defined. These bits are read/write but they can be only toggled by writing '1. Host mode These bits are the host application controls to start, retry, or abort host transactions driven by the channel. These bits also contain information about the device answer to the last IN channel transaction and report the current status of the channel according to the following STRX table of states: - DISABLE DISABLE value is reported in case of ACK acknowledge is received on a single-buffer channel. When in DISABLE state the channel is unused or not active waiting for application to restart it by writing VALID. Application can reset a VALID channel to DISABLE to abort a transaction. In this case the transaction is immediately removed from the Host execution list. If the aborted transaction was already under execution it will be regularly terminated on the USB but the relative VTRX interrupt is not generated. - VALID An Host channel is actively trying to submit USB transaction to device only when in VALID state.VALID state can be set by software or automatically by hardware on a NAKED channel at the start of a new frame. When set to VALID, an host channel enters the host execution queue and waits permission from the Host Frame Schedure to submit its configured transaction. VALID value is also reported in case of ACK acknowledge is received on a double-buffered channel. In this case the channel remains active on the alternate buffer while application needs to read the current buffer and toggle DTOGTX. In case software is late in reading and the alternate buffer is not ready, the host channel is automatically suspended transparently to the application. The suspended double buffered channel will be re-activated as soon as delay is recovered and DTOGTX is toggled. - NAK NAK value is reported in case of NAK acknowledge received. When in NAK state the channel is suspended and does not try to transmit. NAK state is moved to VALID by hardware at the start of the next frame, or software can change it to immediately retry transmission by writing it to VALID, or can disable it and abort the transaction by writing DISABLE - STALL STALL value is reported in case of STALL acknowledge received. When in STALL state the channel behaves as disabled. Application should not retry transmission but reset the USB and re-enumerate.
296pub type STATRX_R = crate::FieldReader<STATRXR>;
297impl STATRX_R {
298    ///Get enumerated values variant
299    #[inline(always)]
300    pub const fn variant(&self) -> STATRXR {
301        match self.bits {
302            0 => STATRXR::Disabled,
303            1 => STATRXR::Stall,
304            2 => STATRXR::Nak,
305            3 => STATRXR::Valid,
306            _ => unreachable!(),
307        }
308    }
309    ///All reception requests addressed to this endpoint/channel are ignored.
310    #[inline(always)]
311    pub fn is_disabled(&self) -> bool {
312        *self == STATRXR::Disabled
313    }
314    ///Device mode: the endpoint is stalled and all reception requests result in a STALL handshake. Host mode: this indicates that the device has STALLed the channel.
315    #[inline(always)]
316    pub fn is_stall(&self) -> bool {
317        *self == STATRXR::Stall
318    }
319    ///Device mode: the endpoint is NAKed and all reception requests result in a NAK handshake. Host mode: this indicates that the device has NAKed the reception request.
320    #[inline(always)]
321    pub fn is_nak(&self) -> bool {
322        *self == STATRXR::Nak
323    }
324    ///This endpoint/channel is enabled for reception.
325    #[inline(always)]
326    pub fn is_valid(&self) -> bool {
327        *self == STATRXR::Valid
328    }
329}
330/**Status bits, for reception transfers Device mode These bits contain information about the endpoint status, which are listed in Reception status encoding on page2000.These bits can be toggled by software to initialize their value. When the application software writes '0, the value remains unchanged, while writing '1 makes the bit value toggle. Hardware sets the STRX bits to NAK when a correct transfer has occurred (VTRX=1) corresponding to a OUT or SETUP (control only) transaction addressed to this endpoint, so the software has the time to elaborate the received data before it acknowledge a new transaction Double-buffered bulk endpoints implement a special transaction flow control, which control the status based upon buffer availability condition (Refer to endpoints). If the endpoint is defined as Isochronous, its status can be only 'VALID' or 'DISABLED', so that the hardware cannot change the status of the endpoint after a successful transaction. If the software sets the STRX bits to 'STALL' or 'NAK' for an Isochronous endpoint, the USB peripheral behavior is not defined. These bits are read/write but they can be only toggled by writing '1. Host mode These bits are the host application controls to start, retry, or abort host transactions driven by the channel. These bits also contain information about the device answer to the last IN channel transaction and report the current status of the channel according to the following STRX table of states: - DISABLE DISABLE value is reported in case of ACK acknowledge is received on a single-buffer channel. When in DISABLE state the channel is unused or not active waiting for application to restart it by writing VALID. Application can reset a VALID channel to DISABLE to abort a transaction. In this case the transaction is immediately removed from the Host execution list. If the aborted transaction was already under execution it will be regularly terminated on the USB but the relative VTRX interrupt is not generated. - VALID An Host channel is actively trying to submit USB transaction to device only when in VALID state.VALID state can be set by software or automatically by hardware on a NAKED channel at the start of a new frame. When set to VALID, an host channel enters the host execution queue and waits permission from the Host Frame Schedure to submit its configured transaction. VALID value is also reported in case of ACK acknowledge is received on a double-buffered channel. In this case the channel remains active on the alternate buffer while application needs to read the current buffer and toggle DTOGTX. In case software is late in reading and the alternate buffer is not ready, the host channel is automatically suspended transparently to the application. The suspended double buffered channel will be re-activated as soon as delay is recovered and DTOGTX is toggled. - NAK NAK value is reported in case of NAK acknowledge received. When in NAK state the channel is suspended and does not try to transmit. NAK state is moved to VALID by hardware at the start of the next frame, or software can change it to immediately retry transmission by writing it to VALID, or can disable it and abort the transaction by writing DISABLE - STALL STALL value is reported in case of STALL acknowledge received. When in STALL state the channel behaves as disabled. Application should not retry transmission but reset the USB and re-enumerate.
331
332Value on reset: 0*/
333#[cfg_attr(feature = "defmt", derive(defmt::Format))]
334#[derive(Clone, Copy, Debug, PartialEq, Eq)]
335#[repr(u8)]
336pub enum STATRXW {
337    ///0: Do not change bits
338    Keep = 0,
339}
340impl From<STATRXW> for u8 {
341    #[inline(always)]
342    fn from(variant: STATRXW) -> Self {
343        variant as _
344    }
345}
346impl crate::FieldSpec for STATRXW {
347    type Ux = u8;
348}
349impl crate::IsEnum for STATRXW {}
350///Field `STATRX` writer - Status bits, for reception transfers Device mode These bits contain information about the endpoint status, which are listed in Reception status encoding on page2000.These bits can be toggled by software to initialize their value. When the application software writes '0, the value remains unchanged, while writing '1 makes the bit value toggle. Hardware sets the STRX bits to NAK when a correct transfer has occurred (VTRX=1) corresponding to a OUT or SETUP (control only) transaction addressed to this endpoint, so the software has the time to elaborate the received data before it acknowledge a new transaction Double-buffered bulk endpoints implement a special transaction flow control, which control the status based upon buffer availability condition (Refer to endpoints). If the endpoint is defined as Isochronous, its status can be only 'VALID' or 'DISABLED', so that the hardware cannot change the status of the endpoint after a successful transaction. If the software sets the STRX bits to 'STALL' or 'NAK' for an Isochronous endpoint, the USB peripheral behavior is not defined. These bits are read/write but they can be only toggled by writing '1. Host mode These bits are the host application controls to start, retry, or abort host transactions driven by the channel. These bits also contain information about the device answer to the last IN channel transaction and report the current status of the channel according to the following STRX table of states: - DISABLE DISABLE value is reported in case of ACK acknowledge is received on a single-buffer channel. When in DISABLE state the channel is unused or not active waiting for application to restart it by writing VALID. Application can reset a VALID channel to DISABLE to abort a transaction. In this case the transaction is immediately removed from the Host execution list. If the aborted transaction was already under execution it will be regularly terminated on the USB but the relative VTRX interrupt is not generated. - VALID An Host channel is actively trying to submit USB transaction to device only when in VALID state.VALID state can be set by software or automatically by hardware on a NAKED channel at the start of a new frame. When set to VALID, an host channel enters the host execution queue and waits permission from the Host Frame Schedure to submit its configured transaction. VALID value is also reported in case of ACK acknowledge is received on a double-buffered channel. In this case the channel remains active on the alternate buffer while application needs to read the current buffer and toggle DTOGTX. In case software is late in reading and the alternate buffer is not ready, the host channel is automatically suspended transparently to the application. The suspended double buffered channel will be re-activated as soon as delay is recovered and DTOGTX is toggled. - NAK NAK value is reported in case of NAK acknowledge received. When in NAK state the channel is suspended and does not try to transmit. NAK state is moved to VALID by hardware at the start of the next frame, or software can change it to immediately retry transmission by writing it to VALID, or can disable it and abort the transaction by writing DISABLE - STALL STALL value is reported in case of STALL acknowledge received. When in STALL state the channel behaves as disabled. Application should not retry transmission but reset the USB and re-enumerate.
351pub type STATRX_W<'a, REG> = crate::FieldWriter<'a, REG, 2, STATRXW>;
352impl<'a, REG> STATRX_W<'a, REG>
353where
354    REG: crate::Writable + crate::RegisterSpec,
355    REG::Ux: From<u8>,
356{
357    ///Do not change bits
358    #[inline(always)]
359    pub fn keep(self) -> &'a mut crate::W<REG> {
360        self.variant(STATRXW::Keep)
361    }
362}
363/**Data Toggle, for reception transfers If the endpoint/channel is not Isochronous, this bit contains the expected value of the data toggle bit (0=DATA0, 1=DATA1) for the next data packet to be received. Hardware toggles this bit, when the ACK handshake is sent following a data packet reception having a matching data PID value; if the endpoint is defined as a control one, hardware clears this bit at the reception of a SETUP PID received from host (in device) or acknowledged by device (in host). If the endpoint/channel is using the double-buffering feature this bit is used to support packet buffer swapping too (Refer to ). If the endpoint/channel is Isochronous, this bit is used only to support packet buffer swapping for data transmission since no data toggling is used for this kind of channels/endpoints and only DATA0 packet are transmitted (Refer to Isochronous transfers). Hardware toggles this bit just after the end of data packet reception, since no handshake is used for isochronous transfers. This bit can also be toggled by the software to initialize its value (mandatory when the endpoint is not a control one) or to force specific data toggle/packet buffer usage. When the application software writes '0, the value of DTOGRX remains unchanged, while writing '1 makes the bit value toggle. This bit is read/write but it can be only toggled by writing 1.
364
365Value on reset: 0*/
366#[cfg_attr(feature = "defmt", derive(defmt::Format))]
367#[derive(Clone, Copy, Debug, PartialEq, Eq)]
368pub enum DTOGRXW {
369    ///1: Flip bit
370    Toggle = 1,
371}
372impl From<DTOGRXW> for bool {
373    #[inline(always)]
374    fn from(variant: DTOGRXW) -> Self {
375        variant as u8 != 0
376    }
377}
378///Field `DTOGRX` writer - Data Toggle, for reception transfers If the endpoint/channel is not Isochronous, this bit contains the expected value of the data toggle bit (0=DATA0, 1=DATA1) for the next data packet to be received. Hardware toggles this bit, when the ACK handshake is sent following a data packet reception having a matching data PID value; if the endpoint is defined as a control one, hardware clears this bit at the reception of a SETUP PID received from host (in device) or acknowledged by device (in host). If the endpoint/channel is using the double-buffering feature this bit is used to support packet buffer swapping too (Refer to ). If the endpoint/channel is Isochronous, this bit is used only to support packet buffer swapping for data transmission since no data toggling is used for this kind of channels/endpoints and only DATA0 packet are transmitted (Refer to Isochronous transfers). Hardware toggles this bit just after the end of data packet reception, since no handshake is used for isochronous transfers. This bit can also be toggled by the software to initialize its value (mandatory when the endpoint is not a control one) or to force specific data toggle/packet buffer usage. When the application software writes '0, the value of DTOGRX remains unchanged, while writing '1 makes the bit value toggle. This bit is read/write but it can be only toggled by writing 1.
379pub type DTOGRX_W<'a, REG> = crate::BitWriter1T<'a, REG, DTOGRXW>;
380impl<'a, REG> DTOGRX_W<'a, REG>
381where
382    REG: crate::Writable + crate::RegisterSpec,
383{
384    ///Flip bit
385    #[inline(always)]
386    pub fn toggle(self) -> &'a mut crate::W<REG> {
387        self.variant(DTOGRXW::Toggle)
388    }
389}
390/**USB valid transaction received Device mode This bit is set by the hardware when an OUT/SETUP transaction is successfully completed on this endpoint; the software can only clear this bit. If the CTRM bit in USB_CNTR register is set accordingly, a generic interrupt condition is generated together with the endpoint related interrupt condition, which is always activated. The type of occurred transaction, OUT or SETUP, can be determined from the SETUP bit described below. A transaction ended with a NAK or STALL handshake does not set this bit, since no data is actually transferred, as in the case of protocol errors or data toggle mismatches. This bit is read/write but only '0 can be written, writing 1 has no effect. Host mode This bit is set by the hardware when an IN transaction is successfully completed on this channel. The software can only clear this bit. If the VTRM bit in USB_CNTR register is set a generic interrupt condition is generated together with the channel related flag, which is always activated. - A transaction ended with a NAK sets this bit and NAK answer is reported to application reading the NAK state from the STRX field of this register. One naked transaction keeps pending and is automatically retried by the Host at the next frame, or the Host can immediately retry by resetting STRX state to VALID. - A transaction ended by STALL handshake sets this bit and the STALL answer is reported to application reading the STALL state from the STRX field of this register. Host application should consequently disable the channel and re-enumerate. - A transaction ended with ACK handshake sets this bit If double buffering is disabled, ACK answer is reported by application reading the DISABLE state from the STRX field of this register. Host application should read received data from USBRAM and re-arm the channel by writing VALID to the STRX field of this register. If double buffering is enabled, ACK answer is reported by application reading VALID state from the STRX field of this register. Host application should read received data from USBRAM and toggle the DTOGTX bit of this register. This bit is read/write but only '0 can be written, writing 1 has no effect.
391
392Value on reset: 0*/
393#[cfg_attr(feature = "defmt", derive(defmt::Format))]
394#[derive(Clone, Copy, Debug, PartialEq, Eq)]
395pub enum VTRXW {
396    ///0: Clear flag
397    Clear = 0,
398}
399impl From<VTRXW> for bool {
400    #[inline(always)]
401    fn from(variant: VTRXW) -> Self {
402        variant as u8 != 0
403    }
404}
405///Field `VTRX` reader - USB valid transaction received Device mode This bit is set by the hardware when an OUT/SETUP transaction is successfully completed on this endpoint; the software can only clear this bit. If the CTRM bit in USB_CNTR register is set accordingly, a generic interrupt condition is generated together with the endpoint related interrupt condition, which is always activated. The type of occurred transaction, OUT or SETUP, can be determined from the SETUP bit described below. A transaction ended with a NAK or STALL handshake does not set this bit, since no data is actually transferred, as in the case of protocol errors or data toggle mismatches. This bit is read/write but only '0 can be written, writing 1 has no effect. Host mode This bit is set by the hardware when an IN transaction is successfully completed on this channel. The software can only clear this bit. If the VTRM bit in USB_CNTR register is set a generic interrupt condition is generated together with the channel related flag, which is always activated. - A transaction ended with a NAK sets this bit and NAK answer is reported to application reading the NAK state from the STRX field of this register. One naked transaction keeps pending and is automatically retried by the Host at the next frame, or the Host can immediately retry by resetting STRX state to VALID. - A transaction ended by STALL handshake sets this bit and the STALL answer is reported to application reading the STALL state from the STRX field of this register. Host application should consequently disable the channel and re-enumerate. - A transaction ended with ACK handshake sets this bit If double buffering is disabled, ACK answer is reported by application reading the DISABLE state from the STRX field of this register. Host application should read received data from USBRAM and re-arm the channel by writing VALID to the STRX field of this register. If double buffering is enabled, ACK answer is reported by application reading VALID state from the STRX field of this register. Host application should read received data from USBRAM and toggle the DTOGTX bit of this register. This bit is read/write but only '0 can be written, writing 1 has no effect.
406pub type VTRX_R = crate::BitReader<VTRXW>;
407impl VTRX_R {
408    ///Get enumerated values variant
409    #[inline(always)]
410    pub const fn variant(&self) -> Option<VTRXW> {
411        match self.bits {
412            false => Some(VTRXW::Clear),
413            _ => None,
414        }
415    }
416    ///Clear flag
417    #[inline(always)]
418    pub fn is_clear(&self) -> bool {
419        *self == VTRXW::Clear
420    }
421}
422///Field `VTRX` writer - USB valid transaction received Device mode This bit is set by the hardware when an OUT/SETUP transaction is successfully completed on this endpoint; the software can only clear this bit. If the CTRM bit in USB_CNTR register is set accordingly, a generic interrupt condition is generated together with the endpoint related interrupt condition, which is always activated. The type of occurred transaction, OUT or SETUP, can be determined from the SETUP bit described below. A transaction ended with a NAK or STALL handshake does not set this bit, since no data is actually transferred, as in the case of protocol errors or data toggle mismatches. This bit is read/write but only '0 can be written, writing 1 has no effect. Host mode This bit is set by the hardware when an IN transaction is successfully completed on this channel. The software can only clear this bit. If the VTRM bit in USB_CNTR register is set a generic interrupt condition is generated together with the channel related flag, which is always activated. - A transaction ended with a NAK sets this bit and NAK answer is reported to application reading the NAK state from the STRX field of this register. One naked transaction keeps pending and is automatically retried by the Host at the next frame, or the Host can immediately retry by resetting STRX state to VALID. - A transaction ended by STALL handshake sets this bit and the STALL answer is reported to application reading the STALL state from the STRX field of this register. Host application should consequently disable the channel and re-enumerate. - A transaction ended with ACK handshake sets this bit If double buffering is disabled, ACK answer is reported by application reading the DISABLE state from the STRX field of this register. Host application should read received data from USBRAM and re-arm the channel by writing VALID to the STRX field of this register. If double buffering is enabled, ACK answer is reported by application reading VALID state from the STRX field of this register. Host application should read received data from USBRAM and toggle the DTOGTX bit of this register. This bit is read/write but only '0 can be written, writing 1 has no effect.
423pub type VTRX_W<'a, REG> = crate::BitWriter0C<'a, REG, VTRXW>;
424impl<'a, REG> VTRX_W<'a, REG>
425where
426    REG: crate::Writable + crate::RegisterSpec,
427{
428    ///Clear flag
429    #[inline(always)]
430    pub fn clear(self) -> &'a mut crate::W<REG> {
431        self.variant(VTRXW::Clear)
432    }
433}
434///Field `DEVADDR` reader - Host mode Device address assigned to the endpoint during the enumeration process.
435pub type DEVADDR_R = crate::FieldReader;
436///Field `DEVADDR` writer - Host mode Device address assigned to the endpoint during the enumeration process.
437pub type DEVADDR_W<'a, REG> = crate::FieldWriter<'a, REG, 7>;
438/**Host mode This bit is set by the hardware when a device responds with a NAK. Software can be use this bit to monitoring the number of NAKs received from a device.
439
440Value on reset: 0*/
441#[cfg_attr(feature = "defmt", derive(defmt::Format))]
442#[derive(Clone, Copy, Debug, PartialEq, Eq)]
443pub enum NAKW {
444    ///0: Clear flag
445    Clear = 0,
446}
447impl From<NAKW> for bool {
448    #[inline(always)]
449    fn from(variant: NAKW) -> Self {
450        variant as u8 != 0
451    }
452}
453///Field `NAK` reader - Host mode This bit is set by the hardware when a device responds with a NAK. Software can be use this bit to monitoring the number of NAKs received from a device.
454pub type NAK_R = crate::BitReader<NAKW>;
455impl NAK_R {
456    ///Get enumerated values variant
457    #[inline(always)]
458    pub const fn variant(&self) -> Option<NAKW> {
459        match self.bits {
460            false => Some(NAKW::Clear),
461            _ => None,
462        }
463    }
464    ///Clear flag
465    #[inline(always)]
466    pub fn is_clear(&self) -> bool {
467        *self == NAKW::Clear
468    }
469}
470///Field `NAK` writer - Host mode This bit is set by the hardware when a device responds with a NAK. Software can be use this bit to monitoring the number of NAKs received from a device.
471pub type NAK_W<'a, REG> = crate::BitWriter0C<'a, REG, NAKW>;
472impl<'a, REG> NAK_W<'a, REG>
473where
474    REG: crate::Writable + crate::RegisterSpec,
475{
476    ///Clear flag
477    #[inline(always)]
478    pub fn clear(self) -> &'a mut crate::W<REG> {
479        self.variant(NAKW::Clear)
480    }
481}
482///Field `LS_EP` reader - Low speed endpoint
483pub type LS_EP_R = crate::BitReader;
484///Field `LS_EP` writer - Low speed endpoint
485pub type LS_EP_W<'a, REG> = crate::BitWriter<'a, REG>;
486/**Transmit error Host mode This bit is set by the hardware when an error (e.g. no answer by the device, CRC error, bit stuffing error, framing format violation, etc.) has occurred during an OUT or SETUP transaction on this channel. The software can only clear this bit. If the ERRM bit in USB_CNTR register is set a generic interrupt condition is generated together with the channel related flag, which is always activated.
487
488Value on reset: 0*/
489#[cfg_attr(feature = "defmt", derive(defmt::Format))]
490#[derive(Clone, Copy, Debug, PartialEq, Eq)]
491pub enum ERR_TXW {
492    ///0: Clear flag
493    Clear = 0,
494}
495impl From<ERR_TXW> for bool {
496    #[inline(always)]
497    fn from(variant: ERR_TXW) -> Self {
498        variant as u8 != 0
499    }
500}
501///Field `ERR_TX` reader - Transmit error Host mode This bit is set by the hardware when an error (e.g. no answer by the device, CRC error, bit stuffing error, framing format violation, etc.) has occurred during an OUT or SETUP transaction on this channel. The software can only clear this bit. If the ERRM bit in USB_CNTR register is set a generic interrupt condition is generated together with the channel related flag, which is always activated.
502pub type ERR_TX_R = crate::BitReader<ERR_TXW>;
503impl ERR_TX_R {
504    ///Get enumerated values variant
505    #[inline(always)]
506    pub const fn variant(&self) -> Option<ERR_TXW> {
507        match self.bits {
508            false => Some(ERR_TXW::Clear),
509            _ => None,
510        }
511    }
512    ///Clear flag
513    #[inline(always)]
514    pub fn is_clear(&self) -> bool {
515        *self == ERR_TXW::Clear
516    }
517}
518///Field `ERR_TX` writer - Transmit error Host mode This bit is set by the hardware when an error (e.g. no answer by the device, CRC error, bit stuffing error, framing format violation, etc.) has occurred during an OUT or SETUP transaction on this channel. The software can only clear this bit. If the ERRM bit in USB_CNTR register is set a generic interrupt condition is generated together with the channel related flag, which is always activated.
519pub type ERR_TX_W<'a, REG> = crate::BitWriter0C<'a, REG, ERR_TXW>;
520impl<'a, REG> ERR_TX_W<'a, REG>
521where
522    REG: crate::Writable + crate::RegisterSpec,
523{
524    ///Clear flag
525    #[inline(always)]
526    pub fn clear(self) -> &'a mut crate::W<REG> {
527        self.variant(ERR_TXW::Clear)
528    }
529}
530/**Receive error Host mode This bit is set by the hardware when an error (e.g. no answer by the device, CRC error, bit stuffing error, framing format violation, etc.) has occurred during an IN transaction on this channel. The software can only clear this bit. If the ERRM bit in USB_CNTR register is set a generic interrupt condition is generated together with the channel related flag, which is always activated.
531
532Value on reset: 0*/
533#[cfg_attr(feature = "defmt", derive(defmt::Format))]
534#[derive(Clone, Copy, Debug, PartialEq, Eq)]
535pub enum ERR_RXW {
536    ///0: Clear flag
537    Clear = 0,
538}
539impl From<ERR_RXW> for bool {
540    #[inline(always)]
541    fn from(variant: ERR_RXW) -> Self {
542        variant as u8 != 0
543    }
544}
545///Field `ERR_RX` reader - Receive error Host mode This bit is set by the hardware when an error (e.g. no answer by the device, CRC error, bit stuffing error, framing format violation, etc.) has occurred during an IN transaction on this channel. The software can only clear this bit. If the ERRM bit in USB_CNTR register is set a generic interrupt condition is generated together with the channel related flag, which is always activated.
546pub type ERR_RX_R = crate::BitReader<ERR_RXW>;
547impl ERR_RX_R {
548    ///Get enumerated values variant
549    #[inline(always)]
550    pub const fn variant(&self) -> Option<ERR_RXW> {
551        match self.bits {
552            false => Some(ERR_RXW::Clear),
553            _ => None,
554        }
555    }
556    ///Clear flag
557    #[inline(always)]
558    pub fn is_clear(&self) -> bool {
559        *self == ERR_RXW::Clear
560    }
561}
562///Field `ERR_RX` writer - Receive error Host mode This bit is set by the hardware when an error (e.g. no answer by the device, CRC error, bit stuffing error, framing format violation, etc.) has occurred during an IN transaction on this channel. The software can only clear this bit. If the ERRM bit in USB_CNTR register is set a generic interrupt condition is generated together with the channel related flag, which is always activated.
563pub type ERR_RX_W<'a, REG> = crate::BitWriter0C<'a, REG, ERR_RXW>;
564impl<'a, REG> ERR_RX_W<'a, REG>
565where
566    REG: crate::Writable + crate::RegisterSpec,
567{
568    ///Clear flag
569    #[inline(always)]
570    pub fn clear(self) -> &'a mut crate::W<REG> {
571        self.variant(ERR_RXW::Clear)
572    }
573}
574impl R {
575    ///Bits 0:3 - endpoint/channel address Device mode Software must write in this field the 4-bit address used to identify the transactions directed to this endpoint. A value must be written before enabling the corresponding endpoint. Host mode Software must write in this field the 4-bit address used to identify the channel addressed by the host transaction.
576    #[inline(always)]
577    pub fn ea(&self) -> EA_R {
578        EA_R::new((self.bits & 0x0f) as u8)
579    }
580    ///Bits 4:5 - Status bits, for transmission transfers Device mode These bits contain the information about the endpoint status, listed in . These bits can be toggled by the software to initialize their value. When the application software writes '0, the value remains unchanged, while writing '1 makes the bit value toggle. Hardware sets the STTX bits to NAK, when a correct transfer has occurred (VTTX=1) corresponding to a IN or SETUP (control only) transaction addressed to this channel/endpoint. It then waits for the software to prepare the next set of data to be transmitted. Double-buffered bulk endpoints implement a special transaction flow control, which controls the status based on buffer availability condition (Refer to endpoints). If the endpoint is defined as Isochronous, its status can only be 'VALID' or 'DISABLED'. Therefore, the hardware cannot change the status of the channel/endpoint/channel after a successful transaction. If the software sets the STTX bits to 'STALL' or 'NAK' for an Isochronous channel/endpoint, the USB peripheral behavior is not defined. These bits are read/write but they can be only toggled by writing '1. Host mode Same as STRX behaviour but for IN transactions (TBC)
581    #[inline(always)]
582    pub fn stattx(&self) -> STATTX_R {
583        STATTX_R::new(((self.bits >> 4) & 3) as u8)
584    }
585    ///Bit 7 - Valid USB transaction transmitted Device mode This bit is set by the hardware when an IN transaction is successfully completed on this endpoint; the software can only clear this bit. If the CTRM bit in the USB_CNTR register is set accordingly, a generic interrupt condition is generated together with the endpoint related interrupt condition, which is always activated. A transaction ended with a NAK or STALL handshake does not set this bit, since no data is actually transferred, as in the case of protocol errors or data toggle mismatches. This bit is read/write but only '0 can be written. Host mode Same of VTRX behaviour but for USB OUT and SETUP transactions.
586    #[inline(always)]
587    pub fn vttx(&self) -> VTTX_R {
588        VTTX_R::new(((self.bits >> 7) & 1) != 0)
589    }
590    ///Bit 8 - endpoint/channel kind The meaning of this bit depends on the endpoint/channel type configured by the EP_TYPE bits. summarizes the different meanings. DBL_BUF: This bit is set by the software to enable the double-buffering feature for this bulk endpoint. The usage of double-buffered bulk endpoints is explained in Double-buffered endpoints. STATUS_OUT: This bit is set by the software to indicate that a status out transaction is expected: in this case all OUT transactions containing more than zero data bytes are answered 'STALL' instead of 'ACK'. This bit may be used to improve the robustness of the application to protocol errors during control transfers and its usage is intended for control endpoints only. When STATUS_OUT is reset, OUT transactions can have any number of bytes, as required.
591    #[inline(always)]
592    pub fn epkind(&self) -> EPKIND_R {
593        EPKIND_R::new(((self.bits >> 8) & 1) != 0)
594    }
595    ///Bits 9:10 - USB type of transaction These bits configure the behavior of this endpoint/channel as described in endpoint/channel type encoding on page2001. Channel0/Endpoint0 must always be a control endpoint/channel and each USB function must have at least one control endpoint/channel which has address 0, but there may be other control channels/endpoints if required. Only control channels/endpoints handle SETUP transactions, which are ignored by endpoints of other kinds. SETUP transactions cannot be answered with NAK or STALL. If a control endpoint/channel is defined as NAK, the USB peripheral will not answer, simulating a receive error, in the receive direction when a SETUP transaction is received. If the control endpoint/channel is defined as STALL in the receive direction, then the SETUP packet will be accepted anyway, transferring data and issuing the CTR interrupt. The reception of OUT transactions is handled in the normal way, even if the endpoint/channel is a control one. Bulk and interrupt endpoints have very similar behavior and they differ only in the special feature available using the EPKIND configuration bit. The usage of Isochronous channels/endpoints is explained in transfers
596    #[inline(always)]
597    pub fn utype(&self) -> UTYPE_R {
598        UTYPE_R::new(((self.bits >> 9) & 3) as u8)
599    }
600    ///Bit 11 - Setup transaction completed Device mode This bit is read-only and it is set by the hardware when the last completed transaction is a SETUP. This bit changes its value only for control endpoints. It must be examined, in the case of a successful receive transaction (VTRX event), to determine the type of transaction occurred. To protect the interrupt service routine from the changes in SETUP bits due to next incoming tokens, this bit is kept frozen while VTRX bit is at 1; its state changes when VTRX is at 0. This bit is read-only. Host mode This bit is set by the software to send a SETUP transaction on a control endpoint. This bit changes its value only for control endpoints. It is cleared by hardware when the SETUP transaction is acknowledged and VTTX interrupt generated.
601    #[inline(always)]
602    pub fn setup(&self) -> SETUP_R {
603        SETUP_R::new(((self.bits >> 11) & 1) != 0)
604    }
605    ///Bits 12:13 - Status bits, for reception transfers Device mode These bits contain information about the endpoint status, which are listed in Reception status encoding on page2000.These bits can be toggled by software to initialize their value. When the application software writes '0, the value remains unchanged, while writing '1 makes the bit value toggle. Hardware sets the STRX bits to NAK when a correct transfer has occurred (VTRX=1) corresponding to a OUT or SETUP (control only) transaction addressed to this endpoint, so the software has the time to elaborate the received data before it acknowledge a new transaction Double-buffered bulk endpoints implement a special transaction flow control, which control the status based upon buffer availability condition (Refer to endpoints). If the endpoint is defined as Isochronous, its status can be only 'VALID' or 'DISABLED', so that the hardware cannot change the status of the endpoint after a successful transaction. If the software sets the STRX bits to 'STALL' or 'NAK' for an Isochronous endpoint, the USB peripheral behavior is not defined. These bits are read/write but they can be only toggled by writing '1. Host mode These bits are the host application controls to start, retry, or abort host transactions driven by the channel. These bits also contain information about the device answer to the last IN channel transaction and report the current status of the channel according to the following STRX table of states: - DISABLE DISABLE value is reported in case of ACK acknowledge is received on a single-buffer channel. When in DISABLE state the channel is unused or not active waiting for application to restart it by writing VALID. Application can reset a VALID channel to DISABLE to abort a transaction. In this case the transaction is immediately removed from the Host execution list. If the aborted transaction was already under execution it will be regularly terminated on the USB but the relative VTRX interrupt is not generated. - VALID An Host channel is actively trying to submit USB transaction to device only when in VALID state.VALID state can be set by software or automatically by hardware on a NAKED channel at the start of a new frame. When set to VALID, an host channel enters the host execution queue and waits permission from the Host Frame Schedure to submit its configured transaction. VALID value is also reported in case of ACK acknowledge is received on a double-buffered channel. In this case the channel remains active on the alternate buffer while application needs to read the current buffer and toggle DTOGTX. In case software is late in reading and the alternate buffer is not ready, the host channel is automatically suspended transparently to the application. The suspended double buffered channel will be re-activated as soon as delay is recovered and DTOGTX is toggled. - NAK NAK value is reported in case of NAK acknowledge received. When in NAK state the channel is suspended and does not try to transmit. NAK state is moved to VALID by hardware at the start of the next frame, or software can change it to immediately retry transmission by writing it to VALID, or can disable it and abort the transaction by writing DISABLE - STALL STALL value is reported in case of STALL acknowledge received. When in STALL state the channel behaves as disabled. Application should not retry transmission but reset the USB and re-enumerate.
606    #[inline(always)]
607    pub fn statrx(&self) -> STATRX_R {
608        STATRX_R::new(((self.bits >> 12) & 3) as u8)
609    }
610    ///Bit 15 - USB valid transaction received Device mode This bit is set by the hardware when an OUT/SETUP transaction is successfully completed on this endpoint; the software can only clear this bit. If the CTRM bit in USB_CNTR register is set accordingly, a generic interrupt condition is generated together with the endpoint related interrupt condition, which is always activated. The type of occurred transaction, OUT or SETUP, can be determined from the SETUP bit described below. A transaction ended with a NAK or STALL handshake does not set this bit, since no data is actually transferred, as in the case of protocol errors or data toggle mismatches. This bit is read/write but only '0 can be written, writing 1 has no effect. Host mode This bit is set by the hardware when an IN transaction is successfully completed on this channel. The software can only clear this bit. If the VTRM bit in USB_CNTR register is set a generic interrupt condition is generated together with the channel related flag, which is always activated. - A transaction ended with a NAK sets this bit and NAK answer is reported to application reading the NAK state from the STRX field of this register. One naked transaction keeps pending and is automatically retried by the Host at the next frame, or the Host can immediately retry by resetting STRX state to VALID. - A transaction ended by STALL handshake sets this bit and the STALL answer is reported to application reading the STALL state from the STRX field of this register. Host application should consequently disable the channel and re-enumerate. - A transaction ended with ACK handshake sets this bit If double buffering is disabled, ACK answer is reported by application reading the DISABLE state from the STRX field of this register. Host application should read received data from USBRAM and re-arm the channel by writing VALID to the STRX field of this register. If double buffering is enabled, ACK answer is reported by application reading VALID state from the STRX field of this register. Host application should read received data from USBRAM and toggle the DTOGTX bit of this register. This bit is read/write but only '0 can be written, writing 1 has no effect.
611    #[inline(always)]
612    pub fn vtrx(&self) -> VTRX_R {
613        VTRX_R::new(((self.bits >> 15) & 1) != 0)
614    }
615    ///Bits 16:22 - Host mode Device address assigned to the endpoint during the enumeration process.
616    #[inline(always)]
617    pub fn devaddr(&self) -> DEVADDR_R {
618        DEVADDR_R::new(((self.bits >> 16) & 0x7f) as u8)
619    }
620    ///Bit 23 - Host mode This bit is set by the hardware when a device responds with a NAK. Software can be use this bit to monitoring the number of NAKs received from a device.
621    #[inline(always)]
622    pub fn nak(&self) -> NAK_R {
623        NAK_R::new(((self.bits >> 23) & 1) != 0)
624    }
625    ///Bit 24 - Low speed endpoint
626    #[inline(always)]
627    pub fn ls_ep(&self) -> LS_EP_R {
628        LS_EP_R::new(((self.bits >> 24) & 1) != 0)
629    }
630    ///Bit 25 - Transmit error Host mode This bit is set by the hardware when an error (e.g. no answer by the device, CRC error, bit stuffing error, framing format violation, etc.) has occurred during an OUT or SETUP transaction on this channel. The software can only clear this bit. If the ERRM bit in USB_CNTR register is set a generic interrupt condition is generated together with the channel related flag, which is always activated.
631    #[inline(always)]
632    pub fn err_tx(&self) -> ERR_TX_R {
633        ERR_TX_R::new(((self.bits >> 25) & 1) != 0)
634    }
635    ///Bit 26 - Receive error Host mode This bit is set by the hardware when an error (e.g. no answer by the device, CRC error, bit stuffing error, framing format violation, etc.) has occurred during an IN transaction on this channel. The software can only clear this bit. If the ERRM bit in USB_CNTR register is set a generic interrupt condition is generated together with the channel related flag, which is always activated.
636    #[inline(always)]
637    pub fn err_rx(&self) -> ERR_RX_R {
638        ERR_RX_R::new(((self.bits >> 26) & 1) != 0)
639    }
640}
641impl core::fmt::Debug for R {
642    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
643        f.debug_struct("CHEPR")
644            .field("ea", &self.ea())
645            .field("stattx", &self.stattx())
646            .field("vttx", &self.vttx())
647            .field("epkind", &self.epkind())
648            .field("utype", &self.utype())
649            .field("setup", &self.setup())
650            .field("statrx", &self.statrx())
651            .field("vtrx", &self.vtrx())
652            .field("devaddr", &self.devaddr())
653            .field("nak", &self.nak())
654            .field("ls_ep", &self.ls_ep())
655            .field("err_tx", &self.err_tx())
656            .field("err_rx", &self.err_rx())
657            .finish()
658    }
659}
660impl W {
661    ///Bits 0:3 - endpoint/channel address Device mode Software must write in this field the 4-bit address used to identify the transactions directed to this endpoint. A value must be written before enabling the corresponding endpoint. Host mode Software must write in this field the 4-bit address used to identify the channel addressed by the host transaction.
662    #[inline(always)]
663    pub fn ea(&mut self) -> EA_W<CHEPRrs> {
664        EA_W::new(self, 0)
665    }
666    ///Bits 4:5 - Status bits, for transmission transfers Device mode These bits contain the information about the endpoint status, listed in . These bits can be toggled by the software to initialize their value. When the application software writes '0, the value remains unchanged, while writing '1 makes the bit value toggle. Hardware sets the STTX bits to NAK, when a correct transfer has occurred (VTTX=1) corresponding to a IN or SETUP (control only) transaction addressed to this channel/endpoint. It then waits for the software to prepare the next set of data to be transmitted. Double-buffered bulk endpoints implement a special transaction flow control, which controls the status based on buffer availability condition (Refer to endpoints). If the endpoint is defined as Isochronous, its status can only be 'VALID' or 'DISABLED'. Therefore, the hardware cannot change the status of the channel/endpoint/channel after a successful transaction. If the software sets the STTX bits to 'STALL' or 'NAK' for an Isochronous channel/endpoint, the USB peripheral behavior is not defined. These bits are read/write but they can be only toggled by writing '1. Host mode Same as STRX behaviour but for IN transactions (TBC)
667    #[inline(always)]
668    pub fn stattx(&mut self) -> STATTX_W<CHEPRrs> {
669        STATTX_W::new(self, 4)
670    }
671    ///Bit 6 - Data Toggle, for transmission transfers If the endpoint/channel is non-isochronous, this bit contains the required value of the data toggle bit (0=DATA0, 1=DATA1) for the next data packet to be transmitted. Hardware toggles this bit when the ACK handshake is received from the USB host, following a data packet transmission. If the endpoint/channel is defined as a control one, hardware sets this bit to 1 at the reception of a SETUP PID addressed to this endpoint. If the endpoint/channel is using the double buffer feature, this bit is used to support packet buffer swapping too (Refer to ) If the endpoint/channel is Isochronous, this bit is used to support packet buffer swapping since no data toggling is used for this sort of endpoints and only DATA0 packet are transmitted (Refer to ). Hardware toggles this bit just after the end of data packet transmission, since no handshake is used for Isochronous transfers. This bit can also be toggled by the software to initialize its value (mandatory when the endpoint/channel is not a control one) or to force a specific data toggle/packet buffer usage. When the application software writes '0, the value of DTOGTX remains unchanged, while writing '1 makes the bit value toggle. This bit is read/write but it can only be toggled by writing 1.
672    #[inline(always)]
673    pub fn dtogtx(&mut self) -> DTOGTX_W<CHEPRrs> {
674        DTOGTX_W::new(self, 6)
675    }
676    ///Bit 7 - Valid USB transaction transmitted Device mode This bit is set by the hardware when an IN transaction is successfully completed on this endpoint; the software can only clear this bit. If the CTRM bit in the USB_CNTR register is set accordingly, a generic interrupt condition is generated together with the endpoint related interrupt condition, which is always activated. A transaction ended with a NAK or STALL handshake does not set this bit, since no data is actually transferred, as in the case of protocol errors or data toggle mismatches. This bit is read/write but only '0 can be written. Host mode Same of VTRX behaviour but for USB OUT and SETUP transactions.
677    #[inline(always)]
678    pub fn vttx(&mut self) -> VTTX_W<CHEPRrs> {
679        VTTX_W::new(self, 7)
680    }
681    ///Bit 8 - endpoint/channel kind The meaning of this bit depends on the endpoint/channel type configured by the EP_TYPE bits. summarizes the different meanings. DBL_BUF: This bit is set by the software to enable the double-buffering feature for this bulk endpoint. The usage of double-buffered bulk endpoints is explained in Double-buffered endpoints. STATUS_OUT: This bit is set by the software to indicate that a status out transaction is expected: in this case all OUT transactions containing more than zero data bytes are answered 'STALL' instead of 'ACK'. This bit may be used to improve the robustness of the application to protocol errors during control transfers and its usage is intended for control endpoints only. When STATUS_OUT is reset, OUT transactions can have any number of bytes, as required.
682    #[inline(always)]
683    pub fn epkind(&mut self) -> EPKIND_W<CHEPRrs> {
684        EPKIND_W::new(self, 8)
685    }
686    ///Bits 9:10 - USB type of transaction These bits configure the behavior of this endpoint/channel as described in endpoint/channel type encoding on page2001. Channel0/Endpoint0 must always be a control endpoint/channel and each USB function must have at least one control endpoint/channel which has address 0, but there may be other control channels/endpoints if required. Only control channels/endpoints handle SETUP transactions, which are ignored by endpoints of other kinds. SETUP transactions cannot be answered with NAK or STALL. If a control endpoint/channel is defined as NAK, the USB peripheral will not answer, simulating a receive error, in the receive direction when a SETUP transaction is received. If the control endpoint/channel is defined as STALL in the receive direction, then the SETUP packet will be accepted anyway, transferring data and issuing the CTR interrupt. The reception of OUT transactions is handled in the normal way, even if the endpoint/channel is a control one. Bulk and interrupt endpoints have very similar behavior and they differ only in the special feature available using the EPKIND configuration bit. The usage of Isochronous channels/endpoints is explained in transfers
687    #[inline(always)]
688    pub fn utype(&mut self) -> UTYPE_W<CHEPRrs> {
689        UTYPE_W::new(self, 9)
690    }
691    ///Bits 12:13 - Status bits, for reception transfers Device mode These bits contain information about the endpoint status, which are listed in Reception status encoding on page2000.These bits can be toggled by software to initialize their value. When the application software writes '0, the value remains unchanged, while writing '1 makes the bit value toggle. Hardware sets the STRX bits to NAK when a correct transfer has occurred (VTRX=1) corresponding to a OUT or SETUP (control only) transaction addressed to this endpoint, so the software has the time to elaborate the received data before it acknowledge a new transaction Double-buffered bulk endpoints implement a special transaction flow control, which control the status based upon buffer availability condition (Refer to endpoints). If the endpoint is defined as Isochronous, its status can be only 'VALID' or 'DISABLED', so that the hardware cannot change the status of the endpoint after a successful transaction. If the software sets the STRX bits to 'STALL' or 'NAK' for an Isochronous endpoint, the USB peripheral behavior is not defined. These bits are read/write but they can be only toggled by writing '1. Host mode These bits are the host application controls to start, retry, or abort host transactions driven by the channel. These bits also contain information about the device answer to the last IN channel transaction and report the current status of the channel according to the following STRX table of states: - DISABLE DISABLE value is reported in case of ACK acknowledge is received on a single-buffer channel. When in DISABLE state the channel is unused or not active waiting for application to restart it by writing VALID. Application can reset a VALID channel to DISABLE to abort a transaction. In this case the transaction is immediately removed from the Host execution list. If the aborted transaction was already under execution it will be regularly terminated on the USB but the relative VTRX interrupt is not generated. - VALID An Host channel is actively trying to submit USB transaction to device only when in VALID state.VALID state can be set by software or automatically by hardware on a NAKED channel at the start of a new frame. When set to VALID, an host channel enters the host execution queue and waits permission from the Host Frame Schedure to submit its configured transaction. VALID value is also reported in case of ACK acknowledge is received on a double-buffered channel. In this case the channel remains active on the alternate buffer while application needs to read the current buffer and toggle DTOGTX. In case software is late in reading and the alternate buffer is not ready, the host channel is automatically suspended transparently to the application. The suspended double buffered channel will be re-activated as soon as delay is recovered and DTOGTX is toggled. - NAK NAK value is reported in case of NAK acknowledge received. When in NAK state the channel is suspended and does not try to transmit. NAK state is moved to VALID by hardware at the start of the next frame, or software can change it to immediately retry transmission by writing it to VALID, or can disable it and abort the transaction by writing DISABLE - STALL STALL value is reported in case of STALL acknowledge received. When in STALL state the channel behaves as disabled. Application should not retry transmission but reset the USB and re-enumerate.
692    #[inline(always)]
693    pub fn statrx(&mut self) -> STATRX_W<CHEPRrs> {
694        STATRX_W::new(self, 12)
695    }
696    ///Bit 14 - Data Toggle, for reception transfers If the endpoint/channel is not Isochronous, this bit contains the expected value of the data toggle bit (0=DATA0, 1=DATA1) for the next data packet to be received. Hardware toggles this bit, when the ACK handshake is sent following a data packet reception having a matching data PID value; if the endpoint is defined as a control one, hardware clears this bit at the reception of a SETUP PID received from host (in device) or acknowledged by device (in host). If the endpoint/channel is using the double-buffering feature this bit is used to support packet buffer swapping too (Refer to ). If the endpoint/channel is Isochronous, this bit is used only to support packet buffer swapping for data transmission since no data toggling is used for this kind of channels/endpoints and only DATA0 packet are transmitted (Refer to Isochronous transfers). Hardware toggles this bit just after the end of data packet reception, since no handshake is used for isochronous transfers. This bit can also be toggled by the software to initialize its value (mandatory when the endpoint is not a control one) or to force specific data toggle/packet buffer usage. When the application software writes '0, the value of DTOGRX remains unchanged, while writing '1 makes the bit value toggle. This bit is read/write but it can be only toggled by writing 1.
697    #[inline(always)]
698    pub fn dtogrx(&mut self) -> DTOGRX_W<CHEPRrs> {
699        DTOGRX_W::new(self, 14)
700    }
701    ///Bit 15 - USB valid transaction received Device mode This bit is set by the hardware when an OUT/SETUP transaction is successfully completed on this endpoint; the software can only clear this bit. If the CTRM bit in USB_CNTR register is set accordingly, a generic interrupt condition is generated together with the endpoint related interrupt condition, which is always activated. The type of occurred transaction, OUT or SETUP, can be determined from the SETUP bit described below. A transaction ended with a NAK or STALL handshake does not set this bit, since no data is actually transferred, as in the case of protocol errors or data toggle mismatches. This bit is read/write but only '0 can be written, writing 1 has no effect. Host mode This bit is set by the hardware when an IN transaction is successfully completed on this channel. The software can only clear this bit. If the VTRM bit in USB_CNTR register is set a generic interrupt condition is generated together with the channel related flag, which is always activated. - A transaction ended with a NAK sets this bit and NAK answer is reported to application reading the NAK state from the STRX field of this register. One naked transaction keeps pending and is automatically retried by the Host at the next frame, or the Host can immediately retry by resetting STRX state to VALID. - A transaction ended by STALL handshake sets this bit and the STALL answer is reported to application reading the STALL state from the STRX field of this register. Host application should consequently disable the channel and re-enumerate. - A transaction ended with ACK handshake sets this bit If double buffering is disabled, ACK answer is reported by application reading the DISABLE state from the STRX field of this register. Host application should read received data from USBRAM and re-arm the channel by writing VALID to the STRX field of this register. If double buffering is enabled, ACK answer is reported by application reading VALID state from the STRX field of this register. Host application should read received data from USBRAM and toggle the DTOGTX bit of this register. This bit is read/write but only '0 can be written, writing 1 has no effect.
702    #[inline(always)]
703    pub fn vtrx(&mut self) -> VTRX_W<CHEPRrs> {
704        VTRX_W::new(self, 15)
705    }
706    ///Bits 16:22 - Host mode Device address assigned to the endpoint during the enumeration process.
707    #[inline(always)]
708    pub fn devaddr(&mut self) -> DEVADDR_W<CHEPRrs> {
709        DEVADDR_W::new(self, 16)
710    }
711    ///Bit 23 - Host mode This bit is set by the hardware when a device responds with a NAK. Software can be use this bit to monitoring the number of NAKs received from a device.
712    #[inline(always)]
713    pub fn nak(&mut self) -> NAK_W<CHEPRrs> {
714        NAK_W::new(self, 23)
715    }
716    ///Bit 24 - Low speed endpoint
717    #[inline(always)]
718    pub fn ls_ep(&mut self) -> LS_EP_W<CHEPRrs> {
719        LS_EP_W::new(self, 24)
720    }
721    ///Bit 25 - Transmit error Host mode This bit is set by the hardware when an error (e.g. no answer by the device, CRC error, bit stuffing error, framing format violation, etc.) has occurred during an OUT or SETUP transaction on this channel. The software can only clear this bit. If the ERRM bit in USB_CNTR register is set a generic interrupt condition is generated together with the channel related flag, which is always activated.
722    #[inline(always)]
723    pub fn err_tx(&mut self) -> ERR_TX_W<CHEPRrs> {
724        ERR_TX_W::new(self, 25)
725    }
726    ///Bit 26 - Receive error Host mode This bit is set by the hardware when an error (e.g. no answer by the device, CRC error, bit stuffing error, framing format violation, etc.) has occurred during an IN transaction on this channel. The software can only clear this bit. If the ERRM bit in USB_CNTR register is set a generic interrupt condition is generated together with the channel related flag, which is always activated.
727    #[inline(always)]
728    pub fn err_rx(&mut self) -> ERR_RX_W<CHEPRrs> {
729        ERR_RX_W::new(self, 26)
730    }
731}
732/**USB endpoint/channel %s register
733
734You can [`read`](crate::Reg::read) this register and get [`chepr::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`chepr::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).
735
736See register [structure](https://stm32-rs.github.io/stm32-rs/STM32G0C1.html#USB:CHEP[0]R)*/
737pub struct CHEPRrs;
738impl crate::RegisterSpec for CHEPRrs {
739    type Ux = u32;
740}
741///`read()` method returns [`chepr::R`](R) reader structure
742impl crate::Readable for CHEPRrs {}
743///`write(|w| ..)` method takes [`chepr::W`](W) writer structure
744impl crate::Writable for CHEPRrs {
745    type Safety = crate::Unsafe;
746    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0x0680_8080;
747    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0x7070;
748}
749///`reset()` method sets CHEP%sR to value 0
750impl crate::Resettable for CHEPRrs {}