Skip to content

Commit

Permalink
drop block_size from macro, the buffer allocation was not being align…
Browse files Browse the repository at this point in the history
…ed - its not needed for dram anyway.
  • Loading branch information
liebman committed Sep 19, 2024
1 parent c229379 commit 374a334
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions esp-hal/src/dma/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -567,10 +567,8 @@ macro_rules! dma_circular_descriptors_chunk_size {
};
}

/// Convenience macro to create a DmaTxBuf from buffer size and optional
/// alignment. The buffer and descriptors are statically allocated used to
/// create the `DmaTxBuf` with the passed alignment. With one ardument, the
/// alignment is set to `None`.
/// Convenience macro to create a DmaTxBuf from buffer size. The buffer and
/// descriptors are statically allocated and used to create the `DmaTxBuf`.
///
/// ## Usage
/// ```rust,no_run
Expand All @@ -584,19 +582,15 @@ macro_rules! dma_circular_descriptors_chunk_size {
/// ```
#[macro_export]
macro_rules! dma_tx_buffer {
($tx_size:expr, $tx_align:expr) => {{
($tx_size:expr) => {{
const TX_DESCRIPTOR_LEN: usize =
$crate::dma::DmaTxBuf::compute_descriptor_count($tx_size, $tx_align);
$crate::dma::DmaTxBuf::compute_descriptor_count($tx_size, None);
static mut TX_BUFFER: [u8; $tx_size] = [0u8; $tx_size];
static mut TX_DESCRIPTORS: [$crate::dma::DmaDescriptor; TX_DESCRIPTOR_LEN] =
[$crate::dma::DmaDescriptor::EMPTY; TX_DESCRIPTOR_LEN];
let (tx_buffer, tx_descriptors) = unsafe { (&mut TX_BUFFER, &mut TX_DESCRIPTORS) };
$crate::dma::DmaTxBuf::new_with_block_size(tx_descriptors, tx_buffer, $tx_align)
$crate::dma::DmaTxBuf::new(tx_descriptors, tx_buffer)
}};

($tx_size:expr) => {
$crate::dma_tx_buffer!($tx_size, None)
};
}

/// DMA Errors
Expand Down

0 comments on commit 374a334

Please sign in to comment.