add a reset method to the UDMA abstraction

This commit is contained in:
bunnie 2024-11-20 01:42:27 +08:00
parent 72685e2c1c
commit 6829eae73c

View file

@ -413,6 +413,12 @@ pub trait Udma {
bank_addr.add(DmaReg::Size.into()).write_volatile((buf.len() * size_of::<T>()) as u32);
bank_addr.add(DmaReg::Cfg.into()).write_volatile(config | CFG_EN)
}
fn udma_reset(&self, bank: Bank) {
unsafe {
let bank_addr = self.csr().base().add(bank as usize);
bank_addr.add(DmaReg::Cfg.into()).write_volatile(CFG_CLEAR);
}
}
fn udma_can_enqueue(&self, bank: Bank) -> bool {
// Safety: only safe when used in the context of UDMA registers.
unsafe {