adjustments to self test routines

This commit is contained in:
bunnie 2021-09-06 14:39:44 +08:00
parent e240179f94
commit 1a55973346
4 changed files with 15 additions and 12 deletions

View file

@ -160,11 +160,11 @@ impl Com {
Ok(stats)
}
pub fn poll_usb_cc(&mut self) -> Result<(bool, [u16; 3]), xous::Error> {
pub fn poll_usb_cc(&mut self) -> Result<(bool, [u16; 3], u8), xous::Error> {
let response = send_message(self.conn,
Message::new_blocking_scalar(Opcode::PollUsbCc.to_usize().unwrap(), 0, 0, 0, 0))?;
if let xous::Result::Scalar2(val1, val2) = response {
let event = if (val1 >> 16) == 0 {
let event = if ((val1 >> 16) & 0xff) == 0 {
false
} else {
true
@ -172,9 +172,10 @@ impl Com {
let regs: [u16; 3] = [
(val1 & 0xFFFF) as u16,
(val2 & 0xFFFF) as u16,
((val2 >> 16) & 0xFFFF) as u16
((val2 >> 16) & 0xFF) as u16
];
Ok((event, regs))
let rev: u8 = ((val1 >> 24) & 0xff) as u8;
Ok((event, regs, rev))
} else {
Err(xous::Error::InternalError)
}

View file

@ -210,9 +210,10 @@ mod implementation {
for r in ret.iter_mut() {
*r = self.wait_txrx(ComState::LINK_READ.verb, Some(STD_TIMEOUT));
}
let rev = self.wait_txrx(ComState::LINK_READ.verb, Some(STD_TIMEOUT));
// pack into a format that can be returned as a scalar2
[
((event as u32) << 16) | ret[0] as u32,
((rev & 0xff) as u32) << 24 | (((event & 0xff) as u32) << 16) | ret[0] as u32,
ret[1] as u32 | ((ret[2] as u32) << 16)
]
}

View file

@ -34,16 +34,17 @@ impl<'a> ShellCmdApi<'a> for Test {
env.llio.set_uart_mux(llio::UartType::Log).unwrap();
env.llio.wfi_override(true).unwrap();
let (x, y, z, id) = env.com.gyro_read_blocking().unwrap();
log::info!("{}|GYRO|{}|{}|{}|{}", SENTINEL, x, y, z, id);
log::info!("{}|GYRO|{}|{}|{}|{}|", SENTINEL, x, y, z, id);
let (wf_maj, wf_min, wf_rev) = env.com.get_wf200_fw_rev().unwrap();
log::info!("{}|WF200REV|{}|{}|{}", SENTINEL, wf_maj, wf_min, wf_rev);
log::info!("{}|WF200REV|{}|{}|{}|", SENTINEL, wf_maj, wf_min, wf_rev);
let (ec_rev, ec_dirty) = env.com.get_ec_git_rev().unwrap();
log::info!("{}|ECREV|{:x}|{:?}", SENTINEL, ec_rev, ec_dirty);
log::info!("{}|ECREV|{:x}|{:?}|", SENTINEL, ec_rev, ec_dirty);
let morestats = env.com.get_more_stats().unwrap();
log::info!("{}|BATTSTATS|{:?}", SENTINEL, morestats);
let (usbcc_event, usbcc_regs) = env.com.poll_usb_cc().unwrap();
log::info!("{}|USBCC|{:?}|{:?}", SENTINEL, usbcc_event, usbcc_regs);
log::info!("{}|BATTSTATS|{:?}|", SENTINEL, morestats);
let (usbcc_event, usbcc_regs, usbcc_rev) = env.com.poll_usb_cc().unwrap();
log::info!("{}|USBCC|{:?}|{:?}|{}|", SENTINEL, usbcc_event, usbcc_regs, usbcc_rev);
log::info!("{}|DONE|", SENTINEL);
write!(ret, "Factory test script has run, check serial terminal for output").unwrap();
env.llio.wfi_override(false).unwrap();
}

View file

@ -310,7 +310,7 @@ fn xmain() -> ! {
)
.expect("couldn't create menu thread");
info!("|status: starting main loop");
info!("|status: starting main loop"); // don't change this -- factory test looks for this exact string
loop {
let msg = xous::receive_message(status_sid).unwrap();
log::trace!("|status: Message: {:?}", msg);