aboutsummaryrefslogtreecommitdiff
path: root/embassy-imxrt
diff options
context:
space:
mode:
authorFelipe Balbi <[email protected]>2025-12-16 11:27:20 -0800
committerFelipe Balbi <[email protected]>2025-12-16 11:33:30 -0800
commit2102dba83b3254b77c12a23fd17853cbf985233f (patch)
treeffe437de40e46a236d3fe3bfc0b4c2fbfcf9f6f9 /embassy-imxrt
parent4e3e4f44c29d6a5ef93d646b0ae4acc861f1f72e (diff)
[iMXRT] dma: define MAX_CHUNK_SIZE constant
Instead of adding magic constants all over the place, let's just define DMA MAX_CHUNK_SIZE in a single constant that be referenced by the various users.
Diffstat (limited to 'embassy-imxrt')
-rw-r--r--embassy-imxrt/src/dma.rs2
-rw-r--r--embassy-imxrt/src/flexcomm/uart.rs4
2 files changed, 4 insertions, 2 deletions
diff --git a/embassy-imxrt/src/dma.rs b/embassy-imxrt/src/dma.rs
index e71a27e0e..76c9953c1 100644
--- a/embassy-imxrt/src/dma.rs
+++ b/embassy-imxrt/src/dma.rs
@@ -16,6 +16,8 @@ use crate::peripherals::DMA0;
16use crate::sealed::Sealed; 16use crate::sealed::Sealed;
17use crate::{BitIter, interrupt, pac, peripherals}; 17use crate::{BitIter, interrupt, pac, peripherals};
18 18
19pub(crate) const MAX_CHUNK_SIZE: usize = 1024;
20
19#[cfg(feature = "rt")] 21#[cfg(feature = "rt")]
20#[interrupt] 22#[interrupt]
21fn DMA0() { 23fn DMA0() {
diff --git a/embassy-imxrt/src/flexcomm/uart.rs b/embassy-imxrt/src/flexcomm/uart.rs
index 2b759ba84..d13b32e93 100644
--- a/embassy-imxrt/src/flexcomm/uart.rs
+++ b/embassy-imxrt/src/flexcomm/uart.rs
@@ -598,7 +598,7 @@ impl<'a> UartTx<'a, Async> {
598 regs.fifocfg().modify(|_, w| w.dmatx().disabled()); 598 regs.fifocfg().modify(|_, w| w.dmatx().disabled());
599 }); 599 });
600 600
601 for chunk in buf.chunks(1024) { 601 for chunk in buf.chunks(dma::MAX_CHUNK_SIZE) {
602 regs.fifocfg().modify(|_, w| w.dmatx().enabled()); 602 regs.fifocfg().modify(|_, w| w.dmatx().enabled());
603 603
604 let ch = self.tx_dma.as_mut().unwrap().reborrow(); 604 let ch = self.tx_dma.as_mut().unwrap().reborrow();
@@ -726,7 +726,7 @@ impl<'a> UartRx<'a, Async> {
726 regs.fifocfg().modify(|_, w| w.dmarx().disabled()); 726 regs.fifocfg().modify(|_, w| w.dmarx().disabled());
727 }); 727 });
728 728
729 for chunk in buf.chunks_mut(1024) { 729 for chunk in buf.chunks_mut(dma::MAX_CHUNK_SIZE) {
730 regs.fifocfg().modify(|_, w| w.dmarx().enabled()); 730 regs.fifocfg().modify(|_, w| w.dmarx().enabled());
731 731
732 let ch = self.rx_dma.as_mut().unwrap().reborrow(); 732 let ch = self.rx_dma.as_mut().unwrap().reborrow();