mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-17 08:40:52 +00:00
Merge pull request #596 from betrusted-io/cram-dev
merge dev mods to avoid branch divergence
This commit is contained in:
commit
cfc1114671
4 changed files with 28 additions and 12 deletions
|
|
@ -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"]
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -318,10 +318,11 @@ pub fn host_fifo_tests() -> usize {
|
|||
//
|
||||
// finally, we're pegged at 15, because, backpressure caused us to miss the rest of
|
||||
// the entries, and we are stuck at the final written value of the output test
|
||||
print!("rbk: {:x}\r", rbk);
|
||||
if i <= 9 {
|
||||
assert!(rbk == !(0xF1F0_0000 + i));
|
||||
assert!(rbk == (0xF1F0_0000 + i));
|
||||
} else {
|
||||
assert!(rbk == !(0xF1F0_0000 + 15));
|
||||
assert!(rbk == (0xF1F0_0000 + 15));
|
||||
}
|
||||
print!("backpressure {:x}\r", rbk);
|
||||
}
|
||||
|
|
@ -402,7 +403,7 @@ pub fn host_fifo_tests() -> usize {
|
|||
bio_code!(fifo_host0_bitbang, FIFO_HOST0_BITBANG_START, FIFO_HOST0_BITBANG_END,
|
||||
"li t0, 0xFFFFFFFF",
|
||||
"mv x26, t0", // ensure mask is disabled
|
||||
"mv x25, t0", // set all pins to inputs
|
||||
"mv x24, t0", // set all pins to outputs
|
||||
"90:",
|
||||
"mv x21, x16",
|
||||
"mv x20, zero",
|
||||
|
|
|
|||
|
|
@ -1415,14 +1415,6 @@ unsafe fn init_clock_asic(freq_hz: u32) -> u32 {
|
|||
|
||||
crate::println!("pllq: 0x{:x}, pllmn: 0x{:x}, n_frac: 0x{:x}", pllq, pllmn, n_frac);
|
||||
|
||||
daric_cgu.add(sysctrl::SFR_CGUSEL1.offset()).write_volatile(1); // 0: RC, 1: XTAL
|
||||
daric_cgu.add(sysctrl::SFR_CGUFSCR.offset()).write_volatile(48); // external crystal is 48MHz
|
||||
daric_cgu.add(sysctrl::SFR_CGUSET.offset()).write_volatile(0x32);
|
||||
|
||||
if freq_hz < 1_000_000 {
|
||||
daric_cgu.add(sysctrl::SFR_IPCOSC.offset()).write_volatile(freq_hz);
|
||||
daric_cgu.add(sysctrl::SFR_IPCARIPFLOW.offset()).write_volatile(0x32); // commit, must write 32
|
||||
}
|
||||
// switch to OSC
|
||||
daric_cgu.add(sysctrl::SFR_CGUSEL0.offset()).write_volatile(0); // clktop sel, 0:clksys, 1:clkpll0
|
||||
daric_cgu.add(sysctrl::SFR_CGUSET.offset()).write_volatile(0x32); // commit
|
||||
|
|
@ -1430,7 +1422,7 @@ unsafe fn init_clock_asic(freq_hz: u32) -> u32 {
|
|||
if 0 == freq_hz {
|
||||
// do nothing
|
||||
} else {
|
||||
// PD PLL
|
||||
// powerdown PLL
|
||||
daric_cgu
|
||||
.add(sysctrl::SFR_IPCLPEN.offset())
|
||||
.write_volatile(daric_cgu.add(sysctrl::SFR_IPCLPEN.offset()).read_volatile() | 0x02);
|
||||
|
|
@ -1453,6 +1445,17 @@ unsafe fn init_clock_asic(freq_hz: u32) -> u32 {
|
|||
// daric_cgu.add(sysctrl::SFR_IPCCR.offset()).write_volatile((3 << 6) | (5 << 3) | (5));
|
||||
daric_cgu.add(sysctrl::SFR_IPCARIPFLOW.offset()).write_volatile(0x32); // commit, must write 32
|
||||
|
||||
// ensure the correct oscillator is selected here. It's put after the PLL is configured
|
||||
// to ensure the PLL doesn't get edges while in an invalid configuration.
|
||||
daric_cgu.add(sysctrl::SFR_CGUSEL1.offset()).write_volatile(1); // 0: RC, 1: XTAL
|
||||
daric_cgu.add(sysctrl::SFR_CGUFSCR.offset()).write_volatile(48); // external crystal is 48MHz
|
||||
daric_cgu.add(sysctrl::SFR_CGUSET.offset()).write_volatile(0x32);
|
||||
|
||||
if freq_hz < 1_000_000 {
|
||||
daric_cgu.add(sysctrl::SFR_IPCOSC.offset()).write_volatile(freq_hz);
|
||||
daric_cgu.add(sysctrl::SFR_IPCARIPFLOW.offset()).write_volatile(0x32); // commit, must write 32
|
||||
}
|
||||
|
||||
daric_cgu
|
||||
.add(sysctrl::SFR_IPCLPEN.offset())
|
||||
.write_volatile(daric_cgu.add(sysctrl::SFR_IPCLPEN.offset()).read_volatile() & !0x02);
|
||||
|
|
|
|||
Loading…
Reference in a new issue