This commit is contained in:
hathach
2025-02-12 11:34:32 +07:00
parent 87adc63226
commit 85247e50dd
5 changed files with 31 additions and 28 deletions

View File

@@ -100,21 +100,21 @@ target_sources(tinyusb_device_base INTERFACE
${TOP}/src/class/video/video_device.c ${TOP}/src/class/video/video_device.c
) )
#------------------------------------ #------------------------------------
# Base config for host mode; wrapped by SDK's tinyusb_host # Base config for host mode; wrapped by SDK's tinyusb_host
#------------------------------------ #------------------------------------
add_library(tinyusb_host_base INTERFACE) add_library(tinyusb_host_base INTERFACE)
target_sources(tinyusb_host_base INTERFACE target_sources(tinyusb_host_base INTERFACE
${TOP}/src/portable/raspberrypi/rp2040/hcd_rp2040.c ${TOP}/src/portable/raspberrypi/rp2040/hcd_rp2040.c
${TOP}/src/portable/raspberrypi/rp2040/rp2040_usb.c ${TOP}/src/portable/raspberrypi/rp2040/rp2040_usb.c
${TOP}/src/host/usbh.c ${TOP}/src/host/usbh.c
${TOP}/src/host/hub.c ${TOP}/src/host/hub.c
${TOP}/src/class/cdc/cdc_host.c ${TOP}/src/class/cdc/cdc_host.c
${TOP}/src/class/hid/hid_host.c ${TOP}/src/class/hid/hid_host.c
${TOP}/src/class/midi/midi_host.c ${TOP}/src/class/midi/midi_host.c
${TOP}/src/class/msc/msc_host.c ${TOP}/src/class/msc/msc_host.c
${TOP}/src/class/vendor/vendor_host.c ${TOP}/src/class/vendor/vendor_host.c
) )
# Sometimes have to do host specific actions in mostly common functions # Sometimes have to do host specific actions in mostly common functions
target_compile_definitions(tinyusb_host_base INTERFACE target_compile_definitions(tinyusb_host_base INTERFACE

View File

@@ -440,7 +440,7 @@ uint16_t midid_open(uint8_t rhport, const tusb_desc_interface_t* desc_itf, uint1
drv_len = tu_desc_len(desc_itf); drv_len = tu_desc_len(desc_itf);
p_desc = tu_desc_next(desc_itf); p_desc = tu_desc_next(desc_itf);
// Skip Class Specific descriptors // Skip Class Specific descriptors
while ( TUSB_DESC_CS_INTERFACE == tu_desc_type(p_desc) && drv_len <= max_len ) { while (TUSB_DESC_CS_INTERFACE == tu_desc_type(p_desc) && drv_len <= max_len) {
drv_len += tu_desc_len(p_desc); drv_len += tu_desc_len(p_desc);
p_desc = tu_desc_next(p_desc); p_desc = tu_desc_next(p_desc);
} }

View File

@@ -1032,14 +1032,13 @@ static bool process_set_config(uint8_t rhport, uint8_t cfg_num)
#endif #endif
#if CFG_TUD_MIDI #if CFG_TUD_MIDI
if ( driver->open == midid_open ) if (driver->open == midid_open) {
{ // If there is a class-compliant Audio Control Class, then 2 interfaces. Otherwise, only one
// If there is a class-compliant Audio Control Class, then 2 interfaces
// Otherwise, only one
if (TUSB_CLASS_AUDIO == desc_itf->bInterfaceClass && if (TUSB_CLASS_AUDIO == desc_itf->bInterfaceClass &&
AUDIO_SUBCLASS_CONTROL == desc_itf->bInterfaceSubClass && AUDIO_SUBCLASS_CONTROL == desc_itf->bInterfaceSubClass &&
AUDIO_FUNC_PROTOCOL_CODE_UNDEF == desc_itf->bInterfaceProtocol) AUDIO_FUNC_PROTOCOL_CODE_UNDEF == desc_itf->bInterfaceProtocol) {
assoc_itf_count = 2; assoc_itf_count = 2;
}
} }
#endif #endif

View File

@@ -1488,7 +1488,9 @@ static void process_enumeration(tuh_xfer_t* xfer) {
dev->i_product = desc_device->iProduct; dev->i_product = desc_device->iProduct;
dev->i_serial = desc_device->iSerialNumber; dev->i_serial = desc_device->iSerialNumber;
if (tuh_desc_device_cb) tuh_desc_device_cb(daddr, (tusb_desc_device_t const*) _usbh_ctrl_buf); if (tuh_desc_device_cb) {
tuh_desc_device_cb(daddr, (tusb_desc_device_t const*) _usbh_ctrl_buf);
}
// Get 9-byte for total length // Get 9-byte for total length
uint8_t const config_idx = CONFIG_NUM - 1; uint8_t const config_idx = CONFIG_NUM - 1;
@@ -1517,7 +1519,9 @@ static void process_enumeration(tuh_xfer_t* xfer) {
} }
case ENUM_SET_CONFIG: case ENUM_SET_CONFIG:
if (tuh_desc_config_cb) tuh_desc_config_cb(daddr, (const tusb_desc_configuration_t*) _usbh_ctrl_buf); if (tuh_desc_config_cb) {
tuh_desc_config_cb(daddr, (const tusb_desc_configuration_t*) _usbh_ctrl_buf);
}
TU_ASSERT(tuh_configuration_set(daddr, CONFIG_NUM, process_enumeration, ENUM_CONFIG_DRIVER),); TU_ASSERT(tuh_configuration_set(daddr, CONFIG_NUM, process_enumeration, ENUM_CONFIG_DRIVER),);
break; break;

View File

@@ -657,9 +657,9 @@
//------------------------------------------------------------------ //------------------------------------------------------------------
// Configuration Validation // Configuration Validation
//------------------------------------------------------------------ //------------------------------------------------------------------
//#if CFG_TUD_ENDPOINT0_SIZE > 64 #if CFG_TUD_ENDPOINT0_SIZE > 64
// #error Control Endpoint Max Packet Size cannot be larger than 64 #error Control Endpoint Max Packet Size cannot be larger than 64
//#endif #endif
// To avoid GCC compiler warnings when -pedantic option is used (strict ISO C) // To avoid GCC compiler warnings when -pedantic option is used (strict ISO C)
typedef int make_iso_compilers_happy; typedef int make_iso_compilers_happy;