summaryrefslogtreecommitdiff
path: root/src/host
diff options
context:
space:
mode:
authorSaulo VerĂ­ssimo <[email protected]>2026-03-24 23:38:02 -0300
committerSaulo VerĂ­ssimo <[email protected]>2026-05-12 11:07:44 -0300
commit7750e51ce1b64bd4d2f0ba6d9671303b96ba80ce (patch)
tree9451691d1292c5c31dac155130abc5646c0ef5fc /src/host
parentbc8ce76ae800b312b4d3ef591cc42e8726e68d7f (diff)
feat: add MIDI 2.0 Host class driver (USB-MIDI 2.0)
Add native USB-MIDI 2.0 Host class driver to TinyUSB. Implements reactive architecture: enumerate, detect MIDI 2.0 capability, inform application via callbacks. Driver features: - Parse both Alt Setting 0 (MIDI 1.0) and Alt Setting 1 (UMP) - Detect bcdMSC version from descriptor - Auto-select highest protocol (Alt 1 preferred if available) - UMP read/write via endpoint streams - Proper Audio Control interface skip (loop-based, following midi_host.c pattern) - Endpoint open with tuh_edpt_open/tu_edpt_stream_open/clear - usbh_driver_set_config_complete for USBH state machine - Handle Audio Control itf_num in set_config gracefully - 5 weak callback stubs (descriptor, mount, unmount, rx, tx) Build system: - Register midih2_* in usbh.c driver table - Add midi2_host.h include to tusb.h - Add CFG_TUH_MIDI2_LOG_LEVEL to tusb_option.h All changes guarded by #if CFG_TUH_MIDI2 (default 0). Zero impact on existing drivers and examples. Tested: Waveshare RP2350-USB-A (Host) receiving UMP from Raspberry Pi Pico (Device) via PIO-USB, board-to-board
Diffstat (limited to 'src/host')
-rw-r--r--src/host/usbh.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/host/usbh.c b/src/host/usbh.c
index 490724b02..2e3c93c5e 100644
--- a/src/host/usbh.c
+++ b/src/host/usbh.c
@@ -278,6 +278,18 @@ static usbh_class_driver_t const usbh_class_drivers[] = {
},
#endif
+ #if CFG_TUH_MIDI2
+ {
+ .name = DRIVER_NAME("MIDI2"),
+ .init = midih2_init,
+ .deinit = midih2_deinit,
+ .open = midih2_open,
+ .set_config = midih2_set_config,
+ .xfer_cb = midih2_xfer_cb,
+ .close = midih2_close
+ },
+ #endif
+
#if CFG_TUH_HUB
{
.name = DRIVER_NAME("HUB"),