From 63253ed7b2399b67d99878c7becc3926dfe17177 Mon Sep 17 00:00:00 2001 From: Kevin Gilbert Date: Thu, 4 Aug 2016 12:02:10 -0700 Subject: Add sleep function to dboard_iface Having this function allows a dboard_iface implementation to be aware of the timing of various calls such as SPI and register writes. --- host/lib/usrp/dboard/twinrx/twinrx_io.hpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'host/lib/usrp/dboard/twinrx/twinrx_io.hpp') diff --git a/host/lib/usrp/dboard/twinrx/twinrx_io.hpp b/host/lib/usrp/dboard/twinrx/twinrx_io.hpp index 8b504b549..5d099e361 100644 --- a/host/lib/usrp/dboard/twinrx/twinrx_io.hpp +++ b/host/lib/usrp/dboard/twinrx/twinrx_io.hpp @@ -108,10 +108,9 @@ public: _db_iface->set_gpio_out(dboard_iface::UNIT_BOTH, (cpld::get_reg(addr) << shift(CPLD_FULL_ADDR)) | (data << shift(CPLD_DATA)), mask(CPLD_FULL_ADDR)|mask(CPLD_DATA)); - //Sleep for 166ns to ensure that we don't toggle the enables to quickly - //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. - boost::this_thread::sleep(boost::posix_time::microseconds(0)); + //Sleep for 166ns to ensure that we don't toggle the enables too quickly + //The underlying sleep function rounds to microsecond precision. + _db_iface->sleep(boost::chrono::nanoseconds(166)); //Step 2: Write the reg offset and data, and assert the necessary enable _db_iface->set_gpio_out(dboard_iface::UNIT_BOTH, (static_cast(addr) << shift(CPLD_FULL_ADDR)) | (data << shift(CPLD_DATA)), -- cgit v1.2.3