LPC31: Port hub registration logic from Olimex H3131 to EA3131

This commit is contained in:
Gregory Nutt 2015-04-27 15:50:40 -06:00
parent d96ddb61f5
commit 6d574043b8
2 changed files with 25 additions and 29 deletions

View File

@ -1,7 +1,7 @@
/************************************************************************************
* configs/ea3131/src/lpc31_usbhost.c
*
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
* Copyright (C) 2013, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -70,10 +70,6 @@
# define CONFIG_USBHOST_STACKSIZE 1024
#endif
#ifdef HAVE_USBDEV
# undef CONFIG_LPC31_USBOTG_RHPORT1
#endif
/************************************************************************************
* Private Data
************************************************************************************/
@ -101,35 +97,24 @@ static xcpt_t g_ochandler;
static int ehci_waiter(int argc, char *argv[])
{
bool connected = false;
int rhpndx;
int ret;
FAR struct usbhost_hubport_s *hport;
uvdbg("Waiter Running\n");
uvdbg("ehci_waiter: Running\n");
for (;;)
{
/* Wait for the device to change state */
rhpndx = CONN_WAIT(g_ehciconn, &connected);
DEBUGASSERT(rhpndx >= 0 && rhpndx < 1);
connected = !connected;
uvdbg("RHport1 %s\n",
connected ? "connected" : "disconnected");
DEBUGVERIFY(CONN_WAIT(g_ehciconn, &hport));
syslog(LOG_INFO, "ehci_waiter: %s\n",
hport->connected ? "connected" : "disconnected");
/* Did we just become connected? */
if (connected)
if (hport->connected)
{
/* Yes.. enumerate the newly connected device */
ret = CONN_ENUMERATE(g_ehciconn, rhpndx);
if (ret < 0)
{
uvdbg("RHport1 CONN_ENUMERATE failed: %d\n", ret);
connected = false;
}
(void)CONN_ENUMERATE(g_ehciconn, hport);
}
}
@ -188,11 +173,21 @@ int lpc31_usbhost_initialize(void)
/* First, register all of the class drivers needed to support the drivers
* that we care about
*
* Register theUSB host Mass Storage Class:
*/
#ifdef CONFIG_USBHOST_HUB
/* Initialize USB hub support */
ret = usbhost_hub_initialize();
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: usbhost_hub_initialize failed: %d\n", ret);
}
#endif
#ifdef CONFIG_USBHOST_MSC
/* Register theUSB host Mass Storage Class */
ret = usbhost_storageinit();
if (ret != OK)
{
@ -200,9 +195,9 @@ int lpc31_usbhost_initialize(void)
}
#endif
#ifdef CONFIG_USBHOST_HIDKBD
/* Register the USB host HID keyboard class driver */
#ifdef CONFIG_USBHOST_HIDKBD
ret = usbhost_kbdinit();
if (ret != OK)
{
@ -240,8 +235,9 @@ int lpc31_usbhost_initialize(void)
* each platform that implements the OHCI or EHCI host interface
*
* Input Parameters:
* rhport - Selects root hub port to be powered host interface. See SAM_RHPORT_*
* definitions above.
* rhport - Selects root hub port to be powered host interface. Since the LPC31
* has only a downstream port, zero is the only possible value for this
* parameter.
* enable - true: enable VBUS power; false: disable VBUS power
*
* Returned Value:

View File

@ -1,7 +1,7 @@
/************************************************************************************
* configs/olimex-lpc-h3131/src/lpc31_usbhost.c
*
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
* Copyright (C) 2013, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without