mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-17 08:40:52 +00:00
improve debug telemetry on llio
This commit is contained in:
parent
c3a331291b
commit
9b3aeeecc2
2 changed files with 9 additions and 7 deletions
|
|
@ -183,7 +183,7 @@ impl I2cStateMachine {
|
||||||
|
|
||||||
/// Assumes we are initiating on a "clean" I2C machine (idle, no errors, no callbacks or state mapped)
|
/// Assumes we are initiating on a "clean" I2C machine (idle, no errors, no callbacks or state mapped)
|
||||||
fn checked_initiate(&mut self, transaction: I2cTransaction, msg: xous::MessageEnvelope) {
|
fn checked_initiate(&mut self, transaction: I2cTransaction, msg: xous::MessageEnvelope) {
|
||||||
log::debug!("I2C initated with {:x?}", transaction);
|
log::debug!("I2C initiated with {:x?}", transaction);
|
||||||
// sanity-check the bounds limits
|
// sanity-check the bounds limits
|
||||||
if transaction.txlen > 258 || transaction.rxlen > 258 {
|
if transaction.txlen > 258 || transaction.rxlen > 258 {
|
||||||
self.report_response(I2cStatus::ResponseFormatError, None);
|
self.report_response(I2cStatus::ResponseFormatError, None);
|
||||||
|
|
|
||||||
|
|
@ -37,8 +37,9 @@ fn i2c_thread(i2c_sid: xous::SID) {
|
||||||
log::trace!("starting i2c main loop");
|
log::trace!("starting i2c main loop");
|
||||||
loop {
|
loop {
|
||||||
let msg = xous::receive_message(i2c_sid).unwrap();
|
let msg = xous::receive_message(i2c_sid).unwrap();
|
||||||
log::trace!("i2c message: {:?}", msg);
|
let opcode: Option::<I2cOpcode> = FromPrimitive::from_usize(msg.body.id());
|
||||||
match FromPrimitive::from_usize(msg.body.id()) {
|
log::debug!("{:?}", opcode);
|
||||||
|
match opcode {
|
||||||
Some(I2cOpcode::SuspendResume) => xous::msg_scalar_unpack!(msg, token, _, _, _, {
|
Some(I2cOpcode::SuspendResume) => xous::msg_scalar_unpack!(msg, token, _, _, _, {
|
||||||
if !i2c_mutex_acquired && !i2c.is_busy() {
|
if !i2c_mutex_acquired && !i2c.is_busy() {
|
||||||
i2c.suspend();
|
i2c.suspend();
|
||||||
|
|
@ -172,7 +173,7 @@ fn main() -> ! {
|
||||||
let i2c_sid = xns.register_name(api::SERVER_NAME_I2C, Some(2)).expect("can't register I2C thread");
|
let i2c_sid = xns.register_name(api::SERVER_NAME_I2C, Some(2)).expect("can't register I2C thread");
|
||||||
#[cfg(not(target_os = "xous"))]
|
#[cfg(not(target_os = "xous"))]
|
||||||
let i2c_sid = xns.register_name(api::SERVER_NAME_I2C, Some(1)).expect("can't register I2C thread");
|
let i2c_sid = xns.register_name(api::SERVER_NAME_I2C, Some(1)).expect("can't register I2C thread");
|
||||||
log::trace!("registered I2C thread with NS -- {:?}", i2c_sid);
|
log::debug!("registered I2C thread with NS -- {:?}", i2c_sid);
|
||||||
let _ = thread::spawn({
|
let _ = thread::spawn({
|
||||||
let i2c_sid = i2c_sid.clone();
|
let i2c_sid = i2c_sid.clone();
|
||||||
move || {
|
move || {
|
||||||
|
|
@ -203,11 +204,12 @@ fn main() -> ! {
|
||||||
let mut i2c = llio::I2c::new(&xns);
|
let mut i2c = llio::I2c::new(&xns);
|
||||||
let tt = ticktimer_server::Ticktimer::new().unwrap();
|
let tt = ticktimer_server::Ticktimer::new().unwrap();
|
||||||
|
|
||||||
log::trace!("starting main loop");
|
log::debug!("starting main loop");
|
||||||
loop {
|
loop {
|
||||||
let msg = xous::receive_message(llio_sid).unwrap();
|
let msg = xous::receive_message(llio_sid).unwrap();
|
||||||
log::trace!("Message: {:?}", msg);
|
let opcode: Option::<Opcode> = FromPrimitive::from_usize(msg.body.id());
|
||||||
match FromPrimitive::from_usize(msg.body.id()) {
|
log::debug!("{:?}", opcode);
|
||||||
|
match opcode {
|
||||||
Some(Opcode::SuspendResume) => xous::msg_scalar_unpack!(msg, token, _, _, _, {
|
Some(Opcode::SuspendResume) => xous::msg_scalar_unpack!(msg, token, _, _, _, {
|
||||||
llio.suspend();
|
llio.suspend();
|
||||||
#[cfg(feature="tts")]
|
#[cfg(feature="tts")]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue