Skip to content

Commit 11b9bf9

Browse files
committed
Update tinyusb dcd_dwc2
1 parent 9919f9b commit 11b9bf9

File tree

2 files changed

+161
-180
lines changed

2 files changed

+161
-180
lines changed

Diff for: components/arduino_tinyusb/patches/dcd_dwc2.patch

+14-13
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@
1717

1818
static void edpt_activate(uint8_t rhport, tusb_desc_endpoint_t const * p_endpoint_desc) {
1919
dwc2_regs_t* dwc2 = DWC2_REG(rhport);
20-
@@ -336,7 +346,18 @@
21-
dwc2->epout[epnum].doepctl = dxepctl;
22-
dwc2->daintmsk |= TU_BIT(DAINTMSK_OEPM_Pos + epnum);
23-
} else {
24-
- dwc2->epin[epnum].diepctl = dxepctl | (epnum << DIEPCTL_TXFNUM_Pos);
20+
@@ -332,7 +342,19 @@
21+
(p_endpoint_desc->bmAttributes.xfer != TUSB_XFER_ISOCHRONOUS ? DOEPCTL_SD0PID_SEVNFRM : 0) |
22+
(xfer->max_size << DOEPCTL_MPSIZ_Pos);
23+
if (dir == TUSB_DIR_IN) {
24+
- epctl |= (epnum << DIEPCTL_TXFNUM_Pos);
25+
+ //epctl |= (epnum << DIEPCTL_TXFNUM_Pos);
2526
+ uint8_t fifo_num = epnum;
2627
+#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3)
2728
+ // Special Case for EP5, which is used by CDC but not actually called by the driver
@@ -33,12 +34,12 @@
3334
+ }
3435
+ //TU_ASSERT(fifo_num != 0);
3536
+#endif
36-
+ dwc2->epin[epnum].diepctl = dxepctl | (fifo_num << DIEPCTL_TXFNUM_Pos);
37-
dwc2->daintmsk |= TU_BIT(DAINTMSK_IEPM_Pos + epnum);
37+
+ epctl |= (fifo_num << DIEPCTL_TXFNUM_Pos);
3838
}
39-
}
40-
@@ -850,6 +871,10 @@
41-
xfer_status[n][TUSB_DIR_IN].max_size = 0;
39+
40+
dwc2_dep_t* dep = &dwc2->ep[1 - dir][epnum];
41+
@@ -840,6 +862,10 @@
42+
}
4243
}
4344

4445
+#if TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3)
@@ -48,7 +49,7 @@
4849
dfifo_flush_tx(dwc2, 0x10); // all tx fifo
4950
dfifo_flush_rx(dwc2);
5051

51-
@@ -1204,6 +1229,9 @@
52+
@@ -1186,6 +1212,9 @@
5253
if (int_status & GINTSTS_USBRST) {
5354
// USBRST is start of reset.
5455
dwc2->gintsts = GINTSTS_USBRST;
@@ -58,7 +59,7 @@
5859
bus_reset(rhport);
5960
}
6061

61-
@@ -1235,7 +1263,11 @@
62+
@@ -1217,7 +1246,11 @@
6263

6364
if (int_status & GINTSTS_USBSUSP) {
6465
dwc2->gintsts = GINTSTS_USBSUSP;
@@ -71,7 +72,7 @@
7172
}
7273

7374
if (int_status & GINTSTS_WKUINT) {
74-
@@ -1252,6 +1284,9 @@
75+
@@ -1234,6 +1267,9 @@
7576

7677
if (otg_int & GOTGINT_SEDET) {
7778
dcd_event_bus_signal(rhport, DCD_EVENT_UNPLUGGED, true);

0 commit comments

Comments
 (0)