Skip to content

Commit 58b8f1f

Browse files
authored
Merge pull request #41 from espressif/fix/usbd_cleanup_dcd_fix_epin_counter
fix(usbd/dcd_dwc2): Fixed epin counter assert, update buffer name for usbd_control debug
2 parents 8502c71 + 681b920 commit 58b8f1f

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/device/usbd_control.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ bool usbd_control_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t result,
174174
if (_ctrl_xfer.request.bmRequestType_bit.direction == TUSB_DIR_OUT) {
175175
TU_VERIFY(_ctrl_xfer.buffer);
176176
memcpy(_ctrl_xfer.buffer, _ctrl_epbuf.buf, xferred_bytes);
177-
TU_LOG_MEM(CFG_TUD_LOG_LEVEL, _usbd_ctrl_buf, xferred_bytes, 2);
177+
TU_LOG_MEM(CFG_TUD_LOG_LEVEL, _ctrl_xfer.buffer, xferred_bytes, 2);
178178
}
179179

180180
_ctrl_xfer.total_xferred += (uint16_t) xferred_bytes;

src/portable/synopsys/dwc2/dcd_dwc2.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,8 @@ static bool dfifo_alloc(uint8_t rhport, uint8_t ep_addr, uint16_t packet_size) {
195195
}
196196
} else {
197197
// Check IN endpoints concurrently active limit
198-
if(_dwc2_controller->ep_in_count) {
199-
TU_ASSERT(_dcd_data.allocated_epin_count < _dwc2_controller->ep_in_count);
198+
if(dwc2_controller->ep_in_count) {
199+
TU_ASSERT(_dcd_data.allocated_epin_count < dwc2_controller->ep_in_count);
200200
_dcd_data.allocated_epin_count++;
201201
}
202202

@@ -543,7 +543,7 @@ void dcd_edpt_close_all(uint8_t rhport) {
543543
dwc2_regs_t* dwc2 = DWC2_REG(rhport);
544544
uint8_t const ep_count = _dwc2_controller[rhport].ep_count;
545545

546-
_dcd_data.allocated_epin_count = 1;
546+
_dcd_data.allocated_epin_count = 0;
547547

548548
// Disable non-control interrupt
549549
dwc2->daintmsk = (1 << DAINTMSK_OEPM_Pos) | (1 << DAINTMSK_IEPM_Pos);
@@ -654,7 +654,7 @@ static void handle_bus_reset(uint8_t rhport) {
654654
tu_memclr(xfer_status, sizeof(xfer_status));
655655

656656
_dcd_data.sof_en = false;
657-
_dcd_data.allocated_epin_count = 1;
657+
_dcd_data.allocated_epin_count = 0;
658658

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

0 commit comments

Comments
 (0)