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