@@ -295,18 +295,7 @@ TU_ATTR_ALWAYS_INLINE static inline void pcd_set_ep_rx_cnt(USB_TypeDef * USBx, u
295
295
TU_ATTR_ALWAYS_INLINE static inline void pcd_set_ep_tx_status (USB_TypeDef * USBx , uint32_t bEpIdx , uint32_t wState ) {
296
296
uint32_t regVal = pcd_get_endpoint (USBx , bEpIdx );
297
297
regVal &= USB_EPTX_DTOGMASK ;
298
-
299
- /* toggle first bit ? */
300
- if ((USB_EPTX_DTOG1 & (wState ))!= 0U )
301
- {
302
- regVal ^= USB_EPTX_DTOG1 ;
303
- }
304
- /* toggle second bit ? */
305
- if ((USB_EPTX_DTOG2 & ((uint32_t )(wState )))!= 0U )
306
- {
307
- regVal ^= USB_EPTX_DTOG2 ;
308
- }
309
-
298
+ regVal ^= wState ;
310
299
regVal |= USB_EP_CTR_RX |USB_EP_CTR_TX ;
311
300
pcd_set_endpoint (USBx , bEpIdx , regVal );
312
301
}
@@ -322,16 +311,7 @@ TU_ATTR_ALWAYS_INLINE static inline void pcd_set_ep_tx_status(USB_TypeDef * USBx
322
311
TU_ATTR_ALWAYS_INLINE static inline void pcd_set_ep_rx_status (USB_TypeDef * USBx , uint32_t bEpIdx , uint32_t wState ) {
323
312
uint32_t regVal = pcd_get_endpoint (USBx , bEpIdx );
324
313
regVal &= USB_EPRX_DTOGMASK ;
325
-
326
- /* toggle first bit ? */
327
- if ((USB_EPRX_DTOG1 & wState )!= 0U ) {
328
- regVal ^= USB_EPRX_DTOG1 ;
329
- }
330
- /* toggle second bit ? */
331
- if ((USB_EPRX_DTOG2 & wState )!= 0U ) {
332
- regVal ^= USB_EPRX_DTOG2 ;
333
- }
334
-
314
+ regVal ^= wState ;
335
315
regVal |= USB_EP_CTR_RX |USB_EP_CTR_TX ;
336
316
pcd_set_endpoint (USBx , bEpIdx , regVal );
337
317
}
0 commit comments