[HAL:LPC]: USB Bugfix

This commit is contained in:
codetector 2020-12-17 18:55:04 -05:00
parent 638f45982d
commit 9e44155cde
No known key found for this signature in database
GPG Key ID: 7D42AB4D2C7B40A4
1 changed files with 5 additions and 5 deletions

View File

@ -157,7 +157,7 @@ static size_t usb_packet_receive(USBDriver *usbp, usbep_t ep) {
osp->rxcnt += n;
osp->rxsize -= n;
size_t next_xfer = (osp->rxsize > epcp->out_maxsize) ? epcp->out_maxsize : osp->rxsize;
size_t next_xfer = (osp->rxsize > epcp->out_maxsize) ? epcp->out_maxsize : osp->rxsize;
USB_EPLIST->entry[4 * ep] &= ~(0x3FFFFFF | EPLIST_ENTRY_STALL | EPLIST_ENTRY_ACTIVE);
if (next_xfer > 0) {
// ReSetup for recieve
@ -218,12 +218,12 @@ OSAL_IRQ_HANDLER(LPC_USB_IRQ_VECTOR) {
} else {
// OUT endpoint, receive
USBOutEndpointState *osp = usbp->epc[ep]->out_state;
size_t n = 0;
if (osp->rxsize > 0) {
osalSysLockFromISR();
n = usb_packet_receive(usbp, ep);
osalSysLockFromISR();
usb_packet_receive(usbp, ep);
osalSysUnlockFromISR();
} else {
}
if (osp->rxsize == 0) { // TODO: Check if this is correct
_usb_isr_invoke_out_cb(usbp, ep);
}
}