diff options
| -rw-r--r-- | host/lib/usrp/mpmd/mpmd_impl.cpp | 20 | ||||
| -rw-r--r-- | mpm/python/usrp_mpm/periph_manager/base.py | 32 | 
2 files changed, 49 insertions, 3 deletions
diff --git a/host/lib/usrp/mpmd/mpmd_impl.cpp b/host/lib/usrp/mpmd/mpmd_impl.cpp index 1d8b2b03b..2464a71cd 100644 --- a/host/lib/usrp/mpmd/mpmd_impl.cpp +++ b/host/lib/usrp/mpmd/mpmd_impl.cpp @@ -120,11 +120,25 @@ mpmd_impl::mpmd_impl(const device_addr_t& device_addr)      // TODO read this from the device info      _tree->create<std::string>("/name").set("MPMD - Series device"); +    const size_t mb_index = 0; +    const size_t num_xbars = _mb[mb_index]->rpc->call<size_t>("get_num_xbars"); +    UHD_ASSERT_THROW(num_xbars >= 1); +    if (num_xbars > 1) { +        UHD_LOG_WARNING("MPMD", "Only using first crossbar"); +    } +    const size_t xbar_index = 0; +    const size_t num_blocks = _mb[mb_index]->rpc->call<size_t>("get_num_blocks", xbar_index); +    const size_t base_port = _mb[mb_index]->rpc->call<size_t>("get_base_port", xbar_index); +    UHD_LOG_TRACE("MPMD", +        "Enumerating RFNoC blocks for xbar " << xbar_index << +        ". Total blocks: " << num_blocks << +        " Base port: " << base_port +    );      try {          enumerate_rfnoc_blocks( -          0, -          3, /* num blocks */ // TODO don't hardcode -          3, /* base port */  // TODO don't hardcode +          mb_index, +          num_blocks, +          base_port,            uhd::sid_t(0x0200), // TODO don't hardcode            device_addr          ); diff --git a/mpm/python/usrp_mpm/periph_manager/base.py b/mpm/python/usrp_mpm/periph_manager/base.py index e52a75fcb..031573551 100644 --- a/mpm/python/usrp_mpm/periph_manager/base.py +++ b/mpm/python/usrp_mpm/periph_manager/base.py @@ -26,6 +26,7 @@ from .udev import get_spidev_nodes  from usrp_mpm import net  from usrp_mpm import dtoverlay  from usrp_mpm import eeprom +from usrp_mpm.rpc_server import no_claim, no_rpc  def get_dboard_class_from_pid(pid):      """ @@ -368,3 +369,34 @@ class PeriphManagerBase(object):          """          raise NotImplementedError("_allocate_sid() not implented") +    @no_claim +    def get_num_xbars(self): +        """ +        Returns the number of crossbars instantiated in the current design +        """ +        return 1 # FIXME + +    @no_claim +    def get_num_blocks(self, xbar_index): +        """ +        Returns the number of blocks connected to crossbar with index +        xbar_index. + +        xbar_index -- The index of the crossbar that's being queried. +        docstring for get_num_blocks""" +        # FIXME +        return int(open('/sys/class/rfnoc_crossbar/crossbar0/nports').read().strip()) - 3 + +    @no_claim +    def get_base_port(self, xbar_index): +        """ +        Returns the index of the first port which is connected to an RFNoC +        block. Example: Assume there are two SFPs connected to the crossbar, and +        one DMA engine for CHDR traffic. The convention would be to connect +        those to ports 0, 1, and 2, respectively. This makes port 3 the first +        block to be connected to an RFNoC block. + +        xbar_index -- The index of the crossbar that's being queried +        """ +        return 3 # FIXME This is the same 3 as in get_num_blocks +  | 
