From 367b3194015d7b35838e4d692b90e8e9ffa402ae Mon Sep 17 00:00:00 2001 From: Dietrich Beck Date: Sat, 1 Jul 2023 20:52:00 +0200 Subject: [PATCH] interrupts for dma polling --- embassy-rp/src/dma.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/embassy-rp/src/dma.rs b/embassy-rp/src/dma.rs index 67e1d985..6a0a4624 100644 --- a/embassy-rp/src/dma.rs +++ b/embassy-rp/src/dma.rs @@ -358,9 +358,7 @@ impl<'a, 'b, 'c, 'r, W: Word, C1: Channel, C2: Channel> ContinuousTransfer<'a, ' if pc.read_addr().read() == control_input.as_ptr() as u32 && pd.ctrl_trig().read().busy() { poll_fn(|cx: &mut Context<'_>| { - // the more efficient solution would be to use the interrupts, - // but I was not able to get it working robustly - cx.waker().wake_by_ref(); + CHANNEL_WAKERS[channels.data.number() as usize].register(cx.waker()); if pc.read_addr().read() == control_input.as_ptr() as u32 + 16 { Poll::Ready(()) } else { @@ -418,8 +416,7 @@ impl<'a, 'b, 'c, 'r, W: Word, C1: Channel, C2: Channel> ContinuousTransfer<'a, ' pub async fn stop(self) { // when no longer enabling the chain, data simply stops poll_fn(|cx| { - // using interrupts would be nicer - cx.waker().wake_by_ref(); + CHANNEL_WAKERS[self.channels.data.number() as usize].register(cx.waker()); if self.channels.data.regs().ctrl_trig().read().busy() { Poll::Pending } else {