From b8acf58798018f5fb4d84d470badadce5dd3a08d Mon Sep 17 00:00:00 2001 From: mattprost Date: Thu, 16 Dec 2021 13:48:26 -0600 Subject: n310: Add Filter API to n310 Add the Filter API to n3xx specifically for the AD937x device. The TX filter is limited to 32 taps, and the RX filter is limited to 48 taps. This feature requires MPM version 4.2 or later on the device. Co-authored-by: bpadalino Signed-off-by: mattprost --- host/lib/usrp/multi_usrp_rfnoc.cpp | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) (limited to 'host/lib/usrp/multi_usrp_rfnoc.cpp') diff --git a/host/lib/usrp/multi_usrp_rfnoc.cpp b/host/lib/usrp/multi_usrp_rfnoc.cpp index 00e386b71..270e86ca4 100644 --- a/host/lib/usrp/multi_usrp_rfnoc.cpp +++ b/host/lib/usrp/multi_usrp_rfnoc.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -2229,11 +2230,13 @@ public: const std::string& name, const size_t chan) override { try { + // Get the blockid and filtername separated from the name string + const auto names = string::split(name, ":"); + const auto& blockid = names.first; + const auto& filter_name = names.second; // The block_id_t constructor is pretty smart; let it handle the parsing. - block_id_t block_id(name); - auto rx_chan = _get_rx_chan(chan); - // The filter name is the `name` after the BLOCK_ID and a `:` - std::string filter_name = name.substr(block_id.to_string().size() + 1); + block_id_t block_id(blockid); + const auto rx_chan = _get_rx_chan(chan); // Try to dynamic cast either the radio or the DDC to a filter_node, and call // its filter function auto block_ctrl = [rx_chan, block_id, chan]() -> noc_block_base::sptr { @@ -2270,11 +2273,12 @@ public: { MUX_RX_API_CALL(set_rx_filter, name, filter); try { + const auto names = string::split(name, ":"); + const auto& blockid = names.first; + const auto& filter_name = names.second; // The block_id_t constructor is pretty smart; let it handle the parsing. - block_id_t block_id(name); - auto rx_chan = _get_rx_chan(chan); - // The filter name is the `name` after the BLOCK_ID and a `:` - std::string filter_name = name.substr(block_id.to_string().size() + 1); + block_id_t block_id(blockid); + const auto rx_chan = _get_rx_chan(chan); // Try to dynamic cast either the radio or the DDC to a filter_node, and call // its filter function auto block_ctrl = [rx_chan, block_id, chan]() -> noc_block_base::sptr { @@ -2352,11 +2356,12 @@ public: const std::string& name, const size_t chan) override { try { + const auto names = string::split(name, ":"); + const auto& blockid = names.first; + const auto& filter_name = names.second; // The block_id_t constructor is pretty smart; let it handle the parsing. - block_id_t block_id(name); - auto tx_chan = _get_tx_chan(chan); - // The filter name is the `name` after the BLOCK_ID and a `:` - std::string filter_name = name.substr(block_id.to_string().size() + 1); + block_id_t block_id(blockid); + const auto tx_chan = _get_tx_chan(chan); // Try to dynamic cast either the radio or the DUC to a filter_node, and call // its filter function auto block_ctrl = [tx_chan, block_id, chan]() -> noc_block_base::sptr { @@ -2393,11 +2398,12 @@ public: { MUX_TX_API_CALL(set_tx_filter, name, filter); try { + const auto names = string::split(name, ":"); + const auto& blockid = names.first; + const auto& filter_name = names.second; // The block_id_t constructor is pretty smart; let it handle the parsing. - block_id_t block_id(name); - auto tx_chan = _get_tx_chan(chan); - // The filter name is the `name` after the BLOCK_ID and a `:` - std::string filter_name = name.substr(block_id.to_string().size() + 1); + block_id_t block_id(blockid); + const auto tx_chan = _get_tx_chan(chan); // Try to dynamic cast either the radio or the DUC to a filter_node, and call // its filter function auto block_ctrl = [tx_chan, block_id, chan]() -> noc_block_base::sptr { -- cgit v1.2.3