From 354313f408db8f979cd729a19e80ede3a1c83283 Mon Sep 17 00:00:00 2001 From: Axoloti Date: Tue, 12 Sep 2017 11:41:38 +0200 Subject: allow enabling IAD without UVC --- os/hal/include/hal_usbh.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/os/hal/include/hal_usbh.h b/os/hal/include/hal_usbh.h index 1ed6416..7ff8de0 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__) -- cgit v1.2.3 From d2269527b744e0ab249d38663436613158b0a282 Mon Sep 17 00:00:00 2001 From: Mark Harris Date: Tue, 12 Sep 2017 16:55:01 +0200 Subject: implement ptxfe_int for outbound INT ep --- os/hal/ports/STM32/LLD/USBHv1/hal_usbh_lld.c | 18 +++++++++++++++--- os/hal/src/hal_usbh.c | 2 +- 2 files changed, 16 insertions(+), 4 deletions(-) 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 4723508..05054d0 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,21 @@ static inline void _nptxfe_int(USBHDriver *host) { } static inline void _ptxfe_int(USBHDriver *host) { - //TODO: implement - (void)host; - uinfo("PTXFE"); + // //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_CTRL], + otg->HNPTXSTS & HPTXSTS_PTXFSAVL_MASK); + + rem += _write_packet(&host->ep_active_lists[USBH_EPTYPE_INT], + otg->HNPTXSTS & 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 7dff98a..10c5c03 100644 --- a/os/hal/src/hal_usbh.c +++ b/os/hal/src/hal_usbh.c @@ -338,7 +338,7 @@ usbh_urbstatus_t usbhBulkTransfer(usbh_ep_t *ep, osalDbgCheck(ep != NULL); osalDbgCheck((data != NULL) || (len == 0)); - osalDbgAssert(ep->type == USBH_EPTYPE_BULK, "wrong ep"); + // osalDbgAssert(ep->type == USBH_EPTYPE_BULK, "wrong ep"); usbh_urb_t urb; usbhURBObjectInit(&urb, ep, 0, 0, data, len); -- cgit v1.2.3 From f5f3c8ffdb666682868c0280995f2a5fb8c62aa3 Mon Sep 17 00:00:00 2001 From: Mark Harris Date: Thu, 14 Sep 2017 14:41:28 +0200 Subject: usbh:_ptxfe_int, use HPTXSTS, introduce usbhSyncrhonousTransfer --- os/hal/include/hal_usbh.h | 6 ++++++ os/hal/ports/STM32/LLD/USBHv1/hal_usbh_lld.c | 10 +++------- os/hal/src/hal_usbh.c | 11 ++++++++++- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/os/hal/include/hal_usbh.h b/os/hal/include/hal_usbh.h index 7ff8de0..9e31096 100644 --- a/os/hal/include/hal_usbh.h +++ b/os/hal/include/hal_usbh.h @@ -301,6 +301,12 @@ extern "C" { } /* Synchronous API */ + usbh_urbstatus_t usbhSyncrhonousTransfer(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 05054d0..0403eae 100644 --- a/os/hal/ports/STM32/LLD/USBHv1/hal_usbh_lld.c +++ b/os/hal/ports/STM32/LLD/USBHv1/hal_usbh_lld.c @@ -1172,18 +1172,14 @@ 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_CTRL], - otg->HNPTXSTS & HPTXSTS_PTXFSAVL_MASK); + 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->HNPTXSTS & HPTXSTS_PTXFSAVL_MASK); + otg->HPTXSTS & HPTXSTS_PTXFSAVL_MASK); if (!rem) otg->GINTMSK &= ~GINTMSK_PTXFEM; diff --git a/os/hal/src/hal_usbh.c b/os/hal/src/hal_usbh.c index 10c5c03..a7ceedf 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 usbhSyncrhonousTransfer(ep,data,len,actual_len,timeout); +} + +usbh_urbstatus_t usbhSyncrhonousTransfer(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); -- cgit v1.2.3 From 741459ac27f9efb158ff28860c5d8e9affb87b68 Mon Sep 17 00:00:00 2001 From: Mark Harris Date: Thu, 14 Sep 2017 17:36:21 +0200 Subject: usbh:correct spelling of usbhSynchronousTransfer --- os/hal/include/hal_usbh.h | 2 +- os/hal/src/hal_usbh.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/os/hal/include/hal_usbh.h b/os/hal/include/hal_usbh.h index 9e31096..6a6be21 100644 --- a/os/hal/include/hal_usbh.h +++ b/os/hal/include/hal_usbh.h @@ -301,7 +301,7 @@ extern "C" { } /* Synchronous API */ - usbh_urbstatus_t usbhSyncrhonousTransfer(usbh_ep_t *ep, + usbh_urbstatus_t usbhSynchronousTransfer(usbh_ep_t *ep, void *data, uint32_t len, uint32_t *actual_len, diff --git a/os/hal/src/hal_usbh.c b/os/hal/src/hal_usbh.c index a7ceedf..3949c68 100644 --- a/os/hal/src/hal_usbh.c +++ b/os/hal/src/hal_usbh.c @@ -337,10 +337,10 @@ usbh_urbstatus_t usbhBulkTransfer(usbh_ep_t *ep, systime_t timeout) { osalDbgAssert(ep->type == USBH_EPTYPE_BULK, "wrong ep"); - return usbhSyncrhonousTransfer(ep,data,len,actual_len,timeout); + return usbhSynchronousTransfer(ep,data,len,actual_len,timeout); } -usbh_urbstatus_t usbhSyncrhonousTransfer(usbh_ep_t *ep, +usbh_urbstatus_t usbhSynchronousTransfer(usbh_ep_t *ep, void *data, uint32_t len, uint32_t *actual_len, -- cgit v1.2.3