commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] [gnuradio] 11/11: uhd: Used uhd-internal fragmentation


From: git
Subject: [Commit-gnuradio] [gnuradio] 11/11: uhd: Used uhd-internal fragmentation handling, bursty tx w/o time tags now no longer uses time specs
Date: Sat, 26 Apr 2014 22:34:12 +0000 (UTC)

This is an automated email from the git hooks/post-receive script.

jcorgan pushed a commit to branch master
in repository gnuradio.

commit a337dcb7d7db53fa703acc250d56806f8afb9144
Author: Martin Braun <address@hidden>
Date:   Sat Apr 26 23:29:59 2014 +0200

    uhd: Used uhd-internal fragmentation handling, bursty tx w/o time tags now 
no longer uses time specs
---
 gr-uhd/include/gnuradio/uhd/usrp_sink.h | 10 ++++---
 gr-uhd/lib/usrp_sink_impl.cc            | 51 ++++++++++++---------------------
 2 files changed, 25 insertions(+), 36 deletions(-)

diff --git a/gr-uhd/include/gnuradio/uhd/usrp_sink.h 
b/gr-uhd/include/gnuradio/uhd/usrp_sink.h
index 46d8351..35bb2e4 100644
--- a/gr-uhd/include/gnuradio/uhd/usrp_sink.h
+++ b/gr-uhd/include/gnuradio/uhd/usrp_sink.h
@@ -63,7 +63,8 @@ namespace gr {
       /*!
        * \brief DEPRECATED Make a new USRP sink block using the deprecated 
io_type_t.
        *
-       * This function will go away in 3.8.
+       * This function will be removed in the future. Please use the other 
make function,
+       * gr::uhd::make(const ::uhd::device_addr_t, const ::uhd::stream_args_t, 
const std::string).
        *
        * \ingroup uhd_blk
        */
@@ -105,8 +106,9 @@ namespace gr {
        * The timestamp tag value is a PMT tuple of the following:
        * (uint64 seconds, and double fractional seconds).
        *
-       * The tx_freq tag has to be a double, and will re-tune the USRP to the 
given frequency,
-       * if possible.
+       * The tx_freq tag has to be a double, and will issue a tune command to 
the USRP
+       * to the given frequency, if possible. Note that oscillators need some 
time
+       * to stabilize after this! Don't expect clean data to be sent 
immediately after this command.
        *
        * The command tag can carry a PMT command. See the following section.
        *
@@ -115,7 +117,7 @@ namespace gr {
        * There are two ways of passing commands to this block:
        * 1) tx_command tag. The command is attached to a sample, and will 
executed
        *    before the sample is transmitted, and after the previous sample.
-       * 2) 'command' message interface. The command is executed 
asynchronously,
+       * 2) The 'command' message port. The command is executed asynchronously,
        *    as soon as possible.
        *
        * In both cases, the payload of the command is a PMT pair, with the 
first
diff --git a/gr-uhd/lib/usrp_sink_impl.cc b/gr-uhd/lib/usrp_sink_impl.cc
index 02aa1fd..b6a9839 100644
--- a/gr-uhd/lib/usrp_sink_impl.cc
+++ b/gr-uhd/lib/usrp_sink_impl.cc
@@ -89,11 +89,11 @@ namespace gr {
          pmt::mp("command"),
          boost::bind(&usrp_sink_impl::msg_handler_command, this, _1)
       );
-      message_port_register_in(pmt::mp("query"));
-      set_msg_handler(
-         pmt::mp("query"),
-         boost::bind(&usrp_sink_impl::msg_handler_query, this, _1)
-      );
+      //message_port_register_in(pmt::mp("query"));
+      //set_msg_handler(
+         //pmt::mp("query"),
+         //boost::bind(&usrp_sink_impl::msg_handler_query, this, _1)
+      //);
     }
 
     usrp_sink_impl::~usrp_sink_impl()
@@ -519,7 +519,7 @@ namespace gr {
     {
       int ninput_items = noutput_items; //cuz it's a sync block
 
-      //send a mid-burst packet with time spec
+      // default to send a mid-burst packet
       _metadata.start_of_burst = false;
       _metadata.end_of_burst = false;
 
@@ -550,10 +550,6 @@ namespace gr {
         }
       }
 
-      // We send the EOB manually to avoid sending several EOBs in case of 
fragmentation
-      bool eob = _metadata.end_of_burst;
-      _metadata.end_of_burst = false;
-
 #ifdef GR_UHD_USE_STREAM_API
       //send all ninput_items with metadata
       const size_t num_sent = _tx_stream->send
@@ -573,23 +569,9 @@ namespace gr {
       _metadata.time_spec += ::uhd::time_spec_t(0, num_sent, _sample_rate);
 
       // Some post-processing tasks if we actually transmitted the entire burst
-      if (num_sent == size_t(ninput_items)) {
-        if (_call_tune) {
-          _set_center_freq_from_internals_allchans();
-          _call_tune = false;
-        }
-
-        if (eob) {
-#ifdef GR_UHD_USE_STREAM_API
-          _metadata.end_of_burst = true;
-          _tx_stream->send
-            (gr_vector_const_void_star(_nchan), 0, _metadata, 1.0);
-#else
-          _dev->get_device()->send
-            (gr_vector_const_void_star(_nchan), 0, _metadata,
-             *_type, ::uhd::device::SEND_MODE_ONE_PACKET, 1.0);
-#endif
-        }
+      if (_call_tune and num_sent == size_t(ninput_items)) {
+       _set_center_freq_from_internals_allchans();
+       _call_tune = false;
       }
 
       return num_sent;
@@ -609,6 +591,7 @@ namespace gr {
       uint64_t max_count = samp0_count + ninput_items;
 
       // Go through tag list until something indicates the end of a burst.
+      bool found_time_tag = false;
       bool found_eob = false;
       bool found_freq_tag_in_burst = false;
       uint64_t freq_cmd_offset = 0;
@@ -651,6 +634,7 @@ namespace gr {
             max_count = my_tag_count;
             break;
           }
+         found_time_tag = true;
           _metadata.has_time_spec = true;
           _metadata.time_spec = ::uhd::time_spec_t
             (pmt::to_uint64(pmt::tuple_ref(value, 0)),
@@ -663,6 +647,8 @@ namespace gr {
             max_count = my_tag_count;
             break;
           }
+         // Bursty tx will not use time specs, unless a tx_time tag is also 
given.
+         _metadata.has_time_spec = false;
           _metadata.start_of_burst = pmt::to_bool(value);
         }
 
@@ -742,14 +728,14 @@ namespace gr {
         }
       }
 
+      if (found_time_tag) {
+       _metadata.has_time_spec = true;
+      }
+
       // Only transmit up to and including end of burst,
       // or everything if no burst boundaries are found.
       ninput_items = int(max_count - samp0_count);
 
-      // TODO unset has_time_spec for bursty behaviour w/o time!
-      //time will not be set unless a time tag is found
-      //_metadata.has_time_spec = false;
-
     } // end tag_work()
 
     void
@@ -771,7 +757,8 @@ namespace gr {
 
       _metadata.start_of_burst = true;
       _metadata.end_of_burst = false;
-      _metadata.has_time_spec = not _stream_now;
+      // Bursty tx will need to send a tx_time to activate time spec
+      _metadata.has_time_spec = not _stream_now and 
pmt::is_null(_length_tag_key);
       _nitems_to_send = 0;
       if(_start_time_set) {
         _start_time_set = false; //cleared for next run



reply via email to

[Prev in Thread] Current Thread [Next in Thread]