From 948d3e709477405309b382d625aa6409f1784552 Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Thu, 23 Jul 2015 13:24:44 -0700 Subject: cores: Moved subtree populate code to DSP cores (X3x0, E310) --- host/lib/usrp/cores/rx_dsp_core_200.cpp | 1 + host/lib/usrp/cores/rx_dsp_core_3000.cpp | 21 +++++++++++++++++++++ host/lib/usrp/cores/rx_dsp_core_3000.hpp | 10 ++++++++-- host/lib/usrp/cores/tx_dsp_core_3000.cpp | 21 +++++++++++++++++++++ host/lib/usrp/cores/tx_dsp_core_3000.hpp | 8 +++++++- 5 files changed, 58 insertions(+), 3 deletions(-) (limited to 'host/lib/usrp/cores') diff --git a/host/lib/usrp/cores/rx_dsp_core_200.cpp b/host/lib/usrp/cores/rx_dsp_core_200.cpp index 6a36e8fa1..b899085c0 100644 --- a/host/lib/usrp/cores/rx_dsp_core_200.cpp +++ b/host/lib/usrp/cores/rx_dsp_core_200.cpp @@ -295,6 +295,7 @@ public: _iface->poke32(REG_RX_CTRL_FORMAT, format_word); } + private: wb_iface::sptr _iface; const size_t _dsp_base, _ctrl_base; diff --git a/host/lib/usrp/cores/rx_dsp_core_3000.cpp b/host/lib/usrp/cores/rx_dsp_core_3000.cpp index 8a131ffb4..18dabade0 100644 --- a/host/lib/usrp/cores/rx_dsp_core_3000.cpp +++ b/host/lib/usrp/cores/rx_dsp_core_3000.cpp @@ -46,6 +46,9 @@ template T ceil_log2(T num){ using namespace uhd; +const double rx_dsp_core_3000::DEFAULT_CORDIC_FREQ = 0.0; +const double rx_dsp_core_3000::DEFAULT_RATE = 1e6; + rx_dsp_core_3000::~rx_dsp_core_3000(void){ /* NOP */ } @@ -263,6 +266,24 @@ public: this->update_scalar(); } + void populate_subtree(property_tree::sptr subtree) + { + subtree->create("rate/range") + .publish(boost::bind(&rx_dsp_core_3000::get_host_rates, this)) + ; + subtree->create("rate/value") + .set(DEFAULT_RATE) + .coerce(boost::bind(&rx_dsp_core_3000::set_host_rate, this, _1)) + ; + subtree->create("freq/value") + .set(DEFAULT_CORDIC_FREQ) + .coerce(boost::bind(&rx_dsp_core_3000::set_freq, this, _1)) + ; + subtree->create("freq/range") + .publish(boost::bind(&rx_dsp_core_3000::get_freq_range, this)) + ; + } + private: wb_iface::sptr _iface; const size_t _dsp_base; diff --git a/host/lib/usrp/cores/rx_dsp_core_3000.hpp b/host/lib/usrp/cores/rx_dsp_core_3000.hpp index 89059e953..65801de1d 100644 --- a/host/lib/usrp/cores/rx_dsp_core_3000.hpp +++ b/host/lib/usrp/cores/rx_dsp_core_3000.hpp @@ -21,14 +21,18 @@ #include #include #include -#include -#include #include #include +#include +#include +#include #include class rx_dsp_core_3000 : boost::noncopyable{ public: + static const double DEFAULT_CORDIC_FREQ; + static const double DEFAULT_RATE; + typedef boost::shared_ptr sptr; virtual ~rx_dsp_core_3000(void) = 0; @@ -56,6 +60,8 @@ public: virtual double set_freq(const double freq) = 0; virtual void setup(const uhd::stream_args_t &stream_args) = 0; + + virtual void populate_subtree(uhd::property_tree::sptr subtree) = 0; }; #endif /* INCLUDED_LIBUHD_USRP_RX_DSP_CORE_3000_HPP */ diff --git a/host/lib/usrp/cores/tx_dsp_core_3000.cpp b/host/lib/usrp/cores/tx_dsp_core_3000.cpp index 736205402..93b70435f 100644 --- a/host/lib/usrp/cores/tx_dsp_core_3000.cpp +++ b/host/lib/usrp/cores/tx_dsp_core_3000.cpp @@ -37,6 +37,9 @@ template T ceil_log2(T num){ using namespace uhd; +const double tx_dsp_core_3000::DEFAULT_CORDIC_FREQ = 0.0; +const double tx_dsp_core_3000::DEFAULT_RATE = 1e6; + tx_dsp_core_3000::~tx_dsp_core_3000(void){ /* NOP */ } @@ -200,6 +203,24 @@ public: this->update_scalar(); } + void populate_subtree(property_tree::sptr subtree) + { + subtree->create("rate/range") + .publish(boost::bind(&tx_dsp_core_3000::get_host_rates, this)) + ; + subtree->create("rate/value") + .set(DEFAULT_RATE) + .coerce(boost::bind(&tx_dsp_core_3000::set_host_rate, this, _1)) + ; + subtree->create("freq/value") + .set(DEFAULT_CORDIC_FREQ) + .coerce(boost::bind(&tx_dsp_core_3000::set_freq, this, _1)) + ; + subtree->create("freq/range") + .publish(boost::bind(&tx_dsp_core_3000::get_freq_range, this)) + ; + } + private: wb_iface::sptr _iface; const size_t _dsp_base; diff --git a/host/lib/usrp/cores/tx_dsp_core_3000.hpp b/host/lib/usrp/cores/tx_dsp_core_3000.hpp index a51cb2803..fbc43add6 100644 --- a/host/lib/usrp/cores/tx_dsp_core_3000.hpp +++ b/host/lib/usrp/cores/tx_dsp_core_3000.hpp @@ -21,12 +21,16 @@ #include #include #include +#include +#include #include #include -#include class tx_dsp_core_3000 : boost::noncopyable{ public: + static const double DEFAULT_CORDIC_FREQ; + static const double DEFAULT_RATE; + typedef boost::shared_ptr sptr; virtual ~tx_dsp_core_3000(void) = 0; @@ -51,6 +55,8 @@ public: virtual double set_freq(const double freq) = 0; virtual void setup(const uhd::stream_args_t &stream_args) = 0; + + virtual void populate_subtree(uhd::property_tree::sptr subtree) = 0; }; #endif /* INCLUDED_LIBUHD_USRP_TX_DSP_CORE_3000_HPP */ -- cgit v1.2.3