diff options
author | Mark Meserve <mark.meserve@ni.com> | 2019-04-24 16:05:40 -0500 |
---|---|---|
committer | michael-west <michael.west@ettus.com> | 2019-05-21 21:37:19 -0700 |
commit | 223909d147d1915a7f1409764cae2644cac3094e (patch) | |
tree | 00caf603cd0c45699f70e2f1a1cff54b620c6464 /host | |
parent | 45ae7843c34d81430c64b6925f3ac145015bbf45 (diff) | |
download | uhd-223909d147d1915a7f1409764cae2644cac3094e.tar.gz uhd-223909d147d1915a7f1409764cae2644cac3094e.tar.bz2 uhd-223909d147d1915a7f1409764cae2644cac3094e.zip |
twinrx: add lo charge pump properties
Diffstat (limited to 'host')
-rw-r--r-- | host/lib/usrp/dboard/db_twinrx.cpp | 22 | ||||
-rw-r--r-- | host/lib/usrp/dboard/twinrx/twinrx_ctrl.cpp | 50 | ||||
-rw-r--r-- | host/lib/usrp/dboard/twinrx/twinrx_ctrl.hpp | 9 | ||||
-rw-r--r-- | host/lib/usrp/dboard/twinrx/twinrx_experts.cpp | 4 | ||||
-rw-r--r-- | host/lib/usrp/dboard/twinrx/twinrx_experts.hpp | 50 |
5 files changed, 116 insertions, 19 deletions
diff --git a/host/lib/usrp/dboard/db_twinrx.cpp b/host/lib/usrp/dboard/db_twinrx.cpp index 523d68185..27b2c22da 100644 --- a/host/lib/usrp/dboard/db_twinrx.cpp +++ b/host/lib/usrp/dboard/db_twinrx.cpp @@ -108,6 +108,28 @@ public: "los/all/export", prepend_ch("los/all/export", _ch_name), false, AUTO_RESOLVE_ON_WRITE); + // LO1 Charge Pump + get_rx_subtree()->create<meta_range_t>("los/LO1/charge_pump/range") + .set(_ctrl->get_lo1_charge_pump_range()); + expert_factory::add_dual_prop_node<double>(_expert, + get_rx_subtree(), + "los/LO1/charge_pump/value", + prepend_ch("los/LO1/charge_pump/desired", _ch_name), + prepend_ch("los/LO1/charge_pump/coerced", _ch_name), + (get_rx_id() == twinrx::TWINRX_REV_C_ID) ? 0.3e-6 : 0.9375e-6, + AUTO_RESOLVE_ON_READ_WRITE); + + // LO2 Charge Pump + get_rx_subtree()->create<meta_range_t>("los/LO2/charge_pump/range") + .set(_ctrl->get_lo2_charge_pump_range()); + expert_factory::add_dual_prop_node<double>(_expert, + get_rx_subtree(), + "los/LO2/charge_pump/value", + prepend_ch("los/LO2/charge_pump/desired", _ch_name), + prepend_ch("los/LO2/charge_pump/coerced", _ch_name), + 0.3125e-6, + AUTO_RESOLVE_ON_READ_WRITE); + //Gain Specific get_rx_subtree()->create<meta_range_t>("gains/all/range") .set(gain_range_t(0, 93, double(1.0))); diff --git a/host/lib/usrp/dboard/twinrx/twinrx_ctrl.cpp b/host/lib/usrp/dboard/twinrx/twinrx_ctrl.cpp index 7ed01f624..29342ce51 100644 --- a/host/lib/usrp/dboard/twinrx/twinrx_ctrl.cpp +++ b/host/lib/usrp/dboard/twinrx/twinrx_ctrl.cpp @@ -469,6 +469,56 @@ public: return coerced_freq; } + double set_lo1_charge_pump(channel_t ch, double current, bool commit = true) + { + boost::lock_guard<boost::mutex> lock(_mutex); + double coerced_current = 0.0; + if (ch == CH1 or ch == BOTH) { + coerced_current = + _lo1_iface[size_t(CH1)]->set_charge_pump_current(current, false); + } + if (ch == CH2 or ch == BOTH) { + coerced_current = + _lo1_iface[size_t(CH2)]->set_charge_pump_current(current, false); + } + + if (commit) { + _commit(); + } + return coerced_current; + } + + double set_lo2_charge_pump(channel_t ch, double current, bool commit = true) + { + boost::lock_guard<boost::mutex> lock(_mutex); + double coerced_current = 0.0; + if (ch == CH1 or ch == BOTH) { + coerced_current = + _lo2_iface[size_t(CH1)]->set_charge_pump_current(current, false); + } + if (ch == CH2 or ch == BOTH) { + coerced_current = + _lo2_iface[size_t(CH2)]->set_charge_pump_current(current, false); + } + + if (commit) { + _commit(); + } + return coerced_current; + } + + uhd::meta_range_t get_lo1_charge_pump_range() + { + // assume that both channels have the same range + return _lo1_iface[size_t(CH1)]->get_charge_pump_current_range(); + } + + uhd::meta_range_t get_lo2_charge_pump_range() + { + // assume that both channels have the same range + return _lo2_iface[size_t(CH1)]->get_charge_pump_current_range(); + } + bool read_lo1_locked(channel_t ch) { boost::lock_guard<boost::mutex> lock(_mutex); diff --git a/host/lib/usrp/dboard/twinrx/twinrx_ctrl.hpp b/host/lib/usrp/dboard/twinrx/twinrx_ctrl.hpp index a96abf879..59c9c04e9 100644 --- a/host/lib/usrp/dboard/twinrx/twinrx_ctrl.hpp +++ b/host/lib/usrp/dboard/twinrx/twinrx_ctrl.hpp @@ -11,6 +11,7 @@ #include "twinrx_io.hpp" #include <uhd/types/wb_iface.hpp> #include <boost/noncopyable.hpp> +#include <uhd/types/ranges.hpp> namespace uhd { namespace usrp { namespace dboard { namespace twinrx { @@ -81,6 +82,14 @@ public: virtual double set_lo2_synth_freq(channel_t ch, double freq, bool commit = true) = 0; + virtual double set_lo1_charge_pump(channel_t ch, double current, bool commit = true) = 0; + + virtual double set_lo2_charge_pump(channel_t ch, double current, bool commit = true) = 0; + + virtual uhd::meta_range_t get_lo1_charge_pump_range() = 0; + + virtual uhd::meta_range_t get_lo2_charge_pump_range() = 0; + virtual bool read_lo1_locked(channel_t ch) = 0; virtual bool read_lo2_locked(channel_t ch) = 0; diff --git a/host/lib/usrp/dboard/twinrx/twinrx_experts.cpp b/host/lib/usrp/dboard/twinrx/twinrx_experts.cpp index 25aec4421..f98521cc9 100644 --- a/host/lib/usrp/dboard/twinrx/twinrx_experts.cpp +++ b/host/lib/usrp/dboard/twinrx/twinrx_experts.cpp @@ -543,6 +543,10 @@ void twinrx_settings_expert::resolve() _ctrl->set_hb_atten(ch, ch_set.hb_atten, FORCE_COMMIT); _ctrl->set_lo1_source(ch, ch_set.lo1_source, FORCE_COMMIT); _ctrl->set_lo2_source(ch, ch_set.lo2_source, FORCE_COMMIT); + ch_set.lo1_charge_pump_c = + _ctrl->set_lo1_charge_pump(ch, ch_set.lo1_charge_pump_d, FORCE_COMMIT); + ch_set.lo2_charge_pump_c = + _ctrl->set_lo2_charge_pump(ch, ch_set.lo2_charge_pump_d, FORCE_COMMIT); } _resolve_lox_freq(STAGE_LO1, diff --git a/host/lib/usrp/dboard/twinrx/twinrx_experts.hpp b/host/lib/usrp/dboard/twinrx/twinrx_experts.hpp index c070765d9..16569849c 100644 --- a/host/lib/usrp/dboard/twinrx/twinrx_experts.hpp +++ b/host/lib/usrp/dboard/twinrx/twinrx_experts.hpp @@ -556,6 +556,10 @@ public: bind_accessor(ch.lo2_freq_d); bind_accessor(ch.lo1_freq_c); bind_accessor(ch.lo2_freq_c); + bind_accessor(ch.lo1_charge_pump_c); + bind_accessor(ch.lo2_charge_pump_c); + bind_accessor(ch.lo1_charge_pump_d); + bind_accessor(ch.lo2_charge_pump_d); } bind_accessor(_lo1_synth0_mapping); bind_accessor(_lo1_synth1_mapping); @@ -587,22 +591,26 @@ private: class ch_settings { public: ch_settings(const experts::node_retriever_t& db, const std::string& ch) : - chan_enabled (db, prepend_ch("enabled", ch)), - preamp1 (db, prepend_ch("ant/preamp1", ch)), - preamp2 (db, prepend_ch("ant/preamp2", ch)), - lb_preamp_presel(db, prepend_ch("ant/lb_preamp_presel", ch)), - signal_path (db, prepend_ch("ch/signal_path", ch)), - lb_presel (db, prepend_ch("ch/lb_presel", ch)), - hb_presel (db, prepend_ch("ch/hb_presel", ch)), - input_atten (db, prepend_ch("ant/input_atten", ch)), - lb_atten (db, prepend_ch("ch/lb_atten", ch)), - hb_atten (db, prepend_ch("ch/hb_atten", ch)), - lo1_source (db, prepend_ch("ch/LO1/source", ch)), - lo2_source (db, prepend_ch("ch/LO2/source", ch)), - lo1_freq_d (db, prepend_ch("los/LO1/freq/desired", ch)), - lo2_freq_d (db, prepend_ch("los/LO2/freq/desired", ch)), - lo1_freq_c (db, prepend_ch("los/LO1/freq/coerced", ch)), - lo2_freq_c (db, prepend_ch("los/LO2/freq/coerced", ch)) + chan_enabled (db, prepend_ch("enabled", ch)), + preamp1 (db, prepend_ch("ant/preamp1", ch)), + preamp2 (db, prepend_ch("ant/preamp2", ch)), + lb_preamp_presel (db, prepend_ch("ant/lb_preamp_presel", ch)), + signal_path (db, prepend_ch("ch/signal_path", ch)), + lb_presel (db, prepend_ch("ch/lb_presel", ch)), + hb_presel (db, prepend_ch("ch/hb_presel", ch)), + input_atten (db, prepend_ch("ant/input_atten", ch)), + lb_atten (db, prepend_ch("ch/lb_atten", ch)), + hb_atten (db, prepend_ch("ch/hb_atten", ch)), + lo1_source (db, prepend_ch("ch/LO1/source", ch)), + lo2_source (db, prepend_ch("ch/LO2/source", ch)), + lo1_freq_d (db, prepend_ch("los/LO1/freq/desired", ch)), + lo2_freq_d (db, prepend_ch("los/LO2/freq/desired", ch)), + lo1_charge_pump_d (db, prepend_ch("los/LO1/charge_pump/desired", ch)), + lo2_charge_pump_d (db, prepend_ch("los/LO2/charge_pump/desired", ch)), + lo1_freq_c (db, prepend_ch("los/LO1/freq/coerced", ch)), + lo2_freq_c (db, prepend_ch("los/LO2/freq/coerced", ch)), + lo1_charge_pump_c (db, prepend_ch("los/LO1/charge_pump/coerced", ch)), + lo2_charge_pump_c (db, prepend_ch("los/LO2/charge_pump/coerced", ch)) {} //Inputs (channel specific) @@ -613,17 +621,21 @@ private: experts::data_reader_t<twinrx_ctrl::signal_path_t> signal_path; experts::data_reader_t<twinrx_ctrl::preselector_path_t> lb_presel; experts::data_reader_t<twinrx_ctrl::preselector_path_t> hb_presel; - experts::data_reader_t<uint8_t> input_atten; - experts::data_reader_t<uint8_t> lb_atten; - experts::data_reader_t<uint8_t> hb_atten; + experts::data_reader_t<uint8_t> input_atten; + experts::data_reader_t<uint8_t> lb_atten; + experts::data_reader_t<uint8_t> hb_atten; experts::data_reader_t<twinrx_ctrl::lo_source_t> lo1_source; experts::data_reader_t<twinrx_ctrl::lo_source_t> lo2_source; experts::data_reader_t<double> lo1_freq_d; experts::data_reader_t<double> lo2_freq_d; + experts::data_reader_t<double> lo1_charge_pump_d; + experts::data_reader_t<double> lo2_charge_pump_d; //Output (channel specific) experts::data_writer_t<double> lo1_freq_c; experts::data_writer_t<double> lo2_freq_c; + experts::data_writer_t<double> lo1_charge_pump_c; + experts::data_writer_t<double> lo2_charge_pump_c; }; //External interface |