diff options
Diffstat (limited to 'gr-digital')
-rwxr-xr-x | gr-digital/examples/narrowband/benchmark_rx.py | 3 | ||||
-rwxr-xr-x | gr-digital/examples/narrowband/benchmark_tx.py | 3 | ||||
-rwxr-xr-x | gr-digital/examples/narrowband/tunnel.py | 8 | ||||
-rw-r--r-- | gr-digital/examples/narrowband/uhd_interface.py | 24 | ||||
-rwxr-xr-x | gr-digital/examples/ofdm/benchmark_rx.py | 3 | ||||
-rwxr-xr-x | gr-digital/examples/ofdm/benchmark_tx.py | 3 | ||||
-rwxr-xr-x | gr-digital/examples/ofdm/tunnel.py | 6 | ||||
-rw-r--r-- | gr-digital/examples/ofdm/uhd_interface.py | 22 |
8 files changed, 51 insertions, 21 deletions
diff --git a/gr-digital/examples/narrowband/benchmark_rx.py b/gr-digital/examples/narrowband/benchmark_rx.py index 32c3222ae..1962fdc4b 100755 --- a/gr-digital/examples/narrowband/benchmark_rx.py +++ b/gr-digital/examples/narrowband/benchmark_rx.py @@ -51,7 +51,8 @@ class my_top_block(gr.top_block): self.source = uhd_receiver(options.args, symbol_rate, options.samples_per_symbol, options.rx_freq, options.rx_gain, - options.antenna, options.verbose) + options.spec, options.antenna, + options.verbose) options.samples_per_symbol = self.source._sps elif(options.from_file is not None): diff --git a/gr-digital/examples/narrowband/benchmark_tx.py b/gr-digital/examples/narrowband/benchmark_tx.py index 25ed355da..9afacb495 100755 --- a/gr-digital/examples/narrowband/benchmark_tx.py +++ b/gr-digital/examples/narrowband/benchmark_tx.py @@ -50,7 +50,8 @@ class my_top_block(gr.top_block): self.sink = uhd_transmitter(options.args, symbol_rate, options.samples_per_symbol, options.tx_freq, options.tx_gain, - options.antenna, options.verbose) + options.spec, options.antenna, + options.verbose) options.samples_per_symbol = self.sink._sps elif(options.to_file is not None): diff --git a/gr-digital/examples/narrowband/tunnel.py b/gr-digital/examples/narrowband/tunnel.py index 7414a7227..65205b9f6 100755 --- a/gr-digital/examples/narrowband/tunnel.py +++ b/gr-digital/examples/narrowband/tunnel.py @@ -99,12 +99,14 @@ class my_top_block(gr.top_block): self.source = uhd_receiver(options.args, symbol_rate, options.samples_per_symbol, options.rx_freq, options.rx_gain, - options.antenna, options.verbose) - + options.spec, options.antenna, + options.verbose) + self.sink = uhd_transmitter(options.args, symbol_rate, options.samples_per_symbol, options.tx_freq, options.tx_gain, - options.antenna, options.verbose) + options.spec, options.antenna, + options.verbose) options.samples_per_symbol = self.source._sps diff --git a/gr-digital/examples/narrowband/uhd_interface.py b/gr-digital/examples/narrowband/uhd_interface.py index a0be516ec..21930ad01 100644 --- a/gr-digital/examples/narrowband/uhd_interface.py +++ b/gr-digital/examples/narrowband/uhd_interface.py @@ -43,7 +43,7 @@ def add_freq_option(parser): class uhd_interface: def __init__(self, istx, args, sym_rate, sps, 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._sps = self.set_sample_rate(sym_rate, sps) + # Set the subdevice spec + if(spec): + self.u.set_subdev_spec(spec, 0) + + # Set the antenna if(antenna): self.u.set_antenna(antenna, 0) @@ -125,14 +131,14 @@ class uhd_interface: class uhd_transmitter(uhd_interface, gr.hier_block2): def __init__(self, args, sym_rate, sps, 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, sym_rate, sps, - freq, gain, antenna) + freq, gain, spec, antenna) self.connect(self, self.u) @@ -143,6 +149,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, @@ -165,7 +173,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) #-------------------------------------------------------------------# @@ -175,14 +183,14 @@ class uhd_transmitter(uhd_interface, gr.hier_block2): class uhd_receiver(uhd_interface, gr.hier_block2): def __init__(self, args, sym_rate, sps, 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, sym_rate, sps, - freq, gain, antenna) + freq, gain, spec, antenna) self.connect(self.u, self) @@ -193,6 +201,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, @@ -216,4 +226,4 @@ 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 "Spec: %s" % (self._spec) 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) |