Skip to content

Commit

Permalink
Clear interrupts earlier
Browse files Browse the repository at this point in the history
  • Loading branch information
bjoernQ committed Jul 5, 2024
1 parent 221081f commit 35a2163
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions esp-hal/src/spi/master.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2015,14 +2015,16 @@ where
self.update();

reset_dma_before_load_dma_dscr(reg_block);

self.clear_dma_interrupts();

tx_chain.fill_for_tx(false, write_buffer_ptr, write_buffer_len)?;
tx.prepare_transfer_without_start(self.dma_peripheral(), tx_chain)
.and_then(|_| tx.start_transfer())?;
rx_chain.fill_for_rx(false, read_buffer_ptr, read_buffer_len)?;
rx.prepare_transfer_without_start(self.dma_peripheral(), rx_chain)
.and_then(|_| rx.start_transfer())?;

self.clear_dma_interrupts();
reset_dma_before_usr_cmd(reg_block);

reg_block.cmd().modify(|_, w| w.usr().set_bit());
Expand Down Expand Up @@ -2065,13 +2067,15 @@ where
self.update();

reset_dma_before_load_dma_dscr(reg_block);

self.clear_dma_interrupts();

chain.fill_for_tx(false, ptr, len)?;
unsafe {
tx.prepare_transfer_without_start(self.dma_peripheral(), chain)
.and_then(|_| tx.start_transfer())?;
}

self.clear_dma_interrupts();
reset_dma_before_usr_cmd(reg_block);

reg_block.cmd().modify(|_, w| w.usr().set_bit());
Expand All @@ -2096,11 +2100,13 @@ where
self.update();

reset_dma_before_load_dma_dscr(reg_block);

self.clear_dma_interrupts();

chain.fill_for_rx(false, ptr, len)?;
rx.prepare_transfer_without_start(self.dma_peripheral(), chain)
.and_then(|_| rx.start_transfer())?;

self.clear_dma_interrupts();
reset_dma_before_usr_cmd(reg_block);

reg_block.cmd().modify(|_, w| w.usr().set_bit());
Expand Down

0 comments on commit 35a2163

Please sign in to comment.