diff options
Diffstat (limited to 'host/lib/usrp/b100')
-rw-r--r-- | host/lib/usrp/b100/b100_impl.cpp | 29 | ||||
-rw-r--r-- | host/lib/usrp/b100/clock_ctrl.cpp | 23 | ||||
-rw-r--r-- | host/lib/usrp/b100/codec_ctrl.cpp | 6 | ||||
-rw-r--r-- | host/lib/usrp/b100/io_impl.cpp | 6 | ||||
-rw-r--r-- | host/lib/usrp/b100/usb_zero_copy_wrapper.cpp | 3 |
5 files changed, 32 insertions, 35 deletions
diff --git a/host/lib/usrp/b100/b100_impl.cpp b/host/lib/usrp/b100/b100_impl.cpp index 1a38bf3b7..27af43c48 100644 --- a/host/lib/usrp/b100/b100_impl.cpp +++ b/host/lib/usrp/b100/b100_impl.cpp @@ -19,7 +19,7 @@ #include "b100_impl.hpp" #include "b100_regs.hpp" #include <uhd/transport/usb_control.hpp> -#include <uhd/utils/msg.hpp> +#include <uhd/utils/log.hpp> #include <uhd/utils/cast.hpp> #include <uhd/exception.hpp> #include <uhd/utils/static.hpp> @@ -29,7 +29,6 @@ #include <boost/assign/list_of.hpp> #include <boost/filesystem.hpp> #include <boost/thread/thread.hpp> -#include <boost/lexical_cast.hpp> #include <cstdio> #include <iostream> @@ -73,17 +72,17 @@ static device_addrs_t b100_find(const device_addr_t &hint) //find the usrps and load firmware size_t found = 0; - BOOST_FOREACH(usb_device_handle::sptr handle, usb_device_handle::get_device_list(vid, pid)) { + for(usb_device_handle::sptr handle: usb_device_handle::get_device_list(vid, pid)) { //extract the firmware path for the b100 std::string b100_fw_image; try{ b100_fw_image = find_image_path(hint.get("fw", B100_FW_FILE_NAME)); } catch(...){ - UHD_MSG(warning) << boost::format("Could not locate B100 firmware. %s\n") % print_utility_error("uhd_images_downloader.py"); + UHD_LOGGER_WARNING("B100") << boost::format("Could not locate B100 firmware. %s\n") % print_utility_error("uhd_images_downloader.py"); return b100_addrs; } - UHD_LOG << "the firmware image: " << b100_fw_image << std::endl; + UHD_LOGGER_DEBUG("B100") << "the firmware image: " << b100_fw_image ; usb_control::sptr control; try{control = usb_control::make(handle, 0);} @@ -102,7 +101,7 @@ static device_addrs_t b100_find(const device_addr_t &hint) //search for the device until found or timeout while (boost::get_system_time() < timeout_time and b100_addrs.empty() and found != 0) { - BOOST_FOREACH(usb_device_handle::sptr handle, usb_device_handle::get_device_list(vid, pid)) + for(usb_device_handle::sptr handle: usb_device_handle::get_device_list(vid, pid)) { usb_control::sptr control; try{control = usb_control::make(handle, 0);} @@ -161,7 +160,7 @@ b100_impl::b100_impl(const device_addr_t &device_addr){ //locate the matching handle in the device list usb_device_handle::sptr handle; - BOOST_FOREACH(usb_device_handle::sptr dev_handle, device_list) { + for(usb_device_handle::sptr dev_handle: device_list) { if (dev_handle->get_serial() == device_addr["serial"]){ handle = dev_handle; break; @@ -202,9 +201,9 @@ b100_impl::b100_impl(const device_addr_t &device_addr){ //try reset once in the case of failure catch(const uhd::exception &ex){ if (initialization_count > 1) throw; - UHD_MSG(warning) << + UHD_LOGGER_WARNING("B100") << "The control endpoint was left in a bad state.\n" - "Attempting endpoint re-enumeration...\n" << ex.what() << std::endl; + "Attempting endpoint re-enumeration...\n" << ex.what() ; _fifo_ctrl.reset(); _ctrl_transport.reset(); _fx2_ctrl->usrp_fx2_reset(); @@ -230,9 +229,9 @@ b100_impl::b100_impl(const device_addr_t &device_addr){ //try reset once in the case of failure catch(const uhd::exception &){ if (initialization_count > 1) throw; - UHD_MSG(warning) << + UHD_LOGGER_WARNING("B100") << "The control endpoint was left in a bad state.\n" - "Attempting endpoint re-enumeration...\n" << std::endl; + "Attempting endpoint re-enumeration...\n" ; _fifo_ctrl.reset(); _ctrl_transport.reset(); _fx2_ctrl->usrp_fx2_reset(); @@ -478,12 +477,12 @@ b100_impl::b100_impl(const device_addr_t &device_addr){ //bind frontend corrections to the dboard freq props const fs_path db_tx_fe_path = mb_path / "dboards" / "A" / "tx_frontends"; - BOOST_FOREACH(const std::string &name, _tree->list(db_tx_fe_path)){ + for(const std::string &name: _tree->list(db_tx_fe_path)){ _tree->access<double>(db_tx_fe_path / name / "freq" / "value") .add_coerced_subscriber(boost::bind(&b100_impl::set_tx_fe_corrections, this, _1)); } const fs_path db_rx_fe_path = mb_path / "dboards" / "A" / "rx_frontends"; - BOOST_FOREACH(const std::string &name, _tree->list(db_rx_fe_path)){ + for(const std::string &name: _tree->list(db_rx_fe_path)){ _tree->access<double>(db_rx_fe_path / name / "freq" / "value") .add_coerced_subscriber(boost::bind(&b100_impl::set_rx_fe_corrections, this, _1)); } @@ -504,10 +503,10 @@ b100_impl::b100_impl(const device_addr_t &device_addr){ .add_coerced_subscriber(boost::bind(&b100_clock_ctrl::set_fpga_clock_rate, _clock_ctrl, _1)); //reset cordic rates and their properties to zero - BOOST_FOREACH(const std::string &name, _tree->list(mb_path / "rx_dsps")){ + for(const std::string &name: _tree->list(mb_path / "rx_dsps")){ _tree->access<double>(mb_path / "rx_dsps" / name / "freq" / "value").set(0.0); } - BOOST_FOREACH(const std::string &name, _tree->list(mb_path / "tx_dsps")){ + for(const std::string &name: _tree->list(mb_path / "tx_dsps")){ _tree->access<double>(mb_path / "tx_dsps" / name / "freq" / "value").set(0.0); } diff --git a/host/lib/usrp/b100/clock_ctrl.cpp b/host/lib/usrp/b100/clock_ctrl.cpp index 5700a321a..010a0a6f8 100644 --- a/host/lib/usrp/b100/clock_ctrl.cpp +++ b/host/lib/usrp/b100/clock_ctrl.cpp @@ -18,14 +18,13 @@ #include "clock_ctrl.hpp" #include "ad9522_regs.hpp" #include <uhd/utils/log.hpp> -#include <uhd/utils/msg.hpp> + #include <uhd/exception.hpp> #include <uhd/utils/assert_has.hpp> #include <uhd/utils/safe_call.hpp> #include <stdint.h> #include "b100_regs.hpp" //spi slave constants #include <boost/assign/list_of.hpp> -#include <boost/foreach.hpp> #include <boost/format.hpp> #include <boost/thread/thread.hpp> #include <boost/math/common_factor_rt.hpp> //gcd @@ -149,11 +148,11 @@ static clock_settings_type get_clock_settings(double rate){ cs.chan_divider /= cs.vco_divider; } - UHD_LOGV(always) - << "gcd " << gcd << std::endl - << "X " << X << std::endl - << "Y " << Y << std::endl - << cs.to_pp_string() << std::endl + UHD_LOGGER_DEBUG("B100") + << "gcd: " << gcd + << " X: " << X + << " Y: " << Y + << cs.to_pp_string() ; //filter limits on the counters @@ -167,7 +166,7 @@ static clock_settings_type get_clock_settings(double rate){ if (cs.get_vco_rate() < 1400e6 + vco_bound_pad) continue; if (cs.get_out_rate() != rate) continue; - UHD_MSG(status) << "USRP-B100 clock control: " << i << std::endl << cs.to_pp_string() << std::endl; + UHD_LOGGER_INFO("B100") << "USRP-B100 clock control: " << i << cs.to_pp_string() ; return cs; } } @@ -466,7 +465,7 @@ private: void send_reg(uint16_t addr){ uint32_t reg = _ad9522_regs.get_write_reg(addr); - UHD_LOGV(often) << "clock control write reg: " << std::hex << reg << std::endl; + UHD_LOGGER_TRACE("B100") << "clock control write reg: " << std::hex << reg ; byte_vector_t buf; buf.push_back(uint8_t(reg >> 16)); buf.push_back(uint8_t(reg >> 8)); @@ -502,7 +501,7 @@ private: _ad9522_regs.set_reg(addr, reg); if (_ad9522_regs.vco_calibration_finished) goto wait_for_ld; } - UHD_MSG(error) << "USRP-B100 clock control: VCO calibration timeout" << std::endl; + UHD_LOGGER_ERROR("B100") << "USRP-B100 clock control: VCO calibration timeout"; wait_for_ld: //wait for digital lock detect: for (size_t ms10 = 0; ms10 < 100; ms10++){ @@ -511,7 +510,7 @@ private: _ad9522_regs.set_reg(addr, reg); if (_ad9522_regs.digital_lock_detect) return; } - UHD_MSG(error) << "USRP-B100 clock control: lock detection timeout" << std::endl; + UHD_LOGGER_ERROR("B100") << "USRP-B100 clock control: lock detection timeout"; } void soft_sync(void){ @@ -533,7 +532,7 @@ private: ; //write initial register values and latch/update - BOOST_FOREACH(const range_t &range, ranges){ + for(const range_t &range: ranges){ for(uint16_t addr = range.first; addr <= range.second; addr++){ this->send_reg(addr); } diff --git a/host/lib/usrp/b100/codec_ctrl.cpp b/host/lib/usrp/b100/codec_ctrl.cpp index e78608beb..01fd51f52 100644 --- a/host/lib/usrp/b100/codec_ctrl.cpp +++ b/host/lib/usrp/b100/codec_ctrl.cpp @@ -259,7 +259,7 @@ void b100_codec_ctrl_impl::write_aux_dac(aux_dac_t which, double volts){ **********************************************************************/ void b100_codec_ctrl_impl::send_reg(uint8_t addr){ uint32_t reg = _ad9862_regs.get_write_reg(addr); - UHD_LOGV(rarely) << "codec control write reg: " << std::hex << reg << std::endl; + UHD_LOGGER_TRACE("B100") << "codec control write reg: " << std::hex << reg ; _iface->transact_spi( B100_SPI_SS_AD9862, spi_config_t::EDGE_RISE, @@ -269,13 +269,13 @@ void b100_codec_ctrl_impl::send_reg(uint8_t addr){ void b100_codec_ctrl_impl::recv_reg(uint8_t addr){ uint32_t reg = _ad9862_regs.get_read_reg(addr); - UHD_LOGV(rarely) << "codec control read reg: " << std::hex << reg << std::endl; + UHD_LOGGER_TRACE("B100") << "codec control read reg: " << std::hex << reg ; uint32_t ret = _iface->transact_spi( B100_SPI_SS_AD9862, spi_config_t::EDGE_RISE, reg, 16, true /*rb*/ ); - UHD_LOGV(rarely) << "codec control read ret: " << std::hex << uint16_t(ret & 0xFF) << std::endl; + UHD_LOGGER_TRACE("B100") << "codec control read ret: " << std::hex << uint16_t(ret & 0xFF) ; _ad9862_regs.set_reg(addr, uint8_t(ret&0xff)); } diff --git a/host/lib/usrp/b100/io_impl.cpp b/host/lib/usrp/b100/io_impl.cpp index c1810ed8c..7cccc7752 100644 --- a/host/lib/usrp/b100/io_impl.cpp +++ b/host/lib/usrp/b100/io_impl.cpp @@ -23,7 +23,7 @@ #include <boost/format.hpp> #include <boost/bind.hpp> #include <boost/thread.hpp> -#include <uhd/utils/msg.hpp> + #include <uhd/utils/log.hpp> #include <boost/make_shared.hpp> @@ -36,10 +36,10 @@ void b100_impl::update_rates(void){ _tree->access<double>(mb_path / "tick_rate").update(); //and now that the tick rate is set, init the host rates to something - BOOST_FOREACH(const std::string &name, _tree->list(mb_path / "rx_dsps")){ + for(const std::string &name: _tree->list(mb_path / "rx_dsps")){ _tree->access<double>(mb_path / "rx_dsps" / name / "rate" / "value").update(); } - BOOST_FOREACH(const std::string &name, _tree->list(mb_path / "tx_dsps")){ + for(const std::string &name: _tree->list(mb_path / "tx_dsps")){ _tree->access<double>(mb_path / "tx_dsps" / name / "rate" / "value").update(); } } diff --git a/host/lib/usrp/b100/usb_zero_copy_wrapper.cpp b/host/lib/usrp/b100/usb_zero_copy_wrapper.cpp index d57d57f21..ea3e9f87e 100644 --- a/host/lib/usrp/b100/usb_zero_copy_wrapper.cpp +++ b/host/lib/usrp/b100/usb_zero_copy_wrapper.cpp @@ -18,10 +18,9 @@ #include <uhd/transport/usb_zero_copy.hpp> #include <uhd/transport/buffer_pool.hpp> #include <uhd/utils/byteswap.hpp> -#include <uhd/utils/msg.hpp> +#include <uhd/utils/log.hpp> #include <uhd/utils/tasks.hpp> #include <uhd/utils/atomic.hpp> -#include <boost/foreach.hpp> #include <boost/make_shared.hpp> #include <boost/thread/mutex.hpp> #include <boost/thread/condition_variable.hpp> |