aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/cores
diff options
context:
space:
mode:
authorDerek Kozel <derek.kozel@ettus.com>2018-07-10 16:51:14 +0000
committerMartin Braun <martin.braun@ettus.com>2018-07-11 10:12:03 -0700
commitb39358f490a24ffe4b8b29227736b8d2eb40b956 (patch)
tree57ae22193cd0a9ee95c8b3f73d938b167b1c6675 /host/lib/usrp/cores
parentb185c9447a4a33bff14fd697dc294b9ee5d298b3 (diff)
downloaduhd-b39358f490a24ffe4b8b29227736b8d2eb40b956.tar.gz
uhd-b39358f490a24ffe4b8b29227736b8d2eb40b956.tar.bz2
uhd-b39358f490a24ffe4b8b29227736b8d2eb40b956.zip
uhd: Expose DC Offset range via multi_usrp interface
Diffstat (limited to 'host/lib/usrp/cores')
-rw-r--r--host/lib/usrp/cores/rx_frontend_core_200.cpp9
-rw-r--r--host/lib/usrp/cores/rx_frontend_core_3000.cpp9
-rw-r--r--host/lib/usrp/cores/tx_frontend_core_200.cpp9
3 files changed, 27 insertions, 0 deletions
diff --git a/host/lib/usrp/cores/rx_frontend_core_200.cpp b/host/lib/usrp/cores/rx_frontend_core_200.cpp
index 38710db15..f0556e4b0 100644
--- a/host/lib/usrp/cores/rx_frontend_core_200.cpp
+++ b/host/lib/usrp/cores/rx_frontend_core_200.cpp
@@ -6,6 +6,7 @@
//
#include <uhdlib/usrp/cores/rx_frontend_core_200.hpp>
+#include <uhd/types/ranges.hpp>
#include <boost/math/special_functions/round.hpp>
#include <boost/bind.hpp>
@@ -21,6 +22,11 @@ using namespace uhd;
#define OFFSET_SET (1ul << 30)
#define FLAG_MASK (OFFSET_FIXED | OFFSET_SET)
+namespace {
+ static const double DC_OFFSET_MIN = -1.0;
+ static const double DC_OFFSET_MAX = 1.0;
+}
+
static uint32_t fs_to_bits(const double num, const size_t bits){
return int32_t(boost::math::round(num * (1 << (bits-1))));
}
@@ -71,6 +77,9 @@ public:
void populate_subtree(uhd::property_tree::sptr subtree)
{
+ subtree->create<uhd::meta_range_t>("dc_offset/range")
+ .set(meta_range_t(DC_OFFSET_MIN, DC_OFFSET_MAX))
+ ;
subtree->create<std::complex<double> >("dc_offset/value")
.set(DEFAULT_DC_OFFSET_VALUE)
.set_coercer(boost::bind(&rx_frontend_core_200::set_dc_offset, this, _1))
diff --git a/host/lib/usrp/cores/rx_frontend_core_3000.cpp b/host/lib/usrp/cores/rx_frontend_core_3000.cpp
index cf1a105d8..841a72d9b 100644
--- a/host/lib/usrp/cores/rx_frontend_core_3000.cpp
+++ b/host/lib/usrp/cores/rx_frontend_core_3000.cpp
@@ -6,6 +6,7 @@
//
#include <uhd/types/dict.hpp>
+#include <uhd/types/ranges.hpp>
#include <uhdlib/usrp/cores/rx_frontend_core_3000.hpp>
#include <uhdlib/usrp/cores/dsp_core_utils.hpp>
#include <boost/math/special_functions/round.hpp>
@@ -34,6 +35,11 @@ using namespace uhd;
#define OFFSET_SET (1ul << 30)
#define FLAG_MASK (OFFSET_FIXED | OFFSET_SET)
+namespace {
+ static const double DC_OFFSET_MIN = -1.0;
+ static const double DC_OFFSET_MAX = 1.0;
+}
+
using namespace uhd::usrp;
static uint32_t fs_to_bits(const double num, const size_t bits){
@@ -138,6 +144,9 @@ public:
}
void populate_subtree(uhd::property_tree::sptr subtree) {
+ subtree->create<uhd::meta_range_t>("dc_offset/range")
+ .set(meta_range_t(DC_OFFSET_MIN, DC_OFFSET_MAX))
+ ;
subtree->create<std::complex<double> >("dc_offset/value")
.set(DEFAULT_DC_OFFSET_VALUE)
.set_coercer(boost::bind(&rx_frontend_core_3000::set_dc_offset, this, _1))
diff --git a/host/lib/usrp/cores/tx_frontend_core_200.cpp b/host/lib/usrp/cores/tx_frontend_core_200.cpp
index 7e23e2515..d44a618bc 100644
--- a/host/lib/usrp/cores/tx_frontend_core_200.cpp
+++ b/host/lib/usrp/cores/tx_frontend_core_200.cpp
@@ -7,6 +7,7 @@
#include <uhdlib/usrp/cores/tx_frontend_core_200.hpp>
#include <uhd/types/dict.hpp>
+#include <uhd/types/ranges.hpp>
#include <uhd/exception.hpp>
#include <boost/assign/list_of.hpp>
#include <boost/math/special_functions/round.hpp>
@@ -23,6 +24,11 @@ using namespace uhd;
const std::complex<double> tx_frontend_core_200::DEFAULT_DC_OFFSET_VALUE = std::complex<double>(0.0, 0.0);
const std::complex<double> tx_frontend_core_200::DEFAULT_IQ_BALANCE_VALUE = std::complex<double>(0.0, 0.0);
+namespace {
+ static const double DC_OFFSET_MIN = -1.0;
+ static const double DC_OFFSET_MAX = 1.0;
+}
+
static uint32_t fs_to_bits(const double num, const size_t bits){
return int32_t(boost::math::round(num * (1 << (bits-1))));
}
@@ -67,6 +73,9 @@ public:
void populate_subtree(uhd::property_tree::sptr subtree)
{
+ subtree->create<uhd::meta_range_t>("dc_offset/range")
+ .set(meta_range_t(DC_OFFSET_MIN, DC_OFFSET_MAX))
+ ;
subtree->create< std::complex<double> >("dc_offset/value")
.set(DEFAULT_DC_OFFSET_VALUE)
.set_coercer(boost::bind(&tx_frontend_core_200::set_dc_offset, this, _1))