aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2017-12-05 11:30:12 -0800
committerMartin Braun <martin.braun@ettus.com>2017-12-06 10:59:28 -0800
commitcc86cc5a6a713788cc58add7fd76486b8a8fa141 (patch)
treec796c703e333864229e66be6939443b77d1ed7c9 /host
parent77adcffe0689f120fee71854ec0f627a32991f79 (diff)
downloaduhd-cc86cc5a6a713788cc58add7fd76486b8a8fa141.tar.gz
uhd-cc86cc5a6a713788cc58add7fd76486b8a8fa141.tar.bz2
uhd-cc86cc5a6a713788cc58add7fd76486b8a8fa141.zip
rfnoc: Added TX LO APIs to radio_ctrl
Also added stubs in the default impl. Reviewed-By: Ashish Chaudhari <ashish@ettus.com> Reviewed-By: Derek Kozel <derek.kozel@ettus.com>
Diffstat (limited to 'host')
-rw-r--r--host/include/uhd/rfnoc/radio_ctrl.hpp131
-rw-r--r--host/lib/rfnoc/radio_ctrl_impl.cpp71
-rw-r--r--host/lib/rfnoc/radio_ctrl_impl.hpp15
3 files changed, 211 insertions, 6 deletions
diff --git a/host/include/uhd/rfnoc/radio_ctrl.hpp b/host/include/uhd/rfnoc/radio_ctrl.hpp
index be22c6e5e..a8588b4fb 100644
--- a/host/include/uhd/rfnoc/radio_ctrl.hpp
+++ b/host/include/uhd/rfnoc/radio_ctrl.hpp
@@ -258,15 +258,18 @@ public:
*/
virtual uint32_t get_gpio_attr(const std::string &bank, const std::string &attr) = 0;
- /*!
- * Get a list of possible LO stage names
+ /**************************************************************************
+ * LO Controls
+ *************************************************************************/
+ /*! Get a list of possible LO stage names
+ *
* \param chan the channel index 0 to N-1
* \return a vector of strings for possible LO names
*/
virtual std::vector<std::string> get_rx_lo_names(const size_t chan) = 0;
- /*!
- * Get a list of possible LO sources.
+ /*! Get a list of possible LO sources.
+ *
* Channels which do not have controllable LO sources
* will return "internal".
* \param name the name of the LO stage to query
@@ -342,6 +345,126 @@ public:
*/
virtual double get_rx_lo_freq(const std::string &name, const size_t chan) = 0;
+ /*! Get a list of possible LO stage names
+ *
+ * \param chan the channel index 0 to N-1
+ * \return a vector of strings for possible LO names
+ */
+ virtual std::vector<std::string> get_tx_lo_names(const size_t chan) = 0;
+
+ /*! Get a list of possible LO sources.
+ *
+ * Channels which do not have controllable LO sources
+ * will return "internal".
+ * \param name the name of the LO stage to query
+ * \param chan the channel index 0 to N-1
+ * \return a vector of strings for possible settings
+ */
+ virtual std::vector<std::string> get_tx_lo_sources(
+ const std::string &name,
+ const size_t chan
+ ) = 0;
+
+ /*!
+ * Get the LO frequency range of the tx LO.
+ * If the channel does not have independently configurable LOs
+ * the rf frequency range will be returned.
+ * \param name the name of the LO stage to query
+ * \param chan the channel index 0 to N-1
+ * \return a frequency range object
+ */
+ virtual freq_range_t get_tx_lo_freq_range(
+ const std::string &name,
+ const size_t chan
+ ) = 0;
+
+ /*!
+ * Set the LO source for a channel.
+ * For usrps that support selectable LOs, this function
+ * allows switching between them.
+ * Typical options for source: internal, external.
+ * \param src a string representing the LO source
+ * \param name the name of the LO stage to update
+ * \param chan the channel index 0 to N-1
+ */
+ virtual void set_tx_lo_source(
+ const std::string &src,
+ const std::string &name,
+ const size_t chan
+ ) = 0;
+
+ /*!
+ * Get the currently set LO source.
+ * Channels without controllable LO sources will return
+ * "internal"
+ * \param name the name of the LO stage to query
+ * \param chan the channel index 0 to N-1
+ * \return the configured LO source
+ */
+ virtual const std::string get_tx_lo_source(
+ const std::string &name,
+ const size_t chan
+ ) = 0;
+
+ /*!
+ * Set whether the LO used by the usrp device is exported
+ * For usrps that support exportable LOs, this function
+ * configures if the LO used by chan is exported or not.
+ * \param enabled if true then export the LO
+ * \param name the name of the LO stage to update
+ * \param chan the channel index 0 to N-1 for the source channel
+ */
+ virtual void set_tx_lo_export_enabled(
+ const bool enabled,
+ const std::string &name,
+ const size_t chan
+ ) = 0;
+
+ /*!
+ * Returns true if the currently selected LO is being exported.
+ * \param name the name of the LO stage to query
+ * \param chan the channel index 0 to N-1
+ */
+ virtual bool get_tx_lo_export_enabled(
+ const std::string &name,
+ const size_t chan
+ ) = 0;
+
+ /*! Set the tx LO frequency (Advanced).
+ *
+ * See also multi_usrp::set_tx_lo_freq().
+ *
+ * \param freq the frequency to set the LO to
+ * \param name the name of the LO stage to update
+ * \param chan the channel index 0 to N-1
+ * \return a coerced LO frequency
+ */
+ virtual double set_tx_lo_freq(
+ const double freq,
+ const std::string &name,
+ const size_t chan
+ ) = 0;
+
+ /*! Get the current TX LO frequency (Advanced).
+ *
+ * See also multi_usrp::get_tx_lo_freq()
+ *
+ * If the channel does not have independently configurable LOs
+ * the current RF frequency will be returned.
+ *
+ * \param name the name of the LO stage to query
+ * \param chan the channel index 0 to N-1
+ * \return the configured LO frequency
+ */
+ virtual double get_tx_lo_freq(
+ const std::string &name,
+ const size_t chan
+ ) = 0;
+
+ /**************************************************************************
+ * Time and clock control
+ *************************************************************************/
+
/*!
* Set the time source for this radio.
*
diff --git a/host/lib/rfnoc/radio_ctrl_impl.cpp b/host/lib/rfnoc/radio_ctrl_impl.cpp
index 85ad6ed92..81bc0600b 100644
--- a/host/lib/rfnoc/radio_ctrl_impl.cpp
+++ b/host/lib/rfnoc/radio_ctrl_impl.cpp
@@ -244,7 +244,10 @@ double radio_ctrl_impl::get_rx_bandwidth(const size_t chan) /* const */
{
return _rx_bandwidth[chan];
}
-
+
+/******************************************************************************
+ * LO controls
+ *****************************************************************************/
std::vector<std::string> radio_ctrl_impl::get_rx_lo_names(const size_t /* chan */)
{
return std::vector<std::string>();
@@ -290,6 +293,72 @@ double radio_ctrl_impl::get_rx_lo_freq(const std::string & /* name */, const siz
return 0;
}
+std::vector<std::string> radio_ctrl_impl::get_tx_lo_names(
+ const size_t /* chan */
+) {
+ return std::vector<std::string>();
+}
+
+std::vector<std::string> radio_ctrl_impl::get_tx_lo_sources(
+ const std::string & /* name */,
+ const size_t /* chan */
+) {
+ return std::vector<std::string>();
+}
+
+freq_range_t radio_ctrl_impl::get_tx_lo_freq_range(
+ const std::string & /* name */,
+ const size_t /* chan */
+) {
+ return freq_range_t();
+}
+
+void radio_ctrl_impl::set_tx_lo_source(
+ const std::string & /* src */,
+ const std::string & /* name */,
+ const size_t /* chan */
+) {
+ throw uhd::not_implemented_error("set_tx_lo_source is not supported on this radio");
+}
+
+const std::string radio_ctrl_impl::get_tx_lo_source(
+ const std::string & /* name */,
+ const size_t /* chan */
+) {
+ return "internal";
+}
+
+void radio_ctrl_impl::set_tx_lo_export_enabled(
+ const bool /* enabled */,
+ const std::string & /* name */,
+ const size_t /* chan */
+) {
+ throw uhd::not_implemented_error("set_tx_lo_export_enabled is not supported on this radio");
+}
+
+bool radio_ctrl_impl::get_tx_lo_export_enabled(
+ const std::string & /* name */,
+ const size_t /* chan */
+) {
+ return false; // Not exporting non-existant LOs
+}
+
+double radio_ctrl_impl::set_tx_lo_freq(
+ const double /* freq */,
+ const std::string & /* name */,
+ const size_t /* chan */
+) {
+ throw uhd::not_implemented_error(
+ "set_tx_lo_freq is not supported on this radio");
+}
+
+double radio_ctrl_impl::get_tx_lo_freq(
+ const std::string & /* name */,
+ const size_t chan
+) {
+ return get_tx_frequency(chan);
+}
+
/***********************************************************************
* RX Streamer-related methods (from source_block_ctrl_base)
**********************************************************************/
diff --git a/host/lib/rfnoc/radio_ctrl_impl.hpp b/host/lib/rfnoc/radio_ctrl_impl.hpp
index 6f0c82504..dc4ab114e 100644
--- a/host/lib/rfnoc/radio_ctrl_impl.hpp
+++ b/host/lib/rfnoc/radio_ctrl_impl.hpp
@@ -81,9 +81,22 @@ public:
virtual void set_rx_lo_export_enabled(bool enabled, const std::string &name, const size_t chan);
virtual bool get_rx_lo_export_enabled(const std::string &name, const size_t chan);
- virtual double set_rx_lo_freq(double freq, const std::string &name, const size_t chan);
+ virtual double set_rx_lo_freq(const double freq, const std::string &name, const size_t chan);
virtual double get_rx_lo_freq(const std::string &name, const size_t chan);
+ virtual std::vector<std::string> get_tx_lo_names(const size_t chan);
+ virtual std::vector<std::string> get_tx_lo_sources(const std::string &name, const size_t chan);
+ virtual freq_range_t get_tx_lo_freq_range(const std::string &name, const size_t chan);
+
+ virtual void set_tx_lo_source(const std::string &src, const std::string &name, const size_t chan);
+ virtual const std::string get_tx_lo_source(const std::string &name, const size_t chan);
+
+ virtual void set_tx_lo_export_enabled(const bool enabled, const std::string &name, const size_t chan);
+ virtual bool get_tx_lo_export_enabled(const std::string &name, const size_t chan);
+
+ virtual double set_tx_lo_freq(const double freq, const std::string &name, const size_t chan);
+ virtual double get_tx_lo_freq(const std::string &name, const size_t chan);
+
void set_time_now(const time_spec_t &time_spec);
void set_time_next_pps(const time_spec_t &time_spec);
void set_time_sync(const uhd::time_spec_t &time);