Skip to content

Commit

Permalink
add udma stresstest feature
Browse files Browse the repository at this point in the history
  • Loading branch information
bunnie committed Nov 28, 2024
1 parent ffb00cf commit 2dddae3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions libs/cramium-hal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ board-baosec = [] # USB form factor token
board-baosor = [] # Precursor form factor
board-dabao = [] # Dev board form factor

udma-stress-test = [
] # For RTL simulation testing - aggravates a key corner case

compress-entropy = []
magic-manual = []
std = ["log", "xous-api-names", "usb-device", "xous-api-ticktimer"]
Expand Down
9 changes: 9 additions & 0 deletions libs/cramium-hal/src/udma/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,15 @@ pub trait Udma {
}
}
fn udma_busy(&self, bank: Bank) -> bool {
// create dummy traffic on IFRAM that causes stall conditions on the bus
// the write is totally bogus and
#[cfg(feature = "udma-stress-test")]
for i in 0..12 {
unsafe {
let ifram_tickle = 0x5000_0000 as *mut u32;
ifram_tickle.add(i).write_volatile(i as u32);
}
}
// Safety: only safe when used in the context of UDMA registers.
unsafe {
let saddr = self.csr().base().add(bank as usize).add(DmaReg::Saddr.into()).read_volatile();
Expand Down

0 comments on commit 2dddae3

Please sign in to comment.