Skip to content

Commit

Permalink
Only enable interrupts when future is polled
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominic Fischer committed Jul 22, 2024
1 parent d3db3e0 commit 8e62204
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
24 changes: 12 additions & 12 deletions esp-hal/src/dma/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2154,8 +2154,6 @@ pub(crate) mod asynch {
TX: Tx,
{
pub fn new(tx: &'a mut TX) -> Self {
tx.listen_eof();
tx.listen_out_descriptor_error();
Self { tx, _a: () }
}

Expand All @@ -2182,6 +2180,8 @@ pub(crate) mod asynch {
self.tx.clear_interrupts();
Poll::Ready(Err(DmaError::DescriptorError))
} else {
self.tx.listen_eof();
self.tx.listen_out_descriptor_error();
Poll::Pending
}
}
Expand Down Expand Up @@ -2210,10 +2210,6 @@ pub(crate) mod asynch {
RX: Rx,
{
pub fn new(rx: &'a mut RX) -> Self {
rx.listen_eof();
rx.listen_in_descriptor_error();
rx.listen_in_descriptor_error_dscr_empty();
rx.listen_in_descriptor_error_err_eof();
Self { rx, _a: () }
}

Expand Down Expand Up @@ -2243,6 +2239,10 @@ pub(crate) mod asynch {
self.rx.clear_interrupts();
Poll::Ready(Err(DmaError::DescriptorError))
} else {
self.rx.listen_eof();
self.rx.listen_in_descriptor_error();
self.rx.listen_in_descriptor_error_dscr_empty();
self.rx.listen_in_descriptor_error_err_eof();
Poll::Pending
}
}
Expand Down Expand Up @@ -2275,8 +2275,6 @@ pub(crate) mod asynch {
TX: Tx,
{
pub fn new(tx: &'a mut TX) -> Self {
tx.listen_ch_out_done();
tx.listen_out_descriptor_error();
Self { tx, _a: () }
}
}
Expand All @@ -2300,6 +2298,8 @@ pub(crate) mod asynch {
self.tx.clear_interrupts();
Poll::Ready(Err(DmaError::DescriptorError))
} else {
self.tx.listen_ch_out_done();
self.tx.listen_out_descriptor_error();
Poll::Pending
}
}
Expand Down Expand Up @@ -2331,10 +2331,6 @@ pub(crate) mod asynch {
RX: Rx,
{
pub fn new(rx: &'a mut RX) -> Self {
rx.listen_ch_in_done();
rx.listen_in_descriptor_error();
rx.listen_in_descriptor_error_dscr_empty();
rx.listen_in_descriptor_error_err_eof();
Self { rx, _a: () }
}
}
Expand All @@ -2361,6 +2357,10 @@ pub(crate) mod asynch {
self.rx.clear_interrupts();
Poll::Ready(Err(DmaError::DescriptorError))
} else {
self.rx.listen_ch_in_done();
self.rx.listen_in_descriptor_error();
self.rx.listen_in_descriptor_error_dscr_empty();
self.rx.listen_in_descriptor_error_err_eof();
Poll::Pending
}
}
Expand Down
5 changes: 3 additions & 2 deletions esp-hal/src/parl_io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1758,8 +1758,9 @@ pub mod asynch {
}
}

Self::start_receive_bytes_dma(&mut self.rx_channel, &mut self.rx_chain, ptr, len)?;
DmaRxDoneChFuture::new(&mut self.rx_channel).await?;
let future = DmaRxDoneChFuture::new(&mut self.rx_channel);
Self::start_receive_bytes_dma(future.rx, &mut self.rx_chain, ptr, len)?;
future.await?;

Ok(())
}
Expand Down

0 comments on commit 8e62204

Please sign in to comment.