From 9b2b1dadaad9a6fe7eb40873d9a76658dec36267 Mon Sep 17 00:00:00 2001 From: mwojcik Date: Thu, 26 Aug 2021 15:20:33 +0200 Subject: [PATCH] satman: repeater fixes, missing code --- src/satman/repeater.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/satman/repeater.rs b/src/satman/repeater.rs index ef9145c..33e65e8 100644 --- a/src/satman/repeater.rs +++ b/src/satman/repeater.rs @@ -5,6 +5,8 @@ use libboard_artiq::{pl::csr}; use libboard_zynq::time::Milliseconds; use libboard_zynq::timer::GlobalTimer; +use embedded_hal::prelude::_embedded_hal_blocking_delay_DelayUs; + #[cfg(has_drtio_routing)] fn rep_link_rx_up(repno: u8) -> bool { let repno = repno as usize; @@ -84,12 +86,12 @@ impl Repeater { self.state = RepeaterState::Failed; return; } - if let Err(e) = self.load_routing_table(routing_table) { + if let Err(e) = self.load_routing_table(routing_table, timer) { error!("[REP#{}] failed to load routing table ({})", self.repno, e); self.state = RepeaterState::Failed; return; } - if let Err(e) = self.set_rank(rank + 1) { + if let Err(e) = self.set_rank(rank + 1, timer) { error!("[REP#{}] failed to set rank ({})", self.repno, e); self.state = RepeaterState::Failed; return; @@ -167,7 +169,7 @@ impl Repeater { } fn recv_aux_timeout(&self, timeout: u32, timer: GlobalTimer) -> Result> { - let max_time = timer.get_time() + timeout as u64; + let max_time = timer.get_time() + Milliseconds(timeout); loop { if !rep_link_rx_up(self.repno) { return Err(drtioaux::Error::LinkDown); @@ -230,9 +232,9 @@ impl Repeater { Ok(()) } - pub fn load_routing_table(&self, routing_table: &drtio_routing::RoutingTable) -> Result<(), drtioaux::Error> { + pub fn load_routing_table(&self, routing_table: &drtio_routing::RoutingTable, timer: GlobalTimer) -> Result<(), drtioaux::Error> { for i in 0..drtio_routing::DEST_COUNT { - self.set_path(i as u8, &routing_table.0[i])?; + self.set_path(i as u8, &routing_table.0[i], timer)?; } Ok(()) }