diff options
Diffstat (limited to 'gr-usrp2')
42 files changed, 0 insertions, 3186 deletions
diff --git a/gr-usrp2/.gitignore b/gr-usrp2/.gitignore deleted file mode 100644 index a43ae9c692..0000000000 --- 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 895032fb0b..0000000000 --- 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 b336cc7cec..0000000000 --- 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 e1cec4cfc3..0000000000 --- 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 1f23eee4e2..0000000000 --- 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 2222badd7d..0000000000 --- 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 b336cc7cec..0000000000 --- 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 2502bf363d..0000000000 --- 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 c71a092b10..0000000000 --- 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 38c8f655ce..0000000000 --- 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 cc3f9c2fd2..0000000000 --- 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 74995da990..0000000000 --- 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 a23c5bc5c1..0000000000 --- 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 71f8258201..0000000000 --- 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 a84637f730..0000000000 --- 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 78cb4e5c69..0000000000 --- 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 fd4289af56..0000000000 --- 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 3c1ff87f5d..0000000000 --- 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 7ead5015dc..0000000000 --- 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 33e44aeed8..0000000000 --- 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 5d08b0dd53..0000000000 --- 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 3f068256ee..0000000000 --- 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 7fb9ad06f9..0000000000 --- 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 9d5b1f2e95..0000000000 --- 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 c9c2515586..0000000000 --- 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 f2ce2b55df..0000000000 --- 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 69544c5e6b..0000000000 --- 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 bb99597254..0000000000 --- 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 67a62ba106..0000000000 --- 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 75cc1f4a6b..0000000000 --- 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 faacc447a3..0000000000 --- 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 fa75b38057..0000000000 --- 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 b63f96871e..0000000000 --- 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 c9b34a54a9..0000000000 --- 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 d831d4df69..0000000000 --- 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 33114b51d3..0000000000 --- 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 d5a86be735..0000000000 --- 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 89b4bea0ed..0000000000 --- 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 041416ded6..0000000000 --- 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 d946991dec..0000000000 --- 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 9e35e2e936..0000000000 --- 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 6e8fa1960a..0000000000 --- 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 |