mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
prevent interrupt storm on sleep from the COM
This commit is contained in:
parent
5ef7126ede
commit
a94bb0e4d7
1 changed files with 9 additions and 0 deletions
|
|
@ -394,6 +394,7 @@ fn xmain() -> ! {
|
||||||
parse_version(&mut com)
|
parse_version(&mut com)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
let mut desired_int_mask = 0;
|
||||||
|
|
||||||
trace!("starting main loop");
|
trace!("starting main loop");
|
||||||
loop {
|
loop {
|
||||||
|
|
@ -401,12 +402,19 @@ fn xmain() -> ! {
|
||||||
trace!("Message: {:?}", msg);
|
trace!("Message: {:?}", msg);
|
||||||
match FromPrimitive::from_usize(msg.body.id()) {
|
match FromPrimitive::from_usize(msg.body.id()) {
|
||||||
Some(Opcode::SuspendResume) => xous::msg_scalar_unpack!(msg, token, _, _, _, {
|
Some(Opcode::SuspendResume) => xous::msg_scalar_unpack!(msg, token, _, _, _, {
|
||||||
|
com.txrx(ComState::LINK_SET_INTMASK.verb);
|
||||||
|
com.txrx(0); // suppress interrupts on suspend
|
||||||
|
|
||||||
if bl_main != 0 || bl_sec != 0 {
|
if bl_main != 0 || bl_sec != 0 {
|
||||||
com.txrx(ComState::BL_START.verb); // this will turn off the backlights
|
com.txrx(ComState::BL_START.verb); // this will turn off the backlights
|
||||||
}
|
}
|
||||||
com.suspend();
|
com.suspend();
|
||||||
susres.suspend_until_resume(token).expect("couldn't execute suspend/resume");
|
susres.suspend_until_resume(token).expect("couldn't execute suspend/resume");
|
||||||
com.resume();
|
com.resume();
|
||||||
|
|
||||||
|
com.txrx(ComState::LINK_SET_INTMASK.verb);
|
||||||
|
com.txrx(desired_int_mask); // restore interrupts on resume
|
||||||
|
|
||||||
if bl_main != 0 || bl_sec != 0 { // restore the backlight settings, if they are not 0
|
if bl_main != 0 || bl_sec != 0 { // restore the backlight settings, if they are not 0
|
||||||
com.txrx(ComState::BL_START.verb | (bl_main as u16) & 0x1f | (((bl_sec as u16) & 0x1f) << 5));
|
com.txrx(ComState::BL_START.verb | (bl_main as u16) & 0x1f | (((bl_sec as u16) & 0x1f) << 5));
|
||||||
}
|
}
|
||||||
|
|
@ -917,6 +925,7 @@ fn xmain() -> ! {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some(Opcode::IntSetMask) => msg_blocking_scalar_unpack!(msg, mask_val, _, _, _, {
|
Some(Opcode::IntSetMask) => msg_blocking_scalar_unpack!(msg, mask_val, _, _, _, {
|
||||||
|
desired_int_mask = mask_val as u16;
|
||||||
com.txrx(ComState::LINK_SET_INTMASK.verb);
|
com.txrx(ComState::LINK_SET_INTMASK.verb);
|
||||||
com.txrx(mask_val as u16);
|
com.txrx(mask_val as u16);
|
||||||
xous::return_scalar(msg.sender, 1)
|
xous::return_scalar(msg.sender, 1)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue