From ad1b645b0f46a3cfbaac1dc89105082d191b385f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1niel=20Buga?= Date: Tue, 28 Jan 2025 09:45:28 +0100 Subject: [PATCH] Don't register waker if the DMA is done (#3045) * Don't register waker if the DMA is done * Update embassy-executor in HIL tests --- esp-hal/src/dma/mod.rs | 8 ++++---- esp-hal/src/lcd_cam/lcd/i8080.rs | 2 +- hil-test/Cargo.toml | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/esp-hal/src/dma/mod.rs b/esp-hal/src/dma/mod.rs index d10f56ab590..b65da3eed03 100644 --- a/esp-hal/src/dma/mod.rs +++ b/esp-hal/src/dma/mod.rs @@ -2938,7 +2938,6 @@ pub(crate) mod asynch { self: core::pin::Pin<&mut Self>, cx: &mut core::task::Context<'_>, ) -> Poll { - self.tx.waker().register(cx.waker()); if self.tx.is_done() { self.tx.clear_interrupts(); Poll::Ready(Ok(())) @@ -2950,6 +2949,7 @@ pub(crate) mod asynch { self.tx.clear_interrupts(); Poll::Ready(Err(DmaError::DescriptorError)) } else { + self.tx.waker().register(cx.waker()); self.tx .listen_out(DmaTxInterrupt::TotalEof | DmaTxInterrupt::DescriptorError); Poll::Pending @@ -2994,7 +2994,6 @@ pub(crate) mod asynch { self: core::pin::Pin<&mut Self>, cx: &mut core::task::Context<'_>, ) -> Poll { - self.rx.waker().register(cx.waker()); if self.rx.is_done() { self.rx.clear_interrupts(); Poll::Ready(Ok(())) @@ -3006,6 +3005,7 @@ pub(crate) mod asynch { self.rx.clear_interrupts(); Poll::Ready(Err(DmaError::DescriptorError)) } else { + self.rx.waker().register(cx.waker()); self.rx.listen_in( DmaRxInterrupt::SuccessfulEof | DmaRxInterrupt::DescriptorError @@ -3060,7 +3060,6 @@ pub(crate) mod asynch { self: core::pin::Pin<&mut Self>, cx: &mut core::task::Context<'_>, ) -> Poll { - self.tx.waker().register(cx.waker()); if self .tx .pending_out_interrupts() @@ -3076,6 +3075,7 @@ pub(crate) mod asynch { self.tx.clear_interrupts(); Poll::Ready(Err(DmaError::DescriptorError)) } else { + self.tx.waker().register(cx.waker()); self.tx .listen_out(DmaTxInterrupt::Done | DmaTxInterrupt::DescriptorError); Poll::Pending @@ -3124,7 +3124,6 @@ pub(crate) mod asynch { self: core::pin::Pin<&mut Self>, cx: &mut core::task::Context<'_>, ) -> Poll { - self.rx.waker().register(cx.waker()); if self .rx .pending_in_interrupts() @@ -3140,6 +3139,7 @@ pub(crate) mod asynch { self.rx.clear_interrupts(); Poll::Ready(Err(DmaError::DescriptorError)) } else { + self.rx.waker().register(cx.waker()); self.rx.listen_in( DmaRxInterrupt::Done | DmaRxInterrupt::DescriptorError diff --git a/esp-hal/src/lcd_cam/lcd/i8080.rs b/esp-hal/src/lcd_cam/lcd/i8080.rs index 2c8d22c09f3..9b6ab75b93e 100644 --- a/esp-hal/src/lcd_cam/lcd/i8080.rs +++ b/esp-hal/src/lcd_cam/lcd/i8080.rs @@ -502,7 +502,6 @@ impl I8080Transfer<'_, BUF, crate::Async> { type Output = (); fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { - LCD_DONE_WAKER.register(cx.waker()); if Instance::is_lcd_done_set() { // Interrupt bit will be cleared in Self::wait. // This allows `wait_for_done` to be called more than once. @@ -510,6 +509,7 @@ impl I8080Transfer<'_, BUF, crate::Async> { // Instance::clear_lcd_done(); Poll::Ready(()) } else { + LCD_DONE_WAKER.register(cx.waker()); Instance::listen_lcd_done(); Poll::Pending } diff --git a/hil-test/Cargo.toml b/hil-test/Cargo.toml index 9f679509347..8f52933e3dd 100644 --- a/hil-test/Cargo.toml +++ b/hil-test/Cargo.toml @@ -201,7 +201,7 @@ cfg-if = "1.0.0" critical-section = "1.1.3" defmt = "0.3.8" defmt-rtt = { version = "0.4.1", optional = true } -embassy-executor = "0.6.0" +embassy-executor = "0.7.0" embassy-futures = "0.1.1" embassy-sync = "0.6.0" embassy-time = "0.4.0"