summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config/grc_gr_uhd.m47
-rw-r--r--config/usrp_libusb.m4168
-rw-r--r--gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc11
-rw-r--r--gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.cc2
-rw-r--r--gnuradio-core/src/lib/filter/gr_sincos.c4
-rw-r--r--gnuradio-core/src/lib/filter/gr_single_pole_iir.h6
-rw-r--r--gnuradio-core/src/lib/general/Makefile.am15
-rw-r--r--gnuradio-core/src/lib/general/general.i6
-rw-r--r--gnuradio-core/src/lib/general/gr_annotator_1to1.cc107
-rw-r--r--gnuradio-core/src/lib/general/gr_annotator_1to1.h74
-rw-r--r--gnuradio-core/src/lib/general/gr_annotator_1to1.i36
-rw-r--r--gnuradio-core/src/lib/general/gr_annotator_alltoall.cc110
-rw-r--r--gnuradio-core/src/lib/general/gr_annotator_alltoall.h75
-rw-r--r--gnuradio-core/src/lib/general/gr_annotator_alltoall.i36
-rw-r--r--gnuradio-core/src/lib/general/gr_burst_tagger.cc83
-rw-r--r--gnuradio-core/src/lib/general/gr_burst_tagger.h56
-rw-r--r--gnuradio-core/src/lib/general/gr_burst_tagger.i31
-rw-r--r--gnuradio-core/src/lib/general/gr_circular_file.cc7
-rw-r--r--gnuradio-core/src/lib/general/gr_float_to_complex.cc4
-rw-r--r--gnuradio-core/src/lib/general/gr_keep_one_in_n.cc5
-rw-r--r--gnuradio-core/src/lib/general/gr_skiphead.cc8
-rw-r--r--gnuradio-core/src/lib/general/gr_skiphead.h10
-rw-r--r--gnuradio-core/src/lib/general/gr_skiphead.i8
-rw-r--r--gnuradio-core/src/lib/gengen/gr_add_XX.cc.t2
-rw-r--r--gnuradio-core/src/lib/gengen/gr_divide_XX.cc.t4
-rw-r--r--gnuradio-core/src/lib/gengen/gr_multiply_XX.cc.t2
-rw-r--r--gnuradio-core/src/lib/gengen/gr_sub_XX.cc.t4
-rw-r--r--gnuradio-core/src/lib/io/Makefile.am9
-rw-r--r--gnuradio-core/src/lib/io/gr_tagged_file_sink.cc212
-rw-r--r--gnuradio-core/src/lib/io/gr_tagged_file_sink.h70
-rw-r--r--gnuradio-core/src/lib/io/gr_tagged_file_sink.i35
-rw-r--r--gnuradio-core/src/lib/io/io.i3
-rw-r--r--gnuradio-core/src/lib/runtime/Makefile.am8
-rw-r--r--gnuradio-core/src/lib/runtime/gr_block.cc68
-rw-r--r--gnuradio-core/src/lib/runtime/gr_block.h85
-rw-r--r--gnuradio-core/src/lib/runtime/gr_block.i3
-rw-r--r--gnuradio-core/src/lib/runtime/gr_block_detail.cc92
-rw-r--r--gnuradio-core/src/lib/runtime/gr_block_detail.h73
-rw-r--r--gnuradio-core/src/lib/runtime/gr_block_executor.cc87
-rw-r--r--gnuradio-core/src/lib/runtime/gr_block_executor.h3
-rw-r--r--gnuradio-core/src/lib/runtime/gr_buffer.cc71
-rw-r--r--gnuradio-core/src/lib/runtime/gr_buffer.h50
-rw-r--r--gnuradio-core/src/lib/runtime/gr_flat_flowgraph.cc7
-rw-r--r--gnuradio-core/src/lib/runtime/gr_preferences.cc24
-rw-r--r--gnuradio-core/src/lib/runtime/gr_tag_info.cc38
-rw-r--r--gnuradio-core/src/lib/runtime/gr_tag_info.h87
-rw-r--r--gnuradio-core/src/lib/runtime/qa_block_tags.cc450
-rw-r--r--gnuradio-core/src/lib/runtime/qa_block_tags.h52
-rw-r--r--gnuradio-core/src/lib/runtime/qa_runtime.cc2
-rw-r--r--gnuradio-core/src/lib/swig/gnuradio.i2
-rw-r--r--gnuradio-core/src/python/gnuradio/blks2impl/pfb_arb_resampler.py11
-rwxr-xr-xgnuradio-examples/python/pfb/resampler.py95
-rwxr-xr-xgnuradio-examples/python/tags/test_file_tags.py29
-rwxr-xr-xgnuradio-examples/python/tags/uhd_burst_detector.py98
-rw-r--r--gr-audio-jack/src/audio_jack_sink.cc13
-rw-r--r--gr-audio-jack/src/audio_jack_source.cc7
-rw-r--r--gr-audio-portaudio/src/audio_portaudio_sink.cc5
-rw-r--r--gr-audio-portaudio/src/audio_portaudio_source.cc5
-rw-r--r--gr-msdd6000/src/msdd_rs_source_simple.cc5
-rw-r--r--gr-msdd6000/src/msdd_source_simple.cc4
-rw-r--r--gr-trellis/src/lib/fsm.cc20
-rw-r--r--gr-trellis/src/lib/interleaver.cc13
-rw-r--r--gr-uhd/grc/Makefile.am7
-rw-r--r--gr-uhd/grc/uhd_block_tree.xml7
-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/Makefile.am17
-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_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_source.h4
-rw-r--r--gr-uhd/swig/Makefile.am7
-rw-r--r--gr-uhd/swig/uhd_swig.i17
-rwxr-xr-xgr-utils/src/python/gr_plot_psd.py17
-rw-r--r--usrp/doc/Doxyfile.in67
82 files changed, 2614 insertions, 2792 deletions
diff --git a/config/grc_gr_uhd.m4 b/config/grc_gr_uhd.m4
index 090187c04..00892867d 100644
--- a/config/grc_gr_uhd.m4
+++ b/config/grc_gr_uhd.m4
@@ -26,10 +26,11 @@ AC_DEFUN([GRC_GR_UHD],[
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])]
+ [UHD], [uhd >= 1.0.0 uhd < 2.0.0], [],
+ [passed=no; AC_MSG_RESULT([gr-uhd requires libuhd 1.x.x])]
)
- AC_SUBST(UHD_CFLAGS)
+ UHD_CPPFLAGS="${UHD_CPPFLAGS} -I\${abs_top_srcdir}/gr-uhd/lib"
+ AC_SUBST(UHD_CPPFLAGS)
AC_SUBST(UHD_LIBS)
fi
diff --git a/config/usrp_libusb.m4 b/config/usrp_libusb.m4
index a434d379d..cc3410f41 100644
--- a/config/usrp_libusb.m4
+++ b/config/usrp_libusb.m4
@@ -24,28 +24,43 @@ dnl Boston, MA 02110-1301, USA.
AC_DEFUN([USRP_LIBUSB], [
- dnl Use PKGCONFIG to check for packages first, then check to
- dnl make sure the USB_* variables work (whether from PKGCONFIG
- dnl or overridden by the user)
-
- dnl do not use LDFLAGS, since PKGCONFIG will provide everything
+ dnl do not use LDFLAGS, except on Windows
saved_LDFLAGS=${LDFLAGS}
- LDFLAGS=
- LIBUSB_PKG_CONFIG_NAME=
+ case "$host_os" in
+ cygwin* | mingw*)
+ ;;
+ *)
+ LDFLAGS=
+ ;;
+ esac
- dnl loop over various possible 'libusb' PKGCONFIG names, and choose
- dnl the first one that meets both the user's selection (via
- dnl configure flags) as well as what is installed
+ dnl this variable is set in usrp/usrp.pc.in as a requirement
+ dnl for libusrp; it is OK to be empty.
+ LIBUSB_PKG_CONFIG_NAME=
- dnl create the list of libusb PKGCONFIG modules to test
+ dnl for Windows (cygin, mingw), do not use PKGCONFIG since LIBUSB
+ dnl does not install a .pc file. For all other OSs, use
+ dnl PKGCONFIG to check for various package names first.
libusb_list=''
- if test x$1 = xyes; then
- dnl libusb-1.0 was requested; just test for it
- libusb_list="libusb-1.0"
- else
- dnl test for legacy libusb only
- libusb_list="libusb libusb-legacy"
- fi
+ case "$host_os" in
+ cygwin* | mingw*)
+ libusb_list='libusb'
+ ;;
+ *)
+ dnl create the list of libusb PKGCONFIG modules to test
+ if test x$1 = xyes; then
+ dnl libusb-1.0 was requested; just test for it
+ libusb_list="libusb-1.0"
+ else
+ dnl test for legacy libusb only
+ libusb_list="libusb libusb-legacy"
+ fi
+ ;;
+ esac
+
+ dnl loop over various possible 'libusb' names, and
+ dnl choose the first one that meets both the user's selection
+ dnl (via configure flags) as well as what is installed
for libusb_name in ${libusb_list}; do
dnl clear internal variables
libusbok=no
@@ -54,31 +69,45 @@ AC_DEFUN([USRP_LIBUSB], [
usb_lib_func=''
usb_lib_name=''
- dnl start checks
- AC_MSG_NOTICE([Checking for LIBUSB version '${libusb_name}'])
- if test ${libusb_name} = "libusb-1.0"; then
- dnl see if the pkgconfig module is available
- PKG_CHECK_MODULES(USB, ${libusb_name}, [
- libusbok=yes
- have_libusb1=yes
- usb_header='libusb-1.0/libusb.h'
- usb_lib_func='libusb_bulk_transfer'
- ], [libusbok=no])
- else
- dnl see if the pkgconfig module is available
- PKG_CHECK_MODULES(USB, ${libusb_name}, [
- libusbok=yes
+ case "$host_os" in
+ cygwin* | mingw*)
+ USB_INCLUDEDIR=
+ USB_INCLUDES=
+ USB_LIBS=-lusb
usb_header='usb.h'
usb_lib_func='usb_bulk_write'
- ], [libusbok=no])
- fi
+ libusbok=yes
+ ;;
+ *)
+ dnl start checks
+ AC_MSG_NOTICE([Checking for LIBUSB version '${libusb_name}'])
+ if test ${libusb_name} = "libusb-1.0"; then
+ dnl see if the pkgconfig module is available
+ PKG_CHECK_MODULES(USB, ${libusb_name}, [
+ libusbok=yes
+ have_libusb1=yes
+ usb_header='libusb-1.0/libusb.h'
+ usb_lib_func='libusb_bulk_transfer'
+ ], [libusbok=no])
+ else
+ dnl see if the pkgconfig module is available
+ PKG_CHECK_MODULES(USB, ${libusb_name}, [
+ libusbok=yes
+ usb_header='usb.h'
+ usb_lib_func='usb_bulk_write'
+ ], [libusbok=no])
+ fi
+ ;;
+ esac
if test $libusbok = yes; then
- dnl PKGCONFIG found a version of LIBUSB.
+ dnl PKGCONFIG found a version of LIBUSB, or the info was
+ dnl provided by the user, or the OS is Windows.
+
dnl Check it to make sure it meets enough criteria:
dnl Verify that $usb_header is a valid header. If so, then
dnl verify that $usb_lib_func can be found in the library
dnl $usb_lib_name. if so, verify that the symbol 'usb_debug' is
- dnl found in the library.
+ dnl found in the library if not using Windows.
dnl Check for the header. Similar to AC_CHECK_HEADERS,
dnl but doesn't append to known \#defines.
@@ -135,28 +164,43 @@ AC_DEFUN([USRP_LIBUSB], [
if test $libusbok = yes; then
if test ${libusb_name} != "libusb-1.0"; then
dnl PKGCONFIG found a legacy version of libusb; make sure the
- dnl variable _usb_debug is available in the found library
- AC_LANG_PUSH(C)
- save_CPPFLAGS="$CPPFLAGS"
- CPPFLAGS="$USB_INCLUDES"
- save_LIBS="$LIBS"
- LIBS="$USB_LIBS"
- AC_MSG_CHECKING([$libusb_name for symbol usb_debug in library $usb_lib_name])
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[
- extern int usb_debug;]],
- [[usb_debug = 0;]])],
- [libusbok=yes],[libusbok=no])
- AC_MSG_RESULT([$libusbok])
- LIBS="$save_LIBS"
- CPPFLAGS="$save_CPPFLAGS"
- AC_LANG_POP(C)
+ dnl variable _usb_debug is available in the found library.
+ dnl Do not test on Windows, since that symbol is not defined.
+ case "$host_os" in
+ cygwin* | mingw*)
+ ;;
+ *)
+ AC_LANG_PUSH(C)
+ save_CPPFLAGS="$CPPFLAGS"
+ if test x$USB_INCLUDEDIR != x; then
+ CPPFLAGS="$USB_INCLUDES"
+ fi
+ save_LIBS="$LIBS"
+ LIBS="$USB_LIBS"
+ AC_MSG_CHECKING([$libusb_name for symbol usb_debug in library $usb_lib_name])
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[
+ extern int usb_debug;]],
+ [[usb_debug = 0;]])],
+ [libusbok=yes],[libusbok=no])
+ AC_MSG_RESULT([$libusbok])
+ LIBS="$save_LIBS"
+ CPPFLAGS="$save_CPPFLAGS"
+ AC_LANG_POP(C)
+ ;;
+ esac
fi
fi
fi
fi
dnl if everything checks out OK, finish up
if test $libusbok = yes; then
- LIBUSB_PKG_CONFIG_NAME="${libusb_name}"
+ case "$host_os" in
+ cygwin* | mingw*)
+ ;;
+ *)
+ LIBUSB_PKG_CONFIG_NAME="${libusb_name}"
+ ;;
+ esac
break
else
dnl something wasn't found in this LIBUSB version.
@@ -173,7 +217,9 @@ AC_DEFUN([USRP_LIBUSB], [
dnl final error checking, mostly to create #define's
AC_LANG_PUSH(C)
save_CPPFLAGS="$CPPFLAGS"
- CPPFLAGS="$USB_INCLUDES"
+ if test x$USB_INCLUDEDIR != x; then
+ CPPFLAGS="$USB_INCLUDES"
+ fi
dnl Check for the header.
AC_CHECK_HEADERS([$usb_header], [], [libusbok=no])
CPPFLAGS="$save_CPPFLAGS"
@@ -185,18 +231,20 @@ AC_DEFUN([USRP_LIBUSB], [
dnl check for the library (again)
AC_LANG_PUSH(C)
save_CPPFLAGS="$CPPFLAGS"
- CPPFLAGS="$USB_INCLUDES"
+ if test x$USB_INCLUDEDIR != x; then
+ CPPFLAGS="$USB_INCLUDES"
+ fi
save_LIBS="$LIBS"
LIBS="$USB_LIBS"
AC_CHECK_LIB([$usb_lib_name], [$usb_lib_func], [], [
libusbok=no
AC_MSG_RESULT([USRP requires library '$usb_lib_name' with function '$usb_lib_func', which was either not found or was not usable. See http://www.libusb.org])])
- case "$host_os" in
- cygwin* | mingw*)
- USB_LIBS="$LIBS"
- ;;
- *) ;;
- esac
+# case "$host_os" in
+# cygwin* | mingw*)
+# USB_LIBS="$LIBS"
+# ;;
+# *) ;;
+# esac
LIBS="$save_LIBS"
CPPFLAGS="$save_CPPFLAGS"
AC_LANG_POP(C)
diff --git a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc
index 399632003..59b76a6f0 100644
--- a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc
+++ b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc
@@ -71,7 +71,7 @@ gr_pfb_arb_resampler_ccf::gr_pfb_arb_resampler_ccf (float rate,
// Create an FIR filter for each channel and zero out the taps
std::vector<float> vtaps(0, d_int_rate);
- for(int i = 0; i < d_int_rate; i++) {
+ for(unsigned int i = 0; i < d_int_rate; i++) {
d_filters[i] = gr_fir_util::create_gr_fir_ccf(vtaps);
d_diff_filters[i] = gr_fir_util::create_gr_fir_ccf(vtaps);
}
@@ -97,8 +97,6 @@ gr_pfb_arb_resampler_ccf::create_taps (const std::vector<float> &newtaps,
std::vector< std::vector<float> > &ourtaps,
std::vector<gr_fir_ccf*> &ourfilter)
{
- int i,j;
-
unsigned int ntaps = newtaps.size();
d_taps_per_filter = (unsigned int)ceil((double)ntaps/(double)d_int_rate);
@@ -114,10 +112,10 @@ gr_pfb_arb_resampler_ccf::create_taps (const std::vector<float> &newtaps,
}
// Partition the filter
- for(i = 0; i < d_int_rate; i++) {
+ for(unsigned int i = 0; i < d_int_rate; i++) {
// Each channel uses all d_taps_per_filter with 0's if not enough taps to fill out
ourtaps[d_int_rate-1-i] = std::vector<float>(d_taps_per_filter, 0);
- for(j = 0; j < d_taps_per_filter; j++) {
+ for(unsigned int j = 0; j < d_taps_per_filter; j++) {
ourtaps[d_int_rate - 1 - i][j] = tmp_taps[i + j*d_int_rate];
}
@@ -173,7 +171,8 @@ gr_pfb_arb_resampler_ccf::general_work (int noutput_items,
return 0; // history requirements may have changed.
}
- int i = 0, j, count = d_start_index;
+ int i = 0, count = d_start_index;
+ unsigned int j;
gr_complex o0, o1;
// Restore the last filter position
diff --git a/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.cc b/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.cc
index 8a0ad1c4c..e20bc38bb 100644
--- a/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.cc
+++ b/gnuradio-core/src/lib/filter/gr_pfb_interpolator_ccf.cc
@@ -132,7 +132,7 @@ gr_pfb_interpolator_ccf::work (int noutput_items,
int i = 0, count = 0;
while(i < noutput_items) {
- for(int j = 0; j < d_rate; j++) {
+ for(unsigned int j = 0; j < d_rate; j++) {
out[i] = d_filters[j]->filter(&in[count]);
i++;
}
diff --git a/gnuradio-core/src/lib/filter/gr_sincos.c b/gnuradio-core/src/lib/filter/gr_sincos.c
index 240a84852..57b26b22f 100644
--- a/gnuradio-core/src/lib/filter/gr_sincos.c
+++ b/gnuradio-core/src/lib/filter/gr_sincos.c
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -24,7 +24,9 @@
#include "config.h"
#endif
+#ifndef _GNU_SOURCE
#define _GNU_SOURCE // ask for GNU extensions if available
+#endif
#include <gr_sincos.h>
#include <math.h>
diff --git a/gnuradio-core/src/lib/filter/gr_single_pole_iir.h b/gnuradio-core/src/lib/filter/gr_single_pole_iir.h
index bd59e53ac..da919b35c 100644
--- a/gnuradio-core/src/lib/filter/gr_single_pole_iir.h
+++ b/gnuradio-core/src/lib/filter/gr_single_pole_iir.h
@@ -71,12 +71,12 @@ public:
d_prev_output = 0;
}
- tap_type prev_output () { return d_prev_output; }
+ o_type prev_output () { return d_prev_output; }
protected:
tap_type d_alpha;
tap_type d_one_minus_alpha;
- tap_type d_prev_output;
+ o_type d_prev_output;
};
@@ -87,7 +87,7 @@ template<class o_type, class i_type, class tap_type>
o_type
gr_single_pole_iir<o_type, i_type, tap_type>::filter (const i_type input)
{
- tap_type output;
+ o_type output;
output = d_alpha * input + d_one_minus_alpha * d_prev_output;
d_prev_output = output;
diff --git a/gnuradio-core/src/lib/general/Makefile.am b/gnuradio-core/src/lib/general/Makefile.am
index b25326deb..c6440506d 100644
--- a/gnuradio-core/src/lib/general/Makefile.am
+++ b/gnuradio-core/src/lib/general/Makefile.am
@@ -176,7 +176,10 @@ libgeneral_la_SOURCES = \
gr_descrambler_bb.cc \
gr_scrambler_bb.cc \
gr_probe_mpsk_snr_c.cc \
- gr_probe_density_b.cc
+ gr_probe_density_b.cc \
+ gr_annotator_alltoall.cc \
+ gr_annotator_1to1.cc \
+ gr_burst_tagger.cc
libgeneral_qa_la_SOURCES = \
qa_general.cc \
@@ -346,7 +349,10 @@ grinclude_HEADERS = \
gr_descrambler_bb.h \
gr_scrambler_bb.h \
gr_probe_mpsk_snr_c.h \
- gr_probe_density_b.h
+ gr_probe_density_b.h \
+ gr_annotator_alltoall.h \
+ gr_annotator_1to1.h \
+ gr_burst_tagger.h
noinst_HEADERS = \
qa_general.h \
@@ -487,5 +493,8 @@ swiginclude_HEADERS = \
gr_descrambler_bb.i \
gr_scrambler_bb.i \
gr_probe_mpsk_snr_c.i \
- gr_probe_density_b.i
+ gr_probe_density_b.i \
+ gr_annotator_alltoall.i \
+ gr_annotator_1to1.i \
+ gr_burst_tagger.i
endif
diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i
index 2c86a6240..fb9c4c0f2 100644
--- a/gnuradio-core/src/lib/general/general.i
+++ b/gnuradio-core/src/lib/general/general.i
@@ -142,6 +142,9 @@
#include <gr_fll_band_edge_cc.h>
#include <gr_additive_scrambler_bb.h>
#include <complex_vec_test.h>
+#include <gr_annotator_alltoall.h>
+#include <gr_annotator_1to1.h>
+#include <gr_burst_tagger.h>
%}
%include "gr_nop.i"
@@ -264,3 +267,6 @@
%include "gr_fll_band_edge_cc.i"
%include "gr_additive_scrambler_bb.i"
%include "complex_vec_test.i"
+%include "gr_annotator_alltoall.i"
+%include "gr_annotator_1to1.i"
+%include "gr_burst_tagger.i"
diff --git a/gnuradio-core/src/lib/general/gr_annotator_1to1.cc b/gnuradio-core/src/lib/general/gr_annotator_1to1.cc
new file mode 100644
index 000000000..511b356e5
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_annotator_1to1.cc
@@ -0,0 +1,107 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_annotator_1to1.h>
+#include <gr_io_signature.h>
+#include <string.h>
+#include <iostream>
+#include <iomanip>
+
+gr_annotator_1to1_sptr
+gr_make_annotator_1to1 (int when, size_t sizeof_stream_item)
+{
+ return gnuradio::get_initial_sptr (new gr_annotator_1to1
+ (when, sizeof_stream_item));
+}
+
+gr_annotator_1to1::gr_annotator_1to1 (int when, size_t sizeof_stream_item)
+ : gr_sync_block ("annotator_1to1",
+ gr_make_io_signature (1, -1, sizeof_stream_item),
+ gr_make_io_signature (1, -1, sizeof_stream_item)),
+ d_itemsize(sizeof_stream_item), d_when((uint64_t)when)
+{
+ set_tag_propagation_policy(TPP_ONE_TO_ONE);
+
+ d_tag_counter = 0;
+ set_relative_rate(1.0);
+}
+
+gr_annotator_1to1::~gr_annotator_1to1 ()
+{
+}
+
+int
+gr_annotator_1to1::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const float *in = (const float*)input_items[0];
+ float *out = (float*)output_items[0];
+
+ std::stringstream str;
+ str << name() << unique_id();
+
+ uint64_t abs_N = 0;
+ int ninputs = input_items.size();
+ for(int i = 0; i < ninputs; i++) {
+ abs_N = nitems_read(i);
+
+ std::vector<pmt::pmt_t> all_tags;
+ get_tags_in_range(all_tags, i, abs_N, abs_N + noutput_items);
+
+ std::vector<pmt::pmt_t>::iterator itr;
+ for(itr = all_tags.begin(); itr != all_tags.end(); itr++) {
+ d_stored_tags.push_back(*itr);
+ }
+ }
+
+ // Storing the current noutput_items as the value to the "noutput_items" key
+ pmt::pmt_t srcid = pmt::pmt_string_to_symbol(str.str());
+ pmt::pmt_t key = pmt::pmt_string_to_symbol("seq");
+
+ // Work does nothing to the data stream; just copy all inputs to outputs
+ // Adds a new tag when the number of items read is a multiple of d_when
+ abs_N = nitems_read(0);
+ int noutputs = output_items.size();
+ for(int j = 0; j < noutput_items; j++) {
+ // the min() is a hack to make sure this doesn't segfault if there are a
+ // different number of ins and outs. This is specifically designed to test
+ // the 1-to-1 propagation policy.
+ for(int i = 0; i < std::min(noutputs, ninputs); i++) {
+ if(abs_N % d_when == 0) {
+ pmt::pmt_t value = pmt::pmt_from_uint64(d_tag_counter++);
+ add_item_tag(i, abs_N, key, value, srcid);
+ }
+
+ in = (const float*)input_items[i];
+ out = (float*)output_items[i];
+ out[j] = in[j];
+ }
+ abs_N++;
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_annotator_1to1.h b/gnuradio-core/src/lib/general/gr_annotator_1to1.h
new file mode 100644
index 000000000..4abc5b051
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_annotator_1to1.h
@@ -0,0 +1,74 @@
+/* -*- 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_GR_ANNOTATOR_1TO1_H
+#define INCLUDED_GR_ANNOTATOR_1TO1_H
+
+#include <gr_sync_block.h>
+
+class gr_annotator_1to1;
+typedef boost::shared_ptr<gr_annotator_1to1> gr_annotator_1to1_sptr;
+
+// public constructor
+gr_annotator_1to1_sptr
+gr_make_annotator_1to1 (int when, size_t sizeof_stream_item);
+
+/*!
+ * \brief 1-to-1 stream annotator testing block. FOR TESTING PURPOSES ONLY.
+ *
+ * This block creates tags to be sent downstream every 10,000 items it sees. The
+ * tags contain the name and ID of the instantiated block, use "seq" as a key,
+ * and have a counter that increments by 1 for every tag produced that is used
+ * as the tag's value. The tags are propagated using the 1-to-1 policy.
+ *
+ * It also stores a copy of all tags it sees flow past it. These tags can be
+ * recalled externally with the data() member.
+ *
+ * This block is only meant for testing and showing how to use the tags.
+ */
+class gr_annotator_1to1 : public gr_sync_block
+{
+ public:
+ ~gr_annotator_1to1 ();
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ std::vector<pmt::pmt_t> data() const
+ {
+ return d_stored_tags;
+ }
+
+protected:
+ gr_annotator_1to1 (int when, size_t sizeof_stream_item);
+
+ private:
+ size_t d_itemsize;
+ uint64_t d_when;
+ uint64_t d_tag_counter;
+ std::vector<pmt::pmt_t> d_stored_tags;
+
+ friend gr_annotator_1to1_sptr
+ gr_make_annotator_1to1 (int when, size_t sizeof_stream_item);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/general/gr_annotator_1to1.i b/gnuradio-core/src/lib/general/gr_annotator_1to1.i
new file mode 100644
index 000000000..f29ecbf53
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_annotator_1to1.i
@@ -0,0 +1,36 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,annotator_1to1);
+
+gr_annotator_1to1_sptr gr_make_annotator_1to1 (int when,
+ size_t sizeof_stream_item);
+
+class gr_annotator_1to1 : public gr_sync_block
+{
+public:
+ std::vector<pmt::pmt_t> data() const;
+
+private:
+ gr_annotator_1to1 (int when, size_t sizeof_stream_item);
+};
+
diff --git a/gnuradio-core/src/lib/general/gr_annotator_alltoall.cc b/gnuradio-core/src/lib/general/gr_annotator_alltoall.cc
new file mode 100644
index 000000000..344fd088b
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_annotator_alltoall.cc
@@ -0,0 +1,110 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_annotator_alltoall.h>
+#include <gr_io_signature.h>
+#include <string.h>
+#include <iostream>
+#include <iomanip>
+
+gr_annotator_alltoall_sptr
+gr_make_annotator_alltoall (int when, size_t sizeof_stream_item)
+{
+ return gnuradio::get_initial_sptr (new gr_annotator_alltoall
+ (when, sizeof_stream_item));
+}
+
+gr_annotator_alltoall::gr_annotator_alltoall (int when,
+ size_t sizeof_stream_item)
+ : gr_sync_block ("annotator_alltoall",
+ gr_make_io_signature (1, -1, sizeof_stream_item),
+ gr_make_io_signature (1, -1, sizeof_stream_item)),
+ d_itemsize(sizeof_stream_item), d_when((uint64_t)when)
+{
+ set_tag_propagation_policy(TPP_ALL_TO_ALL);
+
+ d_tag_counter = 0;
+}
+
+gr_annotator_alltoall::~gr_annotator_alltoall ()
+{
+}
+
+int
+gr_annotator_alltoall::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const float *in = (const float *) input_items[0];
+ float *out = (float *) output_items[0];
+
+ std::stringstream str;
+ str << name() << unique_id();
+
+ uint64_t abs_N = 0, end_N;
+ int ninputs = input_items.size();
+ for(int i = 0; i < ninputs; i++) {
+ abs_N = nitems_read(i);
+ end_N = abs_N + (uint64_t)(noutput_items);
+
+ std::vector<pmt::pmt_t> all_tags;
+ get_tags_in_range(all_tags, i, abs_N, end_N);
+
+ std::vector<pmt::pmt_t>::iterator itr;
+ for(itr = all_tags.begin(); itr != all_tags.end(); itr++) {
+ d_stored_tags.push_back(*itr);
+ }
+ }
+
+ // Source ID and key for any tag that might get applied from this block
+ pmt::pmt_t srcid = pmt::pmt_string_to_symbol(str.str());
+ pmt::pmt_t key = pmt::pmt_string_to_symbol("seq");
+
+ // Work does nothing to the data stream; just copy all inputs to outputs
+ // Adds a new tag when the number of items read is a multiple of d_when
+ abs_N = nitems_written(0);
+ int noutputs = output_items.size();
+
+ for(int j = 0; j < noutput_items; j++) {
+ for(int i = 0; i < noutputs; i++) {
+ if(abs_N % d_when == 0) {
+ pmt::pmt_t value = pmt::pmt_from_uint64(d_tag_counter++);
+ add_item_tag(i, abs_N, key, value, srcid);
+ }
+
+ // Sum all of the inputs together for each output. Just 'cause.
+ out = (float*)output_items[i];
+ out[j] = 0;
+ for(int ins = 0; ins < ninputs; ins++) {
+ in = (const float*)input_items[ins];
+ out[j] += in[j];
+ }
+ }
+ abs_N++;
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_annotator_alltoall.h b/gnuradio-core/src/lib/general/gr_annotator_alltoall.h
new file mode 100644
index 000000000..e1e51ebf3
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_annotator_alltoall.h
@@ -0,0 +1,75 @@
+/* -*- 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_GR_ANNOTATOR_ALLTOALL_H
+#define INCLUDED_GR_ANNOTATOR_ALLTOALL_H
+
+#include <gr_sync_block.h>
+
+class gr_annotator_alltoall;
+typedef boost::shared_ptr<gr_annotator_alltoall> gr_annotator_alltoall_sptr;
+
+// public constructor
+gr_annotator_alltoall_sptr
+gr_make_annotator_alltoall (int when, size_t sizeof_stream_item);
+
+/*!
+ * \brief All-to-all stream annotator testing block. FOR TESTING PURPOSES ONLY.
+ *
+ * This block creates tags to be sent downstream every 10,000 items it sees. The
+ * tags contain the name and ID of the instantiated block, use "seq" as a key,
+ * and have a counter that increments by 1 for every tag produced that is used
+ * as the tag's value. The tags are propagated using the all-to-all policy.
+ *
+ * It also stores a copy of all tags it sees flow past it. These tags can be
+ * recalled externally with the data() member.
+ *
+ * This block is only meant for testing and showing how to use the tags.
+ */
+class gr_annotator_alltoall : public gr_sync_block
+{
+ public:
+ ~gr_annotator_alltoall ();
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ std::vector<pmt::pmt_t> data() const
+ {
+ return d_stored_tags;
+ }
+
+protected:
+ gr_annotator_alltoall (int when, size_t sizeof_stream_item);
+
+ private:
+ size_t d_itemsize;
+ uint64_t d_when;
+ uint64_t d_tag_counter;
+ std::vector<pmt::pmt_t> d_stored_tags;
+
+ friend gr_annotator_alltoall_sptr
+ gr_make_annotator_alltoall (int when, size_t sizeof_stream_item);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/general/gr_annotator_alltoall.i b/gnuradio-core/src/lib/general/gr_annotator_alltoall.i
new file mode 100644
index 000000000..f9bf6dd9a
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_annotator_alltoall.i
@@ -0,0 +1,36 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,annotator_alltoall);
+
+gr_annotator_alltoall_sptr gr_make_annotator_alltoall (int when,
+ size_t sizeof_stream_item);
+
+class gr_annotator_alltoall : public gr_sync_block
+{
+public:
+ std::vector<pmt::pmt_t> data() const;
+
+private:
+ gr_annotator_alltoall (int when, size_t sizeof_stream_item);
+};
+
diff --git a/gnuradio-core/src/lib/general/gr_burst_tagger.cc b/gnuradio-core/src/lib/general/gr_burst_tagger.cc
new file mode 100644
index 000000000..4b3847b08
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_burst_tagger.cc
@@ -0,0 +1,83 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_burst_tagger.h>
+#include <gr_io_signature.h>
+#include <string.h>
+
+gr_burst_tagger_sptr
+gr_make_burst_tagger(size_t itemsize)
+{
+ return gnuradio::get_initial_sptr(new gr_burst_tagger(itemsize));
+}
+
+gr_burst_tagger::gr_burst_tagger(size_t itemsize)
+ : gr_sync_block ("burst_tagger",
+ gr_make_io_signature2 (2, 2, itemsize, sizeof(short)),
+ gr_make_io_signature (1, 1, itemsize)),
+ d_itemsize(itemsize), d_state(false)
+{
+ std::stringstream str;
+ str << name() << unique_id();
+
+ d_key = pmt::pmt_string_to_symbol("burst");
+ d_id = pmt::pmt_string_to_symbol(str.str());
+}
+
+gr_burst_tagger::~gr_burst_tagger()
+{
+}
+
+int
+gr_burst_tagger::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ const char *signal = (const char*)input_items[0];
+ const short *trigger = (const short*)input_items[1];
+ char *out = (char*)output_items[0];
+
+ memcpy(out, signal, noutput_items * d_itemsize);
+
+ for(int i = 0; i < noutput_items; i++) {
+ if(trigger[i] > 0) {
+ if(d_state == false) {
+ d_state = true;
+ pmt::pmt_t value = pmt::PMT_T;
+ add_item_tag(0, nitems_written(0)+i, d_key, value, d_id);
+ }
+ }
+ else {
+ if(d_state == true) {
+ d_state = false;
+ pmt::pmt_t value = pmt::PMT_F;
+ add_item_tag(0, nitems_written(0)+i, d_key, value, d_id);
+ }
+ }
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/general/gr_burst_tagger.h b/gnuradio-core/src/lib/general/gr_burst_tagger.h
new file mode 100644
index 000000000..8f814bea0
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_burst_tagger.h
@@ -0,0 +1,56 @@
+/* -*- 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_GR_BURST_TAGGER_H
+#define INCLUDED_GR_BURST_TAGGER_H
+
+#include <gr_sync_block.h>
+
+class gr_burst_tagger;
+typedef boost::shared_ptr<gr_burst_tagger> gr_burst_tagger_sptr;
+
+gr_burst_tagger_sptr gr_make_burst_tagger(size_t itemsize);
+
+/*!
+ * \brief output[i] = input[i]
+ * \ingroup misc_blk
+ *
+ */
+class gr_burst_tagger : public gr_sync_block
+{
+ size_t d_itemsize;
+ bool d_state;
+ pmt::pmt_t d_key;
+ pmt::pmt_t d_id;
+
+ friend gr_burst_tagger_sptr gr_make_burst_tagger(size_t itemsize);
+ gr_burst_tagger(size_t itemsize);
+
+ public:
+ ~gr_burst_tagger();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif
diff --git a/gnuradio-core/src/lib/general/gr_burst_tagger.i b/gnuradio-core/src/lib/general/gr_burst_tagger.i
new file mode 100644
index 000000000..ebf1eea8c
--- /dev/null
+++ b/gnuradio-core/src/lib/general/gr_burst_tagger.i
@@ -0,0 +1,31 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,burst_tagger)
+
+gr_burst_tagger_sptr gr_make_burst_tagger(size_t itemsize);
+
+class gr_burst_tagger : public gr_sync_block
+{
+ private:
+ gr_burst_tagger(size_t itemsize);
+};
diff --git a/gnuradio-core/src/lib/general/gr_circular_file.cc b/gnuradio-core/src/lib/general/gr_circular_file.cc
index 468b49a10..c9222597a 100644
--- a/gnuradio-core/src/lib/general/gr_circular_file.cc
+++ b/gnuradio-core/src/lib/general/gr_circular_file.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2002 Free Software Foundation, Inc.
+ * Copyright 2002,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -66,7 +66,10 @@ gr_circular_file::gr_circular_file (const char *filename,
exit (1);
}
#ifdef HAVE_MMAP /* FIXME */
- ftruncate (d_fd, size + HEADER_SIZE);
+ if(ftruncate (d_fd, size + HEADER_SIZE) != 0) {
+ perror (filename);
+ exit (1);
+ }
#endif
}
else {
diff --git a/gnuradio-core/src/lib/general/gr_float_to_complex.cc b/gnuradio-core/src/lib/general/gr_float_to_complex.cc
index 89ef18869..a392abd06 100644
--- a/gnuradio-core/src/lib/general/gr_float_to_complex.cc
+++ b/gnuradio-core/src/lib/general/gr_float_to_complex.cc
@@ -52,12 +52,12 @@ gr_float_to_complex::work (int noutput_items,
switch (input_items.size ()){
case 1:
- for (int j = 0; j < noutput_items*d_vlen; j++)
+ for (size_t j = 0; j < noutput_items*d_vlen; j++)
out[j] = gr_complex (r[j], 0);
break;
case 2:
- for (int j = 0; j < noutput_items*d_vlen; j++)
+ for (size_t j = 0; j < noutput_items*d_vlen; j++)
out[j] = gr_complex (r[j], i[j]);
break;
diff --git a/gnuradio-core/src/lib/general/gr_keep_one_in_n.cc b/gnuradio-core/src/lib/general/gr_keep_one_in_n.cc
index c07e177fe..85495e277 100644
--- a/gnuradio-core/src/lib/general/gr_keep_one_in_n.cc
+++ b/gnuradio-core/src/lib/general/gr_keep_one_in_n.cc
@@ -38,8 +38,9 @@ gr_keep_one_in_n::gr_keep_one_in_n (size_t item_size, int n)
: gr_block ("keep_one_in_n",
gr_make_io_signature (1, 1, item_size),
gr_make_io_signature (1, 1, item_size)),
- d_n (n), d_count(n)
+ d_count(n)
{
+ set_n(n);
}
void
@@ -50,6 +51,8 @@ gr_keep_one_in_n::set_n(int n)
d_n = n;
d_count = n;
+
+ set_relative_rate(1.0 / (float)n);
}
int
diff --git a/gnuradio-core/src/lib/general/gr_skiphead.cc b/gnuradio-core/src/lib/general/gr_skiphead.cc
index ea7e9405f..1670eb7cf 100644
--- a/gnuradio-core/src/lib/general/gr_skiphead.cc
+++ b/gnuradio-core/src/lib/general/gr_skiphead.cc
@@ -27,7 +27,7 @@
#include <gr_io_signature.h>
#include <string.h>
-gr_skiphead::gr_skiphead (size_t itemsize, size_t nitems_to_skip)
+gr_skiphead::gr_skiphead (size_t itemsize, uint64_t nitems_to_skip)
: gr_block ("skiphead",
gr_make_io_signature(1, 1, itemsize),
gr_make_io_signature(1, 1, itemsize)),
@@ -36,7 +36,7 @@ gr_skiphead::gr_skiphead (size_t itemsize, size_t nitems_to_skip)
}
gr_skiphead_sptr
-gr_make_skiphead (size_t itemsize, size_t nitems_to_skip)
+gr_make_skiphead (size_t itemsize, uint64_t nitems_to_skip)
{
return gnuradio::get_initial_sptr(new gr_skiphead (itemsize, nitems_to_skip));
}
@@ -55,11 +55,11 @@ gr_skiphead::general_work(int noutput_items,
while (ii < ninput_items){
- long long ni_total = ii + d_nitems; // total items processed so far
+ uint64_t ni_total = ii + d_nitems; // total items processed so far
if (ni_total < d_nitems_to_skip){ // need to skip some more
int n_to_skip = (int) std::min(d_nitems_to_skip - ni_total,
- (long long)(ninput_items - ii));
+ (uint64_t)(ninput_items - ii));
ii += n_to_skip;
}
diff --git a/gnuradio-core/src/lib/general/gr_skiphead.h b/gnuradio-core/src/lib/general/gr_skiphead.h
index 965feff9b..933c126e3 100644
--- a/gnuradio-core/src/lib/general/gr_skiphead.h
+++ b/gnuradio-core/src/lib/general/gr_skiphead.h
@@ -39,11 +39,11 @@ typedef boost::shared_ptr<gr_skiphead> gr_skiphead_sptr;
class gr_skiphead : public gr_block
{
- friend gr_skiphead_sptr gr_make_skiphead (size_t itemsize, size_t nitems_to_skip);
- gr_skiphead (size_t itemsize, size_t nitems_to_skip);
+ friend gr_skiphead_sptr gr_make_skiphead (size_t itemsize, uint64_t nitems_to_skip);
+ gr_skiphead (size_t itemsize, uint64_t nitems_to_skip);
- long long d_nitems_to_skip;
- long long d_nitems; // total items seen
+ uint64_t d_nitems_to_skip;
+ uint64_t d_nitems; // total items seen
public:
@@ -54,7 +54,7 @@ class gr_skiphead : public gr_block
};
gr_skiphead_sptr
-gr_make_skiphead (size_t itemsize, size_t nitems_to_skip);
+gr_make_skiphead (size_t itemsize, uint64_t nitems_to_skip);
#endif /* INCLUDED_GR_SKIPHEAD_H */
diff --git a/gnuradio-core/src/lib/general/gr_skiphead.i b/gnuradio-core/src/lib/general/gr_skiphead.i
index 52c0808f0..45cbd0437 100644
--- a/gnuradio-core/src/lib/general/gr_skiphead.i
+++ b/gnuradio-core/src/lib/general/gr_skiphead.i
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2005,2007 Free Software Foundation, Inc.
+ * Copyright 2005,2007,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -22,9 +22,9 @@
GR_SWIG_BLOCK_MAGIC(gr,skiphead);
-gr_skiphead_sptr gr_make_skiphead (size_t itemsize, size_t nitems_to_skip);
+gr_skiphead_sptr gr_make_skiphead (size_t itemsize, uint64_t nitems_to_skip);
class gr_skiphead : public gr_block {
- friend gr_skiphead_sptr gr_make_skiphead (size_t itemsize, size_t nitems_to_skip);
- gr_skiphead (size_t itemsize, size_t nitems_to_skip);
+ friend gr_skiphead_sptr gr_make_skiphead (size_t itemsize, uint64_t nitems_to_skip);
+ gr_skiphead (size_t itemsize, uint64_t nitems_to_skip);
};
diff --git a/gnuradio-core/src/lib/gengen/gr_add_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_add_XX.cc.t
index 58a25325a..0e8b23ee1 100644
--- a/gnuradio-core/src/lib/gengen/gr_add_XX.cc.t
+++ b/gnuradio-core/src/lib/gengen/gr_add_XX.cc.t
@@ -52,7 +52,7 @@ int
int ninputs = input_items.size ();
- for (int i = 0; i < noutput_items*d_vlen; i++){
+ for (size_t i = 0; i < noutput_items*d_vlen; i++){
@I_TYPE@ acc = ((@I_TYPE@ *) input_items[0])[i];
for (int j = 1; j < ninputs; j++)
acc += ((@I_TYPE@ *) input_items[j])[i];
diff --git a/gnuradio-core/src/lib/gengen/gr_divide_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_divide_XX.cc.t
index 1200145fa..ea245b57b 100644
--- a/gnuradio-core/src/lib/gengen/gr_divide_XX.cc.t
+++ b/gnuradio-core/src/lib/gengen/gr_divide_XX.cc.t
@@ -53,13 +53,13 @@ int
int ninputs = input_items.size ();
if (ninputs == 1){ // compute reciprocal
- for (int i = 0; i < noutput_items*d_vlen; i++)
+ for (size_t i = 0; i < noutput_items*d_vlen; i++)
*optr++ = (@O_TYPE@) ((@O_TYPE@) 1 /
((@I_TYPE@ *) input_items[0])[i]);
}
else {
- for (int i = 0; i < noutput_items*d_vlen; i++){
+ for (size_t i = 0; i < noutput_items*d_vlen; i++){
@I_TYPE@ acc = ((@I_TYPE@ *) input_items[0])[i];
for (int j = 1; j < ninputs; j++)
acc /= ((@I_TYPE@ *) input_items[j])[i];
diff --git a/gnuradio-core/src/lib/gengen/gr_multiply_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_multiply_XX.cc.t
index 13ec0c8b3..5d270c763 100644
--- a/gnuradio-core/src/lib/gengen/gr_multiply_XX.cc.t
+++ b/gnuradio-core/src/lib/gengen/gr_multiply_XX.cc.t
@@ -52,7 +52,7 @@ int
int ninputs = input_items.size ();
- for (int i = 0; i < noutput_items*d_vlen; i++){
+ for (size_t i = 0; i < noutput_items*d_vlen; i++){
@I_TYPE@ acc = ((@I_TYPE@ *) input_items[0])[i];
for (int j = 1; j < ninputs; j++)
acc *= ((@I_TYPE@ *) input_items[j])[i];
diff --git a/gnuradio-core/src/lib/gengen/gr_sub_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_sub_XX.cc.t
index f0ed75217..1dcdf81ad 100644
--- a/gnuradio-core/src/lib/gengen/gr_sub_XX.cc.t
+++ b/gnuradio-core/src/lib/gengen/gr_sub_XX.cc.t
@@ -53,12 +53,12 @@ int
int ninputs = input_items.size ();
if (ninputs == 1){ // negate
- for (int i = 0; i < noutput_items*d_vlen; i++)
+ for (size_t i = 0; i < noutput_items*d_vlen; i++)
*optr++ = (@O_TYPE@) -((@I_TYPE@ *) input_items[0])[i];
}
else {
- for (int i = 0; i < noutput_items*d_vlen; i++){
+ for (size_t i = 0; i < noutput_items*d_vlen; i++){
@I_TYPE@ acc = ((@I_TYPE@ *) input_items[0])[i];
for (int j = 1; j < ninputs; j++)
acc -= ((@I_TYPE@ *) input_items[j])[i];
diff --git a/gnuradio-core/src/lib/io/Makefile.am b/gnuradio-core/src/lib/io/Makefile.am
index c52554645..8ce740afd 100644
--- a/gnuradio-core/src/lib/io/Makefile.am
+++ b/gnuradio-core/src/lib/io/Makefile.am
@@ -56,7 +56,8 @@ libio_la_SOURCES = \
gr_udp_source.cc \
gr_wavfile_sink.cc \
gr_wavfile_source.cc \
- gri_wavfile.cc
+ gri_wavfile.cc \
+ gr_tagged_file_sink.cc
grinclude_HEADERS = \
gr_file_sink.h \
@@ -89,7 +90,8 @@ grinclude_HEADERS = \
gr_udp_source.h \
gr_wavfile_source.h \
gr_wavfile_sink.h \
- gri_wavfile.h
+ gri_wavfile.h \
+ gr_tagged_file_sink.h
if PYTHON
swiginclude_HEADERS = \
@@ -111,5 +113,6 @@ swiginclude_HEADERS = \
gr_udp_sink.i \
gr_udp_source.i \
gr_wavfile_source.i \
- gr_wavfile_sink.i
+ gr_wavfile_sink.i \
+ gr_tagged_file_sink.i
endif
diff --git a/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc b/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc
new file mode 100644
index 000000000..c76ede542
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_tagged_file_sink.cc
@@ -0,0 +1,212 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gr_tagged_file_sink.h>
+#include <gr_io_signature.h>
+#include <cstdio>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdexcept>
+#include <iostream>
+#include <gr_tag_info.h>
+
+#ifdef O_BINARY
+#define OUR_O_BINARY O_BINARY
+#else
+#define OUR_O_BINARY 0
+#endif
+
+// should be handled via configure
+#ifdef O_LARGEFILE
+#define OUR_O_LARGEFILE O_LARGEFILE
+#else
+#define OUR_O_LARGEFILE 0
+#endif
+
+
+gr_tagged_file_sink::gr_tagged_file_sink (size_t itemsize, double samp_rate)
+ : gr_sync_block ("tagged_file_sink",
+ gr_make_io_signature (1, 1, itemsize),
+ gr_make_io_signature (0, 0, 0)),
+ d_itemsize (itemsize), d_n(0), d_sample_rate(samp_rate)
+{
+ d_state = NOT_IN_BURST;
+ d_last_N = 0;
+ d_timeval = 0;
+}
+
+gr_tagged_file_sink_sptr
+gr_make_tagged_file_sink (size_t itemsize, double samp_rate)
+{
+ return gnuradio::get_initial_sptr(new gr_tagged_file_sink (itemsize, samp_rate));
+}
+
+gr_tagged_file_sink::~gr_tagged_file_sink ()
+{
+}
+
+int
+gr_tagged_file_sink::work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ char *inbuf = (char *) input_items[0];
+
+ uint64_t start_N = nitems_read(0);
+ uint64_t end_N = start_N + (uint64_t)(noutput_items);
+ pmt::pmt_t bkey = pmt::pmt_string_to_symbol("burst");
+ //pmt::pmt_t tkey = pmt::pmt_string_to_symbol("time"); // use gr_tags::key_time
+
+ std::vector<pmt::pmt_t> all_tags;
+ get_tags_in_range(all_tags, 0, start_N, end_N);
+
+ std::sort(all_tags.begin(), all_tags.end(), gr_tags::nitems_compare);
+
+ std::vector<pmt::pmt_t>::iterator vitr = all_tags.begin();
+
+ int idx = 0, idx_stop = 0;
+ while(idx < noutput_items) {
+ if(d_state == NOT_IN_BURST) {
+ while(vitr != all_tags.end()) {
+ if((pmt::pmt_eqv(gr_tags::get_key(*vitr), bkey)) &&
+ pmt::pmt_is_true(gr_tags::get_value(*vitr))) {
+
+ uint64_t N = gr_tags::get_nitems(*vitr);
+ idx = (int)(N - start_N);
+
+ //std::cout << std::endl << "Found start of burst: "
+ // << idx << ", " << N << std::endl;
+
+ // Find time burst occurred by getting latest time tag and extrapolating
+ // to new time based on sample rate of this block.
+ std::vector<pmt::pmt_t> time_tags;
+ //get_tags_in_range(time_tags, 0, d_last_N, N, gr_tags::key_time);
+ get_tags_in_range(time_tags, 0, d_last_N, N,
+ pmt::pmt_string_to_symbol("time"));
+ if(time_tags.size() > 0) {
+ pmt::pmt_t tag = time_tags[time_tags.size()-1];
+
+ uint64_t time_nitems = gr_tags::get_nitems(tag);
+
+ // Get time based on last time tag from USRP
+ pmt::pmt_t time = gr_tags::get_value(tag);
+ int tsecs = pmt::pmt_to_long(pmt::pmt_tuple_ref(time, 0));
+ double tfrac = pmt::pmt_to_double(pmt::pmt_tuple_ref(time, 1));
+
+ // Get new time from last time tag + difference in time to when
+ // burst tag occured based on the sample rate
+ double delta = (double)(N - time_nitems) / d_sample_rate;
+ d_timeval = (double)tsecs + tfrac + delta;
+
+ //std::cout.setf(std::ios::fixed, std::ios::floatfield);
+ //std::cout.precision(8);
+ //std::cout << "Time found: " << (double)tsecs + tfrac << std::endl;
+ //std::cout << " time: " << d_timeval << std::endl;
+ //std::cout << " time at N = " << time_nitems << " burst N = " << N << std::endl;
+ }
+ else {
+ // if no time tag, use last seen tag and update time based on
+ // sample rate of the block
+ d_timeval += (double)(N - d_last_N) / d_sample_rate;
+ //std::cout << "Time not found" << std::endl;
+ //std::cout << " time: " << d_timeval << std::endl;
+ }
+ d_last_N = N;
+
+ std::stringstream filename;
+ filename.setf(std::ios::fixed, std::ios::floatfield);
+ filename.precision(8);
+ filename << "file" << d_n << "_" << d_timeval << ".dat";
+ d_n++;
+
+ int fd;
+ if ((fd = ::open (filename.str().c_str(),
+ O_WRONLY|O_CREAT|O_TRUNC|OUR_O_LARGEFILE|OUR_O_BINARY,
+ 0664)) < 0){
+ perror (filename.str().c_str());
+ return -1;
+ }
+
+ // FIXME:
+ //if ((d_handle = fdopen (fd, d_is_binary ? "wb" : "w")) == NULL){
+ if ((d_handle = fdopen (fd, "wb")) == NULL){
+ perror (filename.str().c_str());
+ ::close(fd); // don't leak file descriptor if fdopen fails.
+ }
+
+ //std::cout << "Created new file: " << filename.str() << std::endl;
+
+ d_state = IN_BURST;
+ break;
+ }
+
+ vitr++;
+ }
+ if(d_state == NOT_IN_BURST)
+ return noutput_items;
+ }
+ else { // In burst
+ while(vitr != all_tags.end()) {
+ if((pmt::pmt_eqv(gr_tags::get_key(*vitr), bkey)) &&
+ pmt::pmt_is_false(gr_tags::get_value(*vitr))) {
+ uint64_t N = gr_tags::get_nitems(*vitr);
+ idx_stop = (int)N - start_N;
+
+ //std::cout << "Found end of burst: "
+ // << idx_stop << ", " << N << std::endl;
+
+ int count = fwrite (&inbuf[d_itemsize*idx], d_itemsize, idx_stop-idx, d_handle);
+ if (count == 0) {
+ if(ferror(d_handle)) {
+ perror("gr_tagged_file_sink: error writing file");
+ }
+ }
+ idx = idx_stop;
+ d_state = NOT_IN_BURST;
+ vitr++;
+ fclose(d_handle);
+ break;
+ }
+ else {
+ vitr++;
+ }
+ }
+ if(d_state == IN_BURST) {
+ int count = fwrite (&inbuf[idx], d_itemsize, noutput_items-idx, d_handle);
+ if (count == 0) {
+ if(ferror(d_handle)) {
+ perror("gr_tagged_file_sink: error writing file");
+ }
+ }
+ idx = noutput_items;
+ }
+ }
+ }
+
+ return noutput_items;
+}
diff --git a/gnuradio-core/src/lib/io/gr_tagged_file_sink.h b/gnuradio-core/src/lib/io/gr_tagged_file_sink.h
new file mode 100644
index 000000000..956340f8d
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_tagged_file_sink.h
@@ -0,0 +1,70 @@
+/* -*- 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_GR_TAGGED_FILE_SINK_H
+#define INCLUDED_GR_TAGGED_FILE_SINK_H
+
+#include <gr_sync_block.h>
+
+class gr_tagged_file_sink;
+typedef boost::shared_ptr<gr_tagged_file_sink> gr_tagged_file_sink_sptr;
+
+gr_tagged_file_sink_sptr gr_make_tagged_file_sink (size_t itemsize,
+ double samp_rate);
+
+/*!
+ * \brief Write stream to file descriptor.
+ * \ingroup sink_blk
+ */
+
+class gr_tagged_file_sink : public gr_sync_block
+{
+ friend gr_tagged_file_sink_sptr gr_make_tagged_file_sink (size_t itemsize,
+ double samp_rate);
+
+ private:
+ enum {
+ NOT_IN_BURST = 0,
+ IN_BURST
+ };
+
+ size_t d_itemsize;
+ int d_state;
+ FILE *d_handle;
+ int d_n;
+ double d_sample_rate;
+ uint64_t d_last_N;
+ double d_timeval;
+
+ protected:
+ gr_tagged_file_sink (size_t itemsize, double samp_rate);
+
+ public:
+ ~gr_tagged_file_sink ();
+
+ int work (int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+
+#endif /* INCLUDED_GR_TAGGED_FILE_SINK_H */
diff --git a/gnuradio-core/src/lib/io/gr_tagged_file_sink.i b/gnuradio-core/src/lib/io/gr_tagged_file_sink.i
new file mode 100644
index 000000000..1408adfc1
--- /dev/null
+++ b/gnuradio-core/src/lib/io/gr_tagged_file_sink.i
@@ -0,0 +1,35 @@
+/* -*- 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.
+ */
+
+GR_SWIG_BLOCK_MAGIC(gr,tagged_file_sink)
+
+gr_tagged_file_sink_sptr
+gr_make_tagged_file_sink (size_t itemsize, double samp_rate);
+
+class gr_tagged_file_sink : public gr_sync_block
+{
+ protected:
+ gr_tagged_file_sink (size_t itemsize, double samp_rate);
+
+ public:
+ ~gr_tagged_file_sink ();
+};
diff --git a/gnuradio-core/src/lib/io/io.i b/gnuradio-core/src/lib/io/io.i
index 3538942ca..365577cd4 100644
--- a/gnuradio-core/src/lib/io/io.i
+++ b/gnuradio-core/src/lib/io/io.i
@@ -43,7 +43,7 @@
#include <gr_udp_source.h>
#include <gr_wavfile_sink.h>
#include <gr_wavfile_source.h>
-
+#include <gr_tagged_file_sink.h>
%}
%include "gr_file_sink_base.i"
@@ -64,4 +64,5 @@
%include "gr_udp_source.i"
%include "gr_wavfile_sink.i"
%include "gr_wavfile_source.i"
+%include "gr_tagged_file_sink.i"
diff --git a/gnuradio-core/src/lib/runtime/Makefile.am b/gnuradio-core/src/lib/runtime/Makefile.am
index f67e8843d..dd9a8ea64 100644
--- a/gnuradio-core/src/lib/runtime/Makefile.am
+++ b/gnuradio-core/src/lib/runtime/Makefile.am
@@ -68,7 +68,8 @@ libruntime_la_SOURCES = \
gr_vmcircbuf_mmap_tmpfile.cc \
gr_vmcircbuf_createfilemapping.cc \
gr_vmcircbuf_sysv_shm.cc \
- gr_select_handler.cc
+ gr_select_handler.cc \
+ gr_tag_info.cc
libruntime_qa_la_SOURCES = \
qa_gr_block.cc \
@@ -79,6 +80,7 @@ libruntime_qa_la_SOURCES = \
qa_gr_top_block.cc \
qa_gr_io_signature.cc \
qa_gr_vmcircbuf.cc \
+ qa_block_tags.cc \
qa_runtime.cc
grinclude_HEADERS = \
@@ -121,7 +123,8 @@ grinclude_HEADERS = \
gr_tmp_path.h \
gr_types.h \
gr_unittests.h \
- gr_vmcircbuf.h
+ gr_vmcircbuf.h \
+ gr_tag_info.h
noinst_HEADERS = \
gr_vmcircbuf_mmap_shm_open.h \
@@ -136,6 +139,7 @@ noinst_HEADERS = \
qa_gr_io_signature.h \
qa_gr_top_block.h \
qa_gr_vmcircbuf.h \
+ qa_block_tags.h \
qa_runtime.h
if PYTHON
diff --git a/gnuradio-core/src/lib/runtime/gr_block.cc b/gnuradio-core/src/lib/runtime/gr_block.cc
index 8915f3360..81a55af9d 100644
--- a/gnuradio-core/src/lib/runtime/gr_block.cc
+++ b/gnuradio-core/src/lib/runtime/gr_block.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2009 Free Software Foundation, Inc.
+ * Copyright 2004,2009,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -36,7 +36,8 @@ gr_block::gr_block (const std::string &name,
d_output_multiple (1),
d_relative_rate (1.0),
d_history(1),
- d_fixed_rate(false)
+ d_fixed_rate(false),
+ d_tag_propagation_policy(TPP_ALL_TO_ALL)
{
}
@@ -117,6 +118,69 @@ gr_block::fixed_rate_noutput_to_ninput(int noutput)
throw std::runtime_error("Unimplemented");
}
+uint64_t
+gr_block::nitems_read(unsigned int which_input)
+{
+ if(d_detail) {
+ return d_detail->nitems_read(which_input);
+ }
+ else {
+ //throw std::runtime_error("No block_detail associated with block yet");
+ return 0;
+ }
+}
+
+uint64_t
+gr_block::nitems_written(unsigned int which_output)
+{
+ if(d_detail) {
+ return d_detail->nitems_written(which_output);
+ }
+ else {
+ //throw std::runtime_error("No block_detail associated with block yet");
+ return 0;
+ }
+}
+
+void
+gr_block::add_item_tag(unsigned int which_output,
+ uint64_t offset,
+ const pmt::pmt_t &key,
+ const pmt::pmt_t &value,
+ const pmt::pmt_t &srcid)
+{
+ d_detail->add_item_tag(which_output, offset, key, value, srcid);
+}
+
+void
+gr_block::get_tags_in_range(std::vector<pmt::pmt_t> &v,
+ unsigned int which_output,
+ uint64_t start, uint64_t end)
+{
+ d_detail->get_tags_in_range(v, which_output, start, end);
+}
+
+void
+gr_block::get_tags_in_range(std::vector<pmt::pmt_t> &v,
+ unsigned int which_output,
+ uint64_t start, uint64_t end,
+ const pmt::pmt_t &key)
+{
+ d_detail->get_tags_in_range(v, which_output, start, end, key);
+}
+
+gr_block::tag_propagation_policy_t
+gr_block::tag_propagation_policy()
+{
+ return d_tag_propagation_policy;
+}
+
+void
+gr_block::set_tag_propagation_policy(tag_propagation_policy_t p)
+{
+ d_tag_propagation_policy = p;
+}
+
std::ostream&
operator << (std::ostream& os, const gr_block *m)
{
diff --git a/gnuradio-core/src/lib/runtime/gr_block.h b/gnuradio-core/src/lib/runtime/gr_block.h
index b6f724dde..ad7fa9555 100644
--- a/gnuradio-core/src/lib/runtime/gr_block.h
+++ b/gnuradio-core/src/lib/runtime/gr_block.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2007,2009 Free Software Foundation, Inc.
+ * Copyright 2004,2007,2009,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -63,6 +63,12 @@ class gr_block : public gr_basic_block {
WORK_DONE = -1
};
+ enum tag_propagation_policy_t {
+ TPP_DONT = 0,
+ TPP_ALL_TO_ALL = 1,
+ TPP_ONE_TO_ONE = 2
+ };
+
virtual ~gr_block ();
/*!
@@ -198,6 +204,26 @@ class gr_block : public gr_basic_block {
*/
virtual int fixed_rate_noutput_to_ninput(int noutput);
+ /*!
+ * \brief Return the number of items read on input stream which_input
+ */
+ uint64_t nitems_read(unsigned int which_input);
+
+ /*!
+ * \brief Return the number of items written on output stream which_output
+ */
+ uint64_t nitems_written(unsigned int which_output);
+
+ /*!
+ * \brief Asks for the policy used by the scheduler to moved tags downstream.
+ */
+ tag_propagation_policy_t tag_propagation_policy();
+
+ /*!
+ * \brief Set the policy by the scheduler to determine how tags are moved downstream.
+ */
+ void set_tag_propagation_policy(tag_propagation_policy_t p);
+
// ----------------------------------------------------------------------------
private:
@@ -207,6 +233,7 @@ class gr_block : public gr_basic_block {
gr_block_detail_sptr d_detail; // implementation details
unsigned d_history;
bool d_fixed_rate;
+ tag_propagation_policy_t d_tag_propagation_policy; // policy for moving tags downstream
protected:
@@ -216,6 +243,62 @@ class gr_block : public gr_basic_block {
void set_fixed_rate(bool fixed_rate){ d_fixed_rate = fixed_rate; }
+
+ /*!
+ * \brief Adds a new tag onto the given output buffer.
+ *
+ * \param which_output an integer of which output stream to attach the tag
+ * \param abs_offset a uint64 number of the absolute item number
+ * assicated with the tag. Can get from nitems_written.
+ * \param key the tag key as a PMT symbol
+ * \param value any PMT holding any value for the given key
+ * \param srcid optional source ID specifier; defaults to PMT_F
+ */
+ void add_item_tag(unsigned int which_output,
+ uint64_t abs_offset,
+ const pmt::pmt_t &key,
+ const pmt::pmt_t &value,
+ const pmt::pmt_t &srcid=pmt::PMT_F);
+
+ /*!
+ * \brief Given a [start,end), returns a vector of all tags in the range.
+ *
+ * Range of counts is from start to end-1.
+ *
+ * Tags are tuples of:
+ * (item count, source id, key, value)
+ *
+ * \param v a vector reference to return tags into
+ * \param which_input an integer of which input stream to pull from
+ * \param abs_start a uint64 count of the start of the range of interest
+ * \param abs_end a uint64 count of the end of the range of interest
+ */
+ void get_tags_in_range(std::vector<pmt::pmt_t> &v,
+ unsigned int which_input,
+ uint64_t abs_start,
+ uint64_t abs_end);
+
+ /*!
+ * \brief Given a [start,end), returns a vector of all tags in the range
+ * with a given key.
+ *
+ * Range of counts is from start to end-1.
+ *
+ * Tags are tuples of:
+ * (item count, source id, key, value)
+ *
+ * \param v a vector reference to return tags into
+ * \param which_input an integer of which input stream to pull from
+ * \param abs_start a uint64 count of the start of the range of interest
+ * \param abs_end a uint64 count of the end of the range of interest
+ * \param key a PMT symbol key to filter only tags of this key
+ */
+ void get_tags_in_range(std::vector<pmt::pmt_t> &v,
+ unsigned int which_input,
+ uint64_t abs_start,
+ uint64_t abs_end,
+ const pmt::pmt_t &key);
+
// These are really only for internal use, but leaving them public avoids
// having to work up an ever-varying list of friends
diff --git a/gnuradio-core/src/lib/runtime/gr_block.i b/gnuradio-core/src/lib/runtime/gr_block.i
index f4ee43477..bb0c5f221 100644
--- a/gnuradio-core/src/lib/runtime/gr_block.i
+++ b/gnuradio-core/src/lib/runtime/gr_block.i
@@ -49,6 +49,9 @@ class gr_block : public gr_basic_block {
bool start();
bool stop();
+ uint64_t nitems_read(unsigned int which_input);
+ uint64_t nitems_written(unsigned int which_output);
+
// internal use
gr_block_detail_sptr detail () const { return d_detail; }
void set_detail (gr_block_detail_sptr detail) { d_detail = detail; }
diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.cc b/gnuradio-core/src/lib/runtime/gr_block_detail.cc
index 38d4a13ca..a360240c0 100644
--- a/gnuradio-core/src/lib/runtime/gr_block_detail.cc
+++ b/gnuradio-core/src/lib/runtime/gr_block_detail.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2009 Free Software Foundation, Inc.
+ * Copyright 2004,2009,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -27,6 +27,8 @@
#include <gr_block_detail.h>
#include <gr_buffer.h>
+using namespace pmt;
+
static long s_ncurrently_allocated = 0;
long
@@ -88,16 +90,20 @@ gr_block_detail::set_done (bool done)
void
gr_block_detail::consume (int which_input, int how_many_items)
{
- if (how_many_items > 0)
+ if (how_many_items > 0) {
input (which_input)->update_read_pointer (how_many_items);
+ }
}
+
void
gr_block_detail::consume_each (int how_many_items)
{
- if (how_many_items > 0)
- for (int i = 0; i < ninputs (); i++)
+ if (how_many_items > 0) {
+ for (int i = 0; i < ninputs (); i++) {
d_input[i]->update_read_pointer (how_many_items);
+ }
+ }
}
void
@@ -112,16 +118,88 @@ gr_block_detail::produce (int which_output, int how_many_items)
void
gr_block_detail::produce_each (int how_many_items)
{
- if (how_many_items > 0){
- for (int i = 0; i < noutputs (); i++)
+ if (how_many_items > 0) {
+ for (int i = 0; i < noutputs (); i++) {
d_output[i]->update_write_pointer (how_many_items);
+ }
d_produce_or |= how_many_items;
}
}
void
-gr_block_detail::_post(pmt::pmt_t msg)
+gr_block_detail::_post(pmt_t msg)
{
d_tpb.insert_tail(msg);
}
+
+uint64_t
+gr_block_detail::nitems_read(unsigned int which_input)
+{
+ if(which_input >= d_ninputs)
+ throw std::invalid_argument ("gr_block_detail::n_input_items");
+ return d_input[which_input]->nitems_read();
+}
+
+uint64_t
+gr_block_detail::nitems_written(unsigned int which_output)
+{
+ if(which_output >= d_noutputs)
+ throw std::invalid_argument ("gr_block_detail::n_output_items");
+ return d_output[which_output]->nitems_written();
+}
+
+void
+gr_block_detail::add_item_tag(unsigned int which_output,
+ uint64_t abs_offset,
+ const pmt_t &key,
+ const pmt_t &value,
+ const pmt_t &srcid)
+{
+ if(!pmt_is_symbol(key)) {
+ throw pmt_wrong_type("gr_block_detail::add_item_tag key", key);
+ }
+ else {
+ // build tag tuple
+ pmt_t nitem = pmt_from_uint64(abs_offset);
+ pmt_t tuple = pmt_make_tuple(nitem, srcid, key, value);
+
+ // Add tag to gr_buffer's deque tags
+ d_output[which_output]->add_item_tag(tuple);
+ }
+}
+
+void
+gr_block_detail::get_tags_in_range(std::vector<pmt::pmt_t> &v,
+ unsigned int which_input,
+ uint64_t abs_start,
+ uint64_t abs_end)
+{
+ // get from gr_buffer_reader's deque of tags
+ d_input[which_input]->get_tags_in_range(v, abs_start, abs_end);
+}
+
+void
+gr_block_detail::get_tags_in_range(std::vector<pmt_t> &v,
+ unsigned int which_input,
+ uint64_t abs_start,
+ uint64_t abs_end,
+ const pmt_t &key)
+{
+ std::vector<pmt_t> found_items;
+
+ v.resize(0);
+
+ // get from gr_buffer_reader's deque of tags
+ d_input[which_input]->get_tags_in_range(found_items, abs_start, abs_end);
+
+ // Filter further by key name
+ pmt_t itemkey;
+ std::vector<pmt_t>::iterator itr;
+ for(itr = found_items.begin(); itr != found_items.end(); itr++) {
+ itemkey = pmt_tuple_ref(*itr, 2);
+ if(pmt_eqv(key, itemkey)) {
+ v.push_back(*itr);
+ }
+ }
+}
diff --git a/gnuradio-core/src/lib/runtime/gr_block_detail.h b/gnuradio-core/src/lib/runtime/gr_block_detail.h
index c5787a5ad..d7ec3b136 100644
--- a/gnuradio-core/src/lib/runtime/gr_block_detail.h
+++ b/gnuradio-core/src/lib/runtime/gr_block_detail.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2009 Free Software Foundation, Inc.
+ * Copyright 2004,2009,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -25,6 +25,7 @@
#include <gr_runtime_types.h>
#include <gr_tpb_detail.h>
+#include <gr_tag_info.h>
#include <stdexcept>
/*!
@@ -88,6 +89,75 @@ class gr_block_detail {
*/
void _post(pmt::pmt_t msg);
+ // Return the number of items read on input stream which_input
+ uint64_t nitems_read(unsigned int which_input);
+
+ // Return the number of items written on output stream which_output
+ uint64_t nitems_written(unsigned int which_output);
+
+
+ /*!
+ * \brief Adds a new tag to the given output stream.
+ *
+ * This takes the input parameters and builds a PMT tuple
+ * from it. It then calls gr_buffer::add_item_tag(pmt::pmt_t t),
+ * which appends the tag onto its deque.
+ *
+ * \param which_output an integer of which output stream to attach the tag
+ * \param abs_offset a uint64 number of the absolute item number
+ * assicated with the tag. Can get from nitems_written.
+ * \param key the tag key as a PMT symbol
+ * \param value any PMT holding any value for the given key
+ * \param srcid a PMT source ID specifier
+ */
+ void add_item_tag(unsigned int which_output,
+ uint64_t abs_offset,
+ const pmt::pmt_t &key,
+ const pmt::pmt_t &value,
+ const pmt::pmt_t &srcid);
+
+ /*!
+ * \brief Given a [start,end), returns a vector of all tags in the range.
+ *
+ * Pass-through function to gr_buffer_reader to get a vector of tags
+ * in given range. Range of counts is from start to end-1.
+ *
+ * Tags are tuples of:
+ * (item count, source id, key, value)
+ *
+ * \param v a vector reference to return tags into
+ * \param which_input an integer of which input stream to pull from
+ * \param abs_start a uint64 count of the start of the range of interest
+ * \param abs_end a uint64 count of the end of the range of interest
+ */
+ void get_tags_in_range(std::vector<pmt::pmt_t> &v,
+ unsigned int which_input,
+ uint64_t abs_start,
+ uint64_t abs_end);
+
+ /*!
+ * \brief Given a [start,end), returns a vector of all tags in the range
+ * with a given key.
+ *
+ * Calls get_tags_in_range(which_input, abs_start, abs_end) to get a vector of
+ * tags from the buffers. This function then provides a secondary filter to
+ * the tags to extract only tags with the given 'key'.
+ *
+ * Tags are tuples of:
+ * (item count, source id, key, value)
+ *
+ * \param v a vector reference to return tags into
+ * \param which_input an integer of which input stream to pull from
+ * \param abs_start a uint64 count of the start of the range of interest
+ * \param abs_end a uint64 count of the end of the range of interest
+ * \param key a PMT symbol to select only tags of this key
+ */
+ void get_tags_in_range(std::vector<pmt::pmt_t> &v,
+ unsigned int which_input,
+ uint64_t abs_start,
+ uint64_t abs_end,
+ const pmt::pmt_t &key);
+
gr_tpb_detail d_tpb; // used by thread-per-block scheduler
int d_produce_or;
@@ -100,7 +170,6 @@ class gr_block_detail {
std::vector<gr_buffer_sptr> d_output;
bool d_done;
-
gr_block_detail (unsigned int ninputs, unsigned int noutputs);
friend class gr_tpb_detail;
diff --git a/gnuradio-core/src/lib/runtime/gr_block_executor.cc b/gnuradio-core/src/lib/runtime/gr_block_executor.cc
index 2c21a0b0f..112150235 100644
--- a/gnuradio-core/src/lib/runtime/gr_block_executor.cc
+++ b/gnuradio-core/src/lib/runtime/gr_block_executor.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2008,2009 Free Software Foundation, Inc.
+ * Copyright 2004,2008,2009,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -87,7 +87,80 @@ min_available_space (gr_block_detail *d, int output_multiple)
return min_space;
}
+static bool
+propagate_tags(gr_block::tag_propagation_policy_t policy, gr_block_detail *d,
+ const std::vector<uint64_t> &start_nitems_read, double rrate,
+ std::vector<pmt::pmt_t> &rtags)
+{
+ // Move tags downstream
+ // if a sink, we don't need to move downstream;
+ // and do not bother if block uses TAGS_NONE attribute
+ if(d->sink_p()) {
+ return true;
+ }
+ switch(policy) {
+ case gr_block::TPP_DONT:
+ return true;
+ break;
+ case gr_block::TPP_ALL_TO_ALL:
+ // every tag on every input propogates to everyone downstream
+ for(int i = 0; i < d->ninputs(); i++) {
+ d->get_tags_in_range(rtags, i, start_nitems_read[i],
+ d->nitems_read(i));
+
+ std::vector<pmt::pmt_t>::iterator t;
+ if(rrate == 1.0) {
+ for(t = rtags.begin(); t != rtags.end(); t++) {
+ for(int o = 0; o < d->noutputs(); o++)
+ d->output(o)->add_item_tag(*t);
+ }
+ }
+ else {
+ for(t = rtags.begin(); t != rtags.end(); t++) {
+ uint64_t newcount = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*t, 0));
+ pmt::pmt_t newtup = pmt::mp(pmt::pmt_from_uint64(newcount * rrate),
+ pmt::pmt_tuple_ref(*t, 1),
+ pmt::pmt_tuple_ref(*t, 2),
+ pmt::pmt_tuple_ref(*t, 3));
+
+ for(int o = 0; o < d->noutputs(); o++)
+ d->output(o)->add_item_tag(newtup);
+ }
+ }
+ }
+ break;
+ case gr_block::TPP_ONE_TO_ONE:
+ // tags from input i only go to output i
+ // this requires d->ninputs() == d->noutputs; this is checked when this
+ // type of tag-propagation system is selected in gr_block_detail
+ if(d->ninputs() == d->noutputs()) {
+ for(int i = 0; i < d->ninputs(); i++) {
+ d->get_tags_in_range(rtags, i, start_nitems_read[i],
+ d->nitems_read(i));
+
+ std::vector<pmt::pmt_t>::iterator t;
+ for(t = rtags.begin(); t != rtags.end(); t++) {
+ uint64_t newcount = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*t, 0));
+ pmt::pmt_t newtup = pmt::mp(pmt::pmt_from_uint64(newcount * rrate),
+ pmt::pmt_tuple_ref(*t, 1),
+ pmt::pmt_tuple_ref(*t, 2),
+ pmt::pmt_tuple_ref(*t, 3));
+ d->output(i)->add_item_tag(newtup);
+ }
+ }
+ }
+ else {
+ std::cerr << "Error: gr_block_executor: propagation_policy 'ONE-TO-ONE' requires ninputs == noutputs" << std::endl;
+ return false;
+ }
+
+ break;
+ default:
+ return true;
+ }
+ return true;
+}
gr_block_executor::gr_block_executor (gr_block_sptr block)
: d_block(block), d_log(0)
@@ -134,6 +207,7 @@ gr_block_executor::run_one_iteration()
d_input_items.resize (0);
d_input_done.resize(0);
d_output_items.resize (d->noutputs ());
+ d_start_nitems_read.resize(0);
// determine the minimum available output space
noutput_items = min_available_space (d, m->output_multiple ());
@@ -155,6 +229,7 @@ gr_block_executor::run_one_iteration()
d_input_items.resize (d->ninputs ());
d_input_done.resize(d->ninputs());
d_output_items.resize (0);
+ d_start_nitems_read.resize(d->ninputs());
LOG(*d_log << " sink\n");
max_items_avail = 0;
@@ -198,6 +273,7 @@ gr_block_executor::run_one_iteration()
d_input_items.resize (d->ninputs ());
d_input_done.resize(d->ninputs());
d_output_items.resize (d->noutputs ());
+ d_start_nitems_read.resize(d->ninputs());
max_items_avail = 0;
for (int i = 0; i < d->ninputs (); i++){
@@ -294,12 +370,21 @@ gr_block_executor::run_one_iteration()
for (int i = 0; i < d->noutputs (); i++)
d_output_items[i] = d->output(i)->write_pointer();
+ // determine where to start looking for new tags
+ for (int i = 0; i < d->ninputs(); i++)
+ d_start_nitems_read[i] = d->nitems_read(i);
+
// Do the actual work of the block
int n = m->general_work (noutput_items, d_ninput_items,
d_input_items, d_output_items);
LOG(*d_log << " general_work: noutput_items = " << noutput_items
<< " result = " << n << std::endl);
+ if(!propagate_tags(m->tag_propagation_policy(), d,
+ d_start_nitems_read, m->relative_rate(),
+ d_returned_tags))
+ goto were_done;
+
if (n == gr_block::WORK_DONE)
goto were_done;
diff --git a/gnuradio-core/src/lib/runtime/gr_block_executor.h b/gnuradio-core/src/lib/runtime/gr_block_executor.h
index 41b5ede7c..77ace5522 100644
--- a/gnuradio-core/src/lib/runtime/gr_block_executor.h
+++ b/gnuradio-core/src/lib/runtime/gr_block_executor.h
@@ -25,6 +25,7 @@
#include <gr_runtime_types.h>
#include <fstream>
+#include <gruel/pmt.h>
//class gr_block_executor;
//typedef boost::shared_ptr<gr_block_executor> gr_block_executor_sptr;
@@ -47,6 +48,8 @@ protected:
gr_vector_const_void_star d_input_items;
std::vector<bool> d_input_done;
gr_vector_void_star d_output_items;
+ std::vector<uint64_t> d_start_nitems_read; //stores where tag counts are before work
+ std::vector<pmt::pmt_t> d_returned_tags;
public:
gr_block_executor(gr_block_sptr block);
diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.cc b/gnuradio-core/src/lib/runtime/gr_buffer.cc
index db2db5d6d..0b2eb52a0 100644
--- a/gnuradio-core/src/lib/runtime/gr_buffer.cc
+++ b/gnuradio-core/src/lib/runtime/gr_buffer.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2009 Free Software Foundation, Inc.
+ * Copyright 2004,2009,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -80,7 +80,7 @@ minimum_buffer_items (long type_size, long page_size)
gr_buffer::gr_buffer (int nitems, size_t sizeof_item, gr_block_sptr link)
: d_base (0), d_bufsize (0), d_vmcircbuf (0),
d_sizeof_item (sizeof_item), d_link(link),
- d_write_index (0), d_done (false)
+ d_write_index (0), d_abs_write_offset(0), d_done (false)
{
if (!allocate_buffer (nitems, sizeof_item))
throw std::bad_alloc ();
@@ -156,8 +156,13 @@ gr_buffer::space_available ()
// Find out the maximum amount of data available to our readers
int most_data = d_readers[0]->items_available ();
- for (unsigned int i = 1; i < d_readers.size (); i++)
+ uint64_t min_items_read = d_readers[0]->nitems_read();
+ for (size_t i = 1; i < d_readers.size (); i++) {
most_data = std::max (most_data, d_readers[i]->items_available ());
+ min_items_read = std::min(min_items_read, d_readers[i]->nitems_read());
+ }
+
+ prune_tags(min_items_read);
// The -1 ensures that the case d_write_index == d_read_index is
// unambiguous. It indicates that there is no data for the reader
@@ -177,6 +182,7 @@ gr_buffer::update_write_pointer (int nitems)
{
gruel::scoped_lock guard(*mutex());
d_write_index = index_add (d_write_index, nitems);
+ d_abs_write_offset += nitems;
}
void
@@ -215,6 +221,40 @@ gr_buffer::drop_reader (gr_buffer_reader *reader)
d_readers.erase (result);
}
+void
+gr_buffer::add_item_tag(const pmt::pmt_t &tag)
+{
+ gruel::scoped_lock guard(*mutex());
+ d_item_tags.push_back(tag);
+}
+
+void
+gr_buffer::prune_tags(uint64_t max_time)
+{
+ /* NOTE: this function _should_ lock the mutex before editing
+ d_item_tags. In practice, this function is only called at
+ runtime by min_available_space in gr_block_executor.cc,
+ which locks the mutex itself.
+
+ If this function is used elsewhere, remember to lock the
+ buffer's mutex al la the scoped_lock line below.
+ */
+ //gruel::scoped_lock guard(*mutex());
+
+ int n = 0;
+ uint64_t item_time;
+ std::deque<pmt::pmt_t>::iterator itr = d_item_tags.begin();
+
+ while(itr != d_item_tags.end()) {
+ item_time = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*itr, 0));
+ if(item_time < max_time) {
+ d_item_tags.pop_front();
+ n++;
+ }
+ itr++;
+ }
+}
+
long
gr_buffer_ncurrently_allocated ()
{
@@ -225,7 +265,7 @@ gr_buffer_ncurrently_allocated ()
gr_buffer_reader::gr_buffer_reader(gr_buffer_sptr buffer, unsigned int read_index,
gr_block_sptr link)
- : d_buffer(buffer), d_read_index(read_index), d_link(link)
+ : d_buffer(buffer), d_read_index(read_index), d_abs_read_offset(0), d_link(link)
{
s_buffer_reader_count++;
}
@@ -253,6 +293,29 @@ gr_buffer_reader::update_read_pointer (int nitems)
{
gruel::scoped_lock guard(*mutex());
d_read_index = d_buffer->index_add (d_read_index, nitems);
+ d_abs_read_offset += nitems;
+}
+
+void
+gr_buffer_reader::get_tags_in_range(std::vector<pmt::pmt_t> &v,
+ uint64_t abs_start,
+ uint64_t abs_end)
+{
+ gruel::scoped_lock guard(*mutex());
+
+ v.resize(0);
+ std::deque<pmt::pmt_t>::iterator itr = d_buffer->get_tags_begin();
+
+ uint64_t item_time;
+ while(itr != d_buffer->get_tags_end()) {
+ item_time = pmt::pmt_to_uint64(pmt::pmt_tuple_ref(*itr, 0));
+
+ if((item_time >= abs_start) && (item_time <= abs_end)) {
+ v.push_back(*itr);
+ }
+
+ itr++;
+ }
}
long
diff --git a/gnuradio-core/src/lib/runtime/gr_buffer.h b/gnuradio-core/src/lib/runtime/gr_buffer.h
index 207bfe7c5..fe0e7585d 100644
--- a/gnuradio-core/src/lib/runtime/gr_buffer.h
+++ b/gnuradio-core/src/lib/runtime/gr_buffer.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2009 Free Software Foundation, Inc.
+ * Copyright 2004,2009,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -26,6 +26,7 @@
#include <gr_runtime_types.h>
#include <boost/weak_ptr.hpp>
#include <gruel/thread.h>
+#include <gruel/pmt.h>
class gr_vmcircbuf;
@@ -88,6 +89,26 @@ class gr_buffer {
gruel::mutex *mutex() { return &d_mutex; }
+ uint64_t nitems_written() { return d_abs_write_offset; }
+
+
+ /*!
+ * \brief Adds a new tag to the buffer.
+ *
+ * \param tag a PMT tuple containing the new tag
+ */
+ void add_item_tag(const pmt::pmt_t &tag);
+
+ /*!
+ * \brief Removes all tags before \p max_time from buffer
+ *
+ * \param max_time the time (item number) to trim up until.
+ */
+ void prune_tags(uint64_t max_time);
+
+ std::deque<pmt::pmt_t>::iterator get_tags_begin() { return d_item_tags.begin(); }
+ std::deque<pmt::pmt_t>::iterator get_tags_end() { return d_item_tags.end(); }
+
// -------------------------------------------------------------------------
private:
@@ -106,11 +127,15 @@ class gr_buffer {
boost::weak_ptr<gr_block> d_link; // block that writes to this buffer
//
- // The mutex protects d_write_index, d_done and the d_read_index's in the buffer readers.
+ // The mutex protects d_write_index, d_abs_write_offset, d_done, d_item_tags
+ // and the d_read_index's and d_abs_read_offset's in the buffer readers.
//
gruel::mutex d_mutex;
unsigned int d_write_index; // in items [0,d_bufsize)
+ uint64_t d_abs_write_offset; // num items written since the start
bool d_done;
+ std::deque<pmt::pmt_t> d_item_tags;
+
unsigned
index_add (unsigned a, unsigned b)
@@ -220,11 +245,31 @@ class gr_buffer_reader {
gruel::mutex *mutex() { return d_buffer->mutex(); }
+ uint64_t nitems_read() { return d_abs_read_offset; }
+
/*!
* \brief Return the block that reads via this reader.
+ *
*/
gr_block_sptr link() { return gr_block_sptr(d_link); }
+
+ /*!
+ * \brief Given a [start,end), returns a vector all tags in the range.
+ *
+ * Get a vector of tags in given range. Range of counts is from start to end-1.
+ *
+ * Tags are tuples of:
+ * (item count, source id, key, value)
+ *
+ * \param v a vector reference to return tags into
+ * \param abs_start a uint64 count of the start of the range of interest
+ * \param abs_end a uint64 count of the end of the range of interest
+ */
+ void get_tags_in_range(std::vector<pmt::pmt_t> &v,
+ uint64_t abs_start,
+ uint64_t abs_end);
+
// -------------------------------------------------------------------------
private:
@@ -236,6 +281,7 @@ class gr_buffer_reader {
gr_buffer_sptr d_buffer;
unsigned int d_read_index; // in items [0,d->buffer.d_bufsize)
+ uint64_t d_abs_read_offset; // num items seen since the start
boost::weak_ptr<gr_block> d_link; // block that reads via this buffer reader
//! constructor is private. Use gr_buffer::add_reader to create instances
diff --git a/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.cc b/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.cc
index 031eb6dfd..5d1057e0f 100644
--- a/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.cc
+++ b/gnuradio-core/src/lib/runtime/gr_flat_flowgraph.cc
@@ -264,16 +264,13 @@ void gr_flat_flowgraph::dump()
int no = detail->noutputs();
for (int i = 0; i < no; i++) {
gr_buffer_sptr buffer = detail->output(i);
- std::cout << " output " << i << ": " << buffer
- << " space=" << buffer->space_available() << std::endl;
+ std::cout << " output " << i << ": " << buffer << std::endl;
}
for (int i = 0; i < ni; i++) {
gr_buffer_reader_sptr reader = detail->input(i);
std::cout << " reader " << i << ": " << reader
- << " reading from buffer=" << reader->buffer()
- << " avail=" << reader->items_available() << " items"
- << std::endl;
+ << " reading from buffer=" << reader->buffer() << std::endl;
}
}
diff --git a/gnuradio-core/src/lib/runtime/gr_preferences.cc b/gnuradio-core/src/lib/runtime/gr_preferences.cc
index e0be2db62..5f7412248 100644
--- a/gnuradio-core/src/lib/runtime/gr_preferences.cc
+++ b/gnuradio-core/src/lib/runtime/gr_preferences.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2003 Free Software Foundation, Inc.
+ * Copyright 2003,2010 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -77,11 +77,20 @@ gr_preferences::get (const char *key)
static char buf[1024];
FILE *fp = fopen (pathname (key), "r");
- if (fp == 0)
+ if (fp == 0) {
+ perror (pathname (key));
return 0;
+ }
memset (buf, 0, sizeof (buf));
- fread (buf, 1, sizeof (buf) - 1, fp);
+ size_t ret = fread (buf, 1, sizeof (buf) - 1, fp);
+ if(ret == 0) {
+ if(ferror(fp) != 0) {
+ perror (pathname (key));
+ fclose (fp);
+ return 0;
+ }
+ }
fclose (fp);
return buf;
}
@@ -97,6 +106,13 @@ gr_preferences::set (const char *key, const char *value)
return;
}
- fwrite (value, 1, strlen (value), fp);
+ size_t ret = fwrite (value, 1, strlen (value), fp);
+ if(ret == 0) {
+ if(ferror(fp) != 0) {
+ perror (pathname (key));
+ fclose (fp);
+ return;
+ }
+ }
fclose (fp);
};
diff --git a/gnuradio-core/src/lib/runtime/gr_tag_info.cc b/gnuradio-core/src/lib/runtime/gr_tag_info.cc
new file mode 100644
index 000000000..f15329f9b
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_tag_info.cc
@@ -0,0 +1,38 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gr_tag_info.h>
+#include <gruel/pmt.h>
+
+namespace gr_tags {
+/*
+ const pmt::pmt_t key_time = pmt::pmt_string_to_symbol("time");
+ const pmt::pmt_t key_sample_rate = pmt::pmt_string_to_symbol("sample_rate");
+ const pmt::pmt_t key_frequency = pmt::pmt_string_to_symbol("frequency");
+ const pmt::pmt_t key_rssi = pmt::pmt_string_to_symbol("rssi");
+ const pmt::pmt_t key_rx_gain = pmt::pmt_string_to_symbol("gain");
+*/
+}
diff --git a/gnuradio-core/src/lib/runtime/gr_tag_info.h b/gnuradio-core/src/lib/runtime/gr_tag_info.h
new file mode 100644
index 000000000..5a1e1555a
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/gr_tag_info.h
@@ -0,0 +1,87 @@
+/* -*- 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_GR_TAG_INFO_H
+#define INCLUDED_GR_TAG_INFO_H
+
+#include <gruel/pmt.h>
+
+namespace gr_tags {
+
+ enum {
+ TAG_NITEM_REF = 0,
+ TAG_SRCID_REF,
+ TAG_KEY_REF,
+ TAG_VALUE_REF
+ };
+
+ /*
+ extern const pmt::pmt_t key_time;
+ extern const pmt::pmt_t key_sample_rate;
+ extern const pmt::pmt_t key_frequency;
+ extern const pmt::pmt_t key_rssi;
+ extern const pmt::pmt_t key_gain;
+ */
+
+ /*!
+ * \brief Returns the item \p tag occurred at (as a uint64_t)
+ */
+ static inline uint64_t
+ get_nitems(const pmt::pmt_t &tag) {
+ return pmt::pmt_to_uint64(pmt::pmt_tuple_ref(tag, TAG_NITEM_REF));
+ }
+
+ /*!
+ * \brief Returns the source ID of \p tag (as a PMT)
+ */
+ static inline pmt::pmt_t
+ get_srcid(const pmt::pmt_t &tag) {
+ return pmt::pmt_tuple_ref(tag, TAG_SRCID_REF);
+ }
+
+ /*!
+ * \brief Returns the key of \p tag (as a PMT symbol)
+ */
+ static inline pmt::pmt_t
+ get_key(const pmt::pmt_t &tag) {
+ return pmt::pmt_tuple_ref(tag, TAG_KEY_REF);
+ }
+
+ /*!
+ * \brief Returns the value of \p tag (as a PMT)
+ */
+ static inline pmt::pmt_t
+ get_value(const pmt::pmt_t &tag) {
+ return pmt::pmt_tuple_ref(tag, TAG_VALUE_REF);
+ }
+
+ /*!
+ * \brief Comparison function to test which tag, \p x or \p y, came first in time
+ */
+ static inline bool
+ nitems_compare(pmt::pmt_t x, pmt::pmt_t y) {
+ return get_nitems(x) < get_nitems(y);
+ }
+
+}; /* namespace tags */
+
+#endif /* GR_TAG_INFO */
diff --git a/gnuradio-core/src/lib/runtime/qa_block_tags.cc b/gnuradio-core/src/lib/runtime/qa_block_tags.cc
new file mode 100644
index 000000000..07ce5c276
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/qa_block_tags.cc
@@ -0,0 +1,450 @@
+/* -*- 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <qa_block_tags.h>
+#include <gr_block.h>
+#include <gr_top_block.h>
+#include <gr_null_source.h>
+#include <gr_null_sink.h>
+#include <gr_head.h>
+#include <gr_annotator_alltoall.h>
+#include <gr_annotator_1to1.h>
+#include <gr_keep_one_in_n.h>
+#include <gr_firdes.h>
+#include <gruel/pmt.h>
+
+
+// ----------------------------------------------------------------
+
+using namespace pmt;
+
+// set to 1 to turn on debug output
+// The debug output fully checks that the tags seen are what are expected. While
+// this behavior currently works with our implementation, there is no guarentee
+// that the tags will be coming in this specific order, so it's dangerous to
+// rely on this as a test of the tag system working. We would really want to
+// tags we know we should see and then test that they all occur once, but in no
+// particular order.
+#define QA_TAGS_DEBUG 0
+
+void
+qa_block_tags::t0 ()
+{
+ unsigned int N = 1000;
+ gr_top_block_sptr tb = gr_make_top_block("top");
+ gr_block_sptr src (gr_make_null_source(sizeof(int)));
+ gr_block_sptr head (gr_make_head(sizeof(int), N));
+ gr_block_sptr snk (gr_make_null_sink(sizeof(int)));
+
+ tb->connect(src, 0, head, 0);
+ tb->connect(head, 0, snk, 0);
+
+ //CPPUNIT_ASSERT_THROW(src->nitems_read(0), std::runtime_error);
+ //CPPUNIT_ASSERT_THROW(src->nitems_written(0), std::runtime_error);
+ CPPUNIT_ASSERT_EQUAL(src->nitems_read(0), (uint64_t)0);
+ CPPUNIT_ASSERT_EQUAL(src->nitems_written(0), (uint64_t)0);
+
+ tb->run();
+
+ CPPUNIT_ASSERT_THROW(src->nitems_read(0), std::invalid_argument);
+ CPPUNIT_ASSERT(src->nitems_written(0) >= N);
+ CPPUNIT_ASSERT_EQUAL(snk->nitems_read(0), (uint64_t)1000);
+ CPPUNIT_ASSERT_THROW(snk->nitems_written(0), std::invalid_argument);
+}
+
+
+void
+qa_block_tags::t1 ()
+{
+ int N = 40000;
+ gr_top_block_sptr tb = gr_make_top_block("top");
+ gr_block_sptr src (gr_make_null_source(sizeof(int)));
+ gr_block_sptr head (gr_make_head(sizeof(int), N));
+ gr_annotator_alltoall_sptr ann0 (gr_make_annotator_alltoall(10000, sizeof(int)));
+ gr_annotator_alltoall_sptr ann1 (gr_make_annotator_alltoall(10000, sizeof(int)));
+ gr_annotator_alltoall_sptr ann2 (gr_make_annotator_alltoall(10000, sizeof(int)));
+ gr_annotator_alltoall_sptr ann3 (gr_make_annotator_alltoall(10000, sizeof(int)));
+ gr_annotator_alltoall_sptr ann4 (gr_make_annotator_alltoall(10000, sizeof(int)));
+ gr_block_sptr snk0 (gr_make_null_sink(sizeof(int)));
+ gr_block_sptr snk1 (gr_make_null_sink(sizeof(int)));
+
+ tb->connect(src, 0, head, 0);
+ tb->connect(head, 0, ann0, 0);
+
+ tb->connect(ann0, 0, ann1, 0);
+ tb->connect(ann0, 1, ann2, 0);
+ tb->connect(ann1, 0, ann3, 0);
+ tb->connect(ann2, 0, ann4, 0);
+
+ tb->connect(ann3, 0, snk0, 0);
+ tb->connect(ann4, 0, snk1, 0);
+
+ tb->run();
+
+ std::vector<pmt::pmt_t> tags0 = ann0->data();
+ std::vector<pmt::pmt_t> tags3 = ann3->data();
+ std::vector<pmt::pmt_t> tags4 = ann4->data();
+
+ // The first annotator does not receive any tags from the null sink upstream
+ CPPUNIT_ASSERT_EQUAL(tags0.size(), (size_t)0);
+ CPPUNIT_ASSERT_EQUAL(tags3.size(), (size_t)8);
+ CPPUNIT_ASSERT_EQUAL(tags4.size(), (size_t)8);
+
+#if QA_TAGS_DEBUG
+ // Kludge together the tags that we know should result from the above graph
+ std::stringstream str0, str1, str2;
+ str0 << ann0->name() << ann0->unique_id();
+ str1 << ann1->name() << ann1->unique_id();
+ str2 << ann2->name() << ann2->unique_id();
+
+ pmt_t expected_tags3[8];
+ expected_tags3[0] = mp(pmt_from_uint64(0), mp(str1.str()), mp("seq"), mp(0));
+ expected_tags3[1] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(0));
+ expected_tags3[2] = mp(pmt_from_uint64(10000), mp(str1.str()), mp("seq"), mp(1));
+ expected_tags3[3] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(2));
+ expected_tags3[4] = mp(pmt_from_uint64(20000), mp(str1.str()), mp("seq"), mp(2));
+ expected_tags3[5] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(4));
+ expected_tags3[6] = mp(pmt_from_uint64(30000), mp(str1.str()), mp("seq"), mp(3));
+ expected_tags3[7] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(6));
+
+ pmt_t expected_tags4[8];
+ expected_tags4[0] = mp(pmt_from_uint64(0), mp(str2.str()), mp("seq"), mp(0));
+ expected_tags4[1] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(1));
+ expected_tags4[2] = mp(pmt_from_uint64(10000), mp(str2.str()), mp("seq"), mp(1));
+ expected_tags4[3] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(3));
+ expected_tags4[4] = mp(pmt_from_uint64(20000), mp(str2.str()), mp("seq"), mp(2));
+ expected_tags4[5] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(5));
+ expected_tags4[6] = mp(pmt_from_uint64(30000), mp(str2.str()), mp("seq"), mp(3));
+ expected_tags4[7] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(7));
+
+ std::cout << std::endl << "qa_block_tags::t1" << std::endl;
+
+ // For annotator 3, we know it gets tags from ann0 and ann1, test this
+ for(size_t i = 0; i < tags3.size(); i++) {
+ std::cout << "tags3[" << i << "] = " << tags3[i] << "\t\t" << expected_tags3[i] << std::endl;
+ CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags3[i]), pmt_write_string(expected_tags3[i]));
+ }
+
+ // For annotator 4, we know it gets tags from ann0 and ann2, test this
+ std::cout << std::endl;
+ for(size_t i = 0; i < tags4.size(); i++) {
+ std::cout << "tags4[" << i << "] = " << tags4[i] << "\t\t" << expected_tags4[i] << std::endl;
+ CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags4[i]), pmt_write_string(expected_tags4[i]));
+ }
+#endif
+}
+
+void
+qa_block_tags::t2 ()
+{
+ int N = 40000;
+ gr_top_block_sptr tb = gr_make_top_block("top");
+ gr_block_sptr src (gr_make_null_source(sizeof(int)));
+ gr_block_sptr head (gr_make_head(sizeof(int), N));
+ gr_annotator_alltoall_sptr ann0 (gr_make_annotator_alltoall(10000, sizeof(int)));
+ gr_annotator_alltoall_sptr ann1 (gr_make_annotator_alltoall(10000, sizeof(int)));
+ gr_annotator_alltoall_sptr ann2 (gr_make_annotator_alltoall(10000, sizeof(int)));
+ gr_annotator_alltoall_sptr ann3 (gr_make_annotator_alltoall(10000, sizeof(int)));
+ gr_annotator_alltoall_sptr ann4 (gr_make_annotator_alltoall(10000, sizeof(int)));
+ gr_block_sptr snk0 (gr_make_null_sink(sizeof(int)));
+ gr_block_sptr snk1 (gr_make_null_sink(sizeof(int)));
+ gr_block_sptr snk2 (gr_make_null_sink(sizeof(int)));
+
+ tb->connect(src, 0, head, 0);
+ tb->connect(head, 0, ann0, 0);
+
+ tb->connect(ann0, 0, ann1, 0);
+ tb->connect(ann0, 1, ann1, 1);
+ tb->connect(ann1, 0, ann2, 0);
+ tb->connect(ann1, 1, ann3, 0);
+ tb->connect(ann1, 2, ann4, 0);
+
+ tb->connect(ann2, 0, snk0, 0);
+ tb->connect(ann3, 0, snk1, 0);
+ tb->connect(ann4, 0, snk2, 0);
+
+ tb->run();
+
+ std::vector<pmt::pmt_t> tags0 = ann0->data();
+ std::vector<pmt::pmt_t> tags1 = ann1->data();
+ std::vector<pmt::pmt_t> tags2 = ann2->data();
+ std::vector<pmt::pmt_t> tags3 = ann4->data();
+ std::vector<pmt::pmt_t> tags4 = ann4->data();
+
+ // The first annotator does not receive any tags from the null sink upstream
+ CPPUNIT_ASSERT_EQUAL(tags0.size(), (size_t)0);
+ CPPUNIT_ASSERT_EQUAL(tags1.size(), (size_t)8);
+
+ // Make sure the rest all have 12 tags
+ CPPUNIT_ASSERT_EQUAL(tags2.size(), (size_t)12);
+ CPPUNIT_ASSERT_EQUAL(tags3.size(), (size_t)12);
+ CPPUNIT_ASSERT_EQUAL(tags4.size(), (size_t)12);
+
+
+#if QA_TAGS_DEBUG
+ // Kludge together the tags that we know should result from the above graph
+ std::stringstream str0, str1;
+ str0 << ann0->name() << ann0->unique_id();
+ str1 << ann1->name() << ann1->unique_id();
+
+ pmt_t expected_tags2[12];
+ expected_tags2[0] = mp(pmt_from_uint64(0), mp(str1.str()), mp("seq"), mp(0));
+ expected_tags2[1] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(0));
+ expected_tags2[2] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(1));
+ expected_tags2[3] = mp(pmt_from_uint64(10000), mp(str1.str()), mp("seq"), mp(3));
+ expected_tags2[4] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(2));
+ expected_tags2[5] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(3));
+ expected_tags2[6] = mp(pmt_from_uint64(20000), mp(str1.str()), mp("seq"), mp(6));
+ expected_tags2[7] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(4));
+ expected_tags2[8] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(5));
+ expected_tags2[9] = mp(pmt_from_uint64(30000), mp(str1.str()), mp("seq"), mp(9));
+ expected_tags2[10] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(6));
+ expected_tags2[11] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(7));
+
+ pmt_t expected_tags4[12];
+ expected_tags4[0] = mp(pmt_from_uint64(0), mp(str1.str()), mp("seq"), mp(2));
+ expected_tags4[1] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(0));
+ expected_tags4[2] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(1));
+ expected_tags4[3] = mp(pmt_from_uint64(10000), mp(str1.str()), mp("seq"), mp(5));
+ expected_tags4[4] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(2));
+ expected_tags4[5] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(3));
+ expected_tags4[6] = mp(pmt_from_uint64(20000), mp(str1.str()), mp("seq"), mp(8));
+ expected_tags4[7] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(4));
+ expected_tags4[8] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(5));
+ expected_tags4[9] = mp(pmt_from_uint64(30000), mp(str1.str()), mp("seq"), mp(11));
+ expected_tags4[10] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(6));
+ expected_tags4[11] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(7));
+
+ std::cout << std::endl << "qa_block_tags::t2" << std::endl;
+
+ // For annotator[2-4], we know it gets tags from ann0 and ann1
+ // but the tags from the different outputs of ann1 are different for each.
+ // Just testing ann2 and ann4; if they are correct it would be
+ // inconceivable for ann3 to have it wrong.
+ for(size_t i = 0; i < tags2.size(); i++) {
+ std::cout << "tags2[" << i << "] = " << tags2[i] << "\t\t" << expected_tags2[i] << std::endl;
+ CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags2[i]), pmt_write_string(expected_tags2[i]));
+ }
+
+ std::cout << std::endl;
+ for(size_t i = 0; i < tags4.size(); i++) {
+ std::cout << "tags2[" << i << "] = " << tags4[i] << "\t\t" << expected_tags4[i] << std::endl;
+ CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags4[i]), pmt_write_string(expected_tags4[i]));
+ }
+#endif
+}
+
+
+void
+qa_block_tags::t3 ()
+{
+ int N = 40000;
+ gr_top_block_sptr tb = gr_make_top_block("top");
+ gr_block_sptr src (gr_make_null_source(sizeof(int)));
+ gr_block_sptr head (gr_make_head(sizeof(int), N));
+ gr_annotator_1to1_sptr ann0 (gr_make_annotator_1to1(10000, sizeof(int)));
+ gr_annotator_alltoall_sptr ann1 (gr_make_annotator_alltoall(10000, sizeof(int)));
+ gr_annotator_alltoall_sptr ann2 (gr_make_annotator_alltoall(10000, sizeof(int)));
+ gr_annotator_1to1_sptr ann3 (gr_make_annotator_1to1(10000, sizeof(int)));
+ gr_annotator_1to1_sptr ann4 (gr_make_annotator_1to1(10000, sizeof(int)));
+ gr_block_sptr snk0 (gr_make_null_sink(sizeof(int)));
+ gr_block_sptr snk1 (gr_make_null_sink(sizeof(int)));
+
+ tb->connect(src, 0, head, 0);
+ tb->connect(head, 0, ann0, 0);
+ tb->connect(head, 0, ann0, 1);
+
+ tb->connect(ann0, 0, ann1, 0);
+ tb->connect(ann0, 1, ann2, 0);
+ tb->connect(ann1, 0, ann3, 0);
+ tb->connect(ann2, 0, ann4, 0);
+
+ tb->connect(ann3, 0, snk0, 0);
+ tb->connect(ann4, 0, snk1, 0);
+
+ tb->run();
+
+
+ std::vector<pmt::pmt_t> tags0 = ann0->data();
+ std::vector<pmt::pmt_t> tags3 = ann3->data();
+ std::vector<pmt::pmt_t> tags4 = ann4->data();
+
+ // The first annotator does not receive any tags from the null sink upstream
+ CPPUNIT_ASSERT_EQUAL(tags0.size(), (size_t)0);
+ CPPUNIT_ASSERT_EQUAL(tags3.size(), (size_t)8);
+ CPPUNIT_ASSERT_EQUAL(tags4.size(), (size_t)8);
+
+#if QA_TAGS_DEBUG
+ // Kludge together the tags that we know should result from the above graph
+ std::stringstream str0, str1, str2;
+ str0 << ann0->name() << ann0->unique_id();
+ str1 << ann1->name() << ann1->unique_id();
+ str2 << ann2->name() << ann2->unique_id();
+
+ pmt_t expected_tags3[8];
+ expected_tags3[0] = mp(pmt_from_uint64(0), mp(str1.str()), mp("seq"), mp(0));
+ expected_tags3[1] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(0));
+ expected_tags3[2] = mp(pmt_from_uint64(10000), mp(str1.str()), mp("seq"), mp(1));
+ expected_tags3[3] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(2));
+ expected_tags3[4] = mp(pmt_from_uint64(20000), mp(str1.str()), mp("seq"), mp(2));
+ expected_tags3[5] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(4));
+ expected_tags3[6] = mp(pmt_from_uint64(30000), mp(str1.str()), mp("seq"), mp(3));
+ expected_tags3[7] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(6));
+
+ pmt_t expected_tags4[8];
+ expected_tags4[0] = mp(pmt_from_uint64(0), mp(str2.str()), mp("seq"), mp(0));
+ expected_tags4[1] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(1));
+ expected_tags4[2] = mp(pmt_from_uint64(10000), mp(str2.str()), mp("seq"), mp(1));
+ expected_tags4[3] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(3));
+ expected_tags4[4] = mp(pmt_from_uint64(20000), mp(str2.str()), mp("seq"), mp(2));
+ expected_tags4[5] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(5));
+ expected_tags4[6] = mp(pmt_from_uint64(30000), mp(str2.str()), mp("seq"), mp(3));
+ expected_tags4[7] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(7));
+
+ std::cout << std::endl << "qa_block_tags::t3" << std::endl;
+
+ // For annotator 3, we know it gets tags from ann0 and ann1, test this
+ for(size_t i = 0; i < tags3.size(); i++) {
+ std::cout << "tags3[" << i << "] = " << tags3[i] << "\t\t" << expected_tags3[i] << std::endl;
+ CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags3[i]), pmt_write_string(expected_tags3[i]));
+ }
+
+ // For annotator 4, we know it gets tags from ann0 and ann2, test this
+ std::cout << std::endl;
+ for(size_t i = 0; i < tags4.size(); i++) {
+ std::cout << "tags4[" << i << "] = " << tags4[i] << "\t\t" << expected_tags4[i] << std::endl;
+ CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags4[i]), pmt_write_string(expected_tags4[i]));
+ }
+#endif
+}
+
+
+void
+qa_block_tags::t4 ()
+{
+ int N = 40000;
+ gr_top_block_sptr tb = gr_make_top_block("top");
+ gr_block_sptr src (gr_make_null_source(sizeof(int)));
+ gr_block_sptr head (gr_make_head(sizeof(int), N));
+ gr_annotator_1to1_sptr ann0 (gr_make_annotator_1to1(10000, sizeof(int)));
+ gr_annotator_1to1_sptr ann1 (gr_make_annotator_1to1(10000, sizeof(int)));
+ gr_annotator_1to1_sptr ann2 (gr_make_annotator_1to1(10000, sizeof(int)));
+ gr_block_sptr snk0 (gr_make_null_sink(sizeof(int)));
+ gr_block_sptr snk1 (gr_make_null_sink(sizeof(int)));
+
+ // using 1-to-1 tag propagation without having equal number of
+ // ins and outs. Make sure this works; will just exit run early.
+ tb->connect(src, 0, head, 0);
+ tb->connect(head, 0, ann0, 0);
+ tb->connect(ann0, 0, ann1, 0);
+ tb->connect(ann0, 1, ann2, 0);
+ tb->connect(ann1, 0, snk0, 0);
+ tb->connect(ann2, 0, snk1, 0);
+
+ std::cerr << std::endl
+ << "NOTE: This is supposed to produce an error from gr_block_executor"
+ << std::endl;
+ tb->run();
+}
+
+
+void
+qa_block_tags::t5 ()
+{
+ int N = 40000;
+ gr_top_block_sptr tb = gr_make_top_block("top");
+ gr_block_sptr src (gr_make_null_source(sizeof(float)));
+ gr_block_sptr head (gr_make_head(sizeof(float), N));
+ gr_annotator_alltoall_sptr ann0 (gr_make_annotator_alltoall(10000, sizeof(float)));
+ gr_annotator_alltoall_sptr ann1 (gr_make_annotator_alltoall(10000, sizeof(float)));
+ gr_annotator_alltoall_sptr ann2 (gr_make_annotator_alltoall(1000, sizeof(float)));
+ gr_block_sptr snk0 (gr_make_null_sink(sizeof(float)));
+
+ // Rate change blocks
+ gr_keep_one_in_n_sptr dec10 (gr_make_keep_one_in_n(sizeof(float), 10));
+
+ tb->connect(src, 0, head, 0);
+ tb->connect(head, 0, ann0, 0);
+ tb->connect(ann0, 0, ann1, 0);
+ tb->connect(ann1, 0, dec10, 0);
+ tb->connect(dec10, 0, ann2, 0);
+ tb->connect(ann2, 0, snk0, 0);
+
+ tb->run();
+
+ std::vector<pmt::pmt_t> tags0 = ann0->data();
+ std::vector<pmt::pmt_t> tags1 = ann1->data();
+ std::vector<pmt::pmt_t> tags2 = ann2->data();
+
+ // The first annotator does not receive any tags from the null sink upstream
+ CPPUNIT_ASSERT_EQUAL(tags0.size(), (size_t)0);
+ CPPUNIT_ASSERT_EQUAL(tags1.size(), (size_t)4);
+ CPPUNIT_ASSERT_EQUAL(tags2.size(), (size_t)8);
+
+
+#if QA_TAGS_DEBUG
+ // Kludge together the tags that we know should result from the above graph
+ std::stringstream str0, str1, str2;
+ str0 << ann0->name() << ann0->unique_id();
+ str1 << ann1->name() << ann1->unique_id();
+ str2 << ann2->name() << ann2->unique_id();
+
+ pmt_t expected_tags1[5];
+ expected_tags1[0] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(0));
+ expected_tags1[1] = mp(pmt_from_uint64(10000), mp(str0.str()), mp("seq"), mp(1));
+ expected_tags1[2] = mp(pmt_from_uint64(20000), mp(str0.str()), mp("seq"), mp(2));
+ expected_tags1[3] = mp(pmt_from_uint64(30000), mp(str0.str()), mp("seq"), mp(3));
+
+ pmt_t expected_tags2[10];
+ expected_tags2[0] = mp(pmt_from_uint64(0), mp(str1.str()), mp("seq"), mp(0));
+ expected_tags2[1] = mp(pmt_from_uint64(0), mp(str0.str()), mp("seq"), mp(0));
+ expected_tags2[2] = mp(pmt_from_uint64(1000), mp(str1.str()), mp("seq"), mp(1));
+ expected_tags2[3] = mp(pmt_from_uint64(1000), mp(str0.str()), mp("seq"), mp(1));
+ expected_tags2[4] = mp(pmt_from_uint64(2000), mp(str1.str()), mp("seq"), mp(2));
+ expected_tags2[5] = mp(pmt_from_uint64(2000), mp(str0.str()), mp("seq"), mp(2));
+ expected_tags2[6] = mp(pmt_from_uint64(3000), mp(str1.str()), mp("seq"), mp(3));
+ expected_tags2[7] = mp(pmt_from_uint64(3000), mp(str0.str()), mp("seq"), mp(3));
+ expected_tags2[8] = mp(pmt_from_uint64(4000), mp(str1.str()), mp("seq"), mp(4));
+ expected_tags2[9] = mp(pmt_from_uint64(4000), mp(str0.str()), mp("seq"), mp(4));
+
+ std::cout << std::endl << "qa_block_tags::t5" << std::endl;
+
+ // annotator 1 gets tags from annotator 0
+ std::cout << "tags1.size(): " << tags1.size() << std::endl;
+ for(size_t i = 0; i < tags1.size(); i++) {
+ std::cout << "tags1[" << i << "] = " << tags1[i] << "\t\t" << expected_tags1[i] << std::endl;
+ CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags1[i]), pmt_write_string(expected_tags1[i]));
+ }
+
+ // annotator 2 gets tags from annotators 0 and 1
+ std::cout << std::endl;
+ std::cout << "tags2.size(): " << tags2.size() << std::endl;
+ for(size_t i = 0; i < tags2.size(); i++) {
+ std::cout << "tags2[" << i << "] = " << tags2[i] << "\t\t" << expected_tags2[i] << std::endl;
+ CPPUNIT_ASSERT_EQUAL(pmt_write_string(tags2[i]), pmt_write_string(expected_tags2[i]));
+ }
+#endif
+}
+
diff --git a/gnuradio-core/src/lib/runtime/qa_block_tags.h b/gnuradio-core/src/lib/runtime/qa_block_tags.h
new file mode 100644
index 000000000..b0d211390
--- /dev/null
+++ b/gnuradio-core/src/lib/runtime/qa_block_tags.h
@@ -0,0 +1,52 @@
+/* -*- 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_QA_BLOCK_TAGS_H
+#define INCLUDED_QA_BLOCK_TAGS_H
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+#include <stdexcept>
+
+class qa_block_tags : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE (qa_block_tags);
+ CPPUNIT_TEST (t0);
+ CPPUNIT_TEST (t1);
+ CPPUNIT_TEST (t2);
+ CPPUNIT_TEST (t3);
+ CPPUNIT_TEST (t4);
+ CPPUNIT_TEST (t5);
+ CPPUNIT_TEST_SUITE_END ();
+
+ private:
+ void t0 ();
+ void t1 ();
+ void t2 ();
+ void t3 ();
+ void t4 ();
+ void t5 ();
+
+};
+
+
+#endif /* INCLUDED_QA_BLOCK_TAGS_H */
diff --git a/gnuradio-core/src/lib/runtime/qa_runtime.cc b/gnuradio-core/src/lib/runtime/qa_runtime.cc
index 31e3a82d6..967d4bfa8 100644
--- a/gnuradio-core/src/lib/runtime/qa_runtime.cc
+++ b/gnuradio-core/src/lib/runtime/qa_runtime.cc
@@ -38,6 +38,7 @@
#include <qa_gr_hier_block2.h>
#include <qa_gr_hier_block2_derived.h>
#include <qa_gr_buffer.h>
+#include <qa_block_tags.h>
CppUnit::TestSuite *
qa_runtime::suite ()
@@ -52,6 +53,7 @@ qa_runtime::suite ()
s->addTest (qa_gr_hier_block2::suite ());
s->addTest (qa_gr_hier_block2_derived::suite ());
s->addTest (qa_gr_buffer::suite ());
+ s->addTest (qa_block_tags::suite ());
return s;
}
diff --git a/gnuradio-core/src/lib/swig/gnuradio.i b/gnuradio-core/src/lib/swig/gnuradio.i
index 47fd4e330..1601cca12 100644
--- a/gnuradio-core/src/lib/swig/gnuradio.i
+++ b/gnuradio-core/src/lib/swig/gnuradio.i
@@ -60,6 +60,8 @@
typedef std::complex<float> gr_complex;
typedef std::complex<double> gr_complexd;
+typedef unsigned long long uint64_t;
+typedef long long int64_t;
// instantiate the required template specializations
diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/pfb_arb_resampler.py b/gnuradio-core/src/python/gnuradio/blks2impl/pfb_arb_resampler.py
index e40d9636a..cd9289fa5 100644
--- a/gnuradio-core/src/python/gnuradio/blks2impl/pfb_arb_resampler.py
+++ b/gnuradio-core/src/python/gnuradio/blks2impl/pfb_arb_resampler.py
@@ -31,15 +31,22 @@ class pfb_arb_resampler_ccf(gr.hier_block2):
streams. This block is provided to be consistent with the interface to the
other PFB block.
'''
- def __init__(self, rate, taps, flt_size=32):
+ def __init__(self, rate, taps=None, flt_size=32, atten=80):
gr.hier_block2.__init__(self, "pfb_arb_resampler_ccf",
gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature
gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature
self._rate = rate
- self._taps = taps
self._size = flt_size
+ if taps is not None:
+ self._taps = taps
+ else:
+ # Create a filter that covers the full bandwidth of the input signal
+ bw = 0.5
+ tb = 0.1
+ self._taps = gr.firdes.low_pass_2(self._size, self._size, bw, tb, atten)
+
self.pfb = gr.pfb_arb_resampler_ccf(self._rate, self._taps, self._size)
self.connect(self, self.pfb)
diff --git a/gnuradio-examples/python/pfb/resampler.py b/gnuradio-examples/python/pfb/resampler.py
new file mode 100755
index 000000000..6be7cf14e
--- /dev/null
+++ b/gnuradio-examples/python/pfb/resampler.py
@@ -0,0 +1,95 @@
+#!/usr/bin/env python
+
+from gnuradio import gr, blks2
+import scipy, pylab
+
+class mytb(gr.top_block):
+ def __init__(self, fs_in, fs_out, fc, N=10000):
+ gr.top_block.__init__(self)
+
+ rerate = float(fs_out) / float(fs_in)
+ print "Resampling from %f to %f by %f " %(fs_in, fs_out, rerate)
+
+ # Creating our own taps
+ taps = gr.firdes.low_pass_2(32, 32, 0.25, 0.1, 80)
+
+ self.src = gr.sig_source_c(fs_in, gr.GR_SIN_WAVE, fc, 1)
+ #self.src = gr.noise_source_c(gr.GR_GAUSSIAN, 1)
+ self.head = gr.head(gr.sizeof_gr_complex, N)
+
+ # A resampler with our taps
+ self.resamp_0 = blks2.pfb_arb_resampler_ccf(rerate, taps,
+ flt_size=32)
+
+ # A resampler that just needs a resampling rate.
+ # Filter is created for us and designed to cover
+ # entire bandwidth of the input signal.
+ # An optional atten=XX rate can be used here to
+ # specify the out-of-band rejection (default=80).
+ self.resamp_1 = blks2.pfb_arb_resampler_ccf(rerate)
+
+ self.snk_in = gr.vector_sink_c()
+ self.snk_0 = gr.vector_sink_c()
+ self.snk_1 = gr.vector_sink_c()
+
+ self.connect(self.src, self.head, self.snk_in)
+ self.connect(self.head, self.resamp_0, self.snk_0)
+ self.connect(self.head, self.resamp_1, self.snk_1)
+
+def main():
+ fs_in = 8000
+ fs_out = 20000
+ fc = 1000
+ N = 10000
+
+ tb = mytb(fs_in, fs_out, fc, N)
+ tb.run()
+
+
+ # Plot PSD of signals
+ nfftsize = 2048
+ fig1 = pylab.figure(1, figsize=(10,10), facecolor="w")
+ sp1 = fig1.add_subplot(2,1,1)
+ sp1.psd(tb.snk_in.data(), NFFT=nfftsize,
+ noverlap=nfftsize/4, Fs = fs_in)
+ sp1.set_title(("Input Signal at f_s=%.2f kHz" % (fs_in/1000.0)))
+ sp1.set_xlim([-fs_in/2, fs_in/2])
+
+ sp2 = fig1.add_subplot(2,1,2)
+ sp2.psd(tb.snk_0.data(), NFFT=nfftsize,
+ noverlap=nfftsize/4, Fs = fs_out,
+ label="With our filter")
+ sp2.psd(tb.snk_1.data(), NFFT=nfftsize,
+ noverlap=nfftsize/4, Fs = fs_out,
+ label="With auto-generated filter")
+ sp2.set_title(("Output Signals at f_s=%.2f kHz" % (fs_out/1000.0)))
+ sp2.set_xlim([-fs_out/2, fs_out/2])
+ sp2.legend()
+
+ # Plot signals in time
+ Ts_in = 1.0/fs_in
+ Ts_out = 1.0/fs_out
+ t_in = scipy.arange(0, len(tb.snk_in.data())*Ts_in, Ts_in)
+ t_out = scipy.arange(0, len(tb.snk_0.data())*Ts_out, Ts_out)
+
+ fig2 = pylab.figure(2, figsize=(10,10), facecolor="w")
+ sp21 = fig2.add_subplot(2,1,1)
+ sp21.plot(t_in, tb.snk_in.data())
+ sp21.set_title(("Input Signal at f_s=%.2f kHz" % (fs_in/1000.0)))
+ sp21.set_xlim([t_in[100], t_in[200]])
+
+ sp22 = fig2.add_subplot(2,1,2)
+ sp22.plot(t_out, tb.snk_0.data(),
+ label="With our filter")
+ sp22.plot(t_out, tb.snk_1.data(),
+ label="With auto-generated filter")
+ sp22.set_title(("Output Signals at f_s=%.2f kHz" % (fs_out/1000.0)))
+ r = float(fs_out)/float(fs_in)
+ sp22.set_xlim([t_out[r * 100], t_out[r * 200]])
+ sp22.legend()
+
+ pylab.show()
+
+if __name__ == "__main__":
+ main()
+
diff --git a/gnuradio-examples/python/tags/test_file_tags.py b/gnuradio-examples/python/tags/test_file_tags.py
new file mode 100755
index 000000000..4ff4549ef
--- /dev/null
+++ b/gnuradio-examples/python/tags/test_file_tags.py
@@ -0,0 +1,29 @@
+#!/usr/bin/env python
+
+from gnuradio import gr
+import scipy
+
+def main():
+ data = scipy.arange(0, 32000, 1).tolist()
+ trig = 100*[0,] + 100*[1,]
+
+ src = gr.vector_source_s(data, True)
+ trigger = gr.vector_source_s(trig, True)
+
+ thr = gr.throttle(gr.sizeof_short, 10e3)
+ ann = gr.annotator_alltoall(1000000, gr.sizeof_short)
+ tagger = gr.burst_tagger(gr.sizeof_short)
+
+ fsnk = gr.tagged_file_sink(gr.sizeof_short, 1)
+
+ tb = gr.top_block()
+ tb.connect(src, thr, (tagger, 0))
+ tb.connect(trigger, (tagger, 1))
+ tb.connect(tagger, fsnk)
+
+ tb.run()
+
+if __name__ == "__main__":
+ main()
+
+
diff --git a/gnuradio-examples/python/tags/uhd_burst_detector.py b/gnuradio-examples/python/tags/uhd_burst_detector.py
new file mode 100755
index 000000000..f8ebbe66a
--- /dev/null
+++ b/gnuradio-examples/python/tags/uhd_burst_detector.py
@@ -0,0 +1,98 @@
+#!/usr/bin/env python
+
+from gnuradio import eng_notation
+from gnuradio import gr
+from gnuradio import uhd
+from gnuradio import window
+from gnuradio.eng_option import eng_option
+from gnuradio.gr import firdes
+from optparse import OptionParser
+
+class uhd_burst_detector(gr.top_block):
+ def __init__(self, frequency, sample_rate,
+ uhd_address="192.168.10.2", trigger=False):
+
+ gr.top_block.__init__(self)
+
+ self.freq = frequency
+ self.samp_rate = sample_rate
+ self.uhd_addr = uhd_address
+ self.gain = 32
+ self.trigger = trigger
+
+ self.uhd_src = uhd.single_usrp_source(
+ device_addr=self.uhd_addr,
+ io_type=uhd.io_type_t.COMPLEX_FLOAT32,
+ num_channels=1,
+ )
+
+ self.uhd_src.set_samp_rate(self.samp_rate)
+ self.uhd_src.set_center_freq(self.freq, 0)
+ self.uhd_src.set_gain(self.gain, 0)
+
+ taps = firdes.low_pass_2(1, 1, 0.4, 0.1, 60)
+ self.chanfilt = gr.fir_filter_ccc(10, taps)
+ self.ann0 = gr.annotator_alltoall(100000, gr.sizeof_gr_complex)
+ self.tagger = gr.burst_tagger(gr.sizeof_gr_complex)
+
+ # Dummy signaler to collect a burst on known periods
+ data = 1000*[0,] + 1000*[1,]
+ self.signal = gr.vector_source_s(data, True)
+
+ # Energy detector to get signal burst
+ self.c2m = gr.complex_to_mag_squared()
+ self.iir = gr.single_pole_iir_filter_ff(0.0001)
+ self.sub = gr.sub_ff()
+ self.mult = gr.multiply_const_ff(32768)
+ self.f2s = gr.float_to_short()
+ self.fsnk = gr.tagged_file_sink(gr.sizeof_gr_complex, self.samp_rate)
+
+
+ ##################################################
+ # Connections
+ ##################################################
+ self.connect((self.uhd_src, 0), (self.tagger, 0))
+ self.connect((self.tagger, 0), (self.fsnk, 0))
+
+ if self.trigger:
+ # Connect a dummy signaler to the burst tagger
+ self.connect((self.signal, 0), (self.tagger, 1))
+
+ else:
+ # Connect an energy detector signaler to the burst tagger
+ self.connect((self.uhd_src, 0), (self.c2m, 0))
+ self.connect((self.c2m, 0), (self.sub, 0))
+ self.connect((self.c2m, 0), (self.iir, 0))
+ self.connect((self.iir, 0), (self.sub, 1))
+ self.connect((self.sub, 0), (self.mult,0))
+ self.connect((self.mult, 0), (self.f2s, 0))
+ self.connect((self.f2s, 0), (self.tagger, 1))
+
+ def set_samp_rate(self, samp_rate):
+ self.samp_rate = samp_rate
+ self.wxgui_fftsink2_0.set_sample_rate(self.samp_rate/10)
+ self.uhd_src_0.set_samp_rate(self.samp_rate)
+
+if __name__ == '__main__':
+ parser = OptionParser(option_class=eng_option, usage="%prog: [options]")
+ parser.add_option("-a", "--address", type="string", default="addr=192.168.10.2",
+ help="select address of the device [default=%default]")
+ #parser.add_option("-A", "--antenna", default=None,
+ # help="select Rx Antenna (only on RFX-series boards)")
+ parser.add_option("-f", "--freq", type="eng_float", default=450e6,
+ help="set frequency to FREQ", metavar="FREQ")
+ parser.add_option("-g", "--gain", type="eng_float", default=0,
+ help="set gain in dB [default=%default]")
+ parser.add_option("-R", "--rate", type="eng_float", default=200000,
+ help="set USRP sample rate [default=%default]")
+ parser.add_option("-T", "--trigger", action="store_true", default=False,
+ help="Use internal trigger instead of detector [default=%default]")
+ (options, args) = parser.parse_args()
+
+ frequency = options.freq
+ samp_rate = samp_rate = options.rate
+ uhd_addr = options.address
+ trigger = options.trigger
+
+ tb = uhd_burst_detector(frequency, samp_rate, uhd_addr, trigger)
+ tb.run()
diff --git a/gr-audio-jack/src/audio_jack_sink.cc b/gr-audio-jack/src/audio_jack_sink.cc
index 6e39135c9..f28fddc34 100644
--- a/gr-audio-jack/src/audio_jack_sink.cc
+++ b/gr-audio-jack/src/audio_jack_sink.cc
@@ -105,12 +105,17 @@ audio_jack_sink::audio_jack_sink (int sampling_rate,
d_nunderuns (0)
{
#ifndef NO_PTHREAD
- pthread_cond_init(&d_ringbuffer_ready, NULL);;
- pthread_mutex_init(&d_jack_process_lock, NULL);
+ pthread_cond_init(&d_ringbuffer_ready, NULL);;
+ pthread_mutex_init(&d_jack_process_lock, NULL);
#endif
-
+
// try to become a client of the JACK server
- if ((d_jack_client = jack_client_new (d_device_name.c_str ())) == 0) {
+ jack_options_t options = JackNullOption;
+ jack_status_t status;
+ const char *server_name = NULL;
+ if ((d_jack_client = jack_client_open (d_device_name.c_str (),
+ options, &status,
+ server_name)) == NULL) {
fprintf (stderr, "audio_jack_sink[%s]: jack server not running?\n",
d_device_name.c_str());
throw std::runtime_error ("audio_jack_sink");
diff --git a/gr-audio-jack/src/audio_jack_source.cc b/gr-audio-jack/src/audio_jack_source.cc
index ca3df51d7..a92e970f5 100644
--- a/gr-audio-jack/src/audio_jack_source.cc
+++ b/gr-audio-jack/src/audio_jack_source.cc
@@ -110,7 +110,12 @@ audio_jack_source::audio_jack_source (int sampling_rate,
#endif
// try to become a client of the JACK server
- if ((d_jack_client = jack_client_new (d_device_name.c_str ())) == 0) {
+ jack_options_t options = JackNullOption;
+ jack_status_t status;
+ const char *server_name = NULL;
+ if ((d_jack_client = jack_client_open (d_device_name.c_str (),
+ options, &status,
+ server_name)) == NULL) {
fprintf (stderr, "audio_jack_source[%s]: jack server not running?\n",
d_device_name.c_str());
throw std::runtime_error ("audio_jack_source");
diff --git a/gr-audio-portaudio/src/audio_portaudio_sink.cc b/gr-audio-portaudio/src/audio_portaudio_sink.cc
index 9a3baf40e..64e64ccf4 100644
--- a/gr-audio-portaudio/src/audio_portaudio_sink.cc
+++ b/gr-audio-portaudio/src/audio_portaudio_sink.cc
@@ -102,7 +102,10 @@ portaudio_sink_callback (const void *inputBuffer,
else { // underrun
self->d_nunderuns++;
- ::write(2, "aU", 2); // FIXME change to non-blocking call
+ ssize_t r = ::write(2, "aU", 2); // FIXME change to non-blocking call
+ if(r == -1) {
+ perror("audio_portaudio_source::portaudio_source_callback write error to stderr.");
+ }
// FIXME we should transfer what we've got and pad the rest
memset(outputBuffer, 0, nreqd_samples * sizeof(sample_t));
diff --git a/gr-audio-portaudio/src/audio_portaudio_source.cc b/gr-audio-portaudio/src/audio_portaudio_source.cc
index 23801a8bf..e508fda22 100644
--- a/gr-audio-portaudio/src/audio_portaudio_source.cc
+++ b/gr-audio-portaudio/src/audio_portaudio_source.cc
@@ -105,7 +105,10 @@ portaudio_source_callback (const void *inputBuffer,
else { // overrun
self->d_noverruns++;
- ::write(2, "aO", 2); // FIXME change to non-blocking call
+ ssize_t r = ::write(2, "aO", 2); // FIXME change to non-blocking call
+ if(r == -1) {
+ perror("audio_portaudio_source::portaudio_source_callback write error to stderr.");
+ }
self->d_ringbuffer_ready = false;
self->d_ringbuffer_cond.notify_one(); // Tell the sink to get going!
diff --git a/gr-msdd6000/src/msdd_rs_source_simple.cc b/gr-msdd6000/src/msdd_rs_source_simple.cc
index c44808f51..70e692d83 100644
--- a/gr-msdd6000/src/msdd_rs_source_simple.cc
+++ b/gr-msdd6000/src/msdd_rs_source_simple.cc
@@ -64,7 +64,10 @@ msdd_rs_source_simple::work (int noutput_items,
/* Read a buffer out -- looking at UDP payload at this point.*/
rcv->read( &buffer[0], BUF_LEN );
- int seq = *((int*) &buffer[2]);
+ //int seq = *((int*) &buffer[2]);
+ int seq;
+ memcpy(&seq, &buffer[2], 4*sizeof(char));
+
char type = buffer[0];
//printf("Sequence %d\n",seq);
diff --git a/gr-msdd6000/src/msdd_source_simple.cc b/gr-msdd6000/src/msdd_source_simple.cc
index 076a305f1..20b15c43d 100644
--- a/gr-msdd6000/src/msdd_source_simple.cc
+++ b/gr-msdd6000/src/msdd_source_simple.cc
@@ -64,7 +64,9 @@ msdd_source_simple::work (int noutput_items,
char buffer[BUF_LEN];
rcv->read( &buffer[0], BUF_LEN );
- int seq = *((int*) &buffer[2]);
+ //int seq = *((int*) &buffer[2]);
+ int seq;
+ memcpy(&seq, &buffer[2], 4*sizeof(char));
if(d_lastseq == -MSDD_COMPLEX_SAMPLES_PER_PACKET){
// not started case
diff --git a/gr-trellis/src/lib/fsm.cc b/gr-trellis/src/lib/fsm.cc
index c65b13456..5950b56b9 100644
--- a/gr-trellis/src/lib/fsm.cc
+++ b/gr-trellis/src/lib/fsm.cc
@@ -86,16 +86,30 @@ fsm::fsm(const char *name)
if((fsmfile=fopen(name,"r"))==NULL)
throw std::runtime_error ("fsm::fsm(const char *name): file open error\n");
//printf("file open error in fsm()\n");
+
+ if(fscanf(fsmfile,"%d %d %d\n",&d_I,&d_S,&d_O) == EOF) {
+ if(ferror(fsmfile) != 0)
+ throw std::runtime_error ("fsm::fsm(const char *name): file read error\n");
+ }
- fscanf(fsmfile,"%d %d %d\n",&d_I,&d_S,&d_O);
d_NS.resize(d_I*d_S);
d_OS.resize(d_I*d_S);
for(int i=0;i<d_S;i++) {
- for(int j=0;j<d_I;j++) fscanf(fsmfile,"%d",&(d_NS[i*d_I+j]));
+ for(int j=0;j<d_I;j++) {
+ if(fscanf(fsmfile,"%d",&(d_NS[i*d_I+j])) == EOF) {
+ if(ferror(fsmfile) != 0)
+ throw std::runtime_error ("fsm::fsm(const char *name): file read error\n");
+ }
+ }
}
for(int i=0;i<d_S;i++) {
- for(int j=0;j<d_I;j++) fscanf(fsmfile,"%d",&(d_OS[i*d_I+j]));
+ for(int j=0;j<d_I;j++) {
+ if(fscanf(fsmfile,"%d",&(d_OS[i*d_I+j])) == EOF) {
+ if(ferror(fsmfile) != 0)
+ throw std::runtime_error ("fsm::fsm(const char *name): file read error\n");
+ }
+ }
}
generate_PS_PI();
diff --git a/gr-trellis/src/lib/interleaver.cc b/gr-trellis/src/lib/interleaver.cc
index 077416f80..ff15eeadc 100644
--- a/gr-trellis/src/lib/interleaver.cc
+++ b/gr-trellis/src/lib/interleaver.cc
@@ -75,11 +75,20 @@ interleaver::interleaver(const char *name)
throw std::runtime_error ("file open error in interleaver()");
//printf("file open error in interleaver()\n");
- fscanf(interleaverfile,"%d\n",&d_K);
+ if(fscanf(interleaverfile,"%d\n",&d_K) == EOF) {
+ if(ferror(interleaverfile) != 0)
+ throw std::runtime_error ("interleaver::interleaver(const char *name): file read error\n");
+ }
+
d_INTER.resize(d_K);
d_DEINTER.resize(d_K);
- for(int i=0;i<d_K;i++) fscanf(interleaverfile,"%d",&(d_INTER[i]));
+ for(int i=0;i<d_K;i++) {
+ if(fscanf(interleaverfile,"%d",&(d_INTER[i])) == EOF) {
+ if(ferror(interleaverfile) != 0)
+ throw std::runtime_error ("interleaver::interleaver(const char *name): file read error\n");
+ }
+ }
// generate DEINTER table
for(int i=0;i<d_K;i++) {
diff --git a/gr-uhd/grc/Makefile.am b/gr-uhd/grc/Makefile.am
index 6a336c893..30061a7ec 100644
--- a/gr-uhd/grc/Makefile.am
+++ b/gr-uhd/grc/Makefile.am
@@ -39,13 +39,6 @@ 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
########################################################################
diff --git a/gr-uhd/grc/uhd_block_tree.xml b/gr-uhd/grc/uhd_block_tree.xml
index e8c4f069d..f5d42b567 100644
--- a/gr-uhd/grc/uhd_block_tree.xml
+++ b/gr-uhd/grc/uhd_block_tree.xml
@@ -13,11 +13,4 @@
<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
deleted file mode 100644
index 13865c913..000000000
--- a/gr-uhd/grc/uhd_mimo_sink.xml
+++ /dev/null
@@ -1,549 +0,0 @@
-<?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
deleted file mode 100644
index 6167838b0..000000000
--- a/gr-uhd/grc/uhd_mimo_source.xml
+++ /dev/null
@@ -1,549 +0,0 @@
-<?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
deleted file mode 100644
index ee6051432..000000000
--- a/gr-uhd/grc/uhd_simple_sink.xml
+++ /dev/null
@@ -1,101 +0,0 @@
-<?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
deleted file mode 100644
index 825981d66..000000000
--- a/gr-uhd/grc/uhd_simple_source.xml
+++ /dev/null
@@ -1,101 +0,0 @@
-<?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/Makefile.am b/gr-uhd/lib/Makefile.am
index eb2ba4a17..1bcfbbbdc 100644
--- a/gr-uhd/lib/Makefile.am
+++ b/gr-uhd/lib/Makefile.am
@@ -24,7 +24,7 @@ include $(top_srcdir)/Makefile.common
AM_CPPFLAGS = \
$(STD_DEFINES_AND_INCLUDES) \
$(WITH_INCLUDES) \
- $(UHD_CFLAGS)
+ $(UHD_CPPFLAGS)
lib_LTLIBRARIES = libgnuradio-uhd.la
@@ -34,13 +34,6 @@ libgnuradio_uhd_la_SOURCES = \
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)
@@ -53,12 +46,4 @@ grinclude_HEADERS = \
uhd_single_usrp_source.h \
uhd_single_usrp_sink.h
-# add the deprecated headers
-grinclude_HEADERS += \
- uhd_mimo_source.h \
- uhd_mimo_sink.h \
- uhd_simple_source.h \
- uhd_simple_sink.h
-
-
noinst_HEADERS =
diff --git a/gr-uhd/lib/uhd_mimo_sink.cc b/gr-uhd/lib/uhd_mimo_sink.cc
deleted file mode 100644
index 03d310b1e..000000000
--- a/gr-uhd/lib/uhd_mimo_sink.cc
+++ /dev/null
@@ -1,161 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2010 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along 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
deleted file mode 100644
index 29e9298a9..000000000
--- a/gr-uhd/lib/uhd_mimo_sink.h
+++ /dev/null
@@ -1,145 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2010 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along 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
deleted file mode 100644
index abd70ba36..000000000
--- a/gr-uhd/lib/uhd_mimo_source.cc
+++ /dev/null
@@ -1,166 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2010 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along 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
deleted file mode 100644
index 36735ae7e..000000000
--- a/gr-uhd/lib/uhd_mimo_source.h
+++ /dev/null
@@ -1,145 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2010 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along 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_simple_sink.cc b/gr-uhd/lib/uhd_simple_sink.cc
deleted file mode 100644
index d7b04465d..000000000
--- a/gr-uhd/lib/uhd_simple_sink.cc
+++ /dev/null
@@ -1,152 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2010 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along 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
deleted file mode 100644
index 930487049..000000000
--- a/gr-uhd/lib/uhd_simple_sink.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2010 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along 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
deleted file mode 100644
index d74c8414d..000000000
--- a/gr-uhd/lib/uhd_simple_source.cc
+++ /dev/null
@@ -1,183 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2010 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along 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
deleted file mode 100644
index d9f8d252a..000000000
--- a/gr-uhd/lib/uhd_simple_source.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2010 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along 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_source.h b/gr-uhd/lib/uhd_single_usrp_source.h
index 495f8c611..2a011b2b3 100644
--- a/gr-uhd/lib/uhd_single_usrp_source.h
+++ b/gr-uhd/lib/uhd_single_usrp_source.h
@@ -168,6 +168,10 @@ public:
* \return the single usrp device object
*/
virtual uhd::usrp::single_usrp::sptr get_device(void) = 0;
+
+ protected:
+ size_t d_num_packet_samps;
+ pmt::pmt_t d_tstamp_pair;
};
#endif /* INCLUDED_UHD_SINGLE_USRP_SOURCE_H */
diff --git a/gr-uhd/swig/Makefile.am b/gr-uhd/swig/Makefile.am
index 11c0cabb2..3b7b3cc60 100644
--- a/gr-uhd/swig/Makefile.am
+++ b/gr-uhd/swig/Makefile.am
@@ -27,9 +27,10 @@ EXTRA_DIST += $(nobase_guile_DATA)
AM_CPPFLAGS = \
$(STD_DEFINES_AND_INCLUDES) \
$(PYTHON_CPPFLAGS) \
- $(WITH_INCLUDES) \
- $(UHD_CFLAGS) \
- -I$(top_srcdir)/gr-uhd/lib
+ $(UHD_CPPFLAGS) \
+ $(WITH_INCLUDES)
+
+uhd_swig_swig_args = $(UHD_CPPFLAGS)
if GUILE
nobase_guile_DATA = \
diff --git a/gr-uhd/swig/uhd_swig.i b/gr-uhd/swig/uhd_swig.i
index c7664157b..079f8120e 100644
--- a/gr-uhd/swig/uhd_swig.i
+++ b/gr-uhd/swig/uhd_swig.i
@@ -51,11 +51,6 @@ namespace std {
// 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>
@@ -88,18 +83,6 @@ namespace std {
////////////////////////////////////////////////////////////////////////
// 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>
diff --git a/gr-utils/src/python/gr_plot_psd.py b/gr-utils/src/python/gr_plot_psd.py
index 0e3dbecd9..f3535d321 100755
--- a/gr-utils/src/python/gr_plot_psd.py
+++ b/gr-utils/src/python/gr_plot_psd.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2007,2008 Free Software Foundation, Inc.
+# Copyright 2007,2008,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -35,6 +35,7 @@ except ImportError:
from optparse import OptionParser
from scipy import log10
+from gnuradio.eng_option import eng_option
class gr_plot_psd:
def __init__(self, datatype, filename, options):
@@ -100,10 +101,10 @@ class gr_plot_psd:
''' Need to do this here and plot later so we can do the fftshift '''
overlap = self.psdfftsize/4
winfunc = scipy.blackman
- psd,freq = self.sp_psd.psd(iq, self.psdfftsize, self.sample_rate,
- window = lambda d: d*winfunc(self.psdfftsize),
- noverlap = overlap, visible=False)
- psd = 10.0*log10(abs(fftpack.fftshift(psd)))
+ psd,freq = mlab.psd(iq, self.psdfftsize, self.sample_rate,
+ window = lambda d: d*winfunc(self.psdfftsize),
+ noverlap = overlap)
+ psd = 10.0*log10(abs(psd))
return (psd, freq)
def make_plots(self):
@@ -159,6 +160,7 @@ class gr_plot_psd:
def draw_psd(self):
self.plot_psd[0].set_data([self.freq, self.iq_psd])
self.sp_psd.set_ylim([min(self.iq_psd)-10, max(self.iq_psd)+10])
+ self.sp_psd.set_xlim([min(self.freq), max(self.freq)])
def draw_spec(self):
overlap = self.specfftsize/4
@@ -236,14 +238,15 @@ def setup_options():
usage="%prog: [options] input_filename"
description = "Takes a GNU Radio binary file (with specified data type using --data-type) and displays the I&Q data versus time as well as the power spectral density (PSD) plot. The y-axis values are plotted assuming volts as the amplitude of the I&Q streams and converted into dBm in the frequency domain (the 1/N power adjustment out of the FFT is performed internally). The script plots a certain block of data at a time, specified on the command line as -B or --block. The start position in the file can be set by specifying -s or --start and defaults to 0 (the start of the file). By default, the system assumes a sample rate of 1, so in time, each sample is plotted versus the sample number. To set a true time and frequency axis, set the sample rate (-R or --sample-rate) to the sample rate used when capturing the samples. Finally, the size of the FFT to use for the PSD and spectrogram plots can be set independently with --psd-size and --spec-size, respectively. The spectrogram plot does not display by default and is turned on with -S or --enable-spec."
- parser = OptionParser(conflict_handler="resolve", usage=usage, description=description)
+ parser = OptionParser(option_class=eng_option, conflict_handler="resolve",
+ usage=usage, description=description)
parser.add_option("-d", "--data-type", type="string", default="complex64",
help="Specify the data type (complex64, float32, (u)int32, (u)int16, (u)int8) [default=%default]")
parser.add_option("-B", "--block", type="int", default=8192,
help="Specify the block size [default=%default]")
parser.add_option("-s", "--start", type="int", default=0,
help="Specify where to start in the file [default=%default]")
- parser.add_option("-R", "--sample-rate", type="float", default=1.0,
+ parser.add_option("-R", "--sample-rate", type="eng_float", default=1.0,
help="Set the sampler rate of the data [default=%default]")
parser.add_option("", "--psd-size", type="int", default=1024,
help="Set the size of the PSD FFT [default=%default]")
diff --git a/usrp/doc/Doxyfile.in b/usrp/doc/Doxyfile.in
index 5043b1471..33c5bcf03 100644
--- a/usrp/doc/Doxyfile.in
+++ b/usrp/doc/Doxyfile.in
@@ -73,16 +73,6 @@ CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English
-# This tag can be used to specify the encoding used in the generated output.
-# The encoding is not always determined by the language that is chosen,
-# but also whether or not the output is meant for Windows or non-Windows users.
-# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES
-# forces the Windows encoding (this is the default for the Windows binary),
-# whereas setting the tag to NO uses a Unix-style encoding (the default for
-# all platforms other than Windows).
-
-USE_WINDOWS_ENCODING = NO
-
# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
# include brief member descriptions after the members that are listed in
# the file and class documentation (similar to JavaDoc).
@@ -167,13 +157,6 @@ JAVADOC_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
-# If the DETAILS_AT_TOP tag is set to YES then Doxygen
-# will output the detailed description near the top, like JavaDoc.
-# If set to NO, the detailed description appears after the member
-# documentation.
-
-DETAILS_AT_TOP = YES
-
# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
# member inherits the documentation from any documented member that it
# re-implements.
@@ -1118,32 +1101,40 @@ DOT_PATH =
DOTFILE_DIRS =
-# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width
-# (in pixels) of the graphs generated by dot. If a graph becomes larger than
-# this value, doxygen will try to truncate the graph, so that it fits within
-# the specified constraint. Beware that most browsers cannot cope with very
-# large images.
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
+# nodes that will be shown in the graph. If the number of nodes in a graph
+# becomes larger than this value, doxygen will truncate the graph, which is
+# visualized by representing a node as a red box. Note that doxygen if the
+# number of direct children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
-MAX_DOT_GRAPH_WIDTH = 1024
+DOT_GRAPH_MAX_NODES = 50
-# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height
-# (in pixels) of the graphs generated by dot. If a graph becomes larger than
-# this value, doxygen will try to truncate the graph, so that it fits within
-# the specified constraint. Beware that most browsers cannot cope with very
-# large images.
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes
+# that lay further from the root node will be omitted. Note that setting this
+# option to 1 or 2 may greatly reduce the computation time needed for large
+# code bases. Also note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
-MAX_DOT_GRAPH_HEIGHT = 1024
+MAX_DOT_GRAPH_DEPTH = 0
-# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
-# graphs generated by dot. A depth value of 3 means that only nodes reachable
-# from the root by following a path via at most 3 edges will be shown. Nodes that
-# lay further from the root node will be omitted. Note that setting this option to
-# 1 or 2 may greatly reduce the computation time needed for large code bases. Also
-# note that a graph may be further truncated if the graph's image dimensions are
-# not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH and MAX_DOT_GRAPH_HEIGHT).
-# If 0 is used for the depth value (the default), the graph is not depth-constrained.
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not
+# seem to support this out of the box. Warning: Depending on the platform used,
+# enabling this option may lead to badly anti-aliased labels on the edges of
+# a graph (i.e. they become hard to read).
-MAX_DOT_GRAPH_DEPTH = 0
+DOT_TRANSPARENT = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10)
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS = YES
# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
# generate a legend page explaining the meaning of the various boxes and