Skip to content

Commit

Permalink
Fix reading/writing small buffers
Browse files Browse the repository at this point in the history
  • Loading branch information
bjoernQ committed Jul 5, 2024
1 parent dc4ddcb commit 3e5bd6e
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions esp-hal/src/spi/master.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1136,7 +1136,6 @@ pub mod dma {
ptr,
len,
&mut self.channel.tx,
false,
)?;
}
Ok(())
Expand Down Expand Up @@ -1192,7 +1191,6 @@ pub mod dma {
ptr,
len,
&mut self.channel.rx,
false,
)?;
}

Expand Down Expand Up @@ -1349,7 +1347,6 @@ pub mod dma {
ptr,
len,
&mut self.channel.rx,
false,
)?;
}
Ok(DmaTransferRx::new(self))
Expand Down Expand Up @@ -1429,7 +1426,6 @@ pub mod dma {
ptr,
len,
&mut self.channel.tx,
false,
)?;
}
Ok(DmaTransferTx::new(self))
Expand Down Expand Up @@ -1552,7 +1548,6 @@ pub mod dma {
words.as_mut_ptr(),
words.len(),
future.rx(),
true,
)?;
}
future.await?;
Expand All @@ -1569,7 +1564,6 @@ pub mod dma {
chunk.as_ptr(),
chunk.len(),
future.tx(),
true,
)?;
}
future.await?;
Expand Down Expand Up @@ -2044,7 +2038,7 @@ where
) -> Result<&'w [u8], Error> {
for chunk in words.chunks(MAX_DMA_SIZE) {
unsafe {
self.start_write_bytes_dma(chain, chunk.as_ptr(), chunk.len(), tx, false)?;
self.start_write_bytes_dma(chain, chunk.as_ptr(), chunk.len(), tx)?;
}

while !tx.is_done() {}
Expand All @@ -2061,7 +2055,6 @@ where
ptr: *const u8,
len: usize,
tx: &mut TX,
listen: bool,
) -> Result<(), Error> {
let reg_block = self.register_block();
self.configure_datalen(len as u32 * 8);
Expand All @@ -2081,9 +2074,6 @@ where
self.clear_dma_interrupts();
reset_dma_before_usr_cmd(reg_block);

if listen {
tx.listen_eof();
}
reg_block.cmd().modify(|_, w| w.usr().set_bit());

Ok(())
Expand All @@ -2096,7 +2086,6 @@ where
ptr: *mut u8,
len: usize,
rx: &mut RX,
listen: bool,
) -> Result<(), Error> {
let reg_block = self.register_block();
self.configure_datalen(len as u32 * 8);
Expand All @@ -2114,9 +2103,6 @@ where
self.clear_dma_interrupts();
reset_dma_before_usr_cmd(reg_block);

if listen {
rx.listen_eof();
}
reg_block.cmd().modify(|_, w| w.usr().set_bit());

Ok(())
Expand Down

0 comments on commit 3e5bd6e

Please sign in to comment.