cleanup warnings

This commit is contained in:
bunnie 2021-04-02 18:07:39 +08:00
parent 2cb519b8ee
commit 39153f6fba
6 changed files with 13 additions and 20 deletions

View file

@ -299,7 +299,13 @@ fn xmain() -> ! {
}
/// only if doing callbacks. This might actually make more sense in a thread of its own, to make it
/// truly asynchronous, but this example is focused on the messaging API, not the threading API
/// truly asynchronous, but this example is focused on the messaging API, not the threading API.
/// This example admittedly sweeps a rather hairy issue (passing data between process-local threads)
/// under the carpet. As of Xous 0.8 your options to send data around between threads within a process
/// are:
/// 1. Define a crate-local API to pass the messages
/// 2. Use Atomic data types (only applicable if you have primitive data to send)
/// 3. Do some static mut unsafe thing because we don't have a Mutex data type yet.
fn do_callback(cb_conns: [Option<CID>; 32]) {
let a = useful_computation();
for maybe_conn in cb_conns.iter() {

View file

@ -1,12 +1,6 @@
use xous::{Message, ScalarMessage};
use xous_ipc::String;
// NOTE: the use of ComState "verbs" as commands is not meant as a 1:1 mapping of commands
// It's just a convenient abuse of already-defined constants. However, it's intended that
// the COM server on the SoC side abstracts much of the EC bus complexity away.
use com_rs::*;
use com_rs_ref as com_rs;
pub(crate) const SERVER_NAME_COM: &str = "_COM manager_";
#[derive(Debug, Default, Copy, Clone, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)]

View file

@ -1,7 +1,5 @@
#![cfg_attr(target_os = "none", no_std)]
use core::convert::TryInto;
/// This is the API that other servers use to call the COM. Read this code as if you
/// are calling these functions inside a different process.
pub mod api;
@ -23,7 +21,7 @@ fn battstats_server(sid0: usize, sid1: usize, sid2: usize, sid3: usize) {
loop {
let msg = xous::receive_message(sid).unwrap();
match FromPrimitive::from_usize(msg.body.id()) {
Some(api::Callback::BattStats) => msg_scalar_unpack!(msg, lo, hi, _, _, {
Some(Callback::BattStats) => msg_scalar_unpack!(msg, lo, hi, _, _, {
let bs: BattStats = [lo, hi].into();
unsafe {
if let Some(cb) = BATTSTATS_CB {
@ -31,7 +29,7 @@ fn battstats_server(sid0: usize, sid1: usize, sid2: usize, sid3: usize) {
}
}
}),
Some(api::Callback::Drop) => {
Some(Callback::Drop) => {
break; // this exits the loop and kills the thread
}
None => (),

View file

@ -4,7 +4,6 @@
mod api;
use api::Opcode;
use core::convert::TryFrom;
use num_traits::{ToPrimitive, FromPrimitive};
use log::{error, info, trace};
@ -12,7 +11,7 @@ use log::{error, info, trace};
use com_rs_ref as com_rs;
use com_rs::*;
use xous::{CID, msg_scalar_unpack, msg_blocking_scalar_unpack};
use xous::{CID, msg_scalar_unpack};
use xous_ipc::{Buffer, String};
const STD_TIMEOUT: u32 = 100;
@ -39,7 +38,6 @@ mod implementation {
use com_rs::*;
use log::error;
use utralib::generated::*;
use xous::CID;
use heapless::Vec;
use heapless::consts::U64;
@ -232,9 +230,6 @@ mod implementation {
#[xous::xous_main]
fn xmain() -> ! {
use crate::implementation::XousCom;
use core::pin::Pin;
use xous::buffer;
use rkyv::archived_value_mut;
log_server::init_wait().unwrap();
info!("my PID is {}", xous::process::id());

View file

@ -41,7 +41,7 @@ fn rkyv_test_client() -> ! {
let xns = xous_names::XousNames::new().unwrap();
let mut com = com::Com::new(xns).unwrap();
com.hook_batt_stats(handle_battstats);
com.hook_batt_stats(handle_battstats).unwrap();
loop {
log::info!("2 + {} = {}", idx, rkyv_test_server::add(2, idx).unwrap());
@ -61,7 +61,7 @@ fn rkyv_test_client() -> ! {
log::info!("Sending a string \"{}\"", sent_str);
rkyv_test_server::log_message("prefix", sent_str);
com.req_batt_stats();
com.req_batt_stats().unwrap();
idx += 1;
}

View file

@ -41,7 +41,7 @@ fn try_main() -> Result<(), DynError> {
//"shellchat",
//"ime-frontend",
//"ime-plugin-shell",
//"graphics-server",
"graphics-server",
"ticktimer-server",
"log-server",
"com",