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 15, 2024
1 parent 0cae79b commit c3d48a6
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 @@ -1140,7 +1140,6 @@ pub mod dma {
ptr,
len,
&mut self.channel.tx,
false,
)?;
}
Ok(())
Expand Down Expand Up @@ -1196,7 +1195,6 @@ pub mod dma {
ptr,
len,
&mut self.channel.rx,
false,
)?;
}

Expand Down Expand Up @@ -1353,7 +1351,6 @@ pub mod dma {
ptr,
len,
&mut self.channel.rx,
false,
)?;
}
Ok(DmaTransferRx::new(self))
Expand Down Expand Up @@ -1433,7 +1430,6 @@ pub mod dma {
ptr,
len,
&mut self.channel.tx,
false,
)?;
}
Ok(DmaTransferTx::new(self))
Expand Down Expand Up @@ -1556,7 +1552,6 @@ pub mod dma {
words.as_mut_ptr(),
words.len(),
future.rx(),
true,
)?;
}
future.await?;
Expand All @@ -1573,7 +1568,6 @@ pub mod dma {
chunk.as_ptr(),
chunk.len(),
future.tx(),
true,
)?;
}
future.await?;
Expand Down Expand Up @@ -2048,7 +2042,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 @@ -2065,7 +2059,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 @@ -2085,9 +2078,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 @@ -2100,7 +2090,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 @@ -2118,9 +2107,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 c3d48a6

Please sign in to comment.