mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-16 08:38:26 +00:00
Sync the EC to the SOC on boot
Always reset the EC on boot. If we have a cold-boot situation, it's hard to know what state the EC is in versus our stack; a hard reset on the EC guarantees we at least always start from the same point. Note that on suspend/resume, there is no reset - the EC continues trundling onwards, but the system was designed for this.
This commit is contained in:
parent
fbd0bc542f
commit
77f4356620
2 changed files with 14 additions and 3 deletions
|
|
@ -90,13 +90,21 @@ fn xmain() -> ! {
|
|||
let net_conn = xous::connect(net_sid).unwrap();
|
||||
log::trace!("registered with NS -- {:?}", net_sid);
|
||||
|
||||
// hook the COM interrupt listener
|
||||
// bring the EC into a sane state for the network -- that is, reset the EC
|
||||
let mut llio = llio::Llio::new(&xns);
|
||||
let com = com::Com::new(&xns).unwrap();
|
||||
let timer = ticktimer_server::Ticktimer::new().unwrap();
|
||||
|
||||
llio.ec_reset().unwrap();
|
||||
timer.sleep_ms(3500).unwrap();
|
||||
com.link_reset().unwrap();
|
||||
com.reseed_ec_trng().unwrap();
|
||||
|
||||
// hook the COM interrupt listener
|
||||
let net_cid = xous::connect(net_sid).unwrap();
|
||||
llio.hook_com_event_callback(Opcode::ComInterrupt.to_u32().unwrap(), net_cid).unwrap();
|
||||
llio.com_event_enable(true).unwrap();
|
||||
// setup the interrupt masks
|
||||
let com = com::Com::new(&xns).unwrap();
|
||||
let mut com_int_list: Vec::<ComIntSources> = vec![];
|
||||
com.ints_get_active(&mut com_int_list);
|
||||
log::debug!("COM initial pending interrupts: {:?}", com_int_list);
|
||||
|
|
@ -150,7 +158,6 @@ fn xmain() -> ! {
|
|||
let mut udp_clones = HashMap::<u16, HashMap::<[u32; 4], CID>>::new(); // additional clones for UDP responders
|
||||
|
||||
// other link storage
|
||||
let timer = ticktimer_server::Ticktimer::new().unwrap();
|
||||
let neighbor_cache = NeighborCache::new(BTreeMap::new());
|
||||
let ip_addrs = [IpCidr::new(Ipv4Address::UNSPECIFIED.into(), 0)];
|
||||
let routes = Routes::new(BTreeMap::new());
|
||||
|
|
|
|||
|
|
@ -202,6 +202,10 @@ fn xmain() -> ! {
|
|||
)
|
||||
.expect("|status: Can't draw border line");
|
||||
|
||||
// the EC gets reset by the Net crate on boot to ensure that the state machines are synced up
|
||||
// this takes a few seconds, so we have a dead-wait here. This is a good spot for it because
|
||||
// the status bar reads "booting up..." during this period.
|
||||
ticktimer.sleep_ms(4000).unwrap();
|
||||
com.hook_batt_stats(battstats_cb)
|
||||
.expect("|status: couldn't hook callback for events from COM");
|
||||
// prime the loop
|
||||
|
|
|
|||
Loading…
Reference in a new issue