Separate wait() and enumerate() methods from struct usbhost_driver_s and move to new interface, struct usbhost_connection_s. This is part of the necessary restructuring of the USB host interface to support multiple root hub ports.
This commit is contained in:
parent
f76d80ca1d
commit
567c513046
@ -83,7 +83,7 @@
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_USBHOST
|
||||
static struct usbhost_driver_s *g_drvr;
|
||||
static struct usbhost_connection_s *g_usbconn;
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
@ -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 = CONN_WAIT(g_usbconn, &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, 0);
|
||||
(void)CONN_ENUMERATE(g_usbconn, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -187,8 +187,8 @@ int stm32_usbhost_initialize(void)
|
||||
/* Then get an instance of the USB host interface */
|
||||
|
||||
uvdbg("Initialize USB host\n");
|
||||
g_drvr = stm32_otgfshost_initialize(0);
|
||||
if (g_drvr)
|
||||
g_usbconn = stm32_otgfshost_initialize(0);
|
||||
if (g_usbconn)
|
||||
{
|
||||
/* Start a thread to handle device connection. */
|
||||
|
||||
|
@ -82,7 +82,7 @@
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_USBHOST
|
||||
static struct usbhost_driver_s *g_drvr;
|
||||
static struct usbhost_connection_s *g_usbconn;
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
@ -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 = CONN_WAIT(g_usbconn, &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, 0);
|
||||
(void)CONN_ENUMERATE(g_usbconn, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -186,8 +186,8 @@ int stm32_usbhost_initialize(void)
|
||||
/* Then get an instance of the USB host interface */
|
||||
|
||||
uvdbg("Initialize USB host\n");
|
||||
g_drvr = stm32_otgfshost_initialize(0);
|
||||
if (g_drvr)
|
||||
g_usbconn = stm32_otgfshost_initialize(0);
|
||||
if (g_usbconn)
|
||||
{
|
||||
/* Start a thread to handle device connection. */
|
||||
|
||||
|
@ -143,7 +143,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef NSH_HAVEUSBHOST
|
||||
static struct usbhost_driver_s *g_drvr;
|
||||
static struct usbhost_connection_s *g_usbconn;
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
@ -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 = CONN_WAIT(g_usbconn, &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, 0);
|
||||
(void)CONN_ENUMERATE(g_usbconn, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -279,8 +279,8 @@ static int nsh_usbhostinitialize(void)
|
||||
/* Then get an instance of the USB host interface */
|
||||
|
||||
message("nsh_usbhostinitialize: Initialize USB host\n");
|
||||
g_drvr = usbhost_initialize(0);
|
||||
if (g_drvr)
|
||||
g_usbconn = usbhost_initialize(0);
|
||||
if (g_usbconn)
|
||||
{
|
||||
/* Start a thread to handle device connection. */
|
||||
|
||||
|
@ -164,7 +164,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef NSH_HAVE_USBHOST
|
||||
static struct usbhost_driver_s *g_drvr;
|
||||
static struct usbhost_connection_s *g_usbconn;
|
||||
#endif
|
||||
#ifdef NSH_HAVE_MMCSD
|
||||
static FAR struct sdio_dev_s *g_sdiodev;
|
||||
@ -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 = CONN_WAIT(g_usbconn, &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, 0);
|
||||
(void)CONN_ENUMERATE(g_usbconn, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -336,8 +336,8 @@ static int nsh_usbhostinitialize(void)
|
||||
/* Then get an instance of the USB host interface */
|
||||
|
||||
message("nsh_usbhostinitialize: Initialize USB host\n");
|
||||
g_drvr = usbhost_initialize(0);
|
||||
if (g_drvr)
|
||||
g_usbconn = usbhost_initialize(0);
|
||||
if (g_usbconn)
|
||||
{
|
||||
/* Start a thread to handle device connection. */
|
||||
|
||||
|
@ -171,7 +171,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef NSH_HAVEUSBHOST
|
||||
static struct usbhost_driver_s *g_drvr;
|
||||
static struct usbhost_connection_s *g_usbconn;
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
@ -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 = CONN_WAIT(g_usbconn, &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, 0);
|
||||
(void)CONN_ENUMERATE(g_usbconn, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -300,8 +300,8 @@ static int nsh_usbhostinitialize(void)
|
||||
/* Then get an instance of the USB host interface */
|
||||
|
||||
message("nsh_usbhostinitialize: Initialize USB host\n");
|
||||
g_drvr = usbhost_initialize(0);
|
||||
if (g_drvr)
|
||||
g_usbconn = usbhost_initialize(0);
|
||||
if (g_usbconn)
|
||||
{
|
||||
/* Start a thread to handle device connection. */
|
||||
|
||||
|
@ -170,7 +170,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef NSH_HAVEUSBHOST
|
||||
static struct usbhost_driver_s *g_drvr;
|
||||
static struct usbhost_connection_s *g_usbconn;
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
@ -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 = CONN_WAIT(g_usbconn, &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, 0);
|
||||
(void)CONN_ENUMERATE(g_usbconn, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -308,8 +308,8 @@ static int nsh_usbhostinitialize(void)
|
||||
/* Then get an instance of the USB host interface */
|
||||
|
||||
message("nsh_usbhostinitialize: Initialize USB host\n");
|
||||
g_drvr = usbhost_initialize(0);
|
||||
if (g_drvr)
|
||||
g_usbconn = usbhost_initialize(0);
|
||||
if (g_usbconn)
|
||||
{
|
||||
/* Start a thread to handle device connection. */
|
||||
|
||||
|
@ -77,10 +77,10 @@
|
||||
/* Retained device driver handles */
|
||||
|
||||
#ifdef CONFIG_SAMA5_OHCI
|
||||
static struct usbhost_driver_s *g_ohci;
|
||||
static struct usbhost_connection_s *g_ohciconn;
|
||||
#endif
|
||||
#ifdef CONFIG_SAMA5_EHCI
|
||||
static struct usbhost_driver_s *g_ehci;
|
||||
static struct usbhost_connection_s *g_ehciconn;
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
@ -96,7 +96,7 @@ static struct usbhost_driver_s *g_ehci;
|
||||
************************************************************************************/
|
||||
|
||||
#if HAVE_USBHOST
|
||||
static int usbhost_waiter(struct usbhost_driver_s *dev)
|
||||
static int usbhost_waiter(struct usbhost_connection_s *dev)
|
||||
{
|
||||
bool connected[SAM_USBHOST_NRHPORT] = {false, false, false};
|
||||
int rhpndx;
|
||||
@ -106,7 +106,7 @@ static int usbhost_waiter(struct usbhost_driver_s *dev)
|
||||
{
|
||||
/* Wait for the device to change state */
|
||||
|
||||
rhpndx = DRVR_WAIT(dev, connected);
|
||||
rhpndx = CONN_WAIT(dev, connected);
|
||||
DEBUGASSERT(rhpndx >= 0 && rhpndx < SAM_USBHOST_NRHPORT);
|
||||
|
||||
connected[rhpndx] = !connected[rhpndx];
|
||||
@ -120,7 +120,7 @@ static int usbhost_waiter(struct usbhost_driver_s *dev)
|
||||
{
|
||||
/* Yes.. enumerate the newly connected device */
|
||||
|
||||
(void)DRVR_ENUMERATE(dev, rhpndx);
|
||||
(void)CONN_ENUMERATE(dev, rhpndx);
|
||||
}
|
||||
}
|
||||
|
||||
@ -141,7 +141,7 @@ static int usbhost_waiter(struct usbhost_driver_s *dev)
|
||||
#ifdef CONFIG_SAMA5_OHCI
|
||||
static int ohci_waiter(int argc, char *argv[])
|
||||
{
|
||||
return usbhost_waiter(g_ohci);
|
||||
return usbhost_waiter(g_ohciconn);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -156,7 +156,7 @@ static int ohci_waiter(int argc, char *argv[])
|
||||
#ifdef CONFIG_SAMA5_EHCI
|
||||
static int ehci_waiter(int argc, char *argv[])
|
||||
{
|
||||
return usbhost_waiter(g_ehci);
|
||||
return usbhost_waiter(g_ehciconn);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -287,8 +287,8 @@ int sam_usbhost_initialize(void)
|
||||
#ifdef CONFIG_SAMA5_OHCI
|
||||
/* Get an instance of the USB OHCI interface */
|
||||
|
||||
g_ohci = sam_ohci_initialize(0);
|
||||
if (!g_ohci)
|
||||
g_ohciconn = sam_ohci_initialize(0);
|
||||
if (!g_ohciconn)
|
||||
{
|
||||
udbg("ERROR: sam_ohci_initialize failed\n");
|
||||
return -ENODEV;
|
||||
@ -308,8 +308,8 @@ int sam_usbhost_initialize(void)
|
||||
#ifdef CONFIG_SAMA5_EHCI
|
||||
/* Get an instance of the USB EHCI interface */
|
||||
|
||||
g_ehci = sam_ehci_initialize(0);
|
||||
if (!g_ehci)
|
||||
g_ehciconn = sam_ehci_initialize(0);
|
||||
if (!g_ehciconn)
|
||||
{
|
||||
udbg("ERROR: sam_ehci_initialize failed\n");
|
||||
return -ENODEV;
|
||||
|
@ -82,7 +82,7 @@
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_USBHOST
|
||||
static struct usbhost_driver_s *g_drvr;
|
||||
static struct usbhost_connection_s *g_usbconn;
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
@ -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 = CONN_WAIT(g_usbconn, &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, 0);
|
||||
(void)CONN_ENUMERATE(g_usbconn, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -186,8 +186,8 @@ int stm32_usbhost_initialize(void)
|
||||
/* Then get an instance of the USB host interface */
|
||||
|
||||
uvdbg("Initialize USB host\n");
|
||||
g_drvr = stm32_otgfshost_initialize(0);
|
||||
if (g_drvr)
|
||||
g_usbconn = stm32_otgfshost_initialize(0);
|
||||
if (g_usbconn)
|
||||
{
|
||||
/* Start a thread to handle device connection. */
|
||||
|
||||
|
@ -82,7 +82,7 @@
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_USBHOST
|
||||
static struct usbhost_driver_s *g_drvr;
|
||||
static struct usbhost_connection_s *g_usbconn;
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
@ -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 = CONN_WAIT(g_usbconn, &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, 0);
|
||||
(void)CONN_ENUMERATE(g_usbconn, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -186,8 +186,8 @@ int stm32_usbhost_initialize(void)
|
||||
/* Then get an instance of the USB host interface */
|
||||
|
||||
uvdbg("Initialize USB host\n");
|
||||
g_drvr = stm32_otgfshost_initialize(0);
|
||||
if (g_drvr)
|
||||
g_usbconn = stm32_otgfshost_initialize(0);
|
||||
if (g_usbconn)
|
||||
{
|
||||
/* Start a thread to handle device connection. */
|
||||
|
||||
|
@ -82,7 +82,7 @@
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_USBHOST
|
||||
static struct usbhost_driver_s *g_drvr;
|
||||
static struct usbhost_connection_s *g_usbconn;
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
@ -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 = CONN_WAIT(g_usbconn, &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, 0);
|
||||
(void)CONN_ENUMERATE(g_usbconn, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -186,8 +186,8 @@ int stm32_usbhost_initialize(void)
|
||||
/* Then get an instance of the USB host interface */
|
||||
|
||||
uvdbg("Initialize USB host\n");
|
||||
g_drvr = stm32_otgfshost_initialize(0);
|
||||
if (g_drvr)
|
||||
g_usbconn = stm32_otgfshost_initialize(0);
|
||||
if (g_usbconn)
|
||||
{
|
||||
/* Start a thread to handle device connection. */
|
||||
|
||||
|
@ -82,7 +82,7 @@
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_USBHOST
|
||||
static struct usbhost_driver_s *g_drvr;
|
||||
static struct usbhost_connection_s *g_usbconn;
|
||||
#endif
|
||||
|
||||
/************************************************************************************
|
||||
@ -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 = CONN_WAIT(g_usbconn, &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, 0);
|
||||
(void)CONN_ENUMERATE(g_usbconn, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -186,8 +186,8 @@ int stm32_usbhost_initialize(void)
|
||||
/* Then get an instance of the USB host interface */
|
||||
|
||||
uvdbg("Initialize USB host\n");
|
||||
g_drvr = stm32_otgfshost_initialize(0);
|
||||
if (g_drvr)
|
||||
g_usbconn = stm32_otgfshost_initialize(0);
|
||||
if (g_usbconn)
|
||||
{
|
||||
/* Start a thread to handle device connection. */
|
||||
|
||||
|
@ -162,7 +162,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef NSH_HAVE_USBHOST
|
||||
static struct usbhost_driver_s *g_drvr;
|
||||
static struct usbhost_connection_s *g_usbconn;
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
@ -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 = CONN_WAIT(g_usbconn, &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, 0);
|
||||
(void)CONN_ENUMERATE(g_usbconn, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -300,8 +300,8 @@ static int nsh_usbhostinitialize(void)
|
||||
/* Then get an instance of the USB host interface */
|
||||
|
||||
message("nsh_usbhostinitialize: Initialize USB host\n");
|
||||
g_drvr = usbhost_initialize(0);
|
||||
if (g_drvr)
|
||||
g_usbconn = usbhost_initialize(0);
|
||||
if (g_usbconn)
|
||||
{
|
||||
/* Start a thread to handle device connection. */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user