Skip to content
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

feature(dcd_dwc2) : Added cache bypassing on esp32p4 while DMA is used #38

Draft
wants to merge 9 commits into
base: release/v0.17
Choose a base branch
from

Conversation

roma-jam
Copy link
Collaborator

@roma-jam roma-jam commented Nov 20, 2024

Requirements

ESP32P4 has Cache to access the RAM.
Cache is bypassing when:

  1. DMA reads/writes the physical memory
  2. CPU bypass Cache and directly reads/writes to the physical memory

When DMA is used for DCD DWC2 layer, it is necessary to synchronize data between memory and cache.
It could be achieved by two possible ways:

  1. Explicitly synchronize the cache (implemented in feature(dcd_dwc2) : Added cache synchronization on esp32p4 while DMA is used #37)
  2. Use direct access after DMA is done transferring (implemented here)

Description

All access to cache-related data were replaced with macroses, which return the regular (cache-able) address or noncache-able address based on the manually changed value (1) in the code.

Measurements

Measurements were done only to one example (tusb_msc), one buffer size and one chip.

ESP32P4

MSC Buffer size (bytes) Slave Mode (R/W) Buffer DMA direct-access (R/W) Buffer DMA cache-able (R/W)
8192* 1.0 MB/s / 236.6 kB/s 1.0 MB/s / 236.6 kB/s 5.2 MB/s / 1.9 MB/s

Limitations

Currently, cache bypassing is only done for:

  1. dcd_dwc2 itself
  2. usbd_control layer
  3. mscd class driver

But it should be done in every class, which allocates buffer/s statically to transfer data via DCD DWC2.

Breaking change

No breaking changes

Checklist

  • Pull Request name has appropriate format (for example: "fix(dcd_dwc2): Resolved address selection when several phy are present")
  • Optional: README.md updated
  • CI passing

Related issues

No related issues

@roma-jam roma-jam force-pushed the feature/esp32p4_dma_bypass_cache branch 2 times, most recently from 0fb9efb to 7a12120 Compare November 20, 2024 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant