Add USB hub initialization logic to a couple of board configurations
This commit is contained in:
parent
290bebae54
commit
5c16454cdf
|
@ -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 */
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -135,4 +135,5 @@ int usbmsc_archinitialize(void)
|
|||
|
||||
errout:
|
||||
lpc17_gpiowrite(LPC1766STK_MMC_PWR, true);
|
||||
return ret;}
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -1341,7 +1341,7 @@ static int usbhost_disconnected(struct usbhost_class_s *hubclass)
|
|||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: usbhost_hubinit
|
||||
* Name: usbhost_hub_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the USB hub class. This function should be called
|
||||
|
@ -1357,7 +1357,7 @@ static int usbhost_disconnected(struct usbhost_class_s *hubclass)
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
int usbhost_hubinit(void)
|
||||
int usbhost_hub_initialize(void)
|
||||
{
|
||||
/* Advertise our availability to support (certain) mass storage devices */
|
||||
|
||||
|
|
|
@ -865,8 +865,8 @@ int usbhost_registerclass(struct usbhost_registry_s *devclass);
|
|||
const struct usbhost_registry_s *usbhost_findclass(const struct usbhost_id_s *id);
|
||||
|
||||
#ifdef CONFIG_USBHOST_HUB
|
||||
/****************************************************************************
|
||||
* Name: usbhost_hubinit
|
||||
/****************************************************************************
|
||||
* Name: usbhost_hub_initialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the USB hub class. This function should be called
|
||||
|
@ -882,7 +882,7 @@ const struct usbhost_registry_s *usbhost_findclass(const struct usbhost_id_s *id
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
int usbhost_hubinit(void);
|
||||
int usbhost_hub_initialize(void);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USBHOST_MSC
|
||||
|
|
Loading…
Reference in New Issue