rtio_clocking: added si5324 bypass

This commit is contained in:
mwojcik 2021-10-25 14:16:32 +08:00
parent 61442b3775
commit c94582ccbe
1 changed files with 10 additions and 3 deletions

View File

@ -35,6 +35,7 @@ fn get_rtio_clock_cfg(cfg: &Config) -> RtioClock {
}
}
else {
info!("error reading configuration. Using default internal 125MHz clock");
RtioClock::Int_125
}
}
@ -105,16 +106,22 @@ fn setup_si5324(timer: &mut GlobalTimer, clk: RtioClock) {
crystal_ref: true
});
}
let si5324_ref_input = si5324::Input::Ckin2;
si5324::setup(unsafe { (&mut i2c::I2C_BUS).as_mut().unwrap() },
&si5324_settings.unwrap(), si5324::Input::Ckin2, timer).expect("cannot initialize Si5324");
&si5324_settings.unwrap(), si5324_ref_input, timer).expect("cannot initialize Si5324");
}
pub fn init(timer: &mut GlobalTimer, cfg: &Config) {
let clk = get_rtio_clock_cfg(cfg);
#[cfg(has_si5324)]
setup_si5324(timer, clk);
{
let si5324_ext_input = si5324::Input::Ckin2;
match clk {
RtioClock::Ext0_Bypass => si5324::bypass(si5324_ext_input).expect("cannot bypass Si5324"),
_ => setup_si5324(timer, clk),
}
}
#[cfg(has_drtio)]
init_drtio(timer);