diff options
| author | Martin Braun <martin.braun@ettus.com> | 2017-10-18 13:16:43 -0700 | 
|---|---|---|
| committer | Martin Braun <martin.braun@ettus.com> | 2017-12-22 15:04:02 -0800 | 
| commit | 219b04e99dceb075a91655ddc4d16d06a968db77 (patch) | |
| tree | a1878910146737b2e81eb1eee82d1a25437b773f /mpm | |
| parent | 5eb49364cea736d358ca005035ba50e772fae9fd (diff) | |
| download | uhd-219b04e99dceb075a91655ddc4d16d06a968db77.tar.gz uhd-219b04e99dceb075a91655ddc4d16d06a968db77.tar.bz2 uhd-219b04e99dceb075a91655ddc4d16d06a968db77.zip | |
mpm: tdc_sync: Remove sleeps in offset polling
On the N310, there's a penalty for calling time.sleep(). This means the
polling loop was extremely slow for polling TDC updates. Now, it simply
polls as fast as possible. Note: This could hog the bus if run outside
of an initialization sequence, where no one else is using the bus.
Diffstat (limited to 'mpm')
| -rw-r--r-- | mpm/python/usrp_mpm/cores/tdc_sync.py | 14 | 
1 files changed, 7 insertions, 7 deletions
| diff --git a/mpm/python/usrp_mpm/cores/tdc_sync.py b/mpm/python/usrp_mpm/cores/tdc_sync.py index ccedfcdcc..01724852d 100644 --- a/mpm/python/usrp_mpm/cores/tdc_sync.py +++ b/mpm/python/usrp_mpm/cores/tdc_sync.py @@ -260,15 +260,15 @@ class ClockSynchronizer(object):          Return the offset (in seconds) the whatever what measured and whatever          the reference is.          """ -        for _ in range(1000): # TODO replace with poll & timeout +        timeout = time.time() + 1.0 +        while True:              rtc_offset_msb = self.peek32(self.RTC_OFFSET_1) -            updated = (rtc_offset_msb & 0x100) == 0x100 -            if updated: +            if rtc_offset_msb & 0x100 == 0x100:                  break -            time.sleep(0.001) -        if not updated: -            self.log.error("Offsets failed to update within timeout.") -            raise RuntimeError("Offsets failed to update within timeout.") +            if time.time() > timeout: +                error_msg = "Offsets failed to update within timeout." +                self.log.error(error_msg) +                raise RuntimeError(error_msg)          rtc_offset = (rtc_offset_msb & 0xFF) << 32          rtc_offset = float(rtc_offset | self.peek32(self.RTC_OFFSET_0)) / (1<<27) | 
