Add USB hub initialization logic to a couple of board configurations

This commit is contained in:
Gregory Nutt 2015-04-21 13:44:14 -06:00
parent db59d0a2e5
commit 44ac65e8ed
5 changed files with 53 additions and 4 deletions

View File

@ -39,6 +39,9 @@
#include <nuttx/config.h>
#include <errno.h>
#include <debug.h>
#include <nuttx/usb/usbhost.h>
#include "lpc17_usbhost.h"
@ -66,6 +69,18 @@
struct usbhost_connection_s *arch_usbhost_initialize(void)
{
#ifdef CONFIG_USBHOST_HUB
int ret;
/* Initialize USB hub support */
ret = usbhost_hub_initialize();
if (ret < 0)
{
udbg("ERROR: usbhost_hub_initialize failed: %d\n", ret);
}
#endif
return lpc17_usbhost_initialize(0);
}
#endif /* CONFIG_LPC17_USBHOST && CONFIG_USBHOST && CONFIG_EXAMPLES_HIDKBD */

View File

@ -41,9 +41,9 @@
#include <stdbool.h>
#include <stdio.h>
#include <debug.h>
#include <assert.h>
#include <errno.h>
#include <debug.h>
#include <nuttx/board.h>
#include <nuttx/usb/usbhost.h>
@ -125,6 +125,16 @@ int board_tsc_setup(int minor)
if (!initialized)
{
#ifdef CONFIG_USBHOST_HUB
/* Initialize USB hub support */
ret = usbhost_hub_initialize();
if (ret < 0)
{
idbg("ERROR: usbhost_hub_initialize failed: %d\n", ret);
}
#endif
/* Initialize and register the USB HID mouse device class */
ret = usbhost_mouse_init();

View File

@ -248,6 +248,19 @@ static int nsh_usbhostinitialize(void)
*/
syslog(LOG_INFO, "Register class drivers\n");
#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
/* Initialize mass storage support */
ret = usbhost_storageinit();
if (ret != OK)
{

View File

@ -135,4 +135,5 @@ int usbmsc_archinitialize(void)
errout:
lpc17_gpiowrite(LPC1766STK_MMC_PWR, true);
return ret;}
return ret;
}

View File

@ -311,10 +311,20 @@ int sam_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)
{
udbg("ERROR: usbhost_hub_initialize failed: %d\n", ret);
}
#endif
/* Register the USB host Mass Storage Class */
ret = usbhost_storageinit();
if (ret != OK)
{