-
Notifications
You must be signed in to change notification settings - Fork 1.3k
dcd/dwc2: fix EP0 multi-packet transfer logic #3295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…m_packets = 1 Signed-off-by: HiFiPhile <[email protected]>
Signed-off-by: HiFiPhile <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes EP0 multi-packet transfer logic in the DWC2 driver and adds configurable EP0 buffer size support. The issue was in the edpt_schedule_packets
function where ep0_pending
was incorrectly being set to xfer->max_size
instead of the proper endpoint size, causing transfer size calculation errors.
Key changes:
- Added
CFG_TUD_EP0_BUFSIZE
configuration option for EP0 buffer size - Fixed EP0 packet scheduling logic to use correct endpoint size
- Enhanced packet transmission handling for single vs multi-packet transfers
- Updated DFU examples with BOS descriptors and Microsoft OS 2.0 compatibility
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
src/tusb_option.h | Added CFG_TUD_EP0_BUFSIZE configuration option |
src/portable/synopsys/dwc2/dcd_dwc2.c | Fixed EP0 transfer logic and improved packet handling |
src/device/usbd_control.c | Updated to use new CFG_TUD_EP0_BUFSIZE configuration |
examples/device/dfu_runtime/src/usb_descriptors.c | Added BOS descriptor and Microsoft OS 2.0 support |
examples/device/dfu/src/usb_descriptors.c | Added BOS descriptor and Microsoft OS 2.0 support |
Signed-off-by: HiFiPhile <[email protected]>
Signed-off-by: HiFiPhile <[email protected]>
…to/from use EP0 buffer. Signed-off-by: HiFiPhile <[email protected]>
Describe the PR
There was an issue in
edpt_schedule_packets
, asep0_pending = xfer->max_size
is set indcd_edpt_xfer
, ep0_pending will become 0.The issue didn't broken since we schedule only one control transfer each time.
I've add an option
CFG_TUD_EP0_BUFSIZE
to allow setting EP0 buffer size individually, tested with DFU examples withCFG_TUD_EP0_BUFSIZE=512