From 30ecc840c98c8c6e3ae1f9e36a9adff0d9e0414f Mon Sep 17 00:00:00 2001 From: Sugandha Gupta Date: Mon, 25 Jun 2018 21:09:50 -0700 Subject: legacy_compat: Fix tx/rx channel map initialization for all channels This will populate tx/rx channel map (radio and port index) considering number of channels, radios and mboards. On TwinRX and N310, the default subdev spec will now include all available channels. --- host/lib/rfnoc/legacy_compat.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'host/lib/rfnoc') diff --git a/host/lib/rfnoc/legacy_compat.cpp b/host/lib/rfnoc/legacy_compat.cpp index 47eaf8c67..3c3a0a26f 100644 --- a/host/lib/rfnoc/legacy_compat.cpp +++ b/host/lib/rfnoc/legacy_compat.cpp @@ -135,8 +135,8 @@ public: : num_ports(_tree, RADIO_BLOCK_NAME, "out")), _rx_spp(get_block_ctrl(0, RADIO_BLOCK_NAME, 0)->get_arg("spp")), _tx_spp(_rx_spp), - _rx_channel_map(_num_mboards, std::vector(_num_radios_per_board)), - _tx_channel_map(_num_mboards, std::vector(_num_radios_per_board)) + _rx_channel_map(_num_mboards, std::vector()), + _tx_channel_map(_num_mboards, std::vector()) { _device->clear(); check_available_periphs(); // Throws if invalid configuration. @@ -166,11 +166,20 @@ public: if (not _has_dmafifo and not _has_sramfifo) { UHD_LOGGER_WARNING("RFNOC") << "[legacy_compat] No FIFO detected. Higher transmit rates may encounter errors."; } - for (size_t mboard = 0; mboard < _num_mboards; mboard++) { for (size_t radio = 0; radio < _num_radios_per_board; radio++) { - _rx_channel_map[mboard][radio].radio_index = radio; - _tx_channel_map[mboard][radio].radio_index = radio; + auto radio_block_ctrl = get_block_ctrl(mboard, "Radio", radio); + for (size_t port = 0; port < _num_rx_chans_per_radio; port++) { + if (!radio_block_ctrl->get_dboard_fe_from_chan(port, uhd::RX_DIRECTION).empty()) { + _rx_channel_map[mboard].push_back({radio, port}); + } + } + for (size_t port = 0; port < _num_tx_chans_per_radio; port++) { + size_t chan = radio * _num_tx_chans_per_radio + port; + if (!radio_block_ctrl->get_dboard_fe_from_chan(port, uhd::TX_DIRECTION).empty()) { + _tx_channel_map[mboard].push_back({radio, port}); + } + } } const double tick_rate = _tree->access(mb_root(mboard) / "tick_rate").get(); -- cgit v1.2.3