Fix LPC17XX and LPC40XX USB data throttling

Only clear the USB read buffer when endpointRead is called. This
allows data to be read with endpointReadResult without also allowing
USB to transfer more data. Instead additional data is transferred explicitly
with a call to endpointRead.
pull/5878/head
Russ Butler 2018-01-15 21:18:32 -06:00 committed by Russ Butler
parent eda332cbf8
commit 6fe0aa0074
2 changed files with 12 additions and 12 deletions

View File

@ -275,11 +275,6 @@ uint32_t USBHAL::endpointReadcore(uint8_t endpoint, uint8_t *buffer) {
LPC_USB->USBCtrl = 0; LPC_USB->USBCtrl = 0;
if ((endpoint >> 1) % 3 || (endpoint >> 1) == 0) {
SIEselectEndpoint(endpoint);
SIEclearBuffer();
}
return size; return size;
} }
@ -431,7 +426,7 @@ void USBHAL::EP0setup(uint8_t *buffer) {
} }
void USBHAL::EP0read(void) { void USBHAL::EP0read(void) {
// Not required endpointRead(EP0OUT, MAX_PACKET_SIZE_EP0);
} }
void USBHAL::EP0readStage(void) { void USBHAL::EP0readStage(void) {
@ -456,6 +451,11 @@ void USBHAL::EP0stall(void) {
} }
EP_STATUS USBHAL::endpointRead(uint8_t endpoint, uint32_t maximumSize) { EP_STATUS USBHAL::endpointRead(uint8_t endpoint, uint32_t maximumSize) {
// Don't clear isochronous endpoints
if ((endpoint >> 1) % 3 || (endpoint >> 1) == 0) {
SIEselectEndpoint(endpoint);
SIEclearBuffer();
}
return EP_PENDING; return EP_PENDING;
} }

View File

@ -276,11 +276,6 @@ uint32_t USBHAL::endpointReadcore(uint8_t endpoint, uint8_t *buffer) {
LPC_USB->Ctrl = 0; LPC_USB->Ctrl = 0;
if ((endpoint >> 1) % 3 || (endpoint >> 1) == 0) {
SIEselectEndpoint(endpoint);
SIEclearBuffer();
}
return size; return size;
} }
@ -436,7 +431,7 @@ void USBHAL::EP0setup(uint8_t *buffer) {
} }
void USBHAL::EP0read(void) { void USBHAL::EP0read(void) {
// Not required endpointRead(EP0OUT, MAX_PACKET_SIZE_EP0);
} }
void USBHAL::EP0readStage(void) { void USBHAL::EP0readStage(void) {
@ -461,6 +456,11 @@ void USBHAL::EP0stall(void) {
} }
EP_STATUS USBHAL::endpointRead(uint8_t endpoint, uint32_t maximumSize) { EP_STATUS USBHAL::endpointRead(uint8_t endpoint, uint32_t maximumSize) {
// Don't clear isochronous endpoints
if ((endpoint >> 1) % 3 || (endpoint >> 1) == 0) {
SIEselectEndpoint(endpoint);
SIEclearBuffer();
}
return EP_PENDING; return EP_PENDING;
} }