mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-17 08:40:52 +00:00
Merge branch 'main' of github.com:betrusted-io/xous-core into main
This commit is contained in:
commit
ec48f85071
2 changed files with 10 additions and 6 deletions
|
|
@ -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,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue