mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
debug the test oqc integration
This commit is contained in:
parent
cbe7c0ce83
commit
f464e34eef
4 changed files with 44 additions and 23 deletions
|
|
@ -72,7 +72,8 @@ utralib = {path = "../../utralib"}
|
|||
[features]
|
||||
debugprint = []
|
||||
spinortest = [] # for spinor testing. contra-indicated with PDDB, as it steals memory from the PDDB.
|
||||
default = [] # "debugprint"
|
||||
benchmarks = [] # adds the benchmark routines. Left off normally to free up code and memory space.
|
||||
default = ["benchmarks"] # "debugprint"
|
||||
|
||||
[target.'cfg(any(windows,unix))'.dependencies]
|
||||
debug-here = "*"
|
||||
|
|
|
|||
|
|
@ -94,7 +94,6 @@ mod backlight; use backlight::*;
|
|||
mod accel; use accel::*;
|
||||
mod sha; use sha::*;
|
||||
mod ecup; use ecup::*;
|
||||
mod aes_cmd; use aes_cmd::*;
|
||||
mod trng_cmd; use trng_cmd::*;
|
||||
mod engine; use engine::*;
|
||||
mod console; use console::*;
|
||||
|
|
@ -105,6 +104,10 @@ mod jtag_cmd; use jtag_cmd::*;
|
|||
mod net_cmd; use net_cmd::*;
|
||||
mod pddb_cmd; use pddb_cmd::*;
|
||||
|
||||
#[cfg(feature="benchmarks")]
|
||||
mod aes_cmd;
|
||||
#[cfg(feature="benchmarks")]
|
||||
use aes_cmd::*;
|
||||
//mod fcc; use fcc::*;
|
||||
//mod pds; // dependency of the FCC file
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ pub struct Test {
|
|||
end_time: Option<DateTime>,
|
||||
start_elapsed: Option<u64>,
|
||||
end_elapsed: Option<u64>,
|
||||
oqc_cid: Option<xous::CID>,
|
||||
oqc_start: u64,
|
||||
#[cfg(any(target_os = "none", target_os = "xous"))]
|
||||
jtag: jtag::Jtag,
|
||||
|
|
@ -68,6 +69,7 @@ impl Test {
|
|||
end_time: None,
|
||||
start_elapsed: None,
|
||||
end_elapsed: None,
|
||||
oqc_cid: None,
|
||||
oqc_start: 0,
|
||||
#[cfg(any(target_os = "none", target_os = "xous"))]
|
||||
jtag: jtag::Jtag::new(&xns).unwrap(),
|
||||
|
|
@ -398,24 +400,32 @@ impl<'a> ShellCmdApi<'a> for Test {
|
|||
log::info!("{}|ASTOP|", SENTINEL);
|
||||
}
|
||||
"oqc" => {
|
||||
let oqc_cid = Arc::new(AtomicU32::new(0));
|
||||
// start the OQC thread
|
||||
let _ = std::thread::spawn({
|
||||
let oqc_cid = oqc_cid.clone();
|
||||
move || {
|
||||
crate::oqc_test::oqc_test(oqc_cid);
|
||||
}
|
||||
});
|
||||
// wait until the OQC thread has connected itself
|
||||
while oqc_cid.load(Ordering::SeqCst) == 0 {
|
||||
env.ticktimer.sleep_ms(200).unwrap();
|
||||
}
|
||||
|
||||
if ((env.llio.adc_vbus().unwrap() as f64) * 0.005033) > 1.5 {
|
||||
// if power is plugged in, deny powerdown request
|
||||
write!(ret, "Can't run OQC test while charging. Unplug charging cable and try again.").unwrap();
|
||||
return Ok(Some(ret));
|
||||
}
|
||||
// start the server if it isn't started already, but only allow it to start once. Note that the CID stays the same between calls,
|
||||
// because the SID is stable between calls and we're calling from the same process each time.
|
||||
let oqc_cid = if let Some(oc) = self.oqc_cid {
|
||||
oc
|
||||
} else {
|
||||
let oqc_cid = Arc::new(AtomicU32::new(0));
|
||||
// start the OQC thread
|
||||
let _ = std::thread::spawn({
|
||||
let oqc_cid = oqc_cid.clone();
|
||||
move || {
|
||||
crate::oqc_test::oqc_test(oqc_cid);
|
||||
}
|
||||
});
|
||||
// wait until the OQC thread has connected itself
|
||||
while oqc_cid.load(Ordering::SeqCst) == 0 {
|
||||
env.ticktimer.sleep_ms(200).unwrap();
|
||||
}
|
||||
self.oqc_cid = Some(oqc_cid.load(Ordering::SeqCst));
|
||||
oqc_cid.load(Ordering::SeqCst)
|
||||
};
|
||||
|
||||
let susres = susres::Susres::new_without_hook(&env.xns).unwrap();
|
||||
env.llio.wfi_override(true).unwrap();
|
||||
// activate SSID scanning while the test runs
|
||||
|
|
@ -446,13 +456,13 @@ impl<'a> ShellCmdApi<'a> for Test {
|
|||
susres.initiate_suspend().unwrap();
|
||||
env.ticktimer.sleep_ms(1000).unwrap(); // pause for the suspend/resume cycle
|
||||
|
||||
let timeout = 60_0000;
|
||||
xous::send_message(oqc_cid.load(Ordering::SeqCst),
|
||||
let timeout = 60_000;
|
||||
xous::send_message(oqc_cid,
|
||||
xous::Message::new_blocking_scalar(OqcOp::Trigger.to_usize().unwrap(), timeout, 0, 0, 0,)
|
||||
).expect("couldn't trigger self test");
|
||||
|
||||
loop {
|
||||
match oqc_status(oqc_cid.load(Ordering::SeqCst)) {
|
||||
match oqc_status(oqc_cid) {
|
||||
Some(true) => {
|
||||
let ssid_str = env.com.ssid_fetch_as_string().unwrap();
|
||||
use std::str::FromStr;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use num_traits::*;
|
||||
use gam::modal::*;
|
||||
use keyboard::{RowCol, KeyRawStates};
|
||||
use core::sync::atomic::{AtomicU32, Ordering};
|
||||
use core::sync::atomic::{AtomicU32, Ordering, AtomicBool};
|
||||
use std::sync::Arc;
|
||||
|
||||
pub(crate) const SERVER_NAME_OQC: &str = "_Outgoing Quality Check Test Program_";
|
||||
|
|
@ -18,7 +18,14 @@ pub(crate) enum OqcOp {
|
|||
Quit,
|
||||
}
|
||||
|
||||
static SERVER_STARTED: AtomicBool = AtomicBool::new(false);
|
||||
pub(crate) fn oqc_test(oqc_cid: Arc<AtomicU32>) {
|
||||
// only start the server once!
|
||||
if SERVER_STARTED.load(Ordering::SeqCst) {
|
||||
return
|
||||
}
|
||||
SERVER_STARTED.store(true, Ordering::SeqCst);
|
||||
|
||||
let xns = xous_names::XousNames::new().unwrap();
|
||||
// we allow any connections because this server is not spawned until it is needed
|
||||
let oqc_sid = xns.register_name(SERVER_NAME_OQC, None).expect("can't register server");
|
||||
|
|
@ -190,10 +197,11 @@ pub(crate) fn oqc_test(oqc_cid: Arc<AtomicU32>) {
|
|||
Some(OqcOp::ModalDrop) => {
|
||||
log::error!("test modal quit unexpectedly");
|
||||
}
|
||||
Some(OqcOp::Quit) => {
|
||||
Some(OqcOp::Quit) => xous::msg_blocking_scalar_unpack!(msg, _, _, _, _, {
|
||||
log::warn!("Quit received on OQC");
|
||||
xous::return_scalar(msg.sender, 1).unwrap();
|
||||
break;
|
||||
}
|
||||
}),
|
||||
None => {
|
||||
log::error!("couldn't convert OqcOp: {:?}", msg);
|
||||
}
|
||||
|
|
@ -203,8 +211,7 @@ pub(crate) fn oqc_test(oqc_cid: Arc<AtomicU32>) {
|
|||
log::trace!("main loop exit, destroying servers");
|
||||
xns.unregister_server(oqc_sid).unwrap();
|
||||
xous::destroy_server(oqc_sid).unwrap();
|
||||
log::trace!("quitting");
|
||||
xous::terminate_process(0)
|
||||
log::trace!("quitting oqc server");
|
||||
}
|
||||
|
||||
fn populate_vectors() -> Vec::<(RowCol, bool)> {
|
||||
|
|
|
|||
Loading…
Reference in a new issue