aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp/dboard/db_tvrx2.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/usrp/dboard/db_tvrx2.cpp')
-rw-r--r--host/lib/usrp/dboard/db_tvrx2.cpp128
1 files changed, 64 insertions, 64 deletions
diff --git a/host/lib/usrp/dboard/db_tvrx2.cpp b/host/lib/usrp/dboard/db_tvrx2.cpp
index 1bac81153..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;
@@ -962,7 +962,7 @@ tvrx2::tvrx2(ctor_args_t args) : rx_dboard_base(args){
.set_publisher(boost::bind(&tvrx2::get_rssi, this));
this->get_rx_subtree()->create<sensor_value_t>("sensors/temperature")
.set_publisher(boost::bind(&tvrx2::get_temp, this));
- BOOST_FOREACH(const std::string &name, tvrx2_gain_ranges.keys()){
+ for(const std::string &name: tvrx2_gain_ranges.keys()){
this->get_rx_subtree()->create<double>("gains/"+name+"/value")
.set_coercer(boost::bind(&tvrx2::set_gain, this, _1, name));
this->get_rx_subtree()->create<meta_range_t>("gains/"+name+"/range")
@@ -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;
@@ -1066,7 +1066,7 @@ bool tvrx2::set_enabled(bool enable){
test_rf_filter_robustness();
- BOOST_FOREACH(const std::string &name, tvrx2_gain_ranges.keys()){
+ for(const std::string &name: tvrx2_gain_ranges.keys()){
this->get_rx_subtree()->access<double>("gains/"+name+"/value")
.set(tvrx2_gain_ranges[name].start());
}
@@ -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 ;
}
}
}
@@ -1271,14 +1271,14 @@ void tvrx2::tvrx2_tda18272_init_rfcal(void)
// Loop through rfcal_log_* registers, initialize _rfcal_results
- BOOST_FOREACH(const uint32_t &result, result_to_cal_regs.keys())
+ for(const uint32_t &result: result_to_cal_regs.keys())
_rfcal_results[result].delta_c = result_to_cal_regs[result] > 63 ? result_to_cal_regs[result] - 128 : result_to_cal_regs[result];
/* read byte 0x26-0x2B */
read_reg(0x26, 0x2B);
// Loop through rfcal_byte_* registers, initialize _rfcal_coeffs
- BOOST_FOREACH(const uint32_t &subband, _rfcal_coeffs.keys())
+ for(const uint32_t &subband: _rfcal_coeffs.keys())
{
freq_range_t subband_freqs;
@@ -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;
@@ -1473,7 +1473,7 @@ void tvrx2::test_rf_filter_robustness(void){
("UHFHigh_1", 0x43)
;
- BOOST_FOREACH(const std::string &name, filter_cal_regs.keys()){
+ for(const std::string &name: filter_cal_regs.keys()){
uint8_t cal_result = _tda18272hnm_regs.get_reg(filter_cal_regs[name]);
if (cal_result & 0x80) {
_filter_ratings.set(name, "E");
@@ -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;
- BOOST_FOREACH(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("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]);
}
- 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;
}