aboutsummaryrefslogtreecommitdiffstats
path: root/os
diff options
context:
space:
mode:
authorFabien Poussin <fabien.poussin@gmail.com>2018-10-02 20:51:08 +0200
committerGitHub <noreply@github.com>2018-10-02 20:51:08 +0200
commita0e2c3a785cff480ecb803a2557c1bdf1d03f9d3 (patch)
treece7d701e2b9005eb7d878173050e5d49aa564ae6 /os
parent4344e6d1797b35dfb13a86c4cc8dcfe404b39910 (diff)
parent40769f9bd350be59b9a9ef944c77d63cfc883f2e (diff)
downloadChibiOS-Contrib-a0e2c3a785cff480ecb803a2557c1bdf1d03f9d3.tar.gz
ChibiOS-Contrib-a0e2c3a785cff480ecb803a2557c1bdf1d03f9d3.tar.bz2
ChibiOS-Contrib-a0e2c3a785cff480ecb803a2557c1bdf1d03f9d3.zip
Merge pull request #169 from apmorton/usbh-fixes
STM32 USBH LLD Fixes
Diffstat (limited to 'os')
-rw-r--r--os/hal/ports/STM32/LLD/USBHv1/hal_usbh_lld.c23
1 files changed, 16 insertions, 7 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 2894907..3298c20 100644
--- a/os/hal/ports/STM32/LLD/USBHv1/hal_usbh_lld.c
+++ b/os/hal/ports/STM32/LLD/USBHv1/hal_usbh_lld.c
@@ -594,9 +594,10 @@ void usbh_lld_ep_open(usbh_ep_t *ep) {
}
void usbh_lld_ep_close(usbh_ep_t *ep) {
- usbh_urb_t *urb, *tmp;
+ usbh_urb_t *urb;
uinfof("\t%s: Closing EP...", ep->name);
- list_for_each_entry_safe(urb, usbh_urb_t, tmp, &ep->urb_list, node) {
+ while (!list_empty(&ep->urb_list)) {
+ urb = list_first_entry(&ep->urb_list, usbh_urb_t, node);
uinfof("\t%s: Abort URB, USBH_URBSTATUS_DISCONNECTED", ep->name);
_usbh_urb_abort_and_waitS(urb, USBH_URBSTATUS_DISCONNECTED);
}
@@ -987,7 +988,7 @@ static inline void _hcint_int(USBHDriver *host) {
haint = host->otg->HAINT;
haint &= host->otg->HAINTMSK;
-#if USBH_LLD_DEBUG_ENABLE_ERRORS
+#if USBH_DEBUG_ENABLE && USBH_LLD_DEBUG_ENABLE_ERRORS
if (!haint) {
uint32_t a, b;
a = host->otg->HAINT;
@@ -1172,9 +1173,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) {
@@ -1319,7 +1328,7 @@ static void usb_lld_serve_interrupt(USBHDriver *host) {
gintsts &= otg->GINTMSK;
if (!gintsts) {
-#if USBH_DEBUG_ENABLE_WARNINGS
+#if USBH_DEBUG_ENABLE && USBH_DEBUG_ENABLE_WARNINGS
uint32_t a, b;
a = otg->GINTSTS;
b = otg->GINTMSK;