diff options
author | Martin Braun <martin.braun@ettus.com> | 2020-02-19 12:38:30 -0800 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2020-04-17 07:59:50 -0500 |
commit | a63682f981c3d4b828b5454a7d4849d181b9c8b3 (patch) | |
tree | 738f00e989da67eb89aee3978d05c6615be20cc7 /host/lib/usrp/multi_usrp.cpp | |
parent | 1a19bc653ee499545addb2a8718d12069bfd6fcd (diff) | |
download | uhd-a63682f981c3d4b828b5454a7d4849d181b9c8b3.tar.gz uhd-a63682f981c3d4b828b5454a7d4849d181b9c8b3.tar.bz2 uhd-a63682f981c3d4b828b5454a7d4849d181b9c8b3.zip |
uhd: Add reference power level API to multi_usrp and radio_control
This adds the following API calls:
- multi_usrp::has_{rx,tx}_power_reference()
- multi_usrp::set_{rx,tx}_power_reference()
- multi_usrp::get_{rx,tx}_power_reference()
- radio_control::has_{rx,tx}_power_reference()
- radio_control::set_{rx,tx}_power_reference()
- radio_control::get_{rx,tx}_power_reference()
It also adds a manual page explaining the philosophy of the API.
Note that this does not actually add this feature to any device
implementation. Calling the new API calls will thus result in
`uhd::not_implemented_error` exceptions being thrown. This commit is to
lock down the API and ABI.
Diffstat (limited to 'host/lib/usrp/multi_usrp.cpp')
-rw-r--r-- | host/lib/usrp/multi_usrp.cpp | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/host/lib/usrp/multi_usrp.cpp b/host/lib/usrp/multi_usrp.cpp index c91f596cd..0392d4df9 100644 --- a/host/lib/usrp/multi_usrp.cpp +++ b/host/lib/usrp/multi_usrp.cpp @@ -1718,6 +1718,34 @@ public: return rx_gain_group(chan)->get_names(); } + /************************************************************************** + * RX Power control + *************************************************************************/ + bool has_rx_power_reference(const size_t chan) + { + return _tree->exists(rx_rf_fe_root(chan) / "ref_power/value"); + } + + void set_rx_power_reference(const double power_dbm, const size_t chan = 0) + { + const auto power_ref_path = rx_rf_fe_root(chan) / "ref_power/value"; + if (!_tree->exists(power_ref_path)) { + throw uhd::not_implemented_error( + "set_rx_power_reference() not available for this device and channel"); + } + _tree->access<double>(power_ref_path).set(power_dbm); + } + + double get_rx_power_reference(const size_t chan = 0) + { + const auto power_ref_path = rx_rf_fe_root(chan) / "ref_power/value"; + if (!_tree->exists(power_ref_path)) { + throw uhd::not_implemented_error( + "get_rx_power_reference() not available for this device and channel"); + } + return _tree->access<double>(power_ref_path).get(); + } + void set_rx_antenna(const std::string& ant, size_t chan) { _tree->access<std::string>(rx_rf_fe_root(chan) / "antenna" / "value").set(ant); @@ -2194,6 +2222,34 @@ public: return tx_gain_group(chan)->get_names(); } + /************************************************************************** + * TX Power Controls + *************************************************************************/ + bool has_tx_power_reference(const size_t chan) + { + return _tree->exists(tx_rf_fe_root(chan) / "ref_power/value"); + } + + void set_tx_power_reference(const double power_dbm, const size_t chan = 0) + { + const auto power_ref_path = tx_rf_fe_root(chan) / "ref_power/value"; + if (!_tree->exists(power_ref_path)) { + throw uhd::not_implemented_error( + "set_tx_power_reference() not available for this device and channel"); + } + _tree->access<double>(power_ref_path).set(power_dbm); + } + + double get_tx_power_reference(const size_t chan = 0) + { + const auto power_ref_path = tx_rf_fe_root(chan) / "ref_power/value"; + if (!_tree->exists(power_ref_path)) { + throw uhd::not_implemented_error( + "get_tx_power_reference() not available for this device and channel"); + } + return _tree->access<double>(power_ref_path).get(); + } + void set_tx_antenna(const std::string& ant, size_t chan) { _tree->access<std::string>(tx_rf_fe_root(chan) / "antenna" / "value").set(ant); |