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
1 changed files with 19 additions and 1 deletions
Showing only changes of commit 93bd962f9b - Show all commits

View File

@ -1,6 +1,7 @@
use log::{info, warn, error}; use log::{info, warn, error};
use libboard_zynq::timer::GlobalTimer; use libboard_zynq::timer::GlobalTimer;
use embedded_hal::blocking::delay::DelayMs; use embedded_hal::blocking::delay::DelayMs;
use libasync::task;
use libconfig::Config; use libconfig::Config;
use libboard_artiq::pl; use libboard_artiq::pl;
#[cfg(has_si5324)] #[cfg(has_si5324)]
@ -9,6 +10,7 @@ use libboard_zynq::i2c::I2c;
use crate::i2c; use crate::i2c;
#[cfg(has_si5324)] #[cfg(has_si5324)]
use libboard_artiq::si5324; use libboard_artiq::si5324;
use crate::mgmt;
#[derive(Debug, PartialEq, Copy, Clone)] #[derive(Debug, PartialEq, Copy, Clone)]
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
@ -98,7 +100,10 @@ fn init_rtio(timer: &mut GlobalTimer, _clk: RtioClock) {
error!("RTIO PLL failed to lock"); error!("RTIO PLL failed to lock");
#[cfg(feature = "target_kasli_soc")] #[cfg(feature = "target_kasli_soc")]
{ {
unsafe {
pl::csr::error_led::out_write(1); pl::csr::error_led::out_write(1);
}
soft_panic();
// try "soft" panic // try "soft" panic
} }
} }
@ -257,3 +262,16 @@ pub fn init(timer: &mut GlobalTimer, cfg: &Config) {
init_rtio(timer, clk); 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());
}
}