From 12673d9290319d2453fedd806ddf248d3d5586e3 Mon Sep 17 00:00:00 2001 From: Lane Kolbly Date: Thu, 18 Jun 2020 17:46:06 -0500 Subject: 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. --- host/lib/rfnoc/radio_control_impl.cpp | 36 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 20 deletions(-) (limited to 'host/lib/rfnoc/radio_control_impl.cpp') diff --git a/host/lib/rfnoc/radio_control_impl.cpp b/host/lib/rfnoc/radio_control_impl.cpp index f9347b9e7..e20f5d4f6 100644 --- a/host/lib/rfnoc/radio_control_impl.cpp +++ b/host/lib/rfnoc/radio_control_impl.cpp @@ -253,6 +253,10 @@ radio_control_impl::radio_control_impl(make_args_ptr make_args) boost::optional timestamp) { this->async_message_handler(addr, data, timestamp); }); + + // Set the default gain profiles + _rx_gain_profile_api = std::make_shared(); + _tx_gain_profile_api = std::make_shared(); } /* ctor */ /****************************************************************************** @@ -436,42 +440,34 @@ void radio_control_impl::set_rx_agc(const bool, const size_t) throw uhd::not_implemented_error("set_rx_agc() is not supported on this radio!"); } -void radio_control_impl::set_tx_gain_profile(const std::string& profile, const size_t) +void radio_control_impl::set_tx_gain_profile(const std::string& profile, const size_t chan) { - if (profile != DEFAULT_GAIN_PROFILE) { - throw uhd::value_error( - std::string("set_tx_gain_profile(): Unknown gain profile: `") + profile - + "'"); - } + _tx_gain_profile_api->set_gain_profile(profile, chan); } -void radio_control_impl::set_rx_gain_profile(const std::string& profile, const size_t) +void radio_control_impl::set_rx_gain_profile(const std::string& profile, const size_t chan) { - if (profile != DEFAULT_GAIN_PROFILE) { - throw uhd::value_error( - std::string("set_rx_gain_profile(): Unknown gain profile: `") + profile - + "'"); - } + _rx_gain_profile_api->set_gain_profile(profile, chan); } -std::vector radio_control_impl::get_tx_gain_profile_names(const size_t) const +std::vector radio_control_impl::get_tx_gain_profile_names(const size_t chan) const { - return {DEFAULT_GAIN_PROFILE}; + return _tx_gain_profile_api->get_gain_profile_names(chan); } -std::vector radio_control_impl::get_rx_gain_profile_names(const size_t) const +std::vector radio_control_impl::get_rx_gain_profile_names(const size_t chan) const { - return {DEFAULT_GAIN_PROFILE}; + return _rx_gain_profile_api->get_gain_profile_names(chan); } -std::string radio_control_impl::get_tx_gain_profile(const size_t) const +std::string radio_control_impl::get_tx_gain_profile(const size_t chan) const { - return DEFAULT_GAIN_PROFILE; + return _tx_gain_profile_api->get_gain_profile(chan); } -std::string radio_control_impl::get_rx_gain_profile(const size_t) const +std::string radio_control_impl::get_rx_gain_profile(const size_t chan) const { - return DEFAULT_GAIN_PROFILE; + return _rx_gain_profile_api->get_gain_profile(chan); } double radio_control_impl::set_tx_bandwidth(const double bandwidth, const size_t chan) -- cgit v1.2.3