From 9c2e1907e96d708f71de92faa7a1501d236baf8d Mon Sep 17 00:00:00 2001
From: Brent Stapleton <brent.stapleton@ettus.com>
Date: Mon, 2 Jul 2018 17:13:33 -0700
Subject: mpm: n3xx: Overridable crossbar base port

Moving the RFNoC crossbar base port to the class overridables. MPM
devices may need to reserve different numbers of ports for non-blocks;
this can now be done by overriding the crossbar_base_port.
---
 mpm/python/usrp_mpm/periph_manager/base.py | 5 ++++-
 mpm/python/usrp_mpm/periph_manager/n3xx.py | 1 +
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/mpm/python/usrp_mpm/periph_manager/base.py b/mpm/python/usrp_mpm/periph_manager/base.py
index d1f2c9f92..f920c9387 100644
--- a/mpm/python/usrp_mpm/periph_manager/base.py
+++ b/mpm/python/usrp_mpm/periph_manager/base.py
@@ -95,6 +95,9 @@ class PeriphManagerBase(object):
     # depending on the severity of the issue. If fewer dboards are found,
     # that's generally considered OK.
     max_num_dboards = 2
+    # The index of the first port of the RFNoC crossbar which is connected to
+    # an RFNoC block
+    crossbar_base_port = 0
     # Address of the daughterboard EEPROMs. This could be something like
     # "e0004000.i2c". This value will be passed to get_eeprom_paths() to
     # determine a full path to an EEPROM device.
@@ -670,7 +673,7 @@ class PeriphManagerBase(object):
 
         xbar_index -- The index of the crossbar that's being queried
         """
-        return 3 # FIXME It's 3 because 0,1,2 are SFP,SFP,DMA
+        return self.crossbar_base_port
 
     def set_xbar_local_addr(self, xbar_index, local_addr):
         """
diff --git a/mpm/python/usrp_mpm/periph_manager/n3xx.py b/mpm/python/usrp_mpm/periph_manager/n3xx.py
index c09a1a7ff..a90e39b27 100644
--- a/mpm/python/usrp_mpm/periph_manager/n3xx.py
+++ b/mpm/python/usrp_mpm/periph_manager/n3xx.py
@@ -125,6 +125,7 @@ class n3xx(PeriphManagerBase):
         'temp': 'get_temp_sensor',
         'fan': 'get_fan_sensor',
     }
+    crossbar_base_port = 3  # It's 3 because 0,1,2 are SFP,SFP,DMA
     dboard_eeprom_addr = "e0004000.i2c"
     dboard_eeprom_offset = 0
     dboard_eeprom_max_len = 64
-- 
cgit v1.2.3