diff options
author | Josh Blum | 2011-10-19 16:53:11 -0700 |
---|---|---|
committer | Josh Blum | 2011-10-19 16:53:11 -0700 |
commit | 604ae82b9f31d8b5d7775810ab2fa06b7595bea0 (patch) | |
tree | fe4c7ad82dca0d92d90e37c4b68dd729d29a9d66 | |
parent | d8d886d42ef9966e0578f39f180348e908965f7a (diff) | |
parent | eb95f431badf197b249131a3119a92bd5317621b (diff) | |
download | gnuradio-604ae82b9f31d8b5d7775810ab2fa06b7595bea0.tar.gz gnuradio-604ae82b9f31d8b5d7775810ab2fa06b7595bea0.tar.bz2 gnuradio-604ae82b9f31d8b5d7775810ab2fa06b7595bea0.zip |
Merge branch 'next' of http://gnuradio.org/git/gnuradio into next
585 files changed, 0 insertions, 86977 deletions
diff --git a/gr-usrp/.gitignore b/gr-usrp/.gitignore deleted file mode 100644 index cdcf41b15..000000000 --- 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 be4035dd4..000000000 --- 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 4ed7a15b3..000000000 --- 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 2d01df25f..000000000 --- a/gr-usrp/apps/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -/Makefile -/Makefile.in -/.libs -/.deps -/usrp_siggen -/usrp_rx_cfile diff --git a/gr-usrp/apps/Makefile.am b/gr-usrp/apps/Makefile.am deleted file mode 100644 index b45f3f79c..000000000 --- a/gr-usrp/apps/Makefile.am +++ /dev/null @@ -1,68 +0,0 @@ -# -# Copyright 2008,2009,2010 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -include $(top_srcdir)/Makefile.common - -# For compiling within the GNU Radio build tree -AM_CPPFLAGS = \ - -I$(top_srcdir)/gr-usrp/src \ - $(USRP_INCLUDES) \ - $(STD_DEFINES_AND_INCLUDES) \ - $(WITH_INCLUDES) - -GR_USRP_LA=$(top_builddir)/gr-usrp/src/libgnuradio-usrp.la - -# For compiling outside the tree, these will get fished out by pkgconfig - -LDADD = \ - $(GNURADIO_CORE_LA) \ - $(USRP_LA) \ - $(GR_USRP_LA) \ - $(BOOST_LDFLAGS) \ - $(BOOST_PROGRAM_OPTIONS_LIB) \ - $(BOOST_FILESYSTEM_LIB) - -noinst_PROGRAMS = \ - usrp_rx_cfile \ - usrp_siggen - -noinst_HEADERS = \ - usrp_rx_cfile.h \ - usrp_siggen.h - -usrp_rx_cfile_SOURCES = \ - usrp_rx_cfile.cc - -usrp_siggen_SOURCES = \ - usrp_siggen.cc - -if PYTHON - -bin_SCRIPTS = \ - lsusrp \ - usrp_print_db.py \ - usrp_rx_cfile.py \ - usrp_test_counting.py \ - usrp_test_loopback.py - -EXTRA_DIST += $(bin_SCRIPTS) - -endif diff --git a/gr-usrp/apps/lsusrp b/gr-usrp/apps/lsusrp deleted file mode 100755 index d2eab33fe..000000000 --- a/gr-usrp/apps/lsusrp +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2008 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -MAX_USRPS = 8 - -from gnuradio import usrp -from optparse import OptionParser - -def disp_usrp(which, serial=None): - u_source = usrp.source_c(which=which) - u_sink = usrp.sink_c(which=which) - u_serial = u_source.serial_number() - - if serial is not None: - if serial != u_serial: - raise ValueError - - print "USRP", which, "serial number", u_source.serial_number() - subdev_A_rx = usrp.selected_subdev(u_source, (0,0)) - subdev_B_rx = usrp.selected_subdev(u_source, (1,0)) - subdev_A_tx = usrp.selected_subdev(u_sink, (0,0)) - subdev_B_tx = usrp.selected_subdev(u_sink, (1,0)) - print " RX d'board %s" % (subdev_A_rx.side_and_name(),) - print " RX d'board %s" % (subdev_B_rx.side_and_name(),) - print " TX d'board %s" % (subdev_A_tx.side_and_name(),) - print " TX d'board %s" % (subdev_B_tx.side_and_name(),) - -if __name__ == "__main__": - parser = OptionParser() - parser.add_option("-w", "--which", type="int", default=None, - help="select which USRP (0, 1, ...) default is all found", - metavar="NUM") - parser.add_option("-s", "--serial", default=None, - help="select USRP by serial number", - metavar="SER") - (options, args) = parser.parse_args() - if len(args) > 0: - print parser.print_help() - raise SystemExit, 1 - - if options.serial is not None and options.which is not None: - print "Use of --which or --serial is exclusive" - raise SystemExit, 1 - - if options.which is not None: - try: - disp_usrp(options.which) - except: - print "USRP", options.which, "not found." - else: - for n in range(MAX_USRPS): - try: - disp_usrp(n, options.serial) - except: - pass - diff --git a/gr-usrp/apps/usrp_print_db.py b/gr-usrp/apps/usrp_print_db.py deleted file mode 100755 index b082cb073..000000000 --- a/gr-usrp/apps/usrp_print_db.py +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2006,2007 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -#!/usr/bin/env python - -from gnuradio import gr -from gnuradio import usrp -from optparse import OptionParser -from usrpm import usrp_dbid - -u_source = usrp.source_c() -u_sink = usrp.sink_c() - -subdev_Ar = usrp.selected_subdev(u_source, (0,0)) -subdev_Br = usrp.selected_subdev(u_source, (1,0)) -subdev_At = usrp.selected_subdev(u_sink, (0,0)) -subdev_Bt = usrp.selected_subdev(u_sink, (1,0)) - -print "RX d'board %s" % (subdev_Ar.side_and_name(),) -print "RX d'board %s" % (subdev_Br.side_and_name(),) -print "TX d'board %s" % (subdev_At.side_and_name(),) -print "TX d'board %s" % (subdev_Bt.side_and_name(),) - diff --git a/gr-usrp/apps/usrp_rx_cfile.cc b/gr-usrp/apps/usrp_rx_cfile.cc deleted file mode 100644 index d40ca58f7..000000000 --- a/gr-usrp/apps/usrp_rx_cfile.cc +++ /dev/null @@ -1,245 +0,0 @@ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#include <usrp_rx_cfile.h> -#include <gr_io_signature.h> -#include <gr_head.h> -#include <stdexcept> -#include <iostream> -#include <boost/program_options.hpp> - -namespace po = boost::program_options; - -usrp_subdev_spec -str_to_subdev(std::string spec_str) -{ - usrp_subdev_spec spec; - if(spec_str == "A" || spec_str == "A:0" || spec_str == "0:0") { - spec.side = 0; - spec.subdev = 0; - } - else if(spec_str == "A:1" || spec_str == "0:1") { - spec.side = 0; - spec.subdev = 1; - } - else if(spec_str == "B" || spec_str == "B:0" || spec_str == "1:0") { - spec.side = 1; - spec.subdev = 0; - } - else if(spec_str == "B:1" || spec_str == "1:1") { - spec.side = 1; - spec.subdev = 1; - } - else { - throw std::range_error("Incorrect subdevice specifications.\n"); - } - - return spec; -} - - -// Shared pointer constructor -usrp_rx_cfile_sptr make_usrp_rx_cfile(int which, usrp_subdev_spec spec, - int decim, double freq, float gain, - bool width8, bool nohb, - bool output_shorts, int nsamples, - const std::string &filename) -{ - return gnuradio::get_initial_sptr(new usrp_rx_cfile(which, spec, - decim, freq, gain, - width8, nohb, - output_shorts, - nsamples, - filename)); -} - -// Hierarchical block constructor, with no inputs or outputs -usrp_rx_cfile::usrp_rx_cfile(int which, usrp_subdev_spec spec, - int decim, double freq, float gain, - bool width8, bool nohb, - bool output_shorts, int nsamples, - const std::string &filename) : - gr_top_block("usrp_rx_cfile"), - d_which(which), d_spec(spec), d_decim(decim), d_freq(freq), - d_gain(gain), d_width8(width8), d_nohb(nohb), d_nsamples(nsamples), - d_filename(filename) -{ - usrp_source_c_sptr usrp; - - if(d_nohb || (d_decim<8)) { - // Min decimation of this firmware is 4. - // contains 4 Rx paths without halfbands and 0 tx paths. - std::string fpga_filename="std_4rx_0tx.rbf"; - - // use default values and add fpga_filename - usrp = usrp_make_source_c(d_which, d_decim, - 1, -1, 0, 0, 0, - fpga_filename.c_str()); - } - else { - // standard fpga firmware "std_2rxhb_2tx.rbf" contains - // 2 Rx paths with halfband filters and 2 tx paths - //(the default) min decimation 8 - usrp = usrp_make_source_c(d_which, d_decim); - } - - if(d_width8) { - int sample_width = 8; - int sample_shift = 8; - int format = usrp->make_format(sample_width, sample_shift); - int r = usrp->set_format(format); - printf("width8: format=%d r=%d\n", format, r); - } - - - /* Get subdevice and process it */ - db_base_sptr subdev = usrp->selected_subdev(d_spec); - printf("\nSubdevice name is %s\n", subdev->side_and_name().c_str()); - printf("Subdevice freq range: (%g, %g)\n", - subdev->freq_min(), subdev->freq_max()); - - unsigned int mux = usrp->determine_rx_mux_value(d_spec); - printf("mux: %#08x\n", mux); - usrp->set_mux(mux); - - float gain_min = subdev->gain_min(); - float gain_max = subdev->gain_max(); - if(d_gain == -1) { - d_gain = (gain_min + gain_max)/2.0; - } - printf("gain: %g\n", d_gain); - subdev->set_gain(d_gain); - - - /* Set the USRP/dboard frequency */ - usrp_tune_result r; - bool ok = usrp->tune(0, subdev, freq, &r); //DDC 0 - - if(!ok) { - throw std::runtime_error("Could not set frequency."); - } - - /* The rest */ - d_dst = gr_make_file_sink(sizeof(gr_complex), d_filename.c_str()); - - if(d_nsamples == -1) { - connect(usrp, 0, d_dst, 0); - } - else { - d_head = gr_make_head(sizeof(gr_complex), d_nsamples*2); - connect(usrp, 0, d_head, 0); - connect(d_head, 0, d_dst, 0); - } -} - - -int main(int argc, char *argv[]) -{ - int which = 0; // specify which USRP board - usrp_subdev_spec spec(0,0); // specify the d'board side - int decim = 16; // set the decimation rate - double freq = 0; // set the frequency - float gain = -1; // set the gain; -1 will set the mid-point gain - int nsamples = -1; // set the number of samples to collect; -1 will continue - bool width8 = false; // use 8-bit samples across USB - bool nohb = false; // don't use halfband filter in USRP - bool output_shorts = false; // use shorts - std::string filename = "received.dat"; - - po::options_description cmdconfig("Program options: usrp_text_rx [options] filename"); - cmdconfig.add_options() - ("help,h", "produce help message") - ("which,W", po::value<int>(&which), "select which USRP board") - ("rx-subdev-spec,R", po::value<std::string>(), "select USRP Rx side A or B (default=A)") - ("decim,d", po::value<int>(&decim), "set fgpa decimation rate to DECIM") - ("freq,f", po::value<double>(), "set frequency to FREQ") - ("gain,g", po::value<float>(), "set gain in dB (default is midpoint)") - ("width-8,8", "Enable 8-bit samples across USB") - ("no-hb", "don't use halfband filter in usrp") - //("output-shorts,s", "output interleaved shorts in stead of complex floats") - ("nsamples,N", po::value<int>(&nsamples), "number of samples to collect") - ; - - po::options_description fileconfig("Input file options"); - fileconfig.add_options() - ("filename", po::value<std::string>(), "input file") - ; - - po::positional_options_description inputfile; - inputfile.add("filename", -1); - - po::options_description config; - config.add(cmdconfig).add(fileconfig); - - po::variables_map vm; - po::store(po::command_line_parser(argc, argv). - options(config).positional(inputfile).run(), vm); - po::notify(vm); - - if (vm.count("help")) { - std::cout << cmdconfig << "\n"; - return 1; - } - - if(vm.count("filename")) { - filename = vm["filename"].as<std::string>(); - } - - if(vm.count("freq")) { - freq = vm["freq"].as<double>(); - } - else { - fprintf(stderr, "You must specify a frequency.\n"); - return -1; - } - - if(vm.count("rx-subdev-spec")) { - std::string s = vm["rx-subdev-spec"].as<std::string>(); - spec = str_to_subdev(s); - } - - if(vm.count("width-8")) { - width8 = true; - } - if(vm.count("nohb")) { - nohb = true; - } - if(vm.count("output-shorts")) { - output_shorts = true; - } - - std::cout << "which: " << which << std::endl; - std::cout << "decim: " << decim << std::endl; - std::cout << "freq: " << freq << std::endl; - std::cout << "gain: " << gain << std::endl; - std::cout << "width-8 " << (width8 ? "Yes" : "No") << std::endl; - std::cout << "no-hb " << (nohb ? "Yes" : "no") << std::endl; - std::cout << "shorts: " << (output_shorts ? "Yes" : "No") << std::endl; - std::cout << "samples: " << nsamples << std::endl; - - usrp_rx_cfile_sptr top_block = make_usrp_rx_cfile(which, spec, decim, freq, - gain, width8, nohb, - output_shorts, nsamples, - filename); - top_block->run(); - - return 0; -} diff --git a/gr-usrp/apps/usrp_rx_cfile.h b/gr-usrp/apps/usrp_rx_cfile.h deleted file mode 100644 index 3a42972ca..000000000 --- a/gr-usrp/apps/usrp_rx_cfile.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#include <gr_top_block.h> -#include <usrp_source_base.h> -#include <usrp_source_c.h> -#include <usrp_source_s.h> -#include <gr_file_sink.h> - -class usrp_rx_cfile; -typedef boost::shared_ptr<usrp_rx_cfile> usrp_rx_cfile_sptr; -usrp_rx_cfile_sptr make_usrp_rx_cfile(int which, usrp_subdev_spec spec, - int decim, double freq, float gain, - bool width8, bool nohb, - bool output_shorts, int nsamples, - const std::string &filename); - -class usrp_rx_cfile : public gr_top_block -{ -private: - usrp_rx_cfile(int which, usrp_subdev_spec spec, - int decim, double freq, float gain, - bool width8, bool nohb, - bool output_shorts, int nsamples, - const std::string &filename); - friend usrp_rx_cfile_sptr make_usrp_rx_cfile(int which, usrp_subdev_spec spec, - int decim, double freq, float gain, - bool width8, bool nohb, - bool output_shorts, int nsamples, - const std::string &filename); - - int d_which; - usrp_subdev_spec d_spec; - int d_decim; - double d_freq; - float d_gain; - bool d_width8, d_nohb; - int d_nsamples; - std::string d_filename; - - public: - gr_block_sptr d_head; - gr_block_sptr d_dst; -}; diff --git a/gr-usrp/apps/usrp_rx_cfile.py b/gr-usrp/apps/usrp_rx_cfile.py deleted file mode 100755 index 3ac9fb56f..000000000 --- a/gr-usrp/apps/usrp_rx_cfile.py +++ /dev/null @@ -1,108 +0,0 @@ -#!/usr/bin/env python - -""" -Read samples from the USRP and write to file formatted as binary -outputs single precision complex float values or complex short values (interleaved 16 bit signed short integers). - -""" - -from gnuradio import gr, eng_notation -from gnuradio import audio -from gnuradio import usrp -from gnuradio.eng_option import eng_option -from optparse import OptionParser -import sys - -class my_top_block(gr.top_block): - - def __init__(self): - gr.top_block.__init__(self) - - usage="%prog: [options] output_filename" - parser = OptionParser(option_class=eng_option, usage=usage) - parser.add_option("-R", "--rx-subdev-spec", type="subdev", default=(0, 0), - help="select USRP Rx side A or B (default=A)") - parser.add_option("-d", "--decim", type="int", default=16, - help="set fgpa decimation rate to DECIM [default=%default]") - parser.add_option("-f", "--freq", type="eng_float", default=None, - help="set frequency to FREQ", metavar="FREQ") - parser.add_option("-g", "--gain", type="eng_float", default=None, - help="set gain in dB (default is midpoint)") - parser.add_option("-8", "--width-8", action="store_true", default=False, - help="Enable 8-bit samples across USB") - parser.add_option( "--no-hb", action="store_true", default=False, - help="don't use halfband filter in usrp") - parser.add_option( "-s","--output-shorts", action="store_true", default=False, - help="output interleaved shorts in stead of complex floats") - parser.add_option("-N", "--nsamples", type="eng_float", default=None, - help="number of samples to collect [default=+inf]") - (options, args) = parser.parse_args () - if len(args) != 1: - parser.print_help() - raise SystemExit, 1 - filename = args[0] - - if options.freq is None: - parser.print_help() - sys.stderr.write('You must specify the frequency with -f FREQ\n'); - raise SystemExit, 1 - - # build the graph - if options.no_hb or (options.decim<8): - self.fpga_filename="std_4rx_0tx.rbf" #Min decimation of this firmware is 4. contains 4 Rx paths without halfbands and 0 tx paths. - if options.output_shorts: - self.u = usrp.source_s(decim_rate=options.decim,fpga_filename=self.fpga_filename) - else: - self.u = usrp.source_c(decim_rate=options.decim,fpga_filename=self.fpga_filename) - else: - #standard fpga firmware "std_2rxhb_2tx.rbf" contains 2 Rx paths with halfband filters and 2 tx paths (the default) min decimation 8 - if options.output_shorts: - self.u = usrp.source_s(decim_rate=options.decim) - else: - self.u = usrp.source_c(decim_rate=options.decim) - if options.width_8: - sample_width = 8 - sample_shift = 8 - format = self.u.make_format(sample_width, sample_shift) - r = self.u.set_format(format) - if options.output_shorts: - self.dst = gr.file_sink(gr.sizeof_short, filename) - else: - self.dst = gr.file_sink(gr.sizeof_gr_complex, filename) - if options.nsamples is None: - self.connect(self.u, self.dst) - else: - if options.output_shorts: - self.head = gr.head(gr.sizeof_short, int(options.nsamples)*2) - else: - self.head = gr.head(gr.sizeof_gr_complex, int(options.nsamples)) - self.connect(self.u, self.head, self.dst) - - if options.rx_subdev_spec is None: - options.rx_subdev_spec = usrp.pick_rx_subdevice(self.u) - self.u.set_mux(usrp.determine_rx_mux_value(self.u, options.rx_subdev_spec)) - - # determine the daughterboard subdevice we're using - self.subdev = usrp.selected_subdev(self.u, options.rx_subdev_spec) - print "Using RX d'board %s" % (self.subdev.side_and_name(),) - input_rate = self.u.adc_freq() / self.u.decim_rate() - print "USB sample rate %s" % (eng_notation.num_to_str(input_rate)) - - if options.gain is None: - # if no gain was specified, use the mid-point in dB - g = self.subdev.gain_range() - options.gain = float(g[0]+g[1])/2 - - self.subdev.set_gain(options.gain) - - r = self.u.tune(0, self.subdev, options.freq) - if not r: - sys.stderr.write('Failed to set frequency\n') - raise SystemExit, 1 - - -if __name__ == '__main__': - try: - my_top_block().run() - except KeyboardInterrupt: - pass diff --git a/gr-usrp/apps/usrp_siggen.cc b/gr-usrp/apps/usrp_siggen.cc deleted file mode 100644 index 5fb66348f..000000000 --- a/gr-usrp/apps/usrp_siggen.cc +++ /dev/null @@ -1,225 +0,0 @@ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#include <usrp_siggen.h> -#include <gr_io_signature.h> -#include <gr_head.h> -#include <gr_noise_type.h> -#include <stdexcept> -#include <iostream> -#include <cstdio> -#include <boost/program_options.hpp> - -namespace po = boost::program_options; - -usrp_subdev_spec -str_to_subdev(std::string spec_str) -{ - usrp_subdev_spec spec; - if(spec_str == "A" || spec_str == "A:0" || spec_str == "0:0") { - spec.side = 0; - spec.subdev = 0; - } - else if(spec_str == "A:1" || spec_str == "0:1") { - spec.side = 0; - spec.subdev = 1; - } - else if(spec_str == "B" || spec_str == "B:0" || spec_str == "1:0") { - spec.side = 1; - spec.subdev = 0; - } - else if(spec_str == "B:1" || spec_str == "1:1") { - spec.side = 1; - spec.subdev = 1; - } - else { - throw std::range_error("Incorrect subdevice specifications.\n"); - } - - return spec; -} - -// Shared pointer constructor -usrp_siggen_sptr make_usrp_siggen(int which, usrp_subdev_spec spec, - double rf_freq, int interp, double wfreq, - int waveform, float amp, float gain, - float offset, long long nsamples) -{ - return gnuradio::get_initial_sptr(new usrp_siggen(which, spec, - rf_freq, interp, wfreq, - waveform, amp, gain, - offset, nsamples)); -} - -// Hierarchical block constructor, with no inputs or outputs -usrp_siggen::usrp_siggen(int which, usrp_subdev_spec spec, - double rf_freq, int interp, double wfreq, - int waveform, float amp, float gain, - float offset, long long nsamples) - : gr_top_block("usrp_siggen") -{ - usrp_sink_c_sptr usrp = usrp_make_sink_c(which, interp); - - db_base_sptr subdev = usrp->selected_subdev(spec); - printf("Subdevice name is %s\n", subdev->name().c_str()); - printf("Subdevice freq range: (%g, %g)\n", - subdev->freq_min(), subdev->freq_max()); - - unsigned int mux = usrp->determine_tx_mux_value(spec); - printf("mux: %#08x\n", mux); - usrp->set_mux(mux); - - if(gain == -1) { - gain = subdev->gain_max(); - } - subdev->set_gain(gain); - - float input_rate = usrp->dac_freq() / usrp->interp_rate(); - printf("baseband rate: %g\n", input_rate); - - usrp_tune_result r; - double target_freq = rf_freq; - bool ok = usrp->tune(subdev->which(), subdev, target_freq, &r); - - if(!ok) { - throw std::runtime_error("Could not set frequency."); - } - - subdev->set_enable(true); - - printf("target_freq: %f\n", target_freq); - printf("ok: %s\n", ok ? "true" : "false"); - printf("r.baseband_freq: %f\n", r.baseband_freq); - printf("r.dxc_freq: %f\n", r.dxc_freq); - printf("r.residual_freq: %f\n", r.residual_freq); - printf("r.inverted: %d\n", r.inverted); - - /* Set up the signal source */ - siggen = gr_make_sig_source_c(input_rate, GR_SIN_WAVE, wfreq, amp); - noisegen = gr_make_noise_source_c (GR_UNIFORM, amp); - if(waveform == GR_SIN_WAVE || waveform == GR_CONST_WAVE) { - source = siggen; - } - else if(waveform == GR_UNIFORM || waveform == GR_GAUSSIAN) { - source = noisegen; - } - else { - throw std::range_error("Unknown waveform type.\n"); - } - - siggen->set_waveform((gr_waveform_t)waveform); - - if (nsamples > 0){ - gr_block_sptr head = gr_make_head(sizeof(gr_complex), nsamples); - connect(source, 0, head, 0); - connect(head, 0, usrp, 0); - } - else { - connect(source, 0, usrp, 0); - } -} - -int main(int argc, char *argv[]) -{ - int which = 0; // specify which USRP board - usrp_subdev_spec spec(0,0); // specify the d'board side - int interp = 128; // set the interpolation rate - double rf_freq = 0; // set the frequency - double wfreq = 100e3; // set the waveform frequency - float amp = 5; // set the amplitude of the output - float gain = -1; // set the d'board PGA gain - float offset = 0; // set waveform offset - int waveform; - double nsamples = 0; // set the number of samples to transmit (0 -> inf) - - po::options_description cmdconfig("Program options"); - cmdconfig.add_options() - ("help,h", "produce help message") - ("which,W", po::value<int>(&which), "select which USRP board") - ("tx-subdev-spec,T", po::value<std::string>(), "select USRP Tx side A or B") - ("rf-freq,f", po::value<double>(), "set RF center frequency to FREQ") - ("interp,i", po::value<int>(&interp), "set fgpa interpolation rate to INTERP") - - ("sine", "generate a complex sinusoid [default]") - ("const", "generate a constant output") - ("gaussian", "generate Gaussian random output") - ("uniform", "generate Uniform random output") - - ("waveform-freq,w", po::value<double>(&wfreq), "set waveform frequency to FREQ") - ("amplitude,a", po::value<float>(&), "set amplitude") - ("gain,g", po::value<float>(&gain), "set output gain to GAIN") - ("offset,o", po::value<float>(&offset), "set waveform offset to OFFSET") - ("nsamples,N", po::value<double>(&nsamples), "number of samples to send [default=+inf]") - ; - - po::variables_map vm; - po::store(po::command_line_parser(argc, argv). - options(cmdconfig).run(), vm); - po::notify(vm); - - if (vm.count("help")) { - std::cout << cmdconfig << "\n"; - return 1; - } - - if(vm.count("rf-freq")) { - rf_freq = vm["rf-freq"].as<double>(); - } - else { - fprintf(stderr, "You must specify a frequency.\n"); - return -1; - } - - if(vm.count("tx-subdev-spec")) { - std::string s = vm["tx-subdev-spec"].as<std::string>(); - spec = str_to_subdev(s); - } - - if(vm.count("sine")) { - waveform = GR_SIN_WAVE; - } - else if(vm.count("const")) { - waveform = GR_CONST_WAVE; - } - else if(vm.count("gaussian")) { - waveform = GR_GAUSSIAN; - } - else if(vm.count("uniform")) { - waveform = GR_UNIFORM; - } - else { - waveform = GR_SIN_WAVE; - } - - printf("which: %d\n", which); - printf("interp: %d\n", interp); - printf("rf_freq: %g\n", rf_freq); - printf("amp: %f\n", amp); - printf("nsamples: %g\n", nsamples); - - usrp_siggen_sptr top_block = make_usrp_siggen(which, spec, rf_freq, - interp, wfreq, waveform, - amp, gain, offset, (long long) nsamples); - - top_block->run(); - - return 0; -} diff --git a/gr-usrp/apps/usrp_siggen.h b/gr-usrp/apps/usrp_siggen.h deleted file mode 100644 index 053c4bdfa..000000000 --- a/gr-usrp/apps/usrp_siggen.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#include <gr_top_block.h> -#include <usrp_sink_c.h> -#include <gr_sig_source_c.h> -#include <gr_noise_source_c.h> - -usrp_subdev_spec str_to_subdev(std::string spec_str); - -class usrp_siggen; -typedef boost::shared_ptr<usrp_siggen> usrp_siggen_sptr; -usrp_siggen_sptr make_usrp_siggen(int which, usrp_subdev_spec spec, - double rf_freq, int interp, double wfreq, - int waveform, float amp, float gain, - float offset, long long nsamples); - -class usrp_siggen : public gr_top_block -{ -private: - usrp_siggen(int which, usrp_subdev_spec spec, - double rf_freq, int interp, double wfreq, - int waveform, float amp, float gain, - float offset, long long nsamples); - friend usrp_siggen_sptr make_usrp_siggen(int which, usrp_subdev_spec spec, - double rf_freq, int interp, double wfreq, - int waveform, float amp, float gain, - float offset, - long long nsamples); - - public: - gr_block_sptr source; - gr_sig_source_c_sptr siggen; - gr_noise_source_c_sptr noisegen; -}; diff --git a/gr-usrp/apps/usrp_test_counting.py b/gr-usrp/apps/usrp_test_counting.py deleted file mode 100755 index a8300afe2..000000000 --- a/gr-usrp/apps/usrp_test_counting.py +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2007 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -""" -Check Rx path or USRP Rev 1. - -This configures the USRP to return a periodic sequence of integers -""" - -from gnuradio import gr -from gnuradio import usrp - -def build_graph (): - rx_decim = 32 - - tb = gr.top_block () - usrp_rx = usrp.source_s (0, rx_decim, 1, 0x32103210, usrp.FPGA_MODE_COUNTING) - sink = gr.check_counting_s () - tb.connect (usrp_rx, sink) - - # file_sink = gr.file_sink (gr.sizeof_short, 'counting.dat') - # tb.connect (usrp_rx, file_sink) - - return tb - -def main (): - tb = build_graph () - try: - tb.run() - except KeyboardInterrupt: - pass - -if __name__ == '__main__': - main () diff --git a/gr-usrp/apps/usrp_test_loopback.py b/gr-usrp/apps/usrp_test_loopback.py deleted file mode 100755 index b58ac06ae..000000000 --- a/gr-usrp/apps/usrp_test_loopback.py +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2007 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -""" -Digital loopback (Tx to Rx) for the USRP Rev1. -""" - - -from gnuradio import gr -from gnuradio import usrp - - -def ramp_source (tb): - period = 2**16 - src = gr.vector_source_s (range (-period/2, period/2, 1), True) - return src - -def build_graph (): - tx_interp = 32 # tx should be twice rx - rx_decim = 16 - - tb = gr.top_block () - - data_src = ramp_source (tb) - # usrp_tx = usrp.sink_s (0, tx_interp, 1, 0x98) - usrp_tx = usrp.sink_s (0, tx_interp) - tb.connect (data_src, usrp_tx) - - usrp_rx = usrp.source_s (0, rx_decim, 1, 0x32103210, usrp.FPGA_MODE_LOOPBACK) - sink = gr.check_counting_s () - tb.connect (usrp_rx, sink) - - # file_sink = gr.file_sink (gr.sizeof_short, "loopback.dat") - # tb.connect (usrp_rx, file_sink) - - return tb - -def main (): - tb = build_graph () - try: - tb.run() - except KeyboardInterrupt: - pass - -if __name__ == '__main__': - main () diff --git a/gr-usrp/gnuradio-usrp.pc.in b/gr-usrp/gnuradio-usrp.pc.in deleted file mode 100644 index b1f33f41b..000000000 --- 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 b336cc7ce..000000000 --- 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 11a5f40dc..000000000 --- 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 1956bbd5b..000000000 --- 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 65c1e7e29..000000000 --- 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 66b76b2df..000000000 --- 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 136321994..000000000 --- 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 fb7a39570..000000000 --- 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 babc124d0..000000000 --- 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 4e1fa81d8..000000000 --- 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 d2e92e753..000000000 --- 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 ee207c28d..000000000 --- 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 e52b5f047..000000000 --- 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 a79c78c20..000000000 --- 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 96caf587f..000000000 --- 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 29cedc96a..000000000 --- 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 00ecfcb54..000000000 --- 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 c81b2f2b0..000000000 --- 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 ff32900a5..000000000 --- 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 0c4d489ab..000000000 --- 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 e01c9454a..000000000 --- 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 06e630330..000000000 --- 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 5d08b0dd5..000000000 --- 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 c03f96e0b..000000000 --- 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 6b2a0c259..000000000 --- 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 740fe3055..000000000 --- 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 1d632a567..000000000 --- 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 7947723fb..000000000 --- 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 0fd62911f..000000000 --- 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 c04d73124..000000000 --- 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 635d9345f..000000000 --- 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 8d573af1b..000000000 --- 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 17fca441d..000000000 --- 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 7054158d8..000000000 --- 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 59ebace38..000000000 --- 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 15480883e..000000000 --- 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 1ffaeed96..000000000 --- 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 f23b86125..000000000 --- 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 9993d5214..000000000 --- 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 5a5e20f3e..000000000 --- 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 4def48e24..000000000 --- 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 aed751de9..000000000 --- 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 9055f3ee7..000000000 --- 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 3fb04d657..000000000 --- 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 499f7f740..000000000 --- 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 8e1c2f188..000000000 --- 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 9118b4e0f..000000000 --- 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 d8b285c99..000000000 --- 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 61053bb3b..000000000 --- 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 80d59abc9..000000000 --- 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 diff --git a/gr-usrp2/.gitignore b/gr-usrp2/.gitignore deleted file mode 100644 index a43ae9c69..000000000 --- a/gr-usrp2/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/Makefile -/Makefile.in -/gnuradio-usrp2.pc diff --git a/gr-usrp2/Makefile.am b/gr-usrp2/Makefile.am deleted file mode 100644 index 895032fb0..000000000 --- a/gr-usrp2/Makefile.am +++ /dev/null @@ -1,31 +0,0 @@ -# -# Copyright 2001,2006,2008,2009,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 - -SUBDIRS = src apps - -if PYTHON -SUBDIRS += grc -endif - -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = gnuradio-usrp2.pc diff --git a/gr-usrp2/apps/.gitignore b/gr-usrp2/apps/.gitignore deleted file mode 100644 index b336cc7ce..000000000 --- a/gr-usrp2/apps/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/Makefile -/Makefile.in diff --git a/gr-usrp2/apps/Makefile.am b/gr-usrp2/apps/Makefile.am deleted file mode 100644 index e1cec4cfc..000000000 --- a/gr-usrp2/apps/Makefile.am +++ /dev/null @@ -1,32 +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 - -EXTRA_DIST += \ - $(bin_SCRIPTS) - -if PYTHON - -bin_SCRIPTS = \ - usrp2_rx_cfile.py - -endif diff --git a/gr-usrp2/apps/usrp2_rx_cfile.py b/gr-usrp2/apps/usrp2_rx_cfile.py deleted file mode 100755 index 1f23eee4e..000000000 --- a/gr-usrp2/apps/usrp2_rx_cfile.py +++ /dev/null @@ -1,144 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2005,2007,2008,2009 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -""" -Read samples from the USRP2 and write to file formatted as binary -outputs single precision complex float values or complex short values -(interleaved 16 bit signed short integers). -""" - -from gnuradio import gr, eng_notation -from gnuradio import usrp2 -from gnuradio.eng_option import eng_option -from optparse import OptionParser -import sys - -n2s = eng_notation.num_to_str - -class rx_cfile_block(gr.top_block): - - def __init__(self, options, filename): - gr.top_block.__init__(self) - - # Create a USRP2 source - if options.output_shorts: - self._u = usrp2.source_16sc(options.interface, options.mac_addr) - self._sink = gr.file_sink(gr.sizeof_short*2, filename) - else: - self._u = usrp2.source_32fc(options.interface, options.mac_addr) - self._sink = gr.file_sink(gr.sizeof_gr_complex, filename) - - # Set receiver decimation rate - self._u.set_decim(options.decim) - - # Set receive daughterboard gain - if options.gain is None: - g = self._u.gain_range() - options.gain = float(g[0]+g[1])/2 - print "Using mid-point gain of", options.gain, "(", g[0], "-", g[1], ")" - self._u.set_gain(options.gain) - - # Set receive frequency - if options.lo_offset is not None: - self._u.set_lo_offset(options.lo_offset) - - tr = self._u.set_center_freq(options.freq) - if tr == None: - sys.stderr.write('Failed to set center frequency\n') - raise SystemExit, 1 - - # Create head block if needed and wire it up - if options.nsamples is None: - self.connect(self._u, self._sink) - else: - if options.output_shorts: - self._head = gr.head(gr.sizeof_short*2, int(options.nsamples)) - else: - self._head = gr.head(gr.sizeof_gr_complex, int(options.nsamples)) - - self.connect(self._u, self._head, self._sink) - - input_rate = self._u.adc_rate()/self._u.decim() - - if options.verbose: - print "Network interface:", options.interface - print "USRP2 address:", self._u.mac_addr() - print "Using RX d'board id 0x%04X" % (self._u.daughterboard_id(),) - print "Rx gain:", options.gain - print "Rx baseband frequency:", n2s(tr.baseband_freq) - print "Rx DDC frequency:", n2s(tr.dxc_freq) - print "Rx residual frequency:", n2s(tr.residual_freq) - print "Rx decimation rate:", options.decim - print "Rx sample rate:", n2s(input_rate) - if options.nsamples is None: - print "Receiving samples until Ctrl-C" - else: - print "Receving", n2s(options.nsamples), "samples" - if options.output_shorts: - print "Writing 16-bit complex shorts" - else: - print "Writing 32-bit complex floats" - print "Output filename:", filename - -def get_options(): - usage="%prog: [options] output_filename" - parser = OptionParser(option_class=eng_option, usage=usage) - parser.add_option("-e", "--interface", type="string", default="eth0", - help="use specified Ethernet interface [default=%default]") - parser.add_option("-m", "--mac-addr", type="string", default="", - help="use USRP2 at specified MAC address [default=None]") - parser.add_option("-d", "--decim", type="int", default=16, - help="set fgpa decimation rate to DECIM [default=%default]") - parser.add_option("-f", "--freq", type="eng_float", default=None, - help="set frequency to FREQ", metavar="FREQ") - parser.add_option("-g", "--gain", type="eng_float", default=None, - help="set gain in dB (default is midpoint)") - parser.add_option( "-s","--output-shorts", action="store_true", default=False, - help="output interleaved shorts instead of complex floats") - parser.add_option("-N", "--nsamples", type="eng_float", default=None, - help="number of samples to collect [default=+inf]") - parser.add_option("-v", "--verbose", action="store_true", default=False, - help="verbose output") - parser.add_option("", "--lo-offset", type="eng_float", default=None, - help="set daughterboard LO offset to OFFSET [default=hw default]") - - (options, args) = parser.parse_args () - if len(args) != 1: - parser.print_help() - raise SystemExit, 1 - - if options.freq is None: - parser.print_help() - sys.stderr.write('You must specify the frequency with -f FREQ\n'); - raise SystemExit, 1 - - return (options, args[0]) - - -if __name__ == '__main__': - (options, filename) = get_options() - tb = rx_cfile_block(options, filename) - - try: - tb.run() - except KeyboardInterrupt: - pass diff --git a/gr-usrp2/gnuradio-usrp2.pc.in b/gr-usrp2/gnuradio-usrp2.pc.in deleted file mode 100644 index 2222badd7..000000000 --- a/gr-usrp2/gnuradio-usrp2.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@/gnuradio - -Name: gnuradio-usrp2 -Description: GNU Software Radio support for Universal Software Radio Peripheral 2 -Requires: gnuradio-core usrp2 -Version: @LIBVER@ -Libs: -L${libdir} -lgnuradio-usrp2 -Cflags: -I${includedir} diff --git a/gr-usrp2/grc/.gitignore b/gr-usrp2/grc/.gitignore deleted file mode 100644 index b336cc7ce..000000000 --- a/gr-usrp2/grc/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/Makefile -/Makefile.in diff --git a/gr-usrp2/grc/Makefile.am b/gr-usrp2/grc/Makefile.am deleted file mode 100644 index 2502bf363..000000000 --- a/gr-usrp2/grc/Makefile.am +++ /dev/null @@ -1,33 +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 - -dist_bin_SCRIPTS = usrp2_probe - -grcblocksdir = $(grc_blocksdir) -dist_grcblocks_DATA = \ - usrp2_probe.xml \ - usrp2_source_xxxx.xml \ - usrp2_sink_xxxx.xml - -ourdatadir = $(pkgdatadir)/grc/freedesktop -dist_ourdata_DATA = gnuradio-usrp2_probe.desktop diff --git a/gr-usrp2/grc/gnuradio-usrp2_probe.desktop b/gr-usrp2/grc/gnuradio-usrp2_probe.desktop deleted file mode 100644 index c71a092b1..000000000 --- a/gr-usrp2/grc/gnuradio-usrp2_probe.desktop +++ /dev/null @@ -1,7 +0,0 @@ -[Desktop Entry] -Version=1.0 -Type=Application -Name=USRP2 Probe -Exec=usrp2_probe -Categories=Development; -Icon=gnuradio-grc diff --git a/gr-usrp2/grc/usrp2_probe b/gr-usrp2/grc/usrp2_probe deleted file mode 100755 index 38c8f655c..000000000 --- a/gr-usrp2/grc/usrp2_probe +++ /dev/null @@ -1,163 +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 usrp2 -import subprocess -import os - -import pygtk -pygtk.require('2.0') -import gtk -import gobject - -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('usrp2_probe') - -##all params -usrp_interface_param = block.get_param('interface') -usrp_type_param = block.get_param('type') - -def get_input(param): - param.validate() - input = param.get_input() - return input - -class USRP2ProbeWindow(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): - """ - USRP2ProbeWindow contructor. - Create a new gtk Dialog with a close button, USRP2 input paramaters, and output labels. - """ - self.usrp2_macs = list() - 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('USRP2 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_interface_param), False) - vbox.pack_start(get_input(usrp_type_param), False) - #make the tree model for holding mac addrs - self.treestore = gtk.TreeStore(gobject.TYPE_STRING) - self.treeview = gtk.TreeView(self.treestore) - self.treeview.set_enable_search(False) #disable pop up search box - self.treeview.add_events(gtk.gdk.BUTTON_PRESS_MASK) - self.treeview.connect('button_press_event', self._handle_selection) - selection = self.treeview.get_selection() - selection.set_mode('single') - selection.connect('changed', self._handle_selection) - renderer = gtk.CellRendererText() - column = gtk.TreeViewColumn('Select a USRP2 MAC Address', renderer, text=0) - self.treeview.append_column(column) - vbox.pack_start(self.treeview, False) - #create probe button - self.probe_button = gtk.Button('Probe') - self.probe_button.connect('clicked', self._probe_usrp2) - 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() - self.treeview.hide() - - def _probe_usrp2(self, widget=None): - """Probe the USRP2 device and copy the results into the query text box.""" - #call find usrps - args = ['find_usrps'] - interface = usrp_interface_param.evaluate() - if interface: args.extend(['-e', interface]) - p = subprocess.Popen(args=args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=False, universal_newlines=True) - msg = p.stdout.read() - #extract mac addrs - self.usrp2_macs = sorted(map(lambda l: l.split()[0], filter(lambda l: l.count(':') >= 5, msg.strip().splitlines()))) - #set the tree store with the mac addrs - self.treestore.clear() - for usrp2_mac in self.usrp2_macs: self.treestore.append(None, (usrp2_mac,)) - #set the text with the error message for 0 found, hide the list - #when only 1 usrp2, auto handle selection, hide the list - #for multiple usrp2, show the list - if not self.usrp2_macs: - self.treeview.hide() - self.query_buffer.set_text(msg) - elif len(self.usrp2_macs) == 1: - self.treeview.hide() - self.query_buffer.set_text('') - self._handle_selection() - else: - self.treeview.show() - self.query_buffer.set_text('') - - def _handle_selection(self, *args, **kwargs): - """A selection change or click occured.""" - #get the mac addr - selection = self.treeview.get_selection() - treestore, iter = selection.get_selected() - mac_addr = iter and treestore.get_value(iter, 0) or '' - if not mac_addr and len(self.usrp2_macs) > 1: - return #no empty mac addrs for when multiple found - #make the usrp2 object - make, rate_attr = { - 'rx': (usrp2.source_32fc, 'adc_rate'), - 'tx': (usrp2.sink_32fc, 'dac_rate'), - }[usrp_type_param.evaluate()] - interface = usrp_interface_param.evaluate() - try: - if not interface and not mac_addr: u = make() - elif not mac_addr: u = make(interface) - else: u = make(interface, mac_addr) - msg = ">>> USRP2 Probe\n" - msg = "%s\nMAC Addr:\n\t%s\n"%(msg, u.mac_addr()) - msg = "%s\nName (ID):\n\t%s\n"%(msg, u.daughterboard_id()) - msg = "%s\nConverter Rate:\n\t%s Hz\n"%(msg, getattr(u, rate_attr)()) - gain_min, gain_max, gain_step = u.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 = u.freq_range() - msg = "%s\nFreq Range (min, max):\n\t%s Hz\n\t%s Hz\n"%(msg, freq_min, freq_max) - self.query_buffer.set_text(msg) - except Exception, e: #display the error message - self.query_buffer.set_text('>>> Error\n%s'%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 - USRP2ProbeWindow() - gtk.main() diff --git a/gr-usrp2/grc/usrp2_probe.xml b/gr-usrp2/grc/usrp2_probe.xml deleted file mode 100644 index cc3f9c2fd..000000000 --- a/gr-usrp2/grc/usrp2_probe.xml +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##USRP2 Probe: -## This block should not appear in the tree. -################################################### - --> -<block> - <name>USRP2 Probe</name> - <key>usrp2_probe</key> - <make></make> - <param> - <name>Interface</name> - <key>interface</key> - <value></value> - <type>string</type> - </param> - <param> - <name>Type</name> - <key>type</key> - <value>rx</value> - <type>enum</type> - <option> - <name>RX</name> - <key>rx</key> - </option> - <option> - <name>TX</name> - <key>tx</key> - </option> - </param> - <doc>Press "Probe" to retrieve USRP2 information...</doc> -</block> diff --git a/gr-usrp2/grc/usrp2_sink_xxxx.xml b/gr-usrp2/grc/usrp2_sink_xxxx.xml deleted file mode 100644 index 74995da99..000000000 --- a/gr-usrp2/grc/usrp2_sink_xxxx.xml +++ /dev/null @@ -1,121 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##USRP2 Sink -## Note: the center freq must be set after the lo offset -################################################### - --> -<block> - <name>USRP2 Sink</name> - <key>usrp2_sink_xxxx</key> - <category>USRP</category> - <import>from gnuradio import usrp2</import> - <make>#if not $interface() and not $mac_addr() -usrp2.sink_$(type.fcn)() -#elif not $mac_addr() -usrp2.sink_$(type.fcn)($interface) -#else -usrp2.sink_$(type.fcn)($interface, $mac_addr) -#end if -self.$(id).set_interp($interpolation) -#if $lo_offset() != float('inf') -self.$(id).set_lo_offset($lo_offset) -#end if -self.$(id).set_center_freq($frequency) -self.$(id).set_gain($gain) -self.$(id).config_mimo($usrp2_clock_src)</make> - <callback>set_interp($interpolation)</callback> - <callback>#if $lo_offset() != float('inf') -self.$(id).set_lo_offset($lo_offset) -#end if -self.$(id).set_center_freq($frequency)</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:32fc</opt> - <opt>vlen:1</opt> - </option> - <option> - <name>Short</name> - <key>short</key> - <opt>fcn:16sc</opt> - <opt>vlen:2</opt> - </option> - </param> - <param> - <name>Interface</name> - <key>interface</key> - <value></value> - <type>string</type> - </param> - <param> - <name>MAC Addr</name> - <key>mac_addr</key> - <value></value> - <type>string</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>Clock Source</name> - <key>usrp2_clock_src</key> - <value>usrp2.MC_WE_DONT_LOCK</value> - <type>enum</type> - <option> - <name>Internal</name> - <key>usrp2.MC_WE_DONT_LOCK</key> - </option> - <option> - <name>External SMA</name> - <key>usrp2.MC_WE_LOCK_TO_SMA</key> - </option> - <option> - <name>External MIMO</name> - <key>usrp2.MC_WE_LOCK_TO_MIMO</key> - </option> - </param> - <sink> - <name>in</name> - <type>$type</type> - <vlen>$type.vlen</vlen> - </sink> - <doc> -The USRP2 sink inputs 100 Megasamples per second / interpolation. - -Input amplitude should be between 0.0 and 1.0. - -To use the default ethernet device, leave interface blank. \ -For systems with only 1 USRP2, you may leave the mac address blank. \ -For multi-USRP2 systems, specify the mac address in the form 00:50:C2:85:3x:xx. - </doc> -</block> diff --git a/gr-usrp2/grc/usrp2_source_xxxx.xml b/gr-usrp2/grc/usrp2_source_xxxx.xml deleted file mode 100644 index a23c5bc5c..000000000 --- a/gr-usrp2/grc/usrp2_source_xxxx.xml +++ /dev/null @@ -1,119 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##USRP2 Source -## Note: the center freq must be set after the lo offset -################################################### - --> -<block> - <name>USRP2 Source</name> - <key>usrp2_source_xxxx</key> - <category>USRP</category> - <import>from gnuradio import usrp2</import> - <make>#if not $interface() and not $mac_addr() -usrp2.source_$(type.fcn)() -#elif not $mac_addr() -usrp2.source_$(type.fcn)($interface) -#else -usrp2.source_$(type.fcn)($interface, $mac_addr) -#end if -self.$(id).set_decim($decimation) -#if $lo_offset() != float('inf') -self.$(id).set_lo_offset($lo_offset) -#end if -self.$(id).set_center_freq($frequency) -self.$(id).set_gain($gain) -self.$(id).config_mimo($usrp2_clock_src)</make> - <callback>set_decim($decimation)</callback> - <callback>#if $lo_offset() != float('inf') -self.$(id).set_lo_offset($lo_offset) -#end if -self.$(id).set_center_freq($frequency)</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:32fc</opt> - <opt>vlen:1</opt> - </option> - <option> - <name>Short</name> - <key>short</key> - <opt>fcn:16sc</opt> - <opt>vlen:2</opt> - </option> - </param> - <param> - <name>Interface</name> - <key>interface</key> - <value></value> - <type>string</type> - </param> - <param> - <name>MAC Addr</name> - <key>mac_addr</key> - <value></value> - <type>string</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>Clock Source</name> - <key>usrp2_clock_src</key> - <value>usrp2.MC_WE_DONT_LOCK</value> - <type>enum</type> - <option> - <name>Internal</name> - <key>usrp2.MC_WE_DONT_LOCK</key> - </option> - <option> - <name>External SMA</name> - <key>usrp2.MC_WE_LOCK_TO_SMA</key> - </option> - <option> - <name>External MIMO</name> - <key>usrp2.MC_WE_LOCK_TO_MIMO</key> - </option> - </param> - <source> - <name>out</name> - <type>$type</type> - <vlen>$type.vlen</vlen> - </source> - <doc> -The USRP2 source outputs 100 Megasamples per second / decimation. - -To use the default ethernet device, leave interface blank. \ -For systems with only 1 USRP2, you may leave the mac address blank. \ -For multi-USRP2 systems, specify the mac address in the form 00:50:C2:85:3x:xx. - </doc> -</block> diff --git a/gr-usrp2/src/.gitignore b/gr-usrp2/src/.gitignore deleted file mode 100644 index 71f825820..000000000 --- a/gr-usrp2/src/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -/Makefile -/Makefile.in -/.libs -/.deps -/usrp2.py -/usrp2.cc -/usrp2_python.cc -/run_tests -/test_gr_usrp2 -/*.pyc -/guile -/python -/usrp2_swig.py -/run_guile_tests diff --git a/gr-usrp2/src/Makefile.am b/gr-usrp2/src/Makefile.am deleted file mode 100644 index a84637f73..000000000 --- a/gr-usrp2/src/Makefile.am +++ /dev/null @@ -1,115 +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_usrp2.py -noinst_GUILE = usrp2.test - -if GUILE -nobase_guile_DATA = gnuradio/usrp2.scm -endif - -# ---------------------------------------------------------------------- -# C++ block API interface librar(ies) -# -# libgr-usrp.so -# ---------------------------------------------------------------------- -AM_CPPFLAGS = \ - $(GRUEL_INCLUDES) \ - $(USRP2_INCLUDES) \ - $(STD_DEFINES_AND_INCLUDES) \ - $(PYTHON_CPPFLAGS) \ - $(WITH_INCLUDES) - -lib_LTLIBRARIES = libgnuradio-usrp2.la - -libgnuradio_usrp2_la_LDFLAGS = $(LTVERSIONFLAGS) - -libgnuradio_usrp2_la_SOURCES = \ - rx_16sc_handler.cc \ - rx_32fc_handler.cc \ - usrp2_base.cc \ - usrp2_source_base.cc \ - usrp2_source_16sc.cc \ - usrp2_source_32fc.cc \ - usrp2_sink_base.cc \ - usrp2_sink_16sc.cc \ - usrp2_sink_32fc.cc - -libgnuradio_usrp2_la_LIBADD = \ - $(USRP2_LA) \ - $(GNURADIO_CORE_LA) - -grinclude_HEADERS = \ - usrp2_base.h \ - usrp2_source_base.h \ - usrp2_source_32fc.h \ - usrp2_source_16sc.h \ - usrp2_sink_base.h \ - usrp2_sink_16sc.h \ - usrp2_sink_32fc.h - -noinst_HEADERS = \ - rx_16sc_handler.h \ - rx_32fc_handler.h - -# ---------------------------------------------------------------------- -# SWIG wrappers around C++ library -# -# usrp2.py -# _usrp2.so -# ---------------------------------------------------------------------- - -TOP_SWIG_IFILES = \ - usrp2_swig.i - -# Install so that they end up available as: -# import gnuradio.usrp2 -# This ends up at: -# ${prefix}/lib/python${python_version}/site-packages/gnuradio/usrp2 -usrp2_swig_pythondir_category = \ - gnuradio/usrp2 - -# additional arguments to the SWIG command -usrp2_swig_swig_args = \ - $(USRP2_INCLUDES) - -# additional libraries for linking with the SWIG-generated library -usrp2_swig_la_swig_libadd = \ - libgnuradio-usrp2.la - -# additional Python files to be installed along with the SWIG-generated one -usrp2_swig_python = \ - __init__.py - -if PYTHON -TESTS += run_tests -endif - -if GUILE -TESTS += run_guile_tests -endif diff --git a/gr-usrp2/src/Makefile.swig.gen b/gr-usrp2/src/Makefile.swig.gen deleted file mode 100644 index 78cb4e5c6..000000000 --- a/gr-usrp2/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 usrp2_swig.i - -## Default install locations for these files: -## -## Default location for the Python directory is: -## ${prefix}/lib/python${python_version}/site-packages/[category]/usrp2_swig -## Default location for the Python exec directory is: -## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/usrp2_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. - -usrp2_swig_pythondir_category ?= gnuradio/usrp2_swig -usrp2_swig_pylibdir_category ?= $(usrp2_swig_pythondir_category) -usrp2_swig_pythondir = $(pythondir)/$(usrp2_swig_pythondir_category) -usrp2_swig_pylibdir = $(pyexecdir)/$(usrp2_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. -usrp2_swig_scmlibdir = $(libdir) - -# The scm files for the guile modules get installed where ever guile -# is installed, usually /usr/share/guile/site/usrp2_swig -# FIXME: determince whether these should be installed with gnuradio. -usrp2_swig_scmdir = $(guiledir) - -## SWIG headers are always installed into the same directory. - -usrp2_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 . - -usrp2_swig_swiginclude_HEADERS = \ - usrp2_swig.i \ - $(usrp2_swig_swiginclude_headers) - -if PYTHON -usrp2_swig_pylib_LTLIBRARIES = \ - _usrp2_swig.la - -_usrp2_swig_la_SOURCES = \ - python/usrp2_swig.cc \ - $(usrp2_swig_la_swig_sources) - -usrp2_swig_python_PYTHON = \ - usrp2_swig.py \ - $(usrp2_swig_python) - -_usrp2_swig_la_LIBADD = \ - $(STD_SWIG_LA_LIB_ADD) \ - $(usrp2_swig_la_swig_libadd) - -_usrp2_swig_la_LDFLAGS = \ - $(STD_SWIG_LA_LD_FLAGS) \ - $(usrp2_swig_la_swig_ldflags) - -_usrp2_swig_la_CXXFLAGS = \ - $(STD_SWIG_CXX_FLAGS) \ - -I$(top_builddir) \ - $(usrp2_swig_la_swig_cxxflags) - -python/usrp2_swig.cc: usrp2_swig.py -usrp2_swig.py: usrp2_swig.i - -# Include the python dependencies for this file --include python/usrp2_swig.d - -endif # end of if python - -if GUILE - -usrp2_swig_scmlib_LTLIBRARIES = \ - libguile-gnuradio-usrp2_swig.la -libguile_gnuradio_usrp2_swig_la_SOURCES = \ - guile/usrp2_swig.cc \ - $(usrp2_swig_la_swig_sources) -nobase_usrp2_swig_scm_DATA = \ - gnuradio/usrp2_swig.scm \ - gnuradio/usrp2_swig-primitive.scm -libguile_gnuradio_usrp2_swig_la_LIBADD = \ - $(STD_SWIG_LA_LIB_ADD) \ - $(usrp2_swig_la_swig_libadd) -libguile_gnuradio_usrp2_swig_la_LDFLAGS = \ - $(STD_SWIG_LA_LD_FLAGS) \ - $(usrp2_swig_la_swig_ldflags) -libguile_gnuradio_usrp2_swig_la_CXXFLAGS = \ - $(STD_SWIG_CXX_FLAGS) \ - -I$(top_builddir) \ - $(usrp2_swig_la_swig_cxxflags) - -guile/usrp2_swig.cc: gnuradio/usrp2_swig.scm -gnuradio/usrp2_swig.scm: usrp2_swig.i -gnuradio/usrp2_swig-primitive.scm: gnuradio/usrp2_swig.scm - -# Include the guile dependencies for this file --include guile/usrp2_swig.d - -endif # end of GUILE - - diff --git a/gr-usrp2/src/__init__.py b/gr-usrp2/src/__init__.py deleted file mode 100644 index fd4289af5..000000000 --- a/gr-usrp2/src/__init__.py +++ /dev/null @@ -1,28 +0,0 @@ -# -# Copyright 2008,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. -# - -# The presence of this file turns this directory into a Python package - -# Add SWIG generated code to this namespace -from usrp2_swig import * - -# Add other content from pure-Python modules here - diff --git a/gr-usrp2/src/gnuradio/.gitignore b/gr-usrp2/src/gnuradio/.gitignore deleted file mode 100644 index 3c1ff87f5..000000000 --- a/gr-usrp2/src/gnuradio/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -usrp2_swig.scm -usrp2_swig-primitive.scm diff --git a/gr-usrp2/src/gnuradio/usrp2.scm b/gr-usrp2/src/gnuradio/usrp2.scm deleted file mode 100644 index 7ead5015d..000000000 --- a/gr-usrp2/src/gnuradio/usrp2.scm +++ /dev/null @@ -1,79 +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/>. -;;; - -;;; Module that re-exports the usrp2_swig module and adds convenience functions - -(define-module (gnuradio usrp2) - #:use-module (oop goops) - #:use-module (gnuradio export-safely) - #:use-module (gnuradio usrp2_swig) - #:duplicates (merge-generics replace check)) - -(re-export-all '(gnuradio usrp2_swig)) - -;; Utilities (guaranteed not to leak the allocated object) -(define (call-with-long-ptr fn) - (let ((ptr #f)) - (dynamic-wind - (lambda () (set! ptr (gr:make-long-ptr))) - (lambda () (and (fn ptr) (gr:deref-long-ptr ptr))) - (lambda () (gr:free-long-ptr ptr))))) - -(define (call-with-int-ptr fn) - (let ((ptr #f)) - (dynamic-wind - (lambda () (set! ptr (gr:make-int-ptr))) - (lambda () (and (fn ptr) (gr:deref-int-ptr ptr))) - (lambda () (gr:free-int-ptr ptr))))) - -(define (call-with-uint16-ptr fn) - (let ((ptr #f)) - (dynamic-wind - (lambda () (set! ptr (gr:make-uint16-ptr))) - (lambda () (and (fn ptr) (gr:deref-uint16-ptr ptr))) - (lambda () (gr:free-uint16-ptr ptr))))) - - -;;; scheme-ish convenience functions - -(define-method (gr:set-center-freq self freq) - (let ((tr (make <tune-result>))) - (if (gr:-real-set-center-freq self freq tr) - tr - #f))) - -(define-method (gr:fpga-master-clock-freq self) - (call-with-long-ptr (lambda (ptr) (gr:-real-fpga-master-clock-freq self ptr)))) - -(define-method (gr:adc-rate self) - (call-with-long-ptr (lambda (ptr) (gr:-real-adc-rate self ptr)))) - -(define-method (gr:dac-rate self) - (call-with-long-ptr (lambda (ptr) (gr:-real-dac-rate self ptr)))) - -(define-method (gr:daughterboard-id self) - (call-with-int-ptr (lambda (ptr) (gr:-real-daugherboard-id self ptr)))) - -;; (define-method (gr:default-tx-scale-iq self) ...) FIXME - -(define-method (gr:read-gpio self) - (call-with-uint16-ptr (lambda (ptr) (gr:-real-read-gpio self ptr)))) - -;; Export them -(export-safely gr:set-center-freq gr:fpga-master-clock-freq gr:adc-rate gr:dac-rate gr:daughterboard-id gr:read-gpio) diff --git a/gr-usrp2/src/qa_usrp2.py b/gr-usrp2/src/qa_usrp2.py deleted file mode 100755 index 33e44aeed..000000000 --- a/gr-usrp2/src/qa_usrp2.py +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005,2008,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 usrp2_swig - -class test_usrp2(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 USRP2 connected, etc. Don't try to run anything""" - pass - -if __name__ == '__main__': - gr_unittest.run(test_usrp2, "test_usrp2.xml") diff --git a/gr-usrp2/src/run_guile_tests.in b/gr-usrp2/src/run_guile_tests.in deleted file mode 100644 index 5d08b0dd5..000000000 --- a/gr-usrp2/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-usrp2/src/run_tests.in b/gr-usrp2/src/run_tests.in deleted file mode 100644 index 3f068256e..000000000 --- a/gr-usrp2/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@/usrp2/host/lib:@abs_top_builddir@/usrp2/host/lib/.libs:$DYLD_LIBRARY_PATH -export DYLD_LIBRARY_PATH - -# For Win32 -PATH=@abs_top_builddir@/usrp2/host/lib:@abs_top_builddir@/usrp2/host/lib/.libs:$PATH - -@top_builddir@/run_tests.sh \ - @abs_top_srcdir@/gr-usrp2 \ - @abs_top_builddir@/gr-usrp2 \ - @srcdir@ diff --git a/gr-usrp2/src/rx_16sc_handler.cc b/gr-usrp2/src/rx_16sc_handler.cc deleted file mode 100644 index 7fb9ad06f..000000000 --- a/gr-usrp2/src/rx_16sc_handler.cc +++ /dev/null @@ -1,32 +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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <rx_16sc_handler.h> - -rx_16sc_handler::~rx_16sc_handler() -{ - // NOP -} diff --git a/gr-usrp2/src/rx_16sc_handler.h b/gr-usrp2/src/rx_16sc_handler.h deleted file mode 100644 index 9d5b1f2e9..000000000 --- a/gr-usrp2/src/rx_16sc_handler.h +++ /dev/null @@ -1,63 +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. - */ - -#ifndef INCLUDED_RX_16SC_HANDLER_H -#define INCLUDED_RX_16SC_HANDLER_H - -#include <usrp2/rx_nop_handler.h> -#include <usrp2/copiers.h> - -class rx_16sc_handler : public usrp2::rx_nop_handler -{ - std::complex<int16_t> *d_dest; - - // Private constructor - rx_16sc_handler(uint64_t max_samples, uint64_t max_quantum, std::complex<int16_t> *dest) - : rx_nop_handler(max_samples, max_quantum), d_dest(dest) {} - -public: - // Shared pointer to one of these - typedef boost::shared_ptr<rx_16sc_handler> sptr; - - // Factory function to return a shared pointer to a new instance - static sptr make(uint64_t max_samples, uint64_t max_quantum, std::complex<int16_t> *dest) - { - return sptr(new rx_16sc_handler(max_samples, max_quantum, dest)); - } - - // Invoked by USRP2 API when samples are available - bool operator()(const uint32_t *items, size_t nitems, const usrp2::rx_metadata *metadata) - { - // Copy/reformat/endian swap USRP2 data to destination buffer - usrp2::copy_u2_16sc_to_host_16sc(nitems, items, d_dest); - d_dest += nitems; - - // FIXME: do something with metadata - - // Call parent to determine if there is room to be called again - return rx_nop_handler::operator()(items, nitems, metadata); - } - - ~rx_16sc_handler(); -}; - -#endif /* INCLUDED_RX_16SC_HANDLER_H */ diff --git a/gr-usrp2/src/rx_32fc_handler.cc b/gr-usrp2/src/rx_32fc_handler.cc deleted file mode 100644 index c9c251558..000000000 --- a/gr-usrp2/src/rx_32fc_handler.cc +++ /dev/null @@ -1,32 +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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <rx_32fc_handler.h> - -rx_32fc_handler::~rx_32fc_handler() -{ - // NOP -} diff --git a/gr-usrp2/src/rx_32fc_handler.h b/gr-usrp2/src/rx_32fc_handler.h deleted file mode 100644 index f2ce2b55d..000000000 --- a/gr-usrp2/src/rx_32fc_handler.h +++ /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. - */ - -#ifndef INCLUDED_RX_32FC_HANDLER_H -#define INCLUDED_RX_32FC_HANDLER_H - -#include <usrp2/rx_nop_handler.h> -#include <usrp2/copiers.h> -#include <gr_complex.h> - -class rx_32fc_handler : public usrp2::rx_nop_handler -{ - gr_complex *d_dest; - - // Private constructor - rx_32fc_handler(uint64_t max_samples, uint64_t max_quantum, gr_complex *dest) - : rx_nop_handler(max_samples, max_quantum), d_dest(dest) {} - -public: - // Shared pointer to one of these - typedef boost::shared_ptr<rx_32fc_handler> sptr; - - // Factory function to return a shared pointer to a new instance - static sptr make(uint64_t max_samples, uint64_t max_quantum, gr_complex *dest) - { - return sptr(new rx_32fc_handler(max_samples, max_quantum, dest)); - } - - // Invoked by USRP2 API when samples are available - bool operator()(const uint32_t *items, size_t nitems, const usrp2::rx_metadata *metadata) - { - // Copy/reformat/endian swap USRP2 data to destination buffer - usrp2::copy_u2_16sc_to_host_32fc(nitems, items, d_dest); - d_dest += nitems; - - // FIXME: do something with metadata - - // Call parent to determine if there is room to be called again - return rx_nop_handler::operator()(items, nitems, metadata); - } - - ~rx_32fc_handler(); -}; - -#endif /* INCLUDED_RX_32FC_HANDLER_H */ diff --git a/gr-usrp2/src/usrp2.test b/gr-usrp2/src/usrp2.test deleted file mode 100644 index 69544c5e6..000000000 --- a/gr-usrp2/src/usrp2.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 USRP2 attached, powered up etc. - -(use-modules (gnuradio usrp2)) diff --git a/gr-usrp2/src/usrp2_base.cc b/gr-usrp2/src/usrp2_base.cc deleted file mode 100644 index bb9959725..000000000 --- a/gr-usrp2/src/usrp2_base.cc +++ /dev/null @@ -1,112 +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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <usrp2_base.h> -#include <gr_io_signature.h> -#include <iostream> - -usrp2_base::usrp2_base(const char *name, - gr_io_signature_sptr input_signature, - gr_io_signature_sptr output_signature, - const std::string &ifc, - const std::string &mac) - throw (std::runtime_error) - : gr_sync_block(name, - input_signature, - output_signature), - d_u2(usrp2::usrp2::sptr()) -{ - d_u2 = usrp2::usrp2::make(ifc, mac); - if (!d_u2) - throw std::runtime_error("Unable to initialize USRP2!"); -} - -usrp2_base::~usrp2_base () -{ - // NOP -} - -std::string -usrp2_base::mac_addr() const -{ - return d_u2->mac_addr(); -} - -std::string -usrp2_base::interface_name() const -{ - return d_u2->interface_name(); -} - -bool -usrp2_base::fpga_master_clock_freq(long *freq) const -{ - return d_u2->fpga_master_clock_freq(freq); -} - -bool -usrp2_base::config_mimo(int flags) -{ - return d_u2->config_mimo(flags); -} - -bool -usrp2_base::sync_to_pps() -{ - return d_u2->sync_to_pps(); -} - -bool -usrp2_base::sync_every_pps(bool enable) -{ - return d_u2->sync_every_pps(enable); -} - -std::vector<uint32_t> -usrp2_base::peek32(uint32_t addr, uint32_t words) -{ - return d_u2->peek32(addr, words); -} - -bool -usrp2_base::poke32(uint32_t addr, const std::vector<uint32_t> &data) -{ - return d_u2->poke32(addr, data); -} - -bool -usrp2_base::start() -{ - // Default implementation is NOP - return true; -} - -bool -usrp2_base::stop() -{ - // Default implementation is NOP - return true; -} diff --git a/gr-usrp2/src/usrp2_base.h b/gr-usrp2/src/usrp2_base.h deleted file mode 100644 index 67a62ba10..000000000 --- a/gr-usrp2/src/usrp2_base.h +++ /dev/null @@ -1,109 +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. - */ - -#ifndef INCLUDED_USRP2_BASE_H -#define INCLUDED_USRP2_BASE_H - -#include <gr_sync_block.h> -#include <usrp2/usrp2.h> -#include <stdexcept> - -// BIG ASS FIXME: get from lower layer MTU calculation -#define USRP2_MIN_RX_SAMPLES 371 - -/*! - * Base class for all USRP2 blocks - */ -class usrp2_base : public gr_sync_block -{ -protected: - usrp2_base(const char *name, - gr_io_signature_sptr input_signature, - gr_io_signature_sptr output_signature, - const std::string &ifc, - const std::string &mac) - throw (std::runtime_error); - - usrp2::usrp2::sptr d_u2; - -public: - ~usrp2_base(); - - /*! - * \brief Get USRP2 hardware MAC address - */ - std::string mac_addr() const; - - /*! - * \brief Get interface name used to communicat with USRP2 - */ - std::string interface_name() const; - - /*! - * \brief Get USRP2 master clock rate - */ - bool fpga_master_clock_freq(long *freq) const; - - /*! - * \brief MIMO configuration - */ - bool config_mimo(int flags); - - /*! - * \brief Set master time to 0 at next PPS rising edge - */ - bool sync_to_pps(); - - /*! - * Reset master time to 0 at every PPS edge - */ - bool sync_every_pps(bool enable); - - /*! - * \brief Read memory from Wishbone bus as words - */ - std::vector<uint32_t> peek32(uint32_t addr, uint32_t words); - - /*! - * \brief Write memory to Wishbone bus as words - */ - bool poke32(uint32_t addr, const std::vector<uint32_t> &data); - - /*! - * \brief Called by scheduler when starting flowgraph - */ - virtual bool start(); - - /*! - * \brief Called by scheduler when stopping flowgraph - */ - virtual bool stop(); - - /*! - * \brief Derived class must override this - */ - virtual int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) = 0; -}; - -#endif /* INCLUDED_USRP2_BASE_H */ diff --git a/gr-usrp2/src/usrp2_sink_16sc.cc b/gr-usrp2/src/usrp2_sink_16sc.cc deleted file mode 100644 index 75cc1f4a6..000000000 --- a/gr-usrp2/src/usrp2_sink_16sc.cc +++ /dev/null @@ -1,90 +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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <usrp2_sink_16sc.h> -#include <usrp2/metadata.h> -#include <gr_io_signature.h> -#include <iostream> - -// FIXME hack until VRT replaces libusrp2 -#define U2_MIN_SAMPLES 9 - -usrp2_sink_16sc_sptr -usrp2_make_sink_16sc(const std::string &ifc, const std::string &mac_addr) - throw (std::runtime_error) -{ - return gnuradio::get_initial_sptr(new usrp2_sink_16sc(ifc, mac_addr)); -} - -usrp2_sink_16sc::usrp2_sink_16sc(const std::string &ifc, const std::string &mac_addr) - throw (std::runtime_error) - : usrp2_sink_base("usrp2_sink_16sc", - gr_make_io_signature(1, 1, sizeof(std::complex<int16_t>)), - ifc, mac_addr) -{ - // NOP -} - -usrp2_sink_16sc::~usrp2_sink_16sc() -{ - // NOP -} - -int -usrp2_sink_16sc::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - std::complex<int16_t> *in = (std::complex<int16_t> *)input_items[0]; - - // FIXME: Current libusrp2 can't handle short packets. - // Returning 0 assumes there will be more samples - // the next round... - if (noutput_items < U2_MIN_SAMPLES) - return 0; - - usrp2::tx_metadata metadata; - - // Set TX metadata to either start time or now - if (d_should_wait == true) { - metadata.timestamp = d_tx_time; - metadata.send_now = 0; - d_should_wait = false; - } - else { - metadata.timestamp = -1; - metadata.send_now = 1; - } - metadata.start_of_burst = 1; - - bool ok = d_u2->tx_16sc(0, in, noutput_items, &metadata); - if (!ok){ - std::cerr << "usrp2_sink_16sc: tx_16sc failed" << std::endl; - return -1; // say we're done - } - - return noutput_items; -} diff --git a/gr-usrp2/src/usrp2_sink_16sc.h b/gr-usrp2/src/usrp2_sink_16sc.h deleted file mode 100644 index faacc447a..000000000 --- a/gr-usrp2/src/usrp2_sink_16sc.h +++ /dev/null @@ -1,60 +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. - */ - -#ifndef INCLUDED_USRP2_SINK_16SC_H -#define INCLUDED_USRP2_SINK_16SC_H - -#include <usrp2_sink_base.h> - -class usrp2_sink_16sc; -typedef boost::shared_ptr<usrp2_sink_16sc> usrp2_sink_16sc_sptr; - -usrp2_sink_16sc_sptr -usrp2_make_sink_16sc(const std::string &ifc="eth0", - const std::string &mac="") - throw (std::runtime_error); - -/*! - * \ingroup sink_blk - * \ingroup usrp2 - */ -class usrp2_sink_16sc : public usrp2_sink_base -{ -private: - friend usrp2_sink_16sc_sptr - usrp2_make_sink_16sc(const std::string &ifc, - const std::string &mac) - throw (std::runtime_error); - -protected: - usrp2_sink_16sc(const std::string &ifc, const std::string &mac) - throw (std::runtime_error); - -public: - ~usrp2_sink_16sc(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_USRP2_SINK_16SC_H */ diff --git a/gr-usrp2/src/usrp2_sink_32fc.cc b/gr-usrp2/src/usrp2_sink_32fc.cc deleted file mode 100644 index fa75b3805..000000000 --- a/gr-usrp2/src/usrp2_sink_32fc.cc +++ /dev/null @@ -1,90 +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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <usrp2_sink_32fc.h> -#include <usrp2/metadata.h> -#include <gr_io_signature.h> -#include <iostream> - -// FIXME hack until VRT replaces libusrp2 -#define U2_MIN_SAMPLES 9 - -usrp2_sink_32fc_sptr -usrp2_make_sink_32fc(const std::string &ifc, const std::string &mac_addr) - throw (std::runtime_error) -{ - return gnuradio::get_initial_sptr(new usrp2_sink_32fc(ifc, mac_addr)); -} - -usrp2_sink_32fc::usrp2_sink_32fc(const std::string &ifc, const std::string &mac_addr) - throw (std::runtime_error) - : usrp2_sink_base("usrp2_sink_32fc", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - ifc, mac_addr) -{ - // NOP -} - -usrp2_sink_32fc::~usrp2_sink_32fc() -{ - // NOP -} - -int -usrp2_sink_32fc::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - gr_complex *in = (gr_complex *)input_items[0]; - - // FIXME: Current libusrp2 can't handle short packets. - // Returning 0 assumes there will be more samples - // the next round... - if (noutput_items < U2_MIN_SAMPLES) - return 0; - - usrp2::tx_metadata metadata; - - // Set TX metadata to either start time or now - if (d_should_wait == true) { - metadata.timestamp = d_tx_time; - metadata.send_now = 0; - d_should_wait = false; - } - else { - metadata.timestamp = -1; - metadata.send_now = 1; - } - metadata.start_of_burst = 1; - - bool ok = d_u2->tx_32fc(0, in, noutput_items, &metadata); - if (!ok){ - std::cerr << "usrp2_sink_32fc: tx_32fc failed" << std::endl; - return -1; // say we're done - } - - return noutput_items; -} diff --git a/gr-usrp2/src/usrp2_sink_32fc.h b/gr-usrp2/src/usrp2_sink_32fc.h deleted file mode 100644 index b63f96871..000000000 --- a/gr-usrp2/src/usrp2_sink_32fc.h +++ /dev/null @@ -1,60 +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. - */ - -#ifndef INCLUDED_USRP2_SINK_32FC_H -#define INCLUDED_USRP2_SINK_32FC_H - -#include <usrp2_sink_base.h> - -class usrp2_sink_32fc; -typedef boost::shared_ptr<usrp2_sink_32fc> usrp2_sink_32fc_sptr; - -usrp2_sink_32fc_sptr -usrp2_make_sink_32fc(const std::string &ifc="eth0", - const std::string &mac="") - throw (std::runtime_error); - -/*! - * \ingroup sink_blk - * \ingroup usrp2 - */ -class usrp2_sink_32fc : public usrp2_sink_base -{ -private: - friend usrp2_sink_32fc_sptr - usrp2_make_sink_32fc(const std::string &ifc, - const std::string &mac) - throw (std::runtime_error); - -protected: - usrp2_sink_32fc(const std::string &ifc, const std::string &mac) - throw (std::runtime_error); - -public: - ~usrp2_sink_32fc(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_USRP2_SINK_32FC_H */ diff --git a/gr-usrp2/src/usrp2_sink_base.cc b/gr-usrp2/src/usrp2_sink_base.cc deleted file mode 100644 index c9b34a54a..000000000 --- a/gr-usrp2/src/usrp2_sink_base.cc +++ /dev/null @@ -1,166 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,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 <usrp2_sink_base.h> -#include <gr_io_signature.h> -#include <iostream> - -usrp2_sink_base::usrp2_sink_base(const char *name, - gr_io_signature_sptr input_signature, - const std::string &ifc, - const std::string &mac) - throw (std::runtime_error) - : usrp2_base(name, - input_signature, - gr_make_io_signature(0, 0, 0), - ifc, mac), - d_should_wait(false), - d_tx_time(0) -{ - // NOP -} - -usrp2_sink_base::~usrp2_sink_base () -{ - // NOP -} - -bool -usrp2_sink_base::set_antenna(int ant) -{ - return d_u2->set_tx_antenna(ant); -} - -bool -usrp2_sink_base::set_gain(double gain) -{ - return d_u2->set_tx_gain(gain); -} - -bool -usrp2_sink_base::set_lo_offset(double frequency) -{ - return d_u2->set_tx_lo_offset(frequency); -} - -bool -usrp2_sink_base::set_center_freq(double frequency, usrp2::tune_result *tr) -{ - return d_u2->set_tx_center_freq(frequency, tr); -} - -bool -usrp2_sink_base::set_interp(int interp_factor) -{ - return d_u2->set_tx_interp(interp_factor); -} - -void -usrp2_sink_base::default_scale_iq(int interp_factor, int *scale_i, int *scale_q) -{ - return d_u2->default_tx_scale_iq(interp_factor, scale_i, scale_q); -} - -bool -usrp2_sink_base::set_scale_iq(int scale_i, int scale_q) -{ - return d_u2->set_tx_scale_iq(scale_i, scale_q); -} - -int -usrp2_sink_base::interp() -{ - return d_u2->tx_interp(); -} - -bool -usrp2_sink_base::dac_rate(long *rate) -{ - return d_u2->dac_rate(rate); -} - -double -usrp2_sink_base::gain_min() -{ - return d_u2->tx_gain_min(); -} - -double -usrp2_sink_base::gain_max() -{ - return d_u2->tx_gain_max(); -} - -double -usrp2_sink_base::gain_db_per_step() -{ - return d_u2->tx_gain_db_per_step(); -} - -double -usrp2_sink_base::freq_min() -{ - return d_u2->tx_freq_min(); -} - -double -usrp2_sink_base::freq_max() -{ - return d_u2->tx_freq_max(); -} - -bool -usrp2_sink_base::daughterboard_id(int *dbid) -{ - return d_u2->tx_daughterboard_id(dbid); -} - -bool usrp2_sink_base::set_gpio_ddr(uint16_t value, uint16_t mask) -{ - return d_u2->set_gpio_ddr(usrp2::GPIO_TX_BANK, value, mask); -} - -bool usrp2_sink_base::set_gpio_sels(std::string sels) -{ - return d_u2->set_gpio_sels(usrp2::GPIO_TX_BANK, sels); -} - -bool usrp2_sink_base::write_gpio(uint16_t value, uint16_t mask) -{ - return d_u2->write_gpio(usrp2::GPIO_TX_BANK, value, mask); -} - -bool usrp2_sink_base::read_gpio(uint16_t *value) -{ - return d_u2->read_gpio(usrp2::GPIO_TX_BANK, value); -} - -bool usrp2_sink_base::start_streaming_at(usrp2::fpga_timestamp time) -{ - d_should_wait = true; - d_tx_time = time; - return true; -} diff --git a/gr-usrp2/src/usrp2_sink_base.h b/gr-usrp2/src/usrp2_sink_base.h deleted file mode 100644 index d831d4df6..000000000 --- a/gr-usrp2/src/usrp2_sink_base.h +++ /dev/null @@ -1,152 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,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. - */ - -#ifndef INCLUDED_USRP2_SINK_BASE_H -#define INCLUDED_USRP2_SINK_BASE_H - -#include <usrp2_base.h> - -/*! - * Base class for all USRP2 transmit blocks - */ -class usrp2_sink_base : public usrp2_base -{ -protected: - usrp2_sink_base(const char *name, - gr_io_signature_sptr input_signature, - const std::string &ifc, - const std::string &mac) - throw (std::runtime_error); - - bool d_should_wait; - usrp2::fpga_timestamp d_tx_time; - -public: - ~usrp2_sink_base(); - - /*! - * \brief Set antenna - */ - bool set_antenna(int ant); - - /*! - * \brief Set transmitter gain - */ - bool set_gain(double gain); - - /*! - * \brief Set transmitter LO offset frequency - */ - bool set_lo_offset(double frequency); - - /*! - * \brief Set transmitter center frequency - */ - bool set_center_freq(double frequency, usrp2::tune_result *tr); - - /*! - * \brief Set transmit interpolation rate - */ - bool set_interp(int interp_factor); - - /*! - * \brief Calculate default scale_iq for given interpolation factor - */ - void default_scale_iq(int interpolation_factor, int *scale_i, int *scale_q); - - /*! - * \brief Set transmit IQ scale factors - */ - bool set_scale_iq(int scale_i, int scale_q); - - /*! - * \brief Get transmit interpolation rate - */ - int interp(); - - /*! - * \brief Get DAC sample rate in Hz - */ - bool dac_rate(long *rate); - - /*! - * \brief Returns minimum Tx gain - */ - double gain_min(); - - /*! - * \brief Returns maximum Tx gain - */ - double gain_max(); - - /*! - * \brief Returns Tx gain db_per_step - */ - double gain_db_per_step(); - - /*! - * \brief Returns minimum Tx center frequency - */ - double freq_min(); - - /*! - * \brief Returns maximum Tx center frequency - */ - double freq_max(); - - /*! - * \brief Get Tx daughterboard ID - * - * \param[out] dbid returns the daughterboard id. - * - * daughterboard id >= 0 if successful, -1 if no daugherboard installed, - * -2 if invalid EEPROM on daughterboard. - */ - bool daughterboard_id(int *dbid); - - /*! - * \brief Set daughterboard GPIO data direction register. - */ - bool set_gpio_ddr(uint16_t value, uint16_t mask); - - /*! - * \brief Set daughterboard GPIO output selection register. - */ - bool set_gpio_sels(std::string sels); - - /*! - * \brief Set daughterboard GPIO pin values. - */ - bool write_gpio(uint16_t value, uint16_t mask); - - /*! - * \brief Read daughterboard GPIO pin values - */ - bool read_gpio(uint16_t *value); - - /*! - * \brief First samples begin streaming to USRP2 at given time - */ - bool start_streaming_at(usrp2::fpga_timestamp time); -}; - -#endif /* INCLUDED_USRP2_SINK_BASE_H */ diff --git a/gr-usrp2/src/usrp2_source_16sc.cc b/gr-usrp2/src/usrp2_source_16sc.cc deleted file mode 100644 index 33114b51d..000000000 --- a/gr-usrp2/src/usrp2_source_16sc.cc +++ /dev/null @@ -1,69 +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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <usrp2_source_16sc.h> -#include <rx_16sc_handler.h> -#include <gr_io_signature.h> -#include <iostream> - -usrp2_source_16sc_sptr -usrp2_make_source_16sc(const std::string &ifc, const std::string &mac_addr) - throw (std::runtime_error) -{ - return gnuradio::get_initial_sptr(new usrp2_source_16sc(ifc, mac_addr)); -} - -usrp2_source_16sc::usrp2_source_16sc(const std::string &ifc, const std::string &mac_addr) - throw (std::runtime_error) - : usrp2_source_base("usrp2_source_16sc", - gr_make_io_signature(1, 1, sizeof(std::complex<int16_t>)), - ifc, mac_addr) -{ - set_output_multiple(USRP2_MIN_RX_SAMPLES); -} - -usrp2_source_16sc::~usrp2_source_16sc() -{ - // NOP -} - -int -usrp2_source_16sc::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - std::complex<int16_t> *out = (std::complex<int16_t> *)output_items[0]; - - rx_16sc_handler::sptr handler = rx_16sc_handler::make(noutput_items, USRP2_MIN_RX_SAMPLES, out); - - bool ok = d_u2->rx_samples(0, handler.get()); // FIXME: channel number instead of 0 - if (!ok){ - std::cerr << "usrp2::rx_samples() failed" << std::endl; - return -1; // say we're done - } - - return handler->nsamples(); -} diff --git a/gr-usrp2/src/usrp2_source_16sc.h b/gr-usrp2/src/usrp2_source_16sc.h deleted file mode 100644 index d5a86be73..000000000 --- a/gr-usrp2/src/usrp2_source_16sc.h +++ /dev/null @@ -1,58 +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. - */ - -#ifndef INCLUDED_USRP2_SOURCE_16SC_H -#define INCLUDED_USRP2_SOURCE_16SC_H - -#include <usrp2_source_base.h> - -class usrp2_source_16sc; -typedef boost::shared_ptr<usrp2_source_16sc> usrp2_source_16sc_sptr; - -usrp2_source_16sc_sptr -usrp2_make_source_16sc(const std::string &ifc="eth0", - const std::string &mac="") - throw (std::runtime_error); - -/*! - * \ingroup source_blk - * \ingroup usrp2 - */ -class usrp2_source_16sc : public usrp2_source_base -{ -private: - friend usrp2_source_16sc_sptr - usrp2_make_source_16sc(const std::string &ifc, - const std::string &mac) throw (std::runtime_error); - -protected: - usrp2_source_16sc(const std::string &ifc, const std::string &mac) throw (std::runtime_error); - -public: - ~usrp2_source_16sc(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_USRP2_SOURCE_16SC_H */ diff --git a/gr-usrp2/src/usrp2_source_32fc.cc b/gr-usrp2/src/usrp2_source_32fc.cc deleted file mode 100644 index 89b4bea0e..000000000 --- a/gr-usrp2/src/usrp2_source_32fc.cc +++ /dev/null @@ -1,69 +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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <usrp2_source_32fc.h> -#include <rx_32fc_handler.h> -#include <gr_io_signature.h> -#include <iostream> - -usrp2_source_32fc_sptr -usrp2_make_source_32fc(const std::string &ifc, const std::string &mac_addr) - throw (std::runtime_error) -{ - return gnuradio::get_initial_sptr(new usrp2_source_32fc(ifc, mac_addr)); -} - -usrp2_source_32fc::usrp2_source_32fc(const std::string &ifc, const std::string &mac_addr) - throw (std::runtime_error) - : usrp2_source_base("usrp2_source_32fc", - gr_make_io_signature(1, 1, sizeof(gr_complex)), - ifc, mac_addr) -{ - set_output_multiple(USRP2_MIN_RX_SAMPLES); -} - -usrp2_source_32fc::~usrp2_source_32fc() -{ - // NOP -} - -int -usrp2_source_32fc::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - gr_complex *out = (gr_complex *)output_items[0]; - - rx_32fc_handler::sptr handler = rx_32fc_handler::make(noutput_items, USRP2_MIN_RX_SAMPLES, out); - - bool ok = d_u2->rx_samples(0, handler.get()); // FIXME: channel number instead of 0 - if (!ok){ - std::cerr << "usrp2::rx_samples() failed" << std::endl; - return -1; // say we're done - } - - return handler->nsamples(); -} diff --git a/gr-usrp2/src/usrp2_source_32fc.h b/gr-usrp2/src/usrp2_source_32fc.h deleted file mode 100644 index 041416ded..000000000 --- a/gr-usrp2/src/usrp2_source_32fc.h +++ /dev/null @@ -1,58 +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. - */ - -#ifndef INCLUDED_USRP2_SOURCE_32FC_H -#define INCLUDED_USRP2_SOURCE_32FC_H - -#include <usrp2_source_base.h> - -class usrp2_source_32fc; -typedef boost::shared_ptr<usrp2_source_32fc> usrp2_source_32fc_sptr; - -usrp2_source_32fc_sptr -usrp2_make_source_32fc(const std::string &ifc="eth0", - const std::string &mac="") - throw (std::runtime_error); - -/*! - * \ingroup source_blk - * \ingroup usrp2 - */ -class usrp2_source_32fc : public usrp2_source_base -{ -private: - friend usrp2_source_32fc_sptr - usrp2_make_source_32fc(const std::string &ifc, - const std::string &mac) throw (std::runtime_error); - -protected: - usrp2_source_32fc(const std::string &ifc, const std::string &mac) throw (std::runtime_error); - -public: - ~usrp2_source_32fc(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_USRP2_SOURCE_32FC_H */ diff --git a/gr-usrp2/src/usrp2_source_base.cc b/gr-usrp2/src/usrp2_source_base.cc deleted file mode 100644 index d946991de..000000000 --- a/gr-usrp2/src/usrp2_source_base.cc +++ /dev/null @@ -1,185 +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. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <usrp2_source_base.h> -#include <gr_io_signature.h> -#include <iostream> - -usrp2_source_base::usrp2_source_base(const char *name, - gr_io_signature_sptr output_signature, - const std::string &ifc, - const std::string &mac) - throw (std::runtime_error) - : usrp2_base(name, - gr_make_io_signature(0, 0, 0), - output_signature, - ifc, mac) -{ - // NOP -} - -usrp2_source_base::~usrp2_source_base () -{ - // NOP -} - -bool -usrp2_source_base::set_antenna(int ant) -{ - return d_u2->set_rx_antenna(ant); -} - -bool -usrp2_source_base::set_gain(double gain) -{ - return d_u2->set_rx_gain(gain); -} - -bool -usrp2_source_base::set_lo_offset(double frequency) -{ - return d_u2->set_rx_lo_offset(frequency); -} - -bool -usrp2_source_base::set_center_freq(double frequency, usrp2::tune_result *tr) -{ - return d_u2->set_rx_center_freq(frequency, tr); -} - -bool -usrp2_source_base::set_decim(int decimation_factor) -{ - return d_u2->set_rx_decim(decimation_factor); -} - -bool -usrp2_source_base::set_scale_iq(int scale_i, int scale_q) -{ - return d_u2->set_rx_scale_iq(scale_i, scale_q); -} - -int -usrp2_source_base::decim() -{ - return d_u2->rx_decim(); -} - -bool -usrp2_source_base::adc_rate(long *rate) -{ - return d_u2->adc_rate(rate); -} - -double -usrp2_source_base::gain_min() -{ - return d_u2->rx_gain_min(); -} - -double -usrp2_source_base::gain_max() -{ - return d_u2->rx_gain_max(); -} - -double -usrp2_source_base::gain_db_per_step() -{ - return d_u2->rx_gain_db_per_step(); -} - -double -usrp2_source_base::freq_min() -{ - return d_u2->rx_freq_min(); -} - -double -usrp2_source_base::freq_max() -{ - return d_u2->rx_freq_max(); -} - -bool -usrp2_source_base::daughterboard_id(int *dbid) -{ - return d_u2->rx_daughterboard_id(dbid); -} - -unsigned int -usrp2_source_base::overruns() -{ - return d_u2->rx_overruns(); -} - -unsigned int -usrp2_source_base::missing() -{ - return d_u2->rx_missing(); -} - -bool -usrp2_source_base::start() -{ - return d_u2->start_rx_streaming(0); // FIXME: someday sources will have channel #s -} - -bool -usrp2_source_base::stop() -{ - return d_u2->stop_rx_streaming(0); // FIXME: someday sources will have channel #s -} - -bool -usrp2_source_base::set_gpio_ddr(uint16_t value, uint16_t mask) -{ - return d_u2->set_gpio_ddr(usrp2::GPIO_RX_BANK, value, mask); -} - -bool -usrp2_source_base::set_gpio_sels(std::string sels) -{ - return d_u2->set_gpio_sels(usrp2::GPIO_RX_BANK, sels); -} - -bool -usrp2_source_base::write_gpio(uint16_t value, uint16_t mask) -{ - return d_u2->write_gpio(usrp2::GPIO_RX_BANK, value, mask); -} - -bool -usrp2_source_base::read_gpio(uint16_t *value) -{ - return d_u2->read_gpio(usrp2::GPIO_RX_BANK, value); -} - -bool -usrp2_source_base::enable_gpio_streaming(int enable) -{ - return d_u2->enable_gpio_streaming(usrp2::GPIO_RX_BANK, enable); -} diff --git a/gr-usrp2/src/usrp2_source_base.h b/gr-usrp2/src/usrp2_source_base.h deleted file mode 100644 index 9e35e2e93..000000000 --- a/gr-usrp2/src/usrp2_source_base.h +++ /dev/null @@ -1,164 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - -#ifndef INCLUDED_USRP2_SOURCE_BASE_H -#define INCLUDED_USRP2_SOURCE_BASE_H - -#include <usrp2_base.h> - -/*! - * Base class for all USRP2 source blocks - */ -class usrp2_source_base : public usrp2_base -{ -protected: - usrp2_source_base(const char *name, - gr_io_signature_sptr output_signature, - const std::string &ifc, - const std::string &mac) - throw (std::runtime_error); - -public: - ~usrp2_source_base(); - - /*! - * \brief Set antenna - */ - bool set_antenna(int ant); - - /*! - * \brief Set receiver gain - */ - bool set_gain(double gain); - - /*! - * \brief Set receive LO offset frequency - */ - bool set_lo_offset(double frequency); - - /*! - * \brief Set receiver center frequency - */ - bool set_center_freq(double frequency, usrp2::tune_result *tr); - - /*! - * \brief Set receive decimation rate - */ - bool set_decim(int decimation_factor); - - /*! - * \brief Set receive IQ scale factors - */ - bool set_scale_iq(int scale_i, int scale_q); - - /*! - * \brief Get receive decimation rate - */ - int decim(); - - /*! - * \brief Get the ADC sample rate - */ - bool adc_rate(long *rate); - - /*! - * \brief Returns minimum Rx gain - */ - double gain_min(); - - /*! - * \brief Returns maximum Rx gain - */ - double gain_max(); - - /*! - * \brief Returns Rx gain db_per_step - */ - double gain_db_per_step(); - - /*! - * \brief Returns minimum Rx center frequency - */ - double freq_min(); - - /*! - * \brief Returns maximum Rx center frequency - */ - double freq_max(); - - /*! - * \brief Get Rx daughterboard ID - * - * \param[out] dbid returns the daughterboard id. - * - * daughterboard id >= 0 if successful, -1 if no daugherboard installed, - * -2 if invalid EEPROM on daughterboard. - */ - bool daughterboard_id(int *dbid); - - /*! - * \brief Returns number of receiver overruns - */ - unsigned int overruns(); - - /*! - * \brief Returns number of missing sequence numbers - */ - unsigned int missing(); - - /*! - * \brief Called by scheduler when starting flowgraph - */ - virtual bool start(); - - /*! - * \brief Called by scheduler when stopping flowgraph - */ - virtual bool stop(); - - /*! - * \brief Set daughterboard GPIO data direction register. - */ - bool set_gpio_ddr(uint16_t value, uint16_t mask); - - /*! - * \brief Set daughterboard GPIO output selection register. - */ - bool set_gpio_sels(std::string sels); - - /*! - * \brief Set daughterboard GPIO pin values. - */ - bool write_gpio(uint16_t value, uint16_t mask); - - /*! - * \brief Read daughterboard GPIO pin values - */ - bool read_gpio(uint16_t *value); - - /*! - * \brief Enable streaming GPIO in sample LSBs - */ - bool enable_gpio_streaming(int enable); -}; - -#endif /* INCLUDED_USRP2_SOURCE_BASE_H */ diff --git a/gr-usrp2/src/usrp2_swig.i b/gr-usrp2/src/usrp2_swig.i deleted file mode 100644 index 6e8fa1960..000000000 --- a/gr-usrp2/src/usrp2_swig.i +++ /dev/null @@ -1,361 +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 -%import <stdint.i> - -%{ -#include "usrp2_source_16sc.h" -#include "usrp2_source_32fc.h" -#include "usrp2_sink_16sc.h" -#include "usrp2_sink_32fc.h" -%} - -%include <usrp2/tune_result.h> -%include <usrp2/mimo_config.h> -%include <usrp2/metadata.h> - -%template(uint32_t_vector) std::vector<uint32_t>; - -// ---------------------------------------------------------------- - -class usrp2_base : public gr_sync_block -{ -protected: - usrp2_base() throw (std::runtime_error); - -public: - ~usrp2_base(); - - std::string mac_addr() const; - std::string interface_name() const; - %rename(_real_fpga_master_clock_freq) fpga_master_clock_freq; - bool fpga_master_clock_freq(long *freq); - bool config_mimo(int flags); - bool sync_to_pps(); - bool sync_every_pps(bool enable); - std::vector<uint32_t> peek32(uint32_t addr, uint32_t words); - bool poke32(uint32_t addr, const std::vector<uint32_t> &data); -}; - -// ---------------------------------------------------------------- - -class usrp2_source_base : public usrp2_base -{ -protected: - usrp2_source_base() throw (std::runtime_error); - -public: - ~usrp2_source_base(); - - bool set_antenna(int ant); - bool set_gain(double gain); - %rename(_real_set_center_freq) set_center_freq; - bool set_lo_offset(double frequency); - bool set_center_freq(double frequency, usrp2::tune_result *r); - bool set_decim(int decimation_factor); - bool set_scale_iq(int scale_i, int scale_q); - int decim(); - %rename(_real_adc_rate) adc_rate; - bool adc_rate(long *rate); - double gain_min(); - double gain_max(); - double gain_db_per_step(); - double freq_min(); - double freq_max(); - %rename(_real_daughterboard_id) daughterboard_id; - bool daughterboard_id(int *dbid); - unsigned int overruns(); - unsigned int missing(); - bool set_gpio_ddr(uint16_t value, uint16_t mask); - bool set_gpio_sels(std::string sels); - bool write_gpio(uint16_t value, uint16_t mask); - %rename(_real_read_gpio) read_gpio; - bool read_gpio(uint16_t *value); - bool enable_gpio_streaming(int enable); -}; - -// ---------------------------------------------------------------- - -GR_SWIG_BLOCK_MAGIC(usrp2,source_32fc) - -usrp2_source_32fc_sptr -usrp2_make_source_32fc(const std::string ifc="eth0", - const std::string mac="") - throw (std::runtime_error); - -class usrp2_source_32fc : public usrp2_source_base -{ -protected: - usrp2_source_32fc(const std::string &ifc, const std::string &mac); - -public: - ~usrp2_source_32fc(); -}; - -// ---------------------------------------------------------------- - -GR_SWIG_BLOCK_MAGIC(usrp2,source_16sc) - -usrp2_source_16sc_sptr -usrp2_make_source_16sc(const std::string ifc="eth0", - const std::string mac="") - throw (std::runtime_error); - -class usrp2_source_16sc : public usrp2_source_base -{ -protected: - usrp2_source_16sc(const std::string &ifc, const std::string &mac); - -public: - ~usrp2_source_16sc(); -}; - -// ---------------------------------------------------------------- - -class usrp2_sink_base : public usrp2_base -{ -protected: - usrp2_sink_base() throw (std::runtime_error); - -public: - ~usrp2_sink_base(); - - bool set_antenna(int ant); - bool set_gain(double gain); - %rename(_real_set_center_freq) set_center_freq; - bool set_lo_offset(double frequency); - bool set_center_freq(double frequency, usrp2::tune_result *r); - bool set_interp(int interp_factor); - bool set_scale_iq(int scale_i, int scale_q); - int interp(); - %rename(_real_default_tx_scale_iq) default_scale_iq; - void default_scale_iq(int interp, int *scale_i, int *scale_q); - %rename(_real_dac_rate) dac_rate; - bool dac_rate(long *rate); - double gain_min(); - double gain_max(); - double gain_db_per_step(); - double freq_min(); - double freq_max(); - %rename(_real_daughterboard_id) daughterboard_id; - bool daughterboard_id(int *dbid); - bool set_gpio_ddr(uint16_t value, uint16_t mask); - bool set_gpio_sels(std::string sels); - bool write_gpio(uint16_t value, uint16_t mask); - %rename(_real_read_gpio) read_gpio; - bool read_gpio(uint16_t *value); - bool start_streaming_at(usrp2::fpga_timestamp time); -}; - -// ---------------------------------------------------------------- - -GR_SWIG_BLOCK_MAGIC(usrp2,sink_32fc) - -usrp2_sink_32fc_sptr -usrp2_make_sink_32fc(const std::string ifc="eth0", - const std::string mac="") - throw (std::runtime_error); - -class usrp2_sink_32fc : public usrp2_sink_base -{ -protected: - usrp2_sink_32fc(const std::string &ifc, const std::string &mac); - -public: - ~usrp2_sink_32fc(); -}; - -// ---------------------------------------------------------------- - -GR_SWIG_BLOCK_MAGIC(usrp2,sink_16sc) - -usrp2_sink_16sc_sptr -usrp2_make_sink_16sc(const std::string ifc="eth0", - const std::string mac="") - throw (std::runtime_error); - -class usrp2_sink_16sc : public usrp2_sink_base -{ -protected: - usrp2_sink_16sc(const std::string &ifc, const std::string &mac); - -public: - ~usrp2_sink_16sc(); -}; - -// ---------------------------------------------------------------- - -// some utility functions to allow Python to deal with pointers -%{ - long *make_long_ptr() { return new long; } - long deref_long_ptr(long *l) { return *l; } - void free_long_ptr(long *l) { delete l; } - int *make_int_ptr() { return new int; } - int deref_int_ptr(int *l) { return *l; } - void free_int_ptr(int *l) { delete l; } - uint16_t *make_uint16_ptr() { return new uint16_t; } - int deref_uint16_ptr(uint16_t *l) { return *l; } - void free_uint16_ptr(uint16_t *l) { delete l; } -%} - -long *make_long_ptr(); -long deref_long_ptr(long *l); -void free_long_ptr(long *l); -int *make_int_ptr(); -int deref_int_ptr(int *l); -void free_int_ptr(int *l); -uint16_t *make_uint16_ptr(); -int deref_uint16_ptr(uint16_t *l); -void free_uint16_ptr(uint16_t *l); - -#ifdef SWIGPYTHON -// create a more pythonic interface -%pythoncode %{ - -def __set_center_freq(self, freq): - tr = tune_result() - r = self._real_set_center_freq(freq, tr) - if r: - return tr - else: - return None - -def __fpga_master_clock_freq(self): - f = make_long_ptr(); - r = self._real_fpga_master_clock_freq(f) - if r: - result = deref_long_ptr(f) - else: - result = None - free_long_ptr(f) - return result - -def __adc_rate(self): - rate = make_long_ptr(); - r = self._real_adc_rate(rate) - if r: - result = deref_long_ptr(rate) - else: - result = None - free_long_ptr(rate) - return result - -def __dac_rate(self): - rate = make_long_ptr(); - r = self._real_dac_rate(rate) - if r: - result = deref_long_ptr(rate) - else: - result = None - free_long_ptr(rate) - return result - -def __gain_range(self): - return [self.gain_min(), - self.gain_max(), - self.gain_db_per_step()] - -# NOTE: USRP1 uses a length three tuple here (3rd value is 'freq step'), -# but it's not really useful. We let an index error happen here -# to identify code using it. -def __freq_range(self): - return [self.freq_min(), - self.freq_max()] - -def __daughterboard_id(self): - dbid = make_int_ptr() - r = self._real_daughterboard_id(dbid) - if r: - result = deref_int_ptr(dbid) - else: - result = None - free_int_ptr(dbid) - return result - -def __default_tx_scale_iq(self, interp): - scale_i = make_int_ptr() - scale_q = make_int_ptr() - self._real_default_tx_scale_iq(interp, scale_i, scale_q) - return (deref_int_ptr(scale_i), deref_int_ptr(scale_q)) - -def __read_gpio(self): - value = make_uint16_ptr() - r = self._real_read_gpio(value) - if r: - result = deref_uint16_ptr(value) - else: - result = None - free_uint16_ptr(value) - return result - - -usrp2_source_32fc_sptr.set_center_freq = __set_center_freq -usrp2_source_16sc_sptr.set_center_freq = __set_center_freq -usrp2_sink_32fc_sptr.set_center_freq = __set_center_freq -usrp2_sink_16sc_sptr.set_center_freq = __set_center_freq - -usrp2_source_32fc_sptr.fpga_master_clock_freq = __fpga_master_clock_freq -usrp2_source_16sc_sptr.fpga_master_clock_freq = __fpga_master_clock_freq -usrp2_sink_32fc_sptr.fpga_master_clock_freq = __fpga_master_clock_freq -usrp2_sink_16sc_sptr.fpga_master_clock_freq = __fpga_master_clock_freq - -usrp2_source_32fc_sptr.adc_rate = __adc_rate -usrp2_source_16sc_sptr.adc_rate = __adc_rate -usrp2_sink_32fc_sptr.dac_rate = __dac_rate -usrp2_sink_16sc_sptr.dac_rate = __dac_rate - -usrp2_source_32fc_sptr.gain_range = __gain_range -usrp2_source_16sc_sptr.gain_range = __gain_range -usrp2_sink_32fc_sptr.gain_range = __gain_range -usrp2_sink_16sc_sptr.gain_range = __gain_range - -usrp2_source_32fc_sptr.freq_range = __freq_range -usrp2_source_16sc_sptr.freq_range = __freq_range -usrp2_sink_32fc_sptr.freq_range = __freq_range -usrp2_sink_16sc_sptr.freq_range = __freq_range - -usrp2_source_32fc_sptr.daughterboard_id = __daughterboard_id -usrp2_source_16sc_sptr.daughterboard_id = __daughterboard_id -usrp2_sink_32fc_sptr.daughterboard_id = __daughterboard_id -usrp2_sink_16sc_sptr.daughterboard_id = __daughterboard_id - -usrp2_sink_32fc_sptr.default_scale_iq = __default_tx_scale_iq -usrp2_sink_16sc_sptr.default_scale_iq = __default_tx_scale_iq - -usrp2_source_32fc_sptr.read_gpio = __read_gpio -usrp2_source_16sc_sptr.read_gpio = __read_gpio -usrp2_sink_32fc_sptr.read_gpio = __read_gpio -usrp2_sink_16sc_sptr.read_gpio = __read_gpio - -%} -#endif - -#if SWIGGUILE -%scheme %{ -(load-extension-global "libguile-gnuradio-usrp2_swig" "scm_init_gnuradio_usrp2_swig_module") -%} - -%goops %{ -(use-modules (gnuradio gnuradio_core_runtime)) -%} -#endif diff --git a/usrp/.gitignore b/usrp/.gitignore deleted file mode 100644 index 4af69afee..000000000 --- a/usrp/.gitignore +++ /dev/null @@ -1,31 +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 -/ltmain.sh -/libtool -/ltmain.sh -/make.log -/missing -/missing -/stamp-h -/py-compile -/stamp-h.in -/stamp-h1 -/usrp.iss diff --git a/usrp/Makefile.am b/usrp/Makefile.am deleted file mode 100644 index cde72e1eb..000000000 --- a/usrp/Makefile.am +++ /dev/null @@ -1,33 +0,0 @@ -# -# Copyright 2003 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 += \ - usrp.pc.in \ - usrp.iss.in \ - usrp.inf - -SUBDIRS = host firmware fpga doc - -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = \ - usrp.pc diff --git a/usrp/README b/usrp/README deleted file mode 100644 index df8277c3c..000000000 --- a/usrp/README +++ /dev/null @@ -1,29 +0,0 @@ -# -# README -- the short version -# - -The top level makefile handles the host code and FX2 firmware. - -Besides the normal gcc suite and all the auto tools, you'll need -the SDCC free C compiler to build the firmware. You MUST -USE VERSION 2.4.0 or VERSION 2.5.0 due to some problems with variable -initialization. http://sdcc.sourceforge.net - - -The high level interface to the USRP using our standard FPGA bitstram -is contained in usrp/host/lib/usrp_standard.h - -If you've got doxygen installed, there are html docs in -usrp/doc/html/index.html - - -# Compiling the verilog (not required unless you're modifying it) - -If you want to build the FPGA .rbf file from source (not required; we -provide pre-compiled .rbf files in usrp/fpga/rbf directory), you'll -need Altera's no cost Quartus II development tools. We're currently -building with Quartus II 5.1sp1 Web Edition. The project file is -usrp/fpga/toplevel/usrp_std/usrp_std.qpf. The toplevel verilog file -is usrp/fpga/toplevel/usrp_std/usrp_std.v. The bulk of the verilog -modules are contained in usrp/fpga/sdr_lib - diff --git a/usrp/doc/.gitignore b/usrp/doc/.gitignore deleted file mode 100644 index fdf7036a8..000000000 --- a/usrp/doc/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -/Makefile -/Makefile.in -/html -/latex -/man -/Doxyfile -/.la -/.lo -/.deps -/.libs -/*.la -/*.lo -/xml -/usrp_guide.html diff --git a/usrp/doc/Doxyfile.in b/usrp/doc/Doxyfile.in deleted file mode 100644 index 33c5bcf03..000000000 --- a/usrp/doc/Doxyfile.in +++ /dev/null @@ -1,1158 +0,0 @@ -# -# Copyright 2001,2004,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. -# - -# Doxyfile 1.3.7 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project -# -# All text after a hash (#) is considered a comment and will be ignored -# The format is: -# TAG = value [value, ...] -# For lists items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (" ") - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded -# by quotes) that should identify the project. - -PROJECT_NAME = "Universal Software Radio Peripheral" - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. -# This could be handy for archiving the generated documentation or -# if some version control system is used. - -PROJECT_NUMBER = - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) -# base path where the generated documentation will be put. -# If a relative path is entered, it will be relative to the location -# where doxygen was started. If left blank the current directory will be used. - -OUTPUT_DIRECTORY = - -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create -# 2 levels of 10 sub-directories under the output directory of each output -# format and will distribute the generated files over these directories. -# Enabling this option can be useful when feeding doxygen a huge amount of source -# files, where putting all generated files in the same directory would otherwise -# cause performance problems for the file system. - -CREATE_SUBDIRS = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# The default language is English, other supported languages are: -# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, Dutch, -# Finnish, French, German, Greek, Hungarian, Italian, Japanese, Japanese-en -# (Japanese with English messages), Korean, Korean-en, Norwegian, Polish, Portuguese, -# Romanian, Russian, Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian. - -OUTPUT_LANGUAGE = English - -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will -# include brief member descriptions after the members that are listed in -# the file and class documentation (similar to JavaDoc). -# Set to NO to disable this. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator -# that is used to form the text in various listings. Each string -# in this list, if found as the leading text of the brief description, will be -# stripped from the text and the result after processing the whole list, is used -# as the annotated text. Otherwise, the brief description is used as-is. If left -# blank, the following values are used ("$name" is automatically replaced with the -# name of the entity): "The $name class" "The $name widget" "The $name file" -# "is" "provides" "specifies" "contains" "represents" "a" "an" "the" - -ABBREVIATE_BRIEF = - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# Doxygen will generate a detailed section even if there is only a brief -# description. - -ALWAYS_DETAILED_SEC = NO - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all inherited -# members of a class in the documentation of that class as if those members were -# ordinary class members. Constructors, destructors and assignment operators of -# the base classes will not be shown. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full -# path before files name in the file list and in the header files. If set -# to NO the shortest path that makes the file name unique will be used. - -FULL_PATH_NAMES = NO - -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user-defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the -# path to strip. - -STRIP_FROM_PATH = - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of -# the path mentioned in the documentation of a class, which tells -# the reader which header file to include in order to use a class. -# If left blank only the name of the header file containing the class -# definition is used. Otherwise one should specify the include paths that -# are normally passed to the compiler using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter -# (but less readable) file names. This can be useful is your file systems -# doesn't support long names like on DOS, Mac, or CD-ROM. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the JavaDoc -# comments will behave just like the Qt-style comments (thus requiring an -# explicit @brief command for a brief description. - -JAVADOC_AUTOBRIEF = NO - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen -# treat a multi-line C++ special comment block (i.e. a block of //! or /// -# comments) as a brief description. This used to be the default behaviour. -# The new default is to treat a multi-line C++ comment block as a detailed -# description. Set this tag to YES if you prefer the old behaviour instead. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it -# re-implements. - -INHERIT_DOCS = YES - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. - -DISTRIBUTE_GROUP_DOC = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. -# Doxygen uses this value to replace tabs by spaces in code fragments. - -TAB_SIZE = 8 - -# This tag can be used to specify a number of aliases that acts -# as commands in the documentation. An alias has the form "name=value". -# For example adding "sideeffect=\par Side Effects:\n" will allow you to -# put the command \sideeffect (or @sideeffect) in the documentation, which -# will result in a user-defined paragraph with heading "Side Effects:". -# You can put \n's in the value part of an alias to insert newlines. - -ALIASES = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources -# only. Doxygen will then generate output that is more tailored for C. -# For instance, some of the names that are used will be different. The list -# of all members will be omitted, etc. - -OPTIMIZE_OUTPUT_FOR_C = NO - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources -# only. Doxygen will then generate output that is more tailored for Java. -# For instance, namespaces will be presented as packages, qualified scopes -# will look different, etc. - -OPTIMIZE_OUTPUT_JAVA = NO - -# Set the SUBGROUPING tag to YES (the default) to allow class member groups of -# the same type (for instance a group of public functions) to be put as a -# subgroup of that type (e.g. under the Public Functions section). Set it to -# NO to prevent subgrouping. Alternatively, this can be done per class using -# the \nosubgrouping command. - -SUBGROUPING = YES - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. -# Private class members and static file members will be hidden unless -# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES - -EXTRACT_ALL = YES - -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class -# will be included in the documentation. - -EXTRACT_PRIVATE = NO - -# If the EXTRACT_STATIC tag is set to YES all static members of a file -# will be included in the documentation. - -EXTRACT_STATIC = NO - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) -# defined locally in source files will be included in the documentation. -# If set to NO only classes defined in header files are included. - -EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. When set to YES local -# methods, which are defined in the implementation section but not in -# the interface are included in the documentation. -# If set to NO (the default) only methods in the interface are included. - -EXTRACT_LOCAL_METHODS = NO - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members of documented classes, files or namespaces. -# If set to NO (the default) these members will be included in the -# various overviews, but no documentation section is generated. -# This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_MEMBERS = NO - -# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. -# If set to NO (the default) these classes will be included in the various -# overviews. This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all -# friend (class|struct|union) declarations. -# If set to NO (the default) these declarations will be included in the -# documentation. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any -# documentation blocks found inside the body of a function. -# If set to NO (the default) these blocks will be appended to the -# function's detailed documentation block. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. -# Set it to YES to include the internal documentation. - -INTERNAL_DOCS = NO - -# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate -# file names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# users are advised to set this option to NO. - -CASE_SENSE_NAMES = YES - -# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen -# will show members with their full class and namespace scopes in the -# documentation. If set to YES the scope will be hidden. - -HIDE_SCOPE_NAMES = NO - -# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen -# will put a list of the files that are included by a file in the documentation -# of that file. - -SHOW_INCLUDE_FILES = YES - -# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] -# is inserted in the documentation for inline members. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen -# will sort the (detailed) documentation of file and class members -# alphabetically by member name. If set to NO the members will appear in -# declaration order. - -SORT_MEMBER_DOCS = YES - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the -# brief documentation of file, namespace and class members alphabetically -# by member name. If set to NO (the default) the members will appear in -# declaration order. - -SORT_BRIEF_DOCS = NO - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be -# sorted by fully-qualified names, including namespaces. If set to -# NO (the default), the class list will be sorted only by class name, -# not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the -# alphabetical list. - -SORT_BY_SCOPE_NAME = NO - -# The GENERATE_TODOLIST tag can be used to enable (YES) or -# disable (NO) the todo list. This list is created by putting \todo -# commands in the documentation. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or -# disable (NO) the test list. This list is created by putting \test -# commands in the documentation. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or -# disable (NO) the bug list. This list is created by putting \bug -# commands in the documentation. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or -# disable (NO) the deprecated list. This list is created by putting -# \deprecated commands in the documentation. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional -# documentation sections, marked by \if sectionname ... \endif. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines -# the initial value of a variable or define consists of for it to appear in -# the documentation. If the initializer consists of more lines than specified -# here it will be hidden. Use a value of 0 to hide initializers completely. -# The appearance of the initializer of individual variables and defines in the -# documentation can be controlled using \showinitializer or \hideinitializer -# command in the documentation regardless of this setting. - -MAX_INITIALIZER_LINES = 30 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated -# at the bottom of the documentation of classes and structs. If set to YES the -# list will mention the files that were used to generate the documentation. - -SHOW_USED_FILES = YES - -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated -# by doxygen. Possible values are YES and NO. If left blank NO is used. - -QUIET = NO - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank -# NO is used. - -WARNINGS = YES - -# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings -# for undocumented members. If EXTRACT_ALL is set to YES then this flag will -# automatically be disabled. - -WARN_IF_UNDOCUMENTED = YES - -# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some -# parameters in a documented function, or documenting parameters that -# don't exist or using markup commands wrongly. - -WARN_IF_DOC_ERROR = YES - -# The WARN_FORMAT tag determines the format of the warning messages that -# doxygen can produce. The string should contain the $file, $line, and $text -# tags, which will be replaced by the file and line number from which the -# warning originated and the warning text. - -WARN_FORMAT = "$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning -# and error messages should be written. If left blank the output is written -# to stderr. - -WARN_LOGFILE = - -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag can be used to specify the files and/or directories that contain -# documented source files. You may enter file names like "myfile.cpp" or -# directories like "/usr/src/myproject". Separate the files or directories -# with spaces. - -INPUT = @top_srcdir@/usrp/host \ - @top_srcdir@/usrp/doc/other - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank the following patterns are tested: -# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp -# *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm - -FILE_PATTERNS = *.h \ - *.cc \ - *.dox - -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. -# If left blank NO is used. - -RECURSIVE = YES - -# The EXCLUDE tag can be used to specify files and/or directories that should -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. - -EXCLUDE = CVS \ - @top_srcdir@/usrp/host/swig - -# The EXCLUDE_SYMLINKS tag can be used select whether or not files or directories -# that are symbolic links (a Unix filesystem feature) are excluded from the input. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. - -EXCLUDE_PATTERNS = moc_*.cc - -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see -# the \include command). - -EXAMPLE_PATH = - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank all files are included. - -EXAMPLE_PATTERNS = - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude -# commands irrespective of the value of the RECURSIVE tag. -# Possible values are YES and NO. If left blank NO is used. - -EXAMPLE_RECURSIVE = NO - -# The IMAGE_PATH tag can be used to specify one or more files or -# directories that contain image that are included in the documentation (see -# the \image command). - -IMAGE_PATH = - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command <filter> <input-file>, where <filter> -# is the value of the INPUT_FILTER tag, and <input-file> is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. - -INPUT_FILTER = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will be used to filter the input files when producing source -# files to browse (i.e. when SOURCE_BROWSER is set to YES). - -FILTER_SOURCE_FILES = NO - -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will -# be generated. Documented entities will be cross-referenced with these sources. -# Note: To get rid of all source code in the generated output, make sure also -# VERBATIM_HEADERS is set to NO. - -SOURCE_BROWSER = NO - -# Setting the INLINE_SOURCES tag to YES will include the body -# of functions and classes directly in the documentation. - -INLINE_SOURCES = NO - -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct -# doxygen to hide any special comment blocks from generated source code -# fragments. Normal C and C++ comments will always remain visible. - -STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES (the default) -# then for each documented function all documented -# functions referencing it will be listed. - -REFERENCED_BY_RELATION = YES - -# If the REFERENCES_RELATION tag is set to YES (the default) -# then for each documented function all documented entities -# called/used by that function will be listed. - -REFERENCES_RELATION = YES - -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for -# which an include is specified. Set to NO to disable this. - -VERBATIM_HEADERS = YES - -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project -# contains a lot of classes, structs, unions or interfaces. - -ALPHABETICAL_INDEX = NO - -# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then -# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns -# in which this list will be split (can be a number in the range [1..20]) - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all -# classes will be put under the same header in the alphabetical index. -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that -# should be ignored while generating the index headers. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will -# generate HTML output. - -GENERATE_HTML = @enable_html_docs@ - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `html' will be used as the default path. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for -# each generated HTML page (for example: .htm,.php,.asp). If it is left blank -# doxygen will generate files with .html extension. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a -# standard header. - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a -# standard footer. - -HTML_FOOTER = - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading -# style sheet that is used by each HTML page. It can be used to -# fine-tune the look of the HTML output. If the tag is left blank doxygen -# will generate a default style sheet. Note that doxygen will try to copy -# the style sheet file to the HTML output directory, so don't put your own -# stylesheet in the HTML output directory as well, or it will be erased! - -HTML_STYLESHEET = - -# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, -# files or namespaces will be aligned in HTML using tables. If set to -# NO a bullet list will be used. - -HTML_ALIGN_MEMBERS = YES - -# If the GENERATE_HTMLHELP tag is set to YES, additional index files -# will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) -# of the generated HTML documentation. - -GENERATE_HTMLHELP = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can -# be used to specify the file name of the resulting .chm file. You -# can add a path in front of the file if the result should not be -# written to the html output directory. - -CHM_FILE = - -# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can -# be used to specify the location (absolute path including file name) of -# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run -# the HTML help compiler on the generated index.hhp. - -HHC_LOCATION = - -# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag -# controls if a separate .chi index file is generated (YES) or that -# it should be included in the master .chm file (NO). - -GENERATE_CHI = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag -# controls whether a binary table of contents is generated (YES) or a -# normal table of contents (NO) in the .chm file. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members -# to the contents of the HTML help documentation and to the tree view. - -TOC_EXPAND = NO - -# The DISABLE_INDEX tag can be used to turn on/off the condensed index at -# top of each HTML page. The value NO (the default) enables the index and -# the value YES disables it. - -DISABLE_INDEX = NO - -# This tag can be used to set the number of enum values (range [1..20]) -# that doxygen will group on one line in the generated HTML documentation. - -ENUM_VALUES_PER_LINE = 4 - -# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be -# generated containing a tree-like index structure (just like the one that -# is generated for HTML Help). For this to work a browser that supports -# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, -# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are -# probably better off using the HTML help feature. - -GENERATE_TREEVIEW = NO - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be -# used to set the initial width (in pixels) of the frame in which the tree -# is shown. - -TREEVIEW_WIDTH = 250 - -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- - -# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will -# generate Latex output. - -GENERATE_LATEX = @enable_latex_docs@ - -# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `latex' will be used as the default path. - -LATEX_OUTPUT = latex - -# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be -# invoked. If left blank `latex' will be used as the default command name. - -LATEX_CMD_NAME = latex - -# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to -# generate index for LaTeX. If left blank `makeindex' will be used as the -# default command name. - -MAKEINDEX_CMD_NAME = makeindex - -# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact -# LaTeX documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_LATEX = NO - -# The PAPER_TYPE tag can be used to set the paper type that is used -# by the printer. Possible values are: a4, a4wide, letter, legal and -# executive. If left blank a4wide will be used. - -PAPER_TYPE = letter - -# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX -# packages that should be included in the LaTeX output. - -EXTRA_PACKAGES = - -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for -# the generated latex document. The header should contain everything until -# the first chapter. If it is left blank doxygen will generate a -# standard header. Notice: only use this tag if you know what you are doing! - -LATEX_HEADER = - -# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated -# is prepared for conversion to pdf (using ps2pdf). The pdf file will -# contain links (just like the HTML output) instead of page references -# This makes the output suitable for online browsing using a pdf viewer. - -PDF_HYPERLINKS = YES - -# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of -# plain latex in the generated Makefile. Set this option to YES to get a -# higher quality PDF documentation. - -USE_PDFLATEX = NO - -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. -# command to the generated LaTeX files. This will instruct LaTeX to keep -# running if errors occur, instead of asking the user for help. -# This option is also used when generating formulas in HTML. - -LATEX_BATCHMODE = NO - -# If LATEX_HIDE_INDICES is set to YES then doxygen will not -# include the index chapters (such as File Index, Compound Index, etc.) -# in the output. - -LATEX_HIDE_INDICES = NO - -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- - -# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output -# The RTF output is optimized for Word 97 and may not look very pretty with -# other RTF readers or editors. - -GENERATE_RTF = NO - -# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `rtf' will be used as the default path. - -RTF_OUTPUT = rtf - -# If the COMPACT_RTF tag is set to YES Doxygen generates more compact -# RTF documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_RTF = NO - -# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated -# will contain hyperlink fields. The RTF file will -# contain links (just like the HTML output) instead of page references. -# This makes the output suitable for online browsing using WORD or other -# programs which support those fields. -# Note: wordpad (write) and others do not support links. - -RTF_HYPERLINKS = NO - -# Load stylesheet definitions from file. Syntax is similar to doxygen's -# config file, i.e. a series of assignments. You only have to provide -# replacements, missing definitions are set to their default value. - -RTF_STYLESHEET_FILE = - -# Set optional variables used in the generation of an rtf document. -# Syntax is similar to doxygen's config file. - -RTF_EXTENSIONS_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- - -# If the GENERATE_MAN tag is set to YES (the default) Doxygen will -# generate man pages - -GENERATE_MAN = NO - -# The MAN_OUTPUT tag is used to specify where the man pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `man' will be used as the default path. - -MAN_OUTPUT = man - -# The MAN_EXTENSION tag determines the extension that is added to -# the generated man pages (default is the subroutine's section .3) - -MAN_EXTENSION = .3 - -# If the MAN_LINKS tag is set to YES and Doxygen generates man output, -# then it will generate one additional man file for each entity -# documented in the real man page(s). These additional files -# only source the real man page, but without them the man command -# would be unable to find the correct page. The default is NO. - -MAN_LINKS = NO - -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- - -# If the GENERATE_XML tag is set to YES Doxygen will -# generate an XML file that captures the structure of -# the code including all documentation. - -GENERATE_XML = @enable_xml_docs@ - -# The XML_OUTPUT tag is used to specify where the XML pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `xml' will be used as the default path. - -XML_OUTPUT = xml - -# The XML_SCHEMA tag can be used to specify an XML schema, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_SCHEMA = - -# The XML_DTD tag can be used to specify an XML DTD, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_DTD = - -# If the XML_PROGRAMLISTING tag is set to YES Doxygen will -# dump the program listings (including syntax highlighting -# and cross-referencing information) to the XML output. Note that -# enabling this will significantly increase the size of the XML output. - -XML_PROGRAMLISTING = YES - -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- - -# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will -# generate an AutoGen Definitions (see autogen.sf.net) file -# that captures the structure of the code including all -# documentation. Note that this feature is still experimental -# and incomplete at the moment. - -GENERATE_AUTOGEN_DEF = NO - -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- - -# If the GENERATE_PERLMOD tag is set to YES Doxygen will -# generate a Perl module file that captures the structure of -# the code including all documentation. Note that this -# feature is still experimental and incomplete at the -# moment. - -GENERATE_PERLMOD = NO - -# If the PERLMOD_LATEX tag is set to YES Doxygen will generate -# the necessary Makefile rules, Perl scripts and LaTeX code to be able -# to generate PDF and DVI output from the Perl module output. - -PERLMOD_LATEX = NO - -# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be -# nicely formatted so it can be parsed by a human reader. This is useful -# if you want to understand what is going on. On the other hand, if this -# tag is set to NO the size of the Perl module output will be much smaller -# and Perl will parse it just the same. - -PERLMOD_PRETTY = YES - -# The names of the make variables in the generated doxyrules.make file -# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. -# This is useful so different doxyrules.make files included by the same -# Makefile don't overwrite each other's variables. - -PERLMOD_MAKEVAR_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- - -# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will -# evaluate all C-preprocessor directives found in the sources and include -# files. - -ENABLE_PREPROCESSING = YES - -# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro -# names in the source code. If set to NO (the default) only conditional -# compilation will be performed. Macro expansion can be done in a controlled -# way by setting EXPAND_ONLY_PREDEF to YES. - -MACRO_EXPANSION = NO - -# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES -# then the macro expansion is limited to the macros specified with the -# PREDEFINED and EXPAND_AS_PREDEFINED tags. - -EXPAND_ONLY_PREDEF = NO - -# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files -# in the INCLUDE_PATH (see below) will be search if a #include is found. - -SEARCH_INCLUDES = YES - -# The INCLUDE_PATH tag can be used to specify one or more directories that -# contain include files that are not input files but should be processed by -# the preprocessor. - -INCLUDE_PATH = - -# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard -# patterns (like *.h and *.hpp) to filter out the header-files in the -# directories. If left blank, the patterns specified with FILE_PATTERNS will -# be used. - -INCLUDE_FILE_PATTERNS = - -# The PREDEFINED tag can be used to specify one or more macro names that -# are defined before the preprocessor is started (similar to the -D option of -# gcc). The argument of the tag is a list of macros of the form: name -# or name=definition (no spaces). If the definition and the = are -# omitted =1 is assumed. - -PREDEFINED = - -# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then -# this tag can be used to specify a list of macro names that should be expanded. -# The macro definition that is found in the sources will be used. -# Use the PREDEFINED tag if you want to use a different macro definition. - -EXPAND_AS_DEFINED = - -# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then -# doxygen's preprocessor will remove all function-like macros that are alone -# on a line, have an all uppercase name, and do not end with a semicolon. Such -# function macros are typically used for boiler-plate code, and will confuse the -# parser if not removed. - -SKIP_FUNCTION_MACROS = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- - -# The TAGFILES option can be used to specify one or more tagfiles. -# Optionally an initial location of the external documentation -# can be added for each tagfile. The format of a tag file without -# this location is as follows: -# TAGFILES = file1 file2 ... -# Adding location for the tag files is done as follows: -# TAGFILES = file1=loc1 "file2 = loc2" ... -# where "loc1" and "loc2" can be relative or absolute paths or -# URLs. If a location is present for each tag, the installdox tool -# does not have to be run to correct the links. -# Note that each tag file must have a unique name -# (where the name does NOT include the path) -# If a tag file is not located in the directory in which doxygen -# is run, you must also specify the path to the tagfile here. - -TAGFILES = - -# When a file name is specified after GENERATE_TAGFILE, doxygen will create -# a tag file that is based on the input files it reads. - -GENERATE_TAGFILE = - -# If the ALLEXTERNALS tag is set to YES all external classes will be listed -# in the class index. If set to NO only the inherited external classes -# will be listed. - -ALLEXTERNALS = NO - -# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed -# in the modules index. If set to NO, only the current project's groups will -# be listed. - -EXTERNAL_GROUPS = YES - -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of `which perl'). - -PERL_PATH = /usr/bin/perl - -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- - -# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will -# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base or -# super classes. Setting the tag to NO turns the diagrams off. Note that this -# option is superseded by the HAVE_DOT option below. This is only a fallback. It is -# recommended to install and use dot, since it yields more powerful graphs. - -CLASS_DIAGRAMS = YES - -# If set to YES, the inheritance and collaboration graphs will hide -# inheritance and usage relations if the target is undocumented -# or is not a class. - -HIDE_UNDOC_RELATIONS = YES - -# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is -# available from the path. This tool is part of Graphviz, a graph visualization -# toolkit from AT&T and Lucent Bell Labs. The other options in this section -# have no effect if this option is set to NO (the default) - -HAVE_DOT = @HAVE_DOT@ - -# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect inheritance relations. Setting this tag to YES will force the -# the CLASS_DIAGRAMS tag to NO. - -CLASS_GRAPH = YES - -# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect implementation dependencies (inheritance, containment, and -# class references variables) of the class with other documented classes. - -COLLABORATION_GRAPH = YES - -# If the UML_LOOK tag is set to YES doxygen will generate inheritance and -# collaboration diagrams in a style similar to the OMG's Unified Modeling -# Language. - -UML_LOOK = NO - -# If set to YES, the inheritance and collaboration graphs will show the -# relations between templates and their instances. - -TEMPLATE_RELATIONS = NO - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT -# tags are set to YES then doxygen will generate a graph for each documented -# file showing the direct and indirect include dependencies of the file with -# other documented files. - -INCLUDE_GRAPH = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and -# HAVE_DOT tags are set to YES then doxygen will generate a graph for each -# documented header file showing the documented files that directly or -# indirectly include this file. - -INCLUDED_BY_GRAPH = YES - -# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will -# generate a call dependency graph for every global function or class method. -# Note that enabling this option will significantly increase the time of a run. -# So in most cases it will be better to enable call graphs for selected -# functions only using the \callgraph command. - -CALL_GRAPH = NO - -# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen -# will graphical hierarchy of all classes instead of a textual one. - -GRAPHICAL_HIERARCHY = YES - -# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. Possible values are png, jpg, or gif -# If left blank png will be used. - -DOT_IMAGE_FORMAT = png - -# The tag DOT_PATH can be used to specify the path where the dot tool can be -# found. If left blank, it is assumed the dot tool can be found on the path. - -DOT_PATH = - -# The DOTFILE_DIRS tag can be used to specify one or more directories that -# contain dot files that are included in the documentation (see the -# \dotfile command). - -DOTFILE_DIRS = - -# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of -# nodes that will be shown in the graph. If the number of nodes in a graph -# becomes larger than this value, doxygen will truncate the graph, which is -# visualized by representing a node as a red box. Note that doxygen if the -# number of direct children of the root node in a graph is already larger than -# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note -# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. - -DOT_GRAPH_MAX_NODES = 50 - -# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the -# graphs generated by dot. A depth value of 3 means that only nodes reachable -# from the root by following a path via at most 3 edges will be shown. Nodes -# that lay further from the root node will be omitted. Note that setting this -# option to 1 or 2 may greatly reduce the computation time needed for large -# code bases. Also note that the size of a graph can be further restricted by -# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. - -MAX_DOT_GRAPH_DEPTH = 0 - -# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent -# background. This is disabled by default, because dot on Windows does not -# seem to support this out of the box. Warning: Depending on the platform used, -# enabling this option may lead to badly anti-aliased labels on the edges of -# a graph (i.e. they become hard to read). - -DOT_TRANSPARENT = NO - -# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output -# files in one run (i.e. multiple -o and -T options on the command line). This -# makes dot run faster, but since only newer versions of dot (>1.8.10) -# support this, this feature is disabled by default. - -DOT_MULTI_TARGETS = YES - -# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will -# generate a legend page explaining the meaning of the various boxes and -# arrows in the dot generated graphs. - -GENERATE_LEGEND = YES - -# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will -# remove the intermediate dot files that are used to generate -# the various graphs. - -DOT_CLEANUP = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to the search engine -#--------------------------------------------------------------------------- - -# The SEARCHENGINE tag specifies whether or not a search engine should be -# used. If set to NO the values of all tags below this one will be ignored. - -SEARCHENGINE = NO diff --git a/usrp/doc/Makefile.am b/usrp/doc/Makefile.am deleted file mode 100644 index 0eddc623a..000000000 --- a/usrp/doc/Makefile.am +++ /dev/null @@ -1,71 +0,0 @@ -# -# Copyright 2001,2005,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 $(top_srcdir)/Makefile.common - - -SUBDIRS = other - -man3dir = $(mandir)/man3 -usrp_docdir = $(prefix)/share/doc/usrp-$(DOCVER) - -EXTRA_DIST += \ - Doxyfile.in \ - ddc.eps \ - ddc.png \ - usrp-block-diagram.eps \ - usrp-block-diagram.png \ - usrp.jpg \ - usrp_guide.xml - -if HAS_XMLTO -DOCBOOK_HTML_FILES=usrp_guide.html -all-local: dox docbook-html -else -DOCBOOK_HTML_FILES= -all-local: dox -endif - -dist_usrp_doc_DATA = $(top_srcdir)/usrp/README - -dox: html/index.html -html/index.html: - $(MKDIR_P) html - @DOXYGEN@ - -docbook-html: usrp_guide.html - -usrp_guide.html: usrp_guide.xml - xmlto html-nochunks $(top_srcdir)/usrp/doc/usrp_guide.xml - -install-data-local: - $(MKDIR_P) $(DESTDIR)$(usrp_docdir)/html - @for i in $(DOCBOOK_HTML_FILES); do \ - echo "$(INSTALL_DATA) $$i $(DESTDIR)$(usrp_docdir)/html"; \ - $(INSTALL_DATA) $$i $(DESTDIR)$(usrp_docdir)/html; \ - done - cp -r html $(DESTDIR)$(usrp_docdir) - -uninstall-local: - $(RM) -fr $(DESTDIR)$(usrp_docdir)/html - -clean-local: - $(RM) -fr latex html man xml $(DOCBOOK_HTML_FILES) diff --git a/usrp/doc/ddc.eps b/usrp/doc/ddc.eps deleted file mode 100644 index 8931a16a4..000000000 --- a/usrp/doc/ddc.eps +++ /dev/null @@ -1,3105 +0,0 @@ -%!PS-Adobe-3.0 EPSF-3.0 -%%BoundingBox: 0 0 755 575 -%%Pages: 0 -%%Creator: Sun Microsystems, Inc. -%%Title: none -%%CreationDate: none -%%LanguageLevel: 2 -%%EndComments -%%BeginPreview: 760 575 1 1725 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000010008000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000300FE001800C100000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000701CF001800C300000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000F03830018000300000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000003F03000018000300000000000 -%00000000000000001F800000000000031800000000000000000000000000780000000000000000 -%000000000000000000000000000000000000000000F00019C03000000000000000000000000000 -%0000000007303000019E0CFC0000000000 -%00000000000000007FE00000000000031800000000000000C00000000000F80000000000000000 -%000000000000000000000000000000000000000001E00019C03000000000000000000000000000 -%000000000030638001FF0C7C0000000000 -%000000000000000060700000000000030000000000000000C00000000000C00000000000000000 -%000000000000000000000000000000000000000003000019E03000000000000000000000000000 -%0000000000307FE001C38C300000000000 -%0000000000000000E0380000000000030000000000000000C00000000000C00000000000000000 -%000000000000000000000000000000000000000003000031F03000000000000000000000000000 -%000000000030787001C18C300000000000 -%0000000000000000E0000C04202002030842002100110181F01000000001F02000000000000000 -%000000000000000000000000000000000000000007C08031B03000000000000000000000000000 -%000000000030703001818C300000000000 -%0000000000000000E0007F86FDF87FC3187FC0FF803F8FF1F8FE001FFC03F9FC00000000000000 -%00000000000000000000000000000000000000000FE7F031B83000000000000000000000000000 -%0000000000307033F181CC300000000000 -%00000000000000007C00E3879FBC78C31879C1CF803F9C70E1C7001FFC00C38E00000000000000 -%0000000000000000000000000000000000000000030E38219C3000000000000000000000000000 -%0000000000307033F981CC300000000000 -%00000000000000003FC0C1C70E0C70631860E30780381838C38300000000C30600000000000000 -%0000000000000000000000000000000000000000030C18618C3000000000000000000000000000 -%00000000003070300181CC300000000000 -%000000000000000007E000C60E0C60631860630380380038C30180000000C30000000000000000 -%0000000000000000000000000000000000000000030C00618E3000000000000000000000000000 -%000000000030303001818C300000000000 -%000000000000000000F001C60E0C60731860670380380038C30380000000C3C000000000000000 -%0000000000000000000000000000000000000000030F804187300001B6DBFFFB6DB00000000000 -%000000000030303001C18C300000000000 -%000000000000000000383FC60E0C60331860670380380FF8C3FF801FFC00C1FC00000000000000 -%00000000000000000000000000000000000000000307F041833000000000000000000000000000 -%0000000000301C6001E30C300000000000 -%0000000000000001C018F8C60E0C60731860670380381E38C300001FFC00C03E00000000000000 -%00000000000000000000000000000000000000000300F8C183B000000000000000000000000000 -%0000000000300FC001FF0C3C0000000000 -%0000000000000001C019C0C60E0C60731860670380383838C30000000000C00700000000000000 -%000000000000000000000000000000000000000003001CC181F000000000000000000000000000 -%0000000000300780019C0C1C0000000000 -%0000000000000000E039C1C60E0C70631860630380383038C30180000000C30700000000000000 -%0000000000000000000000000000000000000000030C0C8180F000000000000000000000000000 -%0000000000000000000000000000000000 -%0000000000000000F071C1C60E0C70E31860638780383078E38380000000C30600000000000000 -%0000000000000000000000000000000000000000030C1D8180F000000000000000080000000000 -%0000000000000000000000000000000000 -%00000000000000007FE0E7C60E0C7FC3186061FF80381CF8F9FF00000000C3DE00000000000000 -%00000000000000000000000000000000000000000307F981807000000000000000040000000000 -%0000000000000000000000000000000000 -%00000000000000001FC07CC60E0C7F83186060FB80380F98787C00000000C0FC00000000000000 -%00000000000000000000000000000000000000000303F181803000000000000000020000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000060000000000300000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000060000000030300000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000060000000038700000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000010000000000 -%0000000000000000000000000000000000 -%00000000000000000000000000006000000001FE00000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000060000000007800000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000008000000000 -%0008000000000000000018000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000004000000000 -%000C000180000060000018000000001000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000C000380000060000018000000003000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000004000000000 -%000C000380000060000018000000003000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000C000380000060000018000000003000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%03DC1F87E1F001F87E0019E01F00F87E00 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000001000000000 -%0FFC7FC7C7FC00F0FF001FF83FC3FC7C00 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%1C3C60C38E0C0061C3801C1870E30E3000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000001000000000 -%181C60E38C0C006181801C1CE063043000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000800000000 -%181C00E3800C006300C0181CC033803000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%381C0FE381FC006300C0181CC033F03000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000400000000 -%380C7FE387FC006300C0181CC030FC3000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%181C60E38E0C006300C0181CC0300E3000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%181CC0E38C0C006381C0181CC072063000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%1C1CC0E38C1C00618180181C6067063800 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0E3CE1E38E3C0071C380181C70E38E3800 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000100000000 -%07FC7F61E7EC0078FF00181C3FC1FC1E00 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000100000000 -%01881C60E3C600383C0018080F00F00E00 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000080000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000080000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000040000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000040000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000020000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000020000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000003000000C01803C03FC00000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000003000000C0180FF03FF00000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000003000000C0181E7C38F80000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000C018301C301C0000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000008000000 -%000000000000000C018300C301C0000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000004000000 -%00000603307E000C0183000301C0000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000070330FF800C0183C0030180000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000002000000 -%0000030631C1800C0181FC030380000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000002000000 -%000003063181800C01807F03FF00000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000001863001800C018007C3FF80000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000001000000 -%0000018C303F800C018001C301C0000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000018C30FD800C018000E300C0000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000800000 -%000000DC31C1800C018600E300E0000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000800000 -%000000D83181800E038700E300E0000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000F83183800E038380C300C0000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000400000 -%0000007031C78007FF03FF83FFC0000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000007030FD8003FE00FF03FF80000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000203070800070003C03FC00000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000200000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000100000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000040000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000020000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000010000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000010000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000004000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000004000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000002600 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000003E00 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%00000000000000000000000000000000000000000000000000000000000000000000000003FE00 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000003FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000001FE00 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%00000000000000000000020000000000000000000000000000000000000000000010000000FE00 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000200000000000000000000000000000000000000000000100000007E00 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000200000000000000000000000000000000000000000000100000003E00 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000200000000000000000000000000000000000000000000100000001E00 -%0000000000000000000000000000000000 -%000007000000000004003C00000000000000000000000000000000000F00000000000000000000 -%000000000000000000000200000000000000000000000000000000000000000000100000001E00 -%0000000000000000000000000000000000 -%00000700000000000C007C00000000000000000000000000000000007FE0000000000000000000 -%000000000000000000000200000000000000000000000000000000000000000000100000000E00 -%0000000000000000000000000000000000 -%00000700000000000C00600000000000000000000000000000000007FFFE000000000000000000 -%000000000000000000000200000000000000000000000000000000000000000000100000000600 -%0000000000000000000000000000000000 -%00000700000000000C0060000000000000000000000000000000001F801F800000000000000000 -%000000000000000000000200000000000000000000000000000000000000000000100000000200 -%0000000000000000000000000000000000 -%00000719E06F03033F01FCDC1E06787800000000000000000000007C0003E00000000000000000 -%000000000000000000000200000000000000000000000000000000000000000000100000000000 -%0000000000000000000000000000000000 -%0000071FF87FC3031F01F8FC7F87FDFC0000000000000000000000F80001F00000000000000000 -%000000000000000000000200000000000000000000000000000000000000000000100000000000 -%0000000000000000000000000000000000 -%0000071E1870E3030C0060E0E1C78F0C0000000000000000000001C00000380000000000000000 -%000000000000000000000200000000000000000000000000000000000000000000100000000000 -%0000000000000000000000000000000000 -%0000071C1C6063030C0060C0C0E7060E00000000000000000000038000001C0000000000000000 -%000000000000000000000200000000000000000000000000000000000000000000100000000000 -%0000000000000000000000000000000000 -%0000071C0C6063030C0060C18067060E00000000000000000000078000000E0000000000000000 -%000000000000000000000200000000000000000000000000000000000000000000100000000000 -%0000000000000000000000000000000000 -%000007180C6063030C0060C18067060E000000000000000000000CC000001B0000000000000000 -%000000000000000000000200000000000000000000000000000000000000000000100000000000 -%0000000000000000000000000000000000 -%000007180C6063030C0060C18067060E0000000000000000000018600000318000000000000000 -%000000000000000000000200000000000000000000000000000000000000000000100000000000 -%0000000000000000000000000000000000 -%000007180C6063030C0060C18067060E0000000000000000000018300000618000000000000000 -%000000000000000000000200000000000000000000000000000000000000000000100000000000 -%0000000000000000000000000000000000 -%000007180C6063070C0060C1C067060E0000000000000000000030180000C0C000000000000000 -%000000000000000000000200000000000000000000000000000000000000000000100000000000 -%0000000000000001800000000000000000 -%000007180C60E3070C0060C0C0C7060E00000000000000000000300C000180C000000000000000 -%000000000000000000000200000000000000000000000000000000000000000000100000000000 -%0000000000000001800000000000000000 -%000007180C71C38F0C0060C0E1C7060E0000000000000000000060060003006000000000000000 -%000000000000000000000200000000000000000000000000000000000000000000100000000000 -%0000000000000001800000000000000000 -%000007180C7F81FB0F0060C07F87060E0000000000000000000040030006002000000000000000 -%000000000000000000000200000000000000000000000000000000000000000000100000000000 -%0000000000000001800000000000000000 -%000006180C6700F3070060C01E07060600000000000000000000C001800C003000000000000000 -%000000000000000000000200000000000000000000000000000000000000000000100000000000 -%0000000000000001800000000000000000 -%0000000000600000000000000000000000000000000000000000C000C01C003000000000000000 -%000000000000000000000200000000000000000000000000000000000000000000100000000000 -%0000000000000001800000000000000000 -%0000000000600000000000000000000000000000000000000001C0006038003800000000000000 -%000000000000000000000200000000000000000000000000000000000000000000100000000000 -%0000000000000001800000000000000000 -%0000000000600000000000000000000000000000000000000601C0003070003800000000000000 -%000000000000000000700200000000000000000000000000000000000000000000100000000000 -%0000000060000001800000000000000000 -%00000000006000000000000000000000000000000000000007E1800018E0001800000000000000 -%0000000000000000007F0200000000000000000000000000000000000000000000100000000000 -%000000007E000001800000000000000000 -%00000000000000000000000000000000000000000000000007FD80000DC0001800000000000000 -%0000000000000000007FC200000000000000000000000000000000000000000000100000000000 -%000000007FC00001800000000000000000 -%00000000000000000000000000000000000000000000000007FF80000780001800000000000000 -%0000000000000000007FFA00000003FF0000000060000000000300000000000000100000000000 -%000000007FF00001800000000000000000 -%0000000000000000000000000000000000000000000000000FFF80000700001C00000000000000 -%0000000000000000007FFA00000003FF800000006000000000C300000000000000100000000000 -%00000000FFF00001800000000000000000 -%00000000000000000000000000000000000000000000000007FD80000780001800000000000000 -%0000000000000000007FC20000000301C00000000000000000C000000000000000100000000000 -%000000007FC00001800000000000000000 -%00000000000000000000000000000000000000000000000007F180000DC0001800000000000000 -%0000000000000000007F020000000300E00000000000000000C000000000000000100000000000 -%000000007E000001800000000000000000 -%00000000000001007F0000200000000000000000000000000601800018E0001800000000000000 -%00000000000000000070020000000300601800404210100301E200400420000000100000000000 -%0000000060000001800000000000000000 -%00000000000003807FF003FC0000000000000000000000000001C0003070003800000000000000 -%00000000000000000000020000000300707F03F8637EFC1FE3F31BF03F60000000100000000000 -%0000000000000001800000000000000000 -%00000000000007807FF807FF0000000000000000000000000001C0006038003800000000000000 -%0000000000000000000002000000030030E7871C63CFDE1CF0C31F3879E0000000100000000000 -%0000000000000001800000000000000000 -%00000000000006C0601C0E070000000000000000000000000000C000C018003000000000000000 -%000000000000000000000200000003003181860C6387063030C31C1C60E0000000100000000000 -%0000000000000000000000000000000000 -%00000000000006C0600C1C038000000000000000000000000000C001800C003000000000000000 -%000000000000000000000200000003003181CC006307060030C31C1CE060000000100000000000 -%0000000000000000000000000000000000 -%0000000000000C60600E18018000000000000000000000000000C0030006003000000000000000 -%000000000000000000000200000003003381CC006303060070C3181CC060000000100000000000 -%0000000000000000000000000000000000 -%0000000000000C6060063800000000000000000000000000000040060003002000000000000000 -%0000000000000000000002000000030033FFCC006303060FF0C3181CC060000000100000000000 -%0000000000000000000000000000000000 -%0000000000001C70600638000000000000000000000000000000600C0001806000000000000000 -%0000000000000000000002000000030073800C006303063E30C3181CC060000000100000000000 -%0000000000000000000000000000000000 -%000000000000183060063800000000000000000000000000000020180000C04000000000000000 -%0000000000000000000002000000030063800C006303063030C3181CC060000000100000000000 -%0000000000000000000000000000000000 -%00000000000018306006380000000000000000000000000000003070000060C000000000000000 -%00000000000000000000020000000300E1818E0E6303063030C3181C60E0000000100000000000 -%0000000000000000000000000000000000 -%000000000000383860063800000000000000000000000000000038E0000031C000000000000000 -%00000000000000000000020000000301C1C1860C6303063070C3181C60E0000000100000000000 -%0000000000000000000000000000000000 -%0000000000003FF86006180000000000000000000000000000001CC000001B8000000000000000 -%000000000000000000000200000003FFC0FF87BC63030639F0F3181C3FE0000000100000000000 -%0000000000000000000000000000000000 -%000000000000301C600E180180000000000000000000000000000F8000000F0000000000000000 -%000000000000000000000200000003FF007E01F06303061FB873181C1F60000000100000000000 -%0000000000000000000000000000000000 -%000000000000600C600C1C038000000000000000000000000000070000000E0000000000000000 -%000000000000000000000200000000000000000000000000000000000060000000100000000000 -%0000000000000000000000000000000000 -%000000000000600C601C0E038000000000000000000000000000038000001C0000000000000000 -%000000000000000000000200000000000000000000000000000000004060000000100000000000 -%0000000000000000000000000000000000 -%000000000000E00E6078078F000000000000000000000000000001E00000780000000000000000 -%0000000000000000000002000000000000000000000000000000000061C0000000100000000000 -%0000000000000000000000000000000000 -%000000000000C0067FF003FE000000000000000000000000000000F80001F00000000000000000 -%000000000000000000000200000000000000000000000000000000003F80000000100000000000 -%0000000000000000000000000000000000 -%000000000000C0067FC000F00000000000000000000000000000003E0007C00000000000000000 -%000000000000000000000200000000000000000000000000000000000F00000000100000000000 -%0000000000000000000000000000000000 -%00000000000000000000000000000000000000000000000000000007F07E000000000000000000 -%000000000000000000000200000000000000000000000000000000000000000000100000000000 -%0000000000000000000000000000000000 -%00000000000000000000000000000000000000000000000000000003FFFC000000000000000000 -%000000000000000000000200000000000000000000000000000000000000000000100000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000007FE0000000000000000000 -%000000000000000000000200000000000000000000000000000000000000000000100000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%000000000000000000000200000000000000000000000000000000000000000000100000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%000000000000000000000200000000000000000000000000000000000000000000100000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000600000000000000000000 -%00000000000000000000020000000000C000000000007FE0000000000000000000100000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000600000000000000000000 -%00000000000000000000020000000000C000000000007FF8000000000000000000100000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000600000000000000000000 -%00000000000000000000020000000000C00000000000701C000000000000000000100000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000F00000000000000000000 -%00000000000000000000020000000000C00000000000701C000000000000000000100000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000F00000000000000000000 -%00000000000000000000020000000000C000E040C080700C0700E00C0000000000100000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000F00000000000000000000 -%00000000000000000000020000000000C003F860C180700C3FC3F83F8000000000100000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000001F00000000000000000000 -%00000000000000000000020000000000C0071C61E180700C71E31C738000000000100000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000001F80000000000000000000 -%00000000000000000000020000000000C00E0E61E180701C60660C61C000000000100000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000003F80000000000000000000 -%00000000000000000000020000000000C00C0631E3007FF8006700600000000000100000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000003FC0000000000000000000 -%00000000000000000000020000000000C00C0731B3007FF000E3C0780000000000100000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%00000000000000000000020000000000C00C0733330070003FE1F83F8000000000100000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%00000000000000000000020000000000C00C071B360070007C607C07C000000000100000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%00000000000000000000020000000000C00C061B3600700060600E01C000000000100000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%00000000000000000000020000000000C00C061E1E007000E0E606C0C000000000100000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%00000000000000000000020000000000C00E0E1E1E007000E0E70E60C000000000100000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%00000000000000000000020000000000FFC7FC0E1C00700077E3FC7F8000000000100000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%00000000000000000000020000000000FFC1F00E1C0070003E61F83F0000000000100000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%000000000000000000000200000000000000000000000000000000000000000000100000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%000000000000000000000200000000000000000000000000000000000000000000100000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%000000000000000000000200000000000000000000000000000000000000000000100000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%000000000000000000000200000000000000000000000000000000000000000000100000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%000000000000000000000200000000000000000000000000000000000000000000100000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%000000000000000000000200000000000000000000000000000000000000000000100000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000003 -%C00000000000000000000200000000000000000000000000000000000000000000100000000000 -%0000000000000000000000000000000000 -%000007000000000000003C0000000000000000000000000000000000040000000000000000001F -%FC0000000000000000000200000000000000000000000000000000000000000000100000000000 -%0000000000000000000000000000000000 -%00000700000000000C007C000000000000000000000000000000000004000000000000000001FC -%7FC000000000000000000200000000000000000000000000000000000000000000100000000000 -%0000000000000000000000000000000000 -%00000700000000000C0060000000000000000000000000000000000004000000000000000007E0 -%07E000000000000000000200000000000000000000000000000000000000000000100000000000 -%0000000000000000000000000000000000 -%00000700000000000C006000000000000000000000000000000000000400000000000000001F00 -%00F80000000000000000020000000000000000FFE3180000000000000000000000100000000000 -%0000000000000000000000000000000000 -%00000718E04703021F01F89C1E0238700000000000000000000000000400000000000000007800 -%001C0000000000000000020000000000000000FFE3186000000000000000000000100000000000 -%0000000000000000000000000000000000 -%0000071BF07F83033F01FCFC7F87FCFC000000000000000000000000040000000000000000E000 -%000E0000000000000000020000000000000000C000186000000000000000000000100000000000 -%0000000000000000000000000000000000 -%0000071F3879C3030C0060FCF1C7CF9C000000000000000000000000040000000000000000E000 -%00070000000000000000020000000000000000C000186000000000000000000000100000000000 -%0000000000000000000000000000000000 -%0000071C1C70E3030C0060C0C0C7070E000000000000000000000000040000000000000001E000 -%00038000000000000000020000000000000000C00318F81C046000000000000000100000000000 -%0000000000000000000000000000000000 -%0000071C0C6063030C0060C1C067060E0000000000000000000000000400000000000000033000 -%0007C000000000000000020000000000000000C00318FC7F07F000000000000000100000000000 -%0000000000000000000000000000000000 -%000007180C6063030C0060C18067060E0000000000000000000000000400000000000000061800 -%000CE000000000000000020000000000000000C0031870E387E000000000000000100000000000 -%0000000000000000000000000000000000 -%000007180C6063030C0060C18067060E0000000000000000000000000400000000000000061C00 -%00187000000000000000020000000000000000FFC3186181870000000000000000100000000000 -%0000000000000000000000000000000000 -%000007180C6063030C0060C18067060E0000000000000000000000000400000000000000040E00 -%00307000000000000000020000000000000000FFC3186180C60000000000000000100000000000 -%0000000000000007C00000000000000000 -%000007180C6063030C0060C18067060E00000000000000000000000004000000000000000C0700 -%00603800000000000000020000000000000000C0031861FFC60000000000000000100000000000 -%000000000000001FF00000000000000000 -%000007180C6063070C0060C0C0E7060E0000000000000000000000000400000000000000180380 -%00C03800000000000000020000000000000000C0031861FFC60000000000000000100000000000 -%00000000000000383C0000000000000000 -%000007180C70C3070C0060C0E1C7060E00000000000000000000000004000000000000001801C0 -%01801800000000000000020000000000000000C003186180060000000000000000100000000000 -%00000000000000701C0000000000000000 -%000007180C7FC3FF0F0060C07F87060E00000000000000000000000004000000000000003000E0 -%03001C00000000000000020000000000000000C003186180060000000000000000100000000000 -%00000000000000E00E0000000000000000 -%000007180C6F00F3070060C03F07060E0000000000000000000000000400000000000000300060 -%06000C00000000000000020000000000000000C003186180C60000000000000000100000000000 -%00000000000000C0060000000000000000 -%000000000060000000000000000000000000000000000000000000000400000000000000300030 -%0C000C00000000000000020000000000000000C0031871C1860000000000000000100000000000 -%00000000000001C0070000000000000000 -%000000000060000000000000000000000000000000000000000000000400000000000C00300018 -%18000400000000000070020000000000000000C003187CFF860000000000000000100000000000 -%00000000600001C0070000000000000000 -%000000000060000000000000000000000000000000000000000000000400000000000FE060000E -%3000060000000000007F020000000000000000C003183C3E060000000000000000100000000000 -%000000007E0001C0070000000000000000 -%000000000060000000000000000000000000000000000000000000000400000000000FF8600006 -%6000060000000000007FC200000000000000000000000000000000000000000000100000000000 -%000000007FC001C0070000000000000000 -%000000000060000000000000000000000000000000000000000000000400000000000FFF600003 -%C000060000000000007FFA00000000000000000000000000000000000000000000100000000000 -%00000000FFF001C0070000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000FFE600001 -%C000060000000000007FFA00000000000000000000000000000000000000000000100000000000 -%00000000FFF000C0060000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000FF8600003 -%C000060000000000007FC200000000000000000000000000000000000000000000100000000000 -%000000007FC000C0060000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000FE0600006 -%6000060000000000007F0200000000000000000000000000000000000000000000100000000000 -%000000007E000060EC0000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000C0060000C -%380006000000000000700200000000000000000000000000000000000000000000100000000000 -%00000000600000707C0000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000700018 -%180006000000000000000200000000000000000000000000000000000000000000100000000000 -%000000000000003FFC0000000000000000 -%00000000000003807FE001FC000000000000000000000000000000000400000000000000300030 -%0C000C000000000000000200000000000000000000000000000000000000000000100000000000 -%000000000000000FEE0000000000000000 -%00000000000003807FF807FE000000000000000000000000000000000400000000000000300070 -%07000C000000000000000200000000000000000000000000000000000000000000100000000000 -%0000000000000000030000000000000000 -%00000000000006C0603C0E070000000000000000000000000000000004000000000000003000E0 -%03000C000000000000000200000000000000000000000000000000000000000000100000000000 -%0000000000000000000000000000000000 -%00000000000006C0600C0C038000000000000000000000000000000004000000000000003001C0 -%01801C000000000000000200000000000000000000000000000000000000000000100000000000 -%0000000000000000000000000000000000 -%0000000000000EE0600E1801800000000000000000000000000000000400000000000000180380 -%00E018000000000000000200000000000000000000000000000000000000000000100000000000 -%0000000000000000000000000000000000 -%0000000000000C60600E1800000000000000000000000000000000000400000000000000180700 -%007038000000000000000200000000000000000000000000000000000000000000100000000000 -%0000000000000000000000000000000000 -%0000000000000C60600638000000000000000000000000000000000004000000000000000C0E00 -%003838000000000000000200000000000000000000000000000000000000000000100000000000 -%0000000000000000000000000000000000 -%0000000000001C70600638000000000000000000000000000000000004000000000000000C1C00 -%001C70000000000000000200000000000000000000000000000000000000000000100000000000 -%0000000000000000000000000000000000 -%000000000000183060063800000000000000000000000000000000000400000000000000061800 -%000E70000000000000000200000000000000000000000000000000000000000000100000000000 -%0000000000000000000000000000000000 -%000000000000183860063800000000000000000000000000000000000400000000000000033000 -%0007E0000000000000000200000000000000000000000000000000000000000000100000000000 -%0000000000000000000000000000000000 -%0000000000003FF86006380000000000000000000000000000000000040000000000000001A000 -%000380000000000000000200000000000000000000000000000000000000000000100000000000 -%0000000000000000000000000000000000 -%0000000000003FF8600E180180000000000000000000000000000000040000000000000000C000 -%000300000000000000000200000000000000000000000000000000000000000000100000000000 -%0000000000000000000000000000000000 -%000000000000701C600E1C0180000000000000000000000000000000040000000000000000E000 -%000700000000000000000200000000000000000000000000000000000000000000100000000000 -%0000000000000000000000000000000000 -%000000000000600C601C0C03800000000000000000000000000000000400000000000000007C00 -%003E00000000000000000200000000000000000000000000000000000000000000100000000000 -%0000000000000000000000000000000000 -%000000000000E00E603C0F07000000000000000000000000000000000400000000000000003E00 -%00FC00000000000000000200000000000000000000000000000000000000000000100000000000 -%0000000000000000000000000000000000 -%000000000000E00E7FF807FE000000000000000000000000000000000400000000000000000F80 -%01F000000000000000000200000000000000000000000000000000000000000000100000000000 -%0000000000000000000000000000000000 -%000000000000C0067FE001F80000000000000000000000000000000004000000000000000003FC -%3F8000000000000000000200000000000000000000000000000000000000000000100000000000 -%0000000000000000000000000000000000 -%0000000000000000000000000000000000000000000000000000000004000000000000000000FF -%FF0000000000000000000200000000000000000000000000000000000000000000100000000000 -%0000000000000000000000000000000000 -%00000000000000000000000000000000000000000000000000000000040000000000000000001F -%F80000000000000000000200000000000000000000000000000000000000000000100000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000001 -%000000000000000000000200000000000000000000000000000000000000000000100000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%000000000000000000000200000000000000000000000000000000000000000000100000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000003 -%0000000000000000000003FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE00000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000003 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000007 -%00000000000000000000000000000000000000000000C000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000007 -%80000000000000000000000000000000000000000000C000000000000000000000000000000000 -%0000000000000000000000000000000000 -%00000000000000000000000000000000000000000000000000000000040000000000000000000F -%80000000000000000000000000000000000000000001E000000000000000000000000000000000 -%0000000000000000000000000000000000 -%00000000000000000000000000000000000000000000000000000000040000000000000000000F -%80000000000000000000000000000000000000000001E000000000000000000000000000000000 -%0000000000000000000000000000000000 -%00000000000000000000000000000000000000000000000000000000040000000000000000000F -%C0000000000000000000000000000000000000000001E000000000000000000000000000000000 -%0000000000000000000000000000000000 -%00000000000000000000000000000000000000000000000000000000040000000000000000000F -%C0000000000000000000000000000000000000000003F000000000000000000000000000000000 -%0000000000000000000000000000000000 -%00000000000000000000000000000000000000000000000000000000040000000000000000000F -%C0000000000000000000000000000000000000000003F000000000000000000000000000000000 -%0000000000000000000000000000000000 -%00000000000000000000000000000000000000000000000000000000040000000000000000001F -%C0000000000000000000000000000000000000000003F000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%00000000000000000000000000000000000000000003F000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%00000000000000000000000000000000000000000007F800000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%00000000000000000000000000000000000000000000C000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000C00000400000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000C00000400000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000800000400000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%0000000000000000000000000000000000000000000000007E0C6FC00400000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000E70C7FE00400000000000000000000 -%0007807807C0000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000C38C70600400000000000000000000 -%001FC1FE0FE0000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000C00C60600400000000000000000000 -%003863871870000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000F00C60600400000000000000000000 -%003033039830000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%0000000000000000000000000000000000000000000000007E0C60600400000000000000000000 -%007007019800000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%0000000000000000000000000000000000000000000000001F8C60600400000000000000000000 -%006007019F80000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000038C60600400000000000000000000 -%0060060187E0000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000818C60600400000000000000000000 -%0060070180F0000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000C18C60600400000000000000000000 -%007037018038000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000E38C60600400000000000000000000 -%003033039838000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%0000000000000000000000000000000000000000000000007F0C60600400000000000000000000 -%003863871830000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%001FE1FE0FF0000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%0007807C07C0000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000400000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%0000000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF -%FFFFFFFFFFFFFFFFC0000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%0000000000000000000000000000000000000000800000000000000000001803003E000F800000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%0000000000000000000000000000000000000000800000000000000000001C0300FF803FE00000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%0000000000000000000000000000000000000000800000000000000000001E0303C1C070780000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%0000000000000000000000000000000000000000800000000000000000001E030300C0E0380000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%0000000000000000000000000000000000000000800000000000000000001F030700E1C01C0000 -%00000000000000004000000000000001FF00000000006000018006086000000000000000000000 -%0000000000000000000000000000000000 -%0000000000000000000000000000000000000000800000000000000000001B83060001800C0000 -%00000000000000004000000000000001FFC0000000006000018006186000000000000000000000 -%0000000000000000000000000000000000 -%00000000000000000000000000000000000000008000000000000000000019C30E0003800E0000 -%0000000000000000400000000000000180C0000000006000000006186000000000000000000000 -%0000000000000000000000000000000000 -%00000000000000000000000000000000000000008000000000000000000019C30E0003800E0000 -%0000000000000000400000000000000180E0000000006000000006186000000000000000000000 -%0000000000000000000000000000000000 -%00000000000000000000000000000000000000008000000000000000000018E30C0003800E0000 -%0000000000000000400000000000000180603C08E00E66060D80C67E6700000000000000000000 -%0000000000000000000000000000000000 -%00000000000000000000000000000000000000008000000000000000000018630E0003800E0000 -%000000000000000040000000000000018060FF1FF83FE30E0D83F67E6FC0000000000000000000 -%0000000000000000000000000000000000 -%00000000000000000000000000000000000000008000000000000000000018330E0003800E0000 -%0000000000000000400000000000000180C1C71F3871E30E0D871E1878E0000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000183B060061800C0000 -%00000000000000004000000000000001FF83831C1C60E30F198E0E187060000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000181B060061800C0000 -%00000000000000004000000000000001FF80031C0CE0630B198C0E186060000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000181F0700E0C01C0000 -%0000000000000000400000000000000181E0071C0CE0619B198C06186060000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000180F0381C0E0380000 -%000000000000000040000000000000018060FF1C0CC0619B318C06186060000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000180701FF807FF00000 -%000000000000000040000000000000018071E31C0CC06199B18C06186060000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000180700FF001FC00000 -%000000000000000040000000000000018073831C0CE060F1B18C06186060000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%000000000000000040000000000000018073031C0C6060F1E18E0E186060000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%0000000000000000400000000000000180E3071C0C70E0F0E1861E186060000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%00000000000000004000000000000001FFC1FF9C0C3FE070E187FE1E6060000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%00000000000000004000000000000001FF80F99C0C0F6060E181E60E6060000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000003E0300000000006000FC00000003 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%00000000000000000000000000000000000000008000000000FF830000000000C003FF00000003 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%00000000000000000000000000000000000000008000000001C1C00000000000C0070780000000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%0000000000000000000000000000000000000000800000000380E00000000000C00E0180000000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%0000000000000000000000000000000000000000800000000380400000000000800C01C0000000 -%000000000000000040000000000000000C000000180000000010C0000000000000000000000000 -%0000000000000000000000000000000000 -%0000000000000000000000000000000000000000800000000380031BF81F8001801C0001FC1FC3 -%1BF03F800000000040000000000000000C000000180000000030C0000000000000000000000000 -%0000000000000000000000000000000000 -%00000000000000000000000000000000000000008000000001F0031F3839C001801800039E38E3 -%1F3879C00000000040000000000000000C00000000000000003000000000000000000000000000 -%0000000000000000000000000000000000 -%00000000000000000000000000000000000000008000000000FE031C1C60600100180007073063 -%1C1860E00000000040000000000000000C00000000000000003000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000001FC31C0C60700300180006033003 -%1C1CC060000000004000000000000001CC07001C18CF0E01F07CC07819E0000000000000000000 -%0000000000000000000000000000000000 -%0000000000000000000000000000000000000000800000000003C31C0CE070030018000E033C03 -%181CE060000000004000000000000007EC1FC07F18FFBF83FC7CC0FE1BF0000000000000000000 -%0000000000000000000000000000000000 -%0000000000000000000000000000000000000000800000000000E31C0CFFF0030018000E031FC3 -%181CFFE000000000400000000000000E3C38E0E398F1F3861C30C1C71E38000000000000000000 -%0000000000000000000000000000000000 -%0000000000000000000000000000000000000000800000000300631C0CE00006001C00CE0303E3 -%181CC00000000000400000000000000C1C6070C198E0C18E0C30C3839C18000000000000000000 -%0000000000000000000000000000000000 -%0000000000000000000000000000000000000000800000000300631C0CE00006000C01CE030073 -%181CC0000000000040000000000000180C60318018E0C1800C30C3019818000000000000000000 -%0000000000000000000000000000000000 -%0000000000000000000000000000000000000000800000000380631C0C606006000E0186073073 -%181CE0600000000040000000000000180C7FF18018C0C1803C30C301981C000000000000000000 -%0000000000000000000000000000000000 -%00000000000000000000000000000000000000008000000003C0C31C0C70600400070387063073 -%181C70E00000000040000000000000180C7FF18018C0C183FC30C701981C000000000000000000 -%0000000000000000000000000000000000 -%00000000000000000000000000000000000000008000000001FFC31C0C3DE00C0003FF03DE3DE3 -%181C3BC00000000040000000000000180C60018018C0C1878C30C701981C000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000007F031C0C1F800C0001FC01F80FC3 -%181C1F800000000040000000000000180C60018098C0C18C0C30C301981C000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%0000000000000000400000000000000C1C7031C1D8C0C18C0C30C301981C000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%0000000000000000400000000000000E1C7060C198C0C18C1C30C383981C000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%00000000000000004000000000000007FC3FE07F18C0C187FE3EC1FF181C000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%00000000000000004000000000000003CC0F803E18C0C183E61EC07C181C000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%00000000000000000000000000000000000000008000000000000007E000000000000000000000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%0000000000000000000000000000000000000000800000000000001FF800000000000000006000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000381C00000000000000006000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000700E00000000000000006000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%00000000000000000000000000000000000000008000000000000060060300860030110180F818 -%088000000000000040000000000000001E00000010000000000000380700000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000E0001FC0DF81FC3F8FF0F8FE -%0FE000000000000040000000000000003E000000300000000000003C0700000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000C0003CE0F9C38E3F9C7061C7 -%0FC0000000000000400000000000000030000000300000000000003C0700000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000C0003030E0C3073818386383 -%8E00000000000000400000000000000030000000300000000000003E0700000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000C0FE6030C0E6033800386301 -%8C000000000000004000000000000000FE1F00F07E1F037007FF00360700000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000C0FF7030C0E7033800386301 -%CC000000000000004000000000000000FE7FC1FC7C3F83F007FF00330700000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000C0077FF0C0E7FF380FF86301 -%CC0000000000000040000000000000003061C38E3071C3D0000000338700000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000E0076000C0E600381E386301 -%CC00000000000000400000000000000030E0C70630C0E38000000031C700000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000E0076000C0E6003838386301 -%CC0000000000000040000000000000003000C60030C0630000000030C700000000000000000000 -%0000000000000000000000000000000000 -%00000000000000000000000000000000000000008000000000000070077030C0E7033830386301 -%8C0000000000000040000000000000003007C60030C0630000000030E700000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000381E3870C0E3073830786383 -%8C000000000000004000000000000000303FC60031C0730007FF00307700000000000000000000 -%0000000000000000000000000000000000 -%0000000000000000000000000000000000000000800000000000001FFC1FE0C0E3FE381CF879FF -%0C0000000000000040000000000000003070C60030C0630007FF00303700000000000000000000 -%0000000000000000000000000000000000 -%00000000000000000000000000000000000000008000000000000007F00FC0C0E0FC380F983C7C -%0C00000000000000400000000000000030C0C60230C06300000000303F00000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%0000000000000000400000000000000030C0C60630C06300000000301F00000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%0000000000000000400000000000000030E1C30E38E0E300000000300F00000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%00000000000000004000000000000000307FE3FC3E7FC300000000300F00000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%00000000000000004000000000000000303C60F01E1F0300000000300700000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000080000000000000000000000000000000000000 -%000000000000000040000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%0000000000000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF -%FFFFFFFFFFFFFFFFC0000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000010000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000018000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000018000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%00000000000000000000000000000000000000000000000000000000000000000003C000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%00000000000000000000000000000000000000000000000000000000000000000003C000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%00000000000000000000000000000000000000000000000000000000000000000003C000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%00000000000000000000000000000000000000000000000000000000000000000007C000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%00000000000000000000000000000000000000000000000000000000000000000007C000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%0000000000000000000000000000000000000000000000000000000000000000000FE000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%0000000000000000000000000000000000000000000000000000000000000000000FE000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%0000000000000000000000000000000000000000000000000000000000000000000FF000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%0000000000000000000000000000000000000000000000000000000000000000000FF000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000010000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000010000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000010000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000010000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000010000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000010000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000010000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000010000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000010000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000010000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000010000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000010000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000010000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000010000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000010000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000010000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000010000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000010000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000010000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000010000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000010000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000010000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000010000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000010000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000010000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000010000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000010000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000010000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000010000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000010000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000010000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000010000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000010000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000010000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000010000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000010000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000010000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000010000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000010000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000010000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%0000000000000000000000000000000000000000000001F800000000000000000F000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%0000000000000000000000000000000000000000000007FE00000000C00000001F000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000E0F00000000C000000018000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000001C0300000000C000000018000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%00000000000000000000000000000000000000000000180380000000E000000038000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%00000000000000000000000000000000000000000000380003F837E3F0FC0FC07F7F1FC07EC606 -%0FE0DF81FC60700000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000003800073C3CF0C1CE0FC0187F3CE0E7C606 -%1C70FBC38E70600000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%0000000000000000000000000000000000000000000030000C0C3870C3030E0018703071C1C606 -%3830E0C30630600000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%0000000000000000000000000000000000000000000030000C0E3030C3038C001870603181C606 -%3018C0C60030E00000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%0000000000000000000000000000000000000000000030001C0E3030C7038C001870703181C606 -%3038C0C60038C00000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%0000000000000000000000000000000000000000000030001FFE3030C7FF8C0018707FF180C606 -%3FF8C0C60018C00000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%0000000000000000000000000000000000000000000038019C003030C7000C001870600180C606 -%3000C0C60019800000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%0000000000000000000000000000000000000000000018019C003030C7000C001870600181C606 -%3000C0C6000D800000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000001C030C0C3030C3030C001870703181C606 -%3018C0C6060D000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000E070E0C3030C3830C0018703871C3C70E -%3838C0C3060F000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%0000000000000000000000000000000000000000000007FE07BC3030F1EF0C0018703FE0F7C3FE -%1EF0C0C3DE07000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%0000000000000000000000000000000000000000000003F803F0303070FC0C0018700FC07DC1F6 -%07E0C0C0F806000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%00000000000000000000000000000000000000000000000000000000000000000000000001C000 -%000000000006000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%00000000000000000000000000000000000000000000000000000000000000000000000001C000 -%000000000006000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%00000000000000000000000000000000000000000000000000000000000000000000000001C000 -%00000000001C000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%00000000000000000000000000000000000000000000000000000000000000000000000001C000 -%000000000038000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000008000 -%000000000030000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000001E000187C00000000000003C0 -%0060F8000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000003E00011FF000C0000000007C0 -%0063FC000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%00000000000000000000000000000000000000000000000000000300003183001C000000000E00 -%00670E000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%00000000000000000000000000000000000000000000000000000300003303801C000000380C00 -%004606000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%00000000000000000000000000000000000000000000000000000FC1802301803E030000381F03 -%00C607000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%00000000000000000000000000000000000000000000000000000FC7F06001803F1FC000381F9F -%C0C006000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%0000000000000000000000000000000000000000000000000000070E706003801C38E000380C18 -%E08006000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%0000000000000000000000000000000000000000000000000000031C386007001C707003FF8C30 -%60800E000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%0000000000000000000000000000000000000000000000000000031C00C00E001C603003FF8C38 -%01801C000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%0000000000000000000000000000000000000000000000000000030F00C01C001C603800380C1E -%018038000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000FE307E0C038001C603800380C0F -%C10070000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000FE300F88070001C603800380C03 -%E300E0000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000003003980E0001C603800380C00 -%7303C0000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000003181981C0001C703000380C30 -%330300000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%0000000000000000000000000000000000000000000000000000031C190380001C307000000C38 -%760600000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%0000000000000000000000000000000000000000000000000000030FF103FF800F3FE000000C1F -%E60FFE000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%00000000000000000000000000000000000000000000000000000307E303FF800F0FC000000C0F -%C60FFF000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%%EndPreview -%%BeginProlog -%%BeginResource: SDRes -/b4_inc_state save def -/dict_count countdictstack def -/op_count count 1 sub def -userdict begin -0 setgray 0 setlinecap 1 setlinewidth 0 setlinejoin 10 setmiterlimit[] 0 setdash newpath -/languagelevel where {pop languagelevel 1 ne {false setstrokeadjust false setoverprint} if} if -/bdef {bind def} bind def -/c {setgray} bdef -/l {neg lineto} bdef -/rl {neg rlineto} bdef -/lc {setlinecap} bdef -/lj {setlinejoin} bdef -/lw {setlinewidth} bdef -/ml {setmiterlimit} bdef -/ld {setdash} bdef -/m {neg moveto} bdef -/ct {6 2 roll neg 6 2 roll neg 6 2 roll neg curveto} bdef -/r {rotate} bdef -/t {neg translate} bdef -/s {scale} bdef -/sw {show} bdef -/gs {gsave} bdef -/gr {grestore} bdef -/f {findfont dup length dict begin -{1 index /FID ne {def} {pop pop} ifelse} forall /Encoding ISOLatin1Encoding def -currentdict end /NFont exch definefont pop /NFont findfont} bdef -/p {closepath} bdef -/sf {scalefont setfont} bdef -/ef {eofill}bdef -/pc {closepath stroke}bdef -/ps {stroke}bdef -/pum {matrix currentmatrix}bdef -/pom {setmatrix}bdef -/bs {/aString exch def /nXOfs exch def /nWidth exch def currentpoint nXOfs 0 rmoveto pum nWidth aString stringwidth pop div 1 scale aString show pom moveto} bdef -%%EndResource -%%EndProlog -%%BeginSetup -%%EndSetup -%%Page: 1 1 -%%BeginPageSetup -%%EndPageSetup -pum -0.02834 0.02833 s -0 -20290 t -/tm matrix currentmatrix def -gs -tm setmatrix --635 -635 t -1 1 s -635 635 m 27274 635 l 27274 20924 l 635 20924 l 635 635 l eoclip newpath -0 lw 1 lj 0.000 c 17781 10461 m 14606 10461 l 14606 6016 l 20956 6016 l -20956 10461 l 17781 10461 l pc -gs -pum -15663 7567 t -65 0 m 65 -606 l 274 -606 l 321 -606 357 -603 382 -597 ct 416 -589 446 -575 471 -554 ct -503 -527 526 -492 542 -450 ct 558 -408 566 -360 566 -306 ct 566 -260 561 -219 550 -184 ct -539 -148 525 -119 509 -95 ct 492 -72 473 -54 453 -40 ct 433 -27 409 -17 381 -10 ct -353 -3 320 0 284 0 ct p -145 -71 m 275 -71 l 315 -71 346 -75 369 -82 ct 391 -90 409 -100 423 -114 ct -442 -133 457 -158 467 -190 ct 478 -222 483 -261 483 -307 ct 483 -371 473 -419 452 -453 ct -431 -487 406 -510 376 -522 ct 355 -530 320 -534 272 -534 ct 145 -534 l p ef -965 -141 m 1042 -131 l 1030 -86 1007 -52 975 -27 ct 942 -2 900 9 849 9 ct -785 9 734 -9 696 -49 ct 658 -88 640 -144 640 -215 ct 640 -289 659 -347 697 -387 ct -735 -428 784 -449 845 -449 ct 903 -449 951 -429 989 -389 ct 1026 -349 1044 -292 1044 -220 ct -1044 -216 1044 -209 1044 -200 ct 716 -200 l 719 -152 733 -115 757 -89 ct 782 -64 813 -51 849 -51 ct -877 -51 900 -58 919 -72 ct 938 -87 l 954 -110 l p -721 -261 m 966 -261 l 963 -298 953 -326 938 -344 ct 914 -373 883 -387 845 -387 ct -811 -387 783 -376 759 -353 ct 736 -330 l 723 -300 l p ef -1427 -160 m 1500 -151 l 1492 -100 1472 -61 1439 -32 ct 1406 -4 1365 9 1317 9 ct -1257 9 1209 -9 1172 -49 ct 1136 -88 1118 -144 1118 -217 ct 1118 -265 1125 -306 1141 -342 ct -1157 -378 1181 -404 1213 -422 ct 1245 -440 1280 -449 1318 -449 ct 1365 -449 1404 -437 1435 -412 ct -1465 -388 1485 -354 1493 -310 ct 1421 -299 l 1414 -328 1402 -350 1384 -365 ct -1367 -380 1345 -387 1321 -387 ct 1283 -387 1253 -374 1229 -347 ct 1206 -320 1194 -278 1194 -220 ct -1194 -161 1205 -118 1228 -91 ct 1251 -64 1280 -51 1317 -51 ct 1346 -51 1370 -60 1390 -78 ct -1409 -96 l 1422 -123 l p ef -1564 -520 m 1564 -606 l 1638 -606 l 1638 -520 l p -1564 0 m 1564 -439 l 1638 -439 l 1638 0 l p ef -1748 0 m 1748 -439 l 1815 -439 l 1815 -377 l 1829 -399 1847 -416 1870 -429 ct -1893 -442 1919 -449 1948 -449 ct 1981 -449 2007 -442 2028 -428 ct 2049 -415 2064 -396 2072 -372 ct -2107 -423 2152 -449 2208 -449 ct 2251 -449 2285 -437 2308 -412 ct 2332 -388 2343 -351 2343 -301 ct -2343 0 l 2269 0 l 2269 -276 l 2269 -306 2267 -327 2262 -340 ct 2257 -354 2249 -364 2236 -372 ct -2223 -380 2208 -384 2191 -384 ct 2160 -384 2135 -374 2114 -353 ct 2094 -333 2084 -300 2084 -255 ct -2084 0 l 2009 0 l 2009 -285 l 2009 -318 2003 -343 1991 -359 ct 1979 -376 1959 -384 1932 -384 ct -1911 -384 1891 -379 1873 -368 ct 1856 -357 1843 -340 1835 -319 ct 1827 -298 1823 -267 1823 -227 ct -1823 0 l p ef -2750 -54 m 2722 -30 2696 -14 2670 -4 ct 2645 5 2617 9 2588 9 ct 2540 9 2503 -1 2477 -25 ct -2451 -49 2438 -79 2438 -115 ct 2438 -137 2443 -156 2453 -174 ct 2463 -192 2475 -206 2491 -217 ct -2507 -228 2525 -236 2545 -241 ct 2559 -245 2581 -249 2611 -253 ct 2671 -260 2715 -268 2744 -278 ct -2744 -288 2744 -295 2744 -298 ct 2744 -328 2737 -349 2723 -362 ct 2704 -379 2676 -387 2638 -387 ct -2603 -387 2577 -381 2561 -369 ct 2544 -356 2532 -335 2524 -303 ct 2451 -313 l -2458 -345 2468 -370 2484 -389 ct 2499 -408 2521 -423 2549 -433 ct 2578 -443 2611 -449 2649 -449 ct -2687 -449 2717 -444 2740 -435 ct 2764 -427 2781 -415 2792 -402 ct 2803 -389 2811 -372 2815 -351 ct -2818 -339 2819 -316 2819 -283 ct 2819 -184 l 2819 -114 2821 -71 2824 -52 ct -2827 -34 2833 -16 2843 0 ct 2765 0 l 2757 -15 l 2752 -33 l p -2744 -220 m 2717 -209 2676 -200 2622 -192 ct 2592 -187 2570 -182 2557 -177 ct -2545 -171 2535 -163 2528 -153 ct 2521 -142 2518 -130 2518 -117 ct 2518 -98 2525 -81 2540 -68 ct -2555 -55 2577 -48 2606 -48 ct 2635 -48 2660 -54 2683 -67 ct 2705 -79 2721 -96 2732 -118 ct -2740 -135 2744 -160 2744 -193 ct p ef -3076 -66 m 3087 0 l 3066 3 3047 5 3030 5 ct 3003 5 2982 1 2968 -7 ct 2953 -15 2942 -26 2936 -40 ct -2930 -54 2927 -83 2927 -128 ct 2927 -381 l 2872 -381 l 2872 -439 l 2927 -439 l -2927 -547 l 3001 -592 l 3001 -439 l 3076 -439 l 3076 -381 l 3001 -381 l -3001 -124 l 3001 -103 3002 -89 3005 -83 ct 3008 -77 3012 -72 3018 -69 ct 3024 -65 3032 -63 3043 -63 ct -3051 -63 l 3062 -64 l p ef -3152 -520 m 3152 -606 l 3226 -606 l 3226 -520 l p -3152 0 m 3152 -439 l 3226 -439 l 3226 0 l p ef -3336 0 m 3336 -439 l 3403 -439 l 3403 -376 l 3436 -425 3482 -449 3543 -449 ct -3570 -449 3594 -444 3616 -434 ct 3638 -425 3655 -412 3666 -397 ct 3677 -382 3685 -363 3689 -342 ct -3692 -328 3693 -304 3693 -270 ct 3693 0 l 3619 0 l 3619 -267 l 3619 -297 3616 -320 3610 -335 ct -3604 -350 3594 -362 3579 -371 ct 3565 -380 3547 -384 3527 -384 ct 3496 -384 3468 -374 3445 -354 ct -3422 -334 3411 -296 3411 -239 ct 3411 0 l p ef -3799 36 m 3871 47 l 3874 69 3883 85 3896 95 ct 3915 109 3940 116 3972 116 ct -4006 116 4033 109 4052 95 ct 4071 82 4083 62 4090 38 ct 4094 22 4095 -8 4095 -57 ct -4063 -19 4022 0 3974 0 ct 3913 0 3867 -21 3833 -65 ct 3800 -108 3784 -161 3784 -222 ct -3784 -264 3791 -302 3807 -338 ct 3822 -373 3844 -400 3873 -420 ct 3901 -439 3935 -449 3974 -449 ct -4026 -449 4069 -428 4102 -386 ct 4102 -439 l 4171 -439 l 4171 -59 l 4171 8 4164 57 4150 85 ct -4136 114 4114 136 4084 153 ct 4054 169 4017 178 3972 178 ct 3920 178 3878 166 3845 142 ct -3813 119 l 3798 83 l p -3860 -227 m 3860 -169 3872 -127 3895 -101 ct 3918 -74 3946 -61 3981 -61 ct -4015 -61 4044 -74 4067 -101 ct 4090 -127 4101 -168 4101 -224 ct 4101 -278 4090 -319 4066 -346 ct -4042 -373 4013 -387 3979 -387 ct 3946 -387 3918 -374 3895 -347 ct 3872 -320 l -3860 -280 l p ef -pom -pum -16007 8520 t -62 0 m 62 -606 l 142 -606 l 142 -71 l 440 -71 l 440 0 l p ef -478 -219 m 478 -300 500 -361 545 -400 ct 583 -432 629 -449 684 -449 ct 744 -449 793 -429 832 -389 ct -870 -350 889 -295 889 -225 ct 889 -169 881 -124 864 -92 ct 847 -60 822 -34 790 -16 ct -757 0 722 9 684 9 ct 622 9 572 -9 534 -49 ct 497 -88 l 478 -145 l p -554 -219 m 554 -163 566 -121 591 -93 ct 615 -65 646 -51 684 -51 ct 721 -51 751 -65 776 -93 ct -800 -121 813 -164 813 -222 ct 813 -276 800 -317 776 -345 ct 751 -373 720 -387 684 -387 ct -646 -387 615 -373 591 -345 ct 566 -317 l 554 -275 l p ef -1062 0 m 928 -439 l 1005 -439 l 1075 -185 l 1101 -91 l 1102 -96 1110 -126 1124 -181 ct -1194 -439 l 1270 -439 l 1336 -184 l 1358 -100 l 1383 -185 l 1458 -439 l -1531 -439 l 1393 0 l 1316 0 l 1246 -263 l 1229 -337 l 1140 0 l p ef -1811 0 m 1811 -606 l 2040 -606 l 2080 -606 2111 -604 2132 -600 ct 2162 -595 2187 -586 2207 -572 ct -2227 -558 2243 -538 2255 -513 ct 2268 -488 2274 -461 2274 -430 ct 2274 -379 2257 -335 2224 -300 ct -2192 -264 2132 -246 2047 -246 ct 1891 -246 l 1891 0 l p -1891 -318 m 2048 -318 l 2100 -318 2136 -327 2158 -346 ct 2180 -366 2191 -393 2191 -428 ct -2191 -453 2185 -475 2172 -493 ct 2159 -511 2142 -523 2121 -529 ct 2108 -532 2083 -534 2046 -534 ct -1891 -534 l p ef -2644 -54 m 2616 -30 2590 -14 2564 -4 ct 2539 5 2511 9 2482 9 ct 2434 9 2397 -1 2371 -25 ct -2345 -49 2332 -79 2332 -115 ct 2332 -137 2337 -156 2347 -174 ct 2357 -192 2369 -206 2385 -217 ct -2401 -228 2419 -236 2439 -241 ct 2453 -245 2475 -249 2505 -253 ct 2565 -260 2609 -268 2638 -278 ct -2638 -288 2638 -295 2638 -298 ct 2638 -328 2631 -349 2617 -362 ct 2598 -379 2570 -387 2532 -387 ct -2497 -387 2471 -381 2455 -369 ct 2438 -356 2426 -335 2418 -303 ct 2345 -313 l -2352 -345 2362 -370 2378 -389 ct 2393 -408 2415 -423 2443 -433 ct 2472 -443 2505 -449 2543 -449 ct -2581 -449 2611 -444 2634 -435 ct 2658 -427 2675 -415 2686 -402 ct 2697 -389 2705 -372 2709 -351 ct -2712 -339 2713 -316 2713 -283 ct 2713 -184 l 2713 -114 2715 -71 2718 -52 ct -2721 -34 2727 -16 2737 0 ct 2659 0 l 2651 -15 l 2646 -33 l p -2638 -220 m 2611 -209 2570 -200 2516 -192 ct 2486 -187 2464 -182 2451 -177 ct -2439 -171 2429 -163 2422 -153 ct 2415 -142 2412 -130 2412 -117 ct 2412 -98 2419 -81 2434 -68 ct -2449 -55 2471 -48 2500 -48 ct 2529 -48 2554 -54 2577 -67 ct 2599 -79 2615 -96 2626 -118 ct -2634 -135 2638 -160 2638 -193 ct p ef -2778 -131 m 2851 -142 l 2855 -113 2867 -90 2886 -74 ct 2905 -59 2931 -51 2965 -51 ct -2999 -51 3024 -58 3041 -72 ct 3058 -86 3066 -102 3066 -121 ct 3066 -138 3059 -151 3044 -160 ct -3034 -167 3008 -175 2968 -186 ct 2913 -199 2875 -211 2854 -221 ct 2833 -231 2817 -245 2806 -263 ct -2795 -281 2790 -301 2790 -322 ct 2790 -342 2794 -360 2803 -376 ct 2812 -393 2825 -407 2840 -418 ct -2852 -427 2867 -434 2887 -440 ct 2907 -446 2929 -449 2952 -449 ct 2986 -449 3016 -444 3042 -434 ct -3069 -424 3088 -410 3100 -393 ct 3113 -376 3121 -354 3126 -325 ct 3053 -315 l -3050 -338 3040 -356 3024 -368 ct 3008 -381 2986 -387 2957 -387 ct 2923 -387 2898 -382 2884 -370 ct -2869 -359 2862 -346 2862 -331 ct 2862 -321 2865 -312 2871 -305 ct 2877 -297 2887 -290 2900 -285 ct -2907 -282 2929 -276 2965 -266 ct 3018 -252 3055 -240 3076 -231 ct 3096 -222 3113 -209 3125 -192 ct -3136 -175 3142 -154 3142 -129 ct 3142 -104 3135 -80 3121 -58 ct 3106 -37 3085 -20 3058 -8 ct -3031 3 3000 9 2965 9 ct 2908 9 2865 -1 2835 -25 ct 2805 -49 l 2786 -84 l p ef -3175 -131 m 3248 -142 l 3252 -113 3264 -90 3283 -74 ct 3302 -59 3328 -51 3362 -51 ct -3396 -51 3421 -58 3438 -72 ct 3455 -86 3463 -102 3463 -121 ct 3463 -138 3456 -151 3441 -160 ct -3431 -167 3405 -175 3365 -186 ct 3310 -199 3272 -211 3251 -221 ct 3230 -231 3214 -245 3203 -263 ct -3192 -281 3187 -301 3187 -322 ct 3187 -342 3191 -360 3200 -376 ct 3209 -393 3222 -407 3237 -418 ct -3249 -427 3264 -434 3284 -440 ct 3304 -446 3326 -449 3349 -449 ct 3383 -449 3413 -444 3439 -434 ct -3466 -424 3485 -410 3497 -393 ct 3510 -376 3518 -354 3523 -325 ct 3450 -315 l -3447 -338 3437 -356 3421 -368 ct 3405 -381 3383 -387 3354 -387 ct 3320 -387 3295 -382 3281 -370 ct -3266 -359 3259 -346 3259 -331 ct 3259 -321 3262 -312 3268 -305 ct 3274 -297 3284 -290 3297 -285 ct -3304 -282 3326 -276 3362 -266 ct 3415 -252 3452 -240 3473 -231 ct 3493 -222 3510 -209 3522 -192 ct -3533 -175 3539 -154 3539 -129 ct 3539 -104 3532 -80 3518 -58 ct 3503 -37 3482 -20 3455 -8 ct -3428 3 3397 9 3362 9 ct 3305 9 3262 -1 3232 -25 ct 3202 -49 l 3183 -84 l p ef -pom -pum -16827 9473 t -69 0 m 69 -606 l 478 -606 l 478 -534 l 149 -534 l 149 -346 l 434 -346 l -434 -275 l 149 -275 l 149 0 l p ef -585 -520 m 585 -606 l 659 -606 l 659 -520 l p -585 0 m 585 -439 l 659 -439 l 659 0 l p ef -768 0 m 768 -606 l 842 -606 l 842 0 l p ef -1118 -66 m 1129 0 l 1108 3 1089 5 1072 5 ct 1045 5 1024 1 1010 -7 ct 995 -15 984 -26 978 -40 ct -972 -54 969 -83 969 -128 ct 969 -381 l 914 -381 l 914 -439 l 969 -439 l -969 -547 l 1043 -592 l 1043 -439 l 1118 -439 l 1118 -381 l 1043 -381 l -1043 -124 l 1043 -103 1044 -89 1047 -83 ct 1050 -77 1054 -72 1060 -69 ct 1066 -65 1074 -63 1085 -63 ct -1093 -63 l 1104 -64 l p ef -1494 -141 m 1571 -131 l 1559 -86 1536 -52 1504 -27 ct 1471 -2 1429 9 1378 9 ct -1314 9 1263 -9 1225 -49 ct 1187 -88 1169 -144 1169 -215 ct 1169 -289 1188 -347 1226 -387 ct -1264 -428 1313 -449 1374 -449 ct 1432 -449 1480 -429 1518 -389 ct 1555 -349 1573 -292 1573 -220 ct -1573 -216 1573 -209 1573 -200 ct 1245 -200 l 1248 -152 1262 -115 1286 -89 ct -1311 -64 1342 -51 1378 -51 ct 1406 -51 1429 -58 1448 -72 ct 1467 -87 l 1483 -110 l -p -1250 -261 m 1495 -261 l 1492 -298 1482 -326 1467 -344 ct 1443 -373 1412 -387 1374 -387 ct -1340 -387 1312 -376 1288 -353 ct 1265 -330 l 1252 -300 l p ef -1669 0 m 1669 -439 l 1736 -439 l 1736 -372 l 1753 -403 1768 -424 1783 -434 ct -1797 -444 1813 -449 1831 -449 ct 1856 -449 1881 -441 1907 -425 ct 1882 -356 l -1863 -366 1845 -372 1827 -372 ct 1811 -372 1796 -367 1783 -357 ct 1770 -347 1761 -334 1755 -316 ct -1747 -290 1743 -261 1743 -229 ct 1743 0 l p ef -pom -gr -11317 10321 m 11312 10318 l 11099 10206 l 11093 10203 l 10924 10032 l -10921 10026 l 10811 9811 l 10808 9805 l 10769 9556 l 10769 9549 l -10808 9299 l 10811 9293 l 10921 9078 l 10924 9072 l 11093 8901 l 11099 8898 l -11312 8786 l 11317 8784 l 11564 8744 l 11571 8744 l 11817 8784 l 11823 8786 l -12036 8898 l 12041 8901 l 12210 9072 l 12213 9078 l 12324 9293 l 12326 9299 l -12366 9549 l 12366 9556 l 12326 9805 l 12324 9811 l 12213 10026 l -12210 10032 l 12041 10203 l 12036 10206 l 11823 10318 l 11817 10321 l -11571 10361 l 11564 10361 l 11317 10321 l p -11567 10319 m 11806 10279 l 12013 10171 l 12178 10004 l 12285 9794 l -12324 9552 l 12285 9310 l 12178 9100 l 12013 8933 l 11806 8825 l 11567 8786 l -11328 8825 l 11121 8933 l 10956 9100 l 10849 9310 l 10811 9552 l 10849 9794 l -10956 10004 l 11121 10171 l 11328 10279 l 11567 10319 l p -11049 9029 m 11079 8998 l 11286 9208 l 11493 9417 l 11700 9627 l 11907 9837 l -12115 10048 l 12085 10078 l 11877 9868 l 11670 9658 l 11463 9448 l -11255 9238 l 11049 9029 l p -11079 10078 m 11049 10049 l 11255 9838 l 11463 9628 l 11670 9418 l -11878 9208 l 12086 8998 l 12115 9029 l 11907 9239 l 11700 9449 l 11493 9659 l -11286 9869 l 11079 10078 l p ef -1 lw 0 lj 11317 10321 m 11312 10318 l 11099 10206 l 11093 10203 l 10924 10032 l -10921 10026 l 10811 9811 l 10808 9805 l 10769 9556 l 10769 9549 l -10808 9299 l 10811 9293 l 10921 9078 l 10924 9072 l 11093 8901 l 11099 8898 l -11312 8786 l 11317 8784 l 11564 8744 l 11571 8744 l 11817 8784 l 11823 8786 l -12036 8898 l 12041 8901 l 12210 9072 l 12213 9078 l 12324 9293 l 12326 9299 l -12366 9549 l 12366 9556 l 12326 9805 l 12324 9811 l 12213 10026 l -12210 10032 l 12041 10203 l 12036 10206 l 11823 10318 l 11817 10321 l -11571 10361 l 11564 10361 l 11317 10321 l pc -11567 10319 m 11806 10279 l 12013 10171 l 12178 10004 l 12285 9794 l -12324 9552 l 12285 9310 l 12178 9100 l 12013 8933 l 11806 8825 l 11567 8786 l -11328 8825 l 11121 8933 l 10956 9100 l 10849 9310 l 10811 9552 l 10849 9794 l -10956 10004 l 11121 10171 l 11328 10279 l 11567 10319 l pc -11049 9029 m 11079 8998 l 11286 9208 l 11493 9417 l 11700 9627 l 11907 9837 l -12115 10048 l 12085 10078 l 11877 9868 l 11670 9658 l 11463 9448 l -11255 9238 l 11049 9029 l pc -11079 10078 m 11049 10049 l 11255 9838 l 11463 9628 l 11670 9418 l -11878 9208 l 12086 8998 l 12115 9029 l 11907 9239 l 11700 9449 l 11493 9659 l -11286 9869 l 11079 10078 l pc -7989 6986 m 7538 6836 l 7539 7136 l 7989 6986 l p ef -5716 6986 m 7629 6986 l ps -14606 6986 m 14155 6836 l 14156 7136 l 14606 6986 l p ef -9526 6986 m 14246 6986 l ps -10769 9526 m 10318 9376 l 10319 9676 l 10769 9526 l p ef -5716 9526 m 10409 9526 l ps -14606 9526 m 14155 9376 l 14156 9676 l 14606 9526 l p ef -12426 9526 m 14246 9526 l ps -0 lw 1 lj 10061 16546 m 6251 16546 l 6251 12736 l 13871 12736 l 13871 16546 l -10061 16546 l pc -gs -pum -9102 13970 t -64 0 m 64 -606 l 146 -606 l 465 -130 l 465 -606 l 542 -606 l 542 0 l -459 0 l 141 -476 l 141 0 l p ef -1106 -212 m 1187 -192 l 1170 -126 1140 -76 1096 -41 ct 1052 -6 999 10 936 10 ct -870 10 817 -2 776 -29 ct 735 -56 704 -94 683 -145 ct 661 -195 651 -249 651 -307 ct -651 -370 663 -425 687 -472 ct 711 -519 745 -555 790 -580 ct 834 -604 883 -616 937 -616 ct -998 -616 1049 -601 1090 -570 ct 1131 -539 1160 -496 1176 -440 ct 1097 -421 l -1083 -465 1063 -497 1036 -517 ct 1009 -537 976 -547 935 -547 ct 889 -547 850 -536 818 -514 ct -787 -492 765 -462 752 -424 ct 740 -386 733 -348 733 -308 ct 733 -256 741 -211 756 -173 ct -771 -134 794 -105 826 -86 ct 858 -67 892 -58 929 -58 ct 974 -58 1012 -71 1043 -97 ct -1074 -123 l 1095 -161 l p ef -1284 -295 m 1284 -395 1311 -474 1366 -531 ct 1420 -588 1489 -617 1575 -617 ct -1631 -617 1681 -603 1726 -576 ct 1771 -550 1805 -512 1829 -465 ct 1852 -417 1864 -362 1864 -302 ct -1864 -240 1852 -185 1827 -137 ct 1802 -88 1767 -52 1722 -27 ct 1676 -2 1627 10 1574 10 ct -1517 10 1466 -3 1421 -31 ct 1376 -58 1342 -96 1319 -143 ct 1296 -191 l 1284 -242 l -p -1367 -294 m 1367 -220 1387 -163 1426 -121 ct 1465 -79 1515 -58 1574 -58 ct -1634 -58 1684 -79 1723 -122 ct 1762 -164 1782 -224 1782 -302 ct 1782 -352 1773 -395 1757 -431 ct -1740 -468 1715 -497 1683 -517 ct 1651 -537 1615 -547 1575 -547 ct 1518 -547 1470 -528 1429 -489 ct -1388 -450 l 1367 -385 l p ef -pom -pum -7514 14923 t -38 -194 m 113 -201 l 117 -171 125 -146 138 -126 ct 151 -107 172 -91 199 -79 ct -227 -67 258 -61 292 -61 ct 323 -61 350 -66 373 -75 ct 397 -84 414 -96 426 -112 ct -437 -128 443 -145 443 -164 ct 443 -183 437 -200 426 -214 ct 415 -228 397 -240 372 -250 ct -355 -256 319 -266 264 -279 ct 208 -293 169 -305 147 -317 ct 118 -332 96 -351 82 -374 ct -68 -396 61 -421 61 -449 ct 61 -480 69 -508 87 -535 ct 104 -561 130 -582 163 -595 ct -196 -609 233 -616 274 -616 ct 319 -616 359 -609 393 -594 ct 427 -580 454 -559 472 -531 ct -491 -502 501 -471 502 -435 ct 425 -429 l 421 -468 407 -496 383 -516 ct 359 -536 324 -545 277 -545 ct -229 -545 194 -537 171 -519 ct 149 -501 138 -480 138 -454 ct 138 -433 146 -415 162 -401 ct -177 -387 217 -372 283 -357 ct 348 -343 393 -330 417 -319 ct 452 -303 478 -282 495 -257 ct -512 -232 520 -203 520 -171 ct 520 -138 511 -108 492 -80 ct 474 -51 447 -29 413 -13 ct -378 2 339 10 296 10 ct 241 10 195 2 158 -13 ct 121 -29 92 -53 71 -85 ct 50 -117 l -39 -154 l p ef -638 -520 m 638 -606 l 712 -606 l 712 -520 l p -638 0 m 638 -439 l 712 -439 l 712 0 l p ef -822 0 m 822 -439 l 889 -439 l 889 -376 l 922 -425 968 -449 1029 -449 ct -1056 -449 1080 -444 1102 -434 ct 1124 -425 1141 -412 1152 -397 ct 1163 -382 1171 -363 1175 -342 ct -1178 -328 1179 -304 1179 -270 ct 1179 0 l 1105 0 l 1105 -267 l 1105 -297 1102 -320 1096 -335 ct -1090 -350 1080 -362 1065 -371 ct 1051 -380 1033 -384 1013 -384 ct 982 -384 954 -374 931 -354 ct -908 -334 897 -296 897 -239 ct 897 0 l p ef -1600 -141 m 1677 -131 l 1665 -86 1642 -52 1610 -27 ct 1577 -2 1535 9 1484 9 ct -1420 9 1369 -9 1331 -49 ct 1293 -88 1275 -144 1275 -215 ct 1275 -289 1294 -347 1332 -387 ct -1370 -428 1419 -449 1480 -449 ct 1538 -449 1586 -429 1624 -389 ct 1661 -349 1679 -292 1679 -220 ct -1679 -216 1679 -209 1679 -200 ct 1351 -200 l 1354 -152 1368 -115 1392 -89 ct -1417 -64 1448 -51 1484 -51 ct 1512 -51 1535 -58 1554 -72 ct 1573 -87 l 1589 -110 l -p -1356 -261 m 1601 -261 l 1598 -298 1588 -326 1573 -344 ct 1549 -373 1518 -387 1480 -387 ct -1446 -387 1418 -376 1394 -353 ct 1371 -330 l 1358 -300 l p ef -1958 10 m 2133 -616 l 2193 -616 l 2017 10 l p ef -2931 -212 m 3012 -192 l 2995 -126 2965 -76 2921 -41 ct 2877 -6 2824 10 2761 10 ct -2695 10 2642 -2 2601 -29 ct 2560 -56 2529 -94 2508 -145 ct 2486 -195 2476 -249 2476 -307 ct -2476 -370 2488 -425 2512 -472 ct 2536 -519 2570 -555 2615 -580 ct 2659 -604 2708 -616 2762 -616 ct -2823 -616 2874 -601 2915 -570 ct 2956 -539 2985 -496 3001 -440 ct 2922 -421 l -2908 -465 2888 -497 2861 -517 ct 2834 -537 2801 -547 2760 -547 ct 2714 -547 2675 -536 2643 -514 ct -2612 -492 2590 -462 2577 -424 ct 2565 -386 2558 -348 2558 -308 ct 2558 -256 2566 -211 2581 -173 ct -2596 -134 2619 -105 2651 -86 ct 2683 -67 2717 -58 2754 -58 ct 2799 -58 2837 -71 2868 -97 ct -2899 -123 l 2920 -161 l p ef -3097 -219 m 3097 -300 3119 -361 3164 -400 ct 3202 -432 3248 -449 3303 -449 ct -3363 -449 3412 -429 3451 -389 ct 3489 -350 3508 -295 3508 -225 ct 3508 -169 3500 -124 3483 -92 ct -3466 -60 3441 -34 3409 -16 ct 3376 0 3341 9 3303 9 ct 3241 9 3191 -9 3153 -49 ct -3116 -88 l 3097 -145 l p -3173 -219 m 3173 -163 3185 -121 3210 -93 ct 3234 -65 3265 -51 3303 -51 ct 3340 -51 3370 -65 3395 -93 ct -3419 -121 3432 -164 3432 -222 ct 3432 -276 3419 -317 3395 -345 ct 3370 -373 3339 -387 3303 -387 ct -3265 -387 3234 -373 3210 -345 ct 3185 -317 l 3173 -275 l p ef -3571 -131 m 3644 -142 l 3648 -113 3660 -90 3679 -74 ct 3698 -59 3724 -51 3758 -51 ct -3792 -51 3817 -58 3834 -72 ct 3851 -86 3859 -102 3859 -121 ct 3859 -138 3852 -151 3837 -160 ct -3827 -167 3801 -175 3761 -186 ct 3706 -199 3668 -211 3647 -221 ct 3626 -231 3610 -245 3599 -263 ct -3588 -281 3583 -301 3583 -322 ct 3583 -342 3587 -360 3596 -376 ct 3605 -393 3618 -407 3633 -418 ct -3645 -427 3660 -434 3680 -440 ct 3700 -446 3722 -449 3745 -449 ct 3779 -449 3809 -444 3835 -434 ct -3862 -424 3881 -410 3893 -393 ct 3906 -376 3914 -354 3919 -325 ct 3846 -315 l -3843 -338 3833 -356 3817 -368 ct 3801 -381 3779 -387 3750 -387 ct 3716 -387 3691 -382 3677 -370 ct -3662 -359 3655 -346 3655 -331 ct 3655 -321 3658 -312 3664 -305 ct 3670 -297 3680 -290 3693 -285 ct -3700 -282 3722 -276 3758 -266 ct 3811 -252 3848 -240 3869 -231 ct 3889 -222 3906 -209 3918 -192 ct -3929 -175 3935 -154 3935 -129 ct 3935 -104 3928 -80 3914 -58 ct 3899 -37 3878 -20 3851 -8 ct -3824 3 3793 9 3758 9 ct 3701 9 3658 -1 3628 -25 ct 3598 -49 l 3579 -84 l p ef -3998 -520 m 3998 -606 l 4072 -606 l 4072 -520 l p -3998 0 m 3998 -439 l 4072 -439 l 4072 0 l p ef -4183 0 m 4183 -439 l 4250 -439 l 4250 -376 l 4283 -425 4329 -449 4390 -449 ct -4417 -449 4441 -444 4463 -434 ct 4485 -425 4502 -412 4513 -397 ct 4524 -382 4532 -363 4536 -342 ct -4539 -328 4540 -304 4540 -270 ct 4540 0 l 4466 0 l 4466 -267 l 4466 -297 4463 -320 4457 -335 ct -4451 -350 4441 -362 4426 -371 ct 4412 -380 4394 -384 4374 -384 ct 4343 -384 4315 -374 4292 -354 ct -4269 -334 4258 -296 4258 -239 ct 4258 0 l p ef -4960 -141 m 5037 -131 l 5025 -86 5002 -52 4970 -27 ct 4937 -2 4895 9 4844 9 ct -4780 9 4729 -9 4691 -49 ct 4653 -88 4635 -144 4635 -215 ct 4635 -289 4654 -347 4692 -387 ct -4730 -428 4779 -449 4840 -449 ct 4898 -449 4946 -429 4984 -389 ct 5021 -349 5039 -292 5039 -220 ct -5039 -216 5039 -209 5039 -200 ct 4711 -200 l 4714 -152 4728 -115 4752 -89 ct -4777 -64 4808 -51 4844 -51 ct 4872 -51 4895 -58 4914 -72 ct 4933 -87 l 4949 -110 l -p -4716 -261 m 4961 -261 l 4958 -298 4948 -326 4933 -344 ct 4909 -373 4878 -387 4840 -387 ct -4806 -387 4778 -376 4754 -353 ct 4731 -330 l 4718 -300 l p ef -pom -pum -8136 15876 t -349 -237 m 349 -308 l 605 -309 l 605 -84 l 566 -52 525 -29 483 -13 ct -441 2 398 10 354 10 ct 295 10 241 -2 192 -27 ct 143 -53 107 -90 82 -138 ct 57 -186 45 -240 45 -300 ct -45 -359 57 -414 82 -465 ct 106 -516 142 -554 188 -579 ct 234 -604 288 -616 348 -616 ct -392 -616 432 -609 467 -595 ct 502 -581 530 -561 550 -535 ct 571 -510 586 -477 596 -436 ct -524 -416 l 515 -447 504 -472 490 -489 ct 476 -507 457 -521 432 -532 ct 407 -542 379 -547 349 -547 ct -312 -547 280 -542 253 -531 ct 227 -520 205 -505 189 -487 ct 172 -468 160 -449 150 -427 ct -135 -389 127 -349 127 -305 ct 127 -251 137 -205 155 -169 ct 174 -133 201 -106 236 -88 ct -272 -70 310 -62 350 -62 ct 385 -62 418 -68 452 -82 ct 485 -95 510 -109 527 -124 ct -527 -237 l p ef -1017 -141 m 1094 -131 l 1082 -86 1059 -52 1027 -27 ct 994 -2 952 9 901 9 ct -837 9 786 -9 748 -49 ct 710 -88 692 -144 692 -215 ct 692 -289 711 -347 749 -387 ct -787 -428 836 -449 897 -449 ct 955 -449 1003 -429 1041 -389 ct 1078 -349 1096 -292 1096 -220 ct -1096 -216 1096 -209 1096 -200 ct 768 -200 l 771 -152 785 -115 809 -89 ct 834 -64 865 -51 901 -51 ct -929 -51 952 -58 971 -72 ct 990 -87 l 1006 -110 l p -773 -261 m 1018 -261 l 1015 -298 1005 -326 990 -344 ct 966 -373 935 -387 897 -387 ct -863 -387 835 -376 811 -353 ct 788 -330 l 775 -300 l p ef -1193 0 m 1193 -439 l 1260 -439 l 1260 -376 l 1293 -425 1339 -449 1400 -449 ct -1427 -449 1451 -444 1473 -434 ct 1495 -425 1512 -412 1523 -397 ct 1534 -382 1542 -363 1546 -342 ct -1549 -328 1550 -304 1550 -270 ct 1550 0 l 1476 0 l 1476 -267 l 1476 -297 1473 -320 1467 -335 ct -1461 -350 1451 -362 1436 -371 ct 1422 -380 1404 -384 1384 -384 ct 1353 -384 1325 -374 1302 -354 ct -1279 -334 1268 -296 1268 -239 ct 1268 0 l p ef -1970 -141 m 2047 -131 l 2035 -86 2012 -52 1980 -27 ct 1947 -2 1905 9 1854 9 ct -1790 9 1739 -9 1701 -49 ct 1663 -88 1645 -144 1645 -215 ct 1645 -289 1664 -347 1702 -387 ct -1740 -428 1789 -449 1850 -449 ct 1908 -449 1956 -429 1994 -389 ct 2031 -349 2049 -292 2049 -220 ct -2049 -216 2049 -209 2049 -200 ct 1721 -200 l 1724 -152 1738 -115 1762 -89 ct -1787 -64 1818 -51 1854 -51 ct 1882 -51 1905 -58 1924 -72 ct 1943 -87 l 1959 -110 l -p -1726 -261 m 1971 -261 l 1968 -298 1958 -326 1943 -344 ct 1919 -373 1888 -387 1850 -387 ct -1816 -387 1788 -376 1764 -353 ct 1741 -330 l 1728 -300 l p ef -2145 0 m 2145 -439 l 2212 -439 l 2212 -372 l 2229 -403 2244 -424 2259 -434 ct -2273 -444 2289 -449 2307 -449 ct 2332 -449 2357 -441 2383 -425 ct 2358 -356 l -2339 -366 2321 -372 2303 -372 ct 2287 -372 2272 -367 2259 -357 ct 2246 -347 2237 -334 2231 -316 ct -2223 -290 2219 -261 2219 -229 ct 2219 0 l p ef -2723 -54 m 2695 -30 2669 -14 2643 -4 ct 2618 5 2590 9 2561 9 ct 2513 9 2476 -1 2450 -25 ct -2424 -49 2411 -79 2411 -115 ct 2411 -137 2416 -156 2426 -174 ct 2436 -192 2448 -206 2464 -217 ct -2480 -228 2498 -236 2518 -241 ct 2532 -245 2554 -249 2584 -253 ct 2644 -260 2688 -268 2717 -278 ct -2717 -288 2717 -295 2717 -298 ct 2717 -328 2710 -349 2696 -362 ct 2677 -379 2649 -387 2611 -387 ct -2576 -387 2550 -381 2534 -369 ct 2517 -356 2505 -335 2497 -303 ct 2424 -313 l -2431 -345 2441 -370 2457 -389 ct 2472 -408 2494 -423 2522 -433 ct 2551 -443 2584 -449 2622 -449 ct -2660 -449 2690 -444 2713 -435 ct 2737 -427 2754 -415 2765 -402 ct 2776 -389 2784 -372 2788 -351 ct -2791 -339 2792 -316 2792 -283 ct 2792 -184 l 2792 -114 2794 -71 2797 -52 ct -2800 -34 2806 -16 2816 0 ct 2738 0 l 2730 -15 l 2725 -33 l p -2717 -220 m 2690 -209 2649 -200 2595 -192 ct 2565 -187 2543 -182 2530 -177 ct -2518 -171 2508 -163 2501 -153 ct 2494 -142 2491 -130 2491 -117 ct 2491 -98 2498 -81 2513 -68 ct -2528 -55 2550 -48 2579 -48 ct 2608 -48 2633 -54 2656 -67 ct 2678 -79 2694 -96 2705 -118 ct -2713 -135 2717 -160 2717 -193 ct p ef -3049 -66 m 3060 0 l 3039 3 3020 5 3003 5 ct 2976 5 2955 1 2941 -7 ct 2926 -15 2915 -26 2909 -40 ct -2903 -54 2900 -83 2900 -128 ct 2900 -381 l 2845 -381 l 2845 -439 l 2900 -439 l -2900 -547 l 2974 -592 l 2974 -439 l 3049 -439 l 3049 -381 l 2974 -381 l -2974 -124 l 2974 -103 2975 -89 2978 -83 ct 2981 -77 2985 -72 2991 -69 ct 2997 -65 3005 -63 3016 -63 ct -3024 -63 l 3035 -64 l p ef -3097 -219 m 3097 -300 3119 -361 3164 -400 ct 3202 -432 3248 -449 3303 -449 ct -3363 -449 3412 -429 3451 -389 ct 3489 -350 3508 -295 3508 -225 ct 3508 -169 3500 -124 3483 -92 ct -3466 -60 3441 -34 3409 -16 ct 3376 0 3341 9 3303 9 ct 3241 9 3191 -9 3153 -49 ct -3116 -88 l 3097 -145 l p -3173 -219 m 3173 -163 3185 -121 3210 -93 ct 3234 -65 3265 -51 3303 -51 ct 3340 -51 3370 -65 3395 -93 ct -3419 -121 3432 -164 3432 -222 ct 3432 -276 3419 -317 3395 -345 ct 3370 -373 3339 -387 3303 -387 ct -3265 -387 3234 -373 3210 -345 ct 3185 -317 l 3173 -275 l p ef -3600 0 m 3600 -439 l 3667 -439 l 3667 -372 l 3684 -403 3699 -424 3714 -434 ct -3728 -444 3744 -449 3762 -449 ct 3787 -449 3812 -441 3838 -425 ct 3813 -356 l -3794 -366 3776 -372 3758 -372 ct 3742 -372 3727 -367 3714 -357 ct 3701 -347 3692 -334 3686 -316 ct -3678 -290 3674 -261 3674 -229 ct 3674 0 l p ef -pom -gr -gs -pum -1284 9366 t -79 0 m 79 -606 l 159 -606 l 159 0 l p ef -293 0 m 293 -439 l 360 -439 l 360 -376 l 393 -425 439 -449 500 -449 ct -527 -449 551 -444 573 -434 ct 595 -425 612 -412 623 -397 ct 634 -382 642 -363 646 -342 ct -649 -328 650 -304 650 -270 ct 650 0 l 576 0 l 576 -267 l 576 -297 573 -320 567 -335 ct -561 -350 551 -362 536 -371 ct 522 -380 504 -384 484 -384 ct 453 -384 425 -374 402 -354 ct -379 -334 368 -296 368 -239 ct 368 0 l p ef -769 168 m 769 -439 l 837 -439 l 837 -382 l 853 -404 871 -421 891 -432 ct -911 -443 936 -449 965 -449 ct 1002 -449 1035 -439 1064 -420 ct 1092 -400 1114 -373 1129 -338 ct -1143 -303 1151 -264 1151 -222 ct 1151 -177 1143 -137 1126 -101 ct 1110 -65 1087 -37 1056 -18 ct -1025 0 993 9 959 9 ct 934 9 912 4 892 -5 ct 873 -16 856 -29 844 -45 ct 844 168 l -p -837 -217 m 837 -160 848 -118 871 -91 ct 894 -64 922 -51 954 -51 ct 987 -51 1016 -65 1039 -93 ct -1063 -121 1075 -164 1075 -223 ct 1075 -279 1063 -321 1040 -349 ct 1017 -376 990 -390 958 -390 ct -926 -390 898 -376 873 -346 ct 849 -316 l 837 -273 l p ef -1507 0 m 1507 -64 l 1473 -14 1427 9 1368 9 ct 1342 9 1318 4 1295 -4 ct 1273 -14 1256 -27 1245 -42 ct -1234 -57 1227 -75 1222 -97 ct 1219 -112 1218 -135 1218 -167 ct 1218 -439 l 1292 -439 l -1292 -195 l 1292 -156 1294 -130 1297 -117 ct 1301 -97 1311 -82 1326 -70 ct -1342 -59 1360 -54 1383 -54 ct 1405 -54 1426 -59 1446 -71 ct 1465 -82 1479 -98 1487 -118 ct -1495 -137 1499 -166 1499 -203 ct 1499 -439 l 1574 -439 l 1574 0 l p ef -1858 -66 m 1869 0 l 1848 3 1829 5 1812 5 ct 1785 5 1764 1 1750 -7 ct 1735 -15 1724 -26 1718 -40 ct -1712 -54 1709 -83 1709 -128 ct 1709 -381 l 1654 -381 l 1654 -439 l 1709 -439 l -1709 -547 l 1783 -592 l 1783 -439 l 1858 -439 l 1858 -381 l 1783 -381 l -1783 -124 l 1783 -103 1784 -89 1787 -83 ct 1790 -77 1794 -72 1800 -69 ct 1806 -65 1814 -63 1825 -63 ct -1833 -63 l 1844 -64 l p ef -2190 0 m 2190 -381 l 2124 -381 l 2124 -439 l 2190 -439 l 2190 -485 l -2190 -515 2193 -537 2198 -551 ct 2205 -571 2218 -586 2236 -598 ct 2254 -610 2279 -616 2312 -616 ct -2333 -616 2356 -614 2381 -609 ct 2370 -544 l 2355 -547 2340 -548 2326 -548 ct -2304 -548 2288 -543 2278 -533 ct 2269 -524 2264 -506 2264 -479 ct 2264 -439 l -2350 -439 l 2350 -381 l 2264 -381 l 2264 0 l p ef -2410 0 m 2410 -439 l 2477 -439 l 2477 -372 l 2494 -403 2509 -424 2524 -434 ct -2538 -444 2554 -449 2572 -449 ct 2597 -449 2622 -441 2648 -425 ct 2623 -356 l -2604 -366 2586 -372 2568 -372 ct 2552 -372 2537 -367 2524 -357 ct 2511 -347 2502 -334 2496 -316 ct -2488 -290 2484 -261 2484 -229 ct 2484 0 l p ef -2674 -219 m 2674 -300 2696 -361 2741 -400 ct 2779 -432 2825 -449 2880 -449 ct -2940 -449 2989 -429 3028 -389 ct 3066 -350 3085 -295 3085 -225 ct 3085 -169 3077 -124 3060 -92 ct -3043 -60 3018 -34 2986 -16 ct 2953 0 2918 9 2880 9 ct 2818 9 2768 -9 2730 -49 ct -2693 -88 l 2674 -145 l p -2750 -219 m 2750 -163 2762 -121 2787 -93 ct 2811 -65 2842 -51 2880 -51 ct 2917 -51 2947 -65 2972 -93 ct -2996 -121 3009 -164 3009 -222 ct 3009 -276 2996 -317 2972 -345 ct 2947 -373 2916 -387 2880 -387 ct -2842 -387 2811 -373 2787 -345 ct 2762 -317 l 2750 -275 l p ef -3177 0 m 3177 -439 l 3244 -439 l 3244 -377 l 3258 -399 3276 -416 3299 -429 ct -3322 -442 3348 -449 3377 -449 ct 3410 -449 3436 -442 3457 -428 ct 3478 -415 3493 -396 3501 -372 ct -3536 -423 3581 -449 3637 -449 ct 3680 -449 3714 -437 3737 -412 ct 3761 -388 3772 -351 3772 -301 ct -3772 0 l 3698 0 l 3698 -276 l 3698 -306 3696 -327 3691 -340 ct 3686 -354 3678 -364 3665 -372 ct -3652 -380 3637 -384 3620 -384 ct 3589 -384 3564 -374 3543 -353 ct 3523 -333 3513 -300 3513 -255 ct -3513 0 l 3438 0 l 3438 -285 l 3438 -318 3432 -343 3420 -359 ct 3408 -376 3388 -384 3361 -384 ct -3340 -384 3320 -379 3302 -368 ct 3285 -357 3272 -340 3264 -319 ct 3256 -298 3252 -267 3252 -227 ct -3252 0 l p ef -pom -pum -2302 10319 t --1 0 m 231 -606 l 318 -606 l 566 0 l 474 0 l 404 -183 l 150 -183 l -83 0 l p -173 -248 m 379 -248 l 315 -416 l 296 -467 282 -509 272 -542 ct 265 -503 254 -465 240 -426 ct -p ef -621 0 m 621 -606 l 830 -606 l 877 -606 913 -603 938 -597 ct 972 -589 1002 -575 1027 -554 ct -1059 -527 1082 -492 1098 -450 ct 1114 -408 1122 -360 1122 -306 ct 1122 -260 1117 -219 1106 -184 ct -1095 -148 1081 -119 1065 -95 ct 1048 -72 1029 -54 1009 -40 ct 989 -27 965 -17 937 -10 ct -909 -3 876 0 840 0 ct p -701 -71 m 831 -71 l 871 -71 902 -75 925 -82 ct 947 -90 965 -100 979 -114 ct -998 -133 1013 -158 1023 -190 ct 1034 -222 1039 -261 1039 -307 ct 1039 -371 1029 -419 1008 -453 ct -987 -487 962 -510 932 -522 ct 911 -530 876 -534 828 -534 ct 701 -534 l p ef -1661 -212 m 1742 -192 l 1725 -126 1695 -76 1651 -41 ct 1607 -6 1554 10 1491 10 ct -1425 10 1372 -2 1331 -29 ct 1290 -56 1259 -94 1238 -145 ct 1216 -195 1206 -249 1206 -307 ct -1206 -370 1218 -425 1242 -472 ct 1266 -519 1300 -555 1345 -580 ct 1389 -604 1438 -616 1492 -616 ct -1553 -616 1604 -601 1645 -570 ct 1686 -539 1715 -496 1731 -440 ct 1652 -421 l -1638 -465 1618 -497 1591 -517 ct 1564 -537 1531 -547 1490 -547 ct 1444 -547 1405 -536 1373 -514 ct -1342 -492 1320 -462 1307 -424 ct 1295 -386 1288 -348 1288 -308 ct 1288 -256 1296 -211 1311 -173 ct -1326 -134 1349 -105 1381 -86 ct 1413 -67 1447 -58 1484 -58 ct 1529 -58 1567 -71 1598 -97 ct -1629 -123 l 1650 -161 l p ef -pom -gr -gs -pum -1284 6773 t -79 0 m 79 -606 l 159 -606 l 159 0 l p ef -293 0 m 293 -439 l 360 -439 l 360 -376 l 393 -425 439 -449 500 -449 ct -527 -449 551 -444 573 -434 ct 595 -425 612 -412 623 -397 ct 634 -382 642 -363 646 -342 ct -649 -328 650 -304 650 -270 ct 650 0 l 576 0 l 576 -267 l 576 -297 573 -320 567 -335 ct -561 -350 551 -362 536 -371 ct 522 -380 504 -384 484 -384 ct 453 -384 425 -374 402 -354 ct -379 -334 368 -296 368 -239 ct 368 0 l p ef -769 168 m 769 -439 l 837 -439 l 837 -382 l 853 -404 871 -421 891 -432 ct -911 -443 936 -449 965 -449 ct 1002 -449 1035 -439 1064 -420 ct 1092 -400 1114 -373 1129 -338 ct -1143 -303 1151 -264 1151 -222 ct 1151 -177 1143 -137 1126 -101 ct 1110 -65 1087 -37 1056 -18 ct -1025 0 993 9 959 9 ct 934 9 912 4 892 -5 ct 873 -16 856 -29 844 -45 ct 844 168 l -p -837 -217 m 837 -160 848 -118 871 -91 ct 894 -64 922 -51 954 -51 ct 987 -51 1016 -65 1039 -93 ct -1063 -121 1075 -164 1075 -223 ct 1075 -279 1063 -321 1040 -349 ct 1017 -376 990 -390 958 -390 ct -926 -390 898 -376 873 -346 ct 849 -316 l 837 -273 l p ef -1507 0 m 1507 -64 l 1473 -14 1427 9 1368 9 ct 1342 9 1318 4 1295 -4 ct 1273 -14 1256 -27 1245 -42 ct -1234 -57 1227 -75 1222 -97 ct 1219 -112 1218 -135 1218 -167 ct 1218 -439 l 1292 -439 l -1292 -195 l 1292 -156 1294 -130 1297 -117 ct 1301 -97 1311 -82 1326 -70 ct -1342 -59 1360 -54 1383 -54 ct 1405 -54 1426 -59 1446 -71 ct 1465 -82 1479 -98 1487 -118 ct -1495 -137 1499 -166 1499 -203 ct 1499 -439 l 1574 -439 l 1574 0 l p ef -1858 -66 m 1869 0 l 1848 3 1829 5 1812 5 ct 1785 5 1764 1 1750 -7 ct 1735 -15 1724 -26 1718 -40 ct -1712 -54 1709 -83 1709 -128 ct 1709 -381 l 1654 -381 l 1654 -439 l 1709 -439 l -1709 -547 l 1783 -592 l 1783 -439 l 1858 -439 l 1858 -381 l 1783 -381 l -1783 -124 l 1783 -103 1784 -89 1787 -83 ct 1790 -77 1794 -72 1800 -69 ct 1806 -65 1814 -63 1825 -63 ct -1833 -63 l 1844 -64 l p ef -2190 0 m 2190 -381 l 2124 -381 l 2124 -439 l 2190 -439 l 2190 -485 l -2190 -515 2193 -537 2198 -551 ct 2205 -571 2218 -586 2236 -598 ct 2254 -610 2279 -616 2312 -616 ct -2333 -616 2356 -614 2381 -609 ct 2370 -544 l 2355 -547 2340 -548 2326 -548 ct -2304 -548 2288 -543 2278 -533 ct 2269 -524 2264 -506 2264 -479 ct 2264 -439 l -2350 -439 l 2350 -381 l 2264 -381 l 2264 0 l p ef -2410 0 m 2410 -439 l 2477 -439 l 2477 -372 l 2494 -403 2509 -424 2524 -434 ct -2538 -444 2554 -449 2572 -449 ct 2597 -449 2622 -441 2648 -425 ct 2623 -356 l -2604 -366 2586 -372 2568 -372 ct 2552 -372 2537 -367 2524 -357 ct 2511 -347 2502 -334 2496 -316 ct -2488 -290 2484 -261 2484 -229 ct 2484 0 l p ef -2674 -219 m 2674 -300 2696 -361 2741 -400 ct 2779 -432 2825 -449 2880 -449 ct -2940 -449 2989 -429 3028 -389 ct 3066 -350 3085 -295 3085 -225 ct 3085 -169 3077 -124 3060 -92 ct -3043 -60 3018 -34 2986 -16 ct 2953 0 2918 9 2880 9 ct 2818 9 2768 -9 2730 -49 ct -2693 -88 l 2674 -145 l p -2750 -219 m 2750 -163 2762 -121 2787 -93 ct 2811 -65 2842 -51 2880 -51 ct 2917 -51 2947 -65 2972 -93 ct -2996 -121 3009 -164 3009 -222 ct 3009 -276 2996 -317 2972 -345 ct 2947 -373 2916 -387 2880 -387 ct -2842 -387 2811 -373 2787 -345 ct 2762 -317 l 2750 -275 l p ef -3177 0 m 3177 -439 l 3244 -439 l 3244 -377 l 3258 -399 3276 -416 3299 -429 ct -3322 -442 3348 -449 3377 -449 ct 3410 -449 3436 -442 3457 -428 ct 3478 -415 3493 -396 3501 -372 ct -3536 -423 3581 -449 3637 -449 ct 3680 -449 3714 -437 3737 -412 ct 3761 -388 3772 -351 3772 -301 ct -3772 0 l 3698 0 l 3698 -276 l 3698 -306 3696 -327 3691 -340 ct 3686 -354 3678 -364 3665 -372 ct -3652 -380 3637 -384 3620 -384 ct 3589 -384 3564 -374 3543 -353 ct 3523 -333 3513 -300 3513 -255 ct -3513 0 l 3438 0 l 3438 -285 l 3438 -318 3432 -343 3420 -359 ct 3408 -376 3388 -384 3361 -384 ct -3340 -384 3320 -379 3302 -368 ct 3285 -357 3272 -340 3264 -319 ct 3256 -298 3252 -267 3252 -227 ct -3252 0 l p ef -pom -pum -2302 7726 t --1 0 m 231 -606 l 318 -606 l 566 0 l 474 0 l 404 -183 l 150 -183 l -83 0 l p -173 -248 m 379 -248 l 315 -416 l 296 -467 282 -509 272 -542 ct 265 -503 254 -465 240 -426 ct -p ef -621 0 m 621 -606 l 830 -606 l 877 -606 913 -603 938 -597 ct 972 -589 1002 -575 1027 -554 ct -1059 -527 1082 -492 1098 -450 ct 1114 -408 1122 -360 1122 -306 ct 1122 -260 1117 -219 1106 -184 ct -1095 -148 1081 -119 1065 -95 ct 1048 -72 1029 -54 1009 -40 ct 989 -27 965 -17 937 -10 ct -909 -3 876 0 840 0 ct p -701 -71 m 831 -71 l 871 -71 902 -75 925 -82 ct 947 -90 965 -100 979 -114 ct -998 -133 1013 -158 1023 -190 ct 1034 -222 1039 -261 1039 -307 ct 1039 -371 1029 -419 1008 -453 ct -987 -487 962 -510 932 -522 ct 911 -530 876 -534 828 -534 ct 701 -534 l p ef -1661 -212 m 1742 -192 l 1725 -126 1695 -76 1651 -41 ct 1607 -6 1554 10 1491 10 ct -1425 10 1372 -2 1331 -29 ct 1290 -56 1259 -94 1238 -145 ct 1216 -195 1206 -249 1206 -307 ct -1206 -370 1218 -425 1242 -472 ct 1266 -519 1300 -555 1345 -580 ct 1389 -604 1438 -616 1492 -616 ct -1553 -616 1604 -601 1645 -570 ct 1686 -539 1715 -496 1731 -440 ct 1652 -421 l -1638 -465 1618 -497 1591 -517 ct 1564 -537 1531 -547 1490 -547 ct 1444 -547 1405 -536 1373 -514 ct -1342 -492 1320 -462 1307 -424 ct 1295 -386 1288 -348 1288 -308 ct 1288 -256 1296 -211 1311 -173 ct -1326 -134 1349 -105 1381 -86 ct 1413 -67 1447 -58 1484 -58 ct 1529 -58 1567 -71 1598 -97 ct -1629 -123 l 1650 -161 l p ef -pom -gr -8442 7781 m 8437 7778 l 8224 7666 l 8218 7663 l 8049 7492 l 8046 7486 l -7936 7271 l 7933 7265 l 7894 7016 l 7894 7009 l 7933 6759 l 7936 6753 l -8046 6538 l 8049 6532 l 8218 6361 l 8224 6358 l 8437 6246 l 8442 6244 l -8689 6204 l 8696 6204 l 8942 6244 l 8948 6246 l 9161 6358 l 9166 6361 l -9335 6532 l 9338 6538 l 9449 6753 l 9451 6759 l 9491 7009 l 9491 7016 l -9451 7265 l 9449 7271 l 9338 7486 l 9335 7492 l 9166 7663 l 9161 7666 l -8948 7778 l 8942 7781 l 8696 7821 l 8689 7821 l 8442 7781 l p -8692 7779 m 8931 7739 l 9138 7631 l 9303 7464 l 9410 7254 l 9449 7012 l -9410 6770 l 9303 6560 l 9138 6393 l 8931 6285 l 8692 6246 l 8453 6285 l -8246 6393 l 8081 6560 l 7974 6770 l 7936 7012 l 7974 7254 l 8081 7464 l -8246 7631 l 8453 7739 l 8692 7779 l p -8174 6489 m 8204 6458 l 8411 6668 l 8618 6877 l 8825 7087 l 9032 7297 l -9240 7508 l 9210 7538 l 9002 7328 l 8795 7118 l 8588 6908 l 8380 6698 l -8174 6489 l p -8204 7538 m 8174 7509 l 8380 7298 l 8588 7088 l 8795 6878 l 9003 6668 l -9211 6458 l 9240 6489 l 9032 6699 l 8825 6909 l 8618 7119 l 8411 7329 l -8204 7538 l p ef -1 lw 0 lj 8442 7781 m 8437 7778 l 8224 7666 l 8218 7663 l 8049 7492 l -8046 7486 l 7936 7271 l 7933 7265 l 7894 7016 l 7894 7009 l 7933 6759 l -7936 6753 l 8046 6538 l 8049 6532 l 8218 6361 l 8224 6358 l 8437 6246 l -8442 6244 l 8689 6204 l 8696 6204 l 8942 6244 l 8948 6246 l 9161 6358 l -9166 6361 l 9335 6532 l 9338 6538 l 9449 6753 l 9451 6759 l 9491 7009 l -9491 7016 l 9451 7265 l 9449 7271 l 9338 7486 l 9335 7492 l 9166 7663 l -9161 7666 l 8948 7778 l 8942 7781 l 8696 7821 l 8689 7821 l 8442 7781 l -pc -8692 7779 m 8931 7739 l 9138 7631 l 9303 7464 l 9410 7254 l 9449 7012 l -9410 6770 l 9303 6560 l 9138 6393 l 8931 6285 l 8692 6246 l 8453 6285 l -8246 6393 l 8081 6560 l 7974 6770 l 7936 7012 l 7974 7254 l 8081 7464 l -8246 7631 l 8453 7739 l 8692 7779 l pc -8174 6489 m 8204 6458 l 8411 6668 l 8618 6877 l 8825 7087 l 9032 7297 l -9240 7508 l 9210 7538 l 9002 7328 l 8795 7118 l 8588 6908 l 8380 6698 l -8174 6489 l pc -8204 7538 m 8174 7509 l 8380 7298 l 8588 7088 l 8795 6878 l 9003 6668 l -9211 6458 l 9240 6489 l 9032 6699 l 8825 6909 l 8618 7119 l 8411 7329 l -8204 7538 l pc -8691 7821 m 8541 8271 l 8841 8270 l 8691 7821 l p ef -8691 8181 m 8691 12701 l ps -11531 10361 m 11381 10811 l 11681 10810 l 11531 10361 l p ef -11531 10721 m 11531 12701 l ps -gs -pum -7329 12171 t -26 -131 m 99 -142 l 103 -113 115 -90 134 -74 ct 153 -59 179 -51 213 -51 ct -247 -51 272 -58 289 -72 ct 306 -86 314 -102 314 -121 ct 314 -138 307 -151 292 -160 ct -282 -167 256 -175 216 -186 ct 161 -199 123 -211 102 -221 ct 81 -231 65 -245 54 -263 ct -43 -281 38 -301 38 -322 ct 38 -342 42 -360 51 -376 ct 60 -393 73 -407 88 -418 ct -100 -427 115 -434 135 -440 ct 155 -446 177 -449 200 -449 ct 234 -449 264 -444 290 -434 ct -317 -424 336 -410 348 -393 ct 361 -376 369 -354 374 -325 ct 301 -315 l 298 -338 288 -356 272 -368 ct -256 -381 234 -387 205 -387 ct 171 -387 146 -382 132 -370 ct 117 -359 110 -346 110 -331 ct -110 -321 113 -312 119 -305 ct 125 -297 135 -290 148 -285 ct 155 -282 177 -276 213 -266 ct -266 -252 303 -240 324 -231 ct 344 -222 361 -209 373 -192 ct 384 -175 390 -154 390 -129 ct -390 -104 383 -80 369 -58 ct 354 -37 333 -20 306 -8 ct 279 3 248 9 213 9 ct 156 9 113 -1 83 -25 ct -53 -49 l 34 -84 l p ef -453 -520 m 453 -606 l 527 -606 l 527 -520 l p -453 0 m 453 -439 l 527 -439 l 527 0 l p ef -637 0 m 637 -439 l 704 -439 l 704 -376 l 737 -425 783 -449 844 -449 ct -871 -449 895 -444 917 -434 ct 939 -425 956 -412 967 -397 ct 978 -382 986 -363 990 -342 ct -993 -328 994 -304 994 -270 ct 994 0 l 920 0 l 920 -267 l 920 -297 917 -320 911 -335 ct -905 -350 895 -362 880 -371 ct 866 -380 848 -384 828 -384 ct 797 -384 769 -374 746 -354 ct -723 -334 712 -296 712 -239 ct 712 0 l p ef -pom -gr -gs -pum -11880 12223 t -342 -160 m 415 -151 l 407 -100 387 -61 354 -32 ct 321 -4 280 9 232 9 ct 172 9 124 -9 87 -49 ct -51 -88 33 -144 33 -217 ct 33 -265 40 -306 56 -342 ct 72 -378 96 -404 128 -422 ct -160 -440 195 -449 233 -449 ct 280 -449 319 -437 350 -412 ct 380 -388 400 -354 408 -310 ct -336 -299 l 329 -328 317 -350 299 -365 ct 282 -380 260 -387 236 -387 ct 198 -387 168 -374 144 -347 ct -121 -320 109 -278 109 -220 ct 109 -161 120 -118 143 -91 ct 166 -64 195 -51 232 -51 ct -261 -51 285 -60 305 -78 ct 324 -96 l 337 -123 l p ef -451 -219 m 451 -300 473 -361 518 -400 ct 556 -432 602 -449 657 -449 ct 717 -449 766 -429 805 -389 ct -843 -350 862 -295 862 -225 ct 862 -169 854 -124 837 -92 ct 820 -60 795 -34 763 -16 ct -730 0 695 9 657 9 ct 595 9 545 -9 507 -49 ct 470 -88 l 451 -145 l p -527 -219 m 527 -163 539 -121 564 -93 ct 588 -65 619 -51 657 -51 ct 694 -51 724 -65 749 -93 ct -773 -121 786 -164 786 -222 ct 786 -276 773 -317 749 -345 ct 724 -373 693 -387 657 -387 ct -619 -387 588 -373 564 -345 ct 539 -317 l 527 -275 l p ef -926 -131 m 999 -142 l 1003 -113 1015 -90 1034 -74 ct 1053 -59 1079 -51 1113 -51 ct -1147 -51 1172 -58 1189 -72 ct 1206 -86 1214 -102 1214 -121 ct 1214 -138 1207 -151 1192 -160 ct -1182 -167 1156 -175 1116 -186 ct 1061 -199 1023 -211 1002 -221 ct 981 -231 965 -245 954 -263 ct -943 -281 938 -301 938 -322 ct 938 -342 942 -360 951 -376 ct 960 -393 973 -407 988 -418 ct -1000 -427 1015 -434 1035 -440 ct 1055 -446 1077 -449 1100 -449 ct 1134 -449 1164 -444 1190 -434 ct -1217 -424 1236 -410 1248 -393 ct 1261 -376 1269 -354 1274 -325 ct 1201 -315 l -1198 -338 1188 -356 1172 -368 ct 1156 -381 1134 -387 1105 -387 ct 1071 -387 1046 -382 1032 -370 ct -1017 -359 1010 -346 1010 -331 ct 1010 -321 1013 -312 1019 -305 ct 1025 -297 1035 -290 1048 -285 ct -1055 -282 1077 -276 1113 -266 ct 1166 -252 1203 -240 1224 -231 ct 1244 -222 1261 -209 1273 -192 ct -1284 -175 1290 -154 1290 -129 ct 1290 -104 1283 -80 1269 -58 ct 1254 -37 1233 -20 1206 -8 ct -1179 3 1148 9 1113 9 ct 1056 9 1013 -1 983 -25 ct 953 -49 l 934 -84 l p ef -pom -gr -24131 6986 m 23680 6836 l 23681 7136 l 24131 6986 l p ef -20956 6986 m 23771 6986 l ps -24131 9526 m 23680 9376 l 23681 9676 l 24131 9526 l p ef -20956 9526 m 23771 9526 l ps -gs -pum -24646 7223 t -79 0 m 79 -606 l 159 -606 l 159 0 l p ef -pom -gr -gs -pum -24435 9763 t -524 -64 m 562 -39 596 -20 627 -8 ct 604 47 l 560 31 517 6 473 -27 ct 429 -2 379 10 325 10 ct -270 10 220 -2 175 -29 ct 131 -55 96 -93 72 -141 ct 48 -189 36 -243 36 -303 ct 36 -362 48 -417 72 -466 ct -97 -515 131 -552 176 -578 ct 221 -604 271 -617 326 -617 ct 382 -617 433 -603 478 -577 ct -523 -550 557 -513 580 -465 ct 604 -417 616 -363 616 -303 ct 616 -253 608 -208 593 -168 ct -578 -129 l 555 -94 l p -348 -167 m 394 -154 432 -135 462 -109 ct 509 -152 533 -217 533 -303 ct 533 -352 525 -395 508 -432 ct -491 -468 467 -497 435 -517 ct 403 -537 367 -547 327 -547 ct 267 -547 217 -527 178 -486 ct -138 -445 119 -384 119 -303 ct 119 -224 138 -163 177 -121 ct 216 -79 266 -58 327 -58 ct -355 -58 382 -63 408 -74 ct 383 -90 356 -102 328 -109 ct p ef -pom -gr -gs -pum -23747 3307 t -315 0 m 241 0 l 241 -474 l 223 -457 199 -440 170 -423 ct 141 -405 115 -393 92 -384 ct -92 -456 l 133 -476 170 -499 201 -527 ct 232 -555 254 -582 267 -608 ct 315 -608 l -p ef -897 -457 m 823 -452 l 816 -481 807 -502 795 -515 ct 775 -536 750 -547 720 -547 ct -697 -547 676 -540 658 -527 ct 634 -510 616 -485 602 -452 ct 589 -420 582 -373 581 -312 ct -599 -339 621 -360 647 -373 ct 673 -386 700 -393 729 -393 ct 778 -393 820 -375 855 -338 ct -890 -301 908 -254 908 -196 ct 908 -158 899 -123 883 -90 ct 867 -58 844 -33 815 -15 ct -787 1 754 10 718 10 ct 656 10 605 -12 566 -58 ct 527 -103 507 -178 507 -283 ct -507 -400 529 -486 572 -539 ct 610 -585 661 -608 725 -608 ct 773 -608 812 -595 842 -568 ct -873 -541 l 891 -504 l p -593 -196 m 593 -170 598 -146 609 -122 ct 620 -99 635 -81 655 -69 ct 675 -57 695 -50 717 -50 ct -748 -50 775 -63 798 -88 ct 820 -114 832 -148 832 -192 ct 832 -234 820 -267 798 -291 ct -776 -315 748 -327 714 -327 ct 680 -327 652 -315 628 -291 ct 605 -267 l 593 -235 l -p ef -952 -181 m 952 -256 l 1181 -256 l 1181 -181 l p ef -1341 0 m 1272 0 l 1272 -606 l 1346 -606 l 1346 -390 l 1378 -429 1418 -449 1467 -449 ct -1494 -449 1519 -443 1543 -432 ct 1568 -421 1587 -406 1603 -386 ct 1619 -367 1631 -343 1640 -315 ct -1648 -287 1653 -257 1653 -226 ct 1653 -150 1634 -92 1597 -51 ct 1560 -10 1515 9 1463 9 ct -1411 9 1370 -11 1341 -55 ct p -1340 -222 m 1340 -170 1347 -132 1362 -108 ct 1385 -70 1417 -51 1457 -51 ct -1489 -51 1517 -65 1541 -93 ct 1565 -121 1577 -164 1577 -220 ct 1577 -277 1565 -319 1543 -346 ct -1520 -374 1492 -387 1460 -387 ct 1428 -387 1399 -373 1376 -345 ct 1352 -317 l -1340 -276 l p ef -1723 -520 m 1723 -606 l 1797 -606 l 1797 -520 l p -1723 0 m 1723 -439 l 1797 -439 l 1797 0 l p ef -2070 -66 m 2081 0 l 2060 3 2041 5 2024 5 ct 1997 5 1976 1 1962 -7 ct 1947 -15 1936 -26 1930 -40 ct -1924 -54 1921 -83 1921 -128 ct 1921 -381 l 1866 -381 l 1866 -439 l 1921 -439 l -1921 -547 l 1995 -592 l 1995 -439 l 2070 -439 l 2070 -381 l 1995 -381 l -1995 -124 l 1995 -103 1996 -89 1999 -83 ct 2002 -77 2006 -72 2012 -69 ct 2018 -65 2026 -63 2037 -63 ct -2045 -63 l 2056 -64 l p ef -pom -pum -22596 4260 t -340 0 m 340 -55 l 312 -11 272 9 217 9 ct 182 9 150 0 121 -19 ct 92 -38 69 -65 53 -99 ct -37 -134 28 -174 28 -219 ct 28 -263 36 -302 50 -338 ct 65 -374 87 -401 116 -420 ct -145 -439 178 -449 214 -449 ct 241 -449 264 -443 285 -432 ct 306 -421 322 -406 335 -388 ct -335 -606 l 409 -606 l 409 0 l p -105 -219 m 105 -162 117 -120 141 -93 ct 164 -65 192 -51 224 -51 ct 257 -51 285 -64 307 -91 ct -330 -117 342 -158 342 -212 ct 342 -273 330 -317 307 -345 ct 284 -373 255 -387 221 -387 ct -188 -387 160 -374 138 -346 ct 116 -319 l 105 -277 l p ef -818 -54 m 790 -30 764 -14 738 -4 ct 713 5 685 9 656 9 ct 608 9 571 -1 545 -25 ct -519 -49 506 -79 506 -115 ct 506 -137 511 -156 521 -174 ct 531 -192 543 -206 559 -217 ct -575 -228 593 -236 613 -241 ct 627 -245 649 -249 679 -253 ct 739 -260 783 -268 812 -278 ct -812 -288 812 -295 812 -298 ct 812 -328 805 -349 791 -362 ct 772 -379 744 -387 706 -387 ct -671 -387 645 -381 629 -369 ct 612 -356 600 -335 592 -303 ct 519 -313 l 526 -345 536 -370 552 -389 ct -567 -408 589 -423 617 -433 ct 646 -443 679 -449 717 -449 ct 755 -449 785 -444 808 -435 ct -832 -427 849 -415 860 -402 ct 871 -389 879 -372 883 -351 ct 886 -339 887 -316 887 -283 ct -887 -184 l 887 -114 889 -71 892 -52 ct 895 -34 901 -16 911 0 ct 833 0 l 825 -15 l -820 -33 l p -812 -220 m 785 -209 744 -200 690 -192 ct 660 -187 638 -182 625 -177 ct 613 -171 603 -163 596 -153 ct -589 -142 586 -130 586 -117 ct 586 -98 593 -81 608 -68 ct 623 -55 645 -48 674 -48 ct -703 -48 728 -54 751 -67 ct 773 -79 789 -96 800 -118 ct 808 -135 812 -160 812 -193 ct -p ef -1144 -66 m 1155 0 l 1134 3 1115 5 1098 5 ct 1071 5 1050 1 1036 -7 ct 1021 -15 1010 -26 1004 -40 ct -998 -54 995 -83 995 -128 ct 995 -381 l 940 -381 l 940 -439 l 995 -439 l -995 -547 l 1069 -592 l 1069 -439 l 1144 -439 l 1144 -381 l 1069 -381 l -1069 -124 l 1069 -103 1070 -89 1073 -83 ct 1076 -77 1080 -72 1086 -69 ct 1092 -65 1100 -63 1111 -63 ct -1119 -63 l 1130 -64 l p ef -1506 -54 m 1478 -30 1452 -14 1426 -4 ct 1401 5 1373 9 1344 9 ct 1296 9 1259 -1 1233 -25 ct -1207 -49 1194 -79 1194 -115 ct 1194 -137 1199 -156 1209 -174 ct 1219 -192 1231 -206 1247 -217 ct -1263 -228 1281 -236 1301 -241 ct 1315 -245 1337 -249 1367 -253 ct 1427 -260 1471 -268 1500 -278 ct -1500 -288 1500 -295 1500 -298 ct 1500 -328 1493 -349 1479 -362 ct 1460 -379 1432 -387 1394 -387 ct -1359 -387 1333 -381 1317 -369 ct 1300 -356 1288 -335 1280 -303 ct 1207 -313 l -1214 -345 1224 -370 1240 -389 ct 1255 -408 1277 -423 1305 -433 ct 1334 -443 1367 -449 1405 -449 ct -1443 -449 1473 -444 1496 -435 ct 1520 -427 1537 -415 1548 -402 ct 1559 -389 1567 -372 1571 -351 ct -1574 -339 1575 -316 1575 -283 ct 1575 -184 l 1575 -114 1577 -71 1580 -52 ct -1583 -34 1589 -16 1599 0 ct 1521 0 l 1513 -15 l 1508 -33 l p -1500 -220 m 1473 -209 1432 -200 1378 -192 ct 1348 -187 1326 -182 1313 -177 ct -1301 -171 1291 -163 1284 -153 ct 1277 -142 1274 -130 1274 -117 ct 1274 -98 1281 -81 1296 -68 ct -1311 -55 1333 -48 1362 -48 ct 1391 -48 1416 -54 1439 -67 ct 1461 -79 1477 -96 1488 -118 ct -1496 -135 1500 -160 1500 -193 ct p ef -2070 -66 m 2081 0 l 2060 3 2041 5 2024 5 ct 1997 5 1976 1 1962 -7 ct 1947 -15 1936 -26 1930 -40 ct -1924 -54 1921 -83 1921 -128 ct 1921 -381 l 1866 -381 l 1866 -439 l 1921 -439 l -1921 -547 l 1995 -592 l 1995 -439 l 2070 -439 l 2070 -381 l 1995 -381 l -1995 -124 l 1995 -103 1996 -89 1999 -83 ct 2002 -77 2006 -72 2012 -69 ct 2018 -65 2026 -63 2037 -63 ct -2045 -63 l 2056 -64 l p ef -2118 -219 m 2118 -300 2140 -361 2185 -400 ct 2223 -432 2269 -449 2324 -449 ct -2384 -449 2433 -429 2472 -389 ct 2510 -350 2529 -295 2529 -225 ct 2529 -169 2521 -124 2504 -92 ct -2487 -60 2462 -34 2430 -16 ct 2397 0 2362 9 2324 9 ct 2262 9 2212 -9 2174 -49 ct -2137 -88 l 2118 -145 l p -2194 -219 m 2194 -163 2206 -121 2231 -93 ct 2255 -65 2286 -51 2324 -51 ct 2361 -51 2391 -65 2416 -93 ct -2440 -121 2453 -164 2453 -222 ct 2453 -276 2440 -317 2416 -345 ct 2391 -373 2360 -387 2324 -387 ct -2286 -387 2255 -373 2231 -345 ct 2206 -317 l 2194 -275 l p ef -2860 0 m 2860 -606 l 2935 -606 l 2935 -388 l 2970 -429 3013 -449 3066 -449 ct -3099 -449 3127 -442 3151 -429 ct 3175 -417 3192 -399 3203 -376 ct 3213 -354 3218 -321 3218 -278 ct -3218 0 l 3144 0 l 3144 -278 l 3144 -315 3136 -342 3119 -359 ct 3103 -376 3081 -385 3051 -385 ct -3029 -385 3008 -379 2989 -367 ct 2969 -356 2955 -340 2947 -321 ct 2939 -301 2935 -274 2935 -240 ct -2935 0 l p ef -3309 -219 m 3309 -300 3331 -361 3376 -400 ct 3414 -432 3460 -449 3515 -449 ct -3575 -449 3624 -429 3663 -389 ct 3701 -350 3720 -295 3720 -225 ct 3720 -169 3712 -124 3695 -92 ct -3678 -60 3653 -34 3621 -16 ct 3588 0 3553 9 3515 9 ct 3453 9 3403 -9 3365 -49 ct -3328 -88 l 3309 -145 l p -3385 -219 m 3385 -163 3397 -121 3422 -93 ct 3446 -65 3477 -51 3515 -51 ct 3552 -51 3582 -65 3607 -93 ct -3631 -121 3644 -164 3644 -222 ct 3644 -276 3631 -317 3607 -345 ct 3582 -373 3551 -387 3515 -387 ct -3477 -387 3446 -373 3422 -345 ct 3397 -317 l 3385 -275 l p ef -3783 -131 m 3856 -142 l 3860 -113 3872 -90 3891 -74 ct 3910 -59 3936 -51 3970 -51 ct -4004 -51 4029 -58 4046 -72 ct 4063 -86 4071 -102 4071 -121 ct 4071 -138 4064 -151 4049 -160 ct -4039 -167 4013 -175 3973 -186 ct 3918 -199 3880 -211 3859 -221 ct 3838 -231 3822 -245 3811 -263 ct -3800 -281 3795 -301 3795 -322 ct 3795 -342 3799 -360 3808 -376 ct 3817 -393 3830 -407 3845 -418 ct -3857 -427 3872 -434 3892 -440 ct 3912 -446 3934 -449 3957 -449 ct 3991 -449 4021 -444 4047 -434 ct -4074 -424 4093 -410 4105 -393 ct 4118 -376 4126 -354 4131 -325 ct 4058 -315 l -4055 -338 4045 -356 4029 -368 ct 4013 -381 3991 -387 3962 -387 ct 3928 -387 3903 -382 3889 -370 ct -3874 -359 3867 -346 3867 -331 ct 3867 -321 3870 -312 3876 -305 ct 3882 -297 3892 -290 3905 -285 ct -3912 -282 3934 -276 3970 -266 ct 4023 -252 4060 -240 4081 -231 ct 4101 -222 4118 -209 4130 -192 ct -4141 -175 4147 -154 4147 -129 ct 4147 -104 4140 -80 4126 -58 ct 4111 -37 4090 -20 4063 -8 ct -4036 3 4005 9 3970 9 ct 3913 9 3870 -1 3840 -25 ct 3810 -49 l 3791 -84 l p ef -4372 -66 m 4383 0 l 4362 3 4343 5 4326 5 ct 4299 5 4278 1 4264 -7 ct 4249 -15 4238 -26 4232 -40 ct -4226 -54 4223 -83 4223 -128 ct 4223 -381 l 4168 -381 l 4168 -439 l 4223 -439 l -4223 -547 l 4297 -592 l 4297 -439 l 4372 -439 l 4372 -381 l 4297 -381 l -4297 -124 l 4297 -103 4298 -89 4301 -83 ct 4304 -77 4308 -72 4314 -69 ct 4320 -65 4328 -63 4339 -63 ct -4347 -63 l 4358 -64 l p ef -pom -pum -23257 5213 t -177 0 m 10 -439 l 89 -439 l 183 -176 l 193 -147 203 -118 211 -87 ct 218 -110 227 -138 239 -171 ct -337 -439 l 413 -439 l 247 0 l p ef -479 -520 m 479 -606 l 553 -606 l 553 -520 l p -479 0 m 479 -439 l 553 -439 l 553 0 l p ef -951 -54 m 923 -30 897 -14 871 -4 ct 846 5 818 9 789 9 ct 741 9 704 -1 678 -25 ct -652 -49 639 -79 639 -115 ct 639 -137 644 -156 654 -174 ct 664 -192 676 -206 692 -217 ct -708 -228 726 -236 746 -241 ct 760 -245 782 -249 812 -253 ct 872 -260 916 -268 945 -278 ct -945 -288 945 -295 945 -298 ct 945 -328 938 -349 924 -362 ct 905 -379 877 -387 839 -387 ct -804 -387 778 -381 762 -369 ct 745 -356 733 -335 725 -303 ct 652 -313 l 659 -345 669 -370 685 -389 ct -700 -408 722 -423 750 -433 ct 779 -443 812 -449 850 -449 ct 888 -449 918 -444 941 -435 ct -965 -427 982 -415 993 -402 ct 1004 -389 1012 -372 1016 -351 ct 1019 -339 1020 -316 1020 -283 ct -1020 -184 l 1020 -114 1022 -71 1025 -52 ct 1028 -34 1034 -16 1044 0 ct 966 0 l -958 -15 l 953 -33 l p -945 -220 m 918 -209 877 -200 823 -192 ct 793 -187 771 -182 758 -177 ct 746 -171 736 -163 729 -153 ct -722 -142 719 -130 719 -117 ct 719 -98 726 -81 741 -68 ct 756 -55 778 -48 807 -48 ct -836 -48 861 -54 884 -67 ct 906 -79 922 -96 933 -118 ct 941 -135 945 -160 945 -193 ct -p ef -1759 -606 m 1839 -606 l 1839 -256 l 1839 -195 1832 -146 1818 -110 ct 1804 -75 1780 -45 1744 -23 ct -1708 0 1660 10 1602 10 ct 1545 10 1499 0 1463 -19 ct 1426 -38 1401 -66 1385 -104 ct -1370 -141 1362 -191 1362 -256 ct 1362 -606 l 1442 -606 l 1442 -256 l 1442 -203 1447 -164 1457 -139 ct -1467 -115 1484 -95 1507 -82 ct 1531 -68 1560 -62 1595 -62 ct 1654 -62 1696 -75 1721 -102 ct -1746 -128 1759 -180 1759 -256 ct p ef -1969 -194 m 2044 -201 l 2048 -171 2056 -146 2069 -126 ct 2082 -107 2103 -91 2130 -79 ct -2158 -67 2189 -61 2223 -61 ct 2254 -61 2281 -66 2304 -75 ct 2328 -84 2345 -96 2357 -112 ct -2368 -128 2374 -145 2374 -164 ct 2374 -183 2368 -200 2357 -214 ct 2346 -228 2328 -240 2303 -250 ct -2286 -256 2250 -266 2195 -279 ct 2139 -293 2100 -305 2078 -317 ct 2049 -332 2027 -351 2013 -374 ct -1999 -396 1992 -421 1992 -449 ct 1992 -480 2000 -508 2018 -535 ct 2035 -561 2061 -582 2094 -595 ct -2127 -609 2164 -616 2205 -616 ct 2250 -616 2290 -609 2324 -594 ct 2358 -580 2385 -559 2403 -531 ct -2422 -502 2432 -471 2433 -435 ct 2356 -429 l 2352 -468 2338 -496 2314 -516 ct -2290 -536 2255 -545 2208 -545 ct 2160 -545 2125 -537 2102 -519 ct 2080 -501 2069 -480 2069 -454 ct -2069 -433 2077 -415 2093 -401 ct 2108 -387 2148 -372 2214 -357 ct 2279 -343 2324 -330 2348 -319 ct -2383 -303 2409 -282 2426 -257 ct 2443 -232 2451 -203 2451 -171 ct 2451 -138 2442 -108 2423 -80 ct -2405 -51 2378 -29 2344 -13 ct 2309 2 2270 10 2227 10 ct 2172 10 2126 2 2089 -13 ct -2052 -29 2023 -53 2002 -85 ct 1981 -117 l 1970 -154 l p ef -2576 0 m 2576 -606 l 2803 -606 l 2849 -606 2886 -600 2914 -587 ct 2942 -575 2964 -556 2980 -531 ct -2996 -505 3004 -479 3004 -451 ct 3004 -425 2997 -400 2983 -378 ct 2969 -355 2948 -336 2919 -322 ct -2956 -311 2984 -293 3004 -267 ct 3024 -241 3033 -211 3033 -175 ct 3033 -147 3027 -120 3015 -96 ct -3003 -72 2989 -53 2971 -40 ct 2953 -26 2931 -16 2905 -10 ct 2878 -3 2845 0 2807 0 ct -p -2656 -351 m 2787 -351 l 2822 -351 2848 -353 2863 -358 ct 2884 -364 2899 -374 2909 -388 ct -2920 -402 2925 -420 2925 -441 ct 2925 -461 2920 -479 2911 -494 ct 2901 -510 2887 -520 2869 -526 ct -2851 -531 2821 -534 2777 -534 ct 2656 -534 l p -2656 -71 m 2807 -71 l 2833 -71 2851 -72 2861 -74 ct 2880 -77 2895 -83 2908 -90 ct -2920 -98 2930 -109 2938 -124 ct 2946 -139 2950 -156 2950 -175 ct 2950 -198 2944 -218 2933 -234 ct -2921 -251 2905 -263 2885 -269 ct 2864 -276 2835 -279 2796 -279 ct 2656 -279 l -p ef -pom -gr -gs -pum -6825 19235 t -497 -212 m 578 -192 l 561 -126 531 -76 487 -41 ct 443 -6 390 10 327 10 ct -261 10 208 -2 167 -29 ct 126 -56 95 -94 74 -145 ct 52 -195 42 -249 42 -307 ct 42 -370 54 -425 78 -472 ct -102 -519 136 -555 181 -580 ct 225 -604 274 -616 328 -616 ct 389 -616 440 -601 481 -570 ct -522 -539 551 -496 567 -440 ct 488 -421 l 474 -465 454 -497 427 -517 ct 400 -537 367 -547 326 -547 ct -280 -547 241 -536 209 -514 ct 178 -492 156 -462 143 -424 ct 131 -386 124 -348 124 -308 ct -124 -256 132 -211 147 -173 ct 162 -134 185 -105 217 -86 ct 249 -67 283 -58 320 -58 ct -365 -58 403 -71 434 -97 ct 465 -123 l 486 -161 l p ef -991 -141 m 1068 -131 l 1056 -86 1033 -52 1001 -27 ct 968 -2 926 9 875 9 ct -811 9 760 -9 722 -49 ct 684 -88 666 -144 666 -215 ct 666 -289 685 -347 723 -387 ct -761 -428 810 -449 871 -449 ct 929 -449 977 -429 1015 -389 ct 1052 -349 1070 -292 1070 -220 ct -1070 -216 1070 -209 1070 -200 ct 742 -200 l 745 -152 759 -115 783 -89 ct 808 -64 839 -51 875 -51 ct -903 -51 926 -58 945 -72 ct 964 -87 l 980 -110 l p -747 -261 m 992 -261 l 989 -298 979 -326 964 -344 ct 940 -373 909 -387 871 -387 ct -837 -387 809 -376 785 -353 ct 762 -330 l 749 -300 l p ef -1166 0 m 1166 -439 l 1233 -439 l 1233 -376 l 1266 -425 1312 -449 1373 -449 ct -1400 -449 1424 -444 1446 -434 ct 1468 -425 1485 -412 1496 -397 ct 1507 -382 1515 -363 1519 -342 ct -1522 -328 1523 -304 1523 -270 ct 1523 0 l 1449 0 l 1449 -267 l 1449 -297 1446 -320 1440 -335 ct -1434 -350 1424 -362 1409 -371 ct 1395 -380 1377 -384 1357 -384 ct 1326 -384 1298 -374 1275 -354 ct -1252 -334 1241 -296 1241 -239 ct 1241 0 l p ef -1806 -66 m 1817 0 l 1796 3 1777 5 1760 5 ct 1733 5 1712 1 1698 -7 ct 1683 -15 1672 -26 1666 -40 ct -1660 -54 1657 -83 1657 -128 ct 1657 -381 l 1602 -381 l 1602 -439 l 1657 -439 l -1657 -547 l 1731 -592 l 1731 -439 l 1806 -439 l 1806 -381 l 1731 -381 l -1731 -124 l 1731 -103 1732 -89 1735 -83 ct 1738 -77 1742 -72 1748 -69 ct 1754 -65 1762 -63 1773 -63 ct -1781 -63 l 1792 -64 l p ef -2182 -141 m 2259 -131 l 2247 -86 2224 -52 2192 -27 ct 2159 -2 2117 9 2066 9 ct -2002 9 1951 -9 1913 -49 ct 1875 -88 1857 -144 1857 -215 ct 1857 -289 1876 -347 1914 -387 ct -1952 -428 2001 -449 2062 -449 ct 2120 -449 2168 -429 2206 -389 ct 2243 -349 2261 -292 2261 -220 ct -2261 -216 2261 -209 2261 -200 ct 1933 -200 l 1936 -152 1950 -115 1974 -89 ct -1999 -64 2030 -51 2066 -51 ct 2094 -51 2117 -58 2136 -72 ct 2155 -87 l 2171 -110 l -p -1938 -261 m 2183 -261 l 2180 -298 2170 -326 2155 -344 ct 2131 -373 2100 -387 2062 -387 ct -2028 -387 2000 -376 1976 -353 ct 1953 -330 l 1940 -300 l p ef -2357 0 m 2357 -439 l 2424 -439 l 2424 -372 l 2441 -403 2456 -424 2471 -434 ct -2485 -444 2501 -449 2519 -449 ct 2544 -449 2569 -441 2595 -425 ct 2570 -356 l -2551 -366 2533 -372 2515 -372 ct 2499 -372 2484 -367 2471 -357 ct 2458 -347 2449 -334 2443 -316 ct -2435 -290 2431 -261 2431 -229 ct 2431 0 l p ef -2904 0 m 2904 -381 l 2838 -381 l 2838 -439 l 2904 -439 l 2904 -485 l -2904 -515 2907 -537 2912 -551 ct 2919 -571 2932 -586 2950 -598 ct 2968 -610 2993 -616 3026 -616 ct -3047 -616 3070 -614 3095 -609 ct 3084 -544 l 3069 -547 3054 -548 3040 -548 ct -3018 -548 3002 -543 2992 -533 ct 2983 -524 2978 -506 2978 -479 ct 2978 -439 l -3064 -439 l 3064 -381 l 2978 -381 l 2978 0 l p ef -3124 0 m 3124 -439 l 3191 -439 l 3191 -372 l 3208 -403 3223 -424 3238 -434 ct -3252 -444 3268 -449 3286 -449 ct 3311 -449 3336 -441 3362 -425 ct 3337 -356 l -3318 -366 3300 -372 3282 -372 ct 3266 -372 3251 -367 3238 -357 ct 3225 -347 3216 -334 3210 -316 ct -3202 -290 3198 -261 3198 -229 ct 3198 0 l p ef -3716 -141 m 3793 -131 l 3781 -86 3758 -52 3726 -27 ct 3693 -2 3651 9 3600 9 ct -3536 9 3485 -9 3447 -49 ct 3409 -88 3391 -144 3391 -215 ct 3391 -289 3410 -347 3448 -387 ct -3486 -428 3535 -449 3596 -449 ct 3654 -449 3702 -429 3740 -389 ct 3777 -349 3795 -292 3795 -220 ct -3795 -216 3795 -209 3795 -200 ct 3467 -200 l 3470 -152 3484 -115 3508 -89 ct -3533 -64 3564 -51 3600 -51 ct 3628 -51 3651 -58 3670 -72 ct 3689 -87 l 3705 -110 l -p -3472 -261 m 3717 -261 l 3714 -298 3704 -326 3689 -344 ct 3665 -373 3634 -387 3596 -387 ct -3562 -387 3534 -376 3510 -353 ct 3487 -330 l 3474 -300 l p ef -4171 168 m 4171 -46 l 4160 -30 4144 -16 4123 -6 ct 4102 4 4080 9 4056 9 ct -4004 9 3959 -10 3922 -52 ct 3884 -94 3865 -151 3865 -223 ct 3865 -267 3873 -307 3888 -342 ct -3904 -377 3926 -404 3955 -422 ct 3984 -440 4016 -449 4051 -449 ct 4105 -449 4148 -426 4179 -380 ct -4179 -439 l 4246 -439 l 4246 168 l p -3942 -220 m 3942 -164 3954 -121 3977 -93 ct 4001 -65 4029 -51 4063 -51 ct 4094 -51 4122 -64 4144 -91 ct -4167 -118 4179 -159 4179 -214 ct 4179 -272 4167 -316 4143 -346 ct 4118 -375 4090 -390 4058 -390 ct -4025 -390 3998 -376 3975 -349 ct 3953 -321 l 3942 -279 l p ef -4656 0 m 4656 -64 l 4622 -14 4576 9 4517 9 ct 4491 9 4467 4 4444 -4 ct 4422 -14 4405 -27 4394 -42 ct -4383 -57 4376 -75 4371 -97 ct 4368 -112 4367 -135 4367 -167 ct 4367 -439 l 4441 -439 l -4441 -195 l 4441 -156 4443 -130 4446 -117 ct 4450 -97 4460 -82 4475 -70 ct -4491 -59 4509 -54 4532 -54 ct 4554 -54 4575 -59 4595 -71 ct 4614 -82 4628 -98 4636 -118 ct -4644 -137 4648 -166 4648 -203 ct 4648 -439 l 4723 -439 l 4723 0 l p ef -5145 -141 m 5222 -131 l 5210 -86 5187 -52 5155 -27 ct 5122 -2 5080 9 5029 9 ct -4965 9 4914 -9 4876 -49 ct 4838 -88 4820 -144 4820 -215 ct 4820 -289 4839 -347 4877 -387 ct -4915 -428 4964 -449 5025 -449 ct 5083 -449 5131 -429 5169 -389 ct 5206 -349 5224 -292 5224 -220 ct -5224 -216 5224 -209 5224 -200 ct 4896 -200 l 4899 -152 4913 -115 4937 -89 ct -4962 -64 4993 -51 5029 -51 ct 5057 -51 5080 -58 5099 -72 ct 5118 -87 l 5134 -110 l -p -4901 -261 m 5146 -261 l 5143 -298 5133 -326 5118 -344 ct 5094 -373 5063 -387 5025 -387 ct -4991 -387 4963 -376 4939 -353 ct 4916 -330 l 4903 -300 l p ef -5320 0 m 5320 -439 l 5387 -439 l 5387 -376 l 5420 -425 5466 -449 5527 -449 ct -5554 -449 5578 -444 5600 -434 ct 5622 -425 5639 -412 5650 -397 ct 5661 -382 5669 -363 5673 -342 ct -5676 -328 5677 -304 5677 -270 ct 5677 0 l 5603 0 l 5603 -267 l 5603 -297 5600 -320 5594 -335 ct -5588 -350 5578 -362 5563 -371 ct 5549 -380 5531 -384 5511 -384 ct 5480 -384 5452 -374 5429 -354 ct -5406 -334 5395 -296 5395 -239 ct 5395 0 l p ef -6083 -160 m 6156 -151 l 6148 -100 6128 -61 6095 -32 ct 6062 -4 6021 9 5973 9 ct -5913 9 5865 -9 5828 -49 ct 5792 -88 5774 -144 5774 -217 ct 5774 -265 5781 -306 5797 -342 ct -5813 -378 5837 -404 5869 -422 ct 5901 -440 5936 -449 5974 -449 ct 6021 -449 6060 -437 6091 -412 ct -6121 -388 6141 -354 6149 -310 ct 6077 -299 l 6070 -328 6058 -350 6040 -365 ct -6023 -380 6001 -387 5977 -387 ct 5939 -387 5909 -374 5885 -347 ct 5862 -320 5850 -278 5850 -220 ct -5850 -161 5861 -118 5884 -91 ct 5907 -64 5936 -51 5973 -51 ct 6002 -51 6026 -60 6046 -78 ct -6065 -96 l 6078 -123 l p ef -6217 169 m 6209 99 l 6225 103 6239 105 6251 105 ct 6268 105 6281 103 6291 97 ct -6301 92 6309 84 6315 74 ct 6320 66 6328 48 6338 19 ct 6340 14 6342 8 6345 0 ct -6178 -439 l 6258 -439 l 6350 -184 l 6362 -152 6372 -118 6382 -83 ct 6390 -117 6400 -150 6412 -183 ct -6506 -439 l 6581 -439 l 6413 7 l 6396 55 6382 88 6372 107 ct 6358 131 6343 149 6326 161 ct -6309 172 6289 178 6265 178 ct 6251 178 l 6235 175 l p ef -pom -pum -7778 20188 t -26 -181 m 26 -256 l 255 -256 l 255 -181 l p ef -364 0 m 364 -381 l 298 -381 l 298 -439 l 364 -439 l 364 -485 l 364 -515 367 -537 372 -551 ct -379 -571 392 -586 410 -598 ct 428 -610 453 -616 486 -616 ct 507 -616 530 -614 555 -609 ct -544 -544 l 529 -547 514 -548 500 -548 ct 478 -548 462 -543 452 -533 ct 443 -524 438 -506 438 -479 ct -438 -439 l 524 -439 l 524 -381 l 438 -381 l 438 0 l p ef -555 -131 m 628 -142 l 632 -113 644 -90 663 -74 ct 682 -59 708 -51 742 -51 ct -776 -51 801 -58 818 -72 ct 835 -86 843 -102 843 -121 ct 843 -138 836 -151 821 -160 ct -811 -167 785 -175 745 -186 ct 690 -199 652 -211 631 -221 ct 610 -231 594 -245 583 -263 ct -572 -281 567 -301 567 -322 ct 567 -342 571 -360 580 -376 ct 589 -393 602 -407 617 -418 ct -629 -427 644 -434 664 -440 ct 684 -446 706 -449 729 -449 ct 763 -449 793 -444 819 -434 ct -846 -424 865 -410 877 -393 ct 890 -376 898 -354 903 -325 ct 830 -315 l 827 -338 817 -356 801 -368 ct -785 -381 763 -387 734 -387 ct 700 -387 675 -382 661 -370 ct 646 -359 639 -346 639 -331 ct -639 -321 642 -312 648 -305 ct 654 -297 664 -290 677 -285 ct 684 -282 706 -276 742 -266 ct -795 -252 832 -240 853 -231 ct 873 -222 890 -209 902 -192 ct 913 -175 919 -154 919 -129 ct -919 -104 912 -80 898 -58 ct 883 -37 862 -20 835 -8 ct 808 3 777 9 742 9 ct 685 9 642 -1 612 -25 ct -582 -49 l 563 -84 l p ef -926 10 m 1101 -616 l 1161 -616 l 985 10 l p ef -1590 -71 m 1590 0 l 1189 0 l 1189 -17 1191 -35 1198 -51 ct 1208 -79 1224 -105 1247 -132 ct -1269 -158 1302 -189 1344 -224 ct 1410 -278 1455 -321 1478 -352 ct 1501 -384 1513 -413 1513 -442 ct -1513 -471 1502 -496 1481 -516 ct 1460 -537 1432 -547 1398 -547 ct 1363 -547 1334 -536 1312 -514 ct -1291 -493 1280 -463 1280 -425 ct 1203 -433 l 1208 -490 1228 -533 1262 -563 ct -1297 -593 1342 -608 1400 -608 ct 1458 -608 1504 -592 1538 -560 ct 1572 -528 1589 -488 1589 -440 ct -1589 -416 1584 -392 1574 -368 ct 1564 -345 1548 -320 1525 -294 ct 1502 -268 1463 -233 1410 -188 ct -1365 -150 1337 -125 1324 -111 ct 1311 -98 1301 -85 1293 -71 ct p ef -2097 -66 m 2108 0 l 2087 3 2068 5 2051 5 ct 2024 5 2003 1 1989 -7 ct 1974 -15 1963 -26 1957 -40 ct -1951 -54 1948 -83 1948 -128 ct 1948 -381 l 1893 -381 l 1893 -439 l 1948 -439 l -1948 -547 l 2022 -592 l 2022 -439 l 2097 -439 l 2097 -381 l 2022 -381 l -2022 -124 l 2022 -103 2023 -89 2026 -83 ct 2029 -77 2033 -72 2039 -69 ct 2045 -65 2053 -63 2064 -63 ct -2072 -63 l 2083 -64 l p ef -2145 -219 m 2145 -300 2167 -361 2212 -400 ct 2250 -432 2296 -449 2351 -449 ct -2411 -449 2460 -429 2499 -389 ct 2537 -350 2556 -295 2556 -225 ct 2556 -169 2548 -124 2531 -92 ct -2514 -60 2489 -34 2457 -16 ct 2424 0 2389 9 2351 9 ct 2289 9 2239 -9 2201 -49 ct -2164 -88 l 2145 -145 l p -2221 -219 m 2221 -163 2233 -121 2258 -93 ct 2282 -65 2313 -51 2351 -51 ct 2388 -51 2418 -65 2443 -93 ct -2467 -121 2480 -164 2480 -222 ct 2480 -276 2467 -317 2443 -345 ct 2418 -373 2387 -387 2351 -387 ct -2313 -387 2282 -373 2258 -345 ct 2233 -317 l 2221 -275 l p ef -3043 -98 m 3043 -264 l 2878 -264 l 2878 -333 l 3043 -333 l 3043 -498 l -3113 -498 l 3113 -333 l 3278 -333 l 3278 -264 l 3113 -264 l 3113 -98 l -p ef -3407 0 m 3407 -381 l 3341 -381 l 3341 -439 l 3407 -439 l 3407 -485 l -3407 -515 3410 -537 3415 -551 ct 3422 -571 3435 -586 3453 -598 ct 3471 -610 3496 -616 3529 -616 ct -3550 -616 3573 -614 3598 -609 ct 3587 -544 l 3572 -547 3557 -548 3543 -548 ct -3521 -548 3505 -543 3495 -533 ct 3486 -524 3481 -506 3481 -479 ct 3481 -439 l -3567 -439 l 3567 -381 l 3481 -381 l 3481 0 l p ef -3598 -131 m 3671 -142 l 3675 -113 3687 -90 3706 -74 ct 3725 -59 3751 -51 3785 -51 ct -3819 -51 3844 -58 3861 -72 ct 3878 -86 3886 -102 3886 -121 ct 3886 -138 3879 -151 3864 -160 ct -3854 -167 3828 -175 3788 -186 ct 3733 -199 3695 -211 3674 -221 ct 3653 -231 3637 -245 3626 -263 ct -3615 -281 3610 -301 3610 -322 ct 3610 -342 3614 -360 3623 -376 ct 3632 -393 3645 -407 3660 -418 ct -3672 -427 3687 -434 3707 -440 ct 3727 -446 3749 -449 3772 -449 ct 3806 -449 3836 -444 3862 -434 ct -3889 -424 3908 -410 3920 -393 ct 3933 -376 3941 -354 3946 -325 ct 3873 -315 l -3870 -338 3860 -356 3844 -368 ct 3828 -381 3806 -387 3777 -387 ct 3743 -387 3718 -382 3704 -370 ct -3689 -359 3682 -346 3682 -331 ct 3682 -321 3685 -312 3691 -305 ct 3697 -297 3707 -290 3720 -285 ct -3727 -282 3749 -276 3785 -266 ct 3838 -252 3875 -240 3896 -231 ct 3916 -222 3933 -209 3945 -192 ct -3956 -175 3962 -154 3962 -129 ct 3962 -104 3955 -80 3941 -58 ct 3926 -37 3905 -20 3878 -8 ct -3851 3 3820 9 3785 9 ct 3728 9 3685 -1 3655 -25 ct 3625 -49 l 3606 -84 l p ef -3969 10 m 4144 -616 l 4204 -616 l 4028 10 l p ef -4633 -71 m 4633 0 l 4232 0 l 4232 -17 4234 -35 4241 -51 ct 4251 -79 4267 -105 4290 -132 ct -4312 -158 4345 -189 4387 -224 ct 4453 -278 4498 -321 4521 -352 ct 4544 -384 4556 -413 4556 -442 ct -4556 -471 4545 -496 4524 -516 ct 4503 -537 4475 -547 4441 -547 ct 4406 -547 4377 -536 4355 -514 ct -4334 -493 4323 -463 4323 -425 ct 4246 -433 l 4251 -490 4271 -533 4305 -563 ct -4340 -593 4385 -608 4443 -608 ct 4501 -608 4547 -592 4581 -560 ct 4615 -528 4632 -488 4632 -440 ct -4632 -416 4627 -392 4617 -368 ct 4607 -345 4591 -320 4568 -294 ct 4545 -268 4506 -233 4453 -188 ct -4408 -150 4380 -125 4367 -111 ct 4354 -98 4344 -85 4336 -71 ct p ef -pom -gr -10161 16546 m 10011 16996 l 10311 16995 l 10161 16546 l p ef -10161 18381 m 10161 16906 l ps -gs -pum -2805 3466 t -38 -194 m 113 -201 l 117 -171 125 -146 138 -126 ct 151 -107 172 -91 199 -79 ct -227 -67 258 -61 292 -61 ct 323 -61 350 -66 373 -75 ct 397 -84 414 -96 426 -112 ct -437 -128 443 -145 443 -164 ct 443 -183 437 -200 426 -214 ct 415 -228 397 -240 372 -250 ct -355 -256 319 -266 264 -279 ct 208 -293 169 -305 147 -317 ct 118 -332 96 -351 82 -374 ct -68 -396 61 -421 61 -449 ct 61 -480 69 -508 87 -535 ct 104 -561 130 -582 163 -595 ct -196 -609 233 -616 274 -616 ct 319 -616 359 -609 393 -594 ct 427 -580 454 -559 472 -531 ct -491 -502 501 -471 502 -435 ct 425 -429 l 421 -468 407 -496 383 -516 ct 359 -536 324 -545 277 -545 ct -229 -545 194 -537 171 -519 ct 149 -501 138 -480 138 -454 ct 138 -433 146 -415 162 -401 ct -177 -387 217 -372 283 -357 ct 348 -343 393 -330 417 -319 ct 452 -303 478 -282 495 -257 ct -512 -232 520 -203 520 -171 ct 520 -138 511 -108 492 -80 ct 474 -51 447 -29 413 -13 ct -378 2 339 10 296 10 ct 241 10 195 2 158 -13 ct 121 -29 92 -53 71 -85 ct 50 -117 l -39 -154 l p ef -924 -54 m 896 -30 870 -14 844 -4 ct 819 5 791 9 762 9 ct 714 9 677 -1 651 -25 ct -625 -49 612 -79 612 -115 ct 612 -137 617 -156 627 -174 ct 637 -192 649 -206 665 -217 ct -681 -228 699 -236 719 -241 ct 733 -245 755 -249 785 -253 ct 845 -260 889 -268 918 -278 ct -918 -288 918 -295 918 -298 ct 918 -328 911 -349 897 -362 ct 878 -379 850 -387 812 -387 ct -777 -387 751 -381 735 -369 ct 718 -356 706 -335 698 -303 ct 625 -313 l 632 -345 642 -370 658 -389 ct -673 -408 695 -423 723 -433 ct 752 -443 785 -449 823 -449 ct 861 -449 891 -444 914 -435 ct -938 -427 955 -415 966 -402 ct 977 -389 985 -372 989 -351 ct 992 -339 993 -316 993 -283 ct -993 -184 l 993 -114 995 -71 998 -52 ct 1001 -34 1007 -16 1017 0 ct 939 0 l -931 -15 l 926 -33 l p -918 -220 m 891 -209 850 -200 796 -192 ct 766 -187 744 -182 731 -177 ct 719 -171 709 -163 702 -153 ct -695 -142 692 -130 692 -117 ct 692 -98 699 -81 714 -68 ct 729 -55 751 -48 780 -48 ct -809 -48 834 -54 857 -67 ct 879 -79 895 -96 906 -118 ct 914 -135 918 -160 918 -193 ct -p ef -1087 0 m 1087 -439 l 1154 -439 l 1154 -377 l 1168 -399 1186 -416 1209 -429 ct -1232 -442 1258 -449 1287 -449 ct 1320 -449 1346 -442 1367 -428 ct 1388 -415 1403 -396 1411 -372 ct -1446 -423 1491 -449 1547 -449 ct 1590 -449 1624 -437 1647 -412 ct 1671 -388 1682 -351 1682 -301 ct -1682 0 l 1608 0 l 1608 -276 l 1608 -306 1606 -327 1601 -340 ct 1596 -354 1588 -364 1575 -372 ct -1562 -380 1547 -384 1530 -384 ct 1499 -384 1474 -374 1453 -353 ct 1433 -333 1423 -300 1423 -255 ct -1423 0 l 1348 0 l 1348 -285 l 1348 -318 1342 -343 1330 -359 ct 1318 -376 1298 -384 1271 -384 ct -1250 -384 1230 -379 1212 -368 ct 1195 -357 1182 -340 1174 -319 ct 1166 -298 1162 -267 1162 -227 ct -1162 0 l p ef -1801 168 m 1801 -439 l 1869 -439 l 1869 -382 l 1885 -404 1903 -421 1923 -432 ct -1943 -443 1968 -449 1997 -449 ct 2034 -449 2067 -439 2096 -420 ct 2124 -400 2146 -373 2161 -338 ct -2175 -303 2183 -264 2183 -222 ct 2183 -177 2175 -137 2158 -101 ct 2142 -65 2119 -37 2088 -18 ct -2057 0 2025 9 1991 9 ct 1966 9 1944 4 1924 -5 ct 1905 -16 1888 -29 1876 -45 ct -1876 168 l p -1869 -217 m 1869 -160 1880 -118 1903 -91 ct 1926 -64 1954 -51 1986 -51 ct 2019 -51 2048 -65 2071 -93 ct -2095 -121 2107 -164 2107 -223 ct 2107 -279 2095 -321 2072 -349 ct 2049 -376 2022 -390 1990 -390 ct -1958 -390 1930 -376 1905 -346 ct 1881 -316 l 1869 -273 l p ef -2250 0 m 2250 -606 l 2324 -606 l 2324 0 l p ef -2437 -520 m 2437 -606 l 2511 -606 l 2511 -520 l p -2437 0 m 2437 -439 l 2511 -439 l 2511 0 l p ef -2621 0 m 2621 -439 l 2688 -439 l 2688 -376 l 2721 -425 2767 -449 2828 -449 ct -2855 -449 2879 -444 2901 -434 ct 2923 -425 2940 -412 2951 -397 ct 2962 -382 2970 -363 2974 -342 ct -2977 -328 2978 -304 2978 -270 ct 2978 0 l 2904 0 l 2904 -267 l 2904 -297 2901 -320 2895 -335 ct -2889 -350 2879 -362 2864 -371 ct 2850 -380 2832 -384 2812 -384 ct 2781 -384 2753 -374 2730 -354 ct -2707 -334 2696 -296 2696 -239 ct 2696 0 l p ef -3085 36 m 3157 47 l 3160 69 3169 85 3182 95 ct 3201 109 3226 116 3258 116 ct -3292 116 3319 109 3338 95 ct 3357 82 3369 62 3376 38 ct 3380 22 3381 -8 3381 -57 ct -3349 -19 3308 0 3260 0 ct 3199 0 3153 -21 3119 -65 ct 3086 -108 3070 -161 3070 -222 ct -3070 -264 3077 -302 3093 -338 ct 3108 -373 3130 -400 3159 -420 ct 3187 -439 3221 -449 3260 -449 ct -3312 -449 3355 -428 3388 -386 ct 3388 -439 l 3457 -439 l 3457 -59 l 3457 8 3450 57 3436 85 ct -3422 114 3400 136 3370 153 ct 3340 169 3303 178 3258 178 ct 3206 178 3164 166 3131 142 ct -3099 119 l 3084 83 l p -3146 -227 m 3146 -169 3158 -127 3181 -101 ct 3204 -74 3232 -61 3267 -61 ct -3301 -61 3330 -74 3353 -101 ct 3376 -127 3387 -168 3387 -224 ct 3387 -278 3376 -319 3352 -346 ct -3328 -373 3299 -387 3265 -387 ct 3232 -387 3204 -374 3181 -347 ct 3158 -320 l -3146 -280 l p ef -3812 0 m 3812 -439 l 3879 -439 l 3879 -372 l 3896 -403 3911 -424 3926 -434 ct -3940 -444 3956 -449 3974 -449 ct 3999 -449 4024 -441 4050 -425 ct 4025 -356 l -4006 -366 3988 -372 3970 -372 ct 3954 -372 3939 -367 3926 -357 ct 3913 -347 3904 -334 3898 -316 ct -3890 -290 3886 -261 3886 -229 ct 3886 0 l p ef -4390 -54 m 4362 -30 4336 -14 4310 -4 ct 4285 5 4257 9 4228 9 ct 4180 9 4143 -1 4117 -25 ct -4091 -49 4078 -79 4078 -115 ct 4078 -137 4083 -156 4093 -174 ct 4103 -192 4115 -206 4131 -217 ct -4147 -228 4165 -236 4185 -241 ct 4199 -245 4221 -249 4251 -253 ct 4311 -260 4355 -268 4384 -278 ct -4384 -288 4384 -295 4384 -298 ct 4384 -328 4377 -349 4363 -362 ct 4344 -379 4316 -387 4278 -387 ct -4243 -387 4217 -381 4201 -369 ct 4184 -356 4172 -335 4164 -303 ct 4091 -313 l -4098 -345 4108 -370 4124 -389 ct 4139 -408 4161 -423 4189 -433 ct 4218 -443 4251 -449 4289 -449 ct -4327 -449 4357 -444 4380 -435 ct 4404 -427 4421 -415 4432 -402 ct 4443 -389 4451 -372 4455 -351 ct -4458 -339 4459 -316 4459 -283 ct 4459 -184 l 4459 -114 4461 -71 4464 -52 ct -4467 -34 4473 -16 4483 0 ct 4405 0 l 4397 -15 l 4392 -33 l p -4384 -220 m 4357 -209 4316 -200 4262 -192 ct 4232 -187 4210 -182 4197 -177 ct -4185 -171 4175 -163 4168 -153 ct 4161 -142 4158 -130 4158 -117 ct 4158 -98 4165 -81 4180 -68 ct -4195 -55 4217 -48 4246 -48 ct 4275 -48 4300 -54 4323 -67 ct 4345 -79 4361 -96 4372 -118 ct -4380 -135 4384 -160 4384 -193 ct p ef -4716 -66 m 4727 0 l 4706 3 4687 5 4670 5 ct 4643 5 4622 1 4608 -7 ct 4593 -15 4582 -26 4576 -40 ct -4570 -54 4567 -83 4567 -128 ct 4567 -381 l 4512 -381 l 4512 -439 l 4567 -439 l -4567 -547 l 4641 -592 l 4641 -439 l 4716 -439 l 4716 -381 l 4641 -381 l -4641 -124 l 4641 -103 4642 -89 4645 -83 ct 4648 -77 4652 -72 4658 -69 ct 4664 -65 4672 -63 4683 -63 ct -4691 -63 l 4702 -64 l p ef -5092 -141 m 5169 -131 l 5157 -86 5134 -52 5102 -27 ct 5069 -2 5027 9 4976 9 ct -4912 9 4861 -9 4823 -49 ct 4785 -88 4767 -144 4767 -215 ct 4767 -289 4786 -347 4824 -387 ct -4862 -428 4911 -449 4972 -449 ct 5030 -449 5078 -429 5116 -389 ct 5153 -349 5171 -292 5171 -220 ct -5171 -216 5171 -209 5171 -200 ct 4843 -200 l 4846 -152 4860 -115 4884 -89 ct -4909 -64 4940 -51 4976 -51 ct 5004 -51 5027 -58 5046 -72 ct 5065 -87 l 5081 -110 l -p -4848 -261 m 5093 -261 l 5090 -298 5080 -326 5065 -344 ct 5041 -373 5010 -387 4972 -387 ct -4938 -387 4910 -376 4886 -353 ct 4863 -330 l 4850 -300 l p ef -5897 -356 m 5497 -356 l 5497 -425 l 5897 -425 l p -5897 -172 m 5497 -172 l 5497 -241 l 5897 -241 l p ef -6264 0 m 6264 -381 l 6198 -381 l 6198 -439 l 6264 -439 l 6264 -485 l -6264 -515 6267 -537 6272 -551 ct 6279 -571 6292 -586 6310 -598 ct 6328 -610 6353 -616 6386 -616 ct -6407 -616 6430 -614 6455 -609 ct 6444 -544 l 6429 -547 6414 -548 6400 -548 ct -6378 -548 6362 -543 6352 -533 ct 6343 -524 6338 -506 6338 -479 ct 6338 -439 l -6424 -439 l 6424 -381 l 6338 -381 l 6338 0 l p ef -6455 -131 m 6528 -142 l 6532 -113 6544 -90 6563 -74 ct 6582 -59 6608 -51 6642 -51 ct -6676 -51 6701 -58 6718 -72 ct 6735 -86 6743 -102 6743 -121 ct 6743 -138 6736 -151 6721 -160 ct -6711 -167 6685 -175 6645 -186 ct 6590 -199 6552 -211 6531 -221 ct 6510 -231 6494 -245 6483 -263 ct -6472 -281 6467 -301 6467 -322 ct 6467 -342 6471 -360 6480 -376 ct 6489 -393 6502 -407 6517 -418 ct -6529 -427 6544 -434 6564 -440 ct 6584 -446 6606 -449 6629 -449 ct 6663 -449 6693 -444 6719 -434 ct -6746 -424 6765 -410 6777 -393 ct 6790 -376 6798 -354 6803 -325 ct 6730 -315 l -6727 -338 6717 -356 6701 -368 ct 6685 -381 6663 -387 6634 -387 ct 6600 -387 6575 -382 6561 -370 ct -6546 -359 6539 -346 6539 -331 ct 6539 -321 6542 -312 6548 -305 ct 6554 -297 6564 -290 6577 -285 ct -6584 -282 6606 -276 6642 -266 ct 6695 -252 6732 -240 6753 -231 ct 6773 -222 6790 -209 6802 -192 ct -6813 -175 6819 -154 6819 -129 ct 6819 -104 6812 -80 6798 -58 ct 6783 -37 6762 -20 6735 -8 ct -6708 3 6677 9 6642 9 ct 6585 9 6542 -1 6512 -25 ct 6482 -49 l 6463 -84 l p ef -pom -gr -gs -pum -15981 14102 t -62 0 m 62 -606 l 289 -606 l 335 -606 372 -600 400 -587 ct 428 -575 450 -556 466 -531 ct -482 -505 490 -479 490 -451 ct 490 -425 483 -400 469 -378 ct 455 -355 434 -336 405 -322 ct -442 -311 470 -293 490 -267 ct 510 -241 519 -211 519 -175 ct 519 -147 513 -120 501 -96 ct -489 -72 475 -53 457 -40 ct 439 -26 417 -16 391 -10 ct 364 -3 331 0 293 0 ct p -142 -351 m 273 -351 l 308 -351 334 -353 349 -358 ct 370 -364 385 -374 395 -388 ct -406 -402 411 -420 411 -441 ct 411 -461 406 -479 397 -494 ct 387 -510 373 -520 355 -526 ct -337 -531 307 -534 263 -534 ct 142 -534 l p -142 -71 m 293 -71 l 319 -71 337 -72 347 -74 ct 366 -77 381 -83 394 -90 ct -406 -98 416 -109 424 -124 ct 432 -139 436 -156 436 -175 ct 436 -198 430 -218 419 -234 ct -407 -251 391 -263 371 -269 ct 350 -276 321 -279 282 -279 ct 142 -279 l p ef -898 -54 m 870 -30 844 -14 818 -4 ct 793 5 765 9 736 9 ct 688 9 651 -1 625 -25 ct -599 -49 586 -79 586 -115 ct 586 -137 591 -156 601 -174 ct 611 -192 623 -206 639 -217 ct -655 -228 673 -236 693 -241 ct 707 -245 729 -249 759 -253 ct 819 -260 863 -268 892 -278 ct -892 -288 892 -295 892 -298 ct 892 -328 885 -349 871 -362 ct 852 -379 824 -387 786 -387 ct -751 -387 725 -381 709 -369 ct 692 -356 680 -335 672 -303 ct 599 -313 l 606 -345 616 -370 632 -389 ct -647 -408 669 -423 697 -433 ct 726 -443 759 -449 797 -449 ct 835 -449 865 -444 888 -435 ct -912 -427 929 -415 940 -402 ct 951 -389 959 -372 963 -351 ct 966 -339 967 -316 967 -283 ct -967 -184 l 967 -114 969 -71 972 -52 ct 975 -34 981 -16 991 0 ct 913 0 l 905 -15 l -900 -33 l p -892 -220 m 865 -209 824 -200 770 -192 ct 740 -187 718 -182 705 -177 ct 693 -171 683 -163 676 -153 ct -669 -142 666 -130 666 -117 ct 666 -98 673 -81 688 -68 ct 703 -55 725 -48 754 -48 ct -783 -48 808 -54 831 -67 ct 853 -79 869 -96 880 -118 ct 888 -135 892 -160 892 -193 ct -p ef -1060 0 m 1060 -439 l 1127 -439 l 1127 -376 l 1160 -425 1206 -449 1267 -449 ct -1294 -449 1318 -444 1340 -434 ct 1362 -425 1379 -412 1390 -397 ct 1401 -382 1409 -363 1413 -342 ct -1416 -328 1417 -304 1417 -270 ct 1417 0 l 1343 0 l 1343 -267 l 1343 -297 1340 -320 1334 -335 ct -1328 -350 1318 -362 1303 -371 ct 1289 -380 1271 -384 1251 -384 ct 1220 -384 1192 -374 1169 -354 ct -1146 -334 1135 -296 1135 -239 ct 1135 0 l p ef -1822 0 m 1822 -55 l 1794 -11 1754 9 1699 9 ct 1664 9 1632 0 1603 -19 ct 1574 -38 1551 -65 1535 -99 ct -1519 -134 1510 -174 1510 -219 ct 1510 -263 1518 -302 1532 -338 ct 1547 -374 1569 -401 1598 -420 ct -1627 -439 1660 -449 1696 -449 ct 1723 -449 1746 -443 1767 -432 ct 1788 -421 1804 -406 1817 -388 ct -1817 -606 l 1891 -606 l 1891 0 l p -1587 -219 m 1587 -162 1599 -120 1623 -93 ct 1646 -65 1674 -51 1706 -51 ct 1739 -51 1767 -64 1789 -91 ct -1812 -117 1824 -158 1824 -212 ct 1824 -273 1812 -317 1789 -345 ct 1766 -373 1737 -387 1703 -387 ct -1670 -387 1642 -374 1620 -346 ct 1598 -319 l 1587 -277 l p ef -2094 0 m 1960 -439 l 2037 -439 l 2107 -185 l 2133 -91 l 2134 -96 2142 -126 2156 -181 ct -2226 -439 l 2302 -439 l 2368 -184 l 2390 -100 l 2415 -185 l 2490 -439 l -2563 -439 l 2425 0 l 2348 0 l 2278 -263 l 2261 -337 l 2172 0 l p ef -2596 -520 m 2596 -606 l 2670 -606 l 2670 -520 l p -2596 0 m 2596 -439 l 2670 -439 l 2670 0 l p ef -3065 0 m 3065 -55 l 3037 -11 2997 9 2942 9 ct 2907 9 2875 0 2846 -19 ct 2817 -38 2794 -65 2778 -99 ct -2762 -134 2753 -174 2753 -219 ct 2753 -263 2761 -302 2775 -338 ct 2790 -374 2812 -401 2841 -420 ct -2870 -439 2903 -449 2939 -449 ct 2966 -449 2989 -443 3010 -432 ct 3031 -421 3047 -406 3060 -388 ct -3060 -606 l 3134 -606 l 3134 0 l p -2830 -219 m 2830 -162 2842 -120 2866 -93 ct 2889 -65 2917 -51 2949 -51 ct 2982 -51 3010 -64 3032 -91 ct -3055 -117 3067 -158 3067 -212 ct 3067 -273 3055 -317 3032 -345 ct 3009 -373 2980 -387 2946 -387 ct -2913 -387 2885 -374 2863 -346 ct 2841 -319 l 2830 -277 l p ef -3419 -66 m 3430 0 l 3409 3 3390 5 3373 5 ct 3346 5 3325 1 3311 -7 ct 3296 -15 3285 -26 3279 -40 ct -3273 -54 3270 -83 3270 -128 ct 3270 -381 l 3215 -381 l 3215 -439 l 3270 -439 l -3270 -547 l 3344 -592 l 3344 -439 l 3419 -439 l 3419 -381 l 3344 -381 l -3344 -124 l 3344 -103 3345 -89 3348 -83 ct 3351 -77 3355 -72 3361 -69 ct 3367 -65 3375 -63 3386 -63 ct -3394 -63 l 3405 -64 l p ef -3495 0 m 3495 -606 l 3570 -606 l 3570 -388 l 3605 -429 3648 -449 3701 -449 ct -3734 -449 3762 -442 3786 -429 ct 3810 -417 3827 -399 3838 -376 ct 3848 -354 3853 -321 3853 -278 ct -3853 0 l 3779 0 l 3779 -278 l 3779 -315 3771 -342 3754 -359 ct 3738 -376 3716 -385 3686 -385 ct -3664 -385 3643 -379 3624 -367 ct 3604 -356 3590 -340 3582 -321 ct 3574 -301 3570 -274 3570 -240 ct -3570 0 l p ef -pom -pum -15888 15055 t -340 0 m 340 -55 l 312 -11 272 9 217 9 ct 182 9 150 0 121 -19 ct 92 -38 69 -65 53 -99 ct -37 -134 28 -174 28 -219 ct 28 -263 36 -302 50 -338 ct 65 -374 87 -401 116 -420 ct -145 -439 178 -449 214 -449 ct 241 -449 264 -443 285 -432 ct 306 -421 322 -406 335 -388 ct -335 -606 l 409 -606 l 409 0 l p -105 -219 m 105 -162 117 -120 141 -93 ct 164 -65 192 -51 224 -51 ct 257 -51 285 -64 307 -91 ct -330 -117 342 -158 342 -212 ct 342 -273 330 -317 307 -345 ct 284 -373 255 -387 221 -387 ct -188 -387 160 -374 138 -346 ct 116 -319 l 105 -277 l p ef -832 -141 m 909 -131 l 897 -86 874 -52 842 -27 ct 809 -2 767 9 716 9 ct 652 9 601 -9 563 -49 ct -525 -88 507 -144 507 -215 ct 507 -289 526 -347 564 -387 ct 602 -428 651 -449 712 -449 ct -770 -449 818 -429 856 -389 ct 893 -349 911 -292 911 -220 ct 911 -216 911 -209 911 -200 ct -583 -200 l 586 -152 600 -115 624 -89 ct 649 -64 680 -51 716 -51 ct 744 -51 767 -58 786 -72 ct -805 -87 l 821 -110 l p -588 -261 m 833 -261 l 830 -298 820 -326 805 -344 ct 781 -373 750 -387 712 -387 ct -678 -387 650 -376 626 -353 ct 603 -330 l 590 -300 l p ef -1295 -160 m 1368 -151 l 1360 -100 1340 -61 1307 -32 ct 1274 -4 1233 9 1185 9 ct -1125 9 1077 -9 1040 -49 ct 1004 -88 986 -144 986 -217 ct 986 -265 993 -306 1009 -342 ct -1025 -378 1049 -404 1081 -422 ct 1113 -440 1148 -449 1186 -449 ct 1233 -449 1272 -437 1303 -412 ct -1333 -388 1353 -354 1361 -310 ct 1289 -299 l 1282 -328 1270 -350 1252 -365 ct -1235 -380 1213 -387 1189 -387 ct 1151 -387 1121 -374 1097 -347 ct 1074 -320 1062 -278 1062 -220 ct -1062 -161 1073 -118 1096 -91 ct 1119 -64 1148 -51 1185 -51 ct 1214 -51 1238 -60 1258 -78 ct -1277 -96 l 1290 -123 l p ef -1432 -520 m 1432 -606 l 1506 -606 l 1506 -520 l p -1432 0 m 1432 -439 l 1506 -439 l 1506 0 l p ef -1616 0 m 1616 -439 l 1683 -439 l 1683 -377 l 1697 -399 1715 -416 1738 -429 ct -1761 -442 1787 -449 1816 -449 ct 1849 -449 1875 -442 1896 -428 ct 1917 -415 1932 -396 1940 -372 ct -1975 -423 2020 -449 2076 -449 ct 2119 -449 2153 -437 2176 -412 ct 2200 -388 2211 -351 2211 -301 ct -2211 0 l 2137 0 l 2137 -276 l 2137 -306 2135 -327 2130 -340 ct 2125 -354 2117 -364 2104 -372 ct -2091 -380 2076 -384 2059 -384 ct 2028 -384 2003 -374 1982 -353 ct 1962 -333 1952 -300 1952 -255 ct -1952 0 l 1877 0 l 1877 -285 l 1877 -318 1871 -343 1859 -359 ct 1847 -376 1827 -384 1800 -384 ct -1779 -384 1759 -379 1741 -368 ct 1724 -357 1711 -340 1703 -319 ct 1695 -298 1691 -267 1691 -227 ct -1691 0 l p ef -2617 -54 m 2589 -30 2563 -14 2537 -4 ct 2512 5 2484 9 2455 9 ct 2407 9 2370 -1 2344 -25 ct -2318 -49 2305 -79 2305 -115 ct 2305 -137 2310 -156 2320 -174 ct 2330 -192 2342 -206 2358 -217 ct -2374 -228 2392 -236 2412 -241 ct 2426 -245 2448 -249 2478 -253 ct 2538 -260 2582 -268 2611 -278 ct -2611 -288 2611 -295 2611 -298 ct 2611 -328 2604 -349 2590 -362 ct 2571 -379 2543 -387 2505 -387 ct -2470 -387 2444 -381 2428 -369 ct 2411 -356 2399 -335 2391 -303 ct 2318 -313 l -2325 -345 2335 -370 2351 -389 ct 2366 -408 2388 -423 2416 -433 ct 2445 -443 2478 -449 2516 -449 ct -2554 -449 2584 -444 2607 -435 ct 2631 -427 2648 -415 2659 -402 ct 2670 -389 2678 -372 2682 -351 ct -2685 -339 2686 -316 2686 -283 ct 2686 -184 l 2686 -114 2688 -71 2691 -52 ct -2694 -34 2700 -16 2710 0 ct 2632 0 l 2624 -15 l 2619 -33 l p -2611 -220 m 2584 -209 2543 -200 2489 -192 ct 2459 -187 2437 -182 2424 -177 ct -2412 -171 2402 -163 2395 -153 ct 2388 -142 2385 -130 2385 -117 ct 2385 -98 2392 -81 2407 -68 ct -2422 -55 2444 -48 2473 -48 ct 2502 -48 2527 -54 2550 -67 ct 2572 -79 2588 -96 2599 -118 ct -2607 -135 2611 -160 2611 -193 ct p ef -2943 -66 m 2954 0 l 2933 3 2914 5 2897 5 ct 2870 5 2849 1 2835 -7 ct 2820 -15 2809 -26 2803 -40 ct -2797 -54 2794 -83 2794 -128 ct 2794 -381 l 2739 -381 l 2739 -439 l 2794 -439 l -2794 -547 l 2868 -592 l 2868 -439 l 2943 -439 l 2943 -381 l 2868 -381 l -2868 -124 l 2868 -103 2869 -89 2872 -83 ct 2875 -77 2879 -72 2885 -69 ct 2891 -65 2899 -63 2910 -63 ct -2918 -63 l 2929 -64 l p ef -3019 -520 m 3019 -606 l 3093 -606 l 3093 -520 l p -3019 0 m 3019 -439 l 3093 -439 l 3093 0 l p ef -3177 -219 m 3177 -300 3199 -361 3244 -400 ct 3282 -432 3328 -449 3383 -449 ct -3443 -449 3492 -429 3531 -389 ct 3569 -350 3588 -295 3588 -225 ct 3588 -169 3580 -124 3563 -92 ct -3546 -60 3521 -34 3489 -16 ct 3456 0 3421 9 3383 9 ct 3321 9 3271 -9 3233 -49 ct -3196 -88 l 3177 -145 l p -3253 -219 m 3253 -163 3265 -121 3290 -93 ct 3314 -65 3345 -51 3383 -51 ct 3420 -51 3450 -65 3475 -93 ct -3499 -121 3512 -164 3512 -222 ct 3512 -276 3499 -317 3475 -345 ct 3450 -373 3419 -387 3383 -387 ct -3345 -387 3314 -373 3290 -345 ct 3265 -317 l 3253 -275 l p ef -3680 0 m 3680 -439 l 3747 -439 l 3747 -376 l 3780 -425 3826 -449 3887 -449 ct -3914 -449 3938 -444 3960 -434 ct 3982 -425 3999 -412 4010 -397 ct 4021 -382 4029 -363 4033 -342 ct -4036 -328 4037 -304 4037 -270 ct 4037 0 l 3963 0 l 3963 -267 l 3963 -297 3960 -320 3954 -335 ct -3948 -350 3938 -362 3923 -371 ct 3909 -380 3891 -384 3871 -384 ct 3840 -384 3812 -374 3789 -354 ct -3766 -334 3755 -296 3755 -239 ct 3755 0 l p ef -pom -pum -16087 16008 t -73 0 m 73 -381 l 7 -381 l 7 -439 l 73 -439 l 73 -485 l 73 -515 76 -537 81 -551 ct -88 -571 101 -586 119 -598 ct 137 -610 162 -616 195 -616 ct 216 -616 239 -614 264 -609 ct -253 -544 l 238 -547 223 -548 209 -548 ct 187 -548 171 -543 161 -533 ct 152 -524 147 -506 147 -479 ct -147 -439 l 233 -439 l 233 -381 l 147 -381 l 147 0 l p ef -580 -54 m 552 -30 526 -14 500 -4 ct 475 5 447 9 418 9 ct 370 9 333 -1 307 -25 ct -281 -49 268 -79 268 -115 ct 268 -137 273 -156 283 -174 ct 293 -192 305 -206 321 -217 ct -337 -228 355 -236 375 -241 ct 389 -245 411 -249 441 -253 ct 501 -260 545 -268 574 -278 ct -574 -288 574 -295 574 -298 ct 574 -328 567 -349 553 -362 ct 534 -379 506 -387 468 -387 ct -433 -387 407 -381 391 -369 ct 374 -356 362 -335 354 -303 ct 281 -313 l 288 -345 298 -370 314 -389 ct -329 -408 351 -423 379 -433 ct 408 -443 441 -449 479 -449 ct 517 -449 547 -444 570 -435 ct -594 -427 611 -415 622 -402 ct 633 -389 641 -372 645 -351 ct 648 -339 649 -316 649 -283 ct -649 -184 l 649 -114 651 -71 654 -52 ct 657 -34 663 -16 673 0 ct 595 0 l 587 -15 l -582 -33 l p -574 -220 m 547 -209 506 -200 452 -192 ct 422 -187 400 -182 387 -177 ct 375 -171 365 -163 358 -153 ct -351 -142 348 -130 348 -117 ct 348 -98 355 -81 370 -68 ct 385 -55 407 -48 436 -48 ct -465 -48 490 -54 513 -67 ct 535 -79 551 -96 562 -118 ct 570 -135 574 -160 574 -193 ct -p ef -1030 -160 m 1103 -151 l 1095 -100 1075 -61 1042 -32 ct 1009 -4 968 9 920 9 ct -860 9 812 -9 775 -49 ct 739 -88 721 -144 721 -217 ct 721 -265 728 -306 744 -342 ct -760 -378 784 -404 816 -422 ct 848 -440 883 -449 921 -449 ct 968 -449 1007 -437 1038 -412 ct -1068 -388 1088 -354 1096 -310 ct 1024 -299 l 1017 -328 1005 -350 987 -365 ct -970 -380 948 -387 924 -387 ct 886 -387 856 -374 832 -347 ct 809 -320 797 -278 797 -220 ct -797 -161 808 -118 831 -91 ct 854 -64 883 -51 920 -51 ct 949 -51 973 -60 993 -78 ct -1012 -96 l 1025 -123 l p ef -1329 -66 m 1340 0 l 1319 3 1300 5 1283 5 ct 1256 5 1235 1 1221 -7 ct 1206 -15 1195 -26 1189 -40 ct -1183 -54 1180 -83 1180 -128 ct 1180 -381 l 1125 -381 l 1125 -439 l 1180 -439 l -1180 -547 l 1254 -592 l 1254 -439 l 1329 -439 l 1329 -381 l 1254 -381 l -1254 -124 l 1254 -103 1255 -89 1258 -83 ct 1261 -77 1265 -72 1271 -69 ct 1277 -65 1285 -63 1296 -63 ct -1304 -63 l 1315 -64 l p ef -1377 -219 m 1377 -300 1399 -361 1444 -400 ct 1482 -432 1528 -449 1583 -449 ct -1643 -449 1692 -429 1731 -389 ct 1769 -350 1788 -295 1788 -225 ct 1788 -169 1780 -124 1763 -92 ct -1746 -60 1721 -34 1689 -16 ct 1656 0 1621 9 1583 9 ct 1521 9 1471 -9 1433 -49 ct -1396 -88 l 1377 -145 l p -1453 -219 m 1453 -163 1465 -121 1490 -93 ct 1514 -65 1545 -51 1583 -51 ct 1620 -51 1650 -65 1675 -93 ct -1699 -121 1712 -164 1712 -222 ct 1712 -276 1699 -317 1675 -345 ct 1650 -373 1619 -387 1583 -387 ct -1545 -387 1514 -373 1490 -345 ct 1465 -317 l 1453 -275 l p ef -1881 0 m 1881 -439 l 1948 -439 l 1948 -372 l 1965 -403 1980 -424 1995 -434 ct -2009 -444 2025 -449 2043 -449 ct 2068 -449 2093 -441 2119 -425 ct 2094 -356 l -2075 -366 2057 -372 2039 -372 ct 2023 -372 2008 -367 1995 -357 ct 1982 -347 1973 -334 1967 -316 ct -1959 -290 1955 -261 1955 -229 ct 1955 0 l p ef -2802 -356 m 2402 -356 l 2402 -425 l 2802 -425 l p -2802 -172 m 2402 -172 l 2402 -241 l 2802 -241 l p ef -3160 0 m 3160 -606 l 3242 -606 l 3561 -130 l 3561 -606 l 3638 -606 l -3638 0 l 3555 0 l 3237 -476 l 3237 0 l p ef -pom -gr -17781 10461 m 17631 10911 l 17931 10910 l 17781 10461 l p ef -17781 13336 m 17781 10821 l ps -gs -pum -17357 3466 t -73 0 m 73 -381 l 7 -381 l 7 -439 l 73 -439 l 73 -485 l 73 -515 76 -537 81 -551 ct -88 -571 101 -586 119 -598 ct 137 -610 162 -616 195 -616 ct 216 -616 239 -614 264 -609 ct -253 -544 l 238 -547 223 -548 209 -548 ct 187 -548 171 -543 161 -533 ct 152 -524 147 -506 147 -479 ct -147 -439 l 233 -439 l 233 -381 l 147 -381 l 147 0 l p ef -264 -131 m 337 -142 l 341 -113 353 -90 372 -74 ct 391 -59 417 -51 451 -51 ct -485 -51 510 -58 527 -72 ct 544 -86 552 -102 552 -121 ct 552 -138 545 -151 530 -160 ct -520 -167 494 -175 454 -186 ct 399 -199 361 -211 340 -221 ct 319 -231 303 -245 292 -263 ct -281 -281 276 -301 276 -322 ct 276 -342 280 -360 289 -376 ct 298 -393 311 -407 326 -418 ct -338 -427 353 -434 373 -440 ct 393 -446 415 -449 438 -449 ct 472 -449 502 -444 528 -434 ct -555 -424 574 -410 586 -393 ct 599 -376 607 -354 612 -325 ct 539 -315 l 536 -338 526 -356 510 -368 ct -494 -381 472 -387 443 -387 ct 409 -387 384 -382 370 -370 ct 355 -359 348 -346 348 -331 ct -348 -321 351 -312 357 -305 ct 363 -297 373 -290 386 -285 ct 393 -282 415 -276 451 -266 ct -504 -252 541 -240 562 -231 ct 582 -222 599 -209 611 -192 ct 622 -175 628 -154 628 -129 ct -628 -104 621 -80 607 -58 ct 592 -37 571 -20 544 -8 ct 517 3 486 9 451 9 ct 394 9 351 -1 321 -25 ct -291 -49 l 272 -84 l p ef -635 10 m 810 -616 l 870 -616 l 694 10 l p ef -937 0 m 937 -606 l 1019 -606 l 1338 -130 l 1338 -606 l 1415 -606 l -1415 0 l 1332 0 l 1014 -476 l 1014 0 l p ef -pom -gr -22227 6350 m 22199 5876 l 21920 5987 l 22227 6350 l p ef -19422 3175 m 19475 3175 l ps -19528 3175 m 19581 3175 l ps -19634 3175 m 19687 3175 l ps -19740 3175 m 19793 3175 l ps -19846 3175 m 19899 3175 l ps -19952 3175 m 20006 3175 l ps -20059 3175 m 20112 3175 l ps -20165 3175 m 20218 3175 l ps -20271 3175 m 20324 3175 l ps -20377 3175 m 20430 3175 l ps -20483 3175 m 20536 3175 l ps -20590 3175 m 20643 3175 l ps -20696 3175 m 20749 3175 l ps -20802 3175 m 20855 3175 l ps -20908 3175 m 20956 3175 l ps -20956 3175 m 20958 3180 l ps -20977 3229 m 20997 3278 l ps -21017 3328 m 21037 3377 l ps -21056 3426 m 21076 3475 l ps -21096 3525 m 21115 3574 l ps -21135 3623 m 21155 3673 l ps -21175 3722 m 21194 3771 l ps -21214 3821 m 21234 3870 l ps -21254 3919 m 21273 3968 l ps -21293 4018 m 21313 4067 l ps -21332 4116 m 21352 4166 l ps -21372 4215 m 21392 4264 l ps -21411 4313 m 21431 4363 l ps -21451 4412 m 21471 4461 l ps -21490 4511 m 21510 4560 l ps -21530 4609 m 21550 4658 l ps -21569 4708 m 21589 4757 l ps -21609 4806 m 21628 4856 l ps -21648 4905 m 21668 4954 l ps -21688 5003 m 21707 5053 l ps -21727 5102 m 21747 5151 l ps -21767 5201 m 21786 5250 l ps -21806 5299 m 21826 5348 l ps -21845 5398 m 21865 5447 l ps -21885 5496 m 21905 5546 l ps -21924 5595 m 21944 5644 l ps -21964 5693 m 21984 5743 l ps -22003 5792 m 22023 5841 l ps -22043 5891 m 22063 5940 l ps -22082 5989 m 22093 6015 l ps -gr -0 20290 t -pom -count op_count sub {pop} repeat countdictstack dict_count sub {end} repeat b4_inc_state restore -%%PageTrailer -%%Trailer -%%EOF diff --git a/usrp/doc/ddc.png b/usrp/doc/ddc.png Binary files differdeleted file mode 100644 index ce35bc2a9..000000000 --- a/usrp/doc/ddc.png +++ /dev/null diff --git a/usrp/doc/inband-signaling-gigethernet b/usrp/doc/inband-signaling-gigethernet deleted file mode 100644 index 4ca7542d2..000000000 --- a/usrp/doc/inband-signaling-gigethernet +++ /dev/null @@ -1,34 +0,0 @@ -Gigabit Ethernet Interconnect for the USRP2 - -At this point, this is a place to summarize design requirements, -possible solutions, point-counterpoint, etc. - - -Requirements: - -(R1) High throughput and low latency between USRP h/w and user-space. -One of the primary reasons for switching from USB to gigabit ethernet -is to increase throughput. Many users want to be be able to build -WLAN type systems, and are thwarted by the relatively low throughput -available over the USB. Eric thinks we should shoot for at least -100MB/s full-duplex into user space, using packets with payloads on -the order of 256 to 512 bytes. The small packet size is to reduce the -latency. This is important for many MACs that people want to build on -the host side. - -(R2) Non-priviledged user programs should be able to access the USRP. -This could be implemented by a priviledged daemon that actually handles the -low level communication with the USRP2. This daemon may be desirable -for other reasons, including central point of control for -arbitrating/muxing/demuxing between multiple concurrent users (e.g., -Tx, Rx, requests, replies, various logical channels). - -(R3) Some way to flow control the host to USRP2 stream. This is -required in case the user connects an unthrottled signal generator to -the USRP. (This is not uncommon.) The USRP2 to host direction -shouldn't be a problem, since the USRP2 throughput is controlled by -its configuration. It is an error to configure the USRP2 to transmit -data at a higher rate than the transport or host can consume. - -One solution to this requirement could be having the USRP2 emit GigE -"pause" frames. We'll need to confirm that this works. diff --git a/usrp/doc/inband-signaling-usb b/usrp/doc/inband-signaling-usb deleted file mode 100644 index 14f83479a..000000000 --- a/usrp/doc/inband-signaling-usb +++ /dev/null @@ -1,314 +0,0 @@ -This file specifies the format of USB packets used for in-band data -transmission and signaling on the USRP. All packets are 512-byte long, -and are transfered using USB "bulk" transfers. - -IN packets are sent towards the host. -OUT packets are sent away from the host. - -The layout is 32-bits wide. All data is transmitted in little-endian -format across the USB. - - - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - |O|U|D|S|E| RSSI | Chan | mbz | Tag | Payload Len | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Timestamp | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | | - + + - | Payload | - . . - . . - . . - | | - + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | ... | . - +-+-+-+-+-+-+-+ . - . . - . Padding . - . . - | | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - - - mbz Must be Zero: these bits must be zero in both IN and OUT packets. - - O Overrun Flag: set in an IN packet if an overrun condition was - detected. Must be zero in OUT packets. Overrun occurs when - the FPGA has data to transmit to the host and there is no - buffer space available. This generally indicates a problem on - the host. Either it is not keeping up, or it has configured - the FPGA to transmit data at a higher rate than the transport - (USB) can support. - - U Underrun Flag: set in an IN packet if an underrun condition - was detected. Must be zero in OUT packets. Underrun occurs - when the FPGA runs out of samples, and it's not between - bursts. See the "End of Burst flag" below. - - D Dropped Packet Flag: Set in an IN packet if the FPGA - discarded an OUT packet because its timestamp had already - passed. - - S Start of Burst Flag: Set in an OUT packet if the data is the - first segment of what is logically a continuous burst of data. - Must be zero in IN packets. - - E End of Burst Flag: Set in an OUT packet if the data is the - last segment of what is logically a continuous burst of data. - Must be zero in IN packets. Underruns are not reported - when the FPGA runs out of samples between bursts. - - - RSSI 6-bit Received Strength Signal Indicator: Must be zero in OUT - packets. In IN packets, indicates RSSI as reported by front end. - FIXME The format and interpretation are to be determined. - - Chan 5-bit logical channel number. Channel number 0x1f is reserved - for control information. See "Control Channel" below. Other - channels are "data channels." Each data channel is logically - independent of the others. A data channel payload field - contains a sequence of homogeneous samples. The format of the - samples is determined by the configuration associated with the - given channel. It is often the case that the payload field - contains 32-bit complex samples, each containing 16-bit real - and imaginary components. - - Tag 4-bit tag for matching IN packets with OUT packets. - [FIXME, write more...] - - Payload Len: 9-bit field that specifies the length of the payload - field in bytes. Must be in the range 0 to 504 inclusive. - - Timestamp: 32-bit timestamp. - On IN packets, the timestamp indicates the time at which the - first sample of the packet was produced by the A/D converter(s) - for that channel. On OUT packets, the timestamp specifies the - time at which the first sample in the packet should go out the - D/A converter(s) for that channel. If a packet reaches the - head of the transmit queue, and the current time is later than - the timestamp, an error is assumed to have occurred and the - packet is discarded. As a special case, the timestamp - 0xffffffff is interpreted as "Now". - - The time base is a free running 32-bit counter that is - incremented by the A/D sample-clock. - - Payload: Variable length field. Length is specified by the - Payload Len field. - - Padding: This field is 504 - Payload Len bytes long, and its content - is unspecified. This field pads the packet out to a constant - 512 bytes. - - - -"Data Channel" payload format: -------------------------------- - -If Chan != 0x1f, the packet is a "data packet" and the payload is a -sequence of homogeneous samples. The format of the samples is -determined by the configuration associated with the given channel. -It is often the case that the payload field contains 32-bit complex -samples, each containing 16-bit real and imaginary components. - - -"Control Channel" payload format: ---------------------------------- - -If Chan == 0x1f, the packet is a "control packet". The control channel -payload consists of a sequence of 0 or more sub-packets. - -Each sub-packet starts on a 32-bit boundary, and consists of an 8-bit -Opcode field, an 8-bit Length field, Length bytes of arguments, and 0, -1, 2 or 3 bytes of padding to align the tail of the sub-packet to -a 32-bit boundary. - -Control channel packets shall be processed at the head of the queue, -and shall observe the timestamp semantics described above. - - -General sub-packet format: --------------------------- - - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-//-+-+-+-+-+-+-+-+ - | Opcode | Length | <length bytes> ... | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-//-+-+-+-+-+-+-+-+ - - -Specific sub-packet formats: ----------------------------- - - RID: 6-bit Request-ID. Copied from request sub-packet into corresponding - reply sub-packet. RID allows the host to match requests and replies. - - Reg Number: 10-bit Register Number. - - - -Ping Fixed Length: - - Opcode: OP_PING_FIXED - - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Opcode | 2 | RID | Ping Value | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - - -Ping Fixed Length Reply: - - Opcode: OP_PING_FIXED_REPLY - - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Opcode | 2 | RID | Ping Value | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - - -Write Register: - - Opcode: OP_WRITE_REG - - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Opcode | 6 | mbz | Reg Number | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Register Value | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - - -Write Register Masked: - - Opcode: OP_WRITE_REG_MASKED - - REG[Num] = (REG[Num] & ~Mask) | (Value & Mask) - - That is, only the register bits that correspond to 1's in the - mask are written with the new value. - - - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Opcode | 10 | mbz | Reg Number | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Register Value | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Mask Value | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - - -Read Register: - - Opcode: OP_READ_REG - - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Opcode | 2 | RID | Reg Number | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - - -Read Register Reply: - - Opcode: OP_READ_REG_REPLY - - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Opcode | 6 | RID | Reg Number | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Register Value | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - - -I2C Write: - - Opcode: OP_I2C_WRITE - I2C Addr: 7-bit I2C address - Data: The bytes to write to the I2C bus - Length: Length of Data + 2 - - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Opcode | Length | mbz | I2C Addr | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Data ... . - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - - -I2C Read: - - Opcode: OP_I2C_READ - I2C Addr: 7-bit I2C address - Nbytes: Number of bytes to read from I2C bus - - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Opcode | 3 | RID | mbz | I2C Addr | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Nbytes | unspecified padding | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - - -I2C Read Reply: - - Opcode: OP_I2C_READ_REPLY - I2C Addr: 7-bit I2C address - Data: Length - 2 bytes of data read from I2C bus. - - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Opcode | Length | RID | mbz | I2C Addr | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Data ... . - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - - -SPI Write: - - Opcode: OP_SPI_WRITE - Enables: Which SPI enables to assert (mask) - Format: Specifies format of SPI data and Opt Header Bytes - Opt Header Bytes: 2-byte field containing optional Tx bytes; see Format - Data: The bytes to write to the SPI bus - Length: Length of Data + 6 - - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Opcode | Length | mbz | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Enables | Format | Opt Header Bytes | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Data ... . - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - - -SPI Read: - - Opcode: OP_SPI_READ - Enables: Which SPI enables to assert (mask) - Format: Specifies format of SPI data and Opt Header Bytes - Opt Header Bytes: 2-byte field containing optional Tx bytes; see Format - Nbytes: Number of bytes to read from SPI bus. - - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Opcode | 7 | RID | mbz | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Enables | Format | Opt Header Bytes | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Nbytes | unspecified padding | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - - -SPI Read Reply: - - Opcode: OP_SPI_READ_REPLY - Data: Length - 2 bytes of data read from SPI bus. - - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Opcode | Length | RID | mbz | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Data ... . - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - - -Delay: - - Opcode: OP_DELAY - Ticks: 16-bit unsigned delay count - - Delay Ticks clock ticks before executing next operation. - - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Opcode | 2 | Ticks | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - diff --git a/usrp/doc/inband-signaling-usb-host b/usrp/doc/inband-signaling-usb-host deleted file mode 100644 index 6bfdca97e..000000000 --- a/usrp/doc/inband-signaling-usb-host +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright 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 this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# - - -See usrp/host/lib/inband/usrp_server.mbh for interface - diff --git a/usrp/doc/other/.gitignore b/usrp/doc/other/.gitignore deleted file mode 100644 index b336cc7ce..000000000 --- a/usrp/doc/other/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/Makefile -/Makefile.in diff --git a/usrp/doc/other/Makefile.am b/usrp/doc/other/Makefile.am deleted file mode 100644 index 815553a6d..000000000 --- a/usrp/doc/other/Makefile.am +++ /dev/null @@ -1,25 +0,0 @@ -# -# 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. -# - -include $(top_srcdir)/Makefile.common - -EXTRA_DIST += \ - mainpage.dox diff --git a/usrp/doc/other/mainpage.dox b/usrp/doc/other/mainpage.dox deleted file mode 100644 index 56068cc5f..000000000 --- a/usrp/doc/other/mainpage.dox +++ /dev/null @@ -1,9 +0,0 @@ -/*! \mainpage - -The top level interfaces to the USRP are usrp_standard_rx and -usrp_standard_tx. Also take a look at their base classes, -usrp_basic_rx, usrp_basic_tx and usrp_basic. - -See also <a href="usrp_guide.html">USRP User's and Developer's Guide</a> - -*/ diff --git a/usrp/doc/traffic-cop-dma b/usrp/doc/traffic-cop-dma deleted file mode 100644 index 0b3c3507e..000000000 --- a/usrp/doc/traffic-cop-dma +++ /dev/null @@ -1,137 +0,0 @@ -Matt, - -Here's my idea on the interface to the traffic cop. Basically I'm -thinking about treating it as 4 separate DMA channels, one for each of -the four possible "flows". In the interest of simplicity, I think we can -assign buffers 0,1 to channel 0; 2,3 to channel 1, etc... - -port assignments ------------------ - 0 SERDES - 1 DSP pipeline - 2 Gigabit ethernet MAC - 3 RAM - - -registers ---------- - - MBZ == Must Be Zero - - 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 - - -TC_DMA_SRC_{0,3} [WR] ("traffic cop DMA source, channel N") - - (The {0,3} notation means there are four of these registers, - one for each channel, named TC_DMA_SRC_0, TC_DMA_SRC_1, - TC_DMA_SRC_2, TC_DMA_3.) - - Specifies where the writing port adapter writes info the buffer, and - the maximum number of lines to write. - - 5 9 9 9 - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - |0| src | start | end (max) | step | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - - src: source port number. E.g., 2 = ethernet MAC (the buffer writer) - start: starting line number for transfer (32-bit lines) - end: index of last line to write. I.e., start = 0, end = 0, xfers 1 line. - step: normally 1. - - -TC_DMA_DST_{0,3} [WR] - - Specifies the range of lines that the reading port adapter accesses. - The number of lines to be transferred is controlled by the source. - - 5 9 9 9 - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - |0| dst | start | end (max) | step | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - - dst: destination port number. E.g., 1 = DSP pipeline (the buffer reader) - start: starting line number tranfer (32-bit lines) - end: Must be zero, unless a TC_DMA_CMD_SEND_0 or TC_DMA_CMD_SEND_1 - cmd is written to TC_DMA_CTRL_{0,3} in which case this - specifies the index of the last line to send to the destination. - step: normally 1. - - -TC_DMA_CTRL_{0,3} [WR] - - 27 1 4 - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | MBZ |A| cmd | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - - - A: Set if "Host Approval" is required before beginning xfer to dst. - Used to allow processor to inspect packet for s/w dispatch. If set, - traffic cop sets PENDING_APPROVAL bit (and causes interrupt?) after the - 2nd line has been written into the buffer. Reader is held off - until hosts APPROVES or DROPS the buffer. - - - cmd: command - - TC_DMA_CMD_RESET 0 // abort active tranfers now; reset to idle state - TC_DMA_CMD_START 1 // begin transfers according - TC_DMA_CMD_STOP 2 // stop transfers at completion of current buffer - TC_DMA_CMD_APPROVE_0 3 // host approves xfer on even buffer, continue - TC_DMA_CMD_APPROVE_1 4 // host approves xfer on odd buffer, continue - TC_DMA_CMD_DROP_0 5 // host naks xfer on even buffer, drop buffer and continue - TC_DMA_CMD_DROP_1 6 // host naks xfer on even buffer, drop buffer and continue - TC_DMA_CMD_SEND_0 7 // copy buffer 0 to destination (processor init'd buffer) - TC_DMA_CMD_SEND_1 8 // copy buffer 1 to destination (processor init'd buffer) - - -TC_DMA_STATUS_{0,3} [RD] - - 10 10 - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | nwritten even | nwritten odd | state? | flags | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - - nwritten even: number of lines written into even buffer - nwritten odd: number of lines written into odd buffer - - flag bits: - - bmTCDS_PENDING_APPROVAL_0 (1 << 0) // pending host approval on even buffer - bmTCDS_PENDING_APPROVAL_1 (1 << 1) // pending host approval on odd buffer - bmTCDS_WRITE_DONE_0 (1 << 2) // the even buffer write is complete - bmTCDS_WRITE_DONE_1 (1 << 3) // the odd buffer write is complete - -I think the combination of the "host approval" and WRITE_DONE bits -will allow us to handle the cases where the host looks and doesn't -care, and the case where the host looks, cares, and needs to wait -until it sees the whole packet. - -WRITE_DONE_* should be cleared when the corresponding buffer is -selected to be written into (e.g., when swapping buffers, and at init) -prior to writing the first line. WRITE_DONE_* is set when the -requested number of lines have been written into the buffer. - - - -I also want a "global status register" that pulls the N flag bits -from each of the 4 status registers into a single word. This should -allow me to read a single word to figure out what to do. - - -TC_DMA_STATUS_GLOBAL [RD] - - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | flags3 | flags2 | flags1 | flags0 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - - - -// some kind of registers to enable and ack interrupts - -TC_DMA_INTR_EN [WR] // enable particular interrupts -TC_DMA_INTR_CLR [WR] // clear particular pending interrupts - diff --git a/usrp/doc/usrp-block-diagram.eps b/usrp/doc/usrp-block-diagram.eps deleted file mode 100644 index 190b9dee3..000000000 --- a/usrp/doc/usrp-block-diagram.eps +++ /dev/null @@ -1,2785 +0,0 @@ -%!PS-Adobe-3.0 EPSF-3.0 -%%BoundingBox: 0 0 755 575 -%%Pages: 0 -%%Creator: Sun Microsystems, Inc. -%%Title: none -%%CreationDate: none -%%LanguageLevel: 2 -%%EndComments -%%BeginPreview: 760 575 1 1725 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000FFE300707800000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000FFE380E1FE00000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000C001C0C30700000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000C000E1830300000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000C000E3820300000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000C00077000300000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000C0003E000300000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000C0001C000700000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000FFC01C000E00000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000FFC03E001C00000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000C00037003800000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000C0006700F000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000C000E381C000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000C001C1C18000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000C00180C30000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000C00380E7FF00000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000C0070077FF00000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%08000000300701F80FF80007C00000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%08000000300707FE0FFE000FF00000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%08000000300706070C060018380000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0800000030070E038C030010180000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0800000030070C000C030030180000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0800000030070E000C030000180000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%08000000300707C00C070000380000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%08000000300703FC0FFE0000300000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000003007007E0FFC0000700000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000003007000F0FFF0000E00000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%08000000300700038C030003C00000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0800000030071C018C038007000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0800000038061C018C01800E000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0800000018060E038C03801C000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000001C0E0F070C070018000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000FFC07FE0FFF003FF80000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0800000007F001FC0FFC003FF80000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080007E00000000000000031800000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%08001FF80000000300000031800000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0800381C0000000300000031800000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0800700C0000000300000031800000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0800600E03808E07C8C0E03180E023000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0800E0000FE0FF8FCFE3F83183F83F800000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0800E0001C70F3C30FC71C31871C3F000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0800C0003038E0C30E0E0E318E0E38000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0800C0003018C0C30C0C06318C0630000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0800C0007018C0C30C0C06318FFE30000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0800C0007018C0C30C0C07318FFE30000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0800E0067018C0C30C0C07318C0030000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0800600E7018C0C30C0C06318C0030000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0800700C3038C0C30C0C06318C0630000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0800381C3830C0C30C0E0E318E0E30000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%08001FF81FF0C0C3CC07FC3187FC30000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080007E00FC0C0C1CC01F03181F030000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%080000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000018000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000018000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000018000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000018000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000018000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000018000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000018000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000018000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000018000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000018000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000018000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000018000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000018000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000018000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000018000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000018000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000018000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000018000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000018000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000018000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000018000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000018000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000018000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000018000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000018000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000018000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000018000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000018000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000018000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000018000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000018000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000018000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000018000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000018000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000018000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC00000000000000000000000000000 -%007FFFFFFFFFFFFFFFFFFFFFFFFFFFFE00000000000000000000000000000000FFFFFFFFFFFFFF -%FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC00 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000010000 -%004000000000000000000000000000020000040000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000020000000000000000000 -%004000000000000000000000000000020000000000000000000020000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000040000000000000000000 -%004000000000000000000000000000020000000000000000000010000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000100000000000000000000 -%004000000000000000000000000000020000000000000000000004000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000200000000000000000000 -%004000000000000000000000000000020000000000000000000002000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000400000000000000000000 -%004000000000000000000000000000020000000000000000000001000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000800000000000000000000 -%004000000000000000000000000000020000000000000000000000800000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000001000000000000000000000 -%004000000000000000000000000000020000000000000000000000400000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000002000000000000000000000 -%004000000000000000000000000000020000000000000000000000200000000080000000000000 -%0000000000000000000000000000000400 -%00080000000000000000000000000000000000000000000040000000C000000000000000000000 -%004000000000000000000000000000020000000000000000000000180000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000010000000000000000000000 -%004000000000000000000000000000020000000000000000000000040000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000020000000000000000000000 -%004000000000000000000000000000020000000000000000000000020000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000040000000000000000000000 -%004000000000000000000000000000020000000000000000000000010000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000080000000000000000000000 -%004000000000000000000000000000020000000000000000000000008000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000100000000000000000000000 -%004000000000000000000000000000020000000000000000000000004000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000200000000000000000000000 -%004000000000000000000000000000020000000000000000000000002000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000C00000000000000000000000 -%004000000000000000000000000000020000000000000000000000001800000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%0008000000000000000000000000000000000000000000004000020001C03FF800FE0000000000 -%00400000000000000000000000000002000000000003C03FF001FE000200000080000000000000 -%0000000000000000000000000000000400 -%0008000000000000000000000000000000000000000000004000040001E03FFC03FF8000000000 -%00400000000000000000000000000002000000000003C03FFC03FF000100000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000360300E07038000000000 -%00400000000000000000000000000002000000000003C0301C0703800000000080000000000000 -%0000000000000000000000000000000400 -%00080000000000000000000000000000000000000000000040001000036030060601C000000000 -%0040000000000000000000000000000200000000000760300E0E01800040000080000000000000 -%0000000000000000000000000000000400 -%00080000000000000000000000000000000000000000000040002000073030070C00C000000000 -%004000000000000000000000000000020000000000066030060C01C00020000080000000000000 -%0000000000000000000000000000000400 -%00080000000000000000000000000000000000000000000040004000063030030C000000000000 -%004000000000000000000000000000020000000000067030071C00000010000080000000000000 -%0000000000000000000000000000000400 -%00080000000000000000000000000000000000000000000040000000063830031C000000000000 -%0040000000000000000000000000000200000000000C3030071800000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000E1830031C00000000FFFF -%FFC0000000000000000000000000000200000000000C3030031800000001FFFF80000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400200000C1830031C00000000FFFF -%FFC0000000000000000000000000000200000000001C1830031800000003FFFF80000000000000 -%0000000000000000000000000000000400 -%0008000000000000000000000000000000000000000000007FF800000C1C30031C000000000000 -%00400000000000000000000000000003FFFFF800001C1830031800000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000001FFC30030C000000000000 -%0040000000000000000000000000000200000000001FFC30071800000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000001FFE30070C00C000000000 -%0040000000000000000000000000000200000000003FFC30061C00C00000000080000000000000 -%0000000000000000000000000000000400 -%00080000000000000000000000000000000000000000000040000000380630070E00C000000000 -%004000000000000000000000000000020000000000300E30060C01C00000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400020003006300E0701C000000000 -%004000000000000000000000000000020000000000300E300E0E03800020000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400010003007301E07838000000000 -%0040000000000000000000000000000200000000006006301C0707800040000080000000000000 -%0000000000000000000000000000000400 -%0008000000000000000000000000000000000000000000004000000070033FF801FF0000000000 -%00400000000000000000000000000002000000000060073FF803FE000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400004006003BFE0007C0000000000 -%004000000000000000000000000000020000000000E0033FE000FC000100000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400002000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000200000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000800000000000000000000000 -%004000000000000000000000000000020000000000000000000000000800000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000400000000000000000000000 -%004000000000000000000000000000020000000000000000000000001000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000200000000000000000000000 -%004000000000000000000000000000020000000000000000000000002000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000100000000000000000000000 -%004000000000000000000000000000020000000000000000000000004000000080000000000000 -%0000000000000000000000000000000400 -%0008000000000003FF800000000003000000000000000000400000080000000000000000000000 -%00400000000000000000000000000002000000000000000000000000800000008000000000003F -%F800000000003000000000000000000400 -%0008000000000003FFC00000000003000000000000000000400000040000000000000000000000 -%00400000000000000000000000000002000000000000000000000001000000008000000000003F -%FC00000000003000000000000000000400 -%000800000000000300E00000000002000000000000000000400000020000000000000000000000 -%004000000000000000000000000000020000000000000000000000020000000080000000000038 -%0E00000000002000000000000000000400 -%000800000000000300600000000000000000000000000000400000018000000000000000000000 -%0040000000000000000000000000000200000000000000000000000C0000000080000000000030 -%0700000000000000000000000000000400 -%000800000000000300700000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000100000000080000000000030 -%0700000000000000000000000000000400 -%00080000000000030070FE03F03F0330187E000000000000400000002000000000000000000000 -%004000000000000000000000000000020000000000000000000000200000000080000000000030 -%0707E03F03F8338187F000000000000400 -%00080000000000030061EF073873833838E7000000000000400000001000000000000000000000 -%004000000000000000000000000000020000000000000000000000400000000080000000000030 -%070E7073873C31818E7800000000000400 -%000800000000000301E1830E1CE0C3183181800000000000400000000800000000000000000000 -%004000000000000000000000000000020000000000000000000000800000000080000000000038 -%1E1838E0CE0C31831C1800000000000400 -%0008000000000003FF83018C0CC0E3183181C00000000000400000000400000000000000000000 -%00400000000000000000000000000002000000000000000000000100000000008000000000003F -%FC3018C0CC0631C3180C00000000000400 -%0008000000000003FE03019C01C0E30C6381C00000000000400000000200000000000000000000 -%00400000000000000000000000000002000000000000000000000200000000008000000000003F -%F03018C00C0630C3181C00000000000400 -%00080000000000030703FF9C01FFE30C63FFC00000000000400000000100000000000000000000 -%004000000000000000000000000000020000000000000000000004000000000080000000000030 -%383FF8C00FFE30C61FFC00000000000400 -%00080000000000030383001C01C0030C6380000000000000400000000040000000000000000000 -%004000000000000000000000000000020000000000000000000010000000000080000000000030 -%183000C00C003066180000000000000400 -%000800000000000301C3001C01C00306C380000000000000400000000020000000000000000000 -%004000000000000000000000000000020000000000000000000020000000000080000000000030 -%1C3000C00C003066180000000000000400 -%000800000000000300E3018C0CC04306C181800000000000400000000000000000000000010000 -%004000000000000000000000000000020000040000000000000000000000000080000000000030 -%0E3818C0CC06306C180C00000000000400 -%000800000000000300E1838E1CE0C307C1C1800000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000030 -%071838E0CE0E303C1C1C00000000000400 -%00080000000000030071E7073873C30380E7800000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000030 -%071E707387BC30380F7800000000000400 -%00080000000000030030FE03F03F8303807F000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000030 -%0387E03F03F8303807F000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800FFC0000000000030000000000C0000000000000C00400000000000000000000000000000 -%0040000000000000000000000000000200000000000000000000000000000000800FFC00000000 -%00030000000000C0000000000000C00400 -%000800FFF000000000003000C000000C0000000000000C00400000000000000000000000000000 -%0040000000000000000000000000000200000000000000000000000000000000800FFF00000000 -%0003000C000000C0000000000000C00400 -%000800E07800000000003000C000000C0000000000000C00400000000000000000000000000000 -%0040000000000000000000000000000200000000000000000000000000000000800E0780000000 -%0003000C000000C0000000000000C00400 -%000800E01800000000003000C000000C0000000000000C00400000000000000000000000000000 -%0040000000000000000000000000000200000000000000000000000000000000800E01C0000000 -%0003000C000000C0000000000000C00400 -%000800E01C00000000003000C000000C0000000000000C00400000000000000000000000000000 -%0040000000000000000000000000000200000000000000000000000000000000800E00C0000000 -%0003000E000000C0000000000000C00400 -%000800E00C1FC38183FC37E3F0FC1FCDF03F81FE1FC7FC00400000000000000000000000010000 -%0040000000000000000000000000000200000400000000000000000000000000800E00C1FE1818 -%3FE37E1F0FC0FCDF01FC0FE1FC7EC00400 -%000800E00C39E381873C3CE0C1CE1FCF3879C3CF1F8E7C00400000000020000000000000000000 -%0040000000000000000000000000000200000000000000000000200000000000800E00E38E1818 -%73E3EF0C1CF0FCFB879E1CF1F8E7C00400 -%000800E00E7063818C1C3870C3031C0E1C60E3031C1C3C00400000000040000000000000000000 -%0040000000000000000000000000000200000000000000000000100000000000800E00E3071818 -%E1E3830C3030E0E1C6063831C1C1C00400 -%000800E00E0063818C0C3030C7031C0C0CC0600318181C00400000000100000000000000000000 -%0040000000000000000000000000000200000000000000000000040000000000800E00E0071818 -%C0E3030C3038C0C0CE070031C181C00400 -%000800E00E006381980C3030C7039C0C0CC0700718181C00400000000200000000000000000000 -%0040000000000000000000000000000200000000000000000000020000000000800E00E0071818 -%C0E3030C7038C0C0CC0300718180C00400 -%000800E00C1FE381980C3030C7FF9C0C0CC030FF18381C00400000000400000000000000000000 -%0040000000000000000000000000000200000000000000000000010000000000800E00E0FF1819 -%C0E3030C7FF8C0C0EC030FF18180C00400 -%000800E00C3E6381980C3030C7001C0C0CC033E318381C00400000000800000000000000000000 -%0040000000000000000000000000000200000000000000000000008000000000800E00E3E71819 -%C0E3030C7000C0C0EC031E318180C00400 -%000800E00C7063839C0C3030C6001C0C0CC0730318181C00400000001000000000000000000000 -%0040000000000000000000000000000200000000000000000000004000000000800E00C7071818 -%C0E3030C7000C0C0CC0330318180C00400 -%000800E01C6063838C0C3030C7031C0C0CE0670318181C00400000002000000000000000000000 -%0040000000000000000000000000000200000000000000000000002000000000800E01C6071838 -%C0E3030C3030C0C0CE0730318181C00400 -%000800E03860E1878C1C3030C3871C0E1860E707181C3C00400000008000000000000000000000 -%0040000000000000000000000000000200000000000000000000001800000000800E0386071838 -%E1E3030C3830C0E1C706307180C1C00400 -%000800FFF071E1FF877C3030F1CE1C0F3879C39F180E7C00400000010000000000000000000000 -%0040000000000000000000000000000200000000000000000000000400000000800FFF039F1FF8 -%73E3030F1EF0C0FB839E39F180F7C00400 -%000800FFE03F30F983EC303070FC1C0DF01F81FB1807FC00400000020000000000000000000000 -%0040000000000000000000000000000200000000000000000000000200000000800FFE03F30FD8 -%3FE303078FE0C0DF01F81FB9807EC00400 -%0008000000000000000C0000000000000000000000000000400000040000000000000000000000 -%004000000000000000000000000000020000000000000000000000010000000080000000000000 -%00E0000000000000000000000000000400 -%0008000000000000080C0000000000000000000000000000400000080000000000000000000000 -%004000000000000000000000000000020000000000000000000000008000000080000000000000 -%C0C0000000000000000000000000000400 -%00080000000000000C1C0000000000000000000000000000400000100000000000000000000000 -%004000000000000000000000000000020000000000000000000000004000000080000000000000 -%E1C0000000000000000000000000000400 -%000800000000000007F80000000000000000000000000000400000200000000000000000000000 -%004000000000000000000000000000020000000000000000000000002000000080000000000000 -%7F80000000000000000000000000000400 -%000800000000000003E00000000000000000000000000000400000C00000000000000000000000 -%004000000000000000000000000000020000000000000000000000001800000080000000000000 -%1E00000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%0008000000000000000000000000000000000000000000004000020001C03FF801FE0000000000 -%00400000000000000000000000000002000000000003C03FF801FE000200000080000000000000 -%0000000000000000000000000000000400 -%0008000000000000000000000000000000000000000000004000040001E03FFC03FF8000000000 -%00400000000000000000000000000002000000000003C03FFC03FF000100000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000360300E07018000000000 -%00400000000000000000000000000002000000000003E0301C0703800000000080000000000000 -%0000000000000000000000000000000400 -%00080000000000000000000000000000000000000000000040001000036030070E01C000000000 -%0040000000000000000000000000000200000000000660300E0E01800040000080000000000000 -%0000000000000000000000000000000400 -%00080000000000000000000000000000000000000000000040002000073030070C00C000000000 -%004000000000000000000000000000020000000000066030060C00800020000080000000000000 -%0000000000000000000000000000000400 -%00080000000000000000000000000000000000000000000040004000063030030C000000000000 -%004000000000000000000000000000020000000000067030071C00000010000080000000000000 -%0000000000000000000000000000000400 -%00080000000000000000000000000000000000000000000040010000063830031C000000000000 -%0040000000000000000000000000000200000000000C3030031800000000000080000000000000 -%0000000000000000000000000000000400 -%0008000000000000000000000000000000000000000000007FF800000E1830031C00000000FFFF -%FFC0000000000000000000000000000200000000000C3830031800000001FFFF80000000000000 -%0000000000000000000000000000000400 -%0008000000000000000000000000000000000000000000007FF800000C1C30031C00000000FFFF -%FFC0000000000000000000000000000200000800001C1830031800000001FFFF80000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400200000C1C30031C000000000000 -%00400000000000000000000000000003FFFFF800001C1830031800000002000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000001FFC30030C000000000000 -%0040000000000000000000000000000200000000001FFC30071C00000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000001FFE30070C00C000000000 -%0040000000000000000000000000000200000000003FFC30060C00C00000000080000000000000 -%0000000000000000000000000000000400 -%00080000000000000000000000000000000000000000000040000000380630070E00C000000000 -%004000000000000000000000000000020000000000300E30060C01C00000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400020003007300E0701C000000000 -%004000000000000000000000000000020000000000300E300E0E03800020000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000003007383C03C78000000000 -%0040000000000000000000000000000200000000006006303C0787000000000080000000000000 -%0000000000000000000000000000000400 -%0008000000000000000000000000000000000000000000004000000070033FF801FF0000000000 -%00400000000000000000000000000002000000000060073FF803FE000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400004006003BFE0007C0000000000 -%004000000000000000000000000000020000000000E0033FE000F8000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000800000000000000000000000 -%004000000000000000000000000000020000000000000000000000000800000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000400000000000000000000000 -%004000000000000000000000000000020000000000000000000000001000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000100000000000000000000000 -%004000000000000000000000000000020000000000000000000000004000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000080000000000000000000000 -%004000000000000000000000000000020000000000000000000000008000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000020000000000000000000000 -%004000000000000000000000000000020000000000000000000000020000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000018000000000000000000000 -%0040000000000000000000000000000200000000000000000000000C0000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000004000000000000000000000 -%004000000000000000000000000000020000000000000000000000100000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000002000000000000000000000 -%004000000000000000000000000000020000000000000000000000200000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000001000000000000000000000 -%004000000000000000000000000000020000000000000000000000400000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000800000000000000000000 -%004000000000000000000000000000020000000000000000000000800000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000400000000000000000000 -%004000000000000000000000000000020000000000000000000001000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000200000000000000000000 -%004000000000000000000000000000020000000000000000000002000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000080000000000000000000 -%004000000000000000000000000000020000000000000000000008000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000040000000000000000000 -%004000000000000000000000000000020000000000000000000010000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000020000000000000000000 -%004000000000000000000000000000020000000000000000000020000000000080000000000000 -%0000000000000000000000000000000400 -%00080000000000000000000000000000000000000000000040000000001FFFFFFFFFFFFFFF0000 -%00400000000000000000000000000002000007FFFFFFFFFFFFFFC0000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC00000000000000000000000000000 -%0040000000000000000000000000000200000000000000000000000000000000FFFFFFFFFFFFFF -%FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC00 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0040000007FF9FF8007C001C000000020000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0040000007FF9FFE01FF801C000000020000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0040000007001C0F0383C03E000000020000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0040000006001C070700C036000000020000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0040000006001C030E00C036000000020000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0040000006001C030C000063000000020000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0040000006001C031C000063000000020000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0040000007001C071C0000E3800000020000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0040000007FF1FFE1C0FE0C1800000020000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0040000007FE1FFC1C0FE0C1800000020000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0040000006001C001C00E1FFC00000020000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0040000006001C000C0061FFC00000020000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0040000006001C000C006380E00000020000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0040000006001C000E006300600000020000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0040000006001C000781E300700000020000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0040000006001C0003FFC700700000020000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0040000006001C0000FF0600300000020000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC00000000000000000000000000000 -%00400000000000000000000000000002000000000000000000000000000000007FFFFFFFFFFFFF -%FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC00 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%00080000000000000000000000000000000000000000000040000000001FFFFFFFFFFFFFFF0000 -%00400000000000000000000000000002000007FFFFFFFFFFFFFFC0000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000080000000000000000000 -%004000000000000000000000000000020000000000000000000008000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000002000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000008000000000000000000000 -%004000000000000000000000000000020000000000000000000000080000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000010000000000000000000000 -%004000000000000000000000000000020000000000000000000000040000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000040000000000000000000000 -%004000000000000000000000000000020000000000000000000000010000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000080000000000000000000000 -%004000000000000000000000000000020000000000000000000000008000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000200000000000000000000000 -%004000000000000000000000000000020000000000000000000000002000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000C00000000000000000000000 -%004000000000000000000000000000020000000000000000000000001800000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400001003FE00060007C0000000000 -%0040000000000000000000000000000200000000003FE000E00078000400000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400002003FF800F001FF0000000000 -%0040000000000000000000000000000200000000003FF800E001FE000200000080000000000000 -%0000000000000000000000000000000400 -%00080000000000000000000000000000000000000000000040000400383E00F003C78000000000 -%004000000000000000000000000000020000000000303C01E00787000100000080000000000000 -%0000000000000000000000000000000400 -%00080000000000000000000000000000000000000000000040000800380E01F80701C000000000 -%004000000000000000000000000000020000000000300E01B00E03800080000080000000000000 -%0000000000000000000000000000000400 -%00080000000000000000000000000000000000000000000040001000380701980E00C000000000 -%004000000000000000000000000000020000000000300601B00C01C00040000080000000000000 -%0000000000000000000000000000000400 -%00080000000000000000000000000000000000000000000040002000380301980C008000000000 -%004000000000000000000000000000020000000000300703181C00800020000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400080003803039C0C000000000000 -%004000000000000000000000000000020000000000300303181C00000008000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400100003803830C1C000000000000 -%0040000000000000000000000000000200000000003003071C1800000004000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000003803830C1C000000008000 -%0040000000000000000000000000000200000800003003060C1800000000000080000000000000 -%0000000000000000000000000000000400 -%0008000000000000000000000000000000000000000000007FFC0000380386061C00000000FFFF -%FFC00000000000000000000000000003FFFFF800003003060C1800000001FFFF80000000000000 -%0000000000000000000000000000000400 -%00080000000000000000000000000000000000000000000040020000380387FE1C000000000000 -%00400000000000000000000000000002000000000030030FFE1800000002000080000000000000 -%0000000000000000000000000000000400 -%0008000000000000000000000000000000000000000000004000000038030FFF0C000000000000 -%00400000000000000000000000000002000000000030070FFE1C00000004000080000000000000 -%0000000000000000000000000000000400 -%0008000000000000000000000000000000000000000000004000C00038030C030C00C000000000 -%00400000000000000000000000000002000000000030061C070C00C00018000080000000000000 -%0000000000000000000000000000000400 -%0008000000000000000000000000000000000000000000004000000038070C030E01C000000000 -%004000000000000000000000000000020000000000300618030E01C00000000080000000000000 -%0000000000000000000000000000000400 -%00080000000000000000000000000000000000000000000040000000380E1C038701C000000000 -%004000000000000000000000000000020000000000300E18038703800000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400008003FFC180183FF8000000000 -%0040000000000000000000000000000200000000003FFC380387FF000080000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000003FF83801C1FE0000000000 -%0040000000000000000000000000000200000000003FF8300181FE000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400002000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000200000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400001000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000400000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000800000000000000000000000 -%004000000000000000000000000000020000000000000000000000000800000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000007FFE00000000000000000C100000000000400000000000000000000000000000 -%0040000000000000000000000000000200000000000000000000000000000000800000000003FF -%E00000000000000000C100000000000400 -%000800000000003FFE00000000000000000C300000000000400000004000000000000000000000 -%0040000000000000000000000000000200000000000000000000001000000000800000000003FF -%E00000000000000000C300000000000400 -%0008000000000001C0000000000000000000300000000000400000002000000000000000000000 -%00400000000000000000000000000002000000000000000000000020000000008000000000000C -%0000000000000000000300000000000400 -%0008000000000001C0000000000000000000300000000000400000000000000000000000000000 -%00400000000000000000000000000002000000000000000000000000000000008000000000000C -%0000000000000000000300000000000400 -%0008000000000001C0670F833C03C19E1C0CFC0000000000400000000800000000000000000000 -%00400000000000000000000000000002000000000000000000000000000000008000000000000C -%0270F811C03C09E1C0CFC0000000000400 -%0008000000000001C07F3FE3FF0FE1FF7F0CFC0000000000400000000400000000000000000000 -%00400000000000000000000000000002000000000000000000000100000000008000000000000C -%07F1FE1FF0FF1FF3F0CFC0000000000400 -%0008000000000001C07A30E3C31C31E3C70C300000000000400000000100000000000000000000 -%00400000000000000000000000000002000000000000000000000400000000008000000000000C -%0783061C38C31E3E30C300000000000400 -%0008000000000001C0707063839831C1830C300000000000400000000080000000000000000000 -%00400000000000000000000000000002000000000000000000000800000000008000000000000C -%0703071819C11C1C38C300000000000400 -%0008000000000001C0700063819C01C1830C300000000000400000000040000000000000000000 -%00400000000000000000000000000002000000000000000000001000000000008000000000000C -%0700071819C01C1818C300000000000400 -%0008000000000001C06003E3818F8181830C300000000000400000000000000000000000000000 -%00400000000000000000000000000002000000000000000000000000000000008000000000000C -%07001F1818F81C1818C300000000000400 -%0008000000000001C0603FE38187F181830C30000000000040000000001FFFFFFFFFFFFFFF0000 -%00400000000000000000000000000002000007FFFFFFFFFFFFFFC000000000008000000000000C -%0701FF18187F1C1818C300000000000400 -%0008000000000001C06078638180F181830C300000000000400000000000000000000000000000 -%00400000000000000000000000000002000000000000000000000000000000008000000000000C -%0703C718180F9C1818C300000000000400 -%0008000000000001C060606381803981830C300000000000400000000000000000000000000000 -%00400000000000000000000000000002000000000000000000000000000000008000000000000C -%0707071818019C1818C300000000000400 -%0008000000000001C060606381981981830C300000000000400000000000000000000000000000 -%00400000000000000000000000000002000000000000000000000000000000008000000000000C -%0706071819819C1818C300000000000400 -%0008000000000001C06060E3819C3981830C300000000000400000000000000000000000000000 -%00400000000000000000000000000002000000000000000000000000000000008000000000000C -%07070F1819C39C1818C300000000000400 -%0008000000000001C0607FE3818FF181830C3C0000000000400000000000000000000000000000 -%00400000000000000000000000000002000000000000000000000000000000008000000000000C -%0703FF1818FF1C1818C3C0000000000400 -%0008000000000001C0601E338187C181830C1C0000000000400000000000000000000000000000 -%00400000000000000000000000000002000000000000000000000000000000008000000000000C -%0701F318183E1C1818C1C0000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800FFE0000000000030004000000C0000000000000C00400000000000000000000000000000 -%0040000000000000000000000000000200000000000000000000000000000000800FFE00000000 -%00030004000000C0000000000000C00400 -%000800FFF000000000003000C000000C0000000000000C00400000000000000000000000000000 -%0040000000000000000000000000000200000000000000000000000000000000800FFF00000000 -%0003000C000000C0000000000000C00400 -%000800E03800000000003000C000000C0000000000000C00400000000000000000000000000000 -%0040000000000000000000000000000200000000000000000000000000000000800E0380000000 -%0003000C000000C0000000000000C00400 -%000800E01C00000000003000C000000C0000000000000C00400000000000000000000000000000 -%0040000000000000000000000000000200000000000000000000000000000000800E01C0000000 -%0003000C000000C0000000000000C00400 -%000800E00C0F838181EC33C3F07819CCE00F007C1B83CC0040000000001FFFFFFFFFFFFFFF0000 -%00400000000000000000000000000002000007FFFFFFFFFFFFFFC00000000000800E00C0F81818 -%1E633C1F0780DCCE00F007C1BC3CC00400 -%000800E00C3FE38187FC3FE3F1FE1FCFF83FC1FE1F8FFC00400000000000000000000000000000 -%0040000000000000000000000000000200000000000000000000000000000000800E00E1FE1818 -%7FE3FE1F1FE0FCFF83FC1FE1FC7FC00400 -%000800E00E30E3818E1C3870C3871E0E1870E3871E9C3C00400000000040000000000000000000 -%0040000000000000000000000000000200000000000000000000100000000000800E00E3061818 -%61E3870C3870E0F1C70E3871E0C3C00400 -%000800E00E7063818C0C3030C3031C0E1CE063031C181C00400000000080000000000000000000 -%0040000000000000000000000000000200000000000000000000080000000000800E00E3071818 -%C0E3030C3030C0E0C6063031C1C1C00400 -%000800E00E0063819C0C3030C6031C0C0CC0700318181C00400000000000000000000000000000 -%0040000000000000000000000000000200000000000000000000000000000000800E00E0071818 -%C0E3030C3038C0C0CC0300318181C00400 -%000800E00E03E381980C3030C7FF9C0C0CC0303F18381C00400000000400000000000000000000 -%0040000000000000000000000000000200000000000000000000010000000000800E00E03F1819 -%C0E3030C7FF8C0C0EC0301F18180C00400 -%000800E00C3FE381980C3030C7FF9C0C0CC031FF18381C00400000000000000000000000000000 -%0040000000000000000000000000000200000000000000000000000000000000800E00E1FF1819 -%C0E3030C7FF8C0C0EC031FF18180C00400 -%000800E00C786383980C3030C6001C0C0CC033C318381C00400000000000000000000000000000 -%0040000000000000000000000000000200000000000000000000000000000000800E00C3871819 -%C0E3030C7000C0C0EC033C318180C00400 -%000800E01C6063839C0C3030C7001C0C0CC0770318181C00400000002000000000000000000000 -%0040000000000000000000000000000200000000000000000000002000000000800E00C7071818 -%C0E3030C7000C0C0CC0330318180C00400 -%000800E0186063838C0C3030C3031C0C1CE0670718181C00400000004000000000000000000000 -%0040000000000000000000000000000200000000000000000000000000000000800E01C6071838 -%C0E3030C3038C0E0C606303181C1C00400 -%000800E07870E1878E1C3030C3871C0E1870E70F180C3C00400000008000000000000000000000 -%0040000000000000000000000000000200000000000000000000000800000000800E07870F1C78 -%E1E3030C3870C0E1C70E307180C3C00400 -%000800FFF03FF1FD87FC3030F1FE1C0FF03FC3FF180FFC00400000000000000000000000000000 -%0040000000000000000000000000000200000000000000000000000000000000800FFF03FF0FD8 -%7FE3030F1FE0C0FF83FC3FF1807FC00400 -%000800FFC01E307981EC303070781C0DE01F01F39803CC00400000000000000000000000000000 -%0040000000000000000000000000000200000000000000000000000000000000800FFC01F30798 -%1EE3030787C0C0CE00F00F19803CC00400 -%0008000000000000000C0000000000000000000000000000400000040000000000000000000000 -%004000000000000000000000000000020000000000000000000000010000000080000000000000 -%00C0000000000000000000000000000400 -%00080000000000000C0C0000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%C0C0000000000000000000000000000400 -%00080000000000000E380000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%F3C0000000000000000000000000000400 -%000800000000000007F00000000000000000000000000000400000200000000000000000000000 -%004000000000000000000000000000020000000000000000000000002000000080000000000000 -%7F80000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400001003FF00060007C0000000000 -%0040000000000000000000000000000200000000003FE000E000FC000400000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400002003FFC00F001FF0000000000 -%0040000000000000000000000000000200000000003FF800E003FE000200000080000000000000 -%0000000000000000000000000000000400 -%00080000000000000000000000000000000000000000000040000000381E00F003838000000000 -%004000000000000000000000000000020000000000301C01F00787800000000080000000000000 -%0000000000000000000000000000000400 -%00080000000000000000000000000000000000000000000040000800380601F80701C000000000 -%004000000000000000000000000000020000000000300E01B00E03800080000080000000000000 -%0000000000000000000000000000000400 -%00080000000000000000000000000000000000000000000040001000380701980E00C000000000 -%004000000000000000000000000000020000000000300603B00C01C00040000080000000000000 -%0000000000000000000000000000000400 -%00080000000000000000000000000000000000000000000040004000380301980C000000000000 -%004000000000000000000000000000020000000000300703181C00000010000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400080003803031C0C000000000000 -%004000000000000000000000000000020000000000300303181800000008000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400100003803830C1C000000000000 -%0040000000000000000000000000000200000000003003071C1800000004000080000000000000 -%0000000000000000000000000000000400 -%0008000000000000000000000000000000000000000000007FFA00003803870E1C00000000FFFF -%FFC00000000000000000000000000003FFFFF800003003060C1800000003FFFF80000000000000 -%0000000000000000000000000000000400 -%0008000000000000000000000000000000000000000000007FFC0000380386061C00000000FFFF -%FFC00000000000000000000000000003FFFFF800003003060C1800000001FFFF80000000000000 -%0000000000000000000000000000000400 -%00080000000000000000000000000000000000000000000040020000380307FE0C000000000000 -%00400000000000000000000000000002000000000030030FFE1800000002000080000000000000 -%0000000000000000000000000000000400 -%0008000000000000000000000000000000000000000000004001000038030FFF0C00C000000000 -%00400000000000000000000000000002000000000030070FFE1C00800004000080000000000000 -%0000000000000000000000000000000400 -%0008000000000000000000000000000000000000000000004000C00038030C030C00C000000000 -%00400000000000000000000000000002000000000030061C070C01C00018000080000000000000 -%0000000000000000000000000000000400 -%0008000000000000000000000000000000000000000000004000000038070C038601C000000000 -%004000000000000000000000000000020000000000300E18030E01800000000080000000000000 -%0000000000000000000000000000000400 -%00080000000000000000000000000000000000000000000040001000380E1C0387038000000000 -%004000000000000000000000000000020000000000301E18038703800040000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400008003FFC180183FF8000000000 -%0040000000000000000000000000000200000000003FFC380387FF000080000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000003FF83801C1FE0000000000 -%0040000000000000000000000000000200000000003FF0300181FE000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400002000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000200000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400001000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000400000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000800000000000000000000000 -%004000000000000000000000000000020000000000000000000000000800000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000200000000000000000000000 -%004000000000000000000000000000020000000000000000000000002000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000040000000000000000000000 -%004000000000000000000000000000020000000000000000000000010000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000100000000000000000000 -%004000000000000000000000000000020000000000000000000004000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000080000000000000000000 -%004000000000000000000000000000020000000000000000000008000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000040000000000000000000 -%004000000000000000000000000000020000000000000000000010000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%00080000000000000000000000000000000000000000000040000000001FFFFFFFFFFFFFFF0000 -%00400000000000000000000000000002000007FFFFFFFFFFFFFFC0000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000800000000000000000000000000000000000000000000400000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000080000000000000 -%0000000000000000000000000000000400 -%000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC00000000000000000000000000000 -%00400000000000000000000000000002000000000000000000000000000000007FFFFFFFFFFFFF -%FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC00 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%004000000000000000000000000000020000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%007FFFFFFFFFFFFFFFFFFFFFFFFFFFFE0000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%000000000000000000000000000000000000000000000000000000000000000000000000000000 -%0000000000000000000000000000000000 -%%EndPreview -%%BeginProlog -%%BeginResource: SDRes -/b4_inc_state save def -/dict_count countdictstack def -/op_count count 1 sub def -userdict begin -0 setgray 0 setlinecap 1 setlinewidth 0 setlinejoin 10 setmiterlimit[] 0 setdash newpath -/languagelevel where {pop languagelevel 1 ne {false setstrokeadjust false setoverprint} if} if -/bdef {bind def} bind def -/c {setgray} bdef -/l {neg lineto} bdef -/rl {neg rlineto} bdef -/lc {setlinecap} bdef -/lj {setlinejoin} bdef -/lw {setlinewidth} bdef -/ml {setmiterlimit} bdef -/ld {setdash} bdef -/m {neg moveto} bdef -/ct {6 2 roll neg 6 2 roll neg 6 2 roll neg curveto} bdef -/r {rotate} bdef -/t {neg translate} bdef -/s {scale} bdef -/sw {show} bdef -/gs {gsave} bdef -/gr {grestore} bdef -/f {findfont dup length dict begin -{1 index /FID ne {def} {pop pop} ifelse} forall /Encoding ISOLatin1Encoding def -currentdict end /NFont exch definefont pop /NFont findfont} bdef -/p {closepath} bdef -/sf {scalefont setfont} bdef -/ef {eofill}bdef -/pc {closepath stroke}bdef -/ps {stroke}bdef -/pum {matrix currentmatrix}bdef -/pom {setmatrix}bdef -/bs {/aString exch def /nXOfs exch def /nWidth exch def currentpoint nXOfs 0 rmoveto pum nWidth aString stringwidth pop div 1 scale aString show pom moveto} bdef -%%EndResource -%%EndProlog -%%BeginSetup -%%EndSetup -%%Page: 1 1 -%%BeginPageSetup -%%EndPageSetup -pum -0.02834 0.02833 s -0 -20290 t -/tm matrix currentmatrix def -gs -tm setmatrix --635 -635 t -1 1 s -635 635 m 27274 635 l 27274 20924 l 635 20924 l 635 635 l eoclip newpath -0.996 c 7835 7938 m 8893 6985 l 11010 6985 l 11010 8890 l 8893 8890 l -7835 7938 l p ef -0 lw 1 lj 0.000 c 7835 7938 m 8893 6985 l 11010 6985 l 11010 8890 l 8893 8890 l -7835 7938 l pc -gs -pum -8520 8228 t --1 0 m 231 -605 l 317 -605 l 565 0 l 474 0 l 403 -183 l 150 -183 l -83 0 l p -173 -248 m 378 -248 l 315 -416 l 296 -467 282 -509 272 -541 ct 264 -503 254 -464 240 -426 ct -p ef -621 0 m 621 -605 l 829 -605 l 876 -605 912 -602 937 -596 ct 972 -588 1001 -574 1026 -553 ct -1058 -526 1082 -492 1098 -450 ct 1114 -408 1121 -360 1121 -306 ct 1121 -260 1116 -219 1105 -183 ct -1095 -148 1081 -118 1064 -95 ct 1047 -72 1029 -54 1009 -40 ct 989 -27 965 -17 937 -10 ct -908 -3 876 0 839 0 ct p -701 -71 m 830 -71 l 870 -71 901 -75 924 -82 ct 947 -90 965 -100 979 -114 ct -998 -133 1012 -158 1023 -190 ct 1034 -222 1039 -261 1039 -307 ct 1039 -370 1028 -419 1008 -453 ct -987 -487 962 -510 932 -521 ct 910 -530 876 -534 828 -534 ct 701 -534 l p ef -1661 -212 m 1741 -192 l 1724 -126 1694 -76 1650 -41 ct 1607 -6 1553 10 1490 10 ct -1425 10 1372 -2 1331 -29 ct 1290 -56 1259 -94 1238 -145 ct 1216 -195 1206 -249 1206 -307 ct -1206 -370 1218 -425 1242 -472 ct 1266 -519 1300 -554 1345 -579 ct 1389 -603 1438 -615 1491 -615 ct -1552 -615 1603 -600 1644 -569 ct 1686 -538 1714 -495 1731 -439 ct 1652 -420 l -1638 -465 1617 -497 1591 -517 ct 1564 -537 1530 -547 1490 -547 ct 1443 -547 1404 -536 1373 -513 ct -1342 -491 1320 -461 1307 -424 ct 1295 -386 1288 -347 1288 -307 ct 1288 -256 1296 -211 1311 -172 ct -1326 -134 1349 -105 1381 -86 ct 1412 -67 1447 -58 1484 -58 ct 1529 -58 1567 -71 1598 -97 ct -1629 -122 l 1650 -161 l p ef -pom -gr -13955 5080 m 11733 5080 l 11733 1270 l 16178 1270 l 16178 5080 l 13955 5080 l -pc -gs -pum -13176 2513 t -69 0 m 69 -605 l 477 -605 l 477 -534 l 149 -534 l 149 -346 l 433 -346 l -433 -275 l 149 -275 l 149 0 l p ef -532 0 m 766 -315 l 560 -605 l 655 -605 l 765 -450 l 788 -418 804 -393 814 -375 ct -827 -397 843 -420 862 -444 ct 984 -605 l 1071 -605 l 858 -320 l 1087 0 l -988 0 l 836 -216 l 827 -228 818 -241 809 -256 ct 796 -234 786 -219 780 -211 ct -628 0 l p ef -1510 -71 m 1510 0 l 1110 0 l 1110 -17 1112 -35 1119 -51 ct 1129 -78 1145 -105 1168 -132 ct -1190 -158 1223 -189 1265 -223 ct 1331 -277 1375 -320 1398 -352 ct 1422 -383 1433 -413 1433 -441 ct -1433 -471 1423 -495 1402 -516 ct 1380 -536 1353 -546 1319 -546 ct 1283 -546 1255 -535 1233 -514 ct -1212 -492 1201 -463 1201 -425 ct 1124 -432 l 1129 -489 1149 -533 1183 -563 ct -1217 -593 1263 -608 1321 -608 ct 1379 -608 1425 -591 1459 -559 ct 1493 -527 1510 -487 1510 -439 ct -1510 -415 1505 -391 1495 -368 ct 1485 -345 1468 -320 1445 -294 ct 1422 -268 1384 -233 1331 -187 ct -1286 -150 1257 -125 1245 -111 ct 1232 -98 1222 -84 1213 -71 ct p ef -pom -pum -12713 3466 t -462 -605 m 542 -605 l 542 -255 l 542 -194 535 -146 522 -110 ct 508 -74 483 -45 447 -23 ct -411 0 364 10 306 10 ct 249 10 202 0 166 -19 ct 130 -38 105 -66 89 -103 ct 74 -140 66 -191 66 -255 ct -66 -605 l 146 -605 l 146 -256 l 146 -203 151 -164 161 -139 ct 171 -114 187 -95 211 -82 ct -235 -68 264 -61 299 -61 ct 358 -61 400 -75 425 -102 ct 450 -128 462 -180 462 -256 ct -p ef -673 -194 m 748 -201 l 752 -170 760 -146 773 -126 ct 786 -107 806 -91 834 -79 ct -862 -67 893 -61 927 -61 ct 958 -61 985 -66 1008 -75 ct 1031 -84 1049 -96 1060 -112 ct -1072 -128 1077 -145 1077 -164 ct 1077 -183 1072 -200 1061 -214 ct 1050 -228 1032 -240 1006 -249 ct -990 -256 954 -266 898 -279 ct 843 -292 804 -305 782 -317 ct 753 -332 731 -351 717 -373 ct -703 -396 696 -421 696 -449 ct 696 -479 704 -508 722 -534 ct 739 -561 764 -581 798 -595 ct -831 -609 868 -615 909 -615 ct 954 -615 993 -608 1028 -594 ct 1062 -579 1088 -558 1107 -530 ct -1125 -502 1135 -470 1136 -434 ct 1060 -429 l 1055 -467 1041 -496 1018 -515 ct -994 -535 959 -545 912 -545 ct 864 -545 828 -536 806 -518 ct 784 -500 773 -479 773 -454 ct -773 -432 781 -414 796 -400 ct 812 -386 852 -372 917 -357 ct 982 -342 1027 -329 1051 -318 ct -1087 -302 1113 -282 1129 -257 ct 1146 -232 1155 -203 1155 -171 ct 1155 -138 1145 -108 1127 -79 ct -1108 -51 1082 -29 1047 -13 ct 1013 2 974 10 931 10 ct 876 10 830 2 793 -13 ct 756 -29 727 -53 706 -85 ct -685 -117 l 674 -154 l p ef -1278 0 m 1278 -605 l 1506 -605 l 1552 -605 1589 -599 1617 -587 ct 1645 -574 1667 -556 1683 -530 ct -1699 -505 1706 -478 1706 -450 ct 1706 -424 1699 -400 1685 -377 ct 1671 -354 1650 -336 1622 -322 ct -1658 -311 1687 -293 1706 -267 ct 1726 -241 1736 -210 1736 -175 ct 1736 -147 1730 -120 1718 -96 ct -1706 -72 1691 -53 1673 -40 ct 1656 -26 1634 -16 1607 -10 ct 1580 -3 1548 0 1509 0 ct -p -1359 -351 m 1490 -351 l 1525 -351 1551 -353 1566 -358 ct 1586 -364 1602 -374 1612 -388 ct -1622 -402 1628 -419 1628 -441 ct 1628 -461 1623 -478 1613 -494 ct 1603 -509 1590 -520 1572 -525 ct -1554 -531 1523 -534 1480 -534 ct 1359 -534 l p -1359 -71 m 1509 -71 l 1535 -71 1553 -72 1564 -74 ct 1582 -77 1598 -83 1610 -90 ct -1623 -98 1633 -109 1641 -124 ct 1649 -139 1653 -156 1653 -175 ct 1653 -198 1647 -217 1635 -234 ct -1624 -251 1608 -262 1587 -269 ct 1567 -276 1537 -279 1499 -279 ct 1359 -279 l -p ef -2436 -71 m 2436 0 l 2036 0 l 2036 -17 2038 -35 2045 -51 ct 2055 -78 2071 -105 2094 -132 ct -2116 -158 2149 -189 2191 -223 ct 2257 -277 2301 -320 2324 -352 ct 2348 -383 2359 -413 2359 -441 ct -2359 -471 2349 -495 2328 -516 ct 2306 -536 2279 -546 2245 -546 ct 2209 -546 2181 -535 2159 -514 ct -2138 -492 2127 -463 2127 -425 ct 2050 -432 l 2055 -489 2075 -533 2109 -563 ct -2143 -593 2189 -608 2247 -608 ct 2305 -608 2351 -591 2385 -559 ct 2419 -527 2436 -487 2436 -439 ct -2436 -415 2431 -391 2421 -368 ct 2411 -345 2394 -320 2371 -294 ct 2348 -268 2310 -233 2257 -187 ct -2212 -150 2183 -125 2171 -111 ct 2158 -98 2148 -84 2139 -71 ct p ef -pom -pum -12091 4419 t -497 -212 m 577 -192 l 560 -126 530 -76 486 -41 ct 443 -6 389 10 326 10 ct -261 10 208 -2 167 -29 ct 126 -56 95 -94 74 -145 ct 52 -195 42 -249 42 -307 ct 42 -370 54 -425 78 -472 ct -102 -519 136 -554 181 -579 ct 225 -603 274 -615 327 -615 ct 388 -615 439 -600 480 -569 ct -522 -538 550 -495 567 -439 ct 488 -420 l 474 -465 453 -497 427 -517 ct 400 -537 366 -547 326 -547 ct -279 -547 240 -536 209 -513 ct 178 -491 156 -461 143 -424 ct 131 -386 124 -347 124 -307 ct -124 -256 132 -211 147 -172 ct 162 -134 185 -105 217 -86 ct 248 -67 283 -58 320 -58 ct -365 -58 403 -71 434 -97 ct 465 -122 l 486 -161 l p ef -663 -219 m 663 -300 685 -360 730 -399 ct 768 -432 814 -448 868 -448 ct 929 -448 978 -428 1016 -389 ct -1054 -349 1074 -295 1074 -225 ct 1074 -169 1065 -124 1048 -92 ct 1031 -59 1007 -34 974 -16 ct -942 0 907 9 868 9 ct 807 9 757 -9 719 -49 ct 682 -88 l 663 -145 l p -739 -219 m 739 -163 751 -121 776 -93 ct 800 -65 831 -51 868 -51 ct 905 -51 936 -65 960 -93 ct -985 -121 997 -164 997 -221 ct 997 -276 985 -317 960 -345 ct 936 -373 905 -387 868 -387 ct -831 -387 800 -373 776 -345 ct 751 -317 l 739 -275 l p ef -1166 0 m 1166 -438 l 1233 -438 l 1233 -376 l 1265 -424 1312 -448 1373 -448 ct -1399 -448 1424 -443 1446 -434 ct 1468 -424 1484 -412 1495 -396 ct 1507 -381 1514 -363 1519 -342 ct -1521 -328 1523 -304 1523 -269 ct 1523 0 l 1448 0 l 1448 -266 l 1448 -297 1446 -319 1440 -334 ct -1434 -349 1424 -361 1409 -370 ct 1394 -379 1377 -384 1357 -384 ct 1325 -384 1298 -374 1275 -354 ct -1252 -333 1241 -295 1241 -239 ct 1241 0 l p ef -1806 -66 m 1816 0 l 1795 3 1777 5 1760 5 ct 1733 5 1712 1 1697 -7 ct 1683 -15 1672 -26 1666 -40 ct -1660 -54 1657 -83 1657 -128 ct 1657 -380 l 1602 -380 l 1602 -438 l 1657 -438 l -1657 -547 l 1731 -591 l 1731 -438 l 1806 -438 l 1806 -380 l 1731 -380 l -1731 -124 l 1731 -103 1732 -89 1735 -83 ct 1737 -77 1742 -72 1748 -68 ct 1753 -65 1762 -63 1773 -63 ct -1781 -63 l 1792 -64 l p ef -1880 0 m 1880 -438 l 1947 -438 l 1947 -372 l 1964 -403 1980 -423 1995 -433 ct -2009 -443 2025 -448 2042 -448 ct 2067 -448 2093 -440 2119 -424 ct 2093 -355 l -2075 -366 2057 -371 2039 -371 ct 2022 -371 2008 -366 1995 -357 ct 1982 -347 1973 -333 1967 -316 ct -1959 -289 1955 -261 1955 -229 ct 1955 0 l p ef -2145 -219 m 2145 -300 2167 -360 2212 -399 ct 2250 -432 2296 -448 2350 -448 ct -2411 -448 2460 -428 2498 -389 ct 2536 -349 2556 -295 2556 -225 ct 2556 -169 2547 -124 2530 -92 ct -2513 -59 2489 -34 2456 -16 ct 2424 0 2389 9 2350 9 ct 2289 9 2239 -9 2201 -49 ct -2164 -88 l 2145 -145 l p -2221 -219 m 2221 -163 2233 -121 2258 -93 ct 2282 -65 2313 -51 2350 -51 ct 2387 -51 2418 -65 2442 -93 ct -2467 -121 2479 -164 2479 -221 ct 2479 -276 2467 -317 2442 -345 ct 2418 -373 2387 -387 2350 -387 ct -2313 -387 2282 -373 2258 -345 ct 2233 -317 l 2221 -275 l p ef -2647 0 m 2647 -605 l 2721 -605 l 2721 0 l p ef -2832 0 m 2832 -605 l 2906 -605 l 2906 0 l p ef -3319 -141 m 3395 -131 l 3383 -86 3361 -52 3328 -27 ct 3295 -2 3253 9 3203 9 ct -3138 9 3087 -9 3050 -49 ct 3012 -88 2993 -144 2993 -215 ct 2993 -289 3012 -346 3050 -387 ct -3089 -428 3138 -448 3198 -448 ct 3257 -448 3305 -428 3342 -388 ct 3379 -348 3398 -292 3398 -220 ct -3398 -215 3398 -209 3397 -200 ct 3070 -200 l 3073 -152 3087 -115 3111 -89 ct -3136 -64 3166 -51 3203 -51 ct 3230 -51 3253 -58 3273 -72 ct 3292 -87 l 3307 -109 l -p -3074 -261 m 3319 -261 l 3316 -298 3307 -326 3291 -344 ct 3268 -373 3237 -387 3199 -387 ct -3165 -387 3136 -376 3113 -353 ct 3090 -330 l 3077 -299 l p ef -3494 0 m 3494 -438 l 3561 -438 l 3561 -372 l 3578 -403 3594 -423 3609 -433 ct -3623 -443 3639 -448 3656 -448 ct 3681 -448 3707 -440 3733 -424 ct 3707 -355 l -3689 -366 3671 -371 3653 -371 ct 3636 -371 3622 -366 3609 -357 ct 3596 -347 3587 -333 3581 -316 ct -3573 -289 3569 -261 3569 -229 ct 3569 0 l p ef -pom -gr -13956 19115 m 11900 19115 l 11900 6350 l 16013 6350 l 16013 19115 l -13956 19115 l pc -gs -pum -12806 13017 t -69 0 m 69 -605 l 477 -605 l 477 -534 l 149 -534 l 149 -346 l 433 -346 l -433 -275 l 149 -275 l 149 0 l p ef -594 0 m 594 -605 l 822 -605 l 862 -605 893 -603 914 -599 ct 944 -594 969 -585 989 -571 ct -1009 -557 1025 -538 1038 -513 ct 1050 -488 1056 -460 1056 -430 ct 1056 -378 1040 -335 1007 -299 ct -974 -264 915 -246 829 -246 ct 674 -246 l 674 0 l p -674 -317 m 830 -317 l 882 -317 919 -327 941 -346 ct 963 -365 973 -392 973 -427 ct -973 -453 967 -474 954 -493 ct 941 -511 925 -522 904 -528 ct 890 -532 865 -534 829 -534 ct -674 -534 l p ef -1433 -237 m 1433 -308 l 1690 -308 l 1690 -84 l 1650 -52 1610 -29 1568 -13 ct -1526 2 1483 10 1439 10 ct 1379 10 1325 -2 1277 -27 ct 1228 -53 1191 -90 1167 -138 ct -1142 -186 1130 -240 1130 -299 ct 1130 -358 1142 -413 1167 -464 ct 1191 -516 1227 -553 1273 -578 ct -1319 -603 1372 -615 1433 -615 ct 1477 -615 1516 -608 1551 -594 ct 1587 -580 1615 -560 1635 -535 ct -1655 -510 1670 -476 1681 -436 ct 1608 -416 l 1599 -447 1588 -471 1574 -489 ct -1561 -506 1542 -520 1517 -531 ct 1492 -542 1464 -547 1433 -547 ct 1397 -547 1365 -541 1338 -530 ct -1311 -519 1290 -504 1273 -486 ct 1257 -468 1244 -448 1235 -426 ct 1220 -389 1212 -348 1212 -304 ct -1212 -250 1221 -205 1240 -169 ct 1259 -133 1286 -106 1321 -88 ct 1357 -70 1394 -61 1434 -61 ct -1469 -61 1503 -68 1536 -82 ct 1569 -95 1594 -109 1611 -124 ct 1611 -237 l p ef -1745 0 m 1977 -605 l 2063 -605 l 2311 0 l 2220 0 l 2149 -183 l 1896 -183 l -1829 0 l p -1919 -248 m 2124 -248 l 2061 -416 l 2042 -467 2028 -509 2018 -541 ct 2010 -503 2000 -464 1986 -426 ct -p ef -pom -gr -0.996 c 7835 17258 m 8893 16305 l 11010 16305 l 11010 18210 l 8893 18210 l -7835 17258 l p ef -0.000 c 7835 17258 m 8893 16305 l 11010 16305 l 11010 18210 l 8893 18210 l -7835 17258 l pc -gs -pum -8520 17542 t -65 0 m 65 -605 l 273 -605 l 320 -605 356 -602 381 -596 ct 416 -588 445 -574 470 -553 ct -502 -526 526 -492 542 -450 ct 558 -408 565 -360 565 -306 ct 565 -260 560 -219 549 -183 ct -539 -148 525 -118 508 -95 ct 491 -72 473 -54 453 -40 ct 433 -27 409 -17 381 -10 ct -352 -3 320 0 283 0 ct p -145 -71 m 274 -71 l 314 -71 345 -75 368 -82 ct 391 -90 409 -100 423 -114 ct -442 -133 456 -158 467 -190 ct 478 -222 483 -261 483 -307 ct 483 -370 472 -419 452 -453 ct -431 -487 406 -510 376 -521 ct 354 -530 320 -534 272 -534 ct 145 -534 l p ef -608 0 m 840 -605 l 926 -605 l 1174 0 l 1083 0 l 1012 -183 l 759 -183 l -692 0 l p -782 -248 m 987 -248 l 924 -416 l 905 -467 891 -509 881 -541 ct 873 -503 863 -464 849 -426 ct -p ef -1661 -212 m 1741 -192 l 1724 -126 1694 -76 1650 -41 ct 1607 -6 1553 10 1490 10 ct -1425 10 1372 -2 1331 -29 ct 1290 -56 1259 -94 1238 -145 ct 1216 -195 1206 -249 1206 -307 ct -1206 -370 1218 -425 1242 -472 ct 1266 -519 1300 -554 1345 -579 ct 1389 -603 1438 -615 1491 -615 ct -1552 -615 1603 -600 1644 -569 ct 1686 -538 1714 -495 1731 -439 ct 1652 -420 l -1638 -465 1617 -497 1591 -517 ct 1564 -537 1530 -547 1490 -547 ct 1443 -547 1404 -536 1373 -513 ct -1342 -491 1320 -461 1307 -424 ct 1295 -386 1288 -347 1288 -307 ct 1288 -256 1296 -211 1311 -172 ct -1326 -134 1349 -105 1381 -86 ct 1412 -67 1447 -58 1484 -58 ct 1529 -58 1567 -71 1598 -97 ct -1629 -122 l 1650 -161 l p ef -pom -gr -0.996 c 7835 10478 m 8893 9525 l 11010 9525 l 11010 11430 l 8893 11430 l -7835 10478 l p ef -0.000 c 7835 10478 m 8893 9525 l 11010 9525 l 11010 11430 l 8893 11430 l -7835 10478 l pc -gs -pum -8520 10768 t --1 0 m 231 -605 l 317 -605 l 565 0 l 474 0 l 403 -183 l 150 -183 l -83 0 l p -173 -248 m 378 -248 l 315 -416 l 296 -467 282 -509 272 -541 ct 264 -503 254 -464 240 -426 ct -p ef -621 0 m 621 -605 l 829 -605 l 876 -605 912 -602 937 -596 ct 972 -588 1001 -574 1026 -553 ct -1058 -526 1082 -492 1098 -450 ct 1114 -408 1121 -360 1121 -306 ct 1121 -260 1116 -219 1105 -183 ct -1095 -148 1081 -118 1064 -95 ct 1047 -72 1029 -54 1009 -40 ct 989 -27 965 -17 937 -10 ct -908 -3 876 0 839 0 ct p -701 -71 m 830 -71 l 870 -71 901 -75 924 -82 ct 947 -90 965 -100 979 -114 ct -998 -133 1012 -158 1023 -190 ct 1034 -222 1039 -261 1039 -307 ct 1039 -370 1028 -419 1008 -453 ct -987 -487 962 -510 932 -521 ct 910 -530 876 -534 828 -534 ct 701 -534 l p ef -1661 -212 m 1741 -192 l 1724 -126 1694 -76 1650 -41 ct 1607 -6 1553 10 1490 10 ct -1425 10 1372 -2 1331 -29 ct 1290 -56 1259 -94 1238 -145 ct 1216 -195 1206 -249 1206 -307 ct -1206 -370 1218 -425 1242 -472 ct 1266 -519 1300 -554 1345 -579 ct 1389 -603 1438 -615 1491 -615 ct -1552 -615 1603 -600 1644 -569 ct 1686 -538 1714 -495 1731 -439 ct 1652 -420 l -1638 -465 1617 -497 1591 -517 ct 1564 -537 1530 -547 1490 -547 ct 1443 -547 1404 -536 1373 -513 ct -1342 -491 1320 -461 1307 -424 ct 1295 -386 1288 -347 1288 -307 ct 1288 -256 1296 -211 1311 -172 ct -1326 -134 1349 -105 1381 -86 ct 1412 -67 1447 -58 1484 -58 ct 1529 -58 1567 -71 1598 -97 ct -1629 -122 l 1650 -161 l p ef -pom -gr -0.996 c 7835 14618 m 8893 13665 l 11010 13665 l 11010 15570 l 8893 15570 l -7835 14618 l p ef -0.000 c 7835 14618 m 8893 13665 l 11010 13665 l 11010 15570 l 8893 15570 l -7835 14618 l pc -gs -pum -8520 14896 t -65 0 m 65 -605 l 273 -605 l 320 -605 356 -602 381 -596 ct 416 -588 445 -574 470 -553 ct -502 -526 526 -492 542 -450 ct 558 -408 565 -360 565 -306 ct 565 -260 560 -219 549 -183 ct -539 -148 525 -118 508 -95 ct 491 -72 473 -54 453 -40 ct 433 -27 409 -17 381 -10 ct -352 -3 320 0 283 0 ct p -145 -71 m 274 -71 l 314 -71 345 -75 368 -82 ct 391 -90 409 -100 423 -114 ct -442 -133 456 -158 467 -190 ct 478 -222 483 -261 483 -307 ct 483 -370 472 -419 452 -453 ct -431 -487 406 -510 376 -521 ct 354 -530 320 -534 272 -534 ct 145 -534 l p ef -608 0 m 840 -605 l 926 -605 l 1174 0 l 1083 0 l 1012 -183 l 759 -183 l -692 0 l p -782 -248 m 987 -248 l 924 -416 l 905 -467 891 -509 881 -541 ct 873 -503 863 -464 849 -426 ct -p ef -1661 -212 m 1741 -192 l 1724 -126 1694 -76 1650 -41 ct 1607 -6 1553 10 1490 10 ct -1425 10 1372 -2 1331 -29 ct 1290 -56 1259 -94 1238 -145 ct 1216 -195 1206 -249 1206 -307 ct -1206 -370 1218 -425 1242 -472 ct 1266 -519 1300 -554 1345 -579 ct 1389 -603 1438 -615 1491 -615 ct -1552 -615 1603 -600 1644 -569 ct 1686 -538 1714 -495 1731 -439 ct 1652 -420 l -1638 -465 1617 -497 1591 -517 ct 1564 -537 1530 -547 1490 -547 ct 1443 -547 1404 -536 1373 -513 ct -1342 -491 1320 -461 1307 -424 ct 1295 -386 1288 -347 1288 -307 ct 1288 -256 1296 -211 1311 -172 ct -1326 -134 1349 -105 1381 -86 ct 1412 -67 1447 -58 1484 -58 ct 1529 -58 1567 -71 1598 -97 ct -1629 -122 l 1650 -161 l p ef -pom -gr -0.996 c 19984 7938 m 18926 6985 l 16809 6985 l 16809 8890 l 18926 8890 l -19984 7938 l p ef -0.000 c 19984 7938 m 18926 6985 l 16809 6985 l 16809 8890 l 18926 8890 l -19984 7938 l pc -gs -pum -17489 8228 t --1 0 m 231 -605 l 317 -605 l 565 0 l 474 0 l 403 -183 l 150 -183 l -83 0 l p -173 -248 m 378 -248 l 315 -416 l 296 -467 282 -509 272 -541 ct 264 -503 254 -464 240 -426 ct -p ef -621 0 m 621 -605 l 829 -605 l 876 -605 912 -602 937 -596 ct 972 -588 1001 -574 1026 -553 ct -1058 -526 1082 -492 1098 -450 ct 1114 -408 1121 -360 1121 -306 ct 1121 -260 1116 -219 1105 -183 ct -1095 -148 1081 -118 1064 -95 ct 1047 -72 1029 -54 1009 -40 ct 989 -27 965 -17 937 -10 ct -908 -3 876 0 839 0 ct p -701 -71 m 830 -71 l 870 -71 901 -75 924 -82 ct 947 -90 965 -100 979 -114 ct -998 -133 1012 -158 1023 -190 ct 1034 -222 1039 -261 1039 -307 ct 1039 -370 1028 -419 1008 -453 ct -987 -487 962 -510 932 -521 ct 910 -530 876 -534 828 -534 ct 701 -534 l p ef -1661 -212 m 1741 -192 l 1724 -126 1694 -76 1650 -41 ct 1607 -6 1553 10 1490 10 ct -1425 10 1372 -2 1331 -29 ct 1290 -56 1259 -94 1238 -145 ct 1216 -195 1206 -249 1206 -307 ct -1206 -370 1218 -425 1242 -472 ct 1266 -519 1300 -554 1345 -579 ct 1389 -603 1438 -615 1491 -615 ct -1552 -615 1603 -600 1644 -569 ct 1686 -538 1714 -495 1731 -439 ct 1652 -420 l -1638 -465 1617 -497 1591 -517 ct 1564 -537 1530 -547 1490 -547 ct 1443 -547 1404 -536 1373 -513 ct -1342 -491 1320 -461 1307 -424 ct 1295 -386 1288 -347 1288 -307 ct 1288 -256 1296 -211 1311 -172 ct -1326 -134 1349 -105 1381 -86 ct 1412 -67 1447 -58 1484 -58 ct 1529 -58 1567 -71 1598 -97 ct -1629 -122 l 1650 -161 l p ef -pom -gr -0.996 c 19984 17258 m 18926 16305 l 16809 16305 l 16809 18210 l 18926 18210 l -19984 17258 l p ef -0.000 c 19984 17258 m 18926 16305 l 16809 16305 l 16809 18210 l 18926 18210 l -19984 17258 l pc -gs -pum -17489 17542 t -65 0 m 65 -605 l 273 -605 l 320 -605 356 -602 381 -596 ct 416 -588 445 -574 470 -553 ct -502 -526 526 -492 542 -450 ct 558 -408 565 -360 565 -306 ct 565 -260 560 -219 549 -183 ct -539 -148 525 -118 508 -95 ct 491 -72 473 -54 453 -40 ct 433 -27 409 -17 381 -10 ct -352 -3 320 0 283 0 ct p -145 -71 m 274 -71 l 314 -71 345 -75 368 -82 ct 391 -90 409 -100 423 -114 ct -442 -133 456 -158 467 -190 ct 478 -222 483 -261 483 -307 ct 483 -370 472 -419 452 -453 ct -431 -487 406 -510 376 -521 ct 354 -530 320 -534 272 -534 ct 145 -534 l p ef -608 0 m 840 -605 l 926 -605 l 1174 0 l 1083 0 l 1012 -183 l 759 -183 l -692 0 l p -782 -248 m 987 -248 l 924 -416 l 905 -467 891 -509 881 -541 ct 873 -503 863 -464 849 -426 ct -p ef -1661 -212 m 1741 -192 l 1724 -126 1694 -76 1650 -41 ct 1607 -6 1553 10 1490 10 ct -1425 10 1372 -2 1331 -29 ct 1290 -56 1259 -94 1238 -145 ct 1216 -195 1206 -249 1206 -307 ct -1206 -370 1218 -425 1242 -472 ct 1266 -519 1300 -554 1345 -579 ct 1389 -603 1438 -615 1491 -615 ct -1552 -615 1603 -600 1644 -569 ct 1686 -538 1714 -495 1731 -439 ct 1652 -420 l -1638 -465 1617 -497 1591 -517 ct 1564 -537 1530 -547 1490 -547 ct 1443 -547 1404 -536 1373 -513 ct -1342 -491 1320 -461 1307 -424 ct 1295 -386 1288 -347 1288 -307 ct 1288 -256 1296 -211 1311 -172 ct -1326 -134 1349 -105 1381 -86 ct 1412 -67 1447 -58 1484 -58 ct 1529 -58 1567 -71 1598 -97 ct -1629 -122 l 1650 -161 l p ef -pom -gr -0.996 c 19984 10478 m 18926 9525 l 16809 9525 l 16809 11430 l 18926 11430 l -19984 10478 l p ef -0.000 c 19984 10478 m 18926 9525 l 16809 9525 l 16809 11430 l 18926 11430 l -19984 10478 l pc -gs -pum -17489 10768 t --1 0 m 231 -605 l 317 -605 l 565 0 l 474 0 l 403 -183 l 150 -183 l -83 0 l p -173 -248 m 378 -248 l 315 -416 l 296 -467 282 -509 272 -541 ct 264 -503 254 -464 240 -426 ct -p ef -621 0 m 621 -605 l 829 -605 l 876 -605 912 -602 937 -596 ct 972 -588 1001 -574 1026 -553 ct -1058 -526 1082 -492 1098 -450 ct 1114 -408 1121 -360 1121 -306 ct 1121 -260 1116 -219 1105 -183 ct -1095 -148 1081 -118 1064 -95 ct 1047 -72 1029 -54 1009 -40 ct 989 -27 965 -17 937 -10 ct -908 -3 876 0 839 0 ct p -701 -71 m 830 -71 l 870 -71 901 -75 924 -82 ct 947 -90 965 -100 979 -114 ct -998 -133 1012 -158 1023 -190 ct 1034 -222 1039 -261 1039 -307 ct 1039 -370 1028 -419 1008 -453 ct -987 -487 962 -510 932 -521 ct 910 -530 876 -534 828 -534 ct 701 -534 l p ef -1661 -212 m 1741 -192 l 1724 -126 1694 -76 1650 -41 ct 1607 -6 1553 10 1490 10 ct -1425 10 1372 -2 1331 -29 ct 1290 -56 1259 -94 1238 -145 ct 1216 -195 1206 -249 1206 -307 ct -1206 -370 1218 -425 1242 -472 ct 1266 -519 1300 -554 1345 -579 ct 1389 -603 1438 -615 1491 -615 ct -1552 -615 1603 -600 1644 -569 ct 1686 -538 1714 -495 1731 -439 ct 1652 -420 l -1638 -465 1617 -497 1591 -517 ct 1564 -537 1530 -547 1490 -547 ct 1443 -547 1404 -536 1373 -513 ct -1342 -491 1320 -461 1307 -424 ct 1295 -386 1288 -347 1288 -307 ct 1288 -256 1296 -211 1311 -172 ct -1326 -134 1349 -105 1381 -86 ct 1412 -67 1447 -58 1484 -58 ct 1529 -58 1567 -71 1598 -97 ct -1629 -122 l 1650 -161 l p ef -pom -gr -0.996 c 19984 14618 m 18926 13665 l 16809 13665 l 16809 15570 l 18926 15570 l -19984 14618 l p ef -0.000 c 19984 14618 m 18926 13665 l 16809 13665 l 16809 15570 l 18926 15570 l -19984 14618 l pc -gs -pum -17489 14896 t -65 0 m 65 -605 l 273 -605 l 320 -605 356 -602 381 -596 ct 416 -588 445 -574 470 -553 ct -502 -526 526 -492 542 -450 ct 558 -408 565 -360 565 -306 ct 565 -260 560 -219 549 -183 ct -539 -148 525 -118 508 -95 ct 491 -72 473 -54 453 -40 ct 433 -27 409 -17 381 -10 ct -352 -3 320 0 283 0 ct p -145 -71 m 274 -71 l 314 -71 345 -75 368 -82 ct 391 -90 409 -100 423 -114 ct -442 -133 456 -158 467 -190 ct 478 -222 483 -261 483 -307 ct 483 -370 472 -419 452 -453 ct -431 -487 406 -510 376 -521 ct 354 -530 320 -534 272 -534 ct 145 -534 l p ef -608 0 m 840 -605 l 926 -605 l 1174 0 l 1083 0 l 1012 -183 l 759 -183 l -692 0 l p -782 -248 m 987 -248 l 924 -416 l 905 -467 891 -509 881 -541 ct 873 -503 863 -464 849 -426 ct -p ef -1661 -212 m 1741 -192 l 1724 -126 1694 -76 1650 -41 ct 1607 -6 1553 10 1490 10 ct -1425 10 1372 -2 1331 -29 ct 1290 -56 1259 -94 1238 -145 ct 1216 -195 1206 -249 1206 -307 ct -1206 -370 1218 -425 1242 -472 ct 1266 -519 1300 -554 1345 -579 ct 1389 -603 1438 -615 1491 -615 ct -1552 -615 1603 -600 1644 -569 ct 1686 -538 1714 -495 1731 -439 ct 1652 -420 l -1638 -465 1617 -497 1591 -517 ct 1564 -537 1530 -547 1490 -547 ct 1443 -547 1404 -536 1373 -513 ct -1342 -491 1320 -461 1307 -424 ct 1295 -386 1288 -347 1288 -307 ct 1288 -256 1296 -211 1311 -172 ct -1326 -134 1349 -105 1381 -86 ct 1412 -67 1447 -58 1484 -58 ct 1529 -58 1567 -71 1598 -97 ct -1629 -122 l 1650 -161 l p ef -pom -gr -23767 18828 m 20592 18828 l 20592 13113 l 26942 13113 l 26942 18828 l -23767 18828 l pc -gs -pum -22133 15795 t -219 0 m 219 -534 l 19 -534 l 19 -605 l 499 -605 l 499 -534 l 299 -534 l -299 0 l p ef -583 0 m 583 -438 l 650 -438 l 650 -372 l 667 -403 683 -423 698 -433 ct -712 -443 728 -448 745 -448 ct 770 -448 796 -440 822 -424 ct 796 -355 l 778 -366 760 -371 742 -371 ct -725 -371 711 -366 698 -357 ct 685 -347 676 -333 670 -316 ct 662 -289 658 -261 658 -229 ct -658 0 l p ef -1162 -54 m 1134 -30 1108 -14 1082 -4 ct 1057 5 1029 9 1000 9 ct 952 9 915 -1 889 -25 ct -863 -48 850 -79 850 -115 ct 850 -137 855 -156 865 -174 ct 875 -192 887 -206 903 -217 ct -919 -228 937 -236 957 -241 ct 971 -245 993 -249 1023 -252 ct 1083 -259 1127 -268 1155 -278 ct -1156 -288 1156 -295 1156 -297 ct 1156 -328 1149 -349 1135 -361 ct 1116 -378 1087 -387 1050 -387 ct -1015 -387 989 -380 973 -368 ct 956 -356 944 -334 936 -303 ct 863 -313 l 869 -344 880 -369 896 -388 ct -911 -408 933 -422 961 -433 ct 990 -443 1023 -448 1061 -448 ct 1098 -448 1129 -444 1152 -435 ct -1175 -426 1193 -415 1204 -402 ct 1215 -388 1222 -371 1227 -351 ct 1229 -338 1231 -316 1231 -282 ct -1231 -183 l 1231 -114 1232 -70 1235 -52 ct 1238 -34 1245 -16 1254 0 ct 1176 0 l -1169 -15 l 1164 -33 l p -1155 -220 m 1128 -209 1088 -199 1034 -192 ct 1003 -187 982 -182 969 -177 ct -956 -171 947 -163 940 -153 ct 933 -142 929 -130 929 -117 ct 929 -97 937 -81 952 -68 ct -967 -54 989 -48 1018 -48 ct 1046 -48 1072 -54 1094 -67 ct 1117 -79 1133 -96 1143 -118 ct -1151 -135 1155 -160 1155 -192 ct p ef -1325 0 m 1325 -438 l 1392 -438 l 1392 -376 l 1424 -424 1471 -448 1532 -448 ct -1558 -448 1583 -443 1605 -434 ct 1627 -424 1643 -412 1654 -396 ct 1666 -381 1673 -363 1678 -342 ct -1680 -328 1682 -304 1682 -269 ct 1682 0 l 1607 0 l 1607 -266 l 1607 -297 1605 -319 1599 -334 ct -1593 -349 1583 -361 1568 -370 ct 1553 -379 1536 -384 1516 -384 ct 1484 -384 1457 -374 1434 -354 ct -1411 -333 1400 -295 1400 -239 ct 1400 0 l p ef -1772 -130 m 1845 -142 l 1849 -113 1861 -90 1880 -74 ct 1898 -59 1925 -51 1959 -51 ct -1993 -51 2018 -58 2035 -72 ct 2051 -85 2059 -102 2059 -121 ct 2059 -137 2052 -151 2038 -160 ct -2027 -167 2002 -175 1962 -185 ct 1907 -199 1869 -211 1848 -221 ct 1827 -231 1811 -245 1800 -263 ct -1789 -281 1784 -300 1784 -322 ct 1784 -341 1788 -359 1797 -376 ct 1806 -393 1818 -407 1834 -418 ct -1845 -426 1861 -433 1881 -439 ct 1901 -445 1923 -448 1945 -448 ct 1980 -448 2010 -443 2036 -433 ct -2062 -423 2081 -410 2094 -393 ct 2106 -376 2115 -353 2119 -325 ct 2047 -315 l -2043 -338 2034 -355 2018 -368 ct 2002 -381 1980 -387 1951 -387 ct 1917 -387 1892 -381 1878 -370 ct -1863 -359 1856 -346 1856 -330 ct 1856 -321 1859 -312 1865 -304 ct 1871 -296 1880 -290 1893 -285 ct -1901 -282 1923 -275 1959 -266 ct 2012 -251 2048 -240 2069 -231 ct 2090 -222 2106 -209 2118 -192 ct -2130 -175 2136 -154 2136 -128 ct 2136 -104 2129 -80 2114 -58 ct 2100 -36 2079 -20 2052 -8 ct -2024 3 1993 9 1959 9 ct 1902 9 1859 -1 1829 -25 ct 1799 -49 l 1780 -84 l p ef -2198 0 m 2198 -438 l 2265 -438 l 2265 -377 l 2279 -398 2297 -415 2320 -428 ct -2343 -442 2369 -448 2398 -448 ct 2430 -448 2457 -441 2478 -428 ct 2499 -414 2513 -396 2522 -371 ct -2556 -423 2602 -448 2657 -448 ct 2701 -448 2734 -436 2758 -412 ct 2781 -388 2793 -351 2793 -301 ct -2793 0 l 2719 0 l 2719 -276 l 2719 -306 2716 -327 2712 -340 ct 2707 -353 2698 -364 2685 -372 ct -2673 -380 2658 -384 2641 -384 ct 2610 -384 2584 -373 2564 -353 ct 2543 -332 2533 -300 2533 -254 ct -2533 0 l 2459 0 l 2459 -285 l 2459 -318 2453 -342 2441 -359 ct 2429 -375 2409 -384 2381 -384 ct -2360 -384 2341 -378 2323 -367 ct 2305 -356 2293 -340 2285 -319 ct 2277 -298 2273 -267 2273 -227 ct -2273 0 l p ef -2914 -520 m 2914 -605 l 2988 -605 l 2988 -520 l p -2914 0 m 2914 -438 l 2988 -438 l 2988 0 l p ef -3261 -66 m 3271 0 l 3250 3 3232 5 3215 5 ct 3188 5 3167 1 3152 -7 ct 3138 -15 3127 -26 3121 -40 ct -3115 -54 3112 -83 3112 -128 ct 3112 -380 l 3057 -380 l 3057 -438 l 3112 -438 l -3112 -547 l 3186 -591 l 3186 -438 l 3261 -438 l 3261 -380 l 3186 -380 l -3186 -124 l 3186 -103 3187 -89 3190 -83 ct 3192 -77 3197 -72 3203 -68 ct 3208 -65 3217 -63 3228 -63 ct -3236 -63 l 3247 -64 l p ef -pom -pum -20955 16748 t -65 0 m 65 -605 l 273 -605 l 320 -605 356 -602 381 -596 ct 416 -588 445 -574 470 -553 ct -502 -526 526 -492 542 -450 ct 558 -408 565 -360 565 -306 ct 565 -260 560 -219 549 -183 ct -539 -148 525 -118 508 -95 ct 491 -72 473 -54 453 -40 ct 433 -27 409 -17 381 -10 ct -352 -3 320 0 283 0 ct p -145 -71 m 274 -71 l 314 -71 345 -75 368 -82 ct 391 -90 409 -100 423 -114 ct -442 -133 456 -158 467 -190 ct 478 -222 483 -261 483 -307 ct 483 -370 472 -419 452 -453 ct -431 -487 406 -510 376 -521 ct 354 -530 320 -534 272 -534 ct 145 -534 l p ef -951 -54 m 923 -30 897 -14 871 -4 ct 846 5 818 9 789 9 ct 741 9 704 -1 678 -25 ct -652 -48 639 -79 639 -115 ct 639 -137 644 -156 654 -174 ct 664 -192 676 -206 692 -217 ct -708 -228 726 -236 746 -241 ct 760 -245 782 -249 812 -252 ct 872 -259 916 -268 944 -278 ct -945 -288 945 -295 945 -297 ct 945 -328 938 -349 924 -361 ct 905 -378 876 -387 839 -387 ct -804 -387 778 -380 762 -368 ct 745 -356 733 -334 725 -303 ct 652 -313 l 658 -344 669 -369 685 -388 ct -700 -408 722 -422 750 -433 ct 779 -443 812 -448 850 -448 ct 887 -448 918 -444 941 -435 ct -964 -426 982 -415 993 -402 ct 1004 -388 1011 -371 1016 -351 ct 1018 -338 1020 -316 1020 -282 ct -1020 -183 l 1020 -114 1021 -70 1024 -52 ct 1027 -34 1034 -16 1043 0 ct 965 0 l -958 -15 l 953 -33 l p -944 -220 m 917 -209 877 -199 823 -192 ct 792 -187 771 -182 758 -177 ct 745 -171 736 -163 729 -153 ct -722 -142 718 -130 718 -117 ct 718 -97 726 -81 741 -68 ct 756 -54 778 -48 807 -48 ct -835 -48 861 -54 883 -67 ct 906 -79 922 -96 932 -118 ct 940 -135 944 -160 944 -192 ct -p ef -1401 0 m 1401 -64 l 1367 -14 1320 9 1262 9 ct 1236 9 1212 4 1189 -4 ct 1167 -14 1150 -27 1139 -42 ct -1128 -57 1121 -75 1116 -97 ct 1113 -112 1112 -135 1112 -166 ct 1112 -438 l 1186 -438 l -1186 -195 l 1186 -156 1187 -130 1191 -116 ct 1195 -97 1205 -82 1220 -70 ct -1235 -59 1254 -54 1276 -54 ct 1299 -54 1320 -59 1339 -71 ct 1359 -82 1373 -98 1381 -117 ct -1389 -137 1393 -166 1393 -203 ct 1393 -438 l 1467 -438 l 1467 0 l p ef -1577 36 m 1649 47 l 1652 69 1660 85 1674 95 ct 1693 109 1718 116 1750 116 ct -1784 116 1811 109 1829 95 ct 1848 82 1861 62 1867 38 ct 1871 22 1873 -8 1873 -57 ct -1840 -19 1800 0 1751 0 ct 1691 0 1644 -21 1611 -65 ct 1578 -108 1562 -160 1562 -221 ct -1562 -263 1569 -302 1584 -337 ct 1600 -373 1622 -400 1650 -419 ct 1679 -438 1713 -448 1752 -448 ct -1804 -448 1846 -427 1880 -385 ct 1880 -438 l 1948 -438 l 1948 -59 l 1948 8 1941 57 1928 85 ct -1914 114 1892 136 1861 153 ct 1831 169 1794 178 1750 178 ct 1698 178 1656 166 1623 142 ct -1591 119 l 1576 83 l p -1638 -227 m 1638 -169 1650 -127 1672 -101 ct 1695 -74 1724 -61 1758 -61 ct -1793 -61 1821 -74 1844 -101 ct 1867 -127 1879 -168 1879 -224 ct 1879 -278 1867 -318 1843 -346 ct -1819 -373 1791 -387 1757 -387 ct 1724 -387 1696 -373 1673 -346 ct 1650 -319 l -1638 -280 l p ef -2066 0 m 2066 -605 l 2141 -605 l 2141 -388 l 2175 -428 2219 -448 2272 -448 ct -2304 -448 2333 -442 2357 -429 ct 2381 -416 2398 -398 2408 -376 ct 2418 -353 2424 -320 2424 -278 ct -2424 0 l 2349 0 l 2349 -278 l 2349 -315 2341 -342 2325 -359 ct 2309 -376 2286 -384 2257 -384 ct -2235 -384 2214 -378 2195 -367 ct 2175 -356 2161 -340 2153 -320 ct 2145 -301 2141 -274 2141 -240 ct -2141 0 l p ef -2705 -66 m 2715 0 l 2694 3 2676 5 2659 5 ct 2632 5 2611 1 2596 -7 ct 2582 -15 2571 -26 2565 -40 ct -2559 -54 2556 -83 2556 -128 ct 2556 -380 l 2501 -380 l 2501 -438 l 2556 -438 l -2556 -547 l 2630 -591 l 2630 -438 l 2705 -438 l 2705 -380 l 2630 -380 l -2630 -124 l 2630 -103 2631 -89 2634 -83 ct 2636 -77 2641 -72 2647 -68 ct 2652 -65 2661 -63 2672 -63 ct -2680 -63 l 2691 -64 l p ef -3081 -141 m 3157 -131 l 3145 -86 3123 -52 3090 -27 ct 3057 -2 3015 9 2965 9 ct -2900 9 2849 -9 2812 -49 ct 2774 -88 2755 -144 2755 -215 ct 2755 -289 2774 -346 2812 -387 ct -2851 -428 2900 -448 2960 -448 ct 3019 -448 3067 -428 3104 -388 ct 3141 -348 3160 -292 3160 -220 ct -3160 -215 3160 -209 3159 -200 ct 2832 -200 l 2835 -152 2849 -115 2873 -89 ct -2898 -64 2928 -51 2965 -51 ct 2992 -51 3015 -58 3035 -72 ct 3054 -87 l 3069 -109 l -p -2836 -261 m 3081 -261 l 3078 -298 3069 -326 3053 -344 ct 3030 -373 2999 -387 2961 -387 ct -2927 -387 2898 -376 2875 -353 ct 2852 -330 l 2839 -299 l p ef -3255 0 m 3255 -438 l 3322 -438 l 3322 -372 l 3339 -403 3355 -423 3370 -433 ct -3384 -443 3400 -448 3417 -448 ct 3442 -448 3468 -440 3494 -424 ct 3468 -355 l -3450 -366 3432 -371 3414 -371 ct 3397 -371 3383 -366 3370 -357 ct 3357 -347 3348 -333 3342 -316 ct -3334 -289 3330 -261 3330 -229 ct 3330 0 l p ef -3617 0 m 3548 0 l 3548 -605 l 3622 -605 l 3622 -389 l 3654 -428 3694 -448 3742 -448 ct -3769 -448 3795 -443 3819 -432 ct 3843 -421 3863 -406 3879 -386 ct 3894 -366 3906 -343 3915 -315 ct -3924 -287 3928 -257 3928 -225 ct 3928 -150 3910 -92 3873 -51 ct 3835 -10 3791 9 3739 9 ct -3687 9 3646 -11 3617 -54 ct p -3616 -222 m 3616 -170 3623 -132 3638 -108 ct 3661 -70 3693 -51 3733 -51 ct -3765 -51 3793 -65 3817 -93 ct 3840 -121 3852 -163 3852 -219 ct 3852 -277 3841 -319 3818 -346 ct -3796 -373 3768 -387 3736 -387 ct 3703 -387 3675 -373 3652 -345 ct 3628 -316 l -3616 -276 l p ef -3970 -219 m 3970 -300 3992 -360 4037 -399 ct 4075 -432 4121 -448 4175 -448 ct -4236 -448 4285 -428 4323 -389 ct 4361 -349 4381 -295 4381 -225 ct 4381 -169 4372 -124 4355 -92 ct -4338 -59 4314 -34 4281 -16 ct 4249 0 4214 9 4175 9 ct 4114 9 4064 -9 4026 -49 ct -3989 -88 l 3970 -145 l p -4046 -219 m 4046 -163 4058 -121 4083 -93 ct 4107 -65 4138 -51 4175 -51 ct 4212 -51 4243 -65 4267 -93 ct -4292 -121 4304 -164 4304 -221 ct 4304 -276 4292 -317 4267 -345 ct 4243 -373 4212 -387 4175 -387 ct -4138 -387 4107 -373 4083 -345 ct 4058 -317 l 4046 -275 l p ef -4761 -54 m 4733 -30 4707 -14 4681 -4 ct 4656 5 4628 9 4599 9 ct 4551 9 4514 -1 4488 -25 ct -4462 -48 4449 -79 4449 -115 ct 4449 -137 4454 -156 4464 -174 ct 4474 -192 4486 -206 4502 -217 ct -4518 -228 4536 -236 4556 -241 ct 4570 -245 4592 -249 4622 -252 ct 4682 -259 4726 -268 4754 -278 ct -4755 -288 4755 -295 4755 -297 ct 4755 -328 4748 -349 4734 -361 ct 4715 -378 4686 -387 4649 -387 ct -4614 -387 4588 -380 4572 -368 ct 4555 -356 4543 -334 4535 -303 ct 4462 -313 l -4468 -344 4479 -369 4495 -388 ct 4510 -408 4532 -422 4560 -433 ct 4589 -443 4622 -448 4660 -448 ct -4697 -448 4728 -444 4751 -435 ct 4774 -426 4792 -415 4803 -402 ct 4814 -388 4821 -371 4826 -351 ct -4828 -338 4830 -316 4830 -282 ct 4830 -183 l 4830 -114 4831 -70 4834 -52 ct -4837 -34 4844 -16 4853 0 ct 4775 0 l 4768 -15 l 4763 -33 l p -4754 -220 m 4727 -209 4687 -199 4633 -192 ct 4602 -187 4581 -182 4568 -177 ct -4555 -171 4546 -163 4539 -153 ct 4532 -142 4528 -130 4528 -117 ct 4528 -97 4536 -81 4551 -68 ct -4566 -54 4588 -48 4617 -48 ct 4645 -48 4671 -54 4693 -67 ct 4716 -79 4732 -96 4742 -118 ct -4750 -135 4754 -160 4754 -192 ct p ef -4922 0 m 4922 -438 l 4989 -438 l 4989 -372 l 5006 -403 5022 -423 5037 -433 ct -5051 -443 5067 -448 5084 -448 ct 5109 -448 5135 -440 5161 -424 ct 5135 -355 l -5117 -366 5099 -371 5081 -371 ct 5064 -371 5050 -366 5037 -357 ct 5024 -347 5015 -333 5009 -316 ct -5001 -289 4997 -261 4997 -229 ct 4997 0 l p ef -5499 0 m 5499 -55 l 5471 -11 5430 9 5376 9 ct 5341 9 5309 0 5280 -19 ct 5250 -38 5228 -65 5212 -99 ct -5195 -134 5187 -174 5187 -218 ct 5187 -262 5195 -302 5209 -338 ct 5224 -373 5246 -401 5275 -420 ct -5304 -439 5337 -448 5373 -448 ct 5399 -448 5423 -443 5444 -431 ct 5464 -420 5481 -406 5494 -388 ct -5494 -605 l 5568 -605 l 5568 0 l p -5264 -218 m 5264 -162 5276 -120 5299 -92 ct 5323 -65 5351 -51 5383 -51 ct 5416 -51 5443 -64 5466 -91 ct -5489 -117 5500 -158 5500 -212 ct 5500 -272 5489 -316 5465 -344 ct 5442 -373 5414 -387 5380 -387 ct -5347 -387 5319 -373 5297 -346 ct 5275 -319 l 5264 -277 l p ef -pom -gr -23767 12065 m 20592 12065 l 20592 6350 l 26942 6350 l 26942 12065 l -23767 12065 l pc -gs -pum -22239 9022 t -66 0 m 66 -605 l 335 -605 l 389 -605 430 -600 458 -589 ct 486 -578 508 -559 525 -531 ct -542 -504 550 -473 550 -440 ct 550 -397 536 -361 508 -331 ct 481 -302 438 -283 380 -275 ct -401 -265 417 -255 428 -245 ct 451 -223 473 -197 494 -164 ct 600 0 l 499 0 l -419 -125 l 395 -162 376 -190 361 -209 ct 346 -228 332 -242 320 -249 ct 308 -257 296 -263 284 -266 ct -275 -267 260 -268 239 -268 ct 146 -268 l 146 0 l p -146 -338 m 318 -338 l 355 -338 384 -342 404 -349 ct 425 -357 441 -369 451 -386 ct -462 -402 468 -420 468 -440 ct 468 -468 457 -492 436 -510 ct 416 -529 383 -538 338 -538 ct -146 -538 l p ef -965 -141 m 1041 -131 l 1029 -86 1007 -52 974 -27 ct 941 -2 899 9 849 9 ct -784 9 733 -9 696 -49 ct 658 -88 639 -144 639 -215 ct 639 -289 658 -346 696 -387 ct -735 -428 784 -448 844 -448 ct 903 -448 951 -428 988 -388 ct 1025 -348 1044 -292 1044 -220 ct -1044 -215 1044 -209 1043 -200 ct 716 -200 l 719 -152 733 -115 757 -89 ct 782 -64 812 -51 849 -51 ct -876 -51 899 -58 919 -72 ct 938 -87 l 953 -109 l p -720 -261 m 965 -261 l 962 -298 953 -326 937 -344 ct 914 -373 883 -387 845 -387 ct -811 -387 782 -376 759 -353 ct 736 -330 l 723 -299 l p ef -1427 -160 m 1500 -151 l 1492 -100 1471 -61 1438 -32 ct 1405 -4 1365 9 1317 9 ct -1257 9 1209 -9 1172 -48 ct 1136 -88 1118 -144 1118 -217 ct 1118 -265 1125 -306 1141 -342 ct -1157 -377 1181 -404 1213 -421 ct 1245 -439 1280 -448 1317 -448 ct 1365 -448 1404 -436 1434 -412 ct -1465 -388 1484 -354 1493 -309 ct 1420 -298 l 1413 -328 1401 -350 1384 -365 ct -1366 -380 1345 -387 1320 -387 ct 1283 -387 1252 -374 1229 -347 ct 1206 -320 1194 -277 1194 -219 ct -1194 -160 1205 -118 1228 -91 ct 1250 -64 1280 -51 1316 -51 ct 1345 -51 1370 -60 1389 -78 ct -1409 -95 l 1421 -123 l p ef -1864 -141 m 1940 -131 l 1928 -86 1906 -52 1873 -27 ct 1840 -2 1798 9 1748 9 ct -1683 9 1632 -9 1595 -49 ct 1557 -88 1538 -144 1538 -215 ct 1538 -289 1557 -346 1595 -387 ct -1634 -428 1683 -448 1743 -448 ct 1802 -448 1850 -428 1887 -388 ct 1924 -348 1943 -292 1943 -220 ct -1943 -215 1943 -209 1942 -200 ct 1615 -200 l 1618 -152 1632 -115 1656 -89 ct -1681 -64 1711 -51 1748 -51 ct 1775 -51 1798 -58 1818 -72 ct 1837 -87 l 1852 -109 l -p -1619 -261 m 1864 -261 l 1861 -298 1852 -326 1836 -344 ct 1813 -373 1782 -387 1744 -387 ct -1710 -387 1681 -376 1658 -353 ct 1635 -330 l 1622 -299 l p ef -2040 -520 m 2040 -605 l 2114 -605 l 2114 -520 l p -2040 0 m 2040 -438 l 2114 -438 l 2114 0 l p ef -2347 0 m 2180 -438 l 2259 -438 l 2353 -175 l 2363 -147 2372 -118 2381 -87 ct -2388 -110 2397 -138 2409 -171 ct 2506 -438 l 2583 -438 l 2417 0 l p ef -2949 -141 m 3025 -131 l 3013 -86 2991 -52 2958 -27 ct 2925 -2 2883 9 2833 9 ct -2768 9 2717 -9 2680 -49 ct 2642 -88 2623 -144 2623 -215 ct 2623 -289 2642 -346 2680 -387 ct -2719 -428 2768 -448 2828 -448 ct 2887 -448 2935 -428 2972 -388 ct 3009 -348 3028 -292 3028 -220 ct -3028 -215 3028 -209 3027 -200 ct 2700 -200 l 2703 -152 2717 -115 2741 -89 ct -2766 -64 2796 -51 2833 -51 ct 2860 -51 2883 -58 2903 -72 ct 2922 -87 l 2937 -109 l -p -2704 -261 m 2949 -261 l 2946 -298 2937 -326 2921 -344 ct 2898 -373 2867 -387 2829 -387 ct -2795 -387 2766 -376 2743 -353 ct 2720 -330 l 2707 -299 l p ef -pom -pum -20955 9975 t -65 0 m 65 -605 l 273 -605 l 320 -605 356 -602 381 -596 ct 416 -588 445 -574 470 -553 ct -502 -526 526 -492 542 -450 ct 558 -408 565 -360 565 -306 ct 565 -260 560 -219 549 -183 ct -539 -148 525 -118 508 -95 ct 491 -72 473 -54 453 -40 ct 433 -27 409 -17 381 -10 ct -352 -3 320 0 283 0 ct p -145 -71 m 274 -71 l 314 -71 345 -75 368 -82 ct 391 -90 409 -100 423 -114 ct -442 -133 456 -158 467 -190 ct 478 -222 483 -261 483 -307 ct 483 -370 472 -419 452 -453 ct -431 -487 406 -510 376 -521 ct 354 -530 320 -534 272 -534 ct 145 -534 l p ef -951 -54 m 923 -30 897 -14 871 -4 ct 846 5 818 9 789 9 ct 741 9 704 -1 678 -25 ct -652 -48 639 -79 639 -115 ct 639 -137 644 -156 654 -174 ct 664 -192 676 -206 692 -217 ct -708 -228 726 -236 746 -241 ct 760 -245 782 -249 812 -252 ct 872 -259 916 -268 944 -278 ct -945 -288 945 -295 945 -297 ct 945 -328 938 -349 924 -361 ct 905 -378 876 -387 839 -387 ct -804 -387 778 -380 762 -368 ct 745 -356 733 -334 725 -303 ct 652 -313 l 658 -344 669 -369 685 -388 ct -700 -408 722 -422 750 -433 ct 779 -443 812 -448 850 -448 ct 887 -448 918 -444 941 -435 ct -964 -426 982 -415 993 -402 ct 1004 -388 1011 -371 1016 -351 ct 1018 -338 1020 -316 1020 -282 ct -1020 -183 l 1020 -114 1021 -70 1024 -52 ct 1027 -34 1034 -16 1043 0 ct 965 0 l -958 -15 l 953 -33 l p -944 -220 m 917 -209 877 -199 823 -192 ct 792 -187 771 -182 758 -177 ct 745 -171 736 -163 729 -153 ct -722 -142 718 -130 718 -117 ct 718 -97 726 -81 741 -68 ct 756 -54 778 -48 807 -48 ct -835 -48 861 -54 883 -67 ct 906 -79 922 -96 932 -118 ct 940 -135 944 -160 944 -192 ct -p ef -1401 0 m 1401 -64 l 1367 -14 1320 9 1262 9 ct 1236 9 1212 4 1189 -4 ct 1167 -14 1150 -27 1139 -42 ct -1128 -57 1121 -75 1116 -97 ct 1113 -112 1112 -135 1112 -166 ct 1112 -438 l 1186 -438 l -1186 -195 l 1186 -156 1187 -130 1191 -116 ct 1195 -97 1205 -82 1220 -70 ct -1235 -59 1254 -54 1276 -54 ct 1299 -54 1320 -59 1339 -71 ct 1359 -82 1373 -98 1381 -117 ct -1389 -137 1393 -166 1393 -203 ct 1393 -438 l 1467 -438 l 1467 0 l p ef -1577 36 m 1649 47 l 1652 69 1660 85 1674 95 ct 1693 109 1718 116 1750 116 ct -1784 116 1811 109 1829 95 ct 1848 82 1861 62 1867 38 ct 1871 22 1873 -8 1873 -57 ct -1840 -19 1800 0 1751 0 ct 1691 0 1644 -21 1611 -65 ct 1578 -108 1562 -160 1562 -221 ct -1562 -263 1569 -302 1584 -337 ct 1600 -373 1622 -400 1650 -419 ct 1679 -438 1713 -448 1752 -448 ct -1804 -448 1846 -427 1880 -385 ct 1880 -438 l 1948 -438 l 1948 -59 l 1948 8 1941 57 1928 85 ct -1914 114 1892 136 1861 153 ct 1831 169 1794 178 1750 178 ct 1698 178 1656 166 1623 142 ct -1591 119 l 1576 83 l p -1638 -227 m 1638 -169 1650 -127 1672 -101 ct 1695 -74 1724 -61 1758 -61 ct -1793 -61 1821 -74 1844 -101 ct 1867 -127 1879 -168 1879 -224 ct 1879 -278 1867 -318 1843 -346 ct -1819 -373 1791 -387 1757 -387 ct 1724 -387 1696 -373 1673 -346 ct 1650 -319 l -1638 -280 l p ef -2066 0 m 2066 -605 l 2141 -605 l 2141 -388 l 2175 -428 2219 -448 2272 -448 ct -2304 -448 2333 -442 2357 -429 ct 2381 -416 2398 -398 2408 -376 ct 2418 -353 2424 -320 2424 -278 ct -2424 0 l 2349 0 l 2349 -278 l 2349 -315 2341 -342 2325 -359 ct 2309 -376 2286 -384 2257 -384 ct -2235 -384 2214 -378 2195 -367 ct 2175 -356 2161 -340 2153 -320 ct 2145 -301 2141 -274 2141 -240 ct -2141 0 l p ef -2705 -66 m 2715 0 l 2694 3 2676 5 2659 5 ct 2632 5 2611 1 2596 -7 ct 2582 -15 2571 -26 2565 -40 ct -2559 -54 2556 -83 2556 -128 ct 2556 -380 l 2501 -380 l 2501 -438 l 2556 -438 l -2556 -547 l 2630 -591 l 2630 -438 l 2705 -438 l 2705 -380 l 2630 -380 l -2630 -124 l 2630 -103 2631 -89 2634 -83 ct 2636 -77 2641 -72 2647 -68 ct 2652 -65 2661 -63 2672 -63 ct -2680 -63 l 2691 -64 l p ef -3081 -141 m 3157 -131 l 3145 -86 3123 -52 3090 -27 ct 3057 -2 3015 9 2965 9 ct -2900 9 2849 -9 2812 -49 ct 2774 -88 2755 -144 2755 -215 ct 2755 -289 2774 -346 2812 -387 ct -2851 -428 2900 -448 2960 -448 ct 3019 -448 3067 -428 3104 -388 ct 3141 -348 3160 -292 3160 -220 ct -3160 -215 3160 -209 3159 -200 ct 2832 -200 l 2835 -152 2849 -115 2873 -89 ct -2898 -64 2928 -51 2965 -51 ct 2992 -51 3015 -58 3035 -72 ct 3054 -87 l 3069 -109 l -p -2836 -261 m 3081 -261 l 3078 -298 3069 -326 3053 -344 ct 3030 -373 2999 -387 2961 -387 ct -2927 -387 2898 -376 2875 -353 ct 2852 -330 l 2839 -299 l p ef -3255 0 m 3255 -438 l 3322 -438 l 3322 -372 l 3339 -403 3355 -423 3370 -433 ct -3384 -443 3400 -448 3417 -448 ct 3442 -448 3468 -440 3494 -424 ct 3468 -355 l -3450 -366 3432 -371 3414 -371 ct 3397 -371 3383 -366 3370 -357 ct 3357 -347 3348 -333 3342 -316 ct -3334 -289 3330 -261 3330 -229 ct 3330 0 l p ef -3617 0 m 3548 0 l 3548 -605 l 3622 -605 l 3622 -389 l 3654 -428 3694 -448 3742 -448 ct -3769 -448 3795 -443 3819 -432 ct 3843 -421 3863 -406 3879 -386 ct 3894 -366 3906 -343 3915 -315 ct -3924 -287 3928 -257 3928 -225 ct 3928 -150 3910 -92 3873 -51 ct 3835 -10 3791 9 3739 9 ct -3687 9 3646 -11 3617 -54 ct p -3616 -222 m 3616 -170 3623 -132 3638 -108 ct 3661 -70 3693 -51 3733 -51 ct -3765 -51 3793 -65 3817 -93 ct 3840 -121 3852 -163 3852 -219 ct 3852 -277 3841 -319 3818 -346 ct -3796 -373 3768 -387 3736 -387 ct 3703 -387 3675 -373 3652 -345 ct 3628 -316 l -3616 -276 l p ef -3970 -219 m 3970 -300 3992 -360 4037 -399 ct 4075 -432 4121 -448 4175 -448 ct -4236 -448 4285 -428 4323 -389 ct 4361 -349 4381 -295 4381 -225 ct 4381 -169 4372 -124 4355 -92 ct -4338 -59 4314 -34 4281 -16 ct 4249 0 4214 9 4175 9 ct 4114 9 4064 -9 4026 -49 ct -3989 -88 l 3970 -145 l p -4046 -219 m 4046 -163 4058 -121 4083 -93 ct 4107 -65 4138 -51 4175 -51 ct 4212 -51 4243 -65 4267 -93 ct -4292 -121 4304 -164 4304 -221 ct 4304 -276 4292 -317 4267 -345 ct 4243 -373 4212 -387 4175 -387 ct -4138 -387 4107 -373 4083 -345 ct 4058 -317 l 4046 -275 l p ef -4761 -54 m 4733 -30 4707 -14 4681 -4 ct 4656 5 4628 9 4599 9 ct 4551 9 4514 -1 4488 -25 ct -4462 -48 4449 -79 4449 -115 ct 4449 -137 4454 -156 4464 -174 ct 4474 -192 4486 -206 4502 -217 ct -4518 -228 4536 -236 4556 -241 ct 4570 -245 4592 -249 4622 -252 ct 4682 -259 4726 -268 4754 -278 ct -4755 -288 4755 -295 4755 -297 ct 4755 -328 4748 -349 4734 -361 ct 4715 -378 4686 -387 4649 -387 ct -4614 -387 4588 -380 4572 -368 ct 4555 -356 4543 -334 4535 -303 ct 4462 -313 l -4468 -344 4479 -369 4495 -388 ct 4510 -408 4532 -422 4560 -433 ct 4589 -443 4622 -448 4660 -448 ct -4697 -448 4728 -444 4751 -435 ct 4774 -426 4792 -415 4803 -402 ct 4814 -388 4821 -371 4826 -351 ct -4828 -338 4830 -316 4830 -282 ct 4830 -183 l 4830 -114 4831 -70 4834 -52 ct -4837 -34 4844 -16 4853 0 ct 4775 0 l 4768 -15 l 4763 -33 l p -4754 -220 m 4727 -209 4687 -199 4633 -192 ct 4602 -187 4581 -182 4568 -177 ct -4555 -171 4546 -163 4539 -153 ct 4532 -142 4528 -130 4528 -117 ct 4528 -97 4536 -81 4551 -68 ct -4566 -54 4588 -48 4617 -48 ct 4645 -48 4671 -54 4693 -67 ct 4716 -79 4732 -96 4742 -118 ct -4750 -135 4754 -160 4754 -192 ct p ef -4922 0 m 4922 -438 l 4989 -438 l 4989 -372 l 5006 -403 5022 -423 5037 -433 ct -5051 -443 5067 -448 5084 -448 ct 5109 -448 5135 -440 5161 -424 ct 5135 -355 l -5117 -366 5099 -371 5081 -371 ct 5064 -371 5050 -366 5037 -357 ct 5024 -347 5015 -333 5009 -316 ct -5001 -289 4997 -261 4997 -229 ct 4997 0 l p ef -5499 0 m 5499 -55 l 5471 -11 5430 9 5376 9 ct 5341 9 5309 0 5280 -19 ct 5250 -38 5228 -65 5212 -99 ct -5195 -134 5187 -174 5187 -218 ct 5187 -262 5195 -302 5209 -338 ct 5224 -373 5246 -401 5275 -420 ct -5304 -439 5337 -448 5373 -448 ct 5399 -448 5423 -443 5444 -431 ct 5464 -420 5481 -406 5494 -388 ct -5494 -605 l 5568 -605 l 5568 0 l p -5264 -218 m 5264 -162 5276 -120 5299 -92 ct 5323 -65 5351 -51 5383 -51 ct 5416 -51 5443 -64 5466 -91 ct -5489 -117 5500 -158 5500 -212 ct 5500 -272 5489 -316 5465 -344 ct 5442 -373 5414 -387 5380 -387 ct -5347 -387 5319 -373 5297 -346 ct 5275 -319 l 5264 -277 l p ef -pom -gr -4245 18828 m 1070 18828 l 1070 13113 l 7420 13113 l 7420 18828 l 4245 18828 l -pc -gs -pum -2607 15795 t -219 0 m 219 -534 l 19 -534 l 19 -605 l 499 -605 l 499 -534 l 299 -534 l -299 0 l p ef -583 0 m 583 -438 l 650 -438 l 650 -372 l 667 -403 683 -423 698 -433 ct -712 -443 728 -448 745 -448 ct 770 -448 796 -440 822 -424 ct 796 -355 l 778 -366 760 -371 742 -371 ct -725 -371 711 -366 698 -357 ct 685 -347 676 -333 670 -316 ct 662 -289 658 -261 658 -229 ct -658 0 l p ef -1162 -54 m 1134 -30 1108 -14 1082 -4 ct 1057 5 1029 9 1000 9 ct 952 9 915 -1 889 -25 ct -863 -48 850 -79 850 -115 ct 850 -137 855 -156 865 -174 ct 875 -192 887 -206 903 -217 ct -919 -228 937 -236 957 -241 ct 971 -245 993 -249 1023 -252 ct 1083 -259 1127 -268 1155 -278 ct -1156 -288 1156 -295 1156 -297 ct 1156 -328 1149 -349 1135 -361 ct 1116 -378 1087 -387 1050 -387 ct -1015 -387 989 -380 973 -368 ct 956 -356 944 -334 936 -303 ct 863 -313 l 869 -344 880 -369 896 -388 ct -911 -408 933 -422 961 -433 ct 990 -443 1023 -448 1061 -448 ct 1098 -448 1129 -444 1152 -435 ct -1175 -426 1193 -415 1204 -402 ct 1215 -388 1222 -371 1227 -351 ct 1229 -338 1231 -316 1231 -282 ct -1231 -183 l 1231 -114 1232 -70 1235 -52 ct 1238 -34 1245 -16 1254 0 ct 1176 0 l -1169 -15 l 1164 -33 l p -1155 -220 m 1128 -209 1088 -199 1034 -192 ct 1003 -187 982 -182 969 -177 ct -956 -171 947 -163 940 -153 ct 933 -142 929 -130 929 -117 ct 929 -97 937 -81 952 -68 ct -967 -54 989 -48 1018 -48 ct 1046 -48 1072 -54 1094 -67 ct 1117 -79 1133 -96 1143 -118 ct -1151 -135 1155 -160 1155 -192 ct p ef -1325 0 m 1325 -438 l 1392 -438 l 1392 -376 l 1424 -424 1471 -448 1532 -448 ct -1558 -448 1583 -443 1605 -434 ct 1627 -424 1643 -412 1654 -396 ct 1666 -381 1673 -363 1678 -342 ct -1680 -328 1682 -304 1682 -269 ct 1682 0 l 1607 0 l 1607 -266 l 1607 -297 1605 -319 1599 -334 ct -1593 -349 1583 -361 1568 -370 ct 1553 -379 1536 -384 1516 -384 ct 1484 -384 1457 -374 1434 -354 ct -1411 -333 1400 -295 1400 -239 ct 1400 0 l p ef -1772 -130 m 1845 -142 l 1849 -113 1861 -90 1880 -74 ct 1898 -59 1925 -51 1959 -51 ct -1993 -51 2018 -58 2035 -72 ct 2051 -85 2059 -102 2059 -121 ct 2059 -137 2052 -151 2038 -160 ct -2027 -167 2002 -175 1962 -185 ct 1907 -199 1869 -211 1848 -221 ct 1827 -231 1811 -245 1800 -263 ct -1789 -281 1784 -300 1784 -322 ct 1784 -341 1788 -359 1797 -376 ct 1806 -393 1818 -407 1834 -418 ct -1845 -426 1861 -433 1881 -439 ct 1901 -445 1923 -448 1945 -448 ct 1980 -448 2010 -443 2036 -433 ct -2062 -423 2081 -410 2094 -393 ct 2106 -376 2115 -353 2119 -325 ct 2047 -315 l -2043 -338 2034 -355 2018 -368 ct 2002 -381 1980 -387 1951 -387 ct 1917 -387 1892 -381 1878 -370 ct -1863 -359 1856 -346 1856 -330 ct 1856 -321 1859 -312 1865 -304 ct 1871 -296 1880 -290 1893 -285 ct -1901 -282 1923 -275 1959 -266 ct 2012 -251 2048 -240 2069 -231 ct 2090 -222 2106 -209 2118 -192 ct -2130 -175 2136 -154 2136 -128 ct 2136 -104 2129 -80 2114 -58 ct 2100 -36 2079 -20 2052 -8 ct -2024 3 1993 9 1959 9 ct 1902 9 1859 -1 1829 -25 ct 1799 -49 l 1780 -84 l p ef -2198 0 m 2198 -438 l 2265 -438 l 2265 -377 l 2279 -398 2297 -415 2320 -428 ct -2343 -442 2369 -448 2398 -448 ct 2430 -448 2457 -441 2478 -428 ct 2499 -414 2513 -396 2522 -371 ct -2556 -423 2602 -448 2657 -448 ct 2701 -448 2734 -436 2758 -412 ct 2781 -388 2793 -351 2793 -301 ct -2793 0 l 2719 0 l 2719 -276 l 2719 -306 2716 -327 2712 -340 ct 2707 -353 2698 -364 2685 -372 ct -2673 -380 2658 -384 2641 -384 ct 2610 -384 2584 -373 2564 -353 ct 2543 -332 2533 -300 2533 -254 ct -2533 0 l 2459 0 l 2459 -285 l 2459 -318 2453 -342 2441 -359 ct 2429 -375 2409 -384 2381 -384 ct -2360 -384 2341 -378 2323 -367 ct 2305 -356 2293 -340 2285 -319 ct 2277 -298 2273 -267 2273 -227 ct -2273 0 l p ef -2914 -520 m 2914 -605 l 2988 -605 l 2988 -520 l p -2914 0 m 2914 -438 l 2988 -438 l 2988 0 l p ef -3261 -66 m 3271 0 l 3250 3 3232 5 3215 5 ct 3188 5 3167 1 3152 -7 ct 3138 -15 3127 -26 3121 -40 ct -3115 -54 3112 -83 3112 -128 ct 3112 -380 l 3057 -380 l 3057 -438 l 3112 -438 l -3112 -547 l 3186 -591 l 3186 -438 l 3261 -438 l 3261 -380 l 3186 -380 l -3186 -124 l 3186 -103 3187 -89 3190 -83 ct 3192 -77 3197 -72 3203 -68 ct 3208 -65 3217 -63 3228 -63 ct -3236 -63 l 3247 -64 l p ef -pom -pum -1429 16748 t -65 0 m 65 -605 l 273 -605 l 320 -605 356 -602 381 -596 ct 416 -588 445 -574 470 -553 ct -502 -526 526 -492 542 -450 ct 558 -408 565 -360 565 -306 ct 565 -260 560 -219 549 -183 ct -539 -148 525 -118 508 -95 ct 491 -72 473 -54 453 -40 ct 433 -27 409 -17 381 -10 ct -352 -3 320 0 283 0 ct p -145 -71 m 274 -71 l 314 -71 345 -75 368 -82 ct 391 -90 409 -100 423 -114 ct -442 -133 456 -158 467 -190 ct 478 -222 483 -261 483 -307 ct 483 -370 472 -419 452 -453 ct -431 -487 406 -510 376 -521 ct 354 -530 320 -534 272 -534 ct 145 -534 l p ef -951 -54 m 923 -30 897 -14 871 -4 ct 846 5 818 9 789 9 ct 741 9 704 -1 678 -25 ct -652 -48 639 -79 639 -115 ct 639 -137 644 -156 654 -174 ct 664 -192 676 -206 692 -217 ct -708 -228 726 -236 746 -241 ct 760 -245 782 -249 812 -252 ct 872 -259 916 -268 944 -278 ct -945 -288 945 -295 945 -297 ct 945 -328 938 -349 924 -361 ct 905 -378 876 -387 839 -387 ct -804 -387 778 -380 762 -368 ct 745 -356 733 -334 725 -303 ct 652 -313 l 658 -344 669 -369 685 -388 ct -700 -408 722 -422 750 -433 ct 779 -443 812 -448 850 -448 ct 887 -448 918 -444 941 -435 ct -964 -426 982 -415 993 -402 ct 1004 -388 1011 -371 1016 -351 ct 1018 -338 1020 -316 1020 -282 ct -1020 -183 l 1020 -114 1021 -70 1024 -52 ct 1027 -34 1034 -16 1043 0 ct 965 0 l -958 -15 l 953 -33 l p -944 -220 m 917 -209 877 -199 823 -192 ct 792 -187 771 -182 758 -177 ct 745 -171 736 -163 729 -153 ct -722 -142 718 -130 718 -117 ct 718 -97 726 -81 741 -68 ct 756 -54 778 -48 807 -48 ct -835 -48 861 -54 883 -67 ct 906 -79 922 -96 932 -118 ct 940 -135 944 -160 944 -192 ct -p ef -1401 0 m 1401 -64 l 1367 -14 1320 9 1262 9 ct 1236 9 1212 4 1189 -4 ct 1167 -14 1150 -27 1139 -42 ct -1128 -57 1121 -75 1116 -97 ct 1113 -112 1112 -135 1112 -166 ct 1112 -438 l 1186 -438 l -1186 -195 l 1186 -156 1187 -130 1191 -116 ct 1195 -97 1205 -82 1220 -70 ct -1235 -59 1254 -54 1276 -54 ct 1299 -54 1320 -59 1339 -71 ct 1359 -82 1373 -98 1381 -117 ct -1389 -137 1393 -166 1393 -203 ct 1393 -438 l 1467 -438 l 1467 0 l p ef -1577 36 m 1649 47 l 1652 69 1660 85 1674 95 ct 1693 109 1718 116 1750 116 ct -1784 116 1811 109 1829 95 ct 1848 82 1861 62 1867 38 ct 1871 22 1873 -8 1873 -57 ct -1840 -19 1800 0 1751 0 ct 1691 0 1644 -21 1611 -65 ct 1578 -108 1562 -160 1562 -221 ct -1562 -263 1569 -302 1584 -337 ct 1600 -373 1622 -400 1650 -419 ct 1679 -438 1713 -448 1752 -448 ct -1804 -448 1846 -427 1880 -385 ct 1880 -438 l 1948 -438 l 1948 -59 l 1948 8 1941 57 1928 85 ct -1914 114 1892 136 1861 153 ct 1831 169 1794 178 1750 178 ct 1698 178 1656 166 1623 142 ct -1591 119 l 1576 83 l p -1638 -227 m 1638 -169 1650 -127 1672 -101 ct 1695 -74 1724 -61 1758 -61 ct -1793 -61 1821 -74 1844 -101 ct 1867 -127 1879 -168 1879 -224 ct 1879 -278 1867 -318 1843 -346 ct -1819 -373 1791 -387 1757 -387 ct 1724 -387 1696 -373 1673 -346 ct 1650 -319 l -1638 -280 l p ef -2066 0 m 2066 -605 l 2141 -605 l 2141 -388 l 2175 -428 2219 -448 2272 -448 ct -2304 -448 2333 -442 2357 -429 ct 2381 -416 2398 -398 2408 -376 ct 2418 -353 2424 -320 2424 -278 ct -2424 0 l 2349 0 l 2349 -278 l 2349 -315 2341 -342 2325 -359 ct 2309 -376 2286 -384 2257 -384 ct -2235 -384 2214 -378 2195 -367 ct 2175 -356 2161 -340 2153 -320 ct 2145 -301 2141 -274 2141 -240 ct -2141 0 l p ef -2705 -66 m 2715 0 l 2694 3 2676 5 2659 5 ct 2632 5 2611 1 2596 -7 ct 2582 -15 2571 -26 2565 -40 ct -2559 -54 2556 -83 2556 -128 ct 2556 -380 l 2501 -380 l 2501 -438 l 2556 -438 l -2556 -547 l 2630 -591 l 2630 -438 l 2705 -438 l 2705 -380 l 2630 -380 l -2630 -124 l 2630 -103 2631 -89 2634 -83 ct 2636 -77 2641 -72 2647 -68 ct 2652 -65 2661 -63 2672 -63 ct -2680 -63 l 2691 -64 l p ef -3081 -141 m 3157 -131 l 3145 -86 3123 -52 3090 -27 ct 3057 -2 3015 9 2965 9 ct -2900 9 2849 -9 2812 -49 ct 2774 -88 2755 -144 2755 -215 ct 2755 -289 2774 -346 2812 -387 ct -2851 -428 2900 -448 2960 -448 ct 3019 -448 3067 -428 3104 -388 ct 3141 -348 3160 -292 3160 -220 ct -3160 -215 3160 -209 3159 -200 ct 2832 -200 l 2835 -152 2849 -115 2873 -89 ct -2898 -64 2928 -51 2965 -51 ct 2992 -51 3015 -58 3035 -72 ct 3054 -87 l 3069 -109 l -p -2836 -261 m 3081 -261 l 3078 -298 3069 -326 3053 -344 ct 3030 -373 2999 -387 2961 -387 ct -2927 -387 2898 -376 2875 -353 ct 2852 -330 l 2839 -299 l p ef -3255 0 m 3255 -438 l 3322 -438 l 3322 -372 l 3339 -403 3355 -423 3370 -433 ct -3384 -443 3400 -448 3417 -448 ct 3442 -448 3468 -440 3494 -424 ct 3468 -355 l -3450 -366 3432 -371 3414 -371 ct 3397 -371 3383 -366 3370 -357 ct 3357 -347 3348 -333 3342 -316 ct -3334 -289 3330 -261 3330 -229 ct 3330 0 l p ef -3617 0 m 3548 0 l 3548 -605 l 3622 -605 l 3622 -389 l 3654 -428 3694 -448 3742 -448 ct -3769 -448 3795 -443 3819 -432 ct 3843 -421 3863 -406 3879 -386 ct 3894 -366 3906 -343 3915 -315 ct -3924 -287 3928 -257 3928 -225 ct 3928 -150 3910 -92 3873 -51 ct 3835 -10 3791 9 3739 9 ct -3687 9 3646 -11 3617 -54 ct p -3616 -222 m 3616 -170 3623 -132 3638 -108 ct 3661 -70 3693 -51 3733 -51 ct -3765 -51 3793 -65 3817 -93 ct 3840 -121 3852 -163 3852 -219 ct 3852 -277 3841 -319 3818 -346 ct -3796 -373 3768 -387 3736 -387 ct 3703 -387 3675 -373 3652 -345 ct 3628 -316 l -3616 -276 l p ef -3970 -219 m 3970 -300 3992 -360 4037 -399 ct 4075 -432 4121 -448 4175 -448 ct -4236 -448 4285 -428 4323 -389 ct 4361 -349 4381 -295 4381 -225 ct 4381 -169 4372 -124 4355 -92 ct -4338 -59 4314 -34 4281 -16 ct 4249 0 4214 9 4175 9 ct 4114 9 4064 -9 4026 -49 ct -3989 -88 l 3970 -145 l p -4046 -219 m 4046 -163 4058 -121 4083 -93 ct 4107 -65 4138 -51 4175 -51 ct 4212 -51 4243 -65 4267 -93 ct -4292 -121 4304 -164 4304 -221 ct 4304 -276 4292 -317 4267 -345 ct 4243 -373 4212 -387 4175 -387 ct -4138 -387 4107 -373 4083 -345 ct 4058 -317 l 4046 -275 l p ef -4761 -54 m 4733 -30 4707 -14 4681 -4 ct 4656 5 4628 9 4599 9 ct 4551 9 4514 -1 4488 -25 ct -4462 -48 4449 -79 4449 -115 ct 4449 -137 4454 -156 4464 -174 ct 4474 -192 4486 -206 4502 -217 ct -4518 -228 4536 -236 4556 -241 ct 4570 -245 4592 -249 4622 -252 ct 4682 -259 4726 -268 4754 -278 ct -4755 -288 4755 -295 4755 -297 ct 4755 -328 4748 -349 4734 -361 ct 4715 -378 4686 -387 4649 -387 ct -4614 -387 4588 -380 4572 -368 ct 4555 -356 4543 -334 4535 -303 ct 4462 -313 l -4468 -344 4479 -369 4495 -388 ct 4510 -408 4532 -422 4560 -433 ct 4589 -443 4622 -448 4660 -448 ct -4697 -448 4728 -444 4751 -435 ct 4774 -426 4792 -415 4803 -402 ct 4814 -388 4821 -371 4826 -351 ct -4828 -338 4830 -316 4830 -282 ct 4830 -183 l 4830 -114 4831 -70 4834 -52 ct -4837 -34 4844 -16 4853 0 ct 4775 0 l 4768 -15 l 4763 -33 l p -4754 -220 m 4727 -209 4687 -199 4633 -192 ct 4602 -187 4581 -182 4568 -177 ct -4555 -171 4546 -163 4539 -153 ct 4532 -142 4528 -130 4528 -117 ct 4528 -97 4536 -81 4551 -68 ct -4566 -54 4588 -48 4617 -48 ct 4645 -48 4671 -54 4693 -67 ct 4716 -79 4732 -96 4742 -118 ct -4750 -135 4754 -160 4754 -192 ct p ef -4922 0 m 4922 -438 l 4989 -438 l 4989 -372 l 5006 -403 5022 -423 5037 -433 ct -5051 -443 5067 -448 5084 -448 ct 5109 -448 5135 -440 5161 -424 ct 5135 -355 l -5117 -366 5099 -371 5081 -371 ct 5064 -371 5050 -366 5037 -357 ct 5024 -347 5015 -333 5009 -316 ct -5001 -289 4997 -261 4997 -229 ct 4997 0 l p ef -5499 0 m 5499 -55 l 5471 -11 5430 9 5376 9 ct 5341 9 5309 0 5280 -19 ct 5250 -38 5228 -65 5212 -99 ct -5195 -134 5187 -174 5187 -218 ct 5187 -262 5195 -302 5209 -338 ct 5224 -373 5246 -401 5275 -420 ct -5304 -439 5337 -448 5373 -448 ct 5399 -448 5423 -443 5444 -431 ct 5464 -420 5481 -406 5494 -388 ct -5494 -605 l 5568 -605 l 5568 0 l p -5264 -218 m 5264 -162 5276 -120 5299 -92 ct 5323 -65 5351 -51 5383 -51 ct 5416 -51 5443 -64 5466 -91 ct -5489 -117 5500 -158 5500 -212 ct 5500 -272 5489 -316 5465 -344 ct 5442 -373 5414 -387 5380 -387 ct -5347 -387 5319 -373 5297 -346 ct 5275 -319 l 5264 -277 l p ef -pom -gr -4245 12065 m 1070 12065 l 1070 6350 l 7420 6350 l 7420 12065 l 4245 12065 l -pc -gs -pum -2713 9022 t -66 0 m 66 -605 l 335 -605 l 389 -605 430 -600 458 -589 ct 486 -578 508 -559 525 -531 ct -542 -504 550 -473 550 -440 ct 550 -397 536 -361 508 -331 ct 481 -302 438 -283 380 -275 ct -401 -265 417 -255 428 -245 ct 451 -223 473 -197 494 -164 ct 600 0 l 499 0 l -419 -125 l 395 -162 376 -190 361 -209 ct 346 -228 332 -242 320 -249 ct 308 -257 296 -263 284 -266 ct -275 -267 260 -268 239 -268 ct 146 -268 l 146 0 l p -146 -338 m 318 -338 l 355 -338 384 -342 404 -349 ct 425 -357 441 -369 451 -386 ct -462 -402 468 -420 468 -440 ct 468 -468 457 -492 436 -510 ct 416 -529 383 -538 338 -538 ct -146 -538 l p ef -965 -141 m 1041 -131 l 1029 -86 1007 -52 974 -27 ct 941 -2 899 9 849 9 ct -784 9 733 -9 696 -49 ct 658 -88 639 -144 639 -215 ct 639 -289 658 -346 696 -387 ct -735 -428 784 -448 844 -448 ct 903 -448 951 -428 988 -388 ct 1025 -348 1044 -292 1044 -220 ct -1044 -215 1044 -209 1043 -200 ct 716 -200 l 719 -152 733 -115 757 -89 ct 782 -64 812 -51 849 -51 ct -876 -51 899 -58 919 -72 ct 938 -87 l 953 -109 l p -720 -261 m 965 -261 l 962 -298 953 -326 937 -344 ct 914 -373 883 -387 845 -387 ct -811 -387 782 -376 759 -353 ct 736 -330 l 723 -299 l p ef -1427 -160 m 1500 -151 l 1492 -100 1471 -61 1438 -32 ct 1405 -4 1365 9 1317 9 ct -1257 9 1209 -9 1172 -48 ct 1136 -88 1118 -144 1118 -217 ct 1118 -265 1125 -306 1141 -342 ct -1157 -377 1181 -404 1213 -421 ct 1245 -439 1280 -448 1317 -448 ct 1365 -448 1404 -436 1434 -412 ct -1465 -388 1484 -354 1493 -309 ct 1420 -298 l 1413 -328 1401 -350 1384 -365 ct -1366 -380 1345 -387 1320 -387 ct 1283 -387 1252 -374 1229 -347 ct 1206 -320 1194 -277 1194 -219 ct -1194 -160 1205 -118 1228 -91 ct 1250 -64 1280 -51 1316 -51 ct 1345 -51 1370 -60 1389 -78 ct -1409 -95 l 1421 -123 l p ef -1864 -141 m 1940 -131 l 1928 -86 1906 -52 1873 -27 ct 1840 -2 1798 9 1748 9 ct -1683 9 1632 -9 1595 -49 ct 1557 -88 1538 -144 1538 -215 ct 1538 -289 1557 -346 1595 -387 ct -1634 -428 1683 -448 1743 -448 ct 1802 -448 1850 -428 1887 -388 ct 1924 -348 1943 -292 1943 -220 ct -1943 -215 1943 -209 1942 -200 ct 1615 -200 l 1618 -152 1632 -115 1656 -89 ct -1681 -64 1711 -51 1748 -51 ct 1775 -51 1798 -58 1818 -72 ct 1837 -87 l 1852 -109 l -p -1619 -261 m 1864 -261 l 1861 -298 1852 -326 1836 -344 ct 1813 -373 1782 -387 1744 -387 ct -1710 -387 1681 -376 1658 -353 ct 1635 -330 l 1622 -299 l p ef -2040 -520 m 2040 -605 l 2114 -605 l 2114 -520 l p -2040 0 m 2040 -438 l 2114 -438 l 2114 0 l p ef -2347 0 m 2180 -438 l 2259 -438 l 2353 -175 l 2363 -147 2372 -118 2381 -87 ct -2388 -110 2397 -138 2409 -171 ct 2506 -438 l 2583 -438 l 2417 0 l p ef -2949 -141 m 3025 -131 l 3013 -86 2991 -52 2958 -27 ct 2925 -2 2883 9 2833 9 ct -2768 9 2717 -9 2680 -49 ct 2642 -88 2623 -144 2623 -215 ct 2623 -289 2642 -346 2680 -387 ct -2719 -428 2768 -448 2828 -448 ct 2887 -448 2935 -428 2972 -388 ct 3009 -348 3028 -292 3028 -220 ct -3028 -215 3028 -209 3027 -200 ct 2700 -200 l 2703 -152 2717 -115 2741 -89 ct -2766 -64 2796 -51 2833 -51 ct 2860 -51 2883 -58 2903 -72 ct 2922 -87 l 2937 -109 l -p -2704 -261 m 2949 -261 l 2946 -298 2937 -326 2921 -344 ct 2898 -373 2867 -387 2829 -387 ct -2795 -387 2766 -376 2743 -353 ct 2720 -330 l 2707 -299 l p ef -pom -pum -1429 9975 t -65 0 m 65 -605 l 273 -605 l 320 -605 356 -602 381 -596 ct 416 -588 445 -574 470 -553 ct -502 -526 526 -492 542 -450 ct 558 -408 565 -360 565 -306 ct 565 -260 560 -219 549 -183 ct -539 -148 525 -118 508 -95 ct 491 -72 473 -54 453 -40 ct 433 -27 409 -17 381 -10 ct -352 -3 320 0 283 0 ct p -145 -71 m 274 -71 l 314 -71 345 -75 368 -82 ct 391 -90 409 -100 423 -114 ct -442 -133 456 -158 467 -190 ct 478 -222 483 -261 483 -307 ct 483 -370 472 -419 452 -453 ct -431 -487 406 -510 376 -521 ct 354 -530 320 -534 272 -534 ct 145 -534 l p ef -951 -54 m 923 -30 897 -14 871 -4 ct 846 5 818 9 789 9 ct 741 9 704 -1 678 -25 ct -652 -48 639 -79 639 -115 ct 639 -137 644 -156 654 -174 ct 664 -192 676 -206 692 -217 ct -708 -228 726 -236 746 -241 ct 760 -245 782 -249 812 -252 ct 872 -259 916 -268 944 -278 ct -945 -288 945 -295 945 -297 ct 945 -328 938 -349 924 -361 ct 905 -378 876 -387 839 -387 ct -804 -387 778 -380 762 -368 ct 745 -356 733 -334 725 -303 ct 652 -313 l 658 -344 669 -369 685 -388 ct -700 -408 722 -422 750 -433 ct 779 -443 812 -448 850 -448 ct 887 -448 918 -444 941 -435 ct -964 -426 982 -415 993 -402 ct 1004 -388 1011 -371 1016 -351 ct 1018 -338 1020 -316 1020 -282 ct -1020 -183 l 1020 -114 1021 -70 1024 -52 ct 1027 -34 1034 -16 1043 0 ct 965 0 l -958 -15 l 953 -33 l p -944 -220 m 917 -209 877 -199 823 -192 ct 792 -187 771 -182 758 -177 ct 745 -171 736 -163 729 -153 ct -722 -142 718 -130 718 -117 ct 718 -97 726 -81 741 -68 ct 756 -54 778 -48 807 -48 ct -835 -48 861 -54 883 -67 ct 906 -79 922 -96 932 -118 ct 940 -135 944 -160 944 -192 ct -p ef -1401 0 m 1401 -64 l 1367 -14 1320 9 1262 9 ct 1236 9 1212 4 1189 -4 ct 1167 -14 1150 -27 1139 -42 ct -1128 -57 1121 -75 1116 -97 ct 1113 -112 1112 -135 1112 -166 ct 1112 -438 l 1186 -438 l -1186 -195 l 1186 -156 1187 -130 1191 -116 ct 1195 -97 1205 -82 1220 -70 ct -1235 -59 1254 -54 1276 -54 ct 1299 -54 1320 -59 1339 -71 ct 1359 -82 1373 -98 1381 -117 ct -1389 -137 1393 -166 1393 -203 ct 1393 -438 l 1467 -438 l 1467 0 l p ef -1577 36 m 1649 47 l 1652 69 1660 85 1674 95 ct 1693 109 1718 116 1750 116 ct -1784 116 1811 109 1829 95 ct 1848 82 1861 62 1867 38 ct 1871 22 1873 -8 1873 -57 ct -1840 -19 1800 0 1751 0 ct 1691 0 1644 -21 1611 -65 ct 1578 -108 1562 -160 1562 -221 ct -1562 -263 1569 -302 1584 -337 ct 1600 -373 1622 -400 1650 -419 ct 1679 -438 1713 -448 1752 -448 ct -1804 -448 1846 -427 1880 -385 ct 1880 -438 l 1948 -438 l 1948 -59 l 1948 8 1941 57 1928 85 ct -1914 114 1892 136 1861 153 ct 1831 169 1794 178 1750 178 ct 1698 178 1656 166 1623 142 ct -1591 119 l 1576 83 l p -1638 -227 m 1638 -169 1650 -127 1672 -101 ct 1695 -74 1724 -61 1758 -61 ct -1793 -61 1821 -74 1844 -101 ct 1867 -127 1879 -168 1879 -224 ct 1879 -278 1867 -318 1843 -346 ct -1819 -373 1791 -387 1757 -387 ct 1724 -387 1696 -373 1673 -346 ct 1650 -319 l -1638 -280 l p ef -2066 0 m 2066 -605 l 2141 -605 l 2141 -388 l 2175 -428 2219 -448 2272 -448 ct -2304 -448 2333 -442 2357 -429 ct 2381 -416 2398 -398 2408 -376 ct 2418 -353 2424 -320 2424 -278 ct -2424 0 l 2349 0 l 2349 -278 l 2349 -315 2341 -342 2325 -359 ct 2309 -376 2286 -384 2257 -384 ct -2235 -384 2214 -378 2195 -367 ct 2175 -356 2161 -340 2153 -320 ct 2145 -301 2141 -274 2141 -240 ct -2141 0 l p ef -2705 -66 m 2715 0 l 2694 3 2676 5 2659 5 ct 2632 5 2611 1 2596 -7 ct 2582 -15 2571 -26 2565 -40 ct -2559 -54 2556 -83 2556 -128 ct 2556 -380 l 2501 -380 l 2501 -438 l 2556 -438 l -2556 -547 l 2630 -591 l 2630 -438 l 2705 -438 l 2705 -380 l 2630 -380 l -2630 -124 l 2630 -103 2631 -89 2634 -83 ct 2636 -77 2641 -72 2647 -68 ct 2652 -65 2661 -63 2672 -63 ct -2680 -63 l 2691 -64 l p ef -3081 -141 m 3157 -131 l 3145 -86 3123 -52 3090 -27 ct 3057 -2 3015 9 2965 9 ct -2900 9 2849 -9 2812 -49 ct 2774 -88 2755 -144 2755 -215 ct 2755 -289 2774 -346 2812 -387 ct -2851 -428 2900 -448 2960 -448 ct 3019 -448 3067 -428 3104 -388 ct 3141 -348 3160 -292 3160 -220 ct -3160 -215 3160 -209 3159 -200 ct 2832 -200 l 2835 -152 2849 -115 2873 -89 ct -2898 -64 2928 -51 2965 -51 ct 2992 -51 3015 -58 3035 -72 ct 3054 -87 l 3069 -109 l -p -2836 -261 m 3081 -261 l 3078 -298 3069 -326 3053 -344 ct 3030 -373 2999 -387 2961 -387 ct -2927 -387 2898 -376 2875 -353 ct 2852 -330 l 2839 -299 l p ef -3255 0 m 3255 -438 l 3322 -438 l 3322 -372 l 3339 -403 3355 -423 3370 -433 ct -3384 -443 3400 -448 3417 -448 ct 3442 -448 3468 -440 3494 -424 ct 3468 -355 l -3450 -366 3432 -371 3414 -371 ct 3397 -371 3383 -366 3370 -357 ct 3357 -347 3348 -333 3342 -316 ct -3334 -289 3330 -261 3330 -229 ct 3330 0 l p ef -3617 0 m 3548 0 l 3548 -605 l 3622 -605 l 3622 -389 l 3654 -428 3694 -448 3742 -448 ct -3769 -448 3795 -443 3819 -432 ct 3843 -421 3863 -406 3879 -386 ct 3894 -366 3906 -343 3915 -315 ct -3924 -287 3928 -257 3928 -225 ct 3928 -150 3910 -92 3873 -51 ct 3835 -10 3791 9 3739 9 ct -3687 9 3646 -11 3617 -54 ct p -3616 -222 m 3616 -170 3623 -132 3638 -108 ct 3661 -70 3693 -51 3733 -51 ct -3765 -51 3793 -65 3817 -93 ct 3840 -121 3852 -163 3852 -219 ct 3852 -277 3841 -319 3818 -346 ct -3796 -373 3768 -387 3736 -387 ct 3703 -387 3675 -373 3652 -345 ct 3628 -316 l -3616 -276 l p ef -3970 -219 m 3970 -300 3992 -360 4037 -399 ct 4075 -432 4121 -448 4175 -448 ct -4236 -448 4285 -428 4323 -389 ct 4361 -349 4381 -295 4381 -225 ct 4381 -169 4372 -124 4355 -92 ct -4338 -59 4314 -34 4281 -16 ct 4249 0 4214 9 4175 9 ct 4114 9 4064 -9 4026 -49 ct -3989 -88 l 3970 -145 l p -4046 -219 m 4046 -163 4058 -121 4083 -93 ct 4107 -65 4138 -51 4175 -51 ct 4212 -51 4243 -65 4267 -93 ct -4292 -121 4304 -164 4304 -221 ct 4304 -276 4292 -317 4267 -345 ct 4243 -373 4212 -387 4175 -387 ct -4138 -387 4107 -373 4083 -345 ct 4058 -317 l 4046 -275 l p ef -4761 -54 m 4733 -30 4707 -14 4681 -4 ct 4656 5 4628 9 4599 9 ct 4551 9 4514 -1 4488 -25 ct -4462 -48 4449 -79 4449 -115 ct 4449 -137 4454 -156 4464 -174 ct 4474 -192 4486 -206 4502 -217 ct -4518 -228 4536 -236 4556 -241 ct 4570 -245 4592 -249 4622 -252 ct 4682 -259 4726 -268 4754 -278 ct -4755 -288 4755 -295 4755 -297 ct 4755 -328 4748 -349 4734 -361 ct 4715 -378 4686 -387 4649 -387 ct -4614 -387 4588 -380 4572 -368 ct 4555 -356 4543 -334 4535 -303 ct 4462 -313 l -4468 -344 4479 -369 4495 -388 ct 4510 -408 4532 -422 4560 -433 ct 4589 -443 4622 -448 4660 -448 ct -4697 -448 4728 -444 4751 -435 ct 4774 -426 4792 -415 4803 -402 ct 4814 -388 4821 -371 4826 -351 ct -4828 -338 4830 -316 4830 -282 ct 4830 -183 l 4830 -114 4831 -70 4834 -52 ct -4837 -34 4844 -16 4853 0 ct 4775 0 l 4768 -15 l 4763 -33 l p -4754 -220 m 4727 -209 4687 -199 4633 -192 ct 4602 -187 4581 -182 4568 -177 ct -4555 -171 4546 -163 4539 -153 ct 4532 -142 4528 -130 4528 -117 ct 4528 -97 4536 -81 4551 -68 ct -4566 -54 4588 -48 4617 -48 ct 4645 -48 4671 -54 4693 -67 ct 4716 -79 4732 -96 4742 -118 ct -4750 -135 4754 -160 4754 -192 ct p ef -4922 0 m 4922 -438 l 4989 -438 l 4989 -372 l 5006 -403 5022 -423 5037 -433 ct -5051 -443 5067 -448 5084 -448 ct 5109 -448 5135 -440 5161 -424 ct 5135 -355 l -5117 -366 5099 -371 5081 -371 ct 5064 -371 5050 -366 5037 -357 ct 5024 -347 5015 -333 5009 -316 ct -5001 -289 4997 -261 4997 -229 ct 4997 0 l p ef -5499 0 m 5499 -55 l 5471 -11 5430 9 5376 9 ct 5341 9 5309 0 5280 -19 ct 5250 -38 5228 -65 5212 -99 ct -5195 -134 5187 -174 5187 -218 ct 5187 -262 5195 -302 5209 -338 ct 5224 -373 5246 -401 5275 -420 ct -5304 -439 5337 -448 5373 -448 ct 5399 -448 5423 -443 5444 -431 ct 5464 -420 5481 -406 5494 -388 ct -5494 -605 l 5568 -605 l 5568 0 l p -5264 -218 m 5264 -162 5276 -120 5299 -92 ct 5323 -65 5351 -51 5383 -51 ct 5416 -51 5443 -64 5466 -91 ct -5489 -117 5500 -158 5500 -212 ct 5500 -272 5489 -316 5465 -344 ct 5442 -373 5414 -387 5380 -387 ct -5347 -387 5319 -373 5297 -346 ct 5275 -319 l 5264 -277 l p ef -pom -gr -51 lw 13970 5080 m 13970 6350 l ps -11010 7920 m 11900 7920 l ps -11010 10460 m 11900 10460 l ps -11010 14605 m 11900 14605 l ps -11010 17245 m 11900 17245 l ps -7835 7955 m 7420 7955 l ps -7835 10460 m 7420 10460 l ps -7835 14605 m 7420 14605 l ps -7835 17245 m 7420 17245 l ps -16013 7955 m 16809 7955 l ps -19984 7920 m 20592 7920 l ps -19984 10460 m 20592 10460 l ps -16013 10495 m 16809 10495 l ps -16013 14605 m 16809 14605 l ps -16013 17245 m 16809 17245 l ps -19984 14605 m 20592 14605 l ps -19984 17245 m 20592 17245 l ps -gr -0 20290 t -pom -count op_count sub {pop} repeat countdictstack dict_count sub {end} repeat b4_inc_state restore -%%PageTrailer -%%Trailer -%%EOF diff --git a/usrp/doc/usrp-block-diagram.png b/usrp/doc/usrp-block-diagram.png Binary files differdeleted file mode 100644 index 55a0f0b38..000000000 --- a/usrp/doc/usrp-block-diagram.png +++ /dev/null diff --git a/usrp/doc/usrp.jpg b/usrp/doc/usrp.jpg Binary files differdeleted file mode 100644 index 0ddb59275..000000000 --- a/usrp/doc/usrp.jpg +++ /dev/null diff --git a/usrp/doc/usrp_guide.xml b/usrp/doc/usrp_guide.xml deleted file mode 100644 index 7c4d5d5e8..000000000 --- a/usrp/doc/usrp_guide.xml +++ /dev/null @@ -1,399 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" - "docbookx.dtd" [ -]> - -<article> - <articleinfo> - <title>USRP User's and Developer's Guide</title> - <author> - <firstname>Matt</firstname> - <surname>Ettus</surname> - <affiliation> - <orgname>Ettus Research LLC</orgname> - <address> - Ettus Research LLC - <street>604 Mariposa Ave</street> - <city>Mountain View</city>, <state>CA</state> <postcode>94041</postcode> - <country>USA</country> - <email>matt@ettus.com</email> - </address> - </affiliation> - </author> - - <abstract> - <para> - This guide explains both basic usage of the USRP as well as how to expand it. - </para> - </abstract> - - </articleinfo> - - <sect1 id="intro"> - <title>Introduction</title> - <para> - The Universal Software Radio Peripheral, or USRP (pronounced "usurp") - is designed to allow general purpose computers to function as high - bandwidth software radios. In essence, it serves as a digital - baseband and IF section of a radio communication system. In addition, - it has a well-defined electrical and mechanical interface to RF - front-ends (daughterboards) which can translate between that IF or - baseband and the RF bands of interest - </para> - <para> - The basic design philosophy behind the USRP has been to do all of the - waveform-specific processing, like modulation and demodulation, on the - host CPU. All of the high-speed general purpose operations like - digital up- and downconversion, decimation and interpolation are done - on the FPGA. - </para> - <para> - It is anticipated that the majority of USRP users will never need to - use anything other than the standard FPGA configuration. However, for - those users that wish to, the FPGA design may be changed or replaced. - All of the interfaces are well defined and documented. - </para> - <figure id="usrp-board"> - <title>USRP with Daughterboards</title> - <mediaobject> - <imageobject><imagedata fileref="usrp.jpg" format="JPG"/></imageobject> - <caption><para> - This USRP has 2 BasicTX and 2 BasicRX boards mounted on it. - Notice that the boards on the left are rotated 180 degrees. - </para></caption> - </mediaobject> - </figure> - - <sect2 id="requirements"> - <title>System Requirements</title> - <para> - The USRP requires a PC or Mac with a USB2 interface. - </para> - </sect2> - - <sect2 id="capabilities"> - <title>Capabilities</title> - <para> - The USRP has 4 high-speed analog to digital converters (ADCs), each at - 12 bits per sample, 64 million samples per second. There are also - 4 high-speed digital to analog converters (DACs), each at 14 bits per - sample, 128 million samples per second. These 4 input and 4 output - channels are connected to an Altera Cyclone EP1C12 FPGA. The FPGA, in - turn, connects to a USB2 interface chip, the Cypress FX2, and on to the - computer. The USRP connects to the computer via a high speed USB2 - interface only, and will not work with USB1.1. - </para> - <figure id="usrp-block-diagram-fig"><title>Universal Software Radio Peripheral</title> - <mediaobject> - <imageobject><imagedata fileref="usrp-block-diagram.eps" format="EPS"/></imageobject> - <imageobject><imagedata fileref="usrp-block-diagram.png" format="PNG"/></imageobject> - <caption><para></para></caption> - </mediaobject> - </figure> - </sect2> - </sect1> - <sect1 id="getting-started"> - <title>Getting Started</title> - <sect2 id="the-code"> - <title>Getting all the Software</title> - <para> - The first step in using your USRP system is to get all of GNU Radio installed. This can - sometimes be a daunting process, as there are several other libraries which will need to be - installed first. - </para> - <sect3 id="dependencies"> - <title>Library Dependencies</title> - <itemizedlist> - <listitem> - <para>SWIG</para> - <para> - We use SWIG (Simple Wrapper Interface Generator) to tie together the C++ and Python code - in the GNU Radio system. We require that you have version 1.3.24 or newer. You'll - probably have to compile it from source, which you can find here: <ulink url="http://www.swig.org">SWIG</ulink> - </para> - </listitem> - <listitem> - <para>FFTW</para> - <para> - FFTW is the library which GNU Radio uses for FFTs. GNU Radio requires version 3.0.1 or - newer, and it must be compiled for single precision. You can get it from the - <ulink url="http://www.fftw.org">FFTW Homepage</ulink> - </para> - </listitem> - <listitem> - <para>Boost Library</para> - <para> - Boost provides several low-level structures used in our C++ code. If it is not included in - your OS distribution, you can get it here: <ulink url="http://boost.org">Boost</ulink> - </para> - </listitem> - <listitem> - <para>CPP Unit</para> - <para> - CPPUnit provides our unit-testing framework. This creates automated tests to insure that - code does not break when changes are made. Get it at the <ulink url="http://cppunit.sf.net"> - CPP Unit Homepage</ulink> - </para> - </listitem> - </itemizedlist> - </sect3> - <sect3 id="getting-gradio"> - <title>Getting GNU Radio and the USRP code</title> - <para> - There are several packages of software which make up GNU Radio and the USRP support software. - Links to the latest versions of each can be found on the GNU Radio Wiki at - <ulink url="http://comsec.com/wiki?GnuRadio2.X">Download Links</ulink>. Gr-build - can greatly simplify the installation process, and its use it highly recommended. - </para> - </sect3> - <sect3 id="cvs"> - <title>Following CVS Development</title> - <para> - Development for the USRP proceeds very quickly at times, so some users may want to keep up with - the latest by following the CVS trees. There are three separate software repositories - which contain various parts of the USRP system. - <itemizedlist> - <listitem> - <para> - USRP-HW, containing the hardware and FPGA designs. - </para> - <para> - All of the schematics in this repository were created in - <ulink url="http://www.geda.seul.org">gEDA</ulink>. The board - layouts were created in <ulink url="http://pcb.sf.net">PCB</ulink>. - Verilog designs are compiled in Quartus II Web Edition from - <ulink url="http://www.altera.com">Altera</ulink>. - </para> - </listitem> - <listitem> - <para> - <ulink url="https://sourceforge.net/cvs/?group_id=22397">USRP-SW</ulink>, - USRP-SW, containing firmware and host drivers for the USRP - </para> - <para> - Host side drivers and firmware which runs in the USB2 interface chip on the board. - </para> - </listitem> - <listitem> - <para> - <ulink url="http://comsec.com/wiki?CvsAccess">GNU Radio/gr-usrp</ulink> - which contains the GNU Radio interface to the USRP - </para> - </listitem> - </itemizedlist> - </para> - </sect3> - </sect2> - <sect2 id="usrp-start"> - <title>Using your USRP</title> - <sect3 id="physical"> - <title>Mechanical Connection</title> - <para> - The USRP ships with a complete set of standoffs, nuts and bolts. There are 20 standoffs, - M3x10mm M-F, of which 4 are intended to be used as "feet" for the USRP. Place them in the 4 - corner holes on the main board, inserting the male part from below. The remaining 16 - are used to hold the daughterboards in place. Four of them should be connected to the male - portion of the 4 standoffs already inserted from below. The remaining 12 should be - connected to the board with the 12 M3x6mm screws from below. At this point there should be - 16 standoffs on the board with the male ends up to serve as a guide for the daughterboards. - The 16 M3 nuts are used to fasten the daughterboards down to the main board. - </para> - <para> - The USRP accomodates 2 TX and 2 RX daughterboards. The placement of the standoffs is designed - to prevent the accidental incorrect connection of daughterboards. The 2 sides of the USRP have - their daughterboard slots rotated 180 degrees. The USRP should not be operated without - standoffs, and daughterboards should never be connected or removed while power is applied. - </para> - </sect3> - <sect3 id="electrical"> - <title>Electrical Connections</title> - <para> - The USRP is powered by a 6V 4A power converter included in the kit. The converter is - capable of 90-260 Vac, 50/60 Hz operation, and so should work in any country. - If there is a need to use another power supply, the connector is a standard 2.1mm/5.5mm - DC power connector. The USRP itself only needs 5V at 2A, but a 6V supply was chosen to - accomodate future daughterboards. Extra power supplies are available from Ettus Research. - </para> - <para> - The included USB cable should be connected to a USB2-capable socket on a computer. The USRP - does not support USB 1.1 operation at this time. - </para> - </sect3> - <sect3 id="diagnostics"> - <title>Troubleshooting</title> - <para> - When first powered up, an LED on the USRP should be flashing at about 3-4x per second. - This indicates that the processor is running, and has put the device in a low power mode. - Once firmware has been downloaded to the USRP, the LED will blink at a slower rate. - If there is no blinking LED, check all power connections, and check for continuity - in the power fuse (F501, near the power connector). If the fuse needs replacement, it - is size 0603, 3 amps. - </para> - </sect3> - </sect2> - </sect1> - <sect1 id="fpga"> - <title>FPGA</title> - <sect2 id="fpga-std"> - <title>Standard FPGA Configuration</title> - <para> - In the standard fpga configuration, usrp_std, all samples sent over - the USB interface are in 16-bit signed integers in IQ format. When - there are multiple channels (up to 4), the channels are interleaved. - For example, with 4 channels, the sequence would be I0 Q0 I1 Q1 I2 Q2 - I3 Q3 I0 Q0, etc. - </para> - <para> - The USRP can operate in full duplex mode. When in this mode, the - transmit and receive sides are completely independent of one another. - The only consideration is that the combined data rate over the bus - must be 32 Megabytes per second or less. The multiple RX channels - (1,2, or 4) must all be the same data rate (i.e. same decimation - ratio). The same applies to the 1,2, or TX channels, which each must - be at the same data rate (which may be different from the RX rate). - </para> - <para> - On the RX side, each of the 4 ADCs can be routed to either of I or the - Q input of any of the 4 downconverters. This allows for having - multiple channels selected out of the same ADC sample stream. - </para> - <para> - The digital upconverters (DUCs) on the transmit side are actually - contained in the AD9862 CODEC chips, not in the FPGA. The only - transmit signal processing blocks in the FPGA are the interpolators. - The interpolator outputs can be routed to any of the 4 CODEC inputs. - </para> - <figure id="ddc-fig"><title>Digital Down Converter Block Diagram</title> - <mediaobject> - <imageobject><imagedata fileref="ddc.eps" format="EPS"/></imageobject> - <imageobject><imagedata fileref="ddc.png" format="PNG"/></imageobject> - <caption><para></para></caption> - </mediaobject> - </figure> - - </sect2> - </sect1> - <sect1 id="dboard-int"> - <title>Daughterboard Interface</title> - <sect2 id="power-int"> - <title>Power</title> - <para> - Daughterboards are provided with clean regulated 3.3V for the analog - and digital sections. Additionally there is a 6V connection straight from - the wall supply which is intended to supply a 5V LDO regulator. All daughterboards - may draw a combined total of 1.5 A. - </para> - </sect2> - <sect2 id="logical-int"> - <title>Logical Interface</title> - <para> - There are slots for 2 TX daughterboards, labeled TXA and TXB, and 2 - corresponding RX daughterboards, RXA and RXB. Each daughterboard slot has - access to 2 of the 4 high-speed data converter analog signals (DAC outputs - for TX, ADC inputs for RX). This allows each daughterboard which uses real - (not IQ) sampling to have 2 independent RF sections, and 2 antennas - (4 total for the system). If IQ sampling is used, each board can support - a single RF section, for a total of 2 for the whole system. - </para> - <para> - No antialias or reconstruction filtering is provided on the USRP motherboard. - This allows for maximum flexibility in frequency planning for the - daughterboards. The analog input bandwidth of the ADCs is over 200 MHz, so - IF frequencies up to that high may be chosen. If several decibels of loss - is tolerable, and IF frequency as high as 500 MHz can be used. - </para> - <para> - Every daughterboard has an I2C EEPROM (24LC024 or 24LC025) onboard - which identifies the board to the system. This allows the host - software to automatically set up the system properly based on the - installed daughterboard. The EEPROM may also store calibration values - like DC offsets or IQ imbalances. If this EEPROM is not programmed, a - warning message is printed every time USRP software is run. - </para> - </sect2> - <sect2 id="analog-int"> - <title>Analog Interface</title> - <para> - Each RX daughterboard has 2 differential analog inputs - (VINP_A/VINN_A and VINP_B/VINN_B) which are sampled at a rate of 64 MS/s. - The input impedance is approximately 1Kohm. - The motherboard has a software-controllable programmable gain amplifier - on these inputs, with 0 to 20 dB of gain. With gain set to zero, full - scale inputs are 2 Volts peak-to-peak differential. When set to 20 dB, - only .2 V pk-pk differential is needed to reach full scale. - </para> - <para> - If signals are AC-coupled, there is no need to provide DC bias as long as the - internal buffer is turned on. It will provide an approximately 2V bias. - If signals are DC-couple, a DC bias of Vdd/2 (1.65V) should be provided to - both the positive and negative inputs, and the internal buffer should be turned off. - VREF provides a clean 1 V reference. - </para> - <para> - Each TX daughterboard has a pair of differential analog outputs which are - updated at 128 MS/s. The signals (IOUTP_A/IOUTN_A and IOUTP_B/IOUTN_B) are - current-output, each varying between 0 and 20 mA. Since they are high-impedance, - they can be converted into differential voltages with a resistor. - </para> - <para> - In addition to the high-speed signals, each daughterboard has exclusive access to 2 low-speed ADC inputs - (labeled AUX_ADC_A and AUX_ADC_B) which can be read from software. - These are useful for sensing RSSI signal levels, temperatures, bias - levels, etc. Additionally, each board has shared access to 4 low-speed DAC - signals, labeled AUX_DAC_A through AUX_DAC_D. RXA and TXA share one set - of these 4 lines, and RXB and TXB share their own independent set. These - signals are useful for controlling gain of variable-gain amplifiers, for example. - AUX_ADC_REF provides a reference level for gain setting if it is necessary. - </para> - - </sect2> - <sect2 id="dig-int"> - <title>Digital Interface</title> - <para></para> - </sect2> - <sect2 id="mech-int"> - <title>Connector Pinouts</title> - - <table frame='all'><title>RX DBoard Connector</title> - <tgroup cols='3' align='left' colsep='1' rowsep='1'> - <thead> - <row> - <entry>Pin #</entry> - <entry>Name</entry> - <entry>Description</entry> - </row> - </thead> - <tbody> - <row> - <entry>1</entry> - <entry>power</entry> - <entry>This is power</entry> - </row> - <row> - <entry>c1</entry> - <entry>c4</entry> - </row> - <row> - <entry>d1</entry> - <entry>d4</entry> - <entry>d5</entry> - </row> - </tbody> - </tgroup> - </table> - </sect2> - </sect1> - <sect1 id="dboards"> - <title>Available Daughterboards</title> - <sect2 id="basicrx"> - <title>BasicRX</title> - <para> - </para> - </sect2> - <sect2 id="basictx"> - <title>BasicTX</title> - <para> - </para> - </sect2> - </sect1> -</article> diff --git a/usrp/doc/usrp_rfx_diagrams.odp b/usrp/doc/usrp_rfx_diagrams.odp Binary files differdeleted file mode 100644 index 4521f71ce..000000000 --- a/usrp/doc/usrp_rfx_diagrams.odp +++ /dev/null diff --git a/usrp/firmware/.gitignore b/usrp/firmware/.gitignore deleted file mode 100644 index 75bb241c8..000000000 --- a/usrp/firmware/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -/Makefile -/Makefile.in -/aclocal.m4 -/configure -/config.h.in -/stamp-h.in -/libtool -/config.log -/config.h -/config.cache -/config.status -/missing -/stamp-h -/stamp-h1 -/.la -/.lo -/.deps -/.libs -/*.la -/*.lo -/autom4te.cache -/*.cache -/missing -/make.log -/usrp.pc diff --git a/usrp/firmware/Makefile.am b/usrp/firmware/Makefile.am deleted file mode 100644 index 9c0da3573..000000000 --- a/usrp/firmware/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -# -# Copyright 2003 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. -# - -SUBDIRS = include lib src diff --git a/usrp/firmware/include/.gitignore b/usrp/firmware/include/.gitignore deleted file mode 100644 index 75bb241c8..000000000 --- a/usrp/firmware/include/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -/Makefile -/Makefile.in -/aclocal.m4 -/configure -/config.h.in -/stamp-h.in -/libtool -/config.log -/config.h -/config.cache -/config.status -/missing -/stamp-h -/stamp-h1 -/.la -/.lo -/.deps -/.libs -/*.la -/*.lo -/autom4te.cache -/*.cache -/missing -/make.log -/usrp.pc diff --git a/usrp/firmware/include/Makefile.am b/usrp/firmware/include/Makefile.am deleted file mode 100644 index e17726c07..000000000 --- a/usrp/firmware/include/Makefile.am +++ /dev/null @@ -1,61 +0,0 @@ -# -# Copyright 2003 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. -# - -usrpincludedir = $(includedir)/usrp - -usrpinclude_HEADERS = \ - usrp_i2c_addr.h \ - usrp_spi_defs.h \ - fpga_regs_common.h \ - fpga_regs_standard.h - - -noinst_HEADERS = \ - delay.h \ - fpga_regs_common.v \ - fpga_regs_standard.v \ - fpga_regs0.h \ - fx2regs.h \ - fx2utils.h \ - i2c.h \ - isr.h \ - syncdelay.h \ - timer.h \ - usb_common.h \ - usb_descriptors.h \ - usb_requests.h \ - usrp_commands.h \ - usrp_config.h \ - usrp_ids.h \ - usrp_interfaces.h - - -CODE_GENERATOR = \ - generate_regs.py - -EXTRA_DIST = \ - $(CODE_GENERATOR) - -fpga_regs_common.v: fpga_regs_common.h generate_regs.py - PYTHONPATH=$(top_srcdir)/usrp/firmware/include $(PYTHON) $(srcdir)/generate_regs.py $(srcdir)/fpga_regs_common.h $@ - -fpga_regs_standard.v: fpga_regs_standard.h generate_regs.py - PYTHONPATH=$(top_srcdir)/usrp/firmware/include $(PYTHON) $(srcdir)/generate_regs.py $(srcdir)/fpga_regs_standard.h $@ diff --git a/usrp/firmware/include/delay.h b/usrp/firmware/include/delay.h deleted file mode 100644 index f5df779e1..000000000 --- a/usrp/firmware/include/delay.h +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 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 _DELAY_H_ -#define _DELAY_H_ - -/* - * delay for approximately usecs microseconds - * Note limit of 255 usecs. - */ -void udelay (unsigned char usecs); - -/* - * delay for approximately msecs milliseconds - */ -void mdelay (unsigned short msecs); - - -#endif /* _DELAY_H_ */ diff --git a/usrp/firmware/include/fpga_regs0.h b/usrp/firmware/include/fpga_regs0.h deleted file mode 100644 index 883798301..000000000 --- a/usrp/firmware/include/fpga_regs0.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 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 _FPGA_REGS0_H_ -#define _FPGA_REGS0_H_ - -#define FR_RX_FREQ_0 0 -#define FR_RX_FREQ_1 1 -#define FR_RX_FREQ_2 2 -#define FR_RX_FREQ_3 3 -#define FR_TX_FREQ_0 4 -#define FR_TX_FREQ_1 5 -#define FR_TX_FREQ_2 6 -#define FR_TX_FREQ_3 7 -#define FR_COMBO 8 - - -#define FR_ADC_CLK_DIV 128 // pseudo regs mapped to FR_COMBO by f/w -#define FR_EXT_CLK_DIV 129 -#define FR_INTERP 130 -#define FR_DECIM 131 - -#endif diff --git a/usrp/firmware/include/fpga_regs_common.h b/usrp/firmware/include/fpga_regs_common.h deleted file mode 100644 index b4a496af7..000000000 --- a/usrp/firmware/include/fpga_regs_common.h +++ /dev/null @@ -1,150 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003,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_FPGA_REGS_COMMON_H -#define INCLUDED_FPGA_REGS_COMMON_H - -// This file defines registers common to all FPGA configurations. -// Registers 0 to 31 are reserved for use in this file. - - -// The FPGA needs to know the rate that samples are coming from and -// going to the A/D's and D/A's. div = 128e6 / sample_rate - -#define FR_TX_SAMPLE_RATE_DIV 0 -#define FR_RX_SAMPLE_RATE_DIV 1 - -// 2 and 3 are defined in the ATR section - -#define FR_MASTER_CTRL 4 // master enable and reset controls -# define bmFR_MC_ENABLE_TX (1 << 0) -# define bmFR_MC_ENABLE_RX (1 << 1) -# define bmFR_MC_RESET_TX (1 << 2) -# define bmFR_MC_RESET_RX (1 << 3) - -// i/o direction registers for pins that go to daughterboards. -// Setting the bit makes it an output from the FPGA to the d'board. -// top 16 is mask, low 16 is value - -#define FR_OE_0 5 // slot 0 -#define FR_OE_1 6 -#define FR_OE_2 7 -#define FR_OE_3 8 - -// i/o registers for pins that go to daughterboards. -// top 16 is a mask, low 16 is value - -#define FR_IO_0 9 // slot 0 -#define FR_IO_1 10 -#define FR_IO_2 11 -#define FR_IO_3 12 - -#define FR_MODE 13 -# define bmFR_MODE_NORMAL 0 -# define bmFR_MODE_LOOPBACK (1 << 0) // enable digital loopback -# define bmFR_MODE_RX_COUNTING (1 << 1) // Rx is counting -# define bmFR_MODE_RX_COUNTING_32BIT (1 << 2) // Rx is counting with a 32 bit counter - // low and high 16 bits are multiplexed across channel I and Q - - -// If the corresponding bit is set, internal FPGA debug circuitry -// controls the i/o pins for the associated bank of daughterboard -// i/o pins. Typically used for debugging FPGA designs. - -#define FR_DEBUG_EN 14 -# define bmFR_DEBUG_EN_TX_A (1 << 0) // debug controls TX_A i/o -# define bmFR_DEBUG_EN_RX_A (1 << 1) // debug controls RX_A i/o -# define bmFR_DEBUG_EN_TX_B (1 << 2) // debug controls TX_B i/o -# define bmFR_DEBUG_EN_RX_B (1 << 3) // debug controls RX_B i/o - - -// If the corresponding bit is set, enable the automatic DC -// offset correction control loop. -// -// The 4 low bits are significant: -// -// ADC0 = (1 << 0) -// ADC1 = (1 << 1) -// ADC2 = (1 << 2) -// ADC3 = (1 << 3) -// -// This control loop works if the attached daugherboard blocks DC. -// Currently all daughterboards do block DC. This includes: -// basic rx, dbs_rx, tv_rx, flex_xxx_rx. - -#define FR_DC_OFFSET_CL_EN 15 // DC Offset Control Loop Enable - - -// offset corrections for ADC's and DAC's (2's complement) - -#define FR_ADC_OFFSET_0 16 -#define FR_ADC_OFFSET_1 17 -#define FR_ADC_OFFSET_2 18 -#define FR_ADC_OFFSET_3 19 - - -// ------------------------------------------------------------------------ -// Automatic Transmit/Receive switching -// -// If automatic transmit/receive (ATR) switching is enabled in the -// FR_ATR_CTL register, the presence or absence of data in the FPGA -// transmit fifo selects between two sets of values for each of the 4 -// banks of daughterboard i/o pins. -// -// Each daughterboard slot has 3 16-bit registers associated with it: -// FR_ATR_MASK_*, FR_ATR_TXVAL_* and FR_ATR_RXVAL_* -// -// FR_ATR_MASK_{0,1,2,3}: -// -// These registers determine which of the daugherboard i/o pins are -// affected by ATR switching. If a bit in the mask is set, the -// corresponding i/o bit is controlled by ATR, else it's output -// value comes from the normal i/o pin output register: -// FR_IO_{0,1,2,3}. -// -// FR_ATR_TXVAL_{0,1,2,3}: -// FR_ATR_RXVAL_{0,1,2,3}: -// -// If the Tx fifo contains data, then the bits from TXVAL that are -// selected by MASK are output. Otherwise, the bits from RXVAL that -// are selected by MASK are output. - -#define FR_ATR_MASK_0 20 // slot 0 -#define FR_ATR_TXVAL_0 21 -#define FR_ATR_RXVAL_0 22 - -#define FR_ATR_MASK_1 23 // slot 1 -#define FR_ATR_TXVAL_1 24 -#define FR_ATR_RXVAL_1 25 - -#define FR_ATR_MASK_2 26 // slot 2 -#define FR_ATR_TXVAL_2 27 -#define FR_ATR_RXVAL_2 28 - -#define FR_ATR_MASK_3 29 // slot 3 -#define FR_ATR_TXVAL_3 30 -#define FR_ATR_RXVAL_3 31 - -// Clock ticks to delay rising and falling edge of T/R signal -#define FR_ATR_TX_DELAY 2 -#define FR_ATR_RX_DELAY 3 - -#endif /* INCLUDED_FPGA_REGS_COMMON_H */ diff --git a/usrp/firmware/include/fpga_regs_common.v b/usrp/firmware/include/fpga_regs_common.v deleted file mode 100644 index 8035d8565..000000000 --- a/usrp/firmware/include/fpga_regs_common.v +++ /dev/null @@ -1,117 +0,0 @@ -// -// This file is machine generated from ./fpga_regs_common.h -// Do not edit by hand; your edits will be overwritten. -// - -// This file defines registers common to all FPGA configurations. -// Registers 0 to 31 are reserved for use in this file. - - -// The FPGA needs to know the rate that samples are coming from and -// going to the A/D's and D/A's. div = 128e6 / sample_rate - -`define FR_TX_SAMPLE_RATE_DIV 7'd0 -`define FR_RX_SAMPLE_RATE_DIV 7'd1 - -// 2 and 3 are defined in the ATR section - -`define FR_MASTER_CTRL 7'd4 // master enable and reset controls - -// i/o direction registers for pins that go to daughterboards. -// Setting the bit makes it an output from the FPGA to the d'board. -// top 16 is mask, low 16 is value - -`define FR_OE_0 7'd5 // slot 0 -`define FR_OE_1 7'd6 -`define FR_OE_2 7'd7 -`define FR_OE_3 7'd8 - -// i/o registers for pins that go to daughterboards. -// top 16 is a mask, low 16 is value - -`define FR_IO_0 7'd9 // slot 0 -`define FR_IO_1 7'd10 -`define FR_IO_2 7'd11 -`define FR_IO_3 7'd12 - -`define FR_MODE 7'd13 - - -// If the corresponding bit is set, internal FPGA debug circuitry -// controls the i/o pins for the associated bank of daughterboard -// i/o pins. Typically used for debugging FPGA designs. - -`define FR_DEBUG_EN 7'd14 - - -// If the corresponding bit is set, enable the automatic DC -// offset correction control loop. -// -// The 4 low bits are significant: -// -// ADC0 = (1 << 0) -// ADC1 = (1 << 1) -// ADC2 = (1 << 2) -// ADC3 = (1 << 3) -// -// This control loop works if the attached daugherboard blocks DC. -// Currently all daughterboards do block DC. This includes: -// basic rx, dbs_rx, tv_rx, flex_xxx_rx. - -`define FR_DC_OFFSET_CL_EN 7'd15 // DC Offset Control Loop Enable - - -// offset corrections for ADC's and DAC's (2's complement) - -`define FR_ADC_OFFSET_0 7'd16 -`define FR_ADC_OFFSET_1 7'd17 -`define FR_ADC_OFFSET_2 7'd18 -`define FR_ADC_OFFSET_3 7'd19 - - -// ------------------------------------------------------------------------ -// Automatic Transmit/Receive switching -// -// If automatic transmit/receive (ATR) switching is enabled in the -// FR_ATR_CTL register, the presence or absence of data in the FPGA -// transmit fifo selects between two sets of values for each of the 4 -// banks of daughterboard i/o pins. -// -// Each daughterboard slot has 3 16-bit registers associated with it: -// FR_ATR_MASK_*, FR_ATR_TXVAL_* and FR_ATR_RXVAL_* -// -// FR_ATR_MASK_{0,1,2,3}: -// -// These registers determine which of the daugherboard i/o pins are -// affected by ATR switching. If a bit in the mask is set, the -// corresponding i/o bit is controlled by ATR, else it's output -// value comes from the normal i/o pin output register: -// FR_IO_{0,1,2,3}. -// -// FR_ATR_TXVAL_{0,1,2,3}: -// FR_ATR_RXVAL_{0,1,2,3}: -// -// If the Tx fifo contains data, then the bits from TXVAL that are -// selected by MASK are output. Otherwise, the bits from RXVAL that -// are selected by MASK are output. - -`define FR_ATR_MASK_0 7'd20 // slot 0 -`define FR_ATR_TXVAL_0 7'd21 -`define FR_ATR_RXVAL_0 7'd22 - -`define FR_ATR_MASK_1 7'd23 // slot 1 -`define FR_ATR_TXVAL_1 7'd24 -`define FR_ATR_RXVAL_1 7'd25 - -`define FR_ATR_MASK_2 7'd26 // slot 2 -`define FR_ATR_TXVAL_2 7'd27 -`define FR_ATR_RXVAL_2 7'd28 - -`define FR_ATR_MASK_3 7'd29 // slot 3 -`define FR_ATR_TXVAL_3 7'd30 -`define FR_ATR_RXVAL_3 7'd31 - -// Clock ticks to delay rising and falling edge of T/R signal -`define FR_ATR_TX_DELAY 7'd2 -`define FR_ATR_RX_DELAY 7'd3 - diff --git a/usrp/firmware/include/fpga_regs_standard.h b/usrp/firmware/include/fpga_regs_standard.h deleted file mode 100644 index 7485e2bab..000000000 --- a/usrp/firmware/include/fpga_regs_standard.h +++ /dev/null @@ -1,300 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003,2004,2006 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_FPGA_REGS_STANDARD_H -#define INCLUDED_FPGA_REGS_STANDARD_H - -// Register numbers 0 to 31 are reserved for use in fpga_regs_common.h. -// Registers 64 to 79 are available for custom FPGA builds. - - -// DDC / DUC - -#define FR_INTERP_RATE 32 // [1,1024] -#define FR_DECIM_RATE 33 // [1,256] - -// DDC center freq - -#define FR_RX_FREQ_0 34 -#define FR_RX_FREQ_1 35 -#define FR_RX_FREQ_2 36 -#define FR_RX_FREQ_3 37 - -// See below for DDC Starting Phase - -// ------------------------------------------------------------------------ -// configure FPGA Rx mux -// -// 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 -// +-----------------------+-------+-------+-------+-------+-+-----+ -// | must be zero | Q3| I3| Q2| I2| Q1| I1| Q0| I0|Z| NCH | -// +-----------------------+-------+-------+-------+-------+-+-----+ -// -// There are a maximum of 4 digital downconverters in the the FPGA. -// Each DDC has two 16-bit inputs, I and Q, and two 16-bit outputs, I & Q. -// -// DDC I inputs are specified by the two bit fields I3, I2, I1 & I0 -// -// 0 = DDC input is from ADC 0 -// 1 = DDC input is from ADC 1 -// 2 = DDC input is from ADC 2 -// 3 = DDC input is from ADC 3 -// -// If Z == 1, all DDC Q inputs are set to zero -// If Z == 0, DDC Q inputs are specified by the two bit fields Q3, Q2, Q1 & Q0 -// -// NCH specifies the number of complex channels that are sent across -// the USB. The legal values are 1, 2 or 4, corresponding to 2, 4 or -// 8 16-bit values. - -#define FR_RX_MUX 38 - -// ------------------------------------------------------------------------ -// configure FPGA Tx Mux. -// -// 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 -// +-----------------------+-------+-------+-------+-------+-+-----+ -// | | DAC3 | DAC2 | DAC1 | DAC0 |0| NCH | -// +-----------------------------------------------+-------+-+-----+ -// -// NCH specifies the number of complex channels that are sent across -// the USB. The legal values are 1 or 2, corresponding to 2 or 4 -// 16-bit values. -// -// There are two interpolators with complex inputs and outputs. -// There are four DACs. (We use the DUC in each AD9862.) -// -// Each 4-bit DACx field specifies the source for the DAC and -// whether or not that DAC is enabled. Each subfield is coded -// like this: -// -// 3 2 1 0 -// +-+-----+ -// |E| N | -// +-+-----+ -// -// Where E is set if the DAC is enabled, and N specifies which -// interpolator output is connected to this DAC. -// -// N which interp output -// --- ------------------- -// 0 chan 0 I -// 1 chan 0 Q -// 2 chan 1 I -// 3 chan 1 Q - -#define FR_TX_MUX 39 - -// ------------------------------------------------------------------------ -// REFCLK control -// -// 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 - -#define FR_TX_A_REFCLK 40 -#define FR_RX_A_REFCLK 41 -#define FR_TX_B_REFCLK 42 -#define FR_RX_B_REFCLK 43 - -# define bmFR_REFCLK_EN 0x80 -# define bmFR_REFCLK_DIVISOR_MASK 0x7f - -// ------------------------------------------------------------------------ -// DDC Starting Phase - -#define FR_RX_PHASE_0 44 -#define FR_RX_PHASE_1 45 -#define FR_RX_PHASE_2 46 -#define FR_RX_PHASE_3 47 - -// ------------------------------------------------------------------------ -// Tx 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) | FMT | -// +-------------------------------------------------------+-------+ -// -// FMT values: - -#define FR_TX_FORMAT 48 -# define bmFR_TX_FORMAT_16_IQ 0 // 16-bit I, 16-bit Q - -// ------------------------------------------------------------------------ -// 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 | -// +-----------------------------------------+-+-+---------+-------+ -// -// FMT values: - -#define FR_RX_FORMAT 49 - -# define bmFR_RX_FORMAT_SHIFT_MASK (0x0f << 0) // arithmetic right shift [0, 15] -# define bmFR_RX_FORMAT_SHIFT_SHIFT 0 -# define bmFR_RX_FORMAT_WIDTH_MASK (0x1f << 4) // data width in bits [1, 16] (not all valid) -# define bmFR_RX_FORMAT_WIDTH_SHIFT 4 -# define bmFR_RX_FORMAT_WANT_Q (0x1 << 9) // deliver both I & Q, else just I -# define bmFR_RX_FORMAT_BYPASS_HB (0x1 << 10) // bypass half-band filter - -// The valid combinations currently are: -// -// B Q WIDTH SHIFT -// 0 1 16 0 -// 0 1 8 8 - - -// Possible future values of WIDTH = {4, 2, 1} -// 12 takes a bit more work, since we need to know packet alignment. - -// ------------------------------------------------------------------------ -// FIXME register numbers 50 to 63 are available - -// ------------------------------------------------------------------------ -// Registers 64 to 95 are reserved for user custom FPGA builds. -// The standard USRP software will not touch these. - -#define FR_USER_0 64 -#define FR_USER_1 65 -#define FR_USER_2 66 -#define FR_USER_3 67 -#define FR_USER_4 68 -#define FR_USER_5 69 -#define FR_USER_6 70 -#define FR_USER_7 71 -#define FR_USER_8 72 -#define FR_USER_9 73 -#define FR_USER_10 74 -#define FR_USER_11 75 -#define FR_USER_12 76 -#define FR_USER_13 77 -#define FR_USER_14 78 -#define FR_USER_15 79 -#define FR_USER_16 80 -#define FR_USER_17 81 -#define FR_USER_18 82 -#define FR_USER_19 83 -#define FR_USER_20 84 -#define FR_USER_21 85 -#define FR_USER_22 86 -#define FR_USER_23 87 -#define FR_USER_24 88 -#define FR_USER_25 89 -#define FR_USER_26 90 -#define FR_USER_27 91 -#define FR_USER_28 92 -#define FR_USER_29 93 -#define FR_USER_30 94 -#define FR_USER_31 95 - -//Registers needed for multi usrp master/slave configuration -// -//Rx Master/slave control register (FR_RX_MASTER_SLAVE = FR_USER_0) -// -#define FR_RX_MASTER_SLAVE 64 -#define bitnoFR_RX_SYNC 0 -#define bitnoFR_RX_SYNC_MASTER 1 -#define bitnoFR_RX_SYNC_SLAVE 2 -# define bmFR_RX_SYNC (1 <<bitnoFR_RX_SYNC) //1 If this is a master "sync now" and send sync to slave. - // If this is a slave "sync now" (testing purpose only) - // Sync is allmost the same as reset (clear all counters and buffers) - // except that the io outputs and settings don't get reset (otherwise it couldn't send the sync to the slave) - //0 Normal operation - -# define bmFR_RX_SYNC_MASTER (1 <<bitnoFR_RX_SYNC_MASTER) //1 This is a rx sync master, output sync_rx on rx_a_io[15] - //0 This is not a rx sync master -# define bmFR_RX_SYNC_SLAVE (1 <<bitnoFR_RX_SYNC_SLAVE) //1 This is a rx sync slave, follow sync_rx on rx_a_io[bitnoFR_RX_SYNC_INPUT_IOPIN] - //0 This is not an rx sync slave. - -//Caution The master settings will output values on the io lines. -//They inheritely enable these lines as output. If you have a daughtercard which uses these lines also as output then you will burn your usrp and daughtercard. -//If you set the slave bits then your usrp won't do anything if you don't connect a master. -// Rx Master/slave control register -// -// The way this is supposed to be used is connecting a (short) 16pin flatcable from an rx daughterboard in RXA master io_rx[8..15] to slave io_rx[8..15] on RXA of slave usrp -// This can be done with basic_rx boards or dbsrx boards -//dbsrx: connect master-J25 to slave-J25 -//basic rx: connect J25 to slave-J25 -//CAUTION: pay attention to the lineup of your connector. -//The red line (pin1) should be at the same side of the daughterboards on master and slave. -//If you turnaround the cable on one end you will burn your usrp. - -//You cannot use a 16pin flatcable if you are using FLEX400 or FLEX2400 daughterboards, since these use a lot of the io pins. -//You can still link them but you must use only a 2pin or 1pin cable -//You can also use a 2-wire link. put a 2pin header on io[15],gnd of the master RXA daughterboard and connect it to io15,gnd of the slave RXA db. -//You can use a cable like the ones found with the leds on the mainbord of a PC. -//Make sure you don't twist the cable, otherwise you connect the sync output to ground. -//To be save you could also just use a single wire from master io[15] to slave io[15], but this is not optimal for signal integrity. - - -// Since rx_io[0] can normally be used as a refclk and is not exported on all daughterboards this line -// still has the refclk function if you use the master/slave setup (it is not touched by the master/slave settings). -// The master/slave circuitry will only use io pin 15 and does not touch any of the other io pins. -#define bitnoFR_RX_SYNC_INPUT_IOPIN 15 -#define bmFR_RX_SYNC_INPUT_IOPIN (1<<bitnoFR_RX_SYNC_INPUT_IOPIN) -//TODO the output pin is still hardcoded in the verilog code, make it listen to the following define -#define bitnoFR_RX_SYNC_OUTPUT_IOPIN 15 -#define bmFR_RX_SYNC_OUTPUT_IOPIN (1<<bitnoFR_RX_SYNC_OUTPUT_IOPIN) -// ======================================================================= -// READBACK Registers -// ======================================================================= - -#define FR_RB_IO_RX_A_IO_TX_A 1 // read back a-side i/o pins -#define FR_RB_IO_RX_B_IO_TX_B 2 // read back b-side i/o pins - -// ------------------------------------------------------------------------ -// FPGA Capability 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) |T|NDUC |R|NDDC | -// +-----------------------------------------------+-+-----+-+-----+ -// -// Bottom 4-bits are Rx capabilities -// Next 4-bits are Tx capabilities - -#define FR_RB_CAPS 3 -# define bmFR_RB_CAPS_NDDC_MASK (0x7 << 0) // # of digital down converters 0,1,2,4 -# define bmFR_RB_CAPS_NDDC_SHIFT 0 -# define bmFR_RB_CAPS_RX_HAS_HALFBAND (0x1 << 3) -# define bmFR_RB_CAPS_NDUC_MASK (0x7 << 4) // # of digital up converters 0,1,2 -# define bmFR_RB_CAPS_NDUC_SHIFT 4 -# define bmFR_RB_CAPS_TX_HAS_HALFBAND (0x1 << 7) - - -#endif /* INCLUDED_FPGA_REGS_STANDARD_H */ diff --git a/usrp/firmware/include/fpga_regs_standard.v b/usrp/firmware/include/fpga_regs_standard.v deleted file mode 100644 index d09aa6116..000000000 --- a/usrp/firmware/include/fpga_regs_standard.v +++ /dev/null @@ -1,256 +0,0 @@ -// -// This file is machine generated from ./fpga_regs_standard.h -// Do not edit by hand; your edits will be overwritten. -// - -// Register numbers 0 to 31 are reserved for use in fpga_regs_common.h. -// Registers 64 to 79 are available for custom FPGA builds. - - -// DDC / DUC - -`define FR_INTERP_RATE 7'd32 // [1,1024] -`define FR_DECIM_RATE 7'd33 // [1,256] - -// DDC center freq - -`define FR_RX_FREQ_0 7'd34 -`define FR_RX_FREQ_1 7'd35 -`define FR_RX_FREQ_2 7'd36 -`define FR_RX_FREQ_3 7'd37 - -// See below for DDC Starting Phase - -// ------------------------------------------------------------------------ -// configure FPGA Rx mux -// -// 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 -// +-----------------------+-------+-------+-------+-------+-+-----+ -// | must be zero | Q3| I3| Q2| I2| Q1| I1| Q0| I0|Z| NCH | -// +-----------------------+-------+-------+-------+-------+-+-----+ -// -// There are a maximum of 4 digital downconverters in the the FPGA. -// Each DDC has two 16-bit inputs, I and Q, and two 16-bit outputs, I & Q. -// -// DDC I inputs are specified by the two bit fields I3, I2, I1 & I0 -// -// 0 = DDC input is from ADC 0 -// 1 = DDC input is from ADC 1 -// 2 = DDC input is from ADC 2 -// 3 = DDC input is from ADC 3 -// -// If Z == 1, all DDC Q inputs are set to zero -// If Z == 0, DDC Q inputs are specified by the two bit fields Q3, Q2, Q1 & Q0 -// -// NCH specifies the number of complex channels that are sent across -// the USB. The legal values are 1, 2 or 4, corresponding to 2, 4 or -// 8 16-bit values. - -`define FR_RX_MUX 7'd38 - -// ------------------------------------------------------------------------ -// configure FPGA Tx Mux. -// -// 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 -// +-----------------------+-------+-------+-------+-------+-+-----+ -// | | DAC3 | DAC2 | DAC1 | DAC0 |0| NCH | -// +-----------------------------------------------+-------+-+-----+ -// -// NCH specifies the number of complex channels that are sent across -// the USB. The legal values are 1 or 2, corresponding to 2 or 4 -// 16-bit values. -// -// There are two interpolators with complex inputs and outputs. -// There are four DACs. (We use the DUC in each AD9862.) -// -// Each 4-bit DACx field specifies the source for the DAC and -// whether or not that DAC is enabled. Each subfield is coded -// like this: -// -// 3 2 1 0 -// +-+-----+ -// |E| N | -// +-+-----+ -// -// Where E is set if the DAC is enabled, and N specifies which -// interpolator output is connected to this DAC. -// -// N which interp output -// --- ------------------- -// 0 chan 0 I -// 1 chan 0 Q -// 2 chan 1 I -// 3 chan 1 Q - -`define FR_TX_MUX 7'd39 - -// ------------------------------------------------------------------------ -// REFCLK control -// -// 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 - -`define FR_TX_A_REFCLK 7'd40 -`define FR_RX_A_REFCLK 7'd41 -`define FR_TX_B_REFCLK 7'd42 -`define FR_RX_B_REFCLK 7'd43 - - -// ------------------------------------------------------------------------ -// DDC Starting Phase - -`define FR_RX_PHASE_0 7'd44 -`define FR_RX_PHASE_1 7'd45 -`define FR_RX_PHASE_2 7'd46 -`define FR_RX_PHASE_3 7'd47 - -// ------------------------------------------------------------------------ -// Tx 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) | FMT | -// +-------------------------------------------------------+-------+ -// -// FMT values: - -`define FR_TX_FORMAT 7'd48 - -// ------------------------------------------------------------------------ -// 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 | -// +-----------------------------------------+-+-+---------+-------+ -// -// FMT values: - -`define FR_RX_FORMAT 7'd49 - - -// The valid combinations currently are: -// -// B Q WIDTH SHIFT -// 0 1 16 0 -// 0 1 8 8 - - -// Possible future values of WIDTH = {4, 2, 1} -// 12 takes a bit more work, since we need to know packet alignment. - -// ------------------------------------------------------------------------ -// FIXME register numbers 50 to 63 are available - -// ------------------------------------------------------------------------ -// Registers 64 to 95 are reserved for user custom FPGA builds. -// The standard USRP software will not touch these. - -`define FR_USER_0 7'd64 -`define FR_USER_1 7'd65 -`define FR_USER_2 7'd66 -`define FR_USER_3 7'd67 -`define FR_USER_4 7'd68 -`define FR_USER_5 7'd69 -`define FR_USER_6 7'd70 -`define FR_USER_7 7'd71 -`define FR_USER_8 7'd72 -`define FR_USER_9 7'd73 -`define FR_USER_10 7'd74 -`define FR_USER_11 7'd75 -`define FR_USER_12 7'd76 -`define FR_USER_13 7'd77 -`define FR_USER_14 7'd78 -`define FR_USER_15 7'd79 -`define FR_USER_16 7'd80 -`define FR_USER_17 7'd81 -`define FR_USER_18 7'd82 -`define FR_USER_19 7'd83 -`define FR_USER_20 7'd84 -`define FR_USER_21 7'd85 -`define FR_USER_22 7'd86 -`define FR_USER_23 7'd87 -`define FR_USER_24 7'd88 -`define FR_USER_25 7'd89 -`define FR_USER_26 7'd90 -`define FR_USER_27 7'd91 -`define FR_USER_28 7'd92 -`define FR_USER_29 7'd93 -`define FR_USER_30 7'd94 -`define FR_USER_31 7'd95 - -//Registers needed for multi usrp master/slave configuration -// -//Rx Master/slave control register (FR_RX_MASTER_SLAVE = FR_USER_0) -// -`define FR_RX_MASTER_SLAVE 7'd64 -`define bitnoFR_RX_SYNC 0 -`define bitnoFR_RX_SYNC_MASTER 1 -`define bitnoFR_RX_SYNC_SLAVE 2 - - -//Caution The master settings will output values on the io lines. -//They inheritely enable these lines as output. If you have a daughtercard which uses these lines also as output then you will burn your usrp and daughtercard. -//If you set the slave bits then your usrp won't do anything if you don't connect a master. -// Rx Master/slave control register -// -// The way this is supposed to be used is connecting a (short) 16pin flatcable from an rx daughterboard in RXA master io_rx[8..15] to slave io_rx[8..15] on RXA of slave usrp -// This can be done with basic_rx boards or dbsrx boards -//dbsrx: connect master-J25 to slave-J25 -//basic rx: connect J25 to slave-J25 -//CAUTION: pay attention to the lineup of your connector. -//The red line (pin1) should be at the same side of the daughterboards on master and slave. -//If you turnaround the cable on one end you will burn your usrp. - -//You cannot use a 16pin flatcable if you are using FLEX400 or FLEX2400 daughterboards, since these use a lot of the io pins. -//You can still link them but you must use only a 2pin or 1pin cable -//You can also use a 2-wire link. put a 2pin header on io[15],gnd of the master RXA daughterboard and connect it to io15,gnd of the slave RXA db. -//You can use a cable like the ones found with the leds on the mainbord of a PC. -//Make sure you don't twist the cable, otherwise you connect the sync output to ground. -//To be save you could also just use a single wire from master io[15] to slave io[15], but this is not optimal for signal integrity. - - -// Since rx_io[0] can normally be used as a refclk and is not exported on all daughterboards this line -// still has the refclk function if you use the master/slave setup (it is not touched by the master/slave settings). -// The master/slave circuitry will only use io pin 15 and does not touch any of the other io pins. -`define bitnoFR_RX_SYNC_INPUT_IOPIN 15 -`define bmFR_RX_SYNC_INPUT_IOPIN (1<<bitnoFR_RX_SYNC_INPUT_IOPIN) -//TODO the output pin is still hardcoded in the verilog code, make it listen to the following define -`define bitnoFR_RX_SYNC_OUTPUT_IOPIN 15 -`define bmFR_RX_SYNC_OUTPUT_IOPIN (1<<bitnoFR_RX_SYNC_OUTPUT_IOPIN) -// ======================================================================= -// READBACK Registers -// ======================================================================= - -`define FR_RB_IO_RX_A_IO_TX_A 7'd1 // read back a-side i/o pins -`define FR_RB_IO_RX_B_IO_TX_B 7'd2 // read back b-side i/o pins - -// ------------------------------------------------------------------------ -// FPGA Capability 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) |T|NDUC |R|NDDC | -// +-----------------------------------------------+-+-----+-+-----+ -// -// Bottom 4-bits are Rx capabilities -// Next 4-bits are Tx capabilities - -`define FR_RB_CAPS 7'd3 - - diff --git a/usrp/firmware/include/fx2regs.h b/usrp/firmware/include/fx2regs.h deleted file mode 100644 index 2f210f567..000000000 --- a/usrp/firmware/include/fx2regs.h +++ /dev/null @@ -1,716 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 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. - */ - -/* -//----------------------------------------------------------------------------- -// File: FX2regs.h -// Contents: EZ-USB FX2 register declarations and bit mask definitions. -// -// $Archive: /USB/Target/Inc/fx2regs.h $ -// $Date$ -// $Revision$ -// -// -// Copyright (c) 2000 Cypress Semiconductor, All rights reserved -//----------------------------------------------------------------------------- -*/ - - -#ifndef FX2REGS_H /* Header Sentry */ -#define FX2REGS_H - -#define ALLOCATE_EXTERN // required for "right thing to happen" with fx2regs.h - -/* -//----------------------------------------------------------------------------- -// FX2 Related Register Assignments -//----------------------------------------------------------------------------- - -// The Ez-USB FX2 registers are defined here. We use FX2regs.h for register -// address allocation by using "#define ALLOCATE_EXTERN". -// When using "#define ALLOCATE_EXTERN", you get (for instance): -// xdata volatile BYTE OUT7BUF[64] _at_ 0x7B40; -// Such lines are created from FX2.h by using the preprocessor. -// Incidently, these lines will not generate any space in the resulting hex -// file; they just bind the symbols to the addresses for compilation. -// You just need to put "#define ALLOCATE_EXTERN" in your main program file; -// i.e. fw.c or a stand-alone C source file. -// Without "#define ALLOCATE_EXTERN", you just get the external reference: -// extern xdata volatile BYTE OUT7BUF[64] ;// 0x7B40; -// This uses the concatenation operator "##" to insert a comment "//" -// to cut off the end of the line, "_at_ 0x7B40;", which is not wanted. -*/ - - -#ifdef ALLOCATE_EXTERN -#define EXTERN -#define _AT_(a) at a -#else -#define EXTERN extern -#define _AT_ ;/ ## / -#endif - -typedef unsigned char BYTE; -typedef unsigned short WORD; - -EXTERN xdata _AT_(0xE400) volatile BYTE GPIF_WAVE_DATA[128]; -EXTERN xdata _AT_(0xE480) volatile BYTE RES_WAVEDATA_END ; - -// General Configuration - -EXTERN xdata _AT_(0xE600) volatile BYTE CPUCS ; // Control & Status -EXTERN xdata _AT_(0xE601) volatile BYTE IFCONFIG ; // Interface Configuration -EXTERN xdata _AT_(0xE602) volatile BYTE PINFLAGSAB ; // FIFO FLAGA and FLAGB Assignments -EXTERN xdata _AT_(0xE603) volatile BYTE PINFLAGSCD ; // FIFO FLAGC and FLAGD Assignments -EXTERN xdata _AT_(0xE604) volatile BYTE FIFORESET ; // Restore FIFOS to default state -EXTERN xdata _AT_(0xE605) volatile BYTE BREAKPT ; // Breakpoint -EXTERN xdata _AT_(0xE606) volatile BYTE BPADDRH ; // Breakpoint Address H -EXTERN xdata _AT_(0xE607) volatile BYTE BPADDRL ; // Breakpoint Address L -EXTERN xdata _AT_(0xE608) volatile BYTE UART230 ; // 230 Kbaud clock for T0,T1,T2 -EXTERN xdata _AT_(0xE609) volatile BYTE FIFOPINPOLAR ; // FIFO polarities -EXTERN xdata _AT_(0xE60A) volatile BYTE REVID ; // Chip Revision -EXTERN xdata _AT_(0xE60B) volatile BYTE REVCTL ; // Chip Revision Control - -// Endpoint Configuration - -EXTERN xdata _AT_(0xE610) volatile BYTE EP1OUTCFG ; // Endpoint 1-OUT Configuration -EXTERN xdata _AT_(0xE611) volatile BYTE EP1INCFG ; // Endpoint 1-IN Configuration -EXTERN xdata _AT_(0xE612) volatile BYTE EP2CFG ; // Endpoint 2 Configuration -EXTERN xdata _AT_(0xE613) volatile BYTE EP4CFG ; // Endpoint 4 Configuration -EXTERN xdata _AT_(0xE614) volatile BYTE EP6CFG ; // Endpoint 6 Configuration -EXTERN xdata _AT_(0xE615) volatile BYTE EP8CFG ; // Endpoint 8 Configuration -EXTERN xdata _AT_(0xE618) volatile BYTE EP2FIFOCFG ; // Endpoint 2 FIFO configuration -EXTERN xdata _AT_(0xE619) volatile BYTE EP4FIFOCFG ; // Endpoint 4 FIFO configuration -EXTERN xdata _AT_(0xE61A) volatile BYTE EP6FIFOCFG ; // Endpoint 6 FIFO configuration -EXTERN xdata _AT_(0xE61B) volatile BYTE EP8FIFOCFG ; // Endpoint 8 FIFO configuration -EXTERN xdata _AT_(0xE620) volatile BYTE EP2AUTOINLENH ; // Endpoint 2 Packet Length H (IN only) -EXTERN xdata _AT_(0xE621) volatile BYTE EP2AUTOINLENL ; // Endpoint 2 Packet Length L (IN only) -EXTERN xdata _AT_(0xE622) volatile BYTE EP4AUTOINLENH ; // Endpoint 4 Packet Length H (IN only) -EXTERN xdata _AT_(0xE623) volatile BYTE EP4AUTOINLENL ; // Endpoint 4 Packet Length L (IN only) -EXTERN xdata _AT_(0xE624) volatile BYTE EP6AUTOINLENH ; // Endpoint 6 Packet Length H (IN only) -EXTERN xdata _AT_(0xE625) volatile BYTE EP6AUTOINLENL ; // Endpoint 6 Packet Length L (IN only) -EXTERN xdata _AT_(0xE626) volatile BYTE EP8AUTOINLENH ; // Endpoint 8 Packet Length H (IN only) -EXTERN xdata _AT_(0xE627) volatile BYTE EP8AUTOINLENL ; // Endpoint 8 Packet Length L (IN only) -EXTERN xdata _AT_(0xE630) volatile BYTE EP2FIFOPFH ; // EP2 Programmable Flag trigger H -EXTERN xdata _AT_(0xE631) volatile BYTE EP2FIFOPFL ; // EP2 Programmable Flag trigger L -EXTERN xdata _AT_(0xE632) volatile BYTE EP4FIFOPFH ; // EP4 Programmable Flag trigger H -EXTERN xdata _AT_(0xE633) volatile BYTE EP4FIFOPFL ; // EP4 Programmable Flag trigger L -EXTERN xdata _AT_(0xE634) volatile BYTE EP6FIFOPFH ; // EP6 Programmable Flag trigger H -EXTERN xdata _AT_(0xE635) volatile BYTE EP6FIFOPFL ; // EP6 Programmable Flag trigger L -EXTERN xdata _AT_(0xE636) volatile BYTE EP8FIFOPFH ; // EP8 Programmable Flag trigger H -EXTERN xdata _AT_(0xE637) volatile BYTE EP8FIFOPFL ; // EP8 Programmable Flag trigger L -EXTERN xdata _AT_(0xE640) volatile BYTE EP2ISOINPKTS ; // EP2 (if ISO) IN Packets per frame (1-3) -EXTERN xdata _AT_(0xE641) volatile BYTE EP4ISOINPKTS ; // EP4 (if ISO) IN Packets per frame (1-3) -EXTERN xdata _AT_(0xE642) volatile BYTE EP6ISOINPKTS ; // EP6 (if ISO) IN Packets per frame (1-3) -EXTERN xdata _AT_(0xE643) volatile BYTE EP8ISOINPKTS ; // EP8 (if ISO) IN Packets per frame (1-3) -EXTERN xdata _AT_(0xE648) volatile BYTE INPKTEND ; // Force IN Packet End -EXTERN xdata _AT_(0xE649) volatile BYTE OUTPKTEND ; // Force OUT Packet End - -// Interrupts - -EXTERN xdata _AT_(0xE650) volatile BYTE EP2FIFOIE ; // Endpoint 2 Flag Interrupt Enable -EXTERN xdata _AT_(0xE651) volatile BYTE EP2FIFOIRQ ; // Endpoint 2 Flag Interrupt Request -EXTERN xdata _AT_(0xE652) volatile BYTE EP4FIFOIE ; // Endpoint 4 Flag Interrupt Enable -EXTERN xdata _AT_(0xE653) volatile BYTE EP4FIFOIRQ ; // Endpoint 4 Flag Interrupt Request -EXTERN xdata _AT_(0xE654) volatile BYTE EP6FIFOIE ; // Endpoint 6 Flag Interrupt Enable -EXTERN xdata _AT_(0xE655) volatile BYTE EP6FIFOIRQ ; // Endpoint 6 Flag Interrupt Request -EXTERN xdata _AT_(0xE656) volatile BYTE EP8FIFOIE ; // Endpoint 8 Flag Interrupt Enable -EXTERN xdata _AT_(0xE657) volatile BYTE EP8FIFOIRQ ; // Endpoint 8 Flag Interrupt Request -EXTERN xdata _AT_(0xE658) volatile BYTE IBNIE ; // IN-BULK-NAK Interrupt Enable -EXTERN xdata _AT_(0xE659) volatile BYTE IBNIRQ ; // IN-BULK-NAK interrupt Request -EXTERN xdata _AT_(0xE65A) volatile BYTE NAKIE ; // Endpoint Ping NAK interrupt Enable -EXTERN xdata _AT_(0xE65B) volatile BYTE NAKIRQ ; // Endpoint Ping NAK interrupt Request -EXTERN xdata _AT_(0xE65C) volatile BYTE USBIE ; // USB Int Enables -EXTERN xdata _AT_(0xE65D) volatile BYTE USBIRQ ; // USB Interrupt Requests -EXTERN xdata _AT_(0xE65E) volatile BYTE EPIE ; // Endpoint Interrupt Enables -EXTERN xdata _AT_(0xE65F) volatile BYTE EPIRQ ; // Endpoint Interrupt Requests -EXTERN xdata _AT_(0xE660) volatile BYTE GPIFIE ; // GPIF Interrupt Enable -EXTERN xdata _AT_(0xE661) volatile BYTE GPIFIRQ ; // GPIF Interrupt Request -EXTERN xdata _AT_(0xE662) volatile BYTE USBERRIE ; // USB Error Interrupt Enables -EXTERN xdata _AT_(0xE663) volatile BYTE USBERRIRQ ; // USB Error Interrupt Requests -EXTERN xdata _AT_(0xE664) volatile BYTE ERRCNTLIM ; // USB Error counter and limit -EXTERN xdata _AT_(0xE665) volatile BYTE CLRERRCNT ; // Clear Error Counter EC[3..0] -EXTERN xdata _AT_(0xE666) volatile BYTE INT2IVEC ; // Interupt 2 (USB) Autovector -EXTERN xdata _AT_(0xE667) volatile BYTE INT4IVEC ; // Interupt 4 (FIFOS & GPIF) Autovector -EXTERN xdata _AT_(0xE668) volatile BYTE INTSETUP ; // Interrupt 2&4 Setup - -// Input/Output - -EXTERN xdata _AT_(0xE670) volatile BYTE PORTACFG ; // I/O PORTA Alternate Configuration -EXTERN xdata _AT_(0xE671) volatile BYTE PORTCCFG ; // I/O PORTC Alternate Configuration -EXTERN xdata _AT_(0xE672) volatile BYTE PORTECFG ; // I/O PORTE Alternate Configuration -EXTERN xdata _AT_(0xE678) volatile BYTE I2CS ; // Control & Status -EXTERN xdata _AT_(0xE679) volatile BYTE I2DAT ; // Data -EXTERN xdata _AT_(0xE67A) volatile BYTE I2CTL ; // I2C Control -EXTERN xdata _AT_(0xE67B) volatile BYTE XAUTODAT1 ; // Autoptr1 MOVX access -EXTERN xdata _AT_(0xE67C) volatile BYTE XAUTODAT2 ; // Autoptr2 MOVX access - -#define EXTAUTODAT1 XAUTODAT1 -#define EXTAUTODAT2 XAUTODAT2 - -// USB Control - -EXTERN xdata _AT_(0xE680) volatile BYTE USBCS ; // USB Control & Status -EXTERN xdata _AT_(0xE681) volatile BYTE SUSPEND ; // Put chip into suspend -EXTERN xdata _AT_(0xE682) volatile BYTE WAKEUPCS ; // Wakeup source and polarity -EXTERN xdata _AT_(0xE683) volatile BYTE TOGCTL ; // Toggle Control -EXTERN xdata _AT_(0xE684) volatile BYTE USBFRAMEH ; // USB Frame count H -EXTERN xdata _AT_(0xE685) volatile BYTE USBFRAMEL ; // USB Frame count L -EXTERN xdata _AT_(0xE686) volatile BYTE MICROFRAME ; // Microframe count, 0-7 -EXTERN xdata _AT_(0xE687) volatile BYTE FNADDR ; // USB Function address - -// Endpoints - -EXTERN xdata _AT_(0xE68A) volatile BYTE EP0BCH ; // Endpoint 0 Byte Count H -EXTERN xdata _AT_(0xE68B) volatile BYTE EP0BCL ; // Endpoint 0 Byte Count L -EXTERN xdata _AT_(0xE68D) volatile BYTE EP1OUTBC ; // Endpoint 1 OUT Byte Count -EXTERN xdata _AT_(0xE68F) volatile BYTE EP1INBC ; // Endpoint 1 IN Byte Count -EXTERN xdata _AT_(0xE690) volatile BYTE EP2BCH ; // Endpoint 2 Byte Count H -EXTERN xdata _AT_(0xE691) volatile BYTE EP2BCL ; // Endpoint 2 Byte Count L -EXTERN xdata _AT_(0xE694) volatile BYTE EP4BCH ; // Endpoint 4 Byte Count H -EXTERN xdata _AT_(0xE695) volatile BYTE EP4BCL ; // Endpoint 4 Byte Count L -EXTERN xdata _AT_(0xE698) volatile BYTE EP6BCH ; // Endpoint 6 Byte Count H -EXTERN xdata _AT_(0xE699) volatile BYTE EP6BCL ; // Endpoint 6 Byte Count L -EXTERN xdata _AT_(0xE69C) volatile BYTE EP8BCH ; // Endpoint 8 Byte Count H -EXTERN xdata _AT_(0xE69D) volatile BYTE EP8BCL ; // Endpoint 8 Byte Count L -EXTERN xdata _AT_(0xE6A0) volatile BYTE EP0CS ; // Endpoint Control and Status -EXTERN xdata _AT_(0xE6A1) volatile BYTE EP1OUTCS ; // Endpoint 1 OUT Control and Status -EXTERN xdata _AT_(0xE6A2) volatile BYTE EP1INCS ; // Endpoint 1 IN Control and Status -EXTERN xdata _AT_(0xE6A3) volatile BYTE EP2CS ; // Endpoint 2 Control and Status -EXTERN xdata _AT_(0xE6A4) volatile BYTE EP4CS ; // Endpoint 4 Control and Status -EXTERN xdata _AT_(0xE6A5) volatile BYTE EP6CS ; // Endpoint 6 Control and Status -EXTERN xdata _AT_(0xE6A6) volatile BYTE EP8CS ; // Endpoint 8 Control and Status -EXTERN xdata _AT_(0xE6A7) volatile BYTE EP2FIFOFLGS ; // Endpoint 2 Flags -EXTERN xdata _AT_(0xE6A8) volatile BYTE EP4FIFOFLGS ; // Endpoint 4 Flags -EXTERN xdata _AT_(0xE6A9) volatile BYTE EP6FIFOFLGS ; // Endpoint 6 Flags -EXTERN xdata _AT_(0xE6AA) volatile BYTE EP8FIFOFLGS ; // Endpoint 8 Flags -EXTERN xdata _AT_(0xE6AB) volatile BYTE EP2FIFOBCH ; // EP2 FIFO total byte count H -EXTERN xdata _AT_(0xE6AC) volatile BYTE EP2FIFOBCL ; // EP2 FIFO total byte count L -EXTERN xdata _AT_(0xE6AD) volatile BYTE EP4FIFOBCH ; // EP4 FIFO total byte count H -EXTERN xdata _AT_(0xE6AE) volatile BYTE EP4FIFOBCL ; // EP4 FIFO total byte count L -EXTERN xdata _AT_(0xE6AF) volatile BYTE EP6FIFOBCH ; // EP6 FIFO total byte count H -EXTERN xdata _AT_(0xE6B0) volatile BYTE EP6FIFOBCL ; // EP6 FIFO total byte count L -EXTERN xdata _AT_(0xE6B1) volatile BYTE EP8FIFOBCH ; // EP8 FIFO total byte count H -EXTERN xdata _AT_(0xE6B2) volatile BYTE EP8FIFOBCL ; // EP8 FIFO total byte count L -EXTERN xdata _AT_(0xE6B3) volatile BYTE SUDPTRH ; // Setup Data Pointer high address byte -EXTERN xdata _AT_(0xE6B4) volatile BYTE SUDPTRL ; // Setup Data Pointer low address byte -EXTERN xdata _AT_(0xE6B5) volatile BYTE SUDPTRCTL ; // Setup Data Pointer Auto Mode -EXTERN xdata _AT_(0xE6B8) volatile BYTE SETUPDAT[8] ; // 8 bytes of SETUP data - -// GPIF - -EXTERN xdata _AT_(0xE6C0) volatile BYTE GPIFWFSELECT ; // Waveform Selector -EXTERN xdata _AT_(0xE6C1) volatile BYTE GPIFIDLECS ; // GPIF Done, GPIF IDLE drive mode -EXTERN xdata _AT_(0xE6C2) volatile BYTE GPIFIDLECTL ; // Inactive Bus, CTL states -EXTERN xdata _AT_(0xE6C3) volatile BYTE GPIFCTLCFG ; // CTL OUT pin drive -EXTERN xdata _AT_(0xE6C4) volatile BYTE GPIFADRH ; // GPIF Address H -EXTERN xdata _AT_(0xE6C5) volatile BYTE GPIFADRL ; // GPIF Address L - -EXTERN xdata _AT_(0xE6CE) volatile BYTE GPIFTCB3 ; // GPIF Transaction Count Byte 3 -EXTERN xdata _AT_(0xE6CF) volatile BYTE GPIFTCB2 ; // GPIF Transaction Count Byte 2 -EXTERN xdata _AT_(0xE6D0) volatile BYTE GPIFTCB1 ; // GPIF Transaction Count Byte 1 -EXTERN xdata _AT_(0xE6D1) volatile BYTE GPIFTCB0 ; // GPIF Transaction Count Byte 0 - -#define EP2GPIFTCH GPIFTCB1 // these are here for backwards compatibility -#define EP2GPIFTCL GPIFTCB0 // before REVE silicon (ie. REVB and REVD) -#define EP4GPIFTCH GPIFTCB1 // these are here for backwards compatibility -#define EP4GPIFTCL GPIFTCB0 // before REVE silicon (ie. REVB and REVD) -#define EP6GPIFTCH GPIFTCB1 // these are here for backwards compatibility -#define EP6GPIFTCL GPIFTCB0 // before REVE silicon (ie. REVB and REVD) -#define EP8GPIFTCH GPIFTCB1 // these are here for backwards compatibility -#define EP8GPIFTCL GPIFTCB0 // before REVE silicon (ie. REVB and REVD) - -// EXTERN xdata volatile BYTE EP2GPIFTCH _AT_ 0xE6D0; // EP2 GPIF Transaction Count High -// EXTERN xdata volatile BYTE EP2GPIFTCL _AT_ 0xE6D1; // EP2 GPIF Transaction Count Low -EXTERN xdata _AT_(0xE6D2) volatile BYTE EP2GPIFFLGSEL ; // EP2 GPIF Flag select -EXTERN xdata _AT_(0xE6D3) volatile BYTE EP2GPIFPFSTOP ; // Stop GPIF EP2 transaction on prog. flag -EXTERN xdata _AT_(0xE6D4) volatile BYTE EP2GPIFTRIG ; // EP2 FIFO Trigger -// EXTERN xdata volatile BYTE EP4GPIFTCH _AT_ 0xE6D8; // EP4 GPIF Transaction Count High -// EXTERN xdata volatile BYTE EP4GPIFTCL _AT_ 0xE6D9; // EP4 GPIF Transactionr Count Low -EXTERN xdata _AT_(0xE6DA) volatile BYTE EP4GPIFFLGSEL ; // EP4 GPIF Flag select -EXTERN xdata _AT_(0xE6DB) volatile BYTE EP4GPIFPFSTOP ; // Stop GPIF EP4 transaction on prog. flag -EXTERN xdata _AT_(0xE6DC) volatile BYTE EP4GPIFTRIG ; // EP4 FIFO Trigger -// EXTERN xdata volatile BYTE EP6GPIFTCH _AT_ 0xE6E0; // EP6 GPIF Transaction Count High -// EXTERN xdata volatile BYTE EP6GPIFTCL _AT_ 0xE6E1; // EP6 GPIF Transaction Count Low -EXTERN xdata _AT_(0xE6E2) volatile BYTE EP6GPIFFLGSEL ; // EP6 GPIF Flag select -EXTERN xdata _AT_(0xE6E3) volatile BYTE EP6GPIFPFSTOP ; // Stop GPIF EP6 transaction on prog. flag -EXTERN xdata _AT_(0xE6E4) volatile BYTE EP6GPIFTRIG ; // EP6 FIFO Trigger -// EXTERN xdata volatile BYTE EP8GPIFTCH _AT_ 0xE6E8; // EP8 GPIF Transaction Count High -// EXTERN xdata volatile BYTE EP8GPIFTCL _AT_ 0xE6E9; // EP8GPIF Transaction Count Low -EXTERN xdata _AT_(0xE6EA) volatile BYTE EP8GPIFFLGSEL ; // EP8 GPIF Flag select -EXTERN xdata _AT_(0xE6EB) volatile BYTE EP8GPIFPFSTOP ; // Stop GPIF EP8 transaction on prog. flag -EXTERN xdata _AT_(0xE6EC) volatile BYTE EP8GPIFTRIG ; // EP8 FIFO Trigger -EXTERN xdata _AT_(0xE6F0) volatile BYTE XGPIFSGLDATH ; // GPIF Data H (16-bit mode only) -EXTERN xdata _AT_(0xE6F1) volatile BYTE XGPIFSGLDATLX ; // Read/Write GPIF Data L & trigger transac -EXTERN xdata _AT_(0xE6F2) volatile BYTE XGPIFSGLDATLNOX ; // Read GPIF Data L, no transac trigger -EXTERN xdata _AT_(0xE6F3) volatile BYTE GPIFREADYCFG ; // Internal RDY,Sync/Async, RDY5CFG -EXTERN xdata _AT_(0xE6F4) volatile BYTE GPIFREADYSTAT ; // RDY pin states -EXTERN xdata _AT_(0xE6F5) volatile BYTE GPIFABORT ; // Abort GPIF cycles - -// UDMA - -EXTERN xdata _AT_(0xE6C6) volatile BYTE FLOWSTATE ; //Defines GPIF flow state -EXTERN xdata _AT_(0xE6C7) volatile BYTE FLOWLOGIC ; //Defines flow/hold decision criteria -EXTERN xdata _AT_(0xE6C8) volatile BYTE FLOWEQ0CTL ; //CTL states during active flow state -EXTERN xdata _AT_(0xE6C9) volatile BYTE FLOWEQ1CTL ; //CTL states during hold flow state -EXTERN xdata _AT_(0xE6CA) volatile BYTE FLOWHOLDOFF ; -EXTERN xdata _AT_(0xE6CB) volatile BYTE FLOWSTB ; //CTL/RDY Signal to use as master data strobe -EXTERN xdata _AT_(0xE6CC) volatile BYTE FLOWSTBEDGE ; //Defines active master strobe edge -EXTERN xdata _AT_(0xE6CD) volatile BYTE FLOWSTBHPERIOD ; //Half Period of output master strobe -EXTERN xdata _AT_(0xE60C) volatile BYTE GPIFHOLDAMOUNT ; //Data delay shift -EXTERN xdata _AT_(0xE67D) volatile BYTE UDMACRCH ; //CRC Upper byte -EXTERN xdata _AT_(0xE67E) volatile BYTE UDMACRCL ; //CRC Lower byte -EXTERN xdata _AT_(0xE67F) volatile BYTE UDMACRCQUAL ; //UDMA In only, host terminated use only - - -// Debug/Test - -EXTERN xdata _AT_(0xE6F8) volatile BYTE DBUG ; // Debug -EXTERN xdata _AT_(0xE6F9) volatile BYTE TESTCFG ; // Test configuration -EXTERN xdata _AT_(0xE6FA) volatile BYTE USBTEST ; // USB Test Modes -EXTERN xdata _AT_(0xE6FB) volatile BYTE CT1 ; // Chirp Test--Override -EXTERN xdata _AT_(0xE6FC) volatile BYTE CT2 ; // Chirp Test--FSM -EXTERN xdata _AT_(0xE6FD) volatile BYTE CT3 ; // Chirp Test--Control Signals -EXTERN xdata _AT_(0xE6FE) volatile BYTE CT4 ; // Chirp Test--Inputs - -// Endpoint Buffers - -EXTERN xdata _AT_(0xE740) volatile BYTE EP0BUF[64] ; // EP0 IN-OUT buffer -EXTERN xdata _AT_(0xE780) volatile BYTE EP1OUTBUF[64] ; // EP1-OUT buffer -EXTERN xdata _AT_(0xE7C0) volatile BYTE EP1INBUF[64] ; // EP1-IN buffer -EXTERN xdata _AT_(0xF000) volatile BYTE EP2FIFOBUF[1024] ; // 512/1024-byte EP2 buffer (IN or OUT) -EXTERN xdata _AT_(0xF400) volatile BYTE EP4FIFOBUF[1024] ; // 512 byte EP4 buffer (IN or OUT) -EXTERN xdata _AT_(0xF800) volatile BYTE EP6FIFOBUF[1024] ; // 512/1024-byte EP6 buffer (IN or OUT) -EXTERN xdata _AT_(0xFC00) volatile BYTE EP8FIFOBUF[1024] ; // 512 byte EP8 buffer (IN or OUT) - -#undef EXTERN -#undef _AT_ - -/*----------------------------------------------------------------------------- - Special Function Registers (SFRs) - The byte registers and bits defined in the following list are based - on the Synopsis definition of the 8051 Special Function Registers for EZ-USB. - If you modify the register definitions below, please regenerate the file - "ezregs.inc" which includes the same basic information for assembly inclusion. ------------------------------------------------------------------------------*/ - -sfr at 0x80 IOA; -sfr at 0x81 SP; -sfr at 0x82 DPL; -sfr at 0x83 DPH; -sfr at 0x84 DPL1; -sfr at 0x85 DPH1; -sfr at 0x86 DPS; - /* DPS */ - sbit at 0x86+0 SEL; -sfr at 0x87 PCON; /* PCON */ - //sbit IDLE = 0x87+0; - //sbit STOP = 0x87+1; - //sbit GF0 = 0x87+2; - //sbit GF1 = 0x87+3; - //sbit SMOD0 = 0x87+7; -sfr at 0x88 TCON; - /* TCON */ - sbit at 0x88+0 IT0; - sbit at 0x88+1 IE0; - sbit at 0x88+2 IT1; - sbit at 0x88+3 IE1; - sbit at 0x88+4 TR0; - sbit at 0x88+5 TF0; - sbit at 0x88+6 TR1; - sbit at 0x88+7 TF1; -sfr at 0x89 TMOD; - /* TMOD */ - //sbit M00 = 0x89+0; - //sbit M10 = 0x89+1; - //sbit CT0 = 0x89+2; - //sbit GATE0 = 0x89+3; - //sbit M01 = 0x89+4; - //sbit M11 = 0x89+5; - //sbit CT1 = 0x89+6; - //sbit GATE1 = 0x89+7; -sfr at 0x8A TL0; -sfr at 0x8B TL1; -sfr at 0x8C TH0; -sfr at 0x8D TH1; -sfr at 0x8E CKCON; - /* CKCON */ - //sbit MD0 = 0x89+0; - //sbit MD1 = 0x89+1; - //sbit MD2 = 0x89+2; - //sbit T0M = 0x89+3; - //sbit T1M = 0x89+4; - //sbit T2M = 0x89+5; -// sfr at 0x8F SPC_FNC; // Was WRS in Reg320 - /* CKCON */ - //sbit WRS = 0x8F+0; -sfr at 0x90 IOB; -sfr at 0x91 EXIF; // EXIF Bit Values differ from Reg320 - /* EXIF */ - //sbit USBINT = 0x91+4; - //sbit I2CINT = 0x91+5; - //sbit IE4 = 0x91+6; - //sbit IE5 = 0x91+7; -sfr at 0x92 MPAGE; -sfr at 0x98 SCON0; - /* SCON0 */ - sbit at 0x98+0 RI; - sbit at 0x98+1 TI; - sbit at 0x98+2 RB8; - sbit at 0x98+3 TB8; - sbit at 0x98+4 REN; - sbit at 0x98+5 SM2; - sbit at 0x98+6 SM1; - sbit at 0x98+7 SM0; -sfr at 0x99 SBUF0; - -sfr at 0x9A APTR1H; -sfr at 0x9B APTR1L; -sfr at 0x9C AUTODAT1; -sfr at 0x9D AUTOPTRH2; -sfr at 0x9E AUTOPTRL2; -sfr at 0x9F AUTODAT2; -sfr at 0xA0 IOC; -sfr at 0xA1 INT2CLR; -sfr at 0xA2 INT4CLR; - -#define AUTOPTRH1 APTR1H -#define AUTOPTRL1 APTR1L - -sfr at 0xA8 IE; - /* IE */ - sbit at 0xA8+0 EX0; - sbit at 0xA8+1 ET0; - sbit at 0xA8+2 EX1; - sbit at 0xA8+3 ET1; - sbit at 0xA8+4 ES0; - sbit at 0xA8+5 ET2; - sbit at 0xA8+6 ES1; - sbit at 0xA8+7 EA; - -sfr at 0xAA EP2468STAT; - /* EP2468STAT */ - //sbit EP2E = 0xAA+0; - //sbit EP2F = 0xAA+1; - //sbit EP4E = 0xAA+2; - //sbit EP4F = 0xAA+3; - //sbit EP6E = 0xAA+4; - //sbit EP6F = 0xAA+5; - //sbit EP8E = 0xAA+6; - //sbit EP8F = 0xAA+7; - -sfr at 0xAB EP24FIFOFLGS; -sfr at 0xAC EP68FIFOFLGS; -sfr at 0xAF AUTOPTRSETUP; - /* AUTOPTRSETUP */ - // sbit EXTACC = 0xAF+0; - // sbit APTR1FZ = 0xAF+1; - // sbit APTR2FZ = 0xAF+2; - -sfr at 0xB0 IOD; -sfr at 0xB1 IOE; -sfr at 0xB2 OEA; -sfr at 0xB3 OEB; -sfr at 0xB4 OEC; -sfr at 0xB5 OED; -sfr at 0xB6 OEE; - -sfr at 0xB8 IP; - /* IP */ - sbit at 0xB8+0 PX0; - sbit at 0xB8+1 PT0; - sbit at 0xB8+2 PX1; - sbit at 0xB8+3 PT1; - sbit at 0xB8+4 PS0; - sbit at 0xB8+5 PT2; - sbit at 0xB8+6 PS1; - -sfr at 0xBA EP01STAT; -sfr at 0xBB GPIFTRIG; - -sfr at 0xBD GPIFSGLDATH; -sfr at 0xBE GPIFSGLDATLX; -sfr at 0xBF GPIFSGLDATLNOX; - -sfr at 0xC0 SCON1; - /* SCON1 */ - sbit at 0xC0+0 RI1; - sbit at 0xC0+1 TI1; - sbit at 0xC0+2 RB81; - sbit at 0xC0+3 TB81; - sbit at 0xC0+4 REN1; - sbit at 0xC0+5 SM21; - sbit at 0xC0+6 SM11; - sbit at 0xC0+7 SM01; -sfr at 0xC1 SBUF1; -sfr at 0xC8 T2CON; - /* T2CON */ - sbit at 0xC8+0 CP_RL2; - sbit at 0xC8+1 C_T2; - sbit at 0xC8+2 TR2; - sbit at 0xC8+3 EXEN2; - sbit at 0xC8+4 TCLK; - sbit at 0xC8+5 RCLK; - sbit at 0xC8+6 EXF2; - sbit at 0xC8+7 TF2; -sfr at 0xCA RCAP2L; -sfr at 0xCB RCAP2H; -sfr at 0xCC TL2; -sfr at 0xCD TH2; -sfr at 0xD0 PSW; - /* PSW */ - sbit at 0xD0+0 P; - sbit at 0xD0+1 FL; - sbit at 0xD0+2 OV; - sbit at 0xD0+3 RS0; - sbit at 0xD0+4 RS1; - sbit at 0xD0+5 F0; - sbit at 0xD0+6 AC; - sbit at 0xD0+7 CY; -sfr at 0xD8 EICON; // Was WDCON in DS80C320 EICON; Bit Values differ from Reg320 - /* EICON */ - sbit at 0xD8+3 INT6; - sbit at 0xD8+4 RESI; - sbit at 0xD8+5 ERESI; - sbit at 0xD8+7 SMOD1; -sfr at 0xE0 ACC; -sfr at 0xE8 EIE; // EIE Bit Values differ from Reg320 - /* EIE */ - sbit at 0xE8+0 EIUSB; - sbit at 0xE8+1 EI2C; - sbit at 0xE8+2 EIEX4; - sbit at 0xE8+3 EIEX5; - sbit at 0xE8+4 EIEX6; -sfr at 0xF0 B; -sfr at 0xF8 EIP; // EIP Bit Values differ from Reg320 - /* EIP */ - sbit at 0xF8+0 PUSB; - sbit at 0xF8+1 PI2C; - sbit at 0xF8+2 EIPX4; - sbit at 0xF8+3 EIPX5; - sbit at 0xF8+4 EIPX6; - -/*----------------------------------------------------------------------------- - Bit Masks ------------------------------------------------------------------------------*/ - -#define bmBIT0 1 -#define bmBIT1 2 -#define bmBIT2 4 -#define bmBIT3 8 -#define bmBIT4 16 -#define bmBIT5 32 -#define bmBIT6 64 -#define bmBIT7 128 - -/* CPU Control & Status Register (CPUCS) */ -#define bmPRTCSTB bmBIT5 -#define bmCLKSPD (bmBIT4 | bmBIT3) -#define bmCLKSPD1 bmBIT4 -#define bmCLKSPD0 bmBIT3 -#define bmCLKINV bmBIT2 -#define bmCLKOE bmBIT1 -#define bm8051RES bmBIT0 -/* Port Alternate Configuration Registers */ -/* Port A (PORTACFG) */ -#define bmFLAGD bmBIT7 -#define bmINT1 bmBIT1 -#define bmINT0 bmBIT0 -/* Port C (PORTCCFG) */ -#define bmGPIFA7 bmBIT7 -#define bmGPIFA6 bmBIT6 -#define bmGPIFA5 bmBIT5 -#define bmGPIFA4 bmBIT4 -#define bmGPIFA3 bmBIT3 -#define bmGPIFA2 bmBIT2 -#define bmGPIFA1 bmBIT1 -#define bmGPIFA0 bmBIT0 -/* Port E (PORTECFG) */ -#define bmGPIFA8 bmBIT7 -#define bmT2EX bmBIT6 -#define bmINT6 bmBIT5 -#define bmRXD1OUT bmBIT4 -#define bmRXD0OUT bmBIT3 -#define bmT2OUT bmBIT2 -#define bmT1OUT bmBIT1 -#define bmT0OUT bmBIT0 - -/* I2C Control & Status Register (I2CS) */ -#define bmSTART bmBIT7 -#define bmSTOP bmBIT6 -#define bmLASTRD bmBIT5 -#define bmID (bmBIT4 | bmBIT3) -#define bmBERR bmBIT2 -#define bmACK bmBIT1 -#define bmDONE bmBIT0 -/* I2C Control Register (I2CTL) */ -#define bmSTOPIE bmBIT1 -#define bm400KHZ bmBIT0 -/* Interrupt 2 (USB) Autovector Register (INT2IVEC) */ -#define bmIV4 bmBIT6 -#define bmIV3 bmBIT5 -#define bmIV2 bmBIT4 -#define bmIV1 bmBIT3 -#define bmIV0 bmBIT2 -/* USB Interrupt Request & Enable Registers (USBIE/USBIRQ) */ -#define bmEP0ACK bmBIT6 -#define bmHSGRANT bmBIT5 -#define bmURES bmBIT4 -#define bmSUSP bmBIT3 -#define bmSUTOK bmBIT2 -#define bmSOF bmBIT1 -#define bmSUDAV bmBIT0 -/* Breakpoint register (BREAKPT) */ -#define bmBREAK bmBIT3 -#define bmBPPULSE bmBIT2 -#define bmBPEN bmBIT1 -/* Interrupt 2 & 4 Setup (INTSETUP) */ -#define bmAV2EN bmBIT3 -#define bmINT4IN bmBIT1 -#define bmAV4EN bmBIT0 -/* USB Control & Status Register (USBCS) */ -#define bmHSM bmBIT7 -#define bmDISCON bmBIT3 -#define bmNOSYNSOF bmBIT2 -#define bmRENUM bmBIT1 -#define bmSIGRESUME bmBIT0 -/* Wakeup Control and Status Register (WAKEUPCS) */ -#define bmWU2 bmBIT7 -#define bmWU bmBIT6 -#define bmWU2POL bmBIT5 -#define bmWUPOL bmBIT4 -#define bmDPEN bmBIT2 -#define bmWU2EN bmBIT1 -#define bmWUEN bmBIT0 -/* End Point 0 Control & Status Register (EP0CS) */ -#define bmHSNAK bmBIT7 -/* End Point 0-1 Control & Status Registers (EP0CS/EP1OUTCS/EP1INCS) */ -#define bmEPBUSY bmBIT1 -#define bmEPSTALL bmBIT0 -/* End Point 2-8 Control & Status Registers (EP2CS/EP4CS/EP6CS/EP8CS) */ -#define bmNPAK (bmBIT6 | bmBIT5 | bmBIT4) -#define bmEPFULL bmBIT3 -#define bmEPEMPTY bmBIT2 -/* Endpoint Status (EP2468STAT) SFR bits */ -#define bmEP8FULL bmBIT7 -#define bmEP8EMPTY bmBIT6 -#define bmEP6FULL bmBIT5 -#define bmEP6EMPTY bmBIT4 -#define bmEP4FULL bmBIT3 -#define bmEP4EMPTY bmBIT2 -#define bmEP2FULL bmBIT1 -#define bmEP2EMPTY bmBIT0 -/* SETUP Data Pointer Auto Mode (SUDPTRCTL) */ -#define bmSDPAUTO bmBIT0 -/* Endpoint Data Toggle Control (TOGCTL) */ -#define bmQUERYTOGGLE bmBIT7 -#define bmSETTOGGLE bmBIT6 -#define bmRESETTOGGLE bmBIT5 -#define bmTOGCTLEPMASK bmBIT3 | bmBIT2 | bmBIT1 | bmBIT0 -/* IBN (In Bulk Nak) enable and request bits (IBNIE/IBNIRQ) */ -#define bmEP8IBN bmBIT5 -#define bmEP6IBN bmBIT4 -#define bmEP4IBN bmBIT3 -#define bmEP2IBN bmBIT2 -#define bmEP1IBN bmBIT1 -#define bmEP0IBN bmBIT0 - -/* PING-NAK enable and request bits (NAKIE/NAKIRQ) */ -#define bmEP8PING bmBIT7 -#define bmEP6PING bmBIT6 -#define bmEP4PING bmBIT5 -#define bmEP2PING bmBIT4 -#define bmEP1PING bmBIT3 -#define bmEP0PING bmBIT2 -#define bmIBN bmBIT0 - -/* Interface Configuration bits (IFCONFIG) */ -#define bmIFCLKSRC bmBIT7 // set == INTERNAL -#define bm3048MHZ bmBIT6 // set == 48 MHz -#define bmIFCLKOE bmBIT5 -#define bmIFCLKPOL bmBIT4 -#define bmASYNC bmBIT3 -#define bmGSTATE bmBIT2 -#define bmIFCFG1 bmBIT1 -#define bmIFCFG0 bmBIT0 -#define bmIFCFGMASK (bmIFCFG0 | bmIFCFG1) -#define bmIFGPIF bmIFCFG1 - -/* EP 2468 FIFO Configuration bits (EP2FIFOCFG,EP4FIFOCFG,EP6FIFOCFG,EP8FIFOCFG) */ -#define bmINFM bmBIT6 -#define bmOEP bmBIT5 -#define bmAUTOOUT bmBIT4 -#define bmAUTOIN bmBIT3 -#define bmZEROLENIN bmBIT2 -// must be zero bmBIT1 -#define bmWORDWIDE bmBIT0 - -/* - * Chip Revision Control Bits (REVCTL) - used to ebable/disable revision specific features - */ -#define bmNOAUTOARM bmBIT1 // these don't match the docs -#define bmSKIPCOMMIT bmBIT0 // these don't match the docs - -#define bmDYN_OUT bmBIT1 // these do... -#define bmENH_PKT bmBIT0 - - -/* Fifo Reset bits (FIFORESET) */ -#define bmNAKALL bmBIT7 - -/* Endpoint Configuration (EPxCFG) */ -#define bmVALID bmBIT7 -#define bmIN bmBIT6 -#define bmTYPE1 bmBIT5 -#define bmTYPE0 bmBIT4 -#define bmISOCHRONOUS bmTYPE0 -#define bmBULK bmTYPE1 -#define bmINTERRUPT (bmTYPE1 | bmTYPE0) -#define bm1KBUF bmBIT3 -#define bmBUF1 bmBIT1 -#define bmBUF0 bmBIT0 -#define bmQUADBUF 0 -#define bmINVALIDBUF bmBUF0 -#define bmDOUBLEBUF bmBUF1 -#define bmTRIPLEBUF (bmBUF1 | bmBUF0) - -/* OUTPKTEND */ -#define bmSKIP bmBIT7 // low 4 bits specify which end point - -/* GPIFTRIG defs */ -#define bmGPIF_IDLE bmBIT7 // status bit - -#define bmGPIF_EP2_START 0 -#define bmGPIF_EP4_START 1 -#define bmGPIF_EP6_START 2 -#define bmGPIF_EP8_START 3 -#define bmGPIF_READ bmBIT2 -#define bmGPIF_WRITE 0 - -/* EXIF bits */ -#define bmEXIF_USBINT bmBIT4 -#define bmEXIF_I2CINT bmBIT5 -#define bmEXIF_IE4 bmBIT6 -#define bmEXIF_IE5 bmBIT7 - - -#endif /* FX2REGS_H */ diff --git a/usrp/firmware/include/fx2utils.h b/usrp/firmware/include/fx2utils.h deleted file mode 100644 index b184dec27..000000000 --- a/usrp/firmware/include/fx2utils.h +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- c -*- */ -/* - * Copyright 2003 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 _FX2UTILS_H_ -#define _FX2UTILS_H_ - -void fx2_stall_ep0 (void); -void fx2_reset_data_toggle (unsigned char ep); -void fx2_renumerate (void); - - - -#endif /* _FX2UTILS_H_ */ diff --git a/usrp/firmware/include/generate_regs.py b/usrp/firmware/include/generate_regs.py deleted file mode 100755 index 656cd5e81..000000000 --- a/usrp/firmware/include/generate_regs.py +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env python - -import os, os.path -import re -import sys - - -# set srcdir to the directory that contains Makefile.am -try: - srcdir = os.environ['srcdir'] -except KeyError, e: - srcdir = "." -srcdir = srcdir + '/' - -def open_src (name, mode): - global srcdir - return open (os.path.join (srcdir, name), mode) - - -def generate_fpga_regs (h_filename, v_filename): - const_width = 7 # bit width of constants - - h_file = open_src (h_filename, 'r') - v_file = open (v_filename, 'w') - v_file.write ( - '''// -// This file is machine generated from %s -// Do not edit by hand; your edits will be overwritten. -// -''' % (h_filename,)) - - pat = re.compile (r'^#define\s*(FR_\w*)\s*(\w*)(.*)$') - pat_bitno = re.compile (r'^#define\s*(bitno\w*)\s*(\w*)(.*)$') - pat_bm = re.compile (r'^#define\s*(bm\w*)\s*(\w*)(.*)$') - for line in h_file: - if re.match ('//|\s*$', line): # comment or blank line - v_file.write (line) - mo = pat.search (line) - mo_bitno =pat_bitno.search (line) - mo_bm =pat_bm.search (line) - if mo: - v_file.write ('`define %-25s %d\'d%s%s\n' % ( - mo.group (1), const_width, mo.group (2), mo.group (3))) - elif mo_bitno: - v_file.write ('`define %-25s %s%s\n' % ( - mo_bitno.group (1), mo_bitno.group (2), mo_bitno.group (3))) - elif mo_bm: - v_file.write ('`define %-25s %s%s\n' % ( - mo_bm.group (1), mo_bm.group (2), mo_bm.group (3))) - - -if __name__ == '__main__': - if len (sys.argv) != 3: - sys.stderr.write ('usage: %s file.h file.v\n' % (sys.argv[0])) - sys.exit (1) - generate_fpga_regs (sys.argv[1], sys.argv[2]) - diff --git a/usrp/firmware/include/i2c.h b/usrp/firmware/include/i2c.h deleted file mode 100644 index 273526dad..000000000 --- a/usrp/firmware/include/i2c.h +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 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 _I2C_H_ -#define _I2C_H_ - -// returns non-zero if successful, else 0 -unsigned char i2c_read (unsigned char addr, xdata unsigned char *buf, unsigned char len); - -// returns non-zero if successful, else 0 -unsigned char i2c_write (unsigned char addr, xdata const unsigned char *buf, unsigned char len); - -#endif /* _I2C_H_ */ diff --git a/usrp/firmware/include/isr.h b/usrp/firmware/include/isr.h deleted file mode 100644 index 856532890..000000000 --- a/usrp/firmware/include/isr.h +++ /dev/null @@ -1,172 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 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 _ISR_H_ -#define _ISR_H_ - -/* - * ---------------------------------------------------------------- - * routines for managing interrupt services routines - * ---------------------------------------------------------------- - */ - -/* - * The FX2 has three discrete sets of interrupt vectors. - * The first set is the standard 8051 vector (13 8-byte entries). - * The second set is USB interrupt autovector (32 4-byte entries). - * The third set is the FIFO/GPIF autovector (14 4-byte entries). - * - * Since all the code we're running in the FX2 is ram based, we - * forego the typical "initialize the interrupt vectors at link time" - * strategy, in favor of calls at run time that install the correct - * pointers to functions. - */ - -/* - * Standard Vector numbers - */ - -#define SV_INT_0 0x03 -#define SV_TIMER_0 0x0b -#define SV_INT_1 0x13 -#define SV_TIMER_1 0x1b -#define SV_SERIAL_0 0x23 -#define SV_TIMER_2 0x2b -#define SV_RESUME 0x33 -#define SV_SERIAL_1 0x3b -#define SV_INT_2 0x43 // (INT_2) points at USB autovector -#define SV_I2C 0x4b -#define SV_INT_4 0x53 // (INT_4) points at FIFO/GPIF autovector -#define SV_INT_5 0x5b -#define SV_INT_6 0x63 - -#define SV_MIN SV_INT_0 -#define SV_MAX SV_INT_6 - -/* - * USB Auto Vector numbers - */ - -#define UV_SUDAV 0x00 -#define UV_SOF 0x04 -#define UV_SUTOK 0x08 -#define UV_SUSPEND 0x0c -#define UV_USBRESET 0x10 -#define UV_HIGHSPEED 0x14 -#define UV_EP0ACK 0x18 -#define UV_SPARE_1C 0x1c -#define UV_EP0IN 0x20 -#define UV_EP0OUT 0x24 -#define UV_EP1IN 0x28 -#define UV_EP1OUT 0x2c -#define UV_EP2 0x30 -#define UV_EP4 0x34 -#define UV_EP6 0x38 -#define UV_EP8 0x3c -#define UV_IBN 0x40 -#define UV_SPARE_44 0x44 -#define UV_EP0PINGNAK 0x48 -#define UV_EP1PINGNAK 0x4c -#define UV_EP2PINGNAK 0x50 -#define UV_EP4PINGNAK 0x54 -#define UV_EP6PINGNAK 0x58 -#define UV_EP8PINGNAK 0x5c -#define UV_ERRLIMIT 0x60 -#define UV_SPARE_64 0x64 -#define UV_SPARE_68 0x68 -#define UV_SPARE_6C 0x6c -#define UV_EP2ISOERR 0x70 -#define UV_EP4ISOERR 0x74 -#define UV_EP6ISOERR 0x78 -#define UV_EP8ISOERR 0x7c - -#define UV_MIN UV_SUDAV -#define UV_MAX UV_EP8ISOERR - -/* - * FIFO/GPIF Auto Vector numbers - */ - -#define FGV_EP2PF 0x00 -#define FGV_EP4PF 0x04 -#define FGV_EP6PF 0x08 -#define FGV_EP8PF 0x0c -#define FGV_EP2EF 0x10 -#define FGV_EP4EF 0x14 -#define FGV_EP6EF 0x18 -#define FGV_EP8EF 0x1c -#define FGV_EP2FF 0x20 -#define FGV_EP4FF 0x24 -#define FGV_EP6FF 0x28 -#define FGV_EP8FF 0x2c -#define FGV_GPIFDONE 0x30 -#define FGV_GPIFWF 0x34 - -#define FGV_MIN FGV_EP2PF -#define FGV_MAX FGV_GPIFWF - - -/* - * Hook standard interrupt vector. - * - * vector_number is from the SV_<foo> list above. - * addr is the address of the interrupt service routine. - */ -void hook_sv (unsigned char vector_number, unsigned short addr); - -/* - * Hook usb interrupt vector. - * - * vector_number is from the UV_<foo> list above. - * addr is the address of the interrupt service routine. - */ -void hook_uv (unsigned char vector_number, unsigned short addr); - -/* - * Hook fifo/gpif interrupt vector. - * - * vector_number is from the FGV_<foo> list above. - * addr is the address of the interrupt service routine. - */ -void hook_fgv (unsigned char vector_number, unsigned short addr); - -/* - * One time call to enable autovectoring for both USB and FIFO/GPIF - */ -void setup_autovectors (void); - - -/* - * Must be called in each usb interrupt handler - */ -#define clear_usb_irq() \ - EXIF &= ~bmEXIF_USBINT; \ - INT2CLR = 0 - -/* - * Must be calledin each fifo/gpif interrupt handler - */ -#define clear_fifo_gpif_irq() \ - EXIF &= ~bmEXIF_IE4; \ - INT4CLR = 0 - -#endif /* _ISR_H_ */ diff --git a/usrp/firmware/include/syncdelay.h b/usrp/firmware/include/syncdelay.h deleted file mode 100644 index 0af7d099f..000000000 --- a/usrp/firmware/include/syncdelay.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 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 _SYNCDELAY_H_ -#define _SYNCDELAY_H_ - -/* - * Magic delay required between access to certain xdata registers (TRM page 15-106). - * For our configuration, 48 MHz FX2 / 48 MHz IFCLK, we need three cycles. Each - * NOP is a single cycle.... - * - * From TRM page 15-105: - * - * Under certain conditions, some read and write access to the FX2 registers must - * be separated by a "synchronization delay". The delay is necessary only under the - * following conditions: - * - * - between a write to any register in the 0xE600 - 0xE6FF range and a write to one - * of the registers listed below. - * - * - between a write to one of the registers listed below and a read from any register - * in the 0xE600 - 0xE6FF range. - * - * Registers which require a synchronization delay: - * - * FIFORESET FIFOPINPOLAR - * INPKTEND EPxBCH:L - * EPxFIFOPFH:L EPxAUTOINLENH:L - * EPxFIFOCFG EPxGPIFFLGSEL - * PINFLAGSAB PINFLAGSCD - * EPxFIFOIE EPxFIFOIRQ - * GPIFIE GPIFIRQ - * UDMACRCH:L GPIFADRH:L - * GPIFTRIG EPxGPIFTRIG - * OUTPKTEND REVCTL - * GPIFTCB3 GPIFTCB2 - * GPIFTCB1 GPIFTCB0 - */ - -/* - * FIXME ensure that the peep hole optimizer isn't screwing us - */ -#define SYNCDELAY _asm nop; nop; nop; _endasm -#define NOP _asm nop; _endasm - - -#endif /* _SYNCDELAY_H_ */ diff --git a/usrp/firmware/include/timer.h b/usrp/firmware/include/timer.h deleted file mode 100644 index 3181874d5..000000000 --- a/usrp/firmware/include/timer.h +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 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 _TIMER_H_ -#define _TIMER_H_ - -/* - * Arrange to have isr_tick_handler called at 100 Hz - */ -void hook_timer_tick (unsigned short isr_tick_handler); - -#define clear_timer_irq() \ - TF2 = 0 /* clear overflow flag */ - - -#endif /* _TIMER_H_ */ diff --git a/usrp/firmware/include/usb_common.h b/usrp/firmware/include/usb_common.h deleted file mode 100644 index ae07b236c..000000000 --- a/usrp/firmware/include/usb_common.h +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- c -*- */ -/* - * Copyright 2003 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 _USB_COMMON_H_ -#define _USB_COMMON_H_ - -extern volatile bit _usb_got_SUDAV; - -// Provided by user application to handle VENDOR commands. -// returns non-zero if it handled the command. -unsigned char app_vendor_cmd (void); - -void usb_install_handlers (void); -void usb_handle_setup_packet (void); - -#define usb_setup_packet_avail() _usb_got_SUDAV - -#endif /* _USB_COMMON_H_ */ diff --git a/usrp/firmware/include/usb_descriptors.h b/usrp/firmware/include/usb_descriptors.h deleted file mode 100644 index 0b8c6212f..000000000 --- a/usrp/firmware/include/usb_descriptors.h +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 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. - */ - -extern xdata const char high_speed_device_descr[]; -extern xdata const char high_speed_devqual_descr[]; -extern xdata const char high_speed_config_descr[]; - -extern xdata const char full_speed_device_descr[]; -extern xdata const char full_speed_devqual_descr[]; -extern xdata const char full_speed_config_descr[]; - -extern xdata unsigned char nstring_descriptors; -extern xdata char * xdata string_descriptors[]; - -/* - * We patch these locations with info read from the usrp config eeprom - */ -extern xdata char usb_desc_hw_rev_binary_patch_location_0[]; -extern xdata char usb_desc_hw_rev_binary_patch_location_1[]; -extern xdata char usb_desc_hw_rev_ascii_patch_location_0[]; -extern xdata char usb_desc_serial_number_ascii[]; diff --git a/usrp/firmware/include/usb_requests.h b/usrp/firmware/include/usb_requests.h deleted file mode 100644 index 7a543abb0..000000000 --- a/usrp/firmware/include/usb_requests.h +++ /dev/null @@ -1,88 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 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. - */ - -// Standard USB requests. -// These are contained in end point 0 setup packets - - -#ifndef _USB_REQUESTS_H_ -#define _USB_REQUESTS_H_ - -// format of bmRequestType byte - -#define bmRT_DIR_MASK (0x1 << 7) -#define bmRT_DIR_IN (1 << 7) -#define bmRT_DIR_OUT (0 << 7) - -#define bmRT_TYPE_MASK (0x3 << 5) -#define bmRT_TYPE_STD (0 << 5) -#define bmRT_TYPE_CLASS (1 << 5) -#define bmRT_TYPE_VENDOR (2 << 5) -#define bmRT_TYPE_RESERVED (3 << 5) - -#define bmRT_RECIP_MASK (0x1f << 0) -#define bmRT_RECIP_DEVICE (0 << 0) -#define bmRT_RECIP_INTERFACE (1 << 0) -#define bmRT_RECIP_ENDPOINT (2 << 0) -#define bmRT_RECIP_OTHER (3 << 0) - - -// standard request codes (bRequest) - -#define RQ_GET_STATUS 0 -#define RQ_CLEAR_FEATURE 1 -#define RQ_RESERVED_2 2 -#define RQ_SET_FEATURE 3 -#define RQ_RESERVED_4 4 -#define RQ_SET_ADDRESS 5 -#define RQ_GET_DESCR 6 -#define RQ_SET_DESCR 7 -#define RQ_GET_CONFIG 8 -#define RQ_SET_CONFIG 9 -#define RQ_GET_INTERFACE 10 -#define RQ_SET_INTERFACE 11 -#define RQ_SYNCH_FRAME 12 - -// standard descriptor types - -#define DT_DEVICE 1 -#define DT_CONFIG 2 -#define DT_STRING 3 -#define DT_INTERFACE 4 -#define DT_ENDPOINT 5 -#define DT_DEVQUAL 6 -#define DT_OTHER_SPEED 7 -#define DT_INTERFACE_POWER 8 - -// standard feature selectors - -#define FS_ENDPOINT_HALT 0 // recip: endpoint -#define FS_DEV_REMOTE_WAKEUP 1 // recip: device -#define FS_TEST_MODE 2 // recip: device - -// Get Status device attributes - -#define bmGSDA_SELF_POWERED 0x01 -#define bmGSDA_REM_WAKEUP 0x02 - - -#endif /* _USB_REQUESTS_H_ */ diff --git a/usrp/firmware/include/usrp_commands.h b/usrp/firmware/include/usrp_commands.h deleted file mode 100644 index 20c28e264..000000000 --- a/usrp/firmware/include/usrp_commands.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * USRP - Universal Software Radio Peripheral - * - * Copyright (C) 2003,2004 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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, Boston, MA 02110-1301 USA - */ - -#ifndef _USRP_COMMANDS_H_ -#define _USRP_COMMANDS_H_ - -#include <usrp_interfaces.h> -#include <usrp_spi_defs.h> - -#define MAX_EP0_PKTSIZE 64 // max size of EP0 packet on FX2 - -// ---------------------------------------------------------------- -// Vendor bmRequestType's -// ---------------------------------------------------------------- - -#define VRT_VENDOR_IN 0xC0 -#define VRT_VENDOR_OUT 0x40 - -// ---------------------------------------------------------------- -// USRP Vendor Requests -// -// Note that Cypress reserves [0xA0,0xAF]. -// 0xA0 is the firmware load function. -// ---------------------------------------------------------------- - - -// IN commands - -#define VRQ_GET_STATUS 0x80 -#define GS_TX_UNDERRUN 0 // wIndexL // returns 1 byte -#define GS_RX_OVERRUN 1 // wIndexL // returns 1 byte - -#define VRQ_I2C_READ 0x81 // wValueL: i2c address; length: how much to read - -#define VRQ_SPI_READ 0x82 // wValue: optional header bytes - // wIndexH: enables - // wIndexL: format - // len: how much to read - -// OUT commands - -#define VRQ_SET_LED 0x01 // wValueL off/on {0,1}; wIndexL: which {0,1} - -#define VRQ_FPGA_LOAD 0x02 -# define FL_BEGIN 0 // wIndexL: begin fpga programming cycle. stalls if trouble. -# define FL_XFER 1 // wIndexL: xfer up to 64 bytes of data -# define FL_END 2 // wIndexL: end programming cycle, check for success. - // stalls endpoint if trouble. - -#define VRQ_FPGA_WRITE_REG 0x03 // wIndexL: regno; data: 32-bit regval MSB first -#define VRQ_FPGA_SET_RESET 0x04 // wValueL: {0,1} -#define VRQ_FPGA_SET_TX_ENABLE 0x05 // wValueL: {0,1} -#define VRQ_FPGA_SET_RX_ENABLE 0x06 // wValueL: {0,1} -// see below VRQ_FPGA_SET_{TX,RX}_RESET - -#define VRQ_SET_SLEEP_BITS 0x07 // wValueH: mask; wValueL: bits. set bits given by mask to bits - -# define SLEEP_ADC0 0x01 -# define SLEEP_ADC1 0x02 -# define SLEEP_DAC0 0x04 -# define SLEEP_DAC1 0x08 - -#define VRQ_I2C_WRITE 0x08 // wValueL: i2c address; data: data - -#define VRQ_SPI_WRITE 0x09 // wValue: optional header bytes - // wIndexH: enables - // wIndexL: format - // len: how much to write - -#define VRQ_FPGA_SET_TX_RESET 0x0a // wValueL: {0, 1} -#define VRQ_FPGA_SET_RX_RESET 0x0b // wValueL: {0, 1} - - -// ------------------------------------------------------------------- -// we store the hashes at fixed addresses in the FX2 internal memory - -#define USRP_HASH_SLOT_0_ADDR 0xe1e0 -#define USRP_HASH_SLOT_1_ADDR 0xe1f0 - - - -#endif /* _USRP_COMMANDS_H_ */ diff --git a/usrp/firmware/include/usrp_config.h b/usrp/firmware/include/usrp_config.h deleted file mode 100644 index e77f8e4c5..000000000 --- a/usrp/firmware/include/usrp_config.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * USRP - Universal Software Radio Peripheral - * - * Copyright (C) 2003 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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, Boston, MA 02110-1301 USA - */ - -/* - * configuration stuff for debugging - */ - -/* - * Define to 0 for normal use of port A, i.e., FPGA control bus. - * Define to 1 to write trace to port A for scoping with logic analyzer. - */ -#define UC_TRACE_USING_PORT_A 0 - - -/* - * Define to 0 for normal use of low 3 bits of port E, i.e., A/D, D/A SLEEP bits. - * Define to 1 to enable by default driving the GPIF state to the - * low three bits of port E. - */ -#define UC_START_WITH_GSTATE_OUTPUT_ENABLED 0 - - -/* - * Define to 1 for normal use (the board really has an FPGA on it). - * Define to 0 for debug use on board without FPGA. - */ -#define UC_BOARD_HAS_FPGA 1 diff --git a/usrp/firmware/include/usrp_i2c_addr.h b/usrp/firmware/include/usrp_i2c_addr.h deleted file mode 100644 index 0a4f3ea59..000000000 --- a/usrp/firmware/include/usrp_i2c_addr.h +++ /dev/null @@ -1,78 +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_I2C_ADDR_H -#define INCLUDED_USRP_I2C_ADDR_H - -// I2C addresses - -#define I2C_DEV_EEPROM 0x50 // 24LC02[45]: 7-bits 1010xxx - -#define I2C_ADDR_BOOT (I2C_DEV_EEPROM | 0x0) -#define I2C_ADDR_TX_A (I2C_DEV_EEPROM | 0x4) -#define I2C_ADDR_RX_A (I2C_DEV_EEPROM | 0x5) -#define I2C_ADDR_TX_B (I2C_DEV_EEPROM | 0x6) -#define I2C_ADDR_RX_B (I2C_DEV_EEPROM | 0x7) - - -// format of FX2 BOOT EEPROM -// 00: 0xC0 code for ``Read IDs from EEPROM'' -// 01: 0xFE USB Vendor ID (LSB) -// 02: 0xFF USB Vendor ID (MSB) -// 03: 0x02 USB Product ID (LSB) -// 04: 0x00 USB Product ID (MSB) -// 05: 0x01 USB Device ID (LSB) // rev1 -// 06: 0x00 USB Device ID (MSB) // 0 = unconfig'd (no firmware) -// 07: 0x00 option byte - - -// format of daughterboard EEPROM -// 00: 0xDB code for ``I'm a daughterboard'' -// 01: .. Daughterboard ID (LSB) -// 02: .. Daughterboard ID (MSB) -// 03: .. io bits 7-0 direction (bit set if it's an output from m'board) -// 04: .. io bits 15-8 direction (bit set if it's an output from m'board) -// 05: .. ADC0 DC offset correction (LSB) -// 06: .. ADC0 DC offset correction (MSB) -// 07: .. ADC1 DC offset correction (LSB) -// 08: .. ADC1 DC offset correction (MSB) -// ... -// 1f: .. negative of the sum of bytes [0x00, 0x1e] - -#define DB_EEPROM_MAGIC 0x00 -#define DB_EEPROM_MAGIC_VALUE 0xDB -#define DB_EEPROM_ID_LSB 0x01 -#define DB_EEPROM_ID_MSB 0x02 -#define DB_EEPROM_OE_LSB 0x03 -#define DB_EEPROM_OE_MSB 0x04 -#define DB_EEPROM_OFFSET_0_LSB 0x05 // offset correction for ADC or DAC 0 -#define DB_EEPROM_OFFSET_0_MSB 0x06 -#define DB_EEPROM_OFFSET_1_LSB 0x07 // offset correction for ADC or DAC 1 -#define DB_EEPROM_OFFSET_1_MSB 0x08 -#define DB_EEPROM_CHKSUM 0x1f - -#define DB_EEPROM_CLEN 0x20 // length of common portion of eeprom - -#define DB_EEPROM_CUSTOM_BASE DB_EEPROM_CLEN // first avail offset for - // daughterboard specific use - -#endif /* INCLUDED_USRP_I2C_ADDR_H */ - diff --git a/usrp/firmware/include/usrp_ids.h b/usrp/firmware/include/usrp_ids.h deleted file mode 100644 index 159151ea9..000000000 --- a/usrp/firmware/include/usrp_ids.h +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003,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. - */ - -/* - * USB Vendor and Product IDs that we use - * - * (keep in sync with usb_descriptors.a51) - */ - -#ifndef _USRP_IDS_H_ -#define _USRP_IDS_H_ - -#define USB_VID_CYPRESS 0x04b4 -#define USB_PID_CYPRESS_FX2 0x8613 - - -#define USB_VID_FSF 0xfffe // Free Software Folks -#define USB_PID_FSF_EXP_0 0x0000 // Experimental 0 -#define USB_PID_FSF_EXP_1 0x0001 // Experimental 1 -#define USB_PID_FSF_USRP 0x0002 // Universal Software Radio Peripheral -#define USB_PID_FSF_USRP_reserved 0x0003 // Universal Software Radio Peripheral -#define USB_PID_FSF_SSRP 0x0004 // Simple Software Radio Peripheral -#define USB_PID_FSF_SSRP_reserved 0x0005 // Simple Software Radio Peripheral -#define USB_PID_FSF_HPSDR 0x0006 // High Performance Software Defined Radio (Internal Boot) -#define USB_PID_FSF_HPSDR_HA 0x0007 // High Performance Software Defined Radio (Host Assisted Boot) -#define USB_PID_FSF_QS1R 0x0008 // QS1R HF receiver -#define USB_PID_FSF_EZDOP 0x0009 // ezdop <jcorgan@aeinet.com> -#define USB_PID_FSF_BDALE_Development 0x000a // Bdale Garbee <bdale@gag.com> -#define USB_PID_FSF_BDALE_TeleMetrum 0x000b // Bdale Garbee <bdale@gag.com> -#define USB_PID_FSF_BDALE_TeleDongle 0x000c // Bdale Garbee <bdale@gag.com> -#define USB_PID_FSF_BDALE_TeleTerra 0x000d // Bdale Garbee <bdale@gag.com> -#define USB_PID_FSF_BDALE_TeleBT 0x000e // Bdale Garbee <bdale@gag.com> -#define USB_PID_FSF_BDALE_TeleLaunch 0x000f // Bdale Garbee <bdale@gag.com> -#define USB_PID_FSF_BDALE_TeleLCO 0x0010 // Bdale Garbee <bdale@gag.com> -#define USB_PID_FSF_BDALE_TeleScience 0x0011 // Bdale Garbee <bdale@gag.com> -#define USB_PID_FSF_BDALE_TelePyro 0x0012 // Bdale Garbee <bdale@gag.com> -#define USB_PID_FSF_BDALE_9 0x0013 // Bdale Garbee <bdale@gag.com> -#define USB_PID_FSF_HPSDR_HERMES 0x0014 // HPSDR Hermes -#define USB_PID_FSF_THINKRF 0x0015 // Catalin Patulea <catalin.patulea@thinkrf.com> -#define USB_PID_FSF_MSA 0x0016 // Hans de Bok <hdbok@dionaea.demon.nl> Scotty's Modular Spectrum Analyzer - -#define USB_PID_FSF_LBNL_UXO 0x0018 // http://recycle.lbl.gov/~ldoolitt/uxo/ -#define USB_PID_FSF_BDALE_10 0x0019 // Bdale Garbee <bdale@gag.com> -#define USB_PID_FSF_BDALE_11 0x001a // Bdale Garbee <bdale@gag.com> -#define USB_PID_FSF_BDALE_12 0x001b // Bdale Garbee <bdale@gag.com> -#define USB_PID_FSF_BDALE_13 0x001c // Bdale Garbee <bdale@gag.com> -#define USB_PID_FSF_BDALE_14 0x001d // Bdale Garbee <bdale@gag.com> -#define USB_PID_FSF_BDALE_15 0x001e // Bdale Garbee <bdale@gag.com> -#define USB_PID_FSF_BDALE_16 0x001f // Bdale Garbee <bdale@gag.com> -#define USB_PID_FSF_BDALE_17 0x0020 // Bdale Garbee <bdale@gag.com> -#define USB_PID_FSF_BDALE_18 0x0021 // Bdale Garbee <bdale@gag.com> -#define USB_PID_FSF_BDALE_19 0x0022 // Bdale Garbee <bdale@gag.com> - - -#define USB_DID_USRP_0 0x0000 // unconfigured rev 0 USRP -#define USB_DID_USRP_1 0x0001 // unconfigured rev 1 USRP -#define USB_DID_USRP_2 0x0002 // unconfigured rev 2 USRP - -#endif /* _USRP_IDS_H_ */ diff --git a/usrp/firmware/include/usrp_interfaces.h b/usrp/firmware/include/usrp_interfaces.h deleted file mode 100644 index 8666e0490..000000000 --- a/usrp/firmware/include/usrp_interfaces.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 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 _USRP_INTERFACES_H_ -#define _USRP_INTERFACES_H_ - -/* - * We've now split the USRP into 3 separate interfaces. - * - * Interface 0 contains only ep0 and is used for command and status. - * Interface 1 is the Tx path and it uses ep2 OUT BULK. - * Interface 2 is the Rx path and it uses ep6 IN BULK. - */ - -#define USRP_CMD_INTERFACE 0 -#define USRP_CMD_ALTINTERFACE 0 -#define USRP_CMD_ENDPOINT 0 - -#define USRP_TX_INTERFACE 1 -#define USRP_TX_ALTINTERFACE 0 -#define USRP_TX_ENDPOINT 2 // streaming data from host to FPGA - -#define USRP_RX_INTERFACE 2 -#define USRP_RX_ALTINTERFACE 0 -#define USRP_RX_ENDPOINT 6 // streaming data from FPGA to host - - -#endif /* _USRP_INTERFACES_H_ */ diff --git a/usrp/firmware/include/usrp_spi_defs.h b/usrp/firmware/include/usrp_spi_defs.h deleted file mode 100644 index 963463ef2..000000000 --- a/usrp/firmware/include/usrp_spi_defs.h +++ /dev/null @@ -1,86 +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_SPI_DEFS_H -#define INCLUDED_USRP_SPI_DEFS_H - -/* - * defines for the VRQ_SPI_READ and VRQ_SPI_WRITE commands - * - * SPI == "Serial Port Interface". SPI is a 3 wire bus plus a - * separate enable for each peripheral. The common lines are SCLK, - * SDI and SDO. The FX2 always drives SCLK and SDI, the clock and - * data lines from the FX2 to the peripheral. When enabled, a - * peripheral may drive SDO, the data line from the peripheral to the - * FX2. - * - * The SPI_READ and SPI_WRITE commands are formatted identically. - * Each specifies which peripherals to enable, whether the bits should - * be transmistted Most Significant Bit first or Least Significant Bit - * first, the number of bytes in the optional header, and the number - * of bytes to read or write in the body. - * - * The body is limited to 64 bytes. The optional header may contain - * 0, 1 or 2 bytes. For an SPI_WRITE, the header bytes are - * transmitted to the peripheral followed by the the body bytes. For - * an SPI_READ, the header bytes are transmitted to the peripheral, - * then len bytes are read back from the peripheral. - */ - -/* - * SPI_FMT_* goes in wIndexL - */ -#define SPI_FMT_xSB_MASK (1 << 7) -# define SPI_FMT_LSB (1 << 7) // least signficant bit first -# define SPI_FMT_MSB (0 << 7) // most significant bit first -#define SPI_FMT_HDR_MASK (3 << 5) -# define SPI_FMT_HDR_0 (0 << 5) // 0 header bytes -# define SPI_FMT_HDR_1 (1 << 5) // 1 header byte -# define SPI_FMT_HDR_2 (2 << 5) // 2 header bytes - -/* - * SPI_ENABLE_* goes in wIndexH - * - * For the software interface, the enables are active high. - * For reads, it's an error to have more than one enable set. - * - * [FWIW, the hardware implements them as active low. Don't change the - * definitions of these. They are related to usrp_rev1_regs.h] - */ -#define SPI_ENABLE_FPGA 0x01 // select FPGA -#define SPI_ENABLE_CODEC_A 0x02 // select AD9862 A -#define SPI_ENABLE_CODEC_B 0x04 // select AD9862 B -#define SPI_ENABLE_reserved 0x08 -#define SPI_ENABLE_TX_A 0x10 // select d'board TX A -#define SPI_ENABLE_RX_A 0x20 // select d'board RX A -#define SPI_ENABLE_TX_B 0x40 // select d'board TX B -#define SPI_ENABLE_RX_B 0x80 // select d'board RX B - -/* - * If there's one header byte, it goes in wValueL. - * - * If there are two header bytes, they go in wValueH | wValueL. - * The transmit order of the bytes (and bits within them) is - * determined by SPI_FMT_*SB - */ - -#endif /* INCLUDED_USRP_SPI_DEFS_H */ diff --git a/usrp/firmware/lib/.gitignore b/usrp/firmware/lib/.gitignore deleted file mode 100644 index 04f253234..000000000 --- a/usrp/firmware/lib/.gitignore +++ /dev/null @@ -1,18 +0,0 @@ -/*.ihx -/*.lnk -/*.lst -/*.map -/*.mem -/*.rel -/*.rst -/*.sym -/blink_leds.asm -/usrp_common.asm -/command_loop.asm -/fpga.asm -/*.asm -/usrp_gpif.c -/usrp_gpif_inline.h -/*.lib -/Makefile -/Makefile.in diff --git a/usrp/firmware/lib/Makefile.am b/usrp/firmware/lib/Makefile.am deleted file mode 100644 index a6790f010..000000000 --- a/usrp/firmware/lib/Makefile.am +++ /dev/null @@ -1,79 +0,0 @@ -# -# Copyright 2003 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. -# - -EXTRA_DIST = \ - delay.c \ - fx2utils.c \ - i2c.c \ - isr.c \ - timer.c \ - usb_common.c - - - -DEFINES= -FW_INCLUDES=-I$(top_srcdir)/usrp/firmware/include - -# with EA = 0, the FX2 implements a portion of the 8051 "external memory" -# on chip. This memory is mapped like this: -# -# The bottom 8K of memory (0x0000 - 0x1fff) is used for both data and -# code accesses. There's also 512 bytes for data only from 0xe000 - 0xe1ff. -# -# We tell the linker to start the xdata segment at 0x1800, 6K up from -# the bottom. - -LINKOPTS = --code-loc 0x0000 --code-size 0x1800 --xram-loc 0x1800 --xram-size 0x0800 - -LIBRARY = libfx2.lib - -LIBOBJS = \ - delay.rel \ - fx2utils.rel \ - i2c.rel \ - isr.rel \ - timer.rel \ - usb_common.rel - - - -all: libfx2.lib - -.c.rel: - $(XCC) $(FW_INCLUDES) $(DEFINES) -c $< -o $@ - -$(LIBRARY): $(LIBOBJS) - -rm -f $(LIBRARY) - touch $(LIBRARY) - for obj in $(LIBOBJS); do basename $$obj .rel >> $(LIBRARY) ; done - - -CLEANFILES = \ - *.ihx *.lnk *.lst *.map *.mem *.rel *.rst *.sym *.asm *.lib - -DISTCLEANFILES = \ - *.ihx *.lnk *.lst *.map *.mem *.rel *.rst *.sym *.asm *.lib - -install: all - - -# dependencies - diff --git a/usrp/firmware/lib/delay.c b/usrp/firmware/lib/delay.c deleted file mode 100644 index 13cf0eec8..000000000 --- a/usrp/firmware/lib/delay.c +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 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. - */ - -/* - * Delay approximately 1 microsecond (including overhead in udelay). - */ -static void -udelay1 (void) _naked -{ - _asm ; lcall that got us here took 4 bus cycles - ret ; 4 bus cycles - _endasm; -} - -/* - * delay for approximately usecs microseconds - */ -void -udelay (unsigned char usecs) -{ - do { - udelay1 (); - } while (--usecs != 0); -} - - -/* - * Delay approximately 1 millisecond. - * We're running at 48 MHz, so we need 48,000 clock cycles. - * - * Note however, that each bus cycle takes 4 clock cycles (not obvious, - * but explains the factor of 4 problem below). - */ -static void -mdelay1 (void) _naked -{ - _asm - mov dptr,#(-1200 & 0xffff) -002$: - inc dptr ; 3 bus cycles - mov a, dpl ; 2 bus cycles - orl a, dph ; 2 bus cycles - jnz 002$ ; 3 bus cycles - - ret - _endasm; -} - -void -mdelay (unsigned int msecs) -{ - do { - mdelay1 (); - } while (--msecs != 0); -} - - diff --git a/usrp/firmware/lib/fx2utils.c b/usrp/firmware/lib/fx2utils.c deleted file mode 100644 index 64ffcc896..000000000 --- a/usrp/firmware/lib/fx2utils.c +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 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 "fx2utils.h" -#include "fx2regs.h" -#include "delay.h" - -void -fx2_stall_ep0 (void) -{ - EP0CS |= bmEPSTALL; -} - -void -fx2_reset_data_toggle (unsigned char ep) -{ - TOGCTL = ((ep & 0x80) >> 3 | (ep & 0x0f)); - TOGCTL |= bmRESETTOGGLE; -} - -void -fx2_renumerate (void) -{ - USBCS |= bmDISCON | bmRENUM; - - // mdelay (1500); // FIXME why 1.5 seconds? - mdelay (250); // FIXME why 1.5 seconds? - - USBIRQ = 0xff; // clear any pending USB irqs... - EPIRQ = 0xff; // they're from before the renumeration - - EXIF &= ~bmEXIF_USBINT; - - USBCS &= ~bmDISCON; // reconnect USB -} diff --git a/usrp/firmware/lib/i2c-compiler-bug.c b/usrp/firmware/lib/i2c-compiler-bug.c deleted file mode 100644 index 360b779bc..000000000 --- a/usrp/firmware/lib/i2c-compiler-bug.c +++ /dev/null @@ -1,129 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 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 "i2c.h" -#include "fx2regs.h" -#include <string.h> - - -// issue a stop bus cycle and wait for completion - - -// returns non-zero if successful, else 0 -unsigned char -i2c_read (unsigned char addr, xdata unsigned char *buf, unsigned char len) -{ - volatile unsigned char junk; - - if (len == 0) // reading zero bytes always works - return 1; - - // memset (buf, 0, len); // FIXME, remove - - while (I2CS & bmSTOP) // wait for stop to clear - ; - - - I2CS = bmSTART; - I2DAT = (addr << 1) | 1; // write address and direction (1's the read bit) - - while ((I2CS & bmDONE) == 0) - ; - - if ((I2CS & bmBERR) || (I2CS & bmACK) == 0) // no device answered... - goto fail; - - if (len == 1) - I2CS |= bmLASTRD; - - junk = I2DAT; // trigger the first read cycle - -#if 1 - while (len != 1){ - while ((I2CS & bmDONE) == 0) - ; - - if (I2CS & bmBERR) - goto fail; - - len--; - if (len == 1) - I2CS |= bmLASTRD; - - *buf++ = I2DAT; // get data, trigger another read - } -#endif - - // wait for final byte - - while ((I2CS & bmDONE) == 0) - ; - - if (I2CS & bmBERR) - goto fail; - - I2CS |= bmSTOP; - *buf = I2DAT; - - return 1; - - fail: - I2CS |= bmSTOP; - return 0; -} - - - -// returns non-zero if successful, else 0 -unsigned char -i2c_write (unsigned char addr, xdata const unsigned char *buf, unsigned char len) -{ - while (I2CS & bmSTOP) // wait for stop to clear - ; - - I2CS = bmSTART; - I2DAT = (addr << 1) | 0; // write address and direction (0's the write bit) - - while ((I2CS & bmDONE) == 0) - ; - - if ((I2CS & bmBERR) || (I2CS & bmACK) == 0) // no device answered... - goto fail; - - while (len > 0){ - I2DAT = *buf++; - len--; - - while ((I2CS & bmDONE) == 0) - ; - - if ((I2CS & bmBERR) || (I2CS & bmACK) == 0) // no device answered... - goto fail; - } - - I2CS |= bmSTOP; - return 1; - - fail: - I2CS |= bmSTOP; - return 0; -} diff --git a/usrp/firmware/lib/i2c.c b/usrp/firmware/lib/i2c.c deleted file mode 100644 index 0f238b5cf..000000000 --- a/usrp/firmware/lib/i2c.c +++ /dev/null @@ -1,123 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 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 "i2c.h" -#include "fx2regs.h" -#include <string.h> - - -// issue a stop bus cycle and wait for completion - - -// returns non-zero if successful, else 0 -unsigned char -i2c_read (unsigned char addr, xdata unsigned char *buf, unsigned char len) -{ - volatile unsigned char junk; - - if (len == 0) // reading zero bytes always works - return 1; - - while (I2CS & bmSTOP) // wait for stop to clear - ; - - I2CS = bmSTART; - I2DAT = (addr << 1) | 1; // write address and direction (1's the read bit) - - while ((I2CS & bmDONE) == 0) - ; - - if ((I2CS & bmBERR) || (I2CS & bmACK) == 0) // no device answered... - goto fail; - - if (len == 1) - I2CS |= bmLASTRD; - - junk = I2DAT; // trigger the first read cycle - - while (--len != 0){ - while ((I2CS & bmDONE) == 0) - ; - - if (I2CS & bmBERR) - goto fail; - - if (len == 1) - I2CS |= bmLASTRD; - - *buf++ = I2DAT; // get data, trigger another read - } - - // wait for final byte - - while ((I2CS & bmDONE) == 0) - ; - - if (I2CS & bmBERR) - goto fail; - - I2CS |= bmSTOP; - *buf = I2DAT; - - return 1; - - fail: - I2CS |= bmSTOP; - return 0; -} - - - -// returns non-zero if successful, else 0 -unsigned char -i2c_write (unsigned char addr, xdata const unsigned char *buf, unsigned char len) -{ - while (I2CS & bmSTOP) // wait for stop to clear - ; - - I2CS = bmSTART; - I2DAT = (addr << 1) | 0; // write address and direction (0's the write bit) - - while ((I2CS & bmDONE) == 0) - ; - - if ((I2CS & bmBERR) || (I2CS & bmACK) == 0) // no device answered... - goto fail; - - while (len > 0){ - I2DAT = *buf++; - len--; - - while ((I2CS & bmDONE) == 0) - ; - - if ((I2CS & bmBERR) || (I2CS & bmACK) == 0) // no device answered... - goto fail; - } - - I2CS |= bmSTOP; - return 1; - - fail: - I2CS |= bmSTOP; - return 0; -} diff --git a/usrp/firmware/lib/isr.c b/usrp/firmware/lib/isr.c deleted file mode 100644 index 05412daf5..000000000 --- a/usrp/firmware/lib/isr.c +++ /dev/null @@ -1,167 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 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 "isr.h" -#include "fx2regs.h" -#include "syncdelay.h" - -extern xdata unsigned char _standard_interrupt_vector[]; -extern xdata unsigned char _usb_autovector[]; -extern xdata unsigned char _fifo_gpif_autovector[]; - -#define LJMP_OPCODE 0x02 - -/* - * Hook standard interrupt vector. - * - * vector_number is from the SV_<foo> list. - * addr is the address of the interrupt service routine. - */ -void -hook_sv (unsigned char vector_number, unsigned short addr) -{ - bit t; - - // sanity checks - - if (vector_number < SV_MIN || vector_number > SV_MAX) - return; - - if ((vector_number & 0x0f) != 0x03 && (vector_number & 0x0f) != 0x0b) - return; - - t = EA; - EA = 0; - _standard_interrupt_vector[vector_number] = LJMP_OPCODE; - _standard_interrupt_vector[vector_number + 1] = addr >> 8; - _standard_interrupt_vector[vector_number + 2] = addr & 0xff; - EA = t; -} - -/* - * Hook usb interrupt vector. - * - * vector_number is from the UV_<foo> list. - * addr is the address of the interrupt service routine. - */ -void -hook_uv (unsigned char vector_number, unsigned short addr) -{ - bit t; - - // sanity checks - - if (vector_number < UV_MIN || vector_number > UV_MAX) - return; - - if ((vector_number & 0x3) != 0) - return; - - t = EA; - EA = 0; - _usb_autovector[vector_number] = LJMP_OPCODE; - _usb_autovector[vector_number + 1] = addr >> 8; - _usb_autovector[vector_number + 2] = addr & 0xff; - EA = t; -} - -/* - * Hook fifo/gpif interrupt vector. - * - * vector_number is from the FGV_<foo> list. - * addr is the address of the interrupt service routine. - */ -void -hook_fgv (unsigned char vector_number, unsigned short addr) -{ - bit t; - - // sanity checks - - if (vector_number < FGV_MIN || vector_number > FGV_MAX) - return; - - if ((vector_number & 0x3) != 0) - return; - - t = EA; - EA = 0; - _fifo_gpif_autovector[vector_number] = LJMP_OPCODE; - _fifo_gpif_autovector[vector_number + 1] = addr >> 8; - _fifo_gpif_autovector[vector_number + 2] = addr & 0xff; - EA = t; -} - -/* - * One time call to enable autovectoring for both USB and FIFO/GPIF. - * - * This disables all USB and FIFO/GPIF interrupts and clears - * any pending interrupts too. It leaves the master USB and FIFO/GPIF - * interrupts enabled. - */ -void -setup_autovectors (void) -{ - // disable master usb and fifo/gpif interrupt enables - EIUSB = 0; - EIEX4 = 0; - - hook_sv (SV_INT_2, (unsigned short) _usb_autovector); - hook_sv (SV_INT_4, (unsigned short) _fifo_gpif_autovector); - - // disable all fifo interrupt enables - SYNCDELAY; - EP2FIFOIE = 0; SYNCDELAY; - EP4FIFOIE = 0; SYNCDELAY; - EP6FIFOIE = 0; SYNCDELAY; - EP8FIFOIE = 0; SYNCDELAY; - - // clear all pending fifo irqs - EP2FIFOIRQ = 0xff; SYNCDELAY; - EP4FIFOIRQ = 0xff; SYNCDELAY; - EP6FIFOIRQ = 0xff; SYNCDELAY; - EP8FIFOIRQ = 0xff; SYNCDELAY; - - IBNIE = 0; - IBNIRQ = 0xff; - NAKIE = 0; - NAKIRQ = 0xff; - USBIE = 0; - USBIRQ = 0xff; - EPIE = 0; - EPIRQ = 0xff; - SYNCDELAY; GPIFIE = 0; - SYNCDELAY; GPIFIRQ = 0xff; - USBERRIE = 0; - USBERRIRQ = 0xff; - CLRERRCNT = 0; - - INTSETUP = bmAV2EN | bmAV4EN | bmINT4IN; - - // clear master irq's for usb and fifo/gpif - EXIF &= ~bmEXIF_USBINT; - EXIF &= ~bmEXIF_IE4; - - // enable master usb and fifo/gpif interrrupts - EIUSB = 1; - EIEX4 = 1; -} diff --git a/usrp/firmware/lib/timer.c b/usrp/firmware/lib/timer.c deleted file mode 100644 index 97e2f7cf9..000000000 --- a/usrp/firmware/lib/timer.c +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 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 "timer.h" -#include "fx2regs.h" -#include "isr.h" - -/* - * Arrange to have isr_tick_handler called at 100 Hz. - * - * The cpu clock is running at 48e6. The input to the timer - * is 48e6 / 12 = 4e6. - * - * We arrange to have the timer overflow every 40000 clocks == 100 Hz - */ - -#define RELOAD_VALUE ((unsigned short) -40000) - -void -hook_timer_tick (unsigned short isr_tick_handler) -{ - ET2 = 0; // disable timer 2 interrupts - hook_sv (SV_TIMER_2, isr_tick_handler); - - RCAP2H = RELOAD_VALUE >> 8; // setup the auto reload value - RCAP2L = RELOAD_VALUE; - - T2CON = 0x04; // interrupt on overflow; reload; run - ET2 = 1; // enable timer 2 interrupts -} diff --git a/usrp/firmware/lib/usb_common.c b/usrp/firmware/lib/usb_common.c deleted file mode 100644 index 3b0547b2f..000000000 --- a/usrp/firmware/lib/usb_common.c +++ /dev/null @@ -1,386 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 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 "usb_common.h" -#include "fx2regs.h" -#include "syncdelay.h" -#include "fx2utils.h" -#include "isr.h" -#include "usb_descriptors.h" -#include "usb_requests.h" - -extern xdata char str0[]; -extern xdata char str1[]; -extern xdata char str2[]; -extern xdata char str3[]; -extern xdata char str4[]; -extern xdata char str5[]; - - -#define bRequestType SETUPDAT[0] -#define bRequest SETUPDAT[1] -#define wValueL SETUPDAT[2] -#define wValueH SETUPDAT[3] -#define wIndexL SETUPDAT[4] -#define wIndexH SETUPDAT[5] -#define wLengthL SETUPDAT[6] -#define wLengthH SETUPDAT[7] - -#define MSB(x) (((unsigned short) x) >> 8) -#define LSB(x) (((unsigned short) x) & 0xff) - -volatile bit _usb_got_SUDAV; - -unsigned char _usb_config = 0; -unsigned char _usb_alt_setting = 0; // FIXME really 1/interface - -xdata unsigned char *current_device_descr; -xdata unsigned char *current_devqual_descr; -xdata unsigned char *current_config_descr; -xdata unsigned char *other_config_descr; - -static void -setup_descriptors (void) -{ - if (USBCS & bmHSM){ // high speed mode - current_device_descr = high_speed_device_descr; - current_devqual_descr = high_speed_devqual_descr; - current_config_descr = high_speed_config_descr; - other_config_descr = full_speed_config_descr; - } - else { - current_device_descr = full_speed_device_descr; - current_devqual_descr = full_speed_devqual_descr; - current_config_descr = full_speed_config_descr; - other_config_descr = high_speed_config_descr; - } - - // whack the type fields - // FIXME, may not be required. - // current_config_descr[1] = DT_CONFIG; - // other_config_descr[1] = DT_OTHER_SPEED; -} - -static void -isr_SUDAV (void) interrupt -{ - clear_usb_irq (); - _usb_got_SUDAV = 1; -} - -static void -isr_USBRESET (void) interrupt -{ - clear_usb_irq (); - setup_descriptors (); -} - -static void -isr_HIGHSPEED (void) interrupt -{ - clear_usb_irq (); - setup_descriptors (); -} - -void -usb_install_handlers (void) -{ - setup_descriptors (); // ensure that they're set before use - - hook_uv (UV_SUDAV, (unsigned short) isr_SUDAV); - hook_uv (UV_USBRESET, (unsigned short) isr_USBRESET); - hook_uv (UV_HIGHSPEED, (unsigned short) isr_HIGHSPEED); - - USBIE = bmSUDAV | bmURES | bmHSGRANT; -} - -// On the FX2 the only plausible endpoints are 0, 1, 2, 4, 6, 8 -// This doesn't check to see that they're enabled - -unsigned char -plausible_endpoint (unsigned char ep) -{ - ep &= ~0x80; // ignore direction bit - - if (ep > 8) - return 0; - - if (ep == 1) - return 1; - - return (ep & 0x1) == 0; // must be even -} - -// return pointer to control and status register for endpoint. -// only called with plausible_endpoints - -xdata volatile unsigned char * -epcs (unsigned char ep) -{ - if (ep == 0x01) // ep1 has different in and out CS regs - return EP1OUTCS; - - if (ep == 0x81) - return EP1INCS; - - ep &= ~0x80; // ignore direction bit - - if (ep == 0x00) // ep0 - return EP0CS; - - return EP2CS + (ep >> 1); // 2, 4, 6, 8 are consecutive -} - -void -usb_handle_setup_packet (void) -{ - _usb_got_SUDAV = 0; - - // handle the standard requests... - - switch (bRequestType & bmRT_TYPE_MASK){ - - case bmRT_TYPE_CLASS: - case bmRT_TYPE_RESERVED: - fx2_stall_ep0 (); // we don't handle these. indicate error - break; - - case bmRT_TYPE_VENDOR: - // call the application code. - // If it handles the command it returns non-zero - - if (!app_vendor_cmd ()) - fx2_stall_ep0 (); - break; - - case bmRT_TYPE_STD: - // these are the standard requests... - - if ((bRequestType & bmRT_DIR_MASK) == bmRT_DIR_IN){ - - //////////////////////////////////// - // handle the IN requests - //////////////////////////////////// - - switch (bRequest){ - - case RQ_GET_CONFIG: - EP0BUF[0] = _usb_config; // FIXME app should handle - EP0BCH = 0; - EP0BCL = 1; - break; - - // -------------------------------- - - case RQ_GET_INTERFACE: - EP0BUF[0] = _usb_alt_setting; // FIXME app should handle - EP0BCH = 0; - EP0BCL = 1; - break; - - // -------------------------------- - - case RQ_GET_DESCR: - switch (wValueH){ - - case DT_DEVICE: - SUDPTRH = MSB (current_device_descr); - SUDPTRL = LSB (current_device_descr); - break; - - case DT_DEVQUAL: - SUDPTRH = MSB (current_devqual_descr); - SUDPTRL = LSB (current_devqual_descr); - break; - - case DT_CONFIG: - if (0 && wValueL != 1) // FIXME only a single configuration - fx2_stall_ep0 (); - else { - SUDPTRH = MSB (current_config_descr); - SUDPTRL = LSB (current_config_descr); - } - break; - - case DT_OTHER_SPEED: - if (0 && wValueL != 1) // FIXME only a single configuration - fx2_stall_ep0 (); - else { - SUDPTRH = MSB (other_config_descr); - SUDPTRL = LSB (other_config_descr); - } - break; - - case DT_STRING: - if (wValueL >= nstring_descriptors) - fx2_stall_ep0 (); - else { - xdata char *p = string_descriptors[wValueL]; - SUDPTRH = MSB (p); - SUDPTRL = LSB (p); - } - break; - - default: - fx2_stall_ep0 (); // invalid request - break; - } - break; - - // -------------------------------- - - case RQ_GET_STATUS: - switch (bRequestType & bmRT_RECIP_MASK){ - case bmRT_RECIP_DEVICE: - EP0BUF[0] = bmGSDA_SELF_POWERED; // FIXME app should handle - EP0BUF[1] = 0; - EP0BCH = 0; - EP0BCL = 2; - break; - - case bmRT_RECIP_INTERFACE: - EP0BUF[0] = 0; - EP0BUF[1] = 0; - EP0BCH = 0; - EP0BCL = 2; - break; - - case bmRT_RECIP_ENDPOINT: - if (plausible_endpoint (wIndexL)){ - EP0BUF[0] = *epcs (wIndexL) & bmEPSTALL; - EP0BUF[1] = 0; - EP0BCH = 0; - EP0BCL = 2; - } - else - fx2_stall_ep0 (); - break; - - default: - fx2_stall_ep0 (); - break; - } - break; - - // -------------------------------- - - case RQ_SYNCH_FRAME: // not implemented - default: - fx2_stall_ep0 (); - break; - } - } - - else { - - //////////////////////////////////// - // handle the OUT requests - //////////////////////////////////// - - switch (bRequest){ - - case RQ_SET_CONFIG: - _usb_config = wValueL; // FIXME app should handle - break; - - case RQ_SET_INTERFACE: - _usb_alt_setting = wValueL; // FIXME app should handle - break; - - // -------------------------------- - - case RQ_CLEAR_FEATURE: - switch (bRequestType & bmRT_RECIP_MASK){ - - case bmRT_RECIP_DEVICE: - switch (wValueL){ - case FS_DEV_REMOTE_WAKEUP: - default: - fx2_stall_ep0 (); - } - break; - - case bmRT_RECIP_ENDPOINT: - if (wValueL == FS_ENDPOINT_HALT && plausible_endpoint (wIndexL)){ - *epcs (wIndexL) &= ~bmEPSTALL; - fx2_reset_data_toggle (wIndexL); - } - else - fx2_stall_ep0 (); - break; - - default: - fx2_stall_ep0 (); - break; - } - break; - - // -------------------------------- - - case RQ_SET_FEATURE: - switch (bRequestType & bmRT_RECIP_MASK){ - - case bmRT_RECIP_DEVICE: - switch (wValueL){ - case FS_TEST_MODE: - // hardware handles this after we complete SETUP phase handshake - break; - - case FS_DEV_REMOTE_WAKEUP: - default: - fx2_stall_ep0 (); - break; - } - } - break; - - case bmRT_RECIP_ENDPOINT: - switch (wValueL){ - case FS_ENDPOINT_HALT: - if (plausible_endpoint (wIndexL)) - *epcs (wIndexL) |= bmEPSTALL; - else - fx2_stall_ep0 (); - break; - - default: - fx2_stall_ep0 (); - break; - } - break; - - // -------------------------------- - - case RQ_SET_ADDRESS: // handled by fx2 hardware - case RQ_SET_DESCR: // not implemented - default: - fx2_stall_ep0 (); - } - - } - break; - - } // bmRT_TYPE_MASK - - // ack handshake phase of device request - EP0CS |= bmHSNAK; -} diff --git a/usrp/firmware/src/.gitignore b/usrp/firmware/src/.gitignore deleted file mode 100644 index d46c52c00..000000000 --- a/usrp/firmware/src/.gitignore +++ /dev/null @@ -1,17 +0,0 @@ -/*.ihx -/*.lnk -/*.lst -/*.map -/*.mem -/*.rel -/*.rst -/*.sym -/blink_leds.asm -/usrp_common.asm -/command_loop.asm -/fpga.asm -/*.asm -/usrp_gpif.c -/usrp_gpif_inline.h -/Makefile -/Makefile.in diff --git a/usrp/firmware/src/Makefile.am b/usrp/firmware/src/Makefile.am deleted file mode 100644 index fab46cef0..000000000 --- a/usrp/firmware/src/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -# -# 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. -# - -SUBDIRS = common usrp2 diff --git a/usrp/firmware/src/common/.gitignore b/usrp/firmware/src/common/.gitignore deleted file mode 100644 index d46c52c00..000000000 --- a/usrp/firmware/src/common/.gitignore +++ /dev/null @@ -1,17 +0,0 @@ -/*.ihx -/*.lnk -/*.lst -/*.map -/*.mem -/*.rel -/*.rst -/*.sym -/blink_leds.asm -/usrp_common.asm -/command_loop.asm -/fpga.asm -/*.asm -/usrp_gpif.c -/usrp_gpif_inline.h -/Makefile -/Makefile.in diff --git a/usrp/firmware/src/common/Makefile.am b/usrp/firmware/src/common/Makefile.am deleted file mode 100644 index 95232324d..000000000 --- a/usrp/firmware/src/common/Makefile.am +++ /dev/null @@ -1,50 +0,0 @@ -# -# 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. -# - -EXTRA_DIST = \ - _startup.a51 \ - blink_leds.c \ - check_mdelay.c \ - check_udelay.c \ - edit-gpif \ - fpga.h \ - fpga_load.h \ - fpga_load.c \ - gpif.c \ - gpif.gpf \ - init_gpif.c \ - usrp_common.c \ - usrp_globals.h \ - vectors.a51 \ - build_eeprom.py - -all: usrp_gpif.c - -usrp_gpif.c usrp_gpif_inline.h : gpif.c - srcdir=$(srcdir) $(PYTHON) $(srcdir)/edit-gpif $(srcdir)/gpif.c usrp_gpif.c usrp_gpif_inline.h - -CLEANFILES = \ - *.ihx *.lnk *.lst *.map *.mem *.rel *.rst *.sym *.asm *.lib \ - usrp_gpif.c usrp_gpif_inline.h - -DISTCLEANFILES = \ - *.ihx *.lnk *.lst *.map *.mem *.rel *.rst *.sym *.asm *.lib \ - usrp_gpif.c usrp_gpif_inline.h diff --git a/usrp/firmware/src/common/_startup.a51 b/usrp/firmware/src/common/_startup.a51 deleted file mode 100644 index 30a907857..000000000 --- a/usrp/firmware/src/common/_startup.a51 +++ /dev/null @@ -1,80 +0,0 @@ -;;; -*- asm -*- -;;; -;;; Copyright 2003,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. - - -;;; The default external memory initialization provided by sdcc is not -;;; appropriate to the FX2. This is derived from the sdcc code, but uses -;;; the FX2 specific _MPAGE sfr. - - - ;; .area XISEG (XDATA) ; the initialized external data area - ;; .area XINIT (CODE) ; the code space consts to init XISEG - .area XSEG (XDATA) ; zero initialized xdata - .area USBDESCSEG (XDATA) ; usb descriptors - - - .area CSEG (CODE) - - ;; sfr that sets upper address byte of MOVX using @r0 or @r1 - _MPAGE = 0x0092 - -__sdcc_external_startup:: - ;; This system is now compiled with the --no-xinit-opt - ;; which means that any initialized XDATA is handled - ;; inline by code in the GSINIT segs emitted for each file. - ;; - ;; We zero XSEG and all of the internal ram to ensure - ;; a known good state for uninitialized variables. - -; _mcs51_genRAMCLEAR() start - mov r0,#l_XSEG - mov a,r0 - orl a,#(l_XSEG >> 8) - jz 00002$ - mov r1,#((l_XSEG + 255) >> 8) - mov dptr,#s_XSEG - clr a - -00001$: movx @dptr,a - inc dptr - djnz r0,00001$ - djnz r1,00001$ - - ;; We're about to clear internal memory. This will overwrite - ;; the stack which contains our return address. - ;; Pop our return address into DPH, DPL -00002$: pop dph - pop dpl - - ;; R0 and A contain 0. This loop will execute 256 times. - ;; - ;; FWIW the first iteration writes direct address 0x00, - ;; which is the location of r0. We get lucky, we're - ;; writing the correct value (0) - -00003$: mov @r0,a - djnz r0,00003$ - - push dpl ; restore our return address - push dph - - mov dpl,#0 ; indicate that data init is still required - ret diff --git a/usrp/firmware/src/common/_startup.a51.brittle b/usrp/firmware/src/common/_startup.a51.brittle deleted file mode 100644 index 2996275cf..000000000 --- a/usrp/firmware/src/common/_startup.a51.brittle +++ /dev/null @@ -1,78 +0,0 @@ -;;; -*- asm -*- -;;; -;;; Copyright 2003 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 default external memory initialization provided by sdcc is not -;;; appropriate to the FX2. This is derived from the sdcc code, but uses -;;; the FX2 specific _MPAGE sfr. - - - .area XISEG (XDATA) ; the initialized external data area - .area XINIT (CODE) ; the code space consts to init XISEG - .area XSEG (XDATA) ; zero initialized xdata - .area USBDESCSEG (XDATA); usb descriptors - - - ;; BIG TIME KLUDGE! - ;; Look at usrp_main.rst and count the bytes from our - ;; "normal return location" to the first instruction following - ;; the comment: "_mcs51_getRAMCLEAR () start" - - INSTRUCTION_BYTES_TO_SKIP = 0x29 ; valid for sdcc 2.4.0 - - - .area CSEG (CODE) - - ;; sfr that sets upper address byte of MOVX using @r0 or @r1 - _MPAGE = 0x0092 - -__sdcc_external_startup:: -; _mcs51_genXINIT() start - mov r1,#l_XINIT - mov a,r1 - orl a,#(l_XINIT >> 8) - jz 00003$ - mov r2,#((l_XINIT+255) >> 8) - mov dptr,#s_XINIT - mov r0,#s_XISEG - mov _MPAGE,#(s_XISEG >> 8) -00001$: clr a - movc a,@a+dptr - movx @r0,a - inc dptr - inc r0 - cjne r0,#0,00002$ - inc _MPAGE -00002$: djnz r1,00001$ - djnz r2,00001$ - mov _MPAGE,#0xFF -00003$: - - ;; Danger! Total KLUDGE! - ;; We pop the return address, add a magic number to it - ;; then jump to that address. Believe it or not, this - ;; looks like the least kludgy way to handle this, - ;; short of patching the compiler... - - pop dph - pop dpl - mov a,#INSTRUCTION_BYTES_TO_SKIP - jmp @a+dptr diff --git a/usrp/firmware/src/common/blink_leds.c b/usrp/firmware/src/common/blink_leds.c deleted file mode 100644 index 255c69733..000000000 --- a/usrp/firmware/src/common/blink_leds.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * USRP - Universal Software Radio Peripheral - * - * Copyright (C) 2003 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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, Boston, MA 02110-1301 USA - */ - -#include "usrp_common.h" - -void -main (void) -{ - unsigned short counter = 0; - - init_usrp (); - - while (1){ - unsigned char counter_high = counter >> 8; - set_led_0 (counter_high & 0x40); - set_led_1 (counter_high & 0x80); - counter++; - } -} diff --git a/usrp/firmware/src/common/build_eeprom.py b/usrp/firmware/src/common/build_eeprom.py deleted file mode 100755 index 00c2e3414..000000000 --- a/usrp/firmware/src/common/build_eeprom.py +++ /dev/null @@ -1,188 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2006 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 re -import sys -import os, os.path -from optparse import OptionParser - -# USB Vendor and Product ID's - -VID = 0xfffe # Free Software Folks -PID = 0x0002 # Universal Software Radio Peripheral - - -def hex_to_bytes (s): - if len (s) & 0x1: - raise ValueError, "Length must be even" - r = [] - for i in range (0, len(s), 2): - r.append (int (s[i:i+2], 16)) - return r - -def msb (x): - return (x >> 8) & 0xff - -def lsb (x): - return x & 0xff - -class ihx_rec (object): - def __init__ (self, addr, type, data): - self.addr = addr - self.type = type - self.data = data - -class ihx_file (object): - def __init__ (self): - self.pat = re.compile (r':[0-9A-F]{10,}') - def read (self, file): - r = [] - for line in file: - line = line.strip().upper () - if not self.pat.match (line): - raise ValueError, "Invalid hex record format" - bytes = hex_to_bytes (line[1:]) - sum = reduce (lambda x, y: x + y, bytes, 0) % 256 - if sum != 0: - raise ValueError, "Bad hex checksum" - lenx = bytes[0] - addr = (bytes[1] << 8) + bytes[2] - type = bytes[3] - data = bytes[4:-1] - if lenx != len (data): - raise ValueError, "Invalid hex record (bad length)" - if type != 0: - break; - r.append (ihx_rec (addr, type, data)) - - return r - -def get_code (filename): - """Read the intel hex format file FILENAME and return a tuple - of the code starting address and a list of bytes to load there. - """ - f = open (filename, 'r') - ifx = ihx_file () - r = ifx.read (f) - r.sort (lambda a,b: a.addr - b.addr) - code_start = r[0].addr - code_end = r[-1].addr + len (r[-1].data) - code_len = code_end - code_start - code = [0] * code_len - for x in r: - a = x.addr - l = len (x.data) - code[a-code_start:a-code_start+l] = x.data - return (code_start, code) - - -def build_eeprom_image (filename, rev): - """Build a ``C2 Load'' EEPROM image. - - For details on this format, see section 3.4.3 of - the EZ-USB FX2 Technical Reference Manual - """ - # get the code we want to run - (start_addr, bytes) = get_code (filename) - - devid = rev - - rom_header = [ - 0xC2, # boot from EEPROM - lsb (VID), - msb (VID), - lsb (PID), - msb (PID), - lsb (devid), - msb (devid), - 0 # configuration byte - ] - - # 4 byte header that indicates where to load - # the immediately follow code bytes. - code_header = [ - msb (len (bytes)), - lsb (len (bytes)), - msb (start_addr), - lsb (start_addr) - ] - - # writes 0 to CPUCS reg (brings FX2 out of reset) - trailer = [ - 0x80, - 0x01, - 0xe6, - 0x00, - 0x00 - ] - - image = rom_header + code_header + bytes + trailer - - assert (len (image) <= 256) - return image - -def build_shell_script (out, ihx_filename, rev, prefix): - - image = build_eeprom_image (ihx_filename, rev) - - out.write ('#!/bin/sh\n') - out.write ('usrper -x load_firmware ' + prefix + '/share/usrp/rev%d/std.ihx\n' % rev) - out.write ('sleep 2\n') - - # print "len(image) =", len(image) - - i2c_addr = 0x50 - rom_addr = 0x00 - - hex_image = map (lambda x : "%02x" % (x,), image) - - while (len (hex_image) > 0): - l = min (len (hex_image), 16) - out.write ('usrper i2c_write 0x%02x %02x%s\n' % - (i2c_addr, rom_addr, ''.join (hex_image[0:l]))) - hex_image = hex_image[l:] - rom_addr = rom_addr + l - out.write ('sleep 2\n') - -if __name__ == '__main__': - usage = "usage: %prog -p PREFIX -r REV [options] bootfile.ihx" - parser = OptionParser (usage=usage) - parser.add_option ("-p", "--prefix", type="string", default="", - help="Specify install prefix from configure") - parser.add_option ("-r", "--rev", type="int", default=-1, - help="Specify USRP revision number REV (2 or 4)") - (options, args) = parser.parse_args () - if len (args) != 1: - parser.print_help () - sys.exit (1) - if options.rev < 0: - sys.stderr.write ( - "You must specify the USRP revision number (2 or 4) with -r REV\n") - sys.exit (1) - if options.prefix == "": - sys.stderr.write ( - "You must specify the install prefix with -p PREFIX\n") - sys.exit (1) - - ihx_filename = args[0] - - build_shell_script (sys.stdout, ihx_filename, options.rev, options.prefix) diff --git a/usrp/firmware/src/common/check_mdelay.c b/usrp/firmware/src/common/check_mdelay.c deleted file mode 100644 index de1af47f6..000000000 --- a/usrp/firmware/src/common/check_mdelay.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * USRP - Universal Software Radio Peripheral - * - * Copyright (C) 2003 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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, Boston, MA 02110-1301 USA - */ - -#include "usrp_common.h" -#include "delay.h" - -void -main (void) -{ - init_usrp (); - - // CPUCS = 0; // 12 MHz - // CPUCS = bmCLKSPD0; // 24 MHz - CPUCS = bmCLKSPD1; // 48 MHz - - while (1){ - USRP_LED_REG ^= bmLED0; - mdelay (10); - } -} diff --git a/usrp/firmware/src/common/check_udelay.c b/usrp/firmware/src/common/check_udelay.c deleted file mode 100644 index 46885a067..000000000 --- a/usrp/firmware/src/common/check_udelay.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * USRP - Universal Software Radio Peripheral - * - * Copyright (C) 2003 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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, Boston, MA 02110-1301 USA - */ - -#include "usrp_common.h" -#include "delay.h" - -void -main (void) -{ - init_usrp (); - - // CPUCS = 0; // 12 MHz - // CPUCS = bmCLKSPD0; // 24 MHz - CPUCS = bmCLKSPD1; // 48 MHz - - while (1){ - USRP_LED_REG ^= bmLED0; - udelay (250); - } -} diff --git a/usrp/firmware/src/common/edit-gpif b/usrp/firmware/src/common/edit-gpif deleted file mode 100755 index 5367b75a5..000000000 --- a/usrp/firmware/src/common/edit-gpif +++ /dev/null @@ -1,114 +0,0 @@ -#!/usr/bin/env python -# -*- Python -*- -# -# Copyright 2003 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. -# - - -# Edit the gpif.c file generated by the Cypress GPIF Designer Tool and -# produce usrp_gpif.c, and usrp_gpif_inline.h, files suitable for our -# uses. - -import re -import string -import sys - -def check_flow_state (line, flow_state_dict): - mo = re.match (r'/\* Wave (\d) FlowStates \*/ (.*),', line) - if mo: - wave = int (mo.group (1)) - data = mo.group (2) - split = data.split (',', 8) - v = map (lambda x : int (x, 16), split) - # print "%s, %s" % (wave, data) - # print "split: ", split - # print "v : ", v - flow_state_dict[wave] = v - - -def delta (xseq, yseq): - # set subtraction - z = [] - for x in xseq: - if x not in yseq: - z.append (x) - return z - - -def write_define (output, name, pairs): - output.write ('#define %s()\t\\\n' % name) - output.write ('do {\t\t\t\t\t\\\n') - for reg, val in pairs: - output.write ('%14s = 0x%02x;\t\t\t\\\n' % (reg, val)) - output.write ('} while (0)\n\n') - -def write_inlines (output, dict): - regs = ['FLOWSTATE', 'FLOWLOGIC', 'FLOWEQ0CTL', 'FLOWEQ1CTL', 'FLOWHOLDOFF', - 'FLOWSTB', 'FLOWSTBEDGE', 'FLOWSTBHPERIOD', 'GPIFHOLDAMOUNT'] - - READ_FLOW_STATE = 2 - WRITE_FLOW_STATE = 3 - - read_info = zip (regs, dict[READ_FLOW_STATE]) - write_info = zip (regs, dict[WRITE_FLOW_STATE]) - - output.write ('''/* - * Machine generated by "edit-gpif". Do not edit by hand. - */ - -''') - write_define (output, 'setup_flowstate_common', read_info) - write_define (output, 'setup_flowstate_read', delta (read_info, write_info)) - write_define (output, 'setup_flowstate_write', delta (write_info, read_info)) - - -def edit_gpif (input_name, output_name, inline_name): - input = open (input_name, 'r') - output = open (output_name, 'w') - inline = open (inline_name, 'w') - flow_state_dict = {} - - output.write ('''/* - * Machine generated by "edit-gpif". Do not edit by hand. - */ - -''') - - while 1: - line = input.readline () - line = string.replace (line, '\r','') - line = re.sub (r' *$', r'', line) - - check_flow_state (line, flow_state_dict) - - line = re.sub (r'#include', r'// #include', line) - line = re.sub (r'xdata ', r'', line) - if re.search (r'GpifInit', line): - break - - output.write (line) - - output.close () - write_inlines (inline, flow_state_dict) - inline.close () - - -# gpif.c usrp_gpif.c usrp_gpif_inline.h -edit_gpif (sys.argv[1], sys.argv[2], sys.argv[3]) diff --git a/usrp/firmware/src/common/fpga.h b/usrp/firmware/src/common/fpga.h deleted file mode 100644 index 6cd5de8e2..000000000 --- a/usrp/firmware/src/common/fpga.h +++ /dev/null @@ -1,31 +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_FPGA_H -#define INCLUDED_FPGA_H - -#include "fpga_load.h" - -#if defined(HAVE_USRP2) -#include "fpga_rev2.h" -#endif - -#endif /* INCLUDED_FPGA_H */ diff --git a/usrp/firmware/src/common/fpga_load.c b/usrp/firmware/src/common/fpga_load.c deleted file mode 100644 index c3ae9e707..000000000 --- a/usrp/firmware/src/common/fpga_load.c +++ /dev/null @@ -1,193 +0,0 @@ -/* - * USRP - Universal Software Radio Peripheral - * - * Copyright (C) 2003 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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, Boston, MA 02110-1301 USA - */ - -#include "usrp_common.h" -#include "fpga_load.h" -#include "delay.h" - -/* - * setup altera FPGA serial load (PS). - * - * On entry: - * don't care - * - * On exit: - * ALTERA_DCLK = 0 - * ALTERA_NCONFIG = 1 - * ALTERA_NSTATUS = 1 (input) - */ -unsigned char -fpga_load_begin (void) -{ - USRP_ALTERA_CONFIG &= ~bmALTERA_BITS; // clear all bits (NCONFIG low) - udelay (40); // wait 40 us - USRP_ALTERA_CONFIG |= bmALTERA_NCONFIG; // set NCONFIG high - - if (UC_BOARD_HAS_FPGA){ - // FIXME should really cap this loop with a counter so we - // don't hang forever on a hardware failure. - while ((USRP_ALTERA_CONFIG & bmALTERA_NSTATUS) == 0) // wait for NSTATUS to go high - ; - } - - // ready to xfer now - - return 1; -} - -/* - * clock out the low bit of bits. - * - * On entry: - * ALTERA_DCLK = 0 - * ALTERA_NCONFIG = 1 - * ALTERA_NSTATUS = 1 (input) - * - * On exit: - * ALTERA_DCLK = 0 - * ALTERA_NCONFIG = 1 - * ALTERA_NSTATUS = 1 (input) - */ - - -#if 0 - -static void -clock_out_config_byte (unsigned char bits) -{ - unsigned char i; - - // clock out configuration byte, least significant bit first - - for (i = 0; i < 8; i++){ - - USRP_ALTERA_CONFIG = ((USRP_ALTERA_CONFIG & ~bmALTERA_DATA0) | ((bits & 1) ? bmALTERA_DATA0 : 0)); - USRP_ALTERA_CONFIG |= bmALTERA_DCLK; /* set DCLK to 1 */ - USRP_ALTERA_CONFIG &= ~bmALTERA_DCLK; /* set DCLK to 0 */ - - bits = bits >> 1; - } -} - -#else - -static void -clock_out_config_byte (unsigned char bits) _naked -{ - _asm - mov a, dpl - - rrc a - mov _bitALTERA_DATA0,c - setb _bitALTERA_DCLK - clr _bitALTERA_DCLK - - rrc a - mov _bitALTERA_DATA0,c - setb _bitALTERA_DCLK - clr _bitALTERA_DCLK - - rrc a - mov _bitALTERA_DATA0,c - setb _bitALTERA_DCLK - clr _bitALTERA_DCLK - - rrc a - mov _bitALTERA_DATA0,c - setb _bitALTERA_DCLK - clr _bitALTERA_DCLK - - rrc a - mov _bitALTERA_DATA0,c - setb _bitALTERA_DCLK - clr _bitALTERA_DCLK - - rrc a - mov _bitALTERA_DATA0,c - setb _bitALTERA_DCLK - clr _bitALTERA_DCLK - - rrc a - mov _bitALTERA_DATA0,c - setb _bitALTERA_DCLK - clr _bitALTERA_DCLK - - rrc a - mov _bitALTERA_DATA0,c - setb _bitALTERA_DCLK - clr _bitALTERA_DCLK - - ret - - _endasm; -} - -#endif - -static void -clock_out_bytes (unsigned char bytecount, - unsigned char xdata *p) -{ - while (bytecount-- > 0) - clock_out_config_byte (*p++); -} - -/* - * Transfer block of bytes from packet to FPGA serial configuration port - * - * On entry: - * ALTERA_DCLK = 0 - * ALTERA_NCONFIG = 1 - * ALTERA_NSTATUS = 1 (input) - * - * On exit: - * ALTERA_DCLK = 0 - * ALTERA_NCONFIG = 1 - * ALTERA_NSTATUS = 1 (input) - */ -unsigned char -fpga_load_xfer (xdata unsigned char *p, unsigned char bytecount) -{ - clock_out_bytes (bytecount, p); - return 1; -} - -/* - * check for successful load... - */ -unsigned char -fpga_load_end (void) -{ - unsigned char status = USRP_ALTERA_CONFIG; - - if (!UC_BOARD_HAS_FPGA) // always true if we don't have FPGA - return 1; - - if ((status & bmALTERA_NSTATUS) == 0) // failed to program - return 0; - - if ((status & bmALTERA_CONF_DONE) == bmALTERA_CONF_DONE) - return 1; // everything's cool - - // I don't think this should happen. It indicates that - // programming is still in progress. - - return 0; -} diff --git a/usrp/firmware/src/common/fpga_load.h b/usrp/firmware/src/common/fpga_load.h deleted file mode 100644 index 7c36a04c8..000000000 --- a/usrp/firmware/src/common/fpga_load.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * USRP - Universal Software Radio Peripheral - * - * Copyright (C) 2003 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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, Boston, MA 02110-1301 USA - */ - -#ifndef INCLUDED_FPGA_LOAD_H -#define INCLUDED_FPGA_LOAD_H - -unsigned char fpga_load_begin (void); -unsigned char fpga_load_xfer (xdata unsigned char *p, unsigned char len); -unsigned char fpga_load_end (void); - -#endif /* INCLUDED_FPGA_LOAD_H */ diff --git a/usrp/firmware/src/common/gpif.c b/usrp/firmware/src/common/gpif.c deleted file mode 100755 index 489e6e81a..000000000 --- a/usrp/firmware/src/common/gpif.c +++ /dev/null @@ -1,292 +0,0 @@ -// This program configures the General Programmable Interface (GPIF) for FX2. -// Please do not modify sections of text which are marked as "DO NOT EDIT ...". -// -// DO NOT EDIT ... -// GPIF Initialization -// Interface Timing Async -// Internal Ready Init IntRdy=1 -// CTL Out Tristate-able Binary -// SingleWrite WF Select 1 -// SingleRead WF Select 0 -// FifoWrite WF Select 3 -// FifoRead WF Select 2 -// Data Bus Idle Drive Tristate -// END DO NOT EDIT - -// DO NOT EDIT ... -// GPIF Wave Names -// Wave 0 = singlerd -// Wave 1 = singlewr -// Wave 2 = FIFORd -// Wave 3 = FIFOWr - -// GPIF Ctrl Outputs Level -// CTL 0 = WEN# CMOS -// CTL 1 = REN# CMOS -// CTL 2 = OE# CMOS -// CTL 3 = CLRST CMOS -// CTL 4 = unused CMOS -// CTL 5 = BOGUS CMOS - -// GPIF Rdy Inputs -// RDY0 = EF# -// RDY1 = FF# -// RDY2 = unused -// RDY3 = unused -// RDY4 = unused -// RDY5 = TCXpire -// FIFOFlag = FIFOFlag -// IntReady = IntReady -// END DO NOT EDIT -// DO NOT EDIT ... -// -// GPIF Waveform 0: singlerd -// -// Interval 0 1 2 3 4 5 6 Idle (7) -// _________ _________ _________ _________ _________ _________ _________ _________ -// -// AddrMode Same Val Same Val Same Val Same Val Same Val Same Val Same Val -// DataMode NO Data NO Data NO Data NO Data NO Data NO Data NO Data -// NextData SameData SameData SameData SameData SameData SameData SameData -// Int Trig No Int No Int No Int No Int No Int No Int No Int -// IF/Wait Wait 1 Wait 1 Wait 1 Wait 1 Wait 1 Wait 1 Wait 1 -// Term A -// LFunc -// Term B -// Branch1 -// Branch0 -// Re-Exec -// Sngl/CRC Default Default Default Default Default Default Default -// WEN# 0 0 0 0 0 0 0 0 -// REN# 0 0 0 0 0 0 0 0 -// OE# 0 0 0 0 0 0 0 0 -// CLRST 0 0 0 0 0 0 0 0 -// unused 0 0 0 0 0 0 0 0 -// BOGUS 0 0 0 0 0 0 0 0 -// -// END DO NOT EDIT -// DO NOT EDIT ... -// -// GPIF Waveform 1: singlewr -// -// Interval 0 1 2 3 4 5 6 Idle (7) -// _________ _________ _________ _________ _________ _________ _________ _________ -// -// AddrMode Same Val Same Val Same Val Same Val Same Val Same Val Same Val -// DataMode Activate Activate Activate Activate Activate Activate Activate -// NextData SameData SameData SameData SameData SameData SameData SameData -// Int Trig No Int No Int No Int No Int No Int No Int No Int -// IF/Wait Wait 1 IF Wait 1 Wait 1 Wait 1 Wait 1 Wait 1 -// Term A EF# -// LFunc AND -// Term B EF# -// Branch1 ThenIdle -// Branch0 ElseIdle -// Re-Exec No -// Sngl/CRC Default Default Default Default Default Default Default -// WEN# 0 1 1 1 1 1 1 0 -// REN# 0 0 0 0 0 0 0 0 -// OE# 0 0 0 0 0 0 0 0 -// CLRST 0 0 0 0 0 0 0 0 -// unused 0 0 0 0 0 0 0 0 -// BOGUS 0 0 0 0 0 0 0 0 -// -// END DO NOT EDIT -// DO NOT EDIT ... -// -// GPIF Waveform 2: FIFORd -// -// Interval 0 1 2 3 4 5 6 Idle (7) -// _________ _________ _________ _________ _________ _________ _________ _________ -// -// AddrMode Same Val Same Val Same Val Same Val Same Val Same Val Same Val -// DataMode NO Data Activate NO Data NO Data NO Data NO Data NO Data -// NextData SameData SameData SameData SameData SameData SameData SameData -// Int Trig No Int No Int No Int No Int No Int No Int No Int -// IF/Wait Wait 1 IF Wait 1 IF Wait 1 Wait 1 Wait 1 -// Term A TCXpire TCXpire -// LFunc AND AND -// Term B TCXpire TCXpire -// Branch1 Then 2 ThenIdle -// Branch0 Else 1 ElseIdle -// Re-Exec No No -// Sngl/CRC Default Default Default Default Default Default Default -// WEN# 0 0 0 0 0 0 0 0 -// REN# 0 0 0 0 0 0 0 0 -// OE# 1 1 1 0 0 0 0 0 -// CLRST 0 0 0 0 0 0 0 0 -// unused 0 0 0 0 0 0 0 0 -// BOGUS 0 0 0 0 0 0 0 0 -// -// END DO NOT EDIT -// DO NOT EDIT ... -// -// GPIF Waveform 3: FIFOWr -// -// Interval 0 1 2 3 4 5 6 Idle (7) -// _________ _________ _________ _________ _________ _________ _________ _________ -// -// AddrMode Same Val Same Val Same Val Same Val Same Val Same Val Same Val -// DataMode NO Data Activate Activate Activate Activate Activate Activate -// NextData SameData SameData SameData SameData SameData SameData SameData -// Int Trig No Int No Int No Int No Int No Int No Int No Int -// IF/Wait Wait 1 IF Wait 1 Wait 1 Wait 1 Wait 1 Wait 1 -// Term A TCXpire -// LFunc AND -// Term B TCXpire -// Branch1 ThenIdle -// Branch0 Else 1 -// Re-Exec No -// Sngl/CRC Default Default Default Default Default Default Default -// WEN# 0 0 0 0 0 0 0 0 -// REN# 0 0 0 0 0 0 0 0 -// OE# 0 0 0 0 0 0 0 0 -// CLRST 0 0 0 0 0 0 0 0 -// unused 0 0 0 0 0 0 0 0 -// BOGUS 0 0 0 0 0 0 0 0 -// -// END DO NOT EDIT - -// GPIF Program Code - -// DO NOT EDIT ... -#include "fx2.h" -#include "fx2regs.h" -#include "fx2sdly.h" // SYNCDELAY macro -// END DO NOT EDIT - -// DO NOT EDIT ... -const char xdata WaveData[128] = -{ -// Wave 0 -/* LenBr */ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x07, -/* Opcode*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* Output*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* LFun */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, -// Wave 1 -/* LenBr */ 0x01, 0x3F, 0x01, 0x01, 0x01, 0x01, 0x01, 0x07, -/* Opcode*/ 0x22, 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, -/* Output*/ 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, -/* LFun */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, -// Wave 2 -/* LenBr */ 0x01, 0x11, 0x01, 0x3F, 0x01, 0x01, 0x01, 0x07, -/* Opcode*/ 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, -/* Output*/ 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, -/* LFun */ 0x00, 0x2D, 0x00, 0x2D, 0x00, 0x00, 0x00, 0x3F, -// Wave 3 -/* LenBr */ 0x01, 0x39, 0x01, 0x01, 0x01, 0x01, 0x01, 0x07, -/* Opcode*/ 0x00, 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, -/* Output*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* LFun */ 0x00, 0x2D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, -}; -// END DO NOT EDIT - -// DO NOT EDIT ... -const char xdata FlowStates[36] = -{ -/* Wave 0 FlowStates */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* Wave 1 FlowStates */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* Wave 2 FlowStates */ 0x81,0x2D,0x26,0x00,0x04,0x04,0x03,0x02,0x00, -/* Wave 3 FlowStates */ 0x81,0x2D,0x21,0x00,0x04,0x04,0x03,0x02,0x00, -}; -// END DO NOT EDIT - -// DO NOT EDIT ... -const char xdata InitData[7] = -{ -/* Regs */ 0xA0,0x00,0x00,0x00,0xEE,0x4E,0x00 -}; -// END DO NOT EDIT - -// TO DO: You may add additional code below. - -void GpifInit( void ) -{ - BYTE i; - - // Registers which require a synchronization delay, see section 15.14 - // FIFORESET FIFOPINPOLAR - // INPKTEND OUTPKTEND - // EPxBCH:L REVCTL - // GPIFTCB3 GPIFTCB2 - // GPIFTCB1 GPIFTCB0 - // EPxFIFOPFH:L EPxAUTOINLENH:L - // EPxFIFOCFG EPxGPIFFLGSEL - // PINFLAGSxx EPxFIFOIRQ - // EPxFIFOIE GPIFIRQ - // GPIFIE GPIFADRH:L - // UDMACRCH:L EPxGPIFTRIG - // GPIFTRIG - - // Note: The pre-REVE EPxGPIFTCH/L register are affected, as well... - // ...these have been replaced by GPIFTC[B3:B0] registers - - // 8051 doesn't have access to waveform memories 'til - // the part is in GPIF mode. - - IFCONFIG = 0xEE; - // IFCLKSRC=1 , FIFOs executes on internal clk source - // xMHz=1 , 48MHz internal clk rate - // IFCLKOE=0 , Don't drive IFCLK pin signal at 48MHz - // IFCLKPOL=0 , Don't invert IFCLK pin signal from internal clk - // ASYNC=1 , master samples asynchronous - // GSTATE=1 , Drive GPIF states out on PORTE[2:0], debug WF - // IFCFG[1:0]=10, FX2 in GPIF master mode - - GPIFABORT = 0xFF; // abort any waveforms pending - - GPIFREADYCFG = InitData[ 0 ]; - GPIFCTLCFG = InitData[ 1 ]; - GPIFIDLECS = InitData[ 2 ]; - GPIFIDLECTL = InitData[ 3 ]; - GPIFWFSELECT = InitData[ 5 ]; - GPIFREADYSTAT = InitData[ 6 ]; - - // use dual autopointer feature... - AUTOPTRSETUP = 0x07; // inc both pointers, - // ...warning: this introduces pdata hole(s) - // ...at E67B (XAUTODAT1) and E67C (XAUTODAT2) - - // source - AUTOPTRH1 = MSB( &WaveData ); - AUTOPTRL1 = LSB( &WaveData ); - - // destination - AUTOPTRH2 = 0xE4; - AUTOPTRL2 = 0x00; - - // transfer - for ( i = 0x00; i < 128; i++ ) - { - EXTAUTODAT2 = EXTAUTODAT1; - } - -// Configure GPIF Address pins, output initial value, - PORTCCFG = 0xFF; // [7:0] as alt. func. GPIFADR[7:0] - OEC = 0xFF; // and as outputs - PORTECFG |= 0x80; // [8] as alt. func. GPIFADR[8] - OEE |= 0x80; // and as output - -// ...OR... tri-state GPIFADR[8:0] pins -// PORTCCFG = 0x00; // [7:0] as port I/O -// OEC = 0x00; // and as inputs -// PORTECFG &= 0x7F; // [8] as port I/O -// OEE &= 0x7F; // and as input - -// GPIF address pins update when GPIFADRH/L written - SYNCDELAY; // - GPIFADRH = 0x00; // bits[7:1] always 0 - SYNCDELAY; // - GPIFADRL = 0x00; // point to PERIPHERAL address 0x0000 - -// Configure GPIF FlowStates registers for Wave 0 of WaveData - FLOWSTATE = FlowStates[ 0 ]; - FLOWLOGIC = FlowStates[ 1 ]; - FLOWEQ0CTL = FlowStates[ 2 ]; - FLOWEQ1CTL = FlowStates[ 3 ]; - FLOWHOLDOFF = FlowStates[ 4 ]; - FLOWSTB = FlowStates[ 5 ]; - FLOWSTBEDGE = FlowStates[ 6 ]; - FLOWSTBHPERIOD = FlowStates[ 7 ]; -} - diff --git a/usrp/firmware/src/common/gpif.gpf b/usrp/firmware/src/common/gpif.gpf Binary files differdeleted file mode 100755 index a954ac193..000000000 --- a/usrp/firmware/src/common/gpif.gpf +++ /dev/null diff --git a/usrp/firmware/src/common/init_gpif.c b/usrp/firmware/src/common/init_gpif.c deleted file mode 100644 index edde919be..000000000 --- a/usrp/firmware/src/common/init_gpif.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * USRP - Universal Software Radio Peripheral - * - * Copyright (C) 2003 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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, Boston, MA 02110-1301 USA - */ - -#include "usrp_common.h" - -// These are the tables generated by the Cypress GPIF Designer - -extern const char WaveData[128]; -extern const char FlowStates[36]; -extern const char InitData[7]; - -// The tool is kind of screwed up, in that it doesn't configure some -// of the ports correctly. We just use their tables and handle the -// initialization ourselves. They also declare that their static -// initialized data is in xdata, which screws us too. - -void -init_gpif (void) -{ - // we've already setup IFCONFIG before calling this... - - GPIFABORT = 0xFF; // abort any waveforms pending - SYNCDELAY; - - GPIFREADYCFG = InitData[ 0 ]; - GPIFCTLCFG = InitData[ 1 ]; - GPIFIDLECS = InitData[ 2 ]; - GPIFIDLECTL = InitData[ 3 ]; - // Hmmm, what's InitData[ 4 ] ... - GPIFWFSELECT = InitData[ 5 ]; - // GPIFREADYSTAT = InitData[ 6 ]; // I think this register is read only... - - { - BYTE i; - - for (i = 0; i < 128; i++){ - GPIF_WAVE_DATA[i] = WaveData[i]; - } - } - - FLOWSTATE = 0; /* ensure it's off */ -} diff --git a/usrp/firmware/src/common/usrp_common.c b/usrp/firmware/src/common/usrp_common.c deleted file mode 100644 index 0998653c2..000000000 --- a/usrp/firmware/src/common/usrp_common.c +++ /dev/null @@ -1,109 +0,0 @@ -/* - * USRP - Universal Software Radio Peripheral - * - * Copyright (C) 2003 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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, Boston, MA 02110-1301 USA - */ - -/* - * common code for USRP - */ - -#include "usrp_common.h" - -void init_board (void); - -void -init_usrp (void) -{ - CPUCS = bmCLKSPD1; // CPU runs @ 48 MHz - CKCON = 0; // MOVX takes 2 cycles - - // IFCLK is generated internally and runs at 48 MHz; GPIF "master mode" - - IFCONFIG = bmIFCLKSRC | bm3048MHZ | bmIFCLKOE | bmIFCLKPOL | bmIFGPIF; - SYNCDELAY; - - // configure IO ports (B and D are used by GPIF) - - IOA = bmPORT_A_INITIAL; // Port A initial state - OEA = bmPORT_A_OUTPUTS; // Port A direction register - - IOC = bmPORT_C_INITIAL; // Port C initial state - OEC = bmPORT_C_OUTPUTS; // Port C direction register - - IOE = bmPORT_E_INITIAL; // Port E initial state - OEE = bmPORT_E_OUTPUTS; // Port E direction register - - - // REVCTL = bmDYN_OUT | bmENH_PKT; // highly recommended by docs - // SYNCDELAY; - - // configure end points - - EP1OUTCFG = bmVALID | bmBULK; SYNCDELAY; - EP1INCFG = bmVALID | bmBULK | bmIN; SYNCDELAY; - - EP2CFG = bmVALID | bmBULK | bmQUADBUF; SYNCDELAY; // 512 quad bulk OUT - EP4CFG = 0; SYNCDELAY; // disabled - EP6CFG = bmVALID | bmBULK | bmQUADBUF | bmIN; SYNCDELAY; // 512 quad bulk IN - EP8CFG = 0; SYNCDELAY; // disabled - - // reset FIFOs - - FIFORESET = bmNAKALL; SYNCDELAY; - FIFORESET = 2; SYNCDELAY; - // FIFORESET = 4; SYNCDELAY; - FIFORESET = 6; SYNCDELAY; - // FIFORESET = 8; SYNCDELAY; - FIFORESET = 0; SYNCDELAY; - - // configure end point FIFOs - - // let core see 0 to 1 transistion of autoout bit - - EP2FIFOCFG = bmWORDWIDE; SYNCDELAY; - EP2FIFOCFG = bmAUTOOUT | bmWORDWIDE; SYNCDELAY; - EP6FIFOCFG = bmAUTOIN | bmWORDWIDE; SYNCDELAY; - - - // prime the pump - -#if 0 - EP2BCL = 0x80; SYNCDELAY; - EP2BCL = 0x80; SYNCDELAY; - EP2BCL = 0x80; SYNCDELAY; - EP2BCL = 0x80; SYNCDELAY; -#endif - - EP0BCH = 0; SYNCDELAY; - - // arm EP1OUT so we can receive "out" packets (TRM pg 8-8) - - EP1OUTBC = 0; SYNCDELAY; - - EP2GPIFFLGSEL = 0x01; SYNCDELAY; // For EP2OUT, GPIF uses EF flag - EP6GPIFFLGSEL = 0x02; SYNCDELAY; // For EP6IN, GPIF uses FF flag - - // set autoin length for EP6 - // FIXME should be f(enumeration) - - EP6AUTOINLENH = (512) >> 8; SYNCDELAY; // this is the length for high speed - EP6AUTOINLENL = (512) & 0xff; SYNCDELAY; - - init_board (); -} - diff --git a/usrp/firmware/src/common/usrp_globals.h b/usrp/firmware/src/common/usrp_globals.h deleted file mode 100644 index 445e9e6b4..000000000 --- a/usrp/firmware/src/common/usrp_globals.h +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 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 _USRP_GLOBALS_H_ -#define _USRP_GLOBALS_H_ - -extern unsigned char g_tx_enable; -extern unsigned char g_rx_enable; -extern unsigned char g_fpga_reset; -extern unsigned char g_rx_overrun; -extern unsigned char g_tx_underrun; - - -#endif /* _USRP_GLOBALS_H_ */ diff --git a/usrp/firmware/src/common/vectors.a51 b/usrp/firmware/src/common/vectors.a51 deleted file mode 100644 index e9382ab84..000000000 --- a/usrp/firmware/src/common/vectors.a51 +++ /dev/null @@ -1,180 +0,0 @@ -;;; -*- asm -*- -;;; -;;; Copyright 2003 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. -;;; - -;;; Interrupt vectors. - -;;; N.B. This object module must come first in the list of modules - - .module vectors - -;;; ---------------------------------------------------------------- -;;; standard FX2 interrupt vectors -;;; ---------------------------------------------------------------- - - .area CSEG (CODE) - .area GSINIT (CODE) - .area CSEG (CODE) -__standard_interrupt_vector:: -__reset_vector:: - ljmp s_GSINIT - - ;; 13 8-byte entries. We point them all at __isr_nop - ljmp __isr_nop ; 3 bytes - .ds 5 ; + 5 = 8 bytes for vector slot - ljmp __isr_nop - .ds 5 - ljmp __isr_nop - .ds 5 - ljmp __isr_nop - .ds 5 - ljmp __isr_nop - .ds 5 - ljmp __isr_nop - .ds 5 - ljmp __isr_nop - .ds 5 - ljmp __isr_nop - .ds 5 - ljmp __isr_nop - .ds 5 - ljmp __isr_nop - .ds 5 - ljmp __isr_nop - .ds 5 - ljmp __isr_nop - .ds 5 - ljmp __isr_nop - .ds 5 - -__isr_nop:: - reti - -;;; ---------------------------------------------------------------- -;;; the FIFO/GPIF autovector. 14 4-byte entries. -;;; must start on a 128 byte boundary. -;;; ---------------------------------------------------------------- - - . = __reset_vector + 0x0080 - -__fifo_gpif_autovector:: - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - - -;;; ---------------------------------------------------------------- -;;; the USB autovector. 32 4-byte entries. -;;; must start on a 256 byte boundary. -;;; ---------------------------------------------------------------- - - . = __reset_vector + 0x0100 - -__usb_autovector:: - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop - ljmp __isr_nop - nop diff --git a/usrp/firmware/src/usrp2/.gitignore b/usrp/firmware/src/usrp2/.gitignore deleted file mode 100644 index 54a9e9415..000000000 --- a/usrp/firmware/src/usrp2/.gitignore +++ /dev/null @@ -1,20 +0,0 @@ -/*.ihx -/*.lnk -/*.lst -/*.map -/*.mem -/*.rel -/*.rst -/*.sym -/blink_leds.asm -/usrp_common.asm -/command_loop.asm -/fpga.asm -/*.asm -/Makefile -/Makefile.in -/usrp_gpif.c -/usrp_gpif_inline.h -/Makefile.in -/burn-usrp2-eeprom -/burn-usrp4-eeprom diff --git a/usrp/firmware/src/usrp2/Makefile.am b/usrp/firmware/src/usrp2/Makefile.am deleted file mode 100644 index 4402cd636..000000000 --- a/usrp/firmware/src/usrp2/Makefile.am +++ /dev/null @@ -1,171 +0,0 @@ -# -# Copyright 2003,2006 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. -# - -firmware2dir = $(prefix)/share/usrp/rev2 -firmware2_DATA = std.ihx - -# we put the same stuff in the rev4 directory -firmware4dir = $(prefix)/share/usrp/rev4 -firmware4_DATA = std.ihx - -EXTRA_DIST = \ - edit-gpif \ - _startup.a51 \ - blink_leds.c \ - board_specific.c \ - check_mdelay.c \ - check_udelay.c \ - eeprom_boot.a51 \ - eeprom_init.c \ - eeprom_io.c \ - eeprom_io.h \ - fpga_load.c \ - fpga_rev2.c \ - fpga_rev2.h \ - gpif.c \ - init_gpif.c \ - spi.c \ - spi.h \ - usb_descriptors.a51 \ - usrp_common.c \ - usrp_common.h \ - usrp_gpif.c \ - usrp_main.c \ - usrp_rev2_regs.h \ - vectors.a51 - - -DEFINES=-DHAVE_USRP2 -FW_INCLUDES=-I$(top_srcdir)/usrp/firmware/include \ - -I$(top_srcdir)/usrp/firmware/src/usrp2 \ - -I$(top_srcdir)/usrp/firmware/src/common \ - -I$(top_builddir)/usrp/firmware/src/common - -# with EA = 0, the FX2 implements a portion of the 8051 "external memory" -# on chip. This memory is mapped like this: -# -# The bottom 8K of memory (0x0000 - 0x1fff) is used for both data and -# code accesses. There's also 512 bytes for data only from 0xe000 - 0xe1ff. -# -# We tell the linker to start the xdata segment at 0x1800, 6K up from -# the bottom. - -MEMOPTS = --code-loc 0x0000 --code-size 0x1800 --xram-loc 0x1800 --xram-size 0x0800 \ - -Wl '-b USBDESCSEG = 0xE000' - -LIBOPTS = -L ../../lib libfx2.lib -LIBDEP = ../../lib/libfx2.lib - -LINKOPTS = $(MEMOPTS) $(LIBOPTS) - -EXECUTABLES = \ - std.ihx \ - blink_leds.ihx \ - check_mdelay.ihx \ - check_udelay.ihx \ - eeprom_boot.ihx - -STARTUP = _startup.rel - -noinst_SCRIPTS = \ - burn-usrp2-eeprom \ - burn-usrp4-eeprom - - -.c.rel: - $(XCC) $(FW_INCLUDES) $(DEFINES) \ - -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< - -.a51.rel: - test -f `basename '$<'` || $(LN_S) '$<' . - test -f ../common/`basename '$<'` -o \ - \! -f `dirname '$<'`/../common/`basename '$<'` \ - || $(LN_S) `dirname '$<'`/../common/`basename '$<'` ../common/`basename '$<'` - $(XAS) `basename '$<'` - - -EEPROM_BOOT_OBJS = eeprom_boot.rel eeprom_init.rel $(STARTUP) - -eeprom_boot.ihx: $(EEPROM_BOOT_OBJS) $(LIBDEP) - $(XCC) $(LINKOPTS) -o $@ $(EEPROM_BOOT_OBJS) - -burn-usrp2-eeprom: eeprom_boot.ihx - $(PYTHON) $(srcdir)/../common/build_eeprom.py -p$(prefix) -r2 eeprom_boot.ihx > $@ - chmod +x $@ - -burn-usrp4-eeprom: eeprom_boot.ihx - $(PYTHON) $(srcdir)/../common/build_eeprom.py -p$(prefix) -r4 eeprom_boot.ihx > $@ - chmod +x $@ - - -BLINK_LEDS_OBJS = blink_leds.rel usrp_common.rel board_specific.rel spi.rel $(STARTUP) - -blink_leds.ihx: $(BLINK_LEDS_OBJS) $(LIBDEP) - $(XCC) $(LINKOPTS) -o $@ $(BLINK_LEDS_OBJS) - - -CHECK_MDELAY_OBJS = check_mdelay.rel usrp_common.rel board_specific.rel spi.rel $(STARTUP) - -check_mdelay.ihx: $(CHECK_MDELAY_OBJS) $(LIBDEP) - $(XCC) $(LINKOPTS) -o $@ $(CHECK_MDELAY_OBJS) - - - -CHECK_UDELAY_OBJS = check_udelay.rel usrp_common.rel board_specific.rel spi.rel $(STARTUP) - -check_udelay.ihx: $(CHECK_UDELAY_OBJS) $(LIBDEP) - $(XCC) $(LINKOPTS) -o $@ $(CHECK_UDELAY_OBJS) - - - -USRP_OBJS = \ - vectors.rel \ - usrp_main.rel usrp_common.rel board_specific.rel \ - fpga_load.rel fpga_rev2.rel init_gpif.rel usrp_gpif.rel \ - usb_descriptors.rel spi.rel eeprom_io.rel $(STARTUP) - -std.ihx: $(USRP_OBJS) $(LIBDEP) - $(XCC) $(LINKOPTS) -o $@ $(USRP_OBJS) - -CLEANFILES = \ - *.ihx *.lnk *.lst *.map *.mem *.rel *.rst *.sym *.asm *.lib \ - usrp_gpif.c usrp_gpif_inline.h \ - burn-usrp2-eeprom \ - burn-usrp4-eeprom - -DISTCLEANFILES = \ - *.ihx *.lnk *.lst *.map *.mem *.rel *.rst *.sym *.asm *.lib - -# build gpif stuff - -all: usrp_gpif.c - -usrp_gpif.c usrp_gpif_inline.h : gpif.c - srcdir=$(srcdir) $(PYTHON) $(srcdir)/edit-gpif $(srcdir)/gpif.c usrp_gpif.c usrp_gpif_inline.h - - -# dependencies - -usrp_main.rel: usrp_gpif_inline.h -#usrp_main.rel: fpga.h usrp_common.h ../../include/usrp_commands.h usrp_gpif_inline.h ../../include/usrp_config.h usrp_rev2_regs.h ../../include/fx2regs.h -#usrp_common.rel: usrp_common.h ../../include/usrp_commands.h ../../include/usrp_config.h usrp_rev2_regs.h ../../include/fx2regs.h -#fpga.rel: usrp_common.h ../../include/usrp_commands.h fpga.h ../../include/usrp_config.h usrp_rev2_regs.h ../../include/fx2regs.h -#init_gpif.rel: usrp_common.h ../../include/usrp_config.h usrp_rev2_regs.h ../../include/fx2regs.h diff --git a/usrp/firmware/src/usrp2/_startup.a51 b/usrp/firmware/src/usrp2/_startup.a51 deleted file mode 100644 index 4f5309922..000000000 --- a/usrp/firmware/src/usrp2/_startup.a51 +++ /dev/null @@ -1 +0,0 @@ - .include "../common/_startup.a51" diff --git a/usrp/firmware/src/usrp2/blink_leds.c b/usrp/firmware/src/usrp2/blink_leds.c deleted file mode 100644 index c633d5d48..000000000 --- a/usrp/firmware/src/usrp2/blink_leds.c +++ /dev/null @@ -1 +0,0 @@ -#include "../common/blink_leds.c" diff --git a/usrp/firmware/src/usrp2/board_specific.c b/usrp/firmware/src/usrp2/board_specific.c deleted file mode 100644 index ef0081d84..000000000 --- a/usrp/firmware/src/usrp2/board_specific.c +++ /dev/null @@ -1,113 +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. - */ - -#include "usrp_common.h" -#include "spi.h" - -void -set_led_0 (unsigned char on) -{ - if (!on) // active low - USRP_PC |= bmPC_LED0; - else - USRP_PC &= ~bmPC_LED0; -} - -void -set_led_1 (unsigned char on) -{ - if (!on) // active low - USRP_PC |= bmPC_LED1; - else - USRP_PC &= ~bmPC_LED1; -} - -void -toggle_led_0 (void) -{ - USRP_PC ^= bmPC_LED0; -} - -void -toggle_led_1 (void) -{ - USRP_PC ^= bmPC_LED1; -} - -void -la_trace_init (void) -{ -} - -void -set_sleep_bits (unsigned char bits, unsigned char mask) -{ - // NOP on usrp1 -} - -static xdata unsigned char xbuf[1]; - -void -write_9862 (unsigned char which, unsigned char regno, unsigned char value) -{ - xbuf[0] = value; - - spi_write (0, regno & 0x3f, - which == 0 ? SPI_ENABLE_CODEC_A : SPI_ENABLE_CODEC_B, - SPI_FMT_MSB | SPI_FMT_HDR_1, - xbuf, 1); -} - -void -write_both_9862s (unsigned char regno, unsigned char value) -{ - xbuf[0] = value; - - spi_write (0, regno & 0x3f, - SPI_ENABLE_CODEC_A | SPI_ENABLE_CODEC_B, - SPI_FMT_MSB | SPI_FMT_HDR_1, - xbuf, 1); -} - -#define REG_RX_PWR_DN 1 -#define REG_TX_PWR_DN 8 -#define REG_TX_MODULATOR 20 - -static void -power_down_9862s (void) -{ - write_both_9862s (REG_RX_PWR_DN, 0x01); - write_both_9862s (REG_TX_PWR_DN, 0x0f); // pwr dn digital and analog_both - write_both_9862s (REG_TX_MODULATOR, 0x00); // coarse & fine modulators disabled -} - -void -init_board (void) -{ - la_trace_init (); - init_spi (); - - USRP_PC &= ~bmPC_nRESET; // active low reset - USRP_PC |= bmPC_nRESET; - - power_down_9862s (); -} diff --git a/usrp/firmware/src/usrp2/check_mdelay.c b/usrp/firmware/src/usrp2/check_mdelay.c deleted file mode 100644 index ea4ccdb14..000000000 --- a/usrp/firmware/src/usrp2/check_mdelay.c +++ /dev/null @@ -1 +0,0 @@ -#include "../common/check_mdelay.c" diff --git a/usrp/firmware/src/usrp2/check_udelay.c b/usrp/firmware/src/usrp2/check_udelay.c deleted file mode 100644 index d01622e5e..000000000 --- a/usrp/firmware/src/usrp2/check_udelay.c +++ /dev/null @@ -1 +0,0 @@ -#include "../common/check_udelay.c" diff --git a/usrp/firmware/src/usrp2/edit-gpif b/usrp/firmware/src/usrp2/edit-gpif deleted file mode 100755 index 5367b75a5..000000000 --- a/usrp/firmware/src/usrp2/edit-gpif +++ /dev/null @@ -1,114 +0,0 @@ -#!/usr/bin/env python -# -*- Python -*- -# -# Copyright 2003 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. -# - - -# Edit the gpif.c file generated by the Cypress GPIF Designer Tool and -# produce usrp_gpif.c, and usrp_gpif_inline.h, files suitable for our -# uses. - -import re -import string -import sys - -def check_flow_state (line, flow_state_dict): - mo = re.match (r'/\* Wave (\d) FlowStates \*/ (.*),', line) - if mo: - wave = int (mo.group (1)) - data = mo.group (2) - split = data.split (',', 8) - v = map (lambda x : int (x, 16), split) - # print "%s, %s" % (wave, data) - # print "split: ", split - # print "v : ", v - flow_state_dict[wave] = v - - -def delta (xseq, yseq): - # set subtraction - z = [] - for x in xseq: - if x not in yseq: - z.append (x) - return z - - -def write_define (output, name, pairs): - output.write ('#define %s()\t\\\n' % name) - output.write ('do {\t\t\t\t\t\\\n') - for reg, val in pairs: - output.write ('%14s = 0x%02x;\t\t\t\\\n' % (reg, val)) - output.write ('} while (0)\n\n') - -def write_inlines (output, dict): - regs = ['FLOWSTATE', 'FLOWLOGIC', 'FLOWEQ0CTL', 'FLOWEQ1CTL', 'FLOWHOLDOFF', - 'FLOWSTB', 'FLOWSTBEDGE', 'FLOWSTBHPERIOD', 'GPIFHOLDAMOUNT'] - - READ_FLOW_STATE = 2 - WRITE_FLOW_STATE = 3 - - read_info = zip (regs, dict[READ_FLOW_STATE]) - write_info = zip (regs, dict[WRITE_FLOW_STATE]) - - output.write ('''/* - * Machine generated by "edit-gpif". Do not edit by hand. - */ - -''') - write_define (output, 'setup_flowstate_common', read_info) - write_define (output, 'setup_flowstate_read', delta (read_info, write_info)) - write_define (output, 'setup_flowstate_write', delta (write_info, read_info)) - - -def edit_gpif (input_name, output_name, inline_name): - input = open (input_name, 'r') - output = open (output_name, 'w') - inline = open (inline_name, 'w') - flow_state_dict = {} - - output.write ('''/* - * Machine generated by "edit-gpif". Do not edit by hand. - */ - -''') - - while 1: - line = input.readline () - line = string.replace (line, '\r','') - line = re.sub (r' *$', r'', line) - - check_flow_state (line, flow_state_dict) - - line = re.sub (r'#include', r'// #include', line) - line = re.sub (r'xdata ', r'', line) - if re.search (r'GpifInit', line): - break - - output.write (line) - - output.close () - write_inlines (inline, flow_state_dict) - inline.close () - - -# gpif.c usrp_gpif.c usrp_gpif_inline.h -edit_gpif (sys.argv[1], sys.argv[2], sys.argv[3]) diff --git a/usrp/firmware/src/usrp2/eeprom_boot.a51 b/usrp/firmware/src/usrp2/eeprom_boot.a51 deleted file mode 100644 index 65e452668..000000000 --- a/usrp/firmware/src/usrp2/eeprom_boot.a51 +++ /dev/null @@ -1,573 +0,0 @@ -;-------------------------------------------------------- -; Hand tweaked minimal eeprom boot code -;-------------------------------------------------------- - .module eeprom_boot - .optsdcc -mmcs51 --model-small - -;-------------------------------------------------------- -; Public variables in this module -;-------------------------------------------------------- - .globl _eeprom_init - .globl _EP8FIFOBUF - .globl _EP6FIFOBUF - .globl _EP4FIFOBUF - .globl _EP2FIFOBUF - .globl _EP1INBUF - .globl _EP1OUTBUF - .globl _EP0BUF - .globl _CT4 - .globl _CT3 - .globl _CT2 - .globl _CT1 - .globl _USBTEST - .globl _TESTCFG - .globl _DBUG - .globl _UDMACRCQUAL - .globl _UDMACRCL - .globl _UDMACRCH - .globl _GPIFHOLDAMOUNT - .globl _FLOWSTBHPERIOD - .globl _FLOWSTBEDGE - .globl _FLOWSTB - .globl _FLOWHOLDOFF - .globl _FLOWEQ1CTL - .globl _FLOWEQ0CTL - .globl _FLOWLOGIC - .globl _FLOWSTATE - .globl _GPIFABORT - .globl _GPIFREADYSTAT - .globl _GPIFREADYCFG - .globl _XGPIFSGLDATLNOX - .globl _XGPIFSGLDATLX - .globl _XGPIFSGLDATH - .globl _EP8GPIFTRIG - .globl _EP8GPIFPFSTOP - .globl _EP8GPIFFLGSEL - .globl _EP6GPIFTRIG - .globl _EP6GPIFPFSTOP - .globl _EP6GPIFFLGSEL - .globl _EP4GPIFTRIG - .globl _EP4GPIFPFSTOP - .globl _EP4GPIFFLGSEL - .globl _EP2GPIFTRIG - .globl _EP2GPIFPFSTOP - .globl _EP2GPIFFLGSEL - .globl _GPIFTCB0 - .globl _GPIFTCB1 - .globl _GPIFTCB2 - .globl _GPIFTCB3 - .globl _GPIFADRL - .globl _GPIFADRH - .globl _GPIFCTLCFG - .globl _GPIFIDLECTL - .globl _GPIFIDLECS - .globl _GPIFWFSELECT - .globl _SETUPDAT - .globl _SUDPTRCTL - .globl _SUDPTRL - .globl _SUDPTRH - .globl _EP8FIFOBCL - .globl _EP8FIFOBCH - .globl _EP6FIFOBCL - .globl _EP6FIFOBCH - .globl _EP4FIFOBCL - .globl _EP4FIFOBCH - .globl _EP2FIFOBCL - .globl _EP2FIFOBCH - .globl _EP8FIFOFLGS - .globl _EP6FIFOFLGS - .globl _EP4FIFOFLGS - .globl _EP2FIFOFLGS - .globl _EP8CS - .globl _EP6CS - .globl _EP4CS - .globl _EP2CS - .globl _EP1INCS - .globl _EP1OUTCS - .globl _EP0CS - .globl _EP8BCL - .globl _EP8BCH - .globl _EP6BCL - .globl _EP6BCH - .globl _EP4BCL - .globl _EP4BCH - .globl _EP2BCL - .globl _EP2BCH - .globl _EP1INBC - .globl _EP1OUTBC - .globl _EP0BCL - .globl _EP0BCH - .globl _FNADDR - .globl _MICROFRAME - .globl _USBFRAMEL - .globl _USBFRAMEH - .globl _TOGCTL - .globl _WAKEUPCS - .globl _SUSPEND - .globl _USBCS - .globl _XAUTODAT2 - .globl _XAUTODAT1 - .globl _I2CTL - .globl _I2DAT - .globl _I2CS - .globl _PORTECFG - .globl _PORTCCFG - .globl _PORTACFG - .globl _INTSETUP - .globl _INT4IVEC - .globl _INT2IVEC - .globl _CLRERRCNT - .globl _ERRCNTLIM - .globl _USBERRIRQ - .globl _USBERRIE - .globl _GPIFIRQ - .globl _GPIFIE - .globl _EPIRQ - .globl _EPIE - .globl _USBIRQ - .globl _USBIE - .globl _NAKIRQ - .globl _NAKIE - .globl _IBNIRQ - .globl _IBNIE - .globl _EP8FIFOIRQ - .globl _EP8FIFOIE - .globl _EP6FIFOIRQ - .globl _EP6FIFOIE - .globl _EP4FIFOIRQ - .globl _EP4FIFOIE - .globl _EP2FIFOIRQ - .globl _EP2FIFOIE - .globl _OUTPKTEND - .globl _INPKTEND - .globl _EP8ISOINPKTS - .globl _EP6ISOINPKTS - .globl _EP4ISOINPKTS - .globl _EP2ISOINPKTS - .globl _EP8FIFOPFL - .globl _EP8FIFOPFH - .globl _EP6FIFOPFL - .globl _EP6FIFOPFH - .globl _EP4FIFOPFL - .globl _EP4FIFOPFH - .globl _EP2FIFOPFL - .globl _EP2FIFOPFH - .globl _EP8AUTOINLENL - .globl _EP8AUTOINLENH - .globl _EP6AUTOINLENL - .globl _EP6AUTOINLENH - .globl _EP4AUTOINLENL - .globl _EP4AUTOINLENH - .globl _EP2AUTOINLENL - .globl _EP2AUTOINLENH - .globl _EP8FIFOCFG - .globl _EP6FIFOCFG - .globl _EP4FIFOCFG - .globl _EP2FIFOCFG - .globl _EP8CFG - .globl _EP6CFG - .globl _EP4CFG - .globl _EP2CFG - .globl _EP1INCFG - .globl _EP1OUTCFG - .globl _REVCTL - .globl _REVID - .globl _FIFOPINPOLAR - .globl _UART230 - .globl _BPADDRL - .globl _BPADDRH - .globl _BREAKPT - .globl _FIFORESET - .globl _PINFLAGSCD - .globl _PINFLAGSAB - .globl _IFCONFIG - .globl _CPUCS - .globl _RES_WAVEDATA_END - .globl _GPIF_WAVE_DATA -;-------------------------------------------------------- -; special function registers -;-------------------------------------------------------- -_IOA = 0x0080 -_SP = 0x0081 -_DPL = 0x0082 -_DPH = 0x0083 -_DPL1 = 0x0084 -_DPH1 = 0x0085 -_DPS = 0x0086 -_PCON = 0x0087 -_TCON = 0x0088 -_TMOD = 0x0089 -_TL0 = 0x008a -_TL1 = 0x008b -_TH0 = 0x008c -_TH1 = 0x008d -_CKCON = 0x008e -_IOB = 0x0090 -_EXIF = 0x0091 -_MPAGE = 0x0092 -_SCON0 = 0x0098 -_SBUF0 = 0x0099 -_APTR1H = 0x009a -_APTR1L = 0x009b -_AUTODAT1 = 0x009c -_AUTOPTRH2 = 0x009d -_AUTOPTRL2 = 0x009e -_AUTODAT2 = 0x009f -_IOC = 0x00a0 -_INT2CLR = 0x00a1 -_INT4CLR = 0x00a2 -_IE = 0x00a8 -_EP2468STAT = 0x00aa -_EP24FIFOFLGS = 0x00ab -_EP68FIFOFLGS = 0x00ac -_AUTOPTRSETUP = 0x00af -_IOD = 0x00b0 -_IOE = 0x00b1 -_OEA = 0x00b2 -_OEB = 0x00b3 -_OEC = 0x00b4 -_OED = 0x00b5 -_OEE = 0x00b6 -_IP = 0x00b8 -_EP01STAT = 0x00ba -_GPIFTRIG = 0x00bb -_GPIFSGLDATH = 0x00bd -_GPIFSGLDATLX = 0x00be -_GPIFSGLDATLNOX = 0x00bf -_SCON1 = 0x00c0 -_SBUF1 = 0x00c1 -_T2CON = 0x00c8 -_RCAP2L = 0x00ca -_RCAP2H = 0x00cb -_TL2 = 0x00cc -_TH2 = 0x00cd -_PSW = 0x00d0 -_EICON = 0x00d8 -_ACC = 0x00e0 -_EIE = 0x00e8 -_B = 0x00f0 -_EIP = 0x00f8 -;-------------------------------------------------------- -; special function bits -;-------------------------------------------------------- -_SEL = 0x0086 -_IT0 = 0x0088 -_IE0 = 0x0089 -_IT1 = 0x008a -_IE1 = 0x008b -_TR0 = 0x008c -_TF0 = 0x008d -_TR1 = 0x008e -_TF1 = 0x008f -_RI = 0x0098 -_TI = 0x0099 -_RB8 = 0x009a -_TB8 = 0x009b -_REN = 0x009c -_SM2 = 0x009d -_SM1 = 0x009e -_SM0 = 0x009f -_EX0 = 0x00a8 -_ET0 = 0x00a9 -_EX1 = 0x00aa -_ET1 = 0x00ab -_ES0 = 0x00ac -_ET2 = 0x00ad -_ES1 = 0x00ae -_EA = 0x00af -_PX0 = 0x00b8 -_PT0 = 0x00b9 -_PX1 = 0x00ba -_PT1 = 0x00bb -_PS0 = 0x00bc -_PT2 = 0x00bd -_PS1 = 0x00be -_RI1 = 0x00c0 -_TI1 = 0x00c1 -_RB81 = 0x00c2 -_TB81 = 0x00c3 -_REN1 = 0x00c4 -_SM21 = 0x00c5 -_SM11 = 0x00c6 -_SM01 = 0x00c7 -_CP_RL2 = 0x00c8 -_C_T2 = 0x00c9 -_TR2 = 0x00ca -_EXEN2 = 0x00cb -_TCLK = 0x00cc -_RCLK = 0x00cd -_EXF2 = 0x00ce -_TF2 = 0x00cf -_P = 0x00d0 -_FL = 0x00d1 -_OV = 0x00d2 -_RS0 = 0x00d3 -_RS1 = 0x00d4 -_F0 = 0x00d5 -_AC = 0x00d6 -_CY = 0x00d7 -_INT6 = 0x00db -_RESI = 0x00dc -_ERESI = 0x00dd -_SMOD1 = 0x00df -_EIUSB = 0x00e8 -_EI2C = 0x00e9 -_EIEX4 = 0x00ea -_EIEX5 = 0x00eb -_EIEX6 = 0x00ec -_PUSB = 0x00f8 -_PI2C = 0x00f9 -_EIPX4 = 0x00fa -_EIPX5 = 0x00fb -_EIPX6 = 0x00fc -_bitS_CLK = 0x0080 -_bitS_OUT = 0x0081 -_bitS_IN = 0x0082 -_bitALTERA_DATA0 = 0x00a1 -_bitALTERA_DCLK = 0x00a3 -;-------------------------------------------------------- -; overlayable register banks -;-------------------------------------------------------- - .area REG_BANK_0 (REL,OVR,DATA) - .ds 8 -;-------------------------------------------------------- -; internal ram data -;-------------------------------------------------------- - .area DSEG (DATA) -;-------------------------------------------------------- -; overlayable items in internal ram -;-------------------------------------------------------- - .area OSEG (OVR,DATA) -;-------------------------------------------------------- -; Stack segment in internal ram -;-------------------------------------------------------- - .area SSEG (DATA) -__start__stack: - .ds 1 - -;-------------------------------------------------------- -; indirectly addressable internal ram data -;-------------------------------------------------------- - .area ISEG (DATA) -;-------------------------------------------------------- -; bit data -;-------------------------------------------------------- - .area BSEG (BIT) -;-------------------------------------------------------- -; external ram data -;-------------------------------------------------------- - .area XSEG (XDATA) -_GPIF_WAVE_DATA = 0xe400 -_RES_WAVEDATA_END = 0xe480 -_CPUCS = 0xe600 -_IFCONFIG = 0xe601 -_PINFLAGSAB = 0xe602 -_PINFLAGSCD = 0xe603 -_FIFORESET = 0xe604 -_BREAKPT = 0xe605 -_BPADDRH = 0xe606 -_BPADDRL = 0xe607 -_UART230 = 0xe608 -_FIFOPINPOLAR = 0xe609 -_REVID = 0xe60a -_REVCTL = 0xe60b -_EP1OUTCFG = 0xe610 -_EP1INCFG = 0xe611 -_EP2CFG = 0xe612 -_EP4CFG = 0xe613 -_EP6CFG = 0xe614 -_EP8CFG = 0xe615 -_EP2FIFOCFG = 0xe618 -_EP4FIFOCFG = 0xe619 -_EP6FIFOCFG = 0xe61a -_EP8FIFOCFG = 0xe61b -_EP2AUTOINLENH = 0xe620 -_EP2AUTOINLENL = 0xe621 -_EP4AUTOINLENH = 0xe622 -_EP4AUTOINLENL = 0xe623 -_EP6AUTOINLENH = 0xe624 -_EP6AUTOINLENL = 0xe625 -_EP8AUTOINLENH = 0xe626 -_EP8AUTOINLENL = 0xe627 -_EP2FIFOPFH = 0xe630 -_EP2FIFOPFL = 0xe631 -_EP4FIFOPFH = 0xe632 -_EP4FIFOPFL = 0xe633 -_EP6FIFOPFH = 0xe634 -_EP6FIFOPFL = 0xe635 -_EP8FIFOPFH = 0xe636 -_EP8FIFOPFL = 0xe637 -_EP2ISOINPKTS = 0xe640 -_EP4ISOINPKTS = 0xe641 -_EP6ISOINPKTS = 0xe642 -_EP8ISOINPKTS = 0xe643 -_INPKTEND = 0xe648 -_OUTPKTEND = 0xe649 -_EP2FIFOIE = 0xe650 -_EP2FIFOIRQ = 0xe651 -_EP4FIFOIE = 0xe652 -_EP4FIFOIRQ = 0xe653 -_EP6FIFOIE = 0xe654 -_EP6FIFOIRQ = 0xe655 -_EP8FIFOIE = 0xe656 -_EP8FIFOIRQ = 0xe657 -_IBNIE = 0xe658 -_IBNIRQ = 0xe659 -_NAKIE = 0xe65a -_NAKIRQ = 0xe65b -_USBIE = 0xe65c -_USBIRQ = 0xe65d -_EPIE = 0xe65e -_EPIRQ = 0xe65f -_GPIFIE = 0xe660 -_GPIFIRQ = 0xe661 -_USBERRIE = 0xe662 -_USBERRIRQ = 0xe663 -_ERRCNTLIM = 0xe664 -_CLRERRCNT = 0xe665 -_INT2IVEC = 0xe666 -_INT4IVEC = 0xe667 -_INTSETUP = 0xe668 -_PORTACFG = 0xe670 -_PORTCCFG = 0xe671 -_PORTECFG = 0xe672 -_I2CS = 0xe678 -_I2DAT = 0xe679 -_I2CTL = 0xe67a -_XAUTODAT1 = 0xe67b -_XAUTODAT2 = 0xe67c -_USBCS = 0xe680 -_SUSPEND = 0xe681 -_WAKEUPCS = 0xe682 -_TOGCTL = 0xe683 -_USBFRAMEH = 0xe684 -_USBFRAMEL = 0xe685 -_MICROFRAME = 0xe686 -_FNADDR = 0xe687 -_EP0BCH = 0xe68a -_EP0BCL = 0xe68b -_EP1OUTBC = 0xe68d -_EP1INBC = 0xe68f -_EP2BCH = 0xe690 -_EP2BCL = 0xe691 -_EP4BCH = 0xe694 -_EP4BCL = 0xe695 -_EP6BCH = 0xe698 -_EP6BCL = 0xe699 -_EP8BCH = 0xe69c -_EP8BCL = 0xe69d -_EP0CS = 0xe6a0 -_EP1OUTCS = 0xe6a1 -_EP1INCS = 0xe6a2 -_EP2CS = 0xe6a3 -_EP4CS = 0xe6a4 -_EP6CS = 0xe6a5 -_EP8CS = 0xe6a6 -_EP2FIFOFLGS = 0xe6a7 -_EP4FIFOFLGS = 0xe6a8 -_EP6FIFOFLGS = 0xe6a9 -_EP8FIFOFLGS = 0xe6aa -_EP2FIFOBCH = 0xe6ab -_EP2FIFOBCL = 0xe6ac -_EP4FIFOBCH = 0xe6ad -_EP4FIFOBCL = 0xe6ae -_EP6FIFOBCH = 0xe6af -_EP6FIFOBCL = 0xe6b0 -_EP8FIFOBCH = 0xe6b1 -_EP8FIFOBCL = 0xe6b2 -_SUDPTRH = 0xe6b3 -_SUDPTRL = 0xe6b4 -_SUDPTRCTL = 0xe6b5 -_SETUPDAT = 0xe6b8 -_GPIFWFSELECT = 0xe6c0 -_GPIFIDLECS = 0xe6c1 -_GPIFIDLECTL = 0xe6c2 -_GPIFCTLCFG = 0xe6c3 -_GPIFADRH = 0xe6c4 -_GPIFADRL = 0xe6c5 -_GPIFTCB3 = 0xe6ce -_GPIFTCB2 = 0xe6cf -_GPIFTCB1 = 0xe6d0 -_GPIFTCB0 = 0xe6d1 -_EP2GPIFFLGSEL = 0xe6d2 -_EP2GPIFPFSTOP = 0xe6d3 -_EP2GPIFTRIG = 0xe6d4 -_EP4GPIFFLGSEL = 0xe6da -_EP4GPIFPFSTOP = 0xe6db -_EP4GPIFTRIG = 0xe6dc -_EP6GPIFFLGSEL = 0xe6e2 -_EP6GPIFPFSTOP = 0xe6e3 -_EP6GPIFTRIG = 0xe6e4 -_EP8GPIFFLGSEL = 0xe6ea -_EP8GPIFPFSTOP = 0xe6eb -_EP8GPIFTRIG = 0xe6ec -_XGPIFSGLDATH = 0xe6f0 -_XGPIFSGLDATLX = 0xe6f1 -_XGPIFSGLDATLNOX = 0xe6f2 -_GPIFREADYCFG = 0xe6f3 -_GPIFREADYSTAT = 0xe6f4 -_GPIFABORT = 0xe6f5 -_FLOWSTATE = 0xe6c6 -_FLOWLOGIC = 0xe6c7 -_FLOWEQ0CTL = 0xe6c8 -_FLOWEQ1CTL = 0xe6c9 -_FLOWHOLDOFF = 0xe6ca -_FLOWSTB = 0xe6cb -_FLOWSTBEDGE = 0xe6cc -_FLOWSTBHPERIOD = 0xe6cd -_GPIFHOLDAMOUNT = 0xe60c -_UDMACRCH = 0xe67d -_UDMACRCL = 0xe67e -_UDMACRCQUAL = 0xe67f -_DBUG = 0xe6f8 -_TESTCFG = 0xe6f9 -_USBTEST = 0xe6fa -_CT1 = 0xe6fb -_CT2 = 0xe6fc -_CT3 = 0xe6fd -_CT4 = 0xe6fe -_EP0BUF = 0xe740 -_EP1OUTBUF = 0xe780 -_EP1INBUF = 0xe7c0 -_EP2FIFOBUF = 0xf000 -_EP4FIFOBUF = 0xf400 -_EP6FIFOBUF = 0xf800 -_EP8FIFOBUF = 0xfc00 -;-------------------------------------------------------- -; external initialized ram data -;-------------------------------------------------------- -;-------------------------------------------------------- -; interrupt vector -;-------------------------------------------------------- - .area CSEG (CODE) -__interrupt_vect: - ljmp __sdcc_gsinit_startup -;-------------------------------------------------------- -; global & static initialisations -;-------------------------------------------------------- - .area GSINIT (CODE) - .area GSFINAL (CODE) - .area GSINIT (CODE) -__sdcc_gsinit_startup: - mov sp,#__start__stack - 1 - lcall __sdcc_external_startup - mov a,dpl - jz __sdcc_init_data - ljmp __sdcc_program_startup -__sdcc_init_data: - .area GSFINAL (CODE) - ljmp __sdcc_program_startup -;-------------------------------------------------------- -; Home -;-------------------------------------------------------- - .area HOME (CODE) - .area CSEG (CODE) -;-------------------------------------------------------- -; code -;-------------------------------------------------------- - .area CSEG (CODE) -__sdcc_program_startup: - lcall _eeprom_init -; return from _eeprom_init will spin here - sjmp . - .area CSEG (CODE) diff --git a/usrp/firmware/src/usrp2/eeprom_init.c b/usrp/firmware/src/usrp2/eeprom_init.c deleted file mode 100644 index a6f6cbe2d..000000000 --- a/usrp/firmware/src/usrp2/eeprom_init.c +++ /dev/null @@ -1,116 +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. - */ - -#include "usrp_common.h" -#include "usrp_commands.h" -#include "spi.h" - -/* - * the host side fpga loader code pushes an MD5 hash of the bitstream - * into hash1. - */ -#define USRP_HASH_SIZE 16 -xdata at USRP_HASH_SLOT_0_ADDR unsigned char hash0[USRP_HASH_SIZE]; - - -#define enable_codecs() USRP_PA &= ~(bmPA_SEN_CODEC_A | bmPA_SEN_CODEC_B) -#define disable_all() USRP_PA |= (bmPA_SEN_CODEC_A | bmPA_SEN_CODEC_B) - -static void -write_byte_msb (unsigned char v); - -void -write_both_9862s (unsigned char header_lo, unsigned char v) -{ - enable_codecs (); - - write_byte_msb (header_lo); - write_byte_msb (v); - - disable_all (); -} - -// ---------------------------------------------------------------- - -static void -write_byte_msb (unsigned char v) -{ - unsigned char n = 8; - do { - v = (v << 1) | (v >> 7); // rotate left (MSB into bottom bit) - bitS_OUT = v & 0x1; - bitS_CLK = 1; - bitS_CLK = 0; - } while (--n != 0); -} - -// ---------------------------------------------------------------- - -#define REG_RX_PWR_DN 1 -#define REG_TX_PWR_DN 8 -#define REG_TX_MODULATOR 20 - -void eeprom_init (void) -{ - unsigned short counter; - unsigned char i; - - // configure IO ports (B and D are used by GPIF) - - IOA = bmPORT_A_INITIAL; // Port A initial state - OEA = bmPORT_A_OUTPUTS; // Port A direction register - - IOC = bmPORT_C_INITIAL; // Port C initial state - OEC = bmPORT_C_OUTPUTS; // Port C direction register - - IOE = bmPORT_E_INITIAL; // Port E initial state - OEE = bmPORT_E_OUTPUTS; // Port E direction register - - EP0BCH = 0; SYNCDELAY; - - // USBCS &= ~bmRENUM; // chip firmware handles commands - USBCS = 0; // chip firmware handles commands - - USRP_PC &= ~bmPC_nRESET; // active low reset - USRP_PC |= bmPC_nRESET; - - // init_spi (); - bitS_OUT = 0; /* idle state has CLK = 0 */ - - write_both_9862s (REG_RX_PWR_DN, 0x01); - write_both_9862s (REG_TX_PWR_DN, 0x0f); // pwr dn digital and analog_both - write_both_9862s (REG_TX_MODULATOR, 0x00); // coarse & fine modulators disabled - - // zero firmware hash slot - i = 0; - do { - hash0[i] = 0; - i++; - } while (i != USRP_HASH_SIZE); - - counter = 0; - while (1){ - counter++; - if (counter & 0x8000) - IOC ^= bmPC_LED0; - } -} diff --git a/usrp/firmware/src/usrp2/eeprom_io.c b/usrp/firmware/src/usrp2/eeprom_io.c deleted file mode 100644 index 9eeb53636..000000000 --- a/usrp/firmware/src/usrp2/eeprom_io.c +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 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 "eeprom_io.h" -#include "i2c.h" -#include "delay.h" - -// returns non-zero if successful, else 0 -unsigned char -eeprom_read (unsigned char i2c_addr, unsigned char eeprom_offset, - xdata unsigned char *buf, unsigned char len) -{ - // We setup a random read by first doing a "zero byte write". - // Writes carry an address. Reads use an implicit address. - - static xdata unsigned char cmd[1]; - cmd[0] = eeprom_offset; - if (!i2c_write(i2c_addr, cmd, 1)) - return 0; - - return i2c_read(i2c_addr, buf, len); -} - - -#if 0 - -// returns non-zero if successful, else 0 -unsigned char -eeprom_write (unsigned char i2c_addr, unsigned char eeprom_offset, - const xdata unsigned char *buf, unsigned char len) -{ - static xdata unsigned char cmd[2]; - unsigned char ok; - - while (len-- > 0){ - cmd[0] = eeprom_offset++; - cmd[1] = *buf++; - ok = i2c_write(i2c_addr, cmd, 2); - mdelay(10); // delay 10ms worst case write time - if (!ok) - return 0; - } - return 1; -} - -#endif diff --git a/usrp/firmware/src/usrp2/eeprom_io.h b/usrp/firmware/src/usrp2/eeprom_io.h deleted file mode 100644 index 558017b12..000000000 --- a/usrp/firmware/src/usrp2/eeprom_io.h +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 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_EEPROM_IO_H -#define INCLUDED_EEPROM_IO_H - - -// returns non-zero if successful, else 0 -unsigned char -eeprom_read (unsigned char i2c_addr, unsigned char eeprom_offset, - xdata unsigned char *buf, unsigned char len); - -// returns non-zero if successful, else 0 -unsigned char -eeprom_write (unsigned char i2c_addr, unsigned char eeprom_offset, - const xdata unsigned char *buf, unsigned char len); - - -#endif /* INCLUDED_EEPROM_IO_H */ diff --git a/usrp/firmware/src/usrp2/fpga_load.c b/usrp/firmware/src/usrp2/fpga_load.c deleted file mode 100644 index b0256e925..000000000 --- a/usrp/firmware/src/usrp2/fpga_load.c +++ /dev/null @@ -1 +0,0 @@ -#include "../common/fpga_load.c" diff --git a/usrp/firmware/src/usrp2/fpga_rev2.c b/usrp/firmware/src/usrp2/fpga_rev2.c deleted file mode 100644 index cca961dc4..000000000 --- a/usrp/firmware/src/usrp2/fpga_rev2.c +++ /dev/null @@ -1,122 +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. - */ - -#include "fpga.h" -#include "fpga_regs_common.h" -#include "usrp_common.h" -#include "usrp_globals.h" -#include "spi.h" - -unsigned char g_tx_reset = 0; -unsigned char g_rx_reset = 0; - -void -fpga_write_reg (unsigned char regno, const xdata unsigned char *regval) -{ - spi_write (0, 0x00 | (regno & 0x7f), - SPI_ENABLE_FPGA, - SPI_FMT_MSB | SPI_FMT_HDR_1, - regval, 4); -} - - -static xdata unsigned char regval[4] = {0, 0, 0, 0}; - -static void -write_fpga_master_ctrl (void) -{ - unsigned char v = 0; - if (g_tx_enable) - v |= bmFR_MC_ENABLE_TX; - if (g_rx_enable) - v |= bmFR_MC_ENABLE_RX; - if (g_tx_reset) - v |= bmFR_MC_RESET_TX; - if (g_rx_reset) - v |= bmFR_MC_RESET_RX; - regval[3] = v; - - fpga_write_reg (FR_MASTER_CTRL, regval); -} - -// Resets both AD9862's and the FPGA serial bus interface. - -void -fpga_set_reset (unsigned char on) -{ - on &= 0x1; - - if (on){ - USRP_PC &= ~bmPC_nRESET; // active low - g_tx_enable = 0; - g_rx_enable = 0; - g_tx_reset = 0; - g_rx_reset = 0; - } - else - USRP_PC |= bmPC_nRESET; -} - -void -fpga_set_tx_enable (unsigned char on) -{ - on &= 0x1; - g_tx_enable = on; - - write_fpga_master_ctrl (); - - if (on){ - g_tx_underrun = 0; - fpga_clear_flags (); - } -} - -void -fpga_set_rx_enable (unsigned char on) -{ - on &= 0x1; - g_rx_enable = on; - - write_fpga_master_ctrl (); - if (on){ - g_rx_overrun = 0; - fpga_clear_flags (); - } -} - -void -fpga_set_tx_reset (unsigned char on) -{ - on &= 0x1; - g_tx_reset = on; - - write_fpga_master_ctrl (); -} - -void -fpga_set_rx_reset (unsigned char on) -{ - on &= 0x1; - g_rx_reset = on; - - write_fpga_master_ctrl (); -} diff --git a/usrp/firmware/src/usrp2/fpga_rev2.h b/usrp/firmware/src/usrp2/fpga_rev2.h deleted file mode 100644 index 54ec3f9fa..000000000 --- a/usrp/firmware/src/usrp2/fpga_rev2.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * USRP - Universal Software Radio Peripheral - * - * Copyright (C) 2003,2004 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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, Boston, MA 02110-1301 USA - */ - -#ifndef INCLUDED_FPGA_REV1_H -#define INCLUDED_FPGA_REV1_H - -void fpga_set_reset (unsigned char v); -void fpga_set_tx_enable (unsigned char v); -void fpga_set_rx_enable (unsigned char v); -void fpga_set_tx_reset (unsigned char v); -void fpga_set_rx_reset (unsigned char v); - -unsigned char fpga_has_room_for_packet (void); -unsigned char fpga_has_packet_avail (void); - -#if (UC_BOARD_HAS_FPGA) -/* - * return TRUE iff FPGA internal fifo has room for 512 bytes. - */ -#define fpga_has_room_for_packet() (GPIFREADYSTAT & bmFPGA_HAS_SPACE) - -/* - * return TRUE iff FPGA internal fifo has at least 512 bytes available. - */ -#define fpga_has_packet_avail() (GPIFREADYSTAT & bmFPGA_PKT_AVAIL) - -#else /* no FPGA on board. fake it. */ - -#define fpga_has_room_for_packet() TRUE -#define fpga_has_packet_avail() TRUE - -#endif - -#define fpga_clear_flags() \ - do { \ - USRP_PE |= bmPE_FPGA_CLR_STATUS; \ - USRP_PE &= ~bmPE_FPGA_CLR_STATUS; \ - } while (0) - - -#endif /* INCLUDED_FPGA_REV1_H */ diff --git a/usrp/firmware/src/usrp2/gpif.c b/usrp/firmware/src/usrp2/gpif.c deleted file mode 100644 index f6745a43b..000000000 --- a/usrp/firmware/src/usrp2/gpif.c +++ /dev/null @@ -1,292 +0,0 @@ -// This program configures the General Programmable Interface (GPIF) for FX2. -// Please do not modify sections of text which are marked as "DO NOT EDIT ...". -// -// DO NOT EDIT ... -// GPIF Initialization -// Interface Timing Async -// Internal Ready Init IntRdy=1 -// CTL Out Tristate-able Binary -// SingleWrite WF Select 1 -// SingleRead WF Select 0 -// FifoWrite WF Select 3 -// FifoRead WF Select 2 -// Data Bus Idle Drive Tristate -// END DO NOT EDIT - -// DO NOT EDIT ... -// GPIF Wave Names -// Wave 0 = singlerd -// Wave 1 = singlewr -// Wave 2 = FIFORd -// Wave 3 = FIFOWr - -// GPIF Ctrl Outputs Level -// CTL 0 = WEN# CMOS -// CTL 1 = REN# CMOS -// CTL 2 = OE# CMOS -// CTL 3 = CLRST CMOS -// CTL 4 = unused CMOS -// CTL 5 = BOGUS CMOS - -// GPIF Rdy Inputs -// RDY0 = EF# -// RDY1 = FF# -// RDY2 = unused -// RDY3 = unused -// RDY4 = unused -// RDY5 = TCXpire -// FIFOFlag = FIFOFlag -// IntReady = IntReady -// END DO NOT EDIT -// DO NOT EDIT ... -// -// GPIF Waveform 0: singlerd -// -// Interval 0 1 2 3 4 5 6 Idle (7) -// _________ _________ _________ _________ _________ _________ _________ _________ -// -// AddrMode Same Val Same Val Same Val Same Val Same Val Same Val Same Val -// DataMode NO Data NO Data NO Data NO Data NO Data NO Data NO Data -// NextData SameData SameData SameData SameData SameData SameData SameData -// Int Trig No Int No Int No Int No Int No Int No Int No Int -// IF/Wait Wait 1 Wait 1 Wait 1 Wait 1 Wait 1 Wait 1 Wait 1 -// Term A -// LFunc -// Term B -// Branch1 -// Branch0 -// Re-Exec -// Sngl/CRC Default Default Default Default Default Default Default -// WEN# 0 0 0 0 0 0 0 0 -// REN# 0 0 0 0 0 0 0 0 -// OE# 0 0 0 0 0 0 0 0 -// CLRST 0 0 0 0 0 0 0 0 -// unused 0 0 0 0 0 0 0 0 -// BOGUS 0 0 0 0 0 0 0 0 -// -// END DO NOT EDIT -// DO NOT EDIT ... -// -// GPIF Waveform 1: singlewr -// -// Interval 0 1 2 3 4 5 6 Idle (7) -// _________ _________ _________ _________ _________ _________ _________ _________ -// -// AddrMode Same Val Same Val Same Val Same Val Same Val Same Val Same Val -// DataMode Activate Activate Activate Activate Activate Activate Activate -// NextData SameData SameData SameData SameData SameData SameData SameData -// Int Trig No Int No Int No Int No Int No Int No Int No Int -// IF/Wait Wait 1 IF Wait 1 Wait 1 Wait 1 Wait 1 Wait 1 -// Term A EF# -// LFunc AND -// Term B EF# -// Branch1 ThenIdle -// Branch0 ElseIdle -// Re-Exec No -// Sngl/CRC Default Default Default Default Default Default Default -// WEN# 0 1 1 1 1 1 1 0 -// REN# 0 0 0 0 0 0 0 0 -// OE# 0 0 0 0 0 0 0 0 -// CLRST 0 0 0 0 0 0 0 0 -// unused 0 0 0 0 0 0 0 0 -// BOGUS 0 0 0 0 0 0 0 0 -// -// END DO NOT EDIT -// DO NOT EDIT ... -// -// GPIF Waveform 2: FIFORd -// -// Interval 0 1 2 3 4 5 6 Idle (7) -// _________ _________ _________ _________ _________ _________ _________ _________ -// -// AddrMode Same Val Same Val Same Val Same Val Same Val Same Val Same Val -// DataMode NO Data Activate NO Data NO Data NO Data NO Data NO Data -// NextData SameData SameData SameData SameData SameData SameData SameData -// Int Trig No Int No Int No Int No Int No Int No Int No Int -// IF/Wait Wait 1 IF Wait 1 IF Wait 1 Wait 1 Wait 1 -// Term A TCXpire TCXpire -// LFunc AND AND -// Term B TCXpire TCXpire -// Branch1 Then 2 ThenIdle -// Branch0 Else 1 ElseIdle -// Re-Exec No No -// Sngl/CRC Default Default Default Default Default Default Default -// WEN# 0 0 0 0 0 0 0 0 -// REN# 1 0 0 0 0 0 0 0 -// OE# 1 1 1 0 0 0 0 0 -// CLRST 0 0 0 0 0 0 0 0 -// unused 0 0 0 0 0 0 0 0 -// BOGUS 0 0 0 0 0 0 0 0 -// -// END DO NOT EDIT -// DO NOT EDIT ... -// -// GPIF Waveform 3: FIFOWr -// -// Interval 0 1 2 3 4 5 6 Idle (7) -// _________ _________ _________ _________ _________ _________ _________ _________ -// -// AddrMode Same Val Same Val Same Val Same Val Same Val Same Val Same Val -// DataMode NO Data Activate Activate Activate Activate Activate Activate -// NextData SameData SameData SameData SameData SameData SameData SameData -// Int Trig No Int No Int No Int No Int No Int No Int No Int -// IF/Wait Wait 1 IF Wait 1 Wait 1 Wait 1 Wait 1 Wait 1 -// Term A TCXpire -// LFunc AND -// Term B TCXpire -// Branch1 ThenIdle -// Branch0 Else 1 -// Re-Exec No -// Sngl/CRC Default Default Default Default Default Default Default -// WEN# 0 0 0 0 0 0 0 0 -// REN# 0 0 0 0 0 0 0 0 -// OE# 0 0 0 0 0 0 0 0 -// CLRST 0 0 0 0 0 0 0 0 -// unused 0 0 0 0 0 0 0 0 -// BOGUS 0 0 0 0 0 0 0 0 -// -// END DO NOT EDIT - -// GPIF Program Code - -// DO NOT EDIT ... -#include "fx2.h" -#include "fx2regs.h" -#include "fx2sdly.h" // SYNCDELAY macro -// END DO NOT EDIT - -// DO NOT EDIT ... -const char xdata WaveData[128] = -{ -// Wave 0 -/* LenBr */ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x07, -/* Opcode*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* Output*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* LFun */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, -// Wave 1 -/* LenBr */ 0x01, 0x3F, 0x01, 0x01, 0x01, 0x01, 0x01, 0x07, -/* Opcode*/ 0x22, 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, -/* Output*/ 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, -/* LFun */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, -// Wave 2 -/* LenBr */ 0x01, 0x11, 0x01, 0x3F, 0x01, 0x01, 0x01, 0x07, -/* Opcode*/ 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, -/* Output*/ 0x06, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, -/* LFun */ 0x00, 0x2D, 0x00, 0x2D, 0x00, 0x00, 0x00, 0x3F, -// Wave 3 -/* LenBr */ 0x01, 0x39, 0x01, 0x01, 0x01, 0x01, 0x01, 0x07, -/* Opcode*/ 0x00, 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, -/* Output*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -/* LFun */ 0x00, 0x2D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, -}; -// END DO NOT EDIT - -// DO NOT EDIT ... -const char xdata FlowStates[36] = -{ -/* Wave 0 FlowStates */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* Wave 1 FlowStates */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -/* Wave 2 FlowStates */ 0x81,0x2D,0x26,0x00,0x04,0x04,0x03,0x02,0x00, -/* Wave 3 FlowStates */ 0x81,0x2D,0x21,0x00,0x04,0x04,0x03,0x02,0x00, -}; -// END DO NOT EDIT - -// DO NOT EDIT ... -const char xdata InitData[7] = -{ -/* Regs */ 0xA0,0x00,0x00,0x00,0xEE,0x4E,0x00 -}; -// END DO NOT EDIT - -// TO DO: You may add additional code below. - -void GpifInit( void ) -{ - BYTE i; - - // Registers which require a synchronization delay, see section 15.14 - // FIFORESET FIFOPINPOLAR - // INPKTEND OUTPKTEND - // EPxBCH:L REVCTL - // GPIFTCB3 GPIFTCB2 - // GPIFTCB1 GPIFTCB0 - // EPxFIFOPFH:L EPxAUTOINLENH:L - // EPxFIFOCFG EPxGPIFFLGSEL - // PINFLAGSxx EPxFIFOIRQ - // EPxFIFOIE GPIFIRQ - // GPIFIE GPIFADRH:L - // UDMACRCH:L EPxGPIFTRIG - // GPIFTRIG - - // Note: The pre-REVE EPxGPIFTCH/L register are affected, as well... - // ...these have been replaced by GPIFTC[B3:B0] registers - - // 8051 doesn't have access to waveform memories 'til - // the part is in GPIF mode. - - IFCONFIG = 0xEE; - // IFCLKSRC=1 , FIFOs executes on internal clk source - // xMHz=1 , 48MHz internal clk rate - // IFCLKOE=0 , Don't drive IFCLK pin signal at 48MHz - // IFCLKPOL=0 , Don't invert IFCLK pin signal from internal clk - // ASYNC=1 , master samples asynchronous - // GSTATE=1 , Drive GPIF states out on PORTE[2:0], debug WF - // IFCFG[1:0]=10, FX2 in GPIF master mode - - GPIFABORT = 0xFF; // abort any waveforms pending - - GPIFREADYCFG = InitData[ 0 ]; - GPIFCTLCFG = InitData[ 1 ]; - GPIFIDLECS = InitData[ 2 ]; - GPIFIDLECTL = InitData[ 3 ]; - GPIFWFSELECT = InitData[ 5 ]; - GPIFREADYSTAT = InitData[ 6 ]; - - // use dual autopointer feature... - AUTOPTRSETUP = 0x07; // inc both pointers, - // ...warning: this introduces pdata hole(s) - // ...at E67B (XAUTODAT1) and E67C (XAUTODAT2) - - // source - AUTOPTRH1 = MSB( &WaveData ); - AUTOPTRL1 = LSB( &WaveData ); - - // destination - AUTOPTRH2 = 0xE4; - AUTOPTRL2 = 0x00; - - // transfer - for ( i = 0x00; i < 128; i++ ) - { - EXTAUTODAT2 = EXTAUTODAT1; - } - -// Configure GPIF Address pins, output initial value, - PORTCCFG = 0xFF; // [7:0] as alt. func. GPIFADR[7:0] - OEC = 0xFF; // and as outputs - PORTECFG |= 0x80; // [8] as alt. func. GPIFADR[8] - OEE |= 0x80; // and as output - -// ...OR... tri-state GPIFADR[8:0] pins -// PORTCCFG = 0x00; // [7:0] as port I/O -// OEC = 0x00; // and as inputs -// PORTECFG &= 0x7F; // [8] as port I/O -// OEE &= 0x7F; // and as input - -// GPIF address pins update when GPIFADRH/L written - SYNCDELAY; // - GPIFADRH = 0x00; // bits[7:1] always 0 - SYNCDELAY; // - GPIFADRL = 0x00; // point to PERIPHERAL address 0x0000 - -// Configure GPIF FlowStates registers for Wave 0 of WaveData - FLOWSTATE = FlowStates[ 0 ]; - FLOWLOGIC = FlowStates[ 1 ]; - FLOWEQ0CTL = FlowStates[ 2 ]; - FLOWEQ1CTL = FlowStates[ 3 ]; - FLOWHOLDOFF = FlowStates[ 4 ]; - FLOWSTB = FlowStates[ 5 ]; - FLOWSTBEDGE = FlowStates[ 6 ]; - FLOWSTBHPERIOD = FlowStates[ 7 ]; -} - diff --git a/usrp/firmware/src/usrp2/gpif.gpf b/usrp/firmware/src/usrp2/gpif.gpf Binary files differdeleted file mode 100755 index 854e25399..000000000 --- a/usrp/firmware/src/usrp2/gpif.gpf +++ /dev/null diff --git a/usrp/firmware/src/usrp2/init_gpif.c b/usrp/firmware/src/usrp2/init_gpif.c deleted file mode 100644 index 0f5944b3b..000000000 --- a/usrp/firmware/src/usrp2/init_gpif.c +++ /dev/null @@ -1 +0,0 @@ -#include "../common/init_gpif.c" diff --git a/usrp/firmware/src/usrp2/spi.c b/usrp/firmware/src/usrp2/spi.c deleted file mode 100644 index f5803c55b..000000000 --- a/usrp/firmware/src/usrp2/spi.c +++ /dev/null @@ -1,381 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2006 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 "spi.h" -#include "usrp_rev2_regs.h" - -static void -setup_enables (unsigned char enables) -{ - // Software eanbles are active high. - // Hardware enables are active low. - - // Uhh, the CODECs are active low, but the FPGA is active high... - enables ^= SPI_ENABLE_FPGA; - - // KLUDGE: This code is fragile, but reasonably fast... - // low three bits of enables go into port A - USRP_PA = USRP_PA | (0x7 << 3); // disable FPGA, CODEC_A, CODEC_B - USRP_PA ^= (enables & 0x7) << 3; // enable specified devs - - // high four bits of enables go into port E - USRP_PE = USRP_PE | (0xf << 4); // disable TX_A, RX_A, TX_B, RX_B - USRP_PE ^= (enables & 0xf0); // enable specified devs -} - -#define disable_all() setup_enables (0) - -void -init_spi (void) -{ - disable_all (); /* disable all devs */ - bitS_OUT = 0; /* idle state has CLK = 0 */ -} - -#if 0 -static unsigned char -count_bits8 (unsigned char v) -{ - static unsigned char count4[16] = { - 0, // 0 - 1, // 1 - 1, // 2 - 2, // 3 - 1, // 4 - 2, // 5 - 2, // 6 - 3, // 7 - 1, // 8 - 2, // 9 - 2, // a - 3, // b - 2, // c - 3, // d - 3, // e - 4 // f - }; - return count4[v & 0xf] + count4[(v >> 4) & 0xf]; -} - -#else - -static unsigned char -count_bits8 (unsigned char v) -{ - unsigned char count = 0; - if (v & (1 << 0)) count++; - if (v & (1 << 1)) count++; - if (v & (1 << 2)) count++; - if (v & (1 << 3)) count++; - if (v & (1 << 4)) count++; - if (v & (1 << 5)) count++; - if (v & (1 << 6)) count++; - if (v & (1 << 7)) count++; - return count; -} -#endif - -static void -write_byte_msb (unsigned char v); - -static void -write_bytes_msb (const xdata unsigned char *buf, unsigned char len); - -static void -read_bytes_msb (xdata unsigned char *buf, unsigned char len); - - -// returns non-zero if successful, else 0 -unsigned char -spi_read (unsigned char header_hi, unsigned char header_lo, - unsigned char enables, unsigned char format, - xdata unsigned char *buf, unsigned char len) -{ - if (count_bits8 (enables) > 1) - return 0; // error, too many enables set - - setup_enables (enables); - - if (format & SPI_FMT_LSB){ // order: LSB -#if 1 - return 0; // error, not implemented -#else - switch (format & SPI_FMR_HDR_MASK){ - case SPI_FMT_HDR_0: - break; - case SPI_FMT_HDR_1: - write_byte_lsb (header_lo); - break; - case SPI_FMT_HDR_2: - write_byte_lsb (header_lo); - write_byte_lsb (header_hi); - break; - default: - return 0; // error - } - if (len != 0) - read_bytes_lsb (buf, len); -#endif - } - - else { // order: MSB - - switch (format & SPI_FMT_HDR_MASK){ - case SPI_FMT_HDR_0: - break; - case SPI_FMT_HDR_1: - write_byte_msb (header_lo); - break; - case SPI_FMT_HDR_2: - write_byte_msb (header_hi); - write_byte_msb (header_lo); - break; - default: - return 0; // error - } - if (len != 0) - read_bytes_msb (buf, len); - } - - disable_all (); - return 1; // success -} - - -// returns non-zero if successful, else 0 -unsigned char -spi_write (unsigned char header_hi, unsigned char header_lo, - unsigned char enables, unsigned char format, - const xdata unsigned char *buf, unsigned char len) -{ - setup_enables (enables); - - if (format & SPI_FMT_LSB){ // order: LSB -#if 1 - return 0; // error, not implemented -#else - switch (format & SPI_FMR_HDR_MASK){ - case SPI_FMT_HDR_0: - break; - case SPI_FMT_HDR_1: - write_byte_lsb (header_lo); - break; - case SPI_FMT_HDR_2: - write_byte_lsb (header_lo); - write_byte_lsb (header_hi); - break; - default: - return 0; // error - } - if (len != 0) - write_bytes_lsb (buf, len); -#endif - } - - else { // order: MSB - - switch (format & SPI_FMT_HDR_MASK){ - case SPI_FMT_HDR_0: - break; - case SPI_FMT_HDR_1: - write_byte_msb (header_lo); - break; - case SPI_FMT_HDR_2: - write_byte_msb (header_hi); - write_byte_msb (header_lo); - break; - default: - return 0; // error - } - if (len != 0) - write_bytes_msb (buf, len); - } - - disable_all (); - return 1; // success -} - -// ---------------------------------------------------------------- - -static void -write_byte_msb (unsigned char v) -{ - v = (v << 1) | (v >> 7); // rotate left (MSB into bottom bit) - bitS_OUT = v & 0x1; - bitS_CLK = 1; - bitS_CLK = 0; - - v = (v << 1) | (v >> 7); // rotate left (MSB into bottom bit) - bitS_OUT = v & 0x1; - bitS_CLK = 1; - bitS_CLK = 0; - - v = (v << 1) | (v >> 7); // rotate left (MSB into bottom bit) - bitS_OUT = v & 0x1; - bitS_CLK = 1; - bitS_CLK = 0; - - v = (v << 1) | (v >> 7); // rotate left (MSB into bottom bit) - bitS_OUT = v & 0x1; - bitS_CLK = 1; - bitS_CLK = 0; - - v = (v << 1) | (v >> 7); // rotate left (MSB into bottom bit) - bitS_OUT = v & 0x1; - bitS_CLK = 1; - bitS_CLK = 0; - - v = (v << 1) | (v >> 7); // rotate left (MSB into bottom bit) - bitS_OUT = v & 0x1; - bitS_CLK = 1; - bitS_CLK = 0; - - v = (v << 1) | (v >> 7); // rotate left (MSB into bottom bit) - bitS_OUT = v & 0x1; - bitS_CLK = 1; - bitS_CLK = 0; - - v = (v << 1) | (v >> 7); // rotate left (MSB into bottom bit) - bitS_OUT = v & 0x1; - bitS_CLK = 1; - bitS_CLK = 0; -} - -static void -write_bytes_msb (const xdata unsigned char *buf, unsigned char len) -{ - while (len-- != 0){ - write_byte_msb (*buf++); - } -} - -#if 0 -/* - * This is incorrectly compiled by SDCC 2.4.0 - */ -static unsigned char -read_byte_msb (void) -{ - unsigned char v = 0; - - bitS_CLK = 1; - v |= bitS_IN; - bitS_CLK = 0; - - v = v << 1; - bitS_CLK = 1; - v |= bitS_IN; - bitS_CLK = 0; - - v = v << 1; - bitS_CLK = 1; - v |= bitS_IN; - bitS_CLK = 0; - - v = v << 1; - bitS_CLK = 1; - v |= bitS_IN; - bitS_CLK = 0; - - v = v << 1; - bitS_CLK = 1; - v |= bitS_IN; - bitS_CLK = 0; - - v = v << 1; - bitS_CLK = 1; - v |= bitS_IN; - bitS_CLK = 0; - - v = v << 1; - bitS_CLK = 1; - v |= bitS_IN; - bitS_CLK = 0; - - v = v << 1; - bitS_CLK = 1; - v |= bitS_IN; - bitS_CLK = 0; - - return v; -} -#else -static unsigned char -read_byte_msb (void) _naked -{ - _asm - clr a - - setb _bitS_CLK - mov c, _bitS_IN - rlc a - clr _bitS_CLK - - setb _bitS_CLK - mov c, _bitS_IN - rlc a - clr _bitS_CLK - - setb _bitS_CLK - mov c, _bitS_IN - rlc a - clr _bitS_CLK - - setb _bitS_CLK - mov c, _bitS_IN - rlc a - clr _bitS_CLK - - setb _bitS_CLK - mov c, _bitS_IN - rlc a - clr _bitS_CLK - - setb _bitS_CLK - mov c, _bitS_IN - rlc a - clr _bitS_CLK - - setb _bitS_CLK - mov c, _bitS_IN - rlc a - clr _bitS_CLK - - setb _bitS_CLK - mov c, _bitS_IN - rlc a - clr _bitS_CLK - - mov dpl,a - ret - _endasm; -} -#endif - -static void -read_bytes_msb (xdata unsigned char *buf, unsigned char len) -{ - while (len-- != 0){ - *buf++ = read_byte_msb (); - } -} - diff --git a/usrp/firmware/src/usrp2/spi.h b/usrp/firmware/src/usrp2/spi.h deleted file mode 100644 index 12bc5e544..000000000 --- a/usrp/firmware/src/usrp2/spi.h +++ /dev/null @@ -1,43 +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_SPI_H -#define INCLUDED_SPI_H - -#include "usrp_spi_defs.h" - -void init_spi (void); // one time call to init - -// returns non-zero if successful, else 0 -unsigned char -spi_read (unsigned char header_hi, unsigned char header_lo, - unsigned char enables, unsigned char format, - xdata unsigned char *buf, unsigned char len); - -// returns non-zero if successful, else 0 -unsigned char -spi_write (unsigned char header_hi, unsigned char header_lo, - unsigned char enables, unsigned char format, - const xdata unsigned char *buf, unsigned char len); - - -#endif /* INCLUDED_SPI_H */ diff --git a/usrp/firmware/src/usrp2/usb_descriptors.a51 b/usrp/firmware/src/usrp2/usb_descriptors.a51 deleted file mode 100644 index a60adbef8..000000000 --- a/usrp/firmware/src/usrp2/usb_descriptors.a51 +++ /dev/null @@ -1,404 +0,0 @@ -;;; -*- asm -*- -;;; -;;; Copyright 2003 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. -;;; - -;;; USB Descriptor table for the USRP -;;; -;;; We're a high-speed only device (480 Mb/sec) with 1 configuration -;;; and 3 interfaces. -;;; -;;; interface 0: command and status (ep0 COMMAND) -;;; interface 1: Transmit path (ep2 OUT BULK) -;;; interface 2: Receive path (ep6 IN BULK) - - .module usb_descriptors - - VID_FREE = 0xfffe ; Free Software Folks - PID_USRP = 0x0002 ; USRP - - ;; We distinguish configured from unconfigured USRPs using the Device ID. - ;; If the MSB of the DID is 0, the device is unconfigured. - ;; The LSB of the DID is reserved for hardware revs. - - DID_USRP = 0x0100 ; Device ID (bcd) - - - DSCR_DEVICE = 1 ; Descriptor type: Device - DSCR_CONFIG = 2 ; Descriptor type: Configuration - DSCR_STRING = 3 ; Descriptor type: String - DSCR_INTRFC = 4 ; Descriptor type: Interface - DSCR_ENDPNT = 5 ; Descriptor type: Endpoint - DSCR_DEVQUAL = 6 ; Descriptor type: Device Qualifier - - DSCR_DEVICE_LEN = 18 - DSCR_CONFIG_LEN = 9 - DSCR_INTRFC_LEN = 9 - DSCR_ENDPNT_LEN = 7 - DSCR_DEVQUAL_LEN = 10 - - ET_CONTROL = 0 ; Endpoint type: Control - ET_ISO = 1 ; Endpoint type: Isochronous - ET_BULK = 2 ; Endpoint type: Bulk - ET_INT = 3 ; Endpoint type: Interrupt - - - ;; configuration attributes - bmSELF_POWERED = 1 << 6 - -;;; -------------------------------------------------------- -;;; external ram data -;;;-------------------------------------------------------- - - .area USBDESCSEG (XDATA) - -;;; ---------------------------------------------------------------- -;;; descriptors used when operating at high speed (480Mb/sec) -;;; ---------------------------------------------------------------- - - .even ; descriptors must be 2-byte aligned for SUDPTR{H,L} to work - - ;; The .even directive isn't really honored by the linker. Bummer! - ;; (There's no way to specify an alignment requirement for a given area, - ;; hence when they're concatenated together, even doesn't work.) - ;; - ;; We work around this by telling the linker to put USBDESCSEG - ;; at 0xE000 absolute. This means that the maximimum length of this - ;; segment is 480 bytes, leaving room for the two hash slots - ;; at 0xE1EO to 0xE1FF. - ;; - ;; As of July 7, 2004, this segment is 326 bytes long - -_high_speed_device_descr:: - .db DSCR_DEVICE_LEN - .db DSCR_DEVICE - .db <0x0200 ; Specification version (LSB) - .db >0x0200 ; Specification version (MSB) - .db 0xff ; device class (vendor specific) - .db 0xff ; device subclass (vendor specific) - .db 0xff ; device protocol (vendor specific) - .db 64 ; bMaxPacketSize0 for endpoint 0 - .db <VID_FREE ; idVendor - .db >VID_FREE ; idVendor - .db <PID_USRP ; idProduct - .db >PID_USRP ; idProduct -_usb_desc_hw_rev_binary_patch_location_0:: - .db <DID_USRP ; bcdDevice - .db >DID_USRP ; bcdDevice - .db SI_VENDOR ; iManufacturer (string index) - .db SI_PRODUCT ; iProduct (string index) - .db SI_SERIAL ; iSerial number (string index) - .db 1 ; bNumConfigurations - -;;; describes the other speed (12Mb/sec) - .even -_high_speed_devqual_descr:: - .db DSCR_DEVQUAL_LEN - .db DSCR_DEVQUAL - .db <0x0200 ; bcdUSB (LSB) - .db >0x0200 ; bcdUSB (MSB) - .db 0xff ; bDeviceClass - .db 0xff ; bDeviceSubClass - .db 0xff ; bDeviceProtocol - .db 64 ; bMaxPacketSize0 - .db 1 ; bNumConfigurations (one config at 12Mb/sec) - .db 0 ; bReserved - - .even -_high_speed_config_descr:: - .db DSCR_CONFIG_LEN - .db DSCR_CONFIG - .db <(_high_speed_config_descr_end - _high_speed_config_descr) ; LSB - .db >(_high_speed_config_descr_end - _high_speed_config_descr) ; MSB - .db 3 ; bNumInterfaces - .db 1 ; bConfigurationValue - .db 0 ; iConfiguration - .db 0x80 | bmSELF_POWERED ; bmAttributes - .db 0 ; bMaxPower - - ;; interface descriptor 0 (command & status, ep0 COMMAND) - - .db DSCR_INTRFC_LEN - .db DSCR_INTRFC - .db 0 ; bInterfaceNumber (zero based) - .db 0 ; bAlternateSetting - .db 0 ; bNumEndpoints - .db 0xff ; bInterfaceClass (vendor specific) - .db 0xff ; bInterfaceSubClass (vendor specific) - .db 0xff ; bInterfaceProtocol (vendor specific) - .db SI_COMMAND_AND_STATUS ; iInterface (description) - - ;; interface descriptor 1 (transmit path, ep2 OUT BULK) - - .db DSCR_INTRFC_LEN - .db DSCR_INTRFC - .db 1 ; bInterfaceNumber (zero based) - .db 0 ; bAlternateSetting - .db 1 ; bNumEndpoints - .db 0xff ; bInterfaceClass (vendor specific) - .db 0xff ; bInterfaceSubClass (vendor specific) - .db 0xff ; bInterfaceProtocol (vendor specific) - .db SI_TX_PATH ; iInterface (description) - - ;; interface 1's end point - - .db DSCR_ENDPNT_LEN - .db DSCR_ENDPNT - .db 0x02 ; bEndpointAddress (ep 2 OUT) - .db ET_BULK ; bmAttributes - .db <512 ; wMaxPacketSize (LSB) - .db >512 ; wMaxPacketSize (MSB) - .db 0 ; bInterval (iso only) - - ;; interface descriptor 2 (receive path, ep6 IN BULK) - - .db DSCR_INTRFC_LEN - .db DSCR_INTRFC - .db 2 ; bInterfaceNumber (zero based) - .db 0 ; bAlternateSetting - .db 1 ; bNumEndpoints - .db 0xff ; bInterfaceClass (vendor specific) - .db 0xff ; bInterfaceSubClass (vendor specific) - .db 0xff ; bInterfaceProtocol (vendor specific) - .db SI_RX_PATH ; iInterface (description) - - ;; interface 2's end point - - .db DSCR_ENDPNT_LEN - .db DSCR_ENDPNT - .db 0x86 ; bEndpointAddress (ep 6 IN) - .db ET_BULK ; bmAttributes - .db <512 ; wMaxPacketSize (LSB) - .db >512 ; wMaxPacketSize (MSB) - .db 0 ; bInterval (iso only) - -_high_speed_config_descr_end: - -;;; ---------------------------------------------------------------- -;;; descriptors used when operating at full speed (12Mb/sec) -;;; ---------------------------------------------------------------- - - .even -_full_speed_device_descr:: - .db DSCR_DEVICE_LEN - .db DSCR_DEVICE - .db <0x0200 ; Specification version (LSB) - .db >0x0200 ; Specification version (MSB) - .db 0xff ; device class (vendor specific) - .db 0xff ; device subclass (vendor specific) - .db 0xff ; device protocol (vendor specific) - .db 64 ; bMaxPacketSize0 for endpoint 0 - .db <VID_FREE ; idVendor - .db >VID_FREE ; idVendor - .db <PID_USRP ; idProduct - .db >PID_USRP ; idProduct -_usb_desc_hw_rev_binary_patch_location_1:: - .db <DID_USRP ; bcdDevice - .db >DID_USRP ; bcdDevice - .db SI_VENDOR ; iManufacturer (string index) - .db SI_PRODUCT ; iProduct (string index) - .db SI_NONE ; iSerial number (None) - .db 1 ; bNumConfigurations - - -;;; describes the other speed (480Mb/sec) - .even -_full_speed_devqual_descr:: - .db DSCR_DEVQUAL_LEN - .db DSCR_DEVQUAL - .db <0x0200 ; bcdUSB - .db >0x0200 ; bcdUSB - .db 0xff ; bDeviceClass - .db 0xff ; bDeviceSubClass - .db 0xff ; bDeviceProtocol - .db 64 ; bMaxPacketSize0 - .db 1 ; bNumConfigurations (one config at 480Mb/sec) - .db 0 ; bReserved - - .even -_full_speed_config_descr:: - .db DSCR_CONFIG_LEN - .db DSCR_CONFIG - .db <(_full_speed_config_descr_end - _full_speed_config_descr) ; LSB - .db >(_full_speed_config_descr_end - _full_speed_config_descr) ; MSB - .db 1 ; bNumInterfaces - .db 1 ; bConfigurationValue - .db 0 ; iConfiguration - .db 0x80 | bmSELF_POWERED ; bmAttributes - .db 0 ; bMaxPower - - ;; interface descriptor 0 (command & status, ep0 COMMAND) - - .db DSCR_INTRFC_LEN - .db DSCR_INTRFC - .db 0 ; bInterfaceNumber (zero based) - .db 0 ; bAlternateSetting - .db 0 ; bNumEndpoints - .db 0xff ; bInterfaceClass (vendor specific) - .db 0xff ; bInterfaceSubClass (vendor specific) - .db 0xff ; bInterfaceProtocol (vendor specific) - .db SI_COMMAND_AND_STATUS ; iInterface (description) - -_full_speed_config_descr_end: - -;;; ---------------------------------------------------------------- -;;; string descriptors -;;; ---------------------------------------------------------------- - -_nstring_descriptors:: - .db (_string_descriptors_end - _string_descriptors) / 2 - -_string_descriptors:: - .db <str0, >str0 - .db <str1, >str1 - .db <str2, >str2 - .db <str3, >str3 - .db <str4, >str4 - .db <str5, >str5 - .db <str6, >str6 -_string_descriptors_end: - - SI_NONE = 0 - ;; str0 contains the language ID's. - .even -str0: .db str0_end - str0 - .db DSCR_STRING - .db 0 - .db 0 - .db <0x0409 ; magic code for US English (LSB) - .db >0x0409 ; magic code for US English (MSB) -str0_end: - - SI_VENDOR = 1 - .even -str1: .db str1_end - str1 - .db DSCR_STRING - .db 'F, 0 ; 16-bit unicode - .db 'r, 0 - .db 'e, 0 - .db 'e, 0 - .db ' , 0 - .db 'S, 0 - .db 'o, 0 - .db 'f, 0 - .db 't, 0 - .db 'w, 0 - .db 'a, 0 - .db 'r, 0 - .db 'e, 0 - .db ' , 0 - .db 'F, 0 - .db 'o, 0 - .db 'l, 0 - .db 'k, 0 - .db 's, 0 -str1_end: - - SI_PRODUCT = 2 - .even -str2: .db str2_end - str2 - .db DSCR_STRING - .db 'U, 0 - .db 'S, 0 - .db 'R, 0 - .db 'P, 0 - .db ' , 0 - .db 'R, 0 - .db 'e, 0 - .db 'v, 0 - .db ' , 0 -_usb_desc_hw_rev_ascii_patch_location_0:: - .db '?, 0 -str2_end: - - SI_COMMAND_AND_STATUS = 3 - .even -str3: .db str3_end - str3 - .db DSCR_STRING - .db 'C, 0 - .db 'o, 0 - .db 'm, 0 - .db 'm, 0 - .db 'a, 0 - .db 'n, 0 - .db 'd, 0 - .db ' , 0 - .db '&, 0 - .db ' , 0 - .db 'S, 0 - .db 't, 0 - .db 'a, 0 - .db 't, 0 - .db 'u, 0 - .db 's, 0 -str3_end: - - SI_TX_PATH = 4 - .even -str4: .db str4_end - str4 - .db DSCR_STRING - .db 'T, 0 - .db 'r, 0 - .db 'a, 0 - .db 'n, 0 - .db 's, 0 - .db 'm, 0 - .db 'i, 0 - .db 't, 0 - .db ' , 0 - .db 'P, 0 - .db 'a, 0 - .db 't, 0 - .db 'h, 0 -str4_end: - - SI_RX_PATH = 5 - .even -str5: .db str5_end - str5 - .db DSCR_STRING - .db 'R, 0 - .db 'e, 0 - .db 'c, 0 - .db 'e, 0 - .db 'i, 0 - .db 'v, 0 - .db 'e, 0 - .db ' , 0 - .db 'P, 0 - .db 'a, 0 - .db 't, 0 - .db 'h, 0 -str5_end: - - SI_SERIAL = 6 - .even -str6: .db str6_end - str6 - .db DSCR_STRING -_usb_desc_serial_number_ascii:: - .db '3, 0 - .db '., 0 - .db '1, 0 - .db '4, 0 - .db '1, 0 - .db '5, 0 - .db '9, 0 - .db '3, 0 -str6_end: - diff --git a/usrp/firmware/src/usrp2/usrp_common.c b/usrp/firmware/src/usrp2/usrp_common.c deleted file mode 100644 index f389d9253..000000000 --- a/usrp/firmware/src/usrp2/usrp_common.c +++ /dev/null @@ -1 +0,0 @@ -#include "../common/usrp_common.c" diff --git a/usrp/firmware/src/usrp2/usrp_common.h b/usrp/firmware/src/usrp2/usrp_common.h deleted file mode 100644 index 738ba6b37..000000000 --- a/usrp/firmware/src/usrp2/usrp_common.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * USRP - Universal Software Radio Peripheral - * - * Copyright (C) 2003,2006 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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, Boston, MA 02110-1301 USA - */ - -/* - * common defines and prototypes for USRP - * - * In comments below "TRM" refers to the EZ-USB FX2 Technical Reference Manual - */ - -#ifndef _USRPCOMMON_H_ -#define _USRPCOMMON_H_ - -#include <usrp_config.h> -#include <usrp_rev2_regs.h> -#include <syncdelay.h> - -/* - * From TRM page 15-105: - * - * Under certain conditions, some read and write access to the FX2 - * registers must be separated by a "synchronization delay". The - * delay is necessary only under the following conditions: - * - * - between a write to any register in the 0xE600 - 0xE6FF range - * and a write to one of the registers listed below. - * - * - between a write to one of the registers listed below and a read - * from any register in the 0xE600 - 0xE6FF range. - * - * Registers which require a synchronization delay: - * - * FIFORESET FIFOPINPOLAR - * INPKTEND EPxBCH:L - * EPxFIFOPFH:L EPxAUTOINLENH:L - * EPxFIFOCFG EPxGPIFFLGSEL - * PINFLAGSAB PINFLAGSCD - * EPxFIFOIE EPxFIFOIRQ - * GPIFIE GPIFIRQ - * UDMACRCH:L GPIFADRH:L - * GPIFTRIG EPxGPIFTRIG - * OUTPKTEND REVCTL - * GPIFTCB3 GPIFTCB2 - * GPIFTCB1 GPIFTCB0 - */ - -#define TRUE 1 -#define FALSE 0 - - -void init_usrp (void); -void init_gpif (void); - -void set_led_0 (unsigned char on); -void set_led_1 (unsigned char on); -void toggle_led_0 (void); -void toggle_led_1 (void); - -#define la_trace(v) - -#endif /* _USRPCOMMON_H_ */ diff --git a/usrp/firmware/src/usrp2/usrp_main.c b/usrp/firmware/src/usrp2/usrp_main.c deleted file mode 100644 index c7c09f8c5..000000000 --- a/usrp/firmware/src/usrp2/usrp_main.c +++ /dev/null @@ -1,380 +0,0 @@ -/* - * USRP - Universal Software Radio Peripheral - * - * Copyright (C) 2003,2004 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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, Boston, MA 02110-1301 USA - */ - -#include "usrp_common.h" -#include "usrp_commands.h" -#include "fpga.h" -#include "usrp_gpif_inline.h" -#include "timer.h" -#include "i2c.h" -#include "isr.h" -#include "usb_common.h" -#include "fx2utils.h" -#include "usrp_globals.h" -#include "usrp_i2c_addr.h" -#include <string.h> -#include "spi.h" -#include "eeprom_io.h" -#include "usb_descriptors.h" - -/* - * offsets into boot eeprom for configuration values - */ -#define HW_REV_OFFSET 5 -#define SERIAL_NO_OFFSET 248 -#define SERIAL_NO_LEN 8 - - -#define bRequestType SETUPDAT[0] -#define bRequest SETUPDAT[1] -#define wValueL SETUPDAT[2] -#define wValueH SETUPDAT[3] -#define wIndexL SETUPDAT[4] -#define wIndexH SETUPDAT[5] -#define wLengthL SETUPDAT[6] -#define wLengthH SETUPDAT[7] - - -unsigned char g_tx_enable = 0; -unsigned char g_rx_enable = 0; -unsigned char g_rx_overrun = 0; -unsigned char g_tx_underrun = 0; - -/* - * the host side fpga loader code pushes an MD5 hash of the bitstream - * into hash1. - */ -#define USRP_HASH_SIZE 16 -xdata at USRP_HASH_SLOT_1_ADDR unsigned char hash1[USRP_HASH_SIZE]; - -static void -get_ep0_data (void) -{ - EP0BCL = 0; // arm EP0 for OUT xfer. This sets the busy bit - - while (EP0CS & bmEPBUSY) // wait for busy to clear - ; -} - -/* - * Handle our "Vendor Extension" commands on endpoint 0. - * If we handle this one, return non-zero. - */ -unsigned char -app_vendor_cmd (void) -{ - if (bRequestType == VRT_VENDOR_IN){ - - ///////////////////////////////// - // handle the IN requests - ///////////////////////////////// - - switch (bRequest){ - - case VRQ_GET_STATUS: - switch (wIndexL){ - - case GS_TX_UNDERRUN: - EP0BUF[0] = g_tx_underrun; - g_tx_underrun = 0; - EP0BCH = 0; - EP0BCL = 1; - break; - - case GS_RX_OVERRUN: - EP0BUF[0] = g_rx_overrun; - g_rx_overrun = 0; - EP0BCH = 0; - EP0BCL = 1; - break; - - default: - return 0; - } - break; - - case VRQ_I2C_READ: - if (!i2c_read (wValueL, EP0BUF, wLengthL)) - return 0; - - EP0BCH = 0; - EP0BCL = wLengthL; - break; - - case VRQ_SPI_READ: - if (!spi_read (wValueH, wValueL, wIndexH, wIndexL, EP0BUF, wLengthL)) - return 0; - - EP0BCH = 0; - EP0BCL = wLengthL; - break; - - default: - return 0; - } - } - - else if (bRequestType == VRT_VENDOR_OUT){ - - ///////////////////////////////// - // handle the OUT requests - ///////////////////////////////// - - switch (bRequest){ - - case VRQ_SET_LED: - switch (wIndexL){ - case 0: - set_led_0 (wValueL); - break; - - case 1: - set_led_1 (wValueL); - break; - - default: - return 0; - } - break; - - case VRQ_FPGA_LOAD: - switch (wIndexL){ // sub-command - case FL_BEGIN: - return fpga_load_begin (); - - case FL_XFER: - get_ep0_data (); - return fpga_load_xfer (EP0BUF, EP0BCL); - - case FL_END: - return fpga_load_end (); - - default: - return 0; - } - break; - - - case VRQ_FPGA_SET_RESET: - fpga_set_reset (wValueL); - break; - - case VRQ_FPGA_SET_TX_ENABLE: - fpga_set_tx_enable (wValueL); - break; - - case VRQ_FPGA_SET_RX_ENABLE: - fpga_set_rx_enable (wValueL); - break; - - case VRQ_FPGA_SET_TX_RESET: - fpga_set_tx_reset (wValueL); - break; - - case VRQ_FPGA_SET_RX_RESET: - fpga_set_rx_reset (wValueL); - break; - - case VRQ_I2C_WRITE: - get_ep0_data (); - if (!i2c_write (wValueL, EP0BUF, EP0BCL)) - return 0; - break; - - case VRQ_SPI_WRITE: - get_ep0_data (); - if (!spi_write (wValueH, wValueL, wIndexH, wIndexL, EP0BUF, EP0BCL)) - return 0; - break; - - default: - return 0; - } - - } - else - return 0; // invalid bRequestType - - return 1; -} - - - -static void -main_loop (void) -{ - setup_flowstate_common (); - - while (1){ - - if (usb_setup_packet_avail ()) - usb_handle_setup_packet (); - - - if (GPIFTRIG & bmGPIF_IDLE){ - - // OK, GPIF is idle. Let's try to give it some work. - - // First check for underruns and overruns - - if (UC_BOARD_HAS_FPGA && (USRP_PA & (bmPA_TX_UNDERRUN | bmPA_RX_OVERRUN))){ - - // record the under/over run - if (USRP_PA & bmPA_TX_UNDERRUN) - g_tx_underrun = 1; - - if (USRP_PA & bmPA_RX_OVERRUN) - g_rx_overrun = 1; - - // tell the FPGA to clear the flags - fpga_clear_flags (); - } - - // Next see if there are any "OUT" packets waiting for our attention, - // and if so, if there's room in the FPGA's FIFO for them. - - if (g_tx_enable && !(EP24FIFOFLGS & 0x02)){ // USB end point fifo is not empty... - - if (fpga_has_room_for_packet ()){ // ... and FPGA has room for packet - - GPIFTCB1 = 0x01; SYNCDELAY; - GPIFTCB0 = 0x00; SYNCDELAY; - - setup_flowstate_write (); - - SYNCDELAY; - GPIFTRIG = bmGPIF_EP2_START | bmGPIF_WRITE; // start the xfer - SYNCDELAY; - - while (!(GPIFTRIG & bmGPIF_IDLE)){ - // wait for the transaction to complete - } - } - } - - // See if there are any requests for "IN" packets, and if so - // whether the FPGA's got any packets for us. - - if (g_rx_enable && !(EP6CS & bmEPFULL)){ // USB end point fifo is not full... - - if (fpga_has_packet_avail ()){ // ... and FPGA has packet available - - GPIFTCB1 = 0x01; SYNCDELAY; - GPIFTCB0 = 0x00; SYNCDELAY; - - setup_flowstate_read (); - - SYNCDELAY; - GPIFTRIG = bmGPIF_EP6_START | bmGPIF_READ; // start the xfer - SYNCDELAY; - - while (!(GPIFTRIG & bmGPIF_IDLE)){ - // wait for the transaction to complete - } - - SYNCDELAY; - INPKTEND = 6; // tell USB we filled buffer (6 is our endpoint num) - } - } - } - } -} - - -/* - * called at 100 Hz from timer2 interrupt - * - * Toggle led 0 - */ -void -isr_tick (void) interrupt -{ - static unsigned char count = 1; - - if (--count == 0){ - count = 50; - USRP_LED_REG ^= bmLED0; - } - - clear_timer_irq (); -} - -/* - * Read h/w rev code and serial number out of boot eeprom and - * patch the usb descriptors with the values. - */ -void -patch_usb_descriptors(void) -{ - static xdata unsigned char hw_rev; - static xdata unsigned char serial_no[8]; - unsigned char i; - - eeprom_read(I2C_ADDR_BOOT, HW_REV_OFFSET, &hw_rev, 1); // LSB of device id - usb_desc_hw_rev_binary_patch_location_0[0] = hw_rev; - usb_desc_hw_rev_binary_patch_location_1[0] = hw_rev; - usb_desc_hw_rev_ascii_patch_location_0[0] = hw_rev + '0'; // FIXME if we get > 9 - - eeprom_read(I2C_ADDR_BOOT, SERIAL_NO_OFFSET, serial_no, SERIAL_NO_LEN); - - for (i = 0; i < SERIAL_NO_LEN; i++){ - unsigned char ch = serial_no[i]; - if (ch == 0xff) // make unprogrammed EEPROM default to '0' - ch = '0'; - usb_desc_serial_number_ascii[i << 1] = ch; - } -} - -void -main (void) -{ -#if 0 - g_rx_enable = 0; // FIXME (work around initialization bug) - g_tx_enable = 0; - g_rx_overrun = 0; - g_tx_underrun = 0; -#endif - - memset (hash1, 0, USRP_HASH_SIZE); // zero fpga bitstream hash. This forces reload - - init_usrp (); - init_gpif (); - - // if (UC_START_WITH_GSTATE_OUTPUT_ENABLED) - IFCONFIG |= bmGSTATE; // no conflict, start with it on - - set_led_0 (0); - set_led_1 (0); - - EA = 0; // disable all interrupts - - patch_usb_descriptors(); - - setup_autovectors (); - usb_install_handlers (); - hook_timer_tick ((unsigned short) isr_tick); - - EIEX4 = 1; // disable INT4 FIXME - EA = 1; // global interrupt enable - - fx2_renumerate (); // simulates disconnect / reconnect - - main_loop (); -} diff --git a/usrp/firmware/src/usrp2/usrp_rev2_regs.h b/usrp/firmware/src/usrp2/usrp_rev2_regs.h deleted file mode 100644 index a4f1d9896..000000000 --- a/usrp/firmware/src/usrp2/usrp_rev2_regs.h +++ /dev/null @@ -1,163 +0,0 @@ -/* - * USRP - Universal Software Radio Peripheral - * - * Copyright (C) 2003 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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, Boston, MA 02110-1301 USA - */ - -/* - * These are the register definitions for the Rev 1 USRP prototype - * The Rev 1 is the version with the AD9862's and daughterboards - */ - -#ifndef _USRP_REV1_REGS_H_ -#define _USRP_REV1_REGS_H_ - -#include "fx2regs.h" - -/* - * Port A (bit addressable): - */ - -#define USRP_PA IOA // Port A -#define USRP_PA_OE OEA // Port A direction register - -#define bmPA_S_CLK bmBIT0 // SPI serial clock -#define bmPA_S_DATA_TO_PERIPH bmBIT1 // SPI SDI (peripheral rel name) -#define bmPA_S_DATA_FROM_PERIPH bmBIT2 // SPI SDO (peripheral rel name) -#define bmPA_SEN_FPGA bmBIT3 // serial enable for FPGA (active low) -#define bmPA_SEN_CODEC_A bmBIT4 // serial enable AD9862 A (active low) -#define bmPA_SEN_CODEC_B bmBIT5 // serial enable AD9862 B (active low) -//#define bmPA_FX2_2 bmBIT6 // misc pin to FPGA (overflow) -//#define bmPA_FX2_3 bmBIT7 // misc pin to FPGA (underflow) -#define bmPA_RX_OVERRUN bmBIT6 // misc pin to FPGA (overflow) -#define bmPA_TX_UNDERRUN bmBIT7 // misc pin to FPGA (underflow) - - -sbit at 0x80+0 bitS_CLK; // 0x80 is the bit address of PORT A -sbit at 0x80+1 bitS_OUT; // out from FX2 point of view -sbit at 0x80+2 bitS_IN; // in from FX2 point of view - - -/* all outputs except S_DATA_FROM_PERIPH, FX2_2, FX2_3 */ - -#define bmPORT_A_OUTPUTS (bmPA_S_CLK \ - | bmPA_S_DATA_TO_PERIPH \ - | bmPA_SEN_FPGA \ - | bmPA_SEN_CODEC_A \ - | bmPA_SEN_CODEC_B \ - ) - -#define bmPORT_A_INITIAL (bmPA_SEN_FPGA | bmPA_SEN_CODEC_A | bmPA_SEN_CODEC_B) - - -/* Port B: GPIF FD[7:0] */ - -/* - * Port C (bit addressable): - * 5:1 FPGA configuration - */ - -#define USRP_PC IOC // Port C -#define USRP_PC_OE OEC // Port C direction register - -#define USRP_ALTERA_CONFIG USRP_PC - -#define bmPC_nRESET bmBIT0 // reset line to codecs (active low) -#define bmALTERA_DATA0 bmBIT1 -#define bmALTERA_NCONFIG bmBIT2 -#define bmALTERA_DCLK bmBIT3 -#define bmALTERA_CONF_DONE bmBIT4 -#define bmALTERA_NSTATUS bmBIT5 -#define bmPC_LED0 bmBIT6 // active low -#define bmPC_LED1 bmBIT7 // active low - -sbit at 0xA0+1 bitALTERA_DATA0; // 0xA0 is the bit address of PORT C -sbit at 0xA0+3 bitALTERA_DCLK; - - -#define bmALTERA_BITS (bmALTERA_DATA0 \ - | bmALTERA_NCONFIG \ - | bmALTERA_DCLK \ - | bmALTERA_CONF_DONE \ - | bmALTERA_NSTATUS) - -#define bmPORT_C_OUTPUTS (bmPC_nRESET \ - | bmALTERA_DATA0 \ - | bmALTERA_NCONFIG \ - | bmALTERA_DCLK \ - | bmPC_LED0 \ - | bmPC_LED1 \ - ) - -#define bmPORT_C_INITIAL (bmPC_LED0 | bmPC_LED1) - - -#define USRP_LED_REG USRP_PC -#define bmLED0 bmPC_LED0 -#define bmLED1 bmPC_LED1 - - -/* Port D: GPIF FD[15:8] */ - -/* Port E: not bit addressible */ - -#define USRP_PE IOE // Port E -#define USRP_PE_OE OEE // Port E direction register - -#define bmPE_PE0 bmBIT0 // GPIF debug output -#define bmPE_PE1 bmBIT1 // GPIF debug output -#define bmPE_PE2 bmBIT2 // GPIF debug output -#define bmPE_FPGA_CLR_STATUS bmBIT3 // misc pin to FPGA (clear status) -#define bmPE_SEN_TX_A bmBIT4 // serial enable d'board TX A (active low) -#define bmPE_SEN_RX_A bmBIT5 // serial enable d'board RX A (active low) -#define bmPE_SEN_TX_B bmBIT6 // serial enable d'board TX B (active low) -#define bmPE_SEN_RX_B bmBIT7 // serial enable d'board RX B (active low) - - -#define bmPORT_E_OUTPUTS (bmPE_FPGA_CLR_STATUS \ - | bmPE_SEN_TX_A \ - | bmPE_SEN_RX_A \ - | bmPE_SEN_TX_B \ - | bmPE_SEN_RX_B \ - ) - - -#define bmPORT_E_INITIAL (bmPE_SEN_TX_A \ - | bmPE_SEN_RX_A \ - | bmPE_SEN_TX_B \ - | bmPE_SEN_RX_B \ - ) - -/* - * FPGA output lines that are tied to FX2 RDYx inputs. - * These are readable using GPIFREADYSTAT. - */ -#define bmFPGA_HAS_SPACE bmBIT0 // usbrdy[0] has room for 512 byte packet -#define bmFPGA_PKT_AVAIL bmBIT1 // usbrdy[1] has >= 512 bytes available -// #define bmTX_UNDERRUN bmBIT2 // usbrdy[2] D/A ran out of data -// #define bmRX_OVERRUN bmBIT3 // usbrdy[3] A/D ran out of buffer - -/* - * FPGA input lines that are tied to the FX2 CTLx outputs. - * - * These are controlled by the GPIF microprogram... - */ -// WR bmBIT0 // usbctl[0] -// RD bmBIT1 // usbctl[1] -// OE bmBIT2 // usbctl[2] - -#endif /* _USRP_REV1_REGS_H_ */ diff --git a/usrp/firmware/src/usrp2/vectors.a51 b/usrp/firmware/src/usrp2/vectors.a51 deleted file mode 100644 index fa579ba8a..000000000 --- a/usrp/firmware/src/usrp2/vectors.a51 +++ /dev/null @@ -1 +0,0 @@ - .include "../common/vectors.a51" diff --git a/usrp/fpga/.gitignore b/usrp/fpga/.gitignore deleted file mode 100644 index b336cc7ce..000000000 --- a/usrp/fpga/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/Makefile -/Makefile.in diff --git a/usrp/fpga/Makefile.am b/usrp/fpga/Makefile.am deleted file mode 100644 index 901a66f0f..000000000 --- a/usrp/fpga/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -# -# Copyright 2004,2005,2006 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. -# - -SUBDIRS = rbf diff --git a/usrp/fpga/README b/usrp/fpga/README deleted file mode 100644 index 3d1e7ad99..000000000 --- a/usrp/fpga/README +++ /dev/null @@ -1,3 +0,0 @@ -The FPGA source content that used to be here is now hosted at: - -git://ettus.sourcerepo.com/ettus/fpga.git diff --git a/usrp/fpga/rbf/.gitignore b/usrp/fpga/rbf/.gitignore deleted file mode 100644 index eb58a95f5..000000000 --- a/usrp/fpga/rbf/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -/Makefile -/Makefile.in -/usrp_fpga_rev1.rbf -/usrp_fpga_rev2.rbf diff --git a/usrp/fpga/rbf/Makefile.am b/usrp/fpga/rbf/Makefile.am deleted file mode 100644 index 7bce77d5f..000000000 --- a/usrp/fpga/rbf/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -# -# Copyright 2005,2006,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. -# - -SUBDIRS = rev2 rev4 diff --git a/usrp/fpga/rbf/rev2/.gitignore b/usrp/fpga/rbf/rev2/.gitignore deleted file mode 100644 index b336cc7ce..000000000 --- a/usrp/fpga/rbf/rev2/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/Makefile -/Makefile.in diff --git a/usrp/fpga/rbf/rev2/Makefile.am b/usrp/fpga/rbf/rev2/Makefile.am deleted file mode 100644 index 487650e18..000000000 --- a/usrp/fpga/rbf/rev2/Makefile.am +++ /dev/null @@ -1,31 +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. -# - -include $(top_srcdir)/Makefile.common - -rbf2datadir = $(prefix)/share/usrp/rev2 - -dist_rbf2data_DATA = \ - std_2rxhb_2tx.rbf \ - std_4rx_0tx.rbf \ - inband_1rxhb_1tx.rbf \ - inband_2rxhb_2tx.rbf \ - multi_2rxhb_2tx.rbf diff --git a/usrp/fpga/rbf/rev2/inband_1rxhb_1tx.rbf b/usrp/fpga/rbf/rev2/inband_1rxhb_1tx.rbf Binary files differdeleted file mode 100755 index c1c9af2ce..000000000 --- a/usrp/fpga/rbf/rev2/inband_1rxhb_1tx.rbf +++ /dev/null diff --git a/usrp/fpga/rbf/rev2/inband_2rxhb_2tx.rbf b/usrp/fpga/rbf/rev2/inband_2rxhb_2tx.rbf Binary files differdeleted file mode 100755 index ca1a0f92b..000000000 --- a/usrp/fpga/rbf/rev2/inband_2rxhb_2tx.rbf +++ /dev/null diff --git a/usrp/fpga/rbf/rev2/multi_2rxhb_2tx.rbf b/usrp/fpga/rbf/rev2/multi_2rxhb_2tx.rbf Binary files differdeleted file mode 100755 index 2683d8641..000000000 --- a/usrp/fpga/rbf/rev2/multi_2rxhb_2tx.rbf +++ /dev/null diff --git a/usrp/fpga/rbf/rev2/multi_4rx_0tx.rbf b/usrp/fpga/rbf/rev2/multi_4rx_0tx.rbf Binary files differdeleted file mode 100755 index b7e4eb393..000000000 --- a/usrp/fpga/rbf/rev2/multi_4rx_0tx.rbf +++ /dev/null diff --git a/usrp/fpga/rbf/rev2/std_2rxhb_2tx.rbf b/usrp/fpga/rbf/rev2/std_2rxhb_2tx.rbf Binary files differdeleted file mode 100755 index ee3c30d66..000000000 --- a/usrp/fpga/rbf/rev2/std_2rxhb_2tx.rbf +++ /dev/null diff --git a/usrp/fpga/rbf/rev2/std_4rx_0tx.rbf b/usrp/fpga/rbf/rev2/std_4rx_0tx.rbf Binary files differdeleted file mode 100755 index 1deca9517..000000000 --- a/usrp/fpga/rbf/rev2/std_4rx_0tx.rbf +++ /dev/null diff --git a/usrp/fpga/rbf/rev4/.gitignore b/usrp/fpga/rbf/rev4/.gitignore deleted file mode 100644 index b336cc7ce..000000000 --- a/usrp/fpga/rbf/rev4/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/Makefile -/Makefile.in diff --git a/usrp/fpga/rbf/rev4/Makefile.am b/usrp/fpga/rbf/rev4/Makefile.am deleted file mode 100644 index 54de9b818..000000000 --- a/usrp/fpga/rbf/rev4/Makefile.am +++ /dev/null @@ -1,31 +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. -# - -include $(top_srcdir)/Makefile.common - -rbf4datadir = $(prefix)/share/usrp/rev4 - -dist_rbf4data_DATA = \ - std_2rxhb_2tx.rbf \ - std_4rx_0tx.rbf \ - inband_1rxhb_1tx.rbf \ - inband_2rxhb_2tx.rbf \ - multi_2rxhb_2tx.rbf diff --git a/usrp/fpga/rbf/rev4/inband_1rxhb_1tx.rbf b/usrp/fpga/rbf/rev4/inband_1rxhb_1tx.rbf Binary files differdeleted file mode 100755 index c1c9af2ce..000000000 --- a/usrp/fpga/rbf/rev4/inband_1rxhb_1tx.rbf +++ /dev/null diff --git a/usrp/fpga/rbf/rev4/inband_2rxhb_2tx.rbf b/usrp/fpga/rbf/rev4/inband_2rxhb_2tx.rbf Binary files differdeleted file mode 100755 index ca1a0f92b..000000000 --- a/usrp/fpga/rbf/rev4/inband_2rxhb_2tx.rbf +++ /dev/null diff --git a/usrp/fpga/rbf/rev4/multi_2rxhb_2tx.rbf b/usrp/fpga/rbf/rev4/multi_2rxhb_2tx.rbf Binary files differdeleted file mode 100755 index 2683d8641..000000000 --- a/usrp/fpga/rbf/rev4/multi_2rxhb_2tx.rbf +++ /dev/null diff --git a/usrp/fpga/rbf/rev4/multi_4rx_0tx.rbf b/usrp/fpga/rbf/rev4/multi_4rx_0tx.rbf Binary files differdeleted file mode 100755 index b7e4eb393..000000000 --- a/usrp/fpga/rbf/rev4/multi_4rx_0tx.rbf +++ /dev/null diff --git a/usrp/fpga/rbf/rev4/std_2rxhb_2tx.rbf b/usrp/fpga/rbf/rev4/std_2rxhb_2tx.rbf Binary files differdeleted file mode 100755 index ee3c30d66..000000000 --- a/usrp/fpga/rbf/rev4/std_2rxhb_2tx.rbf +++ /dev/null diff --git a/usrp/fpga/rbf/rev4/std_4rx_0tx.rbf b/usrp/fpga/rbf/rev4/std_4rx_0tx.rbf Binary files differdeleted file mode 100755 index 1deca9517..000000000 --- a/usrp/fpga/rbf/rev4/std_4rx_0tx.rbf +++ /dev/null diff --git a/usrp/host/.gitignore b/usrp/host/.gitignore deleted file mode 100644 index a02b6ff73..000000000 --- a/usrp/host/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -/Makefile -/Makefile.in -/.la -/.lo -/.deps -/.libs -/*.la -/*.lo diff --git a/usrp/host/Makefile.am b/usrp/host/Makefile.am deleted file mode 100644 index aa94fbd6e..000000000 --- a/usrp/host/Makefile.am +++ /dev/null @@ -1,26 +0,0 @@ -# -# Copyright 2001,2007,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. -# - -SUBDIRS = misc lib include apps - -if PYTHON -SUBDIRS += swig -endif diff --git a/usrp/host/apps/.gitignore b/usrp/host/apps/.gitignore deleted file mode 100644 index 16fdf27ad..000000000 --- a/usrp/host/apps/.gitignore +++ /dev/null @@ -1,27 +0,0 @@ -/Makefile -/Makefile.in -/.la -/.lo -/.deps -/.libs -/*.la -/*.lo -/*.dat -/usrper -/usrper2 -/test_input -/test_fusb -/test_usrp -/test_usrp0 -/test_usrp_standard_rx -/test_usrp_standard_tx -/test_usrp_inband_timestamps -/test_usrp_inband_registers -/test_usrp_inband_rx -/test_usrp_inband_tx -/test_usrp_basic_rx -/check_order_quickly -/usrp_cal_dc_offset -/test_usrp_inband_cs -/read_packets -/test_usrp_inband_ping diff --git a/usrp/host/apps/Makefile.am b/usrp/host/apps/Makefile.am deleted file mode 100644 index 8aa361b22..000000000 --- a/usrp/host/apps/Makefile.am +++ /dev/null @@ -1,56 +0,0 @@ -# -# Copyright 2003,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. -# - -include $(top_srcdir)/Makefile.common - -AM_CPPFLAGS = $(USRP_INCLUDES) $(BOOST_CPPFLAGS) $(CPPUNIT_INCLUDES) \ - $(USB_INCLUDES) $(WITH_INCLUDES) - -bin_PROGRAMS = \ - usrper \ - usrp_cal_dc_offset - -noinst_PROGRAMS = \ - check_order_quickly \ - test_usrp_standard_rx \ - test_usrp_standard_tx - -noinst_HEADERS = \ - time_stuff.h - -noinst_PYTHON = \ - burn-db-eeprom \ - burn-serial-number - - -check_order_quickly_SOURCES = check_order_quickly.cc - -test_usrp_standard_rx_SOURCES = test_usrp_standard_rx.cc time_stuff.c -test_usrp_standard_rx_LDADD = $(USRP_LA) - -test_usrp_standard_tx_SOURCES = test_usrp_standard_tx.cc time_stuff.c -test_usrp_standard_tx_LDADD = $(USRP_LA) $(BOOST_LDFLAGS) $(BOOST_PROGRAM_OPTIONS_LIB) - -usrper_SOURCES = usrper.cc -usrper_LDADD = $(USRP_LA) - -usrp_cal_dc_offset_SOURCES = usrp_cal_dc_offset.cc -usrp_cal_dc_offset_LDADD = $(USRP_LA) diff --git a/usrp/host/apps/burn-db-eeprom b/usrp/host/apps/burn-db-eeprom deleted file mode 100755 index 0c908e3d5..000000000 --- a/usrp/host/apps/burn-db-eeprom +++ /dev/null @@ -1,174 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2005,2007,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. -# - -from usrpm.usrp_prims import * -from optparse import OptionParser -import sys -from usrpm.usrp_dbid import * - -i2c_addr_map = { 'TX_A' : 0x54, 'RX_A' : 0x55, 'TX_B' : 0x56, 'RX_B' : 0x57 } - -daughterboards = { - # name : ((tx-dbid, tx-oe), (rx-dbid, rx-oe)) - 'basictx' : ((BASIC_TX, 0x0000), None), - 'basicrx' : (None, (BASIC_RX, 0x0000)), - 'dbsrx' : (None, (DBS_RX, 0x0000)), - 'dbsrx_clkmod' : (None, (DBS_RX_CLKMOD, 0x0000)), - 'tvrx' : (None, (TV_RX, 0x0000)), - 'tvrx2' : (None, (TV_RX_REV_2, 0x0000)), - 'tvrx3' : (None, (TV_RX_REV_3, 0x0000)), - 'tvrx_mimo' : (None, (TV_RX_MIMO, 0x0000)), - 'tvrx2_mimo' : (None, (TV_RX_REV_2_MIMO, 0x0000)), - 'tvrx3_mimo' : (None, (TV_RX_REV_3_MIMO, 0x0000)), - 'dtt754' : (None, (DTT754, 0x0000)), - 'dtt768' : (None, (DTT768, 0x0000)), - 'rfx400' : ((FLEX_400_TX, 0x0000), (FLEX_400_RX, 0x0000)), - 'rfx900' : ((FLEX_900_TX, 0x0000), (FLEX_900_RX, 0x0000)), - 'rfx1200' : ((FLEX_1200_TX, 0x0000), (FLEX_1200_RX, 0x0000)), - 'rfx1800' : ((FLEX_1800_TX, 0x0000), (FLEX_1800_RX, 0x0000)), - 'rfx2400' : ((FLEX_2400_TX, 0x0000), (FLEX_2400_RX, 0x0000)), - 'rfx400_tx' : ((FLEX_400_TX, 0x0000), None), - 'rfx900_tx' : ((FLEX_900_TX, 0x0000), None), - 'rfx1200_tx' : ((FLEX_1200_TX, 0x0000), None), - 'rfx1800_tx' : ((FLEX_1800_TX, 0x0000), None), - 'rfx2400_tx' : ((FLEX_2400_TX, 0x0000), None), - 'rfx400_rx' : (None, (FLEX_400_RX, 0x0000)), - 'rfx900_rx' : (None, (FLEX_900_RX, 0x0000)), - 'rfx1200_rx' : (None, (FLEX_1200_RX, 0x0000)), - 'rfx1800_rx' : (None, (FLEX_1800_RX, 0x0000)), - 'rfx2400_rx' : (None, (FLEX_2400_RX, 0x0000)), - 'rfx400_mimo_a' : ((FLEX_400_TX_MIMO_A, 0x0000), (FLEX_400_RX_MIMO_A, 0x0000)), - 'rfx900_mimo_a' : ((FLEX_900_TX_MIMO_A, 0x0000), (FLEX_900_RX_MIMO_A, 0x0000)), - 'rfx1200_mimo_a' : ((FLEX_1200_TX_MIMO_A, 0x0000), (FLEX_1200_RX_MIMO_A, 0x0000)), - 'rfx1800_mimo_a' : ((FLEX_1800_TX_MIMO_A, 0x0000), (FLEX_1800_RX_MIMO_A, 0x0000)), - 'rfx2400_mimo_a' : ((FLEX_2400_TX_MIMO_A, 0x0000), (FLEX_2400_RX_MIMO_A, 0x0000)), - 'rfx400_mimo_b' : ((FLEX_400_TX_MIMO_B, 0x0000), (FLEX_400_RX_MIMO_B, 0x0000)), - 'rfx900_mimo_b' : ((FLEX_900_TX_MIMO_B, 0x0000), (FLEX_900_RX_MIMO_B, 0x0000)), - 'rfx1200_mimo_b' : ((FLEX_1200_TX_MIMO_B, 0x0000), (FLEX_1200_RX_MIMO_B, 0x0000)), - 'rfx1800_mimo_b' : ((FLEX_1800_TX_MIMO_B, 0x0000), (FLEX_1800_RX_MIMO_B, 0x0000)), - 'rfx2200_mimo_b' : ((FLEX_2200_TX_MIMO_B, 0x0000), (FLEX_2200_RX_MIMO_B, 0x0000)), - 'rfx2400_mimo_b' : ((FLEX_2400_TX_MIMO_B, 0x0000), (FLEX_2400_RX_MIMO_B, 0x0000)), - 'lftx' : ((LF_TX, 0x0000), None), - 'lfrx' : (None, (LF_RX, 0x0000)), - 'wbx_lo' : ((WBX_LO_TX, 0x0000), (WBX_LO_RX, 0x0000)), - 'wbx_ng' : ((WBX_NG_TX, 0x0000), (WBX_NG_RX, 0x0000)), - 'xcvr2450' : ((XCVR2450_TX, 0x0000), (XCVR2450_RX, 0x0000)), - 'bitshark_rx' : (None, (BITSHARK_RX, 0x0000)), - 'experimental_tx' : ((EXPERIMENTAL_TX, 0x0000), None), - 'experimental_rx' : (None, (EXPERIMENTAL_RX, 0x0000)), - } - -def open_cmd_interface(which_board = 0): - if not usrp_load_standard_bits (which_board, 0): - raise RuntimeError, "usrp_load_standard_bits" - dev = usrp_find_device (which_board) - if not dev: - raise RuntimeError, "usrp_find_device" - u = usrp_open_cmd_interface (dev) - if not u: - raise RuntimeError, "usrp_open_cmd_interface" - return u - -def write_dboard_eeprom(u, i2c_addr, dbid, oe): - eeprom = 0x20 * [0] - eeprom[0] = 0xDB # magic value - eeprom[1] = dbid & 0xff - eeprom[2] = (dbid >> 8) & 0xff - eeprom[3] = oe & 0xff - eeprom[4] = (oe >> 8) & 0xff - eeprom[0x1f] = 0xff & (-reduce(lambda x, y: x+y, eeprom)) # checksum - s = ''.join (map (chr, eeprom)) - ok = usrp_eeprom_write (u, i2c_addr, 0, s) - return ok - - -def init_eeprom(u, slot_name, force, dbid, oe): - i2c_addr = i2c_addr_map[slot_name] - e = usrp_eeprom_read (u, i2c_addr, 0, 0x20) - if not e: - print "%s: no d'board, skipped" % (slot_name,) - return True - - if not force and (sum (map (ord, e)) & 0xff) == 0 and ord (e[0]) == 0xDB: - print "%s: already initialized, skipped" % (slot_name,) - return True - - if not write_dboard_eeprom (u, i2c_addr, dbid, oe): - print "%s: failed to write d'board EEPROM" % (slot_name,) - return False - - print "%s: OK" % (slot_name,) - return True - - -def init_daughterboard(u, side, type, force): - ok = True - dbinfo = daughterboards[type] - if dbinfo[0] is not None: # burn tx slot - ok &= init_eeprom(u, 'TX_' + side, force, dbinfo[0][0], dbinfo[0][1]) - if dbinfo[1] is not None: # burn rx slot - ok &= init_eeprom(u, 'RX_' + side, force, dbinfo[1][0], dbinfo[1][1]) - return ok - - -def main(): - dbs = daughterboards.keys() - dbs.sort() - usage = """\ -usage: %prog [options] -You must specify a type with -t or --type, -and at least one side using -A and/or -B.""" - - parser = OptionParser(usage=usage) - parser.add_option ("-t", "--type", type="choice", help="choose type from %r" % (dbs,), - choices=dbs, default=None) - parser.add_option ("-A", "--burn-a", action="store_true", default=False, - help="burn eeprom(s) on side A") - parser.add_option ("-B", "--burn-b", action="store_true", default=False, - help="burn eeprom(s) on side B") - parser.add_option ("-f", "--force", action="store_true", default=False, - help="force init of already initialized eeproms") - (options, args) = parser.parse_args () - - which=[] - if options.burn_a: - which.append('A') - if options.burn_b: - which.append('B') - - if len(args) != 0 or len(which) == 0 or options.type is None: - parser.print_help() - sys.exit (1) - - u = open_cmd_interface (0) - ok = True - for w in which: - ok &= init_daughterboard (u, w, options.type, options.force) - - if ok: - sys.exit (0) - else: - sys.exit (1) - -if __name__ == "__main__": - main () - diff --git a/usrp/host/apps/burn-serial-number b/usrp/host/apps/burn-serial-number deleted file mode 100755 index f9a2a86a5..000000000 --- a/usrp/host/apps/burn-serial-number +++ /dev/null @@ -1,80 +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. -# - -from usrpm.usrp_prims import * -from optparse import OptionParser -import sys -import time - - -def open_cmd_interface(which_board = 0): - if not usrp_load_standard_bits (which_board, 0): - raise RuntimeError, "usrp_load_standard_bits" - dev = usrp_find_device (which_board) - if not dev: - raise RuntimeError, "usrp_find_device" - u = usrp_open_cmd_interface (dev) - if not u: - raise RuntimeError, "usrp_open_cmd_interface" - return u - - -def write_serial_number_eeprom(u, serial_number): - if not str(serial_number): - raise TypeError - - i2c_addr = 0x50 # usrp boot rom - serial_number_offset = 248 # offset to serial number - serial_number_len = 8 # length of serial number - - lsn = len(serial_number) - if lsn > serial_number_len: - serial_number = serial_number[0:serial_number_len] - if lsn < serial_number_len: - serial_number = serial_number + (serial_number_len - lsn) * ' ' - - ok = usrp_eeprom_write (u, i2c_addr, serial_number_offset, serial_number) - return ok - - -def main(): - - default_serial_number = hex(int(time.time()))[2:] - parser = OptionParser() - parser.add_option ("-s", "--serial-number", default=default_serial_number, - help="set serial number [default=%default]") - (options, args) = parser.parse_args () - - if len(args) != 0: - parser.print_help() - sys.exit(1) - - u = open_cmd_interface (0) - ok = write_serial_number_eeprom(u, options.serial_number) - - if ok: - sys.exit(0) - else: - sys.exit(1) - -if __name__ == "__main__": - main () diff --git a/usrp/host/apps/check_order b/usrp/host/apps/check_order deleted file mode 100755 index 56e192710..000000000 --- a/usrp/host/apps/check_order +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env python -# -*- Python -*- - -import sys -import fileinput - -skip_count = 4096 -lineno = 0 -last_error = 0 - -for line in fileinput.input (): - lineno += 1 - if lineno < skip_count: - continue - (offset, dec_val, hex_val) = line.split () - if lineno == skip_count: - expected_val = int (dec_val) - int_dec_val = int (dec_val) - int_hex_val = int (hex_val, 16) - if int_dec_val != expected_val: - print "line %6d, delta %4d, expected %6d, got %6d" % (lineno, - lineno - last_error, - expected_val, - int_dec_val) - last_error = lineno - elif ((int_hex_val >> 12) & 0xf) != (int_hex_val & 0xf): - print "line %6d, delta %4d, invalid high bits %04x" % (lineno, - lineno - last_error, - int_hex_val) - last_error = lineno - - # expected_val = (expected_val + 1) & 0xffff - expected_val = (expected_val + 1) & 0x0fff - - - - - - diff --git a/usrp/host/apps/check_order_quickly.cc b/usrp/host/apps/check_order_quickly.cc deleted file mode 100644 index 4fa30c7d9..000000000 --- a/usrp/host/apps/check_order_quickly.cc +++ /dev/null @@ -1,62 +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. - */ - -#include <stdio.h> - -static bool -check (int v, int counter, int offset) -{ - if ((v & 0x0fff) != counter){ - fprintf (stdout, "%08x: expected 0x%04x, got 0x%04x\n", offset, counter, v & 0x0fff); - return false; - } - - if (((v >> 12) & 0xf) != (v & 0xf)){ - fprintf (stdout, "%08x: bad high bits 0x%04x\n", offset, v); - return false; - } - - return true; -} - -int -main (int argc, char **argv) -{ - static const int BUFSIZE = 64 * 1024; - unsigned short buf[BUFSIZE]; - - int n; - int i; - int counter = 0; - int offset = 0; - bool ok = true; - - while ((n = fread (buf, sizeof (short), BUFSIZE, stdin)) != 0){ - for (i = 0; i < n; i++){ - ok &= check (buf[i], counter, offset); - counter = (counter + 1) & 0x0fff; - offset++; - } - } - - return ok ? 0 : 1; -} diff --git a/usrp/host/apps/dump_12bit_shorts b/usrp/host/apps/dump_12bit_shorts deleted file mode 100755 index a896f2dd3..000000000 --- a/usrp/host/apps/dump_12bit_shorts +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env python -# -*- Python -*- - -import sys, errno - -counter = 0 - -try: - while 1: - x = sys.stdin.read (2) - if not x: - break - - v = (ord(x[1]) << 8) | ord(x[0]) - sys.stdout.write ("0x%08x %6d 0x%04x\n" % (counter, v & 0x0fff, v)) - counter += 1 -except IOError, e: - if e.errno == errno.EPIPE: - sys.exit (0) - - - - diff --git a/usrp/host/apps/dump_shorts b/usrp/host/apps/dump_shorts deleted file mode 100755 index 6104ea062..000000000 --- a/usrp/host/apps/dump_shorts +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env python -# -*- Python -*- - -import sys, errno - -counter = 0 - -try: - while 1: - x = sys.stdin.read (2) - if not x: - break - - v = (ord(x[1]) << 8) | ord(x[0]) - sys.stdout.write ("0x%08x %6d 0x%04x\n" % (counter, v, v)) - counter += 1 -except IOError, e: - if e.errno == errno.EPIPE: - sys.exit (0) - - - - diff --git a/usrp/host/apps/run b/usrp/host/apps/run deleted file mode 100755 index 5b13336c7..000000000 --- a/usrp/host/apps/run +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -./test_usrp_standard_rx -D 8 -o rx.bin -./dump_12bit_shorts <rx.bin | head -100000 >rx.ascii -./check_order rx.ascii -#./dump_12bit_shorts <rx.bin | ./check_order diff --git a/usrp/host/apps/run2 b/usrp/host/apps/run2 deleted file mode 100755 index 5fcf154cb..000000000 --- a/usrp/host/apps/run2 +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -./test_usrp_standard_rx -D 8 -o rx.bin -./check_order_quickly <rx.bin diff --git a/usrp/host/apps/run_input b/usrp/host/apps/run_input deleted file mode 100755 index b8afae6f3..000000000 --- a/usrp/host/apps/run_input +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -./test_usrp_standard_rx -D 8 -o rx.bin "$@" -./dump_shorts <rx.bin | head -50000 >rx.ascii - diff --git a/usrp/host/apps/test_usrp_standard_rx.cc b/usrp/host/apps/test_usrp_standard_rx.cc deleted file mode 100644 index 4098decda..000000000 --- a/usrp/host/apps/test_usrp_standard_rx.cc +++ /dev/null @@ -1,273 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003,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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <getopt.h> -#include <assert.h> -#include <math.h> -#include "time_stuff.h" -#include <usrp/usrp_standard.h> -#include <usrp/usrp_bytesex.h> -#include "fpga_regs_common.h" -#include "fpga_regs_standard.h" - -#ifdef HAVE_SCHED_H -#include <sched.h> -#endif - -char *prog_name; - -static bool test_input (usrp_standard_rx_sptr urx, int max_bytes, FILE *fp); - -static void -set_progname (char *path) -{ - char *p = strrchr (path, '/'); - if (p != 0) - prog_name = p+1; - else - prog_name = path; -} - -static void -usage () -{ - fprintf (stderr, "usage: %s [-f] [-v] [-l] [-c] [-D <decim>] [-F freq] [-o output_file]\n", prog_name); - fprintf (stderr, " [-f] loop forever\n"); - fprintf (stderr, " [-M] how many Megabytes to transfer (default 128)\n"); - fprintf (stderr, " [-v] verbose\n"); - fprintf (stderr, " [-l] digital loopback in FPGA\n"); - fprintf (stderr, " [-c] counting in FPGA\n"); - fprintf (stderr, " [-8] 8-bit samples across USB\n"); - fprintf (stderr, " [-B <fusb_block_size>] set fast usb block_size\n"); - fprintf (stderr, " [-N <fusb_nblocks>] set fast usb nblocks\n"); - fprintf (stderr, " [-R] set real time scheduling: SCHED_FIFO; pri = midpoint\n"); - - exit (1); -} - -static void -die (const char *msg) -{ - fprintf (stderr, "die: %s: %s\n", prog_name, msg); - exit (1); -} - -int -main (int argc, char **argv) -{ - bool verbose_p = false; - bool loopback_p = false; - bool counting_p = false; - bool width_8_p = false; - int max_bytes = 128 * (1L << 20); - int ch; - char *output_filename = 0; - int which_board = 0; - int decim = 8; // 32 MB/sec - double center_freq = 0; - int fusb_block_size = 0; - int fusb_nblocks = 0; - bool realtime_p = false; - - - set_progname (argv[0]); - - while ((ch = getopt (argc, argv, "fvlco:D:F:M:8B:N:R")) != EOF){ - switch (ch){ - case 'f': - max_bytes = 0; - break; - - case 'v': - verbose_p = true; - break; - - case 'l': - loopback_p = true; - break; - - case 'c': - counting_p = true; - break; - - case '8': - width_8_p = true; - break; - - case 'o': - output_filename = optarg; - break; - - case 'D': - decim = strtol (optarg, 0, 0); - break; - - case 'F': - center_freq = strtod (optarg, 0); - break; - - case 'M': - max_bytes = strtol (optarg, 0, 0) * (1L << 20); - if (max_bytes < 0) max_bytes = 0; - break; - - case 'B': - fusb_block_size = strtol (optarg, 0, 0); - break; - - case 'N': - fusb_nblocks = strtol (optarg, 0, 0); - break; - - case 'R': - realtime_p = true; - break; - - default: - usage (); - } - } - -#ifdef HAVE_SCHED_SETSCHEDULER - if (realtime_p){ - int policy = SCHED_FIFO; - int pri = (sched_get_priority_max (policy) - sched_get_priority_min (policy)) / 2; - int pid = 0; // this process - - struct sched_param param; - memset(¶m, 0, sizeof(param)); - param.sched_priority = pri; - int result = sched_setscheduler(pid, policy, ¶m); - if (result != 0){ - perror ("sched_setscheduler: failed to set real time priority"); - } - else - printf("SCHED_FIFO enabled with priority = %d\n", pri); - } -#endif - - FILE *fp = 0; - - if (output_filename){ - fp = fopen (output_filename, "wb"); - if (fp == 0) - perror (output_filename); - } - - int mode = 0; - if (loopback_p) - mode |= usrp_standard_rx::FPGA_MODE_LOOPBACK; - if (counting_p) - mode |= usrp_standard_rx::FPGA_MODE_COUNTING; - - - usrp_standard_rx_sptr urx = - usrp_standard_rx::make (which_board, decim, 1, -1, mode, - fusb_block_size, fusb_nblocks); - - if (urx == 0) - die ("usrp_standard_rx::make"); - - if (!urx->set_rx_freq (0, center_freq)) - die ("urx->set_rx_freq"); - - if (width_8_p){ - int width = 8; - int shift = 8; - bool want_q = true; - if (!urx->set_format(usrp_standard_rx::make_format(width, shift, want_q))) - die("urx->set_format"); - } - - urx->start(); // start data xfers - - test_input (urx, max_bytes, fp); - - if (fp) - fclose (fp); - - return 0; -} - - -static bool -test_input (usrp_standard_rx_sptr urx, int max_bytes, FILE *fp) -{ - int fd = -1; - static const int BUFSIZE = urx->block_size(); - static const int N = BUFSIZE/sizeof (short); - short buf[N]; - int nbytes = 0; - - double start_wall_time = get_elapsed_time (); - double start_cpu_time = get_cpu_usage (); - - if (fp) - fd = fileno (fp); - - bool overrun; - int noverruns = 0; - - for (nbytes = 0; max_bytes == 0 || nbytes < max_bytes; nbytes += BUFSIZE){ - - unsigned int ret = urx->read (buf, sizeof (buf), &overrun); - if (ret != sizeof (buf)){ - fprintf (stderr, "test_input: error, ret = %d\n", ret); - } - - if (overrun){ - printf ("rx_overrun\n"); - noverruns++; - } - - if (fd != -1){ - - for (unsigned int i = 0; i < sizeof (buf) / sizeof (short); i++) - buf[i] = usrp_to_host_short (buf[i]); - - if (write (fd, buf, sizeof (buf)) == -1){ - perror ("write"); - fd = -1; - } - } - } - - double stop_wall_time = get_elapsed_time (); - double stop_cpu_time = get_cpu_usage (); - - double delta_wall = stop_wall_time - start_wall_time; - double delta_cpu = stop_cpu_time - start_cpu_time; - - printf ("xfered %.3g bytes in %.3g seconds. %.4g bytes/sec. cpu time = %.4g\n", - (double) max_bytes, delta_wall, max_bytes / delta_wall, delta_cpu); - printf ("noverruns = %d\n", noverruns); - - return true; -} diff --git a/usrp/host/apps/test_usrp_standard_tx.cc b/usrp/host/apps/test_usrp_standard_tx.cc deleted file mode 100644 index cc9f9edfc..000000000 --- a/usrp/host/apps/test_usrp_standard_tx.cc +++ /dev/null @@ -1,314 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003,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 <iostream> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <getopt.h> -#include <assert.h> -#include <math.h> -#include "time_stuff.h" -#include <usrp/usrp_standard.h> -#include <usrp/usrp_bytesex.h> -#include <boost/program_options.hpp> - -enum { - GR_SIN_WAVE, - GR_CONST_WAVE -}; - -namespace po = boost::program_options; - -char *prog_name; - -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; -} - - -static void -set_progname (char *path) -{ - char *p = strrchr (path, '/'); - if (p != 0) - prog_name = p+1; - else - prog_name = path; -} - -static void -die (const char *msg) -{ - fprintf (stderr, "die: %s: %s\n", prog_name, msg); - exit (1); -} - - -static bool -test_output (usrp_standard_tx_sptr utx, long long max_bytes, double ampl, int waveform) -{ - const int BUFSIZE = utx->block_size(); - const int N = BUFSIZE/sizeof (short); - - short buf[N]; - long long nbytes = 0; - - // ---------------------------------------------------------------- - // one time initialization of the pattern we're going to transmit - - const int PERIOD = 65; // any value is valid - const int PATLEN = 2 * PERIOD; - short pattern[PATLEN]; - - for (int i = 0; i < PERIOD; i++){ - if (waveform == GR_CONST_WAVE){ - pattern[2*i+0] = host_to_usrp_short((short) ampl); - pattern[2*i+1] = host_to_usrp_short((short) 0); - } - else { - pattern[2*i+0] = host_to_usrp_short((short) (ampl * cos(2*M_PI * i / PERIOD))); - pattern[2*i+1] = host_to_usrp_short((short) (ampl * sin(2*M_PI * i / PERIOD))); - } - } - - // ---------------------------------------------------------------- - - double start_wall_time = get_elapsed_time (); - double start_cpu_time = get_cpu_usage (); - - bool underrun; - int nunderruns = 0; - int pi = 0; - - for (nbytes = 0; max_bytes == 0 || nbytes < max_bytes; nbytes += BUFSIZE){ - - for (int i = 0; i < N; i++){ - buf[i] = pattern[pi]; - pi++; - if (pi >= PATLEN) - pi = 0; - } - - int ret = utx->write (buf, sizeof (buf), &underrun); - if ((unsigned) ret != sizeof (buf)){ - fprintf (stderr, "test_output: error, ret = %d\n", ret); - } - - if (underrun){ - nunderruns++; - printf ("tx_underrun\n"); - //printf ("tx_underrun %9d %6d\n", nbytes, nbytes/BUFSIZE); - } - } - - utx->wait_for_completion (); - - double stop_wall_time = get_elapsed_time (); - double stop_cpu_time = get_cpu_usage (); - - double delta_wall = stop_wall_time - start_wall_time; - double delta_cpu = stop_cpu_time - start_cpu_time; - - printf ("xfered %.3g bytes in %.3g seconds. %.4g bytes/sec. cpu time = %.3g\n", - (double) max_bytes, delta_wall, max_bytes / delta_wall, delta_cpu); - - printf ("%d underruns\n", nunderruns); - - return true; -} - -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 = 16; // set the interpolation rate - double rf_freq = -1; // set the frequency - float amp = 10000; // set the amplitude of the output - float gain = -1; // set the d'board PGA gain - int waveform; - int fusb_block_size = 0; - int fusb_nblocks = 0; - bool realtime_p = false; - double nsamples = 32e6; - - set_progname (argv[0]); - - 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") - - //("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 [default=MAX]") - //("offset,o", po::value<float>(&offset), "set waveform offset to OFFSET") - ("nsamples,N", po::value<double>(&nsamples), "number of samples to send [default=32M]") - ; - - 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("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 { - 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); - - - if (realtime_p){ - // FIXME - } - - usrp_standard_tx_sptr utx; - - utx = usrp_standard_tx::make (which, - interp, - 1, // nchan - -1, // mux - fusb_block_size, - fusb_nblocks); - - if (utx == 0) - die ("usrp_standard_tx::make"); - - // FIXME - - db_base_sptr subdev = utx->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 = utx->determine_tx_mux_value(spec); - printf("mux: %#08x\n", mux); - utx->set_mux(mux); - - if(gain == -1) - gain = subdev->gain_max(); - subdev->set_gain(gain); - - float input_rate = utx->dac_rate() / utx->interp_rate(); - printf("baseband rate: %g\n", input_rate); - - usrp_tune_result r; - - if (rf_freq < 0) - rf_freq = (subdev->freq_min() + subdev->freq_max()) * 0.5; - double target_freq = rf_freq; - bool ok = utx->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); - - - fflush (stdout); - fflush (stderr); - - utx->start(); // start data xfers - - test_output (utx, (long long) nsamples, amp, waveform); - - return 0; -} - - -#if 0 - case 'B': - fusb_block_size = strtol (optarg, 0, 0); - break; - - case 'N': - fusb_nblocks = strtol (optarg, 0, 0); - break; - - case 'R': - realtime_p = true; - break; - -#endif diff --git a/usrp/host/apps/time_stuff.c b/usrp/host/apps/time_stuff.c deleted file mode 100644 index 89a4a3815..000000000 --- a/usrp/host/apps/time_stuff.c +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 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 "time_stuff.h" - -#include <sys/time.h> -#ifdef HAVE_SYS_RESOURCE_H -#include <sys/resource.h> -#endif -#include <unistd.h> - -static double -timeval_to_secs (struct timeval *tv) -{ - return (double) tv->tv_sec + (double) tv->tv_usec * 1e-6; -} - -double -get_cpu_usage (void) -{ -#ifdef HAVE_GETRUSAGE - struct rusage ru; - - if (getrusage (RUSAGE_SELF, &ru) != 0) - return 0; - - return timeval_to_secs (&ru.ru_utime) + timeval_to_secs (&ru.ru_stime); -#else - return 0; /* FIXME */ -#endif -} - -/* - * return elapsed time (wall time) in seconds - */ -double -get_elapsed_time (void) -{ - struct timeval tv; - if (gettimeofday (&tv, 0) != 0) - return 0; - - return timeval_to_secs (&tv); -} - diff --git a/usrp/host/apps/time_stuff.h b/usrp/host/apps/time_stuff.h deleted file mode 100644 index 74b79f388..000000000 --- a/usrp/host/apps/time_stuff.h +++ /dev/null @@ -1,48 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 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 _TIME_STUFF_H_ -#define _TIME_STUFF_H_ - - - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * return USER + SYS cpu time in seconds - */ -double get_cpu_usage (void); - -/* - * return elapsed time in seconds - */ -double get_elapsed_time (void); - - -#ifdef __cplusplus -} -#endif - - -#endif /* _TIME_STUFF_H_ */ diff --git a/usrp/host/apps/usrp_cal_dc_offset.cc b/usrp/host/apps/usrp_cal_dc_offset.cc deleted file mode 100644 index 5f708d672..000000000 --- a/usrp/host/apps/usrp_cal_dc_offset.cc +++ /dev/null @@ -1,239 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,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 <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <getopt.h> -#include <assert.h> -#include <math.h> -#include <boost/scoped_ptr.hpp> -#include <usrp/usrp_local_sighandler.h> -#include <usrp/usrp_standard.h> -#include <usrp/usrp_bytesex.h> - -char *prog_name; - - - - -static void -run_cal(usrp_standard_rx_sptr u, int which_side, int decim, bool verbose_p) -{ - static const int BUFSIZE = u->block_size(); - static const int N = BUFSIZE/sizeof (short); - short buf[N]; - bool cal_done = false; - bool overrun; - int noverruns = 0; - - static const double K = 1e-4; - long integrator[2]; - int offset[2]; - - integrator[0] = 0; - integrator[1] = 0; - offset[0] = 0; - offset[1] = 0; - - u->start(); // start data xfers - - while(!cal_done){ - int ret = u->read (buf, sizeof (buf), &overrun); - if (ret != (int) sizeof (buf)){ - fprintf (stderr, "usrp_cal_dc_offset: error, ret = %d\n", ret); - continue; - } - if (overrun){ - fprintf (stderr, "O"); - noverruns++; - } - else { - // fputc('.', stderr); - } - - static const int MAX = (1L << 30); // 1G - - for (int i = 0; i < N/2; i++){ - for (int n = 0; n < 2; n++){ - integrator[n] = integrator[n] + buf[2*i + n]; - if (integrator[n] > MAX) - integrator[n] = MAX; - else if (integrator[n] < -MAX) - integrator[n] = -MAX; - } - } - -#if 1 - for (int n = 0; n < 2; n++){ - offset[n] = (int) rint(integrator[n] * K); - if (offset[n] > 32767) - offset[n] = 32767; - else if (offset[n] < -32767) - offset[n] = -32767; - u->set_adc_offset(which_side * 2 + n, offset[n]); - } -#else - offset[0] = (int) rint(integrator[0] * K); - if (offset[0] > 32767) - offset[0] = 32767; - else if (offset[0] < -32767) - offset[0] = -32767; - u->set_adc_offset(which_side * 2 + 0, offset[0]); - u->set_adc_offset(which_side * 2 + 1, offset[0]); -#endif - - - printf ("%9ld : %6d\t\t%9ld : %6d\n", - integrator[0], offset[0], integrator[1], offset[1]); - } - - u->stop(); -} - - -static void -set_progname (char *path) -{ - char *p = strrchr (path, '/'); - if (p != 0) - prog_name = p+1; - else - prog_name = path; -} - -static void -usage () -{ - fprintf(stderr, "usage: %s [-v] [-w which_side] [-D decim] [-c ddc_freq] [-g gain]\n", prog_name); - fprintf(stderr, " [-S fusb_block_size] [-N fusb_nblocks]\n"); - exit (1); -} - -static void -die (const char *msg) -{ - fprintf (stderr, "die: %s: %s\n", prog_name, msg); - exit (1); -} - -int -main (int argc, char **argv) -{ - int ch; - int decim = 128; // 500 kS/sec - bool verbose_p = false; - int which_board = 0; - int which_side = 0; - double ddc_freq = 0; - int fusb_block_size = 1024; - int fusb_nblocks = 4; - double pga_gain = 0.0; - - set_progname(argv[0]); - - while ((ch = getopt (argc, argv, "vw:D:c:S:N:g:")) != EOF){ - switch (ch){ - - case 'w': - which_side = strtol (optarg, 0, 0); - if (which_side < 0 || which_side > 1) - usage(); - break; - - case 'D': - decim = strtol (optarg, 0, 0); - if (decim < 1) - usage(); - break; - - case 'c': - ddc_freq = strtod (optarg, 0); - break; - - case 'v': - verbose_p = true; - break; - - case 'S': - fusb_block_size = strtol(optarg, 0, 0); - break; - - case 'N': - fusb_nblocks = strtol(optarg, 0, 0); - break; - - case 'g': - pga_gain = strtod (optarg, 0); - break; - - default: - usage (); - } - } - - int nchannels = 1; - int mode = usrp_standard_rx::FPGA_MODE_NORMAL; - int mux; - - if (which_side == 0) - mux = 0x00000010; - else - mux = 0x00000032; - -#ifdef SIGINT - usrp_local_sighandler sigint (SIGINT, usrp_local_sighandler::throw_signal); -#endif -#ifdef SIGQUIT - usrp_local_sighandler sigquit (SIGQUIT, usrp_local_sighandler::throw_signal); -#endif - - usrp_standard_rx_sptr urx = - usrp_standard_rx::make(which_board, decim, - nchannels, mux, mode, - fusb_block_size, fusb_nblocks); - if (!urx) - die("usrp_standard_rx::make"); - - try { - - if (!urx->set_rx_freq(0, ddc_freq)) - die("urx->set_rx_freq"); - - urx->set_pga(2 * which_side + 0, pga_gain); - urx->set_pga(2 * which_side + 1, pga_gain); - - run_cal(urx, which_side, decim, verbose_p); - } - catch (usrp_signal &sig){ - fprintf (stderr, "usrp_cal_dc_offset: caught %s\n", sig.name().c_str()); - } - catch(...){ - fprintf (stderr, "usrp_cal_dc_offset: caught something\n"); - } -} - diff --git a/usrp/host/apps/usrper.cc b/usrp/host/apps/usrper.cc deleted file mode 100644 index 593cd7921..000000000 --- a/usrp/host/apps/usrper.cc +++ /dev/null @@ -1,356 +0,0 @@ -/* -*- c++ -*- */ -/* - * USRP - Universal Software Radio Peripheral - * - * Copyright (C) 2003,2004,2009 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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, Boston, MA 02110-1301 USA - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <getopt.h> -#include <assert.h> -#include <errno.h> - -#include "usrp/usrp_prims.h" -#include "usrp_spi_defs.h" - -char *prog_name; - -static void -set_progname (char *path) -{ - char *p = strrchr (path, '/'); - if (p != 0) - prog_name = p+1; - else - prog_name = path; -} - -static void -usage () -{ - fprintf (stderr, "usage: \n"); - fprintf (stderr, " %s [-v] [-w <which_board>] [-x] ...\n", prog_name); - fprintf (stderr, " %s load_standard_bits\n", prog_name); - fprintf (stderr, " %s load_firmware <file.ihx>\n", prog_name); - fprintf (stderr, " %s load_fpga <file.rbf>\n", prog_name); - fprintf (stderr, " %s write_fpga_reg <reg8> <value32>\n", prog_name); - fprintf (stderr, " %s set_fpga_reset {on|off}\n", prog_name); - fprintf (stderr, " %s set_fpga_tx_enable {on|off}\n", prog_name); - fprintf (stderr, " %s set_fpga_rx_enable {on|off}\n", prog_name); - fprintf (stderr, " ----- diagnostic routines -----\n"); - fprintf (stderr, " %s led0 {on|off}\n", prog_name); - fprintf (stderr, " %s led1 {on|off}\n", prog_name); - fprintf (stderr, " %s set_hash0 <hex-string>\n", prog_name); - fprintf (stderr, " %s get_hash0\n", prog_name); - fprintf (stderr, " %s i2c_read i2c_addr len\n", prog_name); - fprintf (stderr, " %s i2c_write i2c_addr <hex-string>\n", prog_name); - fprintf (stderr, " %s 9862a_write regno value\n", prog_name); - fprintf (stderr, " %s 9862b_write regno value\n", prog_name); - fprintf (stderr, " %s 9862a_read regno\n", prog_name); - fprintf (stderr, " %s 9862b_read regno\n", prog_name); - exit (1); -} - -#if 0 -static void -die (const char *msg) -{ - fprintf (stderr, "%s (die): %s\n", prog_name, msg); - exit (1); -} -#endif - -static int -hexval (char ch) -{ - if ('0' <= ch && ch <= '9') - return ch - '0'; - - if ('a' <= ch && ch <= 'f') - return ch - 'a' + 10; - - if ('A' <= ch && ch <= 'F') - return ch - 'A' + 10; - - return -1; -} - -static unsigned char * -hex_string_to_binary (const char *string, int *lenptr) -{ - int sl = strlen (string); - if (sl & 0x01){ - fprintf (stderr, "%s: odd number of chars in <hex-string>\n", prog_name); - return 0; - } - - int len = sl / 2; - *lenptr = len; - unsigned char *buf = new unsigned char [len]; - - for (int i = 0; i < len; i++){ - int hi = hexval (string[2 * i]); - int lo = hexval (string[2 * i + 1]); - if (hi < 0 || lo < 0){ - fprintf (stderr, "%s: invalid char in <hex-string>\n", prog_name); - delete [] buf; - return 0; - } - buf[i] = (hi << 4) | lo; - } - return buf; -} - -static void -print_hex (FILE *fp, unsigned char *buf, int len) -{ - for (int i = 0; i < len; i++){ - fprintf (fp, "%02x", buf[i]); - } - fprintf (fp, "\n"); -} - -static void -chk_result (bool ok) -{ - if (!ok){ - fprintf (stderr, "%s: failed\n", prog_name); - exit (1); - } -} - -static bool -get_on_off (const char *s) -{ - if (strcmp (s, "on") == 0) - return true; - - if (strcmp (s, "off") == 0) - return false; - - usage (); // no return - return false; -} - - -int -main (int argc, char **argv) -{ - int ch; - bool verbose = false; - int which_board = 0; - bool fx2_ok_p = false; - - set_progname (argv[0]); - - while ((ch = getopt (argc, argv, "vw:x")) != EOF){ - switch (ch){ - - case 'v': - verbose = true; - break; - - case 'w': - which_board = strtol (optarg, 0, 0); - break; - - case 'x': - fx2_ok_p = true; - break; - - default: - usage (); - } - } - - int nopts = argc - optind; - - if (nopts < 1) - usage (); - - const char *cmd = argv[optind++]; - nopts--; - - usrp_one_time_init (); - - - libusb_device *udev = usrp_find_device (which_board, fx2_ok_p); - if (udev == 0){ - fprintf (stderr, "%s: failed to find usrp[%d]\n", prog_name, which_board); - exit (1); - } - - if (usrp_unconfigured_usrp_p (udev)){ - fprintf (stderr, "%s: found unconfigured usrp; needs firmware.\n", prog_name); - } - - if (usrp_fx2_p (udev)){ - fprintf (stderr, "%s: found unconfigured FX2; needs firmware.\n", prog_name); - } - - libusb_device_handle *udh = usrp_open_cmd_interface (udev); - if (udh == 0){ - fprintf (stderr, "%s: failed to open_cmd_interface\n", prog_name); - exit (1); - } - -#define CHKARGS(n) if (nopts != n) usage (); else - - if (strcmp (cmd, "led0") == 0){ - CHKARGS (1); - bool on = get_on_off (argv[optind]); - chk_result (usrp_set_led (udh, 0, on)); - } - else if (strcmp (cmd, "led1") == 0){ - CHKARGS (1); - bool on = get_on_off (argv[optind]); - chk_result (usrp_set_led (udh, 1, on)); - } - else if (strcmp (cmd, "led2") == 0){ - CHKARGS (1); - bool on = get_on_off (argv[optind]); - chk_result (usrp_set_led (udh, 2, on)); - } - else if (strcmp (cmd, "set_hash0") == 0){ - CHKARGS (1); - char *p = argv[optind]; - unsigned char buf[16]; - - memset (buf, ' ', 16); - for (int i = 0; i < 16 && *p; i++) - buf[i] = *p++; - - chk_result (usrp_set_hash (udh, 0, buf)); - } - else if (strcmp (cmd, "get_hash0") == 0){ - CHKARGS (0); - unsigned char buf[17]; - memset (buf, 0, 17); - bool r = usrp_get_hash (udh, 0, buf); - if (r) - printf ("hash: %s\n", buf); - chk_result (r); - } - else if (strcmp (cmd, "load_fpga") == 0){ - CHKARGS (1); - char *filename = argv[optind]; - chk_result (usrp_load_fpga (udh, filename, true)); - } - else if (strcmp (cmd, "load_firmware") == 0){ - CHKARGS (1); - char *filename = argv[optind]; - chk_result (usrp_load_firmware (udh, filename, true)); - } - else if (strcmp (cmd, "write_fpga_reg") == 0){ - CHKARGS (2); - chk_result (usrp_write_fpga_reg (udh, strtoul (argv[optind], 0, 0), - strtoul(argv[optind+1], 0, 0))); - } - else if (strcmp (cmd, "set_fpga_reset") == 0){ - CHKARGS (1); - chk_result (usrp_set_fpga_reset (udh, get_on_off (argv[optind]))); - } - else if (strcmp (cmd, "set_fpga_tx_enable") == 0){ - CHKARGS (1); - chk_result (usrp_set_fpga_tx_enable (udh, get_on_off (argv[optind]))); - } - else if (strcmp (cmd, "set_fpga_rx_enable") == 0){ - CHKARGS (1); - chk_result (usrp_set_fpga_rx_enable (udh, get_on_off (argv[optind]))); - } - else if (strcmp (cmd, "load_standard_bits") == 0){ - CHKARGS (0); - usrp_close_interface (udh); - udh = 0; - chk_result (usrp_load_standard_bits (which_board, true)); - } - else if (strcmp (cmd, "i2c_read") == 0){ - CHKARGS (2); - int i2c_addr = strtol (argv[optind], 0, 0); - int len = strtol (argv[optind + 1], 0, 0); - if (len < 0) - chk_result (0); - - unsigned char *buf = new unsigned char [len]; - bool result = usrp_i2c_read (udh, i2c_addr, buf, len); - if (!result){ - chk_result (0); - } - print_hex (stdout, buf, len); - } - else if (strcmp (cmd, "i2c_write") == 0){ - CHKARGS (2); - int i2c_addr = strtol (argv[optind], 0, 0); - int len = 0; - char *hex_string = argv[optind + 1]; - unsigned char *buf = hex_string_to_binary (hex_string, &len); - if (buf == 0) - chk_result (0); - - bool result = usrp_i2c_write (udh, i2c_addr, buf, len); - chk_result (result); - } - else if (strcmp (cmd, "9862a_write") == 0){ - CHKARGS (2); - int regno = strtol (argv[optind], 0, 0); - int value = strtol (argv[optind+1], 0, 0); - chk_result (usrp_9862_write (udh, 0, regno, value)); - } - else if (strcmp (cmd, "9862b_write") == 0){ - CHKARGS (2); - int regno = strtol (argv[optind], 0, 0); - int value = strtol (argv[optind+1], 0, 0); - chk_result (usrp_9862_write (udh, 1, regno, value)); - } - else if (strcmp (cmd, "9862a_read") == 0){ - CHKARGS (1); - int regno = strtol (argv[optind], 0, 0); - unsigned char value; - bool result = usrp_9862_read (udh, 0, regno, &value); - if (!result){ - chk_result (0); - } - fprintf (stdout, "reg[%d] = 0x%02x\n", regno, value); - } - else if (strcmp (cmd, "9862b_read") == 0){ - CHKARGS (1); - int regno = strtol (argv[optind], 0, 0); - unsigned char value; - bool result = usrp_9862_read (udh, 1, regno, &value); - if (!result){ - chk_result (0); - } - fprintf (stdout, "reg[%d] = 0x%02x\n", regno, value); - } - else { - usage (); - } - - if (udh){ - usrp_close_interface (udh); - udh = 0; - } - - return 0; -} diff --git a/usrp/host/include/.gitignore b/usrp/host/include/.gitignore deleted file mode 100644 index b336cc7ce..000000000 --- a/usrp/host/include/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/Makefile -/Makefile.in diff --git a/usrp/host/include/Makefile.am b/usrp/host/include/Makefile.am deleted file mode 100644 index 5de5fe58e..000000000 --- a/usrp/host/include/Makefile.am +++ /dev/null @@ -1,23 +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. -# - -SUBDIRS = usrp - diff --git a/usrp/host/include/usrp/.gitignore b/usrp/host/include/usrp/.gitignore deleted file mode 100644 index 0f068a1f3..000000000 --- a/usrp/host/include/usrp/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -/Makefile -/Makefile.in - -# Generated files -/libusb_types.h -/usrp_dbid.h diff --git a/usrp/host/include/usrp/Makefile.am b/usrp/host/include/usrp/Makefile.am deleted file mode 100644 index 19504313b..000000000 --- a/usrp/host/include/usrp/Makefile.am +++ /dev/null @@ -1,54 +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. -# - -include $(top_srcdir)/Makefile.common - -usrpincludedir = $(includedir)/usrp - -usrpinclude_HEADERS = \ - db_base.h \ - db_basic.h \ - db_bitshark_rx.h \ - db_dbs_rx.h \ - db_dtt754.h \ - db_dtt768.h \ - db_flexrf.h \ - db_flexrf_mimo.h \ - db_tv_rx.h \ - db_tv_rx_mimo.h \ - db_wbxng.h \ - db_xcvr2450.h \ - libusb_types.h \ - usrp_basic.h \ - usrp_bytesex.h \ - usrp_dbid.h \ - usrp_local_sighandler.h \ - usrp_prims.h \ - usrp_slots.h \ - usrp_standard.h \ - usrp_subdev_spec.h \ - usrp_tune_result.h - -EXTRA_DIST += \ - libusb_types.h.in - -swiginclude_HEADERS = \ - db_base.i diff --git a/usrp/host/include/usrp/db_base.h b/usrp/host/include/usrp/db_base.h deleted file mode 100644 index 35470891a..000000000 --- a/usrp/host/include/usrp/db_base.h +++ /dev/null @@ -1,119 +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 asversion 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_DB_BASE_H -#define INCLUDED_DB_BASE_H - -#include <string> -#include <boost/shared_ptr.hpp> -#include <boost/weak_ptr.hpp> -#include <iosfwd> - -class db_base; -typedef boost::shared_ptr<db_base> db_base_sptr; - -class usrp_basic; -typedef boost::shared_ptr<usrp_basic> usrp_basic_sptr; - -struct freq_result_t -{ - bool ok; - double baseband_freq; -}; - -/******************************************************************************/ - -/*! - * \brief Abstract base class for all USRP daughterboards - * \ingroup usrp - */ -class db_base -{ - protected: - bool d_is_shutdown; - usrp_basic *d_raw_usrp; - int d_which; - double d_lo_offset; - - void _enable_refclk(bool enable); - virtual double _refclk_freq(); - virtual int _refclk_divisor(); - - usrp_basic *usrp(){ - return d_raw_usrp; - } - - public: - db_base(boost::shared_ptr<usrp_basic> usrp, int which); - virtual ~db_base(); - - int dbid(); - std::string name(); - std::string side_and_name(); - int which() { return d_which; } - - bool bypass_adc_buffers(bool bypass); - bool set_atr_mask(int v); - bool set_atr_txval(int v); - bool set_atr_rxval(int v); - bool set_atr_tx_delay(int v); - bool set_atr_rx_delay(int v); - bool set_lo_offset(double offset); - double lo_offset() { return d_lo_offset; } - - - //////////////////////////////////////////////////////// - // derived classes should override the following methods - -protected: - friend class usrp_basic; - - /*! - * Called to shutdown daughterboard. Called from dtor and usrp_basic dtor. - * - * N.B., any class that overrides shutdown MUST call shutdown in its destructor. - */ - virtual void shutdown(); - - -public: - virtual float gain_min() = 0; - virtual float gain_max() = 0; - virtual float gain_db_per_step() = 0; - virtual double freq_min() = 0; - virtual double freq_max() = 0; - virtual struct freq_result_t set_freq(double target_freq) = 0; - virtual bool set_gain(float gain) = 0; - virtual bool is_quadrature() = 0; - virtual bool i_and_q_swapped(); - virtual bool spectrum_inverted(); - virtual bool set_enable(bool on); - virtual bool set_auto_tr(bool on); - virtual bool select_rx_antenna(int which_antenna); - virtual bool select_rx_antenna(const std::string &which_antenna); - virtual bool set_bw(float bw); -}; - - -std::ostream & operator<<(std::ostream &os, db_base &x); - -#endif /* INCLUDED_DB_BASE_H */ diff --git a/usrp/host/include/usrp/db_base.i b/usrp/host/include/usrp/db_base.i deleted file mode 100644 index fdabd4f99..000000000 --- a/usrp/host/include/usrp/db_base.i +++ /dev/null @@ -1,103 +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 <usrp/db_base.h> -%} - -%include <gr_shared_ptr.i> - -class usrp_tune_result -{ -public: - usrp_tune_result(double baseband=0, double dxc=0, - double residual=0, bool inv=0); - ~usrp_tune_result(); - - double baseband_freq; - double dxc_freq; - double residual_freq; - bool inverted; -}; - -struct freq_result_t -{ - bool ok; - double baseband_freq; -}; - -class db_base -{ - private: - db_base(boost::shared_ptr<usrp_basic> usrp, int which); - - public: - virtual ~db_base(); - - int dbid(); - std::string name(); - std::string side_and_name(); - int which() { return d_which; } - - bool bypass_adc_buffers(bool bypass); - bool set_atr_mask(int v); - bool set_atr_txval(int v); - bool set_atr_rxval(int v); - bool set_atr_tx_delay(int v); - bool set_atr_rx_delay(int v); - bool set_lo_offset(double offset); - double lo_offset() { return d_lo_offset; } - - virtual float gain_min() = 0; - virtual float gain_max() = 0; - virtual float gain_db_per_step() = 0; - virtual double freq_min() = 0; - virtual double freq_max() = 0; - virtual struct freq_result_t set_freq(double target_freq) = 0; - virtual bool set_gain(float gain) = 0; - virtual bool is_quadrature() = 0; - virtual bool i_and_q_swapped(); - virtual bool spectrum_inverted(); - virtual bool set_enable(bool on); - virtual bool set_auto_tr(bool on); - virtual bool select_rx_antenna(int which_antenna); - virtual bool select_rx_antenna(const std::string &antenna); - virtual bool set_bw(float bw); -}; - -// Create templates for db's, vectors of db's, and vector of vectors of db's -typedef boost::shared_ptr<db_base> db_base_sptr; -%template(db_base_sptr) boost::shared_ptr<db_base>; -%template(db_base_sptr_vector) std::vector<db_base_sptr>; -%template(db_base_sptr_vector_vector) std::vector<std::vector<db_base_sptr> >; - -#ifdef SWIGPYTHON -// Set better class name in Python -// Enable freq_range and gain_range from public methods of class not implemented in C++ -// And create a dummy wrapper for backwards compatability with some of the example code -%pythoncode %{ - db_base_sptr.__repr__ = lambda self: "<db_base::%s>" % (self.name(),) - db_base_sptr.freq_range = lambda self: (self.freq_min(), self.freq_max(), 1) - db_base_sptr.gain_range = lambda self: (self.gain_min(), self.gain_max(), self.gain_db_per_step()) -%} -#endif diff --git a/usrp/host/include/usrp/db_basic.h b/usrp/host/include/usrp/db_basic.h deleted file mode 100644 index 7f81733f4..000000000 --- a/usrp/host/include/usrp/db_basic.h +++ /dev/null @@ -1,99 +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 asversion 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 DB_BASIC_H -#define DB_BASIC_H - -#include <usrp/db_base.h> - - -/******************************************************************************/ - - -class db_basic_tx : public db_base -{ -public: - db_basic_tx(usrp_basic_sptr usrp, int which); - ~db_basic_tx(); - - float gain_min(); - float gain_max(); - float gain_db_per_step(); - double freq_min(); - double freq_max(); - struct freq_result_t set_freq(double target_freq); - bool set_gain(float gain); - bool is_quadrature(); -}; - - -/******************************************************************************/ - - -class db_basic_rx : public db_base -{ - public: - db_basic_rx(usrp_basic_sptr usrp, int which, int subdev); - ~db_basic_rx(); - - float gain_min(); - float gain_max(); - float gain_db_per_step(); - double freq_min(); - double freq_max(); - struct freq_result_t set_freq(double target_freq); - bool set_gain(float gain); - bool is_quadrature(); - -private: - int d_subdev; -}; - - -/******************************************************************************/ - - -class db_lf_rx : public db_basic_rx -{ - public: - db_lf_rx(usrp_basic_sptr usrp, int which, int subdev); - ~db_lf_rx(); - - double freq_min(); - double freq_max(); -}; - - -/******************************************************************************/ - - -class db_lf_tx : public db_basic_tx -{ - public: - db_lf_tx(usrp_basic_sptr usrp, int which); - ~db_lf_tx(); - - double freq_min(); - double freq_max(); -}; - - -#endif diff --git a/usrp/host/include/usrp/db_bitshark_rx.h b/usrp/host/include/usrp/db_bitshark_rx.h deleted file mode 100644 index f81877d28..000000000 --- a/usrp/host/include/usrp/db_bitshark_rx.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- c++ -*- */ -// -// 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 asversion 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 DB_BITSHARK_RX_H -#define DB_BITSHARK_RX_H - -#include <usrp/db_base.h> -#include <vector> -#include <stdint.h> - -class db_bitshark_rx : public db_base -{ -private: - int d_i2c_addr; - // Internal function for interfacing to the card - void _set_pga(int pga_gain); - -protected: - void shutdown(); - -public: - db_bitshark_rx(usrp_basic_sptr usrp, int which); - ~db_bitshark_rx(); - - float gain_min(); - float gain_max(); - float gain_db_per_step(); - double freq_min(); - double freq_max(); - struct freq_result_t set_freq(double freq); - bool set_gain(float gain); - bool set_bw(float bw); - bool set_clock_scheme(uint8_t clock_scheme, uint32_t ref_clock_freq); - bool is_quadrature(); - bool i_and_q_swapped(); -}; - -#endif diff --git a/usrp/host/include/usrp/db_dbs_rx.h b/usrp/host/include/usrp/db_dbs_rx.h deleted file mode 100644 index 7f869637d..000000000 --- a/usrp/host/include/usrp/db_dbs_rx.h +++ /dev/null @@ -1,83 +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 asversion 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 DB_DBS_RX_H -#define DB_DBS_RX_H - -#include <usrp/db_base.h> -#include <vector> - -#if 0 -struct bw_t { - int m; - int fdac; - float div; -}; -#endif - -class db_dbs_rx : public db_base -{ -private: - int d_osc, d_cp, d_n, d_div2, d_r, d_r_int; - int d_fdac, d_m, d_dl, d_ade, d_adl, d_gc1, d_gc2, d_diag; - int d_i2c_addr; - - // Internal gain functions - void _write_reg(int regno, int v); - void _write_regs(int starting_regno, const std::vector<int> &vals); - std::vector<int> _read_status(); - void _send_reg(int regno); - void _set_m(int m); - void _set_fdac(int fdac); - void _set_dl(int dl); - void _set_gc2(int gc2); - void _set_gc1(int gc1); - void _set_pga(int pga_gain); - - // Internal frequency function - void _set_osc(int osc); - void _set_cp(int cp); - void _set_n(int n); - void _set_div2(int div2); - void _set_r(int r); - void _set_ade(int ade); - - int _refclk_divisor(); - -protected: - void shutdown(); - -public: - db_dbs_rx(usrp_basic_sptr usrp, int which); - ~db_dbs_rx(); - - float gain_min(); - float gain_max(); - float gain_db_per_step(); - double freq_min(); - double freq_max(); - struct freq_result_t set_freq(double freq); - bool set_gain(float gain); - bool is_quadrature(); - bool set_bw(float bw); -}; - -#endif diff --git a/usrp/host/include/usrp/db_dtt754.h b/usrp/host/include/usrp/db_dtt754.h deleted file mode 100644 index 4fb952824..000000000 --- a/usrp/host/include/usrp/db_dtt754.h +++ /dev/null @@ -1,57 +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 asversion 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 DB_DTT754_H -#define DB_DTT754_H - -#include <usrp/db_base.h> -#include <boost/shared_ptr.hpp> - -class db_dtt754 : public db_base -{ -public: - db_dtt754(usrp_basic_sptr usrp, int which); - ~db_dtt754(); - - float gain_min(); - float gain_max(); - float gain_db_per_step(); - bool set_gain(float gain); - - double freq_min(); - double freq_max(); - struct freq_result_t set_freq(double target_freq); - - bool is_quadrature(); - bool spectrum_inverted(); - bool set_bw(float bw); - -private: - void _set_rfagc(float gain); - void _set_ifagc(float gain); - void _set_pga(float pga_gain); - - int d_i2c_addr; - float d_bw, d_freq, d_IF, d_f_ref; - bool d_inverted; -}; - -#endif diff --git a/usrp/host/include/usrp/db_dtt768.h b/usrp/host/include/usrp/db_dtt768.h deleted file mode 100644 index 78e157e79..000000000 --- a/usrp/host/include/usrp/db_dtt768.h +++ /dev/null @@ -1,57 +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 asversion 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 DB_DTT768_H -#define DB_DTT768_H - -#include <usrp/db_base.h> -#include <boost/shared_ptr.hpp> - -class db_dtt768 : public db_base -{ -public: - db_dtt768(usrp_basic_sptr usrp, int which); - ~db_dtt768(); - - float gain_min(); - float gain_max(); - float gain_db_per_step(); - bool set_gain(float gain); - - double freq_min(); - double freq_max(); - struct freq_result_t set_freq(double target_freq); - - bool is_quadrature(); - bool spectrum_inverted(); - bool set_bw(float bw); - -private: - void _set_rfagc(float gain); - void _set_ifagc(float gain); - void _set_pga(float pga_gain); - - int d_i2c_addr; - float d_bw, d_freq, d_IF, d_f_ref; - bool d_inverted; -}; - -#endif diff --git a/usrp/host/include/usrp/db_flexrf.h b/usrp/host/include/usrp/db_flexrf.h deleted file mode 100644 index 70a55514e..000000000 --- a/usrp/host/include/usrp/db_flexrf.h +++ /dev/null @@ -1,394 +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 asversion 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 DB_FLEXRF_H -#define DB_FLEXRF_H - -#include <usrp/db_base.h> -#include <cmath> - -//debug_using_gui = true // Must be set to True or False -#define debug_using_gui false // Must be set to True or False - -class _AD4360_common; - -class flexrf_base : public db_base -{ -public: - flexrf_base(usrp_basic_sptr usrp, int which, int _power_on=0); - ~flexrf_base(); - - struct freq_result_t set_freq(double freq); - - bool is_quadrature(); - double freq_min(); - double freq_max(); - -protected: - void _write_all(int R, int control, int N); - void _write_control(int control); - void _write_R(int R); - void _write_N(int N); - void _write_it(int v); - bool _lock_detect(); - - virtual bool _compute_regs(double freq, int &retR, int &retcontrol, - int &retN, double &retfreq); - int _compute_control_reg(); - int _refclk_divisor(); - - bool _set_pga(float pga_gain); - - int power_on() { return d_power_on; } - int power_off() { return 0; } - - bool d_first; - int d_spi_format; - int d_spi_enable; - int d_power_on; - int d_PD; - - _AD4360_common *d_common; -}; - -// ---------------------------------------------------------------- - -class flexrf_base_tx : public flexrf_base -{ -protected: - void shutdown(); - -public: - flexrf_base_tx(usrp_basic_sptr usrp, int which, int _power_on=0); - ~flexrf_base_tx(); - - // All RFX tx d'boards have fixed gain - float gain_min(); - float gain_max(); - float gain_db_per_step(); - - bool set_auto_tr(bool on); - bool set_enable(bool on); - bool set_gain(float gain); -}; - -class flexrf_base_rx : public flexrf_base -{ -protected: - void shutdown(); - -public: - flexrf_base_rx(usrp_basic_sptr usrp, int which, int _power_on=0); - ~flexrf_base_rx(); - - bool set_auto_tr(bool on); - bool select_rx_antenna(int which_antenna); - bool select_rx_antenna(const std::string &which_antenna); - bool set_gain(float gain); - -}; - -// ---------------------------------------------------------------- - - -class _AD4360_common -{ -public: - _AD4360_common(); - virtual ~_AD4360_common(); - - virtual double freq_min() = 0; - virtual double freq_max() = 0; - - bool _compute_regs(double refclk_freq, double freq, int &retR, - int &retcontrol, int &retN, double &retfreq); - int _compute_control_reg(); - virtual int _refclk_divisor(); - int _prescaler(); - - void R_DIV(int div) { d_R_DIV = div; } - -protected: - int d_R_RSV, d_BSC, d_TEST, d_LDP, d_ABP, d_N_RSV, d_PL, d_MTLD; - int d_CPG, d_CP3S, d_PDP, d_MUXOUT, d_CR, d_PC; - - // FIXME: d_PD might cause conflict from flexrf_base - int d_A_DIV, d_B_DIV, d_R_DIV, d_P, d_PD, d_CP2, d_CP1, d_DIVSEL; - int d_DIV2, d_CPGAIN, d_freq_mult; - -}; - -//---------------------------------------------------------------------- - -class _2200_common : public _AD4360_common -{ - public: - _2200_common(); - ~_2200_common() {} - - double freq_min(); - double freq_max(); -}; - -//---------------------------------------------------------------------- - -class _2400_common : public _AD4360_common -{ - public: - _2400_common(); - ~_2400_common() {} - - double freq_min(); - double freq_max(); -}; - -//---------------------------------------------------------------------- - -class _1200_common : public _AD4360_common -{ -public: - _1200_common(); - ~_1200_common() {} - - double freq_min(); - double freq_max(); -}; - -//------------------------------------------------------------------------- - -class _1800_common : public _AD4360_common -{ - public: - _1800_common(); - ~_1800_common() {} - - double freq_min(); - double freq_max(); -}; - -//------------------------------------------------------------------------- - -class _900_common : public _AD4360_common -{ -public: - _900_common(); - ~_900_common() {} - - double freq_min(); - double freq_max(); -}; - -//------------------------------------------------------------------------- - -class _400_common : public _AD4360_common -{ -public: - _400_common(); - ~_400_common() {} - - double freq_min(); - double freq_max(); -}; - -class _400_tx : public _400_common -{ -public: - _400_tx(); - ~_400_tx() {} -}; - -class _400_rx : public _400_common -{ -public: - _400_rx(); - ~_400_rx() {} -}; - -//------------------------------------------------------------ - -class db_flexrf_2200_tx : public flexrf_base_tx -{ - public: - db_flexrf_2200_tx(usrp_basic_sptr usrp, int which); - ~db_flexrf_2200_tx(); - - // Wrapper calls to d_common functions - bool _compute_regs(double freq, int &retR, int &retcontrol, - int &retN, double &retfreq); -}; - -class db_flexrf_2200_rx : public flexrf_base_rx -{ -public: - db_flexrf_2200_rx(usrp_basic_sptr usrp, int which); - ~db_flexrf_2200_rx(); - - float gain_min(); - float gain_max(); - float gain_db_per_step(); - bool i_and_q_swapped(); - - bool _compute_regs(double freq, int &retR, int &retcontrol, - int &retN, double &retfreq); -}; - -//------------------------------------------------------------ - -class db_flexrf_2400_tx : public flexrf_base_tx -{ - public: - db_flexrf_2400_tx(usrp_basic_sptr usrp, int which); - ~db_flexrf_2400_tx(); - - // Wrapper calls to d_common functions - bool _compute_regs(double freq, int &retR, int &retcontrol, - int &retN, double &retfreq); -}; - -class db_flexrf_2400_rx : public flexrf_base_rx -{ -public: - db_flexrf_2400_rx(usrp_basic_sptr usrp, int which); - ~db_flexrf_2400_rx(); - - float gain_min(); - float gain_max(); - float gain_db_per_step(); - bool i_and_q_swapped(); - - bool _compute_regs(double freq, int &retR, int &retcontrol, - int &retN, double &retfreq); -}; - -//------------------------------------------------------------ - -class db_flexrf_1200_tx : public flexrf_base_tx -{ -public: - db_flexrf_1200_tx(usrp_basic_sptr usrp, int which); - ~db_flexrf_1200_tx(); - - // Wrapper calls to d_common functions - bool _compute_regs(double freq, int &retR, int &retcontrol, - int &retN, double &retfreq); -}; - -class db_flexrf_1200_rx : public flexrf_base_rx -{ -public: - db_flexrf_1200_rx(usrp_basic_sptr usrp, int which); - ~db_flexrf_1200_rx(); - - float gain_min(); - float gain_max(); - float gain_db_per_step(); - bool i_and_q_swapped(); - - bool _compute_regs(double freq, int &retR, int &retcontrol, - int &retN, double &retfreq); -}; - -//------------------------------------------------------------ - -class db_flexrf_1800_tx : public flexrf_base_tx -{ - public: - db_flexrf_1800_tx(usrp_basic_sptr usrp, int which); - ~db_flexrf_1800_tx(); - - // Wrapper calls to d_common functions - bool _compute_regs(double freq, int &retR, int &retcontrol, - int &retN, double &retfreq); -}; - -class db_flexrf_1800_rx : public flexrf_base_rx -{ -public: - db_flexrf_1800_rx(usrp_basic_sptr usrp, int which); - ~db_flexrf_1800_rx(); - - float gain_min(); - float gain_max(); - float gain_db_per_step(); - bool i_and_q_swapped(); - - bool _compute_regs(double freq, int &retR, int &retcontrol, - int &retN, double &retfreq); -}; - -//------------------------------------------------------------ - -class db_flexrf_900_tx : public flexrf_base_tx -{ - public: - db_flexrf_900_tx(usrp_basic_sptr usrp, int which); - ~db_flexrf_900_tx(); - - // Wrapper calls to d_common functions - bool _compute_regs(double freq, int &retR, int &retcontrol, - int &retN, double &retfreq); -}; - -class db_flexrf_900_rx : public flexrf_base_rx -{ -public: - db_flexrf_900_rx(usrp_basic_sptr usrp, int which); - ~db_flexrf_900_rx(); - - float gain_min(); - float gain_max(); - float gain_db_per_step(); - bool i_and_q_swapped(); - - bool _compute_regs(double freq, int &retR, int &retcontrol, - int &retN, double &retfreq); -}; - - -//------------------------------------------------------------ - -class db_flexrf_400_tx : public flexrf_base_tx -{ - public: - db_flexrf_400_tx(usrp_basic_sptr usrp, int which); - ~db_flexrf_400_tx(); - - // Wrapper calls to d_common functions - bool _compute_regs(double freq, int &retR, int &retcontrol, - int &retN, double &retfreq); -}; - -class db_flexrf_400_rx : public flexrf_base_rx -{ -public: - db_flexrf_400_rx(usrp_basic_sptr usrp, int which); - ~db_flexrf_400_rx(); - - float gain_min(); - float gain_max(); - float gain_db_per_step(); - bool i_and_q_swapped(); - - bool _compute_regs(double freq, int &retR, int &retcontrol, - int &retN, double &retfreq); -}; - -#endif diff --git a/usrp/host/include/usrp/db_flexrf_mimo.h b/usrp/host/include/usrp/db_flexrf_mimo.h deleted file mode 100644 index 771f3b276..000000000 --- a/usrp/host/include/usrp/db_flexrf_mimo.h +++ /dev/null @@ -1,163 +0,0 @@ -/* - * 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 <usrp/db_flexrf.h> - -class db_flexrf_2400_tx_mimo_a : public db_flexrf_2400_tx -{ - public: - db_flexrf_2400_tx_mimo_a(usrp_basic_sptr usrp, int which); - int _refclk_divisor(); -}; - -class db_flexrf_2400_rx_mimo_a : public db_flexrf_2400_rx -{ - public: - db_flexrf_2400_rx_mimo_a(usrp_basic_sptr usrp, int which); - int _refclk_divisor(); -}; - -class db_flexrf_2400_tx_mimo_b : public db_flexrf_2400_tx -{ - public: - db_flexrf_2400_tx_mimo_b(usrp_basic_sptr usrp, int which); - int _refclk_divisor(); -}; - -class db_flexrf_2400_rx_mimo_b : public db_flexrf_2400_rx -{ - public: - db_flexrf_2400_rx_mimo_b(usrp_basic_sptr usrp, int which); - int _refclk_divisor(); -}; - - -class db_flexrf_1800_tx_mimo_a : public db_flexrf_1800_tx -{ - public: - db_flexrf_1800_tx_mimo_a(usrp_basic_sptr usrp, int which); - int _refclk_divisor(); -}; - -class db_flexrf_1800_rx_mimo_a : public db_flexrf_1800_rx -{ - public: - db_flexrf_1800_rx_mimo_a(usrp_basic_sptr usrp, int which); - int _refclk_divisor(); -}; - -class db_flexrf_1800_tx_mimo_b : public db_flexrf_1800_tx -{ - public: - db_flexrf_1800_tx_mimo_b(usrp_basic_sptr usrp, int which); - int _refclk_divisor(); -}; - -class db_flexrf_1800_rx_mimo_b : public db_flexrf_1800_rx -{ - public: - db_flexrf_1800_rx_mimo_b(usrp_basic_sptr usrp, int which); - int _refclk_divisor(); -}; - -class db_flexrf_1200_tx_mimo_a : public db_flexrf_1200_tx -{ - public: - db_flexrf_1200_tx_mimo_a(usrp_basic_sptr usrp, int which); - int _refclk_divisor(); -}; - -class db_flexrf_1200_rx_mimo_a : public db_flexrf_1200_rx -{ - public: - db_flexrf_1200_rx_mimo_a(usrp_basic_sptr usrp, int which); - int _refclk_divisor(); -}; - -class db_flexrf_1200_tx_mimo_b : public db_flexrf_1200_tx -{ - public: - db_flexrf_1200_tx_mimo_b(usrp_basic_sptr usrp, int which); - int _refclk_divisor(); -}; - -class db_flexrf_1200_rx_mimo_b : public db_flexrf_1200_rx -{ - public: - db_flexrf_1200_rx_mimo_b(usrp_basic_sptr usrp, int which); - int _refclk_divisor(); -}; - -class db_flexrf_900_tx_mimo_a : public db_flexrf_900_tx -{ - public: - db_flexrf_900_tx_mimo_a(usrp_basic_sptr usrp, int which); - int _refclk_divisor(); -}; - -class db_flexrf_900_rx_mimo_a : public db_flexrf_900_rx -{ - public: - db_flexrf_900_rx_mimo_a(usrp_basic_sptr usrp, int which); - int _refclk_divisor(); -}; - -class db_flexrf_900_tx_mimo_b : public db_flexrf_900_tx -{ - public: - db_flexrf_900_tx_mimo_b(usrp_basic_sptr usrp, int which); - int _refclk_divisor(); -}; - -class db_flexrf_900_rx_mimo_b : public db_flexrf_900_rx -{ - public: - db_flexrf_900_rx_mimo_b(usrp_basic_sptr usrp, int which); - int _refclk_divisor(); -}; - -class db_flexrf_400_tx_mimo_a : public db_flexrf_400_tx -{ - public: - db_flexrf_400_tx_mimo_a(usrp_basic_sptr usrp, int which); - int _refclk_divisor(); -}; - -class db_flexrf_400_rx_mimo_a : public db_flexrf_400_rx -{ - public: - db_flexrf_400_rx_mimo_a(usrp_basic_sptr usrp, int which); - int _refclk_divisor(); -}; - -class db_flexrf_400_tx_mimo_b : public db_flexrf_400_tx -{ - public: - db_flexrf_400_tx_mimo_b(usrp_basic_sptr usrp, int which); - int _refclk_divisor(); -}; - -class db_flexrf_400_rx_mimo_b : public db_flexrf_400_rx -{ - public: - db_flexrf_400_rx_mimo_b(usrp_basic_sptr usrp, int which); - int _refclk_divisor(); -}; diff --git a/usrp/host/include/usrp/db_tv_rx.h b/usrp/host/include/usrp/db_tv_rx.h deleted file mode 100644 index ee3ed2bf6..000000000 --- a/usrp/host/include/usrp/db_tv_rx.h +++ /dev/null @@ -1,56 +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 asversion 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 DB_TV_RX_H -#define DB_TV_RX_H - -#include <usrp/db_base.h> - -class db_tv_rx : public db_base -{ -private: - void _set_rfagc(float gain); - void _set_ifagc(float gain); - void _set_pga(float pga_gain); - - int d_i2c_addr; - double d_first_IF, d_second_IF; - int d_reference_divisor; - bool d_fast_tuning; - bool d_inverted; - -public: - db_tv_rx(usrp_basic_sptr usrp, int which, - double first_IF, double second_IF); - ~db_tv_rx(); - - float gain_min(); - float gain_max(); - float gain_db_per_step(); - double freq_min(); - double freq_max(); - struct freq_result_t set_freq(double target_freq); - bool set_gain(float gain); - bool is_quadrature(); - bool spectrum_inverted(); -}; - -#endif diff --git a/usrp/host/include/usrp/db_tv_rx_mimo.h b/usrp/host/include/usrp/db_tv_rx_mimo.h deleted file mode 100644 index 0a9bb486e..000000000 --- a/usrp/host/include/usrp/db_tv_rx_mimo.h +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -// -// 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 asversion 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 DB_TV_RX_MIMO_H -#define DB_TV_RX_MIMO_H - -#include <usrp/db_tv_rx.h> - -class db_tv_rx_mimo : public db_tv_rx -{ - public: - db_tv_rx_mimo(usrp_basic_sptr usrp, int which,double first_IF, double second_IF); - int _refclk_divisor(); -}; - -#endif diff --git a/usrp/host/include/usrp/db_wbxng.h b/usrp/host/include/usrp/db_wbxng.h deleted file mode 100644 index 9a7829278..000000000 --- a/usrp/host/include/usrp/db_wbxng.h +++ /dev/null @@ -1,98 +0,0 @@ -/* -*- c++ -*- */ -// -// 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 asversion 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_DB_WBXNG_H -#define INCLUDED_DB_WBXNG_H - -#include <usrp/db_base.h> -#include <cmath> - -class adf4350; - -class wbxng_base : public db_base -{ -public: - wbxng_base(usrp_basic_sptr usrp, int which); - ~wbxng_base(); - - struct freq_result_t set_freq(double freq); - - bool is_quadrature(); - double freq_min(); - double freq_max(); - -protected: - void _write_spi(std::string data); - int _refclk_divisor(); - bool _get_locked(); - bool _set_pga(float pga_gain); - - bool d_first; - int d_spi_format; - int d_spi_enable; - int d_power_on; - int d_PD; - - boost::shared_ptr<adf4350> d_common; -}; - -// ---------------------------------------------------------------- - -class db_wbxng_tx : public wbxng_base -{ -protected: - void shutdown(); - -public: - db_wbxng_tx(usrp_basic_sptr usrp, int which); - ~db_wbxng_tx(); - - float gain_min(); - float gain_max(); - float gain_db_per_step(); - - bool set_auto_tr(bool on); - bool set_enable(bool on); - bool set_gain(float gain); -}; - -class db_wbxng_rx : public wbxng_base -{ -protected: - void shutdown(); - bool _set_attn(float attn); - -public: - db_wbxng_rx(usrp_basic_sptr usrp, int which); - ~db_wbxng_rx(); - - bool set_auto_tr(bool on); - bool select_rx_antenna(int which_antenna); - bool select_rx_antenna(const std::string &which_antenna); - bool set_gain(float gain); - - float gain_min(); - float gain_max(); - float gain_db_per_step(); - bool i_and_q_swapped(); -}; - -#endif /* INCLUDED_DB_WBXNG_H */ diff --git a/usrp/host/include/usrp/db_xcvr2450.h b/usrp/host/include/usrp/db_xcvr2450.h deleted file mode 100644 index 305c60d06..000000000 --- a/usrp/host/include/usrp/db_xcvr2450.h +++ /dev/null @@ -1,92 +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 asversion 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 DB_XCVR2450_H -#define DB_XCVR2450_H - -#include <usrp/db_base.h> -#include <boost/shared_ptr.hpp> - -class xcvr2450; -typedef boost::shared_ptr<xcvr2450> xcvr2450_sptr; - - -/******************************************************************************/ - - -class db_xcvr2450_base: public db_base -{ - /* - * Abstract base class for all xcvr2450 boards. - * - * Derive board specific subclasses from db_xcvr2450_base_{tx,rx} - */ -public: - db_xcvr2450_base(usrp_basic_sptr usrp, int which); - ~db_xcvr2450_base(); - struct freq_result_t set_freq(double target_freq); - bool is_quadrature(); - double freq_min(); - double freq_max(); - -protected: - xcvr2450_sptr d_xcvr; - void shutdown_common(); -}; - - -/******************************************************************************/ - - -class db_xcvr2450_tx : public db_xcvr2450_base -{ -protected: - void shutdown(); - -public: - db_xcvr2450_tx(usrp_basic_sptr usrp, int which); - ~db_xcvr2450_tx(); - - float gain_min(); - float gain_max(); - float gain_db_per_step(); - bool set_gain(float gain); - bool i_and_q_swapped(); -}; - -class db_xcvr2450_rx : public db_xcvr2450_base -{ -protected: - void shutdown(); - -public: - db_xcvr2450_rx(usrp_basic_sptr usrp, int which); - ~db_xcvr2450_rx(); - - float gain_min(); - float gain_max(); - float gain_db_per_step(); - bool set_gain(float gain); -}; - - - -#endif diff --git a/usrp/host/include/usrp/libusb_types.h.in b/usrp/host/include/usrp/libusb_types.h.in deleted file mode 100644 index cf10e33cc..000000000 --- a/usrp/host/include/usrp/libusb_types.h.in +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- Mode: C++ -*- */ -/* - * 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. - */ - -#ifndef _LIBUSB_TYPES_H_ -#define _LIBUSB_TYPES_H_ - -#if @USE_LIBUSB1@ -#include <libusb-1.0/libusb.h> -struct libusb_device; -struct libusb_device_handle; -struct libusb_device_descriptor; -#else -#include <usb.h> -typedef struct usb_device libusb_device; -typedef struct usb_dev_handle libusb_device_handle; -typedef struct usb_device_descriptor libusb_device_descriptor; -#endif - -#endif /* _LIBUSB_TYPES_H_ */ diff --git a/usrp/host/include/usrp/usrp_basic.h b/usrp/host/include/usrp/usrp_basic.h deleted file mode 100644 index b76493ea4..000000000 --- a/usrp/host/include/usrp/usrp_basic.h +++ /dev/null @@ -1,993 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,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_BASIC_H -#define INCLUDED_USRP_BASIC_H - -#include <usrp/db_base.h> -#include <usrp/usrp_slots.h> -#include <usrp/usrp_subdev_spec.h> -#include <usrp/libusb_types.h> -#include <string> -#include <vector> -#include <boost/utility.hpp> - -class fusb_devhandle; -class fusb_ephandle; - -enum txrx_t { - C_RX = 0, - C_TX = 1 -}; - -/* - * ---------------------------------------------------------------------- - * Mid level interface to the Universal Software Radio Peripheral (Rev 1) - * - * These classes implement the basic functionality for talking to the - * USRP. They try to be as independent of the signal processing code - * in FPGA as possible. They implement access to the low level - * peripherals on the board, provide a common way for reading and - * writing registers in the FPGA, and provide the high speed interface - * to streaming data across the USB. - * - * It is expected that subclasses will be derived that provide - * access to the functionality to a particular FPGA configuration. - * ---------------------------------------------------------------------- - */ - - -/*! - * \brief abstract base class for usrp operations - * \ingroup usrp - */ -class usrp_basic : boost::noncopyable -{ -protected: - void shutdown_daughterboards(); - -protected: - libusb_device_handle *d_udh; - struct libusb_context *d_ctx; - int d_usb_data_rate; // bytes/sec - int d_bytes_per_poll; // how often to poll for overruns - bool d_verbose; - long d_fpga_master_clock_freq; - - static const int MAX_REGS = 128; - unsigned int d_fpga_shadows[MAX_REGS]; - - int d_dbid[2]; // daughterboard ID's (side A, side B) - - /*! - * Shared pointers to subclasses of db_base. - * - * The outer vector is of length 2 (0 = side A, 1 = side B). The - * inner vectors are of length 1, 2 or 3 depending on the number of - * subdevices implemented by the daugherboard. At this time, only - * the Basic Rx and LF Rx implement more than 1 subdevice. - */ - std::vector< std::vector<db_base_sptr> > d_db; - - // One time call, made only only from usrp_standard_*::make after shared_ptr is created. - void init_db(usrp_basic_sptr u); - - - usrp_basic (int which_board, - libusb_device_handle *open_interface (libusb_device *dev), - const std::string fpga_filename = "", - const std::string firmware_filename = ""); - - /*! - * \brief advise usrp_basic of usb data rate (bytes/sec) - * - * N.B., this doesn't tweak any hardware. Derived classes - * should call this to inform us of the data rate whenever it's - * first set or if it changes. - * - * \param usb_data_rate bytes/sec - */ - void set_usb_data_rate (int usb_data_rate); - - /*! - * \brief Write auxiliary digital to analog converter. - * - * \param slot Which Tx or Rx slot to write. - * 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 [0,3] RX slots must use only 0 and 1. TX slots must use only 2 and 3. - * \param value [0,4095] - * \returns true iff successful - */ - bool _write_aux_dac (int slot, int which_dac, int value); - - /*! - * \brief Read auxiliary analog to digital converter. - * - * \param slot 2-bit slot number. E.g., SLOT_TX_A - * \param which_adc [0,1] - * \param value return 12-bit value [0,4095] - * \returns true iff successful - */ - bool _read_aux_adc (int slot, int which_adc, int *value); - - /*! - * \brief Read auxiliary analog to digital converter. - * - * \param slot 2-bit slot number. E.g., SLOT_TX_A - * \param which_adc [0,1] - * \returns value in the range [0,4095] if successful, else READ_FAILED. - */ - int _read_aux_adc (int slot, int which_adc); - - -public: - virtual ~usrp_basic (); - - - /*! - * Return a vector of vectors that contain shared pointers - * to the daughterboard instance(s) associated with the specified side. - * - * It is an error to use the returned objects after the usrp_basic - * object has been destroyed. - */ - std::vector<std::vector<db_base_sptr> > db() const { return d_db; } - - /*! - * Return a vector of size >= 1 that contains shared pointers - * to the daughterboard instance(s) associated with the specified side. - * - * \param which_side [0,1] which daughterboard - * - * It is an error to use the returned objects after the usrp_basic - * object has been destroyed. - */ - std::vector<db_base_sptr> db(int which_side); - - /*! - * \brief is the subdev_spec valid? - */ - bool is_valid(const usrp_subdev_spec &ss); - - /*! - * \brief given a 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(const usrp_subdev_spec &ss); - - /*! - * \brief return frequency of master oscillator on USRP - */ - long fpga_master_clock_freq () const { return d_fpga_master_clock_freq; } - - /*! - * 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) { d_fpga_master_clock_freq = master_clock; } - - /*! - * \returns usb data rate in bytes/sec - */ - int usb_data_rate () const { return d_usb_data_rate; } - - void set_verbose (bool on) { d_verbose = 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 = 0; - - /*! - * \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); - - - // ================================================================ - // Routines to access and control daughterboard specific i/o - // - // Those with a common_ prefix access either the Tx or Rx side depending - // on the txrx parameter. Those without the common_ prefix are virtual - // and are overriden in usrp_basic_rx and usrp_basic_tx to access the - // the Rx or Tx sides automatically. We provide the common_ versions - // for those daughterboards such as the WBX and XCVR2450 that share - // h/w resources (such as the LO) between the Tx and Rx sides. - - // ---------------------------------------------------------------- - // BEGIN common_ daughterboard control functions - - /*! - * \brief Set Programmable Gain Amplifier(PGA) - * - * \param txrx Tx or Rx? - * \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 common_set_pga(txrx_t txrx, int which_amp, double gain_in_db); - - /*! - * \brief Return programmable gain amplifier gain setting in dB. - * - * \param txrx Tx or Rx? - * \param which_amp which amp [0,3] - */ - double common_pga(txrx_t txrx, int which_amp) const; - - /*! - * \brief Return minimum legal PGA gain in dB. - * \param txrx Tx or Rx? - */ - double common_pga_min(txrx_t txrx) const; - - /*! - * \brief Return maximum legal PGA gain in dB. - * \param txrx Tx or Rx? - */ - double common_pga_max(txrx_t txrx) const; - - /*! - * \brief Return hardware step size of PGA(linear in dB). - * \param txrx Tx or Rx? - */ - double common_pga_db_per_step(txrx_t txrx) const; - - /*! - * \brief Write direction register(output enables) for pins that go to daughterboard. - * - * \param txrx Tx or Rx? - * \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 _common_write_oe(txrx_t txrx, int which_side, int value, int mask); - - /*! - * \brief Write daughterboard i/o pin value - * - * \param txrx Tx or Rx? - * \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 common_write_io(txrx_t txrx, int which_side, int value, int mask); - - /*! - * \brief Read daughterboard i/o pin value - * - * \param txrx Tx or Rx? - * \param which_side [0,1] which d'board - * \param value output - */ - bool common_read_io(txrx_t txrx, int which_side, int *value); - - /*! - * \brief Read daughterboard i/o pin value - * - * \param txrx Tx or Rx? - * \param which_side [0,1] which d'board - * \returns register value if successful, else READ_FAILED - */ - int common_read_io(txrx_t txrx, int which_side); - - /*! - * \brief Write daughterboard refclk config register - * - * \param txrx Tx or Rx? - * \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 common_write_refclk(txrx_t txrx, int which_side, int value); - - /*! - * \brief Automatic Transmit/Receive switching - * <pre> - * - * If automatic transmit/receive (ATR) switching is enabled in the - * FR_ATR_CTL register, the presence or absence of data in the FPGA - * transmit fifo selects between two sets of values for each of the 4 - * banks of daughterboard i/o pins. - * - * Each daughterboard slot has 3 16-bit registers associated with it: - * FR_ATR_MASK_*, FR_ATR_TXVAL_* and FR_ATR_RXVAL_* - * - * FR_ATR_MASK_{0,1,2,3}: - * - * These registers determine which of the daugherboard i/o pins are - * affected by ATR switching. If a bit in the mask is set, the - * corresponding i/o bit is controlled by ATR, else it's output - * value comes from the normal i/o pin output register: - * FR_IO_{0,1,2,3}. - * - * FR_ATR_TXVAL_{0,1,2,3}: - * FR_ATR_RXVAL_{0,1,2,3}: - * - * If the Tx fifo contains data, then the bits from TXVAL that are - * selected by MASK are output. Otherwise, the bits from RXVAL that - * are selected by MASK are output. - * </pre> - */ - bool common_write_atr_mask(txrx_t txrx, int which_side, int value); - bool common_write_atr_txval(txrx_t txrx, int which_side, int value); - bool common_write_atr_rxval(txrx_t txrx, int which_side, int value); - - /*! - * \brief Write auxiliary digital to analog converter. - * - * \param txrx Tx or Rx? - * \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 common_write_aux_dac(txrx_t txrx, int which_side, int which_dac, int value); - - /*! - * \brief Read auxiliary analog to digital converter. - * - * \param txrx Tx or Rx? - * \param which_side [0,1] which d'board - * \param which_adc [0,1] - * \param value return 12-bit value [0,4095] - * \returns true iff successful - */ - bool common_read_aux_adc(txrx_t txrx, int which_side, int which_adc, int *value); - - /*! - * \brief Read auxiliary analog to digital converter. - * - * \param txrx Tx or Rx? - * \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 common_read_aux_adc(txrx_t txrx, int which_side, int which_adc); - - // END common_ daughterboard control functions - // ---------------------------------------------------------------- - // BEGIN virtual daughterboard control functions - - /*! - * \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() - */ - virtual bool set_pga (int which_amp, double gain_in_db) = 0; - - /*! - * \brief Return programmable gain amplifier gain setting in dB. - * - * \param which_amp which amp [0,3] - */ - virtual double pga (int which_amp) const = 0; - - /*! - * \brief Return minimum legal PGA gain in dB. - */ - virtual double pga_min () const = 0; - - /*! - * \brief Return maximum legal PGA gain in dB. - */ - virtual double pga_max () const = 0; - - /*! - * \brief Return hardware step size of PGA (linear in dB). - */ - virtual double pga_db_per_step () const = 0; - - /*! - * \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. - */ - virtual bool _write_oe (int which_side, int value, int mask) = 0; - - /*! - * \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 - */ - virtual bool write_io (int which_side, int value, int mask) = 0; - - /*! - * \brief Read daughterboard i/o pin value - * - * \param which_side [0,1] which d'board - * \param value output - */ - virtual bool read_io (int which_side, int *value) = 0; - - /*! - * \brief Read daughterboard i/o pin value - * - * \param which_side [0,1] which d'board - * \returns register value if successful, else READ_FAILED - */ - virtual int read_io (int which_side) = 0; - - /*! - * \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> - */ - virtual bool write_refclk(int which_side, int value) = 0; - - virtual bool write_atr_mask(int which_side, int value) = 0; - virtual bool write_atr_txval(int which_side, int value) = 0; - virtual bool write_atr_rxval(int which_side, int value) = 0; - - /*! - * \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 - */ - virtual bool write_aux_dac (int which_side, int which_dac, int value) = 0; - - /*! - * \brief Read auxiliary analog to digital converter. - * - * \param which_side [0,1] which d'board - * \param which_adc [0,1] - * \param value return 12-bit value [0,4095] - * \returns true iff successful - */ - virtual bool read_aux_adc (int which_side, int which_adc, int *value) = 0; - - /*! - * \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. - */ - virtual int read_aux_adc (int which_side, int which_adc) = 0; - - /*! - * \brief returns current fusb block size - */ - virtual int block_size() const = 0; - - /*! - * \brief returns A/D or D/A converter rate in Hz - */ - virtual long converter_rate() const = 0; - - // END virtual daughterboard control functions - - // ---------------------------------------------------------------- - // 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 - * \param value 8-bit value - * \returns true iff successful - */ - bool _read_9862 (int which_codec, int regno, unsigned char *value) const; - - /*! - * \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); - - /*! - * \brief Start data transfers. - * Called in base class to derived class order. - */ - bool start (); - - /*! - * \brief Stop data transfers. - * Called in base class to derived class order. - */ - bool stop (); -}; - -/*! - * \brief class for accessing the receive side of the USRP - * \ingroup usrp - */ -class usrp_basic_rx : public usrp_basic -{ -private: - fusb_devhandle *d_devhandle; - fusb_ephandle *d_ephandle; - int d_bytes_seen; // how many bytes we've seen - bool d_first_read; - bool d_rx_enable; - -protected: - /*! - * \param which_board Which USRP board on usb (not particularly useful; use 0) - * \param fusb_block_size fast usb xfer block size. Must be a multiple of 512. - * Use zero for a reasonable default. - * \param fusb_nblocks number of fast usb URBs to allocate. Use zero for a reasonable default. - * \param fpga_filename name of the rbf file to load - * \param firmware_filename name of ihx file to load - */ - usrp_basic_rx (int which_board, - int fusb_block_size=0, - int fusb_nblocks=0, - const std::string fpga_filename = "", - const std::string firmware_filename = "" - ); // throws if trouble - - bool set_rx_enable (bool on); - bool rx_enable () const { return d_rx_enable; } - - bool disable_rx (); // conditional disable, return prev state - void restore_rx (bool on); // conditional set - - void probe_rx_slots (bool verbose); - -public: - ~usrp_basic_rx (); - - /*! - * \brief invokes constructor, returns instance or 0 if trouble - * - * \param which_board Which USRP board on usb (not particularly useful; use 0) - * \param fusb_block_size fast usb xfer block size. Must be a multiple of 512. - * Use zero for a reasonable default. - * \param fusb_nblocks number of fast usb URBs to allocate. Use zero for a reasonable default. - * \param fpga_filename name of file that contains image to load into FPGA - * \param firmware_filename name of file that contains image to load into FX2 - */ - static usrp_basic_rx *make (int which_board, - int fusb_block_size=0, - int fusb_nblocks=0, - const std::string fpga_filename = "", - const std::string firmware_filename = "" - ); - - /*! - * \brief tell the fpga the rate rx samples are coming from the A/D's - * - * div = fpga_master_clock_freq () / sample_rate - * - * sample_rate is determined by a myriad of registers - * in the 9862. That's why you have to tell us, so - * we can tell the fpga. - */ - bool set_fpga_rx_sample_rate_divisor (unsigned int div); - - /*! - * \brief read data from the D/A's via the FPGA. - * \p len must be a multiple of 512 bytes. - * - * \returns the number of bytes read, or -1 on error. - * - * If overrun is non-NULL it will be set true iff an RX overrun is detected. - */ - int read (void *buf, int len, bool *overrun); - - - //! sampling rate of A/D converter - virtual long converter_rate() const { return fpga_master_clock_freq(); } // 64M - long adc_rate() const { return converter_rate(); } - int daughterboard_id (int which_side) const { return d_dbid[which_side & 0x1]; } - - 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); - bool read_io (int which_side, int *value); - 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); - bool read_aux_adc (int which_side, int which_adc, int *value); - int read_aux_adc (int which_side, int which_adc); - - int block_size() const; - - // called in base class to derived class order - bool start (); - bool stop (); -}; - -/*! - * \brief class for accessing the transmit side of the USRP - * \ingroup usrp - */ -class usrp_basic_tx : public usrp_basic -{ -private: - fusb_devhandle *d_devhandle; - fusb_ephandle *d_ephandle; - int d_bytes_seen; // how many bytes we've seen - bool d_first_write; - bool d_tx_enable; - - protected: - /*! - * \param which_board Which USRP board on usb (not particularly useful; use 0) - * \param fusb_block_size fast usb xfer block size. Must be a multiple of 512. - * Use zero for a reasonable default. - * \param fusb_nblocks number of fast usb URBs to allocate. Use zero for a reasonable default. - * \param fpga_filename name of file that contains image to load into FPGA - * \param firmware_filename name of file that contains image to load into FX2 - */ - usrp_basic_tx (int which_board, - int fusb_block_size=0, - int fusb_nblocks=0, - const std::string fpga_filename = "", - const std::string firmware_filename = "" - ); // throws if trouble - - bool set_tx_enable (bool on); - bool tx_enable () const { return d_tx_enable; } - - bool disable_tx (); // conditional disable, return prev state - void restore_tx (bool on); // conditional set - - void probe_tx_slots (bool verbose); - -public: - - ~usrp_basic_tx (); - - /*! - * \brief invokes constructor, returns instance or 0 if trouble - * - * \param which_board Which USRP board on usb (not particularly useful; use 0) - * \param fusb_block_size fast usb xfer block size. Must be a multiple of 512. - * Use zero for a reasonable default. - * \param fusb_nblocks number of fast usb URBs to allocate. Use zero for a reasonable default. - * \param fpga_filename name of file that contains image to load into FPGA - * \param firmware_filename name of file that contains image to load into FX2 - */ - static usrp_basic_tx *make (int which_board, int fusb_block_size=0, int fusb_nblocks=0, - const std::string fpga_filename = "", - const std::string firmware_filename = "" - ); - - /*! - * \brief tell the fpga the rate tx samples are going to the D/A's - * - * div = fpga_master_clock_freq () * 2 - * - * sample_rate is determined by a myriad of registers - * in the 9862. That's why you have to tell us, so - * we can tell the fpga. - */ - bool set_fpga_tx_sample_rate_divisor (unsigned int div); - - /*! - * \brief Write data to the A/D's via the FPGA. - * - * \p len must be a multiple of 512 bytes. - * \returns number of bytes written or -1 on error. - * - * if \p underrun is non-NULL, it will be set to true iff - * a transmit underrun condition is detected. - */ - int write (const void *buf, int len, bool *underrun); - - /* - * Block until all outstanding writes have completed. - * This is typically used to assist with benchmarking - */ - void wait_for_completion (); - - //! sampling rate of D/A converter - virtual long converter_rate() const { return fpga_master_clock_freq () * 2; } // 128M - long dac_rate() const { return converter_rate(); } - int daughterboard_id (int which_side) const { return d_dbid[which_side & 0x1]; } - - 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); - bool read_io (int which_side, int *value); - 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); - bool read_aux_adc (int which_side, int which_adc, int *value); - int read_aux_adc (int which_side, int which_adc); - - int block_size() const; - - // called in base class to derived class order - bool start (); - bool stop (); -}; - -#endif /* INCLUDED_USRP_BASIC_H */ diff --git a/usrp/host/include/usrp/usrp_bytesex.h b/usrp/host/include/usrp/usrp_bytesex.h deleted file mode 100644 index 331db31c9..000000000 --- a/usrp/host/include/usrp/usrp_bytesex.h +++ /dev/null @@ -1,108 +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_BYTESEX_H -#define INCLUDED_USRP_BYTESEX_H - -/*! - * \brief routines for convertering between host and usrp byte order - * - * Prior to including this file, the user must include "config.h" - * which will or won't define WORDS_BIGENDIAN based on the - * result of the AC_C_BIGENDIAN autoconf test. - */ - -#ifdef HAVE_BYTESWAP_H -#include <byteswap.h> -#else - -#warning Using non-portable code (likely wrong other than ILP32). - -static inline unsigned short int -bswap_16 (unsigned short int x) -{ - return ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8)); -} - -static inline unsigned int -bswap_32 (unsigned int x) -{ - return ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) \ - | (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24)); -} -#endif - - -#ifdef WORDS_BIGENDIAN - -static inline unsigned int -host_to_usrp_u32 (unsigned int x) -{ - return bswap_32(x); -} - -static inline unsigned int -usrp_to_host_u32 (unsigned int x) -{ - return bswap_32(x); -} - -static inline short int -host_to_usrp_short (short int x) -{ - return bswap_16 (x); -} - -static inline short int -usrp_to_host_short (short int x) -{ - return bswap_16 (x); -} - -#else - -static inline unsigned int -host_to_usrp_u32 (unsigned int x) -{ - return x; -} - -static inline unsigned int -usrp_to_host_u32 (unsigned int x) -{ - return x; -} - -static inline short int -host_to_usrp_short (short int x) -{ - return x; -} - -static inline short int -usrp_to_host_short (unsigned short int x) -{ - return x; -} - -#endif - -#endif /* INCLUDED_USRP_BYTESEX_H */ diff --git a/usrp/host/include/usrp/usrp_local_sighandler.h b/usrp/host/include/usrp/usrp_local_sighandler.h deleted file mode 100644 index ee336750f..000000000 --- a/usrp/host/include/usrp/usrp_local_sighandler.h +++ /dev/null @@ -1,61 +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_LOCAL_SIGHANDLER_H -#define INCLUDED_USRP_LOCAL_SIGHANDLER_H - -#include <signal.h> -#include <string> - -/*! - * \brief Representation of signal. - */ -class usrp_signal -{ - int d_signum; -public: - usrp_signal (int signum) : d_signum (signum) {} - int signal () const { return d_signum; } - std::string name () const; -}; - - -/*! - * \brief Get and set signal handler. - * - * Constructor installs new handler, destructor reinstalls - * original value. - */ -class usrp_local_sighandler { - int d_signum; -#ifdef HAVE_SIGACTION - struct sigaction d_old_action; -#endif -public: - usrp_local_sighandler (int signum, void (*new_handler)(int)); - ~usrp_local_sighandler (); - - /* throw usrp_signal (signum) */ - static void throw_signal (int signum) throw (usrp_signal); -}; - -#endif /* INCLUDED_USRP_LOCAL_SIGHANDLER_H */ diff --git a/usrp/host/include/usrp/usrp_prims.h b/usrp/host/include/usrp/usrp_prims.h deleted file mode 100644 index 4780d0004..000000000 --- a/usrp/host/include/usrp/usrp_prims.h +++ /dev/null @@ -1,307 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,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_PRIMS_H -#define INCLUDED_USRP_PRIMS_H - -#include <usrp/usrp_slots.h> -#include <usrp/libusb_types.h> -#include <string> - -struct libusb_context; - -static const int USRP_HASH_SIZE = 16; - -enum usrp_load_status_t { ULS_ERROR = 0, ULS_OK, ULS_ALREADY_LOADED }; - -/*! - * \brief initialize libusb; Behavior differs depending on libusb version - * - * libusb-0.12 - * - * Probe busses and devices. The argument is ignored and defaults to NULL. - * Safe to call more than once. - * - * libusb-1.0 - * - * If an location to a libusb_context is passed in, create and write in the new - * context. If no argument is provided, initialize libusb with the default - * (NULL) context. - * - * Generally _not_ safe to call more than once with non-NULL argument since a - * new context will be created each time. - */ - -void usrp_one_time_init (libusb_context **ctx = NULL); - -/*! - * \brief deinitialize libusb - * - * libusb-0.1: No effect - * - * libusb-1.0: Deinitialize context ctx - */ -void usrp_deinit (libusb_context *ctx); - -/* - * force a rescan of the buses and devices - */ -void usrp_rescan (); - -/*! - * \brief locate Nth (zero based) USRP device in system. - * Return pointer or 0 if not found. - * - * The following kinds of devices are considered USRPs: - * - * unconfigured USRP (no firwmare loaded) - * configured USRP (firmware loaded) - * unconfigured Cypress FX2 (only if fx2_ok_p is true) - */ -libusb_device *usrp_find_device (int nth, bool fx2_ok_p = false, libusb_context *ctx = NULL); - -bool usrp_usrp_p (libusb_device *q); //< is this a USRP -bool usrp_usrp0_p (libusb_device *q); //< is this a USRP Rev 0 -bool usrp_usrp1_p (libusb_device *q); //< is this a USRP Rev 1 -bool usrp_usrp2_p (libusb_device *q); //< is this a USRP Rev 2 -int usrp_hw_rev (libusb_device *q); //< return h/w rev code - -bool usrp_fx2_p (libusb_device *q); //< is this an unconfigured Cypress FX2 - -bool usrp_unconfigured_usrp_p (libusb_device *q); //< some kind of unconfigured USRP -bool usrp_configured_usrp_p (libusb_device *q); //< some kind of configured USRP - -/*! - * \brief given a libusb_device return an instance of the appropriate libusb_device_handle - * - * These routines claim the specified interface and select the - * correct alternate interface. (USB nomenclature is totally screwed!) - * - * If interface can't be opened, or is already claimed by some other - * process, 0 is returned. - */ -libusb_device_handle *usrp_open_cmd_interface (libusb_device *dev); -libusb_device_handle *usrp_open_rx_interface (libusb_device *dev); -libusb_device_handle *usrp_open_tx_interface (libusb_device *dev); - -/*! - * \brief close interface. - */ -bool usrp_close_interface (libusb_device_handle *udh); - -/*! - * \brief load intel hex format file into USRP/Cypress FX2 (8051). - * - * The filename extension is typically *.ihx - * - * Note that loading firmware may cause the device to renumerate. I.e., - * change its configuration, invalidating the current device handle. - */ - -usrp_load_status_t -usrp_load_firmware (libusb_device_handle *udh, const char *filename, bool force); - -/*! - * \brief load intel hex format file into USRP FX2 (8051). - * - * The filename extension is typically *.ihx - * - * Note that loading firmware may cause the device to renumerate. I.e., - * change its configuration, invalidating the current device handle. - * If the result is ULS_OK, usrp_load_firmware_nth delays 1 second - * then rescans the busses and devices. - */ -usrp_load_status_t -usrp_load_firmware_nth (int nth, const char *filename, bool force, libusb_context *ctx = NULL); - -/*! - * \brief load fpga configuration bitstream - */ -usrp_load_status_t -usrp_load_fpga (libusb_device_handle *udh, const char *filename, bool force); - -/*! - * \brief load the regular firmware and fpga bitstream in the Nth USRP. - * - * This is the normal starting point... - */ -bool usrp_load_standard_bits (int nth, bool force, - const std::string fpga_filename = "", - const std::string firmware_filename = "", - libusb_context *ctx = NULL); - -/*! - * \brief copy the given \p hash into the USRP hash slot \p which. - * The usrp implements two hash slots, 0 and 1. - */ -bool usrp_set_hash (libusb_device_handle *udh, int which, - const unsigned char hash[USRP_HASH_SIZE]); - -/*! - * \brief retrieve the \p hash from the USRP hash slot \p which. - * The usrp implements two hash slots, 0 and 1. - */ -bool usrp_get_hash (libusb_device_handle *udh, int which, - unsigned char hash[USRP_HASH_SIZE]); - -bool usrp_write_fpga_reg (libusb_device_handle *udh, int reg, int value); -bool usrp_read_fpga_reg (libusb_device_handle *udh, int reg, int *value); -bool usrp_set_fpga_reset (libusb_device_handle *udh, bool on); -bool usrp_set_fpga_tx_enable (libusb_device_handle *udh, bool on); -bool usrp_set_fpga_rx_enable (libusb_device_handle *udh, bool on); -bool usrp_set_fpga_tx_reset (libusb_device_handle *udh, bool on); -bool usrp_set_fpga_rx_reset (libusb_device_handle *udh, bool on); -bool usrp_set_led (libusb_device_handle *udh, int which, bool on); - -bool usrp_check_rx_overrun (libusb_device_handle *udh, bool *overrun_p); -bool usrp_check_tx_underrun (libusb_device_handle *udh, bool *underrun_p); - -// i2c_read and i2c_write are limited to a maximum len of 64 bytes. - -bool usrp_i2c_write (libusb_device_handle *udh, int i2c_addr, - const void *buf, int len); - -bool usrp_i2c_read (libusb_device_handle *udh, int i2c_addr, - void *buf, int len); - -// spi_read and spi_write are limited to a maximum of 64 bytes -// See usrp_spi_defs.h for more info - -bool usrp_spi_write (libusb_device_handle *udh, - int optional_header, int enables, int format, - const void *buf, int len); - -bool usrp_spi_read (libusb_device_handle *udh, - int optional_header, int enables, int format, - void *buf, int len); - - -bool usrp_9862_write (libusb_device_handle *udh, - int which_codec, // [0, 1] - int regno, // [0, 63] - int value); // [0, 255] - -bool usrp_9862_read (libusb_device_handle *udh, - int which_codec, // [0, 1] - int regno, // [0, 63] - unsigned char *value); // [0, 255] - -/*! - * \brief Write multiple 9862 regs at once. - * - * \p buf contains alternating register_number, register_value pairs. - * \p len must be even and is the length of buf in bytes. - */ -bool usrp_9862_write_many (libusb_device_handle *udh, int which_codec, - const unsigned char *buf, int len); - - -/*! - * \brief write specified regs to all 9862's in the system - */ -bool usrp_9862_write_many_all (libusb_device_handle *udh, - const unsigned char *buf, int len); - - -// Write 24LC024 / 24LC025 EEPROM on motherboard or daughterboard. -// Which EEPROM is determined by i2c_addr. See i2c_addr.h - -bool usrp_eeprom_write (libusb_device_handle *udh, int i2c_addr, - int eeprom_offset, const void *buf, int len); - - -// Read 24LC024 / 24LC025 EEPROM on motherboard or daughterboard. -// Which EEPROM is determined by i2c_addr. See i2c_addr.h - -bool usrp_eeprom_read (libusb_device_handle *udh, int i2c_addr, - int eeprom_offset, void *buf, int len); - - -// Slot specific i/o routines - -/*! - * \brief write to the specified aux dac. - * - * \p slot: which Tx or Rx slot to write. - * 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 - * - * \p which_dac: [0,3] RX slots must use only 0 and 1. - * TX slots must use only 2 and 3. - * - * AUX DAC 3 is really the 9862 sigma delta output. - * - * \p value to write to aux dac. All dacs take straight - * binary values. Although dacs 0, 1 and 2 are 8-bit and dac 3 is 12-bit, - * the interface is in terms of 12-bit values [0,4095] - */ -bool usrp_write_aux_dac (libusb_device_handle *uhd, int slot, - int which_dac, int value); - -/*! - * \brief Read the specified aux adc - * - * \p slot: which Tx or Rx slot to read aux dac - * \p which_adc: [0,1] which of the two adcs to read - * \p *value: return value, 12-bit straight binary. - */ -bool usrp_read_aux_adc (libusb_device_handle *udh, int slot, - int which_adc, int *value); - - -/*! - * \brief usrp daughterboard id to name mapping - */ -const std::string usrp_dbid_to_string (int dbid); - - -enum usrp_dbeeprom_status_t { UDBE_OK, UDBE_BAD_SLOT, UDBE_NO_EEPROM, UDBE_INVALID_EEPROM }; - -struct usrp_dboard_eeprom { - unsigned short id; // d'board identifier code - unsigned short oe; // fpga output enables: - // If bit set, i/o pin is an output from FPGA. - short offset[2]; // ADC/DAC offset correction -}; - -/*! - * \brief Read and return parsed daughterboard eeprom - */ -usrp_dbeeprom_status_t -usrp_read_dboard_eeprom (libusb_device_handle *udh, - int slot_id, usrp_dboard_eeprom *eeprom); - -/*! - * \brief write ADC/DAC offset calibration constants to d'board eeprom - */ -bool usrp_write_dboard_offsets (libusb_device_handle *udh, int slot_id, - short offset0, short offset1); - -/*! - * \brief return a usrp's serial number. - * - * Note that this only works on a configured usrp. - * \returns non-zero length string iff successful. - */ -std::string usrp_serial_number(libusb_device_handle *udh); - -#endif /* INCLUDED_USRP_PRIMS_H */ diff --git a/usrp/host/include/usrp/usrp_slots.h b/usrp/host/include/usrp/usrp_slots.h deleted file mode 100644 index d2c50fc47..000000000 --- a/usrp/host/include/usrp/usrp_slots.h +++ /dev/null @@ -1,33 +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_SLOTS_H -#define INCLUDED_USRP_SLOTS_H - -// daughterboard slot numbers used in some calls - -static const int SLOT_TX_A = 0; -static const int SLOT_RX_A = 1; -static const int SLOT_TX_B = 2; -static const int SLOT_RX_B = 3; - -#endif /* INCLUDED_USRP_SLOTS_H */ diff --git a/usrp/host/include/usrp/usrp_standard.h b/usrp/host/include/usrp/usrp_standard.h deleted file mode 100644 index a631f8b09..000000000 --- a/usrp/host/include/usrp/usrp_standard.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 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_STANDARD_H -#define INCLUDED_USRP_STANDARD_H - -#include <usrp/usrp_basic.h> -#include <boost/shared_ptr.hpp> -#include <usrp/usrp_tune_result.h> - -class usrp_standard_tx; -class usrp_standard_rx; - -typedef boost::shared_ptr<usrp_standard_tx> usrp_standard_tx_sptr; -typedef boost::shared_ptr<usrp_standard_rx> usrp_standard_rx_sptr; - -/*! - * \ingroup usrp - */ -class usrp_standard_common -{ - int d_fpga_caps; // capability register val - -protected: - usrp_standard_common(usrp_basic *parent); - -public: - /*! - *\brief does the FPGA implement the final Rx half-band filter? - * If it doesn't, the maximum decimation factor with proper gain - * is 1/2 of what it would otherwise be. - */ - bool has_rx_halfband() const; - - /*! - * \brief number of digital downconverters implemented in the FPGA - * This will be 0, 1, 2 or 4. - */ - int nddcs() const; - - /*! - *\brief does the FPGA implement the initial Tx half-band filter? - */ - bool has_tx_halfband() const; - - /*! - * \brief number of digital upconverters implemented in the FPGA - * This will be 0, 1, or 2. - */ - int nducs() const; - - /*! - * \brief Calculate the frequency to use for setting the digital up or down converter. - * - * \param target_freq is the desired RF frequency (Hz). - * \param baseband_freq is the RF frequency that corresponds to DC in the IF coming from the d'board. - * \param fs is the sampling frequency. - * \param[out] dxc_freq the frequency to program into the DDC (or DUC). - * \param[out] inverted is true if we're operating in an inverted Nyquist zone. - */ - static void calc_dxc_freq(double target_freq, double baseband_freq, double fs, - double *dxc_freq, bool *inverted); -}; - -/*! - * \brief The C++ interface the receive side of the USRP - * \ingroup usrp - * - * This is the recommended interface to USRP receive functionality - * for applications that use the USRP but not GNU Radio. - */ -class usrp_standard_rx : public usrp_basic_rx, public usrp_standard_common -{ - private: - static const int MAX_CHAN = 4; - unsigned int d_decim_rate; - int d_nchan; - int d_sw_mux; - int d_hw_mux; - double d_rx_freq[MAX_CHAN]; - - protected: - usrp_standard_rx (int which_board, - unsigned int decim_rate, - 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 = "" - ); // throws if trouble - - bool write_hw_mux_reg (); - - public: - - enum { - FPGA_MODE_NORMAL = 0x00, - FPGA_MODE_LOOPBACK = 0x01, - FPGA_MODE_COUNTING = 0x02, - FPGA_MODE_COUNTING_32BIT = 0x04 - }; - - ~usrp_standard_rx (); - - /*! - * \brief invokes constructor, returns shared_ptr or shared_ptr equivalent of 0 if trouble - * - * \param which_board Which USRP board on usb (not particularly useful; use 0) - * \param decim_rate decimation factor - * \param nchan number of channels - * \param mux Rx mux setting, \sa set_mux - * \param mode mode - * \param fusb_block_size fast usb xfer block size. Must be a multiple of 512. - * Use zero for a reasonable default. - * \param fusb_nblocks number of fast usb URBs to allocate. Use zero for a reasonable default. - * \param fpga_filename Name of rbf file to load - * \param firmware_filename Name of ihx file to load - */ - static usrp_standard_rx_sptr make(int which_board, - unsigned int decim_rate, - 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 = "" - ); - /*! - * \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 () * nchannels () - */ - bool set_decim_rate (unsigned int rate); - - /*! - * \brief Set number of active channels. \p nchannels must be 1, 2 or 4. - * - * The final complex sample rate across the USB is - * adc_freq () / decim_rate () * nchannels () - */ - bool set_nchannels (int nchannels); - - /*! - * \brief Set input mux configuration. - * - * This determines which ADC (or constant zero) is connected to - * each DDC input. There are 4 DDCs. Each has two inputs. - * - * <pre> - * Mux value: - * - * 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 - * +-------+-------+-------+-------+-------+-------+-------+-------+ - * | Q3 | I3 | Q2 | I2 | Q1 | I1 | Q0 | I0 | - * +-------+-------+-------+-------+-------+-------+-------+-------+ - * - * Each 4-bit I field is either 0,1,2,3 - * Each 4-bit Q field is either 0,1,2,3 or 0xf (input is const zero) - * All Q's must be 0xf or none of them may be 0xf - * </pre> - */ - bool set_mux (int mux); - - /*! - * Determine the appropriate Rx mux value as a function of the subdevice choosen - * and the characteristics of the respective daughterboard. - */ - int determine_rx_mux_value(const usrp_subdev_spec &ss); - int determine_rx_mux_value(const usrp_subdev_spec &ss_a, const usrp_subdev_spec &ss_b); - - /*! - * \brief set the frequency of the digital down converter. - * - * \p channel must be in the range [0,3]. \p freq is the center - * frequency in Hz. \p freq may be either negative or postive. - * 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 mode - */ - 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); - - /*! - * \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); - - 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); - - - // ACCESSORS - unsigned int decim_rate () const; - double rx_freq (int channel) const; - int nchannels () const; - int mux () const; - unsigned int format () const; - - // called in base class to derived class order - bool start (); - bool stop (); -}; - -// ---------------------------------------------------------------- - -/*! - * \brief The C++ interface the transmit side of the USRP - * \ingroup usrp - * - * This is the recommended interface to USRP transmit functionality - * for applications that use the USRP but not GNU Radio. - * - * Uses digital upconverter (coarse & fine modulators) in AD9862... - */ -class usrp_standard_tx : public usrp_basic_tx, public usrp_standard_common -{ - public: - enum coarse_mod_t { - CM_NEG_FDAC_OVER_4, // -32 MHz - CM_NEG_FDAC_OVER_8, // -16 MHz - CM_OFF, - CM_POS_FDAC_OVER_8, // +16 MHz - CM_POS_FDAC_OVER_4 // +32 MHz - }; - - protected: - static const int MAX_CHAN = 2; - unsigned int d_interp_rate; - int d_nchan; - int d_sw_mux; - int d_hw_mux; - double d_tx_freq[MAX_CHAN]; - coarse_mod_t d_coarse_mod[MAX_CHAN]; - unsigned char d_tx_modulator_shadow[MAX_CHAN]; - - virtual bool set_coarse_modulator (int channel, coarse_mod_t cm); - usrp_standard_tx::coarse_mod_t coarse_modulator (int channel) const; - - protected: - usrp_standard_tx (int which_board, - unsigned int interp_rate, - 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 = "" - ); // throws if trouble - - bool write_hw_mux_reg (); - - public: - ~usrp_standard_tx (); - - /*! - * \brief invokes constructor, returns shared_ptr or shared_ptr equivalent of 0 if trouble - * - * \param which_board Which USRP board on usb (not particularly useful; use 0) - * \param interp_rate interpolation factor - * \param nchan number of channels - * \param mux Tx mux setting, \sa set_mux - * \param fusb_block_size fast usb xfer block size. Must be a multiple of 512. - * Use zero for a reasonable default. - * \param fusb_nblocks number of fast usb URBs to allocate. Use zero for a reasonable default. - * \param fpga_filename Name of rbf file to load - * \param firmware_filename Name of ihx file to load - */ - static usrp_standard_tx_sptr make(int which_board, - unsigned int interp_rate, - 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 = "" - ); - - /*! - * \brief Set interpolator rate. \p rate must be in [4, 512] and a multiple of 4. - * - * The final complex sample rate across the USB is - * dac_freq () / interp_rate () * nchannels () - */ - virtual bool set_interp_rate (unsigned int rate); - - /*! - * \brief Set number of active channels. \p nchannels must be 1 or 2. - * - * The final complex sample rate across the USB is - * dac_freq () / decim_rate () * nchannels () - */ - bool set_nchannels (int nchannels); - - /*! - * \brief Set output mux configuration. - * - * <pre> - * 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 - * +-------------------------------+-------+-------+-------+-------+ - * | | DAC3 | DAC2 | DAC1 | DAC0 | - * +-------------------------------+-------+-------+-------+-------+ - * - * There are two interpolators with complex inputs and outputs. - * There are four DACs. - * - * Each 4-bit DACx field specifies the source for the DAC and - * whether or not that DAC is enabled. Each subfield is coded - * like this: - * - * 3 2 1 0 - * +-+-----+ - * |E| N | - * +-+-----+ - * - * Where E is set if the DAC is enabled, and N specifies which - * interpolator output is connected to this DAC. - * - * N which interp output - * --- ------------------- - * 0 chan 0 I - * 1 chan 0 Q - * 2 chan 1 I - * 3 chan 1 Q - * </pre> - */ - bool set_mux (int mux); - - /*! - * Determine the appropriate Tx mux value as a function of the subdevice choosen - * and the characteristics of the respective daughterboard. - */ - int determine_tx_mux_value(const usrp_subdev_spec &ss); - int determine_tx_mux_value(const usrp_subdev_spec &ss_a, const usrp_subdev_spec &ss_b); - - /*! - * \brief set the frequency of the digital up converter. - * - * \p channel must be in the range [0,1]. \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. - */ - virtual bool set_tx_freq (int channel, double freq); // chan: [0,1] - - // ACCESSORS - unsigned int interp_rate () const; - double tx_freq (int channel) const; - int nchannels () const; - int mux () const; - - /*! - * \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); - - - // called in base class to derived class order - bool start (); - bool stop (); -}; - -#endif /* INCLUDED_USRP_STANDARD_H */ diff --git a/usrp/host/include/usrp/usrp_subdev_spec.h b/usrp/host/include/usrp/usrp_subdev_spec.h deleted file mode 100644 index e841ff832..000000000 --- a/usrp/host/include/usrp/usrp_subdev_spec.h +++ /dev/null @@ -1,50 +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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef INCLUDED_USRP_SUBDEV_SPEC_H -#define INCLUDED_USRP_SUBDEV_SPEC_H - -/*! - * \brief specify a daughterboard and subdevice on a daughterboard. - * - * In the USRP1, there are two sides, A and B. - * - * A daughterboard generally implements a single subdevice, but may in - * general implement any number of subdevices. At this time, all daughterboards - * with the exception of the Basic Rx and LF Rx implement a single subdevice. - * - * The Basic Rx and LF Rx implement 2 subdevices (soon 3). Subdevice - * 0 routes input RX-A to the DDC I input and routes a constant zero - * to the DDC Q input. Similarly, subdevice 1 routes input RX-B to - * the DDC I input and routes a constant zero to the DDC Q - * input. Subdevice 2 (when implemented) will route RX-A to the DDC I - * input and RX-B to the DDC Q input. - */ - -struct usrp_subdev_spec { - unsigned int side; // 0 -> A; 1 -> B - unsigned int subdev; // which subdevice (usually zero) - - usrp_subdev_spec(unsigned int _side = 0, unsigned int _subdev = 0) - : side(_side), subdev(_subdev) {} -}; - -#endif /* INCLUDED_USRP_SUBDEV_SPEC_H */ diff --git a/usrp/host/include/usrp/usrp_tune_result.h b/usrp/host/include/usrp/usrp_tune_result.h deleted file mode 100644 index 200541a37..000000000 --- a/usrp/host/include/usrp/usrp_tune_result.h +++ /dev/null @@ -1,44 +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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#ifndef INCLUDED_USRP_TUNE_RESULT_H -#define INCLUDED_USRP_TUNE_RESULT_H - -class usrp_tune_result -{ -public: - // RF frequency that corresponds to DC in the IF - double baseband_freq; - - // frequency programmed into the DDC/DUC - double dxc_freq; - - // residual frequency (typically < 0.01 Hz) - double residual_freq; - - // is the spectrum inverted? - bool inverted; - - usrp_tune_result(double baseband=0, double dxc=0, double residual=0, bool _inverted=false) - : baseband_freq(baseband), dxc_freq(dxc), - residual_freq(residual), inverted(_inverted) {} -}; - -#endif /* INCLUDED_USRP_TUNE_RESULT_H */ diff --git a/usrp/host/lib/.gitignore b/usrp/host/lib/.gitignore deleted file mode 100644 index e0e4208db..000000000 --- a/usrp/host/lib/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -/Makefile -/Makefile.in -/.la -/.lo -/.deps -/.libs -/*.la -/*.lo -/test_fusb -/std_paths.h -/usrp_dbid.py -/usrp_dbid.h -/usrp_dbid.cc -/stamp-* diff --git a/usrp/host/lib/Makefile.am b/usrp/host/lib/Makefile.am deleted file mode 100644 index 96ab55821..000000000 --- a/usrp/host/lib/Makefile.am +++ /dev/null @@ -1,194 +0,0 @@ -# -# USRP - Universal Software Radio Peripheral -# -# Copyright (C) 2003,2004,2006,2007,2008,2009,2010 Free Software Foundation, Inc. -# -# This program 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 of the License, or -# (at your option) any later version. -# -# This program 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, Boston, MA 02110-1301 USA -# - -include $(top_srcdir)/Makefile.common - -common_INCLUDES = $(USRP_INCLUDES) $(USB_INCLUDES) - -lib_LTLIBRARIES = libusrp.la - -libusrp_la_common_LDFLAGS = $(NO_UNDEFINED) $(LTVERSIONFLAGS) $(BOOST_LDFLAGS) - -libusrp_la_common_LIBADD = \ - $(USB_LIBS) \ - $(BOOST_THREAD_LIB) \ - ../misc/libmisc.la - -# darwin fusb requires gruel (for threading) -if FUSB_TECH_darwin -AM_CPPFLAGS = $(GRUEL_INCLUDES) $(common_INCLUDES) $(BOOST_CPPFLAGS) $(WITH_INCLUDES) -libusrp_la_LIBADD = $(libusrp_la_common_LIBADD) $(GRUEL_LA) -libusrp_la_LDFLAGS = $(libusrp_la_common_LDFLAGS) -framework CoreFoundation -else -AM_CPPFLAGS = $(common_INCLUDES) $(BOOST_CPPFLAGS) $(WITH_INCLUDES) -libusrp_la_LIBADD = $(libusrp_la_common_LIBADD) -libusrp_la_LDFLAGS = $(libusrp_la_common_LDFLAGS) -endif - -EXTRA_DIST += \ - std_paths.h.in \ - usrp_dbid.dat - -BUILT_SOURCES += $(abs_top_builddir)/usrp/host/include/usrp/usrp_dbid.h - -BUILT_SOURCES += usrp_dbid.cc \ - usrp_dbid.py - -# ---------------------------------------------------------------- -# FUSB_TECH is set at configure time by way of -# usrp/config/usrp_fusb_tech.m4. -# It indicates which fast usb strategy we should be building. -# We currently implement "generic", "darwin", "win32" and "linux" - - -generic_CODE = \ - fusb_generic.cc \ - fusb_sysconfig_generic.cc \ - usrp_prims_libusb0.cc - -darwin_CODE = \ - fusb_darwin.cc \ - fusb_sysconfig_darwin.cc \ - README_OSX \ - circular_buffer.h \ - circular_linked_list.h \ - darwin_libusb.h \ - usrp_prims_libusb0.cc - - -win32_CODE = \ - fusb_win32.cc \ - fusb_sysconfig_win32.cc \ - usrp_prims_libusb0.cc - - -linux_CODE = \ - fusb_linux.cc \ - fusb_sysconfig_linux.cc \ - usrp_prims_libusb0.cc - -ra_wb_CODE = \ - fusb_ra_wb.cc \ - fusb_sysconfig_ra_wb.cc \ - usrp_prims_libusb0.cc - -libusb1_CODE = \ - fusb_libusb1.cc \ - fusb_sysconfig_libusb1.cc \ - usrp_prims_libusb1.cc - -# -# include each <foo>_CODE entry here... -# -EXTRA_libusrp_la_SOURCES = \ - $(generic_CODE) \ - $(darwin_CODE) \ - $(win32_CODE) \ - $(linux_CODE) \ - $(ra_wb_CODE) \ - $(libusb1_CODE) - -# work around automake deficiency -libusrp_la_common_SOURCES = \ - fusb.cc \ - md5.c \ - usrp_basic.cc \ - usrp_config.cc \ - usrp_dbid.cc \ - usrp_local_sighandler.cc \ - usrp_prims_common.cc \ - usrp_standard.cc \ - db_wbxng_adf4350.cc \ - db_wbxng_adf4350_regs.cc \ - db_boards.cc \ - db_base.cc \ - db_basic.cc \ - db_bitshark_rx.cc \ - db_tv_rx.cc \ - db_tv_rx_mimo.cc \ - db_flexrf.cc \ - db_flexrf_mimo.cc \ - db_dbs_rx.cc \ - db_wbxng.cc \ - db_xcvr2450.cc \ - db_dtt754.cc \ - db_dtt768.cc \ - db_util.cc - -if FUSB_TECH_generic -libusrp_la_SOURCES = $(libusrp_la_common_SOURCES) $(generic_CODE) -endif - -if FUSB_TECH_darwin -libusrp_la_SOURCES = $(libusrp_la_common_SOURCES) $(darwin_CODE) -endif - -if FUSB_TECH_win32 -libusrp_la_SOURCES = $(libusrp_la_common_SOURCES) $(win32_CODE) -endif - -if FUSB_TECH_linux -libusrp_la_SOURCES = $(libusrp_la_common_SOURCES) $(linux_CODE) -endif - -if FUSB_TECH_ra_wb -libusrp_la_SOURCES = $(libusrp_la_common_SOURCES) $(ra_wb_CODE) -endif - -if FUSB_TECH_libusb1 -libusrp_la_SOURCES = $(libusrp_la_common_SOURCES) $(libusb1_CODE) -endif - - -noinst_HEADERS = \ - ad9862.h \ - db_base_impl.h \ - db_boards.h \ - db_util.h \ - db_wbxng_adf4350.h \ - db_wbxng_adf4350_regs.h \ - fusb.h \ - fusb_darwin.h \ - fusb_generic.h \ - fusb_linux.h \ - fusb_libusb1.h \ - fusb_ra_wb.h \ - fusb_win32.h \ - md5.h \ - rate_to_regval.h \ - usrp_config.h \ - usrp_primsi.h - -if PYTHON -usrppython_PYTHON = \ - usrp_dbid.py - -noinst_PYTHON = \ - gen_usrp_dbid.py \ - check_data.py \ - dump_data.py -endif - -# common way for generating sources from templates when using -# BUILT_SOURCES, using parallel build protection. -gen_sources = $(BUILT_SOURCES) -gen_sources_deps = gen_usrp_dbid.py usrp_dbid.dat -par_gen_command = PYTHONPATH=$(top_srcdir)/usrp/src srcdir=$(srcdir) $(PYTHON) $(srcdir)/gen_usrp_dbid.py $(srcdir)/usrp_dbid.dat -include $(top_srcdir)/Makefile.par.gen diff --git a/usrp/host/lib/README_OSX b/usrp/host/lib/README_OSX deleted file mode 100644 index 37026f25a..000000000 --- a/usrp/host/lib/README_OSX +++ /dev/null @@ -1,63 +0,0 @@ -USRP Darwin Fast USB Changes -Version 0.2 of 2006-04-27 -Michael Dickens <mdickens @at@ nd .dot. edu> - -The files included in this archive are: - -circular_buffer.h -circular_linked_list.h -darwin_libusb.h -fusb_darwin.cc -fusb_darwin.h -mld_threads.h - -These files allow GNURadio code for Darwin / MaxOS X to talk to the -USRP via USB 2.0 at rates up to around 30 Mega-Bytes/sec (MBps), up -from 4-8 MBps without the changes. - -I implemented the buffering myself; there are probably GR buffers -available which would do the work but as this is "beta" software it's -a good place to start. Speed improvements are made by porting -LIBUSB's non-true async bulk read and write functions into USRP's -"fusb", and upgrading them to handle -true- async transfers. -Unfortunately, the easiest way to do this is to spawn a thread or 2 to -handle the "async" part of the transfers. This implementation uses -Darwin's pthreads to do the work for mutexes, conditions, and threads. -Previous implementations (0.1 and before) used "omni_threads" as -provided by gnuradio-core, which caused issues with compiling and -execution ... I'm glad that this is no longer the case. - -As far as I have tested, there is no way to improve the throughput to -32+ MBps without moving into Darwin's "port"s ... a kernel-level data -transport method with a user/application layer for USB-specific -functions. Unfortunately, Apple's documentation for these "port"s is -minimal; I have learned more from reading the Darwin source code -< http://darwinsource.opendarwin.org/ > than by reading Apple's -documents! This would also require -not- using LIBUSB, of which the -removal from the rest of the USRP code would be potentially tedious. - -If you run into issues either compiling or testing the USRP on -OSX, please send me a note. - -(1) Go through the bootstrap, configure, compile, and install as -usual (e.g. see < http://www.nd.edu/~mdickens/GNURadio/ > for my -usual). - -(2) from .../usrp/host/apps : run the scripts -++++++++++++++++ -./test_usrp_standard_tx -./test_usrp_standard_rx -++++++++++++++++ - -For -all- systems I've tested on thus far, both of these return -exactly 41 overruns / underruns, and -most- systems start out with a -stalled pipe. This stall comes in a usb_control function call to -LIBUSB; one would have to change the LIBUSB code to handle this issue. - -(3) from gr-build/gnuradio-examples/python/usrp : -++++++++++++++++ -./benchmark_usb.py -++++++++++++++++ - -(4) If you get to here, the try doing the FM receiver (gui or not). -If that sounds correct, then the USB is working. Yay!
\ No newline at end of file diff --git a/usrp/host/lib/ad9862.h b/usrp/host/lib/ad9862.h deleted file mode 100644 index 4375d93d8..000000000 --- a/usrp/host/lib/ad9862.h +++ /dev/null @@ -1,221 +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_AD9862_H -#define INCLUDED_AD9862_H - -/* - * Analog Devices AD9862 registers and some fields - */ - -#define BEGIN_AD9862 namespace ad9862 { -#define END_AD962 } -#define DEF static const int - -BEGIN_AD9862; - -DEF REG_GENERAL = 0; -DEF REG_RX_PWR_DN = 1; -DEF RX_PWR_DN_VREF_DIFF = (1 << 7); -DEF RX_PWR_DN_VREF = (1 << 6); -DEF RX_PWR_DN_RX_DIGIGAL = (1 << 5); -DEF RX_PWR_DN_RX_B = (1 << 4); -DEF RX_PWR_DN_RX_A = (1 << 3); -DEF RX_PWR_DN_BUF_B = (1 << 2); -DEF RX_PWR_DN_BUF_A = (1 << 1); -DEF RX_PWR_DN_ALL = (1 << 0); - -DEF REG_RX_A = 2; // bypass input buffer / RxPGA -DEF REG_RX_B = 3; // pypass input buffer / RxPGA -DEF RX_X_BYPASS_INPUT_BUFFER = (1 << 7); - -DEF REG_RX_MISC = 4; -DEF RX_MISC_HS_DUTY_CYCLE = (1 << 2); -DEF RX_MISC_SHARED_REF = (1 << 1); -DEF RX_MISC_CLK_DUTY = (1 << 0); - -DEF REG_RX_IF = 5; -DEF RX_IF_THREE_STATE = (1 << 4); -DEF RX_IF_USE_CLKOUT1 = (0 << 3); -DEF RX_IF_USE_CLKOUT2 = (1 << 3); // aka Rx Retime -DEF RX_IF_2S_COMP = (1 << 2); -DEF RX_IF_INV_RX_SYNC = (1 << 1); -DEF RX_IF_MUX_OUT = (1 << 0); - -DEF REG_RX_DIGITAL = 6; -DEF RX_DIGITAL_2_CHAN = (1 << 3); -DEF RX_DIGITAL_KEEP_MINUS_VE = (1 << 2); -DEF RX_DIGITAL_HILBERT = (1 << 1); -DEF RX_DIGITAL_DECIMATE = (1 << 0); - -DEF REG_RESERVED_7 = 7; - -DEF REG_TX_PWR_DN = 8; -DEF TX_PWR_DN_ALT_TIMING_MODE = (1 << 5); -DEF TX_PWR_DN_TX_OFF_ENABLE = (1 << 4); -DEF TX_PWR_DN_TX_DIGITAL = (1 << 3); -DEF TX_PWR_DN_TX_ANALOG_B = 0x4; -DEF TX_PWR_DN_TX_ANALOG_A = 0x2; -DEF TX_PWR_DN_TX_ANALOG_BOTH = 0x7; - -DEF REG_RESERVED_9 = 9; - -DEF REG_TX_A_OFFSET_LO = 10; -DEF REG_TX_A_OFFSET_HI = 11; -DEF REG_TX_B_OFFSET_LO = 12; -DEF REG_TX_B_OFFSET_HI = 13; - -DEF REG_TX_A_GAIN = 14; // fine trim for matching -DEF REG_TX_B_GAIN = 15; // fine trim for matching -DEF TX_X_GAIN_COARSE_FULL = (3 << 6); -DEF TX_X_GAIN_COARSE_1_HALF = (1 << 6); -DEF TX_X_GAIN_COARSE_1_ELEVENTH = (0 << 6); - -DEF REG_TX_PGA = 16; // 20 dB continuous gain in 0.1 dB steps - // 0x00 = min gain (-20 dB) - // 0xff = max gain ( 0 dB) - -DEF REG_TX_MISC = 17; -DEF TX_MISC_SLAVE_ENABLE = (1 << 1); -DEF TX_MISC_TX_PGA_FAST = (1 << 0); - -DEF REG_TX_IF = 18; -DEF TX_IF_USE_CLKOUT2 = (0 << 6); -DEF TX_IF_USE_CLKOUT1 = (1 << 6); // aka Tx Retime -DEF TX_IF_I_FIRST = (0 << 5); -DEF TX_IF_Q_FIRST = (1 << 5); -DEF TX_IF_INV_TX_SYNC = (1 << 4); -DEF TX_IF_2S_COMP = (1 << 3); -DEF TX_IF_INVERSE_SAMPLE = (1 << 2); -DEF TX_IF_TWO_EDGES = (1 << 1); -DEF TX_IF_INTERLEAVED = (1 << 0); - -DEF REG_TX_DIGITAL = 19; -DEF TX_DIGITAL_2_DATA_PATHS = (1 << 4); -DEF TX_DIGITAL_KEEP_NEGATIVE = (1 << 3); -DEF TX_DIGITAL_HILBERT = (1 << 2); -DEF TX_DIGITAL_INTERPOLATE_NONE = 0x0; -DEF TX_DIGITAL_INTERPOLATE_2X = 0x1; -DEF TX_DIGITAL_INTERPOLATE_4X = 0x2; - -DEF REG_TX_MODULATOR = 20; -DEF TX_MODULATOR_NEG_FINE_TUNE = (1 << 5); -DEF TX_MODULATOR_DISABLE_NCO = (0 << 4); -DEF TX_MODULATOR_ENABLE_NCO = (1 << 4); // aka Fine Mode -DEF TX_MODULATOR_REAL_MIX_MODE = (1 << 3); -DEF TX_MODULATOR_NEG_COARSE_TUNE = (1 << 2); -DEF TX_MODULATOR_COARSE_MODULATION_NONE = 0x0; -DEF TX_MODULATOR_COARSE_MODULATION_F_OVER_4 = 0x1; -DEF TX_MODULATOR_COARSE_MODULATION_F_OVER_8 = 0x2; -DEF TX_MODULATOR_CM_MASK = 0x7; - - -DEF REG_TX_NCO_FTW_7_0 = 21; -DEF REG_TX_NCO_FTW_15_8 = 22; -DEF REG_TX_NCO_FTW_23_16= 23; - -DEF REG_DLL = 24; -DEF DLL_DISABLE_INTERNAL_XTAL_OSC = (1 << 6); // aka Input Clock Ctrl -DEF DLL_ADC_DIV2 = (1 << 5); -DEF DLL_MULT_1X = (0 << 3); -DEF DLL_MULT_2X = (1 << 3); -DEF DLL_MULT_4X = (2 << 3); -DEF DLL_PWR_DN = (1 << 2); -// undefined bit = (1 << 1); -DEF DLL_FAST = (1 << 0); - -DEF REG_CLKOUT = 25; -DEF CLKOUT2_EQ_DLL = (0 << 6); -DEF CLKOUT2_EQ_DLL_OVER_2 = (1 << 6); -DEF CLKOUT2_EQ_DLL_OVER_4 = (2 << 6); -DEF CLKOUT2_EQ_DLL_OVER_8 = (3 << 6); -DEF CLKOUT_INVERT_CLKOUT2 = (1 << 5); -DEF CLKOUT_DISABLE_CLKOUT2 = (1 << 4); -// undefined bit = (1 << 3); -// undefined bit = (1 << 2); -DEF CLKOUT_INVERT_CLKOUT1 = (1 << 1); -DEF CLKOUT_DISABLE_CLKOUT1 = (1 << 0); - -DEF REG_AUX_ADC_A2_LO = 26; -DEF REG_AUX_ADC_A2_HI = 27; -DEF REG_AUX_ADC_A1_LO = 28; -DEF REG_AUX_ADC_A1_HI = 29; -DEF REG_AUX_ADC_B2_LO = 30; -DEF REG_AUX_ADC_B2_HI = 31; -DEF REG_AUX_ADC_B1_LO = 32; -DEF REG_AUX_ADC_B1_HI = 33; - -DEF REG_AUX_ADC_CTRL = 34; -DEF AUX_ADC_CTRL_AUX_SPI = (1 << 7); -DEF AUX_ADC_CTRL_SELBNOTA = (1 << 6); -DEF AUX_ADC_CTRL_REFSEL_B = (1 << 5); -DEF AUX_ADC_CTRL_SELECT_B2 = (0 << 4); -DEF AUX_ADC_CTRL_SELECT_B1 = (1 << 4); -DEF AUX_ADC_CTRL_START_B = (1 << 3); -DEF AUX_ADC_CTRL_REFSEL_A = (1 << 2); -DEF AUX_ADC_CTRL_SELECT_A2 = (0 << 1); -DEF AUX_ADC_CTRL_SELECT_A1 = (1 << 1); -DEF AUX_ADC_CTRL_START_A = (1 << 0); - -DEF REG_AUX_ADC_CLK = 35; -DEF AUX_ADC_CLK_CLK_OVER_4 = (1 << 0); - -DEF REG_AUX_DAC_A = 36; -DEF REG_AUX_DAC_B = 37; -DEF REG_AUX_DAC_C = 38; - -DEF REG_AUX_DAC_UPDATE = 39; -DEF AUX_DAC_UPDATE_SLAVE_ENABLE = (1 << 7); -DEF AUX_DAC_UPDATE_C = (1 << 2); -DEF AUX_DAC_UPDATE_B = (1 << 1); -DEF AUX_DAC_UPDATE_A = (1 << 0); - -DEF REG_AUX_DAC_PWR_DN = 40; -DEF AUX_DAC_PWR_DN_C = (1 << 2); -DEF AUX_DAC_PWR_DN_B = (1 << 1); -DEF AUX_DAC_PWR_DN_A = (1 << 0); - -DEF REG_AUX_DAC_CTRL = 41; -DEF AUX_DAC_CTRL_INV_C = (1 << 4); -DEF AUX_DAC_CTRL_INV_B = (1 << 2); -DEF AUX_DAC_CTRL_INV_A = (1 << 0); - -DEF REG_SIGDELT_LO = 42; -DEF REG_SIGDELT_HI = 43; - -// 44 to 48 reserved - -DEF REG_ADC_LOW_PWR_LO = 49; -DEF REG_ADC_LOW_PWR_HI = 50; - -// 51 to 62 reserved - -DEF REG_CHIP_ID = 63; - - -END_AD962; - -#undef DEF -#undef BEGIN_AD9862 -#undef END_AD962 - -#endif /* INCLUDED_AD9862_H */ diff --git a/usrp/host/lib/check_data.py b/usrp/host/lib/check_data.py deleted file mode 100755 index 100f0f6dd..000000000 --- a/usrp/host/lib/check_data.py +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2003 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 struct - -fin = sys.stdin - -count = 0 -expected = 0 -last_correction = 0 - -while 1: - s = fin.read(2) - if not s or len(s) != 2: - break - - v, = struct.unpack ('H', s) - iv = int(v) & 0xffff - # print "%8d %6d 0x%04x" % (count, iv, iv) - if count & 0x1: # only counting on the Q channel - if (expected & 0xffff) != iv: - print "%8d (%6d) %6d 0x%04x" % (count, count - last_correction, iv, iv) - expected = iv # reset expected sequence - last_correction = count - expected = (expected + 1) & 0xffff - - count += 1 - - - - diff --git a/usrp/host/lib/circular_buffer.h b/usrp/host/lib/circular_buffer.h deleted file mode 100644 index 48758bf87..000000000 --- a/usrp/host/lib/circular_buffer.h +++ /dev/null @@ -1,315 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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. - */ - -#ifndef _CIRCULAR_BUFFER_H_ -#define _CIRCULAR_BUFFER_H_ - -#include <gruel/thread.h> -#include <iostream> -#include <stdexcept> - -#ifndef DO_DEBUG -#define DO_DEBUG 0 -#endif - -#if DO_DEBUG -#define DEBUG(X) do{X} while(0); -#else -#define DEBUG(X) do{} while(0); -#endif - -template <class T> -class circular_buffer -{ -private: -// the buffer to use - T* d_buffer; - -// the following are in Items (type T) - size_t d_bufLen_I, d_readNdx_I, d_writeNdx_I; - size_t d_n_avail_write_I, d_n_avail_read_I; - -// stuff to control access to class internals - gruel::mutex* d_internal; - gruel::condition_variable* d_readBlock; - gruel::condition_variable* d_writeBlock; - -// booleans to decide how to control reading, writing, and aborting - bool d_doWriteBlock, d_doFullRead, d_doAbort; - - void delete_mutex_cond () { - if (d_internal) { - delete d_internal; - d_internal = NULL; - } - if (d_readBlock) { - delete d_readBlock; - d_readBlock = NULL; - } - if (d_writeBlock) { - delete d_writeBlock; - d_writeBlock = NULL; - } - }; - -public: - circular_buffer (size_t bufLen_I, - bool doWriteBlock = true, bool doFullRead = false) { - if (bufLen_I == 0) - throw std::runtime_error ("circular_buffer(): " - "Number of items to buffer must be > 0.\n"); - d_bufLen_I = bufLen_I; - d_buffer = (T*) new T[d_bufLen_I]; - d_doWriteBlock = doWriteBlock; - d_doFullRead = doFullRead; - d_internal = NULL; - d_readBlock = d_writeBlock = NULL; - reset (); - DEBUG (std::cerr << "c_b(): buf len (items) = " << d_bufLen_ - << ", doWriteBlock = " << (d_doWriteBlock ? "true" : "false") - << ", doFullRead = " << (d_doFullRead ? "true" : "false") - << std::endl); - }; - - ~circular_buffer () { - delete_mutex_cond (); - delete [] d_buffer; - }; - - inline size_t n_avail_write_items () { - gruel::scoped_lock l (*d_internal); - size_t retVal = d_n_avail_write_I; - return (retVal); - }; - - inline size_t n_avail_read_items () { - gruel::scoped_lock l (*d_internal); - size_t retVal = d_n_avail_read_I; - return (retVal); - }; - - inline size_t buffer_length_items () {return (d_bufLen_I);}; - inline bool do_write_block () {return (d_doWriteBlock);}; - inline bool do_full_read () {return (d_doFullRead);}; - - void reset () { - d_doAbort = false; - bzero (d_buffer, d_bufLen_I * sizeof (T)); - d_readNdx_I = d_writeNdx_I = d_n_avail_read_I = 0; - d_n_avail_write_I = d_bufLen_I; - delete_mutex_cond (); - // create a mutex to handle contention of shared resources; - // any routine needed access to shared resources uses lock() - // before doing anything, then unlock() when finished. - d_internal = new gruel::mutex (); - // link the internal mutex to the read and write conditions; - // when wait() is called, the internal mutex will automatically - // be unlock()'ed. Upon return (from a notify_one() to the condition), - // the internal mutex will be lock()'ed. - d_readBlock = new gruel::condition_variable (); - d_writeBlock = new gruel::condition_variable (); - }; - -/* - * enqueue: add the given buffer of item-length to the queue, - * first-in-first-out (FIFO). - * - * inputs: - * buf: a pointer to the buffer holding the data - * - * bufLen_I: the buffer length in items (of the instantiated type) - * - * returns: - * -1: on overflow (write is not blocking, and data is being - * written faster than it is being read) - * 0: if nothing to do (0 length buffer) - * 1: if success - * 2: in the process of aborting, do doing nothing - * - * will throw runtime errors if inputs are improper: - * buffer pointer is NULL - * buffer length is larger than the instantiated buffer length - */ - - int enqueue (T* buf, size_t bufLen_I) { - DEBUG (std::cerr << "enqueue: buf = " << (void*) buf - << ", bufLen = " << bufLen_I - << ", #av_wr = " << d_n_avail_write_I - << ", #av_rd = " << d_n_avail_read_I << std::endl); - if (bufLen_I > d_bufLen_I) { - std::cerr << "ERROR: cannot add buffer longer (" - << bufLen_I << ") than instantiated length (" - << d_bufLen_I << ")." << std::endl; - throw std::runtime_error ("circular_buffer::enqueue()"); - } - - if (bufLen_I == 0) - return (0); - if (!buf) - throw std::runtime_error ("circular_buffer::enqueue(): " - "input buffer is NULL.\n"); - gruel::scoped_lock l (*d_internal); - if (d_doAbort) { - return (2); - } - // set the return value to 1: success; change if needed - int retval = 1; - if (bufLen_I > d_n_avail_write_I) { - if (d_doWriteBlock) { - while (bufLen_I > d_n_avail_write_I) { - DEBUG (std::cerr << "enqueue: #len > #a, waiting." << std::endl); - // wait; will automatically unlock() the internal mutex via - // the scoped lock - d_writeBlock->wait (l); - // and auto re-lock() it here. - if (d_doAbort) { - DEBUG (std::cerr << "enqueue: #len > #a, aborting." << std::endl); - return (2); - } - DEBUG (std::cerr << "enqueue: #len > #a, done waiting." << std::endl); - } - } else { - d_n_avail_read_I = d_bufLen_I - bufLen_I; - d_n_avail_write_I = bufLen_I; - DEBUG (std::cerr << "circular_buffer::enqueue: overflow" << std::endl); - retval = -1; - } - } - size_t n_now_I = d_bufLen_I - d_writeNdx_I, n_start_I = 0; - if (n_now_I > bufLen_I) - n_now_I = bufLen_I; - else if (n_now_I < bufLen_I) - n_start_I = bufLen_I - n_now_I; - bcopy (buf, &(d_buffer[d_writeNdx_I]), n_now_I * sizeof (T)); - if (n_start_I) { - bcopy (&(buf[n_now_I]), d_buffer, n_start_I * sizeof (T)); - d_writeNdx_I = n_start_I; - } else - d_writeNdx_I += n_now_I; - d_n_avail_read_I += bufLen_I; - d_n_avail_write_I -= bufLen_I; - d_readBlock->notify_one (); - return (retval); - }; - -/* - * dequeue: removes from the queue the number of items requested, or - * available, into the given buffer on a FIFO basis. - * - * inputs: - * buf: a pointer to the buffer into which to copy the data - * - * bufLen_I: pointer to the number of items to remove in items - * (of the instantiated type) - * - * returns: - * 0: if nothing to do (0 length buffer) - * 1: if success - * 2: in the process of aborting, do doing nothing - * - * will throw runtime errors if inputs are improper: - * buffer pointer is NULL - * buffer length pointer is NULL - * buffer length is larger than the instantiated buffer length - */ - - int dequeue (T* buf, size_t* bufLen_I) { - DEBUG (std::cerr << "dequeue: buf = " << ((void*) buf) - << ", *bufLen = " << (*bufLen_I) - << ", #av_wr = " << d_n_avail_write_I - << ", #av_rd = " << d_n_avail_read_I << std::endl); - if (!bufLen_I) - throw std::runtime_error ("circular_buffer::dequeue(): " - "input bufLen pointer is NULL.\n"); - if (!buf) - throw std::runtime_error ("circular_buffer::dequeue(): " - "input buffer pointer is NULL.\n"); - size_t l_bufLen_I = *bufLen_I; - if (l_bufLen_I == 0) - return (0); - if (l_bufLen_I > d_bufLen_I) { - std::cerr << "ERROR: cannot remove buffer longer (" - << l_bufLen_I << ") than instantiated length (" - << d_bufLen_I << ")." << std::endl; - throw std::runtime_error ("circular_buffer::dequeue()"); - } - - gruel::scoped_lock l (*d_internal); - if (d_doAbort) { - return (2); - } - if (d_doFullRead) { - while (d_n_avail_read_I < l_bufLen_I) { - DEBUG (std::cerr << "dequeue: #a < #len, waiting." << std::endl); - // wait; will automatically unlock() the internal mutex via - // the scoped lock - d_readBlock->wait (l); - // and re-lock() it here. - if (d_doAbort) { - DEBUG (std::cerr << "dequeue: #a < #len, aborting." << std::endl); - return (2); - } - DEBUG (std::cerr << "dequeue: #a < #len, done waiting." << std::endl); - } - } else { - while (d_n_avail_read_I == 0) { - DEBUG (std::cerr << "dequeue: #a == 0, waiting." << std::endl); - // wait; will automatically unlock() the internal mutex via - // the scoped lock - d_readBlock->wait (l); - // and re-lock() it here. - if (d_doAbort) { - DEBUG (std::cerr << "dequeue: #a == 0, aborting." << std::endl); - return (2); - } - DEBUG (std::cerr << "dequeue: #a == 0, done waiting." << std::endl); - } - } - if (l_bufLen_I > d_n_avail_read_I) - l_bufLen_I = d_n_avail_read_I; - size_t n_now_I = d_bufLen_I - d_readNdx_I, n_start_I = 0; - if (n_now_I > l_bufLen_I) - n_now_I = l_bufLen_I; - else if (n_now_I < l_bufLen_I) - n_start_I = l_bufLen_I - n_now_I; - bcopy (&(d_buffer[d_readNdx_I]), buf, n_now_I * sizeof (T)); - if (n_start_I) { - bcopy (d_buffer, &(buf[n_now_I]), n_start_I * sizeof (T)); - d_readNdx_I = n_start_I; - } else - d_readNdx_I += n_now_I; - *bufLen_I = l_bufLen_I; - d_n_avail_read_I -= l_bufLen_I; - d_n_avail_write_I += l_bufLen_I; - d_writeBlock->notify_one (); - return (1); - }; - - void abort () { - gruel::scoped_lock l (*d_internal); - d_doAbort = true; - d_writeBlock->notify_one (); - d_readBlock->notify_one (); - }; -}; - -#endif /* _CIRCULAR_BUFFER_H_ */ diff --git a/usrp/host/lib/circular_linked_list.h b/usrp/host/lib/circular_linked_list.h deleted file mode 100644 index bbed5e49b..000000000 --- a/usrp/host/lib/circular_linked_list.h +++ /dev/null @@ -1,278 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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. - */ - -#ifndef _CIRCULAR_LINKED_LIST_H_ -#define _CIRCULAR_LINKED_LIST_H_ - -#include <gruel/thread.h> -#include <stdexcept> - -#define __INLINE__ inline - -#ifndef DO_DEBUG -#define DO_DEBUG 0 -#endif - -#if DO_DEBUG -#define DEBUG(X) do{X} while(0); -#else -#define DEBUG(X) do{} while(0); -#endif - -template <class T> class s_both; - -template <class T> class s_node -{ - typedef s_node<T>* s_node_ptr; - -private: - T d_object; - bool d_available; - s_node_ptr d_prev, d_next; - s_both<T>* d_both; - -public: - s_node (T l_object, - s_node_ptr l_prev = NULL, - s_node_ptr l_next = NULL) - : d_object (l_object), d_available (TRUE), d_prev (l_prev), - d_next (l_next), d_both (0) {}; - - __INLINE__ s_node (s_node_ptr l_prev, s_node_ptr l_next = NULL) { - s_node ((T) NULL, l_prev, l_next); }; - __INLINE__ s_node () { s_node (NULL, NULL, NULL); }; - __INLINE__ ~s_node () {}; - - void remove () { - d_prev->next (d_next); - d_next->prev (d_prev); - d_prev = d_next = this; - }; - - void insert_before (s_node_ptr l_next) { - if (l_next) { - s_node_ptr l_prev = l_next->prev (); - d_next = l_next; - d_prev = l_prev; - l_prev->next (this); - l_next->prev (this); - } else - d_next = d_prev = this; - }; - - void insert_after (s_node_ptr l_prev) { - if (l_prev) { - s_node_ptr l_next = l_prev->next (); - d_prev = l_prev; - d_next = l_next; - l_next->prev (this); - l_prev->next (this); - } else - d_prev = d_next = this; - }; - - __INLINE__ T object () { return (d_object); }; - __INLINE__ void object (T l_object) { d_object = l_object; }; - __INLINE__ bool available () { return (d_available); }; - __INLINE__ void set_available () { d_available = TRUE; }; - __INLINE__ void set_available (bool l_avail) { d_available = l_avail; }; - __INLINE__ void set_not_available () { d_available = FALSE; }; - __INLINE__ s_node_ptr next () { return (d_next); }; - __INLINE__ s_node_ptr prev () { return (d_prev); }; - __INLINE__ s_both<T>* both () { return (d_both); }; - __INLINE__ void next (s_node_ptr l_next) { d_next = l_next; }; - __INLINE__ void prev (s_node_ptr l_prev) { d_prev = l_prev; }; - __INLINE__ void both (s_both<T>* l_both) { d_both = l_both; }; -}; - -template <class T> class circular_linked_list { - typedef s_node<T>* s_node_ptr; - -private: - s_node_ptr d_current, d_iterate, d_available, d_inUse; - size_t d_n_nodes, d_n_used; - gruel::mutex* d_internal; - gruel::condition_variable* d_ioBlock; - -public: - circular_linked_list (size_t n_nodes) { - if (n_nodes == 0) - throw std::runtime_error ("circular_linked_list(): n_nodes == 0"); - - d_iterate = NULL; - d_n_nodes = n_nodes; - d_n_used = 0; - s_node_ptr l_prev, l_next; - d_inUse = d_current = l_next = l_prev = NULL; - - l_prev = new s_node<T> (); - l_prev->set_available (); - l_prev->next (l_prev); - l_prev->prev (l_prev); - if (n_nodes > 1) { - l_next = new s_node<T> (l_prev, l_prev); - l_next->set_available (); - l_next->next (l_prev); - l_next->prev (l_prev); - l_prev->next (l_next); - l_prev->prev (l_next); - if (n_nodes > 2) { - size_t n = n_nodes - 2; - while (n-- > 0) { - d_current = new s_node<T> (l_prev, l_next); - d_current->set_available (); - d_current->prev (l_prev); - d_current->next (l_next); - l_prev->next (d_current); - l_next->prev (d_current); - l_next = d_current; - d_current = NULL; - } - } - } - d_available = d_current = l_prev; - d_ioBlock = new gruel::condition_variable (); - d_internal = new gruel::mutex (); - }; - - ~circular_linked_list () { - iterate_start (); - s_node_ptr l_node = iterate_next (); - while (l_node) { - delete l_node; - l_node = iterate_next (); - } - delete d_ioBlock; - d_ioBlock = NULL; - delete d_internal; - d_internal = NULL; - d_available = d_inUse = d_iterate = d_current = NULL; - d_n_used = d_n_nodes = 0; - }; - - s_node_ptr find_next_available_node () { - gruel::scoped_lock l (*d_internal); -// find an available node - s_node_ptr l_node = d_available; - DEBUG (std::cerr << "w "); - while (! l_node) { - DEBUG (std::cerr << "x" << std::endl); - // the ioBlock condition will automatically unlock() d_internal - d_ioBlock->wait (l); - // and lock() is here - DEBUG (std::cerr << "y" << std::endl); - l_node = d_available; - } - DEBUG (std::cerr << "::f_n_a_n: #u = " << num_used() - << ", node = " << l_node << std::endl); -// remove this one from the current available list - if (num_available () == 1) { -// last one, just set available to NULL - d_available = NULL; - } else - d_available = l_node->next (); - l_node->remove (); -// add is to the inUse list - if (! d_inUse) - d_inUse = l_node; - else - l_node->insert_before (d_inUse); - d_n_used++; - l_node->set_not_available (); - return (l_node); - }; - - void make_node_available (s_node_ptr l_node) { - if (!l_node) return; - gruel::scoped_lock l (*d_internal); - DEBUG (std::cerr << "::m_n_a: #u = " << num_used() - << ", node = " << l_node << std::endl); -// remove this node from the inUse list - if (num_used () == 1) { -// last one, just set inUse to NULL - d_inUse = NULL; - } else - d_inUse = l_node->next (); - l_node->remove (); -// add this node to the available list - if (! d_available) - d_available = l_node; - else - l_node->insert_before (d_available); - d_n_used--; - - DEBUG (std::cerr << "s" << d_n_used); -// signal the condition when new data arrives - d_ioBlock->notify_one (); - DEBUG (std::cerr << "t "); - }; - - __INLINE__ void iterate_start () { d_iterate = d_current; }; - - s_node_ptr iterate_next () { -#if 0 -// lock the mutex for thread safety - gruel::scoped_lock l (*d_internal); -#endif - s_node_ptr l_this = NULL; - if (d_iterate) { - l_this = d_iterate; - d_iterate = d_iterate->next (); - if (d_iterate == d_current) - d_iterate = NULL; - } - return (l_this); - }; - - __INLINE__ T object () { return (d_current->d_object); }; - __INLINE__ void object (T l_object) { d_current->d_object = l_object; }; - __INLINE__ size_t num_nodes () { return (d_n_nodes); }; - __INLINE__ size_t num_used () { return (d_n_used); }; - __INLINE__ void num_used (size_t l_n_used) { d_n_used = l_n_used; }; - __INLINE__ size_t num_available () { return (d_n_nodes - d_n_used); }; - __INLINE__ void num_used_inc (void) { - if (d_n_used < d_n_nodes) ++d_n_used; - }; - __INLINE__ void num_used_dec (void) { - if (d_n_used != 0) --d_n_used; -// signal the condition that new data has arrived - d_ioBlock->notify_one (); - }; - __INLINE__ bool in_use () { return (d_n_used != 0); }; -}; - -template <class T> class s_both -{ -private: - s_node<T>* d_node; - void* d_this; -public: - __INLINE__ s_both (s_node<T>* l_node, void* l_this) - : d_node (l_node), d_this (l_this) {}; - __INLINE__ ~s_both () {}; - __INLINE__ s_node<T>* node () { return (d_node); }; - __INLINE__ void* This () { return (d_this); }; - __INLINE__ void set (s_node<T>* l_node, void* l_this) { - d_node = l_node; d_this = l_this;}; -}; - -#endif /* _CIRCULAR_LINKED_LIST_H_ */ diff --git a/usrp/host/lib/darwin_libusb.h b/usrp/host/lib/darwin_libusb.h deleted file mode 100644 index 8446f044e..000000000 --- a/usrp/host/lib/darwin_libusb.h +++ /dev/null @@ -1,227 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,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. - */ - -/* - * The following code was taken from LIBUSB verion 0.1.10a, - * and makes the fusb_darwin codes do-able in the current GR - * programming framework. Parts and pieces were taken from - * usbi.h, darwin.c, and error.h . - * - * LIBUSB version 0.1.10a is covered by the LGPL, version 2; - * These codes are used with permission from: - * (c) 2000-2003 Johannes Erdfelt <johannes@erdfelt.com> - * (c) 2002-2005 Nathan Hjelm <hjelmn@users.sourceforge.net> - * All rights reserved. - */ - -#ifndef __DARWIN_LIBUSB_H__ -#define __DARWIN_LIBUSB_H__ - -#include <IOKit/IOCFBundle.h> -#include <IOKit/IOCFPlugIn.h> -#include <IOKit/usb/IOUSBLib.h> -#include <IOKit/IOKitLib.h> - -extern "C" { - -static const char* darwin_error_strings[] = { - "no error", - "device not opened for exclusive access", - "no connection to an IOService", - "no asyc port has been opened for interface", - "another process has device opened for exclusive access", - "pipe is stalled", - "could not establish a connection to Darin kernel", - "invalid argument", - "unknown error" -}; - -static const char * -darwin_error_str (int result) -{ - switch (result) { - case kIOReturnSuccess: - return (darwin_error_strings[0]); - case kIOReturnNotOpen: - return (darwin_error_strings[1]); - case kIOReturnNoDevice: - return (darwin_error_strings[2]); - case kIOUSBNoAsyncPortErr: - return (darwin_error_strings[3]); - case kIOReturnExclusiveAccess: - return (darwin_error_strings[4]); - case kIOUSBPipeStalled: - return (darwin_error_strings[5]); - case kIOReturnError: - return (darwin_error_strings[6]); - case kIOReturnBadArgument: - return (darwin_error_strings[7]); - default: - return (darwin_error_strings[8]); - } -} - -/* not a valid errorno outside darwin.c */ -#define LUSBDARWINSTALL (ELAST+1) - -static int -darwin_to_errno (int result) -{ - switch (result) { - case kIOReturnSuccess: - return 0; - case kIOReturnNotOpen: - return EBADF; - case kIOReturnNoDevice: - case kIOUSBNoAsyncPortErr: - return ENXIO; - case kIOReturnExclusiveAccess: - return EBUSY; - case kIOUSBPipeStalled: - return LUSBDARWINSTALL; - case kIOReturnBadArgument: - return EINVAL; - case kIOReturnError: - default: - return 1; - } -} - -typedef enum { - USB_ERROR_TYPE_NONE = 0, - USB_ERROR_TYPE_STRING, - USB_ERROR_TYPE_ERRNO, -} usb_error_type_t; - -extern char usb_error_str[1024]; -extern int usb_error_errno; -extern usb_error_type_t usb_error_type; - -#define USB_ERROR(r, x) \ - do { \ - usb_error_type = USB_ERROR_TYPE_ERRNO; \ - usb_error_errno = x; \ - return (r); \ - } while (0) - -#define USB_ERROR_STR(r, x, format, args...) \ - do { \ - usb_error_type = USB_ERROR_TYPE_STRING; \ - snprintf (usb_error_str, sizeof (usb_error_str) - 1, \ - format, ## args); \ - if (usb_debug) { \ - std::cerr << "USB error: " << usb_error_str << std::cerr; \ - } \ - return (r); \ - } while (0) - -#define USB_ERROR_STR_ORIG(x, format, args...) \ - do { \ - usb_error_type = USB_ERROR_TYPE_STRING; \ - snprintf (usb_error_str, sizeof (usb_error_str) - 1, \ - format, ## args); \ - if (usb_debug) { \ - std::cerr << "USB error: " << usb_error_str << std::endl; \ - } \ - return (x); \ - } while (0) - -#define USB_ERROR_STR_NO_RET(x, format, args...) \ - do { \ - usb_error_type = USB_ERROR_TYPE_STRING; \ - snprintf (usb_error_str, sizeof (usb_error_str) - 1, \ - format, ## args); \ - if (usb_debug) { \ - std::cerr << "USB error: " << usb_error_str << std::endl; \ - } \ - } while (0) - -/* - * simple function that figures out what pipeRef - * is associated with an endpoint - */ -static int ep_to_pipeRef (darwin_dev_handle *device, int ep) -{ - io_return_t ret; - UInt8 numep, direction, number; - UInt8 dont_care1, dont_care3; - UInt16 dont_care2; - int i; - - if (usb_debug > 3) { - std::cerr << "Converting ep address to pipeRef." << std::endl; - } - - /* retrieve the total number of endpoints on this interface */ - ret = (*(device->interface))->GetNumEndpoints(device->interface, &numep); - if ( ret ) { - if ( usb_debug > 3 ) { - std::cerr << "ep_to_pipeRef: interface is " - << device->interface << std::endl; - } - USB_ERROR_STR_ORIG ( -ret, "ep_to_pipeRef: can't get number of " - "endpoints for interface" ); - } - - /* iterate through the pipeRefs until we find the correct one */ - for (i = 1 ; i <= numep ; i++) { - ret = (*(device->interface))->GetPipeProperties - (device->interface, i, &direction, &number, - &dont_care1, &dont_care2, &dont_care3); - - if (ret != kIOReturnSuccess) { - std::cerr << "ep_to_pipeRef: an error occurred getting " - << "pipe information on pipe " << i << std::endl; - - USB_ERROR_STR_ORIG (-darwin_to_errno(ret), - "ep_to_pipeRef(GetPipeProperties): %s", - darwin_error_str(ret)); - } - - if (usb_debug > 3) { - std::cerr << "ep_to_pipeRef: Pipe " << i << ": DIR: " - << direction << " number: " << number << std::endl; - } - - /* calculate the endpoint of the pipe and check it versus - the requested endpoint */ - if ( ((direction << 7 & USB_ENDPOINT_DIR_MASK) | - (number & USB_ENDPOINT_ADDRESS_MASK)) == ep ) { - if (usb_debug > 3) { - std::cerr << "ep_to_pipeRef: pipeRef for ep address " - << ep << " found: " << i << std::endl; - } - return (i); - } - } - - if (usb_debug > 3) { - std::cerr << "ep_to_pipeRef: No pipeRef found with endpoint address " - << ep << std::endl; - } - - /* none of the found pipes match the requested endpoint */ - return (-1); -} - -} -#endif /* __DARWIN_LIBUSB_H__ */ diff --git a/usrp/host/lib/db_base.cc b/usrp/host/lib/db_base.cc deleted file mode 100644 index b4fb45c51..000000000 --- a/usrp/host/lib/db_base.cc +++ /dev/null @@ -1,256 +0,0 @@ -// -// 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 asversion 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/db_base.h> -#include <db_base_impl.h> - -#if 0 -tune_result::tune_result(double baseband, double dxc, double residual, bool inv) - : ok(false), baseband_freq(baseband), dxc_freq(dxc), - residual_freq(residual), inverted(inv) -{ -} - -tune_result::~tune_result() -{ -} -#endif - - -/*****************************************************************************/ - -db_base::db_base(usrp_basic_sptr usrp, int which) - : d_is_shutdown(false), d_raw_usrp(usrp.get()), d_which(which), d_lo_offset(0.0) -{ -} - -db_base::~db_base() -{ - shutdown(); -} - -void -db_base::shutdown() -{ - if (!d_is_shutdown){ - d_is_shutdown = true; - // do whatever there is to do to shutdown - } -} - -int -db_base::dbid() -{ - return usrp()->daughterboard_id(d_which); -} - -std::string -db_base::name() -{ - return usrp_dbid_to_string(dbid()); -} - -std::string -db_base::side_and_name() -{ - if(d_which == 0) - return "A: " + name(); - else - return "B: " + name(); -} - -// Function to bypass ADC buffers. Any board which is DC-coupled -// should bypass the buffers - -bool -db_base::bypass_adc_buffers(bool bypass) -{ - //if(d_tx) { - // throw std::runtime_error("TX Board has no adc buffers\n"); - //} - - bool ok = true; - if(d_which==0) { - ok &= usrp()->set_adc_buffer_bypass(0, bypass); - ok &= usrp()->set_adc_buffer_bypass(1, bypass); - } - else { - ok &= usrp()->set_adc_buffer_bypass(2, bypass); - ok &= usrp()->set_adc_buffer_bypass(3, bypass); - } - return ok; -} - -bool -db_base::set_atr_mask(int v) -{ - // Set Auto T/R mask. - return usrp()->write_atr_mask(d_which, v); -} - -bool -db_base::set_atr_txval(int v) -{ - // Set Auto T/R register value to be used when transmitting. - return usrp()->write_atr_txval(d_which, v); -} - -bool -db_base::set_atr_rxval(int v) -{ - // Set Auto T/R register value to be used when receiving. - return usrp()->write_atr_rxval(d_which, v); -} - -bool -db_base::set_atr_tx_delay(int v) -{ - // Set Auto T/R delay (in clock ticks) from when Tx fifo gets data to - // when T/R switches. - return usrp()->write_atr_tx_delay(v); -} - -bool -db_base::set_atr_rx_delay(int v) -{ - // Set Auto T/R delay (in clock ticks) from when Tx fifo goes empty to - // when T/R switches. - return usrp()->write_atr_rx_delay(v); -} - -bool -db_base::i_and_q_swapped() -{ - // Return True if this is a quadrature device and (for RX) ADC 0 is Q - // or (for TX) DAC 0 is Q - return false; -} - -bool -db_base::spectrum_inverted() -{ - // Return True if the dboard gives an inverted spectrum - - return false; -} - -bool -db_base::set_enable(bool on) -{ - // For tx daughterboards, this controls the transmitter enable. - - return true; // default is nop -} - -bool -db_base::set_auto_tr(bool on) -{ - // Enable automatic Transmit/Receive switching (ATR). - // - // Should be overridden in subclasses that care. This will typically - // set the atr_mask, txval and rxval. - - return true; -} - -bool -db_base::set_lo_offset(double offset) -{ - // Set how much LO is offset from requested frequency - - d_lo_offset = offset; - return true; -} - -bool -db_base::select_rx_antenna(int which_antenna) -{ - // Specify which antenna port to use for reception. - // Should be overriden by daughterboards that care. - - return which_antenna == 0; -} - -bool -db_base::select_rx_antenna(const std::string &which_antenna) -{ - // Specify which antenna port to use for reception. - // Should be overriden by daughterboards that care. - - return which_antenna == ""; -} - - -// Reference Clock section -// -// Control whether a reference clock is sent to the daughterboards, -// and what frequency -// -// Bit 7 -- 1 turns on refclk, 0 allows IO use -// Bits 6:0 Divider value -// - -double -db_base::_refclk_freq() -{ - return usrp()->fpga_master_clock_freq() / _refclk_divisor(); -} - -void -db_base::_enable_refclk(bool enable) -{ - int CLOCK_OUT = 1; // Clock is on lowest bit - int REFCLK_ENABLE = 0x80; - int REFCLK_DIVISOR_MASK = 0x7f; - - if(enable) { - usrp()->_write_oe(d_which, CLOCK_OUT, CLOCK_OUT); // output enable - usrp()->write_refclk(d_which, (_refclk_divisor() & REFCLK_DIVISOR_MASK) | REFCLK_ENABLE); - } - else { - usrp()->write_refclk(d_which, 0); - } -} - -int -db_base::_refclk_divisor() -{ - // Return value to stick in REFCLK_DIVISOR register - throw std::runtime_error("_refclk_divisor() called from base class\n");; -} - -bool -db_base::set_bw(float bw) -{ - // Set baseband bandwidth (board specific) - // Should be overriden by boards that implement variable IF filtering (e.g., DBSRX) - return false; -} - -std::ostream &operator<<(std::ostream &os, db_base &x) -{ - os << x.side_and_name(); - return os; -} diff --git a/usrp/host/lib/db_base_impl.h b/usrp/host/lib/db_base_impl.h deleted file mode 100644 index 9d5ca4370..000000000 --- a/usrp/host/lib/db_base_impl.h +++ /dev/null @@ -1,33 +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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#ifndef INCLUDED_DB_BASE_IMPL_H -#define INCLUDED_DB_BASE_IMPL_H - -#include <usrp/db_base.h> -#include <db_util.h> -#include <usrp/usrp_basic.h> -#include <fpga_regs_standard.h> -#include <fpga_regs_common.h> -#include <usrp/usrp_prims.h> -#include <usrp_spi_defs.h> -#include <stdexcept> - -#endif /* INCLUDED_DB_BASE_IMPL_H */ diff --git a/usrp/host/lib/db_basic.cc b/usrp/host/lib/db_basic.cc deleted file mode 100644 index 1694d6a3f..000000000 --- a/usrp/host/lib/db_basic.cc +++ /dev/null @@ -1,266 +0,0 @@ -// -// 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 asversion 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/db_basic.h> -#include <db_base_impl.h> - -db_basic_tx::db_basic_tx(boost::shared_ptr<usrp_basic> usrp, int which) - : db_base(usrp, which) -{ - // Handler for Basic Tx daughterboards. - // - // @param usrp: instance of usrp.source_c - // @param which: which side: 0 or 1 corresponding to TX_A or TX_B respectively - - set_gain((gain_min() + gain_max()) / 2); // initialize gain -} - -db_basic_tx::~db_basic_tx() -{ -} - -double -db_basic_tx::freq_min() -{ - return -90e9; -} - -double -db_basic_tx::freq_max() -{ - return 90e9; -} - -struct freq_result_t -db_basic_tx::set_freq(double target_freq) -{ - // Set the frequency. - // - // @param freq: target RF frequency in Hz - // @type freq: double - // - // @returns (ok, actual_baseband_freq) where: - // ok is True or False and indicates success or failure, - // actual_baseband_freq is the RF frequency that corresponds to DC in the IF. - - struct freq_result_t args = {false, 0}; - args.ok = true; - args.baseband_freq = 0.0; - return args; -} - -float -db_basic_tx::gain_min() -{ - return usrp()->pga_min(); -} - -float -db_basic_tx::gain_max() -{ - return usrp()->pga_max(); -} - -float -db_basic_tx::gain_db_per_step() -{ - return usrp()->pga_db_per_step(); -} - -bool -db_basic_tx::set_gain(float gain) -{ - // Set the gain. - // - // @param gain: gain in decibels - // @returns True/False - - bool ok = usrp()->set_pga(d_which * 2 + 0, gain); - ok = ok && usrp()->set_pga(d_which * 2 + 1, gain); - return ok; -} - -bool -db_basic_tx::is_quadrature() -{ - // Return True if this board requires both I & Q analog channels. - - return true; -} - - -/******************************************************************************/ - - -db_basic_rx::db_basic_rx(usrp_basic_sptr usrp, int which, int subdev) - : db_base(usrp, which) -{ - // Handler for Basic Rx daughterboards. - // - // @param usrp: instance of usrp.source_c - // @param which: which side: 0 or 1 corresponding to TX_A or TX_B respectively - // @param subdev: which analog i/o channel: 0 or 1 - // @type subdev: int - - d_subdev = subdev; - - bypass_adc_buffers(true); - - if(0) { // Doing this would give us a different default than the historical values... - set_gain(float(gain_min() + gain_max()) / 2.0); // initialize gain - } -} - -db_basic_rx::~db_basic_rx() -{ -} - -double -db_basic_rx::freq_min() -{ - return -90e9; -} - -double -db_basic_rx::freq_max() -{ - return 90e9; -} - -struct freq_result_t -db_basic_rx::set_freq(double target_freq) -{ - // Set the frequency. - // - // @param freq: target RF frequency in Hz - // @type freq: double - // - // @returns (ok, actual_baseband_freq) where: - // ok is True or False and indicates success or failure, - // actual_baseband_freq is the RF frequency that corresponds to DC in the IF. - - struct freq_result_t args = {true, 0.0}; - return args; -} - -float -db_basic_rx::gain_min() -{ - return usrp()->pga_min(); -} - -float -db_basic_rx::gain_max() -{ - return usrp()->pga_max(); -} - -float -db_basic_rx::gain_db_per_step() -{ - return usrp()->pga_db_per_step(); -} - -bool -db_basic_rx::set_gain(float gain) -{ - // Set the gain. - // - // @param gain: gain in decibels - // @returns True/False - - return usrp()->set_pga(d_which * 2 + d_subdev, gain); -} - -bool -db_basic_rx::is_quadrature() -{ - // Return True if this board requires both I & Q analog channels. - - // This bit of info is useful when setting up the USRP Rx mux register. - - return (d_subdev == 2); -} - - - -/******************************************************************************/ - - -db_lf_tx::db_lf_tx(usrp_basic_sptr usrp, int which) - : db_basic_tx(usrp, which) -{ - // Handler for Low Freq Tx daughterboards. - // - // @param usrp: instance of usrp.source_c - // @param which: which side: 0 or 1 corresponding to RX_A or RX_B respectively -} - -db_lf_tx::~db_lf_tx() -{ -} - -double -db_lf_tx::freq_min() -{ - return -32e6; -} - -double -db_lf_tx::freq_max() -{ - return 32e6; -} - -/******************************************************************************/ - - -db_lf_rx::db_lf_rx(usrp_basic_sptr usrp, int which, int subdev) - : db_basic_rx(usrp, which, subdev) -{ - // Handler for Low Freq Rx daughterboards. - // - // @param usrp: instance of usrp.source_c - // @param which: which side: 0 or 1 corresponding to RX_A or RX_B respectively - // @param subdev: which analog i/o channel: 0 or 1 - // @type subdev: int -} - -db_lf_rx::~db_lf_rx() -{ -} - -double -db_lf_rx::freq_min() -{ - return 0.0; -} - -double -db_lf_rx::freq_max() -{ - return 32e6; -} - - diff --git a/usrp/host/lib/db_bitshark_rx.cc b/usrp/host/lib/db_bitshark_rx.cc deleted file mode 100644 index 5368866d8..000000000 --- a/usrp/host/lib/db_bitshark_rx.cc +++ /dev/null @@ -1,417 +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 asversion 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/db_bitshark_rx.h> -#include <db_base_impl.h> -#include <cmath> -#include <cstdio> -#include <string.h> -#include <stdint.h> - -/* Note: Thie general structure of this file is based on the db_dbsrx.cc - codebase for the dbsrx daughterboard. */ - -/* The following defines specify the address map provided by the - Bitshark card. These registers are all accessed over I2C. */ -#define RF_CENTER_FREQ_REG 0x00 -#define RF_CHAN_FILTER_BW_REG 0x01 -#define RF_GAIN_REG 0x02 -#define BB_GAIN_REG 0x03 -#define ADF4350_REG 0x10 -#define SKY73202_REG 0x11 -#define CLOCK_SCHEME_REG 0x20 - -/* The following table lists the registers provided by the BURX board that - are accessible over I2C: - -------------------------------------------------------- - |RegAddr: 0x00-RF Center Freq register | - |4-bytes 0x00| - |4-byte unsigned RF center freq (in KHz)| - |RegAddr: 0x01-RF channel filter bandwidth register | - |4-bytes 0x00| - |4-byte unsigned RF channel filter bw (in KHz)| - |RegAddr: 0x02-RF gain register | - |7-bytes 0x00| - |1-byte signed RF gain (in dB)| - |RegAddr: 0x03-Baseband gain register | - |4-bytes 0x00| - |4-byte signed baseband filter gain (in dB)| - |RegAddr: 0x10-ADF4350 register | - |4-bytes 0x00| - |4-byte ADF4350 register value (actual ADF4350 reg addr embedded - within 4-byte value)| - |RegAddr: 0x11-SKY73202 register | - |5-bytes 0x00| - |1-byte reg 0 of SKY73202 | - |1-byte reg 1 of SKY73202 | - |1-byte reg 2 of SKY73202 | - |RegAddr: 0x20-Clock Scheme | - |3-bytes 0x00| - |1-byte indicating clocking scheme: - -0x00 -> BURX local TCXO off, BURX accepts ref clock from - USRP (freq of USRP's ref clock specified in bytes 2-5) - -0x01 -> BURX local TCXO on, BURX uses its local TCXO as its ref - clock, TCXO signal output for use by USRP | - |4-byte USRP ref clock freq in hz (only needed if byte 1 set to 0x00) | - - --------------------------------------------------------------------------- - - As an example, lets say the client wants to set an RF center freq of - 1000 MHz. In KHz, this translates to 1000000 (resolution is only down to - steps of 1 KHz), which is 0x000F4240 in hex. So the complete 9-byte I2C - sequence that the client should send is as follows: - byte 0: 0x00-register 0x00 is the target of the write operation - bytes 1-4: 0x00 (padding) - byte 5: 0x40 (LSB of the 1000000 KHz value, in hex) - byte 6: 0x42 - byte 7: 0x0F - byte 8: 0x00 (MSB of the 1000000 KHz value, in hex) - - If using the usrper cmd-line application on a PC, this sequence would - be sent as follows (assuming that the BURX is in slot A): - - # usrper i2c_write 0x47 000000000040420F00 - - How about another example...lets say the client wants to setup the clock - scheme to use scheme #1 where the 26 MHz TCXO on the BURX board is enabled, - and is provided to the USRP. 26 MHz (i.e. 26 million), in hex, is 0x18CBA80. - So the complete 9-byte I2C sequence that the client should send is as follows: - byte 0: 0x20-register 0x20 is the target of the write operation - bytes 1-3: 0x00 (padding) - byte 4: 0x01 (indicating that clock scheme #1 is wanted) - byte 5: 0x80 (LSB of the BURX ref clk freq) - byte 6: 0xBA - byte 7: 0x8C - byte 8: 0x01 (MSB of the BURX ref clk freq) - - To enable the BURX local ref clk, which will also make it available on the - on-board U.FL connector as a source for the USRP, a user can also use - the usrper cmd-line application on a PC. The following sequence would - be sent (assuming that the BURX is in slot A): - - # usrper i2c_write 0x47 200000000180BA8C01 - -*/ - -#define NUM_BYTES_IN_I2C_CMD 9 - -/*****************************************************************************/ - -db_bitshark_rx::db_bitshark_rx(usrp_basic_sptr _usrp, int which) - : db_base(_usrp, which) -{ - // Control Bitshark receiver USRP daughterboard. - // - // @param usrp: instance of usrp.source_c - // @param which: which side: 0, 1 corresponding to RX_A or RX_B respectively - - // turn off all outputs - usrp()->_write_oe(d_which, 0, 0xffff); - - if (which == 0) - { - d_i2c_addr = 0x47; - } - else - { - d_i2c_addr = 0x45; - } - - // initialize gain - set_gain((gain_min() + gain_max()) / 2.0); - - // by default, assume we're using the USRPs clock as the ref clk, - // so setup the clock scheme and frequency. If the user wants - // to use the Bitshark's TCXO, the clock scheme should be set - // to 1, the freq should be set to 26000000, and a top-level - // 'make' and 'make install' needs to be executed. In addition, - // a U.FL to SMA cable needs to connect J6 on the Bitshark to - // the external clk input on the USRP - set_clock_scheme(0,64000000); - - set_bw(8e6); // Default IF bandwidth to match USRP1 max host bandwidth - - bypass_adc_buffers(true); -} - -db_bitshark_rx::~db_bitshark_rx() -{ - shutdown(); -} - -/************ Private Functions **********************/ - -void -db_bitshark_rx::_set_pga(int pga_gain) -{ - assert(pga_gain>=0 && pga_gain<=20); - if(d_which == 0) - { - usrp()->set_pga (0, pga_gain); - usrp()->set_pga (1, pga_gain); - } - else - { - usrp()->set_pga (2, pga_gain); - usrp()->set_pga (3, pga_gain); - } -} - -/************ Public Functions **********************/ -void -db_bitshark_rx::shutdown() -{ - if (!d_is_shutdown) - { - d_is_shutdown = true; - } -} - -bool -db_bitshark_rx::set_bw (float bw) -{ - std::vector<int> args(NUM_BYTES_IN_I2C_CMD,0); - uint16_t rf_bw_in_khz = (uint16_t)(bw/1000.0); - char val[4]; - bool result = false; - uint8_t try_count = 0; - - memset(val,0x00,4); - if (rf_bw_in_khz < 660 || rf_bw_in_khz > 56000) - { - fprintf(stderr, "db_bitshark_rx::set_bw: bw (=%d) must be between 660 KHz and 56 MHz inclusive\n", rf_bw_in_khz); - return false; - } - //fprintf(stdout,"Setting bw: requested bw in khz is %d\r\n",rf_bw_in_khz); - memcpy(val,&rf_bw_in_khz,4); - args[0] = RF_CHAN_FILTER_BW_REG; - args[5] = val[0]; - args[6] = val[1]; - args[7] = val[2]; - args[8] = val[3]; - while ((result != true) && (try_count < 3)) - { - result=usrp()->write_i2c (d_i2c_addr, int_seq_to_str (args)); - try_count++; - } - - if (result == false) - { - fprintf(stderr, "db_bitshark_rx:set_bw: giving up after 3 tries without success\n"); - } - - return result; -} - -/* The gain referenced below is RF gain only. There are two independent - gain settings at RF: a digital step attenuator (providing 0, -6, -12, and - -18 dB of attenuation), and a second LNA (LNA2) that provides ~25 dB of - gain (roughly...it actually depends on the RF freq). So combining these - two stages can provide an overall gain range from 0 (which is mapped - to -18 dB on the step attenuator + LNA2 turned off) to 42 (which is - mapped to 0 dB on the step attenuator + LNA2 turned on). - - There could be better ways to map these, but this is sufficient for - now. */ -float -db_bitshark_rx::gain_min() -{ - return 0; -} - -float -db_bitshark_rx::gain_max() -{ - return 42; -} - -float -db_bitshark_rx::gain_db_per_step() -{ - return 6; -} - -bool -db_bitshark_rx::set_gain(float gain) -{ - // Set the gain. - // - // @param gain: RF gain in decibels, range of 0-42 - // @returns True/False - - std::vector<int> args(NUM_BYTES_IN_I2C_CMD,0); - bool result = false; - uint8_t try_count = 0; - - if (gain < gain_min() || gain > gain_max()) - { - fprintf(stderr,"db_bitshark_rx::set_gain: gain (=%f) must be between %f and %f inclusive\n", gain,gain_min(),gain_max()); - return false; - } - //fprintf(stdout,"db_bitshark_rx::set_gain: requested gain of %f\r\n",gain); - args[0] = RF_GAIN_REG; - args[5] = (int)gain; - - while ((result != true) && (try_count < 3)) - { - result=usrp()->write_i2c (d_i2c_addr, int_seq_to_str (args)); - try_count++; - } - - if (result == false) - { - fprintf(stderr, "db_bitshark_rx:set_gain: giving up after 3 tries without success\n"); - } - - return result; -} - - -bool -db_bitshark_rx::set_clock_scheme(uint8_t clock_scheme, uint32_t ref_clk_freq) -{ - // Set the clock scheme for determining how the BURX - // dboard receives its clock. Note: Ideally, the constructor for the - // BURX board could simply call this method to set how it wants the - // clock scheme configured. However, depending on the application - // using the daughterboard, the constructor may run _after_ some - // other portion of the application needs the FPGA. And if the - // the clock source for the FPGA was the BURX's 26 MHz TCXO, we're in - // a chicken-before-the-egg dilemna. So the solution is to leave - // this function here for reference in case an app wants to use it, - // and also give the user the ability to set the clock scheme through - // the usrper cmd-line application (see example at the top of this - // file). - // - // @param clock_scheme - // @param ref_clk_freq in Hz - // @returns True/False - - std::vector<int> args(NUM_BYTES_IN_I2C_CMD,0); - bool result = false; - uint8_t try_count = 0; - char val[4]; - - if (clock_scheme > 1) - { - fprintf(stderr,"db_bitshark_rx::set_clock_scheme: invalid scheme %d\n",clock_scheme); - return false; - } - //fprintf(stdout,"db_bitshark_rx::set_clock_scheme: requested clock schem of %d with freq %d Hz \n",clock_scheme,ref_clk_freq); - memcpy(val,&ref_clk_freq,4); - args[0] = CLOCK_SCHEME_REG; - args[4] = (int)clock_scheme; - args[5] = val[0]; - args[6] = val[1]; - args[7] = val[2]; - args[8] = val[3]; - - while ((result != true) && (try_count < 3)) - { - result=usrp()->write_i2c (d_i2c_addr, int_seq_to_str (args)); - try_count++; - } - - if (result == false) - { - fprintf(stderr, "db_bitshark_rx:set_clock_scheme: giving up after 3 tries without success\n"); - } - return result; -} - -double -db_bitshark_rx::freq_min() -{ - return 300e6; -} - -double -db_bitshark_rx::freq_max() -{ - return 4e9; -} - -struct freq_result_t -db_bitshark_rx::set_freq(double freq) -{ - // Set the frequency. - // - // @param freq: target RF frequency in Hz - // @type freq: double - // - // @returns (ok, actual_baseband_freq) where: - // ok is True or False and indicates success or failure, - // actual_baseband_freq is RF frequency that corresponds to DC in the IF. - - std::vector<int> args(NUM_BYTES_IN_I2C_CMD,0); - std::vector<int> bytes(2); - char val[4]; - freq_result_t act_freq = {false, 0}; - uint32_t freq_in_khz = (uint32_t)(freq/1000.0); - bool result = false; - uint8_t try_count = 0; - - memset(val,0x00,4); - if(!(freq>=freq_min() && freq<=freq_max())) - { - return act_freq; - } - - //fprintf(stdout,"db_bitshark_rx::set_freq: requested freq is %d KHz\n",freq_in_khz); - memcpy(val,&freq_in_khz,4); - args[0] = RF_CENTER_FREQ_REG; - args[5] = val[0]; - args[6] = val[1]; - args[7] = val[2]; - args[8] = val[3]; - - while ((result != true) && (try_count < 3)) - { - result=usrp()->write_i2c (d_i2c_addr, int_seq_to_str (args)); - try_count++; - } - - if (result == false) - { - fprintf(stderr, "db_bitshark_rx:set_freq: giving up after 3 tries without success\n"); - } - - act_freq.ok = result; - act_freq.baseband_freq = (double)freq; - return act_freq; -} - -bool -db_bitshark_rx::is_quadrature() -{ - // Return True if this board requires both I & Q analog channels. - return true; -} - -bool -db_bitshark_rx::i_and_q_swapped() -{ - // Returns True since our I and Q channels are swapped - return true; -} diff --git a/usrp/host/lib/db_boards.cc b/usrp/host/lib/db_boards.cc deleted file mode 100644 index 9324d58ee..000000000 --- a/usrp/host/lib/db_boards.cc +++ /dev/null @@ -1,244 +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 asversion 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 <db_boards.h> -#include <usrp/usrp_dbid.h> -#include <usrp/db_basic.h> -#include <usrp/db_tv_rx.h> -#include <usrp/db_tv_rx_mimo.h> -#include <usrp/db_dbs_rx.h> -#include <usrp/db_flexrf.h> -#include <usrp/db_flexrf_mimo.h> -#include <usrp/db_wbxng.h> -#include <usrp/db_xcvr2450.h> -#include <usrp/db_dtt754.h> -#include <usrp/db_dtt768.h> -#include <usrp/db_bitshark_rx.h> -#include <cstdio> - -std::vector<db_base_sptr> -instantiate_dbs(int dbid, usrp_basic_sptr usrp, int which_side) -{ - std::vector<db_base_sptr> db; - - switch(dbid) { - - case(USRP_DBID_BASIC_TX): - db.push_back(db_base_sptr(new db_basic_tx(usrp, which_side))); - break; - - case(USRP_DBID_BASIC_RX): - db.push_back(db_base_sptr(new db_basic_rx(usrp, which_side, 0))); - db.push_back(db_base_sptr(new db_basic_rx(usrp, which_side, 1))); - db.push_back(db_base_sptr(new db_basic_rx(usrp, which_side, 2))); - break; - - case(USRP_DBID_LF_TX): - db.push_back(db_base_sptr(new db_lf_tx(usrp, which_side))); - break; - - case(USRP_DBID_LF_RX): - db.push_back(db_base_sptr(new db_lf_rx(usrp, which_side, 0))); - db.push_back(db_base_sptr(new db_lf_rx(usrp, which_side, 1))); - db.push_back(db_base_sptr(new db_lf_rx(usrp, which_side, 2))); - break; - - case(USRP_DBID_DBS_RX): - db.push_back(db_base_sptr(new db_dbs_rx(usrp, which_side))); - break; - - case(USRP_DBID_TV_RX): - db.push_back(db_base_sptr(new db_tv_rx(usrp, which_side, 43.75e6, 5.75e6))); - break; - case(USRP_DBID_TV_RX_REV_2): - db.push_back(db_base_sptr(new db_tv_rx(usrp, which_side, 44e6, 20e6))); - break; - case(USRP_DBID_TV_RX_REV_3): - db.push_back(db_base_sptr(new db_tv_rx(usrp, which_side, 44e6, 20e6))); - break; - case(USRP_DBID_TV_RX_MIMO): - db.push_back(db_base_sptr(new db_tv_rx_mimo(usrp, which_side, 43.75e6, 5.75e6))); - break; - case(USRP_DBID_TV_RX_REV_2_MIMO): - db.push_back(db_base_sptr(new db_tv_rx_mimo(usrp, which_side, 44e6, 20e6))); - break; - case(USRP_DBID_TV_RX_REV_3_MIMO): - db.push_back(db_base_sptr(new db_tv_rx_mimo(usrp, which_side, 44e6, 20e6))); - break; - - case(USRP_DBID_FLEX_2400_TX): - db.push_back(db_base_sptr(new db_flexrf_2400_tx(usrp, which_side))); - break; - case(USRP_DBID_FLEX_2400_RX): - db.push_back(db_base_sptr(new db_flexrf_2400_rx(usrp, which_side))); - break; - case(USRP_DBID_FLEX_1200_TX): - db.push_back(db_base_sptr(new db_flexrf_1200_tx(usrp, which_side))); - break; - case(USRP_DBID_FLEX_1200_RX): - db.push_back(db_base_sptr(new db_flexrf_1200_rx(usrp, which_side))); - break; - case(USRP_DBID_FLEX_1800_TX): - db.push_back(db_base_sptr(new db_flexrf_1800_tx(usrp, which_side))); - break; - case(USRP_DBID_FLEX_1800_RX): - db.push_back(db_base_sptr(new db_flexrf_1800_rx(usrp, which_side))); - break; - case(USRP_DBID_FLEX_900_TX): - db.push_back(db_base_sptr(new db_flexrf_900_tx(usrp, which_side))); - break; - case(USRP_DBID_FLEX_900_RX): - db.push_back(db_base_sptr(new db_flexrf_900_rx(usrp, which_side))); - break; - case(USRP_DBID_FLEX_400_TX): - db.push_back(db_base_sptr(new db_flexrf_400_tx(usrp, which_side))); - break; - case(USRP_DBID_FLEX_400_RX): - db.push_back(db_base_sptr(new db_flexrf_400_rx(usrp, which_side))); - break; - case(USRP_DBID_FLEX_2400_TX_MIMO_A): - db.push_back(db_base_sptr(new db_flexrf_2400_tx_mimo_a(usrp, which_side))); - break; - case(USRP_DBID_FLEX_2400_RX_MIMO_A): - db.push_back(db_base_sptr(new db_flexrf_2400_rx_mimo_a(usrp, which_side))); - break; - case(USRP_DBID_FLEX_1800_TX_MIMO_A): - db.push_back(db_base_sptr(new db_flexrf_1800_tx_mimo_a(usrp, which_side))); - break; - case(USRP_DBID_FLEX_1800_RX_MIMO_A): - db.push_back(db_base_sptr(new db_flexrf_1800_rx_mimo_a(usrp, which_side))); - break; - case(USRP_DBID_FLEX_1200_TX_MIMO_A): - db.push_back(db_base_sptr(new db_flexrf_1200_tx_mimo_a(usrp, which_side))); - break; - case(USRP_DBID_FLEX_1200_RX_MIMO_A): - db.push_back(db_base_sptr(new db_flexrf_1200_rx_mimo_a(usrp, which_side))); - break; - case(USRP_DBID_FLEX_900_TX_MIMO_A): - db.push_back(db_base_sptr(new db_flexrf_900_tx_mimo_a(usrp, which_side))); - break; - case(USRP_DBID_FLEX_900_RX_MIMO_A): - db.push_back(db_base_sptr(new db_flexrf_900_rx_mimo_a(usrp, which_side))); - break; - case(USRP_DBID_FLEX_400_TX_MIMO_A): - db.push_back(db_base_sptr(new db_flexrf_400_tx_mimo_a(usrp, which_side))); - break; - case(USRP_DBID_FLEX_400_RX_MIMO_A): - db.push_back(db_base_sptr(new db_flexrf_400_rx_mimo_a(usrp, which_side))); - break; - case(USRP_DBID_FLEX_2400_TX_MIMO_B): - db.push_back(db_base_sptr(new db_flexrf_2400_tx_mimo_b(usrp, which_side))); - break; - case(USRP_DBID_FLEX_2400_RX_MIMO_B): - db.push_back(db_base_sptr(new db_flexrf_2400_rx_mimo_b(usrp, which_side))); - break; - case(USRP_DBID_FLEX_1800_TX_MIMO_B): - db.push_back(db_base_sptr(new db_flexrf_1800_tx_mimo_b(usrp, which_side))); - break; - case(USRP_DBID_FLEX_1800_RX_MIMO_B): - db.push_back(db_base_sptr(new db_flexrf_1800_rx_mimo_b(usrp, which_side))); - break; - case(USRP_DBID_FLEX_1200_TX_MIMO_B): - db.push_back(db_base_sptr(new db_flexrf_1200_tx_mimo_b(usrp, which_side))); - break; - case(USRP_DBID_FLEX_1200_RX_MIMO_B): - db.push_back(db_base_sptr(new db_flexrf_1200_rx_mimo_b(usrp, which_side))); - break; - case(USRP_DBID_FLEX_900_TX_MIMO_B): - db.push_back(db_base_sptr(new db_flexrf_900_tx_mimo_b(usrp, which_side))); - break; - case(USRP_DBID_FLEX_900_RX_MIMO_B): - db.push_back(db_base_sptr(new db_flexrf_900_rx_mimo_b(usrp, which_side))); - break; - case(USRP_DBID_FLEX_400_TX_MIMO_B): - db.push_back(db_base_sptr(new db_flexrf_400_tx_mimo_b(usrp, which_side))); - break; - case(USRP_DBID_FLEX_400_RX_MIMO_B): - db.push_back(db_base_sptr(new db_flexrf_400_rx_mimo_b(usrp, which_side))); - break; - - case(USRP_DBID_XCVR2450_TX): - db.push_back(db_base_sptr(new db_xcvr2450_tx(usrp, which_side))); - break; - case(USRP_DBID_XCVR2450_RX): - db.push_back(db_base_sptr(new db_xcvr2450_rx(usrp, which_side))); - break; - -#if 0 // FIXME wbx doesn't compile - case(USRP_DBID_WBX_LO_TX): - db.push_back(db_base_sptr(new db_wbx_lo_tx(usrp, which_side))); - break; - case(USRP_DBID_WBX_LO_RX): - db.push_back(db_base_sptr(new db_wbx_lo_rx(usrp, which_side))); - break; -#endif - - case(USRP_DBID_WBX_NG_TX): - db.push_back(db_base_sptr(new db_wbxng_tx(usrp, which_side))); - break; - case(USRP_DBID_WBX_NG_RX): - db.push_back(db_base_sptr(new db_wbxng_rx(usrp, which_side))); - break; - - case(USRP_DBID_DTT754): - db.push_back(db_base_sptr(new db_dtt754(usrp, which_side))); - break; - case(USRP_DBID_DTT768): - db.push_back(db_base_sptr(new db_dtt768(usrp, which_side))); - break; - - case(USRP_DBID_BITSHARK_RX): - db.push_back(db_base_sptr(new db_bitshark_rx(usrp, which_side))); - break; - - case(-1): - if (boost::dynamic_pointer_cast<usrp_basic_tx>(usrp)){ - db.push_back(db_base_sptr(new db_basic_tx(usrp, which_side))); - } - else { - db.push_back(db_base_sptr(new db_basic_rx(usrp, which_side, 0))); - db.push_back(db_base_sptr(new db_basic_rx(usrp, which_side, 1))); - } - break; - - case(-2): - default: - if (boost::dynamic_pointer_cast<usrp_basic_tx>(usrp)){ - fprintf(stderr, "\n\aWarning: Treating daughterboard with invalid EEPROM contents as if it were a \"Basic Tx.\"\n"); - fprintf(stderr, "Warning: This is almost certainly wrong... Use appropriate burn-*-eeprom utility.\n\n"); - db.push_back(db_base_sptr(new db_basic_tx(usrp, which_side))); - } - else { - fprintf(stderr, "\n\aWarning: Treating daughterboard with invalid EEPROM contents as if it were a \"Basic Rx.\"\n"); - fprintf(stderr, "Warning: This is almost certainly wrong... Use appropriate burn-*-eeprom utility.\n\n"); - db.push_back(db_base_sptr(new db_basic_rx(usrp, which_side, 0))); - db.push_back(db_base_sptr(new db_basic_rx(usrp, which_side, 1))); - } - break; - } - - return db; -} diff --git a/usrp/host/lib/db_boards.h b/usrp/host/lib/db_boards.h deleted file mode 100644 index 136091c53..000000000 --- a/usrp/host/lib/db_boards.h +++ /dev/null @@ -1,33 +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 asversion 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 DB_BOARDS_H -#define DB_BOARDS_H - -#include <usrp/db_base.h> -#include <usrp/usrp_basic.h> - -std::vector<db_base_sptr> instantiate_dbs(int dbid, usrp_basic_sptr usrp, int which_side); - -#endif - - diff --git a/usrp/host/lib/db_dbs_rx.cc b/usrp/host/lib/db_dbs_rx.cc deleted file mode 100644 index 7fe8c4951..000000000 --- a/usrp/host/lib/db_dbs_rx.cc +++ /dev/null @@ -1,501 +0,0 @@ -// -// 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 asversion 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/db_dbs_rx.h> -#include <db_base_impl.h> -#include <cmath> -#include <cstdio> - - -/*****************************************************************************/ - - -db_dbs_rx::db_dbs_rx(usrp_basic_sptr _usrp, int which) - : db_base(_usrp, which) -{ - // Control DBS receiver based USRP daughterboard. - // - // @param usrp: instance of usrp.source_c - // @param which: which side: 0, 1 corresponding to RX_A or RX_B respectively - - usrp()->_write_oe(d_which, 0x0001, 0x0001); - if(which == 0) { - d_i2c_addr = 0x67; - } - else { - d_i2c_addr = 0x65; - } - - d_n = 950; - d_div2 = 0; - d_osc = 5; - d_cp = 3; - d_r = 4; - d_r_int = 1; - d_fdac = 127; - d_m = 2; - d_dl = 0; - d_ade = 0; - d_adl = 0; - d_gc1 = 0; - d_gc2 = 31; - d_diag = 0; - - _enable_refclk(true); - - set_gain((gain_min() + gain_max()) / 2.0); // initialize gain - - bypass_adc_buffers(true); -} - -db_dbs_rx::~db_dbs_rx() -{ - shutdown(); -} - -void -db_dbs_rx::shutdown() -{ - if (!d_is_shutdown){ - d_is_shutdown = true; - // do whatever there is to do to shutdown orderly - _enable_refclk(false); - } -} - -void -db_dbs_rx::_write_reg (int regno, int v) -{ - //regno is in [0,5], v is value to write to register""" - assert (0 <= regno && regno <= 5); - std::vector<int> args(2); - args[0] = regno; - args[1] = v; - usrp()->write_i2c (d_i2c_addr, int_seq_to_str (args)); -} - -void -db_dbs_rx::_write_regs (int starting_regno, const std::vector<int> &vals) -{ - // starting_regno is in [0,5], - // vals is a seq of integers to write to consecutive registers""" - - //FIXME - std::vector<int> args; - args.push_back(starting_regno); - args.insert(args.end(), vals.begin(), vals.end()); - usrp()->write_i2c (d_i2c_addr, int_seq_to_str (args)); -} - -std::vector<int> -db_dbs_rx::_read_status () -{ - //If successful, return list of two ints: [status_info, filter_DAC]""" - std::string s = usrp()->read_i2c (d_i2c_addr, 2); - if(s.size() != 2) { - std::vector<int> ret(0); - return ret; - } - return str_to_int_seq (s); -} - -void -db_dbs_rx::_send_reg(int regno) -{ - assert(0 <= regno && regno <= 5); - if(regno == 0) - _write_reg(0,(d_div2<<7) + (d_n>>8)); - if(regno == 1) - _write_reg(1,d_n & 255); - if(regno == 2) - _write_reg(2,d_osc + (d_cp<<3) + (d_r_int<<5)); - if(regno == 3) - _write_reg(3,d_fdac); - if(regno == 4) - _write_reg(4,d_m + (d_dl<<5) + (d_ade<<6) + (d_adl<<7)); - if(regno == 5) - _write_reg(5,d_gc2 + (d_diag<<5)); -} - -// BW setting -void -db_dbs_rx::_set_m(int m) -{ - assert(m>0 && m<32); - d_m = m; - _send_reg(4); -} - -void -db_dbs_rx::_set_fdac(int fdac) -{ - assert(fdac>=0 && fdac<128); - d_fdac = fdac; - _send_reg(3); -} - -bool -db_dbs_rx::set_bw (float bw) -{ - if (bw < 1e6 || bw > 33e6) { - fprintf(stderr, "db_dbs_rx::set_bw: bw (=%f) must be between 1e6 and 33e6 inclusive\n", bw); - return false; - } - - // struct bw_t ret = {0, 0, 0}; - int m_max, m_min, m_test, fdac_test; - if(bw >= 4e6) - m_max = int(std::min(31, (int)floor(_refclk_freq()/1e6))); - else if(bw >= 2e6) // Outside of Specs! - m_max = int(std::min(31, (int)floor(_refclk_freq()/.5e6))); - else // Way outside of Specs! - m_max = int(std::min(31, (int)floor(_refclk_freq()/.25e6))); - - m_min = int(ceil(_refclk_freq()/2.5e6)); - m_test = m_max; - while(m_test >= m_min) { - fdac_test = static_cast<int>(round(((bw * m_test / _refclk_freq())-4)/.145)); - if(fdac_test > 127) - m_test = m_test - 1; - else - break; - } - - if(m_test>=m_min && fdac_test>=0) { - _set_m(m_test); - _set_fdac(fdac_test); - - //ret.m = d_m; - //ret.fdac = d_fdac; - //ret.div = _refclk_freq()/d_m*(4+0.145*d_fdac); - } - else { - fprintf(stderr, "db_dbs_rx::set_bw: failed\n"); - return false; - } - - return true; -} - -// Gain setting -void -db_dbs_rx::_set_dl(int dl) -{ - assert(dl == 0 || dl == 1); - d_dl = dl; - _send_reg(4); -} - -void -db_dbs_rx::_set_gc2(int gc2) -{ - assert(gc2<32 && gc2>=0); - d_gc2 = gc2; - _send_reg(5); -} - -void -db_dbs_rx::_set_gc1(int gc1) -{ - assert(gc1>=0 && gc1<4096); - d_gc1 = gc1; - usrp()->write_aux_dac(d_which, 0, gc1); -} - -void -db_dbs_rx::_set_pga(int pga_gain) -{ - assert(pga_gain>=0 && pga_gain<=20); - if(d_which == 0) { - usrp()->set_pga (0, pga_gain); - usrp()->set_pga (1, pga_gain); - } - else { - usrp()->set_pga (2, pga_gain); - usrp()->set_pga (3, pga_gain); - } -} - -float -db_dbs_rx::gain_min() -{ - return 0; -} - -float -db_dbs_rx::gain_max() -{ - return 104; -} - -float -db_dbs_rx::gain_db_per_step() -{ - return 1; -} - -bool -db_dbs_rx::set_gain(float gain) -{ - // Set the gain. - // - // @param gain: gain in decibels - // @returns True/False - - if(!(gain>=0 && gain<105)) { - throw std::runtime_error("gain out of range\n"); - } - - int gc1=0, gc2=0, dl=0, pga=0; - - if(gain < 56) { - gc1 = int((-gain*1.85/56.0 + 2.6)*4096.0/3.3); - gain = 0; - } - else { - gc1 = 0; - gain -= 56; - } - - if(gain < 24) { - gc2 = static_cast<int>(round(31.0 * (1-gain/24.0))); - gain = 0; - } - else { - gc2 = 0; - gain -=24; - } - - if(gain >= 4.58) { - dl = 1; - gain -= 4.58; - } - - pga = gain; - _set_gc1(gc1); - _set_gc2(gc2); - _set_dl(dl); - _set_pga(pga); - - return true; -} - -// Frequency setting -void -db_dbs_rx::_set_osc(int osc) -{ - assert(osc>=0 && osc<8); - d_osc = osc; - _send_reg(2); -} - -void -db_dbs_rx::_set_cp(int cp) -{ - assert(cp>=0 && cp<4); - d_cp = cp; - _send_reg(2); -} - -void -db_dbs_rx::_set_n(int n) -{ - assert(n>256 && n<32768); - d_n = n; - _send_reg(0); - _send_reg(1); -} - -void -db_dbs_rx::_set_div2(int div2) -{ - assert(div2 == 0 || div2 == 1); - d_div2 = div2; - _send_reg(0); -} - -void -db_dbs_rx::_set_r(int r) -{ - assert(r>=0 && r<128); - d_r = r; - d_r_int = static_cast<int>(round(log10(r)/log10(2)) - 1); - _send_reg(2); -} - -// FIXME How do we handle ADE and ADL properly? -void -db_dbs_rx::_set_ade(int ade) -{ - assert(ade == 0 || ade == 1); - d_ade = ade; - _send_reg(4); -} - -double -db_dbs_rx::freq_min() -{ - return 500e6; -} - -double -db_dbs_rx::freq_max() -{ - return 2.6e9; -} - -struct freq_result_t -db_dbs_rx::set_freq(double freq) -{ - // Set the frequency. - // - // @param freq: target RF frequency in Hz - // @type freq: double - // - // @returns (ok, actual_baseband_freq) where: - // ok is True or False and indicates success or failure, - // actual_baseband_freq is RF frequency that corresponds to DC in the IF. - - freq_result_t args = {false, 0}; - - if(!(freq>=freq_min() && freq<=freq_max())) { - return args; - } - - double vcofreq; - if(freq<1150e6) { - _set_div2(0); - vcofreq = 4 * freq; - } - else { - _set_div2(1); - vcofreq = 2 * freq; - } - - _set_ade(1); - int rmin = std::max(2, (int)(_refclk_freq()/2e6)); - int rmax = std::min(128, (int)(_refclk_freq()/500e3)); - int r = 2; - int n = 0; - int best_r = 2; - int best_n = 0; - int best_delta = 10e6; - int delta; - - while(r <= rmax) { - n = static_cast<int>(round(freq/(_refclk_freq()/r))); - if(r<rmin || n<256) { - r = r * 2; - continue; - } - delta = (int)fabs(n*_refclk_freq()/r - freq); - if(delta < 75e3) { - best_r = r; - best_n = n; - break; - } - if(delta < best_delta*0.9) { - best_r = r; - best_n = n; - best_delta = delta; - } - r = r * 2; - } - _set_r(best_r); - - _set_n(static_cast<int>(round(best_n))); - - int vco; - if(vcofreq < 2433e6) - vco = 0; - else if(vcofreq < 2711e6) - vco=1; - else if(vcofreq < 3025e6) - vco=2; - else if(vcofreq < 3341e6) - vco=3; - else if(vcofreq < 3727e6) - vco=4; - else if(vcofreq < 4143e6) - vco=5; - else if(vcofreq < 4493e6) - vco=6; - else - vco=7; - - _set_osc(vco); - - // Set CP current - int adc_val = 0; - std::vector<int> bytes(2); - while(adc_val == 0 || adc_val == 7) { - bytes = _read_status(); - adc_val = bytes[0] >> 2; - if(adc_val == 0) { - if(vco <= 0) { - return args; - } - else { - vco = vco - 1; - } - } - else if(adc_val == 7) { - if(vco >= 7) { - return args; - } - else { - vco = vco + 1; - } - } - _set_osc(vco); - } - - if(adc_val == 1 || adc_val == 2) { - _set_cp(1); - } - else if(adc_val == 3 || adc_val == 4) { - _set_cp(2); - } - else { - _set_cp(3); - } - - args.ok = true; - args.baseband_freq = d_n * _refclk_freq() / d_r; - return args; -} - -int -db_dbs_rx::_refclk_divisor() -{ - //Return value to stick in REFCLK_DIVISOR register - return 16; -} - -bool -db_dbs_rx::is_quadrature() -{ - // Return True if this board requires both I & Q analog channels. - return true; -} diff --git a/usrp/host/lib/db_dtt754.cc b/usrp/host/lib/db_dtt754.cc deleted file mode 100644 index 9ced705e4..000000000 --- a/usrp/host/lib/db_dtt754.cc +++ /dev/null @@ -1,327 +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 asversion 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/db_dtt754.h> -#include <db_base_impl.h> - -int -control_byte_1() -{ - int RS = 0; // 0 = 166.66kHz reference - int ATP = 7; // Disable internal AGC - return (0x80 | ATP<<3 | RS); -} - -int -control_byte_2() -{ - int STBY = 0; // powered on - int XTO = 1; // turn off xtal out, which we don't have - int ATC = 0; // not clear exactly, possibly speeds up or slows down AGC, which we are not using - - int c = 0xc2 | ATC<<5 | STBY<<4 | XTO; - return c; -} - -int -bandswitch_byte(float freq, float bw) -{ - int P5, CP, BS; - - if(bw>7.5e6) { - P5 = 1; - } - else { - P5 = 0; - } - - if(freq < 121e6) { - CP = 0; - BS = 1; - } - else if(freq < 141e6) { - CP = 1; - BS = 1; - } - else if(freq < 166e6) { - CP = 2; - BS = 1; - } - else if(freq < 182e6) { - CP = 3; - BS = 1; - } - else if(freq < 286e6) { - CP = 0; - BS = 2; - } - else if(freq < 386e6) { - CP = 1; - BS = 2; - } - else if(freq < 446e6) { - CP = 2; - BS = 2; - } - else if(freq < 466e6) { - CP = 3; - BS = 2; - } - else if(freq < 506e6) { - CP = 0; - BS = 8; - } - else if(freq < 761e6) { - CP = 1; - BS = 8; - } - else if(freq < 846e6) { - CP = 2; - BS = 8; - } - else { // limit is ~905 MHz - CP = 3; - BS = 8; - } - return (CP<<6 | P5 << 4 | BS); -} - -db_dtt754::db_dtt754(usrp_basic_sptr _usrp, int which) - : db_base(_usrp, which) -{ - /* - * Control custom DTT75403-based daughterboard. - * - * @param usrp: instance of usrp.source_c - * @param which: which side: 0 or 1 corresponding to RX_A or RX_B respectively - * @type which: int - */ - - // FIXME: DTT754 and DTT768 can probably inherit from a DTT class - - if(d_which == 0) { - d_i2c_addr = 0x60; - } - else { - d_i2c_addr = 0x62; - } - - d_bw = 7e6; - d_IF = 36e6; - - d_f_ref = 166.6666e3; - d_inverted = false; - - set_gain((gain_min() + gain_max()) / 2.0); - - bypass_adc_buffers(false); -} - -db_dtt754::~db_dtt754() -{ -} - -float -db_dtt754::gain_min() -{ - return 0; -} - -float -db_dtt754::gain_max() -{ - return 115; -} - -float -db_dtt754::gain_db_per_step() -{ - return 1; -} - -bool -db_dtt754::set_gain(float gain) -{ - assert(gain>=0 && gain<=115); - - float rfgain, ifgain, pgagain; - if(gain > 60) { - rfgain = 60; - gain = gain - 60; - } - else { - rfgain = gain; - gain = 0; - } - - if(gain > 35) { - ifgain = 35; - gain = gain - 35; - } - else { - ifgain = gain; - gain = 0; - } - pgagain = gain; - - _set_rfagc(rfgain); - _set_ifagc(ifgain); - _set_pga(pgagain); - - return true; // can't fail with the assert in place -} - -double -db_dtt754::freq_min() -{ - return 44e6; -} - -double -db_dtt754::freq_max() -{ - return 900e6; -} - -struct freq_result_t -db_dtt754::set_freq(double target_freq) -{ - /* - * @returns (ok, actual_baseband_freq) where: - * ok is True or False and indicates success or failure, - * actual_baseband_freq is the RF frequency that corresponds to DC in the IF. - */ - - freq_result_t ret = {false, 0.0}; - - if(target_freq < freq_min() || target_freq > freq_max()) { - return ret; - } - - double target_lo_freq = target_freq + d_IF; // High side mixing - - int divisor = (int)(0.5+(target_lo_freq / d_f_ref)); - double actual_lo_freq = d_f_ref*divisor; - - if((divisor & ~0x7fff) != 0) { // must be 15-bits or less - return ret; - } - - // build i2c command string - std::vector<int> buf(5); - buf[0] = (divisor >> 8) & 0xff; // DB1 - buf[1] = divisor & 0xff; // DB2 - buf[2] = control_byte_1(); - buf[3] = bandswitch_byte(actual_lo_freq, d_bw); - buf[4] = control_byte_2(); - - bool ok = usrp()->write_i2c(d_i2c_addr, int_seq_to_str (buf)); - - d_freq = actual_lo_freq - d_IF; - - ret.ok = ok; - ret.baseband_freq = actual_lo_freq; - - return ret; - -} - -bool -db_dtt754::is_quadrature() -{ - /* - * Return True if this board requires both I & Q analog channels. - * - * This bit of info is useful when setting up the USRP Rx mux register. - */ - - return false; -} - -bool -db_dtt754::spectrum_inverted() -{ - /* - * The 43.75 MHz version is inverted - */ - - return d_inverted; -} - -bool -db_dtt754::set_bw(float bw) -{ - /* - * Choose the SAW filter bandwidth, either 7MHz or 8MHz) - */ - - d_bw = bw; - set_freq(d_freq); - - return true; // FIXME: propagate set_freq result -} - -void -db_dtt754::_set_rfagc(float gain) -{ - assert(gain <= 60 && gain >= 0); - // FIXME this has a 0.5V step between gain = 60 and gain = 59. - // Why are there two cases instead of a single linear case? - float voltage; - if(gain == 60) { - voltage = 4; - } - else { - voltage = gain/60.0 * 2.25 + 1.25; - } - - int dacword = (int)(4096*voltage/1.22/3.3); // 1.22 = opamp gain - - assert(dacword>=0 && dacword<4096); - usrp()->write_aux_dac(d_which, 1, dacword); -} - -void -db_dtt754::_set_ifagc(float gain) -{ - assert(gain <= 35 && gain >= 0); - float voltage = gain/35.0 * 2.1 + 1.4; - int dacword = (int)(4096*voltage/1.22/3.3); // 1.22 = opamp gain - - assert(dacword>=0 && dacword<4096); - usrp()->write_aux_dac(d_which, 0, dacword); -} - -void -db_dtt754::_set_pga(float pga_gain) -{ - assert(pga_gain >=0 && pga_gain <=20); - if(d_which == 0) { - usrp()->set_pga (0, pga_gain); - } - else { - usrp()->set_pga (2, pga_gain); - } -} diff --git a/usrp/host/lib/db_dtt768.cc b/usrp/host/lib/db_dtt768.cc deleted file mode 100644 index 0dfe1a8f3..000000000 --- a/usrp/host/lib/db_dtt768.cc +++ /dev/null @@ -1,300 +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 asversion 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/db_dtt768.h> -#include <db_base_impl.h> - -int -control_byte_4() -{ - int C = 0; // Charge Pump Current, no info on how to choose - int R = 4; // 125 kHz fref - - // int ATP = 7; // Disable internal AGC - return (0x80 | C<<5 | R); -} - -int -control_byte_5(float freq, int agcmode = 1) -{ - if(agcmode) { - if(freq < 150e6) { - return 0x3B; - } - else if(freq < 420e6) { - return 0x7E; - } - else { - return 0xB7; - } - } - else { - if(freq < 150e6) { - return 0x39; - } - else if(freq < 420e6) { - return 0x7C; - } - else { - return 0xB5; - } - } -} - -int -control_byte_6() -{ - int ATC = 0; // AGC time constant = 100ms, 1 = 3S - int IFE = 1; // IF AGC amplifier enable - int AT = 0; // AGC control, ??? - - return (ATC << 5 | IFE << 4 | AT); -} - -int -control_byte_7() -{ - int SAS = 1; // SAW Digital mode - int AGD = 1; // AGC disable - int ADS = 0; // AGC detector into ADC converter - int T = 0; // Test mode, undocumented - return (SAS << 7 | AGD << 5 | ADS << 4 | T); -} - -db_dtt768::db_dtt768(usrp_basic_sptr _usrp, int which) - : db_base(_usrp, which) -{ - /* - * Control custom DTT76803-based daughterboard. - * - * @param usrp: instance of usrp.source_c - * @param which: which side: 0 or 1 corresponding to RX_A or RX_B respectively - * @type which: int - */ - - if(d_which == 0) { - d_i2c_addr = 0x60; - } - else { - d_i2c_addr = 0x62; - } - - d_IF = 44e6; - - d_f_ref = 125e3; - d_inverted = false; - - set_gain((gain_min() + gain_max()) / 2.0); - - bypass_adc_buffers(false); -} - -db_dtt768::~db_dtt768() -{ -} - -float -db_dtt768::gain_min() -{ - return 0; -} - -float -db_dtt768::gain_max() -{ - return 115; -} - -float -db_dtt768::gain_db_per_step() -{ - return 1; -} - -bool -db_dtt768::set_gain(float gain) -{ - assert(gain>=0 && gain<=115); - - float rfgain, ifgain, pgagain; - if(gain > 60) { - rfgain = 60; - gain = gain - 60; - } - else { - rfgain = gain; - gain = 0; - } - - if(gain > 35) { - ifgain = 35; - gain = gain - 35; - } - else { - ifgain = gain; - gain = 0; - } - pgagain = gain; - - _set_rfagc(rfgain); - _set_ifagc(ifgain); - _set_pga(pgagain); - - return true; -} - -double -db_dtt768::freq_min() -{ - return 44e6; -} - -double -db_dtt768::freq_max() -{ - return 900e6; -} - -struct freq_result_t -db_dtt768::set_freq(double target_freq) -{ - /* - * @returns (ok, actual_baseband_freq) where: - * ok is True or False and indicates success or failure, - * actual_baseband_freq is the RF frequency that corresponds to DC in the IF. - */ - - freq_result_t ret = {false, 0.0}; - - if(target_freq < freq_min() || target_freq > freq_max()) { - return ret; - } - - double target_lo_freq = target_freq + d_IF; // High side mixing - - int divisor = (int)(0.5+(target_lo_freq / d_f_ref)); - double actual_lo_freq = d_f_ref*divisor; - - if((divisor & ~0x7fff) != 0) { // must be 15-bits or less - return ret; - } - - // build i2c command string - std::vector<int> buf(6); - buf[0] = (divisor >> 8) & 0xff; // DB1 - buf[1] = divisor & 0xff; // DB2 - buf[2] = control_byte_4(); - buf[3] = control_byte_5(target_freq); - buf[4] = control_byte_6(); - buf[5] = control_byte_7(); - - bool ok = usrp()->write_i2c(d_i2c_addr, int_seq_to_str (buf)); - - d_freq = actual_lo_freq - d_IF; - - ret.ok = ok; - ret.baseband_freq = actual_lo_freq; - - return ret; - -} - -bool -db_dtt768::is_quadrature() -{ - /* - * Return True if this board requires both I & Q analog channels. - * - * This bit of info is useful when setting up the USRP Rx mux register. - */ - - return false; -} - -bool -db_dtt768::spectrum_inverted() -{ - /* - * The 43.75 MHz version is inverted - */ - - return d_inverted; -} - -bool -db_dtt768::set_bw(float bw) -{ - /* - * Choose the SAW filter bandwidth, either 7MHz or 8MHz) - */ - - d_bw = bw; - set_freq(d_freq); - - return true; // FIXME: propagate set_freq result -} - -void -db_dtt768::_set_rfagc(float gain) -{ - assert(gain <= 60 && gain >= 0); - // FIXME this has a 0.5V step between gain = 60 and gain = 59. - // Why are there two cases instead of a single linear case? - float voltage; - if(gain == 60) { - voltage = 4; - } - else { - voltage = gain/60.0 * 2.25 + 1.25; - } - - int dacword = (int)(4096*voltage/1.22/3.3); // 1.22 = opamp gain - - assert(dacword>=0 && dacword<4096); - usrp()->write_aux_dac(d_which, 1, dacword); -} - -void -db_dtt768::_set_ifagc(float gain) -{ - assert(gain <= 35 && gain >= 0); - float voltage = gain/35.0 * 2.1 + 1.4; - int dacword = (int)(4096*voltage/1.22/3.3); // 1.22 = opamp gain - - assert(dacword>=0 && dacword<4096); - usrp()->write_aux_dac(d_which, 0, dacword); -} - -void -db_dtt768::_set_pga(float pga_gain) -{ - assert(pga_gain >=0 && pga_gain <=20); - if(d_which == 0) { - usrp()->set_pga (0, pga_gain); - } - else { - usrp()->set_pga (2, pga_gain); - } -} diff --git a/usrp/host/lib/db_flexrf.cc b/usrp/host/lib/db_flexrf.cc deleted file mode 100644 index ddd87012d..000000000 --- a/usrp/host/lib/db_flexrf.cc +++ /dev/null @@ -1,1247 +0,0 @@ -// -// 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 asversion 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/db_flexrf.h> -#include <db_base_impl.h> -#ifdef HAVE_TIME_H -#include <ctime> -#endif - -// d'board i/o pin defs -// Tx and Rx have shared defs, but different i/o regs -#define AUX_RXAGC (1 << 8) -#define POWER_UP (1 << 7) // enables power supply -#define RX_TXN (1 << 6) // Tx only: T/R antenna switch for TX/RX port -#define RX2_RX1N (1 << 6) // Rx only: antenna switch between RX2 and TX/RX port -#define ENABLE (1 << 5) // enables mixer -#define AUX_SEN (1 << 4) -#define AUX_SCLK (1 << 3) -#define PLL_LOCK_DETECT (1 << 2) -#define AUX_SDO (1 << 1) -#define CLOCK_OUT (1 << 0) - -flexrf_base::flexrf_base(usrp_basic_sptr _usrp, int which, int _power_on) - : db_base(_usrp, which), d_power_on(_power_on) -{ - /* - @param usrp: instance of usrp.source_c - @param which: which side: 0 or 1 corresponding to side A or B respectively - @type which: int - */ - - d_first = true; - d_spi_format = SPI_FMT_MSB | SPI_FMT_HDR_0; - - usrp()->_write_oe(d_which, 0, 0xffff); // turn off all outputs - _enable_refclk(false); // disable refclk - - set_auto_tr(false); -} - -flexrf_base::~flexrf_base() -{ - delete d_common; -} - -void -flexrf_base::_write_all(int R, int control, int N) -{ - /* - Write R counter latch, control latch and N counter latch to VCO. - - Adds 10ms delay between writing control and N if this is first call. - This is the required power-up sequence. - - @param R: 24-bit R counter latch - @type R: int - @param control: 24-bit control latch - @type control: int - @param N: 24-bit N counter latch - @type N: int - */ - timespec t; - t.tv_sec = 0; - t.tv_nsec = 10000000; - - _write_R(R); - _write_control(control); - if(d_first) { - //time.sleep(0.010); - nanosleep(&t, NULL); - d_first = false; - } - _write_N(N); -} - -void -flexrf_base::_write_control(int control) -{ - _write_it((control & ~0x3) | 0); -} - -void -flexrf_base::_write_R(int R) -{ - _write_it((R & ~0x3) | 1); -} - -void -flexrf_base::_write_N(int N) -{ - _write_it((N & ~0x3) | 2); -} - -void -flexrf_base::_write_it(int v) -{ - char s[3]; - s[0] = (char)((v >> 16) & 0xff); - s[1] = (char)((v >> 8) & 0xff); - s[2] = (char)(v & 0xff); - std::string str(s, 3); - usrp()->_write_spi(0, d_spi_enable, d_spi_format, str); -} - -bool -flexrf_base::_lock_detect() -{ - /* - @returns: the value of the VCO/PLL lock detect bit. - @rtype: 0 or 1 - */ - if(usrp()->read_io(d_which) & PLL_LOCK_DETECT) { - return true; - } - else { // Give it a second chance - // FIXME: make portable sleep - timespec t; - t.tv_sec = 0; - t.tv_nsec = 100000000; - nanosleep(&t, NULL); - - if(usrp()->read_io(d_which) & PLL_LOCK_DETECT) { - return true; - } - else { - return false; - } - } -} - -bool -flexrf_base::_compute_regs(double freq, int &retR, int &retcontrol, - int &retN, double &retfreq) -{ - /* - Determine values of R, control, and N registers, along with actual freq. - - @param freq: target frequency in Hz - @type freq: float - @returns: (R, control, N, actual_freq) - @rtype: tuple(int, int, int, float) - - Override this in derived classes. - */ - - //raise NotImplementedError; - throw std::runtime_error("_compute_regs called from flexrf_base\n"); -} - -int -flexrf_base::_compute_control_reg() -{ - return d_common->_compute_control_reg(); -} - -int -flexrf_base::_refclk_divisor() -{ - return d_common->_refclk_divisor(); -} - -struct freq_result_t -flexrf_base::set_freq(double freq) -{ - /* - @returns (ok, actual_baseband_freq) where: - ok is True or False and indicates success or failure, - actual_baseband_freq is the RF frequency that corresponds to DC in the IF. - */ - - struct freq_result_t args = {false, 0}; - - // Offsetting the LO helps get the Tx carrier leakage out of the way. - // This also ensures that on Rx, we're not getting hosed by the - // FPGA's DC removal loop's time constant. We were seeing a - // problem when running with discontinuous transmission. - // Offsetting the LO made the problem go away. - freq += d_lo_offset; - - int R, control, N; - double actual_freq; - _compute_regs(freq, R, control, N, actual_freq); - - if(R==0) { - return args; - } - - _write_all(R, control, N); - args.ok = _lock_detect(); - args.baseband_freq = actual_freq; - return args; -} - -bool -flexrf_base::_set_pga(float pga_gain) -{ - if(d_which == 0) { - usrp()->set_pga(0, pga_gain); - usrp()->set_pga(1, pga_gain); - } - else { - usrp()->set_pga(2, pga_gain); - usrp()->set_pga(3, pga_gain); - } - return true; -} - -bool -flexrf_base::is_quadrature() -{ - /* - Return True if this board requires both I & Q analog channels. - - This bit of info is useful when setting up the USRP Rx mux register. - */ - return true; -} - -double -flexrf_base::freq_min() -{ - return d_common->freq_min(); -} - -double -flexrf_base::freq_max() -{ - return d_common->freq_max(); -} - -// ---------------------------------------------------------------- - -flexrf_base_tx::flexrf_base_tx(usrp_basic_sptr _usrp, int which, int _power_on) - : flexrf_base(_usrp, which, _power_on) -{ - /* - @param usrp: instance of usrp.sink_c - @param which: 0 or 1 corresponding to side TX_A or TX_B respectively. - */ - - if(which == 0) { - d_spi_enable = SPI_ENABLE_TX_A; - } - else { - d_spi_enable = SPI_ENABLE_TX_B; - } - - // power up the transmit side, but don't enable the mixer - usrp()->_write_oe(d_which,(POWER_UP|RX_TXN|ENABLE), 0xffff); - usrp()->write_io(d_which, (power_on()|RX_TXN), (POWER_UP|RX_TXN|ENABLE)); - set_lo_offset(4e6); - - set_gain((gain_min() + gain_max()) / 2.0); // initialize gain -} - -flexrf_base_tx::~flexrf_base_tx() -{ - shutdown(); -} - - -void -flexrf_base_tx::shutdown() -{ - // fprintf(stderr, "flexrf_base_tx::shutdown d_is_shutdown = %d\n", d_is_shutdown); - - if (!d_is_shutdown){ - d_is_shutdown = true; - // do whatever there is to do to shutdown - - // Power down and leave the T/R switch in the R position - usrp()->write_io(d_which, (power_off()|RX_TXN), (POWER_UP|RX_TXN|ENABLE)); - - // Power down VCO/PLL - d_PD = 3; - - _write_control(_compute_control_reg()); - _enable_refclk(false); // turn off refclk - set_auto_tr(false); - } -} - -bool -flexrf_base_tx::set_auto_tr(bool on) -{ - bool ok = true; - if(on) { - ok &= set_atr_mask (RX_TXN | ENABLE); - ok &= set_atr_txval(0 | ENABLE); - ok &= set_atr_rxval(RX_TXN | 0); - } - else { - ok &= set_atr_mask (0); - ok &= set_atr_txval(0); - ok &= set_atr_rxval(0); - } - return ok; -} - -bool -flexrf_base_tx::set_enable(bool on) -{ - /* - Enable transmitter if on is true - */ - - int v; - int mask = RX_TXN | ENABLE; - if(on) { - v = ENABLE; - } - else { - v = RX_TXN; - } - return usrp()->write_io(d_which, v, mask); -} - -float -flexrf_base_tx::gain_min() -{ - return usrp()->pga_max(); -} - -float -flexrf_base_tx::gain_max() -{ - return usrp()->pga_max(); -} - -float -flexrf_base_tx::gain_db_per_step() -{ - return 1; -} - -bool -flexrf_base_tx::set_gain(float gain) -{ - /* - Set the gain. - - @param gain: gain in decibels - @returns True/False - */ - return _set_pga(usrp()->pga_max()); -} - - -/**************************************************************************/ - - -flexrf_base_rx::flexrf_base_rx(usrp_basic_sptr _usrp, int which, int _power_on) - : flexrf_base(_usrp, which, _power_on) -{ - /* - @param usrp: instance of usrp.source_c - @param which: 0 or 1 corresponding to side RX_A or RX_B respectively. - */ - - if(which == 0) { - d_spi_enable = SPI_ENABLE_RX_A; - } - else { - d_spi_enable = SPI_ENABLE_RX_B; - } - - usrp()->_write_oe(d_which, (POWER_UP|RX2_RX1N|ENABLE), 0xffff); - usrp()->write_io(d_which, (power_on()|RX2_RX1N|ENABLE), - (POWER_UP|RX2_RX1N|ENABLE)); - - // set up for RX on TX/RX port - select_rx_antenna("TX/RX"); - - bypass_adc_buffers(true); - - set_lo_offset(-4e6); -} - -flexrf_base_rx::~flexrf_base_rx() -{ - shutdown(); -} - -void -flexrf_base_rx::shutdown() -{ - // fprintf(stderr, "flexrf_base_rx::shutdown d_is_shutdown = %d\n", d_is_shutdown); - - if (!d_is_shutdown){ - d_is_shutdown = true; - // do whatever there is to do to shutdown - - // Power down - usrp()->common_write_io(C_RX, d_which, power_off(), (POWER_UP|ENABLE)); - - // Power down VCO/PLL - d_PD = 3; - - - // fprintf(stderr, "flexrf_base_rx::shutdown before _write_control\n"); - _write_control(_compute_control_reg()); - - // fprintf(stderr, "flexrf_base_rx::shutdown before _enable_refclk\n"); - _enable_refclk(false); // turn off refclk - - // fprintf(stderr, "flexrf_base_rx::shutdown before set_auto_tr\n"); - set_auto_tr(false); - - // fprintf(stderr, "flexrf_base_rx::shutdown after set_auto_tr\n"); - } -} - -bool -flexrf_base_rx::set_auto_tr(bool on) -{ - bool ok = true; - if(on) { - ok &= set_atr_mask (ENABLE); - ok &= set_atr_txval( 0); - ok &= set_atr_rxval(ENABLE); - } - else { - ok &= set_atr_mask (0); - ok &= set_atr_txval(0); - ok &= set_atr_rxval(0); - } - return true; -} - -bool -flexrf_base_rx::select_rx_antenna(int which_antenna) -{ - /* - Specify which antenna port to use for reception. - @param which_antenna: either 'TX/RX' or 'RX2' - */ - - if(which_antenna == 0) { - usrp()->write_io(d_which, 0,RX2_RX1N); - } - else if(which_antenna == 1) { - usrp()->write_io(d_which, RX2_RX1N, RX2_RX1N); - } - else { - return false; - // throw std::invalid_argument("which_antenna must be either 'TX/RX' or 'RX2'\n"); - } - return true; -} - -bool -flexrf_base_rx::select_rx_antenna(const std::string &which_antenna) -{ - /* - Specify which antenna port to use for reception. - @param which_antenna: either 'TX/RX' or 'RX2' - */ - - if(which_antenna == "TX/RX") { - usrp()->write_io(d_which, 0, RX2_RX1N); - } - else if(which_antenna == "RX2") { - usrp()->write_io(d_which, RX2_RX1N, RX2_RX1N); - } - else { - // throw std::invalid_argument("which_antenna must be either 'TX/RX' or 'RX2'\n"); - return false; - } - return true; -} - -bool -flexrf_base_rx::set_gain(float gain) -{ - /* - Set the gain. - - @param gain: gain in decibels - @returns True/False - */ - - // clamp gain - gain = std::max(gain_min(), std::min(gain, gain_max())); - - float pga_gain, agc_gain; - float V_maxgain, V_mingain, V_fullscale, dac_value; - - float maxgain = gain_max() - usrp()->pga_max(); - float mingain = gain_min(); - if(gain > maxgain) { - pga_gain = gain-maxgain; - assert(pga_gain <= usrp()->pga_max()); - agc_gain = maxgain; - } - else { - pga_gain = 0; - agc_gain = gain; - } - - V_maxgain = .2; - V_mingain = 1.2; - V_fullscale = 3.3; - dac_value = (agc_gain*(V_maxgain-V_mingain)/(maxgain-mingain) + V_mingain)*4096/V_fullscale; - - assert(dac_value>=0 && dac_value<4096); - - return (usrp()->write_aux_dac(d_which, 0, int(dac_value)) - && _set_pga(int(pga_gain))); -} - -// ---------------------------------------------------------------- - - -_AD4360_common::_AD4360_common() -{ - // R-Register Common Values - d_R_RSV = 0; // bits 23,22 - d_BSC = 3; // bits 21,20 Div by 8 to be safe - d_TEST = 0; // bit 19 - d_LDP = 1; // bit 18 - d_ABP = 0; // bit 17,16 3ns - - // N-Register Common Values - d_N_RSV = 0; // bit 7 - - // Control Register Common Values - d_PD = 0; // bits 21,20 Normal operation - d_PL = 0; // bits 13,12 11mA - d_MTLD = 1; // bit 11 enabled - d_CPG = 0; // bit 10 CP setting 1 - d_CP3S = 0; // bit 9 Normal - d_PDP = 1; // bit 8 Positive - d_MUXOUT = 1; // bits 7:5 Digital Lock Detect - d_CR = 0; // bit 4 Normal - d_PC = 1; // bits 3,2 Core power 10mA -} - -_AD4360_common::~_AD4360_common() -{ -} - -bool -_AD4360_common::_compute_regs(double refclk_freq, double freq, int &retR, - int &retcontrol, int &retN, double &retfreq) -{ - /* - Determine values of R, control, and N registers, along with actual freq. - - @param freq: target frequency in Hz - @type freq: float - @returns: (R, control, N, actual_freq) - @rtype: tuple(int, int, int, float) - */ - - // Band-specific N-Register Values - //float phdet_freq = _refclk_freq()/d_R_DIV; - double phdet_freq = refclk_freq/d_R_DIV; - double desired_n = round(freq*d_freq_mult/phdet_freq); - double actual_freq = desired_n * phdet_freq; - int B = floor(desired_n/_prescaler()); - int A = desired_n - _prescaler()*B; - d_B_DIV = int(B); // bits 20:8 - d_A_DIV = int(A); // bit 6:2 - - //assert db_B_DIV >= db_A_DIV - if(d_B_DIV < d_A_DIV) { - retR = 0; - retcontrol = 0; - retN = 0; - retfreq = 0; - return false; - } - - int R = (d_R_RSV<<22) | (d_BSC<<20) | (d_TEST<<19) | - (d_LDP<<18) | (d_ABP<<16) | (d_R_DIV<<2); - - int control = _compute_control_reg(); - - int N = (d_DIVSEL<<23) | (d_DIV2<<22) | (d_CPGAIN<<21) | - (d_B_DIV<<8) | (d_N_RSV<<7) | (d_A_DIV<<2); - - retR = R; - retcontrol = control; - retN = N; - retfreq = actual_freq/d_freq_mult; - return true; -} - -int -_AD4360_common::_compute_control_reg() -{ - int control = (d_P<<22) | (d_PD<<20) | (d_CP2<<17) | (d_CP1<<14) - | (d_PL<<12) | (d_MTLD<<11) | (d_CPG<<10) | (d_CP3S<<9) | (d_PDP<<8) - | (d_MUXOUT<<5) | (d_CR<<4) | (d_PC<<2); - - return control; -} - -int -_AD4360_common::_refclk_divisor() -{ - /* - Return value to stick in REFCLK_DIVISOR register - */ - return 1; -} - -int -_AD4360_common::_prescaler() -{ - if(d_P == 0) { - return 8; - } - else if(d_P == 1) { - return 16; - } - else { - return 32; - } -} - -//---------------------------------------------------------------------- - -_2200_common::_2200_common() - : _AD4360_common() -{ - // Band-specific R-Register Values - d_R_DIV = 16; // bits 15:2 - - // Band-specific C-Register values - d_P = 1; // bits 23,22 Div by 16/17 - d_CP2 = 7; // bits 19:17 - d_CP1 = 7; // bits 16:14 - - // Band specifc N-Register Values - d_DIVSEL = 0; // bit 23 - d_DIV2 = 0; // bit 22 - d_CPGAIN = 0; // bit 21 - d_freq_mult = 1; -} - -double -_2200_common::freq_min() -{ - return 2000e6; -} - -double -_2200_common::freq_max() -{ - return 2400e6; -} - -//---------------------------------------------------------------------- - -_2400_common::_2400_common() - : _AD4360_common() -{ - // Band-specific R-Register Values - d_R_DIV = 16; // bits 15:2 - - // Band-specific C-Register values - d_P = 1; // bits 23,22 Div by 16/17 - d_CP2 = 7; // bits 19:17 - d_CP1 = 7; // bits 16:14 - - // Band specifc N-Register Values - d_DIVSEL = 0; // bit 23 - d_DIV2 = 0; // bit 22 - d_CPGAIN = 0; // bit 21 - d_freq_mult = 1; -} - -double -_2400_common::freq_min() -{ - return 2300e6; -} - -double -_2400_common::freq_max() -{ - return 2900e6; -} - -//---------------------------------------------------------------------- - -_1200_common::_1200_common() - : _AD4360_common() -{ - // Band-specific R-Register Values - d_R_DIV = 16; // bits 15:2 DIV by 16 for a 1 MHz phase detector freq - - // Band-specific C-Register values - d_P = 1; // bits 23,22 Div by 16/17 - d_CP2 = 7; // bits 19:17 1.25 mA - d_CP1 = 7; // bits 16:14 1.25 mA - - // Band specifc N-Register Values - d_DIVSEL = 0; // bit 23 - d_DIV2 = 1; // bit 22 - d_CPGAIN = 0; // bit 21 - d_freq_mult = 2; -} - -double -_1200_common::freq_min() -{ - return 1150e6; -} - -double -_1200_common::freq_max() -{ - return 1450e6; -} - -//------------------------------------------------------------------------- - -_1800_common::_1800_common() - : _AD4360_common() -{ - // Band-specific R-Register Values - d_R_DIV = 16; // bits 15:2 DIV by 16 for a 1 MHz phase detector freq - - // Band-specific C-Register values - d_P = 1; // bits 23,22 Div by 16/17 - d_CP2 = 7; // bits 19:17 1.25 mA - d_CP1 = 7; // bits 16:14 1.25 mA - - // Band specifc N-Register Values - d_DIVSEL = 0; // bit 23 - d_DIV2 = 0; // bit 22 - d_freq_mult = 1; - d_CPGAIN = 0; // bit 21 -} - -double -_1800_common::freq_min() -{ - return 1500e6; -} - -double -_1800_common::freq_max() -{ - return 2100e6; -} - -//------------------------------------------------------------------------- - -_900_common::_900_common() - : _AD4360_common() -{ - // Band-specific R-Register Values - d_R_DIV = 16; // bits 15:2 DIV by 16 for a 1 MHz phase detector freq - - // Band-specific C-Register values - d_P = 1; // bits 23,22 Div by 16/17 - d_CP2 = 7; // bits 19:17 1.25 mA - d_CP1 = 7; // bits 16:14 1.25 mA - - // Band specifc N-Register Values - d_DIVSEL = 0; // bit 23 - d_DIV2 = 1; // bit 22 - d_freq_mult = 2; - d_CPGAIN = 0; // bit 21 -} - -double -_900_common::freq_min() -{ - return 750e6; -} - -double -_900_common::freq_max() -{ - return 1050e6; -} - -//------------------------------------------------------------------------- - -_400_common::_400_common() - : _AD4360_common() -{ - // Band-specific R-Register Values - d_R_DIV = 16; // bits 15:2 - - // Band-specific C-Register values - d_P = 0; // bits 23,22 Div by 8/9 - d_CP2 = 7; // bits 19:17 1.25 mA - d_CP1 = 7; // bits 16:14 1.25 mA - - // Band specifc N-Register Values These are different for TX/RX - d_DIVSEL = 0; // bit 23 - d_freq_mult = 2; - - d_CPGAIN = 0; // bit 21 -} - -double -_400_common::freq_min() -{ - return 400e6; -} - -double -_400_common::freq_max() -{ - return 500e6; -} - -_400_tx::_400_tx() - : _400_common() -{ - d_DIV2 = 1; // bit 22 -} - -_400_rx::_400_rx() - : _400_common() -{ - d_DIV2 = 0; // bit 22 // RX side has built-in DIV2 in AD8348 -} - -//------------------------------------------------------------ - -db_flexrf_2200_tx::db_flexrf_2200_tx(usrp_basic_sptr usrp, int which) - : flexrf_base_tx(usrp, which) -{ - d_common = new _2200_common(); -} - -db_flexrf_2200_tx::~db_flexrf_2200_tx() -{ -} - -bool -db_flexrf_2200_tx::_compute_regs(double freq, int &retR, int &retcontrol, - int &retN, double &retfreq) -{ - return d_common->_compute_regs(_refclk_freq(), freq, retR, - retcontrol, retN, retfreq); -} - - - -db_flexrf_2200_rx::db_flexrf_2200_rx(usrp_basic_sptr usrp, int which) - : flexrf_base_rx(usrp, which) -{ - d_common = new _2200_common(); - set_gain((gain_min() + gain_max()) / 2.0); // initialize gain -} - -db_flexrf_2200_rx::~db_flexrf_2200_rx() -{ -} - -float -db_flexrf_2200_rx::gain_min() -{ - return usrp()->pga_min(); -} - -float -db_flexrf_2200_rx::gain_max() -{ - return usrp()->pga_max()+70; -} - -float -db_flexrf_2200_rx::gain_db_per_step() -{ - return 0.05; -} - - -bool -db_flexrf_2200_rx::i_and_q_swapped() -{ - return true; -} - -bool -db_flexrf_2200_rx::_compute_regs(double freq, int &retR, int &retcontrol, - int &retN, double &retfreq) -{ - return d_common->_compute_regs(_refclk_freq(), freq, retR, - retcontrol, retN, retfreq); -} - -//------------------------------------------------------------ - -db_flexrf_2400_tx::db_flexrf_2400_tx(usrp_basic_sptr usrp, int which) - : flexrf_base_tx(usrp, which) -{ - d_common = new _2400_common(); -} - -db_flexrf_2400_tx::~db_flexrf_2400_tx() -{ -} - -bool -db_flexrf_2400_tx::_compute_regs(double freq, int &retR, int &retcontrol, - int &retN, double &retfreq) -{ - return d_common->_compute_regs(_refclk_freq(), freq, retR, - retcontrol, retN, retfreq); -} - - - -db_flexrf_2400_rx::db_flexrf_2400_rx(usrp_basic_sptr usrp, int which) - : flexrf_base_rx(usrp, which) -{ - d_common = new _2400_common(); - set_gain((gain_min() + gain_max()) / 2.0); // initialize gain -} - -db_flexrf_2400_rx::~db_flexrf_2400_rx() -{ -} - -float -db_flexrf_2400_rx::gain_min() -{ - return usrp()->pga_min(); -} - -float -db_flexrf_2400_rx::gain_max() -{ - return usrp()->pga_max()+70; -} - -float -db_flexrf_2400_rx::gain_db_per_step() -{ - return 0.05; -} - - -bool -db_flexrf_2400_rx::i_and_q_swapped() -{ - return true; -} - -bool -db_flexrf_2400_rx::_compute_regs(double freq, int &retR, int &retcontrol, - int &retN, double &retfreq) -{ - return d_common->_compute_regs(_refclk_freq(), freq, retR, - retcontrol, retN, retfreq); -} - -//------------------------------------------------------------ - - -db_flexrf_1200_tx::db_flexrf_1200_tx(usrp_basic_sptr usrp, int which) - : flexrf_base_tx(usrp, which) -{ - d_common = new _1200_common(); -} - -db_flexrf_1200_tx::~db_flexrf_1200_tx() -{ -} - -bool -db_flexrf_1200_tx::_compute_regs(double freq, int &retR, int &retcontrol, - int &retN, double &retfreq) -{ - return d_common->_compute_regs(_refclk_freq(), freq, retR, - retcontrol, retN, retfreq); -} - - - - -db_flexrf_1200_rx::db_flexrf_1200_rx(usrp_basic_sptr usrp, int which) - : flexrf_base_rx(usrp, which) -{ - d_common = new _1200_common(); - set_gain((gain_min() + gain_max()) / 2.0); // initialize gain -} - -db_flexrf_1200_rx::~db_flexrf_1200_rx() -{ -} - -float -db_flexrf_1200_rx::gain_min() -{ - return usrp()->pga_min(); -} - -float -db_flexrf_1200_rx::gain_max() -{ - return usrp()->pga_max()+70; -} - -float -db_flexrf_1200_rx::gain_db_per_step() -{ - return 0.05; -} - -bool -db_flexrf_1200_rx::i_and_q_swapped() -{ - return true; -} - -bool -db_flexrf_1200_rx::_compute_regs(double freq, int &retR, int &retcontrol, - int &retN, double &retfreq) -{ - return d_common->_compute_regs(_refclk_freq(), freq, retR, - retcontrol, retN, retfreq); -} - - -//------------------------------------------------------------ - - -db_flexrf_1800_tx::db_flexrf_1800_tx(usrp_basic_sptr usrp, int which) - : flexrf_base_tx(usrp, which) -{ - d_common = new _1800_common(); -} - -db_flexrf_1800_tx::~db_flexrf_1800_tx() -{ -} - -bool -db_flexrf_1800_tx::_compute_regs(double freq, int &retR, int &retcontrol, - int &retN, double &retfreq) -{ - return d_common->_compute_regs(_refclk_freq(), freq, retR, - retcontrol, retN, retfreq); -} - - - -db_flexrf_1800_rx::db_flexrf_1800_rx(usrp_basic_sptr usrp, int which) - : flexrf_base_rx(usrp, which) -{ - d_common = new _1800_common(); - set_gain((gain_min() + gain_max()) / 2.0); // initialize gain -} - -db_flexrf_1800_rx::~db_flexrf_1800_rx() -{ -} - - -float -db_flexrf_1800_rx::gain_min() -{ - return usrp()->pga_min(); -} - -float -db_flexrf_1800_rx::gain_max() -{ - return usrp()->pga_max()+70; -} - -float -db_flexrf_1800_rx::gain_db_per_step() -{ - return 0.05; -} - -bool -db_flexrf_1800_rx::i_and_q_swapped() -{ - return true; -} - -bool -db_flexrf_1800_rx::_compute_regs(double freq, int &retR, int &retcontrol, - int &retN, double &retfreq) -{ - return d_common->_compute_regs(_refclk_freq(), freq, retR, - retcontrol, retN, retfreq); -} - - -//------------------------------------------------------------ - - -db_flexrf_900_tx::db_flexrf_900_tx(usrp_basic_sptr usrp, int which) - : flexrf_base_tx(usrp, which) -{ - d_common = new _900_common(); -} - -db_flexrf_900_tx::~db_flexrf_900_tx() -{ -} - -bool -db_flexrf_900_tx::_compute_regs(double freq, int &retR, int &retcontrol, - int &retN, double &retfreq) -{ - return d_common->_compute_regs(_refclk_freq(), freq, retR, - retcontrol, retN, retfreq); -} - - -db_flexrf_900_rx::db_flexrf_900_rx(usrp_basic_sptr usrp, int which) - : flexrf_base_rx(usrp, which) -{ - d_common = new _900_common(); - set_gain((gain_min() + gain_max()) / 2.0); // initialize gain -} - -db_flexrf_900_rx::~db_flexrf_900_rx() -{ -} - -float -db_flexrf_900_rx::gain_min() -{ - return usrp()->pga_min(); -} - -float -db_flexrf_900_rx::gain_max() -{ - return usrp()->pga_max()+70; -} - -float -db_flexrf_900_rx::gain_db_per_step() -{ - return 0.05; -} - -bool -db_flexrf_900_rx::i_and_q_swapped() -{ - return true; -} - -bool -db_flexrf_900_rx::_compute_regs(double freq, int &retR, int &retcontrol, - int &retN, double &retfreq) -{ - return d_common->_compute_regs(_refclk_freq(), freq, retR, - retcontrol, retN, retfreq); -} - -//------------------------------------------------------------ - - -db_flexrf_400_tx::db_flexrf_400_tx(usrp_basic_sptr usrp, int which) - : flexrf_base_tx(usrp, which, POWER_UP) -{ - d_common = new _400_tx(); -} - -db_flexrf_400_tx::~db_flexrf_400_tx() -{ -} - -bool -db_flexrf_400_tx::_compute_regs(double freq, int &retR, int &retcontrol, - int &retN, double &retfreq) -{ - return d_common->_compute_regs(_refclk_freq(), freq, retR, - retcontrol, retN, retfreq); -} - - - -db_flexrf_400_rx::db_flexrf_400_rx(usrp_basic_sptr usrp, int which) - : flexrf_base_rx(usrp, which, POWER_UP) -{ - d_common = new _400_rx(); - set_gain((gain_min() + gain_max()) / 2.0); // initialize gain -} - -db_flexrf_400_rx::~db_flexrf_400_rx() -{ -} - -float -db_flexrf_400_rx::gain_min() -{ - return usrp()->pga_min(); -} - -float -db_flexrf_400_rx::gain_max() -{ - return usrp()->pga_max()+45; -} - -float - -db_flexrf_400_rx::gain_db_per_step() -{ - return 0.035; -} - - -bool -db_flexrf_400_rx::i_and_q_swapped() -{ - return true; -} - -bool -db_flexrf_400_rx::_compute_regs(double freq, int &retR, int &retcontrol, - int &retN, double &retfreq) -{ - return d_common->_compute_regs(_refclk_freq(), freq, retR, - retcontrol, retN, retfreq); -} - diff --git a/usrp/host/lib/db_flexrf_mimo.cc b/usrp/host/lib/db_flexrf_mimo.cc deleted file mode 100644 index 29bbbd58f..000000000 --- a/usrp/host/lib/db_flexrf_mimo.cc +++ /dev/null @@ -1,280 +0,0 @@ -/* - * 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <usrp/db_flexrf_mimo.h> -#include <fpga_regs_standard.h> -#include <fpga_regs_common.h> -#include <usrp/usrp_prims.h> -#include <usrp_spi_defs.h> - - -db_flexrf_2400_tx_mimo_a::db_flexrf_2400_tx_mimo_a(usrp_basic_sptr usrp, int which) - : db_flexrf_2400_tx(usrp, which) -{ - _enable_refclk(true); - d_common->R_DIV(1); -} - -int -db_flexrf_2400_tx_mimo_a::_refclk_divisor() -{ - return 16; -} - -db_flexrf_2400_rx_mimo_a::db_flexrf_2400_rx_mimo_a(usrp_basic_sptr usrp, int which) - : db_flexrf_2400_rx(usrp, which) -{ - _enable_refclk(true); - d_common->R_DIV(1); -} - -int -db_flexrf_2400_rx_mimo_a::_refclk_divisor() -{ - return 16; -} - -db_flexrf_2400_tx_mimo_b::db_flexrf_2400_tx_mimo_b(usrp_basic_sptr usrp, int which) - : db_flexrf_2400_tx(usrp, which) -{ - d_common->R_DIV(16); -} - -int -db_flexrf_2400_tx_mimo_b::_refclk_divisor() -{ - return 1; -} - -db_flexrf_2400_rx_mimo_b::db_flexrf_2400_rx_mimo_b(usrp_basic_sptr usrp, int which) - : db_flexrf_2400_rx(usrp, which) -{ - d_common->R_DIV(16); -} - -int -db_flexrf_2400_rx_mimo_b::_refclk_divisor() -{ - return 1; -} - -db_flexrf_1800_tx_mimo_a::db_flexrf_1800_tx_mimo_a(usrp_basic_sptr usrp, int which) - : db_flexrf_1800_tx(usrp, which) -{ - _enable_refclk(true); - d_common->R_DIV(1); -} - -int -db_flexrf_1800_tx_mimo_a::_refclk_divisor() -{ - return 16; -} - -db_flexrf_1800_rx_mimo_a::db_flexrf_1800_rx_mimo_a(usrp_basic_sptr usrp, int which) - : db_flexrf_1800_rx(usrp, which) -{ - _enable_refclk(true); - d_common->R_DIV(1); -} - -int -db_flexrf_1800_rx_mimo_a::_refclk_divisor() -{ - return 16; -} - -db_flexrf_1800_tx_mimo_b::db_flexrf_1800_tx_mimo_b(usrp_basic_sptr usrp, int which) - : db_flexrf_1800_tx(usrp, which) -{ - d_common->R_DIV(16); -} - -int -db_flexrf_1800_tx_mimo_b::_refclk_divisor() -{ - return 1; -} - -db_flexrf_1800_rx_mimo_b::db_flexrf_1800_rx_mimo_b(usrp_basic_sptr usrp, int which) - : db_flexrf_1800_rx(usrp, which) -{ - d_common->R_DIV(16); -} - -int -db_flexrf_1800_rx_mimo_b::_refclk_divisor() -{ - return 1; -} - -db_flexrf_1200_tx_mimo_a::db_flexrf_1200_tx_mimo_a(usrp_basic_sptr usrp, int which) - : db_flexrf_1200_tx(usrp, which) -{ - _enable_refclk(true); - d_common->R_DIV(1); -} - -int -db_flexrf_1200_tx_mimo_a::_refclk_divisor() -{ - return 16; -} - -db_flexrf_1200_rx_mimo_a::db_flexrf_1200_rx_mimo_a(usrp_basic_sptr usrp, int which) - : db_flexrf_1200_rx(usrp, which) -{ - _enable_refclk(true); - d_common->R_DIV(1); -} - -int -db_flexrf_1200_rx_mimo_a::_refclk_divisor() -{ - return 16; -} - -db_flexrf_1200_tx_mimo_b::db_flexrf_1200_tx_mimo_b(usrp_basic_sptr usrp, int which) - : db_flexrf_1200_tx(usrp, which) -{ - d_common->R_DIV(16); -} - -int -db_flexrf_1200_tx_mimo_b::_refclk_divisor() -{ - return 1; -} - -db_flexrf_1200_rx_mimo_b::db_flexrf_1200_rx_mimo_b(usrp_basic_sptr usrp, int which) - : db_flexrf_1200_rx(usrp, which) -{ - d_common->R_DIV(16); -} - -int -db_flexrf_1200_rx_mimo_b::_refclk_divisor() -{ - return 1; -} - -db_flexrf_900_tx_mimo_a::db_flexrf_900_tx_mimo_a(usrp_basic_sptr usrp, int which) - : db_flexrf_900_tx(usrp, which) -{ - _enable_refclk(true); - d_common->R_DIV(1); -} - -int -db_flexrf_900_tx_mimo_a::_refclk_divisor() -{ - return 16; -} - -db_flexrf_900_rx_mimo_a::db_flexrf_900_rx_mimo_a(usrp_basic_sptr usrp, int which) - : db_flexrf_900_rx(usrp, which) -{ - _enable_refclk(true); - d_common->R_DIV(1); -} - -int -db_flexrf_900_rx_mimo_a::_refclk_divisor() -{ - return 16; -} - -db_flexrf_900_tx_mimo_b::db_flexrf_900_tx_mimo_b(usrp_basic_sptr usrp, int which) - : db_flexrf_900_tx(usrp, which) -{ - d_common->R_DIV(16); -} - -int -db_flexrf_900_tx_mimo_b::_refclk_divisor() -{ - return 1; -} - -db_flexrf_900_rx_mimo_b::db_flexrf_900_rx_mimo_b(usrp_basic_sptr usrp, int which) - : db_flexrf_900_rx(usrp, which) -{ - d_common->R_DIV(16); -} - -int db_flexrf_900_rx_mimo_b::_refclk_divisor() -{ - return 1; -} - -db_flexrf_400_tx_mimo_a::db_flexrf_400_tx_mimo_a(usrp_basic_sptr usrp, int which) - : db_flexrf_400_tx(usrp, which) -{ - _enable_refclk(true); - d_common->R_DIV(1); -} - -int -db_flexrf_400_tx_mimo_a::_refclk_divisor() -{ - return 16; -} - -db_flexrf_400_rx_mimo_a::db_flexrf_400_rx_mimo_a(usrp_basic_sptr usrp, int which) - : db_flexrf_400_rx(usrp, which) -{ - _enable_refclk(true); - d_common->R_DIV(1); -} - -int -db_flexrf_400_rx_mimo_a::_refclk_divisor() -{ - return 16; -} - -db_flexrf_400_tx_mimo_b::db_flexrf_400_tx_mimo_b(usrp_basic_sptr usrp, int which) - : db_flexrf_400_tx(usrp, which) -{ - d_common->R_DIV(16); -} - -int -db_flexrf_400_tx_mimo_b::_refclk_divisor() -{ - return 1; -} - -db_flexrf_400_rx_mimo_b::db_flexrf_400_rx_mimo_b(usrp_basic_sptr usrp, int which) - : db_flexrf_400_rx(usrp, which) -{ - d_common->R_DIV(16); -} - -int -db_flexrf_400_rx_mimo_b::_refclk_divisor() -{ - return 1; -} diff --git a/usrp/host/lib/db_tv_rx.cc b/usrp/host/lib/db_tv_rx.cc deleted file mode 100644 index 1822479e1..000000000 --- a/usrp/host/lib/db_tv_rx.cc +++ /dev/null @@ -1,278 +0,0 @@ -// -// 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 asversion 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/db_tv_rx.h> -#include <db_base_impl.h> - -/*****************************************************************************/ - -int -control_byte_1(bool fast_tuning_p, int reference_divisor) -{ - int c = 0x88; - if(fast_tuning_p) { - c |= 0x40; - } - - if(reference_divisor == 512) { - c |= 0x3 << 1; - } - else if(reference_divisor == 640) { - c |= 0x0 << 1; - } - else if(reference_divisor == 1024) { - c |= 0x1 << 1; - } - else { - assert(0); - } - - return c; -} - -int -control_byte_2(double target_freq, bool shutdown_tx_PGA) -{ - int c; - if(target_freq < 158e6) { // VHF low - c = 0xa0; - } - else if(target_freq < 464e6) { // VHF high - c = 0x90; - } - else { // UHF - c = 0x30; - } - - if(shutdown_tx_PGA) { - c |= 0x08; - } - - return c; -} - - -/*****************************************************************************/ - - -db_tv_rx::db_tv_rx(usrp_basic_sptr usrp, int which, - double first_IF, double second_IF) - : db_base(usrp, which) -{ - // Handler for Tv Rx daughterboards. - // - // @param usrp: instance of usrp.source_c - // @param which: which side: 0, 1 corresponding to RX_A or RX_B respectively - - if(which == 0) { - d_i2c_addr = 0x60; - } - else { - d_i2c_addr = 0x61; - } - - d_first_IF = first_IF; - d_second_IF = second_IF; - d_reference_divisor = 640; - d_fast_tuning = false; - d_inverted = false; // FIXME get rid of this - - set_gain((gain_min() + gain_max()) / 2.0); // initialize gain - - bypass_adc_buffers(false); -} - -db_tv_rx::~db_tv_rx() -{ -} - -// Gain setting -void -db_tv_rx::_set_rfagc(float gain) -{ - float voltage; - - assert(gain <= 60 && gain >= 0); - // FIXME this has a 0.5V step between gain = 60 and gain = 59. - // Why are there two cases instead of a single linear case? - if(gain == 60) { - voltage = 4; - } - else { - voltage = gain/60.0 * 2.25 + 1.25; - } - int dacword = int(4096*voltage/1.22/3.3); // 1.22 = opamp gain - - assert(dacword>=0 && dacword<4096); - usrp()->write_aux_dac(d_which, 1, dacword); -} - -void -db_tv_rx::_set_ifagc(float gain) -{ - float voltage; - - assert(gain <= 35 && gain >= 0); - voltage = gain/35.0 * 2.1 + 1.4; - int dacword = int(4096*voltage/1.22/3.3); // 1.22 = opamp gain - - assert(dacword>=0 && dacword<4096); - usrp()->write_aux_dac(d_which, 0, dacword); -} - -void -db_tv_rx::_set_pga(float pga_gain) -{ - assert(pga_gain >=0 && pga_gain <=20); - if(d_which == 0) { - usrp()->set_pga(0, pga_gain); - } - else { - usrp()->set_pga (2, pga_gain); - } -} - -double -db_tv_rx::freq_min() -{ - return 50e6; -} - -double -db_tv_rx::freq_max() -{ - return 860e6; -} - -struct freq_result_t -db_tv_rx::set_freq(double target_freq) -{ - // Set the frequency. - // - // @param freq: target RF frequency in Hz - // @type freq: double - // - // @returns (ok, actual_baseband_freq) where: - // ok is True or False and indicates success or failure, - // actual_baseband_freq is RF frequency that corresponds to DC in the IF. - - freq_result_t args = {false, 0}; - - double fmin = freq_min(); - double fmax = freq_max(); - if((target_freq < fmin) || (target_freq > fmax)) { - return args; - } - - double target_lo_freq = target_freq + d_first_IF; // High side mixing - double f_ref = 4.0e6 / (double)(d_reference_divisor); // frequency steps - - int divisor = int((target_lo_freq + (f_ref * 4)) / (f_ref * 8)); - double actual_lo_freq = (f_ref * 8 * divisor); - double actual_freq = actual_lo_freq - d_first_IF; - - if((divisor & ~0x7fff) != 0) { // must be 15-bits or less - return args; - } - - // build i2c command string - std::vector<int> buf(4); - buf[0] = (divisor >> 8) & 0xff; // DB1 - buf[1] = divisor & 0xff; // DB2 - buf[2] = control_byte_1(d_fast_tuning, d_reference_divisor); - buf[3] = control_byte_2(actual_freq, true); - - args.ok = usrp()->write_i2c(d_i2c_addr, int_seq_to_str (buf)); - args.baseband_freq = actual_freq - d_second_IF; - return args; -} - -float -db_tv_rx::gain_min() -{ - return 0; -} - -float -db_tv_rx::gain_max() -{ - return 115; -} - -float -db_tv_rx::gain_db_per_step() -{ - return 1; -} - -bool -db_tv_rx::set_gain(float gain) -{ - // Set the gain. - // - // @param gain: gain in decibels - // @returns True/False - - float rfgain, ifgain, pgagain; - - assert(gain>=0 && gain<=115); - if(gain>60) { - rfgain = 60; - gain = gain - 60; - } - else { - rfgain = gain; - gain = 0; - } - - if(gain > 35) { - ifgain = 35; - gain = gain - 35; - } - else { - ifgain = gain; - gain = 0; - } - - pgagain = gain; - _set_rfagc(rfgain); - _set_ifagc(ifgain); - _set_pga(pgagain); - - return true; -} - -bool -db_tv_rx::is_quadrature() -{ - // Return True if this board requires both I & Q analog channels. - return false; -} - -bool -db_tv_rx::spectrum_inverted() -{ - // The 43.75 MHz version is inverted - return d_inverted; -} diff --git a/usrp/host/lib/db_tv_rx_mimo.cc b/usrp/host/lib/db_tv_rx_mimo.cc deleted file mode 100644 index 0964c5d8b..000000000 --- a/usrp/host/lib/db_tv_rx_mimo.cc +++ /dev/null @@ -1,39 +0,0 @@ -// -// 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 asversion 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/db_tv_rx_mimo.h> - -db_tv_rx_mimo::db_tv_rx_mimo(usrp_basic_sptr usrp, int which, - double first_IF, double second_IF) - : db_tv_rx(usrp, which,first_IF,second_IF) -{ - _enable_refclk(true);//enable FPGA refclock output on gpio 0 -} - -int -db_tv_rx_mimo::_refclk_divisor() -{ - return 16;// 64/16=> 4 Mhz refclock -} - diff --git a/usrp/host/lib/db_util.cc b/usrp/host/lib/db_util.cc deleted file mode 100644 index 4b46383bb..000000000 --- a/usrp/host/lib/db_util.cc +++ /dev/null @@ -1,54 +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 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 <db_util.h> -#include <sstream> - -std::string -int_seq_to_str(std::vector<int> &seq) -{ - //convert a sequence of integers into a string - - std::stringstream str; - std::vector<int>::iterator i; - for(i = seq.begin(); i != seq.end(); i++) { - str << char((unsigned int)*i); - } - return str.str(); -} - -std::vector<int> -str_to_int_seq(std::string str) -{ - //convert a string to a list of integers - std::vector<int> seq; - std::vector<int>::iterator sitr; - std::string::iterator i; - for(i=str.begin(); i != str.end(); i++) { - int a = (int)(*i); - seq.push_back(a); - } - return seq; -} - diff --git a/usrp/host/lib/db_util.h b/usrp/host/lib/db_util.h deleted file mode 100644 index e07abb608..000000000 --- a/usrp/host/lib/db_util.h +++ /dev/null @@ -1,31 +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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef INCLUDED_DB_UTIL_H -#define INCLUDED_DB_UTIL_H - -#include <string> -#include <vector> - -std::string int_seq_to_str(std::vector<int> &seq); -std::vector<int> str_to_int_seq(std::string str); - -#endif /* INCLUDED_DB_UTIL_H */ diff --git a/usrp/host/lib/db_wbxng.cc b/usrp/host/lib/db_wbxng.cc deleted file mode 100644 index 4d17c72d1..000000000 --- a/usrp/host/lib/db_wbxng.cc +++ /dev/null @@ -1,538 +0,0 @@ -// -// 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 asversion 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/db_wbxng.h> -#include "db_wbxng_adf4350.h" -#include <db_base_impl.h> -#include <stdio.h> -#ifdef HAVE_TIME_H -#include <ctime> -#endif - -// d'board i/o pin defs -// Tx and Rx have shared defs, but different i/o regs -#define ENABLE_5 (1 << 7) // enables 5.0V power supply -#define ENABLE_33 (1 << 6) // enables 3.3V supply -//#define RX_TXN (1 << 15) // Tx only: T/R antenna switch for TX/RX port -//#define RX2_RX1N (1 << 15) // Rx only: antenna switch between RX2 and TX/RX port -#define RX_TXN ((1 << 5)|(1 << 15)) // Tx only: T/R antenna switch for TX/RX port -#define RX2_RX1N ((1 << 5)|(1 << 15)) // Rx only: antenna switch between RX2 and TX/RX port -#define RXBB_EN (1 << 4) -#define TXMOD_EN (1 << 4) -#define PLL_CE (1 << 3) -#define PLL_PDBRF (1 << 2) -#define PLL_MUXOUT (1 << 1) -#define PLL_LOCK_DETECT (1 << 0) - -// RX Attenuator constants -#define ATTN_SHIFT 8 -#define ATTN_MASK (63 << ATTN_SHIFT) - -wbxng_base::wbxng_base(usrp_basic_sptr _usrp, int which) - : db_base(_usrp, which) -{ - /* - @param usrp: instance of usrp.source_c - @param which: which side: 0 or 1 corresponding to side A or B respectively - @type which: int - */ - - usrp()->_write_oe(d_which, 0, 0xffff); // turn off all outputs - - d_first = true; - d_spi_format = SPI_FMT_MSB | SPI_FMT_HDR_0; - - _enable_refclk(false); // disable refclk - - set_auto_tr(false); -} - -wbxng_base::~wbxng_base() -{ -} - -int -wbxng_base::_refclk_divisor() -{ - return 1; -} - -struct freq_result_t -wbxng_base::set_freq(double freq) -{ - /* - @returns (ok, actual_baseband_freq) where: - ok is True or False and indicates success or failure, - actual_baseband_freq is the RF frequency that corresponds to DC in the IF. - */ - - // clamp freq - freq_t int_freq = freq_t(std::max(freq_min(), std::min(freq, freq_max()))); - - bool ok = d_common->_set_freq(int_freq*2, _refclk_freq()); - - _write_spi(d_common->compute_register(5)); - _write_spi(d_common->compute_register(4)); - _write_spi(d_common->compute_register(3)); - /* load involved registers */ - _write_spi(d_common->compute_register(2)); - _write_spi(d_common->compute_register(1)); - _write_spi(d_common->compute_register(0)); - - double freq_result = (double) d_common->_get_freq(_refclk_freq())/2.0; - - //ok &= _get_locked(); - struct freq_result_t args = {ok, freq_result}; - - /* Wait before reading Lock Detect*/ - timespec t; - t.tv_sec = 0; - t.tv_nsec = 10000000; - nanosleep(&t, NULL); - - //fprintf(stderr,"Setting WBXNG frequency, requested %d, obtained %f, lock_detect %d\n", - // int_freq, freq_result, d_common->_get_locked()); - - // FIXME - // Offsetting the LO helps get the Tx carrier leakage out of the way. - // This also ensures that on Rx, we're not getting hosed by the - // FPGA's DC removal loop's time constant. We were seeing a - // problem when running with discontinuous transmission. - // Offsetting the LO made the problem go away. - //freq += d_lo_offset; - - return args; -} - -bool -wbxng_base::_set_pga(float pga_gain) -{ - if(d_which == 0) { - usrp()->set_pga(0, pga_gain); - usrp()->set_pga(1, pga_gain); - } - else { - usrp()->set_pga(2, pga_gain); - usrp()->set_pga(3, pga_gain); - } - return true; -} - -bool -wbxng_base::is_quadrature() -{ - /* - Return True if this board requires both I & Q analog channels. - - This bit of info is useful when setting up the USRP Rx mux register. - */ - return true; -} - -double -wbxng_base::freq_min() -{ - return (double) d_common->_get_min_freq()/2.0; -} - -double -wbxng_base::freq_max() -{ - return (double) d_common->_get_max_freq()/2.0; -} - -bool -wbxng_base::_get_locked(void) -{ - return usrp()->read_io(d_which) & PLL_LOCK_DETECT; -} - -void -wbxng_base::_write_spi(std::string data) -{ - usrp()->_write_spi(0, d_spi_enable, d_spi_format, data); -} - -// ---------------------------------------------------------------- - -db_wbxng_tx::db_wbxng_tx(usrp_basic_sptr _usrp, int which) - : wbxng_base(_usrp, which) -{ - /* - @param usrp: instance of usrp.sink_c - @param which: 0 or 1 corresponding to side TX_A or TX_B respectively. - */ - - if(which == 0) { - d_spi_enable = SPI_ENABLE_TX_A; - } - else { - d_spi_enable = SPI_ENABLE_TX_B; - } - - d_common = boost::shared_ptr<adf4350> (new adf4350()); - - /* Initialize the registers. */ - _write_spi(d_common->compute_register(5)); - _write_spi(d_common->compute_register(4)); - _write_spi(d_common->compute_register(3)); - _write_spi(d_common->compute_register(2)); - _write_spi(d_common->compute_register(1)); - _write_spi(d_common->compute_register(0)); - - // power up the transmit side, but don't enable the mixer - usrp()->_write_oe(d_which,(PLL_CE|PLL_PDBRF|RX_TXN|TXMOD_EN|ENABLE_33|ENABLE_5), (PLL_CE|PLL_PDBRF|RX_TXN|TXMOD_EN|ENABLE_33|ENABLE_5)); - usrp()->write_io(d_which, (PLL_CE|RX_TXN|ENABLE_33|ENABLE_5), (PLL_CE|PLL_PDBRF|RX_TXN|ENABLE_33|ENABLE_5)); - //set_lo_offset(4e6); - - // Disable VCO/PLL - //d_common->_enable(true); - usrp()->write_io(d_which, (PLL_PDBRF), (PLL_PDBRF)); - - set_gain(gain_min()); // initialize gain -} - -db_wbxng_tx::~db_wbxng_tx() -{ - shutdown(); -} - -void -db_wbxng_tx::shutdown() -{ - // fprintf(stderr, "db_wbxng_tx::shutdown d_is_shutdown = %d\n", d_is_shutdown); - - if (!d_is_shutdown){ - d_is_shutdown = true; - // do whatever there is to do to shutdown - - // Disable VCO/PLL - //d_common->_enable(false); - usrp()->write_io(d_which, 0, (PLL_PDBRF)); - - // Power down and leave the T/R switch in the R position - usrp()->write_io(d_which, (RX_TXN), (PLL_CE|PLL_PDBRF|RX_TXN|ENABLE_33|ENABLE_5)); - - /* - _write_control(_compute_control_reg()); - */ - _enable_refclk(false); // turn off refclk - set_auto_tr(false); - } -} - -bool -db_wbxng_tx::set_auto_tr(bool on) -{ - bool ok = true; - if(on) { - ok &= set_atr_mask (RX_TXN | TXMOD_EN); - ok &= set_atr_txval(0 | TXMOD_EN); - ok &= set_atr_rxval(RX_TXN); - } - else { - ok &= set_atr_mask (0); - ok &= set_atr_txval(0); - ok &= set_atr_rxval(0); - } - return ok; -} - -bool -db_wbxng_tx::set_enable(bool on) -{ - /* - Enable transmitter if on is true - */ - - int v; - int mask = RX_TXN | TXMOD_EN; - if(on) { - v = TXMOD_EN; - // Enable VCO/PLL - //d_common->_enable(true); - } - else { - v = RX_TXN; - // Disable VCO/PLL - //d_common->_enable(false); - } - return usrp()->write_io(d_which, v, mask); -} - -float -db_wbxng_tx::gain_min() -{ - return 0.0; -} - -float -db_wbxng_tx::gain_max() -{ - return 25.0; -} - -float -db_wbxng_tx::gain_db_per_step() -{ - return gain_max()/(1+(1.4-0.5)*4096/3.3); -} - -bool -db_wbxng_tx::set_gain(float gain) -{ - /* - Set the gain. - - @param gain: gain in decibels - @returns True/False - */ - - // clamp gain - gain = std::max(gain_min(), std::min(gain, gain_max())); - - float pga_gain, agc_gain; - float V_maxgain, V_mingain, V_fullscale, dac_value; - - float maxgain = gain_max(); - float mingain = gain_min(); - pga_gain = 0; - agc_gain = gain; - - V_maxgain = 0.5; - V_mingain = 1.4; - V_fullscale = 3.3; - dac_value = (agc_gain*(V_maxgain-V_mingain)/(maxgain-mingain) + V_mingain)*4096/V_fullscale; - - //fprintf(stderr, "TXGAIN: %f dB, Dac Code: %d, Voltage: %f\n", gain, int(dac_value), float((dac_value/4096.0)*V_fullscale)); - assert(dac_value>=0 && dac_value<4096); - - return (usrp()->write_aux_dac(d_which, 0, int(dac_value)) - && _set_pga(usrp()->pga_max())); - -} - - -/**************************************************************************/ - - -db_wbxng_rx::db_wbxng_rx(usrp_basic_sptr _usrp, int which) - : wbxng_base(_usrp, which) -{ - /* - @param usrp: instance of usrp.source_c - @param which: 0 or 1 corresponding to side RX_A or RX_B respectively. - */ - - if(which == 0) { - d_spi_enable = SPI_ENABLE_RX_A; - } - else { - d_spi_enable = SPI_ENABLE_RX_B; - } - - d_common = boost::shared_ptr<adf4350> (new adf4350()); - - /* Initialize the registers. */ - _write_spi(d_common->compute_register(5)); - _write_spi(d_common->compute_register(4)); - _write_spi(d_common->compute_register(3)); - _write_spi(d_common->compute_register(2)); - _write_spi(d_common->compute_register(1)); - _write_spi(d_common->compute_register(0)); - - usrp()->_write_oe(d_which, (PLL_CE|PLL_PDBRF|RX2_RX1N|RXBB_EN|ATTN_MASK|ENABLE_33|ENABLE_5), (PLL_CE|PLL_PDBRF|RX2_RX1N|RXBB_EN|ATTN_MASK|ENABLE_33|ENABLE_5)); - usrp()->write_io(d_which, (PLL_CE|RX2_RX1N|RXBB_EN|ENABLE_33|ENABLE_5), (PLL_CE|PLL_PDBRF|RX2_RX1N|RXBB_EN|ATTN_MASK|ENABLE_33|ENABLE_5)); - //fprintf(stderr,"Setting WBXNG RXBB on"); - - // Enable VCO/PLL - //d_common->_enable(true); - usrp()->write_io(d_which, (PLL_PDBRF), (PLL_PDBRF)); - - // set up for RX on TX/RX port - select_rx_antenna("TX/RX"); - - bypass_adc_buffers(true); - - /* - set_lo_offset(-4e6); - */ - - set_gain(gain_min()); // initialize gain -} - -db_wbxng_rx::~db_wbxng_rx() -{ - shutdown(); -} - -void -db_wbxng_rx::shutdown() -{ - // fprintf(stderr, "db_wbxng_rx::shutdown d_is_shutdown = %d\n", d_is_shutdown); - - if (!d_is_shutdown){ - d_is_shutdown = true; - // do whatever there is to do to shutdown - - // Power down VCO/PLL - //d_common->_enable(false); - usrp()->write_io(d_which, 0, (PLL_PDBRF)); - - // fprintf(stderr, "db_wbxng_rx::shutdown before _write_control\n"); - //_write_control(_compute_control_reg()); - - // fprintf(stderr, "db_wbxng_rx::shutdown before _enable_refclk\n"); - _enable_refclk(false); // turn off refclk - - // fprintf(stderr, "db_wbxng_rx::shutdown before set_auto_tr\n"); - set_auto_tr(false); - - // Power down - usrp()->write_io(d_which, 0, (PLL_CE|PLL_PDBRF|RX2_RX1N|RXBB_EN|ATTN_MASK|ENABLE_33|ENABLE_5)); - - // fprintf(stderr, "db_wbxng_rx::shutdown after set_auto_tr\n"); - } -} - -bool -db_wbxng_rx::set_auto_tr(bool on) -{ - bool ok = true; - if(on) { - ok &= set_atr_mask (RXBB_EN|RX2_RX1N); - ok &= set_atr_txval( 0|RX2_RX1N); - ok &= set_atr_rxval(RXBB_EN| 0); - } - else { - ok &= set_atr_mask (0); - ok &= set_atr_txval(0); - ok &= set_atr_rxval(0); - } - return true; -} - -bool -db_wbxng_rx::select_rx_antenna(int which_antenna) -{ - /* - Specify which antenna port to use for reception. - @param which_antenna: either 'TX/RX' or 'RX2' - */ - - if(which_antenna == 0) { - usrp()->write_io(d_which, 0,RX2_RX1N); - } - else if(which_antenna == 1) { - usrp()->write_io(d_which, RX2_RX1N, RX2_RX1N); - } - else { - return false; - } - return true; -} - -bool -db_wbxng_rx::select_rx_antenna(const std::string &which_antenna) -{ - /* - Specify which antenna port to use for reception. - @param which_antenna: either 'TX/RX' or 'RX2' - */ - - - if(which_antenna == "TX/RX") { - usrp()->write_io(d_which, 0, RX2_RX1N); - } - else if(which_antenna == "RX2") { - usrp()->write_io(d_which, RX2_RX1N, RX2_RX1N); - } - else { - return false; - } - - return true; -} - -bool -db_wbxng_rx::set_gain(float gain) -{ - /* - Set the gain. - - @param gain: gain in decibels - @returns True/False - */ - - // clamp gain - gain = std::max(gain_min(), std::min(gain, gain_max())); - - float pga_gain, agc_gain; - - float maxgain = gain_max() - usrp()->pga_max(); - if(gain > maxgain) { - pga_gain = gain-maxgain; - assert(pga_gain <= usrp()->pga_max()); - agc_gain = maxgain; - } - else { - pga_gain = 0; - agc_gain = gain; - } - - return _set_attn(maxgain-agc_gain) && _set_pga(int(pga_gain)); -} - -bool -db_wbxng_rx::_set_attn(float attn) -{ - int attn_code = int(floor(attn/0.5)); - unsigned int iobits = (~attn_code) << ATTN_SHIFT; - //fprintf(stderr, "Attenuation: %f dB, Code: %d, IO Bits %x, Mask: %x \n", attn, attn_code, iobits & ATTN_MASK, ATTN_MASK); - return usrp()->write_io(d_which, iobits, ATTN_MASK); -} - -float -db_wbxng_rx::gain_min() -{ - return usrp()->pga_min(); -} - -float -db_wbxng_rx::gain_max() -{ - return usrp()->pga_max()+30.5; -} - -float -db_wbxng_rx::gain_db_per_step() -{ - return 0.05; -} - -bool -db_wbxng_rx::i_and_q_swapped() -{ - return false; -} diff --git a/usrp/host/lib/db_wbxng_adf4350.cc b/usrp/host/lib/db_wbxng_adf4350.cc deleted file mode 100644 index f1ab63d82..000000000 --- a/usrp/host/lib/db_wbxng_adf4350.cc +++ /dev/null @@ -1,148 +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 asversion 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 "db_wbxng_adf4350.h" -#include <db_base_impl.h> -#include <stdio.h> - -#define FREQ_C(freq) uint64_t(freq) -#define DIV_ROUND(num, denom) (((num) + ((denom)/2))/(denom)) -#define MIN_INT_DIV uint16_t(23) /* minimum int divider, prescaler 4/5 only */ -#define MAX_RF_DIV uint8_t(16) /* max rf divider, divides rf output */ -#define MIN_VCO_FREQ FREQ_C(2.2e9) /* minimum vco freq */ -#define MAX_VCO_FREQ FREQ_C(4.4e9) /* minimum vco freq */ -#define MAX_FREQ DIV_ROUND(MAX_VCO_FREQ, 1) /* upper bound freq (rf div = 1) */ -#define MIN_FREQ DIV_ROUND(MIN_VCO_FREQ, MAX_RF_DIV) /* calculated lower bound freq */ - -#define CE_PIN (1 << 3) -#define PDB_RF_PIN (1 << 2) -#define MUX_PIN (1 << 1) -#define LD_PIN (1 << 0) - -adf4350::adf4350() -{ - d_regs = new adf4350_regs(); -} - -adf4350::~adf4350() -{ - delete d_regs; -} - -std::string -adf4350::compute_register(uint8_t addr) -{ - uint32_t data = d_regs->compute_register(addr); - - data |= addr; - - // create std::string from data here - char s[4]; - s[0] = (char)((data >> 24) & 0xff); - s[1] = (char)((data >> 16) & 0xff); - s[2] = (char)((data >> 8) & 0xff); - s[3] = (char)(data & 0xff); - return std::string(s, 4); -} - -freq_t -adf4350::_get_max_freq(void) -{ - return MAX_FREQ; -} - -freq_t -adf4350::_get_min_freq(void) -{ - return MIN_FREQ; -} - -bool -adf4350::_set_freq(freq_t freq, freq_t refclock_freq) -{ - /* Set the frequency by setting int, frac, mod, r, div */ - if (freq > MAX_FREQ || freq < MIN_FREQ) return false; - int min_int_div = 23; - d_regs->d_prescaler = 0; - if (freq > FREQ_C(3e9)) { - min_int_div = 75; - d_regs->d_prescaler = 1; - } - /* Ramp up the RF divider until the VCO is within range. */ - d_regs->d_divider_select = 0; - while (freq < MIN_VCO_FREQ){ - freq <<= 1; //double the freq - d_regs->d_divider_select++; //double the divider - } - /* Ramp up the R divider until the N divider is at least the minimum. */ - //d_regs->d_10_bit_r_counter = refclock_freq*MIN_INT_DIV/freq; - d_regs->d_10_bit_r_counter = 2; - uint64_t n_mod; - do{ - d_regs->d_10_bit_r_counter++; - n_mod = freq; - n_mod *= d_regs->d_10_bit_r_counter; - n_mod *= d_regs->d_mod; - n_mod /= refclock_freq; - /* calculate int and frac */ - d_regs->d_int = n_mod/d_regs->d_mod; - d_regs->d_frac = (n_mod - (freq_t)d_regs->d_int*d_regs->d_mod) & uint16_t(0xfff); - /* - fprintf(stderr, - "VCO %lu KHz, Int %u, Frac %u, Mod %u, R %u, Div %u\n", - freq, d_regs->d_int, d_regs->d_frac, - d_regs->d_mod, d_regs->d_10_bit_r_counter, (1 << d_regs->d_divider_select) - ); - */ - }while(d_regs->d_int < min_int_div); - /* calculate the band select so PFD is under 125 KHz */ - d_regs->d_8_bit_band_select_clock_divider_value = \ - refclock_freq/(FREQ_C(30e3)*d_regs->d_10_bit_r_counter) + 1; - /* - fprintf(stderr, "Band Selection: Div %u, Freq %lu\n", - d_regs->d_8_bit_band_select_clock_divider_value, - refclock_freq/(d_regs->d_8_bit_band_select_clock_divider_value * d_regs->d_10_bit_r_counter) + 1 - ); - */ - return true; -} - -freq_t -adf4350::_get_freq(freq_t refclock_freq) -{ - /* Calculate the freq from int, frac, mod, ref, r, div: - * freq = (int + frac/mod) * (ref/r) - * Keep precision by doing multiplies first: - * freq = (((((((int)*mod) + frac)*ref)/mod)/r)/div) - */ - uint64_t freq; - freq = d_regs->d_int; - freq *= d_regs->d_mod; - freq += d_regs->d_frac; - freq *= refclock_freq; - freq /= d_regs->d_mod; - freq /= d_regs->d_10_bit_r_counter; - freq /= (1 << d_regs->d_divider_select); - return freq; -} diff --git a/usrp/host/lib/db_wbxng_adf4350.h b/usrp/host/lib/db_wbxng_adf4350.h deleted file mode 100644 index ce8cbf4b1..000000000 --- a/usrp/host/lib/db_wbxng_adf4350.h +++ /dev/null @@ -1,47 +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 asversion 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_ADF4350_H -#define INCLUDED_ADF4350_H - -#include "db_wbxng_adf4350_regs.h" -#include <usrp/db_base.h> -#include <stdint.h> - -typedef uint64_t freq_t; -class adf4350_regs; - -class adf4350 -{ -public: - adf4350(); - ~adf4350(); - void _update(); - std::string compute_register(uint8_t addr); - bool _set_freq(freq_t freq, freq_t refclock_freq); - freq_t _get_freq(freq_t refclock_freq); - freq_t _get_max_freq(); - freq_t _get_min_freq(); - -protected: - adf4350_regs *d_regs; -}; - -#endif /* INCLUDED_ADF4350_H */ diff --git a/usrp/host/lib/db_wbxng_adf4350_regs.cc b/usrp/host/lib/db_wbxng_adf4350_regs.cc deleted file mode 100644 index c9707c3c6..000000000 --- a/usrp/host/lib/db_wbxng_adf4350_regs.cc +++ /dev/null @@ -1,136 +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 asversion 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 "db_wbxng_adf4350_regs.h" -#include "db_wbxng_adf4350.h" - -//#include "cal_div.h" - -/* reg 0 */ -/* reg 1 */ -const uint16_t adf4350_regs::s_phase = 0; -/* reg 2 */ -const uint8_t adf4350_regs::s_low_noise_and_low_spur_modes = 3; -const uint8_t adf4350_regs::s_muxout = 6; -const uint8_t adf4350_regs::s_reference_doubler = 0; -const uint8_t adf4350_regs::s_rdiv2 = 0; -const uint8_t adf4350_regs::s_double_buff = 0; -const uint8_t adf4350_regs::s_charge_pump_setting = 5; -const uint8_t adf4350_regs::s_ldf = 0; -const uint8_t adf4350_regs::s_ldp = 0; -const uint8_t adf4350_regs::s_pd_polarity = 1; -const uint8_t adf4350_regs::s_power_down = 0; -const uint8_t adf4350_regs::s_cp_three_state = 0; -const uint8_t adf4350_regs::s_counter_reset = 0; -/* reg 3 */ -const uint8_t adf4350_regs::s_csr = 0; -const uint8_t adf4350_regs::s_clk_div_mode = 0; -const uint16_t adf4350_regs::s_12_bit_clock_divider_value = 0; -/* reg 4 */ -const uint8_t adf4350_regs::s_feedback_select = 1; -const uint8_t adf4350_regs::s_vco_power_down = 0; -const uint8_t adf4350_regs::s_mtld = 0; -const uint8_t adf4350_regs::s_aux_output_select = 1; -const uint8_t adf4350_regs::s_aux_output_enable = 0; -const uint8_t adf4350_regs::s_aux_output_power = 0; -const uint8_t adf4350_regs::s_rf_output_enable = 1; -const uint8_t adf4350_regs::s_output_power = 3; -/* reg 5 */ -const uint8_t adf4350_regs::s_ld_pin_mode = 1; - -adf4350_regs::adf4350_regs(){ - - /* reg 0 */ - d_int = uint16_t(100); - d_frac = 0; - /* reg 1 */ - d_prescaler = uint8_t(0); - d_mod = uint16_t(0xfff); /* max fractional accuracy */ - /* reg 2 */ - d_10_bit_r_counter = uint16_t(2); - /* reg 3 */ - /* reg 4 */ - d_divider_select = 0; - d_8_bit_band_select_clock_divider_value = 0; - /* reg 5 */ -} - -adf4350_regs::~adf4350_regs(void){ -} - -uint32_t -adf4350_regs::_reg_shift(uint32_t data, uint32_t shift){ - return data << shift; -} - -uint32_t -adf4350_regs::compute_register(uint8_t addr){ - uint32_t data = 0; - switch (addr){ - case 0: data = ( - _reg_shift(d_int, 15) | - _reg_shift(d_frac, 3)); - break; - case 1: data = ( - _reg_shift(d_prescaler, 27) | - _reg_shift(s_phase, 15) | - _reg_shift(d_mod, 3)); - break; - case 2: data = ( - _reg_shift(s_low_noise_and_low_spur_modes, 29) | - _reg_shift(s_muxout, 26) | - _reg_shift(s_reference_doubler, 25) | - _reg_shift(s_rdiv2, 24) | - _reg_shift(d_10_bit_r_counter, 14) | - _reg_shift(s_double_buff, 13) | - _reg_shift(s_charge_pump_setting, 9) | - _reg_shift(s_ldf, 8) | - _reg_shift(s_ldp, 7) | - _reg_shift(s_pd_polarity, 6) | - _reg_shift(s_power_down, 5) | - _reg_shift(s_cp_three_state, 4) | - _reg_shift(s_counter_reset, 3)); - break; - case 3: data = ( - _reg_shift(s_csr, 18) | - _reg_shift(s_clk_div_mode, 15) | - _reg_shift(s_12_bit_clock_divider_value, 3)); - break; - case 4: data = ( - _reg_shift(s_feedback_select, 23) | - _reg_shift(d_divider_select, 20) | - _reg_shift(d_8_bit_band_select_clock_divider_value, 12) | - _reg_shift(s_vco_power_down, 11) | - _reg_shift(s_mtld, 10) | - _reg_shift(s_aux_output_select, 9) | - _reg_shift(s_aux_output_enable, 8) | - _reg_shift(s_aux_output_power, 6) | - _reg_shift(s_rf_output_enable, 5) | - _reg_shift(s_output_power, 3)); - break; - case 5: data = ( - _reg_shift(s_ld_pin_mode, 22)); - break; - default: return data; - } - /* return the data to write out to spi */ - return data; -} - diff --git a/usrp/host/lib/db_wbxng_adf4350_regs.h b/usrp/host/lib/db_wbxng_adf4350_regs.h deleted file mode 100644 index 33a548e85..000000000 --- a/usrp/host/lib/db_wbxng_adf4350_regs.h +++ /dev/null @@ -1,83 +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 asversion 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 ADF4350_REGS_H -#define ADF4350_REGS_H - -#include <usrp/db_base.h> -#include <stdint.h> - -class adf4350; - -class adf4350_regs -{ -public: - adf4350_regs(); - ~adf4350_regs(); - - uint32_t _reg_shift(uint32_t data, uint32_t shift); - uint32_t compute_register(uint8_t addr); - - /* reg 0 */ - uint16_t d_int; - uint16_t d_frac; - /* reg 1 */ - uint8_t d_prescaler; - static const uint16_t s_phase; - uint16_t d_mod; - /* reg 2 */ - static const uint8_t s_low_noise_and_low_spur_modes; - static const uint8_t s_muxout; - static const uint8_t s_reference_doubler; - static const uint8_t s_rdiv2; - uint16_t d_10_bit_r_counter; - static const uint8_t s_double_buff; - static const uint8_t s_charge_pump_setting; - static const uint8_t s_ldf; - static const uint8_t s_ldp; - static const uint8_t s_pd_polarity; - static const uint8_t s_power_down; - static const uint8_t s_cp_three_state; - static const uint8_t s_counter_reset; - /* reg 3 */ - static const uint8_t s_csr; - static const uint8_t s_clk_div_mode; - static const uint16_t s_12_bit_clock_divider_value; - /* reg 4 */ - static const uint8_t s_feedback_select; - uint8_t d_divider_select; - uint8_t d_8_bit_band_select_clock_divider_value; - static const uint8_t s_vco_power_down; - static const uint8_t s_mtld; - static const uint8_t s_aux_output_select; - static const uint8_t s_aux_output_enable; - static const uint8_t s_aux_output_power; - static const uint8_t s_rf_output_enable; - static const uint8_t s_output_power; - /* reg 5 */ - static const uint8_t s_ld_pin_mode; - -protected: - usrp_basic_sptr d_usrp; - int d_spi_enable; - int d_spi_format; -}; - -#endif /* ADF4350_REGS_H */ diff --git a/usrp/host/lib/db_xcvr2450.cc b/usrp/host/lib/db_xcvr2450.cc deleted file mode 100644 index ce9d1f4e8..000000000 --- a/usrp/host/lib/db_xcvr2450.cc +++ /dev/null @@ -1,795 +0,0 @@ -// -// 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 asversion 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/db_xcvr2450.h> -#include <db_base_impl.h> -#include <cmath> -#include <boost/thread.hpp> -#include <boost/weak_ptr.hpp> -#include <cstdio> - -#if 0 -#define LO_OFFSET 4.25e6 -#else -#define LO_OFFSET 0 -#define NO_LO_OFFSET -#endif - - -/* ------------------------------------------------------------------------ - * A few comments about the XCVR2450: - * - * It is half-duplex. I.e., transmit and receive are mutually exclusive. - * There is a single LO for both the Tx and Rx sides. - * For our purposes the board is always either receiving or transmitting. - * - * Each board is uniquely identified by the *USRP hardware* instance and side - * This dictionary holds a weak reference to existing board controller so it - * can be created or retrieved as needed. - */ - - - -// TX IO Pins -#define HB_PA_OFF (1 << 15) // 5GHz PA, 1 = off, 0 = on -#define LB_PA_OFF (1 << 14) // 2.4GHz PA, 1 = off, 0 = on -#define ANTSEL_TX1_RX2 (1 << 13) // 1 = Ant 1 to TX, Ant 2 to RX -#define ANTSEL_TX2_RX1 (1 << 12) // 1 = Ant 2 to TX, Ant 1 to RX -#define TX_EN (1 << 11) // 1 = TX on, 0 = TX off -#define AD9515DIV (1 << 4) // 1 = Div by 3, 0 = Div by 2 - -#define TX_OE_MASK HB_PA_OFF|LB_PA_OFF|ANTSEL_TX1_RX2|ANTSEL_TX2_RX1|TX_EN|AD9515DIV -#define TX_SAFE_IO HB_PA_OFF|LB_PA_OFF|ANTSEL_TX1_RX2|AD9515DIV - -// RX IO Pins -#define LOCKDET (1 << 15) // This is an INPUT!!! -#define EN (1 << 14) -#define RX_EN (1 << 13) // 1 = RX on, 0 = RX off -#define RX_HP (1 << 12) -#define RX_OE_MASK EN|RX_EN|RX_HP -#define RX_SAFE_IO EN - -struct xcvr2450_key { - std::string serial_no; - int which; - - bool operator==(const xcvr2450_key &x){ - return x.serial_no ==serial_no && x.which == which; - } -}; - -class xcvr2450 -{ -private: - usrp_basic *d_raw_usrp; - int d_which; - - bool d_is_shutdown; - int d_spi_format, d_spi_enable; - - int d_mimo, d_int_div, d_frac_div, d_highband, d_five_gig; - int d_cp_current, d_ref_div, d_rssi_hbw; - int d_txlpf_bw, d_rxlpf_bw, d_rxlpf_fine, d_rxvga_ser; - int d_rssi_range, d_rssi_mode, d_rssi_mux; - int d_rx_hp_pin, d_rx_hpf, d_rx_ant; - int d_tx_ant, d_txvga_ser, d_tx_driver_lin; - int d_tx_vga_lin, d_tx_upconv_lin, d_tx_bb_gain; - int d_pabias_delay, d_pabias, rx_rf_gain, rx_bb_gain, d_txgain; - int d_rx_rf_gain, d_rx_bb_gain; - - int d_reg_standby, d_reg_int_divider, d_reg_frac_divider, d_reg_bandselpll; - int d_reg_cal, dsend_reg, d_reg_lpf, d_reg_rxrssi_ctrl, d_reg_txlin_gain; - int d_reg_pabias, d_reg_rxgain, d_reg_txgain; - - int d_ad9515_div; - - void _set_rfagc(float gain); - void _set_ifagc(float gain); - void _set_pga(float pga_gain); - -public: - usrp_basic *usrp(){ - return d_raw_usrp; - } - - xcvr2450(usrp_basic_sptr usrp, int which); - ~xcvr2450(); - void shutdown(); - - void set_reg_standby(); - - // Integer-Divider Ratio (3) - void set_reg_int_divider(); - - // Fractional-Divider Ratio (4) - void set_reg_frac_divider(); - - // Band Select and PLL (5) - void set_reg_bandselpll(); - - // Calibration (6) - void set_reg_cal(); - - // Lowpass Filter (7) - void set_reg_lpf(); - - // Rx Control/RSSI (8) - void set_reg_rxrssi_ctrl(); - - // Tx Linearity/Baseband Gain (9) - void set_reg_txlin_gain(); - - // PA Bias DAC (10) - void set_reg_pabias(); - - // Rx Gain (11) - void set_reg_rxgain(); - - // Tx Gain (12) - void set_reg_txgain(); - - // Send register write to SPI - void send_reg(int v); - - void set_gpio(); - bool lock_detect(); - bool set_rx_gain(float gain); - bool set_tx_gain(float gain); - - struct freq_result_t set_freq(double target_freq); -}; - - -/*****************************************************************************/ - - -xcvr2450::xcvr2450(usrp_basic_sptr _usrp, int which) - : d_raw_usrp(_usrp.get()), d_which(which), d_is_shutdown(false) -{ - // Handler for Tv Rx daughterboards. - // - // @param usrp: instance of usrp.source_c - // @param which: which side: 0, 1 corresponding to RX_A or RX_B respectively - - // Use MSB with no header - d_spi_format = SPI_FMT_MSB | SPI_FMT_HDR_0; - - if(which == 0) { - d_spi_enable = SPI_ENABLE_RX_A; - } - else { - d_spi_enable = SPI_ENABLE_RX_B; - } - - // Sane defaults - d_mimo = 1; // 0 = OFF, 1 = ON - d_int_div = 192; // 128 = min, 255 = max - d_frac_div = 0; // 0 = min, 65535 = max - d_highband = 0; // 0 = freq <= 5.4e9, 1 = freq > 5.4e9 - d_five_gig = 0; // 0 = freq <= 3.e9, 1 = freq > 3e9 - d_cp_current = 1; // 0 = 2mA, 1 = 4mA - d_ref_div = 1; // 1 to 7 - d_rssi_hbw = 0; // 0 = 2 MHz, 1 = 6 MHz - d_txlpf_bw = 1; // 1 = 12 MHz, 2 = 18 MHz, 3 = 24 MHz - d_rxlpf_bw = 1; // 0 = 7.5 MHz, 1 = 9.5 MHz, 2 = 14 MHz, 3 = 18 MHz - d_rxlpf_fine = 2; // 0 = 90%, 1 = 95%, 2 = 100%, 3 = 105%, 4 = 110% - d_rxvga_ser = 1; // 0 = RXVGA controlled by B7:1, 1=controlled serially - d_rssi_range = 1; // 0 = low range (datasheet typo), 1=high range (0.5V - 2.0V) - d_rssi_mode = 1; // 0 = enable follows RXHP, 1 = enabled - d_rssi_mux = 0; // 0 = RSSI, 1 = TEMP - d_rx_hp_pin = 0; // 0 = Fc set by rx_hpf, 1 = 600 KHz - d_rx_hpf = 0; // 0 = 100Hz, 1 = 30KHz - d_rx_ant = 0; // 0 = Ant. #1, 1 = Ant. #2 - d_tx_ant = 0; // 0 = Ant. #1, 1 = Ant. #2 - d_txvga_ser = 1; // 0 = TXVGA controlled by B6:1, 1=controlled serially - d_tx_driver_lin = 2; // 0=50% (worst linearity), 1=63%, 2=78%, 3=100% (best lin) - d_tx_vga_lin = 2; // 0=50% (worst linearity), 1=63%, 2=78%, 3=100% (best lin) - d_tx_upconv_lin = 2; // 0=50% (worst linearity), 1=63%, 2=78%, 3=100% (best lin) - d_tx_bb_gain = 3; // 0=maxgain-5dB, 1=max-3dB, 2=max-1.5dB, 3=max - d_pabias_delay = 15; // 0 = 0, 15 = 7uS - d_pabias = 0; // 0 = 0 uA, 63 = 315uA - d_rx_rf_gain = 0; // 0 = 0dB, 1 = 0dB, 2 = 15dB, 3 = 30dB - d_rx_bb_gain = 16; // 0 = min, 31 = max (0 - 62 dB) - - d_txgain = 63; // 0 = min, 63 = max - - // Initialize GPIO and ATR - usrp()->common_write_io(C_TX, d_which, TX_SAFE_IO, TX_OE_MASK); - usrp()->_common_write_oe(C_TX, d_which, TX_OE_MASK, 0xffff); - usrp()->common_write_atr_txval(C_TX, d_which, TX_SAFE_IO); - usrp()->common_write_atr_rxval(C_TX, d_which, TX_SAFE_IO); - usrp()->common_write_atr_mask(C_TX, d_which, TX_OE_MASK); - - usrp()->common_write_io(C_RX, d_which, RX_SAFE_IO, RX_OE_MASK); - usrp()->_common_write_oe(C_RX, d_which, RX_OE_MASK, 0xffff); - usrp()->common_write_atr_txval(C_RX, d_which, RX_SAFE_IO); - usrp()->common_write_atr_rxval(C_RX, d_which, RX_SAFE_IO); - usrp()->common_write_atr_mask(C_RX, d_which, RX_OE_MASK); - - // Initialize chipset - // TODO: perform reset sequence to ensure power up defaults - set_reg_standby(); - set_reg_bandselpll(); - set_reg_cal(); - set_reg_lpf(); - set_reg_rxrssi_ctrl(); - set_reg_txlin_gain(); - set_reg_pabias(); - set_reg_rxgain(); - set_reg_txgain(); - //FIXME: set_freq(2.45e9); -} - -xcvr2450::~xcvr2450() -{ - //printf("xcvr2450::destructor\n"); - shutdown(); -} - -void -xcvr2450::shutdown() -{ - if (!d_is_shutdown){ - d_is_shutdown = true; - usrp()->common_write_atr_txval(C_TX, d_which, TX_SAFE_IO); - usrp()->common_write_atr_rxval(C_TX, d_which, TX_SAFE_IO); - usrp()->common_write_atr_txval(C_RX, d_which, RX_SAFE_IO); - usrp()->common_write_atr_rxval(C_RX, d_which, RX_SAFE_IO); - } -} - - -void -xcvr2450::set_reg_standby() -{ - d_reg_standby = ((d_mimo<<17) | - (1<<16) | - (1<<6) | - (1<<5) | - (1<<4) | 2); - send_reg(d_reg_standby); -} - -void -xcvr2450::set_reg_int_divider() -{ - d_reg_int_divider = (((d_frac_div & 0x03)<<16) | - (d_int_div<<4) | 3); - send_reg(d_reg_int_divider); -} - -void -xcvr2450::set_reg_frac_divider() -{ - d_reg_frac_divider = ((d_frac_div & 0xfffc)<<2) | 4; - send_reg(d_reg_frac_divider); -} - -void -xcvr2450::set_reg_bandselpll() -{ - d_reg_bandselpll = ((d_mimo<<17) | - (1<<16) | - (1<<15) | - (0<<11) | - (d_highband<<10) | - (d_cp_current<<9) | - (d_ref_div<<5) | - (d_five_gig<<4) | 5); - send_reg(d_reg_bandselpll); - d_reg_bandselpll = ((d_mimo<<17) | - (1<<16) | - (1<<15) | - (1<<11) | - (d_highband<<10) | - (d_cp_current<<9) | - (d_ref_div<<5) | - (d_five_gig<<4) | 5); - send_reg(d_reg_bandselpll); -} - -void -xcvr2450::set_reg_cal() -{ - // FIXME do calibration - d_reg_cal = (1<<14)|6; - send_reg(d_reg_cal); -} - -void -xcvr2450::set_reg_lpf() -{ - d_reg_lpf = ( - (d_rssi_hbw<<15) | - (d_txlpf_bw<<9) | - (d_rxlpf_bw<<7) | - (d_rxlpf_fine<<4) | 7); - send_reg(d_reg_lpf); -} - -void -xcvr2450::set_reg_rxrssi_ctrl() -{ - d_reg_rxrssi_ctrl = ((d_rxvga_ser<<16) | - (d_rssi_range<<15) | - (d_rssi_mode<<14) | - (d_rssi_mux<<12) | - (1<<9) | - (d_rx_hpf<<6) | - (1<<4) | 8); - send_reg(d_reg_rxrssi_ctrl); -} - -void -xcvr2450::set_reg_txlin_gain() -{ - d_reg_txlin_gain = ((d_txvga_ser<<14) | - (d_tx_driver_lin<<12) | - (d_tx_vga_lin<<10) | - (d_tx_upconv_lin<<6) | - (d_tx_bb_gain<<4) | 9); - send_reg(d_reg_txlin_gain); -} - -void -xcvr2450::set_reg_pabias() -{ - d_reg_pabias = ( - (d_pabias_delay<<10) | - (d_pabias<<4) | 10); - send_reg(d_reg_pabias); -} - -void -xcvr2450::set_reg_rxgain() -{ - d_reg_rxgain = ( - (d_rx_rf_gain<<9) | - (d_rx_bb_gain<<4) | 11); - send_reg(d_reg_rxgain); -} - -void -xcvr2450::set_reg_txgain() -{ - d_reg_txgain = (d_txgain<<4) | 12; - send_reg(d_reg_txgain); -} - -void -xcvr2450::send_reg(int v) -{ - // Send 24 bits, it keeps last 18 clocked in - char c[3]; - c[0] = (char)((v >> 16) & 0xff); - c[1] = (char)((v >> 8) & 0xff); - c[2] = (char)((v & 0xff)); - std::string s(c, 3); - - usrp()->_write_spi(0, d_spi_enable, d_spi_format, s); - //printf("xcvr2450: Setting reg %d to %X\n", (v&15), v); -} - -// ---------------------------------------------------------------- - -void -xcvr2450::set_gpio() -{ - // We calculate four values: - // - // io_rx_while_rx: what to drive onto io_rx_* when receiving - // io_rx_while_tx: what to drive onto io_rx_* when transmitting - // io_tx_while_rx: what to drive onto io_tx_* when receiving - // io_tx_while_tx: what to drive onto io_tx_* when transmitting - // - // B1-B7 is ignored as gain is set serially for now. - - int rx_hp, tx_antsel, rx_antsel, tx_pa_sel; - if(d_rx_hp_pin) - rx_hp = RX_HP; - else - rx_hp = 0; - - if(d_tx_ant) - tx_antsel = ANTSEL_TX2_RX1; - else - tx_antsel = ANTSEL_TX1_RX2; - - if(d_rx_ant) - rx_antsel = ANTSEL_TX2_RX1; - else - rx_antsel = ANTSEL_TX1_RX2; - - if(d_five_gig) - tx_pa_sel = LB_PA_OFF; - else - tx_pa_sel = HB_PA_OFF; - - // Reset GPIO and ATR - // FIXME: dont set io, oe, atr mask once basic code stops overriding our settings - usrp()->common_write_io(C_TX, d_which, TX_SAFE_IO, TX_OE_MASK); - usrp()->_common_write_oe(C_TX, d_which, TX_OE_MASK, 0xffff); - usrp()->common_write_atr_txval(C_TX, d_which, tx_pa_sel|tx_antsel|TX_EN|AD9515DIV); - usrp()->common_write_atr_rxval(C_TX, d_which, HB_PA_OFF|LB_PA_OFF|rx_antsel|AD9515DIV); - usrp()->common_write_atr_mask(C_TX, d_which, TX_OE_MASK); - - usrp()->common_write_io(C_RX, d_which, RX_SAFE_IO, RX_OE_MASK); - usrp()->_common_write_oe(C_RX, d_which, RX_OE_MASK, 0xffff); - usrp()->common_write_atr_txval(C_RX, d_which, EN|rx_hp); - usrp()->common_write_atr_rxval(C_RX, d_which, EN|rx_hp|RX_EN); - usrp()->common_write_atr_mask(C_RX, d_which, RX_OE_MASK); - - //printf("GPIO: RXRX=%04X RXTX=%04X TXRX=%04X TXTX=%04X\n", - // io_rx_while_rx, io_rx_while_tx, io_tx_while_rx, io_tx_while_tx); -} - - -struct freq_result_t -xcvr2450::set_freq(double target_freq) -{ - struct freq_result_t args = {false, 0}; - - double scaler; - - if(target_freq > 3e9) { - d_five_gig = 1; - d_ad9515_div = 3; - scaler = 4.0/5.0; - } - else { - d_five_gig = 0; - d_ad9515_div = 3; - scaler = 4.0/3.0; - } - - if(target_freq > 5.408e9) { - d_highband = 1; - } - else { - d_highband = 0; - } - - double vco_freq = target_freq*scaler; - double sys_clk = usrp()->fpga_master_clock_freq(); // Usually 64e6 - double ref_clk = sys_clk / d_ad9515_div; - - double phdet_freq = ref_clk/d_ref_div; - double div = vco_freq/phdet_freq; - d_int_div = int(floor(div)); - d_frac_div = int((div-d_int_div)*65536.0); - // double actual_freq = phdet_freq*(d_int_div+(d_frac_div/65536.0))/scaler; - - //printf("RF=%f VCO=%f R=%d PHD=%f DIV=%3.5f I=%3d F=%5d ACT=%f\n", - // target_freq, vco_freq, d_ref_div, phdet_freq, - // div, d_int_div, d_frac_div, actual_freq); - - set_gpio(); - set_reg_int_divider(); - set_reg_frac_divider(); - set_reg_bandselpll(); - - args.ok = lock_detect(); -#ifdef NO_LO_OFFSET - args.baseband_freq = target_freq; -#else - args.baseband_freq = actual_freq; -#endif - - if(!args.ok){ - printf("Fail %f\n", target_freq); - } - return args; -} - -bool -xcvr2450::lock_detect() -{ - /* - @returns: the value of the VCO/PLL lock detect bit. - @rtype: 0 or 1 - */ - if(usrp()->common_read_io(C_RX, d_which) & LOCKDET) { - return true; - } - else { // Give it a second chance - if(usrp()->common_read_io(C_RX, d_which) & LOCKDET) - return true; - else - return false; - } -} - -bool -xcvr2450::set_rx_gain(float gain) -{ - if(gain < 0.0) - gain = 0.0; - if(gain > 92.0) - gain = 92.0; - - // Split the gain between RF and baseband - // This is experimental, not prescribed - if(gain < 31.0) { - d_rx_rf_gain = 0; // 0 dB RF gain - rx_bb_gain = int(gain/2.0); - } - - if(gain >= 30.0 and gain < 60.5) { - d_rx_rf_gain = 2; // 15 dB RF gain - d_rx_bb_gain = int((gain-15.0)/2.0); - } - - if(gain >= 60.5) { - d_rx_rf_gain = 3; // 30.5 dB RF gain - d_rx_bb_gain = int((gain-30.5)/2.0); - } - - set_reg_rxgain(); - - return true; -} - -bool -xcvr2450::set_tx_gain(float gain) -{ - if(gain < 0.0) { - gain = 0.0; - } - if(gain > 30.0) { - gain = 30.0; - } - - d_txgain = int((gain/30.0)*63); - set_reg_txgain(); - - return true; -} - - -/*****************************************************************************/ - - -struct xcvr2450_table_entry { - xcvr2450_key key; - boost::weak_ptr<xcvr2450> value; - - xcvr2450_table_entry(const xcvr2450_key &_key, boost::weak_ptr<xcvr2450> _value) - : key(_key), value(_value) {} -}; - -typedef std::vector<xcvr2450_table_entry> xcvr2450_table; - -static boost::mutex s_table_mutex; -static xcvr2450_table s_table; - -static xcvr2450_sptr -_get_or_make_xcvr2450(usrp_basic_sptr usrp, int which) -{ - xcvr2450_key key = {usrp->serial_number(), which}; - - boost::mutex::scoped_lock guard(s_table_mutex); - - for (xcvr2450_table::iterator p = s_table.begin(); p != s_table.end();){ - if (p->value.expired()) // weak pointer is now dead - p = s_table.erase(p); // erase it - else { - if (key == p->key){ // found it - return xcvr2450_sptr(p->value); - } - else - ++p; // keep looking - } - } - - // We don't have the xcvr2450 we're looking for - - // create a new one and stick it in the table. - xcvr2450_sptr r(new xcvr2450(usrp, which)); - xcvr2450_table_entry t(key, r); - s_table.push_back(t); - - return r; -} - - -/*****************************************************************************/ - - -db_xcvr2450_base::db_xcvr2450_base(usrp_basic_sptr usrp, int which) - : db_base(usrp, which) -{ - /* - * Abstract base class for all xcvr2450 boards. - * - * Derive board specific subclasses from db_xcvr2450_base_{tx,rx} - * - * @param usrp: instance of usrp.source_c - * @param which: which side: 0 or 1 corresponding to side A or B respectively - * @type which: int - */ - - d_xcvr = _get_or_make_xcvr2450(usrp, which); -} - -db_xcvr2450_base::~db_xcvr2450_base() -{ -} - -void -db_xcvr2450_base::shutdown_common() -{ - // If the usrp_basic in the xcvr2450 is the same as the usrp_basic - // in the daughterboard, shutdown the xcvr now (when only one of Tx - // and Rx is open, this is always true). - - if (d_xcvr->usrp() == usrp()){ - //std::cerr << "db_xcvr2450_base::shutdown_common: same -> shutting down\n"; - d_xcvr->shutdown(); - } - else { - //std::cerr << "db_xcvr2450_base::shutdown_common: different -> ignoring\n"; - } -} - -struct freq_result_t -db_xcvr2450_base::set_freq(double target_freq) -{ - /* - * @returns (ok, actual_baseband_freq) where: - * ok is True or False and indicates success or failure, - * actual_baseband_freq is the RF frequency that corresponds to DC in the IF. - */ - return d_xcvr->set_freq(target_freq+d_lo_offset); -} - -bool -db_xcvr2450_base::is_quadrature() -{ - /* - * Return True if this board requires both I & Q analog channels. - * - * This bit of info is useful when setting up the USRP Rx mux register. - */ - return true; -} - -double -db_xcvr2450_base::freq_min() -{ - return 2.4e9; -} - -double -db_xcvr2450_base::freq_max() -{ - return 6.0e9; -} - - -/******************************************************************************/ - - -db_xcvr2450_tx::db_xcvr2450_tx(usrp_basic_sptr usrp, int which) - : db_xcvr2450_base(usrp, which) -{ - set_lo_offset(LO_OFFSET); - //printf("db_xcvr2450_tx::db_xcvr2450_tx\n"); -} - -db_xcvr2450_tx::~db_xcvr2450_tx() -{ - shutdown(); -} - -void -db_xcvr2450_tx::shutdown() -{ - if (!d_is_shutdown){ - d_is_shutdown = true; - shutdown_common(); - } -} - -float -db_xcvr2450_tx::gain_min() -{ - return 0; -} - -float -db_xcvr2450_tx::gain_max() -{ - return 30; -} - -float -db_xcvr2450_tx::gain_db_per_step() -{ - return (30.0/63.0); -} - -bool -db_xcvr2450_tx::set_gain(float gain) -{ - return d_xcvr->set_tx_gain(gain); -} - -bool -db_xcvr2450_tx::i_and_q_swapped() -{ - return true; -} - - -/******************************************************************************/ - - -db_xcvr2450_rx::db_xcvr2450_rx(usrp_basic_sptr usrp, int which) - : db_xcvr2450_base(usrp, which) -{ - /* - * @param usrp: instance of usrp.source_c - * @param which: 0 or 1 corresponding to side RX_A or RX_B respectively. - */ - set_lo_offset(LO_OFFSET); - //printf("db_xcvr2450_rx:d_xcvr_2450_rx\n"); -} - -db_xcvr2450_rx::~db_xcvr2450_rx() -{ - shutdown(); -} - -void -db_xcvr2450_rx::shutdown() -{ - if (!d_is_shutdown){ - d_is_shutdown = true; - shutdown_common(); - } -} - -float -db_xcvr2450_rx::gain_min() -{ - return 0.0; -} - -float -db_xcvr2450_rx::gain_max() -{ - return 92.0; -} - -float -db_xcvr2450_rx::gain_db_per_step() -{ - return 1; -} - -bool -db_xcvr2450_rx::set_gain(float gain) -{ - return d_xcvr->set_rx_gain(gain); -} diff --git a/usrp/host/lib/dump_data.py b/usrp/host/lib/dump_data.py deleted file mode 100755 index 034586d8a..000000000 --- a/usrp/host/lib/dump_data.py +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2003 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 struct - -fin = sys.stdin - -count = 0 - -while 1: - s = fin.read(2) - if not s or len(s) != 2: - break - - v, = struct.unpack ('H', s) - iv = int(v) & 0xffff - print "%8d %6d 0x%04x" % (count, iv, iv) - count += 1 - - - diff --git a/usrp/host/lib/fusb.cc b/usrp/host/lib/fusb.cc deleted file mode 100644 index 2a597b67c..000000000 --- a/usrp/host/lib/fusb.cc +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003,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 <fusb.h> - -// ------------------------------------------------------------------------ -// device handle -// ------------------------------------------------------------------------ - -fusb_devhandle::fusb_devhandle (libusb_device_handle *udh) - : d_udh (udh) -{ - // that's it -}; - -fusb_devhandle::~fusb_devhandle () -{ - // nop -} - -// ------------------------------------------------------------------------ -// end point handle -// ------------------------------------------------------------------------ - -fusb_ephandle::fusb_ephandle (int endpoint, bool input_p, - int block_size, int nblocks) - : d_endpoint (endpoint), d_input_p (input_p), - d_block_size (block_size), d_nblocks (nblocks), d_started (false) -{ - // that't it -} - -fusb_ephandle::~fusb_ephandle () -{ - // nop -} diff --git a/usrp/host/lib/fusb.h b/usrp/host/lib/fusb.h deleted file mode 100644 index 538ae1ae0..000000000 --- a/usrp/host/lib/fusb.h +++ /dev/null @@ -1,138 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,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 _FUSB_H_ -#define _FUSB_H_ - -#include <usrp/libusb_types.h> - -struct libusb_context; -class fusb_ephandle; - -/*! - * \brief abstract usb device handle - */ -class fusb_devhandle { -private: - // NOT IMPLEMENTED - fusb_devhandle (const fusb_devhandle &rhs); // no copy constructor - fusb_devhandle &operator= (const fusb_devhandle &rhs); // no assignment operator - -protected: - libusb_device_handle *d_udh; - -public: - // CREATORS - fusb_devhandle (libusb_device_handle *udh); - virtual ~fusb_devhandle (); - - // MANIPULATORS - - /*! - * \brief return an ephandle of the correct subtype - */ - virtual fusb_ephandle *make_ephandle (int endpoint, bool input_p, - int block_size = 0, int nblocks = 0) = 0; - - // ACCESSORS - libusb_device_handle *get_usb_dev_handle () const { return d_udh; } -}; - - -/*! - * \brief abstract usb end point handle - */ -class fusb_ephandle { -private: - // NOT IMPLEMENTED - fusb_ephandle (const fusb_ephandle &rhs); // no copy constructor - fusb_ephandle &operator= (const fusb_ephandle &rhs); // no assignment operator - -protected: - int d_endpoint; - bool d_input_p; - int d_block_size; - int d_nblocks; - bool d_started; - -public: - fusb_ephandle (int endpoint, bool input_p, - int block_size = 0, int nblocks = 0); - virtual ~fusb_ephandle (); - - virtual bool start () = 0; //!< begin streaming i/o - virtual bool stop () = 0; //!< stop streaming i/o - - /*! - * \returns \p nbytes if write was successfully enqueued, else -1. - * Will block if no free buffers available. - */ - virtual int write (const void *buffer, int nbytes) = 0; - - /*! - * \returns number of bytes read or -1 if error. - * number of bytes read will be <= nbytes. - * Will block if no input available. - */ - virtual int read (void *buffer, int nbytes) = 0; - - /* - * block until all outstanding writes have completed - */ - virtual void wait_for_completion () = 0; - - /*! - * \brief returns current block size. - */ - int block_size () { return d_block_size; }; -}; - - -/*! - * \brief factory for creating concrete instances of the appropriate subtype. - */ -class fusb_sysconfig { -public: - /*! - * \brief returns fusb_devhandle or throws if trouble - */ - static fusb_devhandle *make_devhandle (libusb_device_handle *udh, - libusb_context *ctx = 0); - - /*! - * \brief Returns max block size in bytes (hard limit). - */ - static int max_block_size (); - - /*! - * \brief Returns default block size in bytes. - */ - static int default_block_size (); - - /*! - * \brief Returns the default buffer size in bytes. - */ - static int default_buffer_size (); - -}; - -#endif /* _FUSB_H_ */ diff --git a/usrp/host/lib/fusb_darwin.cc b/usrp/host/lib/fusb_darwin.cc deleted file mode 100644 index d2966c115..000000000 --- a/usrp/host/lib/fusb_darwin.cc +++ /dev/null @@ -1,582 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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 - -#define DO_DEBUG 0 - -#include <usb.h> -#include "fusb.h" -#include "fusb_darwin.h" -#include "darwin_libusb.h" -#include <iostream> - -static const int USB_TIMEOUT = 100; // in milliseconds -static const UInt8 NUM_QUEUE_ITEMS = 20; - -fusb_devhandle_darwin::fusb_devhandle_darwin (usb_dev_handle* udh) - : fusb_devhandle (udh) -{ - // that's it -} - -fusb_devhandle_darwin::~fusb_devhandle_darwin () -{ - // nop -} - -fusb_ephandle* -fusb_devhandle_darwin::make_ephandle (int endpoint, bool input_p, - int block_size, int nblocks) -{ - return new fusb_ephandle_darwin (this, endpoint, input_p, - block_size, nblocks); -} - -// ---------------------------------------------------------------- - -fusb_ephandle_darwin::fusb_ephandle_darwin (fusb_devhandle_darwin* dh, - int endpoint, bool input_p, - int block_size, int nblocks) - : fusb_ephandle (endpoint, input_p, block_size, nblocks), - d_devhandle (dh), d_pipeRef (0), d_transferType (0), - d_interfaceRef (0), d_interface (0), d_queue (0), - d_buffer (0), d_bufLenBytes (0) -{ - d_bufLenBytes = fusb_sysconfig::max_block_size(); - -// create circular buffer - d_buffer = new circular_buffer<char> (NUM_QUEUE_ITEMS * d_bufLenBytes, - !d_input_p, d_input_p); - -// create the queue - d_queue = new circular_linked_list <s_buffer_ptr> (NUM_QUEUE_ITEMS); - d_queue->iterate_start (); - s_node_ptr l_node = d_queue->iterate_next (); - while (l_node) { - l_node->both (new s_both<s_buffer_ptr> (l_node, this)); - s_buffer_ptr l_buf = new s_buffer (d_bufLenBytes); - l_node->object (l_buf); - l_node = d_queue->iterate_next (); - l_buf = NULL; - } - - d_readRunning = new gruel::mutex (); - d_runThreadRunning = new gruel::mutex (); - d_runBlock = new gruel::condition_variable (); - d_readBlock = new gruel::condition_variable (); - d_runBlock_mutex = new gruel::mutex (); - d_readBlock_mutex = new gruel::mutex (); -} - -fusb_ephandle_darwin::~fusb_ephandle_darwin () -{ - stop (); - - d_queue->iterate_start (); - s_node_ptr l_node = d_queue->iterate_next (); - while (l_node) { - s_both_ptr l_both = l_node->both (); - delete l_both; - l_both = NULL; - l_node->both (NULL); - s_buffer_ptr l_buf = l_node->object (); - delete l_buf; - l_buf = NULL; - l_node->object (NULL); - l_node = d_queue->iterate_next (); - } - delete d_queue; - d_queue = NULL; - delete d_buffer; - d_buffer = NULL; - delete d_readRunning; - d_readRunning = NULL; - delete d_runThreadRunning; - d_runThreadRunning = NULL; - delete d_runBlock_mutex; - d_runBlock_mutex = NULL; - delete d_readBlock_mutex; - d_readBlock_mutex = NULL; - delete d_runBlock; - d_runBlock = NULL; - delete d_readBlock; - d_readBlock = NULL; -} - -bool -fusb_ephandle_darwin::start () -{ - UInt8 direction, number, interval; - UInt16 maxPacketSize; - -// reset circular buffer - d_buffer->reset (); - -// reset the queue - d_queue->num_used (0); - d_queue->iterate_start (); - s_node_ptr l_node = d_queue->iterate_next (); - while (l_node) { - l_node->both()->set (l_node, this); - l_node->object()->reset (); - l_node->set_available (); - l_node = d_queue->iterate_next (); - } - - d_pipeRef = d_transferType = 0; - - usb_dev_handle* dev = d_devhandle->get_usb_dev_handle (); - if (! dev) - USB_ERROR_STR (false, -ENXIO, "fusb_ephandle_darwin::start: " - "null device"); - - darwin_dev_handle* device = (darwin_dev_handle*) dev->impl_info; - if (! device) - USB_ERROR_STR (false, -ENOENT, "fusb_ephandle_darwin::start: " - "device not initialized"); - - if (usb_debug) { - std::cerr << "fusb_ephandle_darwin::start: dev = " << - (void*) dev << ", device = " << (void*) device << std::endl; - } - - d_interfaceRef = device->interface; - if (! d_interfaceRef) - USB_ERROR_STR (false, -EACCES, "fusb_ephandle_darwin::start: " - "interface used without being claimed"); - d_interface = *d_interfaceRef; - -// get read or write pipe info (depends on "d_input_p") - - if (usb_debug > 3) { - std::cerr << "fusb_ephandle_darwin::start d_endpoint = " << d_endpoint - << ", d_input_p = " << (d_input_p ? "TRUE" : "FALSE") << std::endl; - } - - int l_endpoint = (d_input_p ? USB_ENDPOINT_IN : USB_ENDPOINT_OUT); - int pipeRef = ep_to_pipeRef (device, d_endpoint | l_endpoint); - if (pipeRef < 0) - USB_ERROR_STR (false, -EINVAL, "fusb_ephandle_darwin::start " - " invalid pipeRef.\n"); - - d_pipeRef = pipeRef; - d_interface->GetPipeProperties (d_interfaceRef, - d_pipeRef, - &direction, - &number, - &d_transferType, - &maxPacketSize, - &interval); - if (usb_debug == 3) { - std::cerr << "fusb_ephandle_darwin::start: " << (d_input_p ? "read" : "write") - << ": ep = " << d_endpoint << ", pipeRef = " << d_pipeRef << "interface = " - << d_interface << ", interfaceRef = " << d_interfaceRef - << ", if_direction = " << direction << ", if_# = " << number - << ", if_interval = " << interval << ", if_maxPacketSize = " - << maxPacketSize << std::endl; - } - - // set global start boolean - d_started = true; - - // lock the runBlock mutex, before creating the run thread. - // this guarantees that we can control execution between these 2 threads - gruel::scoped_lock l (*d_runBlock_mutex); - - // create the run thread, which allows OSX to process I/O separately - d_runThread = new gruel::thread (run_thread, this); - - // wait until the run thread (and possibky read thread) are -really- - // going; this will unlock the mutex before waiting for a signal () - d_runBlock->wait (l); - - if (usb_debug) { - std::cerr << "fusb_ephandle_darwin::start: " << (d_input_p ? "read" : "write") - << " started." << std::endl; - } - - return (true); -} - -void -fusb_ephandle_darwin::run_thread (void* arg) -{ - fusb_ephandle_darwin* This = static_cast<fusb_ephandle_darwin*>(arg); - - // lock the run thread running mutex; if ::stop() is called, it will - // first abort() the pipe then wait for the run thread to finish, - // via a lock() on this mutex - gruel::mutex* l_runThreadRunning = This->d_runThreadRunning; - gruel::scoped_lock l0 (*l_runThreadRunning); - - gruel::mutex* l_readRunning = This->d_readRunning; - gruel::condition_variable* l_readBlock = This->d_readBlock; - gruel::mutex* l_readBlock_mutex = This->d_readBlock_mutex; - - bool l_input_p = This->d_input_p; - - if (usb_debug) { - std::cerr << "fusb_ephandle_darwin::run_thread: starting for " - << (l_input_p ? "read" : "write") << "." << std::endl; - } - - usb_interface_t** l_interfaceRef = This->d_interfaceRef; - usb_interface_t* l_interface = This->d_interface; - CFRunLoopSourceRef l_cfSource; - -// create async run loop - l_interface->CreateInterfaceAsyncEventSource (l_interfaceRef, &l_cfSource); - CFRunLoopAddSource (CFRunLoopGetCurrent (), l_cfSource, - kCFRunLoopDefaultMode); -// get run loop reference, to allow other threads to stop - This->d_CFRunLoopRef = CFRunLoopGetCurrent (); - - gruel::thread* l_rwThread = NULL; - - if (l_input_p) { - // lock the readBlock mutex, before creating the read thread. - // this guarantees that we can control execution between these 2 threads - gruel::scoped_lock l1 (*l_readBlock_mutex); - // create the read thread, which just issues all of the starting - // async read commands, then returns - l_rwThread = new gruel::thread (read_thread, arg); - // wait until the the read thread is -really- going; this will - // unlock the read block mutex before waiting for a signal () - l_readBlock->wait (l1); - } - - { - // now signal the run condition to release and finish ::start(). - - // lock the runBlock mutex first; this will force waiting until the - // ->wait() command is issued in ::start() - gruel::mutex* l_run_block_mutex = This->d_runBlock_mutex; - gruel::scoped_lock l2 (*l_run_block_mutex); - - // now that the lock is in place, signal the parent thread that - // things are running - This->d_runBlock->notify_one (); - } - - // run the loop - CFRunLoopRun (); - - if (l_input_p) { - // wait for read_thread () to finish, if needed - gruel::scoped_lock l3 (*l_readRunning); - } - - // remove run loop stuff - CFRunLoopRemoveSource (CFRunLoopGetCurrent (), - l_cfSource, kCFRunLoopDefaultMode); - - if (usb_debug) { - std::cerr << "fusb_ephandle_darwin::run_thread: finished for " - << (l_input_p ? "read" : "write") << "." << std::endl; - } -} - -void -fusb_ephandle_darwin::read_thread (void* arg) -{ - if (usb_debug) { - std::cerr << "fusb_ephandle_darwin::read_thread: starting." << std::endl; - } - - fusb_ephandle_darwin* This = static_cast<fusb_ephandle_darwin*>(arg); - - // before doing anything else, lock the read running mutex. this - // mutex does flow control between this thread and the run_thread - gruel::mutex* l_readRunning = This->d_readRunning; - gruel::scoped_lock l0 (*l_readRunning); - - // signal the read condition from run_thread() to continue - - // lock the readBlock mutex first; this will force waiting until the - // ->wait() command is issued in ::run_thread() - gruel::condition_variable* l_readBlock = This->d_readBlock; - gruel::mutex* l_read_block_mutex = This->d_readBlock_mutex; - - { - gruel::scoped_lock l1 (*l_read_block_mutex); - - // now that the lock is in place, signal the parent thread that - // things are running here - l_readBlock->notify_one (); - } - - // queue up all of the available read requests - s_queue_ptr l_queue = This->d_queue; - l_queue->iterate_start (); - s_node_ptr l_node = l_queue->iterate_next (); - while (l_node) { - This->read_issue (l_node->both ()); - l_node = l_queue->iterate_next (); - } - - if (usb_debug) { - std::cerr << "fusb_ephandle_darwin::read_thread: finished." << std::endl; - } -} - -void -fusb_ephandle_darwin::read_issue (s_both_ptr l_both) -{ - if ((! l_both) || (! d_started)) { - if (usb_debug > 4) { - std::cerr << "fusb_ephandle_darwin::read_issue: Doing nothing; " - << "l_both is " << (void*) l_both << "; started is " - << (d_started ? "TRUE" : "FALSE") << std::endl; - } - return; - } - -// set the node and buffer from the input "both" - s_node_ptr l_node = l_both->node (); - s_buffer_ptr l_buf = l_node->object (); - void* v_buffer = (void*) l_buf->buffer (); - -// read up to d_bufLenBytes - size_t bufLen = d_bufLenBytes; - l_buf->n_used (bufLen); - -// setup system call result - io_return_t result = kIOReturnSuccess; - - if (d_transferType == kUSBInterrupt) -/* This is an interrupt pipe. We can't specify a timeout. */ - result = d_interface->ReadPipeAsync - (d_interfaceRef, d_pipeRef, v_buffer, bufLen, - (IOAsyncCallback1) read_completed, (void*) l_both); - else - result = d_interface->ReadPipeAsyncTO - (d_interfaceRef, d_pipeRef, v_buffer, bufLen, 0, USB_TIMEOUT, - (IOAsyncCallback1) read_completed, (void*) l_both); - - if (result != kIOReturnSuccess) - USB_ERROR_STR_NO_RET (- darwin_to_errno (result), - "fusb_ephandle_darwin::read_issue " - "(ReadPipeAsync%s): %s", - d_transferType == kUSBInterrupt ? "" : "TO", - darwin_error_str (result)); - else if (usb_debug > 4) { - std::cerr << "fusb_ephandle_darwin::read_issue: Queued " << (void*) l_both - << " (" << bufLen << " Bytes)" << std::endl; - } -} - -void -fusb_ephandle_darwin::read_completed (void* refCon, - io_return_t result, - void* io_size) -{ - size_t l_size = (size_t) io_size; - s_both_ptr l_both = static_cast<s_both_ptr>(refCon); - fusb_ephandle_darwin* This = static_cast<fusb_ephandle_darwin*>(l_both->This ()); - s_node_ptr l_node = l_both->node (); - circular_buffer<char>* l_buffer = This->d_buffer; - s_buffer_ptr l_buf = l_node->object (); - size_t l_i_size = l_buf->n_used (); - - if (This->d_started && (l_i_size != l_size)) { - std::cerr << "fusb_ephandle_darwin::read_completed: Expected " << l_i_size - << " bytes; read " << l_size << "." << std::endl; - } else if (usb_debug > 4) { - std::cerr << "fusb_ephandle_darwin::read_completed: Read " << (void*) l_both - << " (" << l_size << " bytes)" << std::endl; - } - -// add this read to the transfer buffer, and check for overflow -// -> data is being enqueued faster than it can be dequeued - if (l_buffer->enqueue (l_buf->buffer (), l_size) == -1) { -// print out that there's an overflow - fputs ("uO", stderr); - fflush (stderr); - } - -// set buffer's # data to 0 - l_buf->n_used (0); - -// issue another read for this "both" - This->read_issue (l_both); -} - -int -fusb_ephandle_darwin::read (void* buffer, int nbytes) -{ - size_t l_nbytes = (size_t) nbytes; - d_buffer->dequeue ((char*) buffer, &l_nbytes); - - if (usb_debug > 4) { - std::cerr << "fusb_ephandle_darwin::read: request for " << nbytes - << " bytes, " << l_nbytes << " bytes retrieved." << std::endl; - } - - return ((int) l_nbytes); -} - -int -fusb_ephandle_darwin::write (const void* buffer, int nbytes) -{ - size_t l_nbytes = (size_t) nbytes; - - if (! d_started) { - if (usb_debug) { - std::cerr << "fusb_ephandle_darwin::write: Not yet started." << std::endl; - } - return (0); - } - - while (l_nbytes != 0) { -// find out how much data to copy; limited to "d_bufLenBytes" per node - size_t t_nbytes = (l_nbytes > d_bufLenBytes) ? d_bufLenBytes : l_nbytes; - -// get next available node to write into; -// blocks internally if none available - s_node_ptr l_node = d_queue->find_next_available_node (); - -// copy the input into the node's buffer - s_buffer_ptr l_buf = l_node->object (); - l_buf->buffer ((char*) buffer, t_nbytes); - void* v_buffer = (void*) l_buf->buffer (); - -// setup callback parameter & system call return - s_both_ptr l_both = l_node->both (); - io_return_t result = kIOReturnSuccess; - - if (d_transferType == kUSBInterrupt) -/* This is an interrupt pipe ... can't specify a timeout. */ - result = d_interface->WritePipeAsync - (d_interfaceRef, d_pipeRef, v_buffer, t_nbytes, - (IOAsyncCallback1) write_completed, (void*) l_both); - else - result = d_interface->WritePipeAsyncTO - (d_interfaceRef, d_pipeRef, v_buffer, t_nbytes, 0, USB_TIMEOUT, - (IOAsyncCallback1) write_completed, (void*) l_both); - - if (result != kIOReturnSuccess) - USB_ERROR_STR (-1, - darwin_to_errno (result), - "fusb_ephandle_darwin::write_thread " - "(WritePipeAsync%s): %s", - d_transferType == kUSBInterrupt ? "" : "TO", - darwin_error_str (result)); - else if (usb_debug > 4) { - std::cerr << "fusb_ephandle_darwin::write_thread: Queued " << (void*) l_both - << " (" << t_nbytes << " Bytes)" << std::endl; - } - l_nbytes -= t_nbytes; - } - - return (nbytes); -} - -void -fusb_ephandle_darwin::write_completed (void* refCon, - io_return_t result, - void* io_size) -{ - s_both_ptr l_both = static_cast<s_both_ptr>(refCon); - fusb_ephandle_darwin* This = static_cast<fusb_ephandle_darwin*>(l_both->This ()); - size_t l_size = (size_t) io_size; - s_node_ptr l_node = l_both->node (); - s_queue_ptr l_queue = This->d_queue; - s_buffer_ptr l_buf = l_node->object (); - size_t l_i_size = l_buf->n_used (); - - if (This->d_started && (l_i_size != l_size)) { - std::cerr << "fusb_ephandle_darwin::write_completed: Expected " << l_i_size - << " bytes written; wrote " << l_size << "." << std::endl; - } else if (usb_debug > 4) { - std::cerr << "fusb_ephandle_darwin::write_completed: Wrote " << (void*) l_both - << " (" << l_size << " Bytes)" << std::endl; - } - -// set buffer's # data to 0 - l_buf->n_used (0); -// make the node available for reuse - l_queue->make_node_available (l_node); -} - -void -fusb_ephandle_darwin::abort () -{ - if (usb_debug) { - std::cerr << "fusb_ephandle_darwin::abort: starting." << std::endl; - } - - io_return_t result = d_interface->AbortPipe (d_interfaceRef, d_pipeRef); - - if (result != kIOReturnSuccess) - USB_ERROR_STR_NO_RET (- darwin_to_errno (result), - "fusb_ephandle_darwin::abort " - "(AbortPipe): %s", darwin_error_str (result)); - if (usb_debug) { - std::cerr << "fusb_ephandle_darwin::abort: finished." << std::endl; - } -} - -bool -fusb_ephandle_darwin::stop () -{ - if (! d_started) - return (true); - - if (usb_debug) { - std::cerr << "fusb_ephandle_darwin::stop: stopping " - << (d_input_p ? "read" : "write") << "." << std::endl; - } - - d_started = false; - -// abort any pending IO transfers - abort (); - -// wait for write transfer to finish - wait_for_completion (); - -// tell IO buffer to abort any waiting conditions - d_buffer->abort (); - -// stop the run loop - CFRunLoopStop (d_CFRunLoopRef); - -// wait for the runThread to stop - gruel::scoped_lock l (*d_runThreadRunning); - - if (usb_debug) { - std::cerr << "fusb_ephandle_darwin::stop: " << (d_input_p ? "read" : "write") - << " stopped." << std::endl; - } - - return (true); -} - -void -fusb_ephandle_darwin::wait_for_completion () -{ - if (d_queue) - while (d_queue->in_use ()) - usleep (1000); -} diff --git a/usrp/host/lib/fusb_darwin.h b/usrp/host/lib/fusb_darwin.h deleted file mode 100644 index 4d18177be..000000000 --- a/usrp/host/lib/fusb_darwin.h +++ /dev/null @@ -1,218 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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. - */ - -#ifndef _FUSB_DARWIN_H_ -#define _FUSB_DARWIN_H_ - -#include <usb.h> -#include "fusb.h" -#include <IOKit/IOCFBundle.h> -#include <IOKit/IOCFPlugIn.h> -#include <IOKit/usb/IOUSBLib.h> -#include <IOKit/IOKitLib.h> -#include "circular_linked_list.h" -#include "circular_buffer.h" - -// for MacOS X 10.4.[0-3] -#define usb_interface_t IOUSBInterfaceInterface220 -#define InterfaceInterfaceID kIOUSBInterfaceInterfaceID220 -#define InterfaceVersion 220 - -// for MacOS X 10.3.[0-9] and 10.4.[0-3] -#define usb_device_t IOUSBDeviceInterface197 -#define DeviceInterfaceID kIOUSBDeviceInterfaceID197 -#define DeviceVersion 197 - -extern "C" { -typedef struct usb_dev_handle { - int fd; - - struct usb_bus *bus; - struct usb_device *device; - - int config; - int interface; - int altsetting; - - /* Added by RMT so implementations can store other per-open-device data */ - void *impl_info; -} usb_dev_handle; - -/* Darwin/OS X impl does not use fd field, instead it uses this */ -typedef struct darwin_dev_handle { - usb_device_t** device; - usb_interface_t** interface; - int open; -} darwin_dev_handle; - -typedef IOReturn io_return_t; -typedef IOCFPlugInInterface *io_cf_plugin_ref_t; - -static int ep_to_pipeRef (darwin_dev_handle* device, int ep); -extern int usb_debug; -} - -class s_buffer -{ -private: - char* d_buffer; - size_t d_n_used, d_n_alloc; - -public: - inline s_buffer (size_t n_alloc = 0) { - d_n_used = 0; - d_n_alloc = n_alloc; - if (n_alloc) { - d_buffer = (char*) new char [n_alloc]; - } else { - d_buffer = 0; - } - }; - inline ~s_buffer () { - if (d_n_alloc) { - delete [] d_buffer; - } - }; - inline size_t n_used () { return (d_n_used); }; - inline void n_used (size_t bufLen) { - d_n_used = (bufLen > d_n_alloc) ? d_n_alloc : bufLen; }; - inline size_t n_alloc () { return (d_n_alloc); }; - void buffer (char* l_buffer, size_t bufLen) { - if (bufLen > d_n_alloc) { - std::cerr << "s_buffer::set: Copying only allocated bytes." << std::endl; - bufLen = d_n_alloc; - } - if (!l_buffer) { - std::cerr << "s_buffer::set: NULL buffer." << std::endl; - return; - } - bcopy (l_buffer, d_buffer, bufLen); - d_n_used = bufLen; - }; - inline char* buffer () { return (d_buffer); }; - inline void reset () { - bzero (d_buffer, d_n_alloc); - d_n_used = 0; - }; -}; - -typedef s_buffer* s_buffer_ptr; -typedef s_node<s_buffer_ptr>* s_node_ptr; -typedef circular_linked_list<s_buffer_ptr>* s_queue_ptr; -typedef s_both<s_buffer_ptr>* s_both_ptr; - -/*! - * \brief darwin implementation of fusb_devhandle - * - * This is currently identical to the generic implementation - * and is intended as a starting point for whatever magic is - * required to make usb fly. - */ -class fusb_devhandle_darwin : public fusb_devhandle -{ -public: - // CREATORS - fusb_devhandle_darwin (usb_dev_handle* udh); - virtual ~fusb_devhandle_darwin (); - - // MANIPULATORS - virtual fusb_ephandle* make_ephandle (int endpoint, bool input_p, - int block_size = 0, int nblocks = 0); -}; - -/*! - * \brief darwin implementation of fusb_ephandle - * - * This is currently identical to the generic implementation - * and is intended as a starting point for whatever magic is - * required to make usb fly. - */ -class fusb_ephandle_darwin : public fusb_ephandle -{ -private: - fusb_devhandle_darwin* d_devhandle; - gruel::thread* d_runThread; - gruel::mutex* d_runThreadRunning; - - CFRunLoopRef d_CFRunLoopRef; - - static void write_completed (void* ret_io_size, - io_return_t result, - void* io_size); - static void read_completed (void* ret_io_size, - io_return_t result, - void* io_size); - static void run_thread (void* arg); - static void read_thread (void* arg); - - void read_issue (s_both_ptr l_both); - -public: - // variables, for now - UInt8 d_pipeRef, d_transferType; - usb_interface_t** d_interfaceRef; - usb_interface_t* d_interface; - s_queue_ptr d_queue; - circular_buffer<char>* d_buffer; - size_t d_bufLenBytes; - gruel::mutex* d_readRunning; - gruel::mutex* d_runBlock_mutex; - gruel::mutex* d_readBlock_mutex; - gruel::condition_variable* d_runBlock; - gruel::condition_variable* d_readBlock; - -// CREATORS - - fusb_ephandle_darwin (fusb_devhandle_darwin *dh, int endpoint, bool input_p, - int block_size = 0, int nblocks = 0); - virtual ~fusb_ephandle_darwin (); - -// MANIPULATORS - - virtual bool start (); //!< begin streaming i/o - virtual bool stop (); //!< stop streaming i/o - - /*! - * \returns \p nbytes if write was successfully enqueued, else -1. - * Will block if no free buffers available. - */ - virtual int write (const void* buffer, int nbytes); - - /*! - * \returns number of bytes read or -1 if error. - * number of bytes read will be <= nbytes. - * Will block if no input available. - */ - virtual int read (void* buffer, int nbytes); - - /* - * abort any pending IO transfers - */ - void abort (); - - /* - * block until all outstanding writes have completed - */ - virtual void wait_for_completion (); -}; - -#endif /* _FUSB_DARWIN_H_ */ diff --git a/usrp/host/lib/fusb_generic.cc b/usrp/host/lib/fusb_generic.cc deleted file mode 100644 index 0958716d9..000000000 --- a/usrp/host/lib/fusb_generic.cc +++ /dev/null @@ -1,108 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 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 <fusb_generic.h> -#include <usb.h> - - -static const int USB_TIMEOUT = 1000; // in milliseconds - - -fusb_devhandle_generic::fusb_devhandle_generic (usb_dev_handle *udh) - : fusb_devhandle (udh) -{ - // that's it -} - -fusb_devhandle_generic::~fusb_devhandle_generic () -{ - // nop -} - -fusb_ephandle * -fusb_devhandle_generic::make_ephandle (int endpoint, bool input_p, - int block_size, int nblocks) -{ - return new fusb_ephandle_generic (this, endpoint, input_p, - block_size, nblocks); -} - -// ---------------------------------------------------------------- - -fusb_ephandle_generic::fusb_ephandle_generic (fusb_devhandle_generic *dh, - int endpoint, bool input_p, - int block_size, int nblocks) - : fusb_ephandle (endpoint, input_p, block_size, nblocks), - d_devhandle (dh) -{ - // that's it -} - -fusb_ephandle_generic::~fusb_ephandle_generic () -{ - // nop -} - -bool -fusb_ephandle_generic::start () -{ - d_started = true; - return true; -} - -bool -fusb_ephandle_generic::stop () -{ - d_started = false; - return true; -} - -int -fusb_ephandle_generic::write (const void *buffer, int nbytes) -{ - if (!d_started) // doesn't matter here, but keeps semantics constant - return -1; - - if (d_input_p) - return -1; - - return usb_bulk_write (d_devhandle->get_usb_dev_handle (), - d_endpoint, (char *) buffer, nbytes, USB_TIMEOUT); -} - -int -fusb_ephandle_generic::read (void *buffer, int nbytes) -{ - if (!d_started) // doesn't matter here, but keeps semantics constant - return -1; - - if (!d_input_p) - return -1; - - return usb_bulk_read (d_devhandle->get_usb_dev_handle (), - d_endpoint|USB_ENDPOINT_IN, (char *) buffer, nbytes, - USB_TIMEOUT); -} diff --git a/usrp/host/lib/fusb_generic.h b/usrp/host/lib/fusb_generic.h deleted file mode 100644 index b9aef2737..000000000 --- a/usrp/host/lib/fusb_generic.h +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 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 _FUSB_GENERIC_H_ -#define _FUSB_GENERIC_H_ - -#include <fusb.h> - -/*! - * \brief generic implementation of fusb_devhandle using only libusb - */ -class fusb_devhandle_generic : public fusb_devhandle -{ -public: - // CREATORS - fusb_devhandle_generic (usb_dev_handle *udh); - virtual ~fusb_devhandle_generic (); - - // MANIPULATORS - virtual fusb_ephandle *make_ephandle (int endpoint, bool input_p, - int block_size = 0, int nblocks = 0); -}; - - -/*! - * \brief generic implementation of fusb_ephandle using only libusb - */ -class fusb_ephandle_generic : public fusb_ephandle -{ -private: - fusb_devhandle_generic *d_devhandle; - -public: - // CREATORS - fusb_ephandle_generic (fusb_devhandle_generic *dh, int endpoint, bool input_p, - int block_size = 0, int nblocks = 0); - virtual ~fusb_ephandle_generic (); - - // MANIPULATORS - - virtual bool start (); //!< begin streaming i/o - virtual bool stop (); //!< stop streaming i/o - - /*! - * \returns \p nbytes if write was successfully enqueued, else -1. - * Will block if no free buffers available. - */ - virtual int write (const void *buffer, int nbytes); - - /*! - * \returns number of bytes read or -1 if error. - * number of bytes read will be <= nbytes. - * Will block if no input available. - */ - virtual int read (void *buffer, int nbytes); - - /* - * block until all outstanding writes have completed - */ - virtual void wait_for_completion () { }; -}; - -#endif /* _FUSB_GENERIC_H_ */ - diff --git a/usrp/host/lib/fusb_libusb1.cc b/usrp/host/lib/fusb_libusb1.cc deleted file mode 100644 index 770708451..000000000 --- a/usrp/host/lib/fusb_libusb1.cc +++ /dev/null @@ -1,702 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003,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 <fusb_libusb1.h> -#include <fusb.h> -#include <libusb-1.0/libusb.h> -#include <stdexcept> -#include <cstdio> -#include <assert.h> -#include <string.h> -#include <algorithm> -#include <errno.h> -#include <string.h> - -#define MINIMIZE_TX_BUFFERING true - -static const int MAX_BLOCK_SIZE = fusb_sysconfig::max_block_size(); -static const int DEFAULT_BLOCK_SIZE = MAX_BLOCK_SIZE; -static const int DEFAULT_BUFFER_SIZE = 4 * (1L << 20); // 4 MB endpoint -static const int LIBUSB_TIMEOUT = 0; // no timeout - -inline static fusb_ephandle_libusb1 * -lut_get_ephandle (libusb_transfer *lut) -{ - return (fusb_ephandle_libusb1 *) lut->user_data; -} - -// ------------------------------------------------------------------------ -// libusb_transfer allocation, deallocation, and callback -// ------------------------------------------------------------------------ - -static void -free_lut (libusb_transfer *lut) -{ - - // if this was an input transfer, free the buffer - if (lut->endpoint & 0x80) - delete [] ((unsigned char *) lut->buffer); - - libusb_free_transfer(lut); - -} - -/* - * The callback means the libusb_transfer is completed whether sent, cancelled, - * or failed. Move the libusb_transfer from the pending list to the - * completed list. If the cancel is from the destructor then free the - * transfer instead; normally this won't happen since all endpoints should be - * destroyed first leaving the pending list empty. - */ - -static void -generic_callback(struct libusb_transfer *lut) -{ - - // Fish out devhandle from endpoint - fusb_devhandle_libusb1* dev_handle = - lut_get_ephandle(lut)->get_fusb_devhandle_libusb1(); - - dev_handle->pending_remove(lut); - - if (lut->status == LIBUSB_TRANSFER_CANCELLED && dev_handle->_teardown() == 1) - { - free_lut (lut); - return; - } - - lut_get_ephandle(lut)->completed_list_add(lut); - -} - -static libusb_transfer* -alloc_lut (fusb_ephandle_libusb1 *self, int buffer_length, int endpoint, - bool input_p, unsigned char *write_buffer, - fusb_devhandle_libusb1 *dh) -{ - - struct libusb_transfer* lut = libusb_alloc_transfer(0); - - endpoint = (endpoint & 0x7f) | (input_p ? 0x80 : 0); - - if (input_p) - write_buffer = new unsigned char [buffer_length]; - - // We need the base class libusb_device_handle - libusb_device_handle *dev_handle = dh->get_usb_dev_handle(); - - // Load the libusb_transfer for bulk transfer - libusb_fill_bulk_transfer (lut, // transfer - dev_handle, // dev_handle - endpoint, // endpoint - write_buffer, // buffer - buffer_length, // length - generic_callback, // callback - self, // user_data - LIBUSB_TIMEOUT); // timeout - - return lut; -} - -// ------------------------------------------------------------------------ -// device handle -// ------------------------------------------------------------------------ - -fusb_devhandle_libusb1::fusb_devhandle_libusb1 (libusb_device_handle *udh, - libusb_context *ctx) - : fusb_devhandle (udh), d_ctx (ctx), d_teardown (false) -{ - // that's it -} - -fusb_devhandle_libusb1::~fusb_devhandle_libusb1 () -{ - d_teardown = true; - - std::list<libusb_transfer*>::reverse_iterator it; - - // After cancellation the libusb_transfer is still active so delay freeing - // transfer until callback occurs. In most cases the pending list should - // already be empty by the time this destructor is called. - - for (it = d_pending_rqsts.rbegin (); it != d_pending_rqsts.rend (); it++) { - _cancel_lut (*it); - } - - // Wait for pending list to empty - _wait_for_completion (); - -} - -fusb_ephandle* -fusb_devhandle_libusb1::make_ephandle (int endpoint, bool input_p, - int block_size, int nblocks) -{ - return new fusb_ephandle_libusb1 (this, endpoint, input_p, - block_size, nblocks); -} - -/* - * devhandle list manipulators - */ - -void -fusb_devhandle_libusb1::pending_add (libusb_transfer *lut) -{ - d_pending_rqsts.push_back (lut); -} - - -/* - * Attempt to cancel all transations associated with eph - */ - -void -fusb_devhandle_libusb1::_cancel_pending_rqsts (fusb_ephandle_libusb1 *eph) -{ - std::list<libusb_transfer*>::reverse_iterator it; - - for (it = d_pending_rqsts.rbegin (); it != d_pending_rqsts.rend (); it++){ - if (lut_get_ephandle (*it) == eph) - _cancel_lut (*it); - } -} - -/* - * Pull from the pending list - */ - -libusb_transfer * -fusb_devhandle_libusb1::pending_get () -{ - if (d_pending_rqsts.empty ()) - return 0; - - libusb_transfer *lut = d_pending_rqsts.front (); - d_pending_rqsts.pop_front (); - return lut; -} - -/* - * Match libusb_tranfer with the pending list and erase - * Return true if found, false otherwise - */ - -bool -fusb_devhandle_libusb1::pending_remove (libusb_transfer *lut) -{ - std::list<libusb_transfer*>::iterator result; - result = find (d_pending_rqsts.begin (), d_pending_rqsts.end (), lut); - - if (result == d_pending_rqsts.end ()) { - fprintf (stderr, "fusb::pending_remove: failed to find lut in pending_rqsts: %p\n", lut); - - return false; - } - d_pending_rqsts.erase (result); - return true; -} - -/* - * Submit the libusb_transfer to libusb - * iff successful, the transfer will be placed on the devhandle pending list. - */ - -bool -fusb_devhandle_libusb1::_submit_lut (libusb_transfer *lut) -{ - - int ret = libusb_submit_transfer (lut); - if (ret < 0) { - fprintf(stderr, "fusb::_submit_lut %d", ret); - return false; - } - - pending_add(lut); - return true; - -} - -/* - * Attempt to cancel any pending libusb_transfer transactions. - * Return true in the absence of errors, which does not mean that the transfer - * is cancelled. Cancellation can be checked after the callback is fired off - * by libusb. - */ - -bool -fusb_devhandle_libusb1::_cancel_lut (libusb_transfer *lut) -{ - - int ret = libusb_cancel_transfer (lut); - if (ret < 0) { - fprintf (stderr, "fusb::_cancel_lut"); - return false; - } - return true; - -} - -/* - * Reimplementing _reap for context use and compatibiliy with libusb-0.12. - * - * Returns false on timeout or error, true if an event was handled - * - * If ok_to_block_p is false then handle already pending events and return - * immediately. - * - * If ok_to_block_p is true then call libusb_handle_events_timeout with default - * timeout value of 2 seconds, which waits and returns on event arrival or - * timeout. - */ - -bool -fusb_devhandle_libusb1::_reap (bool ok_to_block_p) -{ - int ret; - struct timeval tv; - - // Save pending size - int pnd_size = d_pending_rqsts.size(); - - if (ok_to_block_p) { - tv.tv_sec = 2; - tv.tv_usec = 0; - } - else { - tv.tv_sec = 0; - tv.tv_usec = 0; - } - - if ((ret = libusb_handle_events_timeout(d_ctx, &tv)) < 0) { - fprintf (stderr, "fusb::_reap libusb_handle_events() %i\n", ret); - return false; - } - - // Check that a pending transfer was removed - if (pnd_size > d_pending_rqsts.size()) - return true; - else { - return false; - } -} - -void -fusb_devhandle_libusb1::_wait_for_completion () -{ - - while (!d_pending_rqsts.empty ()) - if (!_reap(true)) - break; - -} - -// ------------------------------------------------------------------------ -// endpoint handle -// ------------------------------------------------------------------------ - -fusb_ephandle_libusb1::fusb_ephandle_libusb1 (fusb_devhandle_libusb1 *dh, - int endpoint, bool input_p, - int block_size, int nblocks) - : fusb_ephandle (endpoint, input_p, block_size, nblocks), - d_devhandle (dh), - d_write_work_in_progress (0), d_write_buffer (0), - d_read_work_in_progress (0), d_read_buffer (0), d_read_buffer_end (0) -{ - - if (d_block_size < 0 || d_block_size > MAX_BLOCK_SIZE) - throw std::out_of_range ("fusb_ephandle_libusb1: block_size"); - - if (d_nblocks < 0) - throw std::out_of_range ("fusb_ephandle_libusb1: nblocks"); - - if (d_block_size == 0) - d_block_size = DEFAULT_BLOCK_SIZE; - - if (d_nblocks == 0) - d_nblocks = std::max (1, DEFAULT_BUFFER_SIZE / d_block_size); - - if (!d_input_p) - if (!MINIMIZE_TX_BUFFERING) - d_write_buffer = new unsigned char [d_block_size]; - - if (0) - fprintf(stderr, "fusb_ephandle_libusb1::ctor: d_block_size = %d d_nblocks = %d\n", - d_block_size, d_nblocks); - - // allocate libusb_transfers - for (int i = 0; i < d_nblocks; i++) - d_free_list.push_back (alloc_lut (this, d_block_size, d_endpoint, - d_input_p, d_write_buffer, d_devhandle)); -} - -fusb_ephandle_libusb1::~fusb_ephandle_libusb1 () -{ - - stop (); - - libusb_transfer *lut; - - while ((lut = free_list_get ()) != 0) - free_lut (lut); - - while ((lut = completed_list_get ()) != 0) - free_lut (lut); - - if (d_write_work_in_progress) - free_lut (d_write_work_in_progress); - - delete [] d_write_buffer; - - if (d_read_work_in_progress) - free_lut (d_read_work_in_progress); - -} - -bool -fusb_ephandle_libusb1::start () -{ - if (d_started) - return true; - - d_started = true; - - if (d_input_p) { - libusb_transfer *lut; - - int nerrors = 0; - while ((lut = free_list_get ()) !=0 && nerrors < d_nblocks) { - if (!submit_lut (lut)) - nerrors++; - } - } - - return true; - -} - -/* - * Cancel all transfers in progress or pending and return to initial state - */ - -bool -fusb_ephandle_libusb1::stop () -{ - - if (!d_started) - return true; - - if (d_write_work_in_progress){ - free_list_add (d_write_work_in_progress); - d_write_work_in_progress = 0; - } - - if (d_read_work_in_progress){ - free_list_add (d_read_work_in_progress); - d_read_work_in_progress = 0; - d_read_buffer = 0; - d_read_buffer_end = 0; - } - - d_devhandle->_cancel_pending_rqsts (this); - d_devhandle->_reap (false); - - while (1) { - libusb_transfer *lut; - while ((lut = completed_list_get ()) != 0) - free_list_add (lut); - - if (d_free_list.size () == (unsigned) d_nblocks) - break; - - if (!d_devhandle->_reap(true)) - break; - } - - d_started = false; - - return true; -} - -// ------------------------------------------------------------------------ -// routines for writing -// ------------------------------------------------------------------------ - -#if (MINIMIZE_TX_BUFFERING) - -int -fusb_ephandle_libusb1::write (const void *buffer, int nbytes) -{ - if (!d_started) // doesn't matter here, but keeps semantics constant - return -1; - - if (d_input_p) - return -1; - - assert(nbytes % 512 == 0); - - unsigned char *src = (unsigned char *) buffer; - - int n = 0; - while (n < nbytes){ - - struct libusb_transfer *lut = get_write_work_in_progress(); - if (!lut) - return -1; - assert(lut->actual_length == 0); - int m = std::min(nbytes - n, MAX_BLOCK_SIZE); - lut->buffer = src; - lut->length = m; - - n += m; - src += m; - - if (!submit_lut(lut)) - return -1; - - d_write_work_in_progress = 0; - } - - return n; -} - -#else - -int -fusb_ephandle_libusb1::write (const void *buffer, int nbytes) -{ - if (!d_started) - return -1; - - if (d_input_p) - return -1; - - unsigned char *src = (unsigned char *) buffer; - - int n = 0; - while (n < nbytes){ - - libusb_transfer *lut = get_write_work_in_progress (); - if (!lut) - return -1; - unsigned char *dst = (unsigned char *) lut->buffer; - int m = std::min (nbytes - n, lut->length - lut->actual_length); - - memcpy (&dst[lut->actual_length], &src[n], m); - lut->actual_length += m; - n += m; - - if (lut->actual_length == lut->length){ - if (!submit_lut (lut)) - return -1; - d_write_work_in_progress = 0; - } - } - - return n; -} - -#endif - -struct libusb_transfer * -fusb_ephandle_libusb1::get_write_work_in_progress () -{ - if (d_write_work_in_progress) - return d_write_work_in_progress; - - while (1) { - - reap_complete_writes (); - - struct libusb_transfer *lut = free_list_get (); - - if (lut != 0){ - assert (lut->actual_length == 0); - d_write_work_in_progress = lut; - return lut; - } - - if (!d_devhandle->_reap (true)) - return 0; - } -} - -void -fusb_ephandle_libusb1::reap_complete_writes () -{ - // take a look at the completed list and xfer to free list after - // checking for errors. - - libusb_transfer *lut; - - while ((lut = completed_list_get ()) != 0) { - - // Check for any errors or short writes that were reporetd in the transfer. - // libusb1 sets status, actual_length. - - if (lut->status != LIBUSB_TRANSFER_COMPLETED) { - fprintf (stderr, "fusb: (status %d) \n", lut->status ); - } - else if (lut->actual_length != lut->length){ - fprintf (stderr, "fusb: short write xfer: %d != %d\n", - lut->actual_length, lut->length); - } - - free_list_add (lut); - } -} - -void -fusb_ephandle_libusb1::wait_for_completion () -{ - d_devhandle->_wait_for_completion (); -} - -// ------------------------------------------------------------------------ -// routines for reading -// ------------------------------------------------------------------------ - -int -fusb_ephandle_libusb1::read (void *buffer, int nbytes) -{ - if (!d_started) // doesn't matter here, but keeps semantics constant - return -1; - - if (!d_input_p) - return -1; - - unsigned char *dst = (unsigned char *) buffer; - - int n = 0; - while (n < nbytes) { - - if (d_read_buffer >= d_read_buffer_end) - if (!reload_read_buffer ()) - return -1; - - int m = std::min (nbytes - n, (int) (d_read_buffer_end - d_read_buffer)); - - memcpy (&dst[n], d_read_buffer, m); - d_read_buffer += m; - n += m; - } - - return n; - -} - -bool -fusb_ephandle_libusb1::reload_read_buffer () -{ - assert (d_read_buffer >= d_read_buffer_end); - - libusb_transfer *lut; - - if (d_read_work_in_progress) { - lut = d_read_work_in_progress; - d_read_work_in_progress = 0; - d_read_buffer = 0; - d_read_buffer_end = 0; - lut->actual_length = 0; - if (!submit_lut (lut)) - return false; - } - - while (1) { - - while ((lut = completed_list_get ()) == 0 ) - if (!d_devhandle->_reap(true)) - return false; - - if (lut->status != LIBUSB_TRANSFER_COMPLETED) { - fprintf (stderr, "fust: (rd status %d) %s\n", lut->status, - strerror (-lut->status)); - lut->actual_length = 0; - free_list_add (lut); - return false; - } - - d_read_work_in_progress = lut; - d_read_buffer = (unsigned char *) lut->buffer; - d_read_buffer_end = d_read_buffer + lut->actual_length; - - return true; - } -} - - -/* - * ephandle list manipulation - */ - - -void -fusb_ephandle_libusb1::free_list_add (libusb_transfer *lut) -{ - assert (lut_get_ephandle (lut) == this); - lut->actual_length = 0; - d_free_list.push_back (lut); -} - -libusb_transfer * -fusb_ephandle_libusb1::free_list_get () -{ - if (d_free_list.empty ()) - return 0; - - libusb_transfer *lut = d_free_list.front (); - d_free_list.pop_front (); - return lut; -} - -void -fusb_ephandle_libusb1::completed_list_add (libusb_transfer *lut) -{ - assert (lut_get_ephandle (lut) == this); - d_completed_list.push_back (lut); -} - -libusb_transfer * -fusb_ephandle_libusb1::completed_list_get () -{ - if (d_completed_list.empty ()) - return 0; - - libusb_transfer *lut = d_completed_list.front (); - d_completed_list.pop_front (); - return lut; -} - -bool -fusb_ephandle_libusb1::submit_lut (libusb_transfer *lut) -{ - if (!d_devhandle->_submit_lut (lut)) { - fprintf (stderr, "_submit_lut failed\n"); - free_list_add (lut); - return false; - } - return true; -} diff --git a/usrp/host/lib/fusb_libusb1.h b/usrp/host/lib/fusb_libusb1.h deleted file mode 100644 index c0e3736bd..000000000 --- a/usrp/host/lib/fusb_libusb1.h +++ /dev/null @@ -1,131 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003,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 _FUSB_LIBUSB1_H_ -#define _FUSB_LIBUSB1_H_ - -#include <fusb.h> -#include <list> - -struct libusb_transfer; -struct libusb_context; - -class fusb_ephandle_libusb1; - -/*! - * \brief libusb1 implementation of fusb_devhandle - */ -class fusb_devhandle_libusb1 : public fusb_devhandle -{ -private: - std::list<libusb_transfer*> d_pending_rqsts; - libusb_context *d_ctx; - - void pending_add (struct libusb_transfer *lut); - struct libusb_transfer * pending_get (); - - bool d_teardown; - -public: - // CREATORS - fusb_devhandle_libusb1 (libusb_device_handle *udh, libusb_context *ctx); - virtual ~fusb_devhandle_libusb1 (); - - // MANIPULATORS - virtual fusb_ephandle *make_ephandle (int endpoint, bool input_p, - int block_size = 0, int nblocks = 0); - // internal use only - bool _submit_lut (libusb_transfer *); - bool _cancel_lut (libusb_transfer *); - void _cancel_pending_rqsts (fusb_ephandle_libusb1 *eph); - bool _reap (bool ok_to_block_p); - void _wait_for_completion (); - - // accessors to work from callback context - bool pending_remove (struct libusb_transfer *lut); - inline bool _teardown() { return d_teardown; } - -}; - - -/*! - * \brief libusb1 implementation of fusb_ephandle - */ -class fusb_ephandle_libusb1 : public fusb_ephandle -{ -private: - fusb_devhandle_libusb1 *d_devhandle; - std::list<libusb_transfer*> d_free_list; - std::list<libusb_transfer*> d_completed_list; - libusb_transfer *d_write_work_in_progress; - unsigned char *d_write_buffer; - libusb_transfer *d_read_work_in_progress; - unsigned char *d_read_buffer; - unsigned char *d_read_buffer_end; - - libusb_transfer *get_write_work_in_progress (); - void reap_complete_writes (); - bool reload_read_buffer (); - bool submit_lut (libusb_transfer *lut); - -public: - // CREATORS - fusb_ephandle_libusb1 (fusb_devhandle_libusb1 *dh, int endpoint, bool input_p, - int block_size = 0, int nblocks = 0); - virtual ~fusb_ephandle_libusb1 (); - - // MANIPULATORS - - virtual bool start (); //!< begin streaming i/o - virtual bool stop (); //!< stop streaming i/o - - /*! - * \returns \p nbytes if write was successfully enqueued, else -1. - * Will block if no free buffers available. - */ - virtual int write (const void *buffer, int nbytes); - - /*! - * \returns number of bytes read or -1 if error. - * number of bytes read will be <= nbytes. - * Will block if no input available. - */ - virtual int read (void *buffer, int nbytes); - - /* - * block until all outstanding writes have completed - */ - virtual void wait_for_completion (); - - void free_list_add (struct libusb_transfer *lut); - void completed_list_add (struct libusb_transfer *lut); - struct libusb_transfer *free_list_get (); - struct libusb_transfer *completed_list_get (); - - // accessor to work from callback context - fusb_devhandle_libusb1* get_fusb_devhandle_libusb1 () const { - return d_devhandle; - } -}; - -#endif /* _FUSB_LINUX1_H_ */ - diff --git a/usrp/host/lib/fusb_linux.cc b/usrp/host/lib/fusb_linux.cc deleted file mode 100644 index 6c484569f..000000000 --- a/usrp/host/lib/fusb_linux.cc +++ /dev/null @@ -1,692 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 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 <fusb_linux.h> -#include <usb.h> // libusb header -#include <stdexcept> -#ifdef HAVE_LINUX_COMPILER_H -#include <linux/compiler.h> -#endif -#include <linux/usbdevice_fs.h> // interface to kernel portion of user mode usb driver -#include <sys/ioctl.h> -#include <assert.h> -#include <string.h> -#include <algorithm> -#include <errno.h> -#include <string.h> -#include <cstdio> - -#define MINIMIZE_TX_BUFFERING 1 // must be defined to 0 or 1 - - -static const int MAX_BLOCK_SIZE = fusb_sysconfig::max_block_size(); // hard limit -static const int DEFAULT_BLOCK_SIZE = MAX_BLOCK_SIZE; -static const int DEFAULT_BUFFER_SIZE = 4 * (1L << 20); // 4 MB / endpoint - - -// Totally evil and fragile extraction of file descriptor from -// guts of libusb. They don't install usbi.h, which is what we'd need -// to do this nicely. -// -// FIXME if everything breaks someday in the future, look here... - -static int -fd_from_usb_dev_handle (usb_dev_handle *udh) -{ - return *((int *) udh); -} - -inline static void -urb_set_ephandle (usbdevfs_urb *urb, fusb_ephandle_linux *handle) -{ - urb->usercontext = handle; -} - -inline static fusb_ephandle_linux * -urb_get_ephandle (usbdevfs_urb *urb) -{ - return (fusb_ephandle_linux *) urb->usercontext; -} - -// ------------------------------------------------------------------------ -// USB request block (urb) allocation -// ------------------------------------------------------------------------ - -static usbdevfs_urb * -alloc_urb (fusb_ephandle_linux *self, int buffer_length, int endpoint, - bool input_p, unsigned char *write_buffer) -{ - usbdevfs_urb *urb = new usbdevfs_urb; - memset (urb, 0, sizeof (*urb)); - - urb->buffer_length = buffer_length; - - // We allocate dedicated memory only for input buffers. - // For output buffers we reuse the same buffer (the kernel - // copies the data at submital time) - - if (input_p) - urb->buffer = new unsigned char [buffer_length]; - else - urb->buffer = write_buffer; - - // init common values - - urb->type = USBDEVFS_URB_TYPE_BULK; - urb->endpoint = (endpoint & 0x7f) | (input_p ? 0x80 : 0); - - // USBDEVFS_URB_QUEUE_BULK goes away in linux 2.5, but is needed if - // we are using a 2.4 usb-uhci host controller driver. This is - // unlikely since we're almost always going to be plugged into a - // high speed host controller (ehci) -#if 0 && defined (USBDEVFS_URB_QUEUE_BULK) - urb->flags = USBDEVFS_URB_QUEUE_BULK; -#endif - - urb->signr = 0; - urb_set_ephandle (urb, self); - - return urb; -} - -static void -free_urb (usbdevfs_urb *urb) -{ - // if this was an input urb, free the buffer - if (urb->endpoint & 0x80) - delete [] ((unsigned char *) urb->buffer); - - delete urb; -} - -// ------------------------------------------------------------------------ -// device handle -// ------------------------------------------------------------------------ - -fusb_devhandle_linux::fusb_devhandle_linux (usb_dev_handle *udh) - : fusb_devhandle (udh) -{ - // that's all -} - -fusb_devhandle_linux::~fusb_devhandle_linux () -{ - // if there are any pending requests, cancel them and free the urbs. - - std::list<usbdevfs_urb*>::reverse_iterator it; - - for (it = d_pending_rqsts.rbegin (); it != d_pending_rqsts.rend (); it++){ - _cancel_urb (*it); - free_urb (*it); - } -} - -fusb_ephandle * -fusb_devhandle_linux::make_ephandle (int endpoint, bool input_p, - int block_size, int nblocks) -{ - return new fusb_ephandle_linux (this, endpoint, input_p, - block_size, nblocks); -} - - -// Attempt to cancel all transactions associated with eph. - -void -fusb_devhandle_linux::_cancel_pending_rqsts (fusb_ephandle_linux *eph) -{ - std::list<usbdevfs_urb*>::reverse_iterator it; - - for (it = d_pending_rqsts.rbegin (); it != d_pending_rqsts.rend (); it++){ - if (urb_get_ephandle (*it) == eph) - _cancel_urb (*it); - } -} - -void -fusb_devhandle_linux::pending_add (usbdevfs_urb *urb) -{ - d_pending_rqsts.push_back (urb); -} - -usbdevfs_urb * -fusb_devhandle_linux::pending_get () -{ - if (d_pending_rqsts.empty ()) - return 0; - - usbdevfs_urb *urb = d_pending_rqsts.front (); - d_pending_rqsts.pop_front (); - return urb; -} - -bool -fusb_devhandle_linux::pending_remove (usbdevfs_urb *urb) -{ - std::list<usbdevfs_urb*>::iterator result = find (d_pending_rqsts.begin (), - d_pending_rqsts.end (), - urb); - if (result == d_pending_rqsts.end ()){ - fprintf (stderr, "fusb::pending_remove: failed to find urb in pending_rqsts: %p\n", urb); - return false; - } - d_pending_rqsts.erase (result); - return true; -} - -/* - * Submit the urb to the kernel. - * iff successful, the urb will be placed on the devhandle's pending list. - */ -bool -fusb_devhandle_linux::_submit_urb (usbdevfs_urb *urb) -{ - int ret; - - ret = ioctl (fd_from_usb_dev_handle (d_udh), USBDEVFS_SUBMITURB, urb); - if (ret < 0){ - perror ("fusb::_submit_urb"); - return false; - } - - pending_add (urb); - return true; -} - -/* - * Attempt to cancel the in pending or in-progress urb transaction. - * Return true iff transaction was sucessfully cancelled. - * - * Failure to cancel should not be considered a problem. This frequently - * occurs if the transaction has already completed in the kernel but hasn't - * yet been reaped by the user mode code. - * - * urbs which were cancelled have their status field set to -ENOENT when - * they are reaped. - */ -bool -fusb_devhandle_linux::_cancel_urb (usbdevfs_urb *urb) -{ - int ret = ioctl (fd_from_usb_dev_handle (d_udh), USBDEVFS_DISCARDURB, urb); - if (ret < 0){ - // perror ("fusb::_cancel_urb"); - return false; - } - return true; -} - -/* - * Check with the kernel and see if any of our outstanding requests - * have completed. For each completed transaction, remove it from the - * devhandle's pending list and append it to the completed list for - * the corresponding endpoint. - * - * If any transactions are reaped return true. - * - * If ok_to_block_p is true, then this will block until at least one - * transaction completes or an unrecoverable error occurs. - */ -bool -fusb_devhandle_linux::_reap (bool ok_to_block_p) -{ - int ret; - int nreaped = 0; - usbdevfs_urb *urb = 0; - - int fd = fd_from_usb_dev_handle (d_udh); - - // try to reap as many as possible without blocking... - - while ((ret = ioctl (fd, USBDEVFS_REAPURBNDELAY, &urb)) == 0){ - if (urb->status != 0 && urb->status != -ENOENT){ - fprintf (stderr, "_reap: usb->status = %d, actual_length = %5d\n", - urb->status, urb->actual_length); - } - pending_remove (urb); - urb_get_ephandle (urb)->completed_list_add (urb); - nreaped++; - } - - if (nreaped > 0) // if we got any, return w/o blocking - return true; - - if (!ok_to_block_p) - return false; - - ret = ioctl (fd, USBDEVFS_REAPURB, &urb); - if (ret < 0){ - perror ("fusb::_reap"); - return false; - } - - pending_remove (urb); - urb_get_ephandle (urb)->completed_list_add (urb); - return true; -} - -void -fusb_devhandle_linux::_wait_for_completion () -{ - while (!d_pending_rqsts.empty ()) - if (!_reap(true)) - break; -} -// ------------------------------------------------------------------------ -// end point handle -// ------------------------------------------------------------------------ - -fusb_ephandle_linux::fusb_ephandle_linux (fusb_devhandle_linux *devhandle, - int endpoint, - bool input_p, - int block_size, int nblocks) - : fusb_ephandle (endpoint, input_p, block_size, nblocks), - d_devhandle (devhandle), - d_write_work_in_progress (0), d_write_buffer (0), - d_read_work_in_progress (0), d_read_buffer (0), d_read_buffer_end (0) -{ - - if (d_block_size < 0 || d_block_size > MAX_BLOCK_SIZE) - throw std::out_of_range ("fusb_ephandle_linux: block_size"); - - if (d_nblocks < 0) - throw std::out_of_range ("fusb_ephandle_linux: nblocks"); - - if (d_block_size == 0) - d_block_size = DEFAULT_BLOCK_SIZE; - - if (d_nblocks == 0) - d_nblocks = std::max (1, DEFAULT_BUFFER_SIZE / d_block_size); - - if (!d_input_p) - if (!MINIMIZE_TX_BUFFERING) - d_write_buffer = new unsigned char [d_block_size]; - - if (0) - fprintf(stderr, "fusb_ephandle_linux::ctor: d_block_size = %d d_nblocks = %d\n", - d_block_size, d_nblocks); - - // allocate urbs - - for (int i = 0; i < d_nblocks; i++) - d_free_list.push_back (alloc_urb (this, d_block_size, d_endpoint, - d_input_p, d_write_buffer)); -} - -fusb_ephandle_linux::~fusb_ephandle_linux () -{ - stop (); - - usbdevfs_urb *urb; - - while ((urb = free_list_get ()) != 0) - free_urb (urb); - - while ((urb = completed_list_get ()) != 0) - free_urb (urb); - - if (d_write_work_in_progress) - free_urb (d_write_work_in_progress); - - delete [] d_write_buffer; - - if (d_read_work_in_progress) - free_urb (d_read_work_in_progress); -} - -// ---------------------------------------------------------------- - -bool -fusb_ephandle_linux::start () -{ - if (d_started) - return true; // already running - - d_started = true; - - if (d_input_p){ // fire off all the reads - usbdevfs_urb *urb; - - int nerrors = 0; - while ((urb = free_list_get ()) != 0 && nerrors < d_nblocks){ - if (!submit_urb (urb)) - nerrors++; - } - } - - return true; -} - -// -// kill all i/o in progress. -// kill any completed but unprocessed transactions. -// -bool -fusb_ephandle_linux::stop () -{ - if (!d_started) - return true; - - if (d_write_work_in_progress){ - free_list_add (d_write_work_in_progress); - d_write_work_in_progress = 0; - } - - if (d_read_work_in_progress){ - free_list_add (d_read_work_in_progress); - d_read_work_in_progress = 0; - d_read_buffer = 0; - d_read_buffer_end = 0; - } - - d_devhandle->_cancel_pending_rqsts (this); - d_devhandle->_reap (false); - - while (1){ - usbdevfs_urb *urb; - while ((urb = completed_list_get ()) != 0) - free_list_add (urb); - - if (d_free_list.size () == (unsigned) d_nblocks) - break; - - if (!d_devhandle->_reap(true)) - break; - } - - d_started = false; - return true; -} - -// ---------------------------------------------------------------- -// routines for writing -// ---------------------------------------------------------------- - -#if (MINIMIZE_TX_BUFFERING) - -int -fusb_ephandle_linux::write(const void *buffer, int nbytes) -{ - if (!d_started) - return -1; - - if (d_input_p) - return -1; - - assert(nbytes % 512 == 0); - - unsigned char *src = (unsigned char *) buffer; - - int n = 0; - while (n < nbytes){ - - usbdevfs_urb *urb = get_write_work_in_progress(); - if (!urb) - return -1; - assert(urb->actual_length == 0); - int m = std::min(nbytes - n, MAX_BLOCK_SIZE); - urb->buffer = src; - urb->buffer_length = m; - - n += m; - src += m; - - if (!submit_urb(urb)) - return -1; - - d_write_work_in_progress = 0; - } - - return n; -} - -#else - -int -fusb_ephandle_linux::write (const void *buffer, int nbytes) -{ - if (!d_started) - return -1; - - if (d_input_p) - return -1; - - unsigned char *src = (unsigned char *) buffer; - - int n = 0; - while (n < nbytes){ - - usbdevfs_urb *urb = get_write_work_in_progress (); - if (!urb) - return -1; - unsigned char *dst = (unsigned char *) urb->buffer; - int m = std::min (nbytes - n, urb->buffer_length - urb->actual_length); - - memcpy (&dst[urb->actual_length], &src[n], m); - urb->actual_length += m; - n += m; - - if (urb->actual_length == urb->buffer_length){ - if (!submit_urb (urb)) - return -1; - d_write_work_in_progress = 0; - } - } - - return n; -} - -#endif - -usbdevfs_urb * -fusb_ephandle_linux::get_write_work_in_progress () -{ - // if we've already got some work in progress, return it - - if (d_write_work_in_progress) - return d_write_work_in_progress; - - while (1){ - - reap_complete_writes (); - - usbdevfs_urb *urb = free_list_get (); - - if (urb != 0){ - assert (urb->actual_length == 0); - d_write_work_in_progress = urb; - return urb; - } - - // The free list is empty. Tell the device handle to reap. - // Anything it reaps for us will end up on our completed list. - - if (!d_devhandle->_reap (true)) - return 0; - } -} - -void -fusb_ephandle_linux::reap_complete_writes () -{ - // take a look at the completed_list and xfer to free list after - // checking for errors. - - usbdevfs_urb *urb; - - while ((urb = completed_list_get ()) != 0){ - - // Check for any errors or short writes that were reported in the urb. - // The kernel sets status, actual_length and error_count. - // error_count is only used for ISO xfers. - // status is 0 if successful, else is an errno kind of thing - - if (urb->status != 0){ - fprintf (stderr, "fusb: (status %d) %s\n", urb->status, strerror (-urb->status)); - } - else if (urb->actual_length != urb->buffer_length){ - fprintf (stderr, "fusb: short write xfer: %d != %d\n", - urb->actual_length, urb->buffer_length); - } - - free_list_add (urb); - } -} - -void -fusb_ephandle_linux::wait_for_completion () -{ - d_devhandle->_wait_for_completion (); -} - -// ---------------------------------------------------------------- -// routines for reading -// ---------------------------------------------------------------- - -int -fusb_ephandle_linux::read (void *buffer, int nbytes) -{ - if (!d_started) - return -1; - - if (!d_input_p) - return -1; - - unsigned char *dst = (unsigned char *) buffer; - - int n = 0; - while (n < nbytes){ - - if (d_read_buffer >= d_read_buffer_end) - if (!reload_read_buffer ()) - return -1; - - int m = std::min (nbytes - n, (int) (d_read_buffer_end - d_read_buffer)); - - memcpy (&dst[n], d_read_buffer, m); - d_read_buffer += m; - n += m; - } - - return n; -} - -bool -fusb_ephandle_linux::reload_read_buffer () -{ - assert (d_read_buffer >= d_read_buffer_end); - - usbdevfs_urb *urb; - - if (d_read_work_in_progress){ - // We're done with this urb. Fire off a read to refill it. - urb = d_read_work_in_progress; - d_read_work_in_progress = 0; - d_read_buffer = 0; - d_read_buffer_end = 0; - urb->actual_length = 0; - if (!submit_urb (urb)) - return false; - } - - while (1){ - - while ((urb = completed_list_get ()) == 0) - if (!d_devhandle->_reap (true)) - return false; - - // check result of completed read - - if (urb->status != 0){ - // We've got a problem. Report it and fail. - fprintf (stderr, "fusb: (rd status %d) %s\n", urb->status, strerror (-urb->status)); - urb->actual_length = 0; - free_list_add (urb); - return false; - } - - // we've got a happy urb, full of data... - - d_read_work_in_progress = urb; - d_read_buffer = (unsigned char *) urb->buffer; - d_read_buffer_end = d_read_buffer + urb->actual_length; - - return true; - } -} - -// ---------------------------------------------------------------- - -void -fusb_ephandle_linux::free_list_add (usbdevfs_urb *urb) -{ - assert (urb_get_ephandle (urb) == this); - urb->actual_length = 0; - d_free_list.push_back (urb); -} - -usbdevfs_urb * -fusb_ephandle_linux::free_list_get () -{ - if (d_free_list.empty ()) - return 0; - - usbdevfs_urb *urb = d_free_list.front (); - d_free_list.pop_front (); - return urb; -} - -void -fusb_ephandle_linux::completed_list_add (usbdevfs_urb *urb) -{ - assert (urb_get_ephandle (urb) == this); - d_completed_list.push_back (urb); -} - -usbdevfs_urb * -fusb_ephandle_linux::completed_list_get () -{ - if (d_completed_list.empty ()) - return 0; - - usbdevfs_urb *urb = d_completed_list.front (); - d_completed_list.pop_front (); - return urb; -} - -/* - * Submit the urb. If successful the urb ends up on the devhandle's - * pending list, otherwise, it's back on our free list. - */ -bool -fusb_ephandle_linux::submit_urb (usbdevfs_urb *urb) -{ - if (!d_devhandle->_submit_urb (urb)){ // FIXME record the problem somewhere - fprintf (stderr, "_submit_urb failed\n"); - free_list_add (urb); - return false; - } - return true; -} diff --git a/usrp/host/lib/fusb_linux.h b/usrp/host/lib/fusb_linux.h deleted file mode 100644 index 107e1af70..000000000 --- a/usrp/host/lib/fusb_linux.h +++ /dev/null @@ -1,116 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 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. - */ - -// Fast USB interface - -#ifndef _FUSB_LINUX_H_ -#define _FUSB_LINUX_H_ - -#include <fusb.h> -#include <list> - -struct usbdevfs_urb; -class fusb_ephandle_linux; - -/*! - * \brief linux specific implementation of fusb_devhandle using usbdevice_fs - */ -class fusb_devhandle_linux : public fusb_devhandle { -private: - std::list<usbdevfs_urb*> d_pending_rqsts; - - void pending_add (usbdevfs_urb *urb); - bool pending_remove (usbdevfs_urb *urb); - usbdevfs_urb * pending_get (); - - -public: - // CREATORS - fusb_devhandle_linux (usb_dev_handle *udh); - virtual ~fusb_devhandle_linux (); - - // MANIPULATORS - virtual fusb_ephandle *make_ephandle (int endpoint, bool input_p, - int block_size = 0, int nblocks = 0); - - // internal use only - bool _submit_urb (usbdevfs_urb *urb); - bool _cancel_urb (usbdevfs_urb *urb); - void _cancel_pending_rqsts (fusb_ephandle_linux *eph); - bool _reap (bool ok_to_block_p); - void _wait_for_completion (); -}; - -/*! - * \brief linux specific implementation of fusb_ephandle using usbdevice_fs - */ - -class fusb_ephandle_linux : public fusb_ephandle { -private: - fusb_devhandle_linux *d_devhandle; - std::list<usbdevfs_urb*> d_free_list; - std::list<usbdevfs_urb*> d_completed_list; - usbdevfs_urb *d_write_work_in_progress; - unsigned char *d_write_buffer; - usbdevfs_urb *d_read_work_in_progress; - unsigned char *d_read_buffer; - unsigned char *d_read_buffer_end; - - usbdevfs_urb *get_write_work_in_progress (); - void reap_complete_writes (); - bool reload_read_buffer (); - bool submit_urb (usbdevfs_urb *urb); - -public: - fusb_ephandle_linux (fusb_devhandle_linux *dh, int endpoint, bool input_p, - int block_size = 0, int nblocks = 0); - virtual ~fusb_ephandle_linux (); - - virtual bool start (); //!< begin streaming i/o - virtual bool stop (); //!< stop streaming i/o - - /*! - * \returns \p nbytes if write was successfully enqueued, else -1. - * Will block if no free buffers available. - */ - virtual int write (const void *buffer, int nbytes); - - /*! - * \returns number of bytes read or -1 if error. - * number of bytes read will be <= nbytes. - * Will block if no input available. - */ - virtual int read (void *buffer, int nbytes); - - /* - * block until all outstanding writes have completed - */ - virtual void wait_for_completion (); - - // internal use only - void free_list_add (usbdevfs_urb *urb); - void completed_list_add (usbdevfs_urb *urb); - usbdevfs_urb *free_list_get (); // pop and return head of list or 0 - usbdevfs_urb *completed_list_get (); // pop and return head of list or 0 -}; - -#endif /* _FUSB_LINUX_H_ */ diff --git a/usrp/host/lib/fusb_ra_wb.cc b/usrp/host/lib/fusb_ra_wb.cc deleted file mode 100644 index 699a34b39..000000000 --- a/usrp/host/lib/fusb_ra_wb.cc +++ /dev/null @@ -1,258 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003,2006 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 <fusb_ra_wb.h> -#include <usb.h> - -#include <stdio.h> -#include <errno.h> -#include <string.h> - -#include <sys/event.h> -#include <dev/usb/usb.h> - -static const int USB_TIMEOUT = 1000; // in milliseconds - -// the following comment and function is from fusb_linux.cc -#if 0 -// Totally evil and fragile extraction of file descriptor from -// guts of libusb. They don't install usbi.h, which is what we'd need -// to do this nicely. -// -// FIXME if everything breaks someday in the future, look here... - -static int -fd_from_usb_dev_handle (usb_dev_handle *udh) -{ - return *((int *) udh); -} -#endif - -// the control endpoint doesn't actually do us any good so here is a -// new "fragile extraction" -static int -ep_fd_from_usb_dev_handle (usb_dev_handle *udh, int endpoint) -{ - struct usb_dev_handle_kludge2 { // see also usrp_prims.cc - int fd; - struct usb_bus *bus; - struct usb_device *device; - int config; - int interface; - int altsetting; - void *impl_info; - }; - struct bsd_usb_dev_handle_info_kludge { - int ep_fd[USB_MAX_ENDPOINTS]; - }; - struct bsd_usb_dev_handle_info_kludge *info - = (struct bsd_usb_dev_handle_info_kludge *) - ((struct usb_dev_handle_kludge2 *)udh)->impl_info; - return info->ep_fd[UE_GET_ADDR(endpoint)]; -} - - -fusb_devhandle_ra_wb::fusb_devhandle_ra_wb (usb_dev_handle *udh) - : fusb_devhandle (udh) -{ - // that's it -} - -fusb_devhandle_ra_wb::~fusb_devhandle_ra_wb () -{ - // nop -} - -fusb_ephandle * -fusb_devhandle_ra_wb::make_ephandle (int endpoint, bool input_p, - int block_size, int nblocks) -{ - return new fusb_ephandle_ra_wb (this, endpoint, input_p, - block_size, nblocks); -} - -// ---------------------------------------------------------------- - -fusb_ephandle_ra_wb::fusb_ephandle_ra_wb (fusb_devhandle_ra_wb *dh, - int endpoint, bool input_p, - int block_size, int nblocks) - : fusb_ephandle (endpoint, input_p, block_size, nblocks), - d_devhandle (dh), d_ra_wb_on (false) -{ - // that's it -} - -fusb_ephandle_ra_wb::~fusb_ephandle_ra_wb () -{ - // nop -} - -bool -fusb_ephandle_ra_wb::start () -{ - d_started = true; - - char buf = '\0'; - int fd; - - // this is to cause libusb to open the endpoint - if (!d_input_p) { - write(&buf, 0); - fd = ep_fd_from_usb_dev_handle (d_devhandle->get_usb_dev_handle(), - d_endpoint); - } - else { - read(&buf, 0); - fd = ep_fd_from_usb_dev_handle (d_devhandle->get_usb_dev_handle(), - d_endpoint|USB_ENDPOINT_IN); - } - - // enable read ahead/write behind - int ret; - struct usb_bulk_ra_wb_opt opts; - int enable = 1; - - opts.ra_wb_buffer_size = d_block_size*d_nblocks; - opts.ra_wb_request_size = d_block_size; -// fprintf (stderr, "setting buffer size to %d, request size to %d\n", -// opts.ra_wb_buffer_size, opts.ra_wb_request_size); - if (!d_input_p) { - ret = ioctl (fd, USB_SET_BULK_WB_OPT, &opts); - if (ret < 0) - fprintf (stderr, "USB_SET_BULK_WB_OPT: %s\n", strerror(errno)); - else { - ret = ioctl (fd, USB_SET_BULK_WB, &enable); - if (ret < 0) - fprintf (stderr, "USB_SET_BULK_WB: %s\n", strerror(errno)); - else - d_ra_wb_on = true; - } - } - else { - ret = ioctl (fd, USB_SET_BULK_RA_OPT, &opts); - if (ret < 0) - fprintf (stderr, "USB_SET_BULK_RA_OPT: %s\n", strerror(errno)); - else { - ret = ioctl (fd, USB_SET_BULK_RA, &enable); - if (ret < 0) - fprintf (stderr, "USB_SET_BULK_RA: %s\n", strerror(errno)); - else - d_ra_wb_on = true; - } - } - - return true; -} - -bool -fusb_ephandle_ra_wb::stop () -{ - int fd; - int ret; - int enable = 0; - if (d_ra_wb_on) { - if (!d_input_p) { - fd = ep_fd_from_usb_dev_handle (d_devhandle->get_usb_dev_handle(), - d_endpoint); - ret = ioctl (fd, USB_SET_BULK_WB, &enable); - if (ret < 0) - fprintf (stderr, "USB_SET_BULK_WB: %s\n", strerror(errno)); - else - d_ra_wb_on = false; - } - else { - fd = ep_fd_from_usb_dev_handle (d_devhandle->get_usb_dev_handle(), - d_endpoint|USB_ENDPOINT_IN); - ret = ioctl (fd, USB_SET_BULK_RA, &enable); - if (ret < 0) - fprintf (stderr, "USB_SET_BULK_RA: %s\n", strerror(errno)); - else - d_ra_wb_on = false; - } - } - - d_started = false; - return true; -} - -int -fusb_ephandle_ra_wb::write (const void *buffer, int nbytes) -{ - if (!d_started) - return -1; - - if (d_input_p) - return -1; - - return usb_bulk_write (d_devhandle->get_usb_dev_handle (), - d_endpoint, (char *) buffer, nbytes, USB_TIMEOUT); -} - -int -fusb_ephandle_ra_wb::read (void *buffer, int nbytes) -{ - if (!d_started) - return -1; - - if (!d_input_p) - return -1; - - return usb_bulk_read (d_devhandle->get_usb_dev_handle (), - d_endpoint|USB_ENDPOINT_IN, (char *) buffer, nbytes, - USB_TIMEOUT); -} - -void -fusb_ephandle_ra_wb::wait_for_completion () -{ - // as the driver is implemented this only makes sense for write - if (d_ra_wb_on && !d_input_p) { - int fd = ep_fd_from_usb_dev_handle (d_devhandle->get_usb_dev_handle(), - d_endpoint); - int kq = kqueue(); - if (kq < 0) - return; - struct kevent evt; - int nevents; - EV_SET (&evt, fd, EVFILT_WRITE, EV_ADD | EV_ENABLE, 0, 0, 0/*NULL*/); - nevents = kevent (kq, &evt, 1, &evt, 1, NULL); - if (nevents < 1) { - close(kq); - return; - } - while (!(evt.flags & EV_ERROR) && evt.data < (d_block_size*d_nblocks)) { - // it's a busy loop, but that's all I can do at the moment - nevents = kevent (kq, NULL, 0, &evt, 1, NULL); - // let's see if this improves the test_usrp_standard_tx throughput & - // "CPU usage" by looping less frequently - struct timeval timeout; - timeout.tv_sec = 0; - timeout.tv_usec = 1000; // 1 ms - select (0, NULL, NULL, NULL, &timeout); - } - close (kq); - } -} diff --git a/usrp/host/lib/fusb_ra_wb.h b/usrp/host/lib/fusb_ra_wb.h deleted file mode 100644 index 233976abe..000000000 --- a/usrp/host/lib/fusb_ra_wb.h +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003,2006 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 _FUSB_RA_WB_H_ -#define _FUSB_RA_WB_H_ - -#include <fusb.h> - -/*! - * \brief generic implementation of fusb_devhandle using only libusb - */ -class fusb_devhandle_ra_wb : public fusb_devhandle -{ -public: - // CREATORS - fusb_devhandle_ra_wb (usb_dev_handle *udh); - virtual ~fusb_devhandle_ra_wb (); - - // MANIPULATORS - virtual fusb_ephandle *make_ephandle (int endpoint, bool input_p, - int block_size = 0, int nblocks = 0); -}; - - -/*! - * \brief generic implementation of fusb_ephandle using only libusb - */ -class fusb_ephandle_ra_wb : public fusb_ephandle -{ -private: - fusb_devhandle_ra_wb *d_devhandle; - bool d_ra_wb_on; - -public: - // CREATORS - fusb_ephandle_ra_wb (fusb_devhandle_ra_wb *dh, int endpoint, bool input_p, - int block_size = 0, int nblocks = 0); - virtual ~fusb_ephandle_ra_wb (); - - // MANIPULATORS - - virtual bool start (); //!< begin streaming i/o - virtual bool stop (); //!< stop streaming i/o - - /*! - * \returns \p nbytes if write was successfully enqueued, else -1. - * Will block if no free buffers available. - */ - virtual int write (const void *buffer, int nbytes); - - /*! - * \returns number of bytes read or -1 if error. - * number of bytes read will be <= nbytes. - * Will block if no input available. - */ - virtual int read (void *buffer, int nbytes); - - /* - * block until all outstanding writes have completed - */ - virtual void wait_for_completion (); -}; - -#endif /* _FUSB_RA_WB_H_ */ - diff --git a/usrp/host/lib/fusb_sysconfig_darwin.cc b/usrp/host/lib/fusb_sysconfig_darwin.cc deleted file mode 100644 index 68dd64815..000000000 --- a/usrp/host/lib/fusb_sysconfig_darwin.cc +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003,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 <fusb.h> -#include <fusb_darwin.h> - -static const int MAX_BLOCK_SIZE = 32 * 1024; // hard limit -static const int FUSB_BUFFER_SIZE = 2 * (1L << 20); // 2 MB - -fusb_devhandle * -fusb_sysconfig::make_devhandle (usb_dev_handle *udh, libusb_context *ctx) -{ - return new fusb_devhandle_darwin (udh); -} - -int fusb_sysconfig::max_block_size () -{ - return MAX_BLOCK_SIZE; -} - -int fusb_sysconfig::default_block_size () -{ - return fusb_sysconfig::max_block_size (); -} - -int fusb_sysconfig::default_buffer_size () -{ - return FUSB_BUFFER_SIZE; -} - diff --git a/usrp/host/lib/fusb_sysconfig_generic.cc b/usrp/host/lib/fusb_sysconfig_generic.cc deleted file mode 100644 index e0986510c..000000000 --- a/usrp/host/lib/fusb_sysconfig_generic.cc +++ /dev/null @@ -1,48 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003,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 <fusb.h> -#include <fusb_generic.h> - -static const int MAX_BLOCK_SIZE = 16 * 1024; // hard limit -static const int FUSB_BUFFER_SIZE = 2 * (1L << 20); // 2 MB - -fusb_devhandle * -fusb_sysconfig::make_devhandle (usb_dev_handle *udh, libusb_context *ctx) -{ - return new fusb_devhandle_generic (udh); -} - -int fusb_sysconfig::max_block_size () -{ - return MAX_BLOCK_SIZE; -} - -int fusb_sysconfig::default_block_size () -{ - return fusb_sysconfig::max_block_size (); -} - -int fusb_sysconfig::default_buffer_size () -{ - return FUSB_BUFFER_SIZE; -} diff --git a/usrp/host/lib/fusb_sysconfig_libusb1.cc b/usrp/host/lib/fusb_sysconfig_libusb1.cc deleted file mode 100644 index 46daf561a..000000000 --- a/usrp/host/lib/fusb_sysconfig_libusb1.cc +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003,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 <fusb.h> -#include <fusb_libusb1.h> - -static const int MAX_BLOCK_SIZE = 16 * 1024; // hard limit -static const int DEFAULT_BLOCK_SIZE = 4 * 1024; -static const int FUSB_BUFFER_SIZE = 1 * (1L << 20); // 1 MB - -struct libusb_context; - -fusb_devhandle * -fusb_sysconfig::make_devhandle (libusb_device_handle *udh, libusb_context *ctx) -{ - return new fusb_devhandle_libusb1 (udh, ctx); -} - -int fusb_sysconfig::max_block_size () -{ - return MAX_BLOCK_SIZE; -} - -int fusb_sysconfig::default_block_size () -{ - return DEFAULT_BLOCK_SIZE; -} - -int fusb_sysconfig::default_buffer_size () -{ - return FUSB_BUFFER_SIZE; -} diff --git a/usrp/host/lib/fusb_sysconfig_linux.cc b/usrp/host/lib/fusb_sysconfig_linux.cc deleted file mode 100644 index e33b90ba4..000000000 --- a/usrp/host/lib/fusb_sysconfig_linux.cc +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003,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 <fusb.h> -#include <fusb_linux.h> - -static const int MAX_BLOCK_SIZE = 16 * 1024; // hard limit -static const int DEFAULT_BLOCK_SIZE = 4 * 1024; // fewer kernel memory problems -static const int FUSB_BUFFER_SIZE = 1 * (1L << 20); // 1MB - -fusb_devhandle * -fusb_sysconfig::make_devhandle (usb_dev_handle *udh, libusb_context *ctx) -{ - return new fusb_devhandle_linux (udh); -} - -int fusb_sysconfig::max_block_size () -{ - return MAX_BLOCK_SIZE; -} - -int fusb_sysconfig::default_block_size () -{ - return DEFAULT_BLOCK_SIZE; -} - -int fusb_sysconfig::default_buffer_size () -{ - return FUSB_BUFFER_SIZE; -} diff --git a/usrp/host/lib/fusb_sysconfig_ra_wb.cc b/usrp/host/lib/fusb_sysconfig_ra_wb.cc deleted file mode 100644 index c527e3099..000000000 --- a/usrp/host/lib/fusb_sysconfig_ra_wb.cc +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003,2006,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 <fusb.h> -#include <fusb_ra_wb.h> - -//static const int MAX_BLOCK_SIZE = 16 * 1024; // hard limit -// there's no hard limit, even before making any changes to the driver -// 64k is empirically a pretty good number -static const int MAX_BLOCK_SIZE = 64 * 1024; -// there is a limit of 1 MB in the driver for the buffer size -static const int FUSB_BUFFER_SIZE = 256 * (1L << 10); // 256 kB - -fusb_devhandle * -fusb_sysconfig::make_devhandle (usb_dev_handle *udh, libusb_context *ctx) -{ - return new fusb_devhandle_ra_wb (udh); -} - -int fusb_sysconfig::max_block_size () -{ - return MAX_BLOCK_SIZE; -} - -int fusb_sysconfig::default_block_size () -{ - return fusb_sysconfig::max_block_size (); -} - -int fusb_sysconfig::default_buffer_size () -{ - return FUSB_BUFFER_SIZE; -} diff --git a/usrp/host/lib/fusb_sysconfig_win32.cc b/usrp/host/lib/fusb_sysconfig_win32.cc deleted file mode 100644 index fb4be8829..000000000 --- a/usrp/host/lib/fusb_sysconfig_win32.cc +++ /dev/null @@ -1,48 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003,2005,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 <fusb.h> -#include <fusb_win32.h> - -static const int MAX_BLOCK_SIZE = 64 * 1024; // Windows kernel hard limit -static const int FUSB_BUFFER_SIZE = 2 * (1L << 20); // 2 MB - -fusb_devhandle * -fusb_sysconfig::make_devhandle (usb_dev_handle *udh, libusb_context *ctx) -{ - return new fusb_devhandle_win32 (udh); -} - -int fusb_sysconfig::max_block_size () -{ - return MAX_BLOCK_SIZE; -} - -int fusb_sysconfig::default_block_size () -{ - return fusb_sysconfig::max_block_size (); -} - -int fusb_sysconfig::default_buffer_size () -{ - return FUSB_BUFFER_SIZE; -} diff --git a/usrp/host/lib/fusb_win32.cc b/usrp/host/lib/fusb_win32.cc deleted file mode 100644 index 8c218534b..000000000 --- a/usrp/host/lib/fusb_win32.cc +++ /dev/null @@ -1,267 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003,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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <fusb_win32.h> -#include <usb.h> -#include <assert.h> -#include <stdexcept> -#include <string.h> -#include <cstdio> - -static const int MAX_BLOCK_SIZE = fusb_sysconfig::max_block_size(); -static const int DEFAULT_BLOCK_SIZE = MAX_BLOCK_SIZE; -static const int DEFAULT_BUFFER_SIZE = 16 * (1L << 20); // 16 MB / endpoint - - -static const int USB_TIMEOUT = 1000; // in milliseconds - - -fusb_devhandle_win32::fusb_devhandle_win32 (usb_dev_handle *udh) - : fusb_devhandle (udh) -{ - // that's it -} - -fusb_devhandle_win32::~fusb_devhandle_win32 () -{ - // nop -} - -fusb_ephandle * -fusb_devhandle_win32::make_ephandle (int endpoint, bool input_p, - int block_size, int nblocks) -{ - return new fusb_ephandle_win32 (this, endpoint, input_p, - block_size, nblocks); -} - -// ---------------------------------------------------------------- - -fusb_ephandle_win32::fusb_ephandle_win32 (fusb_devhandle_win32 *dh, - int endpoint, bool input_p, - int block_size, int nblocks) - : fusb_ephandle (endpoint, input_p, block_size, nblocks), - d_devhandle (dh), d_input_leftover(0),d_output_short(0) -{ - if (d_block_size < 0 || d_block_size > MAX_BLOCK_SIZE) - throw std::out_of_range ("fusb_ephandle_win32: block_size"); - - if (d_nblocks < 0) - throw std::out_of_range ("fusb_ephandle_win32: nblocks"); - - if (d_block_size == 0) - d_block_size = DEFAULT_BLOCK_SIZE; - - if (d_nblocks == 0) - d_nblocks = std::max (1, DEFAULT_BUFFER_SIZE / d_block_size); - - d_buffer = new char [d_block_size*d_nblocks]; - d_context = new void * [d_nblocks]; - - // allocate contexts - - usb_dev_handle *dev = dh->get_usb_dev_handle (); - int i; - - if (d_input_p) - endpoint |= USB_ENDPOINT_IN; - - for (i=0; i<d_nblocks; i++) - usb_bulk_setup_async(dev, &d_context[i], endpoint); -} - -fusb_ephandle_win32::~fusb_ephandle_win32 () -{ - int i; - - stop (); - - for (i=0; i<d_nblocks; i++) - usb_free_async(&d_context[i]); - - delete [] d_buffer; - delete [] d_context; -} - -bool -fusb_ephandle_win32::start () -{ - if (d_started) - return true; // already running - - d_started = true; - - d_curr = d_nblocks-1; - d_outstanding_write = 0; - d_input_leftover =0; - d_output_short = 0; - - if (d_input_p){ // fire off all the reads - int i; - - for (i=0; i<d_nblocks; i++) { - usb_submit_async(d_context[i], (char * ) d_buffer+i*d_block_size, - d_block_size); - } - } - - return true; -} - -bool -fusb_ephandle_win32::stop () -{ - if (!d_started) - return true; - - if (!d_input_p) - wait_for_completion (); - - d_started = false; - return true; -} - -int -fusb_ephandle_win32::write (const void *buffer, int nbytes) -{ - int retval=0; - char *buf; - - if (!d_started) // doesn't matter here, but keeps semantics constant - return -1; - - if (d_input_p) - return -1; - - int bytes_to_write = nbytes; - int a=0; - - if (d_output_short != 0) { - - buf = &d_buffer[d_curr*d_block_size + d_block_size - d_output_short]; - a = std::min(nbytes, d_output_short); - memcpy(buf, buffer, a); - bytes_to_write -= a; - d_output_short -= a; - - if (d_output_short == 0) - usb_submit_async(d_context[d_curr], - &d_buffer[d_curr*d_block_size], d_block_size); - } - - while (bytes_to_write > 0) { - d_curr = (d_curr+1)%d_nblocks; - buf = &d_buffer[d_curr*d_block_size]; - - if (d_outstanding_write != d_nblocks) { - d_outstanding_write++; - } else { - retval = usb_reap_async(d_context[d_curr], USB_TIMEOUT); - if (retval < 0) { - fprintf(stderr, "%s: usb_reap_async: %s\n", - __FUNCTION__, usb_strerror()); - return retval; - } - } - - int ncopy = std::min(bytes_to_write, d_block_size); - memcpy(buf, (void *) &(((char*)buffer)[a]), ncopy); - bytes_to_write -= ncopy; - a += ncopy; - - d_output_short = d_block_size - ncopy; - if (d_output_short == 0) - usb_submit_async(d_context[d_curr], buf, d_block_size); - } - - return retval < 0 ? retval : nbytes; -} - -int -fusb_ephandle_win32::read (void *buffer, int nbytes) -{ - int retval=0; - char *buf; - - if (!d_started) // doesn't matter here, but keeps semantics constant - return -1; - - if (!d_input_p) - return -1; - - int bytes_to_read = nbytes; - - int a=0; - if (d_input_leftover != 0) { - - buf = &d_buffer[d_curr*d_block_size + d_block_size - d_input_leftover]; - a = std::min(nbytes, d_input_leftover); - memcpy(buffer, buf, a); - bytes_to_read -= a; - d_input_leftover -= a; - - if (d_input_leftover == 0) - usb_submit_async(d_context[d_curr], - &d_buffer[d_curr*d_block_size], d_block_size); - } - - while (bytes_to_read > 0) { - - d_curr = (d_curr+1)%d_nblocks; - buf = &d_buffer[d_curr*d_block_size]; - - retval = usb_reap_async(d_context[d_curr], USB_TIMEOUT); - if (retval < 0) - fprintf(stderr, "%s: usb_reap_async: %s\n", - __FUNCTION__, usb_strerror()); - - int ncopy = std::min(bytes_to_read, d_block_size); - memcpy((void *) &(((char*)buffer)[a]), buf, ncopy); - bytes_to_read -= ncopy; - a += ncopy; - - d_input_leftover = d_block_size - ncopy; - if (d_input_leftover == 0) - usb_submit_async(d_context[d_curr], buf, d_block_size); - } - - return retval < 0 ? retval : nbytes; -} - -void -fusb_ephandle_win32::wait_for_completion () -{ - int i; - - for (i=0; i<d_outstanding_write; i++) { - int context_num; - - context_num = (d_curr+d_outstanding_write+i+1)%d_nblocks; - usb_reap_async(d_context[context_num], USB_TIMEOUT); - } - - d_outstanding_write = 0; -} diff --git a/usrp/host/lib/fusb_win32.h b/usrp/host/lib/fusb_win32.h deleted file mode 100644 index 3ad2132f4..000000000 --- a/usrp/host/lib/fusb_win32.h +++ /dev/null @@ -1,90 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 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 _FUSB_WIN32_H_ -#define _FUSB_WIN32_H_ - -#include <fusb.h> - -/*! - * \brief win32 implementation of fusb_devhandle using libusb-win32 - */ -class fusb_devhandle_win32 : public fusb_devhandle -{ -public: - // CREATORS - fusb_devhandle_win32 (usb_dev_handle *udh); - virtual ~fusb_devhandle_win32 (); - - // MANIPULATORS - virtual fusb_ephandle *make_ephandle (int endpoint, bool input_p, - int block_size = 0, int nblocks = 0); -}; - - -/*! - * \brief win32 implementation of fusb_ephandle using libusb-win32 - */ -class fusb_ephandle_win32 : public fusb_ephandle -{ -private: - fusb_devhandle_win32 *d_devhandle; - - unsigned d_curr; - unsigned d_outstanding_write; - int d_output_short; - int d_input_leftover; - void ** d_context; - char * d_buffer; - -public: - // CREATORS - fusb_ephandle_win32 (fusb_devhandle_win32 *dh, int endpoint, bool input_p, - int block_size = 0, int nblocks = 0); - virtual ~fusb_ephandle_win32 (); - - // MANIPULATORS - - virtual bool start (); //!< begin streaming i/o - virtual bool stop (); //!< stop streaming i/o - - /*! - * \returns \p nbytes if write was successfully enqueued, else -1. - * Will block if no free buffers available. - */ - virtual int write (const void *buffer, int nbytes); - - /*! - * \returns number of bytes read or -1 if error. - * number of bytes read will be <= nbytes. - * Will block if no input available. - */ - virtual int read (void *buffer, int nbytes); - - /* - * block until all outstanding writes have completed - */ - virtual void wait_for_completion (); -}; - -#endif /* _FUSB_WIN32_H_ */ - diff --git a/usrp/host/lib/gen-ratios b/usrp/host/lib/gen-ratios deleted file mode 100755 index 2250090d7..000000000 --- a/usrp/host/lib/gen-ratios +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env python -# -*- python -*- - -def how_good (x): - pof2 = [1,2,4,8,16] - if x in pof2: - return 0 - if x in map (lambda x: x+1, pof2): - return -10 - if x in map (lambda x: x-1, pof2): - return -5 - return -2 - - -def better (v1, v2): - return abs ((v1 & 0xf) - ((v1 >> 4) & 0xf)) < abs ((v2 & 0xf) - ((v2 >> 4) & 0xf)) - - -def foo (): - result = {} - for i in range (1,17): - for j in range (1,17): - i_goodness = how_good (i) - j_goodness = how_good (j) - goodness = i_goodness + j_goodness - v = ((i - 1) << 4) | (j - 1) - - key = i * j - prev = result.get (key, None) - # print "i=%3d j=%3d key=%3d good=%3d v=0x%02x prev=%s" % (i, j, key, goodness, v, prev) - - if not prev: - result[key] = (goodness, v) - elif goodness > prev[0]: - result[key] = (goodness, v) - elif goodness == prev[0] and better(v, prev[1]): - result[key] = (goodness, v) - - r = result.items () - r.sort () - for k, d in r: - print "(%3d, 0x%02x)" % (k, d[1]) - - - -foo () - - diff --git a/usrp/host/lib/gen_usrp_dbid.py b/usrp/host/lib/gen_usrp_dbid.py deleted file mode 100755 index c7d3770c1..000000000 --- a/usrp/host/lib/gen_usrp_dbid.py +++ /dev/null @@ -1,137 +0,0 @@ -#!/usr/bin/env python - -import sys -import os -import os.path -import re -from optparse import OptionParser - -def write_header(f, comment_char): - f.write(comment_char); f.write('\n') - f.write(comment_char); f.write(' Machine generated by gen_usrp_dbid.py from usrp_dbid.dat\n') - f.write(comment_char); f.write(' Do not edit by hand. All edits will be overwritten.\n') - f.write(comment_char); f.write('\n') - f.write('\n') - -def gen_dbid_py(r): - f = open('usrp_dbid.py', 'w') - comment_char = '#' - write_header(f, comment_char) - f.write(comment_char); f.write('\n') - f.write(comment_char); f.write(" USRP Daughterboard ID's\n") - f.write(comment_char); f.write('\n') - f.write('\n') - for x in r: - f.write('%-16s = %s\n' % (x[1], x[2])) - -def gen_dbid_h(r): - f = open('../include/usrp/usrp_dbid.h', 'w') - comment_char = '//' - write_header(f, comment_char) - f.write(comment_char); f.write('\n') - f.write(comment_char); f.write(" USRP Daughterboard ID's\n") - f.write(comment_char); f.write('\n') - f.write('\n') - f.write('#ifndef INCLUDED_USRP_DBID_H\n') - f.write('#define INCLUDED_USRP_DBID_H\n') - f.write('\n') - for x in r: - f.write('#define %-25s %s\n' % ('USRP_DBID_' + x[1], x[2])) - f.write('\n') - f.write('#endif /* INCLUDED_USRP_DBID_H */\n') - -def gen_dbid_cc(r): - f = open('usrp_dbid.cc', 'w') - write_header(f, '//') - head = '''/* - * 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. - */ - -#include <usrp/usrp_prims.h> -#include <usrp/usrp_dbid.h> -#include <stdio.h> - -#define NELEM(x) sizeof(x)/sizeof(x[0]) - -static struct { - unsigned short dbid; - const char *name; -} dbid_map[] = { -''' - - tail = '''}; - -const std::string -usrp_dbid_to_string (int dbid) -{ - if (dbid == -1) - return "<none>"; - - if (dbid == -2) - return "<invalid EEPROM contents>"; - - for (unsigned i = 0; i < NELEM (dbid_map); i++) - if (dbid == dbid_map[i].dbid) - return dbid_map[i].name; - - char tmp[64]; - snprintf (tmp, sizeof (tmp), "Unknown (0x%04x)", dbid); - return tmp; -} -''' - f.write(head) - for x in r: - f.write(' { %-27s "%s" },\n' % ( - 'USRP_DBID_' + x[1] + ',', x[0])) - f.write(tail) - -def gen_all(src_filename): - src_file = open(src_filename, 'r') - r = [] - for line in src_file: - line = line.strip() - line = re.sub(r'\s*#.*$','', line) - if len(line) == 0: - continue - mo = re.match('"([^"]+)"\s*(0x[0-9a-fA-F]+)', line) - if mo: - str_name = mo.group(1) - id_name = str_name.upper().replace(' ', '_') - id_val = mo.group(2) - r.append((str_name, id_name, id_val)) - #sys.stdout.write('%-16s\t%-16s\t%s\n' % ('"'+str_name+'"', id_name, id_val)) - - gen_dbid_h(r) - gen_dbid_py(r) - gen_dbid_cc(r) - - -def main(): - usage = "usage: %prog [options] usrp_dbid.dat" - parser = OptionParser(usage=usage) - (options, args) = parser.parse_args() - if len(args) != 1: - parser.print_help() - sys.exit(1) - - gen_all(args[0]) - -if __name__ == '__main__': - main() diff --git a/usrp/host/lib/limbo/db_wbx.cc b/usrp/host/lib/limbo/db_wbx.cc deleted file mode 100644 index 9f1d72939..000000000 --- a/usrp/host/lib/limbo/db_wbx.cc +++ /dev/null @@ -1,953 +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 asversion 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 <db_wbx.h> -#include <fpga_regs_standard.h> -#include <fpga_regs_common.h> -#include <usrp_prims.h> -#include <usrp_spi_defs.h> -#include <stdexcept> -#include <cmath> - -// d'board i/o pin defs - -// TX IO Pins -#define TX_POWER (1 << 0) // TX Side Power -#define RX_TXN (1 << 1) // T/R antenna switch for TX/RX port -#define TX_ENB_MIX (1 << 2) // Enable IQ mixer -#define TX_ENB_VGA (1 << 3) - -// RX IO Pins -#define RX2_RX1N (1 << 0) // antenna switch between RX2 and TX/RX port -#define RXENABLE (1 << 1) // enables mixer -#define PLL_LOCK_DETECT (1 << 2) // Muxout pin from PLL -- MUST BE INPUT -#define MReset (1 << 3) // NB6L239 Master Reset, asserted low -#define SELA0 (1 << 4) // NB6L239 SelA0 -#define SELA1 (1 << 5) // NB6L239 SelA1 -#define SELB0 (1 << 6) // NB6L239 SelB0 -#define SELB1 (1 << 7) // NB6L239 SelB1 -#define PLL_ENABLE (1 << 8) // CE Pin on PLL -#define AUX_SCLK (1 << 9) // ALT SPI SCLK -#define AUX_SDO (1 << 10) // ALT SPI SDO -#define AUX_SEN (1 << 11) // ALT SPI SEN - - -wbx_base::wbx_base(usrp_basic_sptr usrp, int which) - : db_base(usrp, which) -{ - /* - * @param usrp: instance of usrp.source_c - * @param which: which side: 0 or 1 corresponding to side A or B respectively - * @type which: int - */ - - d_first = true; - d_spi_format = SPI_FMT_MSB | SPI_FMT_HDR_0; - - // FIXME -- the write reg functions don't work with 0xffff for masks - _rx_write_oe(int(PLL_ENABLE|MReset|SELA0|SELA1|SELB0|SELB1|RX2_RX1N|RXENABLE), 0x7fff); - _rx_write_io((PLL_ENABLE|MReset|0|RXENABLE), (PLL_ENABLE|MReset|RX2_RX1N|RXENABLE)); - - _tx_write_oe((TX_POWER|RX_TXN|TX_ENB_MIX|TX_ENB_VGA), 0x7fff); - _tx_write_io((0|RX_TXN), (TX_POWER|RX_TXN|TX_ENB_MIX|TX_ENB_VGA)); // TX off, TR switch set to RX - - if(d_which == 0) { - d_spi_enable = SPI_ENABLE_RX_A; - } - else { - d_spi_enable = SPI_ENABLE_RX_B; - } - - set_auto_tr(false); - -} - -wbx_base::~wbx_base() -{ - shutdown(); -} - - -void -wbx_base::shutdown() -{ - if (!d_is_shutdown){ - d_is_shutdown = true; - // do whatever there is to do to shutdown - - write_io(d_which, d_power_off, POWER_UP); // turn off power to board - _write_oe(d_which, 0, 0xffff); // turn off all outputs - set_auto_tr(false); // disable auto transmit - } -} - -bool -wbx_base::_lock_detect() -{ - /* - * @returns: the value of the VCO/PLL lock detect bit. - * @rtype: 0 or 1 - */ - - if(_rx_read_io() & PLL_LOCK_DETECT) { - return true; - } - else { // Give it a second chance - if(_rx_read_io() & PLL_LOCK_DETECT) { - return true; - } - else { - return false; - } - } -} - -bool -wbx_base::_tx_write_oe(int value, int mask) -{ - int reg = (d_which == 0 ? FR_OE_0 : FR_OE_2); - return d_usrp->_write_fpga_reg(reg, ((mask & 0xffff) << 16) | (value & 0xffff)); -} - -bool -wbx_base::_rx_write_oe(int value, int mask) -{ - int reg = (d_which == 0 ? FR_OE_1 : FR_OE_3); - return d_usrp->_write_fpga_reg(reg, ((mask & 0xffff) << 16) | (value & 0xffff)); -} - -bool -wbx_base::_tx_write_io(int value, int mask) -{ - int reg = (d_which == 0 ? FR_IO_0 : FR_IO_2); - return d_usrp->_write_fpga_reg(reg, ((mask & 0xffff) << 16) | (value & 0xffff)); -} - -bool -wbx_base::_rx_write_io(int value, int mask) -{ - int reg = (d_which == 0 ? FR_IO_1 : FR_IO_3); - return d_usrp->_write_fpga_reg(reg, ((mask & 0xffff) << 16) | (value & 0xffff)); -} - -bool -wbx_base::_rx_read_io() -{ - int reg = (d_which == 0 ? FR_RB_IO_RX_A_IO_TX_A : FR_RB_IO_RX_B_IO_TX_B); - int t = d_usrp->_read_fpga_reg(reg); - return (t >> 16) & 0xffff; -} - -bool -wbx_base::_tx_read_io() -{ - int reg = (d_which == 0 ? FR_RB_IO_RX_A_IO_TX_A : FR_RB_IO_RX_B_IO_TX_B); - int t = d_usrp->_read_fpga_reg(reg); - return (t & 0xffff); -} - -bool -wbx_base::_compute_regs(double freq) -{ - /* - * Determine values of registers, along with actual freq. - * - * @param freq: target frequency in Hz - * @type freq: double - * @returns: (R, N, func, init, actual_freq) - * @rtype: tuple(int, int, int, int, double) - * - * Override this in derived classes. - */ - throw std::runtime_error("_compute_regs called from base class\n"); -} - -double -wbx_base::_refclk_freq() -{ - return (double)(d_usrp->fpga_master_clock_freq())/_refclk_divisor(); -} - -int -wbx_base::_refclk_divisor() -{ - /* - * Return value to stick in REFCLK_DIVISOR register - */ - return 1; -} - -struct freq_result_t -wbx_base::set_freq(double freq) -{ - /* - * @returns (ok, actual_baseband_freq) where: - * ok is True or False and indicates success or failure, - * actual_baseband_freq is the RF frequency that corresponds to DC in the IF. - */ - throw std::runtime_error("set_freq called from base class\n"); -} - -float -wbx_base::gain_min() -{ - throw std::runtime_error("gain_min called from base class\n"); -} - -float -wbx_base::gain_max() -{ - throw std::runtime_error("gain_max called from base class\n"); -} - -float -wbx_base::gain_db_per_step() -{ - throw std::runtime_error("gain_db_per_step called from base class\n"); -} - -bool -wbx_base::set_gain(float gain) -{ - /* - * Set the gain. - * - * @param gain: gain in decibels - * @returns True/False - */ - throw std::runtime_error("set_gain called from base class\n"); -} - -bool -wbx_base::_set_pga(float pga_gain) -{ - bool ok; - if(d_which == 0) { - ok = d_usrp->set_pga(0, pga_gain); - ok |= d_usrp->set_pga(1, pga_gain); - } - else { - ok = d_usrp->set_pga(2, pga_gain); - ok |= d_usrp->set_pga(3, pga_gain); - } - return ok; -} - -bool -wbx_base::is_quadrature() -{ - /* - * Return True if this board requires both I & Q analog channels. - * - * This bit of info is useful when setting up the USRP Rx mux register. - */ - return true; -} - - -/****************************************************************************/ - - -wbx_base_tx::wbx_base_tx(usrp_basic_sptr usrp, int which) - : wbx_base(usrp, which) -{ - /* - * @param usrp: instance of usrp.sink_c - * @param which: 0 or 1 corresponding to side TX_A or TX_B respectively. - */ - - // power up the transmit side, NO -- but set antenna to receive - d_usrp->write_io(d_which, (TX_POWER), (TX_POWER|RX_TXN)); - d_lo_offset = 0e6; - - // Gain is not set by the PGA, but the PGA must be set at max gain in the TX - _set_pga(d_usrp->pga_max()); -} - -wbx_base_tx::~wbx_base_tx() -{ - // Power down and leave the T/R switch in the R position - d_usrp->write_io(d_which, (RX_TXN), (TX_POWER|RX_TXN|TX_ENB_MIX|TX_ENB_VGA)); -} - -void -wbx_base_tx::set_auto_tr(bool on) -{ - if(on) { - set_atr_mask (RX_TXN); - set_atr_txval(0); - set_atr_rxval(RX_TXN); - } - else { - set_atr_mask (0); - set_atr_txval(0); - set_atr_rxval(0); - } -} - -void -wbx_base_tx::set_enable(bool on) -{ - /* - * Enable transmitter if on is True - */ - - int mask = RX_TXN|TX_ENB_MIX|TX_ENB_VGA; - //printf("HERE!!!!\n"); - if(on) { - d_usrp->write_io(d_which, TX_ENB_MIX|TX_ENB_VGA, mask); - } - else { - d_usrp->write_io(d_which, RX_TXN, mask); - } -} - -void -wbx_base_tx::set_lo_offset(double offset) -{ - /* - * Set amount by which LO is offset from requested tuning frequency. - * - * @param offset: offset in Hz - */ - - d_lo_offset = offset; -} - -double -wbx_base_tx::lo_offset() -{ - /* - * Get amount by which LO is offset from requested tuning frequency. - * - * @returns Offset in Hz - */ - - return d_lo_offset; -} - - -/****************************************************************************/ - - -wbx_base_rx::wbx_base_rx(usrp_basic_sptr usrp, int which) - : wbx_base(usrp, which) -{ - /* - * @param usrp: instance of usrp.source_c - * @param which: 0 or 1 corresponding to side RX_A or RX_B respectively. - */ - - // set up for RX on TX/RX port - select_rx_antenna("TX/RX"); - - bypass_adc_buffers(true); - - d_lo_offset = 0.0; -} - -wbx_base_rx::~wbx_base_rx() -{ - // Power down - d_usrp->write_io(d_which, 0, (RXENABLE)); -} - -void -wbx_base_rx::set_auto_tr(bool on) -{ - if(on) { - // FIXME: where does ENABLE come from? - //set_atr_mask (ENABLE); - set_atr_txval( 0); - //set_atr_rxval(ENABLE); - } - else { - set_atr_mask (0); - set_atr_txval(0); - set_atr_rxval(0); - } -} - -void -wbx_base_rx::select_rx_antenna(int which_antenna) -{ - /* - * Specify which antenna port to use for reception. - * @param which_antenna: either 'TX/RX' or 'RX2' - */ - - if(which_antenna == 0) { - d_usrp->write_io(d_which, 0, RX2_RX1N); - } - else if(which_antenna == 1) { - d_usrp->write_io(d_which, RX2_RX1N, RX2_RX1N); - } - else { - throw std::invalid_argument("which_antenna must be either 'TX/RX' or 'RX2'\n"); - } -} - -void -wbx_base_rx::select_rx_antenna(const std::string &which_antenna) -{ - if(which_antenna == "TX/RX") { - select_rx_antenna(0); - } - else if(which_antenna == "RX2") { - select_rx_antenna(1); - } - else { - throw std::invalid_argument("which_antenna must be either 'TX/RX' or 'RX2'\n"); - } -} - -bool -wbx_base_rx::set_gain(float gain) -{ - /* - * Set the gain. - * - * @param gain: gain in decibels - * @returns True/False - */ - - float pga_gain, agc_gain; - float maxgain = gain_max() - d_usrp->pga_max(); - float mingain = gain_min(); - if(gain > maxgain) { - pga_gain = gain-maxgain; - assert(pga_gain <= d_usrp->pga_max()); - agc_gain = maxgain; - } - else { - pga_gain = 0; - agc_gain = gain; - } - - float V_maxgain = .2; - float V_mingain = 1.2; - float V_fullscale = 3.3; - float dac_value = (agc_gain*(V_maxgain-V_mingain)/(maxgain-mingain) + V_mingain)*4096/V_fullscale; - - assert(dac_value>=0 && dac_value<4096); - - return d_usrp->write_aux_dac(d_which, 0, (int)(dac_value)) && _set_pga((int)(pga_gain)); -} - -void -wbx_base_rx::set_lo_offset(double offset) -{ - /* - * Set amount by which LO is offset from requested tuning frequency. - * - * @param offset: offset in Hz - */ - d_lo_offset = offset; -} - -double -wbx_base_rx::lo_offset() -{ - /* - * Get amount by which LO is offset from requested tuning frequency. - * - * @returns Offset in Hz - */ - return d_lo_offset; -} - -bool -wbx_base_rx::i_and_q_swapped() -{ - /* - * Return True if this is a quadrature device and ADC 0 is Q. - */ - return false; -} - - -/****************************************************************************/ - -_ADF410X_common::_ADF410X_common() -{ - // R-Register Common Values - d_R_RSV = 0; // bits 23,22,21 - d_LDP = 1; // bit 20 Lock detect in 5 cycles - d_TEST = 0; // bit 19,18 Normal - d_ABP = 0; // bit 17,16 2.9ns - - // N-Register Common Values - d_N_RSV = 0; // 23,22 - d_CP_GAIN = 0; // 21 - - // Function Register Common Values - d_P = 0; // bits 23,22 0 = 8/9, 1 = 16/17, 2 = 32/33, 3 = 64/65 - d_PD2 = 0; // bit 21 Normal operation - d_CP2 = 4; // bits 20,19,18 CP Gain = 5mA - d_CP1 = 4; // bits 17,16,15 CP Gain = 5mA - d_TC = 0; // bits 14-11 PFD Timeout - d_FL = 0; // bit 10,9 Fastlock Disabled - d_CP3S = 0; // bit 8 CP Enabled - d_PDP = 0; // bit 7 Phase detector polarity, Positive=1 - d_MUXOUT = 1; // bits 6:4 Digital Lock Detect - d_PD1 = 0; // bit 3 Normal operation - d_CR = 0; // bit 2 Normal operation -} - -_ADF410X_common::~_ADF410X_common() -{ -} - -bool -_ADF410X_common::_compute_regs(double freq, int &retR, int &retcontrol, - int &retN, double &retfreq) -{ - /* - * Determine values of R, control, and N registers, along with actual freq. - * - * @param freq: target frequency in Hz - * @type freq: double - * @returns: (R, N, control, actual_freq) - * @rtype: tuple(int, int, int, double) - */ - - // Band-specific N-Register Values - double phdet_freq = _refclk_freq()/d_R_DIV; - printf("phdet_freq = %f\n", phdet_freq); - - double desired_n = round(freq*d_freq_mult/phdet_freq); - printf("desired_n %f\n", desired_n); - - double actual_freq = desired_n * phdet_freq; - printf("actual freq %f\n", actual_freq); - - double B = floor(desired_n/_prescaler()); - double A = desired_n - _prescaler()*B; - printf("A %f B %f\n", A, B); - - d_B_DIV = int(B); // bits 20:8; - d_A_DIV = int(A); // bit 6:2; - - if(d_B_DIV < d_A_DIV) { - retR = 0; - retN = 0; - retcontrol = 0; - retfreq = 0; - return false; - } - - retR = (d_R_RSV<<21) | (d_LDP<<20) | (d_TEST<<18) | - (d_ABP<<16) | (d_R_DIV<<2); - - retN = (d_N_RSV<<22) | (d_CP_GAIN<<21) | (d_B_DIV<<8) | (d_A_DIV<<2); - - retcontrol = (d_P<<22) | (d_PD2<<21) | (d_CP2<<18) | (d_CP1<<15) | - (d_TC<<11) | (d_FL<<9) | (d_CP3S<<8) | (d_PDP<<7) | - (d_MUXOUT<<4) | (d_PD1<<3) | (d_CR<<2); - - retfreq = actual_freq/d_freq_mult; - - return true; -} - -void -_ADF410X_common::_write_all(int R, int N, int control) -{ - /* - * Write all PLL registers: - * R counter latch, - * N counter latch, - * Function latch, - * Initialization latch - * - * Adds 10ms delay between writing control and N if this is first call. - * This is the required power-up sequence. - * - * @param R: 24-bit R counter latch - * @type R: int - * @param N: 24-bit N counter latch - * @type N: int - * @param control: 24-bit control latch - * @type control: int - */ - static bool first = true; - - timespec t; - t.tv_sec = 0; - t.tv_nsec = 10000000; - - _write_R(R); - _write_func(control); - _write_init(control); - if(first) { - //time.sleep(0.010); - nanosleep(&t, NULL); - first = false; - } - _write_N(N); -} - -void -_ADF410X_common::_write_R(int R) -{ - _write_it((R & ~0x3) | 0); -} - -void -_ADF410X_common::_write_N(int N) -{ - _write_it((N & ~0x3) | 1); -} - -void -_ADF410X_common::_write_func(int func) -{ - _write_it((func & ~0x3) | 2); -} - -void -_ADF410X_common::_write_init(int init) -{ - _write_it((init & ~0x3) | 3); -} - -void -_ADF410X_common::_write_it(int v) -{ - char c[3]; - c[0] = (char)((v >> 16) & 0xff); - c[1] = (char)((v >> 8) & 0xff); - c[2] = (char)((v & 0xff)); - std::string s(c, 3); - //d_usrp->_write_spi(0, d_spi_enable, d_spi_format, s); - usrp()->_write_spi(0, d_spi_enable, d_spi_format, s); -} - -int -_ADF410X_common::_prescaler() -{ - if(d_P == 0) { - return 8; - } - else if(d_P == 1) { - return 16; - } - else if(d_P == 2) { - return 32; - } - else if(d_P == 3) { - return 64; - } - else { - throw std::invalid_argument("Prescaler out of range\n"); - } -} - -double -_ADF410X_common::_refclk_freq() -{ - throw std::runtime_error("_refclk_freq called from base class."); -} - -bool -_ADF410X_common::_rx_write_io(int value, int mask) -{ - throw std::runtime_error("_rx_write_io called from base class."); -} - -bool -_ADF410X_common::_lock_detect() -{ - throw std::runtime_error("_lock_detect called from base class."); -} - -usrp_basic* -_ADF410X_common::usrp() -{ - throw std::runtime_error("usrp() called from base class."); -} - - -/****************************************************************************/ - - -_lo_common::_lo_common() - : _ADF410X_common() -{ - // Band-specific R-Register Values - d_R_DIV = 4; // bits 15:2 - - // Band-specific C-Register values - d_P = 0; // bits 23,22 0 = Div by 8/9 - d_CP2 = 4; // bits 19:17 - d_CP1 = 4; // bits 16:14 - - // Band specifc N-Register Values - d_DIVSEL = 0; // bit 23 - d_DIV2 = 0; // bit 22 - d_CPGAIN = 0; // bit 21 - d_freq_mult = 1; - - d_div = 1; - d_aux_div = 2; - d_main_div = 0; -} - -_lo_common::~_lo_common() -{ -} - -double -_lo_common::freq_min() -{ - return 50e6; -} - -double -_lo_common::freq_max() -{ - return 1000e6; -} - -void -_lo_common::set_divider(int main_or_aux, int divisor) -{ - if(main_or_aux == 0) { - if((divisor != 1) || (divisor != 2) || (divisor != 4) || (divisor != 8)) { - throw std::invalid_argument("Main Divider Must be 1, 2, 4, or 8\n"); - } - d_main_div = (int)(log10(divisor)/log10(2.0)); - } - else if(main_or_aux == 1) { - if((divisor != 2) || (divisor != 4) || (divisor != 8) || (divisor != 16)) { - throw std::invalid_argument("Aux Divider Must be 2, 4, 8 or 16\n"); - } - d_main_div = (int)(log10(divisor/2.0)/log10(2.0)); - } - else { - throw std::invalid_argument("main_or_aux must be 'main' or 'aux'\n"); - } - - int vala = d_main_div*SELA0; - int valb = d_aux_div*SELB0; - int mask = SELA0|SELA1|SELB0|SELB1; - - _rx_write_io((vala | valb), mask); -} - -void -_lo_common::set_divider(const std::string &main_or_aux, int divisor) -{ - if(main_or_aux == "main") { - set_divider(0, divisor); - } - else if(main_or_aux == "aux") { - set_divider(1, divisor); - } - else { - throw std::invalid_argument("main_or_aux must be 'main' or 'aux'\n"); - } -} - -struct freq_result_t -_lo_common::set_freq(double freq) -{ - struct freq_result_t ret; - - if(freq < 20e6 or freq > 1200e6) { - throw std::invalid_argument("Requested frequency out of range\n"); - } - - int div = 1; - double lo_freq = freq * 2; - while((lo_freq < 1e9) && (div < 8)) { - div = div * 2; - lo_freq = lo_freq * 2; - } - - printf("For RF freq of %f, we set DIV=%d and LO Freq=%f\n", freq, div, lo_freq); - - set_divider("main", div); - set_divider("aux", div*2); - - int R, N, control; - double actual_freq; - _compute_regs(lo_freq, R, N, control, actual_freq); - - printf("R %d N %d control %d actual freq %f\n", R, N, control, actual_freq); - if(R==0) { - ret.ok = false; - ret.baseband_freq = 0.0; - return ret; - } - _write_all(R, N, control); - - ret.ok = _lock_detect(); - ret.baseband_freq = actual_freq/div/2; - return ret; -} - - -/****************************************************************************/ - - -db_wbx_lo_tx::db_wbx_lo_tx(usrp_basic_sptr usrp, int which) - : _lo_common(), - wbx_base_tx(usrp, which) -{ -} - -db_wbx_lo_tx::~db_wbx_lo_tx() -{ -} - -float -db_wbx_lo_tx::gain_min() -{ - return -56.0; -} - -float -db_wbx_lo_tx::gain_max() -{ - return 0.0; -} - -float -db_wbx_lo_tx::gain_db_per_step() -{ - return 0.1; -} - -bool -db_wbx_lo_tx::set_gain(float gain) -{ - /* - * Set the gain. - * - * @param gain: gain in decibels - * @returns True/False - */ - - float txvga_gain; - float maxgain = gain_max(); - float mingain = gain_min(); - if(gain > maxgain) { - txvga_gain = maxgain; - } - else if(gain < mingain) { - txvga_gain = mingain; - } - else { - txvga_gain = gain; - } - - float V_maxgain = 1.4; - float V_mingain = 0.1; - float V_fullscale = 3.3; - float dac_value = ((txvga_gain-mingain)*(V_maxgain-V_mingain)/ - (maxgain-mingain) + V_mingain)*4096/V_fullscale; - - assert(dac_value>=0 && dac_value<4096); - printf("DAC value %f\n", dac_value); - - return d_usrp->write_aux_dac(d_which, 1, (int)(dac_value)); -} - -double -db_wbx_lo_tx::_refclk_freq() -{ - return wbx_base::_refclk_freq(); -} - -bool -db_wbx_lo_tx::_rx_write_io(int value, int mask) -{ - return wbx_base::_rx_write_io(value, mask); -} - -bool -db_wbx_lo_tx::_lock_detect() -{ - return wbx_base::_lock_detect(); -} - -usrp_basic* -db_wbx_lo_tx::usrp() -{ - return d_usrp; -} - - -/****************************************************************************/ - - -db_wbx_lo_rx::db_wbx_lo_rx(usrp_basic_sptr usrp, int which) - : _lo_common(), - wbx_base_rx(usrp, which) -{ -} - -db_wbx_lo_rx::~db_wbx_lo_rx() -{ -} - -float -db_wbx_lo_rx::gain_min() -{ - return d_usrp->pga_min(); -} - -float -db_wbx_lo_rx::gain_max() -{ - return d_usrp->pga_max() + 45; -} - -float -db_wbx_lo_rx::gain_db_per_step() -{ - return 0.05; -} - -double -db_wbx_lo_rx::_refclk_freq() -{ - return wbx_base::_refclk_freq(); -} - -bool -db_wbx_lo_rx::_rx_write_io(int value, int mask) -{ - return wbx_base::_rx_write_io(value, mask); -} - -bool -db_wbx_lo_rx::_lock_detect() -{ - return wbx_base::_lock_detect(); -} - -usrp_basic* -db_wbx_lo_rx::usrp() -{ - return d_usrp; -} diff --git a/usrp/host/lib/limbo/db_wbx.h b/usrp/host/lib/limbo/db_wbx.h deleted file mode 100644 index 3202d368c..000000000 --- a/usrp/host/lib/limbo/db_wbx.h +++ /dev/null @@ -1,221 +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 asversion 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 DB_WBX_H -#define DB_WBX_H - -#include <db_base.h> -#include <boost/shared_ptr.hpp> - - -/* - A few comments about the WBX boards: - They are half-duplex. I.e., transmit and receive are mutually exclusive. - There is a single LO for both the Tx and Rx sides. - The the shared control signals are hung off of the Rx side. - The shared io controls are duplexed onto the Rx side pins. - The wbx_high d'board always needs to be in 'auto_tr_mode' -*/ - - -class wbx_base : public db_base -{ -protected: - void shutdown(); - - /* - * Abstract base class for all wbx boards. - * - * Derive board specific subclasses from db_wbx_base_{tx,rx} - */ - -public: - wbx_base(usrp_basic_sptr usrp, int which); - ~wbx_base(); - - struct freq_result_t set_freq(double freq); - float gain_min(); - float gain_max(); - float gain_db_per_step(); - bool set_gain(float gain); - bool is_quadrature(); - - -protected: - virtual bool _lock_detect(); - - // FIXME: After testing, replace these with usrp_basic::common_write_io/oe - bool _tx_write_oe(int value, int mask); - bool _rx_write_oe(int value, int mask); - bool _tx_write_io(int value, int mask); - bool _rx_write_io(int value, int mask); - virtual bool _rx_read_io(); - bool _tx_read_io(); - bool _compute_regs(double freq); - virtual double _refclk_freq(); - int _refclk_divisor(); - - bool _set_pga(float pga_gain); - - bool d_first; - int d_spi_format; - int d_spi_enable; - double d_lo_offset; -}; - - -/****************************************************************************/ - - -class wbx_base_tx : public wbx_base -{ -public: - wbx_base_tx(usrp_basic_sptr usrp, int which); - ~wbx_base_tx(); - - bool set_auto_tr(bool on); - bool set_enable(bool on); -}; - - -/****************************************************************************/ - - -class wbx_base_rx : public wbx_base -{ -public: - wbx_base_rx(usrp_basic_sptr usrp, int which); - ~wbx_base_rx(); - - bool set_auto_tr(bool on); - bool select_rx_antenna(int which_antenna); - bool select_rx_antenna(const std::string &which_antenna); - bool set_gain(float gain); - bool i_and_q_swapped(); -}; - - -/****************************************************************************/ - - -class _ADF410X_common -{ -public: - _ADF410X_common(); - virtual ~_ADF410X_common(); - - bool _compute_regs(double freq, int &retR, int &retcontrol, - int &retN, double &retfreq); - void _write_all(int R, int N, int control); - void _write_R(int R); - void _write_N(int N); - void _write_func(int func); - void _write_init(int init); - int _prescaler(); - virtual void _write_it(int v); - virtual double _refclk_freq(); - virtual bool _rx_write_io(int value, int mask); - virtual bool _lock_detect(); - -protected: - virtual usrp_basic* usrp(); - - int d_R_RSV, d_LDP, d_TEST, d_ABP; - int d_N_RSV, d_CP_GAIN; - int d_P, d_PD2, d_CP2, d_CP1, d_TC, d_FL; - int d_CP3S, d_PDP, d_MUXOUT, d_PD1, d_CR; - int d_R_DIV, d_A_DIV, d_B_DIV; - int d_freq_mult; - - int d_spi_format; - int d_spi_enable; -}; - - -/****************************************************************************/ - - -class _lo_common : public _ADF410X_common -{ -public: - _lo_common(); - ~_lo_common(); - - double freq_min(); - double freq_max(); - - void set_divider(int main_or_aux, int divisor); - void set_divider(const std::string &main_or_aux, int divisor); - - struct freq_result_t set_freq(double freq); - -protected: - int d_R_DIV, d_P, d_CP2, d_CP1; - int d_DIVSEL, d_DIV2, d_CPGAIN; - int d_div, d_aux_div, d_main_div; -}; - - -/****************************************************************************/ - - -class db_wbx_lo_tx : public _lo_common, public wbx_base_tx -{ -public: - db_wbx_lo_tx(usrp_basic_sptr usrp, int which); - ~db_wbx_lo_tx(); - - float gain_min(); - float gain_max(); - float gain_db_per_step(); - bool set_gain(float gain); - - double _refclk_freq(); - bool _rx_write_io(int value, int mask); - bool _lock_detect(); - -protected: - usrp_basic* usrp(); -}; - - -/****************************************************************************/ - - -class db_wbx_lo_rx : public _lo_common, public wbx_base_rx -{ -public: - db_wbx_lo_rx(usrp_basic_sptr usrp, int which); - ~db_wbx_lo_rx(); - - float gain_min(); - float gain_max(); - float gain_db_per_step(); - - double _refclk_freq(); - bool _rx_write_io(int value, int mask); - bool _lock_detect(); - -protected: - usrp_basic* usrp(); -}; - -#endif diff --git a/usrp/host/lib/md5.c b/usrp/host/lib/md5.c deleted file mode 100644 index b15ab390f..000000000 --- a/usrp/host/lib/md5.c +++ /dev/null @@ -1,452 +0,0 @@ -/* md5.c - Functions to compute MD5 message digest of files or memory blocks - according to the definition of MD5 in RFC 1321 from April 1992. - Copyright (C) 1995, 1996, 2001, 2003 Free Software Foundation, Inc. - NOTE: The canonical source of this file is maintained with the GNU C - Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu. - - This program 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. - - This program 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, Boston, MA 02110-1301, USA. */ - -/* Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include "md5.h" - -#include <sys/types.h> - -#include <stdlib.h> -#include <string.h> - -// #include "unlocked-io.h" - -#ifdef _LIBC -# include <endian.h> -# if __BYTE_ORDER == __BIG_ENDIAN -# define WORDS_BIGENDIAN 1 -# endif -/* We need to keep the namespace clean so define the MD5 function - protected using leading __ . */ -# define md5_init_ctx __md5_init_ctx -# define md5_process_block __md5_process_block -# define md5_process_bytes __md5_process_bytes -# define md5_finish_ctx __md5_finish_ctx -# define md5_read_ctx __md5_read_ctx -# define md5_stream __md5_stream -# define md5_buffer __md5_buffer -#endif - -#ifdef WORDS_BIGENDIAN -# define SWAP(n) \ - (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24)) -#else -# define SWAP(n) (n) -#endif - -#define BLOCKSIZE 4096 -/* Ensure that BLOCKSIZE is a multiple of 64. */ -#if BLOCKSIZE % 64 != 0 -/* FIXME-someday (soon?): use #error instead of this kludge. */ -"invalid BLOCKSIZE" -#endif - -/* This array contains the bytes used to pad the buffer to the next - 64-byte boundary. (RFC 1321, 3.1: Step 1) */ -static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ }; - - -/* Initialize structure containing state of computation. - (RFC 1321, 3.3: Step 3) */ -void -md5_init_ctx (struct md5_ctx *ctx) -{ - ctx->A = 0x67452301; - ctx->B = 0xefcdab89; - ctx->C = 0x98badcfe; - ctx->D = 0x10325476; - - ctx->total[0] = ctx->total[1] = 0; - ctx->buflen = 0; -} - -/* Put result from CTX in first 16 bytes following RESBUF. The result - must be in little endian byte order. - - IMPORTANT: On some systems it is required that RESBUF is correctly - aligned for a 32 bits value. */ -void * -md5_read_ctx (const struct md5_ctx *ctx, void *resbuf) -{ - ((md5_uint32 *) resbuf)[0] = SWAP (ctx->A); - ((md5_uint32 *) resbuf)[1] = SWAP (ctx->B); - ((md5_uint32 *) resbuf)[2] = SWAP (ctx->C); - ((md5_uint32 *) resbuf)[3] = SWAP (ctx->D); - - return resbuf; -} - -/* Process the remaining bytes in the internal buffer and the usual - prolog according to the standard and write the result to RESBUF. - - IMPORTANT: On some systems it is required that RESBUF is correctly - aligned for a 32 bits value. */ -void * -md5_finish_ctx (struct md5_ctx *ctx, void *resbuf) -{ - /* Take yet unprocessed bytes into account. */ - md5_uint32 bytes = ctx->buflen; - size_t pad; - - /* Now count remaining bytes. */ - ctx->total[0] += bytes; - if (ctx->total[0] < bytes) - ++ctx->total[1]; - - pad = bytes >= 56 ? 64 + 56 - bytes : 56 - bytes; - memcpy (&ctx->buffer[bytes], fillbuf, pad); - - /* Put the 64-bit file length in *bits* at the end of the buffer. */ - *(md5_uint32 *) &ctx->buffer[bytes + pad] = SWAP (ctx->total[0] << 3); - *(md5_uint32 *) &ctx->buffer[bytes + pad + 4] = SWAP ((ctx->total[1] << 3) | - (ctx->total[0] >> 29)); - - /* Process last bytes. */ - md5_process_block (ctx->buffer, bytes + pad + 8, ctx); - - return md5_read_ctx (ctx, resbuf); -} - -/* Compute MD5 message digest for bytes read from STREAM. The - resulting message digest number will be written into the 16 bytes - beginning at RESBLOCK. */ -int -md5_stream (FILE *stream, void *resblock) -{ - struct md5_ctx ctx; - char buffer[BLOCKSIZE + 72]; - size_t sum; - - /* Initialize the computation context. */ - md5_init_ctx (&ctx); - - /* Iterate over full file contents. */ - while (1) - { - /* We read the file in blocks of BLOCKSIZE bytes. One call of the - computation function processes the whole buffer so that with the - next round of the loop another block can be read. */ - size_t n; - sum = 0; - - /* Read block. Take care for partial reads. */ - while (1) - { - n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream); - - sum += n; - - if (sum == BLOCKSIZE) - break; - - if (n == 0) - { - /* Check for the error flag IFF N == 0, so that we don't - exit the loop after a partial read due to e.g., EAGAIN - or EWOULDBLOCK. */ - if (ferror (stream)) - return 1; - goto process_partial_block; - } - - /* We've read at least one byte, so ignore errors. But always - check for EOF, since feof may be true even though N > 0. - Otherwise, we could end up calling fread after EOF. */ - if (feof (stream)) - goto process_partial_block; - } - - /* Process buffer with BLOCKSIZE bytes. Note that - BLOCKSIZE % 64 == 0 - */ - md5_process_block (buffer, BLOCKSIZE, &ctx); - } - - process_partial_block:; - - /* Process any remaining bytes. */ - if (sum > 0) - md5_process_bytes (buffer, sum, &ctx); - - /* Construct result in desired memory. */ - md5_finish_ctx (&ctx, resblock); - return 0; -} - -/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The - result is always in little endian byte order, so that a byte-wise - output yields to the wanted ASCII representation of the message - digest. */ -void * -md5_buffer (const char *buffer, size_t len, void *resblock) -{ - struct md5_ctx ctx; - - /* Initialize the computation context. */ - md5_init_ctx (&ctx); - - /* Process whole buffer but last len % 64 bytes. */ - md5_process_bytes (buffer, len, &ctx); - - /* Put result in desired memory area. */ - return md5_finish_ctx (&ctx, resblock); -} - - -void -md5_process_bytes (const void *buffer, size_t len, struct md5_ctx *ctx) -{ - /* When we already have some bits in our internal buffer concatenate - both inputs first. */ - if (ctx->buflen != 0) - { - size_t left_over = ctx->buflen; - size_t add = 128 - left_over > len ? len : 128 - left_over; - - memcpy (&ctx->buffer[left_over], buffer, add); - ctx->buflen += add; - - if (ctx->buflen > 64) - { - md5_process_block (ctx->buffer, ctx->buflen & ~63, ctx); - - ctx->buflen &= 63; - /* The regions in the following copy operation cannot overlap. */ - memcpy (ctx->buffer, &ctx->buffer[(left_over + add) & ~63], - ctx->buflen); - } - - buffer = (const char *) buffer + add; - len -= add; - } - - /* Process available complete blocks. */ - if (len >= 64) - { -#if !_STRING_ARCH_unaligned -/* To check alignment gcc has an appropriate operator. Other - compilers don't. */ -# if __GNUC__ >= 2 -# define UNALIGNED_P(p) (((md5_uintptr) p) % __alignof__ (md5_uint32) != 0) -# else -# define UNALIGNED_P(p) (((md5_uintptr) p) % sizeof (md5_uint32) != 0) -# endif - if (UNALIGNED_P (buffer)) - while (len > 64) - { - md5_process_block (memcpy (ctx->buffer, buffer, 64), 64, ctx); - buffer = (const char *) buffer + 64; - len -= 64; - } - else -#endif - { - md5_process_block (buffer, len & ~63, ctx); - buffer = (const char *) buffer + (len & ~63); - len &= 63; - } - } - - /* Move remaining bytes in internal buffer. */ - if (len > 0) - { - size_t left_over = ctx->buflen; - - memcpy (&ctx->buffer[left_over], buffer, len); - left_over += len; - if (left_over >= 64) - { - md5_process_block (ctx->buffer, 64, ctx); - left_over -= 64; - memcpy (ctx->buffer, &ctx->buffer[64], left_over); - } - ctx->buflen = left_over; - } -} - - -/* These are the four functions used in the four steps of the MD5 algorithm - and defined in the RFC 1321. The first function is a little bit optimized - (as found in Colin Plumbs public domain implementation). */ -/* #define FF(b, c, d) ((b & c) | (~b & d)) */ -#define FF(b, c, d) (d ^ (b & (c ^ d))) -#define FG(b, c, d) FF (d, b, c) -#define FH(b, c, d) (b ^ c ^ d) -#define FI(b, c, d) (c ^ (b | ~d)) - -/* Process LEN bytes of BUFFER, accumulating context into CTX. - It is assumed that LEN % 64 == 0. */ - -void -md5_process_block (const void *buffer, size_t len, struct md5_ctx *ctx) -{ - md5_uint32 correct_words[16]; - const md5_uint32 *words = buffer; - size_t nwords = len / sizeof (md5_uint32); - const md5_uint32 *endp = words + nwords; - md5_uint32 A = ctx->A; - md5_uint32 B = ctx->B; - md5_uint32 C = ctx->C; - md5_uint32 D = ctx->D; - - /* First increment the byte count. RFC 1321 specifies the possible - length of the file up to 2^64 bits. Here we only compute the - number of bytes. Do a double word increment. */ - ctx->total[0] += len; - if (ctx->total[0] < len) - ++ctx->total[1]; - - /* Process all bytes in the buffer with 64 bytes in each round of - the loop. */ - while (words < endp) - { - md5_uint32 *cwp = correct_words; - md5_uint32 A_save = A; - md5_uint32 B_save = B; - md5_uint32 C_save = C; - md5_uint32 D_save = D; - - /* First round: using the given function, the context and a constant - the next context is computed. Because the algorithms processing - unit is a 32-bit word and it is determined to work on words in - little endian byte order we perhaps have to change the byte order - before the computation. To reduce the work for the next steps - we store the swapped words in the array CORRECT_WORDS. */ - -#define OP(a, b, c, d, s, T) \ - do \ - { \ - a += FF (b, c, d) + (*cwp++ = SWAP (*words)) + T; \ - ++words; \ - a = rol (a, s); \ - a += b; \ - } \ - while (0) - - /* Before we start, one word to the strange constants. - They are defined in RFC 1321 as - - T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64, or - perl -e 'foreach(1..64){printf "0x%08x\n", int (4294967296 * abs (sin $_))}' - */ - - /* Round 1. */ - OP (A, B, C, D, 7, 0xd76aa478); - OP (D, A, B, C, 12, 0xe8c7b756); - OP (C, D, A, B, 17, 0x242070db); - OP (B, C, D, A, 22, 0xc1bdceee); - OP (A, B, C, D, 7, 0xf57c0faf); - OP (D, A, B, C, 12, 0x4787c62a); - OP (C, D, A, B, 17, 0xa8304613); - OP (B, C, D, A, 22, 0xfd469501); - OP (A, B, C, D, 7, 0x698098d8); - OP (D, A, B, C, 12, 0x8b44f7af); - OP (C, D, A, B, 17, 0xffff5bb1); - OP (B, C, D, A, 22, 0x895cd7be); - OP (A, B, C, D, 7, 0x6b901122); - OP (D, A, B, C, 12, 0xfd987193); - OP (C, D, A, B, 17, 0xa679438e); - OP (B, C, D, A, 22, 0x49b40821); - - /* For the second to fourth round we have the possibly swapped words - in CORRECT_WORDS. Redefine the macro to take an additional first - argument specifying the function to use. */ -#undef OP -#define OP(f, a, b, c, d, k, s, T) \ - do \ - { \ - a += f (b, c, d) + correct_words[k] + T; \ - a = rol (a, s); \ - a += b; \ - } \ - while (0) - - /* Round 2. */ - OP (FG, A, B, C, D, 1, 5, 0xf61e2562); - OP (FG, D, A, B, C, 6, 9, 0xc040b340); - OP (FG, C, D, A, B, 11, 14, 0x265e5a51); - OP (FG, B, C, D, A, 0, 20, 0xe9b6c7aa); - OP (FG, A, B, C, D, 5, 5, 0xd62f105d); - OP (FG, D, A, B, C, 10, 9, 0x02441453); - OP (FG, C, D, A, B, 15, 14, 0xd8a1e681); - OP (FG, B, C, D, A, 4, 20, 0xe7d3fbc8); - OP (FG, A, B, C, D, 9, 5, 0x21e1cde6); - OP (FG, D, A, B, C, 14, 9, 0xc33707d6); - OP (FG, C, D, A, B, 3, 14, 0xf4d50d87); - OP (FG, B, C, D, A, 8, 20, 0x455a14ed); - OP (FG, A, B, C, D, 13, 5, 0xa9e3e905); - OP (FG, D, A, B, C, 2, 9, 0xfcefa3f8); - OP (FG, C, D, A, B, 7, 14, 0x676f02d9); - OP (FG, B, C, D, A, 12, 20, 0x8d2a4c8a); - - /* Round 3. */ - OP (FH, A, B, C, D, 5, 4, 0xfffa3942); - OP (FH, D, A, B, C, 8, 11, 0x8771f681); - OP (FH, C, D, A, B, 11, 16, 0x6d9d6122); - OP (FH, B, C, D, A, 14, 23, 0xfde5380c); - OP (FH, A, B, C, D, 1, 4, 0xa4beea44); - OP (FH, D, A, B, C, 4, 11, 0x4bdecfa9); - OP (FH, C, D, A, B, 7, 16, 0xf6bb4b60); - OP (FH, B, C, D, A, 10, 23, 0xbebfbc70); - OP (FH, A, B, C, D, 13, 4, 0x289b7ec6); - OP (FH, D, A, B, C, 0, 11, 0xeaa127fa); - OP (FH, C, D, A, B, 3, 16, 0xd4ef3085); - OP (FH, B, C, D, A, 6, 23, 0x04881d05); - OP (FH, A, B, C, D, 9, 4, 0xd9d4d039); - OP (FH, D, A, B, C, 12, 11, 0xe6db99e5); - OP (FH, C, D, A, B, 15, 16, 0x1fa27cf8); - OP (FH, B, C, D, A, 2, 23, 0xc4ac5665); - - /* Round 4. */ - OP (FI, A, B, C, D, 0, 6, 0xf4292244); - OP (FI, D, A, B, C, 7, 10, 0x432aff97); - OP (FI, C, D, A, B, 14, 15, 0xab9423a7); - OP (FI, B, C, D, A, 5, 21, 0xfc93a039); - OP (FI, A, B, C, D, 12, 6, 0x655b59c3); - OP (FI, D, A, B, C, 3, 10, 0x8f0ccc92); - OP (FI, C, D, A, B, 10, 15, 0xffeff47d); - OP (FI, B, C, D, A, 1, 21, 0x85845dd1); - OP (FI, A, B, C, D, 8, 6, 0x6fa87e4f); - OP (FI, D, A, B, C, 15, 10, 0xfe2ce6e0); - OP (FI, C, D, A, B, 6, 15, 0xa3014314); - OP (FI, B, C, D, A, 13, 21, 0x4e0811a1); - OP (FI, A, B, C, D, 4, 6, 0xf7537e82); - OP (FI, D, A, B, C, 11, 10, 0xbd3af235); - OP (FI, C, D, A, B, 2, 15, 0x2ad7d2bb); - OP (FI, B, C, D, A, 9, 21, 0xeb86d391); - - /* Add the starting values of the context. */ - A += A_save; - B += B_save; - C += C_save; - D += D_save; - } - - /* Put checksum in context given as argument. */ - ctx->A = A; - ctx->B = B; - ctx->C = C; - ctx->D = D; -} diff --git a/usrp/host/lib/md5.h b/usrp/host/lib/md5.h deleted file mode 100644 index 4a4e790c1..000000000 --- a/usrp/host/lib/md5.h +++ /dev/null @@ -1,129 +0,0 @@ -/* md5.h - Declaration of functions and data types used for MD5 sum - computing library functions. - Copyright (C) 1995, 1996, 1999, 2000, 2003 Free Software Foundation, Inc. - NOTE: The canonical source of this file is maintained with the GNU C - Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu. - - This program 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. - - This program 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, Boston, MA 02110-1301, USA. */ - -#ifndef _MD5_H -#define _MD5_H 1 - -#include <stdio.h> -#include <limits.h> - -/* The following contortions are an attempt to use the C preprocessor - to determine an unsigned integral type that is 32 bits wide. An - alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but - doing that would require that the configure script compile and *run* - the resulting executable. Locally running cross-compiled executables - is usually not possible. */ - -#ifdef _LIBC -# include <stdint.h> -typedef uint32_t md5_uint32; -typedef uintptr_t md5_uintptr; -#else -# define UINT_MAX_32_BITS 4294967295U - -# if UINT_MAX == UINT_MAX_32_BITS - typedef unsigned int md5_uint32; -# else -# if USHRT_MAX == UINT_MAX_32_BITS - typedef unsigned short md5_uint32; -# else -# if ULONG_MAX == UINT_MAX_32_BITS - typedef unsigned long md5_uint32; -# else - /* The following line is intended to evoke an error. - Using #error is not portable enough. */ - "Cannot determine unsigned 32-bit data type." -# endif -# endif -# endif -/* We have to make a guess about the integer type equivalent in size - to pointers which should always be correct. */ -typedef unsigned long int md5_uintptr; -#endif - -/* Structure to save state of computation between the single steps. */ -struct md5_ctx -{ - md5_uint32 A; - md5_uint32 B; - md5_uint32 C; - md5_uint32 D; - - md5_uint32 total[2]; - md5_uint32 buflen; - char buffer[128]; -}; - -/* - * The following three functions are build up the low level used in - * the functions `md5_stream' and `md5_buffer'. - */ - -/* Initialize structure containing state of computation. - (RFC 1321, 3.3: Step 3) */ -extern void md5_init_ctx (struct md5_ctx *ctx); - -/* Starting with the result of former calls of this function (or the - initialization function update the context for the next LEN bytes - starting at BUFFER. - It is necessary that LEN is a multiple of 64!!! */ -extern void md5_process_block (const void *buffer, size_t len, - struct md5_ctx *ctx); - -/* Starting with the result of former calls of this function (or the - initialization function update the context for the next LEN bytes - starting at BUFFER. - It is NOT required that LEN is a multiple of 64. */ -extern void md5_process_bytes (const void *buffer, size_t len, - struct md5_ctx *ctx); - -/* Process the remaining bytes in the buffer and put result from CTX - in first 16 bytes following RESBUF. The result is always in little - endian byte order, so that a byte-wise output yields to the wanted - ASCII representation of the message digest. - - IMPORTANT: On some systems it is required that RESBUF be correctly - aligned for a 32 bits value. */ -extern void *md5_finish_ctx (struct md5_ctx *ctx, void *resbuf); - - -/* Put result from CTX in first 16 bytes following RESBUF. The result is - always in little endian byte order, so that a byte-wise output yields - to the wanted ASCII representation of the message digest. - - IMPORTANT: On some systems it is required that RESBUF is correctly - aligned for a 32 bits value. */ -extern void *md5_read_ctx (const struct md5_ctx *ctx, void *resbuf); - - -/* Compute MD5 message digest for bytes read from STREAM. The - resulting message digest number will be written into the 16 bytes - beginning at RESBLOCK. */ -extern int md5_stream (FILE *stream, void *resblock); - -/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The - result is always in little endian byte order, so that a byte-wise - output yields to the wanted ASCII representation of the message - digest. */ -extern void *md5_buffer (const char *buffer, size_t len, void *resblock); - -#define rol(x,n) ( ((x) << (n)) | ((x) >> (32-(n))) ) - -#endif diff --git a/usrp/host/lib/rate_to_regval.h b/usrp/host/lib/rate_to_regval.h deleted file mode 100644 index 1ffdc0f69..000000000 --- a/usrp/host/lib/rate_to_regval.h +++ /dev/null @@ -1,97 +0,0 @@ - { 1, 0x00 }, - { 2, 0x01 }, - { 3, 0x02 }, - { 4, 0x11 }, - { 5, 0x04 }, - { 6, 0x05 }, - { 7, 0x06 }, - { 8, 0x13 }, - { 9, 0x08 }, - { 10, 0x09 }, - { 11, 0x0a }, - { 12, 0x15 }, - { 13, 0x0c }, - { 14, 0x0d }, - { 15, 0x0e }, - { 16, 0x33 }, - { 18, 0x18 }, - { 20, 0x19 }, - { 21, 0x26 }, - { 22, 0x1a }, - { 24, 0x35 }, - { 25, 0x44 }, - { 26, 0x1c }, - { 27, 0x28 }, - { 28, 0x1d }, - { 30, 0x1e }, - { 32, 0x37 }, - { 33, 0x2a }, - { 35, 0x46 }, - { 36, 0x55 }, - { 39, 0x2c }, - { 40, 0x39 }, - { 42, 0x56 }, - { 44, 0x3a }, - { 45, 0x2e }, - { 48, 0x57 }, - { 49, 0x66 }, - { 50, 0x49 }, - { 52, 0x3c }, - { 54, 0x58 }, - { 55, 0x4a }, - { 56, 0x3d }, - { 60, 0x59 }, - { 63, 0x68 }, - { 64, 0x77 }, - { 65, 0x4c }, - { 66, 0x5a }, - { 70, 0x69 }, - { 72, 0x5b }, - { 75, 0x4e }, - { 77, 0x6a }, - { 78, 0x5c }, - { 80, 0x79 }, - { 81, 0x88 }, - { 84, 0x5d }, - { 88, 0x7a }, - { 90, 0x5e }, - { 91, 0x6c }, - { 96, 0x7b }, - { 98, 0x6d }, - { 99, 0x8a }, - { 100, 0x99 }, - { 104, 0x7c }, - { 105, 0x6e }, - { 108, 0x8b }, - { 110, 0x9a }, - { 112, 0x7d }, - { 117, 0x8c }, - { 120, 0x9b }, - { 121, 0xaa }, - { 126, 0x8d }, - { 128, 0x7f }, - { 130, 0x9c }, - { 132, 0xab }, - { 135, 0x8e }, - { 140, 0x9d }, - { 143, 0xac }, - { 144, 0xbb }, - { 150, 0x9e }, - { 154, 0xad }, - { 156, 0xbc }, - { 160, 0x9f }, - { 165, 0xae }, - { 168, 0xbd }, - { 169, 0xcc }, - { 176, 0xaf }, - { 180, 0xbe }, - { 182, 0xcd }, - { 192, 0xbf }, - { 195, 0xce }, - { 196, 0xdd }, - { 208, 0xcf }, - { 210, 0xde }, - { 224, 0xdf }, - { 225, 0xee }, - { 240, 0xef }, - { 256, 0xff } diff --git a/usrp/host/lib/std_paths.h.in b/usrp/host/lib/std_paths.h.in deleted file mode 100644 index e09499e0b..000000000 --- a/usrp/host/lib/std_paths.h.in +++ /dev/null @@ -1,27 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - -static const char *std_paths[] = { - "@prefix@/share/usrp", - "/usr/local/share/usrp", - 0 -}; diff --git a/usrp/host/lib/usrp_basic.cc b/usrp/host/lib/usrp_basic.cc deleted file mode 100644 index 5b2f7ff71..000000000 --- a/usrp/host/lib/usrp_basic.cc +++ /dev/null @@ -1,1538 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003,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/usrp_basic.h" -#include "usrp/usrp_prims.h" -#include "usrp_interfaces.h" -#include "fpga_regs_common.h" -#include "fpga_regs_standard.h" -#include "fusb.h" -#include "db_boards.h" -#include <stdexcept> -#include <assert.h> -#include <math.h> -#include <ad9862.h> -#include <string.h> -#include <cstdio> - -using namespace ad9862; - -#define NELEM(x) (sizeof (x) / sizeof (x[0])) - -// These set the buffer size used for each end point using the fast -// usb interface. The kernel ends up locking down this much memory. - -static const int FUSB_BUFFER_SIZE = fusb_sysconfig::default_buffer_size(); -static const int FUSB_BLOCK_SIZE = fusb_sysconfig::max_block_size(); -static const int FUSB_NBLOCKS = FUSB_BUFFER_SIZE / FUSB_BLOCK_SIZE; - - -static const double POLLING_INTERVAL = 0.1; // seconds - -//////////////////////////////////////////////////////////////// - -static libusb_device_handle * -open_rx_interface (libusb_device *dev) -{ - libusb_device_handle *udh = usrp_open_rx_interface (dev); - if (udh == 0){ - fprintf (stderr, "usrp_basic_rx: can't open rx interface\n"); - } - return udh; -} - -static libusb_device_handle * -open_tx_interface (libusb_device *dev) -{ - libusb_device_handle *udh = usrp_open_tx_interface (dev); - if (udh == 0){ - fprintf (stderr, "usrp_basic_tx: can't open tx interface\n"); - } - return udh; -} - -////////////////////////////////////////////////////////////////// -// -// usrp_basic -// -//////////////////////////////////////////////////////////////// - -// Given: -// CLKIN = 64 MHz -// CLKSEL pin = high -// -// These settings give us: -// CLKOUT1 = CLKIN = 64 MHz -// CLKOUT2 = CLKIN = 64 MHz -// ADC is clocked at 64 MHz -// DAC is clocked at 128 MHz - -static unsigned char common_regs[] = { - REG_GENERAL, 0, - REG_DLL, (DLL_DISABLE_INTERNAL_XTAL_OSC - | DLL_MULT_2X - | DLL_FAST), - REG_CLKOUT, CLKOUT2_EQ_DLL_OVER_2, - REG_AUX_ADC_CLK, AUX_ADC_CLK_CLK_OVER_4 -}; - -usrp_basic::usrp_basic (int which_board, - libusb_device_handle * - open_interface (libusb_device *dev), - const std::string fpga_filename, - const std::string firmware_filename) - : d_udh (0), d_ctx (0), - d_usb_data_rate (16000000), // SWAG, see below - d_bytes_per_poll ((int) (POLLING_INTERVAL * d_usb_data_rate)), - d_verbose (false), d_fpga_master_clock_freq(64000000), d_db(2) -{ - /* - * SWAG: Scientific Wild Ass Guess. - * - * d_usb_data_rate is used only to determine how often to poll for over- and - * under-runs. We defualt it to 1/2 of our best case. Classes derived from - * usrp_basic (e.g., usrp_standard_tx and usrp_standard_rx) call - * set_usb_data_rate() to tell us the actual rate. This doesn't change our - * throughput, that's determined by the signal processing code in the FPGA - * (which we know nothing about), and the system limits determined by libusb, - * fusb_*, and the underlying drivers. - */ - memset (d_fpga_shadows, 0, sizeof (d_fpga_shadows)); - - usrp_one_time_init (&d_ctx); - - if (!usrp_load_standard_bits (which_board, false, fpga_filename, - firmware_filename, d_ctx)) - throw std::runtime_error ("usrp_basic/usrp_load_standard_bits"); - - libusb_device *dev = usrp_find_device (which_board, false, d_ctx); - if (dev == 0){ - fprintf (stderr, "usrp_basic: can't find usrp[%d]\n", which_board); - throw std::runtime_error ("usrp_basic/usrp_find_device"); - } - - if (!(usrp_usrp_p(dev) && usrp_hw_rev(dev) >= 1)){ - fprintf (stderr, "usrp_basic: sorry, this code only works with USRP revs >= 1\n"); - throw std::runtime_error ("usrp_basic/bad_rev"); - } - - if ((d_udh = open_interface (dev)) == 0) - throw std::runtime_error ("usrp_basic/open_interface"); - - // initialize registers that are common to rx and tx - - if (!usrp_9862_write_many_all (d_udh, common_regs, sizeof (common_regs))) { - fprintf (stderr, "usrp_basic: failed to init common AD9862 regs\n"); - throw std::runtime_error ("usrp_basic/init_9862"); - } - - _write_fpga_reg (FR_MODE, 0); // ensure we're in normal mode - _write_fpga_reg (FR_DEBUG_EN, 0); // disable debug outputs - -} - -usrp_basic::~usrp_basic () -{ - d_db.resize(0); // forget db shared ptrs - - if (d_udh) - usrp_close_interface (d_udh); - - usrp_deinit (d_ctx); -} - -void -usrp_basic::shutdown_daughterboards() -{ - // nuke d'boards before we close down USB in ~usrp_basic - // shutdown() will do any board shutdown while the USRP can still - // be talked to - for(size_t i = 0; i < d_db.size(); i++) - for(size_t j = 0; j < d_db[i].size(); j++) - d_db[i][j]->shutdown(); -} - -void -usrp_basic::init_db(usrp_basic_sptr u) -{ - if (u.get() != this) - throw std::invalid_argument("u is not this"); - - d_db[0] = instantiate_dbs(d_dbid[0], u, 0); - d_db[1] = instantiate_dbs(d_dbid[1], u, 1); -} - -std::vector<db_base_sptr> -usrp_basic::db(int which_side) -{ - which_side &= 0x1; // clamp it to avoid any reporting any errors - return d_db[which_side]; -} - -bool -usrp_basic::is_valid(const usrp_subdev_spec &ss) -{ - if (ss.side < 0 || ss.side > 1) - return false; - - if (ss.subdev < 0 || ss.subdev >= d_db[ss.side].size()) - return false; - - return true; -} - -db_base_sptr -usrp_basic::selected_subdev(const usrp_subdev_spec &ss) -{ - if (!is_valid(ss)) - throw std::invalid_argument("invalid subdev_spec"); - - return d_db[ss.side][ss.subdev]; -} - -bool -usrp_basic::start () -{ - return true; // nop -} - -bool -usrp_basic::stop () -{ - return true; // nop -} - -void -usrp_basic::set_usb_data_rate (int usb_data_rate) -{ - d_usb_data_rate = usb_data_rate; - d_bytes_per_poll = (int) (usb_data_rate * POLLING_INTERVAL); -} - -bool -usrp_basic::_write_aux_dac (int slot, int which_dac, int value) -{ - return usrp_write_aux_dac (d_udh, slot, which_dac, value); -} - -bool -usrp_basic::_read_aux_adc (int slot, int which_adc, int *value) -{ - return usrp_read_aux_adc (d_udh, slot, which_adc, value); -} - -int -usrp_basic::_read_aux_adc (int slot, int which_adc) -{ - int value; - if (!_read_aux_adc (slot, which_adc, &value)) - return READ_FAILED; - - return value; -} - -bool -usrp_basic::write_eeprom (int i2c_addr, int eeprom_offset, const std::string buf) -{ - return usrp_eeprom_write (d_udh, i2c_addr, eeprom_offset, buf.data (), buf.size ()); -} - -std::string -usrp_basic::read_eeprom (int i2c_addr, int eeprom_offset, int len) -{ - if (len <= 0) - return ""; - - char buf[len]; - - if (!usrp_eeprom_read (d_udh, i2c_addr, eeprom_offset, buf, len)) - return ""; - - return std::string (buf, len); -} - -bool -usrp_basic::write_i2c (int i2c_addr, const std::string buf) -{ - return usrp_i2c_write (d_udh, i2c_addr, buf.data (), buf.size ()); -} - -std::string -usrp_basic::read_i2c (int i2c_addr, int len) -{ - if (len <= 0) - return ""; - - char buf[len]; - - if (!usrp_i2c_read (d_udh, i2c_addr, buf, len)) - return ""; - - return std::string (buf, len); -} - -std::string -usrp_basic::serial_number() -{ - return usrp_serial_number(d_udh); -} - -// ---------------------------------------------------------------- - -bool -usrp_basic::set_adc_offset (int which_adc, int offset) -{ - if (which_adc < 0 || which_adc > 3) - return false; - - return _write_fpga_reg (FR_ADC_OFFSET_0 + which_adc, offset); -} - -bool -usrp_basic::set_dac_offset (int which_dac, int offset, int offset_pin) -{ - if (which_dac < 0 || which_dac > 3) - return false; - - int which_codec = which_dac >> 1; - int tx_a = (which_dac & 0x1) == 0; - int lo = ((offset & 0x3) << 6) | (offset_pin & 0x1); - int hi = (offset >> 2); - bool ok; - - if (tx_a){ - ok = _write_9862 (which_codec, REG_TX_A_OFFSET_LO, lo); - ok &= _write_9862 (which_codec, REG_TX_A_OFFSET_HI, hi); - } - else { - ok = _write_9862 (which_codec, REG_TX_B_OFFSET_LO, lo); - ok &= _write_9862 (which_codec, REG_TX_B_OFFSET_HI, hi); - } - return ok; -} - -bool -usrp_basic::set_adc_buffer_bypass (int which_adc, bool bypass) -{ - if (which_adc < 0 || which_adc > 3) - return false; - - int codec = which_adc >> 1; - int reg = (which_adc & 1) == 0 ? REG_RX_A : REG_RX_B; - - unsigned char cur_rx; - unsigned char cur_pwr_dn; - - // If the input buffer is bypassed, we need to power it down too. - - bool ok = _read_9862 (codec, reg, &cur_rx); - ok &= _read_9862 (codec, REG_RX_PWR_DN, &cur_pwr_dn); - if (!ok) - return false; - - if (bypass){ - cur_rx |= RX_X_BYPASS_INPUT_BUFFER; - cur_pwr_dn |= ((which_adc & 1) == 0) ? RX_PWR_DN_BUF_A : RX_PWR_DN_BUF_B; - } - else { - cur_rx &= ~RX_X_BYPASS_INPUT_BUFFER; - cur_pwr_dn &= ~(((which_adc & 1) == 0) ? RX_PWR_DN_BUF_A : RX_PWR_DN_BUF_B); - } - - ok &= _write_9862 (codec, reg, cur_rx); - ok &= _write_9862 (codec, REG_RX_PWR_DN, cur_pwr_dn); - return ok; -} - -bool -usrp_basic::set_dc_offset_cl_enable(int bits, int mask) -{ - return _write_fpga_reg(FR_DC_OFFSET_CL_EN, - (d_fpga_shadows[FR_DC_OFFSET_CL_EN] & ~mask) | (bits & mask)); -} - -// ---------------------------------------------------------------- - -bool -usrp_basic::_write_fpga_reg (int regno, int value) -{ - if (d_verbose){ - fprintf (stdout, "_write_fpga_reg(%3d, 0x%08x)\n", regno, value); - fflush (stdout); - } - - if (regno >= 0 && regno < MAX_REGS) - d_fpga_shadows[regno] = value; - - return usrp_write_fpga_reg (d_udh, regno, value); -} - -bool -usrp_basic::_write_fpga_reg_masked (int regno, int value, int mask) -{ - //Only use this for registers who actually use a mask in the verilog firmware, like FR_RX_MASTER_SLAVE - //value is a 16 bits value and mask is a 16 bits mask - if (d_verbose){ - fprintf (stdout, "_write_fpga_reg_masked(%3d, 0x%04x,0x%04x)\n", regno, value, mask); - fflush (stdout); - } - - if (regno >= 0 && regno < MAX_REGS) - d_fpga_shadows[regno] = value; - - return usrp_write_fpga_reg (d_udh, regno, (value & 0xffff) | ((mask & 0xffff)<<16)); -} - - -bool -usrp_basic::_read_fpga_reg (int regno, int *value) -{ - return usrp_read_fpga_reg (d_udh, regno, value); -} - -int -usrp_basic::_read_fpga_reg (int regno) -{ - int value; - if (!_read_fpga_reg (regno, &value)) - return READ_FAILED; - return value; -} - -bool -usrp_basic::_write_9862 (int which_codec, int regno, unsigned char value) -{ - if (0 && d_verbose){ - // FIXME really want to enable logging in usrp_prims:usrp_9862_write - fprintf(stdout, "_write_9862(codec = %d, regno = %2d, val = 0x%02x)\n", which_codec, regno, value); - fflush(stdout); - } - - return usrp_9862_write (d_udh, which_codec, regno, value); -} - - -bool -usrp_basic::_read_9862 (int which_codec, int regno, unsigned char *value) const -{ - return usrp_9862_read (d_udh, which_codec, regno, value); -} - -int -usrp_basic::_read_9862 (int which_codec, int regno) const -{ - unsigned char value; - if (!_read_9862 (which_codec, regno, &value)) - return READ_FAILED; - return value; -} - -bool -usrp_basic::_write_spi (int optional_header, int enables, int format, std::string buf) -{ - return usrp_spi_write (d_udh, optional_header, enables, format, - buf.data(), buf.size()); -} - -std::string -usrp_basic::_read_spi (int optional_header, int enables, int format, int len) -{ - if (len <= 0) - return ""; - - char buf[len]; - - if (!usrp_spi_read (d_udh, optional_header, enables, format, buf, len)) - return ""; - - return std::string (buf, len); -} - - -bool -usrp_basic::_set_led (int which_led, bool on) -{ - return usrp_set_led (d_udh, which_led, on); -} - -bool -usrp_basic::write_atr_tx_delay(int value) -{ - return _write_fpga_reg(FR_ATR_TX_DELAY, value); -} - -bool -usrp_basic::write_atr_rx_delay(int value) -{ - return _write_fpga_reg(FR_ATR_RX_DELAY, value); -} - -/* - * ---------------------------------------------------------------- - * Routines to access and control daughterboard specific i/o - * ---------------------------------------------------------------- - */ -static int -slot_id_to_oe_reg (int slot_id) -{ - static int reg[4] = { FR_OE_0, FR_OE_1, FR_OE_2, FR_OE_3 }; - assert (0 <= slot_id && slot_id < 4); - return reg[slot_id]; -} - -static int -slot_id_to_io_reg (int slot_id) -{ - static int reg[4] = { FR_IO_0, FR_IO_1, FR_IO_2, FR_IO_3 }; - assert (0 <= slot_id && slot_id < 4); - return reg[slot_id]; -} - -static int -slot_id_to_refclk_reg(int slot_id) -{ - static int reg[4] = { FR_TX_A_REFCLK, FR_RX_A_REFCLK, FR_TX_B_REFCLK, FR_RX_B_REFCLK }; - assert (0 <= slot_id && slot_id < 4); - return reg[slot_id]; -} - -static int -slot_id_to_atr_mask_reg(int slot_id) -{ - static int reg[4] = { FR_ATR_MASK_0, FR_ATR_MASK_1, FR_ATR_MASK_2, FR_ATR_MASK_3 }; - assert (0 <= slot_id && slot_id < 4); - return reg[slot_id]; -} - -static int -slot_id_to_atr_txval_reg(int slot_id) -{ - static int reg[4] = { FR_ATR_TXVAL_0, FR_ATR_TXVAL_1, FR_ATR_TXVAL_2, FR_ATR_TXVAL_3 }; - assert (0 <= slot_id && slot_id < 4); - return reg[slot_id]; -} - -static int -slot_id_to_atr_rxval_reg(int slot_id) -{ - static int reg[4] = { FR_ATR_RXVAL_0, FR_ATR_RXVAL_1, FR_ATR_RXVAL_2, FR_ATR_RXVAL_3 }; - assert (0 <= slot_id && slot_id < 4); - return reg[slot_id]; -} - -static int -to_slot(txrx_t txrx, int which_side) -{ - // TX_A = 0 - // RX_A = 1 - // TX_B = 2 - // RX_B = 3 - return ((which_side & 0x1) << 1) | ((txrx & 0x1) == C_RX); -} - -bool -usrp_basic::common_set_pga(txrx_t txrx, int which_amp, double gain) -{ - if (which_amp < 0 || which_amp > 3) - return false; - - gain = std::min(common_pga_max(txrx), - std::max(common_pga_min(txrx), gain)); - - int codec = which_amp >> 1; - int int_gain = (int) rint((gain - common_pga_min(txrx)) / common_pga_db_per_step(txrx)); - - if (txrx == C_TX){ // 0 and 1 are same, as are 2 and 3 - return _write_9862(codec, REG_TX_PGA, int_gain); - } - else { - int reg = (which_amp & 1) == 0 ? REG_RX_A : REG_RX_B; - - // read current value to get input buffer bypass flag. - unsigned char cur_rx; - if (!_read_9862(codec, reg, &cur_rx)) - return false; - - cur_rx = (cur_rx & RX_X_BYPASS_INPUT_BUFFER) | (int_gain & 0x7f); - return _write_9862(codec, reg, cur_rx); - } -} - -double -usrp_basic::common_pga(txrx_t txrx, int which_amp) const -{ - if (which_amp < 0 || which_amp > 3) - return READ_FAILED; - - if (txrx == C_TX){ - int codec = which_amp >> 1; - unsigned char v; - bool ok = _read_9862 (codec, REG_TX_PGA, &v); - if (!ok) - return READ_FAILED; - - return (pga_db_per_step() * v) + pga_min(); - } - else { - int codec = which_amp >> 1; - int reg = (which_amp & 1) == 0 ? REG_RX_A : REG_RX_B; - unsigned char v; - bool ok = _read_9862 (codec, reg, &v); - if (!ok) - return READ_FAILED; - - return (pga_db_per_step() * (v & 0x1f)) + pga_min(); - } -} - -double -usrp_basic::common_pga_min(txrx_t txrx) const -{ - if (txrx == C_TX) - return -20.0; - else - return 0.0; -} - -double -usrp_basic::common_pga_max(txrx_t txrx) const -{ - if (txrx == C_TX) - return 0.0; - else - return 20.0; -} - -double -usrp_basic::common_pga_db_per_step(txrx_t txrx) const -{ - if (txrx == C_TX) - return 20.0 / 255; - else - return 20.0 / 20; -} - -bool -usrp_basic::_common_write_oe(txrx_t txrx, int which_side, int value, int mask) -{ - if (! (0 <= which_side && which_side <= 1)) - return false; - - return _write_fpga_reg(slot_id_to_oe_reg(to_slot(txrx, which_side)), - (mask << 16) | (value & 0xffff)); -} - -bool -usrp_basic::common_write_io(txrx_t txrx, int which_side, int value, int mask) -{ - if (! (0 <= which_side && which_side <= 1)) - return false; - - return _write_fpga_reg(slot_id_to_io_reg(to_slot(txrx, which_side)), - (mask << 16) | (value & 0xffff)); -} - -bool -usrp_basic::common_read_io(txrx_t txrx, int which_side, int *value) -{ - if (! (0 <= which_side && which_side <= 1)) - return false; - - int t; - int reg = which_side + 1; // FIXME, *very* magic number (fix in serial_io.v) - bool ok = _read_fpga_reg(reg, &t); - if (!ok) - return false; - - if (txrx == C_TX){ - *value = t & 0xffff; // FIXME, more magic - return true; - } - else { - *value = (t >> 16) & 0xffff; // FIXME, more magic - return true; - } -} - -int -usrp_basic::common_read_io(txrx_t txrx, int which_side) -{ - int value; - if (!common_read_io(txrx, which_side, &value)) - return READ_FAILED; - return value; -} - -bool -usrp_basic::common_write_refclk(txrx_t txrx, int which_side, int value) -{ - if (! (0 <= which_side && which_side <= 1)) - return false; - - return _write_fpga_reg(slot_id_to_refclk_reg(to_slot(txrx, which_side)), - value); -} - -bool -usrp_basic::common_write_atr_mask(txrx_t txrx, int which_side, int value) -{ - if (! (0 <= which_side && which_side <= 1)) - return false; - - return _write_fpga_reg(slot_id_to_atr_mask_reg(to_slot(txrx, which_side)), - value); -} - -bool -usrp_basic::common_write_atr_txval(txrx_t txrx, int which_side, int value) -{ - if (! (0 <= which_side && which_side <= 1)) - return false; - - return _write_fpga_reg(slot_id_to_atr_txval_reg(to_slot(txrx, which_side)), - value); -} - -bool -usrp_basic::common_write_atr_rxval(txrx_t txrx, int which_side, int value) -{ - if (! (0 <= which_side && which_side <= 1)) - return false; - - return _write_fpga_reg(slot_id_to_atr_rxval_reg(to_slot(txrx, which_side)), - value); -} - -bool -usrp_basic::common_write_aux_dac(txrx_t txrx, int which_side, int which_dac, int value) -{ - return _write_aux_dac(to_slot(txrx, which_side), which_dac, value); -} - -bool -usrp_basic::common_read_aux_adc(txrx_t txrx, int which_side, int which_adc, int *value) -{ - return _read_aux_adc(to_slot(txrx, which_side), which_adc, value); -} - -int -usrp_basic::common_read_aux_adc(txrx_t txrx, int which_side, int which_adc) -{ - return _read_aux_adc(to_slot(txrx, which_side), which_adc); -} - - -//////////////////////////////////////////////////////////////// -// -// usrp_basic_rx -// -//////////////////////////////////////////////////////////////// - -static unsigned char rx_init_regs[] = { - REG_RX_PWR_DN, 0, - REG_RX_A, 0, // minimum gain = 0x00 (max gain = 0x14) - REG_RX_B, 0, // minimum gain = 0x00 (max gain = 0x14) - REG_RX_MISC, (RX_MISC_HS_DUTY_CYCLE | RX_MISC_CLK_DUTY), - REG_RX_IF, (RX_IF_USE_CLKOUT1 - | RX_IF_2S_COMP), - REG_RX_DIGITAL, (RX_DIGITAL_2_CHAN) -}; - - -usrp_basic_rx::usrp_basic_rx (int which_board, int fusb_block_size, int fusb_nblocks, - const std::string fpga_filename, - const std::string firmware_filename - ) - : usrp_basic (which_board, open_rx_interface, fpga_filename, firmware_filename), - d_devhandle (0), d_ephandle (0), - d_bytes_seen (0), d_first_read (true), - d_rx_enable (false) -{ - // initialize rx specific registers - - if (!usrp_9862_write_many_all (d_udh, rx_init_regs, sizeof (rx_init_regs))){ - fprintf (stderr, "usrp_basic_rx: failed to init AD9862 RX regs\n"); - throw std::runtime_error ("usrp_basic_rx/init_9862"); - } - - if (0){ - // FIXME power down 2nd codec rx path - usrp_9862_write (d_udh, 1, REG_RX_PWR_DN, 0x1); // power down everything - } - - // Reset the rx path and leave it disabled. - set_rx_enable (false); - usrp_set_fpga_rx_reset (d_udh, true); - usrp_set_fpga_rx_reset (d_udh, false); - - set_fpga_rx_sample_rate_divisor (2); // usually correct - - set_dc_offset_cl_enable(0xf, 0xf); // enable DC offset removal control loops - - probe_rx_slots (false); - - //d_db[0] = instantiate_dbs(d_dbid[0], this, 0); - //d_db[1] = instantiate_dbs(d_dbid[1], this, 1); - - // check fusb buffering parameters - - if (fusb_block_size < 0 || fusb_block_size > FUSB_BLOCK_SIZE) - throw std::out_of_range ("usrp_basic_rx: invalid fusb_block_size"); - - if (fusb_nblocks < 0) - throw std::out_of_range ("usrp_basic_rx: invalid fusb_nblocks"); - - if (fusb_block_size == 0) - fusb_block_size = fusb_sysconfig::default_block_size(); - - if (fusb_nblocks == 0) - fusb_nblocks = std::max (1, FUSB_BUFFER_SIZE / fusb_block_size); - - d_devhandle = fusb_sysconfig::make_devhandle (d_udh, d_ctx); - d_ephandle = d_devhandle->make_ephandle (USRP_RX_ENDPOINT, true, - fusb_block_size, fusb_nblocks); - - write_atr_mask(0, 0); // zero Rx A Auto Transmit/Receive regs - write_atr_txval(0, 0); - write_atr_rxval(0, 0); - write_atr_mask(1, 0); // zero Rx B Auto Transmit/Receive regs - write_atr_txval(1, 0); - write_atr_rxval(1, 0); -} - -static unsigned char rx_fini_regs[] = { - REG_RX_PWR_DN, 0x1 // power down everything -}; - -usrp_basic_rx::~usrp_basic_rx () -{ - if (!set_rx_enable (false)){ - fprintf (stderr, "usrp_basic_rx: set_fpga_rx_enable failed\n"); - } - - d_ephandle->stop (); - delete d_ephandle; - delete d_devhandle; - - if (!usrp_9862_write_many_all (d_udh, rx_fini_regs, sizeof (rx_fini_regs))){ - fprintf (stderr, "usrp_basic_rx: failed to fini AD9862 RX regs\n"); - } - - shutdown_daughterboards(); -} - - -bool -usrp_basic_rx::start () -{ - if (!usrp_basic::start ()) // invoke parent's method - return false; - - // fire off reads before asserting rx_enable - - if (!d_ephandle->start ()){ - fprintf (stderr, "usrp_basic_rx: failed to start end point streaming"); - return false; - } - - if (!set_rx_enable (true)){ - fprintf (stderr, "usrp_basic_rx: set_rx_enable failed\n"); - return false; - } - - return true; -} - -bool -usrp_basic_rx::stop () -{ - bool ok = usrp_basic::stop(); - - if (!set_rx_enable(false)){ - fprintf (stderr, "usrp_basic_rx: set_rx_enable(false) failed\n"); - ok = false; - } - - if (!d_ephandle->stop()){ - fprintf (stderr, "usrp_basic_rx: failed to stop end point streaming"); - ok = false; - } - - return ok; -} - -usrp_basic_rx * -usrp_basic_rx::make (int which_board, int fusb_block_size, int fusb_nblocks, - const std::string fpga_filename, - const std::string firmware_filename) -{ - usrp_basic_rx *u = 0; - - try { - u = new usrp_basic_rx (which_board, fusb_block_size, fusb_nblocks, - fpga_filename, firmware_filename); - return u; - } - catch (...){ - delete u; - return 0; - } - - return u; -} - -bool -usrp_basic_rx::set_fpga_rx_sample_rate_divisor (unsigned int div) -{ - return _write_fpga_reg (FR_RX_SAMPLE_RATE_DIV, div - 1); -} - - -/* - * \brief read data from the D/A's via the FPGA. - * \p len must be a multiple of 512 bytes. - * - * \returns the number of bytes read, or -1 on error. - * - * If overrun is non-NULL it will be set true iff an RX overrun is detected. - */ -int -usrp_basic_rx::read (void *buf, int len, bool *overrun) -{ - int r; - - if (overrun) - *overrun = false; - - if (len < 0 || (len % 512) != 0){ - fprintf (stderr, "usrp_basic_rx::read: invalid length = %d\n", len); - return -1; - } - - r = d_ephandle->read (buf, len); - if (r > 0) - d_bytes_seen += r; - - /* - * In many cases, the FPGA reports an rx overrun right after we - * enable the Rx path. If this is our first read, check for the - * overrun to clear the condition, then ignore the result. - */ - if (0 && d_first_read){ // FIXME - d_first_read = false; - bool bogus_overrun; - usrp_check_rx_overrun (d_udh, &bogus_overrun); - } - - if (overrun != 0 && d_bytes_seen >= d_bytes_per_poll){ - d_bytes_seen = 0; - if (!usrp_check_rx_overrun (d_udh, overrun)){ - fprintf (stderr, "usrp_basic_rx: usrp_check_rx_overrun failed\n"); - } - } - - return r; -} - -bool -usrp_basic_rx::set_rx_enable (bool on) -{ - d_rx_enable = on; - return usrp_set_fpga_rx_enable (d_udh, on); -} - -// conditional disable, return prev state -bool -usrp_basic_rx::disable_rx () -{ - bool enabled = rx_enable (); - if (enabled) - set_rx_enable (false); - return enabled; -} - -// conditional set -void -usrp_basic_rx::restore_rx (bool on) -{ - if (on != rx_enable ()) - set_rx_enable (on); -} - -void -usrp_basic_rx::probe_rx_slots (bool verbose) -{ - struct usrp_dboard_eeprom eeprom; - static int slot_id_map[2] = { SLOT_RX_A, SLOT_RX_B }; - static const char *slot_name[2] = { "RX d'board A", "RX d'board B" }; - - for (int i = 0; i < 2; i++){ - int slot_id = slot_id_map [i]; - const char *msg = 0; - usrp_dbeeprom_status_t s = usrp_read_dboard_eeprom (d_udh, slot_id, &eeprom); - - switch (s){ - case UDBE_OK: - d_dbid[i] = eeprom.id; - msg = usrp_dbid_to_string (eeprom.id).c_str (); - set_adc_offset (2*i+0, eeprom.offset[0]); - set_adc_offset (2*i+1, eeprom.offset[1]); - _write_fpga_reg (slot_id_to_oe_reg(slot_id), (0xffff << 16) | eeprom.oe); - _write_fpga_reg (slot_id_to_io_reg(slot_id), (0xffff << 16) | 0x0000); - break; - - case UDBE_NO_EEPROM: - d_dbid[i] = -1; - msg = "<none>"; - _write_fpga_reg (slot_id_to_oe_reg(slot_id), (0xffff << 16) | 0x0000); - _write_fpga_reg (slot_id_to_io_reg(slot_id), (0xffff << 16) | 0x0000); - break; - - case UDBE_INVALID_EEPROM: - d_dbid[i] = -2; - msg = "Invalid EEPROM contents"; - _write_fpga_reg (slot_id_to_oe_reg(slot_id), (0xffff << 16) | 0x0000); - _write_fpga_reg (slot_id_to_io_reg(slot_id), (0xffff << 16) | 0x0000); - break; - - case UDBE_BAD_SLOT: - default: - assert (0); - } - - if (verbose){ - fflush (stdout); - fprintf (stderr, "%s: %s\n", slot_name[i], msg); - } - } -} - -bool -usrp_basic_rx::set_pga (int which_amp, double gain) -{ - return common_set_pga(C_RX, which_amp, gain); -} - -double -usrp_basic_rx::pga(int which_amp) const -{ - return common_pga(C_RX, which_amp); -} - -double -usrp_basic_rx::pga_min() const -{ - return common_pga_min(C_RX); -} - -double -usrp_basic_rx::pga_max() const -{ - return common_pga_max(C_RX); -} - -double -usrp_basic_rx::pga_db_per_step() const -{ - return common_pga_db_per_step(C_RX); -} - -bool -usrp_basic_rx::_write_oe (int which_side, int value, int mask) -{ - return _common_write_oe(C_RX, which_side, value, mask); -} - -bool -usrp_basic_rx::write_io (int which_side, int value, int mask) -{ - return common_write_io(C_RX, which_side, value, mask); -} - -bool -usrp_basic_rx::read_io (int which_side, int *value) -{ - return common_read_io(C_RX, which_side, value); -} - -int -usrp_basic_rx::read_io (int which_side) -{ - return common_read_io(C_RX, which_side); -} - -bool -usrp_basic_rx::write_refclk(int which_side, int value) -{ - return common_write_refclk(C_RX, which_side, value); -} - -bool -usrp_basic_rx::write_atr_mask(int which_side, int value) -{ - return common_write_atr_mask(C_RX, which_side, value); -} - -bool -usrp_basic_rx::write_atr_txval(int which_side, int value) -{ - return common_write_atr_txval(C_RX, which_side, value); -} - -bool -usrp_basic_rx::write_atr_rxval(int which_side, int value) -{ - return common_write_atr_rxval(C_RX, which_side, value); -} - -bool -usrp_basic_rx::write_aux_dac (int which_side, int which_dac, int value) -{ - return common_write_aux_dac(C_RX, which_side, which_dac, value); -} - -bool -usrp_basic_rx::read_aux_adc (int which_side, int which_adc, int *value) -{ - return common_read_aux_adc(C_RX, which_side, which_adc, value); -} - -int -usrp_basic_rx::read_aux_adc (int which_side, int which_adc) -{ - return common_read_aux_adc(C_RX, which_side, which_adc); -} - -int -usrp_basic_rx::block_size () const { return d_ephandle->block_size(); } - -//////////////////////////////////////////////////////////////// -// -// usrp_basic_tx -// -//////////////////////////////////////////////////////////////// - - -// -// DAC input rate 64 MHz interleaved for a total input rate of 128 MHz -// DAC input is latched on rising edge of CLKOUT2 -// NCO is disabled -// interpolate 2x -// coarse modulator disabled -// - -static unsigned char tx_init_regs[] = { - REG_TX_PWR_DN, 0, - REG_TX_A_OFFSET_LO, 0, - REG_TX_A_OFFSET_HI, 0, - REG_TX_B_OFFSET_LO, 0, - REG_TX_B_OFFSET_HI, 0, - REG_TX_A_GAIN, (TX_X_GAIN_COARSE_FULL | 0), - REG_TX_B_GAIN, (TX_X_GAIN_COARSE_FULL | 0), - REG_TX_PGA, 0xff, // maximum gain (0 dB) - REG_TX_MISC, 0, - REG_TX_IF, (TX_IF_USE_CLKOUT1 - | TX_IF_I_FIRST - | TX_IF_INV_TX_SYNC - | TX_IF_2S_COMP - | TX_IF_INTERLEAVED), - REG_TX_DIGITAL, (TX_DIGITAL_2_DATA_PATHS - | TX_DIGITAL_INTERPOLATE_4X), - REG_TX_MODULATOR, (TX_MODULATOR_DISABLE_NCO - | TX_MODULATOR_COARSE_MODULATION_NONE), - REG_TX_NCO_FTW_7_0, 0, - REG_TX_NCO_FTW_15_8, 0, - REG_TX_NCO_FTW_23_16, 0 -}; - -usrp_basic_tx::usrp_basic_tx (int which_board, int fusb_block_size, int fusb_nblocks, - const std::string fpga_filename, - const std::string firmware_filename) - : usrp_basic (which_board, open_tx_interface, fpga_filename, firmware_filename), - d_devhandle (0), d_ephandle (0), - d_bytes_seen (0), d_first_write (true), - d_tx_enable (false) -{ - if (!usrp_9862_write_many_all (d_udh, tx_init_regs, sizeof (tx_init_regs))){ - fprintf (stderr, "usrp_basic_tx: failed to init AD9862 TX regs\n"); - throw std::runtime_error ("usrp_basic_tx/init_9862"); - } - - if (0){ - // FIXME power down 2nd codec tx path - usrp_9862_write (d_udh, 1, REG_TX_PWR_DN, - (TX_PWR_DN_TX_DIGITAL - | TX_PWR_DN_TX_ANALOG_BOTH)); - } - - // Reset the tx path and leave it disabled. - set_tx_enable (false); - usrp_set_fpga_tx_reset (d_udh, true); - usrp_set_fpga_tx_reset (d_udh, false); - - set_fpga_tx_sample_rate_divisor (4); // we're using interp x4 - - probe_tx_slots (false); - - //d_db[0] = instantiate_dbs(d_dbid[0], this, 0); - //d_db[1] = instantiate_dbs(d_dbid[1], this, 1); - - // check fusb buffering parameters - - if (fusb_block_size < 0 || fusb_block_size > FUSB_BLOCK_SIZE) - throw std::out_of_range ("usrp_basic_rx: invalid fusb_block_size"); - - if (fusb_nblocks < 0) - throw std::out_of_range ("usrp_basic_rx: invalid fusb_nblocks"); - - if (fusb_block_size == 0) - fusb_block_size = FUSB_BLOCK_SIZE; - - if (fusb_nblocks == 0) - fusb_nblocks = std::max (1, FUSB_BUFFER_SIZE / fusb_block_size); - - d_devhandle = fusb_sysconfig::make_devhandle (d_udh, d_ctx); - d_ephandle = d_devhandle->make_ephandle (USRP_TX_ENDPOINT, false, - fusb_block_size, fusb_nblocks); - - write_atr_mask(0, 0); // zero Tx A Auto Transmit/Receive regs - write_atr_txval(0, 0); - write_atr_rxval(0, 0); - write_atr_mask(1, 0); // zero Tx B Auto Transmit/Receive regs - write_atr_txval(1, 0); - write_atr_rxval(1, 0); -} - - -static unsigned char tx_fini_regs[] = { - REG_TX_PWR_DN, (TX_PWR_DN_TX_DIGITAL - | TX_PWR_DN_TX_ANALOG_BOTH), - REG_TX_MODULATOR, (TX_MODULATOR_DISABLE_NCO - | TX_MODULATOR_COARSE_MODULATION_NONE) -}; - -usrp_basic_tx::~usrp_basic_tx () -{ - d_ephandle->stop (); - delete d_ephandle; - delete d_devhandle; - - if (!usrp_9862_write_many_all (d_udh, tx_fini_regs, sizeof (tx_fini_regs))){ - fprintf (stderr, "usrp_basic_tx: failed to fini AD9862 TX regs\n"); - } - - shutdown_daughterboards(); -} - -bool -usrp_basic_tx::start () -{ - if (!usrp_basic::start ()) - return false; - - if (!set_tx_enable (true)){ - fprintf (stderr, "usrp_basic_tx: set_tx_enable failed\n"); - return false; - } - - if (!d_ephandle->start ()){ - fprintf (stderr, "usrp_basic_tx: failed to start end point streaming"); - return false; - } - - return true; -} - -bool -usrp_basic_tx::stop () -{ - bool ok = usrp_basic::stop (); - - if (!d_ephandle->stop ()){ - fprintf (stderr, "usrp_basic_tx: failed to stop end point streaming"); - ok = false; - } - - if (!set_tx_enable (false)){ - fprintf (stderr, "usrp_basic_tx: set_tx_enable(false) failed\n"); - ok = false; - } - - return ok; -} - -usrp_basic_tx * -usrp_basic_tx::make (int which_board, int fusb_block_size, int fusb_nblocks, - const std::string fpga_filename, - const std::string firmware_filename) -{ - usrp_basic_tx *u = 0; - - try { - u = new usrp_basic_tx (which_board, fusb_block_size, fusb_nblocks, - fpga_filename, firmware_filename); - return u; - } - catch (...){ - delete u; - return 0; - } - - return u; -} - -bool -usrp_basic_tx::set_fpga_tx_sample_rate_divisor (unsigned int div) -{ - return _write_fpga_reg (FR_TX_SAMPLE_RATE_DIV, div - 1); -} - -/*! - * \brief Write data to the A/D's via the FPGA. - * - * \p len must be a multiple of 512 bytes. - * \returns number of bytes written or -1 on error. - * - * if \p underrun is non-NULL, it will be set to true iff - * a transmit underrun condition is detected. - */ -int -usrp_basic_tx::write (const void *buf, int len, bool *underrun) -{ - int r; - - if (underrun) - *underrun = false; - - if (len < 0 || (len % 512) != 0){ - fprintf (stderr, "usrp_basic_tx::write: invalid length = %d\n", len); - return -1; - } - - r = d_ephandle->write (buf, len); - if (r > 0) - d_bytes_seen += r; - - /* - * In many cases, the FPGA reports an tx underrun right after we - * enable the Tx path. If this is our first write, check for the - * underrun to clear the condition, then ignore the result. - */ - if (d_first_write && d_bytes_seen >= 4 * FUSB_BLOCK_SIZE){ - d_first_write = false; - bool bogus_underrun; - usrp_check_tx_underrun (d_udh, &bogus_underrun); - } - - if (underrun != 0 && d_bytes_seen >= d_bytes_per_poll){ - d_bytes_seen = 0; - if (!usrp_check_tx_underrun (d_udh, underrun)){ - fprintf (stderr, "usrp_basic_tx: usrp_check_tx_underrun failed\n"); - } - } - - return r; -} - -void -usrp_basic_tx::wait_for_completion () -{ - d_ephandle->wait_for_completion (); -} - -bool -usrp_basic_tx::set_tx_enable (bool on) -{ - d_tx_enable = on; - // fprintf (stderr, "set_tx_enable %d\n", on); - return usrp_set_fpga_tx_enable (d_udh, on); -} - -// conditional disable, return prev state -bool -usrp_basic_tx::disable_tx () -{ - bool enabled = tx_enable (); - if (enabled) - set_tx_enable (false); - return enabled; -} - -// conditional set -void -usrp_basic_tx::restore_tx (bool on) -{ - if (on != tx_enable ()) - set_tx_enable (on); -} - -void -usrp_basic_tx::probe_tx_slots (bool verbose) -{ - struct usrp_dboard_eeprom eeprom; - static int slot_id_map[2] = { SLOT_TX_A, SLOT_TX_B }; - static const char *slot_name[2] = { "TX d'board A", "TX d'board B" }; - - for (int i = 0; i < 2; i++){ - int slot_id = slot_id_map [i]; - const char *msg = 0; - usrp_dbeeprom_status_t s = usrp_read_dboard_eeprom (d_udh, slot_id, &eeprom); - - switch (s){ - case UDBE_OK: - d_dbid[i] = eeprom.id; - msg = usrp_dbid_to_string (eeprom.id).c_str (); - // FIXME, figure out interpretation of dc offset for TX d'boards - // offset = (eeprom.offset[1] << 16) | (eeprom.offset[0] & 0xffff); - _write_fpga_reg (slot_id_to_oe_reg(slot_id), (0xffff << 16) | eeprom.oe); - _write_fpga_reg (slot_id_to_io_reg(slot_id), (0xffff << 16) | 0x0000); - break; - - case UDBE_NO_EEPROM: - d_dbid[i] = -1; - msg = "<none>"; - _write_fpga_reg (slot_id_to_oe_reg(slot_id), (0xffff << 16) | 0x0000); - _write_fpga_reg (slot_id_to_io_reg(slot_id), (0xffff << 16) | 0x0000); - break; - - case UDBE_INVALID_EEPROM: - d_dbid[i] = -2; - msg = "Invalid EEPROM contents"; - _write_fpga_reg (slot_id_to_oe_reg(slot_id), (0xffff << 16) | 0x0000); - _write_fpga_reg (slot_id_to_io_reg(slot_id), (0xffff << 16) | 0x0000); - break; - - case UDBE_BAD_SLOT: - default: - assert (0); - } - - if (verbose){ - fflush (stdout); - fprintf (stderr, "%s: %s\n", slot_name[i], msg); - } - } -} - -bool -usrp_basic_tx::set_pga (int which_amp, double gain) -{ - return common_set_pga(C_TX, which_amp, gain); -} - -double -usrp_basic_tx::pga (int which_amp) const -{ - return common_pga(C_TX, which_amp); -} - -double -usrp_basic_tx::pga_min() const -{ - return common_pga_min(C_TX); -} - -double -usrp_basic_tx::pga_max() const -{ - return common_pga_max(C_TX); -} - -double -usrp_basic_tx::pga_db_per_step() const -{ - return common_pga_db_per_step(C_TX); -} - -bool -usrp_basic_tx::_write_oe (int which_side, int value, int mask) -{ - return _common_write_oe(C_TX, which_side, value, mask); -} - -bool -usrp_basic_tx::write_io (int which_side, int value, int mask) -{ - return common_write_io(C_TX, which_side, value, mask); -} - -bool -usrp_basic_tx::read_io (int which_side, int *value) -{ - return common_read_io(C_TX, which_side, value); -} - -int -usrp_basic_tx::read_io (int which_side) -{ - return common_read_io(C_TX, which_side); -} - -bool -usrp_basic_tx::write_refclk(int which_side, int value) -{ - return common_write_refclk(C_TX, which_side, value); -} - -bool -usrp_basic_tx::write_atr_mask(int which_side, int value) -{ - return common_write_atr_mask(C_TX, which_side, value); -} - -bool -usrp_basic_tx::write_atr_txval(int which_side, int value) -{ - return common_write_atr_txval(C_TX, which_side, value); -} - -bool -usrp_basic_tx::write_atr_rxval(int which_side, int value) -{ - return common_write_atr_rxval(C_TX, which_side, value); -} - -bool -usrp_basic_tx::write_aux_dac (int which_side, int which_dac, int value) -{ - return common_write_aux_dac(C_TX, which_side, which_dac, value); -} - -bool -usrp_basic_tx::read_aux_adc (int which_side, int which_adc, int *value) -{ - return common_read_aux_adc(C_TX, which_side, which_adc, value); -} - -int -usrp_basic_tx::read_aux_adc (int which_side, int which_adc) -{ - return common_read_aux_adc(C_TX, which_side, which_adc); -} - -int -usrp_basic_tx::block_size () const { return d_ephandle->block_size(); } - diff --git a/usrp/host/lib/usrp_config.cc b/usrp/host/lib/usrp_config.cc deleted file mode 100644 index fcf207f68..000000000 --- a/usrp/host/lib/usrp_config.cc +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 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_config.h" - -int -usrp_rx_config_stream_count (unsigned int usrp_rx_config) -{ - return 1; -} - -int -usrp_tx_config_stream_count (unsigned int usrp_tx_config) -{ - return 1; -} diff --git a/usrp/host/lib/usrp_config.h b/usrp/host/lib/usrp_config.h deleted file mode 100644 index ee5cb63bd..000000000 --- a/usrp/host/lib/usrp_config.h +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003 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 _USRP_CONFIG_H_ -#define _USRP_CONFIG_H_ - -/* - * ---------------------------------------------------------------- - * USRP Rx configurations. - * - * For now this is a placeholder, but will eventually specify the - * mapping from A/D outputs to DDC inputs (I & Q). - * - * What's implemented today is a single DDC that has its I input - * connected to ADC0 and its Q input connected to ADC1 - * ---------------------------------------------------------------- - */ - -#define USRP_RX_CONFIG_DEFAULT 0 - -/*! - * given a usrp_rx_config word, return the number of I & Q streams that - * are interleaved on the USB. - */ - -int usrp_rx_config_stream_count (unsigned int usrp_rx_config); - -/* - * USRP Tx configurations. - * - * For now this is a placeholder, but will eventually specify the - * mapping from DUC outputs to D/A inputs. - * - * What's implemented today is a single DUC that has its I output - * connected to DAC0 and its Q output connected to DAC1 - */ - -#define USRP_TX_CONFIG_DEFAULT 0 - -/*! - * given a usrp_tx_config word, return the number of I & Q streams that - * are interleaved on the USB. - */ - -int usrp_tx_config_stream_count (unsigned int usrp_tx_config); - - -#endif /* _USRP_CONFIG_H_ */ diff --git a/usrp/host/lib/usrp_dbid.dat b/usrp/host/lib/usrp_dbid.dat deleted file mode 100644 index 2548d737e..000000000 --- a/usrp/host/lib/usrp_dbid.dat +++ /dev/null @@ -1,93 +0,0 @@ -# -# Copyright 2005,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. -# - -# This file is used to generate usrp_dbid.h, usrp_dbid.cc and usrp_dbid.py - -"Basic Tx" 0x0000 -"Basic Rx" 0x0001 -"DBS Rx" 0x0002 -"TV Rx" 0x0003 - -"Flex 400 Rx" 0x0004 -"Flex 900 Rx" 0x0005 -"Flex 1200 Rx" 0x0006 -"Flex 2400 Rx" 0x0007 - -"Flex 400 Tx" 0x0008 -"Flex 900 Tx" 0x0009 -"Flex 1200 Tx" 0x000a -"Flex 2400 Tx" 0x000b - -"TV Rx Rev 2" 0x000c -"DBS Rx ClkMod" 0x000d - -"LF Tx" 0x000e -"LF Rx" 0x000f - -"Flex 400 Rx MIMO A" 0x0014 -"Flex 900 Rx MIMO A" 0x0015 -"Flex 1200 Rx MIMO A" 0x0016 -"Flex 2400 Rx MIMO A" 0x0017 - -"Flex 400 Tx MIMO A" 0x0018 -"Flex 900 Tx MIMO A" 0x0019 -"Flex 1200 Tx MIMO A" 0x001a -"Flex 2400 Tx MIMO A" 0x001b - -"Flex 400 Rx MIMO B" 0x0024 -"Flex 900 Rx MIMO B" 0x0025 -"Flex 1200 Rx MIMO B" 0x0026 -"Flex 2400 Rx MIMO B" 0x0027 - -"Flex 400 Tx MIMO B" 0x0028 -"Flex 900 Tx MIMO B" 0x0029 -"Flex 1200 Tx MIMO B" 0x002a -"Flex 2400 Tx MIMO B" 0x002b - -"Flex 2200 Rx MIMO B" 0x002c -"Flex 2200 Tx MIMO B" 0x002d - -"Flex 1800 Rx" 0x0030 -"Flex 1800 Tx" 0x0031 -"Flex 1800 Rx MIMO A" 0x0032 -"Flex 1800 Tx MIMO A" 0x0033 -"Flex 1800 Rx MIMO B" 0x0034 -"Flex 1800 Tx MIMO B" 0x0035 - -"TV Rx Rev 3" 0x0040 -"DTT754" 0x0041 -"DTT768" 0x0042 -"TV Rx MIMO" 0x0043 -"TV Rx Rev 2 MIMO" 0x0044 -"TV Rx Rev 3 MIMO" 0x0045 - -"WBX LO TX" 0x0050 -"WBX LO RX" 0x0051 - -"WBX NG TX" 0x0052 -"WBX NG RX" 0x0053 - -"XCVR2450 Tx" 0x0060 -"XCVR2450 Rx" 0x0061 - -"Bitshark Rx" 0x0070 - -"Experimental Tx" 0xfffe -"Experimental Rx" 0xffff diff --git a/usrp/host/lib/usrp_local_sighandler.cc b/usrp/host/lib/usrp_local_sighandler.cc deleted file mode 100644 index 59013972e..000000000 --- a/usrp/host/lib/usrp_local_sighandler.cc +++ /dev/null @@ -1,191 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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. - */ - -/* - * This is actually the same as gr_local_signhandler, but with a different name. - * We don't have a common library to put this in, so... - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <usrp/usrp_local_sighandler.h> -#include <stdexcept> -#include <stdio.h> -#include <string.h> - -usrp_local_sighandler::usrp_local_sighandler (int signum, - void (*new_handler)(int)) - : d_signum (signum) -{ -#ifdef HAVE_SIGACTION - struct sigaction new_action; - memset (&new_action, 0, sizeof (new_action)); - - new_action.sa_handler = new_handler; - sigemptyset (&new_action.sa_mask); - new_action.sa_flags = 0; - - if (sigaction (d_signum, &new_action, &d_old_action) < 0){ - perror ("sigaction (install new)"); - throw std::runtime_error ("sigaction"); - } -#endif -} - -usrp_local_sighandler::~usrp_local_sighandler () -{ -#ifdef HAVE_SIGACTION - if (sigaction (d_signum, &d_old_action, 0) < 0){ - perror ("sigaction (restore old)"); - throw std::runtime_error ("sigaction"); - } -#endif -} - -void -usrp_local_sighandler::throw_signal(int signum) throw(usrp_signal) -{ - throw usrp_signal (signum); -} - -/* - * Semi-hideous way to may a signal number into a signal name - */ - -#define SIGNAME(x) case x: return #x - -std::string -usrp_signal::name () const -{ - char tmp[128]; - - switch (signal ()){ -#ifdef SIGHUP - SIGNAME (SIGHUP); -#endif -#ifdef SIGINT - SIGNAME (SIGINT); -#endif -#ifdef SIGQUIT - SIGNAME (SIGQUIT); -#endif -#ifdef SIGILL - SIGNAME (SIGILL); -#endif -#ifdef SIGTRAP - SIGNAME (SIGTRAP); -#endif -#ifdef SIGABRT - SIGNAME (SIGABRT); -#endif -#ifdef SIGBUS - SIGNAME (SIGBUS); -#endif -#ifdef SIGFPE - SIGNAME (SIGFPE); -#endif -#ifdef SIGKILL - SIGNAME (SIGKILL); -#endif -#ifdef SIGUSR1 - SIGNAME (SIGUSR1); -#endif -#ifdef SIGSEGV - SIGNAME (SIGSEGV); -#endif -#ifdef SIGUSR2 - SIGNAME (SIGUSR2); -#endif -#ifdef SIGPIPE - SIGNAME (SIGPIPE); -#endif -#ifdef SIGALRM - SIGNAME (SIGALRM); -#endif -#ifdef SIGTERM - SIGNAME (SIGTERM); -#endif -#ifdef SIGSTKFLT - SIGNAME (SIGSTKFLT); -#endif -#ifdef SIGCHLD - SIGNAME (SIGCHLD); -#endif -#ifdef SIGCONT - SIGNAME (SIGCONT); -#endif -#ifdef SIGSTOP - SIGNAME (SIGSTOP); -#endif -#ifdef SIGTSTP - SIGNAME (SIGTSTP); -#endif -#ifdef SIGTTIN - SIGNAME (SIGTTIN); -#endif -#ifdef SIGTTOU - SIGNAME (SIGTTOU); -#endif -#ifdef SIGURG - SIGNAME (SIGURG); -#endif -#ifdef SIGXCPU - SIGNAME (SIGXCPU); -#endif -#ifdef SIGXFSZ - SIGNAME (SIGXFSZ); -#endif -#ifdef SIGVTALRM - SIGNAME (SIGVTALRM); -#endif -#ifdef SIGPROF - SIGNAME (SIGPROF); -#endif -#ifdef SIGWINCH - SIGNAME (SIGWINCH); -#endif -#ifdef SIGIO - SIGNAME (SIGIO); -#endif -#ifdef SIGPWR - SIGNAME (SIGPWR); -#endif -#ifdef SIGSYS - SIGNAME (SIGSYS); -#endif - default: -#if defined (HAVE_SNPRINTF) -#if defined (SIGRTMIN) && defined (SIGRTMAX) - if (signal () >= SIGRTMIN && signal () <= SIGRTMAX){ - snprintf (tmp, sizeof (tmp), "SIGRTMIN + %d", signal ()); - return tmp; - } -#endif - snprintf (tmp, sizeof (tmp), "SIGNAL %d", signal ()); - return tmp; -#else - return "Unknown signal"; -#endif - } -} diff --git a/usrp/host/lib/usrp_prims_common.cc b/usrp/host/lib/usrp_prims_common.cc deleted file mode 100644 index 20a55653c..000000000 --- a/usrp/host/lib/usrp_prims_common.cc +++ /dev/null @@ -1,1241 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003,2004,2006,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_primsi.h" -#include "usrp_commands.h" -#include "usrp_ids.h" -#include "usrp_i2c_addr.h" -#include "fpga_regs_common.h" -#include "fpga_regs_standard.h" -#include <errno.h> -#include <stdio.h> -#include <unistd.h> -#include <stdlib.h> -#include <string.h> -#include <ctype.h> -#include <time.h> // FIXME should check with autoconf (nanosleep) -#include <algorithm> -#include <ad9862.h> -#include <assert.h> -#include "std_paths.h" - -extern "C" { -#include "md5.h" -}; - -#define VERBOSE 0 - -using namespace ad9862; - -static const int FIRMWARE_HASH_SLOT = 0; -static const int FPGA_HASH_SLOT = 1; - -static const int hash_slot_addr[2] = { - USRP_HASH_SLOT_0_ADDR, - USRP_HASH_SLOT_1_ADDR -}; - -static const char *default_firmware_filename = "std.ihx"; -static const char *default_fpga_filename = "std_2rxhb_2tx.rbf"; - -static char * -find_file (const char *filename, int hw_rev) -{ - const char **sp = std_paths; - static char path[1000]; - char *s; - - s = getenv("USRP_PATH"); - if (s) { - snprintf (path, sizeof (path), "%s/rev%d/%s", s, hw_rev, filename); - if (access (path, R_OK) == 0) - return path; - } - - while (*sp){ - snprintf (path, sizeof (path), "%s/rev%d/%s", *sp, hw_rev, filename); - if (access (path, R_OK) == 0) - return path; - sp++; - } - return 0; -} - -static const char * -get_proto_filename(const std::string user_filename, const char *env_var, const char *def) -{ - if (user_filename.length() != 0) - return user_filename.c_str(); - - char *s = getenv(env_var); - if (s && *s) - return s; - - return def; -} - - -static void power_down_9862s (libusb_device_handle *udh); - - -// ---------------------------------------------------------------- - -/* - * q must be a real USRP, not an FX2. Return its hardware rev number. - */ - -int -usrp_hw_rev (libusb_device *q) -{ - libusb_device_descriptor desc = _get_usb_device_descriptor(q); - return desc.bcdDevice & 0x00FF; -} - -/* - * q must be a real USRP, not an FX2. Return true if it's configured. - */ -static bool -_usrp_configured_p (libusb_device *q) -{ - libusb_device_descriptor desc = _get_usb_device_descriptor(q); - return (desc.bcdDevice & 0xFF00) != 0; -} - -bool -usrp_usrp_p (libusb_device *q) -{ - libusb_device_descriptor desc = _get_usb_device_descriptor(q); - return (desc.idVendor == USB_VID_FSF - && desc.idProduct == USB_PID_FSF_USRP); -} - -bool -usrp_fx2_p (libusb_device *q) -{ - libusb_device_descriptor desc = _get_usb_device_descriptor(q); - return (desc.idVendor == USB_VID_CYPRESS - && desc.idProduct == USB_PID_CYPRESS_FX2); -} - -bool -usrp_usrp0_p (libusb_device *q) -{ - return usrp_usrp_p (q) && usrp_hw_rev (q) == 0; -} - -bool -usrp_usrp1_p (libusb_device *q) -{ - return usrp_usrp_p (q) && usrp_hw_rev (q) == 1; -} - -bool -usrp_usrp2_p (libusb_device *q) -{ - return usrp_usrp_p (q) && usrp_hw_rev (q) == 2; -} - - -bool -usrp_unconfigured_usrp_p (libusb_device *q) -{ - return usrp_usrp_p (q) && !_usrp_configured_p (q); -} - -bool -usrp_configured_usrp_p (libusb_device *q) -{ - return usrp_usrp_p (q) && _usrp_configured_p (q); -} - - -// ---------------------------------------------------------------- - - -libusb_device_handle * -usrp_open_cmd_interface (libusb_device *dev) -{ - return usrp_open_interface (dev, USRP_CMD_INTERFACE, USRP_CMD_ALTINTERFACE); -} - -libusb_device_handle * -usrp_open_rx_interface (libusb_device *dev) -{ - return usrp_open_interface (dev, USRP_RX_INTERFACE, USRP_RX_ALTINTERFACE); -} - -libusb_device_handle * -usrp_open_tx_interface (libusb_device *dev) -{ - return usrp_open_interface (dev, USRP_TX_INTERFACE, USRP_TX_ALTINTERFACE); -} - - -// ---------------------------------------------------------------- -// write internal ram using Cypress vendor extension - -static bool -write_internal_ram (libusb_device_handle *udh, unsigned char *buf, - int start_addr, size_t len) -{ - int addr; - int n; - int a; - int quanta = MAX_EP0_PKTSIZE; - - for (addr = start_addr; addr < start_addr + (int) len; addr += quanta){ - n = len + start_addr - addr; - if (n > quanta) - n = quanta; - - a = _usb_control_transfer (udh, 0x40, 0xA0, addr, 0, - (unsigned char*)(buf + (addr - start_addr)), n, 1000); - - if (a < 0){ - fprintf(stderr,"write_internal_ram failed\n"); - return false; - } - } - return true; -} - - -// ---------------------------------------------------------------- -// whack the CPUCS register using the upload RAM vendor extension - -static bool -reset_cpu (libusb_device_handle *udh, bool reset_p) -{ - unsigned char v; - - if (reset_p) - v = 1; // hold processor in reset - else - v = 0; // release reset - - return write_internal_ram (udh, &v, 0xE600, 1); -} - -// ---------------------------------------------------------------- -// Load intel format file into cypress FX2 (8051) - -static bool -_usrp_load_firmware (libusb_device_handle *udh, const char *filename, - unsigned char hash[USRP_HASH_SIZE]) -{ - FILE *f = fopen (filename, "ra"); - if (f == 0){ - perror (filename); - return false; - } - - if (!reset_cpu (udh, true)) // hold CPU in reset while loading firmware - goto fail; - - - char s[1024]; - int length; - int addr; - int type; - unsigned char data[256]; - unsigned char checksum, a; - unsigned int b; - int i; - - while (!feof(f)){ - fgets(s, sizeof (s), f); /* we should not use more than 263 bytes normally */ - if(s[0]!=':'){ - fprintf(stderr,"%s: invalid line: \"%s\"\n", filename, s); - goto fail; - } - sscanf(s+1, "%02x", &length); - sscanf(s+3, "%04x", &addr); - sscanf(s+7, "%02x", &type); - - if(type==0){ - - a=length+(addr &0xff)+(addr>>8)+type; - for(i=0;i<length;i++){ - sscanf (s+9+i*2,"%02x", &b); - data[i]=b; - a=a+data[i]; - } - - sscanf (s+9+length*2,"%02x", &b); - checksum=b; - if (((a+checksum)&0xff)!=0x00){ - fprintf (stderr, " ** Checksum failed: got 0x%02x versus 0x%02x\n", (-a)&0xff, checksum); - goto fail; - } - if (!write_internal_ram (udh, data, addr, length)) - goto fail; - } - else if (type == 0x01){ // EOF - break; - } - else if (type == 0x02){ - fprintf (stderr, "Extended address: whatever I do with it?\n"); - fprintf (stderr, "%s: invalid line: \"%s\"\n", filename, s); - goto fail; - } - } - - // we jam the hash value into the FX2 memory before letting - // the cpu out of reset. When it comes out of reset it - // may renumerate which will invalidate udh. - - if (!usrp_set_hash (udh, FIRMWARE_HASH_SLOT, hash)) - fprintf (stderr, "usrp: failed to write firmware hash slot\n"); - - if (!reset_cpu (udh, false)) // take CPU out of reset - goto fail; - - fclose (f); - return true; - - fail: - fclose (f); - return false; -} - -// ---------------------------------------------------------------- -// load fpga - -static bool -_usrp_load_fpga (libusb_device_handle *udh, const char *filename, - unsigned char hash[USRP_HASH_SIZE]) -{ - bool ok = true; - - FILE *fp = fopen (filename, "rb"); - if (fp == 0){ - perror (filename); - return false; - } - - unsigned char buf[MAX_EP0_PKTSIZE]; // 64 is max size of EP0 packet on FX2 - int n; - - usrp_set_led (udh, 1, 1); // led 1 on - - - // reset FPGA (and on rev1 both AD9862's, thus killing clock) - usrp_set_fpga_reset (udh, 1); // hold fpga in reset - - if (write_cmd (udh, VRQ_FPGA_LOAD, 0, FL_BEGIN, 0, 0) != 0) - goto fail; - - while ((n = fread (buf, 1, sizeof (buf), fp)) > 0){ - if (write_cmd (udh, VRQ_FPGA_LOAD, 0, FL_XFER, buf, n) != n) - goto fail; - } - - if (write_cmd (udh, VRQ_FPGA_LOAD, 0, FL_END, 0, 0) != 0) - goto fail; - - fclose (fp); - - if (!usrp_set_hash (udh, FPGA_HASH_SLOT, hash)) - fprintf (stderr, "usrp: failed to write fpga hash slot\n"); - - // On the rev1 USRP, the {tx,rx}_{enable,reset} bits are - // controlled over the serial bus, and hence aren't observed until - // we've got a good fpga bitstream loaded. - - usrp_set_fpga_reset (udh, 0); // fpga out of master reset - - // now these commands will work - - ok &= usrp_set_fpga_tx_enable (udh, 0); - ok &= usrp_set_fpga_rx_enable (udh, 0); - - ok &= usrp_set_fpga_tx_reset (udh, 1); // reset tx and rx paths - ok &= usrp_set_fpga_rx_reset (udh, 1); - ok &= usrp_set_fpga_tx_reset (udh, 0); // reset tx and rx paths - ok &= usrp_set_fpga_rx_reset (udh, 0); - - if (!ok) - fprintf (stderr, "usrp: failed to reset tx and/or rx path\n"); - - // Manually reset all regs except master control to zero. - // FIXME may want to remove this when we rework FPGA reset strategy. - // In the mean while, this gets us reproducible behavior. - for (int i = 0; i < FR_USER_0; i++){ - if (i == FR_MASTER_CTRL) - continue; - usrp_write_fpga_reg(udh, i, 0); - } - - power_down_9862s (udh); // on the rev1, power these down! - usrp_set_led (udh, 1, 0); // led 1 off - - return true; - - fail: - power_down_9862s (udh); // on the rev1, power these down! - fclose (fp); - return false; -} - -// ---------------------------------------------------------------- - -bool -usrp_set_led (libusb_device_handle *udh, int which, bool on) -{ - int r = write_cmd (udh, VRQ_SET_LED, on, which, 0, 0); - - return r == 0; -} - -bool -usrp_set_hash (libusb_device_handle *udh, int which, - const unsigned char hash[USRP_HASH_SIZE]) -{ - which &= 1; - - // we use the Cypress firmware down load command to jam it in. - int r = _usb_control_transfer (udh, 0x40, 0xa0, hash_slot_addr[which], 0, - (unsigned char *) hash, USRP_HASH_SIZE, 1000); - - if (r < 0) - fprintf (stderr, "usrp: failed to set hash\n"); - - return r == USRP_HASH_SIZE; -} - -bool -usrp_get_hash (libusb_device_handle *udh, int which, - unsigned char hash[USRP_HASH_SIZE]) -{ - which &= 1; - - // we use the Cypress firmware upload command to fetch it. - int r = _usb_control_transfer (udh, 0xc0, 0xa0, hash_slot_addr[which], 0, - (unsigned char *) hash, USRP_HASH_SIZE, 1000); - - if (r < 0) - fprintf (stderr, "usrp: failed to get hash\n"); - - return r == USRP_HASH_SIZE; -} - - - -static bool -usrp_set_switch (libusb_device_handle *udh, int cmd_byte, bool on) -{ - return write_cmd (udh, cmd_byte, on, 0, 0, 0) == 0; -} - -static bool -usrp1_fpga_write (libusb_device_handle *udh, - int regno, int value) -{ - // on the rev1 usrp, we use the generic spi_write interface - - unsigned char buf[4]; - - buf[0] = (value >> 24) & 0xff; // MSB first - buf[1] = (value >> 16) & 0xff; - buf[2] = (value >> 8) & 0xff; - buf[3] = (value >> 0) & 0xff; - - return usrp_spi_write (udh, 0x00 | (regno & 0x7f), - SPI_ENABLE_FPGA, - SPI_FMT_MSB | SPI_FMT_HDR_1, - buf, sizeof (buf)); -} - -static bool -usrp1_fpga_read (libusb_device_handle *udh, - int regno, int *value) -{ - *value = 0; - unsigned char buf[4]; - - bool ok = usrp_spi_read (udh, 0x80 | (regno & 0x7f), - SPI_ENABLE_FPGA, - SPI_FMT_MSB | SPI_FMT_HDR_1, - buf, sizeof (buf)); - - if (ok) - *value = (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3]; - - return ok; -} - -bool -usrp_write_fpga_reg (libusb_device_handle *udh, int reg, int value) -{ - switch (usrp_hw_rev (_get_usb_device (udh))){ - case 0: // not supported ;) - abort(); - - default: - return usrp1_fpga_write (udh, reg, value); - } -} - -bool -usrp_read_fpga_reg (libusb_device_handle *udh, int reg, int *value) -{ - switch (usrp_hw_rev (_get_usb_device (udh))){ - case 0: // not supported ;) - abort(); - - default: - return usrp1_fpga_read (udh, reg, value); - } -} - -bool -usrp_set_fpga_reset (libusb_device_handle *udh, bool on) -{ - return usrp_set_switch (udh, VRQ_FPGA_SET_RESET, on); -} - -bool -usrp_set_fpga_tx_enable (libusb_device_handle *udh, bool on) -{ - return usrp_set_switch (udh, VRQ_FPGA_SET_TX_ENABLE, on); -} - -bool -usrp_set_fpga_rx_enable (libusb_device_handle *udh, bool on) -{ - return usrp_set_switch (udh, VRQ_FPGA_SET_RX_ENABLE, on); -} - -bool -usrp_set_fpga_tx_reset (libusb_device_handle *udh, bool on) -{ - return usrp_set_switch (udh, VRQ_FPGA_SET_TX_RESET, on); -} - -bool -usrp_set_fpga_rx_reset (libusb_device_handle *udh, bool on) -{ - return usrp_set_switch (udh, VRQ_FPGA_SET_RX_RESET, on); -} - - -// ---------------------------------------------------------------- -// conditional load stuff - -static bool -compute_hash (const char *filename, unsigned char hash[USRP_HASH_SIZE]) -{ - assert (USRP_HASH_SIZE == 16); - memset (hash, 0, USRP_HASH_SIZE); - - FILE *fp = fopen (filename, "rb"); - if (fp == 0){ - perror (filename); - return false; - } - int r = md5_stream (fp, hash); - fclose (fp); - - return r == 0; -} - -static usrp_load_status_t -usrp_conditionally_load_something (libusb_device_handle *udh, - const char *filename, - bool force, - int slot, - bool loader (libusb_device_handle *, - const char *, - unsigned char [USRP_HASH_SIZE])) -{ - unsigned char file_hash[USRP_HASH_SIZE]; - unsigned char usrp_hash[USRP_HASH_SIZE]; - - if (access (filename, R_OK) != 0){ - perror (filename); - return ULS_ERROR; - } - - if (!compute_hash (filename, file_hash)) - return ULS_ERROR; - - if (!force - && usrp_get_hash (udh, slot, usrp_hash) - && memcmp (file_hash, usrp_hash, USRP_HASH_SIZE) == 0) - return ULS_ALREADY_LOADED; - - bool r = loader (udh, filename, file_hash); - - if (!r) - return ULS_ERROR; - - return ULS_OK; -} - -usrp_load_status_t -usrp_load_firmware (libusb_device_handle *udh, - const char *filename, - bool force) -{ - return usrp_conditionally_load_something (udh, filename, force, - FIRMWARE_HASH_SLOT, - _usrp_load_firmware); -} - -usrp_load_status_t -usrp_load_fpga (libusb_device_handle *udh, - const char *filename, - bool force) -{ - return usrp_conditionally_load_something (udh, filename, force, - FPGA_HASH_SLOT, - _usrp_load_fpga); -} - -static libusb_device_handle * -open_nth_cmd_interface (int nth, libusb_context *ctx) -{ - - libusb_device *udev = usrp_find_device (nth, false, ctx); - if (udev == 0){ - fprintf (stderr, "usrp: failed to find usrp[%d]\n", nth); - return 0; - } - - libusb_device_handle *udh; - - udh = usrp_open_cmd_interface (udev); - if (udh == 0){ - // FIXME this could be because somebody else has it open. - // We should delay and retry... - fprintf (stderr, "open_nth_cmd_interface: open_cmd_interface failed\n"); - return 0; - } - - return udh; -} - -static bool -our_nanosleep (const struct timespec *delay) -{ - struct timespec new_delay = *delay; - struct timespec remainder; - - while (1){ - int r = nanosleep (&new_delay, &remainder); - if (r == 0) - return true; - if (errno == EINTR) - new_delay = remainder; - else { - perror ("nanosleep"); - return false; - } - } -} - -static bool -mdelay (int millisecs) -{ - struct timespec ts; - ts.tv_sec = millisecs / 1000; - ts.tv_nsec = (millisecs - (1000 * ts.tv_sec)) * 1000000; - return our_nanosleep (&ts); -} - - -usrp_load_status_t -usrp_load_firmware_nth (int nth, const char *filename, bool force, libusb_context *ctx) -{ - libusb_device_handle *udh = open_nth_cmd_interface (nth, ctx); - if (udh == 0) - return ULS_ERROR; - - usrp_load_status_t s = usrp_load_firmware (udh, filename, force); - usrp_close_interface (udh); - - switch (s){ - - case ULS_ALREADY_LOADED: // nothing changed... - return ULS_ALREADY_LOADED; - break; - - case ULS_OK: - // we loaded firmware successfully. - - // It's highly likely that the board will renumerate (simulate a - // disconnect/reconnect sequence), invalidating our current - // handle. - - // FIXME. Turn this into a loop that rescans until we refind ourselves - - struct timespec t; // delay for 2 second - t.tv_sec = 2; - t.tv_nsec = 0; - our_nanosleep (&t); - - usrp_rescan (); - - return ULS_OK; - - default: - case ULS_ERROR: // some kind of problem - return ULS_ERROR; - } -} - -static void -load_status_msg (usrp_load_status_t s, const char *type, const char *filename) -{ - char *e = getenv("USRP_VERBOSE"); - bool verbose = e != 0; - - switch (s){ - case ULS_ERROR: - fprintf (stderr, "usrp: failed to load %s %s.\n", type, filename); - break; - - case ULS_ALREADY_LOADED: - if (verbose) - fprintf (stderr, "usrp: %s %s already loaded.\n", type, filename); - break; - - case ULS_OK: - if (verbose) - fprintf (stderr, "usrp: %s %s loaded successfully.\n", type, filename); - break; - } -} - -bool -usrp_load_standard_bits (int nth, bool force, - const std::string fpga_filename, - const std::string firmware_filename, - libusb_context *ctx) -{ - usrp_load_status_t s; - const char *filename; - const char *proto_filename; - int hw_rev; - - // first, figure out what hardware rev we're dealing with - { - libusb_device *udev = usrp_find_device (nth, false, ctx); - if (udev == 0){ - fprintf (stderr, "usrp: failed to find usrp[%d]\n", nth); - return false; - } - hw_rev = usrp_hw_rev (udev); - } - - // start by loading the firmware - - proto_filename = get_proto_filename(firmware_filename, "USRP_FIRMWARE", - default_firmware_filename); - filename = find_file(proto_filename, hw_rev); - if (filename == 0){ - fprintf (stderr, "Can't find firmware: %s\n", proto_filename); - return false; - } - s = usrp_load_firmware_nth (nth, filename, force, ctx); - load_status_msg (s, "firmware", filename); - - if (s == ULS_ERROR) - return false; - - // if we actually loaded firmware, we must reload fpga ... - if (s == ULS_OK) - force = true; - - // now move on to the fpga configuration bitstream - - proto_filename = get_proto_filename(fpga_filename, "USRP_FPGA", - default_fpga_filename); - filename = find_file (proto_filename, hw_rev); - if (filename == 0){ - fprintf (stderr, "Can't find fpga bitstream: %s\n", proto_filename); - return false; - } - libusb_device_handle *udh = open_nth_cmd_interface (nth, ctx); - if (udh == 0) - return false; - - s = usrp_load_fpga (udh, filename, force); - usrp_close_interface (udh); - load_status_msg (s, "fpga bitstream", filename); - - if (s == ULS_ERROR) - return false; - - return true; -} - - -bool -_usrp_get_status (libusb_device_handle *udh, int which, bool *trouble) -{ - unsigned char status; - *trouble = true; - - if (write_cmd (udh, VRQ_GET_STATUS, 0, which, - &status, sizeof (status)) != sizeof (status)) - return false; - - *trouble = status; - return true; -} - -bool -usrp_check_rx_overrun (libusb_device_handle *udh, bool *overrun_p) -{ - return _usrp_get_status (udh, GS_RX_OVERRUN, overrun_p); -} - -bool -usrp_check_tx_underrun (libusb_device_handle *udh, bool *underrun_p) -{ - return _usrp_get_status (udh, GS_TX_UNDERRUN, underrun_p); -} - - -bool -usrp_i2c_write (libusb_device_handle *udh, int i2c_addr, - const void *buf, int len) -{ - if (len < 1 || len > MAX_EP0_PKTSIZE) - return false; - - return write_cmd (udh, VRQ_I2C_WRITE, i2c_addr, 0, - (unsigned char *) buf, len) == len; -} - - -bool -usrp_i2c_read (libusb_device_handle *udh, int i2c_addr, - void *buf, int len) -{ - if (len < 1 || len > MAX_EP0_PKTSIZE) - return false; - - return write_cmd (udh, VRQ_I2C_READ, i2c_addr, 0, - (unsigned char *) buf, len) == len; -} - -bool -usrp_spi_write (libusb_device_handle *udh, - int optional_header, int enables, int format, - const void *buf, int len) -{ - if (len < 0 || len > MAX_EP0_PKTSIZE) - return false; - - return write_cmd (udh, VRQ_SPI_WRITE, - optional_header, - ((enables & 0xff) << 8) | (format & 0xff), - (unsigned char *) buf, len) == len; -} - - -bool -usrp_spi_read (libusb_device_handle *udh, - int optional_header, int enables, int format, - void *buf, int len) -{ - if (len < 0 || len > MAX_EP0_PKTSIZE) - return false; - - return write_cmd (udh, VRQ_SPI_READ, - optional_header, - ((enables & 0xff) << 8) | (format & 0xff), - (unsigned char *) buf, len) == len; -} - -bool -usrp_9862_write (libusb_device_handle *udh, int which_codec, - int regno, int value) -{ - if (0) - fprintf (stderr, "usrp_9862_write which = %d, reg = %2d, val = %3d (0x%02x)\n", - which_codec, regno, value, value); - - unsigned char buf[1]; - - buf[0] = value; - - return usrp_spi_write (udh, 0x00 | (regno & 0x3f), - which_codec == 0 ? SPI_ENABLE_CODEC_A : SPI_ENABLE_CODEC_B, - SPI_FMT_MSB | SPI_FMT_HDR_1, - buf, 1); -} - -bool -usrp_9862_read (libusb_device_handle *udh, int which_codec, - int regno, unsigned char *value) -{ - return usrp_spi_read (udh, 0x80 | (regno & 0x3f), - which_codec == 0 ? SPI_ENABLE_CODEC_A : SPI_ENABLE_CODEC_B, - SPI_FMT_MSB | SPI_FMT_HDR_1, - value, 1); -} - -bool -usrp_9862_write_many (libusb_device_handle *udh, - int which_codec, - const unsigned char *buf, - int len) -{ - if (len & 0x1) - return false; // must be even - - bool result = true; - - while (len > 0){ - result &= usrp_9862_write (udh, which_codec, buf[0], buf[1]); - len -= 2; - buf += 2; - } - - return result; -} - - -bool -usrp_9862_write_many_all (libusb_device_handle *udh, - const unsigned char *buf, int len) -{ - // FIXME handle 2/2 and 4/4 versions - - bool result; - result = usrp_9862_write_many (udh, 0, buf, len); - result &= usrp_9862_write_many (udh, 1, buf, len); - return result; -} - -static void -power_down_9862s (libusb_device_handle *udh) -{ - static const unsigned char regs[] = { - REG_RX_PWR_DN, 0x01, // everything - REG_TX_PWR_DN, 0x0f, // pwr dn digital and analog_both - REG_TX_MODULATOR, 0x00 // coarse & fine modulators disabled - }; - - switch (usrp_hw_rev (_get_usb_device (udh))){ - case 0: - break; - - default: - usrp_9862_write_many_all (udh, regs, sizeof (regs)); - break; - } -} - - -static const int EEPROM_PAGESIZE = 16; - -bool -usrp_eeprom_write (libusb_device_handle *udh, int i2c_addr, - int eeprom_offset, const void *buf, int len) -{ - unsigned char cmd[2]; - const unsigned char *p = (unsigned char *) buf; - - // The simplest thing that could possibly work: - // all writes are single byte writes. - // - // We could speed this up using the page write feature, - // but we write so infrequently, why bother... - - while (len-- > 0){ - cmd[0] = eeprom_offset++; - cmd[1] = *p++; - bool r = usrp_i2c_write (udh, i2c_addr, cmd, sizeof (cmd)); - mdelay (10); // delay 10ms worst case write time - if (!r) - return false; - } - - return true; -} - -bool -usrp_eeprom_read (libusb_device_handle *udh, int i2c_addr, - int eeprom_offset, void *buf, int len) -{ - unsigned char *p = (unsigned char *) buf; - - // We setup a random read by first doing a "zero byte write". - // Writes carry an address. Reads use an implicit address. - - unsigned char cmd[1]; - cmd[0] = eeprom_offset; - if (!usrp_i2c_write (udh, i2c_addr, cmd, sizeof (cmd))) - return false; - - while (len > 0){ - int n = std::min (len, MAX_EP0_PKTSIZE); - if (!usrp_i2c_read (udh, i2c_addr, p, n)) - return false; - len -= n; - p += n; - } - return true; -} - -// ---------------------------------------------------------------- - -static bool -slot_to_codec (int slot, int *which_codec) -{ - *which_codec = 0; - - switch (slot){ - case SLOT_TX_A: - case SLOT_RX_A: - *which_codec = 0; - break; - - case SLOT_TX_B: - case SLOT_RX_B: - *which_codec = 1; - break; - - default: - fprintf (stderr, "usrp_prims:slot_to_codec: invalid slot = %d\n", slot); - return false; - } - return true; -} - -static bool -tx_slot_p (int slot) -{ - switch (slot){ - case SLOT_TX_A: - case SLOT_TX_B: - return true; - - default: - return false; - } -} - -bool -usrp_write_aux_dac (libusb_device_handle *udh, int slot, - int which_dac, int value) -{ - int which_codec; - - if (!slot_to_codec (slot, &which_codec)) - return false; - - if (!(0 <= which_dac && which_dac < 4)){ - fprintf (stderr, "usrp_write_aux_dac: invalid dac = %d\n", which_dac); - return false; - } - - value &= 0x0fff; // mask to 12-bits - - if (which_dac == 3){ - // dac 3 is really 12-bits. Use value as is. - bool r = true; - r &= usrp_9862_write (udh, which_codec, 43, (value >> 4)); // most sig - r &= usrp_9862_write (udh, which_codec, 42, (value & 0xf) << 4); // least sig - return r; - } - else { - // dac 0, 1, and 2 are really 8 bits. - value = value >> 4; // shift value appropriately - return usrp_9862_write (udh, which_codec, 36 + which_dac, value); - } -} - - -bool -usrp_read_aux_adc (libusb_device_handle *udh, int slot, - int which_adc, int *value) -{ - *value = 0; - int which_codec; - - if (!slot_to_codec (slot, &which_codec)) - return false; - - if (!(0 <= which_codec && which_codec < 2)){ - fprintf (stderr, "usrp_read_aux_adc: invalid adc = %d\n", which_adc); - return false; - } - - unsigned char aux_adc_control = - AUX_ADC_CTRL_REFSEL_A // on chip reference - | AUX_ADC_CTRL_REFSEL_B; // on chip reference - - int rd_reg = 26; // base address of two regs to read for result - - // program the ADC mux bits - if (tx_slot_p (slot)) - aux_adc_control |= AUX_ADC_CTRL_SELECT_A2 | AUX_ADC_CTRL_SELECT_B2; - else { - rd_reg += 2; - aux_adc_control |= AUX_ADC_CTRL_SELECT_A1 | AUX_ADC_CTRL_SELECT_B1; - } - - // I'm not sure if we can set the mux and issue a start conversion - // in the same cycle, so let's do them one at a time. - - usrp_9862_write (udh, which_codec, 34, aux_adc_control); - - if (which_adc == 0) - aux_adc_control |= AUX_ADC_CTRL_START_A; - else { - rd_reg += 4; - aux_adc_control |= AUX_ADC_CTRL_START_B; - } - - // start the conversion - usrp_9862_write (udh, which_codec, 34, aux_adc_control); - - // read the 10-bit result back - unsigned char v_lo = 0; - unsigned char v_hi = 0; - bool r = usrp_9862_read (udh, which_codec, rd_reg, &v_lo); - r &= usrp_9862_read (udh, which_codec, rd_reg + 1, &v_hi); - - if (r) - *value = ((v_hi << 2) | ((v_lo >> 6) & 0x3)) << 2; // format as 12-bit - - return r; -} - -// ---------------------------------------------------------------- - -static int slot_to_i2c_addr (int slot) -{ - switch (slot){ - case SLOT_TX_A: return I2C_ADDR_TX_A; - case SLOT_RX_A: return I2C_ADDR_RX_A; - case SLOT_TX_B: return I2C_ADDR_TX_B; - case SLOT_RX_B: return I2C_ADDR_RX_B; - default: return -1; - } -} - -static void -set_chksum (unsigned char *buf) -{ - int sum = 0; - unsigned int i; - for (i = 0; i < DB_EEPROM_CLEN - 1; i++) - sum += buf[i]; - buf[i] = -sum; -} - -static usrp_dbeeprom_status_t -read_dboard_eeprom (libusb_device_handle *udh, - int slot_id, unsigned char *buf) -{ - int i2c_addr = slot_to_i2c_addr (slot_id); - if (i2c_addr == -1) - return UDBE_BAD_SLOT; - - if (!usrp_eeprom_read (udh, i2c_addr, 0, buf, DB_EEPROM_CLEN)) - return UDBE_NO_EEPROM; - - if (buf[DB_EEPROM_MAGIC] != DB_EEPROM_MAGIC_VALUE) - return UDBE_INVALID_EEPROM; - - int sum = 0; - for (unsigned int i = 0; i < DB_EEPROM_CLEN; i++) - sum += buf[i]; - - if ((sum & 0xff) != 0) - return UDBE_INVALID_EEPROM; - - return UDBE_OK; -} - -usrp_dbeeprom_status_t -usrp_read_dboard_eeprom (libusb_device_handle *udh, - int slot_id, usrp_dboard_eeprom *eeprom) -{ - unsigned char buf[DB_EEPROM_CLEN]; - - memset (eeprom, 0, sizeof (*eeprom)); - - usrp_dbeeprom_status_t s = read_dboard_eeprom (udh, slot_id, buf); - if (s != UDBE_OK) - return s; - - eeprom->id = (buf[DB_EEPROM_ID_MSB] << 8) | buf[DB_EEPROM_ID_LSB]; - eeprom->oe = (buf[DB_EEPROM_OE_MSB] << 8) | buf[DB_EEPROM_OE_LSB]; - eeprom->offset[0] = (buf[DB_EEPROM_OFFSET_0_MSB] << 8) | buf[DB_EEPROM_OFFSET_0_LSB]; - eeprom->offset[1] = (buf[DB_EEPROM_OFFSET_1_MSB] << 8) | buf[DB_EEPROM_OFFSET_1_LSB]; - - return UDBE_OK; -} - -bool -usrp_write_dboard_offsets (libusb_device_handle *udh, int slot_id, - short offset0, short offset1) -{ - unsigned char buf[DB_EEPROM_CLEN]; - - usrp_dbeeprom_status_t s = read_dboard_eeprom (udh, slot_id, buf); - if (s != UDBE_OK) - return false; - - buf[DB_EEPROM_OFFSET_0_LSB] = (offset0 >> 0) & 0xff; - buf[DB_EEPROM_OFFSET_0_MSB] = (offset0 >> 8) & 0xff; - buf[DB_EEPROM_OFFSET_1_LSB] = (offset1 >> 0) & 0xff; - buf[DB_EEPROM_OFFSET_1_MSB] = (offset1 >> 8) & 0xff; - set_chksum (buf); - - return usrp_eeprom_write (udh, slot_to_i2c_addr (slot_id), - 0, buf, sizeof (buf)); -} - -// ---------------------------------------------------------------- - -std::string -usrp_serial_number(libusb_device_handle *udh) -{ - libusb_device_descriptor desc = - _get_usb_device_descriptor (_get_usb_device (udh)); - - unsigned char iserial = desc.iSerialNumber; - if (iserial == 0) - return ""; - - unsigned char buf[1024]; - if (_get_usb_string_descriptor (udh, iserial, buf, sizeof(buf)) < 0) - return ""; - - return (char*) buf; -} - - - - diff --git a/usrp/host/lib/usrp_prims_libusb0.cc b/usrp/host/lib/usrp_prims_libusb0.cc deleted file mode 100644 index 4fbfabea9..000000000 --- a/usrp/host/lib/usrp_prims_libusb0.cc +++ /dev/null @@ -1,230 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003,2004,2006,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_primsi.h" -#include "usrp_commands.h" -#include <usb.h> -#include <errno.h> -#include <stdio.h> -#include <unistd.h> -#include <stdlib.h> -#include <string.h> -#include <ctype.h> -#include <ad9862.h> -#include <assert.h> - -extern "C" { -#include "md5.h" -}; - -using namespace ad9862; - -/* - * libusb 0.12 / 1.0 compatibility - */ - -struct usb_device * -_get_usb_device (struct usb_dev_handle *udh) -{ - return usb_device (udh); -} - -struct usb_device_descriptor -_get_usb_device_descriptor (struct usb_device *q) -{ - return q->descriptor; -} - -int -_get_usb_string_descriptor (struct usb_dev_handle *udh, int index, - unsigned char* data, int length) -{ - int ret; - ret = usb_get_string_simple (udh, index, (char*) data, length); - - if (ret < 0) { - fprintf (stderr, "usrp: usb_get_string_descriptor failed: %s\n", - usb_strerror()); - } - - return ret; -} - -int -_usb_control_transfer (struct usb_dev_handle *udh, int request_type, - int request, int value, int index, - unsigned char *data, int length, unsigned int timeout) -{ - int ret; - - ret = usb_control_msg (udh, request_type,request, value, index, - (char*) data, length, (int) timeout); - if (ret < 0) - fprintf (stderr, "usrp: usb_control_msg failed: %s\n", usb_strerror()); - - return ret; -} - - -// ---------------------------------------------------------------- - - -void -usrp_one_time_init (libusb_context **ctx) -{ - static bool first = true; - - if (first) { - first = false; - usb_init (); // usb library init - usb_find_busses (); - usb_find_devices (); - } -} - -void -usrp_deinit (libusb_context *ctx) -{ - // nop -} - -void -usrp_rescan () -{ - usb_find_busses (); - usb_find_devices (); -} - - -// ---------------------------------------------------------------- - - -struct usb_device * -usrp_find_device (int nth, bool fx2_ok_p, libusb_context *ctx) -{ - struct usb_bus *p; - struct usb_device *q; - int n_found = 0; - - usrp_one_time_init (); - - p = usb_get_busses(); - while (p != NULL){ - q = p->devices; - while (q != NULL){ - if (usrp_usrp_p (q) || (fx2_ok_p && usrp_fx2_p (q))){ - if (n_found == nth) // return this one - return q; - n_found++; // keep looking - } - q = q->next; - } - p = p->next; - } - return 0; // not found -} - -struct usb_dev_handle * -usrp_open_interface (struct usb_device *dev, int interface, int altinterface) -{ - struct usb_dev_handle *udh = usb_open (dev); - if (udh == 0) - return 0; - - if (dev != usb_device (udh)){ - fprintf (stderr, "%s:%d: internal error!\n", __FILE__, __LINE__); - abort (); - } - -#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) - // There's no get get_configuration function, and with some of the newer kernels - // setting the configuration, even if to the same value, hoses any other processes - // that have it open. Hence we opt to not set it at all (We've only - // got a single configuration anyway). This may hose the win32 stuff... - - // Appears to be required for libusb-win32 and Cygwin -- dew 09/20/06 - if (usb_set_configuration (udh, 1) < 0){ - /* - * Ignore this error. - * - * Seems that something changed in drivers/usb/core/devio.c:proc_setconfig such that - * it returns -EBUSY if _any_ of the interfaces of a device are open. - * We've only got a single configuration, so setting it doesn't even seem - * like it should be required. - */ - } -#endif - - if (usb_claim_interface (udh, interface) < 0){ - fprintf (stderr, "%s:usb_claim_interface: failed interface %d\n", __FUNCTION__,interface); - fprintf (stderr, "%s\n", usb_strerror()); - usb_close (udh); - return 0; - } - - if (usb_set_altinterface (udh, altinterface) < 0){ - fprintf (stderr, "%s:usb_set_alt_interface: failed\n", __FUNCTION__); - fprintf (stderr, "%s\n", usb_strerror()); - usb_release_interface (udh, interface); - usb_close (udh); - return 0; - } - - return udh; -} - -bool -usrp_close_interface (struct usb_dev_handle *udh) -{ - // we're assuming that closing an interface automatically releases it. - return usb_close (udh) == 0; -} - - -// ---------------------------------------------------------------- -// write vendor extension command to USRP - - -int -write_cmd (struct usb_dev_handle *udh, - int request, int value, int index, - unsigned char *bytes, int len) -{ - int requesttype = (request & 0x80) ? VRT_VENDOR_IN : VRT_VENDOR_OUT; - - int r = usb_control_msg (udh, requesttype, request, value, index, - (char *) bytes, len, 1000); - if (r < 0){ - // we get EPIPE if the firmware stalls the endpoint. - if (errno != EPIPE) { - fprintf (stderr, "usb_control_msg failed: %s\n", usb_strerror ()); - fprintf (stderr, "write_cmd failed\n"); - } - } - - return r; -} - diff --git a/usrp/host/lib/usrp_prims_libusb1.cc b/usrp/host/lib/usrp_prims_libusb1.cc deleted file mode 100644 index 5dfe416e1..000000000 --- a/usrp/host/lib/usrp_prims_libusb1.cc +++ /dev/null @@ -1,276 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003,2004,2006,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_primsi.h" -#include "usrp_commands.h" -#include <libusb-1.0/libusb.h> -#include <errno.h> -#include <stdio.h> -#include <unistd.h> -#include <stdlib.h> -#include <string.h> -#include <ctype.h> -#include <ad9862.h> -#include <assert.h> - -extern "C" { -#include "md5.h" -}; - -using namespace ad9862; - -static const int LIBUSB1_DEBUG = 0; - -/* - * libusb 0.12 / 1.0 compatibility - */ - -static const char * -_get_usb_error_str (int usb_err) -{ - switch (usb_err) { - case LIBUSB_SUCCESS: - return "Success (no error)"; - case LIBUSB_ERROR_IO: - return "Input/output error"; - case LIBUSB_ERROR_INVALID_PARAM: - return "Invalid parameter"; - case LIBUSB_ERROR_ACCESS: - return "Access denied (insufficient permissions)"; - case LIBUSB_ERROR_NO_DEVICE: - return "No such device (it may have been disconnected)"; - case LIBUSB_ERROR_NOT_FOUND: - return "Entity not found"; - case LIBUSB_ERROR_BUSY: - return "Resource busy"; - case LIBUSB_ERROR_TIMEOUT: - return "Operation timed out"; - case LIBUSB_ERROR_OVERFLOW: - return "Overflow"; - case LIBUSB_ERROR_PIPE: - return "Pipe error"; - case LIBUSB_ERROR_INTERRUPTED: - return "System call interrupted (perhaps due to signal)"; - case LIBUSB_ERROR_NO_MEM: - return "Insufficient memory"; - case LIBUSB_ERROR_NOT_SUPPORTED: - return "Operation not supported or unimplemented on this platform"; - case LIBUSB_ERROR_OTHER: - return "Unknown error"; - } - - return "Unknown error"; -} - -struct libusb_device * -_get_usb_device (struct libusb_device_handle *udh) -{ - return libusb_get_device (udh); -} - -struct libusb_device_descriptor -_get_usb_device_descriptor(struct libusb_device *q) -{ - int ret; - struct libusb_device_descriptor desc; - - ret = libusb_get_device_descriptor(q, &desc); - - if (ret < 0) { - fprintf (stderr, "usrp: libusb_get_device_descriptor failed: %s\n", - _get_usb_error_str(ret)); - } - return desc; -} - -int -_get_usb_string_descriptor (struct libusb_device_handle *udh, int index, - unsigned char* data, int length) -{ - int ret; - ret = libusb_get_string_descriptor_ascii (udh, (uint8_t) index, data, length); - - if (ret < 0) { - fprintf (stderr, "usrp: libusb_get_string_descriptor_ascii failed: %s\n", - _get_usb_error_str(ret)); - } - return ret; -} - -int -_usb_control_transfer (struct libusb_device_handle *udh, int request_type, - int request, int value, int index, - unsigned char *data, int length, unsigned int timeout) -{ - int ret; - ret = libusb_control_transfer (udh, request_type, request, value, index, - data, length, timeout); - if (ret < 0) { - fprintf (stderr, "usrp: libusb_control_transfer failed: %s\n", - _get_usb_error_str(ret)); - } - return ret; -} - - -// ---------------------------------------------------------------- - - -void -usrp_one_time_init (libusb_context **ctx) -{ - int ret; - - if ((ret = libusb_init (ctx)) < 0) - fprintf (stderr, "usrp: libusb_init failed: %s\n", _get_usb_error_str(ret)); - - // Enable debug verbosity if requested. This will only work if the debug - // option is compiled into libusb and may produce a generous amount of output - // on stdout. If debug output is not compiled into libusb, this call does - // nothing. - if (LIBUSB1_DEBUG) - libusb_set_debug(*ctx, 3); -} - -void -usrp_deinit (struct libusb_context *ctx) -{ - // Each object _should_ be running in its own context. If running in default - // context then leave the instance open as it may be shared. - if (ctx != NULL) - libusb_exit (ctx); -} - -void -usrp_rescan () -{ - // nop -} - -struct libusb_device * -usrp_find_device (int nth, bool fx2_ok_p, libusb_context *ctx) -{ - libusb_device **list; - - struct libusb_device *q; - int n_found = 0; - - // Make sure not operating on default context. There are cases where operating - // with a single global (NULL) context may be preferable, so this check can be - // skipped if you know what you're doing. - assert (ctx != NULL); - - size_t cnt = libusb_get_device_list(ctx, &list); - size_t i = 0; - - if (cnt < 0) - fprintf(stderr, "usrp: libusb_get_device_list failed: %s\n", - _get_usb_error_str(cnt)); - - for (i = 0; i < cnt; i++) { - q = list[i]; - if (usrp_usrp_p (q) || (fx2_ok_p && usrp_fx2_p (q))) { - if (n_found == nth) // return this one - return q; - n_found++; // keep looking - } - } - - // The list needs to be freed. Right now just release it if nothing is found. - libusb_free_device_list(list, 1); - - return 0; // not found -} - -struct libusb_device_handle * -usrp_open_interface (libusb_device *dev, int interface, int altinterface) -{ - libusb_device_handle *udh; - int ret; - - if (libusb_open (dev, &udh) < 0) - return 0; - - if (dev != libusb_get_device (udh)){ - fprintf (stderr, "%s:%d: internal error!\n", __FILE__, __LINE__); - abort (); - } - - if ((ret = libusb_claim_interface (udh, interface)) < 0) { - fprintf (stderr, "%s:usb_claim_interface: failed interface %d\n", - __FUNCTION__, interface); - fprintf (stderr, "%s\n", _get_usb_error_str(ret)); - libusb_close (udh); - return 0; - } - - if ((ret = libusb_set_interface_alt_setting (udh, interface, - altinterface)) < 0) { - fprintf (stderr, "%s:usb_set_alt_interface: failed\n", __FUNCTION__); - fprintf (stderr, "%s\n", _get_usb_error_str(ret)); - libusb_release_interface (udh, interface); - libusb_close (udh); - return 0; - } - - return udh; -} - -bool -usrp_close_interface (libusb_device_handle *udh) -{ - // returns void - libusb_close(udh); - return 0; -} - - -// ---------------------------------------------------------------- -// write vendor extension command to USRP - - -int -write_cmd (struct libusb_device_handle *udh, - int request, int value, int index, - unsigned char *bytes, int len) -{ - int requesttype = (request & 0x80) ? VRT_VENDOR_IN : VRT_VENDOR_OUT; - - int ret = libusb_control_transfer(udh, requesttype, request, value, index, - bytes, len, 1000); - - if (ret < 0) { - // we get EPIPE if the firmware stalls the endpoint. - if (ret != LIBUSB_ERROR_PIPE) { - fprintf (stderr, "usrp: libusb_control_transfer failed: %s\n", - _get_usb_error_str(ret)); - fprintf (stderr, "usrp: write_cmd failed\n"); - } - } - - return ret; -} - diff --git a/usrp/host/lib/usrp_primsi.h b/usrp/host/lib/usrp_primsi.h deleted file mode 100644 index b1cf7263a..000000000 --- a/usrp/host/lib/usrp_primsi.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003,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. - */ - -/* - * Internal usrp_prims header file - */ - -#ifndef _USRP_PRIMSI_H_ -#define _USRP_PRIMSI_H_ - -#include "usrp/usrp_prims.h" - -/* - * Internal functions - */ - -libusb_device_handle * -usrp_open_interface(libusb_device *dev, int interface, int altinterface); - -int write_cmd (libusb_device_handle *udh, int request, int value, int index, - unsigned char *bytes, int len); - -/* - * Compatibility functions - */ - -libusb_device *_get_usb_device (libusb_device_handle *udh); - -libusb_device_descriptor _get_usb_device_descriptor (libusb_device *q); - -int _get_usb_string_descriptor (libusb_device_handle *udh, int index, - unsigned char* data, int length); - -int _usb_control_transfer (libusb_device_handle *udh, int request_type, - int request, int value, int index, - unsigned char *data, int length, - unsigned int timeout); - -#endif /* _USRP_PRIMSI_H_ */ - diff --git a/usrp/host/lib/usrp_standard.cc b/usrp/host/lib/usrp_standard.cc deleted file mode 100644 index fe5afabdb..000000000 --- a/usrp/host/lib/usrp_standard.cc +++ /dev/null @@ -1,1175 +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/usrp_standard.h> - -#include "usrp/usrp_prims.h" -#include "fpga_regs_common.h" -#include "fpga_regs_standard.h" -#include <stdexcept> -#include <assert.h> -#include <math.h> -#include <ad9862.h> -#include <cstdio> - - -static const int OLD_CAPS_VAL = 0xaa55ff77; -static const int DEFAULT_CAPS_VAL = ((2 << bmFR_RB_CAPS_NDUC_SHIFT) - | (2 << bmFR_RB_CAPS_NDDC_SHIFT) - | bmFR_RB_CAPS_RX_HAS_HALFBAND); - -// #define USE_FPGA_TX_CORDIC - - -using namespace ad9862; - -#define NELEM(x) (sizeof (x) / sizeof (x[0])) - - -void -usrp_standard_common::calc_dxc_freq(double target_freq, double baseband_freq, double fs, - double *dxc_freq, bool *inverted) -{ - /* - Calculate the frequency to use for setting the digital up or down converter. - - @param target_freq: desired RF frequency (Hz) - @param baseband_freq: the RF frequency that corresponds to DC in the IF. - @param fs: converter sample rate - - @returns: 2-tuple (ddc_freq, inverted) where ddc_freq is the value - for the ddc and inverted is True if we're operating in an inverted - Nyquist zone. - */ - -#if 0 - printf("calc_dxc_freq:\n"); - printf(" target = %f\n", target_freq); - printf(" baseband = %f\n", baseband_freq); - printf(" fs = %f\n", fs); -#endif - - double delta = target_freq - baseband_freq; - - if(delta >= 0) { - while(delta > fs) { - delta -= fs; - } - if(delta <= fs/2) { // non-inverted region - *dxc_freq = -delta; - *inverted = false; - } - else { // inverted region - *dxc_freq = delta - fs; - *inverted = true; - } - } - else { - while(delta < -fs) { - delta += fs; - } - if(delta >= -fs/2) { - *dxc_freq = -delta; // non-inverted region - *inverted = false; - } - else { // inverted region - *dxc_freq = delta + fs; - *inverted = true; - } - } - -#if 0 - printf(" dxc_freq = %f\n", *dxc_freq); - printf(" inverted = %s\n", *inverted ? "true" : "false"); -#endif -} - - -/* - * Real lambda expressions would be _so_ much easier... - */ -class dxc_control { -public: - virtual bool is_tx() = 0; - virtual bool set_dxc_freq(double dxc_freq) = 0; - virtual double dxc_freq() = 0; -}; - -class ddc_control : public dxc_control { - usrp_standard_rx *d_u; - int d_chan; - -public: - ddc_control(usrp_standard_rx *u, int chan) - : d_u(u), d_chan(chan) {} - - bool is_tx(){ return false; } - bool set_dxc_freq(double dxc_freq){ return d_u->set_rx_freq(d_chan, dxc_freq); } - double dxc_freq(){ return d_u->rx_freq(d_chan); } -}; - -class duc_control : public dxc_control { - usrp_standard_tx *d_u; - int d_chan; - -public: - duc_control(usrp_standard_tx *u, int chan) - : d_u(u), d_chan(chan) {} - - bool is_tx(){ return true; } - bool set_dxc_freq(double dxc_freq){ return d_u->set_tx_freq(d_chan, dxc_freq); } - double dxc_freq() { return d_u->tx_freq(d_chan); } -}; - - -/*! - * \brief Tune such that target_frequency ends up at DC in the complex baseband - * - * \param db the daughterboard to use - * \param target_freq the center frequency we want at baseband (DC) - * \param fs the sample rate - * \param dxc DDC or DUC access and control object - * \param[out] result details of what we did - * - * \returns true iff operation was successful - * - * Tuning is a two step process. First we ask the front-end to - * tune as close to the desired frequency as it can. Then we use - * the result of that operation and our target_frequency to - * determine the value for the digital down converter. - */ -static bool -tune_a_helper(db_base_sptr db, double target_freq, double fs, - dxc_control &dxc, usrp_tune_result *result) -{ - bool inverted = false; - double dxc_freq; - double actual_dxc_freq; - - // Ask the d'board to tune as closely as it can to target_freq -#if 0 - bool ok = db->set_freq(target_freq, &result->baseband_freq); -#else - bool ok; - { - freq_result_t fr = db->set_freq(target_freq); - ok = fr.ok; - result->baseband_freq = fr.baseband_freq; - } -#endif - - // Calculate the DDC setting that will downconvert the baseband from the - // daughterboard to our target frequency. - usrp_standard_common::calc_dxc_freq(target_freq, result->baseband_freq, fs, - &dxc_freq, &inverted); - - // If the spectrum is inverted, and the daughterboard doesn't do - // quadrature downconversion, we can fix the inversion by flipping the - // sign of the dxc_freq... (This only happens using the basic_rx board) - - if(db->spectrum_inverted()) - inverted = !inverted; - - if(inverted && !db->is_quadrature()){ - dxc_freq = -dxc_freq; - inverted = !inverted; - } - - if (dxc.is_tx() && !db->i_and_q_swapped()) // down conversion versus up conversion - dxc_freq = -dxc_freq; - - ok &= dxc.set_dxc_freq(dxc_freq); - actual_dxc_freq = dxc.dxc_freq(); - - result->dxc_freq = dxc_freq; - result->residual_freq = dxc_freq - actual_dxc_freq; - result->inverted = inverted; - return ok; -} - - -static unsigned int -compute_freq_control_word_fpga (double master_freq, double target_freq, - double *actual_freq, bool verbose) -{ - static const int NBITS = 14; - - int v = (int) rint (target_freq / master_freq * pow (2.0, 32.0)); - - if (0) - v = (v >> (32 - NBITS)) << (32 - NBITS); // keep only top NBITS - - *actual_freq = v * master_freq / pow (2.0, 32.0); - - if (verbose) - fprintf (stderr, - "compute_freq_control_word_fpga: target = %g actual = %g delta = %g\n", - target_freq, *actual_freq, *actual_freq - target_freq); - - return (unsigned int) v; -} - -// The 9862 uses an unsigned 24-bit frequency tuning word and -// a separate register to control the sign. - -static unsigned int -compute_freq_control_word_9862 (double master_freq, double target_freq, - double *actual_freq, bool verbose) -{ - double sign = 1.0; - - if (target_freq < 0) - sign = -1.0; - - int v = (int) rint (fabs (target_freq) / master_freq * pow (2.0, 24.0)); - *actual_freq = v * master_freq / pow (2.0, 24.0) * sign; - - if (verbose) - fprintf (stderr, - "compute_freq_control_word_9862: target = %g actual = %g delta = %g v = %8d\n", - target_freq, *actual_freq, *actual_freq - target_freq, v); - - return (unsigned int) v; -} - -// ---------------------------------------------------------------- - -usrp_standard_common::usrp_standard_common(usrp_basic *parent) -{ - // read new FPGA capability register - if (!parent->_read_fpga_reg(FR_RB_CAPS, &d_fpga_caps)){ - fprintf (stderr, "usrp_standard_common: failed to read FPGA cap register.\n"); - throw std::runtime_error ("usrp_standard_common::ctor"); - } - // If we don't have the cap register, set the value to what it would - // have had if we did have one ;) - if (d_fpga_caps == OLD_CAPS_VAL) - d_fpga_caps = DEFAULT_CAPS_VAL; - - if (0){ - fprintf(stdout, "has_rx_halfband = %d\n", has_rx_halfband()); - fprintf(stdout, "nddcs = %d\n", nddcs()); - fprintf(stdout, "has_tx_halfband = %d\n", has_tx_halfband()); - fprintf(stdout, "nducs = %d\n", nducs()); - } -} - -bool -usrp_standard_common::has_rx_halfband() const -{ - return (d_fpga_caps & bmFR_RB_CAPS_RX_HAS_HALFBAND) ? true : false; -} - -int -usrp_standard_common::nddcs() const -{ - return (d_fpga_caps & bmFR_RB_CAPS_NDDC_MASK) >> bmFR_RB_CAPS_NDDC_SHIFT; -} - -bool -usrp_standard_common::has_tx_halfband() const -{ - return (d_fpga_caps & bmFR_RB_CAPS_TX_HAS_HALFBAND) ? true : false; -} - -int -usrp_standard_common::nducs() const -{ - return (d_fpga_caps & bmFR_RB_CAPS_NDUC_MASK) >> bmFR_RB_CAPS_NDUC_SHIFT; -} - -// ---------------------------------------------------------------- - -static int -real_rx_mux_value (int mux, int nchan) -{ - if (mux != -1) - return mux; - - return 0x32103210; -} - -usrp_standard_rx::usrp_standard_rx (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 - ) - : usrp_basic_rx (which_board, fusb_block_size, fusb_nblocks, - fpga_filename, firmware_filename), - usrp_standard_common(this), - d_nchan (1), d_sw_mux (0x0), d_hw_mux (0x0) -{ - if (!set_format(make_format())){ - fprintf (stderr, "usrp_standard_rx: set_format failed\n"); - throw std::runtime_error ("usrp_standard_rx::ctor"); - } - if (!set_nchannels (nchan)){ - fprintf (stderr, "usrp_standard_rx: set_nchannels failed\n"); - throw std::runtime_error ("usrp_standard_rx::ctor"); - } - if (!set_decim_rate (decim_rate)){ - fprintf (stderr, "usrp_standard_rx: set_decim_rate failed\n"); - throw std::runtime_error ("usrp_standard_rx::ctor"); - } - if (!set_mux (real_rx_mux_value (mux, nchan))){ - fprintf (stderr, "usrp_standard_rx: set_mux failed\n"); - throw std::runtime_error ("usrp_standard_rx::ctor"); - } - if (!set_fpga_mode (mode)){ - fprintf (stderr, "usrp_standard_rx: set_fpga_mode failed\n"); - throw std::runtime_error ("usrp_standard_rx::ctor"); - } - - for (int i = 0; i < MAX_CHAN; i++){ - set_rx_freq(i, 0); - set_ddc_phase(i, 0); - } -} - -usrp_standard_rx::~usrp_standard_rx () -{ - // fprintf(stderr, "\nusrp_standard_rx: dtor\n"); -} - -bool -usrp_standard_rx::start () -{ - if (!usrp_basic_rx::start ()) - return false; - - // add our code here - - return true; -} - -bool -usrp_standard_rx::stop () -{ - bool ok = usrp_basic_rx::stop (); - - // add our code here - - return ok; -} - -usrp_standard_rx_sptr -usrp_standard_rx::make (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 - ) -{ - try { - usrp_standard_rx_sptr u = - usrp_standard_rx_sptr(new usrp_standard_rx(which_board, decim_rate, - nchan, mux, mode, - fusb_block_size, fusb_nblocks, - fpga_filename, firmware_filename)); - u->init_db(u); - return u; - } - catch (...){ - return usrp_standard_rx_sptr(); - } -} - -bool -usrp_standard_rx::set_decim_rate(unsigned int rate) -{ - if (has_rx_halfband()){ - if ((rate & 0x1) || rate < 4 || rate > 256){ - fprintf (stderr, "usrp_standard_rx::set_decim_rate: rate must be EVEN and in [4, 256]\n"); - return false; - } - } - else { - if (rate < 4 || rate > 128){ - fprintf (stderr, "usrp_standard_rx::set_decim_rate: rate must be in [4, 128]\n"); - return false; - } - } - - d_decim_rate = rate; - set_usb_data_rate ((adc_rate () / rate * nchannels ()) - * (2 * sizeof (short))); - - bool s = disable_rx (); - int v = has_rx_halfband() ? d_decim_rate/2 - 1 : d_decim_rate - 1; - bool ok = _write_fpga_reg (FR_DECIM_RATE, v); - restore_rx (s); - return ok; -} - -bool usrp_standard_rx::set_nchannels (int nchan) -{ - if (!(nchan == 1 || nchan == 2 || nchan == 4)) - return false; - - if (nchan > nddcs()) - return false; - - d_nchan = nchan; - - return write_hw_mux_reg (); -} - - -// map software mux value to hw mux value -// -// Software mux value: -// -// 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 -// +-------+-------+-------+-------+-------+-------+-------+-------+ -// | Q3 | I3 | Q2 | I2 | Q1 | I1 | Q0 | I0 | -// +-------+-------+-------+-------+-------+-------+-------+-------+ -// -// Each 4-bit I field is either 0,1,2,3 -// Each 4-bit Q field is either 0,1,2,3 or 0xf (input is const zero) -// All Q's must be 0xf or none of them may be 0xf -// -// -// Hardware mux value: -// -// 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 -// +-----------------------+-------+-------+-------+-------+-+-----+ -// | must be zero | Q3| I3| Q2| I2| Q1| I1| Q0| I0|Z| NCH | -// +-----------------------+-------+-------+-------+-------+-+-----+ - - -static bool -map_sw_mux_to_hw_mux (int sw_mux, int *hw_mux_ptr) -{ - // confirm that all I's are either 0,1,2,3 - - for (int i = 0; i < 8; i += 2){ - int t = (sw_mux >> (4 * i)) & 0xf; - if (!(0 <= t && t <= 3)) - return false; - } - - // confirm that all Q's are either 0,1,2,3 or 0xf - - for (int i = 1; i < 8; i += 2){ - int t = (sw_mux >> (4 * i)) & 0xf; - if (!(t == 0xf || (0 <= t && t <= 3))) - return false; - } - - // confirm that all Q inputs are 0xf (const zero input), - // or none of them are 0xf - - int q_and = 1; - int q_or = 0; - - for (int i = 0; i < 4; i++){ - int qx_is_0xf = ((sw_mux >> (8 * i + 4)) & 0xf) == 0xf; - q_and &= qx_is_0xf; - q_or |= qx_is_0xf; - } - - if (q_and || !q_or){ // OK - int hw_mux_value = 0; - - for (int i = 0; i < 8; i++){ - int t = (sw_mux >> (4 * i)) & 0x3; - hw_mux_value |= t << (2 * i + 4); - } - - if (q_and) - hw_mux_value |= 0x8; // all Q's zero - - *hw_mux_ptr = hw_mux_value; - return true; - } - else - return false; -} - -bool -usrp_standard_rx::set_mux (int mux) -{ - if (!map_sw_mux_to_hw_mux (mux, &d_hw_mux)) - return false; - - // fprintf (stderr, "sw_mux = 0x%08x hw_mux = 0x%08x\n", mux, d_hw_mux); - - d_sw_mux = mux; - return write_hw_mux_reg (); -} - -bool -usrp_standard_rx::write_hw_mux_reg () -{ - bool s = disable_rx (); - bool ok = _write_fpga_reg (FR_RX_MUX, d_hw_mux | d_nchan); - restore_rx (s); - return ok; -} - -int -usrp_standard_rx::determine_rx_mux_value(const usrp_subdev_spec &ss) -{ - /* - Determine appropriate Rx mux value as a function of the subdevice choosen and the - characteristics of the respective daughterboard. - - @param u: instance of USRP source - @param subdev_spec: return value from subdev option parser. - @type subdev_spec: (side, subdev), where side is 0 or 1 and subdev is 0 or 1 - @returns: the Rx mux value - - Figure out which A/D's to connect to the DDC. - - Each daughterboard consists of 1 or 2 subdevices. (At this time, - all but the Basic Rx have a single subdevice. The Basic Rx - has two independent channels, treated as separate subdevices). - subdevice 0 of a daughterboard may use 1 or 2 A/D's. We determine this - by checking the is_quadrature() method. If subdevice 0 uses only a single - A/D, it's possible that the daughterboard has a second subdevice, subdevice 1, - and it uses the second A/D. - - If the card uses only a single A/D, we wire a zero into the DDC Q input. - - (side, 0) says connect only the A/D's used by subdevice 0 to the DDC. - (side, 1) says connect only the A/D's used by subdevice 1 to the DDC. - */ - - struct truth_table_element - { - int d_side; - int d_uses; - bool d_swap_iq; - unsigned int d_mux_val; - - truth_table_element(int side, unsigned int uses, bool swap_iq, unsigned int mux_val=0) - : d_side(side), d_uses(uses), d_swap_iq(swap_iq), d_mux_val(mux_val){} - - bool operator==(const truth_table_element &in) - { - return (d_side == in.d_side && d_uses == in.d_uses && d_swap_iq == in.d_swap_iq); - } - - unsigned int mux_val() { return d_mux_val; } - }; - - - if (!is_valid(ss)) - throw std::invalid_argument("subdev_spec"); - - - // This is a tuple of length 1 or 2 containing the subdevice - // classes for the selected side. - std::vector<db_base_sptr> db = this->db(ss.side); - - unsigned int uses; - - // compute bitmasks of used A/D's - - if(db[ss.subdev]->is_quadrature()) - uses = 0x3; // uses A/D 0 and 1 - else if (ss.subdev == 0) - uses = 0x1; // uses A/D 0 only - else if(ss.subdev == 1) - uses = 0x2; // uses A/D 1 only - else - uses = 0x0; // uses no A/D (doesn't exist) - - if(uses == 0){ - throw std::runtime_error("Determine RX Mux Error"); - } - - bool swap_iq = db[ss.subdev]->i_and_q_swapped(); - - truth_table_element truth_table[8] = { - // (side, uses, swap_iq) : mux_val - truth_table_element(0, 0x1, false, 0xf0f0f0f0), - truth_table_element(0, 0x2, false, 0xf0f0f0f1), - truth_table_element(0, 0x3, false, 0x00000010), - truth_table_element(0, 0x3, true, 0x00000001), - truth_table_element(1, 0x1, false, 0xf0f0f0f2), - truth_table_element(1, 0x2, false, 0xf0f0f0f3), - truth_table_element(1, 0x3, false, 0x00000032), - truth_table_element(1, 0x3, true, 0x00000023) - }; - size_t nelements = sizeof(truth_table)/sizeof(truth_table[0]); - - truth_table_element target(ss.side, uses, swap_iq, 0); - - size_t i; - for(i = 0; i < nelements; i++){ - if (truth_table[i] == target) - return truth_table[i].mux_val(); - } - throw std::runtime_error("internal error"); -} - -int -usrp_standard_rx::determine_rx_mux_value(const usrp_subdev_spec &ss_a, const usrp_subdev_spec &ss_b) -{ - std::vector<db_base_sptr> db_a = this->db(ss_a.side); - std::vector<db_base_sptr> db_b = this->db(ss_b.side); - if (db_a[ss_a.subdev]->is_quadrature() != db_b[ss_b.subdev]->is_quadrature()){ - throw std::runtime_error("Cannot compute dual mux when mixing quadrature and non-quadrature subdevices"); - } - int mux_a = determine_rx_mux_value(ss_a); - int mux_b = determine_rx_mux_value(ss_b); - //move the lower byte of the mux b into the second byte of the mux a - return ((mux_b & 0xff) << 8) | (mux_a & 0xffff00ff); -} - -bool -usrp_standard_rx::set_rx_freq (int channel, double freq) -{ - if (channel < 0 || channel > MAX_CHAN) - return false; - - unsigned int v = - compute_freq_control_word_fpga (adc_rate(), - freq, &d_rx_freq[channel], - d_verbose); - - return _write_fpga_reg (FR_RX_FREQ_0 + channel, v); -} - -unsigned int -usrp_standard_rx::decim_rate () const { return d_decim_rate; } - -int -usrp_standard_rx::nchannels () const { return d_nchan; } - -int -usrp_standard_rx::mux () const { return d_sw_mux; } - -double -usrp_standard_rx::rx_freq (int channel) const -{ - if (channel < 0 || channel >= MAX_CHAN) - return 0; - - return d_rx_freq[channel]; -} - -bool -usrp_standard_rx::set_fpga_mode (int mode) -{ - return _write_fpga_reg (FR_MODE, mode); -} - -bool -usrp_standard_rx::set_ddc_phase(int channel, int phase) -{ - if (channel < 0 || channel >= MAX_CHAN) - return false; - - return _write_fpga_reg(FR_RX_PHASE_0 + channel, phase); -} - - -// To avoid quiet failures, check for things that our code cares about. - -static bool -rx_format_is_valid(unsigned int format) -{ - int width = usrp_standard_rx::format_width(format); - int want_q = usrp_standard_rx::format_want_q(format); - - if (!(width == 8 || width == 16)) // FIXME add other widths when valid - return false; - - if (!want_q) // FIXME remove check when the rest of the code can handle I only - return false; - - return true; -} - -bool -usrp_standard_rx::set_format(unsigned int format) -{ - if (!rx_format_is_valid(format)) - return false; - - return _write_fpga_reg(FR_RX_FORMAT, format); -} - -unsigned int -usrp_standard_rx::format() const -{ - return d_fpga_shadows[FR_RX_FORMAT]; -} - -// ---------------------------------------------------------------- - -unsigned int -usrp_standard_rx::make_format(int width, int shift, bool want_q, bool bypass_halfband) -{ - unsigned int format = - (((width << bmFR_RX_FORMAT_WIDTH_SHIFT) & bmFR_RX_FORMAT_WIDTH_MASK) - | ((shift << bmFR_RX_FORMAT_SHIFT_SHIFT) & bmFR_RX_FORMAT_SHIFT_MASK)); - - if (want_q) - format |= bmFR_RX_FORMAT_WANT_Q; - if (bypass_halfband) - format |= bmFR_RX_FORMAT_BYPASS_HB; - - return format; -} - -int -usrp_standard_rx::format_width(unsigned int format) -{ - return (format & bmFR_RX_FORMAT_WIDTH_MASK) >> bmFR_RX_FORMAT_WIDTH_SHIFT; -} - -int -usrp_standard_rx::format_shift(unsigned int format) -{ - return (format & bmFR_RX_FORMAT_SHIFT_MASK) >> bmFR_RX_FORMAT_SHIFT_SHIFT; -} - -bool -usrp_standard_rx::format_want_q(unsigned int format) -{ - return (format & bmFR_RX_FORMAT_WANT_Q) != 0; -} - -bool -usrp_standard_rx::format_bypass_halfband(unsigned int format) -{ - return (format & bmFR_RX_FORMAT_BYPASS_HB) != 0; -} - -bool -usrp_standard_rx::tune(int chan, db_base_sptr db, double target_freq, usrp_tune_result *result) -{ - ddc_control dxc(this, chan); - return tune_a_helper(db, target_freq, converter_rate(), dxc, result); -} - - -////////////////////////////////////////////////////////////////// - - -// tx data is timed to CLKOUT1 (64 MHz) -// interpolate 4x -// fine modulator enabled - - -static unsigned char tx_regs_use_nco[] = { - REG_TX_IF, (TX_IF_USE_CLKOUT1 - | TX_IF_I_FIRST - | TX_IF_2S_COMP - | TX_IF_INTERLEAVED), - REG_TX_DIGITAL, (TX_DIGITAL_2_DATA_PATHS - | TX_DIGITAL_INTERPOLATE_4X) -}; - - -static int -real_tx_mux_value (int mux, int nchan) -{ - if (mux != -1) - return mux; - - switch (nchan){ - case 1: - return 0x0098; - case 2: - return 0xba98; - default: - assert (0); - } -} - -usrp_standard_tx::usrp_standard_tx (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 - ) - : usrp_basic_tx (which_board, fusb_block_size, fusb_nblocks, fpga_filename, firmware_filename), - usrp_standard_common(this), - d_sw_mux (0x8), d_hw_mux (0x81) -{ - if (!usrp_9862_write_many_all (d_udh, tx_regs_use_nco, sizeof (tx_regs_use_nco))){ - fprintf (stderr, "usrp_standard_tx: failed to init AD9862 TX regs\n"); - throw std::runtime_error ("usrp_standard_tx::ctor"); - } - if (!set_nchannels (nchan)){ - fprintf (stderr, "usrp_standard_tx: set_nchannels failed\n"); - throw std::runtime_error ("usrp_standard_tx::ctor"); - } - if (!set_interp_rate (interp_rate)){ - fprintf (stderr, "usrp_standard_tx: set_interp_rate failed\n"); - throw std::runtime_error ("usrp_standard_tx::ctor"); - } - if (!set_mux (real_tx_mux_value (mux, nchan))){ - fprintf (stderr, "usrp_standard_tx: set_mux failed\n"); - throw std::runtime_error ("usrp_standard_tx::ctor"); - } - - for (int i = 0; i < MAX_CHAN; i++){ - d_tx_modulator_shadow[i] = (TX_MODULATOR_DISABLE_NCO - | TX_MODULATOR_COARSE_MODULATION_NONE); - d_coarse_mod[i] = CM_OFF; - set_tx_freq (i, 0); - } -} - -usrp_standard_tx::~usrp_standard_tx () -{ - // fprintf(stderr, "\nusrp_standard_tx: dtor\n"); -} - -bool -usrp_standard_tx::start () -{ - if (!usrp_basic_tx::start ()) - return false; - - // add our code here - - return true; -} - -bool -usrp_standard_tx::stop () -{ - bool ok = usrp_basic_tx::stop (); - - // add our code here - - return ok; -} - -usrp_standard_tx_sptr -usrp_standard_tx::make (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 - ) -{ - try { - usrp_standard_tx_sptr u = - usrp_standard_tx_sptr(new usrp_standard_tx(which_board, interp_rate, nchan, mux, - fusb_block_size, fusb_nblocks, - fpga_filename, firmware_filename)); - u->init_db(u); - return u; - } - catch (...){ - return usrp_standard_tx_sptr(); - } -} - -bool -usrp_standard_tx::set_interp_rate (unsigned int rate) -{ - // fprintf (stderr, "usrp_standard_tx::set_interp_rate\n"); - - if ((rate & 0x3) || rate < 4 || rate > 512){ - fprintf (stderr, "usrp_standard_tx::set_interp_rate: rate must be in [4, 512] and a multiple of 4.\n"); - return false; - } - - d_interp_rate = rate; - set_usb_data_rate ((dac_rate () / rate * nchannels ()) - * (2 * sizeof (short))); - - // We're using the interp by 4 feature of the 9862 so that we can - // use its fine modulator. Thus, we reduce the FPGA's interpolation rate - // by a factor of 4. - - bool s = disable_tx (); - bool ok = _write_fpga_reg (FR_INTERP_RATE, d_interp_rate/4 - 1); - restore_tx (s); - return ok; -} - -bool -usrp_standard_tx::set_nchannels (int nchan) -{ - if (!(nchan == 1 || nchan == 2)) - return false; - - if (nchan > nducs()) - return false; - - d_nchan = nchan; - return write_hw_mux_reg (); -} - -bool -usrp_standard_tx::set_mux (int mux) -{ - d_sw_mux = mux; - d_hw_mux = mux << 4; - return write_hw_mux_reg (); -} - -bool -usrp_standard_tx::write_hw_mux_reg () -{ - bool s = disable_tx (); - bool ok = _write_fpga_reg (FR_TX_MUX, d_hw_mux | d_nchan); - restore_tx (s); - return ok; -} - -int -usrp_standard_tx::determine_tx_mux_value(const usrp_subdev_spec &ss) -{ - /* - Determine appropriate Tx mux value as a function of the subdevice choosen. - - @param u: instance of USRP source - @param subdev_spec: return value from subdev option parser. - @type subdev_spec: (side, subdev), where side is 0 or 1 and subdev is 0 - @returns: the Rx mux value - - This is simpler than the rx case. Either you want to talk - to side A or side B. If you want to talk to both sides at once, - determine the value manually. - */ - - if (!is_valid(ss)) - throw std::invalid_argument("subdev_spec"); - - std::vector<db_base_sptr> db = this->db(ss.side); - - if(db[ss.subdev]->i_and_q_swapped()) { - unsigned int mask[2] = {0x0089, 0x8900}; - return mask[ss.side]; - } - else { - unsigned int mask[2] = {0x0098, 0x9800}; - return mask[ss.side]; - } -} - -int -usrp_standard_tx::determine_tx_mux_value(const usrp_subdev_spec &ss_a, const usrp_subdev_spec &ss_b) -{ - if (ss_a.side == ss_b.side && ss_a.subdev == ss_b.subdev){ - throw std::runtime_error("Cannot compute dual mux, repeated subdevice"); - } - int mux_a = determine_tx_mux_value(ss_a); - //Get the mux b: - // DAC0 becomes DAC2 - // DAC1 becomes DAC3 - unsigned int mask[2] = {0x0022, 0x2200}; - int mux_b = determine_tx_mux_value(ss_b) + mask[ss_b.side]; - return mux_b | mux_a; -} - -#ifdef USE_FPGA_TX_CORDIC - -bool -usrp_standard_tx::set_tx_freq (int channel, double freq) -{ - if (channel < 0 || channel >= MAX_CHAN) - return false; - - // This assumes we're running the 4x on-chip interpolator. - - unsigned int v = - compute_freq_control_word_fpga (dac_rate () / 4, - freq, &d_tx_freq[channel], - d_verbose); - - return _write_fpga_reg (FR_TX_FREQ_0 + channel, v); -} - - -#else - -bool -usrp_standard_tx::set_tx_freq (int channel, double freq) -{ - if (channel < 0 || channel >= MAX_CHAN) - return false; - - // split freq into fine and coarse components - - coarse_mod_t cm; - double coarse; - - double coarse_freq_1 = dac_rate () / 8; // First coarse frequency - double coarse_freq_2 = dac_rate () / 4; // Second coarse frequency - double coarse_limit_1 = coarse_freq_1 / 2; // Midpoint of [0 , freq1] range - double coarse_limit_2 = (coarse_freq_1 + coarse_freq_2) / 2; // Midpoint of [freq1 , freq2] range - double high_limit = (double)44e6/128e6*dac_rate (); // Highest meaningful frequency - - if (freq < -high_limit) // too low - return false; - else if (freq < -coarse_limit_2){ // For 64MHz: [-44, -24) - cm = CM_NEG_FDAC_OVER_4; - coarse = -coarse_freq_2; - } - else if (freq < -coarse_limit_1){ // For 64MHz: [-24, -8) - cm = CM_NEG_FDAC_OVER_8; - coarse = -coarse_freq_1; - } - else if (freq < coarse_limit_1){ // For 64MHz: [-8, 8) - cm = CM_OFF; - coarse = 0; - } - else if (freq < coarse_limit_2){ // For 64MHz: [8, 24) - cm = CM_POS_FDAC_OVER_8; - coarse = coarse_freq_1; - } - else if (freq <= high_limit){ // For 64MHz: [24, 44] - cm = CM_POS_FDAC_OVER_4; - coarse = coarse_freq_2; - } - else // too high - return false; - - - set_coarse_modulator (channel, cm); // set bits in d_tx_modulator_shadow - - double fine = freq - coarse; - - - // Compute fine tuning word... - // This assumes we're running the 4x on-chip interpolator. - // (This is required to use the fine modulator.) - - unsigned int v = - compute_freq_control_word_9862 (dac_rate () / 4, - fine, &d_tx_freq[channel], d_verbose); - - d_tx_freq[channel] += coarse; // adjust actual - - unsigned char high, mid, low; - - high = (v >> 16) & 0xff; - mid = (v >> 8) & 0xff; - low = (v >> 0) & 0xff; - - bool ok = true; - - // write the fine tuning word - ok &= _write_9862 (channel, REG_TX_NCO_FTW_23_16, high); - ok &= _write_9862 (channel, REG_TX_NCO_FTW_15_8, mid); - ok &= _write_9862 (channel, REG_TX_NCO_FTW_7_0, low); - - - d_tx_modulator_shadow[channel] |= TX_MODULATOR_ENABLE_NCO; - - if (fine < 0) - d_tx_modulator_shadow[channel] |= TX_MODULATOR_NEG_FINE_TUNE; - else - d_tx_modulator_shadow[channel] &= ~TX_MODULATOR_NEG_FINE_TUNE; - - ok &=_write_9862 (channel, REG_TX_MODULATOR, d_tx_modulator_shadow[channel]); - - return ok; -} -#endif - -bool -usrp_standard_tx::set_coarse_modulator (int channel, coarse_mod_t cm) -{ - if (channel < 0 || channel >= MAX_CHAN) - return false; - - switch (cm){ - case CM_NEG_FDAC_OVER_4: - d_tx_modulator_shadow[channel] &= ~TX_MODULATOR_CM_MASK; - d_tx_modulator_shadow[channel] |= TX_MODULATOR_COARSE_MODULATION_F_OVER_4; - d_tx_modulator_shadow[channel] |= TX_MODULATOR_NEG_COARSE_TUNE; - break; - - case CM_NEG_FDAC_OVER_8: - d_tx_modulator_shadow[channel] &= ~TX_MODULATOR_CM_MASK; - d_tx_modulator_shadow[channel] |= TX_MODULATOR_COARSE_MODULATION_F_OVER_8; - d_tx_modulator_shadow[channel] |= TX_MODULATOR_NEG_COARSE_TUNE; - break; - - case CM_OFF: - d_tx_modulator_shadow[channel] &= ~TX_MODULATOR_CM_MASK; - break; - - case CM_POS_FDAC_OVER_8: - d_tx_modulator_shadow[channel] &= ~TX_MODULATOR_CM_MASK; - d_tx_modulator_shadow[channel] |= TX_MODULATOR_COARSE_MODULATION_F_OVER_8; - break; - - case CM_POS_FDAC_OVER_4: - d_tx_modulator_shadow[channel] &= ~TX_MODULATOR_CM_MASK; - d_tx_modulator_shadow[channel] |= TX_MODULATOR_COARSE_MODULATION_F_OVER_4; - break; - - default: - return false; - } - - d_coarse_mod[channel] = cm; - return true; -} - -unsigned int -usrp_standard_tx::interp_rate () const { return d_interp_rate; } - -int -usrp_standard_tx::nchannels () const { return d_nchan; } - -int -usrp_standard_tx::mux () const { return d_sw_mux; } - -double -usrp_standard_tx::tx_freq (int channel) const -{ - if (channel < 0 || channel >= MAX_CHAN) - return 0; - - return d_tx_freq[channel]; -} - -usrp_standard_tx::coarse_mod_t -usrp_standard_tx::coarse_modulator (int channel) const -{ - if (channel < 0 || channel >= MAX_CHAN) - return CM_OFF; - - return d_coarse_mod[channel]; -} - -bool -usrp_standard_tx::tune(int chan, db_base_sptr db, double target_freq, usrp_tune_result *result) -{ - duc_control dxc(this, chan); - return tune_a_helper(db, target_freq, converter_rate(), dxc, result); -} diff --git a/usrp/host/misc/.gitignore b/usrp/host/misc/.gitignore deleted file mode 100644 index a02b6ff73..000000000 --- a/usrp/host/misc/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -/Makefile -/Makefile.in -/.la -/.lo -/.deps -/.libs -/*.la -/*.lo diff --git a/usrp/host/misc/Makefile.am b/usrp/host/misc/Makefile.am deleted file mode 100644 index d238311e3..000000000 --- a/usrp/host/misc/Makefile.am +++ /dev/null @@ -1,31 +0,0 @@ -# -# Copyright 2003,2004,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 - -EXTRA_DIST += \ - getopt.c getopt.h \ - gettimeofday.c \ - usleep.c - -noinst_LTLIBRARIES = libmisc.la - -libmisc_la_SOURCES = bug_work_around_8.cc diff --git a/usrp/host/misc/bug_work_around_8.cc b/usrp/host/misc/bug_work_around_8.cc deleted file mode 100644 index 41943247f..000000000 --- a/usrp/host/misc/bug_work_around_8.cc +++ /dev/null @@ -1,2 +0,0 @@ -// if libmisc has no sources, it doesn't get built correctly -int gr_bug_work_around_8; diff --git a/usrp/host/misc/getopt.c b/usrp/host/misc/getopt.c deleted file mode 100644 index 34eeaa6a4..000000000 --- a/usrp/host/misc/getopt.c +++ /dev/null @@ -1,734 +0,0 @@ -/* Getopt for GNU. - NOTE: getopt is now part of the C library, so if you don't know what - "Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu - before changing it! - - Copyright (C) 1987, 88, 89, 90, 91, 92, 1993 - Free Software Foundation, Inc. - - This program 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. - - This program 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, 675 Mass Ave, Cambridge, MA 02139, USA. */ - -/* NOTE!!! AIX requires this to be the first thing in the file. - Do not put ANYTHING before it! */ -#if !defined (__GNUC__) && defined (_AIX) - #pragma alloca -#endif - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#ifdef __GNUC__ -#define alloca __builtin_alloca -#else /* not __GNUC__ */ -#if defined (HAVE_ALLOCA_H) || (defined(sparc) && (defined(sun) || (!defined(USG) && !defined(SVR4) && !defined(__svr4__)))) -#include <alloca.h> -#else -#ifndef _AIX -char *alloca (); -#endif -#endif /* alloca.h */ -#endif /* not __GNUC__ */ - -#if !__STDC__ && !defined(const) && IN_GCC -#define const -#endif - -/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>. */ -#ifndef _NO_PROTO -#define _NO_PROTO -#endif - -#include <stdio.h> -#include <string.h> - -/* Comment out all this code if we are using the GNU C Library, and are not - actually compiling the library itself. This code is part of the GNU C - Library, but also included in many other GNU distributions. Compiling - and linking in this code is a waste when using the GNU C library - (especially if it is a shared library). Rather than having every GNU - program understand `configure --with-gnu-libc' and omit the object files, - it is simpler to just do this in the source for each such file. */ - -#if defined (_LIBC) || !defined (__GNU_LIBRARY__) - - -/* This needs to come after some library #include - to get __GNU_LIBRARY__ defined. */ -#ifdef __GNU_LIBRARY__ -#undef alloca -/* Don't include stdlib.h for non-GNU C libraries because some of them - contain conflicting prototypes for getopt. */ -#include <stdlib.h> -#else /* Not GNU C library. */ -#define __alloca alloca -#endif /* GNU C library. */ - -/* If GETOPT_COMPAT is defined, `+' as well as `--' can introduce a - long-named option. Because this is not POSIX.2 compliant, it is - being phased out. */ -/* #define GETOPT_COMPAT */ - -/* This version of `getopt' appears to the caller like standard Unix `getopt' - but it behaves differently for the user, since it allows the user - to intersperse the options with the other arguments. - - As `getopt' works, it permutes the elements of ARGV so that, - when it is done, all the options precede everything else. Thus - all application programs are extended to handle flexible argument order. - - Setting the environment variable POSIXLY_CORRECT disables permutation. - Then the behavior is completely standard. - - GNU application programs can use a third alternative mode in which - they can distinguish the relative order of options and other arguments. */ - -#include "getopt.h" - -/* For communication from `getopt' to the caller. - When `getopt' finds an option that takes an argument, - the argument value is returned here. - Also, when `ordering' is RETURN_IN_ORDER, - each non-option ARGV-element is returned here. */ - -char *optarg = 0; - -/* Index in ARGV of the next element to be scanned. - This is used for communication to and from the caller - and for communication between successive calls to `getopt'. - - On entry to `getopt', zero means this is the first call; initialize. - - When `getopt' returns EOF, this is the index of the first of the - non-option elements that the caller should itself scan. - - Otherwise, `optind' communicates from one call to the next - how much of ARGV has been scanned so far. */ - -/* XXX 1003.2 says this must be 1 before any call. */ -int optind = 0; - -/* The next char to be scanned in the option-element - in which the last option character we returned was found. - This allows us to pick up the scan where we left off. - - If this is zero, or a null string, it means resume the scan - by advancing to the next ARGV-element. */ - -static char *nextchar; - -/* Callers store zero here to inhibit the error message - for unrecognized options. */ - -int opterr = 1; - -/* Set to an option character which was unrecognized. - This must be initialized on some systems to avoid linking in the - system's own getopt implementation. */ - -int optopt = '?'; - -/* Describe how to deal with options that follow non-option ARGV-elements. - - If the caller did not specify anything, - the default is REQUIRE_ORDER if the environment variable - POSIXLY_CORRECT is defined, PERMUTE otherwise. - - REQUIRE_ORDER means don't recognize them as options; - stop option processing when the first non-option is seen. - This is what Unix does. - This mode of operation is selected by either setting the environment - variable POSIXLY_CORRECT, or using `+' as the first character - of the list of option characters. - - PERMUTE is the default. We permute the contents of ARGV as we scan, - so that eventually all the non-options are at the end. This allows options - to be given in any order, even with programs that were not written to - expect this. - - RETURN_IN_ORDER is an option available to programs that were written - to expect options and other ARGV-elements in any order and that care about - the ordering of the two. We describe each non-option ARGV-element - as if it were the argument of an option with character code 1. - Using `-' as the first character of the list of option characters - selects this mode of operation. - - The special argument `--' forces an end of option-scanning regardless - of the value of `ordering'. In the case of RETURN_IN_ORDER, only - `--' can cause `getopt' to return EOF with `optind' != ARGC. */ - -static enum -{ - REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER -} ordering; - -#ifdef __GNU_LIBRARY__ -/* We want to avoid inclusion of string.h with non-GNU libraries - because there are many ways it can cause trouble. - On some systems, it contains special magic macros that don't work - in GCC. */ -#include <string.h> -#define my_index strchr -#define my_bcopy(src, dst, n) memcpy ((dst), (src), (n)) -#else - -/* Avoid depending on library functions or files - whose names are inconsistent. */ - -char *getenv (); - -static char * -my_index (str, chr) - const char *str; - int chr; -{ - while (*str) - { - if (*str == chr) - return (char *) str; - str++; - } - return 0; -} - -static void -my_bcopy (from, to, size) - const char *from; - char *to; - int size; -{ - int i; - for (i = 0; i < size; i++) - to[i] = from[i]; -} -#endif /* GNU C library. */ - -/* Handle permutation of arguments. */ - -/* Describe the part of ARGV that contains non-options that have - been skipped. `first_nonopt' is the index in ARGV of the first of them; - `last_nonopt' is the index after the last of them. */ - -static int first_nonopt; -static int last_nonopt; - -/* Exchange two adjacent subsequences of ARGV. - One subsequence is elements [first_nonopt,last_nonopt) - which contains all the non-options that have been skipped so far. - The other is elements [last_nonopt,optind), which contains all - the options processed since those non-options were skipped. - - `first_nonopt' and `last_nonopt' are relocated so that they describe - the new indices of the non-options in ARGV after they are moved. */ - -static void -exchange (argv) - char **argv; -{ - int nonopts_size = (last_nonopt - first_nonopt) * sizeof (char *); - char **temp = (char **) __alloca (nonopts_size); - - /* Interchange the two blocks of data in ARGV. */ - - my_bcopy ((char *) &argv[first_nonopt], (char *) temp, nonopts_size); - my_bcopy ((char *) &argv[last_nonopt], (char *) &argv[first_nonopt], - (optind - last_nonopt) * sizeof (char *)); - my_bcopy ((char *) temp, - (char *) &argv[first_nonopt + optind - last_nonopt], - nonopts_size); - - /* Update records for the slots the non-options now occupy. */ - - first_nonopt += (optind - last_nonopt); - last_nonopt = optind; -} - -/* Scan elements of ARGV (whose length is ARGC) for option characters - given in OPTSTRING. - - If an element of ARGV starts with '-', and is not exactly "-" or "--", - then it is an option element. The characters of this element - (aside from the initial '-') are option characters. If `getopt' - is called repeatedly, it returns successively each of the option characters - from each of the option elements. - - If `getopt' finds another option character, it returns that character, - updating `optind' and `nextchar' so that the next call to `getopt' can - resume the scan with the following option character or ARGV-element. - - If there are no more option characters, `getopt' returns `EOF'. - Then `optind' is the index in ARGV of the first ARGV-element - that is not an option. (The ARGV-elements have been permuted - so that those that are not options now come last.) - - OPTSTRING is a string containing the legitimate option characters. - If an option character is seen that is not listed in OPTSTRING, - return '?' after printing an error message. If you set `opterr' to - zero, the error message is suppressed but we still return '?'. - - If a char in OPTSTRING is followed by a colon, that means it wants an arg, - so the following text in the same ARGV-element, or the text of the following - ARGV-element, is returned in `optarg'. Two colons mean an option that - wants an optional arg; if there is text in the current ARGV-element, - it is returned in `optarg', otherwise `optarg' is set to zero. - - If OPTSTRING starts with `-' or `+', it requests different methods of - handling the non-option ARGV-elements. - See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. - - Long-named options begin with `--' instead of `-'. - Their names may be abbreviated as long as the abbreviation is unique - or is an exact match for some defined option. If they have an - argument, it follows the option name in the same ARGV-element, separated - from the option name by a `=', or else the in next ARGV-element. - When `getopt' finds a long-named option, it returns 0 if that option's - `flag' field is nonzero, the value of the option's `val' field - if the `flag' field is zero. - - The elements of ARGV aren't really const, because we permute them. - But we pretend they're const in the prototype to be compatible - with other systems. - - LONGOPTS is a vector of `struct option' terminated by an - element containing a name which is zero. - - LONGIND returns the index in LONGOPT of the long-named option found. - It is only valid when a long-named option has been found by the most - recent call. - - If LONG_ONLY is nonzero, '-' as well as '--' can introduce - long-named options. */ - -int -_getopt_internal (argc, argv, optstring, longopts, longind, long_only) - int argc; - char *const *argv; - const char *optstring; - const struct option *longopts; - int *longind; - int long_only; -{ - int option_index; - - optarg = 0; - - /* Initialize the internal data when the first call is made. - Start processing options with ARGV-element 1 (since ARGV-element 0 - is the program name); the sequence of previously skipped - non-option ARGV-elements is empty. */ - - if (optind == 0) - { - first_nonopt = last_nonopt = optind = 1; - - nextchar = NULL; - - /* Determine how to handle the ordering of options and nonoptions. */ - - if (optstring[0] == '-') - { - ordering = RETURN_IN_ORDER; - ++optstring; - } - else if (optstring[0] == '+') - { - ordering = REQUIRE_ORDER; - ++optstring; - } - else if (getenv ("POSIXLY_CORRECT") != NULL) - ordering = REQUIRE_ORDER; - else - ordering = PERMUTE; - } - - if (nextchar == NULL || *nextchar == '\0') - { - if (ordering == PERMUTE) - { - /* If we have just processed some options following some non-options, - exchange them so that the options come first. */ - - if (first_nonopt != last_nonopt && last_nonopt != optind) - exchange ((char **) argv); - else if (last_nonopt != optind) - first_nonopt = optind; - - /* Now skip any additional non-options - and extend the range of non-options previously skipped. */ - - while (optind < argc - && (argv[optind][0] != '-' || argv[optind][1] == '\0') -#ifdef GETOPT_COMPAT - && (longopts == NULL - || argv[optind][0] != '+' || argv[optind][1] == '\0') -#endif /* GETOPT_COMPAT */ - ) - optind++; - last_nonopt = optind; - } - - /* Special ARGV-element `--' means premature end of options. - Skip it like a null option, - then exchange with previous non-options as if it were an option, - then skip everything else like a non-option. */ - - if (optind != argc && !strcmp (argv[optind], "--")) - { - optind++; - - if (first_nonopt != last_nonopt && last_nonopt != optind) - exchange ((char **) argv); - else if (first_nonopt == last_nonopt) - first_nonopt = optind; - last_nonopt = argc; - - optind = argc; - } - - /* If we have done all the ARGV-elements, stop the scan - and back over any non-options that we skipped and permuted. */ - - if (optind == argc) - { - /* Set the next-arg-index to point at the non-options - that we previously skipped, so the caller will digest them. */ - if (first_nonopt != last_nonopt) - optind = first_nonopt; - return EOF; - } - - /* If we have come to a non-option and did not permute it, - either stop the scan or describe it to the caller and pass it by. */ - - if ((argv[optind][0] != '-' || argv[optind][1] == '\0') -#ifdef GETOPT_COMPAT - && (longopts == NULL - || argv[optind][0] != '+' || argv[optind][1] == '\0') -#endif /* GETOPT_COMPAT */ - ) - { - if (ordering == REQUIRE_ORDER) - return EOF; - optarg = argv[optind++]; - return 1; - } - - /* We have found another option-ARGV-element. - Start decoding its characters. */ - - nextchar = (argv[optind] + 1 - + (longopts != NULL && argv[optind][1] == '-')); - } - - if (longopts != NULL - && ((argv[optind][0] == '-' - && (argv[optind][1] == '-' || long_only)) -#ifdef GETOPT_COMPAT - || argv[optind][0] == '+' -#endif /* GETOPT_COMPAT */ - )) - { - const struct option *p; - char *s = nextchar; - int exact = 0; - int ambig = 0; - const struct option *pfound = NULL; - int indfound; - - while (*s && *s != '=') - s++; - - /* Test all options for either exact match or abbreviated matches. */ - for (p = longopts, option_index = 0; p->name; - p++, option_index++) - if (!strncmp (p->name, nextchar, s - nextchar)) - { - if (s - nextchar == strlen (p->name)) - { - /* Exact match found. */ - pfound = p; - indfound = option_index; - exact = 1; - break; - } - else if (pfound == NULL) - { - /* First nonexact match found. */ - pfound = p; - indfound = option_index; - } - else - /* Second nonexact match found. */ - ambig = 1; - } - - if (ambig && !exact) - { - if (opterr) - fprintf (stderr, "%s: option `%s' is ambiguous\n", - argv[0], argv[optind]); - nextchar += strlen (nextchar); - optind++; - return '?'; - } - - if (pfound != NULL) - { - option_index = indfound; - optind++; - if (*s) - { - /* Don't test has_arg with >, because some C compilers don't - allow it to be used on enums. */ - if (pfound->has_arg) - optarg = s + 1; - else - { - if (opterr) - { - if (argv[optind - 1][1] == '-') - /* --option */ - fprintf (stderr, - "%s: option `--%s' doesn't allow an argument\n", - argv[0], pfound->name); - else - /* +option or -option */ - fprintf (stderr, - "%s: option `%c%s' doesn't allow an argument\n", - argv[0], argv[optind - 1][0], pfound->name); - } - nextchar += strlen (nextchar); - return '?'; - } - } - else if (pfound->has_arg == 1) - { - if (optind < argc) - optarg = argv[optind++]; - else - { - if (opterr) - fprintf (stderr, "%s: option `%s' requires an argument\n", - argv[0], argv[optind - 1]); - nextchar += strlen (nextchar); - return optstring[0] == ':' ? ':' : '?'; - } - } - nextchar += strlen (nextchar); - if (longind != NULL) - *longind = option_index; - if (pfound->flag) - { - *(pfound->flag) = pfound->val; - return 0; - } - return pfound->val; - } - /* Can't find it as a long option. If this is not getopt_long_only, - or the option starts with '--' or is not a valid short - option, then it's an error. - Otherwise interpret it as a short option. */ - if (!long_only || argv[optind][1] == '-' -#ifdef GETOPT_COMPAT - || argv[optind][0] == '+' -#endif /* GETOPT_COMPAT */ - || my_index (optstring, *nextchar) == NULL) - { - if (opterr) - { - if (argv[optind][1] == '-') - /* --option */ - fprintf (stderr, "%s: unrecognized option `--%s'\n", - argv[0], nextchar); - else - /* +option or -option */ - fprintf (stderr, "%s: unrecognized option `%c%s'\n", - argv[0], argv[optind][0], nextchar); - } - nextchar = (char *) ""; - optind++; - return '?'; - } - } - - /* Look at and handle the next option-character. */ - - { - char c = *nextchar++; - char *temp = my_index (optstring, c); - - /* Increment `optind' when we start to process its last character. */ - if (*nextchar == '\0') - ++optind; - - if (temp == NULL || c == ':') - { - if (opterr) - { -#if 0 - if (c < 040 || c >= 0177) - fprintf (stderr, "%s: unrecognized option, character code 0%o\n", - argv[0], c); - else - fprintf (stderr, "%s: unrecognized option `-%c'\n", argv[0], c); -#else - /* 1003.2 specifies the format of this message. */ - fprintf (stderr, "%s: illegal option -- %c\n", argv[0], c); -#endif - } - optopt = c; - return '?'; - } - if (temp[1] == ':') - { - if (temp[2] == ':') - { - /* This is an option that accepts an argument optionally. */ - if (*nextchar != '\0') - { - optarg = nextchar; - optind++; - } - else - optarg = 0; - nextchar = NULL; - } - else - { - /* This is an option that requires an argument. */ - if (*nextchar != '\0') - { - optarg = nextchar; - /* If we end this ARGV-element by taking the rest as an arg, - we must advance to the next element now. */ - optind++; - } - else if (optind == argc) - { - if (opterr) - { -#if 0 - fprintf (stderr, "%s: option `-%c' requires an argument\n", - argv[0], c); -#else - /* 1003.2 specifies the format of this message. */ - fprintf (stderr, "%s: option requires an argument -- %c\n", - argv[0], c); -#endif - } - optopt = c; - if (optstring[0] == ':') - c = ':'; - else - c = '?'; - } - else - /* We already incremented `optind' once; - increment it again when taking next ARGV-elt as argument. */ - optarg = argv[optind++]; - nextchar = NULL; - } - } - return c; - } -} - -#ifdef GETOPT -int -getopt (argc, argv, optstring) - int argc; - char *const *argv; - const char *optstring; -{ - return _getopt_internal (argc, argv, optstring, - (const struct option *) 0, - (int *) 0, - 0); -} -#endif - -#endif /* _LIBC or not __GNU_LIBRARY__. */ - -#ifdef TEST - -/* Compile with -DTEST to make an executable for use in testing - the above definition of `getopt'. */ - -int -main (argc, argv) - int argc; - char **argv; -{ - int c; - int digit_optind = 0; - - while (1) - { - int this_option_optind = optind ? optind : 1; - - c = getopt (argc, argv, "abc:d:0123456789"); - if (c == EOF) - break; - - switch (c) - { - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - if (digit_optind != 0 && digit_optind != this_option_optind) - printf ("digits occur in two different argv-elements.\n"); - digit_optind = this_option_optind; - printf ("option %c\n", c); - break; - - case 'a': - printf ("option a\n"); - break; - - case 'b': - printf ("option b\n"); - break; - - case 'c': - printf ("option c with value `%s'\n", optarg); - break; - - case '?': - break; - - default: - printf ("?? getopt returned character code 0%o ??\n", c); - } - } - - if (optind < argc) - { - printf ("non-option ARGV-elements: "); - while (optind < argc) - printf ("%s ", argv[optind++]); - printf ("\n"); - } - - exit (0); -} - -#endif /* TEST */ diff --git a/usrp/host/misc/getopt.h b/usrp/host/misc/getopt.h deleted file mode 100644 index 067908147..000000000 --- a/usrp/host/misc/getopt.h +++ /dev/null @@ -1,129 +0,0 @@ -/* Declarations for getopt. - Copyright (C) 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc. - - This program 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. - - This program 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, 675 Mass Ave, Cambridge, MA 02139, USA. */ - -#ifndef _GETOPT_H -#define _GETOPT_H 1 - -#ifdef __cplusplus -extern "C" { -#endif - -/* For communication from `getopt' to the caller. - When `getopt' finds an option that takes an argument, - the argument value is returned here. - Also, when `ordering' is RETURN_IN_ORDER, - each non-option ARGV-element is returned here. */ - -extern char *optarg; - -/* Index in ARGV of the next element to be scanned. - This is used for communication to and from the caller - and for communication between successive calls to `getopt'. - - On entry to `getopt', zero means this is the first call; initialize. - - When `getopt' returns EOF, this is the index of the first of the - non-option elements that the caller should itself scan. - - Otherwise, `optind' communicates from one call to the next - how much of ARGV has been scanned so far. */ - -extern int optind; - -/* Callers store zero here to inhibit the error message `getopt' prints - for unrecognized options. */ - -extern int opterr; - -/* Set to an option character which was unrecognized. */ - -extern int optopt; - -/* Describe the long-named options requested by the application. - The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector - of `struct option' terminated by an element containing a name which is - zero. - - The field `has_arg' is: - no_argument (or 0) if the option does not take an argument, - required_argument (or 1) if the option requires an argument, - optional_argument (or 2) if the option takes an optional argument. - - If the field `flag' is not NULL, it points to a variable that is set - to the value given in the field `val' when the option is found, but - left unchanged if the option is not found. - - To have a long-named option do something other than set an `int' to - a compiled-in constant, such as set a value from `optarg', set the - option's `flag' field to zero and its `val' field to a nonzero - value (the equivalent single-letter option character, if there is - one). For long options that have a zero `flag' field, `getopt' - returns the contents of the `val' field. */ - -struct option -{ -#if __STDC__ - const char *name; -#else - char *name; -#endif - /* has_arg can't be an enum because some compilers complain about - type mismatches in all the code that assumes it is an int. */ - int has_arg; - int *flag; - int val; -}; - -/* Names for the values of the `has_arg' field of `struct option'. */ - -#define no_argument 0 -#define required_argument 1 -#define optional_argument 2 - -#if __STDC__ -#if defined(__GNU_LIBRARY__) -/* Many other libraries have conflicting prototypes for getopt, with - differences in the consts, in stdlib.h. To avoid compilation - errors, only prototype getopt for the GNU C library. */ -extern int getopt (int argc, char *const *argv, const char *shortopts); -#else /* not __GNU_LIBRARY__ */ -extern int getopt (); -#endif /* not __GNU_LIBRARY__ */ -extern int getopt_long (int argc, char *const *argv, const char *shortopts, - const struct option *longopts, int *longind); -extern int getopt_long_only (int argc, char *const *argv, - const char *shortopts, - const struct option *longopts, int *longind); - -/* Internal only. Users should not call this directly. */ -extern int _getopt_internal (int argc, char *const *argv, - const char *shortopts, - const struct option *longopts, int *longind, - int long_only); -#else /* not __STDC__ */ -extern int getopt (); -extern int getopt_long (); -extern int getopt_long_only (); - -extern int _getopt_internal (); -#endif /* not __STDC__ */ - -#ifdef __cplusplus -} -#endif - -#endif /* _GETOPT_H */ diff --git a/usrp/host/misc/gettimeofday.c b/usrp/host/misc/gettimeofday.c deleted file mode 100644 index 098793ac9..000000000 --- a/usrp/host/misc/gettimeofday.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2003 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 <config.h> - -#ifdef HAVE_WINDOWS_H -#include <windows.h> -#endif -#ifdef HAVE_WINBASE_H -# include <winbase.h> -#endif - -#ifdef HAVE_SYS_TIME_H -#include <sys/time.h> -#endif - -/* - * broken implementation for WIN32. - * FIXME: usec precision - */ -int gettimeofday(struct timeval *tv, struct timezone *tz) -{ - if (tv) { - time_t tm; - - time(&tm); - tv->tv_sec = tm; - tv->tv_usec = 0; - } - return 0; -} - diff --git a/usrp/host/misc/mkstemp.c b/usrp/host/misc/mkstemp.c deleted file mode 100644 index 8abacb984..000000000 --- a/usrp/host/misc/mkstemp.c +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc. - This file is derived from the one in the GNU C Library. - - This program 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. - - This program 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, Boston, MA 02110-1301, USA. */ - -#include <config.h> - -/* Disable the definition of mkstemp to rpl_mkstemp (from config.h) in this - file. Otherwise, we'd get conflicting prototypes for rpl_mkstemp on - most systems. */ -#undef mkstemp - -#include <stdio.h> -#include <stdlib.h> - -#ifndef __GT_FILE -# define __GT_FILE 0 -#endif - -int __gen_tempname (); - -/* Generate a unique temporary file name from TEMPLATE. - The last six characters of TEMPLATE must be "XXXXXX"; - they are replaced with a string that makes the filename unique. - Then open the file and return a fd. */ -int -rpl_mkstemp (char *template) -{ - return __gen_tempname (template, __GT_FILE); -} diff --git a/usrp/host/misc/tempname.c b/usrp/host/misc/tempname.c deleted file mode 100644 index 2611126cf..000000000 --- a/usrp/host/misc/tempname.c +++ /dev/null @@ -1,352 +0,0 @@ -/* tempname.c - generate the name of a temporary file. - - Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003 Free Software Foundation, Inc. - - This program 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. - - This program 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, Boston, MA 02110-1301, USA. */ - -#if HAVE_CONFIG_H -# include <config.h> -#endif - -#include <sys/types.h> -#include <assert.h> - -#include <errno.h> -#ifndef __set_errno -# define __set_errno(Val) errno = (Val) -#endif - -#include <stdio.h> -#ifndef P_tmpdir -# define P_tmpdir "/tmp" -#endif -#ifndef TMP_MAX -# define TMP_MAX 238328 -#endif -#ifndef __GT_FILE -# define __GT_FILE 0 -# define __GT_BIGFILE 1 -# define __GT_DIR 2 -# define __GT_NOCREATE 3 -#endif - -#include <stddef.h> -#include <stdlib.h> -#include <string.h> - -#if HAVE_FCNTL_H || _LIBC -# include <fcntl.h> -#endif - -#if HAVE_SYS_TIME_H || _LIBC -# include <sys/time.h> -#endif - -#if HAVE_STDINT_H || _LIBC -# include <stdint.h> -#endif -#if HAVE_INTTYPES_H -# include <inttypes.h> -#endif - -#if HAVE_UNISTD_H || _LIBC -# include <unistd.h> -#endif - -#include <sys/stat.h> -#if STAT_MACROS_BROKEN -# undef S_ISDIR -#endif -#if !defined S_ISDIR && defined S_IFDIR -# define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) -#endif -#if !S_IRUSR && S_IREAD -# define S_IRUSR S_IREAD -#endif -#if !S_IRUSR -# define S_IRUSR 00400 -#endif -#if !S_IWUSR && S_IWRITE -# define S_IWUSR S_IWRITE -#endif -#if !S_IWUSR -# define S_IWUSR 00200 -#endif -#if !S_IXUSR && S_IEXEC -# define S_IXUSR S_IEXEC -#endif -#if !S_IXUSR -# define S_IXUSR 00100 -#endif - -#if _LIBC -# define struct_stat64 struct stat64 -#else -# define struct_stat64 struct stat -# define __getpid getpid -# define __gettimeofday gettimeofday -#ifdef MKDIR_TAKES_ONE_ARG -# define __mkdir(pathname,mode) mkdir((pathname)) -#else -# define __mkdir mkdir -#endif -# define __open open -# define __open64 open -#ifdef HAVE_LSTAT -# define __lxstat64(version, path, buf) lstat (path, buf) -#else -# define __lxstat64(version, path, buf) stat (path, buf) -#endif -# define __xstat64(version, path, buf) stat (path, buf) -#endif - -#if ! (HAVE___SECURE_GETENV || _LIBC) -# define __secure_getenv getenv -#endif - -#ifdef _LIBC -# include <hp-timing.h> -# if HP_TIMING_AVAIL -# define RANDOM_BITS(Var) \ - if (__builtin_expect (value == UINT64_C (0), 0)) \ - { \ - /* If this is the first time this function is used initialize \ - the variable we accumulate the value in to some somewhat \ - random value. If we'd not do this programs at startup time \ - might have a reduced set of possible names, at least on slow \ - machines. */ \ - struct timeval tv; \ - __gettimeofday (&tv, NULL); \ - value = ((uint64_t) tv.tv_usec << 16) ^ tv.tv_sec; \ - } \ - HP_TIMING_NOW (Var) -# endif -#endif - -/* Use the widest available unsigned type if uint64_t is not - available. The algorithm below extracts a number less than 62**6 - (approximately 2**35.725) from uint64_t, so ancient hosts where - uintmax_t is only 32 bits lose about 3.725 bits of randomness, - which is better than not having mkstemp at all. */ -#if !defined UINT64_MAX && !defined uint64_t -# define uint64_t uintmax_t -#endif - -/* Return nonzero if DIR is an existent directory. */ -static int -direxists (const char *dir) -{ - struct_stat64 buf; - return __xstat64 (_STAT_VER, dir, &buf) == 0 && S_ISDIR (buf.st_mode); -} - -/* Path search algorithm, for tmpnam, tmpfile, etc. If DIR is - non-null and exists, uses it; otherwise uses the first of $TMPDIR, - P_tmpdir, /tmp that exists. Copies into TMPL a template suitable - for use with mk[s]temp. Will fail (-1) if DIR is non-null and - doesn't exist, none of the searched dirs exists, or there's not - enough space in TMPL. */ -int -__path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx, - int try_tmpdir) -{ - const char *d; - size_t dlen, plen; - - if (!pfx || !pfx[0]) - { - pfx = "file"; - plen = 4; - } - else - { - plen = strlen (pfx); - if (plen > 5) - plen = 5; - } - - if (try_tmpdir) - { - d = __secure_getenv ("TMPDIR"); - if (d != NULL && direxists (d)) - dir = d; - else if (dir != NULL && direxists (dir)) - /* nothing */ ; - else - dir = NULL; - } - if (dir == NULL) - { - if (direxists (P_tmpdir)) - dir = P_tmpdir; - else if (strcmp (P_tmpdir, "/tmp") != 0 && direxists ("/tmp")) - dir = "/tmp"; - else - { - __set_errno (ENOENT); - return -1; - } - } - - dlen = strlen (dir); - while (dlen > 1 && dir[dlen - 1] == '/') - dlen--; /* remove trailing slashes */ - - /* check we have room for "${dir}/${pfx}XXXXXX\0" */ - if (tmpl_len < dlen + 1 + plen + 6 + 1) - { - __set_errno (EINVAL); - return -1; - } - - sprintf (tmpl, "%.*s/%.*sXXXXXX", (int) dlen, dir, (int) plen, pfx); - return 0; -} - -/* These are the characters used in temporary filenames. */ -static const char letters[] = -"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; - -/* Generate a temporary file name based on TMPL. TMPL must match the - rules for mk[s]temp (i.e. end in "XXXXXX"). The name constructed - does not exist at the time of the call to __gen_tempname. TMPL is - overwritten with the result. - - KIND may be one of: - __GT_NOCREATE: simply verify that the name does not exist - at the time of the call. - __GT_FILE: create the file using open(O_CREAT|O_EXCL) - and return a read-write fd. The file is mode 0600. - __GT_BIGFILE: same as __GT_FILE but use open64(). - __GT_DIR: create a directory, which will be mode 0700. - - We use a clever algorithm to get hard-to-predict names. */ -int -__gen_tempname (char *tmpl, int kind) -{ - int len; - char *XXXXXX; - static uint64_t value; - uint64_t random_time_bits; - unsigned int count; - int fd = -1; - int save_errno = errno; - struct_stat64 st; - - /* A lower bound on the number of temporary files to attempt to - generate. The maximum total number of temporary file names that - can exist for a given template is 62**6. It should never be - necessary to try all these combinations. Instead if a reasonable - number of names is tried (we define reasonable as 62**3) fail to - give the system administrator the chance to remove the problems. */ - unsigned int attempts_min = 62 * 62 * 62; - - /* The number of times to attempt to generate a temporary file. To - conform to POSIX, this must be no smaller than TMP_MAX. */ - unsigned int attempts = attempts_min < TMP_MAX ? TMP_MAX : attempts_min; - - len = strlen (tmpl); - if (len < 6 || strcmp (&tmpl[len - 6], "XXXXXX")) - { - __set_errno (EINVAL); - return -1; - } - - /* This is where the Xs start. */ - XXXXXX = &tmpl[len - 6]; - - /* Get some more or less random data. */ -#ifdef RANDOM_BITS - RANDOM_BITS (random_time_bits); -#else -# if HAVE_GETTIMEOFDAY || _LIBC - { - struct timeval tv; - __gettimeofday (&tv, NULL); - random_time_bits = ((uint64_t) tv.tv_usec << 16) ^ tv.tv_sec; - } -# else - random_time_bits = time (NULL); -# endif -#endif - value += random_time_bits ^ __getpid (); - - for (count = 0; count < attempts; value += 7777, ++count) - { - uint64_t v = value; - - /* Fill in the random bits. */ - XXXXXX[0] = letters[v % 62]; - v /= 62; - XXXXXX[1] = letters[v % 62]; - v /= 62; - XXXXXX[2] = letters[v % 62]; - v /= 62; - XXXXXX[3] = letters[v % 62]; - v /= 62; - XXXXXX[4] = letters[v % 62]; - v /= 62; - XXXXXX[5] = letters[v % 62]; - - switch (kind) - { - case __GT_FILE: - fd = __open (tmpl, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR); - break; - - case __GT_BIGFILE: - fd = __open64 (tmpl, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR); - break; - - case __GT_DIR: - fd = __mkdir (tmpl, S_IRUSR | S_IWUSR | S_IXUSR); - break; - - case __GT_NOCREATE: - /* This case is backward from the other three. __gen_tempname - succeeds if __xstat fails because the name does not exist. - Note the continue to bypass the common logic at the bottom - of the loop. */ - if (__lxstat64 (_STAT_VER, tmpl, &st) < 0) - { - if (errno == ENOENT) - { - __set_errno (save_errno); - return 0; - } - else - /* Give up now. */ - return -1; - } - continue; - - default: - assert (! "invalid KIND in __gen_tempname"); - } - - if (fd >= 0) - { - __set_errno (save_errno); - return fd; - } - else if (errno != EEXIST) - return -1; - } - - /* We got out of the loop because we ran out of combinations to try. */ - __set_errno (EEXIST); - return -1; -} diff --git a/usrp/host/misc/usleep.c b/usrp/host/misc/usleep.c deleted file mode 100644 index b1d7dad47..000000000 --- a/usrp/host/misc/usleep.c +++ /dev/null @@ -1,67 +0,0 @@ -/* Copyright (C) 1992 Free Software Foundation, Inc. -This file is part of the GNU C Library. - -The GNU C Library is free software; you can redistribute it and/or -modify it under the terms of the GNU Library General Public License as -published by the Free Software Foundation; either version 3 of the -License, or (at your option) any later version. - -The GNU C Library 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 -Library General Public License for more details. - -You should have received a copy of the GNU Library General Public -License along with the GNU C Library; see the file COPYING.LIB. If -not, write to the Free Software Foundation, Inc., 675 Mass Ave, -Cambridge, MA 02139, USA. */ - -#include <config.h> - -#ifndef HAVE_USLEEP - -#include <sys/types.h> -#include <sys/time.h> - -#ifdef HAVE_SYS_SELECT_H -# include <sys/select.h> -#endif - -#ifdef HAVE_WINDOWS_H -#include <windows.h> -#endif -#ifdef HAVE_WINBASE_H -# include <winbase.h> -#endif - -#ifdef apollo -# include <apollo/base.h> -# include <apollo/time.h> - static time_$clock_t DomainTime100mS = - { - 0, 100000/4 - }; - static status_$t DomainStatus; -#endif - -/* Sleep USECONDS microseconds, or until a previously set timer goes off. */ -int -usleep (unsigned long useconds) -{ -#ifdef apollo - /* The usleep function does not work under the SYS5.3 environment. - Use the Domain/OS time_$wait call instead. */ - time_$wait (time_$relative, DomainTime100mS, &DomainStatus); -#elif defined(HAVE_SSLEEP) /* Win32 */ - Sleep( useconds/1000 ); -#else - struct timeval delay; - - delay.tv_sec = 0; - delay.tv_usec = useconds; - select (0, 0, 0, 0, &delay); -#endif - return 0; -} - -#endif /* !HAVE_USLEEP */ diff --git a/usrp/host/swig/.gitignore b/usrp/host/swig/.gitignore deleted file mode 100644 index 9897dac41..000000000 --- a/usrp/host/swig/.gitignore +++ /dev/null @@ -1,16 +0,0 @@ -/Makefile -/Makefile.in -/.la -/.lo -/.deps -/.libs -/*.la -/*.lo -/usrp_prims.cc -/usrp_prims.py -/usrp_prims.scm -/prims.cc -/prims.py -/gnuradio -/guile -/python diff --git a/usrp/host/swig/Makefile.am b/usrp/host/swig/Makefile.am deleted file mode 100644 index 5baeff4cb..000000000 --- a/usrp/host/swig/Makefile.am +++ /dev/null @@ -1,56 +0,0 @@ -# -# Copyright 2001,2003,2004,2006,2007,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 - -AM_CPPFLAGS = \ - $(USRP_INCLUDES) \ - -I$(srcdir) \ - $(PYTHON_CPPFLAGS) \ - $(USB_INCLUDES) \ - $(WITH_INCLUDES) - -################################# -# SWIG interface and library - -TOP_SWIG_IFILES = \ - usrp_prims.i - -# Install so that they end up available as: -# import usrpm.usrp_prims -# This ends up at: -# ${prefix}/lib/python${python_version}/site-packages/usrpm -usrp_prims_pythondir_category = \ - usrpm - -# additional arguments to the SWIG command -usrp_prims_swig_args = \ - $(USRP_INCLUDES) - -# additional libraries for linking with the SWIG-generated library -usrp_prims_la_swig_libadd = \ - $(USRP_LA) - -# additional Python files to be installed along with the SWIG-generated one -usrp_prims_python = \ - __init__.py \ - usrp_fpga_regs.py diff --git a/usrp/host/swig/Makefile.swig.gen b/usrp/host/swig/Makefile.swig.gen deleted file mode 100644 index b772e97da..000000000 --- a/usrp/host/swig/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_prims.i - -## Default install locations for these files: -## -## Default location for the Python directory is: -## ${prefix}/lib/python${python_version}/site-packages/[category]/usrp_prims -## Default location for the Python exec directory is: -## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/usrp_prims -## -## 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_prims_pythondir_category ?= gnuradio/usrp_prims -usrp_prims_pylibdir_category ?= $(usrp_prims_pythondir_category) -usrp_prims_pythondir = $(pythondir)/$(usrp_prims_pythondir_category) -usrp_prims_pylibdir = $(pyexecdir)/$(usrp_prims_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_prims_scmlibdir = $(libdir) - -# The scm files for the guile modules get installed where ever guile -# is installed, usually /usr/share/guile/site/usrp_prims -# FIXME: determince whether these should be installed with gnuradio. -usrp_prims_scmdir = $(guiledir) - -## SWIG headers are always installed into the same directory. - -usrp_prims_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_prims_swiginclude_HEADERS = \ - usrp_prims.i \ - $(usrp_prims_swiginclude_headers) - -if PYTHON -usrp_prims_pylib_LTLIBRARIES = \ - _usrp_prims.la - -_usrp_prims_la_SOURCES = \ - python/usrp_prims.cc \ - $(usrp_prims_la_swig_sources) - -usrp_prims_python_PYTHON = \ - usrp_prims.py \ - $(usrp_prims_python) - -_usrp_prims_la_LIBADD = \ - $(STD_SWIG_LA_LIB_ADD) \ - $(usrp_prims_la_swig_libadd) - -_usrp_prims_la_LDFLAGS = \ - $(STD_SWIG_LA_LD_FLAGS) \ - $(usrp_prims_la_swig_ldflags) - -_usrp_prims_la_CXXFLAGS = \ - $(STD_SWIG_CXX_FLAGS) \ - -I$(top_builddir) \ - $(usrp_prims_la_swig_cxxflags) - -python/usrp_prims.cc: usrp_prims.py -usrp_prims.py: usrp_prims.i - -# Include the python dependencies for this file --include python/usrp_prims.d - -endif # end of if python - -if GUILE - -usrp_prims_scmlib_LTLIBRARIES = \ - libguile-gnuradio-usrp_prims.la -libguile_gnuradio_usrp_prims_la_SOURCES = \ - guile/usrp_prims.cc \ - $(usrp_prims_la_swig_sources) -nobase_usrp_prims_scm_DATA = \ - gnuradio/usrp_prims.scm \ - gnuradio/usrp_prims-primitive.scm -libguile_gnuradio_usrp_prims_la_LIBADD = \ - $(STD_SWIG_LA_LIB_ADD) \ - $(usrp_prims_la_swig_libadd) -libguile_gnuradio_usrp_prims_la_LDFLAGS = \ - $(STD_SWIG_LA_LD_FLAGS) \ - $(usrp_prims_la_swig_ldflags) -libguile_gnuradio_usrp_prims_la_CXXFLAGS = \ - $(STD_SWIG_CXX_FLAGS) \ - -I$(top_builddir) \ - $(usrp_prims_la_swig_cxxflags) - -guile/usrp_prims.cc: gnuradio/usrp_prims.scm -gnuradio/usrp_prims.scm: usrp_prims.i -gnuradio/usrp_prims-primitive.scm: gnuradio/usrp_prims.scm - -# Include the guile dependencies for this file --include guile/usrp_prims.d - -endif # end of GUILE - - diff --git a/usrp/host/swig/__init__.py b/usrp/host/swig/__init__.py deleted file mode 100644 index a4917cf64..000000000 --- a/usrp/host/swig/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# make this a package diff --git a/usrp/host/swig/usrp_fpga_regs.py b/usrp/host/swig/usrp_fpga_regs.py deleted file mode 100644 index b116d7b7a..000000000 --- a/usrp/host/swig/usrp_fpga_regs.py +++ /dev/null @@ -1,30 +0,0 @@ -# -# 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. -# - -from usrpm import usrp_prims - -# Copy everything that starts with FR_ or bmFR_ from the usrp_prims -# name space into our name space. This is effectively a python binding for -# the contents of firmware/include/fpga_regs_common.h and fpga_regs_standard.h - -for name in dir(usrp_prims): - if name.startswith("FR_") or name.startswith("bmFR_"): - globals()[name] = usrp_prims.__dict__[name] diff --git a/usrp/host/swig/usrp_prims.i b/usrp/host/swig/usrp_prims.i deleted file mode 100644 index a58f8aacf..000000000 --- a/usrp/host/swig/usrp_prims.i +++ /dev/null @@ -1,265 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2003,2004,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. - */ - -/* - * Low level primitives for directly messing with USRP hardware. - * - * If you're trying to use the USRP, you'll probably want to take a - * look at the usrp_standard_rx and usrp_standard_tx classes. They - * hide a bunch of low level details and provide high performance - * streaming i/o. - * - * This interface is built on top of libusb, which allegedly works under - * Linux, *BSD and Mac OS/X. http://libusb.sourceforge.net - */ - -%include <stl.i> // pick up string stuff - - -%{ -#include <usrp/usrp_prims.h> -#include <stddef.h> // ptrdiff_t -%} - - -enum usrp_load_status_t { ULS_ERROR = 0, ULS_OK, ULS_ALREADY_LOADED }; - - -/*! - * \brief initialize libusb; probe busses and devices. - * Safe to call more than once. - */ -void usrp_one_time_init (libusb_context **ctx = NULL); - -void usrp_rescan (); - -/*! - * \brief locate Nth (zero based) USRP device in system. - * Return pointer or 0 if not found. - * - * The following kinds of devices are considered USRPs: - * - * unconfigured USRP (no firwmare loaded) - * configured USRP (firmware loaded) - * unconfigured Cypress FX2 (only if fx2_ok_p is true) - */ -libusb_device *usrp_find_device (int nth, bool fx2_ok_p = false, libusb_context *ctx = NULL); - -bool usrp_usrp_p (libusb_device *q); //< is this a USRP -bool usrp_usrp0_p (libusb_device *q); //< is this a USRP Rev 0 -bool usrp_usrp1_p (libusb_device *q); //< is this a USRP Rev 1 -bool usrp_usrp2_p (libusb_device *q); //< is this a USRP Rev 2 -int usrp_hw_rev (libusb_device *q); //< return h/w rev code -bool usrp_fx2_p (libusb_device *q); //< is this an unconfigured Cypress FX2 - -bool usrp_unconfigured_usrp_p (libusb_device *q); //< some kind of unconfigured USRP -bool usrp_configured_usrp_p (libusb_device *q); //< some kind of configured USRP - -/*! - * \brief given a libusb_device return an instance of the appropriate libusb_device_handle - * - * These routines claim the specified interface and select the - * correct alternate interface. (USB nomenclature is totally screwed!) - * - * If interface can't be opened, or is already claimed by some other - * process, 0 is returned. - */ -libusb_device_handle *usrp_open_cmd_interface (libusb_device *dev); -libusb_device_handle *usrp_open_rx_interface (libusb_device *dev); -libusb_device_handle *usrp_open_tx_interface (libusb_device *dev); - -/*! - * \brief close interface. - */ -bool usrp_close_interface (libusb_device_handle *udh); - -/*! - * \brief load intel hex format file into USRP/Cypress FX2 (8051). - * - * The filename extension is typically *.ihx - * - * Note that loading firmware may cause the device to renumerate. I.e., - * change its configuration, invalidating the current device handle. - */ - -usrp_load_status_t -usrp_load_firmware (libusb_device_handle *udh, const char *filename, bool force); - -/*! - * \brief load intel hex format file into USRP FX2 (8051). - * - * The filename extension is typically *.ihx - * - * Note that loading firmware may cause the device to renumerate. I.e., - * change its configuration, invalidating the current device handle. - * If the result is ULS_OK, usrp_load_firmware_nth delays 1 second - * then rescans the busses and devices. - */ -usrp_load_status_t -usrp_load_firmware_nth (int nth, const char *filename, bool force, libusb_context *ctx = NULL); - -/*! - * \brief load fpga configuration bitstream - */ -usrp_load_status_t -usrp_load_fpga (libusb_device_handle *udh, const char *filename, bool force); - -/*! - * \brief load the regular firmware and fpga bitstream in the Nth USRP. - * - * This is the normal starting point... - */ -bool usrp_load_standard_bits (int nth, bool force); - - -%include <fpga_regs_common.h> -%include <fpga_regs_standard.h> - - -bool usrp_write_fpga_reg (libusb_device_handle *udh, int reg, int value); - -%inline %{ - -int -usrp_read_fpga_reg (libusb_device_handle *udh, int reg) -{ - int value; - bool ok = usrp_read_fpga_reg (udh, reg, &value); - if (ok) - return value; - else - return -999; -} - -%} - -bool usrp_set_fpga_reset (libusb_device_handle *udh, bool on); -bool usrp_set_fpga_tx_enable (libusb_device_handle *udh, bool on); -bool usrp_set_fpga_rx_enable (libusb_device_handle *udh, bool on); -bool usrp_set_fpga_tx_reset (libusb_device_handle *udh, bool on); -bool usrp_set_fpga_rx_reset (libusb_device_handle *udh, bool on); -bool usrp_set_led (libusb_device_handle *udh, int which, bool on); - -bool usrp_check_rx_overrun (libusb_device_handle *udh, bool *overrun_p); -bool usrp_check_tx_underrun (libusb_device_handle *udh, bool *underrun_p); - -// i2c_read and i2c_write are limited to a maximum len of 64 bytes. - -bool usrp_i2c_write (libusb_device_handle *udh, int i2c_addr, - void *buf, int len); - -bool usrp_i2c_read (libusb_device_handle *udh, int i2c_addr, - void *buf, int len); - -// spi_read and spi_write are limited to a maximum of 64 bytes -// See usrp_spi_defs.h for more info - -bool usrp_spi_write (libusb_device_handle *udh, - int optional_header, int enables, int format, - unsigned char *buf, int len); - -bool usrp_spi_read (libusb_device_handle *udh, - int optional_header, int enables, int format, - unsigned char *buf, int len); - - -bool usrp_9862_write (libusb_device_handle *udh, - int which_codec, // [0, 1] - int regno, // [0, 63] - int value); // [0, 255] - -%inline %{ - -int -usrp_9862_read (libusb_device_handle *udh, int which_codec, int reg) -{ - unsigned char value; - bool ok = usrp_9862_read (udh, which_codec, reg, &value); - if (ok) - return value; - else - return -999; -} - -%} - -%inline %{ - -bool -usrp_eeprom_write (libusb_device_handle *udh, int i2c_addr, - int eeprom_offset, const std::string buf) -{ - return usrp_eeprom_write (udh, i2c_addr, eeprom_offset, - buf.data (), buf.size ()); -} - -std::string -usrp_eeprom_read (libusb_device_handle *udh, int i2c_addr, - int eeprom_offset, int len) -{ - if (len <= 0) - return ""; - - char buf[len]; - - if (!usrp_eeprom_read (udh, i2c_addr, eeprom_offset, buf, len)) - return ""; - - return std::string (buf, len); -} - -%} - -bool usrp_write_aux_dac (libusb_device_handle *uhd, int slot, - int which_dac, int value); - -%inline %{ - -int usrp_read_aux_adc (libusb_device_handle *udh, int slot, int which_adc) -{ - int value; - bool ok = usrp_read_aux_adc (udh, slot, which_adc, &value); - if (ok) - return value; - else - return -999; -} - -%} - -/*! - * \brief return a usrp's serial number. - * - * Note that this only works on a configured usrp. - * \returns non-zero length string iff successful. - */ -std::string usrp_serial_number(libusb_device_handle *udh); - -/*! - * \brief usrp daughterboard id to name mapping - */ -const std::string usrp_dbid_to_string (int dbid); - -%inline %{ -#include "../../firmware/include/fpga_regs_common.h" -#include "../../firmware/include/fpga_regs_standard.h" -%} diff --git a/usrp/host/swig/util.py b/usrp/host/swig/util.py deleted file mode 100644 index 089bcaaac..000000000 --- a/usrp/host/swig/util.py +++ /dev/null @@ -1,95 +0,0 @@ -# utilities - -from usrp_prims import * - -def setup (which_board = 0): - if not usrp_load_standard_bits (which_board, False): - raise RuntimeError, "usrp_load_standard_bits" - dev = usrp_find_device (which_board) - if not dev: - raise RuntimeError, "usrp_find_device" - u = usrp_open_cmd_interface (dev) - if not u: - raise RuntimeError, "usrp_open_cmd_interface" - - # FIXME setup high speed paths, Aux ADC Clock, ... - - # usrp_9862_write (u, 0, 35, 0x1) # aux ADC clock = CLK/4 - # usrp_9862_write (u, 1, 35, 0x1) - - return u - -def write_slot_oe (u, slot, value, mask): - assert 0 <= slot and slot < 4 - return usrp_write_fpga_reg (u, slot + FR_OE_0, - ((mask & 0xffff) << 16) | (value & 0xffff)) - -def write_slot_io (u, slot, value, mask): - assert 0 <= slot and slot < 4 - return usrp_write_fpga_reg (u, slot + FR_IO_0, - ((mask & 0xffff) << 16) | (value & 0xffff)) - - -# ---------------------------------------------------------------- - - -def ramp_aux_dac (u, which_codec, which_dac): - if not (which_codec == 0 or which_codec == 1): - raise AssertionError - if not (which_dac >= 0 and which_dac < 4): - raise AssertionError - try: - if which_dac == 3: # sigma delta output - sigma_delta_loop (u, which_codec) - else: - aux_dac_loop (u, which_codec, which_dac) - except KeyboardInterrupt: - return - -def sigma_delta_loop (u, which_codec): - counter = 0 - while True: - usrp_9862_write (u, which_codec, 43, counter >> 4) - usrp_9862_write (u, which_codec, 42, (counter & 0xf) << 4) - # counter += 1 FIXME - counter += 4 - if counter > 0xfff: - counter = 0 - -def aux_dac_loop (u, which_codec, which_dac): - reg = 36 + which_dac # Aux DAC A,B,C - counter = 0 - while True: - usrp_9862_write (u, which_codec, reg, counter) - counter += 1 - if counter > 0xff: - counter = 0 - - -def read_aux_adc_loop (u, slot, which_adc): - while True: - v = usrp_read_aux_adc (u, slot, which_adc) - print "%3d %5.3f" % (v, v * 3.3 / 1024) - -def ramp_io_port (u, slot): - counter = 0 - try: - while True: - write_slot_io (u, slot, counter, 0xffff) - counter += 1 - if counter > 0xffff: - counter = 0 - except KeyboardInterrupt: - return - -def walk_io_port (u, slot): - bit = 1 - try: - while True: - write_slot_io (u, slot, bit, 0xffff) - bit = (bit << 1) & 0xffff - if bit == 0: - bit = 1 - except KeyboardInterrupt: - return - diff --git a/usrp/usrp.inf b/usrp/usrp.inf deleted file mode 100644 index b612d1e37..000000000 --- a/usrp/usrp.inf +++ /dev/null @@ -1,91 +0,0 @@ -[Version] -Signature = "$Chicago$" -provider = %manufacturer% -DriverVer = 03/09/2005,0.1.10.1 -CatalogFile = usrp.cat - -Class = LibUsbDevices -ClassGUID = {EB781AAF-9C70-4523-A5DF-642A87ECA567} - -[ClassInstall] -AddReg=ClassInstall.AddReg - -[ClassInstall32] -AddReg=ClassInstall.AddReg - -[ClassInstall.AddReg] -HKR,,,,"LibUSB-Win32 Devices" -HKR,,Icon,,"-20" - -[Manufacturer] -%manufacturer%=Devices - -;-------------------------------------------------------------------------- -; Files -;-------------------------------------------------------------------------- - -[SourceDisksNames] -1 = "Libusb-Win32 Driver Installation Disk",, - -[SourceDisksFiles] -libusb0.sys = 1,, -libusb0.dll = 1,, - -[DestinationDirs] -LIBUSB.Files.Sys = 10,System32\Drivers -LIBUSB.Files.Dll = 10,System32 - -[LIBUSB.Files.Sys] -libusb0.sys - -[LIBUSB.Files.Dll] -libusb0.dll - -;-------------------------------------------------------------------------- -; Device driver -;-------------------------------------------------------------------------- - -[LIBUSB_DEV] -CopyFiles = LIBUSB.Files.Sys, LIBUSB.Files.Dll -AddReg = LIBUSB_DEV.AddReg - -[LIBUSB_DEV.NT] -CopyFiles = LIBUSB.Files.Sys, LIBUSB.Files.Dll - -[LIBUSB_DEV.HW] -DelReg = LIBUSB_DEV.DelReg.HW - -[LIBUSB_DEV.NT.HW] -DelReg = LIBUSB_DEV.DelReg.HW - -[LIBUSB_DEV.NT.Services] -AddService = libusb0, 0x00000002, LIBUSB.AddService - -[LIBUSB_DEV.AddReg] -HKR,,DevLoader,,*ntkern -HKR,,NTMPDriver,,libusb0.sys - -[LIBUSB_DEV.DelReg.HW] -HKR,,"LowerFilters" - -;-------------------------------------------------------------------------- -; Services -;-------------------------------------------------------------------------- - -[LIBUSB.AddService] -DisplayName = "LibUsb-Win32 - Kernel Driver 03/09/2005, 0.1.10.1" -ServiceType = 1 -StartType = 3 -ErrorControl = 0 -ServiceBinary = %12%\libusb0.sys - -;-------------------------------------------------------------------------- -; Devices -;-------------------------------------------------------------------------- - -[Devices] -"USRP filter"=LIBUSB_DEV, USB\VID_fffe&PID_0002 - -[Strings] -manufacturer = "GNU Radio folks" - diff --git a/usrp/usrp.iss.in b/usrp/usrp.iss.in deleted file mode 100644 index e1257d82f..000000000 --- a/usrp/usrp.iss.in +++ /dev/null @@ -1,69 +0,0 @@ -; -; Copyright 2003 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. -; - -; Requirements: Inno Setup (http://www.jrsoftware.org/isdl.php) -; -; To compile this script do the following: -; - copy libusb's driver (libusb0.sys, libusb0.dll) to this folder -; - copy the USRP filter .inf file to this folder -; - copy the USRP .exe and .dll files to this folder -; - open this scipt with Inno Setup -; - compile and run - -[Setup] -AppName=USRP -AppVerName=USRP @VERSION@ -AppPublisher=GNU Radio folks -AppPublisherURL=http://www.gnu.org/software/gnuradio/ -AppVersion=@VERSION@ -DefaultDirName={pf}\Usrp -DefaultGroupName=Usrp -Compression=lzma -SolidCompression=yes -; Win98 or higher -MinVersion=4,5 -PrivilegesRequired=admin -LicenseFile="COPYING_GPL.txt" - -[Files] -; copy the file to the App folder -Source: "*.sys"; DestDir: "{app}\driver" -;Source: "*.cat"; DestDir: "{app}\driver" -Source: "*.dll"; DestDir: "{app}\driver" -Source: "usrp.inf"; DestDir: "{app}\driver" - -; also copy the DLL to the system folders so that rundll32.exe will find it -Source: "*.dll"; DestDir: "{win}\system32"; FLags: replacesameversion restartreplace - -Source: "COPYING_GPL.txt"; DestDir: "{app}" -Source: "README.txt"; DestDir: "{app}"; Flags: isreadme - -Source: "*.exe"; DestDir: "{app}" -Source: "*.ihx"; DestDir: "{app}\rev2" -Source: "*.rbf"; DestDir: "{app}\rev2" - -[Icons] -Name: "{group}\Uninstall TestDrivers"; Filename: "{uninstallexe}" - -[Run] -; invoke libusb's DLL to install the .inf file -Filename: "rundll32"; Parameters: "libusb0.dll,usb_install_driver_np_rundll {app}\driver\usrp.inf"; StatusMsg: "Installing driver (this may take a few seconds) ..." - diff --git a/usrp/usrp.pc.in b/usrp/usrp.pc.in deleted file mode 100644 index 3c30de622..000000000 --- a/usrp/usrp.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: usrp -Description: USRP Client Side C++ interface -Requires: @LIBUSB_PKG_CONFIG_NAME@ -Version: @LIBVER@ -Libs: -L${libdir} -lusrp -Cflags: -I${includedir} diff --git a/usrp2/.gitignore b/usrp2/.gitignore deleted file mode 100644 index b336cc7ce..000000000 --- a/usrp2/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/Makefile -/Makefile.in diff --git a/usrp2/Makefile.am b/usrp2/Makefile.am deleted file mode 100644 index 9813f38cb..000000000 --- a/usrp2/Makefile.am +++ /dev/null @@ -1,23 +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 this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# - -include $(top_srcdir)/Makefile.common - -SUBDIRS = host firmware diff --git a/usrp2/doc/inband-signaling-eth b/usrp2/doc/inband-signaling-eth deleted file mode 100644 index f4f497be9..000000000 --- a/usrp2/doc/inband-signaling-eth +++ /dev/null @@ -1,390 +0,0 @@ -# -# Copyright 2007 Free Software Foundation, Inc. -# -# This program 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 of the License, or -# (at your option) any later version. -# -# This program 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/>. -# - - -FIXME Needless to say, this is _very much_ a work in progress - - - -This file specifies the format of ethernet packets used for in-band data -transmission and signaling on the USRP2. - -IN packets are sent towards the host. -OUT packets are sent away from the host. - -The layout is 32-bits wide. All data is transmitted in BIG-endian -format across the ethernet. - - - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Chan | mbz |I|S|E| - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Timestamp | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | | - + + - | Payload | - . . - . . - . . - | | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - - - - mbz Must be Zero: these bits must be zero in both IN and OUT packets. - - I Send Immediately. Set on Tx data that should be transmitted now. - FIXME: change definition to honor 0xffffffff timestamp. - - S Start of Burst Flag: Set in an OUT packet if the data is the - first segment of what is logically a continuous burst of data. - Must be zero in IN packets. - - E End of Burst Flag: Set in an OUT packet if the data is the - last segment of what is logically a continuous burst of data. - Must be zero in IN packets. Underruns are not reported - when the FPGA runs out of samples between bursts. - - - Chan 5-bit logical channel number. Channel number 0x1f is reserved - for control information. See "Control Channel" below. Other - channels are "data channels." Each data channel is logically - independent of the others. A data channel payload field - contains a sequence of homogeneous samples. The format of the - samples is determined by the configuration associated with the - given channel. It is often the case that the payload field - contains 32-bit complex samples, each containing 16-bit real - and imaginary components. - - Timestamp: 32-bit timestamp. - - FIXME: update to reflect that the time is measured at the - time the samples inserted into or pulled out of the - DSP pipeline, not the A/D time. Using A/D time is problematic - because of group delay through filtering, etc. - - On IN packets, the timestamp indicates the time at which the - first sample of the packet was produced by the A/D converter(s) - for that channel. On OUT packets, the timestamp specifies the - time at which the first sample in the packet should go out the - D/A converter(s) for that channel. If a packet reaches the - head of the transmit queue, and the current time is later than - the timestamp, an error is assumed to have occurred and the - packet is discarded. As a special case, the timestamp - 0xffffffff is interpreted as "Now". - - The time base is a free running 32-bit counter that is - incremented by the A/D sample-clock. - - Payload: Variable length field. Length is specified by the - length of the containing ethernet frame. - - -// FIXME need to revisit this stuff - - O Overrun Flag: set in an IN packet if an overrun condition was - detected. Must be zero in OUT packets. Overrun occurs when - the FPGA has data to transmit to the host and there is no - buffer space available. This generally indicates a problem on - the host. Either it is not keeping up, or it has configured - the FPGA to transmit data at a higher rate than the transport - (USB) can support. - - U Underrun Flag: set in an IN packet if an underrun condition - was detected. Must be zero in OUT packets. Underrun occurs - when the FPGA runs out of samples, and it's not between - bursts. See the "End of Burst flag" below. - - D Dropped Packet Flag: Set in an IN packet if the FPGA - discarded an OUT packet because its timestamp had already - passed. - - - RSSI 6-bit Received Strength Signal Indicator: Must be zero in OUT - packets. In IN packets, indicates RSSI as reported by front end. - FIXME The format and interpretation are to be determined. - - - Tag 4-bit tag for matching IN packets with OUT packets. - [FIXME, write more...] - - - -"Data Channel" payload format: -------------------------------- - -If Chan != 0x1f, the packet is a "data packet" and the payload is a -sequence of homogeneous samples. The format of the samples is -determined by the configuration associated with the given channel. -It is often the case that the payload field contains 32-bit complex -samples, each containing 16-bit real and imaginary components. - - -"Control Channel" payload format: ---------------------------------- - -If Chan == 0x1f, the packet is a "control packet". The control channel -payload consists of a sequence of 0 or more sub-packets. - -Each sub-packet starts on a 32-bit boundary, and consists of an 8-bit -Opcode field, an 8-bit Length field, Length bytes of arguments, and 0, -1, 2 or 3 bytes of padding to align the tail of the sub-packet to -a 32-bit boundary. - -Control channel packets shall be processed at the head of the queue, -and shall observe the timestamp semantics described above. - - -General sub-packet format: --------------------------- - - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-//-+-+-+-+-+-+-+-+ - | Opcode | Length | <length bytes> ... | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-//-+-+-+-+-+-+-+-+ - - -Specific sub-packet formats: ----------------------------- - - RID: 8-bit Request-ID. Copied from request sub-packet into corresponding - reply sub-packet. RID allows the host to match requests and replies. - - Reg Number: 8-bit Register Number. - - - -Identify: - - Opcode: OP_ID - - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Opcode | 2 | RID | mbz | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - - -Identify Reply: - - Opcode: OP_ID_REPLY - - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Opcode | 50 | RID | mbz | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Mac Addr 0 | Mac Addr 1 | Mac Addr 2 | Mac Addr 3 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Mac Addr 4 | Mac Addr 5 | H/W rev major | H/W rev minor | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Serial Num 0 | Serial Num 1 | Serial Num 2 | Serial Num 3 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Serial Num 4 | Serial Num 5 | Serial Num 6 | Serial Num 7 | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | | - + + - | | - + FPGA MD5SUM + - | | - + + - | | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | | - + + - | | - + S/W MD5SUM + - | | - + + - | | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - - -Write Register: - - Opcode: OP_WRITE_REG - - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Opcode | 6 | mbz | Reg Number | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Register Value | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - - -Write Register Masked: - - Opcode: OP_WRITE_REG_MASKED - - REG[Num] = (REG[Num] & ~Mask) | (Value & Mask) - - That is, only the register bits that correspond to 1's in the - mask are written with the new value. - - - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Opcode | 10 | mbz | Reg Number | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Register Value | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Mask Value | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - - -Read Register: - - Opcode: OP_READ_REG - - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Opcode | 2 | RID | Reg Number | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - - -Read Register Reply: - - Opcode: OP_READ_REG_REPLY - - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Opcode | 6 | RID | Reg Number | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Register Value | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - - -// FIXME these may not be implemented... - -I2C Write: - - Opcode: OP_I2C_WRITE - I2C Addr: 7-bit I2C address - Data: The bytes to write to the I2C bus - Length: Length of Data + 2 - - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Opcode | Length | RID | I2C Addr | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Data ... . - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - - -I2C Write Reply: - - Opcode: OP_I2C_WRITE_REPLY - Length: 2 - - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Opcode | 2 | RID | OK | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - - -OK is 1 if successful, else 0. - - -I2C Read: - - Opcode: OP_I2C_READ - I2C Addr: 7-bit I2C address - Nbytes: Number of bytes to read from I2C bus - - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Opcode | 3 | RID | I2C Addr | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Nbytes | unspecified padding | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - - -I2C Read Reply: - - Opcode: OP_I2C_READ_REPLY - I2C Addr: 7-bit I2C address - Data: Length - 2 bytes of data read from I2C bus. - - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Opcode | Length | RID | OK | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Data ... . - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - -OK is 1 if successful, else 0 - - -SPI Write: - - Opcode: OP_SPI_WRITE - Enables: Which SPI enables to assert (mask) - Format: Specifies format of SPI data and Opt Header Bytes - Opt Header Bytes: 2-byte field containing optional Tx bytes; see Format - Data: The bytes to write to the SPI bus - Length: Length of Data + 6 - - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Opcode | Length | RID | mbz | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Enables | Format | Opt Header Bytes | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Data ... . - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - - -SPI Write Reply: - - Opcode: OP_SPI_WRITE_REPLY - Length: 2 - - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Opcode | 2 | RID | OK | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - - -OK is 1 if successful, else 0. - - -SPI Read: - - Opcode: OP_SPI_READ - Enables: Which SPI enables to assert (mask) - Format: Specifies format of SPI data and Opt Header Bytes - Opt Header Bytes: 2-byte field containing optional Tx bytes; see Format - Nbytes: Number of bytes to read from SPI bus. - - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Opcode | 7 | RID | mbz | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Enables | Format | Opt Header Bytes | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Nbytes | unspecified padding | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - - -SPI Read Reply: - - Opcode: OP_SPI_READ_REPLY - Data: Length - 2 bytes of data read from SPI bus. - - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Opcode | Length | RID | mbz | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Data ... . - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - - -Delay: - - Opcode: OP_DELAY - Ticks: 16-bit unsigned delay count - - Delay Ticks clock ticks before executing next operation. - - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | Opcode | 2 | Ticks | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - diff --git a/usrp2/firmware/.gitignore b/usrp2/firmware/.gitignore deleted file mode 100644 index 2381f1328..000000000 --- a/usrp2/firmware/.gitignore +++ /dev/null @@ -1,40 +0,0 @@ -/*-stamp -/*.a -/*.bin -/*.dump -/*.log -/*.rom -/.deps -/Makefile -/Makefile.in -/aclocal.m4 -/autom4te.cache -/blink_leds -/blink_leds2 -/build -/compile -/config.h -/config.h.in -/config.log -/config.status -/configure -/depcomp -/eth_test -/gen_eth_packets -/ibs_rx_test -/ibs_tx_test -/install-sh -/libtool -/ltmain.sh -/missing -/py-compile -/rcv_eth_packets -/run_tests.sh -/stamp-h1 -/test1 -/test_phy_comm -/timer_test -/buf_ram_test -/buf_ram_zero -/hello -/configure.lineno diff --git a/usrp2/firmware/AUTHORS b/usrp2/firmware/AUTHORS deleted file mode 100644 index 6bd41174b..000000000 --- a/usrp2/firmware/AUTHORS +++ /dev/null @@ -1,2 +0,0 @@ -Eric Blossom <eb@comsec.com> -Matt Ettus <matt@ettus.com> diff --git a/usrp2/firmware/COPYING b/usrp2/firmware/COPYING deleted file mode 100644 index 94a9ed024..000000000 --- a/usrp2/firmware/COPYING +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This program 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 of the License, or - (at your option) any later version. - - This program 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/>. - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -<http://www.gnu.org/licenses/>. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/usrp2/firmware/ChangeLog b/usrp2/firmware/ChangeLog deleted file mode 100644 index 3154fc43a..000000000 --- a/usrp2/firmware/ChangeLog +++ /dev/null @@ -1,22 +0,0 @@ -# -# Copyright 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 this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# - -Please use the trac interface to see what's changed. -http://gnuradio.org/trac/timeline diff --git a/usrp2/firmware/INSTALL b/usrp2/firmware/INSTALL deleted file mode 100644 index 5458714e1..000000000 --- a/usrp2/firmware/INSTALL +++ /dev/null @@ -1,234 +0,0 @@ -Installation Instructions -************************* - -Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, -2006 Free Software Foundation, Inc. - -This file is free documentation; the Free Software Foundation gives -unlimited permission to copy, distribute and modify it. - -Basic Installation -================== - -Briefly, the shell commands `./configure; make; make install' should -configure, build, and install this package. The following -more-detailed instructions are generic; see the `README' file for -instructions specific to this package. - - The `configure' shell script attempts to guess correct values for -various system-dependent variables used during compilation. It uses -those values to create a `Makefile' in each directory of the package. -It may also create one or more `.h' files containing system-dependent -definitions. Finally, it creates a shell script `config.status' that -you can run in the future to recreate the current configuration, and a -file `config.log' containing compiler output (useful mainly for -debugging `configure'). - - It can also use an optional file (typically called `config.cache' -and enabled with `--cache-file=config.cache' or simply `-C') that saves -the results of its tests to speed up reconfiguring. Caching is -disabled by default to prevent problems with accidental use of stale -cache files. - - If you need to do unusual things to compile the package, please try -to figure out how `configure' could check whether to do them, and mail -diffs or instructions to the address given in the `README' so they can -be considered for the next release. If you are using the cache, and at -some point `config.cache' contains results you don't want to keep, you -may remove or edit it. - - The file `configure.ac' (or `configure.in') is used to create -`configure' by a program called `autoconf'. You need `configure.ac' if -you want to change it or regenerate `configure' using a newer version -of `autoconf'. - -The simplest way to compile this package is: - - 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. - - Running `configure' might take a while. While running, it prints - some messages telling which features it is checking for. - - 2. Type `make' to compile the package. - - 3. Optionally, type `make check' to run any self-tests that come with - the package. - - 4. Type `make install' to install the programs and any data files and - documentation. - - 5. You can remove the program binaries and object files from the - source code directory by typing `make clean'. To also remove the - files that `configure' created (so you can compile the package for - a different kind of computer), type `make distclean'. There is - also a `make maintainer-clean' target, but that is intended mainly - for the package's developers. If you use it, you may have to get - all sorts of other programs in order to regenerate files that came - with the distribution. - -Compilers and Options -===================== - -Some systems require unusual options for compilation or linking that the -`configure' script does not know about. Run `./configure --help' for -details on some of the pertinent environment variables. - - You can give `configure' initial values for configuration parameters -by setting variables in the command line or in the environment. Here -is an example: - - ./configure CC=c99 CFLAGS=-g LIBS=-lposix - - *Note Defining Variables::, for more details. - -Compiling For Multiple Architectures -==================================== - -You can compile the package for more than one kind of computer at the -same time, by placing the object files for each architecture in their -own directory. To do this, you can use GNU `make'. `cd' to the -directory where you want the object files and executables to go and run -the `configure' script. `configure' automatically checks for the -source code in the directory that `configure' is in and in `..'. - - With a non-GNU `make', it is safer to compile the package for one -architecture at a time in the source code directory. After you have -installed the package for one architecture, use `make distclean' before -reconfiguring for another architecture. - -Installation Names -================== - -By default, `make install' installs the package's commands under -`/usr/local/bin', include files under `/usr/local/include', etc. You -can specify an installation prefix other than `/usr/local' by giving -`configure' the option `--prefix=PREFIX'. - - You can specify separate installation prefixes for -architecture-specific files and architecture-independent files. If you -pass the option `--exec-prefix=PREFIX' to `configure', the package uses -PREFIX as the prefix for installing programs and libraries. -Documentation and other data files still use the regular prefix. - - In addition, if you use an unusual directory layout you can give -options like `--bindir=DIR' to specify different values for particular -kinds of files. Run `configure --help' for a list of the directories -you can set and what kinds of files go in them. - - If the package supports it, you can cause programs to be installed -with an extra prefix or suffix on their names by giving `configure' the -option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. - -Optional Features -================= - -Some packages pay attention to `--enable-FEATURE' options to -`configure', where FEATURE indicates an optional part of the package. -They may also pay attention to `--with-PACKAGE' options, where PACKAGE -is something like `gnu-as' or `x' (for the X Window System). The -`README' should mention any `--enable-' and `--with-' options that the -package recognizes. - - For packages that use the X Window System, `configure' can usually -find the X include and library files automatically, but if it doesn't, -you can use the `configure' options `--x-includes=DIR' and -`--x-libraries=DIR' to specify their locations. - -Specifying the System Type -========================== - -There may be some features `configure' cannot figure out automatically, -but needs to determine by the type of machine the package will run on. -Usually, assuming the package is built to be run on the _same_ -architectures, `configure' can figure that out, but if it prints a -message saying it cannot guess the machine type, give it the -`--build=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name which has the form: - - CPU-COMPANY-SYSTEM - -where SYSTEM can have one of these forms: - - OS KERNEL-OS - - See the file `config.sub' for the possible values of each field. If -`config.sub' isn't included in this package, then this package doesn't -need to know the machine type. - - If you are _building_ compiler tools for cross-compiling, you should -use the option `--target=TYPE' to select the type of system they will -produce code for. - - If you want to _use_ a cross compiler, that generates code for a -platform different from the build platform, you should specify the -"host" platform (i.e., that on which the generated programs will -eventually be run) with `--host=TYPE'. - -Sharing Defaults -================ - -If you want to set default values for `configure' scripts to share, you -can create a site shell script called `config.site' that gives default -values for variables like `CC', `cache_file', and `prefix'. -`configure' looks for `PREFIX/share/config.site' if it exists, then -`PREFIX/etc/config.site' if it exists. Or, you can set the -`CONFIG_SITE' environment variable to the location of the site script. -A warning: not all `configure' scripts look for a site script. - -Defining Variables -================== - -Variables not defined in a site shell script can be set in the -environment passed to `configure'. However, some packages may run -configure again during the build, and the customized values of these -variables may be lost. In order to avoid this problem, you should set -them in the `configure' command line, using `VAR=value'. For example: - - ./configure CC=/usr/local2/bin/gcc - -causes the specified `gcc' to be used as the C compiler (unless it is -overridden in the site shell script). - -Unfortunately, this technique does not work for `CONFIG_SHELL' due to -an Autoconf bug. Until the bug is fixed you can use this workaround: - - CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash - -`configure' Invocation -====================== - -`configure' recognizes the following options to control how it operates. - -`--help' -`-h' - Print a summary of the options to `configure', and exit. - -`--version' -`-V' - Print the version of Autoconf used to generate the `configure' - script, and exit. - -`--cache-file=FILE' - Enable the cache: use and save the results of the tests in FILE, - traditionally `config.cache'. FILE defaults to `/dev/null' to - disable caching. - -`--config-cache' -`-C' - Alias for `--cache-file=config.cache'. - -`--quiet' -`--silent' -`-q' - Do not print messages saying which checks are being made. To - suppress all normal output, redirect it to `/dev/null' (any error - messages will still be shown). - -`--srcdir=DIR' - Look for the package's source code in directory DIR. Usually - `configure' can determine that directory automatically. - -`configure' also accepts some other, not widely useful, options. Run -`configure --help' for more details. - diff --git a/usrp2/firmware/Makefile.am b/usrp2/firmware/Makefile.am deleted file mode 100644 index a5339bb5b..000000000 --- a/usrp2/firmware/Makefile.am +++ /dev/null @@ -1,34 +0,0 @@ -# -# Copyright 2007,2008,2010 Free Software Foundation, Inc. -# -# This program 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 of the License, or -# (at your option) any later version. -# -# This program 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/>. -# - -ACLOCAL_AMFLAGS = -I config - -include $(top_srcdir)/Makefile.common - -EXTRA_DIST = \ - bootstrap \ - configure \ - configure.gnu \ - u2_flash_tool - -SUBDIRS = config - -if BUILDING_USRP2_FIRMWARE -SUBDIRS += include lib apps -endif - - diff --git a/usrp2/firmware/Makefile.common b/usrp2/firmware/Makefile.common deleted file mode 100644 index d45576201..000000000 --- a/usrp2/firmware/Makefile.common +++ /dev/null @@ -1,59 +0,0 @@ -# -*- Makefile -*- -# -# Copyright 2007 Free Software Foundation, Inc. -# -# This program 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 of the License, or -# (at your option) any later version. -# -# This program 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/>. -# - -STD_INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/lib - -#HAL_IO = -DHAL_IO_USES_DBOARD_PINS -HAL_IO = -DHAL_IO_USES_UART - -AM_CPPFLAGS = $(HAL_IO) $(STD_INCLUDES) - -STD_CFLAGS = --std=gnu99 -Wall -Werror-implicit-function-declaration -mxl-soft-div -msoft-float - -AM_CFLAGS = $(STD_CFLAGS) -mxl-soft-mul -mxl-barrel-shift -#AM_CFLAGS = $(STD_CFLAGS) -mxl-soft-mul -mxl-barrel-shift -mxl-gp-opt -G 16384 - - -#LINKER_SCRIPT = $(top_srcdir)/lib/microblaze.ld -#AM_LDFLAGS = -Wl,-T,$(LINKER_SCRIPT) -Wl,-defsym -Wl,_STACK_SIZE=1024 -#AM_LDFLAGS = -Wl,-T,$(LINKER_SCRIPT) -Wl,-Map -Wl,$@.map -#AM_LDFLAGS = -Wl,-T,$(LINKER_SCRIPT) -AM_LDFLAGS = -Wl,-Map -Wl,$@.map -Wl,-defsym -Wl,_STACK_SIZE=3072 -#AM_LDFLAGS = -Wl,-defsym -Wl,_STACK_SIZE=2048 - - -%.bin : % - mb-objcopy -O binary $< $@ - -%.dump : % - mb-objdump -DSC $< > $@ - -%.rom : %.bin - hexdump -v -e'1/1 "%.2X\n"' $< > $@ - - -.PRECIOUS : %.bin - - -BINS = $(noinst_PROGRAMS:=.bin) -ROMS = $(noinst_PROGRAMS:=.rom) -DUMPS = $(noinst_PROGRAMS:=.dump) - -noinst_DATA = $(BINS) $(ROMS) $(DUMPS) - -CLEANFILES = $(ROMS) $(DUMPS) $(BINS) diff --git a/usrp2/firmware/NEWS b/usrp2/firmware/NEWS deleted file mode 100644 index e69de29bb..000000000 --- a/usrp2/firmware/NEWS +++ /dev/null diff --git a/usrp2/firmware/README b/usrp2/firmware/README deleted file mode 100644 index 61d5ec4ff..000000000 --- a/usrp2/firmware/README +++ /dev/null @@ -1,5 +0,0 @@ -Stay tuned for additional info as it becomes available ... - - $ ./bootstrap - $ ./configure.gnu - $ make diff --git a/usrp2/firmware/apps/.gitignore b/usrp2/firmware/apps/.gitignore deleted file mode 100644 index 33469a796..000000000 --- a/usrp2/firmware/apps/.gitignore +++ /dev/null @@ -1,79 +0,0 @@ -/*-stamp -/*.a -/*.bin -/*.dump -/*.log -/*.rom -/*.map -/.deps -/Makefile -/Makefile.in -/aclocal.m4 -/autom4te.cache -/blink_leds -/blink_leds2 -/build -/compile -/config.h -/config.h.in -/config.log -/config.status -/configure -/depcomp -/echo -/eth_test -/gen_eth_packets -/ibs_rx_test -/ibs_tx_test -/install-sh -/libtool -/ltmain.sh -/missing -/py-compile -/rcv_eth_packets -/run_tests.sh -/stamp-h1 -/test1 -/test_phy_comm -/timer_test -/buf_ram_test -/buf_ram_zero -/hello -/test_printf -/test_spi -/test_i2c -/gen_pause_frames -/test_serdes -/rx_only -/tx_only -/tx_standalone -/tx_drop -/tx_drop2 -/tx_drop_rate_limited -/test_lsdac -/test_lsadc -/read_dbids -/test_db_spi -/ramp_lsdac -/eth_to_serdes -/serdes_to_dsp -/sd_gentest -/sd_bounce -/can_i_sub -/tx_only_v2 -/rx_only_v2 -/txrx -/txrx_wbx -/txrx_xcvr -/eth_serdes -/serdes_txrx -/set_hw_rev -/test_sd -/factory_test -/test_ram -/mimo_tx -/mimo_tx_slave -/burn_dbsrx_eeprom -/burnrev30 -/burnrev31 -/burnrev40 diff --git a/usrp2/firmware/apps/Makefile.am b/usrp2/firmware/apps/Makefile.am deleted file mode 100644 index 1dc8b0a73..000000000 --- a/usrp2/firmware/apps/Makefile.am +++ /dev/null @@ -1,85 +0,0 @@ -# -# Copyright 2007,2008 Free Software Foundation, Inc. -# -# This program 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 of the License, or -# (at your option) any later version. -# -# This program 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/>. -# - -include $(top_srcdir)/Makefile.common - -LDADD = ../lib/libu2fw.a - -noinst_PROGRAMS = \ - blink_leds \ - blink_leds2 \ - buf_ram_test \ - burn_dbsrx_eeprom \ - can_i_sub \ - echo \ - eth_serdes \ - gen_eth_packets \ - hello \ - ibs_rx_test \ - ibs_tx_test \ - rcv_eth_packets \ - read_dbids \ - set_hw_rev \ - test1 \ - test_db_spi \ - test_i2c \ - test_sd \ - test_ram \ - test_phy_comm \ - test_lsadc \ - test_lsdac \ - timer_test \ - tx_standalone \ - txrx \ - txrx_wbx \ - txrx_xcvr \ - factory_test \ - burnrev30 \ - burnrev31 \ - burnrev40 \ - serdes_txrx \ - sd_gentest \ - sd_bounce \ - mimo_tx \ - mimo_tx_slave - - - -# tx_drop_SOURCES = tx_drop.c app_common.c -# tx_drop_rate_limited_SOURCES = tx_drop_rate_limited.c app_common.c -# tx_drop2_SOURCES = tx_drop2.c app_common.c -txrx_SOURCES = txrx.c app_common_v2.c -txrx_wbx_SOURCES = txrx.c app_common_v2.c -txrx_xcvr_SOURCES = txrx.c app_common_v2.c -factory_test_SOURCES = factory_test.c app_common_v2.c -eth_serdes_SOURCES = eth_serdes.c app_passthru_v2.c -serdes_txrx_SOURCES = serdes_txrx.c app_common_v2.c -mimo_tx_SOURCES = mimo_tx.c mimo_app_common_v2.c -mimo_tx_slave_SOURCES = mimo_tx_slave.c app_common_v2.c - -txrx_wbx_LDADD = ../lib/libu2fw_wbx.a - -txrx_xcvr_LDADD = ../lib/libu2fw_xcvr.a - - -noinst_HEADERS = \ - app_common_v2.h \ - app_passthru_v2.h \ - mimo_app_common_v2.h - - -MOSTLYCLEANFILES = *.map diff --git a/usrp2/firmware/apps/app_common_v2.c b/usrp2/firmware/apps/app_common_v2.c deleted file mode 100644 index 7716ed992..000000000 --- a/usrp2/firmware/apps/app_common_v2.c +++ /dev/null @@ -1,686 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2008,2009 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "app_common_v2.h" -#include "buffer_pool.h" -#include "memcpy_wa.h" -#include "ethernet.h" -#include "nonstdio.h" -#include "print_rmon_regs.h" -#include "db.h" -#include "db_base.h" -#include "clocks.h" -#include "u2_init.h" -#include <string.h> -#include "usrp2_i2c_addr.h" - -volatile bool link_is_up = false; // eth handler sets this -int cpu_tx_buf_dest_port = PORT_ETH; - -// If this is non-zero, this dbsm could be writing to the ethernet -dbsm_t *ac_could_be_sending_to_eth; - -static unsigned char exp_seqno __attribute__((unused)) = 0; - -static inline bool -sync_to_pps(const op_generic_t *p) -{ - timesync_regs->sync_on_next_pps = 1; - //putstr("SYNC to PPS\n"); - return true; -} - -static bool -sync_every_pps(const op_generic_t *p) -{ - if (p->ok) - timesync_regs->tick_control |= TSC_TRIGGER_EVERYPPS; - else - timesync_regs->tick_control &= ~TSC_TRIGGER_EVERYPPS; - - return true; -} - -static inline bool -config_mimo_cmd(const op_config_mimo_t *p) -{ - clocks_mimo_config(p->flags); - return true; -} - -void -set_reply_hdr(u2_eth_packet_t *reply_pkt, u2_eth_packet_t const *cmd_pkt) -{ - reply_pkt->ehdr.dst = cmd_pkt->ehdr.src; - reply_pkt->ehdr.src = *ethernet_mac_addr(); - reply_pkt->ehdr.ethertype = U2_ETHERTYPE; - reply_pkt->thdr.flags = 0; - reply_pkt->thdr.fifo_status = 0; // written by protocol engine - reply_pkt->thdr.seqno = 0; // written by protocol engine - reply_pkt->thdr.ack = 0; // written by protocol engine - u2p_set_word0(&reply_pkt->fixed, 0, CONTROL_CHAN); - reply_pkt->fixed.timestamp = timer_regs->time; -} - -static void -send_reply(unsigned char *reply, size_t reply_len) -{ - if (reply_len < 64) - reply_len = 64; - - // wait for buffer to become idle - hal_set_leds(0x4, 0x4); - while((buffer_pool_status->status & BPS_IDLE(CPU_TX_BUF)) == 0) - ; - hal_set_leds(0x0, 0x4); - - // copy reply into CPU_TX_BUF - memcpy_wa(buffer_ram(CPU_TX_BUF), reply, reply_len); - - // wait until nobody else is sending to the ethernet - if (ac_could_be_sending_to_eth){ - hal_set_leds(0x8, 0x8); - dbsm_wait_for_opening(ac_could_be_sending_to_eth); - hal_set_leds(0x0, 0x8); - } - - if (0){ - printf("sending_reply to port %d, len = %d\n", cpu_tx_buf_dest_port, (int)reply_len); - print_buffer(buffer_ram(CPU_TX_BUF), reply_len/4); - } - - // fire it off - bp_send_from_buf(CPU_TX_BUF, cpu_tx_buf_dest_port, 1, 0, reply_len/4); - - // wait for it to complete (not long, it's a small pkt) - while((buffer_pool_status->status & (BPS_DONE(CPU_TX_BUF) | BPS_ERROR(CPU_TX_BUF))) == 0) - ; - - bp_clear_buf(CPU_TX_BUF); -} - - -static size_t -op_id_cmd(const op_generic_t *p, - void *reply_payload, size_t reply_payload_space) -{ - op_id_reply_t *r = (op_id_reply_t *) reply_payload; - if (reply_payload_space < sizeof(*r)) // no room - return 0; - - // Build reply subpacket - - r->opcode = OP_ID_REPLY; - r->len = sizeof(op_id_reply_t); - r->rid = p->rid; - r->addr = *ethernet_mac_addr(); - r->hw_rev = (u2_hw_rev_major << 8) | u2_hw_rev_minor; - // r->fpga_md5sum = ; // FIXME - // r->sw_md5sum = ; // FIXME - - return r->len; -} - - -static size_t -config_tx_v2_cmd(const op_config_tx_v2_t *p, - void *reply_payload, size_t reply_payload_space) -{ - op_config_tx_reply_v2_t *r = (op_config_tx_reply_v2_t *) reply_payload; - if (reply_payload_space < sizeof(*r)) - return 0; // no room - - struct tune_result tune_result; - memset(&tune_result, 0, sizeof(tune_result)); - - bool ok = true; - - if (p->valid & CFGV_GAIN){ - ok &= db_set_gain(tx_dboard, p->gain); - } - - if (p->valid & CFGV_FREQ){ - bool was_streaming = is_streaming(); - if (was_streaming) - stop_rx_cmd(); - - u2_fxpt_freq_t f = u2_fxpt_freq_from_hilo(p->freq_hi, p->freq_lo); - bool tune_ok = db_tune(tx_dboard, f, &tune_result); - ok &= tune_ok; - print_tune_result("Tx", tune_ok, f, &tune_result); - - if (was_streaming) - restart_streaming(); - } - - if (p->valid & CFGV_INTERP_DECIM){ - int interp = p->interp; - int hb1 = 0; - int hb2 = 0; - - if (!(interp & 1)){ - hb2 = 1; - interp = interp >> 1; - } - - if (!(interp & 1)){ - hb1 = 1; - interp = interp >> 1; - } - - if (interp < MIN_CIC_INTERP || interp > MAX_CIC_INTERP) - ok = false; - else { - dsp_tx_regs->interp_rate = (hb1<<9) | (hb2<<8) | interp; - // printf("Interp: %d, register %d\n", p->interp, (hb1<<9) | (hb2<<8) | interp); - } - } - - if (p->valid & CFGV_SCALE_IQ){ - dsp_tx_regs->scale_iq = p->scale_iq; - } - - // Build reply subpacket - - r->opcode = OP_CONFIG_TX_REPLY_V2; - r->len = sizeof(*r); - r->rid = p->rid; - r->ok = ok; - r->inverted = tune_result.inverted; - r->baseband_freq_hi = u2_fxpt_freq_hi(tune_result.baseband_freq); - r->baseband_freq_lo = u2_fxpt_freq_lo(tune_result.baseband_freq); - r->duc_freq_hi = u2_fxpt_freq_hi(tune_result.dxc_freq); - r->duc_freq_lo = u2_fxpt_freq_lo(tune_result.dxc_freq); - r->residual_freq_hi = u2_fxpt_freq_hi(tune_result.residual_freq); - r->residual_freq_lo = u2_fxpt_freq_lo(tune_result.residual_freq); - return r->len; -} - -static size_t -config_rx_v2_cmd(const op_config_rx_v2_t *p, - void *reply_payload, size_t reply_payload_space) -{ - op_config_rx_reply_v2_t *r = (op_config_rx_reply_v2_t *) reply_payload; - if (reply_payload_space < sizeof(*r)) - return 0; // no room - - struct tune_result tune_result; - memset(&tune_result, 0, sizeof(tune_result)); - - bool ok = true; - - if (p->valid & CFGV_GAIN){ - ok &= db_set_gain(rx_dboard, p->gain); - } - - if (p->valid & CFGV_FREQ){ - bool was_streaming = is_streaming(); - if (was_streaming) - stop_rx_cmd(); - - u2_fxpt_freq_t f = u2_fxpt_freq_from_hilo(p->freq_hi, p->freq_lo); - bool tune_ok = db_tune(rx_dboard, f, &tune_result); - ok &= tune_ok; - print_tune_result("Rx", tune_ok, f, &tune_result); - - if (was_streaming) - restart_streaming(); - } - - if (p->valid & CFGV_INTERP_DECIM){ - int decim = p->decim; - int hb1 = 0; - int hb2 = 0; - - if(!(decim & 1)) { - hb2 = 1; - decim = decim >> 1; - } - - if(!(decim & 1)) { - hb1 = 1; - decim = decim >> 1; - } - - if (decim < MIN_CIC_DECIM || decim > MAX_CIC_DECIM) - ok = false; - else { - dsp_rx_regs->decim_rate = (hb1<<9) | (hb2<<8) | decim; - // printf("Decim: %d, register %d\n", p->decim, (hb1<<9) | (hb2<<8) | decim); - } - } - - if (p->valid & CFGV_SCALE_IQ){ - dsp_rx_regs->scale_iq = p->scale_iq; - } - - // Build reply subpacket - - r->opcode = OP_CONFIG_RX_REPLY_V2; - r->len = sizeof(*r); - r->rid = p->rid; - r->ok = ok; - r->inverted = tune_result.inverted; - r->baseband_freq_hi = u2_fxpt_freq_hi(tune_result.baseband_freq); - r->baseband_freq_lo = u2_fxpt_freq_lo(tune_result.baseband_freq); - r->ddc_freq_hi = u2_fxpt_freq_hi(tune_result.dxc_freq); - r->ddc_freq_lo = u2_fxpt_freq_lo(tune_result.dxc_freq); - r->residual_freq_hi = u2_fxpt_freq_hi(tune_result.residual_freq); - r->residual_freq_lo = u2_fxpt_freq_lo(tune_result.residual_freq); - - return r->len; -} - -static size_t -read_time_cmd(const op_generic_t *p, - void *reply_payload, size_t reply_payload_space) -{ - op_read_time_reply_t *r = (op_read_time_reply_t *) reply_payload; - if (reply_payload_space < sizeof(*r)) - return 0; // no room - - r->opcode = OP_READ_TIME_REPLY; - r->len = sizeof(*r); - r->rid = p->rid; - r->time = timer_regs->time; - - return r->len; -} - -static void -fill_db_info(u2_db_info_t *p, const struct db_base *db) -{ - //p->dbid = db->dbid; - p->freq_min_hi = u2_fxpt_freq_hi(db->freq_min); - p->freq_min_lo = u2_fxpt_freq_lo(db->freq_min); - p->freq_max_hi = u2_fxpt_freq_hi(db->freq_max); - p->freq_max_lo = u2_fxpt_freq_lo(db->freq_max); - p->gain_min = db->gain_min; - p->gain_max = db->gain_max; - p->gain_step_size = db->gain_step_size; -} - -static size_t -dboard_info_cmd(const op_generic_t *p, - void *reply_payload, size_t reply_payload_space) -{ - op_dboard_info_reply_t *r = (op_dboard_info_reply_t *) reply_payload; - if (reply_payload_space < sizeof(*r)) - return 0; // no room - - r->opcode = OP_DBOARD_INFO_REPLY; - r->len = sizeof(*r); - r->rid = p->rid; - r->ok = true; - - fill_db_info(&r->tx_db_info, tx_dboard); - fill_db_info(&r->rx_db_info, rx_dboard); - - r->tx_db_info.dbid = read_dboard_eeprom(I2C_ADDR_TX_A); - r->rx_db_info.dbid = read_dboard_eeprom(I2C_ADDR_RX_A); - - return r->len; -} - -static size_t -peek_cmd(const op_peek_t *p, - void *reply_payload, size_t reply_payload_space) -{ - op_generic_t *r = (op_generic_t *) reply_payload; - - //putstr("peek: addr="); puthex32(p->addr); - //printf(" bytes=%u\n", p->bytes); - - if ((reply_payload_space < (sizeof(*r) + p->bytes)) || - p->bytes > MAX_SUBPKT_LEN - sizeof(op_generic_t)) { - putstr("peek: insufficient reply packet space\n"); - return 0; // FIXME do partial read? - } - - r->opcode = OP_PEEK_REPLY; - r->len = sizeof(*r)+p->bytes; - r->rid = p->rid; - r->ok = true; - - memcpy_wa(reply_payload+sizeof(*r), (void *)p->addr, p->bytes); - - return r->len; -} - -static bool -poke_cmd(const op_poke_t *p) -{ - int bytes = p->len - sizeof(*p); - //putstr("poke: addr="); puthex32(p->addr); - //printf(" bytes=%u\n", bytes); - - uint8_t *src = (uint8_t *)p + sizeof(*p); - memcpy_wa((void *)p->addr, src, bytes); - - return true; -} - -static bool -set_lo_offset_cmd(const op_freq_t *p) -{ - u2_fxpt_freq_t f = u2_fxpt_freq_from_hilo(p->freq_hi, p->freq_lo); - if (p->opcode == OP_SET_TX_LO_OFFSET) - return db_set_lo_offset(tx_dboard, f); - else - return db_set_lo_offset(rx_dboard, f); -} - -static size_t -gpio_read_cmd(const op_gpio_t *p, - void *reply_payload, size_t reply_payload_space) -{ - op_gpio_read_reply_t *r = (op_gpio_read_reply_t *) reply_payload; - if (reply_payload_space < sizeof(*r)) // no room - return 0; - - // Build reply subpacket - - r->opcode = OP_GPIO_READ_REPLY; - r->len = sizeof(op_gpio_read_reply_t); - r->rid = p->rid; - r->ok = true; - r->mbz = 0; - r->value = hal_gpio_read(p->bank); - - return r->len; -} - -static size_t -generic_reply(const op_generic_t *p, - void *reply_payload, size_t reply_payload_space, - bool ok) -{ - op_generic_t *r = (op_generic_t *) reply_payload; - if (reply_payload_space < sizeof(*r)) - return 0; // no room - - r->opcode = p->opcode | OP_REPLY_BIT; - r->len = sizeof(*r); - r->rid = p->rid; - r->ok = ok; - - return r->len; -} - -static size_t -add_eop(void *reply_payload, size_t reply_payload_space) -{ - op_generic_t *r = (op_generic_t *) reply_payload; - if (reply_payload_space < sizeof(*r)) - return 0; // no room - - r->opcode = OP_EOP; - r->len = sizeof(*r); - r->rid = 0; - r->ok = 0; - - return r->len; -} - -void -handle_control_chan_frame(u2_eth_packet_t *pkt, size_t len) -{ - unsigned char reply[sizeof(u2_eth_packet_t) + 4 * sizeof(u2_subpkt_t)] _AL4; - unsigned char *reply_payload = &reply[sizeof(u2_eth_packet_t)]; - int reply_payload_space = sizeof(reply) - sizeof(u2_eth_packet_t); - - // initialize reply - memset(reply, 0, sizeof(reply)); - set_reply_hdr((u2_eth_packet_t *) reply, pkt); - - // point to beginning of payload (subpackets) - unsigned char *payload = ((unsigned char *) pkt) + sizeof(u2_eth_packet_t); - int payload_len = len - sizeof(u2_eth_packet_t); - - size_t subpktlen = 0; - bool ok = false; - - while (payload_len >= sizeof(op_generic_t)){ - const op_generic_t *gp = (const op_generic_t *) payload; - subpktlen = 0; - - // printf("\nopcode = %d\n", gp->opcode); - - switch(gp->opcode){ - case OP_EOP: // end of subpackets - goto end_of_subpackets; - - case OP_ID: - subpktlen = op_id_cmd(gp, reply_payload, reply_payload_space); - break; - - case OP_CONFIG_TX_V2: - subpktlen = config_tx_v2_cmd((op_config_tx_v2_t *) payload, reply_payload, reply_payload_space); - break; - - case OP_CONFIG_RX_V2: - subpktlen = config_rx_v2_cmd((op_config_rx_v2_t *) payload, reply_payload, reply_payload_space); - break; - - case OP_START_RX_STREAMING: - if (pkt->fixed.timestamp == -1) // Start now (default) - start_rx_streaming_cmd(&pkt->ehdr.src, (op_start_rx_streaming_t *) payload); - else - start_rx_streaming_at_cmd(&pkt->ehdr.src, (op_start_rx_streaming_t *)payload, pkt->fixed.timestamp); - ok = true; - goto generic_reply; - - case OP_STOP_RX: - stop_rx_cmd(); - ok = true; - goto generic_reply; - - case OP_RX_ANTENNA: - ok = db_set_antenna(rx_dboard, ((op_config_mimo_t *)payload)->flags); - goto generic_reply; - - case OP_TX_ANTENNA: - ok = db_set_antenna(tx_dboard, ((op_config_mimo_t *)payload)->flags); - goto generic_reply; - - case OP_BURN_MAC_ADDR: - ok = ethernet_set_mac_addr(&((op_burn_mac_addr_t *)payload)->addr); - goto generic_reply; - - case OP_CONFIG_MIMO: - ok = config_mimo_cmd((op_config_mimo_t *) payload); - goto generic_reply; - - case OP_READ_TIME: - subpktlen = read_time_cmd(gp, reply_payload, reply_payload_space); - break; - - case OP_DBOARD_INFO: - subpktlen = dboard_info_cmd(gp, reply_payload, reply_payload_space); - break; - - case OP_SYNC_TO_PPS: - sync_to_pps((op_generic_t *) payload); - ok = true; - goto generic_reply; - - case OP_PEEK: - subpktlen = peek_cmd((op_peek_t *)payload, reply_payload, reply_payload_space); - break; - - case OP_POKE: - ok = poke_cmd((op_poke_t *)payload); - goto generic_reply; - - case OP_SET_TX_LO_OFFSET: - case OP_SET_RX_LO_OFFSET: - ok = set_lo_offset_cmd((op_freq_t *)payload); - goto generic_reply; - - case OP_RESET_DB: - db_init(); - ok = true; - goto generic_reply; - - case OP_SYNC_EVERY_PPS: - ok = sync_every_pps((op_generic_t *) payload); - goto generic_reply; - - case OP_GPIO_SET_DDR: - ok = true; - hal_gpio_set_ddr(((op_gpio_t *)payload)->bank, - ((op_gpio_t *)payload)->value, - ((op_gpio_t *)payload)->mask); - goto generic_reply; - - case OP_GPIO_SET_SELS: - ok = true; - hal_gpio_set_sels(((op_gpio_set_sels_t *)payload)->bank, - (char *)(&((op_gpio_set_sels_t *)payload)->sels)); - goto generic_reply; - - case OP_GPIO_READ: - subpktlen = gpio_read_cmd((op_gpio_t *) payload, reply_payload, reply_payload_space); - break; - - case OP_GPIO_WRITE: - ok = true; - hal_gpio_write(((op_gpio_t *)payload)->bank, - ((op_gpio_t *)payload)->value, - ((op_gpio_t *)payload)->mask); - goto generic_reply; - - case OP_GPIO_STREAM: - ok = true; - dsp_rx_regs->gpio_stream_enable = (uint32_t)((op_gpio_t *)payload)->value; - goto generic_reply; - - // Add new opcode handlers here - - generic_reply: - subpktlen = generic_reply(gp, reply_payload, reply_payload_space, ok); - break; - - default: - printf("app_common_v2: unhandled opcode = %d\n", gp->opcode); - break; - } - - int t = (gp->len + 3) & ~3; // bump to a multiple of 4 - payload += t; - payload_len -= t; - - subpktlen = (subpktlen + 3) & ~3; // bump to a multiple of 4 - reply_payload += subpktlen; - reply_payload_space -= subpktlen; - } - - end_of_subpackets: - - // add the EOP marker - subpktlen = add_eop(reply_payload, reply_payload_space); - subpktlen = (subpktlen + 3) & ~3; // bump to a multiple of 4 - reply_payload += subpktlen; - reply_payload_space -= subpktlen; - - send_reply(reply, reply_payload - reply); -} - - -/* - * Called when an ethernet packet is received. - * Return true if we handled it here, otherwise - * it'll be passed on to the DSP Tx pipe - */ -bool -eth_pkt_inspector(dbsm_t *sm, int bufno) -{ - u2_eth_packet_t *pkt = (u2_eth_packet_t *) buffer_ram(bufno); - size_t byte_len = (buffer_pool_status->last_line[bufno] - 1) * 4; - - //static size_t last_len = 0; - - // hal_toggle_leds(0x1); - - // inspect rcvd frame and figure out what do do. - - if (pkt->ehdr.ethertype != U2_ETHERTYPE) - return true; // ignore, probably bogus PAUSE frame from MAC - - int chan = u2p_chan(&pkt->fixed); - - switch (chan){ - case CONTROL_CHAN: - handle_control_chan_frame(pkt, byte_len); - return true; // we handled the packet - break; - - case 0: - default: -#if 0 - if (last_len != 0){ - if (byte_len != last_len){ - printf("Len: %d last: %d\n", byte_len, last_len); - } - } - last_len = byte_len; - - if((pkt->thdr.seqno) == exp_seqno){ - exp_seqno++; - //putchar('.'); - } - else { - // putchar('S'); - //printf("S%d %d ",exp_seqno,pkt->thdr.seqno); - exp_seqno = pkt->thdr.seqno + 1; - } -#endif - return false; // pass it on to Tx DSP - break; - } -} - -/* - * Called when eth phy state changes (w/ interrupts disabled) - */ -void -link_changed_callback(int speed) -{ - link_is_up = speed != 0; - hal_set_leds(link_is_up ? LED_RJ45 : 0x0, LED_RJ45); - printf("\neth link changed: speed = %d\n", speed); -} - - -void -print_tune_result(char *msg, bool tune_ok, - u2_fxpt_freq_t target_freq, struct tune_result *r) -{ -#if 0 - printf("db_tune %s %s\n", msg, tune_ok ? "true" : "false"); - putstr(" target_freq "); print_fxpt_freq(target_freq); newline(); - putstr(" baseband_freq "); print_fxpt_freq(r->baseband_freq); newline(); - putstr(" dxc_freq "); print_fxpt_freq(r->dxc_freq); newline(); - putstr(" residual_freq "); print_fxpt_freq(r->residual_freq); newline(); - printf(" inverted %s\n", r->inverted ? "true" : "false"); -#endif -} diff --git a/usrp2/firmware/apps/app_common_v2.h b/usrp2/firmware/apps/app_common_v2.h deleted file mode 100644 index ff1baec06..000000000 --- a/usrp2/firmware/apps/app_common_v2.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2008,2009 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifndef INCLUDED_APP_COMMON_H -#define INCLUDED_APP_COMMON_H - -#include "bool.h" -#include "usrp2_eth_packet.h" -#include "dbsm.h" -#include "memory_map.h" -#include "hal_io.h" -#include <stddef.h> -#include <db.h> - -#define CPU_TX_BUF 7 // cpu -> eth - -#define _AL4 __attribute__((aligned (4))) - -extern volatile bool link_is_up; // eth handler sets this - -// If there's a dbsm that sends to the ethernet, put it's address here -extern dbsm_t *ac_could_be_sending_to_eth; - -extern int cpu_tx_buf_dest_port; - -void set_reply_hdr(u2_eth_packet_t *reply_pkt, u2_eth_packet_t const *cmd_pkt); - -/* - * Called when an ethernet packet is received. - * Return true if we handled it here, otherwise - * it'll be passed on to the DSP Tx pipe - */ -bool eth_pkt_inspector(dbsm_t *sm, int bufno); - -void link_changed_callback(int speed); - -void -print_tune_result(char *msg, bool tune_ok, - u2_fxpt_freq_t target_freq, struct tune_result *r); - - -void start_rx_streaming_cmd(const u2_mac_addr_t *host, op_start_rx_streaming_t *p); -void start_rx_streaming_at_cmd(const u2_mac_addr_t *host, op_start_rx_streaming_t *p, uint32_t time); -void stop_rx_cmd(void); -void restart_streaming(void); -void restart_streaming_at(uint32_t time); -bool is_streaming(void); - -void handle_control_chan_frame(u2_eth_packet_t *pkt, size_t len); - -#endif /* INCLUDED_APP_COMMON_H */ diff --git a/usrp2/firmware/apps/app_passthru_v2.c b/usrp2/firmware/apps/app_passthru_v2.c deleted file mode 100644 index 406c56b3b..000000000 --- a/usrp2/firmware/apps/app_passthru_v2.c +++ /dev/null @@ -1,251 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "app_passthru_v2.h" -#include "buffer_pool.h" -#include "memcpy_wa.h" -#include "ethernet.h" -#include "nonstdio.h" -#include "print_rmon_regs.h" -#include "db.h" -#include "clocks.h" -#include <string.h> - -volatile bool link_is_up = false; // eth handler sets this - - -// If this is non-zero, this dbsm could be writing to the ethernet -dbsm_t *ac_could_be_sending_to_eth; - -//static unsigned char exp_seqno = 0; - -void -set_reply_hdr(u2_eth_packet_t *reply_pkt, u2_eth_packet_t const *cmd_pkt) -{ - reply_pkt->ehdr.dst = cmd_pkt->ehdr.src; - reply_pkt->ehdr.src = *ethernet_mac_addr(); - reply_pkt->ehdr.ethertype = U2_ETHERTYPE; - reply_pkt->thdr.flags = 0; - reply_pkt->thdr.fifo_status = 0; // written by protocol engine - reply_pkt->thdr.seqno = 0; // written by protocol engine - reply_pkt->thdr.ack = 0; // written by protocol engine - u2p_set_word0(&reply_pkt->fixed, 0, CONTROL_CHAN); - reply_pkt->fixed.timestamp = timer_regs->time; -} - -static void -send_reply(unsigned char *reply, size_t reply_len) -{ - if (reply_len < 64) - reply_len = 64; - - // wait for buffer to become idle - hal_set_leds(0x4, 0x4); - while((buffer_pool_status->status & BPS_IDLE(CPU_TX_BUF)) == 0) - ; - hal_set_leds(0x0, 0x4); - - // copy reply into CPU_TX_BUF - memcpy_wa(buffer_ram(CPU_TX_BUF), reply, reply_len); - - // wait until nobody else is sending to the ethernet - if (ac_could_be_sending_to_eth){ - hal_set_leds(0x8, 0x8); - dbsm_wait_for_opening(ac_could_be_sending_to_eth); - hal_set_leds(0x0, 0x8); - } - - // fire it off - bp_send_from_buf(CPU_TX_BUF, PORT_ETH, 1, 0, reply_len/4); - - // wait for it to complete (not long, it's a small pkt) - while((buffer_pool_status->status & (BPS_DONE(CPU_TX_BUF) | BPS_ERROR(CPU_TX_BUF))) == 0) - ; - - bp_clear_buf(CPU_TX_BUF); -} - - -static size_t -op_id_cmd(const op_generic_t *p, - void *reply_payload, size_t reply_payload_space) -{ - op_id_reply_t *r = (op_id_reply_t *) reply_payload; - if (reply_payload_space < sizeof(*r)) // no room - return 0; - - // Build reply subpacket - - r->opcode = OP_ID_REPLY; - r->len = sizeof(op_id_reply_t); - r->rid = p->rid; - r->addr = *ethernet_mac_addr(); - r->hw_rev = 0x0000; // FIXME - // r->fpga_md5sum = ; // FIXME - // r->sw_md5sum = ; // FIXME - - // FIXME Add d'board info, including dbid, min/max gain, min/max freq - - return r->len; -} - -static size_t -add_eop(void *reply_payload, size_t reply_payload_space) -{ - op_generic_t *r = (op_generic_t *) reply_payload; - if (reply_payload_space < sizeof(*r)) - return 0; // no room - - r->opcode = OP_EOP; - r->len = sizeof(*r); - r->rid = 0; - r->ok = 0; - - return r->len; -} - -bool -handle_control_chan_frame(u2_eth_packet_t *pkt, size_t len) -{ - unsigned char reply[sizeof(u2_eth_packet_t) + 4 * sizeof(u2_subpkt_t)] _AL4; - unsigned char *reply_payload = &reply[sizeof(u2_eth_packet_t)]; - int reply_payload_space = sizeof(reply) - sizeof(u2_eth_packet_t); - - bool handled_it = false; - - // initialize reply - memset(reply, 0, sizeof(reply)); - set_reply_hdr((u2_eth_packet_t *) reply, pkt); - - // point to beginning of payload (subpackets) - unsigned char *payload = ((unsigned char *) pkt) + sizeof(u2_eth_packet_t); - int payload_len = len - sizeof(u2_eth_packet_t); - - size_t subpktlen = 0; - - while (payload_len >= sizeof(op_generic_t)){ - const op_generic_t *gp = (const op_generic_t *) payload; - subpktlen = 0; - - switch(gp->opcode){ - case OP_EOP: // end of subpackets - goto end_of_subpackets; - - case OP_ID: - subpktlen = op_id_cmd(gp, reply_payload, reply_payload_space); - handled_it = true; - break; - - default: - if (0){ - printf("\npassing on %d\n", gp->opcode); - } - break; - } - - int t = (gp->len + 3) & ~3; // bump to a multiple of 4 - payload += t; - payload_len -= t; - - subpktlen = (subpktlen + 3) & ~3; // bump to a multiple of 4 - reply_payload += subpktlen; - reply_payload_space -= subpktlen; - } - - end_of_subpackets: - - if (handled_it){ - // add the EOP marker - subpktlen = add_eop(reply_payload, reply_payload_space); - subpktlen = (subpktlen + 3) & ~3; // bump to a multiple of 4 - reply_payload += subpktlen; - reply_payload_space -= subpktlen; - - send_reply(reply, reply_payload - reply); - } - - return handled_it; -} - - -/* - * Called when an ethernet packet is received. - * Return true if we handled it here, otherwise - * it'll be passed on to the DSP Tx pipe - */ -bool -eth_pkt_inspector(dbsm_t *sm, int bufno) -{ - u2_eth_packet_t *pkt = (u2_eth_packet_t *) buffer_ram(bufno); - size_t byte_len = (buffer_pool_status->last_line[bufno] - 3) * 4; - - //static size_t last_len = 0; - - // hal_toggle_leds(0x1); - - // inspect rcvd frame and figure out what do do. - - if (pkt->ehdr.ethertype != U2_ETHERTYPE) - return true; // ignore, probably bogus PAUSE frame from MAC - - int chan = u2p_chan(&pkt->fixed); - - switch (chan){ - case CONTROL_CHAN: - return handle_control_chan_frame(pkt, byte_len); - break; - - case 0: - default: -#if 0 - if (last_len != 0){ - if (byte_len != last_len){ - printf("Len: %d last: %d\n", byte_len, last_len); - } - } - last_len = byte_len; - - if((pkt->thdr.seqno) == exp_seqno){ - exp_seqno++; - //putchar('.'); - } - else { - // putchar('S'); - //printf("S%d %d ",exp_seqno,pkt->thdr.seqno); - exp_seqno = pkt->thdr.seqno + 1; - } -#endif - return false; // pass it on to Tx DSP - break; - } -} - -/* - * Called when eth phy state changes (w/ interrupts disabled) - */ -void -link_changed_callback(int speed) -{ - link_is_up = speed != 0; - hal_set_leds(link_is_up ? LED_RJ45 : 0x0, LED_RJ45); - printf("\neth link changed: speed = %d\n", speed); -} diff --git a/usrp2/firmware/apps/app_passthru_v2.h b/usrp2/firmware/apps/app_passthru_v2.h deleted file mode 100644 index 419997ff6..000000000 --- a/usrp2/firmware/apps/app_passthru_v2.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifndef INCLUDED_APP_COMMON_H -#define INCLUDED_APP_COMMON_H - -#include "bool.h" -#include "usrp2_eth_packet.h" -#include "dbsm.h" -#include "memory_map.h" -#include "hal_io.h" -#include <stddef.h> -#include <db.h> - -#define CPU_TX_BUF 7 // cpu -> eth - -#define _AL4 __attribute__((aligned (4))) - -extern volatile bool link_is_up; // eth handler sets this - - -// If there's a dbsm that sends to the ethernet, put it's address here -extern dbsm_t *ac_could_be_sending_to_eth; - - -void set_reply_hdr(u2_eth_packet_t *reply_pkt, u2_eth_packet_t const *cmd_pkt); - -/* - * Called when an ethernet packet is received. - * Return true if we handled it here, otherwise - * it'll be passed on to the DSP Tx pipe - */ -bool eth_pkt_inspector(dbsm_t *sm, int bufno); - -void link_changed_callback(int speed); - -bool handle_control_chan_frame(u2_eth_packet_t *pkt, size_t len); - -#endif /* INCLUDED_APP_COMMON_H */ diff --git a/usrp2/firmware/apps/bitrot/tx_drop.c b/usrp2/firmware/apps/bitrot/tx_drop.c deleted file mode 100644 index d5d6557de..000000000 --- a/usrp2/firmware/apps/bitrot/tx_drop.c +++ /dev/null @@ -1,261 +0,0 @@ -/* - * Copyright 2007,2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "u2_init.h" -#include "memory_map.h" -#include "spi.h" -#include "hal_io.h" -#include "buffer_pool.h" -#include "pic.h" -#include "bool.h" -#include "ethernet.h" -#include "nonstdio.h" -#include "usrp2_eth_packet.h" -#include "dbsm.h" -#include "app_common.h" -#include "print_rmon_regs.h" -#include <stddef.h> -#include <stdlib.h> -#include <string.h> - - -/* - * Like tx_only.c, but we discard data packets instead of sending them to the - * DSP TX pipeline. - */ - -int total_rx_pkts = 0; -int total_rx_bytes = 0; - - -static int timer_delta = MASTER_CLK_RATE/1000; // tick at 1kHz - -/* - * This program can respond to queries from the host - * and stream rx samples. - * - * Buffer 1 is used by the cpu to send frames to the host. - * Buffers 2 and 3 are used to double-buffer the DSP Rx to eth flow - * Buffers 4 and 5 are used to double-buffer the eth to DSP Tx eth flow - */ -//#define CPU_RX_BUF 0 // eth -> cpu -//#define CPU_TX_BUF 1 // cpu -> eth - -#define DSP_RX_BUF_0 2 // dsp rx -> eth (double buffer) -#define DSP_RX_BUF_1 3 // dsp rx -> eth -#define DSP_TX_BUF_0 4 // eth -> dsp tx (double buffer) -#define DSP_TX_BUF_1 5 // eth -> dsp tx - - -/* - * ================================================================ - * configure DSP TX double buffering state machine - * ================================================================ - */ - -// 4 lines of ethernet hdr + 2 lines (word0 + timestamp) -// DSP Tx reads word0 (flags) + timestamp followed by samples - -#define DSP_TX_FIRST_LINE 4 -#define DSP_TX_SAMPLES_PER_FRAME 250 // not used except w/ debugging -#define DSP_TX_EXTRA_LINES 2 // reads word0 + timestamp - -// Receive from ethernet -buf_cmd_args_t dsp_tx_recv_args = { - PORT_ETH, - 0, - BP_LAST_LINE -}; - -// send to DSP Tx -buf_cmd_args_t dsp_tx_send_args = { - PORT_DSP, - DSP_TX_FIRST_LINE, // starts just past ethernet header - 0 // filled in from last_line register -}; - -dbsm_t dsp_tx_sm; // the state machine - - -// ---------------------------------------------------------------- - - -// The mac address of the host we're sending to. -u2_mac_addr_t host_mac_addr; - - -void -timer_irq_handler(unsigned irq) -{ - hal_set_timeout(timer_delta); // schedule next timeout -} - -// Tx DSP underrun -void -underrun_irq_handler(unsigned irq) -{ - putchar('U'); - - dbsm_stop(&dsp_tx_sm); - dsp_tx_regs->clear_state = 1; - dbsm_start(&dsp_tx_sm); // restart sm so we're listening to ethernet again - - // putstr("\nirq: underrun\n"); -} - - -void -start_rx_cmd(const u2_mac_addr_t *host, op_start_rx_t *p) -{ -} - -void -stop_rx_cmd(void) -{ -} - -static void -setup_tx() -{ - dsp_tx_regs->clear_state = 1; - bp_clear_buf(DSP_TX_BUF_0); - bp_clear_buf(DSP_TX_BUF_1); - - int tx_scale = 256; - int interp = 32; - - op_config_tx_t def_config; - memset(&def_config, 0, sizeof(def_config)); - def_config.phase_inc = 408021893; // 9.5 MHz [2**32 * fc/fsample] - def_config.scale_iq = (tx_scale << 16) | tx_scale; - def_config.interp = interp; - - // setup Tx DSP regs - config_tx_cmd(&def_config); -} - - -inline static void -buffer_irq_handler(unsigned irq) -{ - uint32_t status = buffer_pool_status->status; - - if (status & BPS_ERROR_ALL){ - // FIXME rare path, handle error conditions - putstr("Errors! status = "); - puthex32_nl(status); - - printf("total_rx_pkts = %d\n", total_rx_pkts); - printf("total_rx_bytes = %d\n", total_rx_bytes); - - print_rmon_regs(); - - if (status & (BPS_ERROR(DSP_TX_BUF_0) | BPS_ERROR(DSP_TX_BUF_1))){ - dbsm_stop(&dsp_tx_sm); - dsp_tx_regs->clear_state = 1; // try to restart - dbsm_start(&dsp_tx_sm); - return; - } - } - - dbsm_process_status(&dsp_tx_sm, status); - - if (status & BPS_DONE(CPU_TX_BUF)){ - bp_clear_buf(CPU_TX_BUF); - } -} - - -/* - * Called when an ethernet packet is received. - * - * Claim that we handled all the packets, - * dropping those destined for the TX DSP chain - * on the ground. - */ -bool -nop_eth_pkt_inspector(dbsm_t *sm, int bufno) -{ - hal_toggle_leds(0x1); - - u2_eth_packet_t *pkt = (u2_eth_packet_t *) buffer_ram(bufno); - size_t byte_len = (buffer_pool_status->last_line[bufno] - 1) * 4; - - total_rx_pkts++; - total_rx_bytes += byte_len; - - // inspect rcvd frame and figure out what do do. - - if (pkt->ehdr.ethertype != U2_ETHERTYPE) - return true; // ignore, probably bogus PAUSE frame from MAC - - int chan = u2p_chan(&pkt->fixed); - - switch (chan){ - case CONTROL_CHAN: - handle_control_chan_frame(pkt, byte_len); - return true; // we handled the packet - break; - - case 0: - default: - return true; // We handled the data by dropping it :) - break; - } -} - - -int -main(void) -{ - u2_init(); - - // setup tx gpio bits for GPIOM_FPGA_1 -- fpga debug output - hal_gpio_set_tx_mode(15, 0, GPIOM_FPGA_1); - hal_gpio_set_rx_mode(15, 0, GPIOM_FPGA_1); - - putstr("\ntx_drop\n"); - - // Control LEDs - hal_set_leds(0x0, 0x3); - - pic_register_handler(IRQ_UNDERRUN, underrun_irq_handler); - - ethernet_register_link_changed_callback(link_changed_callback); - ethernet_init(); - - // initialize double buffering state machine for ethernet -> DSP Tx - - dbsm_init(&dsp_tx_sm, DSP_TX_BUF_0, - &dsp_tx_recv_args, &dsp_tx_send_args, - nop_eth_pkt_inspector); - - // program tx registers - setup_tx(); - - // kick off the state machine - dbsm_start(&dsp_tx_sm); - - while(1){ - buffer_irq_handler(0); - } -} - diff --git a/usrp2/firmware/apps/bitrot/tx_drop2.c b/usrp2/firmware/apps/bitrot/tx_drop2.c deleted file mode 100644 index 7f9b7a563..000000000 --- a/usrp2/firmware/apps/bitrot/tx_drop2.c +++ /dev/null @@ -1,292 +0,0 @@ -/* - * Copyright 2007,2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "u2_init.h" -#include "memory_map.h" -#include "spi.h" -#include "hal_io.h" -#include "buffer_pool.h" -#include "pic.h" -#include "bool.h" -#include "ethernet.h" -#include "nonstdio.h" -#include "usrp2_eth_packet.h" -#include "dbsm.h" -#include "app_common.h" -#include "print_rmon_regs.h" -#include <stddef.h> -#include <stdlib.h> -#include <string.h> - - -/* - * Like tx_only.c, but we discard data packets instead of sending them to the - * DSP TX pipeline. - */ - -int total_rx_pkts = 0; -int total_rx_bytes = 0; - - -static int timer_delta = MASTER_CLK_RATE/1000; // tick at 1kHz - -/* - * This program can respond to queries from the host - * and stream rx samples. - * - * Buffer 1 is used by the cpu to send frames to the host. - * Buffers 2 and 3 are used to double-buffer the DSP Rx to eth flow - * Buffers 4 and 5 are used to double-buffer the eth to DSP Tx eth flow - */ -//#define CPU_RX_BUF 0 // eth -> cpu -//#define CPU_TX_BUF 1 // cpu -> eth - -#define DSP_RX_BUF_0 2 // dsp rx -> eth (double buffer) -#define DSP_RX_BUF_1 3 // dsp rx -> eth -#define DSP_TX_BUF_0 4 // eth -> dsp tx (double buffer) -#define DSP_TX_BUF_1 5 // eth -> dsp tx - - -/* - * ================================================================ - * configure DSP RX double buffering state machine - * ================================================================ - */ - -// 4 lines of ethernet hdr + 1 line (word0) -// DSP Rx writes timestamp followed by nlines_per_frame of samples -#define DSP_RX_FIRST_LINE 5 -#define DSP_RX_SAMPLES_PER_FRAME 128 -#define DSP_RX_EXTRA_LINES 1 // writes timestamp - -// Receive from DSP Rx -buf_cmd_args_t dsp_rx_recv_args = { - PORT_DSP, - DSP_RX_FIRST_LINE, - BP_LAST_LINE -}; - -// send to ethernet -buf_cmd_args_t dsp_rx_send_args = { - PORT_ETH, - 0, // starts with ethernet header in line 0 - 0, // filled in from last_line register -}; - -dbsm_t dsp_rx_sm; // the state machine - -/* - * ================================================================ - * configure DSP TX double buffering state machine - * ================================================================ - */ - -// 4 lines of ethernet hdr + 2 lines (word0 + timestamp) -// DSP Tx reads word0 (flags) + timestamp followed by samples - -#define DSP_TX_FIRST_LINE 4 -#define DSP_TX_SAMPLES_PER_FRAME 250 // not used except w/ debugging -#define DSP_TX_EXTRA_LINES 2 // reads word0 + timestamp - -// Receive from ethernet -buf_cmd_args_t dsp_tx_recv_args = { - PORT_ETH, - 0, - BP_LAST_LINE -}; - -// send to DSP Tx -buf_cmd_args_t dsp_tx_send_args = { - PORT_DSP, - DSP_TX_FIRST_LINE, // starts just past ethernet header - 0 // filled in from last_line register -}; - -dbsm_t dsp_tx_sm; // the state machine - - -// ---------------------------------------------------------------- - - -// The mac address of the host we're sending to. -u2_mac_addr_t host_mac_addr; - - -void -timer_irq_handler(unsigned irq) -{ - hal_set_timeout(timer_delta); // schedule next timeout -} - -// Tx DSP underrun -void -underrun_irq_handler(unsigned irq) -{ - putchar('U'); - - dbsm_stop(&dsp_tx_sm); - dsp_tx_regs->clear_state = 1; - dbsm_start(&dsp_tx_sm); // restart sm so we're listening to ethernet again - - // putstr("\nirq: underrun\n"); -} - - -void -start_rx_cmd(const u2_mac_addr_t *host, op_start_rx_t *p) -{ -} - -void -stop_rx_cmd(void) -{ -} - -static void -setup_tx() -{ - dsp_tx_regs->clear_state = 1; - bp_clear_buf(DSP_TX_BUF_0); - bp_clear_buf(DSP_TX_BUF_1); - -#if 1 - int tx_scale = 256; - int interp = 32; - - op_config_tx_t def_config; - memset(&def_config, 0, sizeof(def_config)); - def_config.phase_inc = 408021893; // 9.5 MHz [2**32 * fc/fsample] - def_config.scale_iq = (tx_scale << 16) | tx_scale; - def_config.interp = interp; - - // setup Tx DSP regs - config_tx_cmd(&def_config); -#endif -} - - -inline static void -buffer_irq_handler(unsigned irq) -{ - uint32_t status = buffer_pool_status->status; - - if (status & BPS_ERROR_ALL){ - // FIXME rare path, handle error conditions - putstr("Errors! status = "); - puthex32_nl(status); - - printf("total_rx_pkts = %d\n", total_rx_pkts); - printf("total_rx_bytes = %d\n", total_rx_bytes); - - print_rmon_regs(); - - if (status & (BPS_ERROR(DSP_TX_BUF_0) | BPS_ERROR(DSP_TX_BUF_1))){ - dbsm_stop(&dsp_tx_sm); - dsp_tx_regs->clear_state = 1; // try to restart - dbsm_start(&dsp_tx_sm); - return; - } - } - - dbsm_process_status(&dsp_tx_sm, status); - - if (status & BPS_DONE(CPU_TX_BUF)){ - bp_clear_buf(CPU_TX_BUF); - } -} - -/* - * Called when an ethernet packet is received. - * Return true if we handled it here (always!) - */ -bool -nop_eth_pkt_inspector(dbsm_t *sm, int bufno) -{ - hal_toggle_leds(0x1); - - u2_eth_packet_t *pkt = (u2_eth_packet_t *) buffer_ram(bufno); - size_t byte_len = (buffer_pool_status->last_line[bufno] - 1) * 4; - - total_rx_pkts++; - total_rx_bytes += byte_len; - - // inspect rcvd frame and figure out what do do. - - if (pkt->ehdr.ethertype != U2_ETHERTYPE) - return true; // ignore, probably bogus PAUSE frame from MAC - - int chan = u2p_chan(&pkt->fixed); - - switch (chan){ - case CONTROL_CHAN: - handle_control_chan_frame(pkt, byte_len); - return true; // we handled the packet - break; - - case 0: - default: - return true; // say we handled it - break; - } -} - - -int -main(void) -{ - u2_init(); - - // setup tx gpio bits for GPIOM_FPGA_1 -- fpga debug output - hal_gpio_set_tx_mode(15, 0, GPIOM_FPGA_1); - hal_gpio_set_rx_mode(15, 0, GPIOM_FPGA_1); // no printing... - - putstr("\ntx_drop2\n"); - - // Control LEDs - hal_set_leds(0x0, 0x3); - - // pic_register_handler(IRQ_OVERRUN, overrun_irq_handler); - pic_register_handler(IRQ_UNDERRUN, underrun_irq_handler); - - //pic_register_handler(IRQ_TIMER, timer_irq_handler); - //hal_set_timeout(timer_delta); - - ethernet_register_link_changed_callback(link_changed_callback); - - ethernet_init(); - - // initialize double buffering state machine for ethernet -> DSP Tx - - dbsm_init(&dsp_tx_sm, DSP_TX_BUF_0, - &dsp_tx_recv_args, &dsp_tx_send_args, - nop_eth_pkt_inspector); - - // program tx registers - setup_tx(); - - // kick off the state machine - dbsm_start(&dsp_tx_sm); - - while(1){ - buffer_irq_handler(0); - } -} - diff --git a/usrp2/firmware/apps/bitrot/tx_drop_rate_limited.c b/usrp2/firmware/apps/bitrot/tx_drop_rate_limited.c deleted file mode 100644 index 0eab25b34..000000000 --- a/usrp2/firmware/apps/bitrot/tx_drop_rate_limited.c +++ /dev/null @@ -1,233 +0,0 @@ -/* - * Copyright 2007,2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "u2_init.h" -#include "memory_map.h" -#include "spi.h" -#include "hal_io.h" -#include "buffer_pool.h" -#include "pic.h" -#include "bool.h" -#include "ethernet.h" -#include "nonstdio.h" -#include "usrp2_eth_packet.h" -#include "dbsm.h" -#include "app_common.h" -#include "print_rmon_regs.h" -#include "eth_mac.h" -#include <stddef.h> -#include <stdlib.h> -#include <string.h> - - -/* - * receive packets from ethernet at a fixed rate and discard them - */ - -int total_rx_pkts = 0; -int total_rx_bytes = 0; - - -static int timer_delta = (int)(MASTER_CLK_RATE * 10e-6); // 10us / tick - - -/* - * This program can respond to queries from the host - * and stream rx samples. - * - * Buffer 1 is used by the cpu to send frames to the host. - * Buffers 2 and 3 are used to double-buffer the DSP Rx to eth flow - * Buffers 4 and 5 are used to double-buffer the eth to DSP Tx eth flow - */ -//#define CPU_RX_BUF 0 // eth -> cpu -//#define CPU_TX_BUF 1 // cpu -> eth - -#define DSP_RX_BUF_0 2 // dsp rx -> eth (double buffer) -#define DSP_RX_BUF_1 3 // dsp rx -> eth -#define DSP_TX_BUF_0 4 // eth -> dsp tx (double buffer) -#define DSP_TX_BUF_1 5 // eth -> dsp tx - - - -// ---------------------------------------------------------------- - - -// The mac address of the host we're sending to. -u2_mac_addr_t host_mac_addr; - - -static volatile bool receive_packet_now = false; - -void -timer_irq_handler(unsigned irq) -{ - hal_set_timeout(timer_delta); // schedule next timeout - receive_packet_now = true; -} - - -// Tx DSP underrun -void -underrun_irq_handler(unsigned irq) -{ - putchar('U'); -} - - -void -start_rx_cmd(const u2_mac_addr_t *host, op_start_rx_t *p) -{ -} - -void -stop_rx_cmd(void) -{ -} - -static void -setup_tx() -{ - dsp_tx_regs->clear_state = 1; - bp_clear_buf(DSP_TX_BUF_0); - bp_clear_buf(DSP_TX_BUF_1); - - int tx_scale = 256; - int interp = 32; - - op_config_tx_t def_config; - memset(&def_config, 0, sizeof(def_config)); - def_config.phase_inc = 408021893; // 9.5 MHz [2**32 * fc/fsample] - def_config.scale_iq = (tx_scale << 16) | tx_scale; - def_config.interp = interp; - - // setup Tx DSP regs - config_tx_cmd(&def_config); -} - - -/* - * Called when an ethernet packet is received. - * - * Claim that we handled all the packets, - * dropping those destined for the TX DSP chain - * on the ground. - */ -bool -nop_eth_pkt_inspector(dbsm_t *sm, int bufno) -{ - hal_toggle_leds(0x1); - - u2_eth_packet_t *pkt = (u2_eth_packet_t *) buffer_ram(bufno); - size_t byte_len = (buffer_pool_status->last_line[bufno] - 1) * 4; - - total_rx_pkts++; - total_rx_bytes += byte_len; - - // inspect rcvd frame and figure out what do do. - - if (pkt->ehdr.ethertype != U2_ETHERTYPE) - return true; // ignore, probably bogus PAUSE frame from MAC - - int chan = u2p_chan(&pkt->fixed); - - switch (chan){ - case CONTROL_CHAN: - handle_control_chan_frame(pkt, byte_len); - return true; // we handled the packet - break; - - case 0: - default: - return true; // We handled the data by dropping it :) - break; - } -} - - -inline static void -buffer_irq_handler(unsigned irq) -{ - uint32_t status = buffer_pool_status->status; - - if (status & (BPS_DONE(CPU_TX_BUF) | BPS_ERROR(CPU_TX_BUF))) - bp_clear_buf(CPU_TX_BUF); - - if (status & (BPS_DONE(DSP_TX_BUF_0) | BPS_ERROR(DSP_TX_BUF_0))){ - bp_clear_buf(DSP_TX_BUF_0); - - if (status & BPS_ERROR(DSP_TX_BUF_0)){ - int crc = eth_mac_read_rmon(0x05); - int fifo_full = eth_mac_read_rmon(0x06); - int too_short_too_long = eth_mac_read_rmon(0x07); - putstr("Errors! status = "); - puthex32_nl(status); - - printf("crc_err\t\t= %d\n", crc); - printf("fifo_full\t\t= %d\n", fifo_full); - printf("too_short_too_long\t= %d\n", too_short_too_long); - - printf("total_rx_pkts = %d\n", total_rx_pkts); - printf("total_rx_bytes = %d\n", total_rx_bytes); - } - else - nop_eth_pkt_inspector(0, DSP_TX_BUF_0); - } - - if (receive_packet_now && (status & BPS_IDLE(DSP_TX_BUF_0))){ - receive_packet_now = false; - bp_receive_to_buf(DSP_TX_BUF_0, PORT_ETH, 1, 0, BP_LAST_LINE); - } -} - - -int -main(void) -{ - u2_init(); - - // setup tx gpio bits for GPIOM_FPGA_1 -- fpga debug output - hal_gpio_set_tx_mode(15, 0, GPIOM_FPGA_1); - hal_gpio_set_rx_mode(15, 0, GPIOM_FPGA_1); - - putstr("\ntx_drop_rate_limited\n"); - - // Control LEDs - hal_set_leds(0x0, 0x3); - - pic_register_handler(IRQ_UNDERRUN, underrun_irq_handler); - - pic_register_handler(IRQ_TIMER, timer_irq_handler); - hal_set_timeout(timer_delta); - - ethernet_register_link_changed_callback(link_changed_callback); - ethernet_init(); - - // program tx registers - setup_tx(); - - // start a receive from ethernet - bp_receive_to_buf(DSP_TX_BUF_0, PORT_ETH, 1, 0, BP_LAST_LINE); - - while(1){ - buffer_irq_handler(0); - } -} - diff --git a/usrp2/firmware/apps/blink_leds.c b/usrp2/firmware/apps/blink_leds.c deleted file mode 100644 index 682ca8db2..000000000 --- a/usrp2/firmware/apps/blink_leds.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "u2_init.h" -#include "memory_map.h" -#include "hal_io.h" -#include "nonstdio.h" - -int -main(void) -{ - int counter = 0; - - u2_init(); - - putstr("blink_leds\n"); - while(1){ - output_regs->leds = (counter++ & 0x3); - } - - return 0; -} diff --git a/usrp2/firmware/apps/blink_leds2.c b/usrp2/firmware/apps/blink_leds2.c deleted file mode 100644 index d4bd89a19..000000000 --- a/usrp2/firmware/apps/blink_leds2.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "u2_init.h" -#include "memory_map.h" -#include "hal_io.h" -#include "pic.h" -#include "nonstdio.h" - -//#define DELTA_T (MASTER_CLK_RATE/2) // 0.5s (10ns per tick) -#define DELTA_T 5000 // 5 us (10ns per tick) - - -void -timer_handler(unsigned irq) -{ - hal_set_timeout(DELTA_T); // schedule next timeout - hal_toggle_leds(0x2); -} - -int -main(void) -{ - u2_init(); - - putstr("blink_leds2\n"); - pic_register_handler(IRQ_TIMER, timer_handler); - hal_set_timeout(DELTA_T); // schedule next timeout - - while(1){ - hal_toggle_leds(0x1); - } - - return 0; -} diff --git a/usrp2/firmware/apps/buf_ram_test.c b/usrp2/firmware/apps/buf_ram_test.c deleted file mode 100644 index e639166a1..000000000 --- a/usrp2/firmware/apps/buf_ram_test.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#include "u2_init.h" -#include "memory_map.h" -#include "bool.h" -#include "nonstdio.h" -#include "hal_io.h" -#include "mdelay.h" - - -static void -write_bufs(void) -{ - int i, n; - int counter = 0; - - for (n = 0; n < NBUFFERS; n++){ - volatile int *p = buffer_ram(n); - for (i = 0; i < BP_NLINES; i++) - p[i] = counter++; - } -} - -// return number of errors detected -static int -check_bufs(void) -{ - int i, n; - int counter = 0; - int nerrors = 0; - - for (n = 0; n < NBUFFERS; n++){ - volatile int *p = buffer_ram(n); - for (i = 0; i < BP_NLINES; i++, counter++){ - int rd = p[i]; - if (rd != counter){ - putchar('b'); - putchar(n + '0'); - putchar('['); - puthex16(i); - putstr("] exp: "); - puthex32(counter); - putstr(" got: "); - puthex32_nl(rd); - nerrors++; - } - } - } - return nerrors; -} - - -int -main(void) -{ - u2_init(); - - output_regs->leds = 0; - - write_bufs(); - int nerrors = check_bufs(); - - if (nerrors == 0){ - output_regs->leds = 0x3; // leds on -> PASS - putstr("PASS\n"); - } - else { - output_regs->leds = 0x0; // leds off -> FAIL - putstr("FAIL\n"); - } - - hal_finish(); - return 0; -} diff --git a/usrp2/firmware/apps/burn_dbsrx_eeprom.c b/usrp2/firmware/apps/burn_dbsrx_eeprom.c deleted file mode 100644 index cbfb37bec..000000000 --- a/usrp2/firmware/apps/burn_dbsrx_eeprom.c +++ /dev/null @@ -1,106 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "u2_init.h" -#include "i2c.h" -#include "usrp2_i2c_addr.h" -#include "mdelay.h" -#include "hal_io.h" -#include "nonstdio.h" -#include "bool.h" - - - -int read_dboard_eeprom(int i2c_addr); - - -#define USRP_DBID_DBS_RX 0x0002 -#define USRP_DBID_DBS_RX_WITH_CLOCK_MOD 0x000d - -const char dbs_rx_rev2_eeprom[] = { - 0xdb, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18 -}; - -#define LED_VALS (LED_A | LED_B | LED_C | LED_D) -#define LED_MASK (LED_A | LED_B | LED_C | LED_D) - -int -main(void) -{ - u2_init(); - - puts("\nburn_dbsrx_eeprom\n"); - - hal_set_leds(0, ~0); // all off - - int i2c_addr = I2C_ADDR_RX_A; - int dbid = read_dboard_eeprom(i2c_addr); - bool ok; - const char *msg = 0; - - switch (dbid){ - case -1: - msg = "No RX daughterboard found"; - goto bad; - - case -2: - msg = "Invalid RX EEPROM contents"; - goto bad; - - case USRP_DBID_DBS_RX_WITH_CLOCK_MOD: - msg = "RX Daughterboard already reports being a DBS RX w/ CLOCK_MOD"; - goto good; - - case USRP_DBID_DBS_RX: - // Says it's a DBS_RX, attempt to burn the EEPROM - ok = eeprom_write(i2c_addr, 0, - dbs_rx_rev2_eeprom, sizeof(dbs_rx_rev2_eeprom)); - if (ok){ - msg = "Successfully programmed db as DBS RX Rev 2.1"; - goto good; - } - else { - msg = "Failed to write daugherboard eeprom"; - goto bad; - } - - default: - msg = "Daughterboard is not a DBS RX; ignored"; - goto bad; - } - - good: - puts(msg); - hal_set_leds(LED_VALS, LED_MASK); - while (1) - ; - - bad: - puts(msg); - while(1){ - hal_toggle_leds(LED_VALS); - mdelay(50); - } -} diff --git a/usrp2/firmware/apps/burnrev30.c b/usrp2/firmware/apps/burnrev30.c deleted file mode 100644 index e91c35c09..000000000 --- a/usrp2/firmware/apps/burnrev30.c +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright 2007,2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "u2_init.h" -#include "memory_map.h" -#include "spi.h" -#include "hal_io.h" -#include "buffer_pool.h" -#include "pic.h" -#include "bool.h" -#include "ethernet.h" -#include "nonstdio.h" -#include "usrp2_eth_packet.h" -#include "dbsm.h" -#include "app_common_v2.h" -#include "memcpy_wa.h" -#include <stddef.h> -#include <stdlib.h> -#include <string.h> -#include <i2c.h> -#include <usrp2_i2c_addr.h> -#include <clocks.h> -#include "sd.h" -#include "mdelay.h" - -#define HW_REV_MAJOR 3 -#define HW_REV_MINOR 0 - -int test_ram() -{ - int i,j,k; - output_regs->ram_page = 1<<10; - - extram[0] = 0xDEADBEEF; - extram[1] = 0xF00D1234; - extram[7] = 0x76543210; - - output_regs->ram_page = 2<<10; - extram[7] = 0x55555555; - extram[1] = 0xaaaaaaaa; - extram[0] = 0xeeeeeeee; - - output_regs->ram_page = 1<<10; - - i = extram[0]; - k = extram[1]; - j = extram[7]; - - if((i != 0xDEADBEEF)||(j!=0x76543210)||(k!=0xF00D1234)) { - puts("RAM FAIL1!\n"); - puthex32_nl(i); - puthex32_nl(j); - puthex32_nl(k); - return 0; - } - - output_regs->ram_page = 2<<10; - - j = extram[7]; - k = extram[1]; - i = extram[0]; - - if((i != 0xeeeeeeee)||(j!=0x55555555)||(k!=0xaaaaaaaa)) { - puts("RAM FAIL2!\n"); - puthex32_nl(i); - puthex32_nl(j); - puthex32_nl(k); - return 0; - } - return 1; -} - -int test_sd() -{ - int i = sd_init(); - if(i==0) { - puts("FAILED INIT of Card\n"); - return 0; - } - - unsigned char buf[512]; - i = sd_read_block(2048,buf); - if(i == 0) { - puts("READ Command Rejected\n"); - return 0; - } - if((buf[0]==0xb8)&&(buf[1]==0x08)&&(buf[2]==0x00)&&(buf[3]==0x50)) - ; - else { - puts("Read bad data from SD Card\n"); - return 0; - } - return 1; -} - -int -main(void) -{ - u2_init(); - - putstr("\nFactory Test, Board Rev 3.0\n"); - - bool ok = true; - unsigned char maj = HW_REV_MAJOR; - unsigned char min = HW_REV_MINOR; - ok = eeprom_write(I2C_ADDR_MBOARD, MBOARD_REV_MSB, &maj, 1); - ok &= eeprom_write(I2C_ADDR_MBOARD, MBOARD_REV_LSB, &min, 1); - - putstr("\nset_hw_rev\n"); - if (ok) - printf("OK: set h/w rev to %d.%d\n", HW_REV_MAJOR, HW_REV_MINOR); - else { - printf("FAILED to set h/w rev to %d.%d\n", HW_REV_MAJOR, HW_REV_MINOR); - hal_finish(); - return 0; - } - - if(test_sd()) - puts("SD OK\n"); - else { - puts("SD FAIL\n"); - //hal_finish(); - //return 0; - } - if(test_ram()) - puts("RAM OK\n"); - else { - puts("RAM FAIL\n"); - hal_finish(); - return 0; - } - - print_mac_addr(ethernet_mac_addr()->addr); - newline(); - - clocks_mimo_config(MC_WE_LOCK_TO_SMA); - - while (!clocks_lock_detect()) { - puts("No Lock"); - mdelay(1000); - } - puts("Clock Locked\n"); - -} diff --git a/usrp2/firmware/apps/burnrev31.c b/usrp2/firmware/apps/burnrev31.c deleted file mode 100644 index 2a58bdfe5..000000000 --- a/usrp2/firmware/apps/burnrev31.c +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright 2007,2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "u2_init.h" -#include "memory_map.h" -#include "spi.h" -#include "hal_io.h" -#include "buffer_pool.h" -#include "pic.h" -#include "bool.h" -#include "ethernet.h" -#include "nonstdio.h" -#include "usrp2_eth_packet.h" -#include "dbsm.h" -#include "app_common_v2.h" -#include "memcpy_wa.h" -#include <stddef.h> -#include <stdlib.h> -#include <string.h> -#include <i2c.h> -#include <usrp2_i2c_addr.h> -#include <clocks.h> -#include "sd.h" -#include "mdelay.h" - -#define HW_REV_MAJOR 3 -#define HW_REV_MINOR 1 - -int test_ram() -{ - int i,j,k; - output_regs->ram_page = 1<<10; - - extram[0] = 0xDEADBEEF; - extram[1] = 0xF00D1234; - extram[7] = 0x76543210; - - output_regs->ram_page = 2<<10; - extram[7] = 0x55555555; - extram[1] = 0xaaaaaaaa; - extram[0] = 0xeeeeeeee; - - output_regs->ram_page = 1<<10; - - i = extram[0]; - k = extram[1]; - j = extram[7]; - - if((i != 0xDEADBEEF)||(j!=0x76543210)||(k!=0xF00D1234)) { - puts("RAM FAIL1!\n"); - puthex32_nl(i); - puthex32_nl(j); - puthex32_nl(k); - return 0; - } - - output_regs->ram_page = 2<<10; - - j = extram[7]; - k = extram[1]; - i = extram[0]; - - if((i != 0xeeeeeeee)||(j!=0x55555555)||(k!=0xaaaaaaaa)) { - puts("RAM FAIL2!\n"); - puthex32_nl(i); - puthex32_nl(j); - puthex32_nl(k); - return 0; - } - return 1; -} - -int test_sd() -{ - int i = sd_init(); - if(i==0) { - puts("FAILED INIT of Card\n"); - return 0; - } - - unsigned char buf[512]; - i = sd_read_block(2048,buf); - if(i == 0) { - puts("READ Command Rejected\n"); - return 0; - } - if((buf[0]==0xb8)&&(buf[1]==0x08)&&(buf[2]==0x00)&&(buf[3]==0x50)) - ; - else { - puts("Read bad data from SD Card\n"); - return 0; - } - return 1; -} - -int -main(void) -{ - u2_init(); - - putstr("\nFactory Test, Board Rev 3.1\n"); - - bool ok = true; - unsigned char maj = HW_REV_MAJOR; - unsigned char min = HW_REV_MINOR; - ok = eeprom_write(I2C_ADDR_MBOARD, MBOARD_REV_MSB, &maj, 1); - ok &= eeprom_write(I2C_ADDR_MBOARD, MBOARD_REV_LSB, &min, 1); - - putstr("\nset_hw_rev\n"); - if (ok) - printf("OK: set h/w rev to %d.%d\n", HW_REV_MAJOR, HW_REV_MINOR); - else { - printf("FAILED to set h/w rev to %d.%d\n", HW_REV_MAJOR, HW_REV_MINOR); - hal_finish(); - return 0; - } - - if(test_sd()) - puts("SD OK\n"); - else { - puts("SD FAIL\n"); - //hal_finish(); - //return 0; - } - if(test_ram()) - puts("RAM OK\n"); - else { - puts("RAM FAIL\n"); - hal_finish(); - return 0; - } - - print_mac_addr(ethernet_mac_addr()->addr); - newline(); - - clocks_mimo_config(MC_WE_LOCK_TO_SMA); - - while (!clocks_lock_detect()) { - puts("No Lock"); - mdelay(1000); - } - puts("Clock Locked\n"); - -} diff --git a/usrp2/firmware/apps/burnrev40.c b/usrp2/firmware/apps/burnrev40.c deleted file mode 100644 index 5197f5358..000000000 --- a/usrp2/firmware/apps/burnrev40.c +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright 2007,2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "u2_init.h" -#include "memory_map.h" -#include "spi.h" -#include "hal_io.h" -#include "buffer_pool.h" -#include "pic.h" -#include "bool.h" -#include "ethernet.h" -#include "nonstdio.h" -#include "usrp2_eth_packet.h" -#include "dbsm.h" -#include "app_common_v2.h" -#include "memcpy_wa.h" -#include <stddef.h> -#include <stdlib.h> -#include <string.h> -#include <i2c.h> -#include <usrp2_i2c_addr.h> -#include <clocks.h> -#include "sd.h" -#include "mdelay.h" - -#define HW_REV_MAJOR 4 -#define HW_REV_MINOR 0 - -int test_ram() -{ - int i,j,k; - output_regs->ram_page = 1<<10; - - extram[0] = 0xDEADBEEF; - extram[1] = 0xF00D1234; - extram[7] = 0x76543210; - - output_regs->ram_page = 2<<10; - extram[7] = 0x55555555; - extram[1] = 0xaaaaaaaa; - extram[0] = 0xeeeeeeee; - - output_regs->ram_page = 1<<10; - - i = extram[0]; - k = extram[1]; - j = extram[7]; - - if((i != 0xDEADBEEF)||(j!=0x76543210)||(k!=0xF00D1234)) { - puts("RAM FAIL1!\n"); - puthex32_nl(i); - puthex32_nl(j); - puthex32_nl(k); - return 0; - } - - output_regs->ram_page = 2<<10; - - j = extram[7]; - k = extram[1]; - i = extram[0]; - - if((i != 0xeeeeeeee)||(j!=0x55555555)||(k!=0xaaaaaaaa)) { - puts("RAM FAIL2!\n"); - puthex32_nl(i); - puthex32_nl(j); - puthex32_nl(k); - return 0; - } - return 1; -} - -int test_sd() -{ - int i = sd_init(); - if(i==0) { - puts("FAILED INIT of Card\n"); - return 0; - } - - unsigned char buf[512]; - i = sd_read_block(2048,buf); - if(i == 0) { - puts("READ Command Rejected\n"); - return 0; - } - if((buf[0]==0xb8)&&(buf[1]==0x08)&&(buf[2]==0x00)&&(buf[3]==0x50)) - ; - else { - puts("Read bad data from SD Card\n"); - return 0; - } - return 1; -} - -int -main(void) -{ - u2_init(); - - putstr("\nFactory Test, Board Rev 4.0\n"); - - bool ok = true; - unsigned char maj = HW_REV_MAJOR; - unsigned char min = HW_REV_MINOR; - ok = eeprom_write(I2C_ADDR_MBOARD, MBOARD_REV_MSB, &maj, 1); - ok &= eeprom_write(I2C_ADDR_MBOARD, MBOARD_REV_LSB, &min, 1); - - putstr("\nset_hw_rev\n"); - if (ok) - printf("OK: set h/w rev to %d.%d\n", HW_REV_MAJOR, HW_REV_MINOR); - else { - printf("FAILED to set h/w rev to %d.%d\n", HW_REV_MAJOR, HW_REV_MINOR); - hal_finish(); - return 0; - } - - if(test_sd()) - puts("SD OK\n"); - else { - puts("SD FAIL\n"); - //hal_finish(); - //return 0; - } - if(test_ram()) - puts("RAM OK\n"); - else { - puts("RAM FAIL\n"); - hal_finish(); - return 0; - } - - print_mac_addr(ethernet_mac_addr()->addr); - newline(); - - clocks_mimo_config(MC_WE_LOCK_TO_SMA); - - while (!clocks_lock_detect()) { - puts("No Lock"); - mdelay(1000); - } - puts("Clock Locked\n"); - -} diff --git a/usrp2/firmware/apps/can_i_sub.c b/usrp2/firmware/apps/can_i_sub.c deleted file mode 100644 index ed49791f0..000000000 --- a/usrp2/firmware/apps/can_i_sub.c +++ /dev/null @@ -1,25 +0,0 @@ -#include <u2_init.h> -#include <nonstdio.h> - -//typedef long long int64_t; - - -int64_t sub(int64_t a, int64_t b); -void print(int64_t d); - -int main(void) -{ - u2_init(); - - int64_t d = sub(462550990848000LL, 462028800000000LL); - print_uint64(d); - newline(); - return 0; -} - -int64_t sub(int64_t a, int64_t b) -{ - return a - b; -} - - diff --git a/usrp2/firmware/apps/double_buffer_fragment.c b/usrp2/firmware/apps/double_buffer_fragment.c deleted file mode 100644 index cfc061247..000000000 --- a/usrp2/firmware/apps/double_buffer_fragment.c +++ /dev/null @@ -1,138 +0,0 @@ -#if 0 -void -double_buffering(int port) { - unsigned int localstatus = buffer_pool_status->status; - - if(localstatus & BPS_DONE_0) { - bp_clear_buf(0); - if(buffer_state[0] == FILLING) { - buffer_state[0] = FULL; - if(buffer_state[1] == EMPTY) { - bp_receive_to_buf(1, 1, 1, 10, 509); // DSP_RX to buffer 1, use 500 lines - buffer_state[1] = FILLING; - } - else - dsp_rx_idle = 1; - if(serdes_tx_idle) { - serdes_tx_idle = 0; - bp_send_from_buf(0, port, 1, 10, 509); // SERDES_TX from buffer 0 - buffer_state[0] = EMPTYING; - } - } - else { // buffer was emptying - buffer_state[0] = EMPTY; - if(dsp_rx_idle) { - dsp_rx_idle = 0; - bp_receive_to_buf(0, 1, 1, 10, 509); // DSP_RX to buffer 0, use 500 lines - buffer_state[0] = FILLING; - } - if(buffer_state[1] == FULL) { - bp_send_from_buf(1, port, 1, 10, 509); // SERDES_TX from buffer 1 - buffer_state[1] = EMPTYING; - } - else - serdes_tx_idle = 1; - } - putstr("Int Proc'ed 0\n"); - } - - if(localstatus & BPS_DONE_1) { - bp_clear_buf(1); - if(buffer_state[1] == FILLING) { - buffer_state[1] = FULL; - if(buffer_state[0] == EMPTY) { - bp_receive_to_buf(0, 1, 1, 10, 509); // DSP_RX to buffer 1, use 500 lines - buffer_state[0] = FILLING; - } - else - dsp_rx_idle = 1; - if(serdes_tx_idle) { - serdes_tx_idle = 0; - bp_send_from_buf(1, port, 1, 10, 509); // SERDES_TX from buffer 1 - buffer_state[1] = EMPTYING; - } - } - else { // buffer was emptying - buffer_state[1] = EMPTY; - if(dsp_rx_idle) { - dsp_rx_idle = 0; - bp_receive_to_buf(1, 1, 1, 10, 509); // DSP_RX to buffer 1, use 500 lines - buffer_state[1] = FILLING; - } - if(buffer_state[0] == FULL) { - bp_send_from_buf(0, port, 1, 10, 509); // SERDES_TX from buffer 0 - buffer_state[0] = EMPTYING; - } - else - serdes_tx_idle = 1; - } - putstr("Int Proc'ed 1\n"); - } - - if(localstatus & BPS_DONE_2) { - bp_clear_buf(2); - if(buffer_state[2] == FILLING) { - buffer_state[2] = FULL; - if(buffer_state[3] == EMPTY) { - bp_receive_to_buf(3, port, 1, 5, 504); // SERDES_RX to buffer 3, use 500 lines - buffer_state[3] = FILLING; - } - else - serdes_rx_idle = 1; - if(dsp_tx_idle) { - dsp_tx_idle = 0; - bp_send_from_buf(2, 1, 1, 5, 504); // DSP_TX from buffer 2 - buffer_state[2] = EMPTYING; - } - } - else { // buffer was emptying - buffer_state[2] = EMPTY; - if(serdes_rx_idle) { - serdes_rx_idle = 0; - bp_receive_to_buf(2, port, 1, 5, 504); // SERDES_RX to buffer 2 - buffer_state[2] = FILLING; - } - if(buffer_state[3] == FULL) { - bp_send_from_buf(3, 1, 1, 5, 504); // DSP_TX from buffer 3 - buffer_state[3] = EMPTYING; - } - else - dsp_tx_idle = 1; - } - putstr("Int Proc'ed 2\n"); - } - - if(localstatus & BPS_DONE_3) { - bp_clear_buf(3); - if(buffer_state[3] == FILLING) { - buffer_state[3] = FULL; - if(buffer_state[2] == EMPTY) { - bp_receive_to_buf(2, port, 1, 5, 504); // SERDES_RX to buffer 2, use 500 lines - buffer_state[2] = FILLING; - } - else - serdes_rx_idle = 1; - if(dsp_tx_idle) { - dsp_tx_idle = 0; - bp_send_from_buf(3, 1, 1, 5, 504); // DSP_TX from buffer 3 - buffer_state[3] = EMPTYING; - } - } - else { // buffer was emptying - buffer_state[3] = EMPTY; - if(serdes_rx_idle) { - serdes_rx_idle = 0; - bp_receive_to_buf(3, port, 1, 5, 504); // SERDES_RX to buffer 3 - buffer_state[3] = FILLING; - } - if(buffer_state[2] == FULL) { - bp_send_from_buf(2, 1, 1, 5, 504); // DSP_TX from buffer 2 - buffer_state[2] = EMPTYING; - } - else - dsp_tx_idle = 1; - } - putstr("Int Proc'ed 3\n"); - } -} -#endif diff --git a/usrp2/firmware/apps/echo.c b/usrp2/firmware/apps/echo.c deleted file mode 100644 index 89108ee80..000000000 --- a/usrp2/firmware/apps/echo.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#include "u2_init.h" -#include "stdio.h" - -int -main(void) -{ - u2_init(); - - puts("\n>>> echo <<<"); - - while (1){ - int ch = getchar(); - putchar(ch); - } - - return 0; -} diff --git a/usrp2/firmware/apps/eth_serdes.c b/usrp2/firmware/apps/eth_serdes.c deleted file mode 100644 index 0286f0c1f..000000000 --- a/usrp2/firmware/apps/eth_serdes.c +++ /dev/null @@ -1,233 +0,0 @@ -/* - * Copyright 2007,2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "u2_init.h" -#include "memory_map.h" -#include "spi.h" -#include "hal_io.h" -#include "buffer_pool.h" -#include "pic.h" -#include "bool.h" -#include "ethernet.h" -#include "nonstdio.h" -#include "usrp2_eth_packet.h" -#include "dbsm.h" -#include "app_passthru_v2.h" -#include "memcpy_wa.h" -#include "clocks.h" -#include <stddef.h> -#include <stdlib.h> -#include <string.h> - - -#define FW_SETS_SEQNO 1 // define to 0 or 1 (FIXME must be 1 for now) - -#if (FW_SETS_SEQNO) -static int fw_seqno __attribute__((unused)); // used when f/w is filling in sequence numbers -#endif - - -/* - * Full duplex Tx and Rx between ethernet and serdes - * - * Buffer 1 is used by the cpu to send frames to the host. - * Buffers 2 and 3 are used to double-buffer the DSP Rx to eth flow - * Buffers 4 and 5 are used to double-buffer the eth to DSP Tx eth flow - */ -//#define CPU_RX_BUF 0 // eth -> cpu - -#define DSP_RX_BUF_0 2 // serdes -> eth (double buffer) -#define DSP_RX_BUF_1 3 // serdes -> eth -#define DSP_TX_BUF_0 4 // eth -> serdes (double buffer) -#define DSP_TX_BUF_1 5 // eth -> serdes - -/* - * ================================================================ - * configure serdes double buffering state machine (eth -> serdes) - * ================================================================ - */ - - -// Receive from ethernet -buf_cmd_args_t dsp_tx_recv_args = { - PORT_ETH, - 0, - BP_LAST_LINE -}; - -// send to serdes -buf_cmd_args_t dsp_tx_send_args = { - PORT_SERDES, - 0, - 0 // filled in from last_line register -}; - -dbsm_t dsp_tx_sm; // the state machine - -/* - * ==================================================================== - * configure serdes RX double buffering state machine (serdes -> eth) - * ==================================================================== - */ - -// receive from serdes -buf_cmd_args_t dsp_rx_recv_args = { - PORT_SERDES, - 0, - BP_LAST_LINE -}; - -// send to ETH -buf_cmd_args_t dsp_rx_send_args = { - PORT_ETH, - 0, // starts with ethernet header in line 0 - 0, // filled in from list_line register -}; - -dbsm_t dsp_rx_sm; // the state machine - - -// The mac address of the host we're sending to. -u2_mac_addr_t host_mac_addr; - - -// ---------------------------------------------------------------- - - -#if (FW_SETS_SEQNO) -/* - * Debugging ONLY. This will be handled by the tx_protocol_engine. - * - * This is called when the DSP Rx chain has filled in a packet. - * We set and increment the seqno, then return false, indicating - * that we didn't handle the packet. A bit of a kludge - * but it should work. - */ - -bool -fw_sets_seqno_inspector(dbsm_t *sm, int buf_this) // returns false -{ -#if 0 - uint32_t *p = buffer_ram(buf_this); - uint32_t last_line = buffer_pool_status->last_line[buf_this] - sm->last_line_adj; - printf("fw_sets_seqno_inspector: buf_this = %d, last_line = %d\n", - buf_this, last_line); - - print_buffer(p, (last_line + 1)); -#endif - -#if 0 - uint32_t *p = buffer_ram(buf_this); - uint32_t seqno = fw_seqno++; - - // KLUDGE all kinds of nasty magic numbers and embedded knowledge - uint32_t t = p[4]; - t = (t & 0xffff00ff) | ((seqno & 0xff) << 8); - p[4] = t; -#endif - - return false; // we didn't handle the packet -} -#endif - - -inline static void -buffer_irq_handler(unsigned irq) -{ - uint32_t status = buffer_pool_status->status; - - if (0 && (status & ~BPS_IDLE_ALL)){ - putstr("status = "); - puthex32_nl(status); - } - - dbsm_process_status(&dsp_tx_sm, status); - dbsm_process_status(&dsp_rx_sm, status); -} - -int -main(void) -{ - u2_init(); - - output_regs->led_src = 0x3; // h/w controls bottom two bits - clocks_enable_test_clk(true, 1); - - putstr("\neth <-> serdes\n"); - - ethernet_register_link_changed_callback(link_changed_callback); - ethernet_init(); - - // clocks_mimo_config(MC_WE_LOCK_TO_SMA | MC_PROVIDE_CLK_TO_MIMO); - clocks_mimo_config(MC_WE_DONT_LOCK | MC_PROVIDE_CLK_TO_MIMO); - -#if 0 - // make bit 15 of Tx gpio's be a s/w output - hal_gpio_set_sel(GPIO_TX_BANK, 15, 's'); - hal_gpio_set_ddr(GPIO_TX_BANK, 0x8000, 0x8000); -#endif - -#if 1 - output_regs->debug_mux_ctrl = 1; - hal_gpio_set_sels(GPIO_TX_BANK, "1111111111111111"); - hal_gpio_set_sels(GPIO_RX_BANK, "1111111111111111"); - hal_gpio_set_ddr(GPIO_TX_BANK, 0xffff, 0xffff); - hal_gpio_set_ddr(GPIO_RX_BANK, 0xffff, 0xffff); -#endif - - - // initialize double buffering state machine for ethernet -> serdes - - dbsm_init(&dsp_tx_sm, DSP_TX_BUF_0, - &dsp_tx_recv_args, &dsp_tx_send_args, - eth_pkt_inspector); - - - // initialize double buffering state machine for serdes -> ethernet - - if (FW_SETS_SEQNO){ - dbsm_init(&dsp_rx_sm, DSP_RX_BUF_0, - &dsp_rx_recv_args, &dsp_rx_send_args, - fw_sets_seqno_inspector); - } - else { - dbsm_init(&dsp_rx_sm, DSP_RX_BUF_0, - &dsp_rx_recv_args, &dsp_rx_send_args, - dbsm_nop_inspector); - } - - // tell app_common that this dbsm could be sending to the ethernet - ac_could_be_sending_to_eth = &dsp_rx_sm; - - - // kick off the state machines - dbsm_start(&dsp_tx_sm); - dbsm_start(&dsp_rx_sm); - - //int which = 0; - - while(1){ - // hal_gpio_write(GPIO_TX_BANK, which, 0x8000); - // which ^= 0x8000; - - buffer_irq_handler(0); - } -} diff --git a/usrp2/firmware/apps/factory_test.c b/usrp2/firmware/apps/factory_test.c deleted file mode 100644 index e7dde524a..000000000 --- a/usrp2/firmware/apps/factory_test.c +++ /dev/null @@ -1,443 +0,0 @@ -/* - * Copyright 2007,2008,2009 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "u2_init.h" -#include "memory_map.h" -#include "spi.h" -#include "hal_io.h" -#include "buffer_pool.h" -#include "pic.h" -#include "bool.h" -#include "ethernet.h" -#include "nonstdio.h" -#include "usrp2_eth_packet.h" -#include "dbsm.h" -#include "app_common_v2.h" -#include "memcpy_wa.h" -#include <stddef.h> -#include <stdlib.h> -#include <string.h> -#include <i2c.h> -#include <usrp2_i2c_addr.h> -#include <clocks.h> -#include "sd.h" - -#define FW_SETS_SEQNO 1 // define to 0 or 1 (FIXME must be 1 for now) - -#if (FW_SETS_SEQNO) -static int fw_seqno; // used when f/w is filling in sequence numbers -#endif - - -/* - * Full duplex Tx and Rx between ethernet and DSP pipelines - * - * Buffer 1 is used by the cpu to send frames to the host. - * Buffers 2 and 3 are used to double-buffer the DSP Rx to eth flow - * Buffers 4 and 5 are used to double-buffer the eth to DSP Tx eth flow - */ -//#define CPU_RX_BUF 0 // eth -> cpu - -#define DSP_RX_BUF_0 2 // dsp rx -> eth (double buffer) -#define DSP_RX_BUF_1 3 // dsp rx -> eth -#define DSP_TX_BUF_0 4 // eth -> dsp tx (double buffer) -#define DSP_TX_BUF_1 5 // eth -> dsp tx - -/* - * ================================================================ - * configure DSP TX double buffering state machine (eth -> dsp) - * ================================================================ - */ - -// 4 lines of ethernet hdr + 1 line transport hdr + 2 lines (word0 + timestamp) -// DSP Tx reads word0 (flags) + timestamp followed by samples - -#define DSP_TX_FIRST_LINE ((sizeof(u2_eth_hdr_t) + sizeof(u2_transport_hdr_t))/4) - -// Receive from ethernet -buf_cmd_args_t dsp_tx_recv_args = { - PORT_ETH, - 0, - BP_LAST_LINE -}; - -// send to DSP Tx -buf_cmd_args_t dsp_tx_send_args = { - PORT_DSP, - DSP_TX_FIRST_LINE, // starts just past transport header - 0 // filled in from last_line register -}; - -dbsm_t dsp_tx_sm; // the state machine - -/* - * ================================================================ - * configure DSP RX double buffering state machine (dsp -> eth) - * ================================================================ - */ - -// 4 lines of ethernet hdr + 1 line transport hdr + 1 line (word0) -// DSP Rx writes timestamp followed by nlines_per_frame of samples -#define DSP_RX_FIRST_LINE ((sizeof(u2_eth_hdr_t) + sizeof(u2_transport_hdr_t))/4 + 1) - -// receive from DSP -buf_cmd_args_t dsp_rx_recv_args = { - PORT_DSP, - DSP_RX_FIRST_LINE, - BP_LAST_LINE -}; - -// send to ETH -buf_cmd_args_t dsp_rx_send_args = { - PORT_ETH, - 0, // starts with ethernet header in line 0 - 0, // filled in from list_line register -}; - -dbsm_t dsp_rx_sm; // the state machine - - -// The mac address of the host we're sending to. -u2_mac_addr_t host_mac_addr; - - -// variables for streaming mode - -static bool streaming_p = false; -static unsigned int streaming_items_per_frame = 0; -static int streaming_frame_count = 0; -#define FRAMES_PER_CMD 1000 - -bool is_streaming(void){ return streaming_p; } - -// ---------------------------------------------------------------- - - -void -restart_streaming(void) -{ - // setup RX DSP regs - dsp_rx_regs->clear_state = 1; // reset - - streaming_p = true; - streaming_frame_count = FRAMES_PER_CMD; - - dsp_rx_regs->rx_command = - MK_RX_CMD(FRAMES_PER_CMD * streaming_items_per_frame, - streaming_items_per_frame, - 1, 1); // set "chain" bit - - // kick off the state machine - dbsm_start(&dsp_rx_sm); - - dsp_rx_regs->rx_time = 0; // enqueue first of two commands - - // make sure this one and the rest have the "now" and "chain" bits set. - dsp_rx_regs->rx_command = - MK_RX_CMD(FRAMES_PER_CMD * streaming_items_per_frame, - streaming_items_per_frame, - 1, 1); - - dsp_rx_regs->rx_time = 0; // enqueue second command -} - -void -start_rx_streaming_cmd(const u2_mac_addr_t *host, op_start_rx_streaming_t *p) -{ - host_mac_addr = *host; // remember who we're sending to - - /* - * Construct ethernet header and word0 and preload into two buffers - */ - u2_eth_packet_t pkt; - memset(&pkt, 0, sizeof(pkt)); - pkt.ehdr.dst = *host; - pkt.ehdr.src = *ethernet_mac_addr(); - pkt.ehdr.ethertype = U2_ETHERTYPE; - u2p_set_word0(&pkt.fixed, 0, 0); - // DSP RX will fill in timestamp - - memcpy_wa(buffer_ram(DSP_RX_BUF_0), &pkt, sizeof(pkt)); - memcpy_wa(buffer_ram(DSP_RX_BUF_1), &pkt, sizeof(pkt)); - - - if (FW_SETS_SEQNO) - fw_seqno = 0; - - streaming_items_per_frame = p->items_per_frame; - restart_streaming(); -} - - -void start_rx_streaming_at_cmd(const u2_mac_addr_t *host, op_start_rx_streaming_t *p, uint32_t time) -{} -void restart_streaming_at(uint32_t time) -{} - -void -stop_rx_cmd(void) -{ - streaming_p = false; - dsp_rx_regs->clear_state = 1; // flush cmd queue - bp_clear_buf(DSP_RX_BUF_0); - bp_clear_buf(DSP_RX_BUF_1); -} - - -static void -setup_tx() -{ - dsp_tx_regs->clear_state = 1; - bp_clear_buf(DSP_TX_BUF_0); - bp_clear_buf(DSP_TX_BUF_1); - - int tx_scale = 256; - int interp = 32; - - // setup some defaults - - dsp_tx_regs->freq = 0; - dsp_tx_regs->scale_iq = (tx_scale << 16) | tx_scale; - dsp_tx_regs->interp_rate = interp; -} - - -#if (FW_SETS_SEQNO) -/* - * Debugging ONLY. This will be handled by the tx_protocol_engine. - * - * This is called when the DSP Rx chain has filled in a packet. - * We set and increment the seqno, then return false, indicating - * that we didn't handle the packet. A bit of a kludge - * but it should work. - */ -bool -fw_sets_seqno_inspector(dbsm_t *sm, int buf_this) // returns false -{ - uint32_t *p = buffer_ram(buf_this); - uint32_t seqno = fw_seqno++; - - // KLUDGE all kinds of nasty magic numbers and embedded knowledge - uint32_t t = p[4]; - t = (t & 0xffff00ff) | ((seqno & 0xff) << 8); - p[4] = t; - - // queue up another rx command when required - if (streaming_p && --streaming_frame_count == 0){ - streaming_frame_count = FRAMES_PER_CMD; - dsp_rx_regs->rx_time = 0; - } - - return false; // we didn't handle the packet -} -#endif - - -inline static void -buffer_irq_handler(unsigned irq) -{ - uint32_t status = buffer_pool_status->status; - - dbsm_process_status(&dsp_tx_sm, status); - dbsm_process_status(&dsp_rx_sm, status); -} - -int test_ram() -{ - int i,j,k; - output_regs->ram_page = 1<<10; - - extram[0] = 0xDEADBEEF; - extram[1] = 0xF00D1234; - extram[7] = 0x76543210; - - output_regs->ram_page = 2<<10; - extram[7] = 0x55555555; - extram[1] = 0xaaaaaaaa; - extram[0] = 0xeeeeeeee; - - output_regs->ram_page = 1<<10; - - i = extram[0]; - k = extram[1]; - j = extram[7]; - - if((i != 0xDEADBEEF)||(j!=0x76543210)||(k!=0xF00D1234)) { - puts("RAM FAIL1!\n"); - puthex32_nl(i); - puthex32_nl(j); - puthex32_nl(k); - return 0; - } - - output_regs->ram_page = 2<<10; - - j = extram[7]; - k = extram[1]; - i = extram[0]; - - if((i != 0xeeeeeeee)||(j!=0x55555555)||(k!=0xaaaaaaaa)) { - puts("RAM FAIL2!\n"); - puthex32_nl(i); - puthex32_nl(j); - puthex32_nl(k); - return 0; - } - return 1; -} - -int test_sd() -{ - int i = sd_init(); - if(i==0) { - puts("FAILED INIT of Card\n"); - return 0; - } - - unsigned char buf[512]; - i = sd_read_block(2048,buf); - if(i == 0) { - puts("READ Command Rejected\n"); - return 0; - } - if((buf[0]==0xb8)&&(buf[1]==0x08)&&(buf[2]==0x00)&&(buf[3]==0x50)) - ; - else { - puts("Read bad data from SD Card\n"); - return 0; - } - return 1; -} - -int -main(void) -{ - u2_init(); - - putstr("\nFactory Test\n"); - - print_mac_addr(ethernet_mac_addr()->addr); - newline(); - - if(test_sd()) - puts("SD OK\n"); - else { - puts("SD FAIL\n"); - // hal_finish(); - //return 0; - } - if(test_ram()) - puts("RAM OK\n"); - else { - puts("RAM FAIL\n"); - hal_finish(); - return 0; - } - - print_mac_addr(ethernet_mac_addr()->addr); - newline(); - - output_regs->led_src = 0x7; // make bottom 3 controlled by HW - - ethernet_register_link_changed_callback(link_changed_callback); - ethernet_init(); - - clocks_enable_tx_dboard(true,1); - clocks_mimo_config(MC_WE_LOCK_TO_SMA); -#if 0 - // make bit 15 of Tx gpio's be a s/w output - hal_gpio_set_sel(GPIO_TX_BANK, 15, 's'); - hal_gpio_set_ddr(GPIO_TX_BANK, 0x8000, 0x8000); -#endif - - output_regs->debug_mux_ctrl = 1; -#if 0 - hal_gpio_set_sels(GPIO_TX_BANK, "1111111111111111"); - hal_gpio_set_sels(GPIO_RX_BANK, "1111111111111111"); - hal_gpio_set_ddr(GPIO_TX_BANK, 0xffff, 0xffff); - hal_gpio_set_ddr(GPIO_RX_BANK, 0xffff, 0xffff); -#endif - - - // initialize double buffering state machine for ethernet -> DSP Tx - - dbsm_init(&dsp_tx_sm, DSP_TX_BUF_0, - &dsp_tx_recv_args, &dsp_tx_send_args, - eth_pkt_inspector); - - - // initialize double buffering state machine for DSP RX -> Ethernet - - if (FW_SETS_SEQNO){ - dbsm_init(&dsp_rx_sm, DSP_RX_BUF_0, - &dsp_rx_recv_args, &dsp_rx_send_args, - fw_sets_seqno_inspector); - } - else { - dbsm_init(&dsp_rx_sm, DSP_RX_BUF_0, - &dsp_rx_recv_args, &dsp_rx_send_args, - dbsm_nop_inspector); - } - - // tell app_common that this dbsm could be sending to the ethernet - ac_could_be_sending_to_eth = &dsp_rx_sm; - - - // program tx registers - setup_tx(); - - // kick off the state machine - dbsm_start(&dsp_tx_sm); - - //int which = 0; - - while(1){ - // hal_gpio_write(GPIO_TX_BANK, which, 0x8000); - // which ^= 0x8000; - - buffer_irq_handler(0); - - int pending = pic_regs->pending; // poll for under or overrun - - if (pending & PIC_UNDERRUN_INT){ - dbsm_handle_tx_underrun(&dsp_tx_sm); - pic_regs->pending = PIC_UNDERRUN_INT; // clear interrupt - putchar('U'); - } - - if (pending & PIC_OVERRUN_INT){ - dbsm_handle_rx_overrun(&dsp_rx_sm); - pic_regs->pending = PIC_OVERRUN_INT; // clear pending interrupt - - // FIXME Figure out how to handle this robustly. - // Any buffers that are emptying should be allowed to drain... - - if (streaming_p){ - // restart_streaming(); - // FIXME report error - } - else { - // FIXME report error - } - putchar('O'); - } - } -} diff --git a/usrp2/firmware/apps/gen_eth_packets.c b/usrp2/firmware/apps/gen_eth_packets.c deleted file mode 100644 index 5cda5bb8e..000000000 --- a/usrp2/firmware/apps/gen_eth_packets.c +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include "u2_init.h" -#include "memory_map.h" -#include "spi.h" -#include "hal_io.h" -#include "buffer_pool.h" -#include "pic.h" -#include "bool.h" -#include "ethernet.h" -#include "nonstdio.h" -#include "usrp2_eth_packet.h" -#include "memcpy_wa.h" -#include "print_rmon_regs.h" -#include <stddef.h> -#include <stdlib.h> -#include <string.h> - - -// ---------------------------------------------------------------- - -static u2_mac_addr_t dst_mac_addr = - {{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }}; - -// ---------------------------------------------------------------- - -// #define PACKET_SIZE 1500 // bytes -// #define ETH_DATA_RATE 1000000 // 1MB/s -// #define ETH_PACKET_RATE (ETH_DATA_RATE/PACKET_SIZE) // 13,3333 pkts/s - -// static int timer_delta = MASTER_CLK_RATE/ETH_PACKET_RATE; // ticks between interrupts - -static int timer_delta = (int)(MASTER_CLK_RATE * 1e-3); // tick at 1 kHz -static int sim_timer_delta = (int)(MASTER_CLK_RATE * 100e-6); // tick at 10 kHz - -static volatile bool send_packet_now = false; // timer handler sets this -static volatile bool link_is_up = false; // eth handler sets this - -int packet_number = 0; - - -#define CPU_TX_BUF 0 // cpu xmits ethernet frames from here -#define CPU_RX_BUF 1 // receive ethernet frames here - -// ---------------------------------------------------------------- - -/* - * Called when eth phy state changes (w/ interrupts disabled) - */ -void -link_changed_callback(int speed) -{ - link_is_up = speed == 0 ? false : true; - hal_set_leds(link_is_up ? 0x2 : 0x0, 0x2); - printf("\neth link changed: speed = %d\n", speed); -} - -void -timer_irq_handler(unsigned irq) -{ - hal_set_timeout(timer_delta); // schedule next timeout - send_packet_now = 1; -} - - -static void -init_packet(int *buf, const u2_eth_packet_t *pkt, int bufnum) -{ - int i = 0; - int mark = ((bufnum & 0xff) << 24) | 0x005A0000; - - for (i = 0; i < BP_NLINES; i++){ - buf[i] = mark | i; - mark ^= 0x00FF0000; - } - - // copy header into buffer - memcpy_wa(buf, pkt, sizeof(*pkt)); -} - -static void -init_packets(void) -{ - u2_eth_packet_t pkt __attribute__((aligned (4))); - - memset(&pkt, 0, sizeof(pkt)); - - pkt.ehdr.dst = dst_mac_addr; - pkt.ehdr.src = *ethernet_mac_addr(); - pkt.ehdr.ethertype = U2_ETHERTYPE; - pkt.fixed.word0 = 0x01234567; - pkt.fixed.timestamp = 0xffffffff; - - // init just the one we're using - init_packet((void *)buffer_ram(CPU_TX_BUF), &pkt, CPU_TX_BUF); -} - -int -main(void) -{ - int npackets_sent = 0; - - u2_init(); - - // setup tx gpio bits for GPIOM_FPGA_1 -- fpga debug output - //hal_gpio_set_sels(GPIO_TX_BANK, "1111111111111111"); - //hal_gpio_set_sels(GPIO_RX_BANK, "1111111111111111"); - - putstr("\ngen_eth_packets\n"); - - hal_set_leds(0x0, 0x3); - - init_packets(); - - pic_register_handler(IRQ_TIMER, timer_irq_handler); - - if (hwconfig_simulation_p()) - timer_delta = sim_timer_delta; - - hal_set_timeout(timer_delta); - - ethernet_register_link_changed_callback(link_changed_callback); - ethernet_init(); - - /* - if (hwconfig_simulation_p()){ - eth_mac->speed = 4; // hardcode mac speed to 1000 - link_is_up = true; - } - */ - - // fire off a receive from the ethernet - bp_receive_to_buf(CPU_RX_BUF, PORT_ETH, 1, 0, BP_LAST_LINE); - - while(1){ - uint32_t status = buffer_pool_status->status; - - if (status & (BPS_DONE(CPU_RX_BUF) | BPS_ERROR(CPU_RX_BUF))){ - bp_clear_buf(CPU_RX_BUF); - // ignore incoming ethernet packets; they were looped back in sim - bp_receive_to_buf(CPU_RX_BUF, PORT_ETH, 1, 0, BP_LAST_LINE); - } - - if (status & (BPS_DONE(CPU_TX_BUF) | BPS_ERROR(CPU_TX_BUF))){ - if (status & BPS_ERROR(CPU_TX_BUF)){ - putchar('E'); - } - bp_clear_buf(CPU_TX_BUF); - npackets_sent++; - if ((npackets_sent & 0xF) == 0){ // print after every 16 packets - //print_rmon_regs(); - putchar('.'); - } - } - - if (link_is_up && send_packet_now && (status & BPS_IDLE(CPU_TX_BUF))){ - send_packet_now = false; - - // kick off the next packet - // FIXME set packet number in packet - - bp_send_from_buf(CPU_TX_BUF, PORT_ETH, 1, 0, 255); // 1KB total - hal_toggle_leds(0x1); - } - } - - hal_finish(); - return 1; -} diff --git a/usrp2/firmware/apps/gen_pause_frames.c b/usrp2/firmware/apps/gen_pause_frames.c deleted file mode 100644 index 8f2b2df03..000000000 --- a/usrp2/firmware/apps/gen_pause_frames.c +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#include "u2_init.h" -#include "memory_map.h" -#include "spi.h" -#include "hal_io.h" -#include "buffer_pool.h" -#include "pic.h" -#include "bool.h" -#include "ethernet.h" -#include "nonstdio.h" -#include "u2_eth_packet.h" -#include "memcpy_wa.h" -#include <stddef.h> -#include <stdlib.h> - - -// ---------------------------------------------------------------- - -unsigned char dst_mac_addr[6] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff -}; - -// ---------------------------------------------------------------- - -// #define PACKET_SIZE 1500 // bytes -// #define ETH_DATA_RATE 1000000 // 1MB/s -// #define ETH_PACKET_RATE (ETH_DATA_RATE/PACKET_SIZE) // 13,3333 pkts/s - -// static int timer_delta = MASTER_CLK_RATE/ETH_PACKET_RATE; // ticks between interrupts - -static int timer_delta = MASTER_CLK_RATE/1000; // tick at 1kHz - -static volatile bool send_packet_now = false; // timer handler sets this -static volatile bool link_is_up = false; // eth handler sets this - -int packet_number = 0; - -// ---------------------------------------------------------------- - -// debugging output on tx pins -#define LS_MASK 0xE0000 -#define LS_1000 0x80000 -#define LS_100 0x40000 -#define LS_10 0x20000 - - -/* - * Called when eth phy state changes (w/ interrupts disabled) - */ -void -link_changed_callback(int speed) -{ - int v = 0; - switch(speed){ - case 10: - v = LS_10; - link_is_up = true; - break; - - case 100: - v = LS_100; - link_is_up = true; - break; - - case 1000: - v = LS_100; - link_is_up = true; - break; - - default: - v = 0; - link_is_up = false; - break; - } - - hal_gpio_set_tx(v, LS_MASK); /* set debug bits on d'board */ - - putstr("\neth link changed: speed = "); - puthex16_nl(speed); -} - -void -timer_irq_handler(unsigned irq) -{ - hal_set_timeout(timer_delta); // schedule next timeout - send_packet_now = 1; -} - - -void -buffer_irq_handler(unsigned irq) -{ - // FIXME -} - -static void -init_packet(int *buf, const u2_eth_packet_t *pkt, int bufnum) -{ - int i = 0; - int mark = ((bufnum & 0xff) << 24) | 0x005A0000; - - for (i = 0; i < BP_NLINES; i++){ - buf[i] = mark | i; - mark ^= 0x00FF0000; - } - - // copy header into buffer - memcpy_wa(buf, pkt, sizeof(*pkt)); -} - -static void -init_packets(void) -{ - int i; - - u2_eth_packet_t pkt __attribute__((aligned (4))); - - for (i = 0; i < 6; i++){ - pkt.ehdr.dst.addr[i] = dst_mac_addr[i]; - } - pkt.ehdr.src = *ethernet_mac_addr(); - pkt.ehdr.ethertype = U2_ETHERTYPE; - - // fill ALL buffers for debugging - for (i = 0; i < 8; i++) - init_packet((void *)buffer_ram(i), &pkt, i); -} - -static int led_counter = 0; - -int -main(void) -{ - int send_pause = 1; - - u2_init(); - - // setup tx gpio bits for GPIOM_FPGA_1 -- fpga debug output - //hal_gpio_set_sels(GPIO_TX_BANK, "1111111111111111"); - //hal_gpio_set_sels(GPIO_RX_BANK, "1111111111111111"); - - putstr("\ngen_eth_packets\n"); - - // Control LEDs - output_regs->leds = 0x00; - - init_packets(); - - // pic_register_handler(IRQ_BUFFER, buffer_irq_handler); // poll for now - pic_register_handler(IRQ_TIMER, timer_irq_handler); - hal_set_timeout(timer_delta); - - ethernet_register_link_changed_callback(link_changed_callback); - - ethernet_init(); - - eth_mac->pause_frame_send_en = 1; - eth_mac->pause_quanta_set = 16384 / 512; - - // eth_mac->speed = 4; // FIXME hardcode mac speed to 1000 - - while(1){ - if (link_is_up && send_packet_now){ - send_packet_now = false; - - - if (send_pause) - eth_mac->xon_cpu = 1; - else - eth_mac->xon_cpu = 0; - - send_pause ^= 1; - - // kick off the next packet - // FIXME set packet number in packet - -#if 0 - bp_send_from_buf(0, PORT_ETH, 1, 0, 255); // 1KB total - - while ((buffer_pool_status->status & (BPS_DONE_0|BPS_ERROR_0)) == 0) - ; - bp_clear_buf(0); -#endif - - output_regs->leds = ((++led_counter) & 0x1) | (link_is_up ? 0x2 : 0x0); - } - } - - hal_finish(); - return 1; -} diff --git a/usrp2/firmware/apps/hello.c b/usrp2/firmware/apps/hello.c deleted file mode 100644 index bce843093..000000000 --- a/usrp2/firmware/apps/hello.c +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#include "u2_init.h" -#include "stdio.h" - -int -main(void) -{ - u2_init(); - - puts("Hello World"); - puts("Goodbye World"); - - return 0; -} diff --git a/usrp2/firmware/apps/ibs_rx_test.c b/usrp2/firmware/apps/ibs_rx_test.c deleted file mode 100644 index bdc04747e..000000000 --- a/usrp2/firmware/apps/ibs_rx_test.c +++ /dev/null @@ -1,82 +0,0 @@ -#include "u2_init.h" -#include "memory_map.h" -#include "spi.h" -#include "hal_io.h" -#include "buffer_pool.h" -#include "nonstdio.h" - -#define PORT 2 // ethernet = 2, serdes = 0 -int dsp_rx_buf, dsp_tx_buf, serdes_rx_buf, serdes_tx_buf; -int dsp_rx_idle, dsp_tx_idle, serdes_rx_idle, serdes_tx_idle; - -int buffer_state[4]; - -static void __attribute__((unused)) -wait_until_status_nonzero(void) -{ - while (buffer_pool_status->status == 0) - ; -} - -int -main(void) -{ - int i; - - u2_init(); - - output_regs->adc_ctrl = 0x0A; - - dsp_rx_regs->freq = 0; - dsp_rx_regs->scale_iq = (1 << 16) | 1; - dsp_rx_regs->decim_rate = 8; - - volatile unsigned int *buffer0 = buffer_ram(0); - volatile unsigned int *buffer1 = buffer_ram(1); - volatile unsigned int *buffer2 = buffer_ram(2); - - putstr("Starting RX\n"); - bp_clear_buf(0); - bp_receive_to_buf(0, 1, 1, 0, 99); - - dsp_rx_regs->rx_command = (50 << 9) | 100; // Numlines, lines per frame - dsp_rx_regs->rx_time = 0x2000; - - dsp_rx_regs->rx_command = (137 << 9) | 50; // Numlines, lines per frame - dsp_rx_regs->rx_time = 0x2200; - - while (buffer_pool_status->status == 0) - ; - bp_clear_buf(0); - bp_clear_buf(1); - bp_receive_to_buf(1, 1, 1, 0, 99); - while (buffer_pool_status->status == 0) - ; - bp_clear_buf(2); - bp_receive_to_buf(2, 1, 1, 0, 99); - while (buffer_pool_status->status == 0) - ; - - for(i=0;i<100;i++) { - puthex(i); - putstr(" "); - puthex_nl(buffer0[i]); - } - for(i=0;i<60;i++) { - puthex(i); - putstr(" "); - puthex_nl(buffer1[i]); - } - for(i=0;i<60;i++) { - puthex(i); - putstr(" "); - puthex_nl(buffer2[i]); - } - //while(timer_regs -> time < 0x6000) - // {} - - putstr("Done\n"); - hal_finish(); - - return 1; -} diff --git a/usrp2/firmware/apps/ibs_tx_test.c b/usrp2/firmware/apps/ibs_tx_test.c deleted file mode 100644 index ff9446d92..000000000 --- a/usrp2/firmware/apps/ibs_tx_test.c +++ /dev/null @@ -1,160 +0,0 @@ -#include "u2_init.h" -#include "memory_map.h" -#include "spi.h" -#include "hal_io.h" -#include "buffer_pool.h" -#include "nonstdio.h" - -// Globals -#define EMPTY 0 -#define FILLING 1 -#define FULL 2 -#define EMPTYING 3 - -#define PORT 2 // ethernet = 2, serdes = 0 -int dsp_rx_buf, dsp_tx_buf, serdes_rx_buf, serdes_tx_buf; -int dsp_rx_idle, dsp_tx_idle, serdes_rx_idle, serdes_tx_idle; - -int buffer_state[4]; - -static void -wait_until_status_nonzero(void) -{ - while (buffer_pool_status->status == 0) - ; -} - -int -main(void) -{ - int i; - - u2_init(); - - dsp_tx_regs->freq = 0; - dsp_tx_regs->scale_iq = (1 << 16) | 1; - dsp_tx_regs->interp_rate = 8; - - // Write data to be sent into the first buffer - volatile unsigned int *buffer0 = buffer_ram(0); - volatile unsigned int *buffer1 = buffer_ram(1); - - - putstr("Starting to fill in RAM\n"); - for(i=0;i<512;i++) - buffer0[i] = i; - putstr("Filled in RAM\n"); - - buffer0[0] = 7; // start and end of buffer, send immediately - buffer0[1] = 0x0000; // start time - bp_clear_buf(0); - bp_send_from_buf(0, 1, 1, 0, 9); - while (buffer_pool_status->status == 0) - ; - while(timer_regs -> time < 0x6000) - {} - - buffer0[0] = 3; // start and end of buffer - buffer0[1] = 0x8000; // start time - bp_clear_buf(0); - bp_send_from_buf(0, 1, 1, 0, 9); - while (buffer_pool_status->status == 0) - ; - while(timer_regs -> time < 0x8400) - {} - - buffer0[0] = 3; // start and end of buffer - buffer0[1] = 0x8800; // start time - bp_clear_buf(0); - bp_send_from_buf(0, 1, 1, 0, 9); - while (buffer_pool_status->status == 0) - ; - while(timer_regs -> time < 0x9000) - {} - - buffer0[0] = 0x2; // not last - buffer0[1] = 0x9100; // start time - bp_clear_buf(0); - bp_send_from_buf(0, 1, 1, 0, 9); - while (buffer_pool_status->status == 0) - ; - buffer0[0] = 0x1; // last - buffer0[1] = 0x0000; // start time - bp_clear_buf(0); - bp_send_from_buf(0, 1, 1, 0, 9); - while (buffer_pool_status->status == 0) - ; - - - buffer0[0] = 0x3; // first and last - buffer0[1] = 0x8000; // Time in the past - bp_clear_buf(0); - bp_send_from_buf(0, 1, 1, 0, 9); - while (buffer_pool_status->status == 0) - ; - - /* - buffer0[0] = 0x2; // not last - buffer0[1] = 0x9600; // start time - bp_clear_buf(0); - bp_send_from_buf(0, 1, 1, 0, 9); - while (buffer_pool_status->status == 0) - ; - */ - - while(timer_regs -> time < 0xa000) - {} - - putstr("Done\n"); - - while(1) - {} - hal_finish(); - - // Send a bunch, let them pile up in FIFO - bp_send_from_buf(0, 2, 1, 21, 80); wait_until_status_nonzero(); - bp_clear_buf(0); - putstr("First add'l TX done\n"); - bp_send_from_buf(0, 2, 1, 81, 288); wait_until_status_nonzero(); - bp_clear_buf(0); - bp_send_from_buf(0, 2, 1, 289, 292); wait_until_status_nonzero(); - bp_clear_buf(0); - bp_send_from_buf(0, 2, 1, 293, 326); wait_until_status_nonzero(); - bp_clear_buf(0); - bp_send_from_buf(0, 2, 1, 327, 399); wait_until_status_nonzero(); - bp_clear_buf(0); - bp_send_from_buf(0, 2, 1, 400, 511); wait_until_status_nonzero(); - bp_clear_buf(0); - putstr("All add'l TX done\n"); - - bp_receive_to_buf(1, 2, 1, 21, 80); wait_until_status_nonzero(); - bp_clear_buf(1); - putstr("First add'l RX done\n"); - bp_receive_to_buf(1, 2, 1, 81, 288); wait_until_status_nonzero(); - bp_clear_buf(1); - bp_receive_to_buf(1, 2, 1, 289, 292); wait_until_status_nonzero(); - bp_clear_buf(1); - bp_receive_to_buf(1, 2, 1, 293, 326); wait_until_status_nonzero(); - bp_clear_buf(1); - bp_receive_to_buf(1, 2, 1, 327, 399); wait_until_status_nonzero(); - bp_clear_buf(1); - bp_receive_to_buf(1, 2, 1, 400, 511); wait_until_status_nonzero(); - bp_clear_buf(1); - putstr("All add'l RX done\n"); - - for(i=0;i<512;i++) - if(buffer0[i] != buffer1[i]) { - putstr("ERROR at location: "); - puthex_nl(i); - putstr("Value sent: "); - puthex_nl(buffer0[i]); - putstr("Value rcvd: "); - puthex_nl(buffer1[i]); - //break; - } - - putstr("Done Testing\n"); - - hal_finish(); - return 1; -} diff --git a/usrp2/firmware/apps/mimo_app_common_v2.c b/usrp2/firmware/apps/mimo_app_common_v2.c deleted file mode 100644 index 5dbecb0d0..000000000 --- a/usrp2/firmware/apps/mimo_app_common_v2.c +++ /dev/null @@ -1,582 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2008,2009 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "mimo_app_common_v2.h" -#include "buffer_pool.h" -#include "memcpy_wa.h" -#include "ethernet.h" -#include "nonstdio.h" -#include "print_rmon_regs.h" -#include "db.h" -#include "db_base.h" -#include "clocks.h" -#include "u2_init.h" -#include <string.h> - -volatile bool link_is_up = false; // eth handler sets this -int cpu_tx_buf_dest_port = PORT_ETH; - -// If this is non-zero, this dbsm could be writing to the ethernet -dbsm_t *ac_could_be_sending_to_eth; - -static unsigned char exp_seqno __attribute__((unused)) = 0; - -void abort(void); - -static bool -burn_mac_addr(const op_burn_mac_addr_t *p) -{ - return ethernet_set_mac_addr(&p->addr); -} - -static bool -sync_to_pps(const op_generic_t *p) -{ - timesync_regs->sync_on_next_pps = 1; - putstr("SYNC to PPS\n"); - return true; -} - -static bool -config_mimo_cmd(const op_config_mimo_t *p) -{ - clocks_mimo_config(p->flags); - return true; -} - -void -set_reply_hdr(u2_eth_packet_t *reply_pkt, u2_eth_packet_t const *cmd_pkt) -{ - reply_pkt->ehdr.dst = cmd_pkt->ehdr.src; - reply_pkt->ehdr.src = *ethernet_mac_addr(); - reply_pkt->ehdr.ethertype = U2_ETHERTYPE; - reply_pkt->thdr.flags = 0; - reply_pkt->thdr.fifo_status = 0; // written by protocol engine - reply_pkt->thdr.seqno = 0; // written by protocol engine - reply_pkt->thdr.ack = 0; // written by protocol engine - u2p_set_word0(&reply_pkt->fixed, 0, CONTROL_CHAN); - reply_pkt->fixed.timestamp = timer_regs->time; -} - -static void -send_reply(unsigned char *reply, size_t reply_len) -{ - if (reply_len < 64) - reply_len = 64; - - // wait for buffer to become idle - hal_set_leds(0x4, 0x4); - while((buffer_pool_status->status & BPS_IDLE(CPU_TX_BUF)) == 0) - ; - hal_set_leds(0x0, 0x4); - - // copy reply into CPU_TX_BUF - memcpy_wa(buffer_ram(CPU_TX_BUF), reply, reply_len); - - // wait until nobody else is sending to the ethernet - if (ac_could_be_sending_to_eth){ - hal_set_leds(0x8, 0x8); - dbsm_wait_for_opening(ac_could_be_sending_to_eth); - hal_set_leds(0x0, 0x8); - } - - if (0){ - printf("sending_reply to port %d, len = %d\n", cpu_tx_buf_dest_port, (int)reply_len); - print_buffer(buffer_ram(CPU_TX_BUF), reply_len/4); - } - - // fire it off - bp_send_from_buf(CPU_TX_BUF, cpu_tx_buf_dest_port, 1, 0, reply_len/4); - - // wait for it to complete (not long, it's a small pkt) - while((buffer_pool_status->status & (BPS_DONE(CPU_TX_BUF) | BPS_ERROR(CPU_TX_BUF))) == 0) - ; - - bp_clear_buf(CPU_TX_BUF); -} - - -static size_t -op_id_cmd(const op_generic_t *p, - void *reply_payload, size_t reply_payload_space) -{ - op_id_reply_t *r = (op_id_reply_t *) reply_payload; - if (reply_payload_space < sizeof(*r)) // no room - return 0; - - // Build reply subpacket - - r->opcode = OP_ID_REPLY; - r->len = sizeof(op_id_reply_t); - r->rid = p->rid; - r->addr = *ethernet_mac_addr(); - r->hw_rev = (u2_hw_rev_major << 8) | u2_hw_rev_minor; - // r->fpga_md5sum = ; // FIXME - // r->sw_md5sum = ; // FIXME - - return r->len; -} - - -static size_t -config_tx_v2_cmd(const op_config_tx_v2_t *p, - void *reply_payload, size_t reply_payload_space) -{ - op_config_tx_reply_v2_t *r = (op_config_tx_reply_v2_t *) reply_payload; - if (reply_payload_space < sizeof(*r)) - return 0; // no room - - struct tune_result tune_result; - memset(&tune_result, 0, sizeof(tune_result)); - - bool ok = true; - -#if 0 - if (p->valid & CFGV_GAIN){ - ok &= db_set_gain(tx_dboard, p->gain); - } - - if (p->valid & CFGV_FREQ){ - bool was_streaming = is_streaming(); - if (was_streaming) - stop_rx_cmd(); - - u2_fxpt_freq_t f = u2_fxpt_freq_from_hilo(p->freq_hi, p->freq_lo); - bool tune_ok = db_tune(tx_dboard, f, &tune_result); - ok &= tune_ok; - print_tune_result("Tx", tune_ok, f, &tune_result); - - if (was_streaming) - restart_streaming(); - } - - if (p->valid & CFGV_INTERP_DECIM){ - int interp = p->interp; - int hb1 = 0; - int hb2 = 0; - - if (!(interp & 1)){ - hb2 = 1; - interp = interp >> 1; - } - - if (!(interp & 1)){ - hb1 = 1; - interp = interp >> 1; - } - - if (interp < MIN_CIC_INTERP || interp > MAX_CIC_INTERP) - ok = false; - else { - dsp_tx_regs->interp_rate = (hb1<<9) | (hb2<<8) | interp; - // printf("Interp: %d, register %d\n", p->interp, (hb1<<9) | (hb2<<8) | interp); - } - } - - if (p->valid & CFGV_SCALE_IQ){ - dsp_tx_regs->scale_iq = p->scale_iq; - } -#endif - - // Build reply subpacket - - r->opcode = OP_CONFIG_TX_REPLY_V2; - r->len = sizeof(*r); - r->rid = p->rid; - r->ok = ok; - r->inverted = tune_result.inverted; - r->baseband_freq_hi = u2_fxpt_freq_hi(tune_result.baseband_freq); - r->baseband_freq_lo = u2_fxpt_freq_lo(tune_result.baseband_freq); - r->duc_freq_hi = u2_fxpt_freq_hi(tune_result.dxc_freq); - r->duc_freq_lo = u2_fxpt_freq_lo(tune_result.dxc_freq); - r->residual_freq_hi = u2_fxpt_freq_hi(tune_result.residual_freq); - r->residual_freq_lo = u2_fxpt_freq_lo(tune_result.residual_freq); - return r->len; -} - -static size_t -config_rx_v2_cmd(const op_config_rx_v2_t *p, - void *reply_payload, size_t reply_payload_space) -{ - op_config_rx_reply_v2_t *r = (op_config_rx_reply_v2_t *) reply_payload; - if (reply_payload_space < sizeof(*r)) - return 0; // no room - - struct tune_result tune_result; - memset(&tune_result, 0, sizeof(tune_result)); - - bool ok = true; - - if (p->valid & CFGV_GAIN){ - ok &= db_set_gain(rx_dboard, p->gain); - } - - if (p->valid & CFGV_FREQ){ - bool was_streaming = is_streaming(); - if (was_streaming) - stop_rx_cmd(); - - u2_fxpt_freq_t f = u2_fxpt_freq_from_hilo(p->freq_hi, p->freq_lo); - bool tune_ok = db_tune(rx_dboard, f, &tune_result); - ok &= tune_ok; - print_tune_result("Rx", tune_ok, f, &tune_result); - - if (was_streaming) - restart_streaming(); - } - - if (p->valid & CFGV_INTERP_DECIM){ - int decim = p->decim; - int hb1 = 0; - int hb2 = 0; - - if(!(decim & 1)) { - hb2 = 1; - decim = decim >> 1; - } - - if(!(decim & 1)) { - hb1 = 1; - decim = decim >> 1; - } - - if (decim < MIN_CIC_DECIM || decim > MAX_CIC_DECIM) - ok = false; - else { - dsp_rx_regs->decim_rate = (hb1<<9) | (hb2<<8) | decim; - // printf("Decim: %d, register %d\n", p->decim, (hb1<<9) | (hb2<<8) | decim); - } - } - - if (p->valid & CFGV_SCALE_IQ){ - dsp_rx_regs->scale_iq = p->scale_iq; - } - - // Build reply subpacket - - r->opcode = OP_CONFIG_RX_REPLY_V2; - r->len = sizeof(*r); - r->rid = p->rid; - r->ok = ok; - r->inverted = tune_result.inverted; - r->baseband_freq_hi = u2_fxpt_freq_hi(tune_result.baseband_freq); - r->baseband_freq_lo = u2_fxpt_freq_lo(tune_result.baseband_freq); - r->ddc_freq_hi = u2_fxpt_freq_hi(tune_result.dxc_freq); - r->ddc_freq_lo = u2_fxpt_freq_lo(tune_result.dxc_freq); - r->residual_freq_hi = u2_fxpt_freq_hi(tune_result.residual_freq); - r->residual_freq_lo = u2_fxpt_freq_lo(tune_result.residual_freq); - - return r->len; -} - -static size_t -read_time_cmd(const op_generic_t *p, - void *reply_payload, size_t reply_payload_space) -{ - op_read_time_reply_t *r = (op_read_time_reply_t *) reply_payload; - if (reply_payload_space < sizeof(*r)) - return 0; // no room - - r->opcode = OP_READ_TIME_REPLY; - r->len = sizeof(*r); - r->rid = p->rid; - r->time = timer_regs->time; - - return r->len; -} - -static void -fill_db_info(u2_db_info_t *p, const struct db_base *db) -{ - p->dbid = db->dbid; - p->freq_min_hi = u2_fxpt_freq_hi(db->freq_min); - p->freq_min_lo = u2_fxpt_freq_lo(db->freq_min); - p->freq_max_hi = u2_fxpt_freq_hi(db->freq_max); - p->freq_max_lo = u2_fxpt_freq_lo(db->freq_max); - p->gain_min = db->gain_min; - p->gain_max = db->gain_max; - p->gain_step_size = db->gain_step_size; -} - -static size_t -dboard_info_cmd(const op_generic_t *p, - void *reply_payload, size_t reply_payload_space) -{ - op_dboard_info_reply_t *r = (op_dboard_info_reply_t *) reply_payload; - if (reply_payload_space < sizeof(*r)) - return 0; // no room - - r->opcode = OP_DBOARD_INFO_REPLY; - r->len = sizeof(*r); - r->rid = p->rid; - r->ok = true; - - fill_db_info(&r->tx_db_info, tx_dboard); - fill_db_info(&r->rx_db_info, rx_dboard); - - return r->len; -} - -static size_t -peek_cmd(const op_peek_t *p, - void *reply_payload, size_t reply_payload_space) -{ - op_generic_t *r = (op_generic_t *) reply_payload; - - putstr("peek: addr="); puthex32(p->addr); - printf(" bytes=%u\n", p->bytes); - - if ((reply_payload_space < (sizeof(*r) + p->bytes)) || - p->bytes > MAX_SUBPKT_LEN - sizeof(op_generic_t)) { - putstr("peek: insufficient reply packet space\n"); - return 0; // FIXME do partial read? - } - - r->opcode = OP_PEEK_REPLY; - r->len = sizeof(*r)+p->bytes; - r->rid = p->rid; - r->ok = true; - - memcpy_wa(reply_payload+sizeof(*r), (void *)p->addr, p->bytes); - - return r->len; -} - -static bool -poke_cmd(const op_poke_t *p) -{ - int bytes = p->len - sizeof(*p); - putstr("poke: addr="); puthex32(p->addr); - printf(" bytes=%u\n", bytes); - - uint8_t *src = (uint8_t *)p + sizeof(*p); - memcpy_wa((void *)p->addr, src, bytes); - - return true; -} - -static size_t -generic_reply(const op_generic_t *p, - void *reply_payload, size_t reply_payload_space, - bool ok) -{ - op_generic_t *r = (op_generic_t *) reply_payload; - if (reply_payload_space < sizeof(*r)) - return 0; // no room - - r->opcode = p->opcode | OP_REPLY_BIT; - r->len = sizeof(*r); - r->rid = p->rid; - r->ok = ok; - - return r->len; -} - -static size_t -add_eop(void *reply_payload, size_t reply_payload_space) -{ - op_generic_t *r = (op_generic_t *) reply_payload; - if (reply_payload_space < sizeof(*r)) - return 0; // no room - - r->opcode = OP_EOP; - r->len = sizeof(*r); - r->rid = 0; - r->ok = 0; - - return r->len; -} - -void -handle_control_chan_frame(u2_eth_packet_t *pkt, size_t len) -{ - unsigned char reply[sizeof(u2_eth_packet_t) + 4 * sizeof(u2_subpkt_t)] _AL4; - unsigned char *reply_payload = &reply[sizeof(u2_eth_packet_t)]; - int reply_payload_space = sizeof(reply) - sizeof(u2_eth_packet_t); - - // initialize reply - memset(reply, 0, sizeof(reply)); - set_reply_hdr((u2_eth_packet_t *) reply, pkt); - - // point to beginning of payload (subpackets) - unsigned char *payload = ((unsigned char *) pkt) + sizeof(u2_eth_packet_t); - int payload_len = len - sizeof(u2_eth_packet_t); - - size_t subpktlen = 0; - - while (payload_len >= sizeof(op_generic_t)){ - const op_generic_t *gp = (const op_generic_t *) payload; - subpktlen = 0; - - // printf("\nopcode = %d\n", gp->opcode); - - switch(gp->opcode){ - case OP_EOP: // end of subpackets - goto end_of_subpackets; - - case OP_ID: - subpktlen = op_id_cmd(gp, reply_payload, reply_payload_space); - break; - - case OP_CONFIG_TX_V2: - subpktlen = config_tx_v2_cmd((op_config_tx_v2_t *) payload, - reply_payload, reply_payload_space); - break; - - case OP_CONFIG_RX_V2: - subpktlen = config_rx_v2_cmd((op_config_rx_v2_t *) payload, - reply_payload, reply_payload_space); - break; - - case OP_START_RX_STREAMING: - start_rx_streaming_cmd(&pkt->ehdr.src, (op_start_rx_streaming_t *) payload); - subpktlen = generic_reply(gp, reply_payload, reply_payload_space, true); - break; - - case OP_STOP_RX: - stop_rx_cmd(); - subpktlen = generic_reply(gp, reply_payload, reply_payload_space, true); - break; - - case OP_BURN_MAC_ADDR: - subpktlen = generic_reply(gp, reply_payload, reply_payload_space, - burn_mac_addr((op_burn_mac_addr_t *) payload)); - break; - - case OP_CONFIG_MIMO: - subpktlen = generic_reply(gp, reply_payload, reply_payload_space, - config_mimo_cmd((op_config_mimo_t *) payload)); - break; - - case OP_READ_TIME: - subpktlen = read_time_cmd(gp, reply_payload, reply_payload_space); - break; - - case OP_DBOARD_INFO: - subpktlen = dboard_info_cmd(gp, reply_payload, reply_payload_space); - break; - - case OP_SYNC_TO_PPS: - subpktlen = generic_reply(gp, reply_payload, reply_payload_space, - sync_to_pps((op_generic_t *) payload)); - break; - - case OP_PEEK: - subpktlen = peek_cmd((op_peek_t *)payload, reply_payload, reply_payload_space); - break; - - case OP_POKE: - subpktlen = generic_reply(gp, reply_payload, reply_payload_space, - poke_cmd((op_poke_t *)payload)); - break; - - default: - printf("app_common_v2: unhandled opcode = %d\n", gp->opcode); - break; - } - - int t = (gp->len + 3) & ~3; // bump to a multiple of 4 - payload += t; - payload_len -= t; - - subpktlen = (subpktlen + 3) & ~3; // bump to a multiple of 4 - reply_payload += subpktlen; - reply_payload_space -= subpktlen; - } - - end_of_subpackets: - - // add the EOP marker - subpktlen = add_eop(reply_payload, reply_payload_space); - subpktlen = (subpktlen + 3) & ~3; // bump to a multiple of 4 - reply_payload += subpktlen; - reply_payload_space -= subpktlen; - - send_reply(reply, reply_payload - reply); -} - - -/* - * Called when an ethernet packet is received. - * Return true if we handled it here, otherwise - * it'll be passed on to the DSP Tx pipe - */ -int -eth_pkt_inspector(bsm12_t *sm, int bufno) -{ - u2_eth_packet_t *pkt = (u2_eth_packet_t *) buffer_ram(bufno); - size_t byte_len = (buffer_pool_status->last_line[bufno] - 3) * 4; - - //static size_t last_len = 0; - - // hal_toggle_leds(0x1); - - // inspect rcvd frame and figure out what do do. - - if (pkt->ehdr.ethertype != U2_ETHERTYPE) - return true; // ignore, probably bogus PAUSE frame from MAC - - int chan = u2p_chan(&pkt->fixed); - - switch (chan){ - case CONTROL_CHAN: - handle_control_chan_frame(pkt, byte_len); - return -1; - break; - - case 0: - return 0; // pass it off to DSP TX - - case 1: - return 1; // pass it off to SERDES TX - - default: - abort(); - break; - } -} - -/* - * Called when eth phy state changes (w/ interrupts disabled) - */ -void -link_changed_callback(int speed) -{ - link_is_up = speed != 0; - hal_set_leds(link_is_up ? LED_RJ45 : 0x0, LED_RJ45); - printf("\neth link changed: speed = %d\n", speed); -} - - -void -print_tune_result(char *msg, bool tune_ok, - u2_fxpt_freq_t target_freq, struct tune_result *r) -{ -#if 0 - printf("db_tune %s %s\n", msg, tune_ok ? "true" : "false"); - putstr(" target_freq "); print_fxpt_freq(target_freq); newline(); - putstr(" baseband_freq "); print_fxpt_freq(r->baseband_freq); newline(); - putstr(" dxc_freq "); print_fxpt_freq(r->dxc_freq); newline(); - putstr(" residual_freq "); print_fxpt_freq(r->residual_freq); newline(); - printf(" inverted %s\n", r->inverted ? "true" : "false"); -#endif -} diff --git a/usrp2/firmware/apps/mimo_app_common_v2.h b/usrp2/firmware/apps/mimo_app_common_v2.h deleted file mode 100644 index 7bb5b7286..000000000 --- a/usrp2/firmware/apps/mimo_app_common_v2.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifndef INCLUDED_APP_COMMON_H -#define INCLUDED_APP_COMMON_H - -#include "bool.h" -#include "usrp2_eth_packet.h" -#include "bsm12.h" -#include "memory_map.h" -#include "hal_io.h" -#include <stddef.h> -#include <db.h> - -#define CPU_TX_BUF 7 // cpu -> eth - -#define _AL4 __attribute__((aligned (4))) - -extern volatile bool link_is_up; // eth handler sets this - -// If there's a dbsm that sends to the ethernet, put it's address here -extern dbsm_t *ac_could_be_sending_to_eth; - -extern int cpu_tx_buf_dest_port; - -void set_reply_hdr(u2_eth_packet_t *reply_pkt, u2_eth_packet_t const *cmd_pkt); - -/* - * Called when an ethernet packet is received. - */ -int eth_pkt_inspector(bsm12_t *sm, int bufno); - - -void link_changed_callback(int speed); - -void -print_tune_result(char *msg, bool tune_ok, - u2_fxpt_freq_t target_freq, struct tune_result *r); - - -void start_rx_streaming_cmd(const u2_mac_addr_t *host, op_start_rx_streaming_t *p); -void stop_rx_cmd(void); -void restart_streaming(void); -bool is_streaming(void); - -void handle_control_chan_frame(u2_eth_packet_t *pkt, size_t len); - -#endif /* INCLUDED_APP_COMMON_H */ diff --git a/usrp2/firmware/apps/mimo_tx.c b/usrp2/firmware/apps/mimo_tx.c deleted file mode 100644 index 7fc7b486f..000000000 --- a/usrp2/firmware/apps/mimo_tx.c +++ /dev/null @@ -1,363 +0,0 @@ -/* - * Copyright 2007,2008,2009 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -/* - * This is a down and dirty test program that confirms that the we can - * coherently transmit different signals to two USRP2s connected via a - * mimo cable. This code runs in the USRP2 connected to the ethernet. - * The other USRP runs mimo_tx_slave. The host runs test_mimo_tx. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "u2_init.h" -#include "memory_map.h" -#include "spi.h" -#include "hal_io.h" -#include "buffer_pool.h" -#include "pic.h" -#include "bool.h" -#include "ethernet.h" -#include "nonstdio.h" -#include "usrp2_eth_packet.h" -#include "bsm12.h" -#include "mimo_app_common_v2.h" -#include "memcpy_wa.h" -#include <stddef.h> -#include <stdlib.h> -#include <string.h> -#include "clocks.h" - -#define FW_SETS_SEQNO 1 // define to 0 or 1 (FIXME must be 1 for now) - -#if (FW_SETS_SEQNO) -static int fw_seqno; // used when f/w is filling in sequence numbers -#endif - - -/* - * Experimental code to transmit packets to DSP Tx and SERDES - * - * Hard wire the Tx config so we don't have to deal with control stuff yet. - */ - -#define BUF_BSM12_0 4 -#define BUF_BSM12_1 5 -#define BUF_BSM12_2 6 - -//#define CPU_TX_BUF 7 // cpu -> eth - -// 4 lines of ethernet hdr + 1 line transport hdr + 2 lines (word0 + timestamp) -// DSP Tx reads word0 (flags) + timestamp followed by samples - -#define DSP_TX_FIRST_LINE ((sizeof(u2_eth_hdr_t) + sizeof(u2_transport_hdr_t))/4) - -// Receive from ethernet -buf_cmd_args_t bsm12_recv_args = { - PORT_ETH, - 0, - BP_LAST_LINE -}; - -// send to DSP Tx -buf_cmd_args_t bsm12_send0_args = { - PORT_DSP, - DSP_TX_FIRST_LINE, // starts just past transport header - 0 // filled in from last_line register -}; - -// send to SERDES -buf_cmd_args_t bsm12_send1_args = { - PORT_SERDES, - 0, // starts just past transport header - 0 // filled in from last_line register -}; - -bsm12_t bsm12_sm; // the state machine - -#if 0 -/* - * ================================================================ - * configure DSP RX double buffering state machine (dsp -> eth) - * ================================================================ - */ - -// 4 lines of ethernet hdr + 1 line transport hdr + 1 line (word0) -// DSP Rx writes timestamp followed by nlines_per_frame of samples -#define DSP_RX_FIRST_LINE ((sizeof(u2_eth_hdr_t) + sizeof(u2_transport_hdr_t))/4 + 1) - -// receive from DSP -buf_cmd_args_t dsp_rx_recv_args = { - PORT_DSP, - DSP_RX_FIRST_LINE, - BP_LAST_LINE -}; - -// send to ETH -buf_cmd_args_t dsp_rx_send_args = { - PORT_ETH, - 0, // starts with ethernet header in line 0 - 0, // filled in from list_line register -}; - -dbsm_t dsp_rx_sm; // the state machine -#endif - - -// The mac address of the host we're sending to. -u2_mac_addr_t host_mac_addr; - - -// variables for streaming mode - -static bool streaming_p = false; -static unsigned int streaming_items_per_frame = 0; -static int streaming_frame_count = 0; -#define FRAMES_PER_CMD 1000 - -bool is_streaming(void){ return streaming_p; } - - -// ---------------------------------------------------------------- - - -void -restart_streaming(void) -{ -#if 0 - // setup RX DSP regs - dsp_rx_regs->clear_state = 1; // reset - - streaming_p = true; - streaming_frame_count = FRAMES_PER_CMD; - - dsp_rx_regs->rx_command = - MK_RX_CMD(FRAMES_PER_CMD * streaming_items_per_frame, - streaming_items_per_frame, - 1, 1); // set "chain" bit - - // kick off the state machine - dbsm_start(&dsp_rx_sm); - - dsp_rx_regs->rx_time = 0; // enqueue first of two commands - - // make sure this one and the rest have the "now" and "chain" bits set. - dsp_rx_regs->rx_command = - MK_RX_CMD(FRAMES_PER_CMD * streaming_items_per_frame, - streaming_items_per_frame, - 1, 1); - - dsp_rx_regs->rx_time = 0; // enqueue second command -#endif -} - -void -start_rx_streaming_cmd(const u2_mac_addr_t *host, op_start_rx_streaming_t *p) -{ -#if 0 - host_mac_addr = *host; // remember who we're sending to - - /* - * Construct ethernet header and word0 and preload into two buffers - */ - u2_eth_packet_t pkt; - memset(&pkt, 0, sizeof(pkt)); - pkt.ehdr.dst = *host; - pkt.ehdr.src = *ethernet_mac_addr(); - pkt.ehdr.ethertype = U2_ETHERTYPE; - u2p_set_word0(&pkt.fixed, 0, 0); - // DSP RX will fill in timestamp - - memcpy_wa(buffer_ram(DSP_RX_BUF_0), &pkt, sizeof(pkt)); - memcpy_wa(buffer_ram(DSP_RX_BUF_1), &pkt, sizeof(pkt)); - - - if (FW_SETS_SEQNO) - fw_seqno = 0; - - streaming_items_per_frame = p->items_per_frame; - restart_streaming(); -#endif -} - - -void -stop_rx_cmd(void) -{ -#if 0 - streaming_p = false; - dsp_rx_regs->clear_state = 1; // flush cmd queue - bp_clear_buf(DSP_RX_BUF_0); - bp_clear_buf(DSP_RX_BUF_1); -#endif -} - - -static void -setup_tx() -{ - dsp_tx_regs->clear_state = 1; - - int tx_scale = 2500; - int interp = 8; // * 4 - - // setup some defaults - - dsp_tx_regs->freq = 429496730; // 10MHz - dsp_tx_regs->scale_iq = (tx_scale << 16) | tx_scale; - dsp_tx_regs->interp_rate = (1 << 9) | (1 << 8) | interp; -} - - -#if 0 -#if (FW_SETS_SEQNO) -/* - * Debugging ONLY. This will be handled by the tx_protocol_engine. - * - * This is called when the DSP Rx chain has filled in a packet. - * We set and increment the seqno, then return false, indicating - * that we didn't handle the packet. A bit of a kludge - * but it should work. - */ -int -fw_sets_seqno_inspector(bsm12_t *sm, int buf_this) -{ - uint32_t *p = buffer_ram(buf_this); - uint32_t seqno = fw_seqno++; - - // KLUDGE all kinds of nasty magic numbers and embedded knowledge - uint32_t t = p[4]; - t = (t & 0xffff00ff) | ((seqno & 0xff) << 8); - p[4] = t; - - // queue up another rx command when required - if (streaming_p && --streaming_frame_count == 0){ - streaming_frame_count = FRAMES_PER_CMD; - dsp_rx_regs->rx_time = 0; - } - - return false; // we didn't handle the packet -} -#endif -#endif - - -inline static void -buffer_irq_handler(unsigned irq) -{ - uint32_t status = buffer_pool_status->status; - - bsm12_process_status(&bsm12_sm, status); -} - -int -main(void) -{ - u2_init(); - - putstr("\nMIMO Tx\n"); - print_mac_addr(ethernet_mac_addr()->addr); - newline(); - - ethernet_register_link_changed_callback(link_changed_callback); - ethernet_init(); - - clocks_mimo_config(MC_WE_DONT_LOCK | MC_PROVIDE_CLK_TO_MIMO); - -#if 0 - // make bit 15 of Tx gpio's be a s/w output - hal_gpio_set_sel(GPIO_TX_BANK, 15, 's'); - hal_gpio_set_ddr(GPIO_TX_BANK, 0x8000, 0x8000); -#endif - - output_regs->debug_mux_ctrl = 1; -#if 0 - hal_gpio_set_sels(GPIO_TX_BANK, "1111111111111111"); - hal_gpio_set_sels(GPIO_RX_BANK, "1111111111111111"); - hal_gpio_set_ddr(GPIO_TX_BANK, 0xffff, 0xffff); - hal_gpio_set_ddr(GPIO_RX_BANK, 0xffff, 0xffff); -#endif - - - // initialize double buffering state machine for ethernet -> DSP Tx - - bsm12_init(&bsm12_sm, BUF_BSM12_0, - &bsm12_recv_args, &bsm12_send0_args, &bsm12_send1_args, - eth_pkt_inspector); - - -#if 0 - // initialize double buffering state machine for DSP RX -> Ethernet - - if (FW_SETS_SEQNO){ - dbsm_init(&dsp_rx_sm, DSP_RX_BUF_0, - &dsp_rx_recv_args, &dsp_rx_send_args, - fw_sets_seqno_inspector); - } - else { - dbsm_init(&dsp_rx_sm, DSP_RX_BUF_0, - &dsp_rx_recv_args, &dsp_rx_send_args, - dbsm_nop_inspector); - } - - // tell app_common that this dbsm could be sending to the ethernet - ac_could_be_sending_to_eth = &dsp_rx_sm; -#endif - - - // program tx registers - setup_tx(); - - // kick off the state machine - bsm12_start(&bsm12_sm); - - //int which = 0; - - while(1){ - // hal_gpio_write(GPIO_TX_BANK, which, 0x8000); - // which ^= 0x8000; - - buffer_irq_handler(0); - - int pending = pic_regs->pending; // poll for under or overrun - - if (pending & PIC_UNDERRUN_INT){ - // dbsm_handle_tx_underrun(&dsp_tx_sm); - pic_regs->pending = PIC_UNDERRUN_INT; // clear interrupt - putchar('U'); - } - - if (pending & PIC_OVERRUN_INT){ - // dbsm_handle_rx_overrun(&dsp_rx_sm); - pic_regs->pending = PIC_OVERRUN_INT; // clear pending interrupt - - // FIXME Figure out how to handle this robustly. - // Any buffers that are emptying should be allowed to drain... - - if (streaming_p){ - // restart_streaming(); - // FIXME report error - } - else { - // FIXME report error - } - putchar('O'); - } - } -} diff --git a/usrp2/firmware/apps/mimo_tx_slave.c b/usrp2/firmware/apps/mimo_tx_slave.c deleted file mode 100644 index 4c284b7c9..000000000 --- a/usrp2/firmware/apps/mimo_tx_slave.c +++ /dev/null @@ -1,380 +0,0 @@ -/* - * Copyright 2007,2008,2009 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -/* - * This is a down and dirty test program that confirms that the we can - * coherently transmit different signals to two USRP2s connected via a - * mimo cable. This code runs in the USRP2 NOT connected to the - * ethernet. The USRP connected to the ethernet runs mimo_tx. The - * host runs test_mimo_tx. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "u2_init.h" -#include "memory_map.h" -#include "spi.h" -#include "hal_io.h" -#include "buffer_pool.h" -#include "pic.h" -#include "bool.h" -#include "ethernet.h" -#include "nonstdio.h" -#include "usrp2_eth_packet.h" -#include "dbsm.h" -#include "app_common_v2.h" -#include "memcpy_wa.h" -#include "clocks.h" -#include <stddef.h> -#include <stdlib.h> -#include <string.h> - - -#define FW_SETS_SEQNO 1 // define to 0 or 1 (FIXME must be 1 for now) - -#if (FW_SETS_SEQNO) -static int fw_seqno; // used when f/w is filling in sequence numbers -#endif - - -/* - * Full duplex Tx and Rx between serdes and DSP pipelines - * - * Buffer 1 is used by the cpu to send frames to the host. - * Buffers 2 and 3 are used to double-buffer the DSP Rx to serdes flow - * Buffers 4 and 5 are used to double-buffer the serdes to DSP Tx flow - */ -//#define CPU_RX_BUF 0 // eth -> cpu - -#define DSP_RX_BUF_0 2 // dsp rx -> serdes (double buffer) -#define DSP_RX_BUF_1 3 // dsp rx -> serdes -#define DSP_TX_BUF_0 4 // serdes -> dsp tx (double buffer) -#define DSP_TX_BUF_1 5 // serdes -> dsp tx - -/* - * ================================================================== - * configure DSP TX double buffering state machine (serdes -> dsp) - * ================================================================== - */ - -// 4 lines of ethernet hdr + 1 line transport hdr + 2 lines (word0 + timestamp) -// DSP Tx reads word0 (flags) + timestamp followed by samples - -#define DSP_TX_FIRST_LINE ((sizeof(u2_eth_hdr_t) + sizeof(u2_transport_hdr_t))/4) - -// Receive from serdes -buf_cmd_args_t dsp_tx_recv_args = { - PORT_SERDES, - 0, - BP_LAST_LINE -}; - -// send to DSP Tx -buf_cmd_args_t dsp_tx_send_args = { - PORT_DSP, - DSP_TX_FIRST_LINE, // starts just past transport header - 0 // filled in from last_line register -}; - -dbsm_t dsp_tx_sm; // the state machine - -/* - * ================================================================= - * configure DSP RX double buffering state machine (dsp -> serdes) - * ================================================================= - */ - -// 4 lines of ethernet hdr + 1 line transport hdr + 1 line (word0) -// DSP Rx writes timestamp followed by nlines_per_frame of samples -#define DSP_RX_FIRST_LINE ((sizeof(u2_eth_hdr_t) + sizeof(u2_transport_hdr_t))/4 + 1) - -// receive from DSP -buf_cmd_args_t dsp_rx_recv_args = { - PORT_DSP, - DSP_RX_FIRST_LINE, - BP_LAST_LINE -}; - -// send to serdes -buf_cmd_args_t dsp_rx_send_args = { - PORT_SERDES, - 0, // starts with ethernet header in line 0 - 0, // filled in from list_line register -}; - -dbsm_t dsp_rx_sm; // the state machine - - -// The mac address of the host we're sending to. -u2_mac_addr_t host_mac_addr; - - -// variables for streaming mode - -static bool streaming_p = false; -static unsigned int streaming_items_per_frame = 0; -static int streaming_frame_count = 0; -#define FRAMES_PER_CMD 1000 - -bool is_streaming(void){ return streaming_p; } - -// ---------------------------------------------------------------- - - -void -restart_streaming(void) -{ - // setup RX DSP regs - dsp_rx_regs->clear_state = 1; // reset - - streaming_p = true; - streaming_frame_count = FRAMES_PER_CMD; - - dsp_rx_regs->rx_command = - MK_RX_CMD(FRAMES_PER_CMD * streaming_items_per_frame, - streaming_items_per_frame, - 1, 1); // set "chain" bit - - // kick off the state machine - dbsm_start(&dsp_rx_sm); - - dsp_rx_regs->rx_time = 0; // enqueue first of two commands - - // make sure this one and the rest have the "now" and "chain" bits set. - dsp_rx_regs->rx_command = - MK_RX_CMD(FRAMES_PER_CMD * streaming_items_per_frame, - streaming_items_per_frame, - 1, 1); - - dsp_rx_regs->rx_time = 0; // enqueue second command -} - -void -start_rx_streaming_cmd(const u2_mac_addr_t *host, op_start_rx_streaming_t *p) -{ - host_mac_addr = *host; // remember who we're sending to - - /* - * Construct ethernet header and word0 and preload into two buffers - */ - u2_eth_packet_t pkt; - memset(&pkt, 0, sizeof(pkt)); - pkt.ehdr.dst = *host; - pkt.ehdr.src = *ethernet_mac_addr(); - pkt.ehdr.ethertype = U2_ETHERTYPE; - u2p_set_word0(&pkt.fixed, 0, 0); - // DSP RX will fill in timestamp - - memcpy_wa(buffer_ram(DSP_RX_BUF_0), &pkt, sizeof(pkt)); - memcpy_wa(buffer_ram(DSP_RX_BUF_1), &pkt, sizeof(pkt)); - - - if (FW_SETS_SEQNO) - fw_seqno = 0; - - streaming_items_per_frame = p->items_per_frame; - restart_streaming(); -} - -void start_rx_streaming_at_cmd(const u2_mac_addr_t *host, op_start_rx_streaming_t *p, uint32_t time) -{} -void restart_streaming_at(uint32_t time) -{} - -void -stop_rx_cmd(void) -{ - streaming_p = false; - dsp_rx_regs->clear_state = 1; // flush cmd queue - bp_clear_buf(DSP_RX_BUF_0); - bp_clear_buf(DSP_RX_BUF_1); -} - - -static void -setup_tx() -{ - dsp_tx_regs->clear_state = 1; - bp_clear_buf(DSP_TX_BUF_0); - bp_clear_buf(DSP_TX_BUF_1); - - int tx_scale = 2500; - int interp = 8; // * 4 - - // setup some defaults - - dsp_tx_regs->freq = 429496730; // 10MHz - dsp_tx_regs->scale_iq = (tx_scale << 16) | tx_scale; - dsp_tx_regs->interp_rate = (1 << 9) | (1 << 8) | interp; -} - - -#if (FW_SETS_SEQNO) -/* - * Debugging ONLY. This will be handled by the tx_protocol_engine. - * - * This is called when the DSP Rx chain has filled in a packet. - * We set and increment the seqno, then return false, indicating - * that we didn't handle the packet. A bit of a kludge - * but it should work. - */ -bool -fw_sets_seqno_inspector(dbsm_t *sm, int buf_this) // returns false -{ - uint32_t *p = buffer_ram(buf_this); - uint32_t seqno = fw_seqno++; - - // KLUDGE all kinds of nasty magic numbers and embedded knowledge - uint32_t t = p[4]; - t = (t & 0xffff00ff) | ((seqno & 0xff) << 8); - p[4] = t; - - // queue up another rx command when required - if (streaming_p && --streaming_frame_count == 0){ - streaming_frame_count = FRAMES_PER_CMD; - dsp_rx_regs->rx_time = 0; - } - - return false; // we didn't handle the packet -} -#endif - - -inline static void -buffer_irq_handler(unsigned irq) -{ - // hal_toggle_leds(LED_A); - - uint32_t status = buffer_pool_status->status; - - if (0 && (status & ~BPS_IDLE_ALL)){ - putstr("status = "); - puthex32_nl(status); - } - - dbsm_process_status(&dsp_tx_sm, status); - dbsm_process_status(&dsp_rx_sm, status); -} - -int -main(void) -{ - u2_init(); - - output_regs->led_src = 0x3; // h/w controls bottom two bits - clocks_enable_test_clk(true, 1); - - putstr("\nMIMO Tx Slave\n"); - - cpu_tx_buf_dest_port = PORT_SERDES; - - // ethernet_register_link_changed_callback(link_changed_callback); - // ethernet_init(); - - clocks_mimo_config(MC_WE_LOCK_TO_MIMO); - - // puts("post clocks_mimo_config"); - -#if 0 - // make bit 15 of Tx gpio's be a s/w output - hal_gpio_set_sel(GPIO_TX_BANK, 15, 's'); - hal_gpio_set_ddr(GPIO_TX_BANK, 0x8000, 0x8000); -#endif - -#if 0 - output_regs->debug_mux_ctrl = 1; - hal_gpio_set_sels(GPIO_TX_BANK, "0000000000000000"); - hal_gpio_set_sels(GPIO_RX_BANK, "0000000000000000"); - hal_gpio_set_ddr(GPIO_TX_BANK, 0xffff, 0xffff); - hal_gpio_set_ddr(GPIO_RX_BANK, 0xffff, 0xffff); -#endif - - - // initialize double buffering state machine for ethernet -> DSP Tx - - dbsm_init(&dsp_tx_sm, DSP_TX_BUF_0, - &dsp_tx_recv_args, &dsp_tx_send_args, - eth_pkt_inspector); - - - //output_regs->flush_icache = 1; - - // initialize double buffering state machine for DSP RX -> Ethernet - - if (FW_SETS_SEQNO){ - dbsm_init(&dsp_rx_sm, DSP_RX_BUF_0, - &dsp_rx_recv_args, &dsp_rx_send_args, - fw_sets_seqno_inspector); - } - else { - dbsm_init(&dsp_rx_sm, DSP_RX_BUF_0, - &dsp_rx_recv_args, &dsp_rx_send_args, - dbsm_nop_inspector); - } - - // puts("post dbsm_init's"); - - // tell app_common that this dbsm could be sending to the ethernet - ac_could_be_sending_to_eth = &dsp_rx_sm; - - - // program tx registers - setup_tx(); - - // puts("post setup_tx"); - - // kick off the state machine - dbsm_start(&dsp_tx_sm); - - // puts("post dbsm_start"); - - //int which = 0; - - while(1){ - // hal_gpio_write(GPIO_TX_BANK, which, 0x8000); - // which ^= 0x8000; - - buffer_irq_handler(0); - - int pending = pic_regs->pending; // poll for under or overrun - - if (pending & PIC_UNDERRUN_INT){ - dbsm_handle_tx_underrun(&dsp_tx_sm); - pic_regs->pending = PIC_UNDERRUN_INT; // clear interrupt - putchar('U'); - } - - if (pending & PIC_OVERRUN_INT){ - dbsm_handle_rx_overrun(&dsp_rx_sm); - pic_regs->pending = PIC_OVERRUN_INT; // clear pending interrupt - - // FIXME Figure out how to handle this robustly. - // Any buffers that are emptying should be allowed to drain... - - if (streaming_p){ - // restart_streaming(); - // FIXME report error - } - else { - // FIXME report error - } - putchar('O'); - } - } -} diff --git a/usrp2/firmware/apps/rcv_eth_packets.c b/usrp2/firmware/apps/rcv_eth_packets.c deleted file mode 100644 index ec772ca75..000000000 --- a/usrp2/firmware/apps/rcv_eth_packets.c +++ /dev/null @@ -1,233 +0,0 @@ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include "u2_init.h" -#include "memory_map.h" -#include "spi.h" -#include "hal_io.h" -#include "buffer_pool.h" -#include "pic.h" -#include "bool.h" -#include "ethernet.h" -#include "nonstdio.h" -#include "usrp2_eth_packet.h" -#include "memcpy_wa.h" -#include <stddef.h> -#include <stdlib.h> - - -// ---------------------------------------------------------------- - -static u2_mac_addr_t dst_mac_addr = - {{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }}; - - -// ---------------------------------------------------------------- - -#define PACKET_SIZE 1500 // bytes -#define ETH_DATA_RATE 1000000 // 1MB/s -#define ETH_PACKET_RATE (ETH_DATA_RATE/PACKET_SIZE) // 13,3333 pkts/s - -#define TIMER_RATE 100000000 // 100 MHz clock - -static int timer_delta = TIMER_RATE/ETH_PACKET_RATE; // ticks between interrupts - -static volatile bool send_packet_now = false; // timer handler sets this -static volatile bool link_is_up = false; // eth handler sets this - -int packet_number = 0; - -// ---------------------------------------------------------------- - -// debugging output on tx pins -#define LS_MASK 0xE0000 -#define LS_1000 0x80000 -#define LS_100 0x40000 -#define LS_10 0x20000 - - -/* - * Called when eth phy state changes (w/ interrupts disabled) - */ -void -link_changed_callback(int speed) -{ - int v = 0; - switch(speed){ - case 10: - v = LS_10; - link_is_up = true; - break; - - case 100: - v = LS_100; - link_is_up = true; - break; - - case 1000: - v = LS_100; - link_is_up = true; - break; - - default: - v = 0; - link_is_up = false; - break; - } - - //hal_gpio_set_tx(v, LS_MASK); /* set debug bits on d'board */ - - putstr("\neth link changed: speed = "); - puthex16_nl(speed); -} - -void -timer_irq_handler(unsigned irq) -{ - hal_set_timeout(timer_delta); // schedule next timeout - send_packet_now = 1; -} - - -void -buffer_irq_handler(unsigned irq) -{ - // FIXME -} - -static void -init_packet(int *buf, const u2_eth_packet_t *pkt, int bufnum) -{ - int i = 0; - int mark = ((bufnum & 0xff) << 24) | 0x005A0000; - - for (i = 0; i < BP_NLINES; i++){ - buf[i] = mark | i; - mark ^= 0x00FF0000; - } - - // copy header into buffer - memcpy_wa(buf, pkt, sizeof(*pkt)); -} - -static void -init_packets(void) -{ - int i; - - u2_eth_packet_t pkt __attribute__((aligned (4))); - - pkt.ehdr.dst = dst_mac_addr; - pkt.ehdr.src = *ethernet_mac_addr(); - pkt.ehdr.ethertype = U2_ETHERTYPE; - - // fill ALL buffers for debugging - for (i = 0; i < 8; i++) - init_packet((void *)buffer_ram(i), &pkt, i); -} - -int -main(void) -{ - u2_init(); - - int prev_leds = -1; - int new_leds = 0x00; - output_regs->leds = 0x00; - - int peak_hold_count = 0; - - // setup tx gpio bits for GPIOM_FPGA_1 -- fpga debug output - //hal_gpio_set_sels(GPIO_TX_BANK, "1111111111111111"); - //hal_gpio_set_sels(GPIO_RX_BANK, "1111111111111111"); - - putstr("\nrcv_eth_packets\n"); - - init_packets(); - - // pic_register_handler(IRQ_BUFFER, buffer_irq_handler); // poll for now - - // FIXME turn off timer since I don't think MTS and MFS instructions are implemented - // pic_register_handler(IRQ_TIMER, timer_irq_handler); - // hal_set_timeout(timer_delta); - - ethernet_register_link_changed_callback(link_changed_callback); - - ethernet_init(); - - //eth_mac->speed = 4; // FIXME hardcode mac speed to 1000 - - // kick off a receive - bp_receive_to_buf(2, PORT_ETH, 1, 0, 511); - - while(1){ - // u2_eth_packet_t pkt; - - new_leds = 0; - if (link_is_up) - new_leds = 0x2; - - if ((buffer_pool_status->status & (BPS_DONE_2|BPS_ERROR_2)) != 0){ - // we've got a packet! - -#if 0 - // copy to stack buffer so we can byte address it - memcpy_wa(&pkt, (void *)buffer_ram(2), sizeof(pkt)); - - putstr("Rx: src: "); - print_mac_addr(pkt.ehdr.dst_addr); - putstr(" dst: "); - print_mac_addr(pkt.ehdr.src_addr); - putstr(" ethtype: "); - puthex16(pkt.ehdr.ethertype); - putstr(" len: "); - int len = (buffer_pool_status->last_line[2] + 1) * 4; - puthex16_nl(len); -#else - volatile int *bp = buffer_ram(2); - int i; - for (i = 0; i < 16; i++){ - puthex8(i); - putchar(':'); - puthex32_nl(bp[i]); - } -#endif - - // kick off next receive - bp_clear_buf(2); - bp_receive_to_buf(2, PORT_ETH, 1, 0, 511); - - peak_hold_count = 2048 * 10; - } - - if (peak_hold_count > 0){ - peak_hold_count--; - new_leds |= 0x1; - } - - if (new_leds != prev_leds){ - prev_leds = new_leds; - output_regs->leds = new_leds; - } - } - - hal_finish(); - return 1; -} diff --git a/usrp2/firmware/apps/read_dbids.c b/usrp2/firmware/apps/read_dbids.c deleted file mode 100644 index 4caabd885..000000000 --- a/usrp2/firmware/apps/read_dbids.c +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#include <nonstdio.h> -#include <u2_init.h> -#include <bool.h> -#include <usrp2_i2c_addr.h> -#include <i2c.h> - - -int main(void) -{ - u2_init(); - - puts("\nread_dbids"); - - unsigned char dbid_tx[2]; - unsigned char dbid_rx[2]; - bool ok; - - ok = eeprom_read(I2C_ADDR_TX_A, 1, dbid_tx, 2); - if (!ok){ - puts("failed to read Tx Daugherboard EEPROM"); - } - else { - putstr("Tx Daugherboard ID: "); - puthex8(dbid_tx[1]); // MSB - puthex8(dbid_tx[0]); // LSB - newline(); - } - - ok = eeprom_read(I2C_ADDR_RX_A, 1, dbid_rx, 2); - if (!ok){ - puts("failed to read Rx Daugherboard EEPROM"); - } - else { - putstr("Rx Daugherboard ID: "); - puthex8(dbid_rx[1]); // MSB - puthex8(dbid_rx[0]); // LSB - newline(); - } - - return 0; -} diff --git a/usrp2/firmware/apps/sd_bounce.c b/usrp2/firmware/apps/sd_bounce.c deleted file mode 100644 index 30e3e3fc5..000000000 --- a/usrp2/firmware/apps/sd_bounce.c +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright 2007,2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -/* - * Loopback SERDES to SERDES - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include "u2_init.h" -#include "memory_map.h" -#include "spi.h" -#include "hal_io.h" -#include "buffer_pool.h" -#include "pic.h" -#include "bool.h" -#include "nonstdio.h" -#include "memset_wa.h" -#include <dbsm.h> -#include <stddef.h> -#include <stdlib.h> -#include <string.h> -#include <clocks.h> - - - -// ---------------------------------------------------------------- - -#define SERDES_RX_BUF_0 0 -#define SERDES_RX_BUF_1 1 - -/* - * ================================================================ - * configure SD RX double buffering state machine - * ================================================================ - */ - -// receive from SERDES -buf_cmd_args_t sd_recv_args = { - PORT_SERDES, - 0, - BP_LAST_LINE -}; - -// send to SERDES -buf_cmd_args_t sd_send_args = { - PORT_SERDES, - 0, // starts with packet in line 0 - 0, // filled in from list_line register -}; - -dbsm_t sd_sm; // the state machine - - - - -// ---------------------------------------------------------------- - -#if 0 -static bool -check_packet(int *buf, int nlines) -{ - bool ok = true; - int i = 0; - for (i = 0; i < nlines; i++){ - int expected = ((2*i + 0) << 16) | (2*i+1); - if (buf[i] != expected){ - ok = false; - printf("buf[%d] = 0x%x expected = 0x%x\n", i, buf[i], expected); - } - } - return ok; -} - -static void -zero_buffer(int bufno) -{ - memset_wa(buffer_ram(bufno), 0, BP_NLINES * 4); -} -#endif - - -bool -sd_rx_inspector(dbsm_t *sm, int buf_this) -{ - hal_toggle_leds(0x2); - -#if 0 - int last_line = buffer_pool_status->last_line[buf_this]; - bool ok = check_packet(buffer_ram(buf_this), last_line); - static int good = 0; - static int bad = 0; - - if (ok) - good++; - else - bad++; - - if(good+bad == 10000) { - printf("Good %d\tBad %d\n",good,bad); - good = 0; - bad = 0; - } -#endif - - return false; -} - - -inline static void -buffer_irq_handler(void) -{ - uint32_t status = buffer_pool_status->status; - dbsm_process_status(&sd_sm, status); -} - - -int -main(void) -{ - u2_init(); - - putstr("\nsd_bounce\n"); - - // Get our clock from the mimo interface - clocks_mimo_config(MC_WE_LOCK_TO_MIMO); - - dbsm_init(&sd_sm, SERDES_RX_BUF_0, - &sd_recv_args, &sd_send_args, - sd_rx_inspector); - - // kick off the state machine - dbsm_start(&sd_sm); - - while(1){ - buffer_irq_handler(); - } -} diff --git a/usrp2/firmware/apps/sd_gentest.c b/usrp2/firmware/apps/sd_gentest.c deleted file mode 100644 index 4824f03f5..000000000 --- a/usrp2/firmware/apps/sd_gentest.c +++ /dev/null @@ -1,269 +0,0 @@ -/* - * Copyright 2007,2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include "u2_init.h" -#include "memory_map.h" -#include "spi.h" -#include "hal_io.h" -#include "buffer_pool.h" -#include "pic.h" -#include "bool.h" -#include "nonstdio.h" -#include "memset_wa.h" -#include <stddef.h> -#include <stdlib.h> -#include <string.h> -#include <clocks.h> -#include <mdelay.h> - -// ---------------------------------------------------------------- - -int packet_number = 0; -volatile bool send_packet_now = 0; - -#define SERDES_TX_BUF 0 -#define SERDES_RX_BUF 1 - - -#define NLINES_PER_PKT 380 - - -// ---------------------------------------------------------------- - -//static int timer_delta = (int)(MASTER_CLK_RATE * 100e-6); -static int timer_delta = 1000000; // .01 second - -void -timer_irq_handler(unsigned irq) -{ - hal_set_timeout(timer_delta); // schedule next timeout - send_packet_now = true; -} - - -static void -init_packet(int *buf) -{ - int i = 0; - for (i = 0; i < BP_NLINES; i++){ - buf[i] = ((2*i + 0) << 16) | (2*i+1); - } -} - -static bool -check_packet(int *buf, int nlines) -{ - bool ok = true; - int i = 0; - for (i = 0; i < nlines; i++){ - int expected = ((2*i + 0) << 16) | (2*i+1); - if (buf[i] != expected){ - ok = false; - printf("buf[%d] = 0x%x expected = 0x%x\n", i, buf[i], expected); - } - } - return ok; -} - -static void -zero_buffer(int bufno) -{ - memset_wa(buffer_ram(bufno), 0, BP_NLINES * 4); -} - -static void -init_packets(void) -{ - // init just the one we're using - init_packet(buffer_ram(SERDES_TX_BUF)); -} - -int -main(void) -{ - u2_init(); - - // We're free running and provide clock to the MIMO interface - clocks_mimo_config(MC_WE_DONT_LOCK | MC_PROVIDE_CLK_TO_MIMO); - - - // setup tx gpio bits for GPIOM_FPGA_1 -- fpga debug output - // output_regs->debug_mux_ctrl = 1; - // hal_gpio_set_sels(GPIO_TX_BANK, "1111111111111111"); - // hal_gpio_set_sels(GPIO_RX_BANK, "1111111111111111"); - - putstr("\nsd_gentest\n"); - - // Set up serdes (already enabled) - //output_regs->serdes_ctrl = (SERDES_ENABLE | SERDES_RXEN | SERDES_LOOPEN); - //output_regs->serdes_ctrl = (SERDES_ENABLE | SERDES_RXEN); - - init_packets(); - - // pic_register_handler(IRQ_TIMER, timer_irq_handler); - - //if (hwconfig_simulation_p()) - // timer_delta = sim_timer_delta; - - // start a receive from sd - zero_buffer(SERDES_RX_BUF); - bp_receive_to_buf(SERDES_RX_BUF, PORT_SERDES, 1, 0, BP_LAST_LINE); - - // fire off the first packet - bp_send_from_buf(SERDES_TX_BUF, PORT_SERDES, 1, 0, NLINES_PER_PKT); - hal_set_timeout(timer_delta); - int ready_to_send = 0; - - int counter __attribute__((unused)) = 0; - int sent = 1; - int txerr = 0; - int rxerr = 0; - int rcvd = 0; - int rxcrc = 0; - int sent_acc = 0; - int txerr_acc = 0; - int rxerr_acc = 0; - int rcvd_acc = 0; - int rxcrc_acc = 0; - -#define EXPECTING_PKT() ((counter & 0x1) == 0) -#define SEND_PKT() ((counter & 0x1) != 0) - - bool got_packet = false; - - while(1){ - uint32_t status = buffer_pool_status->status; - - if (status & (BPS_DONE(SERDES_RX_BUF))){ - bp_clear_buf(SERDES_RX_BUF); - got_packet = true; - - //hal_toggle_leds(0x2); - - // check packet - int last_line = buffer_pool_status->last_line[SERDES_RX_BUF]-1; - bool ok = check_packet(buffer_ram(SERDES_RX_BUF), last_line); - - if (ok) { - rcvd++; - //putchar('r'); - } - else { - rcvd++; - rxcrc++; - //putchar('P'); - } - // start a receive from sd - zero_buffer(SERDES_RX_BUF); - bp_receive_to_buf(SERDES_RX_BUF, PORT_SERDES, 1, 0, BP_LAST_LINE); - } - - if (status & (BPS_ERROR(SERDES_RX_BUF))){ - bp_clear_buf(SERDES_RX_BUF); - got_packet = true; - rcvd++; - rxerr++; - //putchar('E'); - - // start a receive from sd - zero_buffer(SERDES_RX_BUF); - bp_receive_to_buf(SERDES_RX_BUF, PORT_SERDES, 1, 0, BP_LAST_LINE); - } - - if (status & (BPS_DONE(SERDES_TX_BUF))){ - bp_clear_buf(SERDES_TX_BUF); - //putchar('t'); - bp_send_from_buf(SERDES_TX_BUF, PORT_SERDES, 1, 0, NLINES_PER_PKT); - //mdelay(1); - int i; - for (i = 0; i < 50; i++){ - asm volatile ("or r0, r0, r0\n\ - or r0, r0, r0\n \ - or r0, r0, r0\n \ - or r0, r0, r0\n \ - or r0, r0, r0\n \ - or r0, r0, r0\n \ - or r0, r0, r0\n"); - } - sent ++; - ready_to_send = 1; - //hal_toggle_leds(0x1); - } - - if (status & BPS_ERROR(SERDES_TX_BUF)){ - bp_clear_buf(SERDES_TX_BUF); - sent++; - txerr++; - ready_to_send = 1; - //putchar('X'); - } - - if(sent >=1000) { - printf("Status\tSENT %d\tTXERR %d\t",sent,txerr); - printf("RX %d\tERR %d\tCRC %d\tMISSED %d\n",rcvd, rxerr, rxcrc, sent-rcvd); - sent_acc += sent; sent = 0; - txerr_acc += txerr; txerr = 0; - rcvd_acc += rcvd; rcvd = 0; - rxerr_acc += rxerr; rxerr = 0; - rxcrc_acc += rxcrc; rxcrc = 0; - } - - if(sent_acc >=10000) { - printf("\nOverall\tSENT %d\tTXERR %d\t",sent_acc,txerr_acc); - printf("RX %d\tERR %d\tCRC %d\tMISSED %d\n\n",rcvd_acc, rxerr_acc, rxcrc_acc, sent_acc-rcvd_acc); - sent_acc = 0; - txerr_acc = 0; - rcvd_acc = 0; - rxerr_acc = 0; - rxcrc_acc = 0; - } -#if 0 - int pending = pic_regs->pending; - if (pending & PIC_TIMER_INT){ - hal_set_timeout(timer_delta); - - /* - if (EXPECTING_PKT()){ - if (!got_packet) - putchar('T'); - got_packet = false; - } - - if (SEND_PKT()){ - if (status & BPS_IDLE(SERDES_TX_BUF)) - bp_send_from_buf(SERDES_TX_BUF, PORT_SERDES, 1, 0, NLINES_PER_PKT); - } - counter++; - */ - - putchar('T'); - if(ready_to_send) { - bp_send_from_buf(SERDES_TX_BUF, PORT_SERDES, 1, 0, NLINES_PER_PKT); - counter++; - ready_to_send = 0; - } - - pic_regs->pending = PIC_TIMER_INT; // clear pending interrupt - } -#endif - } - - return 0; -} diff --git a/usrp2/firmware/apps/serdes_to_dsp.c b/usrp2/firmware/apps/serdes_to_dsp.c deleted file mode 100644 index a9876d99b..000000000 --- a/usrp2/firmware/apps/serdes_to_dsp.c +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright 2007,2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "u2_init.h" -#include "memory_map.h" -#include "spi.h" -#include "hal_io.h" -#include "buffer_pool.h" -#include "pic.h" -#include "bool.h" -#include "ethernet.h" -#include "nonstdio.h" -#include "usrp2_eth_packet.h" -#include "dbsm.h" -#include "app_common.h" -#include <stddef.h> -#include <stdlib.h> -#include <string.h> - - -/* - * This program can respond to queries from the host - * and stream rx samples. - * - * Buffer 1 is used by the cpu to send frames to the host. - * Buffers 2 and 3 are used to double-buffer the DSP Rx to eth flow - * Buffers 4 and 5 are used to double-buffer the eth to DSP Tx eth flow - */ -//#define CPU_RX_BUF 0 // eth -> cpu -//#define CPU_TX_BUF 1 // cpu -> eth - -#define DSP_RX_BUF_0 2 // dsp rx -> eth (double buffer) -#define DSP_RX_BUF_1 3 // dsp rx -> eth -#define DSP_TX_BUF_0 4 // eth -> dsp tx (double buffer) -#define DSP_TX_BUF_1 5 // eth -> dsp tx - -/* - * ================================================================ - * configure DSP TX double buffering state machine - * ================================================================ - */ - -// 4 lines of ethernet hdr + 1 line transport hdr + 2 lines (word0 + timestamp) -// DSP Tx reads word0 (flags) + timestamp followed by samples - -#define DSP_TX_FIRST_LINE ((sizeof(u2_eth_hdr_t) + sizeof(u2_transport_hdr_t))/4) - -// Receive from ethernet -buf_cmd_args_t dsp_tx_recv_args = { - PORT_SERDES, - 0, - BP_LAST_LINE -}; - -// send to DSP Tx -buf_cmd_args_t dsp_tx_send_args = { - PORT_DSP, - DSP_TX_FIRST_LINE, // starts just past transport header - 0 // filled in from last_line register -}; - -dbsm_t dsp_tx_sm; // the state machine - - -// ---------------------------------------------------------------- - - -// The mac address of the host we're sending to. -u2_mac_addr_t host_mac_addr; - - -void -start_rx_cmd(const u2_mac_addr_t *host, op_start_rx_t *p) -{ -} - -void -stop_rx_cmd(void) -{ -} - -static void -setup_tx() -{ - dsp_tx_regs->clear_state = 1; - bp_clear_buf(DSP_TX_BUF_0); - bp_clear_buf(DSP_TX_BUF_1); - - int tx_scale = 256; - int interp = 32; - - op_config_tx_t def_config; - memset(&def_config, 0, sizeof(def_config)); - def_config.phase_inc = 408021893; // 9.5 MHz [2**32 * fc/fsample] - def_config.scale_iq = (tx_scale << 16) | tx_scale; - def_config.interp = interp; - - // setup Tx DSP regs - config_tx_cmd(&def_config); -} - - -inline static void -buffer_irq_handler(unsigned irq) -{ - //hal_toggle_leds(0x2); - - uint32_t status = buffer_pool_status->status; - - dbsm_process_status(&dsp_tx_sm, status); - - if (status & BPS_DONE(CPU_TX_BUF)){ - bp_clear_buf(CPU_TX_BUF); - } -} - -int -main(void) -{ - u2_init(); - - // Get our clock from the mimo interface - - clocks_enable_test_clk(true,1); - clocks_mimo_config(MC_WE_LOCK_TO_MIMO); - - // setup tx gpio bits for GPIOM_FPGA_1 -- fpga debug output - //hal_gpio_set_sels(GPIO_TX_BANK, "1111111111111111"); - //hal_gpio_set_sels(GPIO_RX_BANK, "1111111111111111"); - - putstr("\nserdes_to_dsp\n"); - - ethernet_register_link_changed_callback(link_changed_callback); - ethernet_init(); - - - // initialize double buffering state machine for ethernet -> DSP Tx - - dbsm_init(&dsp_tx_sm, DSP_TX_BUF_0, - &dsp_tx_recv_args, &dsp_tx_send_args, - eth_pkt_inspector); - - // program tx registers - setup_tx(); - - // kick off the state machine - dbsm_start(&dsp_tx_sm); - - while(1){ - buffer_irq_handler(0); - - int pending = pic_regs->pending; // poll for under or overrun - - if (pending & PIC_UNDERRUN_INT){ - dbsm_handle_tx_underrun(&dsp_tx_sm); - pic_regs->pending = PIC_UNDERRUN_INT; // clear interrupt - putchar('U'); - } - } -} - diff --git a/usrp2/firmware/apps/serdes_txrx.c b/usrp2/firmware/apps/serdes_txrx.c deleted file mode 100644 index aa4a3f33c..000000000 --- a/usrp2/firmware/apps/serdes_txrx.c +++ /dev/null @@ -1,372 +0,0 @@ -/* - * Copyright 2007,2008,2009 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "u2_init.h" -#include "memory_map.h" -#include "spi.h" -#include "hal_io.h" -#include "buffer_pool.h" -#include "pic.h" -#include "bool.h" -#include "ethernet.h" -#include "nonstdio.h" -#include "usrp2_eth_packet.h" -#include "dbsm.h" -#include "app_common_v2.h" -#include "memcpy_wa.h" -#include "clocks.h" -#include <stddef.h> -#include <stdlib.h> -#include <string.h> - - -#define FW_SETS_SEQNO 1 // define to 0 or 1 (FIXME must be 1 for now) - -#if (FW_SETS_SEQNO) -static int fw_seqno; // used when f/w is filling in sequence numbers -#endif - - -/* - * Full duplex Tx and Rx between serdes and DSP pipelines - * - * Buffer 1 is used by the cpu to send frames to the host. - * Buffers 2 and 3 are used to double-buffer the DSP Rx to serdes flow - * Buffers 4 and 5 are used to double-buffer the serdes to DSP Tx flow - */ -//#define CPU_RX_BUF 0 // eth -> cpu - -#define DSP_RX_BUF_0 2 // dsp rx -> serdes (double buffer) -#define DSP_RX_BUF_1 3 // dsp rx -> serdes -#define DSP_TX_BUF_0 4 // serdes -> dsp tx (double buffer) -#define DSP_TX_BUF_1 5 // serdes -> dsp tx - -/* - * ================================================================== - * configure DSP TX double buffering state machine (serdes -> dsp) - * ================================================================== - */ - -// 4 lines of ethernet hdr + 1 line transport hdr + 2 lines (word0 + timestamp) -// DSP Tx reads word0 (flags) + timestamp followed by samples - -#define DSP_TX_FIRST_LINE ((sizeof(u2_eth_hdr_t) + sizeof(u2_transport_hdr_t))/4) - -// Receive from serdes -buf_cmd_args_t dsp_tx_recv_args = { - PORT_SERDES, - 0, - BP_LAST_LINE -}; - -// send to DSP Tx -buf_cmd_args_t dsp_tx_send_args = { - PORT_DSP, - DSP_TX_FIRST_LINE, // starts just past transport header - 0 // filled in from last_line register -}; - -dbsm_t dsp_tx_sm; // the state machine - -/* - * ================================================================= - * configure DSP RX double buffering state machine (dsp -> serdes) - * ================================================================= - */ - -// 4 lines of ethernet hdr + 1 line transport hdr + 1 line (word0) -// DSP Rx writes timestamp followed by nlines_per_frame of samples -#define DSP_RX_FIRST_LINE ((sizeof(u2_eth_hdr_t) + sizeof(u2_transport_hdr_t))/4 + 1) - -// receive from DSP -buf_cmd_args_t dsp_rx_recv_args = { - PORT_DSP, - DSP_RX_FIRST_LINE, - BP_LAST_LINE -}; - -// send to serdes -buf_cmd_args_t dsp_rx_send_args = { - PORT_SERDES, - 0, // starts with ethernet header in line 0 - 0, // filled in from list_line register -}; - -dbsm_t dsp_rx_sm; // the state machine - - -// The mac address of the host we're sending to. -u2_mac_addr_t host_mac_addr; - - -// variables for streaming mode - -static bool streaming_p = false; -static unsigned int streaming_items_per_frame = 0; -static int streaming_frame_count = 0; -#define FRAMES_PER_CMD 1000 - -bool is_streaming(void){ return streaming_p; } - -// ---------------------------------------------------------------- - - -void -restart_streaming(void) -{ - // setup RX DSP regs - dsp_rx_regs->clear_state = 1; // reset - - streaming_p = true; - streaming_frame_count = FRAMES_PER_CMD; - - dsp_rx_regs->rx_command = - MK_RX_CMD(FRAMES_PER_CMD * streaming_items_per_frame, - streaming_items_per_frame, - 1, 1); // set "chain" bit - - // kick off the state machine - dbsm_start(&dsp_rx_sm); - - dsp_rx_regs->rx_time = 0; // enqueue first of two commands - - // make sure this one and the rest have the "now" and "chain" bits set. - dsp_rx_regs->rx_command = - MK_RX_CMD(FRAMES_PER_CMD * streaming_items_per_frame, - streaming_items_per_frame, - 1, 1); - - dsp_rx_regs->rx_time = 0; // enqueue second command -} - -void -start_rx_streaming_cmd(const u2_mac_addr_t *host, op_start_rx_streaming_t *p) -{ - host_mac_addr = *host; // remember who we're sending to - - /* - * Construct ethernet header and word0 and preload into two buffers - */ - u2_eth_packet_t pkt; - memset(&pkt, 0, sizeof(pkt)); - pkt.ehdr.dst = *host; - pkt.ehdr.src = *ethernet_mac_addr(); - pkt.ehdr.ethertype = U2_ETHERTYPE; - u2p_set_word0(&pkt.fixed, 0, 0); - // DSP RX will fill in timestamp - - memcpy_wa(buffer_ram(DSP_RX_BUF_0), &pkt, sizeof(pkt)); - memcpy_wa(buffer_ram(DSP_RX_BUF_1), &pkt, sizeof(pkt)); - - - if (FW_SETS_SEQNO) - fw_seqno = 0; - - streaming_items_per_frame = p->items_per_frame; - restart_streaming(); -} - -void start_rx_streaming_at_cmd(const u2_mac_addr_t *host, op_start_rx_streaming_t *p, uint32_t time) -{} -void restart_streaming_at(uint32_t time) -{} - -void -stop_rx_cmd(void) -{ - streaming_p = false; - dsp_rx_regs->clear_state = 1; // flush cmd queue - bp_clear_buf(DSP_RX_BUF_0); - bp_clear_buf(DSP_RX_BUF_1); -} - - -static void -setup_tx() -{ - dsp_tx_regs->clear_state = 1; - bp_clear_buf(DSP_TX_BUF_0); - bp_clear_buf(DSP_TX_BUF_1); - - int tx_scale = 256; - int interp = 32; - - // setup some defaults - - dsp_tx_regs->freq = 0; - dsp_tx_regs->scale_iq = (tx_scale << 16) | tx_scale; - dsp_tx_regs->interp_rate = interp; -} - - -#if (FW_SETS_SEQNO) -/* - * Debugging ONLY. This will be handled by the tx_protocol_engine. - * - * This is called when the DSP Rx chain has filled in a packet. - * We set and increment the seqno, then return false, indicating - * that we didn't handle the packet. A bit of a kludge - * but it should work. - */ -bool -fw_sets_seqno_inspector(dbsm_t *sm, int buf_this) // returns false -{ - uint32_t *p = buffer_ram(buf_this); - uint32_t seqno = fw_seqno++; - - // KLUDGE all kinds of nasty magic numbers and embedded knowledge - uint32_t t = p[4]; - t = (t & 0xffff00ff) | ((seqno & 0xff) << 8); - p[4] = t; - - // queue up another rx command when required - if (streaming_p && --streaming_frame_count == 0){ - streaming_frame_count = FRAMES_PER_CMD; - dsp_rx_regs->rx_time = 0; - } - - return false; // we didn't handle the packet -} -#endif - - -inline static void -buffer_irq_handler(unsigned irq) -{ - // hal_toggle_leds(LED_A); - - uint32_t status = buffer_pool_status->status; - - if (0 && (status & ~BPS_IDLE_ALL)){ - putstr("status = "); - puthex32_nl(status); - } - - dbsm_process_status(&dsp_tx_sm, status); - dbsm_process_status(&dsp_rx_sm, status); -} - -int -main(void) -{ - u2_init(); - - output_regs->led_src = 0x3; // h/w controls bottom two bits - clocks_enable_test_clk(true, 1); - - putstr("\nSERDES TxRx\n"); - - cpu_tx_buf_dest_port = PORT_SERDES; - - // ethernet_register_link_changed_callback(link_changed_callback); - // ethernet_init(); - - clocks_mimo_config(MC_WE_LOCK_TO_MIMO); - - // puts("post clocks_mimo_config"); - -#if 0 - // make bit 15 of Tx gpio's be a s/w output - hal_gpio_set_sel(GPIO_TX_BANK, 15, 's'); - hal_gpio_set_ddr(GPIO_TX_BANK, 0x8000, 0x8000); -#endif - -#if 0 - output_regs->debug_mux_ctrl = 1; - hal_gpio_set_sels(GPIO_TX_BANK, "0000000000000000"); - hal_gpio_set_sels(GPIO_RX_BANK, "0000000000000000"); - hal_gpio_set_ddr(GPIO_TX_BANK, 0xffff, 0xffff); - hal_gpio_set_ddr(GPIO_RX_BANK, 0xffff, 0xffff); -#endif - - - // initialize double buffering state machine for ethernet -> DSP Tx - - dbsm_init(&dsp_tx_sm, DSP_TX_BUF_0, - &dsp_tx_recv_args, &dsp_tx_send_args, - eth_pkt_inspector); - - - //output_regs->flush_icache = 1; - - // initialize double buffering state machine for DSP RX -> Ethernet - - if (FW_SETS_SEQNO){ - dbsm_init(&dsp_rx_sm, DSP_RX_BUF_0, - &dsp_rx_recv_args, &dsp_rx_send_args, - fw_sets_seqno_inspector); - } - else { - dbsm_init(&dsp_rx_sm, DSP_RX_BUF_0, - &dsp_rx_recv_args, &dsp_rx_send_args, - dbsm_nop_inspector); - } - - // puts("post dbsm_init's"); - - // tell app_common that this dbsm could be sending to the ethernet - ac_could_be_sending_to_eth = &dsp_rx_sm; - - - // program tx registers - setup_tx(); - - // puts("post setup_tx"); - - // kick off the state machine - dbsm_start(&dsp_tx_sm); - - // puts("post dbsm_start"); - - //int which = 0; - - while(1){ - // hal_gpio_write(GPIO_TX_BANK, which, 0x8000); - // which ^= 0x8000; - - buffer_irq_handler(0); - - int pending = pic_regs->pending; // poll for under or overrun - - if (pending & PIC_UNDERRUN_INT){ - dbsm_handle_tx_underrun(&dsp_tx_sm); - pic_regs->pending = PIC_UNDERRUN_INT; // clear interrupt - putchar('U'); - } - - if (pending & PIC_OVERRUN_INT){ - dbsm_handle_rx_overrun(&dsp_rx_sm); - pic_regs->pending = PIC_OVERRUN_INT; // clear pending interrupt - - // FIXME Figure out how to handle this robustly. - // Any buffers that are emptying should be allowed to drain... - - if (streaming_p){ - // restart_streaming(); - // FIXME report error - } - else { - // FIXME report error - } - putchar('O'); - } - } -} diff --git a/usrp2/firmware/apps/set_hw_rev.c b/usrp2/firmware/apps/set_hw_rev.c deleted file mode 100644 index d4ac8ff81..000000000 --- a/usrp2/firmware/apps/set_hw_rev.c +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ -#include <u2_init.h> -#include <nonstdio.h> -#include <i2c.h> -#include <usrp2_i2c_addr.h> - -#define HW_REV_MAJOR 0 -#define HW_REV_MINOR 3 - -int -main(void) -{ - u2_init(); - - putstr("\nset_hw_rev\n"); - - bool ok = true; - unsigned char maj = HW_REV_MAJOR; - unsigned char min = HW_REV_MINOR; - ok = eeprom_write(I2C_ADDR_MBOARD, MBOARD_REV_MSB, &maj, 1); - ok &= eeprom_write(I2C_ADDR_MBOARD, MBOARD_REV_LSB, &min, 1); - - if (ok) - printf("OK: set h/w rev to %d.%d\n", HW_REV_MAJOR, HW_REV_MINOR); - else - printf("FAILED to set h/w rev to %d.%d\n", HW_REV_MAJOR, HW_REV_MINOR); - - return 0; -} diff --git a/usrp2/firmware/apps/test1.c b/usrp2/firmware/apps/test1.c deleted file mode 100644 index c3cc3be56..000000000 --- a/usrp2/firmware/apps/test1.c +++ /dev/null @@ -1,282 +0,0 @@ -#include "u2_init.h" -#include "memory_map.h" -#include "spi.h" -#include "hal_io.h" -#include "buffer_pool.h" -#include "pic.h" -#include "nonstdio.h" - -// Globals -#define EMPTY 0 -#define FILLING 1 -#define FULL 2 -#define EMPTYING 3 - -#define PORT 2 // ethernet = 2, serdes = 0 -int dsp_rx_buf, dsp_tx_buf, serdes_rx_buf, serdes_tx_buf; -int dsp_rx_idle, dsp_tx_idle, serdes_rx_idle, serdes_tx_idle; - -int buffer_state[4]; - - -void double_buffering(int port); - -// -// We register this in the secondary interrupt vector. -// It's called on buffer manager interrupts -// -void -buffer_irq_handler(unsigned irq) -{ - double_buffering(PORT); -} - -int -main(void) -{ - int i; - - u2_init(); - - // Control LEDs - output_regs->leds = 0x02; - - // Turn on ADCs - output_regs->adc_ctrl = 0x0A; - - // Set up TX Chain - dsp_tx_regs->freq = 0; - dsp_tx_regs->scale_iq = (1 << 16) | 1; - dsp_tx_regs->interp_rate = 8; - - // Set up RX Chain - dsp_rx_regs->freq = 0; - dsp_rx_regs->scale_iq = (1 << 16) | 1; - dsp_rx_regs->decim_rate = 8; - - // Set up buffer control, using only 4 for now - for(i=0;i<4;i++) - buffer_state[i] = EMPTY; - - // Set up DSP RX - buffer_state[0] = FILLING; - serdes_tx_idle = 1; - bp_receive_to_buf(0, 1, 1, 10, 509); // DSP_RX to buffer 0, use 500 lines - - //dsp_rx_regs->run_rx = 1; // Start DSP_RX - putstr("Done DSP RX setup\n"); - - // Set up serdes RX - buffer_state[2] = FILLING; - dsp_tx_idle = 1; - bp_receive_to_buf(2, PORT, 1, 5, 504); - - while (buffer_pool_status->status == 0) // wait for completion of DSP RX - ; - - putstr("Done DSP TX setup\n"); - //dsp_tx_regs->run_tx = 1; - - // register interrupt handler - pic_register_handler(IRQ_BUFFER, buffer_irq_handler); - - while (1) - ; - - hal_finish(); - return 1; -} - -void -double_buffering(int port) { - unsigned int localstatus = buffer_pool_status->status; - - if(localstatus & BPS_DONE_0) { - bp_clear_buf(0); - if(buffer_state[0] == FILLING) { - buffer_state[0] = FULL; - if(buffer_state[1] == EMPTY) { - bp_receive_to_buf(1, 1, 1, 10, 509); // DSP_RX to buffer 1, use 500 lines - buffer_state[1] = FILLING; - } - else - dsp_rx_idle = 1; - if(serdes_tx_idle) { - serdes_tx_idle = 0; - bp_send_from_buf(0, port, 1, 10, 509); // SERDES_TX from buffer 0 - buffer_state[0] = EMPTYING; - } - } - else { // buffer was emptying - buffer_state[0] = EMPTY; - if(dsp_rx_idle) { - dsp_rx_idle = 0; - bp_receive_to_buf(0, 1, 1, 10, 509); // DSP_RX to buffer 0, use 500 lines - buffer_state[0] = FILLING; - } - if(buffer_state[1] == FULL) { - bp_send_from_buf(1, port, 1, 10, 509); // SERDES_TX from buffer 1 - buffer_state[1] = EMPTYING; - } - else - serdes_tx_idle = 1; - } - putstr("Int Proc'ed 0\n"); - } - if(localstatus & BPS_DONE_1) { - bp_clear_buf(1); - if(buffer_state[1] == FILLING) { - buffer_state[1] = FULL; - if(buffer_state[0] == EMPTY) { - bp_receive_to_buf(0, 1, 1, 10, 509); // DSP_RX to buffer 1, use 500 lines - buffer_state[0] = FILLING; - } - else - dsp_rx_idle = 1; - if(serdes_tx_idle) { - serdes_tx_idle = 0; - bp_send_from_buf(1, port, 1, 10, 509); // SERDES_TX from buffer 1 - buffer_state[1] = EMPTYING; - } - } - else { // buffer was emptying - buffer_state[1] = EMPTY; - if(dsp_rx_idle) { - dsp_rx_idle = 0; - bp_receive_to_buf(1, 1, 1, 10, 509); // DSP_RX to buffer 1, use 500 lines - buffer_state[1] = FILLING; - } - if(buffer_state[0] == FULL) { - bp_send_from_buf(0, port, 1, 10, 509); // SERDES_TX from buffer 0 - buffer_state[0] = EMPTYING; - } - else - serdes_tx_idle = 1; - } - putstr("Int Proc'ed 1\n"); - } - if(localstatus & BPS_DONE_2) { - bp_clear_buf(2); - if(buffer_state[2] == FILLING) { - buffer_state[2] = FULL; - if(buffer_state[3] == EMPTY) { - bp_receive_to_buf(3, port, 1, 5, 504); // SERDES_RX to buffer 3, use 500 lines - buffer_state[3] = FILLING; - } - else - serdes_rx_idle = 1; - if(dsp_tx_idle) { - dsp_tx_idle = 0; - bp_send_from_buf(2, 1, 1, 5, 504); // DSP_TX from buffer 2 - buffer_state[2] = EMPTYING; - } - } - else { // buffer was emptying - buffer_state[2] = EMPTY; - if(serdes_rx_idle) { - serdes_rx_idle = 0; - bp_receive_to_buf(2, port, 1, 5, 504); // SERDES_RX to buffer 2 - buffer_state[2] = FILLING; - } - if(buffer_state[3] == FULL) { - bp_send_from_buf(3, 1, 1, 5, 504); // DSP_TX from buffer 3 - buffer_state[3] = EMPTYING; - } - else - dsp_tx_idle = 1; - } - putstr("Int Proc'ed 2\n"); - } - if(localstatus & BPS_DONE_3) { - bp_clear_buf(3); - if(buffer_state[3] == FILLING) { - buffer_state[3] = FULL; - if(buffer_state[2] == EMPTY) { - bp_receive_to_buf(2, port, 1, 5, 504); // SERDES_RX to buffer 2, use 500 lines - buffer_state[2] = FILLING; - } - else - serdes_rx_idle = 1; - if(dsp_tx_idle) { - dsp_tx_idle = 0; - bp_send_from_buf(3, 1, 1, 5, 504); // DSP_TX from buffer 3 - buffer_state[3] = EMPTYING; - } - } - else { // buffer was emptying - buffer_state[3] = EMPTY; - if(serdes_rx_idle) { - serdes_rx_idle = 0; - bp_receive_to_buf(3, port, 1, 5, 504); // SERDES_RX to buffer 3 - buffer_state[3] = FILLING; - } - if(buffer_state[2] == FULL) { - bp_send_from_buf(2, 1, 1, 5, 504); // DSP_TX from buffer 2 - buffer_state[2] = EMPTYING; - } - else - dsp_tx_idle = 1; - } - putstr("Int Proc'ed 3\n"); - } -} - -// Spare Code - -#if 0 - // Set up LSDAC - int i = 0; - while(1) { - int command = (3 << 19) | (0 << 16) | (i & 0xffff); - spi_transact(SPI_TXONLY, SPI_SS_TX_DAC, command, 24, 1); // negate TX phase - i++; - } -#endif - -#if 0 - // Write to buffer 0 - int *buf = (int *)(BUFFER_BASE + BUFFER_0); - puthex_nl((int)buf); - - for(i=0;i<BUFFER_SIZE;i++) - buf[i] = i; - - putstr("Filled buffer 0\n"); - - // Write to buffer 1 - buf = (int *)(BUFFER_BASE + BUFFER_1); - puthex_nl((int)buf); - for(i=0;i<BUFFER_SIZE;i++) - buf[i] = i + ((i^0xFFFF) << 16); - - putstr("Filled buffer 1\n"); - -#endif - -#if 0 - // rx SERDES into buffer #2 (buf,port,step,fl,ll) - bp_receive_to_buf(2, 0, 1, 10, 300); - putstr("SERDES RX buffer setup\n"); - - // send SERDES from buffer #0 (buf,port,step,fl,ll) - bp_send_from_buf(0, 0, 1, 20, 200); - putstr("SERDES TX buffer setup\n"); - -#endif - -#if 0 - // send to DACs from buffer #1 - bp_send_from_buf(1 /*buf#*/, 1 /*port*/, 1 /*step*/, 20 /*fl*/, 250 /*ll*/); - putstr("DAC Buffer setup\n"); -#endif - -#if 0 - //putstr("ENTER INT\n"); - for(i=0;i<8;i++) - if(*status & (1<<i)) { - //putstr("Clearing buf "); - puthex_nl(i); - bp_clear_buf(i); - } - //putstr("EXIT INT\n"); -#endif diff --git a/usrp2/firmware/apps/test_db_spi.c b/usrp2/firmware/apps/test_db_spi.c deleted file mode 100644 index f4fa98ef1..000000000 --- a/usrp2/firmware/apps/test_db_spi.c +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#include <u2_init.h> -#include <nonstdio.h> -#include <hal_io.h> -#include <spi.h> - -int -main(void) -{ - u2_init(); - - puts("\ntest_db_spi"); - - while(1){ - spi_transact(SPI_TXONLY, SPI_SS_RX_DB, 0xCC33, 16, SPIF_PUSH_FALL); - spi_transact(SPI_TXONLY, SPI_SS_TX_DB, 0x33CC, 16, SPIF_PUSH_FALL); - } -} diff --git a/usrp2/firmware/apps/test_i2c.c b/usrp2/firmware/apps/test_i2c.c deleted file mode 100644 index f349ead88..000000000 --- a/usrp2/firmware/apps/test_i2c.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#include <stdio.h> -#include <stdint.h> -#include <u2_init.h> /* FIXME */ -#include <i2c.h> -#include <usrp2_i2c_addr.h> -#include <string.h> -#include <hal_io.h> - - - -#define ASSERT_TRUE(x) \ - do { \ - if (!(x)){ \ - printf("ASSERT_TRUE failed on line %d\n", __LINE__); \ - nerrors++; \ - } \ - } while(0) - -#define ASSERT_FALSE(x) \ - do { \ - if (x){ \ - printf("ASSERT_FALSE failed on line %d\n", __LINE__); \ - nerrors++; \ - } \ - } while(0) - - -#define BUFSIZE 128 - -int -main(void) -{ - int i; - bool ok; - int nerrors = 0; - uint8_t buf[BUFSIZE]; - int not_dev_addr = 0x35; // no device with this address on the i2c bus. - int offset; - int len; - - u2_init(); - - puts("test_i2c\n"); - - // try writing a non-existent device - buf[0] = 0xA5; - ok = i2c_write(not_dev_addr, buf, 1); - ASSERT_FALSE(ok); - - // try read from non-existent device - buf[0] = 0; - ok = i2c_read(not_dev_addr, buf, 1); - ASSERT_FALSE(ok); - - // try writing eeprom - offset = 31; - len = 8; - memset(buf, 0, sizeof(buf)); - for (i = 0; i < len; i++) - buf[i] = i; - ok = eeprom_write(I2C_ADDR_MBOARD, offset, buf, len); - ASSERT_TRUE(ok); - - // now try to read it back - offset = 31; - len = 8; - memset(buf, 0, sizeof(buf)); - ok = eeprom_read(I2C_ADDR_MBOARD, offset, buf, len); - ASSERT_TRUE(ok); - - // check result - for (i = 0; i < len; i++){ - if (buf[i] != i){ - printf("buf[%d] = %d, should be %d\n", i, buf[i], i); - nerrors++; - } - } - - if (nerrors == 0){ - output_regs->leds = 0x3; - puts("PASSED\n"); - } - else { - output_regs->leds = 0x0; - puts("FAILED\n"); - } - - hal_finish(); - return 0; -} - diff --git a/usrp2/firmware/apps/test_lsadc.c b/usrp2/firmware/apps/test_lsadc.c deleted file mode 100644 index 5fda29cd7..000000000 --- a/usrp2/firmware/apps/test_lsadc.c +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#include <lsadc.h> -#include <lsdac.h> -#include <u2_init.h> -#include <nonstdio.h> -#include <hal_io.h> - -int -main(void) -{ - u2_init(); - - puts("\ntest_lsadc"); - - uint32_t r; - - unsigned int up_counter = 0; - - while (1){ - unsigned int v; - v = up_counter; - - lsdac_write_rx(0, v << 0); - lsdac_write_rx(2, v << 1); - -#if 1 - r = lsadc_read_rx(0); - lsdac_write_rx(1, r & 0x0fff); - //puthex32_nl(r); -#endif - -#if 1 - r = lsadc_read_rx(1); - lsdac_write_rx(3, r & 0x0fff); - //puthex32_nl(r); -#endif - - up_counter++; - } -} diff --git a/usrp2/firmware/apps/test_lsdac.c b/usrp2/firmware/apps/test_lsdac.c deleted file mode 100644 index 8c1bf333b..000000000 --- a/usrp2/firmware/apps/test_lsdac.c +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#include <lsdac.h> -#include <u2_init.h> -#include <nonstdio.h> -#include <hal_io.h> - -int -main(void) -{ - u2_init(); - - puts("\ntest_lsdac"); - - unsigned int up_counter = 0; - unsigned int dn_counter = 0; - - while(1){ - unsigned int v; - v = up_counter; - lsdac_write_rx(0, v << 0); - lsdac_write_rx(1, v << 1); - lsdac_write_rx(2, v << 2); - lsdac_write_rx(3, v << 3); - - v = up_counter; - lsdac_write_tx(0, v << 0); - lsdac_write_tx(1, v << 1); - lsdac_write_tx(2, v << 2); - lsdac_write_tx(3, v << 3); - - up_counter++; - dn_counter--; - } -} diff --git a/usrp2/firmware/apps/test_phy_comm.c b/usrp2/firmware/apps/test_phy_comm.c deleted file mode 100644 index 7242c6fc8..000000000 --- a/usrp2/firmware/apps/test_phy_comm.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -// check communication with ethernet PHY chip - -#include "u2_init.h" -#include "memory_map.h" -#include "hal_io.h" -#include "ethernet.h" -#include "pic.h" -#include "nonstdio.h" - - -#define DELTA_T 12500000 // .125s (10ns per tick) -//#define DELTA_T 10000 - -// debugging output on tx pins -#define LS_MASK 0xE0000 -#define LS_1000 0x80000 -#define LS_100 0x40000 -#define LS_10 0x20000 - - - -#define U2_ETHERTYPE 0xBEEF - - -static volatile int led_link_up_flag = 0; - -/* - * Called when eth phy state changes (w/ interrupts disabled) - */ -void -link_changed_callback(int speed) -{ - int v = 0; - switch(speed){ - case 10: - v = LS_10; - led_link_up_flag = 0x2; - break; - - case 100: - v = LS_100; - led_link_up_flag = 0x2; - break; - - case 1000: - v = LS_100; - led_link_up_flag = 0x2; - break; - - default: - v = 0; - led_link_up_flag = 0; - break; - } - - //hal_gpio_set_tx(v, LS_MASK); /* set debug bits on d'board */ - - putstr("\neth link changed: speed = "); - puthex_nl(speed); -} - -void -timer_handler(unsigned irq) -{ - static int led_counter = 0; - - hal_set_timeout(DELTA_T); // schedule next timeout - output_regs->leds = (led_counter++ & 0x1) | led_link_up_flag; -} - -int -main(void) -{ - u2_init(); - - putstr("\n test_phy_comm\n"); - - pic_register_handler(IRQ_TIMER, timer_handler); - hal_set_timeout(DELTA_T); // schedule timeout - - // setup tx gpio bits for GPIOM_FPGA_1 -- fpga debug output - //hal_gpio_set_sels(GPIO_TX_BANK, "1111111111111111"); - //hal_gpio_set_sels(GPIO_RX_BANK, "1111111111111111"); - - ethernet_register_link_changed_callback(link_changed_callback); - - output_regs->phy_ctrl = 1; /* reset the eth PHY */ - output_regs->phy_ctrl = 0; - - ethernet_init(); - - while(1) - ; - - return 0; -} diff --git a/usrp2/firmware/apps/test_ram.c b/usrp2/firmware/apps/test_ram.c deleted file mode 100644 index 77ee693f6..000000000 --- a/usrp2/firmware/apps/test_ram.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#include <stdio.h> -#include <stdint.h> -#include <u2_init.h> /* FIXME */ -#include <sd.h> -#include <string.h> -#include <hal_io.h> -#include <nonstdio.h> -#include <hal_uart.h> - -#define ASSERT_TRUE(x) \ - do { \ - if (!(x)){ \ - printf("ASSERT_TRUE failed on line %d\n", __LINE__); \ - nerrors++; \ - } \ - } while(0) - -#define ASSERT_FALSE(x) \ - do { \ - if (x){ \ - printf("ASSERT_FALSE failed on line %d\n", __LINE__); \ - nerrors++; \ - } \ - } while(0) - - -#define BUFSIZE 128 - -int test_ram() -{ - int i,j,k; - output_regs->ram_page = 1<<10; - - extram[0] = 0xDEADBEEF; - extram[1] = 0xF00D1234; - extram[7] = 0x76543210; - - output_regs->ram_page = 2<<10; - extram[7] = 0x55555555; - extram[1] = 0xaaaaaaaa; - extram[0] = 0xeeeeeeee; - - output_regs->ram_page = 1<<10; - - i = extram[0]; - k = extram[1]; - j = extram[7]; - - if((i != 0xDEADBEEF)||(j!=0x76543210)||(k!=0xF00D1234)) { - puts("RAM FAIL1!\n"); - puthex32_nl(i); - puthex32_nl(j); - puthex32_nl(k); - return 0; - } - - output_regs->ram_page = 2<<10; - - j = extram[7]; - k = extram[1]; - i = extram[0]; - - if((i != 0xeeeeeeee)||(j!=0x55555555)||(k!=0xaaaaaaaa)) { - puts("RAM FAIL2!\n"); - puthex32_nl(i); - puthex32_nl(j); - puthex32_nl(k); - return 0; - } - return 1; -} - -int -main(void) -{ - - u2_init(); - puts("\ntest_ram\n"); - int success = test_ram(); - if(success) - puts("RAM Passed Tests\n"); - else - puts("RAM Failed\n"); - - hal_finish(); - return 0; -} - diff --git a/usrp2/firmware/apps/test_sd.c b/usrp2/firmware/apps/test_sd.c deleted file mode 100644 index 494432d7f..000000000 --- a/usrp2/firmware/apps/test_sd.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#include <stdio.h> -#include <stdint.h> -#include <u2_init.h> /* FIXME */ -#include <sd.h> -#include <string.h> -#include <hal_io.h> -#include <nonstdio.h> - - -#define ASSERT_TRUE(x) \ - do { \ - if (!(x)){ \ - printf("ASSERT_TRUE failed on line %d\n", __LINE__); \ - nerrors++; \ - } \ - } while(0) - -#define ASSERT_FALSE(x) \ - do { \ - if (x){ \ - printf("ASSERT_FALSE failed on line %d\n", __LINE__); \ - nerrors++; \ - } \ - } while(0) - - -#define BUFSIZE 128 - -int -main(void) -{ - int i; - unsigned char buf[512]; - - u2_init(); - - puts("\ntest_sd\n"); - - - i = sd_init(); - if(i) - puts("Successfully Init'ed Card\n"); - else - puts("FAILED INIT of Card\n"); - - i = sd_read_block(2048,buf); - if(i) { - puts("READ Command accepted\n"); - for(i=0;i<512;i++) - if((i&15) == 15) - puthex8_nl(buf[i]); - else { - puthex8(buf[i]); - putchar(' '); - } - } - else - puts("READ Command Rejected\n"); - - puts("Done"); - hal_finish(); - return 0; -} - diff --git a/usrp2/firmware/apps/timer_test.c b/usrp2/firmware/apps/timer_test.c deleted file mode 100644 index 7c1e46440..000000000 --- a/usrp2/firmware/apps/timer_test.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#include "u2_init.h" -#include "memory_map.h" -#include "hal_io.h" -#include "buffer_pool.h" -#include "pic.h" -#include "nonstdio.h" - - -#define DELTA_T 500 // 5 us (10ns per tick) - - -void -timer_handler(unsigned irq) -{ - int t = timer_regs->time; - timer_regs->time = t + DELTA_T; - - putstr("Tick: "); - puthex_nl(t); -} - -int -main(void) -{ - u2_init(); - - // setup timer - - putstr("Setting up timer\n"); - pic_register_handler(IRQ_TIMER, timer_handler); - - int t = timer_regs->time; - timer_regs->time = t + DELTA_T; - - while (1) - ; - - putstr("Done Testing\n"); - - hal_finish(); - return 1; -} diff --git a/usrp2/firmware/apps/tx_standalone.c b/usrp2/firmware/apps/tx_standalone.c deleted file mode 100644 index 6350a6956..000000000 --- a/usrp2/firmware/apps/tx_standalone.c +++ /dev/null @@ -1,339 +0,0 @@ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "u2_init.h" -#include "memory_map.h" -#include "spi.h" -#include "hal_io.h" -#include "buffer_pool.h" -#include "pic.h" -#include "bool.h" -#include "ethernet.h" -#include "nonstdio.h" -#include "usrp2_eth_packet.h" -#include "memcpy_wa.h" -#include "dbsm.h" -#include <stddef.h> -#include <stdlib.h> -#include <string.h> - -#define _AL4 __attribute__((aligned (4))) - -#define USE_BUFFER_INTERRUPT 0 // 0 or 1 - - -static int timer_delta = MASTER_CLK_RATE/1000; // tick at 1kHz - -/* - * This program can respond to queries from the host - * and stream rx samples. - * - * Buffer 1 is used by the cpu to send frames to the host. - * Buffers 2 and 3 are used to double-buffer the DSP Rx to eth flow - * Buffers 4 and 5 are used to double-buffer the eth to DSP Tx eth flow - */ -//#define CPU_RX_BUF 0 // eth -> cpu -#define CPU_TX_BUF 1 // cpu -> eth - -#define DSP_RX_BUF_0 2 // dsp rx -> eth (double buffer) -#define DSP_RX_BUF_1 3 // dsp rx -> eth -#define DSP_TX_BUF_0 4 // eth -> dsp tx (double buffer) -#define DSP_TX_BUF_1 5 // eth -> dsp tx - - -/* - * ================================================================ - * configure DSP RX double buffering state machine - * ================================================================ - */ - - -// 4 lines of ethernet hdr + 1 line (word0) -// DSP Rx writes timestamp followed by nlines_per_frame of samples -#define DSP_RX_FIRST_LINE 5 -#define DSP_RX_SAMPLES_PER_FRAME 128 -#define DSP_RX_EXTRA_LINES 1 // writes timestamp - -// Receive from DSP Rx -buf_cmd_args_t dsp_rx_recv_args = { - PORT_DSP, - DSP_RX_FIRST_LINE, - BP_LAST_LINE -}; - -// send to ethernet -buf_cmd_args_t dsp_rx_send_args = { - PORT_ETH, - 0, // starts with ethernet header in line 0 - 0, // filled in from last_line register -}; - -dbsm_t dsp_rx_sm; // the state machine - -/* - * ================================================================ - * configure DSP TX double buffering state machine - * ================================================================ - */ - -// 4 lines of ethernet hdr + 2 lines (word0 + timestamp) -// DSP Tx reads word0 (flags) + timestamp followed by samples - -#define DSP_TX_FIRST_LINE 4 -#define DSP_TX_SAMPLES_PER_FRAME 250 // not used except w/ debugging -#define DSP_TX_EXTRA_LINES 2 // reads word0 + timestamp - -// Receive from ethernet -buf_cmd_args_t dsp_tx_recv_args = { - PORT_ETH, - 0, - BP_LAST_LINE -}; - -// send to DSP Tx -buf_cmd_args_t dsp_tx_send_args = { - PORT_DSP, - DSP_TX_FIRST_LINE, // starts just past ethernet header - 0 // filled in from last_line register -}; - -dbsm_t dsp_tx_sm; // the state machine - -/* - * send constant buffer to DSP TX - */ -static inline void -SEND_CONST_TO_DSP_TX(void) -{ - bp_send_from_buf(DSP_TX_BUF_0, PORT_DSP, 1, - DSP_TX_FIRST_LINE, - DSP_TX_FIRST_LINE + DSP_TX_EXTRA_LINES + DSP_TX_SAMPLES_PER_FRAME - 1); -} - -// ---------------------------------------------------------------- - - - -// The mac address of the host we're sending to. -u2_mac_addr_t host_mac_addr; - - -void link_changed_callback(int speed); -static volatile bool link_is_up = false; // eth handler sets this - - -void -timer_irq_handler(unsigned irq) -{ - hal_set_timeout(timer_delta); // schedule next timeout -} - -// Tx DSP underrun -void -underrun_irq_handler(unsigned irq) -{ - dsp_tx_regs->clear_state = 1; - bp_clear_buf(DSP_TX_BUF_0); - bp_clear_buf(DSP_TX_BUF_1); - dbsm_stop(&dsp_tx_sm); - - // FIXME anything else? - - putstr("\nirq: underrun\n"); -} - -// Rx DSP overrun -void -overrun_irq_handler(unsigned irq) -{ - dsp_rx_regs->clear_state = 1; - bp_clear_buf(DSP_RX_BUF_0); - bp_clear_buf(DSP_RX_BUF_1); - dbsm_stop(&dsp_rx_sm); - - // FIXME anything else? - - putstr("\nirq: overrun\n"); -} - -static void -start_tx_transfers(void) -{ - bp_clear_buf(DSP_TX_BUF_0); // FIXME, really goes in state machine - bp_clear_buf(DSP_TX_BUF_1); - - // fill everything with a constant 32k + 0j - - uint32_t const_sample = (32000 << 16) | 0; - int i; - for (i = 0; i < BP_NLINES; i++){ - buffer_ram(DSP_TX_BUF_0)[i] = const_sample; - buffer_ram(DSP_TX_BUF_1)[i] = const_sample; - } - - /* - * Construct ethernet header and word0 and preload into two buffers - */ - u2_eth_packet_t pkt; - memset(&pkt, 0, sizeof(pkt)); - //pkt.ehdr.dst = *host; - pkt.ehdr.src = *ethernet_mac_addr(); - pkt.ehdr.ethertype = U2_ETHERTYPE; - u2p_set_word0(&pkt.fixed, - U2P_TX_IMMEDIATE | U2P_TX_START_OF_BURST, 0); - u2p_set_timestamp(&pkt.fixed, T_NOW); - - memcpy_wa(buffer_ram(DSP_TX_BUF_0), &pkt, sizeof(pkt)); - memcpy_wa(buffer_ram(DSP_TX_BUF_1), &pkt, sizeof(pkt)); - - - int tx_scale = 256; - - // setup Tx DSP regs - dsp_tx_regs->clear_state = 1; // reset - dsp_tx_regs->freq = 408021893; // 9.5 MHz [2**32 * fc/fsample] - dsp_tx_regs->scale_iq = (tx_scale << 16) | tx_scale; - dsp_tx_regs->interp_rate = 32; - - // kick off the state machine - // dbsm_start(&dsp_rx_sm); - - SEND_CONST_TO_DSP_TX(); // send constant buffer to DSP TX -} - - -void -buffer_irq_handler(unsigned irq) -{ - uint32_t status = buffer_pool_status->status; - - if (0){ - putstr("irq: "); - puthex32(status); - putchar('\n'); - } - - if (status & BPS_ERROR_ALL){ - // FIXME rare path, handle error conditions - } - - if (status & BPS_DONE(DSP_TX_BUF_0)){ - bp_clear_buf(DSP_TX_BUF_0); - SEND_CONST_TO_DSP_TX(); - hal_toggle_leds(0x1); - } - -} - -int -main(void) -{ - u2_init(); - - // setup tx gpio bits for GPIOM_FPGA_1 -- fpga debug output - //hal_gpio_set_sels(GPIO_TX_BANK, "1111111111111111"); - //hal_gpio_set_sels(GPIO_RX_BANK, "1111111111111111"); - - putstr("\ntx_only\n"); - - // Control LEDs - hal_set_leds(0x0, 0x3); - - if (USE_BUFFER_INTERRUPT) - pic_register_handler(IRQ_BUFFER, buffer_irq_handler); - - pic_register_handler(IRQ_OVERRUN, overrun_irq_handler); - pic_register_handler(IRQ_UNDERRUN, underrun_irq_handler); - - //pic_register_handler(IRQ_TIMER, timer_irq_handler); - //hal_set_timeout(timer_delta); - - ethernet_register_link_changed_callback(link_changed_callback); - - ethernet_init(); - - // initialize double buffering state machine for DSP RX -> Ethernet - dbsm_init(&dsp_rx_sm, DSP_RX_BUF_0, - &dsp_rx_recv_args, &dsp_rx_send_args, - dbsm_nop_inspector); - - // setup receive from ETH - // bp_receive_to_buf(CPU_RX_BUF, PORT_ETH, 1, 0, BP_LAST_LINE); - -#if 0 - if (hwconfig_simulation_p()){ - // If we're simulating, pretend that we got a start command from the host - u2_mac_addr_t host = {{ 0x00, 0x0A, 0xE4, 0x3E, 0xD2, 0xD5 }}; - start_rx_cmd(&host); - } -#endif - - start_tx_transfers(); // send constant buffers to DSP TX - - while(1){ - if (!USE_BUFFER_INTERRUPT) - buffer_irq_handler(0); - } -} - -// ---------------------------------------------------------------- - -// debugging output on tx pins -#define LS_MASK 0xE0000 -#define LS_1000 0x80000 -#define LS_100 0x40000 -#define LS_10 0x20000 - -/* - * Called when eth phy state changes (w/ interrupts disabled) - */ -void -link_changed_callback(int speed) -{ - int v = 0; - switch(speed){ - case 10: - v = LS_10; - link_is_up = true; - break; - - case 100: - v = LS_100; - link_is_up = true; - break; - - case 1000: - v = LS_100; - link_is_up = true; - break; - - default: - v = 0; - link_is_up = false; - break; - } - - //hal_gpio_set_tx(v, LS_MASK); /* set debug bits on d'board */ - - // hal_set_leds(link_is_up ? 0x2 : 0x0, 0x2); - - printf("\neth link changed: speed = %d\n", speed); -} diff --git a/usrp2/firmware/apps/txrx.c b/usrp2/firmware/apps/txrx.c deleted file mode 100644 index 975f314bd..000000000 --- a/usrp2/firmware/apps/txrx.c +++ /dev/null @@ -1,401 +0,0 @@ -/* - * Copyright 2007,2008,2009 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "u2_init.h" -#include "memory_map.h" -#include "spi.h" -#include "hal_io.h" -#include "buffer_pool.h" -#include "pic.h" -#include "bool.h" -#include "ethernet.h" -#include "nonstdio.h" -#include "usrp2_eth_packet.h" -#include "dbsm.h" -#include "app_common_v2.h" -#include "memcpy_wa.h" -#include <stddef.h> -#include <stdlib.h> -#include <string.h> -#include "clocks.h" - -#define FW_SETS_SEQNO 1 // define to 0 or 1 (FIXME must be 1 for now) - -#if (FW_SETS_SEQNO) -static int fw_seqno; // used when f/w is filling in sequence numbers -#endif - - -/* - * Full duplex Tx and Rx between ethernet and DSP pipelines - * - * Buffer 1 is used by the cpu to send frames to the host. - * Buffers 2 and 3 are used to double-buffer the DSP Rx to eth flow - * Buffers 4 and 5 are used to double-buffer the eth to DSP Tx eth flow - */ -//#define CPU_RX_BUF 0 // eth -> cpu - -#define DSP_RX_BUF_0 2 // dsp rx -> eth (double buffer) -#define DSP_RX_BUF_1 3 // dsp rx -> eth -#define DSP_TX_BUF_0 4 // eth -> dsp tx (double buffer) -#define DSP_TX_BUF_1 5 // eth -> dsp tx - -/* - * ================================================================ - * configure DSP TX double buffering state machine (eth -> dsp) - * ================================================================ - */ - -// 4 lines of ethernet hdr + 1 line transport hdr + 2 lines (word0 + timestamp) -// DSP Tx reads word0 (flags) + timestamp followed by samples - -#define DSP_TX_FIRST_LINE ((sizeof(u2_eth_hdr_t) + sizeof(u2_transport_hdr_t))/4) - -// Receive from ethernet -buf_cmd_args_t dsp_tx_recv_args = { - PORT_ETH, - 0, - BP_LAST_LINE -}; - -// send to DSP Tx -buf_cmd_args_t dsp_tx_send_args = { - PORT_DSP, - DSP_TX_FIRST_LINE, // starts just past transport header - 0 // filled in from last_line register -}; - -dbsm_t dsp_tx_sm; // the state machine - -/* - * ================================================================ - * configure DSP RX double buffering state machine (dsp -> eth) - * ================================================================ - */ - -// 4 lines of ethernet hdr + 1 line transport hdr + 1 line (word0) -// DSP Rx writes timestamp followed by nlines_per_frame of samples -#define DSP_RX_FIRST_LINE ((sizeof(u2_eth_hdr_t) + sizeof(u2_transport_hdr_t))/4 + 1) - -// receive from DSP -buf_cmd_args_t dsp_rx_recv_args = { - PORT_DSP, - DSP_RX_FIRST_LINE, - BP_LAST_LINE -}; - -// send to ETH -buf_cmd_args_t dsp_rx_send_args = { - PORT_ETH, - 0, // starts with ethernet header in line 0 - 0, // filled in from list_line register -}; - -dbsm_t dsp_rx_sm; // the state machine - - -// The mac address of the host we're sending to. -u2_mac_addr_t host_mac_addr; - - -// variables for streaming mode - -static bool streaming_p = false; -static unsigned int streaming_items_per_frame = 0; -static int streaming_frame_count = 0; -#define FRAMES_PER_CMD 1000 - -bool is_streaming(void){ return streaming_p; } - - -// ---------------------------------------------------------------- - - -void -restart_streaming(void) -{ - // setup RX DSP regs - dsp_rx_regs->clear_state = 1; // reset - - streaming_p = true; - streaming_frame_count = FRAMES_PER_CMD; - - dsp_rx_regs->rx_command = - MK_RX_CMD(FRAMES_PER_CMD * streaming_items_per_frame, - streaming_items_per_frame, - 1, 1); // set "chain" bit - - // kick off the state machine - dbsm_start(&dsp_rx_sm); - - dsp_rx_regs->rx_time = 0; // enqueue first of two commands - - // make sure this one and the rest have the "now" and "chain" bits set. - dsp_rx_regs->rx_command = - MK_RX_CMD(FRAMES_PER_CMD * streaming_items_per_frame, - streaming_items_per_frame, - 1, 1); - - dsp_rx_regs->rx_time = 0; // enqueue second command -} - -void -restart_streaming_at(uint32_t time) -{ - // setup RX DSP regs - dsp_rx_regs->clear_state = 1; // reset - - streaming_p = true; - streaming_frame_count = FRAMES_PER_CMD; - - dsp_rx_regs->rx_command = - MK_RX_CMD(FRAMES_PER_CMD * streaming_items_per_frame, - streaming_items_per_frame, - 0, 1); // set "chain" bit - - // kick off the state machine - dbsm_start(&dsp_rx_sm); - - dsp_rx_regs->rx_time = time; // enqueue first of two commands - - // make sure this one and the rest have the "now" and "chain" bits set. - dsp_rx_regs->rx_command = - MK_RX_CMD(FRAMES_PER_CMD * streaming_items_per_frame, - streaming_items_per_frame, - 1, 1); - - dsp_rx_regs->rx_time = 0; // enqueue second command -} - -void -start_rx_streaming_cmd(const u2_mac_addr_t *host, op_start_rx_streaming_t *p) -{ - host_mac_addr = *host; // remember who we're sending to - - /* - * Construct ethernet header and word0 and preload into two buffers - */ - u2_eth_packet_t pkt; - memset(&pkt, 0, sizeof(pkt)); - pkt.ehdr.dst = *host; - pkt.ehdr.src = *ethernet_mac_addr(); - pkt.ehdr.ethertype = U2_ETHERTYPE; - u2p_set_word0(&pkt.fixed, 0, 0); - // DSP RX will fill in timestamp - - memcpy_wa(buffer_ram(DSP_RX_BUF_0), &pkt, sizeof(pkt)); - memcpy_wa(buffer_ram(DSP_RX_BUF_1), &pkt, sizeof(pkt)); - - - if (FW_SETS_SEQNO) - fw_seqno = 0; - - streaming_items_per_frame = p->items_per_frame; - restart_streaming(); -} - -void -start_rx_streaming_at_cmd(const u2_mac_addr_t *host, op_start_rx_streaming_t *p, uint32_t time) -{ - host_mac_addr = *host; // remember who we're sending to - - /* - * Construct ethernet header and word0 and preload into two buffers - */ - u2_eth_packet_t pkt; - memset(&pkt, 0, sizeof(pkt)); - pkt.ehdr.dst = *host; - pkt.ehdr.src = *ethernet_mac_addr(); - pkt.ehdr.ethertype = U2_ETHERTYPE; - u2p_set_word0(&pkt.fixed, 0, 0); - // DSP RX will fill in timestamp - - memcpy_wa(buffer_ram(DSP_RX_BUF_0), &pkt, sizeof(pkt)); - memcpy_wa(buffer_ram(DSP_RX_BUF_1), &pkt, sizeof(pkt)); - - - if (FW_SETS_SEQNO) - fw_seqno = 0; - - streaming_items_per_frame = p->items_per_frame; - restart_streaming_at(time); -} - - -void -stop_rx_cmd(void) -{ - streaming_p = false; - dsp_rx_regs->clear_state = 1; // flush cmd queue - bp_clear_buf(DSP_RX_BUF_0); - bp_clear_buf(DSP_RX_BUF_1); -} - - -static void -setup_tx() -{ - dsp_tx_regs->clear_state = 1; - bp_clear_buf(DSP_TX_BUF_0); - bp_clear_buf(DSP_TX_BUF_1); - - int tx_scale = 256; - int interp = 32; - - // setup some defaults - - dsp_tx_regs->freq = 0; - dsp_tx_regs->scale_iq = (tx_scale << 16) | tx_scale; - dsp_tx_regs->interp_rate = interp; -} - - -#if (FW_SETS_SEQNO) -/* - * Debugging ONLY. This will be handled by the tx_protocol_engine. - * - * This is called when the DSP Rx chain has filled in a packet. - * We set and increment the seqno, then return false, indicating - * that we didn't handle the packet. A bit of a kludge - * but it should work. - */ -bool -fw_sets_seqno_inspector(dbsm_t *sm, int buf_this) // returns false -{ - uint32_t *p = buffer_ram(buf_this); - uint32_t seqno = fw_seqno++; - - // KLUDGE all kinds of nasty magic numbers and embedded knowledge - uint32_t t = p[4]; - t = (t & 0xffff00ff) | ((seqno & 0xff) << 8); - p[4] = t; - - // queue up another rx command when required - if (streaming_p && --streaming_frame_count == 0){ - streaming_frame_count = FRAMES_PER_CMD; - dsp_rx_regs->rx_time = 0; - } - - return false; // we didn't handle the packet -} -#endif - - -inline static void -buffer_irq_handler(unsigned irq) -{ - uint32_t status = buffer_pool_status->status; - - dbsm_process_status(&dsp_tx_sm, status); - dbsm_process_status(&dsp_rx_sm, status); -} - -int -main(void) -{ - u2_init(); - - putstr("\nTxRx-NEWETH\n"); - print_mac_addr(ethernet_mac_addr()->addr); - newline(); - - ethernet_register_link_changed_callback(link_changed_callback); - ethernet_init(); - -#if 0 - // make bit 15 of Tx gpio's be a s/w output - hal_gpio_set_sel(GPIO_TX_BANK, 15, 's'); - hal_gpio_set_ddr(GPIO_TX_BANK, 0x8000, 0x8000); -#endif - - output_regs->debug_mux_ctrl = 1; -#if 0 - hal_gpio_set_sels(GPIO_TX_BANK, "1111111111111111"); - hal_gpio_set_sels(GPIO_RX_BANK, "1111111111111111"); - hal_gpio_set_ddr(GPIO_TX_BANK, 0xffff, 0xffff); - hal_gpio_set_ddr(GPIO_RX_BANK, 0xffff, 0xffff); -#endif - - - // initialize double buffering state machine for ethernet -> DSP Tx - - dbsm_init(&dsp_tx_sm, DSP_TX_BUF_0, - &dsp_tx_recv_args, &dsp_tx_send_args, - eth_pkt_inspector); - - - // initialize double buffering state machine for DSP RX -> Ethernet - - if (FW_SETS_SEQNO){ - dbsm_init(&dsp_rx_sm, DSP_RX_BUF_0, - &dsp_rx_recv_args, &dsp_rx_send_args, - fw_sets_seqno_inspector); - } - else { - dbsm_init(&dsp_rx_sm, DSP_RX_BUF_0, - &dsp_rx_recv_args, &dsp_rx_send_args, - dbsm_nop_inspector); - } - - // tell app_common that this dbsm could be sending to the ethernet - ac_could_be_sending_to_eth = &dsp_rx_sm; - - - // program tx registers - setup_tx(); - - // kick off the state machine - dbsm_start(&dsp_tx_sm); - - //int which = 0; - - while(1){ - // hal_gpio_write(GPIO_TX_BANK, which, 0x8000); - // which ^= 0x8000; - - buffer_irq_handler(0); - - int pending = pic_regs->pending; // poll for under or overrun - - if (pending & PIC_UNDERRUN_INT){ - dbsm_handle_tx_underrun(&dsp_tx_sm); - pic_regs->pending = PIC_UNDERRUN_INT; // clear interrupt - putchar('U'); - } - - if (pending & PIC_OVERRUN_INT){ - dbsm_handle_rx_overrun(&dsp_rx_sm); - pic_regs->pending = PIC_OVERRUN_INT; // clear pending interrupt - - // FIXME Figure out how to handle this robustly. - // Any buffers that are emptying should be allowed to drain... - - if (streaming_p){ - // restart_streaming(); - // FIXME report error - } - else { - // FIXME report error - } - putchar('O'); - } - } -} diff --git a/usrp2/firmware/bootstrap b/usrp2/firmware/bootstrap deleted file mode 100755 index 4106d4746..000000000 --- a/usrp2/firmware/bootstrap +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh - -# Copyright 2001,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. - - -rm -fr config.cache autom4te*.cache - -aclocal -I config -autoconf -autoheader -# libtoolize --automake -automake --add-missing -Wno-portability - diff --git a/usrp2/firmware/config.guess b/usrp2/firmware/config.guess deleted file mode 100644 index 278f9e9e0..000000000 --- a/usrp2/firmware/config.guess +++ /dev/null @@ -1,1516 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, -# Inc. - -timestamp='2007-07-22' - -# This file 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. -# -# This program 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. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Originally written by Per Bothner <per@bothner.com>. -# Please send patches to <config-patches@gnu.org>. Submit a context -# diff and a properly formatted ChangeLog entry. -# -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. -# -# The plan is that this can be called by configure scripts if you -# don't specify an explicit build system type. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] - -Output the configuration name of the system \`$me' is run on. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to <config-patches@gnu.org>." - -version="\ -GNU config.guess ($timestamp) - -Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" >&2 - exit 1 ;; - * ) - break ;; - esac -done - -if test $# != 0; then - echo "$me: too many arguments$help" >&2 - exit 1 -fi - -trap 'exit 1' 1 2 15 - -# CC_FOR_BUILD -- compiler used by this script. Note that the use of a -# compiler to aid in system detection is discouraged as it requires -# temporary files to be created and, as you can see below, it is a -# headache to deal with in a portable fashion. - -# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still -# use `HOST_CC' if defined, but it is deprecated. - -# Portable tmp directory creation inspired by the Autoconf team. - -set_cc_for_build=' -trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; -trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; -: ${TMPDIR=/tmp} ; - { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || - { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; -dummy=$tmp/dummy ; -tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; -case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int x;" > $dummy.c ; - for c in cc gcc c89 c99 ; do - if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then - CC_FOR_BUILD="$c"; break ; - fi ; - done ; - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found ; - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ; set_cc_for_build= ;' - -# This is needed to find uname on a Pyramid OSx when run in the BSD universe. -# (ghazi@noc.rutgers.edu 1994-08-24) -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then - PATH=$PATH:/.attbin ; export PATH -fi - -UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown -UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown -UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown - -# Note: order is significant - the case branches are not exclusive. - -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - *:NetBSD:*:*) - # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, - # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently - # switched to ELF, *-*-netbsd* would select the old - # object file format. This provides both forward - # compatibility and a consistent mechanism for selecting the - # object file format. - # - # Note: NetBSD doesn't particularly care about the vendor - # portion of the name. We always set it to "unknown". - sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` - case "${UNAME_MACHINE_ARCH}" in - armeb) machine=armeb-unknown ;; - arm*) machine=arm-unknown ;; - sh3el) machine=shl-unknown ;; - sh3eb) machine=sh-unknown ;; - sh5el) machine=sh5le-unknown ;; - *) machine=${UNAME_MACHINE_ARCH}-unknown ;; - esac - # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. - case "${UNAME_MACHINE_ARCH}" in - arm*|i386|m68k|ns32k|sh3*|sparc|vax) - eval $set_cc_for_build - if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep __ELF__ >/dev/null - then - # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). - # Return netbsd for either. FIX? - os=netbsd - else - os=netbsdelf - fi - ;; - *) - os=netbsd - ;; - esac - # The OS release - # Debian GNU/NetBSD machines have a different userland, and - # thus, need a distinct triplet. However, they do not need - # kernel version information, so it can be replaced with a - # suitable tag, in the style of linux-gnu. - case "${UNAME_VERSION}" in - Debian*) - release='-gnu' - ;; - *) - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - ;; - esac - # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: - # contains redundant information, the shorter form: - # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" - exit ;; - *:OpenBSD:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} - exit ;; - *:ekkoBSD:*:*) - echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} - exit ;; - *:SolidBSD:*:*) - echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} - exit ;; - macppc:MirBSD:*:*) - echo powerpc-unknown-mirbsd${UNAME_RELEASE} - exit ;; - *:MirBSD:*:*) - echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} - exit ;; - alpha:OSF1:*:*) - case $UNAME_RELEASE in - *4.0) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - ;; - *5.*) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` - ;; - esac - # According to Compaq, /usr/sbin/psrinfo has been available on - # OSF/1 and Tru64 systems produced since 1995. I hope that - # covers most systems running today. This code pipes the CPU - # types through head -n 1, so we only detect the type of CPU 0. - ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` - case "$ALPHA_CPU_TYPE" in - "EV4 (21064)") - UNAME_MACHINE="alpha" ;; - "EV4.5 (21064)") - UNAME_MACHINE="alpha" ;; - "LCA4 (21066/21068)") - UNAME_MACHINE="alpha" ;; - "EV5 (21164)") - UNAME_MACHINE="alphaev5" ;; - "EV5.6 (21164A)") - UNAME_MACHINE="alphaev56" ;; - "EV5.6 (21164PC)") - UNAME_MACHINE="alphapca56" ;; - "EV5.7 (21164PC)") - UNAME_MACHINE="alphapca57" ;; - "EV6 (21264)") - UNAME_MACHINE="alphaev6" ;; - "EV6.7 (21264A)") - UNAME_MACHINE="alphaev67" ;; - "EV6.8CB (21264C)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8AL (21264B)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8CX (21264D)") - UNAME_MACHINE="alphaev68" ;; - "EV6.9A (21264/EV69A)") - UNAME_MACHINE="alphaev69" ;; - "EV7 (21364)") - UNAME_MACHINE="alphaev7" ;; - "EV7.9 (21364A)") - UNAME_MACHINE="alphaev79" ;; - esac - # A Pn.n version is a patched version. - # A Vn.n version is a released version. - # A Tn.n version is a released field test version. - # A Xn.n version is an unreleased experimental baselevel. - # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - exit ;; - Alpha\ *:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # Should we change UNAME_MACHINE based on the output of uname instead - # of the specific Alpha model? - echo alpha-pc-interix - exit ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit ;; - Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 - exit ;; - *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos - exit ;; - *:[Mm]orph[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-morphos - exit ;; - *:OS/390:*:*) - echo i370-ibm-openedition - exit ;; - *:z/VM:*:*) - echo s390-ibm-zvmoe - exit ;; - *:OS400:*:*) - echo powerpc-ibm-os400 - exit ;; - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} - exit ;; - arm:riscos:*:*|arm:RISCOS:*:*) - echo arm-unknown-riscos - exit ;; - SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - exit ;; - Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) - # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - if test "`(/bin/universe) 2>/dev/null`" = att ; then - echo pyramid-pyramid-sysv3 - else - echo pyramid-pyramid-bsd - fi - exit ;; - NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 - exit ;; - DRS?6000:unix:4.0:6*) - echo sparc-icl-nx6 - exit ;; - DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) - case `/usr/bin/uname -p` in - sparc) echo sparc-icl-nx7; exit ;; - esac ;; - sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) - echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:6*:*) - # According to config.sub, this is the proper way to canonicalize - # SunOS6. Hard to guess exactly what SunOS6 will be like, but - # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in - Series*|S4*) - UNAME_RELEASE=`uname -v` - ;; - esac - # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit ;; - sun3*:SunOS:*:*) - echo m68k-sun-sunos${UNAME_RELEASE} - exit ;; - sun*:*:4.2BSD:*) - UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 - case "`/bin/arch`" in - sun3) - echo m68k-sun-sunos${UNAME_RELEASE} - ;; - sun4) - echo sparc-sun-sunos${UNAME_RELEASE} - ;; - esac - exit ;; - aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} - exit ;; - # The situation for MiNT is a little confusing. The machine name - # can be virtually everything (everything which is not - # "atarist" or "atariste" at least should have a processor - # > m68000). The system name ranges from "MiNT" over "FreeMiNT" - # to the lowercase version "mint" (or "freemint"). Finally - # the system name "TOS" denotes a system which is actually not - # MiNT. But MiNT is downward compatible to TOS, so this should - # be no problem. - atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit ;; - hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit ;; - *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit ;; - m68k:machten:*:*) - echo m68k-apple-machten${UNAME_RELEASE} - exit ;; - powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} - exit ;; - RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit ;; - RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} - exit ;; - VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} - exit ;; - 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} - exit ;; - mips:*:*:UMIPS | mips:*:*:RISCos) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c -#ifdef __cplusplus -#include <stdio.h> /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif - #if defined (host_mips) && defined (MIPSEB) - #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); - #endif - #endif - exit (-1); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && - dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && - SYSTEM_NAME=`$dummy $dummyarg` && - { echo "$SYSTEM_NAME"; exit; } - echo mips-mips-riscos${UNAME_RELEASE} - exit ;; - Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax - exit ;; - Motorola:*:4.3:PL8-*) - echo powerpc-harris-powermax - exit ;; - Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) - echo powerpc-harris-powermax - exit ;; - Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix - exit ;; - m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit ;; - m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit ;; - m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit ;; - AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] - then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ - [ ${TARGET_BINARY_INTERFACE}x = x ] - then - echo m88k-dg-dgux${UNAME_RELEASE} - else - echo m88k-dg-dguxbcs${UNAME_RELEASE} - fi - else - echo i586-dg-dgux${UNAME_RELEASE} - fi - exit ;; - M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit ;; - M88*:*:R3*:*) - # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit ;; - XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit ;; - Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit ;; - *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit ;; - ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i*86:AIX:*:*) - echo i386-ibm-aix - exit ;; - ia64:AIX:*:*) - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit ;; - *:AIX:2:3) - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include <sys/systemcfg.h> - - main() - { - if (!__power_pc()) - exit(1); - puts("powerpc-ibm-aix3.2.5"); - exit(0); - } -EOF - if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` - then - echo "$SYSTEM_NAME" - else - echo rs6000-ibm-aix3.2.5 - fi - elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - echo rs6000-ibm-aix3.2.4 - else - echo rs6000-ibm-aix3.2 - fi - exit ;; - *:AIX:*:[45]) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` - if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then - IBM_ARCH=rs6000 - else - IBM_ARCH=powerpc - fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit ;; - *:AIX:*:*) - echo rs6000-ibm-aix - exit ;; - ibmrt:4.4BSD:*|romp-ibm:BSD:*) - echo romp-ibm-bsd4.4 - exit ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit ;; # report: romp-ibm BSD 4.3 - *:BOSX:*:*) - echo rs6000-bull-bosx - exit ;; - DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 - exit ;; - 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd - exit ;; - hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 - exit ;; - 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - case "${UNAME_MACHINE}" in - 9000/31? ) HP_ARCH=m68000 ;; - 9000/[34]?? ) HP_ARCH=m68k ;; - 9000/[678][0-9][0-9]) - if [ -x /usr/bin/getconf ]; then - sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 - esac ;; - esac - fi - if [ "${HP_ARCH}" = "" ]; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - - #define _HPUX_SOURCE - #include <stdlib.h> - #include <unistd.h> - - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); - - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } -EOF - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` - test -z "$HP_ARCH" && HP_ARCH=hppa - fi ;; - esac - if [ ${HP_ARCH} = "hppa2.0w" ] - then - eval $set_cc_for_build - - # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating - # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler - # generating 64-bit code. GNU and HP use different nomenclature: - # - # $ CC_FOR_BUILD=cc ./config.guess - # => hppa2.0w-hp-hpux11.23 - # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess - # => hppa64-hp-hpux11.23 - - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | - grep __LP64__ >/dev/null - then - HP_ARCH="hppa2.0w" - else - HP_ARCH="hppa64" - fi - fi - echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit ;; - ia64:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux${HPUX_REV} - exit ;; - 3050*:HI-UX:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include <unistd.h> - int - main () - { - long cpu = sysconf (_SC_CPU_VERSION); - /* The order matters, because CPU_IS_HP_MC68K erroneously returns - true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct - results, however. */ - if (CPU_IS_PA_RISC (cpu)) - { - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; - case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; - default: puts ("hppa-hitachi-hiuxwe2"); break; - } - } - else if (CPU_IS_HP_MC68K (cpu)) - puts ("m68k-hitachi-hiuxwe2"); - else puts ("unknown-hitachi-hiuxwe2"); - exit (0); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - echo unknown-hitachi-hiuxwe2 - exit ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) - echo hppa1.1-hp-bsd - exit ;; - 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit ;; - *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix - exit ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) - echo hppa1.1-hp-osf - exit ;; - hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit ;; - i*86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk - else - echo ${UNAME_MACHINE}-unknown-osf1 - fi - exit ;; - parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit ;; - C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit ;; - C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit ;; - C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit ;; - C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit ;; - CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*[A-Z]90:*:*:*) - echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ - | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ - -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ - -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*SV1:*:*:*) - echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - *:UNICOS/mp:*:*) - echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; - 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` - echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; - i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit ;; - sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:FreeBSD:*:*) - case ${UNAME_MACHINE} in - pc98) - echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - amd64) - echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - *) - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - esac - exit ;; - i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin - exit ;; - *:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 - exit ;; - i*:windows32*:*) - # uname -m includes "-pc" on this system. - echo ${UNAME_MACHINE}-mingw32 - exit ;; - i*:PW*:*) - echo ${UNAME_MACHINE}-pc-pw32 - exit ;; - *:Interix*:[3456]*) - case ${UNAME_MACHINE} in - x86) - echo i586-pc-interix${UNAME_RELEASE} - exit ;; - EM64T | authenticamd) - echo x86_64-unknown-interix${UNAME_RELEASE} - exit ;; - esac ;; - [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) - echo i${UNAME_MACHINE}-pc-mks - exit ;; - i*:Windows_NT*:* | Pentium*:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we - # UNAME_MACHINE based on the output of uname instead of i386? - echo i586-pc-interix - exit ;; - i*:UWIN*:*) - echo ${UNAME_MACHINE}-pc-uwin - exit ;; - amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) - echo x86_64-unknown-cygwin - exit ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin - exit ;; - prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - *:GNU:*:*) - # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit ;; - *:GNU/*:*:*) - # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu - exit ;; - i*86:Minix:*:*) - echo ${UNAME_MACHINE}-pc-minix - exit ;; - arm*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - cris:Linux:*:*) - echo cris-axis-linux-gnu - exit ;; - crisv32:Linux:*:*) - echo crisv32-axis-linux-gnu - exit ;; - frv:Linux:*:*) - echo frv-unknown-linux-gnu - exit ;; - ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - mips:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef mips - #undef mipsel - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mipsel - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips - #else - CPU= - #endif - #endif -EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^CPU/{ - s: ::g - p - }'`" - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } - ;; - mips64:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef mips64 - #undef mips64el - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mips64el - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips64 - #else - CPU= - #endif - #endif -EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^CPU/{ - s: ::g - p - }'`" - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } - ;; - or32:Linux:*:*) - echo or32-unknown-linux-gnu - exit ;; - ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu - exit ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu - exit ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} - exit ;; - parisc:Linux:*:* | hppa:Linux:*:*) - # Look for CPU level - case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; - esac - exit ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu - exit ;; - s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux - exit ;; - sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-gnu - exit ;; - x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu - exit ;; - xtensa:Linux:*:*) - echo xtensa-unknown-linux-gnu - exit ;; - i*86:Linux:*:*) - # The BFD linker knows what the default object file format is, so - # first see if it will tell us. cd to the root directory to prevent - # problems with other programs or directories called `ld' in the path. - # Set LC_ALL=C to ensure ld outputs messages in English. - ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ - | sed -ne '/supported targets:/!d - s/[ ][ ]*/ /g - s/.*supported targets: *// - s/ .*// - p'` - case "$ld_supported_targets" in - elf32-i386) - TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" - ;; - a.out-i386-linux) - echo "${UNAME_MACHINE}-pc-linux-gnuaout" - exit ;; - coff-i386) - echo "${UNAME_MACHINE}-pc-linux-gnucoff" - exit ;; - "") - # Either a pre-BFD a.out linker (linux-gnuoldld) or - # one that does not give us useful --help. - echo "${UNAME_MACHINE}-pc-linux-gnuoldld" - exit ;; - esac - # Determine whether the default compiler is a.out or elf - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include <features.h> - #ifdef __ELF__ - # ifdef __GLIBC__ - # if __GLIBC__ >= 2 - LIBC=gnu - # else - LIBC=gnulibc1 - # endif - # else - LIBC=gnulibc1 - # endif - #else - #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) - LIBC=gnu - #else - LIBC=gnuaout - #endif - #endif - #ifdef __dietlibc__ - LIBC=dietlibc - #endif -EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^LIBC/{ - s: ::g - p - }'`" - test x"${LIBC}" != x && { - echo "${UNAME_MACHINE}-pc-linux-${LIBC}" - exit - } - test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } - ;; - i*86:DYNIX/ptx:4*:*) - # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. - # earlier versions are messed up and put the nodename in both - # sysname and nodename. - echo i386-sequent-sysv4 - exit ;; - i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, - # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. - echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit ;; - i*86:OS/2:*:*) - # If we were able to find `uname', then EMX Unix compatibility - # is probably installed. - echo ${UNAME_MACHINE}-pc-os2-emx - exit ;; - i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop - exit ;; - i*86:atheos:*:*) - echo ${UNAME_MACHINE}-unknown-atheos - exit ;; - i*86:syllable:*:*) - echo ${UNAME_MACHINE}-pc-syllable - exit ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit ;; - i*86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit ;; - i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) - UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` - if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} - else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} - fi - exit ;; - i*86:*:5:[678]*) - # UnixWare 7.x, OpenUNIX and OpenServer 6. - case `/bin/uname -X | grep "^Machine"` in - *486*) UNAME_MACHINE=i486 ;; - *Pentium) UNAME_MACHINE=i586 ;; - *Pent*|*Celeron) UNAME_MACHINE=i686 ;; - esac - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - exit ;; - i*86:*:3.2:*) - if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` - echo ${UNAME_MACHINE}-pc-isc$UNAME_REL - elif /bin/uname -X 2>/dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` - (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ - && UNAME_MACHINE=i686 - (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ - && UNAME_MACHINE=i686 - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL - else - echo ${UNAME_MACHINE}-pc-sysv32 - fi - exit ;; - pc:*:*:*) - # Left here for compatibility: - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i386. - echo i386-pc-msdosdjgpp - exit ;; - Intel:Mach:3*:*) - echo i386-pc-mach3 - exit ;; - paragon:*:*:*) - echo i860-intel-osf1 - exit ;; - i860:*:4.*:*) # i860-SVR4 - if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 - else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 - fi - exit ;; - mini*:CTIX:SYS*5:*) - # "miniframe" - echo m68010-convergent-sysv - exit ;; - mc68k:UNIX:SYSTEM5:3.51m) - echo m68k-convergent-sysv - exit ;; - M680?0:D-NIX:5.3:*) - echo m68k-diab-dnix - exit ;; - M68*:*:R3V[5678]*:*) - test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; - 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) - OS_REL='' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; - 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4; exit; } ;; - m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} - exit ;; - mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit ;; - TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} - exit ;; - rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) - echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit ;; - SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${UNAME_RELEASE} - exit ;; - RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - *:SINIX-*:*:*) - if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo ${UNAME_MACHINE}-sni-sysv4 - else - echo ns32k-sni-sysv - fi - exit ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says <Richard.M.Bartel@ccMail.Census.GOV> - echo i586-unisys-sysv4 - exit ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes <hewes@openmarket.com>. - # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit ;; - *:*:*:FTX*) - # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - exit ;; - i*86:VOS:*:*) - # From Paul.Green@stratus.com. - echo ${UNAME_MACHINE}-stratus-vos - exit ;; - *:VOS:*:*) - # From Paul.Green@stratus.com. - echo hppa1.1-stratus-vos - exit ;; - mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} - exit ;; - news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 - exit ;; - R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} - else - echo mips-unknown-sysv${UNAME_RELEASE} - fi - exit ;; - BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit ;; - BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit ;; - BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos - exit ;; - SX-4:SUPER-UX:*:*) - echo sx4-nec-superux${UNAME_RELEASE} - exit ;; - SX-5:SUPER-UX:*:*) - echo sx5-nec-superux${UNAME_RELEASE} - exit ;; - SX-6:SUPER-UX:*:*) - echo sx6-nec-superux${UNAME_RELEASE} - exit ;; - SX-7:SUPER-UX:*:*) - echo sx7-nec-superux${UNAME_RELEASE} - exit ;; - SX-8:SUPER-UX:*:*) - echo sx8-nec-superux${UNAME_RELEASE} - exit ;; - SX-8R:SUPER-UX:*:*) - echo sx8r-nec-superux${UNAME_RELEASE} - exit ;; - Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit ;; - *:Rhapsody:*:*) - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit ;; - *:Darwin:*:*) - UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - case $UNAME_PROCESSOR in - unknown) UNAME_PROCESSOR=powerpc ;; - esac - echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} - exit ;; - *:procnto*:*:* | *:QNX:[0123456789]*:*) - UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then - UNAME_PROCESSOR=i386 - UNAME_MACHINE=pc - fi - echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit ;; - *:QNX:*:4*) - echo i386-pc-qnx - exit ;; - NSE-?:NONSTOP_KERNEL:*:*) - echo nse-tandem-nsk${UNAME_RELEASE} - exit ;; - NSR-?:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk${UNAME_RELEASE} - exit ;; - *:NonStop-UX:*:*) - echo mips-compaq-nonstopux - exit ;; - BS2000:POSIX*:*:*) - echo bs2000-siemens-sysv - exit ;; - DS/*:UNIX_System_V:*:*) - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit ;; - *:Plan9:*:*) - # "uname -m" is not consistent, so use $cputype instead. 386 - # is converted to i386 for consistency with other x86 - # operating systems. - if test "$cputype" = "386"; then - UNAME_MACHINE=i386 - else - UNAME_MACHINE="$cputype" - fi - echo ${UNAME_MACHINE}-unknown-plan9 - exit ;; - *:TOPS-10:*:*) - echo pdp10-unknown-tops10 - exit ;; - *:TENEX:*:*) - echo pdp10-unknown-tenex - exit ;; - KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - echo pdp10-dec-tops20 - exit ;; - XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - echo pdp10-xkl-tops20 - exit ;; - *:TOPS-20:*:*) - echo pdp10-unknown-tops20 - exit ;; - *:ITS:*:*) - echo pdp10-unknown-its - exit ;; - SEI:*:*:SEIUX) - echo mips-sei-seiux${UNAME_RELEASE} - exit ;; - *:DragonFly:*:*) - echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` - exit ;; - *:*VMS:*:*) - UNAME_MACHINE=`(uname -p) 2>/dev/null` - case "${UNAME_MACHINE}" in - A*) echo alpha-dec-vms ; exit ;; - I*) echo ia64-dec-vms ; exit ;; - V*) echo vax-dec-vms ; exit ;; - esac ;; - *:XENIX:*:SysV) - echo i386-pc-xenix - exit ;; - i*86:skyos:*:*) - echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' - exit ;; - i*86:rdos:*:*) - echo ${UNAME_MACHINE}-pc-rdos - exit ;; -esac - -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - -eval $set_cc_for_build -cat >$dummy.c <<EOF -#ifdef _SEQUENT_ -# include <sys/types.h> -# include <sys/utsname.h> -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include <sys/param.h> - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix\n"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - if (version < 4) - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - else - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); - -#endif - -#if defined (vax) -# if !defined (ultrix) -# include <sys/param.h> -# if defined (BSD) -# if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -# else -# if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# endif -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# else - printf ("vax-dec-ultrix\n"); exit (0); -# endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - -# Apollos put the system type in the environment. - -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } - -# Convex versions that predate uname can use getsysinfo(1) - -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - c34*) - echo c34-convex-bsd - exit ;; - c38*) - echo c38-convex-bsd - exit ;; - c4*) - echo c4-convex-bsd - exit ;; - esac -fi - -cat >&2 <<EOF -$0: unable to guess system type - -This script, last modified $timestamp, has failed to recognize -the operating system you are using. It is advised that you -download the most up to date version of the config scripts from - - http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess -and - http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub - -If the version you run ($0) is already up to date, please -send the following data and any information you think might be -pertinent to <config-patches@gnu.org> in order to provide the needed -information to handle your system. - -config.guess timestamp = $timestamp - -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null` - -hostinfo = `(hostinfo) 2>/dev/null` -/bin/universe = `(/bin/universe) 2>/dev/null` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` -/bin/arch = `(/bin/arch) 2>/dev/null` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` - -UNAME_MACHINE = ${UNAME_MACHINE} -UNAME_RELEASE = ${UNAME_RELEASE} -UNAME_SYSTEM = ${UNAME_SYSTEM} -UNAME_VERSION = ${UNAME_VERSION} -EOF - -exit 1 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/usrp2/firmware/config.sub b/usrp2/firmware/config.sub deleted file mode 100644 index 1761d8bdf..000000000 --- a/usrp2/firmware/config.sub +++ /dev/null @@ -1,1626 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, -# Inc. - -timestamp='2007-06-28' - -# This file is (in principle) common to ALL GNU software. -# The presence of a machine in this file suggests that SOME GNU software -# can handle that machine. It does not imply ALL GNU software can. -# -# This file 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. -# -# This program 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. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Please send patches to <config-patches@gnu.org>. Submit a context -# diff and a properly formatted ChangeLog entry. -# -# Configuration subroutine to validate and canonicalize a configuration type. -# Supply the specified configuration type as an argument. -# If it is invalid, we print an error message on stderr and exit with code 1. -# Otherwise, we print the canonical config type on stdout and succeed. - -# This file is supposed to be the same for all GNU packages -# and recognize all the CPU types, system types and aliases -# that are meaningful with *any* GNU software. -# Each package is responsible for reporting which valid configurations -# it does not support. The user should be able to distinguish -# a failure to support a valid configuration from a meaningless -# configuration. - -# The goal of this file is to map all the various variations of a given -# machine specification into a single specification in the form: -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or in some cases, the newer four-part form: -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# It is wrong to echo any other type of specification. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS - -Canonicalize a configuration name. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to <config-patches@gnu.org>." - -version="\ -GNU config.sub ($timestamp) - -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" - exit 1 ;; - - *local*) - # First pass through any local machine types. - echo $1 - exit ;; - - * ) - break ;; - esac -done - -case $# in - 0) echo "$me: missing argument$help" >&2 - exit 1;; - 1) ;; - *) echo "$me: too many arguments$help" >&2 - exit 1;; -esac - -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). -# Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` -case $maybe_os in - nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ - uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ - storm-chaos* | os2-emx* | rtmk-nova*) - os=-$maybe_os - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; - *) - basic_machine=`echo $1 | sed 's/-[^-]*$//'` - if [ $basic_machine != $1 ] - then os=`echo $1 | sed 's/.*-/-/'` - else os=; fi - ;; -esac - -### Let's recognize common machines as not being operating systems so -### that things like config.sub decstation-3100 work. We also -### recognize some manufacturers as not being operating systems, so we -### can provide default operating systems below. -case $os in - -sun*os*) - # Prevent following clause from handling this invalid input. - ;; - -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ - -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ - -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ - -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ - -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ - -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray) - os= - basic_machine=$1 - ;; - -sim | -cisco | -oki | -wec | -winbond) - os= - basic_machine=$1 - ;; - -scout) - ;; - -wrs) - os=-vxworks - basic_machine=$1 - ;; - -chorusos*) - os=-chorusos - basic_machine=$1 - ;; - -chorusrdb) - os=-chorusrdb - basic_machine=$1 - ;; - -hiux*) - os=-hiuxwe2 - ;; - -sco6) - os=-sco5v6 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5) - os=-sco3.2v5 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco4) - os=-sco3.2v4 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2.[4-9]*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2v[4-9]*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5v6*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco*) - os=-sco3.2v2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -udk*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -isc) - os=-isc2.2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -clix*) - basic_machine=clipper-intergraph - ;; - -isc*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -lynx*) - os=-lynxos - ;; - -ptx*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` - ;; - -windowsnt*) - os=`echo $os | sed -e 's/windowsnt/winnt/'` - ;; - -psos*) - os=-psos - ;; - -mint | -mint[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; -esac - -# Decode aliases for certain CPU-COMPANY combinations. -case $basic_machine in - # Recognize the basic CPU types without company name. - # Some are omitted here because they have special meanings below. - 1750a | 580 \ - | a29k \ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | am33_2.0 \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ - | bfin \ - | c4x | clipper \ - | d10v | d30v | dlx | dsp16xx \ - | fido | fr30 | frv \ - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | i370 | i860 | i960 | ia64 \ - | ip2k | iq2000 \ - | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | mcore | mep \ - | mips | mipsbe | mipseb | mipsel | mipsle \ - | mips16 \ - | mips64 | mips64el \ - | mips64vr | mips64vrel \ - | mips64orion | mips64orionel \ - | mips64vr4100 | mips64vr4100el \ - | mips64vr4300 | mips64vr4300el \ - | mips64vr5000 | mips64vr5000el \ - | mips64vr5900 | mips64vr5900el \ - | mipsisa32 | mipsisa32el \ - | mipsisa32r2 | mipsisa32r2el \ - | mipsisa64 | mipsisa64el \ - | mipsisa64r2 | mipsisa64r2el \ - | mipsisa64sb1 | mipsisa64sb1el \ - | mipsisa64sr71k | mipsisa64sr71kel \ - | mipstx39 | mipstx39el \ - | mn10200 | mn10300 \ - | mt \ - | msp430 \ - | nios | nios2 \ - | ns16k | ns32k \ - | or32 \ - | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ - | pyramid \ - | score \ - | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ - | sh64 | sh64le \ - | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ - | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ - | spu | strongarm \ - | tahoe | thumb | tic4x | tic80 | tron \ - | v850 | v850e \ - | we32k \ - | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ - | z8k) - basic_machine=$basic_machine-unknown - ;; - m6811 | m68hc11 | m6812 | m68hc12) - # Motorola 68HC11/12. - basic_machine=$basic_machine-unknown - os=-none - ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) - ;; - ms1) - basic_machine=mt-unknown - ;; - - # We use `pc' rather than `unknown' - # because (1) that's what they normally are, and - # (2) the word "unknown" tends to confuse beginning users. - i*86 | x86_64) - basic_machine=$basic_machine-pc - ;; - # Object if more than one company name word. - *-*-*) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; - # Recognize the basic CPU types with company name. - 580-* \ - | a29k-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ - | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ - | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* | avr32-* \ - | bfin-* | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ - | clipper-* | craynv-* | cydra-* \ - | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ - | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ - | h8300-* | h8500-* \ - | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ - | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* | iq2000-* \ - | m32c-* | m32r-* | m32rle-* \ - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* \ - | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ - | mips16-* \ - | mips64-* | mips64el-* \ - | mips64vr-* | mips64vrel-* \ - | mips64orion-* | mips64orionel-* \ - | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* \ - | mips64vr5000-* | mips64vr5000el-* \ - | mips64vr5900-* | mips64vr5900el-* \ - | mipsisa32-* | mipsisa32el-* \ - | mipsisa32r2-* | mipsisa32r2el-* \ - | mipsisa64-* | mipsisa64el-* \ - | mipsisa64r2-* | mipsisa64r2el-* \ - | mipsisa64sb1-* | mipsisa64sb1el-* \ - | mipsisa64sr71k-* | mipsisa64sr71kel-* \ - | mipstx39-* | mipstx39el-* \ - | mmix-* \ - | mt-* \ - | msp430-* \ - | nios-* | nios2-* \ - | none-* | np1-* | ns16k-* | ns32k-* \ - | orion-* \ - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ - | pyramid-* \ - | romp-* | rs6000-* \ - | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ - | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ - | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ - | tahoe-* | thumb-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ - | tron-* \ - | v850-* | v850e-* | vax-* \ - | we32k-* \ - | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ - | xstormy16-* | xtensa-* \ - | ymp-* \ - | z8k-*) - ;; - # Recognize the various machine names and aliases which stand - # for a CPU type and a company and sometimes even an OS. - 386bsd) - basic_machine=i386-unknown - os=-bsd - ;; - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - basic_machine=m68000-att - ;; - 3b*) - basic_machine=we32k-att - ;; - a29khif) - basic_machine=a29k-amd - os=-udi - ;; - abacus) - basic_machine=abacus-unknown - ;; - adobe68k) - basic_machine=m68010-adobe - os=-scout - ;; - alliant | fx80) - basic_machine=fx80-alliant - ;; - altos | altos3068) - basic_machine=m68k-altos - ;; - am29k) - basic_machine=a29k-none - os=-bsd - ;; - amd64) - basic_machine=x86_64-pc - ;; - amd64-*) - basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - amdahl) - basic_machine=580-amdahl - os=-sysv - ;; - amiga | amiga-*) - basic_machine=m68k-unknown - ;; - amigaos | amigados) - basic_machine=m68k-unknown - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - os=-sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=-sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - os=-bsd - ;; - aux) - basic_machine=m68k-apple - os=-aux - ;; - balance) - basic_machine=ns32k-sequent - os=-dynix - ;; - c90) - basic_machine=c90-cray - os=-unicos - ;; - convex-c1) - basic_machine=c1-convex - os=-bsd - ;; - convex-c2) - basic_machine=c2-convex - os=-bsd - ;; - convex-c32) - basic_machine=c32-convex - os=-bsd - ;; - convex-c34) - basic_machine=c34-convex - os=-bsd - ;; - convex-c38) - basic_machine=c38-convex - os=-bsd - ;; - cray | j90) - basic_machine=j90-cray - os=-unicos - ;; - craynv) - basic_machine=craynv-cray - os=-unicosmp - ;; - cr16) - basic_machine=cr16-unknown - os=-elf - ;; - crds | unos) - basic_machine=m68k-crds - ;; - crisv32 | crisv32-* | etraxfs*) - basic_machine=crisv32-axis - ;; - cris | cris-* | etrax*) - basic_machine=cris-axis - ;; - crx) - basic_machine=crx-unknown - os=-elf - ;; - da30 | da30-*) - basic_machine=m68k-da30 - ;; - decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) - basic_machine=mips-dec - ;; - decsystem10* | dec10*) - basic_machine=pdp10-dec - os=-tops10 - ;; - decsystem20* | dec20*) - basic_machine=pdp10-dec - os=-tops20 - ;; - delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - basic_machine=m68k-motorola - ;; - delta88) - basic_machine=m88k-motorola - os=-sysv3 - ;; - djgpp) - basic_machine=i586-pc - os=-msdosdjgpp - ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx - ;; - dpx2* | dpx2*-bull) - basic_machine=m68k-bull - os=-sysv3 - ;; - ebmon29k) - basic_machine=a29k-amd - os=-ebmon - ;; - elxsi) - basic_machine=elxsi-elxsi - os=-bsd - ;; - encore | umax | mmax) - basic_machine=ns32k-encore - ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=-ose - ;; - fx2800) - basic_machine=i860-alliant - ;; - genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - go32) - basic_machine=i386-pc - os=-go32 - ;; - h3050r* | hiux*) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=-hms - ;; - h8300xray) - basic_machine=h8300-hitachi - os=-xray - ;; - h8500hms) - basic_machine=h8500-hitachi - os=-hms - ;; - harris) - basic_machine=m88k-harris - os=-sysv3 - ;; - hp300-*) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=-bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=-hpux - ;; - hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k2[0-9][0-9] | hp9k31[0-9]) - basic_machine=m68000-hp - ;; - hp9k3[2-9][0-9]) - basic_machine=m68k-hp - ;; - hp9k6[0-9][0-9] | hp6[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k7[0-79][0-9] | hp7[0-79][0-9]) - basic_machine=hppa1.1-hp - ;; - hp9k78[0-9] | hp78[0-9]) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][13679] | hp8[0-9][13679]) - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][0-9] | hp8[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hppa-next) - os=-nextstep3 - ;; - hppaosf) - basic_machine=hppa1.1-hp - os=-osf - ;; - hppro) - basic_machine=hppa1.1-hp - os=-proelf - ;; - i370-ibm* | ibm*) - basic_machine=i370-ibm - ;; -# I'm not sure what "Sysv32" means. Should this be sysv3.2? - i*86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv32 - ;; - i*86v4*) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv4 - ;; - i*86v) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv - ;; - i*86sol2) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-solaris2 - ;; - i386mach) - basic_machine=i386-mach - os=-mach - ;; - i386-vsta | vsta) - basic_machine=i386-unknown - os=-vsta - ;; - iris | iris4d) - basic_machine=mips-sgi - case $os in - -irix*) - ;; - *) - os=-irix4 - ;; - esac - ;; - isi68 | isi) - basic_machine=m68k-isi - os=-sysv - ;; - m88k-omron*) - basic_machine=m88k-omron - ;; - magnum | m3230) - basic_machine=mips-mips - os=-sysv - ;; - merlin) - basic_machine=ns32k-utek - os=-sysv - ;; - mingw32) - basic_machine=i386-pc - os=-mingw32 - ;; - mingw32ce) - basic_machine=arm-unknown - os=-mingw32ce - ;; - miniframe) - basic_machine=m68000-convergent - ;; - *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; - mips3*-*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown - ;; - monitor) - basic_machine=m68k-rom68k - os=-coff - ;; - morphos) - basic_machine=powerpc-unknown - os=-morphos - ;; - msdos) - basic_machine=i386-pc - os=-msdos - ;; - ms1-*) - basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` - ;; - mvs) - basic_machine=i370-ibm - os=-mvs - ;; - ncr3000) - basic_machine=i486-ncr - os=-sysv4 - ;; - netbsd386) - basic_machine=i386-unknown - os=-netbsd - ;; - netwinder) - basic_machine=armv4l-rebel - os=-linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - os=-newsos - ;; - news1000) - basic_machine=m68030-sony - os=-newsos - ;; - news-3600 | risc-news) - basic_machine=mips-sony - os=-newsos - ;; - necv70) - basic_machine=v70-nec - os=-sysv - ;; - next | m*-next ) - basic_machine=m68k-next - case $os in - -nextstep* ) - ;; - -ns2*) - os=-nextstep2 - ;; - *) - os=-nextstep3 - ;; - esac - ;; - nh3000) - basic_machine=m68k-harris - os=-cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=-cxux - ;; - nindy960) - basic_machine=i960-intel - os=-nindy - ;; - mon960) - basic_machine=i960-intel - os=-mon960 - ;; - nonstopux) - basic_machine=mips-compaq - os=-nonstopux - ;; - np1) - basic_machine=np1-gould - ;; - nsr-tandem) - basic_machine=nsr-tandem - ;; - op50n-* | op60c-*) - basic_machine=hppa1.1-oki - os=-proelf - ;; - openrisc | openrisc-*) - basic_machine=or32-unknown - ;; - os400) - basic_machine=powerpc-ibm - os=-os400 - ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - os=-ose - ;; - os68k) - basic_machine=m68k-none - os=-os68k - ;; - pa-hitachi) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - paragon) - basic_machine=i860-intel - os=-osf - ;; - pbd) - basic_machine=sparc-tti - ;; - pbb) - basic_machine=m68k-tti - ;; - pc532 | pc532-*) - basic_machine=ns32k-pc532 - ;; - pc98) - basic_machine=i386-pc - ;; - pc98-*) - basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium | p5 | k5 | k6 | nexgen | viac3) - basic_machine=i586-pc - ;; - pentiumpro | p6 | 6x86 | athlon | athlon_*) - basic_machine=i686-pc - ;; - pentiumii | pentium2 | pentiumiii | pentium3) - basic_machine=i686-pc - ;; - pentium4) - basic_machine=i786-pc - ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumpro-* | p6-* | 6x86-* | athlon-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium4-*) - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pn) - basic_machine=pn-gould - ;; - power) basic_machine=power-ibm - ;; - ppc) basic_machine=powerpc-unknown - ;; - ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppcle | powerpclittle | ppc-le | powerpc-little) - basic_machine=powerpcle-unknown - ;; - ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64) basic_machine=powerpc64-unknown - ;; - ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) - basic_machine=powerpc64le-unknown - ;; - ppc64le-* | powerpc64little-*) - basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ps2) - basic_machine=i386-ibm - ;; - pw32) - basic_machine=i586-unknown - os=-pw32 - ;; - rdos) - basic_machine=i386-pc - os=-rdos - ;; - rom68k) - basic_machine=m68k-rom68k - os=-coff - ;; - rm[46]00) - basic_machine=mips-siemens - ;; - rtpc | rtpc-*) - basic_machine=romp-ibm - ;; - s390 | s390-*) - basic_machine=s390-ibm - ;; - s390x | s390x-*) - basic_machine=s390x-ibm - ;; - sa29200) - basic_machine=a29k-amd - os=-udi - ;; - sb1) - basic_machine=mipsisa64sb1-unknown - ;; - sb1el) - basic_machine=mipsisa64sb1el-unknown - ;; - sde) - basic_machine=mipsisa32-sde - os=-elf - ;; - sei) - basic_machine=mips-sei - os=-seiux - ;; - sequent) - basic_machine=i386-sequent - ;; - sh) - basic_machine=sh-hitachi - os=-hms - ;; - sh5el) - basic_machine=sh5le-unknown - ;; - sh64) - basic_machine=sh64-unknown - ;; - sparclite-wrs | simso-wrs) - basic_machine=sparclite-wrs - os=-vxworks - ;; - sps7) - basic_machine=m68k-bull - os=-sysv2 - ;; - spur) - basic_machine=spur-unknown - ;; - st2000) - basic_machine=m68k-tandem - ;; - stratus) - basic_machine=i860-stratus - os=-sysv4 - ;; - sun2) - basic_machine=m68000-sun - ;; - sun2os3) - basic_machine=m68000-sun - os=-sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - os=-sunos4 - ;; - sun3os3) - basic_machine=m68k-sun - os=-sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - os=-sunos4 - ;; - sun4os3) - basic_machine=sparc-sun - os=-sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - os=-sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - os=-solaris2 - ;; - sun3 | sun3-*) - basic_machine=m68k-sun - ;; - sun4) - basic_machine=sparc-sun - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - ;; - sv1) - basic_machine=sv1-cray - os=-unicos - ;; - symmetry) - basic_machine=i386-sequent - os=-dynix - ;; - t3e) - basic_machine=alphaev5-cray - os=-unicos - ;; - t90) - basic_machine=t90-cray - os=-unicos - ;; - tic54x | c54x*) - basic_machine=tic54x-unknown - os=-coff - ;; - tic55x | c55x*) - basic_machine=tic55x-unknown - os=-coff - ;; - tic6x | c6x*) - basic_machine=tic6x-unknown - os=-coff - ;; - tx39) - basic_machine=mipstx39-unknown - ;; - tx39el) - basic_machine=mipstx39el-unknown - ;; - toad1) - basic_machine=pdp10-xkl - os=-tops20 - ;; - tower | tower-32) - basic_machine=m68k-ncr - ;; - tpf) - basic_machine=s390x-ibm - os=-tpf - ;; - udi29k) - basic_machine=a29k-amd - os=-udi - ;; - ultra3) - basic_machine=a29k-nyu - os=-sym1 - ;; - v810 | necv810) - basic_machine=v810-nec - os=-none - ;; - vaxv) - basic_machine=vax-dec - os=-sysv - ;; - vms) - basic_machine=vax-dec - os=-vms - ;; - vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; - vxworks960) - basic_machine=i960-wrs - os=-vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - os=-vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - os=-vxworks - ;; - w65*) - basic_machine=w65-wdc - os=-none - ;; - w89k-*) - basic_machine=hppa1.1-winbond - os=-proelf - ;; - xbox) - basic_machine=i686-pc - os=-mingw32 - ;; - xps | xps100) - basic_machine=xps100-honeywell - ;; - ymp) - basic_machine=ymp-cray - os=-unicos - ;; - z8k-*-coff) - basic_machine=z8k-unknown - os=-sim - ;; - none) - basic_machine=none-none - os=-none - ;; - -# Here we handle the default manufacturer of certain CPU types. It is in -# some cases the only manufacturer, in others, it is the most popular. - w89k) - basic_machine=hppa1.1-winbond - ;; - op50n) - basic_machine=hppa1.1-oki - ;; - op60c) - basic_machine=hppa1.1-oki - ;; - romp) - basic_machine=romp-ibm - ;; - mmix) - basic_machine=mmix-knuth - ;; - rs6000) - basic_machine=rs6000-ibm - ;; - vax) - basic_machine=vax-dec - ;; - pdp10) - # there are many clones, so DEC is not a safe bet - basic_machine=pdp10-unknown - ;; - pdp11) - basic_machine=pdp11-dec - ;; - we32k) - basic_machine=we32k-att - ;; - sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) - basic_machine=sh-unknown - ;; - sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) - basic_machine=sparc-sun - ;; - cydra) - basic_machine=cydra-cydrome - ;; - orion) - basic_machine=orion-highlevel - ;; - orion105) - basic_machine=clipper-highlevel - ;; - mac | mpw | mac-mpw) - basic_machine=m68k-apple - ;; - pmac | pmac-mpw) - basic_machine=powerpc-apple - ;; - *-unknown) - # Make sure to match an already-canonicalized machine name. - ;; - *) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; -esac - -# Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` - ;; - *-commodore*) - basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` - ;; - *) - ;; -esac - -# Decode manufacturer-specific aliases for certain operating systems. - -if [ x"$os" != x"" ] -then -case $os in - # First match some system type aliases - # that might get confused with valid system types. - # -solaris* is a basic system type, with this one exception. - -solaris1 | -solaris1.*) - os=`echo $os | sed -e 's|solaris1|sunos4|'` - ;; - -solaris) - os=-solaris2 - ;; - -svr4*) - os=-sysv4 - ;; - -unixware*) - os=-sysv4.2uw - ;; - -gnu/linux*) - os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` - ;; - # First accept the basic system types. - # The portable systems comes first. - # Each alternative MUST END IN A *, to match a version number. - # -sysv* is not here because it comes later, after sysvr4. - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -openbsd* | -solidbsd* \ - | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ - | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ - | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* \ - | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* \ - | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ - | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ - | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ - | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ - | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ - | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops*) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - -qnx*) - case $basic_machine in - x86-* | i*86-*) - ;; - *) - os=-nto$os - ;; - esac - ;; - -nto-qnx*) - ;; - -nto*) - os=`echo $os | sed -e 's|nto|nto-qnx|'` - ;; - -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ - | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) - ;; - -mac*) - os=`echo $os | sed -e 's|mac|macos|'` - ;; - -linux-dietlibc) - os=-linux-dietlibc - ;; - -linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; - -sunos5*) - os=`echo $os | sed -e 's|sunos5|solaris2|'` - ;; - -sunos6*) - os=`echo $os | sed -e 's|sunos6|solaris3|'` - ;; - -opened*) - os=-openedition - ;; - -os400*) - os=-os400 - ;; - -wince*) - os=-wince - ;; - -osfrose*) - os=-osfrose - ;; - -osf*) - os=-osf - ;; - -utek*) - os=-bsd - ;; - -dynix*) - os=-bsd - ;; - -acis*) - os=-aos - ;; - -atheos*) - os=-atheos - ;; - -syllable*) - os=-syllable - ;; - -386bsd) - os=-bsd - ;; - -ctix* | -uts*) - os=-sysv - ;; - -nova*) - os=-rtmk-nova - ;; - -ns2 ) - os=-nextstep2 - ;; - -nsk*) - os=-nsk - ;; - # Preserve the version number of sinix5. - -sinix5.*) - os=`echo $os | sed -e 's|sinix|sysv|'` - ;; - -sinix*) - os=-sysv4 - ;; - -tpf*) - os=-tpf - ;; - -triton*) - os=-sysv3 - ;; - -oss*) - os=-sysv3 - ;; - -svr4) - os=-sysv4 - ;; - -svr3) - os=-sysv3 - ;; - -sysvr4) - os=-sysv4 - ;; - # This must come after -sysvr4. - -sysv*) - ;; - -ose*) - os=-ose - ;; - -es1800*) - os=-ose - ;; - -xenix) - os=-xenix - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - os=-mint - ;; - -aros*) - os=-aros - ;; - -kaos*) - os=-kaos - ;; - -zvmoe) - os=-zvmoe - ;; - -none) - ;; - *) - # Get rid of the `-' at the beginning of $os. - os=`echo $os | sed 's/[^-]*-//'` - echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 - exit 1 - ;; -esac -else - -# Here we handle the default operating systems that come with various machines. -# The value should be what the vendor currently ships out the door with their -# machine or put another way, the most popular os provided with the machine. - -# Note that if you're going to try to match "-MANUFACTURER" here (say, -# "-sun"), then you have to tell the case statement up towards the top -# that MANUFACTURER isn't an operating system. Otherwise, code above -# will signal an error saying that MANUFACTURER isn't an operating -# system, and we'll never get to this point. - -case $basic_machine in - score-*) - os=-elf - ;; - spu-*) - os=-elf - ;; - *-acorn) - os=-riscix1.2 - ;; - arm*-rebel) - os=-linux - ;; - arm*-semi) - os=-aout - ;; - c4x-* | tic4x-*) - os=-coff - ;; - # This must come before the *-dec entry. - pdp10-*) - os=-tops20 - ;; - pdp11-*) - os=-none - ;; - *-dec | vax-*) - os=-ultrix4.2 - ;; - m68*-apollo) - os=-domain - ;; - i386-sun) - os=-sunos4.0.2 - ;; - m68000-sun) - os=-sunos3 - # This also exists in the configure program, but was not the - # default. - # os=-sunos4 - ;; - m68*-cisco) - os=-aout - ;; - mep-*) - os=-elf - ;; - mips*-cisco) - os=-elf - ;; - mips*-*) - os=-elf - ;; - or32-*) - os=-coff - ;; - *-tti) # must be before sparc entry or we get the wrong os. - os=-sysv3 - ;; - sparc-* | *-sun) - os=-sunos4.1.1 - ;; - *-be) - os=-beos - ;; - *-haiku) - os=-haiku - ;; - *-ibm) - os=-aix - ;; - *-knuth) - os=-mmixware - ;; - *-wec) - os=-proelf - ;; - *-winbond) - os=-proelf - ;; - *-oki) - os=-proelf - ;; - *-hp) - os=-hpux - ;; - *-hitachi) - os=-hiux - ;; - i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv - ;; - *-cbm) - os=-amigaos - ;; - *-dg) - os=-dgux - ;; - *-dolphin) - os=-sysv3 - ;; - m68k-ccur) - os=-rtu - ;; - m88k-omron*) - os=-luna - ;; - *-next ) - os=-nextstep - ;; - *-sequent) - os=-ptx - ;; - *-crds) - os=-unos - ;; - *-ns) - os=-genix - ;; - i370-*) - os=-mvs - ;; - *-next) - os=-nextstep3 - ;; - *-gould) - os=-sysv - ;; - *-highlevel) - os=-bsd - ;; - *-encore) - os=-bsd - ;; - *-sgi) - os=-irix - ;; - *-siemens) - os=-sysv4 - ;; - *-masscomp) - os=-rtu - ;; - f30[01]-fujitsu | f700-fujitsu) - os=-uxpv - ;; - *-rom68k) - os=-coff - ;; - *-*bug) - os=-coff - ;; - *-apple) - os=-macos - ;; - *-atari*) - os=-mint - ;; - *) - os=-none - ;; -esac -fi - -# Here we handle the case where we know the os, and the CPU type, but not the -# manufacturer. We pick the logical manufacturer. -vendor=unknown -case $basic_machine in - *-unknown) - case $os in - -riscix*) - vendor=acorn - ;; - -sunos*) - vendor=sun - ;; - -aix*) - vendor=ibm - ;; - -beos*) - vendor=be - ;; - -hpux*) - vendor=hp - ;; - -mpeix*) - vendor=hp - ;; - -hiux*) - vendor=hitachi - ;; - -unos*) - vendor=crds - ;; - -dgux*) - vendor=dg - ;; - -luna*) - vendor=omron - ;; - -genix*) - vendor=ns - ;; - -mvs* | -opened*) - vendor=ibm - ;; - -os400*) - vendor=ibm - ;; - -ptx*) - vendor=sequent - ;; - -tpf*) - vendor=ibm - ;; - -vxsim* | -vxworks* | -windiss*) - vendor=wrs - ;; - -aux*) - vendor=apple - ;; - -hms*) - vendor=hitachi - ;; - -mpw* | -macos*) - vendor=apple - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - vendor=atari - ;; - -vos*) - vendor=stratus - ;; - esac - basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` - ;; -esac - -echo $basic_machine$os -exit - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/usrp2/firmware/config/.gitignore b/usrp2/firmware/config/.gitignore deleted file mode 100644 index b11bb113a..000000000 --- a/usrp2/firmware/config/.gitignore +++ /dev/null @@ -1,20 +0,0 @@ -/configure -/Makefile.in -/config.log -/config.h -/ltmain.sh -/Makefile -/config.status -/stamp-h1 -/config.h.in -/autom4te.cache -/libtool -/missing -/aclocal.m4 -/install-sh -/depcomp -/py-compile -/compile -/build -/run_tests.sh -/*-stamp diff --git a/usrp2/firmware/config/Makefile.am b/usrp2/firmware/config/Makefile.am deleted file mode 100644 index 06b15c68a..000000000 --- a/usrp2/firmware/config/Makefile.am +++ /dev/null @@ -1,33 +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 $(top_srcdir)/Makefile.common - -# Install m4 macros in this directory -m4datadir = $(datadir)/aclocal - -# List your m4 macros here -m4macros = \ - grc_build.m4 \ - grc_usrp2_stub.m4 \ - grc_usrp2_firmware.m4 - -EXTRA_DIST = $(m4macros) diff --git a/usrp2/firmware/config/grc_build.m4 b/usrp2/firmware/config/grc_build.m4 deleted file mode 100644 index bf33d0da2..000000000 --- a/usrp2/firmware/config/grc_build.m4 +++ /dev/null @@ -1,287 +0,0 @@ -dnl Copyright 2006,2008 Free Software Foundation, Inc. -dnl -dnl This file is part of GNU Radio -dnl -dnl GNU Radio is free software; you can redistribute it and/or modify -dnl it under the terms of the GNU General Public License as published by -dnl the Free Software Foundation; either version 3, or (at your option) -dnl any later version. -dnl -dnl GNU Radio is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -dnl GNU General Public License for more details. -dnl -dnl You should have received a copy of the GNU General Public License -dnl along with GNU Radio; see the file COPYING. If not, write to -dnl the Free Software Foundation, Inc., 51 Franklin Street, -dnl Boston, MA 02110-1301, USA. - -dnl Create --enable-foo argument for named component, create variables as needed -dnl $1 is component name -AC_DEFUN([GRC_ENABLE], [ - _GRC_ENABLE($1,m4_bpatsubst($1,-,_)) -]) -dnl $2 is the '_'d component name -dnl on exit variable enable_$2 will be set to [yes|no]; -dnl passed will be [yes|no] (same as enable_$2) - -AC_DEFUN([_GRC_ENABLE],[ - passed=yes - AC_ARG_ENABLE([$1], - AC_HELP_STRING([--enable-$1], - [Stop if $1 fails configuration]), - [],[ - [enable_]$2=$enable_all_components - if test x$enable_all_components = xno; then - passed=no - fi - ]) -]) -dnl Component specific configuration -dnl The order of the GR_ macros determines the order of compilation -dnl For -any- checks on $enable_all_components -dnl use the following guildlines: -dnl yes : --enable-all-components was specified, so error out if any -dnl components do not pass configuration checks. -dnl no : --disable-all-components was specified, so try to build the -dnl --enable'd components, and error out if any do not pass -dnl configuration checks. -dnl "" : this option was not specified on the command line; try to -dnl build all components that are not --with'd, but don't -dnl error out if any component does not pass configuration checks. -dnl -dnl For each --enable-foo component, if that flag is not specified on -dnl the command line, the related variable $enable_foo will be set to -dnl $enable_all_components . - -dnl Create --with-foo argument for named compoment, create variables as needed -dnl $1 is component name -dnl $2 is what to do on success -dnl $3 is the PKG_CONFIG name; if not given, then $1 -AC_DEFUN([GRC_WITH], [ - if test [x]$3 = x; then - pc_comp_name="$1" - else - pc_comp_name="$3" - fi - _GRC_WITH($1,[$2],${pc_comp_name},m4_bpatsubst($1,-,_)) -]) -dnl $3 is the pkg-config component name -dnl $4 is the '_'d component name -dnl on exit variable passed will be [yes|no|with]: -dnl yes: if --enable-$1 and/or --enable-all-components was specified, -dnl but --with was not; -dnl with: if --with-$1 was specified, and passed checks; -dnl no: all other conditions -AC_DEFUN([_GRC_WITH],[ - AC_ARG_WITH([$1], - AC_HELP_STRING([--with-$1@<:@=PATH@:>@], - [Use package $1 if installed in PATH (if specified) or PKG_CONFIG_PATH (if PATH not specified); stop if $1 not found]), - [if test "x$withval" != "xyes"; then - [with_]$4[_val]=$withval - [with_]$4=yes - fi], - []) - if test x$[with_]$4 = xyes; then - if test x$[enable_]$4 = xyes; then - AC_MSG_ERROR([Component $1: Cannot use both --enable and --with]) - else - _GRC_WITH_PKG_CONFIG_CHECK($1,$3,$4) - ifelse([$2], , :, [$2]) - fi - fi -]) - -dnl Use 'pkgconfig' to check for a package -dnl $1 is the --with component name -dnl $2 is the pkg-config component name, if provided; otherwise use $1 for this -dnl on success, resulting INCLUDES, INCLUDEDIR, LA, and LIBDIRPATH variables -dnl will be set; on failure, will exit with an error. -AC_DEFUN([GRC_WITH_PKG_CONFIG_CHECK], [ - if test [x]$2 = x; then - pc_comp_name="$1" - else - pc_comp_name="$2" - fi - _GRC_WITH_PKG_CONFIG_CHECK($1,${pc_comp_name},m4_bpatsubst($1,-,_)) -]) -dnl $2 is the pkg-config component name -dnl $3 is the '_'d component name -AC_DEFUN([_GRC_WITH_PKG_CONFIG_CHECK],[ - dnl save PKG_CONFIG_PATH, restore at the end - s_PKG_CONFIG_PATH=$PKG_CONFIG_PATH - - dnl create the PKG_CONFIG_PATH, via this component arg, if provided; - dnl else use the environment PKG_CONFIG_PATH - l_PKG_CONFIG_PATH=$[with_]$3[_val] - if test "x$l_PKG_CONFIG_PATH" != "x"; then - export PKG_CONFIG_PATH=$l_PKG_CONFIG_PATH - - dnl verify that the file exists; if not, no point in continuing - if ! test -r ${l_PKG_CONFIG_PATH}/$2[.pc]; then - AC_MSG_ERROR([Component $1: PKGCONFIG cannot find info for $2, with provided PKG_CONFIG_PATH = @<:@ $l_PKG_CONFIG_PATH @:>@ .]) - fi - fi - - dnl do the check; error out if not found - PKG_CHECK_EXISTS($2, [passed=with; check1=yes], [ - check1=no - dnl pkg-config returned an error; this might be that the .pc - dnl file was not valid, or the Requires: were not met. - dnl If the arg was provided and the input PKG_CONFIG_PATH , then try - dnl again appending the whole PKG_CONFIG_PATH. - if test "x$l_PKG_CONFIG_PATH" != "x"; then - if test "x$s_PKG_CONFIG_PATH" != "x"; then - export PKG_CONFIG_PATH=${PKG_CONFIG_PATH}:${s_PKG_CONFIG_PATH} - PKG_CHECK_EXISTS($2, passed=with, passed=no) - fi - fi - if test $passed != with; then - AC_MSG_ERROR([Component $1: PKGCONFIG cannot find info for $2, with PKG_CONFIG_PATH = @<:@ $PKG_CONFIG_PATH @:>@ .]) - fi - dnl pkg-config Requires are now met; save the new PKG_CONFIG_PATH - s_PKG_CONFIG_PATH=$PKG_CONFIG_PATH - ]) - - dnl if PKG_CHECK_EXISTS returned, then this component's .pc file was - dnl found in the provided 'arg' PKG_CONFIG_PATH; - dnl retrieve various parameters - $3[_INCLUDES]=`$PKG_CONFIG --cflags-only-I $2` - $3[_LA]=`$PKG_CONFIG --libs $2` - $3[_INCLUDEDIR]=`$PKG_CONFIG --variable=includedir $2` - - if test x$check1 = xyes; then - dnl prepend the args PKG_CONFIG_PATH to the saved one, if the - dnl saved version was not empty - if test "x$s_PKG_CONFIG_PATH" != "x"; then - export PKG_CONFIG_PATH=${PKG_CONFIG_PATH}:${s_PKG_CONFIG_PATH} - fi - fi -]) - -dnl Check the $prefix versus the --with libdirpath for this component -dnl $1 is the prefix -dnl $2 is the --with component name -dnl $3 is the --with component library path -AC_DEFUN([GRC_PREFIX_LDFLAGS],[ - $2[_LIBDIRPATH]=$3 - dnl create LDFLAGS for this --with, if different from the provided $prefix - if test [x]$1[/lib] != [x]$3; then - $2[_LDFLAG]=[-L]$3 - else - $2[_LDFLAG]= - fi -]) - -dnl Check to make sure this dependency is fulfilled for this component -dnl $1 is the component's name -dnl $2 is the component dependency name -dnl On input and exit, $passed will be: -dnl with : if --with passed muster -dnl yes : if --enable passed muster -dnl no : otherwise -dnl If trying --with, will error-out if any dependency was not --with'd -AC_DEFUN([GRC_CHECK_DEPENDENCY],[ -dnl f0=[enable_]m4_bpatsubst($1,-,_) -dnl f1=[$enable_]m4_bpatsubst($1,-,_) -dnl echo -dnl echo "$1 : Checking Dependency $2" -dnl echo "$1 : enable_all_components is '$enable_all_components'" -dnl echo "$1 : $f0 is '$f1'" -dnl echo "$1 : passed is '$passed'" -dnl echo - if test $passed != no; then - if test $passed = yes; then - dnl make sure this dependency was not skipped - if test [x$]m4_bpatsubst($2,-,_)[_skipped] = xyes; then - AC_MSG_RESULT([Component $1 requires $2, which is not being built or specified via pre-installed files.]) - passed=no - fi - else - dnl make sure this dependency was --with'd only; not --enable'd - if test [x$]m4_bpatsubst($2,-,_)[_with] = xno; then - AC_MSG_ERROR([Component $1 requires $2 to be included as --with-$1@<:@=arg@:>@]) - fi - fi - fi -]) - -dnl Check to make sure GUILE is available -dnl $1 is the component name -AC_DEFUN([GRC_CHECK_GUILE],[ - if test x"$GUILE" = x; then - AC_MSG_RESULT([Component $1 requires guile, which was not found.]) - passed=no - fi -]) - -dnl Add the specified "with" list; clear the provided variable -dnl $1 is the component name -dnl $2 is the path list name suffix -dnl $3 is the separator (for paths, ":"; for includes " ") -AC_DEFUN([GRC_ADD_TO_LIST],[ - if test "x${$1[_]$2}" != "x"; then - if test "x$[with_]$2" = "x"; then - [with_]$2="${$1[_]$2}" - else - [with_]$2="${$1[_]$2}"$3"$[with_]$2" - fi - $1[_]$2= - fi -]) - -dnl Conditionally build named component. -dnl $1 is component name -dnl $2 is executed if configuration passes and build is desired -AC_DEFUN([GRC_BUILD_CONDITIONAL],[ - _GRC_BUILD_CONDITIONAL($1, $2, m4_bpatsubst($1,-,_)) -]) -dnl $3=m4_bpatsubst($1,-,_) -dnl Use $passed=no to indicate configuration failure; -dnl Use $passed=with to indicate the use of pre-installed libraries and headers; -dnl Any other value of $passed, including blank, assumes success; -dnl Defines $3_with=[yes|no] depending on if $passed=with or not (respectively) -dnl Defines $3_skipped=[yes|no] depending on if $passed=no or not (respectively) -AC_DEFUN([_GRC_BUILD_CONDITIONAL],[ - $3[_with]=no - if test $passed = no; then - if test x$[enable_]$3 = xyes; then - AC_MSG_ERROR([Component $1 has errors; stopping.]) - else - AC_MSG_RESULT([Not building component $1.]) - fi - else - if test $passed = with; then - with_dirs="$with_dirs $1" - GRC_ADD_TO_LIST($3, INCLUDES, " ") - GRC_ADD_TO_LIST($3, SWIG_INCLUDES, " ") - GRC_ADD_TO_LIST($3, PYDIRPATH, ":") - GRC_ADD_TO_LIST($3, SWIGDIRPATH, ":") - GRC_ADD_TO_LIST($3, LIBDIRPATH, ":") - AC_MSG_RESULT([Component $1 will be included from a pre-installed library and includes.]) - $3[_with]=yes - else - $3[_LDFLAG]= - if test x$[enable_]$3 != xno; then - ifelse([$2], , :, [$2]) - build_dirs="$build_dirs $1" - AC_MSG_RESULT([Component $1 passed configuration checks; building.]) - else - passed=no - AC_MSG_RESULT([Component $1 passed configuration checks; but not building.]) - fi - fi - fi - if test $passed = no; then - skipped_dirs="$skipped_dirs $1" - $3[_skipped]=yes - else - $3[_skipped]=no - fi - AC_SUBST($3[_INCLUDES]) - AC_SUBST($3[_LA]) - AC_SUBST($3[_INCLUDEDIR]) - AC_SUBST($3[_LIBDIRPATH]) - AC_SUBST($3[_LDFLAG]) -]) diff --git a/usrp2/firmware/config/grc_usrp2_firmware.m4 b/usrp2/firmware/config/grc_usrp2_firmware.m4 deleted file mode 100644 index 53ff03ce4..000000000 --- a/usrp2/firmware/config/grc_usrp2_firmware.m4 +++ /dev/null @@ -1,76 +0,0 @@ -dnl Copyright 2008 Free Software Foundation, Inc. -dnl -dnl This file is part of GNU Radio -dnl -dnl GNU Radio is free software; you can redistribute it and/or modify -dnl it under the terms of the GNU General Public License as published by -dnl the Free Software Foundation; either version 3, or (at your option) -dnl any later version. -dnl -dnl GNU Radio is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -dnl GNU General Public License for more details. -dnl -dnl You should have received a copy of the GNU General Public License -dnl along with GNU Radio; see the file COPYING. If not, write to -dnl the Free Software Foundation, Inc., 51 Franklin Street, -dnl Boston, MA 02110-1301, USA. - -dnl Fix 2.64 cross compile detection for AVR and RTEMS -dnl by not trying to compile fopen. -m4_if(m4_defn([m4_PACKAGE_VERSION]), [2.64], - [m4_foreach([_GCC_LANG], [C, C++, Fortran, Fortran 77], - [m4_define([_AC_LANG_IO_PROGRAM(]_GCC_LANG[)], m4_defn([AC_LANG_PROGRAM(]_GCC_LANG[)]))])]) - -AC_DEFUN([GRC_USRP2_FIRMWARE],[ - dnl we use --enable-usrp2-firmware to enable this - GRC_ENABLE(usrp2-firmware) - - GRC_CHECK_DEPENDENCY(usrp2-firmware, usrp2) - - AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([AC_PROG_CPP]) - AC_REQUIRE([AM_PROG_AS]) - AC_REQUIRE([AC_PROG_RANLIB]) - - - AC_CHECK_HEADERS(arpa/inet.h netinet/in.h byteswap.h) - AC_C_BIGENDIAN - - dnl If execution gets to here, $passed will be: - dnl with : if the --with code didn't error out - dnl yes : if the --enable code passed muster and all dependencies are met - dnl no : otherwise - if test $passed = yes; then - - dnl Only do firmware if mb-gcc can be found - AC_CHECK_PROG([MB_GCC],[mb-gcc],[yes],[no]) - if test $MB_GCC = no; then - AC_MSG_RESULT([usrp2 firmware requires mb-gcc. Not found]) - passed=no - fi - fi - if test $passed != with; then - dnl how and where to find INCLUDES and LA - dnl USRP2_INCLUDES="-I\${abs_top_srcdir}/usrp2/host/include \ - dnl -I\${abs_top_srcdir}/usrp2/firmware/include" - dnl USRP2_LA="\${abs_top_builddir}/usrp2/host/lib/libusrp2.la" - : - fi - - dnl Include the usrp2 INCLUDES and LA - dnl AC_SUBST(USRP2_INCLUDES) - dnl AC_SUBST(USRP2_LA) - - AC_CONFIG_FILES([ \ - apps/Makefile \ - include/Makefile \ - lib/Makefile \ - ]) - - dnl Slightly non-standard: we handle this with an AM_CONDITIONAL - AM_CONDITIONAL(BUILDING_USRP2_FIRMWARE, [test $passed = yes && test "$enable_usrp2_firmware" != no]) - - GRC_BUILD_CONDITIONAL(usrp2-firmware) -]) diff --git a/usrp2/firmware/config/grc_usrp2_stub.m4 b/usrp2/firmware/config/grc_usrp2_stub.m4 deleted file mode 100644 index 57aa86c08..000000000 --- a/usrp2/firmware/config/grc_usrp2_stub.m4 +++ /dev/null @@ -1,23 +0,0 @@ -dnl Copyright 2008 Free Software Foundation, Inc. -dnl -dnl This file is part of GNU Radio -dnl -dnl GNU Radio is free software; you can redistribute it and/or modify -dnl it under the terms of the GNU General Public License as published by -dnl the Free Software Foundation; either version 3, or (at your option) -dnl any later version. -dnl -dnl GNU Radio is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -dnl GNU General Public License for more details. -dnl -dnl You should have received a copy of the GNU General Public License -dnl along with GNU Radio; see the file COPYING. If not, write to -dnl the Free Software Foundation, Inc., 51 Franklin Street, -dnl Boston, MA 02110-1301, USA. - -AC_DEFUN([GRC_USRP2_STUB],[ - GRC_ENABLE(usrp2) - GRC_BUILD_CONDITIONAL(usrp2) -]) diff --git a/usrp2/firmware/configure.ac b/usrp2/firmware/configure.ac deleted file mode 100644 index f3ff0cd80..000000000 --- a/usrp2/firmware/configure.ac +++ /dev/null @@ -1,162 +0,0 @@ -dnl -dnl Copyright 2007,2008 Free Software Foundation, Inc. -dnl -dnl This program is free software: you can redistribute it and/or modify -dnl it under the terms of the GNU General Public License as published by -dnl the Free Software Foundation, either version 3 of the License, or -dnl (at your option) any later version. -dnl -dnl This program is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -dnl GNU General Public License for more details. -dnl -dnl You should have received a copy of the GNU General Public License -dnl along with this program. If not, see <http://www.gnu.org/licenses/>. -dnl - -AC_INIT -AC_PREREQ(2.57) -AM_CONFIG_HEADER(config.h) -AC_CONFIG_AUX_DIR([.]) -AC_CONFIG_SRCDIR([lib/u2_init.c]) - -AM_INIT_AUTOMAKE(usrp2-firmware,0.0svn) - -dnl Component specific configuration -dnl The order of the GR_ macros determines the order of compilation -dnl For -any- checks on $enable_all_components -dnl use the following guidelines: -dnl yes : --enable-all-components was specified, so error out if any -dnl components do not pass configuration checks. -dnl no : --disable-all-components was specified, so try to build the -dnl --enable'd components, and error out if any do not pass -dnl configuration checks. -dnl "" : this option was not specified on the command line; try to -dnl build all components that are not --with'd, but don't -dnl error out if any component does not pass configuration checks. -dnl -dnl For each --enable-foo component, if that flag is not specified on -dnl the command line, the related variable $enable_foo will be set to -dnl $enable_all_components . - -AC_ARG_ENABLE( - [all-components], - [ --enable-all-components Build all configurable components (default), or stop on failed dependencies] -) - -#build_dirs="config" -build_dirs= -GRC_USRP2_STUB -GRC_USRP2_FIRMWARE - - -# Each component is now either to be built, was skipped, will be -# included from pre-installed libraries and includes, or failed -# dependencies. -AC_SUBST([build_dirs], [$build_dirs]) -AC_SUBST([skipped_dirs], [$skipped_dirs]) -AC_SUBST([with_dirs], [$with_dirs]) - -# fix for older autotools that don't define "abs_top_YYY" by default -AC_SUBST(abs_top_srcdir) -AC_SUBST(abs_top_builddir) - -# 'with' variables - the pre-installed libraries, includes, and paths -# - must always come last in the lists, so they require special -# treatment. -AC_SUBST(with_INCLUDES) -AC_SUBST(with_SWIG_INCLUDES) -AC_SUBST(with_PYDIRPATH) -AC_SUBST(with_SWIGDIRPATH) -AC_SUBST(with_LIBDIRPATH) - -AC_CONFIG_FILES([ \ - Makefile \ - config/Makefile \ -]) - -AC_OUTPUT - -# -# trim usrp2 out of dirs; we only use it as a controlling dependency -# -t= -for d in $build_dirs -do - if test $d != usrp2; then - if test -z "$t"; then - t="$d" - else - t="$t $d" - fi - fi -done -build_dirs=$t - -t= -for d in $skipped_dirs -do - if test $d != usrp2; then - if test -z "$t"; then - t="$d" - else - t="$t $d" - fi - fi -done -skipped_dirs=$t - -t= -for d in $with_dirs -do - if test $d != usrp2; then - if test -z "$t"; then - t="$d" - else - t="$t $d" - fi - fi -done -with_dirs=$t - -if test "$build_dirs" != ""; then - echo - echo "*********************************************************************" - echo The following GNU Radio components have been successfully configured: - echo - for dir in $build_dirs - do - echo $dir - done - echo - echo You my now run the 'make' command to build these components. - echo -fi - -if test "$skipped_dirs" != ""; then - echo "*********************************************************************" - echo The following components were skipped either because you asked not - echo to build them or they didn\'t pass configuration checks: - echo - for dir in $skipped_dirs - do - echo $dir - done - echo - echo These components will not be built. - echo -fi -if test "$with_dirs" != ""; then - echo "*********************************************************************" - echo The following components will be included from pre-installed - echo libraries and includes: - echo - for dir in $with_dirs - do - echo $dir - done - echo - echo These components will not be built. - echo -fi diff --git a/usrp2/firmware/configure.gnu b/usrp2/firmware/configure.gnu deleted file mode 100755 index 53ca9b518..000000000 --- a/usrp2/firmware/configure.gnu +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh -# -# wrapper to setup cross-compilation of firmware -# - -for v in CC CPP CXX AS AR NM RANLIB STRIP F77 CFLAGS CXXFLAGS CPPFLAGS LDFLAGS CCAS CCASFLAGS USB_LIBS USB_CFLAGS -do - unset $v -done - -args= -for t in "$@" -do - case "$t" in - (CC=*) ;; - (CPP=*) ;; - (CXX=*) ;; - (AR=*) ;; - (AS=*) ;; - (NM=*) ;; - (RANLIB=*) ;; - (STRIP=*) ;; - (F77=*) ;; - (FFLAGS=*) ;; - (CFLAGS=*) ;; - (CXXFLAGS=*) ;; - (CPPFLAGS=*) ;; - (LDFLAGS=*) ;; - (CCAS=*) ;; - (CCASFLAGS=*) ;; - (USB_CFLAGS=*) ;; - (USB_LIBS=*) ;; - (*) args="$args $t" ;; - esac -done - - -`dirname $0`/configure CFLAGS='-O2' $args --host=mb diff --git a/usrp2/firmware/divisors.py b/usrp2/firmware/divisors.py deleted file mode 100755 index d31bd4dad..000000000 --- a/usrp2/firmware/divisors.py +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env python - -speeds = (9600, 19200, 38400, 57600, 115200, 230400) - -master_clk = 100e6 -wb_clk = master_clk / 2 - -def divisor(speed): - div0 = wb_clk // (speed * 16) - div1 = div0 + 1 - actual0 = actual_speed(div0) - actual1 = actual_speed(div1) - if abs(actual0 - speed) < abs(actual1 - speed): - return div0 - else: - return div1 - -def actual_speed(divisor): - return (wb_clk // divisor) / 16 - -def doit(speed): - div = divisor(speed) - actual = actual_speed(div) - rel_error = (actual - speed) / speed - print "target: %6d divisor: %6d actual: %11.4f %6.3f%%" % (speed, div, actual, rel_error*100) - -def main(): - print "wb_clk = %f" % (wb_clk,) - for s in speeds: - doit(s) - -if __name__ == '__main__': - main() - diff --git a/usrp2/firmware/include/.gitignore b/usrp2/firmware/include/.gitignore deleted file mode 100644 index b336cc7ce..000000000 --- a/usrp2/firmware/include/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/Makefile -/Makefile.in diff --git a/usrp2/firmware/include/Makefile.am b/usrp2/firmware/include/Makefile.am deleted file mode 100644 index a5e339191..000000000 --- a/usrp2/firmware/include/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -# -# Copyright 2008 Free Software Foundation, Inc. -# -# This program 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 of the License, or -# (at your option) any later version. -# -# This program 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/>. -# - -include $(top_srcdir)/Makefile.common - -noinst_HEADERS = \ - usrp2_cdefs.h \ - usrp2_eth_packet.h \ - usrp2_fpga_regs.h \ - usrp2_i2c_addr.h \ - usrp2_mac_addr.h \ - usrp2_mimo_config.h \ - usrp2_types.h diff --git a/usrp2/firmware/include/usrp2_cdefs.h b/usrp2/firmware/include/usrp2_cdefs.h deleted file mode 100644 index 71395cda8..000000000 --- a/usrp2/firmware/include/usrp2_cdefs.h +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef INCLUDED_USRP2_CDEFS_H -#define INCLUDED_USRP2_CDEFS_H - -/* C++ needs to know that types and declarations are C, not C++. */ -#ifdef __cplusplus -# define __U2_BEGIN_DECLS extern "C" { -# define __U2_END_DECLS } -#else -# define __U2_BEGIN_DECLS -# define __U2_END_DECLS -#endif - -#endif /* INCLUDED_USRP2_CDEFS_H */ diff --git a/usrp2/firmware/include/usrp2_eth_packet.h b/usrp2/firmware/include/usrp2_eth_packet.h deleted file mode 100644 index 2f24556f0..000000000 --- a/usrp2/firmware/include/usrp2_eth_packet.h +++ /dev/null @@ -1,500 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2008,2009,2010 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifndef INCLUDED_USRP2_ETH_PACKET_H -#define INCLUDED_USRP2_ETH_PACKET_H - -#include "usrp2_cdefs.h" -#include "usrp2_bytesex.h" -#include "usrp2_mac_addr.h" -#include "usrp2_mimo_config.h" - -__U2_BEGIN_DECLS - -#define U2_ETHERTYPE 0xBEEF // used in our frames -#define MAC_CTRL_ETHERTYPE 0x8808 // used in PAUSE frames - -/* - * All these data structures are BIG-ENDIAN on the wire - */ - -// FIXME gcc specific. Really ought to come from compiler.h -#define _AL4 __attribute__((aligned (4))) - -/* - * \brief The classic 14-byte ethernet header - */ -typedef struct { - u2_mac_addr_t dst; - u2_mac_addr_t src; - uint16_t ethertype; -} __attribute__((packed)) u2_eth_hdr_t; - -/*! - * \brief USRP2 transport header - * - * This enables host->usrp2 flow control and dropped packet detection. - */ -typedef struct { - uint16_t flags; // MBZ, may be used for channel in future - uint16_t fifo_status; // free space in Rx fifo in 32-bit lines - uint8_t seqno; // sequence number of this packet - uint8_t ack; // sequence number of next packet expected -} __attribute__((packed)) u2_transport_hdr_t; - - -/* - * The fixed payload header of a USRP2 ethernet packet... - * - * Basically there's 1 word of flags and routing info, and 1 word - * of timestamp that specifies when the data was received, or - * when it should be transmitted. The data samples follow immediately. - * - * Transmit packets (from host to U2) - * - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | Chan | mbz |I|S|E| - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | Timestamp | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * - * - * Received packets (from U2 to host) - * - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | Chan | mbz | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | Timestamp | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * - * mbz == must be zero - */ - -typedef struct { - uint32_t word0; // flags etc - uint32_t timestamp; // time of rx or tx (100 MHz) -} u2_fixed_hdr_t; - - -#define U2P_CHAN_MASK 0x1f -#define U2P_CHAN_SHIFT 27 - -#define U2P_TX_IMMEDIATE 0x00000004 // send samples NOW, else at timestamp -#define U2P_TX_START_OF_BURST 0x00000002 // this frame is the start of a burst -#define U2P_TX_END_OF_BURST 0x00000001 // this frame is the end of a burst - -#define U2P_ALL_FLAGS 0x00000007 - -#define CONTROL_CHAN 0x1f - -static inline int -u2p_chan(u2_fixed_hdr_t *p) -{ - return (ntohl(p->word0) >> U2P_CHAN_SHIFT) & U2P_CHAN_MASK; -} - -inline static uint32_t -u2p_word0(u2_fixed_hdr_t *p) -{ - return ntohl(p->word0); -} - -inline static uint32_t -u2p_timestamp(u2_fixed_hdr_t *p) -{ - return ntohl(p->timestamp); -} - -inline static void -u2p_set_word0(u2_fixed_hdr_t *p, int flags, int chan) -{ - p->word0 = htonl((flags & U2P_ALL_FLAGS) - | ((chan & U2P_CHAN_MASK) << U2P_CHAN_SHIFT)); -} - -inline static void -u2p_set_timestamp(u2_fixed_hdr_t *p, uint32_t ts) -{ - p->timestamp = htonl(ts); -} - -/*! - * \brief consolidated packet: ethernet header + transport header + fixed header - */ -typedef struct { - u2_eth_hdr_t ehdr; - u2_transport_hdr_t thdr; - u2_fixed_hdr_t fixed; -} u2_eth_packet_t; - -/* - * full load of samples: - * ethernet header + transport header + fixed header + maximum number of samples. - * sizeof(u2_eth_samples_t) == 1512 - * (payload is 1498 bytes, two bytes shorter than 1500 byte MTU) - * (sample numbers are made even to force pairwise alignment in the interleaved case) - */ - -#define U2_MAX_SAMPLES 370 -#define U2_MIN_SAMPLES 10 - -typedef struct { - u2_eth_packet_t hdrs; - uint32_t samples[U2_MAX_SAMPLES]; -} u2_eth_samples_t; - -/* - * Opcodes for control channel - * - * Reply opcodes are the same as the request opcode with the OP_REPLY_BIT set (0x80). - */ -#define OP_REPLY_BIT 0x80 - -#define OP_EOP 0 // marks last subpacket in packet - -#define OP_ID 1 -#define OP_ID_REPLY (OP_ID | OP_REPLY_BIT) -#define OP_BURN_MAC_ADDR 2 -#define OP_BURN_MAC_ADDR_REPLY (OP_BURN_MAC_ADDR | OP_REPLY_BIT) -#define OP_READ_TIME 3 // What time is it? (100 MHz counter) -#define OP_READ_TIME_REPLY (OP_READ_TIME | OP_REPLY_BIT) -#define OP_CONFIG_RX_V2 4 -#define OP_CONFIG_RX_REPLY_V2 (OP_CONFIG_RX_V2 | OP_REPLY_BIT) -#define OP_CONFIG_TX_V2 5 -#define OP_CONFIG_TX_REPLY_V2 (OP_CONFIG_TX_V2 | OP_REPLY_BIT) -#define OP_START_RX_STREAMING 6 -#define OP_START_RX_STREAMING_REPLY (OP_START_RX_STREAMING | OP_REPLY_BIT) -#define OP_STOP_RX 7 -#define OP_STOP_RX_REPLY (OP_STOP_RX | OP_REPLY_BIT) -#define OP_CONFIG_MIMO 8 -#define OP_CONFIG_MIMO_REPLY (OP_CONFIG_MIMO | OP_REPLY_BIT) -#define OP_DBOARD_INFO 9 -#define OP_DBOARD_INFO_REPLY (OP_DBOARD_INFO | OP_REPLY_BIT) -#define OP_SYNC_TO_PPS 10 -#define OP_SYNC_TO_PPS_REPLY (OP_SYNC_TO_PPS | OP_REPLY_BIT) -#define OP_PEEK 11 -#define OP_PEEK_REPLY (OP_PEEK | OP_REPLY_BIT) -#define OP_POKE 12 -#define OP_POKE_REPLY (OP_POKE | OP_REPLY_BIT) -#define OP_SET_TX_LO_OFFSET 13 -#define OP_SET_TX_LO_OFFSET_REPLY (OP_SET_TX_LO_OFFSET | OP_REPLY_BIT) -#define OP_SET_RX_LO_OFFSET 14 -#define OP_SET_RX_LO_OFFSET_REPLY (OP_SET_RX_LO_OFFSET | OP_REPLY_BIT) -#define OP_RESET_DB 15 -#define OP_RESET_DB_REPLY (OP_RESET_DB | OP_REPLY_BIT) -#define OP_SYNC_EVERY_PPS 16 -#define OP_SYNC_EVERY_PPS_REPLY (OP_SYNC_EVERY_PPS | OP_REPLY_BIT) -#define OP_GPIO_SET_DDR 17 -#define OP_GPIO_SET_DDR_REPLY (OP_GPIO_SET_DDR | OP_REPLY_BIT) -#define OP_GPIO_SET_SELS 18 -#define OP_GPIO_SET_SELS_REPLY (OP_GPIO_SET_SELS | OP_REPLY_BIT) -#define OP_GPIO_READ 19 -#define OP_GPIO_READ_REPLY (OP_GPIO_READ | OP_REPLY_BIT) -#define OP_GPIO_WRITE 20 -#define OP_GPIO_WRITE_REPLY (OP_GPIO_WRITE | OP_REPLY_BIT) -#define OP_GPIO_STREAM 21 -#define OP_GPIO_STREAM_REPLY (OP_GPIO_STREAM | OP_REPLY_BIT) -#define OP_RX_ANTENNA 22 -#define OP_RX_ANTENNA_REPLY (OP_RX_ANTENNA | OP_REPLY_BIT) -#define OP_TX_ANTENNA 23 -#define OP_TX_ANTENNA_REPLY (OP_RX_ANTENNA | OP_REPLY_BIT) - -/* - * All subpackets are a multiple of 4 bytes long. - * All subpackets start with an 8-bit opcode, an 8-bit len and an 8-bit rid. - */ -#define MAX_SUBPKT_LEN 252 - -/*! - * \brief Generic request and reply packet - * - * Used by: - * OP_EOP, OP_BURN_MAC_ADDR_REPLY, OP_START_RX_STREAMING_REPLY, - * OP_STOP_RX_REPLY, OP_DBOARD_INFO, OP_SYNC_TO_PPS - */ -typedef struct { - uint8_t opcode; - uint8_t len; - uint8_t rid; - uint8_t ok; // bool -} _AL4 op_generic_t; - -/*! - * \brief Reply info from a USRP2 - */ -typedef struct { - uint8_t opcode; - uint8_t len; - uint8_t rid; - uint8_t mbz; - u2_mac_addr_t addr; - uint16_t hw_rev; - uint8_t fpga_md5sum[16]; - uint8_t sw_md5sum[16]; -} _AL4 op_id_reply_t; - -typedef struct { - uint8_t opcode; - uint8_t len; - uint8_t rid; - uint8_t mbz; - uint32_t items_per_frame; // # of 32-bit data items; MTU=1500: [9,371] -} _AL4 op_start_rx_streaming_t; - -typedef struct { - uint8_t opcode; - uint8_t len; - uint8_t rid; - u2_mac_addr_t addr; -} _AL4 op_burn_mac_addr_t; - -typedef struct { - uint8_t opcode; - uint8_t len; - uint8_t rid; - uint8_t mbz; - uint32_t time; -} _AL4 op_read_time_reply_t; - - -/*! - * \brief Configure receiver - */ -typedef struct { - uint8_t opcode; - uint8_t len; - uint8_t rid; - uint8_t mbz; - // bitmask indicating which of the following fields are valid - uint16_t valid; - uint16_t gain; // fxpt_db (Q9.7) - uint32_t freq_hi; // high 32-bits of 64-bit fxpt_freq (Q44.20) - uint32_t freq_lo; // low 32-bits of 64-bit fxpt_freq (Q44.20) - uint32_t decim; // desired decimation factor (NOT -1) - uint32_t scale_iq; // (scale_i << 16) | scale_q [16.0 format] -} _AL4 op_config_rx_v2_t; - -// bitmask for "valid" field. If the bit is set, there's -// meaningful data in the corresonding field. - -#define CFGV_GAIN 0x0001 // gain field is valid -#define CFGV_FREQ 0x0002 // target_freq field is valid -#define CFGV_INTERP_DECIM 0x0004 // interp or decim is valid -#define CFGV_SCALE_IQ 0x0008 // scale_iq is valid - -/*! - * \brief Reply to receiver configuration - */ -typedef struct { - uint8_t opcode; - uint8_t len; - uint8_t rid; - uint8_t mbz; - - uint16_t ok; // config was successful (bool) - uint16_t inverted; // spectrum is inverted (bool) - - // RF frequency that corresponds to DC in the IF (fxpt_freq) - uint32_t baseband_freq_hi; - uint32_t baseband_freq_lo; - // DDC frequency (fxpt_freq) - uint32_t ddc_freq_hi; - uint32_t ddc_freq_lo; - // residual frequency (fxpt_freq) - uint32_t residual_freq_hi; - uint32_t residual_freq_lo; - -} _AL4 op_config_rx_reply_v2_t; - -/*! - * \brief Configure transmitter - */ -typedef struct { - uint8_t opcode; - uint8_t len; - uint8_t rid; - uint8_t mbz; - - // bitmask indicating which of the following fields are valid - uint16_t valid; - uint16_t gain; // fxpt_db (Q9.7) - uint32_t freq_hi; // high 32-bits of 64-bit fxpt_freq (Q44.20) - uint32_t freq_lo; // low 32-bits of 64-bit fxpt_freq (Q44.20) - uint32_t interp; // desired interpolation factor (NOT -1) - uint32_t scale_iq; // (scale_i << 16) | scale_q [16.0 format] -} _AL4 op_config_tx_v2_t; - -/*! - * \brief Reply to configure transmitter - */ -typedef struct { - uint8_t opcode; - uint8_t len; - uint8_t rid; - uint8_t mbz; - - uint16_t ok; // config was successful (bool) - uint16_t inverted; // spectrum is inverted (bool) - - // RF frequency that corresponds to DC in the IF (fxpt_freq) - uint32_t baseband_freq_hi; - uint32_t baseband_freq_lo; - // DUC frequency (fxpt_freq) - uint32_t duc_freq_hi; - uint32_t duc_freq_lo; - // residual frequency (fxpt_freq) - uint32_t residual_freq_hi; - uint32_t residual_freq_lo; - -} _AL4 op_config_tx_reply_v2_t; - -/*! - * \brief Configure MIMO clocking, etc (uses generic reply) - */ -typedef struct { - uint8_t opcode; - uint8_t len; - uint8_t rid; - uint8_t flags; // from usrp_mimo_config.h -} op_config_mimo_t; - - -/*! - * \brief High-level information about daughterboards - */ -typedef struct { - int32_t dbid; //< d'board ID (-1 none, -2 invalid eeprom) - uint32_t freq_min_hi; //< high 32-bits of 64-bit fxpt_freq (Q44.20) - uint32_t freq_min_lo; //< low 32-bits of 64-bit fxpt_freq (Q44.20) - uint32_t freq_max_hi; //< high 32-bits of 64-bit fxpt_freq (Q44.20) - uint32_t freq_max_lo; //< low 32-bits of 64-bit fxpt_freq (Q44.20) - uint16_t gain_min; //< min gain that can be set. fxpt_db (Q9.7) - uint16_t gain_max; //< max gain that can be set. fxpt_db (Q9.7) - uint16_t gain_step_size; //< fxpt_db (Q9.7) -} u2_db_info_t; - - -/*! - * \brief Reply to d'board info request - */ -typedef struct { - uint8_t opcode; - uint8_t len; - uint8_t rid; - uint8_t ok; // request was successful (bool) - - u2_db_info_t tx_db_info; - u2_db_info_t rx_db_info; -} _AL4 op_dboard_info_reply_t; - -/*! - * \brief Read from Wishbone memory - */ -typedef struct { - uint8_t opcode; - uint8_t len; - uint8_t rid; - uint8_t mbz; - uint32_t addr; - uint32_t bytes; -} _AL4 op_peek_t; - -/*! - * \brief Write to Wishbone memory - */ -typedef struct { - uint8_t opcode; - uint8_t len; - uint8_t rid; - uint8_t mbz; - uint32_t addr; - // Words follow here -} _AL4 op_poke_t; - -/* - * Common structure for commands with a single frequency param - * (e.g., set_*_lo_offset, set_*_bw) - */ -typedef struct { - uint8_t opcode; - uint8_t len; - uint8_t rid; - uint8_t mbz; - uint32_t freq_hi; //< high 32-bits of 64-bit fxpt_freq (Q44.20) - uint32_t freq_lo; //< low 32-bits of 64-bit fxpt_freq (Q44.20) -} _AL4 op_freq_t; - -/* - * Structures for commands in GPIO system - */ -typedef struct { - uint8_t opcode; // OP_GPIO_SET_DDR, OP_GPIO_WRITE, OP_GPIO_STREAM - uint8_t len; - uint8_t rid; - uint8_t bank; - uint16_t value; - uint16_t mask; -} _AL4 op_gpio_t; - -typedef struct { - uint8_t opcode; // OP_GPIO_SET_SELS - uint8_t len; - uint8_t rid; - uint8_t bank; - uint8_t sels[16]; -} _AL4 op_gpio_set_sels_t; - -typedef struct { - uint8_t opcode; // OP_GPIO_READ_REPLY - uint8_t len; - uint8_t rid; - uint8_t ok; - uint16_t mbz; - uint16_t value; -} _AL4 op_gpio_read_reply_t; - -/* - * ================================================================ - * union of all of subpacket types - * ================================================================ - */ -typedef union { - - op_generic_t op_generic; - op_id_reply_t op_id_reply; - op_start_rx_streaming_t op_start_rx_streaming; - op_burn_mac_addr_t op_burn_mac_addr; - op_read_time_reply_t op_read_time_reply; - op_config_rx_v2_t op_config_rx_v2; - op_config_rx_reply_v2_t op_config_rx_reply_v2; - op_config_tx_v2_t op_config_tx_v2; - op_config_tx_reply_v2_t op_config_tx_reply_v2; - op_config_mimo_t op_config_mimo; - op_peek_t op_peek; - op_poke_t op_poke; - op_freq_t op_freq; - op_gpio_t op_gpio; - op_gpio_set_sels_t op_gpio_set_sels; - op_gpio_read_reply_t op_gpio_read_reply; - -} u2_subpkt_t; - - -__U2_END_DECLS - -#endif /* INCLUDED_USRP2_ETH_PACKET_H */ diff --git a/usrp2/firmware/include/usrp2_fpga_regs.h b/usrp2/firmware/include/usrp2_fpga_regs.h deleted file mode 100644 index b0f83df60..000000000 --- a/usrp2/firmware/include/usrp2_fpga_regs.h +++ /dev/null @@ -1,80 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifndef INCLUDED_USRP2_FPGA_REGS_H -#define INCLUDED_USSRP2_FPGA_REGS_H - -#include "usrp2_cdefs.h" - -__U2_BEGIN_DECLS - -// ---------------------------------------------------------------- - -#define DSP_CORE_TX_BASE 128 - -// DUC center frequency tuning word (phase increment) -#define FR_TX_FREQ_0 (0 + DSP_CORE_TX_BASE) - -// I & Q output scaling, 16.0 format ((I_SCALE << 16) | Q_SCALE) -#define FR_TX_SCALE_0 (1 + DSP_CORE_TX_BASE) - -// Tx interpolation rate (set to 1 less than desired rate) -#define FR_TX_INTERP_RATE_0 (2 + DSP_CORE_TX_BASE) - -// Write 1 (actually anything) to clear tx state -#define FR_TX_CLEAR_STATE_0 (3 + DSP_CORE_TX_BASE) - -// ---------------------------------------------------------------- - -#define DSP_CORE_RX_BASE 160 - -// DDC center frequency tuning word (phase increment) -#define FR_RX_FREQ_0 (0 + DSP_CORE_RX_BASE) - -// I & Q input scaling, 16.0 format ((I_SCALE << 16) | Q_SCALE) -#define FR_RX_SCALE_0 (1 + DSP_CORE_RX_BASE) - -// Rx decimation rate (set to 1 less than desired rate) -#define FR_RX_DECIM_RATE_0 (2 + DSP_CORE_RX_BASE) - -// The next two registers concatenated are the Rx command register. -// -// Writing FR_RX_TIME_TO_RX_0 writes the concatenated value into the -// cmd queue. Thus, if you're writing both, be sure to write -// FR_RX_QTY_0 first. -// -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | Timestamp | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - -#define FR_RX_TIME_TO_RX (3 + DSP_CORE_RX_BASE) - -// 23-bits 9-bits -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | number_of_lines | lines_per_frame | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - -#define FR_RX_QTY_0 (4 + DSP_CORE_RX_BASE) - -// write a 1 (anything actually) to clear the overrun -#define FR_RX_CLR_OVERRUN_0 (5 + DSP_CORE_RX_BASE) - - -__U2_END_DECLS - -#endif /* INCLUDED_USRP2_FPGA_REGS_H */ diff --git a/usrp2/firmware/include/usrp2_i2c_addr.h b/usrp2/firmware/include/usrp2_i2c_addr.h deleted file mode 100644 index f25996903..000000000 --- a/usrp2/firmware/include/usrp2_i2c_addr.h +++ /dev/null @@ -1,82 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifndef INCLUDED_USRP2_I2C_ADDR_H -#define INCLUDED_USRP2_I2C_ADDR_H - -#include "usrp2_cdefs.h" - -__U2_BEGIN_DECLS - -// I2C addresses - -#define I2C_DEV_EEPROM 0x50 // 24LC02[45]: 7-bits 1010xxx - -#define I2C_ADDR_MBOARD (I2C_DEV_EEPROM | 0x0) -#define I2C_ADDR_TX_A (I2C_DEV_EEPROM | 0x4) -#define I2C_ADDR_RX_A (I2C_DEV_EEPROM | 0x5) - - -// format of USRP2 motherboard rom -// 00: 0x00 h/w rev (LSB) -// 01: 0x00 h/w rev (MSB) -// 02: 0x00 MAC addr 0 -// 03: 0x50 MAC addr 1 -// 04: 0xC2 MAC addr 2 -// 05: 0x85 MAC addr 3 -// 06: 0x3. MAC addr 4 -// 07: 0x.. MAC addr 5 - -#define MBOARD_REV_LSB 0x00 -#define MBOARD_REV_MSB 0x01 -#define MBOARD_MAC_ADDR 0x02 - - -// format of daughterboard EEPROM -// 00: 0xDB code for ``I'm a daughterboard'' -// 01: .. Daughterboard ID (LSB) -// 02: .. Daughterboard ID (MSB) -// 03: .. io bits 7-0 direction (bit set if it's an output from m'board) -// 04: .. io bits 15-8 direction (bit set if it's an output from m'board) -// 05: .. ADC0 DC offset correction (LSB) -// 06: .. ADC0 DC offset correction (MSB) -// 07: .. ADC1 DC offset correction (LSB) -// 08: .. ADC1 DC offset correction (MSB) -// ... -// 1f: .. negative of the sum of bytes [0x00, 0x1e] - -#define DB_EEPROM_MAGIC 0x00 -#define DB_EEPROM_MAGIC_VALUE 0xDB -#define DB_EEPROM_ID_LSB 0x01 -#define DB_EEPROM_ID_MSB 0x02 -#define DB_EEPROM_OE_LSB 0x03 -#define DB_EEPROM_OE_MSB 0x04 -#define DB_EEPROM_OFFSET_0_LSB 0x05 // offset correction for ADC or DAC 0 -#define DB_EEPROM_OFFSET_0_MSB 0x06 -#define DB_EEPROM_OFFSET_1_LSB 0x07 // offset correction for ADC or DAC 1 -#define DB_EEPROM_OFFSET_1_MSB 0x08 -#define DB_EEPROM_CHKSUM 0x1f - -#define DB_EEPROM_CLEN 0x20 // length of common portion of eeprom - -#define DB_EEPROM_CUSTOM_BASE DB_EEPROM_CLEN // first avail offset for - // daughterboard specific use -__U2_END_DECLS - -#endif /* INCLUDED_USRP2_I2C_ADDR_H */ - diff --git a/usrp2/firmware/include/usrp2_mac_addr.h b/usrp2/firmware/include/usrp2_mac_addr.h deleted file mode 100644 index da5a69f58..000000000 --- a/usrp2/firmware/include/usrp2_mac_addr.h +++ /dev/null @@ -1,28 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifndef INCLUDED_USRP2_MAC_ADDR_H -#define INCLUDED_USRP2_MAC_ADDR_H - -#include <stdint.h> - -typedef struct { - uint8_t addr[6]; -} u2_mac_addr_t; - -#endif /* INCLUDED_USRP2_MAC_ADDR_H */ diff --git a/usrp2/firmware/include/usrp2_mimo_config.h b/usrp2/firmware/include/usrp2_mimo_config.h deleted file mode 100644 index 129675198..000000000 --- a/usrp2/firmware/include/usrp2_mimo_config.h +++ /dev/null @@ -1,46 +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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#ifndef INCLUDED_USRP2_MIMO_CONFIG_H -#define INCLUDED_USRP2_MIMO_CONFIG_H - -#define _MC_WE_LOCK 0x0001 -#define _MC_MIMO_CLK_INPUT 0x0002 // else SMA input - -/* - * Derived masks (use these): - * - * We get our input from 1 of three places: - * Our free running oscilator, our SMA connector, or from the MIMO connector - */ -#define MC_WE_DONT_LOCK 0x0000 -#define MC_WE_LOCK_TO_SMA (_MC_WE_LOCK | 0) -#define MC_WE_LOCK_TO_MIMO (_MC_WE_LOCK | _MC_MIMO_CLK_INPUT) - -/* - * Independent of the source of the clock, we may or may not drive our - * clock onto the mimo connector. Note that there are dedicated clock - * signals in each direction, so disaster doesn't occurs if we're - * unnecessarily providing clock. - */ -#define MC_PROVIDE_CLK_TO_MIMO 0x0004 - - -#endif /* INCLUDED_USRP2_MIMO_CONFIG_H */ diff --git a/usrp2/firmware/include/usrp2_types.h b/usrp2/firmware/include/usrp2_types.h deleted file mode 100644 index 32cb25c41..000000000 --- a/usrp2/firmware/include/usrp2_types.h +++ /dev/null @@ -1,118 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ -#ifndef INCLUDED_USRP2_TYPES_H -#define INCLUDED_USRP2_TYPES_H - -#include <usrp2_cdefs.h> -#include <stdint.h> - -__U2_BEGIN_DECLS - -/*! - * \brief Fixed point representation of a frequency in Hertz (VITA-49 compatible) - * - * 64-bit two's complement, with the radix point 20 bits up from the bottom. - * Q44.20 format (20 bits to the right of the radix point) - * - * Values range from +/- 8.79 terahertz with a resolution of 0.95 microhertz. - */ -typedef int64_t u2_fxpt_freq_t; - -#define U2_FPF_RP 20 // location of radix point in u2_fxpt_freq_t - -// macro so we can init structs at compile time -#define U2_DOUBLE_TO_FXPT_FREQ(f) (int64_t)((f) * (1LL << U2_FPF_RP)) - -static inline u2_fxpt_freq_t -u2_double_to_fxpt_freq(double f) -{ - return U2_DOUBLE_TO_FXPT_FREQ(f); -} - -static inline int -u2_fxpt_freq_round_to_int(u2_fxpt_freq_t fx) -{ - return (int)((fx+(1<<(U2_FPF_RP-1)))>>U2_FPF_RP); -} - -static inline unsigned int -u2_fxpt_freq_round_to_uint(u2_fxpt_freq_t fx) -{ - return (unsigned int)((fx+(1<<(U2_FPF_RP-1)))>>U2_FPF_RP); -} - -static inline double -u2_fxpt_freq_to_double(u2_fxpt_freq_t fx) -{ - return ((double) fx) * 1.0/(1 << U2_FPF_RP); -} - -static inline uint32_t -u2_fxpt_freq_hi(u2_fxpt_freq_t f) -{ - return ((f >> 32) & 0xffffffff); -} - -static inline uint32_t -u2_fxpt_freq_lo(u2_fxpt_freq_t f) -{ - return (f & 0xffffffff); -} - -static inline u2_fxpt_freq_t -u2_fxpt_freq_from_hilo(uint32_t hi, uint32_t lo) -{ - return (((u2_fxpt_freq_t) hi) << 32) | lo; -} - -/*! - * \brief Fixed point representation of a gain in dB (VITA-49 compatible) - * - * 16-bit two's complement, with the radix point 7 bits up from the bottom. - * Q9.7 format (7 bits to the right of the radix point) - */ -typedef int16_t u2_fxpt_gain_t; - -#define U2_FPG_RP 7 // location of radix point in u2_fxpt_gain_t - -// macro so we can init structs at compile time -#define U2_DOUBLE_TO_FXPT_GAIN(g) (int16_t)((g) * (1 << U2_FPG_RP)) - -static inline u2_fxpt_gain_t -u2_double_to_fxpt_gain(double g) -{ - return U2_DOUBLE_TO_FXPT_GAIN(g); -} - -static inline float -u2_fxpt_gain_to_double(u2_fxpt_gain_t fx) -{ - return ((double) fx) * 1.0/(1 << U2_FPG_RP); -} - -static inline int -u2_fxpt_gain_round_to_int(u2_fxpt_gain_t fx) -{ - return (int)((fx+(1<<(U2_FPG_RP-1)))>>U2_FPG_RP); -} - - -__U2_END_DECLS - - -#endif /* INCLUDED_USRP2_TYPES_H */ diff --git a/usrp2/firmware/lib/.gitignore b/usrp2/firmware/lib/.gitignore deleted file mode 100644 index 5d838bf6c..000000000 --- a/usrp2/firmware/lib/.gitignore +++ /dev/null @@ -1,40 +0,0 @@ -*~ -/*-stamp -/*.a -/*.bin -/*.dump -/*.log -/*.rom -/.deps -/Makefile -/Makefile.in -/aclocal.m4 -/autom4te.cache -/blink_leds -/blink_leds2 -/build -/compile -/config.h -/config.h.in -/config.log -/config.status -/configure -/depcomp -/eth_test -/gen_eth_packets -/ibs_rx_test -/ibs_tx_test -/install-sh -/libtool -/ltmain.sh -/missing -/py-compile -/rcv_eth_packets -/run_tests.sh -/stamp-h1 -/test1 -/test_phy_comm -/timer_test -/buf_ram_test -/buf_ram_zero -/hello diff --git a/usrp2/firmware/lib/Makefile.am b/usrp2/firmware/lib/Makefile.am deleted file mode 100644 index 2e5f3651f..000000000 --- a/usrp2/firmware/lib/Makefile.am +++ /dev/null @@ -1,121 +0,0 @@ -# -# Copyright 2007,2010 Free Software Foundation, Inc. -# -# This program 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 of the License, or -# (at your option) any later version. -# -# This program 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/>. -# - -include $(top_srcdir)/Makefile.common - -noinst_LIBRARIES = \ - libu2fw.a \ - libu2fw_wbx.a \ - libu2fw_xcvr.a - -U2FW_COMMON = \ - _exit.c \ - abort.c \ - ad9510.c \ - ad9777.c \ - bsm12.c \ - buffer_pool.c \ - clocks.c \ - db_basic.c \ - dbsm.c \ - eeprom.c \ - eth_mac.c \ - ethernet.c \ - exit.c \ - hal_io.c \ - hal_uart.c \ - i2c.c \ - lsadc.c \ - lsdac.c \ - mdelay.c \ - memcpy_wa.c \ - memset_wa.c \ - nonstdio.c \ - pic.c \ - print_buffer.c \ - print_fxpt.c \ - print_mac_addr.c \ - print_rmon_regs.c \ - printf.c \ - sd.c \ - spi.c \ - u2_init.c - -libu2fw_a_SOURCES = \ - $(U2FW_COMMON) \ - db_init.c \ - db_bitshark_rx.c \ - db_dbsrx.c \ - db_rfx.c \ - db_tvrx.c - -libu2fw_wbx_a_SOURCES = \ - $(U2FW_COMMON) \ - db_init_wbx.c \ - adf4350.c \ - adf4350_regs.c \ - db_wbxng.c - -libu2fw_xcvr_a_SOURCES = \ - $(U2FW_COMMON) \ - db_init_xcvr.c \ - adf4350.c \ - adf4350_regs.c \ - db_xcvr2450.c - - -noinst_HEADERS = \ - ad9510.h \ - adf4350.h \ - adf4350_regs.h \ - ad9777.h \ - ad9777_regs.h \ - bool.h \ - bsm12.h \ - buffer_pool.h \ - clocks.h \ - db.h \ - db_base.h \ - db_wbxng.h \ - db_bitshark_rx.h \ - dbsm.h \ - eth_mac.h \ - eth_mac_regs.h \ - eth_phy.h \ - ethernet.h \ - hal_io.h \ - hal_uart.h \ - i2c.h \ - lsadc.h \ - lsdac.h \ - mdelay.h \ - memcpy_wa.h \ - memory_map.h \ - memset_wa.h \ - nonstdio.h \ - pic.h \ - print_rmon_regs.h \ - sd.h \ - spi.h \ - stdint.h \ - stdio.h \ - u2_init.h \ - usrp2_bytesex.h \ - wb16550.h - -EXTRA_DIST = \ - microblaze.ld diff --git a/usrp2/firmware/lib/_exit.c b/usrp2/firmware/lib/_exit.c deleted file mode 100644 index 9b40ab2ee..000000000 --- a/usrp2/firmware/lib/_exit.c +++ /dev/null @@ -1,27 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -/* - * Stub so we can compile using 3.4 based mb-gcc - */ -void -_exit(int status) -{ - while (1) - ; -} diff --git a/usrp2/firmware/lib/abort.c b/usrp2/firmware/lib/abort.c deleted file mode 100644 index d1d709392..000000000 --- a/usrp2/firmware/lib/abort.c +++ /dev/null @@ -1,32 +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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include <nonstdio.h> - -extern void _exit(int status); - -void -abort(void) -{ - putstr("\n\nabort\n"); - // FIXME loop blinking leds - _exit(-1); -} diff --git a/usrp2/firmware/lib/ad9510.c b/usrp2/firmware/lib/ad9510.c deleted file mode 100644 index 4d3acb65d..000000000 --- a/usrp2/firmware/lib/ad9510.c +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#include "ad9510.h" -#include "spi.h" -#include <memory_map.h> - -#define RD (1 << 15) -#define WR (0 << 15) - -void -ad9510_write_reg(int regno, uint8_t value) -{ - uint32_t inst = WR | (regno & 0xff); - uint32_t v = (inst << 8) | (value & 0xff); - spi_transact(SPI_TXONLY, SPI_SS_AD9510, v, 24, SPIF_PUSH_FALL); -} - -int -ad9510_read_reg(int regno) -{ - uint32_t inst = RD | (regno & 0xff); - uint32_t v = (inst << 8) | 0; - uint32_t r = spi_transact(SPI_TXRX, SPI_SS_AD9510, v, 24, - SPIF_PUSH_FALL | SPIF_LATCH_FALL); - return r & 0xff; -} diff --git a/usrp2/firmware/lib/ad9510.h b/usrp2/firmware/lib/ad9510.h deleted file mode 100644 index a395e5223..000000000 --- a/usrp2/firmware/lib/ad9510.h +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ -#ifndef INCLUDED_AD9510_H -#define INCLUDED_AD9510_H - -#include <stdint.h> - -/* - * Analog Device AD9510 1.2 GHz Clock Distribution IC w/ PLL - */ - -void ad9510_write_reg(int regno, uint8_t value); -int ad9510_read_reg(int regno); - -#endif /* INCLUDED_AD9510_H */ diff --git a/usrp2/firmware/lib/ad9777.c b/usrp2/firmware/lib/ad9777.c deleted file mode 100644 index 734ccd7e5..000000000 --- a/usrp2/firmware/lib/ad9777.c +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#include "ad9777.h" -#include "memory_map.h" -#include "spi.h" - -#define IB_RD 0x80 -#define IB_WR 0x00 -#define IB_XFER_1 0x00 -#define IB_XFER_2 0x20 -#define IB_XFER_3 0x40 -#define IB_XFER_4 0x60 -#define IB_ADDR_MASK 0x1f - -void -ad9777_write_reg(int regno, uint8_t value) -{ - uint8_t instr = IB_WR | IB_XFER_1 | (regno & IB_ADDR_MASK); - spi_transact(SPI_TXONLY, SPI_SS_AD9777, - (instr << 8) | (value & 0xff), 16, SPIF_PUSH_FALL); -} - -int -ad9777_read_reg(int regno) -{ - uint8_t instr = IB_RD | IB_XFER_1 | (regno & IB_ADDR_MASK); - uint32_t r = spi_transact(SPI_TXRX, SPI_SS_AD9777, - (instr << 8) | 0, 16, - SPIF_PUSH_FALL | SPIF_LATCH_RISE); - return r & 0xff; -} diff --git a/usrp2/firmware/lib/ad9777.h b/usrp2/firmware/lib/ad9777.h deleted file mode 100644 index d4d104910..000000000 --- a/usrp2/firmware/lib/ad9777.h +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ -#ifndef INCLUDED_AD9777_H -#define INCLUDED_AD9777_H - -#include <stdint.h> -#include "ad9777_regs.h" - -/* - * Analog Devices AD9777 16-bit, 160 MS/s, Dual Interpolating TxDAC - */ - -void ad9777_write_reg(int regno, uint8_t value); -int ad9777_read_reg(int regno); - -#endif /* INCLUDED_AD9777_H */ diff --git a/usrp2/firmware/lib/ad9777_regs.h b/usrp2/firmware/lib/ad9777_regs.h deleted file mode 100644 index de2936c15..000000000 --- a/usrp2/firmware/lib/ad9777_regs.h +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ -#ifndef INCLUDED_AD9777_REGS_H -#define INCLUDED_AD9777_REGS_H - -#define R0_SW_RESET (1 << 5) -#define R0_SLEEP (1 << 4) -#define R0_POWER_DN (1 << 3) -#define R0_1R (1 << 2) -#define R0_2R (0 << 2) -#define R0_PLL_LOCKED (1 << 1) - -#define R1_INTERP_1X 0x00 -#define R1_INTERP_2X 0x40 -#define R1_INTERP_4X 0x80 -#define R1_INTERP_8X 0xC0 -#define R1_MOD_NONE 0x00 -#define R1_MOD_FS_2 0x10 // Fs/2 -#define R1_MOD_FS_4 0x20 // Fs/4 -#define R1_MOD_FS_8 0x30 // Fs/8 -#define R1_ZERO_STUFF (1 << 3) // N.B., doubles output rate -#define R1_REAL_MIX (1 << 2) -#define R1_CMPLX_MIX (0 << 2) -#define R1_POS_EXP (1 << 1) // exp(+jwt) -#define R1_NEG_EXP (0 << 1) // exp(-jwt) -#define R1_DATACLK_OUT (1 << 0) - -#define R2_2S_COMP (0 << 7) -#define R2_2PORT_MODE (0 << 6) -#define R2_1PORT_MODE (1 << 6) - -#define R3_PLL_DIV_1 0x00 -#define R3_PLL_DIV_2 0x01 -#define R3_PLL_DIV_4 0x02 -#define R3_PLL_DIV_8 0x03 - -#define R4_PLL_ON (1 << 7) -#define R4_CP_MANUAL (1 << 6) -#define R4_CP_AUTO (0 << 6) -#define R4_CP_50uA (0x00 | R4_CP_MANUAL) -#define R4_CP_100uA (0x01 | R4_CP_MANUAL) -#define R4_CP_200uA (0x02 | R4_CP_MANUAL) -#define R4_CP_400uA (0x03 | R4_CP_MANUAL) -#define R4_CP_800uA (0x07 | R4_CP_MANUAL) - -#define R5_I_FINE_GAIN(g) (g) // 8-bits -#define R6_I_COARSE_GAIN(g) ((g) & 0xf) // low 4-bits - -#define R9_Q_FINE_GAIN(g) (g) // 8-bits -#define R10_Q_COARSE_GAIN(g) ((g) & 0xf) // low 4-bits - - -// FIXME more registers for offset and gain control... - - -#endif /* INCLUDED_AD9777_REGS_H */ diff --git a/usrp2/firmware/lib/adf4350.c b/usrp2/firmware/lib/adf4350.c deleted file mode 100644 index dbab654ea..000000000 --- a/usrp2/firmware/lib/adf4350.c +++ /dev/null @@ -1,209 +0,0 @@ -/* - * Copyright 2010 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - * - */ - -#include "adf4350.h" -#include "adf4350_regs.h" -#include "db_wbxng.h" -#include <spi.h> -#include <hal_io.h> -#include <stdio.h> -#include <stdint.h> - -#define INPUT_REF_FREQ U2_DOUBLE_TO_FXPT_FREQ(50e6) -#define INPUT_REF_FREQ_2X (2*INPUT_REF_FREQ) /* input ref freq with doubler turned on */ -#define MAX_RF_DIV UINT8_C(16) /* max rf divider, divides rf output */ -#define MIN_VCO_FREQ U2_DOUBLE_TO_FXPT_FREQ(2.2e9) /* minimum vco freq */ -#define MAX_VCO_FREQ U2_DOUBLE_TO_FXPT_FREQ(4.4e9) /* minimum vco freq */ -#define MAX_FREQ MAX_VCO_FREQ /* upper bound freq (rf div = 1) */ -#define MIN_FREQ U2_DOUBLE_TO_FXPT_FREQ(68.75e6) /* lower bound freq (rf div = 16) */ - -u2_fxpt_freq_t adf4350_get_max_freq(void){ - return MAX_FREQ; -} - -u2_fxpt_freq_t adf4350_get_min_freq(void){ - return MIN_FREQ; -} - -void adf4350_init(struct db_base *dbb){ - struct db_wbxng_dummy *db = (struct db_wbxng_dummy *) dbb; - - /* Initialize the pin levels. */ - hal_gpio_write( db->base.is_tx ? GPIO_TX_BANK : GPIO_RX_BANK, PLL_CE, PLL_CE ); - adf4350_enable(true, dbb); - /* Initialize the registers. */ - adf4350_load_register(5, dbb); - adf4350_load_register(4, dbb); - adf4350_load_register(3, dbb); - adf4350_load_register(2, dbb); - adf4350_load_register(1, dbb); - adf4350_load_register(0, dbb); -} - -/* -void adf4350_update(void){ - // mirror the lock detect pin to the led debug - if (adf4350_get_locked()){ - io_set_pin(led_pin); - }else{ - io_clear_pin(led_pin); - } -} -*/ - -bool adf4350_get_locked(struct db_base *dbb){ - struct db_wbxng_dummy *db = (struct db_wbxng_dummy *) dbb; - - int pins; - pins = hal_gpio_read( db->base.is_tx ? GPIO_TX_BANK : GPIO_RX_BANK ); - if(pins & PLL_LOCK_DETECT) - return true; - return false; -} - -void adf4350_enable(bool enable, struct db_base *dbb){ - struct db_wbxng_dummy *db = (struct db_wbxng_dummy *) dbb; - - if (enable){ /* chip enable */ - hal_gpio_write( db->base.is_tx ? GPIO_TX_BANK : GPIO_RX_BANK, PLL_PDBRF, PLL_PDBRF ); - }else{ - hal_gpio_write( db->base.is_tx ? GPIO_TX_BANK : GPIO_RX_BANK, 0, PLL_PDBRF ); - } -} - -void adf4350_write(uint8_t addr, uint32_t data, struct db_base *dbb){ - struct db_wbxng_dummy *db = (struct db_wbxng_dummy *) dbb; - - //printf("SPI write ADDR 0x%x, WORD 0x%x\n", (int) (addr), (int) (data)); - data |= addr; - spi_transact(SPI_TXONLY,db->common.spi_mask,data,32,SPIF_PUSH_FALL); - //spi_read_write(clk_pin, data_pin, ld_pin, &data, 32); - /* pulse latch */ - //io_set_pin(le_pin); - //io_clear_pin(le_pin); -} - -bool adf4350_set_freq(u2_fxpt_freq_t freq, struct db_base *dbb){ - struct db_wbxng_dummy *db = (struct db_wbxng_dummy *) dbb; - - /* Set the frequency by setting int, frac, mod, r, div */ - if (freq > MAX_FREQ || freq < MIN_FREQ) return false; - - /* Set the prescaler and the min N based on the freq. */ - uint16_t min_int_div; - if (freq > U2_DOUBLE_TO_FXPT_FREQ(3e9) ){ - db->common.adf4350_regs_prescaler = (uint8_t) 1; - min_int_div = UINT16_C(75); - }else{ - db->common.adf4350_regs_prescaler = (uint8_t) 0; - min_int_div = UINT16_C(23); - } - - /* Ramp up the RF divider until the VCO is within range. */ - db->common.adf4350_regs_divider_select = (uint8_t) 0; - while (freq < MIN_VCO_FREQ){ - freq <<= 1; //double the freq - db->common.adf4350_regs_divider_select++; //double the divider - } - - /* Ramp up the R divider until the N divider is at least the minimum. */ - db->common.adf4350_regs_10_bit_r_counter = (uint16_t) (DIV_ROUND((INPUT_REF_FREQ*min_int_div), freq)); - //printf("Initial R setting: %u, MIN_INT: %u\n", db->common.adf4350_regs_10_bit_r_counter, min_int_div); - if (db->common.adf4350_regs_10_bit_r_counter * U2_DOUBLE_TO_FXPT_FREQ(32e6) < INPUT_REF_FREQ){ - db->common.adf4350_regs_10_bit_r_counter = (uint16_t) (DIV_ROUND(INPUT_REF_FREQ, U2_DOUBLE_TO_FXPT_FREQ(32e6))); - //printf("Updating R setting: %u, MIN_INT: %u\n", db->common.adf4350_regs_10_bit_r_counter, min_int_div); - } - - db->common.adf4350_regs_10_bit_r_counter--; - //db->common.adf4350_regs_10_bit_r_counter=1; - - do{ - db->common.adf4350_regs_10_bit_r_counter++; - /* throw out some fractional bits in freq to avoid overflow */ - u2_fxpt_freq_t some_frac_freq = (U2_DOUBLE_TO_FXPT_FREQ(1.0)/db->common.adf4350_regs_mod); - uint64_t n_mod = DIV_ROUND(freq, some_frac_freq); - n_mod *= db->common.adf4350_regs_10_bit_r_counter; - n_mod *= db->common.adf4350_regs_mod; - n_mod = DIV_ROUND(n_mod, DIV_ROUND(INPUT_REF_FREQ, some_frac_freq)); - /* calculate int and frac: regs_mod is a power of 2, this will optimize to a bitwise operation */ - db->common.adf4350_regs_int = (uint16_t) (n_mod/db->common.adf4350_regs_mod); - db->common.adf4350_regs_frac = (uint16_t) (n_mod%db->common.adf4350_regs_mod); - //printf("Int %u < Min %u\n", db->common.adf4350_regs_int, min_int_div); - }while(db->common.adf4350_regs_int < min_int_div); - - /* calculate the band select so PFD is under 125 KHz */ - db->common.adf4350_regs_8_bit_band_select_clock_divider_value = \ - (uint8_t) (INPUT_REF_FREQ/(U2_DOUBLE_TO_FXPT_FREQ(30e3)*db->common.adf4350_regs_10_bit_r_counter)) + 1; - - /* - printf( - "VCO %u KHz, Int %u, Frac %u, Mod %u, R %u, Div %u, BandSelect %u\n", - (uint32_t) ((freq >> U2_FPF_RP)/1000), - (uint32_t) db->common.adf4350_regs_int, - (uint32_t) db->common.adf4350_regs_frac, - (uint32_t) db->common.adf4350_regs_mod, - (uint32_t) db->common.adf4350_regs_10_bit_r_counter, - (uint32_t) (1 << db->common.adf4350_regs_divider_select), - (uint32_t) db->common.adf4350_regs_8_bit_band_select_clock_divider_value - ); - */ - - /* load involved registers */ - adf4350_load_register(5, dbb); - adf4350_load_register(3, dbb); - adf4350_load_register(1, dbb); - adf4350_load_register(2, dbb); - adf4350_load_register(4, dbb); - adf4350_load_register(0, dbb); /* register 0 must be last */ - return adf4350_get_locked(dbb); -} - -u2_fxpt_freq_t adf4350_get_freq(struct db_base *dbb){ - struct db_wbxng_dummy *db = (struct db_wbxng_dummy *) dbb; - - /* Calculate the freq from int, frac, mod, ref, r, div: - * freq = (int + frac/mod) * (ref/r) - * Keep precision by doing multiplies first: - * freq = (((((((int)*mod) + frac)*ref)/mod)/r)/div) - */ - uint64_t temp; - temp = (uint64_t) db->common.adf4350_regs_int; - temp *= (uint64_t) db->common.adf4350_regs_mod; - temp += (uint64_t) db->common.adf4350_regs_frac; - temp *= (uint64_t) (INPUT_REF_FREQ >> U2_FPF_RP); - temp /= (uint64_t) db->common.adf4350_regs_mod; - temp /= (uint64_t) db->common.adf4350_regs_10_bit_r_counter; - temp /= (uint64_t) (1 << db->common.adf4350_regs_divider_select); - - /* Shift 1Hz Radix Point for u2_fxpt_freq_t */ - temp = temp << U2_FPF_RP; - - /* - printf( - "Got Freq %u KHz, Int %u, Frac %u, Mod %u, R %u, Div %u\n", - (uint32_t) ((temp >> U2_FPF_RP)/1000), - (uint32_t) db->common.adf4350_regs_int, - (uint32_t) db->common.adf4350_regs_frac, - (uint32_t) db->common.adf4350_regs_mod, - (uint32_t) db->common.adf4350_regs_10_bit_r_counter, - (uint32_t) (1 << db->common.adf4350_regs_divider_select) - ); - */ - - return (u2_fxpt_freq_t) (temp); -} diff --git a/usrp2/firmware/lib/adf4350.h b/usrp2/firmware/lib/adf4350.h deleted file mode 100644 index 3c66ec344..000000000 --- a/usrp2/firmware/lib/adf4350.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2010 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - * - */ - -#ifndef ADF4350_H -#define ADF4350_H - -#include <db_base.h> -#include <stdbool.h> -#include <stdint.h> - -#define DIV_ROUND(num, denom) (((num) + ((denom)/2))/(denom)) -#define UINT8_C(num) ((uint8_t) (num)) -#define UINT16_C(num) ((uint16_t) (num)) - -void adf4350_init(struct db_base *dbb); -//void adf4350_update(void); -bool adf4350_get_locked(struct db_base *dbb); -void adf4350_enable(bool enable, struct db_base *dbb); -void adf4350_write(uint8_t addr, uint32_t data, struct db_base *dbb); -bool adf4350_set_freq(u2_fxpt_freq_t freq, struct db_base *dbb); -u2_fxpt_freq_t adf4350_get_freq(struct db_base *dbb); -u2_fxpt_freq_t adf4350_get_max_freq(void); -u2_fxpt_freq_t adf4350_get_min_freq(void); - -#endif /* ADF4350_H */ diff --git a/usrp2/firmware/lib/adf4350_regs.c b/usrp2/firmware/lib/adf4350_regs.c deleted file mode 100644 index e2740d3ab..000000000 --- a/usrp2/firmware/lib/adf4350_regs.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright 2010 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - * - */ - -#include "adf4350_regs.h" -#include "adf4350.h" -#include "db_wbxng.h" - -#define _REG_SHIFT(reg, shift) (((uint32_t)(reg)) << (shift)) - -/* reg 0 */ -/* reg 1 */ -static const uint16_t adf4350_regs_phase = 0; /* 0 */ -/* reg 2 */ -static const uint8_t adf4350_regs_low_noise_and_low_spur_modes = 3; /* low noise mode */ -static const uint8_t adf4350_regs_muxout = 3; /* digital lock detect */ -static const uint8_t adf4350_regs_reference_doubler = 0; /* disabled */ -static const uint8_t adf4350_regs_rdiv2 = 1; /* disabled */ -static const uint8_t adf4350_regs_double_buff = 0; /* disabled */ -static const uint8_t adf4350_regs_charge_pump_setting = 5; /* 2.50 mA */ -static const uint8_t adf4350_regs_ldf = 0; /* frac-n */ -static const uint8_t adf4350_regs_ldp = 0; /* 10 ns */ -static const uint8_t adf4350_regs_pd_polarity = 1; /* positive */ -static const uint8_t adf4350_regs_power_down = 0; /* disabled */ -static const uint8_t adf4350_regs_cp_three_state = 0; /* disabled */ -static const uint8_t adf4350_regs_counter_reset = 0; /* disabled */ -/* reg 3 */ -static const uint8_t adf4350_regs_csr = 0; /* disabled */ -static const uint8_t adf4350_regs_clk_div_mode = 0; /* clock divider off */ -static const uint16_t adf4350_regs_12_bit_clock_divider_value = 0; /* 0 */ -/* reg 4 */ -static const uint8_t adf4350_regs_feedback_select = 1; /* fundamental */ -static const uint8_t adf4350_regs_vco_power_down = 0; /* vco powered up */ -static const uint8_t adf4350_regs_mtld = 0; /* mute disabled */ -static const uint8_t adf4350_regs_aux_output_select = 1; /* divided output */ -static const uint8_t adf4350_regs_aux_output_enable = 1; /* disabled */ -static const uint8_t adf4350_regs_aux_output_power = 0; /* -4 */ -static const uint8_t adf4350_regs_rf_output_enable = 1; /* enabled */ -static const uint8_t adf4350_regs_output_power = 3; /* -1 */ -/* reg 5 */ -static const uint8_t adf4350_regs_ld_pin_mode = 1; /* digital lock detect */ - -void adf4350_load_register(uint8_t addr, struct db_base *dbb){ - struct db_wbxng_dummy *db = (struct db_wbxng_dummy *) dbb; - uint32_t data; - switch (addr){ - case 0: data = ( - _REG_SHIFT(db->common.adf4350_regs_int, 15) | - _REG_SHIFT(db->common.adf4350_regs_frac, 3)); break; - case 1: data = ( - _REG_SHIFT(db->common.adf4350_regs_prescaler, 27) | - _REG_SHIFT(adf4350_regs_phase, 15) | - _REG_SHIFT(db->common.adf4350_regs_mod, 3)); break; - case 2: data = ( - _REG_SHIFT(adf4350_regs_low_noise_and_low_spur_modes, 29) | - _REG_SHIFT(adf4350_regs_muxout, 26) | - _REG_SHIFT(adf4350_regs_reference_doubler, 25) | - _REG_SHIFT(adf4350_regs_rdiv2, 24) | - _REG_SHIFT(db->common.adf4350_regs_10_bit_r_counter, 14) | - _REG_SHIFT(adf4350_regs_double_buff, 13) | - _REG_SHIFT(adf4350_regs_charge_pump_setting, 9) | - _REG_SHIFT(adf4350_regs_ldf, 8) | - _REG_SHIFT(adf4350_regs_ldp, 7) | - _REG_SHIFT(adf4350_regs_pd_polarity, 6) | - _REG_SHIFT(adf4350_regs_power_down, 5) | - _REG_SHIFT(adf4350_regs_cp_three_state, 4) | - _REG_SHIFT(adf4350_regs_counter_reset, 3)); break; - case 3: data = ( - _REG_SHIFT(adf4350_regs_csr, 18) | - _REG_SHIFT(adf4350_regs_clk_div_mode, 15) | - _REG_SHIFT(adf4350_regs_12_bit_clock_divider_value, 3)); break; - case 4: data = ( - _REG_SHIFT(adf4350_regs_feedback_select, 23) | - _REG_SHIFT(db->common.adf4350_regs_divider_select, 20) | - _REG_SHIFT(db->common.adf4350_regs_8_bit_band_select_clock_divider_value, 12) | - _REG_SHIFT(adf4350_regs_vco_power_down, 11) | - _REG_SHIFT(adf4350_regs_mtld, 10) | - _REG_SHIFT(adf4350_regs_aux_output_select, 9) | - _REG_SHIFT(adf4350_regs_aux_output_enable, 8) | - _REG_SHIFT(adf4350_regs_aux_output_power, 6) | - _REG_SHIFT(adf4350_regs_rf_output_enable, 5) | - _REG_SHIFT(adf4350_regs_output_power, 3)); break; - case 5: data = ( - _REG_SHIFT(adf4350_regs_ld_pin_mode, 22)); break; - default: return; - } - /* write the data out to spi */ - adf4350_write(addr, data, dbb); -} diff --git a/usrp2/firmware/lib/adf4350_regs.h b/usrp2/firmware/lib/adf4350_regs.h deleted file mode 100644 index f7c160f6f..000000000 --- a/usrp2/firmware/lib/adf4350_regs.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2010 Free Software Foundation, Inc. - * - * Copyright 2010 Ettus Research LLC - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - * - */ - -#ifndef ADF4350_REGS_H -#define ADF4350_REGS_H - -#include <db_base.h> -#include <stdint.h> - -void adf4350_load_register(uint8_t addr, struct db_base *dbb); - -#endif /* ADF4350_REGS_H */ diff --git a/usrp2/firmware/lib/bool.h b/usrp2/firmware/lib/bool.h deleted file mode 100644 index 36f472d40..000000000 --- a/usrp2/firmware/lib/bool.h +++ /dev/null @@ -1,26 +0,0 @@ -/* -*- c -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifndef INCLUDED_BOOL_H -#define INCLUDED_BOOL_H - -typedef int bool; -#define true 1 -#define false 0 - -#endif /* INCLUDED_BOOL_H */ diff --git a/usrp2/firmware/lib/bsm12.c b/usrp2/firmware/lib/bsm12.c deleted file mode 100644 index c996e6496..000000000 --- a/usrp2/firmware/lib/bsm12.c +++ /dev/null @@ -1,319 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -/* - * buffer state machine: 1 input to two outputs - * - * Typically used to read packets from the ethernet and then after inspecting, - * handle the packet in firmware or pass it on to 1 of the 2 buffer destinations. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "bsm12.h" -#include "memory_map.h" -#include "buffer_pool.h" -#include "bool.h" -#include "nonstdio.h" -#include <stdlib.h> - -typedef enum { - BS_EMPTY, - BS_FILLING, - BS_FULL, - BS_EMPTYING, -} buffer_state_t; - -static buffer_state_t buffer_state[NBUFFERS]; -static uint32_t last_send_ctrl[NBUFFERS]; -static int8_t buffer_target[NBUFFERS]; // -1, 0 or 1. -static uint8_t buffer_dst[NBUFFERS]; // 0 or 1. Valid only when BF_EMPTYING - -#define ST_IDLE (-1) - -void -bsm12_init(bsm12_t *sm, int buf0, - const buf_cmd_args_t *recv, - const buf_cmd_args_t *send0, - const buf_cmd_args_t *send1, - bsm12_inspector_t inspect) -{ - if (buf0 & 0x3) // precondition: buf0 % 4 == 0 - abort(); - - sm->buf0 = buf0; - sm->running = false; - sm->recv_args = *recv; - sm->send_args[0] = *send0; - sm->send_args[1] = *send1; - - sm->rx_state = ST_IDLE; - sm->tx_state[0] = ST_IDLE; - sm->tx_state[1] = ST_IDLE; - - sm->inspect = inspect; - - sm->bps_error = BPS_ERROR(buf0 + 0) | BPS_ERROR(buf0 + 1) | BPS_ERROR(buf0 + 2); - sm->bps_done = BPS_DONE(buf0 + 0) | BPS_DONE(buf0 + 1) | BPS_DONE(buf0 + 2); - sm->bps_error_or_done = sm->bps_error | sm->bps_done; - - // How much to adjust the last_line register. - // It's 1 for everything but the ethernet. - sm->last_line_adj = recv->port == PORT_ETH ? 3 : 1; - - buffer_state[sm->buf0 + 0] = BS_EMPTY; - buffer_state[sm->buf0 + 1] = BS_EMPTY; - buffer_state[sm->buf0 + 2] = BS_EMPTY; - - buffer_target[sm->buf0 + 0] = -1; - buffer_target[sm->buf0 + 1] = -1; - buffer_target[sm->buf0 + 2] = -1; - - for (int i = 0; i < NBUFFERS; i++) - sm->next_buf[i] = buf0; - - sm->next_buf[buf0 + 0] = buf0 + 1; - sm->next_buf[buf0 + 1] = buf0 + 2; - sm->next_buf[buf0 + 2] = buf0 + 0; - - for (int i = 0; i < 3; i++){ - sm->precomputed_receive_to_buf_ctrl_word[i] = - (BPC_READ - | BPC_BUFFER(sm->buf0 + i) - | BPC_PORT(sm->recv_args.port) - | BPC_STEP(1) - | BPC_FIRST_LINE(sm->recv_args.first_line) - | BPC_LAST_LINE(sm->recv_args.last_line)); - - for (int j = 0; j < 2; j++){ - sm->precomputed_send_from_buf_ctrl_word[i][j] = - (BPC_WRITE - | BPC_BUFFER(sm->buf0 + i) - | BPC_PORT(sm->send_args[j].port) - | BPC_STEP(1) - | BPC_FIRST_LINE(sm->send_args[j].first_line) - | BPC_LAST_LINE(0)); // last line filled in at runtime - } - } -} - -static inline void -bsm12_receive_to_buf(bsm12_t *sm, int bufno) -{ - buffer_pool_ctrl->ctrl = sm->precomputed_receive_to_buf_ctrl_word[bufno & 0x3]; -} - -static inline void -bsm12_send_from_buf(bsm12_t *sm, int bufno, int dst_idx) -{ - dst_idx &= 0x1; - - uint32_t t = - (sm->precomputed_send_from_buf_ctrl_word[bufno & 0x3][dst_idx] - | BPC_LAST_LINE(buffer_pool_status->last_line[bufno] - sm->last_line_adj)); - - buffer_pool_ctrl->ctrl = t; - last_send_ctrl[bufno] = t; - buffer_dst[bufno] = dst_idx; -} - -static inline void -bsm12_resend_from_buf(bsm12_t *sm, int bufno) -{ - buffer_pool_ctrl->ctrl = last_send_ctrl[bufno]; -} - -void -bsm12_start(bsm12_t *sm) -{ - sm->running = true; - - buffer_state[sm->buf0 + 0] = BS_EMPTY; - buffer_state[sm->buf0 + 1] = BS_EMPTY; - buffer_state[sm->buf0 + 2] = BS_EMPTY; - - buffer_target[sm->buf0 + 0] = -1; - buffer_target[sm->buf0 + 1] = -1; - buffer_target[sm->buf0 + 2] = -1; - - bp_clear_buf(sm->buf0 + 0); - bp_clear_buf(sm->buf0 + 1); - bp_clear_buf(sm->buf0 + 2); - - sm->rx_state = 0; - sm->tx_state[0] = ST_IDLE; - sm->tx_state[1] = ST_IDLE; - bsm12_receive_to_buf(sm, sm->buf0); - buffer_state[sm->buf0] = BS_FILLING; -} - -void -bsm12_stop(bsm12_t *sm) -{ - sm->running = false; - bp_clear_buf(sm->buf0 + 0); - bp_clear_buf(sm->buf0 + 1); - bp_clear_buf(sm->buf0 + 2); - buffer_state[sm->buf0 + 0] = BS_EMPTY; - buffer_state[sm->buf0 + 1] = BS_EMPTY; - buffer_state[sm->buf0 + 2] = BS_EMPTY; -} - -static void bsm12_process_helper(bsm12_t *sm, int buf_this); -static void bsm12_error_helper(bsm12_t *sm, int buf_this); - -void -bsm12_process_status(bsm12_t *sm, uint32_t status) -{ - // anything for us? - if ((status & sm->bps_error_or_done) == 0 || !sm->running) - return; - - if (status & sm->bps_error){ - // Most likely an ethernet Rx error. We just restart the transfer. - if (status & (BPS_ERROR(sm->buf0 + 0))) - bsm12_error_helper(sm, sm->buf0 + 0); - - if (status & (BPS_ERROR(sm->buf0 + 1))) - bsm12_error_helper(sm, sm->buf0 + 1); - - if (status & (BPS_ERROR(sm->buf0 + 2))) - bsm12_error_helper(sm, sm->buf0 + 2); - } - - if (status & BPS_DONE(sm->buf0 + 0)) - bsm12_process_helper(sm, sm->buf0 + 0); - - if (status & BPS_DONE(sm->buf0 + 1)) - bsm12_process_helper(sm, sm->buf0 + 1); - - if (status & BPS_DONE(sm->buf0 + 2)) - bsm12_process_helper(sm, sm->buf0 + 2); -} - -static void -bsm12_process_helper(bsm12_t *sm, int buf_this) -{ - bp_clear_buf(buf_this); - - if (buffer_state[buf_this] == BS_FILLING){ - - buffer_state[buf_this] = BS_FULL; - buffer_target[buf_this] = -1; - - // - // where does this packet go? - // - int dst = sm->inspect(sm, buf_this); - if (dst == -1){ - // - // f/w handled the packet; refill the buffer - // - bsm12_receive_to_buf(sm, buf_this); - buffer_state[buf_this] = BS_FILLING; - buffer_target[buf_this] = -1; - sm->rx_state = buf_this & 0x3; - } - else { // goes to dst 0 or 1 - // - // If the next buffer is empty, start a receive on it - // - int t = sm->next_buf[buf_this]; - if (buffer_state[t] == BS_EMPTY){ - bsm12_receive_to_buf(sm, t); - buffer_state[t] = BS_FILLING; - buffer_target[t] = -1; - sm->rx_state = t & 0x3; - } - else - sm->rx_state = ST_IDLE; - - // - // If the destination is idle, start the xfer, othewise remember it - // - if (sm->tx_state[dst] == ST_IDLE){ - bsm12_send_from_buf(sm, buf_this, dst); - sm->tx_state[dst] = buf_this & 0x3; - buffer_state[buf_this] = BS_EMPTYING; - buffer_target[buf_this] = -1; - } - else { - buffer_target[buf_this] = dst; - } - } - } - - else { // BS_EMPTYING - - buffer_state[buf_this] = BS_EMPTY; - buffer_target[buf_this] = -1; - - if (sm->rx_state == ST_IDLE){ // fire off another receive - sm->rx_state = buf_this & 0x3; - bsm12_receive_to_buf(sm, buf_this); - buffer_state[buf_this] = BS_FILLING; - buffer_target[buf_this] = -1; - } - - int dst = buffer_dst[buf_this]; // the dst we were emptying into - // is the next buffer full and for us? - int t = sm->next_buf[buf_this]; - if (buffer_target[t] == dst){ // yes, - bsm12_send_from_buf(sm, t, dst); // send it - buffer_state[t] = BS_EMPTYING; - buffer_target[t] = -1; - sm->tx_state[dst] = t & 0x3; - } - // how about the one after that? - else if (buffer_target[t=sm->next_buf[t]] == dst){ // yes, - bsm12_send_from_buf(sm, t, dst); // send it - buffer_state[t] = BS_EMPTYING; - buffer_target[t] = -1; - sm->tx_state[dst] = t & 0x3; - } - else { - sm->tx_state[dst] = ST_IDLE; - } - } -} - -static void -bsm12_error_helper(bsm12_t *sm, int buf_this) -{ - bp_clear_buf(buf_this); // clears ERROR flag - - if (buffer_state[buf_this] == BS_FILLING){ - bsm12_receive_to_buf(sm, buf_this); // restart the xfer - } - else { // buffer was emptying - bsm12_resend_from_buf(sm, buf_this); // restart the xfer - } -} - - -void -bsm12_handle_tx_underrun(bsm12_t *sm) -{ -} - -void -bsm12_handle_rx_overrun(bsm12_t *sm) -{ -} diff --git a/usrp2/firmware/lib/bsm12.h b/usrp2/firmware/lib/bsm12.h deleted file mode 100644 index b8e576b79..000000000 --- a/usrp2/firmware/lib/bsm12.h +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifndef INCLUDED_BSM12_H -#define INCLUDED_BSM12_H - -#include "dbsm.h" -#include "memory_map.h" - -/*! - * buffer state machine: 1 input to two outputs - * - * Typically used to read packets from the ethernet and then after inspecting, - * handle the packet in firmware or pass it on to 1 of the 2 buffer destinations. - */ - -struct _bsm12; -typedef struct _bsm12 bsm12_t; - -/*! - * Pointer to function that does packet inspection. - * - * \param sm the state machine - * \param buf_this the index of the buffer to inspect and/or pass on - * - * Returns -1, 0 or 1. If it returns -1, it means that the s/w - * handled that packet, and that it should NOT be passed on to one of - * the buffer endpoints. 0 indicates the first endpoint, 1 the second endpoint. - */ -typedef int (*bsm12_inspector_t)(bsm12_t *sm, int buf_this); - - -/*! - * buffer state machine: 1 input to two outputs - */ -struct _bsm12 -{ - uint8_t buf0; // This machine uses buf0, buf0+1 and buf0+2. buf0 % 4 == 0. - uint8_t running; - int8_t rx_state; // -1, 0, 1, 2 which buffer we're receiving into - int8_t tx_state[2]; // -1, 0, 1, 2 which buffer we're sending from - buf_cmd_args_t recv_args; - buf_cmd_args_t send_args[2]; - bsm12_inspector_t inspect; - int last_line_adj; - uint32_t bps_error; - uint32_t bps_done; - uint32_t bps_error_or_done; - uint8_t next_buf[NBUFFERS]; - uint32_t precomputed_receive_to_buf_ctrl_word[3]; - uint32_t precomputed_send_from_buf_ctrl_word[4][2]; // really only 3, not 4 - // (easier addr comp) -}; - -void bsm12_init(bsm12_t *sm, int buf0, - const buf_cmd_args_t *recv, - const buf_cmd_args_t *send0, - const buf_cmd_args_t *send1, - bsm12_inspector_t inspect); - -void bsm12_start(bsm12_t *sm); -void bsm12_stop(bsm12_t *sm); -void bsm12_process_status(bsm12_t *sm, uint32_t status); -void bsm12_handle_tx_underrun(bsm12_t *sm); -void bsm12_handle_rx_overrun(bsm12_t *sm); - - -#endif /* INCLUDED_BSM12_H */ diff --git a/usrp2/firmware/lib/buffer_pool.c b/usrp2/firmware/lib/buffer_pool.c deleted file mode 100644 index 77e7c5213..000000000 --- a/usrp2/firmware/lib/buffer_pool.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#include "memory_map.h" -#include "buffer_pool.h" -#include "hal_io.h" - -void -bp_init(void) -{ - int i; - bp_disable_port(PORT_SERDES); - bp_disable_port(PORT_DSP); - bp_disable_port(PORT_ETH); - bp_disable_port(PORT_RAM); - - for (i = 0; i < NBUFFERS; i++) - bp_clear_buf(i); -} - -#ifndef INLINE_BUFFER_POOL - -void -bp_clear_buf(int bufnum) -{ - buffer_pool_ctrl->ctrl = BPC_BUFFER(bufnum) | BPC_PORT_NIL | BPC_CLR; -} - -void -bp_disable_port(int portnum) -{ - // disable buffer connections to this port - buffer_pool_ctrl->ctrl = BPC_BUFFER_NIL | BPC_PORT(portnum); -} - -void -bp_receive_to_buf(int bufnum, int port, int step, int fl, int ll) -{ - buffer_pool_ctrl->ctrl = (BPC_READ - | BPC_BUFFER(bufnum) - | BPC_PORT(port) - | BPC_STEP(step) - | BPC_FIRST_LINE(fl) - | BPC_LAST_LINE(ll)); -} - -void -bp_send_from_buf(int bufnum, int port, int step, int fl, int ll) -{ - buffer_pool_ctrl->ctrl = (BPC_WRITE - | BPC_BUFFER(bufnum) - | BPC_PORT(port) - | BPC_STEP(step) - | BPC_FIRST_LINE(fl) - | BPC_LAST_LINE(ll)); -} - -#endif diff --git a/usrp2/firmware/lib/buffer_pool.h b/usrp2/firmware/lib/buffer_pool.h deleted file mode 100644 index 145b20f8d..000000000 --- a/usrp2/firmware/lib/buffer_pool.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifndef INCLUDED_BUFFER_POOL_H -#define INCLUDED_BUFFER_POOL_H - -#include "memory_map.h" - -// Buffer Pool Management - - -// define to have common buffer operations inlined -#define INLINE_BUFFER_POOL 1 - -void bp_init(void); - -#ifndef INLINE_BUFFER_POOL - -void bp_clear_buf(int bufnum); -void bp_disable_port(int portnum); -void bp_receive_to_buf(int bufnum, int port, int step, int fl, int ll); -void bp_send_from_buf(int bufnum, int port, int step, int fl, int ll); - -#else - -static inline void -bp_clear_buf(int bufnum) -{ - buffer_pool_ctrl->ctrl = BPC_BUFFER(bufnum) | BPC_PORT_NIL | BPC_CLR; -} - -static inline void -bp_disable_port(int portnum) -{ - // disable buffer connections to this port - buffer_pool_ctrl->ctrl = BPC_BUFFER_NIL | BPC_PORT(portnum); -} - -static inline void -bp_receive_to_buf(int bufnum, int port, int step, int fl, int ll) -{ - buffer_pool_ctrl->ctrl = (BPC_READ - | BPC_BUFFER(bufnum) - | BPC_PORT(port) - | BPC_STEP(step) - | BPC_FIRST_LINE(fl) - | BPC_LAST_LINE(ll)); -} - -static inline void -bp_send_from_buf(int bufnum, int port, int step, int fl, int ll) -{ - buffer_pool_ctrl->ctrl = (BPC_WRITE - | BPC_BUFFER(bufnum) - | BPC_PORT(port) - | BPC_STEP(step) - | BPC_FIRST_LINE(fl) - | BPC_LAST_LINE(ll)); -} -#endif -#endif diff --git a/usrp2/firmware/lib/clocks.c b/usrp2/firmware/lib/clocks.c deleted file mode 100644 index 0dbf3f90e..000000000 --- a/usrp2/firmware/lib/clocks.c +++ /dev/null @@ -1,243 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <clocks.h> - -#include "memory_map.h" -#include "ad9510.h" -#include "spi.h" -#include "u2_init.h" -#include "nonstdio.h" - -void -clocks_init(void) -{ - // Set up basic clocking functions in AD9510 - ad9510_write_reg(0x45, 0x00); // CLK2 drives distribution - - clocks_enable_fpga_clk(true, 1); - - spi_wait(); - - // Set up PLL for 10 MHz reference - // Reg 4, A counter, Don't Care - ad9510_write_reg(0x05, 0x00); // Reg 5, B counter MSBs, 0 - ad9510_write_reg(0x06, 0x05); // Reg 6, B counter LSBs, 5 - // Reg 7, Loss of reference detect, doesn't work yet, 0 - ad9510_write_reg(0x5A, 0x01); // Update Regs - - - // FIXME, probably need interface to this... - timesync_regs->tick_control = 4; - - // Primary clock configuration - clocks_mimo_config(MC_WE_DONT_LOCK); - - // Set up other clocks - clocks_enable_test_clk(false, 0); - clocks_enable_tx_dboard(false, 0); - clocks_enable_rx_dboard(false, 0); - clocks_enable_eth_phyclk(false, 0); - - // Enable clock to ADCs and DACs - clocks_enable_dac_clk(true, 1); - clocks_enable_adc_clk(true, 1); -} - - -void -clocks_mimo_config(int flags) -{ - if (flags & _MC_WE_LOCK){ - // Reg 8, Charge pump on, dig lock det, positive PFD, 47 - ad9510_write_reg(0x08, 0x47); - } - else { - // Reg 8, Charge pump off, dig lock det, positive PFD - ad9510_write_reg(0x08, 0x00); - } - - // Reg 9, Charge pump current, 0x40=3mA, 0x00=650uA - ad9510_write_reg(0x09, 0x00); - // Reg A, Prescaler of 2, everything normal 04 - ad9510_write_reg(0x0A, 0x04); - // Reg B, R Div MSBs, 0 - ad9510_write_reg(0x0B, 0x00); - // Reg C, R Div LSBs, 1 - ad9510_write_reg(0x0C, 0x01); - // Reg D, Antibacklash, Digital lock det, 0 - - ad9510_write_reg(0x5A, 0x01); // Update Regs - - spi_wait(); - - // Allow for clock switchover - - if (flags & _MC_WE_LOCK){ // WE LOCK - if (flags & _MC_MIMO_CLK_INPUT) { - // Turn on ref output and choose the MIMO connector - output_regs->clk_ctrl = 0x15; - } - else { - // turn on ref output and choose the SMA - output_regs->clk_ctrl = 0x1C; - } - } - else { // WE DONT LOCK - // Disable both ext clk inputs - output_regs->clk_ctrl = 0x10; - } - - // Do we drive a clock onto the MIMO connector? - if (flags & MC_PROVIDE_CLK_TO_MIMO) - clocks_enable_clkexp_out(true,10); - else - clocks_enable_clkexp_out(false,0); -} - -bool -clocks_lock_detect() -{ - if(pic_regs->pending & PIC_CLKSTATUS) - return true; - return false; -} - -int inline -clocks_gen_div(int divisor) -{ - int L,H; - L = (divisor>>1)-1; - H = divisor-L-2; - return (L<<4)|H; -} - -#define CLOCK_OUT_EN 0x08 -#define CLOCK_OUT_DIS_CMOS 0x01 -#define CLOCK_OUT_DIS_PECL 0x02 -#define CLOCK_DIV_DIS 0x80 -#define CLOCK_DIV_EN 0x00 - -#define CLOCK_MODE_PECL 1 -#define CLOCK_MODE_LVDS 2 -#define CLOCK_MODE_CMOS 3 - -void -clocks_enable_XXX_clk(bool enable, int divisor, int reg_en, int reg_div, int mode) -{ - int enable_word, div_word, div_en_word; - - switch(mode) { - case CLOCK_MODE_PECL : - enable_word = enable ? 0x08 : 0x0A; - break; - case CLOCK_MODE_LVDS : - enable_word = enable ? 0x02 : 0x03; - break; - case CLOCK_MODE_CMOS : - enable_word = enable ? 0x08 : 0x09; - break; - } - if(enable && (divisor>1)) { - div_word = clocks_gen_div(divisor); - div_en_word = CLOCK_DIV_EN; - } - else { - div_word = 0; - div_en_word = CLOCK_DIV_DIS; - } - - ad9510_write_reg(reg_en,enable_word); // Output en/dis - ad9510_write_reg(reg_div,div_word); // Set divisor - ad9510_write_reg(reg_div+1,div_en_word); // Enable or Bypass Divider - ad9510_write_reg(0x5A, 0x01); // Update Regs -} - -// Clock 0 -void -clocks_enable_test_clk(bool enable, int divisor) -{ - clocks_enable_XXX_clk(enable,divisor,0x3C,0x48,CLOCK_MODE_PECL); -} - -// Clock 1 -void -clocks_enable_fpga_clk(bool enable, int divisor) -{ - clocks_enable_XXX_clk(enable,divisor,0x3D,0x4A,CLOCK_MODE_PECL); -} - -// Clock 2 on Rev 3, Clock 5 on Rev 4 -void -clocks_enable_clkexp_out(bool enable, int divisor) -{ - if(u2_hw_rev_major == 3) - clocks_enable_XXX_clk(enable,divisor,0x3E,0x4C,CLOCK_MODE_PECL); - else if(u2_hw_rev_major == 4) { - ad9510_write_reg(0x34,0x00); // Turn on fine delay - ad9510_write_reg(0x35,0x00); // Set Full Scale to nearly 10ns - ad9510_write_reg(0x36,0x1c); // Set fine delay. 0x20 is midscale - clocks_enable_XXX_clk(enable,divisor,0x41,0x52,CLOCK_MODE_LVDS); - - } - else - putstr("ERR: Invalid Rev\n"); -} - -// Clock 5 on Rev 3, none (was 2) on Rev 4 -void -clocks_enable_eth_phyclk(bool enable, int divisor) -{ - if(u2_hw_rev_major == 3) - clocks_enable_XXX_clk(enable,divisor,0x41,0x52,CLOCK_MODE_LVDS); - else if(u2_hw_rev_major == 4) - clocks_enable_XXX_clk(enable,divisor,0x3E,0x4C,CLOCK_MODE_PECL); - else - putstr("ERR: Invalid Rev\n"); -} - -// Clock 3 -void -clocks_enable_dac_clk(bool enable, int divisor) -{ - clocks_enable_XXX_clk(enable,divisor,0x3F,0x4E,CLOCK_MODE_PECL); -} - -// Clock 4 -void -clocks_enable_adc_clk(bool enable, int divisor) -{ - clocks_enable_XXX_clk(enable,divisor,0x40,0x50,CLOCK_MODE_LVDS); -} - -// Clock 6 -void -clocks_enable_tx_dboard(bool enable, int divisor) -{ - clocks_enable_XXX_clk(enable,divisor,0x42,0x54,CLOCK_MODE_CMOS); -} - -// Clock 7 -void -clocks_enable_rx_dboard(bool enable, int divisor) -{ - clocks_enable_XXX_clk(enable,divisor,0x43,0x56,CLOCK_MODE_CMOS); -} diff --git a/usrp2/firmware/lib/clocks.h b/usrp2/firmware/lib/clocks.h deleted file mode 100644 index 39a0893c1..000000000 --- a/usrp2/firmware/lib/clocks.h +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifndef INCLUDED_CLOCKS_H -#define INCLUDED_CLOCKS_H - -/* - * Routines to configure our multitude of clocks - */ - -#include <bool.h> -#include <usrp2_mimo_config.h> - - -/*! - * One time call to initialize all clocks to a reasonable state. We - * come out of here using our free running 100MHz oscilator and not - * providing a clock to the MIMO connector (CMC_WE_DONT_LOCK) - */ -void clocks_init(void); - - -/*! - * \brief MIMO clock configuration. - * - * Configure our master clock source, and whether or not we drive a - * clock onto the mimo connector. See MC_flags in usrp2_mimo_config.h. - */ -void clocks_mimo_config(int flags); - -/*! - * \brief Lock Detect -- Return True if our PLL is locked - */ -bool clocks_lock_detect(); - -/*! - * \brief Enable or disable test clock (extra clock signal) - */ -void clocks_enable_test_clk(bool enable, int divisor); - -/*! - * \brief Enable or disable fpga clock. Disabling would wedge and require a power cycle. - */ -void clocks_enable_fpga_clk(bool enable, int divisor); - -/*! - * \brief Enable or disable clock output sent to MIMO connector - */ -void clocks_enable_clkexp_out(bool enable, int divisor); - -/*! - * \brief Enable or disable ethernet phyclk, should always be disabled - */ -void clocks_enable_eth_phyclk(bool enable, int divisor); - -/*! - * \brief Enable or disable clock to DAC - */ -void clocks_enable_dac_clk(bool enable, int divisor); - -/*! - * \brief Enable or disable clock to ADC - */ -void clocks_enable_adc_clk(bool enable, int divisor); - -/*! - * \brief Enable or disable clock to Rx daughterboard - */ -void clocks_enable_rx_dboard(bool enable, int divisor); - - -/*! - * \brief Enable or disable clock to Tx daughterboard - */ -void clocks_enable_tx_dboard(bool enable, int divisor); - - -#endif /* INCLUDED_CLOCKS_H */ diff --git a/usrp2/firmware/lib/db.h b/usrp2/firmware/lib/db.h deleted file mode 100644 index 9c0f41da5..000000000 --- a/usrp2/firmware/lib/db.h +++ /dev/null @@ -1,112 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2009 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -/* - * Interface to daughterboard code - */ - -#ifndef INCLUDED_DB_H -#define INCLUDED_DB_H - -#include <usrp2_types.h> - - -struct db_base; - -/* pointers to daughterboard structures */ -extern struct db_base *tx_dboard; -extern struct db_base *rx_dboard; - - -//! Intermediate tuning information - -struct tune_result -{ - //! The RF frequency that corresponds to DC in the IF from the daughterboard - u2_fxpt_freq_t baseband_freq; - - //! The DDC/DUC frequency used to down/up convert to/from the target frequency - u2_fxpt_freq_t dxc_freq; - - //! Any differerence btwn target and actual (typically < 0.01 Hz) - u2_fxpt_freq_t residual_freq; - - //! Is the complex baseband spectrum inverted - bool inverted; -}; - - -/*! - * \brief One-time init at powerup - * - * Sets rx_dboard, tx_dboard and initializes daughterboards. - */ -void -db_init(void); - -/*! - * \brief Set daughterboard LO offset frequency. - * - * \param[in] db is the daughterboard instance - * \param[in] offset is the amount to add to tuning requests - * \param[out] success or failure - */ -bool -db_set_lo_offset(struct db_base *db, u2_fxpt_freq_t offset); - -/*! - * \brief Two stage tuning. Given target_freq, tune LO and DDC/DUC - * - * \param[in] db is the daughterboard instance - * \param[in] target_freq is the freq to translate the complex baseband to/from. - * \param[out] result provides details of the resulting configuration. - * - */ -bool -db_tune(struct db_base *db, u2_fxpt_freq_t target_freq, struct tune_result *result); - - -/* - * Set only the DDC frequency - */ -bool -db_set_ddc_freq(u2_fxpt_freq_t dxc_freq, u2_fxpt_freq_t *actual_dxc_freq); - -/* - * Set only the DUC frequency - */ -bool -db_set_duc_freq(u2_fxpt_freq_t dxc_freq, u2_fxpt_freq_t *actual_dxc_freq); - - -/*! - * \brief Set gain - */ -bool -db_set_gain(struct db_base *db, u2_fxpt_gain_t gain); - -bool -db_set_antenna(struct db_base *db, int ant); - -/*! - * \brief Read the eeprom value from the db, without defaulting to BasicRX/TX - */ -int -read_dboard_eeprom(int i2c_addr); - -#endif /* INCLUDED_DB_H */ diff --git a/usrp2/firmware/lib/db_base.h b/usrp2/firmware/lib/db_base.h deleted file mode 100644 index 1945efe0b..000000000 --- a/usrp2/firmware/lib/db_base.h +++ /dev/null @@ -1,70 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2009 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifndef INCLUDED_DB_BASE_H -#define INCLUDED_DB_BASE_H - -#include <usrp2_types.h> -#include <bool.h> - -/*! - * \brief "base class" for firmware version of daughterboard code - */ -struct db_base { - uint16_t dbid; //< daughterboard ID - - uint16_t is_tx : 1; //< is this a transmit db? - uint16_t is_quadrature : 1; - uint16_t i_and_q_swapped : 1; - uint16_t spectrum_inverted : 1; - - uint16_t output_enables; //< bitmask of which pins should be outputs from FPGA - uint16_t used_pins; //< bitmask of pins used by the daughterboard - - u2_fxpt_freq_t freq_min; //< min freq that can be set (Hz) - u2_fxpt_freq_t freq_max; //< max freq that can be set (Hz) - - u2_fxpt_gain_t gain_min; //< min gain that can be set (dB) - u2_fxpt_gain_t gain_max; //< max gain that can be set (dB) - u2_fxpt_gain_t gain_step_size; //< (dB) - - u2_fxpt_freq_t default_lo_offset; //< offset to add to tune frequency, reset value - u2_fxpt_freq_t current_lo_offset; //< current value of lo_offset - - /* - * Auto T/R control values - */ - uint32_t atr_mask; //< which bits to control - uint32_t atr_txval; //< value to use when transmitting - uint32_t atr_rxval; //< value to use when receiving - - //! delay in clk ticks from when Tx fifo gets data to when T/R switches - // uint32_t atr_tx_delay; - - //! delay in clk ticks from when Tx fifo goes empty to when T/R switches - // uint32_t atr_rx_delay; - - bool (*init)(struct db_base *); - bool (*set_freq)(struct db_base *, u2_fxpt_freq_t freq, u2_fxpt_freq_t *dc); - bool (*set_gain)(struct db_base *, u2_fxpt_gain_t gain); - bool (*set_tx_enable)(struct db_base *, bool on); - bool (*set_antenna)(struct db_base *, int ant); -}; - - -#endif /* INCLUDED_DB_BASE_H */ diff --git a/usrp2/firmware/lib/db_basic.c b/usrp2/firmware/lib/db_basic.c deleted file mode 100644 index 8f86f060b..000000000 --- a/usrp2/firmware/lib/db_basic.c +++ /dev/null @@ -1,165 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2009 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - - -#include <db_base.h> - -bool db_basic_init(struct db_base *db); -bool db_basic_set_freq(struct db_base *db, u2_fxpt_freq_t freq, u2_fxpt_freq_t *dc); -bool db_basic_set_gain(struct db_base *db, u2_fxpt_gain_t gain); -bool db_basic_set_tx_enable(struct db_base *, bool on); - -struct db_basic { - struct db_base base; -}; - - -struct db_basic db_basic_tx = { - .base.dbid = 0x0000, - .base.is_tx = true, - .base.output_enables = 0x0000, - .base.used_pins = 0x0000, - .base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(-90e9), - .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(90e9), - .base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(0), - .base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(0), - .base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(0), - .base.is_quadrature = true, - .base.i_and_q_swapped = false, - .base.spectrum_inverted = false, - .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0), - .base.atr_mask = 0, - .base.atr_txval = 0, - .base.atr_rxval = 0, - //.base.atr_tx_delay = 0, - //.base.atr_rx_delay = 0, - - .base.init = db_basic_init, - .base.set_freq = db_basic_set_freq, - .base.set_gain = db_basic_set_gain, - .base.set_tx_enable = db_basic_set_tx_enable, - .base.set_antenna = 0, -}; - -struct db_basic db_basic_rx = { - .base.dbid = 0x0001, - .base.is_tx = false, - .base.output_enables = 0x0000, - .base.used_pins = 0x0000, - .base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(-90e9), - .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(90e9), - .base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(0), - .base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(0), - .base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(0), - .base.is_quadrature = false, - .base.i_and_q_swapped = false, - .base.spectrum_inverted = false, - .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0), - .base.atr_mask = 0, - .base.atr_txval = 0, - .base.atr_rxval = 0, - //.base.atr_tx_delay = 0, - //.base.atr_rx_delay = 0, - - .base.init = db_basic_init, - .base.set_freq = db_basic_set_freq, - .base.set_gain = db_basic_set_gain, - .base.set_tx_enable = db_basic_set_tx_enable, - .base.set_antenna = 0, -}; - -struct db_basic db_lf_tx = { - .base.dbid = 0x000e, - .base.is_tx = true, - .base.output_enables = 0x0000, - .base.used_pins = 0x0000, - .base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(-32e6), - .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(32e6), - .base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(0), - .base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(0), - .base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(0), - .base.is_quadrature = true, - .base.i_and_q_swapped = false, - .base.spectrum_inverted = false, - .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0), - .base.atr_mask = 0, - .base.atr_txval = 0, - .base.atr_rxval = 0, - //.base.atr_tx_delay = 0, - //.base.atr_rx_delay = 0, - - .base.init = db_basic_init, - .base.set_freq = db_basic_set_freq, - .base.set_gain = db_basic_set_gain, - .base.set_tx_enable = db_basic_set_tx_enable, - .base.set_antenna = 0, -}; - -struct db_basic db_lf_rx = { - .base.dbid = 0x000f, - .base.is_tx = false, - .base.output_enables = 0x0000, - .base.used_pins = 0x0000, - .base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(0), - .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(32e6), - .base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(0), - .base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(0), - .base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(0), - .base.is_quadrature = false, - .base.i_and_q_swapped = false, - .base.spectrum_inverted = false, - .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0), - .base.atr_mask = 0, - .base.atr_txval = 0, - .base.atr_rxval = 0, - //.base.atr_tx_delay = 0, - //.base.atr_rx_delay = 0, - - .base.init = db_basic_init, - .base.set_freq = db_basic_set_freq, - .base.set_gain = db_basic_set_gain, - .base.set_tx_enable = db_basic_set_tx_enable, - .base.set_antenna = 0, -}; - - -bool -db_basic_init(struct db_base *db) -{ - return true; -} - -bool -db_basic_set_freq(struct db_base *db, u2_fxpt_freq_t freq, u2_fxpt_freq_t *dc) -{ - *dc = 0; - return true; -} - -bool -db_basic_set_gain(struct db_base *db, u2_fxpt_gain_t gain) -{ - return true; -} - -bool -db_basic_set_tx_enable(struct db_base *db, bool on) -{ - return true; -} - diff --git a/usrp2/firmware/lib/db_bitshark_rx.c b/usrp2/firmware/lib/db_bitshark_rx.c deleted file mode 100644 index cf7370ff0..000000000 --- a/usrp2/firmware/lib/db_bitshark_rx.c +++ /dev/null @@ -1,367 +0,0 @@ -/* - * Copyright 2010 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - * - */ - -#include "db_bitshark_rx.h" -#include <memory_map.h> -#include <db_base.h> -#include <hal_io.h> -#include <mdelay.h> -#include <lsdac.h> -#include <clocks.h> -#include <stdio.h> -#include <stdint.h> -#include <string.h> -#include <i2c.h> - -/* Note: Thie general structure of this file is based on the db_wbxng.c - codebase for the wbx daughterboard. */ - -/* The following defines specify the address map provided by the - Bitshark USRP Rx (BURX) board. These registers are all accessed over I2C. */ -#define RF_CENTER_FREQ_REG 0x00 -#define RF_CHAN_FILTER_BW_REG 0x01 -#define RF_GAIN_REG 0x02 -#define BB_GAIN_REG 0x03 -#define ADF4350_REG 0x10 -#define SKY73202_REG 0x11 -#define CLOCK_SCHEME_REG 0x20 - -/* The following table lists the registers provided by the Bitshark board - that are accessible over I2C: - -------------------------------------------------------- - |RegAddr: 0x00-RF Center Freq register | - |4-bytes 0x00| - |4-byte unsigned RF center freq (in KHz)| - |RegAddr: 0x01-RF channel filter bandwidth register | - |4-bytes 0x00| - |4-byte unsigned RF channel filter bw (in KHz)| - |RegAddr: 0x02-RF gain register | - |7-bytes 0x00| - |1-byte signed RF gain (in dB)| - |RegAddr: 0x03-Baseband gain register | - |4-bytes 0x00| - |4-byte signed baseband filter gain (in dB)| - |RegAddr: 0x10-ADF4350 register | - |4-bytes 0x00| - |4-byte ADF4350 register value (actual ADF4350 reg addr embedded - within 4-byte value)| - |RegAddr: 0x11-SKY73202 register | - |5-bytes 0x00| - |1-byte reg 0 of SKY73202 | - |1-byte reg 1 of SKY73202 | - |1-byte reg 2 of SKY73202 | - |RegAddr: 0x20-Clock Scheme | - |3-bytes 0x00| - |1-byte indicating clocking scheme: - -0x00 -> BURX local TCXO off, BURX accepts ref clock from - USRP2 (freq of USRP2's ref clock specified in bytes 2-5) - -0x01 -> BURX local TCXO on, BURX uses its local TCXO as its ref - clock, TCXO signal output for use as phase lock for USRP2 | - |4-byte USRP2 ref clock freq in hz (only needed if byte 1 set to 0x00) | - - --------------------------------------------------------------------------- - - As an example, lets say the client wants to set an RF center freq of - 1000 MHz. In KHz, this translates to 1000000 (resolution is only down to - steps of 1 KHz), which is 0x000F4240 in hex. So the complete 9-byte I2C - sequence that the client should send is as follows: - byte 0: 0x00-register 0x00 is the target of the write operation - bytes 1-4: 0x00 (padding) - byte 5: 0x00 (MSB of the 1000000 KHz value, in hex) - byte 6: 0x0F - byte 7: 0x42 - byte 8: 0x40 (LSB of the 1000000 KHz value, in hex) - - How about another example...lets say the client wants to setup the clock - scheme to use scheme #1 where the 26 MHz TCXO on the BURX board is enabled, - and is provided to the USRP2 for it to phase lock to it as an external ref. - 26 MHz (i.e. 26 million), in hex, is 0x18CBA80. - So the complete 9-byte I2C sequence that the client should send is as follows: - byte 0: 0x20-register 0x20 is the target of the write operation - bytes 1-3: 0x00 (padding) - byte 4: 0x01 (indicating that clock scheme #1 is wanted) - byte 5: 0x01 (MSB of the BURX ref clk freq) - byte 6: 0x8C - byte 7: 0xBA - byte 8: 0x80 (LSB of the BURX ref clk freq) - - Note: The endian-ness of 4-byte values used in I2C cmds is different on - USRP2 compared to USRP1. - -*/ - -#define NUM_BYTES_IN_I2C_CMD 9 -#define I2C_ADDR 0x47 - -bool bitshark_rx_init(struct db_base *dbb); -bool bitshark_rx_set_freq(struct db_base *dbb, u2_fxpt_freq_t freq, u2_fxpt_freq_t *dc); -bool bitshark_rx_set_gain(struct db_base *dbb, u2_fxpt_gain_t gain); -bool bitshark_rx_set_bw(struct db_base *dbb, uint16_t bw); - -static bool set_clock_scheme(uint8_t clock_scheme, uint32_t ref_clk_freq); - -/* - * The class instances - */ -struct db_bitshark_rx db_bitshark_rx = { - .base.dbid = 0x0070, - .base.is_tx = false, - .base.output_enables = 0x0000, - .base.used_pins = 0x0000, - .base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(300e6), - .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(4000e6), - .base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(0), - .base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(42), - .base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(6), - .base.is_quadrature = true, - .base.i_and_q_swapped = true, - .base.spectrum_inverted = false, - .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0), - .base.init = bitshark_rx_init, - .base.set_freq = bitshark_rx_set_freq, - .base.set_gain = bitshark_rx_set_gain, - .base.set_tx_enable = 0, - .base.atr_mask = 0x0000, - .base.atr_txval = 0, - .base.atr_rxval = 0, - .base.set_antenna = 0, - .extra.bw_min = 660, /* in KHz, so 660 KHz */ - .extra.bw_max = 56000, /* in KHz, so 56 MHz */ - .extra.set_bw = bitshark_rx_set_bw -}; - -bool -bitshark_rx_init(struct db_base *dbb) -{ - struct db_bitshark_rx_dummy *db = (struct db_bitshark_rx_dummy *) dbb; - - clocks_enable_rx_dboard(true, 0); - /* hal_gpio_write( GPIO_RX_BANK, ENABLE_5|ENABLE_33, ENABLE_5|ENABLE_33 ); */ - /* above isn't needed, since we don't have any GPIO from the FPGA */ - - /* setup the clock scheme to accept the USRP2's 100 MHz ref clk */ - set_clock_scheme(0,100000000); - - /* initial setting of gain */ - dbb->set_gain(dbb,U2_DOUBLE_TO_FXPT_GAIN(20.0)); - - /* Set the freq now to get the one time 10ms delay out of the way. */ - u2_fxpt_freq_t dc; - dbb->set_freq(dbb, dbb->freq_min, &dc); - - /* set up the RF bandwidth of the signal of interest...Note: there - doesn't appear to be a standard way of setting this bandwidth - in USRP2-land (compared to USRP1-land, where we have the - straight-forward set_bw() method). Not sure why this is, but - for now, simply set the bandwidth once for the intended - application. */ - db->extra.set_bw(dbb, 25000); /* 25 MHz channel bw */ - - return true; -} - -bool -bitshark_rx_set_freq(struct db_base *dbb, u2_fxpt_freq_t freq, u2_fxpt_freq_t *dc) -{ - struct db_bitshark_rx_dummy *db = (struct db_bitshark_rx_dummy *) dbb; - unsigned char args[NUM_BYTES_IN_I2C_CMD]; - unsigned char val[4]; - uint32_t freq_in_hz = (uint32_t)(u2_fxpt_freq_round_to_uint(freq)); - uint32_t freq_div_5mhz = freq_in_hz/5000000; - uint32_t freq_rounded_to_5mhz_in_khz = freq_div_5mhz*5000; - uint64_t freq_rounded_to_5mhz_in_hz = ((uint64_t)freq_rounded_to_5mhz_in_khz)*1000; - uint64_t temp; - - if(!(freq>=db->base.freq_min && freq<=db->base.freq_max)) - { - return false; - } - - /* There is a bug in the BURX firmware where tuning to frequencies - above 2.2 GHz will result in a small final frequency error - (up to a few KHz). This bug is due to an overflow of a 16-bit - value when the input reference clock is sufficiently high (such - as the 100 MHz clock used on the USRP2), AND the requested tuning - frequency is not a multiple of 5 MHz. A fix for the BURX firmware - is available from Epiq Solutions, but requires an AVR microcontroller - programmer to update the firmware on the BURX card directly. An - alternate solution is to enforce a policy where the BURX card only - tunes to frequencies that are multiples of 5 MHz, and uses the - DDC in the FPGA to perform any fine-tuning less than 5 MHz. So - an application can still request an abribrary RF tuning frequency, - but the BURX card will be directed to tune to the next lowest - multiple of 5 MHz, and return the DC-centered freq to the calling - function to allow the DDC in the FPGA to perform the final - down-conversion digitally. This policy also reduces the overall - spurious content due to the LO synthesizer, as the Frac-N portion - of the ADF4350 synthesizer isn't being invoked in modes where - high spur content would be seen. */ - - memset(args,0x00,NUM_BYTES_IN_I2C_CMD); - memcpy(val,&freq_rounded_to_5mhz_in_khz,4); - args[0] = RF_CENTER_FREQ_REG; - args[5] = val[3]; - args[6] = val[2]; - args[7] = val[1]; - args[8] = val[0]; - - i2c_write(I2C_ADDR, args, NUM_BYTES_IN_I2C_CMD); - /* Add a brief delay after each command. This only seems to be - necessary when sending a sequence of commands one after the other. - This issue appears to be specific to the USRP2, since it isn't - necessary on the USRP1. The 5 mS delay is a bit of - an emperical compromise: too short (say, 1 mS), and every once - in a great while a command will still be magically dropped on its - way out...too long (say, 500 mS) and higher-level apps such as - usrp2_fft.py seem to choke because the init sequence is taking - too long. So 5 mS was tested repeatedly without error, and deemed - reasonable. Not sure if this is an issue with the I2C master - code in the microblaze or some place else, and I hate magic - delays too, but this seems to be stable. */ - mdelay(5); - - /* shift the value up so that it is represented properly in the fixed - point mode... - */ - temp = freq_rounded_to_5mhz_in_hz << U2_FPF_RP; - - - *dc = (u2_fxpt_freq_t)temp; - return true; -} - -bool -bitshark_rx_set_gain(struct db_base *dbb, u2_fxpt_gain_t gain) -{ - struct db_bitshark_rx_dummy *db = (struct db_bitshark_rx_dummy *) dbb; - - unsigned char args[NUM_BYTES_IN_I2C_CMD]; - uint8_t final_gain = (uint8_t)(u2_fxpt_gain_round_to_int(gain)); - - if(!(gain >= db->base.gain_min && gain <= db->base.gain_max)) - { - return false; - } - - memset(args,0x00,NUM_BYTES_IN_I2C_CMD); - args[0] = RF_GAIN_REG; - args[5] = final_gain; - - i2c_write(I2C_ADDR, args, NUM_BYTES_IN_I2C_CMD); - /* Add a brief delay after each command. This only seems to be - necessary when sending a sequence of commands one after the other. - This issue appears to be specific to the USRP2, since it isn't - necessary on the USRP1. The 5 mS delay is a bit of - an emperical compromise: too short (say, 1 mS), and every once - in a great while a command will still be magically dropped on its - way out...too long (say, 500 mS) and higher-level apps such as - usrp2_fft.py seem to choke because the init sequence is taking - too long. So 5 mS was tested repeatedly without error, and deemed - reasonable. Not sure if this is an issue with the I2C master - code in the microblaze or some place else, and I hate magic - delays too, but this seems to be stable. */ - mdelay(5); - - return true; -} - -bool -bitshark_rx_set_bw(struct db_base *dbb, uint16_t bw_in_khz) -{ - struct db_bitshark_rx_dummy *db = (struct db_bitshark_rx_dummy *) dbb; - unsigned char val[2]; - unsigned char args[NUM_BYTES_IN_I2C_CMD]; - - if(!(bw_in_khz >= db->extra.bw_min && bw_in_khz <= db->extra.bw_max)) - { - return false; - } - - memset(args,0x00,NUM_BYTES_IN_I2C_CMD); - memcpy(val,&bw_in_khz,2); - args[0] = RF_CHAN_FILTER_BW_REG; - args[5] = val[1]; - args[6] = val[0]; - - i2c_write(I2C_ADDR, args, NUM_BYTES_IN_I2C_CMD); - /* Add a brief delay after each command. This only seems to be - necessary when sending a sequence of commands one after the other. - This issue appears to be specific to the USRP2, since it isn't - necessary on the USRP1. The 5 mS delay is a bit of - an emperical compromise: too short (say, 1 mS), and every once - in a great while a command will still be magically dropped on its - way out...too long (say, 500 mS) and higher-level apps such as - usrp2_fft.py seem to choke because the init sequence is taking - too long. So 5 mS was tested repeatedly without error, and deemed - reasonable. Not sure if this is an issue with the I2C master - code in the microblaze or some place else, and I hate magic - delays too, but this seems to be stable. */ - mdelay(5); - - return true; -} - -static bool -set_clock_scheme(uint8_t clock_scheme, uint32_t ref_clk_freq) -{ - /* Set the clock scheme for determining how the BURX - dboard receives its clock. For the USRP2, there is really only - one way of doing this, which is to use the 100 MHz ref clk - on the USRP2 as its reference. However, it is possible to - use the BURX's 26 MHz TCXO as the external reference input to - the USRP, which would provide phase lock between our oscillator - and the USRP's 100 MHz oscillator. And since the BURX board - provides the ability to warp the oscillator, this may be - useful to some folks. Otherwise, the BURX board will always - just take the 100 MHz reference from the USRP2 as its reference. - */ - - unsigned char args[NUM_BYTES_IN_I2C_CMD]; - char val[4]; - - if (clock_scheme > 1) - { - return false; - } - - memcpy(val,&ref_clk_freq,4); - args[0] = CLOCK_SCHEME_REG; - args[4] = clock_scheme; - args[5] = val[3]; - args[6] = val[2]; - args[7] = val[1]; - args[8] = val[0]; - - i2c_write(I2C_ADDR, args, NUM_BYTES_IN_I2C_CMD); - /* Add a brief delay after each command. This only seems to be - necessary when sending a sequence of commands one after the other. - This issue appears to be specific to the USRP2, since it isn't - necessary on the USRP1. The 5 mS delay is a bit of - an emperical compromise: too short (say, 1 mS), and every once - in a great while a command will still be magically dropped on its - way out...too long (say, 500 mS) and higher-level apps such as - usrp2_fft.py seem to choke because the init sequence is taking - too long. So 5 mS was tested repeatedly without error, and deemed - reasonable. Not sure if this is an issue with the I2C master - code in the microblaze or some place else, and I hate magic - delays too, but this seems to be stable. */ - mdelay(5); - - return true; -} - diff --git a/usrp2/firmware/lib/db_bitshark_rx.h b/usrp2/firmware/lib/db_bitshark_rx.h deleted file mode 100644 index 3651f27b8..000000000 --- a/usrp2/firmware/lib/db_bitshark_rx.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2010 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - * - */ - -#ifndef DB_BITSHARK_RX_H -#define DB_BITSHARK_RX_H - -#include <db_base.h> - -struct db_bitshark_rx_extra -{ - uint16_t bw_min; - uint16_t bw_max; - bool (*set_bw)(struct db_base *, uint16_t bw); - -}; - -struct db_bitshark_rx_dummy -{ - struct db_base base; - struct db_bitshark_rx_extra extra; -}; - - -struct db_bitshark_rx -{ - struct db_base base; - struct db_bitshark_rx_extra extra; -}; - - -#endif /* DB_BITSHARK_RX_H */ diff --git a/usrp2/firmware/lib/db_dbsrx.c b/usrp2/firmware/lib/db_dbsrx.c deleted file mode 100644 index ce1300bf2..000000000 --- a/usrp2/firmware/lib/db_dbsrx.c +++ /dev/null @@ -1,396 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#include <i2c.h> -#include <db_base.h> -#include <lsdac.h> -#include <memory_map.h> -#include <clocks.h> -#include <stdio.h> -#include <hal_io.h> - -#define min(X,Y) ((X) < (Y) ? (X) : (Y)) -#define max(X,Y) ((X) > (Y) ? (X) : (Y)) -#define abs(X) ((X) < (0) ? ((-1)*(X)) : (X)) - -#define I2C_ADDR 0x67 -#define REFCLK_DIVISOR 25 // Gives a 4 MHz clock -#define REFCLK_FREQ U2_DOUBLE_TO_FXPT_FREQ(MASTER_CLK_RATE/REFCLK_DIVISOR) -#define REFCLK_FREQ_INT u2_fxpt_freq_round_to_int(REFCLK_FREQ) - -#define VMAXGAIN .75 -#define VMINGAIN 2.6 -#define RFGAINMAX 60 -#define BBGAINMAX 24 -#define DACFULLSCALE 3.3 - -bool db_dbsrx_init(struct db_base *db); -bool db_dbsrx_set_freq(struct db_base *db, u2_fxpt_freq_t freq, u2_fxpt_freq_t *dc); -bool db_dbsrx_set_gain(struct db_base *db, u2_fxpt_gain_t gain); - -struct db_dbsrx_common { - int d_n; - int d_div2; - int d_osc; - int d_cp; - int d_r_reg; - int d_fdac; - int d_m; - int d_dl; - int d_ade; - int d_adl; - int d_gc2; - int d_diag; -}; - -struct db_dbsrx_dummy { - struct db_base base; - struct db_dbsrx_common common; -}; - -struct db_dbsrx { - struct db_base base; - struct db_dbsrx_common common; -}; - -struct db_dbsrx db_dbsrx = { - .base.dbid = 0x000d, - .base.is_tx = false, - .base.output_enables = 0x0000, - .base.used_pins = 0x0000, - .base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(500e6), - .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(2.6e9), - .base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(0), - .base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(RFGAINMAX+BBGAINMAX), - .base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(1), - .base.is_quadrature = true, - .base.i_and_q_swapped = false, - .base.spectrum_inverted = false, - .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0), - .base.init = db_dbsrx_init, - .base.set_freq = db_dbsrx_set_freq, - .base.set_gain = db_dbsrx_set_gain, - .base.set_tx_enable = 0, - .base.atr_mask = 0x0000, - .base.atr_txval = 0, - .base.atr_rxval = 0, - //.base.atr_tx_delay = - //.base.atr_rx_delay = - .common.d_n = 950, - .common.d_div2 = 0, - .common.d_osc = 5, - .common.d_cp = 3, - .common.d_r_reg = 1, - .common.d_fdac = 127, - .common.d_m = 2, - .common.d_dl = 1, - .common.d_ade = 0, - .common.d_adl = 0, - .common.d_gc2 = 31, - .common.d_diag = 0, - .base.set_antenna = 0, -}; - -bool -db_dbsrx_init(struct db_base *dbb){ - struct db_dbsrx_dummy *db = (struct db_dbsrx_dummy *) dbb; - db->base.set_gain(dbb, (db->base.gain_max + db->base.gain_min)/2); - clocks_enable_rx_dboard(true, REFCLK_DIVISOR); // Gives 4 MHz clock - - return true; -} - -/************************************************** - * Registers - **************************************************/ -static int -_read_adc (void){ - unsigned char readback[2]; - i2c_read(I2C_ADDR, readback, 2*sizeof(unsigned char)); - int adc_val = (readback[0] >> 2)&7; - //printf("READBACK[0] %d, [1] %d\n",readback[0],readback[1]); - //printf("ADC: %d\n",adc_val); - return adc_val; -} - -static void -_write_reg (int regno, int v){ - //regno is in [0,5], v is value to write to register""" - unsigned char args[2]; - args[0] = (unsigned char)regno; - args[1] = (unsigned char)v; - i2c_write(I2C_ADDR, args, 2*sizeof(unsigned char)); - //printf("Reg %d, Val %x\n",regno,v); -} - -static void _send_reg_0(struct db_dbsrx_dummy *db){ - _write_reg(0,(db->common.d_div2<<7) + (db->common.d_n>>8)); -} - -static void _send_reg_1(struct db_dbsrx_dummy *db){ - _write_reg(1,db->common.d_n & 255); -} - -static void _send_reg_2(struct db_dbsrx_dummy *db){ - _write_reg(2,db->common.d_osc + (db->common.d_cp<<3) + (db->common.d_r_reg<<5)); -} - -static void _send_reg_3(struct db_dbsrx_dummy *db){ - _write_reg(3,db->common.d_fdac); -} - -static void _send_reg_4(struct db_dbsrx_dummy *db){ - _write_reg(4,db->common.d_m + (db->common.d_dl<<5) + (db->common.d_ade<<6) + (db->common.d_adl<<7)); -} - -static void _send_reg_5(struct db_dbsrx_dummy *db){ - _write_reg(5,db->common.d_gc2 + (db->common.d_diag<<5)); -} - -/************************************************** - * Helpers for setting the freq - **************************************************/ -static void -_set_div2(struct db_dbsrx_dummy *db, int div2){ - db->common.d_div2 = div2; - _send_reg_0(db); -} - -// FIXME How do we handle ADE and ADL properly? -static void -_set_ade(struct db_dbsrx_dummy *db, int ade){ - db->common.d_ade = ade; - _send_reg_4(db); -} - -static void -_set_r(struct db_dbsrx_dummy *db, int r){ - db->common.d_r_reg = r; - _send_reg_2(db); -} - -static void -_set_n(struct db_dbsrx_dummy *db, int n){ - db->common.d_n = n; - _send_reg_0(db); - _send_reg_1(db); -} - -static void -_set_osc(struct db_dbsrx_dummy *db, int osc){ - db->common.d_osc = osc; - _send_reg_2(db); -} - -static void -_set_cp(struct db_dbsrx_dummy *db, int cp){ - db->common.d_cp = cp; - _send_reg_2(db); -} - -/************************************************** - * Set the freq - **************************************************/ - - -bool -db_dbsrx_set_freq(struct db_base *dbb, u2_fxpt_freq_t freq, u2_fxpt_freq_t *dc){ - struct db_dbsrx_dummy *db = (struct db_dbsrx_dummy *) dbb; - - if(!(freq>=db->base.freq_min && freq<=db->base.freq_max)) { - return false; - } - - u2_fxpt_freq_t vcofreq; - if(freq < U2_DOUBLE_TO_FXPT_FREQ(1150e6)) { - _set_div2(db, 0); - vcofreq = 4 * freq; - } - else { - _set_div2(db, 1); - vcofreq = 2 * freq; - } - - _set_ade(db, 1); - int rmin = max(2, u2_fxpt_freq_round_to_int(REFCLK_FREQ/2e6)); //TODO? remove max() - //int rmax = min(128, u2_fxpt_freq_round_to_int(REFCLK_FREQ/500e3)); //TODO? remove min() - int n = 0; - u2_fxpt_freq_t best_delta = U2_DOUBLE_TO_FXPT_FREQ(10e6); - u2_fxpt_freq_t delta; - - int r_reg = 0; - while ((r_reg<7) && ((2<<r_reg) < rmin)) { - r_reg++; - } - //printf ("r_reg = %d, r = %d\n",r_reg,2<<r_reg); - int best_r = r_reg; - int best_n = 0; - - while(r_reg <= 7) { - n = u2_fxpt_freq_round_to_int(freq/REFCLK_FREQ_INT*(2<<r_reg)); - //printf("LOOP: r_reg %d, best_r %d, best_n %d, best_delta %d\n", - //r_reg,best_r,best_n,u2_fxpt_freq_round_to_int(best_delta)); - - //printf("N: %d\n",n); - if(n<256) { - r_reg++; - continue; - } - delta = abs(n*REFCLK_FREQ/(2<<r_reg) - freq); - if(delta < best_delta) { - best_r = r_reg; - best_n = n; - best_delta = delta; - } - if(best_delta < U2_DOUBLE_TO_FXPT_FREQ(75e3)) { - break; - } - r_reg++; - } - - //printf("BEST R: %d Best Delta %d Best N %d\n", - // best_r,u2_fxpt_freq_round_to_int(best_delta),best_n); - _set_r(db, best_r); - _set_n(db, best_n); - - int vco; - if(vcofreq < U2_DOUBLE_TO_FXPT_FREQ(2433e6)) - vco = 0; - else if(vcofreq < U2_DOUBLE_TO_FXPT_FREQ(2711e6)) - vco=1; - else if(vcofreq < U2_DOUBLE_TO_FXPT_FREQ(3025e6)) - vco=2; - else if(vcofreq < U2_DOUBLE_TO_FXPT_FREQ(3341e6)) - vco=3; - else if(vcofreq < U2_DOUBLE_TO_FXPT_FREQ(3727e6)) - vco=4; - else if(vcofreq < U2_DOUBLE_TO_FXPT_FREQ(4143e6)) - vco=5; - else if(vcofreq < U2_DOUBLE_TO_FXPT_FREQ(4493e6)) - vco=6; - else - vco=7; - //printf("Initial VCO choice %d\n",vco); - _set_osc(db, vco); - - - int adc_val = 0; - while(adc_val == 0 || adc_val == 7) { - adc_val = _read_adc(); - //printf("adc %d\n",adc_val); - - if(adc_val == 0) { - if(vco <= 0) { - return false; - } - else { - vco = vco - 1; - } - } - else if(adc_val == 7) { - if(vco >= 7) { - return false; - } - else { - vco = vco + 1; - } - } - _set_osc(db, vco); - } - - if(adc_val == 1 || adc_val == 2) { - _set_cp(db, 1); - } - else if(adc_val == 3 || adc_val == 4) { - _set_cp(db, 2); - } - else { - _set_cp(db, 3); - } - //printf("Final VCO choice %d\n",vco); - - *dc = db->common.d_n * REFCLK_FREQ / (2<<db->common.d_r_reg); - return true; - -} - -/************************************************** - * Helpers for setting the gain - **************************************************/ - -static void -_set_gc2(struct db_dbsrx_dummy *db, int gc2){ - db->common.d_gc2 = gc2; - _send_reg_5(db); -} - -/************************************************** - * Set the gain - **************************************************/ -bool -db_dbsrx_set_gain(struct db_base *dbb, u2_fxpt_gain_t gain){ - struct db_dbsrx_dummy *db = (struct db_dbsrx_dummy *) dbb; - - u2_fxpt_gain_t rfgain, bbgain; - - if(!(gain >= db->base.gain_min && gain <= db->base.gain_max)) { - return false; - } - - if(gain < U2_DOUBLE_TO_FXPT_GAIN(RFGAINMAX)) { - rfgain = gain; - bbgain = 0; - } - else { - rfgain = U2_DOUBLE_TO_FXPT_GAIN(RFGAINMAX); - bbgain = gain - U2_DOUBLE_TO_FXPT_GAIN(RFGAINMAX); - } - - int rf_gain_slope_q8 = 256 * 4096 * (VMAXGAIN-VMINGAIN) / RFGAINMAX / DACFULLSCALE; - int rf_gain_offset_q8 = 128 * 256 * 4096 * VMINGAIN / DACFULLSCALE; - - int rfdac = (rfgain*rf_gain_slope_q8 + rf_gain_offset_q8)>>15; - - //printf("Set RF Gain %d, %d\n",rfgain,rfdac); - lsdac_write_rx(1,rfdac); - - // Set GC2 - int bb_gain_slope_q8 = 256*(0-31)/(BBGAINMAX-0); - - int gc2 = u2_fxpt_gain_round_to_int((bb_gain_slope_q8 * bbgain)>>8) + 31; - //printf("Set BB Gain: %d, gc2 %d\n",bbgain,gc2); - - _set_gc2(db, gc2); - - return true; -} - -/************************************************** - * Helpers for setting the bw - **************************************************/ -static void -_set_m(struct db_dbsrx_dummy *db, int m){ - db->common.d_m = m; - _send_reg_4(db); -} - -static void -_set_fdac(struct db_dbsrx_dummy *db, int fdac){ - db->common.d_fdac = fdac; - _send_reg_3(db); -} diff --git a/usrp2/firmware/lib/db_init.c b/usrp2/firmware/lib/db_init.c deleted file mode 100644 index d58badc9e..000000000 --- a/usrp2/firmware/lib/db_init.c +++ /dev/null @@ -1,434 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2009 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - - -#include <memory_map.h> -#include <i2c.h> -#include <usrp2_i2c_addr.h> -#include <string.h> -#include <stdio.h> -#include <db.h> -#include <db_base.h> -#include <hal_io.h> -#include <nonstdio.h> - - -struct db_base *tx_dboard; // the tx daughterboard that's installed -struct db_base *rx_dboard; // the rx daughterboard that's installed - -extern struct db_base db_basic_tx; -extern struct db_base db_basic_rx; -extern struct db_base db_lf_tx; -extern struct db_base db_lf_rx; -extern struct db_base db_rfx_400_tx; -extern struct db_base db_rfx_400_rx; -extern struct db_base db_rfx_900_tx; -extern struct db_base db_rfx_900_rx; -extern struct db_base db_rfx_1200_tx; -extern struct db_base db_rfx_1200_rx; -extern struct db_base db_rfx_1800_tx; -extern struct db_base db_rfx_1800_rx; -extern struct db_base db_rfx_2400_tx; -extern struct db_base db_rfx_2400_rx; -extern struct db_base db_wbxng_rx; -extern struct db_base db_wbxng_tx; -extern struct db_base db_tvrx1; -extern struct db_base db_tvrx2; -extern struct db_base db_tvrx3; -extern struct db_base db_dbsrx; -extern struct db_base db_bitshark_rx; - -struct db_base *all_dboards[] = { - &db_basic_tx, - &db_basic_rx, - &db_lf_tx, - &db_lf_rx, - &db_rfx_400_tx, - &db_rfx_400_rx, - &db_rfx_900_tx, - &db_rfx_900_rx, - &db_rfx_1200_tx, - &db_rfx_1200_rx, - &db_rfx_1800_tx, - &db_rfx_1800_rx, - &db_rfx_2400_tx, - &db_rfx_2400_rx, - &db_tvrx1, -#if 0 - &db_tvrx2, -#endif - &db_tvrx3, - &db_dbsrx, - &db_bitshark_rx, - 0 -}; - - -typedef enum { UDBE_OK, UDBE_NO_EEPROM, UDBE_INVALID_EEPROM } usrp_dbeeprom_status_t; - -static usrp_dbeeprom_status_t -read_raw_dboard_eeprom (unsigned char *buf, int i2c_addr) -{ - if (!eeprom_read (i2c_addr, 0, buf, DB_EEPROM_CLEN)) - return UDBE_NO_EEPROM; - - if (buf[DB_EEPROM_MAGIC] != DB_EEPROM_MAGIC_VALUE) - return UDBE_INVALID_EEPROM; - - int sum = 0; - unsigned int i; - for (i = 0; i < DB_EEPROM_CLEN; i++) - sum += buf[i]; - - if ((sum & 0xff) != 0) - return UDBE_INVALID_EEPROM; - - return UDBE_OK; -} - - -/* - * Return DBID, -1 <none> or -2 <invalid eeprom contents> - */ -int -read_dboard_eeprom(int i2c_addr) -{ - unsigned char buf[DB_EEPROM_CLEN]; - - usrp_dbeeprom_status_t s = read_raw_dboard_eeprom (buf, i2c_addr); - - //printf("\nread_raw_dboard_eeprom: %d\n", s); - - switch (s){ - case UDBE_OK: - return (buf[DB_EEPROM_ID_MSB] << 8) | buf[DB_EEPROM_ID_LSB]; - - case UDBE_NO_EEPROM: - default: - return -1; - - case UDBE_INVALID_EEPROM: - return -2; - } -} - - -static struct db_base * -lookup_dbid(int dbid) -{ - if (dbid < 0) - return 0; - - int i; - for (i = 0; all_dboards[i]; i++) - if (all_dboards[i]->dbid == dbid) - return all_dboards[i]; - - return 0; -} - -static struct db_base * -lookup_dboard(int i2c_addr, struct db_base *default_db, char *msg) -{ - struct db_base *db; - int dbid = read_dboard_eeprom(i2c_addr); - - // FIXME removing this printf has the system hang if there are two d'boards - // installed. (I think the problem is in i2c_read/write or the way - // I kludge the zero-byte write to set the read address in eeprom_read.) - printf("%s dbid: 0x%x\n", msg, dbid); - - if (dbid < 0){ // there was some kind of problem. Treat as Basic Tx - return default_db; - } - else if ((db = lookup_dbid(dbid)) == 0){ - printf("No daugherboard code for dbid = 0x%x\n", dbid); - return default_db; - } - return db; -} - -void -set_atr_regs(int bank, struct db_base *db) -{ - uint32_t val[4]; - int shift; - int mask; - int i; - - val[ATR_IDLE] = db->atr_rxval; - val[ATR_RX] = db->atr_rxval; - val[ATR_TX] = db->atr_txval; - val[ATR_FULL] = db->atr_txval; - - if (bank == GPIO_TX_BANK){ - mask = 0xffff0000; - shift = 16; - } - else { - mask = 0x0000ffff; - shift = 0; - } - - for (i = 0; i < 4; i++){ - int t = (atr_regs->v[i] & ~mask) | ((val[i] << shift) & mask); - //printf("atr_regs[%d] = 0x%x\n", i, t); - atr_regs->v[i] = t; - } -} - -static void -set_gpio_mode(int bank, struct db_base *db) -{ - int i; - - hal_gpio_set_ddr(bank, db->output_enables, 0xffff); - set_atr_regs(bank, db); - - for (i = 0; i < 16; i++){ - if (db->used_pins & (1 << i)){ - // set to either GPIO_SEL_SW or GPIO_SEL_ATR - hal_gpio_set_sel(bank, i, (db->atr_mask & (1 << i)) ? 'a' : 's'); - } - } -} - -static int __attribute__((unused)) -determine_tx_mux_value(struct db_base *db) -{ - if (db->i_and_q_swapped) - return 0x01; - else - return 0x10; -} - -static int -determine_rx_mux_value(struct db_base *db) -{ -#define ADC0 0x0 -#define ADC1 0x1 -#define ZERO 0x2 - - static int truth_table[8] = { - /* swap_iq, uses */ - /* 0, 0x0 */ (ZERO << 2) | ZERO, // N/A - /* 0, 0x1 */ (ZERO << 2) | ADC0, - /* 0, 0x2 */ (ZERO << 2) | ADC1, - /* 0, 0x3 */ (ADC1 << 2) | ADC0, - /* 1, 0x0 */ (ZERO << 2) | ZERO, // N/A - /* 1, 0x1 */ (ZERO << 2) | ADC0, - /* 1, 0x2 */ (ZERO << 2) | ADC1, - /* 1, 0x3 */ (ADC0 << 2) | ADC1, - }; - - int subdev0_uses; - int subdev1_uses; - int uses; - - if (db->is_quadrature) - subdev0_uses = 0x3; // uses A/D 0 and 1 - else - subdev0_uses = 0x1; // uses A/D 0 only - - // FIXME second subdev on Basic Rx, LF RX - // if subdev2 exists - // subdev1_uses = 0x2; - subdev1_uses = 0; - - uses = subdev0_uses; - - int swap_iq = db->i_and_q_swapped & 0x1; - int index = (swap_iq << 2) | uses; - - return truth_table[index]; -} - - -void -db_init(void) -{ - int m; - - tx_dboard = lookup_dboard(I2C_ADDR_TX_A, &db_basic_tx, "Tx"); - //printf("db_init: tx dbid = 0x%x\n", tx_dboard->dbid); - set_gpio_mode(GPIO_TX_BANK, tx_dboard); - tx_dboard->init(tx_dboard); - m = determine_tx_mux_value(tx_dboard); - dsp_tx_regs->tx_mux = m; - //printf("tx_mux = 0x%x\n", m); - tx_dboard->current_lo_offset = tx_dboard->default_lo_offset; - - rx_dboard = lookup_dboard(I2C_ADDR_RX_A, &db_basic_rx, "Rx"); - //printf("db_init: rx dbid = 0x%x\n", rx_dboard->dbid); - set_gpio_mode(GPIO_RX_BANK, rx_dboard); - rx_dboard->init(rx_dboard); - m = determine_rx_mux_value(rx_dboard); - dsp_rx_regs->rx_mux = m; - //printf("rx_mux = 0x%x\n", m); - rx_dboard->current_lo_offset = rx_dboard->default_lo_offset; -} - -/*! - * Calculate the frequency to use for setting the digital down converter. - * - * \param[in] target_freq desired RF frequency (Hz) - * \param[in] baseband_freq the RF frequency that corresponds to DC in the IF. - * - * \param[out] dxc_freq is the value for the ddc - * \param[out] inverted is true if we're operating in an inverted Nyquist zone. -*/ -void -calc_dxc_freq(u2_fxpt_freq_t target_freq, u2_fxpt_freq_t baseband_freq, - u2_fxpt_freq_t *dxc_freq, bool *inverted) -{ - u2_fxpt_freq_t fs = U2_DOUBLE_TO_FXPT_FREQ(100e6); // converter sample rate - u2_fxpt_freq_t delta = target_freq - baseband_freq; - -#if 0 - printf("calc_dxc_freq\n"); - printf(" fs = "); print_fxpt_freq(fs); newline(); - printf(" target = "); print_fxpt_freq(target_freq); newline(); - printf(" baseband = "); print_fxpt_freq(baseband_freq); newline(); - printf(" delta = "); print_fxpt_freq(delta); newline(); -#endif - - if (delta >= 0){ - while (delta > fs) - delta -= fs; - if (delta <= fs/2){ // non-inverted region - *dxc_freq = -delta; - *inverted = false; - } - else { // inverted region - *dxc_freq = delta - fs; - *inverted = true; - } - } - else { - while (delta < -fs) - delta += fs; - if (delta >= -fs/2){ // non-inverted region - *dxc_freq = -delta; - *inverted = false; - } - else { // inverted region - *dxc_freq = delta + fs; - *inverted = true; - } - } -} - -bool -db_set_lo_offset(struct db_base *db, u2_fxpt_freq_t offset) -{ - db->current_lo_offset = offset; - return true; -} - -bool -db_tune(struct db_base *db, u2_fxpt_freq_t target_freq, struct tune_result *result) -{ - memset(result, 0, sizeof(*result)); - bool inverted = false; - u2_fxpt_freq_t dxc_freq; - u2_fxpt_freq_t actual_dxc_freq; - - // Ask the d'board to tune as closely as it can to target_freq+lo_offset - bool ok = db->set_freq(db, target_freq+db->current_lo_offset, &result->baseband_freq); - - // Calculate the DDC setting that will downconvert the baseband from the - // daughterboard to our target frequency. - calc_dxc_freq(target_freq, result->baseband_freq, &dxc_freq, &inverted); - - // If the spectrum is inverted, and the daughterboard doesn't do - // quadrature downconversion, we can fix the inversion by flipping the - // sign of the dxc_freq... (This only happens using the basic_rx board) - - if (db->spectrum_inverted) - inverted = !inverted; - - if (inverted && !db->is_quadrature){ - dxc_freq = -dxc_freq; - inverted = !inverted; - } - - if (db->is_tx){ - dxc_freq = -dxc_freq; // down conversion versus up conversion - ok &= db_set_duc_freq(dxc_freq, &actual_dxc_freq); - } - else { - ok &= db_set_ddc_freq(dxc_freq, &actual_dxc_freq); - } - - result->dxc_freq = dxc_freq; - result->residual_freq = dxc_freq - actual_dxc_freq; - result->inverted = inverted; - return ok; -} - -static int32_t -compute_freq_control_word(u2_fxpt_freq_t target_freq, u2_fxpt_freq_t *actual_freq) -{ - // If we were using floating point, we'd calculate - // master = 100e6; - // v = (int) rint(target_freq / master_freq) * pow(2.0, 32.0); - - //printf("compute_freq_control_word\n"); - //printf(" target_freq = "); print_fxpt_freq(target_freq); newline(); - - int32_t master_freq = 100000000; // 100M - - int32_t v = ((target_freq << 12)) / master_freq; - //printf(" fcw = %d\n", v); - - *actual_freq = (v * (int64_t) master_freq) >> 12; - - //printf(" actual = "); print_fxpt_freq(*actual_freq); newline(); - - return v; -} - - -bool -db_set_ddc_freq(u2_fxpt_freq_t dxc_freq, u2_fxpt_freq_t *actual_dxc_freq) -{ - int32_t v = compute_freq_control_word(dxc_freq, actual_dxc_freq); - dsp_rx_regs->freq = v; - return true; -} - -bool -db_set_duc_freq(u2_fxpt_freq_t dxc_freq, u2_fxpt_freq_t *actual_dxc_freq) -{ - int32_t v = compute_freq_control_word(dxc_freq, actual_dxc_freq); - dsp_tx_regs->freq = v; - return true; -} - -bool -db_set_gain(struct db_base *db, u2_fxpt_gain_t gain) -{ - return db->set_gain(db, gain); -} - -bool -db_set_antenna(struct db_base *db, int ant) -{ - if (db->set_antenna == 0) return false; - return db->set_antenna(db, ant); -} diff --git a/usrp2/firmware/lib/db_init_wbx.c b/usrp2/firmware/lib/db_init_wbx.c deleted file mode 100644 index 8810e0d4d..000000000 --- a/usrp2/firmware/lib/db_init_wbx.c +++ /dev/null @@ -1,404 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2009 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - - -#include <memory_map.h> -#include <i2c.h> -#include <usrp2_i2c_addr.h> -#include <string.h> -#include <stdio.h> -#include <db.h> -#include <db_base.h> -#include <hal_io.h> -#include <nonstdio.h> - - -struct db_base *tx_dboard; // the tx daughterboard that's installed -struct db_base *rx_dboard; // the rx daughterboard that's installed - -extern struct db_base db_basic_tx; -extern struct db_base db_basic_rx; -extern struct db_base db_lf_tx; -extern struct db_base db_lf_rx; -extern struct db_base db_wbxng_rx; -extern struct db_base db_wbxng_tx; - -struct db_base *all_dboards[] = { - &db_basic_tx, - &db_basic_rx, - &db_lf_tx, - &db_lf_rx, - &db_wbxng_rx, - &db_wbxng_tx, - 0 -}; - - -typedef enum { UDBE_OK, UDBE_NO_EEPROM, UDBE_INVALID_EEPROM } usrp_dbeeprom_status_t; - -static usrp_dbeeprom_status_t -read_raw_dboard_eeprom (unsigned char *buf, int i2c_addr) -{ - if (!eeprom_read (i2c_addr, 0, buf, DB_EEPROM_CLEN)) - return UDBE_NO_EEPROM; - - if (buf[DB_EEPROM_MAGIC] != DB_EEPROM_MAGIC_VALUE) - return UDBE_INVALID_EEPROM; - - int sum = 0; - unsigned int i; - for (i = 0; i < DB_EEPROM_CLEN; i++) - sum += buf[i]; - - if ((sum & 0xff) != 0) - return UDBE_INVALID_EEPROM; - - return UDBE_OK; -} - - -/* - * Return DBID, -1 <none> or -2 <invalid eeprom contents> - */ -int -read_dboard_eeprom(int i2c_addr) -{ - unsigned char buf[DB_EEPROM_CLEN]; - - usrp_dbeeprom_status_t s = read_raw_dboard_eeprom (buf, i2c_addr); - - //printf("\nread_raw_dboard_eeprom: %d\n", s); - - switch (s){ - case UDBE_OK: - return (buf[DB_EEPROM_ID_MSB] << 8) | buf[DB_EEPROM_ID_LSB]; - - case UDBE_NO_EEPROM: - default: - return -1; - - case UDBE_INVALID_EEPROM: - return -2; - } -} - - -static struct db_base * -lookup_dbid(int dbid) -{ - if (dbid < 0) - return 0; - - int i; - for (i = 0; all_dboards[i]; i++) - if (all_dboards[i]->dbid == dbid) - return all_dboards[i]; - - return 0; -} - -static struct db_base * -lookup_dboard(int i2c_addr, struct db_base *default_db, char *msg) -{ - struct db_base *db; - int dbid = read_dboard_eeprom(i2c_addr); - - // FIXME removing this printf has the system hang if there are two d'boards - // installed. (I think the problem is in i2c_read/write or the way - // I kludge the zero-byte write to set the read address in eeprom_read.) - printf("%s dbid: 0x%x\n", msg, dbid); - - if (dbid < 0){ // there was some kind of problem. Treat as Basic Tx - return default_db; - } - else if ((db = lookup_dbid(dbid)) == 0){ - printf("No daugherboard code for dbid = 0x%x\n", dbid); - return default_db; - } - return db; -} - -void -set_atr_regs(int bank, struct db_base *db) -{ - uint32_t val[4]; - int shift; - int mask; - int i; - - val[ATR_IDLE] = db->atr_rxval; - val[ATR_RX] = db->atr_rxval; - val[ATR_TX] = db->atr_txval; - val[ATR_FULL] = db->atr_txval; - - if (bank == GPIO_TX_BANK){ - mask = 0xffff0000; - shift = 16; - } - else { - mask = 0x0000ffff; - shift = 0; - } - - for (i = 0; i < 4; i++){ - int t = (atr_regs->v[i] & ~mask) | ((val[i] << shift) & mask); - //printf("atr_regs[%d] = 0x%x\n", i, t); - atr_regs->v[i] = t; - } -} - -static void -set_gpio_mode(int bank, struct db_base *db) -{ - int i; - - hal_gpio_set_ddr(bank, db->output_enables, 0xffff); - set_atr_regs(bank, db); - - for (i = 0; i < 16; i++){ - if (db->used_pins & (1 << i)){ - // set to either GPIO_SEL_SW or GPIO_SEL_ATR - hal_gpio_set_sel(bank, i, (db->atr_mask & (1 << i)) ? 'a' : 's'); - } - } -} - -static int __attribute__((unused)) -determine_tx_mux_value(struct db_base *db) -{ - if (db->i_and_q_swapped) - return 0x01; - else - return 0x10; -} - -static int -determine_rx_mux_value(struct db_base *db) -{ -#define ADC0 0x0 -#define ADC1 0x1 -#define ZERO 0x2 - - static int truth_table[8] = { - /* swap_iq, uses */ - /* 0, 0x0 */ (ZERO << 2) | ZERO, // N/A - /* 0, 0x1 */ (ZERO << 2) | ADC0, - /* 0, 0x2 */ (ZERO << 2) | ADC1, - /* 0, 0x3 */ (ADC1 << 2) | ADC0, - /* 1, 0x0 */ (ZERO << 2) | ZERO, // N/A - /* 1, 0x1 */ (ZERO << 2) | ADC0, - /* 1, 0x2 */ (ZERO << 2) | ADC1, - /* 1, 0x3 */ (ADC0 << 2) | ADC1, - }; - - int subdev0_uses; - int subdev1_uses; - int uses; - - if (db->is_quadrature) - subdev0_uses = 0x3; // uses A/D 0 and 1 - else - subdev0_uses = 0x1; // uses A/D 0 only - - // FIXME second subdev on Basic Rx, LF RX - // if subdev2 exists - // subdev1_uses = 0x2; - subdev1_uses = 0; - - uses = subdev0_uses; - - int swap_iq = db->i_and_q_swapped & 0x1; - int index = (swap_iq << 2) | uses; - - return truth_table[index]; -} - - -void -db_init(void) -{ - int m; - - tx_dboard = lookup_dboard(I2C_ADDR_TX_A, &db_basic_tx, "Tx"); - //printf("db_init: tx dbid = 0x%x\n", tx_dboard->dbid); - set_gpio_mode(GPIO_TX_BANK, tx_dboard); - tx_dboard->init(tx_dboard); - m = determine_tx_mux_value(tx_dboard); - dsp_tx_regs->tx_mux = m; - //printf("tx_mux = 0x%x\n", m); - tx_dboard->current_lo_offset = tx_dboard->default_lo_offset; - - rx_dboard = lookup_dboard(I2C_ADDR_RX_A, &db_basic_rx, "Rx"); - //printf("db_init: rx dbid = 0x%x\n", rx_dboard->dbid); - set_gpio_mode(GPIO_RX_BANK, rx_dboard); - rx_dboard->init(rx_dboard); - m = determine_rx_mux_value(rx_dboard); - dsp_rx_regs->rx_mux = m; - //printf("rx_mux = 0x%x\n", m); - rx_dboard->current_lo_offset = rx_dboard->default_lo_offset; -} - -/*! - * Calculate the frequency to use for setting the digital down converter. - * - * \param[in] target_freq desired RF frequency (Hz) - * \param[in] baseband_freq the RF frequency that corresponds to DC in the IF. - * - * \param[out] dxc_freq is the value for the ddc - * \param[out] inverted is true if we're operating in an inverted Nyquist zone. -*/ -void -calc_dxc_freq(u2_fxpt_freq_t target_freq, u2_fxpt_freq_t baseband_freq, - u2_fxpt_freq_t *dxc_freq, bool *inverted) -{ - u2_fxpt_freq_t fs = U2_DOUBLE_TO_FXPT_FREQ(100e6); // converter sample rate - u2_fxpt_freq_t delta = target_freq - baseband_freq; - -#if 0 - printf("calc_dxc_freq\n"); - printf(" fs = "); print_fxpt_freq(fs); newline(); - printf(" target = "); print_fxpt_freq(target_freq); newline(); - printf(" baseband = "); print_fxpt_freq(baseband_freq); newline(); - printf(" delta = "); print_fxpt_freq(delta); newline(); -#endif - - if (delta >= 0){ - while (delta > fs) - delta -= fs; - if (delta <= fs/2){ // non-inverted region - *dxc_freq = -delta; - *inverted = false; - } - else { // inverted region - *dxc_freq = delta - fs; - *inverted = true; - } - } - else { - while (delta < -fs) - delta += fs; - if (delta >= -fs/2){ // non-inverted region - *dxc_freq = -delta; - *inverted = false; - } - else { // inverted region - *dxc_freq = delta + fs; - *inverted = true; - } - } -} - -bool -db_set_lo_offset(struct db_base *db, u2_fxpt_freq_t offset) -{ - db->current_lo_offset = offset; - return true; -} - -bool -db_tune(struct db_base *db, u2_fxpt_freq_t target_freq, struct tune_result *result) -{ - memset(result, 0, sizeof(*result)); - bool inverted = false; - u2_fxpt_freq_t dxc_freq; - u2_fxpt_freq_t actual_dxc_freq; - - // Ask the d'board to tune as closely as it can to target_freq+lo_offset - bool ok = db->set_freq(db, target_freq+db->current_lo_offset, &result->baseband_freq); - - // Calculate the DDC setting that will downconvert the baseband from the - // daughterboard to our target frequency. - calc_dxc_freq(target_freq, result->baseband_freq, &dxc_freq, &inverted); - - // If the spectrum is inverted, and the daughterboard doesn't do - // quadrature downconversion, we can fix the inversion by flipping the - // sign of the dxc_freq... (This only happens using the basic_rx board) - - if (db->spectrum_inverted) - inverted = !inverted; - - if (inverted && !db->is_quadrature){ - dxc_freq = -dxc_freq; - inverted = !inverted; - } - - if (db->is_tx){ - dxc_freq = -dxc_freq; // down conversion versus up conversion - ok &= db_set_duc_freq(dxc_freq, &actual_dxc_freq); - } - else { - ok &= db_set_ddc_freq(dxc_freq, &actual_dxc_freq); - } - - result->dxc_freq = dxc_freq; - result->residual_freq = dxc_freq - actual_dxc_freq; - result->inverted = inverted; - return ok; -} - -static int32_t -compute_freq_control_word(u2_fxpt_freq_t target_freq, u2_fxpt_freq_t *actual_freq) -{ - // If we were using floating point, we'd calculate - // master = 100e6; - // v = (int) rint(target_freq / master_freq) * pow(2.0, 32.0); - - //printf("compute_freq_control_word\n"); - //printf(" target_freq = "); print_fxpt_freq(target_freq); newline(); - - int32_t master_freq = 100000000; // 100M - - int32_t v = ((target_freq << 12)) / master_freq; - //printf(" fcw = %d\n", v); - - *actual_freq = (v * (int64_t) master_freq) >> 12; - - //printf(" actual = "); print_fxpt_freq(*actual_freq); newline(); - - return v; -} - - -bool -db_set_ddc_freq(u2_fxpt_freq_t dxc_freq, u2_fxpt_freq_t *actual_dxc_freq) -{ - int32_t v = compute_freq_control_word(dxc_freq, actual_dxc_freq); - dsp_rx_regs->freq = v; - return true; -} - -bool -db_set_duc_freq(u2_fxpt_freq_t dxc_freq, u2_fxpt_freq_t *actual_dxc_freq) -{ - int32_t v = compute_freq_control_word(dxc_freq, actual_dxc_freq); - dsp_tx_regs->freq = v; - return true; -} - -bool -db_set_gain(struct db_base *db, u2_fxpt_gain_t gain) -{ - return db->set_gain(db, gain); -} - -bool -db_set_antenna(struct db_base *db, int ant) -{ - if (db->set_antenna == 0) return false; - return db->set_antenna(db, ant); -} diff --git a/usrp2/firmware/lib/db_init_xcvr.c b/usrp2/firmware/lib/db_init_xcvr.c deleted file mode 100644 index 3e3d3eb86..000000000 --- a/usrp2/firmware/lib/db_init_xcvr.c +++ /dev/null @@ -1,404 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2009 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - - -#include <memory_map.h> -#include <i2c.h> -#include <usrp2_i2c_addr.h> -#include <string.h> -#include <stdio.h> -#include <db.h> -#include <db_base.h> -#include <hal_io.h> -#include <nonstdio.h> - - -struct db_base *tx_dboard; // the tx daughterboard that's installed -struct db_base *rx_dboard; // the rx daughterboard that's installed - -extern struct db_base db_basic_tx; -extern struct db_base db_basic_rx; -extern struct db_base db_lf_tx; -extern struct db_base db_lf_rx; -extern struct db_base db_xcvr2450_tx; -extern struct db_base db_xcvr2450_rx; - -struct db_base *all_dboards[] = { - &db_basic_tx, - &db_basic_rx, - &db_lf_tx, - &db_lf_rx, - &db_xcvr2450_rx, - &db_xcvr2450_tx, - 0 -}; - - -typedef enum { UDBE_OK, UDBE_NO_EEPROM, UDBE_INVALID_EEPROM } usrp_dbeeprom_status_t; - -static usrp_dbeeprom_status_t -read_raw_dboard_eeprom (unsigned char *buf, int i2c_addr) -{ - if (!eeprom_read (i2c_addr, 0, buf, DB_EEPROM_CLEN)) - return UDBE_NO_EEPROM; - - if (buf[DB_EEPROM_MAGIC] != DB_EEPROM_MAGIC_VALUE) - return UDBE_INVALID_EEPROM; - - int sum = 0; - unsigned int i; - for (i = 0; i < DB_EEPROM_CLEN; i++) - sum += buf[i]; - - if ((sum & 0xff) != 0) - return UDBE_INVALID_EEPROM; - - return UDBE_OK; -} - - -/* - * Return DBID, -1 <none> or -2 <invalid eeprom contents> - */ -int -read_dboard_eeprom(int i2c_addr) -{ - unsigned char buf[DB_EEPROM_CLEN]; - - usrp_dbeeprom_status_t s = read_raw_dboard_eeprom (buf, i2c_addr); - - //printf("\nread_raw_dboard_eeprom: %d\n", s); - - switch (s){ - case UDBE_OK: - return (buf[DB_EEPROM_ID_MSB] << 8) | buf[DB_EEPROM_ID_LSB]; - - case UDBE_NO_EEPROM: - default: - return -1; - - case UDBE_INVALID_EEPROM: - return -2; - } -} - - -static struct db_base * -lookup_dbid(int dbid) -{ - if (dbid < 0) - return 0; - - int i; - for (i = 0; all_dboards[i]; i++) - if (all_dboards[i]->dbid == dbid) - return all_dboards[i]; - - return 0; -} - -static struct db_base * -lookup_dboard(int i2c_addr, struct db_base *default_db, char *msg) -{ - struct db_base *db; - int dbid = read_dboard_eeprom(i2c_addr); - - // FIXME removing this printf has the system hang if there are two d'boards - // installed. (I think the problem is in i2c_read/write or the way - // I kludge the zero-byte write to set the read address in eeprom_read.) - printf("%s dbid: 0x%x\n", msg, dbid); - - if (dbid < 0){ // there was some kind of problem. Treat as Basic Tx - return default_db; - } - else if ((db = lookup_dbid(dbid)) == 0){ - printf("No daugherboard code for dbid = 0x%x\n", dbid); - return default_db; - } - return db; -} - -void -set_atr_regs(int bank, struct db_base *db) -{ - uint32_t val[4]; - int shift; - int mask; - int i; - - val[ATR_IDLE] = db->atr_rxval; - val[ATR_RX] = db->atr_rxval; - val[ATR_TX] = db->atr_txval; - val[ATR_FULL] = db->atr_txval; - - if (bank == GPIO_TX_BANK){ - mask = 0xffff0000; - shift = 16; - } - else { - mask = 0x0000ffff; - shift = 0; - } - - for (i = 0; i < 4; i++){ - int t = (atr_regs->v[i] & ~mask) | ((val[i] << shift) & mask); - //printf("atr_regs[%d] = 0x%x\n", i, t); - atr_regs->v[i] = t; - } -} - -static void -set_gpio_mode(int bank, struct db_base *db) -{ - int i; - - hal_gpio_set_ddr(bank, db->output_enables, 0xffff); - set_atr_regs(bank, db); - - for (i = 0; i < 16; i++){ - if (db->used_pins & (1 << i)){ - // set to either GPIO_SEL_SW or GPIO_SEL_ATR - hal_gpio_set_sel(bank, i, (db->atr_mask & (1 << i)) ? 'a' : 's'); - } - } -} - -static int __attribute__((unused)) -determine_tx_mux_value(struct db_base *db) -{ - if (db->i_and_q_swapped) - return 0x01; - else - return 0x10; -} - -static int -determine_rx_mux_value(struct db_base *db) -{ -#define ADC0 0x0 -#define ADC1 0x1 -#define ZERO 0x2 - - static int truth_table[8] = { - /* swap_iq, uses */ - /* 0, 0x0 */ (ZERO << 2) | ZERO, // N/A - /* 0, 0x1 */ (ZERO << 2) | ADC0, - /* 0, 0x2 */ (ZERO << 2) | ADC1, - /* 0, 0x3 */ (ADC1 << 2) | ADC0, - /* 1, 0x0 */ (ZERO << 2) | ZERO, // N/A - /* 1, 0x1 */ (ZERO << 2) | ADC0, - /* 1, 0x2 */ (ZERO << 2) | ADC1, - /* 1, 0x3 */ (ADC0 << 2) | ADC1, - }; - - int subdev0_uses; - int subdev1_uses; - int uses; - - if (db->is_quadrature) - subdev0_uses = 0x3; // uses A/D 0 and 1 - else - subdev0_uses = 0x1; // uses A/D 0 only - - // FIXME second subdev on Basic Rx, LF RX - // if subdev2 exists - // subdev1_uses = 0x2; - subdev1_uses = 0; - - uses = subdev0_uses; - - int swap_iq = db->i_and_q_swapped & 0x1; - int index = (swap_iq << 2) | uses; - - return truth_table[index]; -} - - -void -db_init(void) -{ - int m; - - tx_dboard = lookup_dboard(I2C_ADDR_TX_A, &db_basic_tx, "Tx"); - //printf("db_init: tx dbid = 0x%x\n", tx_dboard->dbid); - set_gpio_mode(GPIO_TX_BANK, tx_dboard); - tx_dboard->init(tx_dboard); - m = determine_tx_mux_value(tx_dboard); - dsp_tx_regs->tx_mux = m; - //printf("tx_mux = 0x%x\n", m); - tx_dboard->current_lo_offset = tx_dboard->default_lo_offset; - - rx_dboard = lookup_dboard(I2C_ADDR_RX_A, &db_basic_rx, "Rx"); - //printf("db_init: rx dbid = 0x%x\n", rx_dboard->dbid); - set_gpio_mode(GPIO_RX_BANK, rx_dboard); - rx_dboard->init(rx_dboard); - m = determine_rx_mux_value(rx_dboard); - dsp_rx_regs->rx_mux = m; - //printf("rx_mux = 0x%x\n", m); - rx_dboard->current_lo_offset = rx_dboard->default_lo_offset; -} - -/*! - * Calculate the frequency to use for setting the digital down converter. - * - * \param[in] target_freq desired RF frequency (Hz) - * \param[in] baseband_freq the RF frequency that corresponds to DC in the IF. - * - * \param[out] dxc_freq is the value for the ddc - * \param[out] inverted is true if we're operating in an inverted Nyquist zone. -*/ -void -calc_dxc_freq(u2_fxpt_freq_t target_freq, u2_fxpt_freq_t baseband_freq, - u2_fxpt_freq_t *dxc_freq, bool *inverted) -{ - u2_fxpt_freq_t fs = U2_DOUBLE_TO_FXPT_FREQ(100e6); // converter sample rate - u2_fxpt_freq_t delta = target_freq - baseband_freq; - -#if 0 - printf("calc_dxc_freq\n"); - printf(" fs = "); print_fxpt_freq(fs); newline(); - printf(" target = "); print_fxpt_freq(target_freq); newline(); - printf(" baseband = "); print_fxpt_freq(baseband_freq); newline(); - printf(" delta = "); print_fxpt_freq(delta); newline(); -#endif - - if (delta >= 0){ - while (delta > fs) - delta -= fs; - if (delta <= fs/2){ // non-inverted region - *dxc_freq = -delta; - *inverted = false; - } - else { // inverted region - *dxc_freq = delta - fs; - *inverted = true; - } - } - else { - while (delta < -fs) - delta += fs; - if (delta >= -fs/2){ // non-inverted region - *dxc_freq = -delta; - *inverted = false; - } - else { // inverted region - *dxc_freq = delta + fs; - *inverted = true; - } - } -} - -bool -db_set_lo_offset(struct db_base *db, u2_fxpt_freq_t offset) -{ - db->current_lo_offset = offset; - return true; -} - -bool -db_tune(struct db_base *db, u2_fxpt_freq_t target_freq, struct tune_result *result) -{ - memset(result, 0, sizeof(*result)); - bool inverted = false; - u2_fxpt_freq_t dxc_freq; - u2_fxpt_freq_t actual_dxc_freq; - - // Ask the d'board to tune as closely as it can to target_freq+lo_offset - bool ok = db->set_freq(db, target_freq+db->current_lo_offset, &result->baseband_freq); - - // Calculate the DDC setting that will downconvert the baseband from the - // daughterboard to our target frequency. - calc_dxc_freq(target_freq, result->baseband_freq, &dxc_freq, &inverted); - - // If the spectrum is inverted, and the daughterboard doesn't do - // quadrature downconversion, we can fix the inversion by flipping the - // sign of the dxc_freq... (This only happens using the basic_rx board) - - if (db->spectrum_inverted) - inverted = !inverted; - - if (inverted && !db->is_quadrature){ - dxc_freq = -dxc_freq; - inverted = !inverted; - } - - if (db->is_tx){ - dxc_freq = -dxc_freq; // down conversion versus up conversion - ok &= db_set_duc_freq(dxc_freq, &actual_dxc_freq); - } - else { - ok &= db_set_ddc_freq(dxc_freq, &actual_dxc_freq); - } - - result->dxc_freq = dxc_freq; - result->residual_freq = dxc_freq - actual_dxc_freq; - result->inverted = inverted; - return ok; -} - -static int32_t -compute_freq_control_word(u2_fxpt_freq_t target_freq, u2_fxpt_freq_t *actual_freq) -{ - // If we were using floating point, we'd calculate - // master = 100e6; - // v = (int) rint(target_freq / master_freq) * pow(2.0, 32.0); - - //printf("compute_freq_control_word\n"); - //printf(" target_freq = "); print_fxpt_freq(target_freq); newline(); - - int32_t master_freq = 100000000; // 100M - - int32_t v = ((target_freq << 12)) / master_freq; - //printf(" fcw = %d\n", v); - - *actual_freq = (v * (int64_t) master_freq) >> 12; - - //printf(" actual = "); print_fxpt_freq(*actual_freq); newline(); - - return v; -} - - -bool -db_set_ddc_freq(u2_fxpt_freq_t dxc_freq, u2_fxpt_freq_t *actual_dxc_freq) -{ - int32_t v = compute_freq_control_word(dxc_freq, actual_dxc_freq); - dsp_rx_regs->freq = v; - return true; -} - -bool -db_set_duc_freq(u2_fxpt_freq_t dxc_freq, u2_fxpt_freq_t *actual_dxc_freq) -{ - int32_t v = compute_freq_control_word(dxc_freq, actual_dxc_freq); - dsp_tx_regs->freq = v; - return true; -} - -bool -db_set_gain(struct db_base *db, u2_fxpt_gain_t gain) -{ - return db->set_gain(db, gain); -} - -bool -db_set_antenna(struct db_base *db, int ant) -{ - if (db->set_antenna == 0) return false; - return db->set_antenna(db, ant); -} diff --git a/usrp2/firmware/lib/db_rfx.c b/usrp2/firmware/lib/db_rfx.c deleted file mode 100644 index d07d3c1fb..000000000 --- a/usrp2/firmware/lib/db_rfx.c +++ /dev/null @@ -1,674 +0,0 @@ -/* - * Copyright 2008,2009 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#include <spi.h> -#include <memory_map.h> -#include <db_base.h> -#include <hal_io.h> -#include <stdio.h> -#include <mdelay.h> -#include <lsdac.h> -#include <clocks.h> - - -bool rfx_init_rx(struct db_base *db); -bool rfx_init_tx(struct db_base *db); -bool rfx_set_freq(struct db_base *db, u2_fxpt_freq_t freq, u2_fxpt_freq_t *dc); -bool rfx_set_gain_rx(struct db_base *db, u2_fxpt_gain_t gain); -bool rfx_set_gain_tx(struct db_base *db, u2_fxpt_gain_t gain); -bool rfx_set_tx_enable(struct db_base *, bool on); - -// Control Latch Defines -#define P 0 // Prescalar value for setting in regs, must match the next line... -#define PRESCALER 8 // Presacalar value for computations -#define PD 0 // Power down, 0 = normal operation -#define PL 0 // PLL power output -#define MTLD 1 // Mute till lock detect -#define CPGAIN 0 // Charge pump gain, use setting 1, also in N-reg -#define CP3S 0 // Charge pump tri-state, 0 = normal operation -#define PDP 1 // Phase detector polarity -#define MUXOUT 1 // Digital lock detect, active high -#define CR 0 // normal operation -#define PC 1 // core power - -// N Latch Defines -#define DIVSEL 0 // N Counter always operates on full rate -#define N_RSV 0 - -// R Latch Defines -#define R_RSV 0 -#define R_BSC 3 -#define R_TMB 0 -#define R_LDP 1 -#define R_ABP 0 -#define R_DIV 16 - -#define phdet_freq (U2_DOUBLE_TO_FXPT_FREQ(100e6/R_DIV)) - -// IO Pin functions -#define POWER_UP (1 << 7) // Low enables power supply -#define ANT_SW (1 << 6) // On TX DB, 0 = TX, 1 = RX, on RX DB 0 = main ant, 1 = RX2 -#define MIX_EN (1 << 5) // Enable appropriate mixer -#define LOCKDET_MASK (1 << 2) // Input pin - -struct db_rfx_common { - // RFX common stuff - unsigned char DIV2; - unsigned char CP1; - unsigned char CP2; - int freq_mult; - int spi_mask; -}; - -struct db_rfx_dummy { - struct db_base base; - struct db_rfx_common common; -}; - - -struct db_rfx_400_rx { - struct db_base base; - struct db_rfx_common common; -}; - -struct db_rfx_400_tx { - struct db_base base; - struct db_rfx_common common; -}; - -struct db_rfx_900_rx { - struct db_base base; - struct db_rfx_common common; -}; - -struct db_rfx_900_tx { - struct db_base base; - struct db_rfx_common common; -}; - -struct db_rfx_1200_rx { - struct db_base base; - struct db_rfx_common common; -}; - -struct db_rfx_1200_tx { - struct db_base base; - struct db_rfx_common common; -}; - -struct db_rfx_1800_rx { - struct db_base base; - struct db_rfx_common common; -}; - -struct db_rfx_1800_tx { - struct db_base base; - struct db_rfx_common common; -}; - -struct db_rfx_2200_rx { - struct db_base base; - struct db_rfx_common common; -}; - -struct db_rfx_2200_tx { - struct db_base base; - struct db_rfx_common common; -}; - -struct db_rfx_2400_rx { - struct db_base base; - struct db_rfx_common common; -}; - -struct db_rfx_2400_tx { - struct db_base base; - struct db_rfx_common common; -}; - - -/* - * The class instances - */ -struct db_rfx_400_rx db_rfx_400_rx = { - .base.dbid = 0x0024, - .base.is_tx = false, - .base.output_enables = 0x00E0, - .base.used_pins = 0x00FF, - .base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(400e6), - .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(500e6), - .base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(0), - .base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(45), - .base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(0.022), - .base.is_quadrature = true, - .base.i_and_q_swapped = true, - .base.spectrum_inverted = false, - .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0), - .base.init = rfx_init_rx, - .base.set_freq = rfx_set_freq, - .base.set_gain = rfx_set_gain_rx, - .base.set_tx_enable = 0, - .base.atr_mask = 0x00E0, - .base.atr_txval = POWER_UP, - .base.atr_rxval = POWER_UP|MIX_EN, - // .base.atr_tx_delay = - // .base.atr_rx_delay = - .base.set_antenna = 0, - .common.DIV2 = 0, - .common.CP1 = 7, - .common.CP2 = 7, - .common.spi_mask = SPI_SS_RX_DB, - .common.freq_mult = 2 -}; - - -struct db_rfx_400_tx db_rfx_400_tx = { - .base.dbid = 0x0028, - .base.is_tx = true, - .base.output_enables = 0x00E0, - .base.used_pins = 0x00FF, - .base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(400e6), - .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(500e6), - //.base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(xxx), - //.base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(xxx), - //.base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(xxx), - .base.is_quadrature = true, - .base.i_and_q_swapped = false, - .base.spectrum_inverted = false, - .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(12.5e6), - .base.init = rfx_init_tx, - .base.set_freq = rfx_set_freq, - .base.set_gain = rfx_set_gain_tx, - .base.set_tx_enable = rfx_set_tx_enable, - .base.atr_mask = 0x00E0, - .base.atr_txval = POWER_UP|MIX_EN, - .base.atr_rxval = POWER_UP|ANT_SW, - // .base.atr_tx_delay = - // .base.atr_rx_delay = - .base.set_antenna = 0, - .common.DIV2 = 1, - .common.CP1 = 7, - .common.CP2 = 7, - .common.spi_mask = SPI_SS_TX_DB, - .common.freq_mult = 2 -}; - -struct db_rfx_900_rx db_rfx_900_rx = { - .base.dbid = 0x0025, - .base.is_tx = false, - .base.output_enables = 0x00E0, - .base.used_pins = 0x00FF, - .base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(750e6), - .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(1050e6), - .base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(0), - .base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(70), - .base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(0.034), - .base.is_quadrature = true, - .base.i_and_q_swapped = true, - .base.spectrum_inverted = false, - .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0), - .base.init = rfx_init_rx, - .base.set_freq = rfx_set_freq, - .base.set_gain = rfx_set_gain_rx, - .base.set_tx_enable = 0, - .base.atr_mask = 0x00E0, - .base.atr_txval = 0, - .base.atr_rxval = MIX_EN, - // .base.atr_tx_delay = - // .base.atr_rx_delay = - .base.set_antenna = 0, - .common.DIV2 = 1, - .common.CP1 = 7, - .common.CP2 = 7, - .common.spi_mask = SPI_SS_RX_DB, - .common.freq_mult = 2 -}; - - -struct db_rfx_900_tx db_rfx_900_tx = { - .base.dbid = 0x0029, - .base.is_tx = true, - .base.output_enables = 0x00E0, - .base.used_pins = 0x00FF, - .base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(750e6), - .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(1050e6), - //.base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(xxx), - //.base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(xxx), - //.base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(xxx), - .base.is_quadrature = true, - .base.i_and_q_swapped = false, - .base.spectrum_inverted = false, - .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(12.5e6), - .base.init = rfx_init_tx, - .base.set_freq = rfx_set_freq, - .base.set_gain = rfx_set_gain_tx, - .base.set_tx_enable = rfx_set_tx_enable, - .base.atr_mask = 0x00E0, - .base.atr_txval = MIX_EN, - .base.atr_rxval = ANT_SW, - // .base.atr_tx_delay = - // .base.atr_rx_delay = - .base.set_antenna = 0, - .common.DIV2 = 1, - .common.CP1 = 7, - .common.CP2 = 7, - .common.spi_mask = SPI_SS_TX_DB, - .common.freq_mult = 2 -}; - -struct db_rfx_1200_rx db_rfx_1200_rx = { - .base.dbid = 0x0026, - .base.is_tx = false, - .base.output_enables = 0x00E0, - .base.used_pins = 0x00FF, - .base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(1150e6), - .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(1450e6), - .base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(0), - .base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(70), - .base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(0.034), - .base.is_quadrature = true, - .base.i_and_q_swapped = true, - .base.spectrum_inverted = false, - .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0), - .base.init = rfx_init_rx, - .base.set_freq = rfx_set_freq, - .base.set_gain = rfx_set_gain_rx, - .base.set_tx_enable = 0, - .base.atr_mask = 0x00E0, - .base.atr_txval = 0, - .base.atr_rxval = MIX_EN, - // .base.atr_tx_delay = - // .base.atr_rx_delay = - .base.set_antenna = 0, - .common.DIV2 = 1, - .common.CP1 = 7, - .common.CP2 = 7, - .common.spi_mask = SPI_SS_RX_DB, - .common.freq_mult = 2 -}; - - -struct db_rfx_1200_tx db_rfx_1200_tx = { - .base.dbid = 0x002a, - .base.is_tx = true, - .base.output_enables = 0x00E0, - .base.used_pins = 0x00FF, - .base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(1150e6), - .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(1450e6), - //.base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(xxx), - //.base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(xxx), - //.base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(xxx), - .base.is_quadrature = true, - .base.i_and_q_swapped = false, - .base.spectrum_inverted = false, - .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(12.5e6), - .base.init = rfx_init_tx, - .base.set_freq = rfx_set_freq, - .base.set_gain = rfx_set_gain_tx, - .base.set_tx_enable = rfx_set_tx_enable, - .base.atr_mask = 0x00E0, - .base.atr_txval = MIX_EN, - .base.atr_rxval = ANT_SW, - // .base.atr_tx_delay = - // .base.atr_rx_delay = - .base.set_antenna = 0, - .common.DIV2 = 1, - .common.CP1 = 7, - .common.CP2 = 7, - .common.spi_mask = SPI_SS_TX_DB, - .common.freq_mult = 2 -}; - -struct db_rfx_1800_rx db_rfx_1800_rx = { - .base.dbid = 0x0034, - .base.is_tx = false, - .base.output_enables = 0x00E0, - .base.used_pins = 0x00FF, - .base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(1500e6), - .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(2100e6), - .base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(0), - .base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(70), - .base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(0.034), - .base.is_quadrature = true, - .base.i_and_q_swapped = true, - .base.spectrum_inverted = false, - .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0), - .base.init = rfx_init_rx, - .base.set_freq = rfx_set_freq, - .base.set_gain = rfx_set_gain_rx, - .base.set_tx_enable = 0, - .base.atr_mask = 0x00E0, - .base.atr_txval = 0, - .base.atr_rxval = MIX_EN, - // .base.atr_tx_delay = - // .base.atr_rx_delay = - .base.set_antenna = 0, - .common.DIV2 = 0, - .common.CP1 = 7, - .common.CP2 = 7, - .common.spi_mask = SPI_SS_RX_DB, - .common.freq_mult = 1 -}; - - -struct db_rfx_1800_tx db_rfx_1800_tx = { - .base.dbid = 0x0035, - .base.is_tx = true, - .base.output_enables = 0x00E0, - .base.used_pins = 0x00FF, - .base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(1500e6), - .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(2100e6), - //.base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(xxx), - //.base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(xxx), - //.base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(xxx), - .base.is_quadrature = true, - .base.i_and_q_swapped = false, - .base.spectrum_inverted = false, - .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(12.5e6), - .base.init = rfx_init_tx, - .base.set_freq = rfx_set_freq, - .base.set_gain = rfx_set_gain_tx, - .base.set_tx_enable = rfx_set_tx_enable, - .base.atr_mask = 0x00E0, - .base.atr_txval = MIX_EN, - .base.atr_rxval = ANT_SW, - // .base.atr_tx_delay = - // .base.atr_rx_delay = - .base.set_antenna = 0, - .common.DIV2 = 0, - .common.CP1 = 7, - .common.CP2 = 7, - .common.spi_mask = SPI_SS_TX_DB, - .common.freq_mult = 1 -}; - - -struct db_rfx_2200_rx db_rfx_2200_rx = { - .base.dbid = 0x002c, - .base.is_tx = false, - .base.output_enables = 0x00E0, - .base.used_pins = 0x00FF, - .base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(2000e6), - .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(2400e6), - .base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(0), - .base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(70), - .base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(0.034), - .base.is_quadrature = true, - .base.i_and_q_swapped = true, - .base.spectrum_inverted = false, - .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0), - .base.init = rfx_init_rx, - .base.set_freq = rfx_set_freq, - .base.set_gain = rfx_set_gain_rx, - .base.set_tx_enable = 0, - .base.atr_mask = 0x00E0, - .base.atr_txval = 0, - .base.atr_rxval = MIX_EN, - // .base.atr_tx_delay = - // .base.atr_rx_delay = - .base.set_antenna = 0, - .common.DIV2 = 0, - .common.CP1 = 7, - .common.CP2 = 7, - .common.spi_mask = SPI_SS_RX_DB, - .common.freq_mult = 1 -}; - - -struct db_rfx_2200_tx db_rfx_2200_tx = { - .base.dbid = 0x002d, - .base.is_tx = true, - .base.output_enables = 0x00E0, - .base.used_pins = 0x00FF, - .base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(2000e6), - .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(2400e6), - //.base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(xxx), - //.base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(xxx), - //.base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(xxx), - .base.is_quadrature = true, - .base.i_and_q_swapped = false, - .base.spectrum_inverted = false, - .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(12.5e6), - .base.init = rfx_init_tx, - .base.set_freq = rfx_set_freq, - .base.set_gain = rfx_set_gain_tx, - .base.set_tx_enable = rfx_set_tx_enable, - .base.atr_mask = 0x00E0, - .base.atr_txval = MIX_EN, - .base.atr_rxval = ANT_SW, - // .base.atr_tx_delay = - // .base.atr_rx_delay = - .base.set_antenna = 0, - .common.DIV2 = 0, - .common.CP1 = 7, - .common.CP2 = 7, - .common.spi_mask = SPI_SS_TX_DB, - .common.freq_mult = 1 -}; - - -struct db_rfx_2400_rx db_rfx_2400_rx = { - .base.dbid = 0x0027, - .base.is_tx = false, - .base.output_enables = 0x00E0, - .base.used_pins = 0x00FF, - .base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(2300e6), - .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(2900e6), - .base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(0), - .base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(70), - .base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(0.034), - .base.is_quadrature = true, - .base.i_and_q_swapped = true, - .base.spectrum_inverted = false, - .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0), - .base.init = rfx_init_rx, - .base.set_freq = rfx_set_freq, - .base.set_gain = rfx_set_gain_rx, - .base.set_tx_enable = 0, - .base.atr_mask = 0x00E0, - .base.atr_txval = 0, - .base.atr_rxval = MIX_EN, - // .base.atr_tx_delay = - // .base.atr_rx_delay = - .base.set_antenna = 0, - .common.DIV2 = 0, - .common.CP1 = 7, - .common.CP2 = 7, - .common.spi_mask = SPI_SS_RX_DB, - .common.freq_mult = 1 -}; - - -struct db_rfx_2400_tx db_rfx_2400_tx = { - .base.dbid = 0x002b, - .base.is_tx = true, - .base.output_enables = 0x00E0, - .base.used_pins = 0x00FF, - .base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(2300e6), - .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(2900e6), - //.base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(xxx), - //.base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(xxx), - //.base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(xxx), - .base.is_quadrature = true, - .base.i_and_q_swapped = false, - .base.spectrum_inverted = false, - .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(12.5e6), - .base.init = rfx_init_tx, - .base.set_freq = rfx_set_freq, - .base.set_gain = rfx_set_gain_tx, - .base.set_tx_enable = rfx_set_tx_enable, - .base.atr_mask = 0x00E0, - .base.atr_txval = MIX_EN, - .base.atr_rxval = ANT_SW, - // .base.atr_tx_delay = - // .base.atr_rx_delay = - .base.set_antenna = 0, - .common.DIV2 = 0, - .common.CP1 = 7, - .common.CP2 = 7, - .common.spi_mask = SPI_SS_TX_DB, - .common.freq_mult = 1 -}; - - -bool -rfx_init_tx(struct db_base *dbb) -{ - //struct db_rfx_dummy *db = (struct db_rfx_dummy *) dbb; - clocks_enable_tx_dboard(true, 0); - - // Set the freq now to get the one time 10ms delay out of the way. - u2_fxpt_freq_t dc; - dbb->set_freq(dbb, dbb->freq_min, &dc); - return true; -} - -bool -rfx_init_rx(struct db_base *dbb) -{ - //struct db_rfx_dummy *db = (struct db_rfx_dummy *) dbb; - clocks_enable_rx_dboard(true, 0); - - // test gain - dbb->set_gain(dbb,U2_DOUBLE_TO_FXPT_GAIN(45.0)); - - // Set the freq now to get the one time 10ms delay out of the way. - u2_fxpt_freq_t dc; - dbb->set_freq(dbb, dbb->freq_min, &dc); - - return true; -} - -bool -rfx_set_freq(struct db_base *dbb, u2_fxpt_freq_t freq, u2_fxpt_freq_t *dc) -{ - static unsigned char first = true; - - *dc = 0; - struct db_rfx_dummy *db = (struct db_rfx_dummy *) dbb; - u2_fxpt_freq_t desired_n = (U2_DOUBLE_TO_FXPT_FREQ(1.0)*db->common.freq_mult*freq)/phdet_freq; - int N_DIV = u2_fxpt_freq_round_to_int(desired_n); - int B = N_DIV/PRESCALER; - int A = N_DIV - PRESCALER*B; - - if(B<A) - return false; - - int R = (R_RSV<<22)|(R_BSC<<20)|(R_TMB<<19)|(R_LDP<<18)|(R_ABP<<16)|(R_DIV<<2)|1; - int N = (DIVSEL<<23)|(db->common.DIV2<<22)|(CPGAIN<<21)|(B<<8)|(N_RSV<<7)|(A<<2)|2; - int C = (P<<22)|(PD<<20)|(db->common.CP2<<17)|(db->common.CP1<<14)|(PL<<12)| - (MTLD<<11)|(CPGAIN<<10)|(CP3S<<9)|(PDP<<8)|(MUXOUT<<5)|(CR<<4)|(PC<<2)|0; - - spi_transact(SPI_TXONLY,db->common.spi_mask,R,24,SPIF_PUSH_FALL); - spi_transact(SPI_TXONLY,db->common.spi_mask,C,24,SPIF_PUSH_FALL); - if (first){ - first = false; - mdelay(10); - } - spi_transact(SPI_TXONLY,db->common.spi_mask,N,24,SPIF_PUSH_FALL); - - //printf("A = %d, B = %d, N_DIV = %d\n",A, B, N_DIV); - *dc = (N_DIV * phdet_freq) / db->common.freq_mult; - return true; -} - -bool -rfx_set_gain_tx(struct db_base *dbb, u2_fxpt_gain_t gain) -{ - // There is no analog gain control on TX - return true; -} - -bool -rfx_set_gain_rx(struct db_base *dbb, u2_fxpt_gain_t gain) -{ - struct db_rfx_dummy *db = (struct db_rfx_dummy *) dbb; - - int offset_q8 = (int)(1.2/3.3*4096*(1<<15)); - int range_q15 = (int)(-1.0*4096/3.3*256*128); - int slope_q8 = range_q15/db->base.gain_max; - - int dacword = ((slope_q8 * gain) + offset_q8)>>15; - //printf("DACWORD %d\n",dacword); - lsdac_write_rx(1,dacword); - return true; -} - - -bool -rfx_set_tx_enable(struct db_base *dbb, bool on) -{ - struct db_rfx_dummy *db = (struct db_rfx_dummy *) dbb; - - // FIXME - - return false; -} - -bool -rfx_lock_detect(struct db_base *dbb) -{ - struct db_rfx_dummy *db = (struct db_rfx_dummy *) dbb; - int pins; - pins = hal_gpio_read( db->base.is_tx ? GPIO_TX_BANK : GPIO_RX_BANK ); - if(pins & LOCKDET_MASK) - return true; - return false; -} - -/* - def select_rx_antenna(self, which_antenna): - """ - Specify which antenna port to use for reception. - @param which_antenna: either 'TX/RX' or 'RX2' - """ - if which_antenna in (0, 'TX/RX'): - self._u.write_io(self._which, 0, RX2_RX1N) - elif which_antenna in (1, 'RX2'): - self._u.write_io(self._which, RX2_RX1N, RX2_RX1N) - else: - raise ValueError, "which_antenna must be either 'TX/RX' or 'RX2'" - - def set_gain(self, gain): - """ - Set the gain. - - @param gain: gain in decibels - @returns True/False - """ - maxgain = self.gain_range()[1] - self._u.pga_max() - mingain = self.gain_range()[0] - if gain > maxgain: - pga_gain = gain-maxgain - assert pga_gain <= self._u.pga_max() - agc_gain = maxgain - else: - pga_gain = 0 - agc_gain = gain - V_maxgain = .2 - V_mingain = 1.2 - V_fullscale = 3.3 - dac_value = (agc_gain*(V_maxgain-V_mingain)/(maxgain-mingain) + V_mingain)*4096/V_fullscale - assert dac_value>=0 and dac_value<4096 - return self._u.write_aux_dac(self._which, 0, int(dac_value)) and \ - self._set_pga(int(pga_gain)) - - def gain_range(self): - return (self._u.pga_min(), self._u.pga_max() + 70, 0.05) -- For 900-2400 - return (self._u.pga_min(), self._u.pga_max() + 45, 0.035) -- For 400 - -*/ diff --git a/usrp2/firmware/lib/db_tvrx.c b/usrp2/firmware/lib/db_tvrx.c deleted file mode 100644 index 077e59e88..000000000 --- a/usrp2/firmware/lib/db_tvrx.c +++ /dev/null @@ -1,247 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2009 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#include <i2c.h> -#include <lsdac.h> -#include <memory_map.h> -#include <db_base.h> -#include <hal_io.h> -#include <stdio.h> - -bool tvrx_init(struct db_base *db); -bool tvrx_set_freq(struct db_base *db, u2_fxpt_freq_t freq, u2_fxpt_freq_t *dc); -bool tvrx_set_gain(struct db_base *db, u2_fxpt_gain_t gain); - -#define I2C_ADDR 0x60 -#define REF_FREQ (U2_DOUBLE_TO_FXPT_FREQ(4e6)/640*8) - -#define ref_div 640 /* choices are 640, 512, 1024 */ - -#if (ref_div == 640) -#define ref_div_byte 0 -#else -#if (ref_div == 512) -#define ref_div_byte 0x6 -#else -#define ref_div_byte 0x2 -#endif -#endif - -#define fast_tuning 0x40 - -#define control_byte_1 (0x88|fast_tuning|ref_div_byte) - - -struct db_tvrx_common { - // TVRX common stuff - u2_fxpt_freq_t first_if; - u2_fxpt_freq_t second_if; -}; - -struct db_tvrx_dummy { - struct db_base base; - struct db_tvrx_common common; -}; - -struct db_tvrx1 { - struct db_base base; - struct db_tvrx_common common; -}; - -struct db_tvrx2 { - struct db_base base; - struct db_tvrx_common common; -}; - -struct db_tvrx3 { - struct db_base base; - struct db_tvrx_common common; -}; - -/* The class instances */ -struct db_tvrx1 db_tvrx1 = { - .base.dbid = 0x0003, - .base.is_tx = false, - .base.output_enables = 0x0000, - .base.used_pins = 0x0000, - .base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(50e6), - .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(860e6), - .base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(0), - .base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(95), - .base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(1), - .base.is_quadrature = false, - .base.i_and_q_swapped = false, - .base.spectrum_inverted = false, - .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0), - .base.init = tvrx_init, - .base.set_freq = tvrx_set_freq, - .base.set_gain = tvrx_set_gain, - .base.set_tx_enable = 0, - .base.atr_mask = 0x0000, - .base.atr_txval = 0, - .base.atr_rxval = 0, - // .base.atr_tx_delay = - // .base.atr_rx_delay = - .base.set_antenna = 0, - .common.first_if = U2_DOUBLE_TO_FXPT_FREQ(43.75e6), - .common.second_if = U2_DOUBLE_TO_FXPT_FREQ(5.75e6), -}; - -#if 0 -struct db_tvrx2 db_tvrx2 = { - .base.dbid = 0x000c, - .base.is_tx = false, - .base.output_enables = 0x0000, - .base.used_pins = 0x0000, - .base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(50e6), - .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(860e6), - .base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(0), - .base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(95), - .base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(1), - .base.is_quadrature = false, - .base.i_and_q_swapped = false, - .base.spectrum_inverted = false, - .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0), - .base.init = tvrx_init, - .base.set_freq = tvrx_set_freq, - .base.set_gain = tvrx_set_gain, - .base.set_tx_enable = 0, - .base.atr_mask = 0x0000, - .base.atr_txval = 0, - .base.atr_rxval = 0, - // .base.atr_tx_delay = - // .base.atr_rx_delay = - .base.set_antenna = 0, - .common.first_if = U2_DOUBLE_TO_FXPT_FREQ(44e6), - .common.second_if = U2_DOUBLE_TO_FXPT_FREQ(56e6), // Fs - 44e6 -}; -#endif - -struct db_tvrx3 db_tvrx3 = { - .base.dbid = 0x0040, - .base.is_tx = false, - .base.output_enables = 0x0000, - .base.used_pins = 0x0000, - .base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(50e6), - .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(860e6), - .base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(0), - .base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(95), - .base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(1), - .base.is_quadrature = false, - .base.i_and_q_swapped = false, - .base.spectrum_inverted = false, - .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0), - .base.init = tvrx_init, - .base.set_freq = tvrx_set_freq, - .base.set_gain = tvrx_set_gain, - .base.set_tx_enable = 0, - .base.atr_mask = 0x0000, - .base.atr_txval = 0, - .base.atr_rxval = 0, - // .base.atr_tx_delay = - // .base.atr_rx_delay = - .base.set_antenna = 0, - .common.first_if = U2_DOUBLE_TO_FXPT_FREQ(44e6), - .common.second_if = U2_DOUBLE_TO_FXPT_FREQ(56e6), // Fs - 44e6 -}; - -bool -tvrx_init(struct db_base *dbb) -{ - struct db_tvrx_dummy *db = (struct db_tvrx_dummy *) dbb; - db->base.set_gain(dbb,U2_DOUBLE_TO_FXPT_GAIN(94.0)); - return true; -} - -bool -tvrx_set_freq(struct db_base *dbb, u2_fxpt_freq_t freq, u2_fxpt_freq_t *dc) -{ - *dc = 0; - if (freq < dbb->freq_min || freq > dbb->freq_max) - return false; - - struct db_tvrx_dummy *db = (struct db_tvrx_dummy *) dbb; - - u2_fxpt_freq_t target_lo_freq = freq + db->common.first_if; - int n_div = u2_fxpt_freq_round_to_int(((1LL<<20) * target_lo_freq)/REF_FREQ); - - u2_fxpt_freq_t actual_lo_freq = REF_FREQ * n_div; - u2_fxpt_freq_t actual_freq = actual_lo_freq - db->common.first_if; - if(n_div > 32767) - return false; - - if (0) - printf("n_div = %d, actual_freq = %d, actual_lo_freq = %d\n", - n_div, u2_fxpt_freq_round_to_int(actual_freq), - u2_fxpt_freq_round_to_int(actual_lo_freq)); - - unsigned char buf[4]; - buf[0] = (n_div>>8) & 0xff; - buf[1] = n_div & 0xff; - buf[2] = control_byte_1; - buf[3] = ((actual_freq < U2_DOUBLE_TO_FXPT_FREQ(158e6)) ? 0xa8 : // VHF LOW - (actual_freq < U2_DOUBLE_TO_FXPT_FREQ(464e6)) ? 0x98 : // VHF HIGH - 0x38); // UHF - - *dc = actual_freq - db->common.second_if; - return i2c_write(I2C_ADDR,buf,4); -} - -bool -tvrx_set_gain(struct db_base *dbb, u2_fxpt_gain_t gain) -{ - //struct db_tvrx_dummy *db = (struct db_tvrx_dummy *) dbb; - int rfgain; - int ifgain; - if(gain>U2_DOUBLE_TO_FXPT_GAIN(95.0)) - return false; - if(gain<0) - return false; - - if(gain>U2_DOUBLE_TO_FXPT_GAIN(60.0)) { - rfgain = U2_DOUBLE_TO_FXPT_GAIN(60.0); - ifgain = gain-U2_DOUBLE_TO_FXPT_GAIN(60.0); - } else { - rfgain = gain; - ifgain = 0; - } - - int rf_slope_q8 = 256 * 4096 * 2.5 / 60.0 / 1.22 / 3.3; - int rf_offset_q8 = 128 * 256 * 4096 * 1.25 / 1.22 / 3.3; - int if_slope_q8 = 256 * 4096 * 2.25 / 35.0 / 1.22 / 3.3; - int if_offset_q8 = 128 * 256 * 4096 * 1.4 / 1.22 / 3.3; - - - int rfdac = (rfgain*rf_slope_q8 + rf_offset_q8)>>15; - int ifdac = (ifgain*if_slope_q8 + if_offset_q8)>>15; - lsdac_write_rx(0,rfdac); - lsdac_write_rx(1,ifdac); - - if (0) - printf("Setting gain %d, rf %d, if %d\n",gain,rfdac,ifdac); - - return true; -} - - -bool -tvrx_lock_detect(struct db_base *dbb) -{ - // struct db_tvrx_dummy *db = (struct db_tvrx_dummy *) dbb; - return true; -} diff --git a/usrp2/firmware/lib/db_wbxng.c b/usrp2/firmware/lib/db_wbxng.c deleted file mode 100644 index 954633da2..000000000 --- a/usrp2/firmware/lib/db_wbxng.c +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Copyright 2010 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - * - */ - - -#include "db_wbxng.h" -#include "adf4350.h" -#include <spi.h> -#include <memory_map.h> -#include <db_base.h> -#include <hal_io.h> -#include <mdelay.h> -#include <lsdac.h> -#include <clocks.h> -#include <stdio.h> -#include <stdint.h> - -#define min(X,Y) ((X) < (Y) ? (X) : (Y)) -#define max(X,Y) ((X) > (Y) ? (X) : (Y)) - -bool wbxng_init_rx(struct db_base *dbb); -bool wbxng_init_tx(struct db_base *dbb); -bool wbxng_set_freq(struct db_base *dbb, u2_fxpt_freq_t freq, u2_fxpt_freq_t *dc); -bool wbxng_set_gain_rx(struct db_base *dbb, u2_fxpt_gain_t gain); -bool wbxng_set_gain_tx(struct db_base *dbb, u2_fxpt_gain_t gain); -bool wbxng_set_tx_enable(struct db_base *dbb, bool on); - - -/* - * The class instances - */ -struct db_wbxng_rx db_wbxng_rx = { - .base.dbid = 0x0053, - .base.is_tx = false, - .base.output_enables = RX2_RX1N|RXBB_EN|ATTN_MASK|ENABLE_33|ENABLE_5|PLL_CE|PLL_PDBRF|ATTN_MASK, - .base.used_pins = 0xFFFF, - .base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(68.75e6), - .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(2200e6), - .base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(0), - .base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(31.5), - .base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(0.5), - .base.is_quadrature = true, - .base.i_and_q_swapped = false, - .base.spectrum_inverted = false, - .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0), - .base.init = wbxng_init_rx, - .base.set_freq = wbxng_set_freq, - .base.set_gain = wbxng_set_gain_rx, - .base.set_tx_enable = 0, - .base.atr_mask = RXBB_EN | RX2_RX1N, - .base.atr_txval = RX2_RX1N, - .base.atr_rxval = RXBB_EN, - // .base.atr_tx_delay = - // .base.atr_rx_delay = - .base.set_antenna = 0, - .common.adf4350_regs_int = UINT16_C(100), - .common.adf4350_regs_frac = 0, - .common.adf4350_regs_prescaler = 1, - .common.adf4350_regs_mod = UINT16_C(0xfff), - .common.adf4350_regs_10_bit_r_counter = UINT16_C(1), - .common.adf4350_regs_divider_select = 0, - .common.adf4350_regs_8_bit_band_select_clock_divider_value = 0, - .common.spi_mask = SPI_SS_RX_DB, - .common.freq_mult = 2 -}; - - -struct db_wbxng_tx db_wbxng_tx = { - .base.dbid = 0x0052, - .base.is_tx = true, - .base.output_enables = RX_TXN|TXMOD_EN|ENABLE_33|ENABLE_5|PLL_CE|PLL_PDBRF, - .base.used_pins = 0xFFFF, - .base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(68.75e6), - .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(2200e6), - .base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(0), - .base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(25), - .base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(0.1), - .base.is_quadrature = true, - .base.i_and_q_swapped = false, - .base.spectrum_inverted = false, - .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0), - .base.init = wbxng_init_tx, - .base.set_freq = wbxng_set_freq, - .base.set_gain = wbxng_set_gain_tx, - .base.set_tx_enable = wbxng_set_tx_enable, - .base.atr_mask = RX_TXN | TXMOD_EN, - .base.atr_txval = TXMOD_EN, - .base.atr_rxval = RX_TXN, - // .base.atr_tx_delay = - // .base.atr_rx_delay = - .base.set_antenna = 0, - .common.adf4350_regs_int = UINT16_C(100), - .common.adf4350_regs_frac = 0, - .common.adf4350_regs_prescaler = 1, - .common.adf4350_regs_mod = UINT16_C(0xfff), - .common.adf4350_regs_10_bit_r_counter = UINT16_C(1), - .common.adf4350_regs_divider_select = 0, - .common.adf4350_regs_8_bit_band_select_clock_divider_value = 0, - .common.spi_mask = SPI_SS_TX_DB, - .common.freq_mult = 2 -}; - - -bool -wbxng_init_tx(struct db_base *dbb) -{ - //struct db_wbxng_dummy *db = (struct db_wbxng_dummy *) dbb; - clocks_enable_tx_dboard(true, 0); - hal_gpio_write( GPIO_TX_BANK, ENABLE_5|ENABLE_33, ENABLE_5|ENABLE_33 ); - - adf4350_init(dbb); - - // Set the freq now to get the one time 10ms delay out of the way. - u2_fxpt_freq_t dc; - dbb->set_freq(dbb, dbb->freq_min, &dc); - return true; -} - -bool -wbxng_init_rx(struct db_base *dbb) -{ - //struct db_wbxng_dummy *db = (struct db_wbxng_dummy *) dbb; - clocks_enable_rx_dboard(true, 0); - hal_gpio_write( GPIO_RX_BANK, ENABLE_5|ENABLE_33, ENABLE_5|ENABLE_33 ); - - adf4350_init(dbb); - - // test gain - dbb->set_gain(dbb,U2_DOUBLE_TO_FXPT_GAIN(20.0)); - - // Set the freq now to get the one time 10ms delay out of the way. - u2_fxpt_freq_t dc; - dbb->set_freq(dbb, dbb->freq_min, &dc); - - return true; -} - -bool -wbxng_set_freq(struct db_base *dbb, u2_fxpt_freq_t freq, u2_fxpt_freq_t *dc) -{ - // clamp freq - u2_fxpt_freq_t clamp_freq = max(dbb->freq_min, min(freq, dbb->freq_max)); - //printf("Requested LO freq = %u", (uint32_t) ((clamp_freq >> U2_FPF_RP)/1000)); - bool ok = adf4350_set_freq(clamp_freq<<1,dbb); - *dc = adf4350_get_freq(dbb)>>1; - - return ok; -} - -bool -wbxng_set_gain_tx(struct db_base *dbb, u2_fxpt_gain_t gain) -{ - struct db_wbxng_dummy *db = (struct db_wbxng_dummy *) dbb; - - // clamp gain - //gain = max(db->gain_min, min(gain, db->gain_max)); - - int offset_q8 = (int)(1.4/3.3*4096*(1<<15)); - int range_q15 = (int)(-0.9*4096/3.3*256*128); - int slope_q8 = range_q15/db->base.gain_max; - - int dacword = ((slope_q8 * gain) + offset_q8)>>15; - //printf("DACWORD 0x%x\n",dacword); - lsdac_write_tx(0,dacword); - return true; -} - -bool -wbxng_set_gain_rx(struct db_base *dbb, u2_fxpt_gain_t gain) -{ - struct db_wbxng_dummy *db = (struct db_wbxng_dummy *) dbb; - - // clamp gain - //gain = max(db->gain_min, min(gain, db->gain_max)); - - int iobits = (int) ((~((db->base.gain_max - gain) << 2)) & ATTN_MASK); - //printf("gain %d, gainmax %d, RX_ATTN_MASK = 0x%x, RX_ATTN_WORD = 0x%x\n", gain, db->base.gain_max, (int) (ATTN_MASK), (int) (iobits)); - - hal_gpio_write( GPIO_RX_BANK, (int) (iobits), ATTN_MASK ); - return true; -} - - -bool -wbxng_set_tx_enable(struct db_base *dbb, bool on) -{ - struct db_wbxng_dummy *db = (struct db_wbxng_dummy *) dbb; - - // FIXME - - return false; -} - -bool -wbxng_lock_detect(struct db_base *dbb) -{ - struct db_wbxng_dummy *db = (struct db_wbxng_dummy *) dbb; - - int pins; - pins = hal_gpio_read( db->base.is_tx ? GPIO_TX_BANK : GPIO_RX_BANK ); - if(pins & PLL_LOCK_DETECT) - //printf("Got Locked Status from Synth"); - return true; - - //printf("Got Unlocked Status from Synth"); - return false; -} - diff --git a/usrp2/firmware/lib/db_wbxng.h b/usrp2/firmware/lib/db_wbxng.h deleted file mode 100644 index 3756e6c24..000000000 --- a/usrp2/firmware/lib/db_wbxng.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2010 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - * - */ - -#ifndef DB_WBXNG_H -#define DB_WBXNG_H - -#include <db_base.h> - -// IO Pin functions -// Tx and Rx have shared defs, but different i/o regs -#define ENABLE_5 (1 << 7) // enables 5.0V power supply -#define ENABLE_33 (1 << 6) // enables 3.3V supply -//#define RX_TXN (1 << 15) // Tx only: T/R antenna switch for TX/RX port -//#define RX2_RX1N (1 << 15) // Rx only: antenna switch between RX2 and TX/RX port -#define RX_TXN ((1 << 5)|(1 << 15)) // Tx only: T/R antenna switch for TX/RX port -#define RX2_RX1N ((1 << 5)|(1 << 15)) // Rx only: antenna switch between RX2 and TX/RX port -#define RXBB_EN (1 << 4) -#define TXMOD_EN (1 << 4) -#define PLL_CE (1 << 3) -#define PLL_PDBRF (1 << 2) -#define PLL_MUXOUT (1 << 1) -#define PLL_LOCK_DETECT (1 << 0) - -// RX Attenuator constants -#define ATTN_SHIFT 8 -#define ATTN_MASK (63 << ATTN_SHIFT) - -struct db_wbxng_common { - // RFX common stuff - uint16_t adf4350_regs_int; - uint16_t adf4350_regs_frac; - uint8_t adf4350_regs_prescaler; - uint16_t adf4350_regs_mod; - uint16_t adf4350_regs_10_bit_r_counter; - uint8_t adf4350_regs_divider_select; - uint8_t adf4350_regs_8_bit_band_select_clock_divider_value; - - int freq_mult; - int spi_mask; -}; - -struct db_wbxng_dummy { - struct db_base base; - struct db_wbxng_common common; -}; - - -struct db_wbxng_rx { - struct db_base base; - struct db_wbxng_common common; -}; - -struct db_wbxng_tx { - struct db_base base; - struct db_wbxng_common common; -}; - - -#endif /* DB_WBXNG_H */ diff --git a/usrp2/firmware/lib/db_xcvr2450.c b/usrp2/firmware/lib/db_xcvr2450.c deleted file mode 100644 index 4cdcf031e..000000000 --- a/usrp2/firmware/lib/db_xcvr2450.c +++ /dev/null @@ -1,521 +0,0 @@ -/* - * Copyright 2009 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#include <memory_map.h> -#include <db_base.h> -#include <stdio.h> -#include <spi.h> -#include <hal_io.h> -#include <clocks.h> -#include <mdelay.h> - -void set_atr_regs(int bank, struct db_base *db); //FIXME I need to be in a header - -// RX IO Pins -#define LOCKDET (1 << 15) // This is an INPUT!!! -#define EN (1 << 14) -#define RX_EN (1 << 13) // 1 = RX on, 0 = RX off -#define RX_HP (1 << 12) -#define B1 (1 << 11) -#define B2 (1 << 10) -#define B3 (1 << 9) -#define B4 (1 << 8) -#define B5 (1 << 7) -#define B6 (1 << 6) -#define B7 (1 << 5) -#define RX_OE_MASK EN|RX_EN|RX_HP|B1|B2|B3|B4|B5|B6|B7 -#define RX_SAFE_IO EN -#define RX_ATR_MASK EN|RX_EN|RX_HP - -// TX IO Pins -#define HB_PA_OFF (1 << 15) // 5GHz PA, 1 = off, 0 = on -#define LB_PA_OFF (1 << 14) // 2.4GHz PA, 1 = off, 0 = on -#define ANTSEL_TX1_RX2 (1 << 13) // 1 = Ant 1 to TX, Ant 2 to RX -#define ANTSEL_TX2_RX1 (1 << 12) // 1 = Ant 2 to TX, Ant 1 to RX -#define TX_EN (1 << 11) // 1 = TX on, 0 = TX off -#define AD9515DIV (1 << 4) // 1 = Div by 3, 0 = Div by 2 -#define TX_OE_MASK HB_PA_OFF|LB_PA_OFF|ANTSEL_TX1_RX2|ANTSEL_TX2_RX1|TX_EN|AD9515DIV -#define TX_SAFE_IO HB_PA_OFF|LB_PA_OFF|ANTSEL_TX1_RX2|AD9515DIV -#define TX_ATR_MASK HB_PA_OFF|LB_PA_OFF|ANTSEL_TX1_RX2|ANTSEL_TX2_RX1|TX_EN|AD9515DIV - -#define LB_FREQ_MIN U2_DOUBLE_TO_FXPT_FREQ(2.3e9) -#define LB_FREQ_MAX U2_DOUBLE_TO_FXPT_FREQ(2.6e9) -#define HB_FREQ_MIN U2_DOUBLE_TO_FXPT_FREQ(4.8e9) -#define HB_FREQ_MAX U2_DOUBLE_TO_FXPT_FREQ(6.1e9) -#define MASTER_REF_CLK_DIV 1 -#define N_DIV_MIN_Q16 (131 << 16) - -bool xcvr2450_init(struct db_base *db); -bool xcvr2450_set_freq(struct db_base *db, u2_fxpt_freq_t freq, u2_fxpt_freq_t *dc); -bool xcvr2450_set_gain_rx(struct db_base *db, u2_fxpt_gain_t gain); -bool xcvr2450_set_gain_tx(struct db_base *db, u2_fxpt_gain_t gain); -bool xcvr2450_set_tx_enable(struct db_base *db, bool on); -bool xcvr2450_set_rx_antenna(struct db_base *db, int ant); -bool xcvr2450_set_tx_antenna(struct db_base *db, int ant); - -struct db_xcvr2450_common { - int d_mimo, d_int_div, d_frac_div, d_highband, d_five_gig; - int d_cp_current, d_ref_div, d_rssi_hbw; - int d_txlpf_bw, d_rxlpf_bw, d_rxlpf_fine, d_rxvga_ser; - int d_rssi_range, d_rssi_mode, d_rssi_mux; - int d_rx_hp_pin, d_rx_hpf, d_rx_ant; - int d_tx_ant, d_txvga_ser, d_tx_driver_lin; - int d_tx_vga_lin, d_tx_upconv_lin, d_tx_bb_gain; - int d_pabias_delay, d_pabias; - int d_rx_rf_gain, d_rx_bb_gain, d_txgain; - int d_ad9515_div; - int d_tx_enb; -}; - -struct db_xcvr2450_dummy { - struct db_base base; - struct db_xcvr2450_common *common; -}; - -struct db_xcvr2450_rx { - struct db_base base; - struct db_xcvr2450_common *common; -}; - -struct db_xcvr2450_tx { - struct db_base base; - struct db_xcvr2450_common *common; -}; - -/* - * shared common between rx and tx db - */ -struct db_xcvr2450_common db_xcvr2450_common = { - /* set sane defaults */ - .d_mimo = 1, // 0 = OFF, 1 = ON - .d_int_div = 192, // 128 = min, 255 = max - .d_frac_div = 0, // 0 = min, 65535 = max - .d_highband = 0, // 0 = freq <= 5.4e9, 1 = freq > 5.4e9 - .d_five_gig = 0, // 0 = freq <= 3.e9, 1 = freq > 3e9 - .d_cp_current = 0, // 0 = 2mA, 1 = 4mA - .d_ref_div = 1, // 1 to 7 - .d_rssi_hbw = 0, // 0 = 2 MHz, 1 = 6 MHz - .d_txlpf_bw = 1, // 1 = 12 MHz, 2 = 18 MHz, 3 = 24 MHz - .d_rxlpf_bw = 1, // 0 = 7.5 MHz, 1 = 9.5 MHz, 2 = 14 MHz, 3 = 18 MHz - .d_rxlpf_fine = 2, // 0 = 90%, 1 = 95%, 2 = 100%, 3 = 105%, 4 = 110% - .d_rxvga_ser = 1, // 0 = RXVGA controlled by B7:1, 1=controlled serially - .d_rssi_range = 1, // 0 = low range (datasheet typo), 1=high range (0.5V - 2.0V) - .d_rssi_mode = 1, // 0 = enable follows RXHP, 1 = enabled - .d_rssi_mux = 0, // 0 = RSSI, 1 = TEMP - .d_rx_hp_pin = 0, // 0 = Fc set by rx_hpf, 1 = 600 KHz - .d_rx_hpf = 0, // 0 = 100Hz, 1 = 30KHz - .d_rx_ant = 0, // 0 = Ant. #1, 1 = Ant. #2 - .d_tx_ant = 0, // 0 = Ant. #1, 1 = Ant. #2 - .d_txvga_ser = 1, // 0 = TXVGA controlled by B6:1, 1=controlled serially - .d_tx_driver_lin = 2, // 0=50% (worst linearity), 1=63%, 2=78%, 3=100% (best lin) - .d_tx_vga_lin = 2, // 0=50% (worst linearity), 1=63%, 2=78%, 3=100% (best lin) - .d_tx_upconv_lin = 2, // 0=50% (worst linearity), 1=63%, 2=78%, 3=100% (best lin) - .d_tx_bb_gain = 3, // 0=maxgain-5dB, 1=max-3dB, 2=max-1.5dB, 3=max - .d_pabias_delay = 15, // 0 = 0, 15 = 7uS - .d_pabias = 0, // 0 = 0 uA, 63 = 315uA - .d_rx_rf_gain = 0, // 0 = 0dB, 1 = 0dB, 2 = 15dB, 3 = 30dB - .d_rx_bb_gain = 16, // 0 = min, 31 = max (0 - 62 dB) - .d_txgain = 63, // 0 = min, 63 = max - .d_tx_enb = 1, // 0 = disabled, 1 = enabled -}; - -/* - * The class instances - */ -struct db_xcvr2450_rx db_xcvr2450_rx = { - .base.dbid = 0x0061, - .base.is_tx = false, - .base.output_enables = RX_OE_MASK, - .base.used_pins = 0xFFFF, - .base.freq_min = LB_FREQ_MIN, - .base.freq_max = HB_FREQ_MAX, - .base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(0), - .base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(92), - .base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(1), - .base.is_quadrature = true, - .base.i_and_q_swapped = false, - .base.spectrum_inverted = false, - .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0), - .base.init = xcvr2450_init, - .base.set_freq = xcvr2450_set_freq, - .base.set_gain = xcvr2450_set_gain_rx, - .base.atr_mask = RX_ATR_MASK, - .base.atr_txval = 0x0, - .base.atr_rxval = 0x0, - .base.set_antenna = xcvr2450_set_rx_antenna, - .common = &db_xcvr2450_common, -}; - -struct db_xcvr2450_tx db_xcvr2450_tx = { - .base.dbid = 0x0060, - .base.is_tx = true, - .base.output_enables = TX_OE_MASK, - .base.used_pins = 0xFFFF, - .base.freq_min = LB_FREQ_MIN, - .base.freq_max = HB_FREQ_MAX, - .base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(0), - .base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(30), - .base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(30.0/63.0), - .base.is_quadrature = true, - .base.i_and_q_swapped = true, - .base.spectrum_inverted = false, - .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0), - .base.init = xcvr2450_init, - .base.set_freq = xcvr2450_set_freq, - .base.set_gain = xcvr2450_set_gain_tx, - .base.set_tx_enable = xcvr2450_set_tx_enable, - .base.atr_mask = TX_ATR_MASK, - .base.atr_txval = 0x0, - .base.atr_rxval = 0x0, - .base.set_antenna = xcvr2450_set_tx_antenna, - .common = &db_xcvr2450_common, -}; - -/************************************************** - * Set Registers - **************************************************/ -static void -send_reg(int v){ - // Send 24 bits, it keeps last 18 clocked in - spi_transact(SPI_TXONLY,SPI_SS_RX_DB,v,24,SPIF_PUSH_FALL); - //printf("xcvr2450: Setting reg %d to %x\n", (v&15), v); -} - -static void -set_reg_standby(struct db_xcvr2450_dummy *db){ - int reg_standby = ( - (db->common->d_mimo<<17) | - (1<<16) | - (1<<6) | - (1<<5) | - (1<<4) | 2); - send_reg(reg_standby); -} - -static void -set_reg_int_divider(struct db_xcvr2450_dummy *db){ - int reg_int_divider = (( - (db->common->d_frac_div & 0x03)<<16) | - (db->common->d_int_div<<4) | 3); - send_reg(reg_int_divider); -} - -static void -set_reg_frac_divider(struct db_xcvr2450_dummy *db){ - int reg_frac_divider = ((db->common->d_frac_div & 0xfffc)<<2) | 4; - send_reg(reg_frac_divider); -} - -static void -set_reg_bandselpll(struct db_xcvr2450_dummy *db){ - int reg_bandselpll = ((db->common->d_mimo<<17) | - (1<<16) | - (1<<15) | - (0<<11) | //this bit gets toggled - (db->common->d_highband<<10) | - (db->common->d_cp_current<<9) | - (db->common->d_ref_div<<5) | - (db->common->d_five_gig<<4) | 5); - send_reg(reg_bandselpll); - reg_bandselpll = ((db->common->d_mimo<<17) | - (1<<16) | - (1<<15) | - (1<<11) | - (db->common->d_highband<<10) | - (db->common->d_cp_current<<9) | - (db->common->d_ref_div<<5) | - (db->common->d_five_gig<<4) | 5); - send_reg(reg_bandselpll); -} - -static void -set_reg_cal(struct db_xcvr2450_dummy *db){ - // FIXME do calibration - int reg_cal = ( - (1<<14) | 6); - send_reg(reg_cal); -} - -static void -set_reg_lpf(struct db_xcvr2450_dummy *db){ - int reg_lpf = ( - (db->common->d_rssi_hbw<<15) | - (db->common->d_txlpf_bw<<9) | - (db->common->d_rxlpf_bw<<7) | - (db->common->d_rxlpf_fine<<4) | 7); - send_reg(reg_lpf); -} - -static void -set_reg_rxrssi_ctrl(struct db_xcvr2450_dummy *db){ - int reg_rxrssi_ctrl = ( - (db->common->d_rxvga_ser<<16) | - (db->common->d_rssi_range<<15) | - (db->common->d_rssi_mode<<14) | - (db->common->d_rssi_mux<<12) | - (1<<9) | - (db->common->d_rx_hpf<<6) | - (1<<4) | 8); - send_reg(reg_rxrssi_ctrl); -} - -static void -set_reg_txlin_gain(struct db_xcvr2450_dummy *db){ - int reg_txlin_gain = ( - (db->common->d_txvga_ser<<14) | - (db->common->d_tx_driver_lin<<12) | - (db->common->d_tx_vga_lin<<10) | - (db->common->d_tx_upconv_lin<<6) | - (db->common->d_tx_bb_gain<<4) | 9); - send_reg(reg_txlin_gain); -} - -static void -set_reg_pabias(struct db_xcvr2450_dummy *db){ - int reg_pabias = ( - (db->common->d_pabias_delay<<10) | - (db->common->d_pabias<<4) | 10); - send_reg(reg_pabias); -} - -static void -set_reg_rxgain(struct db_xcvr2450_dummy *db){ - int reg_rxgain = ( - (db->common->d_rx_rf_gain<<9) | - (db->common->d_rx_bb_gain<<4) | 11); - send_reg(reg_rxgain); -} - -static void -set_reg_txgain(struct db_xcvr2450_dummy *db){ - int reg_txgain = ( - (db->common->d_txgain<<4) | 12); - send_reg(reg_txgain); -} - -/************************************************** - * GPIO - **************************************************/ -static void -set_gpio(struct db_xcvr2450_dummy *db){ - //set tx/rx gpio pins for auto tr - int tx_enb_sel = (db->common->d_tx_enb)? TX_EN:0; - int ad9515_sel = (db->common->d_ad9515_div == 3)? AD9515DIV:0; - int rx_hp = (db->common->d_rx_hp_pin)? RX_HP:0; - int tx_antsel = (db->common->d_tx_ant)? ANTSEL_TX2_RX1:ANTSEL_TX1_RX2; - int rx_antsel = (db->common->d_rx_ant)? ANTSEL_TX2_RX1:ANTSEL_TX1_RX2; - int tx_pa_sel = (db->common->d_five_gig)? LB_PA_OFF:HB_PA_OFF; - - /* FIXME better way to set rx and tx val for RX and TX banks */ - /* set rx bank */ - db->base.atr_rxval = EN|rx_hp|RX_EN; - db->base.atr_txval = EN|rx_hp; - set_atr_regs(GPIO_RX_BANK, (struct db_base *)db); - /* set tx bank */ - db->base.atr_rxval = HB_PA_OFF|LB_PA_OFF|rx_antsel|ad9515_sel; - db->base.atr_txval = tx_pa_sel|tx_antsel|tx_enb_sel|ad9515_sel; - set_atr_regs(GPIO_TX_BANK, (struct db_base *)db); -} - -/************************************************** - * Init for TX and RX - **************************************************/ -bool -xcvr2450_init(struct db_base *dbb){ - struct db_xcvr2450_dummy *db = (struct db_xcvr2450_dummy *) dbb; - /* Initialize chipset */ - clocks_enable_tx_dboard(true, MASTER_REF_CLK_DIV); - set_gpio(db); - set_reg_standby(db); - set_reg_bandselpll(db); - set_reg_cal(db); - set_reg_lpf(db); - set_reg_rxrssi_ctrl(db); - set_reg_txlin_gain(db); - set_reg_pabias(db); - set_reg_rxgain(db); - set_reg_txgain(db); - //u2_fxpt_freq_t dc; - //db->base.set_freq(dbb, U2_DOUBLE_TO_FXPT_FREQ(2.434e9), &dc); - return true; -} - -/************************************************** - * Lock detect - **************************************************/ -static bool -lock_detect(){ - //true when the VCO/PLL lock detect bit is set. - if(hal_gpio_read(GPIO_RX_BANK) & LOCKDET) { - return true; - } - else { // Give it a second chance - mdelay(1); - if(hal_gpio_read(GPIO_RX_BANK) & LOCKDET) - return true; - else - return false; - } -} - -/************************************************** - * Set the freq - **************************************************/ -bool -xcvr2450_set_freq(struct db_base *dbb, u2_fxpt_freq_t freq, u2_fxpt_freq_t *dc){ - unsigned int scaler, div_factor, actual_div_q16; - struct db_xcvr2450_dummy *db = (struct db_xcvr2450_dummy *) dbb; - /* determine if the freq range is in low or high band */ - if (freq >= LB_FREQ_MIN && freq <= LB_FREQ_MAX) { - db->common->d_five_gig = 0; - scaler = 3; - //printf("2.4-GHZ\n"); - } else if (freq >= HB_FREQ_MIN && freq <= HB_FREQ_MAX) { - db->common->d_five_gig = 1; - scaler = 5; - //printf("5-GHZ\n"); - } else { - printf("Out of range\n"); - return false; - } - /* set the highband bit */ - if(freq > U2_DOUBLE_TO_FXPT_FREQ(5.408e9)) { - db->common->d_highband = 1; - //printf("5-HB\n"); - } - else { - db->common->d_highband = 0; - //printf("5-LB\n"); - } - unsigned int loop_iter = 0; - do { /* set the dividers so that the n divider is above the practical minimum */ - switch(loop_iter){ - case 0: - db->common->d_ad9515_div = 3; - db->common->d_ref_div = 1; - break; - case 1: - db->common->d_ad9515_div = 2; - db->common->d_ref_div = 2; - break; - default: - db->common->d_ad9515_div = 3; - db->common->d_ref_div = loop_iter; - } - loop_iter++; - div_factor = db->common->d_ref_div*db->common->d_ad9515_div*4*MASTER_REF_CLK_DIV; - actual_div_q16 = ((freq*div_factor)/(scaler*MASTER_CLK_RATE)) >> (U2_FPF_RP-16); - } while (actual_div_q16 < N_DIV_MIN_Q16); - /* calculate the divisors */ - db->common->d_int_div = actual_div_q16 >> 16; - db->common->d_frac_div = actual_div_q16 & 0xffff; //isolate lower 16 bits - /* calculate the dc freq */ - *dc = ((((u2_fxpt_freq_t)MASTER_CLK_RATE)*actual_div_q16*scaler) / div_factor) << (U2_FPF_RP-16); - /*printf("scaler %d, div(int) %u, div_factor %d, ad9515_div %u, ref_div %u\n", - scaler, db->common->d_int_div, div_factor, db->common->d_ad9515_div, db->common->d_ref_div); - printf("actual div %u, Target Freq %uKHz, Actual Freq %uKHz\n", - actual_div_q16, u2_fxpt_freq_round_to_int(freq/1000), u2_fxpt_freq_round_to_int(*dc/1000)); - */ - set_gpio(db); - set_reg_int_divider(db); - set_reg_frac_divider(db); - set_reg_bandselpll(db); - - bool ok = lock_detect(); - if(!ok){ - printf("Fail lock detect %uKHz\n", u2_fxpt_freq_round_to_int(freq/1000)); - } - return ok; -} - -/************************************************** - * Set RX Gain - **************************************************/ -bool -xcvr2450_set_gain_rx(struct db_base *dbb, u2_fxpt_gain_t gain){ - struct db_xcvr2450_dummy *db = (struct db_xcvr2450_dummy *) dbb; - //ensure gain is within range - if(!(gain >= db->base.gain_min && gain <= db->base.gain_max)) { - return false; - } - // Split the gain between RF and baseband - // This is experimental, not prescribed - if(gain < U2_DOUBLE_TO_FXPT_GAIN(30.0)) { - db->common->d_rx_rf_gain = 0; // 0 dB RF gain - db->common->d_rx_bb_gain = u2_fxpt_gain_round_to_int(gain/2); - } - else if(gain >= U2_DOUBLE_TO_FXPT_GAIN(30.0) && gain < U2_DOUBLE_TO_FXPT_GAIN(61.0)) { - db->common->d_rx_rf_gain = 2; // 15 dB RF gain - db->common->d_rx_bb_gain = u2_fxpt_gain_round_to_int((gain-U2_DOUBLE_TO_FXPT_GAIN(15.0))/2); - } - else if(gain >= U2_DOUBLE_TO_FXPT_GAIN(61.0)) { - db->common->d_rx_rf_gain = 3; // 30.5 dB RF gain - db->common->d_rx_bb_gain = u2_fxpt_gain_round_to_int((gain-U2_DOUBLE_TO_FXPT_GAIN(30.5))/2); - } - //printf("RX RF Gain %u, RX BB Gain %u\n", db->common->d_rx_rf_gain, db->common->d_rx_bb_gain); - set_reg_rxgain(db); - return true; -} - -/************************************************** - * Set TX Gain - **************************************************/ -bool -xcvr2450_set_gain_tx(struct db_base *dbb, u2_fxpt_gain_t gain){ - struct db_xcvr2450_dummy *db = (struct db_xcvr2450_dummy *) dbb; - //ensure gain in within range - if(!(gain >= db->base.gain_min && gain <= db->base.gain_max)) { - return false; - } - //scale for register and set - db->common->d_txgain = (gain*63)/db->base.gain_max; - //printf("TX Gain %u, TX Reg %u\n", u2_fxpt_gain_round_to_int(gain), db->common->d_txgain); - set_reg_txgain(db); - return true; -} - -/************************************************** - * Set TX Enable - **************************************************/ -bool -xcvr2450_set_tx_enable(struct db_base *dbb, bool on){ - struct db_xcvr2450_dummy *db = (struct db_xcvr2450_dummy *) dbb; - db->common->d_tx_enb = on; - set_gpio(db); - return true; -} - -/************************************************** - * Set Antennas - **************************************************/ -bool xcvr2450_set_rx_antenna(struct db_base *dbb, int ant){ - printf("xcvr set rx ant %d\n", ant); - if (ant > 1) return false; - struct db_xcvr2450_dummy *db = (struct db_xcvr2450_dummy *) dbb; - db->common->d_rx_ant = ant; - set_gpio(db); - return true; -} - -bool xcvr2450_set_tx_antenna(struct db_base *dbb, int ant){ - printf("xcvr set tx ant %d\n", ant); - if (ant > 1) return false; - struct db_xcvr2450_dummy *db = (struct db_xcvr2450_dummy *) dbb; - db->common->d_tx_ant = ant; - set_gpio(db); - return true; -} diff --git a/usrp2/firmware/lib/dbsm.c b/usrp2/firmware/lib/dbsm.c deleted file mode 100644 index 96484d577..000000000 --- a/usrp2/firmware/lib/dbsm.c +++ /dev/null @@ -1,297 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -/* - * Double Buffering State Machine - */ - -#include "dbsm.h" -#include "memory_map.h" -#include "buffer_pool.h" -#include "bool.h" -#include "nonstdio.h" -#include <stdlib.h> - -typedef enum { - BS_EMPTY, - BS_FILLING, - BS_FULL, - BS_EMPTYING, -} buffer_state_t; - -static buffer_state_t buffer_state[NBUFFERS]; - -bool -dbsm_nop_inspector(dbsm_t *sm, int buf_this) -{ - return false; -} - -void -dbsm_init(dbsm_t *sm, int buf0, - const buf_cmd_args_t *recv, const buf_cmd_args_t *send, - inspector_t inspect) -{ - if (buf0 & 0x1) // must be even - abort(); - - sm->buf0 = buf0; - sm->running = false; - sm->recv_args = *recv; - sm->send_args = *send; - - sm->rx_idle = true; - sm->tx_idle = true; - - sm->inspect = inspect; - - // How much to adjust the last_line register. - // It's 1 for everything but the ethernet. - //sm->last_line_adj = recv->port == PORT_ETH ? 3 : 1; - sm->last_line_adj = 1; - - buffer_state[sm->buf0] = BS_EMPTY; - buffer_state[sm->buf0 ^ 1] = BS_EMPTY; - - sm->precomputed_receive_to_buf_ctrl_word[0] = - (BPC_READ - | BPC_BUFFER(sm->buf0) - | BPC_PORT(sm->recv_args.port) - | BPC_STEP(1) - | BPC_FIRST_LINE(sm->recv_args.first_line) - | BPC_LAST_LINE(sm->recv_args.last_line)); - - sm->precomputed_receive_to_buf_ctrl_word[1] = - (BPC_READ - | BPC_BUFFER(sm->buf0 ^ 1) - | BPC_PORT(sm->recv_args.port) - | BPC_STEP(1) - | BPC_FIRST_LINE(sm->recv_args.first_line) - | BPC_LAST_LINE(sm->recv_args.last_line)); - - sm->precomputed_send_from_buf_ctrl_word[0] = - (BPC_WRITE - | BPC_BUFFER(sm->buf0) - | BPC_PORT(sm->send_args.port) - | BPC_STEP(1) - | BPC_FIRST_LINE(sm->send_args.first_line) - | BPC_LAST_LINE(0)); // last line filled in at runtime - - sm->precomputed_send_from_buf_ctrl_word[1] = - (BPC_WRITE - | BPC_BUFFER(sm->buf0 ^ 1) - | BPC_PORT(sm->send_args.port) - | BPC_STEP(1) - | BPC_FIRST_LINE(sm->send_args.first_line) - | BPC_LAST_LINE(0)); // last line filled in at runtime - -} - -static inline void -dbsm_receive_to_buf(dbsm_t *sm, int bufno) -{ - buffer_pool_ctrl->ctrl = sm->precomputed_receive_to_buf_ctrl_word[bufno & 1]; -} - -static inline void -dbsm_send_from_buf(dbsm_t *sm, int bufno) -{ - buffer_pool_ctrl->ctrl = - (sm->precomputed_send_from_buf_ctrl_word[bufno & 1] - | BPC_LAST_LINE(buffer_pool_status->last_line[bufno] - sm->last_line_adj)); -} - -void -dbsm_start(dbsm_t *sm) -{ - // printf("dbsm_start: buf0 = %d, recv_port = %d\n", sm->buf0, sm->recv_args.port); - - sm->running = true; - - buffer_state[sm->buf0] = BS_EMPTY; - buffer_state[sm->buf0 ^ 1] = BS_EMPTY; - - bp_clear_buf(sm->buf0); - bp_clear_buf(sm->buf0 ^ 1); - - sm->tx_idle = true; - sm->rx_idle = false; - dbsm_receive_to_buf(sm, sm->buf0); - buffer_state[sm->buf0] = BS_FILLING; - -} - - -void -dbsm_stop(dbsm_t *sm) -{ - sm->running = false; - bp_clear_buf(sm->buf0); - bp_clear_buf(sm->buf0 ^ 1); - buffer_state[sm->buf0] = BS_EMPTY; - buffer_state[sm->buf0 ^ 1] = BS_EMPTY; -} - -static void dbsm_process_helper(dbsm_t *sm, int buf_this); -static void dbsm_error_helper(dbsm_t *sm, int buf_this); - -void -dbsm_process_status(dbsm_t *sm, uint32_t status) -{ - if (!sm->running) - return; - - if (status & (BPS_ERROR(sm->buf0) | BPS_ERROR(sm->buf0 ^ 1))){ - putchar('E'); - // Most likely an ethernet Rx error. We just restart the transfer. - if (status & (BPS_ERROR(sm->buf0))) - dbsm_error_helper(sm, sm->buf0); - - if (status & (BPS_ERROR(sm->buf0 ^ 1))) - dbsm_error_helper(sm, sm->buf0 ^ 1); - } - - if (status & BPS_DONE(sm->buf0)) - dbsm_process_helper(sm, sm->buf0); - - if (status & BPS_DONE(sm->buf0 ^ 1)) - dbsm_process_helper(sm, sm->buf0 ^ 1); -} - -static void -dbsm_process_helper(dbsm_t *sm, int buf_this) -{ - int buf_other = buf_this ^ 1; - - bp_clear_buf(buf_this); - - if (buffer_state[buf_this] == BS_FILLING){ - buffer_state[buf_this] = BS_FULL; - // - // does s/w handle this packet? - // - if (sm->inspect(sm, buf_this)){ - // s/w handled the packet; refill the buffer - dbsm_receive_to_buf(sm, buf_this); - buffer_state[buf_this] = BS_FILLING; - } - - else { // s/w didn't handle this; pass it on - - if(buffer_state[buf_other] == BS_EMPTY){ - dbsm_receive_to_buf(sm, buf_other); - buffer_state[buf_other] = BS_FILLING; - } - else - sm->rx_idle = true; - - if (sm->tx_idle){ - sm->tx_idle = false; - dbsm_send_from_buf(sm, buf_this); - buffer_state[buf_this] = BS_EMPTYING; - } - } - } - else { // buffer was emptying - buffer_state[buf_this] = BS_EMPTY; - if (sm->rx_idle){ - sm->rx_idle = false; - dbsm_receive_to_buf(sm, buf_this); - buffer_state[buf_this] = BS_FILLING; - } - if (buffer_state[buf_other] == BS_FULL){ - dbsm_send_from_buf(sm, buf_other); - buffer_state[buf_other] = BS_EMPTYING; - } - else - sm->tx_idle = true; - } -} - -static void -dbsm_error_helper(dbsm_t *sm, int buf_this) -{ - bp_clear_buf(buf_this); // clears ERROR flag - - if (buffer_state[buf_this] == BS_FILLING){ - dbsm_receive_to_buf(sm, buf_this); // restart the xfer - } - else { // buffer was emptying - dbsm_send_from_buf(sm, buf_this); // restart the xfer - } -} - -/* - * Handle DSP Tx underrun - */ -void -dbsm_handle_tx_underrun(dbsm_t *sm) -{ - // clear the DSP Tx state machine - dsp_tx_regs->clear_state = 1; - - // If there's a buffer that's empyting, clear it & flush xfer - - if (buffer_state[sm->buf0] == BS_EMPTYING){ - bp_clear_buf(sm->buf0); - dsp_tx_regs->clear_state = 1; // flush partial packet - // drop frame in progress on ground. Pretend it finished - dbsm_process_helper(sm, sm->buf0); - } - else if (buffer_state[sm->buf0 ^ 1] == BS_EMPTYING){ - bp_clear_buf(sm->buf0 ^ 1); - dsp_tx_regs->clear_state = 1; // flush partial packet - // drop frame in progress on ground. Pretend it finished - dbsm_process_helper(sm, sm->buf0 ^ 1); - } -} - -/* - * Handle DSP Rx overrun - */ -void -dbsm_handle_rx_overrun(dbsm_t *sm) -{ - dsp_rx_regs->clear_state = 1; - - // If there's a buffer that's filling, clear it. - // Any restart will be the job of the caller. - - if (buffer_state[sm->buf0] == BS_FILLING) - bp_clear_buf(sm->buf0); - - if (buffer_state[sm->buf0 ^1] == BS_FILLING) - bp_clear_buf(sm->buf0 ^ 1); -} - -void -dbsm_wait_for_opening(dbsm_t *sm) -{ - if (buffer_state[sm->buf0] == BS_EMPTYING){ - // wait for xfer to complete - int mask = BPS_DONE(sm->buf0) | BPS_ERROR(sm->buf0) | BPS_IDLE(sm->buf0); - while ((buffer_pool_status->status & mask) == 0) - ; - } - else if (buffer_state[sm->buf0 ^ 1] == BS_EMPTYING){ - // wait for xfer to complete - int mask = BPS_DONE(sm->buf0 ^ 1) | BPS_ERROR(sm->buf0 ^ 1) | BPS_IDLE(sm->buf0 ^ 1); - while ((buffer_pool_status->status & mask) == 0) - ; - } -} diff --git a/usrp2/firmware/lib/dbsm.h b/usrp2/firmware/lib/dbsm.h deleted file mode 100644 index 3a64bf0dc..000000000 --- a/usrp2/firmware/lib/dbsm.h +++ /dev/null @@ -1,90 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ -#ifndef INCLUDED_DBSM_H -#define INCLUDED_DBSM_H - -/* - * Double Buffering State Machine - */ - -#include <stdint.h> -#include "bool.h" - -struct _dbsm; -typedef struct _dbsm dbsm_t; - -/* - * pointer to function that does packet inspection. - * - * If one of these returns true, it means that the s/w - * handled that packet, and that it should NOT be passed - * on to the normal destination port. - */ -typedef bool (*inspector_t)(dbsm_t *sm, int buf_this); - -bool dbsm_nop_inspector(dbsm_t *sm, int buf_this); // returns false - - -typedef struct -{ - uint16_t port; - uint16_t first_line; - uint16_t last_line; -} buf_cmd_args_t; - -/*! - * double buffer state machine - */ -struct _dbsm -{ - uint8_t buf0; // Must be even. This machine uses buf0 and buf0+1 - uint8_t running; - uint8_t rx_idle; - uint8_t tx_idle; - buf_cmd_args_t recv_args; - buf_cmd_args_t send_args; - inspector_t inspect; - uint32_t precomputed_receive_to_buf_ctrl_word[2]; - uint32_t precomputed_send_from_buf_ctrl_word[2]; - int last_line_adj; -}; - -void dbsm_init(dbsm_t *sm, int buf0, - const buf_cmd_args_t *recv, const buf_cmd_args_t *send, - inspector_t inspect); - -void dbsm_start(dbsm_t *sm); -void dbsm_stop(dbsm_t *sm); -void dbsm_process_status(dbsm_t *sm, uint32_t status); -void dbsm_handle_tx_underrun(dbsm_t *sm); -void dbsm_handle_rx_overrun(dbsm_t *sm); - -/* - * The cpu calls this when it want to ensure that it can send a buffer - * to the same destination being used by this state machine. - * - * If neither buffer is EMPTYING it returns immediately. If a buffer - * is EMPYTING, it waits for the h/w to transition to the DONE or - * ERROR state. - * - * When this function returns, the caller queues it's buffer and busy - * waits for it to complete. - */ -void dbsm_wait_for_opening(dbsm_t *sm); - -#endif /* INCLUDED_DBSM_H */ diff --git a/usrp2/firmware/lib/eeprom.c b/usrp2/firmware/lib/eeprom.c deleted file mode 100644 index b12ffe082..000000000 --- a/usrp2/firmware/lib/eeprom.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#include "i2c.h" -#include "mdelay.h" - -static const int EEPROM_PAGESIZE = 16; - -bool -eeprom_write (int i2c_addr, int eeprom_offset, const void *buf, int len) -{ - unsigned char cmd[2]; - const unsigned char *p = (unsigned char *) buf; - - // The simplest thing that could possibly work: - // all writes are single byte writes. - // - // We could speed this up using the page write feature, - // but we write so infrequently, why bother... - - while (len-- > 0){ - cmd[0] = eeprom_offset++; - cmd[1] = *p++; - bool r = i2c_write (i2c_addr, cmd, sizeof (cmd)); - mdelay (10); // delay 10ms worst case write time - if (!r) - return false; - } - return true; -} - -bool -eeprom_read (int i2c_addr, int eeprom_offset, void *buf, int len) -{ - unsigned char *p = (unsigned char *) buf; - - // We setup a random read by first doing a "zero byte write". - // Writes carry an address. Reads use an implicit address. - - unsigned char cmd[1]; - cmd[0] = eeprom_offset; - if (!i2c_write (i2c_addr, cmd, sizeof (cmd))) - return false; - - while (len > 0){ - // int n = std::min (len, MAX_EP0_PKTSIZE); - int n = len; - if (!i2c_read (i2c_addr, p, n)) - return false; - len -= n; - p += n; - } - return true; -} - diff --git a/usrp2/firmware/lib/eth_mac.c b/usrp2/firmware/lib/eth_mac.c deleted file mode 100644 index 88051dca0..000000000 --- a/usrp2/firmware/lib/eth_mac.c +++ /dev/null @@ -1,127 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#include "eth_mac.h" -#include "memory_map.h" -#include "bool.h" -#include "eth_phy.h" // for simulation constants -#include "mdelay.h" -#include "stdio.h" - -#define PHY_ADDR 1 - -void -eth_mac_set_addr(const u2_mac_addr_t *src) -{ - eth_mac->ucast_hi = - (((unsigned int)src->addr[0])<<8) + - ((unsigned int)src->addr[1]); - eth_mac->ucast_lo = - (((unsigned int)src->addr[2])<<24) + - (((unsigned int)src->addr[3])<<16) + - (((unsigned int)src->addr[4])<<8) + - (((unsigned int)src->addr[5])); -} - - -void -eth_mac_init(const u2_mac_addr_t *src) -{ - eth_mac->miimoder = 25; // divider from CPU clock (50MHz/25 = 2MHz) - - eth_mac_set_addr(src); - eth_mac->settings = MAC_SET_PAUSE_EN | MAC_SET_PASS_BCAST | MAC_SET_PASS_UCAST | MAC_SET_PAUSE_SEND_EN; - - eth_mac->pause_time = 38; - eth_mac->pause_thresh = 1200; - - // set rx flow control high and low water marks - // unsigned int lwmark = (2*2048 + 64)/4; // 2 * 2048-byte frames + 1 * 64-byte pause frame - // eth_mac->fc_hwmark = lwmark + 2048/4; // plus a 2048-byte frame - - // eth_mac->fc_lwmark = 600; // there are currently 2047 lines in the fifo - // eth_mac->fc_hwmark = 1200; - //eth_mac->fc_padtime = 1700; // how long before flow control runs out do we - // request a re-pause. Units of 8ns (bytes) - - //eth_mac->tx_pause_en = 0; // pay attn to pause frames sent to us - //eth_mac->pause_quanta_set = 38; // a bit more than 1 max frame 16kb/512 + fudge - //eth_mac->pause_frame_send_en = 0; // enable sending pause frames -} - -int -eth_mac_read_rmon(int addr) -{ - int t = 0; - /* - eth_mac->rmon_rd_addr = addr; - eth_mac->rmon_rd_apply = 1; - while(eth_mac->rmon_rd_grant == 0) - ; - - t = eth_mac->rmon_rd_dout; - eth_mac->rmon_rd_apply = 0; - */ - return t; -} - -int -eth_mac_miim_read(int addr) -{ - if (hwconfig_simulation_p()){ - switch(addr){ - case PHY_LINK_AN: - return LANSR_MASTER | LANSR_LINK_GOOD | LANSR_SPEED_1000; - default: - return 0; - } - } - - int phy_addr = PHY_ADDR; - eth_mac->miiaddress = ((addr & 0x1f) << 8) | phy_addr; - eth_mac->miicommand = MIIC_RSTAT; - - while((eth_mac->miistatus & MIIS_BUSY) != 0) - ; - - int r = eth_mac->miirx_data; - //printf("MIIM-READ ADDR 0x%x DATA 0x%x\n",addr, r); - return r; -} - -void -eth_mac_miim_write(int addr, int value) -{ - int phy_addr = PHY_ADDR; - eth_mac->miiaddress = ((addr & 0x1f) << 8) | phy_addr; - eth_mac->miitx_data = value; - eth_mac->miicommand = MIIC_WCTRLDATA; - - //printf("MIIM-WRITE ADDR 0x%x VAL 0x%x\n",addr,value); - while((eth_mac->miistatus & MIIS_BUSY) != 0) - ; -} - -int -eth_mac_miim_read_status(void) -{ - if (hwconfig_simulation_p()) - return 0; - - return eth_mac->miistatus; -} diff --git a/usrp2/firmware/lib/eth_mac.h b/usrp2/firmware/lib/eth_mac.h deleted file mode 100644 index 291994c5c..000000000 --- a/usrp2/firmware/lib/eth_mac.h +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- c -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifndef INCLUDED_ETH_MAC_H -#define INCLUDED_ETH_MAC_H - -#include "usrp2_mac_addr.h" - -void eth_mac_init(const u2_mac_addr_t *src); - -void eth_mac_set_addr(const u2_mac_addr_t *src); -int eth_mac_read_rmon(int addr); -int eth_mac_miim_read(int addr); -void eth_mac_miim_write(int addr, int value); -int eth_mac_miim_read_status(void); - -#endif /* INCLUDED_ETH_MAC_H */ diff --git a/usrp2/firmware/lib/eth_mac_regs.h b/usrp2/firmware/lib/eth_mac_regs.h deleted file mode 100644 index d680f8de0..000000000 --- a/usrp2/firmware/lib/eth_mac_regs.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- c -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifndef INCLUDED_ETH_MAC_REGS_H -#define INCLUDED_ETH_MAC_REGS_H - -/* - * Simple GEMAC - * - */ -typedef struct { - volatile int settings; - volatile int ucast_hi; - volatile int ucast_lo; - volatile int mcast_hi; - volatile int mcast_lo; - volatile int miimoder; - volatile int miiaddress; - volatile int miitx_data; - volatile int miicommand; - volatile int miistatus; - volatile int miirx_data; - volatile int pause_time; - volatile int pause_thresh; -} eth_mac_regs_t; - -// settings register -#define MAC_SET_PAUSE_EN (1 << 0) // Makes us respect received pause frames (normally on) -#define MAC_SET_PASS_ALL (1 << 1) // Enables promiscuous mode, currently broken -#define MAC_SET_PASS_PAUSE (1 << 2) // Sends pause frames through (normally off) -#define MAC_SET_PASS_BCAST (1 << 3) // Sends broadcast frames through (normally on) -#define MAC_SET_PASS_MCAST (1 << 4) // Sends multicast frames that match mcast addr (normally off) -#define MAC_SET_PASS_UCAST (1 << 5) // Sends unicast (normal) frames through if they hit in address filter (normally on) -#define MAC_SET_PAUSE_SEND_EN (1 << 6) // Enables sending pause frames - -// miicommand register -#define MIIC_SCANSSTAT (1 << 0) // Scan status -#define MIIC_RSTAT (1 << 1) // Read status -#define MIIC_WCTRLDATA (1 << 2) // Write control data - -// miistatus register -#define MIIS_LINKFAIL (1 << 0) // The link failed -#define MIIS_BUSY (1 << 1) // The MII is busy (operation in progress) -#define MIIS_NVALID (1 << 2) // The data in the status register is invalid - // This it is only valid when the scan status is active. - -#endif /* INCLUDED_ETH_MAC_REGS_H */ diff --git a/usrp2/firmware/lib/eth_phy.h b/usrp2/firmware/lib/eth_phy.h deleted file mode 100644 index 6c16f97b7..000000000 --- a/usrp2/firmware/lib/eth_phy.h +++ /dev/null @@ -1,219 +0,0 @@ -/* -*- c -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * Copyright(c) 1999 - 2005 Intel Corporation. All rights reserved. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -/* Much of this was extracted from the Linux e1000_hw.h file */ - -#ifndef INCLUDED_ETH_PHY_H -#define INCLUDED_ETH_PHY_H - -/* PHY 1000 MII Register/Bit Definitions */ -/* PHY Registers defined by IEEE */ - -#define PHY_CTRL 0x00 /* Control Register */ -#define PHY_STATUS 0x01 /* Status Regiser */ -#define PHY_ID1 0x02 /* Phy Id Reg (word 1) */ -#define PHY_ID2 0x03 /* Phy Id Reg (word 2) */ -#define PHY_AUTONEG_ADV 0x04 /* Autoneg Advertisement */ -#define PHY_LP_ABILITY 0x05 /* Link Partner Ability (Base Page) */ -#define PHY_AUTONEG_EXP 0x06 /* Autoneg Expansion Reg */ -#define PHY_NEXT_PAGE_TX 0x07 /* Next Page TX */ -#define PHY_LP_NEXT_PAGE 0x08 /* Link Partner Next Page */ -#define PHY_1000T_CTRL 0x09 /* 1000Base-T Control Reg */ -#define PHY_1000T_STATUS 0x0A /* 1000Base-T Status Reg */ -#define PHY_EXT_STATUS 0x0F /* Extended Status Reg */ - -/* PHY 1000 MII Register additions in DP83856 */ -/* The part implements 0x00 thru 0x1f; we use these. */ - -#define PHY_LINK_AN 0x11 /* Link and Auto Negotiation Status Reg */ -#define PHY_INT_STATUS 0x14 /* Interupt Status Reg (RO) */ -#define PHY_INT_MASK 0x15 /* Interrupt Mask Reg (RW) */ -#define PHY_INT_CLEAR 0x17 /* Interrupt Clear Reg (RW) */ - - -/* Bit definitions for some of the registers above */ - -/* PHY Control Register (PHY_CTRL) */ -#define MII_CR_SPEED_SELECT_MSB 0x0040 /* bits 6,13: 10=1000, 01=100, 00=10 */ -#define MII_CR_COLL_TEST_ENABLE 0x0080 /* Collision test enable */ -#define MII_CR_FULL_DUPLEX 0x0100 /* FDX =1, half duplex =0 */ -#define MII_CR_RESTART_AUTO_NEG 0x0200 /* Restart auto negotiation */ -#define MII_CR_ISOLATE 0x0400 /* Isolate PHY from MII */ -#define MII_CR_POWER_DOWN 0x0800 /* Power down */ -#define MII_CR_AUTO_NEG_EN 0x1000 /* Auto Neg Enable */ -#define MII_CR_SPEED_SELECT_LSB 0x2000 /* bits 6,13: 10=1000, 01=100, 00=10 */ -#define MII_CR_LOOPBACK 0x4000 /* 0 = normal, 1 = loopback */ -#define MII_CR_RESET 0x8000 /* 0 = normal, 1 = PHY reset */ - -/* PHY Status Register (PHY_STATUS) */ -#define MII_SR_EXTENDED_CAPS 0x0001 /* Extended register capabilities */ -#define MII_SR_JABBER_DETECT 0x0002 /* Jabber Detected */ -#define MII_SR_LINK_STATUS 0x0004 /* Link Status 1 = link */ -#define MII_SR_AUTONEG_CAPS 0x0008 /* Auto Neg Capable */ -#define MII_SR_REMOTE_FAULT 0x0010 /* Remote Fault Detect */ -#define MII_SR_AUTONEG_COMPLETE 0x0020 /* Auto Neg Complete */ -#define MII_SR_PREAMBLE_SUPPRESS 0x0040 /* Preamble may be suppressed */ -#define MII_SR_EXTENDED_STATUS 0x0100 /* Ext. status info in Reg 0x0F */ -#define MII_SR_100T2_HD_CAPS 0x0200 /* 100T2 Half Duplex Capable */ -#define MII_SR_100T2_FD_CAPS 0x0400 /* 100T2 Full Duplex Capable */ -#define MII_SR_10T_HD_CAPS 0x0800 /* 10T Half Duplex Capable */ -#define MII_SR_10T_FD_CAPS 0x1000 /* 10T Full Duplex Capable */ -#define MII_SR_100X_HD_CAPS 0x2000 /* 100X Half Duplex Capable */ -#define MII_SR_100X_FD_CAPS 0x4000 /* 100X Full Duplex Capable */ -#define MII_SR_100T4_CAPS 0x8000 /* 100T4 Capable */ - -/* Autoneg Advertisement Register (PHY_AUTONEG_ADV) */ -#define NWAY_AR_SELECTOR_FIELD 0x0001 /* indicates IEEE 802.3 CSMA/CD */ -#define NWAY_AR_10T_HD_CAPS 0x0020 /* 10T Half Duplex Capable */ -#define NWAY_AR_10T_FD_CAPS 0x0040 /* 10T Full Duplex Capable */ -#define NWAY_AR_100TX_HD_CAPS 0x0080 /* 100TX Half Duplex Capable */ -#define NWAY_AR_100TX_FD_CAPS 0x0100 /* 100TX Full Duplex Capable */ -#define NWAY_AR_100T4_CAPS 0x0200 /* 100T4 Capable */ -#define NWAY_AR_PAUSE 0x0400 /* Pause operation desired */ -#define NWAY_AR_ASM_DIR 0x0800 /* Asymmetric Pause Direction bit */ -#define NWAY_AR_REMOTE_FAULT 0x2000 /* Remote Fault detected */ -#define NWAY_AR_NEXT_PAGE 0x8000 /* Next Page ability supported */ - -/* Link Partner Ability Register (Base Page) (PHY_LP_ABILITY) */ -#define NWAY_LPAR_SELECTOR_FIELD 0x0000 /* LP protocol selector field */ -#define NWAY_LPAR_10T_HD_CAPS 0x0020 /* LP is 10T Half Duplex Capable */ -#define NWAY_LPAR_10T_FD_CAPS 0x0040 /* LP is 10T Full Duplex Capable */ -#define NWAY_LPAR_100TX_HD_CAPS 0x0080 /* LP is 100TX Half Duplex Capable */ -#define NWAY_LPAR_100TX_FD_CAPS 0x0100 /* LP is 100TX Full Duplex Capable */ -#define NWAY_LPAR_100T4_CAPS 0x0200 /* LP is 100T4 Capable */ -#define NWAY_LPAR_PAUSE 0x0400 /* LP Pause operation desired */ -#define NWAY_LPAR_ASM_DIR 0x0800 /* LP Asymmetric Pause Direction bit */ -#define NWAY_LPAR_REMOTE_FAULT 0x2000 /* LP has detected Remote Fault */ -#define NWAY_LPAR_ACKNOWLEDGE 0x4000 /* LP has rx'd link code word */ -#define NWAY_LPAR_NEXT_PAGE 0x8000 /* Next Page ability supported */ - -/* Autoneg Expansion Register (PHY_AUTONEG_EXP) */ -#define NWAY_ER_LP_NWAY_CAPS 0x0001 /* LP has Auto Neg Capability */ -#define NWAY_ER_PAGE_RXD 0x0002 /* LP is 10T Half Duplex Capable */ -#define NWAY_ER_NEXT_PAGE_CAPS 0x0004 /* LP is 10T Full Duplex Capable */ -#define NWAY_ER_LP_NEXT_PAGE_CAPS 0x0008 /* LP is 100TX Half Duplex Capable */ -#define NWAY_ER_PAR_DETECT_FAULT 0x0010 /* LP is 100TX Full Duplex Capable */ - -/* Next Page TX Register (PHY_NEXT_PAGE_TX) */ -#define NPTX_MSG_CODE_FIELD 0x0001 /* NP msg code or unformatted data */ -#define NPTX_TOGGLE 0x0800 /* Toggles between exchanges - * of different NP - */ -#define NPTX_ACKNOWLDGE2 0x1000 /* 1 = will comply with msg - * 0 = cannot comply with msg - */ -#define NPTX_MSG_PAGE 0x2000 /* formatted(1)/unformatted(0) pg */ -#define NPTX_NEXT_PAGE 0x8000 /* 1 = addition NP will follow - * 0 = sending last NP - */ - -/* Link Partner Next Page Register (PHY_LP_NEXT_PAGE) */ -#define LP_RNPR_MSG_CODE_FIELD 0x0001 /* NP msg code or unformatted data */ -#define LP_RNPR_TOGGLE 0x0800 /* Toggles between exchanges - * of different NP - */ -#define LP_RNPR_ACKNOWLDGE2 0x1000 /* 1 = will comply with msg - * 0 = cannot comply with msg - */ -#define LP_RNPR_MSG_PAGE 0x2000 /* formatted(1)/unformatted(0) pg */ -#define LP_RNPR_ACKNOWLDGE 0x4000 /* 1 = ACK / 0 = NO ACK */ -#define LP_RNPR_NEXT_PAGE 0x8000 /* 1 = addition NP will follow - * 0 = sending last NP - */ - -/* 1000BASE-T Control Register (PHY_1000T_CTRL) */ -#define CR_1000T_ASYM_PAUSE 0x0080 /* Advertise asymmetric pause bit */ -#define CR_1000T_HD_CAPS 0x0100 /* Advertise 1000T HD capability */ -#define CR_1000T_FD_CAPS 0x0200 /* Advertise 1000T FD capability */ -#define CR_1000T_REPEATER_DTE 0x0400 /* 1=Repeater/switch device port */ - /* 0=DTE device */ -#define CR_1000T_MS_VALUE 0x0800 /* 1=Configure PHY as Master */ - /* 0=Configure PHY as Slave */ -#define CR_1000T_MS_ENABLE 0x1000 /* 1=Master/Slave manual config value */ - /* 0=Automatic Master/Slave config */ -#define CR_1000T_TEST_MODE_NORMAL 0x0000 /* Normal Operation */ -#define CR_1000T_TEST_MODE_1 0x2000 /* Transmit Waveform test */ -#define CR_1000T_TEST_MODE_2 0x4000 /* Master Transmit Jitter test */ -#define CR_1000T_TEST_MODE_3 0x6000 /* Slave Transmit Jitter test */ -#define CR_1000T_TEST_MODE_4 0x8000 /* Transmitter Distortion test */ - -/* 1000BASE-T Status Register (PHY_1000T_STATUS) */ -#define SR_1000T_IDLE_ERROR_CNT 0x00FF /* Num idle errors since last read */ -#define SR_1000T_ASYM_PAUSE_DIR 0x0100 /* LP asymmetric pause direction bit */ -#define SR_1000T_LP_HD_CAPS 0x0400 /* LP is 1000T HD capable */ -#define SR_1000T_LP_FD_CAPS 0x0800 /* LP is 1000T FD capable */ -#define SR_1000T_REMOTE_RX_STATUS 0x1000 /* Remote receiver OK */ -#define SR_1000T_LOCAL_RX_STATUS 0x2000 /* Local receiver OK */ -#define SR_1000T_MS_CONFIG_RES 0x4000 /* 1=Local TX is Master, 0=Slave */ -#define SR_1000T_MS_CONFIG_FAULT 0x8000 /* Master/Slave config fault */ -#define SR_1000T_REMOTE_RX_STATUS_SHIFT 12 -#define SR_1000T_LOCAL_RX_STATUS_SHIFT 13 -#define SR_1000T_PHY_EXCESSIVE_IDLE_ERR_COUNT 5 -#define FFE_IDLE_ERR_COUNT_TIMEOUT_20 20 -#define FFE_IDLE_ERR_COUNT_TIMEOUT_100 100 - -/* Extended Status Register (PHY_EXT_STATUS) */ -#define IEEE_ESR_1000T_HD_CAPS 0x1000 /* 1000T HD capable */ -#define IEEE_ESR_1000T_FD_CAPS 0x2000 /* 1000T FD capable */ -#define IEEE_ESR_1000X_HD_CAPS 0x4000 /* 1000X HD capable */ -#define IEEE_ESR_1000X_FD_CAPS 0x8000 /* 1000X FD capable */ - -#define PHY_TX_POLARITY_MASK 0x0100 /* register 10h bit 8 (polarity bit) */ -#define PHY_TX_NORMAL_POLARITY 0 /* register 10h bit 8 (normal polarity) */ - -#define AUTO_POLARITY_DISABLE 0x0010 /* register 11h bit 4 */ - /* (0=enable, 1=disable) */ - -/* Link and Auto Negotiation Status Reg (PHY_LINK_AN) [READ-ONLY] */ -#define LANSR_MASTER 0x0001 /* 1=PHY is currently in master mode */ -#define LANSR_FULL_DUPLEX 0x0002 /* 1=PHY is currently full duplex */ -#define LANSR_LINK_GOOD 0x0004 /* 1=a good link is established */ -#define LANSR_SPEED_MASK 0x0018 -#define LANSR_SPEED_10 0x0000 /* 10Mb/s */ -#define LANSR_SPEED_100 0x0008 /* 100Mb/s */ -#define LANSR_SPEED_1000 0x0010 /* 1000Mb/s */ -#define LANSR_SPEED_RSRVD 0x0018 /* reserved */ -#define LANSR_NON_COMP_MODE 0x0020 /* 1=detects only in non-compliant mode */ -#define LANSR_DEEP_LOOPBACK 0x0040 /* 1=the PHY operates in deep loopback mode */ -#define LANSR_SHALLOW_LOOPBACK 0x0080 /* 1=the PHY operates in shallow loopback mode */ -#define LANSR_RSRVD_8 0x0100 /* reserved */ -#define LANSR_FIFO_ERR 0x0200 /* 1=FIFO error occurred */ -#define LANSR_MDIX_XOVER 0x0400 /* 1=PHY's MDI is in cross-over mode */ -#define LANSR_RSRVD_11 0x0800 /* resevered */ -#define LANSR_TP_POLARITY_REV 0xf000 /* Twisted pair polarity status A:D([15:12]) 1=reversed */ - -/* Interrupt status, mask and clear regs (PHY_INT_{STATUS,MASK,CLEAR}) */ -#define PHY_INT_RSRVD_0 0x0001 /* reserved */ -#define PHY_INT_RSRVD_1 0x0002 /* reserved */ -#define PHY_INT_RSRVD_2 0x0004 /* reserved */ -#define PHY_INT_REM_FLT_CNG 0x0008 /* Remote Fault Changed */ -#define PHY_INT_AN_CMPL 0x0010 /* Auto-negotiation completion */ -#define PHY_INT_NXT_PG_RCVD 0x0020 /* Next Page Received */ -#define PHY_INT_JABBER_CNG 0x0040 /* Jabber Changed */ -#define PHY_INT_NO_LINK 0x0080 /* No link after auto-negotiation */ -#define PHY_INT_NO_HCD 0x0100 /* AN couldn't determine highest common denominator */ -#define PHY_INT_MAS_SLA_ERR 0x0200 /* Master / Slave Error: couldn't resolve */ -#define PHY_INT_PRL_DET_FLT 0x0400 /* Parallel detection fault */ -#define PHY_INT_POL_CNG 0x0800 /* Polarity of any channel changed */ -#define PHY_INT_MDIX_CNG 0x1000 /* MDIX changed. A pair swap occurred. */ -#define PHY_INT_DPLX_CNG 0x2000 /* Duplex changed */ -#define PHY_INT_LNK_CNG 0x4000 /* Link changed (asserted when a link is established or broken) */ -#define PHY_INT_SPD_CNG 0x8000 /* Speed changed */ - -#endif /* INCLUDED_ETH_PHY_H */ diff --git a/usrp2/firmware/lib/ethernet.c b/usrp2/firmware/lib/ethernet.c deleted file mode 100644 index f554e0179..000000000 --- a/usrp2/firmware/lib/ethernet.c +++ /dev/null @@ -1,348 +0,0 @@ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#include "ethernet.h" -#include "memory_map.h" -#include "eth_phy.h" -#include "eth_mac.h" -#include "eth_mac_regs.h" -#include "pic.h" -#include "hal_io.h" -#include "nonstdio.h" -#include "bool.h" -#include "i2c.h" -#include "usrp2_i2c_addr.h" - - -#define VERBOSE 0 - -static ethernet_t ed_state; -static ethernet_link_changed_callback_t ed_callback = 0; - -void -ethernet_register_link_changed_callback(ethernet_link_changed_callback_t new_callback) -{ - ed_callback = new_callback; -} - - -static void -ed_set_mac_speed(int speed) -{ - printf("Speed set to %d\n",speed); - /* - switch(speed){ - case 10: - eth_mac->speed = 1; - break; - case 100: - eth_mac->speed = 2; - break; - case 1000: - eth_mac->speed = 4; - break; - default: - break; - } - */ -} - -static void -ed_link_up(int speed) -{ - // putstr("ed_link_up: "); puthex16_nl(speed); - - ed_set_mac_speed(speed); - - if (ed_callback) // fire link changed callback - (*ed_callback)(speed); -} - -static void -ed_link_down(void) -{ - // putstr("ed_link_down\n"); - - if (ed_callback) // fire link changed callback - (*ed_callback)(0); -} - - -static void -ed_link_speed_change(int speed) -{ - ed_link_down(); - ed_link_up(speed); -} - -static void -print_flow_control(int flow_control) -{ - static const char *flow_control_msg[4] = { - "NONE", "WE_TX", "WE_RX", "SYMMETRIC" - }; - putstr("ethernet flow control: "); - puts(flow_control_msg[flow_control & 0x3]); -} - -static void -check_flow_control_resolution(void) -{ - static const unsigned char table[16] = { - // index = {local_asm, local_pause, partner_asm, partner_pause} - FC_NONE, FC_NONE, FC_NONE, FC_NONE, - FC_NONE, FC_SYMM, FC_NONE, FC_SYMM, - FC_NONE, FC_NONE, FC_NONE, FC_WE_TX, - FC_NONE, FC_SYMM, FC_WE_RX, FC_SYMM - }; - - int us = eth_mac_miim_read(PHY_AUTONEG_ADV); - int lp = eth_mac_miim_read(PHY_LP_ABILITY); - int index = (((us >> 10) & 0x3) << 2) | ((lp >> 10) & 0x3); - ed_state.flow_control = table[index]; - - if (1) - print_flow_control(ed_state.flow_control); -} - -/* - * Read the PHY state register to determine link state and speed - */ -static void -ed_check_phy_state(void) -{ - int lansr = eth_mac_miim_read(PHY_LINK_AN); - eth_link_state_t new_state = LS_UNKNOWN; - int new_speed = S_UNKNOWN; - - if (VERBOSE){ - putstr("LANSR: "); - puthex16_nl(lansr); - } - - if (lansr & LANSR_LINK_GOOD){ // link's up - if (VERBOSE) - puts(" LINK_GOOD"); - - new_state = LS_UP; - switch (lansr & LANSR_SPEED_MASK){ - case LANSR_SPEED_10: - new_speed = 10; - break; - - case LANSR_SPEED_100: - new_speed = 100; - break; - - case LANSR_SPEED_1000: - new_speed = 1000; - break; - - default: - new_speed = S_UNKNOWN; - break; - } - - check_flow_control_resolution(); - } - else { // link's down - if (VERBOSE) - puts(" NOT LINK_GOOD"); - - new_state = LS_DOWN; - new_speed = S_UNKNOWN; - } - - if (new_state != ed_state.link_state){ - ed_state.link_state = new_state; // remember new state - if (new_state == LS_UP) - ed_link_up(new_speed); - else if (new_state == LS_DOWN) - ed_link_down(); - } - else if (new_state == LS_UP && new_speed != ed_state.link_speed){ - ed_state.link_speed = new_speed; // remember new speed - ed_link_speed_change(new_speed); - } -} - -/* - * This is fired when the ethernet PHY state changes - */ -static void -eth_phy_irq_handler(unsigned irq) -{ - ed_check_phy_state(); - eth_mac_miim_write(PHY_INT_CLEAR, ~0); // clear all ints -} - -void -ethernet_init(void) -{ - eth_mac_init(ethernet_mac_addr()); - - ed_state.link_state = LS_UNKNOWN; - ed_state.link_speed = S_UNKNOWN; - - // initialize MAC registers - // eth_mac->tx_hwmark = 0x1e; - //eth_mac->tx_lwmark = 0x19; - - //eth_mac->crc_chk_en = 1; - //eth_mac->rx_max_length = 2048; - - // configure PAUSE frame stuff - //eth_mac->tx_pause_en = 1; // pay attn to pause frames sent to us - - //eth_mac->pause_quanta_set = 38; // a bit more than 1 max frame 16kb/512 + fudge - //eth_mac->pause_frame_send_en = 1; // enable sending pause frames - - - // setup PHY to interrupt on changes - - unsigned mask = - (PHY_INT_AN_CMPL // auto-neg completed - | PHY_INT_NO_LINK // no link after auto-neg - | PHY_INT_NO_HCD // no highest common denominator - | PHY_INT_MAS_SLA_ERR // couldn't resolve master/slave - | PHY_INT_PRL_DET_FLT // parallel detection fault - | PHY_INT_LNK_CNG // link established or broken - | PHY_INT_SPD_CNG // speed changed - ); - - eth_mac_miim_write(PHY_INT_CLEAR, ~0); // clear all pending interrupts - eth_mac_miim_write(PHY_INT_MASK, mask); // enable the ones we want - - pic_register_handler(IRQ_PHY, eth_phy_irq_handler); - - // Advertise our flow control configuation. - // - // We and the link partner each specify two bits in the base page - // related to autoconfiguration: NWAY_AR_PAUSE and NWAY_AR_ASM_DIR. - // The bits say what a device is "willing" to do, not what may actually - // happen as a result of the negotiation. There are 4 cases: - // - // PAUSE ASM_DIR - // - // 0 0 I have no flow control capability. - // - // 1 0 I both assert and respond to flow control. - // - // 0 1 I assert flow control, but cannot respond. That is, - // I want to be able to send PAUSE frames, but will ignore any - // you send to me. (This is our configuration.) - // - // 1 1 I can both assert and respond to flow control AND I am willing - // to operate symmetrically OR asymmetrically in EITHER direction. - // (We hope the link partner advertises this, otherwise we don't - // get what we want.) - - int t = eth_mac_miim_read(PHY_AUTONEG_ADV); - t &= ~(NWAY_AR_PAUSE | NWAY_AR_ASM_DIR); - t |= NWAY_AR_ASM_DIR; - - // Say we can't to 10BASE-T or 100BASE-TX, half or full duplex - t &= ~(NWAY_AR_10T_HD_CAPS | NWAY_AR_10T_FD_CAPS | NWAY_AR_100TX_HD_CAPS | NWAY_AR_100TX_FD_CAPS); - - eth_mac_miim_write(PHY_AUTONEG_ADV, t); - int r = eth_mac_miim_read(PHY_AUTONEG_ADV); // DEBUG, read back - if (t != r){ - printf("PHY_AUTONEG_ADV: wrote 0x%x, got 0x%x\n", t, r); - } - - // Restart autonegotation. - // We want to ensure that we're advertising our PAUSE capabilities. - t = eth_mac_miim_read(PHY_CTRL); - eth_mac_miim_write(PHY_CTRL, t | MII_CR_RESTART_AUTO_NEG); -} - -static bool -unprogrammed(const u2_mac_addr_t *t) -{ - int i; - bool all_zeros = true; - bool all_ones = true; - for (i = 0; i < 6; i++){ - all_zeros &= t->addr[i] == 0x00; - all_ones &= t->addr[i] == 0xff; - } - return all_ones | all_zeros; -} - -static int8_t src_addr_initialized = false; -static u2_mac_addr_t src_addr = {{ - 0x00, 0x50, 0xC2, 0x85, 0x3f, 0xff - }}; - -const u2_mac_addr_t * -ethernet_mac_addr(void) -{ - if (!src_addr_initialized){ // fetch from eeprom - src_addr_initialized = true; - - // if we're simulating, don't read the EEPROM model, it's REALLY slow - if (hwconfig_simulation_p()) - return &src_addr; - - u2_mac_addr_t tmp; - bool ok = eeprom_read(I2C_ADDR_MBOARD, MBOARD_MAC_ADDR, &tmp.addr[0], 6); - if (!ok || unprogrammed(&tmp)){ - // use the default - } - else - src_addr = tmp; - } - - return &src_addr; -} - -bool -ethernet_set_mac_addr(const u2_mac_addr_t *t) -{ - bool ok = eeprom_write(I2C_ADDR_MBOARD, MBOARD_MAC_ADDR, &t->addr[0], 6); - if (ok){ - src_addr = *t; - src_addr_initialized = true; - eth_mac_set_addr(t); - } - - return ok; -} - -int -ethernet_check_errors(void) -{ - // these registers are reset when read - - int r = 0; - /* - if (eth_mac_read_rmon(0x05) != 0) - r |= RME_RX_CRC; - if (eth_mac_read_rmon(0x06) != 0) - r |= RME_RX_FIFO_FULL; - if (eth_mac_read_rmon(0x07) != 0) - r |= RME_RX_2SHORT_2LONG; - - if (eth_mac_read_rmon(0x25) != 0) - r |= RME_TX_JAM_DROP; - if (eth_mac_read_rmon(0x26) != 0) - r |= RME_TX_FIFO_UNDER; - if (eth_mac_read_rmon(0x27) != 0) - r |= RME_TX_FIFO_OVER; - */ - return r; -} diff --git a/usrp2/firmware/lib/ethernet.h b/usrp2/firmware/lib/ethernet.h deleted file mode 100644 index aaed05d44..000000000 --- a/usrp2/firmware/lib/ethernet.h +++ /dev/null @@ -1,82 +0,0 @@ -/* -*- c -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifndef INCLUDED_ETHERNET_H -#define INCLUDED_ETHERNET_H - -#include "usrp2_mac_addr.h" -#include "bool.h" - -typedef void (*ethernet_link_changed_callback_t)(int speed); - - -/*! - * \brief one time call to initialize ethernet - */ -void ethernet_init(void); - -/*! - * \brief Specify the function to call on link state changes. - * - * When the link comes up, speed is the link speed in Mbit/s. - * When the link goes down, speed is 0. - */ -void ethernet_register_link_changed_callback(ethernet_link_changed_callback_t cb); - -/*! - * \returns ethernet MAC address - */ -const u2_mac_addr_t *ethernet_mac_addr(void); - -/*! - * \brief write mac address to eeprom and begin using it - */ -bool ethernet_set_mac_addr(const u2_mac_addr_t *t); - - -/* - * \brief read RMON regs and return error mask - */ -int ethernet_check_errors(void); - -#define RME_RX_CRC 0x0001 -#define RME_RX_FIFO_FULL 0x0002 -#define RME_RX_2SHORT_2LONG 0x0004 - -#define RME_TX_JAM_DROP 0x0010 -#define RME_TX_FIFO_UNDER 0x0020 -#define RME_TX_FIFO_OVER 0x0040 - - -typedef enum { LS_UNKNOWN, LS_DOWN, LS_UP } eth_link_state_t; - -// flow control bitmasks -#define FC_NONE 0x0 -#define FC_WE_TX 0x1 // we send PAUSE frames -#define FC_WE_RX 0x2 // we honor received PAUSE frames -#define FC_SYMM (FC_WE_TX | FC_WE_RX) - -#define S_UNKNOWN (-1) // unknown link speed - -typedef struct { - eth_link_state_t link_state; - int link_speed; // in Mb/s - int flow_control; -} ethernet_t; - -#endif /* INCLUDED_ETHERNET_H */ diff --git a/usrp2/firmware/lib/exit.c b/usrp2/firmware/lib/exit.c deleted file mode 100644 index 95a3bf4de..000000000 --- a/usrp2/firmware/lib/exit.c +++ /dev/null @@ -1,28 +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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -extern void _exit(int status); - -void -exit(int status) -{ - _exit(status); -} diff --git a/usrp2/firmware/lib/hal_io.c b/usrp2/firmware/lib/hal_io.c deleted file mode 100644 index 1a370687e..000000000 --- a/usrp2/firmware/lib/hal_io.c +++ /dev/null @@ -1,323 +0,0 @@ -/* -*- c -*- */ -/* - * Copyright 2007,2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -// conditionalized on HAL_IO_USES_DBOARD_PINS && HAL_IO_USES_UART - -#include "hal_io.h" -#include "memory_map.h" -#include "hal_uart.h" -#include "bool.h" -#include <stdio.h> -#include <string.h> -//#include <assert.h> - -/* - * ======================================================================== - * GPIOS - * ======================================================================== - */ -void -hal_gpio_set_ddr(int bank, int value, int mask) -{ - bank &= 0x1; - - if (bank == GPIO_TX_BANK){ // tx in top half - value <<= 16; - mask <<= 16; - } - else { - value &= 0xffff; - mask &= 0xffff; - } - - int ei = hal_disable_ints(); - gpio_base->ddr = (gpio_base->ddr & ~mask) | (value & mask); - hal_restore_ints(ei); -} - -static bool -code_to_int(char code, int *val) -{ - switch(code){ - case 's': *val = GPIO_SEL_SW; return true; - case 'a': *val = GPIO_SEL_ATR; return true; - case '0': *val = GPIO_SEL_DEBUG_0; return true; - case '1': *val = GPIO_SEL_DEBUG_1; return true; - case '.': - default: - return false; - } -} - -void -hal_gpio_set_sel(int bank, int bitno, char code) -{ - bank &= 0x1; - int t; - - if (!code_to_int(code, &t)) - return; - - int val = t << (2 * bitno); - int mask = 0x3 << (2 * bitno); - - volatile uint32_t *sel = bank == GPIO_TX_BANK ? &gpio_base->tx_sel : &gpio_base->rx_sel; - int ei = hal_disable_ints(); - int v = (*sel & ~mask) | (val & mask); - *sel = v; - hal_restore_ints(ei); - - if (0) - printf("hal_gpio_set_sel(bank=%d, bitno=%d, code=%c) *sel = 0x%x\n", - bank, bitno, code, v); -} - -void -hal_gpio_set_sels(int bank, char *codes) -{ - //assert(strlen(codes) == 16); - - int val = 0; - int mask = 0; - int i; - - for (i = 15; i >= 0; i--){ - val <<= 2; - mask <<= 2; - int t; - if (code_to_int(codes[i], &t)){ - val |= t; - mask |= 0x3; - } - } - - volatile uint32_t *sel = bank == GPIO_TX_BANK ? &gpio_base->tx_sel : &gpio_base->rx_sel; - int ei = hal_disable_ints(); - *sel = (*sel & ~mask) | (val & mask); - hal_restore_ints(ei); -} - - -/*! - * \brief write \p value to gpio pins specified by \p mask. - */ -void -hal_gpio_write(int bank, int value, int mask) -{ - static uint32_t _gpio_io_shadow; - - bank &= 0x1; - - if (bank == GPIO_TX_BANK){ // tx in top half - value <<= 16; - mask <<= 16; - } - else { - value &= 0xffff; - mask &= 0xffff; - } - - //int ei = hal_disable_ints(); - _gpio_io_shadow = (_gpio_io_shadow & ~mask) | (value & mask); - gpio_base->io = _gpio_io_shadow; - //hal_restore_ints(ei); -} - - -/*! - * \brief read GPIO bits - */ -int -hal_gpio_read(int bank) -{ - bank &= 0x1; - int r = gpio_base->io; - if (bank == GPIO_TX_BANK) - r >>= 16; - - return r & 0xffff; -} - -/* - * ======================================================================== - * leds - * ======================================================================== - */ - -static unsigned long leds_shadow = 0; -static unsigned long led_src_shadow = 0; - -void -hal_set_leds(int value, int mask) -{ - int ei = hal_disable_ints(); - leds_shadow = (leds_shadow & ~mask) | (value & mask); - output_regs->leds = leds_shadow; - hal_restore_ints(ei); -} - -// Allow hardware control over leds. 1 = hardware, 0 = software -void -hal_set_led_src(int value, int mask) -{ - int ei = hal_disable_ints(); - led_src_shadow = (led_src_shadow & ~mask) | (value & mask); - output_regs->led_src = led_src_shadow; - hal_restore_ints(ei); -} - -void -hal_toggle_leds(int mask) -{ - int ei = hal_disable_ints(); - leds_shadow ^= mask; - output_regs->leds = leds_shadow; - hal_restore_ints(ei); -} - - -// ================================================================ -// primitives -// ================================================================ - -#if defined(HAL_IO_USES_DBOARD_PINS) -// -// Does i/o using high 9-bits of rx daughterboard pins. -// -// 1 1 1 1 1 1 -// 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | char |W| | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// -// -// Asserts W when writing char -// - -#define W 0x0080 - -void -hal_io_init(void) -{ - // make high 9 bits of tx daughterboard outputs - hal_gpio_set_rx_mode(15, 7, GPIOM_OUTPUT); - - // and set them to zero - hal_gpio_set_rx(0x0000, 0xff80); -} - -void -hal_finish(void) -{ - volatile unsigned long *p = (unsigned long *) 0xC2F0; - *p = 0; -} - -// %c -inline int -putchar(int ch) -{ - hal_gpio_set_rx((s << 8) | W, 0xff80); - hal_gpio_set_rx(0, 0xff80); - return ch; -} - -#elif defined(HAL_IO_USES_UART) - -void -hal_io_init(void) -{ - hal_uart_init(); -} - -void -hal_finish(void) -{ -} - -// %c -inline int -putchar(int ch) -{ - hal_uart_putc(ch); - return ch; -} - -int -getchar(void) -{ - return hal_uart_getc(); -} - -#else // nop all i/o - -void -hal_io_init(void) -{ -} - -void -hal_finish(void) -{ -} - -// %c -inline int -putchar(int ch) -{ - return ch; -} - -int -getchar(void) -{ - return EOF; -} - -#endif - -// ================================================================ -// (slightly) higher level functions -// -// These are here so we can inline the calls to putchar. -// The rest of the stuff was moved to nonstdio.c -// ================================================================ - -// \n -inline void -newline(void) -{ - putchar('\n'); -} - -int -putstr(const char *s) -{ - while (*s) - putchar(*s++); - - return 0; -} - -int -puts(const char *s) -{ - putstr(s); - putchar('\n'); - return 0; -} diff --git a/usrp2/firmware/lib/hal_io.h b/usrp2/firmware/lib/hal_io.h deleted file mode 100644 index b6ae35b73..000000000 --- a/usrp2/firmware/lib/hal_io.h +++ /dev/null @@ -1,169 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifndef INCLUDED_HAL_IO_H -#define INCLUDED_HAL_IO_H - -#include "memory_map.h" - -void hal_io_init(void); -void hal_finish(); - - -/* - * ------------------------------------------------------------------------ - * The GPIO pins are organized into two banks of 16-bits. - * Bank 0 goes to the Tx daughterboard, Bank 1 goes to the Rx daughterboard. - * - * Each pin may be configured as an input or an output from the FPGA. - * For output pins, there are four signals which may be routed to the - * pin. The four signals are the value written by s/w, the output of - * the ATR controller, or two different sources of debug info from the - * FPGA fabric. - * ------------------------------------------------------------------------ - */ - -#define GPIO_TX_BANK 0 // pins that connect to the Tx daughterboard -#define GPIO_RX_BANK 1 // pins that connect to the Rx daughterboard - - -/*! - * \brief Set the data direction for GPIO pins - * - * If the bit is set, it's an output from the FPGA. - * \param value is a 16-bit bitmask of values - * \param mask is a 16-bit bitmask of which bits to effect. - */ -void hal_gpio_set_ddr(int bank, int value, int mask); - -/*! - * \brief Select the source of the signal for an output pin. - * - * \param code is is one of 's', 'a', '0', '1' - * where 's' selects software output, 'a' selects ATR output, '0' selects - * debug 0, '1' selects debug 1. - */ -void hal_gpio_set_sel(int bank, int bitno, char code); - -/*! - * \brief Select the source of the signal for the output pins. - * - * \param codes is is a string of 16 characters composed of '.', 's', - * 'a', '0', or '1' where '.' means "don't change", 's' selects - * software output, 'a' selects ATR output, '0' selects debug 0, '1' - * selects debug 1. - */ -void hal_gpio_set_sels(int bank, char *codes); - - -/*! - * \brief write \p value to gpio pins specified by \p mask. - */ -void hal_gpio_write(int bank, int value, int mask); - -/*! - * \brief read GPIO bits - */ -int hal_gpio_read(int bank); - - -/* - * ------------------------------------------------------------------------ - * control the leds - * - * Low 4-bits are the general purpose leds on the board - * The next bit is the led on the ethernet connector - * ------------------------------------------------------------------------ - */ - -void hal_set_leds(int value, int mask); -void hal_set_led_src(int value, int mask); -void hal_toggle_leds(int mask); - -/* - * ------------------------------------------------------------------------ - * simple timeouts - * ------------------------------------------------------------------------ - */ - - - -static inline void -hal_set_timeout(int delta_ticks) -{ - int t = timer_regs->time + delta_ticks; - if (t == 0) // kills timer - t = 1; - timer_regs->time = t; -} - -/* - * ------------------------------------------------------------------------ - * interrupt enable/disable - * ------------------------------------------------------------------------ - */ - -/*! - * \brief Disable interrupts and return previous interrupt enable state. - * [Microblaze specific] - */ -static inline int -hal_disable_ints(void) -{ - int result, t0; - - asm volatile("mfs %0, rmsr \n\ - andni %1, %0, 0x2 \n\ - mts rmsr, %1" - : "=r" (result), "=r" (t0)); - return result; -} - -/*! - * \brief Enable interrupts and return previous interrupt enable state. - * [Microblaze specific] - */ -static inline int -hal_enable_ints(void) -{ - int result, t0; - - asm volatile("mfs %0, rmsr \n\ - ori %1, %0, 0x2 \n\ - mts rmsr, %1" - : "=r" (result), "=r" (t0)); - return result; -} - -/*! - * \brief Set interrupt enable state to \p prev_state. - * [Microblaze specific] - */ -static inline void -hal_restore_ints(int prev_state) -{ - int t0, t1; - asm volatile("andi %0, %2, 0x2 \n\ - mfs %1, rmsr \n\ - andni %1, %1, 0x2 \n\ - or %1, %1, %0 \n\ - mts rmsr, %1" - : "=r" (t0), "=r"(t1) : "r" (prev_state)); -} - -#endif /* INCLUDED_HAL_IO_H */ diff --git a/usrp2/firmware/lib/hal_uart.c b/usrp2/firmware/lib/hal_uart.c deleted file mode 100644 index 75b12b432..000000000 --- a/usrp2/firmware/lib/hal_uart.c +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- c -*- */ -/* - * Copyright 2007,2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#include "hal_uart.h" -#include "hal_io.h" -#include "memory_map.h" - -// First pass, no interrupts - -// Replaced with divisors.py which generates best divisor -//#define CALC_DIVISOR(rate) (WISHBONE_CLK_RATE / ((rate) * 16)) - -#define NSPEEDS 6 -#define MAX_WB_DIV 4 - -static const uint16_t -divisor_table[MAX_WB_DIV+1][NSPEEDS] = { - { 2, 2, 2, 2, 2, 2}, // 0: can't happen - { 651, 326, 163, 109, 54, 27 }, // 1: 100 MHz - { 326, 163, 81, 54, 27, 14 }, // 2: 50 MHz - { 217, 109, 54, 36, 18, 9 }, // 3: 33.3333 MHz - { 163, 81, 41, 27, 14, 7 }, // 4: 25 MHz -}; - -#define u uart_regs - -void -hal_uart_init(void) -{ - u->clkdiv = 217; // 230400 bps -} - -void -hal_uart_putc(int ch) -{ - if (ch == '\n') // FIXME for now map \n -> \r\n - hal_uart_putc('\r'); - - while (u->txlevel == 0) // wait for fifo to have space - ; - - u->txchar = ch; -} - -void -hal_uart_putc_nowait(int ch) -{ - if (ch == '\n') // FIXME for now map \n -> \r\n - hal_uart_putc('\r'); - - if(u->txlevel) // If fifo has space - u->txchar = ch; -} - -int -hal_uart_getc(void) -{ - while ((u->rxlevel) == 0) // wait for data to be ready - ; - - return u->rxchar; -} diff --git a/usrp2/firmware/lib/hal_uart.h b/usrp2/firmware/lib/hal_uart.h deleted file mode 100644 index 2ddfa6259..000000000 --- a/usrp2/firmware/lib/hal_uart.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- c -*- */ -/* - * Copyright 2007,2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifndef INCLUDED_HAL_UART_H -#define INCLUDED_HAL_UART_H - - -/*! - * \brief one-time call to init - */ -void hal_uart_init(void); - -typedef enum { - US_9600, - US_19200, - US_38400, - US_57600, - US_115200, - US_230400, -} hal_uart_speed_t; - -typedef struct { - hal_uart_speed_t speed; -} hal_uart_config_t; - -/*! - * \brief Set uart parameters - * Default is 115,200 bps, 8N1. - */ -void hal_uart_set_config(const hal_uart_config_t *c); - -/*! - * \brief Get uart configuation. - */ -void hal_uart_get_config(hal_uart_config_t *c); - -/*! - * \brief Enqueue \p ch for output over serial port - */ -void hal_uart_putc(int ch); - -/*! - * \brief Enqueue \p ch for output over serial port, silent fail if queue is full - */ -void hal_uart_putc_nowait(int ch); - -/* - * \brief Blocking read of next char from serial port - */ -int hal_uart_getc(void); - - -#endif /* INCLUDED_HAL_UART_H */ diff --git a/usrp2/firmware/lib/i2c.c b/usrp2/firmware/lib/i2c.c deleted file mode 100644 index 3f738733b..000000000 --- a/usrp2/firmware/lib/i2c.c +++ /dev/null @@ -1,127 +0,0 @@ -/* -*- c -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#include "i2c.h" -#include "memory_map.h" -#include "stdint.h" - -#define MAX_WB_DIV 4 // maximum wishbone divisor (from 100 MHz MASTER_CLK) - -// prescaler divisor values for 100 kHz I2C [uses 5 * SCLK internally] - -#define PRESCALER(wb_div) (((MASTER_CLK_RATE/(wb_div)) / (5 * 100000)) - 1) - -static uint16_t prescaler_values[MAX_WB_DIV+1] = { - 0xffff, // 0: can't happen - PRESCALER(1), // 1: 100 MHz - PRESCALER(2), // 2: 50 MHz - PRESCALER(3), // 3: 33.333 MHz - PRESCALER(4), // 4: 25 MHz -}; - -void -i2c_init(void) -{ - i2c_regs->ctrl = 0; // disable core - - // setup prescaler depending on wishbone divisor - int wb_div = hwconfig_wishbone_divisor(); - if (wb_div > MAX_WB_DIV) - wb_div = MAX_WB_DIV; - - i2c_regs->prescaler_lo = prescaler_values[wb_div] & 0xff; - i2c_regs->prescaler_hi = (prescaler_values[wb_div] >> 8) & 0xff; - - i2c_regs->ctrl = I2C_CTRL_EN; // enable core - - // FIXME interrupt driven? -} - -static inline void -wait_for_xfer(void) -{ - while (i2c_regs->cmd_status & I2C_ST_TIP) // wait for xfer to complete - ; -} - -static inline bool -wait_chk_ack(void) -{ - wait_for_xfer(); - - if ((i2c_regs->cmd_status & I2C_ST_RXACK) != 0){ // target NAK'd - return false; - } - return true; -} - -bool -i2c_read (unsigned char i2c_addr, unsigned char *buf, unsigned int len) -{ - if (len == 0) // reading zero bytes always works - return true; - - while (i2c_regs->cmd_status & I2C_ST_BUSY) - ; - - i2c_regs->data = (i2c_addr << 1) | 1; // 7 bit address and read bit (1) - // generate START and write addr - i2c_regs->cmd_status = I2C_CMD_WR | I2C_CMD_START; - if (!wait_chk_ack()) - goto fail; - - for (; len > 0; buf++, len--){ - i2c_regs->cmd_status = I2C_CMD_RD | (len == 1 ? (I2C_CMD_NACK | I2C_CMD_STOP) : 0); - wait_for_xfer(); - *buf = i2c_regs->data; - } - return true; - - fail: - i2c_regs->cmd_status = I2C_CMD_STOP; // generate STOP - return false; -} - - -bool -i2c_write(unsigned char i2c_addr, const unsigned char *buf, unsigned int len) -{ - while (i2c_regs->cmd_status & I2C_ST_BUSY) - ; - - i2c_regs->data = (i2c_addr << 1) | 0; // 7 bit address and write bit (0) - - // generate START and write addr (and maybe STOP) - i2c_regs->cmd_status = I2C_CMD_WR | I2C_CMD_START | (len == 0 ? I2C_CMD_STOP : 0); - if (!wait_chk_ack()) - goto fail; - - for (; len > 0; buf++, len--){ - i2c_regs->data = *buf; - i2c_regs->cmd_status = I2C_CMD_WR | (len == 1 ? I2C_CMD_STOP : 0); - if (!wait_chk_ack()) - goto fail; - } - return true; - - fail: - i2c_regs->cmd_status = I2C_CMD_STOP; // generate STOP - return false; -} - - diff --git a/usrp2/firmware/lib/i2c.h b/usrp2/firmware/lib/i2c.h deleted file mode 100644 index ad1e4159a..000000000 --- a/usrp2/firmware/lib/i2c.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- c -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifndef INCLUDED_I2C_H -#define INCLUDED_I2C_H - -#include "bool.h" - -void i2c_init(void); -bool i2c_read (unsigned char i2c_addr, unsigned char *buf, unsigned int len); -bool i2c_write(unsigned char i2c_addr, const unsigned char *buf, unsigned int len); - - -// Write 24LC024 / 24LC025 EEPROM on motherboard or daughterboard. -// Which EEPROM is determined by i2c_addr. See i2c_addr.h - -bool eeprom_write (int i2c_addr, int eeprom_offset, const void *buf, int len); - -// Read 24LC024 / 24LC025 EEPROM on motherboard or daughterboard. -// Which EEPROM is determined by i2c_addr. See i2c_addr.h - -bool eeprom_read (int i2c_addr, int eeprom_offset, void *buf, int len); - -#endif /* INCLUDED_I2C_H */ diff --git a/usrp2/firmware/lib/lsadc.c b/usrp2/firmware/lib/lsadc.c deleted file mode 100644 index 7983552e7..000000000 --- a/usrp2/firmware/lib/lsadc.c +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#include "lsadc.h" -#include "spi.h" -#include "memory_map.h" - - -// AD9712 or AD7922 1 MS/s, 10-/12-bit ADCs - -//#define SPI_SS_DEBUG SPI_SS_RX_DB -#define SPI_SS_DEBUG 0 - - -void -lsadc_init(void) -{ - // nop -} - -/* - * The ADC's are pipelined. That is, you have to tell them - * which of the two inputs you want one cycle ahead of time. - * We could optimize and keep track of which one we used last - * time, but for simplicity we'll always tell it which - * one we want. This takes 2 16-bit xfers, one to set the - * input and one to read the one we want. - */ - -int -_lsadc_read(int which_adc, int slave_select) -{ - uint32_t r; - int channel = which_adc & 0x1; - - // Set CHN and STY equal to channel number. We don't want "daisy chain mode" - uint16_t cmd = (channel << 13) | (channel << 12); - - spi_transact(SPI_TXONLY, slave_select | SPI_SS_DEBUG, - cmd, 16, SPIF_PUSH_RISE | SPIF_LATCH_RISE); - - r = spi_transact(SPI_TXRX, slave_select | SPI_SS_DEBUG, - cmd, 16, SPIF_PUSH_RISE | SPIF_LATCH_RISE); - - return r & 0x0fff; -} - -int -lsadc_read_rx(int which_adc) -{ - return _lsadc_read(which_adc, SPI_SS_RX_ADC); -} - -int -lsadc_read_tx(int which_adc) -{ - return _lsadc_read(which_adc, SPI_SS_TX_ADC); -} diff --git a/usrp2/firmware/lib/lsadc.h b/usrp2/firmware/lib/lsadc.h deleted file mode 100644 index 319f34d91..000000000 --- a/usrp2/firmware/lib/lsadc.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ -#ifndef INCLUDED_LSADC_H -#define INCLUDED_LSADC_H - -#include "memory_map.h" - -/*! - * \brief One time call to initialize low-speed ADCs. - */ -void lsadc_init(void); - -/*! - * \brief Read one of the low-speed Rx daughterboard ADCs. - * \param which_adc in [0, 1] - * - * \returns 12-bit value in [0,4095] - */ -int lsadc_read_rx(int which_adc); - -/*! - * \brief Read one of the low-speed Tx daughterboard ADCs. - * \param which_adc in [0, 1] - * - * \returns 12-bit value in [0,4095] - */ -int lsadc_read_tx(int which_adc); - - -#endif /* INCLUDED_LSADC_H */ diff --git a/usrp2/firmware/lib/lsdac.c b/usrp2/firmware/lib/lsdac.c deleted file mode 100644 index 6bc2e5cb5..000000000 --- a/usrp2/firmware/lib/lsdac.c +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#include "lsdac.h" -#include "spi.h" -#include "memory_map.h" - -// AD5624, AD5623 - -#define CMD(x) ((x) << 19) -#define CMD_WR_INPUT_N CMD(0) // write input N -#define CMD_UP_DAC_N CMD(1) // update DAC N from input reg -#define CMD_WR_INPUT_N_LDAC CMD(2) // write input N, update all -#define CMD_WR_UP_DAC_N CMD(3) // write and update N -#define CMD_WR_PWR_CONFIG CMD(4) // write power up/down config reg -#define CMD_SW_RESET CMD(5) // force s/w reset -#define CMD_WR_LDAC_CFG CMD(6) // write LDAC config reg -#define CMD_WR_INT_REF_CFG CMD(7) // write internal ref cfg reg (AD5623R only) - - -//#define SPI_SS_DEBUG SPI_SS_TX_DB -#define SPI_SS_DEBUG 0 - -inline static void -_write_rx(uint32_t v) -{ - spi_transact(SPI_TXONLY, SPI_SS_RX_DAC | SPI_SS_DEBUG, v, 24, SPIF_PUSH_RISE); -} - -inline static void -_write_tx(uint32_t v) -{ - spi_transact(SPI_TXONLY, SPI_SS_TX_DAC | SPI_SS_DEBUG, v, 24, SPIF_PUSH_RISE); -} - -void -lsdac_init(void) -{ - _write_tx(CMD_SW_RESET | 0x1); // power-on reset - _write_rx(CMD_SW_RESET | 0x1); // power-on reset -} - -void -lsdac_write_rx(int which_dac, int value) -{ - _write_rx(CMD_WR_UP_DAC_N | ((which_dac & 0x7) << 16) | ((value << 4) & 0xffff)); -} - -void -lsdac_write_tx(int which_dac, int value) -{ - _write_tx(CMD_WR_UP_DAC_N | ((which_dac & 0x7) << 16) | ((value << 4) & 0xffff)); -} diff --git a/usrp2/firmware/lib/lsdac.h b/usrp2/firmware/lib/lsdac.h deleted file mode 100644 index 9cad917e3..000000000 --- a/usrp2/firmware/lib/lsdac.h +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ -#ifndef INCLUDED_LSDAC_H -#define INCLUDED_LSDAC_H - -#include "memory_map.h" - -/*! - * \brief One time call to initialize low-speed DACs. - */ -void lsdac_init(void); - -/*! - * \brief Write one of the low-speed Rx daughterboard DACs. - * \param which_dac in [0, 3] - * \param unsigned 12-bit value in [0, 4095] - * - * value maps linearly to output voltage from 0 to 3.3V - */ -void lsdac_write_rx(int which_dac, int value); - -/*! - * \brief Write one of the low-speed Tx daughterboard DACs. - * \param which_dac in [0, 3] - * \param unsigned 12-bit value in [0, 4095] - * - * value maps linearly to output voltage from 0 to 3.3V - */ -void lsdac_write_tx(int which_dac, int value); - - -#endif /* INCLUDED_LSDAC_H */ diff --git a/usrp2/firmware/lib/mdelay.c b/usrp2/firmware/lib/mdelay.c deleted file mode 100644 index c8c119b1a..000000000 --- a/usrp2/firmware/lib/mdelay.c +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- c -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#include "mdelay.h" -#include "memory_map.h" - -// Delay about one millisecond. -// -// Need 33,333 cycles at 33 MHz. -// Each time around the loop is 10 cycles -// - -#define LOOPCNT(wb_div) (MASTER_CLK_RATE/(wb_div) / 10000) - -inline static void -delay_1ms(int loop_count) -{ - int i; - for (i = 0; i < loop_count; i++){ - asm volatile ("or r0, r0, r0\n\ - or r0, r0, r0\n\ - or r0, r0, r0\n\ - or r0, r0, r0\n\ - or r0, r0, r0\n\ - or r0, r0, r0\n\ - or r0, r0, r0\n"); - } -} - -// delay about ms milliseconds -void -mdelay(int ms) -{ - static int loop_count = -1; - - if (hwconfig_simulation_p()) - return; - - if (loop_count < 0){ - // set correct loop_count - static unsigned short lc[8] = { - 0, - LOOPCNT(1), - LOOPCNT(2), - LOOPCNT(3), - LOOPCNT(4), - LOOPCNT(5), - LOOPCNT(6), - LOOPCNT(7) - }; - - loop_count = lc[hwconfig_wishbone_divisor() & 0x7]; - } - - int i; - for (i = 0; i < ms; i++) - delay_1ms(loop_count); -} diff --git a/usrp2/firmware/lib/mdelay.h b/usrp2/firmware/lib/mdelay.h deleted file mode 100644 index 226bbb3f7..000000000 --- a/usrp2/firmware/lib/mdelay.h +++ /dev/null @@ -1,29 +0,0 @@ -/* -*- c -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifndef INCLUDED_MDELAY_H -#define INCLUDED_MDELAY_H - -/*! - * \brief Delay about ms milliseconds - * - * If simulating, _very_ short delay - */ -void mdelay(int ms); - -#endif /* INCLUDED_MDELAY_H */ diff --git a/usrp2/firmware/lib/memcpy_wa.c b/usrp2/firmware/lib/memcpy_wa.c deleted file mode 100644 index ef20efaa9..000000000 --- a/usrp2/firmware/lib/memcpy_wa.c +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#include "memcpy_wa.h" -#include <stdint.h> -#include <stdlib.h> - -/* - * For copying to/from non-byte-adressable memory, such as - * the buffers. dst, src, and nbytes must all satisfy (x % 4 == 0) - */ -void -memcpy_wa(void *dst, const void *src, size_t nbytes) -{ - if (((intptr_t) dst & 0x3) - || ((intptr_t) src & 0x3) - || (nbytes & 0x3)) - exit(1); /* die! */ - - int *dp = (int *) dst; - int *sp = (int *) src; - unsigned nw = nbytes/4; - - unsigned i; - for (i = 0; i < nw; i++) - dp[i] = sp[i]; -} diff --git a/usrp2/firmware/lib/memcpy_wa.h b/usrp2/firmware/lib/memcpy_wa.h deleted file mode 100644 index 072fc148f..000000000 --- a/usrp2/firmware/lib/memcpy_wa.h +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifndef INCLUDED_MEMCPY_WA_H -#define INCLUDED_MEMCPY_WA_H - -#include <stddef.h> - -/* - * For copying to/from non-byte-adressable memory, such as - * the buffers. dst, src, and nbytes must all satisfy (x % 4 == 0) - */ -void memcpy_wa(void *dst, const void *src, size_t nbytes); - -#endif /* INCLUDED_MEMCPY_WA_H */ - - diff --git a/usrp2/firmware/lib/memory_map.h b/usrp2/firmware/lib/memory_map.h deleted file mode 100644 index 0d0cf04f6..000000000 --- a/usrp2/firmware/lib/memory_map.h +++ /dev/null @@ -1,723 +0,0 @@ -/* -*- c -*- */ -/* - * Copyright 2007,2008,2009 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -/* Overall Memory Map - * 0000-7FFF 32K RAM space (16K on 1500, 24K on 2000, 32K on DSP) - * 8000-BFFF 16K Buffer Pool - * C000-FFFF 16K Peripherals - */ - - -#ifndef INCLUDED_MEMORY_MAP_H -#define INCLUDED_MEMORY_MAP_H - -#include <stdint.h> - - -#define MASTER_CLK_RATE 100000000 // 100 MHz - - -//////////////////////////////////////////////////////////////// -// -// Memory map for embedded wishbone bus -// -//////////////////////////////////////////////////////////////// - - -//////////////////////////////////////////////////////////////// -// Main RAM, Slave 0 - -#define RAM_BASE 0x0000 - -//////////////////////////////////////////////////////////////// -// Buffer Pool RAM, Slave 1 -// -// The buffers themselves are located in Slave 1, Buffer Pool RAM. -// The status registers are in Slave 5, Buffer Pool Status. -// The control register is in Slave 7, Settings Bus. - -#define BUFFER_POOL_RAM_BASE 0x8000 - -#define NBUFFERS 8 -#define BP_NLINES 0x0200 // number of 32-bit lines in a buffer -#define BP_LAST_LINE (BP_NLINES - 1) // last line in a buffer - -#define buffer_pool_ram \ - ((uint32_t *) BUFFER_POOL_RAM_BASE) - -#define buffer_ram(n) (&buffer_pool_ram[(n) * BP_NLINES]) - - -///////////////////////////////////////////////////// -// SPI Core, Slave 2. See core docs for more info -#define SPI_BASE 0xC000 // Base address (16-bit) - -typedef struct { - volatile uint32_t txrx0; - volatile uint32_t txrx1; - volatile uint32_t txrx2; - volatile uint32_t txrx3; - volatile uint32_t ctrl; - volatile uint32_t div; - volatile uint32_t ss; -} spi_regs_t; - -#define spi_regs ((spi_regs_t *) SPI_BASE) - - -// Masks for controlling different peripherals -#define SPI_SS_AD9510 1 -#define SPI_SS_AD9777 2 -#define SPI_SS_RX_DAC 4 -#define SPI_SS_RX_ADC 8 -#define SPI_SS_RX_DB 16 -#define SPI_SS_TX_DAC 32 -#define SPI_SS_TX_ADC 64 -#define SPI_SS_TX_DB 128 - -// Masks for different parts of CTRL reg -#define SPI_CTRL_ASS (1<<13) -#define SPI_CTRL_IE (1<<12) -#define SPI_CTRL_LSB (1<<11) -#define SPI_CTRL_TXNEG (1<<10) -#define SPI_CTRL_RXNEG (1<< 9) -#define SPI_CTRL_GO_BSY (1<< 8) -#define SPI_CTRL_CHAR_LEN_MASK 0x7F - -//////////////////////////////////////////////// -// I2C, Slave 3 -// See Wishbone I2C-Master Core Specification. - -#define I2C_BASE 0xC400 - -typedef struct { - volatile uint32_t prescaler_lo; // r/w - volatile uint32_t prescaler_hi; // r/w - volatile uint32_t ctrl; // r/w - volatile uint32_t data; // wr = transmit reg; rd = receive reg - volatile uint32_t cmd_status; // wr = command reg; rd = status reg -} i2c_regs_t; - -#define i2c_regs ((i2c_regs_t *) I2C_BASE) - -#define I2C_CTRL_EN (1 << 7) // core enable -#define I2C_CTRL_IE (1 << 6) // interrupt enable - -// -// STA, STO, RD, WR, and IACK bits are cleared automatically -// -#define I2C_CMD_START (1 << 7) // generate (repeated) start condition -#define I2C_CMD_STOP (1 << 6) // generate stop condition -#define I2C_CMD_RD (1 << 5) // read from slave -#define I2C_CMD_WR (1 << 4) // write to slave -#define I2C_CMD_NACK (1 << 3) // when a rcvr, send ACK (ACK=0) or NACK (ACK=1) -#define I2C_CMD_RSVD_2 (1 << 2) // reserved -#define I2C_CMD_RSVD_1 (1 << 1) // reserved -#define I2C_CMD_IACK (1 << 0) // set to clear pending interrupt - -#define I2C_ST_RXACK (1 << 7) // Received acknowledgement from slave (1 = NAK, 0 = ACK) -#define I2C_ST_BUSY (1 << 6) // 1 after START signal detected; 0 after STOP signal detected -#define I2C_ST_AL (1 << 5) // Arbitration lost. 1 when core lost arbitration -#define I2C_ST_RSVD_4 (1 << 4) // reserved -#define I2C_ST_RSVD_3 (1 << 3) // reserved -#define I2C_ST_RSVD_2 (1 << 2) // reserved -#define I2C_ST_TIP (1 << 1) // Transfer-in-progress -#define I2C_ST_IP (1 << 0) // Interrupt pending - - -//////////////////////////////////////////////// -// GPIO, Slave 4 -// -// These go to the daughterboard i/o pins - -#define GPIO_BASE 0xC800 - -typedef struct { - volatile uint32_t io; // tx data in high 16, rx in low 16 - volatile uint32_t ddr; // 32 bits, 1 means output. tx in high 16, rx in low 16 - volatile uint32_t tx_sel; // 16 2-bit fields select which source goes to TX DB - volatile uint32_t rx_sel; // 16 2-bit fields select which source goes to RX DB -} gpio_regs_t; - -// each 2-bit sel field is layed out this way -#define GPIO_SEL_SW 0 // if pin is an output, set by software in the io reg -#define GPIO_SEL_ATR 1 // if pin is an output, set by ATR logic -#define GPIO_SEL_DEBUG_0 2 // if pin is an output, debug lines from FPGA fabric -#define GPIO_SEL_DEBUG_1 3 // if pin is an output, debug lines from FPGA fabric - -#define gpio_base ((gpio_regs_t *) GPIO_BASE) - -/////////////////////////////////////////////////// -// Buffer Pool Status, Slave 5 -// -// The buffers themselves are located in Slave 1, Buffer Pool RAM. -// The status registers are in Slave 5, Buffer Pool Status. -// The control register is in Slave 7, Settings Bus. - -#define BUFFER_POOL_STATUS_BASE 0xCC00 - -typedef struct { - volatile uint32_t last_line[NBUFFERS]; // last line xfer'd in buffer - volatile uint32_t status; // error and done flags - volatile uint32_t hw_config; // see below - volatile uint32_t dummy[3]; - volatile uint32_t irqs; - volatile uint32_t pri_enc_bp_status; - volatile uint32_t cycle_count; -} buffer_pool_status_t; - -#define buffer_pool_status ((buffer_pool_status_t *) BUFFER_POOL_STATUS_BASE) - -/* - * Buffer n's xfer is done. - * Clear this bit by issuing bp_clear_buf(n) - */ -#define BPS_DONE(n) (0x00000001 << (n)) -#define BPS_DONE_0 BPS_DONE(0) -#define BPS_DONE_1 BPS_DONE(1) -#define BPS_DONE_2 BPS_DONE(2) -#define BPS_DONE_3 BPS_DONE(3) -#define BPS_DONE_4 BPS_DONE(4) -#define BPS_DONE_5 BPS_DONE(5) -#define BPS_DONE_6 BPS_DONE(6) -#define BPS_DONE_7 BPS_DONE(7) - -/* - * Buffer n's xfer had an error. - * Clear this bit by issuing bp_clear_buf(n) - */ -#define BPS_ERROR(n) (0x00000100 << (n)) -#define BPS_ERROR_0 BPS_ERROR(0) -#define BPS_ERROR_1 BPS_ERROR(1) -#define BPS_ERROR_2 BPS_ERROR(2) -#define BPS_ERROR_3 BPS_ERROR(3) -#define BPS_ERROR_4 BPS_ERROR(4) -#define BPS_ERROR_5 BPS_ERROR(5) -#define BPS_ERROR_6 BPS_ERROR(6) -#define BPS_ERROR_7 BPS_ERROR(7) - -/* - * Buffer n is idle. A buffer is idle if it's not - * DONE, ERROR, or processing a transaction. If it's - * IDLE, it's safe to start a new transaction. - * - * Clear this bit by starting a xfer with - * bp_send_from_buf or bp_receive_to_buf. - */ -#define BPS_IDLE(n) (0x00010000 << (n)) -#define BPS_IDLE_0 BPS_IDLE(0) -#define BPS_IDLE_1 BPS_IDLE(1) -#define BPS_IDLE_2 BPS_IDLE(2) -#define BPS_IDLE_3 BPS_IDLE(3) -#define BPS_IDLE_4 BPS_IDLE(4) -#define BPS_IDLE_5 BPS_IDLE(5) -#define BPS_IDLE_6 BPS_IDLE(6) -#define BPS_IDLE_7 BPS_IDLE(7) - -/* - * Buffer n has a "slow path" packet in it. - * This bit is orthogonal to the bits above and indicates that - * the FPGA ethernet rx protocol engine has identified this packet - * as one requiring firmware intervention. - */ -#define BPS_SLOWPATH(n) (0x01000000 << (n)) -#define BPS_SLOWPATH_0 BPS_SLOWPATH(0) -#define BPS_SLOWPATH_1 BPS_SLOWPATH(1) -#define BPS_SLOWPATH_2 BPS_SLOWPATH(2) -#define BPS_SLOWPATH_3 BPS_SLOWPATH(3) -#define BPS_SLOWPATH_4 BPS_SLOWPATH(4) -#define BPS_SLOWPATH_5 BPS_SLOWPATH(5) -#define BPS_SLOWPATH_6 BPS_SLOWPATH(6) -#define BPS_SLOWPATH_7 BPS_SLOWPATH(7) - - -#define BPS_DONE_ALL 0x000000ff // mask of all dones -#define BPS_ERROR_ALL 0x0000ff00 // mask of all errors -#define BPS_IDLE_ALL 0x00ff0000 // mask of all idles -#define BPS_SLOWPATH_ALL 0xff000000 // mask of all slowpaths - -// The hw_config register - -#define HWC_SIMULATION 0x80000000 -#define HWC_WB_CLK_DIV_MASK 0x0000000f - -/*! - * \brief return non-zero if we're running under the simulator - */ -inline static int -hwconfig_simulation_p(void) -{ - return buffer_pool_status->hw_config & HWC_SIMULATION; -} - -/*! - * \brief Return Wishbone Clock divisor. - * The processor runs at the Wishbone Clock rate which is MASTER_CLK_RATE / divisor. - */ -inline static int -hwconfig_wishbone_divisor(void) -{ - return buffer_pool_status->hw_config & HWC_WB_CLK_DIV_MASK; -} - -/////////////////////////////////////////////////// -// Ethernet Core, Slave 6 - -#define ETH_BASE 0xD000 - -#include "eth_mac_regs.h" - -#define eth_mac ((eth_mac_regs_t *) ETH_BASE) - -//////////////////////////////////////////////////// -// Settings Bus, Slave #7, Not Byte Addressable! -// -// Output-only from processor point-of-view. -// 1KB of address space (== 256 32-bit write-only regs) - - -#define MISC_OUTPUT_BASE 0xD400 -#define TX_PROTOCOL_ENGINE_BASE 0xD480 -#define RX_PROTOCOL_ENGINE_BASE 0xD4C0 -#define BUFFER_POOL_CTRL_BASE 0xD500 -#define DSP_TX_BASE 0xD600 -#define DSP_RX_BASE 0xD680 - -#define LAST_SETTING_REG 0xD7FC // last valid setting register - -// --- buffer pool control regs --- - -typedef struct { - volatile uint32_t ctrl; -} buffer_pool_ctrl_t; - -// buffer pool ports - -#define PORT_SERDES 0 // serial/deserializer -#define PORT_DSP 1 // DSP tx or rx pipeline -#define PORT_ETH 2 // ethernet tx or rx -#define PORT_RAM 3 // RAM tx or rx - -// the buffer pool ctrl register fields - -#define BPC_BUFFER(n) (((n) & 0xf) << 28) -#define BPC_BUFFER_MASK BPC_BUFFER(~0) -#define BPC_BUFFER_0 BPC_BUFFER(0) -#define BPC_BUFFER_1 BPC_BUFFER(1) -#define BPC_BUFFER_2 BPC_BUFFER(2) -#define BPC_BUFFER_3 BPC_BUFFER(3) -#define BPC_BUFFER_4 BPC_BUFFER(4) -#define BPC_BUFFER_5 BPC_BUFFER(5) -#define BPC_BUFFER_6 BPC_BUFFER(6) -#define BPC_BUFFER_7 BPC_BUFFER(7) -#define BPC_BUFFER_NIL BPC_BUFFER(0x8) // disable - -#define BPC_PORT(n) (((n) & 0x7) << 25) -#define BPC_PORT_MASK BPC_PORT(~0) -#define BPC_PORT_SERDES BPC_PORT(PORT_SERDES) -#define BPC_PORT_DSP BPC_PORT(PORT_DSP) -#define BPC_PORT_ETH BPC_PORT(PORT_ETH) -#define BPC_PORT_RAM BPC_PORT(PORT_RAM) -#define BPC_PORT_NIL BPC_PORT(0x4) // disable - -#define BPC_CLR (1 << 24) // mutually excl commands -#define BPC_READ (1 << 23) -#define BPC_WRITE (1 << 22) - -#define BPC_STEP(step) (((step) & 0xf) << 18) -#define BPC_STEP_MASK BPC_STEP(~0) -#define BPC_LAST_LINE(line) (((line) & 0x1ff) << 9) -#define BPC_LAST_LINE_MASK BPC_LAST_LINE(~0) -#define BPC_FIRST_LINE(line) (((line) & 0x1ff) << 0) -#define BPC_FIRST_LINE_MASK BPC_FIRST_LINE(~0) - -#define buffer_pool_ctrl ((buffer_pool_ctrl_t *) BUFFER_POOL_CTRL_BASE) - -// --- misc outputs --- - -typedef struct { - volatile uint32_t clk_ctrl; - volatile uint32_t serdes_ctrl; - volatile uint32_t adc_ctrl; - volatile uint32_t leds; - volatile uint32_t phy_ctrl; // LSB is reset line to eth phy - volatile uint32_t debug_mux_ctrl; - volatile uint32_t ram_page; // FIXME should go somewhere else... - volatile uint32_t flush_icache; // Flush the icache - volatile uint32_t led_src; // HW or SW control for LEDs -} output_regs_t; - -#define SERDES_ENABLE 8 -#define SERDES_PRBSEN 4 -#define SERDES_LOOPEN 2 -#define SERDES_RXEN 1 - -#define ADC_CTRL_ON 0x0F -#define ADC_CTRL_OFF 0x00 - -// crazy order that matches the labels on the case - -#define LED_A (1 << 4) -#define LED_B (1 << 1) -#define LED_C (1 << 3) -#define LED_D (1 << 0) -#define LED_E (1 << 2) -// LED_F // controlled by CPLD -#define LED_RJ45 (1 << 5) - -#define output_regs ((output_regs_t *) MISC_OUTPUT_BASE) - -// --- dsp tx regs --- - -#define MIN_CIC_INTERP 1 -#define MAX_CIC_INTERP 128 - -typedef struct { - volatile int32_t freq; - volatile uint32_t scale_iq; // {scale_i,scale_q} - volatile uint32_t interp_rate; - volatile uint32_t clear_state; // clears out state machine, fifos, - // NOT freq, scale, interp - /*! - * \brief output mux configuration. - * - * <pre> - * 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 - * +-------------------------------+-------+-------+-------+-------+ - * | | DAC1 | DAC0 | - * +-------------------------------+-------+-------+-------+-------+ - * - * There are N DUCs (1 now) with complex inputs and outputs. - * There are two DACs. - * - * Each 4-bit DACx field specifies the source for the DAC - * Each subfield is coded like this: - * - * 3 2 1 0 - * +-------+ - * | N | - * +-------+ - * - * N specifies which DUC output is connected to this DAC. - * - * N which interp output - * --- ------------------- - * 0 DUC 0 I - * 1 DUC 0 Q - * 2 DUC 1 I - * 3 DUC 1 Q - * F All Zeros - * - * The default value is 0x10 - * </pre> - */ - volatile uint32_t tx_mux; - -} dsp_tx_regs_t; - -#define dsp_tx_regs ((dsp_tx_regs_t *) DSP_TX_BASE) - -// --- dsp rx regs --- - -#define T_NOW (-1) - -#define MIN_CIC_DECIM 1 -#define MAX_CIC_DECIM 128 - -typedef struct { - volatile int32_t freq; - volatile uint32_t scale_iq; // {scale_i,scale_q} - volatile uint32_t decim_rate; - volatile uint32_t rx_time; // when to begin reception - volatile uint32_t rx_command; // {now, chain, num_lines(21), lines_per_frame(9) - volatile uint32_t clear_state; // clears out state machine, fifos, - // cmd queue, NOT freq, scale, decim - volatile uint32_t dcoffset_i; // Bit 31 high sets fixed offset mode, using lower 14 bits, - // otherwise it is automatic - volatile uint32_t dcoffset_q; // Bit 31 high sets fixed offset mode, using lower 14 bits - - /*! - * \brief input mux configuration. - * - * This determines which ADC (or constant zero) is connected to - * each DDC input. There are N DDCs (1 now). Each has two inputs. - * - * <pre> - * Mux value: - * - * 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 - * +-------+-------+-------+-------+-------+-------+-------+-------+ - * | |Q0 |I0 | - * +-------+-------+-------+-------+-------+-------+-------+-------+ - * - * Each 2-bit I field is either 00 (A/D A), 01 (A/D B) or 1X (const zero) - * Each 2-bit Q field is either 00 (A/D A), 01 (A/D B) or 1X (const zero) - * - * The default value is 0x4 - * </pre> - */ - volatile uint32_t rx_mux; // called adc_mux in dsp_core_rx.v - - /*! - * \brief Streaming GPIO configuration - * - * This determines whether the LSBs of I and Q samples come from the DSP - * pipeline or from the io_rx GPIO pins. To stream GPIO, one must first - * set the GPIO data direction register to have io_rx[15] and/or io_rx[14] - * configured as inputs. The GPIO pins will be sampled at the time the - * remainder of the DSP sample is strobed into the RX sample FIFO. There - * will be a decimation-dependent fixed time offset between the GPIO - * sample stream and the associated RF samples. - * - * 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 - * +-------+-------+-------+-------+-------+-------+-------+-------+ - * | MBZ |Q|I| - * +-------+-------+-------+-------+-------+-------+-------+-------+ - * - * I 0=LSB comes from DSP pipeline (default) - * 1=LSB comes from io_rx[15] - * - * Q 0=LSB comes from DSP pipeline (default) - * 1=LSB comes from io_rx[14] - */ - volatile uint32_t gpio_stream_enable; - -} dsp_rx_regs_t; - -#define dsp_rx_regs ((dsp_rx_regs_t *) DSP_RX_BASE) - -#define MK_RX_CMD(num_lines, lines_per_frame, now, chain) \ - (((num_lines) << 9) | ((lines_per_frame) & 0x1ff) \ - | (((now) & 0x1) << 31) | (((chain) & 0x1) << 30)) - -/* - * --- ethernet tx protocol engine regs (write only) --- - * - * These registers control the transmit portion of the ethernet - * protocol engine (out of USRP2). The protocol engine handles fifo - * status and sequence number insertion in outgoing packets, and - * automagically generates status packets when required to inform the - * host of changes in fifo availability. - * - * All outgoing packets have their fifo_status field set to the number - * of 32-bit lines of fifo available in the ethernet Rx fifo (see - * usrp2_eth_packet.h). Seqno's are set if FIXME, else 0. - * - * FIXME clean this up once we know how it's supposed to behave. - */ - -typedef struct { - volatile uint32_t flags; // not yet fully defined (channel?) - volatile uint32_t mac_dst0123; // 4 bytes of destination mac addr - volatile uint32_t mac_dst45src01; // 2 bytes of dest mac addr; 2 bytes of src mac addr - volatile uint32_t mac_src2345; // 4 bytes of destination mac addr - volatile uint32_t seqno; // Write to init seqno. It autoincs on match -} tx_proto_engine_regs_t; - -#define tx_proto_engine ((tx_proto_engine_regs_t *) TX_PROTOCOL_ENGINE_BASE) - -/* - * --- ethernet rx protocol engine regs (write only) --- - * - * These registers control the receive portion of the ethernet - * protocol engine (into USRP2). The protocol engine offloads common - * packet inspection operations so that firmware has less to do on - * "fast path" packets. - * - * The registers define conditions which must be matched for a packet - * to be considered a "fast path" packet. If a received packet - * matches the src and dst mac address, ethertype, flags field, and - * expected seqno number it is considered a "fast path" packet, and - * the expected seqno is updated. If the packet fails to satisfy any - * of the above conditions it's a "slow path" packet, and the - * corresponding SLOWPATH flag will be set buffer_status register. - */ - -typedef struct { - volatile uint32_t flags; // not yet fully defined (channel?) - volatile uint32_t mac_dst0123; // 4 bytes of destination mac addr - volatile uint32_t mac_dst45src01; // 2 bytes of dest mac addr; 2 bytes of src mac addr - volatile uint32_t mac_src2345; // 4 bytes of destination mac addr - volatile uint32_t ethertype_pad; // ethertype in high 16-bits -} rx_proto_engine_regs_t; - -#define rx_proto_engine ((rx_proto_engine_regs_t *) RX_PROTOCOL_ENGINE_BASE) - - - -/////////////////////////////////////////////////// -// Simple Programmable Interrupt Controller, Slave 8 - -#define PIC_BASE 0xD800 - -// Interrupt request lines -// Bit numbers (LSB == 0) that correpond to interrupts into PIC - -#define IRQ_BUFFER 0 // buffer manager -#define IRQ_TIMER 1 -#define IRQ_SPI 2 -#define IRQ_I2C 3 -#define IRQ_PHY 4 // ethernet PHY -#define IRQ_UNDERRUN 5 -#define IRQ_OVERRUN 6 -#define IRQ_PPS 7 // pulse per second -#define IRQ_UART_RX 8 -#define IRQ_UART_TX 9 -#define IRQ_SERDES 10 -#define IRQ_CLKSTATUS 11 - -#define IRQ_TO_MASK(x) (1 << (x)) - -#define PIC_BUFFER_INT IRQ_TO_MASK(IRQ_BUFFER) -#define PIC_TIMER_INT IRQ_TO_MASK(IRQ_TIMER) -#define PIC_SPI_INT IRQ_TO_MASK(IRQ_SPI) -#define PIC_I2C_INT IRQ_TO_MASK(IRQ_I2C) -#define PIC_PHY_INT IRQ_TO_MASK(IRQ_PHY) -#define PIC_UNDERRUN_INT IRQ_TO_MASK(IRQ_UNDERRUN) -#define PIC_OVERRUN_INT IRQ_TO_MASK(IRQ_OVERRUN) -#define PIC_PPS_INT IRQ_TO_MASK(IRQ_PPS) -#define PIC_UART_RX_INT IRQ_TO_MASK(IRQ_UART_RX) -#define PIC_UART_TX_INT IRQ_TO_MASK(IRQ_UART_TX) -#define PIC_SERDES IRQ_TO_MASK(IRQ_SERDES) -#define PIC_CLKSTATUS IRQ_TO_MASK(IRQ_CLKSTATUS) - -typedef struct { - volatile uint32_t edge_enable; // mask: 1 -> edge triggered, 0 -> level - volatile uint32_t polarity; // mask: 1 -> rising edge - volatile uint32_t mask; // mask: 1 -> disabled - volatile uint32_t pending; // mask: 1 -> pending; write 1's to clear pending ints -} pic_regs_t; - -#define pic_regs ((pic_regs_t *) PIC_BASE) - -/////////////////////////////////////////////////// -// Timer, Slave 9 - -#define TIMER_BASE 0xDC00 - -typedef struct { - volatile uint32_t time; // R: current, W: set time to interrupt -} timer_regs_t; - -#define timer_regs ((timer_regs_t *) TIMER_BASE) - -/////////////////////////////////////////////////// -// UART, Slave 10 - -#define UART_BASE 0xE000 - -typedef struct { - // All elements are 8 bits except for clkdiv (16), but we use uint32 to make - // the hardware for decoding easier - volatile uint32_t clkdiv; // Set to 50e6 divided by baud rate (no x16 factor) - volatile uint32_t txlevel; // Number of spaces in the FIFO for writes - volatile uint32_t rxlevel; // Number of available elements in the FIFO for reads - volatile uint32_t txchar; // Write characters to be sent here - volatile uint32_t rxchar; // Read received characters here -} uart_regs_t; - -#define uart_regs ((uart_regs_t *) UART_BASE) - -/////////////////////////////////////////////////// -// ATR Controller, Slave 11 - -#define ATR_BASE 0xE400 - -typedef struct { - volatile uint32_t v[16]; -} atr_regs_t; - -#define ATR_IDLE 0x0 // indicies into v -#define ATR_TX 0x1 -#define ATR_RX 0x2 -#define ATR_FULL 0x3 - -#define atr_regs ((atr_regs_t *) ATR_BASE) - -/////////////////////////////////////////////////// -// Time Sync Controller, Slave 12 -#define TIMESYNC_BASE 0xE800 - -typedef struct { - /*! - * \brief Time sync configuration. - * - * <pre> - * - * 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 - * +-----------------------------------------------------+-+-+-+-+-+ - * | |T|G|X|I|S| - * +-----------------------------------------------------+-+-+-+-+-+ - * - * S - Tick source (0 = free run, 1 = pps, default=0) - * I - Tick interrupt enable (not implemented) - * X - Use external sync source (default=1) - * G - PPS edge selection (0=negedge, 1=posedge, default=0) - * T - Trigger sync every pps edge (default=0) - * - * </pre> - */ - volatile uint32_t tick_control; - volatile uint32_t tick_interval; - volatile uint32_t delta_time; - volatile uint32_t sync_on_next_pps; -} timesync_regs_t; - -#define timesync_regs ((timesync_regs_t *) TIMESYNC_BASE) - -#define TSC_SOURCE_PPS (1 << 0) -//#define TSC_SOURCE_FREE_RUN (0 << 0) -#define TSC_IENABLE (1 << 1) -#define TSC_EXTSYNC (1 << 2) -#define TSC_PPSEDGE_POS (1 << 3) -//#define TSC_PPSEDGE_NEG (0 << 3) -#define TSC_TRIGGER_EVERYPPS (1 << 4) -//#define TSC_TRIGGER_ONCE (0 << 4) - -/////////////////////////////////////////////////// -// SD Card SPI interface, Slave 13 -// All regs are 8 bits wide, but are accessed as if they are 32 bits - -#define SDSPI_BASE 0xEC00 - -typedef struct { - volatile uint32_t status; // Write a 1 or 0 for controlling CS - volatile uint32_t clkdiv; - volatile uint32_t send_dat; - volatile uint32_t receive_dat; -} sdspi_regs_t; - -#define sdspi_regs ((sdspi_regs_t *) SDSPI_BASE) - -/////////////////////////////////////////////////// -// External RAM interface, Slave 14 -// Pages are 1K. Page is 10 bits, set by a control register -// output_regs->ram_page - -#define EXTRAM_BASE 0xF000 -#define extram ((volatile uint32_t *) EXTRAM_BASE) - - -/////////////////////////////////////////////////// - -#endif - diff --git a/usrp2/firmware/lib/memset_wa.c b/usrp2/firmware/lib/memset_wa.c deleted file mode 100644 index da5da21ab..000000000 --- a/usrp2/firmware/lib/memset_wa.c +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#include "memset_wa.h" -#include <stdint.h> -#include <stdlib.h> - -/* - * For setting non-byte-adressable memory, such as - * the buffers. dst and nbytes must all satisfy (x % 4 == 0) - */ -void * -memset_wa(void *dst, int c, size_t nbytes) -{ - if (((intptr_t) dst & 0x3) - || (nbytes & 0x3)) - exit(1); /* die! */ - - int *dp = (int *) dst; - - c &= 0xff; - int v = (c << 24) | (c << 16) | (c << 8) | c; - unsigned nw = nbytes/4; - - unsigned i; - for (i = 0; i < nw; i++) - dp[i] = v; - - return dst; -} diff --git a/usrp2/firmware/lib/memset_wa.h b/usrp2/firmware/lib/memset_wa.h deleted file mode 100644 index 46d903d53..000000000 --- a/usrp2/firmware/lib/memset_wa.h +++ /dev/null @@ -1,27 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifndef INCLUDED_MEMSET_WA_H -#define INCLUDED_MEMSET_WA_H - -#include <stdlib.h> - -void *memset_wa(void *s, int c, size_t n); - - -#endif /* INCLUDED_MEMSET_WA_H */ diff --git a/usrp2/firmware/lib/microblaze.ld b/usrp2/firmware/lib/microblaze.ld deleted file mode 100644 index ef816cf2e..000000000 --- a/usrp2/firmware/lib/microblaze.ld +++ /dev/null @@ -1,163 +0,0 @@ -OUTPUT_FORMAT("elf32-microblaze", "", "") -/* SEARCH_DIR(/home/jwilliams/tmp/microblaze-toolchain-sources/release/lin/microblaze//lib);*/ - -ENTRY(_start) - -MEMORY { - flatmem : ORIGIN = 0x0, LENGTH = 0x00008000 /* 32KB */ -} - -SECTIONS -{ - _TEXT_START_ADDR = DEFINED(_TEXT_START_ADDR) ? _TEXT_START_ADDR : 0x50; - .vectors.reset 0x0 : { *(.vectors.reset) } > flatmem - .vectors.sw_exception 0x8 : { *(.vectors.sw_exception) } > flatmem - .vectors.interrupt 0x10 : { *(.vectors.interrupt) } > flatmem - .vectors.hw_exception 0x20 : { *(.vectors.hw_exception) } >flatmem - . = _TEXT_START_ADDR; - _ftext = .; - .text : { - *(.text) - *(.text.*) - *(.gnu.linkonce.t.*) - } > flatmem - _etext = .; - .init : { KEEP (*(.init)) } > flatmem =0 - .fini : { KEEP (*(.fini)) } > flatmem =0 - PROVIDE (__CTOR_LIST__ = .); - PROVIDE (___CTOR_LIST__ = .); - .ctors : - { - /* gcc uses crtbegin.o to find the start of - the constructors, so we make sure it is - first. Because this is a wildcard, it - doesn't matter if the user does not - actually link against crtbegin.o; the - linker won't look for a file to match a - wildcard. The wildcard also means that it - doesn't matter which directory crtbegin.o - is in. */ - KEEP (*crtbegin.o(.ctors)) - /* We don't want to include the .ctor section from - from the crtend.o file until after the sorted ctors. - The .ctor section from the crtend file contains the - end of ctors marker and it must be last */ - KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) - KEEP (*(SORT(.ctors.*))) - KEEP (*(.ctors)) - } > flatmem - PROVIDE (__CTOR_END__ = .); - PROVIDE (___CTOR_END__ = .); - PROVIDE (__DTOR_LIST__ = .); - PROVIDE (___DTOR_LIST__ = .); - .dtors : - { - KEEP (*crtbegin.o(.dtors)) - KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) - KEEP (*(SORT(.dtors.*))) - KEEP (*(.dtors)) - } > flatmem - PROVIDE (__DTOR_END__ = .); - PROVIDE (___DTOR_END__ = .); - . = ALIGN(4); - _frodata = . ; - .rodata : { - *(.rodata) - *(.gnu.linkonce.r.*) - CONSTRUCTORS; /* Is this needed? */ - } > flatmem - _erodata = .; - /* Alignments by 8 to ensure that _SDA2_BASE_ on a word boundary */ - /* Note that .sdata2 and .sbss2 must be contiguous */ - . = ALIGN(8); - _ssrw = .; - .sdata2 : { - *(.sdata2) - *(.gnu.linkonce.s2.*) - } > flatmem - . = ALIGN(4); - .sbss2 : { - PROVIDE (__sbss2_start = .); - *(.sbss2) - *(.gnu.linkonce.sb2.*) - PROVIDE (__sbss2_end = .); - } > flatmem - . = ALIGN(8); - _essrw = .; - _ssrw_size = _essrw - _ssrw; - PROVIDE (_SDA2_BASE_ = _ssrw + (_ssrw_size / 2 )); - . = ALIGN(4); - _fdata = .; - .data : { - *(.data) - *(.gnu.linkonce.d.*) - CONSTRUCTORS; /* Is this needed? */ - } > flatmem - _edata = . ; - /* Added to handle pic code */ - .got : { - *(.got) - } > flatmem - .got1 : { - *(.got1) - } > flatmem - .got2 : { - *(.got2) - } > flatmem - /* Added by Sathya to handle C++ exceptions */ - .eh_frame : { - *(.eh_frame) - } > flatmem - .jcr : { - *(.jcr) - } > flatmem - .gcc_except_table : { - *(.gcc_except_table) - } > flatmem - /* Alignments by 8 to ensure that _SDA_BASE_ on a word boundary */ - /* Note that .sdata and .sbss must be contiguous */ - . = ALIGN(8); - _ssro = .; - .sdata : { - *(.sdata) - *(.gnu.linkonce.s.*) - } > flatmem - . = ALIGN(4); - .sbss : { - PROVIDE (__sbss_start = .); - *(.sbss) - *(.gnu.linkonce.sb.*) - PROVIDE (__sbss_end = .); - } > flatmem - . = ALIGN(8); - _essro = .; - _ssro_size = _essro - _ssro; - PROVIDE (_SDA_BASE_ = _ssro + (_ssro_size / 2 )); - . = ALIGN(4); - _fbss = .; - .bss : { - PROVIDE (__bss_start = .); - *(.bss) - *(.gnu.linkonce.b.*) - *(COMMON) - . = ALIGN(4); - PROVIDE (__bss_end = .); - _heap = .; - _HEAP_SIZE = DEFINED(_HEAP_SIZE) ? _HEAP_SIZE : 0x0; - _STACK_SIZE = DEFINED(_STACK_SIZE) ? _STACK_SIZE : 0x800; - . += _HEAP_SIZE; - _heap_end = .; - . += _STACK_SIZE; - . = ALIGN(8); - _stack = .; - _end = .; - } > flatmem - .tdata : { - *(.tdata) - *(.gnu.linkonce.td.*) - } > flatmem - .tbss : { - *(.tbss) - *(.gnu.linkonce.tb.*) - } > flatmem -} diff --git a/usrp2/firmware/lib/nonstdio.c b/usrp2/firmware/lib/nonstdio.c deleted file mode 100644 index 1c991afee..000000000 --- a/usrp2/firmware/lib/nonstdio.c +++ /dev/null @@ -1,80 +0,0 @@ -/* -*- c -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#include <nonstdio.h> - -static const char hex[16] = "0123456789ABCDEF"; - -// %x -void -puthex4(unsigned long x) -{ - putchar(hex[x & 0xf]); -} - -// %02x -void -puthex8(unsigned long x) -{ - putchar(hex[(x >> 4) & 0xf]); - putchar(hex[x & 0xf]); -} - -// %04x -void -puthex16(unsigned long x) -{ - puthex8(x >> 8); - puthex8(x); -} - -// %08x -void -puthex32(unsigned long x) -{ - puthex16(x >> 16); - puthex16(x); -} - -void -puthex4_nl(unsigned long x) -{ - puthex4(x); - newline(); -} - -void -puthex8_nl(unsigned long x) -{ - puthex8(x); - newline(); -} - -void -puthex16_nl(unsigned long x) -{ - puthex16(x); - newline(); -} - -void -puthex32_nl(unsigned long x) -{ - puthex32(x); - newline(); -} diff --git a/usrp2/firmware/lib/nonstdio.h b/usrp2/firmware/lib/nonstdio.h deleted file mode 100644 index 3fd9e39bb..000000000 --- a/usrp2/firmware/lib/nonstdio.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- c -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifndef INCLUDED_NONSTDIO_H -#define INCLUDED_NONSTDIO_H - -#include <stdio.h> -#include <usrp2_types.h> -#include <stddef.h> - -void putstr(const char *s); // cf puts, no added newline -void puthex4(unsigned long x); // output 1 hex digit -void puthex8(unsigned long x); // output 2 hex digits -void puthex16(unsigned long x); // output 4 hex digits -void puthex32(unsigned long x); // output 8 hex digits -void puthex4_nl(unsigned long x); // ... followed by newline -void puthex8_nl(unsigned long x); -void puthex16_nl(unsigned long x); -void puthex32_nl(unsigned long x); -#define puthex puthex32 -#define puthex_nl puthex32_nl -void newline(); // putchar('\n') - -void print_mac_addr(const unsigned char addr[6]); -void print_fxpt_freq(u2_fxpt_freq_t v); -void print_fxpt_gain(u2_fxpt_gain_t v); -void print_uint64(uint64_t v); - -void print_buffer(uint32_t *buf, size_t n); - -#endif /* INCLUDED_NONSTDIO_H */ diff --git a/usrp2/firmware/lib/pic.c b/usrp2/firmware/lib/pic.c deleted file mode 100644 index 592a07aef..000000000 --- a/usrp2/firmware/lib/pic.c +++ /dev/null @@ -1,94 +0,0 @@ -/* -*- c -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#include "pic.h" -#include "hal_io.h" -#include "memory_map.h" - - -#define NVECTORS 8 - -/* - * Our secondary interrupt vector. - */ -irq_handler_t pic_vector[NVECTORS] = { - nop_handler, - nop_handler, - nop_handler, - nop_handler, - nop_handler, - nop_handler, - nop_handler, - nop_handler -}; - - -void -pic_init(void) -{ - // uP is level triggered - - pic_regs->mask = ~0; // mask all interrupts - pic_regs->edge_enable = PIC_TIMER_INT | PIC_PHY_INT; - pic_regs->polarity = ~0 & ~PIC_PHY_INT; // rising edge - pic_regs->pending = ~0; // clear all pending ints -} - -/* - * This magic gets pic_interrupt_handler wired into the - * system interrupt handler with the appropriate prologue and - * epilogue. - */ -void pic_interrupt_handler() __attribute__ ((interrupt_handler)); - -void pic_interrupt_handler() -{ - // pending and not masked interrupts - int live = pic_regs->pending & ~pic_regs->mask; - - // FIXME loop while there are interrupts to service. - // That will reduce our overhead. - - // handle the first one set - int i; - int mask; - for (i=0, mask=1; i < NVECTORS; i++, mask <<= 1){ - if (mask & live){ // handle this one - // puthex_nl(i); - (*pic_vector[i])(i); - pic_regs->pending = mask; // clear pending interrupt - return; - } - } -} - -void -pic_register_handler(unsigned irq, irq_handler_t handler) -{ - if (irq >= NVECTORS) - return; - pic_vector[irq] = handler; - - pic_regs->mask &= ~IRQ_TO_MASK(irq); -} - -void -nop_handler(unsigned irq) -{ - // nop -} diff --git a/usrp2/firmware/lib/pic.h b/usrp2/firmware/lib/pic.h deleted file mode 100644 index 68918f9ad..000000000 --- a/usrp2/firmware/lib/pic.h +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- c -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifndef INCLUDED_PIC_H -#define INCLUDED_PIC_H - -typedef void (*irq_handler_t)(unsigned irq); - -void pic_init(void); -void pic_register_handler(unsigned irq, irq_handler_t handler); - -void nop_handler(unsigned irq); // default handler does nothing - -// FIXME inline assembler -int pic_disable_interrupts(); -int pic_enable_interrupts(); -void pic_restore_interrupts(int prev_status); - - -#endif /* INCLUDED_PIC_H */ diff --git a/usrp2/firmware/lib/print_buffer.c b/usrp2/firmware/lib/print_buffer.c deleted file mode 100644 index 9f9104bb5..000000000 --- a/usrp2/firmware/lib/print_buffer.c +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ -#include <nonstdio.h> - -void -print_buffer(uint32_t *buf, size_t n) -{ - size_t i; - for (i = 0; i < n; i++){ - if (i % 4 == 0) - puthex16(i * 4); - - putchar(' '); - puthex32(buf[i]); - if (i % 4 == 3) - newline(); - } - - newline(); -} - diff --git a/usrp2/firmware/lib/print_fxpt.c b/usrp2/firmware/lib/print_fxpt.c deleted file mode 100644 index 185bbc51b..000000000 --- a/usrp2/firmware/lib/print_fxpt.c +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ -#include <nonstdio.h> - -/* - * print uint64_t - */ -void -print_uint64(uint64_t u) -{ - const char *_hex = "0123456789ABCDEF"; - if (u >= 10) - print_uint64(u/10); - putchar(_hex[u%10]); -} - -static void -print_thousandths(int thousandths) -{ - putchar('.'); - if (thousandths < 100) - putchar('0'); - if (thousandths < 10) - putchar('0'); - printf("%d", thousandths); -} - - -void -print_fxpt_freq(u2_fxpt_freq_t v) -{ - if (v < 0){ - v = -v; - putchar('-'); - } - - int64_t int_part = v >> 20; - int32_t frac_part = v & ((1 << 20) - 1); - -#if 0 - // would work, if we had it - printf("%lld.%03d", int_part, (frac_part * 1000) >> 20); -#else - print_uint64(int_part); - print_thousandths((frac_part * 1000) >> 20); -#endif -} - -void -print_fxpt_gain(u2_fxpt_gain_t v) -{ - if (v < 0){ - v = -v; - putchar('-'); - } - - int32_t int_part = v >> 7; - int32_t frac_part = v & ((1 << 7) - 1); - -#if 0 - // would work, if we had it - printf("%d.%03d", int_part, (frac_part * 1000) >> 7); -#else - printf("%d", int_part); - print_thousandths((frac_part * 1000) >> 7); -#endif -} - diff --git a/usrp2/firmware/lib/print_mac_addr.c b/usrp2/firmware/lib/print_mac_addr.c deleted file mode 100644 index 838fd614a..000000000 --- a/usrp2/firmware/lib/print_mac_addr.c +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ -#include "nonstdio.h" - -void -print_mac_addr(const unsigned char addr[6]) -{ - puthex8(addr[0]); putchar(':'); - puthex8(addr[1]); putchar(':'); - puthex8(addr[2]); putchar(':'); - puthex8(addr[3]); putchar(':'); - puthex8(addr[4]); putchar(':'); - puthex8(addr[5]); -} - diff --git a/usrp2/firmware/lib/print_rmon_regs.c b/usrp2/firmware/lib/print_rmon_regs.c deleted file mode 100644 index 6d9986909..000000000 --- a/usrp2/firmware/lib/print_rmon_regs.c +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "print_rmon_regs.h" -#include "eth_mac.h" -#include "nonstdio.h" - -void -print_rmon_regs(void) -{ - int i; - for (i=0; i <= 0x10; i++){ - putstr("RMON[0x"); - puthex8(i); - putstr("] = "); - printf("%d\n", eth_mac_read_rmon(i)); - } - - for (i=0x20; i <= 0x30; i++){ - putstr("RMON[0x"); - puthex8(i); - putstr("] = "); - printf("%d\n", eth_mac_read_rmon(i)); - } -} diff --git a/usrp2/firmware/lib/print_rmon_regs.h b/usrp2/firmware/lib/print_rmon_regs.h deleted file mode 100644 index 44e52da84..000000000 --- a/usrp2/firmware/lib/print_rmon_regs.h +++ /dev/null @@ -1,24 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifndef INCLUDED_PRINT_RMON_REGS_H -#define INCLUDED_PRINT_RMON_REGS_H - -void print_rmon_regs(void); - -#endif /* INCLUDED_PRINT_RMON_REGS_H */ diff --git a/usrp2/firmware/lib/printf.c b/usrp2/firmware/lib/printf.c deleted file mode 100644 index 45bd57cb9..000000000 --- a/usrp2/firmware/lib/printf.c +++ /dev/null @@ -1,134 +0,0 @@ -/* -*- c -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -/* - * Based on code from the SDCC z80 library ;) - */ - -#include <stdarg.h> -#include <stdio.h> - -static void -_printn(unsigned u, unsigned base, char issigned, - void (*emitter)(char, void *), void *pData) -{ - const char *_hex = "0123456789ABCDEF"; - if (issigned && ((int)u < 0)) { - (*emitter)('-', pData); - u = (unsigned)-((int)u); - } - if (u >= base) - _printn(u/base, base, 0, emitter, pData); - (*emitter)(_hex[u%base], pData); -} - -static void -_printf(const char *format, void (*emitter)(char, void *), - void *pData, va_list va) -{ - while (*format) { - if (*format != '%') - (*emitter)(*format, pData); - else { - switch (*++format) { - case 0: /* hit end of format string */ - return; - case 'c': - { - char c = (char)va_arg(va, int); - (*emitter)(c, pData); - break; - } - case 'u': - { - unsigned u = va_arg(va, unsigned); - _printn(u, 10, 0, emitter, pData); - break; - } - case 'd': - { - unsigned u = va_arg(va, unsigned); - _printn(u, 10, 1, emitter, pData); - break; - } - case 'x': - case 'p': - { - unsigned u = va_arg(va, unsigned); - _printn(u, 16, 0, emitter, pData); - break; - } - case 's': - { - char *s = va_arg(va, char *); - while (*s) { - (*emitter)(*s, pData); - s++; - } - break; - } - } - } - format++; - } -} - -static void -_char_emitter(char c, void *pData __attribute__((unused))) -{ - putchar(c); -} - -int -printf(const char *format, ...) -{ - va_list va; - va_start(va, format); - - _printf(format, _char_emitter, NULL, va); - - va_end(va); - - // wrong return value... - return 0; -} - - -#if 0 - -// Totally dangerous. Don't use -static void -_buf_emitter(char c, void *pData) -{ - *((*((char **)pData)))++ = c; -} - -int sprintf(char *pInto, const char *format, ...) -{ - va_list va; - va_start(va, format); - - _printf(format, _buf_emitter, &pInto, va); - *pInto++ = '\0'; - - va_end(va); - - // FIXME wrong return value - return 0; -} -#endif diff --git a/usrp2/firmware/lib/printf.c.smaller b/usrp2/firmware/lib/printf.c.smaller deleted file mode 100644 index 4d858648d..000000000 --- a/usrp2/firmware/lib/printf.c.smaller +++ /dev/null @@ -1,134 +0,0 @@ -/* -*- c -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -/* - * Based on code from the SDCC z80 library ;) - */ - -#include <stdarg.h> -#include <stdio.h> -#include <hal_io.h> /* FIXME refactor into stdio */ - -#define PUTCHAR(x) hal_putc(x) - - -static void -_printn(unsigned u, unsigned base, char issigned) -{ - const char *_hex = "0123456789ABCDEF"; - if (issigned && ((int)u < 0)) { - PUTCHAR('-'); - u = (unsigned)-((int)u); - } - if (u >= base) - _printn(u/base, base, 0); - PUTCHAR(_hex[u%base]); -} - -static void -_printf(const char *format, va_list va) -{ - while (*format) { - if (*format != '%') - PUTCHAR(*format); - else { - switch (*++format) { - case 0: /* hit end of format string */ - return; - case 'c': - { - char c = (char)va_arg(va, int); - PUTCHAR(c); - break; - } - case 'u': - { - unsigned u = va_arg(va, unsigned); - _printn(u, 10, 0); - break; - } - case 'd': - { - unsigned u = va_arg(va, unsigned); - _printn(u, 10, 1); - break; - } - case 'x': - case 'p': - { - unsigned u = va_arg(va, unsigned); - _printn(u, 16, 0); - break; - } - case 's': - { - char *s = va_arg(va, char *); - while (*s) { - PUTCHAR(*s); - s++; - } - break; - } - } - } - format++; - } -} - -#if 0 -static void -_char_emitter(char c, void *pData __attribute__((unused))) -{ - hal_putc(c); -} -#endif - -int -printf(const char *format, ...) -{ - va_list va; - va_start(va, format); - - _printf(format, va); - - // wrong return value... - return 0; -} - - -#if 0 - -// Totally dangerous. Don't use -static void -_buf_emitter(char c, void *pData) -{ - *((*((char **)pData)))++ = c; -} - -int sprintf(char *pInto, const char *format, ...) -{ - va_list va; - va_start(va, format); - - _printf(format, _buf_emitter, &pInto, va); - *pInto++ = '\0'; - - // FIXME wrong return value - return 0; -} -#endif diff --git a/usrp2/firmware/lib/sd.c b/usrp2/firmware/lib/sd.c deleted file mode 100644 index d000b28ae..000000000 --- a/usrp2/firmware/lib/sd.c +++ /dev/null @@ -1,197 +0,0 @@ -/* -*- c -*- */ -/* - * Copyright 2008 Ettus Research LLC - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#include "sd.h" -#include "memory_map.h" -#include "stdint.h" -#include "stdio.h" - -static inline void -sd_packarg(unsigned char *argument,unsigned int value) -{ - argument[3] = (unsigned char)(value >> 24); - argument[2] = (unsigned char)(value >> 16); - argument[1] = (unsigned char)(value >> 8); - argument[0] = (unsigned char)(value); -} - -int -sd_init(void) -{ - unsigned char response[5]; - unsigned char argument[4]; - int i,j; - - for(i=0;i<4;i++) - argument[i] = 0; - - // Set clock to less than 400 kHz to start out - sdspi_regs->clkdiv = 128; - - // Delay at least 74 cycles - sd_assert_cs(); - for(i = 0; i < 100; i++) - sd_send_byte(SD_IDLE); - sd_deassert_cs(); - - // Initialization Sequence -- CMD0 CMD55 ACMD41 CMD58 - // Put card in idle state - if(sd_send_command(SD_CMD0,SD_CMD0_R,response,argument)==0) - return 0; // Something went wrong in command - - j = 0; - do { - j++; - if(sd_send_command(SD_CMD55,SD_CMD55_R,response,argument)==1) - sd_send_command(SD_ACMD41,SD_ACMD41_R,response,argument); - else - j = SD_IDLE_WAIT_MAX; - } - while(((response[0] & SD_MSK_IDLE) == SD_MSK_IDLE) && (j < SD_IDLE_WAIT_MAX)); - - if(j>= SD_IDLE_WAIT_MAX) // IDLE timeout exceeded, card asleep - return 0; - - // CMD58 reads the SD card capabilities - if(sd_send_command(SD_CMD58,SD_CMD58_R,response,argument)==0) - return 0; // CMD58 FAIL - - if((response[2] & SD_MSK_OCR_33) != SD_MSK_OCR_33) - return 0; // Card doesn't do 3.3V - - //printf("OCR = %x %x %x %x\n",response[0],response[1],response[2],response[3]); - - // Set blocklen here - sd_packarg(argument,SD_BLOCKLEN); - if(sd_send_command(SD_CMD16,SD_CMD16_R,response,argument)==0) - return 0; // Set Blocklen failed - - // Reset back to high speed - sdspi_regs->clkdiv = 4; - //puts("finished init\n"); - return 1; -} - -int sd_send_command(unsigned char cmd,unsigned char response_type, - unsigned char *response,unsigned char *argument) -{ - int i; - char response_length; - unsigned char tmp; - - sd_assert_cs(); - sd_send_byte((cmd & 0x3F) | 0x40); - for(i=3;i>=0;i--) - sd_send_byte(argument[i]); - sd_send_byte(SD_CRC); // Always the same - - response_length = 0; - switch(response_type) - { - case SD_R1: - case SD_R1B: - response_length = 1; - break; - case SD_R2: - response_length = 2; - break; - case SD_R3: - response_length = 5; - break; - default: - break; - } - - // Wait for a response, which will have a 0 start bit - i = 0; - do - { - tmp = sd_rcv_byte(); - i++; - } - while(((tmp & 0x80) != 0) && i < SD_CMD_TIMEOUT); - - if(i>= SD_CMD_TIMEOUT) - { - sd_deassert_cs(); - //puts("cmd send timeout\n"); - return 0; - } - - for(i=response_length-1; i>=0; i--) - { - response[i] = tmp; - tmp = sd_rcv_byte(); - } - i = 0; - if(response_type == SD_R1B) - { - do - { - i++; - tmp = sd_rcv_byte(); - } - while(tmp != SD_IDLE); - sd_send_byte(SD_IDLE); - } - - //puts("send cmd success\n"); - sd_deassert_cs(); - return 1; -} - -int -sd_read_block (unsigned int blockaddr, unsigned char *buf) -{ - unsigned char response[5]; - unsigned char argument[4]; - unsigned int i = 0; - unsigned char tmp; - - blockaddr <<= SD_BLOCKLEN_NBITS; - sd_packarg(argument,blockaddr); - if(sd_send_command(SD_CMD17,SD_CMD17_R,response,argument)==0) - return 0; //Failed READ; - if(response[0] != 0) - return 0; //Misaligned READ - - sd_assert_cs(); - i = 0; - do - { - tmp = sd_rcv_byte(); - i++; - } - while((tmp == 0xFF) && (i < SD_RD_TIMEOUT)); - if((i>= SD_RD_TIMEOUT) ||((tmp & SD_MSK_TOK_DATAERROR) == 0)) - { - sd_send_byte(SD_IDLE); // Send a dummy before quitting - return 0; // Data ERROR - } - for(i=0;i<SD_BLOCKLEN;i++) - buf[i] = sd_rcv_byte(); - return 1; - -} - -int -sd_write_block(unsigned int blockaddr, const unsigned char *buf) -{ - // FIXME not implemented yet - return 0; -} diff --git a/usrp2/firmware/lib/sd.h b/usrp2/firmware/lib/sd.h deleted file mode 100644 index e2d0ae38e..000000000 --- a/usrp2/firmware/lib/sd.h +++ /dev/null @@ -1,122 +0,0 @@ -/* -*- c -*- */ -/* - * Copyright 2008 Ettus Research LLC - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifndef INCLUDED_SD_H -#define INCLUDED_SD_H - -#include "memory_map.h" - -#define SD_READY 1 -#define SD_IDLE_WAIT_MAX 100 -#define SD_CMD_TIMEOUT 100 -#define SD_RD_TIMEOUT 1000 - -#define SD_CMD0 0 -#define SD_CMD1 1 -#define SD_CMD9 9 -#define SD_CMD10 10 -#define SD_CMD12 12 -#define SD_CMD13 13 -#define SD_CMD16 16 -#define SD_CMD17 17 -#define SD_CMD18 18 -#define SD_CMD24 24 -#define SD_CMD25 25 -#define SD_CMD27 27 -#define SD_CMD28 28 -#define SD_CMD29 29 -#define SD_CMD30 30 -#define SD_CMD32 32 -#define SD_CMD33 33 -#define SD_CMD38 38 -#define SD_CMD55 55 -#define SD_CMD58 58 -#define SD_CMD59 59 -#define SD_ACMD41 41 -#define SD_IDLE 0xFF -#define SD_CRC 0x95 - -#define SD_R1 1 -#define SD_R1B 2 -#define SD_R2 3 -#define SD_R3 4 - -#define SD_CMD0_R SD_R1 -#define SD_CMD16_R SD_R1 -#define SD_CMD17_R SD_R1 -#define SD_CMD55_R SD_R1 -#define SD_ACMD41_R SD_R1 -#define SD_CMD58_R SD_R3 - -#define SD_BLOCKLEN 512 -#define SD_BLOCKLEN_NBITS 9 - -#define SD_MSK_IDLE 0x01 -#define SD_MSK_OCR_33 0xC0 -#define SD_MSK_TOK_DATAERROR 0xE0 - - -int sd_init(void); - -static inline void -sd_assert_cs(void) -{ - // Wait for idle before doing anything - while(sdspi_regs->status != SD_READY) - ; - sdspi_regs->status = 1; -} - -static inline void -sd_deassert_cs(void) -{ - // Wait for idle before doing anything - while(sdspi_regs->status != SD_READY) - ; - sdspi_regs->status = 0; -} - -static inline char -sd_rcv_byte(void) -{ - // Wait for idle before doing anything - while(sdspi_regs->status != SD_READY) - ; - sdspi_regs->send_dat = SD_IDLE; - while(sdspi_regs->status != SD_READY) - ; - return sdspi_regs-> receive_dat; -} - -static inline void -sd_send_byte(char dat) -{ - // Wait for idle before doing anything - while(sdspi_regs->status != SD_READY) - ; // Wait for status = 1 (ready) - sdspi_regs->send_dat = dat; -} - - -int sd_send_command(unsigned char cmd,unsigned char response_type, - unsigned char *response,unsigned char *argument); - -int sd_read_block (unsigned int blockaddr, unsigned char *buf); -int sd_write_block(unsigned int blockaddr, const unsigned char *buf); - -#endif /* INCLUDED_SD_H */ diff --git a/usrp2/firmware/lib/spi.c b/usrp2/firmware/lib/spi.c deleted file mode 100644 index 937397df6..000000000 --- a/usrp2/firmware/lib/spi.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2007,2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#include "spi.h" -#include "memory_map.h" - -void -spi_init(void) -{ - /* - * f_sclk = f_wb / ((div + 1) * 2) - */ - spi_regs->div = 1; // 0 = Div by 2 (25 MHz); 1 = Div-by-4 (12.5 MHz) -} - -void -spi_wait(void) -{ - while (spi_regs->ctrl & SPI_CTRL_GO_BSY) - ; -} - -uint32_t -spi_transact(bool readback, int slave, uint32_t data, int length, uint32_t flags) -{ - flags &= (SPI_CTRL_TXNEG | SPI_CTRL_RXNEG); - int ctrl = SPI_CTRL_ASS | (SPI_CTRL_CHAR_LEN_MASK & length) | flags; - - spi_wait(); - - // Tell it which SPI slave device to access - spi_regs->ss = slave & 0xff; - - // Data we will send - spi_regs->txrx0 = data; - - // Run it -- write once and rewrite with GO set - spi_regs->ctrl = ctrl; - spi_regs->ctrl = ctrl | SPI_CTRL_GO_BSY; - - if(readback) { - spi_wait(); - return spi_regs->txrx0; - } - else - return 0; -} diff --git a/usrp2/firmware/lib/spi.h b/usrp2/firmware/lib/spi.h deleted file mode 100644 index 0914d6c3b..000000000 --- a/usrp2/firmware/lib/spi.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- c -*- */ -/* - * Copyright 2006,2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifndef INCLUDED_SPI_H -#define INCLUDED_SPI_H - -#include <memory_map.h> -#include <bool.h> - -/*! - * \brief One time call to initialize SPI - */ -void spi_init(void); - -/*! - * \brief Wait for last SPI transaction to complete. - * Unless you need to know it completed, it's not necessary to call this. - */ -void spi_wait(void); - -#define SPI_TXONLY false // readback: no -#define SPI_TXRX true // readback: yes - -/* - * Flags for spi_transact - */ -#define SPIF_PUSH_RISE 0 // push tx data on rising edge of SCLK -#define SPIF_PUSH_FALL SPI_CTRL_TXNEG // push tx data on falling edge of SCLK -#define SPIF_LATCH_RISE 0 // latch rx data on rising edge of SCLK -#define SPIF_LATCH_FALL SPI_CTRL_RXNEG // latch rx data on falling edge of SCLK - - -uint32_t -spi_transact(bool readback, int slave, uint32_t data, int length, uint32_t flags); - - -#endif /* INCLUDED_SPI_H */ diff --git a/usrp2/firmware/lib/stdint.h b/usrp2/firmware/lib/stdint.h deleted file mode 100644 index b5a8611a9..000000000 --- a/usrp2/firmware/lib/stdint.h +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c -*- */ -/* - * Copyright 2007,2009 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifndef INCLUDED_STDINT_H -#define INCLUDED_STDINT_H - -typedef signed char int8_t; -typedef unsigned char uint8_t; -typedef short int16_t; -typedef unsigned short uint16_t; -typedef int int32_t; -typedef unsigned int uint32_t; -typedef long long int int64_t; -typedef unsigned long long int uint64_t; - -typedef int intptr_t; -typedef unsigned int uintptr_t; - -#endif /* INCLUDED_STDINT_H */ diff --git a/usrp2/firmware/lib/stdio.h b/usrp2/firmware/lib/stdio.h deleted file mode 100644 index 12a7ed0bb..000000000 --- a/usrp2/firmware/lib/stdio.h +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- c -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifndef INCLUDED_STDIO_H -#define INCLUDED_STDIO_H - -// very trimmed down stdio.h See also nonstdio.h - -#ifndef NULL -#define NULL 0 -#endif - -#ifndef EOF -#define EOF (-1) -#endif - -int putchar(int c); -int puts(const char *s); -int printf(const char *format, ...); - -int getchar(void); - -#endif /* INCLUDED_STDIO_H */ diff --git a/usrp2/firmware/lib/u2_init.c b/usrp2/firmware/lib/u2_init.c deleted file mode 100644 index 9a1eb1651..000000000 --- a/usrp2/firmware/lib/u2_init.c +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#include "u2_init.h" -#include "memory_map.h" -#include "spi.h" -#include "pic.h" -#include "hal_io.h" -#include "lsadc.h" -#include "lsdac.h" -#include "buffer_pool.h" -#include "hal_uart.h" -#include "i2c.h" -#include "bool.h" -#include "mdelay.h" -#include "ad9777.h" -#include "clocks.h" -#include "db.h" -#include "usrp2_i2c_addr.h" - -//#include "nonstdio.h" - -unsigned char u2_hw_rev_major; -unsigned char u2_hw_rev_minor; - -static inline void -get_hw_rev(void) -{ - bool ok = eeprom_read(I2C_ADDR_MBOARD, MBOARD_REV_LSB, &u2_hw_rev_minor, 1); - ok &= eeprom_read(I2C_ADDR_MBOARD, MBOARD_REV_MSB, &u2_hw_rev_major, 1); -} - -/* - * We ought to arrange for this to be called before main, but for now, - * we require that the user's main call u2_init as the first thing... - */ -bool -u2_init(void) -{ - // Set GPIOs to inputs, disable GPIO streaming - hal_gpio_set_ddr(GPIO_TX_BANK, 0x0000, 0xffff); - hal_gpio_set_ddr(GPIO_RX_BANK, 0x0000, 0xffff); - - hal_gpio_write(GPIO_TX_BANK, 0x0000, 0xffff); // init s/w output value to zero - hal_gpio_write(GPIO_RX_BANK, 0x0000, 0xffff); - - dsp_rx_regs->gpio_stream_enable = 0; // I, Q LSBs come from DSP - - hal_io_init(); - - // init spi, so that we can switch over to the high-speed clock - spi_init(); - - // init i2c so we can read our rev - i2c_init(); - get_hw_rev(); - - // set up the default clocks - clocks_init(); - - // clocks_enable_test_clk(true,1); - - // Enable ADCs - output_regs->adc_ctrl = ADC_CTRL_ON; - - // Set up AD9777 DAC - ad9777_write_reg(0, R0_1R); - ad9777_write_reg(1, R1_INTERP_4X | R1_REAL_MIX); - ad9777_write_reg(2, 0); - ad9777_write_reg(3, R3_PLL_DIV_1); - ad9777_write_reg(4, R4_PLL_ON | R4_CP_AUTO); - ad9777_write_reg(5, R5_I_FINE_GAIN(0)); - ad9777_write_reg(6, R6_I_COARSE_GAIN(0xf)); - ad9777_write_reg(7, 0); // I dac offset - ad9777_write_reg(8, 0); - ad9777_write_reg(9, R9_Q_FINE_GAIN(0)); - ad9777_write_reg(10, R10_Q_COARSE_GAIN(0xf)); - ad9777_write_reg(11, 0); // Q dac offset - ad9777_write_reg(12, 0); - - // Initial values for tx and rx mux registers - dsp_tx_regs->tx_mux = 0x10; - dsp_rx_regs->rx_mux = 0x44444444; - - // Set up serdes - output_regs->serdes_ctrl = (SERDES_ENABLE | SERDES_RXEN); - - pic_init(); // progammable interrupt controller - bp_init(); // buffer pool - lsadc_init(); // low-speed ADCs - lsdac_init(); // low-speed DACs - db_init(); // daughterboard init - - hal_enable_ints(); - - // flash all leds to let us know board is alive - hal_set_leds(0x0, 0x1f); - mdelay(100); - hal_set_leds(0x1f, 0x1f); - mdelay(100); - hal_set_leds(0x1, 0x1f); // Leave the first one on - -#if 0 - // test register readback - int rr, vv; - vv = ad9777_read_reg(0); - printf("ad9777 reg[0] = 0x%x\n", vv); - - for (rr = 0x04; rr <= 0x0d; rr++){ - vv = ad9510_read_reg(rr); - printf("ad9510 reg[0x%x] = 0x%x\n", rr, vv); - } -#endif - - return true; -} diff --git a/usrp2/firmware/lib/u2_init.h b/usrp2/firmware/lib/u2_init.h deleted file mode 100644 index 91654dac8..000000000 --- a/usrp2/firmware/lib/u2_init.h +++ /dev/null @@ -1,29 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ -#ifndef INCLUDED_U2_INIT_H -#define INCLUDED_U2_INIT_H - -extern unsigned char u2_hw_rev_major; -extern unsigned char u2_hw_rev_minor; - -/*! - * one-time init - */ -int u2_init(void); - -#endif /* INCLUDED_U2_INIT_H */ diff --git a/usrp2/firmware/lib/usrp2_bytesex.h b/usrp2/firmware/lib/usrp2_bytesex.h deleted file mode 100644 index 2b74f2a0b..000000000 --- a/usrp2/firmware/lib/usrp2_bytesex.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ -#ifndef INCLUDED_USRP2_BYTESEX_H -#define INCLUDED_USRP2_BYTESEX_H - -// The USRP2 speaks big-endian... -// Use the standard include files or provide substitutions for -// htons and friends - -#if defined(HAVE_ARPA_INET_H) -#include <arpa/inet.h> -#elif defined(HAVE_NETINET_IN_H) -#include <netinet/in.h> -#else -#include <stdint.h> - -#ifdef WORDS_BIGENDIAN // nothing to do... - -static inline uint32_t htonl(uint32_t x){ return x; } -static inline uint16_t htons(uint16_t x){ return x; } -static inline uint32_t ntohl(uint32_t x){ return x; } -static inline uint16_t ntohs(uint16_t x){ return x; } - -#else - -#ifdef HAVE_BYTESWAP_H -#include <byteswap.h> -#else - -static inline uint16_t -bswap_16 (uint16_t x) -{ - return ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8)); -} - -static inline uint32_t -bswap_32 (uint32_t x) -{ - return ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) \ - | (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24)); -} -#endif - -static inline uint32_t htonl(uint32_t x){ return bswap_32(x); } -static inline uint16_t htons(uint16_t x){ return bswap_16(x); } -static inline uint32_t ntohl(uint32_t x){ return bswap_32(x); } -static inline uint16_t ntohs(uint16_t x){ return bswap_16(x); } - -#endif -#endif -#endif /* INCLUDED_USRP2_BYTESEX_H */ diff --git a/usrp2/firmware/lib/wb16550.h b/usrp2/firmware/lib/wb16550.h deleted file mode 100644 index 7522f4438..000000000 --- a/usrp2/firmware/lib/wb16550.h +++ /dev/null @@ -1,98 +0,0 @@ -/* -*- c -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - - -// Wishbone National Semiconductor 16550A compatible UART - -#ifndef INCLUDED_WB16550_H -#define INCLUDED_WB16550_H - -#include <stdint.h> - -typedef struct { - volatile uint8_t data; // 0 r/w: r: rx fifo, w: tx fifo (if DLAB: LSB of divisor) - volatile uint8_t ier; // 1 r/w: Interrupt Enable Register (if DLAB: MSB of divisor) - volatile uint8_t iir_fcr; // 2 r/w: r: Interrupt ID Register, - // w: Fifo Control Register - volatile uint8_t lcr; // 3 r/w: Line Control Register - volatile uint8_t mcr; // 4 w: Modem Control Register - volatile uint8_t lsr; // 5 r: Line Status Register - volatile uint8_t msr; // 6 r: Modem Status Register - -} wb16550_reg_t; - -#define UART_IER_RDI 0x01 // Enable received data interrupt -#define UART_IER_THRI 0x02 // Enable transmitter holding reg empty int. -#define UART_IER_RLSI 0x04 // Enable receiver line status interrupt -#define UART_IER_MSI 0x08 // Enable modem status interrupt - -#define UART_IIR_NO_INT 0x01 // No interrupts pending -#define UART_IIR_ID_MASK 0x06 // Mask for interrupt ID -#define UART_IIR_MSI 0x00 // Modem status interrupt -#define UART_IIR_THRI 0x02 // Tx holding register empty int -#define UART_IIR_RDI 0x04 // Rx data available int -#define UART_IIR_RLSI 0x06 // Receiver line status int - -#define UART_FCR_ENABLE_FIFO 0x01 // ignore, always enabled -#define UART_FCR_CLEAR_RCVR 0x02 // Clear the RCVR FIFO -#define UART_FCR_CLEAR_XMIT 0x04 // Clear the XMIT FIFO -#define UART_FCR_TRIGGER_MASK 0xC0 // Mask for FIFO trigger range -#define UART_FCR_TRIGGER_1 0x00 // Rx fifo trigger level: 1 byte -#define UART_FCR_TRIGGER_4 0x40 // Rx fifo trigger level: 4 bytes -#define UART_FCR_TRIGGER_8 0x80 // Rx fifo trigger level: 8 bytes -#define UART_FCR_TRIGGER_14 0xC0 // Rx fifo trigger level: 14 bytes - -#define UART_LCR_DLAB 0x80 // Divisor latch access bit -#define UART_LCR_SBC 0x40 // Set break control -#define UART_LCR_SPAR 0x20 // Stick parity -#define UART_LCR_EPAR 0x10 // Even parity select -#define UART_LCR_PARITY 0x08 // Parity Enable -#define UART_LCR_STOP 0x04 // Stop bits: 0=1 bit, 1=2 bits -#define UART_LCR_WLEN5 0x00 // Wordlength: 5 bits -#define UART_LCR_WLEN6 0x01 // Wordlength: 6 bits -#define UART_LCR_WLEN7 0x02 // Wordlength: 7 bits -#define UART_LCR_WLEN8 0x03 // Wordlength: 8 bits - -#define UART_MCR_LOOP 0x10 // Enable loopback test mode -#define UART_MCR_OUT2n 0x08 // Out2 complement (loopback mode) -#define UART_MCR_OUT1n 0x04 // Out1 complement (loopback mode) -#define UART_MCR_RTSn 0x02 // RTS complement -#define UART_MCR_DTRn 0x01 // DTR complement - -#define UART_LSR_TEMT 0x40 // Transmitter empty -#define UART_LSR_THRE 0x20 // Transmit-hold-register empty -#define UART_LSR_BI 0x10 // Break interrupt indicator -#define UART_LSR_FE 0x08 // Frame error indicator -#define UART_LSR_PE 0x04 // Parity error indicator -#define UART_LSR_OE 0x02 // Overrun error indicator -#define UART_LSR_DR 0x01 // Receiver data ready -#define UART_LSR_BRK_ERROR_BITS 0x1E // BI, FE, PE, OE bits -#define UART_LSR_ERROR 0x80 // At least 1 PE, FE or BI are in the fifo - -#define UART_MSR_DCD 0x80 // Data Carrier Detect -#define UART_MSR_RI 0x40 // Ring Indicator -#define UART_MSR_DSR 0x20 // Data Set Ready -#define UART_MSR_CTS 0x10 // Clear to Send -#define UART_MSR_DDCD 0x08 // Delta DCD -#define UART_MSR_TERI 0x04 // Trailing edge ring indicator -#define UART_MSR_DDSR 0x02 // Delta DSR -#define UART_MSR_DCTS 0x01 // Delta CTS -#define UART_MSR_ANY_DELTA 0x0F // Any of the delta bits! - - -#endif // INCLUDED_WB16550_H diff --git a/usrp2/firmware/u2_flash_tool b/usrp2/firmware/u2_flash_tool deleted file mode 100755 index 2b66a4ac0..000000000 --- a/usrp2/firmware/u2_flash_tool +++ /dev/null @@ -1,116 +0,0 @@ -#!/usr/bin/env python - -import sys -from optparse import OptionParser - -SECTOR_SIZE = 512 # bytes -MAX_FILE_SIZE = 1 * (2**20) # maximum number of bytes we'll burn to a slot - -FPGA_OFFSET = 0 # offset in flash to fpga image -FIRMWARE_OFFSET = 1 * (2**20) # offset in flash to firmware image - -def read_file_data(filename): - f = open(filename, "rb") - file_data = f.read(MAX_FILE_SIZE) - t = len(file_data) % SECTOR_SIZE - if t != 0: - file_data += (SECTOR_SIZE - t)*chr(0) # pad to an even sector size w/ zeros - return file_data - - -def write_flash(offset, filename, devname): - file_data = read_file_data(filename) - dev = open(devname, "wb") - dev.seek(offset, 0) # seek to absolute byte offset - dev.write(file_data) - dev.flush() - dev.close() - return True - - -def verify_flash(offset, filename, devname): - file_data = read_file_data(filename) - dev = open(devname, "rb") - dev.seek(offset, 0) # seek to absolute byte offset - dev_data = dev.read(len(file_data)) - if len(dev_data) != len(file_data): - sys.stderr.write("short read on device %s\n" % (devname,)) - return False - - if file_data == dev_data: - return True - - # doesn't match - nwrong = 0 - for i in range(len(file_data)): - if dev_data[i] != file_data[i]: - sys.stderr.write("mismatch at offset %7d. Expected 0x%02x, got 0x%02x\n" % ( - i, ord(file_data[i]), ord(dev_data[i]))) - nwrong += 1 - if nwrong > 16: - sys.stderr.write("> 16 errors, stopping comparison\n") - break - return False - -def read_flash(offset, filename, devname): - dev = open(devname, "rb") - dev.seek(offset, 0) # seek to absolute byte offset - dev_data = dev.read(MAX_FILE_SIZE) - dev.close() - open(filename, "wb").write(dev_data) - - -def main(): - parser = OptionParser(usage="%prog: [options] filename") - parser.add_option("-w", "--write", action="store_const", const="write", dest="mode", - help="write FILE to TARGET slot") - parser.add_option("-v", "--verify", action="store_const", const="verify", dest="mode", - help="verify FILE against TARGET slot") - parser.add_option("-r", "--read", action="store_const", const="read", dest="mode", - help="read TARGET slot, write to FILE") - parser.add_option("-t", "--target", type="choice", choices=("fpga", "s/w"), default="s/w", - help="select TARGET slot from: fpga, s/w [default=%default]") - parser.add_option("", "--dev", default=None, - help="specify flash device file, e.g., /dev/sdb. Be careful!") - parser.set_defaults(target="s/w", mode=None) - - (options, args) = parser.parse_args() - if len(args) != 1: - parser.print_help() - raise SystemExit - - filename = args[0] - - if options.mode is None: - sys.stderr.write("specify mode with -w, -v or -r\n") - parser.print_help() - raise SystemExit - - if options.dev is None: - sys.stderr.write("specify the device file with --dev\n") - parser.print_help() - raise SystemExit - - offset = { "fpga" : FPGA_OFFSET, "s/w" : FIRMWARE_OFFSET }[options.target] - - if options.mode == "write": - r = (write_flash(offset, filename, options.dev) - and verify_flash(offset, filename, options.dev)) - elif options.mode == "verify": - r = verify_flash(offset, filename, options.dev) - elif options.mode == "read": - r = read_flash(offset, filename, options.dev) - else: - raise NotImplemented - - if not r: - raise SystemExit, 1 - - -if __name__ == "__main__": - main() - - - - - diff --git a/usrp2/fpga/README b/usrp2/fpga/README deleted file mode 100644 index 802b98476..000000000 --- a/usrp2/fpga/README +++ /dev/null @@ -1,3 +0,0 @@ -The FPGA directory that used to be here is now hosted at: - -git://ettus.sourcerepo.com/ettus/fpga.git diff --git a/usrp2/host/.gitignore b/usrp2/host/.gitignore deleted file mode 100644 index 605b6fe86..000000000 --- a/usrp2/host/.gitignore +++ /dev/null @@ -1,20 +0,0 @@ -/configure -/Makefile.in -/config.log -/config.status -/config.guess -/stamp-h1 -/config.h -/ltmain.sh -/config.sub -/config.h.in -/libtool -/autom4te.cache -/missing -/aclocal.m4 -/Makefile -/install-sh -/depcomp -/usrp2*.tar.gz -/py-compile -/usrp2.pc diff --git a/usrp2/host/Makefile.am b/usrp2/host/Makefile.am deleted file mode 100644 index 13f7cb86a..000000000 --- a/usrp2/host/Makefile.am +++ /dev/null @@ -1,29 +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 this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# - -include $(top_srcdir)/Makefile.common - -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = usrp2.pc - -EXTRA_DIST += \ - usrp2.pc.in - -SUBDIRS = include lib apps diff --git a/usrp2/host/apps/.gitignore b/usrp2/host/apps/.gitignore deleted file mode 100644 index 4b66ac0f9..000000000 --- a/usrp2/host/apps/.gitignore +++ /dev/null @@ -1,16 +0,0 @@ -/Makefile -/Makefile.in -/.libs -/.deps -/test_eth -/test_usrp2 -/gen_const -/find_usrps -/cerr -/*.sh -/tx_samples -/rx_streaming_samples -/u2_burn_mac_addr -/usrp2_burn_mac_addr -/test_mimo_tx -/gpio diff --git a/usrp2/host/apps/Makefile.am b/usrp2/host/apps/Makefile.am deleted file mode 100644 index 087ab9e31..000000000 --- a/usrp2/host/apps/Makefile.am +++ /dev/null @@ -1,47 +0,0 @@ -# -# Copyright 2007,2008,2010 Free Software Foundation, Inc. -# -# This program 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 of the License, or -# (at your option) any later version. -# -# This program 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/>. -# - -include $(top_srcdir)/Makefile.common - -AM_CPPFLAGS = \ - $(USRP2_INCLUDES) \ - $(GRUEL_INCLUDES) \ - $(STD_DEFINES_AND_INCLUDES) \ - $(CPPUNIT_INCLUDES) - -LDADD = \ - $(USRP2_LA) \ - $(GRUEL_LA) - -bin_PROGRAMS = \ - find_usrps \ - usrp2_burn_mac_addr - -noinst_PROGRAMS = \ - gen_const \ - rx_streaming_samples \ - tx_samples \ - test_mimo_tx \ - gpio - -find_usrps_SOURCES = find_usrps.cc -usrp2_burn_mac_addr_SOURCES = usrp2_burn_mac_addr.cc -rx_streaming_samples_SOURCES = rx_streaming_samples.cc -gen_const_SOURCES = gen_const.cc -tx_samples_SOURCES = tx_samples.cc -test_mimo_tx_SOURCES = test_mimo_tx.cc -gpio_SOURCES = gpio.cc diff --git a/usrp2/host/apps/bitrot/rx_samples.cc b/usrp2/host/apps/bitrot/rx_samples.cc deleted file mode 100644 index c1c3b5917..000000000 --- a/usrp2/host/apps/bitrot/rx_samples.cc +++ /dev/null @@ -1,382 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include "usrp2_basic.h" -#include <iostream> -#include <complex> -#include <getopt.h> -#include <string.h> -#include "strtod_si.h" -#include <signal.h> -#include <stdexcept> -#include "gri_if_stats.h" -#include <gr_realtime.h> - - -typedef std::complex<float> fcomplex; - -static volatile bool signaled = false; - -static void -sig_handler(int sig) -{ - signaled = true; -} - -static void -install_sig_handler(int signum, - void (*new_handler)(int)) -{ - struct sigaction new_action; - memset (&new_action, 0, sizeof (new_action)); - - new_action.sa_handler = new_handler; - sigemptyset (&new_action.sa_mask); - new_action.sa_flags = 0; - - if (sigaction (signum, &new_action, 0) < 0){ - perror ("sigaction (install new)"); - throw std::runtime_error ("sigaction"); - } -} - - -/* - * Vectorize me! - */ -void -convert_samples_to_complex(size_t nsamples, - uint32_t *i_samples, - fcomplex *c_samples) -{ - uint32_t *p = i_samples; - for (size_t i = 0; i < nsamples; i++){ - int16_t si = ((int16_t) (p[i] >> 16)); - int16_t sq = ((int16_t) (p[i] & 0xffff)); - c_samples[i] = fcomplex((float) si, (float) sq); - } -} - - -static void -usage(const char *progname) -{ - const char *p = strrchr(progname, '/'); // drop leading directory path - if (p) - p++; - - if (strncmp(p, "lt-", 3) == 0) // drop lt- libtool prefix - p += 3; - - fprintf(stderr, "Usage: %s [options]\n\n", p); - fprintf(stderr, "Options:\n"); - fprintf(stderr, " -h show this message and exit\n"); - fprintf(stderr, " -e ETH_INTERFACE specify ethernet interface [default=eth0]\n"); - fprintf(stderr, " -m MAC_ADDR mac address of USRP2 HH:HH [default=first one found]\n"); - fprintf(stderr, " -o OUTPUT_FILE set output filename [default=NONE]\n"); - fprintf(stderr, " -f FREQ set frequency to FREQ [default=0]\n"); - fprintf(stderr, " -d DECIM set decimation rate to DECIM [default=32]\n"); - fprintf(stderr, " -N NSAMPLES total number of samples to receive [default=2.5e6]\n"); - fprintf(stderr, " -F SAMPLES_PER_FRAME number of samples in each frame [default=371]\n"); - fprintf(stderr, " -S SCALE fpga scaling factor for I & Q [default=1024]\n"); - fprintf(stderr, " -M DONT_LOCK|LOCK_TO_SMA|LOCK_TO_MIMO specify MIMO clock source\n"); - fprintf(stderr, " -P provide clock to MIMO connector\n"); -} - -struct pkt_info { - int d_nsamples; - int d_timestamp; - unsigned int d_seqno; - - pkt_info(int nsamples, int timestamp, int seqno) - : d_nsamples(nsamples), - d_timestamp(timestamp), - d_seqno(seqno) {} -}; - -int -main(int argc, char **argv) -{ - - // options and their defaults - const char *interface = "eth0"; - const char *mac_addr_str = 0; - const char *output_filename = 0; - double freq = 0; - int32_t decim = 32; - int32_t nsamples = static_cast<int32_t>(2.5e6); - int32_t samples_per_frame = 371; - int32_t scale = 1024; - int mimo_config = MC_WE_DONT_LOCK; - bool provide_clock = false; - - int ch; - double tmp; - u2_mac_addr_t mac_addr; - - setvbuf(stdout, 0, _IOFBF, 64 * 1024); // make stdout fully buffered - - while ((ch = getopt(argc, argv, "he:m:o:f:d:N:F:S:M:P")) != EOF){ - switch (ch){ - - case 'e': - interface = optarg; - break; - - case 'm': - mac_addr_str = optarg; - if (!usrp2_basic::parse_mac_addr(optarg, &mac_addr)){ - std::cerr << "invalid mac addr: " << optarg << std::endl; - usage(argv[0]); - exit(1); - } - break; - - case 'o': - output_filename = optarg; - break; - - case 'f': - if (!strtod_si(optarg, &freq)){ - std::cerr << "invalid number: " << optarg << std::endl; - usage(argv[0]); - exit(1); - } - break; - - case 'N': - if (!strtod_si(optarg, &tmp)){ - std::cerr << "invalid number: " << optarg << std::endl; - usage(argv[0]); - exit(1); - } - nsamples = static_cast<int32_t>(tmp); - break; - - case 'F': - samples_per_frame = strtol(optarg, 0, 0); - break; - - case 'd': - decim = strtol(optarg, 0, 0); - break; - - case 'S': - if (!strtod_si(optarg, &tmp)){ - std::cerr << "invalid number: " << optarg << std::endl; - usage(argv[0]); - exit(1); - } - scale = static_cast<int32_t>(tmp); - break; - - case 'M': - if (strcmp(optarg, "DONT_LOCK") == 0) - mimo_config = MC_WE_DONT_LOCK; - else if (strcmp(optarg, "LOCK_TO_SMA") == 0) - mimo_config = MC_WE_LOCK_TO_SMA; - else if (strcmp(optarg, "LOCK_TO_MIMO") == 0) - mimo_config = MC_WE_LOCK_TO_MIMO; - else { - usage(argv[0]); - exit(1); - } - break; - - case 'P': - provide_clock = true; - break; - - case 'h': - default: - usage(argv[0]); - exit(1); - } - } - - if (argc - optind != 0){ - usage(argv[0]); - exit(1); - } - - FILE *of = 0; - if (output_filename) - of = fopen(output_filename, "wb"); - - usrp2_basic *u2 = new usrp2_basic(); - - if (!u2->open(interface)){ - std::cerr << "couldn't open " << interface << std::endl; - return 0; - } - - - install_sig_handler(SIGINT, sig_handler); - if (1){ - install_sig_handler(SIGALRM, sig_handler); - alarm(5); - } - - - std::vector<op_id_reply_t> r = u2->find_usrps(); - - for (size_t i = 0; i < r.size(); i++){ - std::cout << r[i] << std::endl; - } - - if (r.size() == 0){ - std::cerr << "No USRP2 found.\n"; - return 1; - } - - u2_mac_addr_t which = r[0].addr; // pick the first one - - - gr_rt_status_t rt = gr_enable_realtime_scheduling(); - if (rt != RT_OK) - std::cerr << "failed to enable realtime scheduling\n"; - - if (provide_clock) - mimo_config |= MC_PROVIDE_CLK_TO_MIMO; - - u2->config_mimo(which, mimo_confg); - - - gri_if_stats start, stop; - gri_get_if_stats(interface, &start); - - if (!u2->start_rx(which, freq, decim, nsamples, samples_per_frame, scale, scale)){ - std::cerr << "start_rx failed\n"; - return 1; - } - - - std::vector<pkt_info> history; - history.reserve(64*1024); // preallocate 64K entries - - - long total_samples_recvd = 0; - - while (!signaled && total_samples_recvd < nsamples){ - u2_eth_samples_t pkt; - // fcomplex c_samples[U2_MAX_SAMPLES]; - - // read samples - int n = u2->read_samples(which, &pkt); - if (n <= 0) - break; - - total_samples_recvd += n; - - history.push_back(pkt_info(n, u2p_timestamp(&pkt.hdrs.fixed), pkt.hdrs.thdr.seqno)); - - // convert_samples_to_complex(n, pkt.samples, c_samples); - // size_t r = fwrite(c_samples, sizeof(fcomplex), n, of); - - if (of){ - fwrite(pkt.samples, sizeof(uint32_t), n, of); - fflush(of); - } - } - - - gri_get_if_stats(interface, &stop); - - if (!u2->stop_rx(which)){ - std::cerr << "stop_rx failed\n"; - return 1; - } - - - long expected_rx_packets = - (nsamples + samples_per_frame - 1)/samples_per_frame; - - long expected_rx_bytes = - expected_rx_packets * sizeof(u2_eth_packet_t) + nsamples * 4; - - - long total_pkts_recvd = 0; - total_samples_recvd = 0; - - int nbad_seqno = 0; - - for (unsigned i = 0; i < history.size(); i++){ - total_pkts_recvd++; - total_samples_recvd += history[i].d_nsamples; - - bool bad_seqno = history[i].d_seqno != (i & 0xff); - if (bad_seqno) - nbad_seqno++; - - printf("%3d %8d %8ld %8ld %3d %s\n", - history[i].d_nsamples, - history[i].d_timestamp, - total_pkts_recvd, total_samples_recvd, - history[i].d_seqno, - bad_seqno ? "BAD SEQNO" : "" - ); - } - - if (nbad_seqno == 0) - printf("\nAll sequence numbers are correct\n"); - else - printf("\n%d sequence numbers were INCORRECT\n", nbad_seqno); - - - printf("\nUser space statistics:\n"); - printf(" rx_samples: %8ld", total_samples_recvd); - printf(" expected %8d %s\n", - nsamples, - nsamples - total_samples_recvd == 0 ? "OK" : "NOT OK"); - - printf(" rx_packets: %8ld", total_pkts_recvd); - printf(" expected %8ld %s\n", - expected_rx_packets, - expected_rx_packets - total_pkts_recvd == 0 ? "OK" : "NOT OK"); - - - fflush(stdout); - - printf("\nKernel interface statistics:\n"); - - long long delta; - delta = stop.rx_bytes - start.rx_bytes; - printf(" rx_bytes: %8Ld", delta); - printf(" expected %8ld %s\n", - expected_rx_bytes, - expected_rx_bytes - delta == 0 ? "OK" : "NOT OK"); - - delta = stop.rx_packets - start.rx_packets; - printf(" rx_packets: %8Ld", delta); - printf(" expected %8ld %s\n", - expected_rx_packets, - expected_rx_packets - delta == 0 ? "OK" : "NOT OK"); - - printf(" rx_errs: %8Ld\n", stop.rx_errs - start.rx_errs); - printf(" rx_drop: %8Ld\n", stop.rx_drop - start.rx_drop); - printf(" tx_bytes: %8Ld\n", stop.tx_bytes - start.tx_bytes); - printf(" tx_packets: %8Ld\n", stop.tx_packets - start.tx_packets); - printf(" tx_errs: %8Ld\n", stop.tx_errs - start.tx_errs); - printf(" tx_drop: %8Ld\n", stop.tx_drop - start.tx_drop); - - - return 0; -} diff --git a/usrp2/host/apps/find_usrps.cc b/usrp2/host/apps/find_usrps.cc deleted file mode 100644 index ff6b4ab79..000000000 --- a/usrp2/host/apps/find_usrps.cc +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <usrp2/usrp2.h> -#include <iostream> -#include <cstdio> -#include <getopt.h> - -static void -usage(const char *progname) -{ - fprintf(stderr, "usage: %s [-e ethN]\n", - progname); -} - -int -main(int argc, char **argv) -{ - int ch; - const char *interface = "eth0"; - - while ((ch = getopt(argc, argv, "he:")) != EOF){ - switch (ch){ - case 'e': - interface = optarg; - break; - - case 'h': - default: - usage(argv[0]); - exit(1); - } - } - - if (argc - optind != 0){ - usage(argv[0]); - exit(1); - } - - usrp2::props_vector_t r = usrp2::find(interface); - - for (size_t i = 0; i < r.size(); i++){ - std::cout << r[i] << std::endl; - } - - if (r.size() == 0){ - std::cerr << "No USRP2 found.\n"; - return 1; - } - - return 0; -} diff --git a/usrp2/host/apps/gen_2tone.py b/usrp2/host/apps/gen_2tone.py deleted file mode 100755 index ec681d3e0..000000000 --- a/usrp2/host/apps/gen_2tone.py +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2007 Free Software Foundation, Inc. -# -# This program 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 of the License, or -# (at your option) any later version. -# -# This program 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/>. -# - -from gnuradio import gr, eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser -import sys - -master_clock = 100e6 - -class my_top_block(gr.top_block): - - def __init__(self): - gr.top_block.__init__(self) - - parser = OptionParser(option_class=eng_option) - parser.add_option("-f", "--freq1", type="eng_float", default=1e6, - help="set waveform frequency to FREQ [default=%default]") - parser.add_option("-g", "--freq2", type="eng_float", default=1e6, - help="set waveform frequency to FREQ [default=%default]") - parser.add_option ("-a", "--amplitude1", type="eng_float", default=16e3, - help="set waveform amplitude to AMPLITUDE [default=%default]", metavar="AMPL") - parser.add_option ("-b", "--amplitude2", type="eng_float", default=16e3, - help="set waveform amplitude to AMPLITUDE [default=%default]", metavar="AMPL") - - parser.add_option("-i", "--interp", type="int", default=32, - help="assume fgpa interpolation rate is INTERP [default=%default]") - - (options, args) = parser.parse_args () - if len(args) != 0: - parser.print_help() - raise SystemExit, 1 - - - src0 = gr.sig_source_c(master_clock/options.interp, - gr.GR_SIN_WAVE, - options.freq1, - options.amplitude1) - src1 = gr.sig_source_c(master_clock/options.interp, - gr.GR_SIN_WAVE, - options.freq2, - options.amplitude2) - - adder = gr.add_cc() - - - c2s = gr.complex_to_interleaved_short() - - stdout_sink = gr.file_descriptor_sink(gr.sizeof_short, 1) - - self.connect(src0, (adder,0)) - self.connect(src1, (adder,1)) - self.connect(adder, c2s, stdout_sink) - - -if __name__ == '__main__': - try: - my_top_block().run() - except KeyboardInterrupt: - pass diff --git a/usrp2/host/apps/gen_const.cc b/usrp2/host/apps/gen_const.cc deleted file mode 100644 index d2c36ebba..000000000 --- a/usrp2/host/apps/gen_const.cc +++ /dev/null @@ -1,27 +0,0 @@ -#include <stdio.h> -#include <stdint.h> -#include <stdlib.h> -#include <unistd.h> - -int -main(int argc, char **argv) -{ - if (argc != 3){ - fprintf(stderr, "usage: %s i-val q-val\n", argv[0]); - return 1; - } - - int i_val = strtol(argv[1], 0, 0); - int q_val = strtol(argv[2], 0, 0); - - static const int NSAMPLES = 16384; - - uint32_t sample[NSAMPLES]; - sample[0] = ((i_val & 0xffff) << 16) | (q_val & 0xffff); - for (int i = 1; i < NSAMPLES; i++) - sample[i] = sample[0]; - - while(1){ - write(1, sample, sizeof(sample)); - } -} diff --git a/usrp2/host/apps/gen_sine.py b/usrp2/host/apps/gen_sine.py deleted file mode 100755 index 6a44dd110..000000000 --- a/usrp2/host/apps/gen_sine.py +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2007 Free Software Foundation, Inc. -# -# This program 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 of the License, or -# (at your option) any later version. -# -# This program 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/>. -# - -from gnuradio import gr, eng_notation -from gnuradio.eng_option import eng_option -from optparse import OptionParser -import sys - -master_clock = 100e6 - -class my_top_block(gr.top_block): - - def __init__(self): - gr.top_block.__init__(self) - - parser = OptionParser(option_class=eng_option) - parser.add_option("-f", "--freq", type="eng_float", default=1e6, - help="set waveform frequency to FREQ [default=%default]") - parser.add_option ("-a", "--amplitude", type="eng_float", default=16e3, - help="set waveform amplitude to AMPLITUDE [default=%default]", metavar="AMPL") - - parser.add_option("-i", "--interp", type="int", default=32, - help="assume fgpa interpolation rate is INTERP [default=%default]") - - (options, args) = parser.parse_args () - if len(args) != 0: - parser.print_help() - raise SystemExit, 1 - - - src0 = gr.sig_source_c(master_clock/options.interp, - gr.GR_SIN_WAVE, - options.freq, - options.amplitude) - - - c2s = gr.complex_to_interleaved_short() - - stdout_sink = gr.file_descriptor_sink(gr.sizeof_short, 1) - - self.connect(src0, c2s, stdout_sink) - - -if __name__ == '__main__': - try: - my_top_block().run() - except KeyboardInterrupt: - pass diff --git a/usrp2/host/apps/gpio.cc b/usrp2/host/apps/gpio.cc deleted file mode 100644 index 2fee7e761..000000000 --- a/usrp2/host/apps/gpio.cc +++ /dev/null @@ -1,47 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <usrp2/usrp2.h> -#include <iostream> -#include <cstdio> - -int -main(int argc, char **argv) -{ - usrp2::usrp2::sptr u2 = usrp2::usrp2::make("eth0"); - - // Set io_tx[15] as FPGA output - u2->set_gpio_ddr(usrp2::GPIO_TX_BANK, 0x8000, 0x8000); - - // Set io_tx[15] under host sofware control - u2->set_gpio_sels(usrp2::GPIO_TX_BANK, "s..............."); - - // Write pins - uint16_t v = 0x8765; - u2->write_gpio(usrp2::GPIO_TX_BANK, v, 0x8000); - - // Read back - v = 0; - u2->read_gpio(usrp2::GPIO_TX_BANK, &v); - printf("TX GPIO read: %04X\n", v); - return 0; -} diff --git a/usrp2/host/apps/rx_streaming_samples.cc b/usrp2/host/apps/rx_streaming_samples.cc deleted file mode 100644 index 8479ae1b2..000000000 --- a/usrp2/host/apps/rx_streaming_samples.cc +++ /dev/null @@ -1,373 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <usrp2/usrp2.h> -#include <usrp2/strtod_si.h> -#include <usrp2/copiers.h> -#include <usrp2/rx_nop_handler.h> -#include <gruel/realtime.h> -#include <sys/time.h> -#include <iostream> -#include <cstdio> -#include <string.h> -#include <boost/scoped_ptr.hpp> -#include <boost/shared_ptr.hpp> -#include <stdexcept> -#include <signal.h> - -static volatile bool signaled = false; - -static void -sig_handler(int sig) -{ - signaled = true; -} - -static void -install_sig_handler(int signum, - void (*new_handler)(int)) -{ - struct sigaction new_action; - memset (&new_action, 0, sizeof (new_action)); - - new_action.sa_handler = new_handler; - sigemptyset (&new_action.sa_mask); - new_action.sa_flags = 0; - - if (sigaction (signum, &new_action, 0) < 0){ - perror ("sigaction (install new)"); - throw std::runtime_error ("sigaction"); - } -} - -// ------------------------------------------------------------------------ - -// FIXME make this a template - -class file_writer_16sc : public usrp2::rx_nop_handler -{ - FILE *d_fp; - std::string d_filename; - -public: - - file_writer_16sc(const std::string &filename, uint64_t max_samples) - : usrp2::rx_nop_handler(max_samples), d_filename(filename) - { - d_fp = fopen(filename.c_str(), "wb"); - if (d_fp == 0){ - perror(filename.c_str()); - throw std::invalid_argument(filename); - } - } - - ~file_writer_16sc(); - - bool - operator()(const uint32_t *items, size_t nitems, const usrp2::rx_metadata *metadata) - { - bool ok = rx_nop_handler::operator()(items, nitems, metadata); - - size_t host_nitems = nitems; - std::complex<int16_t> host_items[host_nitems]; - - usrp2::copy_u2_16sc_to_host_16sc(nitems, items, host_items); - - size_t n = 0; - while (n < host_nitems){ - size_t r = fwrite(&host_items[n], sizeof(host_items[0]), host_nitems - n, d_fp); - n += r; - if (r == 0){ // out of space? - d_err = true; - perror(d_filename.c_str()); - ok = false; - break; - } - } - - return ok; - } -}; - -file_writer_16sc::~file_writer_16sc() -{ - fclose(d_fp); -} - -// ------------------------------------------------------------------------ - -class file_writer_32fc : public usrp2::rx_nop_handler -{ - FILE *d_fp; - std::string d_filename; - -public: - - file_writer_32fc(const std::string &filename, uint64_t max_samples) - : usrp2::rx_nop_handler(max_samples), d_filename(filename) - { - d_fp = fopen(filename.c_str(), "wb"); - if (d_fp == 0){ - perror(filename.c_str()); - throw std::invalid_argument(filename); - } - } - - ~file_writer_32fc(); - - bool - operator()(const uint32_t *items, size_t nitems, const usrp2::rx_metadata *metadata) - { - bool ok = rx_nop_handler::operator()(items, nitems, metadata); - - size_t host_nitems = nitems; - std::complex<float> host_items[host_nitems]; - - usrp2::copy_u2_16sc_to_host_32fc(nitems, items, host_items); - - size_t n = 0; - while (n < host_nitems){ - size_t r = fwrite(&host_items[n], sizeof(host_items[0]), host_nitems - n, d_fp); - n += r; - if (r == 0){ // out of space? - d_err = true; - perror(d_filename.c_str()); - ok = false; - break; - } - } - - return ok; - } -}; - -file_writer_32fc::~file_writer_32fc() -{ - fclose(d_fp); -} - -// ------------------------------------------------------------------------ - -static void -usage(const char *progname) -{ - const char *p = strrchr(progname, '/'); // drop leading directory path - if (p) - p++; - - if (strncmp(p, "lt-", 3) == 0) // drop lt- libtool prefix - p += 3; - - fprintf(stderr, "Usage: %s [options]\n\n", p); - fprintf(stderr, "Options:\n"); - fprintf(stderr, " -h show this message and exit\n"); - fprintf(stderr, " -e ETH_INTERFACE specify ethernet interface [default=eth0]\n"); - fprintf(stderr, " -m MAC_ADDR mac address of USRP2 HH:HH [default=first one found]\n"); - fprintf(stderr, " -f FREQUENCY specify receive center frequency in Hz [default=0.0]\n"); - fprintf(stderr, " -d DECIM specify receive decimation rate [default=5]\n"); - fprintf(stderr, " -g GAIN specify receive daughterboard gain [default=0]\n"); - fprintf(stderr, " -N NSAMPLES specify number of samples to receive [default=infinite]\n"); - fprintf(stderr, " -o OUTPUT_FILENAME specify file to receive samples [default=none]\n"); - fprintf(stderr, " -s write complex<short> [default=complex<float>]\n"); - fprintf(stderr, " -v verbose output\n"); -} - -int -main(int argc, char **argv) -{ - // options and their defaults - const char *interface = "eth0"; - const char *mac_addr_str = ""; - double rx_freq = 0.0; - int rx_decim = 5; - double rx_gain = 0.0; - uint64_t nsamples = 0; - bool output_shorts = false; - char *output_filename = 0; - bool verbose = false; - - int ch; - - while ((ch = getopt(argc, argv, "he:m:f:d:g:N:o:sv")) != EOF){ - double tmp; - switch (ch){ - - case 'e': - interface = optarg; - break; - - case 'm': - mac_addr_str = optarg; - break; - - case 'f': - if (!strtod_si(optarg, &rx_freq)) { - std::cerr << "invalid number: " << optarg << std::endl; - usage(argv[0]); - exit(1); - } - break; - - case 'g': - if (!strtod_si(optarg, &rx_gain)) { - std::cerr << "invalid number: " << optarg << std::endl; - usage(argv[0]); - exit(1); - } - break; - - case 'd': - rx_decim = strtol(optarg, 0, 0); - if (rx_decim < 4 or rx_decim > 512) { - std::cerr << "invalid decimation rate: " << optarg << std::endl; - usage(argv[0]); - exit(1); - } - break; - - case 'N': - if (!strtod_si(optarg, &tmp)) { - std::cerr << "invalid number: " << optarg << std::endl; - usage(argv[0]); - exit(1); - } - nsamples = static_cast<uint64_t>(tmp); - break; - - case 's': - output_shorts = true; - break; - - case 'o': - output_filename = optarg; - break; - - case 'v': - verbose = true; - break; - - case 'h': - default: - usage(argv[0]); - exit(1); - } - } - - - install_sig_handler(SIGINT, sig_handler); - - usrp2::rx_nop_handler::sptr handler; - - if (output_filename){ - if (output_shorts) - handler = usrp2::rx_nop_handler::sptr(new file_writer_16sc(output_filename, nsamples)); - else - handler = usrp2::rx_nop_handler::sptr(new file_writer_32fc(output_filename, nsamples)); - } - else - handler = usrp2::rx_nop_handler::sptr(new usrp2::rx_nop_handler(nsamples)); - - gruel::rt_status_t rt = gruel::enable_realtime_scheduling(); - if (rt != gruel::RT_OK) - std::cerr << "Failed to enable realtime scheduling" << std::endl; - - usrp2::usrp2::sptr u2 = usrp2::usrp2::make(interface, mac_addr_str); - - // FIXME in case it was left running... - if (!u2->stop_rx_streaming()){ - fprintf(stderr, "stop_rx_streaming failed\n"); - } - - if (!u2->set_rx_gain(rx_gain)){ - fprintf(stderr, "set_rx_gain(%f) failed\n", rx_gain); - exit(1); - } - - usrp2::tune_result tr; - if (!u2->set_rx_center_freq(rx_freq, &tr)){ - fprintf(stderr, "set_rx_center_freq(%g) failed\n", rx_freq); - exit(1); - } - - if (verbose){ - printf("USRP2 MAC address: %s\n\n", u2->mac_addr().c_str()); - printf("Daughterboard configuration:\n"); - printf(" baseband_freq=%f\n", tr.baseband_freq); - printf(" ddc_freq=%f\n", tr.dxc_freq); - printf(" residual_freq=%f\n", tr.residual_freq); - printf(" inverted=%s\n\n", tr.spectrum_inverted ? "yes" : "no"); - } - - if (!u2->set_rx_decim(rx_decim)) { - fprintf(stderr, "set_rx_decim(%d) failed\n", rx_decim); - exit(1); - } - - if (verbose) - printf("USRP2 using decimation rate of %d\n", rx_decim); - - if (!u2->start_rx_streaming(0)){ - fprintf(stderr, "start_rx_streaming failed\n"); - exit(1); - } - - if (verbose) { - if (nsamples > 0) - printf("Receiving %zd samples\n\n", nsamples); - else - printf("Receiving infinite samples\n\n"); - } - - struct timeval start, end; - gettimeofday(&start, 0); - - while (!signaled && - !handler->has_errored_p() && - !handler->has_finished_p()) { - bool ok = u2->rx_samples(0, handler.get()); - if (!ok){ - fprintf(stderr, "u2->rx_samples failed\n"); - return 1; - } - } - - gettimeofday(&end, 0); - long n_usecs = end.tv_usec-start.tv_usec; - long n_secs = end.tv_sec-start.tv_sec; - double elapsed = (double)n_secs + (double)n_usecs*1e-6; - double mbs = handler->nsamples()*sizeof(uint32_t)/elapsed/1e6; - double pps = handler->nframes()/elapsed; - - u2->stop_rx_streaming(); - - if (verbose){ - printf("\nCopy handler called %li times.\n", handler->nframes()); - printf("Copy handler called with %li bytes.\n\n", handler->nsamples()*sizeof(uint32_t)); - printf("Elapsed time was %5.3f seconds.\n", elapsed); - printf("Packet rate was %1.0f pkts/sec.\n", pps); - printf("Approximate throughput was %5.2f MB/sec.\n", mbs); - printf("Total instances of overruns was %d.\n", u2->rx_overruns()); - printf("Total missing frames was %d.\n", u2->rx_missing()); - } - - return 0; -} diff --git a/usrp2/host/apps/stdin_int32_fft.py b/usrp2/host/apps/stdin_int32_fft.py deleted file mode 100755 index 1596fa00d..000000000 --- a/usrp2/host/apps/stdin_int32_fft.py +++ /dev/null @@ -1,201 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2005,2007,2008,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, gru -from gnuradio import eng_notation -from gnuradio.eng_option import eng_option -from gnuradio.wxgui import stdgui2, fftsink2, waterfallsink2, scopesink2, form, slider -from optparse import OptionParser -import wx -import sys -import numpy - - -class app_top_block(stdgui2.std_top_block): - def __init__(self, frame, panel, vbox, argv): - stdgui2.std_top_block.__init__(self, frame, panel, vbox, argv) - - self.frame = frame - self.panel = panel - - parser = OptionParser(option_class=eng_option) - 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("-W", "--waterfall", action="store_true", default=False, - help="Enable waterfall display") - parser.add_option("-S", "--oscilloscope", action="store_true", default=False, - help="Enable oscilloscope display") - (options, args) = parser.parse_args() - if len(args) != 0: - parser.print_help() - sys.exit(1) - self.options = options - self.options.gain = 1.0 - self.show_debug_info = True - - - input_rate = 100e6 / options.decim - - self.src = gr.file_descriptor_source(gr.sizeof_short, 0, False); - self.s2c = gr.interleaved_short_to_complex() - - if options.waterfall: - self.scope = \ - waterfallsink2.waterfall_sink_c (panel, fft_size=1024, sample_rate=input_rate) - elif options.oscilloscope: - self.scope = scopesink2.scope_sink_c(panel, sample_rate=input_rate) - else: - self.scope = fftsink2.fft_sink_c (panel, fft_size=1024, y_divs=12, sample_rate=input_rate,ref_level=110,fft_rate=20) - - self.connect(self.src, self.s2c, self.scope) - - self._build_gui(vbox) - self._setup_events() - - # set initial values - - if options.freq is None: - # if no freq was specified, use the mid-point - options.freq = 0.0 - - if self.show_debug_info: - self.myform['decim'].set_value(self.options.decim) - - - def _set_status_msg(self, msg): - self.frame.GetStatusBar().SetStatusText(msg, 0) - - def _build_gui(self, vbox): - - def _form_set_freq(kv): - return self.set_freq(kv['freq']) - - vbox.Add(self.scope.win, 10, wx.EXPAND) - - # add control area at the bottom - self.myform = myform = form.form() - hbox = wx.BoxSizer(wx.HORIZONTAL) - hbox.Add((5,0), 0, 0) - myform['freq'] = form.float_field( - parent=self.panel, sizer=hbox, label="Center freq", weight=1, - callback=myform.check_input_and_call(_form_set_freq, self._set_status_msg)) - - hbox.Add((5,0), 0, 0) - vbox.Add(hbox, 0, wx.EXPAND) - - self._build_subpanel(vbox) - - def _build_subpanel(self, vbox_arg): - # build a secondary information panel (sometimes hidden) - - # FIXME figure out how to have this be a subpanel that is always - # created, but has its visibility controlled by foo.Show(True/False) - - def _form_set_decim(kv): - return self.set_decim(kv['decim']) - - if not(self.show_debug_info): - return - - panel = self.panel - vbox = vbox_arg - myform = self.myform - - #panel = wx.Panel(self.panel, -1) - #vbox = wx.BoxSizer(wx.VERTICAL) - - hbox = wx.BoxSizer(wx.HORIZONTAL) - hbox.Add((5,0), 0) - - myform['decim'] = form.int_field( - parent=panel, sizer=hbox, label="Decim", - callback=myform.check_input_and_call(_form_set_decim, self._set_status_msg)) - - hbox.Add((5,0), 0) - vbox.Add(hbox, 0, wx.EXPAND) - - - def set_freq(self, target_freq): - """ - Set the center frequency we're interested in. - - @param target_freq: frequency in Hz - @rypte: bool - - Tuning is a two step process. First we ask the front-end to - tune as close to the desired frequency as it can. Then we use - the result of that operation and our target_frequency to - determine the value for the digital down converter. - """ - - if True: - self.myform['freq'].set_value(target_freq) # update displayed value - if not self.options.waterfall and not self.options.oscilloscope: - self.scope.set_baseband_freq(target_freq) - return True - - return False - - def set_gain(self, gain): - self.myform['gain'].set_value(gain) # update displayed value - - def set_decim(self, decim): - input_rate = 100e6 / self.options.decim - self.scope.set_sample_rate(input_rate) - if self.show_debug_info: # update displayed values - self.myform['decim'].set_value(self.u.decim_rate()) - return ok - - def _setup_events(self): - if not self.options.waterfall and not self.options.oscilloscope: - self.scope.win.Bind(wx.EVT_LEFT_DCLICK, self.evt_left_dclick) - - def evt_left_dclick(self, event): - (ux, uy) = self.scope.win.GetXY(event) - if event.CmdDown(): - # Re-center on maximum power - points = self.scope.win._points - if self.scope.win.peak_hold: - if self.scope.win.peak_vals is not None: - ind = numpy.argmax(self.scope.win.peak_vals) - else: - ind = int(points.shape()[0]/2) - else: - ind = numpy.argmax(points[:,1]) - (freq, pwr) = points[ind] - target_freq = freq/self.scope.win._scale_factor - print ind, freq, pwr - self.set_freq(target_freq) - else: - # Re-center on clicked frequency - target_freq = ux/self.scope.win._scale_factor - self.set_freq(target_freq) - - -def main (): - app = stdgui2.stdapp(app_top_block, "USRP FFT", nstatus=1) - app.MainLoop() - -if __name__ == '__main__': - main () diff --git a/usrp2/host/apps/streaming_fft.py b/usrp2/host/apps/streaming_fft.py deleted file mode 100755 index 4d341497a..000000000 --- a/usrp2/host/apps/streaming_fft.py +++ /dev/null @@ -1,76 +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 this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# - -import os -import os.path -import sys -from gnuradio.eng_option import eng_option -from optparse import OptionParser - -def main(): - parser = OptionParser(option_class=eng_option) - 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=0.0, - help="set frequency to FREQ", metavar="FREQ") - parser.add_option("-g", "--gain", type="string", default=None, - help="set gain to GAIN [default=%default]") - parser.add_option("-W", "--waterfall", action="store_true", default=False, - help="Enable waterfall display") - parser.add_option("-S", "--oscilloscope", action="store_true", default=False, - help="Enable oscilloscope display") - parser.add_option("-F", "--samples-per-frame", type="int", default=250, - help="[default=%default]") - parser.add_option("-e", "--eth", default="eth0", - help="specify ethernet interface [default=%default]") - - (options, args) = parser.parse_args() - if len(args) != 0: - parser.print_help() - sys.exit(1) - - - path = os.path.dirname(sys.argv[0]) - if path == '': - path = '.' - - - display_type = '' - if options.waterfall: - display_type = '-W' - if options.oscilloscope: - display_type = '-S' - - gain_clause = '' - if options.gain: - gain_clause = '-g ' + options.gain - - # FIXME: restore -F - cmd = "%s/rx_streaming_samples -s -e %s -f %g -d %d %s -o /proc/self/fd/1 | %s/stdin_int32_fft.py %s -f %g -d %d" % ( - path, options.eth, options.freq, options.decim, gain_clause, - path, display_type, options.freq, options.decim) - - print cmd - os.system(cmd) - - -if __name__ == '__main__': - main() diff --git a/usrp2/host/apps/test.sh b/usrp2/host/apps/test.sh deleted file mode 100755 index c533c3339..000000000 --- a/usrp2/host/apps/test.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -sudo ./rx_streaming_samples -d 4 -v -N 100M - diff --git a/usrp2/host/apps/test_mimo_tx.cc b/usrp2/host/apps/test_mimo_tx.cc deleted file mode 100644 index f52bfd582..000000000 --- a/usrp2/host/apps/test_mimo_tx.cc +++ /dev/null @@ -1,311 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2008,2009 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -/* - * This is a down and dirty test program that confirms that the we can - * coherently transmit different signals to two USRP2s connected via a - * mimo cable. It ignores most of its command line arguments, and - * requires that special purpose firmware be installed in the two - * USRP2s. The one connected to the ethernet must be running - * mimo_tx.bin The other must be running mimo_tx_slave.bin. - * - * Don't use this as a model for how s/w should be written :-) - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include <usrp2/usrp2.h> -#include <usrp2/strtod_si.h> -#include <iostream> -#include <cstdio> -#include <complex> -#include <getopt.h> -#include <gruel/realtime.h> -#include <signal.h> -#include <string.h> -#include <stdexcept> -#include <math.h> - - -typedef std::complex<float> fcomplex; - -static volatile bool signaled = false; - -void -gen_and_send(usrp2::usrp2::sptr u2, int chan, - double *ph, double ph_incr, int nsamples); - - -static void -sig_handler(int sig) -{ - signaled = true; -} - -static void -install_sig_handler(int signum, - void (*new_handler)(int)) -{ - struct sigaction new_action; - memset (&new_action, 0, sizeof (new_action)); - - new_action.sa_handler = new_handler; - sigemptyset (&new_action.sa_mask); - new_action.sa_flags = 0; - - if (sigaction (signum, &new_action, 0) < 0){ - perror ("sigaction (install new)"); - throw std::runtime_error ("sigaction"); - } -} - - -static const char * -prettify_progname(const char *progname) // that's probably almost a word ;) -{ - const char *p = strrchr(progname, '/'); // drop leading directory path - if (p) - p++; - - if (strncmp(p, "lt-", 3) == 0) // drop lt- libtool prefix - p += 3; - - return p; -} - -static void -usage(const char *progname) -{ - fprintf(stderr, "Usage: %s [options]\n\n", prettify_progname(progname)); - fprintf(stderr, "Options:\n"); - fprintf(stderr, " -h show this message and exit\n"); - fprintf(stderr, " -e ETH_INTERFACE specify ethernet interface [default=eth0]\n"); - fprintf(stderr, " -m MAC_ADDR mac address of USRP2 HH:HH [default=first one found]\n"); - fprintf(stderr, " -I INPUT_FILE set input filename [default=stdin]\n"); - fprintf(stderr, " -r repeat. When EOF of input file is reached, seek to beginning\n"); - fprintf(stderr, " -f FREQ set frequency to FREQ [default=0]\n"); - fprintf(stderr, " -i INTERP set interpolation rate to INTERP [default=32]\n"); - fprintf(stderr, " -g gain set tx gain\n"); - fprintf(stderr, " -S SCALE fpga scaling factor for I & Q [default=256]\n"); -} - -#define GAIN_NOT_SET (-1000) -#define MAX_SAMPLES (371) - -int -main(int argc, char **argv) -{ - const char *interface = "eth0"; - const char *input_filename = 0; - bool repeat = false; - const char *mac_addr_str = ""; - double freq = 0; - int32_t interp = 32; - int32_t samples_per_frame = MAX_SAMPLES; - int32_t scale = -1; - double gain = GAIN_NOT_SET; - - int ch; - double tmp; - - - while ((ch = getopt(argc, argv, "he:m:I:rf:i:S:F:g:")) != EOF){ - switch (ch){ - - case 'e': - interface = optarg; - break; - - case 'm': - mac_addr_str = optarg; -#if 0 - if (!usrp2_basic::parse_mac_addr(optarg, &mac_addr)){ - std::cerr << "invalid mac addr: " << optarg << std::endl; - usage(argv[0]); - return 1; - } -#endif - break; - - case 'I': - input_filename = optarg; - break; - - case 'r': - repeat = true; - break; - - case 'f': - if (!strtod_si(optarg, &freq)){ - std::cerr << "invalid number: " << optarg << std::endl; - usage(argv[0]); - return 1; - } - break; - - case 'F': - samples_per_frame = strtol(optarg, 0, 0); - break; - - case 'i': - interp = strtol(optarg, 0, 0); - break; - - case 'S': - if (!strtod_si(optarg, &tmp)){ - std::cerr << "invalid number: " << optarg << std::endl; - usage(argv[0]); - return 1; - } - scale = static_cast<int32_t>(tmp); - break; - - case 'h': - default: - usage(argv[0]); - return 1; - } - } - - - if (argc - optind != 0){ - usage(argv[0]); - return 1; - } - - if (samples_per_frame < 9 || samples_per_frame > MAX_SAMPLES){ - std::cerr << prettify_progname(argv[0]) - << ": samples_per_frame is out of range. " - << "Must be in [9, " << MAX_SAMPLES << "].\n"; - usage(argv[0]); - return 1; - } - - - FILE *fp = 0; - if (input_filename == 0) - fp = stdin; - else { - fp = fopen(input_filename, "rb"); - if (fp == 0){ - perror(input_filename); - return 1; - } - } - - install_sig_handler(SIGINT, sig_handler); - - - gruel::rt_status_t rt = gruel::enable_realtime_scheduling(); - if (rt != gruel::RT_OK) - std::cerr << "Failed to enable realtime scheduling" << std::endl; - - - usrp2::usrp2::sptr u2 = usrp2::usrp2::make(interface, mac_addr_str); - -#if 0 - if (gain != GAIN_NOT_SET){ - if (!u2->set_tx_gain(gain)){ - std::cerr << "set_tx_gain failed\n"; - return 1; - } - } - - usrp2::tune_result tr; - if (!u2->set_tx_center_freq(freq, &tr)){ - fprintf(stderr, "set_tx_center_freq(%g) failed\n", freq); - return 1; - } - - printf("Daughterboard configuration:\n"); - printf(" baseband_freq=%f\n", tr.baseband_freq); - printf(" duc_freq=%f\n", tr.dxc_freq); - printf(" residual_freq=%f\n", tr.residual_freq); - printf(" inverted=%s\n\n", tr.spectrum_inverted ? "yes" : "no"); - - if (!u2->set_tx_interp(interp)){ - fprintf(stderr, "set_tx_interp(%d) failed\n", interp); - return 1; - } - - if (scale != -1){ - if (!u2->set_tx_scale_iq(scale, scale)){ - std::cerr << "set_tx_scale_iq failed\n"; - return 1; - } - } -#endif - - double baseband_rate = 100e6 / 32; - - double ph0 = 0; - double ph1 = 0; - - double ph0_incr = 7.5e3/baseband_rate * 2 * M_PI; - double ph1_incr = 7.5e3/baseband_rate * 2 * M_PI; - - while (!signaled){ - - gen_and_send(u2, 0, &ph0, ph0_incr, samples_per_frame); - gen_and_send(u2, 1, &ph1, ph1_incr, samples_per_frame); - - } - - return 0; -} - -void -gen_and_send(usrp2::usrp2::sptr u2, int chan, - double *ph_ptr, double ph_incr, int nsamples) -{ - double ph = *ph_ptr; - - std::complex<float> buf[MAX_SAMPLES]; - - usrp2::tx_metadata md; - md.timestamp = -1; - md.start_of_burst = 1; - md.send_now = 1; - - float ampl; - - if (chan == 0) - ampl = 0.5; - else - ampl = 0.75; - - - for (int i = 0; i < nsamples; i++){ -#if 0 - float s, c; - sincosf((float) ph, &s, &c); - buf[i] = std::complex<float>(s * ampl, c * ampl); - ph += ph_incr; -#else - buf[i] = std::complex<float>(ampl, 0); -#endif - } - - if (!u2->tx_32fc(chan, buf, nsamples, &md)){ - fprintf(stderr, "tx_32fc failed\n"); - } - - ph = fmod(ph, 2*M_PI); - *ph_ptr = ph; -} diff --git a/usrp2/host/apps/tx_samples.cc b/usrp2/host/apps/tx_samples.cc deleted file mode 100644 index 3e41bbf8d..000000000 --- a/usrp2/host/apps/tx_samples.cc +++ /dev/null @@ -1,269 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif -#include <usrp2/usrp2.h> -#include <usrp2/strtod_si.h> -#include <iostream> -#include <cstdio> -#include <complex> -#include <getopt.h> -#include <gruel/realtime.h> -#include <signal.h> -#include <string.h> -#include <stdexcept> - - -typedef std::complex<float> fcomplex; - -static volatile bool signaled = false; - -static void -sig_handler(int sig) -{ - signaled = true; -} - -static void -install_sig_handler(int signum, - void (*new_handler)(int)) -{ - struct sigaction new_action; - memset (&new_action, 0, sizeof (new_action)); - - new_action.sa_handler = new_handler; - sigemptyset (&new_action.sa_mask); - new_action.sa_flags = 0; - - if (sigaction (signum, &new_action, 0) < 0){ - perror ("sigaction (install new)"); - throw std::runtime_error ("sigaction"); - } -} - - -static const char * -prettify_progname(const char *progname) // that's probably almost a word ;) -{ - const char *p = strrchr(progname, '/'); // drop leading directory path - if (p) - p++; - - if (strncmp(p, "lt-", 3) == 0) // drop lt- libtool prefix - p += 3; - - return p; -} - -static void -usage(const char *progname) -{ - fprintf(stderr, "Usage: %s [options]\n\n", prettify_progname(progname)); - fprintf(stderr, "Options:\n"); - fprintf(stderr, " -h show this message and exit\n"); - fprintf(stderr, " -e ETH_INTERFACE specify ethernet interface [default=eth0]\n"); - fprintf(stderr, " -m MAC_ADDR mac address of USRP2 HH:HH [default=first one found]\n"); - fprintf(stderr, " -I INPUT_FILE set input filename [default=stdin]\n"); - fprintf(stderr, " -r repeat. When EOF of input file is reached, seek to beginning\n"); - fprintf(stderr, " -f FREQ set frequency to FREQ [default=0]\n"); - fprintf(stderr, " -i INTERP set interpolation rate to INTERP [default=32]\n"); - fprintf(stderr, " -g gain set tx gain\n"); - fprintf(stderr, " -S SCALE fpga scaling factor for I & Q [default=256]\n"); -} - -#define GAIN_NOT_SET (-1000) -#define MAX_SAMPLES (371) - -int -main(int argc, char **argv) -{ - const char *interface = "eth0"; - const char *input_filename = 0; - bool repeat = false; - const char *mac_addr_str = ""; - double freq = 0; - int32_t interp = 32; - int32_t samples_per_frame = MAX_SAMPLES; - int32_t scale = -1; - double gain = GAIN_NOT_SET; - - int ch; - double tmp; - - - while ((ch = getopt(argc, argv, "he:m:I:rf:i:S:F:g:")) != EOF){ - switch (ch){ - - case 'e': - interface = optarg; - break; - - case 'm': - mac_addr_str = optarg; -#if 0 - if (!usrp2_basic::parse_mac_addr(optarg, &mac_addr)){ - std::cerr << "invalid mac addr: " << optarg << std::endl; - usage(argv[0]); - return 1; - } -#endif - break; - - case 'I': - input_filename = optarg; - break; - - case 'r': - repeat = true; - break; - - case 'f': - if (!strtod_si(optarg, &freq)){ - std::cerr << "invalid number: " << optarg << std::endl; - usage(argv[0]); - return 1; - } - break; - - case 'F': - samples_per_frame = strtol(optarg, 0, 0); - break; - - case 'i': - interp = strtol(optarg, 0, 0); - break; - - case 'g': - gain = strtod(optarg, 0); - break; - - case 'S': - if (!strtod_si(optarg, &tmp)){ - std::cerr << "invalid number: " << optarg << std::endl; - usage(argv[0]); - return 1; - } - scale = static_cast<int32_t>(tmp); - break; - - case 'h': - default: - usage(argv[0]); - return 1; - } - } - - - if (argc - optind != 0){ - usage(argv[0]); - return 1; - } - - if (samples_per_frame < 9 || samples_per_frame > MAX_SAMPLES){ - std::cerr << prettify_progname(argv[0]) - << ": samples_per_frame is out of range. " - << "Must be in [9, " << MAX_SAMPLES << "].\n"; - usage(argv[0]); - return 1; - } - - - FILE *fp = 0; - if (input_filename == 0) - fp = stdin; - else { - fp = fopen(input_filename, "rb"); - if (fp == 0){ - perror(input_filename); - return 1; - } - } - - install_sig_handler(SIGINT, sig_handler); - - - gruel::rt_status_t rt = gruel::enable_realtime_scheduling(); - if (rt != gruel::RT_OK) - std::cerr << "Failed to enable realtime scheduling" << std::endl; - - - usrp2::usrp2::sptr u2 = usrp2::usrp2::make(interface, mac_addr_str); - - if (gain != GAIN_NOT_SET){ - if (!u2->set_tx_gain(gain)){ - std::cerr << "set_tx_gain failed\n"; - return 1; - } - } - - usrp2::tune_result tr; - if (!u2->set_tx_center_freq(freq, &tr)){ - fprintf(stderr, "set_tx_center_freq(%g) failed\n", freq); - return 1; - } - - printf("Daughterboard configuration:\n"); - printf(" baseband_freq=%f\n", tr.baseband_freq); - printf(" duc_freq=%f\n", tr.dxc_freq); - printf(" residual_freq=%f\n", tr.residual_freq); - printf(" inverted=%s\n\n", tr.spectrum_inverted ? "yes" : "no"); - - if (!u2->set_tx_interp(interp)){ - fprintf(stderr, "set_tx_interp(%d) failed\n", interp); - return 1; - } - - if (scale != -1){ - if (!u2->set_tx_scale_iq(scale, scale)){ - std::cerr << "set_tx_scale_iq failed\n"; - return 1; - } - } - - usrp2::tx_metadata md; - md.timestamp = -1; - md.start_of_burst = 1; - md.send_now = 1; - - while (!signaled){ - - std::complex<int16_t> samples[MAX_SAMPLES]; - - int r = fread(samples, sizeof(uint32_t), samples_per_frame, fp); - - // fprintf(stderr, "fread -> %d\n", r); - - if (r == 0){ - if (!repeat) - break; - if (fseek(fp, 0, SEEK_SET) == -1) - break; - } - - // FIXME if r < 9, pad to 9 for minimum packet size constraint - - if (!u2->tx_16sc(0, samples, r, &md)){ - fprintf(stderr, "tx_complex_int16 failed\n"); - break; - } - } - - return 0; -} diff --git a/usrp2/host/apps/usrp2_burn_mac_addr.cc b/usrp2/host/apps/usrp2_burn_mac_addr.cc deleted file mode 100644 index 6ee76c130..000000000 --- a/usrp2/host/apps/usrp2_burn_mac_addr.cc +++ /dev/null @@ -1,176 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <usrp2/usrp2.h> -#include <iostream> -#include <getopt.h> -#include <string.h> -#include <time.h> -#include <stdio.h> -#include <signal.h> -#include <stdexcept> - - -static volatile bool signaled = false; - -static void -sig_handler(int sig) -{ - signaled = true; -} - -static void -install_sig_handler(int signum, - void (*new_handler)(int)) -{ - struct sigaction new_action; - memset (&new_action, 0, sizeof (new_action)); - - new_action.sa_handler = new_handler; - sigemptyset (&new_action.sa_mask); - new_action.sa_flags = 0; - - if (sigaction (signum, &new_action, 0) < 0){ - perror ("sigaction (install new)"); - throw std::runtime_error ("sigaction"); - } -} - - -static void -usage(const char *progname) -{ - fprintf(stderr, "usage: %s [-e ethN] [-m old_mac_addr] new_mac_addr\n", - progname); - fprintf(stderr, " old_mac_addr defaults to 00:50:c2:85:3f:ff\n"); - fprintf(stderr, " new_mac_address must be HH:HH or HH:HH:HH:HH:HH:HH\n"); -} - -static bool -check_mac_addr_syntax(const std::string &s) -{ - unsigned char addr[6]; - - addr[0] = 0x00; // Matt's IAB - addr[1] = 0x50; - addr[2] = 0xC2; - addr[3] = 0x85; - addr[4] = 0x30; - addr[5] = 0x00; - - int len = s.size(); - - switch (len){ - - case 5: - return sscanf(s.c_str(), "%hhx:%hhx", &addr[4], &addr[5]) == 2; - - case 17: - return sscanf(s.c_str(), "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", - &addr[0], &addr[1], &addr[2], - &addr[3], &addr[4], &addr[5]) == 6; - default: - return false; - } - - return true; -} - - -int -main(int argc, char **argv) -{ - int ch; - const char *interface = "eth0"; - const char *old_mac_addr = "00:50:c2:85:3f:ff"; - const char *new_mac_addr = 0; - - while ((ch = getopt(argc, argv, "he:m:")) != EOF){ - switch (ch){ - case 'e': - interface = optarg; - break; - - case 'm': - old_mac_addr = optarg; - break; - - case 'h': - default: - usage(argv[0]); - exit(1); - } - } - - if (argc - optind != 1){ - usage(argv[0]); - exit(1); - } - - new_mac_addr = argv[optind]; - - if (!check_mac_addr_syntax(old_mac_addr)){ - fprintf(stderr, "invalid mac address: %s\n", old_mac_addr); - exit(1); - } - if (!check_mac_addr_syntax(new_mac_addr)){ - fprintf(stderr, "invalid mac address: %s\n", new_mac_addr); - exit(1); - } - - install_sig_handler(SIGINT, sig_handler); - - usrp2::usrp2::sptr u2; - - try { - u2 = usrp2::usrp2::make(interface, old_mac_addr); - } - catch (std::exception const &e){ - std::cerr << e.what() << std::endl; - return 1; - } - - if (!u2->burn_mac_addr(new_mac_addr)){ - std::cerr << "Failed to burn mac address: " - << new_mac_addr << std::endl; - return 1; - } - - u2.reset(); // close - - // wait 250 ms - struct timespec ts; - ts.tv_sec = 0; - ts.tv_nsec = 250000000; - nanosleep(&ts, 0); - - try { - u2 = usrp2::usrp2::make(interface, new_mac_addr); - } - catch (std::exception const &e){ - std::cerr << "Failed to connect to USRP2 using new addr: " - << new_mac_addr << std::endl; - std::cerr << e.what() << std::endl; - return 1; - } - - return 0; -} diff --git a/usrp2/host/include/.gitignore b/usrp2/host/include/.gitignore deleted file mode 100644 index b336cc7ce..000000000 --- a/usrp2/host/include/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/Makefile -/Makefile.in diff --git a/usrp2/host/include/Makefile.am b/usrp2/host/include/Makefile.am deleted file mode 100644 index e2f7282b1..000000000 --- a/usrp2/host/include/Makefile.am +++ /dev/null @@ -1,23 +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 this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# - -include $(top_srcdir)/Makefile.common - -SUBDIRS = usrp2 diff --git a/usrp2/host/include/usrp2/.gitignore b/usrp2/host/include/usrp2/.gitignore deleted file mode 100644 index b336cc7ce..000000000 --- a/usrp2/host/include/usrp2/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/Makefile -/Makefile.in diff --git a/usrp2/host/include/usrp2/Makefile.am b/usrp2/host/include/usrp2/Makefile.am deleted file mode 100644 index 08fdcde33..000000000 --- a/usrp2/host/include/usrp2/Makefile.am +++ /dev/null @@ -1,35 +0,0 @@ -# -# Copyright 2008 Free Software Foundation, Inc. -# -# This program 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 of the License, or -# (at your option) any later version. -# -# This program 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/>. -# - -include $(top_srcdir)/Makefile.common - -INCLUDES = $(STD_DEFINES_AND_INCLUDES) $(CPPUNIT_INCLUDES) - -usrp2includedir = $(includedir)/usrp2 - -usrp2include_HEADERS = \ - copiers.h \ - copy_handler.h \ - data_handler.h \ - metadata.h \ - mimo_config.h \ - rx_nop_handler.h \ - rx_sample_handler.h \ - strtod_si.h \ - tune_result.h \ - usrp2.h \ - usrp2_cdefs.h diff --git a/usrp2/host/include/usrp2/copiers.h b/usrp2/host/include/usrp2/copiers.h deleted file mode 100644 index e98126f65..000000000 --- a/usrp2/host/include/usrp2/copiers.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifndef INCLUDED_USRP2_COPIERS_H -#define INCLUDED_USRP2_COPIERS_H - -#include <complex> -#include <stdint.h> - -namespace usrp2 { - - // FIXME we may want to rework this, but this will get us on the air - - /* - * ---------------------------------------------------------------- - * Copy and convert from USRP2 wire format to host format - * ---------------------------------------------------------------- - */ - - void - copy_u2_16sc_to_host_16sc(size_t nitems, - const uint32_t *items, - std::complex<int16_t> *host_items); - - void - copy_u2_16sc_to_host_32fc(size_t nitems, - const uint32_t *items, - std::complex<float> *host_items); - - /* - * ---------------------------------------------------------------- - * Copy and convert from host format to USRP2 wire format - * ---------------------------------------------------------------- - */ - - void - copy_host_16sc_to_u2_16sc(size_t nitems, - const std::complex<int16_t> *host_items, - uint32_t *items); - - void - copy_host_32fc_to_u2_16sc(size_t nitems, - const std::complex<float> *host_items, - uint32_t *items); -} - - -#endif /* INCLUDED_USRP2_COPIERS_H */ diff --git a/usrp2/host/include/usrp2/copy_handler.h b/usrp2/host/include/usrp2/copy_handler.h deleted file mode 100644 index aef14cac8..000000000 --- a/usrp2/host/include/usrp2/copy_handler.h +++ /dev/null @@ -1,51 +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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#ifndef INCLUDED_COPY_HANDLER_H -#define INCLUDED_COPY_HANDLER_H - -#include <usrp2/data_handler.h> -#include <boost/utility.hpp> - -namespace usrp2 { - - class copy_handler : public data_handler, boost::noncopyable - { - uint8_t *d_dest; // next write pointer - size_t d_space; // space left in destination buffer - size_t d_bytes; // total bytes copied - size_t d_times; // number of times invoked - - public: - copy_handler(void *dest, size_t len); - ~copy_handler(); - - virtual data_handler::result operator()(const void *base, size_t len); - - size_t bytes() const { return d_bytes; } - size_t times() const { return d_times; } - - static const size_t MIN_COPY_LEN = 1484; // FIXME: calculate eth packet - thdr - bool full() const { return d_space < MIN_COPY_LEN; } - }; - -} // namespace usrp2 - -#endif /* INCLUDED_COPY_HANDLER_H */ diff --git a/usrp2/host/include/usrp2/data_handler.h b/usrp2/host/include/usrp2/data_handler.h deleted file mode 100644 index 7317b38af..000000000 --- a/usrp2/host/include/usrp2/data_handler.h +++ /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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#ifndef INCLUDED_DATA_HANDLER_H -#define INCLUDED_DATA_HANDLER_H - -#include <stdint.h> -#include <stddef.h> - -namespace usrp2 { - - /*! - * \brief Abstract function object called to handle received data blocks. - */ - class data_handler - { - public: - - enum result_bits { - RELEASE = 0x0000, //< OK to release data (opposite of KEEP) - KEEP = 0x0001, //< do not discard data - DONE = 0x0002, //< do not call this object again - }; - - typedef int result; //< bitmask of result_bits - - /*! - * \param base points to the beginning of the data - * \param len is the length in bytes of the data - * \returns bitmask composed of DONE, KEEP - */ - virtual result operator()(const void *base, size_t len) = 0; - virtual ~data_handler(); - }; - -} // namespace usrp2 - -#endif /* INCLUDED_DATA_HANDLER_H */ diff --git a/usrp2/host/include/usrp2/metadata.h b/usrp2/host/include/usrp2/metadata.h deleted file mode 100644 index 8a95c3859..000000000 --- a/usrp2/host/include/usrp2/metadata.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ -#ifndef INCLUDED_USRP2_METADATA_H -#define INCLUDED_USRP2_METADATA_H - -#include <stdint.h> - -namespace usrp2 { - - //! type of the timestamp returned from the USRP2 FPGA - typedef uint32_t fpga_timestamp; - - /*! - * \brief metadata associated with received frames - * \ingroup usrp2 - */ - struct rx_metadata { - uint32_t word0; //< debugging, extensions - fpga_timestamp timestamp; //< time that first sample of frame was received - unsigned int start_of_burst : 1; //< this frame is the start of a burst - unsigned int end_of_burst : 1; //< this frame is the end of a burst - unsigned int rx_overrun : 1; //< An Rx overrun occurred in the FPGA - // rssi - // agc_mode - - rx_metadata() : - word0(0), timestamp(0), start_of_burst(0), end_of_burst(0), rx_overrun(0) {} - }; - - /*! - * \brief metadata associated with transmitted frames - * \ingroup usrp2 - */ - struct tx_metadata { - fpga_timestamp timestamp; //< time to transmit first sample of frame - unsigned int send_now : 1; //< ignore timestamp, send now - unsigned int start_of_burst : 1; //< this frame is the start of a burst - unsigned int end_of_burst : 1; //< this frame is the end of a burst - // ... - - tx_metadata() : - timestamp(0), send_now(0), start_of_burst(0), end_of_burst(0) {} - }; - -}; // usrp2 - -#endif /* INCLUDED_USRP2_METADATA_H */ diff --git a/usrp2/host/include/usrp2/mimo_config.h b/usrp2/host/include/usrp2/mimo_config.h deleted file mode 100644 index a1e038f74..000000000 --- a/usrp2/host/include/usrp2/mimo_config.h +++ /dev/null @@ -1,50 +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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#ifndef INCLUDED_USRP2_MIMO_CONFIG_H -#define INCLUDED_USRP2_MIMO_CONFIG_H - -// FIXME: This duplicates the firmware usrp2_mimo_config.h file - -namespace usrp2 { - - static const int _MC_WE_LOCK = 0x0001; - static const int _MC_MIMO_CLK_INPUT = 0x0002; // else SMA input - - /* - * Derived masks (use these): - * - * We get our input from 1 of three places: - * Our free running oscilator, our SMA connector, or from the MIMO connector - */ - static const int MC_WE_DONT_LOCK = 0x0000; - static const int MC_WE_LOCK_TO_SMA = (_MC_WE_LOCK | 0); - static const int MC_WE_LOCK_TO_MIMO = (_MC_WE_LOCK | _MC_MIMO_CLK_INPUT); - - /* - * Independent of the source of the clock, we may or may not drive our - * clock onto the mimo connector. Note that there are dedicated clock - * signals in each direction, so disaster doesn't occurs if we're - * unnecessarily providing clock. - */ - static const int MC_PROVIDE_CLK_TO_MIMO = 0x0004; -} - -#endif /* INCLUDED_USRP2_MIMO_CONFIG_H */ diff --git a/usrp2/host/include/usrp2/rx_nop_handler.h b/usrp2/host/include/usrp2/rx_nop_handler.h deleted file mode 100644 index 68a254f31..000000000 --- a/usrp2/host/include/usrp2/rx_nop_handler.h +++ /dev/null @@ -1,130 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifndef INCLUDED_RX_NOP_HANDLER_H -#define INCLUDED_RX_NOP_HANDLER_H - -#include <usrp2/rx_sample_handler.h> -#include <boost/shared_ptr.hpp> - -/*! - * \ingroup usrp2 - * - * Base class for receive handlers that must copy into potentially limited - * range destination buffers. - * - * Maintains counters for number of items copied, times invoked, and test - * for whether maximum has been reached. - * - * Derived classes should override the () operator, but call this - * parent class method at some point at the start of their own operations. - */ - -namespace usrp2 { - - class rx_nop_handler : public rx_sample_handler - { - uint64_t d_max_samples; - uint64_t d_max_quantum; - uint64_t d_nsamples; - uint64_t d_nframes; - - protected: - bool d_err; - - public: - - // Shared pointer to an instance of this class - typedef boost::shared_ptr<rx_nop_handler> sptr; - - /*! - * Constructor - * - * \param max_samples Maximum number of samples to copy. Use zero for no maximum. - * \param max_quantum Maximum number of samples required to accept in one call. - * Use 0 to indicate no maximum. - */ - rx_nop_handler(uint64_t max_samples, uint64_t max_quantum=0) - : d_max_samples(max_samples), d_max_quantum(max_quantum), - d_nsamples(0), d_nframes(0), d_err(false) {} - - /*! - * Destructor. Derived classes must implement their own, non-inline destructor. - */ - virtual ~rx_nop_handler(); - - /*! - * \brief Returns number of frames this copier was called with - */ - uint64_t nframes() const { return d_nframes; } - - /*! - * \brief Returns actual number of samples copied - */ - uint64_t nsamples() const { return d_nsamples; } - - /*! - * \brief Returns maximum number of samples that will be copied - */ - uint64_t max_samples() const { return d_max_samples; } - - /*! - * Returns true if an error has occurred. Derived classes must set d_err to true - * when an error occurs in the () operator - */ - bool has_errored_p() const { return d_err; } - - /*! - * \brief Returns true if this instance has reached the maximum number of samples - */ - bool has_finished_p() const - { return d_max_samples == 0 ? false : d_nsamples >= d_max_samples-d_max_quantum; } - - - /*! - * Function operator invoked by USRP2 RX API. Derived classes must override this method - * but then invoke it at the start of their processing. This operator will always be - * called at least once. - * - * \param items points to the first 32-bit word of uninterpreted sample data in the frame. - * \param nitems is the number of entries in the frame in units of uint32_t's. - * \param metadata is the additional per frame data provided by the USRP2 FPGA. - * - * \p items points to the raw sample data received off of the ethernet. The data is - * packed into big-endian 32-bit unsigned ints for transport, but the actual format - * of the data is dependent on the current configuration of the USRP2. The most common - * format is 16-bit I & Q, with I in the top of the 32-bit word. - * - * \returns true if the object wants to be called again with new data; - * false if no additional data is wanted. - */ - virtual bool operator()(const uint32_t *items, size_t nitems, const rx_metadata *metadata) - { - // printf("W0: %08x TS: %08x\n", metadata->word0, metadata->timestamp); - // printf("I0: %08x\n", items[0]); - - d_nsamples += nitems; - d_nframes++; - - return !has_finished_p(); - } - }; - -} /* namespace usrp2 */ - -#endif /* INCLUDED_RX_NOP_HANDLER */ diff --git a/usrp2/host/include/usrp2/rx_sample_handler.h b/usrp2/host/include/usrp2/rx_sample_handler.h deleted file mode 100644 index a7fb7b641..000000000 --- a/usrp2/host/include/usrp2/rx_sample_handler.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ -#ifndef INCLUDED_USRP2_RX_SAMPLE_HANDLER_H -#define INCLUDED_USRP2_RX_SAMPLE_HANDLER_H - -#include <usrp2/metadata.h> -#include <stddef.h> - - -namespace usrp2 { - - /*! - * \brief Abstract function object called to handle received data blocks. - * \ingroup usrp2 - * - * An object derived from this class is passed to usrp2::rx_samples - * to process the received frames of samples. - */ - class rx_sample_handler { - public: - virtual ~rx_sample_handler(); - - /*! - * \param items points to the first 32-bit word of uninterpreted sample data in the frame. - * \param nitems is the number of entries in the frame in units of uint32_t's. - * \param metadata is the additional per frame data provided by the USRP2 FPGA. - * - * \p items points to the raw sample data received off of the ethernet. The data is - * packed into big-endian 32-bit unsigned ints for transport, but the actual format - * of the data is dependent on the current configuration of the USRP2. The most common - * format is 16-bit I & Q, with I in the top of the 32-bit word. - * - * This is the general purpose, low level interface and relies on other functions - * to handle all required endian-swapping and format conversion. \sa FIXME. - * - * \returns true if the object wants to be called again with new data; - * false if no additional data is wanted. - */ - virtual bool operator()(const uint32_t *items, size_t nitems, const rx_metadata *metadata) = 0; - }; - -}; - -#endif /* INCLUDED_RX_SAMPLE_HANDLER_H */ diff --git a/usrp2/host/include/usrp2/strtod_si.h b/usrp2/host/include/usrp2/strtod_si.h deleted file mode 100644 index 0a0f5a62c..000000000 --- a/usrp2/host/include/usrp2/strtod_si.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifndef INCLUDED_STRTOD_SI_H -#define INCLUDED_STRTOD_SI_H - -#include "usrp2_cdefs.h" -__U2_BEGIN_DECLS - - -/*! - * \brief convert string at s to double honoring any trailing SI suffixes - * - * \param[in] s is the string to convert - * \param[out] result is the converted value - * \returns non-zero iff conversion was successful. - */ -int strtod_si(const char *s, double *result); - -__U2_END_DECLS - - -#endif /* INCLUDED_STRTOD_SI_H */ - diff --git a/usrp2/host/include/usrp2/tune_result.h b/usrp2/host/include/usrp2/tune_result.h deleted file mode 100644 index 9fe6539da..000000000 --- a/usrp2/host/include/usrp2/tune_result.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifndef INCLUDED_USRP2_TUNE_RESULT_H -#define INCLUDED_USRP2_TUNE_RESULT_H - -namespace usrp2 { - - /* - * \ingroup usrp2 - */ - class tune_result - { - public: - // RF frequency that corresponds to DC in the IF - double baseband_freq; - - // frequency programmed into the DDC/DUC - double dxc_freq; - - // residual frequency (typically < 0.01 Hz) - double residual_freq; - - // is the spectrum inverted? - bool spectrum_inverted; - - tune_result(double baseband=0, double dxc=0, double residual=0, bool inverted=false) - : baseband_freq(baseband), dxc_freq(dxc), - residual_freq(residual), spectrum_inverted(inverted) {} - }; - -} // namespace usrp2 - -#endif /* INCLUDED_USRP2_TUNE_RESULT_H */ diff --git a/usrp2/host/include/usrp2/usrp2.h b/usrp2/host/include/usrp2/usrp2.h deleted file mode 100644 index e29caa33d..000000000 --- a/usrp2/host/include/usrp2/usrp2.h +++ /dev/null @@ -1,632 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2009 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifndef INCLUDED_USRP2_H -#define INCLUDED_USRP2_H - -#include <boost/shared_ptr.hpp> -#include <boost/utility.hpp> -#include <boost/bind.hpp> -#include <vector> -#include <complex> -#include <usrp2/rx_sample_handler.h> -#include <usrp2/tune_result.h> -#include <usrp2/mimo_config.h> - -/* - * N.B., The interfaces described here are still in flux. - * - * We will keep all the code in the tree up-to-date with regard to changes - * here, but reserve the right to change this on a whim. - */ - -namespace usrp2 { - - /*! - * Structure to hold properties of USRP2 hardware devices. - * - */ - struct props - { - std::string addr; - uint16_t hw_rev; - uint8_t fpga_md5sum[16]; - uint8_t sw_md5sum[16]; - }; - - typedef std::vector<props> props_vector_t; - - /*! - * \brief Search the ethernet for all USRP2s or for a specific USRP2. - * - * \param ifc is the name of the OS ethernet interface (e.g., "eth0") - * \param mac_addr is the MAC address of the desired USRP2, or "" to search for all. - * mac_addr must be either a zero length string, "", or must be of the form - * "01:02:03:04:05:06" or "05:06". - * - * \returns a vector of properties, 1 entry for each matching USRP2 found. - */ - props_vector_t find(const std::string &ifc, const std::string &mac_addr=""); - - class tune_result; - - // FIXME: get from firmware include - static const int GPIO_TX_BANK = 0; - static const int GPIO_RX_BANK = 1; - - /*! - * \brief standard C++ interface to USRP2 - * \ingroup usrp2 - */ - class usrp2 : boost::noncopyable - { - public: - static const unsigned int MAX_CHAN = 30; - - /*! - * Shared pointer to this class - */ - typedef boost::shared_ptr<usrp2> sptr; - - /*! - * Static function to return an instance of usrp2 as a shared pointer - * - * \param ifc Network interface name, e.g., "eth0" - * \param addr Network mac address, e.g., "01:23:45:67:89:ab", "89:ab" or "". - * If \p addr is HH:HH, it's treated as if it were 00:50:c2:85:HH:HH - * "" will autoselect a USRP2 if there is only a single one on the local ethernet. - * \param rx_bufsize is the length in bytes of the kernel networking buffer to allocate. - */ - static sptr make(const std::string &ifc, const std::string &addr="", size_t rx_bufsize=0); - - /*! - * Class destructor - */ - ~usrp2(); - - /*! - * Returns the MAC address associated with this USRP - */ - std::string mac_addr(); - - /*! - * Returns the GbE interface name associated with this USRP - */ - std::string interface_name(); - - /* - * ---------------------------------------------------------------- - * Rx configuration and control - * ---------------------------------------------------------------- - */ - - /*! - * Set the rx antenna - */ - bool set_rx_antenna(int ant); - - /*! - * Set receiver gain - * \param gain in dB (more or less) - */ - bool set_rx_gain(double gain); - - //! return minimum Rx gain - double rx_gain_min(); - - //! return maximum Rx gain - double rx_gain_max(); - - //! return Rx gain db_per_step - double rx_gain_db_per_step(); - - /*! - * \brief Set receive daughterboard LO offset frequency - */ - bool set_rx_lo_offset(double frequency); - - /*! - * Set receiver center frequency - */ - bool set_rx_center_freq(double frequency, tune_result *result); - - //! return minimum Rx center frequency - double rx_freq_min(); - - //! return maximum Rx center frequency - double rx_freq_max(); - - /*! - * Set receiver sample rate decimation - */ - bool set_rx_decim(int decimation_factor); - - //! Return current decimation factor - int rx_decim(); - - /*! - * Set receiver IQ magnitude scaling - */ - bool set_rx_scale_iq(int scale_i, int scale_q); - - /*! - * Set received sample format - * - * domain: complex or real - * type: floating, fixed point, or raw - * depth: bits per sample - * - * Sets format over the wire for samples from USRP2. - */ - // bool set_rx_format(...); - - /*! - * Start streaming receive mode. USRP2 will send a continuous stream of - * DSP pipeline samples to host. Call rx_samples(...) to access. - * - * \param channel Stream channel number (0-30) - * \param items_per_frame Number of 32-bit items per frame. - */ - bool start_rx_streaming(unsigned int channel=0, unsigned int items_per_frame=0); - - /*! - * Start streaming receive mode at specified timestamp. USRP2 will send a - * continuous stream of DSP pipeline samples to host. Call rx_samples(...) - * to access. - * - * \param channel Stream channel number (0-30) - * \param items_per_frame Number of 32-bit items per frame. - * \param time Timestamp to start streaming at - */ - bool start_rx_streaming_at(unsigned int channel=0, unsigned int items_per_frame=0, unsigned int time=0); - - /*! - * Sync to PPS and start streaming receive mode at specified timestamp. - * Just like calling sync_to_pps() and start_rx_streaming_at(). - * - * \param channel Stream channel number (0-30) - * \param items_per_frame Number of 32-bit items per frame. - * \param time Timestamp to start streaming at - */ - bool sync_and_start_rx_streaming_at(unsigned int channel=0, unsigned int items_per_frame=0, uint32_t time=0); - - /*! - * Stop streaming receive mode. - */ - bool stop_rx_streaming(unsigned int channel=0); - - /*! - * \brief Receive data from the specified channel - * This method is used to receive all data: streaming or discrete. - */ - bool rx_samples(unsigned int channel, rx_sample_handler *handler); - - /*! - * Returns number of times receive overruns have occurred - */ - unsigned int rx_overruns(); - - /*! - * Returns total number of missing frames from overruns. - */ - unsigned int rx_missing(); - - /* - * ---------------------------------------------------------------- - * Tx configuration and control - * ---------------------------------------------------------------- - */ - - /*! - * Set the tx antenna - */ - bool set_tx_antenna(int ant); - - /*! - * Set transmitter gain - */ - bool set_tx_gain(double gain); - - //! return minimum Tx gain - double tx_gain_min(); - - //! return maximum Tx gain - double tx_gain_max(); - - //! return Tx gain db_per_step - double tx_gain_db_per_step(); - - /* - * \brief Set transmit daughterboard LO offset frequency - */ - bool set_tx_lo_offset(double frequency); - - /*! - * Set transmitter center frequency - */ - bool set_tx_center_freq(double frequency, tune_result *result); - - //! return minimum Tx center frequency - double tx_freq_min(); - - //! return maximum Tx center frequency - double tx_freq_max(); - - /*! - * Set transmitter sample rate interpolation - */ - bool set_tx_interp(int interpolation_factor); - - //! Return current interpolation factor - int tx_interp(); - - /* - * \brief Calculate default scale_iq for given interpolation rate - */ - void default_tx_scale_iq(int interpolation_factor, int *scale_i, int *scale_q); - - /*! - * Set transmit IQ magnitude scaling - */ - bool set_tx_scale_iq(int scale_i, int scale_q); - - /*! - * Set transmit sample format - * - * domain: complex or real - * type: floating, fixed point, or raw - * depth: bits per sample - * - * Sets format over the wire for samples to USRP2. - */ - // bool set_tx_format(...); - - /*! - * \brief transmit complex<float> samples to USRP2 - * - * \param channel specifies the channel to send them to - * \param samples are the samples to transmit. They should be in the range [-1.0, +1.0] - * \param nsamples is the number of samples to transmit - * \param metadata provides the timestamp and flags - * - * The complex<float> samples are converted to the appropriate - * "on the wire" representation, depending on the current USRP2 - * configuration. Typically, this is big-endian 16-bit I & Q. - */ - bool tx_32fc(unsigned int channel, - const std::complex<float> *samples, - size_t nsamples, - const tx_metadata *metadata); - - /*! - * \brief transmit complex<int16_t> samples to USRP2 - * - * \param channel specifies the channel to send them to - * \param samples are the samples to transmit - * \param nsamples is the number of samples to transmit - * \param metadata provides the timestamp and flags - * - * The complex<int16_t> samples are converted to the appropriate - * "on the wire" representation, depending on the current USRP2 - * configuration. Typically, this is big-endian 16-bit I & Q. - */ - bool tx_16sc(unsigned int channel, - const std::complex<int16_t> *samples, - size_t nsamples, - const tx_metadata *metadata); - - /*! - * \brief transmit raw uint32_t data items to USRP2 - * - * The caller is responsible for ensuring that the items are - * formatted appropriately for the USRP2 and its configuration. - * This method is used primarily by the system itself. Users - * should call tx_32fc or tx_16sc instead. - * - * \param channel specifies the channel to send them to - * \param items are the data items to transmit - * \param nitems is the number of items to transmit - * \param metadata provides the timestamp and flags - */ - bool tx_raw(unsigned int channel, - const uint32_t *items, - size_t nitems, - const tx_metadata *metadata); - - /* - * ---------------------------------------------------------------- - * miscellaneous methods - * ---------------------------------------------------------------- - */ - - /*! - * \brief MIMO configuration - * - * \param flags from usrp2_mimo_config.h - * - * <pre> - * one of these: - * - * MC_WE_DONT_LOCK - * MC_WE_LOCK_TO_SMA - * MC_WE_LOCK_TO_MIMO - * - * and optionally this: - * - * MC_PROVIDE_CLK_TO_MIMO - * </pre> - */ - bool config_mimo(int flags); - - - //! Get frequency of master oscillator in Hz - bool fpga_master_clock_freq(long *freq); - - // Get Sampling rate of A/D converter in Hz - bool adc_rate(long *rate); - - // Get Sampling rate of D/A converter in Hz - bool dac_rate(long *rate); - - /*! - * \brief Get Tx daughterboard ID - * - * \param[out] dbid returns the daughterboard id. - * - * daughterboard id >= 0 if successful, -1 if no daugherboard installed, - * -2 if invalid EEPROM on daughterboard. - */ - bool tx_daughterboard_id(int *dbid); - - /*! - * \brief Get Rx daughterboard ID - * - * \param[out] dbid returns the daughterboard id. - * - * daughterboard id >= 0 if successful, -1 if no daugherboard installed, - * -2 if invalid EEPROM on daughterboard. - */ - bool rx_daughterboard_id(int *dbid); - - /* - * ---------------------------------------------------------------- - * Low level methods - * ---------------------------------------------------------------- - */ - - /*! - * Burn new mac address into EEPROM on USRP2 - * - * \param new_addr Network mac address, e.g., "01:23:45:67:89:ab" or "89:ab". - * If \p addr is HH:HH, it's treated as if it were 00:50:c2:85:HH:HH - */ - bool burn_mac_addr(const std::string &new_addr); - - /*! - * Reset master time to 0 at next PPS edge - */ - bool sync_to_pps(); - - /*! - * Reset master time to 0 at every PPS edge - */ - bool sync_every_pps(bool enable); - - /*! - * Read memory from Wishbone bus as 32-bit words. Handles endian swapping if needed. - * - * \param addr 32-bit aligned address. Only the lower 16-bits are significant. - * \param words Number of 32-bit words - * - * \returns Vector of 32-bit read values - * - * WARNING: Attempts to read memory from addresses that do not correspond to RAM or - * memory-mapped peripherals may cause the USRP2 to hang, requiring a power cycle. - * - */ - std::vector<uint32_t> peek32(uint32_t addr, uint32_t words); - - /*! - * Write memory to Wishbone bus as 32-bit words. Handles endian swapping if needed. - * - * \param addr 32-bit aligned address. Only the lower 16-bits are significant - * \param data Vector of 32-bit values to write. - * - * \returns true iff successful - * - * WARNING: Attempts to read memory from addresses that do not correspond to RAM or - * memory-mapped peripherals may cause the USRP2 to hang, requiring a power cycle. - * - */ - bool poke32(uint32_t addr, const std::vector<uint32_t> &data); - - /*! - * Set daughterboard GPIO data direction register. - * - * \param bank GPIO_TX_BANK or GPIO_RX_BANK - * \param value 16-bits, 0=FPGA input, 1=FPGA output - * \param mask 16-bits, 0=ignore, 1=set - * - * \returns true iff successful - * - * WARNING: Improper usage of this function may result in damage to the USRP2 - * - */ - bool set_gpio_ddr(int bank, uint16_t value, uint16_t mask); - - /*! - * Set daughterboard GPIO output selection register. For those GPIO pins that - * are configured as outputs in the DDR, this settings configures the source - * of the pin value. - * - * \param bank GPIO_TX_BANK or GPIO_RX_BANK - * \param sels Exactly 16 character MSB->LSB string. For each position: - * '.' = ignore this bit, i.e., leave current value - * 'a' = Output ATR value - * 's' = Output host software controlled value - * '0' = Output FPGA debug bus 0 value - * '1' = Output FPGA debug bus 1 value - * - * \returns true iff successful - * - * WARNING: Improper usage of this function may result in damage to the USRP2 - * - */ - bool set_gpio_sels(int bank, std::string sels); - - /*! - * Set daughterboard GPIO pin values. - * - * \param bank GPIO_TX_BANK or GPIO_RX_BANK - * \param value 16 bits, 0=low, 1=high - * \param mask 16 bits, 0=ignore, 1=set - * - * \returns true iff successful - * - * WARNING: Improper usage of this function may result in damage to the USRP2 - * - */ - bool write_gpio(int bank, uint16_t value, uint16_t mask); - - /*! - * Read daughterboard GPIO pin values - * - * \param bank GPIO_TX_BANK or GPIO_RX_BANK - * \param value pointer to uint16_t to hold read results - * - * \returns true iff successful - * - */ - bool read_gpio(int bank, uint16_t *value); - - /*! - * Set GPIO streaming mode - * - * Individually enables streaming GPIO pins through LSBs of DSP - * samples. - * - * On receive, io_rx[15] replaces I[0], io_rx[14] replaces Q[0] - * On transmit, I[0] maps to io_tx[15], Q[0] maps to io_tx[14] - * (Transmit streaming is not yet implemented.) - * - * The selected GPIO pins must have been set as inputs or outputs - * and, for transmit, set to software control. - * - * When enabled, the replaced DSP sample LSBs become 0. - * - * \param bank GPIO_TX_BANK or GPIO_RX_BANK - * \param enable enable[0] controls I channel LSB - * enable[1] controls Q channel LSB - * - * \returns true iff successful - * - * WARNING: Improper usage of this function may result in damage to the USRP2 - * - */ - bool enable_gpio_streaming(int bank, int enable); - -#if 0 // not yet implemented - /*! - * \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 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, const 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); -#endif - - - class impl; // implementation details - - private: - // Static function to retrieve or create usrp2 instance - static sptr find_existing_or_make_new(const std::string &ifc, props *p, size_t rx_bufsize); - - // Only class members can instantiate this class - usrp2(const std::string &ifc, props *p, size_t rx_bufsize); - - // All private state is held in opaque pointer - std::auto_ptr<impl> d_impl; - }; - -}; - -std::ostream& operator<<(std::ostream &os, const usrp2::props &x); - - -#endif /* INCLUDED_USRP2_H */ diff --git a/usrp2/host/include/usrp2/usrp2_cdefs.h b/usrp2/host/include/usrp2/usrp2_cdefs.h deleted file mode 100644 index 71395cda8..000000000 --- a/usrp2/host/include/usrp2/usrp2_cdefs.h +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef INCLUDED_USRP2_CDEFS_H -#define INCLUDED_USRP2_CDEFS_H - -/* C++ needs to know that types and declarations are C, not C++. */ -#ifdef __cplusplus -# define __U2_BEGIN_DECLS extern "C" { -# define __U2_END_DECLS } -#else -# define __U2_BEGIN_DECLS -# define __U2_END_DECLS -#endif - -#endif /* INCLUDED_USRP2_CDEFS_H */ diff --git a/usrp2/host/lib/.gitignore b/usrp2/host/lib/.gitignore deleted file mode 100644 index 8f5500b33..000000000 --- a/usrp2/host/lib/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -/.libs -/.deps -/Makefile -/Makefile.in -/usrp2_socket_opener diff --git a/usrp2/host/lib/Makefile.am b/usrp2/host/lib/Makefile.am deleted file mode 100644 index 85bec4673..000000000 --- a/usrp2/host/lib/Makefile.am +++ /dev/null @@ -1,66 +0,0 @@ -# -# Copyright 2007,2008,2010 Free Software Foundation, Inc. -# -# This program 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 of the License, or -# (at your option) any later version. -# -# This program 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/>. -# - -include $(top_srcdir)/Makefile.common - -AM_CPPFLAGS = \ - $(USRP2_INCLUDES) \ - $(GRUEL_INCLUDES) \ - $(STD_DEFINES_AND_INCLUDES) \ - $(BOOST_CPPFLAGS) \ - $(CPPUNIT_INCLUDES) - -bin_PROGRAMS = usrp2_socket_opener -usrp2_socket_opener_SOURCES = usrp2_socket_opener.cc - -lib_LTLIBRARIES = \ - libusrp2.la - -libusrp2_la_LDFLAGS = $(LTVERSIONFLAGS) - -libusrp2_la_SOURCES = \ - control.cc \ - copiers.cc \ - copy_handler.cc \ - data_handler.cc \ - eth_buffer.cc \ - ethernet.cc \ - find.cc \ - open_usrp2_socket.cc \ - pktfilter.cc \ - ring.cc \ - rx_nop_handler.cc \ - rx_sample_handler.cc \ - strtod_si.c \ - usrp2.cc \ - usrp2_impl.cc - -libusrp2_la_LIBADD = \ - $(GRUEL_LA) \ - $(BOOST_LDFLAGS) $(BOOST_THREAD_LIB) - -# Private headers not needed for above the API development -noinst_HEADERS = \ - control.h \ - eth_buffer.h \ - eth_common.h \ - ethernet.h \ - open_usrp2_socket.h \ - pktfilter.h \ - ring.h \ - usrp2_bytesex.h \ - usrp2_impl.h
\ No newline at end of file diff --git a/usrp2/host/lib/control.cc b/usrp2/host/lib/control.cc deleted file mode 100644 index 3b5533eb8..000000000 --- a/usrp2/host/lib/control.cc +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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 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 "control.h" -#include <iostream> -#include <gruel/thread.h> - -#include <boost/date_time/posix_time/posix_time.hpp> -namespace pt = boost::posix_time; - -namespace usrp2 { - - pending_reply::pending_reply(unsigned int rid, void *buffer, size_t len) - : d_rid(rid), d_buffer(buffer), d_len(len), d_mutex(), d_cond(), - d_complete(false) - { - } - - pending_reply::~pending_reply() - { - notify_completion(); // Needed? - } - - int - pending_reply::wait_for_completion(double secs) - { - gruel::scoped_lock l(d_mutex); - - while (!d_complete) { - if (!d_cond.timed_wait(l, pt::milliseconds(long(secs*1e3)))) - return 0; // timed out - } - - return 1; - } - - void - pending_reply::notify_completion() - { - gruel::scoped_lock l(d_mutex); - d_complete = true; - d_cond.notify_one(); - } - -} // namespace usrp2 - diff --git a/usrp2/host/lib/control.h b/usrp2/host/lib/control.h deleted file mode 100644 index 3515ba10f..000000000 --- a/usrp2/host/lib/control.h +++ /dev/null @@ -1,179 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2009,2010 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifndef INCLUDED_CONTROL_H -#define INCLUDED_CONTROL_H - -#include <gruel/thread.h> -#include <usrp2_eth_packet.h> - -namespace usrp2 { - - struct op_generic_cmd { - u2_eth_packet_t h; - op_generic_t op; - op_generic_t eop; - }; - - /*! - * OP_CONFIG_RX_V2 command packet - */ - struct op_config_rx_v2_cmd - { - u2_eth_packet_t h; - op_config_rx_v2_t op; - op_generic_t eop; - }; - - struct op_start_rx_streaming_cmd - { - u2_eth_packet_t h; - op_start_rx_streaming_t op; - op_generic_t eop; - }; - - struct op_sync_and_start_rx_streaming_cmd - { - u2_eth_packet_t h; - op_generic_t sync_op; - op_start_rx_streaming_t rx_op; - op_generic_t eop; - }; - - struct op_stop_rx_cmd { - u2_eth_packet_t h; - op_generic_t op; - op_generic_t eop; - }; - - struct op_config_tx_v2_cmd - { - u2_eth_packet_t h; - op_config_tx_v2_t op; - op_generic_t eop; - }; - - struct op_config_mimo_cmd - { - u2_eth_packet_t h; - op_config_mimo_t op; - op_generic_t eop; - }; - - struct op_burn_mac_addr_cmd - { - u2_eth_packet_t h; - op_burn_mac_addr_t op; - op_generic_t eop; - }; - - struct op_dboard_info_cmd { - u2_eth_packet_t h; - op_generic_t op; - op_generic_t eop; - }; - - struct op_peek_cmd { - u2_eth_packet_t h; - op_peek_t op; - op_generic_t eop; - }; - - struct op_poke_cmd { - u2_eth_packet_t h; - op_poke_t op; - // words to write go here - // eop must be dynamically written here - }; - - struct op_freq_cmd { - u2_eth_packet_t h; - op_freq_t op; - op_generic_t eop; - }; - - struct op_gpio_cmd { - u2_eth_packet_t h; - op_gpio_t op; - op_generic_t eop; - }; - - struct op_gpio_set_sels_cmd { - u2_eth_packet_t h; - op_gpio_set_sels_t op; - op_generic_t eop; - }; - - /*! - * Control mechanism to allow API calls to block waiting for reply packets - */ - class pending_reply - { - private: - unsigned int d_rid; - void *d_buffer; - size_t d_len; - - // d_mutex is used with d_cond and also protects d_complete - gruel::mutex d_mutex; - gruel::condition_variable d_cond; - bool d_complete; - - public: - /*! - * Construct a pending reply from the reply ID, response packet - * buffer, and buffer length. - */ - pending_reply(unsigned int rid, void *buffer, size_t len); - - /*! - * Destructor. Signals creating thread. - */ - ~pending_reply(); - - /*! - * Block, waiting for reply packet. - * Returns: 1 = ok, reply packet in buffer - * 0 = timeout - */ - int wait_for_completion(double secs); - - /*! - * Allows creating thread to resume after copying reply into buffer - */ - void notify_completion(); - - /*! - * Retrieve pending reply ID - */ - unsigned int rid() const { return d_rid; } - - /*! - * Retrieve destination buffer address - */ - void *buffer() const { return d_buffer; } - - /*! - * Retrieve destination buffer length - */ - size_t len() const { return d_len; } - }; - -} // namespace usrp2 - -#endif /* INCLUDED_CONTROL_H */ diff --git a/usrp2/host/lib/copiers.cc b/usrp2/host/lib/copiers.cc deleted file mode 100644 index 52c66f616..000000000 --- a/usrp2/host/lib/copiers.cc +++ /dev/null @@ -1,133 +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 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 <usrp2/copiers.h> -#include <gruel/inet.h> -#include <gr_math.h> -#include <math.h> -#include <stdexcept> -#include <assert.h> -#include <string.h> - -// FIXME need gruel::not_implemented - -namespace usrp2 { - - /* - * N.B., in all of these, uint32_t *items is NOT 32-bit aligned! - * FIXME Needs fix for non-x86 machines. - */ - - /* - * ---------------------------------------------------------------- - * Copy and convert from USRP2 wire format to host format - * ---------------------------------------------------------------- - */ - void - copy_u2_16sc_to_host_16sc(size_t nitems, - const uint32_t *items, - std::complex<int16_t> *host_items) - { -#ifdef WORDS_BIGENDIAN - - assert(sizeof(items[0]) == sizeof(host_items[0])); - memcpy(host_items, items, nitems * sizeof(items[0])); - -#else - - // FIXME SIMD welcome here - - for (size_t i = 0; i < nitems; i++){ - uint32_t t = ntohx(items[i]); - //printf("%9d\n", items[i]); - host_items[i] = std::complex<int16_t>((t >> 16), t & 0xffff); - } - -#endif - } - - - /* - * endian swap if required and map [-32768, 32767] -> [1.0, +1.0) - */ - void - copy_u2_16sc_to_host_32fc(size_t nitems, - const uint32_t *items, - std::complex<float> *host_items) - { - for (size_t i = 0; i < nitems; i++){ - uint32_t t = ntohx(items[i]); - int16_t re = (t >> 16) & 0xffff; - int16_t im = (t & 0xffff); - host_items[i] = std::complex<float>(re * 1.0/32768, im * 1.0/32768); - } - } - - /* - * ---------------------------------------------------------------- - * Copy and convert from host format to USRP2 wire format - * ---------------------------------------------------------------- - */ - void - copy_host_16sc_to_u2_16sc(size_t nitems, - const std::complex<int16_t> *host_items, - uint32_t *items) - { -#ifdef WORDS_BIGENDIAN - - assert(sizeof(items[0]) == sizeof(host_items[0])); - memcpy(items, host_items, nitems * sizeof(items[0])); - -#else - - // FIXME SIMD welcome here - - for (size_t i = 0; i < nitems; i++){ - items[i] = htonl((host_items[i].real() << 16) | (host_items[i].imag() & 0xffff)); - } - -#endif - } - - - static inline int16_t - clip_and_scale(float x) - { - return static_cast<int16_t>(rintf(gr_branchless_clip(x, 1.0) * 32767.0)); - } - - void - copy_host_32fc_to_u2_16sc(size_t nitems, - const std::complex<float> *host_items, - uint32_t *items) - { - for (size_t i = 0; i < nitems; i++){ - int16_t re = clip_and_scale(host_items[i].real()); - int16_t im = clip_and_scale(host_items[i].imag()); - - items[i] = htonl((re << 16) | (im & 0xffff)); - } - } - -} diff --git a/usrp2/host/lib/copy_handler.cc b/usrp2/host/lib/copy_handler.cc deleted file mode 100644 index 92759084b..000000000 --- a/usrp2/host/lib/copy_handler.cc +++ /dev/null @@ -1,60 +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 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 <usrp2/copy_handler.h> -#include <iostream> -#include <string.h> - -namespace usrp2 { - - copy_handler::copy_handler(void *dest, size_t len) - : d_dest((uint8_t *)dest), d_space(len), d_bytes(0), d_times(0) - { - } - - copy_handler::~copy_handler() - { - // NOP - } - - data_handler::result - copy_handler::operator()(const void *base, size_t len) - { - if (len > d_space) - return KEEP|DONE; // can't do anything, retry later - - memcpy(&d_dest[d_bytes], base, len); - d_space -= len; - d_bytes += len; - d_times++; - - if (d_space < MIN_COPY_LEN) - return DONE; // don't call me anymore - - return 0; - } - -} // namespace usrp2 - diff --git a/usrp2/host/lib/data_handler.cc b/usrp2/host/lib/data_handler.cc deleted file mode 100644 index ba9123681..000000000 --- a/usrp2/host/lib/data_handler.cc +++ /dev/null @@ -1,32 +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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include <usrp2/data_handler.h> - -namespace usrp2 { - - data_handler::~data_handler() - { - // default nop destructor - } - -} - diff --git a/usrp2/host/lib/eth_buffer.cc b/usrp2/host/lib/eth_buffer.cc deleted file mode 100644 index e8ca05283..000000000 --- a/usrp2/host/lib/eth_buffer.cc +++ /dev/null @@ -1,279 +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 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 "eth_buffer.h" -#include "ethernet.h" -#include <usrp2/data_handler.h> -#include <linux/if_packet.h> -#include <sys/socket.h> -#include <sys/mman.h> -#include <sys/poll.h> -#include <iostream> -#include <cmath> -#include <errno.h> -#include <stdexcept> -#include <string.h> -#include <cstdio> - - -#define ETH_BUFFER_DEBUG 0 // define to 0 or 1 -#if ETH_BUFFER_DEBUG -#define DEBUG_LOG(x) ::write(2, (x), 1) -#else -#define DEBUG_LOG(X) -#endif - -#define DEFAULT_MEM_SIZE 25e6 // ~0.25s @ 100 MB/s -#define MAX_MEM_SIZE 1000e6 // ~10.00s @ 100 MB/s. -#define MAX_SLAB_SIZE 131072 // 128 KB (FIXME fish out of /proc/slabinfo) -#define MAX_PKT_SIZE 1512 // we don't do jumbo frames - -namespace usrp2 { - - eth_buffer::eth_buffer(size_t rx_bufsize) - : d_fd(0), d_using_tpring(false), d_buflen(0), d_buf(0), d_frame_nr(0), - d_frame_size(0), d_head(0), d_ring(0), d_ethernet(new ethernet()) - { - if (rx_bufsize == 0) - d_buflen = (size_t)DEFAULT_MEM_SIZE; - else - d_buflen = std::min((size_t)MAX_MEM_SIZE, rx_bufsize); - - memset(d_mac, 0, sizeof(d_mac)); - } - - eth_buffer::~eth_buffer() - { - close(); - } - - bool - eth_buffer::open(const std::string &ifname, int protocol) - { - if (!d_ethernet->open(ifname, protocol)) { - std::cerr << "eth_buffer: unable to open interface " - << ifname << std::endl; - return false; - } - - d_fd = d_ethernet->fd(); - memcpy(d_mac, d_ethernet->mac(), sizeof(d_mac)); - - struct tpacket_req req; - size_t page_size = getpagesize(); - - // Calculate minimum power-of-two aligned size for frames - req.tp_frame_size = - (unsigned int)rint(pow(2, ceil(log2(TPACKET_ALIGN(TPACKET_HDRLEN)+TPACKET_ALIGN(MAX_PKT_SIZE))))); - d_frame_size = req.tp_frame_size; - - // Calculate minimum contiguous pages needed to enclose a frame - int npages = (page_size > req.tp_frame_size) ? 1 : ((req.tp_frame_size+page_size-1)/page_size); - req.tp_block_size = page_size << (int)ceil(log2(npages)); - - // Calculate number of blocks - req.tp_block_nr = (int)(d_buflen/req.tp_block_size); - - - // Recalculate buffer length - d_buflen = req.tp_block_nr*req.tp_block_size; - - // Finally, calculate total number of frames. Since frames, blocks, - // and pages are all power-of-two aligned, frames are contiguous - req.tp_frame_nr = d_buflen/req.tp_frame_size; - d_frame_nr = req.tp_frame_nr; - -#if 0 - if (ETH_BUFFER_DEBUG) - std::cerr << "eth_buffer:" - << " frame_size=" << req.tp_frame_size - << " block_size=" << req.tp_block_size - << " block_nr=" << req.tp_block_nr - << " frame_nr=" << req.tp_frame_nr - << " buflen=" << d_buflen - << std::endl; -#endif - - // Try to get kernel shared memory buffer - if (setsockopt(d_fd, SOL_PACKET, PACKET_RX_RING, (void *)&req, sizeof(req))) { - perror("eth_buffer: setsockopt"); - d_using_tpring = false; - if (!(d_buf = (uint8_t *)malloc(d_buflen))) { - std::cerr << "eth_buffer: failed to allocate packet memory" << std::endl; - return false; - } - - std::cerr << "eth_buffer: using malloc'd memory for buffer" << std::endl; - } - else { - d_using_tpring = true; - void *p = mmap(0, d_buflen, PROT_READ|PROT_WRITE, MAP_SHARED, d_fd, 0); - if (p == MAP_FAILED){ - perror("eth_buffer: mmap"); - return false; - } - d_buf = (uint8_t *) p; - - if (ETH_BUFFER_DEBUG) - std::cerr << "eth_buffer: using kernel shared mem for buffer" << std::endl; - } - - // Initialize our pointers into the packet ring - d_ring = std::vector<uint8_t *>(req.tp_frame_nr); - for (unsigned int i=0; i < req.tp_frame_nr; i++) { - d_ring[i] = (uint8_t *)(d_buf+i*req.tp_frame_size); - } - - // If not using kernel ring, instantiate select/read thread here - - return true; - } - - bool - eth_buffer::close() - { - // if we have background thread, stop it here - - if(d_buf) { - if (!d_using_tpring) - free(d_buf); - else - munmap(d_buf, d_buflen); - } - - return d_ethernet->close(); - } - - bool - eth_buffer::attach_pktfilter(pktfilter *pf) - { - return d_ethernet->attach_pktfilter(pf); - } - - inline bool - eth_buffer::frame_available() - { - return (((tpacket_hdr *)d_ring[d_head])->tp_status != TP_STATUS_KERNEL); - } - - eth_buffer::result - eth_buffer::rx_frames(data_handler *f, int timeout_in_ms) - { - DEBUG_LOG("\n"); - - while (!frame_available()) { - if (timeout_in_ms == 0) { - DEBUG_LOG("w"); - return EB_WOULD_BLOCK; - } - - struct pollfd pfd; - pfd.fd = d_fd; - pfd.revents = 0; - pfd.events = POLLIN; - - DEBUG_LOG("P"); - - int pres = poll(&pfd, 1, timeout_in_ms); - if (pres == -1) { - perror("poll"); - return EB_ERROR; - } - - if (pres == 0) { - DEBUG_LOG("t"); - return EB_TIMED_OUT; - } - } - - // Iterate through available packets - while (frame_available()) { - // Get start of ethernet frame and length - tpacket_hdr *hdr = (tpacket_hdr *)d_ring[d_head]; - void *base = (uint8_t *)hdr+hdr->tp_mac; - size_t len = hdr->tp_len; - - // FYI, (base % 4 == 2) Not what we want given the current FPGA - // code. This means that our uint32_t samples are not 4-byte - // aligned. We'll have to deal with it downstream. - - if (0) - fprintf(stderr, "eth_buffer: base = %p tp_mac = %3d tp_net = %3d\n", - base, hdr->tp_mac, hdr->tp_net); - - // Invoke data handler - data_handler::result r = (*f)(base, len); - if (!(r & data_handler::KEEP)) - hdr->tp_status = TP_STATUS_KERNEL; // mark it free - - inc_head(); - - if (r & data_handler::DONE) - break; - } - - DEBUG_LOG("|"); - return EB_OK; - } - - eth_buffer::result - eth_buffer::tx_frame(const void *base, size_t len, int flags) - { - DEBUG_LOG("T"); - - if (flags & EF_DONTWAIT) // FIXME: implement flags - throw std::runtime_error("tx_frame: EF_DONTWAIT not implemented"); - - int res = d_ethernet->write_packet(base, len); - if (res < 0 || (unsigned int)res != len) - return EB_ERROR; - - return EB_OK; - } - - eth_buffer::result - eth_buffer::tx_framev(const eth_iovec *iov, int iovcnt, int flags) - { - DEBUG_LOG("T"); - - if (flags & EF_DONTWAIT) // FIXME: implement flags - throw std::runtime_error("tx_frame: EF_DONTWAIT not implemented"); - - int res = d_ethernet->write_packetv(iov, iovcnt); - if (res < 0) - return EB_ERROR; - - return EB_OK; - } - - void - eth_buffer::release_frame(void *base) - { - // Get d_frame_size aligned header - tpacket_hdr *hdr = (tpacket_hdr *)((intptr_t)base & ~(d_frame_size-1)); - hdr->tp_status = TP_STATUS_KERNEL; // mark it free - } - -} // namespace usrp2 diff --git a/usrp2/host/lib/eth_buffer.h b/usrp2/host/lib/eth_buffer.h deleted file mode 100644 index 8dee9a4a2..000000000 --- a/usrp2/host/lib/eth_buffer.h +++ /dev/null @@ -1,198 +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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#ifndef INCLUDED_USRP2_ETH_BUFFER_H -#define INCLUDED_USRP2_ETH_BUFFER_H - -#include "pktfilter.h" -#include <eth_common.h> -#include <boost/utility.hpp> -#include <vector> -#include <memory> -#include <stdint.h> - -namespace usrp2 { - - class ethernet; - class data_handler; - - /*! - * \brief high-performance interface to send and receive raw - * ethernet frames with out-of-order retirement of received frames. - * - * On many systems it should be possible to implement this on top of libpcap - * - * \internal - */ - class eth_buffer : boost::noncopyable - { - - int d_fd; // socket file descriptor - uint8_t d_mac[6]; // our mac address - bool d_using_tpring; // using kernel mapped packet ring - size_t d_buflen; // length of our buffer - uint8_t *d_buf; // packet ring - unsigned int d_frame_nr; // max frames on ring - size_t d_frame_size; // frame storage size - unsigned int d_head; // pointer to next frame - - std::vector<uint8_t *> d_ring; // pointers into buffer - std::auto_ptr<ethernet> d_ethernet; // our underlying interface - - bool frame_available(); - - void inc_head() - { - if (d_head + 1 >= d_frame_nr) - d_head = 0; - else - d_head = d_head + 1; - } - - - public: - - enum result { - EB_OK, //< everything's fine - EB_ERROR, //< A non-recoverable error occurred - EB_WOULD_BLOCK, //< A timeout of 0 was specified and nothing was ready - EB_TIMED_OUT, //< The timeout expired before anything was ready - }; - - static const unsigned int MAX_PKTLEN = 1512; - static const unsigned int MIN_PKTLEN = 64; - - /*! - * \param rx_bufsize is a hint as to the number of bytes of memory - * to allocate for received ethernet frames (0 -> reasonable default) - */ - eth_buffer(size_t rx_bufsize = 0); - ~eth_buffer(); - - /*! - * \brief open the specified interface - * - * \param ifname ethernet interface name, e.g., "eth0" - * \param protocol is the ethertype protocol number in network order. - * Use 0 to receive all protocols. - */ - bool open(const std::string &ifname, int protocol); - - /*! - * \brief close the interface - */ - bool close(); - - /*! - * \brief attach packet filter to socket to restrict which packets read sees. - * \param pf the packet filter - */ - bool attach_pktfilter(pktfilter *pf); - - /*! - * \brief return 6 byte string containing our MAC address - */ - const uint8_t *mac() const { return d_mac; } - - /*! - * \brief Call \p f for each frame in the receive buffer. - * \param f is the frame data handler - * \param timeout (in ms) controls behavior when there are no frames to read - * - * If \p timeout is 0, rx_frames will not wait for frames if none are - * available, and f will not be invoked. If \p timeout is -1 (the - * default), rx_frames will block indefinitely until frames are - * available. If \p timeout is positive, it indicates the number of - * milliseconds to wait for a frame to become available. Once the - * timeout has expired, rx_frames will return, f never having been - * invoked. - * - * \p f will be called on each ethernet frame that is available. - * \p f returns a bit mask with one of the following set or cleared: - * - * data_handler::KEEP - hold onto the frame and present it again during - * the next call to rx_frames, otherwise discard it - * - * data_handler::DONE - return from rx_frames now even though more frames - * might be available; otherwise continue if more - * frames are ready. - * - * The idea of holding onto a frame for the next iteration allows - * the caller to scan the received packet stream for particular - * classes of frames (such as command replies) leaving the rest - * intact. On the next call all kept frames, followed by any new - * frames received, will be presented in order to \p f. - * See usrp2.cc for an example of the pattern. - * - * \returns EB_OK if at least one frame was received - * \returns EB_WOULD_BLOCK if \p timeout is 0 and the call would have blocked - * \returns EB_TIMED_OUT if timeout occurred - * \returns EB_ERROR if there was an unrecoverable error. - */ - result rx_frames(data_handler *f, int timeout=-1); - - /* - * \brief Release frame from buffer - * - * Call to release a frame previously held by a data_handler::KEEP. - * The pointer may be offset from the base of the frame up to its length. - */ - void release_frame(void *p); - - /* - * \brief Write an ethernet frame to the interface. - * - * \param base points to the beginning of the frame (the 14-byte ethernet header). - * \param len is the length of the frame in bytes. - * \param flags is 0 or the bitwise-or of values from eth_flags - * - * The frame must begin with a 14-byte ethernet header. - * - * \returns EB_OK if the frame was successfully enqueued. - * \returns EB_WOULD_BLOCK if flags contains EF_DONT_WAIT and the call would have blocked. - * \returns EB_ERROR if there was an unrecoverable error. - */ - result tx_frame(const void *base, size_t len, int flags=0); - - /* - * \brief Write an ethernet frame to the interface using scatter/gather. - * - * \param iov points to an array of iovec structs - * \param iovcnt is the number of entries - * \param flags is 0 or the bitwise-or of values from eth_flags - * - * The frame must begin with a 14-byte ethernet header. - * - * \returns EB_OK if the frame was successfully enqueued. - * \returns EB_WOULD_BLOCK if flags contains EF_DONT_WAIT and the call would have blocked. - * \returns EB_ERROR if there was an unrecoverable error. - */ - result tx_framev(const eth_iovec *iov, int iovcnt, int flags=0); - - /* - * \brief Returns maximum possible number of frames in buffer - */ - unsigned int max_frames() const { return d_frame_nr; } - - }; - -}; // namespace usrp2 - -#endif /* INCLUDED_USRP2_ETH_BUFFER_H */ diff --git a/usrp2/host/lib/eth_common.h b/usrp2/host/lib/eth_common.h deleted file mode 100644 index 7c9feaa25..000000000 --- a/usrp2/host/lib/eth_common.h +++ /dev/null @@ -1,38 +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 this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef INCLUDED_USRP2_ETH_COMMON_H -#define INCLUDED_USRP2_ETH_COMMON_H - -#include <sys/uio.h> // FIXME autoconf this - -namespace usrp2 { - - enum eth_flags { - EF_DONTWAIT = 0x0001, - }; - - typedef struct iovec eth_iovec; // FIXME autoconf this - -} // namespace usrp2 - - -#endif /* INCLUDED_USRP2_ETH_COMMON_H */ diff --git a/usrp2/host/lib/ethernet.cc b/usrp2/host/lib/ethernet.cc deleted file mode 100644 index e51680b2e..000000000 --- a/usrp2/host/lib/ethernet.cc +++ /dev/null @@ -1,230 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2007,2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "eth_buffer.h" -#include "ethernet.h" -#include "pktfilter.h" -#include <open_usrp2_socket.h> - -#include <cstdio> -#include <iostream> -#include <unistd.h> -#include <fcntl.h> -//#include <features.h> -#include <errno.h> -#include <string.h> -#include <net/if.h> -#include <sys/ioctl.h> -#include <sys/socket.h> -#include <net/ethernet.h> -#include <netinet/in.h> - -#include <linux/types.h> -#include <netpacket/packet.h> -#include <linux/filter.h> // packet filter - -namespace usrp2 { - - static int - open_packet_socket (std::string ifname, int protocol) - { -#if 0 - if (protocol == 0) - protocol = htons(ETH_P_ALL); - - int fd = socket (PF_PACKET, SOCK_RAW, protocol); -#else - int fd = usrp2::open_usrp2_socket(); -#endif - - if (fd == -1){ - fprintf (stderr, "%s: socket: %s\n", ifname.c_str(), strerror (errno)); - return -1; - } - - // get interface index - struct ifreq ifr; - memset (&ifr, 0, sizeof(ifr)); - strncpy (ifr.ifr_name, ifname.c_str(), sizeof (ifr.ifr_name)); - int res = ioctl (fd, SIOCGIFINDEX, &ifr); - if (res != 0){ - ::close (fd); - fprintf (stderr, "%s: SIOCGIFINDEX: %s\n", ifname.c_str(), strerror(errno)); - return -1; - } - int ifindex = ifr.ifr_ifindex; - - // bind to the specified interface - sockaddr_ll sa; - memset (&sa, 0, sizeof (sa)); - sa.sll_family = AF_PACKET; - sa.sll_protocol = protocol; - sa.sll_ifindex = ifindex; - res = bind (fd, (struct sockaddr *)&sa, sizeof (sa)); - if (res != 0){ - ::close (fd); - fprintf (stderr, "%s: bind: %s\n", ifname.c_str(), strerror(errno)); - return -1; - } - return fd; - } - - static void - extract_mac_addr (unsigned char *mac, const unsigned char *hwaddr) - { - int i; - for (i = 0; i < 6; i++) - mac[i] = 0xff; - - i = 0; - for (int j = 0; j < 14; j++){ - if (hwaddr[j] != 0xff){ - mac[i++] = hwaddr[j]; - if (i == 6) - return; - } - } - } - - static bool - get_mac_addr (std::string ifname, int fd, unsigned char *mac) - { - struct ifreq ifr; - memset (&ifr, 0, sizeof(ifr)); - strncpy (ifr.ifr_name, ifname.c_str(), sizeof (ifr.ifr_name)); - int res = ioctl (fd, SIOCGIFHWADDR, &ifr); - if (res != 0){ - fprintf (stderr, "%s: SIOCGIFHWADDR: %s\n", ifname.c_str(), strerror(errno)); - return false; - } - else { - if (0){ - for (unsigned i = 0; i < sizeof (ifr.ifr_hwaddr.sa_data); i++) - fprintf (stderr, "%02x", ifr.ifr_hwaddr.sa_data[i]); - fprintf (stderr, "\n"); - } - } - extract_mac_addr (mac, (unsigned char *)ifr.ifr_hwaddr.sa_data); - return true; - } - - ethernet::ethernet () - { - d_fd = -1; - memset (d_mac, 0, sizeof (d_mac)); - } - - ethernet::~ethernet () - { - close (); - } - - bool - ethernet::open (std::string ifname, int protocol) - { - if (d_fd != -1){ - fprintf (stderr, "ethernet: already open\n"); - return false; - } - if ((d_fd = open_packet_socket (ifname, protocol)) == -1){ - return false; - } - get_mac_addr (ifname, d_fd, d_mac); - return true; - } - - bool - ethernet::close () - { - if (d_fd >= 0){ - ::close (d_fd); - d_fd = -1; - } - return true; - } - - int - ethernet::read_packet (void *buf, int buflen) - { - int len = recvfrom (d_fd, buf, buflen, 0, (sockaddr *) 0, 0); - return len; - } - - int - ethernet::read_packet_dont_block (void *buf, int buflen) - { - int len = recvfrom (d_fd, buf, buflen, MSG_DONTWAIT, 0, 0); - if (len == -1 && errno == EAGAIN) - return 0; - - return len; - } - - int - ethernet::write_packet (const void *buf, int buflen) - { - int retval = send (d_fd, buf, buflen, 0); - if (retval < 0){ - if (errno == EINTR) - return write_packet (buf, buflen); - - perror ("ethernet:write_packet: send"); - return -1; - } - return retval; - } - - int - ethernet::write_packetv(const eth_iovec *iov, size_t iovlen) - { - struct msghdr mh; - memset(&mh, 0, sizeof(mh)); - mh.msg_iov = const_cast<eth_iovec*>(iov); - mh.msg_iovlen = iovlen; - - int retval = sendmsg(d_fd, &mh, 0); - if (retval < 0){ - if (errno == EINTR) - return write_packetv(iov, iovlen); - - perror("ethernet:write_packetv: send"); - return -1; - } - return retval; - } - - bool - ethernet::attach_pktfilter (pktfilter *pf) - { - struct sock_fprog filter; - filter.len = pf->d_len; - filter.filter = pf->d_inst; - - int r = setsockopt (d_fd, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof (filter)); - if (r < 0){ - perror ("ethernet:attach: SO_ATTACH_FILTER"); - return false; - } - return true; - } - -} // namespace usrp2 diff --git a/usrp2/host/lib/ethernet.h b/usrp2/host/lib/ethernet.h deleted file mode 100644 index 24624f441..000000000 --- a/usrp2/host/lib/ethernet.h +++ /dev/null @@ -1,124 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2007,2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifndef INCLUDED_USRP2_ETHERNET_H -#define INCLUDED_USRP2_ETHERNET_H - -#include <string> -#include <vector> -#include <eth_common.h> - -namespace usrp2 { - - class pktfilter; - - /*! - * \brief Read and write ethernet frames. - * - * This provides a low level interface to hardware that communicates - * via raw (non-IP) ethernet frames. - */ - class ethernet { - int d_fd; - uint8_t d_mac[6]; - - public: - ethernet (); - ~ethernet (); - - static const int MAX_PKTLEN = 1512; - static const int MIN_PKTLEN = 64; - - /*! - * \param ifname ethernet interface name, e.g., "eth0" - * \param protocol is the ethertype protocol number in network order. - * Use 0 to receive all protocols. - */ - bool open (std::string ifname, int protocol); - - bool close (); - - /*! - * \brief attach packet filter to socket to restrict which packets read sees. - * \param pf the packet filter - */ - bool attach_pktfilter (pktfilter *pf); - - /*! - * \brief return 6 byte string containing our MAC address - */ - const uint8_t *mac () const { return d_mac; } - - /*! - * \brief Return file descriptor associated with socket. - */ - int fd () const { return d_fd; } - - /*! - * \brief Read packet from interface. - * - * \param buf where to put the packet - * \param buflen maximum length of packet in bytes (should be >= 1528) - * - * \returns number of bytes read or -1 if trouble. - * - * Returned packet includes 14-byte ethhdr - */ - int read_packet (void *buf, int buflen); - - /*! - * \brief Read packet from interface, but don't block waiting - * - * \param buf where to put the packet - * \param buflen maximum length of packet in bytes (should be >= 1528) - * - * \returns number of bytes read, -1 if trouble or 0 if nothing available. - * - * Returned packet includes 14-byte ethhdr - */ - int read_packet_dont_block (void *buf, int buflen); - - /* - * \brief Write ethernet packet to interface. - * - * \param buf the packet to write - * \param buflen length of packet in bytes - * - * \returns number of bytes written or -1 if trouble. - * - * Packet must begin with 14-byte ethhdr, but does not include the FCS. - */ - int write_packet (const void *buf, int buflen); - - /* - * \brief Write ethernet packet to interface. - * - * \param iov scatter/gather array - * \param iovlen number of elements in iov - * - * \returns number of bytes written or -1 if trouble. - * - * Packet must begin with 14-byte ethhdr, but does not include the FCS. - */ - int write_packetv (const eth_iovec *iov, size_t iovlen); - - }; - -} // namespace usrp2 - -#endif /* INCLUDED_USRP2_ETHERNET_H */ diff --git a/usrp2/host/lib/find.cc b/usrp2/host/lib/find.cc deleted file mode 100644 index d1df47fc5..000000000 --- a/usrp2/host/lib/find.cc +++ /dev/null @@ -1,182 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <usrp2_eth_packet.h> -#include <usrp2/usrp2.h> -#include <boost/scoped_ptr.hpp> -#include <boost/date_time/posix_time/posix_time_types.hpp> -#include "ethernet.h" -#include "pktfilter.h" -#include <string.h> -#include <iostream> -#include <stdexcept> -#include <cstdio> - -#define FIND_DEBUG 0 - - -// FIXME move to gruel - -static struct timeval -time_duration_to_timeval(boost::posix_time::time_duration delta) -{ - long total_us = delta.total_microseconds(); - if (total_us < 0) - throw std::invalid_argument("duration_to_time: delta is negative"); - - struct timeval tv; - tv.tv_sec = total_us / 1000000; - tv.tv_usec = total_us % 1000000; - return tv; -} - - -namespace usrp2 { - - static props - reply_to_props(const op_id_reply_t *r) - { - const uint8_t *mac = (const uint8_t *)&r->addr; - char addr_buf[128]; - snprintf(addr_buf, sizeof(addr_buf), "%02x:%02x:%02x:%02x:%02x:%02x", - mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); - - props p; - p.addr = std::string(addr_buf); - p.hw_rev = ntohs(r->hw_rev); - memcpy(p.fpga_md5sum, r->fpga_md5sum, sizeof(p.fpga_md5sum)); - memcpy(p.sw_md5sum, r->sw_md5sum, sizeof(p.sw_md5sum)); - return p; - } - - static void - read_replies(ethernet *enet, struct timeval timeout, - const std::string &target_addr, props_vector_t &result) - { - struct reply { - u2_eth_packet_t h; - op_id_reply_t op_id_reply; - }; - - uint8_t pktbuf[ethernet::MAX_PKTLEN]; - memset(pktbuf, 0, sizeof(pktbuf)); - - fd_set read_fds; - FD_ZERO(&read_fds); - FD_SET(enet->fd(), &read_fds); - - select(enet->fd()+1, &read_fds, 0, 0, &timeout); - while(1) { - memset(pktbuf, 0, sizeof(pktbuf)); - int len = enet->read_packet_dont_block(pktbuf, sizeof(pktbuf)); - if (len < 0){ - perror("usrp2_basic: read_packet_dont_block"); - return; - } - if (len == 0) - break; - - reply *rp = (reply *)pktbuf; - if (u2p_chan(&rp->h.fixed) != CONTROL_CHAN) // ignore - continue; - if (rp->op_id_reply.opcode != OP_ID_REPLY) // ignore - continue; - - props p = reply_to_props(&rp->op_id_reply); - if (FIND_DEBUG) - std::cerr << "usrp2::find: response from " << p.addr << std::endl; - - if ((target_addr == "") || (target_addr == p.addr)) - result.push_back(p); - } - } - - props_vector_t - find(const std::string &ifc, const std::string &addr) - { - if (FIND_DEBUG) { - std::cerr << "usrp2::find: Searching interface " << ifc << " for " - << (addr == "" ? "all USRP2s" : addr) - << std::endl; - } - - props_vector_t result; - struct command { - u2_eth_packet_t h; - op_generic_t op_id; - }; - - std::auto_ptr<ethernet> enet(new ethernet()); - - if (!enet->open(ifc, htons(U2_ETHERTYPE))) - return result; - - std::auto_ptr<pktfilter> pf(pktfilter::make_ethertype_inbound(U2_ETHERTYPE, enet->mac())); - if (!enet->attach_pktfilter(pf.get())) - return result; - - static u2_mac_addr_t broadcast_mac_addr = - {{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }}; - - uint8_t pktbuf[ethernet::MAX_PKTLEN]; - memset(pktbuf, 0, sizeof(pktbuf)); - - command *c = (command *)pktbuf; - c->h.ehdr.ethertype = htons(U2_ETHERTYPE); - c->h.ehdr.dst = broadcast_mac_addr; - memcpy(&c->h.ehdr.src, enet->mac(), 6); - c->h.thdr.flags = 0; - c->h.thdr.seqno = 0; - c->h.thdr.ack = 0; - u2p_set_word0(&c->h.fixed, 0, CONTROL_CHAN); - u2p_set_timestamp(&c->h.fixed, -1); - c->op_id.opcode = OP_ID; - c->op_id.len = sizeof(c->op_id); - int len = std::max((size_t) ethernet::MIN_PKTLEN, sizeof(command)); - if (enet->write_packet(c, len) != len) - return result; - - if (FIND_DEBUG) - std::cerr << "usrp2::find: broadcast ID command" << std::endl; - - /* - * Gather all responses that occur within 50ms - */ - boost::posix_time::ptime start(boost::posix_time::microsec_clock::universal_time()); - boost::posix_time::ptime limit(start + boost::posix_time::milliseconds(50)); - boost::posix_time::ptime now; - - while (1){ - now = boost::posix_time::microsec_clock::universal_time(); - if (now >= limit) - break; - - boost::posix_time::time_duration delta(limit - now); - struct timeval timeout = time_duration_to_timeval(delta); - - read_replies(enet.get(), timeout, addr, result); - } - return result; - } - -} // namespace usrp2 - diff --git a/usrp2/host/lib/open_usrp2_socket.cc b/usrp2/host/lib/open_usrp2_socket.cc deleted file mode 100644 index cd729205d..000000000 --- a/usrp2/host/lib/open_usrp2_socket.cc +++ /dev/null @@ -1,130 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <open_usrp2_socket.h> -#include <sys/types.h> -#include <sys/socket.h> -#include <sys/wait.h> -#include <stdio.h> -#include <errno.h> -#include <string> - -static const char *helper = "usrp2_socket_opener"; - -static ssize_t -read_fd(int fd, void *ptr, size_t nbytes, int *recvfd) -{ - struct msghdr msg; - struct iovec iov[1]; - ssize_t n; - -#ifdef HAVE_STRUCT_MSGHDR_MSG_CONTROL - union { - struct cmsghdr cm; - char control[CMSG_SPACE(sizeof (int))]; - } control_un; - struct cmsghdr *cmptr; - - msg.msg_control = control_un.control; - msg.msg_controllen = sizeof(control_un.control); -#else - int newfd; - - msg.msg_accrights = (char *) &newfd; - msg.msg_accrightslen = sizeof(int); -#endif - - msg.msg_name = NULL; - msg.msg_namelen = 0; - - iov[0].iov_base = ptr; - iov[0].iov_len = nbytes; - msg.msg_iov = iov; - msg.msg_iovlen = 1; - - if ((n = recvmsg(fd, &msg, 0)) <= 0) - return n; - -#ifdef HAVE_STRUCT_MSGHDR_MSG_CONTROL - if ((cmptr = CMSG_FIRSTHDR(&msg)) != NULL - && cmptr->cmsg_len == CMSG_LEN(sizeof(int))){ - if (cmptr->cmsg_level != SOL_SOCKET){ - fprintf(stderr, "read_fd: control level != SOL_SOCKET\n"); - return -1; - } - if (cmptr->cmsg_type != SCM_RIGHTS){ - fprintf(stderr, "read_fd: control type != SCM_RIGHTS\n"); - return -1; - } - *recvfd = *((int *) CMSG_DATA(cmptr)); - } else - *recvfd = -1; /* descriptor was not passed */ -#else - if (msg.msg_accrightslen == sizeof(int)) - *recvfd = newfd; - else - *recvfd = -1; /* descriptor was not passed */ -#endif - - return n; -} - -int -usrp2::open_usrp2_socket() -{ - int fd = -1, sockfd[2], status; - pid_t childpid; - char c, argsockfd[10]; - - if (socketpair(AF_LOCAL, SOCK_STREAM, 0, sockfd) != 0){ - perror("socketpair"); - return -1; - } - - if ((childpid = fork()) == 0) { /* child process */ - close(sockfd[0]); - snprintf(argsockfd, sizeof(argsockfd), "%d", sockfd[1]); - execlp(helper, helper, argsockfd, (char *) NULL); - std::string msg("execlp: couldn't exec " + std::string(helper)); - perror(msg.c_str()); - close(sockfd[0]); - close(sockfd[1]); - return -1; - } - - /* parent process - wait for the child to terminate */ - close(sockfd[1]); /* close the end we don't use */ - - waitpid(childpid, &status, 0); - if (!WIFEXITED(status)){ - fprintf(stderr, "child did not terminate\n"); - return -1; - } - if ((status = WEXITSTATUS(status)) == 0) - read_fd(sockfd[0], &c, 1, &fd); - else { - errno = status; /* bogus: set errno value from child's status */ - fd = -1; - } - - close(sockfd[0]); - return (fd); -} diff --git a/usrp2/host/lib/open_usrp2_socket.h b/usrp2/host/lib/open_usrp2_socket.h deleted file mode 100644 index d42440ea0..000000000 --- a/usrp2/host/lib/open_usrp2_socket.h +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ -#ifndef INCLUDED_OPEN_USRP2_SOCKET_H -#define INCLUDED_OPEN_USRP2_SOCKET_H - -namespace usrp2 { - - /*! - * Return the result of executing: - * - * int fd = socket(PF_PACKET, SOCK_RAW, htons(0xBEEF)); - * - * Doing it in a way that we don't need to be running as root. - */ - int open_usrp2_socket(); -}; - - -#endif /* INCLUDED_OPEN_USRP2_SOCKET_H */ diff --git a/usrp2/host/lib/pktfilter.cc b/usrp2/host/lib/pktfilter.cc deleted file mode 100644 index 1ccf90446..000000000 --- a/usrp2/host/lib/pktfilter.cc +++ /dev/null @@ -1,187 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2007,2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "pktfilter.h" -#include <iostream> -#include <sys/ioctl.h> -#include <sys/socket.h> -#include <net/if.h> -#include <features.h> -#include <netpacket/packet.h> -#include <net/ethernet.h> -#include <netinet/in.h> -#include <assert.h> -#include <linux/types.h> -#include <linux/filter.h> // packet filter - -namespace usrp2 { - - /* - * This is all based on the Berkeley Packet Filter (BPF) as implemented on Linux. - * - * The BPF allows you to run an interpreted program (a filter) in the - * kernel that sorts through the packets looking for ones you are - * interested in. This eliminates the overhead of passing all of the - * networking packets up into user space for filtering there. - * - * For documentation on this see - * /usr/src/linux/Documentation/networking/filter.txt, The BSD - * Berkeley Packet Filter manual page, and "The BSD Packet Filter: A - * New Architecture for User-level Packet Capture", by Steven McCanne - * and Van Jacobson. - */ - - pktfilter::pktfilter () - : d_len (0), d_inst (0) - { - // NOP - } - - pktfilter::~pktfilter () - { - delete [] d_inst; - } - - inline static sock_filter - make_stmt (__u16 code, __u32 k) - { - sock_filter f; - f.code = code; - f.jt = 0; - f.jf = 0; - f.k = k; - return f; - } - - inline static sock_filter - make_jump (__u16 code, __u32 k, __u8 jt, __u8 jf) - { - sock_filter f; - f.code = code; - f.jt = jt; - f.jf = jf; - f.k = k; - return f; - } - - /* - * Return a filter that harvests packets with the specified ethertype. - */ - pktfilter * - pktfilter::make_ethertype (unsigned short ethertype) - { - static const int MAX_LEN = 20; - sock_filter *inst = new sock_filter [MAX_LEN]; - pktfilter *pf = new pktfilter (); - - // nothing quite like coding in assembly without the benefit of an assembler ;-) - - // ignore packets that don't have the right ethertype - - int i = 0; - inst[i++] = make_stmt (BPF_LD|BPF_H|BPF_ABS, 12); // load ethertype - inst[i++] = make_jump (BPF_JMP|BPF_JEQ|BPF_K, ethertype, 1, 0); - inst[i++] = make_stmt (BPF_RET|BPF_K, 0); // return 0 (ignore packet) - inst[i++] = make_stmt (BPF_RET|BPF_K, (unsigned) -1); // return whole packet - - assert (i <= MAX_LEN); - - pf->d_inst = inst; - pf->d_len = i; - - return pf; - } - - /* - * Return a filter that harvests inbound packets with the specified ethertype. - * \param ethertype the ethertype we're looking for - * \param our_mac our ethernet MAC address so we can avoid pkts we sent - */ - pktfilter * - pktfilter::make_ethertype_inbound (unsigned short ethertype, const unsigned char *our_mac) - { - static const int MAX_LEN = 20; - sock_filter *inst = new sock_filter [MAX_LEN]; - pktfilter *pf = new pktfilter (); - - __u16 smac_hi = (our_mac[0] << 8) | our_mac[1]; - __u32 smac_lo = (our_mac[2] << 24) | (our_mac[3] << 16) | (our_mac[4] << 8) | our_mac[5]; - - // nothing quite like coding in assembly without the benefit of an assembler ;-) - - // ignore packets that have a different ethertype - // and packets that have a source mac address == our_mac (packets we sent) - - int i = 0; - inst[i++] = make_stmt (BPF_LD|BPF_H|BPF_ABS, 12); // load ethertype - inst[i++] = make_jump (BPF_JMP|BPF_JEQ|BPF_K, ethertype, 0, 5); - inst[i++] = make_stmt (BPF_LD|BPF_W|BPF_ABS, 8); // load low 32-bit of src mac - inst[i++] = make_jump (BPF_JMP|BPF_JEQ|BPF_K, smac_lo, 0, 2); - inst[i++] = make_stmt (BPF_LD|BPF_H|BPF_ABS, 6); // load high 16-bits of src mac - inst[i++] = make_jump (BPF_JMP|BPF_JEQ|BPF_K, smac_hi, 1, 0); - inst[i++] = make_stmt (BPF_RET|BPF_K, (unsigned) -1); // return whole packet - inst[i++] = make_stmt (BPF_RET|BPF_K, 0); // return 0 (ignore packet) - - assert (i <= MAX_LEN); - - pf->d_inst = inst; - pf->d_len = i; - - return pf; - } - /* - * Return a filter that harvests inbound packets with the specified ethertype and target USRP2 MAC address. - * \param ethertype the ethertype we're looking for - * \param usrp_mac our target USRP2 MAC address - */ - pktfilter * - pktfilter::make_ethertype_inbound_target (unsigned short ethertype, const unsigned char *usrp_mac) - { - static const int MAX_LEN = 20; - sock_filter *inst = new sock_filter [MAX_LEN]; - pktfilter *pf = new pktfilter (); - - __u16 tmac_hi = (usrp_mac[0] << 8) | usrp_mac[1]; - __u32 tmac_lo = (usrp_mac[2] << 24) | (usrp_mac[3] << 16) | (usrp_mac[4] << 8) | usrp_mac[5]; - - // ignore packets that have a different ethertype - // and only return packets that have a source mac address == usrp_mac - - int i = 0; - inst[i++] = make_stmt (BPF_LD|BPF_H|BPF_ABS, 12); // load ethertype - inst[i++] = make_jump (BPF_JMP|BPF_JEQ|BPF_K, ethertype, 0, 5); - inst[i++] = make_stmt (BPF_LD|BPF_W|BPF_ABS, 8); // load low 32-bit of src mac - inst[i++] = make_jump (BPF_JMP|BPF_JEQ|BPF_K, tmac_lo, 0, 3); - inst[i++] = make_stmt (BPF_LD|BPF_H|BPF_ABS, 6); // load high 16-bits of src mac - inst[i++] = make_jump (BPF_JMP|BPF_JEQ|BPF_K, tmac_hi, 0, 1); - inst[i++] = make_stmt (BPF_RET|BPF_K, (unsigned) -1); // return whole packet - inst[i++] = make_stmt (BPF_RET|BPF_K, 0); // return 0 (ignore packet) - - assert (i <= MAX_LEN); - - pf->d_inst = inst; - pf->d_len = i; - - return pf; - } - -} // namespace usrp2 diff --git a/usrp2/host/lib/pktfilter.h b/usrp2/host/lib/pktfilter.h deleted file mode 100644 index 09937ae34..000000000 --- a/usrp2/host/lib/pktfilter.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2007,2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifndef INCLUDED_USRP2_PKTFILTER_H -#define INCLUDED_USRP2_PKTFILTER_H - -struct sock_filter; - -namespace usrp2 { - - /* - * \brief Compile programs for the Berkeley Packet Filter - */ - class pktfilter { - public: - - unsigned d_len; // # of instructions - struct sock_filter *d_inst; // the instructions - - pktfilter (); - ~pktfilter (); - - /*! - * \brief Return a filter that harvests packets with the specified ethertype. - * \param ethertype the ethertype we're looking for. - */ - static pktfilter *make_ethertype (unsigned short ethertype); - - /*! - * \brief Return a filter that harvests inbound packets with the specified ethertype. - * \param ethertype the ethertype we're looking for - * \param our_mac our MAC address so we can avoid pkts we sent - */ - static pktfilter *make_ethertype_inbound (unsigned short ethertype, - const unsigned char *our_mac); - - /*! - * \brief Return a filter that harvests inbound packets with the specified ethertype - * and source MAC address - * \param ethertype the ethertype we're looking for - * \param usrp_mac the source MAC address - */ - static pktfilter *make_ethertype_inbound_target (unsigned short ethertype, - const unsigned char *usrp_mac); - }; - -} // namespace usrp2 - -#endif /* INCLUDED_USRP2_PKTFILTER_H */ diff --git a/usrp2/host/lib/ring.cc b/usrp2/host/lib/ring.cc deleted file mode 100644 index d0048418c..000000000 --- a/usrp2/host/lib/ring.cc +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,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, 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 "ring.h" - -namespace usrp2 { - - ring::ring(unsigned int entries) - : d_max(entries), d_read_ind(0), d_write_ind(0), d_ring(entries), - d_mutex(), d_not_empty() - { - for (unsigned int i = 0; i < entries; i++) { - d_ring[i].d_base = 0; - d_ring[i].d_len = 0; - } - } - - void - ring::wait_for_not_empty() - { - gruel::scoped_lock l(d_mutex); - while (empty()) - d_not_empty.wait(l); - } - - bool - ring::enqueue(void *p, size_t len) - { - gruel::scoped_lock l(d_mutex); - if (full()) - return false; - - d_ring[d_write_ind].d_len = len; - d_ring[d_write_ind].d_base = p; - - inc_write_ind(); - d_not_empty.notify_one(); - return true; - } - - bool - ring::dequeue(void **p, size_t *len) - { - gruel::scoped_lock l(d_mutex); - if (empty()) - return false; - - *p = d_ring[d_read_ind].d_base; - *len = d_ring[d_read_ind].d_len; - - inc_read_ind(); - return true; - } - -} // namespace usrp2 - diff --git a/usrp2/host/lib/ring.h b/usrp2/host/lib/ring.h deleted file mode 100644 index fd0ad0a9f..000000000 --- a/usrp2/host/lib/ring.h +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,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, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#ifndef INCLUDED_RING_H -#define INCLUDED_RING_H - -#include <stddef.h> -#include <vector> -#include <boost/shared_ptr.hpp> -#include <gruel/thread.h> - -namespace usrp2 { - - class ring; - typedef boost::shared_ptr<ring> ring_sptr; - - class ring - { - private: - - size_t d_max; - size_t d_read_ind; - size_t d_write_ind; - - struct ring_desc - { - void *d_base; - size_t d_len; - }; - std::vector<ring_desc> d_ring; - - gruel::mutex d_mutex; - gruel::condition_variable d_not_empty; - - void inc_read_ind() - { - if (d_read_ind + 1 >= d_max) - d_read_ind = 0; - else - d_read_ind = d_read_ind + 1; - } - - void inc_write_ind() - { - if (d_write_ind + 1 >= d_max) - d_write_ind = 0; - else - d_write_ind = d_write_ind + 1; - } - - bool empty() const { return d_read_ind == d_write_ind; } - bool full() const { return (d_write_ind+1)%d_max == d_read_ind; } - - public: - - ring(unsigned int entries); - - void wait_for_not_empty(); - - bool enqueue(void *p, size_t len); - bool dequeue(void **p, size_t *len); - }; - -} // namespace usrp2 - -#endif /* INCLUDED_RING_H */ diff --git a/usrp2/host/lib/rx_nop_handler.cc b/usrp2/host/lib/rx_nop_handler.cc deleted file mode 100644 index 96c9164a5..000000000 --- a/usrp2/host/lib/rx_nop_handler.cc +++ /dev/null @@ -1,35 +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 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 <usrp2/rx_nop_handler.h> - -namespace usrp2 { - - rx_nop_handler::~rx_nop_handler() - { - } - -} // namespace usrp2 - diff --git a/usrp2/host/lib/rx_sample_handler.cc b/usrp2/host/lib/rx_sample_handler.cc deleted file mode 100644 index 4521025cb..000000000 --- a/usrp2/host/lib/rx_sample_handler.cc +++ /dev/null @@ -1,27 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <usrp2/rx_sample_handler.h> - -usrp2::rx_sample_handler::~rx_sample_handler() -{ - // nop -} diff --git a/usrp2/host/lib/strtod_si.c b/usrp2/host/lib/strtod_si.c deleted file mode 100644 index 5e5deb2b6..000000000 --- a/usrp2/host/lib/strtod_si.c +++ /dev/null @@ -1,53 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#include <usrp2/strtod_si.h> -#include <stdlib.h> - -#define true 1 -#define false 0 - -int -strtod_si(const char *s, double *result) -{ - *result = 0; - - char *endptr; - double r = strtod(s, &endptr); - if (s == endptr) - return false; - - switch (*endptr){ - case 'p': r *= 1e-12; break; - case 'n': r *= 1e-9; break; - case 'u': r *= 1e-6; break; - case 'm': r *= 1e-3; break; - case 'k': r *= 1e3; break; - case 'M': r *= 1e6; break; - case 'G': r *= 1e9; break; - case 'T': r *= 1e12; break; - default: - // ignore. FIXME could be more robust - break; - } - - *result = r; - return true; -} - - diff --git a/usrp2/host/lib/usrp2.cc b/usrp2/host/lib/usrp2.cc deleted file mode 100644 index 0842482e4..000000000 --- a/usrp2/host/lib/usrp2.cc +++ /dev/null @@ -1,504 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2009 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <usrp2/usrp2.h> -#include "usrp2_impl.h" -#include <vector> -#include <boost/thread.hpp> -#include <boost/weak_ptr.hpp> -#include <string> -#include <stdexcept> -#include <cstdio> - -namespace usrp2 { - - // --- Table of weak pointers to usrps we know about --- - - // (Could be cleaned up and turned into a template) - - struct usrp_table_entry { - // inteface + normalized mac addr ("eth0:01:23:45:67:89:ab") - std::string key; - boost::weak_ptr<usrp2> value; - - usrp_table_entry(const std::string &_key, boost::weak_ptr<usrp2> _value) - : key(_key), value(_value) {} - }; - - typedef std::vector<usrp_table_entry> usrp_table; - - static boost::mutex s_table_mutex; - static usrp_table s_table; - - usrp2::sptr - usrp2::find_existing_or_make_new(const std::string &ifc, props *pr, size_t rx_bufsize) - { - std::string key = ifc + ":" + pr->addr; - - boost::mutex::scoped_lock guard(s_table_mutex); - - for (usrp_table::iterator p = s_table.begin(); p != s_table.end();){ - if (p->value.expired()) // weak pointer is now dead - p = s_table.erase(p); // erase it - else { - if (key == p->key) // found it - return usrp2::sptr(p->value); - else - ++p; // keep looking - } - } - - // We don't have the USRP2 we're looking for - - // create a new one and stick it in the table. - usrp2::sptr r(new usrp2(ifc, pr, rx_bufsize)); - usrp_table_entry t(key, r); - s_table.push_back(t); - - return r; - } - - // --- end of table code --- - - static bool - parse_mac_addr(const std::string &s, std::string &ns) - { - u2_mac_addr_t p; - - p.addr[0] = 0x00; // Matt's IAB - p.addr[1] = 0x50; - p.addr[2] = 0xC2; - p.addr[3] = 0x85; - p.addr[4] = 0x30; - p.addr[5] = 0x00; - - int len = s.size(); - switch (len) { - - case 5: - if (sscanf(s.c_str(), "%hhx:%hhx", &p.addr[4], &p.addr[5]) != 2) - return false; - break; - - case 17: - if (sscanf(s.c_str(), "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", - &p.addr[0], &p.addr[1], &p.addr[2], - &p.addr[3], &p.addr[4], &p.addr[5]) != 6) - return false; - break; - - default: - return false; - } - - char buf[128]; - snprintf(buf, sizeof(buf), - "%02x:%02x:%02x:%02x:%02x:%02x", - p.addr[0],p.addr[1],p.addr[2], - p.addr[3],p.addr[4],p.addr[5]); - ns = std::string(buf); - return true; - } - - usrp2::sptr - usrp2::make(const std::string &ifc, const std::string &addr, size_t rx_bufsize) - { - std::string naddr = ""; - if (addr != "" && !parse_mac_addr(addr, naddr)) - throw std::runtime_error("Invalid MAC address"); - - props_vector_t u2s = find(ifc, naddr); - int n = u2s.size(); - - if (n == 0) { - if (addr == "") - throw std::runtime_error("No USRPs found on interface " + ifc); - else - throw std::runtime_error("No USRP found with addr " + addr + " on interface " + ifc); - } - - if (n > 1) - throw std::runtime_error("Multiple USRPs found on interface; must select by MAC address."); - - return find_existing_or_make_new(ifc, &u2s[0], rx_bufsize); - } - - // Private constructor. Sole function is to create an impl. - usrp2::usrp2(const std::string &ifc, props *p, size_t rx_bufsize) - : d_impl(new usrp2::impl(ifc, p, rx_bufsize)) - { - // NOP - } - - // Public class destructor. d_impl will auto-delete. - usrp2::~usrp2() - { - // NOP - } - - std::string - usrp2::mac_addr() - { - return d_impl->mac_addr(); - } - - std::string - usrp2::interface_name() - { - return d_impl->interface_name(); - } - - // Receive - - bool - usrp2::set_rx_antenna(int ant){ - return d_impl->set_rx_antenna(ant); - } - - bool - usrp2::set_rx_gain(double gain) - { - return d_impl->set_rx_gain(gain); - } - - double - usrp2::rx_gain_min() - { - return d_impl->rx_gain_min(); - } - - double - usrp2::rx_gain_max() - { - return d_impl->rx_gain_max(); - } - - double - usrp2::rx_gain_db_per_step() - { - return d_impl->rx_gain_db_per_step(); - } - - bool - usrp2::set_rx_lo_offset(double frequency) - { - return d_impl->set_rx_lo_offset(frequency); - } - - bool - usrp2::set_rx_center_freq(double frequency, tune_result *result) - { - return d_impl->set_rx_center_freq(frequency, result); - } - - double - usrp2::rx_freq_min() - { - return d_impl->rx_freq_min(); - } - - double - usrp2::rx_freq_max() - { - return d_impl->rx_freq_max(); - } - - bool - usrp2::set_rx_decim(int decimation_factor) - { - return d_impl->set_rx_decim(decimation_factor); - } - - int - usrp2::rx_decim() - { - return d_impl->rx_decim(); - } - - bool - usrp2::set_rx_scale_iq(int scale_i, int scale_q) - { - return d_impl->set_rx_scale_iq(scale_i, scale_q); - } - - bool - usrp2::start_rx_streaming(unsigned int channel, unsigned int items_per_frame) - { - return d_impl->start_rx_streaming(channel, items_per_frame); - } - - bool - usrp2::start_rx_streaming_at(unsigned int channel, unsigned int items_per_frame, unsigned int time) - { - return d_impl->start_rx_streaming_at(channel, items_per_frame,time); - } - - bool - usrp2::sync_and_start_rx_streaming_at(unsigned int channel, unsigned int items_per_frame, unsigned int time) - { - return d_impl->sync_and_start_rx_streaming_at(channel, items_per_frame, time); - } - - bool - usrp2::rx_samples(unsigned int channel, rx_sample_handler *handler) - { - return d_impl->rx_samples(channel, handler); - } - - bool - usrp2::stop_rx_streaming(unsigned int channel) - { - return d_impl->stop_rx_streaming(channel); - } - - unsigned int - usrp2::rx_overruns() - { - return d_impl->rx_overruns(); - } - - unsigned int - usrp2::rx_missing() - { - return d_impl->rx_missing(); - } - - // Transmit - - bool - usrp2::set_tx_antenna(int ant){ - return d_impl->set_tx_antenna(ant); - } - - bool - usrp2::set_tx_gain(double gain) - { - return d_impl->set_tx_gain(gain); - } - - double - usrp2::tx_gain_min() - { - return d_impl->tx_gain_min(); - } - - double - usrp2::tx_gain_max() - { - return d_impl->tx_gain_max(); - } - - double - usrp2::tx_gain_db_per_step() - { - return d_impl->tx_gain_db_per_step(); - } - - bool - usrp2::set_tx_lo_offset(double frequency) - { - return d_impl->set_tx_lo_offset(frequency); - } - - bool - usrp2::set_tx_center_freq(double frequency, tune_result *result) - { - return d_impl->set_tx_center_freq(frequency, result); - } - - double - usrp2::tx_freq_min() - { - return d_impl->tx_freq_min(); - } - - double - usrp2::tx_freq_max() - { - return d_impl->tx_freq_max(); - } - - - bool - usrp2::set_tx_interp(int interpolation_factor) - { - return d_impl->set_tx_interp(interpolation_factor); - } - - int - usrp2::tx_interp() - { - return d_impl->tx_interp(); - } - - void - usrp2::default_tx_scale_iq(int interpolation_factor, int *scale_i, int *scale_q) - { - d_impl->default_tx_scale_iq(interpolation_factor, scale_i, scale_q); - } - - bool - usrp2::set_tx_scale_iq(int scale_i, int scale_q) - { - return d_impl->set_tx_scale_iq(scale_i, scale_q); - } - - bool - usrp2::tx_32fc(unsigned int channel, - const std::complex<float> *samples, - size_t nsamples, - const tx_metadata *metadata) - { - return d_impl->tx_32fc(channel, samples, nsamples, metadata); - } - - bool - usrp2::tx_16sc(unsigned int channel, - const std::complex<int16_t> *samples, - size_t nsamples, - const tx_metadata *metadata) - { - return d_impl->tx_16sc(channel, samples, nsamples, metadata); - } - - bool - usrp2::tx_raw(unsigned int channel, - const uint32_t *items, - size_t nitems, - const tx_metadata *metadata) - { - return d_impl->tx_raw(channel, items, nitems, metadata); - } - - // miscellaneous methods - - bool - usrp2::config_mimo(int flags) - { - return d_impl->config_mimo(flags); - } - - bool - usrp2::fpga_master_clock_freq(long *freq) - { - return d_impl->fpga_master_clock_freq(freq); - } - - bool - usrp2::adc_rate(long *rate) - { - return d_impl->adc_rate(rate); - } - - bool - usrp2::dac_rate(long *rate) - { - return d_impl->dac_rate(rate); - } - - bool - usrp2::tx_daughterboard_id(int *dbid) - { - return d_impl->tx_daughterboard_id(dbid); - } - - bool - usrp2::rx_daughterboard_id(int *dbid) - { - return d_impl->rx_daughterboard_id(dbid); - } - - - // low level methods - - bool - usrp2::burn_mac_addr(const std::string &new_addr) - { - return d_impl->burn_mac_addr(new_addr); - } - - bool - usrp2::sync_to_pps() - { - return d_impl->sync_to_pps(); - } - - bool - usrp2::sync_every_pps(bool enable) - { - return d_impl->sync_every_pps(enable); - } - - std::vector<uint32_t> - usrp2::peek32(uint32_t addr, uint32_t words) - { - return d_impl->peek32(addr, words); - } - - bool - usrp2::poke32(uint32_t addr, const std::vector<uint32_t> &data) - { - return d_impl->poke32(addr, data); - } - - bool - usrp2::set_gpio_ddr(int bank, uint16_t value, uint16_t mask) - { - return d_impl->set_gpio_ddr(bank, value, mask); - } - - bool - usrp2::set_gpio_sels(int bank, std::string src) - { - return d_impl->set_gpio_sels(bank, src); - } - - bool - usrp2::write_gpio(int bank, uint16_t value, uint16_t mask) - { - return d_impl->write_gpio(bank, value, mask); - } - - bool - usrp2::read_gpio(int bank, uint16_t *value) - { - return d_impl->read_gpio(bank, value); - } - - bool - usrp2::enable_gpio_streaming(int bank, int enable) - { - return d_impl->enable_gpio_streaming(bank, enable); - } - -} // namespace usrp2 - -std::ostream& operator<<(std::ostream &os, const usrp2::props &x) -{ - os << x.addr; - - char buf[128]; - snprintf(buf, sizeof(buf)," hw_rev = 0x%04x", x.hw_rev); - - os << buf; - return os; -} diff --git a/usrp2/host/lib/usrp2_bytesex.h b/usrp2/host/lib/usrp2_bytesex.h deleted file mode 100644 index 4f63d0793..000000000 --- a/usrp2/host/lib/usrp2_bytesex.h +++ /dev/null @@ -1,19 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#include <gruel/inet.h> diff --git a/usrp2/host/lib/usrp2_impl.cc b/usrp2/host/lib/usrp2_impl.cc deleted file mode 100644 index 333e2d1e7..000000000 --- a/usrp2/host/lib/usrp2_impl.cc +++ /dev/null @@ -1,1667 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2009,2010 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <usrp2/usrp2.h> -#include <usrp2/tune_result.h> -#include <usrp2/copiers.h> -#include <gruel/inet.h> -#include <gruel/realtime.h> -#include <boost/bind.hpp> -#include <usrp2_types.h> -#include "usrp2_impl.h" -#include "eth_buffer.h" -#include "pktfilter.h" -#include "control.h" -#include "ring.h" -#include <stdexcept> -#include <iostream> -#include <stdio.h> -#include <stddef.h> -#include <assert.h> -#include <string.h> - -#define USRP2_IMPL_DEBUG 0 -#if USRP2_IMPL_DEBUG -#define DEBUG_LOG(x) ::write(2, x, 1) -#else -#define DEBUG_LOG(x) -#endif - -static const int DEFAULT_RX_SCALE = 1024; - -namespace usrp2 { - - static const double DEF_CMD_TIMEOUT = 0.1; - - std::string - opcode_to_string(int opcode) - { - switch(opcode){ - case OP_EOP: return "OP_EOP"; - case OP_ID: return "OP_ID"; - case OP_ID_REPLY: return "OP_ID_REPLY"; - case OP_BURN_MAC_ADDR: return "OP_BURN_MAC_ADDR"; - case OP_READ_TIME: return "OP_READ_TIME"; - case OP_READ_TIME_REPLY: return "OP_READ_TIME_REPLY"; - case OP_CONFIG_RX_V2: return "OP_CONFIG_RX_V2"; - case OP_CONFIG_RX_REPLY_V2: return "OP_CONFIG_RX_REPLY_V2"; - case OP_CONFIG_TX_V2: return "OP_CONFIG_TX_V2"; - case OP_CONFIG_TX_REPLY_V2: return "OP_CONFIG_TX_REPLY_V2"; - case OP_START_RX_STREAMING: return "OP_START_RX_STREAMING"; - case OP_STOP_RX: return "OP_STOP_RX"; - case OP_CONFIG_MIMO: return "OP_CONFIG_MIMO"; - case OP_DBOARD_INFO: return "OP_DBOARD_INFO"; - case OP_DBOARD_INFO_REPLY: return "OP_DBOARD_INFO_REPLY"; - case OP_SYNC_TO_PPS: return "OP_SYNC_TO_PPS"; - case OP_PEEK: return "OP_PEEK"; - case OP_PEEK_REPLY: return "OP_PEEK_REPLY"; - case OP_SET_TX_LO_OFFSET: return "OP_SET_TX_LO_OFFSET"; - case OP_SET_TX_LO_OFFSET_REPLY: return "OP_SET_TX_LO_OFFSET_REPLY"; - case OP_SET_RX_LO_OFFSET: return "OP_SET_RX_LO_OFFSET"; - case OP_SET_RX_LO_OFFSET_REPLY: return "OP_SET_RX_LO_OFFSET_REPLY"; - case OP_SYNC_EVERY_PPS: return "OP_SYNC_EVERY_PPS"; - case OP_SYNC_EVERY_PPS_REPLY: return "OP_SYNC_EVERY_PPS_REPLY"; - - default: - char buf[64]; - snprintf(buf, sizeof(buf), "<unknown opcode: %d>", opcode); - return buf; - } - } - - - /*! - * \param p points to fixed header - * \param payload_len_in_bytes is length of the fixed hdr and the payload - * \param[out] items is set to point to the first uint32 item in the payload - * \param[out] nitems is set to the number of uint32 items in the payload - * \param[out] md is filled in with the parsed metadata from the frame. - */ - static bool - parse_rx_metadata(void *p, size_t payload_len_in_bytes, - uint32_t **items, size_t *nitems_in_uint32s, rx_metadata *md) - { - if (payload_len_in_bytes < sizeof(u2_fixed_hdr_t)) // invalid format - return false; - - // FIXME deal with the fact that (p % 4) == 2 - //assert((((uintptr_t) p) % 4) == 0); // must be 4-byte aligned - - u2_fixed_hdr_t *fh = static_cast<u2_fixed_hdr_t *>(p); - - // FIXME unaligned loads! - md->word0 = u2p_word0(fh); - md->timestamp = u2p_timestamp(fh); - - // FIXME when we've got more info - // md->start_of_burst = (md->word0 & XXX) != 0; - // md->end_of_burst = (md->word0 & XXX) != 0; - // md->rx_overrun = (md->word0 & XXX) != 0; - md->start_of_burst = 0; - md->end_of_burst = 0; - md->rx_overrun = 0; - - *items = (uint32_t *)(&fh[1]); - size_t nbytes = payload_len_in_bytes - sizeof(u2_fixed_hdr_t); - assert((nbytes % sizeof(uint32_t)) == 0); - *nitems_in_uint32s = nbytes / sizeof(uint32_t); - - return true; - } - - - usrp2::impl::impl(const std::string &ifc, props *p, size_t rx_bufsize) - : d_eth_buf(new eth_buffer(rx_bufsize)), d_interface_name(ifc), d_pf(0), - d_bg_running(false), d_rx_seqno(-1), d_tx_seqno(0), d_next_rid(0), - d_num_rx_frames(0), d_num_rx_missing(0), d_num_rx_overruns(0), d_num_rx_bytes(0), - d_num_enqueued(0), d_enqueued_mutex(), d_bg_pending_cond(), - d_channel_rings(NCHANS), d_tx_interp(0), d_rx_decim(0), d_dont_enqueue(true) - { - if (!d_eth_buf->open(ifc, htons(U2_ETHERTYPE))) - throw std::runtime_error("Unable to register USRP2 protocol"); - - d_addr = p->addr; - - // Create a packet filter for U2_ETHERTYPE packets sourced from target USRP2 - u2_mac_addr_t usrp_mac; - parse_mac_addr(d_addr, &usrp_mac); - d_pf = pktfilter::make_ethertype_inbound_target(U2_ETHERTYPE, (const unsigned char*)&(usrp_mac.addr)); - if (!d_pf || !d_eth_buf->attach_pktfilter(d_pf)) - throw std::runtime_error("Unable to attach packet filter."); - - if (USRP2_IMPL_DEBUG) - std::cerr << "usrp2 constructor: using USRP2 at " << d_addr << std::endl; - - memset(d_pending_replies, 0, sizeof(d_pending_replies)); - - // Kick off receive thread - start_bg(); - - // In case the USRP2 was left streaming RX - // FIXME: only one channel right now - stop_rx_streaming(0); - - if (!dboard_info()) // we're hosed - throw std::runtime_error("Unable to retrieve daughterboard info"); - - if (0){ - int dbid; - - tx_daughterboard_id(&dbid); - fprintf(stderr, "Tx dboard 0x%x\n", dbid); - fprintf(stderr, " freq_min = %g\n", tx_freq_min()); - fprintf(stderr, " freq_max = %g\n", tx_freq_max()); - fprintf(stderr, " gain_min = %g\n", tx_gain_min()); - fprintf(stderr, " gain_max = %g\n", tx_gain_max()); - fprintf(stderr, " gain_db_per_step = %g\n", tx_gain_db_per_step()); - - rx_daughterboard_id(&dbid); - fprintf(stderr, "Rx dboard 0x%x\n", dbid); - fprintf(stderr, " freq_min = %g\n", rx_freq_min()); - fprintf(stderr, " freq_max = %g\n", rx_freq_max()); - fprintf(stderr, " gain_min = %g\n", rx_gain_min()); - fprintf(stderr, " gain_max = %g\n", rx_gain_max()); - fprintf(stderr, " gain_db_per_step = %g\n", rx_gain_db_per_step()); - } - - // Ensure any custom values in hardware are cleared - if (!reset_db()) - std::cerr << "usrp2::ctor reset_db failed\n"; - - // default gains to mid point - if (!set_tx_gain((tx_gain_min() + tx_gain_max()) / 2)) - std::cerr << "usrp2::ctor set_tx_gain failed\n"; - - if (!set_rx_gain((rx_gain_min() + rx_gain_max()) / 2)) - std::cerr << "usrp2::ctor set_rx_gain failed\n"; - - // default interp and decim - if (!set_tx_interp(12)) - std::cerr << "usrp2::ctor set_tx_interp failed\n"; - - if (!set_rx_decim(12)) - std::cerr << "usrp2::ctor set_rx_decim failed\n"; - - // set workable defaults for scaling - if (!set_rx_scale_iq(DEFAULT_RX_SCALE, DEFAULT_RX_SCALE)) - std::cerr << "usrp2::ctor set_rx_scale_iq failed\n"; - } - - usrp2::impl::~impl() - { - stop_bg(); - delete d_pf; - d_eth_buf->close(); - delete d_eth_buf; - - if (USRP2_IMPL_DEBUG) { - std::cerr << std::endl - << "usrp2 destructor: received " << d_num_rx_frames - << " frames, with " << d_num_rx_missing << " lost (" - << (d_num_rx_frames == 0 ? 0 : (int)(100.0*d_num_rx_missing/d_num_rx_frames)) - << "%), totaling " << d_num_rx_bytes - << " bytes" << std::endl; - } - } - - bool - usrp2::impl::parse_mac_addr(const std::string &s, u2_mac_addr_t *p) - { - p->addr[0] = 0x00; // Matt's IAB - p->addr[1] = 0x50; - p->addr[2] = 0xC2; - p->addr[3] = 0x85; - p->addr[4] = 0x30; - p->addr[5] = 0x00; - - int len = s.size(); - - switch (len){ - - case 5: - return sscanf(s.c_str(), "%hhx:%hhx", &p->addr[4], &p->addr[5]) == 2; - - case 17: - return sscanf(s.c_str(), "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", - &p->addr[0], &p->addr[1], &p->addr[2], - &p->addr[3], &p->addr[4], &p->addr[5]) == 6; - default: - return false; - } - } - - void - usrp2::impl::init_et_hdrs(u2_eth_packet_t *p, const std::string &dst) - { - p->ehdr.ethertype = htons(U2_ETHERTYPE); - parse_mac_addr(dst, &p->ehdr.dst); - memcpy(&p->ehdr.src, d_eth_buf->mac(), 6); - p->thdr.flags = 0; // FIXME transport header values? - p->thdr.seqno = d_tx_seqno++; - p->thdr.ack = 0; - } - - void - usrp2::impl::init_etf_hdrs(u2_eth_packet_t *p, const std::string &dst, - int word0_flags, int chan, uint32_t timestamp) - { - init_et_hdrs(p, dst); - u2p_set_word0(&p->fixed, word0_flags, chan); - u2p_set_timestamp(&p->fixed, timestamp); - - if (chan == CONTROL_CHAN) { // no sequence numbers, back it out - p->thdr.seqno = 0; - d_tx_seqno--; - } - } - - void - usrp2::impl::init_config_rx_v2_cmd(op_config_rx_v2_cmd *cmd) - { - memset(cmd, 0, sizeof(*cmd)); - init_etf_hdrs(&cmd->h, d_addr, 0, CONTROL_CHAN, -1); - cmd->op.opcode = OP_CONFIG_RX_V2; - cmd->op.len = sizeof(cmd->op); - cmd->op.rid = d_next_rid++; - cmd->eop.opcode = OP_EOP; - cmd->eop.len = sizeof(cmd->eop); - } - - void - usrp2::impl::init_config_tx_v2_cmd(op_config_tx_v2_cmd *cmd) - { - memset(cmd, 0, sizeof(*cmd)); - init_etf_hdrs(&cmd->h, d_addr, 0, CONTROL_CHAN, -1); - cmd->op.opcode = OP_CONFIG_TX_V2; - cmd->op.len = sizeof(cmd->op); - cmd->op.rid = d_next_rid++; - cmd->eop.opcode = OP_EOP; - cmd->eop.len = sizeof(cmd->eop); - } - - - bool - usrp2::impl::transmit_cmd(void *cmd_, size_t len_) - { - const void *cmd = cmd_; - int len = len_; - unsigned char tmp[64]; - - if (len_ < 64){ // pad to minimum ethernet frame size - memset(tmp, 0, sizeof(tmp)); - memcpy(tmp, cmd_, len_); - cmd = tmp; - len = sizeof(tmp); - } - - return d_eth_buf->tx_frame(cmd, len) == eth_buffer::EB_OK; - } - - bool - usrp2::impl::transmit_cmd_and_wait(void *cmd, size_t len, pending_reply *p, double secs) - { - d_pending_replies[p->rid()] = p; - - if (!transmit_cmd(cmd, len)){ - d_pending_replies[p->rid()] = 0; - return false; - } - - int res = p->wait_for_completion(secs); - d_pending_replies[p->rid()] = 0; - return res == 1; - } - - // ---------------------------------------------------------------- - // Background loop: received packet demuxing - // ---------------------------------------------------------------- - - void - usrp2::impl::start_bg() - { - d_rx_tg.create_thread(boost::bind(&usrp2::impl::bg_loop, this)); - } - - void - usrp2::impl::stop_bg() - { - d_bg_running = false; - d_bg_pending_cond.notify_one(); // FIXME: check if needed - d_rx_tg.join_all(); - } - - void - usrp2::impl::bg_loop() - { - gruel::enable_realtime_scheduling(); - - d_bg_running = true; - while(d_bg_running) { - DEBUG_LOG(":"); - // Receive available frames from ethernet buffer. Handler will - // process control frames, enqueue data packets in channel - // rings, and signal blocked API threads - int res = d_eth_buf->rx_frames(this, 100); // FIXME magic timeout - if (res == eth_buffer::EB_ERROR) - break; - - // Wait for user API thread(s) to process all enqueued packets. - // The channel ring thread that decrements d_num_enqueued to zero - // will signal this thread to continue. - { - gruel::scoped_lock l(d_enqueued_mutex); - while(d_num_enqueued > 0 && d_bg_running) - d_bg_pending_cond.wait(l); - } - } - d_bg_running = false; - } - - // - // passed to eth_buffer::rx_frames - // - data_handler::result - usrp2::impl::operator()(const void *base, size_t len) - { - u2_eth_samples_t *pkt = (u2_eth_samples_t *)base; - - // FIXME unaligned load! - int chan = u2p_chan(&pkt->hdrs.fixed); - - if (chan == CONTROL_CHAN) { // control packets - DEBUG_LOG("c"); - return handle_control_packet(base, len); - } - else { // data packets - - if (d_dont_enqueue) // toss packet - return data_handler::RELEASE; - - return handle_data_packet(base, len); - } - - // not reached - } - - data_handler::result - usrp2::impl::handle_control_packet(const void *base, size_t len) - { - // point to beginning of payload (subpackets) - unsigned char *p = (unsigned char *)base + sizeof(u2_eth_packet_t); - - // FIXME (p % 4) == 2. Not good. Must watch for unaligned loads. - - // FIXME iterate over payload, handling more than a single subpacket. - - int opcode = p[0]; - unsigned int oplen = p[1]; - unsigned int rid = p[2]; - - pending_reply *rp = d_pending_replies[rid]; - if (rp) { - unsigned int buflen = rp->len(); - if (oplen != buflen) { - std::cerr << "usrp2: mismatched command reply length (expected: " - << buflen << " got: " << oplen << "). " - << "op = " << opcode_to_string(opcode) << std::endl; - } - - // Copy reply into caller's buffer - memcpy(rp->buffer(), p, std::min(oplen, buflen)); - rp->notify_completion(); - d_pending_replies[rid] = 0; - return data_handler::RELEASE; - } - - // TODO: handle unsolicited, USRP2 initiated, or late replies - DEBUG_LOG("l"); - return data_handler::RELEASE; - } - - data_handler::result - usrp2::impl::handle_data_packet(const void *base, size_t len) - { - u2_eth_samples_t *pkt = (u2_eth_samples_t *)base; - d_num_rx_frames++; - d_num_rx_bytes += len; - - /* --- FIXME start of fake transport layer handler --- */ - - if (d_rx_seqno != -1) { - int expected_seqno = (d_rx_seqno + 1) & 0xFF; - int seqno = pkt->hdrs.thdr.seqno; - - if (seqno != expected_seqno) { - ::write(2, "S", 1); // missing sequence number - int missing = seqno - expected_seqno; - if (missing < 0) - missing += 256; - - d_num_rx_overruns++; - d_num_rx_missing += missing; - } - } - - d_rx_seqno = pkt->hdrs.thdr.seqno; - - /* --- end of fake transport layer handler --- */ - - // FIXME unaligned load! - unsigned int chan = u2p_chan(&pkt->hdrs.fixed); - - { - gruel::scoped_lock l(d_channel_rings_mutex); - - if (!d_channel_rings[chan]) { - DEBUG_LOG("!"); - return data_handler::RELEASE; // discard packet, no channel handler - } - - // Strip off ethernet header and transport header and enqueue the rest - - size_t offset = offsetof(u2_eth_samples_t, hdrs.fixed); - if (d_channel_rings[chan]->enqueue(&pkt->hdrs.fixed, len-offset)) { - inc_enqueued(); - DEBUG_LOG("+"); - return data_handler::KEEP; // channel ring runner will mark frame done - } - else { - DEBUG_LOG("!"); - return data_handler::RELEASE; // discard, no room in channel ring - } - return data_handler::RELEASE; - } - } - - - // ---------------------------------------------------------------- - // Receive - // ---------------------------------------------------------------- - - bool - usrp2::impl::set_rx_antenna(int ant){ - op_config_mimo_cmd cmd; - op_generic_t reply; - - memset(&cmd, 0, sizeof(cmd)); - init_etf_hdrs(&cmd.h, d_addr, 0, CONTROL_CHAN, -1); - cmd.op.opcode = OP_RX_ANTENNA; - cmd.op.len = sizeof(cmd.op); - cmd.op.rid = d_next_rid++; - cmd.op.flags = ant; - cmd.eop.opcode = OP_EOP; - cmd.eop.len = sizeof(cmd.eop); - - pending_reply p(cmd.op.rid, &reply, sizeof(reply)); - if (!transmit_cmd_and_wait(&cmd, sizeof(cmd), &p, DEF_CMD_TIMEOUT)) - return false; - - return ntohx(reply.ok) == 1; - } - - bool - usrp2::impl::set_rx_gain(double gain) - { - op_config_rx_v2_cmd cmd; - op_config_rx_reply_v2_t reply; - - init_config_rx_v2_cmd(&cmd); - cmd.op.valid = htons(CFGV_GAIN); - cmd.op.gain = htons(u2_double_to_fxpt_gain(gain)); - - pending_reply p(cmd.op.rid, &reply, sizeof(reply)); - if (!transmit_cmd_and_wait(&cmd, sizeof(cmd), &p, DEF_CMD_TIMEOUT)) - return false; - - bool success = (ntohx(reply.ok) == 1); - return success; - } - - bool - usrp2::impl::set_rx_lo_offset(double frequency) - { - op_freq_cmd cmd; - op_generic_t reply; - - memset(&cmd, 0, sizeof(cmd)); - init_etf_hdrs(&cmd.h, d_addr, 0, CONTROL_CHAN, -1); - cmd.op.opcode = OP_SET_RX_LO_OFFSET; - cmd.op.len = sizeof(cmd.op); - cmd.op.rid = d_next_rid++; - - u2_fxpt_freq_t fxpt = u2_double_to_fxpt_freq(frequency); - cmd.op.freq_hi = htonl(u2_fxpt_freq_hi(fxpt)); - cmd.op.freq_lo = htonl(u2_fxpt_freq_lo(fxpt)); - - cmd.eop.opcode = OP_EOP; - cmd.eop.len = sizeof(cmd.eop); - - pending_reply p(cmd.op.rid, &reply, sizeof(reply)); - if (!transmit_cmd_and_wait(&cmd, sizeof(cmd), &p, DEF_CMD_TIMEOUT)) - return false; - - bool success = (ntohx(reply.ok) == 1); - return success; - } - - bool - usrp2::impl::set_rx_center_freq(double frequency, tune_result *result) - { - op_config_rx_v2_cmd cmd; - op_config_rx_reply_v2_t reply; - - init_config_rx_v2_cmd(&cmd); - cmd.op.valid = htons(CFGV_FREQ); - u2_fxpt_freq_t fxpt = u2_double_to_fxpt_freq(frequency); - cmd.op.freq_hi = htonl(u2_fxpt_freq_hi(fxpt)); - cmd.op.freq_lo = htonl(u2_fxpt_freq_lo(fxpt)); - - pending_reply p(cmd.op.rid, &reply, sizeof(reply)); - if (!transmit_cmd_and_wait(&cmd, sizeof(cmd), &p, DEF_CMD_TIMEOUT)) - return false; - - bool success = (ntohx(reply.ok) == 1); - if (result && success) { - result->baseband_freq = - u2_fxpt_freq_to_double( - u2_fxpt_freq_from_hilo(ntohl(reply.baseband_freq_hi), - ntohl(reply.baseband_freq_lo))); - - result->dxc_freq = - u2_fxpt_freq_to_double( - u2_fxpt_freq_from_hilo(ntohl(reply.ddc_freq_hi), - ntohl(reply.ddc_freq_lo))); - - result->residual_freq = - u2_fxpt_freq_to_double( - u2_fxpt_freq_from_hilo(ntohl(reply.residual_freq_hi), - ntohl(reply.residual_freq_lo))); - - result->spectrum_inverted = (bool)(ntohx(reply.inverted) == 1); - } - - return success; - } - - bool - usrp2::impl::set_rx_decim(int decimation_factor) - { - op_config_rx_v2_cmd cmd; - op_config_rx_reply_v2_t reply; - - init_config_rx_v2_cmd(&cmd); - cmd.op.valid = htons(CFGV_INTERP_DECIM); - cmd.op.decim = htonl(decimation_factor); - - pending_reply p(cmd.op.rid, &reply, sizeof(reply)); - if (!transmit_cmd_and_wait(&cmd, sizeof(cmd), &p, DEF_CMD_TIMEOUT)) - return false; - - bool success = (ntohx(reply.ok) == 1); - if (success) - d_rx_decim = decimation_factor; - return success; - } - - bool - usrp2::impl::set_rx_scale_iq(int scale_i, int scale_q) - { - op_config_rx_v2_cmd cmd; - op_config_rx_reply_v2_t reply; - - init_config_rx_v2_cmd(&cmd); - cmd.op.valid = htons(CFGV_SCALE_IQ); - cmd.op.scale_iq = htonl(((scale_i & 0xffff) << 16) | (scale_q & 0xffff)); - - pending_reply p(cmd.op.rid, &reply, sizeof(reply)); - if (!transmit_cmd_and_wait(&cmd, sizeof(cmd), &p, DEF_CMD_TIMEOUT)) - return false; - - bool success = (ntohx(reply.ok) == 1); - return success; - } - - bool - usrp2::impl::start_rx_streaming(unsigned int channel, unsigned int items_per_frame) - { - if (channel > MAX_CHAN) { - std::cerr << "usrp2: invalid channel number (" << channel - << ")" << std::endl; - return false; - } - - if (channel > 0) { // until firmware supports multiple streams - std::cerr << "usrp2: channel " << channel - << " not implemented" << std::endl; - return false; - } - - { - gruel::scoped_lock l(d_channel_rings_mutex); - if (d_channel_rings[channel]) { - std::cerr << "usrp2: channel " << channel - << " already streaming" << std::endl; - return false; - } - - if (items_per_frame == 0) - items_per_frame = U2_MAX_SAMPLES; // minimize overhead - - op_start_rx_streaming_cmd cmd; - op_generic_t reply; - - memset(&cmd, 0, sizeof(cmd)); - init_etf_hdrs(&cmd.h, d_addr, 0, CONTROL_CHAN, -1); - cmd.op.opcode = OP_START_RX_STREAMING; - cmd.op.len = sizeof(cmd.op); - cmd.op.rid = d_next_rid++; - cmd.op.items_per_frame = htonl(items_per_frame); - cmd.eop.opcode = OP_EOP; - cmd.eop.len = sizeof(cmd.eop); - - d_dont_enqueue = false; - bool success = false; - pending_reply p(cmd.op.rid, &reply, sizeof(reply)); - success = transmit_cmd_and_wait(&cmd, sizeof(cmd), &p, DEF_CMD_TIMEOUT); - success = success && (ntohx(reply.ok) == 1); - - if (success) - d_channel_rings[channel] = ring_sptr(new ring(d_eth_buf->max_frames())); - else - d_dont_enqueue = true; - - //fprintf(stderr, "usrp2::start_rx_streaming: success = %d\n", success); - return success; - } - } - - bool - usrp2::impl::start_rx_streaming_at(unsigned int channel, unsigned int items_per_frame, unsigned int time) - { - if (channel > MAX_CHAN) { - std::cerr << "usrp2: invalid channel number (" << channel - << ")" << std::endl; - return false; - } - - if (channel > 0) { // until firmware supports multiple streams - std::cerr << "usrp2: channel " << channel - << " not implemented" << std::endl; - return false; - } - - { - gruel::scoped_lock guard(d_channel_rings_mutex); - if (d_channel_rings[channel]) { - std::cerr << "usrp2: channel " << channel - << " already streaming" << std::endl; - return false; - } - - if (items_per_frame == 0) - items_per_frame = U2_MAX_SAMPLES; // minimize overhead - - op_start_rx_streaming_cmd cmd; - op_generic_t reply; - - memset(&cmd, 0, sizeof(cmd)); - init_etf_hdrs(&cmd.h, d_addr, 0, CONTROL_CHAN, time); - cmd.op.opcode = OP_START_RX_STREAMING; - cmd.op.len = sizeof(cmd.op); - cmd.op.rid = d_next_rid++; - cmd.op.items_per_frame = htonl(items_per_frame); - cmd.eop.opcode = OP_EOP; - cmd.eop.len = sizeof(cmd.eop); - - d_dont_enqueue = false; - bool success = false; - pending_reply p(cmd.op.rid, &reply, sizeof(reply)); - success = transmit_cmd_and_wait(&cmd, sizeof(cmd), &p, DEF_CMD_TIMEOUT); - success = success && (ntohx(reply.ok) == 1); - - if (success) - d_channel_rings[channel] = ring_sptr(new ring(d_eth_buf->max_frames())); - else - d_dont_enqueue = true; - - return success; - } - } - - bool - usrp2::impl::sync_and_start_rx_streaming_at(unsigned int channel, unsigned int items_per_frame, unsigned int time) - { - - if (channel > MAX_CHAN) { - std::cerr << "usrp2: invalid channel number (" << channel - << ")" << std::endl; - return false; - } - - if (channel > 0) { // until firmware supports multiple streams - std::cerr << "usrp2: channel " << channel - << " not implemented" << std::endl; - return false; - } - - { - gruel::scoped_lock guard(d_channel_rings_mutex); - if (d_channel_rings[channel]) { - std::cerr << "usrp2: channel " << channel - << " already streaming" << std::endl; - return false; - } - - if (items_per_frame == 0) - items_per_frame = U2_MAX_SAMPLES; // minimize overhead - - op_sync_and_start_rx_streaming_cmd cmd; - op_generic_t reply; - - memset(&cmd, 0, sizeof(cmd)); - init_etf_hdrs(&cmd.h, d_addr, 0, CONTROL_CHAN, time); - cmd.sync_op.opcode = OP_SYNC_TO_PPS; - cmd.sync_op.len = sizeof(cmd.sync_op); - cmd.sync_op.rid = d_next_rid++; - cmd.rx_op.opcode = OP_START_RX_STREAMING; - cmd.rx_op.len = sizeof(cmd.rx_op); - cmd.rx_op.rid = d_next_rid++; - cmd.rx_op.items_per_frame = htonl(items_per_frame); - cmd.eop.opcode = OP_EOP; - cmd.eop.len = sizeof(cmd.eop); - - d_dont_enqueue = false; - bool success = false; - pending_reply p(cmd.sync_op.rid, &reply, sizeof(reply)); - success = transmit_cmd_and_wait(&cmd, sizeof(cmd), &p, DEF_CMD_TIMEOUT); - success = success && (ntohx(reply.ok) == 1); - - if (success) - d_channel_rings[channel] = ring_sptr(new ring(d_eth_buf->max_frames())); - else - d_dont_enqueue = true; - - return success; - } - } - - bool - usrp2::impl::stop_rx_streaming(unsigned int channel) - { - if (channel > MAX_CHAN) { - std::cerr << "usrp2: invalid channel number (" << channel - << ")" << std::endl; - return false; - } - - if (channel > 0) { // until firmware supports multiple streams - std::cerr << "usrp2: channel " << channel - << " not implemented" << std::endl; - return false; - } - - d_dont_enqueue = true; // no new samples - flush_rx_samples(channel); // dump any we may already have - - op_stop_rx_cmd cmd; - op_generic_t reply; - - { - gruel::scoped_lock l(d_channel_rings_mutex); - - memset(&cmd, 0, sizeof(cmd)); - init_etf_hdrs(&cmd.h, d_addr, 0, CONTROL_CHAN, -1); - cmd.op.opcode = OP_STOP_RX; - cmd.op.len = sizeof(cmd.op); - cmd.op.rid = d_next_rid++; - cmd.eop.opcode = OP_EOP; - cmd.eop.len = sizeof(cmd.eop); - - bool success = false; - pending_reply p(cmd.op.rid, &reply, sizeof(reply)); - success = transmit_cmd_and_wait(&cmd, sizeof(cmd), &p, DEF_CMD_TIMEOUT); - success = success && (ntohx(reply.ok) == 1); - d_channel_rings[channel].reset(); - d_rx_seqno = -1; - //fprintf(stderr, "usrp2::stop_rx_streaming: success = %d\n", success); - return success; - } - } - - bool - usrp2::impl::rx_samples(unsigned int channel, rx_sample_handler *handler) - { - if (channel > MAX_CHAN) { - std::cerr << "usrp2: invalid channel (" << channel - << " )" << std::endl; - return false; - } - - if (channel > 0) { - std::cerr << "usrp2: channel " << channel - << " not implemented" << std::endl; - return false; - } - - ring_sptr rp = d_channel_rings[channel]; - if (!rp){ - std::cerr << "usrp2: channel " << channel - << " not receiving" << std::endl; - return false; - } - - // Wait for frames available in channel ring - DEBUG_LOG("W"); - rp->wait_for_not_empty(); - DEBUG_LOG("s"); - - // Iterate through frames and present to user - void *p; - size_t frame_len_in_bytes; - while (rp->dequeue(&p, &frame_len_in_bytes)) { - uint32_t *items; // points to beginning of data items - size_t nitems_in_uint32s; - rx_metadata md; - if (!parse_rx_metadata(p, frame_len_in_bytes, &items, &nitems_in_uint32s, &md)) - return false; - - bool want_more = (*handler)(items, nitems_in_uint32s, &md); - d_eth_buf->release_frame(p); - DEBUG_LOG("-"); - dec_enqueued(); - - if (!want_more) - break; - } - return true; - } - - bool - usrp2::impl::flush_rx_samples(unsigned int channel) - { - if (channel > MAX_CHAN) { - std::cerr << "usrp2: invalid channel (" << channel - << " )" << std::endl; - return false; - } - - if (channel > 0) { - std::cerr << "usrp2: channel " << channel - << " not implemented" << std::endl; - return false; - } - - ring_sptr rp = d_channel_rings[channel]; - if (!rp){ - return false; - } - - // Iterate through frames and drop them - void *p; - size_t frame_len_in_bytes; - while (rp->dequeue(&p, &frame_len_in_bytes)) { - d_eth_buf->release_frame(p); - dec_enqueued(); - } - return true; - } - - // ---------------------------------------------------------------- - // Transmit - // ---------------------------------------------------------------- - - bool - usrp2::impl::set_tx_antenna(int ant){ - op_config_mimo_cmd cmd; - op_generic_t reply; - - memset(&cmd, 0, sizeof(cmd)); - init_etf_hdrs(&cmd.h, d_addr, 0, CONTROL_CHAN, -1); - cmd.op.opcode = OP_TX_ANTENNA; - cmd.op.len = sizeof(cmd.op); - cmd.op.rid = d_next_rid++; - cmd.op.flags = ant; - cmd.eop.opcode = OP_EOP; - cmd.eop.len = sizeof(cmd.eop); - - pending_reply p(cmd.op.rid, &reply, sizeof(reply)); - if (!transmit_cmd_and_wait(&cmd, sizeof(cmd), &p, DEF_CMD_TIMEOUT)) - return false; - - return ntohx(reply.ok) == 1; - } - - bool - usrp2::impl::set_tx_gain(double gain) - { - op_config_tx_v2_cmd cmd; - op_config_tx_reply_v2_t reply; - - init_config_tx_v2_cmd(&cmd); - cmd.op.valid = htons(CFGV_GAIN); - cmd.op.gain = htons(u2_double_to_fxpt_gain(gain)); - - pending_reply p(cmd.op.rid, &reply, sizeof(reply)); - if (!transmit_cmd_and_wait(&cmd, sizeof(cmd), &p, DEF_CMD_TIMEOUT)) - return false; - - bool success = (ntohx(reply.ok) == 1); - return success; - } - - bool - usrp2::impl::set_tx_lo_offset(double frequency) - { - op_freq_cmd cmd; - op_generic_t reply; - - memset(&cmd, 0, sizeof(cmd)); - init_etf_hdrs(&cmd.h, d_addr, 0, CONTROL_CHAN, -1); - cmd.op.opcode = OP_SET_TX_LO_OFFSET; - cmd.op.len = sizeof(cmd.op); - cmd.op.rid = d_next_rid++; - - u2_fxpt_freq_t fxpt = u2_double_to_fxpt_freq(frequency); - cmd.op.freq_hi = htonl(u2_fxpt_freq_hi(fxpt)); - cmd.op.freq_lo = htonl(u2_fxpt_freq_lo(fxpt)); - - cmd.eop.opcode = OP_EOP; - cmd.eop.len = sizeof(cmd.eop); - - pending_reply p(cmd.op.rid, &reply, sizeof(reply)); - if (!transmit_cmd_and_wait(&cmd, sizeof(cmd), &p, DEF_CMD_TIMEOUT)) - return false; - - bool success = (ntohx(reply.ok) == 1); - return success; - } - - bool - usrp2::impl::set_tx_center_freq(double frequency, tune_result *result) - { - op_config_tx_v2_cmd cmd; - op_config_tx_reply_v2_t reply; - - init_config_tx_v2_cmd(&cmd); - cmd.op.valid = htons(CFGV_FREQ); - u2_fxpt_freq_t fxpt = u2_double_to_fxpt_freq(frequency); - cmd.op.freq_hi = htonl(u2_fxpt_freq_hi(fxpt)); - cmd.op.freq_lo = htonl(u2_fxpt_freq_lo(fxpt)); - - pending_reply p(cmd.op.rid, &reply, sizeof(reply)); - if (!transmit_cmd_and_wait(&cmd, sizeof(cmd), &p, DEF_CMD_TIMEOUT)) - return false; - - bool success = (ntohx(reply.ok) == 1); - if (result && success) { - result->baseband_freq = - u2_fxpt_freq_to_double( - u2_fxpt_freq_from_hilo(ntohl(reply.baseband_freq_hi), - ntohl(reply.baseband_freq_lo))); - - result->dxc_freq = - u2_fxpt_freq_to_double( - u2_fxpt_freq_from_hilo(ntohl(reply.duc_freq_hi), - ntohl(reply.duc_freq_lo))); - - result->residual_freq = - u2_fxpt_freq_to_double( - u2_fxpt_freq_from_hilo(ntohl(reply.residual_freq_hi), - ntohl(reply.residual_freq_lo))); - - result->spectrum_inverted = (bool)(ntohx(reply.inverted) == 1); - } - - return success; - } - - bool - usrp2::impl::set_tx_interp(int interpolation_factor) - { - op_config_tx_v2_cmd cmd; - op_config_tx_reply_v2_t reply; - - init_config_tx_v2_cmd(&cmd); - cmd.op.valid = htons(CFGV_INTERP_DECIM); - cmd.op.interp = htonl(interpolation_factor); - - pending_reply p(cmd.op.rid, &reply, sizeof(reply)); - if (!transmit_cmd_and_wait(&cmd, sizeof(cmd), &p, DEF_CMD_TIMEOUT)) - return false; - - bool success = (ntohx(reply.ok) == 1); - if (success) { - d_tx_interp = interpolation_factor; - - // Auto-set TX scaling based on interpolation rate - int scale_i, scale_q; - default_tx_scale_iq(d_tx_interp, &scale_i, &scale_q); - return set_tx_scale_iq(scale_i, scale_q); - } - - return success; - } - - void - usrp2::impl::default_tx_scale_iq(int interpolation_factor, int *scale_i, int *scale_q) - { - // Calculate CIC interpolation (i.e., without halfband interpolators) - int i = interpolation_factor; - if (i > 128) - i = i >> 1; - if (i > 128) - i = i >> 1; - - // Calculate dsp_core_tx gain absent scale multipliers - float gain = (1.65*i*i*i)/(4096*pow(2, ceil(log2(i*i*i)))); - - // Calculate closest multiplier constant to reverse gain - int scale = (int)rint(1.0/gain); - // fprintf(stderr, "if=%i i=%i gain=%f scale=%i\n", interpolation_factor, i, gain, scale); - - // Both I and Q are identical in this case - if (scale_i) - *scale_i = scale; - if (scale_q) - *scale_q = scale; - } - - bool - usrp2::impl::set_tx_scale_iq(int scale_i, int scale_q) - { - op_config_tx_v2_cmd cmd; - op_config_tx_reply_v2_t reply; - - init_config_tx_v2_cmd(&cmd); - cmd.op.valid = htons(CFGV_SCALE_IQ); - cmd.op.scale_iq = htonl(((scale_i & 0xffff) << 16) | (scale_q & 0xffff)); - - pending_reply p(cmd.op.rid, &reply, sizeof(reply)); - if (!transmit_cmd_and_wait(&cmd, sizeof(cmd), &p, DEF_CMD_TIMEOUT)) - return false; - - bool success = (ntohx(reply.ok) == 1); - return success; - } - - bool - usrp2::impl::tx_32fc(unsigned int channel, - const std::complex<float> *samples, - size_t nsamples, - const tx_metadata *metadata) - { - uint32_t items[nsamples]; - copy_host_32fc_to_u2_16sc(nsamples, samples, items); - return tx_raw(channel, items, nsamples, metadata); - } - - bool - usrp2::impl::tx_16sc(unsigned int channel, - const std::complex<int16_t> *samples, - size_t nsamples, - const tx_metadata *metadata) - { -#ifdef WORDS_BIGENDIAN - - // Already binary equivalent to 16-bit I/Q on the wire. - // No conversion required. - - assert(sizeof(samples[0]) == sizeof(uint32_t)); - return tx_raw(channel, (const uint32_t *) samples, nsamples, metadata); - -#else - - uint32_t items[nsamples]; - copy_host_16sc_to_u2_16sc(nsamples, samples, items); - return tx_raw(channel, items, nsamples, metadata); - -#endif - } - - bool - usrp2::impl::tx_raw(unsigned int channel, - const uint32_t *items, - size_t nitems, - const tx_metadata *metadata) - { - if (nitems == 0) - return true; - - // FIXME can't deal with nitems < U2_MIN_SAMPLES (will be fixed in VRT) - // FIXME need to check the MTU instead of assuming 1500 bytes - - // fragment as necessary then fire away - - size_t nframes = (nitems + U2_MAX_SAMPLES - 1) / U2_MAX_SAMPLES; - size_t last_frame = nframes - 1; - u2_eth_packet_t hdrs; - - size_t n = 0; - for (size_t fn = 0; fn < nframes; fn++){ - uint32_t timestamp = 0; - uint32_t flags = 0; - - if (fn == 0){ - timestamp = metadata->timestamp; - if (metadata->send_now) - flags |= U2P_TX_IMMEDIATE; - if (metadata->start_of_burst) - flags |= U2P_TX_START_OF_BURST; - } - if (fn > 0){ - flags |= U2P_TX_IMMEDIATE; - } - if (fn == last_frame){ - if (metadata->end_of_burst) - flags |= U2P_TX_END_OF_BURST; - } - - init_etf_hdrs(&hdrs, d_addr, flags, channel, timestamp); - - // Avoid short packet by splitting last two packets if reqd - size_t i; - if ((nitems - n) > U2_MAX_SAMPLES && (nitems - n) < (U2_MAX_SAMPLES + U2_MIN_SAMPLES)) - i = (nitems - n) / 2; - else - i = std::min((size_t) U2_MAX_SAMPLES, nitems - n); - - eth_iovec iov[2]; - iov[0].iov_base = &hdrs; - iov[0].iov_len = sizeof(hdrs); - iov[1].iov_base = const_cast<uint32_t *>(&items[n]); - iov[1].iov_len = i * sizeof(uint32_t); - - size_t total = iov[0].iov_len + iov[1].iov_len; - if (total < 64) - fprintf(stderr, "usrp2::tx_raw: FIXME: short packet: %zd items (%zd bytes)\n", i, total); - - if (d_eth_buf->tx_framev(iov, 2) != eth_buffer::EB_OK){ - return false; - } - - n += i; - } - - return true; - } - - // ---------------------------------------------------------------- - // misc commands - // ---------------------------------------------------------------- - - bool - usrp2::impl::config_mimo(int flags) - { - op_config_mimo_cmd cmd; - op_generic_t reply; - - memset(&cmd, 0, sizeof(cmd)); - init_etf_hdrs(&cmd.h, d_addr, 0, CONTROL_CHAN, -1); - cmd.op.opcode = OP_CONFIG_MIMO; - cmd.op.len = sizeof(cmd.op); - cmd.op.rid = d_next_rid++; - cmd.op.flags = flags; - cmd.eop.opcode = OP_EOP; - cmd.eop.len = sizeof(cmd.eop); - - pending_reply p(cmd.op.rid, &reply, sizeof(reply)); - if (!transmit_cmd_and_wait(&cmd, sizeof(cmd), &p, DEF_CMD_TIMEOUT)) - return false; - - return ntohx(reply.ok) == 1; - } - - bool - usrp2::impl::fpga_master_clock_freq(long *freq) - { - *freq = 100000000L; // 100 MHz - return true; - } - - bool - usrp2::impl::adc_rate(long *rate) - { - return fpga_master_clock_freq(rate); - } - - bool - usrp2::impl::dac_rate(long *rate) - { - return fpga_master_clock_freq(rate); - } - - bool - usrp2::impl::tx_daughterboard_id(int *dbid) - { - *dbid = d_tx_db_info.dbid; - return true; - } - - bool - usrp2::impl::rx_daughterboard_id(int *dbid) - { - *dbid = d_rx_db_info.dbid; - return true; - } - - - // ---------------------------------------------------------------- - // low-level commands - // ---------------------------------------------------------------- - - bool - usrp2::impl::burn_mac_addr(const std::string &new_addr) - { - op_burn_mac_addr_cmd cmd; - op_generic_t reply; - - memset(&cmd, 0, sizeof(cmd)); - init_etf_hdrs(&cmd.h, d_addr, 0, CONTROL_CHAN, -1); - cmd.op.opcode = OP_BURN_MAC_ADDR; - cmd.op.len = sizeof(cmd.op); - cmd.op.rid = d_next_rid++; - if (!parse_mac_addr(new_addr, &cmd.op.addr)) - return false; - - pending_reply p(cmd.op.rid, &reply, sizeof(reply)); - if (!transmit_cmd_and_wait(&cmd, sizeof(cmd), &p, 4*DEF_CMD_TIMEOUT)) - return false; - - bool success = (ntohx(reply.ok) == 1); - return success; - } - - static void - fill_dboard_info(db_info *dst, const u2_db_info_t *src) - { - dst->dbid = ntohl(src->dbid); - - dst->freq_min = - u2_fxpt_freq_to_double(u2_fxpt_freq_from_hilo(ntohl(src->freq_min_hi), - ntohl(src->freq_min_lo))); - dst->freq_max = - u2_fxpt_freq_to_double(u2_fxpt_freq_from_hilo(ntohl(src->freq_max_hi), - ntohl(src->freq_max_lo))); - - dst->gain_min = u2_fxpt_gain_to_double(ntohs(src->gain_min)); - dst->gain_max = u2_fxpt_gain_to_double(ntohs(src->gain_max)); - dst->gain_step_size = u2_fxpt_gain_to_double(ntohs(src->gain_step_size)); - } - - bool - usrp2::impl::dboard_info() - { - op_dboard_info_cmd cmd; - op_dboard_info_reply_t reply; - - memset(&cmd, 0, sizeof(cmd)); - init_etf_hdrs(&cmd.h, d_addr, 0, CONTROL_CHAN, -1); - cmd.op.opcode = OP_DBOARD_INFO; - cmd.op.len = sizeof(cmd.op); - cmd.op.rid = d_next_rid++; - cmd.eop.opcode = OP_EOP; - cmd.eop.len = sizeof(cmd.eop); - - pending_reply p(cmd.op.rid, &reply, sizeof(reply)); - if (!transmit_cmd_and_wait(&cmd, sizeof(cmd), &p, DEF_CMD_TIMEOUT)) - return false; - - bool success = (ntohx(reply.ok) == 1); - if (success){ - fill_dboard_info(&d_tx_db_info, &reply.tx_db_info); - fill_dboard_info(&d_rx_db_info, &reply.rx_db_info); - } - return success; - } - - - bool - usrp2::impl::sync_to_pps() - { - op_generic_cmd cmd; - op_generic_t reply; - - memset(&cmd, 0, sizeof(cmd)); - init_etf_hdrs(&cmd.h, d_addr, 0, CONTROL_CHAN, -1); - cmd.op.opcode = OP_SYNC_TO_PPS; - cmd.op.len = sizeof(cmd.op); - cmd.op.rid = d_next_rid++; - cmd.eop.opcode = OP_EOP; - cmd.eop.len = sizeof(cmd.eop); - - pending_reply p(cmd.op.rid, &reply, sizeof(reply)); - if (!transmit_cmd_and_wait(&cmd, sizeof(cmd), &p, DEF_CMD_TIMEOUT)) - return false; - - return ntohx(reply.ok) == 1; - } - - bool - usrp2::impl::sync_every_pps(bool enable) - { - op_generic_cmd cmd; - op_generic_t reply; - - memset(&cmd, 0, sizeof(cmd)); - init_etf_hdrs(&cmd.h, d_addr, 0, CONTROL_CHAN, -1); - cmd.op.opcode = OP_SYNC_EVERY_PPS; - cmd.op.len = sizeof(cmd.op); - cmd.op.rid = d_next_rid++; - cmd.op.ok = enable ? 1 : 0; - cmd.eop.opcode = OP_EOP; - cmd.eop.len = sizeof(cmd.eop); - - pending_reply p(cmd.op.rid, &reply, sizeof(reply)); - if (!transmit_cmd_and_wait(&cmd, sizeof(cmd), &p, DEF_CMD_TIMEOUT)) - return false; - - return ntohx(reply.ok) == 1; - } - - std::vector<uint32_t> - usrp2::impl::peek32(uint32_t addr, uint32_t words) - { - std::vector<uint32_t> result; // zero sized on error return - // fprintf(stderr, "usrp2::peek: addr=%08X words=%u\n", addr, words); - - if (addr % 4 != 0) { - fprintf(stderr, "usrp2::peek: addr (=%08X) must be 32-bit word aligned\n", addr); - return result; - } - - if (words == 0) - return result; - - op_peek_cmd cmd; - op_generic_t *reply; - - int wlen = sizeof(uint32_t); - int rlen = sizeof(op_generic_t); - size_t bytes = words*wlen; - - memset(&cmd, 0, sizeof(cmd)); - init_etf_hdrs(&cmd.h, d_addr, 0, CONTROL_CHAN, -1); - cmd.op.opcode = OP_PEEK; - cmd.op.len = sizeof(cmd.op); - cmd.op.rid = d_next_rid++; - cmd.eop.opcode = OP_EOP; - cmd.eop.len = sizeof(cmd.eop); - - cmd.op.addr = htonl(addr); - cmd.op.bytes = htonl(bytes); - - reply = (op_generic_t *)malloc(rlen+bytes); - pending_reply p(cmd.op.rid, reply, rlen+bytes); - if (transmit_cmd_and_wait(&cmd, sizeof(cmd), &p, DEF_CMD_TIMEOUT)) { - uint32_t nwords = (reply->len-rlen)/sizeof(uint32_t); - uint32_t *data = (uint32_t *)(reply+rlen/wlen); - for (unsigned int i = 0; i < nwords; i++) - result.push_back(ntohl(data[i])); - } - - free(reply); - return result; - } - - bool - usrp2::impl::poke32(uint32_t addr, const std::vector<uint32_t> &data) - { - if (addr % 4 != 0) { - fprintf(stderr, "usrp2::poke32: addr (=%08X) must be 32-bit word aligned\n", addr); - return false; - } - - int plen = sizeof(op_poke_cmd); - int wlen = sizeof(uint32_t); - int max_words = (MAX_SUBPKT_LEN-plen)/wlen; - int words = data.size(); - - if (words > max_words) { - fprintf(stderr, "usrp2::poke32: write size (=%u) exceeds maximum of %u words\n", - words, max_words); - return false; - } - - //fprintf(stderr, "usrp2::poke32: addr=%08X words=%u\n", addr, words); - - if (words == 0) - return true; // NOP - - op_poke_cmd *cmd; - op_generic_t *eop; - - // Allocate, clear, and initialize command packet - int bytes = words*wlen; - int l = plen+bytes+sizeof(*eop); // op_poke_cmd+data+eop - cmd = (op_poke_cmd *)malloc(l); - //fprintf(stderr, "cmd=%p l=%i\n", cmd, l); - memset(cmd, 0, l); - init_etf_hdrs(&cmd->h, d_addr, 0, CONTROL_CHAN, -1); - cmd->op.opcode = OP_POKE; - cmd->op.len = sizeof(cmd->op)+bytes; - cmd->op.rid = d_next_rid++; - cmd->op.addr = htonl(addr); - - // Copy data from vector into packet space - uint32_t *dest = (uint32_t *)((uint8_t *)cmd+plen); - for (int i = 0; i < words; i++) { - //fprintf(stderr, "%03i@%p\n", i, dest); - *dest++ = htonl(data[i]); - } - - // Write end-of-packet subpacket - eop = (op_generic_t *)dest; - eop->opcode = OP_EOP; - eop->len = sizeof(*eop); - //fprintf(stderr, "eop=%p len=%i\n", eop, eop->len); - - // Send command to device and retrieve reply - bool ok = false; - op_generic_t reply; - pending_reply p(cmd->op.rid, &reply, sizeof(reply)); - if (transmit_cmd_and_wait(cmd, l, &p, DEF_CMD_TIMEOUT)) - ok = (ntohx(reply.ok) == 1); - - free(cmd); - return ok; - } - - bool - usrp2::impl::reset_db() - { - op_generic_cmd cmd; - op_generic_t reply; - - memset(&cmd, 0, sizeof(cmd)); - init_etf_hdrs(&cmd.h, d_addr, 0, CONTROL_CHAN, -1); - cmd.op.opcode = OP_RESET_DB; - cmd.op.len = sizeof(cmd.op); - cmd.op.rid = d_next_rid++; - cmd.eop.opcode = OP_EOP; - cmd.eop.len = sizeof(cmd.eop); - - pending_reply p(cmd.op.rid, &reply, sizeof(reply)); - if (!transmit_cmd_and_wait(&cmd, sizeof(cmd), &p, DEF_CMD_TIMEOUT)) - return false; - - bool success = (ntohx(reply.ok) == 1); - return success; - } - - bool usrp2::impl::set_gpio_ddr(int bank, uint16_t value, uint16_t mask) - { - if (bank != GPIO_TX_BANK && bank != GPIO_RX_BANK) { - fprintf(stderr, "set_gpio_ddr: bank must be one of GPIO_RX_BANK or GPIO_TX_BANK\n"); - return false; - } - - op_gpio_cmd cmd; - op_generic_t reply; - - memset(&cmd, 0, sizeof(cmd)); - init_etf_hdrs(&cmd.h, d_addr, 0, CONTROL_CHAN, -1); - cmd.op.opcode = OP_GPIO_SET_DDR; - cmd.op.len = sizeof(cmd.op); - cmd.op.rid = d_next_rid++; - cmd.op.bank = static_cast<uint8_t>(bank); - cmd.op.value = htons(value); - cmd.op.mask = htons(mask); - cmd.eop.opcode = OP_EOP; - cmd.eop.len = sizeof(cmd.eop); - - pending_reply p(cmd.op.rid, &reply, sizeof(reply)); - if (!transmit_cmd_and_wait(&cmd, sizeof(cmd), &p, DEF_CMD_TIMEOUT)) - return false; - - bool success = (ntohx(reply.ok) == 1); - return success; - } - - bool usrp2::impl::set_gpio_sels(int bank, std::string sels) - { - if (bank != GPIO_TX_BANK && bank != GPIO_RX_BANK) { - fprintf(stderr, "set_gpio_ddr: bank must be one of GPIO_RX_BANK or GPIO_TX_BANK\n"); - return false; - } - - if (sels.size() != 16) { - fprintf(stderr, "set_gpio_sels: sels must be exactly 16 bytes\n"); - return false; - } - - op_gpio_set_sels_cmd cmd; - op_generic_t reply; - - memset(&cmd, 0, sizeof(cmd)); - init_etf_hdrs(&cmd.h, d_addr, 0, CONTROL_CHAN, -1); - cmd.op.opcode = OP_GPIO_SET_SELS; - cmd.op.len = sizeof(cmd.op); - cmd.op.rid = d_next_rid++; - cmd.op.bank = static_cast<uint8_t>(bank); - memcpy(&cmd.op.sels, sels.c_str(), 16); - cmd.eop.opcode = OP_EOP; - cmd.eop.len = sizeof(cmd.eop); - - pending_reply p(cmd.op.rid, &reply, sizeof(reply)); - if (!transmit_cmd_and_wait(&cmd, sizeof(cmd), &p, DEF_CMD_TIMEOUT)) - return false; - - bool success = (ntohx(reply.ok) == 1); - return success; - } - - bool usrp2::impl::write_gpio(int bank, uint16_t value, uint16_t mask) - { - if (bank != GPIO_TX_BANK && bank != GPIO_RX_BANK) { - fprintf(stderr, "set_gpio_ddr: bank must be one of GPIO_RX_BANK or GPIO_TX_BANK\n"); - return false; - } - - op_gpio_cmd cmd; - op_generic_t reply; - - memset(&cmd, 0, sizeof(cmd)); - init_etf_hdrs(&cmd.h, d_addr, 0, CONTROL_CHAN, -1); - cmd.op.opcode = OP_GPIO_WRITE; - cmd.op.len = sizeof(cmd.op); - cmd.op.rid = d_next_rid++; - cmd.op.bank = static_cast<uint8_t>(bank); - cmd.op.value = htons(value); - cmd.op.mask = htons(mask); - cmd.eop.opcode = OP_EOP; - cmd.eop.len = sizeof(cmd.eop); - - pending_reply p(cmd.op.rid, &reply, sizeof(reply)); - if (!transmit_cmd_and_wait(&cmd, sizeof(cmd), &p, DEF_CMD_TIMEOUT)) - return false; - - bool success = (ntohx(reply.ok) == 1); - return success; - } - - bool usrp2::impl::read_gpio(int bank, uint16_t *value) - { - if (bank != GPIO_TX_BANK && bank != GPIO_RX_BANK) { - fprintf(stderr, "set_gpio_ddr: bank must be one of GPIO_RX_BANK or GPIO_TX_BANK\n"); - return false; - } - - op_gpio_cmd cmd; - op_gpio_read_reply_t reply; - - memset(&cmd, 0, sizeof(cmd)); - init_etf_hdrs(&cmd.h, d_addr, 0, CONTROL_CHAN, -1); - cmd.op.opcode = OP_GPIO_READ; - cmd.op.len = sizeof(cmd.op); - cmd.op.rid = d_next_rid++; - cmd.op.bank = static_cast<uint8_t>(bank); - cmd.op.value = 0; // not used - cmd.op.mask = 0; // not used - cmd.eop.opcode = OP_EOP; - cmd.eop.len = sizeof(cmd.eop); - - pending_reply p(cmd.op.rid, &reply, sizeof(reply)); - if (!transmit_cmd_and_wait(&cmd, sizeof(cmd), &p, DEF_CMD_TIMEOUT)) - return false; - - bool success = (ntohx(reply.ok) == 1); - if (success && (value != NULL)) - *value = ntohs(reply.value); - - return success; - } - - bool usrp2::impl::enable_gpio_streaming(int bank, int enable) - { - if (bank != GPIO_RX_BANK) { - fprintf(stderr, "enable_gpio_streaming: only RX streaming is currently implemented\n"); - return false; - } - - if ((enable & ~0x03) != 0) { - fprintf(stderr, "enable_gpio_streaming: invalid enable format\n"); - return false; - } - - op_gpio_cmd cmd; - op_generic_t reply; - - memset(&cmd, 0, sizeof(cmd)); - init_etf_hdrs(&cmd.h, d_addr, 0, CONTROL_CHAN, -1); - cmd.op.opcode = OP_GPIO_STREAM; - cmd.op.len = sizeof(cmd.op); - cmd.op.rid = d_next_rid++; - cmd.op.bank = static_cast<uint8_t>(bank); - cmd.op.value = htons((uint16_t)enable); - cmd.op.mask = 0; // not used - cmd.eop.opcode = OP_EOP; - cmd.eop.len = sizeof(cmd.eop); - - pending_reply p(cmd.op.rid, &reply, sizeof(reply)); - if (!transmit_cmd_and_wait(&cmd, sizeof(cmd), &p, DEF_CMD_TIMEOUT)) - return false; - - bool success = (ntohx(reply.ok) == 1); - return success; - } - -} // namespace usrp2 diff --git a/usrp2/host/lib/usrp2_impl.h b/usrp2/host/lib/usrp2_impl.h deleted file mode 100644 index eee26358e..000000000 --- a/usrp2/host/lib/usrp2_impl.h +++ /dev/null @@ -1,210 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2009,2010 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -#ifndef INCLUDED_USRP2_IMPL_H -#define INCLUDED_USRP2_IMPL_H - -#include <usrp2/usrp2.h> -#include <usrp2/data_handler.h> -#include <usrp2_eth_packet.h> -#include <gruel/thread.h> -#include <boost/scoped_ptr.hpp> -#include "control.h" -#include "ring.h" -#include <string> - -#define MAX_SUBPKT_LEN 252 - -namespace usrp2 { - - class eth_buffer; - class pktfilter; - class usrp2_thread; - class usrp2_tune_result; - class pending_reply; - class ring; - - //! High-level d'board info - struct db_info { - int dbid; - double freq_min; // Hz - double freq_max; // Hz - double gain_min; // dB - double gain_max; // dB - double gain_step_size; // dB - - db_info() : dbid(-1), freq_min(0), freq_max(0), - gain_min(0), gain_max(0), gain_step_size(0) {} - }; - - class usrp2::impl : private data_handler - { - static const size_t NRIDS = 256; - static const size_t NCHANS = 32; - - eth_buffer *d_eth_buf; - std::string d_interface_name; - pktfilter *d_pf; - std::string d_addr; // FIXME: use u2_mac_addr_t instead - - boost::thread_group d_rx_tg; - volatile bool d_bg_running; // TODO: multistate if needed - - int d_rx_seqno; - int d_tx_seqno; - int d_next_rid; - unsigned int d_num_rx_frames; - unsigned int d_num_rx_missing; - unsigned int d_num_rx_overruns; - unsigned int d_num_rx_bytes; - - unsigned int d_num_enqueued; - gruel::mutex d_enqueued_mutex; - gruel::condition_variable d_bg_pending_cond; - - // all pending_replies are stack allocated, thus no possibility of leaking these - pending_reply *d_pending_replies[NRIDS]; // indexed by 8-bit reply id - - std::vector<ring_sptr> d_channel_rings; // indexed by 5-bit channel number - gruel::mutex d_channel_rings_mutex; - - db_info d_tx_db_info; - db_info d_rx_db_info; - - int d_tx_interp; // shadow tx interp - int d_rx_decim; // shadow rx decim - - bool d_dont_enqueue; - - void inc_enqueued() { - gruel::scoped_lock l(d_enqueued_mutex); - d_num_enqueued++; - } - - void dec_enqueued() { - gruel::scoped_lock l(d_enqueued_mutex); - if (--d_num_enqueued == 0) - d_bg_pending_cond.notify_one(); - } - - static bool parse_mac_addr(const std::string &s, u2_mac_addr_t *p); - void init_et_hdrs(u2_eth_packet_t *p, const std::string &dst); - void init_etf_hdrs(u2_eth_packet_t *p, const std::string &dst, - int word0_flags, int chan, uint32_t timestamp); - void start_bg(); - void stop_bg(); - void init_config_rx_v2_cmd(op_config_rx_v2_cmd *cmd); - void init_config_tx_v2_cmd(op_config_tx_v2_cmd *cmd); - bool transmit_cmd_and_wait(void *cmd, size_t len, pending_reply *p, double secs=0.0); - bool transmit_cmd(void *cmd, size_t len); - virtual data_handler::result operator()(const void *base, size_t len); - data_handler::result handle_control_packet(const void *base, size_t len); - data_handler::result handle_data_packet(const void *base, size_t len); - bool dboard_info(); - bool reset_db(); - - public: - impl(const std::string &ifc, props *p, size_t rx_bufsize); - ~impl(); - - std::string mac_addr() const { return d_addr; } // FIXME: convert from u2_mac_addr_t - std::string interface_name() const { return d_interface_name; } - - // Rx - - bool set_rx_antenna(int ant); - bool set_rx_gain(double gain); - double rx_gain_min() { return d_rx_db_info.gain_min; } - double rx_gain_max() { return d_rx_db_info.gain_max; } - double rx_gain_db_per_step() { return d_rx_db_info.gain_step_size; } - bool set_rx_lo_offset(double frequency); - bool set_rx_center_freq(double frequency, tune_result *result); - double rx_freq_min() { return d_rx_db_info.freq_min; } - double rx_freq_max() { return d_rx_db_info.freq_max; } - bool set_rx_decim(int decimation_factor); - int rx_decim() { return d_rx_decim; } - bool set_rx_scale_iq(int scale_i, int scale_q); - bool set_gpio_ddr(int bank, uint16_t value, uint16_t mask); - bool set_gpio_sels(int bank, std::string src); - bool enable_gpio_streaming(int bank, int enable); - bool write_gpio(int bank, uint16_t value, uint16_t mask); - bool read_gpio(int bank, uint16_t *value); - bool start_rx_streaming(unsigned int channel, unsigned int items_per_frame); - bool start_rx_streaming_at(unsigned int channel, unsigned int items_per_frame, unsigned int time); - bool sync_and_start_rx_streaming_at(unsigned int channel, unsigned int items_per_frame, unsigned int time); - bool rx_samples(unsigned int channel, rx_sample_handler *handler); - bool flush_rx_samples(unsigned int channel); - bool stop_rx_streaming(unsigned int channel); - unsigned int rx_overruns() const { return d_num_rx_overruns; } - unsigned int rx_missing() const { return d_num_rx_missing; } - - // Tx - - bool set_tx_antenna(int ant); - bool set_tx_gain(double gain); - double tx_gain_min() { return d_tx_db_info.gain_min; } - double tx_gain_max() { return d_tx_db_info.gain_max; } - double tx_gain_db_per_step() { return d_tx_db_info.gain_step_size; } - bool set_tx_lo_offset(double frequency); - bool set_tx_center_freq(double frequency, tune_result *result); - double tx_freq_min() { return d_tx_db_info.freq_min; } - double tx_freq_max() { return d_tx_db_info.freq_max; } - bool set_tx_interp(int interpolation_factor); - int tx_interp() { return d_tx_interp; } - void default_tx_scale_iq(int interpolation_factor, int *scale_i, int *scale_q); - bool set_tx_scale_iq(int scale_i, int scale_q); - - bool tx_32fc(unsigned int channel, - const std::complex<float> *samples, - size_t nsamples, - const tx_metadata *metadata); - - bool tx_16sc(unsigned int channel, - const std::complex<int16_t> *samples, - size_t nsamples, - const tx_metadata *metadata); - - bool tx_raw(unsigned int channel, - const uint32_t *items, - size_t nitems, - const tx_metadata *metadata); - - // misc - - bool config_mimo(int flags); - bool fpga_master_clock_freq(long *freq); - bool adc_rate(long *rate); - bool dac_rate(long *rate); - bool tx_daughterboard_id(int *dbid); - bool rx_daughterboard_id(int *dbid); - - // low level - - bool burn_mac_addr(const std::string &new_addr); - bool sync_to_pps(); - bool sync_every_pps(bool enable); - std::vector<uint32_t> peek32(uint32_t addr, uint32_t words); - bool poke32(uint32_t addr, const std::vector<uint32_t> &data); - - // Receive thread, need to be public for boost::bind - void bg_loop(); - }; - -} // namespace usrp2 - -#endif /* INCLUDED_USRP2_IMPL_H */ diff --git a/usrp2/host/lib/usrp2_socket_opener.cc b/usrp2/host/lib/usrp2_socket_opener.cc deleted file mode 100644 index 27d3935e4..000000000 --- a/usrp2/host/lib/usrp2_socket_opener.cc +++ /dev/null @@ -1,143 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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/>. - */ - -/*! - * setuid root program that opens a socket using (PF_PACKET, SOCK_RAW, - * htons(0xBEEF)), and sends the resulting file descriptor by way of - * of the file descriptor specified as the first command line argument. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <sys/types.h> -#include <sys/socket.h> -#include <stdint.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <stdio.h> -#include <errno.h> -#ifdef HAVE_ARPA_INET_H -#include <arpa/inet.h> -#elif defined(HAVE_NETINET_IN_H) -#include <netinet/in.h> -#endif - - -ssize_t -write_fd(int fd, const void *ptr, size_t nbytes, int sendfd) -{ - struct msghdr msg; - struct iovec iov[1]; - -#ifdef HAVE_STRUCT_MSGHDR_MSG_CONTROL - union { - struct cmsghdr cm; - char control[CMSG_SPACE(sizeof(int))]; - } control_un; - struct cmsghdr *cmptr; - - msg.msg_control = control_un.control; - msg.msg_controllen = sizeof(control_un.control); - - cmptr = CMSG_FIRSTHDR(&msg); - cmptr->cmsg_len = CMSG_LEN(sizeof(int)); - cmptr->cmsg_level = SOL_SOCKET; - cmptr->cmsg_type = SCM_RIGHTS; - *((int *) CMSG_DATA(cmptr)) = sendfd; -#else - msg.msg_accrights = (char *) &sendfd; - msg.msg_accrightslen = sizeof(int); -#endif - - msg.msg_name = NULL; - msg.msg_namelen = 0; - - iov[0].iov_base = const_cast<void *>(ptr); - iov[0].iov_len = nbytes; - msg.msg_iov = iov; - msg.msg_iovlen = 1; - - return sendmsg(fd, &msg, 0); -} - -bool -reset_eids() -{ - if (setgid(getgid()) < 0){ - perror("setguid"); - return false; - } - - if (setuid(getuid()) < 0){ - perror("setuid"); - return false; - } - - return true; -} - - -static void -usage() -{ - fprintf(stderr, "usage: usrp2_socket_opener file-descriptor\n"); - exit(1); -} - -int -main(int argc, char **argv) -{ - if (argc != 2) - usage(); - - char *endptr; - int unix_domain_fd = strtol(argv[1], &endptr, 0); - if (*endptr != 0) - usage(); - - // FIXME get client credentials from unix_domain_fd using SCM_CREDENTIALS - - // open the raw socket - int socket_fd = socket(PF_PACKET, SOCK_RAW, htons(0xBEEF)); - if (socket_fd == -1){ - perror("socket(PF_PACKET, SOCK_RAW, htons(0xBEEF))"); - // printf("errno = %d\n", errno); - if (errno == EACCES || errno == ESPIPE){ - fprintf(stderr, "usrp2_socket_opener must be setuid root to open the socket using SOCK_RAW.\n"); - fprintf(stderr, "Running as root, please execute: \n"); - fprintf(stderr, " # chown root:usrp usrp2_socket_opener\n"); - fprintf(stderr, " # chmod 04750 usrp2_socket_opener\n"); - } - exit(2); - } - - // drop privs - if (!reset_eids()){ - fprintf(stderr, "Can't drop root permissions\n"); - exit(3); - } - - if (write_fd(unix_domain_fd, "", 1, socket_fd) != 1){ - perror("write_fd"); - exit(4); - } - - return 0; -} diff --git a/usrp2/host/usrp2.pc.in b/usrp2/host/usrp2.pc.in deleted file mode 100644 index 0c862a877..000000000 --- a/usrp2/host/usrp2.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: usrp2 -Description: Universal Software Radio Peripheral 2 -Requires: gruel -Version: @LIBVER@ -Libs: -L${libdir} -lusrp2 -Cflags: -I${includedir} @DEFINES@ |