commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r11406 - gnuradio/trunk/gnuradio-examples/python/digit


From: jcorgan
Subject: [Commit-gnuradio] r11406 - gnuradio/trunk/gnuradio-examples/python/digital
Date: Thu, 9 Jul 2009 18:36:37 -0600 (MDT)

Author: jcorgan
Date: 2009-07-09 18:36:36 -0600 (Thu, 09 Jul 2009)
New Revision: 11406

Added:
   gnuradio/trunk/gnuradio-examples/python/digital/usrp_receive_path.py
   gnuradio/trunk/gnuradio-examples/python/digital/usrp_transmit_path.py
Modified:
   gnuradio/trunk/gnuradio-examples/python/digital/
   gnuradio/trunk/gnuradio-examples/python/digital/Makefile.am
   gnuradio/trunk/gnuradio-examples/python/digital/benchmark_rx.py
   gnuradio/trunk/gnuradio-examples/python/digital/benchmark_tx.py
   gnuradio/trunk/gnuradio-examples/python/digital/generic_usrp.py
   gnuradio/trunk/gnuradio-examples/python/digital/receive_path.py
   gnuradio/trunk/gnuradio-examples/python/digital/rx_voice.py
   gnuradio/trunk/gnuradio-examples/python/digital/transmit_path.py
   gnuradio/trunk/gnuradio-examples/python/digital/tunnel.py
   gnuradio/trunk/gnuradio-examples/python/digital/tx_voice.py
Log:
Merged r11401:11405 from jblum/digital into trunk.  Restores tunnel.py, 
rx_voice.py, and tx_voice.py operation after transmit/receive path refactoring.


Property changes on: gnuradio/trunk/gnuradio-examples/python/digital
___________________________________________________________________
Modified: svn:mergeinfo
   - 
/gnuradio/branches/developers/eb/t348/gnuradio-examples/python/digital:10638-10648
/gnuradio/branches/developers/eb/t364/gnuradio-examples/python/digital:11016-11017
/gnuradio/branches/developers/eb/t367/gnuradio-examples/python/digital:11021-11025
/gnuradio/branches/developers/eb/t371/gnuradio-examples/python/digital:10958-10971
/gnuradio/branches/developers/eb/t378/gnuradio-examples/python/digital:10683-10688
/gnuradio/branches/developers/jblum/digital:10901-10941,10943-11199
/gnuradio/branches/developers/jblum/grc/gnuradio-examples/python/digital:10680-10938,11187-11273,11310-11357
/gnuradio/branches/developers/jblum/gui_guts/gnuradio-examples/python/digital:10464-10658
/gnuradio/branches/developers/jblum/vlen/gnuradio-examples/python/digital:10667-10677
/gnuradio/branches/developers/jblum/wxgui/gnuradio-examples/python/digital:11125-11183
/gnuradio/branches/developers/jcorgan/cpphier/gnuradio-examples/python/digital:10818-10858
/gnuradio/branches/developers/jcorgan/deb/gnuradio-examples/python/digital:10949-10959,11013-11022,11046-11059,11075-11077
/gnuradio/branches/developers/jcorgan/fw-optimize/gnuradio-examples/python/digital:10428-10429
/gnuradio/branches/developers/jcorgan/gpio2/gnuradio-examples/python/digital:10713-10765
/gnuradio/branches/developers/jcorgan/iad2/gnuradio-examples/python/digital:10771-10887
/gnuradio/branches/developers/jcorgan/np/gnuradio-examples/python/digital:11124-11148
/gnuradio/branches/developers/jcorgan/t161/gnuradio-examples/python/digital:10876-10880
/gnuradio/branches/developers/jcorgan/usrp-headers/gnuradio-examples/python/digital:11378-11390
/gnuradio/branches/developers/michaelld/am_swig_4/gnuradio-examples/python/digital:10555-10595
/gnuradio/branches/developers/michaelld/two_mods/gnuradio-examples/python/digital:10540-10546
/gnuradio/branches/developers/trondeau/digital/gnuradio-examples/python/digital:11193-11205
/gnuradio/branches/developers/trondeau/qt/gnuradio-examples/python/digital:11235-11360
/gnuradio/branches/developers/trondeau/qtdigital/gnuradio-examples/python/digital:11210-11215
   + 
/gnuradio/branches/developers/eb/t348/gnuradio-examples/python/digital:10638-10648
/gnuradio/branches/developers/eb/t364/gnuradio-examples/python/digital:11016-11017
/gnuradio/branches/developers/eb/t367/gnuradio-examples/python/digital:11021-11025
/gnuradio/branches/developers/eb/t371/gnuradio-examples/python/digital:10958-10971
/gnuradio/branches/developers/eb/t378/gnuradio-examples/python/digital:10683-10688
/gnuradio/branches/developers/jblum/digital:10901-10941,10943-11199,11402-11405
/gnuradio/branches/developers/jblum/grc/gnuradio-examples/python/digital:10680-10938,11187-11273,11310-11357
/gnuradio/branches/developers/jblum/gui_guts/gnuradio-examples/python/digital:10464-10658
/gnuradio/branches/developers/jblum/vlen/gnuradio-examples/python/digital:10667-10677
/gnuradio/branches/developers/jblum/wxgui/gnuradio-examples/python/digital:11125-11183
/gnuradio/branches/developers/jcorgan/cpphier/gnuradio-examples/python/digital:10818-10858
/gnuradio/branches/developers/jcorgan/deb/gnuradio-examples/python/digital:10949-10959,11013-11022,11046-11059,11075-11077
/gnuradio/branches/developers/jcorgan/fw-optimize/gnuradio-examples/python/digital:10428-10429
/gnuradio/branches/developers/jcorgan/gpio2/gnuradio-examples/python/digital:10713-10765
/gnuradio/branches/developers/jcorgan/iad2/gnuradio-examples/python/digital:10771-10887
/gnuradio/branches/developers/jcorgan/np/gnuradio-examples/python/digital:11124-11148
/gnuradio/branches/developers/jcorgan/t161/gnuradio-examples/python/digital:10876-10880
/gnuradio/branches/developers/jcorgan/usrp-headers/gnuradio-examples/python/digital:11378-11390
/gnuradio/branches/developers/michaelld/am_swig_4/gnuradio-examples/python/digital:10555-10595
/gnuradio/branches/developers/michaelld/two_mods/gnuradio-examples/python/digital:10540-10546
/gnuradio/branches/developers/trondeau/digital/gnuradio-examples/python/digital:11193-11205
/gnuradio/branches/developers/trondeau/qt/gnuradio-examples/python/digital:11235-11360
/gnuradio/branches/developers/trondeau/qtdigital/gnuradio-examples/python/digital:11210-11215

