aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/rfnoc/radio_control_impl.cpp
diff options
context:
space:
mode:
authorLane Kolbly <lane.kolbly@ni.com>2020-06-18 17:46:06 -0500
committerAaron Rossetto <aaron.rossetto@ni.com>2021-01-11 12:26:00 -0600
commit12673d9290319d2453fedd806ddf248d3d5586e3 (patch)
tree811016297552c5358129aecb5953a0c143229e86 /host/lib/rfnoc/radio_control_impl.cpp
parentc9b35e3b7107ab82c0e3978b7cbfd76ba98e2407 (diff)
downloaduhd-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/rfnoc/radio_control_impl.cpp')
-rw-r--r--host/lib/rfnoc/radio_control_impl.cpp36
1 files changed, 16 insertions, 20 deletions
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<uint64_t> timestamp) {
this->async_message_handler(addr, data, timestamp);
});
+
+ // Set the default gain profiles
+ _rx_gain_profile_api = std::make_shared<rf_control::default_gain_profile>();
+ _tx_gain_profile_api = std::make_shared<rf_control::default_gain_profile>();
} /* 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<std::string> radio_control_impl::get_tx_gain_profile_names(const size_t) const
+std::vector<std::string> 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<std::string> radio_control_impl::get_rx_gain_profile_names(const size_t) const
+std::vector<std::string> 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)