commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r9874 - gnuradio/trunk/usrp2/host/lib


From: eb
Subject: [Commit-gnuradio] r9874 - gnuradio/trunk/usrp2/host/lib
Date: Mon, 27 Oct 2008 02:45:44 -0600 (MDT)

Author: eb
Date: 2008-10-27 02:45:43 -0600 (Mon, 27 Oct 2008)
New Revision: 9874

Modified:
   gnuradio/trunk/usrp2/host/lib/usrp2_impl.cc
   gnuradio/trunk/usrp2/host/lib/usrp2_impl.h
Log:
An insufficient attempt to fix the set_freq problem...

Modified: gnuradio/trunk/usrp2/host/lib/usrp2_impl.cc
===================================================================
--- gnuradio/trunk/usrp2/host/lib/usrp2_impl.cc 2008-10-27 08:08:52 UTC (rev 
9873)
+++ gnuradio/trunk/usrp2/host/lib/usrp2_impl.cc 2008-10-27 08:45:43 UTC (rev 
9874)
@@ -130,7 +130,8 @@
       d_rx_seqno(-1), d_tx_seqno(0), d_next_rid(0),
       d_num_rx_frames(0), d_num_rx_missing(0), d_num_rx_overruns(0), 
d_num_rx_bytes(0), 
       d_num_enqueued(0), d_enqueued_mutex(), 
d_bg_pending_cond(&d_enqueued_mutex),
-      d_channel_rings(NCHANS), d_tx_interp(0), d_rx_decim(0)
+      d_channel_rings(NCHANS), d_tx_interp(0), d_rx_decim(0),
+      d_rx_str_p(false), d_rx_str_channel(0), d_rx_str_items_per_frame(0)
   {
     if (!d_eth_buf->open(ifc, htons(U2_ETHERTYPE)))
       throw std::runtime_error("Unable to register USRP2 protocol");
@@ -480,6 +481,7 @@
   bool
   usrp2::impl::set_rx_center_freq(double frequency, tune_result *result)
   {
+    //without_streaming        s(this);
     op_config_rx_v2_cmd cmd;
     op_config_rx_reply_v2_t reply;
 
@@ -597,6 +599,11 @@
       return false;
 
     bool success = (ntohx(reply.ok) == 1);
+    if (success){
+      d_rx_str_p = true;
+      d_rx_str_channel = channel;
+      d_rx_str_items_per_frame = items_per_frame;
+    }
     return success;
   }
   
@@ -639,8 +646,12 @@
       return false;
 
     bool success = (ntohx(reply.ok) == 1);
-    if (success)
+    if (success){
       d_channel_rings[channel].reset();
+      d_rx_str_p = false;
+      d_rx_str_channel = 0;
+      d_rx_str_items_per_frame = 0;
+    }
 
     return success;
   }
@@ -719,6 +730,7 @@
   bool
   usrp2::impl::set_tx_center_freq(double frequency, tune_result *result)
   {
+    //without_streaming        s(this);
     op_config_tx_v2_cmd cmd;
     op_config_tx_reply_v2_t reply;
 

Modified: gnuradio/trunk/usrp2/host/lib/usrp2_impl.h
===================================================================
--- gnuradio/trunk/usrp2/host/lib/usrp2_impl.h  2008-10-27 08:08:52 UTC (rev 
9873)
+++ gnuradio/trunk/usrp2/host/lib/usrp2_impl.h  2008-10-27 08:45:43 UTC (rev 
9874)
@@ -26,6 +26,7 @@
 #include "control.h"
 #include "ring.h"
 #include <string>
+#include <iostream>
 
 namespace usrp2 {
   
@@ -83,6 +84,13 @@
     int                   d_tx_interp;         // shadow tx interp 
     int                   d_rx_decim;          // shadow rx decim
 
+    // FIXME KLUDGE: shadow rx streaming state
+    bool          d_rx_str_p;          // Is the rx streaming?
+    unsigned int   d_rx_str_channel;
+    unsigned int   d_rx_str_items_per_frame;
+
+    friend struct without_streaming;
+
     void inc_enqueued() {
       omni_mutex_lock l(d_enqueued_mutex);
       d_num_enqueued++;
@@ -107,6 +115,7 @@
     data_handler::result handle_data_packet(const void *base, size_t len);
     bool dboard_info();
 
+
   public:
     impl(const std::string &ifc, props *p);
     ~impl();
@@ -175,6 +184,30 @@
     bool burn_mac_addr(const std::string &new_addr);
   };
   
+
+  struct without_streaming {
+    usrp2::impl *d_impl;
+    bool        d_was_streaming;
+
+    without_streaming(usrp2::impl *p)
+      : d_impl(p), d_was_streaming(p->d_rx_str_p)
+    {
+      if (d_was_streaming){
+       std::cerr << "without_streaming: stopping streaming\n";
+       d_impl->stop_rx_streaming(d_impl->d_rx_str_channel);
+      }
+    }
+
+    ~without_streaming()
+    {
+      if (d_was_streaming){
+       std::cerr << "without_streaming: re-starting streaming\n";
+       d_impl->start_rx_streaming(d_impl->d_rx_str_channel, 
d_impl->d_rx_str_items_per_frame);
+      }
+    }
+  };
+
+
 } // namespace usrp2
 
 #endif /* INCLUDED_USRP2_IMPL_H */





reply via email to

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