summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2026-05-30Merge pull request #3658 from wjklimek1/mtp-out-transfer-fixZixun LI
Fix premature MTP phase change after short MTP OUT transfer
2026-05-29Merge branch 'master' into usbh-add-control-queuehathach
2026-05-29dwc2: process IN EP before OUTHiFiPhile
To avoid STATUS IN completion of previous control transfer treated as next DATA IN when IRQ latency is high. Signed-off-by: HiFiPhile <[email protected]>
2026-05-29Handle OUT transfer completion in MTPWojciech Klimek
Handle OUT transfer differently from IN to not prematurely change MTP phase when host sends short packet that is not end of MTP data phase. Only reaching container length or ZLP should change phase.
2026-05-29Implement asynchronous control transfer queuing for USB host stackhathach
- Added a pending FIFO queue for asynchronous control transfers when the active slot is busy. - Introduced `control_xfer_dispatch_pending` to handle queued transfers on slot availability. - Improved synchronization for blocking and non-blocking transfer modes, preventing deadlocks in RTOS. - Refactored and renamed related functions for clarity and consistency. - Enhanced error handling and callback invocation for failed or stale transfers.
2026-05-29Merge remote-tracking branch 'tinyusb/master' into fix/Dwc2Stm32U5HiFiPhile
2026-05-29dwc2: move OUT transfer management into RXFLVL IRQHiFiPhile
- GRXSTSP register has internal FIFO, receiving events won't mix up (STATUS OUT & next SETUP) - Improve efficiency, remove 2nd IRQ overhead Signed-off-by: HiFiPhile <[email protected]>
2026-05-28abstract OS logic with `CFG_TUSB_OS_HAS_SCHEDULER` to simplify conditional ↵hathach
checks
2026-05-27osal add osal_task_get_current_handle()hathach
2026-05-27dwc2: fix EP0 DMA setup race conditionHiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2026-05-27dwc2: simplify EP0 ZLP handlingHiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2026-05-26ch32_usbhs: fix endpoint stall length index and clear-stall responseJie Feng
Fix issue in the stall handling: - dcd_edpt_stall() for an IN endpoint cleared EP_TX_LEN(0) instead of EP_TX_LEN(ep_num), clobbering endpoint 0's transmit length register when stalling any other IN endpoint. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
2026-05-25optimize interrupt handling timeHiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2026-05-25chore: resolve .gitignore merge conflict with mastercopilot-swe-agent[bot]
Co-authored-by: HiFiPhile <[email protected]>
2026-05-25Merge remote-tracking branch 'tinyusb/master' into musb_ep0_raceHiFiPhile
2026-05-24Merge remote-tracking branch 'tinyusb/master' into stm32c5HiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2026-05-24dcd/stm32_fsdev: workaround CH32 EP0 premature OUT ACKHiFiPhile
Track EP0 control transfer state from SETUP (direction and wLength) and gate CH32 EP0 handshakes accordingly. Switch EP0 type away from control to bulk to block unsolicited OUT ACKs during control read/write gaps, then restore control type when EP0 transfer is explicitly armed. Signed-off-by: HiFiPhile <[email protected]>
2026-05-23dcd/ch32x: optmize CTRL reg writing, basically revert e14b0e85HiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2026-05-23dcd/ch32hs: refactor transfer flowHiFiPhile
Refactor the driver to follow USBFS style for easier maintenance. Replace the old packet/response helpers with explicit queue and update paths for IN and OUT transfers. Introduce transfer validity tracking and per-endpoint data toggle state. Reset toggle state on init, close-all, endpoint close, clear-stall, and bus reset. Initialize endpoint controls consistently in NAK + TOG_0 mode. Tighten EP0 setup/status handling and route transfer IRQ processing through the transfer-flag path. Stop enabling ISO_ACT in INT_EN and clear unhandled interrupt flags explicitly. Signed-off-by: HiFiPhile <[email protected]>
2026-05-23dcd/ch32fs: do not set EP0 to ACK on status completeHiFiPhile
It would casue race condition, SETUP packet is always acked. Signed-off-by: HiFiPhile <[email protected]>
2026-05-23dcd/ch32fs: clear INT flag after processingHiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2026-05-23dcd/ch32x : code reformatHiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2026-05-23dcd/ch32fs: set EP to NAK earlier to reduce spuroius transferHiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2026-05-22dcd/ch32fs: reset EP on clear stallHiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2026-05-22dcd/ch32fs: fix ISO IN transferHiFiPhile
OUT is still buggy Signed-off-by: HiFiPhile <[email protected]>
2026-05-22dcd/ch32fs: only enable EP0 ACK if no data stage, reduce raceHiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2026-05-22dcd/ch32fs: reset EP regs on bus resetHiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2026-05-22ch32v20x: fix port1 IP selectionHiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2026-05-22Merge remote-tracking branch 'tinyusb/master' into mickabrig7/masterHiFiPhile
2026-05-22Merge remote-tracking branch 'tinyusb/master' into fix/Dwc2Stm32U5HiFiPhile
2026-05-22dwc2: handle EP0 status OUT in RXFLVL interruptHiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2026-05-19Merge pull request #3571 from sauloverissimo/feat/midi2-device-host-driverZixun LI
feat: Add USB-MIDI 2.0 Device and Host class drivers
2026-05-19midi2_host: convert TX to raw FIFO mirroring midi2_device refactorSaulo Veríssimo
2026-05-18midi2: convert to raw Tx FIFO for better segmentation handling, add count to ↵HiFiPhile
packet api Signed-off-by: HiFiPhile <[email protected]>
2026-05-18midi2: boundary-aware drain in xfer_cb to keep UMP packets intactSaulo Veríssimo
2026-05-17midi2: drain pattern for RX FIFOSaulo Veríssimo
Default RX/TX buffers to EPSIZE for both device and host. Document drain-in-loop on ump_read; example device callback drains until empty.
2026-05-17midi2: scale device buffers with EPSIZESaulo Veríssimo
Match midi2_host pattern. Literal 256 underran HS endpoints (512B).
2026-05-17midi2: per-interface weak callbacks for UMP Stream configSaulo Veríssimo
Lets each instance return different NUM_GROUPS, NUM_FUNCTION_BLOCKS, EP_NAME and PRODUCT_ID. Defaults fall back to the macros.
2026-05-17midi2: peek 4 bytes for MT, restore 256 buffersSaulo Veríssimo
MT is in byte 3 of the UMP word in LE memory, not byte 0. Buffers at mps blocked RX xfer re-arm on partial packets.
2026-05-17midi2: use hwfifo if supportedHiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2026-05-17midi2: move config to class headerHiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2026-05-16midi2: add sources to TINYUSB_SRC_C, skip familySaulo Veríssimo
Make build was missing midi2_device.c/midi2_host.c from src/tinyusb.mk. Skip stm32h7s3nucleo board which exposes a pre-existing uninitialized warning in its board.h (board_init2) under Make+LTO.
2026-05-16midi2: prevent UMP packet split across USB transfersSaulo Veríssimo
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
2026-05-16midi2: reject UMP read/write API on alt setting 0Saulo Veríssimo
Alt 0 carries USB-MIDI 1.0 32-bit Event Packets, not UMP words; calling the UMP API there would misinterpret the stream. Expose MIDI_PROTOCOL_MIDI1 and MIDI_PROTOCOL_MIDI2 in the public header so applications can branch on the negotiated protocol. Ref #3571
2026-05-15rp2040: fix host SET_REPORT (and any OUT-data control xfer) sending DATA0 ↵Boris Dolgov
instead of DATA1 hcd_edpt_xfer() previously reset ep->next_pid to 1 only when the control endpoint direction changed between stages. That handled IN-data control transfers (e.g. GET_REPORT, GET_DESCRIPTOR) where SETUP is OUT and DATA is IN, but not OUT-data class requests like SET_REPORT, where SETUP and DATA are both OUT and the direction-change check is false. ep->next_pid was left at 0 from hcd_edpt_open(), so the DATA stage went on the wire as DATA0 when the device expected DATA1. Strict devices (observed: Elgato Stream Deck) treat this as a protocol violation and disconnect. Key off "endpoint 0" instead of "direction changed", restoring the previous behavior. Interrupt/bulk endpoints take the ep->interrupt_num > 0 branch above and never reach this code, so they are unaffected.
2026-05-14dcd/musb: defer EP0 SETUP during DATA_IN/STATUS raceHiFiPhile
Handle cases where a new SETUP arrives before the previous control transfer fully completes by buffering the SETUP and replaying it after status completion. Split EP0 DATA state into DATA_IN/DATA_OUT and finalize pending status-out completion before processing deferred SETUP. Signed-off-by: HiFiPhile <[email protected]>
2026-05-14Merge remote-tracking branch 'tinyusb/master' into stm32c5HiFiPhile
2026-05-12dcd/dwc2: fix ISO IN endpoint become disabled after incomplete transferHiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2026-05-12midi2: align descriptors with USB-MIDI 2.0 specSaulo Veríssimo
Brings the MIDI 2.0 device driver into full conformance with USB Device Class Definition for MIDI Devices v2.0 (USB-IF, May 2020). - Alt 1 MS Interface Header wTotalLength now reports 0x0007 per Table 5-2 ("set to match bLength"), replacing the prior 0x0011 carried over from USB-MIDI 1.0 conventions. - GET_DESCRIPTOR class request now validates bmRequestType direction, type and recipient plus wIndex and wValue high byte per Section 6. - iBlockItem in the default Group Terminal Block is driven by CFG_TUD_MIDI2_BLOCK_STRIDX so applications can attach a UI string descriptor to the block per Table 5-6. - UMP word byte order assumption (little-endian host per Section 3.2.2) is documented inline so future big-endian ports know where to wrap access with tu_htole32 / tu_le32toh. Validated on RP2040 and ESP32-P4 under Linux kernel 6.17: lsusb -v reports wTotalLength = 0x0007 on Alt 1 MS Header (raw bytes 07 24 01 00 02 07 00). amidi -l enumerates Group Terminals exposed via the class-specific GET_DESCRIPTOR response.
2026-05-12midi2: align ep_buf allocation with other stream-based classesSaulo Veríssimo
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.