aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/cores
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2015-07-22 18:11:14 -0700
committerMartin Braun <martin.braun@ettus.com>2015-07-29 16:50:34 -0700
commit863648f52eeeea0a8c7e80a7d0f42c5efeede92a (patch)
tree98d1c8204a3350366d499bd28206c065327bdeb0 /host/lib/usrp/cores
parent9ee68e5323932abf06971c7b67415154dee37509 (diff)
downloaduhd-863648f52eeeea0a8c7e80a7d0f42c5efeede92a.tar.gz
uhd-863648f52eeeea0a8c7e80a7d0f42c5efeede92a.tar.bz2
uhd-863648f52eeeea0a8c7e80a7d0f42c5efeede92a.zip
cores: Moved subtree populate code to frontend cores
Diffstat (limited to 'host/lib/usrp/cores')
-rw-r--r--host/lib/usrp/cores/rx_frontend_core_200.cpp21
-rw-r--r--host/lib/usrp/cores/rx_frontend_core_200.hpp9
-rw-r--r--host/lib/usrp/cores/tx_frontend_core_200.cpp16
-rw-r--r--host/lib/usrp/cores/tx_frontend_core_200.hpp8
4 files changed, 52 insertions, 2 deletions
diff --git a/host/lib/usrp/cores/rx_frontend_core_200.cpp b/host/lib/usrp/cores/rx_frontend_core_200.cpp
index b73896b57..7ac920553 100644
--- a/host/lib/usrp/cores/rx_frontend_core_200.cpp
+++ b/host/lib/usrp/cores/rx_frontend_core_200.cpp
@@ -17,6 +17,7 @@
#include "rx_frontend_core_200.hpp"
#include <boost/math/special_functions/round.hpp>
+#include <boost/bind.hpp>
using namespace uhd;
@@ -38,6 +39,10 @@ rx_frontend_core_200::~rx_frontend_core_200(void){
/* NOP */
}
+const std::complex<double> rx_frontend_core_200::DEFAULT_DC_OFFSET_VALUE = std::complex<double>(0.0, 0.0);
+const bool rx_frontend_core_200::DEFAULT_DC_OFFSET_ENABLE = true;
+const std::complex<double> rx_frontend_core_200::DEFAULT_IQ_BALANCE_VALUE = std::complex<double>(0.0, 0.0);
+
class rx_frontend_core_200_impl : public rx_frontend_core_200{
public:
rx_frontend_core_200_impl(wb_iface::sptr iface, const size_t base):
@@ -74,6 +79,22 @@ public:
_iface->poke32(REG_RX_FE_PHASE_CORRECTION, fs_to_bits(cor.imag(), 18));
}
+ void populate_subtree(uhd::property_tree::sptr subtree)
+ {
+ subtree->create<std::complex<double> >("dc_offset/value")
+ .set(DEFAULT_DC_OFFSET_VALUE)
+ .coerce(boost::bind(&rx_frontend_core_200::set_dc_offset, this, _1))
+ ;
+ subtree->create<bool>("dc_offset/enable")
+ .set(DEFAULT_DC_OFFSET_ENABLE)
+ .subscribe(boost::bind(&rx_frontend_core_200::set_dc_offset_auto, this, _1))
+ ;
+ subtree->create<std::complex<double> >("iq_balance/value")
+ .set(DEFAULT_IQ_BALANCE_VALUE)
+ .subscribe(boost::bind(&rx_frontend_core_200::set_iq_balance, this, _1))
+ ;
+ }
+
private:
boost::int32_t _i_dc_off, _q_dc_off;
wb_iface::sptr _iface;
diff --git a/host/lib/usrp/cores/rx_frontend_core_200.hpp b/host/lib/usrp/cores/rx_frontend_core_200.hpp
index 9b18e2089..32ce77e00 100644
--- a/host/lib/usrp/cores/rx_frontend_core_200.hpp
+++ b/host/lib/usrp/cores/rx_frontend_core_200.hpp
@@ -19,14 +19,19 @@
#define INCLUDED_LIBUHD_USRP_TX_FRONTEND_CORE_200_HPP
#include <uhd/config.hpp>
+#include <uhd/types/wb_iface.hpp>
+#include <uhd/property_tree.hpp>
#include <boost/utility.hpp>
#include <boost/shared_ptr.hpp>
-#include <uhd/types/wb_iface.hpp>
#include <complex>
#include <string>
class rx_frontend_core_200 : boost::noncopyable{
public:
+ static const std::complex<double> DEFAULT_DC_OFFSET_VALUE;
+ static const bool DEFAULT_DC_OFFSET_ENABLE;
+ static const std::complex<double> DEFAULT_IQ_BALANCE_VALUE;
+
typedef boost::shared_ptr<rx_frontend_core_200> sptr;
virtual ~rx_frontend_core_200(void) = 0;
@@ -41,6 +46,8 @@ public:
virtual void set_iq_balance(const std::complex<double> &cor) = 0;
+ virtual void populate_subtree(uhd::property_tree::sptr subtree) = 0;
+
};
#endif /* INCLUDED_LIBUHD_USRP_TX_FRONTEND_CORE_200_HPP */
diff --git a/host/lib/usrp/cores/tx_frontend_core_200.cpp b/host/lib/usrp/cores/tx_frontend_core_200.cpp
index 7000f46bd..0fa028571 100644
--- a/host/lib/usrp/cores/tx_frontend_core_200.cpp
+++ b/host/lib/usrp/cores/tx_frontend_core_200.cpp
@@ -20,6 +20,7 @@
#include <uhd/exception.hpp>
#include <boost/assign/list_of.hpp>
#include <boost/math/special_functions/round.hpp>
+#include <boost/bind.hpp>
using namespace uhd;
@@ -29,6 +30,9 @@ using namespace uhd;
#define REG_TX_FE_PHASE_CORRECTION _base + 12 //18 bits
#define REG_TX_FE_MUX _base + 16 //8 bits (std output = 0x10, reversed = 0x01)
+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);
+
static boost::uint32_t fs_to_bits(const double num, const size_t bits){
return boost::int32_t(boost::math::round(num * (1 << (bits-1))));
}
@@ -71,6 +75,18 @@ public:
_iface->poke32(REG_TX_FE_PHASE_CORRECTION, fs_to_bits(cor.imag(), 18));
}
+ void populate_subtree(uhd::property_tree::sptr subtree)
+ {
+ subtree->create< std::complex<double> >("dc_offset/value")
+ .set(DEFAULT_DC_OFFSET_VALUE)
+ .coerce(boost::bind(&tx_frontend_core_200::set_dc_offset, this, _1))
+ ;
+ subtree->create< std::complex<double> >("iq_balance/value")
+ .set(DEFAULT_IQ_BALANCE_VALUE)
+ .subscribe(boost::bind(&tx_frontend_core_200::set_iq_balance, this, _1))
+ ;
+ }
+
private:
wb_iface::sptr _iface;
const size_t _base;
diff --git a/host/lib/usrp/cores/tx_frontend_core_200.hpp b/host/lib/usrp/cores/tx_frontend_core_200.hpp
index 0b89ea818..912256329 100644
--- a/host/lib/usrp/cores/tx_frontend_core_200.hpp
+++ b/host/lib/usrp/cores/tx_frontend_core_200.hpp
@@ -19,9 +19,10 @@
#define INCLUDED_LIBUHD_USRP_RX_FRONTEND_CORE_200_HPP
#include <uhd/config.hpp>
+#include <uhd/types/wb_iface.hpp>
+#include <uhd/property_tree.hpp>
#include <boost/utility.hpp>
#include <boost/shared_ptr.hpp>
-#include <uhd/types/wb_iface.hpp>
#include <complex>
#include <string>
@@ -29,6 +30,9 @@ class tx_frontend_core_200 : boost::noncopyable{
public:
typedef boost::shared_ptr<tx_frontend_core_200> sptr;
+ static const std::complex<double> DEFAULT_DC_OFFSET_VALUE;
+ static const std::complex<double> DEFAULT_IQ_BALANCE_VALUE;
+
virtual ~tx_frontend_core_200(void) = 0;
static sptr make(uhd::wb_iface::sptr iface, const size_t base);
@@ -39,6 +43,8 @@ public:
virtual void set_iq_balance(const std::complex<double> &cor) = 0;
+ virtual void populate_subtree(uhd::property_tree::sptr subtree) = 0;
+
};
#endif /* INCLUDED_LIBUHD_USRP_RX_FRONTEND_CORE_200_HPP */