Add logic to register the hub class to all board logic that initialize USB host

This commit is contained in:
Gregory Nutt 2015-04-28 11:53:26 -06:00
parent 5b80b257ce
commit 1441689cc9
5 changed files with 55 additions and 7 deletions

View File

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

View File

@ -39,7 +39,6 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#include <errno.h>
#include <debug.h> #include <debug.h>
#include <nuttx/usb/usbhost.h> #include <nuttx/usb/usbhost.h>

View File

@ -1,7 +1,7 @@
/************************************************************************************ /************************************************************************************
* configs/olimex-stm32-p207/src/stm32_usb.c * configs/olimex-stm32-p207/src/stm32_usb.c
* *
* Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. * Copyright (C) 2012-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
@ -175,6 +175,18 @@ int stm32_usbhost_initialize(void)
* that we care about: * that we care about:
*/ */
#ifdef CONFIG_USBHOST_HUB
/* Initialize USB hub class support */
ret = usbhost_hub_initialize();
if (ret < 0)
{
udbg("ERROR: usbhost_hub_initialize failed: %d\n", ret);
}
#endif
/* Initialize Mass Storage Class support */
uvdbg("Register class drivers\n"); uvdbg("Register class drivers\n");
ret = usbhost_storageinit(); ret = usbhost_storageinit();
if (ret != OK) if (ret != OK)

View File

@ -1,7 +1,7 @@
/************************************************************************************ /************************************************************************************
* configs/sama5d3x-ek/src/sam_usb.c * configs/sama5d3x-ek/src/sam_usb.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
@ -309,11 +309,21 @@ int sam_usbhost_initialize(void)
int ret; int ret;
/* 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 class 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(); ret = usbhost_storageinit();
if (ret != OK) if (ret != OK)
{ {

View File

@ -1,7 +1,7 @@
/************************************************************************************ /************************************************************************************
* configs/stm32f429i-disco/src/stm32_usbdev.c * configs/stm32f429i-disco/src/stm32_usbdev.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
@ -177,6 +177,19 @@ int stm32_usbhost_initialize(void)
*/ */
uvdbg("Register class drivers\n"); uvdbg("Register class drivers\n");
#ifdef CONFIG_USBHOST_HUB
/* Initialize USB hub class 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(); ret = usbhost_storageinit();
if (ret != OK) if (ret != OK)
{ {