From 3f1554e071ac8c5f7b382c0b640d82a2e0191ca1 Mon Sep 17 00:00:00 2001 From: datdenkikniet Date: Sat, 4 Feb 2023 19:02:59 +0100 Subject: [PATCH] Not sure if sram sections get nulled out during initialization --- src/dma/rx/h_desc.rs | 5 +++++ src/dma/tx/h_desc.rs | 9 +++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/dma/rx/h_desc.rs b/src/dma/rx/h_desc.rs index 80e9a1a8..6fe4bcdb 100644 --- a/src/dma/rx/h_desc.rs +++ b/src/dma/rx/h_desc.rs @@ -137,6 +137,11 @@ impl RxDescriptor { pub(super) fn setup(&mut self, buffer: &[u8]) { self.set_owned(buffer); + unsafe { + for i in 0..4 { + self.inner_raw.write(i, 0); + } + } } /// Pass ownership to the DMA engine diff --git a/src/dma/tx/h_desc.rs b/src/dma/tx/h_desc.rs index 81da90b0..63932f5e 100644 --- a/src/dma/tx/h_desc.rs +++ b/src/dma/tx/h_desc.rs @@ -148,8 +148,13 @@ impl TxDescriptor { (self.inner_raw.read(3) & TXDESC_3_LD) == TXDESC_3_LD } - // Placeholder for API parity with f-series descriptor. - pub(super) fn setup(&mut self, _: &[u8]) {} + pub(super) fn setup(&mut self, _: &[u8]) { + unsafe { + for i in 0..4 { + self.inner_raw.write(i, 0); + } + } + } pub(super) fn is_owned(&self) -> bool { (self.inner_raw.read(3) & TXDESC_3_OWN) == TXDESC_3_OWN