All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
multi_usrp.hpp
Go to the documentation of this file.
//
// Copyright 2010-2011 Ettus Research LLC
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
#ifndef INCLUDED_UHD_USRP_MULTI_USRP_HPP
#define INCLUDED_UHD_USRP_MULTI_USRP_HPP
//define API capabilities for compile time detection of new features
#define UHD_USRP_MULTI_USRP_REF_SOURCES_API
#define UHD_USRP_MULTI_USRP_GET_RATES_API
#define UHD_USRP_MULTI_USRP_FRONTEND_CAL_API
#define UHD_USRP_MULTI_USRP_COMMAND_TIME_API
#define UHD_USRP_MULTI_USRP_BW_RANGE_API
#define UHD_USRP_MULTI_USRP_USER_REGS_API
#include <uhd/config.hpp>
#include <uhd/device.hpp>
#include <uhd/deprecated.hpp>
#include <uhd/types/ranges.hpp>
#include <uhd/types/stream_cmd.hpp>
#include <uhd/types/tune_request.hpp>
#include <uhd/types/tune_result.hpp>
#include <uhd/types/sensors.hpp>
#include <uhd/usrp/subdev_spec.hpp>
#include <uhd/usrp/dboard_iface.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/utility.hpp>
#include <complex>
#include <string>
#include <vector>
namespace uhd{ namespace usrp{
class UHD_API multi_usrp : boost::noncopyable{
public:
typedef boost::shared_ptr<multi_usrp> sptr;
static const size_t ALL_MBOARDS = size_t(~0);
static const size_t ALL_CHANS = size_t(~0);
static const std::string ALL_GAINS;
static sptr make(const device_addr_t &dev_addr);
virtual device::sptr get_device(void) = 0;
rx_streamer::sptr get_rx_stream(const stream_args_t &args){
return this->get_device()->get_rx_stream(args);
}
tx_streamer::sptr get_tx_stream(const stream_args_t &args){
return this->get_device()->get_tx_stream(args);
}
/*******************************************************************
* Mboard methods
******************************************************************/
virtual void set_master_clock_rate(double rate, size_t mboard = ALL_MBOARDS) = 0;
virtual double get_master_clock_rate(size_t mboard = 0) = 0;
virtual std::string get_pp_string(void) = 0;
virtual std::string get_mboard_name(size_t mboard = 0) = 0;
virtual time_spec_t get_time_now(size_t mboard = 0) = 0;
virtual time_spec_t get_time_last_pps(size_t mboard = 0) = 0;
virtual void set_time_now(const time_spec_t &time_spec, size_t mboard = ALL_MBOARDS) = 0;
virtual void set_time_next_pps(const time_spec_t &time_spec, size_t mboard = ALL_MBOARDS) = 0;
virtual void set_time_unknown_pps(const time_spec_t &time_spec) = 0;
virtual bool get_time_synchronized(void) = 0;
virtual void set_command_time(const uhd::time_spec_t &time_spec, size_t mboard = ALL_MBOARDS) = 0;
virtual void clear_command_time(size_t mboard = ALL_MBOARDS) = 0;
virtual void issue_stream_cmd(const stream_cmd_t &stream_cmd, size_t chan = ALL_CHANS) = 0;
virtual void set_clock_config(const clock_config_t &clock_config, size_t mboard = ALL_MBOARDS) = 0;
virtual void set_time_source(const std::string &source, const size_t mboard = ALL_MBOARDS) = 0;
virtual std::string get_time_source(const size_t mboard) = 0;
virtual std::vector<std::string> get_time_sources(const size_t mboard) = 0;
virtual void set_clock_source(const std::string &source, const size_t mboard = ALL_MBOARDS) = 0;
virtual std::string get_clock_source(const size_t mboard) = 0;
virtual std::vector<std::string> get_clock_sources(const size_t mboard) = 0;
virtual size_t get_num_mboards(void) = 0;
virtual sensor_value_t get_mboard_sensor(const std::string &name, size_t mboard = 0) = 0;
virtual std::vector<std::string> get_mboard_sensor_names(size_t mboard = 0) = 0;
virtual void set_user_register(const boost::uint8_t addr, const boost::uint32_t data, size_t mboard = ALL_MBOARDS) = 0;
/*******************************************************************
* RX methods
******************************************************************/
virtual void set_rx_subdev_spec(const uhd::usrp::subdev_spec_t &spec, size_t mboard = ALL_MBOARDS) = 0;
virtual uhd::usrp::subdev_spec_t get_rx_subdev_spec(size_t mboard = 0) = 0;
virtual size_t get_rx_num_channels(void) = 0;
virtual std::string get_rx_subdev_name(size_t chan = 0) = 0;
virtual void set_rx_rate(double rate, size_t chan = ALL_CHANS) = 0;
virtual double get_rx_rate(size_t chan = 0) = 0;
virtual meta_range_t get_rx_rates(size_t chan = 0) = 0;
virtual tune_result_t set_rx_freq(
const tune_request_t &tune_request, size_t chan = 0
) = 0;
virtual double get_rx_freq(size_t chan = 0) = 0;
virtual freq_range_t get_rx_freq_range(size_t chan = 0) = 0;
virtual void set_rx_gain(double gain, const std::string &name, size_t chan = 0) = 0;
void set_rx_gain(double gain, size_t chan = 0){
return this->set_rx_gain(gain, ALL_GAINS, chan);
}
virtual double get_rx_gain(const std::string &name, size_t chan = 0) = 0;
double get_rx_gain(size_t chan = 0){
return this->get_rx_gain(ALL_GAINS, chan);
}
virtual gain_range_t get_rx_gain_range(const std::string &name, size_t chan = 0) = 0;
gain_range_t get_rx_gain_range(size_t chan = 0){
return this->get_rx_gain_range(ALL_GAINS, chan);
}
virtual std::vector<std::string> get_rx_gain_names(size_t chan = 0) = 0;
virtual void set_rx_antenna(const std::string &ant, size_t chan = 0) = 0;
virtual std::string get_rx_antenna(size_t chan = 0) = 0;
virtual std::vector<std::string> get_rx_antennas(size_t chan = 0) = 0;
UHD_DEPRECATED bool get_rx_lo_locked(size_t chan = 0){
return this->get_rx_sensor("lo_locked", chan).to_bool();
}
virtual void set_rx_bandwidth(double bandwidth, size_t chan = 0) = 0;
virtual double get_rx_bandwidth(size_t chan = 0) = 0;
virtual meta_range_t get_rx_bandwidth_range(size_t chan = 0) = 0;
UHD_DEPRECATED double read_rssi(size_t chan = 0){
return this->get_rx_sensor("rssi", chan).to_real();
}
virtual dboard_iface::sptr get_rx_dboard_iface(size_t chan = 0) = 0;
virtual sensor_value_t get_rx_sensor(const std::string &name, size_t chan = 0) = 0;
virtual std::vector<std::string> get_rx_sensor_names(size_t chan = 0) = 0;
virtual void set_rx_dc_offset(const bool enb, size_t chan = ALL_CHANS) = 0;
virtual void set_rx_dc_offset(const std::complex<double> &offset, size_t chan = ALL_CHANS) = 0;
virtual void set_rx_iq_balance(const std::complex<double> &correction, size_t chan = ALL_CHANS) = 0;
/*******************************************************************
* TX methods
******************************************************************/
virtual void set_tx_subdev_spec(const uhd::usrp::subdev_spec_t &spec, size_t mboard = ALL_MBOARDS) = 0;
virtual uhd::usrp::subdev_spec_t get_tx_subdev_spec(size_t mboard = 0) = 0;
virtual size_t get_tx_num_channels(void) = 0;
virtual std::string get_tx_subdev_name(size_t chan = 0) = 0;
virtual void set_tx_rate(double rate, size_t chan = ALL_CHANS) = 0;
virtual double get_tx_rate(size_t chan = 0) = 0;
virtual meta_range_t get_tx_rates(size_t chan = 0) = 0;
virtual tune_result_t set_tx_freq(
const tune_request_t &tune_request, size_t chan = 0
) = 0;
virtual double get_tx_freq(size_t chan = 0) = 0;
virtual freq_range_t get_tx_freq_range(size_t chan = 0) = 0;
virtual void set_tx_gain(double gain, const std::string &name, size_t chan = 0) = 0;
void set_tx_gain(double gain, size_t chan = 0){
return this->set_tx_gain(gain, ALL_GAINS, chan);
}
virtual double get_tx_gain(const std::string &name, size_t chan = 0) = 0;
double get_tx_gain(size_t chan = 0){
return this->get_tx_gain(ALL_GAINS, chan);
}
virtual gain_range_t get_tx_gain_range(const std::string &name, size_t chan = 0) = 0;
gain_range_t get_tx_gain_range(size_t chan = 0){
return this->get_tx_gain_range(ALL_GAINS, chan);
}
virtual std::vector<std::string> get_tx_gain_names(size_t chan = 0) = 0;
virtual void set_tx_antenna(const std::string &ant, size_t chan = 0) = 0;
virtual std::string get_tx_antenna(size_t chan = 0) = 0;
virtual std::vector<std::string> get_tx_antennas(size_t chan = 0) = 0;
UHD_DEPRECATED bool get_tx_lo_locked(size_t chan = 0){
return this->get_tx_sensor("lo_locked", chan).to_bool();
}
virtual void set_tx_bandwidth(double bandwidth, size_t chan = 0) = 0;
virtual double get_tx_bandwidth(size_t chan = 0) = 0;
virtual meta_range_t get_tx_bandwidth_range(size_t chan = 0) = 0;
virtual dboard_iface::sptr get_tx_dboard_iface(size_t chan = 0) = 0;
virtual sensor_value_t get_tx_sensor(const std::string &name, size_t chan = 0) = 0;
virtual std::vector<std::string> get_tx_sensor_names(size_t chan = 0) = 0;
virtual void set_tx_dc_offset(const std::complex<double> &offset, size_t chan = ALL_CHANS) = 0;
virtual void set_tx_iq_balance(const std::complex<double> &correction, size_t chan = ALL_CHANS) = 0;
};
}}
#endif /* INCLUDED_UHD_USRP_MULTI_USRP_HPP */