diff --git a/precursors/soc.svd b/precursors/soc.svd index 73a7104c5..a1b1021df 100755 --- a/precursors/soc.svd +++ b/precursors/soc.svd @@ -3,7 +3,7 @@ litex SOC - + 8 32 @@ -1222,10 +1222,10 @@ register to disable individual events.]]> GIT_GITREV 0x0014 - 0xfce2f15c + 0x977355ba 32 @@ -1242,7 +1242,7 @@ the exact git version used to build this firmware.]]> is ``1``, then the repository this was built from has one additional commit beyond the tag indicated in `MAJOR`, `MINOR`, and `REVISION`.]]> 0x0018 - 0x21 + 0x26 32 @@ -1487,10 +1487,26 @@ register to disable individual events.]]> + + DEVBOOT + 0x0018 + 0x00 + 32 + + + devboot + 0 + [0:0] + 0 + + + + 0 - 0x18 + 0x1c registers @@ -3451,7 +3467,7 @@ inject too fast.]]> SEED1 0x0000 - 0x314fcffc + 0x698bb704 32 @@ -3466,7 +3482,7 @@ inject too fast.]]> SEED0 0x0004 - 0x67a42778 + 0x5d2ea7df 32 diff --git a/precursors/soc_csr.bin b/precursors/soc_csr.bin index 8bbe42120..1636496a5 100755 Binary files a/precursors/soc_csr.bin and b/precursors/soc_csr.bin differ diff --git a/services/engine-25519/src/main.rs b/services/engine-25519/src/main.rs index 9b14082c1..9465cfe63 100644 --- a/services/engine-25519/src/main.rs +++ b/services/engine-25519/src/main.rs @@ -11,6 +11,7 @@ use core::sync::atomic::{AtomicBool, Ordering}; use xous::msg_blocking_scalar_unpack; use xous_ipc::Buffer; +#[cfg(target_os = "none")] #[macro_use] extern crate engine25519_as; @@ -715,6 +716,11 @@ mod implementation { } pub fn power_on(&mut self, _on: bool) { } + pub fn montgomery(&mut self, _job: MontgomeryJob) { + } + pub fn get_single_result(&mut self, _r: usize) -> JobResult { + JobResult::EngineUnavailable + } } } diff --git a/services/gam/src/api.rs b/services/gam/src/api.rs index c47b85720..62c407905 100644 --- a/services/gam/src/api.rs +++ b/services/gam/src/api.rs @@ -147,6 +147,9 @@ pub(crate) enum Opcode { /// raise a context menu RaiseMenu, + /// Turn on Devboot Flag + Devboot, + Quit, } diff --git a/services/gam/src/lib.rs b/services/gam/src/lib.rs index b0bd5ed94..6132f1858 100644 --- a/services/gam/src/lib.rs +++ b/services/gam/src/lib.rs @@ -273,6 +273,17 @@ impl Gam { let buf = Buffer::into_buf(menu_name).or(Err(xous::Error::InternalError))?; buf.send(self.conn, Opcode::RaiseMenu.to_u32().unwrap()).or(Err(xous::Error::InternalError)).map(|_|()) } + + /// this is a one-way door, once you've set it, you can't unset it. + pub fn set_devboot(&self, enable: bool) -> Result<(), xous::Error> { + let ena = + if enable { 1 } + else { 0 }; + send_message(self.conn, + Message::new_scalar(Opcode::Devboot.to_usize().unwrap(), + ena, 0, 0, 0,) + ).map(|_| ()) + } } use core::sync::atomic::{AtomicU32, Ordering}; diff --git a/services/gam/src/main.rs b/services/gam/src/main.rs index 5dac247f3..141767c73 100644 --- a/services/gam/src/main.rs +++ b/services/gam/src/main.rs @@ -927,7 +927,11 @@ fn xmain() -> ! { let menu_name = buffer.to_original::, _>().unwrap(); log::debug!("got request to raise menu {}", menu_name); context_mgr.raise_menu(menu_name.as_str().unwrap(), &gfx, &mut canvases); - } + }, + Some(Opcode::Devboot) => msg_scalar_unpack!(msg, ena, _, _, _, { + if ena != 0 { gfx.set_devboot(true).expect("couldn't send devboot message"); } + else { gfx.set_devboot(false).expect("couldn't send devboot message"); } + }), Some(Opcode::Quit) => break, None => {log::error!("unhandled message {:?}", msg);} } diff --git a/services/graphics-server/src/api.rs b/services/graphics-server/src/api.rs index 53e3f9fb5..c76423b93 100644 --- a/services/graphics-server/src/api.rs +++ b/services/graphics-server/src/api.rs @@ -84,6 +84,9 @@ pub(crate) enum Opcode { /// sets whether a sleep note should be rendered or not on suspend SetSleepNote, + /// permanently turns on the Devboot mark + Devboot, + /// SuspendResume callback SuspendResume, diff --git a/services/graphics-server/src/backend/betrusted.rs b/services/graphics-server/src/backend/betrusted.rs index 76bc50bb6..6c06658c8 100644 --- a/services/graphics-server/src/backend/betrusted.rs +++ b/services/graphics-server/src/backend/betrusted.rs @@ -208,4 +208,12 @@ impl XousDisplay { fn busy(&self) -> bool { self.csr.rf(utra::memlcd::BUSY_BUSY) == 1 } + + pub fn set_devboot(&mut self, ena: bool) { + if ena { + self.csr.wfo(utra::memlcd::DEVBOOT_DEVBOOT, 1); + } else { + self.csr.wfo(utra::memlcd::DEVBOOT_DEVBOOT, 0); + } + } } diff --git a/services/graphics-server/src/backend/minifb.rs b/services/graphics-server/src/backend/minifb.rs index 8b0f02f87..11db68be3 100644 --- a/services/graphics-server/src/backend/minifb.rs +++ b/services/graphics-server/src/backend/minifb.rs @@ -18,6 +18,7 @@ pub struct XousDisplay { native_buffer: Vec, //[u32; WIDTH * HEIGHT], emulated_buffer: [u32; FB_SIZE], window: Window, + devboot: bool, } struct XousKeyboardHandler { @@ -65,8 +66,15 @@ impl XousDisplay { native_buffer, window, emulated_buffer: [0u32; FB_SIZE], + devboot: false, } } + pub fn set_devboot(&mut self, ena: bool) { + if ena { + self.devboot = true; + } + // ignore attempts to turn off devboot + } pub fn suspend(&self, _flag: bool) {} pub fn resume(&self, _flag: bool) {} @@ -110,6 +118,8 @@ impl XousDisplay { } fn emulated_to_native(&mut self) { + const DEVBOOT_LINE: usize = 12; + let mut row = 0; for (dest_row, src_row) in self .native_buffer .chunks_mut(WIDTH as _) @@ -117,13 +127,18 @@ impl XousDisplay { { for (dest_cell, src_cell) in dest_row.chunks_mut(32).zip(src_row) { for (bit, dest) in dest_cell.iter_mut().enumerate() { - *dest = if src_cell & (1 << bit) != 0 { - DARK_COLOUR + if self.devboot && ((bit >> 1) % 2) == 0 && (row == DEVBOOT_LINE) { // try to render the devboot defile somewhat accurately + *dest = LIGHT_COLOUR } else { - LIGHT_COLOUR - }; + *dest = if src_cell & (1 << bit) != 0 { + DARK_COLOUR + } else { + LIGHT_COLOUR + }; + } } } + row += 1; } } } diff --git a/services/graphics-server/src/lib.rs b/services/graphics-server/src/lib.rs index df4ace49f..404df98d2 100644 --- a/services/graphics-server/src/lib.rs +++ b/services/graphics-server/src/lib.rs @@ -141,6 +141,17 @@ impl Gfx { Message::new_scalar(Opcode::SetSleepNote.to_usize().unwrap(), arg, 0, 0, 0, )).map(|_|()) } + + /// this is a one-way door, once you've set it, you can't unset it. + pub fn set_devboot(&self, enable: bool) -> Result<(), xous::Error> { + let ena = + if enable { 1 } + else { 0 }; + send_message(self.conn, + Message::new_scalar(Opcode::Devboot.to_usize().unwrap(), + ena, 0, 0, 0,) + ).map(|_| ()) + } } use core::sync::atomic::{AtomicU32, Ordering}; diff --git a/services/graphics-server/src/main.rs b/services/graphics-server/src/main.rs index 0bfb0c32e..4edee05de 100644 --- a/services/graphics-server/src/main.rs +++ b/services/graphics-server/src/main.rs @@ -393,6 +393,10 @@ fn xmain() -> ! { display.update(); display.redraw(); }), + Some(Opcode::Devboot) => msg_scalar_unpack!(msg, ena, _, _, _, { + if ena != 0 { display.set_devboot(true); } + else { display.set_devboot(false); } + }), Some(Opcode::Quit) => break, None => {log::error!("received opcode scalar that is not handled");} } diff --git a/services/shellchat/src/cmds.rs b/services/shellchat/src/cmds.rs index 985a41c70..0879be558 100644 --- a/services/shellchat/src/cmds.rs +++ b/services/shellchat/src/cmds.rs @@ -78,7 +78,7 @@ impl CommonEnv { ///// 1. add your module here, and pull its namespace into the local crate mod echo; use echo::*; -//mod test; use test::*; +mod test; use test::*; mod sleep; use sleep::*; mod sensors; use sensors::*; mod callback; use callback::*; @@ -104,7 +104,7 @@ pub struct CmdEnv { common_env: CommonEnv, lastverb: String::<256>, ///// 2. declare storage for your command here. - //test_cmd: Test, + test_cmd: Test, sleep_cmd: Sleep, sensors_cmd: Sensors, callback_cmd: CallBack, @@ -152,7 +152,7 @@ impl CmdEnv { common_env: common, lastverb: String::<256>::new(), ///// 3. initialize your storage, by calling new() - //test_cmd: Test::new(), + test_cmd: Test::new(), sleep_cmd: Sleep::new(&xns), sensors_cmd: Sensors::new(), callback_cmd: CallBack::new(), @@ -181,7 +181,7 @@ impl CmdEnv { let commands: &mut [& mut dyn ShellCmdApi] = &mut [ ///// 4. add your command to this array, so that it can be looked up and dispatched &mut echo_cmd, - //&mut self.test_cmd, + &mut self.test_cmd, &mut self.sleep_cmd, &mut self.sensors_cmd, &mut self.callback_cmd, diff --git a/services/shellchat/src/cmds/test.rs b/services/shellchat/src/cmds/test.rs index 78f5d6411..8bbf4d6a5 100644 --- a/services/shellchat/src/cmds/test.rs +++ b/services/shellchat/src/cmds/test.rs @@ -16,12 +16,32 @@ impl Test { impl<'a> ShellCmdApi<'a> for Test { cmd_api!(test); - fn process(&mut self, _args: String::<1024>, _env: &mut CommonEnv) -> Result>, xous::Error> { + fn process(&mut self, args: String::<1024>, env: &mut CommonEnv) -> Result>, xous::Error> { use core::fmt::Write; self.state += 1; let mut ret = String::<1024>::new(); - write!(ret, "Test has run {} times.", self.state).unwrap(); + write!(ret, "Test has run {} times.\n", self.state).unwrap(); + + let mut tokens = args.as_str().unwrap().split(' '); + + if let Some(sub_cmd) = tokens.next() { + match sub_cmd { + "devboot" => { + env.gam.set_devboot(true).unwrap(); + write!(ret, "devboot on").unwrap(); + } + "devbootoff" => { + env.gam.set_devboot(false).unwrap(); + write!(ret, "devboot off").unwrap(); + } + _ => { + () // do nothing + } + } + + } Ok(Some(ret)) + } }