commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r6350 - in gnuradio/branches/developers/jcorgan/t162:


From: jcorgan
Subject: [Commit-gnuradio] r6350 - in gnuradio/branches/developers/jcorgan/t162: gnuradio-core/src/lib/runtime gnuradio-examples/python/digital
Date: Fri, 7 Sep 2007 11:38:37 -0600 (MDT)

Author: jcorgan
Date: 2007-09-07 11:38:36 -0600 (Fri, 07 Sep 2007)
New Revision: 6350

Modified:
   
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.cc
   
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_top_block.cc
   
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_top_block.h
   
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_top_block.i
   
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_top_block_impl.cc
   
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_top_block_impl.h
   
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/digital/benchmark_loopback.py
   
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/digital/benchmark_tx.py
   
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/digital/transmit_path.py
Log:
Finished converting benchmark_tx.py, restored runtime code.

Modified: 
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.cc
===================================================================
--- 
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.cc
        2007-09-07 16:06:24 UTC (rev 6349)
+++ 
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.cc
        2007-09-07 17:38:36 UTC (rev 6350)
@@ -31,7 +31,7 @@
 #include <iostream>
 #include <map>
 
-#define GR_FLAT_FLOWGRAPH_DEBUG 1
+#define GR_FLAT_FLOWGRAPH_DEBUG 0
 
 gr_flat_flowgraph_sptr
 gr_make_flat_flowgraph()

Modified: 
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_top_block.cc
===================================================================
--- 
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_top_block.cc
     2007-09-07 16:06:24 UTC (rev 6349)
+++ 
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_top_block.cc
     2007-09-07 17:38:36 UTC (rev 6350)
@@ -88,9 +88,3 @@
 {
   d_impl->unlock();
 }
-
-void
-gr_top_block::set_verbose(int verbosity)
-{
-  d_impl->set_verbose(verbosity);
-}

Modified: 
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_top_block.h
===================================================================
--- 
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_top_block.h
      2007-09-07 16:06:24 UTC (rev 6349)
+++ 
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_top_block.h
      2007-09-07 17:38:36 UTC (rev 6350)
@@ -97,13 +97,6 @@
    * reconfiguration happens.
    */
   virtual void unlock();
-
-  /*!
-   * Set debug verbosity
-   *
-   */
-  void set_verbose(int verbosity);
-
 };
 
 #endif /* INCLUDED_GR_TOP_BLOCK_H */

Modified: 
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_top_block.i
===================================================================
--- 
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_top_block.i
      2007-09-07 16:06:24 UTC (rev 6349)
+++ 
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_top_block.i
      2007-09-07 17:38:36 UTC (rev 6350)
@@ -46,7 +46,6 @@
   void run();
   void lock();
   void unlock();
