summaryrefslogtreecommitdiff
path: root/gr-usrp/apps
diff options
context:
space:
mode:
Diffstat (limited to 'gr-usrp/apps')
-rw-r--r--gr-usrp/apps/.gitignore6
-rw-r--r--gr-usrp/apps/Makefile.am68
-rwxr-xr-xgr-usrp/apps/lsusrp75
-rwxr-xr-xgr-usrp/apps/usrp_print_db.py42
-rw-r--r--gr-usrp/apps/usrp_rx_cfile.cc245
-rw-r--r--gr-usrp/apps/usrp_rx_cfile.h62
-rwxr-xr-xgr-usrp/apps/usrp_rx_cfile.py108
-rw-r--r--gr-usrp/apps/usrp_siggen.cc225
-rw-r--r--gr-usrp/apps/usrp_siggen.h53
-rwxr-xr-xgr-usrp/apps/usrp_test_counting.py53
-rwxr-xr-xgr-usrp/apps/usrp_test_loopback.py65
11 files changed, 0 insertions, 1002 deletions
diff --git a/gr-usrp/apps/.gitignore b/gr-usrp/apps/.gitignore
deleted file mode 100644
index 2d01df25f..000000000
--- a/gr-usrp/apps/.gitignore
+++ /dev/null
@@ -1,6 +0,0 @@
-/Makefile
-/Makefile.in
-/.libs
-/.deps
-/usrp_siggen
-/usrp_rx_cfile
diff --git a/gr-usrp/apps/Makefile.am b/gr-usrp/apps/Makefile.am
deleted file mode 100644
index b45f3f79c..000000000
--- a/gr-usrp/apps/Makefile.am
+++ /dev/null
@@ -1,68 +0,0 @@
-#
-# Copyright 2008,2009,2010 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.
-#
-
-include $(top_srcdir)/Makefile.common
-
-# For compiling within the GNU Radio build tree
-AM_CPPFLAGS = \
- -I$(top_srcdir)/gr-usrp/src \
- $(USRP_INCLUDES) \
- $(STD_DEFINES_AND_INCLUDES) \
- $(WITH_INCLUDES)
-
-GR_USRP_LA=$(top_builddir)/gr-usrp/src/libgnuradio-usrp.la
-
-# For compiling outside the tree, these will get fished out by pkgconfig
-
-LDADD = \
- $(GNURADIO_CORE_LA) \
- $(USRP_LA) \
- $(GR_USRP_LA) \
- $(BOOST_LDFLAGS) \
- $(BOOST_PROGRAM_OPTIONS_LIB) \
- $(BOOST_FILESYSTEM_LIB)
-
-noinst_PROGRAMS = \
- usrp_rx_cfile \
- usrp_siggen
-
-noinst_HEADERS = \
- usrp_rx_cfile.h \
- usrp_siggen.h
-
-usrp_rx_cfile_SOURCES = \
- usrp_rx_cfile.cc
-
-usrp_siggen_SOURCES = \
- usrp_siggen.cc
-
-if PYTHON
-
-bin_SCRIPTS = \
- lsusrp \
- usrp_print_db.py \
- usrp_rx_cfile.py \
- usrp_test_counting.py \
- usrp_test_loopback.py
-
-EXTRA_DIST += $(bin_SCRIPTS)
-
-endif
diff --git a/gr-usrp/apps/lsusrp b/gr-usrp/apps/lsusrp
deleted file mode 100755
index d2eab33fe..000000000
--- a/gr-usrp/apps/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-usrp/apps/usrp_print_db.py b/gr-usrp/apps/usrp_print_db.py
deleted file mode 100755
index b082cb073..000000000
--- a/gr-usrp/apps/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-usrp/apps/usrp_rx_cfile.cc b/gr-usrp/apps/usrp_rx_cfile.cc
deleted file mode 100644
index d40ca58f7..000000000
--- a/gr-usrp/apps/usrp_rx_cfile.cc
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- * 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.
- */
-
-#include <usrp_rx_cfile.h>
-#include <gr_io_signature.h>
-#include <gr_head.h>
-#include <stdexcept>
-#include <iostream>
-#include <boost/program_options.hpp>
-
-namespace po = boost::program_options;
-
-usrp_subdev_spec
-str_to_subdev(std::string spec_str)
-{
- usrp_subdev_spec spec;
- if(spec_str == "A" || spec_str == "A:0" || spec_str == "0:0") {
- spec.side = 0;
- spec.subdev = 0;
- }
- else if(spec_str == "A:1" || spec_str == "0:1") {
- spec.side = 0;
- spec.subdev = 1;
- }
- else if(spec_str == "B" || spec_str == "B:0" || spec_str == "1:0") {
- spec.side = 1;
- spec.subdev = 0;
- }
- else if(spec_str == "B:1" || spec_str == "1:1") {
- spec.side = 1;
- spec.subdev = 1;
- }
- else {
- throw std::range_error("Incorrect subdevice specifications.\n");
- }
-
- return spec;
-}
-
-
-// Shared pointer constructor
-usrp_rx_cfile_sptr make_usrp_rx_cfile(int which, usrp_subdev_spec spec,
- int decim, double freq, float gain,
- bool width8, bool nohb,
- bool output_shorts, int nsamples,
- const std::string &filename)
-{
- return gnuradio::get_initial_sptr(new usrp_rx_cfile(which, spec,
- decim, freq, gain,
- width8, nohb,
- output_shorts,
- nsamples,
- filename));
-}
-
-// Hierarchical block constructor, with no inputs or outputs
-usrp_rx_cfile::usrp_rx_cfile(int which, usrp_subdev_spec spec,
- int decim, double freq, float gain,
- bool width8, bool nohb,
- bool output_shorts, int nsamples,
- const std::string &filename) :
- gr_top_block("usrp_rx_cfile"),
- d_which(which), d_spec(spec), d_decim(decim), d_freq(freq),
- d_gain(gain), d_width8(width8), d_nohb(nohb), d_nsamples(nsamples),
- d_filename(filename)
-{
- usrp_source_c_sptr usrp;
-
- if(d_nohb || (d_decim<8)) {
- // Min decimation of this firmware is 4.
- // contains 4 Rx paths without halfbands and 0 tx paths.
- std::string fpga_filename="std_4rx_0tx.rbf";
-
- // use default values and add fpga_filename
- usrp = usrp_make_source_c(d_which, d_decim,
- 1, -1, 0, 0, 0,
- fpga_filename.c_str());
- }
- else {
- // standard fpga firmware "std_2rxhb_2tx.rbf" contains
- // 2 Rx paths with halfband filters and 2 tx paths
- //(the default) min decimation 8
- usrp = usrp_make_source_c(d_which, d_decim);
- }
-
- if(d_width8) {
- int sample_width = 8;
- int sample_shift = 8;
- int format = usrp->make_format(sample_width, sample_shift);
- int r = usrp->set_format(format);
- printf("width8: format=%d r=%d\n", format, r);
- }
-
-
- /* Get subdevice and process it */
- db_base_sptr subdev = usrp->selected_subdev(d_spec);
- printf("\nSubdevice name is %s\n", subdev->side_and_name().c_str());
- printf("Subdevice freq range: (%g, %g)\n",
- subdev->freq_min(), subdev->freq_max());
-
- unsigned int mux = usrp->determine_rx_mux_value(d_spec);
- printf("mux: %#08x\n", mux);
- usrp->set_mux(mux);
-
- float gain_min = subdev->gain_min();
- float gain_max = subdev->gain_max();
- if(d_gain == -1) {
- d_gain = (gain_min + gain_max)/2.0;
- }
- printf("gain: %g\n", d_gain);
- subdev->set_gain(d_gain);
-
-
- /* Set the USRP/dboard frequency */
- usrp_tune_result r;
- bool ok = usrp->tune(0, subdev, freq, &r); //DDC 0
-
- if(!ok) {
- throw std::runtime_error("Could not set frequency.");
- }
-
- /* The rest */
- d_dst = gr_make_file_sink(sizeof(gr_complex), d_filename.c_str());
-
- if(d_nsamples == -1) {
- connect(usrp, 0, d_dst, 0);
- }
- else {
- d_head = gr_make_head(sizeof(gr_complex), d_nsamples*2);
- connect(usrp, 0, d_head, 0);
- connect(d_head, 0, d_dst, 0);
- }
-}
-
-
-int main(int argc, char *argv[])
-{
- int which = 0; // specify which USRP board
- usrp_subdev_spec spec(0,0); // specify the d'board side
- int decim = 16; // set the decimation rate
- double freq = 0; // set the frequency
- float gain = -1; // set the gain; -1 will set the mid-point gain
- int nsamples = -1; // set the number of samples to collect; -1 will continue
- bool width8 = false; // use 8-bit samples across USB
- bool nohb = false; // don't use halfband filter in USRP
- bool output_shorts = false; // use shorts
- std::string filename = "received.dat";
-
- po::options_description cmdconfig("Program options: usrp_text_rx [options] filename");
- cmdconfig.add_options()
- ("help,h", "produce help message")
- ("which,W", po::value<int>(&which), "select which USRP board")
- ("rx-subdev-spec,R", po::value<std::string>(), "select USRP Rx side A or B (default=A)")
- ("decim,d", po::value<int>(&decim), "set fgpa decimation rate to DECIM")
- ("freq,f", po::value<double>(), "set frequency to FREQ")
- ("gain,g", po::value<float>(), "set gain in dB (default is midpoint)")
- ("width-8,8", "Enable 8-bit samples across USB")
- ("no-hb", "don't use halfband filter in usrp")
- //("output-shorts,s", "output interleaved shorts in stead of complex floats")
- ("nsamples,N", po::value<int>(&nsamples), "number of samples to collect")
- ;
-
- po::options_description fileconfig("Input file options");
- fileconfig.add_options()
- ("filename", po::value<std::string>(), "input file")
- ;
-
- po::positional_options_description inputfile;
- inputfile.add("filename", -1);
-
- po::options_description config;
- config.add(cmdconfig).add(fileconfig);
-
- po::variables_map vm;
- po::store(po::command_line_parser(argc, argv).
- options(config).positional(inputfile).run(), vm);
- po::notify(vm);
-
- if (vm.count("help")) {
- std::cout << cmdconfig << "\n";
- return 1;
- }
-
- if(vm.count("filename")) {
- filename = vm["filename"].as<std::string>();
- }
-
- if(vm.count("freq")) {
- freq = vm["freq"].as<double>();
- }
- else {
- fprintf(stderr, "You must specify a frequency.\n");
- return -1;
- }
-
- if(vm.count("rx-subdev-spec")) {
- std::string s = vm["rx-subdev-spec"].as<std::string>();
- spec = str_to_subdev(s);
- }
-
- if(vm.count("width-8")) {
- width8 = true;
- }
- if(vm.count("nohb")) {
- nohb = true;
- }
- if(vm.count("output-shorts")) {
- output_shorts = true;
- }
-
- std::cout << "which: " << which << std::endl;
- std::cout << "decim: " << decim << std::endl;
- std::cout << "freq: " << freq << std::endl;
- std::cout << "gain: " << gain << std::endl;
- std::cout << "width-8 " << (width8 ? "Yes" : "No") << std::endl;
- std::cout << "no-hb " << (nohb ? "Yes" : "no") << std::endl;
- std::cout << "shorts: " << (output_shorts ? "Yes" : "No") << std::endl;
- std::cout << "samples: " << nsamples << std::endl;
-
- usrp_rx_cfile_sptr top_block = make_usrp_rx_cfile(which, spec, decim, freq,
- gain, width8, nohb,
- output_shorts, nsamples,
- filename);
- top_block->run();
-
- return 0;
-}
diff --git a/gr-usrp/apps/usrp_rx_cfile.h b/gr-usrp/apps/usrp_rx_cfile.h
deleted file mode 100644
index 3a42972ca..000000000
--- a/gr-usrp/apps/usrp_rx_cfile.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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.
- */
-
-#include <gr_top_block.h>
-#include <usrp_source_base.h>
-#include <usrp_source_c.h>
-#include <usrp_source_s.h>
-#include <gr_file_sink.h>
-
-class usrp_rx_cfile;
-typedef boost::shared_ptr<usrp_rx_cfile> usrp_rx_cfile_sptr;
-usrp_rx_cfile_sptr make_usrp_rx_cfile(int which, usrp_subdev_spec spec,
- int decim, double freq, float gain,
- bool width8, bool nohb,
- bool output_shorts, int nsamples,
- const std::string &filename);
-
-class usrp_rx_cfile : public gr_top_block
-{
-private:
- usrp_rx_cfile(int which, usrp_subdev_spec spec,
- int decim, double freq, float gain,
- bool width8, bool nohb,
- bool output_shorts, int nsamples,
- const std::string &filename);
- friend usrp_rx_cfile_sptr make_usrp_rx_cfile(int which, usrp_subdev_spec spec,
- int decim, double freq, float gain,
- bool width8, bool nohb,
- bool output_shorts, int nsamples,
- const std::string &filename);
-
- int d_which;
- usrp_subdev_spec d_spec;
- int d_decim;
- double d_freq;
- float d_gain;
- bool d_width8, d_nohb;
- int d_nsamples;
- std::string d_filename;
-
- public:
- gr_block_sptr d_head;
- gr_block_sptr d_dst;
-};
diff --git a/gr-usrp/apps/usrp_rx_cfile.py b/gr-usrp/apps/usrp_rx_cfile.py
deleted file mode 100755
index 3ac9fb56f..000000000
--- a/gr-usrp/apps/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-usrp/apps/usrp_siggen.cc b/gr-usrp/apps/usrp_siggen.cc
deleted file mode 100644
index 5fb66348f..000000000
--- a/gr-usrp/apps/usrp_siggen.cc
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- * 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.
- */
-
-#include <usrp_siggen.h>
-#include <gr_io_signature.h>
-#include <gr_head.h>
-#include <gr_noise_type.h>
-#include <stdexcept>
-#include <iostream>
-#include <cstdio>
-#include <boost/program_options.hpp>
-
-namespace po = boost::program_options;
-
-usrp_subdev_spec
-str_to_subdev(std::string spec_str)
-{
- usrp_subdev_spec spec;
- if(spec_str == "A" || spec_str == "A:0" || spec_str == "0:0") {
- spec.side = 0;
- spec.subdev = 0;
- }
- else if(spec_str == "A:1" || spec_str == "0:1") {
- spec.side = 0;
- spec.subdev = 1;
- }
- else if(spec_str == "B" || spec_str == "B:0" || spec_str == "1:0") {
- spec.side = 1;
- spec.subdev = 0;
- }
- else if(spec_str == "B:1" || spec_str == "1:1") {
- spec.side = 1;
- spec.subdev = 1;
- }
- else {
- throw std::range_error("Incorrect subdevice specifications.\n");
- }
-
- return spec;
-}
-
-// Shared pointer constructor
-usrp_siggen_sptr make_usrp_siggen(int which, usrp_subdev_spec spec,
- double rf_freq, int interp, double wfreq,
- int waveform, float amp, float gain,
- float offset, long long nsamples)
-{
- return gnuradio::get_initial_sptr(new usrp_siggen(which, spec,
- rf_freq, interp, wfreq,
- waveform, amp, gain,
- offset, nsamples));
-}
-
-// Hierarchical block constructor, with no inputs or outputs
-usrp_siggen::usrp_siggen(int which, usrp_subdev_spec spec,
- double rf_freq, int interp, double wfreq,
- int waveform, float amp, float gain,
- float offset, long long nsamples)
- : gr_top_block("usrp_siggen")
-{
- usrp_sink_c_sptr usrp = usrp_make_sink_c(which, interp);
-
- db_base_sptr subdev = usrp->selected_subdev(spec);
- printf("Subdevice name is %s\n", subdev->name().c_str());
- printf("Subdevice freq range: (%g, %g)\n",
- subdev->freq_min(), subdev->freq_max());
-
- unsigned int mux = usrp->determine_tx_mux_value(spec);
- printf("mux: %#08x\n", mux);
- usrp->set_mux(mux);
-
- if(gain == -1) {
- gain = subdev->gain_max();
- }
- subdev->set_gain(gain);
-
- float input_rate = usrp->dac_freq() / usrp->interp_rate();
- printf("baseband rate: %g\n", input_rate);
-
- usrp_tune_result r;
- double target_freq = rf_freq;
- bool ok = usrp->tune(subdev->which(), subdev, target_freq, &r);
-
- if(!ok) {
- throw std::runtime_error("Could not set frequency.");
- }
-
- subdev->set_enable(true);
-
- printf("target_freq: %f\n", target_freq);
- printf("ok: %s\n", ok ? "true" : "false");
- printf("r.baseband_freq: %f\n", r.baseband_freq);
- printf("r.dxc_freq: %f\n", r.dxc_freq);
- printf("r.residual_freq: %f\n", r.residual_freq);
- printf("r.inverted: %d\n", r.inverted);
-
- /* Set up the signal source */
- siggen = gr_make_sig_source_c(input_rate, GR_SIN_WAVE, wfreq, amp);
- noisegen = gr_make_noise_source_c (GR_UNIFORM, amp);
- if(waveform == GR_SIN_WAVE || waveform == GR_CONST_WAVE) {
- source = siggen;
- }
- else if(waveform == GR_UNIFORM || waveform == GR_GAUSSIAN) {
- source = noisegen;
- }
- else {
- throw std::range_error("Unknown waveform type.\n");
- }
-
- siggen->set_waveform((gr_waveform_t)waveform);
-
- if (nsamples > 0){
- gr_block_sptr head = gr_make_head(sizeof(gr_complex), nsamples);
- connect(source, 0, head, 0);
- connect(head, 0, usrp, 0);
- }
- else {
- connect(source, 0, usrp, 0);
- }
-}
-
-int main(int argc, char *argv[])
-{
- int which = 0; // specify which USRP board
- usrp_subdev_spec spec(0,0); // specify the d'board side
- int interp = 128; // set the interpolation rate
- double rf_freq = 0; // set the frequency
- double wfreq = 100e3; // set the waveform frequency
- float amp = 5; // set the amplitude of the output
- float gain = -1; // set the d'board PGA gain
- float offset = 0; // set waveform offset
- int waveform;
- double nsamples = 0; // set the number of samples to transmit (0 -> inf)
-
- po::options_description cmdconfig("Program options");
- cmdconfig.add_options()
- ("help,h", "produce help message")
- ("which,W", po::value<int>(&which), "select which USRP board")
- ("tx-subdev-spec,T", po::value<std::string>(), "select USRP Tx side A or B")
- ("rf-freq,f", po::value<double>(), "set RF center frequency to FREQ")
- ("interp,i", po::value<int>(&interp), "set fgpa interpolation rate to INTERP")
-
- ("sine", "generate a complex sinusoid [default]")
- ("const", "generate a constant output")
- ("gaussian", "generate Gaussian random output")
- ("uniform", "generate Uniform random output")
-
- ("waveform-freq,w", po::value<double>(&wfreq), "set waveform frequency to FREQ")
- ("amplitude,a", po::value<float>(&amp), "set amplitude")
- ("gain,g", po::value<float>(&gain), "set output gain to GAIN")
- ("offset,o", po::value<float>(&offset), "set waveform offset to OFFSET")
- ("nsamples,N", po::value<double>(&nsamples), "number of samples to send [default=+inf]")
- ;
-
- po::variables_map vm;
- po::store(po::command_line_parser(argc, argv).
- options(cmdconfig).run(), vm);
- po::notify(vm);
-
- if (vm.count("help")) {
- std::cout << cmdconfig << "\n";
- return 1;
- }
-
- if(vm.count("rf-freq")) {
- rf_freq = vm["rf-freq"].as<double>();
- }
- else {
- fprintf(stderr, "You must specify a frequency.\n");
- return -1;
- }
-
- if(vm.count("tx-subdev-spec")) {
- std::string s = vm["tx-subdev-spec"].as<std::string>();
- spec = str_to_subdev(s);
- }
-
- if(vm.count("sine")) {
- waveform = GR_SIN_WAVE;
- }
- else if(vm.count("const")) {
- waveform = GR_CONST_WAVE;
- }
- else if(vm.count("gaussian")) {
- waveform = GR_GAUSSIAN;
- }
- else if(vm.count("uniform")) {
- waveform = GR_UNIFORM;
- }
- else {
- waveform = GR_SIN_WAVE;
- }
-
- printf("which: %d\n", which);
- printf("interp: %d\n", interp);
- printf("rf_freq: %g\n", rf_freq);
- printf("amp: %f\n", amp);
- printf("nsamples: %g\n", nsamples);
-
- usrp_siggen_sptr top_block = make_usrp_siggen(which, spec, rf_freq,
- interp, wfreq, waveform,
- amp, gain, offset, (long long) nsamples);
-
- top_block->run();
-
- return 0;
-}
diff --git a/gr-usrp/apps/usrp_siggen.h b/gr-usrp/apps/usrp_siggen.h
deleted file mode 100644
index 053c4bdfa..000000000
--- a/gr-usrp/apps/usrp_siggen.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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.
- */
-
-#include <gr_top_block.h>
-#include <usrp_sink_c.h>
-#include <gr_sig_source_c.h>
-#include <gr_noise_source_c.h>
-
-usrp_subdev_spec str_to_subdev(std::string spec_str);
-
-class usrp_siggen;
-typedef boost::shared_ptr<usrp_siggen> usrp_siggen_sptr;
-usrp_siggen_sptr make_usrp_siggen(int which, usrp_subdev_spec spec,
- double rf_freq, int interp, double wfreq,
- int waveform, float amp, float gain,
- float offset, long long nsamples);
-
-class usrp_siggen : public gr_top_block
-{
-private:
- usrp_siggen(int which, usrp_subdev_spec spec,
- double rf_freq, int interp, double wfreq,
- int waveform, float amp, float gain,
- float offset, long long nsamples);
- friend usrp_siggen_sptr make_usrp_siggen(int which, usrp_subdev_spec spec,
- double rf_freq, int interp, double wfreq,
- int waveform, float amp, float gain,
- float offset,
- long long nsamples);
-
- public:
- gr_block_sptr source;
- gr_sig_source_c_sptr siggen;
- gr_noise_source_c_sptr noisegen;
-};
diff --git a/gr-usrp/apps/usrp_test_counting.py b/gr-usrp/apps/usrp_test_counting.py
deleted file mode 100755
index a8300afe2..000000000
--- a/gr-usrp/apps/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-usrp/apps/usrp_test_loopback.py b/gr-usrp/apps/usrp_test_loopback.py
deleted file mode 100755
index b58ac06ae..000000000
--- a/gr-usrp/apps/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 ()