Modified: gnuradio/trunk/gnuradio-examples/python/digital/Makefile.am
===================================================================
--- gnuradio/trunk/gnuradio-examples/python/digital/Makefile.am 2009-07-09 
23:28:38 UTC (rev 11405)
+++ gnuradio/trunk/gnuradio-examples/python/digital/Makefile.am 2009-07-10 
00:36:36 UTC (rev 11406)
@@ -33,7 +33,9 @@
        qt_rx_window.py         \
        receive_path.py         \
        transmit_path.py        \
-       usrp_options.py
+       usrp_options.py \
+       usrp_receive_path.py \
+       usrp_transmit_path.py
 
 dist_ourdata_SCRIPTS =         \
        benchmark_loopback.py   \

Modified: gnuradio/trunk/gnuradio-examples/python/digital/benchmark_rx.py
===================================================================
--- gnuradio/trunk/gnuradio-examples/python/digital/benchmark_rx.py     
2009-07-09 23:28:38 UTC (rev 11405)
+++ gnuradio/trunk/gnuradio-examples/python/digital/benchmark_rx.py     
2009-07-10 00:36:36 UTC (rev 11406)
@@ -31,9 +31,7 @@
 import sys
 
 # from current dir
-from receive_path import receive_path
-from pick_bitrate import pick_rx_bitrate
-import usrp_options
+import usrp_receive_path
 
 #import os
 #print os.getpid()
@@ -43,112 +41,11 @@
     def __init__(self, demodulator, rx_callback, options):
         gr.top_block.__init__(self)
 
-        self._rx_freq            = options.rx_freq         # receiver's center 
frequency
-        self._rx_gain            = options.rx_gain         # receiver's gain
-        self._decim              = options.decim           # Decimating rate 
for the USRP (prelim)
-        self._bitrate            = options.bitrate
-        self._samples_per_symbol = options.samples_per_symbol
-        self._demod_class        = demodulator
-
-        if self._rx_freq is None:
-            sys.stderr.write("-f FREQ or --freq FREQ or --rx-freq FREQ must be 
specified\n")
-            raise SystemExit
-
-        # Set up USRP source
-        self._setup_usrp_source(options)
-
-        # copy the final answers back into options for use by demodulator
-        options.samples_per_symbol = self._samples_per_symbol
-        options.bitrate = self._bitrate
-        options.decim = self._decim
-
-        ok = self.set_freq(self._rx_freq)
-        if not ok:
-            print "Failed to set Rx frequency to %s" % 
(eng_notation.num_to_str(self._rx_freq))
-            raise ValueError, eng_notation.num_to_str(self._rx_freq)
-
-        self.set_gain(options.rx_gain)
-        self.set_auto_tr(True)                 # enable Auto Transmit/Receive 
switching
-
         # Set up receive path
-        self.rxpath = receive_path(demodulator, rx_callback, options) 
+        self.rxpath = usrp_receive_path.usrp_receive_path(demodulator, 
rx_callback, options) 
 
-        self.connect(self.u, self.rxpath)
-        
-    def _setup_usrp_source(self, options):
-        self.u = usrp_options.create_usrp_source(options)
-        adc_rate = self.u.adc_rate()
+        self.connect(self.rxpath)
 
-        self.u.set_decim(self._decim)
-
-        (self._bitrate, self._samples_per_symbol, self._decim) = \
-                        pick_rx_bitrate(self._bitrate, 
self._demod_class.bits_per_symbol(), \
-                                        self._samples_per_symbol, self._decim, 
adc_rate,  \
-                                        self.u.get_decim_rates())
-
-        self.u.set_decim(self._decim)
-
-
-    def set_freq(self, target_freq):
-        """
-        Set the center frequency we're interested in.
-
-        @param target_freq: frequency in Hz
-        @rypte: bool
-
-        Tuning is a two step process.  First we ask the front-end to
-        tune as close to the desired frequency as it can.  Then we use
-        the result of that operation and our target_frequency to
-        determine the value for the digital up converter.
-        """
-        return self.u.set_center_freq(target_freq)
-
-    def set_gain(self, gain):
-        """
-        Sets the analog gain in the USRP
-        """
-        if gain is None:
-            r = self.u.gain_range()
-            gain = (r[0] + r[1])/2               # set gain to midpoint
-        self.gain = gain
-        return self.u.set_gain(gain)
-
-    def set_auto_tr(self, enable):
-        return self.u.set_auto_tr(enable)
-
-    def decim(self):
-        return self._decim
-
-    def add_options(normal, expert):
-        """
-        Adds usrp-specific options to the Options Parser
-        """
-        add_freq_option(normal)
-        normal.add_option("-v", "--verbose", action="store_true", 
default=False)
-
-        expert.add_option("", "--rx-freq", type="eng_float", default=None,
-                          help="set Rx frequency to FREQ [default=%default]", 
metavar="FREQ")
-   
-
-    # Make a static method to call before instantiation
-    add_options = staticmethod(add_options)
-
-
-def add_freq_option(parser):
-    """
-    Hackery that has the -f / --freq option set both tx_freq and rx_freq
-    """
-    def freq_callback(option, opt_str, value, parser):
-        parser.values.rx_freq = value
-        parser.values.tx_freq = value
-
-    if not parser.has_option('--freq'):
-        parser.add_option('-f', '--freq', type="eng_float",
-                          action="callback", callback=freq_callback,
-                          help="set Tx and/or Rx frequency to FREQ 
[default=%default]",
-                          metavar="FREQ")
-
-
 # /////////////////////////////////////////////////////////////////////////////
 #                                   main
 # /////////////////////////////////////////////////////////////////////////////
@@ -183,9 +80,7 @@
                       help="Select modulation from: %s [default=%%default]"
                             % (', '.join(demods.keys()),))
 
