@@ -139,11 +139,22 @@ func handleEndpointRx(ep uint32) []byte {
139
139
// AckUsbOutTransfer is called to acknowledge the completion of a USB OUT transfer.
140
140
func AckUsbOutTransfer (ep uint32 ) {
141
141
ep = ep & 0x7F
142
- setEPDataPID (ep , ! outEpXdata0 [ep ])
142
+ setEPOutDataPID (ep , ! outEpXdata0 [ep ])
143
143
}
144
144
145
145
// Set the USB endpoint Packet ID to DATA0 or DATA1.
146
- func setEPDataPID (ep uint32 , dataOne bool ) {
146
+ func setEPInDataPID (ep uint32 , dataOne bool ) {
147
+ ep = ep & 0x7F
148
+ inEpXdata0 [ep ] = dataOne
149
+ if inEpXdata0 [ep ] || ep == 0 {
150
+ _usbDPSRAM .EPxBufferControl [ep ].In .SetBits (usbBuf0CtrlData1Pid )
151
+ }
152
+
153
+ _usbDPSRAM .EPxBufferControl [ep ].Out .SetBits (usbBuf0CtrlAvail )
154
+ }
155
+
156
+ // Set the USB endpoint Packet ID to DATA0 or DATA1.
157
+ func setEPOutDataPID (ep uint32 , dataOne bool ) {
147
158
outEpXdata0 [ep ] = dataOne
148
159
if outEpXdata0 [ep ] || ep == 0 {
149
160
_usbDPSRAM .EPxBufferControl [ep ].Out .SetBits (usbBuf0CtrlData1Pid )
@@ -205,7 +216,7 @@ func (dev *USBDevice) ClearStallEPIn(ep uint32) {
205
216
_usbDPSRAM .EPxBufferControl [ep ].In .ClearBits (val )
206
217
if inEpXPIDReset [ep ] {
207
218
// Reset the PID to DATA0
208
- setEPDataPID (ep , false )
219
+ setEPInDataPID (ep , false )
209
220
}
210
221
}
211
222
@@ -216,7 +227,7 @@ func (dev *USBDevice) ClearStallEPOut(ep uint32) {
216
227
_usbDPSRAM .EPxBufferControl [ep ].Out .ClearBits (val )
217
228
if outEpXPIDReset [ep ] {
218
229
// Reset the PID to DATA0
219
- setEPDataPID (ep , false )
230
+ setEPOutDataPID (ep , false )
220
231
}
221
232
}
222
233
0 commit comments