mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-21 09:14:34 +00:00
devboot mode support
This commit is contained in:
parent
22906ce366
commit
00be94d913
13 changed files with 119 additions and 18 deletions
|
|
@ -3,7 +3,7 @@
|
||||||
<device schemaVersion="1.1" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="CMSIS-SVD.xsd" >
|
<device schemaVersion="1.1" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="CMSIS-SVD.xsd" >
|
||||||
<vendor>litex</vendor>
|
<vendor>litex</vendor>
|
||||||
<name>SOC</name>
|
<name>SOC</name>
|
||||||
<description><![CDATA[Litex SoC 2021-06-28 03:35:41]]></description>
|
<description><![CDATA[Litex SoC 2021-07-03 18:21:53]]></description>
|
||||||
|
|
||||||
<addressUnitBits>8</addressUnitBits>
|
<addressUnitBits>8</addressUnitBits>
|
||||||
<width>32</width>
|
<width>32</width>
|
||||||
|
|
@ -1222,10 +1222,10 @@ register to disable individual events.]]></description>
|
||||||
<register>
|
<register>
|
||||||
<name>GIT_GITREV</name>
|
<name>GIT_GITREV</name>
|
||||||
<description><![CDATA[First 32-bits of the git revision. This documentation was built from git rev
|
<description><![CDATA[First 32-bits of the git revision. This documentation was built from git rev
|
||||||
``fce2f15c``, so this value is 4242731356, which should be enough to check out
|
``977355ba``, so this value is 2540918202, which should be enough to check out
|
||||||
the exact git version used to build this firmware.]]></description>
|
the exact git version used to build this firmware.]]></description>
|
||||||
<addressOffset>0x0014</addressOffset>
|
<addressOffset>0x0014</addressOffset>
|
||||||
<resetValue>0xfce2f15c</resetValue>
|
<resetValue>0x977355ba</resetValue>
|
||||||
<size>32</size>
|
<size>32</size>
|
||||||
<fields>
|
<fields>
|
||||||
<field>
|
<field>
|
||||||
|
|
@ -1242,7 +1242,7 @@ the exact git version used to build this firmware.]]></description>
|
||||||
is ``1``, then the repository this was built from has one additional commit
|
is ``1``, then the repository this was built from has one additional commit
|
||||||
beyond the tag indicated in `MAJOR`, `MINOR`, and `REVISION`.]]></description>
|
beyond the tag indicated in `MAJOR`, `MINOR`, and `REVISION`.]]></description>
|
||||||
<addressOffset>0x0018</addressOffset>
|
<addressOffset>0x0018</addressOffset>
|
||||||
<resetValue>0x21</resetValue>
|
<resetValue>0x26</resetValue>
|
||||||
<size>32</size>
|
<size>32</size>
|
||||||
<fields>
|
<fields>
|
||||||
<field>
|
<field>
|
||||||
|
|
@ -1487,10 +1487,26 @@ register to disable individual events.]]></description>
|
||||||
</field>
|
</field>
|
||||||
</fields>
|
</fields>
|
||||||
</register>
|
</register>
|
||||||
|
<register>
|
||||||
|
<name>DEVBOOT</name>
|
||||||
|
<addressOffset>0x0018</addressOffset>
|
||||||
|
<resetValue>0x00</resetValue>
|
||||||
|
<size>32</size>
|
||||||
|
<fields>
|
||||||
|
<field>
|
||||||
|
<name>devboot</name>
|
||||||
|
<msb>0</msb>
|
||||||
|
<bitRange>[0:0]</bitRange>
|
||||||
|
<lsb>0</lsb>
|
||||||
|
<description><![CDATA[When set to ``1``, permanently add a strike-through on the top of the screen.
|
||||||
|
Cannot be cleared, except by a full reset.]]></description>
|
||||||
|
</field>
|
||||||
|
</fields>
|
||||||
|
</register>
|
||||||
</registers>
|
</registers>
|
||||||
<addressBlock>
|
<addressBlock>
|
||||||
<offset>0</offset>
|
<offset>0</offset>
|
||||||
<size>0x18</size>
|
<size>0x1c</size>
|
||||||
<usage>registers</usage>
|
<usage>registers</usage>
|
||||||
</addressBlock>
|
</addressBlock>
|
||||||
</peripheral>
|
</peripheral>
|
||||||
|
|
@ -3451,7 +3467,7 @@ inject too fast.]]></description>
|
||||||
<name>SEED1</name>
|
<name>SEED1</name>
|
||||||
<description><![CDATA[Bits 32-63 of `SEED_SEED`. Seed used for the build]]></description>
|
<description><![CDATA[Bits 32-63 of `SEED_SEED`. Seed used for the build]]></description>
|
||||||
<addressOffset>0x0000</addressOffset>
|
<addressOffset>0x0000</addressOffset>
|
||||||
<resetValue>0x314fcffc</resetValue>
|
<resetValue>0x698bb704</resetValue>
|
||||||
<size>32</size>
|
<size>32</size>
|
||||||
<fields>
|
<fields>
|
||||||
<field>
|
<field>
|
||||||
|
|
@ -3466,7 +3482,7 @@ inject too fast.]]></description>
|
||||||
<name>SEED0</name>
|
<name>SEED0</name>
|
||||||
<description><![CDATA[Bits 0-31 of `SEED_SEED`.]]></description>
|
<description><![CDATA[Bits 0-31 of `SEED_SEED`.]]></description>
|
||||||
<addressOffset>0x0004</addressOffset>
|
<addressOffset>0x0004</addressOffset>
|
||||||
<resetValue>0x67a42778</resetValue>
|
<resetValue>0x5d2ea7df</resetValue>
|
||||||
<size>32</size>
|
<size>32</size>
|
||||||
<fields>
|
<fields>
|
||||||
<field>
|
<field>
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -11,6 +11,7 @@ use core::sync::atomic::{AtomicBool, Ordering};
|
||||||
use xous::msg_blocking_scalar_unpack;
|
use xous::msg_blocking_scalar_unpack;
|
||||||
use xous_ipc::Buffer;
|
use xous_ipc::Buffer;
|
||||||
|
|
||||||
|
#[cfg(target_os = "none")]
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate engine25519_as;
|
extern crate engine25519_as;
|
||||||
|
|
||||||
|
|
@ -715,6 +716,11 @@ mod implementation {
|
||||||
}
|
}
|
||||||
pub fn power_on(&mut self, _on: bool) {
|
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -147,6 +147,9 @@ pub(crate) enum Opcode {
|
||||||
/// raise a context menu
|
/// raise a context menu
|
||||||
RaiseMenu,
|
RaiseMenu,
|
||||||
|
|
||||||
|
/// Turn on Devboot Flag
|
||||||
|
Devboot,
|
||||||
|
|
||||||
Quit,
|
Quit,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -273,6 +273,17 @@ impl Gam {
|
||||||
let buf = Buffer::into_buf(menu_name).or(Err(xous::Error::InternalError))?;
|
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(|_|())
|
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};
|
use core::sync::atomic::{AtomicU32, Ordering};
|
||||||
|
|
|
||||||
|
|
@ -927,7 +927,11 @@ fn xmain() -> ! {
|
||||||
let menu_name = buffer.to_original::<String::<128>, _>().unwrap();
|
let menu_name = buffer.to_original::<String::<128>, _>().unwrap();
|
||||||
log::debug!("got request to raise menu {}", menu_name);
|
log::debug!("got request to raise menu {}", menu_name);
|
||||||
context_mgr.raise_menu(menu_name.as_str().unwrap(), &gfx, &mut canvases);
|
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,
|
Some(Opcode::Quit) => break,
|
||||||
None => {log::error!("unhandled message {:?}", msg);}
|
None => {log::error!("unhandled message {:?}", msg);}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,9 @@ pub(crate) enum Opcode {
|
||||||
/// sets whether a sleep note should be rendered or not on suspend
|
/// sets whether a sleep note should be rendered or not on suspend
|
||||||
SetSleepNote,
|
SetSleepNote,
|
||||||
|
|
||||||
|
/// permanently turns on the Devboot mark
|
||||||
|
Devboot,
|
||||||
|
|
||||||
/// SuspendResume callback
|
/// SuspendResume callback
|
||||||
SuspendResume,
|
SuspendResume,
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -208,4 +208,12 @@ impl XousDisplay {
|
||||||
fn busy(&self) -> bool {
|
fn busy(&self) -> bool {
|
||||||
self.csr.rf(utra::memlcd::BUSY_BUSY) == 1
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ pub struct XousDisplay {
|
||||||
native_buffer: Vec<u32>, //[u32; WIDTH * HEIGHT],
|
native_buffer: Vec<u32>, //[u32; WIDTH * HEIGHT],
|
||||||
emulated_buffer: [u32; FB_SIZE],
|
emulated_buffer: [u32; FB_SIZE],
|
||||||
window: Window,
|
window: Window,
|
||||||
|
devboot: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct XousKeyboardHandler {
|
struct XousKeyboardHandler {
|
||||||
|
|
@ -65,8 +66,15 @@ impl XousDisplay {
|
||||||
native_buffer,
|
native_buffer,
|
||||||
window,
|
window,
|
||||||
emulated_buffer: [0u32; FB_SIZE],
|
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 suspend(&self, _flag: bool) {}
|
||||||
pub fn resume(&self, _flag: bool) {}
|
pub fn resume(&self, _flag: bool) {}
|
||||||
|
|
||||||
|
|
@ -110,6 +118,8 @@ impl XousDisplay {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn emulated_to_native(&mut self) {
|
fn emulated_to_native(&mut self) {
|
||||||
|
const DEVBOOT_LINE: usize = 12;
|
||||||
|
let mut row = 0;
|
||||||
for (dest_row, src_row) in self
|
for (dest_row, src_row) in self
|
||||||
.native_buffer
|
.native_buffer
|
||||||
.chunks_mut(WIDTH as _)
|
.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 (dest_cell, src_cell) in dest_row.chunks_mut(32).zip(src_row) {
|
||||||
for (bit, dest) in dest_cell.iter_mut().enumerate() {
|
for (bit, dest) in dest_cell.iter_mut().enumerate() {
|
||||||
*dest = if src_cell & (1 << bit) != 0 {
|
if self.devboot && ((bit >> 1) % 2) == 0 && (row == DEVBOOT_LINE) { // try to render the devboot defile somewhat accurately
|
||||||
DARK_COLOUR
|
*dest = LIGHT_COLOUR
|
||||||
} else {
|
} else {
|
||||||
LIGHT_COLOUR
|
*dest = if src_cell & (1 << bit) != 0 {
|
||||||
};
|
DARK_COLOUR
|
||||||
|
} else {
|
||||||
|
LIGHT_COLOUR
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
row += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -141,6 +141,17 @@ impl Gfx {
|
||||||
Message::new_scalar(Opcode::SetSleepNote.to_usize().unwrap(), arg, 0, 0, 0,
|
Message::new_scalar(Opcode::SetSleepNote.to_usize().unwrap(), arg, 0, 0, 0,
|
||||||
)).map(|_|())
|
)).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};
|
use core::sync::atomic::{AtomicU32, Ordering};
|
||||||
|
|
|
||||||
|
|
@ -393,6 +393,10 @@ fn xmain() -> ! {
|
||||||
display.update();
|
display.update();
|
||||||
display.redraw();
|
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,
|
Some(Opcode::Quit) => break,
|
||||||
None => {log::error!("received opcode scalar that is not handled");}
|
None => {log::error!("received opcode scalar that is not handled");}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ impl CommonEnv {
|
||||||
|
|
||||||
///// 1. add your module here, and pull its namespace into the local crate
|
///// 1. add your module here, and pull its namespace into the local crate
|
||||||
mod echo; use echo::*;
|
mod echo; use echo::*;
|
||||||
//mod test; use test::*;
|
mod test; use test::*;
|
||||||
mod sleep; use sleep::*;
|
mod sleep; use sleep::*;
|
||||||
mod sensors; use sensors::*;
|
mod sensors; use sensors::*;
|
||||||
mod callback; use callback::*;
|
mod callback; use callback::*;
|
||||||
|
|
@ -104,7 +104,7 @@ pub struct CmdEnv {
|
||||||
common_env: CommonEnv,
|
common_env: CommonEnv,
|
||||||
lastverb: String::<256>,
|
lastverb: String::<256>,
|
||||||
///// 2. declare storage for your command here.
|
///// 2. declare storage for your command here.
|
||||||
//test_cmd: Test,
|
test_cmd: Test,
|
||||||
sleep_cmd: Sleep,
|
sleep_cmd: Sleep,
|
||||||
sensors_cmd: Sensors,
|
sensors_cmd: Sensors,
|
||||||
callback_cmd: CallBack,
|
callback_cmd: CallBack,
|
||||||
|
|
@ -152,7 +152,7 @@ impl CmdEnv {
|
||||||
common_env: common,
|
common_env: common,
|
||||||
lastverb: String::<256>::new(),
|
lastverb: String::<256>::new(),
|
||||||
///// 3. initialize your storage, by calling new()
|
///// 3. initialize your storage, by calling new()
|
||||||
//test_cmd: Test::new(),
|
test_cmd: Test::new(),
|
||||||
sleep_cmd: Sleep::new(&xns),
|
sleep_cmd: Sleep::new(&xns),
|
||||||
sensors_cmd: Sensors::new(),
|
sensors_cmd: Sensors::new(),
|
||||||
callback_cmd: CallBack::new(),
|
callback_cmd: CallBack::new(),
|
||||||
|
|
@ -181,7 +181,7 @@ impl CmdEnv {
|
||||||
let commands: &mut [& mut dyn ShellCmdApi] = &mut [
|
let commands: &mut [& mut dyn ShellCmdApi] = &mut [
|
||||||
///// 4. add your command to this array, so that it can be looked up and dispatched
|
///// 4. add your command to this array, so that it can be looked up and dispatched
|
||||||
&mut echo_cmd,
|
&mut echo_cmd,
|
||||||
//&mut self.test_cmd,
|
&mut self.test_cmd,
|
||||||
&mut self.sleep_cmd,
|
&mut self.sleep_cmd,
|
||||||
&mut self.sensors_cmd,
|
&mut self.sensors_cmd,
|
||||||
&mut self.callback_cmd,
|
&mut self.callback_cmd,
|
||||||
|
|
|
||||||
|
|
@ -16,12 +16,32 @@ impl Test {
|
||||||
impl<'a> ShellCmdApi<'a> for Test {
|
impl<'a> ShellCmdApi<'a> for Test {
|
||||||
cmd_api!(test);
|
cmd_api!(test);
|
||||||
|
|
||||||
fn process(&mut self, _args: String::<1024>, _env: &mut CommonEnv) -> Result<Option<String::<1024>>, xous::Error> {
|
fn process(&mut self, args: String::<1024>, env: &mut CommonEnv) -> Result<Option<String::<1024>>, xous::Error> {
|
||||||
use core::fmt::Write;
|
use core::fmt::Write;
|
||||||
|
|
||||||
self.state += 1;
|
self.state += 1;
|
||||||
let mut ret = String::<1024>::new();
|
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))
|
Ok(Some(ret))
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue