forked from M-Labs/artiq
1
0
Fork 0

satman: forward RTIO resets

This commit is contained in:
Sebastien Bourdeauducq 2018-09-12 23:02:54 +08:00
parent 5a9cc004f2
commit 6cf3db3485
2 changed files with 20 additions and 0 deletions

View File

@ -55,6 +55,7 @@ fn process_aux_packet(_repeaters: &mut [repeater::Repeater],
drtioaux::Packet::EchoRequest =>
drtioaux::send_link(0, &drtioaux::Packet::EchoReply),
drtioaux::Packet::ResetRequest { phy } => {
info!("resetting RTIO");
if phy {
drtiosat_reset_phy(true);
drtiosat_reset_phy(false);
@ -62,6 +63,11 @@ fn process_aux_packet(_repeaters: &mut [repeater::Repeater],
drtiosat_reset(true);
drtiosat_reset(false);
}
for rep in _repeaters.iter() {
if let Err(e) = rep.rtio_reset(phy) {
error!("failed to issue RTIO reset ({})", e);
}
}
drtioaux::send_link(0, &drtioaux::Packet::ResetAck)
},

View File

@ -227,6 +227,20 @@ impl Repeater {
}
Ok(())
}
pub fn rtio_reset(&self, phy: bool) -> Result<(), &'static str> {
if self.state != RepeaterState::Up {
return Ok(());
}
drtioaux::send_link(self.auxno, &drtioaux::Packet::ResetRequest {
phy: phy
}).unwrap();
let reply = self.recv_aux_timeout(200)?;
if reply != drtioaux::Packet::ResetAck {
return Err("unexpected reply");
}
Ok(())
}
}
#[cfg(not(has_drtio_routing))]