mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
intermediate progress on debugging return messages
This commit is contained in:
parent
84b39c931a
commit
4d21f2d868
10 changed files with 53 additions and 22 deletions
|
|
@ -14,3 +14,7 @@ utralib = { path = "../../utralib"}
|
||||||
|
|
||||||
[target.'cfg(any(windows,unix))'.dependencies]
|
[target.'cfg(any(windows,unix))'.dependencies]
|
||||||
minifb = "0.17"
|
minifb = "0.17"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
debugprint = []
|
||||||
|
default = [] # "debugprint"
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
#![cfg_attr(target_os = "none", no_std)]
|
#![cfg_attr(target_os = "none", no_std)]
|
||||||
#![cfg_attr(target_os = "none", no_main)]
|
#![cfg_attr(target_os = "none", no_main)]
|
||||||
|
|
||||||
|
#[macro_use]
|
||||||
|
mod debug;
|
||||||
|
|
||||||
mod backend;
|
mod backend;
|
||||||
use backend::XousDisplay;
|
use backend::XousDisplay;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,4 +16,4 @@ utralib = { path = "../../utralib"}
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
debugprint = []
|
debugprint = []
|
||||||
default = [] # "debugprint"
|
default = ["debugprint"] # "debugprint"
|
||||||
|
|
|
||||||
|
|
@ -80,10 +80,6 @@ fn shell_main() -> ! {
|
||||||
gpio.wfo(utra::gpio::UARTSEL_UARTSEL, 0);
|
gpio.wfo(utra::gpio::UARTSEL_UARTSEL, 0);
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
//println!("loop");
|
|
||||||
println!("ticktimer request");
|
|
||||||
let elapsed_time = ticktimer_server::elapsed_ms(ticktimer_conn).unwrap();
|
|
||||||
println!("elapsed time: {}ms", elapsed_time);
|
|
||||||
|
|
||||||
// println!("Sending a scalar message with id {}...", counter + 4096);
|
// println!("Sending a scalar message with id {}...", counter + 4096);
|
||||||
// match xous::syscall::send_message(
|
// match xous::syscall::send_message(
|
||||||
|
|
@ -122,6 +118,15 @@ fn shell_main() -> ! {
|
||||||
Err(e) => panic!("unable to draw to screen: {:?}", e),
|
Err(e) => panic!("unable to draw to screen: {:?}", e),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
println!("ticktimer request");
|
||||||
|
/*
|
||||||
|
ticktimer_server::reset(ticktimer_conn);
|
||||||
|
*/
|
||||||
|
if let Ok(elapsed_time) = ticktimer_server::elapsed_ms(ticktimer_conn) {
|
||||||
|
println!("elapsed time: {}ms", elapsed_time);
|
||||||
|
} else {
|
||||||
|
println!("error requesting ticktimer!")
|
||||||
|
}
|
||||||
let x1 = move_lfsr(lfsr);
|
let x1 = move_lfsr(lfsr);
|
||||||
let y1 = move_lfsr(x1);
|
let y1 = move_lfsr(x1);
|
||||||
let x2 = move_lfsr(y1);
|
let x2 = move_lfsr(y1);
|
||||||
|
|
|
||||||
|
|
@ -14,4 +14,4 @@ utralib = { path = "../../utralib"}
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
debugprint = []
|
debugprint = []
|
||||||
default = ["debugprint"]
|
default = [] # "debugprint"
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,12 @@ impl<'a> core::convert::TryFrom<&'a Message> for Opcode {
|
||||||
match message {
|
match message {
|
||||||
Message::Scalar(m) => match m.id {
|
Message::Scalar(m) => match m.id {
|
||||||
1 => Ok(Opcode::Reset),
|
1 => Ok(Opcode::Reset),
|
||||||
2 => Ok(Opcode::ElapsedMs),
|
|
||||||
_ => Err("unrecognized opcode"),
|
_ => Err("unrecognized opcode"),
|
||||||
},
|
},
|
||||||
|
Message::BlockingScalar(m) => match m.id {
|
||||||
|
4919 => Ok(Opcode::ElapsedMs),
|
||||||
|
_ => Err("unrecognized opcode"),
|
||||||
|
}
|
||||||
_ => Err("unhandled message type"),
|
_ => Err("unhandled message type"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -33,7 +36,7 @@ impl Into<Message> for Opcode {
|
||||||
arg4: 0,
|
arg4: 0,
|
||||||
}),
|
}),
|
||||||
Opcode::ElapsedMs => Message::BlockingScalar(ScalarMessage {
|
Opcode::ElapsedMs => Message::BlockingScalar(ScalarMessage {
|
||||||
id: 2,
|
id: 4919,
|
||||||
arg1: 0,
|
arg1: 0,
|
||||||
arg2: 0,
|
arg2: 0,
|
||||||
arg3: 0,
|
arg3: 0,
|
||||||
|
|
|
||||||
|
|
@ -9,9 +9,16 @@ pub fn elapsed_ms(cid: CID) -> Result<u64, Error> {
|
||||||
if let xous::Result::Scalar2(upper, lower) = response {
|
if let xous::Result::Scalar2(upper, lower) = response {
|
||||||
Ok(upper as u64 | ((lower as u64) << 32))
|
Ok(upper as u64 | ((lower as u64) << 32))
|
||||||
} else {
|
} else {
|
||||||
panic!("unexpected return value"); // or return Err(xous::Result::InternalError)
|
panic!("unexpected return value: {:#?}", response);
|
||||||
}
|
}
|
||||||
}
|
/* // scalar1 experimental reply to see if this makes it any better. It doesn't.
|
||||||
|
if let xous::Result::Scalar1(lower) = response {
|
||||||
|
Ok(lower as u64)
|
||||||
|
} else {
|
||||||
|
panic!("unexpected return value: {:#?}", response);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
pub fn reset(cid: CID) -> Result<(), xous::Error> {
|
pub fn reset(cid: CID) -> Result<(), xous::Error> {
|
||||||
try_send_message(cid, api::Opcode::Reset.into()).map(|_| ())
|
try_send_message(cid, api::Opcode::Reset.into()).map(|_| ())
|
||||||
|
|
|
||||||
|
|
@ -59,12 +59,12 @@ fn xmain() -> ! {
|
||||||
loop {
|
loop {
|
||||||
println!("TickTimer: waiting for message");
|
println!("TickTimer: waiting for message");
|
||||||
let envelope = xous::receive_message(ticktimer_server).unwrap();
|
let envelope = xous::receive_message(ticktimer_server).unwrap();
|
||||||
println!("TickTimer: got message");
|
println!("TickTimer: Message: {:?}", envelope);
|
||||||
// println!("TickTimer: Message: {:?}", envelope);
|
|
||||||
if let Ok(opcode) = Opcode::try_from(&envelope.body) {
|
if let Ok(opcode) = Opcode::try_from(&envelope.body) {
|
||||||
// println!("TickTimer: Opcode: {:?}", opcode);
|
println!("TickTimer: Opcode: {:?}", opcode);
|
||||||
match opcode {
|
match opcode {
|
||||||
Opcode::Reset => {
|
Opcode::Reset => {
|
||||||
|
println!("TickTimer: reset called");
|
||||||
ticktimer.reset();
|
ticktimer.reset();
|
||||||
},
|
},
|
||||||
Opcode::ElapsedMs => {
|
Opcode::ElapsedMs => {
|
||||||
|
|
@ -74,10 +74,11 @@ fn xmain() -> ! {
|
||||||
(time & 0xFFFF_FFFFu64) as usize,
|
(time & 0xFFFF_FFFFu64) as usize,
|
||||||
((time >> 32) & 0xFFF_FFFFu64) as usize,
|
((time >> 32) & 0xFFF_FFFFu64) as usize,
|
||||||
).expect("TickTimer: couldn't return time request");
|
).expect("TickTimer: couldn't return time request");
|
||||||
|
println!("TickTimer: done returning value");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// println!("Couldn't convert opcode");
|
println!("Couldn't convert opcode");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -321,13 +321,13 @@ fn return_scalar(pid: PID, _tid: TID, sender: MessageSender, arg: usize) -> SysC
|
||||||
ss.ready_thread(client_pid, client_tid)?;
|
ss.ready_thread(client_pid, client_tid)?;
|
||||||
ss.switch_to_thread(client_pid, Some(client_tid))?;
|
ss.switch_to_thread(client_pid, Some(client_tid))?;
|
||||||
ss.set_thread_result(client_pid, client_tid, xous_kernel::Result::Scalar1(arg))?;
|
ss.set_thread_result(client_pid, client_tid, xous_kernel::Result::Scalar1(arg))?;
|
||||||
Ok(xous_kernel::Result::Ok)
|
Ok(xous_kernel::Result::Scalar1(arg))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn return_scalar2(
|
fn return_scalar2(
|
||||||
pid: PID,
|
server_pid: PID,
|
||||||
_tid: TID,
|
server_tid: TID,
|
||||||
sender: MessageSender,
|
sender: MessageSender,
|
||||||
arg1: usize,
|
arg1: usize,
|
||||||
arg2: usize,
|
arg2: usize,
|
||||||
|
|
@ -341,7 +341,7 @@ fn return_scalar2(
|
||||||
let server = ss
|
let server = ss
|
||||||
.server_from_sidx_mut(sidx)
|
.server_from_sidx_mut(sidx)
|
||||||
.ok_or(xous_kernel::Error::ServerNotFound)?;
|
.ok_or(xous_kernel::Error::ServerNotFound)?;
|
||||||
if server.pid != pid {
|
if server.pid != server_pid {
|
||||||
return Err(xous_kernel::Error::ServerNotFound);
|
return Err(xous_kernel::Error::ServerNotFound);
|
||||||
}
|
}
|
||||||
let result = server.take_waiting_message(sender.idx, None)?;
|
let result = server.take_waiting_message(sender.idx, None)?;
|
||||||
|
|
@ -369,13 +369,21 @@ fn return_scalar2(
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
ss.ready_thread(client_pid, client_tid)?;
|
ss.ready_thread(client_pid, client_tid)?;
|
||||||
|
ss.ready_thread(server_pid, server_tid)?;
|
||||||
|
|
||||||
|
/*
|
||||||
|
ss.activate_process_thread(server_tid, client_pid, client_tid, false)
|
||||||
|
.map(|_| Ok(xous_kernel::Result::Scalar2(arg1, arg2)))
|
||||||
|
.unwrap_or(Err(xous_kernel::Error::ProcessNotFound))?;*/
|
||||||
|
//ss.switch_from_thread(server_pid, server_tid)?;
|
||||||
|
|
||||||
ss.switch_to_thread(client_pid, Some(client_tid))?;
|
ss.switch_to_thread(client_pid, Some(client_tid))?;
|
||||||
ss.set_thread_result(
|
ss.set_thread_result(
|
||||||
client_pid,
|
client_pid,
|
||||||
client_tid,
|
client_tid,
|
||||||
xous_kernel::Result::Scalar2(arg1, arg2),
|
xous_kernel::Result::Scalar2(arg1, arg2),
|
||||||
)?;
|
)?;
|
||||||
Ok(xous_kernel::Result::Ok)
|
Ok(xous_kernel::Result::Scalar2(arg1, arg2))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -53,9 +53,9 @@ macro_rules! maybe_main {
|
||||||
use core::panic::PanicInfo;
|
use core::panic::PanicInfo;
|
||||||
|
|
||||||
#[panic_handler]
|
#[panic_handler]
|
||||||
fn handle_panic(_arg: &PanicInfo) -> ! {
|
fn handle_panic(arg: &PanicInfo) -> ! {
|
||||||
// println!("PANIC!");
|
println!("PANIC!");
|
||||||
// println!("Details: {:?}", arg);
|
println!("Details: {:?}", arg);
|
||||||
xous::syscall::wait_event();
|
xous::syscall::wait_event();
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue