diff options
author | Lane Kolbly <lane.kolbly@ni.com> | 2020-06-18 17:46:06 -0500 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2021-01-11 12:26:00 -0600 |
commit | 12673d9290319d2453fedd806ddf248d3d5586e3 (patch) | |
tree | 811016297552c5358129aecb5953a0c143229e86 /host/lib/usrp/dboard/magnesium/magnesium_radio_control.cpp | |
parent | c9b35e3b7107ab82c0e3978b7cbfd76ba98e2407 (diff) | |
download | uhd-12673d9290319d2453fedd806ddf248d3d5586e3.tar.gz uhd-12673d9290319d2453fedd806ddf248d3d5586e3.tar.bz2 uhd-12673d9290319d2453fedd806ddf248d3d5586e3.zip |
uhd: Split radio_control into rf_control interfaces
These rf_control interfaces allow easier implementation of
radio controls as well as allowing easier sharing of code
for implementing e.g. gain_profile.
Diffstat (limited to 'host/lib/usrp/dboard/magnesium/magnesium_radio_control.cpp')
-rw-r--r-- | host/lib/usrp/dboard/magnesium/magnesium_radio_control.cpp | 48 |
1 files changed, 4 insertions, 44 deletions
diff --git a/host/lib/usrp/dboard/magnesium/magnesium_radio_control.cpp b/host/lib/usrp/dboard/magnesium/magnesium_radio_control.cpp index 5eb0f63a5..879885640 100644 --- a/host/lib/usrp/dboard/magnesium/magnesium_radio_control.cpp +++ b/host/lib/usrp/dboard/magnesium/magnesium_radio_control.cpp @@ -103,6 +103,10 @@ magnesium_radio_control_impl::magnesium_radio_control_impl(make_args_ptr make_ar { RFNOC_LOG_TRACE("Entering magnesium_radio_control_impl ctor..."); UHD_ASSERT_THROW(get_block_id().get_block_count() < 2); + + _tx_gain_profile_api = std::make_shared<rf_control::enumerated_gain_profile>(MAGNESIUM_GP_OPTIONS, "default", MAGNESIUM_NUM_CHANS); + _rx_gain_profile_api = std::make_shared<rf_control::enumerated_gain_profile>(MAGNESIUM_GP_OPTIONS, "default", MAGNESIUM_NUM_CHANS); + const char radio_slot_name[2] = {'A', 'B'}; _radio_slot = radio_slot_name[get_block_id().get_block_count()]; RFNOC_LOG_TRACE("Radio slot: " << _radio_slot); @@ -363,28 +367,6 @@ double magnesium_radio_control_impl::set_tx_bandwidth( return AD9371_TX_MAX_BANDWIDTH; } -void magnesium_radio_control_impl::set_tx_gain_profile( - const std::string& profile, const size_t) -{ - if (std::find(MAGNESIUM_GP_OPTIONS.begin(), MAGNESIUM_GP_OPTIONS.end(), profile) - == MAGNESIUM_GP_OPTIONS.end()) { - RFNOC_LOG_ERROR("Invalid TX gain profile: " << profile); - throw uhd::key_error("Invalid TX gain profile!"); - } - _gain_profile[TX_DIRECTION] = profile; -} - -void magnesium_radio_control_impl::set_rx_gain_profile( - const std::string& profile, const size_t) -{ - if (std::find(MAGNESIUM_GP_OPTIONS.begin(), MAGNESIUM_GP_OPTIONS.end(), profile) - == MAGNESIUM_GP_OPTIONS.end()) { - RFNOC_LOG_ERROR("Invalid RX gain profile: " << profile); - throw uhd::key_error("Invalid RX gain profile!"); - } - _gain_profile[RX_DIRECTION] = profile; -} - double magnesium_radio_control_impl::set_tx_gain(const double gain, const size_t chan) { std::lock_guard<std::recursive_mutex> l(_set_lock); @@ -716,28 +698,6 @@ uhd::gain_range_t magnesium_radio_control_impl::get_rx_gain_range( throw uhd::key_error("Invalid RX gain name!"); } -std::vector<std::string> magnesium_radio_control_impl::get_tx_gain_profile_names( - const size_t) const -{ - return MAGNESIUM_GP_OPTIONS; -} - -std::vector<std::string> magnesium_radio_control_impl::get_rx_gain_profile_names( - const size_t) const -{ - return MAGNESIUM_GP_OPTIONS; -} - -std::string magnesium_radio_control_impl::get_tx_gain_profile(const size_t) const -{ - return _gain_profile.at(TX_DIRECTION); -} - -std::string magnesium_radio_control_impl::get_rx_gain_profile(const size_t) const -{ - return _gain_profile.at(RX_DIRECTION); -} - meta_range_t magnesium_radio_control_impl::get_tx_bandwidth_range(size_t) const { return meta_range_t(AD9371_TX_MIN_BANDWIDTH, AD9371_TX_MAX_BANDWIDTH); |