aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/usrp')
-rw-r--r--host/lib/usrp/dboard/db_dbsrx.cpp31
-rw-r--r--host/lib/usrp/dboard/db_dbsrx2.cpp17
-rw-r--r--host/lib/usrp/dboard/db_rfx.cpp9
-rw-r--r--host/lib/usrp/dboard/db_sbx.cpp25
-rw-r--r--host/lib/usrp/dboard/db_tvrx.cpp32
-rw-r--r--host/lib/usrp/dboard/db_wbx_common.cpp20
-rw-r--r--host/lib/usrp/dboard/db_wbx_simple.cpp2
-rw-r--r--host/lib/usrp/dboard/db_xcvr2450.cpp15
8 files changed, 68 insertions, 83 deletions
diff --git a/host/lib/usrp/dboard/db_dbsrx.cpp b/host/lib/usrp/dboard/db_dbsrx.cpp
index 8fdd4f953..dbe2f6370 100644
--- a/host/lib/usrp/dboard/db_dbsrx.cpp
+++ b/host/lib/usrp/dboard/db_dbsrx.cpp
@@ -20,6 +20,7 @@
// RX IO Functions
#include "max2118_regs.hpp"
+#include <uhd/utils/log.hpp>
#include <uhd/utils/static.hpp>
#include <uhd/utils/assert_has.hpp>
#include <uhd/utils/algorithm.hpp>
@@ -44,8 +45,6 @@ using namespace boost::assign;
/***********************************************************************
* The DBSRX constants
**********************************************************************/
-static const bool dbsrx_debug = false;
-
static const freq_range_t dbsrx_freq_range(0.8e9, 2.4e9);
static const freq_range_t dbsrx_pfd_freq_range(0.15e6, 2.01e6);
@@ -98,7 +97,7 @@ 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);
- if(dbsrx_debug) std::cerr << boost::format(
+ UHD_LOGV(often) << 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;
}
@@ -130,7 +129,7 @@ private:
if (i + start_addr >= status_addr){
_max2118_read_regs.set_reg(i + start_addr, regs_vector[i]);
}
- if(dbsrx_debug) std::cerr << boost::format(
+ UHD_LOGV(often) << 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;
}
@@ -147,7 +146,7 @@ private:
//mask and return lock detect
bool locked = 5 >= _max2118_read_regs.adc and _max2118_read_regs.adc >= 2;
- if(dbsrx_debug) std::cerr << boost::format(
+ UHD_LOGV(often) << boost::format(
"DBSRX: locked %d"
) % locked << std::endl;
@@ -246,7 +245,7 @@ void dbsrx::set_lo_freq(double target_freq){
m = 31;
while ((ref_clock/m < 1e6 or ref_clock/m > 2.5e6) and m > 0){ m--; }
- if(dbsrx_debug) std::cerr << boost::format(
+ UHD_LOGV(often) << boost::format(
"DBSRX: trying ref_clock %f and m_divider %d"
) % (ref_clock) % m << std::endl;
@@ -256,7 +255,7 @@ void dbsrx::set_lo_freq(double target_freq){
for(r = 0; r <= 6; r += 1) {
//compute divider from setting
R = 1 << (r+1);
- if (dbsrx_debug) std::cerr << boost::format("DBSRX R:%d\n") % R << std::endl;
+ UHD_LOGV(often) << boost::format("DBSRX R:%d\n") % R << std::endl;
//compute PFD compare frequency = ref_clock/R
pfd_freq = ref_clock / R;
@@ -282,7 +281,7 @@ void 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));
- if(dbsrx_debug) std::cerr << boost::format(
+ UHD_LOGV(often) << 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;
@@ -304,7 +303,7 @@ void 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;
- if(dbsrx_debug) std::cerr << boost::format(
+ UHD_LOGV(often) << boost::format(
"DBSRX: scaler %d, actual_freq %f MHz, register bit: %d"
) % scaler % (actual_freq/1e6) % int(_max2118_write_regs.div2) << std::endl;
@@ -333,7 +332,7 @@ void dbsrx::set_lo_freq(double target_freq){
//check vtune for lock condition
read_reg(0x0, 0x0);
- if(dbsrx_debug) std::cerr << boost::format(
+ UHD_LOGV(often) << boost::format(
"DBSRX: initial guess for vco %d, vtune adc %d"
) % int(_max2118_write_regs.osc_band) % int(_max2118_read_regs.adc) << std::endl;
@@ -368,7 +367,7 @@ void dbsrx::set_lo_freq(double target_freq){
_max2118_write_regs.osc_band += 1;
}
- if(dbsrx_debug) std::cerr << boost::format(
+ UHD_LOGV(often) << boost::format(
"DBSRX: trying vco %d, vtune adc %d"
) % int(_max2118_write_regs.osc_band) % int(_max2118_read_regs.adc) << std::endl;
@@ -380,7 +379,7 @@ void dbsrx::set_lo_freq(double target_freq){
boost::this_thread::sleep(boost::posix_time::milliseconds(10));
}
- if(dbsrx_debug) std::cerr << boost::format(
+ UHD_LOGV(often) << boost::format(
"DBSRX: final vco %d, vtune adc %d"
) % int(_max2118_write_regs.osc_band) % int(_max2118_read_regs.adc) << std::endl;
@@ -396,7 +395,7 @@ void 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
- if (dbsrx_debug) std::cerr
+ UHD_LOGV(often)
<< 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)
@@ -432,7 +431,7 @@ static int gain_to_gc2_vga_reg(double &gain){
gain = double(boost::math::iround(gain));
}
- if (dbsrx_debug) std::cerr << boost::format(
+ UHD_LOGV(often) << boost::format(
"DBSRX GC2 Gain: %f dB, reg: %d"
) % gain % reg << std::endl;
@@ -456,7 +455,7 @@ static double gain_to_gc1_rfvga_dac(double &gain){
//calculate the voltage for the aux dac
double dac_volts = gain*slope + min_volts;
- if (dbsrx_debug) std::cerr << boost::format(
+ UHD_LOGV(often) << boost::format(
"DBSRX GC1 Gain: %f dB, dac_volts: %f V"
) % gain % dac_volts << std::endl;
@@ -497,7 +496,7 @@ void 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));
- if (dbsrx_debug) std::cerr << boost::format(
+ UHD_LOGV(often) << 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;
diff --git a/host/lib/usrp/dboard/db_dbsrx2.cpp b/host/lib/usrp/dboard/db_dbsrx2.cpp
index e7b42cb05..0769b3aa1 100644
--- a/host/lib/usrp/dboard/db_dbsrx2.cpp
+++ b/host/lib/usrp/dboard/db_dbsrx2.cpp
@@ -18,6 +18,7 @@
// No RX IO Pins Used
#include "max2112_regs.hpp"
+#include <uhd/utils/log.hpp>
#include <uhd/utils/static.hpp>
#include <uhd/utils/assert_has.hpp>
#include <uhd/utils/algorithm.hpp>
@@ -40,8 +41,6 @@ using namespace boost::assign;
/***********************************************************************
* The DBSRX2 constants
**********************************************************************/
-static const bool dbsrx2_debug = false;
-
static const freq_range_t dbsrx2_freq_range(0.8e9, 2.4e9);
static const int dbsrx2_ref_divider = 4; // Hitachi HMC426 divider (U7)
@@ -94,7 +93,7 @@ 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);
- if(dbsrx2_debug) std::cerr << boost::format(
+ UHD_LOGV(often) << 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;
}
@@ -140,7 +139,7 @@ private:
) % int(i + start_addr) % int(_max2112_read_regs.get_reg(i + start_addr)) << std::endl;
*/
}
- if(dbsrx2_debug) std::cerr << boost::format(
+ UHD_LOGV(often) << 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;
}
@@ -157,7 +156,7 @@ private:
//mask and return lock detect
bool locked = (_max2112_read_regs.ld & _max2112_read_regs.vasa & _max2112_read_regs.vase) != 0;
- if(dbsrx2_debug) std::cerr << boost::format(
+ UHD_LOGV(often) << boost::format(
"DBSRX2 locked: %d"
) % locked << std::endl;
@@ -244,7 +243,7 @@ void 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
- if (dbsrx2_debug) std::cerr
+ UHD_LOGV(often)
<< 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)
@@ -275,7 +274,7 @@ static int gain_to_bbg_vga_reg(double &gain){
gain = double(reg);
- if (dbsrx2_debug) std::cerr
+ UHD_LOGV(often)
<< boost::format("DBSRX2 BBG Gain:\n")
<< boost::format(" %f dB, bbg: %d") % gain % reg
<< std::endl;
@@ -300,7 +299,7 @@ static double gain_to_gc1_rfvga_dac(double &gain){
//calculate the voltage for the aux dac
double dac_volts = gain*slope + min_volts;
- if (dbsrx2_debug) std::cerr
+ UHD_LOGV(often)
<< boost::format("DBSRX2 GC1 Gain:\n")
<< boost::format(" %f dB, dac_volts: %f V") % gain % dac_volts
<< std::endl;
@@ -335,7 +334,7 @@ void 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;
- if (dbsrx2_debug) std::cerr
+ UHD_LOGV(often)
<< boost::format("DBSRX2 Bandwidth:\n")
<< boost::format(" %f MHz, lp: %f V") % (_bandwidth/1e6) % int(_max2112_write_regs.lp)
<< std::endl;
diff --git a/host/lib/usrp/dboard/db_rfx.cpp b/host/lib/usrp/dboard/db_rfx.cpp
index 231757365..1f0290179 100644
--- a/host/lib/usrp/dboard/db_rfx.cpp
+++ b/host/lib/usrp/dboard/db_rfx.cpp
@@ -38,6 +38,7 @@
#include <uhd/types/ranges.hpp>
#include <uhd/types/sensors.hpp>
#include <uhd/utils/assert_has.hpp>
+#include <uhd/utils/log.hpp>
#include <uhd/utils/static.hpp>
#include <uhd/utils/algorithm.hpp>
#include <uhd/utils/warning.hpp>
@@ -55,8 +56,6 @@ using namespace boost::assign;
/***********************************************************************
* The RFX Series constants
**********************************************************************/
-static const bool rfx_debug = false;
-
static const prop_names_t rfx_tx_antennas = list_of("TX/RX");
static const prop_names_t rfx_rx_antennas = list_of("TX/RX")("RX2");
@@ -302,7 +301,7 @@ double rfx_xcvr::set_lo_freq(
dboard_iface::unit_t unit,
double target_freq
){
- if (rfx_debug) std::cerr << boost::format(
+ UHD_LOGV(often) << boost::format(
"RFX tune: target frequency %f Mhz"
) % (target_freq/1e6) << std::endl;
@@ -359,7 +358,7 @@ double rfx_xcvr::set_lo_freq(
}
} done_loop:
- if (rfx_debug) std::cerr << boost::format(
+ UHD_LOGV(often) << 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;
@@ -405,7 +404,7 @@ double rfx_xcvr::set_lo_freq(
//return the actual frequency
if (_div2[unit]) actual_freq /= 2;
- if (rfx_debug) std::cerr << boost::format(
+ UHD_LOGV(often) << boost::format(
"RFX tune: actual frequency %f Mhz"
) % (actual_freq/1e6) << std::endl;
return actual_freq;
diff --git a/host/lib/usrp/dboard/db_sbx.cpp b/host/lib/usrp/dboard/db_sbx.cpp
index d0c3c63ac..4d8753fab 100644
--- a/host/lib/usrp/dboard/db_sbx.cpp
+++ b/host/lib/usrp/dboard/db_sbx.cpp
@@ -78,6 +78,7 @@
#include <uhd/types/ranges.hpp>
#include <uhd/types/sensors.hpp>
#include <uhd/utils/assert_has.hpp>
+#include <uhd/utils/log.hpp>
#include <uhd/utils/static.hpp>
#include <uhd/utils/algorithm.hpp>
#include <uhd/utils/warning.hpp>
@@ -95,8 +96,6 @@ using namespace boost::assign;
/***********************************************************************
* The SBX dboard constants
**********************************************************************/
-static const bool sbx_debug = false;
-
static const freq_range_t sbx_freq_range(68.75e6, 4.4e9);
static const freq_range_t sbx_tx_lo_2dbm = list_of
@@ -269,7 +268,7 @@ sbx_xcvr::sbx_xcvr(ctor_args_t args) : xcvr_dboard_base(args){
//flash LEDs
flash_leds();
- if (sbx_debug) std::cerr << boost::format(
+ UHD_LOGV(often) << boost::format(
"SBX GPIO Direction: RX: 0x%08x, TX: 0x%08x"
) % RXIO_MASK % TXIO_MASK << std::endl;
@@ -305,7 +304,7 @@ static int rx_pga0_gain_to_iobits(double &gain){
int iobits = ((~attn_code) << RX_ATTN_SHIFT) & RX_ATTN_MASK;
- if (sbx_debug) std::cerr << boost::format(
+ UHD_LOGV(often) << boost::format(
"SBX TX Attenuation: %f dB, Code: %d, IO Bits %x, Mask: %x"
) % attn % attn_code % (iobits & RX_ATTN_MASK) % RX_ATTN_MASK << std::endl;
@@ -327,7 +326,7 @@ static int tx_pga0_gain_to_iobits(double &gain){
int iobits = ((~attn_code) << TX_ATTN_SHIFT) & TX_ATTN_MASK;
- if (sbx_debug) std::cerr << boost::format(
+ UHD_LOGV(often) << 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;
@@ -399,7 +398,7 @@ void sbx_xcvr::update_atr(void){
rx_pga0_iobits | rx_lo_lpf_en | rx_ld_led | rx_ant_led | RX_POWER_UP | RX_MIXER_ENB |
((_rx_ant == "TX/RX")? ANT_TXRX : ANT_RX2));
- if (sbx_debug) std::cerr << boost::format(
+ UHD_LOGV(often) << boost::format(
"SBX RXONLY ATR REG: 0x%08x"
) % (rx_pga0_iobits | RX_POWER_UP | RX_MIXER_ENB | ((_rx_ant == "TX/RX")? ANT_TXRX : ANT_RX2)) << std::endl;
}
@@ -435,7 +434,7 @@ double sbx_xcvr::set_lo_freq(
dboard_iface::unit_t unit,
double target_freq
){
- if (sbx_debug) std::cerr << boost::format(
+ UHD_LOGV(often) << boost::format(
"SBX tune: target frequency %f Mhz"
) % (target_freq/1e6) << std::endl;
@@ -531,14 +530,12 @@ double sbx_xcvr::set_lo_freq(
//actual frequency calculation
actual_freq = double((N + (double(FRAC)/double(MOD)))*ref_freq*(1+int(D))/(R*(1+int(T)))/RFdiv);
- if (sbx_debug) {
- std::cerr << boost::format("SBX Intermediates: ref=%0.2f, outdiv=%f, fbdiv=%f") % (ref_freq*(1+int(D))/(R*(1+int(T)))) % double(RFdiv*2) % double(N + double(FRAC)/double(MOD)) << std::endl;
-
- std::cerr << boost::format("SBX tune: R=%d, BS=%d, N=%d, FRAC=%d, MOD=%d, T=%d, D=%d, RFdiv=%d, LD=%d"
+ UHD_LOGV(often)
+ << boost::format("SBX Intermediates: ref=%0.2f, outdiv=%f, fbdiv=%f") % (ref_freq*(1+int(D))/(R*(1+int(T)))) % double(RFdiv*2) % double(N + double(FRAC)/double(MOD)) << std::endl
+ << boost::format("SBX tune: R=%d, BS=%d, N=%d, FRAC=%d, MOD=%d, T=%d, D=%d, RFdiv=%d, LD=%d"
) % R % BS % N % FRAC % MOD % T % D % RFdiv % get_locked(unit)<< std::endl
<< boost::format("SBX Frequencies (MHz): REQ=%0.2f, ACT=%0.2f, VCO=%0.2f, PFD=%0.2f, BAND=%0.2f"
) % (target_freq/1e6) % (actual_freq/1e6) % (vco_freq/1e6) % (pfd_freq/1e6) % (pfd_freq/BS/1e6) << std::endl;
- }
//load the register values
adf4350_regs_t regs;
@@ -564,7 +561,7 @@ double sbx_xcvr::set_lo_freq(
int addr;
for(addr=5; addr>=0; addr--){
- if (sbx_debug) std::cerr << boost::format(
+ UHD_LOGV(often) << boost::format(
"SBX SPI Reg (0x%02x): 0x%08x"
) % addr % regs.get_reg(addr) << std::endl;
this->get_iface()->write_spi(
@@ -574,7 +571,7 @@ double sbx_xcvr::set_lo_freq(
}
//return the actual frequency
- if (sbx_debug) std::cerr << boost::format(
+ UHD_LOGV(often) << boost::format(
"SBX tune: actual frequency %f Mhz"
) % (actual_freq/1e6) << std::endl;
return actual_freq;
diff --git a/host/lib/usrp/dboard/db_tvrx.cpp b/host/lib/usrp/dboard/db_tvrx.cpp
index d264c9ca4..cd7216c22 100644
--- a/host/lib/usrp/dboard/db_tvrx.cpp
+++ b/host/lib/usrp/dboard/db_tvrx.cpp
@@ -27,6 +27,7 @@
//max freq: 860e6
//gain range: [0:1dB:115dB]
+#include <uhd/utils/log.hpp>
#include <uhd/utils/static.hpp>
#include <uhd/utils/assert_has.hpp>
#include <uhd/utils/algorithm.hpp>
@@ -55,8 +56,6 @@ using namespace boost::assign;
/***********************************************************************
* The tvrx constants
**********************************************************************/
-static const bool tvrx_debug = false;
-
static const freq_range_t tvrx_freq_range(50e6, 860e6);
static const prop_names_t tvrx_antennas = list_of("RX");
@@ -158,7 +157,7 @@ private:
//get the register data
for(int i=0; i<4; i++){
regs_vector[i] = _tuner_4937di5_regs.get_reg(i);
- if(tvrx_debug) std::cerr << boost::format(
+ UHD_LOGV(often) << boost::format(
"tvrx: send reg 0x%02x, value 0x%04x"
) % int(i) % int(regs_vector[i]) << std::endl;
}
@@ -221,7 +220,7 @@ tvrx::~tvrx(void){
static std::string get_band(double freq) {
BOOST_FOREACH(const std::string &band, tvrx_freq_ranges.keys()) {
if(freq >= tvrx_freq_ranges[band].start() && freq <= tvrx_freq_ranges[band].stop()){
- if(tvrx_debug) std::cout << "Band: " << band << std::endl;
+ UHD_LOGV(often) << "Band: " << band << std::endl;
return band;
}
}
@@ -263,8 +262,7 @@ static double gain_interp(double gain, boost::array<double, 17> db_vector, boost
//use the volts per dB slope to find the final interpolated voltage
volts = volts_vector[gain_step] + (slope * (gain - db_vector[gain_step]));
- if(tvrx_debug)
- std::cout << "Gain interp: gain: " << gain << ", gain_step: " << int(gain_step) << ", slope: " << slope << ", volts: " << volts << std::endl;
+ UHD_LOGV(often) << "Gain interp: gain: " << gain << ", gain_step: " << int(gain_step) << ", slope: " << slope << ", volts: " << volts << std::endl;
return volts;
}
@@ -290,7 +288,7 @@ static double rf_gain_to_voltage(double gain, double lo_freq){
dac_volts = uhd::clip<double>(dac_volts, 0.0, 3.3);
- if (tvrx_debug) std::cerr << boost::format(
+ UHD_LOGV(often) << boost::format(
"tvrx RF AGC gain: %f dB, dac_volts: %f V"
) % gain % dac_volts << std::endl;
@@ -313,7 +311,7 @@ static double if_gain_to_voltage(double gain){
dac_volts = uhd::clip<double>(dac_volts, 0.0, 3.3);
- if (tvrx_debug) std::cerr << boost::format(
+ UHD_LOGV(often) << boost::format(
"tvrx IF AGC gain: %f dB, dac_volts: %f V"
) % gain % dac_volts << std::endl;
@@ -367,8 +365,7 @@ void 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");
- if(tvrx_debug)
- std::cout << 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_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;
_lo_freq = actual_lo_freq; //for rx props
}
@@ -430,14 +427,13 @@ void tvrx::rx_get(const wax::obj &key_, wax::obj &val){
*/
codec_rate = this->get_iface()->get_codec_rate(dboard_iface::UNIT_RX);
val = (_lo_freq - tvrx_if_freq) + get_alias(tvrx_if_freq, codec_rate);
- if(tvrx_debug) {
- std::cout << "Getting TVRX freq..." << std::endl;
- std::cout << "\tCodec rate: " << codec_rate << std::endl;
- std::cout << "\tLO freq: " << _lo_freq << std::endl;
- std::cout << "\tIF freq: " << tvrx_if_freq << std::endl;
- std::cout << "\tAlias freq: " << get_alias(tvrx_if_freq, codec_rate) << std::endl;
- std::cout << "\tCalculated freq: " << val.as<double>() << std::endl;
- }
+ UHD_LOGV(often)
+ << "Getting TVRX freq..." << std::endl
+ << "\tCodec rate: " << codec_rate << std::endl
+ << "\tLO freq: " << _lo_freq << std::endl
+ << "\tIF freq: " << tvrx_if_freq << std::endl
+ << "\tAlias freq: " << get_alias(tvrx_if_freq, codec_rate) << std::endl
+ << "\tCalculated freq: " << val.as<double>() << std::endl;
return;
case SUBDEV_PROP_FREQ_RANGE:
diff --git a/host/lib/usrp/dboard/db_wbx_common.cpp b/host/lib/usrp/dboard/db_wbx_common.cpp
index eb239c305..fdee14607 100644
--- a/host/lib/usrp/dboard/db_wbx_common.cpp
+++ b/host/lib/usrp/dboard/db_wbx_common.cpp
@@ -51,6 +51,7 @@
#include "db_wbx_common.hpp"
#include "adf4350_regs.hpp"
+#include <uhd/utils/log.hpp>
#include <uhd/types/dict.hpp>
#include <uhd/usrp/subdev_props.hpp>
#include <uhd/types/ranges.hpp>
@@ -70,8 +71,6 @@ using namespace boost::assign;
/***********************************************************************
* The WBX Common dboard constants
**********************************************************************/
-static const bool wbx_debug = false;
-
static const uhd::dict<std::string, gain_range_t> wbx_tx_gain_ranges = map_list_of
("PGA0", gain_range_t(0, 25, 0.05))
;
@@ -150,7 +149,7 @@ 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;
- if (wbx_debug) std::cerr << boost::format(
+ UHD_LOGV(often) << boost::format(
"WBX Attenuation: %f dB, Code: %d, IO Bits %x, Mask: %x"
) % attn % attn_code % (iobits & RX_ATTN_MASK) % RX_ATTN_MASK << std::endl;
@@ -171,7 +170,7 @@ static double tx_pga0_gain_to_dac_volts(double &gain){
//calculate the voltage for the aux dac
double dac_volts = gain*slope + min_volts;
- if (wbx_debug) std::cerr << boost::format(
+ UHD_LOGV(often) << boost::format(
"WBX TX Gain: %f dB, dac_volts: %f V"
) % gain % dac_volts << std::endl;
@@ -212,7 +211,7 @@ double wbx_base::set_lo_freq(
dboard_iface::unit_t unit,
double target_freq
){
- if (wbx_debug) std::cerr << boost::format(
+ UHD_LOGV(often) << boost::format(
"WBX tune: target frequency %f Mhz"
) % (target_freq/1e6) << std::endl;
@@ -306,14 +305,13 @@ double wbx_base::set_lo_freq(
actual_freq = double((N + (double(FRAC)/double(MOD)))*ref_freq*(1+int(D))/(R*(1+int(T)))/RFdiv/2);
- if (wbx_debug) {
- std::cerr << boost::format("WBX Intermediates: ref=%0.2f, outdiv=%f, fbdiv=%f") % (ref_freq*(1+int(D))/(R*(1+int(T)))) % double(RFdiv*2) % double(N + double(FRAC)/double(MOD)) << std::endl;
+ UHD_LOGV(often)
+ << boost::format("WBX Intermediates: ref=%0.2f, outdiv=%f, fbdiv=%f") % (ref_freq*(1+int(D))/(R*(1+int(T)))) % double(RFdiv*2) % double(N + double(FRAC)/double(MOD)) << std::endl
- std::cerr << boost::format("WBX tune: R=%d, BS=%d, N=%d, FRAC=%d, MOD=%d, T=%d, D=%d, RFdiv=%d, LD=%d"
+ << boost::format("WBX tune: R=%d, BS=%d, N=%d, FRAC=%d, MOD=%d, T=%d, D=%d, RFdiv=%d, LD=%d"
) % R % BS % N % FRAC % MOD % T % D % RFdiv % get_locked(unit)<< std::endl
<< boost::format("WBX Frequencies (MHz): REQ=%0.2f, ACT=%0.2f, VCO=%0.2f, PFD=%0.2f, BAND=%0.2f"
) % (target_freq/1e6) % (actual_freq/1e6) % (vco_freq/1e6) % (pfd_freq/1e6) % (pfd_freq/BS/1e6) << std::endl;
- }
//load the register values
adf4350_regs_t regs;
@@ -363,7 +361,7 @@ double wbx_base::set_lo_freq(
int addr;
for(addr=5; addr>=0; addr--){
- if (wbx_debug) std::cerr << boost::format(
+ UHD_LOGV(often) << boost::format(
"WBX SPI Reg (0x%02x): 0x%08x"
) % addr % regs.get_reg(addr) << std::endl;
this->get_iface()->write_spi(
@@ -373,7 +371,7 @@ double wbx_base::set_lo_freq(
}
//return the actual frequency
- if (wbx_debug) std::cerr << boost::format(
+ UHD_LOGV(often) << boost::format(
"WBX tune: actual frequency %f Mhz"
) % (actual_freq/1e6) << std::endl;
return actual_freq;
diff --git a/host/lib/usrp/dboard/db_wbx_simple.cpp b/host/lib/usrp/dboard/db_wbx_simple.cpp
index 390b4474b..c9ae7f23a 100644
--- a/host/lib/usrp/dboard/db_wbx_simple.cpp
+++ b/host/lib/usrp/dboard/db_wbx_simple.cpp
@@ -37,8 +37,6 @@ using namespace boost::assign;
/***********************************************************************
* The WBX Simple dboard constants
**********************************************************************/
-static const bool wbx_debug = false;
-
static const freq_range_t wbx_freq_range(68.75e6, 2.2e9);
static const prop_names_t wbx_tx_antennas = list_of("TX/RX");
diff --git a/host/lib/usrp/dboard/db_xcvr2450.cpp b/host/lib/usrp/dboard/db_xcvr2450.cpp
index 45f600569..4bda43251 100644
--- a/host/lib/usrp/dboard/db_xcvr2450.cpp
+++ b/host/lib/usrp/dboard/db_xcvr2450.cpp
@@ -48,6 +48,7 @@
#define RX_DIS_RXIO 0
#include "max2829_regs.hpp"
+#include <uhd/utils/log.hpp>
#include <uhd/utils/static.hpp>
#include <uhd/utils/assert_has.hpp>
#include <uhd/utils/algorithm.hpp>
@@ -71,8 +72,6 @@ using namespace boost::assign;
/***********************************************************************
* The XCVR 2450 constants
**********************************************************************/
-static const bool xcvr2450_debug = false;
-
static const freq_range_t xcvr_freq_range = list_of
(range_t(2.4e9, 2.5e9))
(range_t(4.9e9, 6.0e9))
@@ -127,7 +126,7 @@ private:
void spi_reset(void);
void send_reg(boost::uint8_t addr){
boost::uint32_t value = _max2829_regs.get_reg(addr);
- if(xcvr2450_debug) std::cerr << boost::format(
+ UHD_LOGV(often) << boost::format(
"XCVR2450: send reg 0x%02x, value 0x%05x"
) % int(addr) % value << std::endl;
this->get_iface()->write_spi(
@@ -302,7 +301,7 @@ void xcvr2450::set_lo_freq(double target_freq){
double N = double(intdiv) + double(fracdiv)/double(1 << 16);
_lo_freq = (N*ref_freq)/(scaler*R*_ad9515div);
- if (xcvr2450_debug) std::cerr
+ UHD_LOGV(often)
<< 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)
@@ -312,10 +311,10 @@ void xcvr2450::set_lo_freq(double target_freq){
//high-high band or low-high band?
if(_lo_freq > (5.35e9 + 5.47e9)/2.0){
- if (xcvr2450_debug) std::cerr << "XCVR2450 tune: Using high-high band" << std::endl;
+ UHD_LOGV(often) << "XCVR2450 tune: Using high-high band" << std::endl;
_max2829_regs.band_select_802_11a = max2829_regs_t::BAND_SELECT_802_11A_5_47GHZ_TO_5_875GHZ;
}else{
- if (xcvr2450_debug) std::cerr << "XCVR2450 tune: Using low-high band" << std::endl;
+ UHD_LOGV(often) << "XCVR2450 tune: Using low-high band" << std::endl;
_max2829_regs.band_select_802_11a = max2829_regs_t::BAND_SELECT_802_11A_4_9GHZ_TO_5_35GHZ;
}
@@ -547,7 +546,7 @@ void xcvr2450::set_rx_bandwidth(double bandwidth){
//update register
send_reg(0x7);
- if (xcvr2450_debug) std::cerr << boost::format(
+ UHD_LOGV(often) << 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;
}
@@ -562,7 +561,7 @@ void xcvr2450::set_tx_bandwidth(double bandwidth){
//update register
send_reg(0x7);
- if (xcvr2450_debug) std::cerr << boost::format(
+ UHD_LOGV(often) << boost::format(
"XCVR2450 TX Bandwidth (lp_fc): %f Hz, coarse reg: %d"
) % _tx_bandwidth % (int(_max2829_regs.tx_lpf_coarse_adj)) << std::endl;
}