summaryrefslogtreecommitdiffstats
path: root/host/include
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-09-24 15:53:03 -0700
committerJosh Blum <josh@joshknows.com>2010-09-24 15:53:03 -0700
commit192663bcc919a794a24eabb38d12519f445b7a47 (patch)
treeba55269010c4484bef12d4019c691d9e469165d7 /host/include
parent77cdb4a9695e71e64e1d87cfad2cb4d8717f971e (diff)
parent5d6d25b49cc783ef012410064bc9eb0e66e50227 (diff)
downloaduhd-192663bcc919a794a24eabb38d12519f445b7a47.tar.gz
uhd-192663bcc919a794a24eabb38d12519f445b7a47.tar.bz2
uhd-192663bcc919a794a24eabb38d12519f445b7a47.zip
Merge branch 'master' into usrp_e
Conflicts: host/CMakeLists.txt
Diffstat (limited to 'host/include')
-rw-r--r--host/include/uhd/device.hpp13
-rw-r--r--host/include/uhd/device.ipp26
-rw-r--r--host/include/uhd/transport/usb_device_handle.hpp12
-rw-r--r--host/include/uhd/transport/usb_zero_copy.hpp2
-rw-r--r--host/include/uhd/usrp/CMakeLists.txt1
-rw-r--r--host/include/uhd/usrp/dsp_props.hpp11
-rw-r--r--host/include/uhd/usrp/simple_usrp.hpp5
-rw-r--r--host/include/uhd/usrp/single_usrp.hpp172
-rw-r--r--host/include/uhd/usrp/tune_helper.hpp18
9 files changed, 201 insertions, 59 deletions
diff --git a/host/include/uhd/device.hpp b/host/include/uhd/device.hpp
index c48b3dfff..2077cae62 100644
--- a/host/include/uhd/device.hpp
+++ b/host/include/uhd/device.hpp
@@ -26,7 +26,6 @@
#include <boost/utility.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/function.hpp>
-#include <boost/asio/buffer.hpp>
#include <vector>
namespace uhd{
@@ -140,12 +139,6 @@ public:
send_mode_t send_mode
);
- //! Deprecated
- size_t send(
- const boost::asio::const_buffer &, const tx_metadata_t &,
- const io_type_t &, send_mode_t send_mode
- );
-
/*!
* Receive buffers containing IF data described by the metadata.
*
@@ -196,12 +189,6 @@ public:
size_t timeout_ms = default_recv_timeout_ms
);
- //! Deprecated
- size_t recv(
- const boost::asio::mutable_buffer &, rx_metadata_t &,
- const io_type_t &, recv_mode_t
- );
-
/*!
* Get the maximum number of samples per packet on send.
* \return the number of samples
diff --git a/host/include/uhd/device.ipp b/host/include/uhd/device.ipp
index 603c52859..60a3f535d 100644
--- a/host/include/uhd/device.ipp
+++ b/host/include/uhd/device.ipp
@@ -34,19 +34,6 @@ namespace uhd{
);
}
- UHD_DEPRECATED UHD_INLINE size_t device::send(
- const boost::asio::const_buffer &buff,
- const tx_metadata_t &metadata,
- const io_type_t &io_type,
- send_mode_t send_mode
- ){
- return this->send(
- boost::asio::buffer_cast<const void *>(buff),
- boost::asio::buffer_size(buff)/io_type.size,
- metadata, io_type, send_mode
- );
- }
-
UHD_INLINE size_t device::recv(
void *buff,
size_t nsamps_per_buff,
@@ -62,19 +49,6 @@ namespace uhd{
);
}
- UHD_DEPRECATED UHD_INLINE size_t device::recv(
- const boost::asio::mutable_buffer &buff,
- rx_metadata_t &metadata,
- const io_type_t &io_type,
- recv_mode_t recv_mode
- ){
- return this->recv(
- boost::asio::buffer_cast<void *>(buff),
- boost::asio::buffer_size(buff)/io_type.size,
- metadata, io_type, recv_mode
- );
- }
-
} //namespace uhd
#endif /* INCLUDED_UHD_DEVICE_IPP */
diff --git a/host/include/uhd/transport/usb_device_handle.hpp b/host/include/uhd/transport/usb_device_handle.hpp
index c3eb72b00..735a3acbe 100644
--- a/host/include/uhd/transport/usb_device_handle.hpp
+++ b/host/include/uhd/transport/usb_device_handle.hpp
@@ -38,7 +38,7 @@ namespace uhd { namespace transport {
* a true descriptor serial number string. This interface returns the
* actual string descriptor.
*/
-class UHD_API usb_device_handle : boost::noncopyable {
+class usb_device_handle : boost::noncopyable {
public:
typedef boost::shared_ptr<usb_device_handle> sptr;
@@ -46,31 +46,31 @@ public:
* Return the device's serial number
* \return a string describing the device's serial number
*/
- virtual UHD_API std::string get_serial() const = 0;
+ virtual std::string get_serial() const = 0;
/*!
* Return the device's Vendor ID (usually assigned by the USB-IF)
* \return a Vendor ID
*/
- virtual UHD_API boost::uint16_t get_vendor_id() const = 0;
+ virtual boost::uint16_t get_vendor_id() const = 0;
/*!
* Return the device's Product ID (usually assigned by manufacturer)
* \return a Product ID
*/
- virtual UHD_API boost::uint16_t get_product_id() const = 0;
+ virtual boost::uint16_t get_product_id() const = 0;
/*!
* Return the device's USB address
* \return a Product ID
*/
- virtual UHD_API boost::uint16_t get_device_addr() const = 0;
+ virtual boost::uint16_t get_device_addr() const = 0;
/*!
* Return a vector of USB devices on this host
* \return a vector of USB device handles that match vid and pid
*/
- static UHD_API std::vector<usb_device_handle::sptr> get_device_list(boost::uint16_t vid, boost::uint16_t pid);
+ static std::vector<usb_device_handle::sptr> get_device_list(boost::uint16_t vid, boost::uint16_t pid);
}; //namespace usb
diff --git a/host/include/uhd/transport/usb_zero_copy.hpp b/host/include/uhd/transport/usb_zero_copy.hpp
index 2edd6d91d..75232c22a 100644
--- a/host/include/uhd/transport/usb_zero_copy.hpp
+++ b/host/include/uhd/transport/usb_zero_copy.hpp
@@ -53,7 +53,7 @@ public:
static sptr make(usb_device_handle::sptr handle,
unsigned int rx_endpoint,
unsigned int tx_endpoint,
- size_t buff_size = 0,
+ size_t buff_size = 0,
size_t block_size = 0);
};
diff --git a/host/include/uhd/usrp/CMakeLists.txt b/host/include/uhd/usrp/CMakeLists.txt
index 130956f8a..f973e401a 100644
--- a/host/include/uhd/usrp/CMakeLists.txt
+++ b/host/include/uhd/usrp/CMakeLists.txt
@@ -40,6 +40,7 @@ INSTALL(FILES
### interfaces ###
simple_usrp.hpp
+ single_usrp.hpp
mimo_usrp.hpp
DESTINATION ${INCLUDE_DIR}/uhd/usrp
diff --git a/host/include/uhd/usrp/dsp_props.hpp b/host/include/uhd/usrp/dsp_props.hpp
index 75d8c0a60..54ea5666b 100644
--- a/host/include/uhd/usrp/dsp_props.hpp
+++ b/host/include/uhd/usrp/dsp_props.hpp
@@ -37,11 +37,12 @@ namespace uhd{ namespace usrp{
* Set the shift property and read it back to get actual shift.
*/
enum dsp_prop_t{
- DSP_PROP_NAME = 'n', //ro, std::string
- DSP_PROP_OTHERS = 'o', //ro, prop_names_t
- DSP_PROP_FREQ_SHIFT = 'f', //rw, double Hz
- DSP_PROP_CODEC_RATE = 'c', //ro, double Sps
- DSP_PROP_HOST_RATE = 'h' //rw, double Sps
+ DSP_PROP_NAME = 'n', //ro, std::string
+ DSP_PROP_OTHERS = 'o', //ro, prop_names_t
+ DSP_PROP_FREQ_SHIFT = 'f', //rw, double Hz
+ DSP_PROP_FREQ_SHIFT_NAMES = 'F', //ro, prop_names_t
+ DSP_PROP_CODEC_RATE = 'c', //ro, double Sps
+ DSP_PROP_HOST_RATE = 'h' //rw, double Sps
};
}} //namespace
diff --git a/host/include/uhd/usrp/simple_usrp.hpp b/host/include/uhd/usrp/simple_usrp.hpp
index 08b9c01ea..6149f739c 100644
--- a/host/include/uhd/usrp/simple_usrp.hpp
+++ b/host/include/uhd/usrp/simple_usrp.hpp
@@ -33,12 +33,13 @@
namespace uhd{ namespace usrp{
/*!
- * The simple USRP device class:
+ * The simple USRP device class (DEPRECATED):
+ * This interface has been deprecated in favor of the single USRP interface.
* A simple 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.
*/
-class UHD_API simple_usrp : boost::noncopyable{
+class UHD_API UHD_DEPRECATED simple_usrp : boost::noncopyable{
public:
typedef boost::shared_ptr<simple_usrp> sptr;
diff --git a/host/include/uhd/usrp/single_usrp.hpp b/host/include/uhd/usrp/single_usrp.hpp
new file mode 100644
index 000000000..1b89a3620
--- /dev/null
+++ b/host/include/uhd/usrp/single_usrp.hpp
@@ -0,0 +1,172 @@
+//
+// Copyright 2010 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_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_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>
+
+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;
+
+ /*!
+ * 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;
+
+ /*!
+ * Get a printable name for this usrp.
+ * \return a printable string
+ */
+ virtual std::string get_pp_string(void) = 0;
+
+ /*******************************************************************
+ * Misc
+ ******************************************************************/
+ /*!
+ * Gets the current time in the usrp time registers.
+ * \return a timespec representing current usrp time
+ */
+ virtual time_spec_t get_time_now(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
+ ******************************************************************/
+ virtual void set_rx_subdev_spec(const uhd::usrp::subdev_spec_t &spec) = 0;
+ virtual uhd::usrp::subdev_spec_t get_rx_subdev_spec(void) = 0;
+
+ virtual void set_rx_rate(double rate) = 0;
+ virtual double get_rx_rate(void) = 0;
+
+ virtual tune_result_t set_rx_freq(double freq, size_t chan = 0) = 0;
+ virtual tune_result_t set_rx_freq(double freq, double lo_off, 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(float gain, size_t chan = 0) = 0;
+ virtual float get_rx_gain(size_t chan = 0) = 0;
+ virtual gain_range_t get_rx_gain_range(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;
+
+ virtual bool get_rx_lo_locked(size_t chan = 0) = 0;
+
+ /*!
+ * Read the RSSI value from a usrp device.
+ * Or throw if the dboard does not support an RSSI readback.
+ * \return the rssi in dB
+ */
+ virtual float read_rssi(size_t chan = 0) = 0;
+
+ virtual dboard_iface::sptr get_rx_dboard_iface(size_t chan = 0) = 0;
+
+ /*******************************************************************
+ * TX methods
+ ******************************************************************/
+ virtual void set_tx_subdev_spec(const uhd::usrp::subdev_spec_t &spec) = 0;
+ virtual uhd::usrp::subdev_spec_t get_tx_subdev_spec(void) = 0;
+
+ virtual void set_tx_rate(double rate) = 0;
+ virtual double get_tx_rate(void) = 0;
+
+ virtual tune_result_t set_tx_freq(double freq, size_t chan = 0) = 0;
+ virtual tune_result_t set_tx_freq(double freq, double lo_off, 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(float gain, size_t chan = 0) = 0;
+ virtual float get_tx_gain(size_t chan = 0) = 0;
+ virtual gain_range_t get_tx_gain_range(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;
+
+ virtual bool get_tx_lo_locked(size_t chan = 0) = 0;
+
+ virtual dboard_iface::sptr get_tx_dboard_iface(size_t chan = 0) = 0;
+};
+
+}}
+
+#endif /* INCLUDED_UHD_USRP_SINGLE_USRP_HPP */
diff --git a/host/include/uhd/usrp/tune_helper.hpp b/host/include/uhd/usrp/tune_helper.hpp
index df3907b3e..ec133fa08 100644
--- a/host/include/uhd/usrp/tune_helper.hpp
+++ b/host/include/uhd/usrp/tune_helper.hpp
@@ -31,12 +31,13 @@ namespace uhd{ namespace usrp{
* The ddc cordic is setup to bring the IF down to baseband.
* \param subdev the dboard subdevice object with properties
* \param ddc the mboard dsp object with properties
+ * \param chan the channel of the dsp to tune
* \param target_freq the desired center frequency
* \param lo_offset an offset for the subdevice IF from center
* \return a tune result struct
*/
UHD_API tune_result_t tune_rx_subdev_and_dsp(
- wax::obj subdev, wax::obj ddc,
+ wax::obj subdev, wax::obj ddc, size_t chan,
double target_freq, double lo_offset
);
@@ -46,17 +47,19 @@ namespace uhd{ namespace usrp{
* is calculated based on the subdevice and BW.
*/
UHD_API tune_result_t tune_rx_subdev_and_dsp(
- wax::obj subdev, wax::obj ddc, double target_freq
+ wax::obj subdev, wax::obj ddc,
+ size_t chan, double target_freq
);
/*!
* Calculate the overall frequency from the combination of dboard IF and DDC shift.
* \param subdev the dboard subdevice object with properties
* \param ddc the mboard dsp object with properties
+ * \param chan the channel of the dsp to tune
* \return the overall tune frequency of the system in Hz
*/
UHD_API double derive_freq_from_rx_subdev_and_dsp(
- wax::obj subdev, wax::obj ddc
+ wax::obj subdev, wax::obj ddc, size_t chan
);
/*!
@@ -66,12 +69,13 @@ namespace uhd{ namespace usrp{
* The duc cordic is setup to bring the baseband up to IF.
* \param subdev the dboard subdevice object with properties
* \param duc the mboard dsp object with properties
+ * \param chan the channel of the dsp to tune
* \param target_freq the desired center frequency
* \param lo_offset an offset for the subdevice IF from center
* \return a tune result struct
*/
UHD_API tune_result_t tune_tx_subdev_and_dsp(
- wax::obj subdev, wax::obj duc,
+ wax::obj subdev, wax::obj duc, size_t chan,
double target_freq, double lo_offset
);
@@ -81,17 +85,19 @@ namespace uhd{ namespace usrp{
* is calculated based on the subdevice and BW.
*/
UHD_API tune_result_t tune_tx_subdev_and_dsp(
- wax::obj subdev, wax::obj duc, double target_freq
+ wax::obj subdev, wax::obj duc,
+ size_t chan, double target_freq
);
/*!
* Calculate the overall frequency from the combination of dboard IF and DUC shift.
* \param subdev the dboard subdevice object with properties
* \param duc the mboard dsp object with properties
+ * \param chan the channel of the dsp to tune
* \return the overall tune frequency of the system in Hz
*/
UHD_API double derive_freq_from_tx_subdev_and_dsp(
- wax::obj subdev, wax::obj duc
+ wax::obj subdev, wax::obj duc, size_t chan
);
}}