mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
rkyv-test-server: add log_message_send to test Send messages
This uncovered a bug in the kernel where Send messages didn't work. Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
5ae39de7da
commit
8760de0406
1 changed files with 21 additions and 0 deletions
|
|
@ -106,6 +106,27 @@ pub fn log_message<S: AsRef<str>, T: AsRef<str>>(prefix: S, message: T) {
|
|||
.unwrap();
|
||||
}
|
||||
|
||||
/// Log the given message to the server.
|
||||
/// We accept any two parameters that can be treated as strings.
|
||||
pub fn log_message_send<S: AsRef<str>, T: AsRef<str>>(prefix: S, message: T) {
|
||||
let op = api::LogString {
|
||||
prefix: xous::String::from_str(prefix.as_ref()),
|
||||
message: xous::String::from_str(message.as_ref()),
|
||||
};
|
||||
|
||||
// Convert the opcode into a serialized buffer. This consumes the opcode, which will
|
||||
// exist on the heap in its own page. Furthermore, this will be in a flattened format
|
||||
// suitable for passing around as a message.
|
||||
let buf = buffer::Buffer::try_from(op).unwrap();
|
||||
|
||||
// Send the message to the server.
|
||||
buf.send(
|
||||
ensure_connection(),
|
||||
api::Opcode::LogString.to_u32().unwrap(),
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
// Callback messages will be sent to this private server.
|
||||
// Ideally it would be held in a Mutex.
|
||||
static mut CALLBACK_SID: Option<xous::SID> = None;
|
||||
|
|
|
|||
Loading…
Reference in a new issue