Soft panic for RTIO PLL reasons #199

Merged
sb10q merged 16 commits from mwojcik/artiq-zynq:pll_error into master 2022-10-21 17:56:34 +08:00
Showing only changes of commit 93bd962f9b - Show all commits

View File

@ -1,6 +1,7 @@
use log::{info, warn, error};
use libboard_zynq::timer::GlobalTimer;
use embedded_hal::blocking::delay::DelayMs;
use libasync::task;
use libconfig::Config;
use libboard_artiq::pl;
#[cfg(has_si5324)]
@ -9,6 +10,7 @@ use libboard_zynq::i2c::I2c;
use crate::i2c;
#[cfg(has_si5324)]
use libboard_artiq::si5324;
use crate::mgmt;
#[derive(Debug, PartialEq, Copy, Clone)]
#[allow(non_camel_case_types)]
@ -98,7 +100,10 @@ fn init_rtio(timer: &mut GlobalTimer, _clk: RtioClock) {
error!("RTIO PLL failed to lock");
#[cfg(feature = "target_kasli_soc")]
{
pl::csr::error_led::out_write(1);
unsafe {
pl::csr::error_led::out_write(1);
}
soft_panic();
// try "soft" panic
}
}
@ -256,4 +261,17 @@ pub fn init(timer: &mut GlobalTimer, cfg: &Config) {
init_rtio(timer, clk);
}
#[cfg(feature = "target_kasli_soc")]
fn soft_panic() {
// start mgmt service but nothing else
let cfg = match Config::new() {
Ok(cfg) => cfg,
Err(_) => Config::new_dummy()
};
mgmt::start(cfg);
loop {
task::block_on(task::r#yield());
}
}