commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] gnuradio-examples/python/gmsk2 Makefile.am benc...


From: Eric Blossom
Subject: [Commit-gnuradio] gnuradio-examples/python/gmsk2 Makefile.am benc...
Date: Mon, 19 Jun 2006 20:59:07 +0000

CVSROOT:        /sources/gnuradio
Module name:    gnuradio-examples
Changes by:     Eric Blossom <eb>       06/06/19 20:59:07

Modified files:
        python/gmsk2   : Makefile.am benchmark_gmsk_rx.py 
                         benchmark_gmsk_tx.py receive_path.py 
                         transmit_path.py tunnel_ip_null_mac.py 
Added files:
        python/gmsk2   : fusb_options.py 

Log message:
        added command line parsing for fusb options.  Enable real-time if 
possible

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnuradio-examples/python/gmsk2/Makefile.am?cvsroot=gnuradio&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/gnuradio-examples/python/gmsk2/benchmark_gmsk_rx.py?cvsroot=gnuradio&r1=1.19&r2=1.20
http://cvs.savannah.gnu.org/viewcvs/gnuradio-examples/python/gmsk2/benchmark_gmsk_tx.py?cvsroot=gnuradio&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/gnuradio-examples/python/gmsk2/receive_path.py?cvsroot=gnuradio&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/gnuradio-examples/python/gmsk2/transmit_path.py?cvsroot=gnuradio&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/gnuradio-examples/python/gmsk2/tunnel_ip_null_mac.py?cvsroot=gnuradio&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/gnuradio-examples/python/gmsk2/fusb_options.py?cvsroot=gnuradio&rev=1.1

Patches:
Index: Makefile.am
===================================================================
RCS file: /sources/gnuradio/gnuradio-examples/python/gmsk2/Makefile.am,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- Makefile.am 31 May 2006 03:11:32 -0000      1.8
+++ Makefile.am 19 Jun 2006 20:59:06 -0000      1.9
@@ -24,6 +24,7 @@
        benchmark_gmsk_tx.py    \
        benchmark_mpsk_rx.py    \
        benchmark_mpsk_tx.py    \
+       fusb_options.py         \
        gen_whitener.py         \
        gmsk_test.py            \
        pick_bitrate.py         \

Index: benchmark_gmsk_rx.py
===================================================================
RCS file: 
/sources/gnuradio/gnuradio-examples/python/gmsk2/benchmark_gmsk_rx.py,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- benchmark_gmsk_rx.py        17 Jun 2006 21:06:41 -0000      1.19
+++ benchmark_gmsk_rx.py        19 Jun 2006 20:59:06 -0000      1.20
@@ -31,6 +31,7 @@
 
 # from current dir
 from receive_path import receive_path
+import fusb_options
 
 #import os
 #print os.getpid()
@@ -39,10 +40,10 @@
 
 class my_graph(gr.flow_graph):
 
-    def __init__(self, rx_subdev_spec, bitrate, decim_rate, spb, rx_callback, 
log):
+    def __init__(self, rx_subdev_spec, bitrate, decim_rate, spb, rx_callback, 
log, options):
         gr.flow_graph.__init__(self)
         self.rxpath = receive_path(self, rx_subdev_spec, bitrate, decim_rate,
-                                   spb, rx_callback, log)
+                                   spb, rx_callback, log, options)
 
 # /////////////////////////////////////////////////////////////////////////////
 #                                   main
@@ -80,6 +81,7 @@
                       help="set rx gain")
     parser.add_option("","--log", action="store_true", default=False,
                       help="enable diagnostic logging")
+    fusb_options.add_options(parser)
     (options, args) = parser.parse_args ()
 
     if len(args) != 0:
@@ -91,7 +93,8 @@
 
     # build the graph
     fg = my_graph(options.rx_subdev_spec, options.bitrate,
-                  options.decim, options.spb, rx_callback, options.log)
+                  options.decim, options.spb, rx_callback, options.log,
+                  options)
 
     print "bitrate: %sb/sec" % (eng_notation.num_to_str(fg.rxpath.bitrate()),)
     print "spb:     %3d" % (fg.rxpath.spb(),)

