esp-hal icon indicating copy to clipboard operation
esp-hal copied to clipboard

support dma chunk sizes other than 4092

Open liebman opened this issue 1 year ago • 1 comments

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 📝

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

Extra:

Pull Request Details 📖

This PR will allow dma "chunk sizes" other than the default 4092.

Description

This is needed to support DMA to/from psram on the esp32s3 where it requires that the size and address pointer fields in each DmaDescriptor are required to be "block" aligned where the block alignment is selectable from the set of 16, 32, or 64 bytes. (support for DMA to/from psram will be a seperate PR)

  • the dma_buffer type macros were refactored to remove code duplication and to add _chunk_size variants.
  • the DmaDescripterChain was changed to support specifing the chunk size.

Testing

tests were added for all of the dma_ macros added an additional mem2mem test using a different CHUNK_SIZE

liebman avatar Jul 04 '24 19:07 liebman

@bjoernQ In my previous PR I fixed a HIL test issue by Insuring that the test dropped the Mem2Mem struct and in the drop explicitly reset the "memory to memory" bit. Thinking on this I think we should utilize the RegisterAccess::init() function to initialize all bits that are known cause undefined behavior. Thoughts? (could be done in a separate PR)

liebman avatar Jul 05 '24 16:07 liebman

@bjoernQ In my previous PR I fixed a HIL test issue by Insuring that the test dropped the Mem2Mem struct and in the drop explicitly reset the "memory to memory" bit. Thinking on this I think we should utilize the RegisterAccess::init() function to initialize all bits that are known cause undefined behavior. Thoughts? (could be done in a separate PR)

Sounds good to me! Better to not hope for defaults being always set

bjoernQ avatar Jul 06 '24 14:07 bjoernQ

Sounds good to me! Better to not hope for defaults being always set

Added.

liebman avatar Jul 06 '24 18:07 liebman