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
1 changed files with 9 additions and 3 deletions

View File

@ -672,15 +672,21 @@ fn dac_cfg(dacno: u8) -> Result<(), &'static str> {
} }
fn dac_cfg_retry(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); dac_reset(dacno);
let outcome = dac_cfg(dacno); let outcome = dac_cfg(dacno);
match outcome { match outcome {
Ok(_) => return 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) { fn dac_sysref_scan(dacno: u8) {