-
Notifications
You must be signed in to change notification settings - Fork 1.3k
remove ep buffer for port with dedicated hw fifo #3359
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
cdc device omit ep buffer when hwfifo is supported
…t read pointer. More rename
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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
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 pull request removes intermediate endpoint buffers for USB endpoints with dedicated hardware FIFOs, optimizing memory usage and data transfer efficiency for certain USB controllers like DWC2.
- Introduces
CFG_TUD_EDPT_DEDICATED_HWFIFOconfiguration to enable direct hardware FIFO access without intermediate buffering - Refactors FIFO API to use
tu_fifo_access_mode_tenum withTU_FIFO_FIXED_ADDR_RW32mode for hardware FIFO operations - Updates CDC device class to conditionally allocate EP buffers only when hardware FIFOs are not available
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| test/unit-test/test/test_fifo.c | Reformatted code and added comprehensive test coverage for new FIFO access modes and edge cases |
| test/unit-test/project.yml | Added CFG_TUSB_FIFO_ACCESS_FIXED_ADDR_RW32 define for test builds |
| test/unit-test/CMakeLists.txt | New CMake build system for unit tests with Ceedling integration |
| test/hil/hil_test.py | Enhanced CDC tests with variable payload sizes and improved error messages |
| src/tusb_option.h | Added configuration options for dedicated hardware FIFO support and migrated to #pragma once |
| src/tusb.c | Modified stream transfer logic to support NULL ep_buf and use xfer_fifo API when available |
| src/portable/synopsys/dwc2/dcd_dwc2.c | Updated to use new tu_fifo_read_n_access/tu_fifo_write_n_access API with TU_FIFO_FIXED_ADDR_RW32 |
| src/portable/nuvoton/nuc505/dcd_nuc505.c | Updated commented-out code to use new FIFO access API |
| src/portable/microchip/samg/dcd_samg.c | Updated commented-out code to use new FIFO access API |
| src/device/usbd.c | Added CFG_TUD_EDPT_DEDICATED_HWFIFO guard for xfer_fifo implementation and formatting cleanup |
| src/common/tusb_private.h | Updated ep_buf comment to clarify NULL usage with dedicated hardware FIFOs |
| src/common/tusb_mcu.h | Migrated to #pragma once and removed TUP_MEM_CONST_ADDR definition |
| src/common/tusb_fifo.h | Refactored API to expose tu_fifo_access_mode_t and reorganized inline helper functions |
| src/common/tusb_fifo.c | Major refactoring: renamed internal functions, moved helpers to header, fixed mutex usage |
| src/class/cdc/cdc_device.c | Conditionally compiled EP buffers and improved wanted char search logic for hardware FIFO compatibility |
| docs/info/changelog.rst | Updated release date (contains error: year changed to 2025 instead of 2024) |
| .clang-format | Added PPIndentWidth configuration and removed ReflowComments option |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ce examples having minimum 64 bytes fifo (fs)
# Conflicts: # src/common/tusb_fifo.h
|



for port with dedicated hw fifo i.e writing data to device fifo instead of DMA. We can omit ep buffer for xfer_fifo() and pretty much normal edpt_xfer() TX direction. Currently only enabled this for dwc2 with cdc, midi device. Vendor is updated in the follow-up PR but need to be careful with no-buffer mode (edpt_xfer only)
Sum up