summaryrefslogtreecommitdiff
path: root/gr-digital/examples/ofdm
diff options
context:
space:
mode:
Diffstat (limited to 'gr-digital/examples/ofdm')
-rwxr-xr-xgr-digital/examples/ofdm/benchmark_rx.py3
-rwxr-xr-xgr-digital/examples/ofdm/benchmark_tx.py3
-rwxr-xr-xgr-digital/examples/ofdm/tunnel.py6
-rw-r--r--gr-digital/examples/ofdm/uhd_interface.py22
4 files changed, 25 insertions, 9 deletions
diff --git a/gr-digital/examples/ofdm/benchmark_rx.py b/gr-digital/examples/ofdm/benchmark_rx.py
index a386a80e4..57817c501 100755
--- a/gr-digital/examples/ofdm/benchmark_rx.py
+++ b/gr-digital/examples/ofdm/benchmark_rx.py
@@ -41,7 +41,8 @@ class my_top_block(gr.top_block):
self.source = uhd_receiver(options.args,
options.bandwidth,
options.rx_freq, options.rx_gain,
- options.antenna, options.verbose)
+ options.spec, options.antenna,
+ options.verbose)
elif(options.from_file is not None):
self.source = gr.file_source(gr.sizeof_gr_complex, options.from_file)
else:
diff --git a/gr-digital/examples/ofdm/benchmark_tx.py b/gr-digital/examples/ofdm/benchmark_tx.py
index dd0c69b57..5962fe7ec 100755
--- a/gr-digital/examples/ofdm/benchmark_tx.py
+++ b/gr-digital/examples/ofdm/benchmark_tx.py
@@ -40,7 +40,8 @@ class my_top_block(gr.top_block):
self.sink = uhd_transmitter(options.args,
options.bandwidth,
options.tx_freq, options.tx_gain,
- options.antenna, options.verbose)
+ options.spec, options.antenna,
+ options.verbose)
elif(options.to_file is not None):
self.sink = gr.file_sink(gr.sizeof_gr_complex, options.to_file)
else:
diff --git a/gr-digital/examples/ofdm/tunnel.py b/gr-digital/examples/ofdm/tunnel.py
index dc862fbec..e253cf516 100755
--- a/gr-digital/examples/ofdm/tunnel.py
+++ b/gr-digital/examples/ofdm/tunnel.py
@@ -90,12 +90,14 @@ class my_top_block(gr.top_block):
self.source = uhd_receiver(options.args,
options.bandwidth,
options.rx_freq, options.rx_gain,
- options.antenna, options.verbose)
+ options.spec, options.antenna,
+ options.verbose)
self.sink = uhd_transmitter(options.args,
options.bandwidth,
options.tx_freq, options.tx_gain,
- options.antenna, options.verbose)
+ options.spec, options.antenna,
+ options.verbose)
self.txpath = transmit_path(options)
self.rxpath = receive_path(callback, options)
diff --git a/gr-digital/examples/ofdm/uhd_interface.py b/gr-digital/examples/ofdm/uhd_interface.py
index cd2d3152d..476d3c842 100644
--- a/gr-digital/examples/ofdm/uhd_interface.py
+++ b/gr-digital/examples/ofdm/uhd_interface.py
@@ -43,7 +43,7 @@ def add_freq_option(parser):
class uhd_interface:
def __init__(self, istx, args, bandwidth, freq=None,
- gain=None, antenna=None):
+ gain=None, spec=None, antenna=None):
if(istx):
self.u = uhd.usrp_sink(device_addr=args,
@@ -56,11 +56,17 @@ class uhd_interface:
self._args = args
self._ant = antenna
+ self._spec = spec
self._gain = self.set_gain(gain)
self._freq = self.set_freq(freq)
self._rate = self.set_sample_rate(bandwidth)
+ # Set the subdevice spec
+ if(spec):
+ self.u.set_subdev_spec(spec, 0)
+
+ # Set the antenna
if(antenna):
self.u.set_antenna(antenna, 0)
@@ -105,14 +111,14 @@ class uhd_interface:
class uhd_transmitter(uhd_interface, gr.hier_block2):
def __init__(self, args, bandwidth, freq=None, gain=None,
- antenna=None, verbose=False):
+ spec=None, antenna=None, verbose=False):
gr.hier_block2.__init__(self, "uhd_transmitter",
gr.io_signature(1,1,gr.sizeof_gr_complex),
gr.io_signature(0,0,0))
# Set up the UHD interface as a transmitter
uhd_interface.__init__(self, True, args, bandwidth,
- freq, gain, antenna)
+ freq, gain, spec, antenna)
self.connect(self, self.u)
@@ -123,6 +129,8 @@ class uhd_transmitter(uhd_interface, gr.hier_block2):
add_freq_option(parser)
parser.add_option("-a", "--args", type="string", default="",
help="UHD device address args [default=%default]")
+ parser.add_option("", "--spec", type="string", default=None,
+ help="Subdevice of UHD device where appropriate")
parser.add_option("-A", "--antenna", type="string", default=None,
help="select Rx Antenna where appropriate")
parser.add_option("", "--tx-freq", type="eng_float", default=None,
@@ -145,6 +153,7 @@ class uhd_transmitter(uhd_interface, gr.hier_block2):
print "Gain: %f dB" % (self._gain)
print "Sample Rate: %ssps" % (eng_notation.num_to_str(self._rate))
print "Antenna: %s" % (self._ant)
+ print "Subdev Sec: %s" % (self._spec)
@@ -155,14 +164,14 @@ class uhd_transmitter(uhd_interface, gr.hier_block2):
class uhd_receiver(uhd_interface, gr.hier_block2):
def __init__(self, args, bandwidth, freq=None, gain=None,
- antenna=None, verbose=False):
+ spec=None, antenna=None, verbose=False):
gr.hier_block2.__init__(self, "uhd_receiver",
gr.io_signature(0,0,0),
gr.io_signature(1,1,gr.sizeof_gr_complex))
# Set up the UHD interface as a receiver
uhd_interface.__init__(self, False, args, bandwidth,
- freq, gain, antenna)
+ freq, gain, spec, antenna)
self.connect(self.u, self)
@@ -173,6 +182,8 @@ class uhd_receiver(uhd_interface, gr.hier_block2):
add_freq_option(parser)
parser.add_option("-a", "--args", type="string", default="",
help="UHD device address args [default=%default]")
+ parser.add_option("", "--spec", type="string", default=None,
+ help="Subdevice of UHD device where appropriate")
parser.add_option("-A", "--antenna", type="string", default=None,
help="select Rx Antenna where appropriate")
parser.add_option("", "--rx-freq", type="eng_float", default=None,
@@ -196,4 +207,5 @@ class uhd_receiver(uhd_interface, gr.hier_block2):
print "Gain: %f dB" % (self._gain)
print "Sample Rate: %ssps" % (eng_notation.num_to_str(self._rate))
print "Antenna: %s" % (self._ant)
+ print "Subdev Sec: %s" % (self._spec)