First of several changes needed to support multiple USB host root hubs

This commit is contained in:
Gregory Nutt
2013-08-12 14:44:06 -06:00
parent e47dba5d22
commit 3fbe4dd685
13 changed files with 35 additions and 30 deletions
+2 -2
View File
@@ -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);
} }
} }
+2 -2
View File
@@ -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);
} }
} }
+2 -2
View File
@@ -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);
} }
} }
+2 -2
View File
@@ -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);
} }
} }
+2 -2
View File
@@ -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);
} }
} }
+2 -2
View File
@@ -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);
} }
} }
+11 -6
View File
@@ -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);
} }
} }
+1 -1
View File
@@ -293,7 +293,7 @@
PIO_PORT_PIOD | PIO_PIN27) PIO_PORT_PIOD | PIO_PIN27)
/* Both Ports B and C /* Both Ports B and C
* *
* PIO Signal Name Function * PIO Signal Name Function
* ---- ----------- ------------------------------------------------------- * ---- ----------- -------------------------------------------------------
* PD28 OVCUR_USB Combined overrcurrent indication from port A and B * PD28 OVCUR_USB Combined overrcurrent indication from port A and B
+2 -2
View File
@@ -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);
} }
} }
+2 -2
View File
@@ -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);
} }
} }
+2 -2
View File
@@ -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);
} }
} }
+2 -2
View File
@@ -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);
} }
} }
+3 -3
View File
@@ -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);
} }
} }