root / host / include / uhd / usrp / simple_usrp.hpp @ 695dd535
History | View | Annotate | Download (5.33 KB)
| 1 |
//
|
|---|---|
| 2 |
// Copyright 2010 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_SIMPLE_USRP_HPP
|
| 19 |
#define INCLUDED_UHD_USRP_SIMPLE_USRP_HPP
|
| 20 |
|
| 21 |
#include <uhd/config.hpp> |
| 22 |
#include <uhd/device.hpp> |
| 23 |
#include <uhd/types/ranges.hpp> |
| 24 |
#include <uhd/types/stream_cmd.hpp> |
| 25 |
#include <uhd/types/clock_config.hpp> |
| 26 |
#include <uhd/types/tune_result.hpp> |
| 27 |
#include <boost/shared_ptr.hpp> |
| 28 |
#include <boost/utility.hpp> |
| 29 |
#include <vector> |
| 30 |
|
| 31 |
namespace uhd{ namespace usrp{ |
| 32 |
|
| 33 |
/*!
|
| 34 |
* The simple USRP device class:
|
| 35 |
* A simple usrp facilitates ease-of-use for most use-case scenarios.
|
| 36 |
* The wrapper provides convenience functions to tune the devices
|
| 37 |
* as well as to set the dboard gains, antennas, and other properties.
|
| 38 |
*/
|
| 39 |
class UHD_API simple_usrp : boost::noncopyable{ |
| 40 |
public:
|
| 41 |
typedef boost::shared_ptr<simple_usrp> sptr;
|
| 42 |
|
| 43 |
/*!
|
| 44 |
* Make a new simple usrp from the device address.
|
| 45 |
* \param dev_addr the device address
|
| 46 |
* \return a new simple usrp object
|
| 47 |
*/
|
| 48 |
static sptr make(const device_addr_t &dev_addr); |
| 49 |
|
| 50 |
/*!
|
| 51 |
* Get the underlying device object.
|
| 52 |
* This is needed to get access to the streaming API and properties.
|
| 53 |
* \return the device object within this simple usrp
|
| 54 |
*/
|
| 55 |
virtual device::sptr get_device(void) = 0; |
| 56 |
|
| 57 |
/*!
|
| 58 |
* Get a printable name for this simple usrp.
|
| 59 |
* \return a printable string
|
| 60 |
*/
|
| 61 |
virtual std::string get_name(void) = 0; |
| 62 |
|
| 63 |
/*******************************************************************
|
| 64 |
* Misc
|
| 65 |
******************************************************************/
|
| 66 |
/*!
|
| 67 |
* Sets the time registers on the usrp immediately.
|
| 68 |
* \param time_spec the time to latch into the usrp device
|
| 69 |
*/
|
| 70 |
virtual void set_time_now(const time_spec_t &time_spec) = 0; |
| 71 |
|
| 72 |
/*!
|
| 73 |
* Set the time registers on the usrp at the next pps tick.
|
| 74 |
* The values will not be latched in until the pulse occurs.
|
| 75 |
* It is recommended that the user sleep(1) after calling to ensure
|
| 76 |
* that the time registers will be in a known state prior to use.
|
| 77 |
*
|
| 78 |
* Note: Because this call sets the time on the "next" pps,
|
| 79 |
* the seconds in the time spec should be current seconds + 1.
|
| 80 |
*
|
| 81 |
* \param time_spec the time to latch into the usrp device
|
| 82 |
*/
|
| 83 |
virtual void set_time_next_pps(const time_spec_t &time_spec) = 0; |
| 84 |
|
| 85 |
/*!
|
| 86 |
* Issue a stream command to the usrp device.
|
| 87 |
* This tells the usrp to send samples into the host.
|
| 88 |
* See the documentation for stream_cmd_t for more info.
|
| 89 |
* \param stream_cmd the stream command to issue
|
| 90 |
*/
|
| 91 |
virtual void issue_stream_cmd(const stream_cmd_t &stream_cmd) = 0; |
| 92 |
|
| 93 |
/*!
|
| 94 |
* Set the clock configuration for the usrp device.
|
| 95 |
* This tells the usrp how to get a 10Mhz reference and PPS clock.
|
| 96 |
* See the documentation for clock_config_t for more info.
|
| 97 |
* \param clock_config the clock configuration to set
|
| 98 |
*/
|
| 99 |
virtual void set_clock_config(const clock_config_t &clock_config) = 0; |
| 100 |
|
| 101 |
/*!
|
| 102 |
* Read the RSSI value from a usrp device.
|
| 103 |
* Or throw if the dboard does not support an RSSI readback.
|
| 104 |
* \return the rssi in dB
|
| 105 |
*/
|
| 106 |
virtual float read_rssi(void) = 0; |
| 107 |
|
| 108 |
/*******************************************************************
|
| 109 |
* RX methods
|
| 110 |
******************************************************************/
|
| 111 |
virtual void set_rx_rate(double rate) = 0; |
| 112 |
virtual double get_rx_rate(void) = 0; |
| 113 |
|
| 114 |
virtual tune_result_t set_rx_freq(double freq) = 0; |
| 115 |
virtual tune_result_t set_rx_freq(double freq, double lo_off) = 0; |
| 116 |
virtual freq_range_t get_rx_freq_range(void) = 0; |
| 117 |
|
| 118 |
virtual void set_rx_gain(float gain) = 0; |
| 119 |
virtual float get_rx_gain(void) = 0; |
| 120 |
virtual gain_range_t get_rx_gain_range(void) = 0; |
| 121 |
|
| 122 |
virtual void set_rx_antenna(const std::string &ant) = 0; |
| 123 |
virtual std::string get_rx_antenna(void) = 0; |
| 124 |
virtual std::vector<std::string> get_rx_antennas(void) = 0; |
| 125 |
|
| 126 |
virtual bool get_rx_lo_locked(void) = 0; |
| 127 |
|
| 128 |
/*******************************************************************
|
| 129 |
* TX methods
|
| 130 |
******************************************************************/
|
| 131 |
virtual void set_tx_rate(double rate) = 0; |
| 132 |
virtual double get_tx_rate(void) = 0; |
| 133 |
|
| 134 |
virtual tune_result_t set_tx_freq(double freq) = 0; |
| 135 |
virtual tune_result_t set_tx_freq(double freq, double lo_off) = 0; |
| 136 |
virtual freq_range_t get_tx_freq_range(void) = 0; |
| 137 |
|
| 138 |
virtual void set_tx_gain(float gain) = 0; |
| 139 |
virtual float get_tx_gain(void) = 0; |
| 140 |
virtual gain_range_t get_tx_gain_range(void) = 0; |
| 141 |
|
| 142 |
virtual void set_tx_antenna(const std::string &ant) = 0; |
| 143 |
virtual std::string get_tx_antenna(void) = 0; |
| 144 |
virtual std::vector<std::string> get_tx_antennas(void) = 0; |
| 145 |
|
| 146 |
virtual bool get_tx_lo_locked(void) = 0; |
| 147 |
}; |
| 148 |
|
| 149 |
}} |
| 150 |
|
| 151 |
#endif /* INCLUDED_UHD_USRP_SIMPLE_USRP_HPP */ |