Skip to content

Commit 2179fb1

Browse files
authored
Merge pull request #2891 from roma-jam/fix/dcd_dwc2_counters
fix(dcd_dwc2): Fix EP IN counters assignment and usage
2 parents 444277f + 239443c commit 2179fb1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/portable/synopsys/dwc2/dcd_dwc2.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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

@@ -539,7 +539,7 @@ void dcd_edpt_close_all(uint8_t rhport) {
539539
dwc2_regs_t* dwc2 = DWC2_REG(rhport);
540540
uint8_t const ep_count = _dwc2_controller[rhport].ep_count;
541541

542-
_dcd_data.allocated_epin_count = 1;
542+
_dcd_data.allocated_epin_count = 0;
543543

544544
// Disable non-control interrupt
545545
dwc2->daintmsk = (1 << DAINTMSK_OEPM_Pos) | (1 << DAINTMSK_IEPM_Pos);
@@ -646,7 +646,7 @@ static void handle_bus_reset(uint8_t rhport) {
646646
tu_memclr(xfer_status, sizeof(xfer_status));
647647

648648
_dcd_data.sof_en = false;
649-
_dcd_data.allocated_epin_count = 1;
649+
_dcd_data.allocated_epin_count = 0;
650650

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

0 commit comments

Comments
 (0)