From 4b0f50293f2fab128de7732d7aa318a7b6b9ce8d Mon Sep 17 00:00:00 2001 From: bunnie Date: Tue, 2 Mar 2021 21:15:40 +0800 Subject: [PATCH] another intermediate commit --- kernel/src/services.rs | 12 ++++++------ services/gam/src/main.rs | 2 +- services/gam/src/status.rs | 5 +++-- services/log-server/src/main.rs | 2 +- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/kernel/src/services.rs b/kernel/src/services.rs index 0ef41e934..54c68fde2 100644 --- a/kernel/src/services.rs +++ b/kernel/src/services.rs @@ -789,7 +789,7 @@ impl SystemServices { ) -> Result { let previous_pid = self.current_pid(); - let debug = false; + let debug = true; if debug { println!( "\n\r KERNEL({},{}): Activating process {} thread {}", @@ -820,10 +820,10 @@ impl SystemServices { new.state ); if new_tid == 0 { - // print!( - // "PID {}: Looking for a valid context in the mask {:08b}, curent context {} ({:08b})", - // new_pid, x, new.current_context, new.current_context - // ); + print!( + "PID {}: Looking for a valid context in the mask {:08b}", + new_pid, x, + ); //new_tid = 0; new_tid = new.current_thread as usize; while x & (1 << new_tid) == 0 { @@ -837,7 +837,7 @@ impl SystemServices { } } new.current_thread = new_tid as _; - // println!(" -- picked thread {}", new_tid); + println!(" -- picked thread {}", new_tid); } else if x & (1 << new_tid) == 0 { println!( "thread is {:?}, which is not valid for new thread {}", diff --git a/services/gam/src/main.rs b/services/gam/src/main.rs index 1a948dab6..3706661f4 100644 --- a/services/gam/src/main.rs +++ b/services/gam/src/main.rs @@ -145,7 +145,7 @@ fn xmain() -> ! { let maybe_env = xous::try_receive_message(gam_sid).unwrap(); match maybe_env { Some(envelope) => { // */ - let envelope = xous::receive_message(gam_sid).unwrap(); + // let envelope = xous::receive_message(gam_sid).unwrap(); if debug1 {info!("GAM: Message: {:?}", envelope); } if let Ok(opcode) = Opcode::try_from(&envelope.body) { if debug1 {info!("GAM: Opcode: {:?}", opcode);} diff --git a/services/gam/src/status.rs b/services/gam/src/status.rs index 40c8ebf06..3de1ebd24 100644 --- a/services/gam/src/status.rs +++ b/services/gam/src/status.rs @@ -49,7 +49,6 @@ pub fn status_thread(canvas_gid: [u32; 4]) { let mut stats: BattStats = BattStats::default(); let mut last_time: u64 = ticktimer_server::elapsed_ms(ticktimer_conn).unwrap(); let mut stats_phase: usize = 0; - info!("GAM|status: starting main loop"); let style_dark = DrawStyle::new(PixelColor::Dark, PixelColor::Dark, 1); gam::draw_line(gam_conn, status_gid, Line::new_with_style( @@ -58,6 +57,8 @@ pub fn status_thread(canvas_gid: [u32; 4]) { style_dark )).expect("GAM|status: Can't draw border line"); + com::request_battstat_events(xous::names::SERVER_NAME_STATUS, com_conn).expect("GAM|status: couldn't request events from COM"); + info!("GAM|status: starting main loop"); loop { /* if debug1{info!("GAM|status: periodic tasks: updating uptime, requesting battstats");} @@ -72,7 +73,7 @@ pub fn status_thread(canvas_gid: [u32; 4]) { let maybe_env = xous::try_receive_message(status_sid).unwrap(); match maybe_env { Some(envelope) => { - let envelope = xous::receive_message(status_sid).unwrap(); + //let envelope = xous::receive_message(status_sid).unwrap(); if debug1{info!("GAM|status: Message: {:?}", envelope);} if let Ok(opcode) = com::api::Opcode::try_from(&envelope.body) { match opcode { diff --git a/services/log-server/src/main.rs b/services/log-server/src/main.rs index 3c6362f30..17daa5f2c 100644 --- a/services/log-server/src/main.rs +++ b/services/log-server/src/main.rs @@ -325,7 +325,7 @@ fn some_main() -> ! { ) .expect("couldn't map GPIO CSR range"); let mut gpio = CSR::new(gpio_base.as_mut_ptr() as *mut u32); - gpio.wfo(utra::gpio::UARTSEL_UARTSEL, 1); // 0 = kernel, 1 = log, 2 = app_uart + gpio.wfo(utra::gpio::UARTSEL_UARTSEL, 0); // 0 = kernel, 1 = log, 2 = app_uart } let mut output = implementation::init();