Merge branch 'main' of github.com:betrusted-io/xous-core into main

This commit is contained in:
bunnie 2022-03-07 13:28:33 +08:00
commit ec48f85071
2 changed files with 10 additions and 6 deletions

View file

@ -1,10 +1,10 @@
pub(crate) const SERVER_NAME_CODEC: &str = "_Low-level Audio Codec Server_";
pub(crate) const SERVER_NAME_CODEC: &str = "_Any descriptive and unique name under 64 chars_";
#[allow(dead_code)]
#[derive(num_derive::FromPrimitive, num_derive::ToPrimitive, Debug)]
pub(crate) enum Opcode {
/// Suspend/resume callback
SuspendResume,
/// Exits the server
Quit,
}

View file

@ -2,6 +2,7 @@
#![cfg_attr(target_os = "none", no_main)]
mod api;
use api::*;
use num_traits::FromPrimitive;
@ -100,14 +101,17 @@ fn xmain() -> ! {
loop {
let msg = xous::receive_message(codec_sid).unwrap();
match FromPrimitive::from_usize(msg.body.id()) {
Some(api::Opcode::SuspendResume) => xous::msg_scalar_unpack!(msg, token, _, _, _, {
Some(Opcode::SuspendResume) => xous::msg_scalar_unpack!(msg, token, _, _, _, {
codec.suspend();
susres.suspend_until_resume(token).expect("couldn't execute suspend/resume");
codec.resume();
}),
Some(Opcode::Quit) => {
log::warn!("Quit received, goodbye world!");
break;
},
None => {
log::error!("couldn't convert opcode");
break
log::error!("couldn't convert opcode: {:?}", msg);
}
}
}