Added files to Makefile.am for distribution.
Added colorbar to spectrogram for magnitude measurement.
Fixed spectrogram plotting axis.
Adding a spectrogram plot. The axis need work.
GR plotter tool handles end of file and files shorter than the block length.
Manages window/filter types better. Disables filter types if the designing algorithm doesn't support it (no RRC or Gaussian for equiripple filters).
User messages if PyQt and PyQwt are not installed (or found).
Setting validators for all edit boxes.
Fixing tab order.
Adding display for the number of taps in the filter.
Adding equiripple band reject filter to filter design app.
Adding P-M version of band reject filter.
Fixed documentation for optfir band pass filters.
Added routine for optfir equiripple filter design code to create complex bandpass filters. Also adds this ability to the filter designer.
Added design for Guassian filters.
Added design for RRC filters.
Added Band Notch filter
Adding complex bandpass filter design (for windowed filters only).
Adding plotting of group delay.
Adding labels to the plots.
...
--- /dev/null
+/configure
+/Makefile.in
+/config.log
+/config.h
+/ltmain.sh
+/Makefile
+/config.status
+/stamp-h1
+/config.h.in
+/autom4te.cache
+/libtool
+/missing
+/aclocal.m4
+/install-sh
+/depcomp
+/py-compile
+/compile
+/build
+/run_tests.sh
+/*-stamp
SUBDIRS = @build_dirs@
DIST_SUBDIRS = @build_dirs@ @skipped_dirs@ @with_dirs@
+
+if PYTHON
+
+export pythondir
+
+install-data-hook:
+ @if ! python -c "import gnuradio" > /dev/null 2>&1; then\
+ printf "\n*** Post-Install Message ***\
+ \nWarning: python could not find the gnuradio module.\
+ \nMake sure that $${pythondir} is in your PYTHONPATH\n\n";\
+ fi
+
+endif
--- /dev/null
+/*.cache
+/*.la
+/*.lo
+/*.pc
+/.deps
+/.la
+/.libs
+/.lo
+/Makefile
+/Makefile.in
+/libtool.m4
+/lt~obsolete.m4
+/ltsugar.m4
+/ltversion.m4
+/ltoptions.m4
grc_gr_trellis.m4 \
grc_gr_usrp.m4 \
grc_gr_video_sdl.m4 \
+ grc_gr_vrt.m4 \
grc_gr_wxgui.m4 \
grc_mblock.m4 \
grc_gruel.m4 \
+ grc_vrt.m4 \
gr_check_createfilemapping.m4 \
gr_check_mc4020.m4 \
gr_check_shm_open.m4 \
--- /dev/null
+dnl Copyright 2008,2009 Free Software Foundation, Inc.
+dnl
+dnl This file is part of GNU Radio
+dnl
+dnl GNU Radio is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 3, or (at your option)
+dnl any later version.
+dnl
+dnl GNU Radio is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+dnl GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with GNU Radio; see the file COPYING. If not, write to
+dnl the Free Software Foundation, Inc., 51 Franklin Street,
+dnl Boston, MA 02110-1301, USA.
+
+AC_DEFUN([GRC_GR_VRT],[
+ GRC_ENABLE(gr-vrt)
+
+ dnl Don't do gr-usrp if gnuradio-core or vrt skipped
+ GRC_CHECK_DEPENDENCY(gr-vrt, vrt)
+ GRC_CHECK_DEPENDENCY(gr-vrt, gnuradio-core)
+
+ AC_CONFIG_FILES([ \
+ gr-vrt/Makefile \
+ gr-vrt/gnuradio-vrt.pc \
+ gr-vrt/src/Makefile \
+ gr-vrt/src/run_tests \
+ ])
+
+ GRC_BUILD_CONDITIONAL(gr-vrt,[
+ dnl run_tests is created from run_tests.in. Make it executable.
+ AC_CONFIG_COMMANDS([run_tests_vrt], [chmod +x gr-vrt/src/run_tests])
+ ])
+])
--- /dev/null
+dnl Copyright 2008,2009 Free Software Foundation, Inc.
+dnl
+dnl This file is part of GNU Radio
+dnl
+dnl GNU Radio is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 3, or (at your option)
+dnl any later version.
+dnl
+dnl GNU Radio is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+dnl GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with GNU Radio; see the file COPYING. If not, write to
+dnl the Free Software Foundation, Inc., 51 Franklin Street,
+dnl Boston, MA 02110-1301, USA.
+
+AC_DEFUN([GRC_VRT],[
+ GRC_ENABLE(vrt)
+
+ dnl If execution gets to here, $passed will be:
+ dnl with : if the --with code didn't error out
+ dnl yes : if the --enable code passed muster and all dependencies are met
+ dnl no : otherwise
+ if test $passed = yes; then
+ dnl Needed for vrt_socket_opener
+ AC_CHECK_HEADERS(arpa/inet.h byteswap.h linux/if_packet.h sys/socket.h sys/un.h)
+ fi
+ if test $passed != with; then
+ dnl how and where to find INCLUDES and LA
+ VRT_INCLUDES="-I\${abs_top_srcdir}/vrt/include"
+ VRT_LA="\${abs_top_builddir}/vrt/lib/libvrt.la"
+ fi
+
+ # Test host OS compatibility
+ AC_MSG_CHECKING([whether host_os is linux*])
+ case "$host_os" in
+ linux*)
+ AC_MSG_RESULT([yes])
+ ;;
+ *)
+ AC_MSG_RESULT([no])
+ AC_MSG_NOTICE([libvrt currently requires Linux host OS, not found])
+ passed="no"
+ ;;
+ esac
+
+ dnl Include the vrt INCLUDES and LA
+ AC_SUBST(VRT_INCLUDES)
+ AC_SUBST(VRT_LA)
+
+ AC_CONFIG_FILES([
+ vrt/Makefile
+ vrt/vrt.pc
+ vrt/include/Makefile
+ vrt/include/vrt/Makefile
+ vrt/lib/Makefile
+ vrt/apps/Makefile
+ ])
+
+ GRC_BUILD_CONDITIONAL(vrt)
+])
GRC_MBLOCK dnl this must come after GRC_GRUEL
GRC_USRP
GRC_USRP2
+GRC_VRT
GRC_GR_USRP dnl this must come after GRC_USRP
GRC_GR_USRP2
+GRC_GR_VRT
GRC_GR_GCELL dnl this must come after GRC_GCELL and GRC_GNURADIO_CORE
GRC_GR_MSDD6000
GRC_GR_AUDIO_ALSA
--- /dev/null
+/changelog
+/*.log
--- /dev/null
+/Makefile.in
+/Makefile
--- /dev/null
+/Makefile
+/Makefile.in
+/html
+/latex
+/xml
+/man
+/Doxyfile
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
--- /dev/null
+/Makefile
+/Makefile.in
+/html
+/latex
+/man
+/Doxyfile
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.xml
+/combine.xslt
+/compound.xsd
+/index.xsd
--- /dev/null
+/exploring-gnuradio.html
--- /dev/null
+/howto-write-a-block.html
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/gcell.pc
+/gcell_spu.pc
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/test_all
+/benchmark_nop
+/benchmark_dma
+/benchmark_roundtrip
--- /dev/null
+/Makefile
+/Makefile.in
+/*.a
+/*.la
+/*.lo
+/.deps
+/.libs
+/benchmark_procs
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
--- /dev/null
+/Makefile
+/Makefile.in
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.a
+/*.o
--- /dev/null
+/Makefile
+/Makefile.in
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.a
+/*.o
--- /dev/null
+/Makefile
+/Makefile.in
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.a
+/*.o
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
--- /dev/null
+/Makefile
+/Makefile.in
+/*.a
+/*.la
+/*.lo
+/.deps
+/.libs
+/test_spu
+/gcell_spu_main
+/gcell_qa
--- /dev/null
+/Makefile
+/Makefile.in
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.a
+/*.o
+/gcell_general_qa
+/gcell_runtime_qa
+/gcell_all
--- /dev/null
+/Makefile
+/Makefile.in
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.a
+/*.o
--- /dev/null
+/Makefile
+/Makefile.in
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.a
+/*.o
--- /dev/null
+/*.cache
+/*.la
+/*.lo
+/*.pc
+/.deps
+/.la
+/.libs
+/.lo
+/Makefile
+/Makefile.in
+/aclocal.m4
+/autom4te.cache
+/config.cache
+/config.h
+/config.h.in
+/config.log
+/config.status
+/configure
+/depcomp
+/install-sh
+/libtool
+/ltmain.sh
+/make.log
+/missing
+/missing
+/mkinstalldirs
+/py-compile
+/stamp-h
+/stamp-h.in
+/stamp-h1
+/stamp-h1.in
+/stamp-h2.in
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
--- /dev/null
+/Makefile
+/Makefile.in
+/.deps
+/.libs
+/*.la
+/*.lo
+/gen_interpolator_taps
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/gnuradio-config-info
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.pyc
+/generate-stamp
+/#
+/---
+/generate
+/files:
+/don't
+/go
+/in
+/CVS
+/---
+/GrFIRfilterCCC.cc
+/GrFIRfilterCCC.h
+/GrFIRfilterCCF.cc
+/GrFIRfilterCCF.h
+/GrFIRfilterFCC.cc
+/GrFIRfilterFCC.h
+/GrFIRfilterFFF.cc
+/GrFIRfilterFFF.h
+/GrFIRfilterFSF.cc
+/GrFIRfilterFSF.h
+/GrFIRfilterSCC.cc
+/GrFIRfilterSCC.h
+/GrFIRfilterSIS.cc
+/GrFIRfilterSIS.h
+/GrFreqXlatingFIRfilterCCC.cc
+/GrFreqXlatingFIRfilterCCC.h
+/GrFreqXlatingFIRfilterCCF.cc
+/GrFreqXlatingFIRfilterCCF.h
+/GrFreqXlatingFIRfilterFCC.cc
+/GrFreqXlatingFIRfilterFCC.h
+/GrFreqXlatingFIRfilterFCF.cc
+/GrFreqXlatingFIRfilterFCF.h
+/GrFreqXlatingFIRfilterSCC.cc
+/GrFreqXlatingFIRfilterSCC.h
+/GrFreqXlatingFIRfilterSCF.cc
+/GrFreqXlatingFIRfilterSCF.h
+/gr_fir_CCC.cc
+/gr_fir_CCC.h
+/gr_fir_CCC_generic.cc
+/gr_fir_CCC_generic.h
+/gr_fir_CCF.cc
+/gr_fir_CCF.h
+/gr_fir_CCF_generic.cc
+/gr_fir_CCF_generic.h
+/gr_fir_FCC.cc
+/gr_fir_FCC.h
+/gr_fir_FCC_generic.cc
+/gr_fir_FCC_generic.h
+/gr_fir_FFF.cc
+/gr_fir_FFF.h
+/gr_fir_FFF_generic.cc
+/gr_fir_FFF_generic.h
+/gr_fir_FSF.cc
+/gr_fir_FSF.h
+/gr_fir_FSF_generic.cc
+/gr_fir_FSF_generic.h
+/gr_fir_SCC.cc
+/gr_fir_SCC.h
+/gr_fir_SCC_generic.cc
+/gr_fir_SCC_generic.h
+/gr_fir_SIS.cc
+/gr_fir_SIS.h
+/gr_fir_SIS_generic.cc
+/gr_fir_SIS_generic.h
+/gr_fir_sysconfig.cc
+/gr_fir_sysconfig.h
+/gr_fir_sysconfig_generic.cc
+/gr_fir_sysconfig_generic.h
+/gr_fir_util.cc
+/gr_fir_util.h
+/GrFIRfilterCCC.i
+/GrFIRfilterCCF.i
+/GrFIRfilterFCC.i
+/GrFIRfilterFFF.i
+/GrFIRfilterFSF.i
+/GrFIRfilterSCC.i
+/GrFIRfilterSIS.i
+/GrFreqXlatingFIRfilterCCC.i
+/GrFreqXlatingFIRfilterCCF.i
+/GrFreqXlatingFIRfilterFCC.i
+/GrFreqXlatingFIRfilterFCF.i
+/GrFreqXlatingFIRfilterSCC.i
+/GrFreqXlatingFIRfilterSCF.i
+/#
+/---
+/end
+/generated
+/files
+/---
+/filter_generated.i
+/gr_fir_ccc.cc
+/gr_fir_ccc.h
+/gr_fir_ccc_generic.cc
+/gr_fir_ccc_generic.h
+/gr_fir_ccf.cc
+/gr_fir_ccf.h
+/gr_fir_ccf_generic.cc
+/gr_fir_ccf_generic.h
+/gr_fir_fcc.cc
+/gr_fir_fcc.h
+/gr_fir_fcc_generic.cc
+/gr_fir_fcc_generic.h
+/gr_fir_fff.cc
+/gr_fir_fff.h
+/gr_fir_fff_generic.cc
+/gr_fir_fff_generic.h
+/gr_fir_fsf.cc
+/gr_fir_fsf.h
+/gr_fir_fsf_generic.cc
+/gr_fir_fsf_generic.h
+/gr_fir_scc.cc
+/gr_fir_scc.h
+/gr_fir_scc_generic.cc
+/gr_fir_scc_generic.h
+/gr_fir_filter_ccc.cc
+/gr_fir_filter_ccc.h
+/gr_fir_filter_ccc.i
+/gr_fir_filter_ccf.cc
+/gr_fir_filter_ccf.h
+/gr_fir_filter_ccf.i
+/gr_fir_filter_fcc.cc
+/gr_fir_filter_fcc.h
+/gr_fir_filter_fcc.i
+/gr_fir_filter_fff.cc
+/gr_fir_filter_fff.h
+/gr_fir_filter_fff.i
+/gr_fir_filter_fsf.cc
+/gr_fir_filter_fsf.h
+/gr_fir_filter_fsf.i
+/gr_fir_filter_scc.cc
+/gr_fir_filter_scc.h
+/gr_fir_filter_scc.i
+/gr_freq_xlating_fir_filter_ccc.cc
+/gr_freq_xlating_fir_filter_ccc.h
+/gr_freq_xlating_fir_filter_ccc.i
+/gr_freq_xlating_fir_filter_ccf.cc
+/gr_freq_xlating_fir_filter_ccf.h
+/gr_freq_xlating_fir_filter_ccf.i
+/gr_freq_xlating_fir_filter_fcc.cc
+/gr_freq_xlating_fir_filter_fcc.h
+/gr_freq_xlating_fir_filter_fcc.i
+/gr_freq_xlating_fir_filter_fcf.cc
+/gr_freq_xlating_fir_filter_fcf.h
+/gr_freq_xlating_fir_filter_fcf.i
+/gr_freq_xlating_fir_filter_scc.cc
+/gr_freq_xlating_fir_filter_scc.h
+/gr_freq_xlating_fir_filter_scc.i
+/gr_freq_xlating_fir_filter_scf.cc
+/gr_freq_xlating_fir_filter_scf.h
+/gr_freq_xlating_fir_filter_scf.i
+/gr_interp_fir_filter_ccc.cc
+/gr_interp_fir_filter_ccc.h
+/gr_interp_fir_filter_ccc.i
+/gr_interp_fir_filter_ccf.cc
+/gr_interp_fir_filter_ccf.h
+/gr_interp_fir_filter_ccf.i
+/gr_interp_fir_filter_fcc.cc
+/gr_interp_fir_filter_fcc.h
+/gr_interp_fir_filter_fcc.i
+/gr_interp_fir_filter_fff.cc
+/gr_interp_fir_filter_fff.h
+/gr_interp_fir_filter_fff.i
+/gr_interp_fir_filter_fsf.cc
+/gr_interp_fir_filter_fsf.h
+/gr_interp_fir_filter_fsf.i
+/gr_interp_fir_filter_scc.cc
+/gr_interp_fir_filter_scc.h
+/gr_interp_fir_filter_scc.i
+/gr_rational_resampler_ccc.cc
+/gr_rational_resampler_ccc.h
+/gr_rational_resampler_ccc.i
+/gr_rational_resampler_ccf.cc
+/gr_rational_resampler_ccf.h
+/gr_rational_resampler_ccf.i
+/gr_rational_resampler_fcc.cc
+/gr_rational_resampler_fcc.h
+/gr_rational_resampler_fcc.i
+/gr_rational_resampler_fff.cc
+/gr_rational_resampler_fff.h
+/gr_rational_resampler_fff.i
+/gr_rational_resampler_fsf.cc
+/gr_rational_resampler_fsf.h
+/gr_rational_resampler_fsf.i
+/gr_rational_resampler_scc.cc
+/gr_rational_resampler_scc.h
+/gr_rational_resampler_scc.i
+/gr_rational_resampler_base_ccc.cc
+/gr_rational_resampler_base_ccc.h
+/gr_rational_resampler_base_ccc.i
+/gr_rational_resampler_base_ccf.cc
+/gr_rational_resampler_base_ccf.h
+/gr_rational_resampler_base_ccf.i
+/gr_rational_resampler_base_fcc.cc
+/gr_rational_resampler_base_fcc.h
+/gr_rational_resampler_base_fcc.i
+/gr_rational_resampler_base_fff.cc
+/gr_rational_resampler_base_fff.h
+/gr_rational_resampler_base_fff.i
+/gr_rational_resampler_base_fsf.cc
+/gr_rational_resampler_base_fsf.h
+/gr_rational_resampler_base_fsf.i
+/gr_rational_resampler_base_scc.cc
+/gr_rational_resampler_base_scc.h
+/gr_rational_resampler_base_scc.i
+/stamp-*
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.pyc
+/generate-stamp
+/gr_constants.cc
+/GrFIRfilterCCC.cc
+/GrFIRfilterCCC.h
+/GrFIRfilterCCF.cc
+/GrFIRfilterCCF.h
+/GrFIRfilterFCC.cc
+/GrFIRfilterFCC.h
+/GrFIRfilterFFF.cc
+/GrFIRfilterFFF.h
+/GrFIRfilterFSF.cc
+/GrFIRfilterFSF.h
+/GrFIRfilterSCC.cc
+/GrFIRfilterSCC.h
+/GrFIRfilterSIS.cc
+/GrFIRfilterSIS.h
+/GrFreqXlatingFIRfilterCCC.cc
+/GrFreqXlatingFIRfilterCCC.h
+/GrFreqXlatingFIRfilterCCF.cc
+/GrFreqXlatingFIRfilterCCF.h
+/GrFreqXlatingFIRfilterFCC.cc
+/GrFreqXlatingFIRfilterFCC.h
+/GrFreqXlatingFIRfilterFCF.cc
+/GrFreqXlatingFIRfilterFCF.h
+/GrFreqXlatingFIRfilterSCC.cc
+/GrFreqXlatingFIRfilterSCC.h
+/GrFreqXlatingFIRfilterSCF.cc
+/GrFreqXlatingFIRfilterSCF.h
+/gr_fir_CCC.cc
+/gr_fir_CCC.h
+/gr_fir_CCC_generic.cc
+/gr_fir_CCC_generic.h
+/gr_fir_CCF.cc
+/gr_fir_CCF.h
+/gr_fir_CCF_generic.cc
+/gr_fir_CCF_generic.h
+/gr_fir_FCC.cc
+/gr_fir_FCC.h
+/gr_fir_FCC_generic.cc
+/gr_fir_FCC_generic.h
+/gr_fir_FFF.cc
+/gr_fir_FFF.h
+/gr_fir_FFF_generic.cc
+/gr_fir_FFF_generic.h
+/gr_fir_FSF.cc
+/gr_fir_FSF.h
+/gr_fir_FSF_generic.cc
+/gr_fir_FSF_generic.h
+/gr_fir_SCC.cc
+/gr_fir_SCC.h
+/gr_fir_SCC_generic.cc
+/gr_fir_SCC_generic.h
+/gr_fir_SIS.cc
+/gr_fir_SIS.h
+/gr_fir_SIS_generic.cc
+/gr_fir_SIS_generic.h
+/gr_fir_sysconfig.cc
+/gr_fir_sysconfig.h
+/gr_fir_sysconfig_generic.cc
+/gr_fir_sysconfig_generic.h
+/gr_fir_util.cc
+/gr_fir_util.h
+/GrFIRfilterCCC.i
+/GrFIRfilterCCF.i
+/GrFIRfilterFCC.i
+/GrFIRfilterFFF.i
+/GrFIRfilterFSF.i
+/GrFIRfilterSCC.i
+/GrFIRfilterSIS.i
+/GrFreqXlatingFIRfilterCCC.i
+/GrFreqXlatingFIRfilterCCF.i
+/GrFreqXlatingFIRfilterFCC.i
+/GrFreqXlatingFIRfilterFCF.i
+/GrFreqXlatingFIRfilterSCC.i
+/GrFreqXlatingFIRfilterSCF.i
+/# --- generated files ---
+/gr_add_cc.cc
+/gr_add_cc.h
+/gr_add_cc.i
+/gr_add_const_c.cc
+/gr_add_const_c.h
+/gr_add_const_c.i
+/gr_add_const_cc.cc
+/gr_add_const_cc.h
+/gr_add_const_cc.i
+/gr_add_const_f.cc
+/gr_add_const_f.h
+/gr_add_const_f.i
+/gr_add_const_ff.cc
+/gr_add_const_ff.h
+/gr_add_const_ff.i
+/gr_add_const_i.cc
+/gr_add_const_i.h
+/gr_add_const_i.i
+/gr_add_const_ii.cc
+/gr_add_const_ii.h
+/gr_add_const_ii.i
+/gr_add_const_s.cc
+/gr_add_const_s.h
+/gr_add_const_s.i
+/gr_add_const_sf.cc
+/gr_add_const_sf.h
+/gr_add_const_sf.i
+/gr_add_const_ss.cc
+/gr_add_const_ss.h
+/gr_add_const_ss.i
+/gr_add_const_vcc.cc
+/gr_add_const_vcc.h
+/gr_add_const_vcc.i
+/gr_add_const_vff.cc
+/gr_add_const_vff.h
+/gr_add_const_vff.i
+/gr_add_const_vii.cc
+/gr_add_const_vii.h
+/gr_add_const_vii.i
+/gr_add_const_vss.cc
+/gr_add_const_vss.h
+/gr_add_const_vss.i
+/gr_add_ff.cc
+/gr_add_ff.h
+/gr_add_ff.i
+/gr_add_ii.cc
+/gr_add_ii.h
+/gr_add_ii.i
+/gr_add_ss.cc
+/gr_add_ss.h
+/gr_add_ss.i
+/gr_add_vcc.cc
+/gr_add_vcc.h
+/gr_add_vcc.i
+/gr_add_vff.cc
+/gr_add_vff.h
+/gr_add_vff.i
+/gr_add_vii.cc
+/gr_add_vii.h
+/gr_add_vii.i
+/gr_add_vss.cc
+/gr_add_vss.h
+/gr_add_vss.i
+/gr_divide_cc.cc
+/gr_divide_cc.h
+/gr_divide_cc.i
+/gr_divide_ff.cc
+/gr_divide_ff.h
+/gr_divide_ff.i
+/gr_divide_ii.cc
+/gr_divide_ii.h
+/gr_divide_ii.i
+/gr_divide_ss.cc
+/gr_divide_ss.h
+/gr_divide_ss.i
+/gr_multiply_cc.cc
+/gr_multiply_cc.h
+/gr_multiply_cc.i
+/gr_multiply_const_cc.cc
+/gr_multiply_const_cc.h
+/gr_multiply_const_cc.i
+/gr_multiply_const_ff.cc
+/gr_multiply_const_ff.h
+/gr_multiply_const_ff.i
+/gr_multiply_const_ii.cc
+/gr_multiply_const_ii.h
+/gr_multiply_const_ii.i
+/gr_multiply_const_ss.cc
+/gr_multiply_const_ss.h
+/gr_multiply_const_ss.i
+/gr_multiply_ff.cc
+/gr_multiply_ff.h
+/gr_multiply_ff.i
+/gr_multiply_ii.cc
+/gr_multiply_ii.h
+/gr_multiply_ii.i
+/gr_multiply_ss.cc
+/gr_multiply_ss.h
+/gr_multiply_ss.i
+/gr_multiply_vcc.cc
+/gr_multiply_vcc.h
+/gr_multiply_vcc.i
+/gr_multiply_vff.cc
+/gr_multiply_vff.h
+/gr_multiply_vff.i
+/gr_multiply_vii.cc
+/gr_multiply_vii.h
+/gr_multiply_vii.i
+/gr_multiply_vss.cc
+/gr_multiply_vss.h
+/gr_multiply_vss.i
+/gr_multiply_const_vcc.cc
+/gr_multiply_const_vcc.h
+/gr_multiply_const_vcc.i
+/gr_multiply_const_vff.cc
+/gr_multiply_const_vff.h
+/gr_multiply_const_vff.i
+/gr_multiply_const_vii.cc
+/gr_multiply_const_vii.h
+/gr_multiply_const_vii.i
+/gr_multiply_const_vss.cc
+/gr_multiply_const_vss.h
+/gr_multiply_const_vss.i
+/gr_noise_source_c.cc
+/gr_noise_source_c.h
+/gr_noise_source_c.i
+/gr_noise_source_f.cc
+/gr_noise_source_f.h
+/gr_noise_source_f.i
+/gr_noise_source_i.cc
+/gr_noise_source_i.h
+/gr_noise_source_i.i
+/gr_noise_source_s.cc
+/gr_noise_source_s.h
+/gr_noise_source_s.i
+/gr_sig_source_c.cc
+/gr_sig_source_c.h
+/gr_sig_source_c.i
+/gr_sig_source_f.cc
+/gr_sig_source_f.h
+/gr_sig_source_f.i
+/gr_sig_source_i.cc
+/gr_sig_source_i.h
+/gr_sig_source_i.i
+/gr_sig_source_s.cc
+/gr_sig_source_s.h
+/gr_sig_source_s.i
+/gr_sub_cc.cc
+/gr_sub_cc.h
+/gr_sub_cc.i
+/gr_sub_ff.cc
+/gr_sub_ff.h
+/gr_sub_ff.i
+/gr_sub_ii.cc
+/gr_sub_ii.h
+/gr_sub_ii.i
+/gr_sub_ss.cc
+/gr_sub_ss.h
+/gr_sub_ss.i
+/gr_vector_sink_b.cc
+/gr_vector_sink_b.h
+/gr_vector_sink_b.i
+/gr_vector_sink_c.cc
+/gr_vector_sink_c.h
+/gr_vector_sink_c.i
+/gr_vector_sink_f.cc
+/gr_vector_sink_f.h
+/gr_vector_sink_f.i
+/gr_vector_sink_i.cc
+/gr_vector_sink_i.h
+/gr_vector_sink_i.i
+/gr_vector_sink_s.cc
+/gr_vector_sink_s.h
+/gr_vector_sink_s.i
+/gr_vector_source_b.cc
+/gr_vector_source_b.h
+/gr_vector_source_b.i
+/gr_vector_source_c.cc
+/gr_vector_source_c.h
+/gr_vector_source_c.i
+/gr_vector_source_f.cc
+/gr_vector_source_f.h
+/gr_vector_source_f.i
+/gr_vector_source_i.cc
+/gr_vector_source_i.h
+/gr_vector_source_i.i
+/gr_vector_source_s.cc
+/gr_vector_source_s.h
+/gr_vector_source_s.i
+/gr_mute_cc.cc
+/gr_mute_cc.h
+/gr_mute_cc.i
+/gr_mute_ff.cc
+/gr_mute_ff.h
+/gr_mute_ff.i
+/gr_mute_ii.cc
+/gr_mute_ii.h
+/gr_mute_ii.i
+/gr_mute_ss.cc
+/gr_mute_ss.h
+/gr_mute_ss.i
+/gr_chunks_to_symbols_bc.cc
+/gr_chunks_to_symbols_bc.h
+/gr_chunks_to_symbols_bc.i
+/gr_chunks_to_symbols_bf.cc
+/gr_chunks_to_symbols_bf.h
+/gr_chunks_to_symbols_bf.i
+/gr_chunks_to_symbols_ic.cc
+/gr_chunks_to_symbols_ic.h
+/gr_chunks_to_symbols_ic.i
+/gr_chunks_to_symbols_if.cc
+/gr_chunks_to_symbols_if.h
+/gr_chunks_to_symbols_if.i
+/gr_chunks_to_symbols_sc.cc
+/gr_chunks_to_symbols_sc.h
+/gr_chunks_to_symbols_sc.i
+/gr_chunks_to_symbols_sf.cc
+/gr_chunks_to_symbols_sf.h
+/gr_chunks_to_symbols_sf.i
+/gr_packed_to_unpacked_bb.cc
+/gr_packed_to_unpacked_bb.h
+/gr_packed_to_unpacked_bb.i
+/gr_packed_to_unpacked_ii.cc
+/gr_packed_to_unpacked_ii.h
+/gr_packed_to_unpacked_ii.i
+/gr_packed_to_unpacked_ss.cc
+/gr_packed_to_unpacked_ss.h
+/gr_packed_to_unpacked_ss.i
+/gr_unpacked_to_packed_bb.cc
+/gr_unpacked_to_packed_bb.h
+/gr_unpacked_to_packed_bb.i
+/gr_unpacked_to_packed_ii.cc
+/gr_unpacked_to_packed_ii.h
+/gr_unpacked_to_packed_ii.i
+/gr_unpacked_to_packed_ss.cc
+/gr_unpacked_to_packed_ss.h
+/gr_unpacked_to_packed_ss.i
+/# --- end generated files ---
/* -*- c++ -*- */
/*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004,2009 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
{
}
-gr_block_sptr
+gr_head_sptr
gr_make_head (size_t sizeof_stream_item, int nitems)
{
- return gr_block_sptr (new gr_head (sizeof_stream_item, nitems));
+ return gnuradio::get_initial_sptr(new gr_head (sizeof_stream_item, nitems));
}
int
/* -*- c++ -*- */
/*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004,2009 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
#include <gr_sync_block.h>
#include <stddef.h> // size_t
+class gr_head;
+typedef boost::shared_ptr<gr_head> gr_head_sptr;
+
/*!
* \brief copies the first N items to the output then signals done
* \ingroup slicedice_blk
class gr_head : public gr_sync_block
{
- friend gr_block_sptr gr_make_head (size_t sizeof_stream_item, int nitems);
+ friend gr_head_sptr gr_make_head (size_t sizeof_stream_item, int nitems);
gr_head (size_t sizeof_stream_item, int nitems);
int d_nitems;
int work (int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
+
+ void reset() { d_ncopied_items = 0; }
};
-gr_block_sptr
+gr_head_sptr
gr_make_head (size_t sizeof_stream_item, int nitems);
/* -*- c++ -*- */
/*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004,2009 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* Boston, MA 02110-1301, USA.
*/
-%ignore gr_head;
+GR_SWIG_BLOCK_MAGIC(gr,head);
+
+gr_head_sptr gr_make_head(size_t sizeof_stream_item, int nitems);
+
class gr_head : public gr_block {
- friend gr_block_sptr gr_make_head (size_t sizeof_stream_item, int nitems);
- gr_head (size_t sizeof_stream_item, int nitems);
+ gr_head();
+public:
+ void reset();
};
-%rename(head) gr_make_head;
-gr_block_sptr gr_make_head (size_t sizeof_stream_item, int nitems);
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.pyc
+/generate-stamp
+/GrFIRfilterCCC.cc
+/GrFIRfilterCCC.h
+/GrFIRfilterCCF.cc
+/GrFIRfilterCCF.h
+/GrFIRfilterFCC.cc
+/GrFIRfilterFCC.h
+/GrFIRfilterFFF.cc
+/GrFIRfilterFFF.h
+/GrFIRfilterFSF.cc
+/GrFIRfilterFSF.h
+/GrFIRfilterSCC.cc
+/GrFIRfilterSCC.h
+/GrFIRfilterSIS.cc
+/GrFIRfilterSIS.h
+/GrFreqXlatingFIRfilterCCC.cc
+/GrFreqXlatingFIRfilterCCC.h
+/GrFreqXlatingFIRfilterCCF.cc
+/GrFreqXlatingFIRfilterCCF.h
+/GrFreqXlatingFIRfilterFCC.cc
+/GrFreqXlatingFIRfilterFCC.h
+/GrFreqXlatingFIRfilterFCF.cc
+/GrFreqXlatingFIRfilterFCF.h
+/GrFreqXlatingFIRfilterSCC.cc
+/GrFreqXlatingFIRfilterSCC.h
+/GrFreqXlatingFIRfilterSCF.cc
+/GrFreqXlatingFIRfilterSCF.h
+/gr_fir_CCC.cc
+/gr_fir_CCC.h
+/gr_fir_CCC_generic.cc
+/gr_fir_CCC_generic.h
+/gr_fir_CCF.cc
+/gr_fir_CCF.h
+/gr_fir_CCF_generic.cc
+/gr_fir_CCF_generic.h
+/gr_fir_FCC.cc
+/gr_fir_FCC.h
+/gr_fir_FCC_generic.cc
+/gr_fir_FCC_generic.h
+/gr_fir_FFF.cc
+/gr_fir_FFF.h
+/gr_fir_FFF_generic.cc
+/gr_fir_FFF_generic.h
+/gr_fir_FSF.cc
+/gr_fir_FSF.h
+/gr_fir_FSF_generic.cc
+/gr_fir_FSF_generic.h
+/gr_fir_SCC.cc
+/gr_fir_SCC.h
+/gr_fir_SCC_generic.cc
+/gr_fir_SCC_generic.h
+/gr_fir_SIS.cc
+/gr_fir_SIS.h
+/gr_fir_SIS_generic.cc
+/gr_fir_SIS_generic.h
+/gr_fir_sysconfig.cc
+/gr_fir_sysconfig.h
+/gr_fir_sysconfig_generic.cc
+/gr_fir_sysconfig_generic.h
+/gr_fir_util.cc
+/gr_fir_util.h
+/GrFIRfilterCCC.i
+/GrFIRfilterCCF.i
+/GrFIRfilterFCC.i
+/GrFIRfilterFFF.i
+/GrFIRfilterFSF.i
+/GrFIRfilterSCC.i
+/GrFIRfilterSIS.i
+/GrFreqXlatingFIRfilterCCC.i
+/GrFreqXlatingFIRfilterCCF.i
+/GrFreqXlatingFIRfilterFCC.i
+/GrFreqXlatingFIRfilterFCF.i
+/GrFreqXlatingFIRfilterSCC.i
+/GrFreqXlatingFIRfilterSCF.i
+/# --- generated files ---
+/gr_add_cc.cc
+/gr_add_cc.h
+/gr_add_cc.i
+/gr_add_const_c.cc
+/gr_add_const_cc.cc
+/gr_add_const_cc.h
+/gr_add_const_cc.i
+/gr_add_const_c.h
+/gr_add_const_c.i
+/gr_add_const_f.cc
+/gr_add_const_ff.cc
+/gr_add_const_ff.h
+/gr_add_const_ff.i
+/gr_add_const_f.h
+/gr_add_const_f.i
+/gr_add_const_i.cc
+/gr_add_const_i.h
+/gr_add_const_i.i
+/gr_add_const_ii.cc
+/gr_add_const_ii.h
+/gr_add_const_ii.i
+/gr_add_const_s.cc
+/gr_add_const_sf.cc
+/gr_add_const_sf.h
+/gr_add_const_sf.i
+/gr_add_const_s.h
+/gr_add_const_s.i
+/gr_add_const_ss.cc
+/gr_add_const_ss.h
+/gr_add_const_ss.i
+/gr_add_const_vcc.cc
+/gr_add_const_vcc.h
+/gr_add_const_vcc.i
+/gr_add_const_vff.cc
+/gr_add_const_vff.h
+/gr_add_const_vff.i
+/gr_add_const_vii.cc
+/gr_add_const_vii.h
+/gr_add_const_vii.i
+/gr_add_const_vss.cc
+/gr_add_const_vss.h
+/gr_add_const_vss.i
+/gr_add_ff.cc
+/gr_add_ff.h
+/gr_add_ff.i
+/gr_add_ii.cc
+/gr_add_ii.h
+/gr_add_ii.i
+/gr_add_ss.cc
+/gr_add_ss.h
+/gr_add_ss.i
+/gr_and_bb.cc
+/gr_and_bb.h
+/gr_and_bb.i
+/gr_and_ii.cc
+/gr_and_ii.h
+/gr_and_ii.i
+/gr_and_ss.cc
+/gr_and_ss.h
+/gr_and_ss.i
+/gr_argmax_fs.cc
+/gr_argmax_fs.h
+/gr_argmax_fs.i
+/gr_argmax_is.cc
+/gr_argmax_is.h
+/gr_argmax_is.i
+/gr_argmax_ss.cc
+/gr_argmax_ss.h
+/gr_argmax_ss.i
+/gr_chunks_to_symbols_bc.cc
+/gr_chunks_to_symbols_bc.h
+/gr_chunks_to_symbols_bc.i
+/gr_chunks_to_symbols_bf.cc
+/gr_chunks_to_symbols_bf.h
+/gr_chunks_to_symbols_bf.i
+/gr_chunks_to_symbols_ic.cc
+/gr_chunks_to_symbols_ic.h
+/gr_chunks_to_symbols_ic.i
+/gr_chunks_to_symbols_if.cc
+/gr_chunks_to_symbols_if.h
+/gr_chunks_to_symbols_if.i
+/gr_chunks_to_symbols_sc.cc
+/gr_chunks_to_symbols_sc.h
+/gr_chunks_to_symbols_sc.i
+/gr_chunks_to_symbols_sf.cc
+/gr_chunks_to_symbols_sf.h
+/gr_chunks_to_symbols_sf.i
+/gr_divide_cc.cc
+/gr_divide_cc.h
+/gr_divide_cc.i
+/gr_divide_ff.cc
+/gr_divide_ff.h
+/gr_divide_ff.i
+/gr_divide_ii.cc
+/gr_divide_ii.h
+/gr_divide_ii.i
+/gr_divide_ss.cc
+/gr_divide_ss.h
+/gr_divide_ss.i
+/gr_integrate_cc.cc
+/gr_integrate_cc.h
+/gr_integrate_cc.i
+/gr_integrate_ff.cc
+/gr_integrate_ff.h
+/gr_integrate_ff.i
+/gr_integrate_ii.cc
+/gr_integrate_ii.h
+/gr_integrate_ii.i
+/gr_integrate_ss.cc
+/gr_integrate_ss.h
+/gr_integrate_ss.i
+/gr_max_ff.cc
+/gr_max_ff.h
+/gr_max_ff.i
+/gr_max_ii.cc
+/gr_max_ii.h
+/gr_max_ii.i
+/gr_max_ss.cc
+/gr_max_ss.h
+/gr_max_ss.i
+/gr_multiply_cc.cc
+/gr_multiply_cc.h
+/gr_multiply_cc.i
+/gr_multiply_const_cc.cc
+/gr_multiply_const_cc.h
+/gr_multiply_const_cc.i
+/gr_multiply_const_ff.cc
+/gr_multiply_const_ff.h
+/gr_multiply_const_ff.i
+/gr_multiply_const_ii.cc
+/gr_multiply_const_ii.h
+/gr_multiply_const_ii.i
+/gr_multiply_const_ss.cc
+/gr_multiply_const_ss.h
+/gr_multiply_const_ss.i
+/gr_multiply_const_vcc.cc
+/gr_multiply_const_vcc.h
+/gr_multiply_const_vcc.i
+/gr_multiply_const_vff.cc
+/gr_multiply_const_vff.h
+/gr_multiply_const_vff.i
+/gr_multiply_const_vii.cc
+/gr_multiply_const_vii.h
+/gr_multiply_const_vii.i
+/gr_multiply_const_vss.cc
+/gr_multiply_const_vss.h
+/gr_multiply_const_vss.i
+/gr_multiply_ff.cc
+/gr_multiply_ff.h
+/gr_multiply_ff.i
+/gr_multiply_ii.cc
+/gr_multiply_ii.h
+/gr_multiply_ii.i
+/gr_multiply_ss.cc
+/gr_multiply_ss.h
+/gr_multiply_ss.i
+/gr_mute_cc.cc
+/gr_mute_cc.h
+/gr_mute_cc.i
+/gr_mute_ff.cc
+/gr_mute_ff.h
+/gr_mute_ff.i
+/gr_mute_ii.cc
+/gr_mute_ii.h
+/gr_mute_ii.i
+/gr_mute_ss.cc
+/gr_mute_ss.h
+/gr_mute_ss.i
+/gr_noise_source_c.cc
+/gr_noise_source_c.h
+/gr_noise_source_c.i
+/gr_noise_source_f.cc
+/gr_noise_source_f.h
+/gr_noise_source_f.i
+/gr_noise_source_i.cc
+/gr_noise_source_i.h
+/gr_noise_source_i.i
+/gr_noise_source_s.cc
+/gr_noise_source_s.h
+/gr_noise_source_s.i
+/gr_not_bb.cc
+/gr_not_bb.h
+/gr_not_bb.i
+/gr_not_ii.cc
+/gr_not_ii.h
+/gr_not_ii.i
+/gr_not_ss.cc
+/gr_not_ss.h
+/gr_not_ss.i
+/gr_or_bb.cc
+/gr_or_bb.h
+/gr_or_bb.i
+/gr_or_ii.cc
+/gr_or_ii.h
+/gr_or_ii.i
+/gr_or_ss.cc
+/gr_or_ss.h
+/gr_or_ss.i
+/gr_packed_to_unpacked_bb.cc
+/gr_packed_to_unpacked_bb.h
+/gr_packed_to_unpacked_bb.i
+/gr_packed_to_unpacked_ii.cc
+/gr_packed_to_unpacked_ii.h
+/gr_packed_to_unpacked_ii.i
+/gr_packed_to_unpacked_ss.cc
+/gr_packed_to_unpacked_ss.h
+/gr_packed_to_unpacked_ss.i
+/gr_peak_detector_fb.cc
+/gr_peak_detector_fb.h
+/gr_peak_detector_fb.i
+/gr_peak_detector_ff.cc
+/gr_peak_detector_ff.h
+/gr_peak_detector_ff.i
+/gr_peak_detector_ib.cc
+/gr_peak_detector_ib.h
+/gr_peak_detector_ib.i
+/gr_peak_detector_ii.cc
+/gr_peak_detector_ii.h
+/gr_peak_detector_ii.i
+/gr_peak_detector_sb.cc
+/gr_peak_detector_sb.h
+/gr_peak_detector_sb.i
+/gr_peak_detector_ss.cc
+/gr_peak_detector_ss.h
+/gr_peak_detector_ss.i
+/gr_prefix.cc
+/gr_sample_and_hold_bb.cc
+/gr_sample_and_hold_bb.h
+/gr_sample_and_hold_bb.i
+/gr_sample_and_hold_ff.cc
+/gr_sample_and_hold_ff.h
+/gr_sample_and_hold_ff.i
+/gr_sample_and_hold_ii.cc
+/gr_sample_and_hold_ii.h
+/gr_sample_and_hold_ii.i
+/gr_sample_and_hold_ss.cc
+/gr_sample_and_hold_ss.h
+/gr_sample_and_hold_ss.i
+/gr_sig_source_c.cc
+/gr_sig_source_c.h
+/gr_sig_source_c.i
+/gr_sig_source_f.cc
+/gr_sig_source_f.h
+/gr_sig_source_f.i
+/gr_sig_source_i.cc
+/gr_sig_source_i.h
+/gr_sig_source_i.i
+/gr_sig_source_s.cc
+/gr_sig_source_s.h
+/gr_sig_source_s.i
+/gr_sub_cc.cc
+/gr_sub_cc.h
+/gr_sub_cc.i
+/gr_sub_ff.cc
+/gr_sub_ff.h
+/gr_sub_ff.i
+/gr_sub_ii.cc
+/gr_sub_ii.h
+/gr_sub_ii.i
+/gr_sub_ss.cc
+/gr_sub_ss.h
+/gr_sub_ss.i
+/gr_unpacked_to_packed_bb.cc
+/gr_unpacked_to_packed_bb.h
+/gr_unpacked_to_packed_bb.i
+/gr_unpacked_to_packed_ii.cc
+/gr_unpacked_to_packed_ii.h
+/gr_unpacked_to_packed_ii.i
+/gr_unpacked_to_packed_ss.cc
+/gr_unpacked_to_packed_ss.h
+/gr_unpacked_to_packed_ss.i
+/gr_vector_sink_b.cc
+/gr_vector_sink_b.h
+/gr_vector_sink_b.i
+/gr_vector_sink_c.cc
+/gr_vector_sink_c.h
+/gr_vector_sink_c.i
+/gr_vector_sink_f.cc
+/gr_vector_sink_f.h
+/gr_vector_sink_f.i
+/gr_vector_sink_i.cc
+/gr_vector_sink_i.h
+/gr_vector_sink_i.i
+/gr_vector_sink_s.cc
+/gr_vector_sink_s.h
+/gr_vector_sink_s.i
+/gr_vector_source_b.cc
+/gr_vector_source_b.h
+/gr_vector_source_b.i
+/gr_vector_source_c.cc
+/gr_vector_source_c.h
+/gr_vector_source_c.i
+/gr_vector_source_f.cc
+/gr_vector_source_f.h
+/gr_vector_source_f.i
+/gr_vector_source_i.cc
+/gr_vector_source_i.h
+/gr_vector_source_i.i
+/gr_vector_source_s.cc
+/gr_vector_source_s.h
+/gr_vector_source_s.i
+/gr_xor_bb.cc
+/gr_xor_bb.h
+/gr_xor_bb.i
+/gr_xor_ii.cc
+/gr_xor_ii.h
+/gr_xor_ii.i
+/gr_xor_ss.cc
+/gr_xor_ss.h
+/gr_xor_ss.i
+/gr_moving_average_cc.cc
+/gr_moving_average_cc.h
+/gr_moving_average_cc.i
+/gr_moving_average_ff.cc
+/gr_moving_average_ff.h
+/gr_moving_average_ff.i
+/gr_moving_average_ss.cc
+/gr_moving_average_ss.h
+/gr_moving_average_ss.i
+/gr_moving_average_ii.cc
+/gr_moving_average_ii.h
+/gr_moving_average_ii.i
+/gr_and_const_bb.cc
+/gr_and_const_ss.h
+/gr_and_const_ss.i
+/gr_and_const_ii.cc
+/gr_and_const_bb.h
+/gr_and_const_ss.cc
+/gr_and_const_bb.i
+/gr_and_const_ii.h
+/gr_and_const_ii.i
+/# --- end generated files ---
+/stamp-*
+/gengen_generated.i
/* -*- c++ -*- */
/*
- * Copyright 2004,2008 Free Software Foundation, Inc.
+ * Copyright 2004,2008,2009 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items);
- void clear() {d_data.clear();}
+ void reset() {d_data.clear();}
+ void clear() {reset(); } // deprecated
std::vector<@TYPE@> data () const;
};
/* -*- c++ -*- */
/*
- * Copyright 2004,2008 Free Software Foundation, Inc.
+ * Copyright 2004,2008,2009 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@NAME@ (int vlen);
public:
- void clear() {d_data.clear();}
+ void clear(); // deprecated
+ void reset();
std::vector<@TYPE@> data () const;
};
--- /dev/null
+/Makefile
+/Makefile.in
+/.libs
+/.deps
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/rstest
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
gr_io_signature.cc \
gr_local_sighandler.cc \
gr_message.cc \
+ gr_msg_accepter.cc \
gr_msg_handler.cc \
gr_msg_queue.cc \
gr_pagesize.cc \
gr_io_signature.h \
gr_local_sighandler.h \
gr_message.h \
+ gr_msg_accepter.h \
gr_msg_handler.h \
gr_msg_queue.h \
gr_pagesize.h \
gr_basic_block::gr_basic_block(const std::string &name,
gr_io_signature_sptr input_signature,
gr_io_signature_sptr output_signature)
- : gruel::msg_accepter_msgq(gruel::make_msg_queue(0)),
- d_name(name),
+ : d_name(name),
d_input_signature(input_signature),
d_output_signature(output_signature),
d_unique_id(s_next_id++),
#include <gr_runtime_types.h>
#include <gr_sptr_magic.h>
#include <boost/enable_shared_from_this.hpp>
-#include <gruel/msg_accepter_msgq.h>
+#include <gr_msg_accepter.h>
#include <string>
/*!
* signal processing functions.
*/
-class gr_basic_block : gruel::msg_accepter_msgq, public boost::enable_shared_from_this<gr_basic_block>
+class gr_basic_block : public gr_msg_accepter, public boost::enable_shared_from_this<gr_basic_block>
{
protected:
friend class gr_flowgraph;
/* -*- c++ -*- */
/*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004,2009 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
d_detail->consume_each (how_many_items);
}
+void
+gr_block::produce (int which_output, int how_many_items)
+{
+ d_detail->produce (which_output, how_many_items);
+}
+
int
gr_block::fixed_rate_ninput_to_noutput(int ninput)
{
/* -*- c++ -*- */
/*
- * Copyright 2004,2007 Free Software Foundation, Inc.
+ * Copyright 2004,2007,2009 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
public:
+ //! Magic return values from general_work
+ enum {
+ WORK_CALLED_PRODUCE = -2,
+ WORK_DONE = -1
+ };
+
virtual ~gr_block ();
/*!
void set_history (unsigned history) { d_history = history; }
/*!
- * \brief return true if this block has a fixed input to output rate
+ * \brief Return true if this block has a fixed input to output rate.
*
* If true, then fixed_rate_in_to_out and fixed_rate_out_to_in may be called.
*/
*/
void consume_each (int how_many_items);
+ /*!
+ * \brief Tell the scheduler \p how_many_items were produced on output stream \p which_output.
+ *
+ * If the block's general_work method calls produce, \p general_work must return WORK_CALLED_PRODUCE.
+ */
+ void produce (int which_output, int how_many_items);
+
/*!
* \brief Set the approximate output rate / input rate
*
int d_output_multiple;
double d_relative_rate; // approx output_rate / input_rate
- gr_block_detail_sptr d_detail; // implementation details
+ gr_block_detail_sptr d_detail; // implementation details
unsigned d_history;
bool d_fixed_rate;
/* -*- c++ -*- */
/*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004,2009 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
}
gr_block_detail::gr_block_detail (unsigned int ninputs, unsigned int noutputs)
- : d_ninputs (ninputs), d_noutputs (noutputs),
+ : d_produce_or(0),
+ d_ninputs (ninputs), d_noutputs (noutputs),
d_input (ninputs), d_output (noutputs),
d_done (false)
{
d_input[i]->update_read_pointer (how_many_items);
}
+void
+gr_block_detail::produce (int which_output, int how_many_items)
+{
+ if (how_many_items > 0){
+ d_output[which_output]->update_write_pointer (how_many_items);
+ d_produce_or |= how_many_items;
+ }
+}
+
void
gr_block_detail::produce_each (int how_many_items)
{
- if (how_many_items > 0)
+ 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)
+{
+ d_tpb.insert_tail(msg);
}
/* -*- c++ -*- */
/*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004,2009 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
*/
void consume_each (int how_many_items);
+ /*!
+ * \brief Tell the scheduler \p how_many_items were produced on output stream \p which_output.
+ */
+ void produce (int which_output, int how_many_items);
+
/*!
* \brief Tell the scheduler \p how_many_items were produced on each output stream.
*/
void produce_each (int how_many_items);
+ /*!
+ * Accept msg, place in queue, arrange for thread to be awakened if it's not already.
+ */
+ void _post(pmt::pmt_t msg);
gr_tpb_detail d_tpb; // used by thread-per-block scheduler
+ int d_produce_or;
// ----------------------------------------------------------------------------
/* -*- c++ -*- */
/*
- * Copyright 2004,2008 Free Software Foundation, Inc.
+ * Copyright 2004,2008,2009 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
setup_call_to_work:
+ d->d_produce_or = 0;
for (int i = 0; i < d->noutputs (); i++)
d_output_items[i] = d->output(i)->write_pointer();
LOG(*d_log << " general_work: noutput_items = " << noutput_items
<< " result = " << n << std::endl);
- if (n == -1) // block is done
+ if (n == gr_block::WORK_DONE)
goto were_done;
- d->produce_each (n); // advance write pointers
- if (n > 0)
+ if (n != gr_block::WORK_CALLED_PRODUCE)
+ d->produce_each (n); // advance write pointers
+
+ if (d->d_produce_or > 0) // block produced something
return READY;
// We didn't produce any output even though we called general_work.
// If this is a source, it's broken.
if (d->source_p()){
std::cerr << "gr_block_executor: source " << m
- << " returned 0 from work. We're marking it DONE.\n";
+ << " produced no output. We're marking it DONE.\n";
// FIXME maybe we ought to raise an exception...
goto were_done;
}
--- /dev/null
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gr_msg_accepter.h>
+#include <gr_block.h>
+#include <gr_block_detail.h>
+#include <gr_hier_block2.h>
+#include <stdexcept>
+
+using namespace pmt;
+
+gr_msg_accepter::gr_msg_accepter()
+{
+}
+
+gr_msg_accepter::~gr_msg_accepter()
+{
+ // NOP, required as virtual destructor
+}
+
+void
+gr_msg_accepter::post(pmt_t msg)
+{
+ // Notify derived class, handled case by case
+ gr_block *p = dynamic_cast<gr_block *>(this);
+ if (p) {
+ p->detail()->_post(msg);
+ return;
+ }
+ gr_hier_block2 *p2 = dynamic_cast<gr_hier_block2 *>(this);
+ if (p2){
+ // FIXME do the right thing
+ return;
+ }
+
+ throw std::runtime_error("unknown derived class");
+}
--- /dev/null
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef INCLUDED_GR_MSG_ACCEPTER_H
+#define INCLUDED_GR_MSG_ACCEPTER_H
+
+#include <gruel/msg_accepter.h>
+#include <gruel/pmt.h>
+
+/*!
+ * \brief Accepts messages and inserts them into a message queue, then notifies
+ * subclass gr_basic_block there is a message pending.
+ */
+class gr_msg_accepter : public gruel::msg_accepter
+{
+public:
+ gr_msg_accepter();
+ ~gr_msg_accepter();
+
+ void post(pmt::pmt_t msg);
+
+};
+
+#endif /* INCLUDED_GR_MSG_ACCEPTER_H */
/* -*- c++ -*- */
/*
- * Copyright 2008 Free Software Foundation, Inc.
+ * Copyright 2008,2009 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
#include <gr_block_detail.h>
#include <gr_buffer.h>
+using namespace pmt;
+
/*
* We assume that no worker threads are ever running when the
* graph structure is being manipulated, thus it's safe for us to poke
notify_downstream(d);
notify_upstream(d);
}
+
+void
+gr_tpb_detail::insert_tail(pmt::pmt_t msg)
+{
+ gruel::scoped_lock guard(mutex);
+
+ msg_queue.push_back(msg);
+
+ // wake up thread if BLKD_IN or BLKD_OUT
+ input_cond.notify_one();
+ output_cond.notify_one();
+}
+
+pmt_t
+gr_tpb_detail::delete_head_nowait()
+{
+ gruel::scoped_lock guard(mutex);
+
+ if (empty_p())
+ return pmt_t();
+
+ pmt_t m(msg_queue.front());
+ msg_queue.pop_front();
+
+ return m;
+}
+
+/*
+ * Caller must already be holding the mutex
+ */
+pmt_t
+gr_tpb_detail::delete_head_nowait_already_holding_mutex()
+{
+ if (empty_p())
+ return pmt_t();
+
+ pmt_t m(msg_queue.front());
+ msg_queue.pop_front();
+
+ return m;
+}
#define INCLUDED_GR_TPB_DETAIL_H
#include <gruel/thread.h>
+#include <deque>
+#include <gruel/pmt.h>
class gr_block_detail;
bool output_changed;
gruel::condition_variable output_cond;
- gr_tpb_detail()
- : input_changed(false), output_changed(false) {}
+private:
+ std::deque<pmt::pmt_t> msg_queue;
+public:
+ gr_tpb_detail()
+ : input_changed(false), output_changed(false) { }
//! Called by us to tell all our upstream blocks that their output may have changed.
void notify_upstream(gr_block_detail *d);
input_changed = false;
output_changed = false;
}
+
+ //! is the queue empty?
+ bool empty_p() const { return msg_queue.empty(); }
+
+ //| Acquires and release the mutex
+ void insert_tail(pmt::pmt_t msg);
+
+ /*!
+ * \returns returns pmt at head of queue or pmt_t() if empty.
+ */
+ pmt::pmt_t delete_head_nowait();
+
+ /*!
+ * \returns returns pmt at head of queue or pmt_t() if empty.
+ * Caller must already be holding the mutex
+ */
+ pmt::pmt_t delete_head_nowait_already_holding_mutex();
private:
#include <gr_tpb_thread_body.h>
#include <iostream>
#include <boost/thread.hpp>
+#include <gruel/pmt.h>
+
+using namespace pmt;
gr_tpb_thread_body::gr_tpb_thread_body(gr_block_sptr block)
: d_exec(block)
{
// std::cerr << "gr_tpb_thread_body: " << block << std::endl;
- gr_block_detail *d = block->detail().get();
+ gr_block_detail *d = block->detail().get();
gr_block_executor::state s;
+ pmt_t msg;
+
while (1){
boost::this_thread::interruption_point();
+
+ // handle any queued up messages
+ while ((msg = d->d_tpb.delete_head_nowait()))
+ block->handle_msg(msg);
d->d_tpb.clear_changed();
s = d_exec.run_one_iteration();
case gr_block_executor::BLKD_IN: // Wait for input.
{
gruel::scoped_lock guard(d->d_tpb.mutex);
- while(!d->d_tpb.input_changed)
- d->d_tpb.input_cond.wait(guard);
+ while (!d->d_tpb.input_changed){
+
+ // wait for input or message
+ while(!d->d_tpb.input_changed && d->d_tpb.empty_p())
+ d->d_tpb.input_cond.wait(guard);
+
+ // handle all pending messages
+ while ((msg = d->d_tpb.delete_head_nowait_already_holding_mutex())){
+ guard.unlock(); // release lock while processing msg
+ block->handle_msg(msg);
+ guard.lock();
+ }
+ }
}
break;
+
case gr_block_executor::BLKD_OUT: // Wait for output buffer space.
{
gruel::scoped_lock guard(d->d_tpb.mutex);
- while(!d->d_tpb.output_changed)
- d->d_tpb.output_cond.wait(guard);
+ while (!d->d_tpb.output_changed){
+
+ // wait for output room or message
+ while(!d->d_tpb.output_changed && d->d_tpb.empty_p())
+ d->d_tpb.output_cond.wait(guard);
+
+ // handle all pending messages
+ while ((msg = d->d_tpb.delete_head_nowait_already_holding_mutex())){
+ guard.unlock(); // release lock while processing msg
+ block->handle_msg(msg);
+ guard.lock();
+ }
+ }
}
break;
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.pyc
+/swigrun.py
+/swigrun_wrap.c
+/Makefile.swigdeps.new
+/gnuradio_swig_py_runtime.d
+/gnuradio_swig_py_general.d
+/gnuradio_swig_py_gengen.d
+/gnuradio_swig_py_filter.d
+/gnuradio_swig_py_io.d
+/gnuradio_swig_bug_workaround.h
+/gnuradio_swig_py_runtime.cc
+/gnuradio_swig_py_runtime.h
+/gnuradio_swig_py_runtime.py
+/gnuradio_swig_py_general.cc
+/gnuradio_swig_py_general.h
+/gnuradio_swig_py_general.py
+/gnuradio_swig_py_gengen.cc
+/gnuradio_swig_py_gengen.h
+/gnuradio_swig_py_gengen.py
+/gnuradio_swig_py_filter.cc
+/gnuradio_swig_py_filter.h
+/gnuradio_swig_py_filter.py
+/gnuradio_swig_py_io.cc
+/gnuradio_swig_py_io.h
+/gnuradio_swig_py_io.py
+/gnuradio_swig_py_hier.cc
+/gnuradio_swig_py_hier.h
+/gnuradio_swig_py_hier.py
--- /dev/null
+/Makefile
+/Makefile.in
+/.libs
+/.deps
+/encode
+/decode
--- /dev/null
+/Makefile
+/Makefile.in
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.pyc
+/*.pyo
--- /dev/null
+/Makefile
+/Makefile.in
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.pyc
+/*.pyo
--- /dev/null
+/Makefile
+/Makefile.in
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.pyc
+/*.pyo
--- /dev/null
+/Makefile
+/Makefile.in
+/*.pyc
--- /dev/null
+/Makefile
+/Makefile.in
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.pyc
+/*.pyo
class pfb_arb_resampler_ccf(gr.hier_block2):
'''
- Convinience wrapper for the polyphase filterbank arbitrary resampler.
+ Convenience wrapper for the polyphase filterbank arbitrary resampler.
The block takes a single complex stream in and outputs a single complex
stream out. As such, it requires no extra glue to handle the input/output
self.connect(self, self.pfb)
self.connect(self.pfb, self)
-
-
-
+ def set_taps(self, taps):
+ self.pfb.set_taps(taps)
--- /dev/null
+/Makefile
+/Makefile.in
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.pyc
+/*.pyo
+/run_tests
--- /dev/null
+/Makefile
+/Makefile.in
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.pyc
+/*.pyo
--- /dev/null
+/Makefile
+/Makefile.in
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.pyc
+/*.pyo
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/t1
+/test_dtv
+/check_dups
+/test_gr
+/test_all
+/exercise_correlator
+/test_grbase
+/test_vmcircbuf
+/test_atsc
+/test_general
+/test_runtime
+/test_filter
+/benchmark_dotprod_fff
+/benchmark_dotprod_ccc
+/benchmark_dotprod_fcc
+/benchmark_dotprod_scc
+/benchmark_nco
+/benchmark_dotprod_ccf
+/benchmark_dotprod_fsf
+/benchmark_vco
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
--- /dev/null
+/Makefile
+/Makefile.in
+/aclocal.m4
+/configure
+/config.h.in
+/stamp-h.in
+/libtool
+/config.log
+/config.h
+/config.cache
+/config.status
+/missing
+/stamp-h
+/stamp-h1
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/autom4te.cache
+/*.cache
+/missing
+/make.log
+/gnuradio.pc
--- /dev/null
+/.deps
+/.libs
+/Makefile
+/Makefile.in
+/dialtone
--- /dev/null
+/.deps
+/.libs
+/Makefile
+/Makefile.in
+/dial_tone
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.pyc
+/*.pyo
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/Makefile
+/Makefile.in
+/*.pyc
--- /dev/null
+/Makefile
+/Makefile.in
+/*.pyc
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.pyc
+/*.pyo
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.pyc
+/*.pyo
+/*.dat
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.pyc
+/*.pyo
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.pyc
+/*.pyo
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.pyc
+/*.pyo
+/*.dat
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.pyc
+/*.pyo
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/Makefile
+/Makefile.in
+/*.pyc
+/*.dat
--- /dev/null
+Makefile
+Makefile.in
decimate.py \
interpolate.py \
fmtest.py
+
+dist_ourdata_DATA = \
+ resampler_demo.grc
--- /dev/null
+<?xml version='1.0' encoding='ASCII'?>
+<flow_graph>
+ <timestamp>Sun Aug 23 11:39:47 2009</timestamp>
+ <block>
+ <key>options</key>
+ <param>
+ <key>id</key>
+ <value>resampler_demo</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>title</key>
+ <value></value>
+ </param>
+ <param>
+ <key>author</key>
+ <value></value>
+ </param>
+ <param>
+ <key>description</key>
+ <value></value>
+ </param>
+ <param>
+ <key>window_size</key>
+ <value>1280, 1024</value>
+ </param>
+ <param>
+ <key>generate_options</key>
+ <value>wx_gui</value>
+ </param>
+ <param>
+ <key>category</key>
+ <value>Custom</value>
+ </param>
+ <param>
+ <key>run</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>realtime_scheduling</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(10, 10)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>import</key>
+ <param>
+ <key>id</key>
+ <value>import_0</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>import</key>
+ <value>import math</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(11, 59)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>rs_taps</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>firdes.low_pass(nphases, nphases, frac_bw, 0.5-frac_bw)</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(273, 154)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>gr_add_const_vxx</key>
+ <param>
+ <key>id</key>
+ <value>adder</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>float</value>
+ </param>
+ <param>
+ <key>const</key>
+ <value>-1.0</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(227, 303)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>gr_throttle</key>
+ <param>
+ <key>id</key>
+ <value>throttle</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>float</value>
+ </param>
+ <param>
+ <key>samples_per_second</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>vlen</key>
+ <value>1</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(227, 493)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>wxgui_fftsink2</key>
+ <param>
+ <key>id</key>
+ <value>orig_fft</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>complex</value>
+ </param>
+ <param>
+ <key>title</key>
+ <value>Original Spectrum</value>
+ </param>
+ <param>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>baseband_freq</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>y_per_div</key>
+ <value>10</value>
+ </param>
+ <param>
+ <key>y_divs</key>
+ <value>10</value>
+ </param>
+ <param>
+ <key>ref_level</key>
+ <value>30</value>
+ </param>
+ <param>
+ <key>fft_size</key>
+ <value>1024</value>
+ </param>
+ <param>
+ <key>fft_rate</key>
+ <value>30</value>
+ </param>
+ <param>
+ <key>peak_hold</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>average</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>avg_alpha</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>grid_pos</key>
+ <value>1, 0, 1, 3</value>
+ </param>
+ <param>
+ <key>notebook</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(409, 289)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>180</value>
+ </param>
+ </block>
+ <block>
+ <key>wxgui_fftsink2</key>
+ <param>
+ <key>id</key>
+ <value>resamp_fft</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>complex</value>
+ </param>
+ <param>
+ <key>title</key>
+ <value>Resampled Spectrum</value>
+ </param>
+ <param>
+ <key>samp_rate</key>
+ <value>new_rate</value>
+ </param>
+ <param>
+ <key>baseband_freq</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>y_per_div</key>
+ <value>10</value>
+ </param>
+ <param>
+ <key>y_divs</key>
+ <value>10</value>
+ </param>
+ <param>
+ <key>ref_level</key>
+ <value>30</value>
+ </param>
+ <param>
+ <key>fft_size</key>
+ <value>1024</value>
+ </param>
+ <param>
+ <key>fft_rate</key>
+ <value>30</value>
+ </param>
+ <param>
+ <key>peak_hold</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>average</key>
+ <value>False</value>
+ </param>
+ <param>
+ <key>avg_alpha</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>grid_pos</key>
+ <value>2, 0, 1, 3</value>
+ </param>
+ <param>
+ <key>notebook</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(640, 256)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>180</value>
+ </param>
+ </block>
+ <block>
+ <key>gr_sig_source_x</key>
+ <param>
+ <key>id</key>
+ <value>tri_source</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>type</key>
+ <value>float</value>
+ </param>
+ <param>
+ <key>samp_rate</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>waveform</key>
+ <value>gr.GR_TRI_WAVE</value>
+ </param>
+ <param>
+ <key>freq</key>
+ <value>0.05</value>
+ </param>
+ <param>
+ <key>amp</key>
+ <value>2.0</value>
+ </param>
+ <param>
+ <key>offset</key>
+ <value>0</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(21, 271)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>gr_frequency_modulator_fc</key>
+ <param>
+ <key>id</key>
+ <value>fm_mod</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>sensitivity</key>
+ <value>math.pi</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(411, 493)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>blks2_pfb_arb_resampler_ccf</key>
+ <param>
+ <key>id</key>
+ <value>resampler</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>rate</key>
+ <value>float(new_rate)/samp_rate</value>
+ </param>
+ <param>
+ <key>taps</key>
+ <value>rs_taps</value>
+ </param>
+ <param>
+ <key>size</key>
+ <value>nphases</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(641, 477)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable</key>
+ <param>
+ <key>id</key>
+ <value>nphases</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>32</value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(185, 153)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable_static_text</key>
+ <param>
+ <key>id</key>
+ <value>samp_rate</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>label</key>
+ <value>Sample Rate</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>44100</value>
+ </param>
+ <param>
+ <key>converver</key>
+ <value>float_converter</value>
+ </param>
+ <param>
+ <key>formatter</key>
+ <value>None</value>
+ </param>
+ <param>
+ <key>grid_pos</key>
+ <value>0, 0, 1, 1</value>
+ </param>
+ <param>
+ <key>notebook</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(179, 14)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable_static_text</key>
+ <param>
+ <key>id</key>
+ <value>new_rate</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>label</key>
+ <value>Resampled Rate</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>48000</value>
+ </param>
+ <param>
+ <key>converver</key>
+ <value>float_converter</value>
+ </param>
+ <param>
+ <key>formatter</key>
+ <value>None</value>
+ </param>
+ <param>
+ <key>grid_pos</key>
+ <value>0, 1, 1, 1</value>
+ </param>
+ <param>
+ <key>notebook</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(328, 15)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <block>
+ <key>variable_static_text</key>
+ <param>
+ <key>id</key>
+ <value>frac_bw</value>
+ </param>
+ <param>
+ <key>_enabled</key>
+ <value>True</value>
+ </param>
+ <param>
+ <key>label</key>
+ <value>Fractional Bandwidth</value>
+ </param>
+ <param>
+ <key>value</key>
+ <value>0.45</value>
+ </param>
+ <param>
+ <key>converver</key>
+ <value>float_converter</value>
+ </param>
+ <param>
+ <key>formatter</key>
+ <value>lambda x: "%0.2f"%x</value>
+ </param>
+ <param>
+ <key>grid_pos</key>
+ <value>0,2,1,1</value>
+ </param>
+ <param>
+ <key>notebook</key>
+ <value></value>
+ </param>
+ <param>
+ <key>_coordinate</key>
+ <value>(473, 14)</value>
+ </param>
+ <param>
+ <key>_rotation</key>
+ <value>0</value>
+ </param>
+ </block>
+ <connection>
+ <source_block_id>tri_source</source_block_id>
+ <sink_block_id>adder</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>adder</source_block_id>
+ <sink_block_id>throttle</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>resampler</source_block_id>
+ <sink_block_id>resamp_fft</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>fm_mod</source_block_id>
+ <sink_block_id>resampler</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>fm_mod</source_block_id>
+ <sink_block_id>orig_fft</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+ <connection>
+ <source_block_id>throttle</source_block_id>
+ <sink_block_id>fm_mod</sink_block_id>
+ <source_key>0</source_key>
+ <sink_key>0</sink_key>
+ </connection>
+</flow_graph>
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.pyc
+/*.pyo
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/Makefile
+/Makefile.in
+/aclocal.m4
+/configure
+/config.h.in
+/stamp-h.in
+/libtool
+/config.log
+/config.h
+/config.cache
+/config.status
+/missing
+/stamp-h
+/stamp-h1
+/.deps
+/.libs
+/*.la
+/*.lo
+/autom4te.cache
+/*.cache
+/missing
+/make.log
+/gnuradio-atsc.pc
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/howto.cc
+/howto.py
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/howto.cc
+/howto.py
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/atsc.cc
+/atsc.py
+/atsci_viterbi_gen
+/atsci_viterbi_mux.cc
+/test_atsci
+/*.pyc
--- /dev/null
+/Makefile
+/Makefile.in
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.pyc
+/*.pyo
+/run_tests
--- /dev/null
+/*.cache
+/*.la
+/*.lo
+/*.pc
+/.deps
+/.la
+/.libs
+/.lo
+/Makefile
+/Makefile.in
+/aclocal.m4
+/autom4te.cache
+/config.cache
+/config.h
+/config.h.in
+/config.log
+/config.status
+/configure
+/depcomp
+/install-sh
+/libtool
+/ltmain.sh
+/make.log
+/missing
+/missing
+/mkinstalldirs
+/py-compile
+/stamp-h
+/stamp-h.in
+/stamp-h1
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/usrp.py
+/usrp.cc
+/audio_oss.cc
+/audio_oss.py
+/audio_alsa.py
+/audio_alsa.cc
+/run_tests
+/*.pyc
--- /dev/null
+/*.cache
+/*.la
+/*.lo
+/*.pc
+/.deps
+/.la
+/.libs
+/.lo
+/Makefile
+/Makefile.in
+/aclocal.m4
+/autom4te.cache
+/config.cache
+/config.h
+/config.h.in
+/config.log
+/config.status
+/configure
+/depcomp
+/install-sh
+/libtool
+/ltmain.sh
+/make.log
+/missing
+/missing
+/mkinstalldirs
+/py-compile
+/stamp-h
+/stamp-h.in
+/stamp-h1
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.pyc
+/audio_jack.cc
+/audio_jack.py
+/run_tests
--- /dev/null
+/*.cache
+/*.la
+/*.lo
+/*.pc
+/.deps
+/.la
+/.libs
+/.lo
+/Makefile
+/Makefile.in
+/aclocal.m4
+/autom4te.cache
+/config.cache
+/config.h
+/config.h.in
+/config.log
+/config.status
+/configure
+/depcomp
+/install-sh
+/libtool
+/ltmain.sh
+/make.log
+/missing
+/missing
+/mkinstalldirs
+/py-compile
+/stamp-h
+/stamp-h.in
+/stamp-h1
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/usrp.py
+/usrp.cc
+/audio_oss.cc
+/audio_oss.py
+/run_tests
+/*.pyc
--- /dev/null
+/*.cache
+/*.la
+/*.lo
+/*.pc
+/.deps
+/.la
+/.libs
+/.lo
+/Makefile
+/Makefile.in
+/aclocal.m4
+/autom4te.cache
+/config.cache
+/config.h
+/config.h.in
+/config.log
+/config.status
+/configure
+/depcomp
+/install-sh
+/libtool
+/ltmain.sh
+/make.log
+/missing
+/missing
+/mkinstalldirs
+/py-compile
+/stamp-h
+/stamp-h.in
+/stamp-h1
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/usrp.py
+/usrp.cc
+/audio_osx.cc
+/audio_osx.py
+/run_tests
--- /dev/null
+/*.cache
+/*.la
+/*.lo
+/*.pc
+/.deps
+/.la
+/.libs
+/.lo
+/Makefile
+/Makefile.in
+/aclocal.m4
+/autom4te.cache
+/config.cache
+/config.h
+/config.h.in
+/config.log
+/config.status
+/configure
+/depcomp
+/install-sh
+/libtool
+/ltmain.sh
+/make.log
+/missing
+/missing
+/mkinstalldirs
+/py-compile
+/stamp-h
+/stamp-h.in
+/stamp-h1
+/stamp-h1.in
+/stamp-h2.in
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.pyc
+/*.pyo
+/usrp.py
+/usrp.cc
+/audio_oss.cc
+/audio_oss.py
+/audio_portaudio.py
+/audio_portaudio.cc
+/run_tests
--- /dev/null
+/*.cache
+/*.la
+/*.lo
+/*.pc
+/.deps
+/.la
+/.libs
+/.lo
+/Makefile
+/Makefile.in
+/aclocal.m4
+/autom4te.cache
+/config.cache
+/config.h
+/config.h.in
+/config.log
+/config.status
+/configure
+/depcomp
+/install-sh
+/libtool
+/ltmain.sh
+/make.log
+/missing
+/missing
+/mkinstalldirs
+/py-compile
+/stamp-h
+/stamp-h.in
+/stamp-h1
+/stamp-h1.in
+/stamp-h2.in
--- /dev/null
+/*.cache
+/*.la
+/*.lo
+/*.pc
+/.deps
+/.la
+/.libs
+/.lo
+/Makefile
+/Makefile.in
+/aclocal.m4
+/autom4te.cache
+/config.cache
+/config.h
+/config.h.in
+/config.log
+/config.status
+/configure
+/depcomp
+/install-sh
+/libtool
+/ltmain.sh
+/make.log
+/missing
+/missing
+/mkinstalldirs
+/py-compile
+/stamp-h
+/stamp-h.in
+/stamp-h1
+/stamp-h1.in
+/stamp-h2.in
+/run_tests
+/audio_windows.cc
+/audio_windows.py
--- /dev/null
+/*.cache
+/*.la
+/*.lo
+/*.pc
+/.deps
+/.la
+/.libs
+/.lo
+/Makefile
+/Makefile.in
+/aclocal.m4
+/autom4te.cache
+/config.cache
+/config.h
+/config.h.in
+/config.log
+/config.status
+/configure
+/depcomp
+/install-sh
+/libtool
+/ltmain.sh
+/make.log
+/missing
+/missing
+/mkinstalldirs
+/py-compile
+/stamp-h
+/stamp-h.in
+/stamp-h1
+/stamp-h1.in
+/stamp-h2.in
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/comedi.cc
+/*.pyc
+/comedi.py
+/run_tests
--- /dev/null
+/Makefile
+/Makefile.in
+/*.pc
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/Makefile
+/Makefile.in
+/.libs
+/.deps
+/cvsd_vocoder.cc
+/cvsd_vocoder.py*
--- /dev/null
+/Makefile
+/Makefile.in
+/run_tests
--- /dev/null
+/*.cache
+/*.la
+/*.lo
+/*.pc
+/.deps
+/.la
+/.libs
+/.lo
+/Makefile
+/Makefile.in
+/aclocal.m4
+/autom4te.cache
+/config.cache
+/config.h
+/config.h.in
+/config.log
+/config.status
+/configure
+/depcomp
+/install-sh
+/libtool
+/ltmain.sh
+/make.log
+/missing
+/missing
+/mkinstalldirs
+/py-compile
+/stamp-h
+/stamp-h.in
+/stamp-h1
+/stamp-h1.in
+/stamp-h2.in
--- /dev/null
+/*.cache
+/*.la
+/*.lo
+/*.pc
+/.deps
+/.la
+/.libs
+/.lo
+/Makefile
+/Makefile.in
+/aclocal.m4
+/autom4te.cache
+/config.cache
+/config.h
+/config.h.in
+/config.log
+/config.status
+/configure
+/depcomp
+/install-sh
+/libtool
+/ltmain.sh
+/make.log
+/missing
+/missing
+/mkinstalldirs
+/py-compile
+/stamp-h
+/stamp-h.in
+/stamp-h1
+/stamp-h1.in
+/stamp-h2.in
+/run_tests
+/gcell.d
+/gcell.cc
+/gcell.py
--- /dev/null
+/*.cache
+/*.la
+/*.lo
+/*.pc
+/.deps
+/.la
+/.libs
+/.lo
+/Makefile
+/Makefile.in
+/aclocal.m4
+/autom4te.cache
+/config.cache
+/config.h
+/config.h.in
+/config.log
+/config.status
+/configure
+/depcomp
+/install-sh
+/libtool
+/ltmain.sh
+/make.log
+/missing
+/missing
+/mkinstalldirs
+/py-compile
+/stamp-h
+/stamp-h.in
+/stamp-h1
+/stamp-h1.in
+/stamp-h2.in
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/Makefile
+/Makefile.in
+/db
+/prev*.*
+/*.summary
+/*.qws
+/*.rpt
+/*.done
+/*.pin
+/*.sof
+/*.rbf
--- /dev/null
+/Makefile
+/Makefile.in
+/*.pyc
+/run_tests
--- /dev/null
+/Makefile
+/Makefile.in
+/aclocal.m4
+/configure
+/config.h.in
+/stamp-h.in
+/libtool
+/config.log
+/config.h
+/config.cache
+/config.status
+/missing
+/stamp-h
+/stamp-h1
+/.deps
+/.libs
+/*.la
+/*.lo
+/autom4te.cache
+/*.cache
+/missing
+/make.log
+/*.pc
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/howto.cc
+/howto.py
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/gsm_full_rate.py
+/gsm_full_rate.cc
+/*.pyc
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
--- /dev/null
+/Makefile
+/Makefile.in
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.pyc
+/*.pyo
+/run_tests
--- /dev/null
+/Makefile
+/Makefile.in
+/aclocal.m4
+/configure
+/config.h.in
+/stamp-h.in
+/libtool
+/config.log
+/config.h
+/config.cache
+/config.status
+/missing
+/stamp-h
+/stamp-h1
+/.deps
+/.libs
+/*.la
+/*.lo
+/autom4te.cache
+/*.cache
+/missing
+/make.log
+/py-compile
+/depcomp
+/ltmain.sh
+/install-sh
--- /dev/null
+/*.cache
+/*.la
+/*.lo
+/*.pc
+/.deps
+/.la
+/.libs
+/.lo
+/Makefile
+/Makefile.in
+/libtool.m4
+/lt~obsolete.m4
+/ltsugar.m4
+/ltversion.m4
+/ltoptions.m4
--- /dev/null
+/Makefile
+/Makefile.in
+/.deps
+/.libs
+/*.la
+/*.lo
+/autom4te.cache
+/*.cache
+/howto-write-a-block.html
+/gr_block.h.xml
+/howto_1.i.xml
+/howto_square_ff.cc.xml
+/howto_square_ff.h.xml
+/qa_howto_1.py.xml
+/src_lib_Makefile_1.am.xml
+/src_lib_Makefile_2.am.xml
+/howto_square2_ff.cc.xml
+/howto_square2_ff.h.xml
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/howto.cc
+/howto.py
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.pyc
+/howto.cc
+/howto.py
--- /dev/null
+/Makefile
+/Makefile.in
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.pyc
+/*.pyo
+/run_tests
--- /dev/null
+/Makefile
+/Makefile.in
+/*.pc
--- /dev/null
+/Makefile
+/Makefile.in
+/.libs
+/.deps
+/msdd.cc
+/msdd.py
--- /dev/null
+/Makefile
+/Makefile.in
+/data
+/*.pc
--- /dev/null
+/.libs
+/.deps
+/Makefile
+/Makefile.in
+/pager_swig.py
+/pager_swig.cc
+/*.pyc
+/run_tests
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/Makefile
+/Makefile.in
+/.libs
+/.deps
+/qtgui.cc
+/qtgui.py
+/WaterfallDisplayPlot_moc.cc
+/Waterfall3DDisplayPlot_moc.cc
+/TimeDomainDisplayPlot_moc.cc
+/spectrumdisplayform_moc.cc
+/spectrumdisplayform_ui.h
+/FrequencyDisplayPlot_moc.cc
+/ConstellationDisplayPlot_moc.cc
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/Makefile
+/Makefile.in
+/radar_tb
+/out
+/*.out*
+/*.vcd
--- /dev/null
+/*.qmsg
+/*.qws
+/*.eqn
+/*.done
+/*.htm
+/*.rpt
+/*.ini
+/*.fsf
+/*.jam
+/*.jbc
+/*.pin
+/*.pof
+/*.rbf
+/*.smsg
+/*.sof
+/*.ttf
+/*.summary
+/undo_redo.txt
+/db
+/Makefile
+/Makefile.in
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/Makefile
+/Makefile.in
+/run_tests
+/*.pyc
--- /dev/null
+/Makefile
+/Makefile.in
+/aclocal.m4
+/configure
+/config.h.in
+/stamp-h.in
+/libtool
+/config.log
+/config.h
+/config.cache
+/config.status
+/missing
+/stamp-h
+/stamp-h1
+/.deps
+/.libs
+/*.la
+/*.lo
+/autom4te.cache
+/*.cache
+/missing
+/make.log
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/howto.cc
+/howto.py
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/howto.cc
+/howto.py
+/ra.cc
+/ra.py
+/*.pyc
--- /dev/null
+/Makefile
+/Makefile.in
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.pyc
+/*.pyo
+/run_tests
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/Makefile
+/Makefile.in
+/*.vcd
+/sounder_tb
+/*.out*
--- /dev/null
+/Makefile
+/Makefile.in
+/db
+/*.rpt
+/*.summary
+/*.rbf
+/*.qws
+/*.smsg
+/*.done
+/*.pin
+/*.sof
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/Makefile
+/Makefile.in
+/run_tests
+/*.pyc
+/loopback.dat
--- /dev/null
+/Makefile
+/Makefile.in
+/aclocal.m4
+/configure
+/config.h.in
+/stamp-h.in
+/libtool
+/config.log
+/config.h
+/config.cache
+/config.status
+/missing
+/stamp-h
+/stamp-h1
+/.deps
+/.libs
+/*.la
+/*.lo
+/autom4te.cache
+/*.cache
+/missing
+/make.log
+/*.pc
--- /dev/null
+/Makefile
+/Makefile.in
+/*.html
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/howto.cc
+/howto.py
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.pyc
+/*.pyo
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.pyc
+/trellis.cc
+/trellis.py
+/wip
+/trellis_encoder_bs.cc
+/trellis_metrics_c.h
+/trellis_metrics_c.i
+/trellis_metrics_f.cc
+/trellis_viterbi_i.h
+/trellis_viterbi_combined_i.h
+/trellis_viterbi_i.i
+/trellis_viterbi_combined_i.i
+/trellis_metrics_i.h
+/trellis_metrics_i.i
+/trellis_encoder_bb.cc
+/trellis_encoder_ss.cc
+/trellis_viterbi_combined_s.h
+/trellis_viterbi_s.h
+/trellis_viterbi_combined_s.i
+/trellis_viterbi_s.i
+/trellis_metrics_s.h
+/trellis_metrics_s.i
+/trellis_encoder_si.h
+/trellis_encoder_si.i
+/trellis_metrics_i.cc
+/trellis_viterbi_s.cc
+/trellis_viterbi_combined_s.cc
+/trellis_encoder_ss.h
+/trellis_encoder_ss.i
+/trellis_encoder_bi.cc
+/trellis_encoder_bi.h
+/trellis_encoder_bi.i
+/trellis_encoder_ii.cc
+/trellis_viterbi_combined_b.cc
+/trellis_viterbi_b.cc
+/trellis_encoder_bs.h
+/trellis_encoder_bs.i
+/trellis_viterbi_combined_b.h
+/trellis_viterbi_b.h
+/trellis_viterbi_combined_b.i
+/trellis_viterbi_b.i
+/trellis_encoder_si.cc
+/trellis_metrics_f.h
+/trellis_metrics_f.i
+/trellis_encoder_ii.h
+/trellis_encoder_ii.i
+/trellis_metrics_c.cc
+/trellis_viterbi_combined_i.cc
+/trellis_viterbi_i.cc
+/trellis_encoder_bb.h
+/trellis_encoder_bb.i
+/trellis_metrics_s.cc
+/trellis_viterbi_combined_fs.h
+/trellis_viterbi_combined_fs.i
+/trellis_viterbi_combined_fi.cc
+/trellis_viterbi_combined_is.h
+/trellis_viterbi_combined_is.i
+/trellis_viterbi_combined_ci.h
+/trellis_viterbi_combined_ci.i
+/trellis_viterbi_combined_cs.cc
+/trellis_viterbi_combined_is.cc
+/trellis_viterbi_combined_si.h
+/trellis_viterbi_combined_si.i
+/trellis_viterbi_combined_ss.cc
+/trellis_viterbi_combined_fb.cc
+/trellis_viterbi_combined_fi.h
+/trellis_viterbi_combined_fi.i
+/trellis_viterbi_combined_cb.h
+/trellis_viterbi_combined_cb.i
+/trellis_viterbi_combined_ci.cc
+/trellis_viterbi_combined_ii.cc
+/trellis_viterbi_combined_ii.h
+/trellis_viterbi_combined_ii.i
+/trellis_viterbi_combined_sb.h
+/trellis_viterbi_combined_sb.i
+/trellis_viterbi_combined_si.cc
+/trellis_viterbi_combined_fb.h
+/trellis_viterbi_combined_fb.i
+/trellis_viterbi_combined_ib.h
+/trellis_viterbi_combined_ib.i
+/trellis_viterbi_combined_cs.h
+/trellis_viterbi_combined_cs.i
+/trellis_viterbi_combined_fs.cc
+/trellis_viterbi_combined_cb.cc
+/trellis_viterbi_combined_ss.h
+/trellis_viterbi_combined_ss.i
+/trellis_viterbi_combined_ib.cc
+/trellis_viterbi_combined_sb.cc
+/trellis_generated.i
+/generate-stamp
+/stamp-*
--- /dev/null
+/Makefile
+/Makefile.in
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.pyc
+/*.pyo
+/run_tests
--- /dev/null
+/*.cache
+/*.la
+/*.lo
+/*.pc
+/.deps
+/.la
+/.libs
+/.lo
+/Makefile
+/Makefile.in
+/aclocal.m4
+/autom4te.cache
+/config.cache
+/config.h
+/config.h.in
+/config.log
+/config.status
+/configure
+/depcomp
+/install-sh
+/libtool
+/ltmain.sh
+/make.log
+/missing
+/missing
+/mkinstalldirs
+/py-compile
+/stamp-h
+/stamp-h.in
+/stamp-h1
--- /dev/null
+/Makefile
+/Makefile.in
+/.libs
+/.deps
+/usrp_siggen
+/usrp_rx_cfile
--- /dev/null
+/Makefile
+/Makefile.in
+/.deps
+/.libs
+/*.la
+/*.lo
+/usrp_swig.cc
+/usrp_swig.py
+/run_tests
+/usrp_dbids.py
+/*.pyc
--- /dev/null
+/Makefile
+/Makefile.in
+/gnuradio-usrp2.pc
--- /dev/null
+/Makefile
+/Makefile.in
+/.libs
+/.deps
+/usrp2.py
+/usrp2.cc
+/run_tests
+/test_gr_usrp2
+/*.pyc
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/Makefile
+/Makefile.in
+/*.pyc
gr_plot_qt.py \
gr_filter_design.py \
lsusrp \
+ qr_fft.py \
usrp_fft.py \
usrp_oscope.py \
usrp_print_db.py \
--- /dev/null
+#!/usr/bin/env python
+#
+# Copyright 2004,2005,2007,2008,2009 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+from gnuradio.wxgui import forms
+from gnuradio import gr, gru
+from gnuradio import vrt
+from gnuradio import eng_notation
+from gnuradio.eng_option import eng_option
+from gnuradio.wxgui import stdgui2, fftsink2, waterfallsink2, scopesink2, form, slider
+from gnuradio.gr import pubsub
+from optparse import OptionParser
+import wx
+import sys
+import numpy
+import time
+
+class app_top_block(stdgui2.std_top_block, pubsub.pubsub):
+ def __init__(self, frame, panel, vbox, argv):
+ stdgui2.std_top_block.__init__(self, frame, panel, vbox, argv)
+ pubsub.pubsub.__init__(self)
+ self.frame = frame
+ self.panel = panel
+
+ parser = OptionParser(option_class=eng_option)
+ #parser.add_option("-e", "--interface", type="string", default="eth0",
+ # help="select Ethernet interface, default is eth0")
+ #parser.add_option("-m", "--mac-addr", type="string", default="",
+ # help="select USRP by MAC address, default is auto-select")
+ #parser.add_option("-A", "--antenna", default=None,
+ # help="select Rx Antenna (only on RFX-series boards)")
+ #parser.add_option("-d", "--decim", type="int", default=16,
+ # help="set fgpa decimation rate to DECIM [default=%default]")
+ #parser.add_option("-f", "--freq", type="eng_float", default=None,
+ # help="set frequency to FREQ", metavar="FREQ")
+ #parser.add_option("-g", "--gain", type="eng_float", default=None,
+ # help="set gain in dB (default is midpoint)")
+ parser.add_option("-W", "--waterfall", action="store_true", default=False,
+ help="Enable waterfall display")
+ parser.add_option("-S", "--oscilloscope", action="store_true", default=False,
+ help="Enable oscilloscope display")
+ parser.add_option("", "--avg-alpha", type="eng_float", default=1e-1,
+ help="Set fftsink averaging factor, default=[%default]")
+ parser.add_option("", "--ref-scale", type="eng_float", default=1.0,
+ help="Set dBFS=0dB input value, default=[%default]")
+ parser.add_option("--fft-size", type="int", default=1024,
+ help="Set number of FFT bins [default=%default]")
+ parser.add_option("--samples-per-pkt", type="int", default=0,
+ help="Set number of SAMPLES-PER-PKT [default=%default]")
+ parser.add_option("", "--ip-addr", type="string", default="192.168.10.2",
+ help="IP address default=[%default]")
+ (options, args) = parser.parse_args()
+ if len(args) != 0:
+ parser.print_help()
+ sys.exit(1)
+ self.options = options
+ self.show_debug_info = True
+
+ self.u = vrt.quadradio_source_32fc(options.ip_addr,
+ int(62.5e6), options.samples_per_pkt)
+ #self.u.set_decim(options.decim)
+
+ #input_rate = self.u.adc_rate() / self.u.decim()
+ input_rate = int(120e6/4)
+
+ if options.waterfall:
+ self.scope = \
+ waterfallsink2.waterfall_sink_c (panel, fft_size=1024, sample_rate=input_rate)
+ elif options.oscilloscope:
+ self.scope = scopesink2.scope_sink_c(panel, sample_rate=input_rate)
+ else:
+ self.scope = fftsink2.fft_sink_c (panel,
+ fft_size=options.fft_size,
+ sample_rate=input_rate,
+ ref_scale=options.ref_scale,
+ ref_level=20.0,
+ y_divs = 12,
+ avg_alpha=options.avg_alpha)
+
+ self.connect(self.u, self.scope)
+
+ self._build_gui(vbox)
+ self._setup_events()
+
+ # set initial values
+
+ #if options.gain is None:
+ # # if no gain was specified, use the mid-point in dB
+ # g = self.u.gain_range()
+ # options.gain = float(g[0]+g[1])/2
+
+ #if options.freq is None:
+ # # if no freq was specified, use the mid-point
+ # r = self.u.freq_range()
+ # options.freq = float(r[0]+r[1])/2
+
+ #self.set_gain(options.gain)
+
+ #if options.antenna is not None:
+ # print "Selecting antenna %s" % (options.antenna,)
+ # self.subdev.select_rx_antenna(options.antenna)
+
+ if self.show_debug_info:
+ # self.myform['decim'].set_value(self.u.decim())
+ self.myform['fs@gbe'].set_value(input_rate)
+ # self.myform['dbname'].set_value("0x%04X" % (self.u.daughterboard_id(),)) # FIXME: add text name
+ self.myform['baseband'].set_value(0)
+ self.myform['ddc'].set_value(0)
+
+ #if not(self.set_freq(options.freq)):
+ # self._set_status_msg("Failed to set initial frequency")
+
+ def _set_status_msg(self, msg):
+ self.frame.GetStatusBar().SetStatusText(msg, 0)
+
+ def _build_gui(self, vbox):
+
+ def _form_set_freq(kv):
+ return self.set_freq(kv['freq'])
+
+ vbox.Add(self.scope.win, 10, wx.EXPAND)
+
+ # add control area at the bottom
+ self.myform = myform = form.form()
+ hbox = wx.BoxSizer(wx.HORIZONTAL)
+ hbox.Add((5,0), 0, 0)
+ myform['freq'] = form.float_field(
+ parent=self.panel, sizer=hbox, label="Center freq", weight=1,
+ callback=myform.check_input_and_call(_form_set_freq, self._set_status_msg))
+
+ hbox.Add((5,0), 0, 0)
+ #g = self.u.gain_range()
+
+ # some configurations don't have gain control
+ if 0 and g[1] > g[0]:
+ myform['gain'] = form.slider_field(parent=self.panel, sizer=hbox, label="Gain",
+ weight=3,
+ min=int(g[0]), max=int(g[1]),
+ callback=self.set_gain)
+
+ hbox.Add((5,0), 0, 0)
+ vbox.Add(hbox, 0, wx.EXPAND)
+
+ self._build_subpanel(vbox)
+
+ def _build_subpanel(self, vbox_arg):
+ # build a secondary information panel (sometimes hidden)
+
+ # FIXME figure out how to have this be a subpanel that is always
+ # created, but has its visibility controlled by foo.Show(True/False)
+
+ def _form_set_decim(kv):
+ return self.set_decim(kv['decim'])
+
+ if not(self.show_debug_info):
+ return
+
+ panel = self.panel
+ vbox = vbox_arg
+ myform = self.myform
+
+ #panel = wx.Panel(self.panel, -1)
+ #vbox = wx.BoxSizer(wx.VERTICAL)
+
+ hbox = wx.BoxSizer(wx.HORIZONTAL)
+ hbox.Add((5,0), 0)
+
+ myform['decim'] = form.int_field(
+ parent=panel, sizer=hbox, label="Decim",
+ callback=myform.check_input_and_call(_form_set_decim, self._set_status_msg))
+
+ hbox.Add((5,0), 1)
+ myform['fs@gbe'] = form.static_float_field(
+ parent=panel, sizer=hbox, label="Fs@GbE")
+
+ hbox.Add((5,0), 1)
+ myform['dbname'] = form.static_text_field(
+ parent=panel, sizer=hbox)
+
+ hbox.Add((5,0), 1)
+ myform['baseband'] = form.static_float_field(
+ parent=panel, sizer=hbox, label="Analog BB")
+
+ hbox.Add((5,0), 1)
+ myform['ddc'] = form.static_float_field(
+ parent=panel, sizer=hbox, label="DDC")
+
+ hbox.Add((5,0), 0)
+ vbox.Add(hbox, 0, wx.EXPAND)
+ ##### db control stuff #####
+ self.subscribe('cal_div_lo_freq', lambda x: self.u.set_lo_freq(x) and time.sleep(0.01))
+ self.subscribe('cal_div_lo_freq', self.u.set_center_freq) #TODO should be combined with set lo freq
+ self.subscribe('cal_div_cal_freq', lambda x: self.u.set_cal_freq(x) and time.sleep(0.01))
+ self.subscribe('db_ctrl_atten0', self.u.set_attenuation0)
+ self.subscribe('db_ctrl_atten1', self.u.set_attenuation1)
+ self.subscribe('sys_beaming', self.u.set_beamforming)
+ #self.subscribe('db_ctrl_10db', self.u.set_10dB_atten)
+ self.subscribe('db_ctrl_adcgain', self.u.set_adc_gain)
+ self.subscribe('db_ctrl_diggain', self.u.set_digital_gain)
+ self.subscribe('db_ctrl_dcoffset', self.u.set_dc_offset_comp)
+ self.subscribe('db_ctrl_bandsel', self.u.set_band_select)
+ self.subscribe('db_ctrl_type', self.u.select_rx_antenna)
+ self.subscribe('db_test_signal', self.u.set_test_signal)
+ self['db_ctrl_bandsel'] = 'A'
+ self['cal_div_lo_freq'] = 2.1e9
+ self['cal_div_cal_freq'] = 2.102e9
+ self['db_ctrl_atten0'] = 0
+ self['db_ctrl_atten1'] = 0
+ #self['db_ctrl_10db'] = False
+ self['db_ctrl_adcgain'] = False
+ self['db_ctrl_dcoffset'] = False
+ self['db_ctrl_diggain'] = 0.0
+ self['db_ctrl_type'] = 'rf'
+ self['db_test_signal'] = vrt.VRT_TEST_SIG_NORMAL
+ self['sys_beaming'] = [16.7e6, 0, 0, 0]
+ #slider and box for freqs
+ for key, name in (('cal_div_lo_freq', 'LO Freq'), ('cal_div_cal_freq', 'Cal Freq')):
+ hbox = wx.BoxSizer(wx.HORIZONTAL)
+ hbox.AddSpacer(10)
+ forms.text_box(
+ label=name,
+ ps=self,
+ key=key,
+ sizer=hbox,
+ parent=panel,
+ proportion=0,
+ converter=forms.float_converter()
+ )
+ hbox.AddSpacer(20)
+ forms.slider(
+ ps=self,
+ key=key,
+ minimum=0, #TODO get bounds from cal_div, from vrt...
+ maximum=int(3.5e9),
+ step_size=int(5e6),
+ cast=float,
+ sizer=hbox,
+ parent=panel,
+ proportion=2,
+ )
+ hbox.AddSpacer(10)
+ vbox.Add(hbox, 0, wx.EXPAND)
+ ############################################
+ hbox = wx.BoxSizer(wx.HORIZONTAL)
+ hbox.AddSpacer(10)
+ #create slider for atten
+ atten0_txt_box = forms.static_text(
+ label='Attenuation (0)',
+ ps=self,
+ key='db_ctrl_atten0',
+ sizer=hbox,
+ parent=panel,
+ proportion=0,
+ converter=forms.int_converter()
+ )
+ hbox.AddSpacer(20)
+ atten0_slider = forms.slider(
+ ps=self,
+ key='db_ctrl_atten0',
+ minimum=0,
+ maximum=31,
+ step_size=1,
+ cast=int,
+ sizer=hbox,
+ parent=panel,
+ proportion=2,
+ )
+ hbox.AddSpacer(10)
+ #create slider for atten
+ forms.static_text(
+ label='Attenuation (1)',
+ ps=self,
+ key='db_ctrl_atten1',
+ sizer=hbox,
+ parent=panel,
+ proportion=0,
+ converter=forms.int_converter()
+ )
+ hbox.AddSpacer(20)
+ forms.slider(
+ ps=self,
+ key='db_ctrl_atten1',
+ minimum=0,
+ maximum=31,
+ step_size=1,
+ cast=int,
+ sizer=hbox,
+ parent=panel,
+ proportion=2,
+ )
+ hbox.AddSpacer(10)
+ def update_atten0(*args):
+ for form_obj in (atten0_txt_box, atten0_slider): form_obj.Enable(self['db_ctrl_bandsel'] > 'B')
+ update_atten0()
+ self.subscribe('db_ctrl_bandsel', update_atten0)
+ #create checkbox for 10dB att
+ #forms.check_box(
+ # label='10dB Attenuation',
+ # ps=self,
+ # key='db_ctrl_10db',
+ # sizer=hbox,
+ # parent=panel,
+ # proportion=1,
+ #)
+ #hbox.AddSpacer(10)
+ vbox.Add(hbox, 0, wx.EXPAND)
+ hbox2 = wx.BoxSizer(wx.HORIZONTAL)
+ hbox2.AddSpacer(10)
+ forms.static_text(
+ label='ADC Controls',
+ ps=self,
+ key='db_ctrl_diggain',
+ sizer=hbox2,
+ parent=panel,
+ proportion=0,
+ converter=forms.float_converter()
+ )
+ hbox2.AddSpacer(20)
+ #create checkbox for ADC digital gain
+ forms.slider(
+ #label='ADC Digital Gain',
+ ps=self,
+ minimum=0,
+ maximum=6,
+ step_size=0.5,
+ key='db_ctrl_diggain',
+ sizer=hbox2,
+ parent=panel,
+ proportion=2,
+ )
+ hbox2.AddSpacer(10)
+ #create checkbox for 3.5dB ADC gain
+ forms.check_box(
+ label='3.5dB ADC Gain',
+ ps=self,
+ key='db_ctrl_adcgain',
+ sizer=hbox2,
+ parent=panel,
+ proportion=1,
+ )
+ hbox2.AddSpacer(10)
+ #create checkbox for DC Offset Correction in ADC
+ forms.check_box(
+ label='DC Offset Correction',
+ ps=self,
+ key='db_ctrl_dcoffset',
+ sizer=hbox2,
+ parent=panel,
+ proportion=2,
+ )
+ hbox2.AddSpacer(10)
+ vbox.Add(hbox2, 0, wx.EXPAND)
+ hbox = wx.BoxSizer(wx.HORIZONTAL)
+ hbox.AddSpacer(10)
+ #create radio buttons for band sel
+ forms.radio_buttons(
+ label='Band Select',
+ ps=self,
+ key='db_ctrl_bandsel',
+ choices=['A', 'B', 'C', 'D'],
+ labels=['A', 'B', 'C', 'D'],
+ sizer=hbox,
+ parent=panel,
+ proportion=0,
+ )
+ hbox.AddSpacer(10)
+ forms.radio_buttons(
+ label='RF Input',
+ ps=self,
+ key='db_ctrl_type',
+ choices=['rf', 'cal'],
+ labels=['Main RF', 'Calibrator'],
+ sizer=hbox,
+ parent=panel,
+ proportion=0,
+ )
+ hbox.AddSpacer(10)
+ #create radio buttons for band sel
+ types = sorted(
+ filter(lambda x: x.startswith('VRT_TEST_SIG_'), dir(vrt)),
+ lambda x, y: cmp(getattr(vrt, x), getattr(vrt, y)),
+ )
+ forms.drop_down(
+ label='Test Signal',
+ ps=self,
+ key='db_test_signal',
+ choices=map(lambda a: getattr(vrt, a), types),
+ labels=types,
+ sizer=hbox,
+ parent=panel,
+ proportion=0,
+ )
+ hbox.AddSpacer(10)
+ #create radio buttons for type
+ forms.drop_down(
+ label='Beamformer',
+ ps=self,
+ key='sys_beaming',
+ choices=[[16.7e6, 0, 0, 0], [0, 16.7e6, 0, 0], [0, 0, 16.7e6, 0], [0, 0, 0, 16.7e6], [4.19e6]*4],
+ labels=['Ant0', 'Ant1', 'Ant2', 'Ant3', 'Equal Gain'],
+ sizer=hbox,
+ parent=panel,
+ proportion=0,
+ )
+ hbox.AddSpacer(10)
+ vbox.Add(hbox, 0, wx.EXPAND)
+
+ def set_freq(self, target_freq):
+ """
+ Set the center frequency we're interested in.
+
+ @param target_freq: frequency in Hz
+ @rypte: bool
+
+ Tuning is a two step process. First we ask the front-end to
+ tune as close to the desired frequency as it can. Then we use
+ the result of that operation and our target_frequency to
+ determine the value for the digital down converter.
+ """
+ return True
+
+ r = self.u.set_center_freq(target_freq)
+
+ if r:
+ self.myform['freq'].set_value(target_freq) # update displayed value
+ if self.show_debug_info:
+ self.myform['baseband'].set_value(r.baseband_freq)
+ self.myform['ddc'].set_value(r.dxc_freq)
+ if not self.options.oscilloscope:
+ self.scope.win.set_baseband_freq(target_freq)
+ return True
+
+ return False
+
+ def set_gain(self, gain):
+ return True
+
+ if self.myform.has_key('gain'):
+ self.myform['gain'].set_value(gain) # update displayed value
+ self.u.set_gain(gain)
+
+ def set_decim(self, decim):
+ return True
+
+ ok = self.u.set_decim(decim)
+ if not ok:
+ print "set_decim failed"
+ #input_rate = self.u.adc_rate() / self.u.decim()
+ input_rate = 120e6/4
+ self.scope.set_sample_rate(input_rate)
+ if self.show_debug_info: # update displayed values
+ self.myform['decim'].set_value(self.u.decim())
+ self.myform['fs@gbe'].set_value(input_rate)
+ return ok
+
+ def _setup_events(self):
+ if not self.options.waterfall and not self.options.oscilloscope:
+ self.scope.win.Bind(wx.EVT_LEFT_DCLICK, self.evt_left_dclick)
+
+ def evt_left_dclick(self, event):
+ (ux, uy) = self.scope.win.GetXY(event)
+ if event.CmdDown():
+ # Re-center on maximum power
+ points = self.scope.win._points
+ if self.scope.win.peak_hold:
+ if self.scope.win.peak_vals is not None:
+ ind = numpy.argmax(self.scope.win.peak_vals)
+ else:
+ ind = int(points.shape()[0]/2)
+ else:
+ ind = numpy.argmax(points[:,1])
+ (freq, pwr) = points[ind]
+ target_freq = freq/self.scope.win._scale_factor
+ print ind, freq, pwr
+ self.set_freq(target_freq)
+ else:
+ # Re-center on clicked frequency
+ target_freq = ux/self.scope.win._scale_factor
+ self.set_freq(target_freq)
+
+
+def main ():
+ app = stdgui2.stdapp(app_top_block, "QuadRadio FFT", nstatus=1)
+ app.MainLoop()
+
+if __name__ == '__main__':
+ main ()
--- /dev/null
+/*.cache
+/*.la
+/*.lo
+/*.pc
+/.deps
+/.la
+/.libs
+/.lo
+/Makefile
+/Makefile.in
+/aclocal.m4
+/autom4te.cache
+/config.cache
+/config.h
+/config.h.in
+/config.log
+/config.status
+/configure
+/depcomp
+/install-sh
+/libtool
+/ltmain.sh
+/make.log
+/missing
+/missing
+/mkinstalldirs
+/py-compile
+/stamp-h
+/stamp-h.in
+/stamp-h1
+/stamp-h1.in
+/stamp-h2.in
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.pyc
+/video_sdl.cc
+/video_sdl.py
+/run_tests
--- /dev/null
+Makefile
+Makefile.in
+gnuradio-vrt.pc
--- /dev/null
+#
+# Copyright 2001,2006,2008,2009 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+include $(top_srcdir)/Makefile.common
+
+SUBDIRS = src
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = gnuradio-vrt.pc
--- /dev/null
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@/gnuradio
+
+Name: gnuradio-vrt
+Description: GNU Software Radio support for Virtual Radio Transport (VRT aka VITA-49)
+Requires: gnuradio-core vrt
+Version: @VERSION@
+Libs: -L${libdir} -lgnuradio-vrt
+Cflags: -I${includedir}
--- /dev/null
+Makefile
+Makefile.in
+.deps
+.libs
+run_tests
+vrt.py
+vrt.pyc
+vrt.cc
--- /dev/null
+#
+# Copyright 2004,2005,2006,2008,2009 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+include $(top_srcdir)/Makefile.common
+
+# ----------------------------------------------------------------------
+# Local Python files, not installed
+#
+# qa_vrt.py
+# ----------------------------------------------------------------------
+
+noinst_PYTHON = qa_vrt.py
+
+# ----------------------------------------------------------------------
+# Miscellaneous build operations
+# ----------------------------------------------------------------------
+
+EXTRA_DIST = run_tests.in
+TESTS = run_tests
+DISTCLEANFILES = run_tests
+
+# ----------------------------------------------------------------------
+# C++ block API interface librar(ies)
+#
+# libgnuradio_vrt.so
+# ----------------------------------------------------------------------
+AM_CPPFLAGS = \
+ $(STD_DEFINES_AND_INCLUDES) \
+ $(GRUEL_INCLUDES) \
+ $(PYTHON_CPPFLAGS) \
+ $(VRT_INCLUDES) \
+ $(WITH_INCLUDES)
+
+lib_LTLIBRARIES = libgnuradio-vrt.la
+
+libgnuradio_vrt_la_SOURCES = \
+ missing_pkt_checker.cc \
+ vrt_source_base.cc \
+ vrt_source_32fc.cc \
+ vrt_quadradio_source_32fc.cc
+
+
+#libgnuradio_vrt_la_SOURCES = \
+# rx_16sc_handler.cc \
+# rx_32fc_handler.cc \
+# vrt_base.cc \
+# vrt_source_base.cc \
+# vrt_source_16sc.cc \
+# vrt_source_32fc.cc
+
+# vrt_sink_base.cc \
+# vrt_sink_16sc.cc \
+# vrt_sink_32fc.cc
+
+libgnuradio_vrt_la_LIBADD = \
+ $(VRT_LA) \
+ $(GNURADIO_CORE_LA)
+
+grinclude_HEADERS = \
+ vrt_source_base.h \
+ vrt_source_32fc.h \
+ vrt_quadradio_source_32fc.h
+
+# vrt_source_16sc.h \
+# vrt_sink_base.h \
+# vrt_sink_16sc.h \
+# vrt_sink_32fc.h
+
+noinst_HEADERS = \
+ missing_pkt_checker.h
+
+
+# ----------------------------------------------------------------------
+# Python SWIG wrapper around C++ library
+#
+# vrt.py
+# _vrt.so
+# ----------------------------------------------------------------------
+
+TOP_SWIG_IFILES = \
+ vrt.i
+
+# Install so that they end up available as:
+# import gnuradio.vrt
+# This ends up at:
+# ${prefix}/lib/python${python_version}/site-packages/gnuradio
+vrt_pythondir_category = \
+ gnuradio
+
+# additional arguments to the SWIG command
+vrt_swig_args = \
+ $(VRT_INCLUDES)
+
+# additional libraries for linking with the SWIG-generated library
+vrt_la_swig_libadd = \
+ libgnuradio-vrt.la
+
+include $(top_srcdir)/Makefile.swig
+
+# add some of the variables generated inside the Makefile.swig.gen
+BUILT_SOURCES = $(swig_built_sources)
+
+# Do not distribute the output of SWIG
+no_dist_files = $(swig_built_sources)
--- /dev/null
+# -*- Makefile -*-
+#
+# Copyright 2009 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+# Makefile.swig.gen for vrt.i
+
+## Default install locations for these files:
+##
+## Default location for the Python directory is:
+## ${prefix}/lib/python${python_version}/site-packages/[category]/vrt
+## Default location for the Python exec directory is:
+## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/vrt
+##
+## The following can be overloaded to change the install location, but
+## this has to be done in the including Makefile.am -before-
+## Makefile.swig is included.
+
+vrt_pythondir_category ?= gnuradio/vrt
+vrt_pylibdir_category ?= $(vrt_pythondir_category)
+vrt_pythondir = $(pythondir)/$(vrt_pythondir_category)
+vrt_pylibdir = $(pyexecdir)/$(vrt_pylibdir_category)
+
+## SWIG headers are always installed into the same directory.
+
+vrt_swigincludedir = $(swigincludedir)
+
+## This is a template file for a "generated" Makefile addition (in
+## this case, "Makefile.swig.gen"). By including the top-level
+## Makefile.swig, this file will be used to generate the SWIG
+## dependencies. Assign the variable TOP_SWIG_FILES to be the list of
+## SWIG .i files to generated wrappings for; there can be more than 1
+## so long as the names are unique (no sorting is done on the
+## TOP_SWIG_FILES list). This file explicitly assumes that a SWIG .i
+## file will generate .cc, .py, and possibly .h files -- meaning that
+## all of these files will have the same base name (that provided for
+## the SWIG .i file).
+##
+## This code is setup to ensure parallel MAKE ("-j" or "-jN") does the
+## right thing. For more info, see <
+## http://sources.redhat.com/automake/automake.html#Multiple-Outputs >
+
+## Stamps used to ensure parallel make does the right thing. These
+## are removed by "make clean", but otherwise unused except during the
+## parallel built. These will not be included in a tarball, because
+## the SWIG-generated files will be removed from the distribution.
+
+STAMPS += $(DEPDIR)/vrt-generate-*
+
+## Other cleaned files: dependency files generated by SWIG or this Makefile
+
+MOSTLYCLEANFILES += $(DEPDIR)/*.S*
+
+## Add the .py and .cc files to the list of SWIG built sources. The
+## .h file is sometimes built, but not always ... so that one has to
+## be added manually by the including Makefile.am .
+
+swig_built_sources += vrt.py vrt.cc
+
+## Various SWIG variables. These can be overloaded in the including
+## Makefile.am by setting the variable value there, then including
+## Makefile.swig .
+
+vrt_swiginclude_HEADERS = \
+ vrt.i \
+ $(vrt_swiginclude_headers)
+
+vrt_pylib_LTLIBRARIES = \
+ _vrt.la
+
+_vrt_la_SOURCES = \
+ vrt.cc \
+ $(vrt_la_swig_sources)
+
+_vrt_la_LIBADD = \
+ $(STD_SWIG_LA_LIB_ADD) \
+ $(vrt_la_swig_libadd)
+
+_vrt_la_LDFLAGS = \
+ $(STD_SWIG_LA_LD_FLAGS) \
+ $(vrt_la_swig_ldflags)
+
+_vrt_la_CXXFLAGS = \
+ $(STD_SWIG_CXX_FLAGS) \
+ $(vrt_la_swig_cxxflags)
+
+vrt_python_PYTHON = \
+ vrt.py \
+ $(vrt_python)
+
+## Entry rule for running SWIG
+
+vrt.h vrt.py vrt.cc: vrt.i
+## This rule will get called only when MAKE decides that one of the
+## targets needs to be created or re-created, because:
+##
+## * The .i file is newer than any or all of the generated files;
+##
+## * Any or all of the .cc, .h, or .py files does not exist and is
+## needed (in the case this file is not needed, the rule for it is
+## ignored); or
+##
+## * Some SWIG-based dependecy of the .cc file isn't met and hence the
+## .cc file needs be be regenerated. Explanation: Because MAKE
+## knows how to handle dependencies for .cc files (regardless of
+## their name or extension), then the .cc file is used as a target
+## instead of the .i file -- but with the dependencies of the .i
+## file. It is this last reason why the line:
+##
+## if test -f $@; then :; else
+##
+## cannot be used in this case: If a .i file dependecy is not met,
+## then the .cc file needs to be rebuilt. But if the stamp is newer
+## than the .cc file, and the .cc file exists, then in the original
+## version (with the 'test' above) the internal MAKE call will not
+## be issued and hence the .cc file will not be rebuilt.
+##
+## Once execution gets to here, it should always proceed no matter the
+## state of a stamp (as discussed in link above). The
+## $(DEPDIR)/vrt-generate stuff is used to allow for parallel
+## builds to "do the right thing". The stamp has no relationship with
+## either the target files or dependency file; it is used solely for
+## the protection of multiple builds during a given call to MAKE.
+##
+## Catch signals SIGHUP (1), SIGINT (2), SIGPIPE (13), and SIGTERM
+## (15). At a caught signal, the quoted command will be issued before
+## exiting. In this case, remove any stamp, whether temporary of not.
+## The trap is valid until the process exits; the process includes all
+## commands appended via "\"s.
+##
+ trap 'rm -rf $(DEPDIR)/vrt-generate-*' 1 2 13 15; \
+##
+## Create a temporary directory, which acts as a lock. The first
+## process to create the directory will succeed and issue the MAKE
+## command to do the actual work, while all subsequent processes will
+## fail -- leading them to wait for the first process to finish.
+##
+ if mkdir $(DEPDIR)/vrt-generate-lock 2>/dev/null; then \
+##
+## This code is being executed by the first process to succeed in
+## creating the directory lock.
+##
+## Remove the stamp associated with this filename.
+##
+ rm -f $(DEPDIR)/vrt-generate-stamp; \
+##
+## Tell MAKE to run the rule for creating this stamp.
+##
+ $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/vrt-generate-stamp WHAT=$<; \
+##
+## Now that the .cc, .h, and .py files have been (re)created from the
+## .i file, future checking of this rule during the same MAKE
+## execution will come back that the rule doesn't need to be executed
+## because none of the conditions mentioned at the start of this rule
+## will be positive. Remove the the directory lock, which frees up
+## any waiting process(es) to continue.
+##
+ rmdir $(DEPDIR)/vrt-generate-lock; \
+ else \
+##
+## This code is being executed by any follower processes while the
+## directory lock is in place.
+##
+## Wait until the first process is done, testing once per second.
+##
+ while test -d $(DEPDIR)/vrt-generate-lock; do \
+ sleep 1; \
+ done; \
+##
+## Succeed if and only if the first process succeeded; exit this
+## process returning the status of the generated stamp.
+##
+ test -f $(DEPDIR)/vrt-generate-stamp; \
+ exit $$?; \
+ fi;
+
+$(DEPDIR)/vrt-generate-stamp:
+## This rule will be called only by the first process issuing the
+## above rule to succeed in creating the lock directory, after
+## removing the actual stamp file in order to guarantee that MAKE will
+## execute this rule.
+##
+## Call SWIG to generate the various output files; special
+## post-processing on 'mingw32' host OS for the dependency file.
+##
+ if $(SWIG) $(STD_SWIG_PYTHON_ARGS) $(vrt_swig_args) \
+ -MD -MF $(DEPDIR)/vrt.Std \
+ -module vrt -o vrt.cc $(WHAT); then \
+ if test $(host_os) = mingw32; then \
+ $(RM) $(DEPDIR)/vrt.Sd; \
+ $(SED) 's,\\\\,/,g' < $(DEPDIR)/vrt.Std \
+ > $(DEPDIR)/vrt.Sd; \
+ $(RM) $(DEPDIR)/vrt.Std; \
+ $(MV) $(DEPDIR)/vrt.Sd $(DEPDIR)/vrt.Std; \
+ fi; \
+ else \
+ $(RM) $(DEPDIR)/vrt.S*; exit 1; \
+ fi;
+##
+## Mess with the SWIG output .Std dependency file, to create a
+## dependecy file valid for the input .i file: Basically, simulate the
+## dependency file created for libraries by GNU's libtool for C++,
+## where all of the dependencies for the target are first listed, then
+## each individual dependency is listed as a target with no further
+## dependencies.
+##
+## (1) remove the current dependency file
+##
+ $(RM) $(DEPDIR)/vrt.d
+##
+## (2) Copy the whole SWIG file:
+##
+ cp $(DEPDIR)/vrt.Std $(DEPDIR)/vrt.d
+##
+## (3) all a carriage return to the end of the dependency file.
+##
+ echo "" >> $(DEPDIR)/vrt.d
+##
+## (4) from the SWIG file, remove the first line (the target); remove
+## trailing " \" and " " from each line. Append ":" to each line,
+## followed by 2 carriage returns, then append this to the end of
+## the dependency file.
+##
+ $(SED) -e '1d;s, \\,,g;s, ,,g' < $(DEPDIR)/vrt.Std | \
+ awk '{ printf "%s:\n\n", $$0 }' >> $(DEPDIR)/vrt.d
+##
+## (5) remove the SWIG-generated file
+##
+ $(RM) $(DEPDIR)/vrt.Std
+##
+## Create the stamp for this filename generation, to signal success in
+## executing this rule; allows other threads waiting on this process
+## to continue.
+##
+ touch $(DEPDIR)/vrt-generate-stamp
+
+# KLUDGE: Force runtime include of a SWIG dependency file. This is
+# not guaranteed to be portable, but will probably work. If it works,
+# we have accurate dependencies for our swig stuff, which is good.
+
+@am__include@ @am__quote@./$(DEPDIR)/vrt.d@am__quote@
+
--- /dev/null
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <missing_pkt_checker.h>
+
+int
+missing_pkt_checker::check(const vrt::expanded_header *hdr)
+{
+ // FIXME assumes we're inspecting only a single stream
+
+ int nmissing = 0;
+ int actual = hdr->pkt_cnt();
+ int expected = (d_last_pkt_cnt + 1) & 0xf;
+ if (actual != expected && !d_resync){
+ d_nwrong_pkt_cnt++;
+ if (actual > expected)
+ nmissing = actual - expected;
+ else
+ nmissing = actual + 16 - expected;
+ d_nmissing_pkt_est += nmissing;
+ }
+ d_last_pkt_cnt = actual;
+ d_npackets++;
+ d_resync = false;
+ return nmissing;
+}
--- /dev/null
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef INCLUDED_MISSING_PKT_CHECKER_H
+#define INCLUDED_MISSING_PKT_CHECKER_H
+
+#include <vrt/expanded_header.h>
+#include <stdint.h>
+
+/*!
+ * \brief Check for missing packets
+ */
+class missing_pkt_checker
+{
+ // FIXME assumes we're inspecting only a single stream
+
+ bool d_resync;
+ uint64_t d_npackets; //< total number of packets
+ int d_last_pkt_cnt; //< the last pkt_cnt we saw
+ uint64_t d_nwrong_pkt_cnt; //< number of incorrect pkt_cnt
+ uint64_t d_nmissing_pkt_est; //< estimate of total number of missing pkts
+
+public:
+ missing_pkt_checker()
+ : d_resync(true), d_npackets(0), d_last_pkt_cnt(0xf), d_nwrong_pkt_cnt(0),
+ d_nmissing_pkt_est(0) {}
+
+ /*!
+ * \brief check header pkt_cnt and return 0 if OK, else estimate of number of missing packets.
+ */
+ int check(const vrt::expanded_header *hdr);
+
+ void resync() { d_resync = true; }
+ uint64_t npackets() const { return d_npackets; }
+ uint64_t nwrong_pkt_cnt() const { return d_nwrong_pkt_cnt; }
+ uint64_t nmissing_pkt_est() const { return d_nmissing_pkt_est; }
+};
+
+
+#endif /* INCLUDED_MISSING_PKT_CHECKER_H */
--- /dev/null
+#!/usr/bin/env python
+#
+# Copyright 2005,2008,2009 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+from gnuradio import gr, gr_unittest
+import vrt
+
+class qa_vrt(gr_unittest.TestCase):
+
+ def setUp(self):
+ self.tb = gr.top_block()
+
+ def tearDown(self):
+ self.tb = None
+
+ def test_000_nop (self):
+ """Just see if we can import the module...
+ They may not have a VRT connected, etc. Don't try to run anything"""
+ pass
+
+if __name__ == '__main__':
+ gr_unittest.main ()
--- /dev/null
+#!/bin/sh
+
+# 1st parameter is absolute path to component source directory
+# 2nd parameter is absolute path to component build directory
+# 3rd parameter is path to Python QA directory
+
+# For OS/X
+DYLD_LIBRARY_PATH=@abs_top_builddir@/vrt/host/lib/legacy:@abs_top_builddir@/vrt/host/lib/legacy/.libs:$DYLD_LIBRARY_PATH
+export DYLD_LIBRARY_PATH
+
+# For Win32
+PATH=@abs_top_builddir@/vrt/host/lib/legacy:@abs_top_builddir@/vrt/host/lib/legacy/.libs:$PATH
+
+@top_builddir@/run_tests.sh \
+ @abs_top_srcdir@/gr-vrt \
+ @abs_top_builddir@/gr-vrt \
+ @srcdir@
--- /dev/null
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+%include "gnuradio.i" // the common stuff
+%import <stdint.i>
+
+%{
+#include "vrt_quadradio_source_32fc.h"
+#include <vrt/quadradio.h>
+//#include "vrt_quadradio_source_16sc.h"
+//#include "vrt_sink_32fc.h"
+//#include "vrt_sink_16sc.h"
+%}
+
+%template(uint32_t_vector) std::vector<uint32_t>;
+
+// ----------------------------------------------------------------
+
+class vrt_source_base : public gr_sync_block
+{
+protected:
+ vrt_source_base() throw (std::runtime_error);
+
+public:
+ ~vrt_source_base();
+
+};
+
+class vrt_source_32fc : public vrt_source_base
+{
+protected:
+ vrt_source_32fc() throw (std::runtime_error);
+
+public:
+ ~vrt_source_32fc();
+ void reset();
+};
+
+// ----------------------------------------------------------------
+
+GR_SWIG_BLOCK_MAGIC(vrt,quadradio_source_32fc)
+
+%include "vrt_quadradio_source_32fc.h"
+
+%include <vrt/quadradio.h>
--- /dev/null
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <vrt_quadradio_source_32fc.h>
+#include <vrt/quadradio.h>
+#include <vrt/rx_packet_handler.h>
+#include <cstdio>
+
+vrt_quadradio_source_32fc_sptr
+vrt_make_quadradio_source_32fc(const std::string &ip,
+ size_t rx_bufsize,
+ size_t samples_per_pkt)
+{
+ return gnuradio::get_initial_sptr(new vrt_quadradio_source_32fc(ip,
+ rx_bufsize,
+ samples_per_pkt));
+}
+
+vrt_quadradio_source_32fc::vrt_quadradio_source_32fc(const std::string &ip,
+ size_t rx_bufsize,
+ size_t samples_per_pkt)
+ : vrt_source_32fc("quadradio_source_32fc"),
+ d_samples_per_pkt(samples_per_pkt == 0 ? 800 : samples_per_pkt),
+ d_qr(vrt::quadradio::sptr(new vrt::quadradio(ip, rx_bufsize)))
+{
+}
+
+vrt_quadradio_source_32fc::~vrt_quadradio_source_32fc()
+{
+ d_qr->stop_streaming();
+}
+
+vrt::rx::sptr
+vrt_quadradio_source_32fc::vrt_rx() const
+{
+ return d_qr->vrt_rx();
+}
+
+bool
+vrt_quadradio_source_32fc::start()
+{
+ // throw away any stale packets before starting
+ vrt::rx_packet_handler nop;
+ vrt_rx()->rx_packets(&nop, true);
+ d_checker.resync();
+
+ return d_qr->start_streaming(d_samples_per_pkt);
+}
+
+bool
+vrt_quadradio_source_32fc::stop()
+{
+ return d_qr->stop_streaming();
+}
+
+bool
+vrt_quadradio_source_32fc::set_dboard_pins(int which_dboard, int v)
+{
+ return d_qr->set_dboard_pins(which_dboard, v);
+}
+
+bool
+vrt_quadradio_source_32fc::set_center_freq(double target_freq)
+{
+ return d_qr->set_center_freq(target_freq);
+}
+
+bool
+vrt_quadradio_source_32fc::set_band_select(const std::string &band)
+{
+ return d_qr->set_band_select(band);
+}
+
+//void
+//vrt_quadradio_source_32fc::set_10dB_atten(bool on)
+//{
+// return d_qr->set_10dB_atten(on);
+//}
+
+bool
+vrt_quadradio_source_32fc::select_rx_antenna(const std::string &ant)
+{
+ return d_qr->select_rx_antenna(ant);
+}
+
+bool
+vrt_quadradio_source_32fc::set_attenuation0(int attenuation)
+{
+ return d_qr->set_attenuation0(attenuation);
+}
+
+bool
+vrt_quadradio_source_32fc::set_attenuation1(int attenuation)
+{
+ return d_qr->set_attenuation1(attenuation);
+}
+
+void
+vrt_quadradio_source_32fc::set_adc_gain(bool on){
+ d_qr->set_adc_gain(on);
+}
+
+void
+vrt_quadradio_source_32fc::set_dc_offset_comp(bool on){
+ d_qr->set_dc_offset_comp(on);
+}
+
+void
+vrt_quadradio_source_32fc::set_digital_gain(float gain){
+ d_qr->set_digital_gain(gain);
+}
+
+void
+vrt_quadradio_source_32fc::set_test_signal(int type){
+ d_qr->set_test_signal(static_cast<vrt_test_sig_t>(type));
+}
+
+bool
+vrt_quadradio_source_32fc::set_setting_reg(int regno, int value)
+{
+ return d_qr->set_setting_reg(regno, value);
+}
+
+bool
+vrt_quadradio_source_32fc::set_hsadc_conf(int which_dboard, int regno, int value)
+{
+ return d_qr->set_hsadc_conf(which_dboard, regno, value);
+}
+
+bool
+vrt_quadradio_source_32fc::set_lsdac(int which_dboard, int which_dac, int value)
+{
+ return d_qr->set_lsdac(which_dboard, which_dac, value);
+}
+
+bool
+vrt_quadradio_source_32fc::set_mem32(int addr, int value)
+{
+ return d_qr->set_mem32(addr, value);
+}
+
+bool
+vrt_quadradio_source_32fc::set_lo_freq(double freq)
+{
+ return d_qr->set_lo_freq(freq);
+}
+
+bool
+vrt_quadradio_source_32fc::set_cal_freq(double freq)
+{
+ return d_qr->set_cal_freq(freq);
+}
+
+/*--------------------------------------------------------------------*/
+#define IQ_IMBAL_NUM_TAPS 30
+#define IQ_IMBAL_REG_NO 162
+
+//helper function to set the iq imbalance register with a tap
+static int get_iq_imbal_reg(bool real, bool init, float tap){
+ int val = int(round(tap));
+ val &= 0x1ffffff; //lower 25 bits for tap
+ val |= (real?0:1) << 30; //30th bit for filter type
+ val |= (init?1:0) << 31; //31st bit for initialization
+ printf("Reg %d Val %x\n", IQ_IMBAL_REG_NO, val);
+ return val;
+}
+
+void
+vrt_quadradio_source_32fc::set_iq_imbal_taps(const std::vector<gr_complex> taps){
+ int i = 0;
+ /* set the real part of the taps */
+ get_iq_imbal_reg(true, true, 0);
+ for (i = 0; i < IQ_IMBAL_NUM_TAPS; i++){
+ set_setting_reg(IQ_IMBAL_REG_NO, get_iq_imbal_reg(true, false, taps[IQ_IMBAL_NUM_TAPS-i-1].real()));
+ }
+ get_iq_imbal_reg(false, true, 0);
+ /* set the imaginary part of the taps */
+ for (i = 0; i < IQ_IMBAL_NUM_TAPS; i++){
+ set_setting_reg(IQ_IMBAL_REG_NO, get_iq_imbal_reg(false, false, taps[IQ_IMBAL_NUM_TAPS-i-1].imag()));
+ }
+}
+
+bool
+vrt_quadradio_source_32fc::set_beamforming(std::vector<gr_complex> gains){
+ int32_t gains_ints[8];
+ for (int i = 0; i < 4; i++){
+ gains_ints[2*i] = int32_t(gains[i].real());
+ gains_ints[2*i+1] = int32_t(gains[i].imag());
+ }
+ return d_qr->set_beamforming(gains_ints);
+}
+
--- /dev/null
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef INCLUDED_VRT_QUADRADIO_SOURCE_32FC_H
+#define INCLUDED_VRT_QUADRADIO_SOURCE_32FC_H
+
+#include <vrt_source_32fc.h>
+
+namespace vrt {
+ class quadradio;
+};
+
+class vrt_quadradio_source_32fc;
+typedef boost::shared_ptr<vrt_quadradio_source_32fc> vrt_quadradio_source_32fc_sptr;
+
+vrt_quadradio_source_32fc_sptr
+vrt_make_quadradio_source_32fc(const std::string &ip,
+ size_t rx_bufsize = 0,
+ size_t samples_per_pkt = 0);
+
+class vrt_quadradio_source_32fc : public vrt_source_32fc
+{
+ size_t d_samples_per_pkt;
+ boost::shared_ptr<vrt::quadradio> d_qr;
+
+ vrt_quadradio_source_32fc(const std::string &ip, size_t rx_bufsize,
+ size_t samples_per_pkt);
+
+ friend vrt_quadradio_source_32fc_sptr
+ vrt_make_quadradio_source_32fc(const std::string &ip, size_t rx_bufsize,
+ size_t samples_per_pkt);
+
+public:
+ virtual ~vrt_quadradio_source_32fc();
+ virtual vrt::rx::sptr vrt_rx() const;
+
+ /*!
+ * \brief Called by scheduler when starting flowgraph
+ */
+ virtual bool start();
+
+ /*!
+ * \brief Called by scheduler when stopping flowgraph
+ */
+ virtual bool stop();
+
+ /*!
+ * \brief Set the LO frequency (actually just sets the band select for now).
+ */
+ bool set_center_freq(double target_freq);
+
+ /*!
+ * \brief Set the band select dboard bits.
+ * \param band "A", "B", "C", "D"
+ */
+ bool set_band_select(const std::string &band);
+
+ /*!
+ * \brief Turn the 10 dB attenuation on/off.
+ */
+ //void set_10dB_atten(bool on);
+
+ /*!
+ * \brief Set the antenna type to the main rf or calibrator.
+ * \param ant "rf" or "cal"
+ */
+ bool select_rx_antenna(const std::string &ant);
+
+ /*!
+ * \brief Set the attenuation.
+ * \param attenuation 0 to 31 in dB
+ */
+ bool set_attenuation0(int attenuation);
+ bool set_attenuation1(int attenuation);
+
+ void set_iq_imbal_taps(const std::vector<gr_complex> taps);
+
+ void set_adc_gain(bool on);
+ void set_dc_offset_comp(bool on);
+ void set_digital_gain(float gain);
+ void set_test_signal(int type);
+
+ bool set_setting_reg(int regno, int value);
+
+ /*!
+ * \brief write \p v to daugherboard control setting register
+ */
+ bool set_dboard_pins(int which_dboard, int v);
+ bool set_hsadc_conf(int which_dboard, int regno, int value);
+ bool set_lsdac(int which_dboard, int which_dac, int value);
+ bool set_mem32(int addr, int value);
+ bool set_lo_freq(double freq);
+ bool set_cal_freq(double freq);
+ bool set_beamforming(std::vector<gr_complex> gains);
+};
+
+
+
+#endif /* INCLUDED_VRT_QUADRADIO_SOURCE_32FC_H */
--- /dev/null
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <vrt_sink_16sc.h>
+#include <vrt/metadata.h>
+#include <gr_io_signature.h>
+#include <iostream>
+
+vrt_sink_16sc_sptr
+vrt_make_sink_16sc(const std::string &ifc, const std::string &mac_addr)
+ throw (std::runtime_error)
+{
+ return gnuradio::get_initial_sptr(new vrt_sink_16sc(ifc, mac_addr));
+}
+
+vrt_sink_16sc::vrt_sink_16sc(const std::string &ifc, const std::string &mac_addr)
+ throw (std::runtime_error)
+ : vrt_sink_base("vrt_sink_16sc",
+ gr_make_io_signature(1, 1, sizeof(std::complex<int16_t>)),
+ ifc, mac_addr)
+{
+ // NOP
+}
+
+vrt_sink_16sc::~vrt_sink_16sc()
+{
+ // NOP
+}
+
+int
+vrt_sink_16sc::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ std::complex<int16_t> *in = (std::complex<int16_t> *)input_items[0];
+
+ vrt::tx_metadata metadata;
+ metadata.timestamp = -1;
+ metadata.send_now = 1;
+ metadata.start_of_burst = 1;
+
+ bool ok = d_u2->tx_16sc(0, // FIXME: someday, streams will have channel numbers
+ in, noutput_items, &metadata);
+ if (!ok){
+ std::cerr << "vrt_sink_16sc: tx_16sc failed" << std::endl;
+ return -1; // say we're done
+ }
+
+ return noutput_items;
+}
--- /dev/null
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_USRP2_SINK_16SC_H
+#define INCLUDED_USRP2_SINK_16SC_H
+
+#include <vrt_sink_base.h>
+
+class vrt_sink_16sc;
+typedef boost::shared_ptr<vrt_sink_16sc> vrt_sink_16sc_sptr;
+
+vrt_sink_16sc_sptr
+vrt_make_sink_16sc(const std::string &ifc="eth0",
+ const std::string &mac="")
+ throw (std::runtime_error);
+
+class vrt_sink_16sc : public vrt_sink_base
+{
+private:
+ friend vrt_sink_16sc_sptr
+ vrt_make_sink_16sc(const std::string &ifc,
+ const std::string &mac)
+ throw (std::runtime_error);
+
+protected:
+ vrt_sink_16sc(const std::string &ifc, const std::string &mac)
+ throw (std::runtime_error);
+
+public:
+ ~vrt_sink_16sc();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_USRP2_SINK_16SC_H */
--- /dev/null
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <vrt_sink_32fc.h>
+#include <vrt/metadata.h>
+#include <gr_io_signature.h>
+#include <iostream>
+
+vrt_sink_32fc_sptr
+vrt_make_sink_32fc(const std::string &ifc, const std::string &mac_addr)
+ throw (std::runtime_error)
+{
+ return gnuradio::get_initial_sptr(new vrt_sink_32fc(ifc, mac_addr));
+}
+
+vrt_sink_32fc::vrt_sink_32fc(const std::string &ifc, const std::string &mac_addr)
+ throw (std::runtime_error)
+ : vrt_sink_base("vrt_sink_32fc",
+ gr_make_io_signature(1, 1, sizeof(gr_complex)),
+ ifc, mac_addr)
+{
+ // NOP
+}
+
+vrt_sink_32fc::~vrt_sink_32fc()
+{
+ // NOP
+}
+
+int
+vrt_sink_32fc::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ gr_complex *in = (gr_complex *)input_items[0];
+
+ vrt::tx_metadata metadata;
+ metadata.timestamp = -1;
+ metadata.send_now = 1;
+ metadata.start_of_burst = 1;
+
+ bool ok = d_u2->tx_32fc(0, // FIXME: someday, streams will have channel numbers
+ in, noutput_items, &metadata);
+ if (!ok){
+ std::cerr << "vrt_sink_32fc: tx_32fc failed" << std::endl;
+ return -1; // say we're done
+ }
+
+ return noutput_items;
+}
--- /dev/null
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_USRP2_SINK_32FC_H
+#define INCLUDED_USRP2_SINK_32FC_H
+
+#include <vrt_sink_base.h>
+
+class vrt_sink_32fc;
+typedef boost::shared_ptr<vrt_sink_32fc> vrt_sink_32fc_sptr;
+
+vrt_sink_32fc_sptr
+vrt_make_sink_32fc(const std::string &ifc="eth0",
+ const std::string &mac="")
+ throw (std::runtime_error);
+
+class vrt_sink_32fc : public vrt_sink_base
+{
+private:
+ friend vrt_sink_32fc_sptr
+ vrt_make_sink_32fc(const std::string &ifc,
+ const std::string &mac)
+ throw (std::runtime_error);
+
+protected:
+ vrt_sink_32fc(const std::string &ifc, const std::string &mac)
+ throw (std::runtime_error);
+
+public:
+ ~vrt_sink_32fc();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_USRP2_SINK_32FC_H */
--- /dev/null
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <vrt_sink_base.h>
+#include <gr_io_signature.h>
+#include <iostream>
+
+vrt_sink_base::vrt_sink_base(const char *name,
+ gr_io_signature_sptr input_signature,
+ const std::string &ifc,
+ const std::string &mac)
+ throw (std::runtime_error)
+ : vrt_base(name,
+ input_signature,
+ gr_make_io_signature(0, 0, 0),
+ ifc, mac)
+{
+ // NOP
+}
+
+vrt_sink_base::~vrt_sink_base ()
+{
+ // NOP
+}
+
+bool
+vrt_sink_base::set_gain(double gain)
+{
+ return d_u2->set_tx_gain(gain);
+}
+
+bool
+vrt_sink_base::set_lo_offset(double frequency)
+{
+ return d_u2->set_tx_lo_offset(frequency);
+}
+
+bool
+vrt_sink_base::set_center_freq(double frequency, vrt::tune_result *tr)
+{
+ return d_u2->set_tx_center_freq(frequency, tr);
+}
+
+bool
+vrt_sink_base::set_interp(int interp_factor)
+{
+ return d_u2->set_tx_interp(interp_factor);
+}
+
+void
+vrt_sink_base::default_scale_iq(int interp_factor, int *scale_i, int *scale_q)
+{
+ return d_u2->default_tx_scale_iq(interp_factor, scale_i, scale_q);
+}
+
+bool
+vrt_sink_base::set_scale_iq(int scale_i, int scale_q)
+{
+ return d_u2->set_tx_scale_iq(scale_i, scale_q);
+}
+
+int
+vrt_sink_base::interp()
+{
+ return d_u2->tx_interp();
+}
+
+bool
+vrt_sink_base::dac_rate(long *rate)
+{
+ return d_u2->dac_rate(rate);
+}
+
+double
+vrt_sink_base::gain_min()
+{
+ return d_u2->tx_gain_min();
+}
+
+double
+vrt_sink_base::gain_max()
+{
+ return d_u2->tx_gain_max();
+}
+
+double
+vrt_sink_base::gain_db_per_step()
+{
+ return d_u2->tx_gain_db_per_step();
+}
+
+double
+vrt_sink_base::freq_min()
+{
+ return d_u2->tx_freq_min();
+}
+
+double
+vrt_sink_base::freq_max()
+{
+ return d_u2->tx_freq_max();
+}
+
+bool
+vrt_sink_base::daughterboard_id(int *dbid)
+{
+ return d_u2->tx_daughterboard_id(dbid);
+}
+
+bool vrt_sink_base::set_gpio_ddr(uint16_t value, uint16_t mask)
+{
+ return d_u2->set_gpio_ddr(vrt::GPIO_TX_BANK, value, mask);
+}
+
+bool vrt_sink_base::set_gpio_sels(std::string sels)
+{
+ return d_u2->set_gpio_sels(vrt::GPIO_TX_BANK, sels);
+}
+
+bool vrt_sink_base::write_gpio(uint16_t value, uint16_t mask)
+{
+ return d_u2->write_gpio(vrt::GPIO_TX_BANK, value, mask);
+}
+
+bool vrt_sink_base::read_gpio(uint16_t *value)
+{
+ return d_u2->read_gpio(vrt::GPIO_TX_BANK, value);
+}
--- /dev/null
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_USRP2_SINK_BASE_H
+#define INCLUDED_USRP2_SINK_BASE_H
+
+#include <vrt_base.h>
+
+/*!
+ * Base class for all USRP2 transmit blocks
+ */
+class vrt_sink_base : public vrt_base
+{
+protected:
+ vrt_sink_base(const char *name,
+ gr_io_signature_sptr input_signature,
+ const std::string &ifc,
+ const std::string &mac)
+ throw (std::runtime_error);
+
+public:
+ ~vrt_sink_base();
+
+ /*!
+ * \brief Set transmitter gain
+ */
+ bool set_gain(double gain);
+
+ /*!
+ * \brief Set transmitter LO offset frequency
+ */
+ bool set_lo_offset(double frequency);
+
+ /*!
+ * \brief Set transmitter center frequency
+ */
+ bool set_center_freq(double frequency, vrt::tune_result *tr);
+
+ /*!
+ * \brief Set transmit interpolation rate
+ */
+ bool set_interp(int interp_factor);
+
+ /*!
+ * \brief Calculate default scale_iq for given interpolation factor
+ */
+ void default_scale_iq(int interpolation_factor, int *scale_i, int *scale_q);
+
+ /*!
+ * \brief Set transmit IQ scale factors
+ */
+ bool set_scale_iq(int scale_i, int scale_q);
+
+ /*!
+ * \brief Get transmit interpolation rate
+ */
+ int interp();
+
+ /*!
+ * \brief Get DAC sample rate in Hz
+ */
+ bool dac_rate(long *rate);
+
+ /*!
+ * \brief Returns minimum Tx gain
+ */
+ double gain_min();
+
+ /*!
+ * \brief Returns maximum Tx gain
+ */
+ double gain_max();
+
+ /*!
+ * \brief Returns Tx gain db_per_step
+ */
+ double gain_db_per_step();
+
+ /*!
+ * \brief Returns minimum Tx center frequency
+ */
+ double freq_min();
+
+ /*!
+ * \brief Returns maximum Tx center frequency
+ */
+ double freq_max();
+
+ /*!
+ * \brief Get Tx daughterboard ID
+ *
+ * \param[out] dbid returns the daughterboard id.
+ *
+ * daughterboard id >= 0 if successful, -1 if no daugherboard installed,
+ * -2 if invalid EEPROM on daughterboard.
+ */
+ bool daughterboard_id(int *dbid);
+
+ /*!
+ * \brief Set daughterboard GPIO data direction register.
+ */
+ bool set_gpio_ddr(uint16_t value, uint16_t mask);
+
+ /*!
+ * \brief Set daughterboard GPIO output selection register.
+ */
+ bool set_gpio_sels(std::string sels);
+
+ /*!
+ * \brief Set daughterboard GPIO pin values.
+ */
+ bool write_gpio(uint16_t value, uint16_t mask);
+
+ /*!
+ * \brief Read daughterboard GPIO pin values
+ */
+ bool read_gpio(uint16_t *value);
+};
+
+#endif /* INCLUDED_USRP2_SINK_BASE_H */
--- /dev/null
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <vrt_source_16sc.h>
+#include <rx_16sc_handler.h>
+#include <gr_io_signature.h>
+#include <iostream>
+
+vrt_source_16sc_sptr
+vrt_make_source_16sc(const std::string &ifc, const std::string &mac_addr)
+ throw (std::runtime_error)
+{
+ return gnuradio::get_initial_sptr(new vrt_source_16sc(ifc, mac_addr));
+}
+
+vrt_source_16sc::vrt_source_16sc(const std::string &ifc, const std::string &mac_addr)
+ throw (std::runtime_error)
+ : vrt_source_base("vrt_source_16sc",
+ gr_make_io_signature(1, 1, sizeof(std::complex<int16_t>)),
+ ifc, mac_addr)
+{
+ set_output_multiple(USRP2_MIN_RX_SAMPLES);
+}
+
+vrt_source_16sc::~vrt_source_16sc()
+{
+ // NOP
+}
+
+int
+vrt_source_16sc::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ std::complex<int16_t> *out = (std::complex<int16_t> *)output_items[0];
+
+ rx_16sc_handler::sptr handler = rx_16sc_handler::make(noutput_items, USRP2_MIN_RX_SAMPLES, out);
+
+ bool ok = d_u2->rx_samples(0, handler.get()); // FIXME: channel number instead of 0
+ if (!ok){
+ std::cerr << "vrt::rx_samples() failed" << std::endl;
+ return -1; // say we're done
+ }
+
+ return handler->nsamples();
+}
--- /dev/null
+/* -*- c++ -*- */
+/*
+ * Copyright 2008 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_USRP2_SOURCE_16SC_H
+#define INCLUDED_USRP2_SOURCE_16SC_H
+
+#include <vrt_source_base.h>
+
+class vrt_source_16sc;
+typedef boost::shared_ptr<vrt_source_16sc> vrt_source_16sc_sptr;
+
+vrt_source_16sc_sptr
+vrt_make_source_16sc(const std::string &ifc="eth0",
+ const std::string &mac="")
+ throw (std::runtime_error);
+
+class vrt_source_16sc : public vrt_source_base
+{
+private:
+ friend vrt_source_16sc_sptr
+ vrt_make_source_16sc(const std::string &ifc,
+ const std::string &mac) throw (std::runtime_error);
+
+protected:
+ vrt_source_16sc(const std::string &ifc, const std::string &mac) throw (std::runtime_error);
+
+public:
+ ~vrt_source_16sc();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+};
+
+#endif /* INCLUDED_USRP2_SOURCE_16SC_H */
--- /dev/null
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <vrt_source_32fc.h>
+#include <vrt/expanded_header.h>
+#include <vrt/copiers.h>
+#include <gr_io_signature.h>
+#include <missing_pkt_checker.h>
+#include <iostream>
+
+#define VERBOSE 1 // define to 0 or 1
+
+
+class rx_32fc_handler : public vrt::rx_packet_handler
+{
+ int d_noutput_items;
+ std::complex<float> *d_out;
+ int *d_oo; // output index
+ std::vector< std::complex<float> > &d_remainder;
+ missing_pkt_checker &d_checker;
+
+
+public:
+
+ rx_32fc_handler(int noutput_items, std::complex<float> *out,
+ int *oo, std::vector< std::complex<float> > &remainder,
+ missing_pkt_checker &checker)
+ : d_noutput_items(noutput_items), d_out(out),
+ d_oo(oo), d_remainder(remainder), d_checker(checker) {}
+
+ ~rx_32fc_handler();
+
+ bool operator()(const uint32_t *payload,
+ size_t n32_bit_words,
+ const vrt::expanded_header *hdr);
+};
+
+rx_32fc_handler::~rx_32fc_handler()
+{
+}
+
+bool
+rx_32fc_handler::operator()(const uint32_t *payload,
+ size_t n32_bit_words,
+ const vrt::expanded_header *hdr)
+{
+ int nmissing = d_checker.check(hdr);
+ if (VERBOSE && nmissing != 0){
+ std::cerr << "S" << nmissing;
+ }
+
+ // copy as many as will fit into the output buffer.
+
+ size_t n = std::min(n32_bit_words, (size_t)(d_noutput_items - *d_oo));
+ vrt::copy_net_16sc_to_host_32fc(n, payload, &d_out[*d_oo]);
+ *d_oo += n;
+
+ // if there are any left over, copy them into remainder and tell
+ // our caller we're had enough for now.
+
+ size_t r = n32_bit_words - n;
+ if (r > 0){
+ assert(d_remainder.size() == 0);
+ d_remainder.resize(r);
+ vrt::copy_net_16sc_to_host_32fc(r, &payload[n], &d_remainder[0]);
+ return false; // Stop calling us.
+ }
+
+ return true; // Keep calling us, we've got more room
+}
+
+
+// ------------------------------------------------------------------------
+
+vrt_source_32fc::vrt_source_32fc(const char *name)
+
+ : vrt_source_base(name,
+ gr_make_io_signature(1, 1, sizeof(gr_complex)))
+{
+}
+
+vrt_source_32fc::~vrt_source_32fc()
+{
+ if (VERBOSE){
+ std::cerr << "\nvrt_source_32fc: npackets = " << d_checker.npackets()
+ << " nwrong_pkt_cnt = " << d_checker.nwrong_pkt_cnt()
+ << " nmissing_pkt_est = " << d_checker.nmissing_pkt_est()
+ << std::endl;
+ }
+}
+
+int
+vrt_source_32fc::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ gr_complex *out = (gr_complex *)output_items[0];
+ int oo = 0;
+
+ // Handle any samples left over from the last call.
+ int t = std::min(noutput_items, (int)d_remainder.size());
+ if (t != 0){
+ for (int i = 0; i < t; i++)
+ out[i] = d_remainder[i];
+ d_remainder.erase(d_remainder.begin(), d_remainder.begin()+t);
+ oo = t;
+ }
+ if (noutput_items - oo == 0)
+ return oo;
+
+ // While we've got room, and there are packets, handle them
+ rx_32fc_handler h(noutput_items, out, &oo, d_remainder, d_checker);
+ bool ok = vrt_rx()->rx_packets(&h);
+
+ if (!ok){
+ std::cerr << "vrt_source_32fc: vrt::rx_packets() failed" << std::endl;
+ return -1; // say we're done
+ }
+
+ return oo;
+}
--- /dev/null
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_VRT_SOURCE_32FC_H
+#define INCLUDED_VRT_SOURCE_32FC_H
+
+#include <vrt_source_base.h>
+#include <missing_pkt_checker.h>
+
+class vrt_source_32fc : public vrt_source_base
+{
+protected:
+ vrt_source_32fc(const char *name);
+
+ std::vector< std::complex<float> > d_remainder;
+ missing_pkt_checker d_checker;
+
+public:
+ ~vrt_source_32fc();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ void reset() { d_remainder.clear(); }
+
+};
+
+#endif /* INCLUDED_VRT_SOURCE_32FC_H */
--- /dev/null
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <vrt_source_base.h>
+#include <gr_io_signature.h>
+#include <iostream>
+
+vrt_source_base::vrt_source_base(const char *name,
+ gr_io_signature_sptr output_signature)
+ : gr_sync_block(name,
+ gr_make_io_signature(0, 0, 0),
+ output_signature)
+{
+}
+
+vrt_source_base::~vrt_source_base()
+{
+}
--- /dev/null
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INCLUDED_VRT_SOURCE_BASE_H
+#define INCLUDED_VRT_SOURCE_BASE_H
+
+#include <gr_sync_block.h>
+#include <vrt/rx.h>
+#include <gr_io_signature.h>
+
+/*!
+ * Base class for all VRT source blocks
+ */
+class vrt_source_base : public gr_sync_block
+{
+protected:
+ vrt_source_base(const char *name,
+ gr_io_signature_sptr output_signature);
+
+public:
+ ~vrt_source_base();
+
+ virtual vrt::rx::sptr vrt_rx() const = 0;
+};
+
+#endif /* INCLUDED_VRT_SOURCE_BASE_H */
--- /dev/null
+/*.cache
+/*.la
+/*.lo
+/*.pc
+/.deps
+/.la
+/.libs
+/.lo
+/Makefile
+/Makefile.in
+/aclocal.m4
+/autom4te.cache
+/config.cache
+/config.h
+/config.h.in
+/config.log
+/config.status
+/configure
+/depcomp
+/install-sh
+/libtool
+/ltmain.sh
+/make.log
+/missing
+/missing
+/mkinstalldirs
+/py-compile
+/stamp-h
+/stamp-h.in
+/stamp-h1
--- /dev/null
+/Makefile
+/Makefile.in
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.pyc
+/*.pyo
--- /dev/null
+/Makefile
+/Makefile.in
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.pyc
+/*.pyo
--- /dev/null
+/Makefile
+/Makefile.in
+/*.pyc
--- /dev/null
+/grc.conf
+/Makefile
+/Makefile.in
--- /dev/null
+/Makefile
+/Makefile.in
def __call__(self):
return self._param.get_evaluated()
+def _get_keys(lst): return [elem.get_key() for elem in lst]
+def _get_elem(lst, key): return lst[_get_keys(lst).index(key)]
+
class Block(Element):
def __init__(self, flow_graph, n):
self._category = n.find('category') or ''
self._block_wrapper_path = n.find('block_wrapper_path')
#create the param objects
- self._params = odict()
+ self._params = list()
#add the id param
- self._params['id'] = self.get_parent().get_parent().Param(
+ self.get_params().append(self.get_parent().get_parent().Param(
self,
odict({
'name': 'ID',
'key': 'id',
'type': 'id',
})
- )
- self._params['_enabled'] = self.get_parent().get_parent().Param(
+ ))
+ self.get_params().append(self.get_parent().get_parent().Param(
self,
odict({
'name': 'Enabled',
'value': 'True',
'hide': 'all',
})
- )
+ ))
for param in map(lambda n: self.get_parent().get_parent().Param(self, n), params):
key = param.get_key()
#test against repeated keys
try: assert key not in self.get_param_keys()
except AssertionError: raise Exception, 'Key "%s" already exists in params'%key
#store the param
- self._params[key] = param
+ self.get_params().append(param)
#create the source objects
- self._sources = odict()
+ self._sources = list()
for source in map(lambda n: self.get_parent().get_parent().Source(self, n), sources):
key = source.get_key()
#test against repeated keys
try: assert key not in self.get_source_keys()
except AssertionError: raise Exception, 'Key "%s" already exists in sources'%key
#store the port
- self._sources[key] = source
+ self.get_sources().append(source)
#create the sink objects
- self._sinks = odict()
+ self._sinks = list()
for sink in map(lambda n: self.get_parent().get_parent().Sink(self, n), sinks):
key = sink.get_key()
#test against repeated keys
try: assert key not in self.get_sink_keys()
except AssertionError: raise Exception, 'Key "%s" already exists in sinks'%key
#store the port
- self._sinks[key] = sink
+ self.get_sinks().append(sink)
#begin the testing
self.test()
##############################################
# Access Params
##############################################
- def get_param_keys(self): return self._params.keys()
- def get_param(self, key): return self._params[key]
- def get_params(self): return self._params.values()
+ def get_param_keys(self): return _get_keys(self._params)
+ def get_param(self, key): return _get_elem(self._params, key)
+ def get_params(self): return self._params
##############################################
# Access Sinks
##############################################
- def get_sink_keys(self): return self._sinks.keys()
- def get_sink(self, key): return self._sinks[key]
- def get_sinks(self): return self._sinks.values()
+ def get_sink_keys(self): return _get_keys(self._sinks)
+ def get_sink(self, key): return _get_elem(self._sinks, key)
+ def get_sinks(self): return self._sinks
##############################################
# Access Sources
##############################################
- def get_source_keys(self): return self._sources.keys()
- def get_source(self, key): return self._sources[key]
- def get_sources(self): return self._sources.values()
+ def get_source_keys(self): return _get_keys(self._sources)
+ def get_source(self, key): return _get_elem(self._sources, key)
+ def get_sources(self): return self._sources
def get_connections(self):
return sum([port.get_connections() for port in self.get_ports()], [])
try: assert self.get_value() in self.get_option_keys()
except AssertionError: raise Exception, 'The value "%s" is not in the possible values of "%s".'%(self.get_value(), self.get_option_keys())
else: self._value = value or ''
+ #begin the testing
+ self.test()
def test(self):
"""
--- /dev/null
+/Makefile
+/Makefile.in
blks2_ofdm_mod.xml \
blks2_packet_decoder.xml \
blks2_packet_encoder.xml \
+ blks2_pfb_arb_resampler.xml \
blks2_qamx_demod.xml \
blks2_qamx_mod.xml \
blks2_rational_resampler_xxx.xml \
gr_kludge_copy.xml \
gr_map_bb.xml \
gr_max_xx.xml \
+ gr_message_sink.xml \
+ gr_message_source.xml \
gr_moving_average_xx.xml \
gr_mpsk_receiver_cc.xml \
gr_mpsk_sync_cc.xml \
--- /dev/null
+<?xml version="1.0"?>
+<!--
+###################################################
+##Polyphase Arbitrary Resampler
+###################################################
+ -->
+<block>
+ <name>Polyphase Resampler</name>
+ <key>blks2_pfb_arb_resampler_ccf</key>
+ <import>from gnuradio import blks2</import>
+ <import>from gnuradio.gr import firdes</import>
+ <make>blks2.pfb_arb_resampler_ccf(
+ $rate,
+ $taps,
+ $size,
+)</make>
+ <callback>set_taps($taps)</callback>
+ <param>
+ <name>Resample Rate</name>
+ <key>rate</key>
+ <type>real</type>
+ </param>
+ <param>
+ <name>Taps</name>
+ <key>taps</key>
+ <type>real_vector</type>
+ </param>
+ <param>
+ <name>Size (# phases)</name>
+ <key>size</key>
+ <value>32</value>
+ <type>int</type>
+ </param>
+ <sink>
+ <name>in</name>
+ <type>complex</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>complex</type>
+ </source>
+</block>
<block>gr_udp_source</block>
<block>audio_source</block>
<block>gr_wavfile_source</block>
+ <block>gr_message_source</block>
<block>pad_source</block>
</cat>
<cat>
<block>gr_udp_sink</block>
<block>audio_sink</block>
<block>gr_wavfile_sink</block>
+ <block>gr_message_sink</block>
<block>pad_sink</block>
</cat>
<cat>
<!-- Filter banks -->
<block>blks2_synthesis_filterbank</block>
<block>blks2_analysis_filterbank</block>
+ <!-- Polyphase filers -->
+ <block>blks2_pfb_arb_resampler_ccf</block>
<!-- Other filters -->
<block>gr_single_pole_iir_filter_xx</block>
<block>gr_hilbert_fc</block>
--- /dev/null
+<?xml version="1.0"?>
+<!--
+###################################################
+##Message Sink (the source port is a message)
+###################################################
+ -->
+<block>
+ <name>Message Sink</name>
+ <key>gr_message_sink</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.message_sink($type.size*$vlen, $(id)_msgq, $dont_block)</make>
+ <param>
+ <name>Input Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Don't Block</name>
+ <key>dont_block</key>
+ <value>False</value>
+ <type>enum</type>
+ <option>
+ <name>Don't Block</name>
+ <key>True</key>
+ </option>
+ <option>
+ <name>Block</name>
+ <key>False</key>
+ </option>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen > 0</check>
+ <sink>
+ <name>in</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>msg</type>
+ </source>
+</block>
--- /dev/null
+<?xml version="1.0"?>
+<!--
+###################################################
+##Message Source (the sink port is a message)
+###################################################
+ -->
+<block>
+ <name>Message Source</name>
+ <key>gr_message_source</key>
+ <import>from gnuradio import gr</import>
+ <make>gr.message_source($type.size*$vlen, $(id)_msgq)</make>
+ <param>
+ <name>Output Type</name>
+ <key>type</key>
+ <type>enum</type>
+ <option>
+ <name>Complex</name>
+ <key>complex</key>
+ <opt>size:gr.sizeof_gr_complex</opt>
+ </option>
+ <option>
+ <name>Float</name>
+ <key>float</key>
+ <opt>size:gr.sizeof_float</opt>
+ </option>
+ <option>
+ <name>Int</name>
+ <key>int</key>
+ <opt>size:gr.sizeof_int</opt>
+ </option>
+ <option>
+ <name>Short</name>
+ <key>short</key>
+ <opt>size:gr.sizeof_short</opt>
+ </option>
+ <option>
+ <name>Byte</name>
+ <key>byte</key>
+ <opt>size:gr.sizeof_char</opt>
+ </option>
+ </param>
+ <param>
+ <name>Vec Length</name>
+ <key>vlen</key>
+ <value>1</value>
+ <type>int</type>
+ </param>
+ <check>$vlen > 0</check>
+ <sink>
+ <name>in</name>
+ <type>msg</type>
+ </sink>
+ <source>
+ <name>out</name>
+ <type>$type</type>
+ <vlen>$vlen</vlen>
+ </source>
+</block>
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/grc_setup_freedesktop
+/Makefile
+/Makefile.in
--- /dev/null
+/Makefile
+/Makefile.in
+/Constants.py
--- /dev/null
+/Makefile
+/Makefile.in
Add graphics related params to the block.
"""
#add the position param
- self._params['_coordinate'] = self.get_parent().get_parent().Param(
+ self.get_params().append(self.get_parent().get_parent().Param(
self,
odict({
'name': 'GUI Coordinate',
'value': '(0, 0)',
'hide': 'all',
})
- )
- self._params['_rotation'] = self.get_parent().get_parent().Param(
+ ))
+ self.get_params().append(self.get_parent().get_parent().Param(
self,
odict({
'name': 'GUI Rotation',
'value': '0',
'hide': 'all',
})
- )
+ ))
Element.__init__(self)
def get_coordinate(self):
--- /dev/null
+/Makefile
+/Makefile.in
except AssertionError: self.add_error_message('Check "%s" failed.'%check)
except: self.add_error_message('Check "%s" did not evaluate.'%check)
#adjust nports
- for ports, Port in (
- (self._sources, self.get_parent().get_parent().Source),
- (self._sinks, self.get_parent().get_parent().Sink),
+ for get_ports, get_port in (
+ (self.get_sources, self.get_source),
+ (self.get_sinks, self.get_sink),
):
- #how many ports?
- num_ports = len(ports)
+ #how many streaming (non-message) ports?
+ num_ports = len(filter(lambda p: p.get_type() != 'msg', get_ports()))
#do nothing for 0 ports
if not num_ports: continue
#get the nports setting
- port0 = ports[str(0)]
+ port0 = get_port(str(0))
nports = port0.get_nports()
#do nothing for no nports
if not nports: continue
if nports < num_ports:
#remove the connections
for key in map(str, range(nports, num_ports)):
- port = ports[key]
+ port = get_port(key)
for connection in port.get_connections():
self.get_parent().remove_element(connection)
#remove the ports
- for key in map(str, range(nports, num_ports)): ports.pop(key)
+ for key in map(str, range(nports, num_ports)):
+ get_ports().remove(get_port(key))
continue
#add more ports
if nports > num_ports:
for key in map(str, range(num_ports, nports)):
- n = port0._n
- n['key'] = key
- port = Port(self, n)
- ports[key] = port
+ prev_port = get_port(str(int(key)-1))
+ get_ports().insert(
+ get_ports().index(prev_port)+1,
+ prev_port.copy(new_key=key),
+ )
continue
def port_controller_modify(self, direction):
class Connection(_Connection):
+ def is_msg(self):
+ return self.get_source().get_type() == self.get_sink().get_type() == 'msg'
+
def validate(self):
"""
Validate the connections.
BYTE_VECTOR_COLOR_SPEC = '#CC66CC'
ID_COLOR_SPEC = '#DDDDDD'
WILDCARD_COLOR_SPEC = '#FFFFFF'
+MSG_COLOR_SPEC = '#777777'
#list of regular blocks (all blocks minus the special ones)
blocks = filter(lambda b: b not in (imports + parameters + variables + probes + notebooks), blocks) + probes
#list of connections where each endpoint is enabled
- connections = self._flow_graph.get_enabled_connections()
+ connections = filter(lambda c: not c.is_msg(), self._flow_graph.get_enabled_connections())
+ messages = filter(lambda c: c.is_msg(), self._flow_graph.get_enabled_connections())
#list of variable names
var_ids = [var.get_id() for var in parameters + variables]
#prepend self.
'parameters': parameters,
'blocks': blocks,
'connections': connections,
+ 'messages': messages,
'generate_options': self._generate_options,
'var_id2cbs': var_id2cbs,
}
('Integer Vector', Constants.INT_VECTOR_COLOR_SPEC),
('Short Vector', Constants.SHORT_VECTOR_COLOR_SPEC),
('Byte Vector', Constants.BYTE_VECTOR_COLOR_SPEC),
- ('Wildcard Type', Constants.WILDCARD_COLOR_SPEC),
+ ('Wildcard', Constants.WILDCARD_COLOR_SPEC),
+ ('Message', Constants.MSG_COLOR_SPEC),
)
class Platform(_Platform):
class Port(_Port):
##possible port types
- TYPES = ['complex', 'float', 'int', 'short', 'byte']
+ TYPES = ['complex', 'float', 'int', 'short', 'byte', 'msg']
def __init__(self, block, n):
"""
Make a new port from nested data.
@param block the parent element
@param n the nested odict
- @return a new port
"""
- vlen = n.find('vlen') or '1'
- nports = n.find('nports') or ''
- optional = n.find('optional') or ''
#build the port
_Port.__init__(
self,
block=block,
n=n,
)
- self._nports = nports
- self._vlen = vlen
- self._optional = bool(optional)
+ self._nports = n.find('nports') or ''
+ self._vlen = n.find('vlen') or ''
+ self._optional = bool(n.find('optional'))
def validate(self):
_Port.validate(self)
except AssertionError: self.add_error_message('Port is not connected.')
try: assert self.is_source() or len(self.get_enabled_connections()) <= 1
except AssertionError: self.add_error_message('Port has too many connections.')
+ if self.get_type() == 'msg':
+ try: assert not self.get_nports()
+ except AssertionError: self.add_error_message('A port of type "msg" cannot have "nports" set.')
+ try: assert self.get_vlen() == 1
+ except AssertionError: self.add_error_message('A port of type "msg" must have a "vlen" of 1.')
def get_vlen(self):
"""
'int': Constants.INT_COLOR_SPEC,
'short': Constants.SHORT_COLOR_SPEC,
'byte': Constants.BYTE_COLOR_SPEC,
+ 'msg': Constants.MSG_COLOR_SPEC,
}[self.get_type()]
return {#vlen is non 1
'complex': Constants.COMPLEX_VECTOR_COLOR_SPEC,
}[self.get_type()]
except: return _Port.get_color(self)
+ def copy(self, new_key=None):
+ n = self._n.copy()
+ if new_key: n['key'] = new_key
+ return self.__class__(self.get_parent(), n)
+
class Source(Port):
def __init__(self, block, n):
self._n = n #save n
- #key is port index
- n['key'] = str(block._source_count)
- block._source_count = block._source_count + 1
+ if n['type'] == 'msg': n['key'] = 'msg'
+ if not n.find('key'):
+ n['key'] = str(block._source_count)
+ block._source_count = block._source_count + 1
Port.__init__(self, block, n)
- def __del__(self):
- self.get_parent()._source_count = self.get_parent()._source_count - 1
-
class Sink(Port):
def __init__(self, block, n):
self._n = n #save n
- #key is port index
- n['key'] = str(block._sink_count)
- block._sink_count = block._sink_count + 1
+ if n['type'] == 'msg': n['key'] = 'msg'
+ if not n.find('key'):
+ n['key'] = str(block._sink_count)
+ block._sink_count = block._sink_count + 1
Port.__init__(self, block, n)
-
- def __del__(self):
- self.get_parent()._sink_count = self.get_parent()._sink_count - 1
##@param parameters the paramater blocks
##@param blocks the signal blocks
##@param connections the connections
+##@param messages the msg type connections
##@param generate_options the type of flow graph
##@param var_id2cbs variable id map to callback strings
########################################################
$indent($ctrl.get_make())
#end for
########################################################
+##Create Message Queues
+########################################################
+#if $messages
+
+ $DIVIDER
+ # Message Queues
+ $DIVIDER
+#end if
+#for $msg in $messages
+ $(msg.get_source().get_parent().get_id())_msgq = $(msg.get_sink().get_parent().get_id())_msgq = gr.msg_queue(2)
+#end for
+########################################################
##Create Blocks
########################################################
#if $blocks
--- /dev/null
+/Makefile
+/Makefile.in
* callbacks for set average on fft, waterfall, number sinks
* add units to params: Sps, Hz, dB...
* command line options should replace _ with - for the --option
+ * add bool type to command line option store_true or store_false
##################################################
# Features
--- /dev/null
+/Makefile
+/Makefile.in
+/gruel.pc
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/Makefile
+/Makefile.in
+/inet.h
+/pmt_serial_tags.h
pmt_pool.h \
pmt_serial_tags.h \
realtime.h \
+ send.h \
sys_pri.h \
thread_body_wrapper.h \
thread_group.h \
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef INCLUDED_MSG_ACCEPTER_H
-#define INCLUDED_MSG_ACCEPTER_H
+#ifndef INCLUDED_GRUEL_MSG_ACCEPTER_H
+#define INCLUDED_GRUEL_MSG_ACCEPTER_H
#include <gruel/pmt.h>
msg_accepter() {};
virtual ~msg_accepter();
+ /*!
+ * \brief send \p msg to \p msg_accepter
+ *
+ * Sending a message is an asynchronous operation. The \p post
+ * call will not wait for the message either to arrive at the
+ * destination or to be received.
+ */
virtual void post(pmt::pmt_t msg) = 0;
};
} /* namespace gruel */
-#endif /* INCLUDED_MSG_ACCEPTER_H */
+#endif /* INCLUDED_GRUEL_MSG_ACCEPTER_H */
*/
class msg_accepter_msgq : public msg_accepter
{
+ protected:
msg_queue_sptr d_msg_queue;
public:
msg_accepter_msgq(msg_queue_sptr msgq);
~msg_accepter_msgq();
- void post(pmt::pmt_t msg);
+ virtual void post(pmt::pmt_t msg);
msg_queue_sptr msg_queue() const { return d_msg_queue; }
};
#ifndef INCLUDED_PMT_H
#define INCLUDED_PMT_H
-#include <boost/shared_ptr.hpp>
+#include <boost/intrusive_ptr.hpp>
#include <boost/any.hpp>
#include <complex>
#include <string>
* \brief typedef for shared pointer (transparent reference counting).
* See http://www.boost.org/libs/smart_ptr/smart_ptr.htm
*/
-typedef boost::shared_ptr<pmt_base> pmt_t;
+typedef boost::intrusive_ptr<pmt_base> pmt_t;
+extern void intrusive_ptr_add_ref(pmt_base*);
+extern void intrusive_ptr_release(pmt_base*);
class pmt_exception : public std::logic_error
{
pmt_t pmt_caddr(pmt_t pair);
pmt_t pmt_cadddr(pmt_t pair);
+/*
+ * ------------------------------------------------------------------------
+ * Tuples
+ *
+ * Store a fixed number of objects. Tuples are not modifiable, and thus
+ * are excellent for use as messages. Indexing is zero based.
+ * Access time to an element is O(1).
+ * ------------------------------------------------------------------------
+ */
+
+//! Return true if \p x is a tuple, othewise false.
+bool pmt_is_tuple(pmt_t x);
+
+pmt_t pmt_make_tuple();
+pmt_t pmt_make_tuple(const pmt_t &e0);
+pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1);
+pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2);
+pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3);
+pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4);
+pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5);
+pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6);
+pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6, const pmt_t &e7);
+pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6, const pmt_t &e7, const pmt_t &e8);
+pmt_t pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6, const pmt_t &e7, const pmt_t &e8, const pmt_t &e9);
+
+/*!
+ * If \p x is a vector or proper list, return a tuple containing the elements of x
+ */
+pmt_t pmt_to_tuple(const pmt_t &x);
+
+/*!
+ * Return the contents of position \p k of \p tuple.
+ * \p k must be a valid index of \p tuple.
+ */
+pmt_t pmt_tuple_ref(const pmt_t &tuple, size_t k);
+
/*
* ------------------------------------------------------------------------
* Vectors
--- /dev/null
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef INCLUDED_GRUEL_SEND_H
+#define INCLUDED_GRUEL_SEND_H
+
+#include <gruel/msg_accepter.h>
+
+namespace gruel {
+
+
+ /*!
+ * \brief send \p msg to \p msg_accepter
+ *
+ * Sending a message is an asynchronous operation. The \p send
+ * call will not wait for the message either to arrive at the
+ * destination or to be received.
+ *
+ * \returns msg
+ */
+ static inline pmt::pmt_t
+ send(msg_accepter &acc, pmt::pmt_t msg)
+ {
+ return acc.post(msg);
+ }
+
+
+
+} /* namespace gruel */
+
+
+#endif /* INCLUDED_SEND_H */
--- /dev/null
+/Makefile
+/Makefile.in
+/.libs
+/.deps
--- /dev/null
+/Makefile
+/Makefile.in
+/.deps
+/.libs
--- /dev/null
+/Makefile
+/Makefile.in
+/.libs
+/.deps
+/test_pmt
+/qa_pmt_unv.cc
+/qa_pmt_unv.h
+/pmt_unv_int.h
+/pmt_unv.cc
+/stamp-sources-generate
#endif
+void intrusive_ptr_add_ref(pmt_base* p) { ++(p->count_); }
+void intrusive_ptr_release(pmt_base* p) { if (--(p->count_) == 0 ) delete p; }
pmt_base::~pmt_base()
{
return dynamic_cast<pmt_vector*>(x.get());
}
+static pmt_tuple *
+_tuple(pmt_t x)
+{
+ return dynamic_cast<pmt_tuple*>(x.get());
+}
+
static pmt_uniform_vector *
_uniform_vector(pmt_t x)
{
_vector(vector)->fill(obj);
}
+////////////////////////////////////////////////////////////////////////////
+// Tuples
+////////////////////////////////////////////////////////////////////////////
+
+pmt_tuple::pmt_tuple(size_t len)
+ : d_v(len)
+{
+}
+
+pmt_t
+pmt_tuple::ref(size_t k) const
+{
+ if (k >= length())
+ throw pmt_out_of_range("pmt_tuple_ref", pmt_from_long(k));
+ return d_v[k];
+}
+
+bool
+pmt_is_tuple(pmt_t obj)
+{
+ return obj->is_tuple();
+}
+
+pmt_t
+pmt_tuple_ref(const pmt_t &tuple, size_t k)
+{
+ if (!tuple->is_tuple())
+ throw pmt_wrong_type("pmt_tuple_ref", tuple);
+ return _tuple(tuple)->ref(k);
+}
+
+// for (i=0; i < 10; i++)
+// make_constructor()
+
+pmt_t
+pmt_make_tuple()
+{
+ return pmt_t(new pmt_tuple(0));
+}
+
+pmt_t
+pmt_make_tuple(const pmt_t &e0)
+{
+ pmt_tuple *t = new pmt_tuple(1);
+ t->_set(0, e0);
+ return pmt_t(t);
+}
+
+pmt_t
+pmt_make_tuple(const pmt_t &e0, const pmt_t &e1)
+{
+ pmt_tuple *t = new pmt_tuple(2);
+ t->_set(0, e0);
+ t->_set(1, e1);
+ return pmt_t(t);
+}
+
+pmt_t
+pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2)
+{
+ pmt_tuple *t = new pmt_tuple(3);
+ t->_set(0, e0);
+ t->_set(1, e1);
+ t->_set(2, e2);
+ return pmt_t(t);
+}
+
+pmt_t
+pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3)
+{
+ pmt_tuple *t = new pmt_tuple(4);
+ t->_set(0, e0);
+ t->_set(1, e1);
+ t->_set(2, e2);
+ t->_set(3, e3);
+ return pmt_t(t);
+}
+
+pmt_t
+pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4)
+{
+ pmt_tuple *t = new pmt_tuple(5);
+ t->_set(0, e0);
+ t->_set(1, e1);
+ t->_set(2, e2);
+ t->_set(3, e3);
+ t->_set(4, e4);
+ return pmt_t(t);
+}
+
+pmt_t
+pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5)
+{
+ pmt_tuple *t = new pmt_tuple(6);
+ t->_set(0, e0);
+ t->_set(1, e1);
+ t->_set(2, e2);
+ t->_set(3, e3);
+ t->_set(4, e4);
+ t->_set(5, e5);
+ return pmt_t(t);
+}
+
+pmt_t
+pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6)
+{
+ pmt_tuple *t = new pmt_tuple(7);
+ t->_set(0, e0);
+ t->_set(1, e1);
+ t->_set(2, e2);
+ t->_set(3, e3);
+ t->_set(4, e4);
+ t->_set(5, e5);
+ t->_set(6, e6);
+ return pmt_t(t);
+}
+
+pmt_t
+pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6, const pmt_t &e7)
+{
+ pmt_tuple *t = new pmt_tuple(8);
+ t->_set(0, e0);
+ t->_set(1, e1);
+ t->_set(2, e2);
+ t->_set(3, e3);
+ t->_set(4, e4);
+ t->_set(5, e5);
+ t->_set(6, e6);
+ t->_set(7, e7);
+ return pmt_t(t);
+}
+
+pmt_t
+pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6, const pmt_t &e7, const pmt_t &e8)
+{
+ pmt_tuple *t = new pmt_tuple(9);
+ t->_set(0, e0);
+ t->_set(1, e1);
+ t->_set(2, e2);
+ t->_set(3, e3);
+ t->_set(4, e4);
+ t->_set(5, e5);
+ t->_set(6, e6);
+ t->_set(7, e7);
+ t->_set(8, e8);
+ return pmt_t(t);
+}
+
+pmt_t
+pmt_make_tuple(const pmt_t &e0, const pmt_t &e1, const pmt_t &e2, const pmt_t &e3, const pmt_t &e4, const pmt_t &e5, const pmt_t &e6, const pmt_t &e7, const pmt_t &e8, const pmt_t &e9)
+{
+ pmt_tuple *t = new pmt_tuple(10);
+ t->_set(0, e0);
+ t->_set(1, e1);
+ t->_set(2, e2);
+ t->_set(3, e3);
+ t->_set(4, e4);
+ t->_set(5, e5);
+ t->_set(6, e6);
+ t->_set(7, e7);
+ t->_set(8, e8);
+ t->_set(9, e9);
+ return pmt_t(t);
+}
+
+pmt_t
+pmt_to_tuple(const pmt_t &x)
+{
+ if (x->is_tuple()) // already one
+ return x;
+
+ size_t len = pmt_length(x);
+ pmt_tuple *t = new pmt_tuple(len);
+ pmt_t r = pmt_t(t);
+
+ if (x->is_vector()){
+ for (size_t i = 0; i < len; i++)
+ t->_set(i, _vector(x)->ref(i));
+ return r;
+ }
+
+ if (x->is_pair()){
+ pmt_t y = x;
+ for (size_t i = 0; i < len; i++){
+ t->_set(i, pmt_car(y));
+ y = pmt_cdr(y);
+ }
+ return r;
+ }
+
+ throw pmt_wrong_type("pmt_to_tuple", x);
+}
+
+
+
////////////////////////////////////////////////////////////////////////////
// Uniform Numeric Vectors
////////////////////////////////////////////////////////////////////////////
return true;
}
+ if (x->is_tuple() && y->is_tuple()){
+ pmt_tuple *xv = _tuple(x);
+ pmt_tuple *yv = _tuple(y);
+ if (xv->length() != yv->length())
+ return false;
+
+ for (unsigned i = 0; i < xv->length(); i++)
+ if (!pmt_equal(xv->_ref(i), yv->_ref(i)))
+ return false;
+
+ return true;
+ }
+
if (x->is_uniform_vector() && y->is_uniform_vector()){
pmt_uniform_vector *xv = _uniform_vector(x);
pmt_uniform_vector *yv = _uniform_vector(y);
if (x->is_uniform_vector())
return _uniform_vector(x)->length();
- if (x->is_null()) return 0;
+ if (x->is_tuple())
+ return _tuple(x)->length();
+
+ if (x->is_null())
+ return 0;
if (x->is_pair()) {
size_t length=1;
- pmt_t it = pmt_cdr(x);
+ pmt_t it = pmt_cdr(x);
while (pmt_is_pair(it)){
length++;
it = pmt_cdr(it);
#include <gruel/pmt.h>
#include <boost/utility.hpp>
+#include <boost/detail/atomic_count.hpp>
/*
* EVERYTHING IN THIS FILE IS PRIVATE TO THE IMPLEMENTATION!
namespace pmt {
class pmt_base : boost::noncopyable {
+ mutable boost::detail::atomic_count count_;
+
protected:
- pmt_base(){};
+ pmt_base() : count_(0) {};
virtual ~pmt_base();
public:
virtual bool is_complex() const { return false; }
virtual bool is_null() const { return false; }
virtual bool is_pair() const { return false; }
+ virtual bool is_tuple() const { return false; }
virtual bool is_vector() const { return false; }
virtual bool is_dict() const { return false; }
virtual bool is_any() const { return false; }
virtual bool is_c32vector() const { return false; }
virtual bool is_c64vector() const { return false; }
+ friend void intrusive_ptr_add_ref(pmt_base* p);
+ friend void intrusive_ptr_release(pmt_base* p);
+
# if (PMT_LOCAL_ALLOCATOR)
void *operator new(size_t);
void operator delete(void *, size_t);
pmt_t _ref(size_t k) const { return d_v[k]; }
};
+class pmt_tuple : public pmt_base
+{
+ std::vector<pmt_t> d_v;
+
+public:
+ pmt_tuple(size_t len);
+ //~pmt_tuple();
+
+ bool is_tuple() const { return true; }
+ pmt_t ref(size_t k) const;
+ size_t length() const { return d_v.size(); }
+
+ pmt_t _ref(size_t k) const { return d_v[k]; }
+ void _set(size_t k, pmt_t v) { d_v[k] = v; }
+};
+
class pmt_dict : public pmt_base
{
pmt_t d_alist; // list of (key . value) pairs
port << "(";
pmt_write_list_tail(obj, port);
}
+ else if (pmt_is_tuple(obj)){
+ port << "{";
+ size_t len = pmt_length(obj);
+ if (len > 0){
+ port << pmt_tuple_ref(obj, 0);
+ for (size_t i = 1; i < len; i++)
+ port << " " << pmt_tuple_ref(obj, i);
+ }
+ port << "}";
+ }
+ else if (pmt_is_vector(obj)){
+ port << "#(";
+ size_t len = pmt_length(obj);
+ if (len > 0){
+ port << pmt_vector_ref(obj, 0);
+ for (size_t i = 1; i < len; i++)
+ port << " " << pmt_vector_ref(obj, i);
+ }
+ port << ")";
+ }
else if (pmt_is_dict(obj)){
// FIXME
// port << "#<dict " << obj << ">";
port << "#<dict>";
}
- else if (pmt_is_vector(obj)){
- // FIXME
- // port << "#<vector " << obj << ">";
- port << "#<vector>";
- }
else if (pmt_is_uniform_vector(obj)){
// FIXME
// port << "#<uniform-vector " << obj << ">";
CPPUNIT_ASSERT_EQUAL(s0, pmt_vector_ref(v1, i));
}
+static void
+check_tuple(size_t len, const std::vector<pmt_t> &s, pmt_t t)
+{
+ CPPUNIT_ASSERT_EQUAL(true, pmt_is_tuple(t));
+ CPPUNIT_ASSERT_EQUAL(len, pmt_length(t));
+
+ for (size_t i = 0; i < len; i++)
+ CPPUNIT_ASSERT_EQUAL(s[i], pmt_tuple_ref(t, i));
+
+}
+
+void
+qa_pmt_prims::test_tuples()
+{
+ pmt_t v = pmt_make_vector(10, PMT_NIL);
+ std::vector<pmt_t> s(10);
+ for (size_t i = 0; i < 10; i++){
+ std::ostringstream os;
+ os << "s" << i;
+ s[i] = pmt_string_to_symbol(os.str());
+ pmt_vector_set(v, i, s[i]);
+ }
+
+
+ pmt_t t;
+
+ t = pmt_make_tuple();
+ check_tuple(0, s, t);
+
+ t = pmt_make_tuple(s[0]);
+ check_tuple(1, s, t);
+
+ CPPUNIT_ASSERT(pmt_is_vector(v));
+ CPPUNIT_ASSERT(!pmt_is_tuple(v));
+ CPPUNIT_ASSERT(pmt_is_tuple(t));
+ CPPUNIT_ASSERT(!pmt_is_vector(t));
+
+ t = pmt_make_tuple(s[0], s[1]);
+ check_tuple(2, s, t);
+
+ t = pmt_make_tuple(s[0], s[1], s[2]);
+ check_tuple(3, s, t);
+
+ t = pmt_make_tuple(s[0], s[1], s[2], s[3]);
+ check_tuple(4, s, t);
+
+ t = pmt_make_tuple(s[0], s[1], s[2], s[3], s[4]);
+ check_tuple(5, s, t);
+
+ t = pmt_make_tuple(s[0], s[1], s[2], s[3], s[4], s[5]);
+ check_tuple(6, s, t);
+
+ t = pmt_make_tuple(s[0], s[1], s[2], s[3], s[4], s[5], s[6]);
+ check_tuple(7, s, t);
+
+ t = pmt_make_tuple(s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7]);
+ check_tuple(8, s, t);
+
+ t = pmt_make_tuple(s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7], s[8]);
+ check_tuple(9, s, t);
+
+ t = pmt_make_tuple(s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7], s[8], s[9]);
+ check_tuple(10, s, t);
+
+ t = pmt_make_tuple(s[0], s[1], s[2]);
+ CPPUNIT_ASSERT_THROW(pmt_tuple_ref(t, 3), pmt_out_of_range);
+ CPPUNIT_ASSERT_THROW(pmt_vector_ref(t, 0), pmt_wrong_type);
+ CPPUNIT_ASSERT_THROW(pmt_tuple_ref(v, 0), pmt_wrong_type);
+
+ t = pmt_make_tuple(s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7], s[8], s[9]);
+ pmt_t t2 = pmt_to_tuple(v);
+ CPPUNIT_ASSERT_EQUAL(size_t(10), pmt_length(v));
+ CPPUNIT_ASSERT(pmt_equal(t, t2));
+ //std::cout << v << std::endl;
+ //std::cout << t2 << std::endl;
+
+
+ t = pmt_make_tuple(s[0], s[1], s[2]);
+ pmt_t list0 = pmt_list3(s[0], s[1], s[2]);
+ CPPUNIT_ASSERT_EQUAL(size_t(3), pmt_length(list0));
+ t2 = pmt_to_tuple(list0);
+ CPPUNIT_ASSERT_EQUAL(size_t(3), pmt_length(t2));
+ CPPUNIT_ASSERT(pmt_equal(t, t2));
+}
+
void
qa_pmt_prims::test_equivalence()
{
CPPUNIT_ASSERT(!pmt_subsetp(l2,l1));
CPPUNIT_ASSERT(!pmt_subsetp(l3,l2));
}
+
CPPUNIT_TEST(test_complexes);
CPPUNIT_TEST(test_pairs);
CPPUNIT_TEST(test_vectors);
+ CPPUNIT_TEST(test_tuples);
CPPUNIT_TEST(test_equivalence);
CPPUNIT_TEST(test_misc);
CPPUNIT_TEST(test_dict);
void test_complexes();
void test_pairs();
void test_vectors();
+ void test_tuples();
void test_equivalence();
void test_misc();
void test_dict();
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
--- /dev/null
+/Makefile
+/Makefile.in
+/mblock.pc
--- /dev/null
+/Makefile
+/Makefile.in
+/.deps
+/.libs
+/*.la
+/*.lo
+/autom4te.cache
+/*.cache
+/howto-write-a-block.html
+/gr_block.h.xml
+/howto_1.i.xml
+/howto_square_ff.cc.xml
+/howto_square_ff.h.xml
+/qa_howto_1.py.xml
+/src_lib_Makefile_1.am.xml
+/src_lib_Makefile_2.am.xml
+/howto_square2_ff.cc.xml
+/howto_square2_ff.h.xml
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/howto.cc
+/howto.py
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/test_mblock
+/qa_bitset_mbh.cc
+/benchmark_send
+/getres
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/gnuradio-omnithread.pc
solaris.cc \
threaddata.cc \
vxWorks.cc \
- dir.mk
+ dir.mk \
+ README
--- /dev/null
+The code in this directory is deprecated, please use the Boost thread
+library for new code.
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/*.cache
+/*.la
+/*.lo
+/*.pc
+/.deps
+/.la
+/.libs
+/.lo
+/Makefile
+/Makefile.in
+/aclocal.m4
+/autom4te.cache
+/config.cache
+/config.h
+/config.h.in
+/config.log
+/config.status
+/configure
+/depcomp
+/install-sh
+/ltmain.sh
+/libtool
+/ltmain.sh
+/make.log
+/missing
+/missing
+/stamp-h
+/py-compile
+/stamp-h.in
+/stamp-h1
+/usrp.iss
--- /dev/null
+/Makefile
+/Makefile.in
+/html
+/latex
+/man
+/Doxyfile
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/xml
+/usrp_guide.html
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/Makefile
+/Makefile.in
+/aclocal.m4
+/configure
+/config.h.in
+/stamp-h.in
+/libtool
+/config.log
+/config.h
+/config.cache
+/config.status
+/missing
+/stamp-h
+/stamp-h1
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/autom4te.cache
+/*.cache
+/missing
+/make.log
+/usrp.pc
--- /dev/null
+/Makefile
+/Makefile.in
+/aclocal.m4
+/configure
+/config.h.in
+/stamp-h.in
+/libtool
+/config.log
+/config.h
+/config.cache
+/config.status
+/missing
+/stamp-h
+/stamp-h1
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/autom4te.cache
+/*.cache
+/missing
+/make.log
+/usrp.pc
--- /dev/null
+/*.ihx
+/*.lnk
+/*.lst
+/*.map
+/*.mem
+/*.rel
+/*.rst
+/*.sym
+/blink_leds.asm
+/usrp_common.asm
+/command_loop.asm
+/fpga.asm
+/*.asm
+/usrp_gpif.c
+/usrp_gpif_inline.h
+/*.lib
+/Makefile
+/Makefile.in
--- /dev/null
+/*.ihx
+/*.lnk
+/*.lst
+/*.map
+/*.mem
+/*.rel
+/*.rst
+/*.sym
+/blink_leds.asm
+/usrp_common.asm
+/command_loop.asm
+/fpga.asm
+/*.asm
+/usrp_gpif.c
+/usrp_gpif_inline.h
+/Makefile
+/Makefile.in
--- /dev/null
+/*.ihx
+/*.lnk
+/*.lst
+/*.map
+/*.mem
+/*.rel
+/*.rst
+/*.sym
+/blink_leds.asm
+/usrp_common.asm
+/command_loop.asm
+/fpga.asm
+/*.asm
+/usrp_gpif.c
+/usrp_gpif_inline.h
+/Makefile
+/Makefile.in
--- /dev/null
+/*.ihx
+/*.lnk
+/*.lst
+/*.map
+/*.mem
+/*.rel
+/*.rst
+/*.sym
+/blink_leds.asm
+/usrp_common.asm
+/command_loop.asm
+/fpga.asm
+/*.asm
+/Makefile
+/Makefile.in
+/usrp_gpif.c
+/usrp_gpif_inline.h
+/Makefile.in
+/burn-usrp2-eeprom
+/burn-usrp4-eeprom
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/Makefile
+/Makefile.in
+/usrp_fpga_rev1.rbf
+/usrp_fpga_rev2.rbf
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/db
+/*.vcd
--- /dev/null
+/*.vcd
+/*.out
+/fullchip_tb
--- /dev/null
+/*.qws
+/*.eqn
+/*.done
+/*.htm
+/*.rpt
+/*.ini
+/*.fsf
+/*.jam
+/*.jbc
+/*.pin
+/*.pof
+/*.sof
+/*.rbf
+/*.ttf
+/*.summary
+/a.out
+/db
--- /dev/null
+/*.qws
+/*.eqn
+/*.done
+/*.htm
+/*.rpt
+/*.ini
+/*.fsf
+/*.jam
+/*.jbc
+/*.pin
+/*.pof
+/*.sof
+/*.rbf
+/*.ttf
+/db
--- /dev/null
+/*.qws
+/*.eqn
+/*.done
+/*.htm
+/*.rpt
+/*.ini
+/*.fsf
+/*.jam
+/*.jbc
+/*.pin
+/*.pof
+/*.sof
+/*.rbf
+/*.ttf
+/*.summary
+/db
--- /dev/null
+/*.qws
+/*.eqn
+/*.done
+/*.htm
+/*.rpt
+/*.ini
+/*.fsf
+/*.jam
+/*.jbc
+/*.pin
+/*.pof
+/*.sof
+/*.rbf
+/*.ttf
+/*.summary
+/db
--- /dev/null
+/*.qws
+/*.eqn
+/*.done
+/*.htm
+/*.rpt
+/*.ini
+/*.fsf
+/*.jam
+/*.jbc
+/*.pin
+/*.pof
+/*.sof
+/*.rbf
+/*.ttf
+/*.summary
+/prev*
+/db
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.dat
+/usrper
+/usrper2
+/test_input
+/test_fusb
+/test_usrp
+/test_usrp0
+/test_usrp_standard_rx
+/test_usrp_standard_tx
+/test_usrp_inband_timestamps
+/test_usrp_inband_registers
+/test_usrp_inband_rx
+/test_usrp_inband_tx
+/test_usrp_basic_rx
+/check_order_quickly
+/usrp_cal_dc_offset
+/test_usrp_inband_cs
+/read_packets
+/test_usrp_inband_ping
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/Makefile
+/Makefile.in
+/usrp_dbid.h
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/test_fusb
+/std_paths.h
+/usrp_dbid.py
+/usrp_dbid.h
+/usrp_dbid.cc
+/stamp-*
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/gnuradio_swig_python.cc
+/gnuradio_swig_python.py
+/usrp_prims.cc
+/usrp_prims.py
+/prims.cc
+/prims.py
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.dat
+/.*.swp
+/usrper
+/usrper2
+/test_input
+/test_fusb
+/test_usrp
+/test_usrp0
+/test_usrp_standard_rx
+/test_usrp_standard_tx
+/test_usrp_standard_2tx
+/test_usrp_inband_timestamps
+/test_usrp_inband_registers
+/test_usrp_inband_rx
+/test_usrp_inband_2rx
+/test_usrp_inband_tx
+/test_usrp_inband_2tx
+/test_usrp_basic_rx
+/check_order_quickly
+/usrp_cal_dc_offset
+/test_usrp_inband_cs
+/read_packets
+/test_usrp_inband_ping
+/test_usrp_inband_underrun
+/test_usrp_inband_overrun
+/gmac_mbh.cc
+/test_gmac_tx
--- /dev/null
+/Makefile
+/Makefile.in
+/.la
+/.lo
+/.deps
+/.libs
+/*.la
+/*.lo
+/*.swp
+/*.dat
+/test_fusb
+/std_paths.h
+/usrp_dbid.py
+/usrp_dbid.h
+/usrp_dbid.cc
+/usrp_server_mbh.cc
+/test_inband
+/test_usrp_inband
+/test_usrp_tx
+/*_mbh.cc
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/*-stamp
+/*.a
+/*.bin
+/*.dump
+/*.log
+/*.rom
+/.deps
+/Makefile
+/Makefile.in
+/aclocal.m4
+/autom4te.cache
+/blink_leds
+/blink_leds2
+/build
+/compile
+/config.h
+/config.h.in
+/config.log
+/config.status
+/configure
+/depcomp
+/eth_test
+/gen_eth_packets
+/ibs_rx_test
+/ibs_tx_test
+/install-sh
+/libtool
+/ltmain.sh
+/missing
+/py-compile
+/rcv_eth_packets
+/run_tests.sh
+/stamp-h1
+/test1
+/test_phy_comm
+/timer_test
+/buf_ram_test
+/buf_ram_zero
+/hello
+/configure.lineno
--- /dev/null
+/*-stamp
+/*.a
+/*.bin
+/*.dump
+/*.log
+/*.rom
+/*.map
+/.deps
+/Makefile
+/Makefile.in
+/aclocal.m4
+/autom4te.cache
+/blink_leds
+/blink_leds2
+/build
+/compile
+/config.h
+/config.h.in
+/config.log
+/config.status
+/configure
+/depcomp
+/echo
+/eth_test
+/gen_eth_packets
+/ibs_rx_test
+/ibs_tx_test
+/install-sh
+/libtool
+/ltmain.sh
+/missing
+/py-compile
+/rcv_eth_packets
+/run_tests.sh
+/stamp-h1
+/test1
+/test_phy_comm
+/timer_test
+/buf_ram_test
+/buf_ram_zero
+/hello
+/test_printf
+/test_spi
+/test_i2c
+/gen_pause_frames
+/test_serdes
+/rx_only
+/tx_only
+/tx_standalone
+/tx_drop
+/tx_drop2
+/tx_drop_rate_limited
+/test_lsdac
+/test_lsadc
+/read_dbids
+/test_db_spi
+/ramp_lsdac
+/eth_to_serdes
+/serdes_to_dsp
+/sd_gentest
+/sd_bounce
+/can_i_sub
+/tx_only_v2
+/rx_only_v2
+/txrx
+/eth_serdes
+/serdes_txrx
+/set_hw_rev
+/test_sd
+/factory_test
+/test_ram
+/mimo_tx
+/mimo_tx_slave
+/burn_dbsrx_eeprom
+/burnrev30
+/burnrev31
+/burnrev40
--- /dev/null
+/configure
+/Makefile.in
+/config.log
+/config.h
+/ltmain.sh
+/Makefile
+/config.status
+/stamp-h1
+/config.h.in
+/autom4te.cache
+/libtool
+/missing
+/aclocal.m4
+/install-sh
+/depcomp
+/py-compile
+/compile
+/build
+/run_tests.sh
+/*-stamp
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/*-stamp
+/*.a
+/*.bin
+/*.dump
+/*.log
+/*.rom
+/.deps
+/Makefile
+/Makefile.in
+/aclocal.m4
+/autom4te.cache
+/blink_leds
+/blink_leds2
+/build
+/compile
+/config.h
+/config.h.in
+/config.log
+/config.status
+/configure
+/depcomp
+/eth_test
+/gen_eth_packets
+/ibs_rx_test
+/ibs_tx_test
+/install-sh
+/libtool
+/ltmain.sh
+/missing
+/py-compile
+/rcv_eth_packets
+/run_tests.sh
+/stamp-h1
+/test1
+/test_phy_comm
+/timer_test
+/buf_ram_test
+/buf_ram_zero
+/hello
--- /dev/null
+/*_xdb
+/*.restore
+/*.xrpt
+/*.zip
+/xst
+/_ngo
+/_xmsgs
+/*.log
+/*.stx
+/*.tspec
+/*.xml
+/*.gyd
+/*.ngr
+/*.tim
+/*.err
+/*.lso
+/*.bld
+/*.cmd_log
+/*.ise_ISE_Backup
+/*.ipf_ISE_Backup
+/*.mfd
+/*.vm6
+/*.syr
+/*.xst
+/*.csv
+/*.html
+/*.jed
+/*.pad
+/*.ng*
+/*.pnx
+/*.rpt
+/*.prj
+/*_html
+/*.cel
+/_pace.ucf
+/*.lock
+/*.tfi
+/templates
--- /dev/null
+/a.out
+/*.vcd
+/*.lxt
+/*.sav
+/*.log
--- /dev/null
+/xlnx_auto*
+/*log
+/tmp
--- /dev/null
+/a.out
+/*.vcd
+/*.sav
+/*.lxt
--- /dev/null
+/dump.vcd
+/a.out
--- /dev/null
+/Entries.Log
--- /dev/null
+/*.bin
+/*.dump
+/*.vcd
+/*.rom
--- /dev/null
+/verilog.log
+/a.out
--- /dev/null
+/a.out
+/db
+/*.vcd
--- /dev/null
+/a.out
+/*~
+/*.vcd
--- /dev/null
+/single_u2_sim
+/dual_u2_sim
+/*.lxt
+/*.vcd
+/*.sav
--- /dev/null
+/a.out
+/*.vcd
--- /dev/null
+/xst
+/_ngo
+/_xmsgs
+/*.stx
+/*.tspec
+/*.xml
+/*.gyd
+/*.ngr
+/*.tim
+/*.err
+/*.lso
+/*.bld
+/*.cmd_log
+/*.ise_ISE_Backup
+/*.mfd
+/*.vm6
+/*.syr
+/*.xst
+/*.csv
+/*.html
+/*.jed
+/*.pad
+/*.ng*
+/*.pnx
+/*.rpt
+/*.prj
+/*_html
+/*_log
+/*.lfp
+/*.bit
+/*.bin
+/*.vcd
+/*.unroutes
+/*.drc
+/*_map.*
+/*_guide.*
+/*.twr
+/*.twx
+/a.out
+/*.xpi
+/*_pad.txt
+/*.bgn
+/*.par
--- /dev/null
+/xst
+/_ngo
+/_xmsgs
+/*.stx
+/*.tspec
+/*.xml
+/*.gyd
+/*.ngr
+/*.tim
+/*.err
+/*.lso
+/*.bld
+/*.cmd_log
+/*.ise_ISE_Backup
+/*.mfd
+/*.vm6
+/*.syr
+/*.xst
+/*.csv
+/*.html
+/*.jed
+/*.pad
+/*.ng*
+/*.pnx
+/*.rpt
+/*.prj
+/*_html
+/*_log
+/*.lfp
+/*.bit
+/*.bin
+/*.vcd
+/*.unroutes
+/*.drc
+/*_map.*
+/*_guide.*
+/*.twr
+/*.twx
+/a.out
+/*.xpi
+/*_pad.txt
+/*.bgn
+/*.par
--- /dev/null
+/templates
+/netgen
+/_ngo
+/_xmsgs
+/_pace.ucf
+/*.cmd
+/*.ibs
+/*.lfp
+/*.mfp
+/*.bit
+/*.bin
+/*.stx
+/*.par
+/*.unroutes
+/*.ntrc_log
+/*.ngr
+/*.mrp
+/*.html
+/*.lso
+/*.twr
+/*.bld
+/*.ncd
+/*.txt
+/*.cmd_log
+/*.drc
+/*.map
+/*.twr
+/*.xml
+/*.syr
+/*.ngm
+/*.xst
+/*.csv
+/*.html
+/*.lock
+/*.ncd
+/*.twx
+/*.ise_ISE_Backup
+/*.xml
+/*.ut
+/*.xpi
+/*.ngd
+/*.ncd
+/*.pad
+/*.bgn
+/*.ngc
+/*.pcf
+/*.ngd
+/xst
+/*.log
+/*.rpt
+/*.cel
+/*.restore
--- /dev/null
+/*.ptwx
+/*.xrpt
+/*.zip
+/*_xdb
+/templates
+/netgen
+/_ngo
+/_xmsgs
+/_pace.ucf
+/*.cmd
+/*.ibs
+/*.lfp
+/*.mfp
+/*.bit
+/*.bin
+/*.stx
+/*.par
+/*.unroutes
+/*.ntrc_log
+/*.ngr
+/*.mrp
+/*.html
+/*.lso
+/*.twr
+/*.bld
+/*.ncd
+/*.txt
+/*.cmd_log
+/*.drc
+/*.map
+/*.twr
+/*.xml
+/*.syr
+/*.ngm
+/*.xst
+/*.csv
+/*.html
+/*.lock
+/*.ncd
+/*.twx
+/*.ise_ISE_Backup
+/*.xml
+/*.ut
+/*.xpi
+/*.ngd
+/*.ncd
+/*.pad
+/*.bgn
+/*.ngc
+/*.pcf
+/*.ngd
+/xst
+/*.log
+/*.rpt
+/*.cel
+/*.restore
+/build
--- /dev/null
+/*.ptwx
+/*.xrpt
+/*.zip
+/*_xdb
+/templates
+/netgen
+/_ngo
+/_xmsgs
+/_pace.ucf
+/*.cmd
+/*.ibs
+/*.lfp
+/*.mfp
+/*.bit
+/*.bin
+/*.stx
+/*.par
+/*.unroutes
+/*.ntrc_log
+/*.ngr
+/*.mrp
+/*.html
+/*.lso
+/*.twr
+/*.bld
+/*.ncd
+/*.txt
+/*.cmd_log
+/*.drc
+/*.map
+/*.twr
+/*.xml
+/*.syr
+/*.ngm
+/*.xst
+/*.csv
+/*.html
+/*.lock
+/*.ncd
+/*.twx
+/*.ise_ISE_Backup
+/*.xml
+/*.ut
+/*.xpi
+/*.ngd
+/*.ncd
+/*.pad
+/*.bgn
+/*.ngc
+/*.pcf
+/*.ngd
+/xst
+/*.log
+/*.rpt
+/*.cel
+/*.restore
+/build
--- /dev/null
+/build
+/*.vcd
+/dsp_core_tb
+/*.dat
--- /dev/null
+/configure
+/Makefile.in
+/config.log
+/config.status
+/config.guess
+/stamp-h1
+/config.h
+/ltmain.sh
+/config.sub
+/config.h.in
+/libtool
+/autom4te.cache
+/missing
+/aclocal.m4
+/Makefile
+/install-sh
+/depcomp
+/usrp2*.tar.gz
+/py-compile
+/usrp2.pc
--- /dev/null
+/Makefile
+/Makefile.in
+/.libs
+/.deps
+/test_eth
+/test_usrp2
+/gen_const
+/find_usrps
+/cerr
+/*.sh
+/tx_samples
+/rx_streaming_samples
+/u2_burn_mac_addr
+/usrp2_burn_mac_addr
+/test_mimo_tx
+/gpio
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/Makefile
+/Makefile.in
--- /dev/null
+/.libs
+/.deps
+/Makefile
+/Makefile.in
+/usrp2_socket_opener
--- /dev/null
+Makefile
+Makefile.in
+vrt.pc
--- /dev/null
+#
+# Copyright 2008,2009 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+
+include $(top_srcdir)/Makefile.common
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = vrt.pc
+
+EXTRA_DIST = \
+ vrt.pc.in
+
+SUBDIRS = include lib apps
--- /dev/null
+Makefile
+Makefile.in
+.deps
+.libs
+simple_rx_samples
--- /dev/null
+#
+# Copyright 2009 Free Software Foundation, Inc.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+include $(top_srcdir)/Makefile.common
+
+AM_CPPFLAGS = \
+ $(VRT_INCLUDES) \
+ $(STD_DEFINES_AND_INCLUDES) \
+ $(CPPUNIT_INCLUDES)
+
+LDADD = \
+ $(VRT_LA) \
+ $(GRUEL_LA)
+
+
+bin_PROGRAMS =
+
+noinst_PROGRAMS = \
+ simple_rx_samples
+
+simple_rx_samples_SOURCES = simple_rx_samples.cc
+
--- /dev/null
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <vrt/quadradio.h>
+#include <vrt/rx.h>
+#include <vrt/copiers.h>
+
+#include <errno.h>
+#include <iostream>
+#include <boost/scoped_ptr.hpp>
+#include <boost/shared_ptr.hpp>
+#include <stdexcept>
+#include <signal.h>
+#include <unistd.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+#include <gruel/realtime.h>
+#include <complex>
+
+#define MIN_IP_LOCAL_PORT 32768
+#define MAX_IP_LOCAL_PORT 61000
+
+static volatile bool signaled = false;
+
+static void
+sig_handler(int sig)
+{
+ signaled = true;
+}
+
+static void
+install_sig_handler(int signum,
+ void (*new_handler)(int))
+{
+ struct sigaction new_action;
+ memset (&new_action, 0, sizeof (new_action));
+
+ new_action.sa_handler = new_handler;
+ sigemptyset (&new_action.sa_mask);
+ new_action.sa_flags = 0;
+
+ if (sigaction (signum, &new_action, 0) < 0){
+ perror ("sigaction (install new)");
+ throw std::runtime_error ("sigaction");
+ }
+}
+
+// ------------------------------------------------------------------------
+
+class rx_nop_handler : public vrt::rx_packet_handler
+{
+private:
+ uint64_t d_max_samples;
+ uint64_t d_max_quantum;
+ uint64_t d_nsamples;
+ uint64_t d_npackets;
+ int d_last_pkt_cnt;
+ uint64_t d_nwrong_pkt_cnt;
+
+protected:
+ bool d_err;
+
+public:
+
+ // Shared pointer to an instance of this class
+ typedef boost::shared_ptr<rx_nop_handler> sptr;
+
+ /*!
+ * Constructor
+ *
+ * \param max_samples Maximum number of samples to copy. Use zero for no maximum.
+ * \param max_quantum Maximum number of samples required to accept in one call.
+ * Use 0 to indicate no maximum.
+ */
+ rx_nop_handler(uint64_t max_samples, uint64_t max_quantum=0)
+ : d_max_samples(max_samples), d_max_quantum(max_quantum),
+ d_nsamples(0), d_npackets(0),
+ d_last_pkt_cnt(0xf), d_nwrong_pkt_cnt(0),
+ d_err(false){}
+
+
+ ~rx_nop_handler();
+
+ bool operator()(const uint32_t *payload,
+ size_t n32_bit_words,
+ const vrt::expanded_header *hdr);
+
+ /*!
+ * \brief Returns number of packets this copier was called with
+ */
+ uint64_t npackets() const { return d_npackets; }
+
+ /*!
+ * \brief Returns actual number of samples copied
+ */
+ uint64_t nsamples() const { return d_nsamples; }
+
+ /*!
+ * \brief Returns maximum number of samples that will be copied
+ */
+ uint64_t max_samples() const { return d_max_samples; }
+
+ /*!
+ * Returns true if an error has occurred. Derived classes must set d_err to true
+ * when an error occurs in the () operator
+ */
+ bool has_errored_p() const { return d_err; }
+
+ /*!
+ * \brief Returns true if this instance has reached the maximum number of samples
+ */
+ bool has_finished_p() const
+ { return d_max_samples == 0 ? false : d_nsamples >= d_max_samples-d_max_quantum; }
+
+ uint64_t nwrong_pkt_cnt() const { return d_nwrong_pkt_cnt; }
+
+
+};
+
+
+rx_nop_handler::~rx_nop_handler()
+{
+}
+
+bool
+rx_nop_handler::operator()(const uint32_t *payload,
+ size_t n32_bit_words,
+ const vrt::expanded_header *hdr)
+{
+ if (d_npackets != 0 && hdr->pkt_cnt() != ((d_last_pkt_cnt + 1) & 0xf)){
+ d_nwrong_pkt_cnt++;
+ fprintf(stderr, "bad cnt (pkt %lld)\n", d_npackets);
+ }
+ d_last_pkt_cnt = hdr->pkt_cnt();
+
+ d_nsamples += n32_bit_words;
+ d_npackets++;
+
+ return !has_finished_p();
+}
+
+// ------------------------------------------------------------------------
+
+class file_writer_16sc : public rx_nop_handler
+{
+ FILE *d_fp;
+ std::string d_filename;
+
+public:
+
+ file_writer_16sc(const std::string &filename, uint64_t max_samples)
+ : rx_nop_handler(max_samples), d_filename(filename)
+ {
+ d_fp = fopen(filename.c_str(), "wb");
+ if (d_fp == 0){
+ perror(filename.c_str());
+ throw std::invalid_argument(filename);
+ }
+ }
+
+ ~file_writer_16sc();
+
+ bool
+ operator()(const uint32_t *items, size_t nitems, const vrt::expanded_header *hdr)
+ {
+ bool ok = rx_nop_handler::operator()(items, nitems, hdr);
+
+ size_t host_nitems = nitems;
+ std::complex<int16_t> host_items[host_nitems];
+
+ vrt::copy_net_16sc_to_host_16sc(nitems, items, host_items);
+
+ size_t n = 0;
+ while (n < host_nitems){
+ size_t r = fwrite(&host_items[n], sizeof(host_items[0]), host_nitems - n, d_fp);
+ n += r;
+ if (r == 0){ // out of space?
+ d_err = true;
+ perror(d_filename.c_str());
+ ok = false;
+ break;
+ }
+ }
+
+ return ok;
+ }
+};
+
+file_writer_16sc::~file_writer_16sc()
+{
+ fclose(d_fp);
+}
+
+// ------------------------------------------------------------------------
+
+class file_writer_32fc : public rx_nop_handler
+{
+ FILE *d_fp;
+ std::string d_filename;
+
+public:
+
+ file_writer_32fc(const std::string &filename, uint64_t max_samples)
+ : rx_nop_handler(max_samples), d_filename(filename)
+ {
+ d_fp = fopen(filename.c_str(), "wb");
+ if (d_fp == 0){
+ perror(filename.c_str());
+ throw std::invalid_argument(filename);
+ }
+ }
+
+ ~file_writer_32fc();
+
+ bool
+ operator()(const uint32_t *items, size_t nitems, const vrt::expanded_header *hdr)
+ {
+ bool ok = rx_nop_handler::operator()(items, nitems, hdr);
+
+ size_t host_nitems = nitems;
+ std::complex<float> host_items[host_nitems];
+
+ vrt::copy_net_16sc_to_host_32fc(nitems, items, host_items);
+
+ size_t n = 0;
+ while (n < host_nitems){
+ size_t r = fwrite(&host_items[n], sizeof(host_items[0]), host_nitems - n, d_fp);
+ n += r;
+ if (r == 0){ // out of space?
+ d_err = true;
+ perror(d_filename.c_str());
+ ok = false;
+ break;
+ }
+ }
+
+ return ok;
+ }
+};
+
+file_writer_32fc::~file_writer_32fc()
+{
+ fclose(d_fp);
+}
+
+// ------------------------------------------------------------------------
+
+static void
+usage(const char *progname)
+{
+ const char *p = strrchr(progname, '/'); // drop leading directory path
+ if (p)
+ p++;
+
+ if (strncmp(p, "lt-", 3) == 0) // drop lt- libtool prefix
+ p += 3;
+
+ fprintf(stderr, "Usage: %s [options]\n\n", p);
+ fprintf(stderr, "Options:\n");
+ fprintf(stderr, " -h show this message and exit\n");
+//fprintf(stderr, " -e ETH_INTERFACE specify ethernet interface [default=eth0]\n");
+//fprintf(stderr, " -m MAC_ADDR mac address of USRP2 HH:HH [default=first one found]\n");
+//fprintf(stderr, " -f FREQUENCY specify receive center frequency in Hz [default=0.0]\n");
+//fprintf(stderr, " -d DECIM specify receive decimation rate [default=5]\n");
+//fprintf(stderr, " -g GAIN specify receive daughterboard gain [default=0]\n");
+ fprintf(stderr, " -N NSAMPLES specify number of samples to receive [default=infinite]\n");
+ fprintf(stderr, " -o OUTPUT_FILENAME specify file to receive samples [default=none]\n");
+ fprintf(stderr, " -s write complex<short> [default=complex<float>]\n");
+ fprintf(stderr, " -S samples_per_pkt specify # of samples per pkt [default=maximum]\n");
+//fprintf(stderr, " -v verbose output\n");
+}
+
+
+int
+main(int argc, char **argv)
+{
+ const char *quad_radio_ip = "192.168.123.123";
+ size_t rx_bufsize = 62.5e6; // sizeof memory mapped network buffer
+ int samples_per_pkt = 0; // use default
+ uint64_t nsamples = 0;
+ char *output_filename = 0;
+ bool output_shorts = false;
+ int t;
+
+ int ch;
+
+ while ((ch = getopt(argc, argv, "hN:o:sS:")) != EOF){
+ switch (ch){
+ case 'N':
+ nsamples = (uint64_t) strtod(optarg, 0);
+ break;
+
+ case 'o':
+ output_filename = optarg;
+ break;
+
+ case 's':
+ output_shorts = true;
+ break;
+
+ case 'S':
+ errno = 0;
+ t = strtol(optarg, 0, 0);
+ if (errno != 0){
+ usage(argv[0]);
+ exit(1);
+ }
+ samples_per_pkt = t;
+ break;
+
+ case 'h':
+ default:
+ usage(argv[0]);
+ exit(1);
+ }
+ }
+
+
+ install_sig_handler(SIGINT, sig_handler);
+
+ gruel::rt_status_t rt = gruel::enable_realtime_scheduling();
+ if (rt != gruel::RT_OK)
+ std::cerr << "Failed to enable realtime scheduling" << std::endl;
+
+
+ vrt::quadradio::sptr qr;
+ try {
+ qr = vrt::quadradio::sptr(new vrt::quadradio(quad_radio_ip, rx_bufsize));
+ }
+ catch (...){
+ std::cerr << "Failed to create vrt::quadradio\n";
+ return 1;
+ }
+
+
+ rx_nop_handler::sptr handler;
+ if (output_filename){
+ if (output_shorts)
+ handler = rx_nop_handler::sptr(new file_writer_16sc(output_filename, nsamples));
+ else
+ handler = rx_nop_handler::sptr(new file_writer_32fc(output_filename, nsamples));
+ }
+ else
+ handler = rx_nop_handler::sptr(new rx_nop_handler(nsamples));
+
+
+ printf("samples_per_pkt = %d\n", samples_per_pkt);
+
+ if (!qr->start_streaming(samples_per_pkt)){
+ fprintf(stderr, "failed to send_rx_command\n");
+ return 1;
+ }
+
+ // start receiving packets
+
+ while(1
+ && !signaled
+ && !handler->has_errored_p()
+ && !handler->has_finished_p()){
+ bool ok = qr->vrt_rx()->rx_packets(handler.get());
+ if (!ok){
+ fprintf(stderr, "vrt->rx_packets failed\n");
+ break;
+ }
+ }
+
+ qr->stop_streaming();
+
+ printf("%llu packets received, %llu bad pkt_cnt field values, %llu samples\n",
+ handler->npackets(), handler->nwrong_pkt_cnt(), handler->nsamples());
+
+ //sleep(1);
+
+ return 0;
+}
--- /dev/null
+#
+# Copyright 2009 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+
+include $(top_srcdir)/Makefile.common
+
+SUBDIRS = vrt
--- /dev/null
+#
+# Copyright 2008,2009 Free Software Foundation, Inc.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+include $(top_srcdir)/Makefile.common
+
+INCLUDES =
+
+vrtincludedir = $(includedir)/vrt
+
+vrtinclude_HEADERS = \
+ bits.h \
+ copiers.h \
+ expanded_header.h \
+ quadradio.h \
+ rx.h \
+ rx_packet_handler.h
--- /dev/null
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef INCLUDED_VRT_BITS_H
+#define INCLUDED_VRT_BITS_H
+
+#include <stdint.h>
+
+
+/* VRT Header bits */
+
+#define VRTH_PT_MASK (0xf << 28)
+#define VRTH_PT_IF_DATA_NO_SID (0x0 << 28) // IF-Data, no stream id
+#define VRTH_PT_IF_DATA_WITH_SID (0x1 << 28) // IF-Data, w/ stream id
+#define VRTH_PT_EXT_DATA_NO_SID (0x2 << 28)
+#define VRTH_PT_EXT_DATA_WITH_SID (0x3 << 28)
+#define VRTH_PT_IF_CONTEXT (0x4 << 28)
+#define VRTH_PT_EXT_CONTEXT (0x5 << 28)
+
+#define VRTH_HAS_CLASSID (1 << 27)
+#define VRTH_HAS_TRAILER (1 << 26) // Data pkts only
+#define VRTH_START_OF_BURST (1 << 25) // Data (Tx) pkts only
+#define VRTH_END_OF_BURST (1 << 24) // Data (Tx) pkts only
+#define VRTH_TSM (1 << 24) // Context pkts only
+
+#define VRTH_TSI_MASK (0x3 << 22)
+#define VRTH_TSI_NONE (0x0 << 22)
+#define VRTH_TSI_UTC (0x1 << 22)
+#define VRTH_TSI_GPS (0x2 << 22)
+#define VRTH_TSI_OTHER (0x3 << 22)
+
+#define VRTH_TSF_MASK (0x3 << 20)
+#define VRTH_TSF_NONE (0x0 << 20)
+#define VRTH_TSF_SAMPLE_CNT (0x1 << 20)
+#define VRTH_TSF_REAL_TIME_PS (0x2 << 20)
+#define VRTH_TSF_FREE_RUNNING (0x3 << 20)
+
+#define VRTH_PKT_CNT_MASK (0xf << 16)
+#define VRTH_PKT_SIZE_MASK 0xffff
+
+
+static inline int
+vrth_pkt_cnt(uint32_t h)
+{
+ return (h & VRTH_PKT_CNT_MASK) >> 16;
+}
+
+static inline int
+vrth_pkt_size(uint32_t h)
+{
+ return h & VRTH_PKT_SIZE_MASK;
+}
+
+#endif /* INCLUDED_VRT_BITS_H */
--- /dev/null
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef INCLUDED_VRT_COPIERS_H
+#define INCLUDED_VRT_COPIERS_H
+
+#include <stdint.h>
+#include <stddef.h>
+#include <complex>
+
+namespace vrt {
+
+ /*!
+ * \brief Copy and convert from net format to host format
+ */
+ void
+ copy_net_16sc_to_host_16sc(size_t nitems,
+ const uint32_t *items,
+ std::complex<int16_t> *host_items);
+
+
+ /*!
+ * \brief Copy and convert from net format to host format mapping [-32768, 32767] -> [1.0, +1.0)
+ */
+ void
+ copy_net_16sc_to_host_32fc(size_t nitems,
+ const uint32_t *items,
+ std::complex<float> *host_items);
+};
+
+#endif /* INCLUDED_VRT_COPIERS_H */
--- /dev/null
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef INCLUDED_VRT_EXPANDED_HEADER_H
+#define INCLUDED_VRT_EXPANDED_HEADER_H
+
+#include <stdint.h>
+#include <stddef.h>
+#include <vrt/bits.h>
+
+namespace vrt {
+
+ /*!
+ * \brief All headers and trailer for VRT IF-Data, Extension-Data,
+ * IF-Context and Extension-Context packets.
+ *
+ * There are fields allocated for each possible header. Their content may
+ * or may not be valid. Check the header field to confirm their validity.
+ * All values are in host-endian format.
+ */
+ struct expanded_header {
+ uint32_t header; // first word of all packets
+ uint32_t stream_id; // optional stream identifier
+ uint64_t class_id; // optional class identifier
+ uint32_t integer_secs; // optional integer seconds timestamp
+ uint64_t fractional_secs; // optional fractional seconds timestamp
+ uint32_t trailer; // optional trailer (only possible in data pkts)
+
+ expanded_header()
+ : header(0) /*, stream_id(0), class_id(0),
+ integer_secs(0), fractional_secs(0), trailer(0)*/ {}
+
+
+ int pkt_type() const {
+ return (header & VRTH_PT_MASK) >> 28;
+ }
+
+ int pkt_cnt() const { return vrth_pkt_cnt(header); }
+ size_t pkt_size() const { return vrth_pkt_size(header); }
+
+
+ // packet type predicates
+ bool if_data_p() const { return s_if_data[pkt_type()]; }
+ bool ext_data_p() const { return s_ext_data[pkt_type()]; }
+ bool if_context_p() const { return (header & VRTH_PT_MASK) == VRTH_PT_IF_CONTEXT; }
+ bool ext_context_p() const { return (header & VRTH_PT_MASK) == VRTH_PT_EXT_CONTEXT; }
+
+ bool data_p() const { return s_data[pkt_type()]; } // if_data_p() || ext_data_p()
+ bool context_p() const { return s_context[pkt_type()]; } // if_context_p() || ext_context_p()
+
+ // optional info predicates
+ bool stream_id_p() const { return s_stream_id[pkt_type()]; }
+ bool class_id_p() const { return (header & VRTH_HAS_CLASSID) != 0; }
+ bool integer_secs_p() const { return (header & VRTH_TSI_MASK) != 0; }
+ bool fractional_secs_p() const { return (header & VRTH_TSF_MASK) != 0; }
+ bool trailer_p() const { return (header & VRTH_HAS_TRAILER) != 0 && data_p(); }
+
+
+ // parser
+
+ /*!
+ * \brief parse packet, fill-in expanded header, start of payload and len of payload
+ */
+ static bool parse(const uint32_t *packet, // in
+ size_t n32_bit_words_packet, // in
+ expanded_header *hdr, // out
+ const uint32_t **payload, // out
+ size_t *n32_bit_words_payload); // out
+
+ private:
+ static unsigned char s_if_data[16];
+ static unsigned char s_ext_data[16];
+ static unsigned char s_data[16];
+ static unsigned char s_context[16];
+ static unsigned char s_stream_id[16];
+
+ };
+
+}; // vrt
+
+
+#endif /* INCLUDED_VRT_EXPANDED_HEADER_H */
--- /dev/null
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef INCLUDED_VRT_QUADRADIO_H
+#define INCLUDED_VRT_QUADRADIO_H
+
+#include <vrt/rx.h>
+
+#include <arpa/inet.h>
+#include <netinet/in.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+
+typedef enum{
+ VRT_TEST_SIG_NORMAL=0,
+ VRT_TEST_SIG_ZEROS=1,
+ VRT_TEST_SIG_ONES=2,
+ VRT_TEST_SIG_TOGGLE=3,
+ VRT_TEST_SIG_RAMP=4,
+ VRT_TEST_SIG_CUSTOM=5,
+
+ } vrt_test_sig_t;
+
+namespace vrt {
+
+ /*
+ * We're not committing to this interface. It's just here so we can make progress...
+ *
+ * This implements the ad-hoc control for bringup and has-a vrt::rx
+ */
+ class quadradio
+ {
+ int d_ctrl_fd; // socket for control
+ struct in_addr d_ctrl_port_inaddr; // our ip addr
+ int d_data_fd; // socket for data (owned by d_rx)
+ int d_data_port; // our data port number
+ vrt::rx::sptr d_rx; // has-a rx
+
+ int d_band_select; // band select setting
+ int d_rx_antenna; // antenna type rf/cal
+ int d_attenuation0; // attenuation setting
+ int d_attenuation1; // attenuation setting
+ bool d_10dB_atten; // 10dB attenuation on/of
+
+ static bool
+ open_sockets(const char *quad_radio_ip, int quad_radio_ctrl_port,
+ int *ctrl_fd_ptr, struct in_addr *ctrl_port_inaddr,
+ int *data_fd_ptr, int *data_port_ptr);
+
+ static bool
+ send_rx_command(int ctrl_fd, bool start,
+ struct in_addr addr, int data_port, int samples_per_pkt, int siggen_param);
+
+ static bool
+ send_stop_rx_command(int ctrl_fd);
+
+ static int control_port() { return 790; }
+ int data_socket_fd() const { return d_data_fd; }
+
+ bool open(const char *ip);
+
+ void update_dboard_pins(void);
+
+ public:
+ typedef boost::shared_ptr<quadradio> sptr;
+
+ quadradio(const std::string &ip, size_t rx_bufsize = 0);
+ ~quadradio();
+
+ vrt::rx::sptr vrt_rx() const { return d_rx; }
+
+ bool start_streaming(int samples_per_pkt = 0);
+ bool stop_streaming();
+
+
+ /* convenience methods that ultimately write the dboard pins */
+ bool set_center_freq(double target_freq);
+ bool set_band_select(const std::string &band);
+ //void set_10dB_atten(bool on);
+ bool set_attenuation0(int attenuation);
+ bool select_rx_antenna(const std::string &ant);
+ bool set_attenuation1(int attenuation);
+
+ /* convenience methods that ultimately call set_hsadc_conf */
+ void set_adc_gain(bool on);
+ void set_dc_offset_comp(bool on);
+ void set_digital_gain(float gain);
+ void set_test_signal(vrt_test_sig_t type);
+
+ /* primitives */
+ bool set_setting_reg(int regno, int value);
+ bool set_mem32(int addr, int value); // poke a 32-bit value
+ bool set_lo_freq(double freq);
+ bool set_cal_freq(double freq);
+ bool set_beamforming(int32_t gains[8]);
+ /*
+ * The first parameter for these is a bitmask which indicates which
+ * daughterboard or daughterboards to apply the operation to.
+ * 0x1 -> dboard 0
+ * 0x2 -> dboard 1
+ * 0x3 -> dboard 0 and 1...
+ */
+ bool set_dboard_pins(int dboard_bitmask, int v);
+ bool set_hsadc_conf(int dboard_bitmask, int regno, int value);
+ bool set_lsdac(int dboard_bitmask, int which_dac, int value);
+
+ };
+
+};
+
+
+#endif /* INCLUDED_QUADRADIO_H */
--- /dev/null
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef INCLUDED_VRT_RX_H
+#define INCLUDED_VRT_RX_H
+
+#include <boost/shared_ptr.hpp>
+#include <boost/utility.hpp>
+#include <vrt/rx_packet_handler.h>
+
+namespace vrt {
+
+ class socket_rx_buffer;
+
+ /*!
+ * Relatively low-level interface to receive VRT packets over a datagram socket.
+ *
+ * (We'll refactor this if/when we use a non-UDP transport.)
+ * No VRT control issues are addressed here.
+ */
+ class rx : boost::noncopyable
+ {
+ int d_socket_fd;
+ socket_rx_buffer *d_srb;
+
+ public:
+ /*!
+ * Shared pointer to this class
+ */
+ typedef boost::shared_ptr<rx> sptr;
+
+ /*!
+ * \brief Static function to return an instance of rx as a shared pointer.
+ *
+ * \param socket_fd file descriptor that data grams will be received from.
+ * It is assumed that some higher-level control software
+ * opened the appropriate UDP socket for us. This object
+ * assumes management of the socket's lifetime. The
+ * socket will be closed when our destructor fires.
+ *
+ * \param rx_bufsize is a hint as to the number of bytes of memory
+ * to allocate for received ethernet frames (0 -> reasonable default)
+ */
+ static sptr make(int socket_fd, size_t rx_bufsize = 0);
+
+ /*!
+ * \param socket_fd file descriptor that data grams will be received from.
+ * It is assumed that some higher-level control software
+ * opened the appropriate UDP socket for us. This object
+ * assumes management of the socket's lifetime. The
+ * socket will be closed when our destructor fires.
+ *
+ * \param rx_bufsize is a hint as to the number of bytes of memory
+ * to allocate for received ethernet frames (0 -> reasonable default)
+ */
+ rx(int socket_fd, size_t rx_bufsize = 0);
+ ~rx();
+
+ /*!
+ * \brief Receive packets from the given socket file descriptor.
+ *
+ * \p handler will be invoked for all available packets.
+ * Unless \p dont_wait is true, this function blocks until at
+ * least one packet has been processed.
+ */
+ bool rx_packets(rx_packet_handler *handler, bool dont_wait = false);
+
+ /*
+ * \returns the socket_fd. Useful for select or poll.
+ */
+ int socket_fd() const { return d_socket_fd; }
+ };
+
+}
+
+#endif /* INCLUDED_VRT_RX_H */
--- /dev/null
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef INCLUDED_VRT_RX_PACKET_HANDLER_H
+#define INCLUDED_VRT_RX_PACKET_HANDLER_H
+
+#include <vrt/expanded_header.h>
+#include <stddef.h>
+
+namespace vrt {
+
+ /*!
+ * \brief Abstract function object called to handle received VRT packets.
+ *
+ * An object derived from this class is passed to vrt_rx_udp::rx_packets
+ * to process the received packets.
+ */
+ class rx_packet_handler {
+ public:
+ virtual ~rx_packet_handler();
+
+ /*!
+ * \param payload points to the first 32-bit word of the payload field.
+ * \param n32_bit_words is the number of 32-bit words in the payload field.
+ * \param hdr is the expanded version of the mandatory and optional header fields (& trailer).
+ *
+ * \p payload points to the raw payload section of the packet received off
+ * the wire. The data is network-endian (aka big-endian) 32-bit integers.
+ *
+ * This is the general purpose, low level interface and relies on other
+ * functions to handle all required endian-swapping and format conversion
+ * of the payload. \sa FIXME.
+ *
+ * \returns true if the object wants to be called again with new data;
+ * false if no additional data is wanted.
+ */
+ virtual bool operator()(const uint32_t *payload,
+ size_t n32_bit_words,
+ const expanded_header *hdr);
+ };
+
+}; // vrt
+
+
+#endif /* INCLUDED_VRT_RX_PACKET_HANDLER_H */
--- /dev/null
+Makefile
+Makefile.in
+.deps
+.libs
--- /dev/null
+#
+# Copyright 2007,2008,2009 Free Software Foundation, Inc.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+include $(top_srcdir)/Makefile.common
+
+AM_CPPFLAGS = \
+ $(VRT_INCLUDES) \
+ $(BOOST_CPPFLAGS) \
+ $(CPPUNIT_INCLUDES)
+
+bin_PROGRAMS =
+
+lib_LTLIBRARIES = \
+ libvrt.la
+
+libvrt_la_SOURCES = \
+ copiers.cc \
+ data_handler.cc \
+ expanded_header.cc \
+ quadradio.cc \
+ rx.cc \
+ rx_packet_handler.cc \
+ socket_rx_buffer.cc
+
+libvrt_la_LIBADD =
+
+# Private headers not needed for above the API development
+noinst_HEADERS = \
+ data_handler.h \
+ expanded_header_cw_tables.h \
+ expanded_header_switch_body.h \
+ socket_rx_buffer.h
+
+EXTRA_DIST = \
+ gen_cw_tables.py \
+ gen_switch_body.py
--- /dev/null
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <vrt/copiers.h>
+#include <arpa/inet.h>
+
+namespace vrt {
+
+ void
+ copy_net_16sc_to_host_16sc(size_t nitems,
+ const uint32_t *items,
+ std::complex<int16_t> *host_items)
+ {
+#ifdef WORDS_BIGENDIAN
+
+ assert(sizeof(items[0]) == sizeof(host_items[0]));
+ memcpy(host_items, items, nitems * sizeof(items[0]));
+
+#else
+
+ // FIXME SIMD welcome here
+
+ for (size_t i = 0; i < nitems; i++){
+ uint32_t t = ntohl(items[i]);
+ //printf("%9d\n", items[i]);
+ host_items[i] = std::complex<int16_t>((t >> 16), t & 0xffff);
+ }
+
+#endif
+ }
+
+ void
+ copy_net_16sc_to_host_32fc(size_t nitems,
+ const uint32_t *items,
+ std::complex<float> *host_items)
+ {
+ // FIXME SIMD welcome here
+
+ for (size_t i = 0; i < nitems; i++){
+ uint32_t t = ntohl(items[i]);
+ int16_t re = (t >> 16) & 0xffff;
+ int16_t im = (t & 0xffff);
+ host_items[i] = std::complex<float>(re * 1.0/32768, im * 1.0/32768);
+ }
+ }
+
+};
+
--- /dev/null
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include "data_handler.h"
+
+namespace vrt {
+
+ data_handler::~data_handler()
+ {
+ // default nop destructor
+ }
+
+}
+
--- /dev/null
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef INCLUDED_VRT_DATA_HANDLER_H
+#define INCLUDED_VRT_DATA_HANDLER_H
+
+#include <stdint.h>
+#include <stddef.h>
+
+namespace vrt {
+
+ /*!
+ * \brief Abstract function object called to handle received data blocks.
+ */
+ class data_handler
+ {
+ public:
+
+ enum result_bits {
+ DONE = 0x0002, //< do not call this object again
+ };
+
+ typedef int result; //< bitmask of result_bits
+
+ /*!
+ * \param base points to the beginning of the data
+ * \param len is the length in bytes of the data
+ * \returns bitmask composed of DONE
+ */
+ virtual result operator()(const void *base, size_t len) = 0;
+ virtual ~data_handler();
+ };
+
+} // namespace vrt
+
+#endif /* INCLUDED_VRT_DATA_HANDLER_H */
--- /dev/null
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <vrt/expanded_header.h>
+#include <arpa/inet.h> // needs autoconf'ing
+//#include <stdio.h>
+
+namespace vrt {
+
+ // lookup tables indexed by packet type
+ unsigned char expanded_header::s_if_data[16] = {
+ 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ };
+
+ unsigned char expanded_header::s_ext_data[16] = {
+ 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ };
+
+ unsigned char expanded_header::s_data[16] = {
+ 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ };
+
+ unsigned char expanded_header::s_context[16] = {
+ 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ };
+
+ unsigned char expanded_header::s_stream_id[16] = {
+ 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ };
+
+
+ // dispatch codeword bits
+ static const int HAS_STREAM_ID = 1 << 0;
+ static const int HAS_CLASS_ID = 1 << 1;
+ static const int HAS_INTEGER_SECS = 1 << 2;
+ static const int HAS_FRACTIONAL_SECS = 1 << 3;
+ static const int HAS_TRAILER = 1 << 4;
+
+#include "expanded_header_cw_tables.h"
+
+ static int
+ compute_codeword(const expanded_header &h)
+ {
+ int cw = 0;
+ if (h.stream_id_p()) cw |= HAS_STREAM_ID;
+ if (h.class_id_p()) cw |= HAS_CLASS_ID;
+ if (h.integer_secs_p()) cw |= HAS_INTEGER_SECS;
+ if (h.fractional_secs_p()) cw |= HAS_FRACTIONAL_SECS;
+ if (h.trailer_p()) cw |= HAS_TRAILER;
+ return cw;
+ }
+
+ bool
+ expanded_header::parse(const uint32_t *packet, // in
+ size_t n32_bit_words_packet, // in
+ expanded_header *h, // out
+ const uint32_t **payload, // out
+ size_t *n32_bit_words_payload) // out
+ {
+ size_t len = n32_bit_words_packet;
+ const uint32_t *p = packet;
+
+ *payload = 0;
+ *n32_bit_words_payload = 0;
+
+ // printf("parse: n32_bit_words_packet = %zd\n", n32_bit_words_packet);
+
+ if (len < 1){ // must have at least the header word
+ h->header = 0;
+ return false;
+ }
+
+ h->header = ntohl(p[0]);
+
+ if (h->pkt_size() > len)
+ return false; // VRT header says packet is bigger than what we've got
+
+ len = h->pkt_size(); // valid length of packet
+
+ int cw = compute_codeword(*h);
+ if (cw_header_len(cw) + cw_trailer_len(cw) > len)
+ return false; // negative payload len
+
+ *payload = p + cw_header_len(cw);
+ *n32_bit_words_payload = len - (cw_header_len(cw) + cw_trailer_len(cw));
+
+ // printf("parse: hdr = 0x%08x, cw = 0x%02x, cw_header_len(cw) = %d, cw_trailer_len(cw) = %d\n",
+ // h->header, cw, cw_header_len(cw), cw_trailer_len(cw));
+
+ switch (cw & 0x1f){
+#include "expanded_header_switch_body.h"
+ }
+
+ return true;
+ }
+
+
+}; // vrt
--- /dev/null
+inline static size_t cw_header_len(int cw){
+ static const size_t s_cw_header_len[32] = {
+ 1, 2, 3, 4, 2, 3, 4, 5, 3, 4, 5, 6, 4, 5, 6, 7, 1, 2, 3, 4, 2, 3, 4, 5, 3, 4, 5, 6, 4, 5, 6, 7,
+ };
+ return s_cw_header_len[cw];
+}
+
+inline static size_t cw_trailer_len(int cw){
+ static const size_t s_cw_trailer_len[32] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ };
+ return s_cw_trailer_len[cw];
+}
+
--- /dev/null
+ case 0:
+ h->stream_id = 0;
+ h->class_id = 0;
+ h->integer_secs = 0;
+ h->fractional_secs = 0;
+ h->trailer = 0;
+ break;
+
+ case 1:
+ h->stream_id = ntohl(p[1]);
+ h->class_id = 0;
+ h->integer_secs = 0;
+ h->fractional_secs = 0;
+ h->trailer = 0;
+ break;
+
+ case 2:
+ h->stream_id = 0;
+ h->class_id = ((uint64_t)(ntohl(p[1])) << 32) | ntohl(p[2]);
+ h->integer_secs = 0;
+ h->fractional_secs = 0;
+ h->trailer = 0;
+ break;
+
+ case 3:
+ h->stream_id = ntohl(p[1]);
+ h->class_id = ((uint64_t)(ntohl(p[2])) << 32) | ntohl(p[3]);
+ h->integer_secs = 0;
+ h->fractional_secs = 0;
+ h->trailer = 0;
+ break;
+
+ case 4:
+ h->stream_id = 0;
+ h->class_id = 0;
+ h->integer_secs = ntohl(p[1]);
+ h->fractional_secs = 0;
+ h->trailer = 0;
+ break;
+
+ case 5:
+ h->stream_id = ntohl(p[1]);
+ h->class_id = 0;
+ h->integer_secs = ntohl(p[2]);
+ h->fractional_secs = 0;
+ h->trailer = 0;
+ break;
+
+ case 6:
+ h->stream_id = 0;
+ h->class_id = ((uint64_t)(ntohl(p[1])) << 32) | ntohl(p[2]);
+ h->integer_secs = ntohl(p[3]);
+ h->fractional_secs = 0;
+ h->trailer = 0;
+ break;
+
+ case 7:
+ h->stream_id = ntohl(p[1]);
+ h->class_id = ((uint64_t)(ntohl(p[2])) << 32) | ntohl(p[3]);
+ h->integer_secs = ntohl(p[4]);
+ h->fractional_secs = 0;
+ h->trailer = 0;
+ break;
+
+ case 8:
+ h->stream_id = 0;
+ h->class_id = 0;
+ h->integer_secs = 0;
+ h->fractional_secs = ((uint64_t)(ntohl(p[1])) << 32) | ntohl(p[2]);
+ h->trailer = 0;
+ break;
+
+ case 9:
+ h->stream_id = ntohl(p[1]);
+ h->class_id = 0;
+ h->integer_secs = 0;
+ h->fractional_secs = ((uint64_t)(ntohl(p[2])) << 32) | ntohl(p[3]);
+ h->trailer = 0;
+ break;
+
+ case 10:
+ h->stream_id = 0;
+ h->class_id = ((uint64_t)(ntohl(p[1])) << 32) | ntohl(p[2]);
+ h->integer_secs = 0;
+ h->fractional_secs = ((uint64_t)(ntohl(p[3])) << 32) | ntohl(p[4]);
+ h->trailer = 0;
+ break;
+
+ case 11:
+ h->stream_id = ntohl(p[1]);
+ h->class_id = ((uint64_t)(ntohl(p[2])) << 32) | ntohl(p[3]);
+ h->integer_secs = 0;
+ h->fractional_secs = ((uint64_t)(ntohl(p[4])) << 32) | ntohl(p[5]);
+ h->trailer = 0;
+ break;
+
+ case 12:
+ h->stream_id = 0;
+ h->class_id = 0;
+ h->integer_secs = ntohl(p[1]);
+ h->fractional_secs = ((uint64_t)(ntohl(p[2])) << 32) | ntohl(p[3]);
+ h->trailer = 0;
+ break;
+
+ case 13:
+ h->stream_id = ntohl(p[1]);
+ h->class_id = 0;
+ h->integer_secs = ntohl(p[2]);
+ h->fractional_secs = ((uint64_t)(ntohl(p[3])) << 32) | ntohl(p[4]);
+ h->trailer = 0;
+ break;
+
+ case 14:
+ h->stream_id = 0;
+ h->class_id = ((uint64_t)(ntohl(p[1])) << 32) | ntohl(p[2]);
+ h->integer_secs = ntohl(p[3]);
+ h->fractional_secs = ((uint64_t)(ntohl(p[4])) << 32) | ntohl(p[5]);
+ h->trailer = 0;
+ break;
+
+ case 15:
+ h->stream_id = ntohl(p[1]);
+ h->class_id = ((uint64_t)(ntohl(p[2])) << 32) | ntohl(p[3]);
+ h->integer_secs = ntohl(p[4]);
+ h->fractional_secs = ((uint64_t)(ntohl(p[5])) << 32) | ntohl(p[6]);
+ h->trailer = 0;
+ break;
+
+ case 16:
+ h->stream_id = 0;
+ h->class_id = 0;
+ h->integer_secs = 0;
+ h->fractional_secs = 0;
+ h->trailer = ntohl(p[len-1]);
+ break;
+
+ case 17:
+ h->stream_id = ntohl(p[1]);
+ h->class_id = 0;
+ h->integer_secs = 0;
+ h->fractional_secs = 0;
+ h->trailer = ntohl(p[len-1]);
+ break;
+
+ case 18:
+ h->stream_id = 0;
+ h->class_id = ((uint64_t)(ntohl(p[1])) << 32) | ntohl(p[2]);
+ h->integer_secs = 0;
+ h->fractional_secs = 0;
+ h->trailer = ntohl(p[len-1]);
+ break;
+
+ case 19:
+ h->stream_id = ntohl(p[1]);
+ h->class_id = ((uint64_t)(ntohl(p[2])) << 32) | ntohl(p[3]);
+ h->integer_secs = 0;
+ h->fractional_secs = 0;
+ h->trailer = ntohl(p[len-1]);
+ break;
+
+ case 20:
+ h->stream_id = 0;
+ h->class_id = 0;
+ h->integer_secs = ntohl(p[1]);
+ h->fractional_secs = 0;
+ h->trailer = ntohl(p[len-1]);
+ break;
+
+ case 21:
+ h->stream_id = ntohl(p[1]);
+ h->class_id = 0;
+ h->integer_secs = ntohl(p[2]);
+ h->fractional_secs = 0;
+ h->trailer = ntohl(p[len-1]);
+ break;
+
+ case 22:
+ h->stream_id = 0;
+ h->class_id = ((uint64_t)(ntohl(p[1])) << 32) | ntohl(p[2]);
+ h->integer_secs = ntohl(p[3]);
+ h->fractional_secs = 0;
+ h->trailer = ntohl(p[len-1]);
+ break;
+
+ case 23:
+ h->stream_id = ntohl(p[1]);
+ h->class_id = ((uint64_t)(ntohl(p[2])) << 32) | ntohl(p[3]);
+ h->integer_secs = ntohl(p[4]);
+ h->fractional_secs = 0;
+ h->trailer = ntohl(p[len-1]);
+ break;
+
+ case 24:
+ h->stream_id = 0;
+ h->class_id = 0;
+ h->integer_secs = 0;
+ h->fractional_secs = ((uint64_t)(ntohl(p[1])) << 32) | ntohl(p[2]);
+ h->trailer = ntohl(p[len-1]);
+ break;
+
+ case 25:
+ h->stream_id = ntohl(p[1]);
+ h->class_id = 0;
+ h->integer_secs = 0;
+ h->fractional_secs = ((uint64_t)(ntohl(p[2])) << 32) | ntohl(p[3]);
+ h->trailer = ntohl(p[len-1]);
+ break;
+
+ case 26:
+ h->stream_id = 0;
+ h->class_id = ((uint64_t)(ntohl(p[1])) << 32) | ntohl(p[2]);
+ h->integer_secs = 0;
+ h->fractional_secs = ((uint64_t)(ntohl(p[3])) << 32) | ntohl(p[4]);
+ h->trailer = ntohl(p[len-1]);
+ break;
+
+ case 27:
+ h->stream_id = ntohl(p[1]);
+ h->class_id = ((uint64_t)(ntohl(p[2])) << 32) | ntohl(p[3]);
+ h->integer_secs = 0;
+ h->fractional_secs = ((uint64_t)(ntohl(p[4])) << 32) | ntohl(p[5]);
+ h->trailer = ntohl(p[len-1]);
+ break;
+
+ case 28:
+ h->stream_id = 0;
+ h->class_id = 0;
+ h->integer_secs = ntohl(p[1]);
+ h->fractional_secs = ((uint64_t)(ntohl(p[2])) << 32) | ntohl(p[3]);
+ h->trailer = ntohl(p[len-1]);
+ break;
+
+ case 29:
+ h->stream_id = ntohl(p[1]);
+ h->class_id = 0;
+ h->integer_secs = ntohl(p[2]);
+ h->fractional_secs = ((uint64_t)(ntohl(p[3])) << 32) | ntohl(p[4]);
+ h->trailer = ntohl(p[len-1]);
+ break;
+
+ case 30:
+ h->stream_id = 0;
+ h->class_id = ((uint64_t)(ntohl(p[1])) << 32) | ntohl(p[2]);
+ h->integer_secs = ntohl(p[3]);
+ h->fractional_secs = ((uint64_t)(ntohl(p[4])) << 32) | ntohl(p[5]);
+ h->trailer = ntohl(p[len-1]);
+ break;
+
+ case 31:
+ h->stream_id = ntohl(p[1]);
+ h->class_id = ((uint64_t)(ntohl(p[2])) << 32) | ntohl(p[3]);
+ h->integer_secs = ntohl(p[4]);
+ h->fractional_secs = ((uint64_t)(ntohl(p[5])) << 32) | ntohl(p[6]);
+ h->trailer = ntohl(p[len-1]);
+ break;
+
--- /dev/null
+#!/usr/bin/env python
+#
+# Copyright 2009 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+
+import sys
+
+# dispatch codeword bits
+HAS_STREAM_ID = 1 << 0;
+HAS_CLASS_ID = 1 << 1;
+HAS_INTEGER_SECS = 1 << 2;
+HAS_FRACTIONAL_SECS = 1 << 3;
+HAS_TRAILER = 1 << 4;
+
+def main():
+ f = sys.stdout
+ header_len = 32 * [0]
+ trailer_len = 32 * [0]
+
+ for cw in range(32):
+ t = 0
+ if cw & HAS_TRAILER: t += 1
+ trailer_len[cw] = t
+
+ t = 1
+ if cw & HAS_STREAM_ID: t += 1
+ if cw & HAS_CLASS_ID: t += 2
+ if cw & HAS_INTEGER_SECS: t += 1
+ if cw & HAS_FRACTIONAL_SECS: t += 2
+ header_len[cw] = t
+
+ write_table(f, "cw_header_len", header_len)
+ write_table(f, "cw_trailer_len", trailer_len)
+
+def write_table(f, name, table):
+ f.write("inline static size_t ")
+ f.write(name)
+ f.write("(int cw){\n")
+
+ f.write(" static const size_t s_")
+ f.write(name)
+ f.write("[32] = {\n ")
+ for t in table:
+ f.write("%d, " % (t,))
+ f.write("\n };\n")
+
+ f.write(" return s_")
+ f.write(name)
+ f.write("[cw];\n}\n\n")
+
+
+if __name__ == '__main__':
+ main()
--- /dev/null
+#!/usr/bin/env python
+#
+# Copyright 2009 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+
+import sys
+
+# dispatch codeword bits
+HAS_STREAM_ID = 1 << 0;
+HAS_CLASS_ID = 1 << 1;
+HAS_INTEGER_SECS = 1 << 2;
+HAS_FRACTIONAL_SECS = 1 << 3;
+HAS_TRAILER = 1 << 4;
+
+def do_case(f, cw):
+
+ def do32(name, mask, index):
+ f.write(" ")
+ if cw & mask:
+ f.write("h->%s = ntohl(p[%d]);\n" % (name, index))
+ return 1
+ else:
+ f.write("h->%s = 0;\n" % (name,))
+ return 0
+
+ def do64(name, mask, index):
+ f.write(" ")
+ if cw & mask:
+ f.write("h->%s = ((uint64_t)(ntohl(p[%d])) << 32) | ntohl(p[%d]);\n" % (name, index, index+1))
+ return 2
+ else:
+ f.write("h->%s = 0;\n" % (name,))
+ return 0
+
+ def dotrailer(name, mask):
+ f.write(" ")
+ if cw & mask:
+ f.write("h->%s = ntohl(p[len-1]);\n" % (name,))
+ return 1
+ else:
+ f.write("h->%s = 0;\n" % (name,))
+ return 0
+
+ f.write(" case %d:\n" % (cw,))
+
+ index = 1
+ index += do32("stream_id", HAS_STREAM_ID, index)
+ index += do64("class_id", HAS_CLASS_ID, index)
+ index += do32("integer_secs", HAS_INTEGER_SECS, index)
+ index += do64("fractional_secs", HAS_FRACTIONAL_SECS, index)
+ dotrailer("trailer", HAS_TRAILER)
+
+ f.write(" break;\n\n")
+
+
+def main():
+ f = sys.stdout
+
+ for cw in range(32):
+ do_case(f, cw)
+
+
+if __name__ == '__main__':
+ main()
--- /dev/null
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <vrt/quadradio.h>
+#include <errno.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdexcept>
+#include <math.h>
+
+#define MIN_IP_LOCAL_PORT 32768
+#define MAX_IP_LOCAL_PORT 61000
+
+#define ALL_DBOARDS 0xf
+
+static bool
+send_and_check(int fd, void *buf, size_t len)
+{
+ int r = send(fd, buf, len, 0);
+ if (r < 0){
+ perror("send");
+ return false;
+ }
+ if ((size_t) r != len){
+ fprintf(stderr, "send: short return value. expected %zd, got %d\n", len, r);
+ return false;
+ }
+ return true;
+}
+
+
+vrt::quadradio::quadradio(const std::string &ip, size_t rx_bufsize)
+ : d_ctrl_fd(0), d_data_fd(0), d_data_port(0),
+ d_band_select(0), d_rx_antenna(0), d_attenuation0(0), d_attenuation1(0)//d_10dB_atten(true)
+{
+ if (!open(ip.c_str()))
+ throw std::runtime_error("vrt::quadradio: failed to open " + ip + "\n");
+
+ d_rx = vrt::rx::make(data_socket_fd(), rx_bufsize);
+ set_test_signal(VRT_TEST_SIG_NORMAL);
+}
+
+vrt::quadradio::~quadradio()
+{
+ ::close(d_ctrl_fd);
+}
+
+bool
+vrt::quadradio::open(const char *ip)
+{
+ return open_sockets(ip, control_port(),
+ &d_ctrl_fd, &d_ctrl_port_inaddr,
+ &d_data_fd, &d_data_port);
+}
+
+bool
+vrt::quadradio::start_streaming(int samples_per_pkt)
+{
+ return send_rx_command(d_ctrl_fd, true, d_ctrl_port_inaddr,
+ d_data_port, samples_per_pkt, 0);
+}
+
+bool
+vrt::quadradio::stop_streaming()
+{
+ return send_stop_rx_command(d_ctrl_fd);
+}
+
+bool
+vrt::quadradio::set_center_freq(double target_freq){
+ if (target_freq < 700e6) return false;
+ if (target_freq <= 1.0e9) return set_band_select("A");
+ if (target_freq <= 1.5e9) return set_band_select("B");
+ if (target_freq <= 2.2e9) return set_band_select("C");
+ if (target_freq <= 3.0e9) return set_band_select("D");
+ return false;
+}
+
+bool
+vrt::quadradio::set_band_select(const std::string &band){
+ if (band == "A") d_band_select = 3;
+ else if (band == "B") d_band_select = 2;
+ else if (band == "C") d_band_select = 1;
+ else if (band == "D") d_band_select = 0;
+ else return false;
+ update_dboard_pins();
+ return true;
+}
+
+//void
+//vrt::quadradio::set_10dB_atten(bool on){
+// d_10dB_atten = on;
+// update_dboard_pins();
+//}
+
+bool
+vrt::quadradio::select_rx_antenna(const std::string &ant){
+ if (ant == "rf") d_rx_antenna = 0;
+ else if (ant == "cal") d_rx_antenna = 1;
+ else return true;
+ update_dboard_pins();
+ return true;
+}
+
+bool
+vrt::quadradio::set_attenuation0(int attenuation){
+ if (attenuation < 0 || attenuation > 31) return false;
+ d_attenuation0 = attenuation;
+ update_dboard_pins();
+ return true;
+}
+
+bool
+vrt::quadradio::set_attenuation1(int attenuation){
+ if (attenuation < 0 || attenuation > 31) return false;
+ d_attenuation1 = attenuation;
+ update_dboard_pins();
+ return true;
+}
+
+//bit reversal, length in bits
+static int reverse_bits(int input, int len){
+ int reversed = 0;
+ for (int i = 0; i < len; i++){
+ reversed += (input & (1<<i))?(1 << (len-i-1)):0;
+ }
+ return reversed;
+}
+
+void
+vrt::quadradio::update_dboard_pins(void){
+ int db_ctrl = \
+ ((reverse_bits(d_attenuation0, 5) & 0x1f) << 10) | \
+ ((reverse_bits(~d_attenuation1, 5) & 0x1f) << 03) | \
+ ((d_band_select & 0x03) << 01) | \
+ ((d_rx_antenna & 0x01) << 00);
+ set_dboard_pins(ALL_DBOARDS, db_ctrl); // FIXME sets them all
+}
+
+void
+vrt::quadradio::set_adc_gain(bool on){
+ set_hsadc_conf(ALL_DBOARDS, 0x14, on ? 0x90 : 0x80);
+}
+
+void
+vrt::quadradio::set_dc_offset_comp(bool on){
+ if (on) {
+ set_hsadc_conf(ALL_DBOARDS, 0x1B, 0x80);
+ set_hsadc_conf(ALL_DBOARDS, 0x1A, 0x00); //bits 6:4 set time constant
+ }
+ else set_hsadc_conf(ALL_DBOARDS, 0x1B, 0x00);
+}
+
+void
+vrt::quadradio::set_digital_gain(float gain){
+ int gain_q1 = static_cast<int>(round(gain*2.0));
+ set_hsadc_conf(ALL_DBOARDS, 0x17, gain_q1);
+}
+
+void
+vrt::quadradio::set_test_signal(vrt_test_sig_t type){
+ set_hsadc_conf(ALL_DBOARDS, 0x16, type);
+}
+
+bool
+vrt::quadradio::open_sockets(const char *quad_radio_ip, int quad_radio_ctrl_port,
+ int *ctrl_fd_ptr, struct in_addr *ctrl_port_inaddr,
+ int *data_fd_ptr, int *data_port_ptr)
+{
+ int ctrl_fd; // socket for control
+ int data_fd; // socket fd for data
+ int data_port; // our port number
+
+ //
+ // create a udp socket and connect it to the quad radio control port
+ //
+
+ ctrl_fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
+ if (ctrl_fd == -1){
+ perror("socket: ctrl_fd");
+ return false;
+ }
+
+ struct sockaddr_in si_other;
+ memset(&si_other, 0, sizeof(si_other));
+ si_other.sin_family = AF_INET;
+ si_other.sin_port = htons(quad_radio_ctrl_port);
+ if (inet_pton(AF_INET, quad_radio_ip, &si_other.sin_addr) <= 0){
+ perror("inet_pton");
+ return false;
+ }
+
+ if (connect(ctrl_fd, (struct sockaddr *) &si_other, sizeof(si_other)) != 0){
+ perror("connect");
+ return false;
+ }
+
+ // get our ip address associated with the interface connected to the control port
+
+ struct sockaddr_in si_me;
+ memset(&si_me, 0, sizeof(si_me));
+ socklen_t sockname_len = sizeof(si_me);
+ if (getsockname(ctrl_fd, (struct sockaddr *) &si_me, &sockname_len) != 0){
+ perror("getsockname");
+ }
+
+ *ctrl_port_inaddr = si_me.sin_addr;
+
+ if (1){
+ char buf[128];
+ const char *s = inet_ntop(si_me.sin_family, &si_me.sin_addr, buf, sizeof(buf));
+ if (s == 0){
+ perror("inet_ntop");
+ return false;
+ }
+ // printf("our ip addr associated with ctrl port: %s\n", s);
+ }
+
+ //
+ // create a udp socket to use to receive data
+ //
+
+ data_fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
+ if (data_fd == -1){
+ perror("socket: data_fd");
+ return false;
+ }
+
+ // bind it to a local port on the interface that connects to the ctrl port.
+ // FIXME this assumes that interface connected to the control port and the
+ // interface connected to the data port are the same. If we're using
+ // both ethernet ports on the quad radio, this may not be the case.
+
+ data_port = -1;
+ for (int port = MIN_IP_LOCAL_PORT; port <= MAX_IP_LOCAL_PORT; port++){
+ struct sockaddr_in si_me;
+ memset(&si_me, 0, sizeof(si_me));
+ si_me.sin_family = AF_INET;
+ si_me.sin_port = htons(port);
+ si_me.sin_addr.s_addr = htonl(INADDR_ANY);
+
+ if (bind(data_fd, (struct sockaddr *) &si_me, sizeof(si_me)) == 0){ // found one!
+ data_port = port;
+ break;
+ }
+ }
+
+ if (data_port == -1){
+ fprintf(stderr, "failed to bind to a local port\n");
+ return false;
+ }
+
+ // printf("our data port = %d\n", data_port);
+
+ *ctrl_fd_ptr = ctrl_fd;
+ *data_fd_ptr = data_fd;
+ *data_port_ptr = data_port;
+
+ return true;
+}
+
+// ------------------------------------------------------------------------
+
+bool
+vrt::quadradio::send_rx_command(int ctrl_fd, bool start,
+ struct in_addr addr, int data_port,
+ int samples_per_pkt, int siggen_param)
+{
+ uint32_t cmd[7];
+ cmd[0] = htonl(0); // verb: set
+ cmd[1] = htonl(0); // id: rx_streaming
+ cmd[2] = htonl(start ? 1: 0); // start or stop?
+ cmd[3] = addr.s_addr; // ip address to send data to (already network endian)
+ cmd[4] = htonl(data_port); // port to send data to
+ cmd[5] = htonl(samples_per_pkt);
+ cmd[6] = htonl(siggen_param);
+
+ return send_and_check(ctrl_fd, cmd, sizeof(cmd));
+}
+
+bool
+vrt::quadradio::send_stop_rx_command(int ctrl_fd)
+{
+ struct in_addr in_addr;
+ in_addr.s_addr = 0;
+ return send_rx_command(ctrl_fd, false, in_addr, 0, 0, 0);
+}
+
+bool
+vrt::quadradio::set_dboard_pins(int dboard_bitmask, int v)
+{
+ uint32_t cmd[4];
+ cmd[0] = htonl(0); // verb: set
+ cmd[1] = htonl(1); // id: dboard_pins
+ cmd[2] = htonl(dboard_bitmask);
+ cmd[3] = htonl(v); // value
+
+ return send_and_check(d_ctrl_fd, cmd, sizeof(cmd));
+}
+
+bool
+vrt::quadradio::set_setting_reg(int regno, int value)
+{
+ uint32_t cmd[4];
+ cmd[0] = htonl(0); // verb: set
+ cmd[1] = htonl(2); // id: SR
+ cmd[2] = htonl(regno);
+ cmd[3] = htonl(value);
+
+ return send_and_check(d_ctrl_fd, cmd, sizeof(cmd));
+}
+
+bool
+vrt::quadradio::set_hsadc_conf(int dboard_bitmask, int regno, int value)
+{
+ uint32_t cmd[5];
+ cmd[0] = htonl(0); // verb: set
+ cmd[1] = htonl(3); // id: HSADC_CONF
+ cmd[2] = htonl(dboard_bitmask);
+ cmd[3] = htonl(regno);
+ cmd[4] = htonl(value);
+
+ return send_and_check(d_ctrl_fd, cmd, sizeof(cmd));
+}
+
+bool
+vrt::quadradio::set_lsdac(int dboard_bitmask, int which_dac, int value)
+{
+ uint32_t cmd[5];
+ cmd[0] = htonl(0); // verb: set
+ cmd[1] = htonl(4); // id: LSDAC
+ cmd[2] = htonl(dboard_bitmask);
+ cmd[3] = htonl(which_dac);
+ cmd[4] = htonl(value);
+
+ return send_and_check(d_ctrl_fd, cmd, sizeof(cmd));
+}
+
+bool
+vrt::quadradio::set_mem32(int addr, int value)
+{
+ uint32_t cmd[4];
+ cmd[0] = htonl(0); // verb: set
+ cmd[1] = htonl(5); // id: MEM32
+ cmd[2] = htonl(addr);
+ cmd[3] = htonl(value);
+
+ return send_and_check(d_ctrl_fd, cmd, sizeof(cmd));
+}
+
+bool
+vrt::quadradio::set_lo_freq(double freq)
+{
+ uint64_t lo_freq = uint64_t(freq * (uint64_t(1)<<20)); //q20 format
+ uint32_t cmd[4];
+ cmd[0] = htonl(0); // verb: set
+ cmd[1] = htonl(6); // id: lo freq
+ cmd[2] = htonl((lo_freq >> 32) & 0xffffffff);
+ cmd[3] = htonl((lo_freq >> 0) & 0xffffffff);
+
+ return send_and_check(d_ctrl_fd, cmd, sizeof(cmd));
+}
+
+bool
+vrt::quadradio::set_cal_freq(double freq)
+{
+ uint64_t cal_freq = uint64_t(freq * (uint64_t(1)<<20)); //q20 format
+ uint32_t cmd[4];
+ cmd[0] = htonl(0); // verb: set
+ cmd[1] = htonl(7); // id: cal freq
+ cmd[2] = htonl((cal_freq >> 32) & 0xffffffff);
+ cmd[3] = htonl((cal_freq >> 0) & 0xffffffff);
+
+ return send_and_check(d_ctrl_fd, cmd, sizeof(cmd));
+}
+
+bool
+vrt::quadradio::set_beamforming(int32_t gains[8]){
+ uint32_t cmd[2+8];
+ cmd[0] = htonl(0); // verb: set
+ cmd[1] = htonl(8); // id: beamformin
+ for (int i = 0; i < 8; i++){
+ //printf("%d\n", gains[i]);
+ cmd[i+2] = htonl(gains[i]);
+ }
+ return send_and_check(d_ctrl_fd, cmd, sizeof(cmd));
+}
+
--- /dev/null
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <vrt/rx.h>
+#include <vrt/expanded_header.h>
+#include "socket_rx_buffer.h"
+#include "data_handler.h"
+#include <unistd.h>
+#include <stdio.h>
+#include <stdexcept>
+
+static void
+print_words(FILE *fp, size_t offset, uint32_t *buf, size_t n)
+{
+ size_t i;
+ for (i = 0; i < n; i++){
+ if (i % 4 == 0){
+ fprintf(fp, "%04zx:", i);
+ }
+
+ putc(' ', fp);
+ fprintf(fp, "%08x", buf[i]);
+ if (i % 4 == 3)
+ putc('\n', fp);
+ }
+
+ putc('\n', fp);
+}
+
+
+
+namespace vrt {
+
+ rx::sptr
+ rx::make(int socket_fd, size_t rx_bufsize)
+ {
+ return sptr(new rx(socket_fd, rx_bufsize));
+ }
+
+ rx::rx(int socket_fd, size_t rx_bufsize)
+ : d_socket_fd(socket_fd),
+ d_srb(new socket_rx_buffer(socket_fd, rx_bufsize))
+ {
+ }
+
+ rx::~rx()
+ {
+ delete d_srb;
+ ::close(d_socket_fd);
+ }
+
+
+ class vrt_data_handler : public data_handler
+ {
+ rx_packet_handler *d_handler;
+
+ public:
+ vrt_data_handler(rx_packet_handler *handler)
+ : d_handler(handler){}
+
+ ~vrt_data_handler();
+
+ result operator()(const void *base, size_t len);
+ };
+
+ vrt_data_handler::~vrt_data_handler(){}
+
+ data_handler::result
+ vrt_data_handler::operator()(const void *base, size_t len)
+ {
+#if 0
+ print_words(0, (uint32_t *)base, len/(sizeof(uint32_t)));
+ return 0;
+#else
+ const uint32_t *payload;
+ size_t n32_bit_words;
+ expanded_header hdr;
+ if (!expanded_header::parse((const uint32_t*) base, len/(sizeof(uint32_t)),
+ &hdr, &payload, &n32_bit_words)){
+ if (1){
+ fprintf(stderr, "vrt_data_handler: malformed VRT packet!\n");
+ print_words(stderr, 0, (uint32_t *)base, len/(sizeof(uint32_t)));
+ }
+ return 0;
+ }
+ bool want_more = (*d_handler)(payload, n32_bit_words, &hdr);
+ return !want_more ? data_handler::DONE : 0;
+#endif
+ }
+
+
+ bool
+ rx::rx_packets(rx_packet_handler *handler, bool dont_wait)
+ {
+ vrt_data_handler h(handler);
+ socket_rx_buffer::result r = d_srb->rx_frames(&h, dont_wait ? 0 : -1);
+ return r == socket_rx_buffer::EB_OK || r == socket_rx_buffer::EB_WOULD_BLOCK;
+ }
+
+}; // vrt
--- /dev/null
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <vrt/rx_packet_handler.h>
+
+namespace vrt {
+
+ rx_packet_handler::~rx_packet_handler(){}
+
+ // default operator is a NOP
+ bool
+ rx_packet_handler::operator()(const uint32_t *payload,
+ size_t n32_bit_words,
+ const expanded_header *hdr)
+ {
+ return true;
+ }
+
+
+}; // vrt
--- /dev/null
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "socket_rx_buffer.h"
+#include "data_handler.h"
+#include <linux/if_packet.h>
+#include <sys/socket.h>
+#include <sys/mman.h>
+#include <sys/poll.h>
+#include <iostream>
+#include <cmath>
+#include <errno.h>
+#include <stdexcept>
+#include <string.h>
+#include <fcntl.h>
+#include <cstdio>
+
+
+#define SOCKET_RX_BUFFER_DEBUG 1 // define to 0 or 1
+#if SOCKET_RX_BUFFER_DEBUG
+#define DEBUG_LOG(x) ::write(2, (x), 1)
+#else
+#define DEBUG_LOG(X)
+#endif
+
+#define DEFAULT_MEM_SIZE 62.5e6 // ~0.5s @ 125 MB/s
+#define MAX_MEM_SIZE 1000e6 // ~10.00s @ 100 MB/s.
+#define MAX_SLAB_SIZE 131072 // 128 KB (FIXME fish out of /proc/slabinfo)
+
+
+namespace vrt {
+
+ const unsigned int socket_rx_buffer::MAX_PKTLEN = 8192;
+ const unsigned int socket_rx_buffer::MIN_PKTLEN = 64;
+
+ socket_rx_buffer::socket_rx_buffer(int socket_fd, size_t rx_bufsize)
+ : d_fd(socket_fd), d_using_tpring(false), d_buflen(0), d_buf(0), d_frame_nr(0),
+ d_frame_size(0), d_head(0), d_ring(0)
+ {
+ if (rx_bufsize == 0)
+ d_buflen = (size_t)DEFAULT_MEM_SIZE;
+ else
+ d_buflen = std::min((size_t)MAX_MEM_SIZE, rx_bufsize);
+
+ if (!open()){
+ throw std::runtime_error("socket_rx_buffer::open failed");
+ }
+ }
+
+ socket_rx_buffer::~socket_rx_buffer()
+ {
+ close();
+ }
+
+ bool
+ socket_rx_buffer::open()
+ {
+ if (try_packet_ring()){
+ d_using_tpring = true;
+ // fprintf(stderr, "socket_rx_buffer: using memory mapped interface\n");
+ }
+ else {
+ d_using_tpring = false;
+ // fprintf(stderr, "socket_rx_buffer: NOT using memory mapped interface\n");
+
+ // Increase socket buffer if possible
+
+ int rcvbuf_size = d_buflen;
+#if defined(SO_RCVBUFFORCE)
+ if (setsockopt(d_fd, SOL_SOCKET, SO_RCVBUFFORCE, &rcvbuf_size, sizeof(rcvbuf_size)) != 0){
+ perror("setsockopt(SO_RCVBUFFORCE)");
+ fprintf(stderr, "Are you running as root? If not, please do.\n");
+ }
+ else {
+ fprintf(stderr, "SO_RCVBUFFORCE = %zd\n", d_buflen);
+ }
+#endif
+ }
+
+ return true;
+ }
+
+ bool
+ socket_rx_buffer::try_packet_ring()
+ {
+ struct tpacket_req req;
+ size_t page_size = getpagesize();
+
+ // Calculate minimum power-of-two aligned size for frames
+ req.tp_frame_size =
+ (unsigned int)rint(pow(2, ceil(log2(TPACKET_ALIGN(TPACKET_HDRLEN)+TPACKET_ALIGN(MAX_PKTLEN)))));
+ d_frame_size = req.tp_frame_size;
+
+ // Calculate minimum contiguous pages needed to enclose a frame
+ int npages = (page_size > req.tp_frame_size) ? 1 : ((req.tp_frame_size+page_size-1)/page_size);
+ req.tp_block_size = page_size << (int)ceil(log2(npages));
+
+ // Calculate number of blocks
+ req.tp_block_nr = (int)(d_buflen/req.tp_block_size);
+
+
+ // Recalculate buffer length
+ d_buflen = req.tp_block_nr*req.tp_block_size;
+
+ // Finally, calculate total number of frames. Since frames, blocks,
+ // and pages are all power-of-two aligned, frames are contiguous
+ req.tp_frame_nr = d_buflen/req.tp_frame_size;
+ d_frame_nr = req.tp_frame_nr;
+
+#if 0
+ if (SOCKET_RX_BUFFER_DEBUG)
+ std::cerr << "socket_rx_buffer:"
+ << " frame_size=" << req.tp_frame_size
+ << " block_size=" << req.tp_block_size
+ << " block_nr=" << req.tp_block_nr
+ << " frame_nr=" << req.tp_frame_nr
+ << " buflen=" << d_buflen
+ << std::endl;
+#endif
+
+ // Try to get kernel shared memory buffer
+ if (setsockopt(d_fd, SOL_PACKET, PACKET_RX_RING, (void *)&req, sizeof(req)) != 0){
+ // perror("socket_rx_buffer: setsockopt");
+ return false;
+ }
+
+ void *p = mmap(0, d_buflen, PROT_READ|PROT_WRITE, MAP_SHARED, d_fd, 0);
+ if (p == MAP_FAILED){
+ perror("socket_rx_buffer: mmap");
+ return false;
+ }
+ d_buf = (uint8_t *) p;
+
+ // Initialize our pointers into the packet ring
+ d_ring.resize(req.tp_frame_nr);
+ for (unsigned int i=0; i < req.tp_frame_nr; i++)
+ d_ring[i] = (uint8_t *)(d_buf+i*req.tp_frame_size);
+
+ return true;
+ }
+
+ bool
+ socket_rx_buffer::close()
+ {
+ return true;
+ }
+
+ inline bool
+ socket_rx_buffer::frame_available()
+ {
+ return (((tpacket_hdr *)d_ring[d_head])->tp_status != TP_STATUS_KERNEL);
+ }
+
+ socket_rx_buffer::result
+ socket_rx_buffer::rx_frames(data_handler *f, int timeout_in_ms)
+ {
+ if (!d_using_tpring){
+
+ // ----------------------------------------------------------------
+ // Use recv instead of kernel Rx packet ring
+ // ----------------------------------------------------------------
+
+ unsigned char buf[MAX_PKTLEN];
+ bool dont_wait = timeout_in_ms == 0; // FIXME treating timeout as 0 or inf
+ int flags = dont_wait ? MSG_DONTWAIT : 0;
+
+ ssize_t rr = recv(d_fd, buf, sizeof(buf), flags);
+ if (rr == -1){ // error?
+ if (errno == EAGAIN){ // non-blocking, nothing there
+ return EB_WOULD_BLOCK;
+ }
+ perror("rx_frames: recv");
+ return EB_ERROR;
+ }
+
+ // Got first packet. Call handler
+
+ data_handler::result r = (*f)(buf, rr);
+ if (r & data_handler::DONE)
+ return EB_OK;
+
+ // Now do as many as we can without blocking
+
+ while (1){
+ rr = recv(d_fd, buf, sizeof(buf), MSG_DONTWAIT);
+ if (rr == -1){ // error?
+ if (errno == EAGAIN) // non-blocking, nothing there
+ return EB_OK; // return OK; we've processed >= 1 packets
+ perror("rx_frames: recv");
+ return EB_ERROR;
+ }
+
+ r = (*f)(buf, rr);
+ if (r & data_handler::DONE)
+ break;
+ }
+ return EB_OK;
+ }
+
+ // ----------------------------------------------------------------
+ // Use kernel Rx packet ring
+ // ----------------------------------------------------------------
+
+ DEBUG_LOG("\n");
+
+ while (!frame_available()) {
+ if (timeout_in_ms == 0) {
+ DEBUG_LOG("w");
+ return EB_WOULD_BLOCK;
+ }
+
+ struct pollfd pfd;
+ pfd.fd = d_fd;
+ pfd.revents = 0;
+ pfd.events = POLLIN;
+
+ // DEBUG_LOG("P");
+
+ int pres = poll(&pfd, 1, timeout_in_ms);
+ if (pres == -1) {
+ perror("poll");
+ return EB_ERROR;
+ }
+
+ if (pres == 0) {
+ DEBUG_LOG("t");
+ return EB_TIMED_OUT;
+ }
+ }
+
+ // Iterate through available packets
+ while (frame_available()) {
+ // Get start of ethernet frame and length
+ tpacket_hdr *hdr = (tpacket_hdr *)d_ring[d_head];
+ void *base = (uint8_t *)hdr+hdr->tp_mac;
+ size_t len = hdr->tp_len;
+
+ if (1)
+ fprintf(stderr, "socket_rx_buffer: base = %p tp_mac = %3d tp_net = %3d\n",
+ base, hdr->tp_mac, hdr->tp_net);
+
+ // Invoke data handler
+ data_handler::result r = (*f)(base, len);
+ hdr->tp_status = TP_STATUS_KERNEL; // mark it free
+
+ inc_head();
+
+ if (r & data_handler::DONE)
+ break;
+ }
+
+ DEBUG_LOG("|");
+ return EB_OK;
+ }
+
+} // namespace vrt
--- /dev/null
+/* -*- c++ -*- */
+/*
+ * Copyright 2008,2009 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef INCLUDED_VRT_SOCKET_RX_BUFFER_H
+#define INCLUDED_VRT_SOCKET_RX_BUFFER_H
+
+#include <boost/utility.hpp>
+#include <vector>
+#include <memory>
+#include <stdint.h>
+
+namespace vrt {
+
+ class data_handler;
+
+ /*!
+ * \brief high-performance interface to receive datagrams
+ *
+ * On many systems it should be possible to implement this on top of libpcap
+ *
+ * \internal
+ */
+ class socket_rx_buffer : boost::noncopyable
+ {
+
+ int d_fd; // socket file descriptor
+ bool d_using_tpring; // using kernel mapped packet ring
+ size_t d_buflen; // length of our buffer
+ uint8_t *d_buf; // packet ring
+ unsigned int d_frame_nr; // max frames on ring
+ size_t d_frame_size; // frame storage size
+ unsigned int d_head; // pointer to next frame
+
+ std::vector<uint8_t *> d_ring; // pointers into buffer
+
+ bool frame_available();
+
+ void inc_head()
+ {
+ if (d_head + 1 >= d_frame_nr)
+ d_head = 0;
+ else
+ d_head = d_head + 1;
+ }
+
+ bool open();
+ bool close();
+ bool try_packet_ring();
+
+ public:
+
+ enum result {
+ EB_OK, //< everything's fine
+ EB_ERROR, //< A non-recoverable error occurred
+ EB_WOULD_BLOCK, //< A timeout of 0 was specified and nothing was ready
+ EB_TIMED_OUT, //< The timeout expired before anything was ready
+ };
+
+ static const unsigned int MAX_PKTLEN;
+ static const unsigned int MIN_PKTLEN;
+
+ /*!
+ * \param socket_fd file descriptor that corresponds to a socket
+ * \param rx_bufsize is a hint as to the number of bytes of memory
+ * to allocate for received ethernet frames (0 -> reasonable default)
+ */
+ socket_rx_buffer(int socket_fd, size_t rx_bufsize = 0);
+ ~socket_rx_buffer();
+
+ /*!
+ * \brief Call \p f for each frame in the receive buffer.
+ * \param f is the frame data handler
+ * \param timeout (in ms) controls behavior when there are no frames to read
+ *
+ * If \p timeout is 0, rx_frames will not wait for frames if none are
+ * available, and f will not be invoked. If \p timeout is -1 (the
+ * default), rx_frames will block indefinitely until frames are
+ * available. If \p timeout is positive, it indicates the number of
+ * milliseconds to wait for a frame to become available. Once the
+ * timeout has expired, rx_frames will return, f never having been
+ * invoked.
+ *
+ * \p f will be called on each frame that is available.
+ * \p f returns a bit mask with one of the following set or cleared:
+ *
+ * data_handler::DONE - return from rx_frames now even though more frames
+ * might be available; otherwise continue if more
+ * frames are ready.
+ *
+ * \returns EB_OK if at least one frame was received
+ * \returns EB_WOULD_BLOCK if \p timeout is 0 and the call would have blocked
+ * \returns EB_TIMED_OUT if timeout occurred
+ * \returns EB_ERROR if there was an unrecoverable error.
+ */
+ result rx_frames(data_handler *f, int timeout=-1);
+
+ /*
+ * \brief Returns maximum possible number of frames in buffer
+ */
+ unsigned int max_frames() const { return d_using_tpring ? d_frame_nr : 0; }
+ };
+
+}; // namespace vrt
+
+#endif /* INCLUDED_VRT_SOCKET_RX_BUFFER_H */
--- /dev/null
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: vrt
+Description: Host implementation of Virtual Radio Transport (VITA-49)
+Requires:
+Version: @VERSION@
+Libs: -L${libdir} -lvrt
+Cflags: -I${includedir}