found a bug.

This commit is contained in:
bunnie 2021-04-06 01:52:26 +08:00
parent 9ba2fb134c
commit 8c12dbe2af
9 changed files with 32 additions and 8 deletions

View file

@ -224,6 +224,7 @@ fn xmain() -> ! {
// make a thread to manage the status bar -- this needs to start after the IMEF is initialized
// the status bar is a trusted element managed by the OS, and we are chosing to domicile this in the GAM process for now
let status_gid = chatlayout.status.gid();
log::trace!("starting status thread with gid {:?}", status_gid);
xous::create_thread_4(status_thread, status_gid[0] as _, status_gid[1] as _, status_gid[2] as _, status_gid[3] as _).expect("couldn't create status thread");
let mut powerdown_requested = false;

View file

@ -238,6 +238,7 @@ fn reader_thread(arg: usize) {
// capturing the build time of the very most recent change!
// writeln!(output, "LOG: *** Built: {:49} ***", env!("VERGEN_BUILD_TIMESTAMP")).unwrap();
writeln!(output, "LOG: ****************************************************************").unwrap();
println!("LOG: my PID is {}", xous::process::id());
let server_addr = xous::create_server_with_address(b"xous-log-server ").unwrap();
writeln!(output, "LOG: Server listening on address {:?}", server_addr).unwrap();

View file

@ -49,11 +49,11 @@ fn rkyv_test_client() -> ! {
let xns = xous_names::XousNames::new().unwrap();
let mut com = com::Com::new(&xns).unwrap();
/*let mut com = com::Com::new(&xns).unwrap();
com.hook_batt_stats(handle_battstats).unwrap();
let mut kbd = keyboard::Keyboard::new(&xns).unwrap();
kbd.hook_keyboard_events(handle_keyevents).unwrap();
kbd.hook_keyboard_events(handle_keyevents).unwrap();*/
loop {
log::info!("2 + {} = {}", idx, rkyv_test_server::add(2, idx).unwrap());
ticktimer.sleep_ms(3000).ok();
@ -72,7 +72,7 @@ fn rkyv_test_client() -> ! {
log::info!("Sending a string \"{}\"", sent_str);
rkyv_test_server::log_message("prefix", sent_str);
com.req_batt_stats().unwrap();
//com.req_batt_stats().unwrap();
idx += 1;
}

View file

@ -1,6 +1,5 @@
use xous_ipc::String;
pub(crate) const SERVER_NAME: &str = "Rkyv Test Server 1";
/// A `usize` value that gets set as the `id` for every message handled
/// by our server.
#[derive(num_derive::FromPrimitive, num_derive::ToPrimitive)]

View file

@ -92,6 +92,22 @@ fn double_string(mem: &mut xous::MemoryMessage) {
buffer.replace(response).unwrap();
}
fn local_lender(){
use core::fmt::Write;
let ticktimer = ticktimer_server::Ticktimer::new().unwrap();
let mut message_string = xous::String::<64>::new();
let mut idx: usize = 0;
loop {
message_string.clear();
write!(message_string, "LOCAL loop # {:^4}", idx).unwrap();
idx += 1;
rkyv_test_server::log_message("LOCAL LENDER", message_string);
ticktimer.sleep_ms(500).unwrap();
}
}
#[xous::xous_main]
fn test_main() -> ! {
log_server::init_wait().unwrap();
@ -105,6 +121,8 @@ fn test_main() -> ! {
let mut logstring_callback_connections = [None; 32];
xous::create_thread_0(local_lender);
loop {
let mut msg = xous::receive_message(sid).unwrap();
match FromPrimitive::from_usize(msg.body.id()) {

View file

@ -20,7 +20,7 @@ pub fn callback_thread() {
id: 0xdeadbeef, arg1: 0, arg2: 0, arg3: 0, arg4: 0,
})).unwrap();
} else {
xous::yield_slice();
ticktimer.sleep_ms(250).unwrap(); // a little more polite than simply busy-waiting
}
}
}

View file

@ -22,5 +22,6 @@ utralib = {path = "../../utralib"}
debug-print = []
watchdog = []
# generally you want to disable watchdog if you're doing development.
default = ["watchdog"]
#default = ["watchdog"]
default = []
# default = ["debug-print"]

View file

@ -76,6 +76,7 @@ mod implementation {
// - the ring oscillator has a tolerance band of 65MHz +/- 50%
// - the CPU runs at 100MHz with a tight tolerance
// - thus we have to confirm the write of the watchdog data before moving to the next state
#[cfg(feature = "watchdog")]
if xtt.wdt.rf(utra::wdt::STATE_ENABLED) == 1 {
if xtt.wdt.rf(utra::wdt::STATE_DISARMED) != 1 {
while xtt.wdt.rf(utra::wdt::STATE_ARMED1) == 1 {
@ -88,6 +89,7 @@ mod implementation {
}
}
// Clear the interrupt
#[cfg(feature = "watchdog")]
xtt.wdt.wfo(utra::wdt::EV_PENDING_SOFT_INT, 1);
}

View file

@ -154,7 +154,7 @@ fn xmain() -> ! {
let xns = xous_names::XousNames::new().unwrap();
let trng_sid = xns.register_name(api::SERVER_NAME_TRNG).expect("can't register server");
info!("registered with NS -- {:?}", trng_sid);
log::trace!("registered with NS -- {:?}", trng_sid);
#[cfg(target_os = "none")]
let trng = Trng::new();
@ -162,7 +162,9 @@ fn xmain() -> ! {
#[cfg(not(target_os = "none"))]
let mut trng = Trng::new();
info!("ready to accept requests");
// pump the TRNG hardware to clear the first number out, sometimes it is 0 due to clock-sync issues on the fifo
trng.get_trng(2);
log::trace!("ready to accept requests");
loop {
let msg = xous::receive_message(trng_sid).unwrap();