diff options
Diffstat (limited to 'host/lib/usrp')
-rw-r--r-- | host/lib/usrp/multi_usrp.cpp | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/host/lib/usrp/multi_usrp.cpp b/host/lib/usrp/multi_usrp.cpp index 57f7cc8f6..636940f53 100644 --- a/host/lib/usrp/multi_usrp.cpp +++ b/host/lib/usrp/multi_usrp.cpp @@ -1272,6 +1272,42 @@ public: } } + void set_rx_gain_profile(const std::string& profile, const size_t chan){ + if (chan != ALL_CHANS) { + if (_tree->exists(rx_rf_fe_root(chan) / "gains/all/profile/value")) { + _tree->access<std::string>(rx_rf_fe_root(chan) / "gains/all/profile/value").set(profile); + } + } else { + for (size_t c = 0; c < get_rx_num_channels(); c++){ + if (_tree->exists(rx_rf_fe_root(c) / "gains/all/profile/value")) { + _tree->access<std::string>(rx_rf_fe_root(chan) / "gains/all/profile/value").set(profile); + } + } + } + } + + std::string get_rx_gain_profile(const size_t chan){ + if (chan != ALL_CHANS) { + if (_tree->exists(rx_rf_fe_root(chan) / "gains/all/profile/value")) { + return _tree->access<std::string>(rx_rf_fe_root(chan) / "gains/all/profile/value").get(); + } + } else { + UHD_LOG_ERROR("MULTI_USRP", "Can't get rx gain profile from all channels at once. Ignoring this operation") + return ""; + } + } + + std::vector<std::string> get_rx_gain_profile_names(const size_t chan){ + if (chan != ALL_CHANS) { + if (_tree->exists(rx_rf_fe_root(chan) / "gains/all/profile/options")) { + return _tree->access<std::vector<std::string>>(rx_rf_fe_root(chan) / "gains/all/profile/options").get(); + } + } else { + UHD_LOG_ERROR("MULTI_USRP", "Can't get rx gain profile from all channels at once. Ignoring this operation") + return std::vector<std::string>(); + } + } + void set_normalized_rx_gain(double gain, size_t chan = 0) { if (gain > 1.0 || gain < 0.0) { @@ -1631,6 +1667,42 @@ public: } } + void set_tx_gain_profile(const std::string& profile, const size_t chan){ + if (chan != ALL_CHANS) { + if (_tree->exists(tx_rf_fe_root(chan) / "gains/all/profile/value")) { + _tree->access<std::string>(tx_rf_fe_root(chan) / "gains/all/profile/value").set(profile); + } + } else { + for (size_t c = 0; c < get_tx_num_channels(); c++){ + if (_tree->exists(tx_rf_fe_root(c) / "gains/all/profile/value")) { + _tree->access<std::string>(tx_rf_fe_root(chan) / "gains/all/profile/value").set(profile); + } + } + } + } + + std::string get_tx_gain_profile(const size_t chan){ + if (chan != ALL_CHANS) { + if (_tree->exists(tx_rf_fe_root(chan) / "gains/all/profile/value")) { + return _tree->access<std::string>(tx_rf_fe_root(chan) / "gains/all/profile/value").get(); + } + } else { + UHD_LOG_ERROR("MULTI_USRP", "Can't get tx gain profile from all channels at once. Ignoring this operation") + return ""; + } + } + + std::vector<std::string> get_tx_gain_profile_names(const size_t chan){ + if (chan != ALL_CHANS) { + if (_tree->exists(tx_rf_fe_root(chan) / "gains/all/profile/options")) { + return _tree->access<std::vector<std::string>>(tx_rf_fe_root(chan) / "gains/all/profile/options").get(); + } + } else { + UHD_LOG_ERROR("MULTI_USRP", "Can't get tx gain profile from all channels at once. Ignoring this operation") + return std::vector<std::string>(); + } + } + void set_normalized_tx_gain(double gain, size_t chan = 0) { if (gain > 1.0 || gain < 0.0) { |