[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r11405 - gnuradio/branches/developers/jblum/digital
From: |
jblum |
Subject: |
[Commit-gnuradio] r11405 - gnuradio/branches/developers/jblum/digital |
Date: |
Thu, 9 Jul 2009 17:28:38 -0600 (MDT) |
Author: jblum
Date: 2009-07-09 17:28:38 -0600 (Thu, 09 Jul 2009)
New Revision: 11405
Added:
gnuradio/branches/developers/jblum/digital/usrp_receive_path.py
gnuradio/branches/developers/jblum/digital/usrp_transmit_path.py
Modified:
gnuradio/branches/developers/jblum/digital/Makefile.am
gnuradio/branches/developers/jblum/digital/benchmark_rx.py
gnuradio/branches/developers/jblum/digital/benchmark_tx.py
gnuradio/branches/developers/jblum/digital/rx_voice.py
gnuradio/branches/developers/jblum/digital/tunnel.py
gnuradio/branches/developers/jblum/digital/tx_voice.py
Log:
Made a common usrp rx and tx path to be shared by benchmark, tunnel, voice
Modified: gnuradio/branches/developers/jblum/digital/Makefile.am
===================================================================
--- gnuradio/branches/developers/jblum/digital/Makefile.am 2009-07-09
20:01:25 UTC (rev 11404)
+++ gnuradio/branches/developers/jblum/digital/Makefile.am 2009-07-09
23:28:38 UTC (rev 11405)
@@ -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/branches/developers/jblum/digital/benchmark_rx.py
===================================================================
--- gnuradio/branches/developers/jblum/digital/benchmark_rx.py 2009-07-09
20:01:25 UTC (rev 11404)
+++ gnuradio/branches/developers/jblum/digital/benchmark_rx.py 2009-07-09
23:28:38 UTC (rev 11405)
@@ -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,113 +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)
- usrp_options.add_rx_options(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
# /////////////////////////////////////////////////////////////////////////////
@@ -184,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/branches/developers/jblum/digital/benchmark_tx.py
===================================================================
--- gnuradio/branches/developers/jblum/digital/benchmark_tx.py 2009-07-09
20:01:25 UTC (rev 11404)
+++ gnuradio/branches/developers/jblum/digital/benchmark_tx.py 2009-07-09
23:28:38 UTC (rev 11405)
@@ -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,114 +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)
- usrp_options.add_tx_options(normal)
- 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 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
# /////////////////////////////////////////////////////////////////////////////
@@ -180,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/branches/developers/jblum/digital/rx_voice.py
===================================================================
--- gnuradio/branches/developers/jblum/digital/rx_voice.py 2009-07-09
20:01:25 UTC (rev 11404)
+++ gnuradio/branches/developers/jblum/digital/rx_voice.py 2009-07-09
23:28:38 UTC (rev 11405)
@@ -26,7 +26,6 @@
from gnuradio import eng_notation
from gnuradio.eng_option import eng_option
from optparse import OptionParser
-import usrp_options
from gnuradio.vocoder import gsm_full_rate
@@ -35,7 +34,7 @@
import sys
# from current dir
-from receive_path import receive_path
+import usrp_receive_path
#import os
#print os.getpid()
@@ -62,9 +61,9 @@
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(usrp_options.create_usrp_source(options), self.rxpath)
+ self.connect(self.rxpath)
self.connect(self.audio_tx)
# /////////////////////////////////////////////////////////////////////////////
@@ -102,8 +101,7 @@
% (', '.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_options.add_rx_options(parser)
- receive_path.add_options(parser, expert_grp)
+ usrp_receive_path.add_options(parser, expert_grp)
for mod in demods.values():
mod.add_options(expert_grp)
Modified: gnuradio/branches/developers/jblum/digital/tunnel.py
===================================================================
--- gnuradio/branches/developers/jblum/digital/tunnel.py 2009-07-09
20:01:25 UTC (rev 11404)
+++ gnuradio/branches/developers/jblum/digital/tunnel.py 2009-07-09
23:28:38 UTC (rev 11405)
@@ -38,7 +38,6 @@
from gnuradio import eng_notation
from gnuradio.eng_option import eng_option
from optparse import OptionParser
-import usrp_options
import random
import time
@@ -47,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')
@@ -92,10 +91,10 @@
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, usrp_options.create_usrp_sink(options))
- self.connect(usrp_options.create_usrp_source(options), 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)
@@ -174,21 +173,6 @@
# main
# /////////////////////////////////////////////////////////////////////////////
-
-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 main():
mods = modulation_utils.type_1_mods()
@@ -196,7 +180,6 @@
parser = OptionParser (option_class=eng_option, conflict_handler="resolve")
expert_grp = parser.add_option_group("Expert")
- add_freq_option(parser)
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,
@@ -212,10 +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_options.add_rx_options(parser)
- usrp_options.add_tx_options(parser)
+ 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)
@@ -228,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/branches/developers/jblum/digital/tx_voice.py
===================================================================
--- gnuradio/branches/developers/jblum/digital/tx_voice.py 2009-07-09
20:01:25 UTC (rev 11404)
+++ gnuradio/branches/developers/jblum/digital/tx_voice.py 2009-07-09
23:28:38 UTC (rev 11405)
@@ -26,7 +26,6 @@
from gnuradio import eng_notation
from gnuradio.eng_option import eng_option
from optparse import OptionParser
-import usrp_options
from gnuradio.vocoder import gsm_full_rate
@@ -36,7 +35,7 @@
import sys
# from current dir
-from transmit_path import transmit_path
+import usrp_transmit_path
#import os
#print os.getpid()
@@ -65,9 +64,9 @@
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, usrp_options.create_usrp_sink(options))
+ self.connect(self.txpath)
self.connect(self.audio_rx)
@@ -96,8 +95,7 @@
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_options.add_tx_options(parser)
- transmit_path.add_options(parser, expert_grp)
+ usrp_transmit_path.add_options(parser, expert_grp)
for mod in mods.values():
mod.add_options(expert_grp)
Added: gnuradio/branches/developers/jblum/digital/usrp_receive_path.py
===================================================================
--- gnuradio/branches/developers/jblum/digital/usrp_receive_path.py
(rev 0)
+++ gnuradio/branches/developers/jblum/digital/usrp_receive_path.py
2009-07-09 23:28:38 UTC (rev 11405)
@@ -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)
Added: gnuradio/branches/developers/jblum/digital/usrp_transmit_path.py
===================================================================
--- gnuradio/branches/developers/jblum/digital/usrp_transmit_path.py
(rev 0)
+++ gnuradio/branches/developers/jblum/digital/usrp_transmit_path.py
2009-07-09 23:28:38 UTC (rev 11405)
@@ -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)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r11405 - gnuradio/branches/developers/jblum/digital,
jblum <=