diff --git a/os/hal/include/hal_usbh.h b/os/hal/include/hal_usbh.h index 1ed6416a..6a6be21c 100644 --- a/os/hal/include/hal_usbh.h +++ b/os/hal/include/hal_usbh.h @@ -52,7 +52,9 @@ #define HAL_USBH_USE_ADDITIONAL_CLASS_DRIVERS FALSE #endif +#ifndef HAL_USBH_USE_IAD #define HAL_USBH_USE_IAD HAL_USBH_USE_UVC +#endif #if (HAL_USE_USBH == TRUE) || defined(__DOXYGEN__) @@ -299,6 +301,12 @@ extern "C" { } /* Synchronous API */ + usbh_urbstatus_t usbhSynchronousTransfer(usbh_ep_t *ep, + void *data, + uint32_t len, + uint32_t *actual_len, + systime_t timeout); + usbh_urbstatus_t usbhBulkTransfer(usbh_ep_t *ep, void *data, uint32_t len, diff --git a/os/hal/ports/STM32/LLD/USBHv1/hal_usbh_lld.c b/os/hal/ports/STM32/LLD/USBHv1/hal_usbh_lld.c index 47235080..0403eae1 100644 --- a/os/hal/ports/STM32/LLD/USBHv1/hal_usbh_lld.c +++ b/os/hal/ports/STM32/LLD/USBHv1/hal_usbh_lld.c @@ -1172,9 +1172,17 @@ static inline void _nptxfe_int(USBHDriver *host) { } static inline void _ptxfe_int(USBHDriver *host) { - //TODO: implement - (void)host; - uinfo("PTXFE"); + uint32_t rem; + stm32_otg_t *const otg = host->otg; + + rem = _write_packet(&host->ep_active_lists[USBH_EPTYPE_ISO], + otg->HPTXSTS & HPTXSTS_PTXFSAVL_MASK); + + rem += _write_packet(&host->ep_active_lists[USBH_EPTYPE_INT], + otg->HPTXSTS & HPTXSTS_PTXFSAVL_MASK); + + if (!rem) + otg->GINTMSK &= ~GINTMSK_PTXFEM; } static void _disable(USBHDriver *host) { diff --git a/os/hal/src/hal_usbh.c b/os/hal/src/hal_usbh.c index 7dff98a4..3949c68a 100644 --- a/os/hal/src/hal_usbh.c +++ b/os/hal/src/hal_usbh.c @@ -335,10 +335,19 @@ usbh_urbstatus_t usbhBulkTransfer(usbh_ep_t *ep, uint32_t len, uint32_t *actual_len, systime_t timeout) { + osalDbgAssert(ep->type == USBH_EPTYPE_BULK, "wrong ep"); + + return usbhSynchronousTransfer(ep,data,len,actual_len,timeout); +} + +usbh_urbstatus_t usbhSynchronousTransfer(usbh_ep_t *ep, + void *data, + uint32_t len, + uint32_t *actual_len, + systime_t timeout) { osalDbgCheck(ep != NULL); osalDbgCheck((data != NULL) || (len == 0)); - osalDbgAssert(ep->type == USBH_EPTYPE_BULK, "wrong ep"); usbh_urb_t urb; usbhURBObjectInit(&urb, ep, 0, 0, data, len);