-    my_top_block.add_options(parser, expert_grp)
-    receive_path.add_options(parser, expert_grp)
-    usrp_options.add_rx_options(parser)
+    usrp_receive_path.add_options(parser, expert_grp)
 
     for mod in demods.values():
         mod.add_options(expert_grp)

Modified: gnuradio/trunk/gnuradio-examples/python/digital/benchmark_tx.py
===================================================================
--- gnuradio/trunk/gnuradio-examples/python/digital/benchmark_tx.py     
2009-07-09 23:28:38 UTC (rev 11405)
+++ gnuradio/trunk/gnuradio-examples/python/digital/benchmark_tx.py     
2009-07-10 00:36:36 UTC (rev 11406)
@@ -29,9 +29,7 @@
 import random, time, struct, sys
 
 # from current dir
-from transmit_path import transmit_path
-from pick_bitrate import pick_tx_bitrate
-import usrp_options
+import usrp_transmit_path
 
 #import os 
 #print os.getpid()
@@ -41,125 +39,10 @@
     def __init__(self, modulator, options):
         gr.top_block.__init__(self)
 
-        self._tx_freq            = options.tx_freq         # tranmitter's 
center frequency
-        self._interp             = options.interp          # interpolating 
rate for the USRP (prelim)
-        self._bitrate            = options.bitrate
-        self._samples_per_symbol = options.samples_per_symbol
-        self._modulator_class    = modulator
+        self.txpath = usrp_transmit_path.usrp_transmit_path(modulator, options)
 
