diff options
author | Martin Braun <martin.braun@ettus.com> | 2018-08-09 16:42:08 -0500 |
---|---|---|
committer | Brent Stapleton <bstapleton@g.hmc.edu> | 2018-08-16 11:40:48 -0700 |
commit | 029e29e24b071e0f316ca74c6d1ff614acc23e19 (patch) | |
tree | bd7d11de12c79b3009a330be0f31481f179290c8 /host/lib/usrp/b200/b200_impl.cpp | |
parent | c14944c357c2d548632472d06e101ca95a7a12b6 (diff) | |
download | uhd-029e29e24b071e0f316ca74c6d1ff614acc23e19.tar.gz uhd-029e29e24b071e0f316ca74c6d1ff614acc23e19.tar.bz2 uhd-029e29e24b071e0f316ca74c6d1ff614acc23e19.zip |
b200: Enable access to user regs via the 'enable_user_regs' arg
Diffstat (limited to 'host/lib/usrp/b200/b200_impl.cpp')
-rw-r--r-- | host/lib/usrp/b200/b200_impl.cpp | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/host/lib/usrp/b200/b200_impl.cpp b/host/lib/usrp/b200/b200_impl.cpp index a173c68f8..ae6e0b0d7 100644 --- a/host/lib/usrp/b200/b200_impl.cpp +++ b/host/lib/usrp/b200/b200_impl.cpp @@ -276,6 +276,7 @@ UHD_STATIC_BLOCK(register_b200_device) b200_impl::b200_impl(const uhd::device_addr_t& device_addr, usb_device_handle::sptr &handle) : _product(B200), // Some safe value _revision(0), + _enable_user_regs(device_addr.has_key("enable_user_regs")), _time_source(UNKNOWN), _tick_rate(0.0) // Forces a clock initialization at startup { @@ -836,6 +837,18 @@ void b200_impl::setup_radio(const size_t dspno) perif.duc = tx_dsp_core_3000::make(perif.ctrl, TOREG(SR_TX_DSP)); perif.duc->set_link_rate(10e9/8); //whatever perif.duc->set_freq(tx_dsp_core_3000::DEFAULT_CORDIC_FREQ); + if (_enable_user_regs) { + UHD_LOG_DEBUG("B200", "Enabling user settings registers"); + perif.user_settings = user_settings_core_3000::make(perif.ctrl, + TOREG(SR_USER_SR_BASE), + TOREG(SR_USER_RB_ADDR) + ); + if (!perif.user_settings) { + const std::string error_msg = "Failed to create user settings bus!"; + UHD_LOG_ERROR("B200", error_msg); + throw uhd::runtime_error(error_msg); + } + } //////////////////////////////////////////////////////////////////// // create time control objects @@ -853,9 +866,10 @@ void b200_impl::setup_radio(const size_t dspno) _tree->create<bool>(rx_dsp_path / "rate" / "set").set(false); _tree->access<double>(rx_dsp_path / "rate" / "value") .set_coercer(boost::bind(&b200_impl::coerce_rx_samp_rate, this, perif.ddc, dspno, _1)) - .add_coerced_subscriber([this](const double){ + .add_coerced_subscriber([this, rx_dsp_path](const double){ if (this->_tree) { - _tree->access<bool>(rx_dsp_path / "rate" / "set").set(true); + this->_tree->access<bool>(rx_dsp_path / "rate" / "set") + .set(true); } }) .add_coerced_subscriber(boost::bind(&b200_impl::update_rx_samp_rate, this, dspno, _1)) @@ -875,9 +889,10 @@ void b200_impl::setup_radio(const size_t dspno) _tree->create<bool>(tx_dsp_path / "rate" / "set").set(false); _tree->access<double>(tx_dsp_path / "rate" / "value") .set_coercer(boost::bind(&b200_impl::coerce_tx_samp_rate, this, perif.duc, dspno, _1)) - .add_coerced_subscriber([this](const double){ + .add_coerced_subscriber([this, tx_dsp_path](const double){ if (this->_tree) { - tree->access<bool>(tx_dsp_path / "rate" / "set").set(true); + this->_tree->access<bool>(tx_dsp_path / "rate" / "set") + .set(true); } }) .add_coerced_subscriber(boost::bind(&b200_impl::update_tx_samp_rate, this, dspno, _1)) @@ -923,6 +938,11 @@ void b200_impl::setup_radio(const size_t dspno) _tree->create<std::vector<std::string> >(rf_fe_path / "antenna" / "options").set(ants); _tree->create<std::string>(rf_fe_path / "antenna" / "value").set("TX/RX"); } + + if (_enable_user_regs) { + _tree->create<uhd::wb_iface::sptr>(rf_fe_path / "user_settings/iface") + .set(perif.user_settings); + } } } |