Skip to content

Commit

Permalink
default 4092 for esp32 & fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
liebman committed Sep 18, 2024
1 parent d83ac6c commit e0600ae
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions esp-hal/src/dma/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -585,16 +585,12 @@ macro_rules! dma_circular_descriptors_chunk_size {
#[macro_export]
macro_rules! dma_tx_buffer {
($tx_size:expr, $tx_align:expr) => {{
const TX_DESCRIPTOR_LEN: usize = $crate::dma::DmaTxBuf::compute_descriptor_count($tx_size, $tx_align);
const TX_DESCRIPTOR_LEN: usize =
$crate::dma::DmaTxBuf::compute_descriptor_count($tx_size, $tx_align);
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,
)
};
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)
}};

Expand Down Expand Up @@ -2128,7 +2124,10 @@ impl DmaTxBuf {
pub const fn compute_chunk_size(block_size: Option<DmaBufBlkSize>) -> usize {
match block_size {
Some(size) => 4096 - size as usize,
None => 4095, // TODO: does this need to be chip specific?
#[cfg(esp32)]
None => 4092, // esp32 requires 4 byte alignment
#[cfg(not(esp32))]
None => 4095,
}
}

Expand Down

0 comments on commit e0600ae

Please sign in to comment.