Merge branch 'patches/marcus/fftw'
authorJohnathan Corgan <jcorgan@corganenterprises.com>
Tue, 22 Jun 2010 14:18:47 +0000 (07:18 -0700)
committerJohnathan Corgan <jcorgan@corganenterprises.com>
Tue, 22 Jun 2010 14:18:47 +0000 (07:18 -0700)
* patches/marcus/fftw:
  gnuradio-core: allows configuring FFTW to use ESTIMATE vs. MEASURE

161 files changed:
Makefile.common
config/Makefile.am
config/gr_git.m4
config/gr_version.m4
config/grc_vrt.m4 [deleted file]
configure.ac
gcell/gcell.pc.in
gcell/lib/Makefile.am
gnuradio-core/gnuradio-core.pc.in
gnuradio-core/src/gen_interpolator_taps/Makefile.am
gnuradio-core/src/lib/Makefile.am
gnuradio-core/src/lib/general/Makefile.am
gnuradio-core/src/lib/general/general.i
gnuradio-core/src/lib/general/gr_dd_mpsk_sync_cc.cc [deleted file]
gnuradio-core/src/lib/general/gr_dd_mpsk_sync_cc.h [deleted file]
gnuradio-core/src/lib/general/gr_dd_mpsk_sync_cc.i [deleted file]
gnuradio-core/src/lib/io/gr_udp_sink.cc
gnuradio-core/src/lib/io/gr_udp_sink.h
gnuradio-core/src/lib/io/gr_udp_sink.i
gnuradio-core/src/lib/io/gr_udp_source.cc
gnuradio-core/src/lib/io/gr_udp_source.h
gnuradio-core/src/lib/io/gr_udp_source.i
gnuradio-core/src/python/gnuradio/gr/Makefile.am
gnuradio-core/src/python/gnuradio/gr/qa_udp_sink_source.py [new file with mode: 0755]
gnuradio-examples/python/network/audio_sink.py
gnuradio-examples/python/network/audio_source.py
gnuradio-examples/python/network/dial_tone_sink.py
gnuradio-examples/python/network/dial_tone_source.py
gnuradio-examples/python/network/vector_sink.py
gnuradio-examples/python/network/vector_source.py
gr-atsc/gnuradio-atsc.pc.in
gr-atsc/src/lib/Makefile.am
gr-audio-alsa/gnuradio-audio-alsa.pc.in
gr-audio-alsa/src/Makefile.am
gr-audio-jack/gnuradio-audio-jack.pc.in
gr-audio-jack/src/Makefile.am
gr-audio-oss/gnuradio-audio-oss.pc.in
gr-audio-oss/src/Makefile.am
gr-audio-osx/src/Makefile.am
gr-audio-portaudio/gnuradio-audio-portaudio.pc.in
gr-audio-portaudio/src/Makefile.am
gr-audio-windows/src/Makefile.am
gr-comedi/gnuradio-comedi.pc.in
gr-comedi/src/Makefile.am
gr-cvsd-vocoder/gnuradio-cvsd-vocoder.pc.in
gr-cvsd-vocoder/src/lib/Makefile.am
gr-gcell/src/Makefile.am
gr-gsm-fr-vocoder/gnuradio-gsm-fr-vocoder.pc.in
gr-gsm-fr-vocoder/src/lib/Makefile.am
gr-howto-write-a-block/Makefile.common
gr-howto-write-a-block/config.guess
gr-howto-write-a-block/config.sub
gr-howto-write-a-block/config/gr_git.m4
gr-howto-write-a-block/config/gr_version.m4
gr-howto-write-a-block/lib/Makefile.am
gr-howto-write-a-block/python/run_tests.in
gr-howto-write-a-block/version.sh
gr-msdd6000/gnuradio-msdd6000.pc.in
gr-msdd6000/src/Makefile.am
gr-noaa/lib/Makefile.am
gr-pager/gnuradio-pager.pc.in
gr-pager/lib/Makefile.am
gr-qtgui/src/lib/Makefile.am
gr-qtgui/src/lib/waterfallGlobalData.h
gr-trellis/gnuradio-trellis.pc.in
gr-trellis/src/lib/Makefile.am
gr-usrp/gnuradio-usrp.pc.in
gr-usrp/src/Makefile.am
gr-usrp2/gnuradio-usrp2.pc.in
gr-usrp2/src/Makefile.am
gr-usrp2/src/usrp2.i
gr-usrp2/src/usrp2_sink_16sc.cc
gr-usrp2/src/usrp2_sink_32fc.cc
gr-usrp2/src/usrp2_sink_base.cc
gr-usrp2/src/usrp2_sink_base.h
gr-video-sdl/gnuradio-video-sdl.pc.in
gr-video-sdl/src/Makefile.am
gr-wxgui/gr-wxgui.pc.in
gr-wxgui/src/python/constants.py
gr-wxgui/src/python/fft_window.py
gr-wxgui/src/python/fftsink_gl.py
gr-wxgui/src/python/fftsink_nongl.py
gr-wxgui/src/python/plot.py
gr-wxgui/src/python/plotter/channel_plotter.py
gr-wxgui/src/python/plotter/plotter_base.py
gr-wxgui/src/python/scope_window.py
gr-wxgui/src/python/scopesink_gl.py
grc/blocks/Makefile.am
grc/blocks/block_tree.xml
grc/blocks/gr_and_const_xx.xml [new file with mode: 0644]
grc/blocks/gr_dd_mpsk_sync_cc.xml [deleted file]
grc/blocks/gr_udp_sink.xml
grc/blocks/gr_udp_source.xml
grc/blocks/usrp2_sink_xxxx.xml
grc/blocks/usrp2_source_xxxx.xml
grc/blocks/variable_config.xml
grc/freedesktop/Makefile.am
grc/freedesktop/gnuradio-gnuradio-companion.desktop [new file with mode: 0644]
grc/freedesktop/gnuradio-grc.desktop [deleted file]
grc/freedesktop/grc_setup_freedesktop.in
grc/scripts/Makefile.am
grc/scripts/gnuradio-companion [new file with mode: 0755]
grc/scripts/grc [deleted file]
gruel/gruel.pc.in
gruel/src/lib/Makefile.am
usrp/firmware/src/common/build_eeprom.py
usrp/host/apps/burn-db-eeprom
usrp/host/include/usrp/Makefile.am
usrp/host/include/usrp/db_bitshark_rx.h [new file with mode: 0644]
usrp/host/include/usrp/db_flexrf.h
usrp/host/include/usrp/db_wbxng.h
usrp/host/lib/Makefile.am
usrp/host/lib/db_base.cc
usrp/host/lib/db_bitshark_rx.cc [new file with mode: 0644]
usrp/host/lib/db_boards.cc
usrp/host/lib/db_flexrf.cc
usrp/host/lib/db_wbxng.cc
usrp/host/lib/db_wbxng_adf4350.cc
usrp/host/lib/db_wbxng_adf4350.h
usrp/host/lib/db_wbxng_adf4350_regs.cc
usrp/host/lib/db_wbxng_adf4350_regs.h
usrp/host/lib/usrp_dbid.dat
usrp/usrp.pc.in
usrp2/firmware/apps/Makefile.am
usrp2/firmware/include/usrp2_types.h
usrp2/firmware/lib/Makefile.am
usrp2/firmware/lib/db_bitshark_rx.c [new file with mode: 0644]
usrp2/firmware/lib/db_bitshark_rx.h [new file with mode: 0644]
usrp2/firmware/lib/db_init.c
usrp2/firmware/lib/db_rfx.c
usrp2/host/include/usrp2/usrp2.h
usrp2/host/lib/Makefile.am
usrp2/host/usrp2.pc.in
version.sh
vrt/.gitignore [deleted file]
vrt/Makefile.am [deleted file]
vrt/apps/.gitignore [deleted file]
vrt/apps/Makefile.am [deleted file]
vrt/include/Makefile.am [deleted file]
vrt/include/vrt/Makefile.am [deleted file]
vrt/include/vrt/bits.h [deleted file]
vrt/include/vrt/copiers.h [deleted file]
vrt/include/vrt/expanded_header.h [deleted file]
vrt/include/vrt/rx.h [deleted file]
vrt/include/vrt/rx_packet_handler.h [deleted file]
vrt/include/vrt/types.h [deleted file]
vrt/lib/.gitignore [deleted file]
vrt/lib/Makefile.am [deleted file]
vrt/lib/copiers.cc [deleted file]
vrt/lib/data_handler.cc [deleted file]
vrt/lib/data_handler.h [deleted file]
vrt/lib/expanded_header.cc [deleted file]
vrt/lib/expanded_header_parse_switch_body.h [deleted file]
vrt/lib/expanded_header_unparse_switch_body.h [deleted file]
vrt/lib/gen_parse_switch_body.py [deleted file]
vrt/lib/gen_unparse_switch_body.py [deleted file]
vrt/lib/rx.cc [deleted file]
vrt/lib/rx_packet_handler.cc [deleted file]
vrt/lib/socket_rx_buffer.cc [deleted file]
vrt/lib/socket_rx_buffer.h [deleted file]
vrt/vrt.pc.in [deleted file]

index aafe85fe791d3bc5909544ece85e76598cda11b8..fb83b9470d3640ed5793c2a5c378708d6448f6ba 100644 (file)
@@ -23,6 +23,9 @@
 AM_CFLAGS = @autoconf_default_CFLAGS@ @lf_CFLAGS@
 AM_CXXFLAGS = @autoconf_default_CXXFLAGS@ @lf_CXXFLAGS@
 
+# Sets ABI version in SONAME and appends -LIBVER to filename
+LTVERSIONFLAGS = -version-info 0:0:0 -release $(LIBVER)
+
 # includes
 grincludedir = $(includedir)/gnuradio
 
index 959b8f014b00e5e4cca53a300763cb82fc8188b5..4dc7216f1424491c2ef4883ccd456f07dc10c4f4 100644 (file)
@@ -70,7 +70,6 @@ m4macros = \
        grc_gr_video_sdl.m4 \
        grc_gr_wxgui.m4 \
        grc_gruel.m4 \
-       grc_vrt.m4 \
        gr_check_createfilemapping.m4 \
        gr_check_mc4020.m4 \
        gr_check_shm_open.m4 \
index e274607137fcfea6a8ea63fc82321569e52b9ea4..c4f1ea0c027eb532f55abc2f98e142c80acbea5c 100644 (file)
@@ -1,4 +1,4 @@
-dnl Copyright 2009 Free Software Foundation, Inc.
+dnl Copyright 2009,2010 Free Software Foundation, Inc.
 dnl 
 dnl This file is part of GNU Radio
 dnl 
@@ -29,14 +29,35 @@ AC_DEFUN([GR_GIT],[
       AC_MSG_RESULT([ok])
       AC_MSG_CHECKING([git description of current commit])
       if (cd $srcdir && $GIT describe >/dev/null 2>&1); then
-        GIT_VERSION=`cd $srcdir && $GIT describe --abbrev=8 | cut -f 2- -d '-'`
-        AC_MSG_RESULT([$GIT_DESCRIBE])
+        GIT_DESCRIBE=`cd $srcdir && $GIT describe --abbrev=8 --long`
+        # Release candidate tags create an extra -rcX field
+       case $GIT_DESCRIBE in
+         *-*-*-*)
+           GIT_TAG=`echo $GIT_DESCRIBE | cut -f -2 -d '-'`
+           GIT_SEQNO=`echo $GIT_DESCRIBE | cut -f 3 -d '-'`
+           GIT_COMMIT=`echo $GIT_DESCRIBE | cut -f 4 -d '-' | cut -f 2- -d 'g'`
+           ;;
+         *-*-*)
+           GIT_TAG=`echo $GIT_DESCRIBE | cut -f 1 -d '-'`
+           GIT_SEQNO=`echo $GIT_DESCRIBE | cut -f 2 -d '-'`
+           GIT_COMMIT=`echo $GIT_DESCRIBE | cut -f 3 -d '-' | cut -f 2- -d 'g'`
+           ;;
+       esac
+
+       AC_MSG_RESULT([$GIT_DESCRIBE])
       else
-        AC_MSG_RESULT([unable to find, using current commit])
-       GIT_VERSION=`cd $srcdir && $GIT describe --always --abbrev=8`
+        AC_MSG_RESULT([no tag in history, using current commit])
+       GIT_TAG=''
+       GIT_SEQNO=''
+       GIT_COMMIT=`cd $srcdir && $GIT describe --always --abbrev=8`
       fi
     else
       AC_MSG_RESULT([not found])
     fi
+
+    AC_SUBST([GIT_DESCRIBE])
+    AC_SUBST([GIT_TAG])
+    AC_SUBST([GIT_SEQNO])
+    AC_SUBST([GIT_COMMIT])
   fi
 ])
index 489f780345f4b289e48fa3efa74ceb1a3f38a0b3..a7a202238dc0559050d4bf4eabe18c6ed39c9060 100644 (file)
@@ -1,4 +1,4 @@
-dnl Copyright 2009 Free Software Foundation, Inc.
+dnl Copyright 2009,2010 Free Software Foundation, Inc.
 dnl 
 dnl This file is part of GNU Radio
 dnl 
@@ -31,39 +31,43 @@ AC_DEFUN([GR_VERSION],[
   dnl The last two fields can have 'git' instead of a number to indicate
   dnl that this branch is between versions.
   . $srcdir/version.sh
-  RELEASE=$MAJOR_VERSION.$API_COMPAT
   
   dnl Get git version if available
   GR_GIT
 
   dnl Test if we should use git version
   if test "$MINOR_VERSION" == "git"; then
-    dnl 3.3git-xxx-gxxxxxxxx
-    RELEASE=$RELEASE$MINOR_VERSION
-    DOCVER=$RELEASE
-    if test "$GIT_VERSION" != "" ; then
-      RELEASE=$RELEASE-$GIT_VERSION
-    fi
+    dnl RELEASE: 3.3git-xxx-gxxxxxxxx
+    dnl DOCVER:  3.3git
+    dnl LIBVER:  3.3git
+    RELEASE=$GIT_DESCRIBE
+    DOCVER=$MAJOR_VERSION.$API_COMPAT$MINOR_VERSION
+    LIBVER=$MAJOR_VERSION.$API_COMPAT$MINOR_VERSION
   else
     if test "$MAINT_VERSION" == "git" ; then
-      dnl 3.3.1git-xxx-gxxxxxxxx
-      RELEASE=$RELEASE.$MINOR_VERSION$MAINT_VERSION
-      DOCVER=$RELEASE
-      if test "$GIT_VERSION" != "" ; then
-        RELEASE=$RELEASE-$GIT_VERSION
-      fi
+      dnl RELEASE: 3.3.1git-xxx-gxxxxxxxx
+      dnl DOCVER:  3.3.1git
+      dnl LIBVER:  3.3.1git
+      RELEASE=$GIT_DESCRIBE
+      DOCVER=$MAJOR_VERSION.$API_COMPAT.$MINOR_VERSION$MAINT_VERSION
+      LIBVER=$MAJOR_VERSION.$API_COMPAT.$MINOR_VERSION$MAINT_VERSION
     else
       dnl This is a numbered release.
-      RELEASE=$RELEASE.$MINOR_VERSION
+      dnl RELEASE: 3.3.1{.x}
+      dnl DOCVER:  3.3.1{.x}
+      dnl LIBVER:  3.3.1{.x}
+      RELEASE=$MAJOR_VERSION.$API_COMPAT.$MINOR_VERSION
       if test "$MAINT_VERSION" != "0"; then
         RELEASE=$RELEASE.$MAINT_VERSION
       fi
 
       DOCVER=$RELEASE
+      LIBVER=$RELEASE
     fi
   fi
 
   AC_MSG_NOTICE([GNU Radio Release $RELEASE])
   AC_SUBST(RELEASE)
   AC_SUBST(DOCVER)
+  AC_SUBST(LIBVER)
 ])
diff --git a/config/grc_vrt.m4 b/config/grc_vrt.m4
deleted file mode 100644 (file)
index 982c886..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-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)
-])
index a170933858129292469d33c743192dabc54b2248..19d19317218c7366865758538fba9805448d3e43 100644 (file)
@@ -124,7 +124,7 @@ dnl AC_DISABLE_SHARED       dnl don't build shared libraries
 AC_ENABLE_SHARED       dnl do build shared libraries
 AC_DISABLE_STATIC      dnl don't build static libraries
 m4_ifdef([LT_INIT],[LT_INIT],[AC_PROG_LIBTOOL])
-GR_FORTRAN
+dnl GR_FORTRAN
 
 GR_NO_UNDEFINED                dnl do we need the -no-undefined linker flag
 GR_SCRIPTING
@@ -170,9 +170,9 @@ AC_HEADER_SYS_WAIT
 AC_CHECK_HEADERS(fcntl.h limits.h strings.h time.h sys/ioctl.h sys/time.h unistd.h)
 AC_CHECK_HEADERS(linux/ppdev.h dev/ppbus/ppi.h sys/mman.h sys/select.h sys/types.h)
 AC_CHECK_HEADERS(sys/resource.h stdint.h sched.h signal.h sys/syscall.h malloc.h)
-AC_CHECK_HEADERS(netinet/in.h)
 AC_CHECK_HEADERS(windows.h)
 AC_CHECK_HEADERS(vec_types.h)
+AC_CHECK_HEADERS(netdb.h netinet/in.h arpa/inet.h sys/types.h sys/socket.h)
 
 dnl Checks for typedefs, structures, and compiler characteristics.
 AC_C_CONST
@@ -293,7 +293,7 @@ dnl AX_BOOST_TEST_EXEC_MONITOR
 dnl AX_BOOST_UNIT_TEST_FRAMEWORK
 dnl AX_BOOST_WSERIALIZATION
 
-BUILD_DATE=`date -R -u`
+BUILD_DATE=`date -u +"%a, %d %b %Y %R:%S"`
 AC_SUBST(BUILD_DATE)
 
 dnl SYSCONFDIR substitution
@@ -340,7 +340,6 @@ GRC_GCELL
 GRC_GNURADIO_CORE
 GRC_USRP
 GRC_USRP2
-GRC_VRT
 GRC_GR_USRP                    dnl this must come after GRC_USRP
 GRC_GR_USRP2
 GRC_GR_GCELL                   dnl this must come after GRC_GCELL and GRC_GNURADIO_CORE
index e602ff7c39e0505c7832e5d7c452c34abd142222..1a3cd9c26acffb84084bc214a5f770fb69a9e4fc 100644 (file)
@@ -7,6 +7,6 @@ gcell_embedspu_libtool=@bindir@/gcell-embedspu-libtool
 Name: gcell
 Description: The GNU Radio SPE scheduler and RPC mechanism
 Requires:
-Version: @VERSION@
+Version: @LIBVER@
 Libs: -L${libdir} -lgcell
 Cflags: -I${includedir} @DEFINES@
index fa9c4a0031de656aaffee1b049d10a7644f1946b..7a727ea84739a1d28d21a02f7bdcec9733c96398 100644 (file)
@@ -27,10 +27,10 @@ SUBDIRS = spu runtime general wrapper .
 lib_LTLIBRARIES = libgcell.la libgcell-qa.la
 
 libgcell_la_SOURCES = 
-libgcell_la_LDFLAGS = $(NO_UNDEFINED) -version-info 0:0:0
+libgcell_la_LDFLAGS = $(NO_UNDEFINED) $(LTVERSIONFLAGS)
 
 libgcell_qa_la_SOURCES = 
-libgcell_qa_la_LDFLAGS = $(NO_UNDEFINED) -version-info 0:0:0
+libgcell_qa_la_LDFLAGS = $(NO_UNDEFINED) $(LTVERSIONFLAGS)
 
 libgcell_la_LIBADD = \
        runtime/libruntime.la \
@@ -42,9 +42,3 @@ libgcell_qa_la_LIBADD = \
        runtime/libruntime-qa.la \
        wrapper/libwrapper-qa.la \
        $(CPPUNIT_LIBS)
-
-
-
-
-
-
index 9ff835041174bf0a19b1bf700639b99689eaabad..5d743a4e9096929040c4d1f5943d7375616afa7c 100644 (file)
@@ -6,7 +6,7 @@ includedir=@includedir@/gnuradio
 Name: gnuradio-core
 Description: GNU Software Radio toolkit
 Requires: gruel fftw3f gsl
-Version: @VERSION@
+Version: @LIBVER@
 Libs.private: @BOOST_LDFLAGS@ @BOOST_THREAD_LIB@ @BOOST_DATE_TIME_LIB@
 Libs: -L${libdir} -lgnuradio-core
 Cflags: @BOOST_CPPFLAGS@ @BOOST_CXXFLAGS@ -I${includedir}
index 5f3a6cb25401e7380b244ebdbbf3615c3a63ed4b..d244e7f5468a7e5e77618b3efc0cb809acdab317 100644 (file)
 
 include $(top_srcdir)/Makefile.common
 
-EXTRA_DIST                     = praxis.txt simpson.h
+EXTRA_DIST                     = praxis.txt simpson.h objective_fct.c gen_interpolator_taps.c simpson.c praxis.f
 
-if ENABLE_FORTRAN
-noinst_PROGRAMS                        = gen_interpolator_taps
-noinst_HEADERS                 = simpson.h
-
-gen_interpolator_taps_SOURCES  = gen_interpolator_taps.c objective_fct.c simpson.c praxis.f
-gen_interpolator_taps_LDADD    = $(FLIBS) -lm
-
-endif
+if ENABLE_FORTRAN
+# noinst_PROGRAMS                      = gen_interpolator_taps
+# noinst_HEADERS                       = simpson.h
+# 
+# gen_interpolator_taps_SOURCES        = gen_interpolator_taps.c objective_fct.c simpson.c praxis.f
+# gen_interpolator_taps_LDADD  = $(FLIBS) -lm
+#
+endif
index 477ba67259a036c022f870838c8a1afc42f2f998..f3a3accdb2f4ef9f762f8c7945ddeb47aae64dce 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright 2001,2004,2009 Free Software Foundation, Inc.
+# Copyright 2001,2004,2009,2010 Free Software Foundation, Inc.
 # 
 # This file is part of GNU Radio
 # 
@@ -33,10 +33,11 @@ AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(CPPUNIT_INCLUDES) $(WITH_INCLUDES)
 
 # generate libgnuradio-core.la from the convenience libraries in subdirs
 
-lib_LTLIBRARIES = libgnuradio-core.la libgnuradio-core-qa.la
+lib_LTLIBRARIES = libgnuradio-core.la
+noinst_LTLIBRARIES = libgnuradio-core-qa.la
 
 libgnuradio_core_la_SOURCES = bug_work_around_6.cc
-libgnuradio_core_la_LDFLAGS = $(NO_UNDEFINED) -version-info 0:0:0
+libgnuradio_core_la_LDFLAGS = $(NO_UNDEFINED) $(LTVERSIONFLAGS)
 
 libgnuradio_core_qa_la_SOURCES = bug_work_around_6.cc
 libgnuradio_core_qa_la_LDFLAGS = $(NO_UNDEFINED) -version-info 0:0:0 \
@@ -68,4 +69,4 @@ libgnuradio_core_qa_la_LIBADD  =      \
 
 bin_PROGRAMS = gnuradio-config-info
 gnuradio_config_info_SOURCES = gnuradio-config-info.cc
-gnuradio_config_info_LDADD = libgnuradio-core.la $(BOOST_PROGRAM_OPTIONS_LIB)
\ No newline at end of file
+gnuradio_config_info_LDADD = libgnuradio-core.la $(BOOST_LDFLAGS) $(BOOST_PROGRAM_OPTIONS_LIB)
index b5f5c346be4083bf52bf6beb07d3538a24ec9ccd..3d8a42805cd0ce4ad3dafed04b88e55de4575ffe 100644 (file)
@@ -60,7 +60,6 @@ libgeneral_la_SOURCES =               \
        gr_cpfsk_bc.cc                  \
        gr_crc32.cc                     \
        gr_ctcss_squelch_ff.cc          \
-       gr_dd_mpsk_sync_cc.cc           \
        gr_decode_ccsds_27_fb.cc        \
        gr_deinterleave.cc              \
        gr_delay.cc                     \
@@ -215,7 +214,6 @@ grinclude_HEADERS =                         \
        gr_cpfsk_bc.h                   \
        gr_crc32.h                      \
        gr_ctcss_squelch_ff.h           \
-       gr_dd_mpsk_sync_cc.h            \
        gr_decode_ccsds_27_fb.h         \
        gr_diff_decoder_bb.h            \
        gr_diff_encoder_bb.h            \
@@ -386,7 +384,6 @@ swiginclude_HEADERS =                       \
        gr_cpfsk_bc.i                   \
        gr_crc32.i                      \
        gr_ctcss_squelch_ff.i           \
-       gr_dd_mpsk_sync_cc.i            \
        gr_decode_ccsds_27_fb.i         \
        gr_diff_decoder_bb.i            \
        gr_diff_encoder_bb.i            \
index 6929f1e6e832c8fca738c9572a484262bd3cdfe6..68cafce2e6de301ae4ac95f30ca279d7843a27ff 100644 (file)
@@ -80,7 +80,6 @@
 #include <gr_threshold_ff.h>
 #include <gr_clock_recovery_mm_ff.h>
 #include <gr_clock_recovery_mm_cc.h>
-#include <gr_dd_mpsk_sync_cc.h>
 #include <gr_packet_sink.h>
 #include <gr_lms_dfe_cc.h>
 #include <gr_lms_dfe_ff.h>
 %include "gr_threshold_ff.i"
 %include "gr_clock_recovery_mm_ff.i"
 %include "gr_clock_recovery_mm_cc.i"
-%include "gr_dd_mpsk_sync_cc.i"
 %include "gr_packet_sink.i"
 %include "gr_lms_dfe_cc.i"
 %include "gr_lms_dfe_ff.i"
diff --git a/gnuradio-core/src/lib/general/gr_dd_mpsk_sync_cc.cc b/gnuradio-core/src/lib/general/gr_dd_mpsk_sync_cc.cc
deleted file mode 100644 (file)
index d4141ef..0000000
+++ /dev/null
@@ -1,196 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004 Free Software Foundation, Inc.
- * 
- * This file is part of GNU Radio
- * 
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- * 
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <gr_dd_mpsk_sync_cc.h>
-#include <gr_io_signature.h>
-#include <gr_sincos.h>
-#include <gri_mmse_fir_interpolator_cc.h>
-#include <math.h>
-#include <stdexcept>
-#include <cstdio>
-
-#include <gr_complex.h>
-
-#define M_TWOPI (2*M_PI)
-
-gr_dd_mpsk_sync_cc_sptr
-gr_make_dd_mpsk_sync_cc (float alpha, float beta, float max_freq, float min_freq, float ref_phase,
-                        float omega, float gain_omega, float mu, float gain_mu)
-{
-    return gr_dd_mpsk_sync_cc_sptr (new gr_dd_mpsk_sync_cc (alpha, beta, max_freq, min_freq,ref_phase,
-                                                           omega,gain_omega,mu,gain_mu));
-}
-
-gr_dd_mpsk_sync_cc::gr_dd_mpsk_sync_cc (float alpha, float beta, float max_freq, float min_freq,
-                                       float ref_phase,
-                                       float omega, float gain_omega, float mu, float gain_mu)
-    : gr_block ("dd_mpsk_sync_cc",
-               gr_make_io_signature (1, 1, sizeof (gr_complex)),
-               gr_make_io_signature (1, 1, sizeof (gr_complex))),
-      d_alpha(alpha), d_beta(beta), 
-      d_max_freq(max_freq), d_min_freq(min_freq),
-      d_ref_phase(ref_phase),d_omega(omega), d_gain_omega(gain_omega), 
-      d_mu(mu), d_gain_mu(gain_mu),
-      d_phase(0), d_freq((max_freq+min_freq)/2), d_last_sample(0), 
-      d_interp(new gri_mmse_fir_interpolator_cc()),
-      d_dl_idx(0)
-{
-    if (omega <= 0.0)
-       throw std::out_of_range ("clock rate must be > 0");
-    if (gain_mu <  0  || gain_omega < 0)
-       throw std::out_of_range ("Gains must be non-negative");
-
-    assert(d_interp->ntaps() <= DLLEN);
-
-    // zero double length delay line.
-    for (unsigned int i = 0; i < 2 * DLLEN; i++)
-      d_dl[i] = gr_complex(0.0,0.0);
-}
-
-gr_dd_mpsk_sync_cc::~gr_dd_mpsk_sync_cc()
-{
-    delete d_interp;
-}
-
-float
-gr_dd_mpsk_sync_cc::phase_detector(gr_complex sample,float ref_phase)
-{
-  return ((sample.real()>0 ? 1.0 : -1.0) * sample.imag() -
-         (sample.imag()>0 ? 1.0 : -1.0) * sample.real());
-}
-
-void
-gr_dd_mpsk_sync_cc::forecast(int noutput_items, gr_vector_int &ninput_items_required)
-{
-  unsigned ninputs = ninput_items_required.size();
-  for (unsigned i=0; i < ninputs; i++)
-    ninput_items_required[i] =
-      (int) ceil((noutput_items * d_omega) + d_interp->ntaps());
-}
-gr_complex
-gr_dd_mpsk_sync_cc::slicer_45deg (gr_complex sample)
-{
-  float real,imag;
-  if(sample.real() > 0)
-    real=1;
-  else
-    real=-1;
-  if(sample.imag() > 0)
-    imag = 1;
-  else
-    imag = -1;
-  return gr_complex(real,imag);
-}
-
-gr_complex
-gr_dd_mpsk_sync_cc::slicer_0deg (gr_complex sample)
-{
-  gr_complex out;
-  if( fabs(sample.real()) > fabs(sample.imag()) ) {
-    if(sample.real() > 0)
-      return gr_complex(1.0,0.0);
-    else
-      return gr_complex(-1.0,0.0);
-  }
-  else {
-    if(sample.imag() > 0)
-      return gr_complex(0.0, 1.0);
-    else
-      return gr_complex(0.0, -1.0);
-  }
-}
-
-int
-gr_dd_mpsk_sync_cc::general_work (int noutput_items, 
-                                 gr_vector_int &ninput_items,
-                                 gr_vector_const_void_star &input_items,
-                                 gr_vector_void_star &output_items)
-{
-  const gr_complex *in = (gr_complex *) input_items[0];
-  gr_complex *out = (gr_complex *) output_items[0];
-  
-  int ii, oo;
-  ii = 0; oo = 0;
-  
-  float error;
-  float t_imag, t_real;
-  gr_complex nco_out;
-  float mm_val;
-
-  while (oo < noutput_items) {
-    // 
-    // generate an output sample by interpolating between the carrier
-    // tracked samples in the delay line.  d_mu, the fractional
-    // interpolation amount (in [0.0, 1.0]) is controlled by the
-    // symbol timing loop below.
-    //
-    out[oo] = d_interp->interpolate (&d_dl[d_dl_idx], d_mu);
-
-    error = phase_detector(out[oo], d_ref_phase);
-    
-    d_freq = d_freq + d_beta * error;
-    d_phase = d_phase + d_alpha * error;
-    while(d_phase>M_TWOPI)
-      d_phase -= M_TWOPI;
-    while(d_phase<-M_TWOPI)
-      d_phase += M_TWOPI;
-      
-    if (d_freq > d_max_freq)
-      d_freq = d_max_freq;
-    else if (d_freq < d_min_freq)
-      d_freq = d_min_freq;
-      
-    mm_val = real(d_last_sample * slicer_0deg(out[oo]) - out[oo] * slicer_0deg(d_last_sample));
-    d_last_sample = out[oo];
-
-    d_omega = d_omega + d_gain_omega * mm_val;
-    d_mu = d_mu + d_omega + d_gain_mu * mm_val;
-    
-    while(d_mu >= 1.0) {
-      //
-      // Generate more carrier tracked samples for the delay line
-      //
-      d_mu -= 1.0;
-      gr_sincosf(d_phase, &t_imag, &t_real);
-      nco_out = gr_complex(t_real, -t_imag);
-      gr_complex new_sample = in[ii] * nco_out;
-
-      d_dl[d_dl_idx] = new_sample;             // overwrite oldest sample
-      d_dl[(d_dl_idx + DLLEN)] = new_sample;   // and second copy
-      d_dl_idx = (d_dl_idx+1) % DLLEN;         // point to the new oldest sample
-      d_phase = d_phase + d_freq;
-      ii++;
-    }
-    oo++;
-    printf("%f\t%f\t%f\t%f\t%f\n",d_mu,d_omega,mm_val,d_freq,d_phase);
-    //printf("%f\t%f\t%f\t%f\t%f\t%f\t%f\n",mple).real(),slicer_0deg(d_last_sample).imag(),mm_val,d_omega,d_mu);
-  }
-
-  assert(ii <= ninput_items[0]);
-
-  consume_each (ii);
-  return noutput_items;
-}
diff --git a/gnuradio-core/src/lib/general/gr_dd_mpsk_sync_cc.h b/gnuradio-core/src/lib/general/gr_dd_mpsk_sync_cc.h
deleted file mode 100644 (file)
index 4ffcd37..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2004,2006 Free Software Foundation, Inc.
- * 
- * This file is part of GNU Radio
- * 
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- * 
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef INCLUDED_GR_DD_MPSK_SYNC_CC_H
-#define INCLUDED_GR_DD_MPSK_SYNC_CC_H
-
-#include <gr_sync_block.h>
-
-class gri_mmse_fir_interpolator_cc;
-
-class gr_dd_mpsk_sync_cc;
-typedef boost::shared_ptr<gr_dd_mpsk_sync_cc> gr_dd_mpsk_sync_cc_sptr;
-
-gr_dd_mpsk_sync_cc_sptr 
-gr_make_dd_mpsk_sync_cc (float alpha, float beta,
-                        float max_freq, float min_freq, float ref_phase,
-                        float omega, float gain_omega, float mu, float gain_mu);
-
-/*!
- * \brief Decision directed M-PSK synchronous demod 
- * \ingroup sync_blk
- * This block performs joint carrier tracking and symbol timing recovery.
- *
- * input: complex baseband; output: properly timed complex samples ready for slicing.
- *
- * N.B, at this point, it handles only QPSK.
- */
-
-class gr_dd_mpsk_sync_cc : public gr_block
-{
-  friend gr_dd_mpsk_sync_cc_sptr gr_make_dd_mpsk_sync_cc (float alpha, float beta,
-                                                         float max_freq, float min_freq, float ref_phase,
-                                                         float omega, float gain_omega, float mu, float gain_mu);
-public:
-  ~gr_dd_mpsk_sync_cc ();
-  void forecast(int noutput_items, gr_vector_int &ninput_items_required);
-  float mu() const { return d_mu;}
-  float omega() const { return d_omega;}
-  float gain_mu() const { return d_gain_mu;}
-  float gain_omega() const { return d_gain_omega;}
-  
-  void set_gain_mu (float gain_mu) { d_gain_mu = gain_mu; }
-  void set_gain_omega (float gain_omega) { d_gain_omega = gain_omega; }
-  void set_mu (float mu) { d_mu = mu; }
-  void set_omega (float omega) { d_omega = omega; }
-
-protected:
-  gr_dd_mpsk_sync_cc (float alpha, float beta, float max_freq, float min_freq, float ref_phase,
-                     float omega, float gain_omega, float mu, float gain_mu);
-  
-  int general_work (int noutput_items,
-                   gr_vector_int &ninput_items,
-                   gr_vector_const_void_star &input_items,
-                   gr_vector_void_star &output_items);
-  
-private:
-  static const unsigned int DLLEN = 8; // delay line length.
-
-  float d_alpha,d_beta,d_max_freq,d_min_freq,d_ref_phase;
-  float d_omega, d_gain_omega, d_mu, d_gain_mu;
-  float d_phase, d_freq;
-  gr_complex slicer_45deg (gr_complex sample);
-  gr_complex slicer_0deg (gr_complex sample);
-  gr_complex d_last_sample;
-  gri_mmse_fir_interpolator_cc         *d_interp;
-  
-  gr_complex d_dl[2 * DLLEN];  // Holds post carrier tracking samples.
-                                // double length delay line to avoid wraps.
-  unsigned int d_dl_idx;       // indexes oldest sample in delay line.
-
-  float phase_detector(gr_complex sample,float ref_phase);
-};
-
-#endif
diff --git a/gnuradio-core/src/lib/general/gr_dd_mpsk_sync_cc.i b/gnuradio-core/src/lib/general/gr_dd_mpsk_sync_cc.i
deleted file mode 100644 (file)
index 1773924..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2005 Free Software Foundation, Inc.
- * 
- * This file is part of GNU Radio
- * 
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- * 
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with GNU Radio; see the file COPYING.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street,
- * Boston, MA 02110-1301, USA.
- */
-
-GR_SWIG_BLOCK_MAGIC(gr,dd_mpsk_sync_cc)
-
-  gr_dd_mpsk_sync_cc_sptr gr_make_dd_mpsk_sync_cc (float alpha, float beta, 
-                                                  float max_freq, float min_freq, float ref_phase,
-                                                  float omega, float gain_omega, float mu, float gain_mu);
-
-class gr_dd_mpsk_sync_cc : public gr_block
-{
- private:
-  gr_dd_mpsk_sync_cc (float alpha, float beta, float max_freq, float min_freq, float ref_phase,
-                     float omega, float gain_omega, float mu, float gain_mu);
-};
index d37adfb8a8cf780f996ba6a1b1f7cc566d06e450..3084a848be7a78c537af79e069703ca404533052 100644 (file)
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2007,2008,2009 Free Software Foundation, Inc.
+ * Copyright 2007,2008,2009,2010 Free Software Foundation, Inc.
  * 
  * This file is part of GNU Radio
  * 
 #include <gr_udp_sink.h>
 #include <gr_io_signature.h>
 #include <stdexcept>
-#if defined(HAVE_SOCKET)
-#include <netdb.h>
+#include <errno.h>
 #include <stdio.h>
+#include <string.h>
+#if defined(HAVE_NETDB_H)
+#include <netdb.h>
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>  //usually included by <netdb.h>?
+#endif
 typedef void* optval_t;
-#else
+#elif defined(HAVE_WINDOWS_H)
+// if not posix, assume winsock
+#define USING_WINSOCK
+#include <winsock2.h>
+#include <ws2tcpip.h>
 #define SHUT_RDWR 2
-#define inet_aton(N,A) ( (A)->s_addr = inet_addr(N), ( (A)->s_addr != INADDR_NONE ) )
 typedef char* optval_t;
 #endif
 
@@ -40,91 +51,67 @@ typedef char* optval_t;
 
 #define SNK_VERBOSE 0
 
-gr_udp_sink::gr_udp_sink (size_t itemsize, 
-                         const char *src, unsigned short port_src,
-                         const char *dst, unsigned short port_dst,
-                         int payload_size)
-  : gr_sync_block ("udp_sink",
-                  gr_make_io_signature (1, 1, itemsize),
-                  gr_make_io_signature (0, 0, 0)),
-    d_itemsize (itemsize), d_updated(false), d_payload_size(payload_size)
+static int is_error( int perr )
 {
-  int ret = 0;
-  
-  // Set up the address stucture for the source address and port numbers
-  // Get the source IP address from the host name
-  struct hostent *hsrc = gethostbyname(src);
-  if(hsrc) {   // if the source was provided as a host namex
-    d_ip_src = *(struct in_addr*)hsrc->h_addr_list[0];    
+  // Compare error to posix error code; return nonzero if match.
+#if defined(USING_WINSOCK)
+#define ENOPROTOOPT 109
+#define ECONNREFUSED 111
+  // All codes to be checked for must be defined below
+  int werr = WSAGetLastError();
+  switch( werr ) {
+  case WSAETIMEDOUT:
+    return( perr == EAGAIN );
+  case WSAENOPROTOOPT:
+    return( perr == ENOPROTOOPT );
+  case WSAECONNREFUSED:
+    return( perr == ECONNREFUSED );
+  default:
+    fprintf(stderr,"gr_udp_source/is_error: unknown error %d\n", perr );
+    throw std::runtime_error("internal error");
   }
-  else { // assume it was specified as an IP address
-    if((ret=inet_aton(src, &d_ip_src)) == 0) {            // format IP address
-      perror("Not a valid source IP address or host name");
-      throw std::runtime_error("can't initialize source socket");
-    }
-  }
-
-  // Get the destination IP address from the host name
-  struct hostent *hdst = gethostbyname(dst);
-  if(hdst) {   // if the source was provided as a host namex
-    d_ip_dst = *(struct in_addr*)hdst->h_addr_list[0];    
-  }
-  else { // assume it was specified as an IP address
-    if((ret=inet_aton(dst, &d_ip_dst)) == 0) {            // format IP address
-      perror("Not a valid destination IP address or host name");
-      throw std::runtime_error("can't initialize destination socket");
-    }
-  }
-
-  d_port_src = htons(port_src);           // format port number
-  d_port_dst = htons(port_dst);           // format port number
-
-  d_sockaddr_src.sin_family = AF_INET;
-  d_sockaddr_src.sin_addr   = d_ip_src;
-  d_sockaddr_src.sin_port   = d_port_src;
-
-  d_sockaddr_dst.sin_family = AF_INET;
-  d_sockaddr_dst.sin_addr   = d_ip_dst;
-  d_sockaddr_dst.sin_port   = d_port_dst;
-  
-  open();
-}
-
-// public constructor that returns a shared_ptr
-
-gr_udp_sink_sptr
-gr_make_udp_sink (size_t itemsize, 
-                 const char *src, unsigned short port_src,
-                 const char *dst, unsigned short port_dst,
-                 int payload_size)
-{
-  return gr_udp_sink_sptr (new gr_udp_sink (itemsize, 
-                                           src, port_src,
-                                           dst, port_dst,
-                                           payload_size));
+  return 0;
+#else
+  return( perr == errno );
+#endif
 }
 
-gr_udp_sink::~gr_udp_sink ()
+static void report_error( const char *msg1, const char *msg2 )
 {
-  close();
+  // Deal with errors, both posix and winsock
+#if defined(USING_WINSOCK)
+  int werr = WSAGetLastError();
+  fprintf(stderr, "%s: winsock error %d\n", msg1, werr );
+#else
+  perror(msg1);
+#endif
+  if( msg2 != NULL )
+    throw std::runtime_error(msg2);
+  return;
 }
 
-bool
-gr_udp_sink::open()
+gr_udp_sink::gr_udp_sink (size_t itemsize, 
+                         const char *host, unsigned short port,
+                         int payload_size, bool eof)
+  : gr_sync_block ("udp_sink",
+                  gr_make_io_signature (1, 1, itemsize),
+                  gr_make_io_signature (0, 0, 0)),
+    d_itemsize (itemsize), d_payload_size(payload_size), d_eof(eof),
+    d_socket(-1), d_connected(false)
 {
-  gruel::scoped_lock guard(d_mutex);   // hold mutex for duration of this function
-
-  // create socket
-  if((d_socket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == -1) {
-    perror("socket open");
-    throw std::runtime_error("can't open socket");
+#if defined(USING_WINSOCK) // for Windows (with MinGW)
+  // initialize winsock DLL
+  WSADATA wsaData;
+  int iResult = WSAStartup( MAKEWORD(2,2), &wsaData );
+  if( iResult != NO_ERROR ) {
+    report_error( "gr_udp_source WSAStartup", "can't open socket" );
   }
+#endif
 
-  // Turn on reuse address
-  int opt_val = true;
-  if(setsockopt(d_socket, SOL_SOCKET, SO_REUSEADDR, (optval_t)&opt_val, sizeof(int)) == -1) {
-    perror("SO_REUSEADDR");
-    throw std::runtime_error("can't set socket option SO_REUSEADDR");
+  // create socket
+  d_socket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
+  if(d_socket == -1) {
+    report_error("socket open","can't open socket");
   }
 
   // Don't wait when shutting down
@@ -132,36 +119,46 @@ gr_udp_sink::open()
   lngr.l_onoff  = 1;
   lngr.l_linger = 0;
   if(setsockopt(d_socket, SOL_SOCKET, SO_LINGER, (optval_t)&lngr, sizeof(linger)) == -1) {
-    perror("SO_LINGER");
-    throw std::runtime_error("can't set socket option SO_LINGER");
+    if( !is_error(ENOPROTOOPT) ) {  // no SO_LINGER for SOCK_DGRAM on Windows
+      report_error("SO_LINGER","can't set socket option SO_LINGER");
+    }
   }
 
-  // bind socket to an address and port number to listen on
-  if(bind (d_socket, (sockaddr*)&d_sockaddr_src, sizeof(struct sockaddr)) == -1) {
-    perror("socket bind");
-    throw std::runtime_error("can't bind socket");
-  }
+  // Get the destination address
+  connect(host, port);
+}
 
-  // Not sure if we should throw here or allow retries
-  if(connect(d_socket, (sockaddr*)&d_sockaddr_dst, sizeof(struct sockaddr)) == -1) {
-    perror("socket connect");
-    throw std::runtime_error("can't connect to socket");
-  }
+// public constructor that returns a shared_ptr
 
-  d_updated = true;
-  return d_socket != 0;
+gr_udp_sink_sptr
+gr_make_udp_sink (size_t itemsize, 
+                 const char *host, unsigned short port,
+                 int payload_size, bool eof)
+{
+  return gr_udp_sink_sptr (new gr_udp_sink (itemsize, 
+                                           host, port,
+                                           payload_size, eof));
 }
 
-void
-gr_udp_sink::close()
+gr_udp_sink::~gr_udp_sink ()
 {
-  gruel::scoped_lock guard(d_mutex);   // hold mutex for duration of this function
+  if (d_connected)
+    disconnect();
 
-  if (d_socket){
+  if (d_socket != -1){
     shutdown(d_socket, SHUT_RDWR);
-    d_socket = 0;
+#if defined(USING_WINSOCK)
+    closesocket(d_socket);
+#else
+    ::close(d_socket);
+#endif
+    d_socket = -1;
   }
-  d_updated = true;
+
+#if defined(USING_WINSOCK) // for Windows (with MinGW)
+  // free winsock resources
+  WSACleanup();
+#endif
 }
 
 int 
@@ -174,21 +171,31 @@ gr_udp_sink::work (int noutput_items,
   ssize_t total_size = noutput_items*d_itemsize;
 
   #if SNK_VERBOSE
-  printf("Entered upd_sink\n");
+  printf("Entered udp_sink\n");
   #endif
 
+  gruel::scoped_lock guard(d_mutex);  // protect d_socket
+
   while(bytes_sent <  total_size) {
     bytes_to_send = std::min((ssize_t)d_payload_size, (total_size-bytes_sent));
   
-    r = send(d_socket, (in+bytes_sent), bytes_to_send, 0);
-    if(r == -1) {         // error on send command
-      perror("udp_sink"); // there should be no error case where this function 
-      return -1;          // should not exit immediately
+    if(d_connected) {
+      r = send(d_socket, (in+bytes_sent), bytes_to_send, 0);
+      if(r == -1) {         // error on send command
+       if( is_error(ECONNREFUSED) )
+         r = bytes_to_send;  // discard data until receiver is started
+       else {
+         report_error("udp_sink",NULL); // there should be no error case where
+         return -1;                  // this function should not exit immediately
+       }
+      }
     }
+    else
+      r = bytes_to_send;  // discarded for lack of connection
     bytes_sent += r;
     
     #if SNK_VERBOSE
-    printf("\tbyte sent: %d bytes\n", bytes);
+    printf("\tbyte sent: %d bytes\n", r);
     #endif
   }
 
@@ -198,3 +205,98 @@ gr_udp_sink::work (int noutput_items,
 
   return noutput_items;
 }
+
+void gr_udp_sink::connect( const char *host, unsigned short port )
+{
+  if(d_connected)
+    disconnect();
+
+  if(host != NULL ) {
+    // Get the destination address
+    struct addrinfo *ip_dst;
+    struct addrinfo hints;
+    memset( (void*)&hints, 0, sizeof(hints) );
+    hints.ai_family = AF_INET;
+    hints.ai_socktype = SOCK_DGRAM;
+    hints.ai_protocol = IPPROTO_UDP;
+    char port_str[12];
+    sprintf( port_str, "%d", port );
+
+    // FIXME leaks if report_error throws below
+    int ret = getaddrinfo( host, port_str, &hints, &ip_dst );
+    if( ret != 0 )
+      report_error("gr_udp_source/getaddrinfo",
+                  "can't initialize destination socket" );
+
+    // don't need d_mutex lock when !d_connected
+    if(::connect(d_socket, ip_dst->ai_addr, ip_dst->ai_addrlen) == -1) {
+      report_error("socket connect","can't connect to socket");
+    }
+    d_connected = true;
+
+    freeaddrinfo(ip_dst);
+  }
+
+  return;
+}
+
+void gr_udp_sink::disconnect()
+{
+  if(!d_connected)
+    return;
+
+  #if SNK_VERBOSE
+  printf("gr_udp_sink disconnecting\n");
+  #endif
+
+  gruel::scoped_lock guard(d_mutex);  // protect d_socket from work()
+
+  // Send a few zero-length packets to signal receiver we are done
+  if(d_eof) {
+    int i;
+    for( i = 0; i < 3; i++ )
+      (void) send( d_socket, NULL, 0, 0 );  // ignore errors
+  }
+
+  // Sending EOF can produce ERRCONNREFUSED errors that won't show up
+  //  until the next send or recv, which might confuse us if it happens
+  //  on a new connection.  The following does a nonblocking recv to
+  //  clear any such errors.
+  timeval timeout;
+  timeout.tv_sec = 0;    // zero time for immediate return
+  timeout.tv_usec = 0;
+  fd_set readfds;
+  FD_ZERO(&readfds);
+  FD_SET(d_socket, &readfds);
+  int r = select(FD_SETSIZE, &readfds, NULL, NULL, &timeout);
+  if(r < 0) {
+      #if SNK_VERBOSE
+      report_error("udp_sink/select",NULL);
+      #endif
+  }
+  else if(r > 0) {  // call recv() to get error return
+    r = recv(d_socket, (char*)&readfds, sizeof(readfds), 0);
+    if(r < 0) {
+       #if SNK_VERBOSE
+       report_error("udp_sink/recv",NULL);
+       #endif
+    }
+  }
+
+  // Since I can't find any way to disconnect a datagram socket in Cygwin,
+  // we just leave it connected but disable sending.
+#if 0
+  // zeroed address structure should reset connection
+  struct sockaddr addr;
+  memset( (void*)&addr, 0, sizeof(addr) );
+  // addr.sa_family = AF_UNSPEC;  // doesn't work on Cygwin
+  // addr.sa_family = AF_INET;  // doesn't work on Cygwin
+
+  if(::connect(d_socket, &addr, sizeof(addr)) == -1)
+    report_error("socket connect","can't connect to socket");
+#endif
+
+  d_connected = false;
+
+  return;
+}
index f22b92dd035dd5e17f78c37ef3b9686486f61257..421d514a4db270872f218bddbc116cc8b293f054 100644 (file)
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2007,2008,2009 Free Software Foundation, Inc.
+ * Copyright 2007,2008,2009,2010 Free Software Foundation, Inc.
  * 
  * This file is part of GNU Radio
  * 
 #define INCLUDED_GR_UDP_SINK_H
 
 #include <gr_sync_block.h>
-#include <boost/thread.hpp>
-#if defined(HAVE_SOCKET)
-#include <sys/socket.h>
-#include <arpa/inet.h>
-#elif defined(HAVE_WINDOWS_H)
-#include <winsock2.h>
-#include <windows.h>
-#endif
-#if defined(HAVE_NETINET_IN_H)
-#include <netinet/in.h>
-#endif
-
 #include <gruel/thread.h>
 
 class gr_udp_sink;
@@ -43,85 +31,75 @@ typedef boost::shared_ptr<gr_udp_sink> gr_udp_sink_sptr;
 
 gr_udp_sink_sptr
 gr_make_udp_sink (size_t itemsize, 
-                 const char *src, unsigned short port_src,
-                 const char *dst, unsigned short port_dst,
-                 int payload_size=1472);
+                 const char *host, unsigned short port,
+                 int payload_size=1472, bool eof=true);
 
 /*!
  * \brief Write stream to an UDP socket.
  * \ingroup sink_blk
  * 
  * \param itemsize     The size (in bytes) of the item datatype
- * \param src          The source address as either the host name or the 'numbers-and-dots'
- *                     IP address
- * \param port_src     Destination port to bind to (0 allows socket to choose an appropriate port)
- * \param dst          The destination address as either the host name or the 'numbers-and-dots'
- *                     IP address
- * \param port_dst     Destination port to connect to
- * \param payload_size UDP payload size by default set to 
- *                     1472 = (1500 MTU - (8 byte UDP header) - (20 byte IP header))
+ * \param host         The name or IP address of the receiving host; use
+ *                     NULL or None for no connection
+ * \param port         Destination port to connect to on receiving host
+ * \param payload_size UDP payload size by default set to 1472 =
+ *                     (1500 MTU - (8 byte UDP header) - (20 byte IP header))
+ * \param eof          Send zero-length packet on disconnect
  */
 
 class gr_udp_sink : public gr_sync_block
 {
   friend gr_udp_sink_sptr gr_make_udp_sink (size_t itemsize, 
-                                           const char *src, unsigned short port_src,
-                                           const char *dst, unsigned short port_dst,
-                                           int payload_size);
+                                           const char *host,
+                                           unsigned short port,
+                                           int payload_size, bool eof);
  private:
   size_t       d_itemsize;
-  bool         d_updated;
-  gruel::mutex d_mutex;
 
-  int            d_payload_size;    // maximum transmission unit (packet length)
-  int            d_socket;          // handle to socket
-  int            d_socket_rcv;      // handle to socket retuned in the accept call
-  struct in_addr d_ip_src;          // store the source ip info
-  struct in_addr d_ip_dst;          // store the destination ip info
-  unsigned short d_port_src;        // the port number to open for connections to this service
-  unsigned short d_port_dst;        // port number of the remove system
-  struct sockaddr_in    d_sockaddr_src;    // store the source sockaddr data (formatted IP address and port number)
-  struct sockaddr_in    d_sockaddr_dst;    // store the destination sockaddr data (formatted IP address and port number)
+  int           d_payload_size;    // maximum transmission unit (packet length)
+  bool          d_eof;             // send zero-length packet on disconnect
+  int           d_socket;          // handle to socket
+  bool          d_connected;       // are we connected?
+  gruel::mutex  d_mutex;           // protects d_socket and d_connected
 
  protected:
   /*!
    * \brief UDP Sink Constructor
    * 
    * \param itemsize     The size (in bytes) of the item datatype
-   * \param src          The source address as either the host name or the 'numbers-and-dots'
-   *                     IP address
-   * \param port_src     Destination port to bind to (0 allows socket to choose an appropriate port)
-   * \param dst          The destination address as either the host name or the 'numbers-and-dots'
-   *                     IP address
-   * \param port_dst     Destination port to connect to
+   * \param host         The name or IP address of the receiving host; use
+   *                     NULL or None for no connection
+   * \param port         Destination port to connect to on receiving host
    * \param payload_size UDP payload size by default set to 
    *                     1472 = (1500 MTU - (8 byte UDP header) - (20 byte IP header))
+   * \param eof          Send zero-length packet on disconnect
    */
   gr_udp_sink (size_t itemsize, 
-              const char *src, unsigned short port_src,
-              const char *dst, unsigned short port_dst,
-              int payload_size);
+              const char *host, unsigned short port,
+              int payload_size, bool eof);
 
  public:
   ~gr_udp_sink ();
 
-  /*!
-   * \brief open a socket specified by the port and ip address info
-   *
-   * Opens a socket, binds to the address, and makes connectionless association
-   * over UDP. If any of these fail, the fuction retuns the error and exits.
-   */
-  bool open();
+  /*! \brief return the PAYLOAD_SIZE of the socket */
+  int payload_size() { return d_payload_size; }
 
-  /*!
-   * \brief Close current socket.
+  /*! \brief Change the connection to a new destination
+   *
+   * \param host         The name or IP address of the receiving host; use
+   *                     NULL or None to break the connection without closing
+   * \param port         Destination port to connect to on receiving host
    *
-   * Shuts down read/write on the socket
+   * Calls disconnect() to terminate any current connection first.
    */
-  void close();
+  void connect( const char *host, unsigned short port );
 
-  /*! \brief return the PAYLOAD_SIZE of the socket */
-  int payload_size() { return d_payload_size; }
+  /*! \brief Send zero-length packet (if eof is requested) then stop sending
+   *
+   * Zero-byte packets can be interpreted as EOF by gr_udp_source.  Note that
+   * disconnect occurs automatically when the sink is destroyed, but not when
+   * its top_block stops.*/
+  void disconnect();
 
   // should we export anything else?
 
index 0f37b477b2c8f5a6b6512c67350a4d976bf4b53b..a71006ae03e9e47a200500f0339c0371d310c536 100644 (file)
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2007 Free Software Foundation, Inc.
+ * Copyright 2007,2010 Free Software Foundation, Inc.
  * 
  * This file is part of GNU Radio
  * 
@@ -25,22 +25,22 @@ GR_SWIG_BLOCK_MAGIC(gr,udp_sink)
 
 gr_udp_sink_sptr 
 gr_make_udp_sink (size_t itemsize, 
-                 const char *src, unsigned short port_src,
-                 const char *dst, unsigned short port_dst,
-                 int payload_size=1472);
+                 const char *host, unsigned short port,
+                 int payload_size=1472, bool eof=true) throw (std::runtime_error);
 
 class gr_udp_sink : public gr_sync_block
 {
  protected:
   gr_udp_sink (size_t itemsize, 
-              const char *src, unsigned short port_src,
-              const char *dst, unsigned short port_dst,
-              int payload_size);
-
-  bool open();
-  void close();
-  int payload_size() { return d_payload_size; }
+              const char *host, unsigned short port,
+              int payload_size, bool eof) 
+    throw (std::runtime_error);
 
  public:
   ~gr_udp_sink ();
+
+  int payload_size() { return d_payload_size; }
+  void connect( const char *host, unsigned short port );
+  void disconnect();
+
 };
index d76d0ee32fcd5ef5ab21d2b4a2ab5373d4485f46..fea9a26ba40083c3fb25768ed08badae5763fc1b 100644 (file)
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2007,2008,2009 Free Software Foundation, Inc.
+ * Copyright 2007,2008,2009,2010 Free Software Foundation, Inc.
  * 
  * This file is part of GNU Radio
  * 
 #include <errno.h>
 #include <stdio.h>
 #include <string.h>
-#if defined(HAVE_SOCKET)
+
+#if defined(HAVE_NETDB_H)
 #include <netdb.h>
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
 typedef void* optval_t;
-#else
+
+// ntohs() on FreeBSD may require both netinet/in.h and arpa/inet.h, in order
+#if defined(HAVE_NETINET_IN_H)
+#include <netinet/in.h>
+#endif
+#if defined(HAVE_ARPA_INET_H)
+#include <arpa/inet.h>
+#endif
+
+#elif defined(HAVE_WINDOWS_H)
+// if not posix, assume winsock
+#define USING_WINSOCK
+#include <winsock2.h>
+#include <ws2tcpip.h>
 #define SHUT_RDWR 2
-#define inet_aton(N,A) ( (A)->s_addr = inet_addr(N), ( (A)->s_addr != INADDR_NONE ) )
 typedef char* optval_t;
 #endif
 
+#define USE_SELECT    1  // non-blocking receive on all platforms
+#define USE_RCV_TIMEO 0  // non-blocking receive on all but Cygwin
 #define SRC_VERBOSE 0
 
-gr_udp_source::gr_udp_source(size_t itemsize, const char *src, 
-                            unsigned short port_src, int payload_size)
+static int is_error( int perr )
+{
+  // Compare error to posix error code; return nonzero if match.
+#if defined(USING_WINSOCK)
+#define ENOPROTOOPT 109
+  // All codes to be checked for must be defined below
+  int werr = WSAGetLastError();
+  switch( werr ) {
+  case WSAETIMEDOUT:
+    return( perr == EAGAIN );
+  case WSAENOPROTOOPT:
+    return( perr == ENOPROTOOPT );
+  default:
+    fprintf(stderr,"gr_udp_source/is_error: unknown error %d\n", perr );
+    throw std::runtime_error("internal error");
+  }
+  return 0;
+#else
+  return( perr == errno );
+#endif
+}
+
+static void report_error( const char *msg1, const char *msg2 )
+{
+  // Deal with errors, both posix and winsock
+#if defined(USING_WINSOCK)
+  int werr = WSAGetLastError();
+  fprintf(stderr, "%s: winsock error %d\n", msg1, werr );
+#else
+  perror(msg1);
+#endif
+  if( msg2 != NULL )
+    throw std::runtime_error(msg2);
+  return;
+}
+
+gr_udp_source::gr_udp_source(size_t itemsize, const char *host, 
+                            unsigned short port, int payload_size,
+                            bool eof, bool wait)
   : gr_sync_block ("udp_source",
                   gr_make_io_signature(0, 0, 0),
                   gr_make_io_signature(1, 1, itemsize)),
-    d_itemsize(itemsize), d_updated(false), d_payload_size(payload_size), d_residual(0), d_temp_offset(0)
+    d_itemsize(itemsize), d_payload_size(payload_size),
+    d_eof(eof), d_wait(wait), d_socket(-1), d_residual(0), d_temp_offset(0)
 {
   int ret = 0;
+
+#if defined(USING_WINSOCK) // for Windows (with MinGW)
+  // initialize winsock DLL
+  WSADATA wsaData;
+  int iResult = WSAStartup( MAKEWORD(2,2), &wsaData );
+  if( iResult != NO_ERROR ) {
+    report_error( "gr_udp_source WSAStartup", "can't open socket" );
+  }
+#endif
   
   // Set up the address stucture for the source address and port numbers
   // Get the source IP address from the host name
-  struct hostent *hsrc = gethostbyname(src);
-  if(hsrc) {   // if the source was provided as a host namex
-    d_ip_src = *(struct in_addr*)hsrc->h_addr_list[0];    
-  }
-  else { // assume it was specified as an IP address
-    if((ret=inet_aton(src, &d_ip_src)) == 0) {            // format IP address
-      perror("Not a valid source IP address or host name");
-      throw std::runtime_error("can't initialize source socket");
-    }
-  }
+  struct addrinfo *ip_src;      // store the source IP address to use
+  struct addrinfo hints;
+  memset( (void*)&hints, 0, sizeof(hints) );
+  hints.ai_family = AF_INET;
+  hints.ai_socktype = SOCK_DGRAM;
+  hints.ai_protocol = IPPROTO_UDP;
+  hints.ai_flags = AI_PASSIVE;
+  char port_str[12];
+  sprintf( port_str, "%d", port );
 
-  d_port_src = htons(port_src);     // format port number
-  
-  d_sockaddr_src.sin_family = AF_INET;
-  d_sockaddr_src.sin_addr   = d_ip_src;
-  d_sockaddr_src.sin_port   = d_port_src;
+  // FIXME leaks if report_error throws below
+  ret = getaddrinfo( host, port_str, &hints, &ip_src );
+  if( ret != 0 )
+    report_error("gr_udp_source/getaddrinfo",
+                "can't initialize source socket" );
 
+  // FIXME leaks if report_error throws below
   d_temp_buff = new char[d_payload_size];   // allow it to hold up to payload_size bytes
-  
-  open();
-}
 
-gr_udp_source_sptr
-gr_make_udp_source (size_t itemsize, const char *ipaddr, 
-                   unsigned short port, int payload_size)
-{
-  return gr_udp_source_sptr (new gr_udp_source (itemsize, ipaddr, 
-                                               port, payload_size));
-}
-
-gr_udp_source::~gr_udp_source ()
-{
-  delete [] d_temp_buff;
-  close();
-}
-
-bool
-gr_udp_source::open()
-{
-  gruel::scoped_lock guard(d_mutex);   // hold mutex for duration of this function
   // create socket
-  d_socket = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
+  d_socket = socket(ip_src->ai_family, ip_src->ai_socktype,
+                   ip_src->ai_protocol);
   if(d_socket == -1) {
-    perror("socket open");
-    throw std::runtime_error("can't open socket");
+    report_error("socket open","can't open socket");
   }
 
   // Turn on reuse address
   int opt_val = 1;
   if(setsockopt(d_socket, SOL_SOCKET, SO_REUSEADDR, (optval_t)&opt_val, sizeof(int)) == -1) {
-    perror("SO_REUSEADDR");
-    throw std::runtime_error("can't set socket option SO_REUSEADDR");
+    report_error("SO_REUSEADDR","can't set socket option SO_REUSEADDR");
   }
 
   // Don't wait when shutting down
@@ -110,40 +156,61 @@ gr_udp_source::open()
   lngr.l_onoff  = 1;
   lngr.l_linger = 0;
   if(setsockopt(d_socket, SOL_SOCKET, SO_LINGER, (optval_t)&lngr, sizeof(linger)) == -1) {
-    perror("SO_LINGER");
-    throw std::runtime_error("can't set socket option SO_LINGER");
+    if( !is_error(ENOPROTOOPT) ) {  // no SO_LINGER for SOCK_DGRAM on Windows
+      report_error("SO_LINGER","can't set socket option SO_LINGER");
+    }
   }
 
+#if USE_RCV_TIMEO
   // Set a timeout on the receive function to not block indefinitely
   // This value can (and probably should) be changed
+  // Ignored on Cygwin
+#if defined(USING_WINSOCK)
+  DWORD timeout = 1000;  // milliseconds
+#else
   timeval timeout;
   timeout.tv_sec = 1;
   timeout.tv_usec = 0;
+#endif
   if(setsockopt(d_socket, SOL_SOCKET, SO_RCVTIMEO, (optval_t)&timeout, sizeof(timeout)) == -1) {
-    perror("SO_RCVTIMEO");
-    throw std::runtime_error("can't set socket option SO_RCVTIMEO");
+    report_error("SO_RCVTIMEO","can't set socket option SO_RCVTIMEO");
   }
+#endif // USE_RCV_TIMEO
 
   // bind socket to an address and port number to listen on
-  if(bind (d_socket, (sockaddr*)&d_sockaddr_src, sizeof(struct sockaddr)) == -1) {
-    perror("socket bind");
-    throw std::runtime_error("can't bind socket");
+  if(bind (d_socket, ip_src->ai_addr, ip_src->ai_addrlen) == -1) {
+    report_error("socket bind","can't bind socket");
   }
-  
-  d_updated = true;
-  return d_socket != 0;
+  freeaddrinfo(ip_src);
+
 }
 
-void
-gr_udp_source::close()
+gr_udp_source_sptr
+gr_make_udp_source (size_t itemsize, const char *ipaddr, 
+                   unsigned short port, int payload_size, bool eof, bool wait)
 {
-  gruel::scoped_lock guard(d_mutex);   // hold mutex for duration of this function
+  return gr_udp_source_sptr (new gr_udp_source (itemsize, ipaddr, 
+                                               port, payload_size, eof, wait));
+}
+
+gr_udp_source::~gr_udp_source ()
+{
+  delete [] d_temp_buff;
 
-  if (d_socket){
+  if (d_socket != -1){
     shutdown(d_socket, SHUT_RDWR);
-    d_socket = 0;
+#if defined(USING_WINSOCK)
+    closesocket(d_socket);
+#else
+    ::close(d_socket);
+#endif
+    d_socket = -1;
   }
-  d_updated = true;
+
+#if defined(USING_WINSOCK) // for Windows (with MinGW)
+  // free winsock resources
+  WSACleanup();
+#endif
 }
 
 int 
@@ -175,29 +242,85 @@ gr_udp_source::work (int noutput_items,
     
     // Update indexing of amount of bytes left in the buffer
     d_residual -= nbytes;
-    d_temp_offset = d_temp_offset+d_residual;
+    d_temp_offset += nbytes;
+
+    // Return now with what we've got.
+    assert(nbytes % d_itemsize == 0);
+    return nbytes/d_itemsize;
   }
 
   while(1) {
     // get the data into our output buffer and record the number of bytes
+
+#if USE_SELECT
+    // RCV_TIMEO doesn't work on all systems (e.g., Cygwin)
+    // use select() instead of, or in addition to RCV_TIMEO
+    fd_set readfds;
+    timeval timeout;
+    timeout.tv_sec = 1;          // Init timeout each iteration.  Select can modify it.
+    timeout.tv_usec = 0;
+    FD_ZERO(&readfds);
+    FD_SET(d_socket, &readfds);
+    r = select(FD_SETSIZE, &readfds, NULL, NULL, &timeout);
+    if(r < 0) {
+       report_error("udp_source/select",NULL);
+       return -1;
+    }
+    else if(r == 0 ) {  // timed out
+      if( d_wait ) {
+       // Allow boost thread interrupt, then try again
+       boost::this_thread::interruption_point();
+       continue;
+      }
+      else
+       return -1;
+    }
+#endif // USE_SELECT
+
     // This is a non-blocking call with a timeout set in the constructor
     r = recv(d_socket, d_temp_buff, d_payload_size, 0);  // get the entire payload or the what's available
 
+    // If r > 0, round it down to a multiple of d_itemsize 
+    // (If sender is broken, don't propagate problem)
+    if (r > 0)
+      r = (r/d_itemsize) * d_itemsize;
+
     // Check if there was a problem; forget it if the operation just timed out
     if(r == -1) {
-      if(errno == EAGAIN) {  // handle non-blocking call timeout
+      if( is_error(EAGAIN) ) {  // handle non-blocking call timeout
         #if SRC_VERBOSE
        printf("UDP receive timed out\n"); 
         #endif
 
-       // Break here to allow the rest of the flow graph time to run and so ctrl-C breaks
-       break;
+       if( d_wait ) {
+         // Allow boost thread interrupt, then try again
+         boost::this_thread::interruption_point();
+         continue;
+       }
+       else
+         return -1;
       }
       else {
-       perror("udp_source");
+       report_error("udp_source/recv",NULL);
        return -1;
       }
     }
+    else if(r==0) {
+      if(d_eof) {
+       // zero-length packet interpreted as EOF
+
+       #if SNK_VERBOSE
+       printf("\tzero-length packet received; returning EOF\n");
+       #endif
+
+       return -1;
+      }
+      else{
+       // do we need to allow boost thread interrupt?
+       boost::this_thread::interruption_point();
+       continue;
+      }
+    }
     else {
       // Calculate the number of bytes we can take from the buffer in this call
       nbytes = std::min(r, total_bytes-bytes_received);
@@ -235,3 +358,15 @@ gr_udp_source::work (int noutput_items,
   return bytes_received/d_itemsize;
 }
 
+// Return port number of d_socket
+int gr_udp_source::get_port(void)
+{
+  sockaddr_in name;
+  socklen_t len = sizeof(name);
+  int ret = getsockname( d_socket, (sockaddr*)&name, &len );
+  if( ret ) {
+    report_error("gr_udp_source/getsockname",NULL);
+    return -1;
+  }
+  return ntohs(name.sin_port);
+}
index 61d719e4da88e86be806fa98357facace22124ea..5d30fad3045de4c7efc4189a5d6a1cab178e930a 100644 (file)
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2007,2008,2009 Free Software Foundation, Inc.
+ * Copyright 2007,2008,2009,2010 Free Software Foundation, Inc.
  * 
  * This file is part of GNU Radio
  * 
 #define INCLUDED_GR_UDP_SOURCE_H
 
 #include <gr_sync_block.h>
-#if defined(HAVE_SOCKET)
-#include <sys/socket.h>
-#include <arpa/inet.h>
-#elif defined(HAVE_WINDOWS_H)
-#include <winsock2.h>
-#include <windows.h>
-#endif
-#if defined(HAVE_NETINET_IN_H)
-#include <netinet/in.h>
-#endif
-
 #include <gruel/thread.h>
 
 class gr_udp_source;
 typedef boost::shared_ptr<gr_udp_source> gr_udp_source_sptr;
 
-gr_udp_source_sptr gr_make_udp_source(size_t itemsize, const char *src, 
-                                     unsigned short port_src, int payload_size=1472);
+gr_udp_source_sptr gr_make_udp_source(size_t itemsize, const char *host, 
+                                     unsigned short port,
+                                     int payload_size=1472,
+                                     bool eof=true, bool wait=true);
 
 /*! 
  * \brief Read stream from an UDP socket.
  * \ingroup source_blk
  *
  * \param itemsize     The size (in bytes) of the item datatype
- * \param src          The source address as either the host name or the 'numbers-and-dots'
- *                     IP address
- * \param port_src     The port number on which the socket listens for data
- * \param payload_size UDP payload size by default set to 
- *                     1472 = (1500 MTU - (8 byte UDP header) - (20 byte IP header))
+ * \param host         The name or IP address of the receiving host; can be
+ *                     NULL, None, or "0.0.0.0" to allow reading from any
+ *                     interface on the host
+ * \param port         The port number on which to receive data; use 0 to
+ *                     have the system assign an unused port number
+ * \param payload_size UDP payload size by default set to 1472 =
+ *                     (1500 MTU - (8 byte UDP header) - (20 byte IP header))
+ * \param eof          Interpret zero-length packet as EOF (default: true)
+ * \param wait         Wait for data if not immediately available
+ *                     (default: true)
  *
 */
 
 class gr_udp_source : public gr_sync_block
 {
-  friend gr_udp_source_sptr gr_make_udp_source(size_t itemsize, const char *src, 
-                                              unsigned short port_src, int payload_size);
+  friend gr_udp_source_sptr gr_make_udp_source(size_t itemsize,
+                                              const char *host, 
+                                              unsigned short port,
+                                              int payload_size,
+                                              bool eof, bool wait);
 
  private:
   size_t       d_itemsize;
-  bool         d_updated;
-  gruel::mutex d_mutex;
-
-  int            d_payload_size;  // maximum transmission unit (packet length)
-  int            d_socket;        // handle to socket
-  int            d_socket_rcv;    // handle to socket retuned in the accept call
-  struct in_addr d_ip_src;        // store the source IP address to use
-  unsigned short d_port_src;      // the port number to open for connections to this service
-  struct sockaddr_in    d_sockaddr_src;  // store the source sockaddr data (formatted IP address and port number)
+  int           d_payload_size;  // maximum transmission unit (packet length)
+  bool          d_eof;           // zero-length packet is EOF
+  bool          d_wait;          // wait if data if not immediately available
+  int           d_socket;        // handle to socket
   char *d_temp_buff;    // hold buffer between calls
   ssize_t d_residual;   // hold information about number of bytes stored in the temp buffer
   size_t d_temp_offset; // point to temp buffer location offset
@@ -81,35 +75,29 @@ class gr_udp_source : public gr_sync_block
    * \brief UDP Source Constructor
    * 
    * \param itemsize     The size (in bytes) of the item datatype
-   * \param src          The source address as either the host name or the 'numbers-and-dots'
-   *                     IP address
-   * \param port_src     The port number on which the socket listens for data
-   * \param payload_size UDP payload size by default set to 
-   *                     1472 = (1500 MTU - (8 byte UDP header) - (20 byte IP header))
+   * \param host         The name or IP address of the receiving host; can be
+   *                     NULL, None, or "0.0.0.0" to allow reading from any
+   *                     interface on the host
+   * \param port         The port number on which to receive data; use 0 to
+   *                     have the system assign an unused port number
+   * \param payload_size UDP payload size by default set to 1472 =
+   *                     (1500 MTU - (8 byte UDP header) - (20 byte IP header))
+   * \param eof          Interpret zero-length packet as EOF (default: true)
+   * \param wait         Wait for data if not immediately available
+   *                     (default: true)
    */
-  gr_udp_source(size_t itemsize, const char *src, unsigned short port_src, int payload_size);
+  gr_udp_source(size_t itemsize, const char *host, unsigned short port,
+               int payload_size, bool eof, bool wait);
 
  public:
   ~gr_udp_source();
 
-  /*!
-   * \brief open a socket specified by the port and ip address info
-   *
-   * Opens a socket, binds to the address, and waits for a connection
-   * over UDP. If any of these fail, the fuction retuns the error and exits.
-   */
-  bool open();
-
-  /*!
-   * \brief Close current socket.
-   *
-   * Shuts down read/write on the socket
-   */
-  void close();
-
   /*! \brief return the PAYLOAD_SIZE of the socket */
   int payload_size() { return d_payload_size; }
 
+  /*! \brief return the port number of the socket */
+  int get_port();
+
   // should we export anything else?
 
   int work(int noutput_items,
index fb39dad68f509aed3635a445ea764c952db1c461..2001f33e9cc8ec3cd2cc2a22fe7af7acbd71e412 100644 (file)
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2007 Free Software Foundation, Inc.
+ * Copyright 2007,2010 Free Software Foundation, Inc.
  * 
  * This file is part of GNU Radio
  * 
 GR_SWIG_BLOCK_MAGIC(gr,udp_source)
 
 gr_udp_source_sptr 
-gr_make_udp_source (size_t itemsize, const char *src, 
-                   unsigned short port_src, int payload_size=1472);
+gr_make_udp_source (size_t itemsize, const char *host, 
+                   unsigned short port, int payload_size=1472,
+                   bool eof=true, bool wait=true) throw (std::runtime_error);
 
 class gr_udp_source : public gr_sync_block
 {
  protected:
-  gr_udp_source (size_t itemsize, const char *src
-                unsigned short port_src, int payload_size);
+  gr_udp_source (size_t itemsize, const char *host
+                unsigned short port, int payload_size, bool eof, bool wait) throw (std::runtime_error);
 
  public:
   ~gr_udp_source ();
 
-  bool open();
-  void close();
   int payload_size() { return d_payload_size; }
-
+  int get_port();
 };
index 3aff89ee7852d60bbb695132f9ba2ac9f82e37bf..341f58812c962bdc6106bdcfbc1266d967904d7b 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright 2004,2005,2006,2008 Free Software Foundation, Inc.
+# Copyright 2004,2005,2006,2008,2010 Free Software Foundation, Inc.
 # 
 # This file is part of GNU Radio
 # 
@@ -97,4 +97,5 @@ noinst_PYTHON =                       \
        qa_unpack_k_bits.py             \
        qa_repeat.py                    \
        qa_scrambler.py                 \
+       qa_udp_sink_source.py           \
        qa_vector_sink_source.py        
diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_udp_sink_source.py b/gnuradio-core/src/python/gnuradio/gr/qa_udp_sink_source.py
new file mode 100755 (executable)
index 0000000..b00b26b
--- /dev/null
@@ -0,0 +1,99 @@
+#!/usr/bin/env python
+#
+# Copyright 2008,2010 Free Software Foundation, Inc.
+# 
+# This file is part of GNU Radio
+# 
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+# 
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING.  If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+# 
+
+from gnuradio import gr, gr_unittest
+from threading import Timer
+
+class test_sink_source(gr_unittest.TestCase):
+
+    def setUp(self):
+        self.tb_snd = gr.top_block()
+        self.tb_rcv = gr.top_block()
+
+    def tearDown(self):
+        self.tb_rcv = None
+        self.tb_snd = None
+        
+    def test_001(self):
+        port = 65500
+
+        n_data = 16
+        src_data = [float(x) for x in range(n_data)]
+        expected_result = tuple(src_data)
+        src = gr.vector_source_f(src_data)
+        udp_snd = gr.udp_sink( gr.sizeof_float, 'localhost', port )
+        self.tb_snd.connect( src, udp_snd )
+
+        udp_rcv = gr.udp_source( gr.sizeof_float, 'localhost', port )
+        dst = gr.vector_sink_f()
+        self.tb_rcv.connect( udp_rcv, dst )
+
+        self.tb_rcv.start()
+        self.tb_snd.run()
+        udp_snd.disconnect()
+        self.timeout = False
+        q = Timer(3.0,self.stop_rcv)
+        q.start()
+        self.tb_rcv.wait()
+        q.cancel()
+
+        result_data = dst.data()
+        self.assertEqual(expected_result, result_data)
+        self.assert_(not self.timeout)
+        
+    def test_002(self):
+        udp_rcv = gr.udp_source( gr.sizeof_float, '0.0.0.0', 0, eof=False )
+        rcv_port = udp_rcv.get_port()
+
+        udp_snd = gr.udp_sink( gr.sizeof_float, '127.0.0.1', 65500 )
+        udp_snd.connect( 'localhost', rcv_port )
+
+        n_data = 16
+        src_data = [float(x) for x in range(n_data)]
+        expected_result = tuple(src_data)
+        src = gr.vector_source_f(src_data)
+        dst = gr.vector_sink_f()
+
+        self.tb_snd.connect( src, udp_snd )
+        self.tb_rcv.connect( udp_rcv, dst )
+
+        self.tb_rcv.start()
+        self.tb_snd.run()
+        udp_snd.disconnect()
+        self.timeout = False
+        q = Timer(3.0,self.stop_rcv)
+        q.start()
+        self.tb_rcv.wait()
+        q.cancel()
+
+        result_data = dst.data()
+        self.assertEqual(expected_result, result_data)
+        self.assert_(self.timeout)  # source ignores EOF?
+
+    def stop_rcv(self):
+        self.timeout = True
+        self.tb_rcv.stop()
+        #print "tb_rcv stopped by Timer"
+        
+if __name__ == '__main__':
+    gr_unittest.main ()
+    
index e59d50834acbfa82fab2967e31ecfc28f0a35b32..eb18a75aa2a993329228c08258fdc83764e4f083 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 #
-# Copyright 2006,2007 Free Software Foundation, Inc.
+# Copyright 2006,2007,2010 Free Software Foundation, Inc.
 # 
 # This file is part of GNU Radio
 # 
@@ -25,30 +25,36 @@ from gnuradio.eng_option import eng_option
 from optparse import OptionParser
 
 class audio_sink(gr.top_block):
-    def __init__(self, src, port, pkt_size, sample_rate):
+    def __init__(self, host, port, pkt_size, sample_rate, eof, wait):
         gr.top_block.__init__(self, "audio_sink")
-        src = gr.udp_source(gr.sizeof_float, src, port, pkt_size)
+        src = gr.udp_source(gr.sizeof_float, host, port, pkt_size,
+                            eof=eof, wait=wait)
         dst = audio.sink(sample_rate)
         self.connect(src, dst)
         
 if __name__ == '__main__':
     parser = OptionParser(option_class=eng_option)
-    parser.add_option("", "--src-name", type="string", default="localhost",
+    parser.add_option("", "--host", type="string", default="0.0.0.0",
                       help="local host name (domain name or IP address)")
-    parser.add_option("", "--src-port", type="int", default=65500,
+    parser.add_option("", "--port", type="int", default=65500,
                       help="port value to listen to for connection")
     parser.add_option("", "--packet-size", type="int", default=1472,
                       help="packet size.")
     parser.add_option("-r", "--sample-rate", type="int", default=32000,
                       help="audio signal sample rate [default=%default]")
+    parser.add_option("", "--no-eof", action="store_true", default=False,
+                      help="don't send EOF on disconnect")
+    parser.add_option("", "--no-wait", action="store_true", default=False,
+                      help="don't wait for source")
     (options, args) = parser.parse_args()
     if len(args) != 0:
         parser.print_help()
         raise SystemExit, 1
 
     # Create an instance of a hierarchical block
-    top_block = audio_sink(options.src_name, options.src_port,
-                           options.packet_size, options.sample_rate)
+    top_block = audio_sink(options.host, options.port,
+                           options.packet_size, options.sample_rate,
+                           not options.no_eof, not options.no_wait)
     
     try:    
         # Run forever
index d7f4f6d9369c41991c539c9d9f2b823a9cb6dec4..5818ccbd8bc30e53b689838bcddd535a3abdeb07 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 #
-# Copyright 2006,2007 Free Software Foundation, Inc.
+# Copyright 2006,2007,2010 Free Software Foundation, Inc.
 # 
 # This file is part of GNU Radio
 # 
@@ -25,32 +25,33 @@ from gnuradio.eng_option import eng_option
 from optparse import OptionParser
 
 class audio_source(gr.top_block):
-    def __init__(self, src, dst, port, pkt_size, sample_rate):
+    def __init__(self, host, port, pkt_size, sample_rate, eof):
         gr.top_block.__init__(self, "audio_source")
         self.audio = audio.source(sample_rate)
-       self.sink = gr.udp_sink(gr.sizeof_float, src, 0, dst, port, pkt_size)
+       self.sink = gr.udp_sink(gr.sizeof_float, host, port, pkt_size, eof=eof)
         self.connect(self.audio, self.sink)
 
 if __name__ == '__main__':
     parser = OptionParser(option_class=eng_option)
-    parser.add_option("", "--src-name", type="string", default="localhost",
-                      help="local host name (domain name or IP address)")
-    parser.add_option("", "--dst-name", type="string", default="localhost",
+    parser.add_option("", "--host", type="string", default="localhost",
                       help="Remote host name (domain name or IP address")
-    parser.add_option("", "--dst-port", type="int", default=65500,
-                      help="port value to connect to")
+    parser.add_option("", "--port", type="int", default=65500,
+                      help="port number to connect to")
     parser.add_option("", "--packet-size", type="int", default=1472,
                       help="packet size.")
     parser.add_option("-r", "--sample-rate", type="int", default=32000 ,
                       help="audio signal sample rate [default=%default]")
+    parser.add_option("", "--no-eof", action="store_true", default=False,
+                      help="don't send EOF on disconnect")
     (options, args) = parser.parse_args()
     if len(args) != 0:
         parser.print_help()
         raise SystemExit, 1
 
     # Create an instance of a hierarchical block
-    top_block = audio_source(options.src_name, options.dst_name, options.dst_port,
-                             options.packet_size, options.sample_rate)
+    top_block = audio_source(options.host, options.port,
+                             options.packet_size, options.sample_rate,
+                             not options.no_eof)
     
     try:    
         # Run forever
index 47d24b9bcfb006764e6180b63cc95503d0e81122..1b9009552e5d7e152169d483036e3f743c571568 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 #
-# Copyright 2006,2007 Free Software Foundation, Inc.
+# Copyright 2006,2007,2010 Free Software Foundation, Inc.
 # 
 # This file is part of GNU Radio
 # 
@@ -25,30 +25,36 @@ from gnuradio.eng_option import eng_option
 from optparse import OptionParser
 
 class dial_tone_sink(gr.top_block):
-    def __init__(self, src, port, pkt_size, sample_rate):
+    def __init__(self, host, port, pkt_size, sample_rate, eof, wait):
         gr.top_block.__init__(self, "dial_tone_sink")
-        udp = gr.udp_source(gr.sizeof_float, src, port, pkt_size)
+        udp = gr.udp_source(gr.sizeof_float, host, port, pkt_size,
+                            eof=eof, wait=wait)
         sink = audio.sink(sample_rate)
         self.connect(udp, sink)
         
 if __name__ == '__main__':
     parser = OptionParser(option_class=eng_option)
-    parser.add_option("", "--src-name", type="string", default="localhost",
+    parser.add_option("", "--host", type="string", default="0.0.0.0",
                       help="local host name (domain name or IP address)")
-    parser.add_option("", "--src-port", type="int", default=65500,
+    parser.add_option("", "--port", type="int", default=65500,
                       help="port value to listen to for connection")
     parser.add_option("", "--packet-size", type="int", default=1472,
                       help="packet size.")
     parser.add_option("-r", "--sample-rate", type="int", default=8000,
                       help="audio signal sample rate [default=%default]")
+    parser.add_option("", "--no-eof", action="store_true", default=False,
+                      help="don't send EOF on disconnect")
+    parser.add_option("", "--no-wait", action="store_true", default=False,
+                      help="don't wait for source")
     (options, args) = parser.parse_args()
     if len(args) != 0:
         parser.print_help()
         raise SystemExit, 1
 
     # Create an instance of a hierarchical block
-    top_block = dial_tone_sink(options.src_name, options.src_port,
-                               options.packet_size, options.sample_rate)
+    top_block = dial_tone_sink(options.host, options.port,
+                               options.packet_size, options.sample_rate,
+                               not options.no_eof, not options.no_wait)
     
     try:    
         # Run forever
index 835f9aafcb34558d97909a6ff21200ff64038a19..766ecf16d85771df360f70f8991d153bfa694957 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 #
-# Copyright 2006,2007 Free Software Foundation, Inc.
+# Copyright 2006,2007,2010 Free Software Foundation, Inc.
 # 
 # This file is part of GNU Radio
 # 
@@ -25,7 +25,7 @@ from gnuradio.eng_option import eng_option
 from optparse import OptionParser
 
 class dial_tone_source(gr.top_block):
-    def __init__(self, src, dst, port, pkt_size, sample_rate):
+    def __init__(self, host, port, pkt_size, sample_rate, eof):
         gr.top_block.__init__(self, "dial_tone_source")
 
         amplitude = 0.3
@@ -35,31 +35,32 @@ class dial_tone_source(gr.top_block):
 
         # Throttle needed here to account for the other side's audio card sampling rate
        thr = gr.throttle(gr.sizeof_float, sample_rate)
-       sink = gr.udp_sink(gr.sizeof_float, src, 0, dst, port, pkt_size)
+       sink = gr.udp_sink(gr.sizeof_float, host, port, pkt_size, eof=eof)
        self.connect(src0, (add, 0))
        self.connect(src1, (add, 1))
        self.connect(add, thr, sink)
 
 if __name__ == '__main__':
     parser = OptionParser(option_class=eng_option)
-    parser.add_option("", "--src-name", type="string", default="localhost",
-                      help="local host name (domain name or IP address)")
-    parser.add_option("", "--dst-name", type="string", default="localhost",
+    parser.add_option("", "--host", type="string", default="localhost",
                       help="Remote host name (domain name or IP address")
-    parser.add_option("", "--dst-port", type="int", default=65500,
-                      help="port value to connect to")
+    parser.add_option("", "--port", type="int", default=65500,
+                      help="port number to connect to")
     parser.add_option("", "--packet-size", type="int", default=1472,
                       help="packet size.")
     parser.add_option("-r", "--sample-rate", type="int", default=8000,
                       help="audio signal sample rate [default=%default]")
+    parser.add_option("", "--no-eof", action="store_true", default=False,
+                      help="don't send EOF on disconnect")
     (options, args) = parser.parse_args()
     if len(args) != 0:
         parser.print_help()
         raise SystemExit, 1
 
     # Create an instance of a hierarchical block
-    top_block = dial_tone_source(options.src_name, options.dst_name, options.dst_port,
-                                 options.packet_size, options.sample_rate)
+    top_block = dial_tone_source(options.host, options.port,
+                                 options.packet_size, options.sample_rate,
+                                 not options.no_eof)
     
     try:    
         # Run forever
@@ -67,4 +68,3 @@ if __name__ == '__main__':
     except KeyboardInterrupt:
         # Ctrl-C exits
         pass
-    
index 981cc598b96178d9c33df76798502bcd2c52d7e9..5d73858a35e8f0ccf60cc541dd4c236136a7415c 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 #
-# Copyright 2006 Free Software Foundation, Inc.
+# Copyright 2006,2010 Free Software Foundation, Inc.
 # 
 # This file is part of GNU Radio
 # 
@@ -25,28 +25,35 @@ from gnuradio.eng_option import eng_option
 from optparse import OptionParser
 
 class vector_sink(gr.top_block):
-    def __init__(self, src, port, pkt_size):
+    def __init__(self, host, port, pkt_size, eof, wait):
         gr.top_block.__init__(self, "vector_sink")
 
-        udp = gr.udp_source(gr.sizeof_float, src, port, pkt_size)
+        udp = gr.udp_source(gr.sizeof_float, host, port, pkt_size,
+                            eof=eof, wait=wait)
         sink = gr.file_sink(gr.sizeof_float, "received.dat")
         self.connect(udp, sink)
 
 if __name__ == "__main__":
     parser = OptionParser(option_class=eng_option)
-    parser.add_option("", "--src-name", type="string", default="localhost",
+    parser.add_option("", "--host", type="string", default="0.0.0.0",
                       help="local host name (domain name or IP address)")
-    parser.add_option("", "--src-port", type="int", default=65500,
+    parser.add_option("", "--port", type="int", default=65500,
                       help="port value to listen to for connection")
     parser.add_option("", "--packet-size", type="int", default=1471,
                       help="packet size.")
+    parser.add_option("", "--no-eof", action="store_true", default=False,
+                      help="don't send EOF on disconnect")
+    parser.add_option("", "--no-wait", action="store_true", default=False,
+                      help="don't wait for source")
     (options, args) = parser.parse_args()
     if len(args) != 0:
         parser.print_help()
         raise SystemExit, 1
     
     # Create an instance of a hierarchical block
-    top_block = vector_sink(options.src_name, options.src_port, options.packet_size)
+    top_block = vector_sink(options.host, options.port,
+                            options.packet_size,
+                            not options.no_eof, not options.no_wait)
     
     try:    
         # Run forever
index e7ec2a461d15bbe15ddb91ff605864faabf74bf0..0e7d678445e90b1a44d3b3f5096ca7dd66878485 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 #
-# Copyright 2006 Free Software Foundation, Inc.
+# Copyright 2006,2010 Free Software Foundation, Inc.
 # 
 # This file is part of GNU Radio
 # 
@@ -25,31 +25,31 @@ from gnuradio.eng_option import eng_option
 from optparse import OptionParser
 
 class vector_source(gr.top_block):
-    def __init__(self, src, dst, port, pkt_size):
+    def __init__(self, host, port, pkt_size, eof):
         gr.top_block.__init__(self, "vector_source")
         data = [i*0.01 for i in range(1000)]
         vec = gr.vector_source_f(data, True)
-        udp = gr.udp_sink(gr.sizeof_float, src, 0, dst, port, pkt_size)
+        udp = gr.udp_sink(gr.sizeof_float, host, port, pkt_size, eof=eof)
         self.connect(vec, udp)
 
 if __name__ == '__main__':
     parser = OptionParser(option_class=eng_option)
-    parser.add_option("", "--src-name", type="string", default="localhost",
-                      help="local host name (domain name or IP address)")
-    parser.add_option("", "--dst-name", type="string", default="localhost",
+    parser.add_option("", "--host", type="string", default="localhost",
                       help="Remote host name (domain name or IP address")
-    parser.add_option("", "--dst-port", type="int", default=65500,
-                      help="port value to connect to")
+    parser.add_option("", "--port", type="int", default=65500,
+                      help="port number to connect to")
     parser.add_option("", "--packet-size", type="int", default=1471,
                       help="packet size.")
+    parser.add_option("", "--no-eof", action="store_true", default=False,
+                      help="don't send EOF on disconnect")
     (options, args) = parser.parse_args()
     if len(args) != 0:
         parser.print_help()
         raise SystemExit, 1
 
 # Create an instance of a hierarchical block
-    top_block = vector_source(options.src_name, options.dst_name,
-                              options.dst_port, options.packet_size)
+    top_block = vector_source(options.host, options.port, options.packet_size,
+                              not options.no_eof)
     
     try:    
         # Run forever
index 4c5ae06823fbee8a2c11959af534cf05aece3f55..4413bfc82de3a559ad004dbc6edc18b284ce862d 100644 (file)
@@ -6,6 +6,6 @@ includedir=@includedir@
 Name: gnuradio-atsc
 Description: The GNU Radio blocks for ATSC decoding
 Requires: gnuradio-core
-Version: @VERSION@
+Version: @LIBVER@
 Libs: -L${libdir} -lgnuradio-atsc
 Cflags: -I${includedir}
index 8aeb80c0a5be7f4b19ee9dbb5bf4a8a22155eae0..bf9c6626adaaeb06b7d5103bc00f1aa6e19b43b7 100644 (file)
@@ -92,8 +92,7 @@ BUILT_SOURCES =                               \
 libgnuradio_atsc_la_LIBADD =                   \
        $(GNURADIO_CORE_LA)
 
-libgnuradio_atsc_la_LDFLAGS = \
-       $(NO_UNDEFINED)
+libgnuradio_atsc_la_LDFLAGS = $(NO_UNDEFINED) $(LTVERSIONFLAGS)
 
 noinst_LTLIBRARIES = libgnuradio-atsc-qa.la
 
index 797bfc024442147381c95828d8bbcdb668564cb3..d5147e6af03a028a238fac00270fd68094728e70 100644 (file)
@@ -6,6 +6,6 @@ includedir=@includedir@
 Name: gnuradio-audio-alsa
 Description: The GNU Radio block for the ALSA sound system
 Requires: gnuradio-core alsa
-Version: @VERSION@
+Version: @LIBVER@
 Libs: -L${libdir} -lgnuradio-audio-alsa
 Cflags: -I${includedir}
index ee7498af48b8a52ef16eb9797e7b63898cea9266..ed92cc197dece844e39c5c9a76f73dc46d51cbef 100644 (file)
@@ -50,8 +50,7 @@ libgnuradio_audio_alsa_la_LIBADD =    \
        $(GNURADIO_CORE_LA)             \
        $(ALSA_LIBS)
 
-libgnuradio_audio_alsa_la_LDFLAGS =    \
-       $(NO_UNDEFINED)
+libgnuradio_audio_alsa_la_LDFLAGS = $(NO_UNDEFINED) $(LTVERSIONFLAGS)
 
 if PYTHON
 ###################################
index eaceaea2f6017fb57eafe45969ce8dd74c82ac76..8fb4a2e0db5bde8fca0a5982f3df1f7800ab5f89 100644 (file)
@@ -6,6 +6,6 @@ includedir=@includedir@
 Name: gnuradio-audio-jack
 Description: GNU Radio blocks for the JACK sound system
 Requires: gnuradio-core jack
-Version: @VERSION@
+Version: @LIBVER@
 Libs: -L${libdir} -lgnuradio-audio-jack
 Cflags: -I${includedir}
index b766ec201294a483badd665539833fb6dad1a1fe..8e0dfe1e386dd9b0597dfa8fee824e4abd4f29ce 100644 (file)
@@ -42,8 +42,7 @@ libgnuradio_audio_jack_la_LIBADD =    \
        $(GNURADIO_CORE_LA)             \
        $(JACK_LIBS)
 
-libgnuradio_audio_jack_la_LDFLAGS =    \
-       $(NO_UNDEFINED)
+libgnuradio_audio_jack_la_LDFLAGS = $(NO_UNDEFINED) $(LTVERSIONFLAGS)
 
 noinst_PYTHON =                        \
        qa_jack.py
index f598ba304ac88b82c1c3818e218bfc05f9d82235..4a215bdabfaf1a4c866fdcbed4ef0321ae942ffd 100644 (file)
@@ -6,6 +6,6 @@ includedir=@includedir@
 Name: gnuradio-audio-oss
 Description: The GNU Radio block for the OSS sound system
 Requires: gnuradio-core
-Version: @VERSION@
+Version: @LIBVER@
 Libs: -L${libdir} -lgnuradio-audio-oss
 Cflags: -I${includedir}
index 6142806395cd9978a2fc9f9afc678f18311e0221..628c9fd9304c52096902d397eff3b697386f7883 100644 (file)
@@ -42,8 +42,7 @@ libgnuradio_audio_oss_la_LIBADD =     \
        $(GNURADIO_CORE_LA)             \
        $(OSS_LIBS)
 
-libgnuradio_audio_oss_la_LDFLAGS =     \
-       $(NO_UNDEFINED)
+libgnuradio_audio_oss_la_LDFLAGS = $(NO_UNDEFINED) $(LTVERSIONFLAGS)
 
 if PYTHON
 ###################################
index 5bf28b8e7e365ae4fea89451243b482e0cbe2e86..ee9df776596607f6809cebafba4b5bfa6e97031f 100644 (file)
@@ -51,7 +51,8 @@ libgnuradio_audio_osx_la_LDFLAGS =    \
        -framework AudioUnit            \
        -framework CoreAudio            \
        -framework AudioToolbox         \
-       $(NO_UNDEFINED)
+       $(NO_UNDEFINED)                 \
+       $(LTVERSIONFLAGS)
 
 if PYTHON
 ###################################
index 8f2c808698bdafdcf51546f3691f36ccd757f02e..0861959650bbe2f67dd5ad3def43da90bd042789 100644 (file)
@@ -6,6 +6,6 @@ includedir=@includedir@
 Name: gnuradio-audio-portaudio
 Description: The GNU Radio block for the PORTAUDIO sound system
 Requires: gnuradio-core
-Version: @VERSION@
+Version: @LIBVER@
 Libs: -L${libdir} -lgnuradio-audio-portaudio
 Cflags: -I${includedir}
index 1df6bbceaf546ddc1e72ae04f39d75ffb419a61f..4fa098dcc48f189d24ec6e415bdd0b355e7b8f47 100644 (file)
@@ -48,8 +48,7 @@ libgnuradio_audio_portaudio_la_LIBADD =       \
        $(GNURADIO_CORE_LA)             \
        $(PORTAUDIO_LIBS)
 
-libgnuradio_audio_portaudio_la_LDFLAGS = \
-       $(NO_UNDEFINED)
+libgnuradio_audio_portaudio_la_LDFLAGS = $(NO_UNDEFINED) $(LTVERSIONFLAGS)
 
 
 if PYTHON
index dc91e140ca00b8e190c31ace6b3d118727a377fd..d3e3f5a85b0f0ade0f29d8e53211b93433935ce5 100644 (file)
@@ -44,7 +44,8 @@ libgnuradio_audio_windows_la_LIBADD = \
 
 libgnuradio_audio_windows_la_LDFLAGS = \
        $(LIBGNURADIO_CORE_EXTRA_LDFLAGS) \
-       $(NO_UNDEFINED)
+       $(NO_UNDEFINED) \
+       $(LTVERSIONFLAGS)
 
 if PYTHON
 ###################################
index 8c320b563162f5f9777930be6db15d0209b8c716..205b40e37c6b6097bfbf210fdbbb08f9278e4ad9 100644 (file)
@@ -6,6 +6,6 @@ includedir=@includedir@
 Name: gnuradio-comedi
 Description: GNU Radio blocks for the comedi library
 Requires: gnuradio-core
-Version: @VERSION@
+Version: @LIBVER@
 Libs: -L${libdir} -lgnuradio-comedi
 Cflags: -I${includedir}
index 462c50ad57221559770cb9fe37c7c00252458217..a55bd175b9d6daf85bf79efe8a9d0f113a386af8 100644 (file)
@@ -47,8 +47,7 @@ libgnuradio_comedi_la_LIBADD =        \
        $(GNURADIO_CORE_LA)     \
        $(COMEDI_LIBS)
 
-libgnuradio_comedi_la_LDFLAGS =        \
-       $(NO_UNDEFINED)
+libgnuradio_comedi_la_LDFLAGS =        $(NO_UNDEFINED) $(LTVERSIONFLAGS)
 
 if PYTHON
 ###################################
index 05623086428aa42039719627c072bb316d0e4517..f5f0c2e64b7dc5279ab6de4422e9a47acc11b17d 100644 (file)
@@ -6,6 +6,6 @@ includedir=@includedir@
 Name: gnuradio-cvsd-vocoder
 Description: GNU Radio blocks implementing a CVSD vocoder
 Requires: gnuradio-core
-Version: @VERSION@
+Version: @LIBVER@
 Libs: -L${libdir} -lgnuradio-cvsd-vocoder
 Cflags: -I${includedir}
index 500d0e858c30fba91291dd80298abf8c851fcd1a..c5957f4acc7cbabd21e7d8e0f33562de877d44f4 100644 (file)
@@ -37,8 +37,7 @@ libgnuradio_cvsd_vocoder_la_SOURCES =         \
 libgnuradio_cvsd_vocoder_la_LIBADD =   \
        $(GNURADIO_CORE_LA)
 
-libgnuradio_cvsd_vocoder_la_LDFLAGS =  \
-       $(NO_UNDEFINED)
+libgnuradio_cvsd_vocoder_la_LDFLAGS = $(NO_UNDEFINED) $(LTVERSIONFLAGS)
 
 if PYTHON
 ###################################
index f44095b473587ad888329e0404fefc2de39a8a1f..63dc156b1162722ce611b382a30617281072ed33 100644 (file)
@@ -52,7 +52,7 @@ libgnuradio_gcell_la_LIBADD = \
        $(GNURADIO_CORE_LA) \
        $(GCELL_LA)
 
-libgnuradio_gcell_la_LDFLAGS = $(NO_UNDEFINED)
+libgnuradio_gcell_la_LDFLAGS = $(NO_UNDEFINED) $(LTVERSIONFLAGS)
 
 if PYTHON
 # ----------------------------------------------------------------
index 43d5c6bad8877cdaa1e906d4cdd3c0d8739fd32d..a799fcd824a5016d9fd7015233e10c48c5b16410 100644 (file)
@@ -6,6 +6,6 @@ includedir=@includedir@
 Name: gnuradio-comedi
 Description: GNU Radio blocks implementing a GSM full rate vocoder
 Requires: gnuradio-core
-Version: @VERSION@
-Libs: -L${libdir} -lgnuradio-gsm-fr-vocoder
+Version: @LIBVER@
+Libs: -L${libdir} -lgnuradio-gsm-fr-vocoder-$@LIBVER@
 Cflags: -I${includedir}
index 3b0270c2f9be5e4d5e05afaa7a24244109af56c0..97d6fc30690a36bef975020d85575fae2bc1974e 100644 (file)
@@ -40,8 +40,7 @@ libgnuradio_gsm_fr_vocoder_la_LIBADD =        \
        $(GNURADIO_CORE_LA)             \
        gsm/libgsm.la
 
-libgnuradio_gsm_fr_vocoder_la_LDFLAGS =        \
-       $(NO_UNDEFINED)
+libgnuradio_gsm_fr_vocoder_la_LDFLAGS =        $(NO_UNDEFINED) $(LTVERSIONFLAGS)
 
 if PYTHON
 # SWIG interface and library
index e628d6b1606f2fb2cb9d62bcc5d52ea302f641db..15a5216981dae8362f78e3cb25c34c81f7a90707 100644 (file)
@@ -27,6 +27,9 @@ modname = howto
 # when going in to non-SWIG libraries
 AM_CXXFLAGS = @autoconf_default_CXXFLAGS@
 
+# Sets ABI version in SONAME and appends -LIBVER to filename
+LTVERSIONFLAGS = -version-info 0:0:0 -release $(LIBVER)
+
 # these flags are used when compiling any CXX file
 AM_CPPFLAGS = \
        $(STD_DEFINES_AND_INCLUDES) \
@@ -37,7 +40,7 @@ AM_CPPFLAGS = \
 # these are used by both SWIG and CXX
 STD_DEFINES_AND_INCLUDES = \
        $(DEFINES) \
-       -I$(abs_top_srcdir)/include \
+       -I$(abs_top_srcdir)/lib \
        -I$(GNURADIO_CORE_INCLUDEDIR) \
        -I$(GNURADIO_CORE_INCLUDEDIR)/swig
 
index dc84c68ef798c6a5000c78c6dd7380d34c9e0218..f32079abda668e5fc8f8de6f226e7b26384e8a03 100755 (executable)
@@ -1,10 +1,10 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
 #   Free Software Foundation, Inc.
 
-timestamp='2009-11-20'
+timestamp='2008-01-23'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -27,16 +27,16 @@ timestamp='2009-11-20'
 # the same distribution terms that you use for the rest of that program.
 
 
-# Originally written by Per Bothner.  Please send patches (context
-# diff format) to <config-patches@gnu.org> and include a ChangeLog
-# entry.
+# Originally written by Per Bothner <per@bothner.com>.
+# Please send patches to <config-patches@gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
 #
 # This script attempts to guess a canonical system name similar to
 # config.sub.  If it succeeds, it prints the system name on stdout, and
 # exits with 0.  Otherwise, it exits with 1.
 #
-# You can get the latest version of this script from:
-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit build system type.
 
 me=`echo "$0" | sed -e 's,.*/,,'`
 
@@ -170,7 +170,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
            arm*|i386|m68k|ns32k|sh3*|sparc|vax)
                eval $set_cc_for_build
                if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
-                       | grep -q __ELF__
+                       | grep __ELF__ >/dev/null
                then
                    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
                    # Return netbsd for either.  FIX?
@@ -324,33 +324,14 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
        case `/usr/bin/uname -p` in
            sparc) echo sparc-icl-nx7; exit ;;
        esac ;;
-    s390x:SunOS:*:*)
-       echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-       exit ;;
     sun4H:SunOS:5.*:*)
        echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
        exit ;;
     sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
        echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
        exit ;;
-    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
-       echo i386-pc-auroraux${UNAME_RELEASE}
-       exit ;;
     i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
-       eval $set_cc_for_build
-       SUN_ARCH="i386"
-       # If there is a compiler, see if it is configured for 64-bit objects.
-       # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
-       # This test works for both compilers.
-       if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
-           if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
-               (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
-               grep IS_64BIT_ARCH >/dev/null
-           then
-               SUN_ARCH="x86_64"
-           fi
-       fi
-       echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+       echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
        exit ;;
     sun4*:SunOS:6*:*)
        # According to config.sub, this is the proper way to canonicalize
@@ -659,7 +640,7 @@ EOF
            # => hppa64-hp-hpux11.23
 
            if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
-               grep -q __LP64__
+               grep __LP64__ >/dev/null
            then
                HP_ARCH="hppa2.0w"
            else
@@ -810,12 +791,12 @@ EOF
     i*:PW*:*)
        echo ${UNAME_MACHINE}-pc-pw32
        exit ;;
-    *:Interix*:*)
+    *:Interix*:[3456]*)
        case ${UNAME_MACHINE} in
            x86)
                echo i586-pc-interix${UNAME_RELEASE}
                exit ;;
-           authenticamd | genuineintel | EM64T)
+           EM64T | authenticamd)
                echo x86_64-unknown-interix${UNAME_RELEASE}
                exit ;;
            IA64)
@@ -825,9 +806,6 @@ EOF
     [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
        echo i${UNAME_MACHINE}-pc-mks
        exit ;;
-    8664:Windows_NT:*)
-       echo x86_64-pc-mks
-       exit ;;
     i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
        # How do we know it's Interix rather than the generic POSIX subsystem?
        # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
@@ -857,20 +835,6 @@ EOF
     i*86:Minix:*:*)
        echo ${UNAME_MACHINE}-pc-minix
        exit ;;
-    alpha:Linux:*:*)
-       case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
-         EV5)   UNAME_MACHINE=alphaev5 ;;
-         EV56)  UNAME_MACHINE=alphaev56 ;;
-         PCA56) UNAME_MACHINE=alphapca56 ;;
-         PCA57) UNAME_MACHINE=alphapca56 ;;
-         EV6)   UNAME_MACHINE=alphaev6 ;;
-         EV67)  UNAME_MACHINE=alphaev67 ;;
-         EV68*) UNAME_MACHINE=alphaev68 ;;
-        esac
-       objdump --private-headers /bin/sh | grep -q ld.so.1
-       if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
-       echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
-       exit ;;
     arm*:Linux:*:*)
        eval $set_cc_for_build
        if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
@@ -893,17 +857,6 @@ EOF
     frv:Linux:*:*)
        echo frv-unknown-linux-gnu
        exit ;;
-    i*86:Linux:*:*)
-       LIBC=gnu
-       eval $set_cc_for_build
-       sed 's/^        //' << EOF >$dummy.c
-       #ifdef __dietlibc__
-       LIBC=dietlibc
-       #endif
-EOF
-       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
-       echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
-       exit ;;
     ia64:Linux:*:*)
        echo ${UNAME_MACHINE}-unknown-linux-gnu
        exit ;;
@@ -913,33 +866,74 @@ EOF
     m68*:Linux:*:*)
        echo ${UNAME_MACHINE}-unknown-linux-gnu
        exit ;;
-    mips:Linux:*:* | mips64:Linux:*:*)
+    mips:Linux:*:*)
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+       #undef CPU
+       #undef mips
+       #undef mipsel
+       #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+       CPU=mipsel
+       #else
+       #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+       CPU=mips
+       #else
+       CPU=
+       #endif
+       #endif
+EOF
+       eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+           /^CPU/{
+               s: ::g
+               p
+           }'`"
+       test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+       ;;
+    mips64:Linux:*:*)
        eval $set_cc_for_build
        sed 's/^        //' << EOF >$dummy.c
        #undef CPU
-       #undef ${UNAME_MACHINE}
-       #undef ${UNAME_MACHINE}el
+       #undef mips64
+       #undef mips64el
        #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
-       CPU=${UNAME_MACHINE}el
+       CPU=mips64el
        #else
        #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
-       CPU=${UNAME_MACHINE}
+       CPU=mips64
        #else
        CPU=
        #endif
        #endif
 EOF
-       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
+       eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+           /^CPU/{
+               s: ::g
+               p
+           }'`"
        test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
        ;;
     or32:Linux:*:*)
        echo or32-unknown-linux-gnu
        exit ;;
-    padre:Linux:*:*)
-       echo sparc-unknown-linux-gnu
+    ppc:Linux:*:*)
+       echo powerpc-unknown-linux-gnu
        exit ;;
-    parisc64:Linux:*:* | hppa64:Linux:*:*)
-       echo hppa64-unknown-linux-gnu
+    ppc64:Linux:*:*)
+       echo powerpc64-unknown-linux-gnu
+       exit ;;
+    alpha:Linux:*:*)
+       case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+         EV5)   UNAME_MACHINE=alphaev5 ;;
+         EV56)  UNAME_MACHINE=alphaev56 ;;
+         PCA56) UNAME_MACHINE=alphapca56 ;;
+         PCA57) UNAME_MACHINE=alphapca56 ;;
+         EV6)   UNAME_MACHINE=alphaev6 ;;
+         EV67)  UNAME_MACHINE=alphaev67 ;;
+         EV68*) UNAME_MACHINE=alphaev68 ;;
+        esac
+       objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+       if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+       echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
        exit ;;
     parisc:Linux:*:* | hppa:Linux:*:*)
        # Look for CPU level
@@ -949,11 +943,8 @@ EOF
          *)    echo hppa-unknown-linux-gnu ;;
        esac
        exit ;;
-    ppc64:Linux:*:*)
-       echo powerpc64-unknown-linux-gnu
-       exit ;;
-    ppc:Linux:*:*)
-       echo powerpc-unknown-linux-gnu
+    parisc64:Linux:*:* | hppa64:Linux:*:*)
+       echo hppa64-unknown-linux-gnu
        exit ;;
     s390:Linux:*:* | s390x:Linux:*:*)
        echo ${UNAME_MACHINE}-ibm-linux
@@ -976,6 +967,69 @@ EOF
     xtensa*:Linux:*:*)
        echo ${UNAME_MACHINE}-unknown-linux-gnu
        exit ;;
+    i*86:Linux:*:*)
+       # The BFD linker knows what the default object file format is, so
+       # first see if it will tell us. cd to the root directory to prevent
+       # problems with other programs or directories called `ld' in the path.
+       # Set LC_ALL=C to ensure ld outputs messages in English.
+       ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
+                        | sed -ne '/supported targets:/!d
+                                   s/[         ][      ]*/ /g
+                                   s/.*supported targets: *//
+                                   s/ .*//
+                                   p'`
+        case "$ld_supported_targets" in
+         elf32-i386)
+               TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
+               ;;
+         a.out-i386-linux)
+               echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+               exit ;;
+         coff-i386)
+               echo "${UNAME_MACHINE}-pc-linux-gnucoff"
+               exit ;;
+         "")
+               # Either a pre-BFD a.out linker (linux-gnuoldld) or
+               # one that does not give us useful --help.
+               echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
+               exit ;;
+       esac
+       # Determine whether the default compiler is a.out or elf
+       eval $set_cc_for_build
+       sed 's/^        //' << EOF >$dummy.c
+       #include <features.h>
+       #ifdef __ELF__
+       # ifdef __GLIBC__
+       #  if __GLIBC__ >= 2
+       LIBC=gnu
+       #  else
+       LIBC=gnulibc1
+       #  endif
+       # else
+       LIBC=gnulibc1
+       # endif
+       #else
+       #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
+       LIBC=gnu
+       #else
+       LIBC=gnuaout
+       #endif
+       #endif
+       #ifdef __dietlibc__
+       LIBC=dietlibc
+       #endif
+EOF
+       eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+           /^LIBC/{
+               s: ::g
+               p
+           }'`"
+       test x"${LIBC}" != x && {
+               echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+               exit
+       }
+       test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
+       ;;
     i*86:DYNIX/ptx:4*:*)
        # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
        # earlier versions are messed up and put the nodename in both
@@ -1004,7 +1058,7 @@ EOF
     i*86:syllable:*:*)
        echo ${UNAME_MACHINE}-pc-syllable
        exit ;;
-    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
+    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
        echo i386-unknown-lynxos${UNAME_RELEASE}
        exit ;;
     i*86:*DOS:*:*)
@@ -1048,11 +1102,8 @@ EOF
     pc:*:*:*)
        # Left here for compatibility:
         # uname -m prints for DJGPP always 'pc', but it prints nothing about
-        # the processor, so we play safe by assuming i586.
-       # Note: whatever this is, it MUST be the same as what config.sub
-       # prints for the "djgpp" host, or else GDB configury will decide that
-       # this is a cross-build.
-       echo i586-pc-msdosdjgpp
+        # the processor, so we play safe by assuming i386.
+       echo i386-pc-msdosdjgpp
         exit ;;
     Intel:Mach:3*:*)
        echo i386-pc-mach3
@@ -1090,16 +1141,6 @@ EOF
     3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
         /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
           && { echo i486-ncr-sysv4; exit; } ;;
-    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
-       OS_REL='.3'
-       test -r /etc/.relid \
-           && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
-       /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
-           && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
-       /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
-           && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
-       /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
-           && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
     m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
        echo m68k-unknown-lynxos${UNAME_RELEASE}
        exit ;;
@@ -1112,7 +1153,7 @@ EOF
     rs6000:LynxOS:2.*:*)
        echo rs6000-unknown-lynxos${UNAME_RELEASE}
        exit ;;
-    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
        echo powerpc-unknown-lynxos${UNAME_RELEASE}
        exit ;;
     SM[BE]S:UNIX_SV:*:*)
@@ -1175,9 +1216,6 @@ EOF
     BePC:BeOS:*:*)     # BeOS running on Intel PC compatible.
        echo i586-pc-beos
        exit ;;
-    BePC:Haiku:*:*)    # Haiku running on Intel PC compatible.
-       echo i586-pc-haiku
-       exit ;;
     SX-4:SUPER-UX:*:*)
        echo sx4-nec-superux${UNAME_RELEASE}
        exit ;;
@@ -1205,16 +1243,6 @@ EOF
     *:Darwin:*:*)
        UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
        case $UNAME_PROCESSOR in
-           i386)
-               eval $set_cc_for_build
-               if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
-                 if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
-                     (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
-                     grep IS_64BIT_ARCH >/dev/null
-                 then
-                     UNAME_PROCESSOR="x86_64"
-                 fi
-               fi ;;
            unknown) UNAME_PROCESSOR=powerpc ;;
        esac
        echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
@@ -1296,9 +1324,6 @@ EOF
     i*86:rdos:*:*)
        echo ${UNAME_MACHINE}-pc-rdos
        exit ;;
-    i*86:AROS:*:*)
-       echo ${UNAME_MACHINE}-pc-aros
-       exit ;;
 esac
 
 #echo '(No uname command or uname output not recognized.)' 1>&2
index 2a55a50751c1aaf99de876b404ed613005dfcce1..6759825a5b7fcf64476b4398dc0e30b3090b925c 100755 (executable)
@@ -1,10 +1,10 @@
 #! /bin/sh
 # Configuration validation subroutine script.
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
 #   Free Software Foundation, Inc.
 
-timestamp='2009-11-20'
+timestamp='2008-01-16'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
@@ -32,16 +32,13 @@ timestamp='2009-11-20'
 
 
 # Please send patches to <config-patches@gnu.org>.  Submit a context
-# diff and a properly formatted GNU ChangeLog entry.
+# diff and a properly formatted ChangeLog entry.
 #
 # Configuration subroutine to validate and canonicalize a configuration type.
 # Supply the specified configuration type as an argument.
 # If it is invalid, we print an error message on stderr and exit with code 1.
 # Otherwise, we print the canonical config type on stdout and succeed.
 
-# You can get the latest version of this script from:
-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
-
 # This file is supposed to be the same for all GNU packages
 # and recognize all the CPU types, system types and aliases
 # that are meaningful with *any* GNU software.
@@ -125,7 +122,6 @@ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
 case $maybe_os in
   nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
   uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
-  kopensolaris*-gnu* | \
   storm-chaos* | os2-emx* | rtmk-nova*)
     os=-$maybe_os
     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
@@ -152,13 +148,10 @@ case $os in
        -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
        -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
        -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-       -apple | -axis | -knuth | -cray | -microblaze)
+       -apple | -axis | -knuth | -cray)
                os=
                basic_machine=$1
                ;;
-        -bluegene*)
-               os=-cnk
-               ;;
        -sim | -cisco | -oki | -wec | -winbond)
                os=
                basic_machine=$1
@@ -256,16 +249,13 @@ case $basic_machine in
        | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
        | i370 | i860 | i960 | ia64 \
        | ip2k | iq2000 \
-       | lm32 \
        | m32c | m32r | m32rle | m68000 | m68k | m88k \
-       | maxq | mb | microblaze | mcore | mep | metag \
+       | maxq | mb | microblaze | mcore | mep \
        | mips | mipsbe | mipseb | mipsel | mipsle \
        | mips16 \
        | mips64 | mips64el \
-       | mips64octeon | mips64octeonel \
-       | mips64orion | mips64orionel \
-       | mips64r5900 | mips64r5900el \
        | mips64vr | mips64vrel \
+       | mips64orion | mips64orionel \
        | mips64vr4100 | mips64vr4100el \
        | mips64vr4300 | mips64vr4300el \
        | mips64vr5000 | mips64vr5000el \
@@ -278,7 +268,6 @@ case $basic_machine in
        | mipsisa64sr71k | mipsisa64sr71kel \
        | mipstx39 | mipstx39el \
        | mn10200 | mn10300 \
-       | moxie \
        | mt \
        | msp430 \
        | nios | nios2 \
@@ -287,22 +276,20 @@ case $basic_machine in
        | pdp10 | pdp11 | pj | pjl \
        | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
        | pyramid \
-       | rx \
        | score \
-       | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+       | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
        | sh64 | sh64le \
        | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
        | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
        | spu | strongarm \
        | tahoe | thumb | tic4x | tic80 | tron \
-       | ubicom32 \
        | v850 | v850e \
        | we32k \
        | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
-       | z8k | z80)
+       | z8k)
                basic_machine=$basic_machine-unknown
                ;;
-       m6811 | m68hc11 | m6812 | m68hc12 | picochip)
+       m6811 | m68hc11 | m6812 | m68hc12)
                # Motorola 68HC11/12.
                basic_machine=$basic_machine-unknown
                os=-none
@@ -342,17 +329,14 @@ case $basic_machine in
        | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
        | i*86-* | i860-* | i960-* | ia64-* \
        | ip2k-* | iq2000-* \
-       | lm32-* \
        | m32c-* | m32r-* | m32rle-* \
        | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
-       | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
+       | m88110-* | m88k-* | maxq-* | mcore-* \
        | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
        | mips16-* \
        | mips64-* | mips64el-* \
-       | mips64octeon-* | mips64octeonel-* \
-       | mips64orion-* | mips64orionel-* \
-       | mips64r5900-* | mips64r5900el-* \
        | mips64vr-* | mips64vrel-* \
+       | mips64orion-* | mips64orionel-* \
        | mips64vr4100-* | mips64vr4100el-* \
        | mips64vr4300-* | mips64vr4300el-* \
        | mips64vr5000-* | mips64vr5000el-* \
@@ -373,22 +357,21 @@ case $basic_machine in
        | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
        | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
        | pyramid-* \
-       | romp-* | rs6000-* | rx-* \
-       | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+       | romp-* | rs6000-* \
+       | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
        | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
        | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
        | sparclite-* \
        | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
        | tahoe-* | thumb-* \
-       | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
+       | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
        | tron-* \
-       | ubicom32-* \
        | v850-* | v850e-* | vax-* \
        | we32k-* \
        | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
        | xstormy16-* | xtensa*-* \
        | ymp-* \
-       | z8k-* | z80-*)
+       | z8k-*)
                ;;
        # Recognize the basic CPU types without company name, with glob match.
        xtensa*)
@@ -456,10 +439,6 @@ case $basic_machine in
                basic_machine=m68k-apollo
                os=-bsd
                ;;
-       aros)
-               basic_machine=i386-pc
-               os=-aros
-               ;;
        aux)
                basic_machine=m68k-apple
                os=-aux
@@ -476,18 +455,10 @@ case $basic_machine in
                basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
                os=-linux
                ;;
-       bluegene*)
-               basic_machine=powerpc-ibm
-               os=-cnk
-               ;;
        c90)
                basic_machine=c90-cray
                os=-unicos
                ;;
-        cegcc)
-               basic_machine=arm-unknown
-               os=-cegcc
-               ;;
        convex-c1)
                basic_machine=c1-convex
                os=-bsd
@@ -555,10 +526,6 @@ case $basic_machine in
                basic_machine=m88k-motorola
                os=-sysv3
                ;;
-       dicos)
-               basic_machine=i686-pc
-               os=-dicos
-               ;;
        djgpp)
                basic_machine=i586-pc
                os=-msdosdjgpp
@@ -732,9 +699,6 @@ case $basic_machine in
                basic_machine=ns32k-utek
                os=-sysv
                ;;
-        microblaze)
-               basic_machine=microblaze-xilinx
-               ;;
        mingw32)
                basic_machine=i386-pc
                os=-mingw32
@@ -1164,10 +1128,6 @@ case $basic_machine in
                basic_machine=z8k-unknown
                os=-sim
                ;;
-       z80-*-coff)
-               basic_machine=z80-unknown
-               os=-sim
-               ;;
        none)
                basic_machine=none-none
                os=-none
@@ -1206,7 +1166,7 @@ case $basic_machine in
        we32k)
                basic_machine=we32k-att
                ;;
-       sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
+       sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
                basic_machine=sh-unknown
                ;;
        sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
@@ -1256,9 +1216,6 @@ case $os in
         # First match some system type aliases
         # that might get confused with valid system types.
        # -solaris* is a basic system type, with this one exception.
-        -auroraux)
-               os=-auroraux
-               ;;
        -solaris1 | -solaris1.*)
                os=`echo $os | sed -e 's|solaris1|sunos4|'`
                ;;
@@ -1279,11 +1236,10 @@ case $os in
        # Each alternative MUST END IN A *, to match a version number.
        # -sysv* is not here because it comes later, after sysvr4.
        -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
-             | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
-             | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
-             | -sym* | -kopensolaris* \
+             | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+             | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
              | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
-             | -aos* | -aros* \
+             | -aos* \
              | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
              | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
              | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
@@ -1292,7 +1248,7 @@ case $os in
              | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
              | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
              | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
-             | -chorusos* | -chorusrdb* | -cegcc* \
+             | -chorusos* | -chorusrdb* \
              | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
              | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
              | -uxpv* | -beos* | -mpeix* | -udk* \
@@ -1302,7 +1258,7 @@ case $os in
              | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
              | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
              | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
-             | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
+             | -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
        # Remember, each alternative MUST END IN *, to match a version number.
                ;;
        -qnx*)
@@ -1432,9 +1388,6 @@ case $os in
        -zvmoe)
                os=-zvmoe
                ;;
-       -dicos*)
-               os=-dicos
-               ;;
        -none)
                ;;
        *)
@@ -1632,7 +1585,7 @@ case $basic_machine in
                        -sunos*)
                                vendor=sun
                                ;;
-                       -cnk*|-aix*)
+                       -aix*)
                                vendor=ibm
                                ;;
                        -beos*)
index 5fe424808c5d84d34d8bdf97b01a6958cb882a9d..c4f1ea0c027eb532f55abc2f98e142c80acbea5c 100644 (file)
@@ -1,4 +1,4 @@
-dnl Copyright 2009 Free Software Foundation, Inc.
+dnl Copyright 2009,2010 Free Software Foundation, Inc.
 dnl 
 dnl This file is part of GNU Radio
 dnl 
@@ -24,12 +24,40 @@ AC_DEFUN([GR_GIT],[
   
   dnl If it exists, get either 'git describe' or fallback to current commit
   if test x$GIT != x ; then
-    if (cd $srcdir && $GIT describe >/dev/null 2>&1); then
-      GIT_VERSION=`cd $srcdir && $GIT describe --abbrev=8 | cut -f 2- -d '-'`
-    else
-      if (cd $srcdir && $GIT describe --always --abbrev=8 >/dev/null 2>&1); then
-        GIT_VERSION=`cd $srcdir && $GIT describe --always --abbrev=8`
+    AC_MSG_CHECKING([existence of git version control directory])
+    if test -d $srcdir/.git ; then
+      AC_MSG_RESULT([ok])
+      AC_MSG_CHECKING([git description of current commit])
+      if (cd $srcdir && $GIT describe >/dev/null 2>&1); then
+        GIT_DESCRIBE=`cd $srcdir && $GIT describe --abbrev=8 --long`
+        # Release candidate tags create an extra -rcX field
+       case $GIT_DESCRIBE in
+         *-*-*-*)
+           GIT_TAG=`echo $GIT_DESCRIBE | cut -f -2 -d '-'`
+           GIT_SEQNO=`echo $GIT_DESCRIBE | cut -f 3 -d '-'`
+           GIT_COMMIT=`echo $GIT_DESCRIBE | cut -f 4 -d '-' | cut -f 2- -d 'g'`
+           ;;
+         *-*-*)
+           GIT_TAG=`echo $GIT_DESCRIBE | cut -f 1 -d '-'`
+           GIT_SEQNO=`echo $GIT_DESCRIBE | cut -f 2 -d '-'`
+           GIT_COMMIT=`echo $GIT_DESCRIBE | cut -f 3 -d '-' | cut -f 2- -d 'g'`
+           ;;
+       esac
+
+       AC_MSG_RESULT([$GIT_DESCRIBE])
+      else
+        AC_MSG_RESULT([no tag in history, using current commit])
+       GIT_TAG=''
+       GIT_SEQNO=''
+       GIT_COMMIT=`cd $srcdir && $GIT describe --always --abbrev=8`
       fi
+    else
+      AC_MSG_RESULT([not found])
     fi
+
+    AC_SUBST([GIT_DESCRIBE])
+    AC_SUBST([GIT_TAG])
+    AC_SUBST([GIT_SEQNO])
+    AC_SUBST([GIT_COMMIT])
   fi
 ])
index 489f780345f4b289e48fa3efa74ceb1a3f38a0b3..a7a202238dc0559050d4bf4eabe18c6ed39c9060 100644 (file)
@@ -1,4 +1,4 @@
-dnl Copyright 2009 Free Software Foundation, Inc.
+dnl Copyright 2009,2010 Free Software Foundation, Inc.
 dnl 
 dnl This file is part of GNU Radio
 dnl 
@@ -31,39 +31,43 @@ AC_DEFUN([GR_VERSION],[
   dnl The last two fields can have 'git' instead of a number to indicate
   dnl that this branch is between versions.
   . $srcdir/version.sh
-  RELEASE=$MAJOR_VERSION.$API_COMPAT
   
   dnl Get git version if available
   GR_GIT
 
   dnl Test if we should use git version
   if test "$MINOR_VERSION" == "git"; then
-    dnl 3.3git-xxx-gxxxxxxxx
-    RELEASE=$RELEASE$MINOR_VERSION
-    DOCVER=$RELEASE
-    if test "$GIT_VERSION" != "" ; then
-      RELEASE=$RELEASE-$GIT_VERSION
-    fi
+    dnl RELEASE: 3.3git-xxx-gxxxxxxxx
+    dnl DOCVER:  3.3git
+    dnl LIBVER:  3.3git
+    RELEASE=$GIT_DESCRIBE
+    DOCVER=$MAJOR_VERSION.$API_COMPAT$MINOR_VERSION
+    LIBVER=$MAJOR_VERSION.$API_COMPAT$MINOR_VERSION
   else
     if test "$MAINT_VERSION" == "git" ; then
-      dnl 3.3.1git-xxx-gxxxxxxxx
-      RELEASE=$RELEASE.$MINOR_VERSION$MAINT_VERSION
-      DOCVER=$RELEASE
-      if test "$GIT_VERSION" != "" ; then
-        RELEASE=$RELEASE-$GIT_VERSION
-      fi
+      dnl RELEASE: 3.3.1git-xxx-gxxxxxxxx
+      dnl DOCVER:  3.3.1git
+      dnl LIBVER:  3.3.1git
+      RELEASE=$GIT_DESCRIBE
+      DOCVER=$MAJOR_VERSION.$API_COMPAT.$MINOR_VERSION$MAINT_VERSION
+      LIBVER=$MAJOR_VERSION.$API_COMPAT.$MINOR_VERSION$MAINT_VERSION
     else
       dnl This is a numbered release.
-      RELEASE=$RELEASE.$MINOR_VERSION
+      dnl RELEASE: 3.3.1{.x}
+      dnl DOCVER:  3.3.1{.x}
+      dnl LIBVER:  3.3.1{.x}
+      RELEASE=$MAJOR_VERSION.$API_COMPAT.$MINOR_VERSION
       if test "$MAINT_VERSION" != "0"; then
         RELEASE=$RELEASE.$MAINT_VERSION
       fi
 
       DOCVER=$RELEASE
+      LIBVER=$RELEASE
     fi
   fi
 
   AC_MSG_NOTICE([GNU Radio Release $RELEASE])
   AC_SUBST(RELEASE)
   AC_SUBST(DOCVER)
+  AC_SUBST(LIBVER)
 ])
index 2e76ee453c085228e3fac456fda95f2ee774568a..f0a18358f0b4ede68704e182254527e955eda12f 100644 (file)
@@ -42,8 +42,7 @@ libgnuradio_howto_la_SOURCES = \
 libgnuradio_howto_la_LIBADD = \
        $(GNURADIO_CORE_LA)
 
-libgnuradio_howto_la_LDFLAGS = \
-       $(NO_UNDEFINED)
+libgnuradio_howto_la_LDFLAGS = $(NO_UNDEFINED) $(LTVERSIONFLAGS)
 
 # ----------------------------------------------------------------
 # howto C++ QA library: libgnuradio-howto-qa.so (not installed)
index 5b50509e17d1198b745013807e1aa0bf6e8cedad..2c32539c717a0de2176ed922c28b27edd0a55317 100644 (file)
@@ -28,6 +28,30 @@ echo $PYTHONPATH
 
 export PYTHONPATH
 
+case "@host_os@" in
+  darwin*)
+    # FIXME: Code for Darwin guessed but not tested
+    # Special Code for executing on Darwin / Mac OS X only
+    if [ "$DYLD_LIBRARY_PATH" = "" ]
+    then
+       DYLD_LIBRARY_PATH=$libbld/.libs
+    else
+       DYLD_LIBRARY_PATH=$libbld/.libs:$DYLD_LIBRARY_PATH
+    fi
+    export DYLD_LIBRARY_PATH
+    ;;
+  cygwin*|win*|mingw*)
+    # Special Code for executing on Win32 variants only
+    if [ "$PATH" = "" ]
+    then
+       PATH=$libbld/.libs
+    else
+       PATH=$libbld/.libs:$PATH
+    fi
+    export PATH
+    ;;
+esac
+
 #
 # This is the simple part...
 # Run everything that matches qa_*.py and return the final result.
index 7f533bd29cbf61657008b482e4678ba256571997..01a47b5d9233cedff83f6428b8f8d7130b2d4db2 100644 (file)
@@ -1,4 +1,4 @@
 MAJOR_VERSION=3
 API_COMPAT=3
-MINOR_VERSION=0-rc0
+MINOR_VERSION=0
 MAINT_VERSION=0
index 8c320b563162f5f9777930be6db15d0209b8c716..5654207189e202b207eb77d4bf6e95a88e799c54 100644 (file)
@@ -4,8 +4,8 @@ libdir=@libdir@
 includedir=@includedir@
 
 Name: gnuradio-comedi
-Description: GNU Radio blocks for the comedi library
+Description: GNU Radio blocks for the Softronics MSDD 6000
 Requires: gnuradio-core
-Version: @VERSION@
-Libs: -L${libdir} -lgnuradio-comedi
+Version: @LIBVER@
+Libs: -L${libdir} -lgnuradio-msdd6000
 Cflags: -I${includedir}
index 7744395f34cac4dff90bc424bc48907b2a165e36..f6dbd2fb816822e46c57582530649793b1141e7c 100644 (file)
@@ -35,6 +35,9 @@ grinclude_HEADERS =                   \
 lib_LTLIBRARIES = libgnuradio-msdd6000.la \
        libgnuradio-msdd6000_rs.la
 
+libgnuradio_msdd6000_la_LDFLAGS = $(NO_UNDEFINED) $(LTVERSIONFLAGS)
+libgnuradio_msdd6000_rs_la_LDFLAGS = $(NO_UNDEFINED) $(LTVERSIONFLAGS)
+
 libgnuradio_msdd6000_la_SOURCES =      \
        msdd_source_simple.cc           \
        msdd6000.cc
@@ -47,14 +50,9 @@ libgnuradio_msdd6000_rs_la_SOURCES =         \
 libgnuradio_msdd6000_la_LIBADD =       \
        $(GNURADIO_CORE_LA)
 
-libgnuradio_msdd6000_la_LDFLAGS =      \
-       $(NO_UNDEFINED)
-
 libgnuradio_msdd6000_rs_la_LIBADD =    \
        $(GNURADIO_CORE_LA)
 
-libgnuradio_msdd6000_rs_la_LDFLAGS =   \
-       $(NO_UNDEFINED)
 
 if PYTHON
 #################################
index f01bbfab89c46bf21e086ffe294994fce274ae72..fdc1476cd10cbc7a0839ef4edf9446d200e3b8a3 100644 (file)
@@ -39,7 +39,7 @@ noinst_HEADERS = \
 libgnuradio_noaa_la_LIBADD = \
        $(GNURADIO_CORE_LA)
 
-libgnuradio_noaa_la_LDFLAGS = $(NO_UNDEFINED) -version-info 0:0:0
+libgnuradio_noaa_la_LDFLAGS = $(NO_UNDEFINED) $(LTVERSIONFLAGS)
 
 grinclude_HEADERS = \
        noaa_hrpt_decoder.h \
index 35516b6eda0d199aeaa0516465b11ea41316949c..6fda2d2f29f9cc9ed891bc395e515074190db649 100644 (file)
@@ -6,6 +6,6 @@ includedir=@includedir@
 Name: gnuradio-comedi
 Description: GNU Radio blocks implementing a FLEX pager decoder
 Requires: gnuradio-core
-Version: @VERSION@
+Version: @LIBVER@
 Libs: -L${libdir} -lgnuradio-pager
 Cflags: -I${includedir}
index 1d8a43b3c831fd4073469cd7ac309fe1da09ee04..29c82ebe8839c4986a8e6548ccf36871cf83ffe3 100644 (file)
@@ -49,5 +49,4 @@ libgnuradio_pager_la_SOURCES = \
 libgnuradio_pager_la_LIBADD =  \
        $(GNURADIO_CORE_LA)
 
-libgnuradio_pager_la_LDFLAGS = \
-       $(NO_UNDEFINED)
+libgnuradio_pager_la_LDFLAGS = $(NO_UNDEFINED) $(LTVERSIONFLAGS)
index 814bee1369ef033798263482e6eac1c3aff1e5e2..6d4a91257bfef9a6970529df98b71c3f2b3e98e6 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright 2008,2009 Free Software Foundation, Inc.
+# Copyright 2008,2009,2010 Free Software Foundation, Inc.
 # 
 # This file is part of GNU Radio
 # 
@@ -54,7 +54,6 @@ libgnuradio_qtgui_la_SOURCES =        \
        SpectrumGUIClass.cc                     \
        spectrumUpdateEvents.cc                 \
        plot_waterfall.cc                       \
-       $(QMAKE_SOURCES)                        \
        qtgui_sink_c.cc                         \
        qtgui_sink_f.cc
 
@@ -75,6 +74,8 @@ grinclude_HEADERS =                   \
        qtgui_sink_c.h                  \
        qtgui_sink_f.h
 
+nodist_libqtsrc_la_SOURCES = $(QMAKE_SOURCES)
+
 %_moc.cc : %.h
        $(QT_MOC_EXEC) -DQT_SHARED -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -p $(srcdir) $< -o $@
 
@@ -82,7 +83,7 @@ grinclude_HEADERS =                   \
        $(QT_UIC_EXEC) $< -o $@
 
 # magic flags
-libgnuradio_qtgui_la_LDFLAGS = $(NO_UNDEFINED) -version-info 0:0:0
+libgnuradio_qtgui_la_LDFLAGS = $(NO_UNDEFINED) $(LTVERSIONFLAGS)
 
 libgnuradio_qtgui_la_LIBADD =          \
        $(GNURADIO_CORE_LA)     \
index 6e34ce5b1772d6c735eb79e9fa5c81b19d3a1945..247e0ae91a5b733157a3cdfd844c9c8bfee9365e 100644 (file)
@@ -3,6 +3,7 @@
 
 #include <qwt_raster_data.h>
 #include <qwt3d_function.h>
+#include <inttypes.h>
 
 class Waterfall3DDisplayPlot;
 
index 8c320b563162f5f9777930be6db15d0209b8c716..618667c4211b255b369a2414ab90a335c5d958ef 100644 (file)
@@ -3,9 +3,9 @@ exec_prefix=@exec_prefix@
 libdir=@libdir@
 includedir=@includedir@
 
-Name: gnuradio-comedi
-Description: GNU Radio blocks for the comedi library
+Name: gnuradio-trellis
+Description: GNU Radio blocks for trellis coded modulation
 Requires: gnuradio-core
-Version: @VERSION@
-Libs: -L${libdir} -lgnuradio-comedi
+Version: @LIBVER@
+Libs: -L${libdir} -lgnuradio-trellis
 Cflags: -I${includedir}
index 58115de254c4db817684f0a943d57659bf3a5068..3e1803554b530edb1a806b7ff6daac3c0925d9f5 100644 (file)
@@ -82,10 +82,7 @@ libgnuradio_trellis_la_SOURCES =     \
 libgnuradio_trellis_la_LIBADD =        \
        $(GNURADIO_CORE_LA)
 
-libgnuradio_trellis_la_LDFLAGS =       \
-       $(NO_UNDEFINED)
-
-
+libgnuradio_trellis_la_LDFLAGS = $(NO_UNDEFINED) $(LTVERSIONFLAGS)
 
 
 if PYTHON
index 6c1d75d439cbbd9c5176d8f82b3d860eddb80e6d..b1f33f41beee9c3eb78162d19a7ed8bc78ee409d 100644 (file)
@@ -6,6 +6,6 @@ includedir=@includedir@/gnuradio
 Name: gnuradio-usrp
 Description: GNU Software Radio support for Universal Software Radio Peripheral
 Requires: gnuradio-core usrp
-Version: @VERSION@
+Version: @LIBVER@
 Libs: -L${libdir} -lgnuradio-usrp
 Cflags: -I${includedir}
index 3d1cc17543682c5601eb92dbf0d74b6a1084d3ed..572a22485b89d7b8863bf215c8668f568c76b433 100644 (file)
@@ -56,7 +56,7 @@ libgnuradio_usrp_la_LIBADD = \
        $(GNURADIO_CORE_LA) \
        $(USRP_LA)                      
 
-libgnuradio_usrp_la_LDFLAGS = $(NO_UNDEFINED) -version-info 0:0:0
+libgnuradio_usrp_la_LDFLAGS = $(NO_UNDEFINED) $(LTVERSIONFLAGS)
 
 grinclude_HEADERS = \
        usrp_base.h \
index 403e5f1c912eda8b8ed83782256a1a82660ef06a..2222badd7ddc1c2321c0fc24df83b4bb1fbdc0ad 100644 (file)
@@ -6,6 +6,6 @@ includedir=@includedir@/gnuradio
 Name: gnuradio-usrp2
 Description: GNU Software Radio support for Universal Software Radio Peripheral 2
 Requires: gnuradio-core usrp2
-Version: @VERSION@
+Version: @LIBVER@
 Libs: -L${libdir} -lgnuradio-usrp2
 Cflags: -I${includedir}
index 8425c497caff94b1c532282f2e0a23c12e6b2709..03b6d0dd9d15c0747c1ef32201efe66aca95031a 100644 (file)
@@ -50,6 +50,8 @@ AM_CPPFLAGS = \
 
 lib_LTLIBRARIES = libgnuradio-usrp2.la
 
+libgnuradio_usrp2_la_LDFLAGS = $(LTVERSIONFLAGS)
+
 libgnuradio_usrp2_la_SOURCES = \
        rx_16sc_handler.cc \
        rx_32fc_handler.cc \
index d1fa091f73f6d8c69e5409dfe688899be207683e..2a79fad44b8f5831a4dee3e96b97b2740254000b 100644 (file)
@@ -32,6 +32,7 @@
 
 %include <usrp2/tune_result.h>
 %include <usrp2/mimo_config.h>
+%include <usrp2/metadata.h>
 
 %template(uint32_t_vector) std::vector<uint32_t>;
 
@@ -163,6 +164,7 @@ public:
   bool write_gpio(uint16_t value, uint16_t mask);
   %rename(_real_read_gpio) read_gpio;
   bool read_gpio(uint16_t *value);
+  bool start_streaming_at(usrp2::fpga_timestamp time);
 };
 
 // ----------------------------------------------------------------
index 1e7c54dcdb16d8c0cb62f0281c39af9303b0c3bf..75cc1f4a6bebb5857ce4fe1ee9df03f2f8680c5c 100644 (file)
@@ -67,12 +67,20 @@ usrp2_sink_16sc::work(int noutput_items,
     return 0;
 
   usrp2::tx_metadata metadata;
-  metadata.timestamp = -1;
-  metadata.send_now = 1;
+
+  // Set TX metadata to either start time or now
+  if (d_should_wait == true) {
+    metadata.timestamp = d_tx_time;
+    metadata.send_now = 0;
+    d_should_wait = false;
+  }
+  else {
+    metadata.timestamp = -1;
+    metadata.send_now = 1;
+  }
   metadata.start_of_burst = 1;
 
-  bool ok = d_u2->tx_16sc(0,  // FIXME: someday, streams will have channel numbers
-                         in, noutput_items, &metadata);
+  bool ok = d_u2->tx_16sc(0, in, noutput_items, &metadata);
   if (!ok){
     std::cerr << "usrp2_sink_16sc: tx_16sc failed" << std::endl;
     return -1; // say we're done
index b1e28a8297ee83468801a8ebd57a43e916d86938..fa75b380571dc960fe4ea56449917f2d5c295362 100644 (file)
@@ -67,12 +67,20 @@ usrp2_sink_32fc::work(int noutput_items,
     return 0;
 
   usrp2::tx_metadata metadata;
-  metadata.timestamp = -1;
-  metadata.send_now = 1;
+
+  // Set TX metadata to either start time or now
+  if (d_should_wait == true) {
+    metadata.timestamp = d_tx_time;
+    metadata.send_now = 0;
+    d_should_wait = false;
+  }
+  else {
+    metadata.timestamp = -1;
+    metadata.send_now = 1;
+  }
   metadata.start_of_burst = 1;
 
-  bool ok = d_u2->tx_32fc(0, // FIXME: someday, streams will have channel numbers
-                         in, noutput_items, &metadata);
+  bool ok = d_u2->tx_32fc(0, in, noutput_items, &metadata);
   if (!ok){
     std::cerr << "usrp2_sink_32fc: tx_32fc failed" << std::endl;
     return -1; // say we're done
index ce473f2365e08b132237f219921d6d4b52c6d142..c9b34a54a93669974226ec79abba05bc87f7a132 100644 (file)
@@ -36,7 +36,9 @@ usrp2_sink_base::usrp2_sink_base(const char *name,
   : usrp2_base(name,
                input_signature,
               gr_make_io_signature(0, 0, 0),
-              ifc, mac)
+              ifc, mac),
+    d_should_wait(false),
+    d_tx_time(0)
 {
   // NOP
 }
@@ -155,3 +157,10 @@ bool usrp2_sink_base::read_gpio(uint16_t *value)
 {
   return d_u2->read_gpio(usrp2::GPIO_TX_BANK, value);
 }
+
+bool usrp2_sink_base::start_streaming_at(usrp2::fpga_timestamp time)
+{
+  d_should_wait = true;
+  d_tx_time = time;
+  return true;
+}
index 38dc4f2364a60fef6cbadc39c8394afcca9ed06a..d831d4df6951d4ee2e250e2f1059c610f820262b 100644 (file)
@@ -37,6 +37,9 @@ protected:
                  const std::string &mac)
     throw (std::runtime_error);
 
+  bool d_should_wait;
+  usrp2::fpga_timestamp d_tx_time;
+
 public:
   ~usrp2_sink_base();
 
@@ -139,6 +142,11 @@ public:
    * \brief Read daughterboard GPIO pin values
    */
   bool read_gpio(uint16_t *value);
+
+  /*!
+   * \brief First samples begin streaming to USRP2 at given time
+   */
+  bool start_streaming_at(usrp2::fpga_timestamp time);
 };
 
 #endif /* INCLUDED_USRP2_SINK_BASE_H */
index 9a8fe7d5e185ffc6019c8814d6820f38c1c4dbb3..8586a288421f72a93c153706a3950412cd7b75c3 100644 (file)
@@ -6,6 +6,6 @@ includedir=@includedir@
 Name: gnuradio-comedi
 Description: GNU Radio blocks for the SDL library
 Requires: gnuradio-core sdl
-Version: @VERSION@
+Version: @LIBVER@
 Libs: -L${libdir} -lgnuradio-video-sdl
 Cflags: -I${includedir}
index e623eb2a9df1a8d37c66d2d1b3d9e11b8cdaff66..45cedfb212a518936f5c4700397553ed935d13bf 100644 (file)
@@ -43,8 +43,7 @@ libgnuradio_video_sdl_la_LIBADD =     \
        $(SDL_LIBS)                     \
        $(GNURADIO_CORE_LA)
 
-libgnuradio_video_sdl_la_LDFLAGS =     \
-       $(NO_UNDEFINED)
+libgnuradio_video_sdl_la_LDFLAGS = $(NO_UNDEFINED) $(LTVERSIONFLAGS)
 
 if PYTHON
 #################################
index a3e352f0f7f3bffe49c5bdf817fdea8581530b94..f7138978951e9aeca719a405b230afd730c48377 100644 (file)
@@ -6,6 +6,6 @@ includedir=@includedir@
 Name: gr-wxgui
 Description: A simple wx gui for GNU Radio applications
 Requires: gnuradio-core
-Version: @VERSION@
+Version: @LIBVER@
 Libs:
 Cflags:
index 825f71c3223369ac43ee263685a4bc38c84702a6..9612f36ddec1f0679c72c8811181a45cd32582fe 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright 2008 Free Software Foundation, Inc.
+# Copyright 2008,2010 Free Software Foundation, Inc.
 #
 # This file is part of GNU Radio
 #
@@ -27,6 +27,8 @@ ALPHA_KEY = 'alpha'
 AUTORANGE_KEY = 'autorange'
 AVERAGE_KEY = 'average'
 AVG_ALPHA_KEY = 'avg_alpha'
+USE_PERSISTENCE_KEY = 'use_persistence'
+PERSIST_ALPHA_KEY = 'persist_alpha'
 BASEBAND_FREQ_KEY = 'baseband_freq'
 BETA_KEY = 'beta'
 COLOR_MODE_KEY = 'color_mode'
index 4ee5520f76167271af35a699266fd20521e9e6c3..f4f485f4b06030f67522ddb65162bebbc8b568c2 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright 2008, 2009 Free Software Foundation, Inc.
+# Copyright 2008, 2009, 2010 Free Software Foundation, Inc.
 #
 # This file is part of GNU Radio
 #
@@ -37,6 +37,7 @@ import forms
 ##################################################
 SLIDER_STEPS = 100
 AVG_ALPHA_MIN_EXP, AVG_ALPHA_MAX_EXP = -3, 0
+PERSIST_ALPHA_MIN_EXP, PERSIST_ALPHA_MAX_EXP = -2, 0
 DEFAULT_WIN_SIZE = (600, 300)
 DEFAULT_FRAME_RATE = gr.prefs().get_long('wxgui', 'fft_rate', 30)
 DB_DIV_MIN, DB_DIV_MAX = 1, 20
@@ -97,7 +98,38 @@ class control_panel(wx.Panel):
                for widget in (avg_alpha_text, avg_alpha_slider):
                        parent.subscribe(AVERAGE_KEY, widget.Enable)
                        widget.Enable(parent[AVERAGE_KEY])
+                       parent.subscribe(AVERAGE_KEY, widget.ShowItems)
+                        #allways show initially, so room is reserved for them
+                       widget.ShowItems(True) # (parent[AVERAGE_KEY])
+
+                parent.subscribe(AVERAGE_KEY, self._update_layout)
+
+               forms.check_box(
+                       sizer=options_box, parent=self, label='Persistence',
+                       ps=parent, key=USE_PERSISTENCE_KEY,
+               )
+               #static text and slider for persist alpha
+               persist_alpha_text = forms.static_text(
+                       sizer=options_box, parent=self, label='Persist Alpha',
+                       converter=forms.float_converter(lambda x: '%.4f'%x),
+                       ps=parent, key=PERSIST_ALPHA_KEY, width=50,
+               )
+               persist_alpha_slider = forms.log_slider(
+                       sizer=options_box, parent=self,
+                       min_exp=PERSIST_ALPHA_MIN_EXP,
+                       max_exp=PERSIST_ALPHA_MAX_EXP,
+                       num_steps=SLIDER_STEPS,
+                       ps=parent, key=PERSIST_ALPHA_KEY,
+               )
+               for widget in (persist_alpha_text, persist_alpha_slider):
+                       parent.subscribe(USE_PERSISTENCE_KEY, widget.Enable)
+                       widget.Enable(parent[USE_PERSISTENCE_KEY])
+                       parent.subscribe(USE_PERSISTENCE_KEY, widget.ShowItems)
+                        #allways show initially, so room is reserved for them
+                       widget.ShowItems(True) # (parent[USE_PERSISTENCE_KEY])
                
+                parent.subscribe(USE_PERSISTENCE_KEY, self._update_layout)
+
                #trace menu
                for trace in TRACES:
                        trace_box = wx.BoxSizer(wx.HORIZONTAL)
@@ -144,6 +176,7 @@ class control_panel(wx.Panel):
                )
                #set sizer
                self.SetSizerAndFit(control_box)
+
                #mouse wheel event
                def on_mouse_wheel(event):
                        if event.GetWheelRotation() < 0: self._on_incr_ref_level(event)
@@ -161,6 +194,14 @@ class control_panel(wx.Panel):
                self.parent[Y_PER_DIV_KEY] = min(DB_DIV_MAX, common.get_clean_incr(self.parent[Y_PER_DIV_KEY]))
        def _on_decr_db_div(self, event):
                self.parent[Y_PER_DIV_KEY] = max(DB_DIV_MIN, common.get_clean_decr(self.parent[Y_PER_DIV_KEY]))
+       ##################################################
+       # subscriber handlers
+       ##################################################
+        def _update_layout(self,key):
+          # Just ignore the key value we get
+          # we only need to now that the visability or size of something has changed
+          self.parent.Layout()
+          #self.parent.Fit()          
 
 ##################################################
 # FFT window with plotter and control panel
@@ -183,7 +224,10 @@ class fft_window(wx.Panel, pubsub.pubsub):
                avg_alpha_key,
                peak_hold,
                msg_key,
+                use_persistence,
+                persist_alpha,
        ):
+
                pubsub.pubsub.__init__(self)
                #setup
                self.samples = EMPTY_TRACE
@@ -204,6 +248,8 @@ class fft_window(wx.Panel, pubsub.pubsub):
                self[REF_LEVEL_KEY] = ref_level
                self[BASEBAND_FREQ_KEY] = baseband_freq
                self[RUNNING_KEY] = True
+               self[USE_PERSISTENCE_KEY] = use_persistence
+               self[PERSIST_ALPHA_KEY] = persist_alpha
                for trace in TRACES:
                        #a function that returns a function
                        #so the function wont use local trace
@@ -232,6 +278,8 @@ class fft_window(wx.Panel, pubsub.pubsub):
                self.plotter.enable_legend(True)
                self.plotter.enable_point_label(True)
                self.plotter.enable_grid_lines(True)
+                self.plotter.set_use_persistence(use_persistence)
+                self.plotter.set_persist_alpha(persist_alpha)
                #setup the box with plot and controls
                self.control_panel = control_panel(self)
                main_box = wx.BoxSizer(wx.HORIZONTAL)
@@ -247,9 +295,12 @@ class fft_window(wx.Panel, pubsub.pubsub):
                        Y_PER_DIV_KEY, X_DIVS_KEY,
                        Y_DIVS_KEY, REF_LEVEL_KEY,
                ): self.subscribe(key, self.update_grid)
+               self.subscribe(USE_PERSISTENCE_KEY, self.plotter.set_use_persistence)
+               self.subscribe(PERSIST_ALPHA_KEY, self.plotter.set_persist_alpha)
                #initial update
                self.update_grid()
 
+
        def autoscale(self, *args):
                """
                Autoscale the fft plot to the last frame.
index 8ddea9a8e3fd0109a737a8f5f49a28478e604b5d..e0306d919302caf335521bf810fbb3518d5a44d6 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright 2008,2009 Free Software Foundation, Inc.
+# Copyright 2008,2009,2010 Free Software Foundation, Inc.
 #
 # This file is part of GNU Radio
 #
@@ -27,6 +27,7 @@ import common
 from gnuradio import gr, blks2
 from pubsub import pubsub
 from constants import *
+import math
 
 ##################################################
 # FFT sink block (wrapper for old wxgui)
@@ -53,10 +54,21 @@ class _fft_sink_base(gr.hier_block2, common.wxgui_hb):
                size=fft_window.DEFAULT_WIN_SIZE,
                peak_hold=False,
                win=None,
+                use_persistence=False,
+                persist_alpha=None,
                **kwargs #do not end with a comma
        ):
                #ensure avg alpha
                if avg_alpha is None: avg_alpha = 2.0/fft_rate
+                #ensure analog alpha
+                if persist_alpha is None: 
+                  actual_fft_rate=float(sample_rate/fft_size)/float(max(1,int(float((sample_rate/fft_size)/fft_rate))))
+                  #print "requested_fft_rate ",fft_rate
+                  #print "actual_fft_rate    ",actual_fft_rate
+                  analog_cutoff_freq=0.5 # Hertz
+                  #calculate alpha from wanted cutoff freq
+                  persist_alpha = 1.0 - math.exp(-2.0*math.pi*analog_cutoff_freq/actual_fft_rate)
+                  
                #init
                gr.hier_block2.__init__(
                        self,
@@ -76,6 +88,8 @@ class _fft_sink_base(gr.hier_block2, common.wxgui_hb):
                )
                msgq = gr.msg_queue(2)
                sink = gr.message_sink(gr.sizeof_float*fft_size, msgq, True)
+
+
                #controller
                self.controller = pubsub()
                self.controller.subscribe(AVERAGE_KEY, fft.set_average)
@@ -103,6 +117,8 @@ class _fft_sink_base(gr.hier_block2, common.wxgui_hb):
                        avg_alpha_key=AVG_ALPHA_KEY,
                        peak_hold=peak_hold,
                        msg_key=MSG_KEY,
+                        use_persistence=use_persistence,
+                        persist_alpha=persist_alpha,
                )
                common.register_access_methods(self, self.win)
                setattr(self.win, 'set_baseband_freq', getattr(self, 'set_baseband_freq')) #BACKWARDS
@@ -134,11 +150,14 @@ class test_app_block (stdgui2.std_top_block):
         fft_size = 256
 
         # build our flow graph
-        input_rate = 20.48e3
+        input_rate = 2048.0e3
+
+        #Generate some noise
+        noise =gr.noise_source_c(gr.GR_UNIFORM, 1.0/10)
 
         # Generate a complex sinusoid
         #src1 = gr.sig_source_c (input_rate, gr.GR_SIN_WAVE, 2e3, 1)
-        src1 = gr.sig_source_c (input_rate, gr.GR_CONST_WAVE, 5.75e3, 1)
+        src1 = gr.sig_source_c (input_rate, gr.GR_CONST_WAVE, 57.50e3, 1)
 
         # We add these throttle blocks so that this demo doesn't
         # suck down all the CPU available.  Normally you wouldn't use these.
@@ -149,17 +168,25 @@ class test_app_block (stdgui2.std_top_block):
                             ref_level=0, y_per_div=20, y_divs=10)
         vbox.Add (sink1.win, 1, wx.EXPAND)
 
-        self.connect(src1, thr1, sink1)
+        combine1=gr.add_cc()
+        self.connect(src1, (combine1,0))
+        self.connect(noise,(combine1,1))
+        self.connect(combine1,thr1, sink1)
 
         #src2 = gr.sig_source_f (input_rate, gr.GR_SIN_WAVE, 2e3, 1)
-        src2 = gr.sig_source_f (input_rate, gr.GR_CONST_WAVE, 5.75e3, 1)
+        src2 = gr.sig_source_f (input_rate, gr.GR_CONST_WAVE, 57.50e3, 1)
         thr2 = gr.throttle(gr.sizeof_float, input_rate)
         sink2 = fft_sink_f (panel, title="Real Data", fft_size=fft_size*2,
                             sample_rate=input_rate, baseband_freq=100e3,
                             ref_level=0, y_per_div=20, y_divs=10)
         vbox.Add (sink2.win, 1, wx.EXPAND)
 
-        self.connect(src2, thr2, sink2)
+        combine2=gr.add_ff()
+        c2f2=gr.complex_to_float()
+
+        self.connect(src2, (combine2,0))
+        self.connect(noise,c2f2,(combine2,1))
+        self.connect(combine2, thr2,sink2)
 
 def main ():
     app = stdgui2.stdapp (test_app_block, "FFT Sink Test App")
index 937eb27cce936ad14c5243ecc66568bb750833cb..508b4e772f5b8f1ae741e1193ca6ee2048589710 100644 (file)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 #
-# Copyright 2003,2004,2005,2006,2007,2009 Free Software Foundation, Inc.
+# Copyright 2003,2004,2005,2006,2007,2009,2010 Free Software Foundation, Inc.
 # 
 # This file is part of GNU Radio
 # 
@@ -37,7 +37,7 @@ class fft_sink_base(object):
                  y_divs=8, ref_level=50,
                  sample_rate=1, fft_size=512,
                  fft_rate=default_fft_rate,
-                 average=False, avg_alpha=None, title='', peak_hold=False):
+                 average=False, avg_alpha=None, title='', peak_hold=False,use_persistence=False,persist_alpha=0.2):
 
         # initialize common attributes
         self.baseband_freq = baseband_freq
@@ -52,6 +52,9 @@ class fft_sink_base(object):
             self.avg_alpha = 2.0 / fft_rate
         else:
             self.avg_alpha = avg_alpha
+        self.use_persistence = use_persistence
+        self.persist_alpha = persist_alpha
+
         self.title = title
         self.peak_hold = peak_hold
         self.input_is_real = input_is_real
@@ -75,6 +78,14 @@ class fft_sink_base(object):
         self.peak_hold = enable
         self.win.set_peak_hold(enable)
 
+    def set_use_persistence(self, enable):
+        self.use_persistence = enable
+        self.win.set_use_persistence(enable)
+
+    def set_persist_alpha(self, persist_alpha):
+        self.persist_alpha = persist_alpha
+        self.win.set_persist_alpha(persist_alpha)
+
     def set_avg_alpha(self, avg_alpha):
         self.avg_alpha = avg_alpha
 
@@ -93,7 +104,7 @@ class fft_sink_f(gr.hier_block2, fft_sink_base):
     def __init__(self, parent, baseband_freq=0, ref_scale=2.0,
                  y_per_div=10, y_divs=8, ref_level=50, sample_rate=1, fft_size=512,
                  fft_rate=default_fft_rate, average=False, avg_alpha=None,
-                 title='', size=default_fftsink_size, peak_hold=False, **kwargs):
+                 title='', size=default_fftsink_size, peak_hold=False, use_persistence=False,persist_alpha=0.2, **kwargs):
 
         gr.hier_block2.__init__(self, "fft_sink_f",
                                 gr.io_signature(1, 1, gr.sizeof_float),
@@ -104,7 +115,7 @@ class fft_sink_f(gr.hier_block2, fft_sink_base):
                                sample_rate=sample_rate, fft_size=fft_size,
                                fft_rate=fft_rate,
                                average=average, avg_alpha=avg_alpha, title=title,
-                               peak_hold=peak_hold)
+                               peak_hold=peak_hold,use_persistence=use_persistence,persist_alpha=persist_alpha)
                                
         self.s2p = gr.stream_to_vector(gr.sizeof_float, self.fft_size)
         self.one_in_n = gr.keep_one_in_n(gr.sizeof_float * self.fft_size,
@@ -131,12 +142,14 @@ class fft_sink_f(gr.hier_block2, fft_sink_base):
         self.win = fft_window(self, parent, size=size)
         self.set_average(self.average)
         self.set_peak_hold(self.peak_hold)
+        self.set_use_persistence(self.use_persistence)
+        self.set_persist_alpha(self.persist_alpha)
 
 class fft_sink_c(gr.hier_block2, fft_sink_base):
     def __init__(self, parent, baseband_freq=0, ref_scale=2.0,
                  y_per_div=10, y_divs=8, ref_level=50, sample_rate=1, fft_size=512,
                  fft_rate=default_fft_rate, average=False, avg_alpha=None,
-                 title='', size=default_fftsink_size, peak_hold=False, **kwargs):
+                 title='', size=default_fftsink_size, peak_hold=False, use_persistence=False,persist_alpha=0.2, **kwargs):
 
         gr.hier_block2.__init__(self, "fft_sink_c",
                                 gr.io_signature(1, 1, gr.sizeof_gr_complex),
@@ -147,7 +160,7 @@ class fft_sink_c(gr.hier_block2, fft_sink_base):
                                sample_rate=sample_rate, fft_size=fft_size,
                                fft_rate=fft_rate,
                                average=average, avg_alpha=avg_alpha, title=title,
-                               peak_hold=peak_hold)
+                               peak_hold=peak_hold, use_persistence=use_persistence,persist_alpha=persist_alpha)
 
         self.s2p = gr.stream_to_vector(gr.sizeof_gr_complex, self.fft_size)
         self.one_in_n = gr.keep_one_in_n(gr.sizeof_gr_complex * self.fft_size,
@@ -173,6 +186,8 @@ class fft_sink_c(gr.hier_block2, fft_sink_base):
 
         self.win = fft_window(self, parent, size=size)
         self.set_average(self.average)
+        self.set_use_persistence(self.use_persistence)
+        self.set_persist_alpha(self.persist_alpha)
         self.set_peak_hold(self.peak_hold)
 
 
@@ -236,6 +251,9 @@ class control_panel(wx.Panel):
         self.average_check_box = wx.CheckBox(parent=self, style=wx.CHK_2STATE, label="Average")
         self.average_check_box.Bind(wx.EVT_CHECKBOX, parent.on_average)
         control_box.Add(self.average_check_box, 0, wx.EXPAND)
+        self.use_persistence_check_box = wx.CheckBox(parent=self, style=wx.CHK_2STATE, label="Persistence")
+        self.use_persistence_check_box.Bind(wx.EVT_CHECKBOX, parent.on_use_persistence)
+        control_box.Add(self.use_persistence_check_box, 0, wx.EXPAND)
         self.peak_hold_check_box = wx.CheckBox(parent=self, style=wx.CHK_2STATE, label="Peak Hold")
         self.peak_hold_check_box.Bind(wx.EVT_CHECKBOX, parent.on_peak_hold) 
         control_box.Add(self.peak_hold_check_box, 0, wx.EXPAND)
@@ -276,6 +294,7 @@ class control_panel(wx.Panel):
         """
         #update checkboxes
         self.average_check_box.SetValue(self.parent.fftsink.average)
+        self.use_persistence_check_box.SetValue(self.parent.fftsink.use_persistence)
         self.peak_hold_check_box.SetValue(self.parent.fftsink.peak_hold)
         #update radio buttons    
         try:
@@ -306,6 +325,10 @@ class fft_window (wx.Panel):
         
         self.peak_hold = False
         self.peak_vals = None
+
+        self.use_persistence=False
+        self.persist_alpha=0.2
+
         
         self.plot.SetEnableGrid (True)
         # self.SetEnableZoom (True)
@@ -394,6 +417,14 @@ class fft_window (wx.Panel):
         y_range = ymin, ymax
         self.plot.Draw (graphics, xAxis=x_range, yAxis=y_range, step=self.fftsink.y_per_div)        
 
+    def set_use_persistence(self, enable):
+        self.use_persistence = enable
+        self.plot.set_use_persistence( enable)
+
+    def set_persist_alpha(self, persist_alpha):
+        self.persist_alpha = persist_alpha
+        self.plot.set_persist_alpha(persist_alpha)
+
     def set_peak_hold(self, enable):
         self.peak_hold = enable
         self.peak_vals = None
@@ -403,6 +434,11 @@ class fft_window (wx.Panel):
         self.fftsink.set_average(evt.IsChecked())
         self.control_panel.update()
 
+    def on_use_persistence(self, evt):
+        # print "on_analog"
+        self.fftsink.set_use_persistence(evt.IsChecked())
+        self.control_panel.update()
+
     def on_peak_hold(self, evt):
         # print "on_peak_hold"
         self.fftsink.set_peak_hold(evt.IsChecked())
@@ -486,9 +522,11 @@ class fft_window (wx.Panel):
         self.id_y_per_div_10 = wx.NewId()
         self.id_y_per_div_20 = wx.NewId()
         self.id_average = wx.NewId()
+        self.id_use_persistence = wx.NewId()
         self.id_peak_hold = wx.NewId()
         
         self.plot.Bind(wx.EVT_MENU, self.on_average, id=self.id_average)
+        self.plot.Bind(wx.EVT_MENU, self.on_use_persistence, id=self.id_use_persistence)
         self.plot.Bind(wx.EVT_MENU, self.on_peak_hold, id=self.id_peak_hold)
         self.plot.Bind(wx.EVT_MENU, self.on_incr_ref_level, id=self.id_incr_ref_level)
         self.plot.Bind(wx.EVT_MENU, self.on_decr_ref_level, id=self.id_decr_ref_level)
@@ -504,6 +542,7 @@ class fft_window (wx.Panel):
         menu = wx.Menu()
         self.popup_menu = menu
         menu.AppendCheckItem(self.id_average, "Average")
+        menu.AppendCheckItem(self.id_use_persistence, "Persistence")
         menu.AppendCheckItem(self.id_peak_hold, "Peak Hold")
         menu.Append(self.id_incr_ref_level, "Incr Ref Level")
         menu.Append(self.id_decr_ref_level, "Decr Ref Level")
@@ -519,6 +558,7 @@ class fft_window (wx.Panel):
 
         self.checkmarks = {
             self.id_average : lambda : self.fftsink.average,
+            self.id_use_persistence : lambda : self.fftsink.use_persistence,
             self.id_peak_hold : lambda : self.fftsink.peak_hold,
             self.id_y_per_div_1 : lambda : self.fftsink.y_per_div == 1,
             self.id_y_per_div_2 : lambda : self.fftsink.y_per_div == 2,
@@ -561,11 +601,11 @@ class test_app_block (stdgui2.std_top_block):
         fft_size = 256
 
         # build our flow graph
-        input_rate = 20.48e3
+        input_rate = 100*20.48e3
 
         # Generate a complex sinusoid
-        #src1 = gr.sig_source_c (input_rate, gr.GR_SIN_WAVE, 2e3, 1)
-        src1 = gr.sig_source_c (input_rate, gr.GR_CONST_WAVE, 5.75e3, 1)
+        #src1 = gr.sig_source_c (input_rate, gr.GR_SIN_WAVE, 100*2e3, 1)
+        src1 = gr.sig_source_c (input_rate, gr.GR_CONST_WAVE, 100*5.75e3, 1)
 
         # We add these throttle blocks so that this demo doesn't
         # suck down all the CPU available.  Normally you wouldn't use these.
@@ -578,8 +618,8 @@ class test_app_block (stdgui2.std_top_block):
 
         self.connect(src1, thr1, sink1)
 
-        #src2 = gr.sig_source_f (input_rate, gr.GR_SIN_WAVE, 2e3, 1)
-        src2 = gr.sig_source_f (input_rate, gr.GR_CONST_WAVE, 5.75e3, 1)
+        #src2 = gr.sig_source_f (input_rate, gr.GR_SIN_WAVE, 100*2e3, 1)
+        src2 = gr.sig_source_f (input_rate, gr.GR_CONST_WAVE, 100*5.75e3, 1)
         thr2 = gr.throttle(gr.sizeof_float, input_rate)
         sink2 = fft_sink_f (panel, title="Real Data", fft_size=fft_size*2,
                             sample_rate=input_rate, baseband_freq=100e3,
index c104b0ea5105ffc5094d906a32528a01d9bd45d6..e0bc4ca6082721c5699a8c2257685d4adbc0d18e 100644 (file)
@@ -6,7 +6,7 @@
 #
 # Created:     2003/11/03
 # RCS-ID:      $Id$
-# Copyright:   (c) 2002,2007
+# Copyright:   (c) 2002,2007,2010
 # Licence:     Use as you wish.
 #-----------------------------------------------------------------------------
 # 12/15/2003 - Jeff Grimmett (grimmtooth@softhome.net)
@@ -36,6 +36,9 @@
 #   
 # May 27, 2007 Johnathan Corgan (jcorgan@corganenterprises.com)
 #   - Converted from numarray to numpy
+#
+# Apr 23, 2010 Martin Dudok van Heel (http://www.olifantasia.com/gnuradio/contact_olifantasia.gif)
+#   - Added Persistence option (emulate after glow of an analog CRT display using IIR)
 
 """
 This is a simple light weight plotting module that can be used with
@@ -422,6 +425,11 @@ class PlotCanvas(wx.Window):
 
     def __init__(self, parent, id = -1, pos=wx.DefaultPosition,
             size=wx.DefaultSize, style= wx.DEFAULT_FRAME_STYLE, name= ""):
+
+        self.use_persistence=False
+        self.alpha=0.3
+        self.decimation=10
+        self.decim_counter=0
         """Constucts a window, which can be a child of a frame, dialog or
         any other non-control window"""
     
@@ -488,6 +496,14 @@ class PlotCanvas(wx.Window):
         # platforms at initialization, but little harm done.
         self.OnSize(None) # sets the initial size based on client size
                           # UNCONDITIONAL, needed to create self._Buffer
+
+
+    def set_use_persistence(self, enable):
+        self.use_persistence = enable
+
+    def set_persist_alpha(self, persist_alpha):
+        self.alpha = persist_alpha
+
         
     # SaveFile
     def SaveFile(self, fileName= ''):
@@ -791,12 +807,19 @@ class PlotCanvas(wx.Window):
             
         if dc == None:
             # sets new dc and clears it 
-            dc = wx.BufferedDC(wx.ClientDC(self), self._Buffer)
-            dc.Clear()
-            
+            if self.use_persistence:
+              dc = wx.MemoryDC()
+              dc.SelectObject(self._Buffer)
+              dc.Clear()
+            else:
+              dc = wx.BufferedDC(wx.ClientDC(self), self._Buffer)
+              dc.Clear() 
+           
         dc.BeginDrawing()
         # dc.Clear()
-        
+
+       
         # set font size for every thing but title and legend
         dc.SetFont(self._getFont(self._fontSizeAxis))
 
@@ -818,6 +841,15 @@ class PlotCanvas(wx.Window):
 
         self.last_draw = (graphics, xAxis, yAxis)       # saves most recient values
 
+        if False:
+          ptx,pty,rectWidth,rectHeight= self._point2ClientCoord(p1, p2)
+          #dc.SetPen(wx.Pen(wx.BLACK))
+          dc.SetBrush(wx.Brush( wx.BLACK, wx.SOLID ) ) #wx.SOLID wx.TRANSPARENT ) )
+          #dc.SetLogicalFunction(wx.INVERT) #wx.XOR wx.INVERT
+          dc.DrawRectangle( ptx,pty, rectWidth,rectHeight)
+          #dc.SetBrush(wx.Brush( wx.WHITE, wx.SOLID ) ) 
+          #dc.SetLogicalFunction(wx.COPY)
+
         # Get ticks and textExtents for axis if required
         if self._xSpec is not 'none':
             if self._xUseScopeTicks:
@@ -874,8 +906,11 @@ class PlotCanvas(wx.Window):
         scale = (self.plotbox_size-textSize_scale) / (p2-p1)* _numpy.array((1,-1))
         shift = -p1*scale + self.plotbox_origin + textSize_shift * _numpy.array((1,-1))
         self._pointScale= scale  # make available for mouse events
-        self._pointShift= shift        
+        self._pointShift= shift
+
+        #dc.SetLogicalFunction(wx.INVERT) #wx.XOR wx.INVERT      
         self._drawAxes(dc, p1, p2, scale, shift, xticks, yticks)
+        #dc.SetLogicalFunction(wx.COPY) 
         
         graphics.scaleAndShift(scale, shift)
         graphics.setPrinterScale(self.printerScale)  # thicken up lines and markers if printing
@@ -885,11 +920,44 @@ class PlotCanvas(wx.Window):
         dc.SetClippingRegion(ptx,pty,rectWidth,rectHeight)
         # Draw the lines and markers
         #start = _time.clock()
+
         graphics.draw(dc)
         # print "entire graphics drawing took: %f second"%(_time.clock() - start)
         # remove the clipping region
         dc.DestroyClippingRegion()
         dc.EndDrawing()
+
+
+        if self.use_persistence:
+          dc=None
+          self._Buffer.CopyToBuffer(self._Bufferarray) #, format=wx.BitmapBufferFormat_RGB, stride=-1)
+          ## do the IIR filter
+          alpha_int=int(float(self.alpha*256))
+          if True:
+            _numpy.add(self._Bufferarray,0,self._Buffer3array)
+            _numpy.multiply(self._Buffer3array,alpha_int,self._Buffer3array)
+            _numpy.multiply(self._Buffer2array,(256-alpha_int),self._Buffer2array)
+            _numpy.add(self._Buffer3array,self._Buffer2array,self._Buffer2array)
+            _numpy.right_shift(self._Buffer2array,8,self._Buffer2array)
+          elif False:
+            self._Buffer2array=(self._Bufferarray.astype(_numpy.uint32) *alpha_int + self._Buffer2array*(256-alpha_int)).__rshift__(8)
+          elif False:
+            self._Buffer2array *=(256-alpha_int)
+            self._Buffer2array +=self._Bufferarray.astype(_numpy.uint32)*alpha_int
+            self._Buffer2array /=256
+
+          ##copy back to image buffer 
+          self._Buffer2.CopyFromBuffer(self._Buffer2array.astype(_numpy.uint8)) #, format=wx.BitmapBufferFormat_RGB, stride=-1)
+
+          #draw to the screen
+          #self.decim_counter=self.decim_counter+1
+          if True: #self.decim_counter>self.decimation:
+            #self.decim_counter=0
+            dc2 = wx.ClientDC( self )
+            dc2.BeginDrawing()
+            dc2.DrawBitmap(self._Buffer2, 0, 0, False)
+            #dc2.DrawBitmap(self._Buffer, 0, 0, False)
+            dc2.EndDrawing()
         
     def Redraw(self, dc= None):
         """Redraw the existing plot."""
@@ -1031,6 +1099,8 @@ class PlotCanvas(wx.Window):
         if self.last_PointLabel != None:
             self._drawPointLabel(self.last_PointLabel) #erase old
             self.last_PointLabel = None
+
+        #paint current buffer to screen
         dc = wx.BufferedPaintDC(self, self._Buffer)
 
     def OnSize(self,event):
@@ -1041,7 +1111,23 @@ class PlotCanvas(wx.Window):
         # Make new offscreen bitmap: this bitmap will always have the
         # current drawing in it, so it can be used to save the image to
         # a file, or whatever.
-        self._Buffer = wx.EmptyBitmap(Size[0],Size[1])
+        self._Buffer = wx.EmptyBitmap(Size[0],Size[1],24)
+
+        
+        if True: #self.use_persistence:
+          #self._Bufferarray = _numpy.zeros((Size[0], Size[1],3), dtype=_numpy.uint8)
+          self._Bufferarray = _numpy.zeros((Size[0]* Size[1]*3), dtype=_numpy.uint8)
+
+          # Make new second offscreen bitmap: this bitmap will always have the
+          # last drawing in it, so it can be used to do display time dependent processing 
+          # like averaging (IIR) or show differences between updates
+          self._Buffer2 = wx.EmptyBitmap(Size[0],Size[1],24)
+          # now the extra buffers for the IIR processing
+          # note the different datatype uint32
+          self._Buffer2array = _numpy.zeros((Size[0]* Size[1]*3), dtype=_numpy.uint32) #dtype=_numpy.float
+          self._Buffer3array = _numpy.zeros((Size[0]* Size[1]*3), dtype=_numpy.uint32) #dtype=_numpy.float
+          # optional you can set the ufunct buffer size to improve speed
+          #_numpy.setbufsize(16*((Size[0]* Size[1]*3)/16 +1))
         self._setSize()
 
         self.last_PointLabel = None        #reset pointLabel
index ff0a3a160d9cb7ddc48bd4538377617a2a1133dc..a3a2b645194b6f6620479b9f72824d0c1ea69049 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright 2008, 2009 Free Software Foundation, Inc.
+# Copyright 2008, 2009, 2010 Free Software Foundation, Inc.
 #
 # This file is part of GNU Radio
 #
@@ -47,6 +47,7 @@ class channel_plotter(grid_plotter_base):
                """
                #init
                grid_plotter_base.__init__(self, parent, MIN_PADDING)
+                self.set_use_persistence(False)
                #setup legend cache
                self._legend_cache = self.new_gl_cache(self._draw_legend, 50)
                self.enable_legend(False)
index dede5a0ad51b8d5abbf231c02ef40634d66acd77..b856215e9ba458069b72bf8e77a8a8815c6c29f0 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright 2008, 2009 Free Software Foundation, Inc.
+# Copyright 2008, 2009, 2010 Free Software Foundation, Inc.
 #
 # This file is part of GNU Radio
 #
@@ -87,7 +87,10 @@ class plotter_base(wx.glcanvas.GLCanvas, common.mutex):
                @param parent the parent widgit
                """
                attribList = (wx.glcanvas.WX_GL_DOUBLEBUFFER, wx.glcanvas.WX_GL_RGBA)
-               wx.glcanvas.GLCanvas.__init__(self, parent, attribList=attribList)
+               wx.glcanvas.GLCanvas.__init__(self, parent, attribList=attribList);
+                self.use_persistence=False
+                self.persist_alpha=2.0/15
+                self.clear_accum=True
                self._gl_init_flag = False
                self._resized_flag = True
                self._init_fcns = list()
@@ -97,6 +100,13 @@ class plotter_base(wx.glcanvas.GLCanvas, common.mutex):
                self.Bind(wx.EVT_SIZE, self._on_size)
                self.Bind(wx.EVT_ERASE_BACKGROUND, lambda e: None)
 
+        def set_use_persistence(self,enable):
+                self.use_persistence=enable 
+                self.clear_accum=True
+
+        def set_persist_alpha(self,analog_alpha):
+                self.persist_alpha=analog_alpha
+
        def new_gl_cache(self, draw_fcn, draw_pri=50):
                """
                Create a new gl cache.
@@ -131,6 +141,7 @@ class plotter_base(wx.glcanvas.GLCanvas, common.mutex):
                """
                self.lock()
                self._resized_flag = True
+                self.clear_accum=True
                self.unlock()
 
        def _on_paint(self, event):
@@ -160,7 +171,30 @@ class plotter_base(wx.glcanvas.GLCanvas, common.mutex):
                        self._resized_flag = False
                #clear, draw functions, swap
                GL.glClear(GL.GL_COLOR_BUFFER_BIT)
+
+                if False:
+                  GL.glEnable (GL.GL_LINE_SMOOTH)
+                  GL.glEnable (GL.GL_POLYGON_SMOOTH)
+                  GL.glEnable (GL.GL_BLEND)
+                  GL.glBlendFunc (GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA)
+                  GL.glHint (GL.GL_LINE_SMOOTH_HINT, GL.GL_NICEST) #GL.GL_DONT_CARE)
+                  GL.glHint(GL.GL_POLYGON_SMOOTH_HINT, GL.GL_NICEST)
+                  #GL.glLineWidth (1.5)
+
+                  GL.glEnable(GL.GL_MULTISAMPLE) #Enable Multisampling anti-aliasing
+
+
                for fcn in self._draw_fcns: fcn[1]()
+
+                if self.use_persistence:
+                  if self.clear_accum:
+                    #GL.glClear(GL.GL_ACCUM_BUFFER_BIT)
+                    GL.glAccum(GL.GL_LOAD, 1.0)
+                    self.clear_accum=False
+
+                  GL.glAccum(GL.GL_MULT, 1.0-self.persist_alpha)
+                  GL.glAccum(GL.GL_ACCUM, self.persist_alpha)
+                  GL.glAccum(GL.GL_RETURN, 1.0)
                self.SwapBuffers()
                self.unlock()
 
index f7c0ffa82e6174a779b4fe412b3feaf8eb775c64..c03b71f1e0c84494791265be416f9eef29ea2d55 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright 2008 Free Software Foundation, Inc.
+# Copyright 2008,2010 Free Software Foundation, Inc.
 #
 # This file is part of GNU Radio
 #
@@ -36,6 +36,8 @@ import forms
 # Constants
 ##################################################
 DEFAULT_FRAME_RATE = gr.prefs().get_long('wxgui', 'scope_rate', 30)
+PERSIST_ALPHA_MIN_EXP, PERSIST_ALPHA_MAX_EXP = -2, 0
+SLIDER_STEPS = 100
 DEFAULT_WIN_SIZE = (600, 300)
 COUPLING_MODES = (
        ('DC', False),
@@ -88,6 +90,37 @@ class control_panel(wx.Panel):
                parent[SHOW_CONTROL_PANEL_KEY] = True
                parent.subscribe(SHOW_CONTROL_PANEL_KEY, self.Show)
                control_box = wx.BoxSizer(wx.VERTICAL)
+
+               ##################################################
+               # Persistence
+               ##################################################
+
+               forms.check_box(
+                       sizer=control_box, parent=self, label='Persistence',
+                       ps=parent, key=USE_PERSISTENCE_KEY,
+               )
+               #static text and slider for analog alpha
+               persist_alpha_text = forms.static_text(
+                       sizer=control_box, parent=self, label='Analog Alpha',
+                       converter=forms.float_converter(lambda x: '%.4f'%x),
+                       ps=parent, key=PERSIST_ALPHA_KEY, width=50,
+               )
+               persist_alpha_slider = forms.log_slider(
+                       sizer=control_box, parent=self,
+                       min_exp=PERSIST_ALPHA_MIN_EXP,
+                       max_exp=PERSIST_ALPHA_MAX_EXP,
+                       num_steps=SLIDER_STEPS,
+                       ps=parent, key=PERSIST_ALPHA_KEY,
+               )
+               for widget in (persist_alpha_text, persist_alpha_slider):
+                       parent.subscribe(USE_PERSISTENCE_KEY, widget.Enable)
+                       widget.Enable(parent[USE_PERSISTENCE_KEY])
+                       parent.subscribe(USE_PERSISTENCE_KEY, widget.ShowItems)
+                        #allways show initially, so room is reserved for them
+                       widget.ShowItems(True) # (parent[USE_PERSISTENCE_KEY])
+               
+                parent.subscribe(USE_PERSISTENCE_KEY, self._update_layout)
+
                ##################################################
                # Axes Options
                ##################################################
@@ -364,6 +397,15 @@ class control_panel(wx.Panel):
        def _on_decr_y_off(self, event):
                self.parent[Y_OFF_KEY] = self.parent[Y_OFF_KEY] - self.parent[Y_PER_DIV_KEY]
 
+       ##################################################
+       # subscriber handlers
+       ##################################################
+        def _update_layout(self,key):
+          # Just ignore the key value we get
+          # we only need to now that the visability or size of something has changed
+          self.parent.Layout()
+          #self.parent.Fit()  
+
 ##################################################
 # Scope window with plotter and control panel
 ##################################################
@@ -388,6 +430,8 @@ class scope_window(wx.Panel, pubsub.pubsub):
                trigger_channel_key,
                decimation_key,
                msg_key,
+                use_persistence,
+                persist_alpha,
        ):
                pubsub.pubsub.__init__(self)
                #check num inputs
@@ -430,6 +474,8 @@ class scope_window(wx.Panel, pubsub.pubsub):
                self[TRIGGER_MODE_KEY] = gr.gr_TRIG_MODE_AUTO
                self[TRIGGER_SLOPE_KEY] = gr.gr_TRIG_SLOPE_POS
                self[T_FRAC_OFF_KEY] = 0.5
+               self[USE_PERSISTENCE_KEY] = use_persistence
+               self[PERSIST_ALPHA_KEY] = persist_alpha
                for i in range(num_inputs):
                        self.proxy(common.index_key(AC_COUPLE_KEY, i), controller, common.index_key(ac_couple_key, i))
                #init panel and plot
@@ -440,6 +486,8 @@ class scope_window(wx.Panel, pubsub.pubsub):
                self.plotter.enable_legend(True)
                self.plotter.enable_point_label(True)
                self.plotter.enable_grid_lines(True)
+                self.plotter.set_use_persistence(use_persistence)
+                self.plotter.set_persist_alpha(persist_alpha)
                #setup the box with plot and controls
                self.control_panel = control_panel(self)
                main_box = wx.BoxSizer(wx.HORIZONTAL)
@@ -457,6 +505,9 @@ class scope_window(wx.Panel, pubsub.pubsub):
                        XY_MODE_KEY, AUTORANGE_KEY, T_FRAC_OFF_KEY,
                        TRIGGER_SHOW_KEY, XY_MARKER_KEY, X_CHANNEL_KEY, Y_CHANNEL_KEY,
                ]: self.subscribe(key, self.update_grid)
+                #register events for plotter settings
+               self.subscribe(USE_PERSISTENCE_KEY, self.plotter.set_use_persistence)
+               self.subscribe(PERSIST_ALPHA_KEY, self.plotter.set_persist_alpha)
                #initial update
                self.update_grid()
 
@@ -621,3 +672,4 @@ class scope_window(wx.Panel, pubsub.pubsub):
                        self.plotter.set_y_grid(self.get_y_min(), self.get_y_max(), self[Y_PER_DIV_KEY])
                #redraw current sample
                self.handle_samples()
+
index 358361de62d6953ee6f969ee1db7dd5e64a17a20..ebf9b29398479ff260b7f72b089f77571f1ca37e 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright 2008 Free Software Foundation, Inc.
+# Copyright 2008,2010 Free Software Foundation, Inc.
 #
 # This file is part of GNU Radio
 #
@@ -27,6 +27,7 @@ import common
 from gnuradio import gr
 from pubsub import pubsub
 from constants import *
+import math
 
 class ac_couple_block(gr.hier_block2):
        """
@@ -76,8 +77,17 @@ class _scope_sink_base(gr.hier_block2, common.wxgui_hb):
                ac_couple=False,
                num_inputs=1,
                frame_rate=scope_window.DEFAULT_FRAME_RATE,
+                use_persistence=False,
+                persist_alpha=None,
                **kwargs #do not end with a comma
        ):
+                #ensure analog alpha
+                if persist_alpha is None: 
+                  actual_frame_rate=float(frame_rate)
+                  analog_cutoff_freq=0.5 # Hertz
+                  #calculate alpha from wanted cutoff freq
+                  persist_alpha = 1.0 - math.exp(-2.0*math.pi*analog_cutoff_freq/actual_frame_rate)
+
                if not t_scale: t_scale = 10.0/sample_rate
                #init
                gr.hier_block2.__init__(
@@ -129,6 +139,8 @@ class _scope_sink_base(gr.hier_block2, common.wxgui_hb):
                        trigger_channel_key=TRIGGER_CHANNEL_KEY,
                        decimation_key=DECIMATION_KEY,
                        msg_key=MSG_KEY,
+                        use_persistence=use_persistence,
+                        persist_alpha=persist_alpha,
                )
                common.register_access_methods(self, self.win)
                #connect
@@ -169,10 +181,11 @@ class test_top_block (stdgui2.std_top_block):
     def __init__(self, frame, panel, vbox, argv):
         stdgui2.std_top_block.__init__ (self, frame, panel, vbox, argv)
 
+        default_input_rate = 1e6
         if len(argv) > 1:
-            frame_decim = int(argv[1]) 
+            input_rate = int(argv[1]) 
         else:
-            frame_decim = 1
+            input_rate = default_input_rate
 
         if len(argv) > 2:
             v_scale = float(argv[2])  # start up at this v_scale value
@@ -182,14 +195,17 @@ class test_top_block (stdgui2.std_top_block):
         if len(argv) > 3:
             t_scale = float(argv[3])  # start up at this t_scale value
         else:
-            t_scale = .00003  # old behavior
+            t_scale = .00003*default_input_rate/input_rate # old behavior
 
-        print "frame decim %s  v_scale %s  t_scale %s" % (frame_decim,v_scale,t_scale)
+        print "input rate %s  v_scale %s  t_scale %s" % (input_rate,v_scale,t_scale)
             
-        input_rate = 1e6
 
         # Generate a complex sinusoid
-        self.src0 = gr.sig_source_c (input_rate, gr.GR_SIN_WAVE, 25.1e3, 1e3)
+        ampl=1.0e3
+        self.src0 = gr.sig_source_c (input_rate, gr.GR_SIN_WAVE, 25.1e3*input_rate/default_input_rate, ampl)
+        self.noise =gr.sig_source_c (input_rate, gr.GR_SIN_WAVE, 11.1*25.1e3*input_rate/default_input_rate, ampl/10) 
+        #self.noise =gr.noise_source_c(gr.GR_GAUSSIAN, ampl/10)
+        self.combine=gr.add_cc()
 
         # We add this throttle block so that this demo doesn't suck down
         # all the CPU available.  You normally wouldn't use it...
@@ -201,7 +217,9 @@ class test_top_block (stdgui2.std_top_block):
 
         # Ultimately this will be
         # self.connect("src0 throttle scope")
-       self.connect(self.src0, self.thr, scope) 
+       self.connect(self.src0,(self.combine,0))
+        self.connect(self.noise,(self.combine,1))
+        self.connect(self.combine, self.thr, scope) 
 
 def main ():
     app = stdgui2.stdapp (test_top_block, "O'Scope Test App")
index 4e3839d27a466a1ea7d0b870eddd3ef9d41cd6f2..18420a013320aa60aabe2adf9b87c72207486539 100644 (file)
@@ -71,6 +71,7 @@ dist_ourdata_DATA = \
        gr_agc2_xx.xml \
        gr_agc_xx.xml \
        gr_and_xx.xml \
+       gr_and_const_xx.xml \
        gr_argmax_xx.xml \
        gr_binary_slicer_fb.xml \
        gr_channel_model.xml \
@@ -91,7 +92,6 @@ dist_ourdata_DATA = \
        gr_correlate_access_code_bb.xml \
        gr_costas_loop_cc.xml \
        gr_cpfsk_bc.xml \
-       gr_dd_mpsk_sync_cc.xml \
        gr_decode_ccsds_27_fb.xml \
        gr_deinterleave.xml \
        gr_delay.xml \
index 04568e19a8e2898e7094900ceddb37ffc875b939..610a881026c12075b7c6ddfbb67bc42281cb990e 100644 (file)
@@ -58,6 +58,7 @@
 
                <block>gr_add_const_vxx</block>
                <block>gr_multiply_const_vxx</block>
+               <block>gr_and_const_xx</block>
 
                <block>gr_not_xx</block>
                <block>gr_and_xx</block>
                <block>gr_pfb_clock_sync_xxx</block>
 
                <block>gr_costas_loop_cc</block>
-               <block>gr_dd_mpsk_sync_cc</block>
                <block>gr_mpsk_sync_cc</block>
                <block>gr_mpsk_receiver_cc</block>
 
diff --git a/grc/blocks/gr_and_const_xx.xml b/grc/blocks/gr_and_const_xx.xml
new file mode 100644 (file)
index 0000000..dc96493
--- /dev/null
@@ -0,0 +1,48 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+## And Const Block:
+##     all types, 1 output, 1 input & const
+###################################################
+ -->
+<block>
+       <name>And Const</name>
+       <key>gr_and_const_xx</key>
+       <import>from gnuradio import gr</import>
+       <make>gr.and_const_$(type.fcn)($const)</make>
+       <callback>set_k($const)</callback>
+       <param>
+               <name>IO Type</name>
+               <key>type</key>
+               <type>enum</type>
+               <option>
+                       <name>Int</name>
+                       <key>int</key>
+                       <opt>fcn:ii</opt>
+               </option>
+               <option>
+                       <name>Short</name>
+                       <key>short</key>
+                       <opt>fcn:ss</opt>
+               </option>
+               <option>
+                       <name>Byte</name>
+                       <key>byte</key>
+                       <opt>fcn:bb</opt>
+               </option>
+       </param>
+       <param>
+               <name>Constant</name>
+               <key>const</key>
+               <value>0</value>
+               <type>int</type>
+       </param>
+       <sink>
+               <name>in</name>
+               <type>$type</type>
+       </sink>
+       <source>
+               <name>out</name>
+               <type>$type</type>
+       </source>
+</block>
diff --git a/grc/blocks/gr_dd_mpsk_sync_cc.xml b/grc/blocks/gr_dd_mpsk_sync_cc.xml
deleted file mode 100644 (file)
index aed0e8d..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-<?xml version="1.0"?>
-<!--
-###################################################
-##DD MPSK Sync
-###################################################
- -->
-<block>
-       <name>DD MPSK Sync</name>
-       <key>gr_dd_mpsk_sync_cc</key>
-       <import>from gnuradio import gr</import>
-       <make>gr.dd_mpsk_sync_cc($alpha, $beta, $max_freq, $min_freq, $ref_phase, $omega, $gain_omega, $mu, $gain_mu)</make>
-       <param>
-               <name>Alpha</name>
-               <key>alpha</key>
-               <type>real</type>
-       </param>
-       <param>
-               <name>Beta</name>
-               <key>beta</key>
-               <type>real</type>
-       </param>
-       <param>
-               <name>Max Freq</name>
-               <key>max_freq</key>
-               <type>real</type>
-       </param>
-       <param>
-               <name>Min Freq</name>
-               <key>min_freq</key>
-               <type>real</type>
-       </param>
-       <param>
-               <name>Reference Phase</name>
-               <key>ref_phase</key>
-               <type>real</type>
-       </param>
-       <param>
-               <name>Omega</name>
-               <key>omega</key>
-               <type>real</type>
-       </param>
-       <param>
-               <name>Gain Omega</name>
-               <key>gain_omega</key>
-               <type>real</type>
-       </param>
-       <param>
-               <name>Mu</name>
-               <key>mu</key>
-               <type>real</type>
-       </param>
-       <param>
-               <name>Gain Mu</name>
-               <key>gain_mu</key>
-               <type>real</type>
-       </param>
-       <sink>
-               <name>in</name>
-               <type>complex</type>
-       </sink>
-       <source>
-               <name>out</name>
-               <type>complex</type>
-       </source>
-</block>
index e9f6c2be8bf8d0960c953050d89302e81461a3f8..45f81075f0faaa1df1a35a6c45e62571f835f5a8 100644 (file)
@@ -8,7 +8,7 @@
        <name>UDP Sink</name>
        <key>gr_udp_sink</key>
        <import>from gnuradio import gr</import>
-       <make>gr.udp_sink($type.size*$vlen, $ipaddr_local, $port_local, $ipaddr_remote, $port_remote, $mtu)</make>
+       <make>gr.udp_sink($type.size*$vlen, $ipaddr, $port, $psize, $eof)</make>
        <callback>set_mtu($mtu)</callback>
        <param>
                <name>Input Type</name>
                </option>
        </param>
        <param>
-               <name>Local IP Address</name>
-               <key>ipaddr_local</key>
-               <value>127.0.0.1</value>
+               <name>Destination IP Address</name>
+               <key>ipaddr</key>
                <type>string</type>
        </param>
        <param>
-               <name>Local Port</name>
-               <key>port_local</key>
-               <value>0</value>
+               <name>Destination Port</name>
+               <key>port</key>
                <type>int</type>
        </param>
        <param>
-               <name>Remote IP Address</name>
-               <key>ipaddr_remote</key>
-               <value>127.0.0.1</value>
-               <type>string</type>
-       </param>
-       <param>
-               <name>Remote Port</name>
-               <key>port_remote</key>
-               <value>1234</value>
+               <name>Payload Size</name>
+               <key>psize</key>
+               <value>1472</value>
                <type>int</type>
        </param>
        <param>
-               <name>MTU</name>
-               <key>mtu</key>
-               <value>1024</value>
-               <type>int</type>
+               <name>Send Null Pkt as EOF</name>
+               <key>eof</key>
+               <value>True</value>
+               <type>bool</type>
        </param>
        <param>
                <name>Vec Length</name>
index f03adf8024d43f3b9c2d4644e5e8769dbd0246c8..a1b961651f33eac2abba43a26a5f36ca3f7b8e30 100644 (file)
@@ -8,7 +8,7 @@
        <name>UDP Source</name>
        <key>gr_udp_source</key>
        <import>from gnuradio import gr</import>
-       <make>gr.udp_source($type.size*$vlen, $ipaddr, $port, $mtu)</make>
+       <make>gr.udp_source($type.size*$vlen, $ipaddr, $port, $psize, $eof, $wait)</make>
        <callback>set_mtu($mtu)</callback>
        <param>
                <name>Output Type</name>
                <type>int</type>
        </param>
        <param>
-               <name>MTU</name>
-               <key>mtu</key>
-               <value>1024</value>
+               <name>Payload Size</name>
+               <key>psize</key>
+               <value>1472</value>
                <type>int</type>
        </param>
+       <param>
+               <name>Null Pkt is EOF</name>
+               <key>eof</key>
+               <value>True</value>
+               <type>bool</type>
+       </param>
+       <param>
+               <name>Wait for Data</name>
+               <key>wait</key>
+               <value>True</value>
+               <type>bool</type>
+       </param>
        <param>
                <name>Vec Length</name>
                <key>vlen</key>
index 14586cc365109c6f1910d47ab370d3c5255d7587..f9fb25361feac11dd11ee4e49214ea5d5fd2ee0d 100644 (file)
@@ -21,7 +21,8 @@ self.$(id).set_interp($interpolation)
 self.$(id).set_lo_offset($lo_offset)
 #end if
 self.$(id).set_center_freq($frequency)
-self.$(id).set_gain($gain)</make>
+self.$(id).set_gain($gain)
+self.$(id).config_mimo($usrp2_clock_src)</make>
        <callback>set_interp($interpolation)</callback>
        <callback>#if $lo_offset() != float('inf')
 self.$(id).set_lo_offset($lo_offset)
@@ -84,6 +85,24 @@ self.$(id).set_center_freq($frequency)</callback>
                <value>0</value>
                <type>real</type>
        </param>
+       <param>
+               <name>Clock Source</name>
+               <key>usrp2_clock_src</key>
+               <value>usrp2.MC_WE_DONT_LOCK</value>
+               <type>enum</type>
+               <option>
+                       <name>Internal</name>
+                       <key>usrp2.MC_WE_DONT_LOCK</key>
+               </option>
+               <option>
+                       <name>External SMA</name>
+                       <key>usrp2.MC_WE_LOCK_TO_SMA</key>
+               </option>
+               <option>
+                       <name>External MIMO</name>
+                       <key>usrp2.MC_WE_LOCK_TO_MIMO</key>
+               </option>
+       </param>
        <sink>
                <name>in</name>
                <type>$type</type>
index 0f297dfd1286fbf0aea4fad8a8f69125b0d4302a..584199798f1b18325f0a31236747fc82f9bb91f5 100644 (file)
@@ -21,7 +21,8 @@ self.$(id).set_decim($decimation)
 self.$(id).set_lo_offset($lo_offset)
 #end if
 self.$(id).set_center_freq($frequency)
-self.$(id).set_gain($gain)</make>
+self.$(id).set_gain($gain)
+self.$(id).config_mimo($usrp2_clock_src)</make>
        <callback>set_decim($decimation)</callback>
        <callback>#if $lo_offset() != float('inf')
 self.$(id).set_lo_offset($lo_offset)
@@ -84,6 +85,24 @@ self.$(id).set_center_freq($frequency)</callback>
                <value>0</value>
                <type>real</type>
        </param>
+       <param>
+               <name>Clock Source</name>
+               <key>usrp2_clock_src</key>
+               <value>usrp2.MC_WE_DONT_LOCK</value>
+               <type>enum</type>
+               <option>
+                       <name>Internal</name>
+                       <key>usrp2.MC_WE_DONT_LOCK</key>
+               </option>
+               <option>
+                       <name>External SMA</name>
+                       <key>usrp2.MC_WE_LOCK_TO_SMA</key>
+               </option>
+               <option>
+                       <name>External MIMO</name>
+                       <key>usrp2.MC_WE_LOCK_TO_MIMO</key>
+               </option>
+       </param>
        <source>
                <name>out</name>
                <type>$type</type>
index 1c815c3470699f8900f087571f373cf1be289b9c..11bff9edc238354cf78a01b9f50f6da8ec8cd6b4 100644 (file)
@@ -46,7 +46,7 @@ self._$(id)_config.write(open($config_file, 'w'))</callback>
                <option>
                        <name>Bool</name>
                        <key>bool</key>
-                       <opt>get:getbool</opt>
+                       <opt>get:getboolean</opt>
                </option>
                <option>
                        <name>String</name>
index bfbdee9404fea4671740d578050cec6132bc2706..23bb70bf54db8ef94a816e1b41e78cfdec70c40a 100644 (file)
@@ -30,7 +30,7 @@ dist_ourdata_DATA = \
        grc-icon-48.png \
        grc-icon-32.png \
        gnuradio-grc.xml \
-       gnuradio-grc.desktop \
+       gnuradio-gnuradio-companion.desktop \
        gnuradio-usrp2_probe.desktop \
        gnuradio-usrp_probe.desktop
 
diff --git a/grc/freedesktop/gnuradio-gnuradio-companion.desktop b/grc/freedesktop/gnuradio-gnuradio-companion.desktop
new file mode 100644 (file)
index 0000000..5fd0497
--- /dev/null
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Version=1.0
+Type=Application
+Name=GRC
+Exec=gnuradio-companion %F
+Categories=Development;
+MimeType=application/gnuradio-grc;
+Icon=gnuradio-grc
diff --git a/grc/freedesktop/gnuradio-grc.desktop b/grc/freedesktop/gnuradio-grc.desktop
deleted file mode 100644 (file)
index d9c70ca..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-[Desktop Entry]
-Version=1.0
-Type=Application
-Name=GRC
-Exec=grc %F
-Categories=Development;
-MimeType=application/gnuradio-grc;
-Icon=gnuradio-grc
index db65064524577a859218760b26e3d5b9efbda6a6..a0c5ac193bde67f06bf58ae60d6ea4564202d86f 100644 (file)
@@ -8,7 +8,7 @@
 ##################################################
 
 ICON_SIZES="32 48 64 128 256"
-MENU_ITEMS="grc usrp2_probe usrp_probe"
+MENU_ITEMS="gnuradio-companion usrp2_probe usrp_probe"
 if [ -n "$2" ]; then
        SRCDIR="$2"
 else
index e24f88800f0ddc68b65d7245ceed2efab379ec8d..9019ec5cc9611256ee220318a7cfe60ddb05b917 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright 2008, 2009 Free Software Foundation, Inc.
+# Copyright 2008, 2009, 2010 Free Software Foundation, Inc.
 # 
 # This file is part of GNU Radio
 # 
@@ -21,4 +21,4 @@
 
 include $(top_srcdir)/Makefile.common
 
-dist_bin_SCRIPTS = grc usrp2_probe usrp_probe
+dist_bin_SCRIPTS = gnuradio-companion usrp2_probe usrp_probe
diff --git a/grc/scripts/gnuradio-companion b/grc/scripts/gnuradio-companion
new file mode 100755 (executable)
index 0000000..a4115c3
--- /dev/null
@@ -0,0 +1,54 @@
+#!/usr/bin/env python
+"""
+Copyright 2009 Free Software Foundation, Inc.
+This file is part of GNU Radio
+
+GNU Radio Companion is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+GNU Radio Companion is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
+"""
+
+import pygtk
+pygtk.require('2.0')
+import gtk
+
+try: from gnuradio import gr
+except ImportError, e:
+       d = gtk.MessageDialog(type=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_CLOSE, message_format="""
+Cannot import gnuradio. Are your PYTHONPATH and LD_LIBRARY_PATH set correctly?""")
+       d.set_title(str(e))
+       d.run()
+       exit(-1)
+
+from gnuradio import gr
+from optparse import OptionParser
+
+if __name__ == "__main__":
+       usage = 'usage: %prog [options] [saved flow graphs]'
+       version = """
+GNU Radio Companion %s
+
+This program is part of GNU Radio
+GRC comes with ABSOLUTELY NO WARRANTY.
+This is free software,
+and you are welcome to redistribute it.
+"""%gr.version()
+       parser = OptionParser(usage=usage, version=version)
+       (options, args) = parser.parse_args()
+       from gnuradio.grc.python.Platform import Platform
+       from gnuradio.grc.gui.ActionHandler import ActionHandler
+       #setup icon using icon theme
+       try: gtk.window_set_default_icon(gtk.IconTheme().load_icon('gnuradio-grc', 256, 0))
+       except: pass
+       ActionHandler(args, Platform())
+
diff --git a/grc/scripts/grc b/grc/scripts/grc
deleted file mode 100755 (executable)
index a4115c3..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/usr/bin/env python
-"""
-Copyright 2009 Free Software Foundation, Inc.
-This file is part of GNU Radio
-
-GNU Radio Companion is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-GNU Radio Companion is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
-"""
-
-import pygtk
-pygtk.require('2.0')
-import gtk
-
-try: from gnuradio import gr
-except ImportError, e:
-       d = gtk.MessageDialog(type=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_CLOSE, message_format="""
-Cannot import gnuradio. Are your PYTHONPATH and LD_LIBRARY_PATH set correctly?""")
-       d.set_title(str(e))
-       d.run()
-       exit(-1)
-
-from gnuradio import gr
-from optparse import OptionParser
-
-if __name__ == "__main__":
-       usage = 'usage: %prog [options] [saved flow graphs]'
-       version = """
-GNU Radio Companion %s
-
-This program is part of GNU Radio
-GRC comes with ABSOLUTELY NO WARRANTY.
-This is free software,
-and you are welcome to redistribute it.
-"""%gr.version()
-       parser = OptionParser(usage=usage, version=version)
-       (options, args) = parser.parse_args()
-       from gnuradio.grc.python.Platform import Platform
-       from gnuradio.grc.gui.ActionHandler import ActionHandler
-       #setup icon using icon theme
-       try: gtk.window_set_default_icon(gtk.IconTheme().load_icon('gnuradio-grc', 256, 0))
-       except: pass
-       ActionHandler(args, Platform())
-
index 6377f5bb3ae9ccb96a78e62004dd1c89a3b7ecaf..504c4d94983ca1323c49b4bd386168aee8dd236c 100644 (file)
@@ -6,6 +6,6 @@ includedir=@includedir@
 Name: gruel
 Description: The GNU Radio Utility Etcetera Library
 Requires: 
-Version: @VERSION@
+Version: @LIBVER@
 Libs: -L${libdir} -lgruel
 Cflags: -I${includedir}
index 6bde9ee272addaed96b97c1e8570803ea0c51458..1bcd26e90717feed2d578c59dcddcb7519d77adc 100644 (file)
@@ -34,7 +34,7 @@ noinst_PROGRAMS = test_gruel
 lib_LTLIBRARIES = libgruel.la
 
 # magic flags
-libgruel_la_LDFLAGS = $(NO_UNDEFINED) $(BOOST_LDFLAGS) -version-info 0:0:0
+libgruel_la_LDFLAGS = $(NO_UNDEFINED) $(BOOST_LDFLAGS) $(LTVERSIONFLAGS)
 
 # ----------------------------------------------------------------
 
index d73cbbc4f74d647a80eef358a7bb34e33c41da1e..00c2e3414138ace2c51870ad1a9d0bc733c373a0 100755 (executable)
@@ -182,10 +182,6 @@ if __name__ == '__main__':
         sys.stderr.write (
             "You must specify the install prefix with -p PREFIX\n")
         sys.exit (1)
-    if not os.path.isdir(options.prefix):
-        sys.stderr.write (
-            "PREFIX dir (" + options.prefix + "), does not exist\n")
-        sys.exit (1)
 
     ihx_filename = args[0]
 
index 7ff1e973698c5fe453d427d53a3c6b47eb28fbbf..0c908e3d55b05ba688e8952da054d960b0d7ceab 100755 (executable)
@@ -65,12 +65,14 @@ daughterboards = {
     'rfx900_mimo_b'   : ((FLEX_900_TX_MIMO_B, 0x0000),     (FLEX_900_RX_MIMO_B, 0x0000)),
     'rfx1200_mimo_b'  : ((FLEX_1200_TX_MIMO_B, 0x0000),    (FLEX_1200_RX_MIMO_B, 0x0000)),
     'rfx1800_mimo_b'  : ((FLEX_1800_TX_MIMO_B, 0x0000),    (FLEX_1800_RX_MIMO_B, 0x0000)),
+    'rfx2200_mimo_b'  : ((FLEX_2200_TX_MIMO_B, 0x0000),    (FLEX_2200_RX_MIMO_B, 0x0000)),
     'rfx2400_mimo_b'  : ((FLEX_2400_TX_MIMO_B, 0x0000),    (FLEX_2400_RX_MIMO_B, 0x0000)),
     'lftx'            : ((LF_TX, 0x0000),           None),
     'lfrx'            : (None,                      (LF_RX, 0x0000)),
     'wbx_lo'          : ((WBX_LO_TX, 0x0000),       (WBX_LO_RX, 0x0000)),
     'wbx_ng'          : ((WBX_NG_TX, 0x0000),       (WBX_NG_RX, 0x0000)),
     'xcvr2450'        : ((XCVR2450_TX, 0x0000),       (XCVR2450_RX, 0x0000)),
+    'bitshark_rx'     : (None,                      (BITSHARK_RX, 0x0000)),
     'experimental_tx' : ((EXPERIMENTAL_TX, 0x0000), None),
     'experimental_rx' : (None,                      (EXPERIMENTAL_RX, 0x0000)),
     }
index cfce514438397475c08cdf79d20db5140d4a8c11..2aaf66a536c17fbe72a1a60c0cde9ff9613b4ecb 100644 (file)
@@ -26,6 +26,7 @@ usrpincludedir = $(includedir)/usrp
 usrpinclude_HEADERS = \
        db_base.h \
        db_basic.h \
+       db_bitshark_rx.h \
        db_dbs_rx.h \
        db_dtt754.h \
        db_dtt768.h \
diff --git a/usrp/host/include/usrp/db_bitshark_rx.h b/usrp/host/include/usrp/db_bitshark_rx.h
new file mode 100644 (file)
index 0000000..f81877d
--- /dev/null
@@ -0,0 +1,56 @@
+/* -*- c++ -*- */
+//
+// Copyright 2010 Free Software Foundation, Inc.
+// 
+// This file is part of GNU Radio
+// 
+// GNU Radio is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either asversion 3, or (at your option)
+// any later version.
+// 
+// GNU Radio is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with GNU Radio; see the file COPYING.  If not, write to
+// the Free Software Foundation, Inc., 51 Franklin Street,
+// Boston, MA 02110-1301, USA.
+
+#ifndef DB_BITSHARK_RX_H
+#define DB_BITSHARK_RX_H
+
+#include <usrp/db_base.h>
+#include <vector>
+#include <stdint.h>
+
+class db_bitshark_rx : public db_base
+{
+private:
+    int d_i2c_addr;
+    // Internal function for interfacing to the card
+    void _set_pga(int pga_gain);
+    
+protected:
+    void shutdown();
+    
+public:
+    db_bitshark_rx(usrp_basic_sptr usrp, int which);
+    ~db_bitshark_rx();
+    
+    float gain_min();
+    float gain_max();
+    float gain_db_per_step();
+    double freq_min();
+    double freq_max();
+    struct freq_result_t set_freq(double freq);
+    bool  set_gain(float gain);
+    bool  set_bw(float bw);
+    bool  set_clock_scheme(uint8_t clock_scheme, uint32_t ref_clock_freq);
+    bool  is_quadrature();
+    bool  i_and_q_swapped();
+};
+
+#endif
index 0c834402d0e44f8fa4f70bec409bc85672fef007..70a55514ee5188fa4c0938567577cb229b796805 100644 (file)
@@ -138,6 +138,18 @@ protected:
 
 //----------------------------------------------------------------------
 
+class _2200_common : public _AD4360_common
+{
+ public:
+  _2200_common();
+  ~_2200_common() {}
+  double freq_min();
+  double freq_max();
+};
+
+//----------------------------------------------------------------------
+
 class _2400_common : public _AD4360_common
 {
  public:
@@ -212,6 +224,34 @@ public:
 
 //------------------------------------------------------------    
 
+class db_flexrf_2200_tx : public flexrf_base_tx
+{
+ public:
+  db_flexrf_2200_tx(usrp_basic_sptr usrp, int which);
+  ~db_flexrf_2200_tx();
+
+  // Wrapper calls to d_common functions
+  bool _compute_regs(double freq, int &retR, int &retcontrol,
+                    int &retN, double &retfreq);
+};
+
+class db_flexrf_2200_rx : public flexrf_base_rx
+{
+public:
+  db_flexrf_2200_rx(usrp_basic_sptr usrp, int which);
+  ~db_flexrf_2200_rx();
+  
+  float gain_min();
+  float gain_max();
+  float gain_db_per_step();
+  bool i_and_q_swapped();
+
+  bool _compute_regs(double freq, int &retR, int &retcontrol,
+                    int &retN, double &retfreq);
+};
+
+//------------------------------------------------------------    
+
 class db_flexrf_2400_tx : public flexrf_base_tx
 {
  public:
index 8611d4787debec97b1c56d03310d01bce1189cf5..9a7829278731f1d1fa06c8186131b4b9912379ed 100644 (file)
@@ -30,7 +30,7 @@ class adf4350;
 class wbxng_base : public db_base
 {
 public:
-  wbxng_base(usrp_basic_sptr usrp, int which, int _power_on=0);
+  wbxng_base(usrp_basic_sptr usrp, int which);
   ~wbxng_base();
 
   struct freq_result_t set_freq(double freq);
@@ -40,31 +40,30 @@ public:
   double freq_max();
 
 protected:
-  bool _lock_detect();
+  void _write_spi(std::string data);
+  int _refclk_divisor();
+  bool _get_locked();
   bool _set_pga(float pga_gain);
 
-  int power_on() { return d_power_on; }
-  int power_off() { return 0; }
-
   bool d_first;
   int  d_spi_format;
   int  d_spi_enable;
   int  d_power_on;
   int  d_PD;
 
-  adf4350 *d_common;
+  boost::shared_ptr<adf4350> d_common;
 };
 
 // ----------------------------------------------------------------
 
-class wbxng_base_tx : public wbxng_base
+class db_wbxng_tx : public wbxng_base
 {
 protected:
   void shutdown();
 
 public:
-  wbxng_base_tx(usrp_basic_sptr usrp, int which, int _power_on=0);
-  ~wbxng_base_tx();
+  db_wbxng_tx(usrp_basic_sptr usrp, int which);
+  ~db_wbxng_tx();
 
   float gain_min();
   float gain_max();
@@ -75,36 +74,20 @@ public:
   bool set_gain(float gain);
 };
 
-class wbxng_base_rx : public wbxng_base
+class db_wbxng_rx : public wbxng_base
 {
 protected:
   void shutdown();
   bool _set_attn(float attn);
 
 public:
-  wbxng_base_rx(usrp_basic_sptr usrp, int which, int _power_on=0);
-  ~wbxng_base_rx();
+  db_wbxng_rx(usrp_basic_sptr usrp, int which);
+  ~db_wbxng_rx();
 
   bool set_auto_tr(bool on);
   bool select_rx_antenna(int which_antenna);
   bool select_rx_antenna(const std::string &which_antenna);
   bool set_gain(float gain);
-};
-
-// ----------------------------------------------------------------
-
-class db_wbxng_tx : public wbxng_base_tx
-{
- public:
-  db_wbxng_tx(usrp_basic_sptr usrp, int which);
-  ~db_wbxng_tx();
-};
-
-class db_wbxng_rx : public wbxng_base_rx
-{
-public:
-  db_wbxng_rx(usrp_basic_sptr usrp, int which);
-  ~db_wbxng_rx();
 
   float gain_min();
   float gain_max();
index 5848412c936e9ee9e82212a62b06e6dc37410592..23889fc85a25822b313dcb62883c0f08a684c028 100644 (file)
@@ -24,7 +24,7 @@ common_INCLUDES = $(USRP_INCLUDES) $(USB_INCLUDES)
 
 lib_LTLIBRARIES = libusrp.la
 
-libusrp_la_common_LDFLAGS = $(NO_UNDEFINED) -version-info 0:0:0 $(BOOST_LDFLAGS)
+libusrp_la_common_LDFLAGS = $(NO_UNDEFINED) $(LTVERSIONFLAGS) $(BOOST_LDFLAGS)
 
 libusrp_la_common_LIBADD =             \
        $(USB_LIBS)                     \
@@ -120,6 +120,7 @@ libusrp_la_common_SOURCES =                 \
        db_boards.cc                    \
        db_base.cc                      \
        db_basic.cc                     \
+       db_bitshark_rx.cc               \
        db_tv_rx.cc                     \
        db_tv_rx_mimo.cc                \
        db_flexrf.cc                    \
index 1cb4634296d8a5569adf071bbd7a9e01a6b92319..b4fb45c517a9a1fa1979fd0ffb8622e0039f2499 100644 (file)
@@ -238,7 +238,7 @@ int
 db_base::_refclk_divisor()
 {
   // Return value to stick in REFCLK_DIVISOR register
-  throw std::runtime_error("_reflck_divisor() called from base class\n");;
+  throw std::runtime_error("_refclk_divisor() called from base class\n");;
 }
 
 bool
diff --git a/usrp/host/lib/db_bitshark_rx.cc b/usrp/host/lib/db_bitshark_rx.cc
new file mode 100644 (file)
index 0000000..5368866
--- /dev/null
@@ -0,0 +1,417 @@
+//
+// Copyright 2010 Free Software Foundation, Inc.
+// 
+// This file is part of GNU Radio
+// 
+// GNU Radio is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either asversion 3, or (at your option)
+// any later version.
+// 
+// GNU Radio is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with GNU Radio; see the file COPYING.  If not, write to
+// the Free Software Foundation, Inc., 51 Franklin Street,
+// Boston, MA 02110-1301, USA.
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <usrp/db_bitshark_rx.h>
+#include <db_base_impl.h>
+#include <cmath>
+#include <cstdio>
+#include <string.h>
+#include <stdint.h>
+
+/* Note: Thie general structure of this file is based on the db_dbsrx.cc 
+   codebase for the dbsrx daughterboard. */
+
+/* The following defines specify the address map provided by the
+   Bitshark card. These registers are all accessed over I2C. */
+#define RF_CENTER_FREQ_REG 0x00
+#define RF_CHAN_FILTER_BW_REG 0x01
+#define RF_GAIN_REG 0x02
+#define BB_GAIN_REG 0x03
+#define ADF4350_REG 0x10
+#define SKY73202_REG 0x11
+#define CLOCK_SCHEME_REG 0x20
+
+/* The following table lists the registers provided by the BURX board that
+   are accessible over I2C:
+   --------------------------------------------------------
+   |RegAddr: 0x00-RF Center Freq register |
+       |4-bytes 0x00|
+       |4-byte unsigned RF center freq (in KHz)|
+   |RegAddr: 0x01-RF channel filter bandwidth register |
+       |4-bytes 0x00|
+       |4-byte unsigned RF channel filter bw (in KHz)|
+   |RegAddr: 0x02-RF gain register |
+       |7-bytes 0x00|
+       |1-byte signed RF gain (in dB)|
+   |RegAddr: 0x03-Baseband gain register |
+       |4-bytes 0x00|
+       |4-byte signed baseband filter gain (in dB)|
+   |RegAddr: 0x10-ADF4350 register |
+       |4-bytes 0x00|
+       |4-byte ADF4350 register value (actual ADF4350 reg addr embedded 
+        within 4-byte value)|
+   |RegAddr: 0x11-SKY73202 register |
+       |5-bytes 0x00|
+       |1-byte reg 0 of SKY73202 |
+       |1-byte reg 1 of SKY73202 |
+       |1-byte reg 2 of SKY73202 |
+   |RegAddr: 0x20-Clock Scheme |
+       |3-bytes 0x00|
+       |1-byte indicating clocking scheme:
+        -0x00 -> BURX local TCXO off, BURX accepts ref clock from
+                USRP (freq of USRP's ref clock specified in bytes 2-5)
+       -0x01 -> BURX local TCXO on, BURX uses its local TCXO as its ref
+                clock, TCXO signal output for use by USRP |
+       |4-byte USRP ref clock freq in hz (only needed if byte 1 set to 0x00) |
+       
+  ---------------------------------------------------------------------------
+   
+   As an example, lets say the client wants to set an RF center freq of
+   1000 MHz.  In KHz, this translates to 1000000 (resolution is only down to
+   steps of 1 KHz), which is 0x000F4240 in hex.  So the complete 9-byte I2C 
+   sequence that the client should send is as follows:
+   byte 0: 0x00-register 0x00 is the target of the write operation
+   bytes 1-4: 0x00 (padding)
+   byte 5: 0x40 (LSB of the 1000000 KHz value, in hex)
+   byte 6: 0x42
+   byte 7: 0x0F
+   byte 8: 0x00 (MSB of the 1000000 KHz value, in hex)
+
+   If using the usrper cmd-line application on a PC, this sequence would
+   be sent as follows (assuming that the BURX is in slot A):
+   
+   # usrper i2c_write 0x47 000000000040420F00
+   
+   How about another example...lets say the client wants to setup the clock
+   scheme to use scheme #1 where the 26 MHz TCXO on the BURX board is enabled,
+   and is provided to the USRP.  26 MHz (i.e. 26 million), in hex, is 0x18CBA80.
+   So the complete 9-byte I2C sequence that the client should send is as follows:
+   byte 0: 0x20-register 0x20 is the target of the write operation
+   bytes 1-3: 0x00 (padding)
+   byte 4: 0x01 (indicating that clock scheme #1 is wanted)
+   byte 5: 0x80 (LSB of the BURX ref clk freq)
+   byte 6: 0xBA
+   byte 7: 0x8C
+   byte 8: 0x01 (MSB of the BURX ref clk freq)
+   
+   To enable the BURX local ref clk, which will also make it available on the
+   on-board U.FL connector as a source for the USRP, a user can also use
+   the usrper cmd-line application on a PC.  The following sequence would
+   be sent (assuming that the BURX is in slot A):
+   
+   # usrper i2c_write 0x47 200000000180BA8C01
+
+*/
+
+#define NUM_BYTES_IN_I2C_CMD 9   
+
+/*****************************************************************************/
+
+db_bitshark_rx::db_bitshark_rx(usrp_basic_sptr _usrp, int which)
+  : db_base(_usrp, which)
+{
+    // Control Bitshark receiver USRP daughterboard.
+    // 
+    // @param usrp: instance of usrp.source_c
+    // @param which: which side: 0, 1 corresponding to RX_A or RX_B respectively
+
+    // turn off all outputs
+    usrp()->_write_oe(d_which, 0, 0xffff);
+
+    if (which == 0) 
+    {
+       d_i2c_addr = 0x47;
+    }
+    else 
+    {
+       d_i2c_addr = 0x45;
+    }
+
+    // initialize gain
+    set_gain((gain_min() + gain_max()) / 2.0);
+
+    // by default, assume we're using the USRPs clock as the ref clk,
+    // so setup the clock scheme and frequency.  If the user wants
+    // to use the Bitshark's TCXO, the clock scheme should be set
+    // to 1, the freq should be set to 26000000, and a top-level
+    // 'make' and 'make install' needs to be executed.  In addition, 
+    // a U.FL to SMA cable needs to connect J6 on the Bitshark to 
+    // the external clk input on the USRP
+    set_clock_scheme(0,64000000);
+
+    set_bw(8e6); // Default IF bandwidth to match USRP1 max host bandwidth
+
+    bypass_adc_buffers(true);
+}
+
+db_bitshark_rx::~db_bitshark_rx()
+{
+    shutdown();
+}
+
+/************ Private Functions **********************/
+
+void
+db_bitshark_rx::_set_pga(int pga_gain)
+{
+    assert(pga_gain>=0 && pga_gain<=20);
+    if(d_which == 0) 
+    {
+       usrp()->set_pga (0, pga_gain);
+       usrp()->set_pga (1, pga_gain);
+    }
+    else 
+    {
+       usrp()->set_pga (2, pga_gain);
+       usrp()->set_pga (3, pga_gain);
+    }
+}
+
+/************ Public Functions **********************/
+void
+db_bitshark_rx::shutdown()
+{
+    if (!d_is_shutdown)
+    {
+       d_is_shutdown = true;
+    }
+}
+
+bool
+db_bitshark_rx::set_bw (float bw)
+{
+    std::vector<int> args(NUM_BYTES_IN_I2C_CMD,0);
+    uint16_t rf_bw_in_khz = (uint16_t)(bw/1000.0);
+    char val[4];
+    bool result = false;
+    uint8_t try_count = 0;
+    
+    memset(val,0x00,4);
+    if (rf_bw_in_khz < 660  || rf_bw_in_khz > 56000) 
+    {
+       fprintf(stderr, "db_bitshark_rx::set_bw: bw (=%d) must be between 660 KHz and 56 MHz inclusive\n", rf_bw_in_khz);
+       return false;
+    }
+    //fprintf(stdout,"Setting bw: requested bw in khz is %d\r\n",rf_bw_in_khz);
+    memcpy(val,&rf_bw_in_khz,4);
+    args[0] = RF_CHAN_FILTER_BW_REG;
+    args[5] = val[0];
+    args[6] = val[1];
+    args[7] = val[2];
+    args[8] = val[3];
+    while ((result != true) && (try_count < 3))
+    {
+       result=usrp()->write_i2c (d_i2c_addr, int_seq_to_str (args));
+       try_count++;
+    }
+
+    if (result == false)
+    {
+       fprintf(stderr, "db_bitshark_rx:set_bw: giving up after 3 tries without success\n");
+    }
+    
+    return result;
+}
+
+/* The gain referenced below is RF gain only.  There are two independent
+   gain settings at RF: a digital step attenuator (providing 0, -6, -12, and
+   -18 dB of attenuation), and a second LNA (LNA2) that provides ~25 dB of
+   gain (roughly...it actually depends on the RF freq).  So combining these
+   two stages can provide an overall gain range from 0 (which is mapped
+   to -18 dB on the step attenuator + LNA2 turned off) to 42 (which is
+   mapped to 0 dB on the step attenuator + LNA2 turned on).  
+   
+   There could be better ways to map these, but this is sufficient for
+   now. */
+float
+db_bitshark_rx::gain_min()
+{
+    return 0;
+}
+
+float
+db_bitshark_rx::gain_max()
+{
+    return 42;
+}
+
+float
+db_bitshark_rx::gain_db_per_step()
+{
+    return 6;
+}
+
+bool 
+db_bitshark_rx::set_gain(float gain)
+{
+    // Set the gain.
+    // 
+    // @param gain:  RF gain in decibels, range of 0-42
+    // @returns True/False
+    
+    std::vector<int> args(NUM_BYTES_IN_I2C_CMD,0);
+    bool result = false;
+    uint8_t try_count = 0;
+        
+    if (gain < gain_min() || gain > gain_max()) 
+    {
+       fprintf(stderr,"db_bitshark_rx::set_gain: gain (=%f) must be between %f and %f inclusive\n", gain,gain_min(),gain_max());
+       return false;
+    }
+    //fprintf(stdout,"db_bitshark_rx::set_gain: requested gain of %f\r\n",gain);
+    args[0] = RF_GAIN_REG;
+    args[5] = (int)gain;
+
+    while ((result != true) && (try_count < 3))
+    {
+       result=usrp()->write_i2c (d_i2c_addr, int_seq_to_str (args));
+       try_count++;
+    }
+
+    if (result == false)
+    {
+       fprintf(stderr, "db_bitshark_rx:set_gain: giving up after 3 tries without success\n");
+    }
+    
+    return result;
+}
+
+
+bool 
+db_bitshark_rx::set_clock_scheme(uint8_t clock_scheme, uint32_t ref_clk_freq)
+{
+    // Set the clock scheme for determining how the BURX
+    // dboard receives its clock.  Note: Ideally, the constructor for the
+    // BURX board could simply call this method to set how it wants the
+    // clock scheme configured.  However, depending on the application
+    // using the daughterboard, the constructor may run _after_ some
+    // other portion of the application needs the FPGA.  And if the
+    // the clock source for the FPGA was the BURX's 26 MHz TCXO, we're in
+    // a chicken-before-the-egg dilemna.  So the solution is to leave
+    // this function here for reference in case an app wants to use it,
+    // and also give the user the ability to set the clock scheme through
+    // the usrper cmd-line application (see example at the top of this
+    // file).
+    // 
+    // @param clock_scheme
+    // @param ref_clk_freq in Hz
+    // @returns True/False
+    
+    std::vector<int> args(NUM_BYTES_IN_I2C_CMD,0);
+    bool result = false;
+    uint8_t try_count = 0;
+    char val[4];
+        
+    if (clock_scheme > 1) 
+    {
+       fprintf(stderr,"db_bitshark_rx::set_clock_scheme: invalid scheme %d\n",clock_scheme);
+       return false;
+    }
+    //fprintf(stdout,"db_bitshark_rx::set_clock_scheme: requested clock schem of %d with freq %d Hz \n",clock_scheme,ref_clk_freq);
+    memcpy(val,&ref_clk_freq,4);
+    args[0] = CLOCK_SCHEME_REG;
+    args[4] = (int)clock_scheme;
+    args[5] = val[0];
+    args[6] = val[1];
+    args[7] = val[2];
+    args[8] = val[3];
+
+    while ((result != true) && (try_count < 3))
+    {
+       result=usrp()->write_i2c (d_i2c_addr, int_seq_to_str (args));
+       try_count++;
+    }
+
+    if (result == false)
+    {
+       fprintf(stderr, "db_bitshark_rx:set_clock_scheme: giving up after 3 tries without success\n");
+    }
+    return result;
+}
+
+double
+db_bitshark_rx::freq_min()
+{    
+    return 300e6;
+}
+
+double
+db_bitshark_rx::freq_max()
+{    
+    return 4e9;
+}
+
+struct freq_result_t
+db_bitshark_rx::set_freq(double freq)
+{
+    // Set the frequency.
+    // 
+    // @param freq:  target RF frequency in Hz
+    // @type freq:   double
+    // 
+    // @returns (ok, actual_baseband_freq) where:
+    //   ok is True or False and indicates success or failure,
+    //   actual_baseband_freq is RF frequency that corresponds to DC in the IF.
+    
+    std::vector<int> args(NUM_BYTES_IN_I2C_CMD,0);
+    std::vector<int> bytes(2);
+    char val[4];
+    freq_result_t act_freq = {false, 0};
+    uint32_t freq_in_khz = (uint32_t)(freq/1000.0);
+    bool result = false;
+    uint8_t try_count = 0;
+        
+    memset(val,0x00,4);
+    if(!(freq>=freq_min() && freq<=freq_max())) 
+    {
+       return act_freq;
+    }
+    
+    //fprintf(stdout,"db_bitshark_rx::set_freq: requested freq is %d KHz\n",freq_in_khz);
+    memcpy(val,&freq_in_khz,4);
+    args[0] = RF_CENTER_FREQ_REG;
+    args[5] = val[0];
+    args[6] = val[1];
+    args[7] = val[2];
+    args[8] = val[3];
+
+    while ((result != true) && (try_count < 3))
+    {
+       result=usrp()->write_i2c (d_i2c_addr, int_seq_to_str (args));
+       try_count++;
+    }
+
+    if (result == false)
+    {
+       fprintf(stderr, "db_bitshark_rx:set_freq: giving up after 3 tries without success\n");
+    }
+        
+    act_freq.ok = result;
+    act_freq.baseband_freq = (double)freq;
+    return act_freq;
+}
+
+bool 
+db_bitshark_rx::is_quadrature()
+{    
+    // Return True if this board requires both I & Q analog channels.  
+    return true;
+}
+
+bool
+db_bitshark_rx::i_and_q_swapped()
+{
+    // Returns True since our I and Q channels are swapped
+    return true;
+}
index 590d8132d152f02b368c6ee028cf6f28e539d2c8..9324d58ee270eb9c21fb0856436eb3ea4b72afe7 100644 (file)
@@ -36,6 +36,7 @@
 #include <usrp/db_xcvr2450.h>
 #include <usrp/db_dtt754.h>
 #include <usrp/db_dtt768.h>
+#include <usrp/db_bitshark_rx.h>
 #include <cstdio>
 
 std::vector<db_base_sptr>
@@ -209,6 +210,10 @@ instantiate_dbs(int dbid, usrp_basic_sptr usrp, int which_side)
     db.push_back(db_base_sptr(new db_dtt768(usrp, which_side)));
     break;
 
+  case(USRP_DBID_BITSHARK_RX):
+    db.push_back(db_base_sptr(new db_bitshark_rx(usrp, which_side)));
+    break;
+
   case(-1):
     if (boost::dynamic_pointer_cast<usrp_basic_tx>(usrp)){
       db.push_back(db_base_sptr(new db_basic_tx(usrp, which_side)));
index 07ac2be3bc22e1cafc1479e5dee61e2d31b9c245..2819c19bd79f73c443a3c0c13fd690e3b76f5947 100644 (file)
@@ -639,6 +639,38 @@ _AD4360_common::_prescaler()
 
 //----------------------------------------------------------------------
 
+_2200_common::_2200_common()
+  : _AD4360_common()
+{
+  // Band-specific R-Register Values
+  d_R_DIV = 16;  // bits 15:2
+   
+  // Band-specific C-Register values
+  d_P = 1;        // bits 23,22   Div by 16/17
+  d_CP2 = 7;      // bits 19:17
+  d_CP1 = 7;      // bits 16:14
+
+  // Band specifc N-Register Values
+  d_DIVSEL = 0;   // bit 23
+  d_DIV2 = 0;     // bit 22
+  d_CPGAIN = 0;   // bit 21
+  d_freq_mult = 1;
+}
+
+double
+_2200_common::freq_min()
+{
+  return 2000e6;
+}
+
+double
+_2200_common::freq_max()
+{
+  return 2400e6;
+}
+
+//----------------------------------------------------------------------
+
 _2400_common::_2400_common()
   : _AD4360_common()
 {
@@ -811,6 +843,72 @@ _400_rx::_400_rx()
 
 //------------------------------------------------------------    
 
+db_flexrf_2200_tx::db_flexrf_2200_tx(usrp_basic_sptr usrp, int which)
+  : flexrf_base_tx(usrp, which)
+{
+  d_common = new _2200_common();
+}
+
+db_flexrf_2200_tx::~db_flexrf_2200_tx()
+{
+}
+
+bool
+db_flexrf_2200_tx::_compute_regs(double freq, int &retR, int &retcontrol,
+                                int &retN, double &retfreq)
+{
+  return d_common->_compute_regs(_refclk_freq(), freq, retR,
+                                retcontrol, retN, retfreq);
+}
+
+
+
+db_flexrf_2200_rx::db_flexrf_2200_rx(usrp_basic_sptr usrp, int which)
+  : flexrf_base_rx(usrp, which)
+{
+  d_common = new _2200_common();
+  set_gain((gain_min() + gain_max()) / 2.0);  // initialize gain
+}
+
+db_flexrf_2200_rx::~db_flexrf_2200_rx()
+{
+}
+
+float
+db_flexrf_2200_rx::gain_min()
+{
+  return usrp()->pga_min();
+}
+
+float
+db_flexrf_2200_rx::gain_max()
+{
+  return usrp()->pga_max()+70;
+}
+
+float
+db_flexrf_2200_rx::gain_db_per_step()
+{
+  return 0.05;
+}
+
+
+bool
+db_flexrf_2200_rx::i_and_q_swapped()
+{
+  return true;
+}
+
+bool
+db_flexrf_2200_rx::_compute_regs(double freq, int &retR, int &retcontrol,
+                                int &retN, double &retfreq)
+{
+  return d_common->_compute_regs(_refclk_freq(), freq, retR,
+                                retcontrol, retN, retfreq);
+}
+
+//------------------------------------------------------------    
+
 db_flexrf_2400_tx::db_flexrf_2400_tx(usrp_basic_sptr usrp, int which)
   : flexrf_base_tx(usrp, which)
 {
index bd836dfe331090724a18c8c9f414ec274dd66032..89200653ea6f8e646ebe13c501870ba64963d871 100644 (file)
@@ -46,8 +46,8 @@
 #define ATTN_SHIFT     8
 #define ATTN_MASK      (63 << ATTN_SHIFT)
 
-wbxng_base::wbxng_base(usrp_basic_sptr _usrp, int which, int _power_on)
-  : db_base(_usrp, which), d_power_on(_power_on)
+wbxng_base::wbxng_base(usrp_basic_sptr _usrp, int which)
+  : db_base(_usrp, which)
 {
   /*
     @param usrp: instance of usrp.source_c
@@ -67,8 +67,12 @@ wbxng_base::wbxng_base(usrp_basic_sptr _usrp, int which, int _power_on)
 
 wbxng_base::~wbxng_base()
 {
-  if (d_common)
-    delete d_common;
+}
+
+int
+wbxng_base::_refclk_divisor()
+{
+  return 1;
 }
 
 struct freq_result_t
@@ -83,8 +87,19 @@ wbxng_base::set_freq(double freq)
   // clamp freq
   freq_t int_freq = freq_t(std::max(freq_min(), std::min(freq, freq_max())));
 
-  bool ok = d_common->_set_freq(int_freq*2);
-  double freq_result = (double) d_common->_get_freq()/2.0;
+  bool ok = d_common->_set_freq(int_freq*2, _refclk_freq());
+
+  _write_spi(d_common->compute_register(5));
+  _write_spi(d_common->compute_register(4));
+  _write_spi(d_common->compute_register(3));
+  /* load involved registers */
+  _write_spi(d_common->compute_register(2));
+  _write_spi(d_common->compute_register(1));
+  _write_spi(d_common->compute_register(0));
+
+  double freq_result = (double) d_common->_get_freq(_refclk_freq())/2.0;
+
+  //ok &= _get_locked();
   struct freq_result_t args = {ok, freq_result};
 
   /* Wait before reading Lock Detect*/
@@ -144,10 +159,22 @@ wbxng_base::freq_max()
   return (double) d_common->_get_max_freq()/2.0;
 }
 
+bool
+wbxng_base::_get_locked(void)
+{
+    return usrp()->read_io(d_which) & PLL_LOCK_DETECT;
+}
+
+void
+wbxng_base::_write_spi(std::string data)
+{
+    usrp()->_write_spi(0, d_spi_enable, d_spi_format, data);
+}
+
 // ----------------------------------------------------------------
 
-wbxng_base_tx::wbxng_base_tx(usrp_basic_sptr _usrp, int which, int _power_on)
-  : wbxng_base(_usrp, which, _power_on)
+db_wbxng_tx::db_wbxng_tx(usrp_basic_sptr _usrp, int which)
+  : wbxng_base(_usrp, which)
 {
   /*
     @param usrp: instance of usrp.sink_c
@@ -161,40 +188,48 @@ wbxng_base_tx::wbxng_base_tx(usrp_basic_sptr _usrp, int which, int _power_on)
     d_spi_enable = SPI_ENABLE_TX_B;
   }
 
-  d_common = new adf4350(_usrp, d_which, d_spi_enable);
+  d_common = boost::shared_ptr<adf4350> (new adf4350());
+
+  /* Initialize the registers. */
+  _write_spi(d_common->compute_register(5));
+  _write_spi(d_common->compute_register(4));
+  _write_spi(d_common->compute_register(3));
+  _write_spi(d_common->compute_register(2));
+  _write_spi(d_common->compute_register(1));
+  _write_spi(d_common->compute_register(0));
 
   // power up the transmit side, but don't enable the mixer
-  usrp()->_write_oe(d_which,(RX_TXN|TXMOD_EN|ENABLE_33|ENABLE_5), (RX_TXN|TXMOD_EN|ENABLE_33|ENABLE_5));
-  usrp()->write_io(d_which, (power_on()|RX_TXN|ENABLE_33|ENABLE_5), (RX_TXN|ENABLE_33|ENABLE_5));
+  usrp()->_write_oe(d_which,(PLL_CE|PLL_PDBRF|RX_TXN|TXMOD_EN|ENABLE_33|ENABLE_5), (PLL_CE|PLL_PDBRF|RX_TXN|TXMOD_EN|ENABLE_33|ENABLE_5));
+  usrp()->write_io(d_which, (PLL_CE|RX_TXN|ENABLE_33|ENABLE_5), (PLL_CE|PLL_PDBRF|RX_TXN|ENABLE_33|ENABLE_5));
   //set_lo_offset(4e6);
   
   // Disable VCO/PLL
-  d_common->_enable(true);
+  //d_common->_enable(true);
+  usrp()->write_io(d_which, (PLL_PDBRF), (PLL_PDBRF));
 
-  set_gain((gain_min() + gain_max()) / 2.0);  // initialize gain
+  set_gain(gain_min());  // initialize gain
 }
 
-wbxng_base_tx::~wbxng_base_tx()
+db_wbxng_tx::~db_wbxng_tx()
 {
   shutdown();
 }
 
-
 void
-wbxng_base_tx::shutdown()
+db_wbxng_tx::shutdown()
 {
-  // fprintf(stderr, "wbxng_base_tx::shutdown  d_is_shutdown = %d\n", d_is_shutdown);
+  // fprintf(stderr, "db_wbxng_tx::shutdown  d_is_shutdown = %d\n", d_is_shutdown);
 
   if (!d_is_shutdown){
     d_is_shutdown = true;
     // do whatever there is to do to shutdown
 
     // Disable VCO/PLL
-    d_common->_enable(false);
+    //d_common->_enable(false);
+    usrp()->write_io(d_which, 0, (PLL_PDBRF));
 
     // Power down and leave the T/R switch in the R position
-    usrp()->write_io(d_which, (power_off()|RX_TXN), (RX_TXN|ENABLE_33|ENABLE_5));
-
+    usrp()->write_io(d_which, (RX_TXN), (PLL_CE|PLL_PDBRF|RX_TXN|ENABLE_33|ENABLE_5));
 
     /*
     _write_control(_compute_control_reg());
@@ -205,7 +240,7 @@ wbxng_base_tx::shutdown()
 }
 
 bool
-wbxng_base_tx::set_auto_tr(bool on)
+db_wbxng_tx::set_auto_tr(bool on)
 {
   bool ok = true;
   if(on) {
@@ -222,7 +257,7 @@ wbxng_base_tx::set_auto_tr(bool on)
 }
 
 bool
-wbxng_base_tx::set_enable(bool on)
+db_wbxng_tx::set_enable(bool on)
 {
   /*
     Enable transmitter if on is true
@@ -244,25 +279,25 @@ wbxng_base_tx::set_enable(bool on)
 }
 
 float
-wbxng_base_tx::gain_min()
+db_wbxng_tx::gain_min()
 {
   return 0.0;
 }
 
 float
-wbxng_base_tx::gain_max()
+db_wbxng_tx::gain_max()
 {
   return 25.0;
 }
 
 float
-wbxng_base_tx::gain_db_per_step()
+db_wbxng_tx::gain_db_per_step()
 {
   return gain_max()/(1+(1.4-0.5)*4096/3.3);
 }
 
 bool
-wbxng_base_tx::set_gain(float gain)
+db_wbxng_tx::set_gain(float gain)
 {
   /*
     Set the gain.
@@ -299,8 +334,8 @@ wbxng_base_tx::set_gain(float gain)
 /**************************************************************************/
 
 
-wbxng_base_rx::wbxng_base_rx(usrp_basic_sptr _usrp, int which, int _power_on)
-  : wbxng_base(_usrp, which, _power_on)
+db_wbxng_rx::db_wbxng_rx(usrp_basic_sptr _usrp, int which)
+  : wbxng_base(_usrp, which)
 {
   /*
     @param usrp: instance of usrp.source_c
@@ -314,15 +349,24 @@ wbxng_base_rx::wbxng_base_rx(usrp_basic_sptr _usrp, int which, int _power_on)
     d_spi_enable = SPI_ENABLE_RX_B;
   }
 
-  d_common = new adf4350(_usrp, d_which, d_spi_enable);
-  
-  // Disable VCO/PLL
-  d_common->_enable(true);
+  d_common = boost::shared_ptr<adf4350> (new adf4350());
 
-  usrp()->_write_oe(d_which, (RX2_RX1N|RXBB_EN|ATTN_MASK|ENABLE_33|ENABLE_5), (RX2_RX1N|RXBB_EN|ATTN_MASK|ENABLE_33|ENABLE_5));
-  usrp()->write_io(d_which,  (power_on()|RX2_RX1N|RXBB_EN|ENABLE_33|ENABLE_5), (RX2_RX1N|RXBB_EN|ATTN_MASK|ENABLE_33|ENABLE_5));
+  /* Initialize the registers. */
+  _write_spi(d_common->compute_register(5));
+  _write_spi(d_common->compute_register(4));
+  _write_spi(d_common->compute_register(3));
+  _write_spi(d_common->compute_register(2));
+  _write_spi(d_common->compute_register(1));
+  _write_spi(d_common->compute_register(0));
+  
+  usrp()->_write_oe(d_which, (PLL_CE|PLL_PDBRF|RX2_RX1N|RXBB_EN|ATTN_MASK|ENABLE_33|ENABLE_5), (PLL_CE|PLL_PDBRF|RX2_RX1N|RXBB_EN|ATTN_MASK|ENABLE_33|ENABLE_5));
+  usrp()->write_io(d_which,  (PLL_CE|RX2_RX1N|RXBB_EN|ENABLE_33|ENABLE_5), (PLL_CE|PLL_PDBRF|RX2_RX1N|RXBB_EN|ATTN_MASK|ENABLE_33|ENABLE_5));
   //fprintf(stderr,"Setting WBXNG RXBB on");
 
+  // Enable VCO/PLL
+  //d_common->_enable(true);
+  usrp()->write_io(d_which, (PLL_PDBRF), (PLL_PDBRF));
+
   // set up for RX on TX/RX port
   select_rx_antenna("TX/RX");
 
@@ -331,43 +375,46 @@ wbxng_base_rx::wbxng_base_rx(usrp_basic_sptr _usrp, int which, int _power_on)
   /*
   set_lo_offset(-4e6);
   */
+
+  set_gain(gain_min());  // initialize gain
 }
 
-wbxng_base_rx::~wbxng_base_rx()
+db_wbxng_rx::~db_wbxng_rx()
 {
   shutdown();
 }
 
 void
-wbxng_base_rx::shutdown()
+db_wbxng_rx::shutdown()
 {
-  // fprintf(stderr, "wbxng_base_rx::shutdown  d_is_shutdown = %d\n", d_is_shutdown);
+  // fprintf(stderr, "db_wbxng_rx::shutdown  d_is_shutdown = %d\n", d_is_shutdown);
 
   if (!d_is_shutdown){
     d_is_shutdown = true;
     // do whatever there is to do to shutdown
 
     // Power down VCO/PLL
-    d_common->_enable(false);
+    //d_common->_enable(false);
+    usrp()->write_io(d_which, 0, (PLL_PDBRF));
 
-    // fprintf(stderr, "wbxng_base_rx::shutdown  before _write_control\n");
+    // fprintf(stderr, "db_wbxng_rx::shutdown  before _write_control\n");
     //_write_control(_compute_control_reg());
 
-    // fprintf(stderr, "wbxng_base_rx::shutdown  before _enable_refclk\n");
+    // fprintf(stderr, "db_wbxng_rx::shutdown  before _enable_refclk\n");
     _enable_refclk(false);                       // turn off refclk
 
-    // fprintf(stderr, "wbxng_base_rx::shutdown  before set_auto_tr\n");
+    // fprintf(stderr, "db_wbxng_rx::shutdown  before set_auto_tr\n");
     set_auto_tr(false);
 
     // Power down
-    usrp()->write_io(d_which, power_off(), (RX2_RX1N|RXBB_EN|ATTN_MASK|ENABLE_33|ENABLE_5));
+    usrp()->write_io(d_which, 0, (PLL_CE|PLL_PDBRF|RX2_RX1N|RXBB_EN|ATTN_MASK|ENABLE_33|ENABLE_5));
 
-    // fprintf(stderr, "wbxng_base_rx::shutdown  after set_auto_tr\n");
+    // fprintf(stderr, "db_wbxng_rx::shutdown  after set_auto_tr\n");
   }
 }
 
 bool
-wbxng_base_rx::set_auto_tr(bool on)
+db_wbxng_rx::set_auto_tr(bool on)
 {
   bool ok = true;
   if(on) {
@@ -384,7 +431,7 @@ wbxng_base_rx::set_auto_tr(bool on)
 }
 
 bool
-wbxng_base_rx::select_rx_antenna(int which_antenna)
+db_wbxng_rx::select_rx_antenna(int which_antenna)
 {
   /*
     Specify which antenna port to use for reception.
@@ -404,7 +451,7 @@ wbxng_base_rx::select_rx_antenna(int which_antenna)
 }
 
 bool
-wbxng_base_rx::select_rx_antenna(const std::string &which_antenna)
+db_wbxng_rx::select_rx_antenna(const std::string &which_antenna)
 {
   /*
     Specify which antenna port to use for reception.
@@ -426,7 +473,7 @@ wbxng_base_rx::select_rx_antenna(const std::string &which_antenna)
 }
 
 bool
-wbxng_base_rx::set_gain(float gain)
+db_wbxng_rx::set_gain(float gain)
 {
   /*
     Set the gain.
@@ -441,7 +488,6 @@ wbxng_base_rx::set_gain(float gain)
   float pga_gain, agc_gain;
 
   float maxgain = gain_max() - usrp()->pga_max();
-  float mingain = gain_min();
   if(gain > maxgain) {
     pga_gain = gain-maxgain;
     assert(pga_gain <= usrp()->pga_max());
@@ -456,7 +502,7 @@ wbxng_base_rx::set_gain(float gain)
 }
 
 bool
-wbxng_base_rx::_set_attn(float attn)
+db_wbxng_rx::_set_attn(float attn)
 {
   int attn_code = int(floor(attn/0.5));
   unsigned int iobits = (~attn_code) << ATTN_SHIFT;
@@ -464,27 +510,6 @@ wbxng_base_rx::_set_attn(float attn)
   return usrp()->write_io(d_which, iobits, ATTN_MASK);
 }
 
-// ----------------------------------------------------------------
-
-db_wbxng_tx::db_wbxng_tx(usrp_basic_sptr usrp, int which)
-  : wbxng_base_tx(usrp, which)
-{
-}
-
-db_wbxng_tx::~db_wbxng_tx()
-{
-}
-
-db_wbxng_rx::db_wbxng_rx(usrp_basic_sptr usrp, int which)
-  : wbxng_base_rx(usrp, which)
-{
-  set_gain((gain_min() + gain_max()) / 2.0);  // initialize gain
-}
-
-db_wbxng_rx::~db_wbxng_rx()
-{
-}
-
 float
 db_wbxng_rx::gain_min()
 {
@@ -503,7 +528,6 @@ db_wbxng_rx::gain_db_per_step()
   return 0.05;
 }
 
-
 bool
 db_wbxng_rx::i_and_q_swapped()
 {
index c17e8d670faddaa04f89e8a8415c42a75c606dcc..f1ab63d821b4dacc81bcf9bf4b4fd3fa0a6dccb5 100644 (file)
@@ -27,9 +27,7 @@
 #include <stdio.h>
 
 #define FREQ_C(freq) uint64_t(freq)
-#define INPUT_REF_FREQ FREQ_C(64e6)
 #define DIV_ROUND(num, denom) (((num) + ((denom)/2))/(denom))
-#define INPUT_REF_FREQ_2X (2*INPUT_REF_FREQ)                            /* input ref freq with doubler turned on */
 #define MIN_INT_DIV uint16_t(23)                                        /* minimum int divider, prescaler 4/5 only */
 #define MAX_RF_DIV uint8_t(16)                                          /* max rf divider, divides rf output */
 #define MIN_VCO_FREQ FREQ_C(2.2e9)                                      /* minimum vco freq */
 #define MUX_PIN       (1 << 1)
 #define LD_PIN        (1 << 0)
 
-adf4350::adf4350(usrp_basic_sptr _usrp, int _which, int _spi_enable)
+adf4350::adf4350()
 {
-    /* Initialize the pin directions. */
-
-    d_usrp = _usrp;
-    d_which = _which;
-    d_spi_enable = _spi_enable;
-    d_spi_format = SPI_FMT_MSB | SPI_FMT_HDR_0;
-
-    d_regs = new adf4350_regs(this);
-
-    /* Outputs */
-    d_usrp->_write_oe(d_which, (CE_PIN | PDB_RF_PIN), (CE_PIN | PDB_RF_PIN));
-    d_usrp->write_io(d_which, (CE_PIN), (CE_PIN | PDB_RF_PIN));
-
-    /* Initialize the pin levels. */
-    _enable(true);
-    /* Initialize the registers. */
-    d_regs->_load_register(5);
-    d_regs->_load_register(4);
-    d_regs->_load_register(3);
-    d_regs->_load_register(2);
-    d_regs->_load_register(1);
-    d_regs->_load_register(0);
+    d_regs = new adf4350_regs();
 }
 
 adf4350::~adf4350()
 {
-    d_usrp->write_io(d_which, (0), (CE_PIN | PDB_RF_PIN));
     delete d_regs;
 }
 
-freq_t
-adf4350::_get_max_freq(void)
-{
-    return MAX_FREQ;
-}
-
-freq_t
-adf4350::_get_min_freq(void)
-{
-    return MIN_FREQ;
-}
-
-bool
-adf4350::_get_locked(void)
-{
-    return d_usrp->read_io(d_which) & LD_PIN;
-}
-
-void
-adf4350::_enable(bool enable)
+std::string
+adf4350::compute_register(uint8_t addr)
 {
-    if (enable){ /* chip enable */
-        d_usrp->write_io(d_which, (PDB_RF_PIN), (PDB_RF_PIN));
-    }else{
-        d_usrp->write_io(d_which, 0, (PDB_RF_PIN));
-    }
-}
+    uint32_t data = d_regs->compute_register(addr);
 
-void
-adf4350::_write(uint8_t addr, uint32_t data)
-{
     data |= addr;
 
-    // create str from data here
+    // create std::string from data here
     char s[4];
     s[0] = (char)((data >> 24) & 0xff);
     s[1] = (char)((data >> 16) & 0xff);
     s[2] = (char)((data >>  8) & 0xff);
     s[3] = (char)(data & 0xff);
-    std::string str(s, 4);
-
-    timespec t;
-    t.tv_sec = 0;
-    t.tv_nsec = 5e6;
+    return std::string(s, 4);
+}
 
-    nanosleep(&t, NULL);
-    d_usrp->_write_spi(0, d_spi_enable, d_spi_format, str);
-    nanosleep(&t, NULL);
+freq_t
+adf4350::_get_max_freq(void)
+{
+    return MAX_FREQ;
+}
 
-    //fprintf(stderr, "Wrote to WBXNG SPI address %d with data %8x\n", addr, data);
-    /* pulse latch */
-    //d_usrp->write_io(d_which, 1, LE_PIN);
-    //d_usrp->write_io(d_which, 0, LE_PIN);
+freq_t
+adf4350::_get_min_freq(void)
+{
+    return MIN_FREQ;
 }
 
 bool
-adf4350::_set_freq(freq_t freq)
+adf4350::_set_freq(freq_t freq, freq_t refclock_freq)
 {
     /* Set the frequency by setting int, frac, mod, r, div */
     if (freq > MAX_FREQ || freq < MIN_FREQ) return false;
@@ -147,7 +96,7 @@ adf4350::_set_freq(freq_t freq)
         d_regs->d_divider_select++; //double the divider
     }
     /* Ramp up the R divider until the N divider is at least the minimum. */
-    //d_regs->d_10_bit_r_counter = INPUT_REF_FREQ*MIN_INT_DIV/freq;
+    //d_regs->d_10_bit_r_counter = refclock_freq*MIN_INT_DIV/freq;
     d_regs->d_10_bit_r_counter = 2;
     uint64_t n_mod;
     do{
@@ -155,7 +104,7 @@ adf4350::_set_freq(freq_t freq)
         n_mod = freq;
         n_mod *= d_regs->d_10_bit_r_counter;
         n_mod *= d_regs->d_mod;
-        n_mod /= INPUT_REF_FREQ;
+        n_mod /= refclock_freq;
         /* calculate int and frac */
         d_regs->d_int = n_mod/d_regs->d_mod;
         d_regs->d_frac = (n_mod - (freq_t)d_regs->d_int*d_regs->d_mod) & uint16_t(0xfff);
@@ -169,38 +118,31 @@ adf4350::_set_freq(freq_t freq)
     }while(d_regs->d_int < min_int_div);
     /* calculate the band select so PFD is under 125 KHz */
     d_regs->d_8_bit_band_select_clock_divider_value = \
-        INPUT_REF_FREQ/(FREQ_C(30e3)*d_regs->d_10_bit_r_counter) + 1;
+        refclock_freq/(FREQ_C(30e3)*d_regs->d_10_bit_r_counter) + 1;
     /*
     fprintf(stderr, "Band Selection: Div %u, Freq %lu\n",
         d_regs->d_8_bit_band_select_clock_divider_value,
-        INPUT_REF_FREQ/(d_regs->d_8_bit_band_select_clock_divider_value * d_regs->d_10_bit_r_counter) + 1
+        refclock_freq/(d_regs->d_8_bit_band_select_clock_divider_value * d_regs->d_10_bit_r_counter) + 1
     );
     */
-    d_regs->_load_register(5);
-    d_regs->_load_register(3);
-    d_regs->_load_register(1);
-    /* load involved registers */
-    d_regs->_load_register(2);
-    d_regs->_load_register(4);
-    d_regs->_load_register(0); /* register 0 must be last */
     return true;
 }
 
 freq_t
-adf4350::_get_freq(void)
+adf4350::_get_freq(freq_t refclock_freq)
 {
     /* Calculate the freq from int, frac, mod, ref, r, div:
      *  freq = (int + frac/mod) * (ref/r)
      * Keep precision by doing multiplies first:
      *  freq = (((((((int)*mod) + frac)*ref)/mod)/r)/div)
      */
-    uint64_t temp;
-    temp = d_regs->d_int;
-    temp *= d_regs->d_mod;
-    temp += d_regs->d_frac;
-    temp *= INPUT_REF_FREQ;
-    temp /= d_regs->d_mod;
-    temp /= d_regs->d_10_bit_r_counter;
-    temp /= (1 << d_regs->d_divider_select);
-    return temp;
+    uint64_t freq;
+    freq = d_regs->d_int;
+    freq *= d_regs->d_mod;
+    freq += d_regs->d_frac;
+    freq *= refclock_freq;
+    freq /= d_regs->d_mod;
+    freq /= d_regs->d_10_bit_r_counter;
+    freq /= (1 << d_regs->d_divider_select);
+    return freq;
 }
index 2b0783c20719e0127eb414cb71f68d50f24eb85f..ce8cbf4b181d85cd3416da054bfcb25b8fed2438 100644 (file)
@@ -31,22 +31,16 @@ class adf4350_regs;
 class adf4350
 {
 public:
-    adf4350(usrp_basic_sptr _usrp, int _which, int _spi_enable);
+    adf4350();
     ~adf4350();
     void _update();
-    bool _get_locked();
-    void _enable(bool enable);
-    void _write(uint8_t addr, uint32_t data);
-    bool _set_freq(freq_t freq);
-    freq_t _get_freq();
+    std::string compute_register(uint8_t addr);
+    bool _set_freq(freq_t freq, freq_t refclock_freq);
+    freq_t _get_freq(freq_t refclock_freq);
     freq_t _get_max_freq();
     freq_t _get_min_freq();
 
 protected:
-    usrp_basic_sptr d_usrp;
-    int d_which;
-    int d_spi_enable;
-    int d_spi_format;
     adf4350_regs *d_regs;
 };
 
index 21d77dcce6d37764919a1e2b902501d21cfb2a76..aa13d50b9d30b7ab7facb0d0770af89eba990914 100644 (file)
@@ -55,8 +55,7 @@ const uint8_t adf4350_regs::s_output_power = 3;
 /* reg 5 */
 const uint8_t adf4350_regs::s_ld_pin_mode = 1;
 
-adf4350_regs::adf4350_regs(adf4350* _adf4350){
-    d_adf4350 = _adf4350;
+adf4350_regs::adf4350_regs(){
 
     /* reg 0 */
     d_int = uint16_t(100);
@@ -79,10 +78,10 @@ adf4350_regs::~adf4350_regs(void){
 uint32_t
 adf4350_regs::_reg_shift(uint32_t data, uint32_t shift){
         return data << shift;
-    }
+}
 
-void
-adf4350_regs::_load_register(uint8_t addr){
+uint32_t
+adf4350_regs::compute_register(uint8_t addr){
        uint32_t data;
        switch (addr){
                case 0: data = (
@@ -123,8 +122,9 @@ adf4350_regs::_load_register(uint8_t addr){
                        _reg_shift(s_output_power, 3)); break;
                case 5: data = (
                        _reg_shift(s_ld_pin_mode, 22)); break;
-               default: return;
+               default: return data;
        }
-       /* write the data out to spi */
-       d_adf4350->_write(addr, data);
+       /* return the data to write out to spi */
+    return data;
 }
+
index 0018aa07f5a6b1440932ac86ee0b5404fd4db812..33a548e85ba72db2beaefbeeb29bd5bf021b79ee 100644 (file)
@@ -29,13 +29,11 @@ class adf4350;
 class adf4350_regs
 {
 public:
-    adf4350_regs(adf4350* _adf4350);
+    adf4350_regs();
     ~adf4350_regs();
 
-    adf4350* d_adf4350;
-
     uint32_t _reg_shift(uint32_t data, uint32_t shift);
-    void _load_register(uint8_t addr);
+    uint32_t compute_register(uint8_t addr);
 
     /* reg 0 */
     uint16_t d_int;
@@ -75,6 +73,11 @@ public:
     static const uint8_t s_output_power;
     /* reg 5 */
     static const uint8_t s_ld_pin_mode;
+
+protected:
+    usrp_basic_sptr d_usrp;
+    int d_spi_enable;
+    int d_spi_format;
 };
 
 #endif /* ADF4350_REGS_H */
index 7d1e1871402043e8f446cbe5adf1f8b542f3f669..2548d737e5cf0d6c1485d362c62bedac3b9ba421 100644 (file)
@@ -61,6 +61,9 @@
 "Flex 1200 Tx MIMO B"  0x002a
 "Flex 2400 Tx MIMO B"  0x002b
 
+"Flex 2200 Rx MIMO B"  0x002c
+"Flex 2200 Tx MIMO B"  0x002d
+
 "Flex 1800 Rx"         0x0030
 "Flex 1800 Tx"         0x0031
 "Flex 1800 Rx MIMO A"  0x0032
@@ -84,5 +87,7 @@
 "XCVR2450 Tx"          0x0060
 "XCVR2450 Rx"          0x0061
 
+"Bitshark Rx"           0x0070
+
 "Experimental Tx"      0xfffe
 "Experimental Rx"      0xffff
index d4794aa6fe722e5111d6075d25e039cea2b00b9f..3c30de62259aa72b59338fd8aad985667f92ad9e 100644 (file)
@@ -6,6 +6,6 @@ includedir=@includedir@
 Name: usrp
 Description: USRP Client Side C++ interface
 Requires: @LIBUSB_PKG_CONFIG_NAME@
-Version: @VERSION@
+Version: @LIBVER@
 Libs: -L${libdir} -lusrp
 Cflags: -I${includedir}
index 00f682fc7ea7023f93a140279116ed4a3d7a5582..1dc8b0a7371a6171e3644694a17ee29e02d63b3a 100644 (file)
@@ -75,6 +75,7 @@ txrx_wbx_LDADD = ../lib/libu2fw_wbx.a
 
 txrx_xcvr_LDADD = ../lib/libu2fw_xcvr.a
 
+
 noinst_HEADERS = \
         app_common_v2.h \
         app_passthru_v2.h \
index dd2bcf1edd5edc39a82c5a7104276a80f83b8978..32cb25c4191e434da1119a78f814ec1aeb7292cc 100644 (file)
@@ -50,6 +50,12 @@ u2_fxpt_freq_round_to_int(u2_fxpt_freq_t fx)
   return (int)((fx+(1<<(U2_FPF_RP-1)))>>U2_FPF_RP);
 }
 
+static inline unsigned int
+u2_fxpt_freq_round_to_uint(u2_fxpt_freq_t fx)
+{
+  return (unsigned int)((fx+(1<<(U2_FPF_RP-1)))>>U2_FPF_RP);
+}
+
 static inline double
 u2_fxpt_freq_to_double(u2_fxpt_freq_t fx)
 {
index 0a7d5c39b64c71cd45f980d3095267672d64b9b1..d6bb4edc382405e83a3b30b19a5380c5cfe7e410 100644 (file)
@@ -22,26 +22,19 @@ noinst_LIBRARIES = \
        libu2fw_wbx.a \
        libu2fw_xcvr.a
 
-
-libu2fw_a_SOURCES = \
+U2FW_COMMON = \
+       _exit.c \
        abort.c \
        ad9510.c \
-       adf4350.c \
-       adf4350_regs.c \
        ad9777.c \
        bsm12.c \
        buffer_pool.c \
        clocks.c \
        db_basic.c \
-       db_dbsrx.c \
-       db_rfx.c \
-       db_tvrx.c \
-       db_init.c \
        dbsm.c \
        eeprom.c \
-       ethernet.c \
        eth_mac.c \
-       _exit.c \
+       ethernet.c \
        exit.c \
        hal_io.c \
        hal_uart.c \
@@ -53,88 +46,37 @@ libu2fw_a_SOURCES = \
        memset_wa.c \
        nonstdio.c \
        pic.c \
+       print_buffer.c \
+       print_fxpt.c \
        print_mac_addr.c \
        print_rmon_regs.c \
-       print_fxpt.c \
-       print_buffer.c \
        printf.c \
        sd.c \
        spi.c \
-       u2_init.c       
+       u2_init.c
+
+libu2fw_a_SOURCES = \
+       $(U2FW_COMMON) \
+       db_init.c \
+       db_bitshark_rx.c \
+       db_dbsrx.c \
+       db_rfx.c \
+       db_tvrx.c
 
 libu2fw_wbx_a_SOURCES = \
-       abort.c \
-       ad9510.c \
+       $(U2FW_COMMON) \
+       db_init_wbx.c \
        adf4350.c \
        adf4350_regs.c \
-       ad9777.c \
-       bsm12.c \
-       buffer_pool.c \
-       clocks.c \
-       db_basic.c \
-       db_wbxng.c \
-       db_init_wbx.c \
-       dbsm.c \
-       eeprom.c \
-       ethernet.c \
-       eth_mac.c \
-       _exit.c \
-       exit.c \
-       hal_io.c \
-       hal_uart.c \
-       i2c.c \
-       lsadc.c \
-       lsdac.c \
-       mdelay.c \
-       memcpy_wa.c \
-       memset_wa.c \
-       nonstdio.c \
-       pic.c \
-       print_mac_addr.c \
-       print_rmon_regs.c \
-       print_fxpt.c \
-       print_buffer.c \
-       printf.c \
-       sd.c \
-       spi.c \
-       u2_init.c       
+       db_wbxng.c 
 
 libu2fw_xcvr_a_SOURCES = \
-       abort.c \
-       ad9510.c \
+       $(U2FW_COMMON) \
+       db_init_xcvr.c \
        adf4350.c \
        adf4350_regs.c \
-       ad9777.c \
-       bsm12.c \
-       buffer_pool.c \
-       clocks.c \
-       db_basic.c \
-       db_xcvr2450.c \
-       db_init_xcvr.c \
-       dbsm.c \
-       eeprom.c \
-       ethernet.c \
-       eth_mac.c \
-       _exit.c \
-       exit.c \
-       hal_io.c \
-       hal_uart.c \
-       i2c.c \
-       lsadc.c \
-       lsdac.c \
-       mdelay.c \
-       memcpy_wa.c \
-       memset_wa.c \
-       nonstdio.c \
-       pic.c \
-       print_mac_addr.c \
-       print_rmon_regs.c \
-       print_fxpt.c \
-       print_buffer.c \
-       printf.c \
-       sd.c \
-       spi.c \
-       u2_init.c       
+       db_xcvr2450.c
+
 
 noinst_HEADERS = \
        ad9510.h \
@@ -149,6 +91,7 @@ noinst_HEADERS = \
        db.h \
        db_base.h \
        db_wbxng.h \
+       db_bitshark_rx.h \
        dbsm.h \
        eth_mac.h \
        eth_mac_regs.h \
diff --git a/usrp2/firmware/lib/db_bitshark_rx.c b/usrp2/firmware/lib/db_bitshark_rx.c
new file mode 100644 (file)
index 0000000..4c126de
--- /dev/null
@@ -0,0 +1,337 @@
+/*
+ * Copyright 2010 Free Software Foundation, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "db_bitshark_rx.h"
+#include <memory_map.h>
+#include <db_base.h>
+#include <hal_io.h>
+#include <mdelay.h>
+#include <lsdac.h>
+#include <clocks.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <string.h>
+#include <i2c.h>
+
+/* Note: Thie general structure of this file is based on the db_wbxng.c 
+   codebase for the wbx daughterboard. */
+
+/* The following defines specify the address map provided by the
+   Bitshark USRP Rx (BURX) board. These registers are all accessed over I2C. */
+#define RF_CENTER_FREQ_REG 0x00
+#define RF_CHAN_FILTER_BW_REG 0x01
+#define RF_GAIN_REG 0x02
+#define BB_GAIN_REG 0x03
+#define ADF4350_REG 0x10
+#define SKY73202_REG 0x11
+#define CLOCK_SCHEME_REG 0x20
+
+/* The following table lists the registers provided by the Bitshark board 
+   that are accessible over I2C:
+   --------------------------------------------------------
+   |RegAddr: 0x00-RF Center Freq register |
+       |4-bytes 0x00|
+       |4-byte unsigned RF center freq (in KHz)|
+   |RegAddr: 0x01-RF channel filter bandwidth register |
+       |4-bytes 0x00|
+       |4-byte unsigned RF channel filter bw (in KHz)|
+   |RegAddr: 0x02-RF gain register |
+       |7-bytes 0x00|
+       |1-byte signed RF gain (in dB)|
+   |RegAddr: 0x03-Baseband gain register |
+       |4-bytes 0x00|
+       |4-byte signed baseband filter gain (in dB)|
+   |RegAddr: 0x10-ADF4350 register |
+       |4-bytes 0x00|
+       |4-byte ADF4350 register value (actual ADF4350 reg addr embedded 
+        within 4-byte value)|
+   |RegAddr: 0x11-SKY73202 register |
+       |5-bytes 0x00|
+       |1-byte reg 0 of SKY73202 |
+       |1-byte reg 1 of SKY73202 |
+       |1-byte reg 2 of SKY73202 |
+   |RegAddr: 0x20-Clock Scheme |
+       |3-bytes 0x00|
+       |1-byte indicating clocking scheme:
+        -0x00 -> BURX local TCXO off, BURX accepts ref clock from
+                USRP2 (freq of USRP2's ref clock specified in bytes 2-5)
+       -0x01 -> BURX local TCXO on, BURX uses its local TCXO as its ref
+                clock, TCXO signal output for use as phase lock for USRP2 |
+       |4-byte USRP2 ref clock freq in hz (only needed if byte 1 set to 0x00) |
+       
+  ---------------------------------------------------------------------------
+   
+   As an example, lets say the client wants to set an RF center freq of
+   1000 MHz.  In KHz, this translates to 1000000 (resolution is only down to
+   steps of 1 KHz), which is 0x000F4240 in hex.  So the complete 9-byte I2C 
+   sequence that the client should send is as follows:
+   byte 0: 0x00-register 0x00 is the target of the write operation
+   bytes 1-4: 0x00 (padding)
+   byte 5: 0x00 (MSB of the 1000000 KHz value, in hex)
+   byte 6: 0x0F
+   byte 7: 0x42
+   byte 8: 0x40 (LSB of the 1000000 KHz value, in hex)
+   
+   How about another example...lets say the client wants to setup the clock
+   scheme to use scheme #1 where the 26 MHz TCXO on the BURX board is enabled,
+   and is provided to the USRP2 for it to phase lock to it as an external ref.  
+   26 MHz (i.e. 26 million), in hex, is 0x18CBA80.
+   So the complete 9-byte I2C sequence that the client should send is as follows:
+   byte 0: 0x20-register 0x20 is the target of the write operation
+   bytes 1-3: 0x00 (padding)
+   byte 4: 0x01 (indicating that clock scheme #1 is wanted)
+   byte 5: 0x01 (MSB of the BURX ref clk freq)
+   byte 6: 0x8C
+   byte 7: 0xBA
+   byte 8: 0x80 (LSB of the BURX ref clk freq)
+
+   Note: The endian-ness of 4-byte values used in I2C cmds is different on 
+   USRP2 compared to USRP1.
+   
+*/
+
+#define NUM_BYTES_IN_I2C_CMD 9
+#define I2C_ADDR 0x47
+
+bool bitshark_rx_init(struct db_base *dbb);
+bool bitshark_rx_set_freq(struct db_base *dbb, u2_fxpt_freq_t freq, u2_fxpt_freq_t *dc);
+bool bitshark_rx_set_gain(struct db_base *dbb, u2_fxpt_gain_t gain);
+bool bitshark_rx_set_bw(struct db_base *dbb, uint16_t bw);
+
+static bool set_clock_scheme(uint8_t clock_scheme, uint32_t ref_clk_freq);
+
+/*
+ * The class instances
+ */
+struct db_bitshark_rx db_bitshark_rx = {
+    .base.dbid = 0x0070,
+    .base.is_tx = false,
+    .base.output_enables = 0x0000,
+    .base.used_pins = 0x0000,
+    .base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(300e6),
+    .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(4000e6),
+    .base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(0),
+    .base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(42),
+    .base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(6),
+    .base.is_quadrature = true,
+    .base.i_and_q_swapped = true,
+    .base.spectrum_inverted = false,
+    .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0),
+    .base.init = bitshark_rx_init,
+    .base.set_freq = bitshark_rx_set_freq,
+    .base.set_gain = bitshark_rx_set_gain,
+    .base.set_tx_enable = 0,
+    .base.atr_mask = 0x0000,
+    .base.atr_txval = 0,
+    .base.atr_rxval = 0,
+    .base.set_antenna = 0,
+    .extra.bw_min = 660, /* in KHz, so 660 KHz */
+    .extra.bw_max = 56000, /* in KHz, so 56 MHz */
+    .extra.set_bw = bitshark_rx_set_bw
+};
+
+bool
+bitshark_rx_init(struct db_base *dbb)
+{
+    struct db_bitshark_rx_dummy *db = (struct db_bitshark_rx_dummy *) dbb;    
+
+    clocks_enable_rx_dboard(true, 0);
+    /* hal_gpio_write( GPIO_RX_BANK, ENABLE_5|ENABLE_33, ENABLE_5|ENABLE_33 ); */
+    /* above isn't needed, since we don't have any GPIO from the FPGA */
+    
+    /* setup the clock scheme to accept the USRP2's 100 MHz ref clk */
+    set_clock_scheme(0,100000000);
+
+    /* initial setting of gain */
+    dbb->set_gain(dbb,U2_DOUBLE_TO_FXPT_GAIN(20.0));
+
+    /* Set the freq now to get the one time 10ms delay out of the way. */
+    u2_fxpt_freq_t     dc;
+    dbb->set_freq(dbb, dbb->freq_min, &dc);
+
+    /* set up the RF bandwidth of the signal of interest...Note: there
+       doesn't appear to be a standard way of setting this bandwidth
+       in USRP2-land (compared to USRP1-land, where we have the
+       straight-forward set_bw() method).  Not sure why this is, but
+       for now, simply set the bandwidth once for the intended
+       application. */
+    db->extra.set_bw(dbb, 25000);  /* 25 MHz channel bw */
+
+    return true;
+}
+
+bool
+bitshark_rx_set_freq(struct db_base *dbb, u2_fxpt_freq_t freq, u2_fxpt_freq_t *dc)
+{
+    struct db_bitshark_rx_dummy *db = (struct db_bitshark_rx_dummy *) dbb;    
+    unsigned char args[NUM_BYTES_IN_I2C_CMD];
+    unsigned char val[4];
+    uint32_t freq_in_khz = (uint32_t)(u2_fxpt_freq_round_to_uint(freq)/1000);
+    
+    if(!(freq>=db->base.freq_min && freq<=db->base.freq_max)) 
+    {
+       return false;
+    }
+    
+    memset(args,0x00,NUM_BYTES_IN_I2C_CMD);
+    memcpy(val,&freq_in_khz,4);
+    args[0] = RF_CENTER_FREQ_REG;
+    args[5] = val[3];
+    args[6] = val[2];
+    args[7] = val[1];
+    args[8] = val[0];
+    
+    i2c_write(I2C_ADDR, args, NUM_BYTES_IN_I2C_CMD);
+    /* Add a brief delay after each command.  This only seems to be
+       necessary when sending a sequence of commands one after the other.
+       This issue appears to be specific to the USRP2, since it isn't
+       necessary on the USRP1.  The 5 mS delay is a bit of 
+       an emperical compromise: too short (say, 1 mS), and every once
+       in a great while a command will still be magically dropped on its
+       way out...too long (say, 500 mS) and higher-level apps such as
+       usrp2_fft.py seem to choke because the init sequence is taking
+       too long.  So 5 mS was tested repeatedly without error, and deemed
+       reasonable. Not sure if this is an issue with the I2C master
+       code in the microblaze or some place else, and I hate magic
+       delays too, but this seems to be stable. */
+    mdelay(5);
+
+   *dc = freq;
+    return true;
+}
+
+bool
+bitshark_rx_set_gain(struct db_base *dbb, u2_fxpt_gain_t gain)
+{
+    struct db_bitshark_rx_dummy *db = (struct db_bitshark_rx_dummy *) dbb;
+    
+    unsigned char args[NUM_BYTES_IN_I2C_CMD];
+    uint8_t final_gain = (uint8_t)(u2_fxpt_gain_round_to_int(gain));
+    
+    if(!(gain >= db->base.gain_min && gain <= db->base.gain_max)) 
+    {
+       return false;
+    }
+    
+    memset(args,0x00,NUM_BYTES_IN_I2C_CMD);
+    args[0] = RF_GAIN_REG;
+    args[5] = final_gain;
+
+    i2c_write(I2C_ADDR, args, NUM_BYTES_IN_I2C_CMD);
+    /* Add a brief delay after each command.  This only seems to be
+       necessary when sending a sequence of commands one after the other.
+       This issue appears to be specific to the USRP2, since it isn't
+       necessary on the USRP1.  The 5 mS delay is a bit of 
+       an emperical compromise: too short (say, 1 mS), and every once
+       in a great while a command will still be magically dropped on its
+       way out...too long (say, 500 mS) and higher-level apps such as
+       usrp2_fft.py seem to choke because the init sequence is taking
+       too long.  So 5 mS was tested repeatedly without error, and deemed
+       reasonable. Not sure if this is an issue with the I2C master
+       code in the microblaze or some place else, and I hate magic
+       delays too, but this seems to be stable. */
+    mdelay(5);
+
+    return true;
+}
+
+bool
+bitshark_rx_set_bw(struct db_base *dbb, uint16_t bw_in_khz)
+{
+    struct db_bitshark_rx_dummy *db = (struct db_bitshark_rx_dummy *) dbb;
+    unsigned char val[2];
+    unsigned char args[NUM_BYTES_IN_I2C_CMD];
+    
+    if(!(bw_in_khz >= db->extra.bw_min && bw_in_khz <= db->extra.bw_max)) 
+    {
+       return false;
+    }
+    
+    memset(args,0x00,NUM_BYTES_IN_I2C_CMD);
+    memcpy(val,&bw_in_khz,2);
+    args[0] = RF_CHAN_FILTER_BW_REG;
+    args[5] = val[1];
+    args[6] = val[0];
+
+    i2c_write(I2C_ADDR, args, NUM_BYTES_IN_I2C_CMD);
+    /* Add a brief delay after each command.  This only seems to be
+       necessary when sending a sequence of commands one after the other.
+       This issue appears to be specific to the USRP2, since it isn't
+       necessary on the USRP1.  The 5 mS delay is a bit of 
+       an emperical compromise: too short (say, 1 mS), and every once
+       in a great while a command will still be magically dropped on its
+       way out...too long (say, 500 mS) and higher-level apps such as
+       usrp2_fft.py seem to choke because the init sequence is taking
+       too long.  So 5 mS was tested repeatedly without error, and deemed
+       reasonable. Not sure if this is an issue with the I2C master
+       code in the microblaze or some place else, and I hate magic
+       delays too, but this seems to be stable. */
+    mdelay(5);
+
+    return true;
+}
+
+static bool
+set_clock_scheme(uint8_t clock_scheme, uint32_t ref_clk_freq)
+{
+    /* Set the clock scheme for determining how the BURX
+       dboard receives its clock.  For the USRP2, there is really only
+       one way of doing this, which is to use the 100 MHz ref clk
+       on the USRP2 as its reference.  However, it is possible to
+       use the BURX's 26 MHz TCXO as the external reference input to
+       the USRP, which would provide phase lock between our oscillator
+       and the USRP's 100 MHz oscillator.  And since the BURX board
+       provides the ability to warp the oscillator, this may be
+       useful to some folks.  Otherwise, the BURX board will always
+       just take the 100 MHz reference from the USRP2 as its reference.
+    */
+    
+    unsigned char args[NUM_BYTES_IN_I2C_CMD];
+    char val[4];
+
+    if (clock_scheme > 1) 
+    {
+       return false;
+    }
+
+    memcpy(val,&ref_clk_freq,4);
+    args[0] = CLOCK_SCHEME_REG;
+    args[4] = clock_scheme;
+    args[5] = val[3];
+    args[6] = val[2];
+    args[7] = val[1];
+    args[8] = val[0];
+
+    i2c_write(I2C_ADDR, args, NUM_BYTES_IN_I2C_CMD);
+    /* Add a brief delay after each command.  This only seems to be
+       necessary when sending a sequence of commands one after the other.
+       This issue appears to be specific to the USRP2, since it isn't
+       necessary on the USRP1.  The 5 mS delay is a bit of 
+       an emperical compromise: too short (say, 1 mS), and every once
+       in a great while a command will still be magically dropped on its
+       way out...too long (say, 500 mS) and higher-level apps such as
+       usrp2_fft.py seem to choke because the init sequence is taking
+       too long.  So 5 mS was tested repeatedly without error, and deemed
+       reasonable. Not sure if this is an issue with the I2C master
+       code in the microblaze or some place else, and I hate magic
+       delays too, but this seems to be stable. */
+    mdelay(5);
+
+    return true;
+}
+
diff --git a/usrp2/firmware/lib/db_bitshark_rx.h b/usrp2/firmware/lib/db_bitshark_rx.h
new file mode 100644 (file)
index 0000000..3651f27
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2010 Free Software Foundation, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef DB_BITSHARK_RX_H
+#define DB_BITSHARK_RX_H
+
+#include <db_base.h>
+
+struct db_bitshark_rx_extra 
+{
+    uint16_t bw_min;
+    uint16_t bw_max;
+    bool     (*set_bw)(struct db_base *, uint16_t bw);
+       
+};
+
+struct db_bitshark_rx_dummy 
+{
+  struct db_base       base;
+  struct db_bitshark_rx_extra  extra;
+};
+
+
+struct db_bitshark_rx 
+{
+  struct db_base       base;
+  struct db_bitshark_rx_extra extra;
+};
+
+
+#endif /* DB_BITSHARK_RX_H */
index bc82946fc718ef3aa841532f2810198603bc9152..d58badc9e5d9907c12c5899c2010e617838115f4 100644 (file)
@@ -51,6 +51,7 @@ extern struct db_base db_tvrx1;
 extern struct db_base db_tvrx2;
 extern struct db_base db_tvrx3;
 extern struct db_base db_dbsrx;
+extern struct db_base db_bitshark_rx;
 
 struct db_base *all_dboards[] = {
   &db_basic_tx,
@@ -73,6 +74,7 @@ struct db_base *all_dboards[] = {
 #endif
   &db_tvrx3,
   &db_dbsrx,
+  &db_bitshark_rx,
   0
 };
 
index 546559010de4bc42a2b6236a77f9d3ebf8197b39..d07d3c1fb4c0a3cf7f9e3146c478cb83f23877ec 100644 (file)
@@ -120,6 +120,16 @@ struct db_rfx_1800_tx {
   struct db_rfx_common common;
 };
 
+struct db_rfx_2200_rx {
+  struct db_base       base;
+  struct db_rfx_common common;
+};
+
+struct db_rfx_2200_tx {
+  struct db_base       base;
+  struct db_rfx_common common;
+};
+
 struct db_rfx_2400_rx {
   struct db_base       base;
   struct db_rfx_common common;
@@ -387,6 +397,70 @@ struct db_rfx_1800_tx db_rfx_1800_tx = {
 };
 
 
+struct db_rfx_2200_rx db_rfx_2200_rx = {
+  .base.dbid = 0x002c,
+  .base.is_tx = false,
+  .base.output_enables = 0x00E0,
+  .base.used_pins = 0x00FF,
+  .base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(2000e6),
+  .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(2400e6),
+  .base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(0),
+  .base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(70),
+  .base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(0.034),
+  .base.is_quadrature = true,
+  .base.i_and_q_swapped = true,
+  .base.spectrum_inverted = false,
+  .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0),
+  .base.init = rfx_init_rx,
+  .base.set_freq = rfx_set_freq,
+  .base.set_gain = rfx_set_gain_rx,
+  .base.set_tx_enable = 0,
+  .base.atr_mask = 0x00E0,
+  .base.atr_txval = 0,
+  .base.atr_rxval = MIX_EN,
+  // .base.atr_tx_delay =
+  // .base.atr_rx_delay =
+  .base.set_antenna = 0,
+  .common.DIV2 = 0,
+  .common.CP1 = 7,
+  .common.CP2 = 7,
+  .common.spi_mask = SPI_SS_RX_DB,
+  .common.freq_mult = 1
+};
+
+
+struct db_rfx_2200_tx db_rfx_2200_tx = {
+  .base.dbid = 0x002d,
+  .base.is_tx = true,
+  .base.output_enables = 0x00E0,
+  .base.used_pins = 0x00FF,
+  .base.freq_min = U2_DOUBLE_TO_FXPT_FREQ(2000e6),
+  .base.freq_max = U2_DOUBLE_TO_FXPT_FREQ(2400e6),
+  //.base.gain_min = U2_DOUBLE_TO_FXPT_GAIN(xxx),
+  //.base.gain_max = U2_DOUBLE_TO_FXPT_GAIN(xxx),
+  //.base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(xxx),
+  .base.is_quadrature = true,
+  .base.i_and_q_swapped = false,
+  .base.spectrum_inverted = false,
+  .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(12.5e6),
+  .base.init = rfx_init_tx,
+  .base.set_freq = rfx_set_freq,
+  .base.set_gain = rfx_set_gain_tx,
+  .base.set_tx_enable = rfx_set_tx_enable,
+  .base.atr_mask = 0x00E0,
+  .base.atr_txval = MIX_EN, 
+  .base.atr_rxval = ANT_SW,
+  // .base.atr_tx_delay =
+  // .base.atr_rx_delay =
+  .base.set_antenna = 0,
+  .common.DIV2 = 0,
+  .common.CP1 = 7,
+  .common.CP2 = 7,
+  .common.spi_mask = SPI_SS_TX_DB,
+  .common.freq_mult = 1
+};
+
+
 struct db_rfx_2400_rx db_rfx_2400_rx = {
   .base.dbid = 0x0027,
   .base.is_tx = false,
index 7069507cfb593fde10563f1aed7d853374c39d9d..e29caa33db1bacb71132b415ac6b4ac235c96a15 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <boost/shared_ptr.hpp>
 #include <boost/utility.hpp>
+#include <boost/bind.hpp>
 #include <vector>
 #include <complex>
 #include <usrp2/rx_sample_handler.h>
index cda051bb07327f0ed20aabda8598f115598374e1..209cb70953d88886b2aa1759c88cde1f443c8cbd 100644 (file)
@@ -30,6 +30,8 @@ usrp2_socket_opener_SOURCES = usrp2_socket_opener.cc
 lib_LTLIBRARIES = \
        libusrp2.la
 
+libusrp2_la_LDFLAGS = $(LTVERSIONFLAGS)
+
 libusrp2_la_SOURCES = \
        control.cc \
        copiers.cc \
index e0c2b1986df44c5567f3c801bd86462754c858a2..0c862a87741259121e9af60eb2ac2153ac3cf125 100644 (file)
@@ -6,6 +6,6 @@ includedir=@includedir@
 Name: usrp2
 Description: Universal Software Radio Peripheral 2
 Requires: gruel
-Version: @VERSION@
+Version: @LIBVER@
 Libs: -L${libdir} -lusrp2
 Cflags: -I${includedir} @DEFINES@
index 7f533bd29cbf61657008b482e4678ba256571997..70d6d74f92cd15540af6b4d810aef1f125b95e74 100644 (file)
@@ -1,4 +1,4 @@
 MAJOR_VERSION=3
 API_COMPAT=3
-MINOR_VERSION=0-rc0
-MAINT_VERSION=0
+MINOR_VERSION=1
+MAINT_VERSION=git
diff --git a/vrt/.gitignore b/vrt/.gitignore
deleted file mode 100644 (file)
index 8d802d8..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-Makefile
-Makefile.in
-vrt.pc
diff --git a/vrt/Makefile.am b/vrt/Makefile.am
deleted file mode 100644 (file)
index 791b8d6..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# Copyright 2008,2009 Free Software Foundation, Inc.
-# 
-# This file is part of GNU Radio
-# 
-# GNU Radio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3, or (at your option)
-# any later version.
-# 
-# GNU Radio is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License along
-# with 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
diff --git a/vrt/apps/.gitignore b/vrt/apps/.gitignore
deleted file mode 100644 (file)
index dab7a7f..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-Makefile
-Makefile.in
-.deps
-.libs
-
diff --git a/vrt/apps/Makefile.am b/vrt/apps/Makefile.am
deleted file mode 100644 (file)
index 4577205..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# Copyright 2009 Free Software Foundation, Inc.
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-#
-
-include $(top_srcdir)/Makefile.common
diff --git a/vrt/include/Makefile.am b/vrt/include/Makefile.am
deleted file mode 100644 (file)
index 3ce6a8f..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# Copyright 2009 Free Software Foundation, Inc.
-# 
-# This file is part of GNU Radio
-# 
-# GNU Radio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3, or (at your option)
-# any later version.
-# 
-# GNU Radio is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License along
-# with 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
diff --git a/vrt/include/vrt/Makefile.am b/vrt/include/vrt/Makefile.am
deleted file mode 100644 (file)
index 183eaf9..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# Copyright 2008,2009 Free Software Foundation, Inc.
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-#
-
-include $(top_srcdir)/Makefile.common
-
-INCLUDES = 
-
-vrtincludedir = $(includedir)/vrt
-
-vrtinclude_HEADERS = \
-       bits.h \
-       copiers.h \
-       expanded_header.h \
-       rx.h \
-       rx_packet_handler.h \
-       types.h
diff --git a/vrt/include/vrt/bits.h b/vrt/include/vrt/bits.h
deleted file mode 100644 (file)
index 54eeec7..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2009 Free Software Foundation, Inc.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-#ifndef INCLUDED_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_SHIFT        16
-#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;
-}
-
-/*
- * Trailer bits
- */
-#define        TR_E                  (1 << 8)
-
-#define TR_ENABLE(x) ((x) << 20)
-#define        TR_STATE(x)  ((x) <<  8)
-
-// Use these with TR_ENABLE and TR_STATE
-#define        TR_CAL_TIME           (1 << 11)
-#define        TR_VALID_DATA         (1 << 10)
-#define TR_REF_LOCK          (1 <<  9)
-#define        TR_AGC                (1 <<  8)
-#define TR_DETECTED_SIG              (1 <<  7)
-#define        TR_SPECTRAL_INVERSION (1 <<  6)
-#define        TR_OVER_RANGE         (1 <<  5)
-#define        TR_SAMPLE_LOSS        (1 <<  4)
-#define TR_USER_3            (1 <<  3)
-#define TR_USER_2            (1 <<  2)
-#define TR_USER_1            (1 <<  1)
-#define TR_USER_0            (1 <<  0)
-
-#endif /* INCLUDED_VRT_BITS_H */
diff --git a/vrt/include/vrt/copiers.h b/vrt/include/vrt/copiers.h
deleted file mode 100644 (file)
index 990538c..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2009 Free Software Foundation, Inc.
- * 
- * This file is part of GNU Radio
- * 
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- * 
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU 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 */
diff --git a/vrt/include/vrt/expanded_header.h b/vrt/include/vrt/expanded_header.h
deleted file mode 100644 (file)
index b3333a7..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2009 Free Software Foundation, Inc.
- * 
- * This file is part of GNU Radio
- * 
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- * 
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU 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 {
-
-  static const size_t HEADER_MAX_N32_BIT_WORDS = 7;
-  static const size_t TRAILER_MAX_N32_BIT_WORDS = 1;
-
-  /*!
-   * \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(); }
-
-
-    /*!
-     * \brief unparse expanded header, fill-in the words of a vrt packet header and trailer
-     * This method is only intended to fill the buffers with header and trailer information.
-     * The actual handling of the separate header, payload, trailer buffers is up to the caller.
-     */
-    static void unparse(const expanded_header *hdr,    // in
-                        size_t n32_bit_words_payload,  // in
-                        uint32_t *header,              // out
-                        size_t *n32_bit_words_header,  // out
-                        uint32_t *trailer,             // out
-                        size_t *n32_bit_words_trailer);// out
-
-    /*!
-     * \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 */
diff --git a/vrt/include/vrt/rx.h b/vrt/include/vrt/rx.h
deleted file mode 100644 (file)
index ff3ce85..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2009 Free Software Foundation, Inc.
- * 
- * This file is part of GNU Radio
- * 
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- * 
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU 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 */
diff --git a/vrt/include/vrt/rx_packet_handler.h b/vrt/include/vrt/rx_packet_handler.h
deleted file mode 100644 (file)
index ad34078..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2009 Free Software Foundation, Inc.
- * 
- * This file is part of GNU Radio
- * 
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- * 
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU 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 */
diff --git a/vrt/include/vrt/types.h b/vrt/include/vrt/types.h
deleted file mode 100644 (file)
index edfa4ec..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2009 Free Software Foundation, Inc.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-#ifndef INCLUDED_VRT_TYPES_H
-#define INCLUDED_VRT_TYPES_H
-
-#include <stdint.h>
-
-/* macros for dealing with fixed point numbers */
-#define _FXPT_C(_type, _x, _rp) ((_type)((_x)*(1ll << _rp)))
-#define _FXPT_TO_INT(_x, _one) (((_x) + ((_one)/2))/(_one))
-#define _FXPT_TO_DOUBLE(_x, _one) ((double)(_x) * (1.0/(_one)))
-
-/***********************************************************************
- * The VRT Altitude Type (meters)
- **********************************************************************/
-typedef int32_t vrt_altitude_t;
-#define VRT_ALTITUDE_RP 5
-#define VRT_ALTITUDE_C(_x) _FXPT_C(vrt_altitude_t, _x, VRT_ALTITUDE_RP)
-
-static inline vrt_altitude_t
-double_to_vrt_altitude(double num){
-  return VRT_ALTITUDE_C(num);
-}
-
-static inline int32_t
-vrt_altitude_round_to_int(vrt_altitude_t fx){
-  return _FXPT_TO_INT(fx, VRT_ALTITUDE_C(1));
-}
-
-static inline double
-vrt_altitude_to_double(vrt_altitude_t fx){
-  return _FXPT_TO_DOUBLE(fx, VRT_ALTITUDE_C(1));
-}
-
-/***********************************************************************
- * The VRT Geolocation Angle Type (degrees)
- **********************************************************************/
-typedef int32_t vrt_geo_angle_t;
-#define VRT_GEO_ANGLE_RP 22
-#define VRT_GEO_ANGLE_C(_x) _FXPT_C(vrt_geo_angle_t, _x, VRT_GEO_ANGLE_RP)
-
-static inline vrt_geo_angle_t
-double_to_vrt_geo_angle(double num){
-  return VRT_GEO_ANGLE_C(num);
-}
-
-static inline int16_t
-vrt_geo_angle_round_to_int(vrt_geo_angle_t fx){
-  return _FXPT_TO_INT(fx, VRT_GEO_ANGLE_C(1));
-}
-
-static inline double
-vrt_geo_angle_to_double(vrt_geo_angle_t fx){
-  return _FXPT_TO_DOUBLE(fx, VRT_GEO_ANGLE_C(1));
-}
-
-/***********************************************************************
- * The VRT Frequency Type (Hz)
- **********************************************************************/
-typedef int64_t vrt_freq_t;
-#define VRT_FREQ_RP 20
-#define VRT_FREQ_C(_x) _FXPT_C(vrt_freq_t, _x, VRT_FREQ_RP)
-
-static inline vrt_freq_t
-double_to_vrt_freq(double num){
-  return VRT_FREQ_C(num);
-}
-
-static inline int64_t
-vrt_freq_round_to_int(vrt_freq_t fx){
-  return _FXPT_TO_INT(fx, VRT_FREQ_C(1));
-}
-
-static inline double
-vrt_freq_to_double(vrt_freq_t fx){
-  return _FXPT_TO_DOUBLE(fx, VRT_FREQ_C(1));
-}
-
-/***********************************************************************
- * The VRT Gain Type (dB)
- **********************************************************************/
-typedef int16_t vrt_gain_t;
-#define VRT_GAIN_RP 7
-#define VRT_GAIN_C(_x) _FXPT_C(vrt_gain_t, _x, VRT_GAIN_RP)
-
-static inline vrt_gain_t
-double_to_vrt_gain(double num){
-  return VRT_GAIN_C(num);
-}
-
-static inline int16_t
-vrt_gain_round_to_int(vrt_gain_t fx){
-  return _FXPT_TO_INT(fx, VRT_GAIN_C(1));
-}
-
-static inline double
-vrt_gain_to_double(vrt_gain_t fx){
-  return _FXPT_TO_DOUBLE(fx, VRT_GAIN_C(1));
-}
-
-/***********************************************************************
- * The VRT Temperature Type (Celcius)
- **********************************************************************/
-typedef int16_t vrt_temp_t;
-#define VRT_TEMP_RP 6
-#define VRT_TEMP_C(_x) _FXPT_C(vrt_temp_t, _x, VRT_TEMP_RP)
-
-static inline vrt_temp_t
-double_to_vrt_temp(double num){
-  return VRT_TEMP_C(num);
-}
-
-static inline int16_t
-vrt_temp_round_to_int(vrt_temp_t fx){
-  return _FXPT_TO_INT(fx, VRT_TEMP_C(1));
-}
-
-static inline double
-vrt_temp_to_double(vrt_temp_t fx){
-  return _FXPT_TO_DOUBLE(fx, VRT_TEMP_C(1));
-}
-
-#endif /* INCLUDED_VRT_TYPES_H */
diff --git a/vrt/lib/.gitignore b/vrt/lib/.gitignore
deleted file mode 100644 (file)
index 02b0523..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-Makefile
-Makefile.in
-.deps
-.libs
diff --git a/vrt/lib/Makefile.am b/vrt/lib/Makefile.am
deleted file mode 100644 (file)
index 303384c..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-#
-# Copyright 2007,2008,2009 Free Software Foundation, Inc.
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-#
-
-include $(top_srcdir)/Makefile.common
-
-AM_CPPFLAGS = \
-    $(VRT_INCLUDES) \
-    $(BOOST_CPPFLAGS) \
-    $(CPPUNIT_INCLUDES) \
-    $(GRUEL_INCLUDES)
-
-bin_PROGRAMS = 
-
-lib_LTLIBRARIES = \
-       libvrt.la
-
-libvrt_la_SOURCES = \
-       copiers.cc \
-       data_handler.cc \
-       expanded_header.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_parse_switch_body.h \
-       expanded_header_unparse_switch_body.h \
-       socket_rx_buffer.h
-
-EXTRA_DIST = \
-       gen_parse_switch_body.py \
-       gen_unparse_switch_body.py
diff --git a/vrt/lib/copiers.cc b/vrt/lib/copiers.cc
deleted file mode 100644 (file)
index ddf82ab..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2009 Free Software Foundation, Inc.
- * 
- * This file is part of GNU Radio
- * 
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- * 
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU 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>
-#include <assert.h>
-#include <string.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);
-    }
-  }
-
-};
-
diff --git a/vrt/lib/data_handler.cc b/vrt/lib/data_handler.cc
deleted file mode 100644 (file)
index 7d1f73a..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2008,2009 Free Software Foundation, Inc.
- * 
- * This file is part of GNU Radio
- * 
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- * 
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include "data_handler.h"
-
-namespace vrt {
-  
-  data_handler::~data_handler()
-  {
-    // default nop destructor
-  }
-
-}
-  
diff --git a/vrt/lib/data_handler.h b/vrt/lib/data_handler.h
deleted file mode 100644 (file)
index c041e48..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2008,2009 Free Software Foundation, Inc.
- * 
- * This file is part of GNU Radio
- * 
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- * 
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-#ifndef INCLUDED_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 */
diff --git a/vrt/lib/expanded_header.cc b/vrt/lib/expanded_header.cc
deleted file mode 100644 (file)
index 8b22fb9..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2009 Free Software Foundation, Inc.
- * 
- * This file is part of GNU Radio
- * 
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- * 
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU 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 <gruel/inet.h>
-//#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;
-
-  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;
-  }
-
-  void expanded_header::unparse(const expanded_header *h,   // in
-                        size_t n32_bit_words_payload,  // in
-                        uint32_t *header,              // out
-                        size_t *n32_bit_words_header,  // out
-                        uint32_t *trailer,             // out
-                        size_t *n32_bit_words_trailer){// out
-    int cw = compute_codeword(*h);
-    //fills in the header (except word0), header length, trailer, trailer length
-    switch (cw & 0x1f){
-#include "expanded_header_unparse_switch_body.h"
-    }
-    //fill in the header word 0 with the calculated length
-    size_t n32_bit_words_packet = *n32_bit_words_header + n32_bit_words_payload + *n32_bit_words_trailer;
-    header[0] = htonl((h->header & ~VRTH_PKT_SIZE_MASK) | (n32_bit_words_packet & VRTH_PKT_SIZE_MASK));
-  }
-
-  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 n32_bit_words_header = 0;
-    size_t n32_bit_words_trailer = 0;
-    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);
-    switch (cw & 0x1f){
-#include "expanded_header_parse_switch_body.h"
-    }
-
-    if (n32_bit_words_header + n32_bit_words_trailer > len)
-      return false;            // negative payload len
-
-    *payload = p + n32_bit_words_header;
-    *n32_bit_words_payload = len - (n32_bit_words_header + n32_bit_words_trailer);
-
-    // printf("parse: hdr = 0x%08x, cw = 0x%02x, n32_bit_words_header = %d, n32_bit_words_trailer = %d\n",
-    //   h->header, cw, n32_bit_words_header, n32_bit_words_trailer);
-
-    return true;
-  }
-
-
-}; // vrt
diff --git a/vrt/lib/expanded_header_parse_switch_body.h b/vrt/lib/expanded_header_parse_switch_body.h
deleted file mode 100644 (file)
index 6bfaf37..0000000
+++ /dev/null
@@ -1,320 +0,0 @@
-  case 0:
-    h->stream_id = 0;
-    h->class_id = 0;
-    h->integer_secs = 0;
-    h->fractional_secs = 0;
-    n32_bit_words_header = 1;
-    h->trailer = 0;
-    n32_bit_words_trailer = 0;
-    break;
-
-  case 1:
-    h->stream_id = ntohl(p[1]);
-    h->class_id = 0;
-    h->integer_secs = 0;
-    h->fractional_secs = 0;
-    n32_bit_words_header = 2;
-    h->trailer = 0;
-    n32_bit_words_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;
-    n32_bit_words_header = 3;
-    h->trailer = 0;
-    n32_bit_words_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;
-    n32_bit_words_header = 4;
-    h->trailer = 0;
-    n32_bit_words_trailer = 0;
-    break;
-
-  case 4:
-    h->stream_id = 0;
-    h->class_id = 0;
-    h->integer_secs = ntohl(p[1]);
-    h->fractional_secs = 0;
-    n32_bit_words_header = 2;
-    h->trailer = 0;
-    n32_bit_words_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;
-    n32_bit_words_header = 3;
-    h->trailer = 0;
-    n32_bit_words_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;
-    n32_bit_words_header = 4;
-    h->trailer = 0;
-    n32_bit_words_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;
-    n32_bit_words_header = 5;
-    h->trailer = 0;
-    n32_bit_words_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]);
-    n32_bit_words_header = 3;
-    h->trailer = 0;
-    n32_bit_words_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]);
-    n32_bit_words_header = 4;
-    h->trailer = 0;
-    n32_bit_words_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]);
-    n32_bit_words_header = 5;
-    h->trailer = 0;
-    n32_bit_words_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]);
-    n32_bit_words_header = 6;
-    h->trailer = 0;
-    n32_bit_words_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]);
-    n32_bit_words_header = 4;
-    h->trailer = 0;
-    n32_bit_words_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]);
-    n32_bit_words_header = 5;
-    h->trailer = 0;
-    n32_bit_words_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]);
-    n32_bit_words_header = 6;
-    h->trailer = 0;
-    n32_bit_words_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]);
-    n32_bit_words_header = 7;
-    h->trailer = 0;
-    n32_bit_words_trailer = 0;
-    break;
-
-  case 16:
-    h->stream_id = 0;
-    h->class_id = 0;
-    h->integer_secs = 0;
-    h->fractional_secs = 0;
-    n32_bit_words_header = 1;
-    h->trailer = ntohl(p[len-1]);
-    n32_bit_words_trailer = 1;
-    break;
-
-  case 17:
-    h->stream_id = ntohl(p[1]);
-    h->class_id = 0;
-    h->integer_secs = 0;
-    h->fractional_secs = 0;
-    n32_bit_words_header = 2;
-    h->trailer = ntohl(p[len-1]);
-    n32_bit_words_trailer = 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;
-    n32_bit_words_header = 3;
-    h->trailer = ntohl(p[len-1]);
-    n32_bit_words_trailer = 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;
-    n32_bit_words_header = 4;
-    h->trailer = ntohl(p[len-1]);
-    n32_bit_words_trailer = 1;
-    break;
-
-  case 20:
-    h->stream_id = 0;
-    h->class_id = 0;
-    h->integer_secs = ntohl(p[1]);
-    h->fractional_secs = 0;
-    n32_bit_words_header = 2;
-    h->trailer = ntohl(p[len-1]);
-    n32_bit_words_trailer = 1;
-    break;
-
-  case 21:
-    h->stream_id = ntohl(p[1]);
-    h->class_id = 0;
-    h->integer_secs = ntohl(p[2]);
-    h->fractional_secs = 0;
-    n32_bit_words_header = 3;
-    h->trailer = ntohl(p[len-1]);
-    n32_bit_words_trailer = 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;
-    n32_bit_words_header = 4;
-    h->trailer = ntohl(p[len-1]);
-    n32_bit_words_trailer = 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;
-    n32_bit_words_header = 5;
-    h->trailer = ntohl(p[len-1]);
-    n32_bit_words_trailer = 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]);
-    n32_bit_words_header = 3;
-    h->trailer = ntohl(p[len-1]);
-    n32_bit_words_trailer = 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]);
-    n32_bit_words_header = 4;
-    h->trailer = ntohl(p[len-1]);
-    n32_bit_words_trailer = 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]);
-    n32_bit_words_header = 5;
-    h->trailer = ntohl(p[len-1]);
-    n32_bit_words_trailer = 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]);
-    n32_bit_words_header = 6;
-    h->trailer = ntohl(p[len-1]);
-    n32_bit_words_trailer = 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]);
-    n32_bit_words_header = 4;
-    h->trailer = ntohl(p[len-1]);
-    n32_bit_words_trailer = 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]);
-    n32_bit_words_header = 5;
-    h->trailer = ntohl(p[len-1]);
-    n32_bit_words_trailer = 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]);
-    n32_bit_words_header = 6;
-    h->trailer = ntohl(p[len-1]);
-    n32_bit_words_trailer = 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]);
-    n32_bit_words_header = 7;
-    h->trailer = ntohl(p[len-1]);
-    n32_bit_words_trailer = 1;
-    break;
-
diff --git a/vrt/lib/expanded_header_unparse_switch_body.h b/vrt/lib/expanded_header_unparse_switch_body.h
deleted file mode 100644 (file)
index ca6e149..0000000
+++ /dev/null
@@ -1,272 +0,0 @@
-  case 0:
-    *n32_bit_words_header = 1;
-    *n32_bit_words_trailer = 0;
-    break;
-
-  case 1:
-    header[1] = htonl(h->stream_id);
-    *n32_bit_words_header = 2;
-    *n32_bit_words_trailer = 0;
-    break;
-
-  case 2:
-    header[1] = htonl((uint32_t)((h->class_id >> 32) & 0xffffffff));
-    header[2] = htonl((uint32_t)((h->class_id >>  0) & 0xffffffff));
-    *n32_bit_words_header = 3;
-    *n32_bit_words_trailer = 0;
-    break;
-
-  case 3:
-    header[1] = htonl(h->stream_id);
-    header[2] = htonl((uint32_t)((h->class_id >> 32) & 0xffffffff));
-    header[3] = htonl((uint32_t)((h->class_id >>  0) & 0xffffffff));
-    *n32_bit_words_header = 4;
-    *n32_bit_words_trailer = 0;
-    break;
-
-  case 4:
-    header[1] = htonl(h->integer_secs);
-    *n32_bit_words_header = 2;
-    *n32_bit_words_trailer = 0;
-    break;
-
-  case 5:
-    header[1] = htonl(h->stream_id);
-    header[2] = htonl(h->integer_secs);
-    *n32_bit_words_header = 3;
-    *n32_bit_words_trailer = 0;
-    break;
-
-  case 6:
-    header[1] = htonl((uint32_t)((h->class_id >> 32) & 0xffffffff));
-    header[2] = htonl((uint32_t)((h->class_id >>  0) & 0xffffffff));
-    header[3] = htonl(h->integer_secs);
-    *n32_bit_words_header = 4;
-    *n32_bit_words_trailer = 0;
-    break;
-
-  case 7:
-    header[1] = htonl(h->stream_id);
-    header[2] = htonl((uint32_t)((h->class_id >> 32) & 0xffffffff));
-    header[3] = htonl((uint32_t)((h->class_id >>  0) & 0xffffffff));
-    header[4] = htonl(h->integer_secs);
-    *n32_bit_words_header = 5;
-    *n32_bit_words_trailer = 0;
-    break;
-
-  case 8:
-    header[1] = htonl((uint32_t)((h->fractional_secs >> 32) & 0xffffffff));
-    header[2] = htonl((uint32_t)((h->fractional_secs >>  0) & 0xffffffff));
-    *n32_bit_words_header = 3;
-    *n32_bit_words_trailer = 0;
-    break;
-
-  case 9:
-    header[1] = htonl(h->stream_id);
-    header[2] = htonl((uint32_t)((h->fractional_secs >> 32) & 0xffffffff));
-    header[3] = htonl((uint32_t)((h->fractional_secs >>  0) & 0xffffffff));
-    *n32_bit_words_header = 4;
-    *n32_bit_words_trailer = 0;
-    break;
-
-  case 10:
-    header[1] = htonl((uint32_t)((h->class_id >> 32) & 0xffffffff));
-    header[2] = htonl((uint32_t)((h->class_id >>  0) & 0xffffffff));
-    header[3] = htonl((uint32_t)((h->fractional_secs >> 32) & 0xffffffff));
-    header[4] = htonl((uint32_t)((h->fractional_secs >>  0) & 0xffffffff));
-    *n32_bit_words_header = 5;
-    *n32_bit_words_trailer = 0;
-    break;
-
-  case 11:
-    header[1] = htonl(h->stream_id);
-    header[2] = htonl((uint32_t)((h->class_id >> 32) & 0xffffffff));
-    header[3] = htonl((uint32_t)((h->class_id >>  0) & 0xffffffff));
-    header[4] = htonl((uint32_t)((h->fractional_secs >> 32) & 0xffffffff));
-    header[5] = htonl((uint32_t)((h->fractional_secs >>  0) & 0xffffffff));
-    *n32_bit_words_header = 6;
-    *n32_bit_words_trailer = 0;
-    break;
-
-  case 12:
-    header[1] = htonl(h->integer_secs);
-    header[2] = htonl((uint32_t)((h->fractional_secs >> 32) & 0xffffffff));
-    header[3] = htonl((uint32_t)((h->fractional_secs >>  0) & 0xffffffff));
-    *n32_bit_words_header = 4;
-    *n32_bit_words_trailer = 0;
-    break;
-
-  case 13:
-    header[1] = htonl(h->stream_id);
-    header[2] = htonl(h->integer_secs);
-    header[3] = htonl((uint32_t)((h->fractional_secs >> 32) & 0xffffffff));
-    header[4] = htonl((uint32_t)((h->fractional_secs >>  0) & 0xffffffff));
-    *n32_bit_words_header = 5;
-    *n32_bit_words_trailer = 0;
-    break;
-
-  case 14:
-    header[1] = htonl((uint32_t)((h->class_id >> 32) & 0xffffffff));
-    header[2] = htonl((uint32_t)((h->class_id >>  0) & 0xffffffff));
-    header[3] = htonl(h->integer_secs);
-    header[4] = htonl((uint32_t)((h->fractional_secs >> 32) & 0xffffffff));
-    header[5] = htonl((uint32_t)((h->fractional_secs >>  0) & 0xffffffff));
-    *n32_bit_words_header = 6;
-    *n32_bit_words_trailer = 0;
-    break;
-
-  case 15:
-    header[1] = htonl(h->stream_id);
-    header[2] = htonl((uint32_t)((h->class_id >> 32) & 0xffffffff));
-    header[3] = htonl((uint32_t)((h->class_id >>  0) & 0xffffffff));
-    header[4] = htonl(h->integer_secs);
-    header[5] = htonl((uint32_t)((h->fractional_secs >> 32) & 0xffffffff));
-    header[6] = htonl((uint32_t)((h->fractional_secs >>  0) & 0xffffffff));
-    *n32_bit_words_header = 7;
-    *n32_bit_words_trailer = 0;
-    break;
-
-  case 16:
-    *n32_bit_words_header = 1;
-    trailer[0] = htonl(h->trailer);
-    *n32_bit_words_trailer = 1;
-    break;
-
-  case 17:
-    header[1] = htonl(h->stream_id);
-    *n32_bit_words_header = 2;
-    trailer[0] = htonl(h->trailer);
-    *n32_bit_words_trailer = 1;
-    break;
-
-  case 18:
-    header[1] = htonl((uint32_t)((h->class_id >> 32) & 0xffffffff));
-    header[2] = htonl((uint32_t)((h->class_id >>  0) & 0xffffffff));
-    *n32_bit_words_header = 3;
-    trailer[0] = htonl(h->trailer);
-    *n32_bit_words_trailer = 1;
-    break;
-
-  case 19:
-    header[1] = htonl(h->stream_id);
-    header[2] = htonl((uint32_t)((h->class_id >> 32) & 0xffffffff));
-    header[3] = htonl((uint32_t)((h->class_id >>  0) & 0xffffffff));
-    *n32_bit_words_header = 4;
-    trailer[0] = htonl(h->trailer);
-    *n32_bit_words_trailer = 1;
-    break;
-
-  case 20:
-    header[1] = htonl(h->integer_secs);
-    *n32_bit_words_header = 2;
-    trailer[0] = htonl(h->trailer);
-    *n32_bit_words_trailer = 1;
-    break;
-
-  case 21:
-    header[1] = htonl(h->stream_id);
-    header[2] = htonl(h->integer_secs);
-    *n32_bit_words_header = 3;
-    trailer[0] = htonl(h->trailer);
-    *n32_bit_words_trailer = 1;
-    break;
-
-  case 22:
-    header[1] = htonl((uint32_t)((h->class_id >> 32) & 0xffffffff));
-    header[2] = htonl((uint32_t)((h->class_id >>  0) & 0xffffffff));
-    header[3] = htonl(h->integer_secs);
-    *n32_bit_words_header = 4;
-    trailer[0] = htonl(h->trailer);
-    *n32_bit_words_trailer = 1;
-    break;
-
-  case 23:
-    header[1] = htonl(h->stream_id);
-    header[2] = htonl((uint32_t)((h->class_id >> 32) & 0xffffffff));
-    header[3] = htonl((uint32_t)((h->class_id >>  0) & 0xffffffff));
-    header[4] = htonl(h->integer_secs);
-    *n32_bit_words_header = 5;
-    trailer[0] = htonl(h->trailer);
-    *n32_bit_words_trailer = 1;
-    break;
-
-  case 24:
-    header[1] = htonl((uint32_t)((h->fractional_secs >> 32) & 0xffffffff));
-    header[2] = htonl((uint32_t)((h->fractional_secs >>  0) & 0xffffffff));
-    *n32_bit_words_header = 3;
-    trailer[0] = htonl(h->trailer);
-    *n32_bit_words_trailer = 1;
-    break;
-
-  case 25:
-    header[1] = htonl(h->stream_id);
-    header[2] = htonl((uint32_t)((h->fractional_secs >> 32) & 0xffffffff));
-    header[3] = htonl((uint32_t)((h->fractional_secs >>  0) & 0xffffffff));
-    *n32_bit_words_header = 4;
-    trailer[0] = htonl(h->trailer);
-    *n32_bit_words_trailer = 1;
-    break;
-
-  case 26:
-    header[1] = htonl((uint32_t)((h->class_id >> 32) & 0xffffffff));
-    header[2] = htonl((uint32_t)((h->class_id >>  0) & 0xffffffff));
-    header[3] = htonl((uint32_t)((h->fractional_secs >> 32) & 0xffffffff));
-    header[4] = htonl((uint32_t)((h->fractional_secs >>  0) & 0xffffffff));
-    *n32_bit_words_header = 5;
-    trailer[0] = htonl(h->trailer);
-    *n32_bit_words_trailer = 1;
-    break;
-
-  case 27:
-    header[1] = htonl(h->stream_id);
-    header[2] = htonl((uint32_t)((h->class_id >> 32) & 0xffffffff));
-    header[3] = htonl((uint32_t)((h->class_id >>  0) & 0xffffffff));
-    header[4] = htonl((uint32_t)((h->fractional_secs >> 32) & 0xffffffff));
-    header[5] = htonl((uint32_t)((h->fractional_secs >>  0) & 0xffffffff));
-    *n32_bit_words_header = 6;
-    trailer[0] = htonl(h->trailer);
-    *n32_bit_words_trailer = 1;
-    break;
-
-  case 28:
-    header[1] = htonl(h->integer_secs);
-    header[2] = htonl((uint32_t)((h->fractional_secs >> 32) & 0xffffffff));
-    header[3] = htonl((uint32_t)((h->fractional_secs >>  0) & 0xffffffff));
-    *n32_bit_words_header = 4;
-    trailer[0] = htonl(h->trailer);
-    *n32_bit_words_trailer = 1;
-    break;
-
-  case 29:
-    header[1] = htonl(h->stream_id);
-    header[2] = htonl(h->integer_secs);
-    header[3] = htonl((uint32_t)((h->fractional_secs >> 32) & 0xffffffff));
-    header[4] = htonl((uint32_t)((h->fractional_secs >>  0) & 0xffffffff));
-    *n32_bit_words_header = 5;
-    trailer[0] = htonl(h->trailer);
-    *n32_bit_words_trailer = 1;
-    break;
-
-  case 30:
-    header[1] = htonl((uint32_t)((h->class_id >> 32) & 0xffffffff));
-    header[2] = htonl((uint32_t)((h->class_id >>  0) & 0xffffffff));
-    header[3] = htonl(h->integer_secs);
-    header[4] = htonl((uint32_t)((h->fractional_secs >> 32) & 0xffffffff));
-    header[5] = htonl((uint32_t)((h->fractional_secs >>  0) & 0xffffffff));
-    *n32_bit_words_header = 6;
-    trailer[0] = htonl(h->trailer);
-    *n32_bit_words_trailer = 1;
-    break;
-
-  case 31:
-    header[1] = htonl(h->stream_id);
-    header[2] = htonl((uint32_t)((h->class_id >> 32) & 0xffffffff));
-    header[3] = htonl((uint32_t)((h->class_id >>  0) & 0xffffffff));
-    header[4] = htonl(h->integer_secs);
-    header[5] = htonl((uint32_t)((h->fractional_secs >> 32) & 0xffffffff));
-    header[6] = htonl((uint32_t)((h->fractional_secs >>  0) & 0xffffffff));
-    *n32_bit_words_header = 7;
-    trailer[0] = htonl(h->trailer);
-    *n32_bit_words_trailer = 1;
-    break;
-
diff --git a/vrt/lib/gen_parse_switch_body.py b/vrt/lib/gen_parse_switch_body.py
deleted file mode 100755 (executable)
index d13e490..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-#!/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 dolength(index):
-        f.write("    n32_bit_words_header = %d;\n"%index)
-
-    def dotrailer(name, mask):
-        if cw & mask:
-            f.write("    h->%s = ntohl(p[len-1]);\n" % (name,))
-            f.write("    n32_bit_words_trailer = 1;\n")
-            return 1
-        else:
-            f.write("    h->%s = 0;\n" % (name,))
-            f.write("    n32_bit_words_trailer = 0;\n")
-            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)
-    dolength(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()
diff --git a/vrt/lib/gen_unparse_switch_body.py b/vrt/lib/gen_unparse_switch_body.py
deleted file mode 100755 (executable)
index 6c7cd01..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-#!/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):
-        if cw & mask:
-            f.write("    header[%d] = htonl(h->%s);\n" % (index, name))
-            return 1
-        return 0
-        
-    def do64(name, mask, index):
-        if cw & mask:
-            f.write("    header[%d] = htonl((uint32_t)((h->%s >> 32) & 0xffffffff));\n" % (index, name))
-            f.write("    header[%d] = htonl((uint32_t)((h->%s >>  0) & 0xffffffff));\n" % (index+1, name))
-            return 2
-        return 0
-
-    def dolength(index):
-        f.write("    *n32_bit_words_header = %d;\n"%index)
-
-    def dotrailer(name, mask):
-        if cw & mask:
-            f.write("    trailer[%d] = htonl(h->%s);\n" % (0, name))
-            f.write("    *n32_bit_words_trailer = 1;\n")
-            return 1
-        else:
-            f.write("    *n32_bit_words_trailer = 0;\n")
-            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)
-    dolength(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()
diff --git a/vrt/lib/rx.cc b/vrt/lib/rx.cc
deleted file mode 100644 (file)
index 2d741e9..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2009 Free Software Foundation, Inc.
- * 
- * This file is part of GNU Radio
- * 
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- * 
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU 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, const 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(){}
-
-  // N.B., There may be more than 1 VRT packet in a frame (usually IF-Context packets)
-  data_handler::result
-  vrt_data_handler::operator()(const void *base, size_t len)
-  {
-    const uint32_t *word_base = (const uint32_t *) base;
-    size_t word_len = len/(sizeof(uint32_t));
-
-    bool want_more = true;
-    while (word_len > 0 && want_more){
-      const uint32_t *payload;
-      size_t n32_bit_words;
-      expanded_header hdr;
-      if (!expanded_header::parse(word_base, word_len,
-                                 &hdr, &payload, &n32_bit_words)){
-       if (1){
-         fprintf(stderr, "vrt_data_handler: malformed VRT packet!\n");
-         print_words(stderr, 0, word_base, word_len);
-       }
-       return 0;
-      }
-      want_more = (*d_handler)(payload, n32_bit_words, &hdr);
-      word_base += hdr.pkt_size();
-      word_len -= hdr.pkt_size();
-    }
-    return !want_more ? data_handler::DONE : 0;
-  }
-
-
-  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
diff --git a/vrt/lib/rx_packet_handler.cc b/vrt/lib/rx_packet_handler.cc
deleted file mode 100644 (file)
index 11f9027..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2009 Free Software Foundation, Inc.
- * 
- * This file is part of GNU Radio
- * 
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- * 
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU 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
diff --git a/vrt/lib/socket_rx_buffer.cc b/vrt/lib/socket_rx_buffer.cc
deleted file mode 100644 (file)
index 6ed211b..0000000
+++ /dev/null
@@ -1,278 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2008,2009 Free Software Foundation, Inc.
- * 
- * This file is part of GNU Radio
- * 
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- * 
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "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
diff --git a/vrt/lib/socket_rx_buffer.h b/vrt/lib/socket_rx_buffer.h
deleted file mode 100644 (file)
index 053c30c..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2008,2009 Free Software Foundation, Inc.
- * 
- * This file is part of GNU Radio
- * 
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- * 
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-#ifndef INCLUDED_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 */
diff --git a/vrt/vrt.pc.in b/vrt/vrt.pc.in
deleted file mode 100644 (file)
index 0f8cb93..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-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}