-
Notifications
You must be signed in to change notification settings - Fork 1.3k
dcd/rusb2: fix fifo write #3407
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
Conversation
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 a FIFO write bug in the RUSB2 USB device controller driver and enables dedicated hardware FIFO support. The fix addresses data corruption issues that could occur when writing from a circular buffer (tu_fifo) that wraps around, ensuring proper 16-bit alignment for hardware FIFO writes.
Key changes:
- Enables
CFG_TUD_EDPT_DEDICATED_HWFIFOfor RUSB2, indicating the hardware has dedicated FIFOs for each endpoint - Refactors
pipe_write_packet_ffto handle wrapped buffer writes with proper alignment by ensuring only the final write operation can have an odd byte count - When the linear portion of a wrapped buffer has odd length, creates a "glue" buffer combining the last byte of the linear portion with the first byte of the wrapped portion to maintain 16-bit alignment
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/tusb_option.h | Enables CFG_TUD_EDPT_DEDICATED_HWFIFO for RUSB2 (tested on RA4M2-EK hardware) |
| src/portable/renesas/rusb2/dcd_rusb2.c | Fixes pipe_write_packet_ff to properly handle wrapped FIFO writes with 16-bit alignment requirements |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Size Difference ReportBecause TinyUSB code size varies by port and configuration, the metrics below represent the averaged totals across all example builds. Note: If there is no change, only one value is shown. Changes >1% in size
Changes <1% in size
No changes
|
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.
great, I kind of guess why we have issue with fifo read, that force us to do byte read previously and skip 32-bit access for highspeed Though I don't really remember it, will test this assumption out later on.
Found a RA4M2-EK from no where, turns out compatible with ra4m3_ek...