diff options
Diffstat (limited to 'gr-usrp')
64 files changed, 0 insertions, 6800 deletions
diff --git a/gr-usrp/.gitignore b/gr-usrp/.gitignore deleted file mode 100644 index cdcf41b156..0000000000 --- a/gr-usrp/.gitignore +++ /dev/null @@ -1,30 +0,0 @@ -/*.cache -/*.la -/*.lo -/*.pc -/.deps -/.la -/.libs -/.lo -/Makefile -/Makefile.in -/aclocal.m4 -/autom4te.cache -/config.cache -/config.h -/config.h.in -/config.log -/config.status -/configure -/depcomp -/install-sh -/libtool -/ltmain.sh -/make.log -/missing -/missing -/mkinstalldirs -/py-compile -/stamp-h -/stamp-h.in -/stamp-h1 diff --git a/gr-usrp/Makefile.am b/gr-usrp/Makefile.am deleted file mode 100644 index be4035dd4e..0000000000 --- a/gr-usrp/Makefile.am +++ /dev/null @@ -1,35 +0,0 @@ -# -# Copyright 2004,2011 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 - -EXTRA_DIST += \ - README_MULTI_USRP.txt \ - gnuradio-usrp.pc.in - -SUBDIRS = src apps - -if PYTHON -SUBDIRS += grc -endif - -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = gnuradio-usrp.pc diff --git a/gr-usrp/README_MULTI_USRP.txt b/gr-usrp/README_MULTI_USRP.txt deleted file mode 100644 index 4ed7a15b30..0000000000 --- a/gr-usrp/README_MULTI_USRP.txt +++ /dev/null @@ -1,251 +0,0 @@ -Multi usrp - -With this code you can connect two or more usrps (with a locked clock) and get synchronised samples. -You must connect a (flat)cable between a dboard on the master in RXA and a dboard on the slave in RXA. -You then put one usrp in master mode, put the other in slave mode. - -For a quick start using the examples look at gnuradio-examples/python/multi_usrp/README - -Use the usrp_multi block which is installed by gr-usrp. -instantiate in the following way: - - self.multi=usrp_multi.multi_source_align( fg=self, master_serialno=options.master_serialno, decim=options.decim, nchan=options.nchan ) - -nchan should be 2 or 4. - -You determine which is the master by master_serialno (this is a text string a hexadecimal number). -If you enter a serial number which is not found it will print the serial numbers which are available. -If you give no serial number (master_serialno=None), the code will pick a Master for you. - -You can get a reference to the master and the slave usrp in the following way: - - self.um=self.multi.get_master_usrp() - self.us=self.multi.get_slave_usrp() - -You only need these references for setting freqs/gains or getting info about daughterboards. -Don't use the output directly but use the aligned output from multi.get_master_source_c() and multi.get_slave_source_c() - -You get references to the aligned output samples in the following way: -aligned_master_source_c=self.multi.get_master_source_c() -aligned_slave_source_c=self.multi.get_slave_source_c() - -These blocks have multiple outputs. -output 0 is the sample counter (high bits in I, low bits in Q) -You normally don't need the samplecounters so you can ignore output 0 - -output 1 is the first aligend output channel (if you enable 2 or 4 channels) -output 2 is the second output channel (only if you enable 4 channels) - -so the usefull 4 channels are: -self.aligned_master_chan1=(self.multi.get_master_source_c(),1) -self.aligned_master_chan2=(self.multi.get_master_source_c(),2) -self.aligned_slave_chan1=(self.multi.get_slave_source_c(),1) -self.aligned_slave_chan2=(self.multi.get_slave_source_c(),2) - -The two samplecounters are: -self.aligned_master_samplecounter=(self.multi.get_master_source_c(),0) -self.aligned_slave_samplecounter=(self.multi.get_slave_source_c(),0) - -You can set the gain or tune the frequency for all 4 receive daughetrboards at once: - self.multi.set_gain_all_rx(options.gain) - result,r1,r2,r3,r4 = self.multi.tune_all_rx(options.freq) - -This will only work reliably when you have all the same daughterboards. -Otherwise set all freqs and gains individually. - -You must call self.multi.sync() at least once AFTER the flowgraph has started running. -(This will synchronise the streams of the two usrps) - -This work was funded by Toby Oliver at Sensus Analytics / Path Intelligence. -Many Thanks for making this possible. - -It was written by Martin Dudok van Heel at Olifantasia. - -Quick start multi-usrp: -Unpack, build and install usrp, gnuradio-core and gr-usrp -Versions need to be more recent then 2.7cvs/svn 11 may 2006 - -Make sure usrp/fpga/rbf/rev2/multi*.rbf is installed in /usr/local/share/usrp/rev2/ -Make sure usrp/fpga/rbf/rev4/multi*.rbf is installed in /usr/local/share/usrp/rev4/ -(If in doubt, copy manually) - -build and install gr-wxgui gr-audio-xxx and so on. - -unpack gnuradio-examples. - -There is a gnuradio-examples/python/multi_usrp directory which contains examples and a README - - -Put at least a basic RX or dbsrx board in RXA of the master and RXA of the slave board. -Make sure that the usrps have a serial or unique identifier programmed in their eeprom. -(All new rev 4.1 boards have this) -You can do without a serial but then you never know which usrp is the master and which is the slave. - - -CONNECTING THE CABLES -Now connect the 64MHz clocks between the boards with a short sma coax cable. -(See the wiki on how to enable clock-out and clock-in -http://comsec.com/wiki?USRPClockingNotes ) - -You need one board with a clock out and one board with a clock in. - -You can choose any of the two boards as master or slave, this is not dependant on which board has the clock-out or in. -In my experiments I had fewer problems when the board that has the clock-in will be the master board. - -You can use a standard 16-pole flatcable to connect tvrx, basic-rx or dbsrx boards. -Of this 16pin flatcable only two pins are used (io15 and ground) -For all new daughterboards which use up a lot of io pins you have to use a cable with fewer connections. -The savest is using a 2pin headercable connected to io15,gnd (a cable like the ones used to connect frontpanel leds to the mainboard of a PC) - -If using basic rx board: - Connect a 16-pole flatcable from J25 on basicrx/dbs_rx in rxa of the master usrp to J25 on basicrx/dbsrx in RXA of the slave usrp - Don't twist the cable (Make sure the pin1 marker (red line on the flatcable) is on the same side of the connector (at io-8 on the master and at io8 on the slave.)) - For basic_rx this means the marker should be on the side of the dboard with the sma connectors. - For dbs_rx this means the marker should be on the side of the dboard with the two little chips. - In other words, don't twist the cable, you will burn your board if you do. - -You can also connect a flatcable with multiple connectors from master-J25 to slave1-J25 to slave2-J25 to ... -You will however have to think of something to create a common 64Mhz clock for more then two usrps. - -For all other daughterboards, connect a 2wire cable from masterRXA J25 io15,gnd to slaveRXA J25 io15,gnd - - -So now the hardware is setup, software is setup. Lets do some tests. - -Connect power to both usrps. -unpack the gnuradio_examples somewhere (cvs version later then 11 may 2006) -go to the gnuradio-examples/python/multi_usrp folder. - -Now run - ./multi_usrp_oscope.py -x 12345678 - -It should tell you that usrp 12345678 is not found and tell you which serials are available. - -Now run ./multi_usrp_oscope.py -x actualserialnum -You should now get an oscope with two channels, one is from the master and one is from the slave -It will which show the I-signal from channel 0 of the master usrp and I-signal from channel 0 of the slave usrp. -(For testing connect the same signal source to the inputs of both boards) -The signals should be aligned. -If you click the sync button, it will resync the master and slave (should never be needed) - -Now run -./multi_usrp_oscope.py --help -To see all available options. - - -Now you are ready to do phase-locked aligned signal processing. - -You can also capture to file with: -./multi_usrp_rx_cfile.py - -run ./multi_usrp_rx_cfile.py --help to see all available options. - - -Here follows a brief of the new blocks and (changes)functionality for multi-usrp. -You can also look at the generated documentation in -/usr/local/share/doc/gnuradio-core-X.X -/usr/local/share/doc/usrp-X.X -(Make sure to build and install the documentation, go to the doc directory of the sourcetree and issue make doc; make install) - - -gnuradio-examples: -new/changed files: -multi_usrp/multi_usrp_oscope.py -multi_usrp/multi_usrp_rx_cfile.py - - -gnuradio-core: -gr.align_on_samplenumbers_ss (int nchan,int align_interval) - -align several complex short (interleaved short) input channels with corresponding unsigned 32 bit sample_counters (provided as interleaved 16 bit values) - -Parameters: - nchan number of complex_short input channels (including the 32 bit counting channel) - align_interval interval at which the samples are aligned, ignored for now. - -Pay attention on how you connect this block It expects a minimum of 2 usrp_source_s with nchan number of channels and as mode usrp_prims.bmFR_MODE_RX_COUNTING_32BIT enabled. This means that the first complex_short channel is an interleaved 32 bit counter. The samples are aligned by dropping samples untill the samplenumbers match. - -files: -gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.cc -gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.h -gnuradio-core/src/lib/general/gr_align_on_samplenumbers_ss.i - - -gr-usrp - added _write_fpga_reg_masked - added usrp_multi.py - new usrp_multi block which can instantiate two linked usrps as master and slave and alignes their output. - It has a sync() function which should be called AFTER the flowgraph has started running. - bool sync(); - \brief Call this on a master usrp to sync master and slave by outputing a sync pulse on rx_a_io[15]. - The 32 bit samplecounter of master and slave will be reset to zero and all phase and buffer related things in the usrps are reset. - Call this only after the flowgraph has been started, otherwise there will be no effect since everything is kept in reset state as long as the flowgraph is not running. - \returns true if successfull. - -files: -configure.ac -src/Makefile.am -src/usrp1.i -src/usrp1_source_base.cc -src/usrp1_source_base.h -src/usrp_multi.py - -usrp-0.11cvsmulti: -usrp: - new constant bmFR_MODE_RX_COUNTING_32BIT (could also be added as extra mode like FPGA_MODE_COUNTING_32BIT) - Use this for the mode parameter when creating a usrp when you want to use the master/slave setup or if you want to use the 32 bit counter for other things, like testing with gr.check_counting_s(True) - - added register FR_RX_MASTER_SLAVE - added bitno and bitmaskes: - bmFR_MODE_RX_COUNTING_32BIT - - bitnoFR_RX_SYNC - bitnoFR_RX_SYNC_MASTER - bitnoFR_RX_SYNC_SLAVE - - bitnoFR_RX_SYNC_INPUT_IOPIN 15 - bmFR_RX_SYNC_INPUT_IOPIN (1<<bitnoFR_RX_SYNC_INPUT_IOPIN) - bitnoFR_RX_SYNC_OUTPUT_IOPIN 15 - bmFR_RX_SYNC_OUTPUT_IOPIN (1<<bitnoFR_RX_SYNC_OUTPUT_IOPIN) - - added _write_fpga_reg_masked() - added new toplevel folder usrp_multi - added usrp_multi.v and master_control_multi.v - added new MULTI_ON and COUNTER_32BIT_ON defines - If these are turned off usrp_multi.v will behave exactly as usrp_std.v - - added setting_reg_masked.v - changed reset behaviour of phase_acc.v and rx_buffer.v - - changed generate_regs.py to handle bm and bitno defines - - -files: -firmware/include/fpga_regs_standard.v -firmware/include/fpga_regs_common.h -firmware/include/generate_regs.py -firmware/include/fpga_regs_standard.h -host/lib/usrp_basic.h -host/lib/usrp_basic.cc -host/lib/usrp_standard.h -fpga/rbf/Makefile.am -fpga/toplevel/usrp_std/usrp_std.v -fpga/toplevel/usrp_multi/usrp_multi.esf -fpga/toplevel/usrp_multi/usrp_multi.vh -fpga/toplevel/usrp_multi/usrp_std.vh -fpga/toplevel/usrp_multi/usrp_multi_config_2rxhb_0tx.vh -fpga/toplevel/usrp_multi/usrp_multi_config_2rxhb_2tx.vh -fpga/toplevel/usrp_multi/usrp_multi.v -fpga/toplevel/usrp_multi/usrp_multi.qpf -fpga/toplevel/usrp_multi/usrp_multi.psf -fpga/toplevel/usrp_multi/usrp_multi_config_2rx_0tx.vh -fpga/toplevel/usrp_multi/usrp_multi.qsf -fpga/toplevel/usrp_multi/usrp_multi_config_4rx_0tx.vh -fpga/toplevel/usrp_multi/usrp_multi.csf -fpga/toplevel/usrp_multi/.cvsignore -fpga/sdr_lib/rx_buffer.v -fpga/sdr_lib/master_control_multi.v -fpga/sdr_lib/phase_acc.v -fpga/sdr_lib/setting_reg_masked.v - - diff --git a/gr-usrp/apps/.gitignore b/gr-usrp/apps/.gitignore deleted file mode 100644 index 2d01df25f7..0000000000 --- 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 b45f3f79c5..0000000000 --- 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 d2eab33fe3..0000000000 --- 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 b082cb073a..0000000000 --- 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 d40ca58f7a..0000000000 --- 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 3a42972caf..0000000000 --- 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 3ac9fb56fb..0000000000 --- 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 5fb66348f9..0000000000 --- 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>(&), "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 053c4bdfa7..0000000000 --- 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 a8300afe20..0000000000 --- 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 b58ac06ae0..0000000000 --- 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 () diff --git a/gr-usrp/gnuradio-usrp.pc.in b/gr-usrp/gnuradio-usrp.pc.in deleted file mode 100644 index b1f33f41be..0000000000 --- a/gr-usrp/gnuradio-usrp.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@/gnuradio - -Name: gnuradio-usrp -Description: GNU Software Radio support for Universal Software Radio Peripheral -Requires: gnuradio-core usrp -Version: @LIBVER@ -Libs: -L${libdir} -lgnuradio-usrp -Cflags: -I${includedir} diff --git a/gr-usrp/grc/.gitignore b/gr-usrp/grc/.gitignore deleted file mode 100644 index b336cc7cec..0000000000 --- a/gr-usrp/grc/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/Makefile -/Makefile.in diff --git a/gr-usrp/grc/Makefile.am b/gr-usrp/grc/Makefile.am deleted file mode 100644 index 11a5f40dc0..0000000000 --- a/gr-usrp/grc/Makefile.am +++ /dev/null @@ -1,42 +0,0 @@ -# -# Copyright 2011 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 - -usrp_pythondir = $(pythondir)/grc_gnuradio/usrp -usrp_python_PYTHON = \ - __init__.py \ - common.py \ - dual_usrp.py \ - simple_usrp.py - -dist_bin_SCRIPTS = usrp_probe - -grcblocksdir = $(grc_blocksdir) -dist_grcblocks_DATA = \ - usrp_dual_sink_x.xml \ - usrp_simple_sink_x.xml \ - usrp_dual_source_x.xml \ - usrp_simple_source_x.xml \ - usrp_probe.xml - -ourdatadir = $(pkgdatadir)/grc/freedesktop -dist_ourdata_DATA = gnuradio-usrp_probe.desktop diff --git a/gr-usrp/grc/__init__.py b/gr-usrp/grc/__init__.py deleted file mode 100644 index 1956bbd5b2..0000000000 --- a/gr-usrp/grc/__init__.py +++ /dev/null @@ -1,26 +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. -# - -from simple_usrp import \ - simple_source_c, simple_source_s, \ - simple_sink_c, simple_sink_s -from dual_usrp import \ - dual_source_c, dual_source_s, \ - dual_sink_c, dual_sink_s diff --git a/gr-usrp/grc/common.py b/gr-usrp/grc/common.py deleted file mode 100644 index 65c1e7e296..0000000000 --- a/gr-usrp/grc/common.py +++ /dev/null @@ -1,75 +0,0 @@ -# Copyright 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. -# - -import sys -from gnuradio import usrp, gr - -################################################## -# USRP base class with common methods -################################################## -class usrp_helper(object): - def _make_usrp(self, *args, **kwargs): self._u = self._usrp_args[0](*args, **kwargs) - def _get_u(self): return self._u - def _get_io_size(self): return self._usrp_args[1] - def _set_frequency(self, chan, subdev, frequency, verbose=False): - """ - Set the carrier frequency for the given subdevice. - @param chan specifies the DDC/DUC number - @param frequency the carrier frequency in Hz - @param verbose if true, print usrp tuning information - """ - r = self._get_u().tune(chan, subdev, frequency) - if not verbose: return - print subdev.side_and_name() - if r: - print "\tr.baseband_frequency =", r.baseband_freq - print "\tr.dxc_frequency =", r.dxc_freq - print "\tr.residual_frequency =", r.residual_freq - print "\tr.inverted =", r.inverted, "\n" - else: print >> sys.stderr, 'Error calling tune on subdevice.' - def set_format(self, width, shift): self._get_u().set_format(self._get_u().make_format(width, shift)) - -################################################## -# Classes to associate usrp constructor w/ io size -################################################## -class usrp_source_c(usrp_helper): _usrp_args = (usrp.source_c, gr.sizeof_gr_complex) -class usrp_source_s(usrp_helper): _usrp_args = (usrp.source_s, gr.sizeof_short) -class usrp_sink_c(usrp_helper): _usrp_args = (usrp.sink_c, gr.sizeof_gr_complex) -class usrp_sink_s(usrp_helper): _usrp_args = (usrp.sink_s, gr.sizeof_short) - -################################################## -# Side spec and antenna spec functions -################################################## -def is_flex(rx_ant): return rx_ant.upper() in ('TX/RX', 'RX2') -def to_spec(side, rx_ant='RXA'): - """ - Convert the side to a spec number. - @param side A or B - @param rx_ant antenna type - @return the spec (0/1, 0/1/2) - """ - #determine the side spec - try: side_spec = {'A': 0, 'B': 1}[side.upper()] - except: raise ValueError, 'Side A or B expected.' - #determine the subdevice spec - if rx_ant.upper() == 'RXB': subdev_spec = 1 - elif rx_ant.upper() == 'RXAB': subdev_spec = 2 - else: subdev_spec = 0 - return (side_spec, subdev_spec) diff --git a/gr-usrp/grc/dual_usrp.py b/gr-usrp/grc/dual_usrp.py deleted file mode 100644 index 66b76b2df9..0000000000 --- a/gr-usrp/grc/dual_usrp.py +++ /dev/null @@ -1,132 +0,0 @@ -# Copyright 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. -# - -import common -from gnuradio import gr - -#################################################################### -# Dual USRP Source -#################################################################### -class _dual_source(gr.hier_block2): - """A dual usrp source of IO type short or complex.""" - - def __init__(self, which, rx_ant_a='RXA', rx_ant_b='RXA', rx_source_a='A', rx_source_b='B'): - """ - USRP dual source contructor. - @param which the unit number - @param rx_ant_a the antenna choice - @param rx_ant_b the antenna choice - """ - #initialize hier2 block - gr.hier_block2.__init__( - self, 'usrp_dual_source', - gr.io_signature(0, 0, 0), - gr.io_signature(2, 2, self._get_io_size()), - ) - #create usrp object - self._make_usrp(which=which, nchan=2) - subdev_spec_a = common.to_spec(rx_source_a, rx_ant_a) - subdev_spec_b = common.to_spec(rx_source_b, rx_ant_b) - self._get_u().set_mux(self._get_u().determine_rx_mux_value(subdev_spec_a, subdev_spec_b)) - self._subdev_a = self._get_u().selected_subdev(subdev_spec_a) - self._subdev_b = self._get_u().selected_subdev(subdev_spec_b) - #connect - deinter = gr.deinterleave(self._get_io_size()) - self.connect(self._get_u(), deinter) - for i in range(2): self.connect((deinter, i), (self, i)) - - def set_decim_rate(self, decim): self._get_u().set_decim_rate(int(decim)) - def set_frequency_a(self, frequency, verbose=False, lo_offset=None): - if lo_offset is not None: self._subdev_a.set_lo_offset(lo_offset) - self._set_frequency( - chan=0, #ddc0 - subdev=self._subdev_a, - frequency=frequency, - verbose=verbose, - ) - def set_frequency_b(self, frequency, verbose=False, lo_offset=None): - if lo_offset is not None: self._subdev_b.set_lo_offset(lo_offset) - self._set_frequency( - chan=1, #ddc1 - subdev=self._subdev_b, - frequency=frequency, - verbose=verbose, - ) - def set_gain_a(self, gain): self._subdev_a.set_gain(gain) - def set_gain_b(self, gain): self._subdev_b.set_gain(gain) - -class dual_source_c(_dual_source, common.usrp_source_c): pass -class dual_source_s(_dual_source, common.usrp_source_s): pass - -#################################################################### -# Dual USRP Sink -#################################################################### -class _dual_sink(gr.hier_block2): - """A dual usrp sink of IO type short or complex.""" - - def __init__(self, which): - """ - USRP simple sink contructor. - @param which the unit number - """ - #initialize hier2 block - gr.hier_block2.__init__( - self, 'usrp_dual_sink', - gr.io_signature(2, 2, self._get_io_size()), - gr.io_signature(0, 0, 0), - ) - #create usrp object - self._make_usrp(which=which, nchan=2) - subdev_spec_a = common.to_spec('A') - subdev_spec_b = common.to_spec('B') - self._get_u().set_mux(self._get_u().determine_tx_mux_value(subdev_spec_a, subdev_spec_b)) - self._subdev_a = self._get_u().selected_subdev(subdev_spec_a) - self._subdev_b = self._get_u().selected_subdev(subdev_spec_b) - #connect - inter = gr.interleave(self._get_io_size()) - self.connect(inter, self._get_u()) - for i in range(2): self.connect((self, i), (inter, i)) - - def set_interp_rate(self, interp): self._get_u().set_interp_rate(int(interp)) - def set_frequency_a(self, frequency, verbose=False, lo_offset=None): - if lo_offset is not None: self._subdev_a.set_lo_offset(lo_offset) - self._set_frequency( - chan=self._subdev_a.which(), - subdev=self._subdev_a, - frequency=frequency, - verbose=verbose, - ) - def set_frequency_b(self, frequency, verbose=False, lo_offset=None): - if lo_offset is not None: self._subdev_b.set_lo_offset(lo_offset) - self._set_frequency( - chan=self._subdev_b.which(), - subdev=self._subdev_b, - frequency=frequency, - verbose=verbose, - ) - def set_gain_a(self, gain): self._subdev_a.set_gain(gain) - def set_gain_b(self, gain): self._subdev_b.set_gain(gain) - def set_enable_a(self, enable): self._subdev_a.set_enable(enable) - def set_enable_b(self, enable): self._subdev_b.set_enable(enable) - def set_auto_tr_a(self, auto_tr): self._subdev_a.set_auto_tr(auto_tr) - def set_auto_tr_b(self, auto_tr): self._subdev_b.set_auto_tr(auto_tr) - -class dual_sink_c(_dual_sink, common.usrp_sink_c): pass -class dual_sink_s(_dual_sink, common.usrp_sink_s): pass diff --git a/gr-usrp/grc/gnuradio-usrp_probe.desktop b/gr-usrp/grc/gnuradio-usrp_probe.desktop deleted file mode 100644 index 1363219942..0000000000 --- a/gr-usrp/grc/gnuradio-usrp_probe.desktop +++ /dev/null @@ -1,7 +0,0 @@ -[Desktop Entry] -Version=1.0 -Type=Application -Name=USRP Probe -Exec=usrp_probe -Categories=Development; -Icon=gnuradio-grc diff --git a/gr-usrp/grc/simple_usrp.py b/gr-usrp/grc/simple_usrp.py deleted file mode 100644 index fb7a39570f..0000000000 --- a/gr-usrp/grc/simple_usrp.py +++ /dev/null @@ -1,113 +0,0 @@ -# Copyright 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. -# - -import common -from gnuradio import gr - -#################################################################### -# Simple USRP Source -#################################################################### -class _simple_source(gr.hier_block2): - """A single usrp source of IO type short or complex.""" - - def __init__(self, which, side='A', rx_ant='RXA', no_hb=False): - """ - USRP simple source contructor. - @param which the unit number - @param side the usrp side A or B - @param rx_ant the antenna choice - @param no_hb disable half band filters - """ - self._no_hb = no_hb - #initialize hier2 block - gr.hier_block2.__init__( - self, 'usrp_simple_source', - gr.io_signature(0, 0, 0), - gr.io_signature(1, 1, self._get_io_size()), - ) - #create usrp object - if self._no_hb: self._make_usrp(which=which, nchan=1, fpga_filename="std_4rx_0tx.rbf") - else: self._make_usrp(which=which, nchan=1) - subdev_spec = common.to_spec(side, rx_ant) - self._get_u().set_mux(self._get_u().determine_rx_mux_value(subdev_spec)) - self._subdev = self._get_u().selected_subdev(subdev_spec) - if common.is_flex(rx_ant): self._subdev.select_rx_antenna(rx_ant) - #connect - self.connect(self._get_u(), self) - - def set_decim_rate(self, decim): - self._get_u().set_decim_rate(int(decim)) - if self._no_hb: #set the BW to half the sample rate - self._subdev.set_bw(self._get_u().converter_rate()/decim/2) - def set_frequency(self, frequency, verbose=False, lo_offset=None): - if lo_offset is not None: self._subdev.set_lo_offset(lo_offset) - self._set_frequency( - chan=0, #ddc0 - subdev=self._subdev, - frequency=frequency, - verbose=verbose, - ) - def set_gain(self, gain): self._subdev.set_gain(gain) - -class simple_source_c(_simple_source, common.usrp_source_c): pass -class simple_source_s(_simple_source, common.usrp_source_s): pass - -#################################################################### -# Simple USRP Sink -#################################################################### -class _simple_sink(gr.hier_block2): - """A single usrp sink of IO type short or complex.""" - - def __init__(self, which, side='A'): - """ - USRP simple sink contructor. - @param which the unit number - @param side the usrp side A or B - """ - #initialize hier2 block - gr.hier_block2.__init__( - self, 'usrp_simple_sink', - gr.io_signature(1, 1, self._get_io_size()), - gr.io_signature(0, 0, 0), - ) - #create usrp object - self._make_usrp(which=which, nchan=1) - subdev_spec = common.to_spec(side) - self._get_u().set_mux(self._get_u().determine_tx_mux_value(subdev_spec)) - self._subdev = self._get_u().selected_subdev(subdev_spec) - #connect - self.connect(self, self._get_u()) - - def set_interp_rate(self, interp): self._get_u().set_interp_rate(int(interp)) - def set_frequency(self, frequency, verbose=False, lo_offset=None): - if lo_offset is not None: self._subdev.set_lo_offset(lo_offset) - self._set_frequency( - chan=self._subdev.which(), - subdev=self._subdev, - frequency=frequency, - verbose=verbose, - ) - def set_gain(self, gain): self._subdev.set_gain(gain) - def set_enable(self, enable): self._subdev.set_enable(enable) - def set_auto_tr(self, auto_tr): self._subdev.set_auto_tr(auto_tr) - -class simple_sink_c(_simple_sink, common.usrp_sink_c): pass -class simple_sink_s(_simple_sink, common.usrp_sink_s): pass - diff --git a/gr-usrp/grc/usrp_dual_sink_x.xml b/gr-usrp/grc/usrp_dual_sink_x.xml deleted file mode 100644 index babc124d09..0000000000 --- a/gr-usrp/grc/usrp_dual_sink_x.xml +++ /dev/null @@ -1,204 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##USRP Dual Sink -################################################### - --> -<block> - <name>USRP1 Dual Sink</name> - <key>usrp_dual_sink_x</key> - <category>USRP</category> - <import>from grc_gnuradio import usrp as grc_usrp</import> - <make>grc_usrp.dual_sink_$(type.fcn)(which=$which) -self.$(id).set_interp_rate($interpolation) -self.$(id).set_frequency_a($frequency_a, verbose=True#slurp -#if $lo_offset_a() != float('inf') -, lo_offset=$lo_offset_a#slurp -#end if -) -self.$(id).set_frequency_b($frequency_b, verbose=True#slurp -#if $lo_offset_b() != float('inf') -, lo_offset=$lo_offset_b#slurp -#end if -) -self.$(id).set_gain_a($gain_a) -self.$(id).set_gain_b($gain_b) -################################################## -## Flex RF A -################################################## -#if $transmit_a.tx_enb -self.$(id).set_enable_a(True) -#end if -#if $transmit_a.auto_tr -self.$(id).set_auto_tr_a(True) -#end if -################################################## -## Flex RF B -################################################## -#if $transmit_b.tx_enb -self.$(id).set_enable_b(True) -#end if -#if $transmit_b.auto_tr -self.$(id).set_auto_tr_b(True) -#end if</make> - <callback>set_interp_rate($interpolation)</callback> - <callback>set_frequency_a($frequency_a#slurp -#if $lo_offset_a() != float('inf') -, lo_offset=$lo_offset_a#slurp -#end if -)</callback> - <callback>set_frequency_b($frequency_b#slurp -#if $lo_offset_b() != float('inf') -, lo_offset=$lo_offset_b#slurp -#end if -)</callback> - <callback>set_gain_a($gain_a)</callback> - <callback>set_gain_b($gain_b)</callback> - <param> - <name>Input Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>Complex</name> - <key>complex</key> - <opt>fcn:c</opt> - </option> - <option> - <name>Short</name> - <key>short</key> - <opt>fcn:s</opt> - </option> - </param> - <param> - <name>Unit Number</name> - <key>which</key> - <value>0</value> - <type>int</type> - </param> - <param> - <name>Interpolation</name> - <key>interpolation</key> - <type>int</type> - </param> - <param> - <name>Frequency A (Hz)</name> - <key>frequency_a</key> - <type>real</type> - </param> - <param> - <name>Frequency B (Hz)</name> - <key>frequency_b</key> - <type>real</type> - </param> - <param> - <name>LO Offset A (Hz)</name> - <key>lo_offset_a</key> - <value>float('inf')</value> - <type>real</type> - <hide>#if $lo_offset_a() == float('inf') then 'part' else 'none'#</hide> - <option> - <name>Default</name> - <key>float('inf')</key> - </option> - </param> - <param> - <name>LO Offset B (Hz)</name> - <key>lo_offset_b</key> - <value>float('inf')</value> - <type>real</type> - <hide>#if $lo_offset_b() == float('inf') then 'part' else 'none'#</hide> - <option> - <name>Default</name> - <key>float('inf')</key> - </option> - </param> - <param> - <name>Gain A (dB)</name> - <key>gain_a</key> - <value>0</value> - <type>real</type> - </param> - <param> - <name>Gain B (dB)</name> - <key>gain_b</key> - <value>0</value> - <type>real</type> - </param> -<!-- -################################################### -## Flex RF A -################################################### - --> - <param> - <name>Transmit A</name> - <key>transmit_a</key> - <value></value> - <type>enum</type> - <hide>#if $transmit_a.tx_enb then 'none' else 'part'#</hide> - <option> - <name>Unconfigured</name> - <key></key> - <opt>tx_enb:</opt> - <opt>auto_tr:</opt> - </option> - <option> - <name>Enable</name> - <key>tx_enb</key> - <opt>tx_enb:1</opt> - <opt>auto_tr:</opt> - </option> - <option> - <name>Auto T/R</name> - <key>auto_tr</key> - <opt>tx_enb:1</opt> - <opt>auto_tr:1</opt> - </option> - </param> -<!-- -################################################### -## Flex RF B -################################################### - --> - <param> - <name>Transmit B</name> - <key>transmit_b</key> - <value></value> - <type>enum</type> - <hide>#if $transmit_b.tx_enb then 'none' else 'part'#</hide> - <option> - <name>Unconfigured</name> - <key></key> - <opt>tx_enb:</opt> - <opt>auto_tr:</opt> - </option> - <option> - <name>Enable</name> - <key>tx_enb</key> - <opt>tx_enb:1</opt> - <opt>auto_tr:</opt> - </option> - <option> - <name>Auto T/R</name> - <key>auto_tr</key> - <opt>tx_enb:1</opt> - <opt>auto_tr:1</opt> - </option> - </param> - <sink> - <name>Ain</name> - <type>$type</type> - </sink> - <sink> - <name>Bin</name> - <type>$type</type> - </sink> - <doc> -The USRP sink inputs 128 Megasamples per second / interpolation. - -Input amplitude should be between 0 and 32767. - -Flex RF boards only: The "Transmit Setting" must be configured. \ -When set to "Enable" the transmitter is always on. \ -When set to "Auto Transmit/Receive", the transmitter is disabled while receiving. - </doc> -</block> diff --git a/gr-usrp/grc/usrp_dual_source_x.xml b/gr-usrp/grc/usrp_dual_source_x.xml deleted file mode 100644 index 4e1fa81d81..0000000000 --- a/gr-usrp/grc/usrp_dual_source_x.xml +++ /dev/null @@ -1,243 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##USRP Dual Source -################################################### - --> -<block> - <name>USRP1 Dual Source</name> - <key>usrp_dual_source_x</key> - <category>USRP</category> - <import>from grc_gnuradio import usrp as grc_usrp</import> - <make>grc_usrp.dual_source_$(type.fcn)( - which=$which, - rx_ant_a=$rx_ant_a, rx_ant_b=$rx_ant_b, - rx_source_a=$rx_source_a, rx_source_b=$rx_source_b, -) -#if $format() -self.$(id).set_format(width=$format.width, shift=$format.shift) -#end if -self.$(id).set_decim_rate($decimation) -self.$(id).set_frequency_a($frequency_a, verbose=True#slurp -#if $lo_offset_a() != float('inf') -, lo_offset=$lo_offset_a#slurp -#end if -) -self.$(id).set_frequency_b($frequency_b, verbose=True#slurp -#if $lo_offset_b() != float('inf') -, lo_offset=$lo_offset_b#slurp -#end if -) -self.$(id).set_gain_a($gain_a) -self.$(id).set_gain_b($gain_b)</make> - <callback>set_decim_rate($decimation)</callback> - <callback>set_frequency_a($frequency_a#slurp -#if $lo_offset_a() != float('inf') -, lo_offset=$lo_offset_a#slurp -#end if -)</callback> - <callback>set_frequency_b($frequency_b#slurp -#if $lo_offset_b() != float('inf') -, lo_offset=$lo_offset_b#slurp -#end if -)</callback> - <callback>set_gain_a($gain_a)</callback> - <callback>set_gain_b($gain_b)</callback> - <param> - <name>Output Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>Complex</name> - <key>complex</key> - <opt>fcn:c</opt> - </option> - <option> - <name>Short</name> - <key>short</key> - <opt>fcn:s</opt> - </option> - </param> - <param> - <name>Format</name> - <key>format</key> - <value></value> - <type>enum</type> - <hide>#if $format() then '' else 'part'#</hide> - <option> - <name>16 Bits (Default)</name> - <key></key> - <opt>width:16</opt> - <opt>shift:0</opt> - </option> - <option> - <name>8 Bits, Shift 8</name> - <key>w8_s8</key> - <opt>width:8</opt> - <opt>shift:8</opt> - </option> - </param> - <param> - <name>Unit Number</name> - <key>which</key> - <value>0</value> - <type>int</type> - </param> - <param> - <name>Decimation</name> - <key>decimation</key> - <type>int</type> - </param> - <param> - <name>Frequency A (Hz)</name> - <key>frequency_a</key> - <type>real</type> - </param> - <param> - <name>Frequency B (Hz)</name> - <key>frequency_b</key> - <type>real</type> - </param> - <param> - <name>LO Offset A (Hz)</name> - <key>lo_offset_a</key> - <value>float('inf')</value> - <type>real</type> - <hide>#if $lo_offset_a() == float('inf') then 'part' else 'none'#</hide> - <option> - <name>Default</name> - <key>float('inf')</key> - </option> - </param> - <param> - <name>LO Offset B (Hz)</name> - <key>lo_offset_b</key> - <value>float('inf')</value> - <type>real</type> - <hide>#if $lo_offset_b() == float('inf') then 'part' else 'none'#</hide> - <option> - <name>Default</name> - <key>float('inf')</key> - </option> - </param> - <param> - <name>Gain A (dB)</name> - <key>gain_a</key> - <value>0</value> - <type>real</type> - </param> - <param> - <name>Gain B (dB)</name> - <key>gain_b</key> - <value>0</value> - <type>real</type> - </param> -<!-- -################################################### -## Antenna A -################################################### - --> - <param> - <name>RX Antenna A</name> - <key>rx_ant_a</key> - <value>RXA</value> - <type>string</type> - <option> - <name>RXA</name> - <key>RXA</key> - </option> - <option> - <name>RXB</name> - <key>RXB</key> - </option> - <option> - <name>RXAB</name> - <key>RXAB</key> - </option> - <option> - <name>TX/RX</name> - <key>TX/RX</key> - </option> - <option> - <name>RX2</name> - <key>RX2</key> - </option> - </param> -<!-- -################################################### -## Antenna B -################################################### - --> - <param> - <name>RX Antenna B</name> - <key>rx_ant_b</key> - <value>RXA</value> - <type>string</type> - <option> - <name>RXA</name> - <key>RXA</key> - </option> - <option> - <name>RXB</name> - <key>RXB</key> - </option> - <option> - <name>RXAB</name> - <key>RXAB</key> - </option> - <option> - <name>TX/RX</name> - <key>TX/RX</key> - </option> - <option> - <name>RX2</name> - <key>RX2</key> - </option> - </param> - <param> - <name>RX Source A</name> - <key>rx_source_a</key> - <value>A</value> - <type>string</type> - <hide>#if $rx_source_a() == 'A' then 'part' else 'none'#</hide> - <option> - <name>Side A</name> - <key>A</key> - </option> - <option> - <name>Side B</name> - <key>B</key> - </option> - </param> - <param> - <name>RX Source B</name> - <key>rx_source_b</key> - <value>B</value> - <type>string</type> - <hide>#if $rx_source_b() == 'B' then 'part' else 'none'#</hide> - <option> - <name>Side A</name> - <key>A</key> - </option> - <option> - <name>Side B</name> - <key>B</key> - </option> - </param> - <source> - <name>Aout</name> - <type>$type</type> - </source> - <source> - <name>Bout</name> - <type>$type</type> - </source> - <doc> -The USRP source outputs 64 Megasamples per second / decimation. - -The "Receive Antenna Setting" selects one of the SMA connectors as the data source. \ -Flex RF boards use the "TX/RX" and "RX2" settings. \ -Basic RX and LFRX use the "RXA", "RXB", and "RXAB" settings. \ -All other boards use the "RXA" setting. - </doc> -</block> diff --git a/gr-usrp/grc/usrp_probe b/gr-usrp/grc/usrp_probe deleted file mode 100755 index d2e92e7530..0000000000 --- a/gr-usrp/grc/usrp_probe +++ /dev/null @@ -1,115 +0,0 @@ -#!/usr/bin/env python -""" -Copyright 2009 Free Software Foundation, Inc. -This file is part of GNU Radio - -GNU Radio Companion 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 2 -of the License, or (at your option) any later version. - -GNU Radio Companion 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 this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA -""" - -from gnuradio import usrp -import os - -import pygtk -pygtk.require('2.0') -import gtk - -from gnuradio.grc.gui.Dialogs import TextDisplay - -from gnuradio.grc.python.Platform import Platform -platform = Platform() - -flow_graph = platform.get_new_flow_graph() -block = flow_graph.get_new_block('usrp_probe') - -##all params -usrp_which_param = block.get_param('which') -usrp_dboard_param = block.get_param('dboard') - -def get_input(param): - param.validate() - input = param.get_input() - return input - -class USRPProbeWindow(gtk.Window): - """ - The main window for USRP Dignostics. - """ - - def delete_event(self, widget, event, data=None): return False - - def destroy(self, widget, data=None): gtk.main_quit() - - def __init__(self): - """ - USRPProbeWindow contructor. - Create a new gtk Dialog with a close button, USRP input paramaters, and output labels. - """ - gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL) - #quit signals - self.connect("delete_event", self.delete_event) - self.connect("destroy", self.destroy) - #set the title - self.set_title('USRP Probe') - #create decorative frame - frame = gtk.Frame() - self.add(frame) - #create vbox for storage - vbox = gtk.VBox() - frame.add(vbox) - vbox.pack_start(get_input(usrp_which_param), False) - vbox.pack_start(get_input(usrp_dboard_param), False) - self.probe_button = gtk.Button('Probe') - self.probe_button.connect('clicked', self._probe_usrp) - vbox.pack_start(self.probe_button, False) - #Create a text box for USRP queries - self.query_buffer = TextDisplay() - self.query_buffer.set_text(block.get_doc()) - vbox.pack_start(self.query_buffer) - self.show_all() - - def _probe_usrp(self, widget=None): - """Probe the USRP device and copy the results into the query text box.""" - dboard = usrp_dboard_param.evaluate() - side = {'a': 0, 'b': 1}[dboard[-1]] - if dboard.startswith('rx'): make = usrp.source_c - elif dboard.startswith('tx'): make = usrp.sink_c - try: - u = make(which=usrp_which_param.evaluate()) - subdev_spec = (side, 0) - subdev = usrp.selected_subdev(u, subdev_spec) #get the subdev - msg = ">>> USRP Probe\n" - msg = "%s\nName:\n\t%s\n"%(msg, str(subdev.name())) - msg = "%s\nConverter Rate:\n\t%s\n"%(msg, u.converter_rate()) - msg = "%s\nUses Quadrature:\n\t%s\n"%(msg, str(subdev.is_quadrature())) - gain_min, gain_max, gain_step = subdev.gain_range() - msg = "%s\nGain Range (min, max, step size):\n\t%s\n\t%s\n\t%s\n"%(msg, gain_min, gain_max, gain_step) - freq_min, freq_max, freq_step = subdev.freq_range() - msg = "%s\nFreq Range (min, max, step size):\n\t%s\n\t%s\n\t%s\n"%(msg, freq_min, freq_max, freq_step) - self.query_buffer.set_text(msg) - except Exception, e: #display the error message - self.query_buffer.set_text('''\ ->>> Error\n%s - -If the USRP cannot be found, make sure that the USRP is plugged-in and restart this program. \ -If the problem persists, there may be a problem with you gnuradio installation or USB 2.0. -'''%str(e)) - -if __name__ == '__main__': - #setup icon using icon theme - try: gtk.window_set_default_icon(gtk.IconTheme().load_icon('gnuradio-grc', 256, 0)) - except: pass - #enter the mainloop - USRPProbeWindow() - gtk.main() diff --git a/gr-usrp/grc/usrp_probe.xml b/gr-usrp/grc/usrp_probe.xml deleted file mode 100644 index ee207c28d3..0000000000 --- a/gr-usrp/grc/usrp_probe.xml +++ /dev/null @@ -1,40 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##USRP Probe: -## This block should not appear in the tree. -################################################### - --> -<block> - <name>USRP Probe</name> - <key>usrp_probe</key> - <make></make> - <param> - <name>Unit Number</name> - <key>which</key> - <value>0</value> - <type>int</type> - </param> - <param> - <name>Daughter Board</name> - <key>dboard</key> - <type>enum</type> - <option> - <name>RX A</name> - <key>rx_a</key> - </option> - <option> - <name>RX B</name> - <key>rx_b</key> - </option> - <option> - <name>TX A</name> - <key>tx_a</key> - </option> - <option> - <name>TX B</name> - <key>tx_b</key> - </option> - </param> - <doc>Press "Probe" to retrieve USRP information...</doc> -</block> diff --git a/gr-usrp/grc/usrp_simple_sink_x.xml b/gr-usrp/grc/usrp_simple_sink_x.xml deleted file mode 100644 index e52b5f0475..0000000000 --- a/gr-usrp/grc/usrp_simple_sink_x.xml +++ /dev/null @@ -1,133 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##USRP Simple Sink -################################################### - --> -<block> - <name>USRP1 Sink</name> - <key>usrp_simple_sink_x</key> - <category>USRP</category> - <import>from grc_gnuradio import usrp as grc_usrp</import> - <make>grc_usrp.simple_sink_$(type.fcn)(which=$which, side=$side) -self.$(id).set_interp_rate($interpolation) -self.$(id).set_frequency($frequency, verbose=True#slurp -#if $lo_offset() != float('inf') -, lo_offset=$lo_offset#slurp -#end if -) -self.$(id).set_gain($gain) -#if $transmit.tx_enb -self.$(id).set_enable(True) -#end if -#if $transmit.auto_tr -self.$(id).set_auto_tr(True) -#end if</make> - <callback>set_interp_rate($interpolation)</callback> - <callback>set_frequency($frequency#slurp -#if $lo_offset() != float('inf') -, lo_offset=$lo_offset#slurp -#end if -)</callback> - <callback>set_gain($gain)</callback> - <param> - <name>Input Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>Complex</name> - <key>complex</key> - <opt>fcn:c</opt> - </option> - <option> - <name>Short</name> - <key>short</key> - <opt>fcn:s</opt> - </option> - </param> - <param> - <name>Unit Number</name> - <key>which</key> - <value>0</value> - <type>int</type> - </param> - <param> - <name>Interpolation</name> - <key>interpolation</key> - <type>int</type> - </param> - <param> - <name>Frequency (Hz)</name> - <key>frequency</key> - <type>real</type> - </param> - <param> - <name>LO Offset (Hz)</name> - <key>lo_offset</key> - <value>float('inf')</value> - <type>real</type> - <hide>#if $lo_offset() == float('inf') then 'part' else 'none'#</hide> - <option> - <name>Default</name> - <key>float('inf')</key> - </option> - </param> - <param> - <name>Gain (dB)</name> - <key>gain</key> - <value>0</value> - <type>real</type> - </param> - <param> - <name>Side</name> - <key>side</key> - <value>A</value> - <type>string</type> - <option> - <name>A</name> - <key>A</key> - </option> - <option> - <name>B</name> - <key>B</key> - </option> - </param> - <param> - <name>Transmit</name> - <key>transmit</key> - <value></value> - <type>enum</type> - <hide>#if $transmit.tx_enb then 'none' else 'part'#</hide> - <option> - <name>Unconfigured</name> - <key></key> - <opt>tx_enb:</opt> - <opt>auto_tr:</opt> - </option> - <option> - <name>Enable</name> - <key>tx_enb</key> - <opt>tx_enb:1</opt> - <opt>auto_tr:</opt> - </option> - <option> - <name>Auto T/R</name> - <key>auto_tr</key> - <opt>tx_enb:1</opt> - <opt>auto_tr:1</opt> - </option> - </param> - <sink> - <name>in</name> - <type>$type</type> - </sink> - <doc> -The USRP sink inputs 128 Megasamples per second / interpolation. - -Input amplitude should be between 0 and 32767. - -Flex RF boards only: The "Transmit Setting" must be configured. \ -When set to "Enable" the transmitter is always on. \ -When set to "Auto Transmit/Receive", the transmitter is disabled while receiving. - </doc> -</block> diff --git a/gr-usrp/grc/usrp_simple_source_x.xml b/gr-usrp/grc/usrp_simple_source_x.xml deleted file mode 100644 index a79c78c20d..0000000000 --- a/gr-usrp/grc/usrp_simple_source_x.xml +++ /dev/null @@ -1,168 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##USRP Simple Source -################################################### - --> -<block> - <name>USRP1 Source</name> - <key>usrp_simple_source_x</key> - <category>USRP</category> - <import>from grc_gnuradio import usrp as grc_usrp</import> - <make>grc_usrp.simple_source_$(type.fcn)(which=$which, side=$side, rx_ant=$rx_ant#if $hb_filters() then ', no_hb=True' else ''#) -#if $format() -self.$(id).set_format(width=$format.width, shift=$format.shift) -#end if -self.$(id).set_decim_rate($decimation) -self.$(id).set_frequency($frequency, verbose=True#slurp -#if $lo_offset() != float('inf') -, lo_offset=$lo_offset#slurp -#end if -) -self.$(id).set_gain($gain)</make> - <callback>set_decim_rate($decimation)</callback> - <callback>set_frequency($frequency#slurp -#if $lo_offset() != float('inf') -, lo_offset=$lo_offset#slurp -#end if -)</callback> - <callback>set_gain($gain)</callback> - <param> - <name>Output Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>Complex</name> - <key>complex</key> - <opt>fcn:c</opt> - </option> - <option> - <name>Short</name> - <key>short</key> - <opt>fcn:s</opt> - </option> - </param> - <param> - <name>Format</name> - <key>format</key> - <value></value> - <type>enum</type> - <hide>#if $format() then '' else 'part'#</hide> - <option> - <name>16 Bits (Default)</name> - <key></key> - <opt>width:16</opt> - <opt>shift:0</opt> - </option> - <option> - <name>8 Bits, Shift 8</name> - <key>w8_s8</key> - <opt>width:8</opt> - <opt>shift:8</opt> - </option> - </param> - <param> - <name>Unit Number</name> - <key>which</key> - <value>0</value> - <type>int</type> - </param> - <param> - <name>Decimation</name> - <key>decimation</key> - <type>int</type> - </param> - <param> - <name>Frequency (Hz)</name> - <key>frequency</key> - <type>real</type> - </param> - <param> - <name>LO Offset (Hz)</name> - <key>lo_offset</key> - <value>float('inf')</value> - <type>real</type> - <hide>#if $lo_offset() == float('inf') then 'part' else 'none'#</hide> - <option> - <name>Default</name> - <key>float('inf')</key> - </option> - </param> - <param> - <name>Gain (dB)</name> - <key>gain</key> - <value>0</value> - <type>real</type> - </param> - <param> - <name>Side</name> - <key>side</key> - <value>A</value> - <type>string</type> - <option> - <name>A</name> - <key>A</key> - </option> - <option> - <name>B</name> - <key>B</key> - </option> - </param> - <param> - <name>RX Antenna</name> - <key>rx_ant</key> - <value>RXA</value> - <type>string</type> - <option> - <name>RXA</name> - <key>RXA</key> - </option> - <option> - <name>RXB</name> - <key>RXB</key> - </option> - <option> - <name>RXAB</name> - <key>RXAB</key> - </option> - <option> - <name>TX/RX</name> - <key>TX/RX</key> - </option> - <option> - <name>RX2</name> - <key>RX2</key> - </option> - </param> - <param> - <name>Halfband Filters</name> - <key>hb_filters</key> - <value></value> - <type>enum</type> - <hide>#if $hb_filters() then 'none' else 'part'#</hide> - <option> - <name>Enable</name> - <key></key> - </option> - <option> - <name>Disable</name> - <key>1</key> - </option> - </param> - <source> - <name>out</name> - <type>$type</type> - </source> - <doc> -The USRP source outputs 64 Megasamples per second / decimation. - -The "Receive Antenna Setting" selects one of the SMA connectors as the data source. \ -Flex RF boards use the "TX/RX" and "RX2" settings. \ -Basic RX and LFRX use the "RXA", "RXB", and "RXAB" settings. \ -All other boards use the "RXA" setting. - -With the format set to 8 bits and the halfband filters disabled, the USRP can acheive a decimation rate of 4. \ -Disabling the halfband filters requires a special USRP firmware without halfband filters or TX paths. \ -For this reason, the USRP cannot transmit with the halfband filters disabled. - </doc> -</block> diff --git a/gr-usrp/src/.gitignore b/gr-usrp/src/.gitignore deleted file mode 100644 index 96caf587fa..0000000000 --- a/gr-usrp/src/.gitignore +++ /dev/null @@ -1,16 +0,0 @@ -/Makefile -/Makefile.in -/.deps -/.libs -/*.la -/*.lo -/usrp_swig.cc -/usrp_swig.py -/usrp_swig.scm -/run_tests -/run_guile_tests -/usrp_dbids.py -/*.pyc -/gnuradio -/guile -/python diff --git a/gr-usrp/src/Makefile.am b/gr-usrp/src/Makefile.am deleted file mode 100644 index 29cedc96aa..0000000000 --- a/gr-usrp/src/Makefile.am +++ /dev/null @@ -1,119 +0,0 @@ -# -# Copyright 2004,2005,2006,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 -include $(top_srcdir)/Makefile.swig - - -TESTS = -EXTRA_DIST += run_tests.in run_guile_tests.in $(nobase_guile_DATA) -DISTCLEANFILES += run_tests run_guile_tests - -noinst_PYTHON = qa_usrp.py -noinst_GUILE = usrp.test - -if GUILE -nobase_guile_DATA = gnuradio/usrp.scm -endif - -# ---------------------------------------------------------------- -# The straight C++ library - -AM_CPPFLAGS = \ - $(USRP_INCLUDES) \ - $(STD_DEFINES_AND_INCLUDES) \ - $(PYTHON_CPPFLAGS) \ - $(USB_INCLUDES) \ - $(WITH_INCLUDES) - -lib_LTLIBRARIES = \ - libgnuradio-usrp.la - -libgnuradio_usrp_la_SOURCES = \ - usrp_base.cc \ - usrp_sink_base.cc \ - usrp_sink_c.cc \ - usrp_sink_s.cc \ - usrp_source_base.cc \ - usrp_source_c.cc \ - usrp_source_s.cc - -libgnuradio_usrp_la_LIBADD = \ - $(GNURADIO_CORE_LA) \ - $(USRP_LA) - -libgnuradio_usrp_la_LDFLAGS = $(NO_UNDEFINED) $(LTVERSIONFLAGS) - -grinclude_HEADERS = \ - usrp_base.h \ - usrp_sink_base.h \ - usrp_sink_c.h \ - usrp_sink_s.h \ - usrp_source_base.h \ - usrp_source_c.h \ - usrp_source_s.h - -# ---------------------------------------------------------------- -# The SWIG library - -TOP_SWIG_IFILES = \ - usrp_swig.i - -# Install so that they end up available as: -# import gnuradio.usrp -# This ends up at: -# ${prefix}/lib/python${python_version}/site-packages/gnuradio/usrp -usrp_swig_pythondir_category = \ - gnuradio/usrp - -# additional arguments to the SWIG command -usrp_swig_swig_args = \ - $(DEFAULT_INCLUDES) \ - $(USRP_INCLUDES) - -# additional libraries for linking with the SWIG-generated library -usrp_swig_la_swig_libadd = \ - libgnuradio-usrp.la - -# additional Python files to be installed along with the SWIG-generated one -usrp_swig_python = \ - __init__.py - -# additional SWIG files to be installed -usrp_swig_swiginclude_headers = \ - usrp_base.i \ - usrp_source_base.i \ - usrp_source_c.i \ - usrp_source_s.i \ - usrp_sink_base.i \ - usrp_sink_c.i \ - usrp_sink_s.i \ - usrp_standard.i - - -if PYTHON -TESTS += run_tests -endif - -if GUILE -TESTS += run_guile_tests -endif - diff --git a/gr-usrp/src/Makefile.swig.gen b/gr-usrp/src/Makefile.swig.gen deleted file mode 100644 index 00ecfcb54b..0000000000 --- a/gr-usrp/src/Makefile.swig.gen +++ /dev/null @@ -1,145 +0,0 @@ -# -*- Makefile -*- -# -# Copyright 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. -# - -# Makefile.swig.gen for usrp_swig.i - -## Default install locations for these files: -## -## Default location for the Python directory is: -## ${prefix}/lib/python${python_version}/site-packages/[category]/usrp_swig -## Default location for the Python exec directory is: -## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/usrp_swig -## -## The following can be overloaded to change the install location, but -## this has to be done in the including Makefile.am -before- -## Makefile.swig is included. - -usrp_swig_pythondir_category ?= gnuradio/usrp_swig -usrp_swig_pylibdir_category ?= $(usrp_swig_pythondir_category) -usrp_swig_pythondir = $(pythondir)/$(usrp_swig_pythondir_category) -usrp_swig_pylibdir = $(pyexecdir)/$(usrp_swig_pylibdir_category) - -# The .so libraries for the guile modules get installed whereever guile -# is installed, usually /usr/lib/guile/gnuradio/ -# FIXME: determince whether these should be installed with gnuradio. -usrp_swig_scmlibdir = $(libdir) - -# The scm files for the guile modules get installed where ever guile -# is installed, usually /usr/share/guile/site/usrp_swig -# FIXME: determince whether these should be installed with gnuradio. -usrp_swig_scmdir = $(guiledir) - -## SWIG headers are always installed into the same directory. - -usrp_swig_swigincludedir = $(swigincludedir) - -## This is a template file for a "generated" Makefile addition (in -## this case, "Makefile.swig.gen"). By including the top-level -## Makefile.swig, this file will be used to generate the SWIG -## dependencies. Assign the variable TOP_SWIG_FILES to be the list of -## SWIG .i files to generated wrappings for; there can be more than 1 -## so long as the names are unique (no sorting is done on the -## TOP_SWIG_FILES list). This file explicitly assumes that a SWIG .i -## file will generate .cc, .py, and possibly .h files -- meaning that -## all of these files will have the same base name (that provided for -## the SWIG .i file). -## -## This code is setup to ensure parallel MAKE ("-j" or "-jN") does the -## right thing. For more info, see < -## http://sources.redhat.com/automake/automake.html#Multiple-Outputs > - -## Other cleaned files: dependency files generated by SWIG or this Makefile - -MOSTLYCLEANFILES += $(DEPDIR)/*.S* - -## Various SWIG variables. These can be overloaded in the including -## Makefile.am by setting the variable value there, then including -## Makefile.swig . - -usrp_swig_swiginclude_HEADERS = \ - usrp_swig.i \ - $(usrp_swig_swiginclude_headers) - -if PYTHON -usrp_swig_pylib_LTLIBRARIES = \ - _usrp_swig.la - -_usrp_swig_la_SOURCES = \ - python/usrp_swig.cc \ - $(usrp_swig_la_swig_sources) - -usrp_swig_python_PYTHON = \ - usrp_swig.py \ - $(usrp_swig_python) - -_usrp_swig_la_LIBADD = \ - $(STD_SWIG_LA_LIB_ADD) \ - $(usrp_swig_la_swig_libadd) - -_usrp_swig_la_LDFLAGS = \ - $(STD_SWIG_LA_LD_FLAGS) \ - $(usrp_swig_la_swig_ldflags) - -_usrp_swig_la_CXXFLAGS = \ - $(STD_SWIG_CXX_FLAGS) \ - -I$(top_builddir) \ - $(usrp_swig_la_swig_cxxflags) - -python/usrp_swig.cc: usrp_swig.py -usrp_swig.py: usrp_swig.i - -# Include the python dependencies for this file --include python/usrp_swig.d - -endif # end of if python - -if GUILE - -usrp_swig_scmlib_LTLIBRARIES = \ - libguile-gnuradio-usrp_swig.la -libguile_gnuradio_usrp_swig_la_SOURCES = \ - guile/usrp_swig.cc \ - $(usrp_swig_la_swig_sources) -nobase_usrp_swig_scm_DATA = \ - gnuradio/usrp_swig.scm \ - gnuradio/usrp_swig-primitive.scm -libguile_gnuradio_usrp_swig_la_LIBADD = \ - $(STD_SWIG_LA_LIB_ADD) \ - $(usrp_swig_la_swig_libadd) -libguile_gnuradio_usrp_swig_la_LDFLAGS = \ - $(STD_SWIG_LA_LD_FLAGS) \ - $(usrp_swig_la_swig_ldflags) -libguile_gnuradio_usrp_swig_la_CXXFLAGS = \ - $(STD_SWIG_CXX_FLAGS) \ - -I$(top_builddir) \ - $(usrp_swig_la_swig_cxxflags) - -guile/usrp_swig.cc: gnuradio/usrp_swig.scm -gnuradio/usrp_swig.scm: usrp_swig.i -gnuradio/usrp_swig-primitive.scm: gnuradio/usrp_swig.scm - -# Include the guile dependencies for this file --include guile/usrp_swig.d - -endif # end of GUILE - - diff --git a/gr-usrp/src/__init__.py b/gr-usrp/src/__init__.py deleted file mode 100644 index c81b2f2b0b..0000000000 --- a/gr-usrp/src/__init__.py +++ /dev/null @@ -1,28 +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. -# - -# The presence of this file turns this directory into a Python package - -# Add SWIG generated code to this namespace -from usrp_swig import * - -# Add other content from pure-Python modules here - diff --git a/gr-usrp/src/flexrf_debug_gui.py b/gr-usrp/src/flexrf_debug_gui.py deleted file mode 100755 index ff32900a5c..0000000000 --- a/gr-usrp/src/flexrf_debug_gui.py +++ /dev/null @@ -1,176 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005 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. -# - -import sys -import wx -from gnuradio.wxgui import form - -class flexrf_debug_gui(wx.Frame): - def __init__(self, flexrf, title="Flexrf Debug"): - wx.Frame.__init__(self, None, -1, title) - - self.flexrf = flexrf - - self.CreateStatusBar (1) - - self.panel = wx.Panel(self, -1) - self.vbox = wx.BoxSizer(wx.VERTICAL) - self.panel.SetSizer(self.vbox) - self.panel.SetAutoLayout(True) - - self._create_form() - - self.vbox.Fit(self.panel) - - self.frame_vbox = wx.BoxSizer(wx.VERTICAL) - self.frame_vbox.Add(self.panel, 1, wx.EXPAND) - self.SetSizer(self.frame_vbox) - self.SetAutoLayout(True) - self.frame_vbox.Fit(self) - - def _create_form(self): - self._create_set_freq() - self._create_write_fpga() - self._create_write_all() - self._create_write_it() - #self._create_set_gain() - - # ---------------------------------------------------------------- - - def _create_set_freq(self): - - def _set_freq(kv): - return self.flexrf.set_freq(kv['freq'])[0] - - sbs = wx.StaticBoxSizer(wx.StaticBox(self.panel), wx.HORIZONTAL) - sbs.Add((5,0), 0.1) # stretchy space - #sbs.Add(wx.StaticText(self.panel, -1, "set_freq "), 0, 0) - #sbs.Add((5,0), 0.1) # stretchy space - myform = form.form() - myform['freq'] = form.float_field(self.panel, sbs, "Set Frequency") - sbs.Add((5,0), 0.1) # stretchy space - sbs.Add(form.button_with_callback(self.panel, "Do It!", - self._generic_doit(_set_freq, myform)), 1, wx.EXPAND) - sbs.Add((5,0), 0.1) # stretchy space - self.vbox.Add(sbs, 0, wx.EXPAND) - - - def _create_write_fpga(self): - - def _write_fpga(kv): - return self.flexrf._u._write_fpga_reg(kv['regno'], kv['value']) - - sbs = wx.StaticBoxSizer(wx.StaticBox(self.panel), wx.HORIZONTAL) - sbs.Add((5,0), 0.1) # stretchy space - sbs.Add(wx.StaticText(self.panel, -1, "write_fpga_reg "), 0, 0) - sbs.Add((5,0), 0.1) # stretchy space - myform = form.form() - myform['regno'] = form.int_field(self.panel, sbs, "regno") - sbs.Add((5,0), 0.1) # stretchy space - myform['value'] = form.int_field(self.panel, sbs, "value") - sbs.Add((5,0), 0.1) # stretchy space - sbs.Add(form.button_with_callback(self.panel, "Do It!", - self._generic_doit(_write_fpga, myform)), 1, wx.EXPAND) - sbs.Add((5,0), 0.1) # stretchy space - self.vbox.Add(sbs, 0, wx.EXPAND) - - - def _create_write_all(self): - - def _write_all(kv): - self.flexrf._write_all(kv['R'], kv['control'], kv['N']) # void - return True - - sbs = wx.StaticBoxSizer(wx.StaticBox(self.panel), wx.HORIZONTAL) - sbs.Add((5,0), 0.1) # stretchy space - sbs.Add(wx.StaticText(self.panel, -1, "write_all "), 0, 0) - sbs.Add((5,0), 0.1) # stretchy space - myform = form.form() - myform['R'] = form.int_field(self.panel, sbs, "R") - sbs.Add((5,0), 0.1) # stretchy space - myform['control'] = form.int_field(self.panel, sbs, "control") - sbs.Add((5,0), 0.1) # stretchy space - myform['N'] = form.int_field(self.panel, sbs, "N") - sbs.Add((5,0), 0.1) # stretchy space - sbs.Add(form.button_with_callback(self.panel, "Do It!", - self._generic_doit(_write_all, myform)), 1, wx.EXPAND) - sbs.Add((5,0), 0.1) # stretchy space - self.vbox.Add(sbs, 0, wx.EXPAND) - - - def _create_write_it(self): - - def _write_it(kv): - self.flexrf._write_it(kv['v']) # void - return True - - sbs = wx.StaticBoxSizer(wx.StaticBox(self.panel), wx.HORIZONTAL) - sbs.Add((5,0), 0.1) # stretchy space - sbs.Add(wx.StaticText(self.panel, -1, "write_it "), 0, 0) - sbs.Add((5,0), 0.1) # stretchy space - myform = form.form() - myform['v'] = form.int_field(self.panel, sbs, "24-bit value") - sbs.Add((5,0), 0.1) # stretchy space - sbs.Add(form.button_with_callback(self.panel, "Do It!", - self._generic_doit(_write_it, myform)), 1, wx.EXPAND) - sbs.Add((5,0), 0.1) # stretchy space - self.vbox.Add(sbs, 0, wx.EXPAND) - - - # ---------------------------------------------------------------- - - def _set_status_msg(self, msg): - self.GetStatusBar().SetStatusText(msg, 0) - - def _generic_doit(self, callback, form): - - def button_callback(): - errors = form.check_input_for_errors() - if errors: - self._set_status_msg(errors[0]) - print '\n'.join(tuple(errors)) - else: - kv = form.get_key_vals() - if callback(kv): - self._set_status_msg("OK") - else: - self._set_status_msg("Failed") - - return button_callback - - - -if False and __name__ == '__main__': - - class demo_app (wx.App): - def __init__ (self): - wx.App.__init__(self) - - def OnInit (self): - frame = flexrf_debug_gui(None, "Debug FlexRF TX") - frame.Show(True) - self.SetTopWindow (frame) - return True - - app = demo_app() - app.MainLoop() - diff --git a/gr-usrp/src/gnuradio/.gitignore b/gr-usrp/src/gnuradio/.gitignore deleted file mode 100644 index 0c4d489ab5..0000000000 --- a/gr-usrp/src/gnuradio/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -usrp_swig-primitive.scm -usrp_swig.scm diff --git a/gr-usrp/src/gnuradio/usrp.scm b/gr-usrp/src/gnuradio/usrp.scm deleted file mode 100644 index e01c9454a6..0000000000 --- a/gr-usrp/src/gnuradio/usrp.scm +++ /dev/null @@ -1,27 +0,0 @@ -;;; -;;; Copyright 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 this program. If not, see <http://www.gnu.org/licenses/>. -;;; - -;;; Semi bogus module that just re-exports the usrp_swig module - -(define-module (gnuradio usrp) - #:use-module (gnuradio export-safely) - #:use-module (gnuradio usrp_swig) - #:duplicates (merge-generics replace check)) - -(re-export-all '(gnuradio usrp_swig)) diff --git a/gr-usrp/src/qa_usrp.py b/gr-usrp/src/qa_usrp.py deleted file mode 100755 index 06e630330a..0000000000 --- a/gr-usrp/src/qa_usrp.py +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005,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. -# - -from gnuradio import gr, gr_unittest -import usrp_swig - -class test_usrp (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test_000_nop (self): - """Just see if we can import the module... - They may not have a USRP connected, etc. Don't try to run anything""" - pass - -if __name__ == '__main__': - gr_unittest.run(test_usrp, "test_usrp.xml") diff --git a/gr-usrp/src/run_guile_tests.in b/gr-usrp/src/run_guile_tests.in deleted file mode 100644 index 5d08b0dd53..0000000000 --- a/gr-usrp/src/run_guile_tests.in +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - -. @top_builddir@/setup_guile_test_env - -# 1st argument is absolute path to hand coded guile source directory -# 2nd argument is absolute path to component C++ shared library build directory -# 3nd argument is absolute path to component SWIG build directory - -add_local_paths \ - @srcdir@ \ - @abs_builddir@ \ - @abs_builddir@ - -@GUILE@ -e main -c '(use-modules (gnuradio test-suite guile-test))' -t @srcdir@ diff --git a/gr-usrp/src/run_tests.in b/gr-usrp/src/run_tests.in deleted file mode 100644 index c03f96e0b6..0000000000 --- a/gr-usrp/src/run_tests.in +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -# 1st parameter is absolute path to component source directory -# 2nd parameter is absolute path to component build directory -# 3rd parameter is path to Python QA directory - -# For OS/X -DYLD_LIBRARY_PATH=@abs_top_builddir@/usrp/host/lib:@abs_top_builddir@/usrp/host/lib/.libs:$DYLD_LIBRARY_PATH -export DYLD_LIBRARY_PATH - -# For Win32 -PATH=@abs_top_builddir@/usrp/host/lib:@abs_top_builddir@/usrp/host/lib/.libs:$PATH - -@top_builddir@/run_tests.sh \ - @abs_top_srcdir@/gr-usrp \ - @abs_top_builddir@/gr-usrp \ - @srcdir@ diff --git a/gr-usrp/src/tx_debug_gui.py b/gr-usrp/src/tx_debug_gui.py deleted file mode 100755 index 6b2a0c2597..0000000000 --- a/gr-usrp/src/tx_debug_gui.py +++ /dev/null @@ -1,187 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005 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. -# - -import sys -import wx -from gnuradio.wxgui import form - -class tx_debug_gui(wx.Frame): - def __init__(self, tx_subdev, title="Tx Debug"): - wx.Frame.__init__(self, None, -1, title) - - self.subdev = tx_subdev - self.subdev._u.set_verbose(True) - - self.CreateStatusBar (1) - - self.panel = wx.Panel(self, -1) - self.vbox = wx.BoxSizer(wx.VERTICAL) - self.panel.SetSizer(self.vbox) - self.panel.SetAutoLayout(True) - - self._create_form() - - self.vbox.Fit(self.panel) - - self.frame_vbox = wx.BoxSizer(wx.VERTICAL) - self.frame_vbox.Add(self.panel, 1, wx.EXPAND) - self.SetSizer(self.frame_vbox) - self.SetAutoLayout(True) - self.frame_vbox.Fit(self) - - # ---------------------------------------------------------------- - - def _write_9862(self, regno, v): - return self.subdev._u._write_9862(self.subdev._which, regno, v) - - def _set_dac_offset(self, i_or_q, offset, offset_pin): - return self.subdev._u.set_dac_offset(self.subdev._which * 2 + i_or_q, offset, offset_pin) - - def _set_dac_fine_gain(self, i_or_q, gain, coarse): - return self._write_9862(14 + i_or_q, (coarse & 0xC0) | (gain & 0x3f)) - - def _create_form(self): - self._create_dac_offset() - self._create_dac_fine_gain() - self._create_pga() - - # ---------------------------------------------------------------- - - def _create_dac_offset(self): - - sbs = wx.StaticBoxSizer(wx.StaticBox(self.panel), wx.VERTICAL) - - hbox = wx.BoxSizer(wx.HORIZONTAL) - hbox.Add(wx.StaticText(self.panel, -1, "DAC Offset"), 5, 0) - sbs.Add(hbox, 0, 1) - - - self._create_dac_offset_helper(sbs, 0) - self._create_dac_offset_helper(sbs, 1) - - self.vbox.Add(sbs, 0, wx.EXPAND) - - def _create_dac_offset_helper(self, vbox, i_or_q): - - def doit(kv): - drive_positive = kv['drive_positive'] - dac_offset = kv['dac_offset'] - print "drive_positive =", drive_positive - print "dac_offset[%d] = %4d" % (i_or_q, dac_offset) - - # FIXME signed magnitude?? - # dac_offset = signed_mag10(dac_offset) - return self._set_dac_offset(i_or_q, dac_offset, int(drive_positive)) - - def signed_mag10(x): - # not clear from doc if this is really 2's comp or 10-bit signed magnitude - # we'll guess it's 10-bit signed mag - if x < 0: - return (1 << 9) | min(511, max(0, abs(x))) - else: - return (0 << 9) | min(511, max(0, abs(x))) - - myform = form.form() - hbox = wx.BoxSizer(wx.HORIZONTAL) - vbox.Add(hbox, 0, wx.EXPAND) - myform['drive_positive'] = form.checkbox_field(parent=self.panel, sizer=hbox, - callback=myform.check_input_and_call(doit), - weight=0, - label="drive +ve") - myform['dac_offset'] = form.slider_field(parent=self.panel, sizer=hbox, - callback=myform.check_input_and_call(doit), - min=-512, max=511, value=0, - weight=5) - - # ---------------------------------------------------------------- - - def _create_dac_fine_gain(self): - sbs = wx.StaticBoxSizer(wx.StaticBox(self.panel), wx.VERTICAL) - - hbox = wx.BoxSizer(wx.HORIZONTAL) - hbox.Add(wx.StaticText(self.panel, -1, "DAC Gain"), 5, 0) - sbs.Add(hbox, 0, 1) - - self._create_dac_gain_helper(sbs, 0) - self._create_dac_gain_helper(sbs, 1) - - self.vbox.Add(sbs, 0, wx.EXPAND) - - def _create_dac_gain_helper(self, vbox, i_or_q): - - d = { "1/1" : 0xC0, - "1/2" : 0x40, - "1/11" : 0x00 } - - def doit(kv): - dac_gain = kv['dac_gain'] - coarse_s = kv['coarse'] - print "dac_gain[%d] = %4d" % (i_or_q, dac_gain) - print "coarse = ", coarse_s - return self._set_dac_fine_gain(i_or_q, dac_gain, d[coarse_s]) - - myform = form.form() - hbox = wx.BoxSizer(wx.HORIZONTAL) - vbox.Add(hbox, 0, wx.EXPAND) - myform['coarse'] = form.radiobox_field(parent=self.panel, sizer=hbox, - callback=myform.check_input_and_call(doit), - choices=['1/11', '1/2', '1/1'], - weight=1, value='1/1') - myform['dac_gain'] = form.slider_field(parent=self.panel, sizer=hbox, - callback=myform.check_input_and_call(doit), - min=-32, max=31, value=0, - weight=4) - - - # ---------------------------------------------------------------- - - def _create_pga(self): - sbs = wx.StaticBoxSizer(wx.StaticBox(self.panel), wx.VERTICAL) - - form.quantized_slider_field(parent=self.panel, sizer=sbs, label="PGA", - weight=3, range=self.subdev.gain_range(), - callback=self.subdev.set_gain) - - self.vbox.Add(sbs, 0, wx.EXPAND) - - - # ---------------------------------------------------------------- - - - def _set_status_msg(self, msg): - self.GetStatusBar().SetStatusText(msg, 0) - - -if False and __name__ == '__main__': - - class demo_app (wx.App): - def __init__ (self): - wx.App.__init__(self) - - def OnInit (self): - frame = tx_debug_gui(None, "Debug TX") - frame.Show(True) - self.SetTopWindow (frame) - return True - - app = demo_app() - app.MainLoop() diff --git a/gr-usrp/src/usrp.test b/gr-usrp/src/usrp.test deleted file mode 100644 index 740fe30553..0000000000 --- a/gr-usrp/src/usrp.test +++ /dev/null @@ -1,37 +0,0 @@ -;;; -*- Scheme -*- -;;; -;;; Copyright 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 this program. If not, see <http://www.gnu.org/licenses/>. -;;; - -;;; If you're using Emacs's Scheme mode: -;;; (put 'with-test-prefix 'scheme-indent-function 1) - -;;; See the comments in gnuradio/test-suite/lib.scm for info on writing tests. -;;; See also the very end of the file, where the test-equal, test-eqv -;;; and test-eq macros are defined. - -(define-module (test-module) - #:use-module (oop goops) - #:use-module (gnuradio core) - #:use-module (gnuradio test-suite lib) - #:duplicates (merge-generics replace check)) - -;;; Just see if we can import the module... -;;; They may not have a USRP attached and powered up - -(use-modules (gnuradio usrp)) diff --git a/gr-usrp/src/usrp_base.cc b/gr-usrp/src/usrp_base.cc deleted file mode 100644 index 1d632a5673..0000000000 --- a/gr-usrp/src/usrp_base.cc +++ /dev/null @@ -1,322 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <usrp_base.h> -#include <usrp/usrp_basic.h> - -class truth_table_element_t -{ -public: - truth_table_element_t(int side, unsigned int uses, bool swap_iq, unsigned int mux_val); - bool operator==(const truth_table_element_t &in); - bool operator!=(const truth_table_element_t &in); - - unsigned int mux_val() { return d_mux_val; } - -private: - int d_side; - unsigned int d_uses; - bool d_swap_iq; - unsigned int d_mux_val; -}; - - -usrp_base::~usrp_base() -{ -} - -void -usrp_base::set_usrp_basic(boost::shared_ptr<usrp_basic> u) -{ - d_usrp_basic = u; -} - -std::vector<std::vector<db_base_sptr> > -usrp_base::db() -{ - return d_usrp_basic->db(); -} - -std::vector<db_base_sptr> -usrp_base::db(int which_side) -{ - return d_usrp_basic->db(which_side); -} - -db_base_sptr -usrp_base::db(int which_side, int which_dev) -{ - return d_usrp_basic->selected_subdev(usrp_subdev_spec(which_side, which_dev)); -} - -db_base_sptr -usrp_base::selected_subdev(usrp_subdev_spec ss) -{ - return d_usrp_basic->selected_subdev(ss); -} - -long -usrp_base::fpga_master_clock_freq() const -{ - return d_usrp_basic->fpga_master_clock_freq(); -} - -void -usrp_base::set_fpga_master_clock_freq(long master_clock) -{ - d_usrp_basic->set_fpga_master_clock_freq(master_clock); -} - -void -usrp_base::set_verbose (bool verbose) -{ - d_usrp_basic->set_verbose (verbose); -} - -bool -usrp_base::write_eeprom (int i2c_addr, int eeprom_offset, const std::string buf) -{ - return d_usrp_basic->write_eeprom (i2c_addr, eeprom_offset, buf); -} - -std::string -usrp_base::read_eeprom (int i2c_addr, int eeprom_offset, int len) -{ - return d_usrp_basic->read_eeprom (i2c_addr, eeprom_offset, len); -} - -bool -usrp_base::write_i2c (int i2c_addr, const std::string buf) -{ - return d_usrp_basic->write_i2c (i2c_addr, buf); -} - -std::string -usrp_base::read_i2c (int i2c_addr, int len) -{ - return d_usrp_basic->read_i2c (i2c_addr, len); -} - -bool -usrp_base::set_adc_offset (int which, int offset) -{ - return d_usrp_basic->set_adc_offset (which, offset); -} - -bool -usrp_base::set_dac_offset (int which, int offset, int offset_pin) -{ - return d_usrp_basic->set_dac_offset (which, offset, offset_pin); -} - -bool -usrp_base::set_adc_buffer_bypass (int which, bool bypass) -{ - return d_usrp_basic->set_adc_buffer_bypass (which, bypass); -} - -bool -usrp_base::set_dc_offset_cl_enable(int bits, int mask) -{ - return d_usrp_basic->set_dc_offset_cl_enable(bits, mask); -} - -std::string -usrp_base::serial_number() -{ - return d_usrp_basic->serial_number(); -} - -int -usrp_base::daughterboard_id (int which) const -{ - return d_usrp_basic->daughterboard_id (which); -} - -bool -usrp_base::write_atr_tx_delay(int value) -{ - return d_usrp_basic->write_atr_tx_delay(value); -} - -bool -usrp_base::write_atr_rx_delay(int value) -{ - return d_usrp_basic->write_atr_rx_delay(value); -} - -bool -usrp_base::set_pga (int which, double gain) -{ - return d_usrp_basic->set_pga (which, gain); -} - -double -usrp_base::pga (int which) const -{ - return d_usrp_basic->pga (which); -} - -double -usrp_base::pga_min () const -{ - return d_usrp_basic->pga_min (); -} - -double -usrp_base::pga_max () const -{ - return d_usrp_basic->pga_max (); -} - -double -usrp_base::pga_db_per_step () const -{ - return d_usrp_basic->pga_db_per_step (); -} - -bool -usrp_base::_write_oe (int which_dboard, int value, int mask) -{ - return d_usrp_basic->_write_oe (which_dboard, value, mask); -} - -bool -usrp_base::write_io (int which_dboard, int value, int mask) -{ - return d_usrp_basic->write_io (which_dboard, value, mask); -} - -int -usrp_base::read_io (int which_dboard) -{ - return d_usrp_basic->read_io (which_dboard); -} - -bool -usrp_base::write_atr_mask(int which_side, int value) -{ - return d_usrp_basic->write_atr_mask(which_side, value); -} - -bool -usrp_base::write_atr_txval(int which_side, int value) -{ - return d_usrp_basic->write_atr_txval(which_side, value); -} - -bool -usrp_base::write_atr_rxval(int which_side, int value) -{ - return d_usrp_basic->write_atr_rxval(which_side, value); -} - -bool -usrp_base::write_aux_dac (int which_dboard, int which_dac, int value) -{ - return d_usrp_basic->write_aux_dac (which_dboard, which_dac, value); -} - -int -usrp_base::read_aux_adc (int which_dboard, int which_adc) -{ - return d_usrp_basic->read_aux_adc (which_dboard, which_adc); -} - -long -usrp_base::converter_rate() const -{ - return d_usrp_basic->converter_rate(); -} - -bool -usrp_base::_set_led(int which_led, bool on) -{ - return d_usrp_basic->_set_led(which_led, on); -} - -bool -usrp_base::_write_fpga_reg (int regno, int value) -{ - return d_usrp_basic->_write_fpga_reg (regno, value); -} - -bool -usrp_base::_write_fpga_reg_masked (int regno, int value, int mask) -{ - return d_usrp_basic->_write_fpga_reg_masked (regno, value, mask); -} - -int -usrp_base::_read_fpga_reg (int regno) -{ - return d_usrp_basic->_read_fpga_reg (regno); -} - -bool -usrp_base::_write_9862 (int which_codec, int regno, unsigned char value) -{ - return d_usrp_basic->_write_9862 (which_codec, regno, value); -} - -int -usrp_base::_read_9862 (int which_codec, int regno) const -{ - return d_usrp_basic->_read_9862 (which_codec, regno); -} - -bool -usrp_base::_write_spi (int optional_header, int enables, - int format, std::string buf) -{ - return d_usrp_basic->_write_spi (optional_header, enables, format, buf); -} - -std::string -usrp_base::_read_spi (int optional_header, int enables, int format, int len) -{ - return d_usrp_basic->_read_spi (optional_header, enables, format, len); -} - -usrp_subdev_spec -usrp_base::pick_subdev(std::vector<int> candidates) -{ - int dbid0 = db(0, 0)->dbid(); - int dbid1 = db(1, 0)->dbid(); - - for (int i = 0; i < candidates.size(); i++) { - int dbid = candidates[i]; - if (dbid0 == dbid) - return usrp_subdev_spec(0, 0); - if (dbid1 == dbid) - return usrp_subdev_spec(1, 0); - } - - if (dbid0 >= 0) - return usrp_subdev_spec(0, 0); - if (dbid1 >= 0) - return usrp_subdev_spec(1, 0); - - throw std::runtime_error("No suitable daughterboard found!"); -} diff --git a/gr-usrp/src/usrp_base.h b/gr-usrp/src/usrp_base.h deleted file mode 100644 index 7947723fba..0000000000 --- a/gr-usrp/src/usrp_base.h +++ /dev/null @@ -1,452 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#ifndef INCLUDED_USRP_BASE_H -#define INCLUDED_USRP_BASE_H - -#include <gr_sync_block.h> -#include <stdexcept> -#include <boost/shared_ptr.hpp> -#include <usrp/db_base.h> -#include <usrp/usrp_subdev_spec.h> - -class usrp_basic; - -/*! - * \brief base class for GNU Radio interface to the USRP - */ -class usrp_base : public gr_sync_block { -private: - boost::shared_ptr<usrp_basic> d_usrp_basic; - -protected: - usrp_base(const std::string &name, - gr_io_signature_sptr input_signature, - gr_io_signature_sptr output_signature) - : gr_sync_block(name, input_signature, output_signature) {} - - - void set_usrp_basic(boost::shared_ptr<usrp_basic> u); - -public: - virtual ~usrp_base(); - - /* ! - * Return a vector of vectors of daughterboard instances associated with - * the USRP source or sink. The first dimension of the returned vector - * corresponds to the side of the USRP, the second dimension, the subdevice - * on the particular daughterboard. - * - * N.B. To ensure proper lifetime management, the caller should - * continue to hold these as weak pointers, not shared pointers. - * As long as the caller does not attempt to directly use the weak - * pointers after this usrp object has been destroyed, everything - * will work out fine. - */ - std::vector<std::vector<db_base_sptr> > db(); - - /*! - * Return a vector of size 1 or 2 that contains shared pointers - * to the daughterboard instance(s) associated with the specified side. - * - * \param which_side [0,1] which daughterboard - * - * N.B. To ensure proper lifetime management, the caller should - * continue to hold these as weak pointers, not shared pointers. - * As long as the caller does not attempt to directly use the weak - * pointers after this usrp object has been destroyed, everything - * will work out fine. - */ - std::vector<db_base_sptr> db(int which_side); - - /*! - * Return the daughterboard instance corresponding to the selected - * side of the USRP and selected daughterboard subdevice. - * N.B. To ensure proper lifetime management, the caller should - * continue to hold these as weak pointers, not shared pointers. - * As long as the caller does not attempt to directly use the weak - * pointers after this usrp object has been destroyed, everything - * will work out fine. - */ - db_base_sptr db(int which_side, int which_dev); - - /*! - * \brief given a usrp_subdev_spec, return the corresponding daughterboard object. - * \throws std::invalid_argument if ss is invalid. - * - * \param ss specifies the side and subdevice - */ - db_base_sptr selected_subdev(usrp_subdev_spec ss); - - /*! - * \brief return frequency of master oscillator on USRP - */ - long fpga_master_clock_freq() const; - - /*! - * Tell API that the master oscillator on the USRP is operating at a non-standard - * fixed frequency. This is only needed for custom USRP hardware modified to - * operate at a different frequency from the default factory configuration. This - * function must be called prior to any other API function. - * \param master_clock USRP2 FPGA master clock frequency in Hz (10..64 MHz) - */ - void set_fpga_master_clock_freq (long master_clock); - - void set_verbose (bool on); - - //! magic value used on alternate register read interfaces - static const int READ_FAILED = -99999; - - /*! - * \brief Write EEPROM on motherboard or any daughterboard. - * \param i2c_addr I2C bus address of EEPROM - * \param eeprom_offset byte offset in EEPROM to begin writing - * \param buf the data to write - * \returns true iff sucessful - */ - bool write_eeprom (int i2c_addr, int eeprom_offset, const std::string buf); - - /*! - * \brief Read EEPROM on motherboard or any daughterboard. - * \param i2c_addr I2C bus address of EEPROM - * \param eeprom_offset byte offset in EEPROM to begin reading - * \param len number of bytes to read - * \returns the data read if successful, else a zero length string. - */ - std::string read_eeprom (int i2c_addr, int eeprom_offset, int len); - - /*! - * \brief Write to I2C peripheral - * \param i2c_addr I2C bus address (7-bits) - * \param buf the data to write - * \returns true iff successful - * Writes are limited to a maximum of of 64 bytes. - */ - bool write_i2c (int i2c_addr, const std::string buf); - - /*! - * \brief Read from I2C peripheral - * \param i2c_addr I2C bus address (7-bits) - * \param len number of bytes to read - * \returns the data read if successful, else a zero length string. - * Reads are limited to a maximum of 64 bytes. - */ - std::string read_i2c (int i2c_addr, int len); - - /*! - * \brief Set ADC offset correction - * \param which_adc which ADC[0,3]: 0 = RX_A I, 1 = RX_A Q... - * \param offset 16-bit value to subtract from raw ADC input. - */ - bool set_adc_offset (int which_adc, int offset); - - /*! - * \brief Set DAC offset correction - * \param which_dac which DAC[0,3]: 0 = TX_A I, 1 = TX_A Q... - * \param offset 10-bit offset value (ambiguous format: See AD9862 datasheet). - * \param offset_pin 1-bit value. If 0 offset applied to -ve differential pin; - * If 1 offset applied to +ve differential pin. - */ - bool set_dac_offset (int which_dac, int offset, int offset_pin); - - /*! - * \brief Control ADC input buffer - * \param which_adc which ADC[0,3] - * \param bypass if non-zero, bypass input buffer and connect input - * directly to switched cap SHA input of RxPGA. - */ - bool set_adc_buffer_bypass (int which_adc, bool bypass); - - /*! - * \brief Enable/disable automatic DC offset removal control loop in FPGA - * - * \param bits which control loops to enable - * \param mask which \p bits to pay attention to - * - * If the corresponding bit is set, enable the automatic DC - * offset correction control loop. - * - * <pre> - * The 4 low bits are significant: - * - * ADC0 = (1 << 0) - * ADC1 = (1 << 1) - * ADC2 = (1 << 2) - * ADC3 = (1 << 3) - * </pre> - * - * By default the control loop is enabled on all ADC's. - */ - bool set_dc_offset_cl_enable(int bits, int mask); - - /*! - * \brief return the usrp's serial number. - * - * \returns non-zero length string iff successful. - */ - std::string serial_number(); - - /*! - * \brief Return daughterboard ID for given side [0,1]. - * - * \param which_side [0,1] which daughterboard - * - * \return daughterboard id >= 0 if successful - * \return -1 if no daugherboard - * \return -2 if invalid EEPROM on daughterboard - */ - virtual int daughterboard_id (int which_side) const; - - /*! - * \brief Clock ticks to delay rising of T/R signal - * \sa write_atr_mask, write_atr_txval, write_atr_rxval - */ - bool write_atr_tx_delay(int value); - - /*! - * \brief Clock ticks to delay falling edge of T/R signal - * \sa write_atr_mask, write_atr_txval, write_atr_rxval - */ - bool write_atr_rx_delay(int value); - - /*! - * \brief Set Programmable Gain Amplifier (PGA) - * - * \param which_amp which amp [0,3] - * \param gain_in_db gain value (linear in dB) - * - * gain is rounded to closest setting supported by hardware. - * - * \returns true iff sucessful. - * - * \sa pga_min(), pga_max(), pga_db_per_step() - */ - bool set_pga (int which_amp, double gain_in_db); - - /*! - * \brief Return programmable gain amplifier gain setting in dB. - * - * \param which_amp which amp [0,3] - */ - double pga (int which_amp) const; - - /*! - * \brief Return minimum legal PGA gain in dB. - */ - double pga_min () const; - - /*! - * \brief Return maximum legal PGA gain in dB. - */ - double pga_max () const; - - /*! - * \brief Return hardware step size of PGA (linear in dB). - */ - double pga_db_per_step () const; - - /*! - * \brief Write direction register (output enables) for pins that go to daughterboard. - * - * \param which_side [0,1] which size - * \param value value to write into register - * \param mask which bits of value to write into reg - * - * Each d'board has 16-bits of general purpose i/o. - * Setting the bit makes it an output from the FPGA to the d'board. - * - * This register is initialized based on a value stored in the - * d'board EEPROM. In general, you shouldn't be using this routine - * without a very good reason. Using this method incorrectly will - * kill your USRP motherboard and/or daughterboard. - */ - bool _write_oe (int which_side, int value, int mask); - - /*! - * \brief Write daughterboard i/o pin value - * - * \param which_side [0,1] which d'board - * \param value value to write into register - * \param mask which bits of value to write into reg - */ - bool write_io (int which_side, int value, int mask); - - /*! - * \brief Read daughterboard i/o pin value - * - * \param which_side [0,1] which d'board - * \returns register value if successful, else READ_FAILED - */ - int read_io (int which_side); - - /*! - * \brief Write daughterboard refclk config register - * - * \param which_side [0,1] which d'board - * \param value value to write into register, see below - * - * <pre> - * Control whether a reference clock is sent to the daughterboards, - * and what frequency. The refclk is sent on d'board i/o pin 0. - * - * 3 2 1 - * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 - * +-----------------------------------------------+-+------------+ - * | Reserved (Must be zero) |E| DIVISOR | - * +-----------------------------------------------+-+------------+ - * - * Bit 7 -- 1 turns on refclk, 0 allows IO use - * Bits 6:0 Divider value - * </pre> - */ - bool write_refclk(int which_side, int value); - - bool write_atr_mask(int which_side, int value); - bool write_atr_txval(int which_side, int value); - bool write_atr_rxval(int which_side, int value); - - /*! - * \brief Write auxiliary digital to analog converter. - * - * \param which_side [0,1] which d'board - * N.B., SLOT_TX_A and SLOT_RX_A share the same AUX DAC's. - * SLOT_TX_B and SLOT_RX_B share the same AUX DAC's. - * \param which_dac [2,3] TX slots must use only 2 and 3. - * \param value [0,4095] - * \returns true iff successful - */ - bool write_aux_dac (int which_side, int which_dac, int value); - - /*! - * \brief Read auxiliary analog to digital converter. - * - * \param which_side [0,1] which d'board - * \param which_adc [0,1] - * \returns value in the range [0,4095] if successful, else READ_FAILED. - */ - int read_aux_adc (int which_side, int which_adc); - - /*! - * \brief returns A/D or D/A converter rate in Hz - */ - long converter_rate() const; - - - // ---------------------------------------------------------------- - // Low level implementation routines. - // You probably shouldn't be using these... - // - - bool _set_led (int which_led, bool on); - - /*! - * \brief Write FPGA register. - * \param regno 7-bit register number - * \param value 32-bit value - * \returns true iff successful - */ - bool _write_fpga_reg (int regno, int value); //< 7-bit regno, 32-bit value - - /*! - * \brief Read FPGA register. - * \param regno 7-bit register number - * \param value 32-bit value - * \returns true iff successful - */ - bool _read_fpga_reg (int regno, int *value); //< 7-bit regno, 32-bit value - - /*! - * \brief Read FPGA register. - * \param regno 7-bit register number - * \returns register value if successful, else READ_FAILED - */ - int _read_fpga_reg (int regno); - - /*! - * \brief Write FPGA register with mask. - * \param regno 7-bit register number - * \param value 16-bit value - * \param mask 16-bit value - * \returns true if successful - * Only use this for registers who actually implement a mask in the verilog firmware, like FR_RX_MASTER_SLAVE - */ - bool _write_fpga_reg_masked (int regno, int value, int mask); - - /*! - * \brief Write AD9862 register. - * \param which_codec 0 or 1 - * \param regno 6-bit register number - * \param value 8-bit value - * \returns true iff successful - */ - bool _write_9862 (int which_codec, int regno, unsigned char value); - - /*! - * \brief Read AD9862 register. - * \param which_codec 0 or 1 - * \param regno 6-bit register number - * \returns register value if successful, else READ_FAILED - */ - int _read_9862 (int which_codec, int regno) const; - - /*! - * \brief Write data to SPI bus peripheral. - * - * \param optional_header 0,1 or 2 bytes to write before buf. - * \param enables bitmask of peripherals to write. See usrp_spi_defs.h - * \param format transaction format. See usrp_spi_defs.h SPI_FMT_* - * \param buf the data to write - * \returns true iff successful - * Writes are limited to a maximum of 64 bytes. - * - * If \p format specifies that optional_header bytes are present, they are - * written to the peripheral immediately prior to writing \p buf. - */ - bool _write_spi (int optional_header, int enables, int format, std::string buf); - - /* - * \brief Read data from SPI bus peripheral. - * - * \param optional_header 0,1 or 2 bytes to write before buf. - * \param enables bitmask of peripheral to read. See usrp_spi_defs.h - * \param format transaction format. See usrp_spi_defs.h SPI_FMT_* - * \param len number of bytes to read. Must be in [0,64]. - * \returns the data read if sucessful, else a zero length string. - * - * Reads are limited to a maximum of 64 bytes. - * - * If \p format specifies that optional_header bytes are present, they - * are written to the peripheral first. Then \p len bytes are read from - * the peripheral and returned. - */ - std::string _read_spi (int optional_header, int enables, int format, int len); - - /*! - * Return an existing daughterboard from list of candidate dbids, or the first found - * on side A or side B. - * - * \param candidates Vector of candidate dbids - * - * Throws std::runtime_error if not found - */ - usrp_subdev_spec pick_subdev(std::vector<int> candidates=std::vector<int>(0)); -}; - -#endif /* INCLUDED_USRP_BASE_H */ diff --git a/gr-usrp/src/usrp_base.i b/gr-usrp/src/usrp_base.i deleted file mode 100644 index 0fd62911f8..0000000000 --- a/gr-usrp/src/usrp_base.i +++ /dev/null @@ -1,85 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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_base.h" -%} - -%ignore usrp_base; -class usrp_base : public gr_sync_block -{ -protected: - usrp_base(const std::string &name, - gr_io_signature_sptr input_signature, - gr_io_signature_sptr output_signature) - : gr_sync_block(name, input_signature, output_signature) {} - -public: - std::vector<std::vector<db_base_sptr> > db(); - std::vector<db_base_sptr> db(int which_side); - db_base_sptr db(int which_side, int which_dev); - %rename (_real_selected_subdev) selected_subdev; - db_base_sptr selected_subdev(usrp_subdev_spec ss); - long fpga_master_clock_freq() const; - void set_fpga_master_clock_freq(long master_clock); - void set_verbose (bool on); - static const int READ_FAILED = -99999; - bool write_eeprom (int i2c_addr, int eeprom_offset, const std::string buf); - std::string read_eeprom (int i2c_addr, int eeprom_offset, int len); - bool write_i2c (int i2c_addr, const std::string buf); - std::string read_i2c (int i2c_addr, int len); - bool set_adc_offset (int which_adc, int offset); - bool set_dac_offset (int which_dac, int offset, int offset_pin); - bool set_adc_buffer_bypass (int which_adc, bool bypass); - bool set_dc_offset_cl_enable(int bits, int mask); - std::string serial_number(); - virtual int daughterboard_id (int which_side) const; - bool write_atr_tx_delay(int value); - bool write_atr_rx_delay(int value); - bool set_pga (int which_amp, double gain_in_db); - double pga (int which_amp) const; - double pga_min () const; - double pga_max () const; - double pga_db_per_step () const; - bool _write_oe (int which_side, int value, int mask); - bool write_io (int which_side, int value, int mask); - int read_io (int which_side); - //bool write_refclk(int which_side, int value); - bool write_atr_mask(int which_side, int value); - bool write_atr_txval(int which_side, int value); - bool write_atr_rxval(int which_side, int value); - bool write_aux_dac (int which_side, int which_dac, int value); - int read_aux_adc (int which_side, int which_adc); - long converter_rate() const; - bool _set_led (int which_led, bool on); - bool _write_fpga_reg (int regno, int value); - //bool _read_fpga_reg (int regno, int *value); - int _read_fpga_reg (int regno); - bool _write_fpga_reg_masked (int regno, int value, int mask); - bool _write_9862 (int which_codec, int regno, unsigned char value); - int _read_9862 (int which_codec, int regno) const; - bool _write_spi (int optional_header, int enables, int format, std::string buf); - std::string _read_spi (int optional_header, int enables, int format, int len); - %rename(_real_pick_subdev) pick_subdev; - usrp_subdev_spec pick_subdev(std::vector<int> candidates=std::vector<int>(0)) - throw (std::runtime_error); -}; diff --git a/gr-usrp/src/usrp_multi.py b/gr-usrp/src/usrp_multi.py deleted file mode 100644 index c04d731245..0000000000 --- a/gr-usrp/src/usrp_multi.py +++ /dev/null @@ -1,233 +0,0 @@ -# -# Copyright 2005,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. -# - -import math -from gnuradio import gr, gru -from gnuradio.gr import hier_block2 -from gnuradio import usrp -from usrpm import usrp_prims -import sys - - -class multi_source_align(object): - def __init__(self, fg, master_serialno, decim, nchan=2, pga_gain=0.0, - cordic_freq=0.0, mux=None, align_interval=-1, - fpga_filename="multi_2rxhb_2tx.rbf"): - """ - Align multiple sources (usrps) using samplenumbers in the first channel. - - Takes two ore more sources producing interleaved shorts. - produces nchan * nsources gr_complex output streams. - - @param nchan: number of interleaved channels in source - @param align_interval: number of samples to minimally skip between alignments - default = -1 which means align only once per work call. - @param master_serial_no: serial number of the source which must be the master. - - - Exported sub-blocks (attributes): - master_source - slave_source - usrp_master - usrp_slave - """ - mode=usrp.FPGA_MODE_NORMAL - mode = mode | usrp_prims.bmFR_MODE_RX_COUNTING_32BIT #(1 << 2) #usrp1.FPGA_MODE_COUNTING_32BIT - align=gr.align_on_samplenumbers_ss (nchan,align_interval) - self.usrp_master = None - self.usrp_slave = None - # um is master usrp - # us is slave usrp - if mux is None: - mux=self.get_default_mux() #Note that all channels have shifted left because of the added 32 bit counter channel - - u1 = usrp.source_s (1, decim, nchan, gru.hexint(mux), mode,fpga_filename=fpga_filename ) - u0 = usrp.source_s (0, decim, nchan, gru.hexint(mux), mode,fpga_filename=fpga_filename ) - print 'usrp[0] serial',u0.serial_number() - print 'usrp[1] serial',u1.serial_number() - #default, choose the second found usrp as master (which is usually the usrp which was first plugged in) - um_index=1 - um=u1 - us_index=0 - us=u0 - if (not (master_serialno is None)): #((master_serialno>0) | (master_serialno <-2)): - if (u0.serial_number() == master_serialno): - um_index=0 - um=u0 - us_index=1 - us=u1 - elif (u1.serial_number() != master_serialno): - errorstring = 'Error. requested master_serialno ' + master_serialno +' not found\n' - errorstring = errorstring + 'Available are:\n' - errorstring = errorstring + 'usrp[1] serial_no = ' + u1.serial_number() +'\n' - errorstring = errorstring + 'usrp[0] serial_no = ' + u0.serial_number() +'\n' - print errorstring - raise ValueError, errorstring - else: #default, just choose the first found usrp as master - um_index=1 - um=u1 - us_index=0 - us=u0 - - self.usrp_master=um - self.usrp_slave=us - print 'usrp_master=usrp[%i] serial_no = %s' % (um_index,self.usrp_master.serial_number() ,) - print 'usrp_slave=usrp[%i] serial_no = %s' % (us_index,self.usrp_slave.serial_number() ,) - self.subdev_mAr = usrp.selected_subdev(self.usrp_master, (0,0)) - self.subdev_mBr = usrp.selected_subdev(self.usrp_master, (1,0)) - self.subdev_sAr = usrp.selected_subdev(self.usrp_slave, (0,0)) - self.subdev_sBr = usrp.selected_subdev(self.usrp_slave, (1,0)) - #throttle = gr.throttle(gr.sizeof_gr_complex, input_rate) - if not (pga_gain is None): - um.set_pga (0, pga_gain) - um.set_pga (1, pga_gain) - - us.set_pga (0, pga_gain) - us.set_pga (1, pga_gain) - - self.input_rate = um.adc_freq () / um.decim_rate () - deintm=gr.deinterleave(gr.sizeof_gr_complex) - deints=gr.deinterleave(gr.sizeof_gr_complex) - nullsinkm=gr.null_sink(gr.sizeof_gr_complex) - nullsinks=gr.null_sink(gr.sizeof_gr_complex) - - tocomplexm=gr.interleaved_short_to_complex() - tocomplexs=gr.interleaved_short_to_complex() - - fg.connect(um,(align,0)) - fg.connect(us,(align,1)) - fg.connect((align,0),tocomplexm) - fg.connect((align,1),tocomplexs) - fg.connect(tocomplexm,deintm) - fg.connect(tocomplexs,deints) - fg.connect((deintm,0),nullsinkm) #The counters are not usefull for the user but must be connected to something - fg.connect((deints,0),nullsinks) #The counters are not usefull for the user but must be connected to something - if 4==nchan: - nullsinkm3=gr.null_sink(gr.sizeof_gr_complex) - nullsinks3=gr.null_sink(gr.sizeof_gr_complex) - fg.connect((deintm,3), nullsinkm3) #channel 4 is not used but must be connected - fg.connect((deints,3), nullsinks3) #channel 4 is not used but must be connected - - self.fg=fg - self.master_source=deintm - self.slave_source=deints - - if not (cordic_freq is None): - um.set_rx_freq (1, cordic_freq) - um.set_rx_freq (0, cordic_freq) - us.set_rx_freq (1, cordic_freq) - us.set_rx_freq (0, cordic_freq) - - self.enable_master_and_slave() - # add an idle handler - self.unsynced=True - - # wire the block together - #hier_block_multi_tail.__init__(self, fg, nchan,deintm,deints) - - def get_default_mux(self): - return 0x10321032 # Note that all channels have shifted left because of the added 32 bit counter channel - - def get_master_source_c(self): - return self.master_source - - def get_slave_source_c(self): - return self.slave_source - - def get_master_usrp(self): - return self.usrp_master - - def get_slave_usrp(self): - return self.usrp_slave - - def enable_master_and_slave(self): - # Warning, allways FIRST enable the slave before you enable the master - # This is to be sure you don't have two masters connecting to each other - # Otherwise you could ruin your hardware because the two sync outputs would be connected together - - #SLAVE - #disable master, enable slave and set sync pulse to zero - reg_mask = usrp_prims.bmFR_RX_SYNC_SLAVE | usrp_prims.bmFR_RX_SYNC_MASTER | usrp_prims.bmFR_RX_SYNC - self.usrp_slave._u._write_fpga_reg_masked(usrp_prims.FR_RX_MASTER_SLAVE, usrp_prims.bmFR_RX_SYNC_SLAVE,reg_mask) - #set SYNC slave iopin on daughterboards RXA as input - oe = 0 # set rx_a_io[bitnoFR_RX_SYNC_INPUT_IOPIN] as input - oe_mask = usrp_prims.bmFR_RX_SYNC_INPUT_IOPIN - self.usrp_slave._u._write_oe(0,oe,oe_mask) - #Now it is save to enable the master - - #MASTER - #enable master, disable slave and set sync pulse to zero - reg_mask = usrp_prims.bmFR_RX_SYNC_SLAVE | usrp_prims.bmFR_RX_SYNC_MASTER | usrp_prims.bmFR_RX_SYNC - self.usrp_master._u._write_fpga_reg_masked(usrp_prims.FR_RX_MASTER_SLAVE,usrp_prims.bmFR_RX_SYNC_MASTER,reg_mask) - #set SYNC master iopin on daughterboards RXA as output - oe = usrp_prims.bmFR_RX_SYNC_OUTPUT_IOPIN # set rx_a_io[bitnoFR_RX_SYNC_OUTPUT_IOPIN] as output - oe_mask = usrp_prims.bmFR_RX_SYNC_OUTPUT_IOPIN - self.usrp_master._u._write_oe(0,oe,oe_mask) - - def sync_usrps(self, evt): - self.sync() - - def sync(self): - result=False - result = self.usrp_master._u._write_fpga_reg_masked (usrp_prims.FR_RX_MASTER_SLAVE, usrp_prims.bmFR_RX_SYNC, usrp_prims.bmFR_RX_SYNC ) - #There should be a small delay here, but the time it takes to get the sync to the usrp is long enough - #turn sync pulse off - result = result & self.usrp_master._u._write_fpga_reg_masked (usrp_prims.FR_RX_MASTER_SLAVE,0 ,usrp_prims.bmFR_RX_SYNC); - return result; - - def nullsink_counters(self): - nullsinkm=gr.null_sink(gr.sizeof_gr_complex) - nullsinks=gr.null_sink(gr.sizeof_gr_complex) - self.fg.connect((self.master_source,0),nullsinkm) - self.fg.connect((self.slave_source,0),nullsinks) - - - def print_db_info(self): - print "MASTER RX d'board %s" % (self.subdev_mAr.side_and_name(),) - print "MASTER RX d'board %s" % (self.subdev_mBr.side_and_name(),) - #print "TX d'board %s" % (self.subdev_At.side_and_name(),) - #print "TX d'board %s" % (self.subdev_Bt.side_and_name(),) - print "SLAVE RX d'board %s" % (self.subdev_sAr.side_and_name(),) - print "SLAVE RX d'board %s" % (self.subdev_sBr.side_and_name(),) - #print "TX d'board %s" % (self.subdev_At.side_and_name(),) - #print "TX d'board %s" % (self.subdev_Bt.side_and_name(),) - - def tune_all_rx(self,target_freq): - result = True - r1 = usrp.tune(self.usrp_master, 0, self.subdev_mAr, target_freq) - if r1 is None: - result=False - r2 = usrp.tune(self.usrp_master, 1, self.subdev_mBr, target_freq) - if r2 is None: - result=False - r3 = usrp.tune(self.usrp_slave, 0, self.subdev_sAr, target_freq) - if r3 is None: - result=False - r4 = usrp.tune(self.usrp_slave, 1, self.subdev_sBr, target_freq) - if r4 is None: - result=False - return result,r1,r2,r3,r4 - - def set_gain_all_rx(self, gain): - self.subdev_mAr.set_gain(gain) - self.subdev_mBr.set_gain(gain) - self.subdev_sAr.set_gain(gain) - self.subdev_sBr.set_gain(gain) diff --git a/gr-usrp/src/usrp_sink_base.cc b/gr-usrp/src/usrp_sink_base.cc deleted file mode 100644 index 635d9345f0..0000000000 --- a/gr-usrp/src/usrp_sink_base.cc +++ /dev/null @@ -1,248 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <usrp_sink_base.h> -#include <gr_io_signature.h> -#include <usrp/usrp_standard.h> -#include <assert.h> -#include <cstdio> - -static const int OUTPUT_MULTIPLE_SAMPLES = 128; // DON'T CHANGE THIS VALUE! - -usrp_sink_base::usrp_sink_base (const std::string &name, - gr_io_signature_sptr input_signature, - int which_board, - unsigned int interp_rate, - int nchan, - int mux, - int fusb_block_size, - int fusb_nblocks, - const std::string fpga_filename, - const std::string firmware_filename - ) throw (std::runtime_error) - : usrp_base(name, - input_signature, - gr_make_io_signature (0, 0, 0)), - d_nunderruns (0) -{ - d_usrp = usrp_standard_tx::make (which_board, - interp_rate, - nchan, mux, - fusb_block_size, - fusb_nblocks, - fpga_filename, - firmware_filename - ); - if (d_usrp == 0) - throw std::runtime_error ("can't open usrp"); - - set_usrp_basic(d_usrp); - - // All calls to d_usrp->write must be multiples of 512 bytes. - - set_output_multiple (OUTPUT_MULTIPLE_SAMPLES); -} - -usrp_sink_base::~usrp_sink_base () -{ -} - -int -usrp_sink_base::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - static const int BUFSIZE = 16 * (1L << 10); // 16kB - unsigned char outbuf[BUFSIZE]; - int obi = 0; - int input_index = 0; - int input_items_consumed; - int bytes_written; - bool underrun; - - - while (input_index < noutput_items){ - - copy_to_usrp_buffer (input_items, - input_index, - noutput_items - input_index, // input_items_available - input_items_consumed, // [out] - &outbuf[obi], // [out] usrp_buffer - BUFSIZE - obi, // usrp_buffer_length - bytes_written); // [out] - - assert (input_index + input_items_consumed <= noutput_items); - assert (obi + bytes_written <= BUFSIZE); - - input_index += input_items_consumed; - obi += bytes_written; - - if (obi >= BUFSIZE){ // flush - if (d_usrp->write (outbuf, obi, &underrun) != obi) - return -1; // indicate we're done - - if (underrun){ - d_nunderruns++; - // fprintf (stderr, "usrp_sink: underrun\n"); - fputs ("uU", stderr); - } - obi = 0; - } - } - - if (obi != 0){ - assert (obi % 512 == 0); - if (d_usrp->write (outbuf, obi, &underrun) != obi) - return -1; // indicate we're done - - if (underrun){ - d_nunderruns++; - // fprintf (stderr, "usrp_sink: underrun\n"); - fputs ("uU", stderr); - } - } - - return noutput_items; -} - -bool -usrp_sink_base::set_interp_rate (unsigned int rate) -{ - return d_usrp->set_interp_rate (rate); -} - -bool -usrp_sink_base::set_nchannels (int nchan) -{ - return d_usrp->set_nchannels (nchan); -} - -bool -usrp_sink_base::set_mux (int mux) -{ - return d_usrp->set_mux (mux); -} - -int -usrp_sink_base::determine_tx_mux_value(usrp_subdev_spec ss) -{ - return d_usrp->determine_tx_mux_value(ss); -} - -int -usrp_sink_base::determine_tx_mux_value(usrp_subdev_spec ss_a, usrp_subdev_spec ss_b) -{ - return d_usrp->determine_tx_mux_value(ss_a, ss_b); -} - -bool -usrp_sink_base::set_tx_freq (int channel, double freq) -{ - return d_usrp->set_tx_freq (channel, freq); -} - -unsigned int -usrp_sink_base::interp_rate () const -{ - return d_usrp->interp_rate (); -} - -int -usrp_sink_base::nchannels () const -{ - return d_usrp->nchannels (); -} - -int -usrp_sink_base::mux () const -{ - return d_usrp->mux (); -} - - -double -usrp_sink_base::tx_freq (int channel) const -{ - return d_usrp->tx_freq (channel); -} - -bool -usrp_sink_base::has_rx_halfband() -{ - return d_usrp->has_rx_halfband(); -} - -bool -usrp_sink_base::has_tx_halfband() -{ - return d_usrp->has_tx_halfband(); -} - -int -usrp_sink_base::nddcs() -{ - return d_usrp->nddcs(); -} - -int -usrp_sink_base::nducs() -{ - return d_usrp->nducs(); -} - -bool -usrp_sink_base::start() -{ - return d_usrp->start(); -} - -bool -usrp_sink_base::stop() -{ - return d_usrp->stop(); -} - - -bool -usrp_sink_base::tune(int chan, db_base_sptr db, double target_freq, usrp_tune_result *result) -{ - return d_usrp->tune(chan, db, target_freq, result); -} - -usrp_subdev_spec -usrp_sink_base::pick_tx_subdevice() -{ - int dbids[] = { - USRP_DBID_FLEX_400_TX, - USRP_DBID_FLEX_900_TX, - USRP_DBID_FLEX_1200_TX, - USRP_DBID_FLEX_2400_TX, - USRP_DBID_BASIC_TX - }; - - std::vector<int> candidates(dbids, dbids+(sizeof(dbids)/sizeof(int))); - return pick_subdev(candidates); -} diff --git a/gr-usrp/src/usrp_sink_base.h b/gr-usrp/src/usrp_sink_base.h deleted file mode 100644 index 8d573af1b0..0000000000 --- a/gr-usrp/src/usrp_sink_base.h +++ /dev/null @@ -1,152 +0,0 @@ - -/* -*- c++ -*- */ -/* - * Copyright 2004,2006,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. - */ - -#ifndef INCLUDED_USRP_SINK_BASE_H -#define INCLUDED_USRP_SINK_BASE_H - -#include <usrp_base.h> -#include <stdexcept> -#include <usrp/usrp_tune_result.h> -#include <usrp/usrp_dbid.h> - -class usrp_standard_tx; - -/*! - * \brief abstract interface to Universal Software Radio Peripheral Tx path (Rev 1) - */ -class usrp_sink_base : public usrp_base { - private: - boost::shared_ptr<usrp_standard_tx> d_usrp; - int d_nunderruns; - - protected: - usrp_sink_base (const std::string &name, - gr_io_signature_sptr input_signature, - int which_board, - unsigned int interp_rate, - int nchan, - int mux, - int fusb_block_size, - int fusb_nblocks, - const std::string fpga_filename, - const std::string firmware_filename - ) throw (std::runtime_error); - - /*! - * \brief convert between input item format and usrp native format - * - * \param[in] input_items stream(s) of input items - * \param[in] input_index starting index in input_items - * \param[in] input_items_available number of items available starting at item[index] - * \param[out] input_items_consumed number of input items consumed by copy - * \param[out] usrp_buffer destination buffer - * \param[in] usrp_buffer_length \p usrp_buffer length in bytes - * \param[out] bytes_written number of bytes written into \p usrp_buffer - */ - virtual void copy_to_usrp_buffer (gr_vector_const_void_star &input_items, - int input_index, - int input_items_available, - int &input_items_consumed, - void *usrp_buffer, - int usrp_buffer_length, - int &bytes_written) = 0; - - public: - ~usrp_sink_base (); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - /*! - * \brief Set interpolator rate. \p rate must be in [4, 1024] and a multiple of 4. - * - * The final complex sample rate across the USB is - * dac_freq () / interp_rate () * nchannels () - */ - bool set_interp_rate (unsigned int rate); - bool set_nchannels (int nchan); - bool set_mux (int mux); - int determine_tx_mux_value(usrp_subdev_spec ss); - int determine_tx_mux_value(usrp_subdev_spec ss_a, usrp_subdev_spec ss_b); - - /*! - * \brief set the frequency of the digital up converter. - * - * \p channel must be 0. \p freq is the center frequency in Hz. - * It must be in the range [-44M, 44M]. The frequency specified is - * quantized. Use tx_freq to retrieve the actual value used. - */ - bool set_tx_freq (int channel, double freq); - - long dac_rate() const { return converter_rate(); } // alias - long dac_freq() const { return converter_rate(); } // deprecated alias - - unsigned int interp_rate () const; - int nchannels () const; - int mux () const; - double tx_freq (int channel) const; - int nunderruns () const { return d_nunderruns; } - - bool has_rx_halfband(); - bool has_tx_halfband(); - int nddcs(); - int nducs(); - - /*! - * \brief Called to enable drivers, etc for i/o devices. - * - * This allows a block to enable an associated driver to begin - * transfering data just before we start to execute the scheduler. - * The end result is that this reduces latency in the pipeline when - * dealing with audio devices, usrps, etc. - */ - bool start(); - - /*! - * \brief Called to disable drivers, etc for i/o devices. - */ - bool stop(); - - /*! - * \brief High-level "tune" method. Works for the single channel case. - * - * This method adjusts both the daughterboard LO and the DUC so that - * DC in the complex baseband samples ends up at RF target_freq. - * - * \param chan which DUC channel we're controlling (usually == which_side). - * \param db the daughterboard we're controlling. - * \param target_freq the RF frequency we want our baseband translated to. - * \param[out] result details how the hardware was configured. - * - * \returns true iff everything was successful. - */ - bool tune(int chan, db_base_sptr db, double target_freq, usrp_tune_result *result); - - /*! - * \brief Select suitable Tx daughterboard - */ - usrp_subdev_spec pick_tx_subdevice(); -}; - -#endif /* INCLUDED_USRP_SINK_BASE_H */ diff --git a/gr-usrp/src/usrp_sink_base.i b/gr-usrp/src/usrp_sink_base.i deleted file mode 100644 index 17fca441de..0000000000 --- a/gr-usrp/src/usrp_sink_base.i +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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_sink_base.h" -%} - -class usrp_sink_base : public usrp_base -{ -private: - usrp_sink_base() throw (std::runtime_error); - -public: - bool set_interp_rate (unsigned int rate); - bool set_nchannels (int nchan); - bool set_mux (int mux); - %rename(_real_determine_tx_mux_value) determine_tx_mux_value; - int determine_tx_mux_value(usrp_subdev_spec ss); - int determine_tx_mux_value(usrp_subdev_spec ss_a, usrp_subdev_spec ss_b); - bool set_tx_freq (int channel, double freq); - long dac_rate() const { return converter_rate(); } - long dac_freq() const { return converter_rate(); } - unsigned int interp_rate () const; - int nchannels () const; - int mux () const; - double tx_freq (int channel) const; - int nunderruns () const { return d_nunderruns; } - bool has_rx_halfband(); - bool has_tx_halfband(); - int nddcs(); - int nducs(); - %rename(_real_tune) tune; - bool tune(int chan, db_base_sptr db, double target_freq, usrp_tune_result *result); - %rename(_real_pick_tx_subdevice) pick_tx_subdevice(); - usrp_subdev_spec pick_tx_subdevice(); -}; diff --git a/gr-usrp/src/usrp_sink_c.cc b/gr-usrp/src/usrp_sink_c.cc deleted file mode 100644 index 7054158d8a..0000000000 --- a/gr-usrp/src/usrp_sink_c.cc +++ /dev/null @@ -1,106 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2006,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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <usrp_sink_c.h> -#include <gr_io_signature.h> -#include <usrp/usrp_standard.h> -#include <usrp/usrp_bytesex.h> - -usrp_sink_c_sptr -usrp_make_sink_c (int which_board, - unsigned int interp_rate, - int nchan, - int mux, - int fusb_block_size, - int fusb_nblocks, - const std::string fpga_filename, - const std::string firmware_filename - ) throw (std::runtime_error) -{ - return gnuradio::get_initial_sptr(new usrp_sink_c (which_board, - interp_rate, - nchan, - mux, - fusb_block_size, - fusb_nblocks, - fpga_filename, - firmware_filename - )); -} - - -usrp_sink_c::usrp_sink_c (int which_board, - unsigned int interp_rate, - int nchan, - int mux, - int fusb_block_size, - int fusb_nblocks, - const std::string fpga_filename, - const std::string firmware_filename - ) throw (std::runtime_error) - : usrp_sink_base ("usrp_sink_c", - gr_make_io_signature (1, 1, sizeof (gr_complex)), - which_board, interp_rate, nchan, mux, - fusb_block_size, fusb_nblocks, - fpga_filename, firmware_filename) -{ -} - -usrp_sink_c::~usrp_sink_c () -{ - // NOP -} - -/* - * Take one complex input stream and format it into interleaved short I & Q - * for the usrp. - */ -void -usrp_sink_c::copy_to_usrp_buffer (gr_vector_const_void_star &input_items, - int input_index, - int input_items_available, - int &input_items_consumed, // out - void *usrp_buffer, - int usrp_buffer_length, - int &bytes_written) // out -{ - gr_complex *in = &((gr_complex *) input_items[0])[input_index]; - short *dst = (short *) usrp_buffer; - - static const int usrp_bytes_per_input_item = 2 * sizeof (short); // I & Q - - int nitems = std::min (input_items_available, - usrp_buffer_length / usrp_bytes_per_input_item); - - for (int i = 0; i < nitems; i++){ - dst[2*i + 0] = host_to_usrp_short((short) real(in[i])); // FIXME saturate? - dst[2*i + 1] = host_to_usrp_short((short) imag(in[i])); // FIXME saturate? - } - - input_items_consumed = nitems; - bytes_written = nitems * usrp_bytes_per_input_item; -} - diff --git a/gr-usrp/src/usrp_sink_c.h b/gr-usrp/src/usrp_sink_c.h deleted file mode 100644 index 59ebace381..0000000000 --- a/gr-usrp/src/usrp_sink_c.h +++ /dev/null @@ -1,89 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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. - */ - -#ifndef INCLUDED_USRP_SINK_C_H -#define INCLUDED_USRP_SINK_C_H - -#include <usrp_sink_base.h> - -class usrp_sink_c; -typedef boost::shared_ptr<usrp_sink_c> usrp_sink_c_sptr; - - -// public shared_ptr constructor - -usrp_sink_c_sptr -usrp_make_sink_c (int which_board=0, - unsigned int interp_rate=32, - int nchan=1, - int mux=-1, - int fusb_block_size=0, - int fusb_nblocks=0, - const std::string fpga_filename="", - const std::string firmware_filename="" - ) throw (std::runtime_error); - - -/*! - * \brief Interface to Universal Software Radio Peripheral Tx path - * \ingroup usrp - * \ingroup sink_blk - * - * input: gr_complex - */ -class usrp_sink_c : public usrp_sink_base { - private: - - friend usrp_sink_c_sptr - usrp_make_sink_c (int which_board, - unsigned int interp_rate, - int nchan, - int mux, - int fusb_block_size, - int fusb_nblocks, - const std::string fpga_filename, - const std::string firmware_filename - ) throw (std::runtime_error); - - protected: - usrp_sink_c (int which_board, - unsigned int interp_rate, - int nchan, - int mux, - int fusb_block_size, - int fusb_nblocks, - const std::string fpga_filename, - const std::string firmware_filename - ) throw (std::runtime_error); - - virtual void copy_to_usrp_buffer (gr_vector_const_void_star &input_items, - int input_index, - int input_items_available, - int &input_items_consumed, - void *usrp_buffer, - int usrp_buffer_length, - int &bytes_written); - public: - ~usrp_sink_c (); -}; - -#endif /* INCLUDED_USRP_SINK_C_H */ diff --git a/gr-usrp/src/usrp_sink_c.i b/gr-usrp/src/usrp_sink_c.i deleted file mode 100644 index 15480883eb..0000000000 --- a/gr-usrp/src/usrp_sink_c.i +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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_sink_c.h" -%} - -GR_SWIG_BLOCK_MAGIC(usrp,sink_c) - -class usrp_sink_c; -typedef boost::shared_ptr<usrp_sink_c> usrp_sink_c_sptr; - -usrp_sink_c_sptr -usrp_make_sink_c(int which=0, - unsigned int interp_rate=32, - int nchan=1, - int mux=-1, - int fusb_block_size=0, - int fusb_nblocks=0, - const std::string fpga_filename="", - const std::string firmware_filename="" - ) throw (std::runtime_error); - -class usrp_sink_c : public usrp_sink_base -{ -private: - usrp_sink_c() throw (std::runtime_error); -}; diff --git a/gr-usrp/src/usrp_sink_s.cc b/gr-usrp/src/usrp_sink_s.cc deleted file mode 100644 index 1ffaeed963..0000000000 --- a/gr-usrp/src/usrp_sink_s.cc +++ /dev/null @@ -1,106 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2006,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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <usrp_sink_s.h> -#include <gr_io_signature.h> -#include <usrp/usrp_standard.h> -#include <usrp/usrp_bytesex.h> - -usrp_sink_s_sptr -usrp_make_sink_s (int which_board, - unsigned int interp_rate, - int nchan, - int mux, - int fusb_block_size, - int fusb_nblocks, - const std::string fpga_filename, - const std::string firmware_filename - ) throw (std::runtime_error) -{ - return gnuradio::get_initial_sptr(new usrp_sink_s (which_board, - interp_rate, - nchan, - mux, - fusb_block_size, - fusb_nblocks, - fpga_filename, - firmware_filename - )); -} - - -usrp_sink_s::usrp_sink_s (int which_board, - unsigned int interp_rate, - int nchan, - int mux, - int fusb_block_size, - int fusb_nblocks, - const std::string fpga_filename, - const std::string firmware_filename - ) throw (std::runtime_error) - : usrp_sink_base ("usrp_sink_s", - gr_make_io_signature (1, 1, sizeof (short)), - which_board, interp_rate, nchan, mux, - fusb_block_size, fusb_nblocks, - fpga_filename, firmware_filename) -{ - set_output_multiple (512 / sizeof(short)); // don't change -} - -usrp_sink_s::~usrp_sink_s () -{ - // NOP -} - -/* - * Take one short input stream and format it into interleaved short I & Q - * for the usrp. - */ -void -usrp_sink_s::copy_to_usrp_buffer (gr_vector_const_void_star &input_items, - int input_index, - int input_items_available, - int &input_items_consumed, // out - void *usrp_buffer, - int usrp_buffer_length, - int &bytes_written) // out -{ - short *in = &((short *) input_items[0])[input_index]; - short *dst = (short *) usrp_buffer; - - static const int usrp_bytes_per_input_item = sizeof (short); - - int nitems = std::min (input_items_available, - usrp_buffer_length / usrp_bytes_per_input_item); - - for (int i = 0; i < nitems; i++){ // FIXME unroll - dst[i] = host_to_usrp_short(in[i]); - } - - input_items_consumed = nitems; - bytes_written = nitems * usrp_bytes_per_input_item; -} - diff --git a/gr-usrp/src/usrp_sink_s.h b/gr-usrp/src/usrp_sink_s.h deleted file mode 100644 index f23b86125b..0000000000 --- a/gr-usrp/src/usrp_sink_s.h +++ /dev/null @@ -1,88 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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. - */ - -#ifndef INCLUDED_USRP_SINK_S_H -#define INCLUDED_USRP_SINK_S_H - -#include <usrp_sink_base.h> - -class usrp_sink_s; -typedef boost::shared_ptr<usrp_sink_s> usrp_sink_s_sptr; - - -// public shared_ptr constructor - -usrp_sink_s_sptr -usrp_make_sink_s (int which_board=0, - unsigned int interp_rate=32, - int nchan=1, - int mux=-1, - int fusb_block_size=0, - int fusb_nblocks=0, - const std::string fpga_filename="", - const std::string firmware_filename="" - ) throw (std::runtime_error); - -/*! - * \brief Interface to Universal Software Radio Peripheral Tx path - * \ingroup usrp - * \ingroup sink_blk - * - * input: short - */ -class usrp_sink_s : public usrp_sink_base { - private: - - friend usrp_sink_s_sptr - usrp_make_sink_s (int which_board, - unsigned int interp_rate, - int nchan, - int mux, - int fusb_block_size, - int fusb_nblocks, - const std::string fpga_filename, - const std::string firmware_filename - ) throw (std::runtime_error); - - protected: - usrp_sink_s (int which_board, - unsigned int interp_rate, - int nchan, - int mux, - int fusb_block_size, - int fusb_nblocks, - const std::string fpga_filename, - const std::string firmware_filename - ) throw (std::runtime_error); - - virtual void copy_to_usrp_buffer (gr_vector_const_void_star &input_items, - int input_index, - int input_items_available, - int &input_items_consumed, - void *usrp_buffer, - int usrp_buffer_length, - int &bytes_written); - public: - ~usrp_sink_s (); -}; - -#endif /* INCLUDED_USRP_SINK_S_H */ diff --git a/gr-usrp/src/usrp_sink_s.i b/gr-usrp/src/usrp_sink_s.i deleted file mode 100644 index 9993d52147..0000000000 --- a/gr-usrp/src/usrp_sink_s.i +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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_sink_s.h" -%} - -GR_SWIG_BLOCK_MAGIC(usrp,sink_s) - -class usrp_sink_s; -typedef boost::shared_ptr<usrp_sink_s> usrp_sink_s_sptr; - -usrp_sink_s_sptr -usrp_make_sink_s(int which=0, - unsigned int interp_rate=32, - int nchan=1, - int mux=-1, - int fusb_block_size=0, - int fusb_nblocks=0, - const std::string fpga_filename="", - const std::string firmware_filename="" - ) throw (std::runtime_error); - -class usrp_sink_s : public usrp_sink_base -{ -private: - usrp_sink_s() throw (std::runtime_error); -}; diff --git a/gr-usrp/src/usrp_source_base.cc b/gr-usrp/src/usrp_source_base.cc deleted file mode 100644 index 5a5e20f3e3..0000000000 --- a/gr-usrp/src/usrp_source_base.cc +++ /dev/null @@ -1,305 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <usrp_source_base.h> -#include <gr_io_signature.h> -#include <usrp/usrp_standard.h> -#include <assert.h> -#include <cstdio> - -static const int OUTPUT_MULTIPLE_BYTES = 4 * 1024; - -usrp_source_base::usrp_source_base (const std::string &name, - gr_io_signature_sptr output_signature, - int which_board, - unsigned int decim_rate, - int nchan, - int mux, - int mode, - int fusb_block_size, - int fusb_nblocks, - const std::string fpga_filename, - const std::string firmware_filename - ) throw (std::runtime_error) - : usrp_base(name, - gr_make_io_signature (0, 0, 0), - output_signature), - d_noverruns (0) -{ - d_usrp = usrp_standard_rx::make (which_board, decim_rate, - nchan, mux, mode, - fusb_block_size, - fusb_nblocks, - fpga_filename, - firmware_filename); - if (d_usrp == 0) - throw std::runtime_error ("can't open usrp"); - - set_usrp_basic(d_usrp); - - // All calls to d_usrp->read must be multiples of 512 bytes. - // We jack this up to 4k to reduce overhead. - - set_output_multiple (OUTPUT_MULTIPLE_BYTES / output_signature->sizeof_stream_item (0)); -} - -usrp_source_base::~usrp_source_base () -{ -} - -unsigned int -usrp_source_base::sizeof_basic_sample() const -{ - return usrp_standard_rx::format_width(d_usrp->format()) / 8; -} - -int -usrp_source_base::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - static const int BUFSIZE = 4 * OUTPUT_MULTIPLE_BYTES; - unsigned char buf[BUFSIZE]; - int output_index = 0; - int output_items_produced; - int bytes_read; - bool overrun; - - while (output_index < noutput_items){ - int nbytes = ninput_bytes_reqd_for_noutput_items (noutput_items - output_index); - nbytes = std::min (nbytes, BUFSIZE); - - int result_nbytes = d_usrp->read (buf, nbytes, &overrun); - if (overrun){ - // fprintf (stderr, "usrp_source: overrun\n"); - fputs ("uO", stderr); - d_noverruns++; - } - - if (result_nbytes < 0) // We've got a problem. Usually board unplugged or powered down. - return -1; // Indicate we're done. - - if (result_nbytes != nbytes){ // not really an error, but unexpected - fprintf (stderr, "usrp_source: short read. Expected %d, got %d\n", - nbytes, result_nbytes); - } - - copy_from_usrp_buffer (output_items, - output_index, - noutput_items - output_index, // output_items_available - output_items_produced, // [out] - buf, // usrp_buffer - result_nbytes, // usrp_buffer_length - bytes_read); // [out] - - assert (output_index + output_items_produced <= noutput_items); - assert (bytes_read == result_nbytes); - - output_index += output_items_produced; - } - - return noutput_items; -} - - -bool -usrp_source_base::set_decim_rate (unsigned int rate) -{ - return d_usrp->set_decim_rate (rate); -} - -bool -usrp_source_base::set_nchannels (int nchan) -{ - return d_usrp->set_nchannels (nchan); -} - -bool -usrp_source_base::set_mux (int mux) -{ - return d_usrp->set_mux (mux); -} - -int -usrp_source_base::determine_rx_mux_value(usrp_subdev_spec ss) -{ - return d_usrp->determine_rx_mux_value(ss); -} - -int -usrp_source_base::determine_rx_mux_value(usrp_subdev_spec ss_a, usrp_subdev_spec ss_b) -{ - return d_usrp->determine_rx_mux_value(ss_a, ss_b); -} - -bool -usrp_source_base::set_rx_freq (int channel, double freq) -{ - return d_usrp->set_rx_freq (channel, freq); -} - -unsigned int -usrp_source_base::decim_rate () const -{ - return d_usrp->decim_rate (); -} - -int -usrp_source_base::nchannels () const -{ - return d_usrp->nchannels (); -} - -int -usrp_source_base::mux () const -{ - return d_usrp->mux (); -} - -double -usrp_source_base::rx_freq (int channel) const -{ - return d_usrp->rx_freq (channel); -} - -bool -usrp_source_base::set_fpga_mode (int mode) -{ - return d_usrp->set_fpga_mode (mode); -} - -bool -usrp_source_base::set_ddc_phase (int channel, int phase) -{ - return d_usrp->set_ddc_phase(channel, phase); -} - - -bool -usrp_source_base::set_format(unsigned int format) -{ - return d_usrp->set_format(format); -} - -unsigned int -usrp_source_base::format() const -{ - return d_usrp->format(); -} - -unsigned int -usrp_source_base::make_format(int width, int shift, bool want_q, bool bypass_halfband) -{ - return usrp_standard_rx::make_format(width, shift, want_q, bypass_halfband); -} - -int -usrp_source_base::format_width(unsigned int format) -{ - return usrp_standard_rx::format_width(format); -} - -int -usrp_source_base::format_shift(unsigned int format) -{ - return usrp_standard_rx::format_shift(format); -} - -bool -usrp_source_base::format_want_q(unsigned int format) -{ - return usrp_standard_rx::format_want_q(format); -} - -bool -usrp_source_base::format_bypass_halfband(unsigned int format) -{ - return usrp_standard_rx::format_bypass_halfband(format); -} - -bool -usrp_source_base::has_rx_halfband() -{ - return d_usrp->has_rx_halfband(); -} - -bool -usrp_source_base::has_tx_halfband() -{ - return d_usrp->has_tx_halfband(); -} - -int -usrp_source_base::nddcs() -{ - return d_usrp->nddcs(); -} - -int -usrp_source_base::nducs() -{ - return d_usrp->nducs(); -} - -bool -usrp_source_base::start() -{ - return d_usrp->start(); -} - -bool -usrp_source_base::stop() -{ - return d_usrp->stop(); -} - -bool -usrp_source_base::tune(int chan, db_base_sptr db, double target_freq, usrp_tune_result *result) -{ - return d_usrp->tune(chan, db, target_freq, result); -} - -usrp_subdev_spec -usrp_source_base::pick_rx_subdevice() -{ - int dbids[] = { - USRP_DBID_FLEX_400_RX, - USRP_DBID_FLEX_900_RX, - USRP_DBID_FLEX_1200_RX, - USRP_DBID_FLEX_2400_RX, - USRP_DBID_TV_RX, - USRP_DBID_TV_RX_REV_2, - USRP_DBID_TV_RX_REV_3, - USRP_DBID_TV_RX_MIMO, - USRP_DBID_TV_RX_REV_2_MIMO, - USRP_DBID_TV_RX_REV_3_MIMO, - USRP_DBID_DBS_RX, - USRP_DBID_BASIC_RX - }; - - std::vector<int> candidates(dbids, dbids+(sizeof(dbids)/sizeof(int))); - return pick_subdev(candidates); -} diff --git a/gr-usrp/src/usrp_source_base.h b/gr-usrp/src/usrp_source_base.h deleted file mode 100644 index 4def48e24c..0000000000 --- a/gr-usrp/src/usrp_source_base.h +++ /dev/null @@ -1,220 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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. - */ - -#ifndef INCLUDED_USRP_SOURCE_BASE_H -#define INCLUDED_USRP_SOURCE_BASE_H - -#include <usrp_base.h> -#include <stdexcept> -#include <usrp/usrp_tune_result.h> -#include <usrp/usrp_dbid.h> - -class usrp_standard_rx; - -/*! - * \brief abstract interface to Universal Software Radio Peripheral Rx path (Rev 1) - */ -class usrp_source_base : public usrp_base { - private: - boost::shared_ptr<usrp_standard_rx> d_usrp; - int d_noverruns; - - protected: - usrp_source_base (const std::string &name, - gr_io_signature_sptr output_signature, - int which_board, - unsigned int decim_rate, - int nchan, - int mux, - int mode, - int fusb_block_size, - int fusb_nblocks, - const std::string fpga_filename, - const std::string firmware_filename - ) throw (std::runtime_error); - - /*! - * \brief return number of usrp input bytes required to produce noutput items. - */ - virtual int ninput_bytes_reqd_for_noutput_items (int noutput_items) = 0; - - /*! - * \brief number of bytes in a low-level sample - */ - unsigned int sizeof_basic_sample() const; - - /*! - * \brief convert between native usrp format and output item format - * - * \param[out] output_items stream(s) of output items - * \param[in] output_index starting index in output_items - * \param[in] output_items_available number of empty items available at item[index] - * \param[out] output_items_produced number of items produced by copy - * \param[in] usrp_buffer source buffer - * \param[in] usrp_buffer_length number of bytes available in \p usrp_buffer - * \param[out] bytes_read number of bytes read from \p usrp_buffer - * - * The copy must consume all bytes available. That is, \p bytes_read must equal - * \p usrp_buffer_length. - */ - virtual void copy_from_usrp_buffer (gr_vector_void_star &output_items, - int output_index, - int output_items_available, - int &output_items_produced, - const void *usrp_buffer, - int usrp_buffer_length, - int &bytes_read) = 0; - - public: - ~usrp_source_base (); - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - /*! - * \brief Set decimator rate. \p rate must be EVEN and in [8, 256]. - * - * The final complex sample rate across the USB is - * adc_freq () / decim_rate () - */ - bool set_decim_rate (unsigned int rate); - bool set_nchannels (int nchan); - bool set_mux (int mux); - int determine_rx_mux_value(usrp_subdev_spec ss); - int determine_rx_mux_value(usrp_subdev_spec ss_a, usrp_subdev_spec ss_b); - - /*! - * \brief set the center frequency of the digital down converter. - * - * \p channel must be 0. \p freq is the center frequency in Hz. - * It must be in the range [-FIXME, FIXME]. The frequency specified is - * quantized. Use rx_freq to retrieve the actual value used. - */ - bool set_rx_freq (int channel, double freq); - - /*! - * \brief set fpga special modes - */ - bool set_fpga_mode (int mode); - - /*! - * \brief Set the digital down converter phase register. - * - * \param channel which ddc channel [0, 3] - * \param phase 32-bit integer phase value. - */ - bool set_ddc_phase(int channel, int phase); - - long adc_rate() const { return converter_rate(); } // alias - long adc_freq() const { return converter_rate(); } // deprecated alias - - unsigned int decim_rate () const; - int nchannels () const; - int mux () const; - double rx_freq (int channel) const; - int noverruns () const { return d_noverruns; } - - bool has_rx_halfband(); - bool has_tx_halfband(); - int nddcs(); - int nducs(); - - /*! - * \brief Called to enable drivers, etc for i/o devices. - * - * This allows a block to enable an associated driver to begin - * transfering data just before we start to execute the scheduler. - * The end result is that this reduces latency in the pipeline when - * dealing with audio devices, usrps, etc. - */ - bool start(); - - /*! - * \brief Called to disable drivers, etc for i/o devices. - */ - bool stop(); - - /*! - * \brief Specify Rx data format. - * - * \param format format specifier - * - * Rx data format control register - * - * 3 2 1 - * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 - * +-----------------------------------------+-+-+---------+-------+ - * | Reserved (Must be zero) |B|Q| WIDTH | SHIFT | - * +-----------------------------------------+-+-+---------+-------+ - * - * SHIFT specifies arithmetic right shift [0, 15] - * WIDTH specifies bit-width of I & Q samples across the USB [1, 16] (not all valid) - * Q if set deliver both I & Q, else just I - * B if set bypass half-band filter. - * - * Right now the acceptable values are: - * - * B Q WIDTH SHIFT - * 0 1 16 0 - * 0 1 8 8 - * - * More valid combos to come. - * - * Default value is 0x00000300 16-bits, 0 shift, deliver both I & Q. - */ - bool set_format(unsigned int format); - - /*! - * \brief return current format - */ - unsigned int format () const; - - static unsigned int make_format(int width=16, int shift=0, - bool want_q=true, bool bypass_halfband=false); - static int format_width(unsigned int format); - static int format_shift(unsigned int format); - static bool format_want_q(unsigned int format); - static bool format_bypass_halfband(unsigned int format); - - /*! - * \brief High-level "tune" method. Works for the single channel case. - * - * This method adjusts both the daughterboard LO and the DDC so that - * target_freq ends up at DC in the complex baseband samples. - * - * \param chan which DDC channel we're controlling (almost always 0). - * \param db the daughterboard we're controlling. - * \param target_freq the RF frequency we want at DC in the complex baseband. - * \param[out] result details how the hardware was configured. - * - * \returns true iff everything was successful. - */ - bool tune(int chan, db_base_sptr db, double target_freq, usrp_tune_result *result); - - /*! - * \brief Select suitable Rx daughterboard - */ - usrp_subdev_spec pick_rx_subdevice(); -}; - -#endif /* INCLUDED_USRP_SOURCE_BASE_H */ diff --git a/gr-usrp/src/usrp_source_base.i b/gr-usrp/src/usrp_source_base.i deleted file mode 100644 index aed751de98..0000000000 --- a/gr-usrp/src/usrp_source_base.i +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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_source_base.h" -%} - -class usrp_source_base : public usrp_base -{ -private: - usrp_source_base() throw (std::runtime_error); - -public: - bool set_decim_rate (unsigned int rate); - bool set_nchannels (int nchan); - bool set_mux (int mux); - %rename(_real_determine_rx_mux_value) determine_rx_mux_value; - int determine_rx_mux_value(usrp_subdev_spec ss); - int determine_rx_mux_value(usrp_subdev_spec ss_a, usrp_subdev_spec ss_b); - bool set_rx_freq (int channel, double freq); - bool set_fpga_mode (int mode); - bool set_ddc_phase(int channel, int phase); - long adc_rate() const { return converter_rate(); } - long adc_freq() const { return converter_rate(); } - unsigned int decim_rate () const; - int nchannels () const; - int mux () const; - double rx_freq (int channel) const; - int noverruns () const { return d_noverruns; } - bool has_rx_halfband(); - bool has_tx_halfband(); - int nddcs(); - int nducs(); - bool set_format(unsigned int format); - static unsigned int make_format(int width=16, int shift=0, - bool want_q=true, bool bypass_halfband=false); - static int format_width(unsigned int format); - static int format_shift(unsigned int format); - static bool format_want_q(unsigned int format); - static bool format_bypass_halfband(unsigned int format); - %rename(_real_tune) tune; - bool tune(int chan, db_base_sptr db, double target_freq, usrp_tune_result *result); - %rename(_real_pick_rx_subdevice) pick_rx_subdevice(); - usrp_subdev_spec pick_rx_subdevice(); -}; diff --git a/gr-usrp/src/usrp_source_c.cc b/gr-usrp/src/usrp_source_c.cc deleted file mode 100644 index 9055f3ee76..0000000000 --- a/gr-usrp/src/usrp_source_c.cc +++ /dev/null @@ -1,131 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2006,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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <usrp_source_c.h> -#include <gr_io_signature.h> -#include <usrp/usrp_standard.h> -#include <usrp/usrp_bytesex.h> - -static const int NBASIC_SAMPLES_PER_ITEM = 2; // I & Q - -usrp_source_c_sptr -usrp_make_source_c (int which_board, - unsigned int decim_rate, - int nchan, - int mux, - int mode, - int fusb_block_size, - int fusb_nblocks, - const std::string fpga_filename, - const std::string firmware_filename - ) throw (std::runtime_error) -{ - return gnuradio::get_initial_sptr(new usrp_source_c (which_board, - decim_rate, - nchan, - mux, - mode, - fusb_block_size, - fusb_nblocks, - fpga_filename, - firmware_filename - )); -} - - -usrp_source_c::usrp_source_c (int which_board, - unsigned int decim_rate, - int nchan, - int mux, - int mode, - int fusb_block_size, - int fusb_nblocks, - const std::string fpga_filename, - const std::string firmware_filename - ) throw (std::runtime_error) - : usrp_source_base ("usrp_source_c", - gr_make_io_signature (1, 1, sizeof (gr_complex)), - which_board, decim_rate, nchan, mux, mode, - fusb_block_size, fusb_nblocks, - fpga_filename, firmware_filename) -{ -} - -usrp_source_c::~usrp_source_c () -{ - // NOP -} - -int -usrp_source_c::ninput_bytes_reqd_for_noutput_items (int noutput_items) -{ - return noutput_items * NBASIC_SAMPLES_PER_ITEM * sizeof_basic_sample(); -} - -/* - * Convert interleaved 8 or 16-bit I & Q from usrp buffer into a single - * complex output stream. - */ -void -usrp_source_c::copy_from_usrp_buffer (gr_vector_void_star &output_items, - int output_index, - int output_items_available, - int &output_items_produced, - const void *usrp_buffer, - int usrp_buffer_length, - int &bytes_read) -{ - gr_complex *out = &((gr_complex *) output_items[0])[output_index]; - unsigned sbs = sizeof_basic_sample(); - unsigned nusrp_bytes_per_item = NBASIC_SAMPLES_PER_ITEM * sbs; - - int nitems = std::min (output_items_available, - (int)(usrp_buffer_length / nusrp_bytes_per_item)); - - signed char *s8 = (signed char *) usrp_buffer; - short *s16 = (short *) usrp_buffer; - - switch (sbs){ - case 1: - for (int i = 0; i < nitems; i++){ - out[i] = gr_complex ((float)(s8[2*i+0] << 8), (float)(s8[2*i+1] << 8)); - } - break; - - case 2: - for (int i = 0; i < nitems; i++){ - out[i] = gr_complex ((float) usrp_to_host_short(s16[2*i+0]), - (float) usrp_to_host_short(s16[2*i+1])); - } - break; - - default: - assert(0); - } - - output_items_produced = nitems; - bytes_read = nitems * nusrp_bytes_per_item; -} diff --git a/gr-usrp/src/usrp_source_c.h b/gr-usrp/src/usrp_source_c.h deleted file mode 100644 index 3fb04d6574..0000000000 --- a/gr-usrp/src/usrp_source_c.h +++ /dev/null @@ -1,97 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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. - */ - -#ifndef INCLUDED_USRP_SOURCE_C_H -#define INCLUDED_USRP_SOURCE_C_H - -#include <usrp_source_base.h> -#include <stdexcept> - -class usrp_standard_rx; - - -class usrp_source_c; -typedef boost::shared_ptr<usrp_source_c> usrp_source_c_sptr; - - -// public shared_ptr constructor - -usrp_source_c_sptr -usrp_make_source_c (int which_board=0, - unsigned int decim_rate=16, - int nchan = 1, - int mux = -1, - int mode = 0, - int fusb_block_size = 0, - int fusb_nblocks = 0, - const std::string fpga_filename = "", - const std::string firmware_filename = "" - ) throw (std::runtime_error); - -/*! - * \brief Interface to Universal Software Radio Peripheral Rx path - * \ingroup usrp - * \ingroup source_blk - * - * output: 1 stream of complex<float> - */ -class usrp_source_c : public usrp_source_base { - private: - friend usrp_source_c_sptr - usrp_make_source_c (int which_board, - unsigned int decim_rate, - int nchan, - int mux, - int mode, - int fusb_block_size, - int fusb_nblocks, - const std::string fpga_filename, - const std::string firmware_filename - ) throw (std::runtime_error); - - protected: - usrp_source_c (int which_board, - unsigned int decim_rate, - int nchan, - int mux, - int mode, - int fusb_block_size, - int fusb_nblocks, - const std::string fpga_filename, - const std::string firmware_filename - ) throw (std::runtime_error); - - virtual int ninput_bytes_reqd_for_noutput_items (int noutput_items); - - virtual void copy_from_usrp_buffer (gr_vector_void_star &output_items, - int output_index, - int output_items_available, - int &output_items_produced, - const void *usrp_buffer, - int usrp_buffer_length, - int &bytes_read); - - public: - ~usrp_source_c (); -}; - -#endif /* INCLUDED_USRP_SOURCE_C_H */ diff --git a/gr-usrp/src/usrp_source_c.i b/gr-usrp/src/usrp_source_c.i deleted file mode 100644 index 499f7f740b..0000000000 --- a/gr-usrp/src/usrp_source_c.i +++ /dev/null @@ -1,48 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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_source_c.h" -%} - -GR_SWIG_BLOCK_MAGIC(usrp,source_c) - -class usrp_source_c; -typedef boost::shared_ptr<usrp_source_c> usrp_source_c_sptr; - -usrp_source_c_sptr -usrp_make_source_c(int which=0, - unsigned int decim_rate=16, - int nchan=1, - int mux=-1, - int mode=0, - int fusb_block_size=0, - int fusb_nblocks=0, - const std::string fpga_filename="", - const std::string firmware_filename="" - ) throw (std::runtime_error); - -class usrp_source_c : public usrp_source_base -{ -private: - usrp_source_c() throw (std::runtime_error); -}; diff --git a/gr-usrp/src/usrp_source_s.cc b/gr-usrp/src/usrp_source_s.cc deleted file mode 100644 index 8e1c2f188b..0000000000 --- a/gr-usrp/src/usrp_source_s.cc +++ /dev/null @@ -1,131 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2006,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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <usrp_source_s.h> -#include <gr_io_signature.h> -#include <usrp/usrp_standard.h> -#include <usrp/usrp_bytesex.h> - -static const int NBASIC_SAMPLES_PER_ITEM = 1; - -usrp_source_s_sptr -usrp_make_source_s (int which_board, - unsigned int decim_rate, - int nchan, - int mux, - int mode, - int fusb_block_size, - int fusb_nblocks, - const std::string fpga_filename, - const std::string firmware_filename - ) throw (std::runtime_error) -{ - return gnuradio::get_initial_sptr(new usrp_source_s (which_board, - decim_rate, - nchan, - mux, - mode, - fusb_block_size, - fusb_nblocks, - fpga_filename, - firmware_filename - )); -} - - -usrp_source_s::usrp_source_s (int which_board, - unsigned int decim_rate, - int nchan, - int mux, - int mode, - int fusb_block_size, - int fusb_nblocks, - const std::string fpga_filename, - const std::string firmware_filename - ) throw (std::runtime_error) - : usrp_source_base ("usrp_source_s", - gr_make_io_signature (1, 1, sizeof (short)), - which_board, decim_rate, nchan, mux, mode, - fusb_block_size, - fusb_nblocks, - fpga_filename, firmware_filename) -{ -} - -usrp_source_s::~usrp_source_s () -{ - // NOP -} - -int -usrp_source_s::ninput_bytes_reqd_for_noutput_items (int noutput_items) -{ - return noutput_items * NBASIC_SAMPLES_PER_ITEM * sizeof_basic_sample(); -} - -/* - * Convert interleaved 8 or 16-bit I & Q from usrp buffer into a single - * short output stream. - */ -void -usrp_source_s::copy_from_usrp_buffer (gr_vector_void_star &output_items, - int output_index, - int output_items_available, - int &output_items_produced, - const void *usrp_buffer, - int usrp_buffer_length, - int &bytes_read) -{ - short *out = &((short *) output_items[0])[output_index]; - unsigned sbs = sizeof_basic_sample(); - unsigned nusrp_bytes_per_item = NBASIC_SAMPLES_PER_ITEM * sbs; - - int nitems = std::min (output_items_available, - (int)(usrp_buffer_length / nusrp_bytes_per_item)); - - signed char *s8 = (signed char *) usrp_buffer; - short *s16 = (short *) usrp_buffer; - - switch(sbs){ - case 1: - for (int i = 0; i < nitems; i++){ - out[i] = s8[i] << 8; - } - break; - - case 2: - for (int i = 0; i < nitems; i++){ - out[i] = usrp_to_host_short(s16[i]); - } - break; - - default: - assert(0); - } - - output_items_produced = nitems; - bytes_read = nitems * nusrp_bytes_per_item; -} diff --git a/gr-usrp/src/usrp_source_s.h b/gr-usrp/src/usrp_source_s.h deleted file mode 100644 index 9118b4e0f4..0000000000 --- a/gr-usrp/src/usrp_source_s.h +++ /dev/null @@ -1,96 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 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. - */ - -#ifndef INCLUDED_USRP_SOURCE_S_H -#define INCLUDED_USRP_SOURCE_S_H - -#include <usrp_source_base.h> -#include <stdexcept> - -class usrp_standard_rx; - - -class usrp_source_s; -typedef boost::shared_ptr<usrp_source_s> usrp_source_s_sptr; - - -// public shared_ptr constructor - -usrp_source_s_sptr -usrp_make_source_s (int which_board=0, - unsigned int decim_rate=16, - int nchan=1, - int mux=-1, - int mode=0, - int fusb_block_size=0, - int fusb_nblocks=0, - const std::string fpga_filename="", - const std::string firmware_filename="" - ) throw (std::runtime_error); - -/*! - * \brief Interface to Universal Software Radio Peripheral Rx path - * \ingroup usrp - * \ingroup source_blk - * - * output: 1 stream of short - */ -class usrp_source_s : public usrp_source_base { - private: - friend usrp_source_s_sptr - usrp_make_source_s (int which_board, - unsigned int decim_rate, - int nchan, - int mux, - int mode, - int fusb_block_size, - int fusb_nblocks, - const std::string fpga_filename, - const std::string firmware_filename - ) throw (std::runtime_error); - - protected: - usrp_source_s (int which_board, - unsigned int decim_rate, - int nchan, - int mux, - int mode, - int fusb_block_size, - int fusb_nblocks, - const std::string fpga_filename, - const std::string firmware_filename - ) throw (std::runtime_error); - - virtual int ninput_bytes_reqd_for_noutput_items (int noutput_items); - - virtual void copy_from_usrp_buffer (gr_vector_void_star &output_items, - int output_index, - int output_items_available, - int &output_items_produced, - const void *usrp_buffer, - int usrp_buffer_length, - int &bytes_read); - public: - ~usrp_source_s (); -}; - -#endif /* INCLUDED_USRP_SOURCE_S_H */ diff --git a/gr-usrp/src/usrp_source_s.i b/gr-usrp/src/usrp_source_s.i deleted file mode 100644 index d8b285c99f..0000000000 --- a/gr-usrp/src/usrp_source_s.i +++ /dev/null @@ -1,48 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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_source_s.h" -%} - -GR_SWIG_BLOCK_MAGIC(usrp,source_s) - -class usrp_source_s; -typedef boost::shared_ptr<usrp_source_s> usrp_source_s_sptr; - -usrp_source_s_sptr -usrp_make_source_s(int which=0, - unsigned int decim_rate=16, - int nchan=1, - int mux=-1, - int mode=0, - int fusb_block_size=0, - int fusb_nblocks=0, - const std::string fpga_filename="", - const std::string firmware_filename="" - ) throw (std::runtime_error); - -class usrp_source_s : public usrp_source_base -{ -private: - usrp_source_s() throw (std::runtime_error); -}; diff --git a/gr-usrp/src/usrp_standard.i b/gr-usrp/src/usrp_standard.i deleted file mode 100644 index 61053bb3b2..0000000000 --- a/gr-usrp/src/usrp_standard.i +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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. - */ - -// FIXME: move to usrp/usrpm component - -%{ -#include <usrp/usrp_standard.h> -#include <usrp_spi_defs.h> -#include <usrp/usrp_dbid.h> -%} - -%include <usrp_spi_defs.h> -%include <usrp/usrp_dbid.h> - -%constant int FPGA_MODE_NORMAL = usrp_standard_rx::FPGA_MODE_NORMAL; -%constant int FPGA_MODE_LOOPBACK = usrp_standard_rx::FPGA_MODE_LOOPBACK; -%constant int FPGA_MODE_COUNTING = usrp_standard_rx::FPGA_MODE_COUNTING; diff --git a/gr-usrp/src/usrp_swig.i b/gr-usrp/src/usrp_swig.i deleted file mode 100644 index 80d59abc98..0000000000 --- a/gr-usrp/src/usrp_swig.i +++ /dev/null @@ -1,157 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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. - */ - -%include "gnuradio.i" // the common stuff - -%{ -#include "config.h" // for NOMINMAX -#include <vector> -%} - -%include <usrp/usrp_subdev_spec.h> -%include <usrp/db_base.i> -%include <fpga_regs_common.h> -%include <fpga_regs_standard.h> -%include "usrp_standard.i" -%include "usrp_base.i" -%include "usrp_source_base.i" -%include "usrp_source_c.i" -%include "usrp_source_s.i" -%include "usrp_sink_base.i" -%include "usrp_sink_c.i" -%include "usrp_sink_s.i" - -#ifdef SWIGPYTHON -//---Allow a more Pythonic interface -%pythoncode %{ - -# Allow subdev_spec to be tuple -def __selected_subdev(self, subdev_spec): - ss = usrp_subdev_spec(subdev_spec[0], subdev_spec[1]) - return self._real_selected_subdev(ss) - -# Allow subdev_spec to be tuple -def __determine_tx_mux_value(self, subdev_spec, subdev_spec_=None): - ss = usrp_subdev_spec(subdev_spec[0], subdev_spec[1]) - if subdev_spec_ is None: return self._real_determine_tx_mux_value(ss) - ss_ = usrp_subdev_spec(subdev_spec_[0], subdev_spec_[1]) - return self._real_determine_tx_mux_value(ss, ss_) - -# Allow subdev_spec to be tuple -def __determine_rx_mux_value(self, subdev_spec, subdev_spec_=None): - ss = usrp_subdev_spec(subdev_spec[0], subdev_spec[1]) - if subdev_spec_ is None: return self._real_determine_rx_mux_value(ss) - ss_ = usrp_subdev_spec(subdev_spec_[0], subdev_spec_[1]) - return self._real_determine_rx_mux_value(ss, ss_) - -# Allow subdev_spec to be tuple -def __pick_subdev(self, candidates=[]): - ss = self._real_pick_subdev(candidates) - return (ss.side, ss.subdev) - -# Allow subdev_spec to be tuple -def __pick_tx_subdevice(self): - ss = self._real_pick_tx_subdevice() - return (ss.side, ss.subdev) - -# Allow subdev_spec to be tuple -def __pick_rx_subdevice(self): - ss = self._real_pick_rx_subdevice() - return (ss.side, ss.subdev) - -# Make return tune_result or None on failure -def __tune(self, chan, db, target_freq): - tr = usrp_tune_result() - r = self._real_tune(chan, db, target_freq, tr) - if r: - return tr - else: - return None - -# Allow to be called as a free function -def tune(u, chan, subdev, target_freq): - return u.tune(chan, subdev, target_freq) - -# Allow to be called as free function -def determine_tx_mux_value(u, subdev_spec, subdev_spec_=None): - return u.determine_tx_mux_value(subdev_spec, subdev_spec_) - -# Allow to be called as free function -def determine_rx_mux_value(u, subdev_spec, subdev_spec_=None): - return u.determine_rx_mux_value(subdev_spec, subdev_spec_) - -# Allow to be called as free function -def selected_subdev(u, subdev_spec): - return u.selected_subdev(subdev_spec) - -# Allow to be called as free function -def pick_subdev(u, candidates=[]): - return u.pick_subdev(candidates); - -# Allow to be called as free function -def pick_tx_subdevice(u): - return u.pick_tx_subdevice(); - -# Allow to be called as free function -def pick_rx_subdevice(u): - return u.pick_rx_subdevice(); - -# Jam into Python objects -usrp_sink_c_sptr.determine_tx_mux_value = __determine_tx_mux_value -usrp_sink_s_sptr.determine_tx_mux_value = __determine_tx_mux_value - -usrp_source_c_sptr.determine_rx_mux_value = __determine_rx_mux_value -usrp_source_s_sptr.determine_rx_mux_value = __determine_rx_mux_value - -usrp_sink_c_sptr.selected_subdev = __selected_subdev -usrp_sink_s_sptr.selected_subdev = __selected_subdev -usrp_source_c_sptr.selected_subdev = __selected_subdev -usrp_source_s_sptr.selected_subdev = __selected_subdev - -usrp_sink_c_sptr.tune = __tune -usrp_sink_s_sptr.tune = __tune -usrp_source_c_sptr.tune = __tune -usrp_source_s_sptr.tune = __tune - -usrp_sink_c_sptr.pick_subdev = __pick_subdev -usrp_sink_s_sptr.pick_subdev = __pick_subdev -usrp_source_c_sptr.pick_subdev = __pick_subdev -usrp_source_s_sptr.pick_subdev = __pick_subdev - -usrp_sink_c_sptr.pick_tx_subdevice = __pick_tx_subdevice -usrp_sink_s_sptr.pick_tx_subdevice = __pick_tx_subdevice -usrp_source_c_sptr.pick_rx_subdevice = __pick_rx_subdevice -usrp_source_s_sptr.pick_rx_subdevice = __pick_rx_subdevice - -%} -#endif - - -#if SWIGGUILE -%scheme %{ -(load-extension-global "libguile-gnuradio-usrp_swig" "scm_init_gnuradio_usrp_swig_module") -%} - -%goops %{ -(use-modules (gnuradio gnuradio_core_runtime)) -%} -#endif |