summaryrefslogtreecommitdiff
path: root/src/portable/nxp
AgeCommit message (Collapse)Author
2026-07-07usbtest: address Codex re-review (5 findings)hathach
- rp2040 dcd_edpt_clear_stall: the toggle-reset re-issue rewound remaining_len only for IN, but bufctrl_prepare16() pre-subtracts it for OUT too, so an OUT re-issue was short by the still-armed buffers. Rewind both directions (user_buf only for IN, which advances at DPRAM-copy time). Validated: pico usbtest 30/30. - usb_recover.sh: refuse pci-rebind/reset/bind on a BDF that is not a USB controller (class 0x0c03xx), so a stray/mistyped address can't disturb storage or NICs on the shared HIL host. Guard tested against real BDFs. - ip3511 dcd_edpt_open: make it tolerant of reopening a still-armed endpoint instead of asserting it disabled -- retire via EPSKIP (UM11126 41.7.6/41.8.3) then force disabled. This is the correct ISO_ALLOC reopen contract, since usbd_edpt_close() is a no-op there. NOTE: audio/video streaming EPs already use usbd_edpt_iso_activate() on ISO_ALLOC, so there is no in-tree trigger; this is defensive hardening for a class that reopens a non-iso EP via usbd_edpt_open (e.g. a UVC device with a notification EP + VC SET_INTERFACE). Verified on HW: lpc11u37 usbtest 30/30 and video_capture SET_INTERFACE cycling both fine. - vendor_device set_alt: abort the outgoing altsetting's bulk/interrupt endpoints before dropping them, so an endpoint absent from the target altsetting can't stay armed and hold its usbd claim. (No in-tree trigger: usbtest uses a single non-zero altsetting; defensive robustness for multi-alt vendor devices.) - vendor_device tud_vendor_n_mounted(): count iso endpoints too, so an iso-only altsetting reports mounted. (No in-tree trigger: usbtest alt1 always has bulk.) Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HeF2gZ1M7GWkz6Av4BpKPg
2026-07-07address Codex/Copilot review findings (9 fixed, 3 refuted with evidence)hathach
- dcd(rp2040): rewind IN staging before the clear-halt re-issue. Staging advances user_buf/remaining_len when packets are copied into DPRAM, before the host has consumed them; aborting and re-issuing from the advanced pointer silently skipped the staged-but-unsent bytes. - dcd(ip3511): dcd_edpt_iso_activate aborts a transfer still armed from the previous altsetting (clear Active on both buffer slots) so the hardware can't keep servicing the old descriptor against the class's fresh queueing. - dcd(rusb2): reuse an endpoint's existing pipe in dcd_edpt_open. usbd_edpt_close is a no-op on ISO_ALLOC ports, so a class's close/open across SET_INTERFACE would allocate a second pipe with the same EPNUM and leak pipes. - class(vendor): the buffered-mode free-slot check also tests the interrupt endpoints, so an interrupt-only vendor interface isn't clobbered as "free". - bsp(ch32v30x): board_get_unique_id respects max_len and copies bytes (alignment-safe) instead of writing 12 bytes through a uint32_t cast. - test/hil/usbtest.py: treat same-serial multi-matches as ambiguous and retry until the dual-port stale node drops (nanoch32v203/ch32v307 variants); reprobe a binding that predates the dynamic-id re-registration so a stale capability profile can't survive; skip the remove_id/unbind cleanup after an unrecovered kernel-side hang (it would join the D-state convoy and deadlock the bus). - usbtest skip.txt: add the families whose DCD refuses dcd_edpt_iso_alloc (CXD56, FT90X, LPC175X_6X, LPC40XX, NUC100/120/505, PIC32MZ, SAMG, SAMX7X, VALENTYUSB_EPTRI) — tier 4 cannot enumerate there. - test/hil/tinyusb-sudoer: note that '#1000' is a sudoers UID specifier, not a comment (the review misread the grants as commented out). Refuted in review threads: nrf5x ISOSPLIT keeps reserve-max per-configuration allocation semantics (iso_alloc is per-config, not per-alt); the LPC EP-number claim (default descriptor uses EP1-3; lpcxpresso11u37 passes 30/30 on HW); the vendor alt-0 "abort" concern (host cannot address endpoints outside the active altsetting; usbd_edpt_iso_activate resets state on re-entry). Verified on hardware: raspberry_pi_pico, lpcxpresso11u37, ra4m1_ek all 30/30 through the HIL battery after the changes; builds clean incl. buffered-mode vendor (webusb_serial). Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HeF2gZ1M7GWkz6Av4BpKPg
2026-07-06Merge remote-tracking branch 'origin/master' into usbtesthathach
# Conflicts: # lib/rt-thread/port/msc_device_port.c # src/device/usbd.c
2026-07-03dcd(ip3511): clear Active before Stall so a queued endpoint actually haltshathach
dcd_edpt_stall() only set cmd_sts.stall, leaving an armed transfer's Active bit set. The hardware services the Active buffer instead of returning STALL, so a SET_FEATURE(HALT) issued while a transfer was queued did not actually stall the endpoint - the host's verify transfer succeeded instead of getting EPIPE, so usbtest case 13 failed with EINVAL. Clear Active when setting Stall (software must not leave both set). lpcxpresso11u37 now passes the full usbtest battery 30/30 (was 29/30). Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HeF2gZ1M7GWkz6Av4BpKPg
2026-07-03dcd: retire dcd_edpt_close() on the iso-migrated drivershathach
Now that ip3511, rusb2 and nrf5x are on ISO_ALLOC, the stack's usbd_edpt_close() is a no-op for them, so dcd_edpt_close() is no longer a public DCD entry point. Audit of the remaining callers: - ip3511, nrf5x: dcd_edpt_close_all() does its own teardown and no longer calls dcd_edpt_close() -> it is dead code, removed. - rusb2: dcd_edpt_close_all() still tears down each pipe via it -> kept but made a static internal helper (edpt_close), not a public dcd_ API. Revert dcd.h to declaring dcd_edpt_close() only under TUP_DCD_EDPT_CLOSE_API (for the remaining close-API MCUs); ISO_ALLOC IPs declare iso alloc/activate instead. Behaviour-neutral (removed/renamed uncalled functions); dwc2 still builds and nrf5x still passes bulk/iso/halt on hardware. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HeF2gZ1M7GWkz6Av4BpKPg
2026-07-03dcd: implement iso alloc/activate for rusb2, ip3511, nrf5x; deprecate ↵hathach
CLOSE_API for them Migrate the ip3511, rusb2 and nrf5x DCDs off the deprecated TUP_DCD_EDPT_CLOSE_API path onto the unified ISO_ALLOC model by implementing dcd_edpt_iso_alloc/activate (previously #if0 stubs / returning false): - rusb2: iso_alloc reserves an ISO-capable pipe (1/2) once and configures it; iso_activate re-arms it in place (PIPEMAXP + SQCLR + PID_BUF) with no pipe free/realloc, avoiding PIPESEL/PIPECFG churn across altsetting changes. - ip3511: iso_alloc reserves the EP command/status entry (type=ISO, INTEN); iso_activate clears stall + resets the data toggle. - nrf5x: iso_alloc validates the fixed EP8; iso_activate enables ISOOUT/ISOIN (with ISOSPLIT when both directions are active) + SOF, mirroring dcd_edpt_open. tusb_mcu.h no longer defines CLOSE_API for these three (they fall through to ISO_ALLOC); dcd_edpt_close is now declared unconditionally in dcd.h since these drivers still use it internally from dcd_edpt_close_all(). The remaining CLOSE_API MCUs (mm32, pic, da1469x, f1c100s, ch32-usbhs) are left for a later per-board pass. Verified on hardware: ip3511 (lpcxpresso11u37) 29/30 and nrf5x (feather_nrf52840) iso 11/11 via the new path (identical to their prior CLOSE_API results); dwc2, fsdev, rp2040 + audio/video still build. rusb2 (ra4m1) has a separate, iso-independent set_interface wedge (still 1/30) tracked for follow-up. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HeF2gZ1M7GWkz6Av4BpKPg
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-04-17fix some Wconversion warningshathach
2026-03-10fix typohathach
2025-12-13update LPC54HiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2025-12-13hcd: add NXP IP3516HiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2025-11-19Merge remote-tracking branch 'tinyusb/master' into ↵HiFiPhile
copilot/fix-dcd-edpt-xfer-issue Signed-off-by: HiFiPhile <[email protected]>
2025-11-17make TUP_DCD_EDPT_ISO_ALLOC i.e dcd_edpt_iso_alloc()/dcd_edpt_iso_activate() ↵hathach
as default driver implementation. dcd_edpt_close() is deprecated and will be removed from all driver in the future.
2025-11-17make TUP_DCD_EDPT_ISO_ALLOC i.e dcd_edpt_iso_alloc()/dcd_edpt_iso_activate() ↵hathach
as default driver implementation. dcd_edpt_close() is deprecated and will be removed from all driver in the future.
2025-10-31Merge branch 'copilot/fix-dcd-edpt-xfer-issue' of ↵HiFiPhile
https://github.com/hathach/tinyusb into copilot/fix-dcd-edpt-xfer-issue
2025-10-31Merge remote-tracking branch 'tinyusb/master' into ↵HiFiPhile
copilot/fix-dcd-edpt-xfer-issue Signed-off-by: HiFiPhile <[email protected]>
2025-10-30Merge branch 'master' into add-ohci-lpc55hathach
# Conflicts: - hw/bsp/lpc17/family.cmake - hw/bsp/lpc40/family.cmake - hw/bsp/lpc55/family.cmake
2025-10-28fix Identifiers that start with '__' or '_[A-Z]' are reserved.hathach
fix compiling with nuc family
2025-10-22Apply suggestions from code reviewZixun LI
Co-authored-by: Copilot <[email protected]>
2025-10-22Fix copilot issuesMengsk
Signed-off-by: Mengsk <[email protected]>
2025-10-22Add is_isr parameter to dcd_edpt_xfer and dcd_edpt_xfer_fifocopilot-swe-agent[bot]
Co-authored-by: HiFiPhile <[email protected]>
2025-10-10try to enable ohci for lpc55 but not working, probably clock issuehathach
2025-04-23rename and expose tuh_bus_info_get() to applicationhathach
2025-03-26added hcd_edpt_close() stub for other portshathach
2025-03-16Fix 2 IAR warnings.HiFiPhile
Signed-off-by: HiFiPhile <[email protected]>
2025-01-20add s3 undefined speed note for racing issue with reset.hathach
fix dcd_event_sof() with frame number
2024-11-27Fix missing protoype warning, change TUD_EPBUF_TYPE_DEF order (#2889)Ha Thach
* change TUD_EPBUF_TYPE_DEF order * add and fix -Wmissing-prototypes warnings for cmake (skip make)
2024-10-14change dcd_init() return from void to boolhathach
2024-10-14change the tusb_rhport_init_t struct, exclude the rhport to make API more ↵hathach
consistent
2024-10-11hcd_init() take init structhathach
2024-10-11change dcd_init() to take rhport structhathach
2024-08-19remove weak from dcd_edpt_close() for port without TUP_DCD_EDPT_ISO_ALLOChathach
2024-06-18LOG3 in isrhathach
2024-05-02add cmake for lpc15hathach
2024-05-02add cmake for lpc11hathach
2024-04-23clang work with lpc55hathach
2024-02-24only save/restore CLK_RECOVER_IRC_EN/CTRL if ↵hathach
FSL_FEATURE_USB_KHCI_IRC48M_MODULE_CLOCK_ENABLED is defined to 1
2024-02-24fix build with cpu without USB_CLK_RECOVER using old dcd_khci driverhathach
2024-02-24frdm k64f usb work well, add kinetis_k to ci cmakehathach
2024-02-04Merge branch 'hathach:master' into nxp_k64Michael Fischer
2023-09-27change hcd_int_handler(rhport, in_isr) signature: add in_isrhathach
change tuh_int_handler() to take in_isr as optional parameter (default = true)
2023-08-28Merge branch 'master' into nxp_k64Ha Thach
2023-08-28rename OPT_MCU_KINETIS_K64 to OPT_MCU_KINETIS_Khathach
2023-08-09update to dcd ip3511 to add work-around for lpc54628 usb hs errata USB.1 and ↵hathach
USB.2 msc is mounted, but device couldn't work reliably and got constant reset due to other errata probably.
2023-08-04Merge branch 'master' into masterHa Thach
2023-07-26correct hcd_edpt_clear_stall() API signaturehathach
2023-07-24Merge branch 'master' into hcd-abort-xferHa Thach
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-07-23Added support for the NXP K64 seriesemb4fun
2023-07-21add stub hcd_edpt_abort_xfer() for all portshathach