Skip to content

Commit

Permalink
Merge pull request #2181 from Xelus22/ch32v307_SOF
Browse files Browse the repository at this point in the history
Add SOF interrupt to CH32V307
  • Loading branch information
HiFiPhile authored May 9, 2024
2 parents 70ae07b + 1cab553 commit 1af56a3
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/portable/wch/dcd_ch32_usbhs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 1af56a3

Please sign in to comment.