another intermediate commit

This commit is contained in:
bunnie 2021-03-02 21:15:40 +08:00
parent 96a19baa8d
commit 4b0f50293f
4 changed files with 11 additions and 10 deletions

View file

@ -789,7 +789,7 @@ impl SystemServices {
) -> Result<TID, xous_kernel::Error> { ) -> Result<TID, xous_kernel::Error> {
let previous_pid = self.current_pid(); let previous_pid = self.current_pid();
let debug = false; let debug = true;
if debug { if debug {
println!( println!(
"\n\r KERNEL({},{}): Activating process {} thread {}", "\n\r KERNEL({},{}): Activating process {} thread {}",
@ -820,10 +820,10 @@ impl SystemServices {
new.state new.state
); );
if new_tid == 0 { if new_tid == 0 {
// print!( print!(
// "PID {}: Looking for a valid context in the mask {:08b}, curent context {} ({:08b})", "PID {}: Looking for a valid context in the mask {:08b}",
// new_pid, x, new.current_context, new.current_context new_pid, x,
// ); );
//new_tid = 0; //new_tid = 0;
new_tid = new.current_thread as usize; new_tid = new.current_thread as usize;
while x & (1 << new_tid) == 0 { while x & (1 << new_tid) == 0 {
@ -837,7 +837,7 @@ impl SystemServices {
} }
} }
new.current_thread = new_tid as _; new.current_thread = new_tid as _;
// println!(" -- picked thread {}", new_tid); println!(" -- picked thread {}", new_tid);
} else if x & (1 << new_tid) == 0 { } else if x & (1 << new_tid) == 0 {
println!( println!(
"thread is {:?}, which is not valid for new thread {}", "thread is {:?}, which is not valid for new thread {}",

View file

@ -145,7 +145,7 @@ fn xmain() -> ! {
let maybe_env = xous::try_receive_message(gam_sid).unwrap(); let maybe_env = xous::try_receive_message(gam_sid).unwrap();
match maybe_env { match maybe_env {
Some(envelope) => { // */ 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 debug1 {info!("GAM: Message: {:?}", envelope); }
if let Ok(opcode) = Opcode::try_from(&envelope.body) { if let Ok(opcode) = Opcode::try_from(&envelope.body) {
if debug1 {info!("GAM: Opcode: {:?}", opcode);} if debug1 {info!("GAM: Opcode: {:?}", opcode);}

View file

@ -49,7 +49,6 @@ pub fn status_thread(canvas_gid: [u32; 4]) {
let mut stats: BattStats = BattStats::default(); let mut stats: BattStats = BattStats::default();
let mut last_time: u64 = ticktimer_server::elapsed_ms(ticktimer_conn).unwrap(); let mut last_time: u64 = ticktimer_server::elapsed_ms(ticktimer_conn).unwrap();
let mut stats_phase: usize = 0; let mut stats_phase: usize = 0;
info!("GAM|status: starting main loop");
let style_dark = DrawStyle::new(PixelColor::Dark, PixelColor::Dark, 1); let style_dark = DrawStyle::new(PixelColor::Dark, PixelColor::Dark, 1);
gam::draw_line(gam_conn, status_gid, Line::new_with_style( 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 style_dark
)).expect("GAM|status: Can't draw border line"); )).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 { loop {
/* /*
if debug1{info!("GAM|status: periodic tasks: updating uptime, requesting battstats");} 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(); let maybe_env = xous::try_receive_message(status_sid).unwrap();
match maybe_env { match maybe_env {
Some(envelope) => { 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 debug1{info!("GAM|status: Message: {:?}", envelope);}
if let Ok(opcode) = com::api::Opcode::try_from(&envelope.body) { if let Ok(opcode) = com::api::Opcode::try_from(&envelope.body) {
match opcode { match opcode {

View file

@ -325,7 +325,7 @@ fn some_main() -> ! {
) )
.expect("couldn't map GPIO CSR range"); .expect("couldn't map GPIO CSR range");
let mut gpio = CSR::new(gpio_base.as_mut_ptr() as *mut u32); 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(); let mut output = implementation::init();