From 83bd55d63972804e62f3890a4a90c8288fcbad0c Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sat, 3 Apr 2010 19:43:20 -0700 Subject: extended stream cmd with mode enum, and extended fragment flags in metadata --- host/lib/usrp/usrp2/io_impl.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'host/lib/usrp/usrp2/io_impl.cpp') diff --git a/host/lib/usrp/usrp2/io_impl.cpp b/host/lib/usrp/usrp2/io_impl.cpp index c87884ebb..5820841d7 100644 --- a/host/lib/usrp/usrp2/io_impl.cpp +++ b/host/lib/usrp/usrp2/io_impl.cpp @@ -222,12 +222,12 @@ size_t usrp2_impl::recv( ){ //perform a receive if no rx data is waiting to be copied if (asio::buffer_size(_rx_copy_buff) == 0){ + _fragment_offset_in_samps = 0; recv_raw(metadata); } //otherwise flag the metadata to show that is is a fragment else{ metadata = rx_metadata_t(); - metadata.is_fragment = true; } //extract the number of samples available to copy @@ -240,6 +240,11 @@ size_t usrp2_impl::recv( ); const boost::uint32_t *items = asio::buffer_cast(_rx_copy_buff); + //setup the fragment flags and offset + metadata.more_fragments = asio::buffer_size(buff)/io_type.size < num_samps; + metadata.fragment_offset = _fragment_offset_in_samps; + _fragment_offset_in_samps += num_samps; //set for next time + //copy the samples from the recv buffer switch(io_type.tid){ case io_type_t::COMPLEX_FLOAT32: -- cgit v1.2.3 From 8740bc7149717673c4580767142ce2563035d4cb Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 5 Apr 2010 18:32:33 -0700 Subject: handle tx fragment eob flag case --- host/include/uhd/device.hpp | 1 + host/lib/usrp/usrp2/io_impl.cpp | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'host/lib/usrp/usrp2/io_impl.cpp') diff --git a/host/include/uhd/device.hpp b/host/include/uhd/device.hpp index bf7e0753d..ae75e6dc8 100644 --- a/host/include/uhd/device.hpp +++ b/host/include/uhd/device.hpp @@ -83,6 +83,7 @@ public: * If the buffer has more samples than the maximum supported, * the send method will send the maximum number of samples * as supported by the transport and return the number sent. + * In this case, the end of burst flag will be forced to false. * It is up to the caller to call send again on the un-sent * portions of the buffer, until the buffer is exhausted. * diff --git a/host/lib/usrp/usrp2/io_impl.cpp b/host/lib/usrp/usrp2/io_impl.cpp index 5820841d7..a58e32619 100644 --- a/host/lib/usrp/usrp2/io_impl.cpp +++ b/host/lib/usrp/usrp2/io_impl.cpp @@ -171,15 +171,21 @@ void usrp2_impl::recv_raw(rx_metadata_t &metadata){ **********************************************************************/ size_t usrp2_impl::send( const asio::const_buffer &buff, - const tx_metadata_t &metadata, + const tx_metadata_t &metadata_, const io_type_t &io_type ){ + tx_metadata_t metadata = metadata_; //rw copy to change later + boost::uint32_t tx_mem[_mtu/sizeof(boost::uint32_t)]; size_t num_samps = std::min( asio::buffer_size(buff)/io_type.size, size_t(_max_tx_samples_per_packet) ); + //kill the end of burst flag if this is a fragment + if (asio::buffer_size(buff)/io_type.size < num_samps) + metadata.end_of_burst = false; + size_t num_header_words32, num_packet_words32; size_t packet_count = _tx_stream_id_to_packet_seq[metadata.stream_id]++; -- cgit v1.2.3