UHD 003.005.002-0-unknown

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
multi_usrp.hpp
Go to the documentation of this file.
1 //
2 // Copyright 2010-2012 Ettus Research LLC
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 //
17
18 #ifndef INCLUDED_UHD_USRP_MULTI_USRP_HPP
19 #define INCLUDED_UHD_USRP_MULTI_USRP_HPP
20
21 //define API capabilities for compile time detection of new features
22 #define UHD_USRP_MULTI_USRP_REF_SOURCES_API
23 #define UHD_USRP_MULTI_USRP_GET_RATES_API
24 #define UHD_USRP_MULTI_USRP_FRONTEND_CAL_API
25 #define UHD_USRP_MULTI_USRP_COMMAND_TIME_API
26 #define UHD_USRP_MULTI_USRP_BW_RANGE_API
27 #define UHD_USRP_MULTI_USRP_USER_REGS_API
28 #define UHD_USRP_MULTI_USRP_GET_USRP_INFO_API
29
30 #include <uhd/config.hpp>
31 #include <uhd/device.hpp>
32 #include <uhd/deprecated.hpp>
33 #include <uhd/types/ranges.hpp>
34 #include <uhd/types/stream_cmd.hpp>
35 #include <uhd/types/tune_request.hpp>
36 #include <uhd/types/tune_result.hpp>
37 #include <uhd/types/sensors.hpp>
38 #include <uhd/usrp/subdev_spec.hpp>
39 #include <uhd/usrp/dboard_iface.hpp>
40 #include <boost/shared_ptr.hpp>
41 #include <boost/utility.hpp>
42 #include <complex>
43 #include <string>
44 #include <vector>
45
46 namespace uhd{ namespace usrp{
47
94 class UHD_API multi_usrp : boost::noncopyable{
95 public:
96 typedef boost::shared_ptr<multi_usrp> sptr;
97
99 static const size_t ALL_MBOARDS = size_t(~0);
100
102 static const size_t ALL_CHANS = size_t(~0);
103
105 static const std::string ALL_GAINS;
106
112 static sptr make(const device_addr_t &dev_addr);
113
119 virtual device::sptr get_device(void) = 0;
120
122 rx_streamer::sptr get_rx_stream(const stream_args_t &args){
123 return this->get_device()->get_rx_stream(args);
124 }
125
127 tx_streamer::sptr get_tx_stream(const stream_args_t &args){
128 return this->get_device()->get_tx_stream(args);
129 }
130
138 virtual dict<std::string, std::string> get_usrp_rx_info(size_t chan = 0) = 0;
139
147 virtual dict<std::string, std::string> get_usrp_tx_info(size_t chan = 0) = 0;
148
149 /*******************************************************************
150 * Mboard methods
151 ******************************************************************/
152
163 virtual void set_master_clock_rate(double rate, size_t mboard = ALL_MBOARDS) = 0;
164
170 virtual double get_master_clock_rate(size_t mboard = 0) = 0;
171
176 virtual std::string get_pp_string(void) = 0;
177
183 virtual std::string get_mboard_name(size_t mboard = 0) = 0;
184
190 virtual time_spec_t get_time_now(size_t mboard = 0) = 0;
191
197 virtual time_spec_t get_time_last_pps(size_t mboard = 0) = 0;
198
210 virtual void set_time_now(const time_spec_t &time_spec, size_t mboard = ALL_MBOARDS) = 0;
211
224 virtual void set_time_next_pps(const time_spec_t &time_spec, size_t mboard = ALL_MBOARDS) = 0;
225
241 virtual void set_time_unknown_pps(const time_spec_t &time_spec) = 0;
242
249 virtual bool get_time_synchronized(void) = 0;
250
261 virtual void set_command_time(const uhd::time_spec_t &time_spec, size_t mboard = ALL_MBOARDS) = 0;
262
268 virtual void clear_command_time(size_t mboard = ALL_MBOARDS) = 0;
269
282 virtual void issue_stream_cmd(const stream_cmd_t &stream_cmd, size_t chan = ALL_CHANS) = 0;
283
292 virtual void set_clock_config(const clock_config_t &clock_config, size_t mboard = ALL_MBOARDS) = 0;
293
302 virtual void set_time_source(const std::string &source, const size_t mboard = ALL_MBOARDS) = 0;
303
309 virtual std::string get_time_source(const size_t mboard) = 0;
310
316 virtual std::vector<std::string> get_time_sources(const size_t mboard) = 0;
317
325 virtual void set_clock_source(const std::string &source, const size_t mboard = ALL_MBOARDS) = 0;
326
332 virtual std::string get_clock_source(const size_t mboard) = 0;
333
339 virtual std::vector<std::string> get_clock_sources(const size_t mboard) = 0;
340
344 virtual size_t get_num_mboards(void) = 0;
345
352 virtual sensor_value_t get_mboard_sensor(const std::string &name, size_t mboard = 0) = 0;
353
359 virtual std::vector<std::string> get_mboard_sensor_names(size_t mboard = 0) = 0;
360
368 virtual void set_user_register(const boost::uint8_t addr, const boost::uint32_t data, size_t mboard = ALL_MBOARDS) = 0;
369
370 /*******************************************************************
371 * RX methods
372 ******************************************************************/
381 virtual void set_rx_subdev_spec(const uhd::usrp::subdev_spec_t &spec, size_t mboard = ALL_MBOARDS) = 0;
382
388 virtual uhd::usrp::subdev_spec_t get_rx_subdev_spec(size_t mboard = 0) = 0;
389
395 virtual size_t get_rx_num_channels(void) = 0;
396
402 virtual std::string get_rx_subdev_name(size_t chan = 0) = 0;
403
409 virtual void set_rx_rate(double rate, size_t chan = ALL_CHANS) = 0;
410
416 virtual double get_rx_rate(size_t chan = 0) = 0;
417
423 virtual meta_range_t get_rx_rates(size_t chan = 0) = 0;
424
431 virtual tune_result_t set_rx_freq(
432 const tune_request_t &tune_request, size_t chan = 0
433 ) = 0;
434
440 virtual double get_rx_freq(size_t chan = 0) = 0;
441
447 virtual freq_range_t get_rx_freq_range(size_t chan = 0) = 0;
448
454 virtual freq_range_t get_fe_rx_freq_range(size_t chan = 0) = 0;
455
463 virtual void set_rx_gain(double gain, const std::string &name, size_t chan = 0) = 0;
464
466 void set_rx_gain(double gain, size_t chan = 0){
467 return this->set_rx_gain(gain, ALL_GAINS, chan);
468 }
469
477 virtual double get_rx_gain(const std::string &name, size_t chan = 0) = 0;
478
480 double get_rx_gain(size_t chan = 0){
481 return this->get_rx_gain(ALL_GAINS, chan);
482 }
483
491 virtual gain_range_t get_rx_gain_range(const std::string &name, size_t chan = 0) = 0;
492
494 gain_range_t get_rx_gain_range(size_t chan = 0){
495 return this->get_rx_gain_range(ALL_GAINS, chan);
496 }
497
504 virtual std::vector<std::string> get_rx_gain_names(size_t chan = 0) = 0;
505
511 virtual void set_rx_antenna(const std::string &ant, size_t chan = 0) = 0;
512
518 virtual std::string get_rx_antenna(size_t chan = 0) = 0;
519
525 virtual std::vector<std::string> get_rx_antennas(size_t chan = 0) = 0;
526
532 UHD_DEPRECATED bool get_rx_lo_locked(size_t chan = 0){
533 return this->get_rx_sensor("lo_locked", chan).to_bool();
534 }
535
541 virtual void set_rx_bandwidth(double bandwidth, size_t chan = 0) = 0;
542
548 virtual double get_rx_bandwidth(size_t chan = 0) = 0;
549
555 virtual meta_range_t get_rx_bandwidth_range(size_t chan = 0) = 0;
556
563 UHD_DEPRECATED double read_rssi(size_t chan = 0){
564 return this->get_rx_sensor("rssi", chan).to_real();
565 }
566
574 virtual dboard_iface::sptr get_rx_dboard_iface(size_t chan = 0) = 0;
575
582 virtual sensor_value_t get_rx_sensor(const std::string &name, size_t chan = 0) = 0;
583
589 virtual std::vector<std::string> get_rx_sensor_names(size_t chan = 0) = 0;
590
603 virtual void set_rx_dc_offset(const bool enb, size_t chan = ALL_CHANS) = 0;
604
612 virtual void set_rx_dc_offset(const std::complex<double> &offset, size_t chan = ALL_CHANS) = 0;
613
621 virtual void set_rx_iq_balance(const std::complex<double> &correction, size_t chan = ALL_CHANS) = 0;
622
623 /*******************************************************************
624 * TX methods
625 ******************************************************************/
634 virtual void set_tx_subdev_spec(const uhd::usrp::subdev_spec_t &spec, size_t mboard = ALL_MBOARDS) = 0;
635
641 virtual uhd::usrp::subdev_spec_t get_tx_subdev_spec(size_t mboard = 0) = 0;
642
648 virtual size_t get_tx_num_channels(void) = 0;
649
655 virtual std::string get_tx_subdev_name(size_t chan = 0) = 0;
656
662 virtual void set_tx_rate(double rate, size_t chan = ALL_CHANS) = 0;
663
669 virtual double get_tx_rate(size_t chan = 0) = 0;
670
676 virtual meta_range_t get_tx_rates(size_t chan = 0) = 0;
677
684 virtual tune_result_t set_tx_freq(
685 const tune_request_t &tune_request, size_t chan = 0
686 ) = 0;
687
693 virtual double get_tx_freq(size_t chan = 0) = 0;
694
700 virtual freq_range_t get_tx_freq_range(size_t chan = 0) = 0;
701
707 virtual freq_range_t get_fe_tx_freq_range(size_t chan = 0) = 0;
708
716 virtual void set_tx_gain(double gain, const std::string &name, size_t chan = 0) = 0;
717
719 void set_tx_gain(double gain, size_t chan = 0){
720 return this->set_tx_gain(gain, ALL_GAINS, chan);
721 }
722
730 virtual double get_tx_gain(const std::string &name, size_t chan = 0) = 0;
731
733 double get_tx_gain(size_t chan = 0){
734 return this->get_tx_gain(ALL_GAINS, chan);
735 }
736
744 virtual gain_range_t get_tx_gain_range(const std::string &name, size_t chan = 0) = 0;
745
747 gain_range_t get_tx_gain_range(size_t chan = 0){
748 return this->get_tx_gain_range(ALL_GAINS, chan);
749 }
750
757 virtual std::vector<std::string> get_tx_gain_names(size_t chan = 0) = 0;
758
764 virtual void set_tx_antenna(const std::string &ant, size_t chan = 0) = 0;
765
771 virtual std::string get_tx_antenna(size_t chan = 0) = 0;
772
778 virtual std::vector<std::string> get_tx_antennas(size_t chan = 0) = 0;
779
785 UHD_DEPRECATED bool get_tx_lo_locked(size_t chan = 0){
786 return this->get_tx_sensor("lo_locked", chan).to_bool();
787 }
788
794 virtual void set_tx_bandwidth(double bandwidth, size_t chan = 0) = 0;
795
801 virtual double get_tx_bandwidth(size_t chan = 0) = 0;
802
808 virtual meta_range_t get_tx_bandwidth_range(size_t chan = 0) = 0;
809
817 virtual dboard_iface::sptr get_tx_dboard_iface(size_t chan = 0) = 0;
818
825 virtual sensor_value_t get_tx_sensor(const std::string &name, size_t chan = 0) = 0;
826
832 virtual std::vector<std::string> get_tx_sensor_names(size_t chan = 0) = 0;
833
840 virtual void set_tx_dc_offset(const std::complex<double> &offset, size_t chan = ALL_CHANS) = 0;
841
849 virtual void set_tx_iq_balance(const std::complex<double> &correction, size_t chan = ALL_CHANS) = 0;
850
851 };
852
853 }}
854
855 #endif /* INCLUDED_UHD_USRP_MULTI_USRP_HPP */
uhd::usrp::multi_usrp::get_rx_gain_range
gain_range_t get_rx_gain_range(size_t chan=0)
A convenience wrapper for getting overall RX gain range.
Definition: multi_usrp.hpp:494
deprecated.hpp
uhd::stream_cmd_t
Definition: stream_cmd.hpp:46
uhd::usrp::multi_usrp::get_tx_lo_locked
UHD_DEPRECATED bool get_tx_lo_locked(size_t chan=0)
Definition: multi_usrp.hpp:785
device.hpp
uhd::tune_result_t
Definition: tune_result.hpp:29
uhd::usrp::multi_usrp::get_tx_gain
double get_tx_gain(size_t chan=0)
A convenience wrapper for getting overall TX gain.
Definition: multi_usrp.hpp:733
UHD_DEPRECATED
#define UHD_DEPRECATED
Definition: config.hpp:68
subdev_spec.hpp
uhd::usrp::multi_usrp::set_tx_gain
void set_tx_gain(double gain, size_t chan=0)
A convenience wrapper for setting overall TX gain.
Definition: multi_usrp.hpp:719
uhd::time_spec_t
Definition: time_spec.hpp:39
uhd::dict< std::string, std::string >
uhd::device::sptr
boost::shared_ptr< device > sptr
Definition: device.hpp:40
sensors.hpp
uhd::usrp::multi_usrp::sptr
boost::shared_ptr< multi_usrp > sptr
Definition: multi_usrp.hpp:96
config.hpp
uhd::usrp::multi_usrp::get_rx_gain
double get_rx_gain(size_t chan=0)
A convenience wrapper for getting overall RX gain.
Definition: multi_usrp.hpp:480
uhd::tune_request_t
Definition: tune_request.hpp:32
uhd::rx_streamer::sptr
boost::shared_ptr< rx_streamer > sptr
Definition: stream.hpp:125
uhd::usrp::multi_usrp::ALL_GAINS
static const std::string ALL_GAINS
A wildcard gain element name.
Definition: multi_usrp.hpp:105
stream_cmd.hpp
UHD_API
#define UHD_API
Definition: config.hpp:76
uhd::sensor_value_t
Definition: sensors.hpp:38
uhd::clock_config_t
Definition: clock_config.hpp:36
dboard_iface.hpp
uhd::usrp::multi_usrp
Definition: multi_usrp.hpp:94
uhd::usrp::multi_usrp::get_rx_stream
rx_streamer::sptr get_rx_stream(const stream_args_t &args)
Convenience method to get a RX streamer.
Definition: multi_usrp.hpp:122
ranges.hpp
uhd::stream_args_t
Definition: stream.hpp:39
uhd::usrp::multi_usrp::get_rx_lo_locked
UHD_DEPRECATED bool get_rx_lo_locked(size_t chan=0)
Definition: multi_usrp.hpp:532
tune_request.hpp
uhd::usrp::dboard_iface::sptr
boost::shared_ptr< dboard_iface > sptr
Definition: dboard_iface.hpp:60
uhd::usrp::multi_usrp::set_rx_gain
void set_rx_gain(double gain, size_t chan=0)
A convenience wrapper for setting overall RX gain.
Definition: multi_usrp.hpp:466
uhd::usrp::subdev_spec_t
Definition: subdev_spec.hpp:66
uhd::usrp::multi_usrp::read_rssi
UHD_DEPRECATED double read_rssi(size_t chan=0)
Definition: multi_usrp.hpp:563
uhd::meta_range_t
Definition: ranges.hpp:68
uhd::tx_streamer::sptr
boost::shared_ptr< tx_streamer > sptr
Definition: stream.hpp:182
tune_result.hpp
uhd::usrp::multi_usrp::get_tx_stream
tx_streamer::sptr get_tx_stream(const stream_args_t &args)
Convenience method to get a TX streamer.
Definition: multi_usrp.hpp:127
uhd::usrp::multi_usrp::get_tx_gain_range
gain_range_t get_tx_gain_range(size_t chan=0)
A convenience wrapper for getting overall TX gain range.
Definition: multi_usrp.hpp:747
uhd::device_addr_t
Definition: device_addr.hpp:47