-  void set_verbose(int verbosity);
 };
 
 %{

Modified: 
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_top_block_impl.cc
===================================================================
--- 
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_top_block_impl.cc
        2007-09-07 16:06:24 UTC (rev 6349)
+++ 
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_top_block_impl.cc
        2007-09-07 17:38:36 UTC (rev 6350)
@@ -34,7 +34,7 @@
 #include <iostream>
 #include <string.h>
 
-#define VERBOSE 1
+#define GR_TOP_BLOCK_IMPL_DEBUG 0
 
 static gr_top_block_impl *s_impl = 0;
 
@@ -59,7 +59,7 @@
 static void 
 runtime_sigint_handler(int signum)
 {
-  if (VERBOSE) {
+  if (GR_TOP_BLOCK_IMPL_DEBUG){
     char *msg = "SIGINT received, calling stop()\n";
     ::write(1, msg, strlen(msg));      // write is OK to call from signal 
handler
   }
@@ -71,8 +71,7 @@
 // ----------------------------------------------------------------
 
 gr_top_block_impl::gr_top_block_impl(gr_top_block *owner) 
-  : d_verbose(0),
-    d_running(false),
+  : d_running(false),
     d_ffg(),
     d_owner(owner),
     d_lock_count(0)
@@ -92,7 +91,7 @@
 void
 gr_top_block_impl::start()
 {
-  if (d_verbose)
+  if (GR_TOP_BLOCK_IMPL_DEBUG)
     std::cout << "start: entered" << std::endl;
 
   if (d_running)
@@ -112,18 +111,15 @@
 void
 gr_top_block_impl::start_threads()
 {
-  if (d_verbose)
+  if (GR_TOP_BLOCK_IMPL_DEBUG)
     std::cout << "start_threads: entered" << std::endl;
 
   d_graphs = d_ffg->partition();
-  if (d_verbose)
-    std::cout << "flow graph has " << d_graphs.size() << " disjoint 
sub-graphs" 
-              << std::endl;
   for (std::vector<gr_basic_block_vector_t>::iterator p = d_graphs.begin();
        p != d_graphs.end(); p++) {
     gr_scheduler_thread *thread = new 
gr_scheduler_thread(make_gr_block_vector(*p));
     d_threads.push_back(thread);
-    if (d_verbose)
+    if (GR_TOP_BLOCK_IMPL_DEBUG)
       std::cout << "start_threads: starting " << thread << std::endl;
     thread->start();
   }
@@ -138,7 +134,7 @@
 void
 gr_top_block_impl::stop()
 {
-  if (d_verbose){
+  if (GR_TOP_BLOCK_IMPL_DEBUG){
     char *msg = "stop: entered\n";
     ::write(1, msg, strlen(msg));
   }
@@ -153,18 +149,18 @@
 void
 gr_top_block_impl::wait()
 {
-  if (d_verbose)
+  if (GR_TOP_BLOCK_IMPL_DEBUG)
     std::cout << "wait: entered" << std::endl;
 
   void *dummy_status; // don't ever dereference this
   gr_local_sighandler sigint(SIGINT, runtime_sigint_handler);
 
   for (gr_scheduler_thread_viter_t p = d_threads.begin(); p != 
d_threads.end(); p++) {
-    if (d_verbose)
+    if (GR_TOP_BLOCK_IMPL_DEBUG)
       std::cout << "wait: joining thread " << (*p) << std::endl;
     (*p)->join(&dummy_status); // pthreads will self-delete, so pointer is now 
dead
     (*p) = 0; // FIXME: switch to stl::list and actually remove from container
-    if (d_verbose)
+    if (GR_TOP_BLOCK_IMPL_DEBUG)
       std::cout << "wait: join returned" << std::endl;
   }
 
@@ -178,7 +174,7 @@
 {
   omni_mutex_lock lock(d_reconf);
   d_lock_count++;
-  if (d_verbose)
+  if (GR_TOP_BLOCK_IMPL_DEBUG)
     std::cout << "runtime: locked, count = " << d_lock_count <<  std::endl;
 }
 
@@ -190,11 +186,11 @@
     throw std::runtime_error("unpaired unlock() call");
 
   d_lock_count--;
-  if (d_verbose)
+  if (GR_TOP_BLOCK_IMPL_DEBUG)
     std::cout << "unlock: unlocked, count = " << d_lock_count << std::endl;
 
   if (d_lock_count == 0) {
-    if (d_verbose)
+    if (GR_TOP_BLOCK_IMPL_DEBUG)
       std::cout << "unlock: restarting flowgraph" << std::endl;
     restart();
   }
@@ -203,7 +199,7 @@
 void
 gr_top_block_impl::restart()
 {
-  if (d_verbose)
+  if (GR_TOP_BLOCK_IMPL_DEBUG)
     std::cout << "restart: entered" << std::endl;
 
   if (!d_running)
@@ -212,7 +208,7 @@
   // Stop scheduler threads and wait for completion
   stop();
   wait();
-  if (d_verbose)
+  if (GR_TOP_BLOCK_IMPL_DEBUG)
     std::cout << "restart: threads stopped" << std::endl;
 
   // Create new simple flow graph
@@ -220,15 +216,9 @@
   new_ffg->validate();                // check consistency, sanity, etc
   new_ffg->merge_connections(d_ffg);   // reuse buffers, etc
 
-  if (d_verbose)
+  if (GR_TOP_BLOCK_IMPL_DEBUG)
     std::cout << "restart: replacing old flow graph with new" << std::endl;
   d_ffg = new_ffg;
 
   start_threads();
 }
-
-void
-gr_top_block_impl::set_verbose(int verbosity)
-{
-  d_verbose = verbosity;
-}

Modified: 
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_top_block_impl.h
===================================================================
--- 
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_top_block_impl.h
 2007-09-07 16:06:24 UTC (rev 6349)
+++ 
gnuradio/branches/developers/jcorgan/t162/gnuradio-core/src/lib/runtime/gr_top_block_impl.h
 2007-09-07 17:38:36 UTC (rev 6350)
@@ -53,12 +53,8 @@
   // Unlock the top block at end of reconfiguration
   void unlock();
 
-  // Enable verbose messages
-  void set_verbose(int verbosity);
-
 private:
     
-  int                            d_verbose;
   bool                           d_running;
   gr_flat_flowgraph_sptr         d_ffg;
   gr_scheduler_thread_vector_t   d_threads;

Modified: 
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/digital/benchmark_loopback.py
===================================================================
--- 
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/digital/benchmark_loopback.py
    2007-09-07 16:06:24 UTC (rev 6349)
+++ 
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/digital/benchmark_loopback.py
    2007-09-07 17:38:36 UTC (rev 6350)
@@ -174,6 +174,7 @@
         
     # Create an instance of a hierarchical block
     tb = my_top_block(mods[options.modulation], demods[options.modulation], 
rx_callback, options)
+    tb.set_verbose(1)
     tb.start()
 
     # generate and send packets

Modified: 
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/digital/benchmark_tx.py
===================================================================
--- 
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/digital/benchmark_tx.py
  2007-09-07 16:06:24 UTC (rev 6349)
+++ 
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/digital/benchmark_tx.py
  2007-09-07 17:38:36 UTC (rev 6350)
@@ -37,12 +37,6 @@
 #raw_input('Attach and press enter')
 
 
-class my_top_block(gr.top_block):
-    def __init__(self, modulator_class, options):
-        gr.top_block.__init__(self)
-        self.txpath = transmit_path(modulator_class, options)
-
-
 # /////////////////////////////////////////////////////////////////////////////
 #                                   main
 # /////////////////////////////////////////////////////////////////////////////
@@ -50,7 +44,7 @@
 def main():
 
     def send_pkt(payload='', eof=False):
-        return tb.txpath.send_pkt(payload, eof)
+        return tb.send_pkt(payload, eof)
 
     def rx_callback(ok, payload):
         print "ok = %r, payload = '%s'" % (ok, payload)
@@ -95,7 +89,7 @@
         source_file = open(options.from_file, 'r')
 
     # build the graph
-    tb = my_top_block(mods[options.modulation], options)
+    tb = transmit_path(mods[options.modulation], options)
     tb.set_verbose(1)
 
     r = gr.enable_realtime_scheduling()

Modified: 
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/digital/transmit_path.py
===================================================================
--- 
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/digital/transmit_path.py
 2007-09-07 16:06:24 UTC (rev 6349)
+++ 
gnuradio/branches/developers/jcorgan/t162/gnuradio-examples/python/digital/transmit_path.py
 2007-09-07 17:38:36 UTC (rev 6350)
@@ -33,14 +33,12 @@
 #                              transmit path
 # /////////////////////////////////////////////////////////////////////////////
 
-class transmit_path(gr.hier_block2): 
+class transmit_path(gr.top_block): 
     def __init__(self, modulator_class, options):
         '''
         See below for what options should hold
         '''
-       gr.hier_block2.__init__(self, "transmit_path",
-                               gr.io_signature(0, 0, 0), # Input signature
-                               gr.io_signature(0, 0, 0)) # Output signature
+       gr.top_block.__init__(self, "transmit_path");
 
         options = copy.copy(options)    # make a copy so we can destructively 
modify
 





reply via email to

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