mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
add wifi reset opcodes
This commit is contained in:
parent
9647c47c2c
commit
9f4dc8a7b1
8 changed files with 45 additions and 14 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
|
@ -314,7 +314,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "com_rs"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/betrusted-io/com_rs.git?rev=885330c0a58fc5c3c9388628435dab24a0b61ab5#885330c0a58fc5c3c9388628435dab24a0b61ab5"
|
||||
source = "git+https://github.com/betrusted-io/com_rs.git?rev=8dfa9ad067b41d0970da1578bb70b0869bc9a74f#8dfa9ad067b41d0970da1578bb70b0869bc9a74f"
|
||||
|
||||
[[package]]
|
||||
name = "com_rs-ref"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<device schemaVersion="1.1" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="CMSIS-SVD.xsd" >
|
||||
<vendor>litex</vendor>
|
||||
<name>SOC</name>
|
||||
<description><![CDATA[Litex SoC 2021-04-12 22:36:11]]></description>
|
||||
<description><![CDATA[Litex SoC 2021-04-14 21:09:51]]></description>
|
||||
|
||||
<addressUnitBits>8</addressUnitBits>
|
||||
<width>32</width>
|
||||
|
|
@ -1070,10 +1070,10 @@ register to disable individual events.]]></description>
|
|||
<register>
|
||||
<name>GIT_GITREV</name>
|
||||
<description><![CDATA[First 32-bits of the git revision. This documentation was built from git rev
|
||||
``1a095da1``, so this value is 436821409, which should be enough to check out
|
||||
``d1096e6d``, so this value is 3507056237, which should be enough to check out
|
||||
the exact git version used to build this firmware.]]></description>
|
||||
<addressOffset>0x0014</addressOffset>
|
||||
<resetValue>0x1a095da1</resetValue>
|
||||
<resetValue>0xd1096e6d</resetValue>
|
||||
<size>32</size>
|
||||
<fields>
|
||||
<field>
|
||||
|
|
@ -1090,7 +1090,7 @@ the exact git version used to build this firmware.]]></description>
|
|||
is ``1``, then the repository this was built from has one additional commit
|
||||
beyond the tag indicated in `MAJOR`, `MINOR`, and `REVISION`.]]></description>
|
||||
<addressOffset>0x0018</addressOffset>
|
||||
<resetValue>0x13</resetValue>
|
||||
<resetValue>0x14</resetValue>
|
||||
<size>32</size>
|
||||
<fields>
|
||||
<field>
|
||||
|
|
@ -2803,7 +2803,7 @@ again until the interrupt is serviced.]]></description>
|
|||
<name>SEED1</name>
|
||||
<description><![CDATA[Bits 32-63 of `SEED_SEED`. Seed used for the build]]></description>
|
||||
<addressOffset>0x0000</addressOffset>
|
||||
<resetValue>0x9878c8f</resetValue>
|
||||
<resetValue>0x6d9ae7d0</resetValue>
|
||||
<size>32</size>
|
||||
<fields>
|
||||
<field>
|
||||
|
|
@ -2818,7 +2818,7 @@ again until the interrupt is serviced.]]></description>
|
|||
<name>SEED0</name>
|
||||
<description><![CDATA[Bits 0-31 of `SEED_SEED`.]]></description>
|
||||
<addressOffset>0x0004</addressOffset>
|
||||
<resetValue>0x8f844c5</resetValue>
|
||||
<resetValue>0x48864b41</resetValue>
|
||||
<size>32</size>
|
||||
<fields>
|
||||
<field>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ edition = "2018"
|
|||
description = "com_rs import package"
|
||||
|
||||
[dependencies]
|
||||
com_rs = { git = "https://github.com/betrusted-io/com_rs.git", rev = "885330c0a58fc5c3c9388628435dab24a0b61ab5" }
|
||||
com_rs = { git = "https://github.com/betrusted-io/com_rs.git", rev = "8dfa9ad067b41d0970da1578bb70b0869bc9a74f" }
|
||||
#com_rs = { path = "../../../betrusted-ec/sw/com_rs" }
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -93,6 +93,12 @@ pub(crate) enum Opcode {
|
|||
|
||||
/// request for a listener to BattStats events
|
||||
RegisterBattStatsListener, //String<64>
|
||||
|
||||
/// Reset the wifi chip
|
||||
Wf200Reset,
|
||||
|
||||
/// Disable the wifi chip
|
||||
Wf200Disable,
|
||||
}
|
||||
|
||||
/// These enums indicate what kind of callback type we're sending.
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ fn battstats_server(sid0: usize, sid1: usize, sid2: usize, sid3: usize) {
|
|||
pub struct Com {
|
||||
conn: CID,
|
||||
battstats_sid: Option<xous::SID>,
|
||||
ticktimer: ticktimer_server::Ticktimer,
|
||||
}
|
||||
impl Com {
|
||||
pub fn new(xns: &xous_names::XousNames) -> Result<Self, xous::Error> {
|
||||
|
|
@ -48,6 +49,7 @@ impl Com {
|
|||
Ok(Com {
|
||||
conn,
|
||||
battstats_sid: None,
|
||||
ticktimer: ticktimer_server::Ticktimer::new().expect("Can't connect to ticktimer"),
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -118,6 +120,17 @@ impl Com {
|
|||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn wifi_disable(&self) -> Result<(), xous::Error> {
|
||||
send_message(self.conn, Message::new_scalar(Opcode::Wf200Disable.to_usize().unwrap(), 0, 0, 0, 0,)).map(|_| ())
|
||||
}
|
||||
// as wifi_reset() re-initializes the wifi chip, call this after wifi_disable() to re-enable wifi
|
||||
pub fn wifi_reset(&self) -> Result<(), xous::Error> {
|
||||
send_message(self.conn, Message::new_scalar(Opcode::Wf200Reset.to_usize().unwrap(), 0, 0, 0, 0,)).expect("couldn't send reset opcode");
|
||||
self.ticktimer.sleep_ms(2000).expect("failed in waiting for wifi chip to reset");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// note to future self: add other event listener registrations (such as network events) here
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -359,6 +359,14 @@ fn xmain() -> ! {
|
|||
)
|
||||
.expect("couldn't return WF200 firmware rev");
|
||||
}
|
||||
Some(Opcode::Wf200Reset) => {
|
||||
com.txrx(ComState::WF200_RESET.verb);
|
||||
com.txrx(0);
|
||||
}
|
||||
Some(Opcode::Wf200Disable) => {
|
||||
com.txrx(ComState::WF200_RESET.verb);
|
||||
com.txrx(1);
|
||||
}
|
||||
None => {error!("unknown opcode"); break},
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ mod sleep; use sleep::*;
|
|||
mod sensors; use sensors::*;
|
||||
mod callback; use callback::*;
|
||||
mod rtc_cmd; use rtc_cmd::*;
|
||||
//mod fcc; use fcc::*;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct CmdEnv {
|
||||
|
|
@ -75,6 +76,7 @@ pub struct CmdEnv {
|
|||
sensors_cmd: Sensors,
|
||||
callback_cmd: CallBack,
|
||||
rtc_cmd: RtcCmd,
|
||||
//fcc_cmd: Fcc,
|
||||
}
|
||||
impl CmdEnv {
|
||||
pub fn new(xns: &xous_names::XousNames) -> CmdEnv {
|
||||
|
|
@ -93,6 +95,7 @@ impl CmdEnv {
|
|||
sensors_cmd: Sensors::new(),
|
||||
callback_cmd: CallBack::new(),
|
||||
rtc_cmd: RtcCmd::new(&xns),
|
||||
//fcc_cmd: Fcc::new(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -108,6 +111,7 @@ impl CmdEnv {
|
|||
&mut self.sensors_cmd,
|
||||
&mut self.callback_cmd,
|
||||
&mut self.rtc_cmd,
|
||||
//&mut self.fcc_cmd,
|
||||
];
|
||||
|
||||
if let Some(cmdline) = maybe_cmdline {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<device schemaVersion="1.1" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="CMSIS-SVD.xsd" >
|
||||
<vendor>litex</vendor>
|
||||
<name>SOC</name>
|
||||
<description><![CDATA[Litex SoC 2021-04-12 22:36:11]]></description>
|
||||
<description><![CDATA[Litex SoC 2021-04-14 21:09:51]]></description>
|
||||
|
||||
<addressUnitBits>8</addressUnitBits>
|
||||
<width>32</width>
|
||||
|
|
@ -1070,10 +1070,10 @@ register to disable individual events.]]></description>
|
|||
<register>
|
||||
<name>GIT_GITREV</name>
|
||||
<description><![CDATA[First 32-bits of the git revision. This documentation was built from git rev
|
||||
``1a095da1``, so this value is 436821409, which should be enough to check out
|
||||
``d1096e6d``, so this value is 3507056237, which should be enough to check out
|
||||
the exact git version used to build this firmware.]]></description>
|
||||
<addressOffset>0x0014</addressOffset>
|
||||
<resetValue>0x1a095da1</resetValue>
|
||||
<resetValue>0xd1096e6d</resetValue>
|
||||
<size>32</size>
|
||||
<fields>
|
||||
<field>
|
||||
|
|
@ -1090,7 +1090,7 @@ the exact git version used to build this firmware.]]></description>
|
|||
is ``1``, then the repository this was built from has one additional commit
|
||||
beyond the tag indicated in `MAJOR`, `MINOR`, and `REVISION`.]]></description>
|
||||
<addressOffset>0x0018</addressOffset>
|
||||
<resetValue>0x13</resetValue>
|
||||
<resetValue>0x14</resetValue>
|
||||
<size>32</size>
|
||||
<fields>
|
||||
<field>
|
||||
|
|
@ -2803,7 +2803,7 @@ again until the interrupt is serviced.]]></description>
|
|||
<name>SEED1</name>
|
||||
<description><![CDATA[Bits 32-63 of `SEED_SEED`. Seed used for the build]]></description>
|
||||
<addressOffset>0x0000</addressOffset>
|
||||
<resetValue>0x9878c8f</resetValue>
|
||||
<resetValue>0x6d9ae7d0</resetValue>
|
||||
<size>32</size>
|
||||
<fields>
|
||||
<field>
|
||||
|
|
@ -2818,7 +2818,7 @@ again until the interrupt is serviced.]]></description>
|
|||
<name>SEED0</name>
|
||||
<description><![CDATA[Bits 0-31 of `SEED_SEED`.]]></description>
|
||||
<addressOffset>0x0004</addressOffset>
|
||||
<resetValue>0x8f844c5</resetValue>
|
||||
<resetValue>0x48864b41</resetValue>
|
||||
<size>32</size>
|
||||
<fields>
|
||||
<field>
|
||||
|
|
|
|||
Loading…
Reference in a new issue