mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-16 08:38:26 +00:00
remove USB checkup functions from LLIO crate
This commit is contained in:
parent
346caad315
commit
78611f97c4
5 changed files with 0 additions and 91 deletions
|
|
@ -118,9 +118,6 @@ pub(crate) enum Opcode {
|
|||
EventRtcHappened,
|
||||
EventUsbHappened,
|
||||
|
||||
/// debug USB status
|
||||
DebugUsbOp,
|
||||
|
||||
/// SuspendResume callback
|
||||
SuspendResume,
|
||||
|
||||
|
|
|
|||
|
|
@ -3,14 +3,12 @@ use llio::api::*;
|
|||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub struct Llio {
|
||||
usb_disable: bool,
|
||||
}
|
||||
pub fn log_init() -> *mut u32 { 0 as *mut u32 }
|
||||
|
||||
impl Llio {
|
||||
pub fn new(_handler_conn: xous::CID, _gpio_base: *mut u32) -> Llio {
|
||||
Llio {
|
||||
usb_disable: false,
|
||||
}
|
||||
}
|
||||
pub fn suspend(&self) {}
|
||||
|
|
@ -88,12 +86,6 @@ impl Llio {
|
|||
pub fn wfi_override(&mut self, _override_: bool) {
|
||||
}
|
||||
|
||||
pub fn get_usb_disable(&self) -> bool {
|
||||
self.usb_disable
|
||||
}
|
||||
pub fn set_usb_disable(&mut self, state: bool) {
|
||||
self.usb_disable = state;
|
||||
}
|
||||
#[allow(dead_code)]
|
||||
pub fn tts_sleep_indicate(&mut self) {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -471,24 +471,5 @@ impl Llio {
|
|||
let value = if ena {1} else {0};
|
||||
self.power_csr.rmwf(utra::power::EV_PENDING_USB_ATTACH, value);
|
||||
}
|
||||
pub fn get_usb_disable(&self) -> bool {
|
||||
log::debug!("*********** get_usb_disable must migrate to usbdev server once it is stabilized!!! *********");
|
||||
false
|
||||
/*
|
||||
if self.gpio_csr.rf(utra::gpio::USBDISABLE_USBDISABLE) != 0 {
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}*/
|
||||
}
|
||||
pub fn set_usb_disable(&mut self, _state: bool) {
|
||||
log::warn!("*********** set_usb_disable must migrate to usbdev server once it is stabilized!!! *********");
|
||||
/*
|
||||
if state {
|
||||
self.gpio_csr.wfo(utra::gpio::USBDISABLE_USBDISABLE, 1);
|
||||
} else {
|
||||
self.gpio_csr.wfo(utra::gpio::USBDISABLE_USBDISABLE, 0);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -343,34 +343,6 @@ impl Llio {
|
|||
Err(xous::Error::InternalError)
|
||||
}
|
||||
}
|
||||
// if do_lock is Some(), set the debug USB lock status to locked if true, unlocked if false
|
||||
// returns a tuple of (bool, bool) -> (is_locked, force_update)
|
||||
// needs_update is so that the polling function knows to redraw the UX after a resume-from-suspend
|
||||
pub fn debug_usb(&self, do_lock: Option<bool>) -> Result<(bool, bool), xous::Error> {
|
||||
// arg1 indicates if an update to the state is requested
|
||||
// arg2 is the new state update
|
||||
let (arg1, arg2) = if let Some(lock) = do_lock {
|
||||
if lock {
|
||||
(1, 1)
|
||||
} else {
|
||||
(1, 0)
|
||||
}
|
||||
} else {
|
||||
(0, 0)
|
||||
};
|
||||
let response = send_message(self.conn,
|
||||
Message::new_blocking_scalar(Opcode::DebugUsbOp.to_usize().unwrap(), arg1, arg2, 0, 0))?;
|
||||
if let xous::Result::Scalar2(is_locked, force_update) = response {
|
||||
let il = if is_locked != 0 {true} else {false};
|
||||
let fu = if force_update != 0 {true} else {false};
|
||||
Ok(
|
||||
(il, fu)
|
||||
)
|
||||
} else {
|
||||
log::error!("LLIO: unexpected return value: {:#?}", response);
|
||||
Err(xous::Error::InternalError)
|
||||
}
|
||||
}
|
||||
pub fn set_uart_mux(&self, setting: UartType) -> Result<(), xous::Error> {
|
||||
if setting == UartType::Application {
|
||||
log::warn!("Application UART has aggressive power settings, so you will have trouble using it for console input.");
|
||||
|
|
|
|||
|
|
@ -155,8 +155,6 @@ fn xmain() -> ! {
|
|||
let mut rtc_cb_conns: [Option<ScalarCallback>; 32] = [None; 32];
|
||||
let mut gpio_cb_conns: [Option<ScalarCallback>; 32] = [None; 32];
|
||||
|
||||
let mut lockstatus_force_update = true; // some state to track if we've been through a susupend/resume, to help out the status thread with its UX update after a restart-from-cold
|
||||
|
||||
// create a self-connection to I2C to handle the public, non-security sensitive RTC API calls
|
||||
let mut i2c = llio::I2c::new(&xns);
|
||||
let mut rtc_alarm_enabled = false;
|
||||
|
|
@ -176,7 +174,6 @@ fn xmain() -> ! {
|
|||
llio.resume();
|
||||
#[cfg(feature="tts")]
|
||||
llio.vibe(VibePattern::Double);
|
||||
lockstatus_force_update = true; // notify the status bar that yes, it does need to redraw the lock status, even if the value hasn't changed since the last read
|
||||
}),
|
||||
Some(Opcode::CrgMode) => msg_scalar_unpack!(msg, _mode, _, _, _, {
|
||||
todo!("CrgMode opcode not yet implemented.");
|
||||
|
|
@ -393,36 +390,6 @@ fn xmain() -> ! {
|
|||
latest_activity %= period;
|
||||
}
|
||||
}),
|
||||
Some(Opcode::DebugUsbOp) => msg_blocking_scalar_unpack!(msg, update_req, new_state, _, _, {
|
||||
if update_req != 0 {
|
||||
// if new_state is true (not 0), then try to lock the USB port
|
||||
// if false, try to unlock the USB port
|
||||
if new_state != 0 {
|
||||
llio.set_usb_disable(true);
|
||||
} else {
|
||||
llio.set_usb_disable(false);
|
||||
}
|
||||
}
|
||||
// at this point, *read back* the new state -- don't assume it "took". The readback is always based on
|
||||
// a real hardware value and not the requested value. for now, always false.
|
||||
let is_locked = if llio.get_usb_disable() {
|
||||
1
|
||||
} else {
|
||||
0
|
||||
};
|
||||
|
||||
// this is a performance optimization. we could always redraw the status, but, instead we only redraw when
|
||||
// the status has changed. However, there is an edge case: on a resume from suspend, the status needs a redraw,
|
||||
// even if nothing has changed. Thus, we have this separate boolean we send back to force an update in the
|
||||
// case that we have just come out of a suspend.
|
||||
let force_update = if lockstatus_force_update {
|
||||
1
|
||||
} else {
|
||||
0
|
||||
};
|
||||
xous::return_scalar2(msg.sender, is_locked, force_update).expect("couldn't return status");
|
||||
lockstatus_force_update = false;
|
||||
}),
|
||||
Some(Opcode::SetWakeupAlarm) => msg_blocking_scalar_unpack!(msg, delay, _, _, _, {
|
||||
if delay > u8::MAX as usize {
|
||||
log::error!("Wakeup must be no longer than {} secs in the future", u8::MAX);
|
||||
|
|
|
|||
Loading…
Reference in a new issue