diff options
Diffstat (limited to 'host/lib/usrp/dboard/twinrx')
-rw-r--r-- | host/lib/usrp/dboard/twinrx/twinrx_ctrl.cpp | 52 | ||||
-rw-r--r-- | host/lib/usrp/dboard/twinrx/twinrx_io.hpp | 10 |
2 files changed, 32 insertions, 30 deletions
diff --git a/host/lib/usrp/dboard/twinrx/twinrx_ctrl.cpp b/host/lib/usrp/dboard/twinrx/twinrx_ctrl.cpp index 29ab194be..355d980ee 100644 --- a/host/lib/usrp/dboard/twinrx/twinrx_ctrl.cpp +++ b/host/lib/usrp/dboard/twinrx/twinrx_ctrl.cpp @@ -12,6 +12,8 @@ #include <uhdlib/usrp/common/adf435x.hpp> #include <uhdlib/usrp/common/adf535x.hpp> #include <uhdlib/utils/narrow.hpp> +#include <boost/chrono.hpp> +#include <boost/format.hpp> #include <chrono> #include <cmath> #include <thread> @@ -158,19 +160,19 @@ public: ~twinrx_ctrl_impl() override { - UHD_SAFE_CALL(boost::lock_guard<boost::mutex> lock(_mutex); + UHD_SAFE_CALL(std::lock_guard<std::mutex> lock(_mutex); _gpio_iface->set_field(twinrx_gpio::FIELD_SWPS_EN, 0);) } void commit() override { - boost::lock_guard<boost::mutex> lock(_mutex); + std::lock_guard<std::mutex> lock(_mutex); _commit(); } void set_chan_enabled(channel_t ch, bool enabled, bool commit = true) override { - boost::lock_guard<boost::mutex> lock(_mutex); + std::lock_guard<std::mutex> lock(_mutex); if (ch == CH1 or ch == BOTH) { _cpld_regs->if0_reg3.set(rm::if0_reg3_t::IF1_IF2_EN_CH1, bool2bin(enabled)); _cpld_regs->if0_reg0.set(rm::if0_reg0_t::AMP_LO2_EN_CH1, bool2bin(enabled)); @@ -191,7 +193,7 @@ public: void set_preamp1(channel_t ch, preamp_state_t value, bool commit = true) override { - boost::lock_guard<boost::mutex> lock(_mutex); + std::lock_guard<std::mutex> lock(_mutex); if (ch == CH1 or ch == BOTH) { _cpld_regs->rf0_reg1.set( rm::rf0_reg1_t::SWPA1_CTL_CH1, bool2bin(value == PREAMP_HIGHBAND)); @@ -218,7 +220,7 @@ public: void set_preamp2(channel_t ch, bool enabled, bool commit = true) override { - boost::lock_guard<boost::mutex> lock(_mutex); + std::lock_guard<std::mutex> lock(_mutex); if (ch == CH1 or ch == BOTH) { _cpld_regs->rf2_reg7.set( rm::rf2_reg7_t::SWPA4_CTRL_CH1, bool2bin(not enabled)); @@ -236,7 +238,7 @@ public: void set_lb_preamp_preselector( channel_t ch, bool enabled, bool commit = true) override { - boost::lock_guard<boost::mutex> lock(_mutex); + std::lock_guard<std::mutex> lock(_mutex); if (ch == CH1 or ch == BOTH) { _cpld_regs->rf0_reg7.set( rm::rf0_reg7_t::SWPA3_CTRL_CH1, bool2bin(not enabled)); @@ -251,7 +253,7 @@ public: void set_signal_path(channel_t ch, signal_path_t path, bool commit = true) override { - boost::lock_guard<boost::mutex> lock(_mutex); + std::lock_guard<std::mutex> lock(_mutex); if (ch == CH1 or ch == BOTH) { _cpld_regs->rf2_reg2.set( rm::rf2_reg2_t::SW11_CTRL_CH1, bool2bin(path == PATH_LOWBAND)); @@ -299,7 +301,7 @@ public: void set_lb_preselector( channel_t ch, preselector_path_t path, bool commit = true) override { - boost::lock_guard<boost::mutex> lock(_mutex); + std::lock_guard<std::mutex> lock(_mutex); uint32_t sw7val = 0, sw8val = 0; switch (path) { case PRESEL_PATH1: @@ -336,7 +338,7 @@ public: void set_hb_preselector( channel_t ch, preselector_path_t path, bool commit = true) override { - boost::lock_guard<boost::mutex> lock(_mutex); + std::lock_guard<std::mutex> lock(_mutex); uint32_t sw9ch1val = 0, sw10ch1val = 0, sw9ch2val = 0, sw10ch2val = 0; switch (path) { case PRESEL_PATH1: @@ -380,7 +382,7 @@ public: void set_input_atten(channel_t ch, uint8_t atten, bool commit = true) override { - boost::lock_guard<boost::mutex> lock(_mutex); + std::lock_guard<std::mutex> lock(_mutex); if (ch == CH1 or ch == BOTH) { _cpld_regs->rf0_reg0.set(rm::rf0_reg0_t::ATTEN_IN_CH1, atten & 0x1F); } @@ -393,7 +395,7 @@ public: void set_lb_atten(channel_t ch, uint8_t atten, bool commit = true) override { - boost::lock_guard<boost::mutex> lock(_mutex); + std::lock_guard<std::mutex> lock(_mutex); if (ch == CH1 or ch == BOTH) { _cpld_regs->rf2_reg0.set(rm::rf2_reg0_t::ATTEN_LB_CH1, atten & 0x1F); } @@ -406,7 +408,7 @@ public: void set_hb_atten(channel_t ch, uint8_t atten, bool commit = true) override { - boost::lock_guard<boost::mutex> lock(_mutex); + std::lock_guard<std::mutex> lock(_mutex); if (ch == CH1 or ch == BOTH) { _cpld_regs->rf1_reg0.set(rm::rf1_reg0_t::ATTEN_HB_CH1, atten & 0x1F); } @@ -419,7 +421,7 @@ public: void set_lo1_source(channel_t ch, lo_source_t source, bool commit = true) override { - boost::lock_guard<boost::mutex> lock(_mutex); + std::lock_guard<std::mutex> lock(_mutex); if (ch == CH1 or ch == BOTH) { _cpld_regs->rf1_reg5.set( rm::rf1_reg5_t::SW14_CTRL_CH2, bool2bin(source != LO_COMPANION)); @@ -447,7 +449,7 @@ public: void set_lo2_source(channel_t ch, lo_source_t source, bool commit = true) override { - boost::lock_guard<boost::mutex> lock(_mutex); + std::lock_guard<std::mutex> lock(_mutex); if (ch == CH1 or ch == BOTH) { _cpld_regs->if0_reg0.set( rm::if0_reg0_t::SW19_CTRL_CH2, bool2bin(source == LO_COMPANION)); @@ -472,7 +474,7 @@ public: void set_lo1_export_source(lo_export_source_t source, bool commit = true) override { - boost::lock_guard<boost::mutex> lock(_mutex); + std::lock_guard<std::mutex> lock(_mutex); // SW22 may conflict with the cal switch but this attr takes priority and we // assume that the cal switch is disabled (by disabling it!) _set_cal_mode(CAL_DISABLED, source); @@ -486,7 +488,7 @@ public: void set_lo2_export_source(lo_export_source_t source, bool commit = true) override { - boost::lock_guard<boost::mutex> lock(_mutex); + std::lock_guard<std::mutex> lock(_mutex); _cpld_regs->if0_reg7.set( rm::if0_reg7_t::SW24_CTRL_CH2, bool2bin(source == LO_CH2_SYNTH)); _cpld_regs->if0_reg4.set( @@ -501,7 +503,7 @@ public: void set_antenna_mapping(antenna_mapping_t mapping, bool commit = true) override { - boost::lock_guard<boost::mutex> lock(_mutex); + std::lock_guard<std::mutex> lock(_mutex); enum switch_path_t { CONNECT, TERM, EXPORT, IMPORT, SWAP }; switch_path_t path1, path2; @@ -548,7 +550,7 @@ public: void set_crossover_cal_mode(cal_mode_t cal_mode, bool commit = true) override { - boost::lock_guard<boost::mutex> lock(_mutex); + std::lock_guard<std::mutex> lock(_mutex); if (_lo1_export == LO_CH1_SYNTH && cal_mode == CAL_CH2) { throw uhd::runtime_error( "cannot enable cal crossover on CH2 when LO1 in CH1 is exported"); @@ -565,7 +567,7 @@ public: double set_lo1_synth_freq(channel_t ch, double freq, bool commit = true) override { - boost::lock_guard<boost::mutex> lock(_mutex); + std::lock_guard<std::mutex> lock(_mutex); double coerced_freq = 0.0; if (ch == CH1 or ch == BOTH) { @@ -586,7 +588,7 @@ public: double set_lo2_synth_freq(channel_t ch, double freq, bool commit = true) override { - boost::lock_guard<boost::mutex> lock(_mutex); + std::lock_guard<std::mutex> lock(_mutex); double coerced_freq = 0.0; if (ch == CH1 or ch == BOTH) { @@ -605,7 +607,7 @@ public: double set_lo1_charge_pump(channel_t ch, double current, bool commit = true) override { - boost::lock_guard<boost::mutex> lock(_mutex); + std::lock_guard<std::mutex> lock(_mutex); double coerced_current = 0.0; if (ch == CH1 or ch == BOTH) { coerced_current = @@ -624,7 +626,7 @@ public: double set_lo2_charge_pump(channel_t ch, double current, bool commit = true) override { - boost::lock_guard<boost::mutex> lock(_mutex); + std::lock_guard<std::mutex> lock(_mutex); double coerced_current = 0.0; if (ch == CH1 or ch == BOTH) { coerced_current = @@ -655,7 +657,7 @@ public: bool read_lo1_locked(channel_t ch) override { - boost::lock_guard<boost::mutex> lock(_mutex); + std::lock_guard<std::mutex> lock(_mutex); bool locked = true; if (ch == CH1 or ch == BOTH) { @@ -671,7 +673,7 @@ public: bool read_lo2_locked(channel_t ch) override { - boost::lock_guard<boost::mutex> lock(_mutex); + std::lock_guard<std::mutex> lock(_mutex); bool locked = true; if (ch == CH1 or ch == BOTH) { @@ -851,7 +853,7 @@ private: // Members } }; - boost::mutex _mutex; + std::mutex _mutex; dboard_iface::sptr _db_iface; twinrx_gpio::sptr _gpio_iface; twinrx_cpld_regmap::sptr _cpld_regs; diff --git a/host/lib/usrp/dboard/twinrx/twinrx_io.hpp b/host/lib/usrp/dboard/twinrx/twinrx_io.hpp index 538b0bfa8..5998a87d1 100644 --- a/host/lib/usrp/dboard/twinrx/twinrx_io.hpp +++ b/host/lib/usrp/dboard/twinrx/twinrx_io.hpp @@ -12,7 +12,7 @@ #include <uhd/usrp/dboard_base.hpp> #include <uhd/utils/soft_register.hpp> #include <uhdlib/usrp/cores/gpio_atr_3000.hpp> -#include <boost/thread.hpp> +#include <boost/chrono.hpp> namespace uhd { namespace usrp { namespace dboard { namespace twinrx { @@ -95,7 +95,7 @@ public: void set_field(const uhd::soft_reg_field_t field, const uint32_t value) { - boost::lock_guard<boost::mutex> lock(_mutex); + std::lock_guard<std::mutex> lock(_mutex); using namespace soft_reg_field; _db_iface->set_gpio_out( @@ -104,7 +104,7 @@ public: uint32_t get_field(const uhd::soft_reg_field_t field) { - boost::lock_guard<boost::mutex> lock(_mutex); + std::lock_guard<std::mutex> lock(_mutex); using namespace soft_reg_field; return (_db_iface->read_gpio(dboard_iface::UNIT_BOTH) & mask<uint32_t>(field)) >> shift(field); @@ -113,7 +113,7 @@ public: // CPLD register write-only interface void poke32(const wb_addr_type addr, const uint32_t data) override { - boost::lock_guard<boost::mutex> lock(_mutex); + std::lock_guard<std::mutex> lock(_mutex); using namespace soft_reg_field; // Step 1: Write the reg offset and data to the GPIO bus and de-assert all enables @@ -140,7 +140,7 @@ private: // Members/definitions // Members dboard_iface::sptr _db_iface; - boost::mutex _mutex; + std::mutex _mutex; }; class twinrx_cpld_regmap : public uhd::soft_regmap_t |