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

[1/3] DMA Move API: Pull out driver specific state in DMA driver into… #1716

Merged
merged 1 commit into from
Jun 25, 2024

Conversation

Dominaezzz
Copy link
Collaborator

@Dominaezzz Dominaezzz commented Jun 25, 2024

… separate structs

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 📝

  • I have updated existing examples or added new ones (if applicable).
  • I have used cargo xtask fmt-packages command to ensure that all changed code is formatted correctly.
  • My changes were added to the CHANGELOG.md in the proper section.
  • My changes are in accordance to the esp-rs API guidelines

Extra:

Pull Request Details 📖

Description

This part of #1512.
This is a no-op refactor of the DMA driver to move (what will eventually become) driver specific state to separate structs.
The new structs are:

  • DescriptorChain - Each DMA capable driver will own either one or two chains. One for RX and one for TX.
  • TxCircularState/RxCircularState - This will be owned by the DmaTransfer(Tx|Rx)Circular (and the custom I2S transfer) structs.

These new structs are currently pub due to other structs using them being pub too. After the 2nd PR, they become pub(crate).

I've split up this work into 3 PRs.

  1. Refactor driver to pull out driver specific state. (No breaking changes in public API)
  2. Move the new structs to their new homes. This also means the slice of DMA descriptors that were used to configure the DMA channels will now be passed to the individual peripheral drivers themselves. (Breaking change in public API).
  3. Specialize the SPI DMA APIs to implement the ideas in Have a Move-In-Move-Out DMA transaction API in addition (again) #1512. Now that drivers own their DMA descriptors this is now very possible.

The reason I've split up this work into multiple PRs is to make this easier to review and to make my life much easier when I (inevitably) have to rebase on top of other breaking changes.

Since this PR is an internal refactor, I've omitted the CHANGELOG entry.

Testing

HIL in CI

@bjoernQ bjoernQ added the skip-changelog No changelog modification needed label Jun 25, 2024
Copy link
Contributor

@bjoernQ bjoernQ left a comment

Choose a reason for hiding this comment

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

Thanks for working on this! Code looks good to me and given HIL tests still work (plus I tested this with an I2S example on S3-BOX) I think this should be fine

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.

I think this is looking quite nice, can't say I really have anything to add. So LGTM!

@jessebraham jessebraham added this pull request to the merge queue Jun 25, 2024
Merged via the queue into esp-rs:main with commit 0b5eb1f Jun 25, 2024
29 of 30 checks passed
@Dominaezzz Dominaezzz deleted the dma_refactor branch June 25, 2024 19:27
@bugadani bugadani mentioned this pull request Oct 3, 2024
20 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip-changelog No changelog modification needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants