File tree 2 files changed +12
-1
lines changed
system/GD32F30x_firmware/GD32F30x_usbd_library
2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ OF SUCH DAMAGE.
35
35
36
36
#include "usbd_enum.h"
37
37
#include "usbd_transc.h"
38
+ #include "usbd_lld_regs.h"
38
39
39
40
/* local function prototypes ('static') */
40
41
static inline void usb_stall_transc (usb_dev * udev );
@@ -56,8 +57,12 @@ void _usb_setup_transc (usb_dev *udev, uint8_t ep_num)
56
57
57
58
usb_reqsta reqstat = REQ_NOTSUPP ;
58
59
60
+ /* Force to IDLE state, to cancel actions by any pending completion handlers. */
61
+ udev -> control .ctl_state = USBD_CTL_IDLE ;
62
+
59
63
uint16_t count = udev -> drv_handler -> ep_read ((uint8_t * )(& udev -> control .req ), 0U , (uint8_t )EP_BUF_SNG );
60
64
65
+ USBD_EP_RX_ST_CLEAR (ep_num );
61
66
if (count != USB_SETUP_PACKET_LEN ) {
62
67
udev -> drv_handler -> err (count );
63
68
usb_stall_transc (udev );
Original file line number Diff line number Diff line change @@ -118,7 +118,9 @@ void usbd_isr (void)
118
118
/* handle the USB OUT direction transaction */
119
119
if (USBD_EPxCS (ep_num ) & EPxCS_RX_ST ) {
120
120
/* clear successful receive interrupt flag */
121
- USBD_EP_RX_ST_CLEAR (ep_num );
121
+ if (0U != ep_num ) {
122
+ USBD_EP_RX_ST_CLEAR (ep_num );
123
+ }
122
124
123
125
if (USBD_EPxCS (ep_num ) & EPxCS_SETUP ) {
124
126
@@ -132,6 +134,10 @@ void usbd_isr (void)
132
134
133
135
uint16_t count = udev -> drv_handler -> ep_read (transc -> xfer_buf , ep_num , (uint8_t )EP_BUF_SNG );
134
136
137
+ if (0U == ep_num ) {
138
+ USBD_EP_RX_ST_CLEAR (ep_num );
139
+ }
140
+
135
141
transc -> xfer_buf += count ;
136
142
transc -> xfer_count += count ;
137
143
You can’t perform that action at this time.
0 commit comments