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 | |
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
-rw-r--r-- | host/lib/usrp/b200/b200_impl.cpp | 28 | ||||
-rw-r--r-- | host/lib/usrp/b200/b200_impl.hpp | 5 | ||||
-rw-r--r-- | host/lib/usrp/b200/b200_regs.hpp | 2 |
3 files changed, 31 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); + } } } diff --git a/host/lib/usrp/b200/b200_impl.hpp b/host/lib/usrp/b200/b200_impl.hpp index 3e1a62249..12678c13d 100644 --- a/host/lib/usrp/b200/b200_impl.hpp +++ b/host/lib/usrp/b200/b200_impl.hpp @@ -32,6 +32,7 @@ #include <uhdlib/usrp/cores/radio_ctrl_core_3000.hpp> #include <uhdlib/usrp/cores/rx_dsp_core_3000.hpp> #include <uhdlib/usrp/cores/tx_dsp_core_3000.hpp> +#include <uhdlib/usrp/cores/user_settings_core_3000.hpp> #include <uhdlib/usrp/common/recv_packet_demuxer_3000.hpp> #include <uhdlib/usrp/common/ad936x_manager.hpp> #include <uhdlib/usrp/common/adf4001_ctrl.hpp> @@ -127,6 +128,9 @@ private: b200_product_t _product; size_t _revision; bool _gpsdo_capable; + //! This flag is true if the FPGA has custom (user) registers and access to + // those needs to be enabled from software. + const bool _enable_user_regs; //controllers b200_iface::sptr _iface; @@ -188,6 +192,7 @@ private: tx_dsp_core_3000::sptr duc; boost::weak_ptr<uhd::rx_streamer> rx_streamer; boost::weak_ptr<uhd::tx_streamer> tx_streamer; + user_settings_core_3000::sptr user_settings; bool ant_rx2; }; std::vector<radio_perifs_t> _radio_perifs; diff --git a/host/lib/usrp/b200/b200_regs.hpp b/host/lib/usrp/b200/b200_regs.hpp index 6cc670d22..cedbe0ff5 100644 --- a/host/lib/usrp/b200/b200_regs.hpp +++ b/host/lib/usrp/b200/b200_regs.hpp @@ -37,6 +37,8 @@ localparam SR_TIME = 128; localparam SR_RX_FMT = 136; localparam SR_TX_FMT = 138; localparam SR_FP_GPIO = 200; +localparam SR_USER_SR_BASE = 253; +localparam SR_USER_RB_ADDR = 255; localparam RB32_TEST = 0; localparam RB64_TIME_NOW = 8; |