mirror of
https://github.com/apache/nuttx.git
synced 2026-05-29 04:19:37 +08:00
Add USB hub initialization logic to a couple of board configurations
This commit is contained in:
@@ -39,6 +39,9 @@
|
|||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
#include <nuttx/usb/usbhost.h>
|
#include <nuttx/usb/usbhost.h>
|
||||||
|
|
||||||
#include "lpc17_usbhost.h"
|
#include "lpc17_usbhost.h"
|
||||||
@@ -66,6 +69,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 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 */
|
||||||
|
|||||||
@@ -41,9 +41,9 @@
|
|||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <debug.h>
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <debug.h>
|
||||||
|
|
||||||
#include <nuttx/board.h>
|
#include <nuttx/board.h>
|
||||||
#include <nuttx/usb/usbhost.h>
|
#include <nuttx/usb/usbhost.h>
|
||||||
@@ -125,6 +125,16 @@ int board_tsc_setup(int minor)
|
|||||||
|
|
||||||
if (!initialized)
|
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 */
|
/* Initialize and register the USB HID mouse device class */
|
||||||
|
|
||||||
ret = usbhost_mouse_init();
|
ret = usbhost_mouse_init();
|
||||||
|
|||||||
@@ -248,6 +248,19 @@ static int nsh_usbhostinitialize(void)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
syslog(LOG_INFO, "Register class drivers\n");
|
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();
|
ret = usbhost_storageinit();
|
||||||
if (ret != OK)
|
if (ret != OK)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -135,4 +135,5 @@ int usbmsc_archinitialize(void)
|
|||||||
|
|
||||||
errout:
|
errout:
|
||||||
lpc17_gpiowrite(LPC1766STK_MMC_PWR, true);
|
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
|
/* 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)
|
||||||
|
{
|
||||||
|
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)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1341,7 +1341,7 @@ static int usbhost_disconnected(struct usbhost_class_s *hubclass)
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: usbhost_hubinit
|
* Name: usbhost_hub_initialize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Initialize the USB hub class. This function should be called
|
* 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 */
|
/* 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);
|
const struct usbhost_registry_s *usbhost_findclass(const struct usbhost_id_s *id);
|
||||||
|
|
||||||
#ifdef CONFIG_USBHOST_HUB
|
#ifdef CONFIG_USBHOST_HUB
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: usbhost_hubinit
|
* Name: usbhost_hub_initialize
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Initialize the USB hub class. This function should be called
|
* 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
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_USBHOST_MSC
|
#ifdef CONFIG_USBHOST_MSC
|
||||||
|
|||||||
Reference in New Issue
Block a user