-
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
Rework DMA descriptors #1054
Rework DMA descriptors #1054
Conversation
d3e117f
to
165820f
Compare
I think "should be sized as Btw. the values 4091 and 4092 are probably wrong anyway because 2^12 = 4096. |
I know the difference is only occasional and only 12 bytes, but why waste it? If I only ever need to transfer a single chunk, I don't want 2 descriptors. This means the macro will stay most likely as it is currently, which in turn would mean the documentation would be incorrect (again).
I didn't invent it, I don't feel confident to change it. I don't know what needs and what doesn't need 4 byte alignment (something requiring word alignment means we can't use 4095 byte chunks), but if you feel compelled to figure it out, change it and test it, feel free to open a PR. |
Section 3.4.8 of the TRM: "That is to say, GDMA can read data of specified length (1 ~ 4095 bytes) from any So where do these 4091/4092 numbers come from? |
I don't remember where these number are from but there are things like these: Anyways it shouldn't get changed in a walk-by - if it turns out 4095/4096 is fine it should be another PR |
Interestingly, the numbers only appear in the doc comments. There's nothing in the code that checks against them. |
Just out of curiousity, what do you expect to happen, when the chunk size is 4095 bytes, but a peripheral supports only 32bit data? |
Good question. Seems to be similar to any case where chunk size and peripheral data size are not aligned, e.g. on a 3 byte transfer with 32-bit peripheral size. How does the hardware behave in such a case? I would guess, transfer would stall and wait for the missing byte. But that is something that should be prevented, so there has to be some modulo calculation depending on the data width. |
379da0f
to
cb34c3c
Compare
This comment was marked as outdated.
This comment was marked as outdated.
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!
The goal of this PR is to better model DMA descriptors by using a 3-word struct and aligning documentation. As a bonus, we can remove a few runtime checks.
Must
errors
orwarnings
.cargo fmt
was run.CHANGELOG.md
in the proper section.Nice to have