diff options
author | kurtis.heimerl <kurtis.heimerl@19bc5d8c-e614-43d4-8b26-e1612bc8e597> | 2011-11-26 03:18:02 +0000 |
---|---|---|
committer | kurtis.heimerl <kurtis.heimerl@19bc5d8c-e614-43d4-8b26-e1612bc8e597> | 2011-11-26 03:18:02 +0000 |
commit | 495d3c8b0cf598ea31f941d1465ba371f73358f8 (patch) | |
tree | 6c41136ea365287f7bffed6162ef005f02833cc3 | |
parent | b9e237e83ed1df2bbf2bd4f2d319d72fdabb7a02 (diff) |
uhd: flush receive buffer should return true on timeout
Receive buffer flush should continue to read until
either the desired number of packets has been read or
timeout, which means that the buffer has been emptied.
These are expected behaviours and should return true.
Ignore errors at this stage as the data and associated
metadata can be considered garbage and not worth
reporting. Actual error conditions will be caught
further downstream when useful data comes in.
Signed-off-by: Thomas Tsou <ttsou@vt.edu>
git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2659 19bc5d8c-e614-43d4-8b26-e1612bc8e597
-rw-r--r-- | Transceiver52M/UHDDevice.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/Transceiver52M/UHDDevice.cpp b/Transceiver52M/UHDDevice.cpp index 3d731a3..88e9814 100644 --- a/Transceiver52M/UHDDevice.cpp +++ b/Transceiver52M/UHDDevice.cpp @@ -378,7 +378,7 @@ bool uhd_device::open() bool uhd_device::flush_recv(size_t num_pkts) { - uhd::rx_metadata_t metadata; + uhd::rx_metadata_t md; size_t num_smpls; uint32_t buff[rx_spp]; float timeout; @@ -390,13 +390,19 @@ bool uhd_device::flush_recv(size_t num_pkts) num_smpls = usrp_dev->get_device()->recv( buff, rx_spp, - metadata, + md, uhd::io_type_t::COMPLEX_INT16, uhd::device::RECV_MODE_ONE_PACKET, timeout); - if (!num_smpls) - return false; + if (!num_smpls) { + switch (md.error_code) { + case uhd::rx_metadata_t::ERROR_CODE_TIMEOUT: + return true; + default: + continue; + } + } } return true; |