Added TARGET_DISCO_F469NI in USBHOST\USBHost\TARGET_STM\USBHALHost_STM_TARGET.h

Dependents:   DISCO-F469NI_USB_Disk STM32F4xx_USB_Memory

Fork of USBHOST by ST

Revision:
3:1c76b46ad779
Parent:
1:ab240722d7ef
Child:
5:fc157e6bd5a5
diff -r ab240722d7ef -r 1c76b46ad779 USBHost/TARGET_STM/USBHALHost_STM.cpp
--- 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;