| Age | Commit message (Collapse) | Author |
|
* license: use SPDX identifiers for src/ headers
Replace the full ~20-line MIT license boilerplate on every src/ file with a
two-line SPDX tag (SPDX-FileCopyrightText + SPDX-License-Identifier), following
the REUSE convention used by CircuitPython and the Linux kernel. Removes ~3500
lines of duplicated boilerplate.
|
|
|
|
|
|
The edpt_stream auto-flush is byte-oriented and could cut an UMP message
in half when the FIFO reached wMaxPacketSize, corrupting the peer's RX
context. Pre-flush whole packets before writing one that would cross the
boundary on both device (tud_midi2_n_ump_write) and host
(tuh_midi2_ump_write) paths. Host write also becomes packet-aware
instead of word-by-word.
Ref #3571
|
|
Keep the MIDI 2.0 drivers fully self-contained, with no changes to
shared or generic stack code.
Allocate the per-endpoint buffer in both midi2_host and midi2_device,
following the convention used by cdc, midi, vendor, and printer.
The class buffer struct is declared unconditionally and passed to
tu_edpt_stream_init on every init, so the streaming helpers operate
on the same shape across all classes.
|
|
Host driver (midi2_host.c):
- midih2_open() now returns actual parsed length instead of max_len,
preventing composite device interface conflicts
- Parsers (alt0/alt1) refactored to return const uint8_t* end pointer
following midi_host.c switch/case pattern
- Alt 1 CS Endpoint now parses MIDI 2.0 layout (bNumGrpTrmBlk at
offset 3 with MIDI_CS_ENDPOINT_GENERAL_2_0 subtype check) instead
of reusing MIDI 1.0 struct (bNumEmbMIDIJack)
- midih2_set_config() now issues SET_INTERFACE control request via
tuh_interface_set() before completing configuration. Falls back to
alt 0 if SET_INTERFACE fails
- Extracted midih2_set_config_complete() and midih2_set_interface_cb()
for async SET_INTERFACE handling
Device driver (midi2_device.c):
- midi2d_open() skip loop now checks bInterfaceNumber, stopping at
interfaces that belong to other functions in composite devices
- SET_INTERFACE handler now rejects alt > 1 (returns false/stall)
- Named constants for GTB descriptor types and MIDI protocol values
Descriptor macros (usbd.h):
- TUD_MIDI2_DESC_ALT1_HEAD: iInterface set to 0 (consistent with
Alt 0), wTotalLength now uses TUD_MIDI2_DESC_ALT1_CS_LEN to cover
all Alt 1 class-specific descriptors
- TUD_MIDI2_DESC_ALT1_EP: now accepts GTB ID list via variadic args,
emitting complete CS endpoint descriptor
Host example:
- CMakeLists.txt restricted to rp2040 family (display.c requires
Pico SDK headers)
- display.c: null terminator after strncpy in log scroll
Documentation:
- class_drivers.rst updated to reflect SET_INTERFACE behavior and
auto-select with fallback
Addresses: Codex P1 (#1, #2, #3), Copilot (#4-#9)
|
|
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
|