Skip to content

Commit

Permalink
Merge pull request #41 from espressif/fix/usbd_cleanup_dcd_fix_epin_c…
Browse files Browse the repository at this point in the history
…ounter

fix(usbd/dcd_dwc2): Fixed epin counter assert, update buffer name for usbd_control debug
  • Loading branch information
roma-jam authored Nov 28, 2024
2 parents 8502c71 + 681b920 commit 58b8f1f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/device/usbd_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ bool usbd_control_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t result,
if (_ctrl_xfer.request.bmRequestType_bit.direction == TUSB_DIR_OUT) {
TU_VERIFY(_ctrl_xfer.buffer);
memcpy(_ctrl_xfer.buffer, _ctrl_epbuf.buf, xferred_bytes);
TU_LOG_MEM(CFG_TUD_LOG_LEVEL, _usbd_ctrl_buf, xferred_bytes, 2);
TU_LOG_MEM(CFG_TUD_LOG_LEVEL, _ctrl_xfer.buffer, xferred_bytes, 2);
}

_ctrl_xfer.total_xferred += (uint16_t) xferred_bytes;
Expand Down
8 changes: 4 additions & 4 deletions src/portable/synopsys/dwc2/dcd_dwc2.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ static bool dfifo_alloc(uint8_t rhport, uint8_t ep_addr, uint16_t packet_size) {
}
} else {
// Check IN endpoints concurrently active limit
if(_dwc2_controller->ep_in_count) {
TU_ASSERT(_dcd_data.allocated_epin_count < _dwc2_controller->ep_in_count);
if(dwc2_controller->ep_in_count) {
TU_ASSERT(_dcd_data.allocated_epin_count < dwc2_controller->ep_in_count);
_dcd_data.allocated_epin_count++;
}

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

_dcd_data.allocated_epin_count = 1;
_dcd_data.allocated_epin_count = 0;

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

_dcd_data.sof_en = false;
_dcd_data.allocated_epin_count = 1;
_dcd_data.allocated_epin_count = 0;

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

0 comments on commit 58b8f1f

Please sign in to comment.