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

Basic DMA for ESP32-C3 #212

Merged
merged 1 commit into from
Oct 13, 2022
Merged

Basic DMA for ESP32-C3 #212

merged 1 commit into from
Oct 13, 2022

Conversation

bjoernQ
Copy link
Contributor

@bjoernQ bjoernQ commented Oct 13, 2022

This adds basic DMA functionality for ESP32-C3

There is still a lot to improve here but I'd like to get this in to see if is a general fit and as a base for exploring how to implement DMA for the other supported chips - especially ESP32 and ESP32-S2 are very different in regards to DMA.

This includes DMA support for SPI. The DMA API is similar to the STM32F1XX implementation - it's unfortunately a bit hard to use but that it seems to be the only possible way to implement DMA in a safe and sound way. Maybe we find ways to improve the ease-of-use while keeping it memory safe.

Other than most HALs it also implements the SPI traits from EH with DMA. Most HALs don't do that since those are blocking and it doesn't make sense for them. For us however it enables single SPI transactions of up to 32k (in contrast for 64 bytes without DMA). Because those APIs are blocking, they should be safe and sound.

As said this PR doesn't aim for perfection - I'm sure we need to change a lot of things to make this work for the other chips - so I don't want to waste effort in polishing something that will get changed anyway (for now - at some point of time we will polish things here).

The PR is not exactly small but I think an implementation of DMA without at least one peripheral supporting it doesn't make any sense.

Copy link
Member

@jessebraham jessebraham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a bunch for getting a start on this!

I'm not exactly familiar with the GDMA peripheral (or DMA in general to be honest...) but this all looks reasonable enough. Given that it's likely to evolve significantly as we add support for additional devices I don't think it's worth scrutinizing too much at this point in time.

The spi_loopback_dma example is functioning as expected so LGTM!

@jessebraham jessebraham merged commit 9cb24bb into esp-rs:main Oct 13, 2022
@jessebraham jessebraham mentioned this pull request Oct 28, 2022
5 tasks
@bjoernQ bjoernQ deleted the feature/gdma branch December 14, 2022 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants