diff options
author | Josh Blum <josh@joshknows.com> | 2010-03-02 14:48:11 -0800 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2010-03-02 14:48:11 -0800 |
commit | 13bd67b4949a91df5e6696e708c935266b14c502 (patch) | |
tree | 40c9ebfd46636307c4537980b7ee116556e7ca17 /host/lib/usrp/usrp2/io_impl.cpp | |
parent | 451067295399e357d73c9bfdeef5f2ad040e0243 (diff) | |
download | uhd-13bd67b4949a91df5e6696e708c935266b14c502.tar.gz uhd-13bd67b4949a91df5e6696e708c935266b14c502.tar.bz2 uhd-13bd67b4949a91df5e6696e708c935266b14c502.zip |
The net common is too slow in usrp2 firmware to figure out if its vrt data.
Added a custom function to tell if a packet is vrt data, seems to be feeding fast enough at this rate...
Fixed some buffer size calculation logic.
Diffstat (limited to 'host/lib/usrp/usrp2/io_impl.cpp')
-rw-r--r-- | host/lib/usrp/usrp2/io_impl.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/host/lib/usrp/usrp2/io_impl.cpp b/host/lib/usrp/usrp2/io_impl.cpp index 8b45a708a..0ca2409c3 100644 --- a/host/lib/usrp/usrp2/io_impl.cpp +++ b/host/lib/usrp/usrp2/io_impl.cpp @@ -127,12 +127,11 @@ size_t usrp2_impl::send_raw( } vrt_hdr_flags |= (metadata.start_of_burst)? (0x1 << 25) : 0; vrt_hdr_flags |= (metadata.end_of_burst)? (0x1 << 24) : 0; - num_vrt_hdr_words += asio::buffer_size(buff)/sizeof(uint32_t); //fill in complete header word vrt_hdr[0] = htonl(vrt_hdr_flags | ((_tx_stream_id_to_packet_seq[metadata.stream_id]++ & 0xf) << 16) | - (num_vrt_hdr_words & 0xffff) + ((num_vrt_hdr_words + asio::buffer_size(buff)/sizeof(uint32_t)) & 0xffff) ); //load the buffer vector @@ -151,6 +150,8 @@ size_t usrp2_impl::recv_raw( const boost::asio::mutable_buffer &buff, uhd::metadata_t &metadata ){ + metadata = metadata_t(); //clear metadata + //handle the case where there is spillover if (asio::buffer_size(_splillover_buff) != 0){ size_t bytes_to_copy = std::min( @@ -198,9 +199,9 @@ size_t usrp2_impl::recv_raw( _rx_stream_id_to_packet_seq[metadata.stream_id] = my_seq; //extract the number of bytes received - size_t num_words = (vrt_header & 0xffff); - num_words -= USRP2_HOST_RX_VRT_HEADER_WORDS32; - num_words -= USRP2_HOST_RX_VRT_TRAILER_WORDS32; + size_t num_words = (vrt_header & 0xffff) - + USRP2_HOST_RX_VRT_HEADER_WORDS32 - + USRP2_HOST_RX_VRT_TRAILER_WORDS32; size_t num_bytes = num_words*sizeof(uint32_t); //handle the case where spillover memory was used |