From 1a559733460577fb43563e47b620b07fce3858f7 Mon Sep 17 00:00:00 2001 From: bunnie Date: Mon, 6 Sep 2021 14:39:44 +0800 Subject: [PATCH] adjustments to self test routines --- services/com/src/lib.rs | 9 +++++---- services/com/src/main.rs | 3 ++- services/shellchat/src/cmds/test.rs | 13 +++++++------ services/status/src/main.rs | 2 +- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/services/com/src/lib.rs b/services/com/src/lib.rs index 293153a5c..961c8e5b5 100644 --- a/services/com/src/lib.rs +++ b/services/com/src/lib.rs @@ -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) } diff --git a/services/com/src/main.rs b/services/com/src/main.rs index f01fa507c..a24cdb2b3 100644 --- a/services/com/src/main.rs +++ b/services/com/src/main.rs @@ -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) ] } diff --git a/services/shellchat/src/cmds/test.rs b/services/shellchat/src/cmds/test.rs index 4d061f84c..9c64d13a8 100644 --- a/services/shellchat/src/cmds/test.rs +++ b/services/shellchat/src/cmds/test.rs @@ -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(); } diff --git a/services/status/src/main.rs b/services/status/src/main.rs index ff240017a..494624f01 100644 --- a/services/status/src/main.rs +++ b/services/status/src/main.rs @@ -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);