Skip to content

Commit d774edd

Browse files
committed
Update dcd_dwc2.c
1 parent 8a016b4 commit d774edd

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

Diff for: components/arduino_tinyusb/src/dcd_dwc2.c

+6-10
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131

3232
#if CFG_TUD_ENABLED && defined(TUP_USBIP_DWC2)
3333

34-
#if !CFG_TUD_DWC2_SLAVE_ENABLE && !CFG_TUH_DWC2_DMA_ENABLE
35-
#error DWC2 require either CFG_TUD_DWC2_SLAVE_ENABLE or CFG_TUH_DWC2_DMA_ENABLE to be enabled
34+
#if !(CFG_TUD_DWC2_SLAVE_ENABLE || CFG_TUD_DWC2_DMA_ENABLE)
35+
#error DWC2 require either CFG_TUD_DWC2_SLAVE_ENABLE or CFG_TUD_DWC2_DMA_ENABLE to be enabled
3636
#endif
3737

3838
// Debug level for DWC2
@@ -192,8 +192,8 @@ static bool dfifo_alloc(uint8_t rhport, uint8_t ep_addr, uint16_t packet_size) {
192192
}
193193
} else {
194194
// Check IN endpoints concurrently active limit
195-
if(_dwc2_controller->ep_in_count) {
196-
TU_ASSERT(_dcd_data.allocated_epin_count < _dwc2_controller->ep_in_count);
195+
if(dwc2_controller->ep_in_count) {
196+
TU_ASSERT(_dcd_data.allocated_epin_count < dwc2_controller->ep_in_count);
197197
_dcd_data.allocated_epin_count++;
198198
}
199199

@@ -561,7 +561,7 @@ void dcd_edpt_close_all(uint8_t rhport) {
561561
dwc2_regs_t* dwc2 = DWC2_REG(rhport);
562562
uint8_t const ep_count = _dwc2_controller[rhport].ep_count;
563563

564-
_dcd_data.allocated_epin_count = 1;
564+
_dcd_data.allocated_epin_count = 0;
565565

566566
// Disable non-control interrupt
567567
dwc2->daintmsk = (1 << DAINTMSK_OEPM_Pos) | (1 << DAINTMSK_IEPM_Pos);
@@ -641,10 +641,6 @@ bool dcd_edpt_xfer_fifo(uint8_t rhport, uint8_t ep_addr, tu_fifo_t* ff, uint16_t
641641
return true;
642642
}
643643

644-
void dcd_edpt_close(uint8_t rhport, uint8_t ep_addr) {
645-
edpt_disable(rhport, ep_addr, false);
646-
}
647-
648644
void dcd_edpt_stall(uint8_t rhport, uint8_t ep_addr) {
649645
dwc2_regs_t* dwc2 = DWC2_REG(rhport);
650646
edpt_disable(rhport, ep_addr, true);
@@ -676,7 +672,7 @@ static void handle_bus_reset(uint8_t rhport) {
676672
tu_memclr(xfer_status, sizeof(xfer_status));
677673

678674
_dcd_data.sof_en = false;
679-
_dcd_data.allocated_epin_count = 1;
675+
_dcd_data.allocated_epin_count = 0;
680676

681677
// 1. NAK for all OUT endpoints
682678
for (uint8_t n = 0; n < ep_count; n++) {

0 commit comments

Comments
 (0)