Skip to content

Commit

Permalink
Don't register waker if the DMA is done (#3045)
Browse files Browse the repository at this point in the history
* Don't register waker if the DMA is done

* Update embassy-executor in HIL tests
  • Loading branch information
bugadani authored Jan 28, 2025
1 parent fbca764 commit ad1b645
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions esp-hal/src/dma/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2938,7 +2938,6 @@ pub(crate) mod asynch {
self: core::pin::Pin<&mut Self>,
cx: &mut core::task::Context<'_>,
) -> Poll<Self::Output> {
self.tx.waker().register(cx.waker());
if self.tx.is_done() {
self.tx.clear_interrupts();
Poll::Ready(Ok(()))
Expand All @@ -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
Expand Down Expand Up @@ -2994,7 +2994,6 @@ pub(crate) mod asynch {
self: core::pin::Pin<&mut Self>,
cx: &mut core::task::Context<'_>,
) -> Poll<Self::Output> {
self.rx.waker().register(cx.waker());
if self.rx.is_done() {
self.rx.clear_interrupts();
Poll::Ready(Ok(()))
Expand All @@ -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
Expand Down Expand Up @@ -3060,7 +3060,6 @@ pub(crate) mod asynch {
self: core::pin::Pin<&mut Self>,
cx: &mut core::task::Context<'_>,
) -> Poll<Self::Output> {
self.tx.waker().register(cx.waker());
if self
.tx
.pending_out_interrupts()
Expand All @@ -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
Expand Down Expand Up @@ -3124,7 +3124,6 @@ pub(crate) mod asynch {
self: core::pin::Pin<&mut Self>,
cx: &mut core::task::Context<'_>,
) -> Poll<Self::Output> {
self.rx.waker().register(cx.waker());
if self
.rx
.pending_in_interrupts()
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion esp-hal/src/lcd_cam/lcd/i8080.rs
Original file line number Diff line number Diff line change
Expand Up @@ -502,14 +502,14 @@ impl<BUF: DmaTxBuffer> I8080Transfer<'_, BUF, crate::Async> {
type Output = ();

fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
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.
//
// Instance::clear_lcd_done();
Poll::Ready(())
} else {
LCD_DONE_WAKER.register(cx.waker());
Instance::listen_lcd_done();
Poll::Pending
}
Expand Down
2 changes: 1 addition & 1 deletion hil-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit ad1b645

Please sign in to comment.