summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorhathach <[email protected]>2026-06-18 17:59:30 +0700
committerhathach <[email protected]>2026-06-18 17:59:30 +0700
commitea5b8d677f22f4bd1574f864fd0487dfd329c090 (patch)
treec73641e9dee6992bdff0f12edf471427fed840a2 /src/common
parent953abfb3931c67b834838c7fe0b31834cb0d42d6 (diff)
dcd/ch58x: drive CH582/583 with shared dcd_ch32_usbfs.c
Replace PR #3515's separate dcd_ch58x_usbfs.c / hcd_ch58x_usbfs.c with the shared WCH USBFS device driver (combined per-endpoint control, like CH32V103), adding two CH58x-specific behaviors guarded so CH32V103/V20x/V307 are unchanged: - CH32_USBFS_EP_MANUAL_TOG: CH58x's hardware AUTO_TOG does not stay in sync, so the ISR toggles DATA0/DATA1 manually and discards toggle-mismatched OUT packets. Fixes multi-packet bulk-IN (e.g. MSC READ10) that otherwise hung. - CH32_USBFS_EP4_SHARES_EP0: EP4 has no DMA register and overlays EP0's region (EP0[0:63] + EP4 OUT[64:127] + EP4 IN[128:191]); add a 192-byte shared buffer and buffer-pointer helpers (transparent for the other parts). Fixes cdc_dual_ports (Port1 is on EP4). Add the ch582m_evt board. Device only on USB0 (rhport 0): the shared hcd_ch32_usbfs.c is CH32V20x-specific and cannot drive CH58x, so host / USB2 (rhport 1) is left commented out in the BSP for easy re-add. Verified on ch582m_evt via local HIL: all device examples pass. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Diffstat (limited to 'src/common')
-rw-r--r--src/common/tusb_mcu.h11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/common/tusb_mcu.h b/src/common/tusb_mcu.h
index 8408d3ae0..f2a2d92a5 100644
--- a/src/common/tusb_mcu.h
+++ b/src/common/tusb_mcu.h
@@ -660,17 +660,16 @@
#endif
#elif TU_CHECK_MCU(OPT_MCU_CH58X)
- // CH582/583 has 2 independent USBFS controllers with merged EP registers, FS only.
- #define TUP_USBIP_WCH_CH58X
+ // CH582/583 USBFS: older WCH USBFS IP with a single combined per-endpoint control register
+ // (like CH32V103), driven by the shared dcd_ch32_usbfs.c on USB0 (rhport 0). Device only:
+ // the shared hcd_ch32_usbfs.c is CH32V20x-specific and does not support CH58x, so host /
+ // USB2 (rhport 1) is not provided here.
+ #define TUP_USBIP_WCH_USBFS
#ifndef CFG_TUD_WCH_USBIP_USBFS
#define CFG_TUD_WCH_USBIP_USBFS 1
#endif
- #ifndef CFG_TUH_WCH_USBIP_USBFS
- #define CFG_TUH_WCH_USBIP_USBFS 1
- #endif
-
#define TUP_DCD_ENDPOINT_MAX 8
//--------------------------------------------------------------------+