File tree 1 file changed +23
-22
lines changed
1 file changed +23
-22
lines changed Original file line number Diff line number Diff line change @@ -319,35 +319,36 @@ class DoubleBufferedEPOutHandler : public EPHandler {
319
319
// Ack Transfer complete
320
320
usbd.epBank0AckTransferComplete (ep);
321
321
// usbd.epBank0AckTransferFailed(ep); // XXX
322
+ uint32_t received = usbd.epBank0ByteCount (ep);
323
+ if (received == 0 ) {
324
+ release ();
325
+ return ;
326
+ }
322
327
323
328
// Update counters and swap banks for non-ZLP's
324
329
if (incoming == 0 ) {
325
- last0 = usbd.epBank0ByteCount (ep);
326
- if (last0 != 0 ) {
327
- incoming = 1 ;
328
- usbd.epBank0SetAddress (ep, const_cast <uint8_t *>(data1));
329
- synchronized {
330
- ready0 = true ;
331
- if (ready1) {
332
- notify = true ;
333
- return ;
334
- }
335
- notify = false ;
330
+ last0 = received;
331
+ incoming = 1 ;
332
+ usbd.epBank0SetAddress (ep, const_cast <uint8_t *>(data1));
333
+ synchronized {
334
+ ready0 = true ;
335
+ if (ready1) {
336
+ notify = true ;
337
+ return ;
336
338
}
339
+ notify = false ;
337
340
}
338
341
} else {
339
- last1 = usbd.epBank0ByteCount (ep);
340
- if (last1 != 0 ) {
341
- incoming = 0 ;
342
- usbd.epBank0SetAddress (ep, const_cast <uint8_t *>(data0));
343
- synchronized {
344
- ready1 = true ;
345
- if (ready0) {
346
- notify = true ;
347
- return ;
348
- }
349
- notify = false ;
342
+ last1 = received;
343
+ incoming = 0 ;
344
+ usbd.epBank0SetAddress (ep, const_cast <uint8_t *>(data0));
345
+ synchronized {
346
+ ready1 = true ;
347
+ if (ready0) {
348
+ notify = true ;
349
+ return ;
350
350
}
351
+ notify = false ;
351
352
}
352
353
}
353
354
release ();
You can’t perform that action at this time.
0 commit comments