Add DMA, DMA Lite, and DMA4 support for BCM2711 #9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
BCM2711 has three distinct DMA engine types with different register maps and control blocks. This PR implements type-safe support for all three variants while avoiding virtual function overhead.
Implementation
Architecture
DmaBase<Derived, DmaTag>) provides shared functionality with compile-time dispatchDmaTraits<DmaTag>) associate register maps and control blocks with each DMA typeDMA Types
Key Files
dma_base.hpp: CRTP base with common methods (Enable, Reset, Start, WaitForCompletion, etc.)dma_standard.hpp/cpp: Standard DMA (channels 0-6, 8-10)dma_lite.hpp/cpp: DMA Lite (channel 7)dma4.hpp/cpp: DMA4 with 40-bit addressing (channels 11-14)registers_dma.hpp: AddedDma4RegisterMapandDma4ControlBlockwith split address fieldsRegister Mapping
Dma4RegisterMap(notDmaRegisterMap)REG_DMA11-14set to nullptr to prevent misuseExample
dma_types_example.cppdemonstrates all three types with performance comparison and verification.Backward Compatibility
include/rpl4/peripheral/dma.hppnow includes all three types. Existing code usingDmaclass unchanged.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.