laforge
/
openbts-osmo
Archived
1
0
Fork 0

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>
This commit is contained in:
Thomas Tsou 2011-06-09 11:50:39 -07:00
parent d186353546
commit 96710c8077
2 changed files with 20 additions and 8 deletions

View File

@ -378,7 +378,7 @@ bool uhd_device::open()
bool uhd_device::flush_recv(size_t num_pkts) bool uhd_device::flush_recv(size_t num_pkts)
{ {
uhd::rx_metadata_t metadata; uhd::rx_metadata_t md;
size_t num_smpls; size_t num_smpls;
uint32_t buff[rx_spp]; uint32_t buff[rx_spp];
float timeout; float timeout;
@ -390,13 +390,19 @@ bool uhd_device::flush_recv(size_t num_pkts)
num_smpls = usrp_dev->get_device()->recv( num_smpls = usrp_dev->get_device()->recv(
buff, buff,
rx_spp, rx_spp,
metadata, md,
uhd::io_type_t::COMPLEX_INT16, uhd::io_type_t::COMPLEX_INT16,
uhd::device::RECV_MODE_ONE_PACKET, uhd::device::RECV_MODE_ONE_PACKET,
timeout); timeout);
if (!num_smpls) if (!num_smpls) {
return false; switch (md.error_code) {
case uhd::rx_metadata_t::ERROR_CODE_TIMEOUT:
return true;
default:
continue;
}
}
} }
return true; return true;

View File

@ -378,7 +378,7 @@ bool uhd_device::open()
bool uhd_device::flush_recv(size_t num_pkts) bool uhd_device::flush_recv(size_t num_pkts)
{ {
uhd::rx_metadata_t metadata; uhd::rx_metadata_t md;
size_t num_smpls; size_t num_smpls;
uint32_t buff[rx_spp]; uint32_t buff[rx_spp];
float timeout; float timeout;
@ -390,13 +390,19 @@ bool uhd_device::flush_recv(size_t num_pkts)
num_smpls = usrp_dev->get_device()->recv( num_smpls = usrp_dev->get_device()->recv(
buff, buff,
rx_spp, rx_spp,
metadata, md,
uhd::io_type_t::COMPLEX_INT16, uhd::io_type_t::COMPLEX_INT16,
uhd::device::RECV_MODE_ONE_PACKET, uhd::device::RECV_MODE_ONE_PACKET,
timeout); timeout);
if (!num_smpls) if (!num_smpls) {
return false; switch (md.error_code) {
case uhd::rx_metadata_t::ERROR_CODE_TIMEOUT:
return true;
default:
continue;
}
}
} }
return true; return true;