mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
add some prelim test routines for flash access
This commit is contained in:
parent
3872ae2a1c
commit
e47ed41726
2 changed files with 24 additions and 0 deletions
|
|
@ -22,6 +22,7 @@ usb-cramium = { path = "../usb-cramium" }
|
|||
modals = { path = "../modals", default-features = false }
|
||||
ux-api = { path = "../../libs/ux-api", optional = true }
|
||||
pddb = { path = "../pddb", optional = true }
|
||||
xous-swapper = { path = "../xous-swapper" }
|
||||
|
||||
# pddb testing
|
||||
rand = { version = "0.8.5", features = ["getrandom"], optional = true }
|
||||
|
|
|
|||
|
|
@ -12,6 +12,29 @@ fn main() {
|
|||
let tt = ticktimer::Ticktimer::new().unwrap();
|
||||
shell::start_shell();
|
||||
|
||||
log::info!("start spi flash map test");
|
||||
let spimap = xous::map_memory(
|
||||
None,
|
||||
xous::MemoryAddress::new(xous::arch::MMAP_VIRT_BASE),
|
||||
cramium_hal::board::SPINOR_LEN as usize,
|
||||
xous::MemoryFlags::R | xous::MemoryFlags::W | xous::MemoryFlags::VIRT,
|
||||
)
|
||||
.expect("couldn't map spi range");
|
||||
log::info!("spimap: {:x?}", spimap);
|
||||
// we have the mapping, now try to dereference it and read something to test it
|
||||
let spislice: &[u32] = unsafe { spimap.as_slice() };
|
||||
// this should trigger the page fault and thus the handler
|
||||
log::info!("spislice: {:x?}", &spislice[..32]);
|
||||
|
||||
// marks modified pages as dirty.
|
||||
xous_swapper::mark_dirty(&spislice[..32]);
|
||||
|
||||
// Calls sync to explicitly flush the dirty pages now
|
||||
xous_swapper::sync(Some(&spislice[..32]));
|
||||
// xous_swapper::sync::<u8>(None);
|
||||
|
||||
log::info!("end spi flash map test");
|
||||
|
||||
#[cfg(feature = "test-scrollbars")]
|
||||
{
|
||||
let mut sl_binding = ux_api::widgets::ScrollableList::default();
|
||||
|
|
|
|||
Loading…
Reference in a new issue