summaryrefslogtreecommitdiffstats
path: root/host/include
diff options
context:
space:
mode:
Diffstat (limited to 'host/include')
-rw-r--r--host/include/uhd/config.hpp11
-rw-r--r--host/include/uhd/types/tune_result.hpp10
-rw-r--r--host/include/uhd/usrp/mimo_usrp.hpp2
-rw-r--r--host/include/uhd/usrp/simple_usrp.hpp2
-rw-r--r--host/include/uhd/usrp/subdev_props.hpp22
-rw-r--r--host/include/uhd/usrp/tune_helper.hpp112
-rw-r--r--host/include/uhd/utils/byteswap.ipp6
7 files changed, 110 insertions, 55 deletions
diff --git a/host/include/uhd/config.hpp b/host/include/uhd/config.hpp
index 2360174a4..dacd3a96b 100644
--- a/host/include/uhd/config.hpp
+++ b/host/include/uhd/config.hpp
@@ -101,4 +101,15 @@
#define UHD_DEPRECATED
#endif
+// Platform defines for conditional parts of headers:
+// Taken from boost/config/select_platform_config.hpp,
+// however, we define macros, not strings for platforms.
+#if defined(linux) || defined(__linux) || defined(__linux__)
+ #define UHD_PLATFORM_LINUX
+#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
+ #define UHD_PLATFORM_WIN32
+#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
+ #define UHD_PLATFORM_MACOS
+#endif
+
#endif /* INCLUDED_UHD_CONFIG_HPP */
diff --git a/host/include/uhd/types/tune_result.hpp b/host/include/uhd/types/tune_result.hpp
index c428a7692..9eebc161a 100644
--- a/host/include/uhd/types/tune_result.hpp
+++ b/host/include/uhd/types/tune_result.hpp
@@ -19,6 +19,7 @@
#define INCLUDED_UHD_TYPES_TUNE_RESULT_HPP
#include <uhd/config.hpp>
+#include <string>
namespace uhd{
@@ -28,15 +29,18 @@ namespace uhd{
* the target and actual intermediate frequency.
* The struct hold the result of tuning the DSP as
* the target and actual digital converter frequency.
- * It also tell us weather or not the spectrum is inverted.
*/
struct UHD_API tune_result_t{
double target_inter_freq;
double actual_inter_freq;
double target_dsp_freq;
double actual_dsp_freq;
- bool spectrum_inverted;
- tune_result_t(void);
+
+ /*!
+ * Create a pretty print string for this tune result struct.
+ * \return the printable string
+ */
+ std::string to_pp_string(void) const;
};
} //namespace uhd
diff --git a/host/include/uhd/usrp/mimo_usrp.hpp b/host/include/uhd/usrp/mimo_usrp.hpp
index 68a42cad8..fd0f4596f 100644
--- a/host/include/uhd/usrp/mimo_usrp.hpp
+++ b/host/include/uhd/usrp/mimo_usrp.hpp
@@ -124,6 +124,7 @@ public:
virtual tune_result_t set_rx_freq(size_t chan, double freq) = 0;
virtual tune_result_t set_rx_freq(size_t chan, double freq, double lo_off) = 0;
+ virtual double get_rx_freq(size_t chan) = 0;
virtual freq_range_t get_rx_freq_range(size_t chan) = 0;
virtual void set_rx_gain(size_t chan, float gain) = 0;
@@ -152,6 +153,7 @@ public:
virtual tune_result_t set_tx_freq(size_t chan, double freq) = 0;
virtual tune_result_t set_tx_freq(size_t chan, double freq, double lo_off) = 0;
+ virtual double get_tx_freq(size_t chan) = 0;
virtual freq_range_t get_tx_freq_range(size_t chan) = 0;
virtual void set_tx_gain(size_t chan, float gain) = 0;
diff --git a/host/include/uhd/usrp/simple_usrp.hpp b/host/include/uhd/usrp/simple_usrp.hpp
index 1d9136f08..a100579ce 100644
--- a/host/include/uhd/usrp/simple_usrp.hpp
+++ b/host/include/uhd/usrp/simple_usrp.hpp
@@ -112,6 +112,7 @@ public:
virtual tune_result_t set_rx_freq(double freq) = 0;
virtual tune_result_t set_rx_freq(double freq, double lo_off) = 0;
+ virtual double get_rx_freq(void) = 0;
virtual freq_range_t get_rx_freq_range(void) = 0;
virtual void set_rx_gain(float gain) = 0;
@@ -139,6 +140,7 @@ public:
virtual tune_result_t set_tx_freq(double freq) = 0;
virtual tune_result_t set_tx_freq(double freq, double lo_off) = 0;
+ virtual double get_tx_freq(void) = 0;
virtual freq_range_t get_tx_freq_range(void) = 0;
virtual void set_tx_gain(float gain) = 0;
diff --git a/host/include/uhd/usrp/subdev_props.hpp b/host/include/uhd/usrp/subdev_props.hpp
index 1f8e91d68..f7bdcd161 100644
--- a/host/include/uhd/usrp/subdev_props.hpp
+++ b/host/include/uhd/usrp/subdev_props.hpp
@@ -23,6 +23,22 @@
namespace uhd{ namespace usrp{
/*!
+ * Possible subdev connection types:
+ *
+ * A complex subdevice is physically connected to both channels,
+ * which may be connected in one of two ways: IQ or QI (swapped).
+ *
+ * A real subdevice is only physically connected one channel,
+ * either only the I channel or only the Q channel.
+ */
+ enum subdev_conn_t{
+ SUBDEV_CONN_COMPLEX_IQ = 'C',
+ SUBDEV_CONN_COMPLEX_QI = 'c',
+ SUBDEV_CONN_REAL_I = 'R',
+ SUBDEV_CONN_REAL_Q = 'r'
+ };
+
+ /*!
* Possible device subdev properties
*/
enum subdev_prop_t{
@@ -36,9 +52,9 @@ namespace uhd{ namespace usrp{
SUBDEV_PROP_ANTENNA = 'a', //rw, std::string
SUBDEV_PROP_ANTENNA_NAMES = 'A', //ro, prop_names_t
SUBDEV_PROP_LO_LOCKED = 'L', //ro, bool
- SUBDEV_PROP_QUADRATURE = 'q', //ro, bool
- SUBDEV_PROP_IQ_SWAPPED = 'i', //ro, bool
- SUBDEV_PROP_SPECTRUM_INVERTED = 's', //ro, bool
+ SUBDEV_PROP_CONNECTION = 'c', //ro, subdev_conn_t
+ //SUBDEV_PROP_QUADRATURE = 'q', //ro, bool
+ //SUBDEV_PROP_IQ_SWAPPED = 'i', //ro, bool
SUBDEV_PROP_USE_LO_OFFSET = 'l', //ro, bool
SUBDEV_PROP_RSSI = 'R', //ro, float
SUBDEV_PROP_BANDWIDTH = 'B' //rw, double
diff --git a/host/include/uhd/usrp/tune_helper.hpp b/host/include/uhd/usrp/tune_helper.hpp
index f1e276d4f..df3907b3e 100644
--- a/host/include/uhd/usrp/tune_helper.hpp
+++ b/host/include/uhd/usrp/tune_helper.hpp
@@ -24,55 +24,75 @@
namespace uhd{ namespace usrp{
-/*!
- * Tune a rx chain to the desired frequency:
- * The IF of the subdevice is set as close as possible to
- * the given target frequency + the LO offset (when applicable).
- * The ddc cordic is setup to bring the IF down to baseband.
- * \param subdev the dboard subdevice object with properties
- * \param ddc the ddc properties object (with "if_rate", "bb_rate", "freq")
- * \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_ddc(
- wax::obj subdev, wax::obj ddc,
- double target_freq, double lo_offset
-);
+ /*!
+ * Tune a rx chain to the desired frequency:
+ * The IF of the subdevice is set as close as possible to
+ * the given target frequency + the LO offset (when applicable).
+ * 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 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,
+ double target_freq, double lo_offset
+ );
-/*!
- * Tune a rx chain to the desired frequency:
- * Same as the above, except the LO offset
- * is calculated based on the subdevice and BW.
- */
-UHD_API tune_result_t tune_rx_subdev_and_ddc(
- wax::obj subdev, wax::obj ddc, double target_freq
-);
+ /*!
+ * Tune a rx chain to the desired frequency:
+ * Same as the above, except the LO offset
+ * 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
+ );
-/*!
- * Tune a tx chain to the desired frequency:
- * The IF of the subdevice is set as close as possible to
- * the given target frequency + the LO offset (when applicable).
- * The duc cordic is setup to bring the baseband up to IF.
- * \param subdev the dboard subdevice object with properties
- * \param duc the duc properties object (with "if_rate", "bb_rate", "freq")
- * \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_duc(
- wax::obj subdev, wax::obj duc,
- double target_freq, double lo_offset
-);
+ /*!
+ * 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
+ * \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
+ );
-/*!
- * Tune a tx chain to the desired frequency:
- * Same as the above, except the LO offset
- * is calculated based on the subdevice and BW.
- */
-UHD_API tune_result_t tune_tx_subdev_and_duc(
- wax::obj subdev, wax::obj duc, double target_freq
-);
+ /*!
+ * Tune a tx chain to the desired frequency:
+ * The IF of the subdevice is set as close as possible to
+ * the given target frequency + the LO offset (when applicable).
+ * 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 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,
+ double target_freq, double lo_offset
+ );
+
+ /*!
+ * Tune a tx chain to the desired frequency:
+ * Same as the above, except the LO offset
+ * 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
+ );
+
+ /*!
+ * 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
+ * \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
+ );
}}
diff --git a/host/include/uhd/utils/byteswap.ipp b/host/include/uhd/utils/byteswap.ipp
index 11c82a4ec..a070a7cf5 100644
--- a/host/include/uhd/utils/byteswap.ipp
+++ b/host/include/uhd/utils/byteswap.ipp
@@ -21,7 +21,7 @@
/***********************************************************************
* Platform-specific implementation details for byteswap below:
**********************************************************************/
-#ifdef BOOST_MSVC //http://msdn.microsoft.com/en-us/library/a3140177%28VS.80%29.aspx
+#if defined(UHD_PLATFORM_WIN32) //http://msdn.microsoft.com/en-us/library/a3140177%28VS.80%29.aspx
#include <stdlib.h>
UHD_INLINE boost::uint16_t uhd::byteswap(boost::uint16_t x){
@@ -50,7 +50,7 @@
return __builtin_bswap64(x);
}
-#elif defined(__FreeBSD__) || defined(__MACOSX__) || defined(__APPLE__)
+#elif defined(UHD_PLATFORM_MACOS)
#include <libkern/OSByteOrder.h>
UHD_INLINE boost::uint16_t uhd::byteswap(boost::uint16_t x){
@@ -65,7 +65,7 @@
return OSSwapInt64(x);
}
-#elif defined(linux) || defined(__linux)
+#elif defined(UHD_PLATFORM_LINUX)
#include <byteswap.h>
UHD_INLINE boost::uint16_t uhd::byteswap(boost::uint16_t x){