Index: benchmark_gmsk_tx.py
===================================================================
RCS file: 
/sources/gnuradio/gnuradio-examples/python/gmsk2/benchmark_gmsk_tx.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- benchmark_gmsk_tx.py        31 May 2006 02:46:45 -0000      1.15
+++ benchmark_gmsk_tx.py        19 Jun 2006 20:59:06 -0000      1.16
@@ -33,6 +33,7 @@
 
 # from current dir
 from transmit_path import transmit_path
+import fusb_options
 
 #import os
 #print os.getpid()
@@ -41,9 +42,10 @@
 
 class my_graph(gr.flow_graph):
 
-    def __init__(self, tx_subdev_spec, bitrate, interp_rate, spb, bt):
+    def __init__(self, tx_subdev_spec, bitrate, interp_rate, spb, bt, options):
         gr.flow_graph.__init__(self)
-        self.txpath = transmit_path(self, tx_subdev_spec, bitrate, 
interp_rate, spb, bt)
+        self.txpath = transmit_path(self, tx_subdev_spec, bitrate, 
interp_rate, spb,
+                                    bt, False, options)
 
 
 # /////////////////////////////////////////////////////////////////////////////
@@ -75,6 +77,7 @@
                       help="set megabytes to transmit [default=%default]")
     parser.add_option("","--discontinuous", action="store_true", default=False,
                       help="enable discontinous transmission (bursts of 5 
packets)")
+    fusb_options.add_options(parser)
     (options, args) = parser.parse_args ()
 
     if len(args) != 0:
@@ -88,7 +91,7 @@
 
     # build the graph
     fg = my_graph(options.tx_subdev_spec, options.bitrate, options.interp,
-                  options.spb, options.bt)
+                  options.spb, options.bt, options)
 
     print "bitrate: %sb/sec" % (eng_notation.num_to_str(fg.txpath.bitrate()),)
     print "spb:     %3d" % (fg.txpath.spb(),)
@@ -99,6 +102,10 @@
         print "Failed to set Tx frequency to %s" % 
(eng_notation.num_to_str(options.freq),)
         raise SystemExit
 
+    r = gr.enable_realtime_scheduling()
+    if r != gr.RT_OK:
+        print "Warning: failed to enable realtime scheduling"
+
     fg.start()                       # start flow graph
 
     # generate and send packets

Index: receive_path.py
===================================================================
RCS file: /sources/gnuradio/gnuradio-examples/python/gmsk2/receive_path.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- receive_path.py     17 Jun 2006 21:34:38 -0000      1.8
+++ receive_path.py     19 Jun 2006 20:59:07 -0000      1.9
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 #
-# Copyright 2005 Free Software Foundation, Inc.
+# Copyright 2005,2006 Free Software Foundation, Inc.
 # 
 # This file is part of GNU Radio
 # 
@@ -31,15 +31,14 @@
 # /////////////////////////////////////////////////////////////////////////////
 
 class receive_path(gr.hier_block):
-    def __init__(self, fg, subdev_spec, bitrate, decim, spb, rx_callback, 
log_p):
+    def __init__(self, fg, subdev_spec, bitrate, decim, spb, rx_callback,
+                 log_p, options):
 
         gain_mu = 0.03     # default
         threshold = -1     # use system default
 
