2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-28 12:48:26 +08:00

firmware: reduce number of DAC initialization attempts

Faster startup when one DAC is broken.
This commit is contained in:
Sebastien Bourdeauducq 2018-06-19 19:10:23 +08:00
parent 1d594d0c97
commit eb3259b847

View File

@ -672,15 +672,21 @@ fn dac_cfg(dacno: u8) -> Result<(), &'static str> {
}
fn dac_cfg_retry(dacno: u8) -> Result<(), &'static str> {
for i in 0..99 {
let mut attempt = 0;
loop {
attempt += 1;
dac_reset(dacno);
let outcome = dac_cfg(dacno);
match outcome {
Ok(_) => return outcome,
Err(e) => warn!("AD9154-{} config attempt #{} failed ({}), retrying", dacno, i, e)
Err(e) => {
warn!("AD9154-{} config attempt #{} failed ({})", dacno, attempt, e);
if attempt >= 10 {
return outcome;
}
}
}
}
dac_cfg(dacno)
}
fn dac_sysref_scan(dacno: u8) {