mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 00:14:22 +08:00
First of several changes needed to support multiple USB host root hubs
This commit is contained in:
@@ -109,7 +109,7 @@ static int usbhost_waiter(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
/* Wait for the device to change state */
|
/* Wait for the device to change state */
|
||||||
|
|
||||||
ret = DRVR_WAIT(g_drvr, connected);
|
ret = DRVR_WAIT(g_drvr, &connected);
|
||||||
DEBUGASSERT(ret == OK);
|
DEBUGASSERT(ret == OK);
|
||||||
|
|
||||||
connected = !connected;
|
connected = !connected;
|
||||||
@@ -121,7 +121,7 @@ static int usbhost_waiter(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
/* Yes.. enumerate the newly connected device */
|
/* Yes.. enumerate the newly connected device */
|
||||||
|
|
||||||
(void)DRVR_ENUMERATE(g_drvr);
|
(void)DRVR_ENUMERATE(g_drvr, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ static int usbhost_waiter(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
/* Wait for the device to change state */
|
/* Wait for the device to change state */
|
||||||
|
|
||||||
ret = DRVR_WAIT(g_drvr, connected);
|
ret = DRVR_WAIT(g_drvr, &connected);
|
||||||
DEBUGASSERT(ret == OK);
|
DEBUGASSERT(ret == OK);
|
||||||
|
|
||||||
connected = !connected;
|
connected = !connected;
|
||||||
@@ -120,7 +120,7 @@ static int usbhost_waiter(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
/* Yes.. enumerate the newly connected device */
|
/* Yes.. enumerate the newly connected device */
|
||||||
|
|
||||||
(void)DRVR_ENUMERATE(g_drvr);
|
(void)DRVR_ENUMERATE(g_drvr, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ static int nsh_waiter(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
/* Wait for the device to change state */
|
/* Wait for the device to change state */
|
||||||
|
|
||||||
ret = DRVR_WAIT(g_drvr, connected);
|
ret = DRVR_WAIT(g_drvr, &connected);
|
||||||
DEBUGASSERT(ret == OK);
|
DEBUGASSERT(ret == OK);
|
||||||
|
|
||||||
connected = !connected;
|
connected = !connected;
|
||||||
@@ -181,7 +181,7 @@ static int nsh_waiter(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
/* Yes.. enumerate the newly connected device */
|
/* Yes.. enumerate the newly connected device */
|
||||||
|
|
||||||
(void)DRVR_ENUMERATE(g_drvr);
|
(void)DRVR_ENUMERATE(g_drvr, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ static int nsh_waiter(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
/* Wait for the device to change state */
|
/* Wait for the device to change state */
|
||||||
|
|
||||||
ret = DRVR_WAIT(g_drvr, connected);
|
ret = DRVR_WAIT(g_drvr, &connected);
|
||||||
DEBUGASSERT(ret == OK);
|
DEBUGASSERT(ret == OK);
|
||||||
|
|
||||||
connected = !connected;
|
connected = !connected;
|
||||||
@@ -205,7 +205,7 @@ static int nsh_waiter(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
/* Yes.. enumerate the newly connected device */
|
/* Yes.. enumerate the newly connected device */
|
||||||
|
|
||||||
(void)DRVR_ENUMERATE(g_drvr);
|
(void)DRVR_ENUMERATE(g_drvr, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ static int nsh_waiter(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
/* Wait for the device to change state */
|
/* Wait for the device to change state */
|
||||||
|
|
||||||
ret = DRVR_WAIT(g_drvr, connected);
|
ret = DRVR_WAIT(g_drvr, &connected);
|
||||||
DEBUGASSERT(ret == OK);
|
DEBUGASSERT(ret == OK);
|
||||||
|
|
||||||
connected = !connected;
|
connected = !connected;
|
||||||
@@ -209,7 +209,7 @@ static int nsh_waiter(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
/* Yes.. enumerate the newly connected device */
|
/* Yes.. enumerate the newly connected device */
|
||||||
|
|
||||||
(void)DRVR_ENUMERATE(g_drvr);
|
(void)DRVR_ENUMERATE(g_drvr, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ static int nsh_waiter(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
/* Wait for the device to change state */
|
/* Wait for the device to change state */
|
||||||
|
|
||||||
ret = DRVR_WAIT(g_drvr, connected);
|
ret = DRVR_WAIT(g_drvr, &connected);
|
||||||
DEBUGASSERT(ret == OK);
|
DEBUGASSERT(ret == OK);
|
||||||
|
|
||||||
connected = !connected;
|
connected = !connected;
|
||||||
@@ -208,7 +208,7 @@ static int nsh_waiter(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
/* Yes.. enumerate the newly connected device */
|
/* Yes.. enumerate the newly connected device */
|
||||||
|
|
||||||
(void)DRVR_ENUMERATE(g_drvr);
|
(void)DRVR_ENUMERATE(g_drvr, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,6 +54,7 @@
|
|||||||
#include "up_arch.h"
|
#include "up_arch.h"
|
||||||
#include "sam_pio.h"
|
#include "sam_pio.h"
|
||||||
#include "sam_usbhost.h"
|
#include "sam_usbhost.h"
|
||||||
|
#include "chip/sam_ohci.h"
|
||||||
#include "sama5d3x-ek.h"
|
#include "sama5d3x-ek.h"
|
||||||
|
|
||||||
#if defined(CONFIG_SAMA5_UHPHS) || defined(CONFIG_SAMA5_UDPHS)
|
#if defined(CONFIG_SAMA5_UHPHS) || defined(CONFIG_SAMA5_UDPHS)
|
||||||
@@ -97,25 +98,29 @@ static struct usbhost_driver_s *g_ehci;
|
|||||||
#if HAVE_USBHOST
|
#if HAVE_USBHOST
|
||||||
static int usbhost_waiter(struct usbhost_driver_s *dev)
|
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");
|
uvdbg("Running\n");
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
/* Wait for the device to change state */
|
/* 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;
|
connected[rhpndx] = !connected[rhpndx];
|
||||||
uvdbg("%s\n", connected ? "connected" : "disconnected");
|
|
||||||
|
uvdbg("RHport%d %s\n",
|
||||||
|
rhpndx + 1, connected[rhpndx] ? "connected" : "disconnected");
|
||||||
|
|
||||||
/* Did we just become connected? */
|
/* Did we just become connected? */
|
||||||
|
|
||||||
if (connected)
|
if (connected[rhpndx])
|
||||||
{
|
{
|
||||||
/* Yes.. enumerate the newly connected device */
|
/* Yes.. enumerate the newly connected device */
|
||||||
|
|
||||||
(void)DRVR_ENUMERATE(dev);
|
(void)DRVR_ENUMERATE(dev, rhpndx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ static int usbhost_waiter(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
/* Wait for the device to change state */
|
/* Wait for the device to change state */
|
||||||
|
|
||||||
ret = DRVR_WAIT(g_drvr, connected);
|
ret = DRVR_WAIT(g_drvr, &connected);
|
||||||
DEBUGASSERT(ret == OK);
|
DEBUGASSERT(ret == OK);
|
||||||
|
|
||||||
connected = !connected;
|
connected = !connected;
|
||||||
@@ -120,7 +120,7 @@ static int usbhost_waiter(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
/* Yes.. enumerate the newly connected device */
|
/* Yes.. enumerate the newly connected device */
|
||||||
|
|
||||||
(void)DRVR_ENUMERATE(g_drvr);
|
(void)DRVR_ENUMERATE(g_drvr, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ static int usbhost_waiter(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
/* Wait for the device to change state */
|
/* Wait for the device to change state */
|
||||||
|
|
||||||
ret = DRVR_WAIT(g_drvr, connected);
|
ret = DRVR_WAIT(g_drvr, &connected);
|
||||||
DEBUGASSERT(ret == OK);
|
DEBUGASSERT(ret == OK);
|
||||||
|
|
||||||
connected = !connected;
|
connected = !connected;
|
||||||
@@ -120,7 +120,7 @@ static int usbhost_waiter(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
/* Yes.. enumerate the newly connected device */
|
/* Yes.. enumerate the newly connected device */
|
||||||
|
|
||||||
(void)DRVR_ENUMERATE(g_drvr);
|
(void)DRVR_ENUMERATE(g_drvr, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ static int usbhost_waiter(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
/* Wait for the device to change state */
|
/* Wait for the device to change state */
|
||||||
|
|
||||||
ret = DRVR_WAIT(g_drvr, connected);
|
ret = DRVR_WAIT(g_drvr, &connected);
|
||||||
DEBUGASSERT(ret == OK);
|
DEBUGASSERT(ret == OK);
|
||||||
|
|
||||||
connected = !connected;
|
connected = !connected;
|
||||||
@@ -120,7 +120,7 @@ static int usbhost_waiter(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
/* Yes.. enumerate the newly connected device */
|
/* Yes.. enumerate the newly connected device */
|
||||||
|
|
||||||
(void)DRVR_ENUMERATE(g_drvr);
|
(void)DRVR_ENUMERATE(g_drvr, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ static int usbhost_waiter(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
/* Wait for the device to change state */
|
/* Wait for the device to change state */
|
||||||
|
|
||||||
ret = DRVR_WAIT(g_drvr, connected);
|
ret = DRVR_WAIT(g_drvr, &connected);
|
||||||
DEBUGASSERT(ret == OK);
|
DEBUGASSERT(ret == OK);
|
||||||
|
|
||||||
connected = !connected;
|
connected = !connected;
|
||||||
@@ -120,7 +120,7 @@ static int usbhost_waiter(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
/* Yes.. enumerate the newly connected device */
|
/* Yes.. enumerate the newly connected device */
|
||||||
|
|
||||||
(void)DRVR_ENUMERATE(g_drvr);
|
(void)DRVR_ENUMERATE(g_drvr, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* config/sure-pic32mx/src/pic32mx_nsh.c
|
* 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 <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* 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 */
|
/* Wait for the device to change state */
|
||||||
|
|
||||||
ret = DRVR_WAIT(g_drvr, connected);
|
ret = DRVR_WAIT(g_drvr, &connected);
|
||||||
DEBUGASSERT(ret == OK);
|
DEBUGASSERT(ret == OK);
|
||||||
|
|
||||||
connected = !connected;
|
connected = !connected;
|
||||||
@@ -200,7 +200,7 @@ static int nsh_waiter(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
/* Yes.. enumerate the newly connected device */
|
/* Yes.. enumerate the newly connected device */
|
||||||
|
|
||||||
(void)DRVR_ENUMERATE(g_drvr);
|
(void)DRVR_ENUMERATE(g_drvr, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user