diff options
author | Andrej Rode <andrej.rode@ettus.com> | 2017-02-07 16:37:25 -0800 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-02-20 17:13:15 -0800 |
commit | 21aad77c9ca07f4271136b9241f5adb00a6bb908 (patch) | |
tree | 636ffe3ab2296e9afa661d3a12eb359224cd3254 /host/lib/usrp/dboard | |
parent | 2b33f2bb4c01d4306fd46f78edf6e355a03e2ed7 (diff) | |
download | uhd-21aad77c9ca07f4271136b9241f5adb00a6bb908.tar.gz uhd-21aad77c9ca07f4271136b9241f5adb00a6bb908.tar.bz2 uhd-21aad77c9ca07f4271136b9241f5adb00a6bb908.zip |
utils: introduce new logging API and remove msg API
Diffstat (limited to 'host/lib/usrp/dboard')
-rw-r--r-- | host/lib/usrp/dboard/db_basic_and_lf.cpp | 2 | ||||
-rw-r--r-- | host/lib/usrp/dboard/db_cbx.cpp | 4 | ||||
-rw-r--r-- | host/lib/usrp/dboard/db_dbsrx.cpp | 64 | ||||
-rw-r--r-- | host/lib/usrp/dboard/db_dbsrx2.cpp | 34 | ||||
-rw-r--r-- | host/lib/usrp/dboard/db_rfx.cpp | 14 | ||||
-rw-r--r-- | host/lib/usrp/dboard/db_sbx_common.cpp | 12 | ||||
-rw-r--r-- | host/lib/usrp/dboard/db_sbx_common.hpp | 2 | ||||
-rw-r--r-- | host/lib/usrp/dboard/db_sbx_version3.cpp | 4 | ||||
-rw-r--r-- | host/lib/usrp/dboard/db_sbx_version4.cpp | 4 | ||||
-rw-r--r-- | host/lib/usrp/dboard/db_tvrx.cpp | 20 | ||||
-rw-r--r-- | host/lib/usrp/dboard/db_tvrx2.cpp | 116 | ||||
-rw-r--r-- | host/lib/usrp/dboard/db_ubx.cpp | 22 | ||||
-rw-r--r-- | host/lib/usrp/dboard/db_unknown.cpp | 4 | ||||
-rw-r--r-- | host/lib/usrp/dboard/db_wbx_common.cpp | 6 | ||||
-rw-r--r-- | host/lib/usrp/dboard/db_wbx_version2.cpp | 10 | ||||
-rw-r--r-- | host/lib/usrp/dboard/db_wbx_version3.cpp | 10 | ||||
-rw-r--r-- | host/lib/usrp/dboard/db_wbx_version4.cpp | 10 | ||||
-rw-r--r-- | host/lib/usrp/dboard/db_xcvr2450.cpp | 20 | ||||
-rw-r--r-- | host/lib/usrp/dboard/twinrx/twinrx_experts.cpp | 5 |
19 files changed, 182 insertions, 181 deletions
diff --git a/host/lib/usrp/dboard/db_basic_and_lf.cpp b/host/lib/usrp/dboard/db_basic_and_lf.cpp index 941a80ea4..a3d9fb316 100644 --- a/host/lib/usrp/dboard/db_basic_and_lf.cpp +++ b/host/lib/usrp/dboard/db_basic_and_lf.cpp @@ -19,7 +19,7 @@ #include <uhd/types/ranges.hpp> #include <uhd/utils/assert_has.hpp> #include <uhd/utils/static.hpp> -#include <uhd/utils/msg.hpp> +#include <uhd/utils/log.hpp> #include <uhd/usrp/dboard_base.hpp> #include <uhd/usrp/dboard_manager.hpp> #include <boost/assign/list_of.hpp> diff --git a/host/lib/usrp/dboard/db_cbx.cpp b/host/lib/usrp/dboard/db_cbx.cpp index 05f8846d6..11cb092b8 100644 --- a/host/lib/usrp/dboard/db_cbx.cpp +++ b/host/lib/usrp/dboard/db_cbx.cpp @@ -51,9 +51,9 @@ void sbx_xcvr::cbx::write_lo_regs(dboard_iface::unit_t unit, const std::vector<u * Tuning **********************************************************************/ double sbx_xcvr::cbx::set_lo_freq(dboard_iface::unit_t unit, double target_freq) { - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("CBX") << boost::format( "CBX tune: target frequency %f MHz" - ) % (target_freq/1e6) << std::endl; + ) % (target_freq/1e6) ; //clip the input target_freq = cbx_freq_range.clip(target_freq); diff --git a/host/lib/usrp/dboard/db_dbsrx.cpp b/host/lib/usrp/dboard/db_dbsrx.cpp index 2862f97dc..80faba5d2 100644 --- a/host/lib/usrp/dboard/db_dbsrx.cpp +++ b/host/lib/usrp/dboard/db_dbsrx.cpp @@ -24,7 +24,7 @@ #include <uhd/utils/static.hpp> #include <uhd/utils/assert_has.hpp> #include <uhd/utils/algorithm.hpp> -#include <uhd/utils/msg.hpp> + #include <uhd/types/ranges.hpp> #include <uhd/types/sensors.hpp> #include <uhd/types/dict.hpp> @@ -98,9 +98,9 @@ private: //get the register data for(int i=0; i<num_bytes; i++){ regs_vector[1+i] = _max2118_write_regs.get_reg(start_addr+i); - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("DBSRX") << boost::format( "DBSRX: send reg 0x%02x, value 0x%04x, start_addr = 0x%04x, num_bytes %d" - ) % int(start_addr+i) % int(regs_vector[1+i]) % int(start_addr) % num_bytes << std::endl; + ) % int(start_addr+i) % int(regs_vector[1+i]) % int(start_addr) % num_bytes ; } //send the data @@ -130,9 +130,9 @@ private: if (i + start_addr >= status_addr){ _max2118_read_regs.set_reg(i + start_addr, regs_vector[i]); } - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("DBSRX") << boost::format( "DBSRX: read reg 0x%02x, value 0x%04x, start_addr = 0x%04x, num_bytes %d" - ) % int(start_addr+i) % int(regs_vector[i]) % int(start_addr) % num_bytes << std::endl; + ) % int(start_addr+i) % int(regs_vector[i]) % int(start_addr) % num_bytes ; } } } @@ -147,9 +147,9 @@ private: //mask and return lock detect bool locked = 5 >= _max2118_read_regs.adc and _max2118_read_regs.adc >= 2; - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("DBSRX") << boost::format( "DBSRX: locked %d" - ) % locked << std::endl; + ) % locked ; return sensor_value_t("LO", locked, "locked", "unlocked"); } @@ -175,7 +175,7 @@ UHD_STATIC_BLOCK(reg_dbsrx_dboard){ dbsrx::dbsrx(ctor_args_t args) : rx_dboard_base(args){ //warn user about incorrect DBID on USRP1, requires R193 populated if (this->get_iface()->get_special_props().soft_clock_divider and this->get_rx_id() == 0x000D) - UHD_MSG(warning) << boost::format( + UHD_LOGGER_WARNING("DBSRX") << boost::format( "DBSRX: incorrect dbid\n" "Expected dbid 0x0002 and R193\n" "found dbid == %d\n" @@ -184,7 +184,7 @@ dbsrx::dbsrx(ctor_args_t args) : rx_dboard_base(args){ //warn user about incorrect DBID on non-USRP1, requires R194 populated if (not this->get_iface()->get_special_props().soft_clock_divider and this->get_rx_id() == 0x0002) - UHD_MSG(warning) << boost::format( + UHD_LOGGER_WARNING("DBSRX") << boost::format( "DBSRX: incorrect dbid\n" "Expected dbid 0x000D and R194\n" "found dbid == %d\n" @@ -279,9 +279,9 @@ double dbsrx::set_lo_freq(double target_freq){ m = 31; while ((ref_clock/m < 1e6 or ref_clock/m > 2.5e6) and m > 0){ m--; } - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("DBSRX") << boost::format( "DBSRX: trying ref_clock %f and m_divider %d" - ) % (ref_clock) % m << std::endl; + ) % (ref_clock) % m ; if (m >= 32) continue; @@ -289,7 +289,7 @@ double dbsrx::set_lo_freq(double target_freq){ for(auto r = 0; r <= 6; r += 1) { //compute divider from setting R = 1 << (r+1); - UHD_LOGV(often) << boost::format("DBSRX R:%d\n") % R << std::endl; + UHD_LOGGER_DEBUG("DBSRX") << boost::format("DBSRX R:%d\n") % R ; //compute PFD compare frequency = ref_clock/R pfd_freq = ref_clock / R; @@ -315,9 +315,9 @@ double dbsrx::set_lo_freq(double target_freq){ UHD_ASSERT_THROW((pfd_freq >= dbsrx_pfd_freq_range.start()) and (pfd_freq <= dbsrx_pfd_freq_range.stop())); UHD_ASSERT_THROW((N >= 256) and (N <= 32768)); - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("DBSRX") << boost::format( "DBSRX: choose ref_clock (current: %f, new: %f) and m_divider %d" - ) % (this->get_iface()->get_clock_rate(dboard_iface::UNIT_RX)) % ref_clock % m << std::endl; + ) % (this->get_iface()->get_clock_rate(dboard_iface::UNIT_RX)) % ref_clock % m ; //if ref_clock or m divider changed, we need to update the filter settings if (ref_clock != this->get_iface()->get_clock_rate(dboard_iface::UNIT_RX) or m != _max2118_write_regs.m_divider) update_filter_settings = true; @@ -337,9 +337,9 @@ double dbsrx::set_lo_freq(double target_freq){ int scaler = actual_freq > 1125e6 ? 2 : 4; _max2118_write_regs.div2 = scaler == 4 ? max2118_write_regs_t::DIV2_DIV4 : max2118_write_regs_t::DIV2_DIV2; - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("DBSRX") << boost::format( "DBSRX: scaler %d, actual_freq %f MHz, register bit: %d" - ) % scaler % (actual_freq/1e6) % int(_max2118_write_regs.div2) << std::endl; + ) % scaler % (actual_freq/1e6) % int(_max2118_write_regs.div2) ; //compute vco frequency and select vco double vco_freq = actual_freq * scaler; @@ -366,9 +366,9 @@ double dbsrx::set_lo_freq(double target_freq){ //check vtune for lock condition read_reg(0x0, 0x0); - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("DBSRX") << boost::format( "DBSRX: initial guess for vco %d, vtune adc %d" - ) % int(_max2118_write_regs.osc_band) % int(_max2118_read_regs.adc) << std::endl; + ) % int(_max2118_write_regs.osc_band) % int(_max2118_read_regs.adc) ; //if we are out of lock for chosen vco, change vco while ((_max2118_read_regs.adc == 0) or (_max2118_read_regs.adc == 7)){ @@ -376,7 +376,7 @@ double dbsrx::set_lo_freq(double target_freq){ //vtune is too low, try lower frequency vco if (_max2118_read_regs.adc == 0){ if (_max2118_write_regs.osc_band == 0){ - UHD_MSG(warning) << boost::format( + UHD_LOGGER_WARNING("DBSRX") << boost::format( "DBSRX: Tuning exceeded vco range, _max2118_write_regs.osc_band == %d\n" ) % int(_max2118_write_regs.osc_band); UHD_ASSERT_THROW(_max2118_read_regs.adc != 0); //just to cause a throw @@ -388,7 +388,7 @@ double dbsrx::set_lo_freq(double target_freq){ //vtune is too high, try higher frequency vco if (_max2118_read_regs.adc == 7){ if (_max2118_write_regs.osc_band == 7){ - UHD_MSG(warning) << boost::format( + UHD_LOGGER_WARNING("DBSRX") << boost::format( "DBSRX: Tuning exceeded vco range, _max2118_write_regs.osc_band == %d\n" ) % int(_max2118_write_regs.osc_band); UHD_ASSERT_THROW(_max2118_read_regs.adc != 7); //just to cause a throw @@ -397,9 +397,9 @@ double dbsrx::set_lo_freq(double target_freq){ _max2118_write_regs.osc_band += 1; } - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("DBSRX") << boost::format( "DBSRX: trying vco %d, vtune adc %d" - ) % int(_max2118_write_regs.osc_band) % int(_max2118_read_regs.adc) << std::endl; + ) % int(_max2118_write_regs.osc_band) % int(_max2118_read_regs.adc) ; //update vco selection and check vtune send_reg(0x2, 0x2); @@ -409,9 +409,9 @@ double dbsrx::set_lo_freq(double target_freq){ boost::this_thread::sleep(boost::posix_time::milliseconds(10)); } - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("DBSRX") << boost::format( "DBSRX: final vco %d, vtune adc %d" - ) % int(_max2118_write_regs.osc_band) % int(_max2118_read_regs.adc) << std::endl; + ) % int(_max2118_write_regs.osc_band) % int(_max2118_read_regs.adc) ; //select charge pump bias current if (_max2118_read_regs.adc <= 2) _max2118_write_regs.cp_current = max2118_write_regs_t::CP_CURRENT_I_CP_100UA; @@ -425,7 +425,7 @@ double dbsrx::set_lo_freq(double target_freq){ _lo_freq = this->get_iface()->get_clock_rate(dboard_iface::UNIT_RX) / std::pow(2.0,(1 + _max2118_write_regs.r_divider)) * _max2118_write_regs.get_n_divider(); //debug output of calculated variables - UHD_LOGV(often) + UHD_LOGGER_DEBUG("DBSRX") << boost::format("DBSRX tune:\n") << boost::format(" VCO=%d, CP=%d, PFD Freq=%fMHz\n") % int(_max2118_write_regs.osc_band) % _max2118_write_regs.cp_current % (pfd_freq/1e6) << boost::format(" R=%d, N=%f, scaler=%d, div2=%d\n") % R % N % scaler % int(_max2118_write_regs.div2) @@ -433,7 +433,7 @@ double dbsrx::set_lo_freq(double target_freq){ << boost::format(" Target Freq=%fMHz\n") % (target_freq/1e6) << boost::format(" Actual Freq=%fMHz\n") % (_lo_freq/1e6) << boost::format(" VCO Freq=%fMHz\n") % (vco_freq/1e6) - << std::endl; + ; if (update_filter_settings) set_bandwidth(_bandwidth); get_locked(); @@ -463,9 +463,9 @@ static int gain_to_gc2_vga_reg(double &gain){ gain = double(boost::math::iround(gain)); } - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("DBSRX") << boost::format( "DBSRX GC2 Gain: %f dB, reg: %d" - ) % gain % reg << std::endl; + ) % gain % reg ; return reg; } @@ -487,9 +487,9 @@ static double gain_to_gc1_rfvga_dac(double &gain){ //calculate the voltage for the aux dac double dac_volts = gain*slope + min_volts; - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("DBSRX") << boost::format( "DBSRX GC1 Gain: %f dB, dac_volts: %f V" - ) % gain % dac_volts << std::endl; + ) % gain % dac_volts ; //the actual gain setting gain = (dac_volts - min_volts)/slope; @@ -533,9 +533,9 @@ double dbsrx::set_bandwidth(double bandwidth){ //determine actual bandwidth _bandwidth = double((ref_clock/(_max2118_write_regs.m_divider))*(4+0.145*_max2118_write_regs.f_dac)); - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("DBSRX") << boost::format( "DBSRX Filter Bandwidth: %f MHz, m: %d, f_dac: %d\n" - ) % (_bandwidth/1e6) % int(_max2118_write_regs.m_divider) % int(_max2118_write_regs.f_dac) << std::endl; + ) % (_bandwidth/1e6) % int(_max2118_write_regs.m_divider) % int(_max2118_write_regs.f_dac) ; this->send_reg(0x3, 0x4); diff --git a/host/lib/usrp/dboard/db_dbsrx2.cpp b/host/lib/usrp/dboard/db_dbsrx2.cpp index 544671d3b..1efc6efd7 100644 --- a/host/lib/usrp/dboard/db_dbsrx2.cpp +++ b/host/lib/usrp/dboard/db_dbsrx2.cpp @@ -92,9 +92,9 @@ private: //get the register data for(int i=0; i<num_bytes; i++){ regs_vector[1+i] = _max2112_write_regs.get_reg(start_addr+i); - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("DBSRX") << boost::format( "DBSRX2: send reg 0x%02x, value 0x%04x, start_addr = 0x%04x, num_bytes %d" - ) % int(start_addr+i) % int(regs_vector[1+i]) % int(start_addr) % num_bytes << std::endl; + ) % int(start_addr+i) % int(regs_vector[1+i]) % int(start_addr) % num_bytes ; } //send the data @@ -133,14 +133,14 @@ private: if (i + start_addr >= status_addr){ _max2112_read_regs.set_reg(i + start_addr, regs_vector[i]); /* - UHD_LOGV(always) << boost::format( + UHD_LOGGER_DEBUG("DBSRX") << boost::format( "DBSRX2: set reg 0x%02x, value 0x%04x" - ) % int(i + start_addr) % int(_max2112_read_regs.get_reg(i + start_addr)) << std::endl; + ) % int(i + start_addr) % int(_max2112_read_regs.get_reg(i + start_addr)); */ } - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("DBSRX") << boost::format( "DBSRX2: read reg 0x%02x, value 0x%04x, start_addr = 0x%04x, num_bytes %d" - ) % int(start_addr+i) % int(regs_vector[i]) % int(start_addr) % num_bytes << std::endl; + ) % int(start_addr+i) % int(regs_vector[i]) % int(start_addr) % num_bytes ; } } } @@ -155,9 +155,9 @@ private: //mask and return lock detect bool locked = (_max2112_read_regs.ld & _max2112_read_regs.vasa & _max2112_read_regs.vase) != 0; - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("DBSRX") << boost::format( "DBSRX2 locked: %d" - ) % locked << std::endl; + ) % locked ; return sensor_value_t("LO", locked, "locked", "unlocked"); } @@ -189,7 +189,7 @@ dbsrx2::dbsrx2(ctor_args_t args) : rx_dboard_base(args){ // Register properties //////////////////////////////////////////////////////////////////// this->get_rx_subtree()->create<std::string>("name") - .set("DBSRX2"); + .set("DBSRX"); this->get_rx_subtree()->create<sensor_value_t>("sensors/lo_locked") .set_publisher(boost::bind(&dbsrx2::get_locked, this)); for(const std::string &name: dbsrx2_gain_ranges.keys()){ @@ -270,14 +270,14 @@ double dbsrx2::set_lo_freq(double target_freq){ _max2112_write_regs.d24 = scaler == 4 ? max2112_write_regs_t::D24_DIV4 : max2112_write_regs_t::D24_DIV2; //debug output of calculated variables - UHD_LOGV(often) + UHD_LOGGER_DEBUG("DBSRX") << boost::format("DBSRX2 tune:\n") << boost::format(" R=%d, N=%f, scaler=%d, ext_div=%d\n") % R % N % scaler % ext_div << boost::format(" int=%d, frac=%d, d24=%d\n") % intdiv % fracdiv % int(_max2112_write_regs.d24) << boost::format(" Ref Freq=%fMHz\n") % (ref_freq/1e6) << boost::format(" Target Freq=%fMHz\n") % (target_freq/1e6) << boost::format(" Actual Freq=%fMHz\n") % (_lo_freq/1e6) - << std::endl; + ; //send the registers 0x0 through 0x7 //writing register 0x4 (F divider LSB) starts the VCO auto seletion so it must be written last @@ -304,10 +304,10 @@ static int gain_to_bbg_vga_reg(double &gain){ gain = double(reg); - UHD_LOGV(often) + UHD_LOGGER_DEBUG("DBSRX") << boost::format("DBSRX2 BBG Gain:\n") << boost::format(" %f dB, bbg: %d") % gain % reg - << std::endl; + ; return reg; } @@ -329,10 +329,10 @@ static double gain_to_gc1_rfvga_dac(double &gain){ //calculate the voltage for the aux dac double dac_volts = gain*slope + min_volts; - UHD_LOGV(often) + UHD_LOGGER_DEBUG("DBSRX") << boost::format("DBSRX2 GC1 Gain:\n") << boost::format(" %f dB, dac_volts: %f V") % gain % dac_volts - << std::endl; + ; //the actual gain setting gain = (dac_volts - min_volts)/slope; @@ -369,10 +369,10 @@ double dbsrx2::set_bandwidth(double bandwidth){ _max2112_write_regs.lp = int((bandwidth/1e6 - 4)/0.29 + 12); _bandwidth = double(4 + (_max2112_write_regs.lp - 12) * 0.29)*1e6; - UHD_LOGV(often) + UHD_LOGGER_DEBUG("DBSRX") << boost::format("DBSRX2 Bandwidth:\n") << boost::format(" %f MHz, lp: %f V") % (_bandwidth/1e6) % int(_max2112_write_regs.lp) - << std::endl; + ; this->send_reg(0x8, 0x8); diff --git a/host/lib/usrp/dboard/db_rfx.cpp b/host/lib/usrp/dboard/db_rfx.cpp index 3982ba224..0a2729320 100644 --- a/host/lib/usrp/dboard/db_rfx.cpp +++ b/host/lib/usrp/dboard/db_rfx.cpp @@ -40,7 +40,7 @@ #include <uhd/utils/log.hpp> #include <uhd/utils/static.hpp> #include <uhd/utils/algorithm.hpp> -#include <uhd/utils/msg.hpp> + #include <uhd/usrp/dboard_id.hpp> #include <uhd/usrp/dboard_base.hpp> #include <uhd/usrp/dboard_manager.hpp> @@ -339,9 +339,9 @@ double rfx_xcvr::set_lo_freq( dboard_iface::unit_t unit, double target_freq ){ - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("RFX") << boost::format( "RFX tune: target frequency %f MHz" - ) % (target_freq/1e6) << std::endl; + ) % (target_freq/1e6) ; //clip the input target_freq = _freq_range.clip(target_freq); @@ -396,9 +396,9 @@ double rfx_xcvr::set_lo_freq( } } done_loop: - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("RFX") << boost::format( "RFX tune: R=%d, BS=%d, P=%d, B=%d, A=%d, DIV2=%d" - ) % R % BS % P % B % A % int(_div2[unit] && (!is_rx_rfx400)) << std::endl; + ) % R % BS % P % B % A % int(_div2[unit] && (!is_rx_rfx400)) ; //load the register values adf4360_regs_t regs; @@ -442,8 +442,8 @@ double rfx_xcvr::set_lo_freq( //return the actual frequency if (_div2[unit]) actual_freq /= 2; - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("RFX") << boost::format( "RFX tune: actual frequency %f MHz" - ) % (actual_freq/1e6) << std::endl; + ) % (actual_freq/1e6) ; return actual_freq; } diff --git a/host/lib/usrp/dboard/db_sbx_common.cpp b/host/lib/usrp/dboard/db_sbx_common.cpp index ab7eb2566..fccad7cf7 100644 --- a/host/lib/usrp/dboard/db_sbx_common.cpp +++ b/host/lib/usrp/dboard/db_sbx_common.cpp @@ -53,9 +53,9 @@ static int rx_pga0_gain_to_iobits(double &gain){ int attn_code = int(floor(attn*2)); int iobits = ((~attn_code) << RX_ATTN_SHIFT) & RX_ATTN_MASK; - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("SBX") << boost::format( "SBX RX Attenuation: %f dB, Code: %d, IO Bits %x, Mask: %x" - ) % attn % attn_code % (iobits & RX_ATTN_MASK) % RX_ATTN_MASK << std::endl; + ) % attn % attn_code % (iobits & RX_ATTN_MASK) % RX_ATTN_MASK ; //the actual gain setting gain = sbx_rx_gain_ranges["PGA0"].stop() - double(attn_code)/2; @@ -74,9 +74,9 @@ static int tx_pga0_gain_to_iobits(double &gain){ int attn_code = int(floor(attn*2)); int iobits = ((~attn_code) << TX_ATTN_SHIFT) & TX_ATTN_MASK; - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("SBX") << boost::format( "SBX TX Attenuation: %f dB, Code: %d, IO Bits %x, Mask: %x" - ) % attn % attn_code % (iobits & TX_ATTN_MASK) % TX_ATTN_MASK << std::endl; + ) % attn % attn_code % (iobits & TX_ATTN_MASK) % TX_ATTN_MASK ; //the actual gain setting gain = sbx_tx_gain_ranges["PGA0"].stop() - double(attn_code)/2; @@ -240,9 +240,9 @@ sbx_xcvr::sbx_xcvr(ctor_args_t args) : xcvr_dboard_base(args){ //Initialize ATR registers after direction and pin ctrl configuration update_atr(); - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("SBX") << boost::format( "SBX GPIO Direction: RX: 0x%08x, TX: 0x%08x" - ) % RXIO_MASK % TXIO_MASK << std::endl; + ) % RXIO_MASK % TXIO_MASK ; } sbx_xcvr::~sbx_xcvr(void){ diff --git a/host/lib/usrp/dboard/db_sbx_common.hpp b/host/lib/usrp/dboard/db_sbx_common.hpp index ad64e2267..0e4dc5ace 100644 --- a/host/lib/usrp/dboard/db_sbx_common.hpp +++ b/host/lib/usrp/dboard/db_sbx_common.hpp @@ -84,7 +84,7 @@ #include <uhd/utils/log.hpp> #include <uhd/utils/static.hpp> #include <uhd/utils/algorithm.hpp> -#include <uhd/utils/msg.hpp> + #include <uhd/usrp/dboard_base.hpp> #include <uhd/usrp/dboard_manager.hpp> #include <boost/assign/list_of.hpp> diff --git a/host/lib/usrp/dboard/db_sbx_version3.cpp b/host/lib/usrp/dboard/db_sbx_version3.cpp index 91a1b6a53..9f762a7f2 100644 --- a/host/lib/usrp/dboard/db_sbx_version3.cpp +++ b/host/lib/usrp/dboard/db_sbx_version3.cpp @@ -50,9 +50,9 @@ void sbx_xcvr::sbx_version3::write_lo_regs(dboard_iface::unit_t unit, const std: * Tuning **********************************************************************/ double sbx_xcvr::sbx_version3::set_lo_freq(dboard_iface::unit_t unit, double target_freq) { - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("SBX") << boost::format( "SBX tune: target frequency %f MHz" - ) % (target_freq/1e6) << std::endl; + ) % (target_freq/1e6) ; /* * If the user sets 'mode_n=integer' in the tuning args, the user wishes to diff --git a/host/lib/usrp/dboard/db_sbx_version4.cpp b/host/lib/usrp/dboard/db_sbx_version4.cpp index 6521285ea..effe0b5eb 100644 --- a/host/lib/usrp/dboard/db_sbx_version4.cpp +++ b/host/lib/usrp/dboard/db_sbx_version4.cpp @@ -52,9 +52,9 @@ void sbx_xcvr::sbx_version4::write_lo_regs(dboard_iface::unit_t unit, const std: * Tuning **********************************************************************/ double sbx_xcvr::sbx_version4::set_lo_freq(dboard_iface::unit_t unit, double target_freq) { - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("SBX") << boost::format( "SBX tune: target frequency %f MHz" - ) % (target_freq/1e6) << std::endl; + ) % (target_freq/1e6) ; /* * If the user sets 'mode_n=integer' in the tuning args, the user wishes to diff --git a/host/lib/usrp/dboard/db_tvrx.cpp b/host/lib/usrp/dboard/db_tvrx.cpp index 5b25883f8..41188ff77 100644 --- a/host/lib/usrp/dboard/db_tvrx.cpp +++ b/host/lib/usrp/dboard/db_tvrx.cpp @@ -31,7 +31,7 @@ #include <uhd/utils/static.hpp> #include <uhd/utils/assert_has.hpp> #include <uhd/utils/algorithm.hpp> -#include <uhd/utils/msg.hpp> + #include <uhd/types/ranges.hpp> #include <uhd/types/sensors.hpp> #include <uhd/types/dict.hpp> @@ -153,9 +153,9 @@ private: //get the register data for(int i=0; i<4; i++){ regs_vector[i] = _tuner_4937di5_regs.get_reg(i); - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("TVRX") << boost::format( "tvrx: send reg 0x%02x, value 0x%04x" - ) % int(i) % int(regs_vector[i]) << std::endl; + ) % int(i) % int(regs_vector[i]) ; } //send the data @@ -249,7 +249,7 @@ tvrx::~tvrx(void){ static std::string get_band(double freq) { for(const std::string &band: tvrx_freq_ranges.keys()) { if(freq >= tvrx_freq_ranges[band].start() && freq <= tvrx_freq_ranges[band].stop()){ - UHD_LOGV(often) << "Band: " << band << std::endl; + UHD_LOGGER_DEBUG("TVRX") << "Band: " << band ; return band; } } @@ -291,7 +291,7 @@ static double gain_interp(double gain, const boost::array<double, 17>& db_vector //use the volts per dB slope to find the final interpolated voltage volts = volts_vector[gain_step] + (slope * (gain - db_vector[gain_step])); - UHD_LOGV(often) << "Gain interp: gain: " << gain << ", gain_step: " << int(gain_step) << ", slope: " << slope << ", volts: " << volts << std::endl; + UHD_LOGGER_DEBUG("TVRX") << "Gain interp: gain: " << gain << ", gain_step: " << int(gain_step) << ", slope: " << slope << ", volts: " << volts ; return volts; } @@ -317,9 +317,9 @@ static double rf_gain_to_voltage(double gain, double lo_freq){ dac_volts = uhd::clip<double>(dac_volts, 0.0, 3.3); - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("TVRX") << boost::format( "tvrx RF AGC gain: %f dB, dac_volts: %f V" - ) % gain % dac_volts << std::endl; + ) % gain % dac_volts ; return dac_volts; } @@ -340,9 +340,9 @@ static double if_gain_to_voltage(double gain){ dac_volts = uhd::clip<double>(dac_volts, 0.0, 3.3); - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("TVRX") << boost::format( "tvrx IF AGC gain: %f dB, dac_volts: %f V" - ) % gain % dac_volts << std::endl; + ) % gain % dac_volts ; return dac_volts; } @@ -396,7 +396,7 @@ double tvrx::set_freq(double freq) { //not FAR off, but we do this to be consistent if(prev_band != new_band) set_gain(_gains["RF"], "RF"); - UHD_LOGV(often) << boost::format("set_freq: target LO: %f f_ref: %f divisor: %i actual LO: %f") % target_lo_freq % f_ref % divisor % actual_lo_freq << std::endl; + UHD_LOGGER_DEBUG("TVRX") << boost::format("set_freq: target LO: %f f_ref: %f divisor: %i actual LO: %f") % target_lo_freq % f_ref % divisor % actual_lo_freq ; _lo_freq = actual_lo_freq; //for rx props diff --git a/host/lib/usrp/dboard/db_tvrx2.cpp b/host/lib/usrp/dboard/db_tvrx2.cpp index 3ba581b0f..6be3684d7 100644 --- a/host/lib/usrp/dboard/db_tvrx2.cpp +++ b/host/lib/usrp/dboard/db_tvrx2.cpp @@ -52,7 +52,7 @@ #include "tda18272hnm_regs.hpp" #include <uhd/utils/static.hpp> #include <uhd/utils/log.hpp> -#include <uhd/utils/msg.hpp> + #include <uhd/utils/safe_call.hpp> #include <uhd/utils/assert_has.hpp> #include <uhd/utils/algorithm.hpp> @@ -803,9 +803,9 @@ private: //return irq status bool irq = _tda18272hnm_regs.irq_status == tda18272hnm_regs_t::IRQ_STATUS_SET; - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("TVRX") << boost::format( "TVRX2 (%s): IRQ %d" - ) % (get_subdev_name()) % irq << std::endl; + ) % (get_subdev_name()) % irq ; return irq; } @@ -821,9 +821,9 @@ private: //return POR state bool por = _tda18272hnm_regs.por == tda18272hnm_regs_t::POR_RESET; - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("TVRX") << boost::format( "TVRX2 (%s): POR %d" - ) % (get_subdev_name()) % int(_tda18272hnm_regs.por) << std::endl; + ) % (get_subdev_name()) % int(_tda18272hnm_regs.por) ; return por; } @@ -838,9 +838,9 @@ private: //return lock detect bool locked = _tda18272hnm_regs.lo_lock == tda18272hnm_regs_t::LO_LOCK_LOCKED; - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("TVRX") << boost::format( "TVRX2 (%s): locked %d" - ) % (get_subdev_name()) % locked << std::endl; + ) % (get_subdev_name()) % locked ; return sensor_value_t("LO", locked, "locked", "unlocked"); } @@ -881,9 +881,9 @@ private: //read temp in degC read_reg(0x3, 0x3); - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("TVRX") << boost::format( "TVRX2 (%s): Temperature %f C" - ) % (get_subdev_name()) % (double(_tda18272hnm_regs.tm_d)) << std::endl; + ) % (get_subdev_name()) % (double(_tda18272hnm_regs.tm_d)) ; //Disable Temperature reading _tda18272hnm_regs.tm_on = tda18272hnm_regs_t::TM_ON_SENSOR_OFF; @@ -999,42 +999,42 @@ tvrx2::tvrx2(ctor_args_t args) : rx_dboard_base(args){ if (ref_clock == 64.0e6) { this->get_iface()->set_gpio_out(dboard_iface::UNIT_RX, REFCLOCK_DIV4); - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("TVRX") << boost::format( "TVRX2 (%s): Dividing Refclock by 4" - ) % (get_subdev_name()) << std::endl; + ) % (get_subdev_name()) ; _freq_scalar = (4*16.0e6)/(this->get_iface()->get_clock_rate(dboard_iface::UNIT_RX)); } else if (ref_clock == 100e6) { this->get_iface()->set_gpio_out(dboard_iface::UNIT_RX, REFCLOCK_DIV6); - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("TVRX") << boost::format( "TVRX2 (%s): Dividing Refclock by 6" - ) % (get_subdev_name()) << std::endl; + ) % (get_subdev_name()) ; _freq_scalar = (6*16.0e6)/this->get_iface()->get_clock_rate(dboard_iface::UNIT_RX); } else if (ref_clock == 200e6) { - UHD_MSG(warning) << boost::format("ref_clock was 200e6, setting ref_clock divider for 100e6.") << std::endl; + UHD_LOGGER_WARNING("TVRX") << boost::format("ref_clock was 200e6, setting ref_clock divider for 100e6.") ; this->get_iface()->set_clock_rate(dboard_iface::UNIT_RX, 100e6); this->get_iface()->set_gpio_out(dboard_iface::UNIT_RX, REFCLOCK_DIV6); - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("TVRX") << boost::format( "TVRX2 (%s): Dividing Refclock by 6" - ) % (get_subdev_name()) << std::endl; + ) % (get_subdev_name()) ; _freq_scalar = (6*16.0e6)/this->get_iface()->get_clock_rate(dboard_iface::UNIT_RX); } else { this->get_iface()->set_gpio_out(dboard_iface::UNIT_RX, REFCLOCK_DIV6); - UHD_MSG(warning) << boost::format("Unsupported ref_clock %0.2f, valid options 64e6, 100e6, 200e6") % ref_clock << std::endl; + UHD_LOGGER_WARNING("TVRX") << boost::format("Unsupported ref_clock %0.2f, valid options 64e6, 100e6, 200e6") % ref_clock ; _freq_scalar = 1.0; } //enable only the clocks we need this->get_iface()->set_clock_enabled(dboard_iface::UNIT_RX, true); - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("TVRX") << boost::format( "TVRX2 (%s): Refclock %f Hz, scalar = %f" - ) % (get_subdev_name()) % (this->get_iface()->get_clock_rate(dboard_iface::UNIT_RX)) % _freq_scalar << std::endl; + ) % (get_subdev_name()) % (this->get_iface()->get_clock_rate(dboard_iface::UNIT_RX)) % _freq_scalar ; _tda18272hnm_regs.irq_polarity = tda18272hnm_regs_t::IRQ_POLARITY_RAISED_VCC; _tda18272hnm_regs.irq_clear = tda18272hnm_regs_t::IRQ_CLEAR_TRUE; @@ -1092,9 +1092,9 @@ bool tvrx2::set_enabled(bool enable){ } tvrx2::~tvrx2(void){ - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("TVRX") << boost::format( "TVRX2 (%s): Called Destructor" - ) % (get_subdev_name()) << std::endl; + ) % (get_subdev_name()) ; UHD_SAFE_CALL(if (_enabled) set_enabled(false);) } @@ -1134,9 +1134,9 @@ void tvrx2::send_reg(uint8_t start_reg, uint8_t stop_reg){ //get the register data for(int i=0; i<num_bytes; i++){ regs_vector[1+i] = _tda18272hnm_regs.get_reg(start_addr+i); - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("TVRX") << boost::format( "TVRX2 (%s, 0x%02x): send reg 0x%02x, value 0x%04x, start_addr = 0x%04x, num_bytes %d" - ) % (get_subdev_name()) % int(tvrx2_sd_name_to_i2c_addr[get_subdev_name()]) % int(start_addr+i) % int(regs_vector[1+i]) % int(start_addr) % num_bytes << std::endl; + ) % (get_subdev_name()) % int(tvrx2_sd_name_to_i2c_addr[get_subdev_name()]) % int(start_addr+i) % int(regs_vector[1+i]) % int(start_addr) % num_bytes ; } //send the data @@ -1177,9 +1177,9 @@ void tvrx2::read_reg(uint8_t start_reg, uint8_t stop_reg){ if (i + start_addr >= status_addr){ _tda18272hnm_regs.set_reg(i + start_addr, regs_vector[i]); } - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("TVRX") << boost::format( "TVRX2 (%s, 0x%02x): read reg 0x%02x, value 0x%04x, start_addr = 0x%04x, num_bytes %d" - ) % (get_subdev_name()) % int(tvrx2_sd_name_to_i2c_addr[get_subdev_name()]) % int(start_addr+i) % int(regs_vector[i]) % int(start_addr) % num_bytes << std::endl; + ) % (get_subdev_name()) % int(tvrx2_sd_name_to_i2c_addr[get_subdev_name()]) % int(start_addr+i) % int(regs_vector[i]) % int(start_addr) % num_bytes ; } } } @@ -1374,7 +1374,7 @@ void tvrx2::tvrx2_tda18272_tune_rf_filter(uint32_t uRF) _tda18272hnm_regs.gain_taper = gain_taper; _tda18272hnm_regs.rf_filter_band = RFBand; - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("TVRX") << boost::format( "\nTVRX2 (%s): Software Calibration:\n" "\tRF Filter Bypass = %d\n" "\tRF Filter Cap = %d\n" @@ -1385,14 +1385,14 @@ void tvrx2::tvrx2_tda18272_tune_rf_filter(uint32_t uRF) % int(_tda18272hnm_regs.rf_filter_cap) % int(_tda18272hnm_regs.rf_filter_band) % int(_tda18272hnm_regs.gain_taper) - << std::endl; + ; send_reg(0x2c, 0x2f); } void tvrx2::soft_calibration(void){ - UHD_LOGV(often) << boost::format( - "\nTVRX2 (%s): Software Calibration: Initialize Tuner, Calibrate and Standby\n") % (get_subdev_name()) << std::endl; + UHD_LOGGER_DEBUG("TVRX") << boost::format( + "\nTVRX2 (%s): Software Calibration: Initialize Tuner, Calibrate and Standby\n") % (get_subdev_name()) ; _tda18272hnm_regs.sm = tda18272hnm_regs_t::SM_NORMAL; _tda18272hnm_regs.sm_lna = tda18272hnm_regs_t::SM_LNA_ON; @@ -1515,12 +1515,12 @@ void tvrx2::test_rf_filter_robustness(void){ } std::stringstream robustness_message; - robustness_message << boost::format("TVRX2 (%s): RF Filter Robustness Results:") % (get_subdev_name()) << std::endl; + robustness_message << boost::format("TVRX2 (%s): RF Filter Robustness Results:") % (get_subdev_name()); for(const std::string &name: uhd::sorted(_filter_ratings.keys())){ - robustness_message << boost::format("\t%s:\tMargin = %0.2f,\tRobustness = %c") % name % (_filter_margins[name]) % (_filter_ratings[name]) << std::endl; + robustness_message << boost::format("\t%s:\tMargin = %0.2f,\tRobustness = %c") % name % (_filter_margins[name]) % (_filter_ratings[name]); } - UHD_LOGV(often) << robustness_message.str(); + UHD_LOGGER_DEBUG("TVRX") << robustness_message.str(); } /*********************************************************************** @@ -1528,8 +1528,8 @@ void tvrx2::test_rf_filter_robustness(void){ **********************************************************************/ void tvrx2::transition_0(void){ //Transition 0: Initialize Tuner and place in standby - UHD_LOGV(often) << boost::format( - "\nTVRX2 (%s): Transition 0: Initialize Tuner, Calibrate and Standby\n") % (get_subdev_name()) << std::endl; + UHD_LOGGER_DEBUG("TVRX") << boost::format( + "\nTVRX2 (%s): Transition 0: Initialize Tuner, Calibrate and Standby\n") % (get_subdev_name()) ; //Check for Power-On Reset, if reset, initialze tuner if (get_power_reset()) { @@ -1582,8 +1582,8 @@ void tvrx2::transition_0(void){ void tvrx2::transition_1(void){ //Transition 1: Select TV Standard - UHD_LOGV(often) << boost::format( - "\nTVRX2 (%s): Transition 1: Select TV Standard\n") % (get_subdev_name()) << std::endl; + UHD_LOGGER_DEBUG("TVRX") << boost::format( + "\nTVRX2 (%s): Transition 1: Select TV Standard\n") % (get_subdev_name()) ; //send magic xtal_cal_dac setting send_reg(0x65, 0x65); @@ -1613,8 +1613,8 @@ void tvrx2::transition_1(void){ void tvrx2::transition_2(int rf_freq){ //Transition 2: Select RF Frequency after changing TV Standard - UHD_LOGV(often) << boost::format( - "\nTVRX2 (%s): Transition 2: Select RF Frequency after changing TV Standard\n") % (get_subdev_name()) << std::endl; + UHD_LOGGER_DEBUG("TVRX") << boost::format( + "\nTVRX2 (%s): Transition 2: Select RF Frequency after changing TV Standard\n") % (get_subdev_name()) ; //send magic xtal_cal_dac setting send_reg(0x65, 0x65); @@ -1651,8 +1651,8 @@ void tvrx2::transition_2(int rf_freq){ void tvrx2::transition_3(void){ //Transition 3: Standby Mode - UHD_LOGV(often) << boost::format( - "\nTVRX2 (%s): Transition 3: Standby Mode\n") % (get_subdev_name()) << std::endl; + UHD_LOGGER_DEBUG("TVRX") << boost::format( + "\nTVRX2 (%s): Transition 3: Standby Mode\n") % (get_subdev_name()) ; //send magic xtal_cal_dac setting send_reg(0x65, 0x65); @@ -1670,8 +1670,8 @@ void tvrx2::transition_3(void){ void tvrx2::transition_4(int rf_freq){ //Transition 4: Change RF Frequency without changing TV Standard - UHD_LOGV(often) << boost::format( - "\nTVRX2 (%s): Transition 4: Change RF Frequency without changing TV Standard\n") % (get_subdev_name()) << std::endl; + UHD_LOGGER_DEBUG("TVRX") << boost::format( + "\nTVRX2 (%s): Transition 4: Change RF Frequency without changing TV Standard\n") % (get_subdev_name()) ; //send magic xtal_cal_dac setting send_reg(0x65, 0x65); @@ -1699,8 +1699,8 @@ void tvrx2::wait_irq(void){ int timeout = 20; //irq waiting timeout in milliseconds //int irq = (this->get_iface()->read_gpio(dboard_iface::UNIT_RX) & int(tvrx2_sd_name_to_irq_io[get_subdev_name()])); bool irq = get_irq(); - UHD_LOGV(often) << boost::format( - "\nTVRX2 (%s): Waiting on IRQ, subdev = %d, mask = 0x%x, Status: 0x%x\n") % (get_subdev_name()) % get_subdev_name() % (int(tvrx2_sd_name_to_irq_io[get_subdev_name()])) % irq << std::endl; + UHD_LOGGER_DEBUG("TVRX") << boost::format( + "\nTVRX2 (%s): Waiting on IRQ, subdev = %d, mask = 0x%x, Status: 0x%x\n") % (get_subdev_name()) % get_subdev_name() % (int(tvrx2_sd_name_to_irq_io[get_subdev_name()])) % irq ; while (not irq and timeout > 0) { //irq = (this->get_iface()->read_gpio(dboard_iface::UNIT_RX) & tvrx2_sd_name_to_irq_io[get_subdev_name()]); @@ -1709,13 +1709,13 @@ void tvrx2::wait_irq(void){ timeout -= 1; } - UHD_LOGV(often) << boost::format( - "\nTVRX2 (%s): IRQ Raised, subdev = %d, mask = 0x%x, Status: 0x%x, Timeout: %d\n") % (get_subdev_name()) % get_subdev_name() % (int(tvrx2_sd_name_to_irq_io[get_subdev_name()])) % irq % timeout << std::endl; + UHD_LOGGER_DEBUG("TVRX") << boost::format( + "\nTVRX2 (%s): IRQ Raised, subdev = %d, mask = 0x%x, Status: 0x%x, Timeout: %d\n") % (get_subdev_name()) % get_subdev_name() % (int(tvrx2_sd_name_to_irq_io[get_subdev_name()])) % irq % timeout ; read_reg(0xA, 0xB); //UHD_ASSERT_THROW(timeout > 0); - if(timeout <= 0) UHD_MSG(warning) << boost::format( - "\nTVRX2 (%s): Timeout waiting on IRQ\n") % (get_subdev_name()) << std::endl; + if(timeout <= 0) UHD_LOGGER_WARNING("TVRX") << boost::format( + "\nTVRX2 (%s): Timeout waiting on IRQ\n") % (get_subdev_name()) ; _tda18272hnm_regs.irq_clear = tda18272hnm_regs_t::IRQ_CLEAR_TRUE; send_reg(0xA, 0xA); @@ -1723,8 +1723,8 @@ void tvrx2::wait_irq(void){ irq = (this->get_iface()->read_gpio(dboard_iface::UNIT_RX) & tvrx2_sd_name_to_irq_io[get_subdev_name()]) > 0; - UHD_LOGV(often) << boost::format( - "\nTVRX2 (%s): Cleared IRQ, subdev = %d, mask = 0x%x, Status: 0x%x\n") % (get_subdev_name()) % get_subdev_name() % (int(tvrx2_sd_name_to_irq_io[get_subdev_name()])) % irq << std::endl; + UHD_LOGGER_DEBUG("TVRX") << boost::format( + "\nTVRX2 (%s): Cleared IRQ, subdev = %d, mask = 0x%x, Status: 0x%x\n") % (get_subdev_name()) % get_subdev_name() % (int(tvrx2_sd_name_to_irq_io[get_subdev_name()])) % irq ; } @@ -1748,20 +1748,20 @@ double tvrx2::set_lo_freq(double target_freq){ _lo_freq = get_scaled_rf_freq() + get_scaled_if_freq(); // - _bandwidth/2; //debug output of calculated variables - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("TVRX") << boost::format( "\nTVRX2 (%s): LO Frequency\n" "\tRequested: \t%f\n" "\tComputed: \t%f\n" "\tReadback: \t%f\n" - "\tIF Frequency: \t%f\n") % (get_subdev_name()) % target_freq % double(int(target_freq/1e3)*1e3) % get_scaled_rf_freq() % get_scaled_if_freq() << std::endl; + "\tIF Frequency: \t%f\n") % (get_subdev_name()) % target_freq % double(int(target_freq/1e3)*1e3) % get_scaled_rf_freq() % get_scaled_if_freq() ; get_locked(); test_rf_filter_robustness(); - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("TVRX") << boost::format( "\nTVRX2 (%s): RSSI = %f dBm\n" - ) % (get_subdev_name()) % (get_rssi().to_real()) << std::endl; + ) % (get_subdev_name()) % (get_rssi().to_real()) ; return _lo_freq; } @@ -1783,9 +1783,9 @@ static double gain_to_if_gain_dac(double &gain){ //calculate the voltage for the aux dac double dac_volts = gain*slope + min_volts; - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("TVRX") << boost::format( "TVRX2 IF Gain: %f dB, dac_volts: %f V" - ) % gain % dac_volts << std::endl; + ) % gain % dac_volts ; //the actual gain setting gain = (dac_volts - min_volts)/slope; @@ -1847,9 +1847,9 @@ double tvrx2::set_bandwidth(double bandwidth){ //update register send_reg(0x13, 0x13); - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("TVRX") << boost::format( "TVRX2 (%s) Bandwidth (lp_fc): %f Hz, reg: %d" - ) % (get_subdev_name()) % _bandwidth % (int(_tda18272hnm_regs.lp_fc)) << std::endl; + ) % (get_subdev_name()) % _bandwidth % (int(_tda18272hnm_regs.lp_fc)) ; return _bandwidth; } diff --git a/host/lib/usrp/dboard/db_ubx.cpp b/host/lib/usrp/dboard/db_ubx.cpp index 2f3c1ebe7..b52234947 100644 --- a/host/lib/usrp/dboard/db_ubx.cpp +++ b/host/lib/usrp/dboard/db_ubx.cpp @@ -27,7 +27,7 @@ #include <uhd/usrp/dboard_manager.hpp> #include <uhd/utils/assert_has.hpp> #include <uhd/utils/log.hpp> -#include <uhd/utils/msg.hpp> + #include <uhd/utils/static.hpp> #include <uhd/utils/safe_call.hpp> #include <boost/assign/list_of.hpp> @@ -749,7 +749,7 @@ private: _ubx_tx_atten_val = ((attn_code & 0x3F) << 10); set_gpio_field(TX_GAIN, attn_code); write_gpio(); - UHD_LOGV(rarely) << boost::format("UBX TX Gain: %f dB, Code: %d, IO Bits 0x%04x") % gain % attn_code % _ubx_tx_atten_val << std::endl; + UHD_LOGGER_DEBUG("UBX") << boost::format("UBX TX Gain: %f dB, Code: %d, IO Bits 0x%04x") % gain % attn_code % _ubx_tx_atten_val ; _tx_gain = gain; return gain; } @@ -762,7 +762,7 @@ private: _ubx_rx_atten_val = ((attn_code & 0x3F) << 10); set_gpio_field(RX_GAIN, attn_code); write_gpio(); - UHD_LOGV(rarely) << boost::format("UBX RX Gain: %f dB, Code: %d, IO Bits 0x%04x") % gain % attn_code % _ubx_rx_atten_val << std::endl; + UHD_LOGGER_DEBUG("UBX") << boost::format("UBX RX Gain: %f dB, Code: %d, IO Bits 0x%04x") % gain % attn_code % _ubx_rx_atten_val ; _rx_gain = gain; return gain; } @@ -786,18 +786,18 @@ private: property_tree::sptr subtree = this->get_tx_subtree(); device_addr_t tune_args = subtree->access<device_addr_t>("tune_args").get(); is_int_n = boost::iequals(tune_args.get("mode_n",""), "integer"); - UHD_LOGV(rarely) << boost::format("UBX TX: the requested frequency is %f MHz") % (freq/1e6) << std::endl; + UHD_LOGGER_DEBUG("UBX") << boost::format("UBX TX: the requested frequency is %f MHz") % (freq/1e6) ; double target_pfd_freq = _tx_target_pfd_freq; if (is_int_n and tune_args.has_key("int_n_step")) { target_pfd_freq = tune_args.cast<double>("int_n_step", _tx_target_pfd_freq); if (target_pfd_freq > _tx_target_pfd_freq) { - UHD_MSG(warning) + UHD_LOGGER_WARNING("UBX") << boost::format("Requested int_n_step of %f MHz too large, clipping to %f MHz") % (target_pfd_freq/1e6) % (_tx_target_pfd_freq/1e6) - << std::endl; + ; target_pfd_freq = _tx_target_pfd_freq; } } @@ -925,7 +925,7 @@ private: _txlo1_freq = freq_lo1; _txlo2_freq = freq_lo2; - UHD_LOGV(rarely) << boost::format("UBX TX: the actual frequency is %f MHz") % (_tx_freq/1e6) << std::endl; + UHD_LOGGER_DEBUG("UBX") << boost::format("UBX TX: the actual frequency is %f MHz") % (_tx_freq/1e6) ; return _tx_freq; } @@ -938,7 +938,7 @@ private: double ref_freq = _iface->get_clock_rate(dboard_iface::UNIT_RX); bool is_int_n = false; - UHD_LOGV(rarely) << boost::format("UBX RX: the requested frequency is %f MHz") % (freq/1e6) << std::endl; + UHD_LOGGER_DEBUG("UBX") << boost::format("UBX RX: the requested frequency is %f MHz") % (freq/1e6) ; property_tree::sptr subtree = this->get_rx_subtree(); device_addr_t tune_args = subtree->access<device_addr_t>("tune_args").get(); @@ -949,11 +949,11 @@ private: target_pfd_freq = tune_args.cast<double>("int_n_step", _rx_target_pfd_freq); if (target_pfd_freq > _rx_target_pfd_freq) { - UHD_MSG(warning) + UHD_LOGGER_WARNING("UBX") << boost::format("Requested int_n_step of %f Mhz too large, clipping to %f MHz") % (target_pfd_freq/1e6) % (_rx_target_pfd_freq/1e6) - << std::endl; + ; target_pfd_freq = _rx_target_pfd_freq; } } @@ -1121,7 +1121,7 @@ private: _rxlo1_freq = freq_lo1; _rxlo2_freq = freq_lo2; - UHD_LOGV(rarely) << boost::format("UBX RX: the actual frequency is %f MHz") % (_rx_freq/1e6) << std::endl; + UHD_LOGGER_DEBUG("UBX") << boost::format("UBX RX: the actual frequency is %f MHz") % (_rx_freq/1e6) ; return _rx_freq; } diff --git a/host/lib/usrp/dboard/db_unknown.cpp b/host/lib/usrp/dboard/db_unknown.cpp index 7e1c20a9e..1a63c9233 100644 --- a/host/lib/usrp/dboard/db_unknown.cpp +++ b/host/lib/usrp/dboard/db_unknown.cpp @@ -18,7 +18,7 @@ #include <uhd/types/ranges.hpp> #include <uhd/utils/assert_has.hpp> #include <uhd/utils/static.hpp> -#include <uhd/utils/msg.hpp> +#include <uhd/utils/log.hpp> #include <uhd/usrp/dboard_base.hpp> #include <uhd/usrp/dboard_manager.hpp> #include <boost/assign/list_of.hpp> @@ -48,7 +48,7 @@ static void warn_if_old_rfx(const dboard_id_t &dboard_id, const std::string &xx) if ( (xx == "RX" and rx_id == dboard_id) or (xx == "TX" and tx_id == dboard_id) - ) UHD_MSG(warning) << boost::format( + ) UHD_LOGGER_WARNING("unknown_db") << boost::format( "Detected %s daughterboard %s\n" "This board requires modification to use.\n" "See the daughterboard application notes.\n" diff --git a/host/lib/usrp/dboard/db_wbx_common.cpp b/host/lib/usrp/dboard/db_wbx_common.cpp index 1ad6ad45b..383daf15b 100644 --- a/host/lib/usrp/dboard/db_wbx_common.cpp +++ b/host/lib/usrp/dboard/db_wbx_common.cpp @@ -21,7 +21,7 @@ #include <uhd/types/sensors.hpp> #include <uhd/utils/assert_has.hpp> #include <uhd/utils/algorithm.hpp> -#include <uhd/utils/msg.hpp> +#include <uhd/utils/log.hpp> using namespace uhd; using namespace uhd::usrp; @@ -42,9 +42,9 @@ static int rx_pga0_gain_to_iobits(double &gain){ int attn_code = boost::math::iround(attn*2); int iobits = ((~attn_code) << RX_ATTN_SHIFT) & RX_ATTN_MASK; - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("WBX") << boost::format( "WBX RX Attenuation: %f dB, Code: %d, IO Bits %x, Mask: %x" - ) % attn % attn_code % (iobits & RX_ATTN_MASK) % RX_ATTN_MASK << std::endl; + ) % attn % attn_code % (iobits & RX_ATTN_MASK) % RX_ATTN_MASK ; //the actual gain setting gain = wbx_rx_gain_ranges["PGA0"].stop() - double(attn_code)/2; diff --git a/host/lib/usrp/dboard/db_wbx_version2.cpp b/host/lib/usrp/dboard/db_wbx_version2.cpp index 319434c3a..134626928 100644 --- a/host/lib/usrp/dboard/db_wbx_version2.cpp +++ b/host/lib/usrp/dboard/db_wbx_version2.cpp @@ -23,7 +23,7 @@ #include <uhd/types/sensors.hpp> #include <uhd/utils/assert_has.hpp> #include <uhd/utils/algorithm.hpp> -#include <uhd/utils/msg.hpp> + #include <uhd/usrp/dboard_base.hpp> #include <boost/assign/list_of.hpp> #include <boost/format.hpp> @@ -58,9 +58,9 @@ static double tx_pga0_gain_to_dac_volts(double &gain){ //calculate the voltage for the aux dac double dac_volts = gain*slope + min_volts; - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("WBX") << boost::format( "WBX TX Gain: %f dB, dac_volts: %f V" - ) % gain % dac_volts << std::endl; + ) % gain % dac_volts ; //the actual gain setting gain = (dac_volts - min_volts)/slope; @@ -165,9 +165,9 @@ double wbx_base::wbx_version2::set_lo_freq(dboard_iface::unit_t unit, double tar //clip to tuning range target_freq = wbx_v2_freq_range.clip(target_freq); - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("WBX") << boost::format( "WBX tune: target frequency %f MHz" - ) % (target_freq/1e6) << std::endl; + ) % (target_freq/1e6) ; /* * If the user sets 'mode_n=integer' in the tuning args, the user wishes to diff --git a/host/lib/usrp/dboard/db_wbx_version3.cpp b/host/lib/usrp/dboard/db_wbx_version3.cpp index cb7616e26..5365a55e5 100644 --- a/host/lib/usrp/dboard/db_wbx_version3.cpp +++ b/host/lib/usrp/dboard/db_wbx_version3.cpp @@ -22,7 +22,7 @@ #include <uhd/types/sensors.hpp> #include <uhd/utils/assert_has.hpp> #include <uhd/utils/algorithm.hpp> -#include <uhd/utils/msg.hpp> + #include <uhd/usrp/dboard_base.hpp> #include <boost/assign/list_of.hpp> #include <boost/format.hpp> @@ -63,9 +63,9 @@ static int tx_pga0_gain_to_iobits(double &gain){ (attn_code & 1 ? 0 : TX_ATTN_1) ) & TX_ATTN_MASK; - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("WBX") << boost::format( "WBX TX Attenuation: %f dB, Code: %d, IO Bits %x, Mask: %x" - ) % attn % attn_code % (iobits & TX_ATTN_MASK) % TX_ATTN_MASK << std::endl; + ) % attn % attn_code % (iobits & TX_ATTN_MASK) % TX_ATTN_MASK ; //the actual gain setting gain = wbx_v3_tx_gain_ranges["PGA0"].stop() - double(attn_code); @@ -196,9 +196,9 @@ double wbx_base::wbx_version3::set_lo_freq(dboard_iface::unit_t unit, double tar //clip to tuning range target_freq = wbx_v3_freq_range.clip(target_freq); - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("WBX") << boost::format( "WBX tune: target frequency %f MHz" - ) % (target_freq/1e6) << std::endl; + ) % (target_freq/1e6) ; /* * If the user sets 'mode_n=integer' in the tuning args, the user wishes to diff --git a/host/lib/usrp/dboard/db_wbx_version4.cpp b/host/lib/usrp/dboard/db_wbx_version4.cpp index 8db03b961..f08504f09 100644 --- a/host/lib/usrp/dboard/db_wbx_version4.cpp +++ b/host/lib/usrp/dboard/db_wbx_version4.cpp @@ -22,7 +22,7 @@ #include <uhd/types/sensors.hpp> #include <uhd/utils/assert_has.hpp> #include <uhd/utils/algorithm.hpp> -#include <uhd/utils/msg.hpp> + #include <uhd/usrp/dboard_base.hpp> #include <boost/assign/list_of.hpp> #include <boost/format.hpp> @@ -64,9 +64,9 @@ static int tx_pga0_gain_to_iobits(double &gain){ (attn_code & 1 ? 0 : TX_ATTN_1) ) & TX_ATTN_MASK; - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("WBX") << boost::format( "WBX TX Attenuation: %f dB, Code: %d, IO Bits %x, Mask: %x" - ) % attn % attn_code % (iobits & TX_ATTN_MASK) % TX_ATTN_MASK << std::endl; + ) % attn % attn_code % (iobits & TX_ATTN_MASK) % TX_ATTN_MASK ; //the actual gain setting gain = wbx_v4_tx_gain_ranges["PGA0"].stop() - double(attn_code); @@ -204,9 +204,9 @@ double wbx_base::wbx_version4::set_lo_freq(dboard_iface::unit_t unit, double tar //clip to tuning range target_freq = wbx_v4_freq_range.clip(target_freq); - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("WBX") << boost::format( "WBX tune: target frequency %f MHz" - ) % (target_freq/1e6) << std::endl; + ) % (target_freq/1e6) ; /* * If the user sets 'mode_n=integer' in the tuning args, the user wishes to diff --git a/host/lib/usrp/dboard/db_xcvr2450.cpp b/host/lib/usrp/dboard/db_xcvr2450.cpp index 63053e326..9d8ef63f2 100644 --- a/host/lib/usrp/dboard/db_xcvr2450.cpp +++ b/host/lib/usrp/dboard/db_xcvr2450.cpp @@ -135,9 +135,9 @@ private: void spi_reset(void); void send_reg(uint8_t addr){ uint32_t value = _max2829_regs.get_reg(addr); - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("XCVR2450") << boost::format( "XCVR2450: send reg 0x%02x, value 0x%05x" - ) % int(addr) % value << std::endl; + ) % int(addr) % value ; this->get_iface()->write_spi( dboard_iface::UNIT_RX, spi_config_t::EDGE_RISE, @@ -391,20 +391,20 @@ double xcvr2450::set_lo_freq_core(double target_freq){ double N = double(intdiv) + double(fracdiv)/double(1 << 16); _lo_freq = (N*ref_freq)/(scaler*R*_ad9515div); - UHD_LOGV(often) + UHD_LOGGER_DEBUG("XCVR2450") << boost::format("XCVR2450 tune:\n") << boost::format(" R=%d, N=%f, ad9515=%d, scaler=%f\n") % R % N % _ad9515div % scaler << boost::format(" Ref Freq=%fMHz\n") % (ref_freq/1e6) << boost::format(" Target Freq=%fMHz\n") % (target_freq/1e6) << boost::format(" Actual Freq=%fMHz\n") % (_lo_freq/1e6) - << std::endl; + ; //high-high band or low-high band? if(_lo_freq > (5.35e9 + 5.47e9)/2.0){ - UHD_LOGV(often) << "XCVR2450 tune: Using high-high band" << std::endl; + UHD_LOGGER_DEBUG("XCVR2450") << "XCVR2450 tune: Using high-high band" ; _max2829_regs.band_select_802_11a = max2829_regs_t::BAND_SELECT_802_11A_5_47GHZ_TO_5_875GHZ; }else{ - UHD_LOGV(often) << "XCVR2450 tune: Using low-high band" << std::endl; + UHD_LOGGER_DEBUG("XCVR2450") << "XCVR2450 tune: Using low-high band" ; _max2829_regs.band_select_802_11a = max2829_regs_t::BAND_SELECT_802_11A_4_9GHZ_TO_5_35GHZ; } @@ -655,9 +655,9 @@ double xcvr2450::set_rx_bandwidth(double bandwidth){ //update register send_reg(0x7); - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("XCVR2450") << boost::format( "XCVR2450 RX Bandwidth (lp_fc): %f Hz, coarse reg: %d, fine reg: %d" - ) % _rx_bandwidth % (int(_max2829_regs.rx_lpf_coarse_adj)) % (int(_max2829_regs.rx_lpf_fine_adj)) << std::endl; + ) % _rx_bandwidth % (int(_max2829_regs.rx_lpf_coarse_adj)) % (int(_max2829_regs.rx_lpf_fine_adj)) ; return 2.0*_rx_bandwidth; } @@ -675,9 +675,9 @@ double xcvr2450::set_tx_bandwidth(double bandwidth){ //update register send_reg(0x7); - UHD_LOGV(often) << boost::format( + UHD_LOGGER_DEBUG("XCVR2450") << boost::format( "XCVR2450 TX Bandwidth (lp_fc): %f Hz, coarse reg: %d" - ) % _tx_bandwidth % (int(_max2829_regs.tx_lpf_coarse_adj)) << std::endl; + ) % _tx_bandwidth % (int(_max2829_regs.tx_lpf_coarse_adj)) ; //convert lowpass back to complex bandpass bandwidth return 2.0*_tx_bandwidth; diff --git a/host/lib/usrp/dboard/twinrx/twinrx_experts.cpp b/host/lib/usrp/dboard/twinrx/twinrx_experts.cpp index 3b41972da..1a66e8fe7 100644 --- a/host/lib/usrp/dboard/twinrx/twinrx_experts.cpp +++ b/host/lib/usrp/dboard/twinrx/twinrx_experts.cpp @@ -18,6 +18,7 @@ #include "twinrx_experts.hpp" #include "twinrx_gain_tables.hpp" #include <uhd/utils/math.hpp> +#include <uhd/utils/log.hpp> #include <uhd/exception.hpp> #include <uhd/types/dict.hpp> #include <uhd/types/ranges.hpp> @@ -481,7 +482,7 @@ void twinrx_ant_gain_expert::resolve() (_ch0_preamp2 != _ch1_preamp2) or (_ch0_lb_preamp_presel != _ch1_lb_preamp_presel)) { - UHD_MSG(warning) << "incompatible gain settings for antenna sharing. temporarily using Ch0 settings for Ch1."; + UHD_LOGGER_WARNING("TWINRX") << "incompatible gain settings for antenna sharing. temporarily using Ch0 settings for Ch1."; } _ant0_input_atten = _ch0_input_atten; _ant0_preamp1 = _ch0_preamp1; @@ -499,7 +500,7 @@ void twinrx_ant_gain_expert::resolve() (_ch0_preamp2 != _ch1_preamp2) or (_ch0_lb_preamp_presel != _ch1_lb_preamp_presel)) { - UHD_MSG(warning) << "incompatible gain settings for antenna sharing. temporarily using Ch0 settings for Ch1."; + UHD_LOGGER_WARNING("TWINRX") << "incompatible gain settings for antenna sharing. temporarily using Ch0 settings for Ch1."; } _ant1_input_atten = _ch0_input_atten; _ant1_preamp1 = _ch0_preamp1; |