2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-25 03:08:27 +08:00

ad9154: retry initialization (#727)

This commit is contained in:
Sebastien Bourdeauducq 2017-12-31 11:27:43 +08:00
parent 6e0288e568
commit a897d82324

View File

@ -473,6 +473,17 @@ fn dac_cfg(dacno: u8) -> Result<(), &'static str> {
Ok(())
}
fn dac_cfg_retry(dacno: u8) -> Result<(), &'static str> {
for i in 0..99 {
let outcome = dac_cfg(dacno);
match outcome {
Ok(_) => return outcome,
Err(e) => warn!("AD9154-{} config attempt #{} failed ({}), retrying", dacno, i, e)
}
}
dac_cfg(dacno)
}
pub fn init() -> Result<(), &'static str> {
// Release the JESD clock domain reset late, as we need to
// set up clock chips before.
@ -481,7 +492,7 @@ pub fn init() -> Result<(), &'static str> {
for dacno in 0..csr::AD9154.len() {
let dacno = dacno as u8;
debug!("setting up AD9154-{} DAC...", dacno);
dac_cfg(dacno)?;
dac_cfg_retry(dacno)?;
}
Ok(())
}