-
Notifications
You must be signed in to change notification settings - Fork 221
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
[DMA 8/8] Burst configuration #2543
Conversation
f2fae81
to
9b608fe
Compare
Easier said than done. Before this can happen, the work to remove Why? Enabling extmem support in Another nice thing about |
Note that length is always unconstrained, alignment requirements are for address and size only. For reads, the DMA will pad the received data to 128 bytes, using zeroes. Then the DMA sets the length to the actually received amount. For writes, |
Yes but how do you tell the SPI to only read 120 bytes, instead of the 128 that |
Ah okay I understand your issue, it's not a hardware-related one. Yeah this is a consequence of the design right now 🤷♂️ I'm guessing we could add a read_length (in spirit, not necessarily in name) field to DmaRxBuf, that we'd use to set up the peripherals. That value wouldn't affect the descriptors, but users could use it to set an upper limit to how much data they want to read. |
Indeed
Yeah that would work but supporting that on other infinite-length descriptors would be awkward. |
Please explain this a bit |
Oops typo. I meant buffers not descriptors. (I need to read my comments more)
|
This comment was marked as outdated.
This comment was marked as outdated.
6f20739
to
06db791
Compare
Yes! I'm proposing that the peripheral takes the length. I.e. The use case I'm thinking of is the user wants to send (or read) 30000 bytes to an spi device but doesn't want to allocate a 30,000 byte buffer. They could make do with 4000 bytes only and stream the data with a stream buf. SPI and parl io have special interrupts to let the user know when they were too slow. |
Alright, that sounds to me like a problem for later. For now, if someone is fine with block aligned reads, they are free to allocate the RX buffer in PSRAM. |
Moved this PR back a spot, as this is probably the bigger and more complex change. |
1576ee4
to
24230ac
Compare
7d453f6
to
0583ce7
Compare
// if cfg!(esp32) { | ||
// // NOTE: The size must be word-aligned. | ||
// // NOTE: The buffer address must be word-aligned | ||
// 4 |
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.
What a mess. Since this check is used by set_length
indirectly, restoring 4 would mean we reject all transfer lengths that are not multiples of 4. But the hardware seems to contradict the TRM in that it works just fine...
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.
What behavior would you expect to see if the TRM wasn't being contradicted?
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.
LGTM, thanks!
I could've sworn there were changes made to the SPI driver, do you accidentally revert them? |
Not accidentally, those changes didn't work (yet) |
Will those be coming in a subsequent PR or in this one? |
I don't intend to change this PR unless some issue comes up. |
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.
LGTM. For now users would have to be mindful not to pass burstable dma bufs to SpiDmaBus
, to avoid panics.
Thank you for your contribution!
We appreciate the time and effort you've put into this pull request.
To help us review it efficiently, please ensure you've gone through the following checklist:
Submission Checklist 📝
cargo xtask fmt-packages
command to ensure that all changed code is formatted correctly.CHANGELOG.md
in the proper section.Extra:
Pull Request Details 📖
Description
This PR adds burst mode configuration to the DMA buffers. This is somewhat out of their scope, but I believe they may be a slight overcomplication anyway. The PR also describes burst mode constraints for both internal and PSRAM accesses, where applicable.