mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-17 08:40:52 +00:00
add bootwait command line API to test
also refactor the test argument parsing so that i can use the more modern version of the api
This commit is contained in:
parent
2b19c4bd21
commit
2a7cffb86e
2 changed files with 228 additions and 210 deletions
|
|
@ -25,6 +25,7 @@ pddb = { path = "../pddb", optional = true }
|
||||||
xous-swapper = { path = "../xous-swapper", optional = true }
|
xous-swapper = { path = "../xous-swapper", optional = true }
|
||||||
bytemuck = "1.24.0"
|
bytemuck = "1.24.0"
|
||||||
susres = { package = "xous-api-susres", version = "0.9.68" }
|
susres = { package = "xous-api-susres", version = "0.9.68" }
|
||||||
|
keystore = { path = "../keystore" }
|
||||||
|
|
||||||
# pddb testing
|
# pddb testing
|
||||||
rand = { version = "0.8.5", features = ["getrandom"], optional = true }
|
rand = { version = "0.8.5", features = ["getrandom"], optional = true }
|
||||||
|
|
|
||||||
|
|
@ -15,242 +15,259 @@ impl<'a> ShellCmdApi<'a> for Test {
|
||||||
let mut ret = String::new();
|
let mut ret = String::new();
|
||||||
|
|
||||||
#[allow(unused_variables)]
|
#[allow(unused_variables)]
|
||||||
let helpstring = "test [proc] [freemem] [interrupts]; see code for other test commands.";
|
let helpstring = "test [proc] [freemem] [interrupts] [bootwait]; see code for other test commands.";
|
||||||
|
|
||||||
#[cfg(feature = "bmp180")]
|
#[cfg(feature = "bmp180")]
|
||||||
let helpstring = "Usage:
|
let helpstring = "Usage:
|
||||||
temp - reads temperature from bmp180.";
|
temp - reads temperature from bmp180.";
|
||||||
|
|
||||||
let mut tokens = args.split(' ');
|
let mut parts = args.split_whitespace();
|
||||||
|
let cmd = parts.next().unwrap_or("").to_string();
|
||||||
|
let args: Vec<String> = parts.map(|s| s.to_string()).collect();
|
||||||
|
|
||||||
if let Some(sub_cmd) = tokens.next() {
|
match cmd.as_str() {
|
||||||
match sub_cmd {
|
"bootwait" => {
|
||||||
"timer" => {
|
let keystore = keystore::Keystore::new(&_env.xns);
|
||||||
let start = _env.ticktimer.elapsed_ms();
|
if args.len() != 1 {
|
||||||
log::info!("Starting test");
|
write!(ret, "bootwait [check | enable | disable]").ok();
|
||||||
let mut seconds = 0;
|
}
|
||||||
loop {
|
if args[0] == "check" {
|
||||||
let elapsed = _env.ticktimer.elapsed_ms() - start;
|
write!(ret, "bootwait is {:?}", keystore.bootwait(None).unwrap()).ok();
|
||||||
if elapsed > seconds * 1000 {
|
} else if args[0] == "enable" {
|
||||||
log::info!("{} s", seconds);
|
keystore.bootwait(Some(true)).unwrap();
|
||||||
seconds += 1;
|
write!(ret, "bootwait enabled").ok();
|
||||||
}
|
log::info!(
|
||||||
|
"{}BOOTWAIT.ENABLED,{}",
|
||||||
|
bao1x_hal::board::BOOKEND_START,
|
||||||
|
bao1x_hal::board::BOOKEND_END
|
||||||
|
);
|
||||||
|
} else if args[0] == "disable" {
|
||||||
|
keystore.bootwait(Some(false)).unwrap();
|
||||||
|
write!(ret, "bootwait disabled").ok();
|
||||||
|
} else {
|
||||||
|
write!(ret, "bootwait [check | enable | disable]").ok();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"timer" => {
|
||||||
|
let start = _env.ticktimer.elapsed_ms();
|
||||||
|
log::info!("Starting test");
|
||||||
|
let mut seconds = 0;
|
||||||
|
loop {
|
||||||
|
let elapsed = _env.ticktimer.elapsed_ms() - start;
|
||||||
|
if elapsed > seconds * 1000 {
|
||||||
|
log::info!("{} s", seconds);
|
||||||
|
seconds += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"time" => {
|
}
|
||||||
use chrono::{Local, Utc};
|
"time" => {
|
||||||
let systime = std::time::SystemTime::now();
|
use chrono::{Local, Utc};
|
||||||
let epoch = systime.duration_since(std::time::SystemTime::UNIX_EPOCH).unwrap();
|
let systime = std::time::SystemTime::now();
|
||||||
log::info!("Seconds since epoch: {}", epoch.as_secs());
|
let epoch = systime.duration_since(std::time::SystemTime::UNIX_EPOCH).unwrap();
|
||||||
log::info!("Systime: {:?}", systime);
|
log::info!("Seconds since epoch: {}", epoch.as_secs());
|
||||||
let now = Utc::now();
|
log::info!("Systime: {:?}", systime);
|
||||||
log::info!("UTC now {}", now.format("%Y-%m-%d %H:%M:%S UTC"));
|
let now = Utc::now();
|
||||||
let local_now = Local::now();
|
log::info!("UTC now {}", now.format("%Y-%m-%d %H:%M:%S UTC"));
|
||||||
log::info!("Local time: {}", local_now.format("%Y-%m-%d %H:%M:%S %Z"));
|
let local_now = Local::now();
|
||||||
|
log::info!("Local time: {}", local_now.format("%Y-%m-%d %H:%M:%S %Z"));
|
||||||
|
|
||||||
log::info!("Waiting 3 seconds");
|
log::info!("Waiting 3 seconds");
|
||||||
std::thread::sleep(std::time::Duration::from_secs(3));
|
std::thread::sleep(std::time::Duration::from_secs(3));
|
||||||
|
|
||||||
let systime = std::time::SystemTime::now();
|
let systime = std::time::SystemTime::now();
|
||||||
let epoch = systime.duration_since(std::time::SystemTime::UNIX_EPOCH).unwrap();
|
let epoch = systime.duration_since(std::time::SystemTime::UNIX_EPOCH).unwrap();
|
||||||
log::info!("Seconds since epoch: {}", epoch.as_secs());
|
log::info!("Seconds since epoch: {}", epoch.as_secs());
|
||||||
log::info!("Systime: {:?}", systime);
|
log::info!("Systime: {:?}", systime);
|
||||||
let now = Utc::now();
|
let now = Utc::now();
|
||||||
log::info!("UTC now {}", now.format("%Y-%m-%d %H:%M:%S UTC"));
|
log::info!("UTC now {}", now.format("%Y-%m-%d %H:%M:%S UTC"));
|
||||||
let local_now = Local::now();
|
let local_now = Local::now();
|
||||||
log::info!("Local time: {}", local_now.format("%Y-%m-%d %H:%M:%S %Z"));
|
log::info!("Local time: {}", local_now.format("%Y-%m-%d %H:%M:%S %Z"));
|
||||||
}
|
}
|
||||||
#[cfg(feature = "bmp180")]
|
#[cfg(feature = "bmp180")]
|
||||||
"temp" => {
|
"temp" => {
|
||||||
use bao1x_hal::bmp180::Bmp180;
|
use bao1x_hal::bmp180::Bmp180;
|
||||||
use bao1x_hal::i2c::I2c;
|
use bao1x_hal::i2c::I2c;
|
||||||
let mut i2c = I2c::new();
|
let mut i2c = I2c::new();
|
||||||
|
|
||||||
match Bmp180::new(&mut i2c) {
|
match Bmp180::new(&mut i2c) {
|
||||||
Ok(sensor) => match sensor.read_temperature(&mut i2c) {
|
Ok(sensor) => match sensor.read_temperature(&mut i2c) {
|
||||||
Ok(temp) => {
|
Ok(temp) => {
|
||||||
write!(ret, "BMP180 Temperature: {:.1}°C", temp).unwrap();
|
write!(ret, "BMP180 Temperature: {:.1}°C", temp).unwrap();
|
||||||
}
|
}
|
||||||
Err(e) => {
|
|
||||||
write!(ret, "Failed to read temperature: {:?}", e).unwrap();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
write!(ret, "Failed to initialize BMP180 sensor: {:?}", e).unwrap();
|
write!(ret, "Failed to read temperature: {:?}", e).unwrap();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Err(e) => {
|
||||||
|
write!(ret, "Failed to initialize BMP180 sensor: {:?}", e).unwrap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[cfg(not(feature = "hosted-baosec"))]
|
||||||
|
"shipmode" => {
|
||||||
|
use bao1x_hal::i2c::I2c;
|
||||||
|
let mut i2c = I2c::new();
|
||||||
|
|
||||||
|
let mut axp2101 = bao1x_hal::axp2101::Axp2101::new(&mut i2c).expect("couldn't get AXP2101");
|
||||||
|
log::info!("sending shipmode to axp2101 pmic...in four seconds");
|
||||||
|
let tt = ticktimer::Ticktimer::new().unwrap();
|
||||||
|
tt.sleep_ms(4000).ok();
|
||||||
|
// shut down BLDO1 - this should disconnect the battery
|
||||||
|
axp2101.set_ldo(&mut i2c, None, bao1x_hal::axp2101::WhichLdo::Bldo1).ok();
|
||||||
|
// shut down PMIC
|
||||||
|
axp2101.powerdown(&mut i2c).ok();
|
||||||
|
log::info!("sent shutdown to axp2101");
|
||||||
|
}
|
||||||
|
#[cfg(not(feature = "hosted-baosec"))]
|
||||||
|
"deepsleep" => {
|
||||||
|
let gfx = ux_api::service::gfx::Gfx::new(&_env.xns).unwrap();
|
||||||
|
log::info!("turn off display");
|
||||||
|
gfx.set_power(false).unwrap();
|
||||||
|
log::info!("display off");
|
||||||
|
use num_traits::*;
|
||||||
|
// monkey patch over the standard xous IP
|
||||||
|
let conn = _env
|
||||||
|
.xns
|
||||||
|
.request_connection_blocking(susres::api::SERVER_NAME_SUSRES)
|
||||||
|
.expect("Can't connect to SUSRES");
|
||||||
|
match xous::send_message(
|
||||||
|
conn,
|
||||||
|
xous::Message::new_blocking_scalar(
|
||||||
|
susres::api::Opcode::SuspendRequest.to_usize().unwrap(),
|
||||||
|
1, // this is a monkeypatch
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
),
|
||||||
|
) {
|
||||||
|
Ok(xous::Result::Scalar1(result)) => {
|
||||||
|
if result == 1 {
|
||||||
|
log::info!("Should be in deep sleep!");
|
||||||
|
} else {
|
||||||
|
log::error!("Couldn't initiate deep sleep")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
_ => panic!("Couldn't send deep sleep message to susres"),
|
||||||
}
|
}
|
||||||
#[cfg(not(feature = "hosted-baosec"))]
|
}
|
||||||
"shipmode" => {
|
"seed" => {
|
||||||
use bao1x_hal::i2c::I2c;
|
let (_, value) = std::env::vars().find(|(key, _value)| key == "SEED").unwrap();
|
||||||
let mut i2c = I2c::new();
|
log::info!("Seed: {:?}", value);
|
||||||
|
}
|
||||||
|
#[cfg(not(feature = "hosted-baosec"))]
|
||||||
|
"wfi" => {
|
||||||
|
let gfx = ux_api::service::gfx::Gfx::new(&_env.xns).unwrap();
|
||||||
|
log::info!("turn off display");
|
||||||
|
gfx.set_power(false).unwrap();
|
||||||
|
log::info!("display off");
|
||||||
|
let susres = susres::Susres::new_without_hook(&_env.xns).unwrap();
|
||||||
|
log::info!("initiating wfi from test shell...");
|
||||||
|
susres.initiate_suspend().unwrap();
|
||||||
|
log::info!("waiting after WFI return (system will be in WFI)");
|
||||||
|
_env.ticktimer.sleep_ms(100).ok();
|
||||||
|
log::info!("turn on display");
|
||||||
|
gfx.set_power(true).unwrap();
|
||||||
|
}
|
||||||
|
"proc" => {
|
||||||
|
// hard coded - debug feature - if the platform ABI changes its name or opcode map this
|
||||||
|
// can break, but also this routine is not meant for public
|
||||||
|
// consumption and coding it here avoids breaking dependencies to the Xous API crate.
|
||||||
|
let page_buf = xous::PageBuf::new();
|
||||||
|
xous::rsyscall(xous::SysCall::PlatformSpecific(2, page_buf.as_ptr(), 0, 0, 0, 0, 0)).unwrap();
|
||||||
|
|
||||||
let mut axp2101 =
|
log::info!("Process listing:");
|
||||||
bao1x_hal::axp2101::Axp2101::new(&mut i2c).expect("couldn't get AXP2101");
|
for line in page_buf.as_str().lines() {
|
||||||
log::info!("sending shipmode to axp2101 pmic...in four seconds");
|
log::info!("{}", line);
|
||||||
let tt = ticktimer::Ticktimer::new().unwrap();
|
|
||||||
tt.sleep_ms(4000).ok();
|
|
||||||
// shut down BLDO1 - this should disconnect the battery
|
|
||||||
axp2101.set_ldo(&mut i2c, None, bao1x_hal::axp2101::WhichLdo::Bldo1).ok();
|
|
||||||
// shut down PMIC
|
|
||||||
axp2101.powerdown(&mut i2c).ok();
|
|
||||||
log::info!("sent shutdown to axp2101");
|
|
||||||
}
|
}
|
||||||
#[cfg(not(feature = "hosted-baosec"))]
|
}
|
||||||
"deepsleep" => {
|
"freemem" => {
|
||||||
let gfx = ux_api::service::gfx::Gfx::new(&_env.xns).unwrap();
|
// hard coded - debug feature - if the platform ABI changes its name or opcode map this
|
||||||
log::info!("turn off display");
|
// can break, but also this routine is not meant for public
|
||||||
gfx.set_power(false).unwrap();
|
// consumption and coding it here avoids breaking dependencies to the Xous API crate.
|
||||||
log::info!("display off");
|
let page_buf = xous::PageBuf::new();
|
||||||
use num_traits::*;
|
xous::rsyscall(xous::SysCall::PlatformSpecific(1, page_buf.as_ptr(), 0, 0, 0, 0, 0)).unwrap();
|
||||||
// monkey patch over the standard xous IP
|
|
||||||
let conn = _env
|
log::info!("RAM usage:");
|
||||||
.xns
|
for line in page_buf.as_str().lines() {
|
||||||
.request_connection_blocking(susres::api::SERVER_NAME_SUSRES)
|
log::info!("{}", line);
|
||||||
.expect("Can't connect to SUSRES");
|
}
|
||||||
match xous::send_message(
|
}
|
||||||
conn,
|
"interrupts" => {
|
||||||
xous::Message::new_blocking_scalar(
|
// hard coded - debug feature - if the platform ABI changes its name or opcode map this
|
||||||
susres::api::Opcode::SuspendRequest.to_usize().unwrap(),
|
// can break, but also this routine is not meant for public
|
||||||
1, // this is a monkeypatch
|
// consumption and coding it here avoids breaking dependencies to the Xous API crate.
|
||||||
0,
|
let page_buf = xous::PageBuf::new();
|
||||||
0,
|
xous::rsyscall(xous::SysCall::PlatformSpecific(3, page_buf.as_ptr(), 0, 0, 0, 0, 0)).unwrap();
|
||||||
0,
|
|
||||||
),
|
log::info!("Interrupt handlers:");
|
||||||
) {
|
for line in page_buf.as_str().lines() {
|
||||||
Ok(xous::Result::Scalar1(result)) => {
|
log::info!("{}", line);
|
||||||
if result == 1 {
|
}
|
||||||
log::info!("Should be in deep sleep!");
|
}
|
||||||
} else {
|
#[cfg(feature = "board-baosec")]
|
||||||
log::error!("Couldn't initiate deep sleep")
|
"qrshow" => {
|
||||||
}
|
// note that 40 bytes gives 320 bits which fits nicely into a version 3 code,
|
||||||
|
// which allows 4 pixels per module rendering.
|
||||||
|
// if we have to move to 3 pixels per module, the next code up that optimally
|
||||||
|
// uses the full screen is version 6. This would give 102 bytes of transfer
|
||||||
|
// in a single scan.
|
||||||
|
//
|
||||||
|
// The equation for capacity is:
|
||||||
|
// `binary_bytes = floor((alphanumeric_capacity / 3) × 2)`
|
||||||
|
//
|
||||||
|
// where `alphameric_capacity` is the capacity of the QR code version
|
||||||
|
// per spec lookup table.
|
||||||
|
let modals = modals::Modals::new(&_env.xns).unwrap();
|
||||||
|
let mut test_data = [0u8; 40];
|
||||||
|
for (i, d) in test_data.iter_mut().enumerate() {
|
||||||
|
*d = i as u8;
|
||||||
|
}
|
||||||
|
let encoded = base45::encode(&test_data);
|
||||||
|
modals.show_notification("", Some(&encoded)).ok();
|
||||||
|
}
|
||||||
|
#[cfg(feature = "board-baosec")]
|
||||||
|
"qrget" => {
|
||||||
|
let gfx = ux_api::service::gfx::Gfx::new(&_env.xns).unwrap();
|
||||||
|
match gfx.acquire_qr() {
|
||||||
|
Ok(qr_data) => {
|
||||||
|
if let Some(meta) = qr_data.meta {
|
||||||
|
log::info!("QR code metadata: {}", meta);
|
||||||
}
|
}
|
||||||
_ => panic!("Couldn't send deep sleep message to susres"),
|
if let Some(coded) = qr_data.content {
|
||||||
}
|
match base45::decode(&coded) {
|
||||||
}
|
Ok(data) => {
|
||||||
"seed" => {
|
log::info!("Recovered: {:x?}", data);
|
||||||
let (_, value) = std::env::vars().find(|(key, _value)| key == "SEED").unwrap();
|
}
|
||||||
log::info!("Seed: {:?}", value);
|
Err(e) => {
|
||||||
}
|
log::info!("Base45 decode err: {:?}", e);
|
||||||
#[cfg(not(feature = "hosted-baosec"))]
|
|
||||||
"wfi" => {
|
|
||||||
let gfx = ux_api::service::gfx::Gfx::new(&_env.xns).unwrap();
|
|
||||||
log::info!("turn off display");
|
|
||||||
gfx.set_power(false).unwrap();
|
|
||||||
log::info!("display off");
|
|
||||||
let susres = susres::Susres::new_without_hook(&_env.xns).unwrap();
|
|
||||||
log::info!("initiating wfi from test shell...");
|
|
||||||
susres.initiate_suspend().unwrap();
|
|
||||||
log::info!("waiting after WFI return (system will be in WFI)");
|
|
||||||
_env.ticktimer.sleep_ms(100).ok();
|
|
||||||
log::info!("turn on display");
|
|
||||||
gfx.set_power(true).unwrap();
|
|
||||||
}
|
|
||||||
"proc" => {
|
|
||||||
// hard coded - debug feature - if the platform ABI changes its name or opcode map this
|
|
||||||
// can break, but also this routine is not meant for public
|
|
||||||
// consumption and coding it here avoids breaking dependencies to the Xous API crate.
|
|
||||||
let page_buf = xous::PageBuf::new();
|
|
||||||
xous::rsyscall(xous::SysCall::PlatformSpecific(2, page_buf.as_ptr(), 0, 0, 0, 0, 0))
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
log::info!("Process listing:");
|
|
||||||
for line in page_buf.as_str().lines() {
|
|
||||||
log::info!("{}", line);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"freemem" => {
|
|
||||||
// hard coded - debug feature - if the platform ABI changes its name or opcode map this
|
|
||||||
// can break, but also this routine is not meant for public
|
|
||||||
// consumption and coding it here avoids breaking dependencies to the Xous API crate.
|
|
||||||
let page_buf = xous::PageBuf::new();
|
|
||||||
xous::rsyscall(xous::SysCall::PlatformSpecific(1, page_buf.as_ptr(), 0, 0, 0, 0, 0))
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
log::info!("RAM usage:");
|
|
||||||
for line in page_buf.as_str().lines() {
|
|
||||||
log::info!("{}", line);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"interrupts" => {
|
|
||||||
// hard coded - debug feature - if the platform ABI changes its name or opcode map this
|
|
||||||
// can break, but also this routine is not meant for public
|
|
||||||
// consumption and coding it here avoids breaking dependencies to the Xous API crate.
|
|
||||||
let page_buf = xous::PageBuf::new();
|
|
||||||
xous::rsyscall(xous::SysCall::PlatformSpecific(3, page_buf.as_ptr(), 0, 0, 0, 0, 0))
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
log::info!("Interrupt handlers:");
|
|
||||||
for line in page_buf.as_str().lines() {
|
|
||||||
log::info!("{}", line);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#[cfg(feature = "board-baosec")]
|
|
||||||
"qrshow" => {
|
|
||||||
// note that 40 bytes gives 320 bits which fits nicely into a version 3 code,
|
|
||||||
// which allows 4 pixels per module rendering.
|
|
||||||
// if we have to move to 3 pixels per module, the next code up that optimally
|
|
||||||
// uses the full screen is version 6. This would give 102 bytes of transfer
|
|
||||||
// in a single scan.
|
|
||||||
//
|
|
||||||
// The equation for capacity is:
|
|
||||||
// `binary_bytes = floor((alphanumeric_capacity / 3) × 2)`
|
|
||||||
//
|
|
||||||
// where `alphameric_capacity` is the capacity of the QR code version
|
|
||||||
// per spec lookup table.
|
|
||||||
let modals = modals::Modals::new(&_env.xns).unwrap();
|
|
||||||
let mut test_data = [0u8; 40];
|
|
||||||
for (i, d) in test_data.iter_mut().enumerate() {
|
|
||||||
*d = i as u8;
|
|
||||||
}
|
|
||||||
let encoded = base45::encode(&test_data);
|
|
||||||
modals.show_notification("", Some(&encoded)).ok();
|
|
||||||
}
|
|
||||||
#[cfg(feature = "board-baosec")]
|
|
||||||
"qrget" => {
|
|
||||||
let gfx = ux_api::service::gfx::Gfx::new(&_env.xns).unwrap();
|
|
||||||
match gfx.acquire_qr() {
|
|
||||||
Ok(qr_data) => {
|
|
||||||
if let Some(meta) = qr_data.meta {
|
|
||||||
log::info!("QR code metadata: {}", meta);
|
|
||||||
}
|
|
||||||
if let Some(coded) = qr_data.content {
|
|
||||||
match base45::decode(&coded) {
|
|
||||||
Ok(data) => {
|
|
||||||
log::info!("Recovered: {:x?}", data);
|
|
||||||
}
|
|
||||||
Err(e) => {
|
|
||||||
log::info!("Base45 decode err: {:?}", e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(e) => {
|
|
||||||
log::info!("QR error: {:?}", e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
Err(e) => {
|
||||||
/* // leave this around in case we have more swap bugs to debug
|
log::info!("QR error: {:?}", e);
|
||||||
// needs to have `swaptest1`` & `swaptest2` added to the image for this to work.
|
|
||||||
"swap" => {
|
|
||||||
log::info!("starting swap test");
|
|
||||||
let swaptest1 = _env.xns.request_connection("swaptest1").unwrap();
|
|
||||||
let swaptest2 = _env.xns.request_connection("swaptest2").unwrap();
|
|
||||||
for i in 1..4 {
|
|
||||||
log::info!("iter {}", i);
|
|
||||||
xous::send_message(swaptest1, xous::Message::new_scalar(0, i, 0, 0, 0)).unwrap();
|
|
||||||
xous::send_message(swaptest2, xous::Message::new_scalar(0, i + 1, 0, 0, 0)).unwrap();
|
|
||||||
}
|
}
|
||||||
log::info!("swaptest done");
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
_ => {
|
|
||||||
write!(ret, "{}", helpstring).unwrap();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
/* // leave this around in case we have more swap bugs to debug
|
||||||
write!(ret, "{}", helpstring).unwrap();
|
// needs to have `swaptest1`` & `swaptest2` added to the image for this to work.
|
||||||
|
"swap" => {
|
||||||
|
log::info!("starting swap test");
|
||||||
|
let swaptest1 = _env.xns.request_connection("swaptest1").unwrap();
|
||||||
|
let swaptest2 = _env.xns.request_connection("swaptest2").unwrap();
|
||||||
|
for i in 1..4 {
|
||||||
|
log::info!("iter {}", i);
|
||||||
|
xous::send_message(swaptest1, xous::Message::new_scalar(0, i, 0, 0, 0)).unwrap();
|
||||||
|
xous::send_message(swaptest2, xous::Message::new_scalar(0, i + 1, 0, 0, 0)).unwrap();
|
||||||
|
}
|
||||||
|
log::info!("swaptest done");
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
_ => {
|
||||||
|
write!(ret, "{}", helpstring).unwrap();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(Some(ret))
|
Ok(Some(ret))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue