summaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-07-10 06:25:22 +0000
committerJosh Blum <josh@joshknows.com>2010-07-10 06:25:22 +0000
commit3a3aefd68f054e3fccff31173be2a878841b29aa (patch)
tree19f26c10881942ff41f8eaadfc59e0dfac68280a /host
parentead865c28690deb1566ce6a20f54cfb43484ad01 (diff)
parent5e7af879c890c1168ba957ca9158428eeb387c94 (diff)
downloaduhd-3a3aefd68f054e3fccff31173be2a878841b29aa.tar.gz
uhd-3a3aefd68f054e3fccff31173be2a878841b29aa.tar.bz2
uhd-3a3aefd68f054e3fccff31173be2a878841b29aa.zip
Merge branch 'error_handling' of ettus.sourcerepo.com:ettus/uhdpriv into usrp_e
Diffstat (limited to 'host')
-rw-r--r--host/lib/transport/vrt_packet_handler.hpp10
-rw-r--r--host/lib/usrp/usrp2/io_impl.cpp14
2 files changed, 9 insertions, 15 deletions
diff --git a/host/lib/transport/vrt_packet_handler.hpp b/host/lib/transport/vrt_packet_handler.hpp
index 702d3bfb9..c5c63b089 100644
--- a/host/lib/transport/vrt_packet_handler.hpp
+++ b/host/lib/transport/vrt_packet_handler.hpp
@@ -48,9 +48,6 @@ namespace vrt_packet_handler{
//width of the receiver in channels
size_t width;
- //init the expected seq number
- std::vector<size_t> next_packet_seq;
-
//state variables to handle fragments
managed_recv_buffs_t managed_buffs;
std::vector<const boost::uint8_t *> copy_buffs;
@@ -59,7 +56,6 @@ namespace vrt_packet_handler{
recv_state(size_t width = 1):
width(width),
- next_packet_seq(width, 0),
managed_buffs(width),
copy_buffs(width, NULL),
size_of_copy_buffs(0),
@@ -98,12 +94,6 @@ namespace vrt_packet_handler{
vrt_unpacker(vrt_hdr, if_packet_info);
const boost::uint32_t *vrt_data = vrt_hdr + if_packet_info.num_header_words32;
- //handle the packet count / sequence number
- if (if_packet_info.packet_count != state.next_packet_seq[i]){
- std::cerr << "S" << (if_packet_info.packet_count - state.next_packet_seq[i])%16;
- }
- state.next_packet_seq[i] = (if_packet_info.packet_count+1)%16;
-
//handle the non-data packet case and parse its contents
if (if_packet_info.packet_type != uhd::transport::vrt::if_packet_info_t::PACKET_TYPE_DATA){
diff --git a/host/lib/usrp/usrp2/io_impl.cpp b/host/lib/usrp/usrp2/io_impl.cpp
index 7e231095f..430f28390 100644
--- a/host/lib/usrp/usrp2/io_impl.cpp
+++ b/host/lib/usrp/usrp2/io_impl.cpp
@@ -83,6 +83,8 @@ void usrp2_impl::io_impl::recv_pirate_loop(
){
set_thread_priority_safe();
recv_pirate_crew_raiding = true;
+ size_t next_packet_seq = 0;
+
while(recv_pirate_crew_raiding){
managed_recv_buffer::sptr buff = zc_if->get_recv_buff();
if (not buff.get()) continue; //ignore timeout/error buffers
@@ -93,13 +95,15 @@ void usrp2_impl::io_impl::recv_pirate_loop(
if_packet_info.num_packet_words32 = buff->size()/sizeof(boost::uint32_t);
vrt::if_hdr_unpack_be(buff->cast<const boost::uint32_t *>(), if_packet_info);
+ //handle the packet count / sequence number
+ if (if_packet_info.packet_count != next_packet_seq){
+ //std::cerr << "S" << (if_packet_info.packet_count - next_packet_seq)%16;
+ std::cerr << "O"; //report overrun (drops in the kernel)
+ }
+ next_packet_seq = (if_packet_info.packet_count+1)%16;
+
//extract the timespec and round to the nearest packet
UHD_ASSERT_THROW(if_packet_info.has_tsi and if_packet_info.has_tsf);
-
- //size_t pkt_dur_ticks = mboard->get_master_clock_freq() * 1; //TODO FIXME
- //size_t(if_packet_info.tsf) - size_t(if_packet_info.tsf)%pkt_dur_ticks
- //the idea is to round the time specs to packet boundaries to avoid the issue
- //of never getting alignment when things are not locked properly
time_spec_t time(
time_t(if_packet_info.tsi), size_t(if_packet_info.tsf), mboard->get_master_clock_freq()
);