From 31bef9918e4cd962b61171c5540f040bca7d76a3 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Mon, 10 Sep 2018 20:16:42 +0800 Subject: [PATCH] firmware: fix drtio_routing compatibility with master and satellite --- artiq/firmware/libboard_artiq/drtio_routing.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/artiq/firmware/libboard_artiq/drtio_routing.rs b/artiq/firmware/libboard_artiq/drtio_routing.rs index 810043297..f5b7c735c 100644 --- a/artiq/firmware/libboard_artiq/drtio_routing.rs +++ b/artiq/firmware/libboard_artiq/drtio_routing.rs @@ -8,12 +8,12 @@ pub struct RoutingTable([[u8; MAX_HOPS]; DEST_COUNT]); impl RoutingTable { // default routing table is for star topology with no hops - fn default_master() -> RoutingTable { + fn default_master(default_n_links: usize) -> RoutingTable { let mut ret = RoutingTable([[INVALID_HOP; MAX_HOPS]; DEST_COUNT]); - for i in 0..csr::DRTIO.len() { + for i in 0..default_n_links { ret.0[i][0] = i as u8; } - for i in 1..csr::DRTIO.len() { + for i in 1..default_n_links { ret.0[i][1] = 0x00; } ret @@ -26,8 +26,8 @@ impl RoutingTable { } } -pub fn config_routing_table() -> RoutingTable { - let mut ret = RoutingTable::default_master(); +pub fn config_routing_table(default_n_links: usize) -> RoutingTable { + let mut ret = RoutingTable::default_master(default_n_links); let ok = config::read("routing_table", |result| { if let Ok(data) = result { if data.len() == DEST_COUNT*MAX_HOPS {