summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config/grc_gr_uhd.m445
-rw-r--r--configure.ac8
-rw-r--r--gr-howto-write-a-block/version.sh4
-rw-r--r--gr-uhd/.gitignore2
-rw-r--r--gr-uhd/Makefile.am29
-rw-r--r--gr-uhd/apps/.gitignore2
-rw-r--r--gr-uhd/apps/Makefile.am22
-rw-r--r--gr-uhd/grc/.gitignore4
-rw-r--r--gr-uhd/grc/Makefile.am62
-rwxr-xr-xgr-uhd/grc/gen_uhd_multi_usrp_blocks_xml.py293
-rwxr-xr-xgr-uhd/grc/gen_uhd_single_usrp_blocks_xml.py269
-rw-r--r--gr-uhd/grc/uhd_block_tree.xml23
-rw-r--r--gr-uhd/grc/uhd_mimo_sink.xml549
-rw-r--r--gr-uhd/grc/uhd_mimo_source.xml549
-rw-r--r--gr-uhd/grc/uhd_simple_sink.xml101
-rw-r--r--gr-uhd/grc/uhd_simple_source.xml101
-rw-r--r--gr-uhd/lib/.gitignore2
-rw-r--r--gr-uhd/lib/Makefile.am56
-rw-r--r--gr-uhd/lib/uhd_mimo_sink.cc161
-rw-r--r--gr-uhd/lib/uhd_mimo_sink.h145
-rw-r--r--gr-uhd/lib/uhd_mimo_source.cc166
-rw-r--r--gr-uhd/lib/uhd_mimo_source.h145
-rw-r--r--gr-uhd/lib/uhd_multi_usrp_sink.cc188
-rw-r--r--gr-uhd/lib/uhd_multi_usrp_sink.h175
-rw-r--r--gr-uhd/lib/uhd_multi_usrp_source.cc187
-rw-r--r--gr-uhd/lib/uhd_multi_usrp_source.h175
-rw-r--r--gr-uhd/lib/uhd_simple_sink.cc152
-rw-r--r--gr-uhd/lib/uhd_simple_sink.h147
-rw-r--r--gr-uhd/lib/uhd_simple_source.cc183
-rw-r--r--gr-uhd/lib/uhd_simple_source.h147
-rw-r--r--gr-uhd/lib/uhd_single_usrp_sink.cc183
-rw-r--r--gr-uhd/lib/uhd_single_usrp_sink.h173
-rw-r--r--gr-uhd/lib/uhd_single_usrp_source.cc182
-rw-r--r--gr-uhd/lib/uhd_single_usrp_source.h173
-rw-r--r--gr-uhd/swig/.gitignore4
-rw-r--r--gr-uhd/swig/Makefile.am69
-rw-r--r--gr-uhd/swig/Makefile.swig.gen259
-rw-r--r--gr-uhd/swig/__init__.py40
-rw-r--r--gr-uhd/swig/uhd_swig.i111
-rw-r--r--grc/base/Param.py2
-rw-r--r--grc/python/Generator.py2
-rw-r--r--version.sh6
-rw-r--r--vrt/README10
43 files changed, 5299 insertions, 7 deletions
diff --git a/config/grc_gr_uhd.m4 b/config/grc_gr_uhd.m4
new file mode 100644
index 0000000000..090187c04c
--- /dev/null
+++ b/config/grc_gr_uhd.m4
@@ -0,0 +1,45 @@
+dnl Copyright 2010 Free Software Foundation, Inc.
+dnl
+dnl This file is part of GNU Radio
+dnl
+dnl GNU Radio is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 3, or (at your option)
+dnl any later version.
+dnl
+dnl GNU Radio is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+dnl GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with GNU Radio; see the file COPYING. If not, write to
+dnl the Free Software Foundation, Inc., 51 Franklin Street,
+dnl Boston, MA 02110-1301, USA.
+
+AC_DEFUN([GRC_GR_UHD],[
+ GRC_ENABLE(gr-uhd)
+
+ dnl Dont do gr-uhd if gnuradio-core skipped
+ GRC_CHECK_DEPENDENCY(gr-uhd, gnuradio-core)
+
+ if test $passed = yes; then
+ dnl Don't do gr-uhd if the 'uhd' package is not installed
+ PKG_CHECK_MODULES(
+ [UHD], [uhd], [],
+ [passed=no; AC_MSG_RESULT([gr-uhd requires libuhd])]
+ )
+ AC_SUBST(UHD_CFLAGS)
+ AC_SUBST(UHD_LIBS)
+ fi
+
+ AC_CONFIG_FILES([ \
+ gr-uhd/Makefile \
+ gr-uhd/apps/Makefile \
+ gr-uhd/grc/Makefile \
+ gr-uhd/lib/Makefile \
+ gr-uhd/swig/Makefile \
+ ])
+
+ GRC_BUILD_CONDITIONAL(gr-uhd)
+])
diff --git a/configure.ac b/configure.ac
index 19d1931721..91bbe755a3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -19,6 +19,13 @@ dnl Boston, MA 02110-1301, USA.
AC_INIT
AC_PREREQ(2.57)
+
+dnl Set the prefix to the default when --prefix is not specified.
+dnl This is critical for variable substitutions in the configure.
+if test "${prefix}" = "NONE"; then
+ prefix=${ac_default_prefix}
+fi
+
AM_CONFIG_HEADER(config.h)
AC_CONFIG_SRCDIR([gnuradio-core/src/lib/runtime/gr_vmcircbuf.cc])
@@ -367,6 +374,7 @@ GRC_GR_SOUNDER dnl this must come after GRC_USRP
GRC_GR_UTILS dnl this must come after GRC_GR_WXGUI
GRC_GNURADIO_EXAMPLES dnl must come after all GRC_GR_*
GRC_GRC
+GRC_GR_UHD
GRC_DOCS dnl must be last
# Each component is now either to be built, was skipped, will be
diff --git a/gr-howto-write-a-block/version.sh b/gr-howto-write-a-block/version.sh
index 01a47b5d92..0d6cc96f0d 100644
--- a/gr-howto-write-a-block/version.sh
+++ b/gr-howto-write-a-block/version.sh
@@ -1,4 +1,4 @@
MAJOR_VERSION=3
-API_COMPAT=3
-MINOR_VERSION=0
+API_COMPAT=4
+MINOR_VERSION=git
MAINT_VERSION=0
diff --git a/gr-uhd/.gitignore b/gr-uhd/.gitignore
new file mode 100644
index 0000000000..b336cc7cec
--- /dev/null
+++ b/gr-uhd/.gitignore
@@ -0,0 +1,2 @@
+/Makefile
+/Makefile.in
diff --git a/gr-uhd/Makefile.am b/gr-uhd/Makefile.am
new file mode 100644
index 0000000000..83190a1d06
--- /dev/null
+++ b/gr-uhd/Makefile.am
@@ -0,0 +1,29 @@
+#
+# 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 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 = lib apps
+
+if PYTHON
+SUBDIRS += swig grc
+endif
+
diff --git a/gr-uhd/apps/.gitignore b/gr-uhd/apps/.gitignore
new file mode 100644
index 0000000000..b336cc7cec
--- /dev/null
+++ b/gr-uhd/apps/.gitignore
@@ -0,0 +1,2 @@
+/Makefile
+/Makefile.in
diff --git a/gr-uhd/apps/Makefile.am b/gr-uhd/apps/Makefile.am
new file mode 100644
index 0000000000..b78d07ee82
--- /dev/null
+++ b/gr-uhd/apps/Makefile.am
@@ -0,0 +1,22 @@
+#
+# 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 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
diff --git a/gr-uhd/grc/.gitignore b/gr-uhd/grc/.gitignore
new file mode 100644
index 0000000000..d8ab9bd0c3
--- /dev/null
+++ b/gr-uhd/grc/.gitignore
@@ -0,0 +1,4 @@
+/uhd_multi*.xml
+/uhd_single*.xml
+/Makefile
+/Makefile.in
diff --git a/gr-uhd/grc/Makefile.am b/gr-uhd/grc/Makefile.am
new file mode 100644
index 0000000000..d424ca7096
--- /dev/null
+++ b/gr-uhd/grc/Makefile.am
@@ -0,0 +1,62 @@
+#
+# 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 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
+
+grcblocksdir = $(grc_blocksdir)
+
+generated_uhd_multi_usrp_blocks = \
+ uhd_multi_usrp_source.xml \
+ uhd_multi_usrp_sink.xml
+
+generated_uhd_single_usrp_blocks = \
+ uhd_single_usrp_source.xml \
+ uhd_single_usrp_sink.xml
+
+BUILT_SOURCES = \
+ $(generated_uhd_multi_usrp_blocks) \
+ $(generated_uhd_single_usrp_blocks)
+
+dist_grcblocks_DATA = \
+ uhd_block_tree.xml \
+ $(BUILT_SOURCES)
+
+# add the deprecated files
+dist_grcblocks_DATA += \
+ uhd_mimo_source.xml \
+ uhd_mimo_sink.xml \
+ uhd_simple_source.xml \
+ uhd_simple_sink.xml
+
+########################################################################
+# Rules for generating the source and sink xml wrappers
+########################################################################
+EXTRA_DIST = \
+ $(srcdir)/gen_uhd_multi_usrp_blocks_xml.py \
+ $(srcdir)/gen_uhd_single_usrp_blocks_xml.py
+
+$(generated_uhd_multi_usrp_blocks): $(srcdir)/gen_uhd_multi_usrp_blocks_xml.py
+ @echo "generating $@..."
+ $(PYTHON) $< $@
+
+$(generated_uhd_single_usrp_blocks): $(srcdir)/gen_uhd_single_usrp_blocks_xml.py
+ @echo "generating $@..."
+ $(PYTHON) $< $@
diff --git a/gr-uhd/grc/gen_uhd_multi_usrp_blocks_xml.py b/gr-uhd/grc/gen_uhd_multi_usrp_blocks_xml.py
new file mode 100755
index 0000000000..112d881599
--- /dev/null
+++ b/gr-uhd/grc/gen_uhd_multi_usrp_blocks_xml.py
@@ -0,0 +1,293 @@
+#!/usr/bin/env python
+"""
+Copyright 2010 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
+"""
+
+MAIN_TMPL = """\
+<?xml version="1.0"?>
+<block>
+ <name>UHD: Multi USRP $sourk.title()</name>
+ <key>uhd_multi_usrp_$(sourk)</key>
+ <import>from gnuradio import uhd</import>
+ <make>uhd.multi_usrp_$(sourk)(
+ device_addr=\$dev_addr,
+ io_type=uhd.io_type_t.\$type.type,
+ num_channels=\$nchan,
+)
+\#if \$sync()
+_clk_cfg = uhd.clock_config_t()
+_clk_cfg.ref_source = uhd.clock_config_t.REF_SMA
+_clk_cfg.pps_source = uhd.clock_config_t.PPS_SMA
+_clk_cfg.pps_polarity = uhd.clock_config_t.PPS_POS
+self.\$(id).set_clock_config(_clk_cfg, uhd.ALL_MBOARDS);
+self.\$(id).set_time_unknown_pps(uhd.time_spec_t())
+\#end if
+#for $m in range($max_mboards)
+\#if \$num_mboards() > $m and \$sd_spec$(m)()
+self.\$(id).set_subdev_spec(\$sd_spec$(m), $m)
+\#end if
+#end for
+self.\$(id).set_samp_rate(\$samp_rate)
+#for $n in range($max_nchan)
+\#if \$nchan() > $n
+self.\$(id).set_center_freq(\$center_freq$(n), $n)
+self.\$(id).set_gain(\$gain$(n), $n)
+ \#if \$ant$(n)()
+self.\$(id).set_antenna(\$ant$(n), $n)
+ \#end if
+ \#if \$bw$(n)()
+self.\$(id).set_bandwidth(\$bw$(n), $n)
+ \#end if
+\#end if
+#end for
+</make>
+ <callback>set_samp_rate(\$samp_rate)</callback>
+ #for $n in range($max_nchan)
+ <callback>set_center_freq(\$center_freq$(n), $n)</callback>
+ <callback>set_gain(\$gain$(n), $n)</callback>
+ <callback>set_antenna(\$ant$(n), $n)</callback>
+ <callback>set_bandwidth(\$bw$(n), $n)</callback>
+ #end for
+ <param>
+ <name>Input Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>type:COMPLEX_FLOAT32</opt>
+ <opt>vlen:1</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>type:COMPLEX_INT16</opt>
+ <opt>vlen:2</opt>
+ </option>
+ </param>
+ <param>
+ <name>Device Addr</name>
+ <key>dev_addr</key>
+ <value>addr=192.168.10.2</value>
+ <type>string</type>
+ <hide>
+ \#if \$dev_addr()
+ none
+ \#else
+ part
+ \#end if
+ </hide>
+ </param>
+ <param>
+ <name>Sync</name>
+ <key>sync</key>
+ <value>sync</value>
+ <type>enum</type>
+ <hide>\#if \$sync() then 'none' else 'part'#</hide>
+ <option>
+ <name>unknown PPS</name>
+ <key>sync</key>
+ </option>
+ <option>
+ <name>don't sync</name>
+ <key></key>
+ </option>
+ </param>
+ <param>
+ <name>Num Mboards</name>
+ <key>num_mboards</key>
+ <value>2</value>
+ <type>int</type>
+ #for $m in range(1, $max_mboards+1)
+ <option>
+ <name>$(m)</name>
+ <key>$m</key>
+ </option>
+ #end for
+ </param>
+ #for $m in range($max_mboards)
+ <param>
+ <name>Mb$(m): Subdev Spec</name>
+ <key>sd_spec$(m)</key>
+ <value></value>
+ <type>string</type>
+ <hide>
+ \#if not \$num_mboards() > $m
+ all
+ \#elif \$sd_spec$(m)()
+ none
+ \#else
+ part
+ \#end if
+ </hide>
+ </param>
+ #end for
+ <param>
+ <name>Num Channels</name>
+ <key>nchan</key>
+ <value>2</value>
+ <type>int</type>
+ #for $n in range(1, $max_nchan+1)
+ <option>
+ <name>$(n)</name>
+ <key>$n</key>
+ </option>
+ #end for
+ </param>
+ <param>
+ <name>Samp Rate (Sps)</name>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
+ <type>real</type>
+ </param>
+ $params
+ <check>$max_nchan >= \$nchan</check>
+ <check>\$nchan > 0</check>
+ <check>$max_mboards >= \$num_mboards</check>
+ <check>\$num_mboards > 0</check>
+ <check>\$nchan >= \$num_mboards</check>
+ <$sourk>
+ <name>$direction</name>
+ <type>\$type</type>
+ <vlen>\$type.vlen</vlen>
+ <nports>\$nchan</nports>
+ </$sourk>
+ <doc>
+The UHD Multi USRP $sourk.title() Block:
+
+Device Address:
+The device address is a delimited string used to locate UHD devices on your system. \\
+If left blank, the first UHD device found will be used. \\
+Used args to specify a specfic device.
+USRP2 Example: addr=192.168.10.2 192.168.10.3
+
+Num Motherboards:
+Selects the number of USRP motherboards in this multi-USRP configuration.
+
+Subdevice specification:
+Each motherboard should have its own subdevice specification \\
+and all subdevice specifications should be the same length. \\
+Select the subdevice or subdevices for each channel using a markup string. \\
+The markup string consists of a list of dboard_slot:subdev_name pairs (one pair per channel). \\
+If left blank, the UHD will try to select the first subdevice on your system. \\
+See the application notes for further details.
+Single channel example: :AB
+Dual channel example: :A :B
+
+Num Channels:
+Selects the total number of channels in this multi-USRP configuration.
+Ex: 4 motherboards with 2 channels per board = 8 channels total
+
+Sample rate:
+The sample rate is the number of samples per second input by this block. \\
+The UHD device driver will try its best to match the requested sample rate. \\
+If the requested rate is not possible, the UHD block will print an error at runtime.
+
+Center frequency:
+The center frequency is the overall frequency of the RF chain. \\
+For greater control of how the UHD tunes elements in the RF chain, \\
+pass a tune_request_t object rather than a simple target frequency.
+Tuning with an LO offset example: uhd.tune_request_t(freq, lo_off)
+
+Antenna:
+For subdevices with only one antenna, this may be left blank. \\
+Otherwise, the user should specify one of the possible antenna choices. \\
+See the daughterboard application notes for the possible antenna choices.
+
+Bandwidth:
+To use the default bandwidth filter setting, this should be zero. \\
+Only certain subdevices have configurable bandwidth filters. \\
+See the daughterboard application notes for possible configurations.
+ </doc>
+</block>
+"""
+
+PARAMS_TMPL = """
+ <param>
+ <name>Ch$(n): Center Freq (Hz)</name>
+ <key>center_freq$(n)</key>
+ <value>0</value>
+ <type>real</type>
+ <hide>\#if \$nchan() > $n then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Ch$(n): Gain (dB)</name>
+ <key>gain$(n)</key>
+ <value>0</value>
+ <type>real</type>
+ <hide>\#if \$nchan() > $n then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Ch$(n): Antenna</name>
+ <key>ant$(n)</key>
+ <value></value>
+ <type>string</type>
+ <hide>
+ \#if not \$nchan() > $n
+ all
+ \#elif \$ant$(n)()
+ none
+ \#else
+ part
+ \#end if
+ </hide>
+ </param>
+ <param>
+ <name>Ch$(n): Bandwidth (Hz)</name>
+ <key>bw$(n)</key>
+ <value>0</value>
+ <type>real</type>
+ <hide>
+ \#if not \$nchan() > $n
+ all
+ \#elif \$bw$(n)()
+ none
+ \#else
+ part
+ \#end if
+ </hide>
+ </param>
+"""
+
+def parse_tmpl(_tmpl, **kwargs):
+ from Cheetah import Template
+ return str(Template.Template(_tmpl, kwargs))
+
+max_num_mboards = 4
+max_num_channels = max_num_mboards*4
+
+if __name__ == '__main__':
+ import sys
+ for file in sys.argv[1:]:
+ if 'source' in file:
+ sourk = 'source'
+ direction = 'out'
+ elif 'sink' in file:
+ sourk = 'sink'
+ direction = 'in'
+ else: raise Exception, 'is %s a source or sink?'%file
+
+ params = ''.join([parse_tmpl(PARAMS_TMPL, n=n) for n in range(max_num_channels)])
+ open(file, 'w').write(parse_tmpl(MAIN_TMPL,
+ max_nchan=max_num_channels,
+ max_mboards=max_num_mboards,
+ params=params,
+ sourk=sourk,
+ direction=direction,
+ ))
diff --git a/gr-uhd/grc/gen_uhd_single_usrp_blocks_xml.py b/gr-uhd/grc/gen_uhd_single_usrp_blocks_xml.py
new file mode 100755
index 0000000000..7337c71d7b
--- /dev/null
+++ b/gr-uhd/grc/gen_uhd_single_usrp_blocks_xml.py
@@ -0,0 +1,269 @@
+#!/usr/bin/env python
+"""
+Copyright 2010 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
+"""
+
+MAIN_TMPL = """\
+<?xml version="1.0"?>
+<block>
+ <name>UHD: Single USRP $sourk.title()</name>
+ <key>uhd_single_usrp_$(sourk)</key>
+ <import>from gnuradio import uhd</import>
+ <make>uhd.single_usrp_$(sourk)(
+ device_addr=\$dev_addr,
+ io_type=uhd.io_type_t.\$type.type,
+ num_channels=\$nchan,
+)
+\#if \$ref_clk()
+_clk_cfg = uhd.clock_config_t()
+_clk_cfg.ref_source = uhd.clock_config_t.REF_SMA
+_clk_cfg.pps_source = uhd.clock_config_t.PPS_SMA
+_clk_cfg.pps_polarity = uhd.clock_config_t.PPS_POS
+self.\$(id).set_clock_config(_clk_cfg);
+\#end if
+\#if \$sd_spec()
+self.\$(id).set_subdev_spec(\$sd_spec)
+\#end if
+self.\$(id).set_samp_rate(\$samp_rate)
+#for $n in range($max_nchan)
+\#if \$nchan() > $n
+self.\$(id).set_center_freq(\$center_freq$(n), $n)
+self.\$(id).set_gain(\$gain$(n), $n)
+ \#if \$ant$(n)()
+self.\$(id).set_antenna(\$ant$(n), $n)
+ \#end if
+ \#if \$bw$(n)()
+self.\$(id).set_bandwidth(\$bw$(n), $n)
+ \#end if
+\#end if
+#end for
+</make>
+ <callback>set_samp_rate(\$samp_rate)</callback>
+ #for $n in range($max_nchan)
+ <callback>set_center_freq(\$center_freq$(n), $n)</callback>
+ <callback>set_gain(\$gain$(n), $n)</callback>
+ <callback>set_antenna(\$ant$(n), $n)</callback>
+ <callback>set_bandwidth(\$bw$(n), $n)</callback>
+ #end for
+ <param>
+ <name>Input Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>type:COMPLEX_FLOAT32</opt>
+ <opt>vlen:1</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>type:COMPLEX_INT16</opt>
+ <opt>vlen:2</opt>
+ </option>
+ </param>
+ <param>
+ <name>Num Channels</name>
+ <key>nchan</key>
+ <value>1</value>
+ <type>int</type>
+ <hide>part</hide>
+ <option>
+ <name>Single Channel</name>
+ <key>1</key>
+ </option>
+ <option>
+ <name>Dual Channel</name>
+ <key>2</key>
+ </option>
+ <option>
+ <name>Quad Channel</name>
+ <key>4</key>
+ </option>
+ </param>
+ <param>
+ <name>Device Addr</name>
+ <key>dev_addr</key>
+ <value>addr=192.168.10.2</value>
+ <type>string</type>
+ <hide>
+ \#if \$dev_addr()
+ none
+ \#else
+ part
+ \#end if
+ </hide>
+ </param>
+ <param>
+ <name>Ref Clock</name>
+ <key>ref_clk</key>
+ <value></value>
+ <type>enum</type>
+ <hide>\#if \$ref_clk() then 'none' else 'part'#</hide>
+ <option>
+ <name>External</name>
+ <key>ext</key>
+ </option>
+ <option>
+ <name>Internal</name>
+ <key></key>
+ </option>
+ </param>
+ <param>
+ <name>Subdev Spec</name>
+ <key>sd_spec</key>
+ <value></value>
+ <type>string</type>
+ <hide>
+ \#if \$sd_spec()
+ none
+ \#else
+ part
+ \#end if
+ </hide>
+ </param>
+ <param>
+ <name>Samp Rate (Sps)</name>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
+ <type>real</type>
+ </param>
+ $params
+ <check>$max_nchan >= \$nchan</check>
+ <check>\$nchan > 0</check>
+ <check>(len((\$sd_spec).split()) or 1) == \$nchan</check>
+ <$sourk>
+ <name>$direction</name>
+ <type>\$type</type>
+ <vlen>\$type.vlen</vlen>
+ <nports>\$nchan</nports>
+ </$sourk>
+ <doc>
+The UHD Single USRP $sourk.title() Block:
+
+Device Address:
+The device address is a delimited string used to locate UHD devices on your system. \\
+If left blank, the first UHD device found will be used. \\
+Used args to specify a specfic device.
+USRP2 Example: addr=192.168.10.2
+USRP1 Example: serial=12345678
+
+Subdevice specification:
+Select the subdevice or subdevices for each channel using a markup string. \\
+The markup string consists of a list of dboard_slot:subdev_name pairs (one pair per channel). \\
+If left blank, the UHD will try to select the first subdevice on your system. \\
+See the application notes for further details.
+Single channel example: A:AB
+Dual channel example: A:AB B:0
+
+Sample rate:
+The sample rate is the number of samples per second input by this block. \\
+The UHD device driver will try its best to match the requested sample rate. \\
+If the requested rate is not possible, the UHD block will print an error at runtime.
+
+Center frequency:
+The center frequency is the overall frequency of the RF chain. \\
+For greater control of how the UHD tunes elements in the RF chain, \\
+pass a tune_request_t object rather than a simple target frequency.
+Tuning with an LO offset example: uhd.tune_request_t(freq, lo_off)
+
+Antenna:
+For subdevices with only one antenna, this may be left blank. \\
+Otherwise, the user should specify one of the possible antenna choices. \\
+See the daughterboard application notes for the possible antenna choices.
+
+Bandwidth:
+To use the default bandwidth filter setting, this should be zero. \\
+Only certain subdevices have configurable bandwidth filters. \\
+See the daughterboard application notes for possible configurations.
+ </doc>
+</block>
+"""
+
+PARAMS_TMPL = """
+ <param>
+ <name>Ch$(n): Center Freq (Hz)</name>
+ <key>center_freq$(n)</key>
+ <value>0</value>
+ <type>real</type>
+ <hide>\#if \$nchan() > $n then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Ch$(n): Gain (dB)</name>
+ <key>gain$(n)</key>
+ <value>0</value>
+ <type>real</type>
+ <hide>\#if \$nchan() > $n then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Ch$(n): Antenna</name>
+ <key>ant$(n)</key>
+ <value></value>
+ <type>string</type>
+ <hide>
+ \#if not \$nchan() > $n
+ all
+ \#elif \$ant$(n)()
+ none
+ \#else
+ part
+ \#end if
+ </hide>
+ </param>
+ <param>
+ <name>Ch$(n): Bandwidth (Hz)</name>
+ <key>bw$(n)</key>
+ <value>0</value>
+ <type>real</type>
+ <hide>
+ \#if not \$nchan() > $n
+ all
+ \#elif \$bw$(n)()
+ none
+ \#else
+ part
+ \#end if
+ </hide>
+ </param>
+"""
+
+def parse_tmpl(_tmpl, **kwargs):
+ from Cheetah import Template
+ return str(Template.Template(_tmpl, kwargs))
+
+max_num_channels = 4
+
+if __name__ == '__main__':
+ import sys
+ for file in sys.argv[1:]:
+ if 'source' in file:
+ sourk = 'source'
+ direction = 'out'
+ elif 'sink' in file:
+ sourk = 'sink'
+ direction = 'in'
+ else: raise Exception, 'is %s a source or sink?'%file
+
+ params = ''.join([parse_tmpl(PARAMS_TMPL, n=n) for n in range(max_num_channels)])
+ open(file, 'w').write(parse_tmpl(MAIN_TMPL,
+ max_nchan=max_num_channels,
+ params=params,
+ sourk=sourk,
+ direction=direction,
+ ))
diff --git a/gr-uhd/grc/uhd_block_tree.xml b/gr-uhd/grc/uhd_block_tree.xml
new file mode 100644
index 0000000000..e8c4f069d9
--- /dev/null
+++ b/gr-uhd/grc/uhd_block_tree.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Block Tree for uhd blocks.
+###################################################
+ -->
+<cat>
+ <name></name> <!-- Blank for Root Name -->
+ <cat>
+ <name>UHD</name>
+ <block>uhd_single_usrp_source</block>
+ <block>uhd_single_usrp_sink</block>
+ <block>uhd_multi_usrp_source</block>
+ <block>uhd_multi_usrp_sink</block>
+ </cat>
+ <cat>
+ <name>UHD (DEPRECATED)</name>
+ <block>uhd_simple_source</block>
+ <block>uhd_simple_sink</block>
+ <block>uhd_mimo_source</block>
+ <block>uhd_mimo_sink</block>
+ </cat>
+</cat>
diff --git a/gr-uhd/grc/uhd_mimo_sink.xml b/gr-uhd/grc/uhd_mimo_sink.xml
new file mode 100644
index 0000000000..13865c913a
--- /dev/null
+++ b/gr-uhd/grc/uhd_mimo_sink.xml
@@ -0,0 +1,549 @@
+<?xml version="1.0"?>
+<block>
+ <name>UHD MIMO Sink (DEPRECATED)</name>
+ <key>uhd_mimo_sink</key>
+ <import>from gnuradio import uhd</import>
+ <make>uhd.mimo_sink($nchan, $args, uhd.io_type_t.$type.type)
+self.$(id).set_samp_rate_all($samp_rate)
+#if $nchan() > 0
+self.$(id).set_subdev_spec(0, $sd_spec0)
+self.$(id).set_center_freq(0, $center_freq0)
+self.$(id).set_gain(0, $gain0)
+ #if $ant0()
+self.$(id).set_antenna(0, $ant0)
+ #end if
+#end if
+#if $nchan() > 1
+self.$(id).set_subdev_spec(1, $sd_spec1)
+self.$(id).set_center_freq(1, $center_freq1)
+self.$(id).set_gain(1, $gain1)
+ #if $ant1()
+self.$(id).set_antenna(1, $ant1)
+ #end if
+#end if
+#if $nchan() > 2
+self.$(id).set_subdev_spec(2, $sd_spec2)
+self.$(id).set_center_freq(2, $center_freq2)
+self.$(id).set_gain(2, $gain2)
+ #if $ant2()
+self.$(id).set_antenna(2, $ant2)
+ #end if
+#end if
+#if $nchan() > 3
+self.$(id).set_subdev_spec(3, $sd_spec3)
+self.$(id).set_center_freq(3, $center_freq3)
+self.$(id).set_gain(3, $gain3)
+ #if $ant3()
+self.$(id).set_antenna(3, $ant3)
+ #end if
+#end if
+#if $nchan() > 4
+self.$(id).set_subdev_spec(4, $sd_spec4)
+self.$(id).set_center_freq(4, $center_freq4)
+self.$(id).set_gain(4, $gain4)
+ #if $ant4()
+self.$(id).set_antenna(4, $ant4)
+ #end if
+#end if
+#if $nchan() > 5
+self.$(id).set_subdev_spec(5, $sd_spec5)
+self.$(id).set_center_freq(5, $center_freq5)
+self.$(id).set_gain(5, $gain5)
+ #if $ant5()
+self.$(id).set_antenna(5, $ant5)
+ #end if
+#end if
+#if $nchan() > 6
+self.$(id).set_subdev_spec(6, $sd_spec6)
+self.$(id).set_center_freq(6, $center_freq6)
+self.$(id).set_gain(6, $gain6)
+ #if $ant6()
+self.$(id).set_antenna(6, $ant6)
+ #end if
+#end if
+#if $nchan() > 7
+self.$(id).set_subdev_spec(7, $sd_spec7)
+self.$(id).set_center_freq(7, $center_freq7)
+self.$(id).set_gain(7, $gain7)
+ #if $ant7()
+self.$(id).set_antenna(7, $ant7)
+ #end if
+#end if
+</make>
+ <callback>set_samp_rate($samp_rate)</callback>
+ <callback>set_center_freq(0, $center_freq0)</callback>
+ <callback>set_gain(0, $gain0)</callback>
+ <callback>set_antenna(0, $ant0)</callback>
+ <callback>set_center_freq(1, $center_freq1)</callback>
+ <callback>set_gain(1, $gain1)</callback>
+ <callback>set_antenna(1, $ant1)</callback>
+ <callback>set_center_freq(2, $center_freq2)</callback>
+ <callback>set_gain(2, $gain2)</callback>
+ <callback>set_antenna(2, $ant2)</callback>
+ <callback>set_center_freq(3, $center_freq3)</callback>
+ <callback>set_gain(3, $gain3)</callback>
+ <callback>set_antenna(3, $ant3)</callback>
+ <callback>set_center_freq(4, $center_freq4)</callback>
+ <callback>set_gain(4, $gain4)</callback>
+ <callback>set_antenna(4, $ant4)</callback>
+ <callback>set_center_freq(5, $center_freq5)</callback>
+ <callback>set_gain(5, $gain5)</callback>
+ <callback>set_antenna(5, $ant5)</callback>
+ <callback>set_center_freq(6, $center_freq6)</callback>
+ <callback>set_gain(6, $gain6)</callback>
+ <callback>set_antenna(6, $ant6)</callback>
+ <callback>set_center_freq(7, $center_freq7)</callback>
+ <callback>set_gain(7, $gain7)</callback>
+ <callback>set_antenna(7, $ant7)</callback>
+ <param>
+ <name>Input Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>type:COMPLEX_FLOAT32</opt>
+ <opt>vlen:1</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>type:COMPLEX_INT16</opt>
+ <opt>vlen:2</opt>
+ </option>
+ </param>
+ <param>
+ <name>Num Channels</name>
+ <key>nchan</key>
+ <value>2</value>
+ <type>int</type>
+ <option>
+ <name>2 Channels</name>
+ <key>2</key>
+ </option>
+ <option>
+ <name>3 Channels</name>
+ <key>3</key>
+ </option>
+ <option>
+ <name>4 Channels</name>
+ <key>4</key>
+ </option>
+ <option>
+ <name>5 Channels</name>
+ <key>5</key>
+ </option>
+ <option>
+ <name>6 Channels</name>
+ <key>6</key>
+ </option>
+ <option>
+ <name>7 Channels</name>
+ <key>7</key>
+ </option>
+ <option>
+ <name>8 Channels</name>
+ <key>8</key>
+ </option>
+ </param>
+ <param>
+ <name>Args</name>
+ <key>args</key>
+ <value>addr=192.168.10.2 192.168.20.2</value>
+ <type>string</type>
+ </param>
+ <param>
+ <name>Samp Rate (Sps)</name>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
+ <type>real</type>
+ </param>
+
+ <param>
+ <name>Ch0: Subdev Spec</name>
+ <key>sd_spec0</key>
+ <value></value>
+ <type>string</type>
+ <hide>
+ #if not $nchan() > 0
+ all
+ #elif $sd_spec0()
+ none
+ #else
+ part
+ #end if
+ </hide>
+ </param>
+ <param>
+ <name>Ch0: Center Freq (Hz)</name>
+ <key>center_freq0</key>
+ <value>0</value>
+ <type>real</type>
+ <hide>#if $nchan() > 0 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Ch0: Gain (dB)</name>
+ <key>gain0</key>
+ <value>0</value>
+ <type>real</type>
+ <hide>#if $nchan() > 0 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Ch0: Antenna</name>
+ <key>ant0</key>
+ <value></value>
+ <type>string</type>
+ <hide>
+ #if not $nchan() > 0
+ all
+ #elif $ant0()
+ none
+ #else
+ part
+ #end if
+ </hide>
+ </param>
+
+ <param>
+ <name>Ch1: Subdev Spec</name>
+ <key>sd_spec1</key>
+ <value></value>
+ <type>string</type>
+ <hide>
+ #if not $nchan() > 1
+ all
+ #elif $sd_spec1()
+ none
+ #else
+ part
+ #end if
+ </hide>
+ </param>
+ <param>
+ <name>Ch1: Center Freq (Hz)</name>
+ <key>center_freq1</key>
+ <value>0</value>
+ <type>real</type>
+ <hide>#if $nchan() > 1 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Ch1: Gain (dB)</name>
+ <key>gain1</key>
+ <value>0</value>
+ <type>real</type>
+ <hide>#if $nchan() > 1 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Ch1: Antenna</name>
+ <key>ant1</key>
+ <value></value>
+ <type>string</type>
+ <hide>
+ #if not $nchan() > 1
+ all
+ #elif $ant1()
+ none
+ #else
+ part
+ #end if
+ </hide>
+ </param>
+
+ <param>
+ <name>Ch2: Subdev Spec</name>
+ <key>sd_spec2</key>
+ <value></value>
+ <type>string</type>
+ <hide>
+ #if not $nchan() > 2
+ all
+ #elif $sd_spec2()
+ none
+ #else
+ part
+ #end if
+ </hide>
+ </param>
+ <param>
+ <name>Ch2: Center Freq (Hz)</name>
+ <key>center_freq2</key>
+ <value>0</value>
+ <type>real</type>
+ <hide>#if $nchan() > 2 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Ch2: Gain (dB)</name>
+ <key>gain2</key>
+ <value>0</value>
+ <type>real</type>
+ <hide>#if $nchan() > 2 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Ch2: Antenna</name>
+ <key>ant2</key>
+ <value></value>
+ <type>string</type>
+ <hide>
+ #if not $nchan() > 2
+ all
+ #elif $ant2()
+ none
+ #else
+ part
+ #end if
+ </hide>
+ </param>
+
+ <param>
+ <name>Ch3: Subdev Spec</name>
+ <key>sd_spec3</key>
+ <value></value>
+ <type>string</type>
+ <hide>
+ #if not $nchan() > 3
+ all
+ #elif $sd_spec3()
+ none
+ #else
+ part
+ #end if
+ </hide>
+ </param>
+ <param>
+ <name>Ch3: Center Freq (Hz)</name>
+ <key>center_freq3</key>
+ <value>0</value>
+ <type>real</type>
+ <hide>#if $nchan() > 3 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Ch3: Gain (dB)</name>
+ <key>gain3</key>
+ <value>0</value>
+ <type>real</type>
+ <hide>#if $nchan() > 3 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Ch3: Antenna</name>
+ <key>ant3</key>
+ <value></value>
+ <type>string</type>
+ <hide>
+ #if not $nchan() > 3
+ all
+ #elif $ant3()
+ none
+ #else
+ part
+ #end if
+ </hide>
+ </param>
+
+ <param>
+ <name>Ch4: Subdev Spec</name>
+ <key>sd_spec4</key>
+ <value></value>
+ <type>string</type>
+ <hide>
+ #if not $nchan() > 4
+ all
+ #elif $sd_spec4()
+ none
+ #else
+ part
+ #end if
+ </hide>
+ </param>
+ <param>
+ <name>Ch4: Center Freq (Hz)</name>
+ <key>center_freq4</key>
+ <value>0</value>
+ <type>real</type>
+ <hide>#if $nchan() > 4 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Ch4: Gain (dB)</name>
+ <key>gain4</key>
+ <value>0</value>
+ <type>real</type>
+ <hide>#if $nchan() > 4 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Ch4: Antenna</name>
+ <key>ant4</key>
+ <value></value>
+ <type>string</type>
+ <hide>
+ #if not $nchan() > 4
+ all
+ #elif $ant4()
+ none
+ #else
+ part
+ #end if
+ </hide>
+ </param>
+
+ <param>
+ <name>Ch5: Subdev Spec</name>
+ <key>sd_spec5</key>
+ <value></value>
+ <type>string</type>
+ <hide>
+ #if not $nchan() > 5
+ all
+ #elif $sd_spec5()
+ none
+ #else
+ part
+ #end if
+ </hide>
+ </param>
+ <param>
+ <name>Ch5: Center Freq (Hz)</name>
+ <key>center_freq5</key>
+ <value>0</value>
+ <type>real</type>
+ <hide>#if $nchan() > 5 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Ch5: Gain (dB)</name>
+ <key>gain5</key>
+ <value>0</value>
+ <type>real</type>
+ <hide>#if $nchan() > 5 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Ch5: Antenna</name>
+ <key>ant5</key>
+ <value></value>
+ <type>string</type>
+ <hide>
+ #if not $nchan() > 5
+ all
+ #elif $ant5()
+ none
+ #else
+ part
+ #end if
+ </hide>
+ </param>
+
+ <param>
+ <name>Ch6: Subdev Spec</name>
+ <key>sd_spec6</key>
+ <value></value>
+ <type>string</type>
+ <hide>
+ #if not $nchan() > 6
+ all
+ #elif $sd_spec6()
+ none
+ #else
+ part
+ #end if
+ </hide>
+ </param>
+ <param>
+ <name>Ch6: Center Freq (Hz)</name>
+ <key>center_freq6</key>
+ <value>0</value>
+ <type>real</type>
+ <hide>#if $nchan() > 6 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Ch6: Gain (dB)</name>
+ <key>gain6</key>
+ <value>0</value>
+ <type>real</type>
+ <hide>#if $nchan() > 6 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Ch6: Antenna</name>
+ <key>ant6</key>
+ <value></value>
+ <type>string</type>
+ <hide>
+ #if not $nchan() > 6
+ all
+ #elif $ant6()
+ none
+ #else
+ part
+ #end if
+ </hide>
+ </param>
+
+ <param>
+ <name>Ch7: Subdev Spec</name>
+ <key>sd_spec7</key>
+ <value></value>
+ <type>string</type>
+ <hide>
+ #if not $nchan() > 7
+ all
+ #elif $sd_spec7()
+ none
+ #else
+ part
+ #end if
+ </hide>
+ </param>
+ <param>
+ <name>Ch7: Center Freq (Hz)</name>
+ <key>center_freq7</key>
+ <value>0</value>
+ <type>real</type>
+ <hide>#if $nchan() > 7 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Ch7: Gain (dB)</name>
+ <key>gain7</key>
+ <value>0</value>
+ <type>real</type>
+ <hide>#if $nchan() > 7 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Ch7: Antenna</name>
+ <key>ant7</key>
+ <value></value>
+ <type>string</type>
+ <hide>
+ #if not $nchan() > 7
+ all
+ #elif $ant7()
+ none
+ #else
+ part
+ #end if
+ </hide>
+ </param>
+
+ <check>8 >= $nchan</check>
+ <check>$nchan >= 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$type.vlen</vlen>
+ <nports>$nchan</nports>
+ </sink>
+ <doc>
+The UHD Sink Block:
+
+Args:
+Args is a delimited string used to locate UHD devices on your system. \
+If left blank, the first UHD device found will be used. \
+Used args to specify a specfic device. \
+USRP2 Example: addr=192.168.10.2
+
+Sample rate:
+The sample rate is the number of samples per second input by this block. \
+The UHD device driver will try its best to match the requested sample rate. \
+If the requested rate is not possible, the UHD block will print an error at runtime.
+
+Antenna:
+For subdevices/daughterboards with only one antenna, this may be left blank. \
+Otherwise, the user should specify one of the possible antenna choices. \
+See the daughterboard application notes for the possible antenna choices.
+ </doc>
+</block>
diff --git a/gr-uhd/grc/uhd_mimo_source.xml b/gr-uhd/grc/uhd_mimo_source.xml
new file mode 100644
index 0000000000..6167838b0b
--- /dev/null
+++ b/gr-uhd/grc/uhd_mimo_source.xml
@@ -0,0 +1,549 @@
+<?xml version="1.0"?>
+<block>
+ <name>UHD MIMO Source (DEPRECATED)</name>
+ <key>uhd_mimo_source</key>
+ <import>from gnuradio import uhd</import>
+ <make>uhd.mimo_source($nchan, $args, uhd.io_type_t.$type.type)
+self.$(id).set_samp_rate_all($samp_rate)
+#if $nchan() > 0
+self.$(id).set_subdev_spec(0, $sd_spec0)
+self.$(id).set_center_freq(0, $center_freq0)
+self.$(id).set_gain(0, $gain0)
+ #if $ant0()
+self.$(id).set_antenna(0, $ant0)
+ #end if
+#end if
+#if $nchan() > 1
+self.$(id).set_subdev_spec(1, $sd_spec1)
+self.$(id).set_center_freq(1, $center_freq1)
+self.$(id).set_gain(1, $gain1)
+ #if $ant1()
+self.$(id).set_antenna(1, $ant1)
+ #end if
+#end if
+#if $nchan() > 2
+self.$(id).set_subdev_spec(2, $sd_spec2)
+self.$(id).set_center_freq(2, $center_freq2)
+self.$(id).set_gain(2, $gain2)
+ #if $ant2()
+self.$(id).set_antenna(2, $ant2)
+ #end if
+#end if
+#if $nchan() > 3
+self.$(id).set_subdev_spec(3, $sd_spec3)
+self.$(id).set_center_freq(3, $center_freq3)
+self.$(id).set_gain(3, $gain3)
+ #if $ant3()
+self.$(id).set_antenna(3, $ant3)
+ #end if
+#end if
+#if $nchan() > 4
+self.$(id).set_subdev_spec(4, $sd_spec4)
+self.$(id).set_center_freq(4, $center_freq4)
+self.$(id).set_gain(4, $gain4)
+ #if $ant4()
+self.$(id).set_antenna(4, $ant4)
+ #end if
+#end if
+#if $nchan() > 5
+self.$(id).set_subdev_spec(5, $sd_spec5)
+self.$(id).set_center_freq(5, $center_freq5)
+self.$(id).set_gain(5, $gain5)
+ #if $ant5()
+self.$(id).set_antenna(5, $ant5)
+ #end if
+#end if
+#if $nchan() > 6
+self.$(id).set_subdev_spec(6, $sd_spec6)
+self.$(id).set_center_freq(6, $center_freq6)
+self.$(id).set_gain(6, $gain6)
+ #if $ant6()
+self.$(id).set_antenna(6, $ant6)
+ #end if
+#end if
+#if $nchan() > 7
+self.$(id).set_subdev_spec(7, $sd_spec7)
+self.$(id).set_center_freq(7, $center_freq7)
+self.$(id).set_gain(7, $gain7)
+ #if $ant7()
+self.$(id).set_antenna(7, $ant7)
+ #end if
+#end if
+</make>
+ <callback>set_samp_rate($samp_rate)</callback>
+ <callback>set_center_freq(0, $center_freq0)</callback>
+ <callback>set_gain(0, $gain0)</callback>
+ <callback>set_antenna(0, $ant0)</callback>
+ <callback>set_center_freq(1, $center_freq1)</callback>
+ <callback>set_gain(1, $gain1)</callback>
+ <callback>set_antenna(1, $ant1)</callback>
+ <callback>set_center_freq(2, $center_freq2)</callback>
+ <callback>set_gain(2, $gain2)</callback>
+ <callback>set_antenna(2, $ant2)</callback>
+ <callback>set_center_freq(3, $center_freq3)</callback>
+ <callback>set_gain(3, $gain3)</callback>
+ <callback>set_antenna(3, $ant3)</callback>
+ <callback>set_center_freq(4, $center_freq4)</callback>
+ <callback>set_gain(4, $gain4)</callback>
+ <callback>set_antenna(4, $ant4)</callback>
+ <callback>set_center_freq(5, $center_freq5)</callback>
+ <callback>set_gain(5, $gain5)</callback>
+ <callback>set_antenna(5, $ant5)</callback>
+ <callback>set_center_freq(6, $center_freq6)</callback>
+ <callback>set_gain(6, $gain6)</callback>
+ <callback>set_antenna(6, $ant6)</callback>
+ <callback>set_center_freq(7, $center_freq7)</callback>
+ <callback>set_gain(7, $gain7)</callback>
+ <callback>set_antenna(7, $ant7)</callback>
+ <param>
+ <name>Input Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>type:COMPLEX_FLOAT32</opt>
+ <opt>vlen:1</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>type:COMPLEX_INT16</opt>
+ <opt>vlen:2</opt>
+ </option>
+ </param>
+ <param>
+ <name>Num Channels</name>
+ <key>nchan</key>
+ <value>2</value>
+ <type>int</type>
+ <option>
+ <name>2 Channels</name>
+ <key>2</key>
+ </option>
+ <option>
+ <name>3 Channels</name>
+ <key>3</key>
+ </option>
+ <option>
+ <name>4 Channels</name>
+ <key>4</key>
+ </option>
+ <option>
+ <name>5 Channels</name>
+ <key>5</key>
+ </option>
+ <option>
+ <name>6 Channels</name>
+ <key>6</key>
+ </option>
+ <option>
+ <name>7 Channels</name>
+ <key>7</key>
+ </option>
+ <option>
+ <name>8 Channels</name>
+ <key>8</key>
+ </option>
+ </param>
+ <param>
+ <name>Args</name>
+ <key>args</key>
+ <value>addr=192.168.10.2 192.168.20.2</value>
+ <type>string</type>
+ </param>
+ <param>
+ <name>Samp Rate (Sps)</name>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
+ <type>real</type>
+ </param>
+
+ <param>
+ <name>Ch0: Subdev Spec</name>
+ <key>sd_spec0</key>
+ <value></value>
+ <type>string</type>
+ <hide>
+ #if not $nchan() > 0
+ all
+ #elif $sd_spec0()
+ none
+ #else
+ part
+ #end if
+ </hide>
+ </param>
+ <param>
+ <name>Ch0: Center Freq (Hz)</name>
+ <key>center_freq0</key>
+ <value>0</value>
+ <type>real</type>
+ <hide>#if $nchan() > 0 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Ch0: Gain (dB)</name>
+ <key>gain0</key>
+ <value>0</value>
+ <type>real</type>
+ <hide>#if $nchan() > 0 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Ch0: Antenna</name>
+ <key>ant0</key>
+ <value></value>
+ <type>string</type>
+ <hide>
+ #if not $nchan() > 0
+ all
+ #elif $ant0()
+ none
+ #else
+ part
+ #end if
+ </hide>
+ </param>
+
+ <param>
+ <name>Ch1: Subdev Spec</name>
+ <key>sd_spec1</key>
+ <value></value>
+ <type>string</type>
+ <hide>
+ #if not $nchan() > 1
+ all
+ #elif $sd_spec1()
+ none
+ #else
+ part
+ #end if
+ </hide>
+ </param>
+ <param>
+ <name>Ch1: Center Freq (Hz)</name>
+ <key>center_freq1</key>
+ <value>0</value>
+ <type>real</type>
+ <hide>#if $nchan() > 1 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Ch1: Gain (dB)</name>
+ <key>gain1</key>
+ <value>0</value>
+ <type>real</type>
+ <hide>#if $nchan() > 1 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Ch1: Antenna</name>
+ <key>ant1</key>
+ <value></value>
+ <type>string</type>
+ <hide>
+ #if not $nchan() > 1
+ all
+ #elif $ant1()
+ none
+ #else
+ part
+ #end if
+ </hide>
+ </param>
+
+ <param>
+ <name>Ch2: Subdev Spec</name>
+ <key>sd_spec2</key>
+ <value></value>
+ <type>string</type>
+ <hide>
+ #if not $nchan() > 2
+ all
+ #elif $sd_spec2()
+ none
+ #else
+ part
+ #end if
+ </hide>
+ </param>
+ <param>
+ <name>Ch2: Center Freq (Hz)</name>
+ <key>center_freq2</key>
+ <value>0</value>
+ <type>real</type>
+ <hide>#if $nchan() > 2 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Ch2: Gain (dB)</name>
+ <key>gain2</key>
+ <value>0</value>
+ <type>real</type>
+ <hide>#if $nchan() > 2 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Ch2: Antenna</name>
+ <key>ant2</key>
+ <value></value>
+ <type>string</type>
+ <hide>
+ #if not $nchan() > 2
+ all
+ #elif $ant2()
+ none
+ #else
+ part
+ #end if
+ </hide>
+ </param>
+
+ <param>
+ <name>Ch3: Subdev Spec</name>
+ <key>sd_spec3</key>
+ <value></value>
+ <type>string</type>
+ <hide>
+ #if not $nchan() > 3
+ all
+ #elif $sd_spec3()
+ none
+ #else
+ part
+ #end if
+ </hide>
+ </param>
+ <param>
+ <name>Ch3: Center Freq (Hz)</name>
+ <key>center_freq3</key>
+ <value>0</value>
+ <type>real</type>
+ <hide>#if $nchan() > 3 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Ch3: Gain (dB)</name>
+ <key>gain3</key>
+ <value>0</value>
+ <type>real</type>
+ <hide>#if $nchan() > 3 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Ch3: Antenna</name>
+ <key>ant3</key>
+ <value></value>
+ <type>string</type>
+ <hide>
+ #if not $nchan() > 3
+ all
+ #elif $ant3()
+ none
+ #else
+ part
+ #end if
+ </hide>
+ </param>
+
+ <param>
+ <name>Ch4: Subdev Spec</name>
+ <key>sd_spec4</key>
+ <value></value>
+ <type>string</type>
+ <hide>
+ #if not $nchan() > 4
+ all
+ #elif $sd_spec4()
+ none
+ #else
+ part
+ #end if
+ </hide>
+ </param>
+ <param>
+ <name>Ch4: Center Freq (Hz)</name>
+ <key>center_freq4</key>
+ <value>0</value>
+ <type>real</type>
+ <hide>#if $nchan() > 4 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Ch4: Gain (dB)</name>
+ <key>gain4</key>
+ <value>0</value>
+ <type>real</type>
+ <hide>#if $nchan() > 4 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Ch4: Antenna</name>
+ <key>ant4</key>
+ <value></value>
+ <type>string</type>
+ <hide>
+ #if not $nchan() > 4
+ all
+ #elif $ant4()
+ none
+ #else
+ part
+ #end if
+ </hide>
+ </param>
+
+ <param>
+ <name>Ch5: Subdev Spec</name>
+ <key>sd_spec5</key>
+ <value></value>
+ <type>string</type>
+ <hide>
+ #if not $nchan() > 5
+ all
+ #elif $sd_spec5()
+ none
+ #else
+ part
+ #end if
+ </hide>
+ </param>
+ <param>
+ <name>Ch5: Center Freq (Hz)</name>
+ <key>center_freq5</key>
+ <value>0</value>
+ <type>real</type>
+ <hide>#if $nchan() > 5 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Ch5: Gain (dB)</name>
+ <key>gain5</key>
+ <value>0</value>
+ <type>real</type>
+ <hide>#if $nchan() > 5 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Ch5: Antenna</name>
+ <key>ant5</key>
+ <value></value>
+ <type>string</type>
+ <hide>
+ #if not $nchan() > 5
+ all
+ #elif $ant5()
+ none
+ #else
+ part
+ #end if
+ </hide>
+ </param>
+
+ <param>
+ <name>Ch6: Subdev Spec</name>
+ <key>sd_spec6</key>
+ <value></value>
+ <type>string</type>
+ <hide>
+ #if not $nchan() > 6
+ all
+ #elif $sd_spec6()
+ none
+ #else
+ part
+ #end if
+ </hide>
+ </param>
+ <param>
+ <name>Ch6: Center Freq (Hz)</name>
+ <key>center_freq6</key>
+ <value>0</value>
+ <type>real</type>
+ <hide>#if $nchan() > 6 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Ch6: Gain (dB)</name>
+ <key>gain6</key>
+ <value>0</value>
+ <type>real</type>
+ <hide>#if $nchan() > 6 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Ch6: Antenna</name>
+ <key>ant6</key>
+ <value></value>
+ <type>string</type>
+ <hide>
+ #if not $nchan() > 6
+ all
+ #elif $ant6()
+ none
+ #else
+ part
+ #end if
+ </hide>
+ </param>
+
+ <param>
+ <name>Ch7: Subdev Spec</name>
+ <key>sd_spec7</key>
+ <value></value>
+ <type>string</type>
+ <hide>
+ #if not $nchan() > 7
+ all
+ #elif $sd_spec7()
+ none
+ #else
+ part
+ #end if
+ </hide>
+ </param>
+ <param>
+ <name>Ch7: Center Freq (Hz)</name>
+ <key>center_freq7</key>
+ <value>0</value>
+ <type>real</type>
+ <hide>#if $nchan() > 7 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Ch7: Gain (dB)</name>
+ <key>gain7</key>
+ <value>0</value>
+ <type>real</type>
+ <hide>#if $nchan() > 7 then 'none' else 'all'#</hide>
+ </param>
+ <param>
+ <name>Ch7: Antenna</name>
+ <key>ant7</key>
+ <value></value>
+ <type>string</type>
+ <hide>
+ #if not $nchan() > 7
+ all
+ #elif $ant7()
+ none
+ #else
+ part
+ #end if
+ </hide>
+ </param>
+
+ <check>8 >= $nchan</check>
+ <check>$nchan >= 0</check>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$type.vlen</vlen>
+ <nports>$nchan</nports>
+ </source>
+ <doc>
+The UHD Source Block:
+
+Args:
+Args is a delimited string used to locate UHD devices on your system. \
+If left blank, the first UHD device found will be used. \
+Used args to specify a specfic device. \
+USRP2 Example: addr=192.168.10.2
+
+Sample rate:
+The sample rate is the number of samples per second input by this block. \
+The UHD device driver will try its best to match the requested sample rate. \
+If the requested rate is not possible, the UHD block will print an error at runtime.
+
+Antenna:
+For subdevices/daughterboards with only one antenna, this may be left blank. \
+Otherwise, the user should specify one of the possible antenna choices. \
+See the daughterboard application notes for the possible antenna choices.
+ </doc>
+</block>
diff --git a/gr-uhd/grc/uhd_simple_sink.xml b/gr-uhd/grc/uhd_simple_sink.xml
new file mode 100644
index 0000000000..ee6051432a
--- /dev/null
+++ b/gr-uhd/grc/uhd_simple_sink.xml
@@ -0,0 +1,101 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+## UHD Simple Sink
+###################################################
+ -->
+<block>
+ <name>UHD Simple Sink (DEPRECATED)</name>
+ <key>uhd_simple_sink</key>
+ <import>from gnuradio import uhd</import>
+ <make>uhd.simple_sink($args, uhd.io_type_t.$type.type)
+self.$(id).set_subdev_spec($sd_spec)
+self.$(id).set_samp_rate($samp_rate)
+self.$(id).set_center_freq($center_freq)
+self.$(id).set_gain($gain)
+#if $ant()
+self.$(id).set_antenna($ant)
+#end if</make>
+ <callback>set_samp_rate($samp_rate)</callback>
+ <callback>set_center_freq($center_freq)</callback>
+ <callback>set_gain($gain)</callback>
+ <callback>set_antenna($ant)</callback>
+ <param>
+ <name>Input Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>type:COMPLEX_FLOAT32</opt>
+ <opt>vlen:1</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>type:COMPLEX_INT16</opt>
+ <opt>vlen:2</opt>
+ </option>
+ </param>
+ <param>
+ <name>Args</name>
+ <key>args</key>
+ <value></value>
+ <type>string</type>
+ </param>
+ <param>
+ <name>Subdev Spec</name>
+ <key>sd_spec</key>
+ <value></value>
+ <type>string</type>
+ <hide>#if $sd_spec() then 'none' else 'part'#</hide>
+ </param>
+ <param>
+ <name>Samp Rate (Sps)</name>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Center Freq (Hz)</name>
+ <key>center_freq</key>
+ <value>0</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Gain (dB)</name>
+ <key>gain</key>
+ <value>0</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Antenna</name>
+ <key>ant</key>
+ <type>string</type>
+ <hide>#if $ant() == '' then 'part' else 'none'#</hide>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$type.vlen</vlen>
+ </sink>
+ <doc>
+The UHD Sink Block:
+
+Args:
+Args is a delimited string used to locate UHD devices on your system. \
+If left blank, the first UHD device found will be used. \
+Used args to specify a specfic device. \
+USRP2 Example: addr=192.168.10.2
+
+Sample rate:
+The sample rate is the number of samples per second input by this block. \
+The UHD device driver will try its best to match the requested sample rate. \
+If the requested rate is not possible, the UHD block will print an error at runtime.
+
+Antenna:
+For subdevices/daughterboards with only one antenna, this may be left blank. \
+Otherwise, the user should specify one of the possible antenna choices. \
+See the daughterboard application notes for the possible antenna choices.
+ </doc>
+</block>
diff --git a/gr-uhd/grc/uhd_simple_source.xml b/gr-uhd/grc/uhd_simple_source.xml
new file mode 100644
index 0000000000..825981d66f
--- /dev/null
+++ b/gr-uhd/grc/uhd_simple_source.xml
@@ -0,0 +1,101 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+## UHD Simple Source
+###################################################
+ -->
+<block>
+ <name>UHD Simple Source (DEPRECATED)</name>
+ <key>uhd_simple_source</key>
+ <import>from gnuradio import uhd</import>
+ <make>uhd.simple_source($args, uhd.io_type_t.$type.type)
+self.$(id).set_subdev_spec($sd_spec)
+self.$(id).set_samp_rate($samp_rate)
+self.$(id).set_center_freq($center_freq)
+self.$(id).set_gain($gain)
+#if $ant()
+self.$(id).set_antenna($ant)
+#end if</make>
+ <callback>set_samp_rate($samp_rate)</callback>
+ <callback>set_center_freq($center_freq)</callback>
+ <callback>set_gain($gain)</callback>
+ <callback>set_antenna($ant)</callback>
+ <param>
+ <name>Output Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>type:COMPLEX_FLOAT32</opt>
+ <opt>vlen:1</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>type:COMPLEX_INT16</opt>
+ <opt>vlen:2</opt>
+ </option>
+ </param>
+ <param>
+ <name>Args</name>
+ <key>args</key>
+ <value></value>
+ <type>string</type>
+ </param>
+ <param>
+ <name>Subdev Spec</name>
+ <key>sd_spec</key>
+ <value></value>
+ <type>string</type>
+ <hide>#if $sd_spec() then 'none' else 'part'#</hide>
+ </param>
+ <param>
+ <name>Samp Rate (Sps)</name>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Center Freq (Hz)</name>
+ <key>center_freq</key>
+ <value>0</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Gain (dB)</name>
+ <key>gain</key>
+ <value>0</value>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Antenna</name>
+ <key>ant</key>
+ <type>string</type>
+ <hide>#if $ant() == '' then 'part' else 'none'#</hide>
+ </param>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$type.vlen</vlen>
+ </source>
+ <doc>
+The UHD Source Block:
+
+Args:
+Args is a delimited string used to locate UHD devices on your system. \
+If left blank, the first UHD device found will be used. \
+Used args to specify a specfic device. \
+USRP2 Example: addr=192.168.10.2
+
+Sample rate:
+The sample rate is the number of samples per second output by this block. \
+The UHD device driver will try its best to match the requested sample rate. \
+If the requested rate is not possible, the UHD block will print an error at runtime.
+
+Antenna:
+For subdevices/daughterboards with only one antenna, this may be left blank. \
+Otherwise, the user should specify one of the possible antenna choices. \
+See the daughterboard application notes for the possible antenna choices.
+ </doc>
+</block>
diff --git a/gr-uhd/lib/.gitignore b/gr-uhd/lib/.gitignore
new file mode 100644
index 0000000000..b336cc7cec
--- /dev/null
+++ b/gr-uhd/lib/.gitignore
@@ -0,0 +1,2 @@
+/Makefile
+/Makefile.in
diff --git a/gr-uhd/lib/Makefile.am b/gr-uhd/lib/Makefile.am
new file mode 100644
index 0000000000..b4b1abfc67
--- /dev/null
+++ b/gr-uhd/lib/Makefile.am
@@ -0,0 +1,56 @@
+#
+# 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 GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+include $(top_srcdir)/Makefile.common
+
+AM_CPPFLAGS = \
+ $(STD_DEFINES_AND_INCLUDES) \
+ $(WITH_INCLUDES) \
+ $(UHD_CFLAGS)
+
+lib_LTLIBRARIES = libgnuradio-uhd.la
+
+libgnuradio_uhd_la_SOURCES = \
+ uhd_multi_usrp_source.cc \
+ uhd_multi_usrp_sink.cc \
+ uhd_single_usrp_source.cc \
+ uhd_single_usrp_sink.cc
+
+# add the deprecated sources
+libgnuradio_uhd_la_SOURCES += \
+ uhd_mimo_source.cc \
+ uhd_mimo_sink.cc \
+ uhd_simple_source.cc \
+ uhd_simple_sink.cc
+
+libgnuradio_uhd_la_LIBADD = \
+ $(GNURADIO_CORE_LA) \
+ $(UHD_LIBS)
+
+libgnuradio_uhd_la_LDFLAGS = $(LTVERSIONFLAGS)
+
+grinclude_HEADERS = \
+ uhd_multi_usrp_source.h \
+ uhd_multi_usrp_sink.h \
+ uhd_single_usrp_source.h \
+ uhd_single_usrp_sink.h
+
+noinst_HEADERS =
diff --git a/gr-uhd/lib/uhd_mimo_sink.cc b/gr-uhd/lib/uhd_mimo_sink.cc
new file mode 100644
index 0000000000..03d310b1ea
--- /dev/null
+++ b/gr-uhd/lib/uhd_mimo_sink.cc
@@ -0,0 +1,161 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2010 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along 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 <uhd_mimo_sink.h>
+#include <gr_io_signature.h>
+#include <stdexcept>
+//#include "utils.h"
+
+/***********************************************************************
+ * UHD Sink
+ **********************************************************************/
+uhd_mimo_sink::uhd_mimo_sink(gr_io_signature_sptr sig)
+:gr_sync_block("uhd mimo sink", sig, gr_make_io_signature(0, 0, 0)){
+ /* NOP */
+}
+
+/***********************************************************************
+ * UHD Sink Impl
+ **********************************************************************/
+class uhd_mimo_sink_impl : public uhd_mimo_sink{
+public:
+ uhd_mimo_sink_impl(
+ size_t num_channels,
+ const std::string &args,
+ const uhd::io_type_t &type
+ ) : uhd_mimo_sink(gr_make_io_signature(num_channels, num_channels, type.size)), _type(type)
+ {
+ _first_run = false;
+ _dev = uhd::usrp::mimo_usrp::make(args);
+ _dev->set_time_unknown_pps(uhd::time_spec_t()); //TODO may want option to disable this
+ }
+
+ ~uhd_mimo_sink_impl(void){
+ //NOP
+ }
+
+ void set_subdev_spec(size_t chan, const std::string &spec){
+ return _dev->set_tx_subdev_spec(chan, spec);
+ }
+
+ void set_samp_rate_all(double rate){
+ _dev->set_tx_rate_all(rate);
+ //do_samp_rate_error_message(rate, get_samp_rate_all(), "TX");
+ }
+
+ double get_samp_rate_all(void){
+ return _dev->get_tx_rate_all();
+ }
+
+ uhd::tune_result_t set_center_freq(size_t chan, double freq){
+ uhd::tune_result_t tr = _dev->set_tx_freq(chan, freq);
+ //do_tune_freq_error_message(freq, _dev->get_tx_freq(chan), "TX");
+ return tr;
+ }
+
+ uhd::freq_range_t get_freq_range(size_t chan){
+ return _dev->get_tx_freq_range(chan);
+ }
+
+ void set_gain(size_t chan, float gain){
+ return _dev->set_tx_gain(chan, gain);
+ }
+
+ float get_gain(size_t chan){
+ return _dev->get_tx_gain(chan);
+ }
+
+ uhd::gain_range_t get_gain_range(size_t chan){
+ return _dev->get_tx_gain_range(chan);
+ }
+
+ void set_antenna(size_t chan, const std::string &ant){
+ return _dev->set_tx_antenna(chan, ant);
+ }
+
+ std::string get_antenna(size_t chan){
+ return _dev->get_tx_antenna(chan);
+ }
+
+ std::vector<std::string> get_antennas(size_t chan){
+ return _dev->get_tx_antennas(chan);
+ }
+
+ uhd::time_spec_t get_time_now(void){
+ return _dev->get_time_now();
+ }
+
+ void set_time_next_pps(const uhd::time_spec_t &time_spec){
+ return _dev->set_time_next_pps(time_spec);
+ }
+
+ uhd::usrp::mimo_usrp::sptr get_device(void){
+ return _dev;
+ }
+
+/***********************************************************************
+ * Work
+ **********************************************************************/
+ int work(
+ int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items
+ ){
+ //init the metadata on the first call to work
+ //and set the timespec with the current time + some offset
+ if (not _first_run){
+ _first_run = true;
+ _metadata.start_of_burst = true;
+ _metadata.has_time_spec = true;
+ _metadata.time_spec = get_time_now() + uhd::time_spec_t(0, 0.01); //10ms offset in future
+ }
+
+ //call to send with metadata slightly in the future (send-at)
+ size_t num_sent = _dev->get_device()->send(
+ input_items, noutput_items, _metadata,
+ _type, uhd::device::SEND_MODE_FULL_BUFF
+ );
+
+ //increment the send-at time by the number of samples sent
+ _metadata.time_spec += uhd::time_spec_t(0, num_sent, get_samp_rate_all());
+ return num_sent;
+ }
+
+protected:
+ uhd::usrp::mimo_usrp::sptr _dev;
+ const uhd::io_type_t _type;
+ uhd::tx_metadata_t _metadata;
+ bool _first_run;
+};
+
+/***********************************************************************
+ * Make UHD Sink
+ **********************************************************************/
+boost::shared_ptr<uhd_mimo_sink> uhd_make_mimo_sink(
+ size_t num_channels,
+ const std::string &args,
+ const uhd::io_type_t::tid_t &type
+){
+ return boost::shared_ptr<uhd_mimo_sink>(
+ new uhd_mimo_sink_impl(num_channels, args, type)
+ );
+}
diff --git a/gr-uhd/lib/uhd_mimo_sink.h b/gr-uhd/lib/uhd_mimo_sink.h
new file mode 100644
index 0000000000..28a530b603
--- /dev/null
+++ b/gr-uhd/lib/uhd_mimo_sink.h
@@ -0,0 +1,145 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2010 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along 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_UHD_MIMO_SINK_H
+#define INCLUDED_UHD_MIMO_SINK_H
+
+#include <gr_sync_block.h>
+#include <uhd/usrp/mimo_usrp.hpp>
+
+class uhd_mimo_sink;
+
+boost::shared_ptr<uhd_mimo_sink> uhd_make_mimo_sink(
+ size_t num_channels,
+ const std::string &args,
+ const uhd::io_type_t::tid_t &type
+);
+
+/***********************************************************************
+ * DEPRECATED
+ **********************************************************************/
+class UHD_DEPRECATED uhd_mimo_sink : public gr_sync_block{
+public:
+
+ /*!
+ * Set the IO signature for this block.
+ * \param sig the input signature
+ */
+ uhd_mimo_sink(gr_io_signature_sptr sig);
+
+ /*!
+ * Set the subdevice specification.
+ * \param chan the channel number from 0 to N-1
+ * \param spec the subdev spec markup string
+ */
+ virtual void set_subdev_spec(size_t chan, const std::string &spec) = 0;
+
+ /*!
+ * Set the sample rate for the usrp device (across all mboards).
+ * \param rate a new rate in Sps
+ */
+ virtual void set_samp_rate_all(double rate) = 0;
+
+ /*!
+ * Get the sample rate for the usrp device (across all mboards).
+ * This is the actual sample rate and may differ from the rate set.
+ * \return the actual rate in Sps
+ */
+ virtual double get_samp_rate_all(void) = 0;
+
+ /*!
+ * Tune the usrp device to the desired center frequency.
+ * \param chan the channel number from 0 to N-1
+ * \param freq the desired frequency in Hz
+ * \return a tune result with the actual frequencies
+ */
+ virtual uhd::tune_result_t set_center_freq(size_t chan, double freq) = 0;
+
+ /*!
+ * Get the tunable frequency range.
+ * \param chan the channel number from 0 to N-1
+ * \return the frequency range in Hz
+ */
+ virtual uhd::freq_range_t get_freq_range(size_t chan) = 0;
+
+ /*!
+ * Set the gain for the dboard.
+ * \param chan the channel number from 0 to N-1
+ * \param gain the gain in dB
+ */
+ virtual void set_gain(size_t chan, float gain) = 0;
+
+ /*!
+ * Get the actual dboard gain setting.
+ * \param chan the channel number from 0 to N-1
+ * \return the actual gain in dB
+ */
+ virtual float get_gain(size_t chan) = 0;
+
+ /*!
+ * Get the settable gain range.
+ * \param chan the channel number from 0 to N-1
+ * \return the gain range in dB
+ */
+ virtual uhd::gain_range_t get_gain_range(size_t chan) = 0;
+
+ /*!
+ * Set the antenna to use.
+ * \param chan the channel number from 0 to N-1
+ * \param ant the antenna string
+ */
+ virtual void set_antenna(size_t chan, const std::string &ant) = 0;
+
+ /*!
+ * Get the antenna in use.
+ * \param chan the channel number from 0 to N-1
+ * \return the antenna string
+ */
+ virtual std::string get_antenna(size_t chan) = 0;
+
+ /*!
+ * Get a list of possible antennas.
+ * \param chan the channel number from 0 to N-1
+ * \return a vector of antenna strings
+ */
+ virtual std::vector<std::string> get_antennas(size_t chan) = 0;
+
+ /*!
+ * Get the current time registers.
+ * \return the current usrp time
+ */
+ virtual uhd::time_spec_t get_time_now(void) = 0;
+
+ /*!
+ * Set the time registers at the next pps (across all mboards).
+ * \param time_spec the new time
+ */
+ virtual void set_time_next_pps(const uhd::time_spec_t &time_spec) = 0;
+
+ /*!
+ * Get access to the underlying uhd device object.
+ * \return the mimo usrp device object
+ */
+ virtual uhd::usrp::mimo_usrp::sptr get_device(void) = 0;
+};
+
+#endif /* INCLUDED_UHD_MIMO_SINK_H */
diff --git a/gr-uhd/lib/uhd_mimo_source.cc b/gr-uhd/lib/uhd_mimo_source.cc
new file mode 100644
index 0000000000..abd70ba369
--- /dev/null
+++ b/gr-uhd/lib/uhd_mimo_source.cc
@@ -0,0 +1,166 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2010 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along 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 <uhd_mimo_source.h>
+#include <gr_io_signature.h>
+#include <stdexcept>
+//#include "utils.h"
+
+/***********************************************************************
+ * UHD Source
+ **********************************************************************/
+uhd_mimo_source::uhd_mimo_source(gr_io_signature_sptr sig)
+:gr_sync_block("uhd mimo source", gr_make_io_signature(0, 0, 0), sig){
+ /* NOP */
+}
+
+/***********************************************************************
+ * UHD Source Impl
+ **********************************************************************/
+class uhd_mimo_source_impl : public uhd_mimo_source{
+public:
+ uhd_mimo_source_impl(
+ size_t num_channels,
+ const std::string &args,
+ const uhd::io_type_t &type
+ ) : uhd_mimo_source(gr_make_io_signature(num_channels, num_channels, type.size)), _type(type)
+ {
+ _dev = uhd::usrp::mimo_usrp::make(args);
+ set_streaming(false);
+ _dev->set_time_unknown_pps(uhd::time_spec_t()); //TODO may want option to disable this
+ }
+
+ ~uhd_mimo_source_impl(void){
+ set_streaming(false);
+ }
+
+ void set_subdev_spec(size_t chan, const std::string &spec){
+ return _dev->set_rx_subdev_spec(chan, spec);
+ }
+
+ void set_samp_rate_all(double rate){
+ _dev->set_rx_rate_all(rate);
+ //do_samp_rate_error_message(rate, get_samp_rate_all(), "RX");
+ }
+
+ double get_samp_rate_all(void){
+ return _dev->get_rx_rate_all();
+ }
+
+ uhd::tune_result_t set_center_freq(size_t chan, double freq){
+ uhd::tune_result_t tr = _dev->set_rx_freq(chan, freq);
+ //do_tune_freq_error_message(freq, _dev->get_rx_freq(chan), "RX");
+ return tr;
+ }
+
+ uhd::freq_range_t get_freq_range(size_t chan){
+ return _dev->get_rx_freq_range(chan);
+ }
+
+ void set_gain(size_t chan, float gain){
+ return _dev->set_rx_gain(chan, gain);
+ }
+
+ float get_gain(size_t chan){
+ return _dev->get_rx_gain(chan);
+ }
+
+ uhd::gain_range_t get_gain_range(size_t chan){
+ return _dev->get_rx_gain_range(chan);
+ }
+
+ void set_antenna(size_t chan, const std::string &ant){
+ return _dev->set_rx_antenna(chan, ant);
+ }
+
+ std::string get_antenna(size_t chan){
+ return _dev->get_rx_antenna(chan);
+ }
+
+ std::vector<std::string> get_antennas(size_t chan){
+ return _dev->get_rx_antennas(chan);
+ }
+
+ uhd::time_spec_t get_time_now(void){
+ return _dev->get_time_now();
+ }
+
+ void set_time_next_pps(const uhd::time_spec_t &time_spec){
+ return _dev->set_time_next_pps(time_spec);
+ }
+
+ uhd::usrp::mimo_usrp::sptr get_device(void){
+ return _dev;
+ }
+
+/***********************************************************************
+ * Work
+ **********************************************************************/
+ int work(
+ int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items
+ ){
+ //conditionally start streaming in the work call
+ //this prevents streaming before the runtime is ready
+ if (not _is_streaming) set_streaming(true);
+
+ uhd::rx_metadata_t metadata; //not passed out of this block
+
+ return _dev->get_device()->recv(
+ output_items, noutput_items, metadata,
+ _type, uhd::device::RECV_MODE_FULL_BUFF
+ );
+ }
+
+protected:
+ uhd::usrp::mimo_usrp::sptr _dev;
+ const uhd::io_type_t _type;
+ bool _is_streaming;
+
+ void set_streaming(bool enb){
+ if (enb){
+ //setup a stream command that starts streaming slightly in the future
+ static const double reasonable_delay = 0.01; //10 ms (order of magnitude >> RTT)
+ uhd::stream_cmd_t stream_cmd(uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS);
+ stream_cmd.stream_now = false;
+ stream_cmd.time_spec = get_time_now() + uhd::time_spec_t(_dev->get_num_channels() * reasonable_delay);
+ _dev->issue_stream_cmd(stream_cmd);
+ }
+ else
+ _dev->issue_stream_cmd(uhd::stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS);
+ _is_streaming = enb;
+ }
+};
+
+/***********************************************************************
+ * Make UHD Source
+ **********************************************************************/
+boost::shared_ptr<uhd_mimo_source> uhd_make_mimo_source(
+ size_t num_channels,
+ const std::string &args,
+ const uhd::io_type_t::tid_t &type
+){
+ return boost::shared_ptr<uhd_mimo_source>(
+ new uhd_mimo_source_impl(num_channels, args, type)
+ );
+}
diff --git a/gr-uhd/lib/uhd_mimo_source.h b/gr-uhd/lib/uhd_mimo_source.h
new file mode 100644
index 0000000000..dc29275985
--- /dev/null
+++ b/gr-uhd/lib/uhd_mimo_source.h
@@ -0,0 +1,145 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2010 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along 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_UHD_MIMO_SOURCE_H
+#define INCLUDED_UHD_MIMO_SOURCE_H
+
+#include <gr_sync_block.h>
+#include <uhd/usrp/mimo_usrp.hpp>
+
+class uhd_mimo_source;
+
+boost::shared_ptr<uhd_mimo_source> uhd_make_mimo_source(
+ size_t num_channels,
+ const std::string &args,
+ const uhd::io_type_t::tid_t &type
+);
+
+/***********************************************************************
+ * DEPRECATED
+ **********************************************************************/
+class UHD_DEPRECATED uhd_mimo_source : public gr_sync_block{
+public:
+
+ /*!
+ * Set the IO signature for this block.
+ * \param sig the output signature
+ */
+ uhd_mimo_source(gr_io_signature_sptr sig);
+
+ /*!
+ * Set the subdevice specification.
+ * \param chan the channel number from 0 to N-1
+ * \param spec the subdev spec markup string
+ */
+ virtual void set_subdev_spec(size_t chan, const std::string &spec) = 0;
+
+ /*!
+ * Set the sample rate for the usrp device (across all mboards).
+ * \param rate a new rate in Sps
+ */
+ virtual void set_samp_rate_all(double rate) = 0;
+
+ /*!
+ * Get the sample rate for the usrp device (across all mboards).
+ * This is the actual sample rate and may differ from the rate set.
+ * \return the actual rate in Sps
+ */
+ virtual double get_samp_rate_all(void) = 0;
+
+ /*!
+ * Tune the usrp device to the desired center frequency.
+ * \param chan the channel number from 0 to N-1
+ * \param freq the desired frequency in Hz
+ * \return a tune result with the actual frequencies
+ */
+ virtual uhd::tune_result_t set_center_freq(size_t chan, double freq) = 0;
+
+ /*!
+ * Get the tunable frequency range.
+ * \param chan the channel number from 0 to N-1
+ * \return the frequency range in Hz
+ */
+ virtual uhd::freq_range_t get_freq_range(size_t chan) = 0;
+
+ /*!
+ * Set the gain for the dboard.
+ * \param chan the channel number from 0 to N-1
+ * \param gain the gain in dB
+ */
+ virtual void set_gain(size_t chan, float gain) = 0;
+
+ /*!
+ * Get the actual dboard gain setting.
+ * \param chan the channel number from 0 to N-1
+ * \return the actual gain in dB
+ */
+ virtual float get_gain(size_t chan) = 0;
+
+ /*!
+ * Get the settable gain range.
+ * \param chan the channel number from 0 to N-1
+ * \return the gain range in dB
+ */
+ virtual uhd::gain_range_t get_gain_range(size_t chan) = 0;
+
+ /*!
+ * Set the antenna to use.
+ * \param chan the channel number from 0 to N-1
+ * \param ant the antenna string
+ */
+ virtual void set_antenna(size_t chan, const std::string &ant) = 0;
+
+ /*!
+ * Get the antenna in use.
+ * \param chan the channel number from 0 to N-1
+ * \return the antenna string
+ */
+ virtual std::string get_antenna(size_t chan) = 0;
+
+ /*!
+ * Get a list of possible antennas.
+ * \param chan the channel number from 0 to N-1
+ * \return a vector of antenna strings
+ */
+ virtual std::vector<std::string> get_antennas(size_t chan) = 0;
+
+ /*!
+ * Get the current time registers.
+ * \return the current usrp time
+ */
+ virtual uhd::time_spec_t get_time_now(void) = 0;
+
+ /*!
+ * Set the time registers at the next pps (across all mboards).
+ * \param time_spec the new time
+ */
+ virtual void set_time_next_pps(const uhd::time_spec_t &time_spec) = 0;
+
+ /*!
+ * Get access to the underlying uhd device object.
+ * \return the mimo usrp device object
+ */
+ virtual uhd::usrp::mimo_usrp::sptr get_device(void) = 0;
+};
+
+#endif /* INCLUDED_UHD_MIMO_SOURCE_H */
diff --git a/gr-uhd/lib/uhd_multi_usrp_sink.cc b/gr-uhd/lib/uhd_multi_usrp_sink.cc
new file mode 100644
index 0000000000..ee16e2928d
--- /dev/null
+++ b/gr-uhd/lib/uhd_multi_usrp_sink.cc
@@ -0,0 +1,188 @@
+/*
+ * 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <uhd_multi_usrp_sink.h>
+#include <gr_io_signature.h>
+#include <stdexcept>
+
+/***********************************************************************
+ * UHD Multi USRP Sink
+ **********************************************************************/
+uhd_multi_usrp_sink::uhd_multi_usrp_sink(gr_io_signature_sptr sig)
+:gr_sync_block("uhd multi usrp sink", sig, gr_make_io_signature(0, 0, 0)){
+ /* NOP */
+}
+
+/***********************************************************************
+ * UHD Multi USRP Sink Impl
+ **********************************************************************/
+class uhd_multi_usrp_sink_impl : public uhd_multi_usrp_sink{
+public:
+ uhd_multi_usrp_sink_impl(
+ const std::string &device_addr,
+ const uhd::io_type_t &io_type,
+ size_t num_channels
+ ):
+ uhd_multi_usrp_sink(gr_make_io_signature(
+ num_channels, num_channels, io_type.size
+ )),
+ _type(io_type),
+ _nchan(num_channels)
+ {
+ _dev = uhd::usrp::multi_usrp::make(device_addr);
+ }
+
+ void set_subdev_spec(const std::string &spec, size_t mboard){
+ return _dev->set_tx_subdev_spec(spec, mboard);
+ }
+
+ void set_samp_rate(double rate){
+ _dev->set_tx_rate(rate);
+ }
+
+ double get_samp_rate(void){
+ return _dev->get_tx_rate();
+ }
+
+ uhd::tune_result_t set_center_freq(
+ const uhd::tune_request_t tune_request, size_t chan
+ ){
+ return _dev->set_tx_freq(tune_request, chan);
+ }
+
+ uhd::freq_range_t get_freq_range(size_t chan){
+ return _dev->get_tx_freq_range(chan);
+ }
+
+ void set_gain(float gain, size_t chan){
+ return _dev->set_tx_gain(gain, chan);
+ }
+
+ float get_gain(size_t chan){
+ return _dev->get_tx_gain(chan);
+ }
+
+ uhd::gain_range_t get_gain_range(size_t chan){
+ return _dev->get_tx_gain_range(chan);
+ }
+
+ void set_antenna(const std::string &ant, size_t chan){
+ return _dev->set_tx_antenna(ant, chan);
+ }
+
+ std::string get_antenna(size_t chan){
+ return _dev->get_tx_antenna(chan);
+ }
+
+ std::vector<std::string> get_antennas(size_t chan){
+ return _dev->get_tx_antennas(chan);
+ }
+
+ void set_bandwidth(double bandwidth, size_t chan){
+ return _dev->set_tx_bandwidth(bandwidth, chan);
+ }
+
+ void set_clock_config(const uhd::clock_config_t &clock_config, size_t mboard){
+ return _dev->set_clock_config(clock_config, mboard);
+ }
+
+ uhd::time_spec_t get_time_now(void){
+ return _dev->get_time_now();
+ }
+
+ void set_time_next_pps(const uhd::time_spec_t &time_spec){
+ return _dev->set_time_next_pps(time_spec);
+ }
+
+ void set_time_unknown_pps(const uhd::time_spec_t &time_spec){
+ return _dev->set_time_unknown_pps(time_spec);
+ }
+
+ uhd::usrp::multi_usrp::sptr get_device(void){
+ return _dev;
+ }
+
+/***********************************************************************
+ * Work
+ **********************************************************************/
+ int work(
+ int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items
+ ){
+ uhd::tx_metadata_t metadata;
+ metadata.start_of_burst = true;
+
+ return _dev->get_device()->send(
+ input_items, noutput_items, metadata,
+ _type, uhd::device::SEND_MODE_FULL_BUFF, 1.0
+ );
+ }
+
+ //Send an empty start-of-burst packet to begin streaming.
+ //Set at a time in the near future so data will be sync'd.
+ bool start(void){
+ uhd::tx_metadata_t metadata;
+ metadata.start_of_burst = true;
+ metadata.has_time_spec = true;
+ //TODO: Time in the near future, must be less than source time in future
+ //because ethernet pause frames with throttle stream commands.
+ //It will be fixed with the invention of host-based flow control.
+ metadata.time_spec = get_time_now() + uhd::time_spec_t(0.05);
+
+ _dev->get_device()->send(
+ gr_vector_const_void_star(_nchan), 0, metadata,
+ _type, uhd::device::SEND_MODE_ONE_PACKET, 1.0
+ );
+ return true;
+ }
+
+ //Send an empty end-of-burst packet to end streaming.
+ //Ending the burst avoids an underflow error on stop.
+ bool stop(void){
+ uhd::tx_metadata_t metadata;
+ metadata.end_of_burst = true;
+
+ _dev->get_device()->send(
+ gr_vector_const_void_star(_nchan), 0, metadata,
+ _type, uhd::device::SEND_MODE_ONE_PACKET, 1.0
+ );
+ return true;
+ }
+
+protected:
+ uhd::usrp::multi_usrp::sptr _dev;
+ const uhd::io_type_t _type;
+ size_t _nchan;
+};
+
+/***********************************************************************
+ * Make UHD Multi USRP Sink
+ **********************************************************************/
+boost::shared_ptr<uhd_multi_usrp_sink> uhd_make_multi_usrp_sink(
+ const std::string &device_addr,
+ const uhd::io_type_t::tid_t &io_type,
+ size_t num_channels
+){
+ return boost::shared_ptr<uhd_multi_usrp_sink>(
+ new uhd_multi_usrp_sink_impl(device_addr, io_type, num_channels)
+ );
+}
diff --git a/gr-uhd/lib/uhd_multi_usrp_sink.h b/gr-uhd/lib/uhd_multi_usrp_sink.h
new file mode 100644
index 0000000000..370e59d0e1
--- /dev/null
+++ b/gr-uhd/lib/uhd_multi_usrp_sink.h
@@ -0,0 +1,175 @@
+/*
+ * 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 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_UHD_MULTI_USRP_SINK_H
+#define INCLUDED_UHD_MULTI_USRP_SINK_H
+
+#include <gr_sync_block.h>
+#include <uhd/usrp/multi_usrp.hpp>
+
+class uhd_multi_usrp_sink;
+
+boost::shared_ptr<uhd_multi_usrp_sink> uhd_make_multi_usrp_sink(
+ const std::string &device_addr,
+ const uhd::io_type_t::tid_t &io_type,
+ size_t num_channels
+);
+
+class uhd_multi_usrp_sink : public gr_sync_block{
+public:
+
+ /*!
+ * Set the IO signature for this block.
+ * \param sig the input signature
+ */
+ uhd_multi_usrp_sink(gr_io_signature_sptr sig);
+
+ /*!
+ * Set the subdevice specification.
+ * \param spec the subdev spec markup string
+ * \param mboard the motherboard index 0 to M-1
+ */
+ virtual void set_subdev_spec(const std::string &spec, size_t mboard) = 0;
+
+ /*!
+ * Set the sample rate for the usrp device.
+ * \param rate a new rate in Sps
+ */
+ virtual void set_samp_rate(double rate) = 0;
+
+ /*!
+ * Get the sample rate for the usrp device.
+ * This is the actual sample rate and may differ from the rate set.
+ * \return the actual rate in Sps
+ */
+ virtual double get_samp_rate(void) = 0;
+
+ /*!
+ * Tune the usrp device to the desired center frequency.
+ * \param tune_request the tune request instructions
+ * \param chan the channel index 0 to N-1
+ * \return a tune result with the actual frequencies
+ */
+ virtual uhd::tune_result_t set_center_freq(
+ const uhd::tune_request_t tune_request, size_t chan
+ ) = 0;
+
+ /*!
+ * Tune the usrp device to the desired center frequency.
+ * This is a wrapper around set center freq so that in this case,
+ * the user can pass a single frequency in the call through swig.
+ * \param freq the desired frequency in Hz
+ * \param chan the channel index 0 to N-1
+ * \return a tune result with the actual frequencies
+ */
+ uhd::tune_result_t set_center_freq(double freq, size_t chan){
+ return set_center_freq(uhd::tune_request_t(freq), chan);
+ }
+
+ /*!
+ * Get the tunable frequency range.
+ * \param chan the channel index 0 to N-1
+ * \return the frequency range in Hz
+ */
+ virtual uhd::freq_range_t get_freq_range(size_t chan) = 0;
+
+ /*!
+ * Set the gain for the dboard.
+ * \param gain the gain in dB
+ * \param chan the channel index 0 to N-1
+ */
+ virtual void set_gain(float gain, size_t chan) = 0;
+
+ /*!
+ * Get the actual dboard gain setting.
+ * \param chan the channel index 0 to N-1
+ * \return the actual gain in dB
+ */
+ virtual float get_gain(size_t chan) = 0;
+
+ /*!
+ * Get the settable gain range.
+ * \param chan the channel index 0 to N-1
+ * \return the gain range in dB
+ */
+ virtual uhd::gain_range_t get_gain_range(size_t chan) = 0;
+
+ /*!
+ * Set the antenna to use.
+ * \param ant the antenna string
+ * \param chan the channel index 0 to N-1
+ */
+ virtual void set_antenna(const std::string &ant, size_t chan) = 0;
+
+ /*!
+ * Get the antenna in use.
+ * \param chan the channel index 0 to N-1
+ * \return the antenna string
+ */
+ virtual std::string get_antenna(size_t chan) = 0;
+
+ /*!
+ * Get a list of possible antennas.
+ * \param chan the channel index 0 to N-1
+ * \return a vector of antenna strings
+ */
+ virtual std::vector<std::string> get_antennas(size_t chan) = 0;
+
+ /*!
+ * Set the subdevice bandpass filter.
+ * \param chan the channel index 0 to N-1
+ * \param bandwidth the filter bandwidth in Hz
+ */
+ virtual void set_bandwidth(double bandwidth, size_t chan) = 0;
+
+ /*!
+ * Set the clock configuration.
+ * \param clock_config the new configuration
+ * \param mboard the motherboard index 0 to M-1
+ */
+ virtual void set_clock_config(const uhd::clock_config_t &clock_config, size_t mboard) = 0;
+
+ /*!
+ * Get the current time registers.
+ * \return the current usrp time
+ */
+ virtual uhd::time_spec_t get_time_now(void) = 0;
+
+ /*!
+ * Set the time registers at the next pps.
+ * \param time_spec the new time
+ */
+ virtual void set_time_next_pps(const uhd::time_spec_t &time_spec) = 0;
+
+ /*!
+ * Sync the time registers with an unknown pps edge.
+ * \param time_spec the new time
+ */
+ virtual void set_time_unknown_pps(const uhd::time_spec_t &time_spec) = 0;
+
+ /*!
+ * Get access to the underlying uhd device object.
+ * \return the multi usrp device object
+ */
+ virtual uhd::usrp::multi_usrp::sptr get_device(void) = 0;
+};
+
+#endif /* INCLUDED_UHD_MULTI_USRP_SINK_H */
diff --git a/gr-uhd/lib/uhd_multi_usrp_source.cc b/gr-uhd/lib/uhd_multi_usrp_source.cc
new file mode 100644
index 0000000000..029a763e33
--- /dev/null
+++ b/gr-uhd/lib/uhd_multi_usrp_source.cc
@@ -0,0 +1,187 @@
+/*
+ * 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <uhd_multi_usrp_source.h>
+#include <gr_io_signature.h>
+#include <stdexcept>
+#include <iostream>
+#include <boost/format.hpp>
+
+/***********************************************************************
+ * UHD Multi USRP Source
+ **********************************************************************/
+uhd_multi_usrp_source::uhd_multi_usrp_source(gr_io_signature_sptr sig)
+:gr_sync_block("uhd multi_usrp source", gr_make_io_signature(0, 0, 0), sig){
+ /* NOP */
+}
+
+/***********************************************************************
+ * UHD Multi USRP Source Impl
+ **********************************************************************/
+class uhd_multi_usrp_source_impl : public uhd_multi_usrp_source{
+public:
+ uhd_multi_usrp_source_impl(
+ const std::string &device_addr,
+ const uhd::io_type_t &io_type,
+ size_t num_channels
+ ):
+ uhd_multi_usrp_source(gr_make_io_signature(
+ num_channels, num_channels, io_type.size
+ )),
+ _type(io_type)
+ {
+ _dev = uhd::usrp::multi_usrp::make(device_addr);
+ }
+
+ void set_subdev_spec(const std::string &spec, size_t mboard){
+ return _dev->set_rx_subdev_spec(spec, mboard);
+ }
+
+ void set_samp_rate(double rate){
+ _dev->set_rx_rate(rate);
+ }
+
+ double get_samp_rate(void){
+ return _dev->get_rx_rate();
+ }
+
+ uhd::tune_result_t set_center_freq(
+ const uhd::tune_request_t tune_request, size_t chan
+ ){
+ return _dev->set_rx_freq(tune_request, chan);
+ }
+
+ uhd::freq_range_t get_freq_range(size_t chan){
+ return _dev->get_rx_freq_range(chan);
+ }
+
+ void set_gain(float gain, size_t chan){
+ return _dev->set_rx_gain(gain, chan);
+ }
+
+ float get_gain(size_t chan){
+ return _dev->get_rx_gain(chan);
+ }
+
+ uhd::gain_range_t get_gain_range(size_t chan){
+ return _dev->get_rx_gain_range(chan);
+ }
+
+ void set_antenna(const std::string &ant, size_t chan){
+ return _dev->set_rx_antenna(ant, chan);
+ }
+
+ std::string get_antenna(size_t chan){
+ return _dev->get_rx_antenna(chan);
+ }
+
+ std::vector<std::string> get_antennas(size_t chan){
+ return _dev->get_rx_antennas(chan);
+ }
+
+ void set_bandwidth(double bandwidth, size_t chan){
+ return _dev->set_rx_bandwidth(bandwidth, chan);
+ }
+
+ void set_clock_config(const uhd::clock_config_t &clock_config, size_t mboard){
+ return _dev->set_clock_config(clock_config, mboard);
+ }
+
+ uhd::time_spec_t get_time_now(void){
+ return _dev->get_time_now();
+ }
+
+ void set_time_next_pps(const uhd::time_spec_t &time_spec){
+ return _dev->set_time_next_pps(time_spec);
+ }
+
+ void set_time_unknown_pps(const uhd::time_spec_t &time_spec){
+ return _dev->set_time_unknown_pps(time_spec);
+ }
+
+ uhd::usrp::multi_usrp::sptr get_device(void){
+ return _dev;
+ }
+
+/***********************************************************************
+ * Work
+ **********************************************************************/
+ int work(
+ int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items
+ ){
+ uhd::rx_metadata_t metadata; //not passed out of this block
+
+ size_t num_samps = _dev->get_device()->recv(
+ output_items, noutput_items, metadata,
+ _type, uhd::device::RECV_MODE_FULL_BUFF, 1.0
+ );
+
+ switch(metadata.error_code){
+ case uhd::rx_metadata_t::ERROR_CODE_NONE:
+ return num_samps;
+
+ case uhd::rx_metadata_t::ERROR_CODE_OVERFLOW:
+ //ignore overflows and try work again
+ return work(noutput_items, input_items, output_items);
+
+ default:
+ std::cout << boost::format(
+ "UHD source block got error code 0x%x"
+ ) % metadata.error_code << std::endl;
+ return num_samps;
+ }
+ }
+
+ bool start(void){
+ //setup a stream command that starts streaming slightly in the future
+ static const double reasonable_delay = 0.1; //order of magnitude over RTT
+ uhd::stream_cmd_t stream_cmd(uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS);
+ stream_cmd.stream_now = false;
+ stream_cmd.time_spec = get_time_now() + uhd::time_spec_t(reasonable_delay);
+ _dev->issue_stream_cmd(stream_cmd);
+ return true;
+ }
+
+ bool stop(void){
+ _dev->issue_stream_cmd(uhd::stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS);
+ return true;
+ }
+
+private:
+ uhd::usrp::multi_usrp::sptr _dev;
+ const uhd::io_type_t _type;
+};
+
+
+/***********************************************************************
+ * Make UHD Multi USRP Source
+ **********************************************************************/
+boost::shared_ptr<uhd_multi_usrp_source> uhd_make_multi_usrp_source(
+ const std::string &device_addr,
+ const uhd::io_type_t::tid_t &io_type,
+ size_t num_channels
+){
+ return boost::shared_ptr<uhd_multi_usrp_source>(
+ new uhd_multi_usrp_source_impl(device_addr, io_type, num_channels)
+ );
+}
diff --git a/gr-uhd/lib/uhd_multi_usrp_source.h b/gr-uhd/lib/uhd_multi_usrp_source.h
new file mode 100644
index 0000000000..b3cbdae1f6
--- /dev/null
+++ b/gr-uhd/lib/uhd_multi_usrp_source.h
@@ -0,0 +1,175 @@
+/*
+ * 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 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_UHD_MULTI_USRP_SOURCE_H
+#define INCLUDED_UHD_MULTI_USRP_SOURCE_H
+
+#include <gr_sync_block.h>
+#include <uhd/usrp/multi_usrp.hpp>
+
+class uhd_multi_usrp_source;
+
+boost::shared_ptr<uhd_multi_usrp_source> uhd_make_multi_usrp_source(
+ const std::string &device_addr,
+ const uhd::io_type_t::tid_t &io_type,
+ size_t num_channels
+);
+
+class uhd_multi_usrp_source : public gr_sync_block{
+public:
+
+ /*!
+ * Set the IO signature for this block.
+ * \param sig the output signature
+ */
+ uhd_multi_usrp_source(gr_io_signature_sptr sig);
+
+ /*!
+ * Set the subdevice specification.
+ * \param spec the subdev spec markup string
+ * \param mboard the motherboard index 0 to M-1
+ */
+ virtual void set_subdev_spec(const std::string &spec, size_t mboard) = 0;
+
+ /*!
+ * Set the sample rate for the usrp device.
+ * \param rate a new rate in Sps
+ */
+ virtual void set_samp_rate(double rate) = 0;
+
+ /*!
+ * Get the sample rate for the usrp device.
+ * This is the actual sample rate and may differ from the rate set.
+ * \return the actual rate in Sps
+ */
+ virtual double get_samp_rate(void) = 0;
+
+ /*!
+ * Tune the usrp device to the desired center frequency.
+ * \param tune_request the tune request instructions
+ * \param chan the channel index 0 to N-1
+ * \return a tune result with the actual frequencies
+ */
+ virtual uhd::tune_result_t set_center_freq(
+ const uhd::tune_request_t tune_request, size_t chan
+ ) = 0;
+
+ /*!
+ * Tune the usrp device to the desired center frequency.
+ * This is a wrapper around set center freq so that in this case,
+ * the user can pass a single frequency in the call through swig.
+ * \param freq the desired frequency in Hz
+ * \param chan the channel index 0 to N-1
+ * \return a tune result with the actual frequencies
+ */
+ uhd::tune_result_t set_center_freq(double freq, size_t chan){
+ return set_center_freq(uhd::tune_request_t(freq), chan);
+ }
+
+ /*!
+ * Get the tunable frequency range.
+ * \param chan the channel index 0 to N-1
+ * \return the frequency range in Hz
+ */
+ virtual uhd::freq_range_t get_freq_range(size_t chan) = 0;
+
+ /*!
+ * Set the gain for the dboard.
+ * \param gain the gain in dB
+ * \param chan the channel index 0 to N-1
+ */
+ virtual void set_gain(float gain, size_t chan) = 0;
+
+ /*!
+ * Get the actual dboard gain setting.
+ * \param chan the channel index 0 to N-1
+ * \return the actual gain in dB
+ */
+ virtual float get_gain(size_t chan) = 0;
+
+ /*!
+ * Get the settable gain range.
+ * \param chan the channel index 0 to N-1
+ * \return the gain range in dB
+ */
+ virtual uhd::gain_range_t get_gain_range(size_t chan) = 0;
+
+ /*!
+ * Set the antenna to use.
+ * \param ant the antenna string
+ * \param chan the channel index 0 to N-1
+ */
+ virtual void set_antenna(const std::string &ant, size_t chan) = 0;
+
+ /*!
+ * Get the antenna in use.
+ * \param chan the channel index 0 to N-1
+ * \return the antenna string
+ */
+ virtual std::string get_antenna(size_t chan) = 0;
+
+ /*!
+ * Get a list of possible antennas.
+ * \param chan the channel index 0 to N-1
+ * \return a vector of antenna strings
+ */
+ virtual std::vector<std::string> get_antennas(size_t chan) = 0;
+
+ /*!
+ * Set the subdevice bandpass filter.
+ * \param bandwidth the filter bandwidth in Hz
+ * \param chan the channel index 0 to N-1
+ */
+ virtual void set_bandwidth(double bandwidth, size_t chan) = 0;
+
+ /*!
+ * Set the clock configuration.
+ * \param clock_config the new configuration
+ * \param mboard the motherboard index 0 to M-1
+ */
+ virtual void set_clock_config(const uhd::clock_config_t &clock_config, size_t mboard) = 0;
+
+ /*!
+ * Get the current time registers.
+ * \return the current usrp time
+ */
+ virtual uhd::time_spec_t get_time_now(void) = 0;
+
+ /*!
+ * Set the time registers at the next pps.
+ * \param time_spec the new time
+ */
+ virtual void set_time_next_pps(const uhd::time_spec_t &time_spec) = 0;
+
+ /*!
+ * Sync the time registers with an unknown pps edge.
+ * \param time_spec the new time
+ */
+ virtual void set_time_unknown_pps(const uhd::time_spec_t &time_spec) = 0;
+
+ /*!
+ * Get access to the underlying uhd device object.
+ * \return the multi usrp device object
+ */
+ virtual uhd::usrp::multi_usrp::sptr get_device(void) = 0;
+};
+
+#endif /* INCLUDED_UHD_MULTI_USRP_SOURCE_H */
diff --git a/gr-uhd/lib/uhd_simple_sink.cc b/gr-uhd/lib/uhd_simple_sink.cc
new file mode 100644
index 0000000000..d7b04465d4
--- /dev/null
+++ b/gr-uhd/lib/uhd_simple_sink.cc
@@ -0,0 +1,152 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2010 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along 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 <uhd_simple_sink.h>
+#include <gr_io_signature.h>
+#include <stdexcept>
+//#include "utils.h"
+
+/***********************************************************************
+ * UHD Sink
+ **********************************************************************/
+uhd_simple_sink::uhd_simple_sink(gr_io_signature_sptr sig)
+:gr_sync_block("uhd simple sink", sig, gr_make_io_signature(0, 0, 0)){
+ /* NOP */
+}
+
+/***********************************************************************
+ * UHD Sink Impl
+ **********************************************************************/
+class uhd_simple_sink_impl : public uhd_simple_sink{
+public:
+ uhd_simple_sink_impl(
+ const std::string &args,
+ const uhd::io_type_t &type
+ ) : uhd_simple_sink(gr_make_io_signature(1, 1, type.size)), _type(type)
+ {
+ _dev = uhd::usrp::simple_usrp::make(args);
+ }
+
+ ~uhd_simple_sink_impl(void){
+ //NOP
+ }
+
+ void set_subdev_spec(const std::string &spec){
+ return _dev->set_tx_subdev_spec(spec);
+ }
+
+ void set_samp_rate(double rate){
+ _dev->set_tx_rate(rate);
+ //do_samp_rate_error_message(rate, get_samp_rate(), "TX");
+ }
+
+ double get_samp_rate(void){
+ return _dev->get_tx_rate();
+ }
+
+ uhd::tune_result_t set_center_freq(double freq){
+ uhd::tune_result_t tr = _dev->set_tx_freq(freq);
+ //do_tune_freq_error_message(freq, _dev->get_tx_freq(), "TX");
+ return tr;
+ }
+
+ uhd::freq_range_t get_freq_range(void){
+ return _dev->get_tx_freq_range();
+ }
+
+ void set_gain(float gain){
+ return _dev->set_tx_gain(gain);
+ }
+
+ float get_gain(void){
+ return _dev->get_tx_gain();
+ }
+
+ uhd::gain_range_t get_gain_range(void){
+ return _dev->get_tx_gain_range();
+ }
+
+ void set_antenna(const std::string &ant){
+ return _dev->set_tx_antenna(ant);
+ }
+
+ std::string get_antenna(void){
+ return _dev->get_tx_antenna();
+ }
+
+ std::vector<std::string> get_antennas(void){
+ return _dev->get_tx_antennas();
+ }
+
+ void set_clock_config(const uhd::clock_config_t &clock_config){
+ return _dev->set_clock_config(clock_config);
+ }
+
+ uhd::time_spec_t get_time_now(void){
+ return _dev->get_time_now();
+ }
+
+ void set_time_now(const uhd::time_spec_t &time_spec){
+ return _dev->set_time_now(time_spec);
+ }
+
+ void set_time_next_pps(const uhd::time_spec_t &time_spec){
+ return _dev->set_time_next_pps(time_spec);
+ }
+
+ uhd::usrp::simple_usrp::sptr get_device(void){
+ return _dev;
+ }
+
+/***********************************************************************
+ * Work
+ **********************************************************************/
+ int work(
+ int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items
+ ){
+ uhd::tx_metadata_t metadata;
+ metadata.start_of_burst = true;
+
+ return _dev->get_device()->send(
+ input_items, noutput_items, metadata,
+ _type, uhd::device::SEND_MODE_FULL_BUFF
+ );
+ }
+
+protected:
+ uhd::usrp::simple_usrp::sptr _dev;
+ const uhd::io_type_t _type;
+};
+
+/***********************************************************************
+ * Make UHD Sink
+ **********************************************************************/
+boost::shared_ptr<uhd_simple_sink> uhd_make_simple_sink(
+ const std::string &args,
+ const uhd::io_type_t::tid_t &type
+){
+ return boost::shared_ptr<uhd_simple_sink>(
+ new uhd_simple_sink_impl(args, type)
+ );
+}
diff --git a/gr-uhd/lib/uhd_simple_sink.h b/gr-uhd/lib/uhd_simple_sink.h
new file mode 100644
index 0000000000..b239e3f212
--- /dev/null
+++ b/gr-uhd/lib/uhd_simple_sink.h
@@ -0,0 +1,147 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2010 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along 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_UHD_SIMPLE_SINK_H
+#define INCLUDED_UHD_SIMPLE_SINK_H
+
+#include <gr_sync_block.h>
+#include <uhd/usrp/simple_usrp.hpp>
+
+class uhd_simple_sink;
+
+boost::shared_ptr<uhd_simple_sink> uhd_make_simple_sink(
+ const std::string &args,
+ const uhd::io_type_t::tid_t &type
+);
+
+/***********************************************************************
+ * DEPRECATED
+ **********************************************************************/
+class UHD_DEPRECATED uhd_simple_sink : public gr_sync_block{
+public:
+
+ /*!
+ * Set the IO signature for this block.
+ * \param sig the input signature
+ */
+ uhd_simple_sink(gr_io_signature_sptr sig);
+
+ /*!
+ * Set the subdevice specification.
+ * \param spec the subdev spec markup string
+ */
+ virtual void set_subdev_spec(const std::string &spec) = 0;
+
+ /*!
+ * Set the sample rate for the usrp device.
+ * \param rate a new rate in Sps
+ */
+ virtual void set_samp_rate(double rate) = 0;
+
+ /*!
+ * Get the sample rate for the usrp device.
+ * This is the actual sample rate and may differ from the rate set.
+ * \return the actual rate in Sps
+ */
+ virtual double get_samp_rate(void) = 0;
+
+ /*!
+ * Tune the usrp device to the desired center frequency.
+ * \param freq the desired frequency in Hz
+ * \return a tune result with the actual frequencies
+ */
+ virtual uhd::tune_result_t set_center_freq(double freq) = 0;
+
+ /*!
+ * Get the tunable frequency range.
+ * \return the frequency range in Hz
+ */
+ virtual uhd::freq_range_t get_freq_range(void) = 0;
+
+ /*!
+ * Set the gain for the dboard.
+ * \param gain the gain in dB
+ */
+ virtual void set_gain(float gain) = 0;
+
+ /*!
+ * Get the actual dboard gain setting.
+ * \return the actual gain in dB
+ */
+ virtual float get_gain(void) = 0;
+
+ /*!
+ * Get the settable gain range.
+ * \return the gain range in dB
+ */
+ virtual uhd::gain_range_t get_gain_range(void) = 0;
+
+ /*!
+ * Set the antenna to use.
+ * \param ant the antenna string
+ */
+ virtual void set_antenna(const std::string &ant) = 0;
+
+ /*!
+ * Get the antenna in use.
+ * \return the antenna string
+ */
+ virtual std::string get_antenna(void) = 0;
+
+ /*!
+ * Get a list of possible antennas.
+ * \return a vector of antenna strings
+ */
+ virtual std::vector<std::string> get_antennas(void) = 0;
+
+ /*!
+ * Set the clock configuration.
+ * \param clock_config the new configuration
+ */
+ virtual void set_clock_config(const uhd::clock_config_t &clock_config) = 0;
+
+ /*!
+ * Get the current time registers.
+ * \return the current usrp time
+ */
+ virtual uhd::time_spec_t get_time_now(void) = 0;
+
+ /*!
+ * Set the time registers asap.
+ * \param time_spec the new time
+ */
+ virtual void set_time_now(const uhd::time_spec_t &time_spec) = 0;
+
+ /*!
+ * Set the time registers at the next pps.
+ * \param time_spec the new time
+ */
+ virtual void set_time_next_pps(const uhd::time_spec_t &time_spec) = 0;
+
+ /*!
+ * Get access to the underlying uhd device object.
+ * \return the simple usrp device object
+ */
+ virtual uhd::usrp::simple_usrp::sptr get_device(void) = 0;
+};
+
+#endif /* INCLUDED_UHD_SIMPLE_SINK_H */
diff --git a/gr-uhd/lib/uhd_simple_source.cc b/gr-uhd/lib/uhd_simple_source.cc
new file mode 100644
index 0000000000..d74c8414d2
--- /dev/null
+++ b/gr-uhd/lib/uhd_simple_source.cc
@@ -0,0 +1,183 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2010 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along 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 <uhd_simple_source.h>
+#include <gr_io_signature.h>
+#include <stdexcept>
+#include <iostream>
+#include <boost/format.hpp>
+//#include "utils.h"
+
+/***********************************************************************
+ * UHD Source
+ **********************************************************************/
+uhd_simple_source::uhd_simple_source(gr_io_signature_sptr sig)
+:gr_sync_block("uhd simple source", gr_make_io_signature(0, 0, 0), sig){
+ /* NOP */
+}
+
+/***********************************************************************
+ * UHD Source Impl
+ **********************************************************************/
+class uhd_simple_source_impl : public uhd_simple_source{
+public:
+ uhd_simple_source_impl(
+ const std::string &args,
+ const uhd::io_type_t &type
+ ) : uhd_simple_source(gr_make_io_signature(1, 1, type.size)), _type(type)
+ {
+ _dev = uhd::usrp::simple_usrp::make(args);
+ set_streaming(false);
+ }
+
+ ~uhd_simple_source_impl(void){
+ set_streaming(false);
+ }
+
+ void set_subdev_spec(const std::string &spec){
+ return _dev->set_rx_subdev_spec(spec);
+ }
+
+ void set_samp_rate(double rate){
+ _dev->set_rx_rate(rate);
+ //do_samp_rate_error_message(rate, get_samp_rate(), "RX");
+ }
+
+ double get_samp_rate(void){
+ return _dev->get_rx_rate();
+ }
+
+ uhd::tune_result_t set_center_freq(double freq){
+ uhd::tune_result_t tr = _dev->set_rx_freq(freq);
+ //do_tune_freq_error_message(freq, _dev->get_rx_freq(), "RX");
+ return tr;
+ }
+
+ uhd::freq_range_t get_freq_range(void){
+ return _dev->get_rx_freq_range();
+ }
+
+ void set_gain(float gain){
+ return _dev->set_rx_gain(gain);
+ }
+
+ float get_gain(void){
+ return _dev->get_rx_gain();
+ }
+
+ uhd::gain_range_t get_gain_range(void){
+ return _dev->get_rx_gain_range();
+ }
+
+ void set_antenna(const std::string &ant){
+ return _dev->set_rx_antenna(ant);
+ }
+
+ std::string get_antenna(void){
+ return _dev->get_rx_antenna();
+ }
+
+ std::vector<std::string> get_antennas(void){
+ return _dev->get_rx_antennas();
+ }
+
+ void set_clock_config(const uhd::clock_config_t &clock_config){
+ return _dev->set_clock_config(clock_config);
+ }
+
+ uhd::time_spec_t get_time_now(void){
+ return _dev->get_time_now();
+ }
+
+ void set_time_now(const uhd::time_spec_t &time_spec){
+ return _dev->set_time_now(time_spec);
+ }
+
+ void set_time_next_pps(const uhd::time_spec_t &time_spec){
+ return _dev->set_time_next_pps(time_spec);
+ }
+
+ uhd::usrp::simple_usrp::sptr get_device(void){
+ return _dev;
+ }
+
+/***********************************************************************
+ * Work
+ **********************************************************************/
+ int work(
+ int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items
+ ){
+ //conditionally start streaming in the work call
+ //this prevents streaming before the runtime is ready
+ if (not _is_streaming) set_streaming(true);
+
+ uhd::rx_metadata_t metadata; //not passed out of this block
+
+ size_t num_samps = _dev->get_device()->recv(
+ output_items, noutput_items, metadata,
+ _type, uhd::device::RECV_MODE_FULL_BUFF
+ );
+
+ switch(metadata.error_code){
+ case uhd::rx_metadata_t::ERROR_CODE_NONE:
+ return num_samps;
+
+ case uhd::rx_metadata_t::ERROR_CODE_OVERFLOW:
+ //ignore overflows and try work again
+ return work(noutput_items, input_items, output_items);
+
+ default:
+ std::cout << boost::format(
+ "UHD source block got error code 0x%x"
+ ) % metadata.error_code << std::endl;
+ return num_samps;
+ }
+ }
+
+private:
+ uhd::usrp::simple_usrp::sptr _dev;
+ const uhd::io_type_t _type;
+ bool _is_streaming;
+
+ void set_streaming(bool enb){
+ if (enb)
+ _dev->issue_stream_cmd(uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS);
+ else
+ _dev->issue_stream_cmd(uhd::stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS);
+ _is_streaming = enb;
+ }
+};
+
+
+/***********************************************************************
+ * Make UHD Source
+ **********************************************************************/
+boost::shared_ptr<uhd_simple_source> uhd_make_simple_source(
+ const std::string &args,
+ const uhd::io_type_t::tid_t &type
+){
+ return boost::shared_ptr<uhd_simple_source>(
+ new uhd_simple_source_impl(args, type)
+ );
+}
diff --git a/gr-uhd/lib/uhd_simple_source.h b/gr-uhd/lib/uhd_simple_source.h
new file mode 100644
index 0000000000..c524a024a8
--- /dev/null
+++ b/gr-uhd/lib/uhd_simple_source.h
@@ -0,0 +1,147 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2010 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along 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_UHD_SIMPLE_SOURCE_H
+#define INCLUDED_UHD_SIMPLE_SOURCE_H
+
+#include <gr_sync_block.h>
+#include <uhd/usrp/simple_usrp.hpp>
+
+class uhd_simple_source;
+
+boost::shared_ptr<uhd_simple_source> uhd_make_simple_source(
+ const std::string &args,
+ const uhd::io_type_t::tid_t &type
+);
+
+/***********************************************************************
+ * DEPRECATED
+ **********************************************************************/
+class UHD_DEPRECATED uhd_simple_source : public gr_sync_block{
+public:
+
+ /*!
+ * Set the IO signature for this block.
+ * \param sig the output signature
+ */
+ uhd_simple_source(gr_io_signature_sptr sig);
+
+ /*!
+ * Set the subdevice specification.
+ * \param spec the subdev spec markup string
+ */
+ virtual void set_subdev_spec(const std::string &spec) = 0;
+
+ /*!
+ * Set the sample rate for the usrp device.
+ * \param rate a new rate in Sps
+ */
+ virtual void set_samp_rate(double rate) = 0;
+
+ /*!
+ * Get the sample rate for the usrp device.
+ * This is the actual sample rate and may differ from the rate set.
+ * \return the actual rate in Sps
+ */
+ virtual double get_samp_rate(void) = 0;
+
+ /*!
+ * Tune the usrp device to the desired center frequency.
+ * \param freq the desired frequency in Hz
+ * \return a tune result with the actual frequencies
+ */
+ virtual uhd::tune_result_t set_center_freq(double freq) = 0;
+
+ /*!
+ * Get the tunable frequency range.
+ * \return the frequency range in Hz
+ */
+ virtual uhd::freq_range_t get_freq_range(void) = 0;
+
+ /*!
+ * Set the gain for the dboard.
+ * \param gain the gain in dB
+ */
+ virtual void set_gain(float gain) = 0;
+
+ /*!
+ * Get the actual dboard gain setting.
+ * \return the actual gain in dB
+ */
+ virtual float get_gain(void) = 0;
+
+ /*!
+ * Get the settable gain range.
+ * \return the gain range in dB
+ */
+ virtual uhd::gain_range_t get_gain_range(void) = 0;
+
+ /*!
+ * Set the antenna to use.
+ * \param ant the antenna string
+ */
+ virtual void set_antenna(const std::string &ant) = 0;
+
+ /*!
+ * Get the antenna in use.
+ * \return the antenna string
+ */
+ virtual std::string get_antenna(void) = 0;
+
+ /*!
+ * Get a list of possible antennas.
+ * \return a vector of antenna strings
+ */
+ virtual std::vector<std::string> get_antennas(void) = 0;
+
+ /*!
+ * Set the clock configuration.
+ * \param clock_config the new configuration
+ */
+ virtual void set_clock_config(const uhd::clock_config_t &clock_config) = 0;
+
+ /*!
+ * Get the current time registers.
+ * \return the current usrp time
+ */
+ virtual uhd::time_spec_t get_time_now(void) = 0;
+
+ /*!
+ * Set the time registers asap.
+ * \param time_spec the new time
+ */
+ virtual void set_time_now(const uhd::time_spec_t &time_spec) = 0;
+
+ /*!
+ * Set the time registers at the next pps.
+ * \param time_spec the new time
+ */
+ virtual void set_time_next_pps(const uhd::time_spec_t &time_spec) = 0;
+
+ /*!
+ * Get access to the underlying uhd device object.
+ * \return the simple usrp device object
+ */
+ virtual uhd::usrp::simple_usrp::sptr get_device(void) = 0;
+};
+
+#endif /* INCLUDED_UHD_SIMPLE_SOURCE_H */
diff --git a/gr-uhd/lib/uhd_single_usrp_sink.cc b/gr-uhd/lib/uhd_single_usrp_sink.cc
new file mode 100644
index 0000000000..622f506b55
--- /dev/null
+++ b/gr-uhd/lib/uhd_single_usrp_sink.cc
@@ -0,0 +1,183 @@
+/*
+ * 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <uhd_single_usrp_sink.h>
+#include <gr_io_signature.h>
+#include <stdexcept>
+
+/***********************************************************************
+ * UHD Single USRP Sink
+ **********************************************************************/
+uhd_single_usrp_sink::uhd_single_usrp_sink(gr_io_signature_sptr sig)
+:gr_sync_block("uhd single usrp sink", sig, gr_make_io_signature(0, 0, 0)){
+ /* NOP */
+}
+
+/***********************************************************************
+ * UHD Single USRP Sink Impl
+ **********************************************************************/
+class uhd_single_usrp_sink_impl : public uhd_single_usrp_sink{
+public:
+ uhd_single_usrp_sink_impl(
+ const std::string &device_addr,
+ const uhd::io_type_t &io_type,
+ size_t num_channels
+ ):
+ uhd_single_usrp_sink(gr_make_io_signature(
+ num_channels, num_channels, io_type.size
+ )),
+ _type(io_type),
+ _nchan(num_channels)
+ {
+ _dev = uhd::usrp::single_usrp::make(device_addr);
+ }
+
+ void set_subdev_spec(const std::string &spec){
+ return _dev->set_tx_subdev_spec(spec);
+ }
+
+ void set_samp_rate(double rate){
+ _dev->set_tx_rate(rate);
+ }
+
+ double get_samp_rate(void){
+ return _dev->get_tx_rate();
+ }
+
+ uhd::tune_result_t set_center_freq(
+ const uhd::tune_request_t tune_request, size_t chan
+ ){
+ return _dev->set_tx_freq(tune_request, chan);
+ }
+
+ uhd::freq_range_t get_freq_range(size_t chan){
+ return _dev->get_tx_freq_range(chan);
+ }
+
+ void set_gain(float gain, size_t chan){
+ return _dev->set_tx_gain(gain, chan);
+ }
+
+ float get_gain(size_t chan){
+ return _dev->get_tx_gain(chan);
+ }
+
+ uhd::gain_range_t get_gain_range(size_t chan){
+ return _dev->get_tx_gain_range(chan);
+ }
+
+ void set_antenna(const std::string &ant, size_t chan){
+ return _dev->set_tx_antenna(ant, chan);
+ }
+
+ std::string get_antenna(size_t chan){
+ return _dev->get_tx_antenna(chan);
+ }
+
+ std::vector<std::string> get_antennas(size_t chan){
+ return _dev->get_tx_antennas(chan);
+ }
+
+ void set_bandwidth(double bandwidth, size_t chan){
+ return _dev->set_tx_bandwidth(bandwidth, chan);
+ }
+
+ void set_clock_config(const uhd::clock_config_t &clock_config){
+ return _dev->set_clock_config(clock_config);
+ }
+
+ uhd::time_spec_t get_time_now(void){
+ return _dev->get_time_now();
+ }
+
+ void set_time_now(const uhd::time_spec_t &time_spec){
+ return _dev->set_time_now(time_spec);
+ }
+
+ void set_time_next_pps(const uhd::time_spec_t &time_spec){
+ return _dev->set_time_next_pps(time_spec);
+ }
+
+ uhd::usrp::single_usrp::sptr get_device(void){
+ return _dev;
+ }
+
+/***********************************************************************
+ * Work
+ **********************************************************************/
+ int work(
+ int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items
+ ){
+ uhd::tx_metadata_t metadata;
+ metadata.start_of_burst = true;
+
+ return _dev->get_device()->send(
+ input_items, noutput_items, metadata,
+ _type, uhd::device::SEND_MODE_FULL_BUFF
+ );
+ }
+
+ //Send an empty start-of-burst packet to begin streaming.
+ //This is not necessary since all packets are marked SOB.
+ bool start(void){
+ uhd::tx_metadata_t metadata;
+ metadata.start_of_burst = true;
+
+ _dev->get_device()->send(
+ gr_vector_const_void_star(_nchan), 0, metadata,
+ _type, uhd::device::SEND_MODE_ONE_PACKET
+ );
+ return true;
+ }
+
+ //Send an empty end-of-burst packet to end streaming.
+ //Ending the burst avoids an underflow error on stop.
+ bool stop(void){
+ uhd::tx_metadata_t metadata;
+ metadata.end_of_burst = true;
+
+ _dev->get_device()->send(
+ gr_vector_const_void_star(_nchan), 0, metadata,
+ _type, uhd::device::SEND_MODE_ONE_PACKET
+ );
+ return true;
+ }
+
+protected:
+ uhd::usrp::single_usrp::sptr _dev;
+ const uhd::io_type_t _type;
+ size_t _nchan;
+};
+
+/***********************************************************************
+ * Make UHD Single USRP Sink
+ **********************************************************************/
+boost::shared_ptr<uhd_single_usrp_sink> uhd_make_single_usrp_sink(
+ const std::string &device_addr,
+ const uhd::io_type_t::tid_t &io_type,
+ size_t num_channels
+){
+ return boost::shared_ptr<uhd_single_usrp_sink>(
+ new uhd_single_usrp_sink_impl(device_addr, io_type, num_channels)
+ );
+}
diff --git a/gr-uhd/lib/uhd_single_usrp_sink.h b/gr-uhd/lib/uhd_single_usrp_sink.h
new file mode 100644
index 0000000000..a4c4e6452e
--- /dev/null
+++ b/gr-uhd/lib/uhd_single_usrp_sink.h
@@ -0,0 +1,173 @@
+/*
+ * 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 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_UHD_SINGLE_USRP_SINK_H
+#define INCLUDED_UHD_SINGLE_USRP_SINK_H
+
+#include <gr_sync_block.h>
+#include <uhd/usrp/single_usrp.hpp>
+
+class uhd_single_usrp_sink;
+
+boost::shared_ptr<uhd_single_usrp_sink> uhd_make_single_usrp_sink(
+ const std::string &device_addr,
+ const uhd::io_type_t::tid_t &io_type,
+ size_t num_channels = 1
+);
+
+class uhd_single_usrp_sink : public gr_sync_block{
+public:
+
+ /*!
+ * Set the IO signature for this block.
+ * \param sig the input signature
+ */
+ uhd_single_usrp_sink(gr_io_signature_sptr sig);
+
+ /*!
+ * Set the subdevice specification.
+ * \param spec the subdev spec markup string
+ */
+ virtual void set_subdev_spec(const std::string &spec) = 0;
+
+ /*!
+ * Set the sample rate for the usrp device.
+ * \param rate a new rate in Sps
+ */
+ virtual void set_samp_rate(double rate) = 0;
+
+ /*!
+ * Get the sample rate for the usrp device.
+ * This is the actual sample rate and may differ from the rate set.
+ * \return the actual rate in Sps
+ */
+ virtual double get_samp_rate(void) = 0;
+
+ /*!
+ * Tune the usrp device to the desired center frequency.
+ * \param tune_request the tune request instructions
+ * \param chan the channel index 0 to N-1
+ * \return a tune result with the actual frequencies
+ */
+ virtual uhd::tune_result_t set_center_freq(
+ const uhd::tune_request_t tune_request, size_t chan
+ ) = 0;
+
+ /*!
+ * Tune the usrp device to the desired center frequency.
+ * This is a wrapper around set center freq so that in this case,
+ * the user can pass a single frequency in the call through swig.
+ * \param freq the desired frequency in Hz
+ * \param chan the channel index 0 to N-1
+ * \return a tune result with the actual frequencies
+ */
+ uhd::tune_result_t set_center_freq(double freq, size_t chan){
+ return set_center_freq(uhd::tune_request_t(freq), chan);
+ }
+
+ /*!
+ * Get the tunable frequency range.
+ * \param chan the channel index 0 to N-1
+ * \return the frequency range in Hz
+ */
+ virtual uhd::freq_range_t get_freq_range(size_t chan = 0) = 0;
+
+ /*!
+ * Set the gain for the dboard.
+ * \param gain the gain in dB
+ * \param chan the channel index 0 to N-1
+ */
+ virtual void set_gain(float gain, size_t chan = 0) = 0;
+
+ /*!
+ * Get the actual dboard gain setting.
+ * \param chan the channel index 0 to N-1
+ * \return the actual gain in dB
+ */
+ virtual float get_gain(size_t chan = 0) = 0;
+
+ /*!
+ * Get the settable gain range.
+ * \param chan the channel index 0 to N-1
+ * \return the gain range in dB
+ */
+ virtual uhd::gain_range_t get_gain_range(size_t chan = 0) = 0;
+
+ /*!
+ * Set the antenna to use.
+ * \param ant the antenna string
+ * \param chan the channel index 0 to N-1
+ */
+ virtual void set_antenna(const std::string &ant, size_t chan = 0) = 0;
+
+ /*!
+ * Get the antenna in use.
+ * \param chan the channel index 0 to N-1
+ * \return the antenna string
+ */
+ virtual std::string get_antenna(size_t chan = 0) = 0;
+
+ /*!
+ * Get a list of possible antennas.
+ * \param chan the channel index 0 to N-1
+ * \return a vector of antenna strings
+ */
+ virtual std::vector<std::string> get_antennas(size_t chan = 0) = 0;
+
+ /*!
+ * Set the subdevice bandpass filter.
+ * \param bandwidth the filter bandwidth in Hz
+ * \param chan the channel index 0 to N-1
+ */
+ virtual void set_bandwidth(double bandwidth, size_t chan = 0) = 0;
+
+ /*!
+ * Set the clock configuration.
+ * \param clock_config the new configuration
+ */
+ virtual void set_clock_config(const uhd::clock_config_t &clock_config) = 0;
+
+ /*!
+ * Get the current time registers.
+ * \return the current usrp time
+ */
+ virtual uhd::time_spec_t get_time_now(void) = 0;
+
+ /*!
+ * Set the time registers asap.
+ * \param time_spec the new time
+ */
+ virtual void set_time_now(const uhd::time_spec_t &time_spec) = 0;
+
+ /*!
+ * Set the time registers at the next pps.
+ * \param time_spec the new time
+ */
+ virtual void set_time_next_pps(const uhd::time_spec_t &time_spec) = 0;
+
+ /*!
+ * Get access to the underlying uhd device object.
+ * \return the single usrp device object
+ */
+ virtual uhd::usrp::single_usrp::sptr get_device(void) = 0;
+};
+
+#endif /* INCLUDED_UHD_SINGLE_USRP_SINK_H */
diff --git a/gr-uhd/lib/uhd_single_usrp_source.cc b/gr-uhd/lib/uhd_single_usrp_source.cc
new file mode 100644
index 0000000000..907e8be542
--- /dev/null
+++ b/gr-uhd/lib/uhd_single_usrp_source.cc
@@ -0,0 +1,182 @@
+/*
+ * 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <uhd_single_usrp_source.h>
+#include <gr_io_signature.h>
+#include <stdexcept>
+#include <iostream>
+#include <boost/format.hpp>
+
+/***********************************************************************
+ * UHD Single USRP Source
+ **********************************************************************/
+uhd_single_usrp_source::uhd_single_usrp_source(gr_io_signature_sptr sig)
+:gr_sync_block("uhd single_usrp source", gr_make_io_signature(0, 0, 0), sig){
+ /* NOP */
+}
+
+/***********************************************************************
+ * UHD Single USRP Source Impl
+ **********************************************************************/
+class uhd_single_usrp_source_impl : public uhd_single_usrp_source{
+public:
+ uhd_single_usrp_source_impl(
+ const std::string &device_addr,
+ const uhd::io_type_t &io_type,
+ size_t num_channels
+ ):
+ uhd_single_usrp_source(gr_make_io_signature(
+ num_channels, num_channels, io_type.size
+ )),
+ _type(io_type)
+ {
+ _dev = uhd::usrp::single_usrp::make(device_addr);
+ }
+
+ void set_subdev_spec(const std::string &spec){
+ return _dev->set_rx_subdev_spec(spec);
+ }
+
+ void set_samp_rate(double rate){
+ _dev->set_rx_rate(rate);
+ }
+
+ double get_samp_rate(void){
+ return _dev->get_rx_rate();
+ }
+
+ uhd::tune_result_t set_center_freq(
+ const uhd::tune_request_t tune_request, size_t chan
+ ){
+ return _dev->set_rx_freq(tune_request, chan);
+ }
+
+ uhd::freq_range_t get_freq_range(size_t chan){
+ return _dev->get_rx_freq_range(chan);
+ }
+
+ void set_gain(float gain, size_t chan){
+ return _dev->set_rx_gain(gain, chan);
+ }
+
+ float get_gain(size_t chan){
+ return _dev->get_rx_gain(chan);
+ }
+
+ uhd::gain_range_t get_gain_range(size_t chan){
+ return _dev->get_rx_gain_range(chan);
+ }
+
+ void set_antenna(const std::string &ant, size_t chan){
+ return _dev->set_rx_antenna(ant, chan);
+ }
+
+ std::string get_antenna(size_t chan){
+ return _dev->get_rx_antenna(chan);
+ }
+
+ std::vector<std::string> get_antennas(size_t chan){
+ return _dev->get_rx_antennas(chan);
+ }
+
+ void set_bandwidth(double bandwidth, size_t chan){
+ return _dev->set_rx_bandwidth(bandwidth, chan);
+ }
+
+ void set_clock_config(const uhd::clock_config_t &clock_config){
+ return _dev->set_clock_config(clock_config);
+ }
+
+ uhd::time_spec_t get_time_now(void){
+ return _dev->get_time_now();
+ }
+
+ void set_time_now(const uhd::time_spec_t &time_spec){
+ return _dev->set_time_now(time_spec);
+ }
+
+ void set_time_next_pps(const uhd::time_spec_t &time_spec){
+ return _dev->set_time_next_pps(time_spec);
+ }
+
+ uhd::usrp::single_usrp::sptr get_device(void){
+ return _dev;
+ }
+
+/***********************************************************************
+ * Work
+ **********************************************************************/
+ int work(
+ int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items
+ ){
+ uhd::rx_metadata_t metadata; //not passed out of this block
+
+ size_t num_samps = _dev->get_device()->recv(
+ output_items, noutput_items, metadata,
+ _type, uhd::device::RECV_MODE_FULL_BUFF
+ );
+
+ switch(metadata.error_code){
+ case uhd::rx_metadata_t::ERROR_CODE_NONE:
+ return num_samps;
+
+ case uhd::rx_metadata_t::ERROR_CODE_OVERFLOW:
+ //ignore overflows and try work again
+ return work(noutput_items, input_items, output_items);
+
+ default:
+ std::cout << boost::format(
+ "UHD source block got error code 0x%x"
+ ) % metadata.error_code << std::endl;
+ return num_samps;
+ }
+ }
+
+ bool start(void){
+ _dev->issue_stream_cmd(uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS);
+ return true;
+ }
+
+ bool stop(void){
+ _dev->issue_stream_cmd(uhd::stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS);
+ return true;
+ }
+
+private:
+ uhd::usrp::single_usrp::sptr _dev;
+ const uhd::io_type_t _type;
+};
+
+
+/***********************************************************************
+ * Make UHD Single USRP Source
+ **********************************************************************/
+boost::shared_ptr<uhd_single_usrp_source> uhd_make_single_usrp_source(
+ const std::string &device_addr,
+ const uhd::io_type_t::tid_t &io_type,
+ size_t num_channels
+){
+ return boost::shared_ptr<uhd_single_usrp_source>(
+ new uhd_single_usrp_source_impl(device_addr, io_type, num_channels)
+ );
+}
diff --git a/gr-uhd/lib/uhd_single_usrp_source.h b/gr-uhd/lib/uhd_single_usrp_source.h
new file mode 100644
index 0000000000..495f8c6117
--- /dev/null
+++ b/gr-uhd/lib/uhd_single_usrp_source.h
@@ -0,0 +1,173 @@
+/*
+ * 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 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_UHD_SINGLE_USRP_SOURCE_H
+#define INCLUDED_UHD_SINGLE_USRP_SOURCE_H
+
+#include <gr_sync_block.h>
+#include <uhd/usrp/single_usrp.hpp>
+
+class uhd_single_usrp_source;
+
+boost::shared_ptr<uhd_single_usrp_source> uhd_make_single_usrp_source(
+ const std::string &device_addr,
+ const uhd::io_type_t::tid_t &io_type,
+ size_t num_channels = 1
+);
+
+class uhd_single_usrp_source : public gr_sync_block{
+public:
+
+ /*!
+ * Set the IO signature for this block.
+ * \param sig the output signature
+ */
+ uhd_single_usrp_source(gr_io_signature_sptr sig);
+
+ /*!
+ * Set the subdevice specification.
+ * \param spec the subdev spec markup string
+ */
+ virtual void set_subdev_spec(const std::string &spec) = 0;
+
+ /*!
+ * Set the sample rate for the usrp device.
+ * \param rate a new rate in Sps
+ */
+ virtual void set_samp_rate(double rate) = 0;
+
+ /*!
+ * Get the sample rate for the usrp device.
+ * This is the actual sample rate and may differ from the rate set.
+ * \return the actual rate in Sps
+ */
+ virtual double get_samp_rate(void) = 0;
+
+ /*!
+ * Tune the usrp device to the desired center frequency.
+ * \param tune_request the tune request instructions
+ * \param chan the channel index 0 to N-1
+ * \return a tune result with the actual frequencies
+ */
+ virtual uhd::tune_result_t set_center_freq(
+ const uhd::tune_request_t tune_request, size_t chan
+ ) = 0;
+
+ /*!
+ * Tune the usrp device to the desired center frequency.
+ * This is a wrapper around set center freq so that in this case,
+ * the user can pass a single frequency in the call through swig.
+ * \param freq the desired frequency in Hz
+ * \param chan the channel index 0 to N-1
+ * \return a tune result with the actual frequencies
+ */
+ uhd::tune_result_t set_center_freq(double freq, size_t chan){
+ return set_center_freq(uhd::tune_request_t(freq), chan);
+ }
+
+ /*!
+ * Get the tunable frequency range.
+ * \param chan the channel index 0 to N-1
+ * \return the frequency range in Hz
+ */
+ virtual uhd::freq_range_t get_freq_range(size_t chan = 0) = 0;
+
+ /*!
+ * Set the gain for the dboard.
+ * \param gain the gain in dB
+ * \param chan the channel index 0 to N-1
+ */
+ virtual void set_gain(float gain, size_t chan = 0) = 0;
+
+ /*!
+ * Get the actual dboard gain setting.
+ * \param chan the channel index 0 to N-1
+ * \return the actual gain in dB
+ */
+ virtual float get_gain(size_t chan = 0) = 0;
+
+ /*!
+ * Get the settable gain range.
+ * \param chan the channel index 0 to N-1
+ * \return the gain range in dB
+ */
+ virtual uhd::gain_range_t get_gain_range(size_t chan = 0) = 0;
+
+ /*!
+ * Set the antenna to use.
+ * \param ant the antenna string
+ * \param chan the channel index 0 to N-1
+ */
+ virtual void set_antenna(const std::string &ant, size_t chan = 0) = 0;
+
+ /*!
+ * Get the antenna in use.
+ * \param chan the channel index 0 to N-1
+ * \return the antenna string
+ */
+ virtual std::string get_antenna(size_t chan = 0) = 0;
+
+ /*!
+ * Get a list of possible antennas.
+ * \param chan the channel index 0 to N-1
+ * \return a vector of antenna strings
+ */
+ virtual std::vector<std::string> get_antennas(size_t chan = 0) = 0;
+
+ /*!
+ * Set the subdevice bandpass filter.
+ * \param bandwidth the filter bandwidth in Hz
+ * \param chan the channel index 0 to N-1
+ */
+ virtual void set_bandwidth(double bandwidth, size_t chan = 0) = 0;
+
+ /*!
+ * Set the clock configuration.
+ * \param clock_config the new configuration
+ */
+ virtual void set_clock_config(const uhd::clock_config_t &clock_config) = 0;
+
+ /*!
+ * Get the current time registers.
+ * \return the current usrp time
+ */
+ virtual uhd::time_spec_t get_time_now(void) = 0;
+
+ /*!
+ * Set the time registers asap.
+ * \param time_spec the new time
+ */
+ virtual void set_time_now(const uhd::time_spec_t &time_spec) = 0;
+
+ /*!
+ * Set the time registers at the next pps.
+ * \param time_spec the new time
+ */
+ virtual void set_time_next_pps(const uhd::time_spec_t &time_spec) = 0;
+
+ /*!
+ * Get access to the underlying uhd device object.
+ * \return the single usrp device object
+ */
+ virtual uhd::usrp::single_usrp::sptr get_device(void) = 0;
+};
+
+#endif /* INCLUDED_UHD_SINGLE_USRP_SOURCE_H */
diff --git a/gr-uhd/swig/.gitignore b/gr-uhd/swig/.gitignore
new file mode 100644
index 0000000000..02d25cc00d
--- /dev/null
+++ b/gr-uhd/swig/.gitignore
@@ -0,0 +1,4 @@
+/uhd_swig.cc
+/uhd_swig.py
+/Makefile
+/Makefile.in
diff --git a/gr-uhd/swig/Makefile.am b/gr-uhd/swig/Makefile.am
new file mode 100644
index 0000000000..183e6b587e
--- /dev/null
+++ b/gr-uhd/swig/Makefile.am
@@ -0,0 +1,69 @@
+#
+# 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 GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+include $(top_srcdir)/Makefile.common
+
+AM_CPPFLAGS = \
+ $(STD_DEFINES_AND_INCLUDES) \
+ $(PYTHON_CPPFLAGS) \
+ $(WITH_INCLUDES) \
+ $(UHD_CFLAGS) \
+ -I$(top_srcdir)/gr-uhd/lib
+
+if PYTHON
+# ----------------------------------------------------------------
+# The SWIG library
+# TESTS = run_tests
+
+TOP_SWIG_IFILES = \
+ uhd_swig.i
+
+# Install so that they end up available as:
+# import gnuradio.uhd
+# This ends up at:
+# ${prefix}/lib/python${python_version}/site-packages/gnuradio/uhd
+uhd_swig_pythondir_category = \
+ gnuradio/uhd
+
+# additional libraries for linking with the SWIG-generated library
+uhd_swig_la_swig_libadd = \
+ $(top_builddir)/gr-uhd/lib/libgnuradio-uhd.la
+
+# additional Python files to be installed along with the SWIG-generated one
+uhd_swig_python = \
+ __init__.py
+
+# additional SWIG files to be installed
+uhd_swig_swiginclude_headers =
+
+include $(top_srcdir)/Makefile.swig
+
+# FIXME better way to set this?
+STD_SWIG_PYTHON_ARGS += \
+ $(UHD_CFLAGS) \
+ -I$(top_srcdir)/gr-uhd/lib
+
+# add some of the variables generated inside the Makefile.swig.gen
+BUILT_SOURCES = $(swig_built_sources)
+
+# Do not distribute the output of SWIG
+no_dist_files = $(swig_built_sources)
+endif
diff --git a/gr-uhd/swig/Makefile.swig.gen b/gr-uhd/swig/Makefile.swig.gen
new file mode 100644
index 0000000000..3804461a4e
--- /dev/null
+++ b/gr-uhd/swig/Makefile.swig.gen
@@ -0,0 +1,259 @@
+# -*- 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 uhd_swig.i
+
+## Default install locations for these files:
+##
+## Default location for the Python directory is:
+## ${prefix}/lib/python${python_version}/site-packages/[category]/uhd_swig
+## Default location for the Python exec directory is:
+## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/uhd_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.
+
+uhd_swig_pythondir_category ?= gnuradio/uhd_swig
+uhd_swig_pylibdir_category ?= $(uhd_swig_pythondir_category)
+uhd_swig_pythondir = $(pythondir)/$(uhd_swig_pythondir_category)
+uhd_swig_pylibdir = $(pyexecdir)/$(uhd_swig_pylibdir_category)
+
+## SWIG headers are always installed into the same directory.
+
+uhd_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 >
+
+## Stamps used to ensure parallel make does the right thing. These
+## are removed by "make clean", but otherwise unused except during the
+## parallel built. These will not be included in a tarball, because
+## the SWIG-generated files will be removed from the distribution.
+
+STAMPS += $(DEPDIR)/uhd_swig-generate-*
+
+## Other cleaned files: dependency files generated by SWIG or this Makefile
+
+MOSTLYCLEANFILES += $(DEPDIR)/*.S*
+
+## Add the .py and .cc files to the list of SWIG built sources. The
+## .h file is sometimes built, but not always ... so that one has to
+## be added manually by the including Makefile.am .
+
+swig_built_sources += uhd_swig.py uhd_swig.cc
+
+## Various SWIG variables. These can be overloaded in the including
+## Makefile.am by setting the variable value there, then including
+## Makefile.swig .
+
+uhd_swig_swiginclude_HEADERS = \
+ uhd_swig.i \
+ $(uhd_swig_swiginclude_headers)
+
+uhd_swig_pylib_LTLIBRARIES = \
+ _uhd_swig.la
+
+_uhd_swig_la_SOURCES = \
+ uhd_swig.cc \
+ $(uhd_swig_la_swig_sources)
+
+_uhd_swig_la_LIBADD = \
+ $(STD_SWIG_LA_LIB_ADD) \
+ $(uhd_swig_la_swig_libadd)
+
+_uhd_swig_la_LDFLAGS = \
+ $(STD_SWIG_LA_LD_FLAGS) \
+ $(uhd_swig_la_swig_ldflags)
+
+_uhd_swig_la_CXXFLAGS = \
+ $(STD_SWIG_CXX_FLAGS) \
+ $(uhd_swig_la_swig_cxxflags)
+
+uhd_swig_python_PYTHON = \
+ uhd_swig.py \
+ $(uhd_swig_python)
+
+## Entry rule for running SWIG
+
+uhd_swig.h uhd_swig.py uhd_swig.cc: uhd_swig.i
+## This rule will get called only when MAKE decides that one of the
+## targets needs to be created or re-created, because:
+##
+## * The .i file is newer than any or all of the generated files;
+##
+## * Any or all of the .cc, .h, or .py files does not exist and is
+## needed (in the case this file is not needed, the rule for it is
+## ignored); or
+##
+## * Some SWIG-based dependecy of the .cc file isn't met and hence the
+## .cc file needs be be regenerated. Explanation: Because MAKE
+## knows how to handle dependencies for .cc files (regardless of
+## their name or extension), then the .cc file is used as a target
+## instead of the .i file -- but with the dependencies of the .i
+## file. It is this last reason why the line:
+##
+## if test -f $@; then :; else
+##
+## cannot be used in this case: If a .i file dependecy is not met,
+## then the .cc file needs to be rebuilt. But if the stamp is newer
+## than the .cc file, and the .cc file exists, then in the original
+## version (with the 'test' above) the internal MAKE call will not
+## be issued and hence the .cc file will not be rebuilt.
+##
+## Once execution gets to here, it should always proceed no matter the
+## state of a stamp (as discussed in link above). The
+## $(DEPDIR)/uhd_swig-generate stuff is used to allow for parallel
+## builds to "do the right thing". The stamp has no relationship with
+## either the target files or dependency file; it is used solely for
+## the protection of multiple builds during a given call to MAKE.
+##
+## Catch signals SIGHUP (1), SIGINT (2), SIGPIPE (13), and SIGTERM
+## (15). At a caught signal, the quoted command will be issued before
+## exiting. In this case, remove any stamp, whether temporary of not.
+## The trap is valid until the process exits; the process includes all
+## commands appended via "\"s.
+##
+ trap 'rm -rf $(DEPDIR)/uhd_swig-generate-*' 1 2 13 15; \
+##
+## Create a temporary directory, which acts as a lock. The first
+## process to create the directory will succeed and issue the MAKE
+## command to do the actual work, while all subsequent processes will
+## fail -- leading them to wait for the first process to finish.
+##
+ if mkdir $(DEPDIR)/uhd_swig-generate-lock 2>/dev/null; then \
+##
+## This code is being executed by the first process to succeed in
+## creating the directory lock.
+##
+## Remove the stamp associated with this filename.
+##
+ rm -f $(DEPDIR)/uhd_swig-generate-stamp; \
+##
+## Tell MAKE to run the rule for creating this stamp.
+##
+ $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/uhd_swig-generate-stamp WHAT=$<; \
+##
+## Now that the .cc, .h, and .py files have been (re)created from the
+## .i file, future checking of this rule during the same MAKE
+## execution will come back that the rule doesn't need to be executed
+## because none of the conditions mentioned at the start of this rule
+## will be positive. Remove the the directory lock, which frees up
+## any waiting process(es) to continue.
+##
+ rmdir $(DEPDIR)/uhd_swig-generate-lock; \
+ else \
+##
+## This code is being executed by any follower processes while the
+## directory lock is in place.
+##
+## Wait until the first process is done, testing once per second.
+##
+ while test -d $(DEPDIR)/uhd_swig-generate-lock; do \
+ sleep 1; \
+ done; \
+##
+## Succeed if and only if the first process succeeded; exit this
+## process returning the status of the generated stamp.
+##
+ test -f $(DEPDIR)/uhd_swig-generate-stamp; \
+ exit $$?; \
+ fi;
+
+$(DEPDIR)/uhd_swig-generate-stamp:
+## This rule will be called only by the first process issuing the
+## above rule to succeed in creating the lock directory, after
+## removing the actual stamp file in order to guarantee that MAKE will
+## execute this rule.
+##
+## Call SWIG to generate the various output files; special
+## post-processing on 'mingw32' host OS for the dependency file.
+##
+ if $(SWIG) $(STD_SWIG_PYTHON_ARGS) $(uhd_swig_swig_args) \
+ -MD -MF $(DEPDIR)/uhd_swig.Std \
+ -module uhd_swig -o uhd_swig.cc $(WHAT); then \
+ if test $(host_os) = mingw32; then \
+ $(RM) $(DEPDIR)/uhd_swig.Sd; \
+ $(SED) 's,\\\\,/,g' < $(DEPDIR)/uhd_swig.Std \
+ > $(DEPDIR)/uhd_swig.Sd; \
+ $(RM) $(DEPDIR)/uhd_swig.Std; \
+ $(MV) $(DEPDIR)/uhd_swig.Sd $(DEPDIR)/uhd_swig.Std; \
+ fi; \
+ else \
+ $(RM) $(DEPDIR)/uhd_swig.S*; exit 1; \
+ fi;
+##
+## Mess with the SWIG output .Std dependency file, to create a
+## dependecy file valid for the input .i file: Basically, simulate the
+## dependency file created for libraries by GNU's libtool for C++,
+## where all of the dependencies for the target are first listed, then
+## each individual dependency is listed as a target with no further
+## dependencies.
+##
+## (1) remove the current dependency file
+##
+ $(RM) $(DEPDIR)/uhd_swig.d
+##
+## (2) Copy the whole SWIG file:
+##
+ cp $(DEPDIR)/uhd_swig.Std $(DEPDIR)/uhd_swig.d
+##
+## (3) all a carriage return to the end of the dependency file.
+##
+ echo "" >> $(DEPDIR)/uhd_swig.d
+##
+## (4) from the SWIG file, remove the first line (the target); remove
+## trailing " \" and " " from each line. Append ":" to each line,
+## followed by 2 carriage returns, then append this to the end of
+## the dependency file.
+##
+ $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/uhd_swig.Std | \
+ awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/uhd_swig.d
+##
+## (5) remove the SWIG-generated file
+##
+ $(RM) $(DEPDIR)/uhd_swig.Std
+##
+## Create the stamp for this filename generation, to signal success in
+## executing this rule; allows other threads waiting on this process
+## to continue.
+##
+ touch $(DEPDIR)/uhd_swig-generate-stamp
+
+# KLUDGE: Force runtime include of a SWIG dependency file. This is
+# not guaranteed to be portable, but will probably work. If it works,
+# we have accurate dependencies for our swig stuff, which is good.
+
+@am__include@ @am__quote@./$(DEPDIR)/uhd_swig.d@am__quote@
+
diff --git a/gr-uhd/swig/__init__.py b/gr-uhd/swig/__init__.py
new file mode 100644
index 0000000000..0fdacb796c
--- /dev/null
+++ b/gr-uhd/swig/__init__.py
@@ -0,0 +1,40 @@
+#
+# 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 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 uhd_swig import *
+
+########################################################################
+# Add other content from pure-Python modules here
+########################################################################
+
+class tune_request_t(tune_request_t, float):
+ """
+ Make the python tune request object inherit from float
+ so that it can be passed in GRC as a frequency parameter.
+ The type checking in GRC will accept the tune request.
+ """
+ def __new__(self, *args): return float.__new__(self)
+ def __float__(self): return self.target_freq
diff --git a/gr-uhd/swig/uhd_swig.i b/gr-uhd/swig/uhd_swig.i
new file mode 100644
index 0000000000..d332bb6171
--- /dev/null
+++ b/gr-uhd/swig/uhd_swig.i
@@ -0,0 +1,111 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2010 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+////////////////////////////////////////////////////////////////////////
+// Language independent exception handler
+////////////////////////////////////////////////////////////////////////
+%include exception.i
+
+%exception {
+ try {
+ $action
+ }
+ catch(std::exception &e) {
+ SWIG_exception(SWIG_RuntimeError, e.what());
+ }
+ catch(...) {
+ SWIG_exception(SWIG_RuntimeError, "Unknown exception");
+ }
+
+}
+
+////////////////////////////////////////////////////////////////////////
+// standard includes
+////////////////////////////////////////////////////////////////////////
+%include "gnuradio.i"
+%include "std_string.i"
+%include "std_vector.i"
+
+namespace std {
+ %template(StringVector) vector<string>;
+}
+
+////////////////////////////////////////////////////////////////////////
+// block headers
+////////////////////////////////////////////////////////////////////////
+%{
+#include <uhd_mimo_source.h> //deprecated
+#include <uhd_mimo_sink.h> //deprecated
+#include <uhd_simple_source.h> //deprecated
+#include <uhd_simple_sink.h> //deprecated
+
+#include <uhd_multi_usrp_source.h>
+#include <uhd_multi_usrp_sink.h>
+#include <uhd_single_usrp_source.h>
+#include <uhd_single_usrp_sink.h>
+%}
+
+////////////////////////////////////////////////////////////////////////
+// used types
+////////////////////////////////////////////////////////////////////////
+%include <uhd/config.hpp>
+%include <uhd/types/ranges.hpp>
+%include <uhd/types/tune_request.hpp>
+%include <uhd/types/tune_result.hpp>
+%include <uhd/types/io_type.hpp>
+%include <uhd/types/time_spec.hpp>
+%include <uhd/types/clock_config.hpp>
+
+////////////////////////////////////////////////////////////////////////
+// block magic
+////////////////////////////////////////////////////////////////////////
+GR_SWIG_BLOCK_MAGIC(uhd,mimo_source) //deprecated
+%include <uhd_mimo_source.h> //deprecated
+
+GR_SWIG_BLOCK_MAGIC(uhd,mimo_sink) //deprecated
+%include <uhd_mimo_sink.h> //deprecated
+
+GR_SWIG_BLOCK_MAGIC(uhd,simple_source) //deprecated
+%include <uhd_simple_source.h> //deprecated
+
+GR_SWIG_BLOCK_MAGIC(uhd,simple_sink) //deprecated
+%include <uhd_simple_sink.h> //deprecated
+
+GR_SWIG_BLOCK_MAGIC(uhd,multi_usrp_source)
+%include <uhd_multi_usrp_source.h>
+
+GR_SWIG_BLOCK_MAGIC(uhd,multi_usrp_sink)
+%include <uhd_multi_usrp_sink.h>
+
+GR_SWIG_BLOCK_MAGIC(uhd,single_usrp_source)
+%include <uhd_single_usrp_source.h>
+
+GR_SWIG_BLOCK_MAGIC(uhd,single_usrp_sink)
+%include <uhd_single_usrp_sink.h>
+
+////////////////////////////////////////////////////////////////////////
+// helpful constants
+////////////////////////////////////////////////////////////////////////
+%{
+static const size_t ALL_MBOARDS = uhd::usrp::multi_usrp::ALL_MBOARDS;
+%}
+static const size_t ALL_MBOARDS;
diff --git a/grc/base/Param.py b/grc/base/Param.py
index e56eac36e1..5cd0f9d6d8 100644
--- a/grc/base/Param.py
+++ b/grc/base/Param.py
@@ -94,7 +94,7 @@ class Param(Element):
try: assert set(opt_keys) == set(option.get_opt_keys())
except AssertionError: raise Exception, 'Opt keys "%s" are not identical across all options.'%opt_keys
#if a value is specified, it must be in the options keys
- self._value = value or self.get_option_keys()[0]
+ self._value = value if value or value in self.get_option_keys() else self.get_option_keys()[0]
try: assert self.get_value() in self.get_option_keys()
except AssertionError: raise Exception, 'The value "%s" is not in the possible values of "%s".'%(self.get_value(), self.get_option_keys())
else: self._value = value or ''
diff --git a/grc/python/Generator.py b/grc/python/Generator.py
index acd98ef841..d53802bef8 100644
--- a/grc/python/Generator.py
+++ b/grc/python/Generator.py
@@ -58,7 +58,7 @@ class Generator(object):
def write(self):
#do throttle warning
all_keys = ' '.join(map(lambda b: b.get_key(), self._flow_graph.get_enabled_blocks()))
- if ('usrp' not in all_keys) and ('audio' not in all_keys) and ('throttle' not in all_keys) and self._generate_options != 'hb':
+ if ('usrp' not in all_keys) and ('uhd' not in all_keys) and ('audio' not in all_keys) and ('throttle' not in all_keys) and self._generate_options != 'hb':
Messages.send_warning('''\
This flow graph may not have flow control: no audio or usrp blocks found. \
Add a Misc->Throttle block to your flow graph to avoid CPU congestion.''')
diff --git a/version.sh b/version.sh
index 70d6d74f92..0ae0409824 100644
--- a/version.sh
+++ b/version.sh
@@ -1,4 +1,4 @@
MAJOR_VERSION=3
-API_COMPAT=3
-MINOR_VERSION=1
-MAINT_VERSION=git
+API_COMPAT=4
+MINOR_VERSION=git
+MAINT_VERSION=
diff --git a/vrt/README b/vrt/README
new file mode 100644
index 0000000000..97719d412f
--- /dev/null
+++ b/vrt/README
@@ -0,0 +1,10 @@
+The vrt code has been temporarily moved to Eric's Out-of-Tree repository,
+pending the "Grand Build System Reorganization".
+
+To grab the code and build it:
+
+ $ git clone git://gnuradio.org/eb-oot
+
+ $ cd eb-oot/vrt
+ $ ./bootstrap && ./configure
+ $ make && make check && make install