diff options
Diffstat (limited to 'host/lib')
41 files changed, 162 insertions, 118 deletions
diff --git a/host/lib/include/uhdlib/usrp/common/max287x.hpp b/host/lib/include/uhdlib/usrp/common/max287x.hpp index 762daf7b6..154a967b4 100644 --- a/host/lib/include/uhdlib/usrp/common/max287x.hpp +++ b/host/lib/include/uhdlib/usrp/common/max287x.hpp @@ -8,6 +8,8 @@ #ifndef MAX287X_HPP_INCLUDED #define MAX287X_HPP_INCLUDED +#include "max2870_regs.hpp" +#include "max2871_regs.hpp" #include <uhd/exception.hpp> #include <uhd/types/dict.hpp> #include <uhd/types/ranges.hpp> @@ -16,12 +18,11 @@ #include <uhd/utils/safe_call.hpp> #include <boost/assign.hpp> #include <boost/function.hpp> -#include <boost/thread.hpp> #include <boost/math/special_functions/round.hpp> -#include <stdint.h> #include <vector> -#include "max2870_regs.hpp" -#include "max2871_regs.hpp" +#include <chrono> +#include <thread> +#include <stdint.h> /** * MAX287x interface @@ -915,7 +916,7 @@ void max287x<max287x_regs_t>::commit() if (_delay_after_write) { - boost::this_thread::sleep(boost::posix_time::milliseconds(20)); + std::this_thread::sleep_for(std::chrono::milliseconds(20)); _delay_after_write = false; } } diff --git a/host/lib/rfnoc/nocscript/gen_basic_funcs.py b/host/lib/rfnoc/nocscript/gen_basic_funcs.py index cd024af5c..fec6b04ad 100755 --- a/host/lib/rfnoc/nocscript/gen_basic_funcs.py +++ b/host/lib/rfnoc/nocscript/gen_basic_funcs.py @@ -26,7 +26,8 @@ from mako.template import Template # INCLUDE_LIST = """ #include <boost/math/special_functions/round.hpp> -#include <boost/thread/thread.hpp> +#include <chrono> +#include <thread> """ FUNCTION_LIST = """ CATEGORY: Math Functions @@ -251,7 +252,7 @@ CATEGORY: Execution Control BOOL SLEEP(DOUBLE) { int ms = ${args[0]} / 1000; - boost::this_thread::sleep(boost::posix_time::milliseconds(ms)); + std::this_thread::sleep_for(std::chrono::milliseconds(ms)); ${RETURN}(true); } """ diff --git a/host/lib/rfnoc/source_block_ctrl_base.cpp b/host/lib/rfnoc/source_block_ctrl_base.cpp index d71905a1f..5ede899cb 100644 --- a/host/lib/rfnoc/source_block_ctrl_base.cpp +++ b/host/lib/rfnoc/source_block_ctrl_base.cpp @@ -9,6 +9,8 @@ #include <uhd/utils/log.hpp> #include <uhd/rfnoc/constants.hpp> #include <uhdlib/rfnoc/utils.hpp> +#include <chrono> +#include <thread> using namespace uhd; using namespace uhd::rfnoc; @@ -103,7 +105,7 @@ void source_block_ctrl_base::configure_flow_control_out( //to flush is more than enough time. //TODO: Enhancement. We should get feedback from the FPGA about when the source_flow_control // module is done flushing. - boost::this_thread::sleep(boost::posix_time::milliseconds(1)); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); //Resize the FC window. //Precondition: No data can be buffered upstream. diff --git a/host/lib/transport/muxed_zero_copy_if.cpp b/host/lib/transport/muxed_zero_copy_if.cpp index 9211ffeb2..2e7583276 100644 --- a/host/lib/transport/muxed_zero_copy_if.cpp +++ b/host/lib/transport/muxed_zero_copy_if.cpp @@ -14,6 +14,8 @@ #include <boost/thread.hpp> #include <boost/thread/locks.hpp> #include <map> +#include <chrono> +#include <thread> using namespace uhd; using namespace uhd::transport; @@ -210,7 +212,7 @@ private: if (not _process_next_buffer()) { //Be a good citizen and yield if no packet is processed static const size_t MIN_DUR = 1; - boost::this_thread::sleep_for(boost::chrono::nanoseconds(MIN_DUR)); + std::this_thread::sleep_for(std::chrono::nanoseconds(MIN_DUR)); //We call sleep(MIN_DUR) above instead of yield() to ensure that we //relinquish the current scheduler time slot. //yield() is a hint to the scheduler to end the time diff --git a/host/lib/transport/nirio/niusrprio_session.cpp b/host/lib/transport/nirio/niusrprio_session.cpp index 797855a11..bda0ec1c1 100644 --- a/host/lib/transport/nirio/niusrprio_session.cpp +++ b/host/lib/transport/nirio/niusrprio_session.cpp @@ -230,7 +230,7 @@ nirio_status niusrprio_session::_ensure_fpga_ready() boost::posix_time::ptime start_time = boost::posix_time::microsec_clock::local_time(); boost::posix_time::time_duration elapsed; do { - boost::this_thread::sleep(boost::posix_time::milliseconds(10)); //Avoid flooding the bus + std::this_thread::sleep_for(std::chrono::milliseconds(10)); //Avoid flooding the bus elapsed = boost::posix_time::microsec_clock::local_time() - start_time; nirio_status_chain(_riok_proxy->peek(FPGA_STATUS_REG, reg_data), status); } while ( diff --git a/host/lib/transport/nirio_zero_copy.cpp b/host/lib/transport/nirio_zero_copy.cpp index 418e78d09..993a2c593 100644 --- a/host/lib/transport/nirio_zero_copy.cpp +++ b/host/lib/transport/nirio_zero_copy.cpp @@ -6,18 +6,19 @@ // #include <uhd/transport/nirio_zero_copy.hpp> -#include <stdio.h> #include <uhd/transport/nirio/nirio_fifo.h> - #include <uhd/utils/log.hpp> #include <uhdlib/utils/atomic.hpp> #include <boost/format.hpp> #include <boost/make_shared.hpp> #include <boost/date_time/posix_time/posix_time.hpp> -#include <boost/thread/thread.hpp> //sleep #include <boost/interprocess/mapped_region.hpp> //get_page_size() #include <vector> #include <algorithm> // std::max +#include <chrono> +#include <thread> +#include <stdio.h> + //@TODO: Move the register defs required by the class to a common location #include "../usrp/x300/x300_regs.hpp" @@ -313,7 +314,7 @@ private: if (nirio_status_not_fatal(status) && (tx_busy || rx_busy)) { start_time = boost::posix_time::microsec_clock::local_time(); do { - boost::this_thread::sleep(boost::posix_time::microsec(50)); //Avoid flooding the bus + std::this_thread::sleep_for(std::chrono::microseconds(50)); //Avoid flooding the bus elapsed = boost::posix_time::microsec_clock::local_time() - start_time; nirio_status_chain(_proxy()->peek( PCIE_TX_DMA_REG(DMA_CTRL_STATUS_REG, _fifo_instance), reg_data), status); diff --git a/host/lib/transport/super_send_packet_handler.hpp b/host/lib/transport/super_send_packet_handler.hpp index 9c18e2080..e824ef4e9 100644 --- a/host/lib/transport/super_send_packet_handler.hpp +++ b/host/lib/transport/super_send_packet_handler.hpp @@ -20,11 +20,11 @@ #include <uhd/transport/vrt_if_packet.hpp> #include <uhd/transport/zero_copy.hpp> #include <uhdlib/rfnoc/tx_stream_terminator.hpp> -#include <boost/thread/thread.hpp> -#include <boost/thread/thread_time.hpp> #include <boost/function.hpp> #include <iostream> #include <vector> +#include <chrono> +#include <thread> #ifdef UHD_TXRX_DEBUG_PRINTS // Included for debugging @@ -172,7 +172,7 @@ public: uhd::async_metadata_t &async_metadata, double timeout = 0.1 ){ if (_async_receiver) return _async_receiver(async_metadata, timeout); - boost::this_thread::sleep(boost::posix_time::microseconds(long(timeout*1e6))); + std::this_thread::sleep_for(std::chrono::microseconds(long(timeout*1e6))); return false; } diff --git a/host/lib/transport/tcp_zero_copy.cpp b/host/lib/transport/tcp_zero_copy.cpp index ddbc6b786..a52d089a8 100644 --- a/host/lib/transport/tcp_zero_copy.cpp +++ b/host/lib/transport/tcp_zero_copy.cpp @@ -8,13 +8,13 @@ #include "udp_common.hpp" #include <uhd/transport/tcp_zero_copy.hpp> #include <uhd/transport/buffer_pool.hpp> - #include <uhd/utils/log.hpp> #include <uhdlib/utils/atomic.hpp> #include <boost/format.hpp> #include <boost/make_shared.hpp> -#include <boost/thread/thread.hpp> //sleep #include <vector> +#include <chrono> +#include <thread> using namespace uhd; using namespace uhd::transport; @@ -85,7 +85,7 @@ public: if (ret == ssize_t(size())) break; if (ret == -1 and errno == ENOBUFS) { - boost::this_thread::sleep(boost::posix_time::microseconds(1)); + std::this_thread::sleep_for(std::chrono::microseconds(1)); continue; //try to send again } UHD_ASSERT_THROW(ret == ssize_t(size())); diff --git a/host/lib/transport/udp_zero_copy.cpp b/host/lib/transport/udp_zero_copy.cpp index dc87d7e4c..29dbd6c1e 100644 --- a/host/lib/transport/udp_zero_copy.cpp +++ b/host/lib/transport/udp_zero_copy.cpp @@ -14,8 +14,9 @@ #include <uhdlib/utils/atomic.hpp> #include <boost/format.hpp> #include <boost/make_shared.hpp> -#include <boost/thread/thread.hpp> //sleep #include <vector> +#include <chrono> +#include <thread> using namespace uhd; using namespace uhd::transport; @@ -116,7 +117,7 @@ public: if (ret == ssize_t(size())) break; if (ret == -1 and errno == ENOBUFS) { - boost::this_thread::sleep(boost::posix_time::microseconds(1)); + std::this_thread::sleep_for(std::chrono::microseconds(1)); continue; //try to send again } if (ret == -1) diff --git a/host/lib/transport/xport_benchmarker.cpp b/host/lib/transport/xport_benchmarker.cpp index c56b3a53e..0351d5106 100644 --- a/host/lib/transport/xport_benchmarker.cpp +++ b/host/lib/transport/xport_benchmarker.cpp @@ -6,6 +6,8 @@ // #include "xport_benchmarker.hpp" +#include <chrono> +#include <thread> namespace uhd { namespace transport { @@ -25,7 +27,7 @@ const device_addr_t& xport_benchmarker::benchmark_throughput_chdr _tx_thread.reset(new boost::thread(boost::bind(&xport_benchmarker::_stream_tx, this, tx_transport.get(), &pkt_info, big_endian))); _rx_thread.reset(new boost::thread(boost::bind(&xport_benchmarker::_stream_rx, this, rx_transport.get(), &pkt_info, big_endian))); - boost::this_thread::sleep(boost::posix_time::milliseconds(duration_ms)); + std::this_thread::sleep_for(std::chrono::milliseconds(duration_ms)); _tx_thread->interrupt(); _rx_thread->interrupt(); diff --git a/host/lib/types/serial.cpp b/host/lib/types/serial.cpp index 381bb2181..24da51e7f 100644 --- a/host/lib/types/serial.cpp +++ b/host/lib/types/serial.cpp @@ -6,8 +6,9 @@ // #include <uhd/types/serial.hpp> -#include <boost/thread.hpp> //for sleeping #include <boost/assign/list_of.hpp> +#include <chrono> +#include <thread> using namespace uhd; @@ -43,7 +44,7 @@ void i2c_iface::write_eeprom( //write a byte at a time, its easy that way byte_vector_t cmd = boost::assign::list_of(offset+i)(bytes[i]); this->write_i2c(addr, cmd); - boost::this_thread::sleep(boost::posix_time::milliseconds(10)); //worst case write + std::this_thread::sleep_for(std::chrono::milliseconds(10)); //worst case write } } @@ -104,7 +105,7 @@ struct eeprom16_impl : i2c_iface uint16_t offset_i = offset+i; byte_vector_t cmd = boost::assign::list_of(offset_i >> 8)(offset_i & 0xff)(bytes[i]); this->write_i2c(addr, cmd); - boost::this_thread::sleep(boost::posix_time::milliseconds(10)); //worst case write + std::this_thread::sleep_for(std::chrono::milliseconds(10)); //worst case write } } }; diff --git a/host/lib/usrp/b100/clock_ctrl.cpp b/host/lib/usrp/b100/clock_ctrl.cpp index e3ef7d6a5..c06b44c49 100644 --- a/host/lib/usrp/b100/clock_ctrl.cpp +++ b/host/lib/usrp/b100/clock_ctrl.cpp @@ -16,10 +16,11 @@ #include "b100_regs.hpp" //spi slave constants #include <boost/assign/list_of.hpp> #include <boost/format.hpp> -#include <boost/thread/thread.hpp> #include <boost/math/common_factor_rt.hpp> //gcd #include <algorithm> #include <utility> +#include <chrono> +#include <thread> using namespace uhd; @@ -486,7 +487,7 @@ private: //wait for calibration done: static const uint8_t addr = 0x01F; for (size_t ms10 = 0; ms10 < 100; ms10++){ - boost::this_thread::sleep(boost::posix_time::milliseconds(10)); + std::this_thread::sleep_for(std::chrono::milliseconds(10)); uint32_t reg = read_reg(addr); _ad9522_regs.set_reg(addr, reg); if (_ad9522_regs.vco_calibration_finished) goto wait_for_ld; @@ -495,7 +496,7 @@ private: wait_for_ld: //wait for digital lock detect: for (size_t ms10 = 0; ms10 < 100; ms10++){ - boost::this_thread::sleep(boost::posix_time::milliseconds(10)); + std::this_thread::sleep_for(std::chrono::milliseconds(10)); uint32_t reg = read_reg(addr); _ad9522_regs.set_reg(addr, reg); if (_ad9522_regs.digital_lock_detect) return; diff --git a/host/lib/usrp/b200/b200_iface.cpp b/host/lib/usrp/b200/b200_iface.cpp index 836a92ff7..432201429 100644 --- a/host/lib/usrp/b200/b200_iface.cpp +++ b/host/lib/usrp/b200/b200_iface.cpp @@ -13,7 +13,6 @@ #include <uhdlib/utils/ihex.hpp> #include <boost/functional/hash.hpp> -#include <boost/thread/thread.hpp> #include <boost/lexical_cast.hpp> #include <boost/format.hpp> #include <libusb.h> @@ -22,6 +21,8 @@ #include <vector> #include <cstring> #include <iomanip> +#include <chrono> +#include <thread> #include <stdint.h> //! libusb_error_name is only in newer API @@ -225,7 +226,7 @@ public: /* Success! Let the system settle. */ // TODO: Replace this with a polling loop in the FX3, or find out // what the actual, correct timeout value is. - boost::this_thread::sleep(boost::posix_time::milliseconds(1000)); + std::this_thread::sleep_for(std::chrono::milliseconds(1000)); } void reset_fx3(void) { @@ -431,7 +432,7 @@ public: return fx3_state; } - boost::this_thread::sleep(boost::posix_time::milliseconds(10)); + std::this_thread::sleep_for(std::chrono::milliseconds(10)); wait_count++; } while(fx3_state != FX3_STATE_FPGA_READY); @@ -456,7 +457,7 @@ public: return fx3_state; } - boost::this_thread::sleep(boost::posix_time::milliseconds(10)); + std::this_thread::sleep_for(std::chrono::milliseconds(10)); wait_count++; } while(fx3_state != FX3_STATE_CONFIGURING_FPGA); @@ -505,7 +506,7 @@ public: return fx3_state; } - boost::this_thread::sleep(boost::posix_time::milliseconds(10)); + std::this_thread::sleep_for(std::chrono::milliseconds(10)); wait_count++; } while(fx3_state != FX3_STATE_RUNNING); diff --git a/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp b/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp index cbb720894..54f15d1a8 100644 --- a/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp +++ b/host/lib/usrp/common/ad9361_driver/ad9361_device.cpp @@ -11,16 +11,16 @@ #include "ad9361_client.h" #include "ad9361_device.h" #define _USE_MATH_DEFINES -#include <cmath> #include <uhd/exception.hpp> #include <uhd/utils/log.hpp> -#include <stdint.h> -#include <boost/date_time/posix_time/posix_time.hpp> -#include <boost/thread/thread.hpp> #include <boost/scoped_array.hpp> #include <boost/format.hpp> #include <boost/math/special_functions.hpp> +#include <chrono> +#include <thread> +#include <cmath> +#include <stdint.h> //////////////////////////////////////////////////////////// // the following macros evaluate to a compile time constant @@ -127,7 +127,7 @@ void ad9361_device_t::_program_fir_filter(direction_t direction, chain_t chain, /* Turn on the filter clock. */ _io_iface->poke8(base + 5, reg_numtaps | reg_chain | 0x02); - boost::this_thread::sleep(boost::posix_time::milliseconds(1)); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); /* Zero the unused taps just in case they have stale data */ int addr; @@ -258,7 +258,7 @@ void ad9361_device_t::_calibrate_lock_bbpll() break; } count++; - boost::this_thread::sleep(boost::posix_time::milliseconds(2)); + std::this_thread::sleep_for(std::chrono::milliseconds(2)); } } @@ -283,7 +283,7 @@ void ad9361_device_t::_calibrate_synth_charge_pumps() break; } count++; - boost::this_thread::sleep(boost::posix_time::milliseconds(1)); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); } _io_iface->poke8(0x23d, 0x00); @@ -296,7 +296,7 @@ void ad9361_device_t::_calibrate_synth_charge_pumps() break; } count++; - boost::this_thread::sleep(boost::posix_time::milliseconds(1)); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); } _io_iface->poke8(0x27d, 0x00); } @@ -357,7 +357,7 @@ double ad9361_device_t::_calibrate_baseband_rx_analog_filter(double req_rfbw) break; } count++; - boost::this_thread::sleep(boost::posix_time::milliseconds(1)); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); } /* Disable RX1 & RX2 filter tuners. */ @@ -414,7 +414,7 @@ double ad9361_device_t::_calibrate_baseband_tx_analog_filter(double req_rfbw) } count++; - boost::this_thread::sleep(boost::posix_time::milliseconds(1)); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); } /* Disable the filter tuner. */ @@ -734,7 +734,7 @@ void ad9361_device_t::_calibrate_baseband_dc_offset() break; } count++; - boost::this_thread::sleep(boost::posix_time::milliseconds(5)); + std::this_thread::sleep_for(std::chrono::milliseconds(5)); } } @@ -767,7 +767,7 @@ void ad9361_device_t::_calibrate_rf_dc_offset() break; } count++; - boost::this_thread::sleep(boost::posix_time::milliseconds(50)); + std::this_thread::sleep_for(std::chrono::milliseconds(50)); } _io_iface->poke8(0x18b, 0x8d); // Enable RF DC tracking @@ -818,7 +818,7 @@ void ad9361_device_t::_calibrate_rx_quadrature() break; } count++; - boost::this_thread::sleep(boost::posix_time::milliseconds(5)); + std::this_thread::sleep_for(std::chrono::milliseconds(5)); } _io_iface->poke8(0x057, 0x30); // Re-enable Tx mixers @@ -886,7 +886,7 @@ void ad9361_device_t::_tx_quadrature_cal_routine() { break; } count++; - boost::this_thread::sleep(boost::posix_time::milliseconds(10)); + std::this_thread::sleep_for(std::chrono::milliseconds(10)); } } @@ -1309,7 +1309,7 @@ double ad9361_device_t::_tune_helper(direction_t direction, const double value) _io_iface->poke8(0x005, _regs.vcodivs); /* Lock the PLL! */ - boost::this_thread::sleep(boost::posix_time::milliseconds(2)); + std::this_thread::sleep_for(std::chrono::milliseconds(2)); if ((_io_iface->peek8(0x247) & 0x02) == 0) { throw uhd::runtime_error("[ad9361_device_t] RX PLL NOT LOCKED"); } @@ -1350,7 +1350,7 @@ double ad9361_device_t::_tune_helper(direction_t direction, const double value) _io_iface->poke8(0x005, _regs.vcodivs); /* Lock the PLL! */ - boost::this_thread::sleep(boost::posix_time::milliseconds(2)); + std::this_thread::sleep_for(std::chrono::milliseconds(2)); if ((_io_iface->peek8(0x287) & 0x02) == 0) { throw uhd::runtime_error("[ad9361_device_t] TX PLL NOT LOCKED"); } @@ -1555,7 +1555,7 @@ void ad9361_device_t::initialize() /* Reset the device. */ _io_iface->poke8(0x000, 0x01); _io_iface->poke8(0x000, 0x00); - boost::this_thread::sleep(boost::posix_time::milliseconds(20)); + std::this_thread::sleep_for(std::chrono::milliseconds(20)); /* Check device ID to make sure iface works */ uint32_t device_id = (_io_iface->peek8(0x037) & 0x8); @@ -1590,7 +1590,7 @@ void ad9361_device_t::initialize() default: throw uhd::runtime_error("[ad9361_device_t] NOT IMPLEMENTED"); } - boost::this_thread::sleep(boost::posix_time::milliseconds(20)); + std::this_thread::sleep_for(std::chrono::milliseconds(20)); /* Tune the BBPLL, write TX and RX FIRS. */ _setup_rates(50e6); @@ -1698,7 +1698,7 @@ void ad9361_device_t::initialize() _io_iface->poke8(0x015, 0x04); // dual synth mode, synth en ctrl en _io_iface->poke8(0x014, 0x05); // use SPI for TXNRX ctrl, to ALERT, TX on _io_iface->poke8(0x013, 0x01); // enable ENSM - boost::this_thread::sleep(boost::posix_time::milliseconds(1)); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); _calibrate_synth_charge_pumps(); @@ -1808,7 +1808,7 @@ double ad9361_device_t::set_clock_rate(const double req_rate) case 0x05: /* We are in the ALERT state. */ _io_iface->poke8(0x014, 0x21); - boost::this_thread::sleep(boost::posix_time::milliseconds(5)); + std::this_thread::sleep_for(std::chrono::milliseconds(5)); _io_iface->poke8(0x014, 0x00); break; @@ -1838,7 +1838,7 @@ double ad9361_device_t::set_clock_rate(const double req_rate) _io_iface->poke8(0x015, 0x04); //dual synth mode, synth en ctrl en _io_iface->poke8(0x014, 0x05); //use SPI for TXNRX ctrl, to ALERT, TX on _io_iface->poke8(0x013, 0x01); //enable ENSM - boost::this_thread::sleep(boost::posix_time::milliseconds(1)); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); _calibrate_synth_charge_pumps(); @@ -2192,7 +2192,7 @@ double ad9361_device_t::_get_temperature(const double cal_offset, const double t boost::posix_time::time_duration elapsed; //wait for valid data (toggle of bit 1 in 0x00C) while(((_io_iface->peek8(0x00C) >> 1) & 0x01) == 0) { - boost::this_thread::sleep(boost::posix_time::microseconds(100)); + std::this_thread::sleep_for(std::chrono::microseconds(100)); elapsed = boost::posix_time::microsec_clock::local_time() - start_time; if(elapsed.total_milliseconds() > (timeout*1000)) { diff --git a/host/lib/usrp/common/fx2_ctrl.cpp b/host/lib/usrp/common/fx2_ctrl.cpp index 6e1b374ca..77501d981 100644 --- a/host/lib/usrp/common/fx2_ctrl.cpp +++ b/host/lib/usrp/common/fx2_ctrl.cpp @@ -10,13 +10,14 @@ #include <uhd/exception.hpp> #include <uhd/transport/usb_control.hpp> #include <boost/functional/hash.hpp> -#include <boost/thread/thread.hpp> #include <stdint.h> #include <fstream> #include <sstream> #include <string> #include <vector> #include <cstring> +#include <chrono> +#include <thread> using namespace uhd; using namespace uhd::usrp; @@ -137,7 +138,7 @@ public: usrp_control_write(FX2_FIRMWARE_LOAD, 0xe600, 0, &reset_y, 1); usrp_control_write(FX2_FIRMWARE_LOAD, 0xe600, 0, &reset_n, 1); //wait for things to settle - boost::this_thread::sleep(boost::posix_time::milliseconds(2000)); + std::this_thread::sleep_for(std::chrono::milliseconds(2000)); } void usrp_load_firmware(std::string filestring, bool force) @@ -194,7 +195,7 @@ public: file.close(); //wait for things to settle - boost::this_thread::sleep(boost::posix_time::milliseconds(1000)); + std::this_thread::sleep_for(std::chrono::milliseconds(1000)); if (load_img_msg) UHD_LOGGER_INFO("FX2") << "Firmware loaded"; return; } @@ -302,7 +303,7 @@ public: } addr += pagesize; len -= pagesize; - boost::this_thread::sleep(boost::posix_time::milliseconds(100)); + std::this_thread::sleep_for(std::chrono::milliseconds(100)); } file.close(); if (load_img_msg) UHD_LOGGER_INFO("FX2") << "EEPROM image loaded"; diff --git a/host/lib/usrp/cores/dma_fifo_core_3000.cpp b/host/lib/usrp/cores/dma_fifo_core_3000.cpp index 618f81f64..445706574 100644 --- a/host/lib/usrp/cores/dma_fifo_core_3000.cpp +++ b/host/lib/usrp/cores/dma_fifo_core_3000.cpp @@ -10,7 +10,8 @@ #include <uhd/utils/log.hpp> #include <uhdlib/usrp/cores/dma_fifo_core_3000.hpp> #include <boost/format.hpp> -#include <boost/thread/thread.hpp> //sleep +#include <chrono> +#include <thread> using namespace uhd; @@ -315,7 +316,7 @@ public: _bist_ctrl_reg.write(bist_ctrl_reg_t::GO, 1); if (!finite) { - boost::this_thread::sleep(boost::posix_time::milliseconds(timeout_ms)); + std::this_thread::sleep_for(std::chrono::milliseconds(timeout_ms)); } _wait_for_bist_done(timeout_ms, !finite); @@ -345,7 +346,7 @@ private: boost::posix_time::time_duration elapsed; while (_fifo_readback.is_fifo_busy()) { - boost::this_thread::sleep(boost::posix_time::microsec(1000)); + std::this_thread::sleep_for(std::chrono::microseconds(1000)); elapsed = boost::posix_time::microsec_clock::local_time() - start_time; if (elapsed.total_milliseconds() > 100) break; } @@ -361,7 +362,7 @@ private: _bist_ctrl_reg.write(bist_ctrl_reg_t::GO, 0); force_stop = false; } - boost::this_thread::sleep(boost::posix_time::microsec(1000)); + std::this_thread::sleep_for(std::chrono::microseconds(1000)); elapsed = boost::posix_time::microsec_clock::local_time() - start_time; if (elapsed.total_milliseconds() > timeout_ms) break; } diff --git a/host/lib/usrp/cores/i2c_core_100_wb32.cpp b/host/lib/usrp/cores/i2c_core_100_wb32.cpp index c6a0e8d84..ec47aa8f0 100644 --- a/host/lib/usrp/cores/i2c_core_100_wb32.cpp +++ b/host/lib/usrp/cores/i2c_core_100_wb32.cpp @@ -8,7 +8,8 @@ #include <uhd/exception.hpp> #include <uhd/utils/log.hpp> #include <uhdlib/usrp/cores/i2c_core_100_wb32.hpp> -#include <boost/thread/thread.hpp> //sleep +#include <chrono> +#include <thread> #define REG_I2C_PRESCALER_LO _base + 0 #define REG_I2C_PRESCALER_HI _base + 4 @@ -126,7 +127,7 @@ private: for (size_t i = 0; i < 10; i++) { if ((_iface->peek32(REG_I2C_CMD_STATUS) & I2C_ST_TIP) == 0) return; - boost::this_thread::sleep(boost::posix_time::milliseconds(1)); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); } UHD_LOGGER_ERROR("CORES") << "i2c_core_100_wb32: i2c_wait timeout" ; } diff --git a/host/lib/usrp/cores/i2c_core_200.cpp b/host/lib/usrp/cores/i2c_core_200.cpp index c0a6cb949..4278bf611 100644 --- a/host/lib/usrp/cores/i2c_core_200.cpp +++ b/host/lib/usrp/cores/i2c_core_200.cpp @@ -8,8 +8,9 @@ #include <uhd/exception.hpp> #include <uhd/utils/log.hpp> #include <uhdlib/usrp/cores/i2c_core_200.hpp> -#include <boost/thread/thread.hpp> //sleep #include <boost/thread/mutex.hpp> +#include <chrono> +#include <thread> #define REG_I2C_WR_PRESCALER_LO (1 << 3) | 0 #define REG_I2C_WR_PRESCALER_HI (1 << 3) | 1 @@ -118,7 +119,7 @@ private: void i2c_wait(void) { for (size_t i = 0; i < 100; i++){ if ((this->peek(REG_I2C_RD_ST) & I2C_ST_TIP) == 0) return; - boost::this_thread::sleep(boost::posix_time::milliseconds(1)); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); } UHD_LOGGER_ERROR("CORES") << "i2c_core_200: i2c_wait timeout" ; } diff --git a/host/lib/usrp/cores/rx_dsp_core_200.cpp b/host/lib/usrp/cores/rx_dsp_core_200.cpp index 730985fdd..a87b92a50 100644 --- a/host/lib/usrp/cores/rx_dsp_core_200.cpp +++ b/host/lib/usrp/cores/rx_dsp_core_200.cpp @@ -13,11 +13,12 @@ #include <uhdlib/usrp/cores/rx_dsp_core_200.hpp> #include <uhdlib/usrp/cores/dsp_core_utils.hpp> #include <boost/assign/list_of.hpp> -#include <boost/thread/thread.hpp> //thread sleep #include <boost/math/special_functions/round.hpp> #include <boost/numeric/conversion/bounds.hpp> #include <algorithm> #include <cmath> +#include <chrono> +#include <thread> #define REG_DSP_RX_FREQ _dsp_base + 0 #define REG_DSP_RX_SCALE_IQ _dsp_base + 4 @@ -69,7 +70,7 @@ public: stream_cmd_t stream_cmd(stream_cmd_t::STREAM_MODE_NUM_SAMPS_AND_DONE); stream_cmd.num_samps = 1; issue_stream_command(stream_cmd); - boost::this_thread::sleep(boost::posix_time::milliseconds(10)); //lets lingering pkt propagate + std::this_thread::sleep_for(std::chrono::milliseconds(10)); //lets lingering pkt propagate } this->clear(); diff --git a/host/lib/usrp/cores/time_core_3000.cpp b/host/lib/usrp/cores/time_core_3000.cpp index edec2880b..3fb6c3d57 100644 --- a/host/lib/usrp/cores/time_core_3000.cpp +++ b/host/lib/usrp/cores/time_core_3000.cpp @@ -8,7 +8,8 @@ #include <uhd/utils/safe_call.hpp> #include <uhd/utils/log.hpp> #include <uhdlib/usrp/cores/time_core_3000.hpp> -#include <boost/thread/thread.hpp> +#include <chrono> +#include <thread> #define REG_TIME_HI _base + 0 #define REG_TIME_LO _base + 4 @@ -55,7 +56,7 @@ struct time_core_3000_impl : time_core_3000 const size_t sleep_millis = 100; UHD_LOGGER_DEBUG("CORES") << "Performing timer loopback test... "; const time_spec_t time0 = this->get_time_now(); - boost::this_thread::sleep(boost::posix_time::milliseconds(sleep_millis)); + std::this_thread::sleep_for(std::chrono::milliseconds(sleep_millis)); const time_spec_t time1 = this->get_time_now(); const double approx_secs = (time1 - time0).get_real_secs(); const bool test_fail = (approx_secs > 0.15) or (approx_secs < 0.05); diff --git a/host/lib/usrp/cores/tx_dsp_core_200.cpp b/host/lib/usrp/cores/tx_dsp_core_200.cpp index efd64f7e5..6418d7049 100644 --- a/host/lib/usrp/cores/tx_dsp_core_200.cpp +++ b/host/lib/usrp/cores/tx_dsp_core_200.cpp @@ -13,9 +13,10 @@ #include <uhd/utils/log.hpp> #include <boost/assign/list_of.hpp> #include <boost/math/special_functions/round.hpp> -#include <boost/thread/thread.hpp> //sleep #include <algorithm> #include <cmath> +#include <chrono> +#include <thread> #define REG_DSP_TX_FREQ _dsp_base + 0 #define REG_DSP_TX_SCALE_IQ _dsp_base + 4 @@ -68,7 +69,7 @@ public: void clear(void){ _iface->poke32(REG_TX_CTRL_CLEAR, 1); //reset and flush technique - boost::this_thread::sleep(boost::posix_time::milliseconds(10)); + std::this_thread::sleep_for(std::chrono::milliseconds(10)); _iface->poke32(REG_TX_CTRL_CLEAR, 0); _iface->poke32(REG_TX_CTRL_REPORT_SID, _sid); } diff --git a/host/lib/usrp/dboard/db_dbsrx.cpp b/host/lib/usrp/dboard/db_dbsrx.cpp index 8266b6d9e..587158470 100644 --- a/host/lib/usrp/dboard/db_dbsrx.cpp +++ b/host/lib/usrp/dboard/db_dbsrx.cpp @@ -22,10 +22,11 @@ #include <uhd/usrp/dboard_manager.hpp> #include <boost/assign/list_of.hpp> #include <boost/format.hpp> -#include <boost/thread.hpp> #include <boost/math/special_functions/round.hpp> #include <utility> #include <cmath> +#include <chrono> +#include <thread> using namespace uhd; using namespace uhd::usrp; @@ -396,7 +397,7 @@ double dbsrx::set_lo_freq(double target_freq){ read_reg(0x0, 0x0); //allow for setup time before checking condition again - boost::this_thread::sleep(boost::posix_time::milliseconds(10)); + std::this_thread::sleep_for(std::chrono::milliseconds(10)); } UHD_LOGGER_TRACE("DBSRX") << boost::format( diff --git a/host/lib/usrp/dboard/db_tvrx2.cpp b/host/lib/usrp/dboard/db_tvrx2.cpp index 8bf2308d7..5f43c75e6 100644 --- a/host/lib/usrp/dboard/db_tvrx2.cpp +++ b/host/lib/usrp/dboard/db_tvrx2.cpp @@ -53,11 +53,12 @@ #include <uhd/usrp/dboard_manager.hpp> #include <boost/assign/list_of.hpp> #include <boost/format.hpp> -#include <boost/thread.hpp> #include <boost/array.hpp> #include <boost/math/special_functions/round.hpp> #include <utility> #include <cmath> +#include <chrono> +#include <thread> using namespace uhd; using namespace uhd::usrp; @@ -1695,7 +1696,7 @@ void tvrx2::wait_irq(void){ 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()]); irq = get_irq(); - boost::this_thread::sleep(boost::posix_time::milliseconds(10)); + std::this_thread::sleep_for(std::chrono::milliseconds(10)); timeout -= 1; } diff --git a/host/lib/usrp/dboard/db_ubx.cpp b/host/lib/usrp/dboard/db_ubx.cpp index 0e85cf188..6c6862fb7 100644 --- a/host/lib/usrp/dboard/db_ubx.cpp +++ b/host/lib/usrp/dboard/db_ubx.cpp @@ -23,10 +23,11 @@ #include <boost/assign/list_of.hpp> #include <boost/shared_ptr.hpp> #include <boost/math/special_functions/round.hpp> -#include <boost/thread.hpp> #include <boost/algorithm/string.hpp> #include <boost/thread/mutex.hpp> #include <map> +#include <chrono> +#include <thread> using namespace uhd; using namespace uhd::usrp; @@ -384,7 +385,7 @@ public: _iface->set_pin_ctrl(dboard_iface::UNIT_RX, _rx_gpio_reg.atr_mask); // bring CPLD out of reset - boost::this_thread::sleep(boost::posix_time::milliseconds(20)); // hold CPLD reset for minimum of 20 ms + std::this_thread::sleep_for(std::chrono::milliseconds(20)); // hold CPLD reset for minimum of 20 ms set_gpio_field(CPLD_RST_N, 1); write_gpio(); diff --git a/host/lib/usrp/dboard/db_xcvr2450.cpp b/host/lib/usrp/dboard/db_xcvr2450.cpp index 73e778b1b..9e1c9f2b0 100644 --- a/host/lib/usrp/dboard/db_xcvr2450.cpp +++ b/host/lib/usrp/dboard/db_xcvr2450.cpp @@ -50,9 +50,10 @@ #include <uhd/usrp/dboard_manager.hpp> #include <boost/assign/list_of.hpp> #include <boost/format.hpp> -#include <boost/thread.hpp> #include <boost/math/special_functions/round.hpp> #include <utility> +#include <chrono> +#include <thread> using namespace uhd; using namespace uhd::usrp; @@ -307,11 +308,11 @@ void xcvr2450::spi_reset(void){ //spi reset mode: global enable = off, tx and rx enable = on this->get_iface()->set_atr_reg(dboard_iface::UNIT_TX, gpio_atr::ATR_REG_IDLE, TX_ENB_TXIO); this->get_iface()->set_atr_reg(dboard_iface::UNIT_RX, gpio_atr::ATR_REG_IDLE, RX_ENB_RXIO | POWER_DOWN_RXIO); - boost::this_thread::sleep(boost::posix_time::milliseconds(10)); + std::this_thread::sleep_for(std::chrono::milliseconds(10)); //take it back out of spi reset mode and wait a bit this->get_iface()->set_atr_reg(dboard_iface::UNIT_RX, gpio_atr::ATR_REG_IDLE, RX_DIS_RXIO | POWER_UP_RXIO); - boost::this_thread::sleep(boost::posix_time::milliseconds(10)); + std::this_thread::sleep_for(std::chrono::milliseconds(10)); } /*********************************************************************** @@ -348,7 +349,7 @@ double xcvr2450::set_lo_freq(double target_freq){ double actual = 0.0; for (double offset = 0.0; offset <= 3e6; offset+=1e6){ actual = this->set_lo_freq_core(target_freq + offset); - boost::this_thread::sleep(boost::posix_time::milliseconds(50)); + std::this_thread::sleep_for(std::chrono::milliseconds(50)); if (this->get_locked().to_bool()) break; } return actual; diff --git a/host/lib/usrp/dboard/twinrx/twinrx_ctrl.cpp b/host/lib/usrp/dboard/twinrx/twinrx_ctrl.cpp index 3e8473087..d8233e1f7 100644 --- a/host/lib/usrp/dboard/twinrx/twinrx_ctrl.cpp +++ b/host/lib/usrp/dboard/twinrx/twinrx_ctrl.cpp @@ -10,7 +10,8 @@ #include <uhdlib/usrp/common/adf535x.hpp> #include <uhd/utils/math.hpp> #include <uhd/utils/safe_call.hpp> -#include <boost/thread/thread.hpp> +#include <chrono> +#include <thread> using namespace uhd; using namespace usrp; @@ -40,7 +41,7 @@ public: _gpio_iface->set_field(twinrx_gpio::FIELD_SWPS_EN, 1); size_t timeout_ms = 100; while (_gpio_iface->get_field(twinrx_gpio::FIELD_SWPS_PWR_GOOD) == 0) { - boost::this_thread::sleep(boost::posix_time::microsec(1000)); + std::this_thread::sleep_for(std::chrono::microseconds(1000)); if (--timeout_ms == 0) { throw uhd::runtime_error("power supply failure"); } diff --git a/host/lib/usrp/dboard_iface.cpp b/host/lib/usrp/dboard_iface.cpp index 55b3c19ba..3bda643fe 100644 --- a/host/lib/usrp/dboard_iface.cpp +++ b/host/lib/usrp/dboard_iface.cpp @@ -6,6 +6,8 @@ // #include <uhd/usrp/dboard_iface.hpp> +#include <chrono> +#include <thread> using namespace uhd::usrp; @@ -14,8 +16,8 @@ void dboard_iface::sleep(const boost::chrono::nanoseconds& time) //nanosleep is not really accurate in userland and it is also not very //cross-platform. So just sleep for the minimum amount of time in us. if (time < boost::chrono::microseconds(1)) { - boost::this_thread::sleep_for(boost::chrono::microseconds(1)); + std::this_thread::sleep_for(std::chrono::microseconds(1)); } else { - boost::this_thread::sleep_for(time); + std::this_thread::sleep_for(std::chrono::microseconds(time.count())); } } diff --git a/host/lib/usrp/e300/e300_fifo_config.cpp b/host/lib/usrp/e300/e300_fifo_config.cpp index 044ce01ee..2c0027ae0 100644 --- a/host/lib/usrp/e300/e300_fifo_config.cpp +++ b/host/lib/usrp/e300/e300_fifo_config.cpp @@ -11,6 +11,8 @@ #include <uhd/config.hpp> #include <stdint.h> #include <atomic> +#include <chrono> +#include <thread> // constants coded into the fpga parameters static const size_t ZF_CONFIG_BASE = 0x40000000; @@ -256,7 +258,7 @@ public: break; } _waiter->wait(timeout); - //boost::this_thread::sleep(boost::posix_time::milliseconds(1)); + //std::this_thread::sleep_for(std::chrono::milliseconds(1)); } return typename T::sptr(); diff --git a/host/lib/usrp/e300/e300_i2c.cpp b/host/lib/usrp/e300/e300_i2c.cpp index c3db4f67a..24fd429b5 100644 --- a/host/lib/usrp/e300/e300_i2c.cpp +++ b/host/lib/usrp/e300/e300_i2c.cpp @@ -5,13 +5,14 @@ // SPDX-License-Identifier: GPL-3.0-or-later // +#include "e300_i2c.hpp" #include <uhd/exception.hpp> #include <uhd/utils/byteswap.hpp> #include <uhd/transport/udp_simple.hpp> - -#include "e300_i2c.hpp" #include <cstring> +#include <chrono> +#include <thread> namespace uhd { namespace usrp { namespace e300 { @@ -281,7 +282,7 @@ public: throw std::runtime_error("ioctl failed"); } // this is ugly - boost::this_thread::sleep(boost::posix_time::milliseconds(5)); + std::this_thread::sleep_for(std::chrono::milliseconds(5)); } uint8_t get_i2c_reg8( @@ -339,7 +340,7 @@ public: throw std::runtime_error("ioctl failed"); } // this is ugly - boost::this_thread::sleep(boost::posix_time::milliseconds(5)); + std::this_thread::sleep_for(std::chrono::milliseconds(5)); } diff --git a/host/lib/usrp/e300/e300_impl.cpp b/host/lib/usrp/e300/e300_impl.cpp index 324b25407..9aa872ff3 100644 --- a/host/lib/usrp/e300/e300_impl.cpp +++ b/host/lib/usrp/e300/e300_impl.cpp @@ -32,9 +32,10 @@ #include <boost/bind.hpp> #include <boost/make_shared.hpp> #include <boost/assign/list_of.hpp> -#include <boost/thread/thread.hpp> //sleep #include <boost/asio.hpp> #include <fstream> +#include <chrono> +#include <thread> using namespace uhd; using namespace uhd::usrp; @@ -395,7 +396,7 @@ e300_impl::e300_impl(const uhd::device_addr_t &device_addr) ad9361_params::sptr client_settings = boost::make_shared<e300_ad9361_client_t>(); _codec_ctrl = ad9361_ctrl::make_spi(client_settings, spi::make(E300_SPIDEV_DEVICE), 1); // This is horrible ... why do I have to sleep here? - boost::this_thread::sleep(boost::posix_time::milliseconds(100)); + std::this_thread::sleep_for(std::chrono::milliseconds(100)); _eeprom_manager = boost::make_shared<e300_eeprom_manager>(i2c::make_i2cdev(E300_I2CDEV_DEVICE)); _sensor_manager = e300_sensor_manager::make_local(_global_regs); } @@ -415,7 +416,7 @@ e300_impl::e300_impl(const uhd::device_addr_t &device_addr) if (_gps) { for (size_t i = 0; i < _GPS_TIMEOUT; i++) { - boost::this_thread::sleep(boost::posix_time::seconds(1)); + std::this_thread::sleep_for(std::chrono::seconds(1)); if (!_gps->gps_detected()) std::cout << "." << std::flush; else { @@ -1141,7 +1142,7 @@ void e300_impl::_reset_codec_mmcm(void) { _misc.codec_arst = 1; _update_gpio_state(); - boost::this_thread::sleep(boost::posix_time::milliseconds(10)); + std::this_thread::sleep_for(std::chrono::milliseconds(10)); _misc.codec_arst = 0; _update_gpio_state(); } diff --git a/host/lib/usrp/e300/e300_network.cpp b/host/lib/usrp/e300/e300_network.cpp index d7473d2ee..d9a104dda 100644 --- a/host/lib/usrp/e300/e300_network.cpp +++ b/host/lib/usrp/e300/e300_network.cpp @@ -26,11 +26,12 @@ #include <uhdlib/usrp/common/ad9361_ctrl.hpp> #include <boost/asio.hpp> -#include <boost/thread.hpp> #include <boost/filesystem.hpp> #include <boost/make_shared.hpp> #include <fstream> +#include <chrono> +#include <thread> using namespace uhd; using namespace uhd::transport; @@ -630,7 +631,7 @@ network_server_impl::network_server_impl(const uhd::device_addr_t &device_addr) ad9361_params::sptr client_settings = boost::make_shared<e300_ad9361_client_t>(); _codec_ctrl = ad9361_ctrl::make_spi(client_settings, spi::make(E300_SPIDEV_DEVICE), 1); // This is horrible ... why do I have to sleep here? - boost::this_thread::sleep(boost::posix_time::milliseconds(100)); + std::this_thread::sleep_for(std::chrono::milliseconds(100)); _sensor_manager = e300_sensor_manager::make_local(_global_regs); } diff --git a/host/lib/usrp/gps_ctrl.cpp b/host/lib/usrp/gps_ctrl.cpp index a50261851..f030108cc 100644 --- a/host/lib/usrp/gps_ctrl.cpp +++ b/host/lib/usrp/gps_ctrl.cpp @@ -28,7 +28,6 @@ using namespace uhd; using namespace boost::posix_time; using namespace boost::algorithm; -using namespace boost::this_thread; namespace { constexpr int GPS_COMM_TIMEOUT_MS = 1300; diff --git a/host/lib/usrp/multi_usrp.cpp b/host/lib/usrp/multi_usrp.cpp index f9509b7f3..6c758e07e 100644 --- a/host/lib/usrp/multi_usrp.cpp +++ b/host/lib/usrp/multi_usrp.cpp @@ -20,12 +20,13 @@ #include <uhdlib/usrp/gpio_defs.hpp> #include <uhdlib/rfnoc/legacy_compat.hpp> #include <boost/assign/list_of.hpp> -#include <boost/thread.hpp> #include <boost/format.hpp> #include <boost/algorithm/string.hpp> #include <algorithm> #include <cmath> #include <bitset> +#include <chrono> +#include <thread> using namespace uhd; using namespace uhd::usrp; @@ -579,12 +580,12 @@ public: "See the application notes for your device.\n" ); } - boost::this_thread::sleep(boost::posix_time::milliseconds(1)); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); } UHD_LOGGER_INFO("MULTI_USRP") << " 2) set times next pps (synchronously)"; set_time_next_pps(time_spec, ALL_MBOARDS); - boost::this_thread::sleep(boost::posix_time::seconds(1)); + std::this_thread::sleep_for(std::chrono::seconds(1)); //verify that the time registers are read to be within a few RTT for (size_t m = 1; m < get_num_mboards(); m++){ diff --git a/host/lib/usrp/n230/n230_impl.cpp b/host/lib/usrp/n230/n230_impl.cpp index c4e3af0b2..0595ee29d 100644 --- a/host/lib/usrp/n230/n230_impl.cpp +++ b/host/lib/usrp/n230/n230_impl.cpp @@ -37,6 +37,9 @@ #include <boost/asio.hpp> //used for htonl and ntohl #include <boost/make_shared.hpp> +#include <chrono> +#include <thread> + namespace uhd { namespace usrp { namespace n230 { using namespace uhd::transport; @@ -131,7 +134,7 @@ uhd::device_addrs_t n230_impl::n230_find(const uhd::device_addr_t &multi_dev_hin fw_ctrl = n230_fw_ctrl_iface::make(ctrl_xport, N230_FW_PRODUCT_ID, false /*verbose*/); break; } catch (uhd::io_error& ex) { - boost::this_thread::sleep(boost::posix_time::milliseconds(500)); + std::this_thread::sleep_for(std::chrono::milliseconds(500)); first_conn_retries--; } } diff --git a/host/lib/usrp/n230/n230_resource_manager.cpp b/host/lib/usrp/n230/n230_resource_manager.cpp index e9f8b5c7d..7a68816a3 100644 --- a/host/lib/usrp/n230/n230_resource_manager.cpp +++ b/host/lib/usrp/n230/n230_resource_manager.cpp @@ -15,11 +15,12 @@ #include <uhd/utils/platform.hpp> #include <uhd/utils/paths.hpp> #include <boost/format.hpp> -#include <boost/thread.hpp> #include <boost/functional/hash.hpp> #include <boost/make_shared.hpp> #include "n230_fw_defs.h" #include "n230_fw_host_iface.h" +#include <chrono> +#include <thread> #define IF_DATA_I_MASK 0xFFF00000 #define IF_DATA_Q_MASK 0x0000FFF0 @@ -206,7 +207,7 @@ n230_resource_manager::n230_resource_manager( _gps_uart = n230_uart::make(gps_uart_xport, uhd::htonx(gps_uart_sid.get())); _gps_uart->set_baud_divider(fpga::BUS_CLK_RATE/fpga::GPSDO_UART_BAUDRATE); _gps_uart->write_uart("\n"); //cause the baud and response to be setup - boost::this_thread::sleep(boost::posix_time::seconds(1)); //allow for a little propagation + std::this_thread::sleep_for(std::chrono::seconds(1)); //allow for a little propagation _gps_ctrl = gps_ctrl::make(_gps_uart); } catch(std::exception &e) { UHD_LOGGER_ERROR("N230") << "An error occurred making GPSDO control: " << e.what() ; @@ -283,7 +284,7 @@ void n230_resource_manager::_claimer_loop() _fw_ctrl->poke32(N230_FW_HOST_SHMEM_OFFSET(claim_time), time(NULL)); _fw_ctrl->poke32(N230_FW_HOST_SHMEM_OFFSET(claim_src), get_process_hash()); } - boost::this_thread::sleep(boost::posix_time::milliseconds(N230_CLAIMER_TIMEOUT_IN_MS / 2)); + std::this_thread::sleep_for(std::chrono::milliseconds(N230_CLAIMER_TIMEOUT_IN_MS / 2)); } void n230_resource_manager::_initialize_radio(size_t instance) @@ -444,7 +445,7 @@ void n230_resource_manager::_reset_codec_digital_interface() _core_ctrl->poke32(fpga::sr_addr(fpga::SR_CORE_CLK_DELAY), fpga::CODEC_CLK_DELAY); _core_radio_ctrl_reg.write(fpga::core_radio_ctrl_reg_t::CODEC_ARST, 1); - boost::this_thread::sleep(boost::posix_time::milliseconds(10)); + std::this_thread::sleep_for(std::chrono::milliseconds(10)); _core_radio_ctrl_reg.write(fpga::core_radio_ctrl_reg_t::CODEC_ARST, 0); } @@ -470,7 +471,7 @@ bool n230_resource_manager::_radio_data_loopback_self_test(wb_iface::sptr iface) const uint32_t word32 = uint32_t(hash) & (IF_DATA_I_MASK | IF_DATA_Q_MASK); iface->poke32(fpga::sr_addr(fpga::SR_RADIO_CODEC_IDLE), word32); iface->peek64(fpga::rb_addr(fpga::RB_RADIO_CODEC_DATA)); //block until request completes - boost::this_thread::sleep(boost::posix_time::microseconds(100)); //wait for loopback to propagate through codec + std::this_thread::sleep_for(std::chrono::microseconds(100)); //wait for loopback to propagate through codec const uint64_t rb_word64 = iface->peek64(fpga::rb_addr(fpga::RB_RADIO_CODEC_DATA)); const uint32_t rb_tx = uint32_t(rb_word64 >> 32); const uint32_t rb_rx = uint32_t(rb_word64 & 0xffffffff); diff --git a/host/lib/usrp/usrp1/io_impl.cpp b/host/lib/usrp/usrp1/io_impl.cpp index 0e79a5985..3ccfa11c9 100644 --- a/host/lib/usrp/usrp1/io_impl.cpp +++ b/host/lib/usrp/usrp1/io_impl.cpp @@ -23,6 +23,8 @@ #include <boost/format.hpp> #include <boost/make_shared.hpp> #include <atomic> +#include <chrono> +#include <thread> #define bmFR_RX_FORMAT_SHIFT_SHIFT 0 #define bmFR_RX_FORMAT_WIDTH_SHIFT 4 @@ -307,7 +309,7 @@ void usrp1_impl::vandal_conquest_loop(std::atomic<bool> &exit_loop){ UHD_LOG_FASTPATH("O") } - boost::this_thread::sleep(boost::posix_time::milliseconds(50)); + std::this_thread::sleep_for(std::chrono::milliseconds(50)); }} catch(const std::exception &e){ UHD_LOGGER_ERROR("USRP1") << "The vandal caught an unexpected exception " << e.what() ; diff --git a/host/lib/usrp/usrp2/io_impl.cpp b/host/lib/usrp/usrp2/io_impl.cpp index 2b8c7a5d1..7042f0391 100644 --- a/host/lib/usrp/usrp2/io_impl.cpp +++ b/host/lib/usrp/usrp2/io_impl.cpp @@ -26,6 +26,8 @@ #include <boost/thread/mutex.hpp> #include <boost/make_shared.hpp> #include <iostream> +#include <chrono> +#include <thread> using namespace uhd; using namespace uhd::usrp; @@ -384,7 +386,7 @@ void usrp2_impl::program_stream_dest( std::memcpy(send_buff->cast<void *>(), &stream_ctrl, sizeof(stream_ctrl)); send_buff->commit(sizeof(stream_ctrl)); send_buff.reset(); - boost::this_thread::sleep(boost::posix_time::milliseconds(300)); + std::this_thread::sleep_for(std::chrono::milliseconds(300)); managed_recv_buffer::sptr recv_buff = xport->get_recv_buff(0.0); if (recv_buff and recv_buff->size() >= sizeof(uint32_t)){ const uint32_t result = uhd::ntohx(recv_buff->cast<const uint32_t *>()[0]); diff --git a/host/lib/usrp/usrp2/usrp2_iface.cpp b/host/lib/usrp/usrp2/usrp2_iface.cpp index a3d1bc390..c8283c500 100644 --- a/host/lib/usrp/usrp2/usrp2_iface.cpp +++ b/host/lib/usrp/usrp2/usrp2_iface.cpp @@ -16,7 +16,6 @@ #include <uhd/utils/paths.hpp> #include <uhd/utils/safe_call.hpp> #include <uhd/types/dict.hpp> -#include <boost/thread.hpp> #include <boost/asio.hpp> //used for htonl and ntohl #include <boost/assign/list_of.hpp> #include <boost/format.hpp> @@ -26,6 +25,8 @@ #include <boost/filesystem.hpp> #include <algorithm> #include <iostream> +#include <chrono> +#include <thread> #include <uhd/utils/platform.hpp> using namespace uhd; @@ -118,7 +119,7 @@ public: //re-lock in task this->pokefw(U2_FW_REG_LOCK_TIME, this->get_curr_time()); //sleep for a bit - boost::this_thread::sleep(boost::posix_time::milliseconds(1500)); + std::this_thread::sleep_for(std::chrono::milliseconds(1500)); } uint32_t get_curr_time(void){ diff --git a/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp b/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp index 6208de231..cf1d9d7c2 100644 --- a/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp +++ b/host/lib/usrp/x300/x300_radio_ctrl_impl.cpp @@ -928,7 +928,7 @@ void x300_radio_ctrl_impl::synchronize_dacs(const std::vector<x300_radio_ctrl_im } //Wait and check status - boost::this_thread::sleep(boost::posix_time::microseconds(t_sync_us)); + std::this_thread::sleep_for(std::chrono::microseconds(t_sync_us)); for (size_t i = 0; i < radios.size(); i++) { radios[i]->_dac->verify_sync(); } diff --git a/host/lib/usrp_clock/octoclock/octoclock_image_loader.cpp b/host/lib/usrp_clock/octoclock/octoclock_image_loader.cpp index 594d10df6..e030e6106 100644 --- a/host/lib/usrp_clock/octoclock/octoclock_image_loader.cpp +++ b/host/lib/usrp_clock/octoclock/octoclock_image_loader.cpp @@ -20,7 +20,6 @@ #include <boost/filesystem.hpp> #include <boost/format.hpp> -#include <boost/thread.hpp> #include <algorithm> #include <iterator> @@ -29,6 +28,8 @@ #include <fstream> #include <iostream> #include <string> +#include <chrono> +#include <thread> #include <stdint.h> namespace fs = boost::filesystem; @@ -194,7 +195,7 @@ static void octoclock_reset_into_bootloader(octoclock_session_t &session){ if(UHD_OCTOCLOCK_PACKET_MATCHES(RESET_ACK, pkt_out, pkt_in, len)){ // Make sure this device is now in its bootloader - boost::this_thread::sleep(boost::posix_time::milliseconds(500)); + std::this_thread::sleep_for(std::chrono::milliseconds(500)); uhd::device_addrs_t octoclocks = uhd::device::find( uhd::device_addr_t(str(boost::format("addr=%s") % session.dev_addr["addr"] diff --git a/host/lib/usrp_clock/octoclock/octoclock_uart.cpp b/host/lib/usrp_clock/octoclock/octoclock_uart.cpp index 490814c40..74d324645 100644 --- a/host/lib/usrp_clock/octoclock/octoclock_uart.cpp +++ b/host/lib/usrp_clock/octoclock/octoclock_uart.cpp @@ -7,11 +7,13 @@ #include <iostream> #include <string> +#include <chrono> +#include <thread> #include <string.h> +#include <stdint.h> #include <boost/algorithm/string.hpp> #include <boost/asio.hpp> -#include <stdint.h> #include <boost/format.hpp> #include <boost/thread/thread.hpp> @@ -95,7 +97,7 @@ namespace uhd{ { break; } - boost::this_thread::sleep(boost::posix_time::milliseconds(1)); + std::this_thread::sleep_for(std::chrono::milliseconds(1)); } return result; |