diff --git a/configs/cloudctrl/src/up_usb.c b/configs/cloudctrl/src/up_usb.c index 98f015deee..2407285c54 100644 --- a/configs/cloudctrl/src/up_usb.c +++ b/configs/cloudctrl/src/up_usb.c @@ -109,7 +109,7 @@ static int usbhost_waiter(int argc, char *argv[]) { /* Wait for the device to change state */ - ret = DRVR_WAIT(g_drvr, connected); + ret = DRVR_WAIT(g_drvr, &connected); DEBUGASSERT(ret == OK); connected = !connected; @@ -121,7 +121,7 @@ static int usbhost_waiter(int argc, char *argv[]) { /* Yes.. enumerate the newly connected device */ - (void)DRVR_ENUMERATE(g_drvr); + (void)DRVR_ENUMERATE(g_drvr, 0); } } diff --git a/configs/mikroe-stm32f4/src/up_usb.c b/configs/mikroe-stm32f4/src/up_usb.c index f8debe5ab8..cb94e5cbef 100644 --- a/configs/mikroe-stm32f4/src/up_usb.c +++ b/configs/mikroe-stm32f4/src/up_usb.c @@ -108,7 +108,7 @@ static int usbhost_waiter(int argc, char *argv[]) { /* Wait for the device to change state */ - ret = DRVR_WAIT(g_drvr, connected); + ret = DRVR_WAIT(g_drvr, &connected); DEBUGASSERT(ret == OK); connected = !connected; @@ -120,7 +120,7 @@ static int usbhost_waiter(int argc, char *argv[]) { /* Yes.. enumerate the newly connected device */ - (void)DRVR_ENUMERATE(g_drvr); + (void)DRVR_ENUMERATE(g_drvr, 0); } } diff --git a/configs/olimex-lpc1766stk/src/up_nsh.c b/configs/olimex-lpc1766stk/src/up_nsh.c index 4ca474c651..e893ba27e0 100644 --- a/configs/olimex-lpc1766stk/src/up_nsh.c +++ b/configs/olimex-lpc1766stk/src/up_nsh.c @@ -169,7 +169,7 @@ static int nsh_waiter(int argc, char *argv[]) { /* Wait for the device to change state */ - ret = DRVR_WAIT(g_drvr, connected); + ret = DRVR_WAIT(g_drvr, &connected); DEBUGASSERT(ret == OK); connected = !connected; @@ -181,7 +181,7 @@ static int nsh_waiter(int argc, char *argv[]) { /* Yes.. enumerate the newly connected device */ - (void)DRVR_ENUMERATE(g_drvr); + (void)DRVR_ENUMERATE(g_drvr, 0); } } diff --git a/configs/open1788/src/lpc17_nsh.c b/configs/open1788/src/lpc17_nsh.c index 3dca28b2f8..fa6e086ed0 100644 --- a/configs/open1788/src/lpc17_nsh.c +++ b/configs/open1788/src/lpc17_nsh.c @@ -193,7 +193,7 @@ static int nsh_waiter(int argc, char *argv[]) { /* Wait for the device to change state */ - ret = DRVR_WAIT(g_drvr, connected); + ret = DRVR_WAIT(g_drvr, &connected); DEBUGASSERT(ret == OK); connected = !connected; @@ -205,7 +205,7 @@ static int nsh_waiter(int argc, char *argv[]) { /* Yes.. enumerate the newly connected device */ - (void)DRVR_ENUMERATE(g_drvr); + (void)DRVR_ENUMERATE(g_drvr, 0); } } diff --git a/configs/pic32-starterkit/src/up_nsh.c b/configs/pic32-starterkit/src/up_nsh.c index 71909f92e3..7c8e214124 100644 --- a/configs/pic32-starterkit/src/up_nsh.c +++ b/configs/pic32-starterkit/src/up_nsh.c @@ -197,7 +197,7 @@ static int nsh_waiter(int argc, char *argv[]) { /* Wait for the device to change state */ - ret = DRVR_WAIT(g_drvr, connected); + ret = DRVR_WAIT(g_drvr, &connected); DEBUGASSERT(ret == OK); connected = !connected; @@ -209,7 +209,7 @@ static int nsh_waiter(int argc, char *argv[]) { /* Yes.. enumerate the newly connected device */ - (void)DRVR_ENUMERATE(g_drvr); + (void)DRVR_ENUMERATE(g_drvr, 0); } } diff --git a/configs/pic32mx7mmb/src/up_nsh.c b/configs/pic32mx7mmb/src/up_nsh.c index 37ecc30950..5e59af5645 100644 --- a/configs/pic32mx7mmb/src/up_nsh.c +++ b/configs/pic32mx7mmb/src/up_nsh.c @@ -196,7 +196,7 @@ static int nsh_waiter(int argc, char *argv[]) { /* Wait for the device to change state */ - ret = DRVR_WAIT(g_drvr, connected); + ret = DRVR_WAIT(g_drvr, &connected); DEBUGASSERT(ret == OK); connected = !connected; @@ -208,7 +208,7 @@ static int nsh_waiter(int argc, char *argv[]) { /* Yes.. enumerate the newly connected device */ - (void)DRVR_ENUMERATE(g_drvr); + (void)DRVR_ENUMERATE(g_drvr, 0); } } diff --git a/configs/sama5d3x-ek/src/sam_usb.c b/configs/sama5d3x-ek/src/sam_usb.c index 3b009bb414..3ab5d3c393 100644 --- a/configs/sama5d3x-ek/src/sam_usb.c +++ b/configs/sama5d3x-ek/src/sam_usb.c @@ -54,6 +54,7 @@ #include "up_arch.h" #include "sam_pio.h" #include "sam_usbhost.h" +#include "chip/sam_ohci.h" #include "sama5d3x-ek.h" #if defined(CONFIG_SAMA5_UHPHS) || defined(CONFIG_SAMA5_UDPHS) @@ -97,25 +98,29 @@ static struct usbhost_driver_s *g_ehci; #if HAVE_USBHOST static int usbhost_waiter(struct usbhost_driver_s *dev) { - bool connected = false; + bool connected[SAM_USBHOST_NRHPORT] = {false, false, false}; + int rhpndx; uvdbg("Running\n"); for (;;) { /* Wait for the device to change state */ - DEBUGVERIFY(DRVR_WAIT(dev, connected) == OK); + rhpndx = DRVR_WAIT(dev, connected); + DEBUGASSERT(rhpndx >= 0 && rhpndx < SAM_USBHOST_NRHPORT); - connected = !connected; - uvdbg("%s\n", connected ? "connected" : "disconnected"); + connected[rhpndx] = !connected[rhpndx]; + + uvdbg("RHport%d %s\n", + rhpndx + 1, connected[rhpndx] ? "connected" : "disconnected"); /* Did we just become connected? */ - if (connected) + if (connected[rhpndx]) { /* Yes.. enumerate the newly connected device */ - (void)DRVR_ENUMERATE(dev); + (void)DRVR_ENUMERATE(dev, rhpndx); } } diff --git a/configs/sama5d3x-ek/src/sama5d3x-ek.h b/configs/sama5d3x-ek/src/sama5d3x-ek.h index 0cf87b2e45..9f91aee92b 100644 --- a/configs/sama5d3x-ek/src/sama5d3x-ek.h +++ b/configs/sama5d3x-ek/src/sama5d3x-ek.h @@ -293,7 +293,7 @@ PIO_PORT_PIOD | PIO_PIN27) /* Both Ports B and C - * + * * PIO Signal Name Function * ---- ----------- ------------------------------------------------------- * PD28 OVCUR_USB Combined overrcurrent indication from port A and B diff --git a/configs/shenzhou/src/up_usb.c b/configs/shenzhou/src/up_usb.c index 0ae1d8c52e..88f6d96baf 100644 --- a/configs/shenzhou/src/up_usb.c +++ b/configs/shenzhou/src/up_usb.c @@ -108,7 +108,7 @@ static int usbhost_waiter(int argc, char *argv[]) { /* Wait for the device to change state */ - ret = DRVR_WAIT(g_drvr, connected); + ret = DRVR_WAIT(g_drvr, &connected); DEBUGASSERT(ret == OK); connected = !connected; @@ -120,7 +120,7 @@ static int usbhost_waiter(int argc, char *argv[]) { /* Yes.. enumerate the newly connected device */ - (void)DRVR_ENUMERATE(g_drvr); + (void)DRVR_ENUMERATE(g_drvr, 0); } } diff --git a/configs/stm3220g-eval/src/up_usb.c b/configs/stm3220g-eval/src/up_usb.c index b16bdb6aa1..4de02df964 100644 --- a/configs/stm3220g-eval/src/up_usb.c +++ b/configs/stm3220g-eval/src/up_usb.c @@ -108,7 +108,7 @@ static int usbhost_waiter(int argc, char *argv[]) { /* Wait for the device to change state */ - ret = DRVR_WAIT(g_drvr, connected); + ret = DRVR_WAIT(g_drvr, &connected); DEBUGASSERT(ret == OK); connected = !connected; @@ -120,7 +120,7 @@ static int usbhost_waiter(int argc, char *argv[]) { /* Yes.. enumerate the newly connected device */ - (void)DRVR_ENUMERATE(g_drvr); + (void)DRVR_ENUMERATE(g_drvr, 0); } } diff --git a/configs/stm3240g-eval/src/up_usb.c b/configs/stm3240g-eval/src/up_usb.c index b9082cbe75..c69a017bbd 100644 --- a/configs/stm3240g-eval/src/up_usb.c +++ b/configs/stm3240g-eval/src/up_usb.c @@ -108,7 +108,7 @@ static int usbhost_waiter(int argc, char *argv[]) { /* Wait for the device to change state */ - ret = DRVR_WAIT(g_drvr, connected); + ret = DRVR_WAIT(g_drvr, &connected); DEBUGASSERT(ret == OK); connected = !connected; @@ -120,7 +120,7 @@ static int usbhost_waiter(int argc, char *argv[]) { /* Yes.. enumerate the newly connected device */ - (void)DRVR_ENUMERATE(g_drvr); + (void)DRVR_ENUMERATE(g_drvr, 0); } } diff --git a/configs/stm32f4discovery/src/up_usb.c b/configs/stm32f4discovery/src/up_usb.c index 4a52681556..166f4e7a97 100644 --- a/configs/stm32f4discovery/src/up_usb.c +++ b/configs/stm32f4discovery/src/up_usb.c @@ -108,7 +108,7 @@ static int usbhost_waiter(int argc, char *argv[]) { /* Wait for the device to change state */ - ret = DRVR_WAIT(g_drvr, connected); + ret = DRVR_WAIT(g_drvr, &connected); DEBUGASSERT(ret == OK); connected = !connected; @@ -120,7 +120,7 @@ static int usbhost_waiter(int argc, char *argv[]) { /* Yes.. enumerate the newly connected device */ - (void)DRVR_ENUMERATE(g_drvr); + (void)DRVR_ENUMERATE(g_drvr, 0); } } diff --git a/configs/sure-pic32mx/src/pic32mx_nsh.c b/configs/sure-pic32mx/src/pic32mx_nsh.c index 294afcb798..b9ea90dba4 100644 --- a/configs/sure-pic32mx/src/pic32mx_nsh.c +++ b/configs/sure-pic32mx/src/pic32mx_nsh.c @@ -1,7 +1,7 @@ /**************************************************************************** * config/sure-pic32mx/src/pic32mx_nsh.c * - * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2011-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -188,7 +188,7 @@ static int nsh_waiter(int argc, char *argv[]) { /* Wait for the device to change state */ - ret = DRVR_WAIT(g_drvr, connected); + ret = DRVR_WAIT(g_drvr, &connected); DEBUGASSERT(ret == OK); connected = !connected; @@ -200,7 +200,7 @@ static int nsh_waiter(int argc, char *argv[]) { /* Yes.. enumerate the newly connected device */ - (void)DRVR_ENUMERATE(g_drvr); + (void)DRVR_ENUMERATE(g_drvr, 0); } }