Fix build

This commit is contained in:
Christian Perez Llamas
2022-11-19 01:38:03 +01:00
parent 16838f8a66
commit 64e8cfef8e
4 changed files with 15 additions and 8 deletions

View File

@ -14,13 +14,10 @@ use embassy_hal_common::{into_ref, PeripheralRef};
use crate::gpio::{AnyPin, Pin as GpioPin};
use crate::interrupt::Interrupt;
use crate::pac::i2s::RegisterBlock;
use crate::Peripheral;
use crate::{EASY_DMA_SIZE, Peripheral};
// TODO: Define those in lib.rs somewhere else
/// I2S EasyDMA MAXCNT bit length = 14
const MAX_DMA_MAXCNT: u32 = 1 << 14;
/// Limits for Easy DMA - it can only read from data ram
pub const SRAM_LOWER: usize = 0x2000_0000;
pub const SRAM_UPPER: usize = 0x3000_0000;
@ -956,7 +953,7 @@ impl<T: Instance> Device<T> {
Err(Error::BufferLengthMisaligned)
} else if (ptr as usize) < SRAM_LOWER || (ptr as usize) > SRAM_UPPER {
Err(Error::BufferNotInDataMemory)
} else if maxcnt > MAX_DMA_MAXCNT {
} else if maxcnt as usize > EASY_DMA_SIZE {
Err(Error::BufferTooLong)
} else {
Ok((ptr, maxcnt))