Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix test
Browse files Browse the repository at this point in the history
bugadani committed Dec 3, 2024
1 parent a32548a commit 0583ce7
Showing 3 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions esp-hal/src/dma/buffers.rs
Original file line number Diff line number Diff line change
@@ -345,6 +345,8 @@ pub enum TransferDirection {
}

/// Holds all the information needed to configure a DMA channel for a transfer.
#[derive(PartialEq, Eq, Debug)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub struct Preparation {
/// The descriptor the DMA will start from.
pub start: *mut DmaDescriptor,
6 changes: 6 additions & 0 deletions esp-hal/src/dma/mod.rs
Original file line number Diff line number Diff line change
@@ -1908,6 +1908,9 @@ where
) -> Result<(), DmaError> {
debug_assert_eq!(preparation.direction, TransferDirection::In);

debug!("Preparing RX transfer {:?}", preparation);
trace!("First descriptor {:?}", unsafe { &*preparation.start });

#[cfg(psram_dma)]
if preparation.accesses_psram && !self.rx_impl.can_access_psram() {
return Err(DmaError::UnsupportedMemoryRegion);
@@ -2199,6 +2202,9 @@ where
) -> Result<(), DmaError> {
debug_assert_eq!(preparation.direction, TransferDirection::Out);

debug!("Preparing TX transfer {:?}", preparation);
trace!("First descriptor {:?}", unsafe { &*preparation.start });

#[cfg(psram_dma)]
if preparation.accesses_psram && !self.tx_impl.can_access_psram() {
return Err(DmaError::UnsupportedMemoryRegion);
6 changes: 6 additions & 0 deletions hil-test/tests/spi_full_duplex.rs
Original file line number Diff line number Diff line change
@@ -204,6 +204,9 @@ mod tests {
unit.channel0
.set_input_mode(EdgeMode::Hold, EdgeMode::Increment);

dma_rx_buf.set_length(TRANSFER_SIZE);
dma_tx_buf.set_length(TRANSFER_SIZE);

// Fill the buffer where each byte has 3 pos edges.
dma_tx_buf.as_mut_slice().fill(0b0110_1010);

@@ -242,6 +245,9 @@ mod tests {
unit.channel0
.set_input_mode(EdgeMode::Hold, EdgeMode::Increment);

dma_rx_buf.set_length(TRANSFER_SIZE);
dma_tx_buf.set_length(TRANSFER_SIZE);

// Fill the buffer where each byte has 3 pos edges.
dma_tx_buf.as_mut_slice().fill(0b0110_1010);

0 comments on commit 0583ce7

Please sign in to comment.