![]()
![]()
#include "tusb_option.h"
![]()
![]()
#include "host/hcd.h"
![]()
![]()
#include "tusb.h"
![]()
![]()
#include "host/usbh_pvt.h"
![]()
![]()
#include "hub.h"
![]()
![]()
#define CFG_TUH_TASK_QUEUE_SZ
![]()
![]()
#define CFG_TUH_INTERFACE_MAX
![]()
![]()
hcd_deinit(uint8_t)
![]()
![]()
hcd_configure(uint8_t, uint32_t, const void *)
![]()
![]()
tuh_event_hook_cb(uint8_t, uint32_t, bool)
![]()
![]()
usbh_dev0_t
![]()
![]()
rhport
![]()
![]()
hub_addr
![]()
![]()
hub_port
![]()
![]()
<anonymous struct>
![]()
![]()
speed
![]()
![]()
enumerating
![]()
![]()
reserved9
![]()
![]()
usbh_device_t
![]()
![]()
rhport
![]()
![]()
hub_addr
![]()
![]()
hub_port
![]()
![]()
speed
![]()
![]()
<anonymous struct>
![]()
![]()
connected
![]()
![]()
addressed
![]()
![]()
configured
![]()
![]()
suspended
![]()
![]()
ep0_size
![]()
![]()
vid
![]()
![]()
pid
![]()
![]()
i_manufacturer
![]()
![]()
i_product
![]()
![]()
i_serial
![]()
![]()
itf2drv
![]()
![]()
ep2drv
![]()
![]()
ep_status
![]()
![]()
#define DRIVER_NAME
![]()
![]()
#define DRIVER_NAME
![]()
![]()
usbh_class_drivers
![]()
![]()
<anonymous enum>
![]()
![]()
BUILTIN_DRIVER_COUNT
![]()
![]()
<anonymous enum>
![]()
![]()
CONFIG_NUM
![]()
![]()
_app_driver
![]()
![]()
_app_driver_count
![]()
![]()
#define TOTAL_DRIVER_COUNT
![]()
![]()
get_driver(uint8_t)
![]()
![]()
if
(drv_id < _app_driver_count)
![]()
![]()
else if
(drv_id < TOTAL_DRIVER_COUNT && BUILTIN_DRIVER_COUNT > 0)
![]()
![]()
#define TOTAL_DEVICES
![]()
![]()
_usbh_controller
![]()
![]()
_dev0
![]()
![]()
_usbh_devices
![]()
![]()
_usbh_mutexdef
![]()
![]()
_usbh_mutex
![]()
![]()
#define _usbh_mutex
![]()
![]()
_usbh_qdef_buf
![]()
![]()
_usbh_qdef
![]()
![]()
_usbh_q
![]()
![]()
_usbh_ctrl_buf
![]()
![]()
<anonymous struct>
![]()
![]()
request
![]()
![]()
buffer
![]()
![]()
complete_cb
![]()
![]()
user_data
![]()
![]()
daddr
![]()
![]()
stage
![]()
![]()
actual_len
![]()
![]()
_ctrl_xfer
![]()
![]()
Helper Function
![]()
![]()
get_device(uint8_t)
![]()
![]()
queue_event(const hcd_event_t *, bool)
![]()
![]()
tuh_mounted(uint8_t)
![]()
![]()
tuh_vid_pid_get(uint8_t, uint16_t *, uint16_t *)
![]()
![]()
tuh_speed_get(uint8_t)
![]()
![]()
tuh_rhport_is_active(uint8_t)
![]()
![]()
tuh_rhport_reset_bus(uint8_t, bool)
![]()
![]()
if
(active)
![]()
![]()
else
![]()
![]()
tuh_configure(uint8_t, uint32_t, const void *)
![]()
![]()
clear_device(usbh_device_t *)
![]()
![]()
tuh_inited()
![]()
![]()
tuh_init(uint8_t)
![]()
![]()
if
(!tuh_inited())
![]()
![]()
if
(usbh_app_driver_get_cb)
![]()
![]()
for
(uint8_t i = 0; i < TOTAL_DEVICES; i++)
![]()
![]()
for
(uint8_t drv_id = 0; drv_id < TOTAL_DRIVER_COUNT; drv_id++)
![]()
![]()
if
(driver)
![]()
![]()
tuh_deinit(uint8_t)
![]()
![]()
if
(!tuh_inited())
![]()
![]()
for
(uint8_t drv_id = 0; drv_id < TOTAL_DRIVER_COUNT; drv_id++)
![]()
![]()
if
(driver && driver->deinit)
![]()
![]()
tuh_task_event_ready()
![]()
![]()
tuh_task_ext(uint32_t, bool)
![]()
![]()
while
(1)
![]()
![]()
switch
(event.event_id)
![]()
![]()
case
HCD_EVENT_DEVICE_ATTACH:
![]()
![]()
if
(_dev0.enumerating)
![]()
![]()
if
(is_empty)
![]()
![]()
else
![]()
![]()
case
HCD_EVENT_DEVICE_REMOVE:
![]()
![]()
if
(event.connection.hub_addr != 0 && event.connection.hub_port != 0)
![]()
![]()
case
HCD_EVENT_XFER_COMPLETE:
![]()
![]()
if
(event.dev_addr == 0)
![]()
![]()
else
![]()
![]()
if
(0 == epnum)
![]()
![]()
else
![]()
![]()
if
(complete_cb)
![]()
![]()
if
(driver)
![]()
![]()
else
![]()
![]()
case
USBH_EVENT_FUNC_CALL:
![]()
![]()
default
![]()
![]()
_control_blocking_complete_cb(tuh_xfer_t *)
![]()
![]()
tuh_control_xfer(tuh_xfer_t *)
![]()
![]()
if
(daddr == 0)
![]()
![]()
else
![]()
![]()
if
(is_idle)
![]()
![]()
if
(xfer->complete_cb)
![]()
![]()
while
(result == XFER_RESULT_INVALID)
![]()
![]()
if
(tuh_task_event_ready())
![]()
![]()
if
(xfer->user_data != 0)
![]()
![]()
_set_control_xfer_stage(uint8_t)
![]()
![]()
_control_xfer_complete(uint8_t, xfer_result_t)
![]()
![]()
if
(xfer_temp.complete_cb)
![]()
![]()
usbh_control_xfer_cb(uint8_t, uint8_t, xfer_result_t, uint32_t)
![]()
![]()
if
(XFER_RESULT_SUCCESS != result)
![]()
![]()
switch
(_ctrl_xfer.stage)
![]()
![]()
case
CONTROL_STAGE_SETUP:
![]()
![]()
if
(request->wLength)
![]()
![]()
case
CONTROL_STAGE_DATA:
![]()
![]()
if
(request->wLength)
![]()
![]()
case
CONTROL_STAGE_ACK:
![]()
![]()
if
(request->bRequest == TUSB_REQ_SET_CONFIGURATION && request->bmRequestType == 0x00)
![]()
![]()
for
(uint8_t epnum=1; epnum<CFG_TUH_ENDPOINT_MAX; epnum++)
![]()
![]()
for
(uint8_t dir=0; dir<2; dir++)
![]()
![]()
default
![]()
![]()
tuh_edpt_xfer(tuh_xfer_t *)
![]()
![]()
if
(!usbh_edpt_xfer_with_callback(daddr, ep_addr, xfer->buffer, (uint16_t) xfer->buflen, xfer->complete_cb, xfer->user_data))
![]()
![]()
tuh_edpt_abort_xfer(uint8_t, uint8_t)
![]()
![]()
if
(epnum == 0)
![]()
![]()
else
![]()
![]()
usbh_get_rhport(uint8_t)
![]()
![]()
usbh_get_enum_buf()
![]()
![]()
usbh_int_set(bool)
![]()
![]()
if
(enabled)
![]()
![]()
else
![]()
![]()
usbh_defer_func(osal_task_func_t, void *, bool)
![]()
![]()
usbh_edpt_claim(uint8_t, uint8_t)
![]()
![]()
usbh_edpt_release(uint8_t, uint8_t)
![]()
![]()
usbh_edpt_xfer_with_callback(uint8_t, uint8_t, uint8_t *, uint16_t, tuh_xfer_cb_t, uintptr_t)
![]()
![]()
if
(hcd_edpt_xfer(dev->rhport, dev_addr, ep_addr, buffer, total_bytes))
![]()
![]()
else
![]()
![]()
usbh_edpt_control_open(uint8_t, uint8_t)
![]()
![]()
tuh_edpt_open(uint8_t, const tusb_desc_endpoint_t *)
![]()
![]()
usbh_edpt_busy(uint8_t, uint8_t)
![]()
![]()
hcd_devtree_get_info(uint8_t, hcd_devtree_info_t *)
![]()
![]()
if
(dev)
![]()
![]()
else
![]()
![]()
hcd_event_handler(const hcd_event_t *, bool)
![]()
![]()
switch
(event->event_id)
![]()
![]()
case
HCD_EVENT_DEVICE_REMOVE:
![]()
![]()
if
((event->rhport == _dev0.rhport) && (event->connection.hub_addr == _dev0.hub_addr) && (event->connection.hub_port == _dev0.hub_port))
![]()
![]()
default
![]()
![]()
_get_descriptor(uint8_t, uint8_t, uint8_t, uint16_t, void *, uint16_t, tuh_xfer_cb_t, uintptr_t)
![]()
![]()
tuh_descriptor_get(uint8_t, uint8_t, uint8_t, void *, uint16_t, tuh_xfer_cb_t, uintptr_t)
![]()
![]()
tuh_descriptor_get_device(uint8_t, void *, uint16_t, tuh_xfer_cb_t, uintptr_t)
![]()
![]()
tuh_descriptor_get_configuration(uint8_t, uint8_t, void *, uint16_t, tuh_xfer_cb_t, uintptr_t)
![]()
![]()
tuh_descriptor_get_string(uint8_t, uint8_t, uint16_t, void *, uint16_t, tuh_xfer_cb_t, uintptr_t)
![]()
![]()
tuh_descriptor_get_manufacturer_string(uint8_t, uint16_t, void *, uint16_t, tuh_xfer_cb_t, uintptr_t)
![]()
![]()
tuh_descriptor_get_product_string(uint8_t, uint16_t, void *, uint16_t, tuh_xfer_cb_t, uintptr_t)
![]()
![]()
tuh_descriptor_get_serial_string(uint8_t, uint16_t, void *, uint16_t, tuh_xfer_cb_t, uintptr_t)
![]()
![]()
tuh_descriptor_get_hid_report(uint8_t, uint8_t, uint8_t, uint8_t, void *, uint16_t, tuh_xfer_cb_t, uintptr_t)
![]()
![]()
tuh_configuration_set(uint8_t, uint8_t, tuh_xfer_cb_t, uintptr_t)
![]()
![]()
tuh_interface_set(uint8_t, uint8_t, uint8_t, tuh_xfer_cb_t, uintptr_t)
![]()
![]()
tuh_descriptor_get_sync(uint8_t, uint8_t, uint8_t, void *, uint16_t)
![]()
![]()
tuh_descriptor_get_device_sync(uint8_t, void *, uint16_t)
![]()
![]()
tuh_descriptor_get_configuration_sync(uint8_t, uint8_t, void *, uint16_t)
![]()
![]()
tuh_descriptor_get_hid_report_sync(uint8_t, uint8_t, uint8_t, uint8_t, void *, uint16_t)
![]()
![]()
tuh_descriptor_get_string_sync(uint8_t, uint8_t, uint16_t, void *, uint16_t)
![]()
![]()
tuh_descriptor_get_manufacturer_string_sync(uint8_t, uint16_t, void *, uint16_t)
![]()
![]()
tuh_descriptor_get_product_string_sync(uint8_t, uint16_t, void *, uint16_t)
![]()
![]()
tuh_descriptor_get_serial_string_sync(uint8_t, uint16_t, void *, uint16_t)
![]()
![]()
is_hub_addr(uint8_t)
![]()
![]()
process_removing_device(uint8_t, uint8_t, uint8_t)
![]()
![]()
for
(uint8_t dev_id = 0; dev_id < TOTAL_DEVICES; dev_id++)
![]()
![]()
if
(dev->rhport == rhport && dev->connected && (hub_addr == 0 || dev->hub_addr == hub_addr) && (hub_port == 0 || dev->hub_port == hub_port))
![]()
![]()
if
(is_hub_addr(daddr))
![]()
![]()
else
![]()
![]()
for
(uint8_t drv_id = 0; drv_id < TOTAL_DRIVER_COUNT; drv_id++)
![]()
![]()
for
(uint8_t h_id = 0; h_id < CFG_TUH_HUB; h_id++)
![]()
![]()
if
(tu_bit_test(removing_hubs, h_id))
![]()
![]()
<anonymous enum>
![]()
![]()
ENUM_RESET_DELAY
![]()
![]()
ENUM_CONTACT_DEBOUNCING_DELAY
![]()
![]()
<anonymous enum>
![]()
![]()
ENUM_IDLE
![]()
![]()
ENUM_RESET_1
![]()
![]()
ENUM_HUB_CLEAR_RESET_1
![]()
![]()
ENUM_ADDR0_DEVICE_DESC
![]()
![]()
ENUM_RESET_2
![]()
![]()
ENUM_HUB_GET_STATUS_2
![]()
![]()
ENUM_HUB_CLEAR_RESET_2
![]()
![]()
ENUM_SET_ADDR
![]()
![]()
ENUM_GET_DEVICE_DESC
![]()
![]()
ENUM_GET_9BYTE_CONFIG_DESC
![]()
![]()
ENUM_GET_FULL_CONFIG_DESC
![]()
![]()
ENUM_SET_CONFIG
![]()
![]()
ENUM_CONFIG_DRIVER
![]()
![]()
process_enumeration(tuh_xfer_t *)
![]()
![]()
if
(XFER_RESULT_SUCCESS != xfer->result)
![]()
![]()
if
(retry)
![]()
![]()
if
(!retry)
![]()
![]()
switch
(state)
![]()
![]()
case
ENUM_HUB_CLEAR_RESET_1:
![]()
![]()
if
(!port_status.status.connection)
![]()
![]()
if
(port_status.change.reset)
![]()
![]()
case
ENUM_HUB_GET_STATUS_2:
![]()
![]()
if
(port_status.change.reset)
![]()
![]()
case
ENUM_ADDR0_DEVICE_DESC:
![]()
![]()
case
ENUM_RESET_2:
![]()
![]()
if
(_dev0.hub_addr == 0)
![]()
![]()
else
![]()
![]()
case
ENUM_SET_ADDR:
![]()
![]()
case
ENUM_GET_DEVICE_DESC:
![]()
![]()
case
ENUM_GET_9BYTE_CONFIG_DESC:
![]()
![]()
case
ENUM_GET_FULL_CONFIG_DESC:
![]()
![]()
case
ENUM_SET_CONFIG:
![]()
![]()
case
ENUM_CONFIG_DRIVER:
![]()
![]()
default
![]()
![]()
enum_new_device(hcd_event_t *)
![]()
![]()
if
(_dev0.hub_addr == 0)
![]()
![]()
if
(!hcd_port_connect_status(_dev0.rhport))
![]()
![]()
else
![]()
![]()
get_new_address(bool)
![]()
![]()
if
(is_hub)
![]()
![]()
for
(uint8_t idx = start; idx < end; idx++)
![]()
![]()
enum_request_set_addr()
![]()
![]()
_parse_configuration_descriptor(uint8_t, const tusb_desc_configuration_t *)
![]()
![]()
while
(p_desc < desc_end)
![]()
![]()
if
(TUSB_DESC_INTERFACE_ASSOCIATION == tu_desc_type(p_desc))
![]()
![]()
if
(1 == assoc_itf_count && TUSB_CLASS_AUDIO == desc_itf->bInterfaceClass && AUDIO_SUBCLASS_CONTROL == desc_itf->bInterfaceSubClass && AUDIO_FUNC_PROTOCOL_CODE_UNDEF == desc_itf->bInterfaceProtocol)
![]()
![]()
if
(1 == assoc_itf_count && TUSB_CLASS_CDC == desc_itf->bInterfaceClass && CDC_COMM_SUBCLASS_ABSTRACT_CONTROL_MODEL == desc_itf->bInterfaceSubClass)
![]()
![]()
for
(uint8_t drv_id = 0; drv_id < TOTAL_DRIVER_COUNT; drv_id++)
![]()
![]()
if
(driver && driver->open(dev->rhport, dev_addr, desc_itf, drv_len))
![]()
![]()
for
(uint8_t i=0; i<assoc_itf_count; i++)
![]()
![]()
if
(drv_id == TOTAL_DRIVER_COUNT - 1)
![]()
![]()
usbh_driver_set_config_complete(uint8_t, uint8_t)
![]()
![]()
for
(itf_num++; itf_num < CFG_TUH_INTERFACE_MAX; itf_num++)
![]()
![]()
if
(driver)
![]()
![]()
if
(itf_num == CFG_TUH_INTERFACE_MAX)
![]()
![]()
if
(is_hub_addr(dev_addr))
![]()
![]()
enum_full_complete()