Merge remote-tracking branch 'upstream/master' into async_io

Signed-off-by: HiFiPhile <admin@hifiphile.com>
This commit is contained in:
HiFiPhile
2025-04-11 23:07:22 +02:00
196 changed files with 9070 additions and 3322 deletions

View File

@@ -578,8 +578,7 @@ static void usbd_reset(uint8_t rhport) {
}
bool tud_task_event_ready(void) {
// Skip if stack is not initialized
if (!tud_inited()) return false;
TU_VERIFY(tud_inited()); // Skip if stack is not initialized
return !osal_queue_empty(_usbd_q);
}
@@ -701,7 +700,9 @@ void tud_task_ext(uint32_t timeout_ms, bool in_isr) {
case USBD_EVENT_FUNC_CALL:
TU_LOG_USBD("\r\n");
if (event.func_call.func) event.func_call.func(event.func_call.param);
if (event.func_call.func) {
event.func_call.func(event.func_call.param);
}
break;
case DCD_EVENT_SOF:
@@ -718,7 +719,7 @@ void tud_task_ext(uint32_t timeout_ms, bool in_isr) {
#if CFG_TUSB_OS != OPT_OS_NONE && CFG_TUSB_OS != OPT_OS_PICO
// return if there is no more events, for application to run other background
if (osal_queue_empty(_usbd_q)) return;
if (osal_queue_empty(_usbd_q)) { return; }
#endif
}
}
@@ -1049,7 +1050,14 @@ static bool process_set_config(uint8_t rhport, uint8_t cfg_num)
#endif
#if CFG_TUD_MIDI
if ( driver->open == midid_open ) assoc_itf_count = 2;
if (driver->open == midid_open) {
// If there is a class-compliant Audio Control Class, then 2 interfaces. Otherwise, only one
if (TUSB_CLASS_AUDIO == desc_itf->bInterfaceClass &&
AUDIO_SUBCLASS_CONTROL == desc_itf->bInterfaceSubClass &&
AUDIO_FUNC_PROTOCOL_CODE_UNDEF == desc_itf->bInterfaceProtocol) {
assoc_itf_count = 2;
}
}
#endif
#if CFG_TUD_BTH && CFG_TUD_BTH_ISO_ALT_COUNT
@@ -1306,7 +1314,7 @@ bool usbd_edpt_open(uint8_t rhport, tusb_desc_endpoint_t const* desc_ep) {
rhport = _usbd_rhport;
TU_ASSERT(tu_edpt_number(desc_ep->bEndpointAddress) < CFG_TUD_ENDPPOINT_MAX);
TU_ASSERT(tu_edpt_validate(desc_ep, (tusb_speed_t) _usbd_dev.speed));
TU_ASSERT(tu_edpt_validate(desc_ep, (tusb_speed_t) _usbd_dev.speed, false));
return dcd_edpt_open(rhport, desc_ep);
}
@@ -1507,7 +1515,7 @@ bool usbd_edpt_iso_activate(uint8_t rhport, tusb_desc_endpoint_t const* desc_ep)
uint8_t const dir = tu_edpt_dir(desc_ep->bEndpointAddress);
TU_ASSERT(epnum < CFG_TUD_ENDPPOINT_MAX);
TU_ASSERT(tu_edpt_validate(desc_ep, (tusb_speed_t) _usbd_dev.speed));
TU_ASSERT(tu_edpt_validate(desc_ep, (tusb_speed_t) _usbd_dev.speed, false));
_usbd_dev.ep_status[epnum][dir].stalled = 0;
_usbd_dev.ep_status[epnum][dir].busy = 0;