mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
Merge branch 'backups' into main
This commit is contained in:
commit
0e6d721bcf
5 changed files with 13 additions and 10 deletions
|
|
@ -425,8 +425,9 @@ fn main() -> ! {
|
||||||
trace!("starting main loop");
|
trace!("starting main loop");
|
||||||
loop {
|
loop {
|
||||||
let mut msg = xous::receive_message(com_sid).unwrap();
|
let mut msg = xous::receive_message(com_sid).unwrap();
|
||||||
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, _, _, _, {
|
||||||
com.txrx(ComState::LINK_SET_INTMASK.verb);
|
com.txrx(ComState::LINK_SET_INTMASK.verb);
|
||||||
com.txrx(0); // suppress interrupts on suspend
|
com.txrx(0); // suppress interrupts on suspend
|
||||||
|
|
|
||||||
|
|
@ -190,7 +190,9 @@ pub fn start_time_server() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
let msg = xous::receive_message(pub_sid).unwrap();
|
let msg = xous::receive_message(pub_sid).unwrap();
|
||||||
match FromPrimitive::from_usize(msg.body.id()) {
|
let op: Option<TimeOp> = FromPrimitive::from_usize(msg.body.id());
|
||||||
|
log::debug!("{:?}", op);
|
||||||
|
match op {
|
||||||
Some(TimeOp::PddbMountPoll) => {
|
Some(TimeOp::PddbMountPoll) => {
|
||||||
tt.sleep_ms(330).unwrap();
|
tt.sleep_ms(330).unwrap();
|
||||||
if temp < 10 {
|
if temp < 10 {
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,7 @@ impl Susres {
|
||||||
pub fn getop_suspend(&self) -> u32 { Opcode::SuspendRequest.to_u32().unwrap() }
|
pub fn getop_suspend(&self) -> u32 { Opcode::SuspendRequest.to_u32().unwrap() }
|
||||||
|
|
||||||
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> {
|
||||||
|
REFCOUNT.fetch_add(1, Ordering::Relaxed);
|
||||||
let conn = xns.request_connection_blocking(api::SERVER_NAME_SUSRES)?;
|
let conn = xns.request_connection_blocking(api::SERVER_NAME_SUSRES)?;
|
||||||
Ok(Susres {
|
Ok(Susres {
|
||||||
conn,
|
conn,
|
||||||
|
|
|
||||||
|
|
@ -615,7 +615,7 @@ fn main() -> ! {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Some(Opcode::SuspendReady) => msg_scalar_unpack!(msg, token, _, _, _, {
|
Some(Opcode::SuspendReady) => msg_scalar_unpack!(msg, token, _, _, _, {
|
||||||
//log::trace!("suspendready with token {}", token);
|
log::debug!("SuspendReady with token {}", token);
|
||||||
if !suspend_requested {
|
if !suspend_requested {
|
||||||
log::error!("received a SuspendReady message when a suspend wasn't pending from token {}", token);
|
log::error!("received a SuspendReady message when a suspend wasn't pending from token {}", token);
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -642,7 +642,7 @@ fn main() -> ! {
|
||||||
for sub in suspend_subscribers.iter() {
|
for sub in suspend_subscribers.iter() {
|
||||||
if sub.order == current_op_order {
|
if sub.order == current_op_order {
|
||||||
if !sub.ready_to_suspend {
|
if !sub.ready_to_suspend {
|
||||||
log::trace!(" -> NOT READY: {}", sub.token);
|
log::debug!(" -> NOT READY token: {}", sub.token);
|
||||||
all_ready = false;
|
all_ready = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -656,7 +656,7 @@ fn main() -> ! {
|
||||||
susres_hw.do_suspend(false);
|
susres_hw.do_suspend(false);
|
||||||
|
|
||||||
// ---- power turns off ----
|
// ---- power turns off ----
|
||||||
// ---- time passes while we are asleep ----
|
// ---- time passes while we are off. The FPGA is powered off; all registers are lost, but RAM is retained. ----
|
||||||
// ---- omg power came back! ---
|
// ---- omg power came back! ---
|
||||||
|
|
||||||
// when do_suspend() returns, it means we've resumed
|
// when do_suspend() returns, it means we've resumed
|
||||||
|
|
@ -731,13 +731,12 @@ fn main() -> ! {
|
||||||
},
|
},
|
||||||
Some(Opcode::SuspendTimeout) => {
|
Some(Opcode::SuspendTimeout) => {
|
||||||
if timeout_pending {
|
if timeout_pending {
|
||||||
log::info!("suspend call has timed out, forcing a suspend");
|
|
||||||
// record which tokens had not reported in
|
// record which tokens had not reported in
|
||||||
for sub in suspend_subscribers.iter_mut() {
|
for sub in suspend_subscribers.iter_mut() {
|
||||||
sub.failed_to_suspend = !sub.ready_to_suspend;
|
sub.failed_to_suspend = !sub.ready_to_suspend;
|
||||||
}
|
}
|
||||||
timeout_pending = false;
|
timeout_pending = false;
|
||||||
log::warn!("Suspend timed out, forcing an unclean suspend");
|
log::warn!("Suspend timed out, forcing an unclean suspend at stage {:?}", current_op_order);
|
||||||
for sub in suspend_subscribers.iter() {
|
for sub in suspend_subscribers.iter() {
|
||||||
if sub.order == current_op_order {
|
if sub.order == current_op_order {
|
||||||
if !sub.ready_to_suspend {
|
if !sub.ready_to_suspend {
|
||||||
|
|
@ -746,7 +745,7 @@ fn main() -> ! {
|
||||||
// a list of PID->tokens. Tokens are assigned in the order that the registration happens
|
// a list of PID->tokens. Tokens are assigned in the order that the registration happens
|
||||||
// to the susres server. Empirically, this list is generally stable for every build,
|
// to the susres server. Empirically, this list is generally stable for every build,
|
||||||
// and is guaranteed to be stable across a single cold boot.
|
// and is guaranteed to be stable across a single cold boot.
|
||||||
log::warn!(" -> NOT READY: {}", sub.token);
|
log::warn!(" -> NOT READY TOKEN: {}", sub.token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,10 +12,10 @@ pub struct Trng {
|
||||||
}
|
}
|
||||||
impl Trng {
|
impl Trng {
|
||||||
pub fn new(xns: &xous_names::XousNames) -> Result<Self, xous::Error> {
|
pub fn new(xns: &xous_names::XousNames) -> Result<Self, xous::Error> {
|
||||||
|
REFCOUNT.fetch_add(1, Ordering::Relaxed);
|
||||||
let conn = xns
|
let conn = xns
|
||||||
.request_connection_blocking(api::SERVER_NAME_TRNG)
|
.request_connection_blocking(api::SERVER_NAME_TRNG)
|
||||||
.expect("Can't connect to TRNG server");
|
.expect("Can't connect to TRNG server");
|
||||||
REFCOUNT.fetch_add(1, Ordering::Relaxed);
|
|
||||||
Ok(Trng {
|
Ok(Trng {
|
||||||
conn,
|
conn,
|
||||||
error_sid: None,
|
error_sid: None,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue