From 914acb9c12bd8da5ca79305b37a2c9bf9d8589be Mon Sep 17 00:00:00 2001 From: bunnie Date: Sun, 5 May 2024 16:41:00 +0800 Subject: [PATCH] apply the optimization to writes as well --- libs/cramium-hal/src/udma.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libs/cramium-hal/src/udma.rs b/libs/cramium-hal/src/udma.rs index 251bca8ca..0a78968d1 100644 --- a/libs/cramium-hal/src/udma.rs +++ b/libs/cramium-hal/src/udma.rs @@ -1307,10 +1307,6 @@ impl Spim { self.send_cmd_list(&cmd_list); // safety: this is safe because tx_buf_phys() slice is only used as a base/bounds reference unsafe { self.udma_enqueue(Bank::Tx, &self.tx_buf_phys::()[..3], CFG_EN | CFG_SIZE_8) } - while self.udma_busy(Bank::Tx) { - #[cfg(feature = "std")] - xous::yield_slice(); - } let wr_cmd = [SpimCmd::TxData( self.mode, SpimWordsPerXfer::Words1, @@ -1318,6 +1314,10 @@ impl Spim { SpimEndian::MsbFirst, chunk.len() as u32, )]; + while self.udma_busy(Bank::Tx) { + #[cfg(feature = "std")] + xous::yield_slice(); + } self.send_cmd_list(&wr_cmd); self.tx_buf_mut()[..chunk.len()].copy_from_slice(chunk); // safety: this is safe because tx_buf_phys() slice is only used as a base/bounds reference