summaryrefslogtreecommitdiff
path: root/gr-digital
diff options
context:
space:
mode:
authorTom Rondeau2011-09-27 16:59:41 -0400
committerTom Rondeau2011-09-27 16:59:41 -0400
commit199487167956a6149d1a895397b72d2525b39742 (patch)
tree25d8fcf6f23d31967dea66eeef5ecf0244c76d4b /gr-digital
parentb6cd070a9b6422672409bfb43232db265a31998b (diff)
downloadgnuradio-199487167956a6149d1a895397b72d2525b39742.tar.gz
gnuradio-199487167956a6149d1a895397b72d2525b39742.tar.bz2
gnuradio-199487167956a6149d1a895397b72d2525b39742.zip
digital: fixed up benchmark codes to handle receive, too. Over-the-air tests worked.
Diffstat (limited to 'gr-digital')
-rwxr-xr-xgr-digital/examples/benchmark_rx.py24
-rwxr-xr-xgr-digital/examples/benchmark_tx.py1
-rw-r--r--gr-digital/examples/receive_path.py15
3 files changed, 23 insertions, 17 deletions
diff --git a/gr-digital/examples/benchmark_rx.py b/gr-digital/examples/benchmark_rx.py
index 9390540dd..7eb4fb9b4 100755
--- a/gr-digital/examples/benchmark_rx.py
+++ b/gr-digital/examples/benchmark_rx.py
@@ -21,7 +21,6 @@
#
from gnuradio import gr, gru
-from gnuradio import usrp
from gnuradio import eng_notation
from gnuradio.eng_option import eng_option
from optparse import OptionParser
@@ -31,6 +30,7 @@ from gnuradio import digital
# from current dir
from receive_path import receive_path
+from uhd_interface import uhd_receiver
import random
import struct
@@ -44,17 +44,24 @@ class my_top_block(gr.top_block):
def __init__(self, demodulator, rx_callback, options):
gr.top_block.__init__(self)
- # Set up receive path
- self.rxpath = receive_path(demodulator, rx_callback, options)
+ if(options.tx_freq is not None):
+ self.source = uhd_receiver(options.address, options.bitrate,
+ options.samples_per_symbol,
+ options.rx_freq, options.rx_gain,
+ options.antenna, options.verbose)
+ options.samples_per_symbol = self.source._sps
- if(options.from_file is not None):
- self.thr = gr.throttle(gr.sizeof_gr_complex, 1e6)
+ elif(options.from_file is not None):
self.source = gr.file_source(gr.sizeof_gr_complex, options.from_file)
- self.connect(self.source, self.thr, self.rxpath)
else:
- self.thr = gr.throttle(gr.sizeof_gr_complex, 1e6)
self.source = gr.null_source(gr.sizeof_gr_complex)
- self.connect(self.source, self.thr, self.rxpath)
+
+ # Set up receive path
+ # do this after for any adjustments to the options that may
+ # occur in the sinks (specifically the UHD sink)
+ self.rxpath = receive_path(demodulator, rx_callback, options)
+
+ self.connect(self.source, self.rxpath)
# /////////////////////////////////////////////////////////////////////////////
@@ -93,6 +100,7 @@ def main():
help="input file of samples to demod")
receive_path.add_options(parser, expert_grp)
+ uhd_receiver.add_options(parser)
for mod in demods.values():
mod.add_options(expert_grp)
diff --git a/gr-digital/examples/benchmark_tx.py b/gr-digital/examples/benchmark_tx.py
index dd8b4ea9a..a4396dd98 100755
--- a/gr-digital/examples/benchmark_tx.py
+++ b/gr-digital/examples/benchmark_tx.py
@@ -21,7 +21,6 @@
#
from gnuradio import gr
-from gnuradio import uhd
from gnuradio import eng_notation
from gnuradio.eng_option import eng_option
from optparse import OptionParser
diff --git a/gr-digital/examples/receive_path.py b/gr-digital/examples/receive_path.py
index dd8eb1a0d..1c5e58963 100644
--- a/gr-digital/examples/receive_path.py
+++ b/gr-digital/examples/receive_path.py
@@ -34,17 +34,16 @@ import sys
class receive_path(gr.hier_block2):
def __init__(self, demod_class, rx_callback, options):
gr.hier_block2.__init__(self, "receive_path",
- gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
- gr.io_signature(0, 0, 0)) # Output signature
-
+ gr.io_signature(1, 1, gr.sizeof_gr_complex),
+ gr.io_signature(0, 0, 0))
options = copy.copy(options) # make a copy so we can destructively modify
- self._verbose = options.verbose
- self._bitrate = options.bitrate # desired bit rate
+ self._verbose = options.verbose
+ self._bitrate = options.bitrate # desired bit rate
- self._rx_callback = rx_callback # this callback is fired when there's a packet available
- self._demod_class = demod_class # the demodulator_class we're using
+ self._rx_callback = rx_callback # this callback is fired when a packet arrives
+ self._demod_class = demod_class # the demodulator_class we're using
# Get demod_kwargs
demod_kwargs = self._demod_class.extract_kwargs_from_options(options)
@@ -126,7 +125,7 @@ class receive_path(gr.hier_block2):
normal.add_option("-r", "--bitrate", type="eng_float", default=100e3,
help="specify bitrate [default=%default].")
normal.add_option("-v", "--verbose", action="store_true", default=False)
- expert.add_option("-S", "--samples-per-symbol", type="float", default=None,
+ expert.add_option("-S", "--samples-per-symbol", type="float", default=2,
help="set samples/symbol [default=%default]")
expert.add_option("", "--log", action="store_true", default=False,
help="Log all parts of flow graph to files (CAUTION: lots of data)")