diff options
author | Josh Blum <josh@joshknows.com> | 2011-01-27 15:24:47 -0800 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2011-01-27 15:24:47 -0800 |
commit | e16445483e1505942b7b1ddcd9fc575532fd93ba (patch) | |
tree | 9f08b9439e8ce46cb876396b32da138105348381 /host/include | |
parent | 8a62a20041605238320eae1f1a69221ef00b6bf1 (diff) | |
download | uhd-e16445483e1505942b7b1ddcd9fc575532fd93ba.tar.gz uhd-e16445483e1505942b7b1ddcd9fc575532fd93ba.tar.bz2 uhd-e16445483e1505942b7b1ddcd9fc575532fd93ba.zip |
uhd: remove single usrp (leave a typedef), multi-usrp is a superset now
Diffstat (limited to 'host/include')
-rw-r--r-- | host/include/uhd/usrp/multi_usrp.hpp | 123 | ||||
-rw-r--r-- | host/include/uhd/usrp/single_usrp.hpp | 435 |
2 files changed, 79 insertions, 479 deletions
diff --git a/host/include/uhd/usrp/multi_usrp.hpp b/host/include/uhd/usrp/multi_usrp.hpp index b603d4324..6e17c0ea8 100644 --- a/host/include/uhd/usrp/multi_usrp.hpp +++ b/host/include/uhd/usrp/multi_usrp.hpp @@ -34,19 +34,30 @@ namespace uhd{ namespace usrp{ /*! - * The multi-USRP device class: - * A multi-USRP facilitates ease-of-use for multiple USRP scenarios. - * The wrapper provides convenience functions to control the group - * of underlying devices as if they consisted of a single device. + * The Multi-USRP device class: * - * A few notes about a multi-USRP configuration: + * This class facilitates ease-of-use for most use-case scenarios. + * The wrapper provides convenience functions to tune the devices, + * set the dboard gains, antennas, filters, and other properties. + * This class can be used to interface with a single USRP with + * one or more channels, or multiple USRPs in a homogeneous setup. + * All members take an optional parameter for board number or channel number. + * In the single device, single channel case, these parameters can be unspecified. + * + * When using a single device with multiple channels: + * - Channel mapping is determined by the subdevice specifications + * - All channels share a common RX sample rate + * - All channels share a common TX sample rate + * + * When using multiple devices in a configuration: + * - Channel mapping is determined by the device address arguments * - All boards share a common RX sample rate * - All boards share a common TX sample rate * - All boards share a common RX subdevice specification size * - All boards share a common TX subdevice specification size * - All boards must have synchronized times (see the set_time_*() calls) * - * Example to setup channel mapping: + * Example to setup channel mapping for multiple devices: * <pre> * * //create a multi_usrp with two boards in the configuration @@ -106,7 +117,7 @@ public: * \param mboard which motherboard to query * \return a string representing the name */ - virtual std::string get_mboard_name(size_t mboard) = 0; + virtual std::string get_mboard_name(size_t mboard = 0) = 0; /*! * Get the current time in the usrp time registers. @@ -121,6 +132,19 @@ public: virtual time_spec_t get_time_last_pps(void) = 0; /*! + * Sets the time registers on the usrp immediately. + * + * If only one MIMO master is present in your configuration, set_time_now is + * safe to use because the slave's time automatically follows the master's time. + * Otherwise, this call cannot set the time synchronously across multiple devices. + * Please use the set_time_next_pps or set_time_unknown_pps calls with a PPS signal. + * + * \param time_spec the time to latch into the usrp device + * \param mboard the motherboard index 0 to M-1 + */ + virtual void set_time_now(const time_spec_t &time_spec, size_t mboard = ALL_MBOARDS) = 0; + + /*! * Set the time registers on the usrp at the next pps tick. * The values will not be latched in until the pulse occurs. * It is recommended that the user sleep(1) after calling to ensure @@ -162,6 +186,11 @@ public: * Issue a stream command to the usrp device. * This tells the usrp to send samples into the host. * See the documentation for stream_cmd_t for more info. + * + * With multiple devices, the first stream command in a chain of commands + * should have a time spec in the near future and stream_now = false; + * to ensure that the packets can be aligned by their time specs. + * * \param stream_cmd the stream command to issue */ virtual void issue_stream_cmd(const stream_cmd_t &stream_cmd) = 0; @@ -173,7 +202,7 @@ public: * \param clock_config the clock configuration to set * \param mboard which motherboard to set the config */ - virtual void set_clock_config(const clock_config_t &clock_config, size_t mboard) = 0; + virtual void set_clock_config(const clock_config_t &clock_config, size_t mboard = ALL_MBOARDS) = 0; /*! * Get the number of USRP motherboards in this configuration. @@ -191,14 +220,14 @@ public: * \param spec the new subdevice specification * \param mboard the motherboard index 0 to M-1 */ - virtual void set_rx_subdev_spec(const uhd::usrp::subdev_spec_t &spec, size_t mboard) = 0; + virtual void set_rx_subdev_spec(const uhd::usrp::subdev_spec_t &spec, size_t mboard = ALL_MBOARDS) = 0; /*! * Get the RX subdevice specification. * \param mboard the motherboard index 0 to M-1 * \return the subdevice specification in use */ - virtual uhd::usrp::subdev_spec_t get_rx_subdev_spec(size_t mboard) = 0; + virtual uhd::usrp::subdev_spec_t get_rx_subdev_spec(size_t mboard = 0) = 0; /*! * Get the number of RX channels in this configuration. @@ -212,7 +241,7 @@ public: * \param chan the channel index 0 to N-1 * \return the subdevice name */ - virtual std::string get_rx_subdev_name(size_t chan) = 0; + virtual std::string get_rx_subdev_name(size_t chan = 0) = 0; /*! * Set the RX sample rate across all channels. @@ -241,14 +270,14 @@ public: * \param chan the channel index 0 to N-1 * \return the frequency in Hz */ - virtual double get_rx_freq(size_t chan) = 0; + virtual double get_rx_freq(size_t chan = 0) = 0; /*! * Get the RX center frequency range. * \param chan the channel index 0 to N-1 * \return a frequency range object */ - virtual freq_range_t get_rx_freq_range(size_t chan) = 0; + virtual freq_range_t get_rx_freq_range(size_t chan = 0) = 0; /*! * Set the RX gain value for the specified gain element. @@ -257,10 +286,10 @@ public: * \param name the name of the gain element * \param chan the channel index 0 to N-1 */ - virtual void set_rx_gain(double gain, const std::string &name, size_t chan) = 0; + virtual void set_rx_gain(double gain, const std::string &name, size_t chan = 0) = 0; //! A convenience wrapper for setting overall RX gain - void set_rx_gain(double gain, size_t chan){ + void set_rx_gain(double gain, size_t chan = 0){ return this->set_rx_gain(gain, ALL_GAINS, chan); } @@ -271,10 +300,10 @@ public: * \param chan the channel index 0 to N-1 * \return the gain in dB */ - virtual double get_rx_gain(const std::string &name, size_t chan) = 0; + virtual double get_rx_gain(const std::string &name, size_t chan = 0) = 0; //! A convenience wrapper for getting overall RX gain - double get_rx_gain(size_t chan){ + double get_rx_gain(size_t chan = 0){ return this->get_rx_gain(ALL_GAINS, chan); } @@ -285,10 +314,10 @@ public: * \param chan the channel index 0 to N-1 * \return a gain range object */ - virtual gain_range_t get_rx_gain_range(const std::string &name, size_t chan) = 0; + virtual gain_range_t get_rx_gain_range(const std::string &name, size_t chan = 0) = 0; //! A convenience wrapper for getting overall RX gain range - gain_range_t get_rx_gain_range(size_t chan){ + gain_range_t get_rx_gain_range(size_t chan = 0){ return this->get_rx_gain_range(ALL_GAINS, chan); } @@ -298,49 +327,49 @@ public: * \param chan the channel index 0 to N-1 * \return a vector of gain element names */ - virtual std::vector<std::string> get_rx_gain_names(size_t chan) = 0; + virtual std::vector<std::string> get_rx_gain_names(size_t chan = 0) = 0; /*! * Select the RX antenna on the subdevice. * \param ant the antenna name * \param chan the channel index 0 to N-1 */ - virtual void set_rx_antenna(const std::string &ant, size_t chan) = 0; + virtual void set_rx_antenna(const std::string &ant, size_t chan = 0) = 0; /*! * Get the selected RX antenna on the subdevice. * \param chan the channel index 0 to N-1 * \return the antenna name */ - virtual std::string get_rx_antenna(size_t chan) = 0; + virtual std::string get_rx_antenna(size_t chan = 0) = 0; /*! * Get a list of possible RX antennas on the subdevice. * \param chan the channel index 0 to N-1 * \return a vector of antenna names */ - virtual std::vector<std::string> get_rx_antennas(size_t chan) = 0; + virtual std::vector<std::string> get_rx_antennas(size_t chan = 0) = 0; /*! * Get the locked status of the LO on the subdevice. * \param chan the channel index 0 to N-1 * \return true for locked */ - virtual bool get_rx_lo_locked(size_t chan) = 0; + virtual bool get_rx_lo_locked(size_t chan = 0) = 0; /*! * Set the RX bandwidth on the subdevice. * \param bandwidth the bandwidth in Hz * \param chan the channel index 0 to N-1 */ - virtual void set_rx_bandwidth(double bandwidth, size_t chan) = 0; + virtual void set_rx_bandwidth(double bandwidth, size_t chan = 0) = 0; /*! * Get the RX bandwidth on the subdevice. * \param chan the channel index 0 to N-1 * \return the bandwidth in Hz */ - virtual double get_rx_bandwidth(size_t chan) = 0; + virtual double get_rx_bandwidth(size_t chan = 0) = 0; /*! * Read the RSSI value on the RX subdevice. @@ -348,7 +377,7 @@ public: * \return the rssi in dB * \throw exception if RSSI readback not supported */ - virtual double read_rssi(size_t chan) = 0; + virtual double read_rssi(size_t chan = 0) = 0; /*! * Get the dboard interface object for the RX subdevice. @@ -357,7 +386,7 @@ public: * \param chan the channel index 0 to N-1 * \return the dboard interface sptr */ - virtual dboard_iface::sptr get_rx_dboard_iface(size_t chan) = 0; + virtual dboard_iface::sptr get_rx_dboard_iface(size_t chan = 0) = 0; /******************************************************************* * TX methods @@ -370,14 +399,14 @@ public: * \param spec the new subdevice specification * \param mboard the motherboard index 0 to M-1 */ - virtual void set_tx_subdev_spec(const uhd::usrp::subdev_spec_t &spec, size_t mboard) = 0; + virtual void set_tx_subdev_spec(const uhd::usrp::subdev_spec_t &spec, size_t mboard = ALL_MBOARDS) = 0; /*! * Get the TX subdevice specification. * \param mboard the motherboard index 0 to M-1 * \return the subdevice specification in use */ - virtual uhd::usrp::subdev_spec_t get_tx_subdev_spec(size_t mboard) = 0; + virtual uhd::usrp::subdev_spec_t get_tx_subdev_spec(size_t mboard = 0) = 0; /*! * Get the number of TX channels in this configuration. @@ -391,7 +420,7 @@ public: * \param chan the channel index 0 to N-1 * \return the subdevice name */ - virtual std::string get_tx_subdev_name(size_t chan) = 0; + virtual std::string get_tx_subdev_name(size_t chan = 0) = 0; /*! * Set the TX sample rate across all channels. @@ -420,14 +449,14 @@ public: * \param chan the channel index 0 to N-1 * \return the frequency in Hz */ - virtual double get_tx_freq(size_t chan) = 0; + virtual double get_tx_freq(size_t chan = 0) = 0; /*! * Get the TX center frequency range. * \param chan the channel index 0 to N-1 * \return a frequency range object */ - virtual freq_range_t get_tx_freq_range(size_t chan) = 0; + virtual freq_range_t get_tx_freq_range(size_t chan = 0) = 0; /*! * Set the TX gain value for the specified gain element. @@ -436,10 +465,10 @@ public: * \param name the name of the gain element * \param chan the channel index 0 to N-1 */ - virtual void set_tx_gain(double gain, const std::string &name, size_t chan) = 0; + virtual void set_tx_gain(double gain, const std::string &name, size_t chan = 0) = 0; //! A convenience wrapper for setting overall TX gain - void set_tx_gain(double gain, size_t chan){ + void set_tx_gain(double gain, size_t chan = 0){ return this->set_tx_gain(gain, ALL_GAINS, chan); } @@ -450,10 +479,10 @@ public: * \param chan the channel index 0 to N-1 * \return the gain in dB */ - virtual double get_tx_gain(const std::string &name, size_t chan) = 0; + virtual double get_tx_gain(const std::string &name, size_t chan = 0) = 0; //! A convenience wrapper for getting overall TX gain - double get_tx_gain(size_t chan){ + double get_tx_gain(size_t chan = 0){ return this->get_tx_gain(ALL_GAINS, chan); } @@ -464,10 +493,10 @@ public: * \param chan the channel index 0 to N-1 * \return a gain range object */ - virtual gain_range_t get_tx_gain_range(const std::string &name, size_t chan) = 0; + virtual gain_range_t get_tx_gain_range(const std::string &name, size_t chan = 0) = 0; //! A convenience wrapper for getting overall TX gain range - gain_range_t get_tx_gain_range(size_t chan){ + gain_range_t get_tx_gain_range(size_t chan = 0){ return this->get_tx_gain_range(ALL_GAINS, chan); } @@ -477,49 +506,49 @@ public: * \param chan the channel index 0 to N-1 * \return a vector of gain element names */ - virtual std::vector<std::string> get_tx_gain_names(size_t chan) = 0; + virtual std::vector<std::string> get_tx_gain_names(size_t chan = 0) = 0; /*! * Select the TX antenna on the subdevice. * \param ant the antenna name * \param chan the channel index 0 to N-1 */ - virtual void set_tx_antenna(const std::string &ant, size_t chan) = 0; + virtual void set_tx_antenna(const std::string &ant, size_t chan = 0) = 0; /*! * Get the selected TX antenna on the subdevice. * \param chan the channel index 0 to N-1 * \return the antenna name */ - virtual std::string get_tx_antenna(size_t chan) = 0; + virtual std::string get_tx_antenna(size_t chan = 0) = 0; /*! * Get a list of possible TX antennas on the subdevice. * \param chan the channel index 0 to N-1 * \return a vector of antenna names */ - virtual std::vector<std::string> get_tx_antennas(size_t chan) = 0; + virtual std::vector<std::string> get_tx_antennas(size_t chan = 0) = 0; /*! * Get the locked status of the LO on the subdevice. * \param chan the channel index 0 to N-1 * \return true for locked */ - virtual bool get_tx_lo_locked(size_t chan) = 0; + virtual bool get_tx_lo_locked(size_t chan = 0) = 0; /*! * Set the TX bandwidth on the subdevice. * \param bandwidth the bandwidth in Hz * \param chan the channel index 0 to N-1 */ - virtual void set_tx_bandwidth(double bandwidth, size_t chan) = 0; + virtual void set_tx_bandwidth(double bandwidth, size_t chan = 0) = 0; /*! * Get the TX bandwidth on the subdevice. * \param chan the channel index 0 to N-1 * \return the bandwidth in Hz */ - virtual double get_tx_bandwidth(size_t chan) = 0; + virtual double get_tx_bandwidth(size_t chan = 0) = 0; /*! * Get the dboard interface object for the TX subdevice. @@ -528,7 +557,7 @@ public: * \param chan the channel index 0 to N-1 * \return the dboard interface sptr */ - virtual dboard_iface::sptr get_tx_dboard_iface(size_t chan) = 0; + virtual dboard_iface::sptr get_tx_dboard_iface(size_t chan = 0) = 0; }; }} diff --git a/host/include/uhd/usrp/single_usrp.hpp b/host/include/uhd/usrp/single_usrp.hpp index d80999300..0520db162 100644 --- a/host/include/uhd/usrp/single_usrp.hpp +++ b/host/include/uhd/usrp/single_usrp.hpp @@ -18,441 +18,12 @@ #ifndef INCLUDED_UHD_USRP_SINGLE_USRP_HPP #define INCLUDED_UHD_USRP_SINGLE_USRP_HPP -#include <uhd/config.hpp> -#include <uhd/device.hpp> -#include <uhd/types/ranges.hpp> -#include <uhd/types/stream_cmd.hpp> -#include <uhd/types/clock_config.hpp> -#include <uhd/types/tune_request.hpp> -#include <uhd/types/tune_result.hpp> -#include <uhd/usrp/subdev_spec.hpp> -#include <uhd/usrp/dboard_iface.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/utility.hpp> -#include <vector> +#include <uhd/usrp/multi_usrp.hpp> namespace uhd{ namespace usrp{ -/*! - * The single-USRP device class: - * A single-USRP facilitates ease-of-use for most use-case scenarios. - * The wrapper provides convenience functions to tune the devices - * as well as to set the dboard gains, antennas, and other properties. - * This wrapper supports multi-channel configurations per motherboard. - */ -class UHD_API single_usrp : boost::noncopyable{ -public: - typedef boost::shared_ptr<single_usrp> sptr; - - //! A wildcard gain element name - static const std::string ALL_GAINS; - - /*! - * Make a new single usrp from the device address. - * \param dev_addr the device address - * \return a new single usrp object - */ - static sptr make(const device_addr_t &dev_addr); - - /*! - * Get the underlying device object. - * This is needed to get access to the streaming API and properties. - * \return the device object within this single usrp - */ - virtual device::sptr get_device(void) = 0; - - /******************************************************************* - * Mboard methods - ******************************************************************/ - /*! - * Get a printable summary for this USRP configuration. - * \return a printable string - */ - virtual std::string get_pp_string(void) = 0; - - /*! - * Get canonical name for this USRP motherboard. - * \return a string representing the name - */ - virtual std::string get_mboard_name(void) = 0; - - /*! - * Get the current time in the usrp time registers. - * \return a timespec representing current usrp time - */ - virtual time_spec_t get_time_now(void) = 0; - - /*! - * Get the time when the last pps pulse occured. - * \return a timespec representing the last pps - */ - virtual time_spec_t get_time_last_pps(void) = 0; - - /*! - * Sets the time registers on the usrp immediately. - * \param time_spec the time to latch into the usrp device - */ - virtual void set_time_now(const time_spec_t &time_spec) = 0; - - /*! - * Set the time registers on the usrp at the next pps tick. - * The values will not be latched in until the pulse occurs. - * It is recommended that the user sleep(1) after calling to ensure - * that the time registers will be in a known state prior to use. - * - * Note: Because this call sets the time on the "next" pps, - * the seconds in the time spec should be current seconds + 1. - * - * \param time_spec the time to latch into the usrp device - */ - virtual void set_time_next_pps(const time_spec_t &time_spec) = 0; - - /*! - * Issue a stream command to the usrp device. - * This tells the usrp to send samples into the host. - * See the documentation for stream_cmd_t for more info. - * \param stream_cmd the stream command to issue - */ - virtual void issue_stream_cmd(const stream_cmd_t &stream_cmd) = 0; - - /*! - * Set the clock configuration for the usrp device. - * This tells the usrp how to get a 10Mhz reference and PPS clock. - * See the documentation for clock_config_t for more info. - * \param clock_config the clock configuration to set - */ - virtual void set_clock_config(const clock_config_t &clock_config) = 0; - - /******************************************************************* - * RX methods - ******************************************************************/ - /*! - * Set the RX subdevice specification: - * The subdev spec maps a physical part of a daughter-board to a channel number. - * Set the subdev spec before calling into any methods with a channel number. - * \param spec the new subdevice specification - */ - virtual void set_rx_subdev_spec(const uhd::usrp::subdev_spec_t &spec) = 0; - - /*! - * Get the RX subdevice specification. - * \return the subdevice specification in use - */ - virtual uhd::usrp::subdev_spec_t get_rx_subdev_spec(void) = 0; - - /*! - * Get the name of the RX subdevice. - * \param chan the channel index 0 to N-1 - * \return the subdevice name - */ - virtual std::string get_rx_subdev_name(size_t chan = 0) = 0; - - /*! - * Set the RX sample rate across all channels. - * \param rate the rate in Sps - */ - virtual void set_rx_rate(double rate) = 0; - - /*! - * Gets the RX sample rate for all channels. - * \return the rate in Sps - */ - virtual double get_rx_rate(void) = 0; - - /*! - * Set the RX center frequency. - * \param tune_request tune request instructions - * \param chan the channel index 0 to N-1 - * \return a tune result object - */ - virtual tune_result_t set_rx_freq( - const tune_request_t &tune_request, size_t chan = 0 - ) = 0; - - /*! - * Get the RX center frequency. - * \param chan the channel index 0 to N-1 - * \return the frequency in Hz - */ - virtual double get_rx_freq(size_t chan = 0) = 0; - - /*! - * Get the RX center frequency range. - * \param chan the channel index 0 to N-1 - * \return a frequency range object - */ - virtual freq_range_t get_rx_freq_range(size_t chan = 0) = 0; - - /*! - * Set the RX gain value for the specified gain element. - * For an empty name, distribute across all gain elements. - * \param gain the gain in dB - * \param name the name of the gain element - * \param chan the channel index 0 to N-1 - */ - virtual void set_rx_gain(double gain, const std::string &name, size_t chan = 0) = 0; - - //! A convenience wrapper for setting overall RX gain - void set_rx_gain(double gain, size_t chan = 0){ - return this->set_rx_gain(gain, ALL_GAINS, chan); - } - - /*! - * Get the RX gain value for the specified gain element. - * For an empty name, sum across all gain elements. - * \param name the name of the gain element - * \param chan the channel index 0 to N-1 - * \return the gain in dB - */ - virtual double get_rx_gain(const std::string &name, size_t chan = 0) = 0; - - //! A convenience wrapper for getting overall RX gain - double get_rx_gain(size_t chan = 0){ - return this->get_rx_gain(ALL_GAINS, chan); - } - - /*! - * Get the RX gain range for the specified gain element. - * For an empty name, calculate the overall gain range. - * \param name the name of the gain element - * \param chan the channel index 0 to N-1 - * \return a gain range object - */ - virtual gain_range_t get_rx_gain_range(const std::string &name, size_t chan = 0) = 0; - - //! A convenience wrapper for getting overall RX gain range - gain_range_t get_rx_gain_range(size_t chan = 0){ - return this->get_rx_gain_range(ALL_GAINS, chan); - } - - /*! - * Get the names of the gain elements in the RX chain. - * Gain elements are ordered from antenna to FPGA. - * \param chan the channel index 0 to N-1 - * \return a vector of gain element names - */ - virtual std::vector<std::string> get_rx_gain_names(size_t chan = 0) = 0; - - /*! - * Select the RX antenna on the subdevice. - * \param ant the antenna name - * \param chan the channel index 0 to N-1 - */ - virtual void set_rx_antenna(const std::string &ant, size_t chan = 0) = 0; - - /*! - * Get the selected RX antenna on the subdevice. - * \param chan the channel index 0 to N-1 - * \return the antenna name - */ - virtual std::string get_rx_antenna(size_t chan = 0) = 0; - - /*! - * Get a list of possible RX antennas on the subdevice. - * \param chan the channel index 0 to N-1 - * \return a vector of antenna names - */ - virtual std::vector<std::string> get_rx_antennas(size_t chan = 0) = 0; - - /*! - * Get the locked status of the LO on the subdevice. - * \param chan the channel index 0 to N-1 - * \return true for locked - */ - virtual bool get_rx_lo_locked(size_t chan = 0) = 0; - - /*! - * Set the RX bandwidth on the subdevice. - * \param bandwidth the bandwidth in Hz - * \param chan the channel index 0 to N-1 - */ - virtual void set_rx_bandwidth(double bandwidth, size_t chan = 0) = 0; - - /*! - * Get the RX bandwidth on the subdevice. - * \param chan the channel index 0 to N-1 - * \return the bandwidth in Hz - */ - virtual double get_rx_bandwidth(size_t chan = 0) = 0; - - /*! - * Read the RSSI value on the RX subdevice. - * \param chan the channel index 0 to N-1 - * \return the rssi in dB - * \throw exception if RSSI readback not supported - */ - virtual double read_rssi(size_t chan = 0) = 0; - - /*! - * Get the dboard interface object for the RX subdevice. - * The dboard interface gives access to GPIOs, SPI, I2C, low-speed ADC and DAC. - * Use at your own risk! - * \param chan the channel index 0 to N-1 - * \return the dboard interface sptr - */ - virtual dboard_iface::sptr get_rx_dboard_iface(size_t chan = 0) = 0; - - /******************************************************************* - * TX methods - ******************************************************************/ - /*! - * Set the TX subdevice specification: - * The subdev spec maps a physical part of a daughter-board to a channel number. - * Set the subdev spec before calling into any methods with a channel number. - * \param spec the new subdevice specification - */ - virtual void set_tx_subdev_spec(const uhd::usrp::subdev_spec_t &spec) = 0; - - /*! - * Get the TX subdevice specification. - * \return the subdevice specification in use - */ - virtual uhd::usrp::subdev_spec_t get_tx_subdev_spec(void) = 0; - - /*! - * Get the name of the TX subdevice. - * \param chan the channel index 0 to N-1 - * \return the subdevice name - */ - virtual std::string get_tx_subdev_name(size_t chan = 0) = 0; - - /*! - * Set the TX sample rate across all channels. - * \param rate the rate in Sps - */ - virtual void set_tx_rate(double rate) = 0; - - /*! - * Gets the TX sample rate for all channels. - * \return the rate in Sps - */ - virtual double get_tx_rate(void) = 0; - - /*! - * Set the TX center frequency. - * \param tune_request tune request instructions - * \param chan the channel index 0 to N-1 - * \return a tune result object - */ - virtual tune_result_t set_tx_freq( - const tune_request_t &tune_request, size_t chan = 0 - ) = 0; - - /*! - * Get the TX center frequency. - * \param chan the channel index 0 to N-1 - * \return the frequency in Hz - */ - virtual double get_tx_freq(size_t chan = 0) = 0; - - /*! - * Get the TX center frequency range. - * \param chan the channel index 0 to N-1 - * \return a frequency range object - */ - virtual freq_range_t get_tx_freq_range(size_t chan = 0) = 0; - - /*! - * Set the TX gain value for the specified gain element. - * For an empty name, distribute across all gain elements. - * \param gain the gain in dB - * \param name the name of the gain element - * \param chan the channel index 0 to N-1 - */ - virtual void set_tx_gain(double gain, const std::string &name, size_t chan = 0) = 0; - - //! A convenience wrapper for setting overall TX gain - void set_tx_gain(double gain, size_t chan = 0){ - return this->set_tx_gain(gain, ALL_GAINS, chan); - } - - /*! - * Get the TX gain value for the specified gain element. - * For an empty name, sum across all gain elements. - * \param name the name of the gain element - * \param chan the channel index 0 to N-1 - * \return the gain in dB - */ - virtual double get_tx_gain(const std::string &name, size_t chan = 0) = 0; - - //! A convenience wrapper for getting overall TX gain - double get_tx_gain(size_t chan = 0){ - return this->get_tx_gain(ALL_GAINS, chan); - } - - /*! - * Get the TX gain range for the specified gain element. - * For an empty name, calculate the overall gain range. - * \param name the name of the gain element - * \param chan the channel index 0 to N-1 - * \return a gain range object - */ - virtual gain_range_t get_tx_gain_range(const std::string &name, size_t chan = 0) = 0; - - //! A convenience wrapper for getting overall TX gain range - gain_range_t get_tx_gain_range(size_t chan = 0){ - return this->get_tx_gain_range(ALL_GAINS, chan); - } - - /*! - * Get the names of the gain elements in the TX chain. - * Gain elements are ordered from antenna to FPGA. - * \param chan the channel index 0 to N-1 - * \return a vector of gain element names - */ - virtual std::vector<std::string> get_tx_gain_names(size_t chan = 0) = 0; - - /*! - * Select the TX antenna on the subdevice. - * \param ant the antenna name - * \param chan the channel index 0 to N-1 - */ - virtual void set_tx_antenna(const std::string &ant, size_t chan = 0) = 0; - - /*! - * Get the selected TX antenna on the subdevice. - * \param chan the channel index 0 to N-1 - * \return the antenna name - */ - virtual std::string get_tx_antenna(size_t chan = 0) = 0; - - /*! - * Get a list of possible TX antennas on the subdevice. - * \param chan the channel index 0 to N-1 - * \return a vector of antenna names - */ - virtual std::vector<std::string> get_tx_antennas(size_t chan = 0) = 0; - - /*! - * Get the locked status of the LO on the subdevice. - * \param chan the channel index 0 to N-1 - * \return true for locked - */ - virtual bool get_tx_lo_locked(size_t chan = 0) = 0; - - /*! - * Set the TX bandwidth on the subdevice. - * \param bandwidth the bandwidth in Hz - * \param chan the channel index 0 to N-1 - */ - virtual void set_tx_bandwidth(double bandwidth, size_t chan = 0) = 0; - - /*! - * Get the TX bandwidth on the subdevice. - * \param chan the channel index 0 to N-1 - * \return the bandwidth in Hz - */ - virtual double get_tx_bandwidth(size_t chan = 0) = 0; - - /*! - * Get the dboard interface object for the TX subdevice. - * The dboard interface gives access to GPIOs, SPI, I2C, low-speed ADC and DAC. - * Use at your own risk! - * \param chan the channel index 0 to N-1 - * \return the dboard interface sptr - */ - virtual dboard_iface::sptr get_tx_dboard_iface(size_t chan = 0) = 0; -}; + //! Multi-USRP is a superset of Single-USRP + typedef multi_usrp single_usrp; }} |