mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
lay in foundations to support the sleep function
This commit is contained in:
parent
2b66ab1db0
commit
835bee2c75
14 changed files with 176 additions and 102 deletions
3
Cargo.lock
generated
3
Cargo.lock
generated
|
|
@ -646,6 +646,7 @@ dependencies = [
|
|||
"heapless",
|
||||
"log",
|
||||
"log-server",
|
||||
"rkyv",
|
||||
"ticktimer-server",
|
||||
"utralib",
|
||||
"xous",
|
||||
|
|
@ -1090,11 +1091,13 @@ dependencies = [
|
|||
name = "shellchat"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"com",
|
||||
"content-plugin-api",
|
||||
"gam",
|
||||
"graphics-server",
|
||||
"heapless",
|
||||
"ime-plugin-api",
|
||||
"llio",
|
||||
"log",
|
||||
"log-server",
|
||||
"rkyv",
|
||||
|
|
|
|||
|
|
@ -56,6 +56,9 @@ pub enum Opcode {
|
|||
// the Gid argument is the rkyv return value.
|
||||
RequestContentCanvas(ContentCanvasRequest),
|
||||
|
||||
// Requests setting the UI to the power down screen
|
||||
PowerDownRequest,
|
||||
|
||||
/////// planned
|
||||
|
||||
// hides a canvas with a given GID
|
||||
|
|
@ -76,6 +79,7 @@ impl core::convert::TryFrom<&Message> for Opcode {
|
|||
},
|
||||
Message::BlockingScalar(m) => match m.id {
|
||||
0 => Ok(Opcode::GetCanvasBounds(Gid::new([m.arg1 as _, m.arg2 as _, m.arg3 as _, m.arg4 as _]))),
|
||||
1 => Ok(Opcode::PowerDownRequest),
|
||||
_ => Err("GAM api: unknown BlockingScalar ID"),
|
||||
}
|
||||
_ => Err("GAM api: unhandled message type"),
|
||||
|
|
@ -86,15 +90,20 @@ impl core::convert::TryFrom<&Message> for Opcode {
|
|||
impl Into<Message> for Opcode {
|
||||
fn into(self) -> Message {
|
||||
match self {
|
||||
// scalars
|
||||
Opcode::ClearCanvas(gid) => Message::Scalar(ScalarMessage {
|
||||
id: 0, arg1: gid.gid()[0] as _, arg2: gid.gid()[1] as _, arg3: gid.gid()[2] as _, arg4: gid.gid()[3] as _
|
||||
}),
|
||||
Opcode::Redraw => Message::Scalar(ScalarMessage {
|
||||
id: 1, arg1: 0, arg2: 0, arg3: 0, arg4: 0
|
||||
}),
|
||||
// blocking scalars
|
||||
Opcode::GetCanvasBounds(gid) => Message::BlockingScalar(ScalarMessage {
|
||||
id: 0, arg1: gid.gid()[0] as _, arg2: gid.gid()[1] as _, arg3: gid.gid()[2] as _, arg4: gid.gid()[3] as _
|
||||
}),
|
||||
Opcode::PowerDownRequest => Message::BlockingScalar(ScalarMessage {
|
||||
id: 1, arg1: 0, arg2: 0, arg3: 0, arg4: 0
|
||||
}),
|
||||
_ => panic!("GAM api: Opcode type not handled by Into(), maybe you meant to use a helper method?"),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
pub mod api;
|
||||
use api::*;
|
||||
|
||||
use xous::send_message;
|
||||
use rkyv::Write;
|
||||
use rkyv::Unarchive;
|
||||
use graphics_server::api::{TextOp, TextView};
|
||||
|
|
@ -14,6 +15,19 @@ pub fn redraw(gam_cid: xous::CID) -> Result<(), xous::Error> {
|
|||
xous::send_message(gam_cid, api::Opcode::Redraw.into()).map(|_|())
|
||||
}
|
||||
|
||||
pub fn powerdown_request(gam_cid: xous::CID) -> Result<bool, xous::Error> {
|
||||
let response = send_message(gam_cid, api::Opcode::PowerDownRequest.into())?;
|
||||
if let xous::Result::Scalar1(confirmed) = response {
|
||||
if confirmed != 0 {
|
||||
Ok(true)
|
||||
} else {
|
||||
Ok(false)
|
||||
}
|
||||
} else {
|
||||
panic!("GAM_API: unexpected return value: {:#?}", response);
|
||||
}
|
||||
}
|
||||
|
||||
/// this "posts" a textview -- it's not a "draw" as the update is neither guaranteed nor instantaneous
|
||||
/// the GAM first has to check that the textview is allowed to be updated, and then it will decide when
|
||||
/// the actual screen update is allowed
|
||||
|
|
|
|||
|
|
@ -221,6 +221,7 @@ fn xmain() -> ! {
|
|||
// no content canvas initially, but keep a placeholder for one
|
||||
let mut ccc: ContentCanvasConnection = ContentCanvasConnection{connection: None};
|
||||
|
||||
let mut powerdown_requested = false;
|
||||
let mut last_time: u64 = ticktimer_server::elapsed_ms(ticktimer_conn).unwrap();
|
||||
info!("GAM: entering main loop");
|
||||
loop {
|
||||
|
|
@ -254,8 +255,17 @@ fn xmain() -> ! {
|
|||
},
|
||||
None => info!("GAM: attempt to get bounds on bogus canvas, ignored."),
|
||||
}
|
||||
}
|
||||
},
|
||||
Opcode::PowerDownRequest => {
|
||||
powerdown_requested = true;
|
||||
graphics_server::draw_sleepscreen(gfx_conn).expect("GAM: couldn't draw sleep screen");
|
||||
// a screen flush is part of the draw_sleepscreen abstraction
|
||||
xous::return_scalar(envelope.sender, 1).expect("GAM: couldn't confirm power down UI request");
|
||||
},
|
||||
Opcode::Redraw => {
|
||||
if powerdown_requested {
|
||||
continue; // don't allow any redraws if a powerdown is requested
|
||||
}
|
||||
if let Ok(elapsed_time) = ticktimer_server::elapsed_ms(ticktimer_conn) {
|
||||
if elapsed_time - last_time > 33 { // rate limit updates, no point in going faster than the eye can see
|
||||
last_time = elapsed_time;
|
||||
|
|
|
|||
|
|
@ -104,6 +104,9 @@ pub enum Opcode {
|
|||
|
||||
/// draws an object that requires clipping
|
||||
DrawClipObject(ClipObject),
|
||||
|
||||
/// draws the sleep screen; assumes requests are vetted by GAM/xous-names
|
||||
DrawSleepScreen
|
||||
}
|
||||
|
||||
impl core::convert::TryFrom<& Message> for Opcode {
|
||||
|
|
@ -146,6 +149,7 @@ impl core::convert::TryFrom<& Message> for Opcode {
|
|||
DrawStyle::from(m.arg3)),
|
||||
m.arg4 as _
|
||||
))),
|
||||
16 => Ok(Opcode::DrawSleepScreen),
|
||||
_ => Err("unrecognized opcode"),
|
||||
},
|
||||
Message::BlockingScalar(m) => match m.id {
|
||||
|
|
@ -263,6 +267,9 @@ impl Into<Message> for Opcode {
|
|||
arg3: rr.border.style.into(),
|
||||
arg4: rr.radius as _,
|
||||
}),
|
||||
Opcode::DrawSleepScreen => Message::Scalar(ScalarMessage {
|
||||
id: 16, arg1: 0, arg2: 0, arg3: 0, arg4: 0,
|
||||
}),
|
||||
_ => panic!("GFX api: Opcode type not handled by Into(), maybe you meant to use a helper method?"),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,6 +36,10 @@ pub fn flush(cid: CID) -> Result<(), xous::Error> {
|
|||
send_message(cid, api::Opcode::Flush.into()).map(|_| ())
|
||||
}
|
||||
|
||||
pub fn draw_sleepscreen(cid: CID) -> Result<(), xous::Error> {
|
||||
send_message(cid, api::Opcode::DrawSleepScreen.into()).map(|_| ())
|
||||
}
|
||||
|
||||
#[deprecated(
|
||||
note = "Please use draw_textview for atomic text updates"
|
||||
)]
|
||||
|
|
|
|||
|
|
@ -433,11 +433,11 @@ fn xmain() -> ! {
|
|||
)
|
||||
.expect("GFX: could not return QueryGlyphProps request");
|
||||
}
|
||||
/*
|
||||
Opcode::TextView(tv) => {
|
||||
info!("GFX: got draw of '{:?}'", tv);
|
||||
op::textview(display.native_buffer(), tv);
|
||||
}*/
|
||||
Opcode::DrawSleepScreen => {
|
||||
display.blit_screen(logo::LOGO_MAP);
|
||||
display.update();
|
||||
display.redraw();
|
||||
}
|
||||
_ => panic!("GFX: received opcode scalar that is not handled")
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ log-server = { path = "../log-server" }
|
|||
ticktimer-server = { path = "../ticktimer-server" }
|
||||
xous-names = { path = "../xous-names" }
|
||||
log = "0.4"
|
||||
rkyv = { version = "0.3.1", default_features = false }
|
||||
|
||||
[target.'cfg(not(any(windows,unix)))'.dependencies]
|
||||
utralib = { path = "../../utralib"}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,7 @@
|
|||
use xous::{Message, ScalarMessage};
|
||||
use xous_names::api::Registration;
|
||||
|
||||
pub const SUBTYPE_REGISTER_GPIO_LISTENER: u16 = 0;
|
||||
pub const SUBTYPE_REGISTER_COM_LISTENER: u16 = 1;
|
||||
pub const SUBTYPE_REGISTER_RTC_LISTENER: u16 = 2;
|
||||
pub const SUBTYPE_REGISTER_USB_LISTENER: u16 = 3;
|
||||
pub const SUBTYPE_I2C_WRITE: u16 = 4;
|
||||
pub const SUBTYPE_I2C_READ: u16 = 5;
|
||||
pub const SUBTYPE_LITEX_ID: u16 = 6;
|
||||
use xous::String;
|
||||
|
||||
/////////////////////// UART TYPE
|
||||
#[derive(Debug)]
|
||||
pub enum UartType {
|
||||
Kernel,
|
||||
|
|
@ -49,15 +42,80 @@ impl Into<u32> for UartType {
|
|||
}
|
||||
}
|
||||
|
||||
/////////////////////// I2C
|
||||
use core::slice;
|
||||
use core::ops::{Deref, DerefMut};
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct I2cTransaction {
|
||||
busAddr: u8,
|
||||
bus_addr: u8,
|
||||
// write address and read address are encoded in the packet field below
|
||||
packet: [u8; 258], // up to 258 bytes total packet length; note cost is "same" b/c these are sent via 4kiB page remaps
|
||||
length: u8,
|
||||
// read or write type is encoded in the opcode
|
||||
}
|
||||
impl I2cTransaction {
|
||||
pub fn new() -> Self {
|
||||
I2cTransaction{ bus_addr: 0, packet: [0; 258], length: 0 }
|
||||
}
|
||||
}
|
||||
impl Deref for I2cTransaction {
|
||||
type Target = [u8];
|
||||
fn deref(&self) -> &[u8] {
|
||||
unsafe {
|
||||
slice::from_raw_parts(self as *const I2cTransaction as *const u8, core::mem::size_of::<I2cTransaction>())
|
||||
as &[u8]
|
||||
}
|
||||
}
|
||||
}
|
||||
impl DerefMut for I2cTransaction {
|
||||
fn deref_mut(&mut self) -> &mut[u8] {
|
||||
unsafe {
|
||||
slice::from_raw_parts_mut(self as *mut I2cTransaction as *mut u8, core::mem::size_of::<I2cTransaction>())
|
||||
as &mut [u8]
|
||||
}
|
||||
}
|
||||
}
|
||||
pub struct ArchivedI2cTransaction {
|
||||
ptr: rkyv::RelPtr,
|
||||
}
|
||||
pub struct I2cTransactionResolver {
|
||||
bytes_pos: usize,
|
||||
}
|
||||
impl rkyv::Resolve<I2cTransaction> for I2cTransactionResolver {
|
||||
type Archived = ArchivedI2cTransaction;
|
||||
fn resolve(self, pos: usize, value: &I2cTransaction) -> Self::Archived {
|
||||
Self::Archived {
|
||||
ptr: unsafe {
|
||||
rkyv::RelPtr::new(pos + rkyv::offset_of!(ArchivedI2cTransaction, ptr), self.bytes_pos)
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl rkyv::Archive for I2cTransaction {
|
||||
type Archived = ArchivedI2cTransaction;
|
||||
type Resolver = I2cTransactionResolver;
|
||||
|
||||
fn archive<W: rkyv::Write + ?Sized>(&self, writer: &mut W) -> core::result::Result<Self::Resolver, W::Error> {
|
||||
let bytes_pos = writer.pos();
|
||||
writer.write(self.deref())?;
|
||||
Ok(Self::Resolver { bytes_pos })
|
||||
}
|
||||
}
|
||||
impl rkyv::Unarchive<I2cTransaction> for ArchivedI2cTransaction {
|
||||
fn unarchive(&self) -> I2cTransaction {
|
||||
let mut i2c: I2cTransaction = I2cTransaction::new();
|
||||
unsafe {
|
||||
let p = self.ptr.as_ptr() as *const u8;
|
||||
for(i, val) in i2c.deref_mut().iter_mut().enumerate() {
|
||||
*val = p.add(i).read();
|
||||
}
|
||||
};
|
||||
i2c
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////// VIBE
|
||||
#[derive(Debug)]
|
||||
pub enum VibePattern {
|
||||
Short,
|
||||
|
|
@ -67,9 +125,9 @@ pub enum VibePattern {
|
|||
impl From<usize> for VibePattern {
|
||||
fn from(pattern: usize) -> Self {
|
||||
match pattern {
|
||||
_ => VibePattern::Short,
|
||||
0 => VibePattern::Long,
|
||||
1 => VibePattern::Double,
|
||||
_ => VibePattern::Short,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -83,6 +141,7 @@ impl Into<usize> for VibePattern {
|
|||
}
|
||||
}
|
||||
|
||||
//////////////////////////////// CLOCK GATING (placeholder)
|
||||
#[derive(Debug)]
|
||||
pub enum ClockMode {
|
||||
Low,
|
||||
|
|
@ -105,6 +164,7 @@ impl Into<usize> for ClockMode {
|
|||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////// OPCODES
|
||||
#[allow(dead_code)]
|
||||
#[derive(Debug)]
|
||||
pub enum Opcode {
|
||||
|
|
@ -127,13 +187,13 @@ pub enum Opcode {
|
|||
GpioIntAsFalling(u32),
|
||||
GpioIntPending,
|
||||
GpioIntEna(u32),
|
||||
GpioIntSubscribe(Registration), // TODO
|
||||
GpioIntSubscribe(String<64>), // TODO
|
||||
|
||||
/// not tested - set UART mux
|
||||
UartMux(UartType),
|
||||
|
||||
/// not tested - information about the SoC build and revision
|
||||
InfoLitexId(Registration), // TODO: returns the ASCII string baked into the FPGA that describes the FPGA build, inside Registration
|
||||
InfoLitexId(String<64>), // TODO: returns the ASCII string baked into the FPGA that describes the FPGA build, inside Registration
|
||||
InfoDna,
|
||||
InfoGit,
|
||||
InfoPlatform,
|
||||
|
|
@ -154,12 +214,14 @@ pub enum Opcode {
|
|||
|
||||
/// not tested - I2C functions
|
||||
I2cWrite(I2cTransaction), /// LEFT OFF HERE -- need rkyv sending of messages
|
||||
I2cRead(I2cTransaction),
|
||||
I2cReadBlocking(I2cTransaction),
|
||||
I2cReadSubscribe(String<64>),
|
||||
I2cReadNonBlocking(I2cTransaction),
|
||||
|
||||
/// not tested -- events
|
||||
EventComSubscribe(Registration),
|
||||
EventRtcSubscribe(Registration),
|
||||
EventUsbAttachSubscribe(Registration),
|
||||
EventComSubscribe(String<64>),
|
||||
EventRtcSubscribe(String<64>),
|
||||
EventUsbAttachSubscribe(String<64>),
|
||||
EventComEnable(bool),
|
||||
EventRtcEnable(bool),
|
||||
EventUsbAttachEnable(bool),
|
||||
|
|
@ -233,44 +295,6 @@ impl core::convert::TryFrom<& Message> for Opcode {
|
|||
0x108 => Ok(Opcode::InfoSeed),
|
||||
_ => Err("LLIO api: unknown BlockingScalar ID"),
|
||||
},
|
||||
Message::Borrow(m) => {
|
||||
if xous_names::api::Registration::match_subtype(m.id, SUBTYPE_REGISTER_GPIO_LISTENER) {
|
||||
Ok(Opcode::GpioIntSubscribe({
|
||||
unsafe { *( (m.buf.as_mut_ptr()) as *mut xous_names::api::Registration) }
|
||||
}))
|
||||
} else if xous_names::api::Registration::match_subtype(m.id, SUBTYPE_REGISTER_COM_LISTENER) {
|
||||
Ok(Opcode::EventComSubscribe({
|
||||
unsafe { *( (m.buf.as_mut_ptr()) as *mut xous_names::api::Registration) }
|
||||
}))
|
||||
} else if xous_names::api::Registration::match_subtype(m.id, SUBTYPE_REGISTER_RTC_LISTENER) {
|
||||
Ok(Opcode::EventRtcSubscribe({
|
||||
unsafe { *( (m.buf.as_mut_ptr()) as *mut xous_names::api::Registration) }
|
||||
}))
|
||||
} else if xous_names::api::Registration::match_subtype(m.id, SUBTYPE_REGISTER_USB_LISTENER) {
|
||||
Ok(Opcode::EventUsbAttachSubscribe({
|
||||
unsafe { *( (m.buf.as_mut_ptr()) as *mut xous_names::api::Registration) }
|
||||
}))
|
||||
} else if m.id as u16 == SUBTYPE_I2C_WRITE {
|
||||
Ok(Opcode::I2cWrite({
|
||||
unsafe { *( (m.buf.as_mut_ptr()) as *mut I2cTransaction) }
|
||||
}))
|
||||
} else {
|
||||
Err("COM: unknown borrow ID")
|
||||
}
|
||||
},
|
||||
Message::MutableBorrow(m) => {
|
||||
if m.id as u16 == SUBTYPE_I2C_READ {
|
||||
Ok(Opcode::I2cRead({
|
||||
unsafe { *( (m.buf.as_mut_ptr()) as *mut I2cTransaction) }
|
||||
}))
|
||||
} else if m.id as u16 == SUBTYPE_LITEX_ID {
|
||||
Ok(Opcode::InfoLitexId({
|
||||
unsafe { *( (m.buf.as_mut_ptr()) as *mut Registration) }
|
||||
}))
|
||||
} else {
|
||||
Err("COM: unknown mutable borrow ID")
|
||||
}
|
||||
}
|
||||
_ => Err("unhandled message type"),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,3 +7,7 @@ pub mod api;
|
|||
use api::*;
|
||||
use xous::{send_message, Error, CID};
|
||||
|
||||
pub fn allow_power_off(cid: CID, allow: bool) -> Result<(), xous::Error> {
|
||||
// note sense inversion on allow versus the opcode
|
||||
send_message(cid, api::Opcode::PowerSelf(!allow).into()).map(|_| ())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,14 +14,9 @@ use xous::CID;
|
|||
mod implementation {
|
||||
use crate::api::*;
|
||||
use log::{error, info};
|
||||
use utra::info::GIT_GITEXTRA_GIT_GITEXTRA;
|
||||
use utralib::generated::*;
|
||||
use xous::CID;
|
||||
use ticktimer_server::*;
|
||||
|
||||
use heapless::Vec;
|
||||
use heapless::consts::*;
|
||||
|
||||
const STD_TIMEOUT: u32 = 100;
|
||||
|
||||
pub struct Llio {
|
||||
|
|
@ -257,7 +252,7 @@ mod implementation {
|
|||
}
|
||||
pub fn ec_reset(&mut self) {
|
||||
self.power_csr.rmwf(utra::power::POWER_RESET_EC, 1);
|
||||
ticktimer_server::sleep_ms(self.ticktimer_conn, 100);
|
||||
ticktimer_server::sleep_ms(self.ticktimer_conn, 100).unwrap();
|
||||
self.power_csr.rmwf(utra::power::POWER_RESET_EC, 0);
|
||||
}
|
||||
pub fn ec_power_on(&mut self) {
|
||||
|
|
@ -277,21 +272,21 @@ mod implementation {
|
|||
match pattern {
|
||||
VibePattern::Short => {
|
||||
self.power_csr.wfo(utra::power::VIBE_VIBE, 1);
|
||||
ticktimer_server::sleep_ms(self.ticktimer_conn, 250);
|
||||
ticktimer_server::sleep_ms(self.ticktimer_conn, 250).unwrap();
|
||||
self.power_csr.wfo(utra::power::VIBE_VIBE, 0);
|
||||
},
|
||||
VibePattern::Long => {
|
||||
self.power_csr.wfo(utra::power::VIBE_VIBE, 1);
|
||||
ticktimer_server::sleep_ms(self.ticktimer_conn, 1000);
|
||||
ticktimer_server::sleep_ms(self.ticktimer_conn, 1000).unwrap();
|
||||
self.power_csr.wfo(utra::power::VIBE_VIBE, 0);
|
||||
},
|
||||
VibePattern::Double => {
|
||||
self.power_csr.wfo(utra::power::VIBE_VIBE, 1);
|
||||
ticktimer_server::sleep_ms(self.ticktimer_conn, 250);
|
||||
ticktimer_server::sleep_ms(self.ticktimer_conn, 250).unwrap();
|
||||
self.power_csr.wfo(utra::power::VIBE_VIBE, 0);
|
||||
ticktimer_server::sleep_ms(self.ticktimer_conn, 250);
|
||||
ticktimer_server::sleep_ms(self.ticktimer_conn, 250).unwrap();
|
||||
self.power_csr.wfo(utra::power::VIBE_VIBE, 1);
|
||||
ticktimer_server::sleep_ms(self.ticktimer_conn, 250);
|
||||
ticktimer_server::sleep_ms(self.ticktimer_conn, 250).unwrap();
|
||||
self.power_csr.wfo(utra::power::VIBE_VIBE, 0);
|
||||
},
|
||||
}
|
||||
|
|
@ -314,34 +309,35 @@ mod implementation {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn reboot(_reboot_soc: bool) {}
|
||||
pub fn set_rebot_vector(_vector: u32) {}
|
||||
pub fn gpio_dout(_d: u32) {}
|
||||
pub fn gpio_din() -> u32 { 0xDEAD_BEEF }
|
||||
pub fn gpio_drive(_d: u32) {}
|
||||
pub fn gpio_int_mask(_d: u32) {}
|
||||
pub fn gpio_int_as_falling(_d: u32) {}
|
||||
pub fn gpio_int_pending() -> u32 { 0x0 }
|
||||
pub fn gpio_int_ena(_d: u32) {}
|
||||
pub fn set_uart_mux(_mux: UartType) {}
|
||||
pub fn get_info_dna() -> (usize, usize) { (0, 0) }
|
||||
pub fn get_info_git() -> (usize, usize) { (0, 0) }
|
||||
pub fn get_info_platform() -> (usize, usize) { (0, 0) }
|
||||
pub fn get_info_target() -> (usize, usize) { (0, 0) }
|
||||
pub fn get_info_seed() -> (usize, usize) { (0, 0) }
|
||||
pub fn power_audio(_power_on: bool) {}
|
||||
pub fn power_self(_power_on: bool) {}
|
||||
pub fn power_boost_mode(_power_on: bool) {}
|
||||
pub fn ec_snoop_allow(_power_on: bool) {}
|
||||
pub fn ec_reset() {}
|
||||
pub fn ec_power_on() {}
|
||||
pub fn self_destruct(_code: u32) {}
|
||||
pub fn vibe(_pattern: VibePattern) {}
|
||||
pub fn reboot(&self, _reboot_soc: bool) {}
|
||||
pub fn set_reboot_vector(&self, _vector: u32) {}
|
||||
pub fn gpio_dout(&self, _d: u32) {}
|
||||
pub fn gpio_din(&self, ) -> u32 { 0xDEAD_BEEF }
|
||||
pub fn gpio_drive(&self, _d: u32) {}
|
||||
pub fn gpio_int_mask(&self, _d: u32) {}
|
||||
pub fn gpio_int_as_falling(&self, _d: u32) {}
|
||||
pub fn gpio_int_pending(&self, ) -> u32 { 0x0 }
|
||||
pub fn gpio_int_ena(&self, _d: u32) {}
|
||||
pub fn set_uart_mux(&self, _mux: UartType) {}
|
||||
pub fn get_info_dna(&self, ) -> (usize, usize) { (0, 0) }
|
||||
pub fn get_info_git(&self, ) -> (usize, usize) { (0, 0) }
|
||||
pub fn get_info_platform(&self, ) -> (usize, usize) { (0, 0) }
|
||||
pub fn get_info_target(&self, ) -> (usize, usize) { (0, 0) }
|
||||
pub fn get_info_seed(&self, ) -> (usize, usize) { (0, 0) }
|
||||
pub fn power_audio(&self, _power_on: bool) {}
|
||||
pub fn power_self(&self, _power_on: bool) {}
|
||||
pub fn power_boost_mode(&self, _power_on: bool) {}
|
||||
pub fn ec_snoop_allow(&self, _power_on: bool) {}
|
||||
pub fn ec_reset(&self, ) {}
|
||||
pub fn ec_power_on(&self, ) {}
|
||||
pub fn self_destruct(&self, _code: u32) {}
|
||||
pub fn vibe(&self, _pattern: VibePattern) {}
|
||||
}
|
||||
}
|
||||
|
||||
#[xous::xous_main]
|
||||
fn xmain() -> ! {
|
||||
let debug1 = false;
|
||||
use crate::implementation::Llio;
|
||||
use heapless::Vec;
|
||||
use heapless::consts::*;
|
||||
|
|
@ -350,16 +346,16 @@ fn xmain() -> ! {
|
|||
info!("LLIO: my PID is {}", xous::process::id());
|
||||
|
||||
let llio_sid = xous_names::register_name(xous::names::SERVER_NAME_LLIO).expect("LLIO: can't register server");
|
||||
info!("LLIO: registered with NS -- {:?}", llio_sid);
|
||||
if debug1{info!("LLIO: registered with NS -- {:?}", llio_sid);}
|
||||
|
||||
// Create a new com object
|
||||
let mut llio = Llio::new();
|
||||
|
||||
info!("LLIO: starting main loop");
|
||||
if debug1{info!("LLIO: starting main loop");}
|
||||
let mut reboot_requested: bool = false;
|
||||
loop {
|
||||
let envelope = xous::receive_message(llio_sid).unwrap();
|
||||
// info!("LLIO: Message: {:?}", envelope);
|
||||
if debug1{info!("LLIO: Message: {:?}", envelope)};
|
||||
if let Ok(opcode) = Opcode::try_from(&envelope.body) {
|
||||
// info!("LLIO: Opcode: {:?}", opcode);
|
||||
// reset the reboot request if the very next opcode is not a confirm
|
||||
|
|
@ -415,9 +411,6 @@ fn xmain() -> ! {
|
|||
Opcode::GpioIntEna(d) => {
|
||||
llio.gpio_int_ena(d);
|
||||
},
|
||||
Opcode::GpioIntSubscribe(_Registration) => {
|
||||
todo!("LLIO: GPIO push interrupt events not yet implemented.");
|
||||
},
|
||||
Opcode::UartMux(mux) => {
|
||||
llio.set_uart_mux(mux);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -313,6 +313,7 @@ fn reader_thread(mut output: implementation::OutputWriter) {
|
|||
|
||||
#[xous::xous_main]
|
||||
fn some_main() -> ! {
|
||||
/*
|
||||
#[cfg(baremetal)]
|
||||
{
|
||||
// use this to select which UART to monitor in the main loop
|
||||
|
|
@ -327,6 +328,7 @@ fn some_main() -> ! {
|
|||
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
|
||||
}
|
||||
*/
|
||||
|
||||
let mut output = implementation::init();
|
||||
let writer = output.get_writer();
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@ ime-plugin-api = {path="../ime-plugin-api"}
|
|||
content-plugin-api = {path="../content-plugin-api"} # all content canvas providers must provide this API
|
||||
log = "0.4"
|
||||
rkyv = { version = "0.3.1", default_features = false }
|
||||
com={path="../com"}
|
||||
llio={path="../llio"}
|
||||
|
||||
|
||||
[target.'cfg(not(any(windows,unix)))'.dependencies]
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ fn try_main() -> Result<(), DynError> {
|
|||
"xous-names",
|
||||
"keyboard",
|
||||
"trng",
|
||||
//"llio",
|
||||
"llio",
|
||||
];
|
||||
let fcc_pkgs = [
|
||||
"shell",
|
||||
|
|
@ -212,6 +212,7 @@ fn run(debug: bool) -> Result<(), DynError> {
|
|||
"xous-names",
|
||||
"keyboard",
|
||||
"trng",
|
||||
"llio",
|
||||
];
|
||||
|
||||
build(&init, debug, None, None)?;
|
||||
|
|
|
|||
Loading…
Reference in a new issue