summaryrefslogtreecommitdiff
path: root/gr-utils
diff options
context:
space:
mode:
Diffstat (limited to 'gr-utils')
-rw-r--r--gr-utils/src/python/Makefile.am9
-rwxr-xr-xgr-utils/src/python/lsusrp75
-rwxr-xr-xgr-utils/src/python/usrp2_rx_cfile.py144
-rwxr-xr-xgr-utils/src/python/usrp_print_db.py42
-rwxr-xr-xgr-utils/src/python/usrp_rx_cfile.py108
-rwxr-xr-xgr-utils/src/python/usrp_test_counting.py53
-rwxr-xr-xgr-utils/src/python/usrp_test_loopback.py65
7 files changed, 1 insertions, 495 deletions
diff --git a/gr-utils/src/python/Makefile.am b/gr-utils/src/python/Makefile.am
index 450032266..b422bfd05 100644
--- a/gr-utils/src/python/Makefile.am
+++ b/gr-utils/src/python/Makefile.am
@@ -50,16 +50,9 @@ bin_SCRIPTS = \
gr_plot_short.py \
gr_plot_qt.py \
gr_filter_design.py \
- lsusrp \
usrp_fft.py \
usrp_oscope.py \
- usrp_print_db.py \
- usrp_rx_cfile.py \
usrp_rx_nogui.py \
usrp_siggen.py \
usrp_siggen_gui.py \
- usrp_test_counting.py \
- usrp_test_loopback.py \
- usrp2_fft.py \
- usrp2_rx_cfile.py
-
+ usrp2_fft.py
diff --git a/gr-utils/src/python/lsusrp b/gr-utils/src/python/lsusrp
deleted file mode 100755
index d2eab33fe..000000000
--- a/gr-utils/src/python/lsusrp
+++ /dev/null
@@ -1,75 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2008 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.
-#
-
-MAX_USRPS = 8
-
-from gnuradio import usrp
-from optparse import OptionParser
-
-def disp_usrp(which, serial=None):
- u_source = usrp.source_c(which=which)
- u_sink = usrp.sink_c(which=which)
- u_serial = u_source.serial_number()
-
- if serial is not None:
- if serial != u_serial:
- raise ValueError
-
- print "USRP", which, "serial number", u_source.serial_number()
- subdev_A_rx = usrp.selected_subdev(u_source, (0,0))
- subdev_B_rx = usrp.selected_subdev(u_source, (1,0))
- subdev_A_tx = usrp.selected_subdev(u_sink, (0,0))
- subdev_B_tx = usrp.selected_subdev(u_sink, (1,0))
- print " RX d'board %s" % (subdev_A_rx.side_and_name(),)
- print " RX d'board %s" % (subdev_B_rx.side_and_name(),)
- print " TX d'board %s" % (subdev_A_tx.side_and_name(),)
- print " TX d'board %s" % (subdev_B_tx.side_and_name(),)
-
-if __name__ == "__main__":
- parser = OptionParser()
- parser.add_option("-w", "--which", type="int", default=None,
- help="select which USRP (0, 1, ...) default is all found",
- metavar="NUM")
- parser.add_option("-s", "--serial", default=None,
- help="select USRP by serial number",
- metavar="SER")
- (options, args) = parser.parse_args()
- if len(args) > 0:
- print parser.print_help()
- raise SystemExit, 1
-
- if options.serial is not None and options.which is not None:
- print "Use of --which or --serial is exclusive"
- raise SystemExit, 1
-
- if options.which is not None:
- try:
- disp_usrp(options.which)
- except:
- print "USRP", options.which, "not found."
- else:
- for n in range(MAX_USRPS):
- try:
- disp_usrp(n, options.serial)
- except:
- pass
-
diff --git a/gr-utils/src/python/usrp2_rx_cfile.py b/gr-utils/src/python/usrp2_rx_cfile.py
deleted file mode 100755
index 1f23eee4e..000000000
--- a/gr-utils/src/python/usrp2_rx_cfile.py
+++ /dev/null
@@ -1,144 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2004,2005,2007,2008,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.
-#
-
-"""
-Read samples from the USRP2 and write to file formatted as binary
-outputs single precision complex float values or complex short values
-(interleaved 16 bit signed short integers).
-"""
-
-from gnuradio import gr, eng_notation
-from gnuradio import usrp2
-from gnuradio.eng_option import eng_option
-from optparse import OptionParser
-import sys
-
-n2s = eng_notation.num_to_str
-
-class rx_cfile_block(gr.top_block):
-
- def __init__(self, options, filename):
- gr.top_block.__init__(self)
-
- # Create a USRP2 source
- if options.output_shorts:
- self._u = usrp2.source_16sc(options.interface, options.mac_addr)
- self._sink = gr.file_sink(gr.sizeof_short*2, filename)
- else:
- self._u = usrp2.source_32fc(options.interface, options.mac_addr)
- self._sink = gr.file_sink(gr.sizeof_gr_complex, filename)
-
- # Set receiver decimation rate
- self._u.set_decim(options.decim)
-
- # Set receive daughterboard gain
- if options.gain is None:
- g = self._u.gain_range()
- options.gain = float(g[0]+g[1])/2
- print "Using mid-point gain of", options.gain, "(", g[0], "-", g[1], ")"
- self._u.set_gain(options.gain)
-
- # Set receive frequency
- if options.lo_offset is not None:
- self._u.set_lo_offset(options.lo_offset)
-
- tr = self._u.set_center_freq(options.freq)
- if tr == None:
- sys.stderr.write('Failed to set center frequency\n')
- raise SystemExit, 1
-
- # Create head block if needed and wire it up
- if options.nsamples is None:
- self.connect(self._u, self._sink)
- else:
- if options.output_shorts:
- self._head = gr.head(gr.sizeof_short*2, int(options.nsamples))
- else:
- self._head = gr.head(gr.sizeof_gr_complex, int(options.nsamples))
-
- self.connect(self._u, self._head, self._sink)
-
- input_rate = self._u.adc_rate()/self._u.decim()
-
- if options.verbose:
- print "Network interface:", options.interface
- print "USRP2 address:", self._u.mac_addr()
- print "Using RX d'board id 0x%04X" % (self._u.daughterboard_id(),)
- print "Rx gain:", options.gain
- print "Rx baseband frequency:", n2s(tr.baseband_freq)
- print "Rx DDC frequency:", n2s(tr.dxc_freq)
- print "Rx residual frequency:", n2s(tr.residual_freq)
- print "Rx decimation rate:", options.decim
- print "Rx sample rate:", n2s(input_rate)
- if options.nsamples is None:
- print "Receiving samples until Ctrl-C"
- else:
- print "Receving", n2s(options.nsamples), "samples"
- if options.output_shorts:
- print "Writing 16-bit complex shorts"
- else:
- print "Writing 32-bit complex floats"
- print "Output filename:", filename
-
-def get_options():
- usage="%prog: [options] output_filename"
- parser = OptionParser(option_class=eng_option, usage=usage)
- parser.add_option("-e", "--interface", type="string", default="eth0",
- help="use specified Ethernet interface [default=%default]")
- parser.add_option("-m", "--mac-addr", type="string", default="",
- help="use USRP2 at specified MAC address [default=None]")
- parser.add_option("-d", "--decim", type="int", default=16,
- help="set fgpa decimation rate to DECIM [default=%default]")
- parser.add_option("-f", "--freq", type="eng_float", default=None,
- help="set frequency to FREQ", metavar="FREQ")
- parser.add_option("-g", "--gain", type="eng_float", default=None,
- help="set gain in dB (default is midpoint)")
- parser.add_option( "-s","--output-shorts", action="store_true", default=False,
- help="output interleaved shorts instead of complex floats")
- parser.add_option("-N", "--nsamples", type="eng_float", default=None,
- help="number of samples to collect [default=+inf]")
- parser.add_option("-v", "--verbose", action="store_true", default=False,
- help="verbose output")
- parser.add_option("", "--lo-offset", type="eng_float", default=None,
- help="set daughterboard LO offset to OFFSET [default=hw default]")
-
- (options, args) = parser.parse_args ()
- if len(args) != 1:
- parser.print_help()
- raise SystemExit, 1
-
- if options.freq is None:
- parser.print_help()
- sys.stderr.write('You must specify the frequency with -f FREQ\n');
- raise SystemExit, 1
-
- return (options, args[0])
-
-
-if __name__ == '__main__':
- (options, filename) = get_options()
- tb = rx_cfile_block(options, filename)
-
- try:
- tb.run()
- except KeyboardInterrupt:
- pass
diff --git a/gr-utils/src/python/usrp_print_db.py b/gr-utils/src/python/usrp_print_db.py
deleted file mode 100755
index b082cb073..000000000
--- a/gr-utils/src/python/usrp_print_db.py
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2006,2007 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.
-#
-
-#!/usr/bin/env python
-
-from gnuradio import gr
-from gnuradio import usrp
-from optparse import OptionParser
-from usrpm import usrp_dbid
-
-u_source = usrp.source_c()
-u_sink = usrp.sink_c()
-
-subdev_Ar = usrp.selected_subdev(u_source, (0,0))
-subdev_Br = usrp.selected_subdev(u_source, (1,0))
-subdev_At = usrp.selected_subdev(u_sink, (0,0))
-subdev_Bt = usrp.selected_subdev(u_sink, (1,0))
-
-print "RX d'board %s" % (subdev_Ar.side_and_name(),)
-print "RX d'board %s" % (subdev_Br.side_and_name(),)
-print "TX d'board %s" % (subdev_At.side_and_name(),)
-print "TX d'board %s" % (subdev_Bt.side_and_name(),)
-
diff --git a/gr-utils/src/python/usrp_rx_cfile.py b/gr-utils/src/python/usrp_rx_cfile.py
deleted file mode 100755
index 3ac9fb56f..000000000
--- a/gr-utils/src/python/usrp_rx_cfile.py
+++ /dev/null
@@ -1,108 +0,0 @@
-#!/usr/bin/env python
-
-"""
-Read samples from the USRP and write to file formatted as binary
-outputs single precision complex float values or complex short values (interleaved 16 bit signed short integers).
-
-"""
-
-from gnuradio import gr, eng_notation
-from gnuradio import audio
-from gnuradio import usrp
-from gnuradio.eng_option import eng_option
-from optparse import OptionParser
-import sys
-
-class my_top_block(gr.top_block):
-
- def __init__(self):
- gr.top_block.__init__(self)
-
- usage="%prog: [options] output_filename"
- parser = OptionParser(option_class=eng_option, usage=usage)
- parser.add_option("-R", "--rx-subdev-spec", type="subdev", default=(0, 0),
- help="select USRP Rx side A or B (default=A)")
- parser.add_option("-d", "--decim", type="int", default=16,
- help="set fgpa decimation rate to DECIM [default=%default]")
- parser.add_option("-f", "--freq", type="eng_float", default=None,
- help="set frequency to FREQ", metavar="FREQ")
- parser.add_option("-g", "--gain", type="eng_float", default=None,
- help="set gain in dB (default is midpoint)")
- parser.add_option("-8", "--width-8", action="store_true", default=False,
- help="Enable 8-bit samples across USB")
- parser.add_option( "--no-hb", action="store_true", default=False,
- help="don't use halfband filter in usrp")
- parser.add_option( "-s","--output-shorts", action="store_true", default=False,
- help="output interleaved shorts in stead of complex floats")
- parser.add_option("-N", "--nsamples", type="eng_float", default=None,
- help="number of samples to collect [default=+inf]")
- (options, args) = parser.parse_args ()
- if len(args) != 1:
- parser.print_help()
- raise SystemExit, 1
- filename = args[0]
-
- if options.freq is None:
- parser.print_help()
- sys.stderr.write('You must specify the frequency with -f FREQ\n');
- raise SystemExit, 1
-
- # build the graph
- if options.no_hb or (options.decim<8):
- self.fpga_filename="std_4rx_0tx.rbf" #Min decimation of this firmware is 4. contains 4 Rx paths without halfbands and 0 tx paths.
- if options.output_shorts:
- self.u = usrp.source_s(decim_rate=options.decim,fpga_filename=self.fpga_filename)
- else:
- self.u = usrp.source_c(decim_rate=options.decim,fpga_filename=self.fpga_filename)
- else:
- #standard fpga firmware "std_2rxhb_2tx.rbf" contains 2 Rx paths with halfband filters and 2 tx paths (the default) min decimation 8
- if options.output_shorts:
- self.u = usrp.source_s(decim_rate=options.decim)
- else:
- self.u = usrp.source_c(decim_rate=options.decim)
- if options.width_8:
- sample_width = 8
- sample_shift = 8
- format = self.u.make_format(sample_width, sample_shift)
- r = self.u.set_format(format)
- if options.output_shorts:
- self.dst = gr.file_sink(gr.sizeof_short, filename)
- else:
- self.dst = gr.file_sink(gr.sizeof_gr_complex, filename)
- if options.nsamples is None:
- self.connect(self.u, self.dst)
- else:
- if options.output_shorts:
- self.head = gr.head(gr.sizeof_short, int(options.nsamples)*2)
- else:
- self.head = gr.head(gr.sizeof_gr_complex, int(options.nsamples))
- self.connect(self.u, self.head, self.dst)
-
- if options.rx_subdev_spec is None:
- options.rx_subdev_spec = usrp.pick_rx_subdevice(self.u)
- self.u.set_mux(usrp.determine_rx_mux_value(self.u, options.rx_subdev_spec))
-
- # determine the daughterboard subdevice we're using
- self.subdev = usrp.selected_subdev(self.u, options.rx_subdev_spec)
- print "Using RX d'board %s" % (self.subdev.side_and_name(),)
- input_rate = self.u.adc_freq() / self.u.decim_rate()
- print "USB sample rate %s" % (eng_notation.num_to_str(input_rate))
-
- if options.gain is None:
- # if no gain was specified, use the mid-point in dB
- g = self.subdev.gain_range()
- options.gain = float(g[0]+g[1])/2
-
- self.subdev.set_gain(options.gain)
-
- r = self.u.tune(0, self.subdev, options.freq)
- if not r:
- sys.stderr.write('Failed to set frequency\n')
- raise SystemExit, 1
-
-
-if __name__ == '__main__':
- try:
- my_top_block().run()
- except KeyboardInterrupt:
- pass
diff --git a/gr-utils/src/python/usrp_test_counting.py b/gr-utils/src/python/usrp_test_counting.py
deleted file mode 100755
index a8300afe2..000000000
--- a/gr-utils/src/python/usrp_test_counting.py
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2004,2007 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.
-#
-
-"""
-Check Rx path or USRP Rev 1.
-
-This configures the USRP to return a periodic sequence of integers
-"""
-
-from gnuradio import gr
-from gnuradio import usrp
-
-def build_graph ():
- rx_decim = 32
-
- tb = gr.top_block ()
- usrp_rx = usrp.source_s (0, rx_decim, 1, 0x32103210, usrp.FPGA_MODE_COUNTING)
- sink = gr.check_counting_s ()
- tb.connect (usrp_rx, sink)
-
- # file_sink = gr.file_sink (gr.sizeof_short, 'counting.dat')
- # tb.connect (usrp_rx, file_sink)
-
- return tb
-
-def main ():
- tb = build_graph ()
- try:
- tb.run()
- except KeyboardInterrupt:
- pass
-
-if __name__ == '__main__':
- main ()
diff --git a/gr-utils/src/python/usrp_test_loopback.py b/gr-utils/src/python/usrp_test_loopback.py
deleted file mode 100755
index b58ac06ae..000000000
--- a/gr-utils/src/python/usrp_test_loopback.py
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2004,2007 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.
-#
-
-"""
-Digital loopback (Tx to Rx) for the USRP Rev1.
-"""
-
-
-from gnuradio import gr
-from gnuradio import usrp
-
-
-def ramp_source (tb):
- period = 2**16
- src = gr.vector_source_s (range (-period/2, period/2, 1), True)
- return src
-
-def build_graph ():
- tx_interp = 32 # tx should be twice rx
- rx_decim = 16
-
- tb = gr.top_block ()
-
- data_src = ramp_source (tb)
- # usrp_tx = usrp.sink_s (0, tx_interp, 1, 0x98)
- usrp_tx = usrp.sink_s (0, tx_interp)
- tb.connect (data_src, usrp_tx)
-
- usrp_rx = usrp.source_s (0, rx_decim, 1, 0x32103210, usrp.FPGA_MODE_LOOPBACK)
- sink = gr.check_counting_s ()
- tb.connect (usrp_rx, sink)
-
- # file_sink = gr.file_sink (gr.sizeof_short, "loopback.dat")
- # tb.connect (usrp_rx, file_sink)
-
- return tb
-
-def main ():
- tb = build_graph ()
- try:
- tb.run()
- except KeyboardInterrupt:
- pass
-
-if __name__ == '__main__':
- main ()