aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/dboard/db_dbsrx.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/usrp/dboard/db_dbsrx.cpp')
-rw-r--r--host/lib/usrp/dboard/db_dbsrx.cpp70
1 files changed, 35 insertions, 35 deletions
diff --git a/host/lib/usrp/dboard/db_dbsrx.cpp b/host/lib/usrp/dboard/db_dbsrx.cpp
index f296820c5..ecfeb5308 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_TRACE("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_TRACE("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_TRACE("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"
@@ -205,7 +205,7 @@ dbsrx::dbsrx(ctor_args_t args) : rx_dboard_base(args){
.set("DBSRX");
this->get_rx_subtree()->create<sensor_value_t>("sensors/lo_locked")
.set_publisher(boost::bind(&dbsrx::get_locked, this));
- BOOST_FOREACH(const std::string &name, dbsrx_gain_ranges.keys()){
+ for(const std::string &name: dbsrx_gain_ranges.keys()){
this->get_rx_subtree()->create<double>("gains/"+name+"/value")
.set_coercer(boost::bind(&dbsrx::set_gain, this, _1, name))
.set(dbsrx_gain_ranges[name].start());
@@ -266,7 +266,7 @@ double dbsrx::set_lo_freq(double target_freq){
//choose refclock
std::vector<double> clock_rates = this->get_iface()->get_clock_rates(dboard_iface::UNIT_RX);
const double max_clock_rate = uhd::sorted(clock_rates).back();
- BOOST_FOREACH(ref_clock, uhd::reversed(uhd::sorted(clock_rates))){
+ for(auto ref_clock: uhd::reversed(uhd::sorted(clock_rates))){
//USRP1 feeds the DBSRX clock from a FPGA GPIO line.
//make sure that this clock does not exceed rate limit.
if (this->get_iface()->get_special_props().soft_clock_divider){
@@ -279,17 +279,17 @@ 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_TRACE("DBSRX") << boost::format(
"DBSRX: trying ref_clock %f and m_divider %d"
- ) % (ref_clock) % m << std::endl;
+ ) % (ref_clock) % m ;
if (m >= 32) continue;
//choose R
- for(r = 0; r <= 6; r += 1) {
+ 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_TRACE("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_TRACE("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_TRACE("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_TRACE("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_TRACE("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_TRACE("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_TRACE("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_TRACE("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_TRACE("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_TRACE("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);