commit-gnuradio
[Top][All Lists]
Advanced

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

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


From: trondeau
Subject: [Commit-gnuradio] r11224 - gnuradio/trunk/gnuradio-examples/python/digital
Date: Wed, 17 Jun 2009 16:48:04 -0600 (MDT)

Author: trondeau
Date: 2009-06-17 16:48:03 -0600 (Wed, 17 Jun 2009)
New Revision: 11224

Modified:
   gnuradio/trunk/gnuradio-examples/python/digital/benchmark_rx.py
Log:
Fixing digital benchmarks: adding usrp_options class to reciever.

Modified: gnuradio/trunk/gnuradio-examples/python/digital/benchmark_rx.py
===================================================================
--- gnuradio/trunk/gnuradio-examples/python/digital/benchmark_rx.py     
2009-06-17 20:40:54 UTC (rev 11223)
+++ gnuradio/trunk/gnuradio-examples/python/digital/benchmark_rx.py     
2009-06-17 22:48:03 UTC (rev 11224)
@@ -32,6 +32,8 @@
 
 # from current dir
 from receive_path import receive_path
+from pick_bitrate import pick_rx_bitrate
+import usrp_options
 
 #import os
 #print os.getpid()
@@ -43,44 +45,44 @@
 
         self._rx_freq            = options.rx_freq         # receiver's center 
frequency
         self._rx_gain            = options.rx_gain         # receiver's gain
-        self._rx_subdev_spec     = options.rx_subdev_spec  # daughterboard to 
use
         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()
+        self._setup_usrp_source(options)
         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)
-        g = self.subdev.gain_range()
-        if options.show_rx_gain_range:
-            print "Rx Gain Range: minimum = %g, maximum = %g, step size = %g" \
-                  % (g[0], g[1], g[2])
+
         self.set_gain(options.rx_gain)
-        self.set_auto_tr(True)                 # enable Auto Transmit/Receive 
switching
+        #self.set_auto_tr(True)                 # enable Auto Transmit/Receive 
switching
 
         # Set up receive path
         self.rxpath = receive_path(demodulator, rx_callback, options) 
 
         self.connect(self.u, self.rxpath)
         
-    def _setup_usrp_source(self):
-        self.u = usrp.source_c ()
+    def _setup_usrp_source(self, options):
+        self.u = usrp_options.create_usrp_source(options)
         adc_rate = self.u.adc_rate()
 
-        self.u.set_decim_rate(self._decim)
+        self.u.set_decim(self._decim)
 
-        # determine the daughterboard subdevice we're using
-        if self._rx_subdev_spec is None:
-            self._rx_subdev_spec = usrp.pick_rx_subdevice(self.u)
-        self.subdev = usrp.selected_subdev(self.u, self._rx_subdev_spec)
+        (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_mux(usrp.determine_rx_mux_value(self.u, 
self._rx_subdev_spec))
+        self.u.set_decim(self._decim)
 
+
     def set_freq(self, target_freq):
         """
         Set the center frequency we're interested in.
@@ -93,21 +95,17 @@
         the result of that operation and our target_frequency to
         determine the value for the digital up converter.
         """
-        r = self.u.tune(0, self.subdev, target_freq)
-        if r:
-            return True
+        return self.u.set_center_freq(target_freq)
 
-        return False
-
     def set_gain(self, gain):
         """
         Sets the analog gain in the USRP
         """
         if gain is None:
-            r = self.subdev.gain_range()
+            r = self.u.gain_range()
             gain = (r[0] + r[1])/2               # set gain to midpoint
         self.gain = gain
-        return self.subdev.set_gain(gain)
+        return self.u.set_gain(gain)
 
     def set_auto_tr(self, enable):
         return self.subdev.set_auto_tr(enable)
@@ -120,20 +118,10 @@
         Adds usrp-specific options to the Options Parser
         """
         add_freq_option(normal)
-        normal.add_option("-R", "--rx-subdev-spec", type="subdev", 
default=None,
-                          help="select USRP Rx side A or B")
-        normal.add_option("", "--rx-gain", type="eng_float", default=None, 
metavar="GAIN",
-                          help="set receiver gain in dB [default=midpoint].  
See also --show-rx-gain-range")
-        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("", "--rx-freq", type="eng_float", default=None,
                           help="set Rx frequency to FREQ [default=%default]", 
metavar="FREQ")
-        expert.add_option("-d", "--decim", type="intx", default=128,
-                          help="set fpga decimation rate to DECIM 
[default=%default]")
-        expert.add_option("", "--snr", type="eng_float", default=30,
-                          help="set the SNR of the channel in dB 
[default=%default]")
    
 
     # Make a static method to call before instantiation
@@ -191,6 +179,7 @@
 
     my_top_block.add_options(parser, expert_grp)
     receive_path.add_options(parser, expert_grp)
+    usrp_options.add_rx_options(parser)
 
     for mod in demods.values():
         mod.add_options(expert_grp)





reply via email to

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