mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-19 09:00:54 +00:00
some more attempts to get log strings working...
This commit is contained in:
parent
c8a2f34998
commit
9ee43a7acc
2 changed files with 15 additions and 5 deletions
|
|
@ -40,6 +40,13 @@ impl<'a> LogStr<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn as_memory_message(&self, id: xous::MessageId) -> Result<xous::MemoryMessage, xous::Error> {
|
pub fn as_memory_message(&self, id: xous::MessageId) -> Result<xous::MemoryMessage, xous::Error> {
|
||||||
|
|
||||||
|
print!("SHELL: String @ {:08x}:", self.raw_slice.as_ptr() as usize);
|
||||||
|
for offset in 0..self.len {
|
||||||
|
print!(" {:02x}", self.raw_slice[offset]);
|
||||||
|
}
|
||||||
|
println!(" (length: {})", self.len);
|
||||||
|
|
||||||
Ok(xous::MemoryMessage {
|
Ok(xous::MemoryMessage {
|
||||||
id,
|
id,
|
||||||
buf: xous::MemoryRange::new(self.raw_slice.as_ptr() as usize, self.raw_slice.len()).unwrap(),
|
buf: xous::MemoryRange::new(self.raw_slice.as_ptr() as usize, self.raw_slice.len()).unwrap(),
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ fn shell_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);
|
gpio.wfo(utra::gpio::UARTSEL_UARTSEL, 2);
|
||||||
|
|
||||||
let mut last_time: u64 = 0;
|
let mut last_time: u64 = 0;
|
||||||
loop {
|
loop {
|
||||||
|
|
@ -92,16 +92,19 @@ fn shell_main() -> ! {
|
||||||
xous::try_send_message(log_conn,
|
xous::try_send_message(log_conn,
|
||||||
xous::Message::Scalar(xous::ScalarMessage{id:256, arg1: elapsed_time as usize, arg2: 257, arg3: 258, arg4: 259}));
|
xous::Message::Scalar(xous::ScalarMessage{id:256, arg1: elapsed_time as usize, arg2: 257, arg3: 258, arg4: 259}));
|
||||||
*/
|
*/
|
||||||
|
println!("Preparing a mutable borrow message");
|
||||||
|
|
||||||
ls.clear();
|
ls.clear();
|
||||||
write!(ls, "Hello, Server! This memory is borrowed from another process. Elapsed: {}", elapsed_time as usize).expect("couldn't send hello message");
|
write!(ls, "Hello, Server! This memory is borrowed from another process. Elapsed: {}", elapsed_time as usize).expect("couldn't send hello message");
|
||||||
|
|
||||||
|
let mm = ls.as_memory_message(0)
|
||||||
|
.expect("couldn't form memory message");
|
||||||
|
|
||||||
println!("Sending a mutable borrow message");
|
println!("Sending a mutable borrow message");
|
||||||
|
|
||||||
let response = xous::syscall::try_send_message(
|
let response = xous::syscall::try_send_message(
|
||||||
log_conn,
|
log_conn,
|
||||||
xous::Message::MutableBorrow(
|
xous::Message::MutableBorrow(mm),
|
||||||
ls.as_memory_message(0)
|
|
||||||
.expect("couldn't form memory message"),
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
.expect("couldn't send memory message");
|
.expect("couldn't send memory message");
|
||||||
//unsafe { ls.set_len(response.0)};
|
//unsafe { ls.set_len(response.0)};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue