summaryrefslogtreecommitdiff
path: root/src/class/midi/midi_device.c
AgeCommit message (Collapse)Author
2026-07-02license: use SPDX identifiers for src/ headers (#3749)Ha Thach
* 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.
2026-03-12refactor(config): separate endpoint buffer sizes into RX and TX definitions ↵hathach
for clarity and flexibility
2026-03-11Merge branch 'master' into zlp-hs-on-fshathach
2026-02-25midi device: add cable-aware stream read (tud_midi_n_demux_stream_read)Saulo Veríssimo
The existing tud_midi_n_stream_read() accepts a cable_num parameter but ignores it — all cables share a single FIFO and stream parser state, so data from different virtual cables is silently mixed together. Add tud_midi_n_demux_stream_read() which returns the cable number of the data that was actually read. It peeks at each USB-MIDI event packet header before consuming it and stops when the next packet belongs to a different cable, allowing callers to dispatch per-cable without losing data. Implementation details: - Mirrors the host-side tuh_midi_stream_read() approach: tu_edpt_stream_peek for cable inspection, CIN-based byte count (USB MIDI 1.0 Table 4-1), leftover handling via existing midi_driver_stream_t - *p_cable_num initialized to 0xff sentinel so callers can detect "no data" even when return value is 0 - Cable-change check (total_read > 0 guard) covers both leftover-originated reads and freshly consumed packets - TU_VERIFY uses explicit != NULL comparisons, consistent with codebase style - Note: shares stream->buffer with tud_midi_n_stream_read(); do not mix calls on the same interface - Adds single-interface convenience wrapper tud_midi_demux_stream_read() Closes #1838
2026-02-11fix rx transfer length when high speed capable device/host working at full speedHiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2025-12-12fix edpt stream write/read to endpoint not yet openedhathach
2025-12-10move hwid into edpt stream for consistent APIhathach
2025-11-26omit ep buffer for midi device if device support CFG_TUD_EDPT_DEDICATED_HWFIFOhathach
2025-11-13clear endpoint stream when open for cdc_host and midi_hosthathach
2025-11-12migrate cdc device to use edpt stream APIhathach
tu_edpt_stream_open() does not clear fifo, allow for persistent stream when disconnect/reconnect
2025-11-12migrate midi_device to use edpt stream APIhathach
also add tud_midi_n_packet_write/read_n()
2025-09-17Update weak callbacks to new syntaxHiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2025-02-24add tuh_midi_mount_cb_t struct for tuh_midi_mount_cb()hathach
change tuh_midi_rx/tx_cb() to have xferred_bytes rename tuh_midi_get_num_rx/tx_cables() to tuh_midi_get_rx/tx_cable_count() use default empty callback instead of weak null to be compatible with keil compiler
2025-02-14- change signature of tuh_midi_mount/umount_cb()hathach
- rename midi_stream_t to midi_driver_stream_t and move to midi.h (common for device and host)
2025-02-12clean uphathach
2025-02-12Merge branch 'master' into fork/atoktoto/midihosthathach
# Conflicts: # hw/bsp/rp2040/family.cmake # src/class/midi/midi.h # src/class/midi/midi_device.c # src/device/usbd_control.c # src/host/hcd.h # src/host/usbh.c # src/host/usbh.h
2024-11-25try to fix circleci with kinetishathach
2024-11-21use TUD_EPBUF_DEF to declare buffer memory for midihathach
2024-11-21- move freertos_hooks to board.chathach
- add device/midi_test_freertos example - update bth/dfu/midi device for cache line size
2024-04-08add class driver deinithathach
2023-07-24rename CFG_TUSB_MEM_SECTION to CFG_TUD_MEM_SECTION in device stackhathach
CFG_TUD_MEM_SECTION is default to CFG_TUSB_MEM_SECTION
2023-03-17fix trailing space and new linehathach
temporarily disable codespell
2023-02-27Merge pull request #1852 from silvergasp/mem_sHa Thach
fix: Replace device calls to memcpy with tu_memcpy_s
2023-02-27minor clean uphathach
2023-02-15Fix issue 1909rppicomidi
2023-01-13fix: Replace device calls to memcpy with tu_memcpy_sNathaniel Brough
Introduces a new function tu_memcpy_s, which is effectively a backport of memcpy_s. The change also refactors calls to memcpy over to the more secure tu_memcpy_s.
2022-11-13Make USB MIDI device code allow a device with no Audio Control interfacerppicomidi
2022-06-27fix most warnings with rp2040 -wconversionhathach
2022-06-02rhport argument in usbd_ API() is not used (always use the initialized port)hathach
remove the usage of TUD_OPT_RHPORT in class driver
2022-02-25rename TUSB_OPT_DEVICE_ENABLED to CFG_TUD_ENABLEDhathach
TUSB_OPT_DEVICE_ENABLED still usable for backward compatible
2021-10-25properly handle Program Change and Channel Aftertouch messagesTod Kurt
2021-10-18fix -Wnull-dereference in midi_devicehathach
2021-08-02fix warninghathach
2021-08-02correct midi available with already stream readhathach
2021-07-13fix midi stream write return value (off by 1)hathach
2021-06-21fix issue when calling midi API when not enumerated yethathach
2021-05-27include clean uphathach
2021-04-03Merge remote-tracking branch 'upstream/master' into edpt_ISO_xferReinhard Panhuber
2021-04-02correct midi stream read behavior to read until user buffer is full or no ↵hathach
more data from usb fifo
2021-04-02refactor midi read buffer to streamhathach
2021-04-02rename midi write()/read() to stream_write() stream_read()hathach
also add deprecated for warning and rename hint
2021-04-02refactor midi write into streamhathach
2021-04-02refactor midi stream readhathach
2021-04-02fix midi tx fifo overflow cause data corruptionhathach
rename
2021-03-31code formathathach
2021-03-30remove tud_midi_read_flush()hathach
2021-03-30rename tud_midi_receive/send to tud_midi_packet_read/writehathach
2021-03-10Merge branch 'master' into edpt_ISO_xferhathach
2021-03-04Extend FIFO mutex to use separate write and read mutexes.Reinhard Panhuber
Adjust all USB drivers using FIFO and mutexes.
2021-03-04add midi commenthathach