-        if self._tx_freq is None:
-            sys.stderr.write("-f FREQ or --freq FREQ or --tx-freq FREQ must be 
specified\n")
-            raise SystemExit
+        self.connect(self.txpath)
 
-        # Set up USRP sink; also adjusts interp, and bitrate
-        self._setup_usrp_sink(options)
-
-        # copy the final answers back into options for use by modulator
-        options.samples_per_symbol = self._samples_per_symbol
-        options.bitrate = self._bitrate
-        options.interp = self._interp
-
-        # Set center frequency of USRP
-        ok = self.set_freq(self._tx_freq)
-        if not ok:
-            print "Failed to set Tx frequency to %s" % 
(eng_notation.num_to_str(self._tx_freq),)
-            raise ValueError
-
-        # Set the USRP for maximum transmit gain
-        # (Note that on the RFX cards this is a nop.)
-        self.set_gain(self.u.gain_range()[1])
-
-        self.txpath = transmit_path(modulator, options)
-
-        self.connect(self.txpath, self.u)
-
-    def _setup_usrp_sink(self, options):
-        """
-        Creates a USRP sink, determines the settings for best bitrate,
-        and attaches to the transmitter's subdevice.
-        """
-        self.u = usrp_options.create_usrp_sink(options)
-        dac_rate = self.u.dac_rate()
-
-        (self._bitrate, self._samples_per_symbol, self._interp) = \
-                        pick_tx_bitrate(self._bitrate, 
self._modulator_class.bits_per_symbol(), \
-                                        self._samples_per_symbol, 
self._interp, dac_rate, \
-                                        self.u.get_interp_rates())
-
-        self.u.set_interp(self._interp)
-        self.set_auto_tr(True)                 # enable Auto Transmit/Receive 
switching
-
-    def set_freq(self, target_freq):
-        """
-        Set the center frequency we're interested in.
-
-        @param target_freq: frequency in Hz
-        @rypte: bool
-
-        Tuning is a two step process.  First we ask the front-end to
-        tune as close to the desired frequency as it can.  Then we use
-        the result of that operation and our target_frequency to
-        determine the value for the digital up converter.
-        """
-        return self.u.set_center_freq(target_freq)
-
-    def set_gain(self, gain):
-        """
-        Sets the analog gain in the USRP
-        """
-        self.gain = gain
-        self.u.set_gain(gain)
-
-    def set_auto_tr(self, enable):
-        """
-        Turns on auto transmit/receive of USRP daughterboard (if exits; else 
ignored)
-        """
-        return self.u.set_auto_tr(enable)
-        
-    def interp(self):
-        return self._interp
-
-    def add_options(normal, expert):
-        """
-        Adds usrp-specific options to the Options Parser
-        """
-        add_freq_option(normal)
-        normal.add_option("-T", "--tx-subdev-spec", type="subdev", 
default=None,
-                          help="select USRP Tx side A or B")
-        normal.add_option("-v", "--verbose", action="store_true", 
default=False)
-
-        expert.add_option("", "--tx-freq", type="eng_float", default=None,
-                          help="set transmit frequency to FREQ 
[default=%default]", metavar="FREQ")
-        expert.add_option("-i", "--interp", type="intx", default=256,
-                          help="set fpga interpolation rate to INTERP 
[default=%default]")
-    # Make a static method to call before instantiation
-    add_options = staticmethod(add_options)
-
-    def _print_verbage(self):
-        """
-        Prints information about the transmit path
-        """
-        print "Using TX d'board %s"    % (self.subdev.side_and_name(),)
-        print "modulation:      %s"    % (self._modulator_class.__name__)
-        print "interp:          %3d"   % (self._interp)
-        print "Tx Frequency:    %s"    % 
(eng_notation.num_to_str(self._tx_freq))
-        
-
-def add_freq_option(parser):
-    """
-    Hackery that has the -f / --freq option set both tx_freq and rx_freq
-    """
-    def freq_callback(option, opt_str, value, parser):
-        parser.values.rx_freq = value
-        parser.values.tx_freq = value
-
-    if not parser.has_option('--freq'):
-        parser.add_option('-f', '--freq', type="eng_float",
-                          action="callback", callback=freq_callback,
-                          help="set Tx and/or Rx frequency to FREQ 
[default=%default]",
-                          metavar="FREQ")
-
-
 # /////////////////////////////////////////////////////////////////////////////
 #                                   main
 # /////////////////////////////////////////////////////////////////////////////
@@ -191,9 +74,7 @@
     parser.add_option("","--from-file", default=None,
                       help="use file for packet contents")
 
-    my_top_block.add_options(parser, expert_grp)
-    transmit_path.add_options(parser, expert_grp)
-    usrp_options.add_tx_options(parser)
+    usrp_transmit_path.add_options(parser, expert_grp)
 
     for mod in mods.values():
         mod.add_options(expert_grp)

Modified: gnuradio/trunk/gnuradio-examples/python/digital/generic_usrp.py
===================================================================
--- gnuradio/trunk/gnuradio-examples/python/digital/generic_usrp.py     
2009-07-09 23:28:38 UTC (rev 11405)
+++ gnuradio/trunk/gnuradio-examples/python/digital/generic_usrp.py     
2009-07-10 00:36:36 UTC (rev 11406)
@@ -99,7 +99,7 @@
     def gain_range(self):
         if self._type == USRP1_TYPE: return self._subdev.gain_range()
         elif self._type == USRP2_TYPE: return self._u.gain_range()
-        elif self._type == DUMMY_TYPE: return (0, 0)
+        elif self._type == DUMMY_TYPE: return (0, 0, 0)
 
     def set_center_freq(self, target_freq):
         if self._type == USRP1_TYPE:

Modified: gnuradio/trunk/gnuradio-examples/python/digital/receive_path.py
===================================================================
--- gnuradio/trunk/gnuradio-examples/python/digital/receive_path.py     
2009-07-09 23:28:38 UTC (rev 11405)
+++ gnuradio/trunk/gnuradio-examples/python/digital/receive_path.py     
2009-07-10 00:36:36 UTC (rev 11406)
@@ -118,8 +118,6 @@
         if not normal.has_option("--bitrate"):
             normal.add_option("-r", "--bitrate", type="eng_float", 
default=100e3,
                               help="specify bitrate [default=%default].")
-        normal.add_option("", "--show-rx-gain-range", action="store_true", 
default=False, 
-                          help="print min and max Rx gain available on 
selected daughterboard")
         normal.add_option("-v", "--verbose", action="store_true", 
default=False)
         expert.add_option("-S", "--samples-per-symbol", type="int", default=2,
                           help="set samples/symbol [default=%default]")


Property changes on: 
gnuradio/trunk/gnuradio-examples/python/digital/receive_path.py
___________________________________________________________________
Modified: svn:mergeinfo
   - 
/gnuradio/branches/developers/eb/t348/gnuradio-examples/python/digital/receive_path_lb.py:10638-10648
/gnuradio/branches/developers/eb/t364/gnuradio-examples/python/digital/receive_path_lb.py:11016-11017
/gnuradio/branches/developers/eb/t367/gnuradio-examples/python/digital/receive_path_lb.py:11021-11025
/gnuradio/branches/developers/eb/t371/gnuradio-examples/python/digital/receive_path_lb.py:10958-10971
/gnuradio/branches/developers/eb/t378/gnuradio-examples/python/digital/receive_path_lb.py:10683-10688
/gnuradio/branches/developers/jblum/digital/receive_path_lb.py:10901-10941
/gnuradio/branches/developers/jblum/grc/gnuradio-examples/python/digital/receive_path.py:11187-11273,11310-11357
/gnuradio/branches/developers/jblum/grc/gnuradio-examples/python/digital/receive_path_lb.py:10680-10938
/gnuradio/branches/developers/jblum/gui_guts/gnuradio-examples/python/digital/receive_path_lb.py:10464-10658
/gnuradio/branches/developers/jblum/vlen/gnuradio-examples/python/digital/receive_path_lb.py:10667-10677
/gnuradio/branches/developers/jblum/wxgui/gnuradio-examples/python/digital/receive_path_lb.py:11125-11183
/gnuradio/branches/developers/jcorgan/cpphier/gnuradio-examples/python/digital/receive_path_lb.py:10818-10858
/gnuradio/branches/developers/jcorgan/deb/gnuradio-examples/python/digital/receive_path_lb.py:10949-10959,11013-11022,11046-11059,11075-11077
/gnuradio/branches/developers/jcorgan/fw-optimize/gnuradio-examples/python/digital/receive_path_lb.py:10428-10429
/gnuradio/branches/developers/jcorgan/gpio2/gnuradio-examples/python/digital/receive_path_lb.py:10713-10765
/gnuradio/branches/developers/jcorgan/iad2/gnuradio-examples/python/digital/receive_path_lb.py:10771-10887
/gnuradio/branches/developers/jcorgan/np/gnuradio-examples/python/digital/receive_path_lb.py:11124-11148
/gnuradio/branches/developers/jcorgan/t161/gnuradio-examples/python/digital/receive_path_lb.py:10876-10880
/gnuradio/branches/developers/jcorgan/usrp-headers/gnuradio-examples/python/digital/receive_path.py:11378-11390
/gnuradio/branches/developers/michaelld/am_swig_4/gnuradio-examples/python/digital/receive_path_lb.py:10555-10595
/gnuradio/branches/developers/michaelld/two_mods/gnuradio-examples/python/digital/receive_path_lb.py:10540-10546
/gnuradio/branches/developers/trondeau/qt/gnuradio-examples/python/digital/receive_path.py:11235-11360
/gnuradio/branches/developers/trondeau/qtdigital/gnuradio-examples/python/digital/receive_path.py:11210-11215
   + 
/gnuradio/branches/developers/eb/t348/gnuradio-examples/python/digital/receive_path_lb.py:10638-10648
/gnuradio/branches/developers/eb/t364/gnuradio-examples/python/digital/receive_path_lb.py:11016-11017
/gnuradio/branches/developers/eb/t367/gnuradio-examples/python/digital/receive_path_lb.py:11021-11025
/gnuradio/branches/developers/eb/t371/gnuradio-examples/python/digital/receive_path_lb.py:10958-10971
/gnuradio/branches/developers/eb/t378/gnuradio-examples/python/digital/receive_path_lb.py:10683-10688
/gnuradio/branches/developers/jblum/digital/receive_path.py:11402-11405
/gnuradio/branches/developers/jblum/digital/receive_path_lb.py:10901-10941
/gnuradio/branches/developers/jblum/grc/gnuradio-examples/python/digital/receive_path.py:11187-11273,11310-11357
/gnuradio/branches/developers/jblum/grc/gnuradio-examples/python/digital/receive_path_lb.py:10680-10938
/gnuradio/branches/developers/jblum/gui_guts/gnuradio-examples/python/digital/receive_path_lb.py:10464-10658
/gnuradio/branches/developers/jblum/vlen/gnuradio-examples/python/digital/receive_path_lb.py:10667-10677
/gnuradio/branches/developers/jblum/wxgui/gnuradio-examples/python/digital/receive_path_lb.py:11125-11183
/gnuradio/branches/developers/jcorgan/cpphier/gnuradio-examples/python/digital/receive_path_lb.py:10818-10858
/gnuradio/branches/developers/jcorgan/deb/gnuradio-examples/python/digital/receive_path_lb.py:10949-10959,11013-11022,11046-11059,11075-11077
/gnuradio/branches/developers/jcorgan/fw-optimize/gnuradio-examples/python/digital/receive_path_lb.py:10428-10429
/gnuradio/branches/developers/jcorgan/gpio2/gnuradio-examples/python/digital/receive_path_lb.py:10713-10765
/gnuradio/branches/developers/jcorgan/iad2/gnuradio-examples/python/digital/receive_path_lb.py:10771-10887
/gnuradio/branches/developers/jcorgan/np/gnuradio-examples/python/digital/receive_path_lb.py:11124-11148
/gnuradio/branches/developers/jcorgan/t161/gnuradio-examples/python/digital/receive_path_lb.py:10876-10880
/gnuradio/branches/developers/jcorgan/usrp-headers/gnuradio-examples/python/digital/receive_path.py:11378-11390
/gnuradio/branches/developers/michaelld/am_swig_4/gnuradio-examples/python/digital/receive_path_lb.py:10555-10595
/gnuradio/branches/developers/michaelld/two_mods/gnuradio-examples/python/digital/receive_path_lb.py:10540-10546
/gnuradio/branches/developers/trondeau/qt/gnuradio-examples/python/digital/receive_path.py:11235-11360
/gnuradio/branches/developers/trondeau/qtdigital/gnuradio-examples/python/digital/receive_path.py:11210-11215

Modified: gnuradio/trunk/gnuradio-examples/python/digital/rx_voice.py
===================================================================
--- gnuradio/trunk/gnuradio-examples/python/digital/rx_voice.py 2009-07-09 
23:28:38 UTC (rev 11405)
+++ gnuradio/trunk/gnuradio-examples/python/digital/rx_voice.py 2009-07-10 
00:36:36 UTC (rev 11406)
@@ -34,7 +34,7 @@
 import sys
 
 # from current dir
-from receive_path import receive_path
+import usrp_receive_path
 
 #import os
 #print os.getpid()
@@ -61,7 +61,7 @@
 class my_top_block(gr.top_block):
     def __init__(self, demod_class, rx_callback, options):
         gr.top_block.__init__(self)
-        self.rxpath = receive_path(demod_class, rx_callback, options)
+        self.rxpath = usrp_receive_path.usrp_receive_path(demod_class, 
rx_callback, options)
         self.audio_tx = audio_tx(options.audio_output)
        self.connect(self.rxpath)
        self.connect(self.audio_tx)        
@@ -101,9 +101,8 @@
                             % (', '.join(demods.keys()),))
     parser.add_option("-O", "--audio-output", type="string", default="",
                       help="pcm output device name.  E.g., hw:0,0 or /dev/dsp")
+    usrp_receive_path.add_options(parser, expert_grp)
 
-    receive_path.add_options(parser, expert_grp)
-
     for mod in demods.values():
         mod.add_options(expert_grp)
 


Property changes on: 
gnuradio/trunk/gnuradio-examples/python/digital/transmit_path.py
___________________________________________________________________
Modified: svn:mergeinfo
   - 
/gnuradio/branches/developers/eb/t348/gnuradio-examples/python/digital/transmit_path_lb.py:10638-10648
/gnuradio/branches/developers/eb/t364/gnuradio-examples/python/digital/transmit_path_lb.py:11016-11017
/gnuradio/branches/developers/eb/t367/gnuradio-examples/python/digital/transmit_path_lb.py:11021-11025
/gnuradio/branches/developers/eb/t371/gnuradio-examples/python/digital/transmit_path_lb.py:10958-10971
/gnuradio/branches/developers/eb/t378/gnuradio-examples/python/digital/transmit_path_lb.py:10683-10688
/gnuradio/branches/developers/jblum/digital/transmit_path_lb.py:10901-10941
/gnuradio/branches/developers/jblum/grc/gnuradio-examples/python/digital/transmit_path.py:11187-11273,11310-11357
/gnuradio/branches/developers/jblum/grc/gnuradio-examples/python/digital/transmit_path_lb.py:10680-10938
/gnuradio/branches/developers/jblum/gui_guts/gnuradio-examples/python/digital/transmit_path_lb.py:10464-10658
/gnuradio/branches/developers/jblum/vlen/gnuradio-examples/python/digital/transmit_path_lb.py:10667-10677
/gnuradio/branches/developers/jblum/wxgui/gnuradio-examples/python/digital/transmit_path_lb.py:11125-11183
/gnuradio/branches/developers/jcorgan/cpphier/gnuradio-examples/python/digital/transmit_path_lb.py:10818-10858
/gnuradio/branches/developers/jcorgan/deb/gnuradio-examples/python/digital/transmit_path_lb.py:10949-10959,11013-11022,11046-11059,11075-11077
/gnuradio/branches/developers/jcorgan/fw-optimize/gnuradio-examples/python/digital/transmit_path_lb.py:10428-10429
/gnuradio/branches/developers/jcorgan/gpio2/gnuradio-examples/python/digital/transmit_path_lb.py:10713-10765
/gnuradio/branches/developers/jcorgan/iad2/gnuradio-examples/python/digital/transmit_path_lb.py:10771-10887
/gnuradio/branches/developers/jcorgan/np/gnuradio-examples/python/digital/transmit_path_lb.py:11124-11148
/gnuradio/branches/developers/jcorgan/t161/gnuradio-examples/python/digital/transmit_path_lb.py:10876-10880
/gnuradio/branches/developers/jcorgan/usrp-headers/gnuradio-examples/python/digital/transmit_path.py:11378-11390
/gnuradio/branches/developers/michaelld/am_swig_4/gnuradio-examples/python/digital/transmit_path_lb.py:10555-10595
/gnuradio/branches/developers/michaelld/two_mods/gnuradio-examples/python/digital/transmit_path_lb.py:10540-10546
/gnuradio/branches/developers/trondeau/qt/gnuradio-examples/python/digital/transmit_path.py:11235-11360
/gnuradio/branches/developers/trondeau/qtdigital/gnuradio-examples/python/digital/transmit_path.py:11210-11215
   + 
/gnuradio/branches/developers/eb/t348/gnuradio-examples/python/digital/transmit_path_lb.py:10638-10648
/gnuradio/branches/developers/eb/t364/gnuradio-examples/python/digital/transmit_path_lb.py:11016-11017
/gnuradio/branches/developers/eb/t367/gnuradio-examples/python/digital/transmit_path_lb.py:11021-11025
/gnuradio/branches/developers/eb/t371/gnuradio-examples/python/digital/transmit_path_lb.py:10958-10971
/gnuradio/branches/developers/eb/t378/gnuradio-examples/python/digital/transmit_path_lb.py:10683-10688
/gnuradio/branches/developers/jblum/digital/transmit_path.py:11402-11405
/gnuradio/branches/developers/jblum/digital/transmit_path_lb.py:10901-10941
/gnuradio/branches/developers/jblum/grc/gnuradio-examples/python/digital/transmit_path.py:11187-11273,11310-11357
/gnuradio/branches/developers/jblum/grc/gnuradio-examples/python/digital/transmit_path_lb.py:10680-10938
/gnuradio/branches/developers/jblum/gui_guts/gnuradio-examples/python/digital/transmit_path_lb.py:10464-10658
/gnuradio/branches/developers/jblum/vlen/gnuradio-examples/python/digital/transmit_path_lb.py:10667-10677
/gnuradio/branches/developers/jblum/wxgui/gnuradio-examples/python/digital/transmit_path_lb.py:11125-11183
/gnuradio/branches/developers/jcorgan/cpphier/gnuradio-examples/python/digital/transmit_path_lb.py:10818-10858
/gnuradio/branches/developers/jcorgan/deb/gnuradio-examples/python/digital/transmit_path_lb.py:10949-10959,11013-11022,11046-11059,11075-11077
/gnuradio/branches/developers/jcorgan/fw-optimize/gnuradio-examples/python/digital/transmit_path_lb.py:10428-10429
/gnuradio/branches/developers/jcorgan/gpio2/gnuradio-examples/python/digital/transmit_path_lb.py:10713-10765
/gnuradio/branches/developers/jcorgan/iad2/gnuradio-examples/python/digital/transmit_path_lb.py:10771-10887
/gnuradio/branches/developers/jcorgan/np/gnuradio-examples/python/digital/transmit_path_lb.py:11124-11148
/gnuradio/branches/developers/jcorgan/t161/gnuradio-examples/python/digital/transmit_path_lb.py:10876-10880
/gnuradio/branches/developers/jcorgan/usrp-headers/gnuradio-examples/python/digital/transmit_path.py:11378-11390
/gnuradio/branches/developers/michaelld/am_swig_4/gnuradio-examples/python/digital/transmit_path_lb.py:10555-10595
/gnuradio/branches/developers/michaelld/two_mods/gnuradio-examples/python/digital/transmit_path_lb.py:10540-10546
/gnuradio/branches/developers/trondeau/qt/gnuradio-examples/python/digital/transmit_path.py:11235-11360
/gnuradio/branches/developers/trondeau/qtdigital/gnuradio-examples/python/digital/transmit_path.py:11210-11215

Modified: gnuradio/trunk/gnuradio-examples/python/digital/tunnel.py
===================================================================
--- gnuradio/trunk/gnuradio-examples/python/digital/tunnel.py   2009-07-09 
23:28:38 UTC (rev 11405)
+++ gnuradio/trunk/gnuradio-examples/python/digital/tunnel.py   2009-07-10 
00:36:36 UTC (rev 11406)
@@ -46,8 +46,8 @@
 import os
 
 # from current dir
-from transmit_path import transmit_path
-from receive_path import receive_path
+import usrp_transmit_path
+import usrp_receive_path
 
 #print os.getpid()
 #raw_input('Attach and press enter')
@@ -91,11 +91,11 @@
                  rx_callback, options):
 
         gr.top_block.__init__(self)
-        self.txpath = transmit_path(mod_class, options)
-        self.rxpath = receive_path(demod_class, rx_callback, options)
-       self.connect(self.txpath);
-       self.connect(self.rxpath);
-       
+        self.txpath = usrp_transmit_path.usrp_transmit_path(mod_class, options)
+        self.rxpath = usrp_receive_path.usrp_receive_path(demod_class, 
rx_callback, options)
+        self.connect(self.txpath)
+        self.connect(self.rxpath)
+
     def send_pkt(self, payload='', eof=False):
         return self.txpath.send_pkt(payload, eof)
 
@@ -180,7 +180,10 @@
 
     parser = OptionParser (option_class=eng_option, conflict_handler="resolve")
     expert_grp = parser.add_option_group("Expert")
-
+    expert_grp.add_option("", "--rx-freq", type="eng_float", default=None,
+                          help="set Rx frequency to FREQ [default=%default]", 
metavar="FREQ")
+    expert_grp.add_option("", "--tx-freq", type="eng_float", default=None,
+                          help="set transmit frequency to FREQ 
[default=%default]", metavar="FREQ")
     parser.add_option("-m", "--modulation", type="choice", choices=mods.keys(),
                       default='gmsk',
                       help="Select modulation from: %s [default=%%default]"
@@ -192,8 +195,8 @@
     expert_grp.add_option("","--tun-device-filename", default="/dev/net/tun",
                           help="path to tun device file [default=%default]")
 
-    transmit_path.add_options(parser, expert_grp)
-    receive_path.add_options(parser, expert_grp)
+    usrp_transmit_path.add_options(parser, expert_grp)
+    usrp_receive_path.add_options(parser, expert_grp)
 
     for mod in mods.values():
         mod.add_options(expert_grp)
@@ -206,11 +209,6 @@
         parser.print_help(sys.stderr)
         sys.exit(1)
 
-    if options.rx_freq is None or options.tx_freq is None:
-        sys.stderr.write("You must specify -f FREQ or --freq FREQ\n")
-        parser.print_help(sys.stderr)
-        sys.exit(1)
-
     # open the TUN/TAP interface
     (tun_fd, tun_ifname) = open_tun_interface(options.tun_device_filename)
 

Modified: gnuradio/trunk/gnuradio-examples/python/digital/tx_voice.py
===================================================================
--- gnuradio/trunk/gnuradio-examples/python/digital/tx_voice.py 2009-07-09 
23:28:38 UTC (rev 11405)
+++ gnuradio/trunk/gnuradio-examples/python/digital/tx_voice.py 2009-07-10 
00:36:36 UTC (rev 11406)
@@ -35,7 +35,7 @@
 import sys
 
 # from current dir
-from transmit_path import transmit_path
+import usrp_transmit_path
 
 #import os
 #print os.getpid()
@@ -64,7 +64,7 @@
 
     def __init__(self, modulator_class, options):
         gr.top_block.__init__(self)
-        self.txpath = transmit_path(modulator_class, options)
+        self.txpath = usrp_transmit_path.usrp_transmit_path(modulator_class, 
options)
         self.audio_rx = audio_rx(options.audio_input)
        self.connect(self.txpath)
        self.connect(self.audio_rx)
@@ -95,9 +95,8 @@
                       help="set megabytes to transmit [default=inf]")
     parser.add_option("-I", "--audio-input", type="string", default="",
                       help="pcm input device name.  E.g., hw:0,0 or /dev/dsp")
+    usrp_transmit_path.add_options(parser, expert_grp)
 
-    transmit_path.add_options(parser, expert_grp)
-
     for mod in mods.values():
         mod.add_options(expert_grp)
 

Copied: gnuradio/trunk/gnuradio-examples/python/digital/usrp_receive_path.py 
(from rev 11405, 
gnuradio/branches/developers/jblum/digital/usrp_receive_path.py)
===================================================================
--- gnuradio/trunk/gnuradio-examples/python/digital/usrp_receive_path.py        
                        (rev 0)
+++ gnuradio/trunk/gnuradio-examples/python/digital/usrp_receive_path.py        
2009-07-10 00:36:36 UTC (rev 11406)
@@ -0,0 +1,86 @@
+#
+# Copyright 2009 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 3, 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., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+# 
+
+from gnuradio import gr
+import usrp_options
+import receive_path
+from pick_bitrate import pick_rx_bitrate
+from gnuradio import eng_notation
+
+def add_freq_option(parser):
+    """
+    Hackery that has the -f / --freq option set both tx_freq and rx_freq
+    """
+    def freq_callback(option, opt_str, value, parser):
+        parser.values.rx_freq = value
+        parser.values.tx_freq = value
+
+    if not parser.has_option('--freq'):
+        parser.add_option('-f', '--freq', type="eng_float",
+                          action="callback", callback=freq_callback,
+                          help="set Tx and/or Rx frequency to FREQ 
[default=%default]",
+                          metavar="FREQ")
+
+def add_options(parser, expert):
+    add_freq_option(parser)
+    usrp_options.add_rx_options(parser)
+    receive_path.receive_path.add_options(parser, expert)
+    expert.add_option("", "--rx-freq", type="eng_float", default=None,
+                          help="set Rx frequency to FREQ [default=%default]", 
metavar="FREQ")
+    parser.add_option("-v", "--verbose", action="store_true", default=False)
+
+class usrp_receive_path(gr.hier_block2):
+
+    def __init__(self, demod_class, rx_callback, options):
+        '''
+        See below for what options should hold
+        '''
+        gr.hier_block2.__init__(self, "usrp_receive_path",
+                gr.io_signature(0, 0, 0),                    # Input signature
+                gr.io_signature(0, 0, 0)) # Output signature
+        if options.rx_freq is None:
+            sys.stderr.write("-f FREQ or --freq FREQ or --rx-freq FREQ must be 
specified\n")
+            raise SystemExit
+        rx_path = receive_path.receive_path(demod_class, rx_callback, options)
+        for attr in dir(rx_path): #forward the methods
+            if not attr.startswith('_') and not hasattr(self, attr):
+                setattr(self, attr, getattr(rx_path, attr))
+        #setup usrp
+        self._demod_class = demod_class
+        self._setup_usrp_source(options)
+        #connect
+        self.connect(self.u, rx_path)
+
+    def _setup_usrp_source(self, options):
+        self.u = usrp_options.create_usrp_source(options)
+        adc_rate = self.u.adc_rate()
+        if options.verbose:
+            print 'USRP Source:', self.u
+        (self._bitrate, self._samples_per_symbol, self._decim) = \
+                        pick_rx_bitrate(options.bitrate, 
self._demod_class.bits_per_symbol(), \
+                                        options.samples_per_symbol, 
options.decim, adc_rate,  \
+                                        self.u.get_decim_rates())
+
+        self.u.set_decim(self._decim)
+
+        if not self.u.set_center_freq(options.rx_freq):
+            print "Failed to set Rx frequency to %s" % 
(eng_notation.num_to_str(options.rx_freq))
+            raise ValueError, eng_notation.num_to_str(options.rx_freq)

Copied: gnuradio/trunk/gnuradio-examples/python/digital/usrp_transmit_path.py 
(from rev 11405, 
gnuradio/branches/developers/jblum/digital/usrp_transmit_path.py)
===================================================================
--- gnuradio/trunk/gnuradio-examples/python/digital/usrp_transmit_path.py       
                        (rev 0)
+++ gnuradio/trunk/gnuradio-examples/python/digital/usrp_transmit_path.py       
2009-07-10 00:36:36 UTC (rev 11406)
@@ -0,0 +1,90 @@
+#
+# Copyright 2009 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 3, 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., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+# 
+
+from gnuradio import gr
+import usrp_options
+import transmit_path
+from pick_bitrate import pick_tx_bitrate
+from gnuradio import eng_notation
+
+def add_freq_option(parser):
+    """
+    Hackery that has the -f / --freq option set both tx_freq and rx_freq
+    """
+    def freq_callback(option, opt_str, value, parser):
+        parser.values.rx_freq = value
+        parser.values.tx_freq = value
+
+    if not parser.has_option('--freq'):
+        parser.add_option('-f', '--freq', type="eng_float",
+                          action="callback", callback=freq_callback,
+                          help="set Tx and/or Rx frequency to FREQ 
[default=%default]",
+                          metavar="FREQ")
+
+def add_options(parser, expert):
+    add_freq_option(parser)
+    usrp_options.add_tx_options(parser)
+    transmit_path.transmit_path.add_options(parser, expert)
+    expert.add_option("", "--tx-freq", type="eng_float", default=None,
+                          help="set transmit frequency to FREQ 
[default=%default]", metavar="FREQ")
+    parser.add_option("-v", "--verbose", action="store_true", default=False)
+
+class usrp_transmit_path(gr.hier_block2):
+    def __init__(self, modulator_class, options):
+        '''
+        See below for what options should hold
+        '''
+        gr.hier_block2.__init__(self, "usrp_transmit_path",
+                gr.io_signature(0, 0, 0),                    # Input signature
+                gr.io_signature(0, 0, 0)) # Output signature
+        if options.tx_freq is None:
+            sys.stderr.write("-f FREQ or --freq FREQ or --tx-freq FREQ must be 
specified\n")
+            raise SystemExit
+        tx_path = transmit_path.transmit_path(modulator_class, options)
+        for attr in dir(tx_path): #forward the methods
+            if not attr.startswith('_') and not hasattr(self, attr):
+                setattr(self, attr, getattr(tx_path, attr))
+        #setup usrp
+        self._modulator_class = modulator_class
+        self._setup_usrp_sink(options)
+        #connect
+        self.connect(tx_path, self.u)
+
+    def _setup_usrp_sink(self, options):
+        """
+        Creates a USRP sink, determines the settings for best bitrate,
+        and attaches to the transmitter's subdevice.
+        """
+        self.u = usrp_options.create_usrp_sink(options)
+        dac_rate = self.u.dac_rate()
+        if options.verbose:
+            print 'USRP Sink:', self.u
+        (self._bitrate, self._samples_per_symbol, self._interp) = \
+                        pick_tx_bitrate(options.bitrate, 
self._modulator_class.bits_per_symbol(), \
+                                        options.samples_per_symbol, 
options.interp, dac_rate, \
+                                        self.u.get_interp_rates())
+
+        self.u.set_interp(self._interp)
+        self.u.set_auto_tr(True)
+
+        if not self.u.set_center_freq(options.tx_freq):
+            print "Failed to set Rx frequency to %s" % 
(eng_notation.num_to_str(options.tx_freq))
+            raise ValueError, eng_notation.num_to_str(options.tx_freq)





reply via email to

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