summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsakumisu <[email protected]>2022-12-03 19:31:39 +0800
committersakumisu <[email protected]>2022-12-03 19:31:39 +0800
commited323a6fa4214b6a5090e82efa78ba015812c3d5 (patch)
tree4d1d65531ec13cd06abb5ef319b381e969286b2d
parent77f0afb94fe6c1660753eb08652888a8435140ba (diff)
disable ext hub when CONFIG_USBHOST_MAX_EXTHUBS = 0
-rw-r--r--class/hub/usbh_hub.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/class/hub/usbh_hub.c b/class/hub/usbh_hub.c
index e7af8299..f07f328c 100644
--- a/class/hub/usbh_hub.c
+++ b/class/hub/usbh_hub.c
@@ -25,14 +25,16 @@ usb_osal_thread_t hub_thread;
USB_NOCACHE_RAM_SECTION struct usbh_hub roothub;
+#if CONFIG_USBHOST_MAX_EXTHUBS > 0
USB_NOCACHE_RAM_SECTION struct usbh_hub exthub[CONFIG_USBHOST_MAX_EXTHUBS];
-
+#endif
extern int usbh_hport_activate_ep0(struct usbh_hubport *hport);
extern int usbh_hport_deactivate_ep0(struct usbh_hubport *hport);
extern int usbh_enumerate(struct usbh_hubport *hport);
static const char *speed_table[] = { "error-speed", "low-speed", "full-speed", "high-speed", "wireless-speed", "super-speed", "superplus-speed" };
+#if CONFIG_USBHOST_MAX_EXTHUBS > 0
static int usbh_hub_devno_alloc(void)
{
int devno;
@@ -54,7 +56,7 @@ static void usbh_hub_devno_free(uint8_t devno)
g_devinuse &= ~(1 << devno);
}
}
-
+#endif
static int _usbh_hub_get_hub_descriptor(struct usbh_hub *hub, uint8_t *buffer)
{
struct usb_setup_packet *setup;
@@ -238,7 +240,7 @@ static void hub_int_complete_callback(void *arg, int nbytes)
usbh_hub_thread_wakeup(hub);
}
}
-
+#if CONFIG_USBHOST_MAX_EXTHUBS > 0
static int usbh_hub_connect(struct usbh_hubport *hport, uint8_t intf)
{
struct usb_endpoint_descriptor *ep_desc;
@@ -341,7 +343,7 @@ static int usbh_hub_disconnect(struct usbh_hubport *hport, uint8_t intf)
}
return ret;
}
-
+#endif
static void usbh_roothub_register(void)
{
memset(&roothub, 0, sizeof(struct usbh_hub));
@@ -572,7 +574,7 @@ int usbh_hub_initialize(void)
}
return 0;
}
-
+#if CONFIG_USBHOST_MAX_EXTHUBS > 0
const struct usbh_class_driver hub_driver = {
.driver_name = "hub",
.connect = usbh_hub_connect,
@@ -588,3 +590,4 @@ CLASS_INFO_DEFINE const struct usbh_class_info hub_info = {
.pid = 0x00,
.class_driver = &hub_driver
};
+#endif \ No newline at end of file