aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorJulian Arnold <julian.arnold@ettus.com>2015-02-23 17:08:21 -0800
committerJulian Arnold <julian.arnold@ettus.com>2015-02-23 17:47:27 -0800
commit566dbc2b5d0751167c9d868743dbebfff4d22afe (patch)
tree2648136464cf6f1fc32719649a0c0b070d0f94b5 /host
parent2b06c3815551c99d7691a7aa3dbcf6eaedc9e998 (diff)
downloaduhd-566dbc2b5d0751167c9d868743dbebfff4d22afe.tar.gz
uhd-566dbc2b5d0751167c9d868743dbebfff4d22afe.tar.bz2
uhd-566dbc2b5d0751167c9d868743dbebfff4d22afe.zip
e3xx: support for dc offset and iq balance control
Diffstat (limited to 'host')
-rw-r--r--host/lib/usrp/common/ad9361_ctrl.cpp13
-rw-r--r--host/lib/usrp/common/ad9361_ctrl.hpp13
-rw-r--r--host/lib/usrp/e300/e300_network.cpp6
-rw-r--r--host/lib/usrp/e300/e300_remote_codec_ctrl.cpp28
-rw-r--r--host/lib/usrp/e300/e300_remote_codec_ctrl.hpp4
5 files changed, 49 insertions, 15 deletions
diff --git a/host/lib/usrp/common/ad9361_ctrl.cpp b/host/lib/usrp/common/ad9361_ctrl.cpp
index 4a3c17cf1..ada74cda5 100644
--- a/host/lib/usrp/common/ad9361_ctrl.cpp
+++ b/host/lib/usrp/common/ad9361_ctrl.cpp
@@ -16,7 +16,6 @@
//
#include "ad9361_ctrl.hpp"
-#include <uhd/exception.hpp>
#include <uhd/types/ranges.hpp>
#include <uhd/utils/msg.hpp>
#include <uhd/types/serial.hpp>
@@ -186,12 +185,6 @@ public:
_device.set_dc_offset_auto(direction,on);
}
- void set_dc_offset(const std::string &which, const std::complex<double> value)
- {
- //This feature should not be used according to Analog Devices
- throw uhd::runtime_error("ad9361_ctrl::set_dc_offset this feature is not supported on this device.");
- }
-
void set_iq_balance_auto(const std::string &which, const bool on)
{
boost::lock_guard<boost::mutex> lock(_mutex);
@@ -200,12 +193,6 @@ public:
_device.set_iq_balance_auto(direction,on);
}
- void set_iq_balance(const std::string &which, const std::complex<double> value)
- {
- //This feature should not be used according to Analog Devices
- throw uhd::runtime_error("ad9361_ctrl::set_iq_balance this feature is not supported on this device.");
- }
-
private:
static ad9361_device_t::direction_t _get_direction_from_antenna(const std::string& antenna)
{
diff --git a/host/lib/usrp/common/ad9361_ctrl.hpp b/host/lib/usrp/common/ad9361_ctrl.hpp
index 94eee608e..5396de225 100644
--- a/host/lib/usrp/common/ad9361_ctrl.hpp
+++ b/host/lib/usrp/common/ad9361_ctrl.hpp
@@ -22,6 +22,7 @@
#include <uhd/types/ranges.hpp>
#include <uhd/types/serial.hpp>
#include <uhd/types/sensors.hpp>
+#include <uhd/exception.hpp>
#include <boost/shared_ptr.hpp>
#include <ad9361_device.h>
#include <string>
@@ -97,13 +98,21 @@ public:
virtual double tune(const std::string &which, const double value) = 0;
//! set the DC offset for I and Q manually
- virtual void set_dc_offset(const std::string &which, const std::complex<double> value) = 0;
+ void set_dc_offset(const std::string &, const std::complex<double>)
+ {
+ //This feature should not be used according to Analog Devices
+ throw uhd::runtime_error("ad9361_ctrl::set_dc_offset this feature is not supported on this device.");
+ }
//! enable or disable the BB/RF DC tracking feature
virtual void set_dc_offset_auto(const std::string &which, const bool on) = 0;
//! set the IQ correction value manually
- virtual void set_iq_balance(const std::string &which, const std::complex<double> value) = 0;
+ void set_iq_balance(const std::string &, const std::complex<double>)
+ {
+ //This feature should not be used according to Analog Devices
+ throw uhd::runtime_error("ad9361_ctrl::set_iq_balance this feature is not supported on this device.");
+ }
//! enable or disable the quadrature calibration
virtual void set_iq_balance_auto(const std::string &which, const bool on) = 0;
diff --git a/host/lib/usrp/e300/e300_network.cpp b/host/lib/usrp/e300/e300_network.cpp
index 7ed83c6c6..3396931e3 100644
--- a/host/lib/usrp/e300/e300_network.cpp
+++ b/host/lib/usrp/e300/e300_network.cpp
@@ -229,6 +229,12 @@ static void e300_codec_ctrl_tunnel(
case codec_xact_t::ACTION_GET_TEMPERATURE:
out->temp = _codec_ctrl->get_temperature().to_real();
break;
+ case codec_xact_t::ACTION_SET_DC_OFFSET_AUTO:
+ _codec_ctrl->set_dc_offset_auto(which_str, in->use_dc_correction == 1);
+ break;
+ case codec_xact_t::ACTION_SET_IQ_BALANCE_AUTO:
+ _codec_ctrl->set_iq_balance_auto(which_str, in->use_iq_correction == 1);
+ break;
default:
UHD_MSG(status) << "Got unknown request?!" << std::endl;
//Zero out actions to fail this request on client
diff --git a/host/lib/usrp/e300/e300_remote_codec_ctrl.cpp b/host/lib/usrp/e300/e300_remote_codec_ctrl.cpp
index 0ea837a85..15222a96a 100644
--- a/host/lib/usrp/e300/e300_remote_codec_ctrl.cpp
+++ b/host/lib/usrp/e300/e300_remote_codec_ctrl.cpp
@@ -130,6 +130,34 @@ public:
return sensor_value_t("temp", _retval.temp, "C");
}
+ void set_dc_offset_auto(const std::string &which, const bool on)
+ {
+ _clear();
+ _args.action = uhd::htonx<boost::uint32_t>(transaction_t::ACTION_SET_DC_OFFSET_AUTO);
+ if (which == "TX1") _args.which = uhd::htonx<boost::uint32_t>(transaction_t::CHAIN_TX1);
+ else if (which == "TX2") _args.which = uhd::htonx<boost::uint32_t>(transaction_t::CHAIN_TX2);
+ else if (which == "RX1") _args.which = uhd::htonx<boost::uint32_t>(transaction_t::CHAIN_RX1);
+ else if (which == "RX2") _args.which = uhd::htonx<boost::uint32_t>(transaction_t::CHAIN_RX2);
+ else throw std::runtime_error("e300_remote_codec_ctrl_impl incorrect chain string.");
+ _args.use_dc_correction = on ? 1 : 0;
+
+ _transact();
+ }
+
+ void set_iq_balance_auto(const std::string &which, const bool on)
+ {
+ _clear();
+ _args.action = uhd::htonx<boost::uint32_t>(transaction_t::ACTION_SET_IQ_BALANCE_AUTO);
+ if (which == "TX1") _args.which = uhd::htonx<boost::uint32_t>(transaction_t::CHAIN_TX1);
+ else if (which == "TX2") _args.which = uhd::htonx<boost::uint32_t>(transaction_t::CHAIN_TX2);
+ else if (which == "RX1") _args.which = uhd::htonx<boost::uint32_t>(transaction_t::CHAIN_RX1);
+ else if (which == "RX2") _args.which = uhd::htonx<boost::uint32_t>(transaction_t::CHAIN_RX2);
+ else throw std::runtime_error("e300_remote_codec_ctrl_impl incorrect chain string.");
+ _args.use_iq_correction = on ? 1 : 0;
+
+ _transact();
+ }
+
private:
void _transact() {
{
diff --git a/host/lib/usrp/e300/e300_remote_codec_ctrl.hpp b/host/lib/usrp/e300/e300_remote_codec_ctrl.hpp
index d92e9bd58..855ab0f42 100644
--- a/host/lib/usrp/e300/e300_remote_codec_ctrl.hpp
+++ b/host/lib/usrp/e300/e300_remote_codec_ctrl.hpp
@@ -35,6 +35,8 @@ public:
double freq;
double rssi;
double temp;
+ boost::uint32_t use_dc_correction;
+ boost::uint32_t use_iq_correction;
boost::uint64_t bits;
};
@@ -46,6 +48,8 @@ public:
static const boost::uint32_t ACTION_SET_LOOPBACK = 14;
static const boost::uint32_t ACTION_GET_RSSI = 15;
static const boost::uint32_t ACTION_GET_TEMPERATURE = 16;
+ static const boost::uint32_t ACTION_SET_DC_OFFSET_AUTO = 17;
+ static const boost::uint32_t ACTION_SET_IQ_BALANCE_AUTO = 18;
//Values for "which"
static const boost::uint32_t CHAIN_NONE = 0;