Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: door-access-controller-dev
Diff: USBHost/TARGET_STM/USBHALHost_STM.cpp
- Revision:
- 3:1c76b46ad779
- Parent:
- 1:ab240722d7ef
- Child:
- 5:fc157e6bd5a5
--- a/USBHost/TARGET_STM/USBHALHost_STM.cpp Wed Feb 15 10:49:44 2017 +0100
+++ b/USBHost/TARGET_STM/USBHALHost_STM.cpp Fri Feb 17 12:40:57 2017 +0100
@@ -93,13 +93,13 @@
return;
}
td->state = (urb_state == URB_DONE) ? USB_TYPE_IDLE : USB_TYPE_ERROR;
- if (urb_state == URB_NOTREADY)
- USB_ERR("urb_state != URB_NOTREADY");
- /* move buffer pointer , for size */
+ /* move buffer pointer , for size */
if ((type != EP_TYPE_BULK) && (type != EP_TYPE_CTRL )) {
/* in packet */
} else {
if (urb_state == URB_DONE) {
+ /* reset retry counter */
+ td->retry = 0;
if (td->size > max_size) {
/* enqueue another request */
td->currBufPtr += max_size;
@@ -108,6 +108,19 @@
MBED_ASSERT(HAL_HCD_HC_SubmitRequest(hhcd, chnum, dir ,type , 1,(uint8_t*) td->currBufPtr, length, 0)==HAL_OK);
return;
}
+ }else if (urb_state == URB_NOTREADY) {
+ /* try again */
+ /* abritary limit , to avoid dead lock if other error than
+ * slow response is */
+ if (td->retry < 1000) {
+ /* increment retry counter */
+ td->retry++;
+ length = td->size <= max_size ? td->size : max_size;
+ MBED_ASSERT(HAL_HCD_HC_SubmitRequest(hhcd, chnum, dir ,type , 1,(uint8_t*) td->currBufPtr, length, 0)==HAL_OK);
+ return;
+ }else USB_ERR("urb_state != URB_NOTREADY");
+
+
}
}
td->state = (urb_state == URB_DONE) ? USB_TYPE_IDLE : USB_TYPE_ERROR;