diff options
| author | Xelus22 <[email protected]> | 2023-07-25 23:53:55 +1000 |
|---|---|---|
| committer | Xelus22 <[email protected]> | 2023-07-25 23:53:55 +1000 |
| commit | d0bff6fd3ec9fc133032dea84732451d93d202b4 (patch) | |
| tree | ed7d000a2b3c09cbc8d00d9c62a419f327f63855 | |
| parent | 9554283b03cb4af00119ccd5a38e539749b32d53 (diff) | |
initial add SOF supporpt to CH32V307 USB HS
| -rw-r--r-- | src/portable/wch/ch32v307/dcd_usbhs.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/portable/wch/ch32v307/dcd_usbhs.c b/src/portable/wch/ch32v307/dcd_usbhs.c index 3ad011cff..843643ef7 100644 --- a/src/portable/wch/ch32v307/dcd_usbhs.c +++ b/src/portable/wch/ch32v307/dcd_usbhs.c @@ -135,6 +135,19 @@ 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 +345,9 @@ 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); |