-        fusb_block_size = 1024
-        fusb_nblocks = 8
-        self.u = usrp.source_c (fusb_block_size=fusb_block_size,
-                                fusb_nblocks=fusb_nblocks)
+        self.u = usrp.source_c (fusb_block_size=options.fusb_block_size,
+                                fusb_nblocks=options.fusb_nblocks)
         adc_rate = self.u.adc_rate()
 
         (self._bitrate, self._spb, self._decim) = pick_rx_bitrate(bitrate, 1, 
spb,

Index: transmit_path.py
===================================================================
RCS file: /sources/gnuradio/gnuradio-examples/python/gmsk2/transmit_path.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- transmit_path.py    17 Jun 2006 21:34:38 -0000      1.6
+++ transmit_path.py    19 Jun 2006 20:59:07 -0000      1.7
@@ -30,14 +30,15 @@
 # /////////////////////////////////////////////////////////////////////////////
 
 class transmit_path(gr.hier_block):
-    def __init__(self, fg, subdev_spec, bitrate, interp, spb, bt, log_p=False):
+    def __init__(self, fg, subdev_spec, bitrate, interp, spb, bt,
+                 log_p, options):
 
         self.normal_gain = 8000
 
-        fusb_block_size = 1024
-        fusb_nblocks = 8
-        self.u = usrp.sink_c (fusb_block_size=fusb_block_size,
-                              fusb_nblocks=fusb_nblocks)
+        fusb_block_size = 512
+        fusb_nblocks = 4
+        self.u = usrp.sink_c (fusb_block_size=options.fusb_block_size,
+                              fusb_nblocks=options.fusb_nblocks)
         dac_rate = self.u.dac_rate();
 
         (self._bitrate, self._spb, self._interp) = pick_tx_bitrate(bitrate, 1, 
spb,

Index: tunnel_ip_null_mac.py
===================================================================
RCS file: 
/sources/gnuradio/gnuradio-examples/python/gmsk2/tunnel_ip_null_mac.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- tunnel_ip_null_mac.py       17 Jun 2006 21:34:38 -0000      1.10
+++ tunnel_ip_null_mac.py       19 Jun 2006 20:59:07 -0000      1.11
@@ -35,6 +35,7 @@
 # from current dir
 from transmit_path import transmit_path
 from receive_path import receive_path
+import fusb_options
 
 #print os.getpid()
 #raw_input('Attach and press enter')
@@ -60,13 +61,14 @@
 class my_graph(gr.flow_graph):
 
     def __init__(self, rx_subdev_spec, tx_subdev_spec,
-                 bitrate, decim_rate, interp_rate, spb, bt, rx_callback, 
log_p):
+                 bitrate, decim_rate, interp_rate, spb, bt, rx_callback, log_p,
+                 options):
 
         gr.flow_graph.__init__(self)
         self.txpath = transmit_path(self, tx_subdev_spec, bitrate, interp_rate,
-                                    spb, bt, log_p)
+                                    spb, bt, log_p, options)
         self.rxpath =  receive_path(self, rx_subdev_spec, bitrate, decim_rate,
-                                    spb, rx_callback, log_p)
+                                    spb, rx_callback, log_p, options)
 
     def send_pkt(self, payload='', eof=False):
         return self.txpath.send_pkt(payload, eof)
@@ -208,6 +210,7 @@
     parser.add_option("","--tun-device-filename", default="/dev/net/tun",
                       help="path to tun device file [default=%default]")
     parser.add_option("-v","--verbose", action="store_true", default=False)
+    fusb_options.add_options(parser)
     (options, args) = parser.parse_args ()
 
     if len(args) != 0:
@@ -229,7 +232,8 @@
     # build the graph (PHY)
     fg = my_graph(options.tx_subdev_spec, options.rx_subdev_spec,
                   options.bitrate, options.decim, options.interp,
-                  options.spb, options.bt, mac.phy_rx_callback, options.log)
+                  options.spb, options.bt, mac.phy_rx_callback, options.log,
+                  options)
 
     mac.set_flow_graph(fg)    # give the MAC a handle for the PHY
 

Index: fusb_options.py
===================================================================
RCS file: fusb_options.py
diff -N fusb_options.py
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ fusb_options.py     19 Jun 2006 20:59:06 -0000      1.1
@@ -0,0 +1,31 @@
+#
+# Copyright 2006 Free Software Foundation, Inc.
+# 
+# This file is part of GNU Radio
+# 
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+# 
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING.  If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+# 
+
+def add_options(parser):
+    """
+    Add Fast USB specifc options to command line parser.
+    
+    @param parser: instance of OptionParser
+    """
+    parser.add_option("-B", "--fusb-block-size", type="int", default=0,
+                      help="specify fast usb block size [default=%default]")
+    parser.add_option("-N", "--fusb-nblocks", type="int", default=0,
+                      help="specify number of fast usb blocks 
[default=%default]")




reply via email to

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