|
1 | 1 | --- a/components/arduino_tinyusb/src/dcd_dwc2.c 2024-10-02 12:17:40.000000000 +0300
|
2 | 2 | +++ b/components/arduino_tinyusb/src/dcd_dwc2.c 2024-10-02 12:19:48.000000000 +0300
|
3 |
| -@@ -316,6 +316,16 @@ |
| 3 | +@@ -243,6 +243,17 @@ |
4 | 4 | //--------------------------------------------------------------------
|
5 | 5 | // Endpoint
|
6 | 6 | //--------------------------------------------------------------------
|
|
14 | 14 | + return 0;
|
15 | 15 | +}
|
16 | 16 | +#endif
|
17 |
| - |
18 |
| - static void edpt_activate(uint8_t rhport, tusb_desc_endpoint_t const * p_endpoint_desc) { |
| 17 | ++ |
| 18 | + static void edpt_activate(uint8_t rhport, const tusb_desc_endpoint_t* p_endpoint_desc) { |
19 | 19 | dwc2_regs_t* dwc2 = DWC2_REG(rhport);
|
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); |
| 20 | + const uint8_t epnum = tu_edpt_number(p_endpoint_desc->bEndpointAddress); |
| 21 | +@@ -266,7 +277,18 @@ |
| 22 | + depctl.bm.set_data0_iso_even = 1; |
| 23 | + } |
23 | 24 | if (dir == TUSB_DIR_IN) {
|
24 |
| -- epctl |= (epnum << DIEPCTL_TXFNUM_Pos); |
25 |
| -+ //epctl |= (epnum << DIEPCTL_TXFNUM_Pos); |
| 25 | +- depctl.bm.tx_fifo_num = epnum; |
| 26 | ++ //depctl.bm.tx_fifo_num = epnum; |
26 | 27 | + uint8_t fifo_num = epnum;
|
27 | 28 | +#if defined(TUP_USBIP_DWC2_ESP32)
|
28 | 29 | + // Special Case for EP5, which is used by CDC but not actually called by the driver
|
|
32 | 33 | + } else {
|
33 | 34 | + fifo_num = get_free_fifo();
|
34 | 35 | + }
|
35 |
| -+ //TU_ASSERT(fifo_num != 0); |
36 | 36 | +#endif
|
37 |
| -+ epctl |= (fifo_num << DIEPCTL_TXFNUM_Pos); |
| 37 | ++ depctl.bm.tx_fifo_num = fifo_num; |
38 | 38 | }
|
39 | 39 |
|
40 |
| - dwc2_dep_t* dep = &dwc2->ep[1 - dir][epnum]; |
41 |
| -@@ -840,6 +862,10 @@ |
| 40 | + dwc2_dep_t* dep = &dwc2->ep[dir == TUSB_DIR_IN ? 0 : 1][epnum]; |
| 41 | +@@ -557,6 +579,10 @@ |
42 | 42 | }
|
43 | 43 | }
|
44 | 44 |
|
|
49 | 49 | dfifo_flush_tx(dwc2, 0x10); // all tx fifo
|
50 | 50 | dfifo_flush_rx(dwc2);
|
51 | 51 |
|
52 |
| -@@ -1186,6 +1212,9 @@ |
53 |
| - if (int_status & GINTSTS_USBRST) { |
| 52 | +@@ -997,6 +1023,9 @@ |
| 53 | + if (gintsts & GINTSTS_USBRST) { |
54 | 54 | // USBRST is start of reset.
|
55 | 55 | dwc2->gintsts = GINTSTS_USBRST;
|
56 | 56 | +#if defined(TUP_USBIP_DWC2_ESP32)
|
57 | 57 | + _allocated_fifos = 1;
|
58 | 58 | +#endif
|
59 |
| - bus_reset(rhport); |
| 59 | + handle_bus_reset(rhport); |
60 | 60 | }
|
61 | 61 |
|
62 |
| -@@ -1217,7 +1246,11 @@ |
| 62 | +@@ -1008,7 +1037,11 @@ |
63 | 63 |
|
64 |
| - if (int_status & GINTSTS_USBSUSP) { |
| 64 | + if (gintsts & GINTSTS_USBSUSP) { |
65 | 65 | dwc2->gintsts = GINTSTS_USBSUSP;
|
66 | 66 | - dcd_event_bus_signal(rhport, DCD_EVENT_SUSPEND, true);
|
67 | 67 | + //dcd_event_bus_signal(rhport, DCD_EVENT_SUSPEND, true);
|
|
71 | 71 | +#endif
|
72 | 72 | }
|
73 | 73 |
|
74 |
| - if (int_status & GINTSTS_WKUINT) { |
75 |
| -@@ -1234,6 +1267,9 @@ |
| 74 | + if (gintsts & GINTSTS_WKUINT) { |
| 75 | +@@ -1025,6 +1058,9 @@ |
76 | 76 |
|
77 | 77 | if (otg_int & GOTGINT_SEDET) {
|
78 | 78 | dcd_event_bus_signal(rhport, DCD_EVENT_UNPLUGGED, true);
|
|
0 commit comments