aboutsummaryrefslogtreecommitdiff
path: root/src/clocks/mod.rs
diff options
context:
space:
mode:
authorBogdan Petru Chircu Mare <[email protected]>2025-11-25 22:09:01 -0800
committerBogdan Petru Chircu Mare <[email protected]>2025-11-28 12:34:24 -0800
commit03356a261801d7ee234490809eef3eac3c27cc52 (patch)
tree23de784ea642f65ce5c02fdcb111ee314a4ca97f /src/clocks/mod.rs
parent87c4eaf3380505ca15ef7ed1d5dc435e9af2200e (diff)
feat(dma): add DMA driver with 10 verified examples
Initial DMA driver implementation for MCXA276 with: Core DMA Features: - DmaChannel type with ownership tracking via Channel trait - Transfer, RingBuffer, and ScatterGatherBuilder abstractions - Support for mem-to-mem, mem-to-peripheral, peripheral-to-mem transfers - Interrupt-driven completion with embassy async/await integration - Word size abstraction (u8, u16, u32) via Word trait LPUART DMA Integration: - LpuartTxDma and LpuartRxDma drivers for async UART with DMA - LpuartDma combined TX/RX driver - Automatic chunking for buffers > 0x7FFF bytes - DMA guards with Drop impl for safe cancellation 10 Verified Examples: - dma_mem2mem: Basic memory-to-memory copy - dma_memset: Memory fill with pattern - dma_uart_tx: UART transmit via DMA - dma_uart_rx: UART receive via DMA - dma_uart_loopback: Combined TX/RX loopback test - dma_scatter_gather: Linked descriptor chains - dma_channel_linking: Major/minor loop channel linking - dma_ring_buffer: Circular buffer for continuous streaming - dma_ping_pong: Double-buffering pattern - dma_software_trigger: Manual transfer triggering PR Feedback Addressed: - Use PAC accessor for LPUART DATA register instead of manual offset - Add EnableInterrupt enum to replace boolean parameter for readability - Add DMA guards with Drop impl for safe async cancellation - Automatic chunking for large buffers instead of returning error - Use NonNull<[W]> + PhantomData for RingBuffer (DMA acts like separate thread) - Remove edma parameter from all methods (single eDMA instance steals ptr internally) - Make edma_tcd() non-public (HAL should not expose PAC items)
Diffstat (limited to 'src/clocks/mod.rs')
-rw-r--r--src/clocks/mod.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/clocks/mod.rs b/src/clocks/mod.rs
index 9c9e6ef3d..ac30115f6 100644
--- a/src/clocks/mod.rs
+++ b/src/clocks/mod.rs
@@ -399,6 +399,10 @@ pub unsafe fn assert_reset<G: Gate>() {
399} 399}
400 400
401/// Check whether the peripheral is held in reset. 401/// Check whether the peripheral is held in reset.
402///
403/// # Safety
404///
405/// Must be called with a valid peripheral gate type.
402#[inline] 406#[inline]
403pub unsafe fn is_reset_released<G: Gate>() -> bool { 407pub unsafe fn is_reset_released<G: Gate>() -> bool {
404 G::is_reset_released() 408 G::is_reset_released()
@@ -940,4 +944,7 @@ pub(crate) mod gate {
940 impl_cc_gate!(LPUART4, mrcc_glb_cc0, mrcc_glb_rst0, lpuart4, LpuartConfig); 944 impl_cc_gate!(LPUART4, mrcc_glb_cc0, mrcc_glb_rst0, lpuart4, LpuartConfig);
941 impl_cc_gate!(LPUART5, mrcc_glb_cc1, mrcc_glb_rst1, lpuart5, LpuartConfig); 945 impl_cc_gate!(LPUART5, mrcc_glb_cc1, mrcc_glb_rst1, lpuart5, LpuartConfig);
942 impl_cc_gate!(ADC1, mrcc_glb_cc1, mrcc_glb_rst1, adc1, AdcConfig); 946 impl_cc_gate!(ADC1, mrcc_glb_cc1, mrcc_glb_rst1, adc1, AdcConfig);
947
948 // DMA0 peripheral - uses NoConfig since it has no selectable clock source
949 impl_cc_gate!(DMA0, mrcc_glb_cc0, mrcc_glb_rst0, dma0, NoConfig);
943} 950}