summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHiFiPhile <[email protected]>2024-05-09 14:48:42 +0200
committerGitHub <[email protected]>2024-05-09 14:48:42 +0200
commit1af56a30cffe6293815f388dfcda4a30c68a4e92 (patch)
treed84e9dda884f7c7059e35e1d34562867fccc1f07 /src
parent70ae07b084950b9721101697a0371e632dd8cc9c (diff)
parent1cab553f4bcb6633face4f50f03192928a68f751 (diff)
Merge pull request #2181 from Xelus22/ch32v307_SOF
Add SOF interrupt to CH32V307
Diffstat (limited to 'src')
-rw-r--r--src/portable/wch/dcd_ch32_usbhs.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/portable/wch/dcd_ch32_usbhs.c b/src/portable/wch/dcd_ch32_usbhs.c
index 1f1c0b876..68e2179e9 100644
--- a/src/portable/wch/dcd_ch32_usbhs.c
+++ b/src/portable/wch/dcd_ch32_usbhs.c
@@ -135,6 +135,16 @@ void dcd_remote_wakeup(uint8_t rhport)
(void) rhport;
}
+void dcd_sof_enable(uint8_t rhport, bool en)
+{
+ (void) rhport;
+ if (en) {
+ USBHSD->INT_EN |= USBHS_SOF_ACT_EN;
+ } else {
+ USBHSD->INT_EN &= ~(USBHS_SOF_ACT_EN);
+ }
+}
+
void dcd_edpt0_status_complete(uint8_t rhport, tusb_control_request_t const *request) {
(void)rhport;
@@ -332,7 +342,10 @@ void dcd_int_handler(uint8_t rhport) {
xfer_ctl_t *xfer = XFER_CTL_BASE(end_num, tu_edpt_dir(endp));
- if (rx_token == PID_OUT) {
+ if (rx_token == PID_SOF) {
+ dcd_event_sof(rhport, USBHSD->FRAME_NO, true);
+
+ } else if (rx_token == PID_OUT) {
uint16_t rx_len = USBHSD->RX_LEN;
receive_packet(xfer, rx_len);