mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-17 08:40:52 +00:00
disable suspend/resume support in hosted mode
hosted mode doesn't have suspend/resume support, and it's not worth debugging subtle issues on that side of the fence that seem to be OS-dependent.
This commit is contained in:
parent
0621fed5d6
commit
05df98d1c1
6 changed files with 24 additions and 4 deletions
|
|
@ -117,7 +117,7 @@ pub fn status_thread(canvas_gid_0: usize, canvas_gid_1: usize, canvas_gid_2: usi
|
||||||
let mut rtc = rtc::Rtc::new(&xns).unwrap();
|
let mut rtc = rtc::Rtc::new(&xns).unwrap();
|
||||||
|
|
||||||
// TODO: debug why this is unreliable
|
// TODO: debug why this is unreliable
|
||||||
rtc.clear_wakeup_alarm().unwrap(); // clear any wakeup alarm state, if it was set
|
//rtc.clear_wakeup_alarm().unwrap(); // clear any wakeup alarm state, if it was set
|
||||||
|
|
||||||
rtc.hook_rtc_callback(dt_callback).unwrap();
|
rtc.hook_rtc_callback(dt_callback).unwrap();
|
||||||
let mut datetime: Option<rtc::DateTime> = None;
|
let mut datetime: Option<rtc::DateTime> = None;
|
||||||
|
|
|
||||||
|
|
@ -91,13 +91,14 @@ fn xmain() -> ! {
|
||||||
op::rounded_rectangle(display.native_buffer(), rr, None);
|
op::rounded_rectangle(display.native_buffer(), rr, None);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let screen_clip = Rectangle::new(Point::new(0,0), display.screen_size());
|
||||||
|
|
||||||
|
display.redraw();
|
||||||
|
|
||||||
// register a suspend/resume listener
|
// register a suspend/resume listener
|
||||||
let sr_cid = xous::connect(sid).expect("couldn't create suspend callback connection");
|
let sr_cid = xous::connect(sid).expect("couldn't create suspend callback connection");
|
||||||
let mut susres = susres::Susres::new(&xns, Opcode::SuspendResume as u32, sr_cid).expect("couldn't create suspend/resume object");
|
let mut susres = susres::Susres::new(&xns, Opcode::SuspendResume as u32, sr_cid).expect("couldn't create suspend/resume object");
|
||||||
|
|
||||||
let screen_clip = Rectangle::new(Point::new(0,0), display.screen_size());
|
|
||||||
|
|
||||||
display.redraw();
|
|
||||||
loop {
|
loop {
|
||||||
let mut msg = xous::receive_message(sid).unwrap();
|
let mut msg = xous::receive_message(sid).unwrap();
|
||||||
log::trace!("Message: {:?}", msg);
|
log::trace!("Message: {:?}", msg);
|
||||||
|
|
|
||||||
|
|
@ -230,6 +230,7 @@ fn handle_scalar(
|
||||||
}
|
}
|
||||||
1200 => writeln!(output, "Terminating process").unwrap(),
|
1200 => writeln!(output, "Terminating process").unwrap(),
|
||||||
2000 => {
|
2000 => {
|
||||||
|
#[cfg(target_os = "none")]
|
||||||
crate::debug::DEFAULT.enable_rx();
|
crate::debug::DEFAULT.enable_rx();
|
||||||
writeln!(output, "Resuming logger").unwrap();
|
writeln!(output, "Resuming logger").unwrap();
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -174,12 +174,14 @@ impl<const N: usize> SuspendResume for RegManager<N> {
|
||||||
|
|
||||||
// because the volatile memory regions can be potentially large (128kiB), but fewer (maybe 5-6 total in the system),
|
// because the volatile memory regions can be potentially large (128kiB), but fewer (maybe 5-6 total in the system),
|
||||||
// we allocate these as stand-alone structures and manage them explicitly.
|
// we allocate these as stand-alone structures and manage them explicitly.
|
||||||
|
#[derive(Debug)]
|
||||||
#[cfg(target_os = "none")]
|
#[cfg(target_os = "none")]
|
||||||
pub struct ManagedMem<const N: usize> {
|
pub struct ManagedMem<const N: usize> {
|
||||||
pub mem: xous::MemoryRange,
|
pub mem: xous::MemoryRange,
|
||||||
pub backing: [u32; N],
|
pub backing: [u32; N],
|
||||||
}
|
}
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
|
#[cfg(target_os = "none")]
|
||||||
impl<const N: usize> ManagedMem<N> {
|
impl<const N: usize> ManagedMem<N> {
|
||||||
pub fn new(src: xous::MemoryRange) -> Self {
|
pub fn new(src: xous::MemoryRange) -> Self {
|
||||||
ManagedMem {
|
ManagedMem {
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ pub struct Susres {
|
||||||
execution_gate_conn: CID,
|
execution_gate_conn: CID,
|
||||||
}
|
}
|
||||||
impl Susres {
|
impl Susres {
|
||||||
|
#[cfg(target_os = "none")]
|
||||||
pub fn new(xns: &xous_names::XousNames, cb_discriminant: u32, cid: CID) -> Result<Self, xous::Error> {
|
pub fn new(xns: &xous_names::XousNames, cb_discriminant: u32, cid: CID) -> Result<Self, xous::Error> {
|
||||||
let conn = xns.request_connection_blocking(api::SERVER_NAME_SUSRES).expect("Can't connect to SUSRES");
|
let conn = xns.request_connection_blocking(api::SERVER_NAME_SUSRES).expect("Can't connect to SUSRES");
|
||||||
let execution_gate_conn = xns.request_connection_blocking(api::SERVER_NAME_EXEC_GATE).expect("Can't connect to the execution gate");
|
let execution_gate_conn = xns.request_connection_blocking(api::SERVER_NAME_EXEC_GATE).expect("Can't connect to the execution gate");
|
||||||
|
|
@ -35,6 +36,20 @@ impl Susres {
|
||||||
execution_gate_conn,
|
execution_gate_conn,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
// suspend/resume is not implemented in hosted mode, and will break if you try to do it.
|
||||||
|
// the main reason this was doen is actually it seems hosted mode can't handle the level
|
||||||
|
// of concurrency introduced by suspend/resume, as its underlying IPC mechanisms are quite
|
||||||
|
// different and have a lot of overhead; it seems like the system goes into a form of deadlock
|
||||||
|
// during boot when all the hosted mode servers try to connect. This isn't an issue on real hardware.
|
||||||
|
#[cfg(not(target_os = "none"))]
|
||||||
|
pub fn new(xns: &xous_names::XousNames, cb_discriminant: u32, cid: CID) -> Result<Self, xous::Error> {
|
||||||
|
Ok(Susres {
|
||||||
|
conn: 0,
|
||||||
|
suspend_cb_sid: None,
|
||||||
|
execution_gate_conn: 0,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
pub fn new_without_hook(xns: &xous_names::XousNames) -> Result<Self, xous::Error> {
|
pub fn new_without_hook(xns: &xous_names::XousNames) -> Result<Self, xous::Error> {
|
||||||
let conn = xns.request_connection_blocking(api::SERVER_NAME_SUSRES)?;
|
let conn = xns.request_connection_blocking(api::SERVER_NAME_SUSRES)?;
|
||||||
Ok(Susres {
|
Ok(Susres {
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,7 @@ impl XousNames {
|
||||||
Err(xous::Error::AccessDenied) => return Err(xous::Error::AccessDenied),
|
Err(xous::Error::AccessDenied) => return Err(xous::Error::AccessDenied),
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
|
log::info!("connection to {} could not be established, retrying", name);
|
||||||
xous::yield_slice();
|
xous::yield_slice();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue