[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r4685 - in gnuradio/branches/developers/n4hy/ofdm: . c
From: |
n4hy |
Subject: |
[Commit-gnuradio] r4685 - in gnuradio/branches/developers/n4hy/ofdm: . config gnuradio-core/src/lib gnuradio-core/src/lib/general gnuradio-core/src/lib/gengen gnuradio-core/src/lib/runtime gnuradio-core/src/lib/swig gnuradio-core/src/python/gnuradio/gr gnuradio-core/src/tests gnuradio-examples/c++/dial_tone gnuradio-examples/python/audio gnuradio-examples/python/hier gnuradio-examples/python/hier/networking gnuradio-examples/python/hier/sounder gnuradio-examples/python/hier/usrp gnuradio-examples/python/multi_usrp gr-atsc/src/lib gr-audio-alsa/src gr-audio-jack/src gr-audio-oss/src gr-audio-osx/src gr-audio-portaudio/src gr-audio-windows/src gr-comedi/src gr-ezdop/src/lib gr-gsm-fr-vocoder/src/lib gr-howto-write-a-block/config gr-pager/src gr-qtgui gr-qtgui/src gr-qtgui/src/lib gr-radio-astronomy/src/lib gr-trellis/src/lib gr-usrp/src gr-video-sdl/src gr-wxgui/src/python mblock/src/lib pmt/src/lib usrp/doc usrp/fpga/toplevel/usrp_std |
Date: |
Thu, 1 Mar 2007 20:57:31 -0700 (MST) |
Author: n4hy
Date: 2007-03-01 20:57:30 -0700 (Thu, 01 Mar 2007)
New Revision: 4685
Added:
gnuradio/branches/developers/n4hy/ofdm/config/grc_gr_qtgui.m4
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_glfsr_source_b.cc
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_glfsr_source_b.h
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_glfsr_source_b.i
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gri_glfsr.cc
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gri_glfsr.h
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/python/gnuradio/gr/qa_glfsr_source_b.py
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/audio/noise.py
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/networking/Makefile.am
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/Makefile.am
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/sounder_rx.py
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/sounder_tx.py
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/usrp_sink.py
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/usrp_sounder_rx.py
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/usrp_sounder_tx.py
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/usrp_source.py
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/usrp/
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/usrp/Makefile.am
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/usrp/usrp_fft.py
gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/
gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/Changelog
gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/Makefile.am
gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/README
gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/gr-qtgui.conf
gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/src/
gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/src/Makefile.am
gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/src/lib/
gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/src/lib/Makefile.am
gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/src/lib/fftdisplay.cc
gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/src/lib/fftdisplay.h
gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/src/lib/fftdisplaysink.h
gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/src/lib/qt_examples.cc
gnuradio/branches/developers/n4hy/ofdm/gr-wxgui/src/python/fftsink2.py
gnuradio/branches/developers/n4hy/ofdm/gr-wxgui/src/python/scopesink2.py
gnuradio/branches/developers/n4hy/ofdm/gr-wxgui/src/python/stdgui2.py
gnuradio/branches/developers/n4hy/ofdm/gr-wxgui/src/python/waterfallsink2.py
gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_endpoint.cc
gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_runtime_single_threaded.cc
gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_runtime_single_threaded.h
gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/qa_mblock_send.cc
gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/qa_mblock_send.h
gnuradio/branches/developers/n4hy/ofdm/usrp/doc/inband-signaling-usb
Removed:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/Makefile.am
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/sounder_rx.py
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/sounder_tx.py
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/usrp_sink.py
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/usrp_sounder_rx.py
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/usrp_sounder_tx.py
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/usrp_source.py
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/usrp/Makefile.am
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/usrp/usrp_fft.py
gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/Changelog
gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/Makefile.am
gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/README
gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/gr-qtgui.conf
gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/src/
gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/src/Makefile.am
gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/src/lib/
gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/src/lib/Makefile.am
gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/src/lib/fftdisplay.cc
gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/src/lib/fftdisplay.h
gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/src/lib/fftdisplaysink.h
gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/src/lib/qt_examples.cc
gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_port_detail.cc
gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_port_detail.h
gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_runtime_impl.cc
gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_runtime_impl.h
Modified:
gnuradio/branches/developers/n4hy/ofdm/Makefile.common
gnuradio/branches/developers/n4hy/ofdm/config/gr_python.m4
gnuradio/branches/developers/n4hy/ofdm/config/grc_gnuradio_examples.m4
gnuradio/branches/developers/n4hy/ofdm/configure.ac
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/Makefile.am
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/Makefile.am
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/general.i
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_correlate_access_code_bb.cc
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_correlate_access_code_bb.h
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen/gr_sig_source_X.cc.t
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen/gr_sig_source_waveform.h
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/runtime/gr_io_signature.cc
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/runtime/gr_io_signature.h
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/runtime/gr_io_signature.i
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/runtime/qa_gr_block.cc
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/runtime/qa_gr_hier_block2.cc
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/runtime/qa_gr_io_signature.cc
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/runtime/qa_gr_io_signature.h
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/swig/Makefile.am
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/python/gnuradio/gr/qa_sig_source.py
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/tests/Makefile.am
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/c++/dial_tone/Makefile.am
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/audio/Makefile.am
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/Makefile.am
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/networking/
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/multi_usrp/README
gnuradio/branches/developers/n4hy/ofdm/gr-atsc/src/lib/Makefile.am
gnuradio/branches/developers/n4hy/ofdm/gr-audio-alsa/src/Makefile.am
gnuradio/branches/developers/n4hy/ofdm/gr-audio-jack/src/Makefile.am
gnuradio/branches/developers/n4hy/ofdm/gr-audio-oss/src/Makefile.am
gnuradio/branches/developers/n4hy/ofdm/gr-audio-osx/src/Makefile.am
gnuradio/branches/developers/n4hy/ofdm/gr-audio-portaudio/src/Makefile.am
gnuradio/branches/developers/n4hy/ofdm/gr-audio-windows/src/Makefile.am
gnuradio/branches/developers/n4hy/ofdm/gr-comedi/src/Makefile.am
gnuradio/branches/developers/n4hy/ofdm/gr-ezdop/src/lib/Makefile.am
gnuradio/branches/developers/n4hy/ofdm/gr-gsm-fr-vocoder/src/lib/Makefile.am
gnuradio/branches/developers/n4hy/ofdm/gr-howto-write-a-block/config/gr_python.m4
gnuradio/branches/developers/n4hy/ofdm/gr-pager/src/Makefile.am
gnuradio/branches/developers/n4hy/ofdm/gr-radio-astronomy/src/lib/Makefile.am
gnuradio/branches/developers/n4hy/ofdm/gr-trellis/src/lib/Makefile.am
gnuradio/branches/developers/n4hy/ofdm/gr-usrp/src/Makefile.am
gnuradio/branches/developers/n4hy/ofdm/gr-usrp/src/run_tests.in
gnuradio/branches/developers/n4hy/ofdm/gr-video-sdl/src/Makefile.am
gnuradio/branches/developers/n4hy/ofdm/gr-wxgui/src/python/Makefile.am
gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/Makefile.am
gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_common.h
gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_connection.cc
gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_connection.h
gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_endpoint.h
gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_exception.cc
gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_exception.h
gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_mblock.cc
gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_mblock.h
gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_mblock_impl.cc
gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_mblock_impl.h
gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_msg_queue.cc
gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_msg_queue.h
gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_port.cc
gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_port.h
gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_port_simple.cc
gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_port_simple.h
gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_runtime.cc
gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_runtime.h
gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_util.cc
gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/qa_mblock.cc
gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/qa_mblock_prims.cc
gnuradio/branches/developers/n4hy/ofdm/pmt/src/lib/Makefile.am
gnuradio/branches/developers/n4hy/ofdm/pmt/src/lib/pmt.cc
gnuradio/branches/developers/n4hy/ofdm/pmt/src/lib/pmt.h
gnuradio/branches/developers/n4hy/ofdm/run_tests.sh.in
gnuradio/branches/developers/n4hy/ofdm/usrp/fpga/toplevel/usrp_std/usrp_std_config_2rxhb_2tx.vh
gnuradio/branches/developers/n4hy/ofdm/usrp/fpga/toplevel/usrp_std/usrp_std_config_4rx_0tx.vh
Log:
merge -r 4518:4683 from trunk
Modified: gnuradio/branches/developers/n4hy/ofdm/Makefile.common
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/Makefile.common 2007-03-02
03:57:08 UTC (rev 4684)
+++ gnuradio/branches/developers/n4hy/ofdm/Makefile.common 2007-03-02
03:57:30 UTC (rev 4685)
@@ -1,6 +1,6 @@
# -*- Makefile -*-
#
-# Copyright 2004,2006 Free Software Foundation, Inc.
+# Copyright 2004,2006,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -54,31 +54,24 @@
-I$(top_builddir)/gnuradio-core/src/lib/swig \
$(FFTW3F_CFLAGS)
-# How to link in the top-level omnithreads library
+# How to link in the top-level omnithreads library from inside the tree
OMNITHREAD_INCLUDES = -I$(top_srcdir)/omnithread
-OMNITHREAD_LIBS = -L$(top_builddir)/omnithread -lgromnithread
+OMNITHREAD_LA = $(top_builddir)/omnithread/libgromnithread.la
-# How to link in GNU Radio core library
-# Note: Win32 libtool cannot extract DLL dependencies already stored in
-# libgnuradio-core, so the core's dependencies must be repeated here
-# This is redundant but harmless on non-Win32 platforms
-GNURADIO_CORE_LIBS = $(OMNITHREAD_LIBS) \
- $(FFTW3F_LIBS) \
- -L$(top_builddir)/gnuradio-core/src/lib \
- -lgnuradio-core
+# How to link in GNU Radio core library from inside the tree
+GNURADIO_CORE_LA = $(top_builddir)/gnuradio-core/src/lib/libgnuradio-core.la
# This is a dependency for many swig operations
GNURADIO_I = $(top_srcdir)/gnuradio-core/src/lib/swig/gnuradio.i
-# The below used to be set in PKGCONFIG but now point to the current
-# build tree.
+# How to link in the USRP library from inside the tree
USRP_INCLUDES = -I$(top_srcdir)/usrp/host/lib \
-I$(top_srcdir)/usrp/firmware/include
+USRP_LA = $(top_builddir)/usrp/host/lib/libusrp.la
-USRP_LIBS = -L$(top_builddir)/usrp/host/lib -lusrp
-
+# How to link the PMT library from inside the tree
PMT_INCLUDES = -I$(top_srcdir)/pmt/src/lib
-PMT_LIBS = -L$(top_builddir)/pmt/src/lib -lpmt
+PMT_LA = $(top_builddir)/pmt/src/lib/libpmt.la
# This used to be set in configure.ac but is now defined here for all
# Makefiles when this fragment is included.
Modified: gnuradio/branches/developers/n4hy/ofdm/config/gr_python.m4
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/config/gr_python.m4 2007-03-02
03:57:08 UTC (rev 4684)
+++ gnuradio/branches/developers/n4hy/ofdm/config/gr_python.m4 2007-03-02
03:57:30 UTC (rev 4685)
@@ -28,6 +28,13 @@
AC_REQUIRE([AM_PATH_PYTHON])
AC_REQUIRE([AC_CANONICAL_HOST])
+ # For Fedora Core 5 and 6, see ticket:39 in Trac
+ if test -f '/etc/redhat-release'; then
+ if (echo $pyexecdir | grep -q lib64); then
+ pythondir="$pyexecdir"
+ fi
+ fi
+
# Check for Python include path
AC_MSG_CHECKING([for Python include path])
if test -z "$PYTHON" ; then
@@ -93,22 +100,10 @@
PYTHON_LDFLAGS="-L$python_stdlib_path -l$libpython_name"
AC_MSG_RESULT($PYTHON_LDFLAGS)
# Replace all backslashes in PYTHON Paths with forward slashes
- AC_MSG_CHECKING([for pythondir])
pythondir=`echo $pythondir |sed 's,\\\\,/,g'`
- AC_MSG_RESULT($pythondir)
- AC_SUBST([pythondir])
- AC_MSG_CHECKING([for pkgpythondir])
pkgpythondir=`echo $pkgpythondir |sed 's,\\\\,/,g'`
- AC_MSG_RESULT($pkgpythondir)
- AC_SUBST([pkgpythondir])
- AC_MSG_CHECKING([for pyexecdir])
pyexecdir=`echo $pyexecdir |sed 's,\\\\,/,g'`
- AC_MSG_RESULT($pyexecdir)
- AC_SUBST([pyexecdir])
- AC_MSG_CHECKING([for pkgpyexecdir])
pkgpyexecdir=`echo $pkgpyexecdir |sed 's,\\\\,/,g'`
- AC_MSG_RESULT($pkgpyexecdir)
- AC_SUBST([pkgpyexecdir])
;;
esac
Modified: gnuradio/branches/developers/n4hy/ofdm/config/grc_gnuradio_examples.m4
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/config/grc_gnuradio_examples.m4
2007-03-02 03:57:08 UTC (rev 4684)
+++ gnuradio/branches/developers/n4hy/ofdm/config/grc_gnuradio_examples.m4
2007-03-02 03:57:30 UTC (rev 4685)
@@ -33,7 +33,10 @@
gnuradio-examples/python/digital_voice/Makefile \
gnuradio-examples/python/hier/Makefile \
gnuradio-examples/python/hier/audio/Makefile \
+ gnuradio-examples/python/hier/networking/Makefile \
gnuradio-examples/python/hier/ofdm/Makefile \
+ gnuradio-examples/python/hier/sounder/Makefile \
+ gnuradio-examples/python/hier/usrp/Makefile \
gnuradio-examples/python/multi-antenna/Makefile \
gnuradio-examples/python/multi_usrp/Makefile \
gnuradio-examples/python/networking/Makefile \
Copied: gnuradio/branches/developers/n4hy/ofdm/config/grc_gr_qtgui.m4 (from rev
4683, gnuradio/trunk/config/grc_gr_qtgui.m4)
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/config/grc_gr_qtgui.m4
(rev 0)
+++ gnuradio/branches/developers/n4hy/ofdm/config/grc_gr_qtgui.m4
2007-03-02 03:57:30 UTC (rev 4685)
@@ -0,0 +1,46 @@
+dnl Copyright 2001,2002,2003,2004,2005,2006 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 2, or (at your option)
+dnl any later version.
+dnl
+dnl GNU Radio is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+dnl GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with GNU Radio; see the file COPYING. If not, write to
+dnl the Free Software Foundation, Inc., 51 Franklin Street,
+dnl Boston, MA 02110-1301, USA.
+
+AC_DEFUN([GRC_GR_QTGUI],[
+ GRC_ENABLE([gr-qtgui])
+
+ AC_CONFIG_FILES([ \
+ gr-qtgui/Makefile \
+ gr-qtgui/src/Makefile \
+ gr-qtgui/src/lib/Makefile \
+ ])
+
+ passed=yes
+ PKG_CHECK_MODULES(QT, qt >= 3.3,[],
+ [passed=no;AC_MSG_RESULT([gr-qtgui requires qt, not found. Checking for
qt-mt])])
+
+ if test x$passed == xno; then
+ passed=yes
+ PKG_CHECK_MODULES(QT, qt-mt >= 3.3,[],
+ [passed=no;AC_MSG_RESULT([gr-qtgui requires qt, not found. Checking for
qt-mt])])
+ fi
+
+ PKG_CHECK_MODULES(QWT, qwt >= 5.0.0, [],
+ [passed=no;AC_MSG_RESULT([gr-qtgui requires qwt, not found.])])
+
+
+ GRC_BUILD_CONDITIONAL([gr-qtgui], [
+ AC_SUBST(QT_LIBS)
+ AC_SUBST(QWT_LIBS)])
+])
Modified: gnuradio/branches/developers/n4hy/ofdm/configure.ac
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/configure.ac 2007-03-02 03:57:08 UTC
(rev 4684)
+++ gnuradio/branches/developers/n4hy/ofdm/configure.ac 2007-03-02 03:57:30 UTC
(rev 4685)
@@ -201,6 +201,7 @@
GRC_GR_RADIO_ASTRONOMY
GRC_GR_TRELLIS
GRC_GR_VIDEO_SDL
+#GRC_GR_QTGUI dnl disabled until grc_gr_qtgui.m4 is final
GRC_GR_WXGUI
GRC_PMT
GRC_MBLOCK dnl this must come after GRC_PMT
Modified:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/Makefile.am
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/Makefile.am
2007-03-02 03:57:08 UTC (rev 4684)
+++ gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/Makefile.am
2007-03-02 03:57:30 UTC (rev 4685)
@@ -36,7 +36,6 @@
libgnuradio_core_qa_la_SOURCES = bug_work_around_6.cc
libgnuradio_core_qa_la_LDFLAGS = $(NO_UNDEFINED) -version-info 0:0:0 \
$(LIBGNURADIO_CORE_EXTRA_LDFLAGS)
-
libgnuradio_core_la_LIBADD = \
filter/libfilter.la \
g72x/libccitt.la \
@@ -46,7 +45,7 @@
missing/libmissing.la \
reed-solomon/librs.la \
runtime/libruntime.la \
- $(OMNITHREAD_LIBS) \
+ $(OMNITHREAD_LA) \
$(FFTW3F_LIBS)
libgnuradio_core_qa_la_LIBADD = \
Modified:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/Makefile.am
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/Makefile.am
2007-03-02 03:57:08 UTC (rev 4684)
+++
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/Makefile.am
2007-03-02 03:57:30 UTC (rev 4685)
@@ -1,5 +1,5 @@
#
-# Copyright 2001,2002,2004,2006 Free Software Foundation, Inc.
+# Copyright 2001,2002,2004,2006,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -78,6 +78,7 @@
gr_frequency_modulator_fc.cc \
gr_fxpt.cc \
gr_framer_sink_1.cc \
+ gr_glfsr_source_b.cc \
gr_head.cc \
gr_interleave.cc \
gr_interleaved_short_to_complex.cc \
@@ -144,6 +145,7 @@
gri_float_to_char.cc \
gri_float_to_short.cc \
gri_float_to_uchar.cc \
+ gri_glfsr.cc \
gri_interleaved_short_to_complex.cc \
gri_short_to_float.cc \
gri_uchar_to_float.cc \
@@ -207,6 +209,7 @@
gr_fxpt.h \
gr_fxpt_nco.h \
gr_fxpt_vco.h \
+ gr_glfsr_source_b.h \
gr_head.h \
gr_interleave.h \
gr_interleaved_short_to_complex.h \
@@ -282,6 +285,7 @@
gri_float_to_char.h \
gri_float_to_short.h \
gri_float_to_uchar.h \
+ gri_glfsr.h \
gri_interleaved_short_to_complex.h \
gri_lfsr_15_1_0.h \
gri_lfsr_32k.h \
@@ -343,6 +347,7 @@
gr_float_to_uchar.i \
gr_frequency_modulator_fc.i \
gr_framer_sink_1.i \
+ gr_glfsr_source_b.i \
gr_head.i \
gr_interleave.i \
gr_interleaved_short_to_complex.i \
Modified:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/general.i
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/general.i
2007-03-02 03:57:08 UTC (rev 4684)
+++
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/general.i
2007-03-02 03:57:30 UTC (rev 4685)
@@ -116,6 +116,7 @@
#include <gr_ctcss_squelch_ff.h>
#include <gr_feedforward_agc_cc.h>
#include <gr_bin_statistics_f.h>
+#include <gr_glfsr_source_b.h>
%}
%include "gr_nop.i"
@@ -212,3 +213,4 @@
%include "gr_ctcss_squelch_ff.i"
%include "gr_feedforward_agc_cc.i"
%include "gr_bin_statistics_f.i"
+%include "gr_glfsr_source_b.i"
Modified:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_correlate_access_code_bb.cc
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_correlate_access_code_bb.cc
2007-03-02 03:57:08 UTC (rev 4684)
+++
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_correlate_access_code_bb.cc
2007-03-02 03:57:30 UTC (rev 4685)
@@ -107,7 +107,7 @@
nwrong = gr_count_bits64(wrong_bits);
// test for access code with up to threshold errors
- new_flag = nwrong <= d_threshold;
+ new_flag = (nwrong <= d_threshold);
#if 0
if(new_flag) {
Modified:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_correlate_access_code_bb.h
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_correlate_access_code_bb.h
2007-03-02 03:57:08 UTC (rev 4684)
+++
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_correlate_access_code_bb.h
2007-03-02 03:57:30 UTC (rev 4685)
@@ -63,7 +63,6 @@
// N is the number of bits in the
access code)
unsigned int d_threshold; // how many bits may be wrong in sync
vector
-
protected:
gr_correlate_access_code_bb(const std::string &access_code, int threshold);
Copied:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_glfsr_source_b.cc
(from rev 4683,
gnuradio/trunk/gnuradio-core/src/lib/general/gr_glfsr_source_b.cc)
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_glfsr_source_b.cc
(rev 0)
+++
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_glfsr_source_b.cc
2007-03-02 03:57:30 UTC (rev 4685)
@@ -0,0 +1,84 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 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 2, 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_glfsr_source_b.h>
+#include <gri_glfsr.h>
+#include <gr_io_signature.h>
+#include <stdexcept>
+
+gr_glfsr_source_b_sptr
+gr_make_glfsr_source_b(int degree, bool repeat, int mask, int seed)
+{
+ return gr_glfsr_source_b_sptr(new gr_glfsr_source_b(degree, repeat, mask,
seed));
+}
+
+gr_glfsr_source_b::gr_glfsr_source_b(int degree, bool repeat, int mask, int
seed)
+ : gr_sync_block ("glfsr_source_b",
+ gr_make_io_signature (0, 0, 0),
+ gr_make_io_signature (1, 1, sizeof(unsigned char))),
+ d_repeat(repeat),
+ d_index(0)
+{
+ if (degree < 1 || degree > 32)
+ throw std::runtime_error("gr_glfsr_source_b: degree must be between 1 and
32 inclusive");
+ d_length = (unsigned int)((1ULL << degree)-1);
+
+ if (mask == 0)
+ mask = gri_glfsr::glfsr_mask(degree);
+ d_glfsr = new gri_glfsr(mask, seed);
+}
+
+gr_glfsr_source_b::~gr_glfsr_source_b()
+{
+ delete d_glfsr;
+}
+
+int
+gr_glfsr_source_b::work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items)
+{
+ char *out = (char *) output_items[0];
+ if ((d_index > d_length) && d_repeat == false)
+ return -1; /* once through the sequence */
+
+ int i;
+ for (i = 0; i < noutput_items; i++) {
+ out[i] = d_glfsr->next_bit();
+ d_index++;
+ if (d_index > d_length && d_repeat == false)
+ break;
+ }
+
+ return i;
+}
+
+int
+gr_glfsr_source_b::mask() const
+{
+ return d_glfsr->mask();
+}
Copied:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_glfsr_source_b.h
(from rev 4683,
gnuradio/trunk/gnuradio-core/src/lib/general/gr_glfsr_source_b.h)
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_glfsr_source_b.h
(rev 0)
+++
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_glfsr_source_b.h
2007-03-02 03:57:30 UTC (rev 4685)
@@ -0,0 +1,65 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 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 2, 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_GLFSR_SOURCE_B_H
+#define INCLUDED_GR_GLFSR_SOURCE_B_H
+
+#include <gr_sync_block.h>
+
+class gri_glfsr;
+
+class gr_glfsr_source_b;
+typedef boost::shared_ptr<gr_glfsr_source_b> gr_glfsr_source_b_sptr;
+
+gr_glfsr_source_b_sptr gr_make_glfsr_source_b(int degree, bool repeat=true,
int mask=0, int seed=1);
+
+/*!
+ * \brief Galois LFSR pseudo-random source
+ * \ingroup source
+ */
+class gr_glfsr_source_b : public gr_sync_block
+{
+ private:
+ friend gr_glfsr_source_b_sptr
+ gr_make_glfsr_source_b(int degree, bool repeat, int mask, int seed);
+
+ gri_glfsr *d_glfsr;
+
+ bool d_repeat;
+ unsigned int d_index;
+ unsigned int d_length;
+
+ gr_glfsr_source_b(int degree, bool repeat, int mask, int seed);
+
+ public:
+
+ ~gr_glfsr_source_b();
+
+ int work(int noutput_items,
+ gr_vector_const_void_star &input_items,
+ gr_vector_void_star &output_items);
+
+ unsigned int period() const { return d_length; }
+ int mask() const;
+};
+
+#endif /* INCLUDED_GR_GLFSR_SOURCE_B_H */
Copied:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_glfsr_source_b.i
(from rev 4683,
gnuradio/trunk/gnuradio-core/src/lib/general/gr_glfsr_source_b.i)
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_glfsr_source_b.i
(rev 0)
+++
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gr_glfsr_source_b.i
2007-03-02 03:57:30 UTC (rev 4685)
@@ -0,0 +1,37 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 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 2, 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,glfsr_source_b);
+
+gr_glfsr_source_b_sptr
+gr_make_glfsr_source_b(int degree, bool repeat=true, int mask=0, int seed=1)
+ throw (std::runtime_error);
+
+class gr_glfsr_source_b : public gr_sync_block
+{
+protected:
+ gr_glfsr_source_b(int degree, bool repeat, int mask, int seed);
+
+public:
+ unsigned int period() const;
+ int mask() const;
+};
Copied:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gri_glfsr.cc
(from rev 4683, gnuradio/trunk/gnuradio-core/src/lib/general/gri_glfsr.cc)
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gri_glfsr.cc
(rev 0)
+++
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gri_glfsr.cc
2007-03-02 03:57:30 UTC (rev 4685)
@@ -0,0 +1,67 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 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 2, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include <gri_glfsr.h>
+#include <stdexcept>
+
+static int s_polynomial_masks[] = {
+ 0x00000000,
+ 0x00000001, // x^1 + 1
+ 0x00000003, // x^2 + x^1 + 1
+ 0x00000005, // x^3 + x^1 + 1
+ 0x00000009, // x^4 + x^1 + 1
+ 0x00000012, // x^5 + x^2 + 1
+ 0x00000021, // x^6 + x^1 + 1
+ 0x00000041, // x^7 + x^1 + 1
+ 0x0000008E, // x^8 + x^4 + x^3 + x^2 + 1
+ 0x00000108, // x^9 + x^4 + 1
+ 0x00000204, // x^10 + x^4 + 1
+ 0x00000402, // x^11 + x^2 + 1
+ 0x00000829, // x^12 + x^6 + x^4 + x^1 + 1
+ 0x0000100D, // x^13 + x^4 + x^3 + x^1 + 1
+ 0x00002015, // x^14 + x^5 + x^3 + x^1 + 1
+ 0x00004001, // x^15 + x^1 + 1
+ 0x00008016, // x^16 + x^5 + x^3 + x^2 + 1
+ 0x00010004, // x^17 + x^3 + 1
+ 0x00020013, // x^18 + x^5 + x^2 + x^1 + 1
+ 0x00040013, // x^19 + x^5 + x^2 + x^1 + 1
+ 0x00080004, // x^20 + x^3 + 1
+ 0x00100002, // x^21 + x^2 + 1
+ 0x00200001, // x^22 + x^1 + 1
+ 0x00400010, // x^23 + x^5 + 1
+ 0x0080000D, // x^24 + x^4 + x^3 + x^1 + 1
+ 0x01000004, // x^25 + x^3 + 1
+ 0x02000023, // x^26 + x^6 + x^2 + x^1 + 1
+ 0x04000013, // x^27 + x^5 + x^2 + x^1 + 1
+ 0x08000004, // x^28 + x^3 + 1
+ 0x10000002, // x^29 + x^2 + 1
+ 0x20000029, // x^30 + x^4 + x^1 + 1
+ 0x40000004, // x^31 + x^3 + 1
+ 0x80000057 // x^32 + x^7 + x^5 + x^3 + x^2 + x^1 + 1
+};
+
+int gri_glfsr::glfsr_mask(int degree)
+{
+ if (degree < 1 || degree > 32)
+ throw std::runtime_error("gri_glfsr::glfsr_mask(): degree must be between
1 and 32 inclusive");
+ return s_polynomial_masks[degree];
+}
Copied:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gri_glfsr.h
(from rev 4683, gnuradio/trunk/gnuradio-core/src/lib/general/gri_glfsr.h)
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gri_glfsr.h
(rev 0)
+++
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/general/gri_glfsr.h
2007-03-02 03:57:30 UTC (rev 4685)
@@ -0,0 +1,54 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 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 2, 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_GRI_GLFSR_H
+#define INCLUDED_GRI_GLFSR_H
+
+/*!
+ * \brief Galois Linear Feedback Shift Register using specified polynomial mask
+ *
+ * Generates a maximal length pseudo-random sequence of length 2^degree-1
+ */
+
+class gri_glfsr
+{
+ private:
+ int d_shift_register;
+ int d_mask;
+
+ public:
+
+ gri_glfsr(int mask, int seed) { d_shift_register = seed; d_mask = mask; }
+ static int glfsr_mask(int degree);
+
+ unsigned char next_bit() {
+ unsigned char bit = d_shift_register & 1;
+ d_shift_register >>= 1;
+ if (bit)
+ d_shift_register ^= d_mask;
+ return bit;
+ }
+
+ int mask() const { return d_mask; }
+};
+
+#endif /* INCLUDED_GRI_GLFSR_H */
Modified:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen/gr_sig_source_X.cc.t
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen/gr_sig_source_X.cc.t
2007-03-02 03:57:08 UTC (rev 4684)
+++
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen/gr_sig_source_X.cc.t
2007-03-02 03:57:30 UTC (rev 4685)
@@ -78,6 +78,65 @@
optr[i] += d_offset;
}
break;
+
+ /* Implements a real square wave high from -PI to 0.
+ * The imaginary square wave leads by 90 deg.
+ */
+ case GR_SQR_WAVE:
+ for (int i = 0; i < noutput_items; i++){
+ if (d_nco.get_phase() < -1*M_PI/2)
+ optr[i] = gr_complex(d_ampl, 0)+d_offset;
+ else if (d_nco.get_phase() < 0)
+ optr[i] = gr_complex(d_ampl, d_ampl)+d_offset;
+ else if (d_nco.get_phase() < M_PI/2)
+ optr[i] = gr_complex(0, d_ampl)+d_offset;
+ else
+ optr[i] = d_offset;
+ d_nco.step();
+ }
+ break;
+
+ /* Implements a real triangle wave rising from -PI to 0 and
+ * falling from 0 to PI. The imaginary triangle wave leads by 90 deg.
+ */
+ case GR_TRI_WAVE:
+ for (int i = 0; i < noutput_items; i++){
+ if (d_nco.get_phase() < -1*M_PI/2){
+ optr[i] = gr_complex(d_ampl*d_nco.get_phase()/M_PI + d_ampl,
+ -1*d_ampl*d_nco.get_phase()/M_PI - d_ampl/2)+d_offset;
+ }
+ else if (d_nco.get_phase() < 0){
+ optr[i] = gr_complex(d_ampl*d_nco.get_phase()/M_PI + d_ampl,
+ d_ampl*d_nco.get_phase()/M_PI + d_ampl/2)+d_offset;
+ }
+ else if (d_nco.get_phase() < M_PI/2){
+ optr[i] = gr_complex(-1*d_ampl*d_nco.get_phase()/M_PI + d_ampl,
+ d_ampl*d_nco.get_phase()/M_PI + d_ampl/2)+d_offset;
+ }
+ else{
+ optr[i] = gr_complex(-1*d_ampl*d_nco.get_phase()/M_PI + d_ampl,
+ -1*d_ampl*d_nco.get_phase()/M_PI + 3*d_ampl/2)+d_offset;
+ }
+ d_nco.step();
+ }
+ break;
+
+ /* Implements a real saw tooth wave rising from -PI to PI.
+ * The imaginary saw tooth wave leads by 90 deg.
+ */
+ case GR_SAW_WAVE:
+ for (int i = 0; i < noutput_items; i++){
+ if (d_nco.get_phase() < -1*M_PI/2){
+ optr[i] = gr_complex(d_ampl*d_nco.get_phase()/(2*M_PI) + d_ampl/2,
+ d_ampl*d_nco.get_phase()/(2*M_PI) + 5*d_ampl/4)+d_offset;
+ }
+ else{
+ optr[i] = gr_complex(d_ampl*d_nco.get_phase()/(2*M_PI) + d_ampl/2,
+ d_ampl*d_nco.get_phase()/(2*M_PI) + d_ampl/4)+d_offset;
+ }
+ d_nco.step();
+ }
+ break;
#else // nope...
@@ -106,6 +165,40 @@
optr[i] += d_offset;
}
break;
+
+ /* The square wave is high from -PI to 0. */
+ case GR_SQR_WAVE:
+ t = (@TYPE@) d_ampl + d_offset;
+ for (int i = 0; i < noutput_items; i++){
+ if (d_nco.get_phase() < 0)
+ optr[i] = t;
+ else
+ optr[i] = d_offset;
+ d_nco.step();
+ }
+ break;
+
+ /* The triangle wave rises from -PI to 0 and falls from 0 to PI. */
+ case GR_TRI_WAVE:
+ for (int i = 0; i < noutput_items; i++){
+ t = (@TYPE@) d_ampl*d_nco.get_phase()/M_PI;
+ if (d_nco.get_phase() < 0)
+ optr[i] = t + d_ampl + d_offset;
+ else
+ optr[i] = -1*t + d_ampl + d_offset;
+ d_nco.step();
+ }
+ break;
+
+ /* The saw tooth wave rises from -PI to PI. */
+ case GR_SAW_WAVE:
+ for (int i = 0; i < noutput_items; i++){
+ t = (@TYPE@) d_ampl*d_nco.get_phase()/(2*M_PI) + d_ampl/2 + d_offset;
+ optr[i] = t;
+ d_nco.step();
+ }
+ break;
+
#endif
default:
Modified:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen/gr_sig_source_waveform.h
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen/gr_sig_source_waveform.h
2007-03-02 03:57:08 UTC (rev 4684)
+++
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/gengen/gr_sig_source_waveform.h
2007-03-02 03:57:30 UTC (rev 4685)
@@ -23,7 +23,7 @@
#define INCLUDED_GR_SIG_SOURCE_WAVEFORM_H
typedef enum {
- GR_CONST_WAVE = 100, GR_SIN_WAVE, GR_COS_WAVE
+ GR_CONST_WAVE = 100, GR_SIN_WAVE, GR_COS_WAVE, GR_SQR_WAVE, GR_TRI_WAVE,
GR_SAW_WAVE
} gr_waveform_t;
#endif /* INCLUDED_GR_SIG_SOURCE_WAVEFORM_H */
Modified:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/runtime/gr_io_signature.cc
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/runtime/gr_io_signature.cc
2007-03-02 03:57:08 UTC (rev 4684)
+++
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/runtime/gr_io_signature.cc
2007-03-02 03:57:30 UTC (rev 4685)
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004,2007 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -27,28 +27,86 @@
#include <stdexcept>
#include <iostream>
-gr_io_signature::gr_io_signature (int min_streams, int max_streams, size_t
sizeof_stream_item)
+gr_io_signature_sptr
+gr_make_io_signaturev(int min_streams, int max_streams,
+ const std::vector<int> &sizeof_stream_items)
{
+ return gr_io_signature_sptr (new gr_io_signature (min_streams, max_streams,
+ sizeof_stream_items));
+}
+
+gr_io_signature_sptr
+gr_make_io_signature(int min_streams, int max_streams,
+ int sizeof_stream_item)
+{
+ std::vector<int> sizeof_items(1);
+ sizeof_items[0] = sizeof_stream_item;
+ return gr_make_io_signaturev(min_streams, max_streams, sizeof_items);
+}
+
+gr_io_signature_sptr
+gr_make_io_signature2(int min_streams, int max_streams,
+ int sizeof_stream_item1,
+ int sizeof_stream_item2)
+{
+ std::vector<int> sizeof_items(2);
+ sizeof_items[0] = sizeof_stream_item1;
+ sizeof_items[1] = sizeof_stream_item2;
+ return gr_make_io_signaturev(min_streams, max_streams, sizeof_items);
+}
+
+gr_io_signature_sptr
+gr_make_io_signature3(int min_streams, int max_streams,
+ int sizeof_stream_item1,
+ int sizeof_stream_item2,
+ int sizeof_stream_item3)
+{
+ std::vector<int> sizeof_items(3);
+ sizeof_items[0] = sizeof_stream_item1;
+ sizeof_items[1] = sizeof_stream_item2;
+ sizeof_items[2] = sizeof_stream_item3;
+ return gr_make_io_signaturev(min_streams, max_streams, sizeof_items);
+}
+
+// ------------------------------------------------------------------------
+
+
+gr_io_signature::gr_io_signature (int min_streams, int max_streams,
+ const std::vector<int> &sizeof_stream_items)
+{
if (min_streams < 0
|| (max_streams != IO_INFINITE && max_streams < min_streams))
- throw std::invalid_argument ("gr_io_signature");
+ throw std::invalid_argument ("gr_io_signature(1)");
+ if (sizeof_stream_items.size() < 1)
+ throw std::invalid_argument("gr_io_signature(2)");
+
+ for (size_t i = 0; i < sizeof_stream_items.size(); i++){
+ if (max_streams != 0 && sizeof_stream_items[i] < 1)
+ throw std::invalid_argument("gr_io_signature(3)");
+ }
+
d_min_streams = min_streams;
d_max_streams = max_streams;
- d_sizeof_stream_item = sizeof_stream_item;
+ d_sizeof_stream_item = sizeof_stream_items;
}
gr_io_signature::~gr_io_signature ()
{
- // NOP for now
- // std::cout << "destroying gr_io_signature: " << this << '\n';
}
-gr_io_signature_sptr
-gr_make_io_signature (int min_streams, int max_streams, size_t
sizeof_stream_item)
+int
+gr_io_signature::sizeof_stream_item (int _index) const
{
- return gr_io_signature_sptr (new gr_io_signature (min_streams, max_streams,
- sizeof_stream_item));
+ if (_index < 0)
+ throw std::invalid_argument ("gr_io_signature::sizeof_stream_item");
+
+ size_t index = _index;
+ return d_sizeof_stream_item[std::min(index, d_sizeof_stream_item.size() -
1)];
}
-
+std::vector<int>
+gr_io_signature::sizeof_stream_items() const
+{
+ return d_sizeof_stream_item;
+}
Modified:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/runtime/gr_io_signature.h
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/runtime/gr_io_signature.h
2007-03-02 03:57:08 UTC (rev 4684)
+++
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/runtime/gr_io_signature.h
2007-03-02 03:57:30 UTC (rev 4685)
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004 Free Software Foundation, Inc.
+ * Copyright 2004,2007 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -26,13 +26,78 @@
#include <gr_runtime_types.h>
/*!
- * \brief i/o signature for input and output ports.
+ * \brief Create an i/o signature
*
- * For now, we restrict all streams to be the same type.
- * We can fix this later.
+ * \param min_streams specify minimum number of streams (>= 0)
+ * \param max_streams specify maximum number of streams (>= min_streams or -1
-> infinite)
+ * \param sizeof_stream_item specify the size of the items in each stream
*/
-
+gr_io_signature_sptr
+gr_make_io_signature(int min_streams, int max_streams,
+ int sizeof_stream_item);
+
+/*!
+ * \brief Create an i/o signature
+ *
+ * \param min_streams specify minimum number of streams (>= 0)
+ * \param max_streams specify maximum number of streams (>= min_streams or -1
-> infinite)
+ * \param sizeof_stream_item1 specify the size of the items in the first stream
+ * \param sizeof_stream_item2 specify the size of the items in the second and
subsequent streams
+ */
+gr_io_signature_sptr
+gr_make_io_signature2(int min_streams, int max_streams,
+ int sizeof_stream_item1,
+ int sizeof_stream_item2
+ );
+
+/*!
+ * \brief Create an i/o signature
+ *
+ * \param min_streams specify minimum number of streams (>= 0)
+ * \param max_streams specify maximum number of streams (>= min_streams or -1
-> infinite)
+ * \param sizeof_stream_item1 specify the size of the items in the first stream
+ * \param sizeof_stream_item2 specify the size of the items in the second
stream
+ * \param sizeof_stream_item3 specify the size of the items in the third and
subsequent streams
+ */
+gr_io_signature_sptr
+gr_make_io_signature3(int min_streams, int max_streams,
+ int sizeof_stream_item1,
+ int sizeof_stream_item2,
+ int sizeof_stream_item3
+ );
+
+/*!
+ * \brief Create an i/o signature
+ *
+ * \param min_streams specify minimum number of streams (>= 0)
+ * \param max_streams specify maximum number of streams (>= min_streams or -1
-> infinite)
+ * \param sizeof_stream_items specify the size of the items in the streams
+ *
+ * If there are more streams than there are entries in sizeof_stream_items, the
+ * value of the last entry in sizeof_stream_items is used for the missing
values.
+ * sizeof_stream_items must contain at least 1 entry.
+ */
+gr_io_signature_sptr
+gr_make_io_signaturev(int min_streams, int max_streams,
+ const std::vector<int> &sizeof_stream_items);
+
+
+/*!
+ * \brief i/o signature for input and output ports.
+ */
class gr_io_signature {
+ int d_min_streams;
+ int d_max_streams;
+ std::vector<int> d_sizeof_stream_item;
+
+ gr_io_signature(int min_streams, int max_streams,
+ const std::vector<int> &sizeof_stream_items);
+
+ friend gr_io_signature_sptr
+ gr_make_io_signaturev(int min_streams,
+ int max_streams,
+ const std::vector<int> &sizeof_stream_item);
+
public:
static const int IO_INFINITE = -1;
@@ -41,25 +106,9 @@
int min_streams () const { return d_min_streams; }
int max_streams () const { return d_max_streams; }
- size_t sizeof_stream_item (int index) const { return d_sizeof_stream_item; }
-
- //
----------------------------------------------------------------------------
-
- private:
-
- int d_min_streams;
- int d_max_streams;
- size_t d_sizeof_stream_item;
-
- gr_io_signature (int min_streams, int max_streams, size_t
sizeof_stream_item);
-
- friend gr_io_signature_sptr gr_make_io_signature (int min_streams,
- int max_streams,
- size_t sizeof_stream_item);
+ int sizeof_stream_item (int index) const;
+ std::vector<int> sizeof_stream_items() const;
};
-gr_io_signature_sptr
-gr_make_io_signature (int min_streams, int max_streams, size_t
sizeof_stream_item);
-
#endif /* INCLUDED_IO_SIGNATURE_H */
Modified:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/runtime/gr_io_signature.i
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/runtime/gr_io_signature.i
2007-03-02 03:57:08 UTC (rev 4684)
+++
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/runtime/gr_io_signature.i
2007-03-02 03:57:30 UTC (rev 4685)
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2004,2005 Free Software Foundation, Inc.
+ * Copyright 2004,2005,2007 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -24,14 +24,40 @@
typedef boost::shared_ptr<gr_io_signature> gr_io_signature_sptr;
%template(gr_io_signature_sptr) boost::shared_ptr<gr_io_signature>;
-%rename(io_signature) gr_make_io_signature;
+%rename(io_signature) gr_make_io_signature;
+%rename(io_signature2) gr_make_io_signature2;
+%rename(io_signature3) gr_make_io_signature3;
+%rename(io_signaturev) gr_make_io_signaturev;
+
gr_io_signature_sptr
-gr_make_io_signature (int min_streams,
- int max_streams,
- size_t sizeof_stream_item);
+gr_make_io_signature(int min_streams, int max_streams,
+ int sizeof_stream_item);
+gr_io_signature_sptr
+gr_make_io_signature2(int min_streams, int max_streams,
+ int sizeof_stream_item1,
+ int sizeof_stream_item2
+ );
+gr_io_signature_sptr
+gr_make_io_signature3(int min_streams, int max_streams,
+ int sizeof_stream_item1,
+ int sizeof_stream_item2,
+ int sizeof_stream_item3
+ );
+gr_io_signature_sptr
+gr_make_io_signaturev(int min_streams, int max_streams,
+ const std::vector<int> &sizeof_stream_items);
+
+
class gr_io_signature {
+ gr_io_signature (int min_streams, int max_streams, int sizeof_stream_item);
+
+ friend gr_io_signature_sptr
+ gr_make_io_signaturev(int min_streams,
+ int max_streams,
+ const std::vector<int> &sizeof_stream_item);
+
public:
// disabled. Suspected bug in SWIG 1.3.24
@@ -41,9 +67,7 @@
int min_streams () const { return d_min_streams; }
int max_streams () const { return d_max_streams; }
- size_t sizeof_stream_item (int index) const { return d_sizeof_stream_item; }
-
- private:
- gr_io_signature (int min_streams, int max_streams, size_t
sizeof_stream_item);
+ int sizeof_stream_item (int index) const;
+ std::vector<int> sizeof_stream_items() const;
};
Modified:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/runtime/qa_gr_block.cc
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/runtime/qa_gr_block.cc
2007-03-02 03:57:08 UTC (rev 4684)
+++
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/runtime/qa_gr_block.cc
2007-03-02 03:57:30 UTC (rev 4685)
@@ -42,7 +42,7 @@
CPPUNIT_ASSERT_EQUAL (0, src1->input_signature()->max_streams ());
CPPUNIT_ASSERT_EQUAL (1, src1->output_signature()->min_streams ());
CPPUNIT_ASSERT_EQUAL (1, src1->output_signature()->max_streams ());
- CPPUNIT_ASSERT_EQUAL (sizeof (int),
+ CPPUNIT_ASSERT_EQUAL ((int) sizeof(int),
src1->output_signature()->sizeof_stream_item (0));
gr_block_sptr src2 (gr_make_null_source (sizeof (short)));
@@ -50,7 +50,7 @@
CPPUNIT_ASSERT_EQUAL (0, src2->input_signature()->max_streams ());
CPPUNIT_ASSERT_EQUAL (1, src2->output_signature()->min_streams ());
CPPUNIT_ASSERT_EQUAL (1, src2->output_signature()->max_streams ());
- CPPUNIT_ASSERT_EQUAL (sizeof (short),
+ CPPUNIT_ASSERT_EQUAL ((int) sizeof (short),
src2->output_signature()->sizeof_stream_item (0));
}
@@ -63,7 +63,7 @@
CPPUNIT_ASSERT_EQUAL (std::string ("null_sink"), dst1->name ());
CPPUNIT_ASSERT_EQUAL (1, dst1->input_signature()->min_streams ());
CPPUNIT_ASSERT_EQUAL (1, dst1->input_signature()->max_streams ());
- CPPUNIT_ASSERT_EQUAL (sizeof (int),
+ CPPUNIT_ASSERT_EQUAL ((int) sizeof (int),
dst1->input_signature()->sizeof_stream_item (0));
CPPUNIT_ASSERT_EQUAL (0, dst1->output_signature()->max_streams ());
@@ -72,7 +72,7 @@
CPPUNIT_ASSERT_EQUAL (std::string ("null_sink"), dst2->name ());
CPPUNIT_ASSERT_EQUAL (1, dst2->input_signature()->min_streams ());
CPPUNIT_ASSERT_EQUAL (1, dst2->input_signature()->max_streams ());
- CPPUNIT_ASSERT_EQUAL (sizeof (short),
+ CPPUNIT_ASSERT_EQUAL ((int) sizeof (short),
dst2->input_signature()->sizeof_stream_item (0));
CPPUNIT_ASSERT_EQUAL (0, dst2->output_signature()->max_streams ());
}
Modified:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/runtime/qa_gr_hier_block2.cc
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/runtime/qa_gr_hier_block2.cc
2007-03-02 03:57:08 UTC (rev 4684)
+++
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/runtime/qa_gr_hier_block2.cc
2007-03-02 03:57:30 UTC (rev 4685)
@@ -41,6 +41,6 @@
CPPUNIT_ASSERT_EQUAL(1, src1->input_signature()->max_streams());
CPPUNIT_ASSERT_EQUAL(1, src1->output_signature()->min_streams());
CPPUNIT_ASSERT_EQUAL(1, src1->output_signature()->max_streams());
- CPPUNIT_ASSERT_EQUAL(sizeof(int),
+ CPPUNIT_ASSERT_EQUAL((int) sizeof(int),
src1->output_signature()->sizeof_stream_item(0));
}
Modified:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/runtime/qa_gr_io_signature.cc
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/runtime/qa_gr_io_signature.cc
2007-03-02 03:57:08 UTC (rev 4684)
+++
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/runtime/qa_gr_io_signature.cc
2007-03-02 03:57:30 UTC (rev 4685)
@@ -45,11 +45,20 @@
gr_make_io_signature (3, gr_io_signature::IO_INFINITE, sizeof (int));
CPPUNIT_ASSERT_EQUAL (p->min_streams (), 3);
- CPPUNIT_ASSERT_EQUAL (p->sizeof_stream_item (0), sizeof (int));
+ CPPUNIT_ASSERT_EQUAL (p->sizeof_stream_item (0), (int) sizeof (int));
}
void
qa_gr_io_signature::t3 ()
{
+ gr_io_signature_sptr p =
+ gr_make_io_signature3 (0, 5, 1, 2, 3);
+
+ CPPUNIT_ASSERT_EQUAL (p->min_streams (), 0);
+ CPPUNIT_ASSERT_EQUAL (p->max_streams (), 5);
+ CPPUNIT_ASSERT_EQUAL (p->sizeof_stream_item(0), 1);
+ CPPUNIT_ASSERT_EQUAL (p->sizeof_stream_item(1), 2);
+ CPPUNIT_ASSERT_EQUAL (p->sizeof_stream_item(2), 3);
+ CPPUNIT_ASSERT_EQUAL (p->sizeof_stream_item(3), 3);
+ CPPUNIT_ASSERT_EQUAL (p->sizeof_stream_item(4), 3);
}
-
Modified:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/runtime/qa_gr_io_signature.h
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/runtime/qa_gr_io_signature.h
2007-03-02 03:57:08 UTC (rev 4684)
+++
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/runtime/qa_gr_io_signature.h
2007-03-02 03:57:30 UTC (rev 4685)
@@ -41,7 +41,6 @@
void t1 ();
void t2 ();
void t3 ();
-
};
#endif /* INCLUDED_QA_GR_IO_SIGNATURE_H */
Modified:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/swig/Makefile.am
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/swig/Makefile.am
2007-03-02 03:57:08 UTC (rev 4684)
+++
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/lib/swig/Makefile.am
2007-03-02 03:57:30 UTC (rev 4685)
@@ -118,8 +118,7 @@
_gnuradio_swig_py_runtime_la_LIBADD = \
- $(GNURADIO_CORE_LIBS) \
- $(top_builddir)/gnuradio-core/src/lib/libgnuradio-core.la \
+ $(GNURADIO_CORE_LA) \
$(PYTHON_LDFLAGS) \
-lstdc++
@@ -150,8 +149,7 @@
_gnuradio_swig_py_general_la_LIBADD = \
- $(GNURADIO_CORE_LIBS) \
- $(top_builddir)/gnuradio-core/src/lib/libgnuradio-core.la \
+ $(GNURADIO_CORE_LA) \
$(PYTHON_LDFLAGS) \
-lstdc++
@@ -182,8 +180,7 @@
_gnuradio_swig_py_gengen_la_LIBADD = \
- $(GNURADIO_CORE_LIBS) \
- $(top_builddir)/gnuradio-core/src/lib/libgnuradio-core.la \
+ $(GNURADIO_CORE_LA) \
$(PYTHON_LDFLAGS) \
-lstdc++
@@ -214,8 +211,7 @@
_gnuradio_swig_py_filter_la_LIBADD = \
- $(GNURADIO_CORE_LIBS) \
- $(top_builddir)/gnuradio-core/src/lib/libgnuradio-core.la \
+ $(GNURADIO_CORE_LA) \
$(PYTHON_LDFLAGS) \
-lstdc++
@@ -246,8 +242,7 @@
_gnuradio_swig_py_io_la_LIBADD = \
- $(GNURADIO_CORE_LIBS) \
- $(top_builddir)/gnuradio-core/src/lib/libgnuradio-core.la \
+ $(GNURADIO_CORE_LA) \
$(PYTHON_LDFLAGS) \
-lstdc++
Copied:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/python/gnuradio/gr/qa_glfsr_source_b.py
(from rev 4683,
gnuradio/trunk/gnuradio-core/src/python/gnuradio/gr/qa_glfsr_source_b.py)
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/python/gnuradio/gr/qa_glfsr_source_b.py
(rev 0)
+++
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/python/gnuradio/gr/qa_glfsr_source_b.py
2007-03-02 03:57:30 UTC (rev 4685)
@@ -0,0 +1,67 @@
+#!/usr/bin/env python
+#
+# Copyright 2007 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 2, 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
+
+class test_glfsr_source_b(gr_unittest.TestCase):
+
+ def setUp (self):
+ self.fg = gr.flow_graph ()
+
+ def tearDown (self):
+ self.fg = None
+
+ def test_000_make(self):
+ src = gr.glfsr_source_b(16)
+ self.assertEquals(src.mask(), 0x8016)
+ self.assertEquals(src.period(), 2**16-1)
+
+ def test_001_degree(self):
+ self.assertRaises(RuntimeError,
+ lambda: gr.glfsr_source_b(0))
+ self.assertRaises(RuntimeError,
+ lambda: gr.glfsr_source_b(33))
+
+ def test_002_correlation(self):
+ for degree in range(1,11): # Higher degrees take too
long to correlate
+ src = gr.glfsr_source_b(degree, False)
+ b2f = gr.chunks_to_symbols_bf((-1.0,1.0), 1)
+ dst = gr.vector_sink_f()
+ self.fg.connect(src, b2f, dst)
+ self.fg.run()
+
+ actual_result = dst.data()
+ R = auto_correlate(actual_result)
+ self.assertEqual(R[0], float(len(R))) # Auto-correlation peak at
origin
+ for i in range(len(R)-1):
+ self.assertEqual(R[i+1], -1.0) # Auto-correlation minimum
everywhere else
+
+def auto_correlate(data):
+ l = len(data)
+ R = [0,]*l
+ for lag in range(l):
+ for i in range(l):
+ R[lag] += data[i]*data[i-lag]
+ return R
+
+if __name__ == '__main__':
+ gr_unittest.main ()
Modified:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/python/gnuradio/gr/qa_sig_source.py
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/python/gnuradio/gr/qa_sig_source.py
2007-03-02 03:57:08 UTC (rev 4684)
+++
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/python/gnuradio/gr/qa_sig_source.py
2007-03-02 03:57:30 UTC (rev 4685)
@@ -80,6 +80,78 @@
fg.run ()
dst_data = dst1.data ()
self.assertFloatTuplesAlmostEqual (expected_result, dst_data, 5)
+
+ def test_sqr_c (self):
+ fg = self.fg #arg6 is a bit
before -PI/2
+ expected_result = (1j, 1j, 0, 0, 1, 1, 1+0j, 1+1j, 1j)
+ src1 = gr.sig_source_c (8, gr.GR_SQR_WAVE, 1.0, 1.0)
+ op = gr.head (gr.sizeof_gr_complex, 9)
+ dst1 = gr.vector_sink_c ()
+ fg.connect (src1, op)
+ fg.connect (op, dst1)
+ fg.run ()
+ dst_data = dst1.data ()
+ self.assertEqual (expected_result, dst_data)
+
+ def test_tri_c (self):
+ fg = self.fg
+ expected_result = (1+.5j, .75+.75j, .5+1j, .25+.75j, 0+.5j, .25+.25j,
.5+0j, .75+.25j, 1+.5j)
+ src1 = gr.sig_source_c (8, gr.GR_TRI_WAVE, 1.0, 1.0)
+ op = gr.head (gr.sizeof_gr_complex, 9)
+ dst1 = gr.vector_sink_c ()
+ fg.connect (src1, op)
+ fg.connect (op, dst1)
+ fg.run ()
+ dst_data = dst1.data ()
+ self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 5)
+
+ def test_saw_c (self):
+ fg = self.fg
+ expected_result = (.5+.25j, .625+.375j, .75+.5j, .875+.625j, 0+.75j,
.125+.875j, .25+1j, .375+.125j, .5+.25j)
+ src1 = gr.sig_source_c (8, gr.GR_SAW_WAVE, 1.0, 1.0)
+ op = gr.head (gr.sizeof_gr_complex, 9)
+ dst1 = gr.vector_sink_c ()
+ fg.connect (src1, op)
+ fg.connect (op, dst1)
+ fg.run ()
+ dst_data = dst1.data ()
+ self.assertComplexTuplesAlmostEqual (expected_result, dst_data, 5)
+
+ def test_sqr_f (self):
+ fg = self.fg
+ expected_result = (0, 0, 0, 0, 1, 1, 1, 1, 0)
+ src1 = gr.sig_source_f (8, gr.GR_SQR_WAVE, 1.0, 1.0)
+ op = gr.head (gr.sizeof_float, 9)
+ dst1 = gr.vector_sink_f ()
+ fg.connect (src1, op)
+ fg.connect (op, dst1)
+ fg.run ()
+ dst_data = dst1.data ()
+ self.assertEqual (expected_result, dst_data)
+
+ def test_tri_f (self):
+ fg = self.fg
+ expected_result = (1, .75, .5, .25, 0, .25, .5, .75, 1)
+ src1 = gr.sig_source_f (8, gr.GR_TRI_WAVE, 1.0, 1.0)
+ op = gr.head (gr.sizeof_float, 9)
+ dst1 = gr.vector_sink_f ()
+ fg.connect (src1, op)
+ fg.connect (op, dst1)
+ fg.run ()
+ dst_data = dst1.data ()
+ self.assertFloatTuplesAlmostEqual (expected_result, dst_data, 5)
+
+ def test_saw_f (self):
+ fg = self.fg
+ expected_result = (.5, .625, .75, .875, 0, .125, .25, .375, .5)
+ src1 = gr.sig_source_f (8, gr.GR_SAW_WAVE, 1.0, 1.0)
+ op = gr.head (gr.sizeof_float, 9)
+ dst1 = gr.vector_sink_f ()
+ fg.connect (src1, op)
+ fg.connect (op, dst1)
+ fg.run ()
+ dst_data = dst1.data ()
+ self.assertFloatTuplesAlmostEqual (expected_result, dst_data, 5)
if __name__ == '__main__':
gr_unittest.main ()
Modified:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/tests/Makefile.am
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/tests/Makefile.am
2007-03-02 03:57:08 UTC (rev 4684)
+++ gnuradio/branches/developers/n4hy/ofdm/gnuradio-core/src/tests/Makefile.am
2007-03-02 03:57:30 UTC (rev 4685)
@@ -33,7 +33,7 @@
#Test program to test setting up buffers using gr_test which can be run
manually
EXTRA_DIST = \
test_buffers.py
-
+
noinst_PROGRAMS = \
benchmark_dotprod \
benchmark_dotprod_fsf \
@@ -50,7 +50,7 @@
test_vmcircbuf
-LIBGNURADIO = $(top_builddir)/gnuradio-core/src/lib/libgnuradio-core.la
+LIBGNURADIO = $(GNURADIO_CORE_LA)
LIBGNURADIOQA = $(top_builddir)/gnuradio-core/src/lib/libgnuradio-core-qa.la
$(LIBGNURADIO)
benchmark_dotprod_SOURCES = benchmark_dotprod.cc
Modified:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/c++/dial_tone/Makefile.am
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/c++/dial_tone/Makefile.am
2007-03-02 03:57:08 UTC (rev 4684)
+++
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/c++/dial_tone/Makefile.am
2007-03-02 03:57:30 UTC (rev 4685)
@@ -25,12 +25,9 @@
INCLUDES=$(STD_DEFINES_AND_INCLUDES) \
-I$(top_srcdir)/gr-audio-alsa/src
-GR_AUDIO_ALSA_LIBS=$(top_builddir)/gr-audio-alsa/src/libgr_audio_alsa.la
+GR_AUDIO_ALSA_LA=$(top_builddir)/gr-audio-alsa/src/libgr_audio_alsa.la
-# For compiling outside the tree, these are the usual
-# INCLUDES = -I/usr/local/include -I/usr/local/include/gnuradio
-# GNURADIO_CORE_LIBS = -lgnuradio-core
-# GR_AUDIO_ALSA_LIBS = -lgr_audio_alsa
+# For compiling outside the tree, these will get fished out by pkgconfig
noinst_PROGRAMS = dial_tone
@@ -42,7 +39,7 @@
main.cc
dial_tone_LDADD = \
- $(GNURADIO_CORE_LIBS) \
+ $(GNURADIO_CORE_LA) \
$(GR_AUDIO_ALSA_LIBS)
MOSTLYCLEANFILES = *~
Modified:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/audio/Makefile.am
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/audio/Makefile.am
2007-03-02 03:57:08 UTC (rev 4684)
+++
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/audio/Makefile.am
2007-03-02 03:57:30 UTC (rev 4685)
@@ -29,5 +29,6 @@
dialtone_v.py \
mono_tone.py \
multi_tone.py \
+ noise.py \
spectrum_inversion.py \
test_resampler.py
Copied:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/audio/noise.py
(from rev 4683, gnuradio/trunk/gnuradio-examples/python/audio/noise.py)
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/audio/noise.py
(rev 0)
+++
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/audio/noise.py
2007-03-02 03:57:30 UTC (rev 4685)
@@ -0,0 +1,55 @@
+#!/usr/bin/env python
+#
+# Copyright 2007 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 2, 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
+from gnuradio import audio
+from gnuradio.eng_option import eng_option
+from optparse import OptionParser
+
+class my_graph(gr.flow_graph):
+
+ def __init__(self):
+ gr.flow_graph.__init__(self)
+
+ parser = OptionParser(option_class=eng_option)
+ parser.add_option("-O", "--audio-output", type="string", default="",
+ help="pcm output device name. E.g., hw:0,0 or
/dev/dsp")
+ parser.add_option("-r", "--sample-rate", type="eng_float",
default=48000,
+ help="set sample rate to RATE (48000)")
+ (options, args) = parser.parse_args ()
+ if len(args) != 0:
+ parser.print_help()
+ raise SystemExit, 1
+
+ sample_rate = int(options.sample_rate)
+ ampl = 0.1
+
+ src = gr.glfsr_source_b(32) # Pseudorandom noise source
+ b2f = gr.chunks_to_symbols_bf([ampl, -ampl], 1)
+ dst = audio.sink(sample_rate, options.audio_output)
+ self.connect(src, b2f, dst)
+
+if __name__ == '__main__':
+ try:
+ my_graph().run()
+ except KeyboardInterrupt:
+ pass
Modified:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/Makefile.am
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/Makefile.am
2007-03-02 03:57:08 UTC (rev 4684)
+++
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/Makefile.am
2007-03-02 03:57:30 UTC (rev 4685)
@@ -21,4 +21,7 @@
SUBDIRS = \
audio \
- ofdm
+ ofdm \
+ networking \
+ sounder \
+ usrp
Property changes on:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/networking
___________________________________________________________________
Name: svn:ignore
+ Makefile
Makefile.in
Copied:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/networking/Makefile.am
(from rev 4683,
gnuradio/trunk/gnuradio-examples/python/hier/networking/Makefile.am)
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/networking/Makefile.am
(rev 0)
+++
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/networking/Makefile.am
2007-03-02 03:57:30 UTC (rev 4685)
@@ -0,0 +1,30 @@
+#
+# Copyright 2007 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 2, 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.
+#
+
+EXTRA_DIST = \
+ audio_sink.py \
+ audio_source.py \
+ dial_tone_sink.py \
+ dial_tone_source.py \
+ vector_sink.py \
+ vector_source.py
+
+MOSTLYCLEANFILES = *.pyc *~
Copied:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder
(from rev 4683, gnuradio/trunk/gnuradio-examples/python/hier/sounder)
Property changes on:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder
___________________________________________________________________
Name: svn:ignore
+ Makefile
Makefile.in
*.pyc
Deleted:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/Makefile.am
Copied:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/Makefile.am
(from rev 4683,
gnuradio/trunk/gnuradio-examples/python/hier/sounder/Makefile.am)
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/Makefile.am
(rev 0)
+++
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/Makefile.am
2007-03-02 03:57:30 UTC (rev 4685)
@@ -0,0 +1,30 @@
+#
+# Copyright 2007 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 2, 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.
+#
+
+EXTRA_DIST = \
+ usrp_sounder_rx.py \
+ usrp_sounder_tx.py \
+ usrp_source.py \
+ usrp_sink.py \
+ sounder_rx.py \
+ sounder_tx.py
+
+MOSTLYCLEANFILES = *.pyc *~
Deleted:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/sounder_rx.py
Copied:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/sounder_rx.py
(from rev 4683,
gnuradio/trunk/gnuradio-examples/python/hier/sounder/sounder_rx.py)
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/sounder_rx.py
(rev 0)
+++
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/sounder_rx.py
2007-03-02 03:57:30 UTC (rev 4685)
@@ -0,0 +1,78 @@
+#!/usr/bin/env python
+#
+# Copyright 2007 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 2, 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, usrp, eng_notation
+from usrp_source import usrp_source_c
+import math
+
+n2s = eng_notation.num_to_str
+
+class sounder_rx(gr.hier_block2):
+ """
+ Creates a top-level channel sounder block with the given parameters.
+ """
+
+ def __init__(self, subdev_spec, freq, cal, verbose, max_delay, chip_rate,
gain):
+
+ # Call hierarchical block constructor
+ # Top-level blocks have no inputs or outputs
+ gr.hier_block2.__init__(self,
+ "sounder_rx", # Block typename
+ gr.io_signature(0,0,0), # Input signature
+ gr.io_signature(0,0,0)) # Output signature
+ self._freq = freq
+ self._cal = cal
+ self._verbose = verbose
+ self._max_delay = max_delay
+
+ self._u = usrp_source_c(0, subdev_spec, gain, chip_rate, self._freq,
self._cal, verbose)
+ self.define_component("usrp", self._u)
+
+ self._chip_rate = self._u._if_rate
+ self._resolution = 1.0/self._chip_rate
+
+ min_chips = int(math.ceil(2.0*self._max_delay * self._chip_rate))
+ degree = int(math.ceil(math.log(min_chips)/math.log(2)))
+ self._length = 2**degree-1
+ self._seq_per_sec = self._chip_rate/self._length
+ self._tap = 0.0001
+
+ if self._verbose:
+ print "Actual chip rate is", n2s(self._chip_rate), "chips/sec"
+ print "Resolution is", n2s(self._resolution), "sec"
+ print "Using specified maximum delay spread of", self._max_delay,
"sec"
+ print "Mininum sequence length needed is", n2s(min_chips), "chips"
+ print "Using PN sequence of degree", degree, "length", self._length
+ print "Sequences per second is", self._seq_per_sec
+ print "IIR tap is", self._tap
+
+ self.define_component("s2v", gr.stream_to_vector(gr.sizeof_gr_complex,
self._length))
+ self.define_component("fft", gr.fft_vcc(self._length, True, ())) # No
window needed
+ self.define_component("avg", gr.single_pole_iir_filter_cc(self._tap,
self._length))
+ self.define_component("keep",
gr.keep_one_in_n(gr.sizeof_gr_complex*self._length, int(self._seq_per_sec)))
+ self.define_component("sink",
gr.file_sink(gr.sizeof_gr_complex*self._length, "FFT.dat"))
+
+ self.connect("usrp", 0, "s2v", 0)
+ self.connect("s2v", 0, "fft", 0)
+ self.connect("fft", 0, "avg", 0)
+ self.connect("avg", 0, "keep", 0)
+ self.connect("keep", 0, "sink", 0)
Deleted:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/sounder_tx.py
Copied:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/sounder_tx.py
(from rev 4683,
gnuradio/trunk/gnuradio-examples/python/hier/sounder/sounder_tx.py)
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/sounder_tx.py
(rev 0)
+++
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/sounder_tx.py
2007-03-02 03:57:30 UTC (rev 4685)
@@ -0,0 +1,70 @@
+#!/usr/bin/env python
+#
+# Copyright 2007 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 2, 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, usrp, eng_notation
+from usrp_sink import usrp_sink_c
+import math
+
+n2s = eng_notation.num_to_str
+
+class sounder_tx(gr.hier_block2):
+ """
+ Creates a top-level channel sounder block with the given parameters.
+ """
+
+ def __init__(self, subdev_spec, freq, cal, verbose, max_delay, chip_rate,
amplitude):
+
+ # Call hierarchical block constructor
+ # Top-level blocks have no inputs or outputs
+ gr.hier_block2.__init__(self,
+ "sounder_tx", # Block typename
+ gr.io_signature(0,0,0), # Input signature
+ gr.io_signature(0,0,0)) # Output signature
+ self._freq = freq
+ self._cal = cal
+ self._verbose = verbose
+ self._max_delay = max_delay
+
+ self._u = usrp_sink_c(0, subdev_spec, chip_rate, self._freq,
self._cal, verbose)
+ self._chip_rate = self._u._if_rate
+ self._resolution = 1.0/self._chip_rate
+
+ min_chips = int(math.ceil(2.0*self._max_delay * self._chip_rate))
+ degree = int(math.ceil(math.log(min_chips)/math.log(2)))
+ self._length = 2**degree-1
+
+ self._glfsr = gr.glfsr_source_b(degree)
+ self._mapper = gr.chunks_to_symbols_bc((-amplitude+0j, amplitude+0j),
1)
+
+ if self._verbose:
+ print "Actual chip rate is", n2s(self._chip_rate), "chips/sec"
+ print "Resolution is", n2s(self._resolution), "sec"
+ print "Using specified maximum delay spread of", self._max_delay,
"sec"
+ print "Mininum sequence length needed is", n2s(min_chips), "chips"
+ print "Using PN sequence of degree", degree, "length", self._length
+ print "Output amplitude is", amplitude
+
+ self.define_component("glfsr", self._glfsr)
+ self.define_component("mapper", self._mapper)
+ self.define_component("usrp", self._u)
+ self.connect("glfsr", 0, "mapper", 0)
+ self.connect("mapper", 0, "usrp", 0)
Deleted:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/usrp_sink.py
Copied:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/usrp_sink.py
(from rev 4683,
gnuradio/trunk/gnuradio-examples/python/hier/sounder/usrp_sink.py)
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/usrp_sink.py
(rev 0)
+++
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/usrp_sink.py
2007-03-02 03:57:30 UTC (rev 4685)
@@ -0,0 +1,120 @@
+#!/usr/bin/env python
+#
+# Copyright 2007 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 2, 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, usrp, eng_notation
+n2s = eng_notation.num_to_str
+
+# Hierarchical block implementing a USRP sink for complex floats,
+# with convenience functions for tuning, interpolation, etc.
+#
+class usrp_sink_c(gr.hier_block2):
+ """
+ Create a USRP sink object accepting complex floats.
+ """
+ def __init__(self, which=0, subdev_spec=None, if_rate=None,
+ freq=0.0, calibration=0.0, verbose=False):
+ # Call hierarchical block constructor
+ gr.hier_block2.__init__(self,
+ "usrp_sink_c", #
Block typename
+ gr.io_signature(1,1,gr.sizeof_gr_complex), #
Input signature
+ gr.io_signature(0,0,0)) #
Output signature
+
+ self._verbose = verbose
+ self._u = usrp.sink_c(which)
+ if self._verbose:
+ print 'DAC sample rate is', n2s(self._u.dac_rate()), "sps"
+ self.set_subdev(subdev_spec)
+ self.set_if_rate(if_rate)
+ self.set_calibration(calibration)
+ self.tune(freq)
+
+ self.define_component("usrp", self._u)
+ self.connect("self", 0, "usrp", 0)
+
+
+ def set_subdev(self, subdev_spec):
+ if subdev_spec is None:
+ subdev_spec = self.pick_subdevice()
+ self._subdev = usrp.selected_subdev(self._u, subdev_spec)
+ self._u.set_mux(usrp.determine_tx_mux_value(self._u, subdev_spec))
+ if self._verbose:
+ print 'TX using', self._subdev.name(), 'daughterboard'
+
+ def pick_subdevice(self):
+ """
+ The user didn't specify a subdevice.
+ If there's a daughterboard on A, select A.
+ If there's a daughterboard on B, select B.
+ Otherwise, select A.
+ """
+ if self._u.db[0][0].dbid() >= 0: # dbid is < 0 if there's no
d'board or a problem
+ return (0, 0)
+ if self._u.db[1][0].dbid() >= 0:
+ return (1, 0)
+ return (0, 0)
+
+ def set_if_rate(self, if_rate):
+ # If no IF rate specified, set to maximum interpolation
+ if if_rate is None:
+ self._interp = 512
+ else:
+ self._interp = 4*int(self._u.dac_rate()/(4.0*if_rate)+0.5)
+
+
+ self._if_rate = self._u.dac_rate()/self._interp
+ self._u.set_interp_rate(self._interp)
+
+ if self._verbose:
+ print "USRP interpolation rate is", self._interp
+ print "USRP IF rate is", n2s(self._if_rate), "sps"
+
+ def set_calibration(self, calibration):
+ self._cal = calibration
+ if self._verbose:
+ print "Using frequency calibration offset of", n2s(calibration),
"Hz"
+
+ def tune(self, freq):
+ """
+ Set the center frequency we're interested in.
+
+ @param target_freq: frequency in Hz
+ @type: bool
+
+ Tuning is a two step process. First we ask the front-end to
+ tune as close to the desired frequency as it can. Then we use
+ the result of that operation and our target_frequency to
+ determine the value for the digital down converter.
+ """
+ self._tune_result = self._u.tune(self._subdev._which, self._subdev,
freq+self._cal)
+ if self._tune_result:
+ if self._verbose:
+ print "Baseband frequency is",
n2s(self._tune_result.baseband_freq), "Hz"
+ print "DXC frequency is", n2s(self._tune_result.dxc_freq), "Hz"
+ print "Center frequency is", n2s(freq), "Hz"
+ print "Residual frequency is",
n2s(self._tune_result.residual_freq), "Hz"
+ return True
+
+ return False
+
+if __name__ == '__main__':
+ sink = usrp_sink_c(verbose=True)
+
Deleted:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/usrp_sounder_rx.py
Copied:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/usrp_sounder_rx.py
(from rev 4683,
gnuradio/trunk/gnuradio-examples/python/hier/sounder/usrp_sounder_rx.py)
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/usrp_sounder_rx.py
(rev 0)
+++
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/usrp_sounder_rx.py
2007-03-02 03:57:30 UTC (rev 4685)
@@ -0,0 +1,69 @@
+#!/usr/bin/env python
+#
+# Copyright 2007 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 2, 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, eng_notation
+from gnuradio.eng_option import eng_option
+from optparse import OptionParser
+from sounder_rx import sounder_rx
+
+def main():
+ parser = OptionParser(option_class=eng_option)
+
+ # Receive path options
+ parser.add_option("-R", "--rx-subdev-spec", type="subdev",
default=None,
+ help="select USRP Rx side A or B (default=first
found)")
+ parser.add_option("-f", "--freq", type="eng_float", default=0.0,
+ help="set center frequency (default=%default)")
+ parser.add_option("-c", "--cal", type="eng_float", default=0.0,
+ help="set frequency calibration offset
(default=%default)")
+ parser.add_option("-v", "--verbose", action="store_true", default=False,
+ help="print extra debugging info")
+ parser.add_option("-d", "--max-delay", type="eng_float", default=10e-6,
+ help="set maximum delay spread (default=%default)")
+ parser.add_option("-r", "--chip-rate", type="eng_float", default=8e6,
+ help="set sounder chip rate (default=%default)")
+ parser.add_option("-g", "--gain", type="eng_float", default=None,
+ help="set output amplitude (default=%default)")
+ (options, args) = parser.parse_args()
+
+ if len(args) != 0:
+ parser.print_help()
+ sys.exit(1)
+
+ # Create an instance of a hierarchical block
+ top_block = sounder_rx(options.rx_subdev_spec, options.freq,
options.cal,
+ options.verbose, options.max_delay,
options.chip_rate,
+ options.gain)
+
+ # Create an instance of a runtime, passing it the top block
+ # to process
+ runtime = gr.runtime(top_block)
+
+ try:
+ # Run forever
+ runtime.run()
+ except KeyboardInterrupt:
+ # Ctrl-C exits
+ pass
+
+if __name__ == '__main__':
+ main ()
Deleted:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/usrp_sounder_tx.py
Copied:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/usrp_sounder_tx.py
(from rev 4683,
gnuradio/trunk/gnuradio-examples/python/hier/sounder/usrp_sounder_tx.py)
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/usrp_sounder_tx.py
(rev 0)
+++
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/usrp_sounder_tx.py
2007-03-02 03:57:30 UTC (rev 4685)
@@ -0,0 +1,69 @@
+#!/usr/bin/env python
+#
+# Copyright 2007 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 2, 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, eng_notation
+from gnuradio.eng_option import eng_option
+from optparse import OptionParser
+from sounder_tx import sounder_tx
+
+def main():
+ parser = OptionParser(option_class=eng_option)
+
+ # Transmit path options
+ parser.add_option("-T", "--tx-subdev-spec", type="subdev",
default=None,
+ help="select USRP Rx side A or B (default=first
found)")
+ parser.add_option("-f", "--freq", type="eng_float", default=0.0,
+ help="set center frequency (default=%default)")
+ parser.add_option("-c", "--cal", type="eng_float", default=0.0,
+ help="set frequency calibration offset
(default=%default)")
+ parser.add_option("-v", "--verbose", action="store_true", default=False,
+ help="print extra debugging info")
+ parser.add_option("-d", "--max-delay", type="eng_float", default=10e-6,
+ help="set maximum delay spread (default=%default)")
+ parser.add_option("-r", "--chip-rate", type="eng_float", default=8e6,
+ help="set sounder chip rate (default=%default)")
+ parser.add_option("-g", "--amplitude", type="eng_float",
default=32000.0,
+ help="set output amplitude (default=%default)")
+ (options, args) = parser.parse_args()
+
+ if len(args) != 0:
+ parser.print_help()
+ sys.exit(1)
+
+ # Create an instance of a hierarchical block
+ top_block = sounder_tx(options.tx_subdev_spec, options.freq,
options.cal,
+ options.verbose, options.max_delay,
options.chip_rate,
+ options.amplitude)
+
+ # Create an instance of a runtime, passing it the top block
+ # to process
+ runtime = gr.runtime(top_block)
+
+ try:
+ # Run forever
+ runtime.run()
+ except KeyboardInterrupt:
+ # Ctrl-C exits
+ pass
+
+if __name__ == '__main__':
+ main ()
Deleted:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/usrp_source.py
Copied:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/usrp_source.py
(from rev 4683,
gnuradio/trunk/gnuradio-examples/python/hier/sounder/usrp_source.py)
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/usrp_source.py
(rev 0)
+++
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/sounder/usrp_source.py
2007-03-02 03:57:30 UTC (rev 4685)
@@ -0,0 +1,126 @@
+#!/usr/bin/env python
+#
+# Copyright 2007 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 2, 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, usrp, eng_notation
+n2s = eng_notation.num_to_str
+
+# Hierarchical block implementing a USRP source for complex floats,
+# with convenience functions for gain, tune, decimation, etc.
+#
+class usrp_source_c(gr.hier_block2):
+ """
+ Create a USRP source object supplying complex floats.
+ """
+ def __init__(self, which=0, subdev_spec=None, gain=None, if_rate=None,
+ freq=0.0, calibration=0.0, verbose=False):
+ # Call hierarchical block constructor
+ gr.hier_block2.__init__(self,
+ "usrp_source_c", #
Block typename
+ gr.io_signature(0,0,0), #
Input signature
+ gr.io_signature(1,1,gr.sizeof_gr_complex)) #
Output signature
+
+ self._verbose = verbose
+ self._u = usrp.source_c(which)
+ if self._verbose:
+ print 'ADC sample rate is', n2s(self._u.adc_rate()), "sps"
+ self.set_subdev(subdev_spec)
+ self.set_if_rate(if_rate)
+ self.set_gain(gain)
+ self.set_calibration(calibration)
+ self.tune(freq)
+
+ self.define_component("usrp", self._u)
+ self.connect("usrp", 0, "self", 0)
+
+ def set_subdev(self, subdev_spec):
+ if subdev_spec is None:
+ subdev_spec = self.pick_subdevice()
+ self._subdev = usrp.selected_subdev(self._u, subdev_spec)
+ self._u.set_mux(usrp.determine_rx_mux_value(self._u, subdev_spec))
+ if self._verbose:
+ print 'RX using', self._subdev.name(), 'daughterboard'
+
+ def pick_subdevice(self):
+ """
+ The user didn't specify a subdevice.
+ If there's a daughterboard on A, select A.
+ If there's a daughterboard on B, select B.
+ Otherwise, select A.
+ """
+ if self._u.db[0][0].dbid() >= 0: # dbid is < 0 if there's no
d'board or a problem
+ return (0, 0)
+ if self._u.db[1][0].dbid() >= 0:
+ return (1, 0)
+ return (0, 0)
+
+ def set_if_rate(self, if_rate):
+ # If no IF rate specified, set to maximum decimation
+ if if_rate is None:
+ self._decim = 256
+ else:
+ self._decim = int(self._u.adc_rate()/if_rate)
+
+ self._u.set_decim_rate(self._decim)
+ self._if_rate = self._u.adc_rate()/self._decim
+
+ if self._verbose:
+ print "USRP decimation rate is", self._decim
+ print "USRP IF rate is", n2s(self._if_rate), "sps"
+
+ def set_gain(self, gain):
+ # If no gain specified, set to midrange
+ if gain is None:
+ g = self._subdev.gain_range()
+ gain = (g[0]+g[1])/2.0
+ self._gain = gain
+ self._subdev.set_gain(self._gain)
+
+ def set_calibration(self, calibration):
+ self._cal = calibration
+ if self._verbose:
+ print "Using frequency calibration offset of", n2s(calibration),
"Hz"
+
+ def tune(self, freq):
+ """
+ Set the center frequency we're interested in.
+
+ @param target_freq: frequency in Hz
+ @type: bool
+
+ Tuning is a two step process. First we ask the front-end to
+ tune as close to the desired frequency as it can. Then we use
+ the result of that operation and our target_frequency to
+ determine the value for the digital down converter.
+ """
+ self._tune_result = usrp.tune(self._u, 0, self._subdev, freq+self._cal)
+ if self._tune_result:
+ if self._verbose:
+ print "Baseband frequency is",
n2s(self._tune_result.baseband_freq), "Hz"
+ print "DXC frequency is", n2s(self._tune_result.dxc_freq), "Hz"
+ print "Center frequency is", n2s(freq), "Hz"
+ print "Residual frequency is",
n2s(self._tune_result.residual_freq), "Hz"
+ return True
+
+ return False
+
+if __name__ == '__main__':
+ src = usrp_source_c(verbose=True)
Copied:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/usrp (from
rev 4683, gnuradio/trunk/gnuradio-examples/python/hier/usrp)
Property changes on:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/usrp
___________________________________________________________________
Name: svn:ignore
+ Makefile
Makefile.in
Deleted:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/usrp/Makefile.am
Copied:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/usrp/Makefile.am
(from rev 4683, gnuradio/trunk/gnuradio-examples/python/hier/usrp/Makefile.am)
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/usrp/Makefile.am
(rev 0)
+++
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/usrp/Makefile.am
2007-03-02 03:57:30 UTC (rev 4685)
@@ -0,0 +1,25 @@
+#
+# Copyright 2007 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 2, 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.
+#
+
+EXTRA_DIST = \
+ usrp_fft.py
+
+MOSTLYCLEANFILES = *.pyc *~
Deleted:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/usrp/usrp_fft.py
Copied:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/usrp/usrp_fft.py
(from rev 4683, gnuradio/trunk/gnuradio-examples/python/hier/usrp/usrp_fft.py)
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/usrp/usrp_fft.py
(rev 0)
+++
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/hier/usrp/usrp_fft.py
2007-03-02 03:57:30 UTC (rev 4685)
@@ -0,0 +1,253 @@
+#!/usr/bin/env python
+#
+# Copyright 2004,2005,2007 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 2, 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, gru
+from gnuradio import usrp
+from gnuradio import eng_notation
+from gnuradio.eng_option import eng_option
+from gnuradio.wxgui import stdgui2, fftsink2, waterfallsink2, scopesink2,
form, slider
+from optparse import OptionParser
+import wx
+import sys
+
+
+def pick_subdevice(u):
+ """
+ The user didn't specify a subdevice on the command line.
+ If there's a daughterboard on A, select A.
+ If there's a daughterboard on B, select B.
+ Otherwise, select A.
+ """
+ if u.db[0][0].dbid() >= 0: # dbid is < 0 if there's no d'board or a
problem
+ return (0, 0)
+ if u.db[1][0].dbid() >= 0:
+ return (1, 0)
+ return (0, 0)
+
+
+class app_top_block(stdgui2.std_top_block):
+ def __init__(self, frame, panel, vbox, argv):
+ stdgui2.std_top_block.__init__(self, frame, panel, vbox, argv)
+
+ self.frame = frame
+ self.panel = panel
+
+ parser = OptionParser(option_class=eng_option)
+ parser.add_option("-R", "--rx-subdev-spec", type="subdev",
default=None,
+ help="select USRP Rx side A or B (default=first one
with a daughterboard)")
+ parser.add_option("-d", "--decim", type="int", default=16,
+ help="set fgpa decimation rate to DECIM
[default=%default]")
+ parser.add_option("-f", "--freq", type="eng_float", default=None,
+ help="set frequency to FREQ", metavar="FREQ")
+ parser.add_option("-g", "--gain", type="eng_float", default=None,
+ help="set gain in dB (default is midpoint)")
+ parser.add_option("-W", "--waterfall", action="store_true",
default=False,
+ help="Enable waterfall display")
+ parser.add_option("-8", "--width-8", action="store_true",
default=False,
+ help="Enable 8-bit samples across USB")
+ parser.add_option("-S", "--oscilloscope", action="store_true",
default=False,
+ help="Enable oscilloscope display")
+ (options, args) = parser.parse_args()
+ if len(args) != 0:
+ parser.print_help()
+ sys.exit(1)
+
+ self.show_debug_info = True
+
+ self.u = usrp.source_c(decim_rate=options.decim)
+ self.define_component("usrp", self.u)
+ if options.rx_subdev_spec is None:
+ options.rx_subdev_spec = pick_subdevice(self.u)
+ self.u.set_mux(usrp.determine_rx_mux_value(self.u,
options.rx_subdev_spec))
+
+ if options.width_8:
+ width = 8
+ shift = 8
+ format = self.u.make_format(width, shift)
+ print "format =", hex(format)
+ r = self.u.set_format(format)
+ print "set_format =", r
+
+ # determine the daughterboard subdevice we're using
+ self.subdev = usrp.selected_subdev(self.u, options.rx_subdev_spec)
+
+ input_rate = self.u.adc_freq() / self.u.decim_rate()
+
+
+ if options.waterfall:
+ self.scope = waterfallsink2.waterfall_sink_c (panel,
fft_size=1024, sample_rate=input_rate)
+ elif options.oscilloscope:
+ self.scope = scopesink2.scope_sink_c(panel, sample_rate=input_rate)
+ else:
+ self.scope = fftsink2.fft_sink_c (panel, fft_size=1024,
sample_rate=input_rate)
+ self.define_component("scope", self.scope)
+
+ # Ultimately this will be
+ # self.connect("usrp scope")
+ self.connect("usrp", 0, "scope", 0)
+
+ self._build_gui(vbox)
+
+ # set initial values
+
+ if options.gain is None:
+ # if no gain was specified, use the mid-point in dB
+ g = self.subdev.gain_range()
+ options.gain = float(g[0]+g[1])/2
+
+ if options.freq is None:
+ # if no freq was specified, use the mid-point
+ r = self.subdev.freq_range()
+ options.freq = float(r[0]+r[1])/2
+
+ self.set_gain(options.gain)
+
+ if self.show_debug_info:
+ self.myform['decim'].set_value(self.u.decim_rate())
+ self.myform['address@hidden'].set_value(self.u.adc_freq() /
self.u.decim_rate())
+ self.myform['dbname'].set_value(self.subdev.name())
+ self.myform['baseband'].set_value(0)
+ self.myform['ddc'].set_value(0)
+
+ if not(self.set_freq(options.freq)):
+ self._set_status_msg("Failed to set initial frequency")
+
+ def _set_status_msg(self, msg):
+ self.frame.GetStatusBar().SetStatusText(msg, 0)
+
+ def _build_gui(self, vbox):
+
+ def _form_set_freq(kv):
+ return self.set_freq(kv['freq'])
+
+ vbox.Add(self.scope.win, 10, wx.EXPAND)
+
+ # add control area at the bottom
+ self.myform = myform = form.form()
+ hbox = wx.BoxSizer(wx.HORIZONTAL)
+ hbox.Add((5,0), 0, 0)
+ myform['freq'] = form.float_field(
+ parent=self.panel, sizer=hbox, label="Center freq", weight=1,
+ callback=myform.check_input_and_call(_form_set_freq,
self._set_status_msg))
+
+ hbox.Add((5,0), 0, 0)
+ g = self.subdev.gain_range()
+ myform['gain'] = form.slider_field(parent=self.panel, sizer=hbox,
label="Gain",
+ weight=3,
+ min=int(g[0]), max=int(g[1]),
+ callback=self.set_gain)
+
+ hbox.Add((5,0), 0, 0)
+ vbox.Add(hbox, 0, wx.EXPAND)
+
+ self._build_subpanel(vbox)
+
+ def _build_subpanel(self, vbox_arg):
+ # build a secondary information panel (sometimes hidden)
+
+ # FIXME figure out how to have this be a subpanel that is always
+ # created, but has its visibility controlled by foo.Show(True/False)
+
+ def _form_set_decim(kv):
+ return self.set_decim(kv['decim'])
+
+ if not(self.show_debug_info):
+ return
+
+ panel = self.panel
+ vbox = vbox_arg
+ myform = self.myform
+
+ #panel = wx.Panel(self.panel, -1)
+ #vbox = wx.BoxSizer(wx.VERTICAL)
+
+ hbox = wx.BoxSizer(wx.HORIZONTAL)
+ hbox.Add((5,0), 0)
+
+ myform['decim'] = form.int_field(
+ parent=panel, sizer=hbox, label="Decim",
+ callback=myform.check_input_and_call(_form_set_decim,
self._set_status_msg))
+
+ hbox.Add((5,0), 1)
+ myform['address@hidden'] = form.static_float_field(
+ parent=panel, sizer=hbox, label="address@hidden")
+
+ hbox.Add((5,0), 1)
+ myform['dbname'] = form.static_text_field(
+ parent=panel, sizer=hbox)
+
+ hbox.Add((5,0), 1)
+ myform['baseband'] = form.static_float_field(
+ parent=panel, sizer=hbox, label="Analog BB")
+
+ hbox.Add((5,0), 1)
+ myform['ddc'] = form.static_float_field(
+ parent=panel, sizer=hbox, label="DDC")
+
+ hbox.Add((5,0), 0)
+ vbox.Add(hbox, 0, wx.EXPAND)
+
+
+ def set_freq(self, target_freq):
+ """
+ Set the center frequency we're interested in.
+
+ @param target_freq: frequency in Hz
+ @rypte: bool
+
+ Tuning is a two step process. First we ask the front-end to
+ tune as close to the desired frequency as it can. Then we use
+ the result of that operation and our target_frequency to
+ determine the value for the digital down converter.
+ """
+ r = self.u.tune(0, self.subdev, target_freq)
+
+ if r:
+ self.myform['freq'].set_value(target_freq) # update displayed
value
+ if self.show_debug_info:
+ self.myform['baseband'].set_value(r.baseband_freq)
+ self.myform['ddc'].set_value(r.dxc_freq)
+ return True
+
+ return False
+
+ def set_gain(self, gain):
+ self.myform['gain'].set_value(gain) # update displayed value
+ self.subdev.set_gain(gain)
+
+ def set_decim(self, decim):
+ ok = self.u.set_decim_rate(decim)
+ if not ok:
+ print "set_decim failed"
+ input_rate = self.u.adc_freq() / self.u.decim_rate()
+ self.scope.set_sample_rate(input_rate)
+ if self.show_debug_info: # update displayed values
+ self.myform['decim'].set_value(self.u.decim_rate())
+ self.myform['address@hidden'].set_value(self.u.adc_freq() /
self.u.decim_rate())
+ return ok
+
+def main ():
+ app = stdgui2.stdapp(app_top_block, "USRP FFT", nstatus=1)
+ app.MainLoop()
+
+if __name__ == '__main__':
+ main ()
Modified:
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/multi_usrp/README
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/multi_usrp/README
2007-03-02 03:57:08 UTC (rev 4684)
+++
gnuradio/branches/developers/n4hy/ofdm/gnuradio-examples/python/multi_usrp/README
2007-03-02 03:57:30 UTC (rev 4685)
@@ -23,7 +23,7 @@
CONNECTING THE CABLES
Now connect the 64MHz clocks between the boards with a short sma coax cable.
(See the wiki on how to enable clock-out and clock-in
-http://comsec.com/wiki?USRPClockingNotes )
+http://gnuradio.org/trac/wiki/USRPClockingNotes )
You need one board with a clock out and one board with a clock in.
Modified: gnuradio/branches/developers/n4hy/ofdm/gr-atsc/src/lib/Makefile.am
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/gr-atsc/src/lib/Makefile.am
2007-03-02 03:57:08 UTC (rev 4684)
+++ gnuradio/branches/developers/n4hy/ofdm/gr-atsc/src/lib/Makefile.am
2007-03-02 03:57:30 UTC (rev 4685)
@@ -30,8 +30,6 @@
INCLUDES = $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) $(CPPUNIT_INCLUDES)
-#LIBS += $(GNURADIO_CORE_LIBS)
-
EXTRA_DIST = \
gen_encoder.py \
qa_atsci_trellis_encoder_t1_input.dat \
@@ -204,9 +202,12 @@
test_atsci_SOURCES = test_atsci.cc
-test_atsci_LDADD = libatsc-qa.la libatsc.la $(GNURADIO_CORE_LIBS)
$(CPPUNIT_LIBS)
+test_atsci_LDADD = \
+ libatsc-qa.la \
+ libatsc.la \
+ $(GNURADIO_CORE_LA) \
+ $(CPPUNIT_LIBS)
-
# ------------------------------------------------------------------------
# This is the swig-ish part of the Makefile.
# It builds the atsc module which we'll load into python
@@ -249,7 +250,7 @@
# link the library against some comon swig runtime code and the
# c++ standard library
_atsc_la_LIBADD = \
- $(GNURADIO_CORE_LIBS) \
+ $(GNURADIO_CORE_LA) \
$(PYTHON_LDFLAGS) \
libatsc.la \
-lstdc++
Modified: gnuradio/branches/developers/n4hy/ofdm/gr-audio-alsa/src/Makefile.am
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/gr-audio-alsa/src/Makefile.am
2007-03-02 03:57:08 UTC (rev 4684)
+++ gnuradio/branches/developers/n4hy/ofdm/gr-audio-alsa/src/Makefile.am
2007-03-02 03:57:30 UTC (rev 4685)
@@ -78,7 +78,7 @@
_audio_alsa_la_LIBADD = \
$(PYTHON_LDFLAGS) \
- $(GNURADIO_CORE_LIBS) \
+ $(GNURADIO_CORE_LA) \
$(ALSA_LIBS) \
libgr_audio_alsa.la \
-lstdc++
Modified: gnuradio/branches/developers/n4hy/ofdm/gr-audio-jack/src/Makefile.am
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/gr-audio-jack/src/Makefile.am
2007-03-02 03:57:08 UTC (rev 4684)
+++ gnuradio/branches/developers/n4hy/ofdm/gr-audio-jack/src/Makefile.am
2007-03-02 03:57:30 UTC (rev 4685)
@@ -76,7 +76,7 @@
_audio_jack_la_LIBADD = \
$(PYTHON_LDFLAGS) \
- $(GNURADIO_CORE_LIBS) \
+ $(GNURADIO_CORE_LA) \
$(JACK_LIBS) \
-lstdc++
Modified: gnuradio/branches/developers/n4hy/ofdm/gr-audio-oss/src/Makefile.am
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/gr-audio-oss/src/Makefile.am
2007-03-02 03:57:08 UTC (rev 4684)
+++ gnuradio/branches/developers/n4hy/ofdm/gr-audio-oss/src/Makefile.am
2007-03-02 03:57:30 UTC (rev 4685)
@@ -69,7 +69,7 @@
_audio_oss_la_LIBADD = \
$(PYTHON_LDFLAGS) \
- $(GNURADIO_CORE_LIBS) \
+ $(GNURADIO_CORE_LA) \
$(OSS_LIBS) \
-lstdc++
Modified: gnuradio/branches/developers/n4hy/ofdm/gr-audio-osx/src/Makefile.am
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/gr-audio-osx/src/Makefile.am
2007-03-02 03:57:08 UTC (rev 4684)
+++ gnuradio/branches/developers/n4hy/ofdm/gr-audio-osx/src/Makefile.am
2007-03-02 03:57:30 UTC (rev 4685)
@@ -73,7 +73,7 @@
_audio_osx_la_LIBADD = \
$(PYTHON_LDFLAGS) \
- $(GNURADIO_CORE_LIBS) \
+ $(GNURADIO_CORE_LA) \
-lstdc++
_audio_osx_la_LDFLAGS = $(NO_UNDEFINED) -module -avoid-version -framework
AudioUnit -framework CoreAudio -framework AudioToolbox
Modified:
gnuradio/branches/developers/n4hy/ofdm/gr-audio-portaudio/src/Makefile.am
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/gr-audio-portaudio/src/Makefile.am
2007-03-02 03:57:08 UTC (rev 4684)
+++ gnuradio/branches/developers/n4hy/ofdm/gr-audio-portaudio/src/Makefile.am
2007-03-02 03:57:30 UTC (rev 4685)
@@ -75,7 +75,7 @@
_audio_portaudio_la_LIBADD = \
$(PYTHON_LDFLAGS) \
- $(GNURADIO_CORE_LIBS) \
+ $(GNURADIO_CORE_LA) \
$(PORTAUDIO_LIBS) \
-lstdc++
Modified:
gnuradio/branches/developers/n4hy/ofdm/gr-audio-windows/src/Makefile.am
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/gr-audio-windows/src/Makefile.am
2007-03-02 03:57:08 UTC (rev 4684)
+++ gnuradio/branches/developers/n4hy/ofdm/gr-audio-windows/src/Makefile.am
2007-03-02 03:57:30 UTC (rev 4685)
@@ -69,7 +69,7 @@
_audio_windows_la_LIBADD = \
$(PYTHON_LDFLAGS) \
- $(GNURADIO_CORE_LIBS) \
+ $(GNURADIO_CORE_LA) \
$(WINAUDIO_LIBS) \
-lstdc++
Modified: gnuradio/branches/developers/n4hy/ofdm/gr-comedi/src/Makefile.am
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/gr-comedi/src/Makefile.am
2007-03-02 03:57:08 UTC (rev 4684)
+++ gnuradio/branches/developers/n4hy/ofdm/gr-comedi/src/Makefile.am
2007-03-02 03:57:30 UTC (rev 4685)
@@ -75,7 +75,7 @@
_comedi_la_LIBADD = \
$(PYTHON_LDFLAGS) \
- $(GNURADIO_CORE_LIBS) \
+ $(GNURADIO_CORE_LA) \
$(COMEDI_LIBS) \
-lstdc++
Modified: gnuradio/branches/developers/n4hy/ofdm/gr-ezdop/src/lib/Makefile.am
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/gr-ezdop/src/lib/Makefile.am
2007-03-02 03:57:08 UTC (rev 4684)
+++ gnuradio/branches/developers/n4hy/ofdm/gr-ezdop/src/lib/Makefile.am
2007-03-02 03:57:30 UTC (rev 4685)
@@ -1,5 +1,5 @@
#
-# Copyright 2004,2005,2006 Free Software Foundation, Inc.
+# Copyright 2004,2005,2006,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -32,7 +32,7 @@
-I$(top_srcdir)/ezdop/src/firmware \
-I$(top_srcdir)/ezdop/src/host/ezdop
-EZDOP_LIBS = -L$(top_builddir)/ezdop/src/host/ezdop/ -lezdop
+EZDOP_LA = $(top_builddir)/ezdop/src/host/ezdop/libezdop.la
INCLUDES = \
$(STD_DEFINES_AND_INCLUDES) \
@@ -78,8 +78,8 @@
# c++ standard library
_ezdop_la_LIBADD = \
$(PYTHON_LDFLAGS) \
- $(GNURADIO_CORE_LIBS) \
- $(EZDOP_LIBS) \
+ $(GNURADIO_CORE_LA) \
+ $(EZDOP_LA) \
-lstdc++
ezdop.cc ezdop.py: $(ALL_IFILES)
@@ -89,7 +89,6 @@
grinclude_HEADERS = \
ezdop_source_c.h
-
# These swig headers get installed in ${prefix}/include/gnuradio/swig
swiginclude_HEADERS = \
$(LOCAL_IFILES)
Modified:
gnuradio/branches/developers/n4hy/ofdm/gr-gsm-fr-vocoder/src/lib/Makefile.am
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm/gr-gsm-fr-vocoder/src/lib/Makefile.am
2007-03-02 03:57:08 UTC (rev 4684)
+++
gnuradio/branches/developers/n4hy/ofdm/gr-gsm-fr-vocoder/src/lib/Makefile.am
2007-03-02 03:57:30 UTC (rev 4685)
@@ -76,7 +76,7 @@
_gsm_full_rate_la_LIBADD = \
gsm/libgsm.la \
$(PYTHON_LDFLAGS) \
- $(GNURADIO_CORE_LIBS) \
+ $(GNURADIO_CORE_LA) \
-lstdc++
gsm_full_rate.cc gsm_full_rate.py: gsm_full_rate.i $(ALL_IFILES)
Modified:
gnuradio/branches/developers/n4hy/ofdm/gr-howto-write-a-block/config/gr_python.m4
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm/gr-howto-write-a-block/config/gr_python.m4
2007-03-02 03:57:08 UTC (rev 4684)
+++
gnuradio/branches/developers/n4hy/ofdm/gr-howto-write-a-block/config/gr_python.m4
2007-03-02 03:57:30 UTC (rev 4685)
@@ -28,6 +28,13 @@
AC_REQUIRE([AM_PATH_PYTHON])
AC_REQUIRE([AC_CANONICAL_HOST])
+ # For Fedora Core 5 and 6, see ticket:39 in Trac
+ if test -f '/etc/redhat-release'; then
+ if (echo $pyexecdir | grep -q lib64); then
+ pythondir="$pyexecdir"
+ fi
+ fi
+
# Check for Python include path
AC_MSG_CHECKING([for Python include path])
if test -z "$PYTHON" ; then
@@ -93,22 +100,10 @@
PYTHON_LDFLAGS="-L$python_stdlib_path -l$libpython_name"
AC_MSG_RESULT($PYTHON_LDFLAGS)
# Replace all backslashes in PYTHON Paths with forward slashes
- AC_MSG_CHECKING([for pythondir])
pythondir=`echo $pythondir |sed 's,\\\\,/,g'`
- AC_MSG_RESULT($pythondir)
- AC_SUBST([pythondir])
- AC_MSG_CHECKING([for pkgpythondir])
pkgpythondir=`echo $pkgpythondir |sed 's,\\\\,/,g'`
- AC_MSG_RESULT($pkgpythondir)
- AC_SUBST([pkgpythondir])
- AC_MSG_CHECKING([for pyexecdir])
pyexecdir=`echo $pyexecdir |sed 's,\\\\,/,g'`
- AC_MSG_RESULT($pyexecdir)
- AC_SUBST([pyexecdir])
- AC_MSG_CHECKING([for pkgpyexecdir])
pkgpyexecdir=`echo $pkgpyexecdir |sed 's,\\\\,/,g'`
- AC_MSG_RESULT($pkgpyexecdir)
- AC_SUBST([pkgpyexecdir])
;;
esac
Modified: gnuradio/branches/developers/n4hy/ofdm/gr-pager/src/Makefile.am
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/gr-pager/src/Makefile.am
2007-03-02 03:57:08 UTC (rev 4684)
+++ gnuradio/branches/developers/n4hy/ofdm/gr-pager/src/Makefile.am
2007-03-02 03:57:30 UTC (rev 4685)
@@ -93,7 +93,7 @@
# link the library against the c++ standard library
_pager_swig_la_LIBADD = \
$(PYTHON_LDFLAGS) \
- $(GNURADIO_CORE_LIBS) \
+ $(GNURADIO_CORE_LA) \
-lstdc++
pager_swig.cc pager_swig.py: $(ALL_IFILES)
Copied: gnuradio/branches/developers/n4hy/ofdm/gr-qtgui (from rev 4683,
gnuradio/trunk/gr-qtgui)
Property changes on: gnuradio/branches/developers/n4hy/ofdm/gr-qtgui
___________________________________________________________________
Name: svn:ignore
+ Makefile
Makefile.in
Deleted: gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/Changelog
Copied: gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/Changelog (from rev
4683, gnuradio/trunk/gr-qtgui/Changelog)
===================================================================
Deleted: gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/Makefile.am
Copied: gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/Makefile.am (from rev
4683, gnuradio/trunk/gr-qtgui/Makefile.am)
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/Makefile.am
(rev 0)
+++ gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/Makefile.am 2007-03-02
03:57:30 UTC (rev 4685)
@@ -0,0 +1,28 @@
+#
+# 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 2, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+include $(top_srcdir)/Makefile.common
+
+EXTRA_DIST = gr-qtgui.conf
+SUBDIRS = src
+
+etcdir = $(sysconfdir)/gnuradio/conf.d
+etc_DATA = gr-qtgui.conf
Deleted: gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/README
Copied: gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/README (from rev 4683,
gnuradio/trunk/gr-qtgui/README)
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/README
(rev 0)
+++ gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/README 2007-03-02
03:57:30 UTC (rev 4685)
@@ -0,0 +1,38 @@
+This requires qt 3 or later. See http://www.trolltech.com
+
+To support the widgets needed for this code you need Qwt, available
+from http://sourceforge.net/projects/qwt
+
+For Linux, this may be obtained from:
+
+ http://n4hy.org/Qwt/qwt.spec
+ http://n4hy.org/Qwt/qwt.pc
+ http://n4hy.org/Qwt/qwt-5.0.0.tar.bz2
+ http://n4hy.org/Qwt/qwt-5.0.0-1.src.rpm
+
+On NetBSD or other pkgsrc systems, pkgsrc/x11/qwt exists and seems to
+be a much older version linked against qt2.
+
+
+QTDIR is an environment variable that must be set for
+gr-qtgui to make.
+
+On Ubuntu with a standard apt-get or synaptic install,
+this is done by:
+
+export QTDIR=/usr/share/qt3
+
+on Fedora Core 6 for example it is automatically set to
+
+/usr/lib/qt-3.3
+
+by Qt install
+
+Qwt probably needs to be built and installed for now using
+
+rpmbuild --rebuild qwt-5.0.0-1.src.rpm
+
+which must be run as root (as in sudo) so that files are
+installed in the proper place for the gnuradio build
+(such as qwt.pc).
+
Deleted: gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/gr-qtgui.conf
Copied: gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/gr-qtgui.conf (from rev
4683, gnuradio/trunk/gr-qtgui/gr-qtgui.conf)
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/gr-qtgui.conf
(rev 0)
+++ gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/gr-qtgui.conf
2007-03-02 03:57:30 UTC (rev 4685)
@@ -0,0 +1,7 @@
+# This file contains system wide configuration data for GNU Radio.
+# You may override any setting on a per-user basis by editing
+# ~/.gnuradio/config.conf
+
+[qtgui]
+fft_rate = 15 # fftsink and waterfallsink
+frame_decim = 1 # scopesink
Copied: gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/src (from rev 4683,
gnuradio/trunk/gr-qtgui/src)
Property changes on: gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/src
___________________________________________________________________
Name: svn:ignore
+ Makefile
Makefile.in
Deleted: gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/src/Makefile.am
Copied: gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/src/Makefile.am (from
rev 4683, gnuradio/trunk/gr-qtgui/src/Makefile.am)
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/src/Makefile.am
(rev 0)
+++ gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/src/Makefile.am
2007-03-02 03:57:30 UTC (rev 4685)
@@ -0,0 +1,24 @@
+#
+# 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 2, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+include $(top_srcdir)/Makefile.common
+
+SUBDIRS = lib
Copied: gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/src/lib (from rev 4683,
gnuradio/trunk/gr-qtgui/src/lib)
Property changes on: gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/src/lib
___________________________________________________________________
Name: svn:ignore
+ Makefile
Makefile.in
.libs
.deps
moc_*.cc
Deleted: gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/src/lib/Makefile.am
Copied: gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/src/lib/Makefile.am
(from rev 4683, gnuradio/trunk/gr-qtgui/src/lib/Makefile.am)
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/src/lib/Makefile.am
(rev 0)
+++ gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/src/lib/Makefile.am
2007-03-02 03:57:30 UTC (rev 4685)
@@ -0,0 +1,65 @@
+#
+# Copyright 2004,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 2, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+include $(top_srcdir)/Makefile.common
+
+INCLUDES = $(STD_DEFINES_AND_INCLUDES) \
+ $(QT_CFLAGS) \
+ $(QWT_CFLAGS)
+
+# This rule lets GNU create any moc_*.cc files from the equivalent *.h
+moc_%.cc: %.h
+ moc $< -o $@
+
+# Generate the .h and .cc files from the .ui file
+%.h: %.ui
+ uic $< -o $@
+
+%.cc: %.ui
+ uic -impl $*.h $< -o $@
+
+include_HEADERS =
+ fftdisplay.h \
+ fftdisplaysink.h
+
+noinst_PROGRAMS = \
+ qt_examples
+
+BUILT_SOURCES = \
+ moc_fftdisplay.cc
+
+nodist_qt_examples_SOURCES = \
+ $(BUILT_SOURCES)
+
+qt_examples_SOURCES = \
+ fftdisplay.cc \
+ qt_examples.cc
+
+qt_examples_LDADD = $(QWT_LIBS) \
+ $(QT_LIBS) \
+ $(GNURADIO_CORE_LA)
+
+
+qt_examples_LDFLAGS = $(QT_CFLAGS) \
+ $(QWT_CFLAGS)
+
+MOSTLYCLEANFILES = \
+ *~ $(BUILT_SOURCES)
Deleted: gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/src/lib/fftdisplay.cc
Copied: gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/src/lib/fftdisplay.cc
(from rev 4683, gnuradio/trunk/gr-qtgui/src/lib/fftdisplay.cc)
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/src/lib/fftdisplay.cc
(rev 0)
+++ gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/src/lib/fftdisplay.cc
2007-03-02 03:57:30 UTC (rev 4685)
@@ -0,0 +1,157 @@
+#ifndef FFT_DISPLAY_CC
+#define FFT_DISPLAY_CC
+
+#include <qwt_painter.h>
+#include <qwt_plot_canvas.h>
+#include <qwt_plot_curve.h>
+#include <qwt_scale_engine.h>
+#include <qapplication.h>
+#include <fftdisplay.h>
+
+const int fft_display_event::EVENT_TYPE_ID = QEvent::User+100;
+
+fft_display_event::fft_display_event( std::vector<gr_complex>* fft_data, const
float start_frequency, const float
stop_frequency):QCustomEvent(fft_display_event::EVENT_TYPE_ID){
+ d_fft_data.resize(fft_data->size());
+ for(unsigned int i = 0; i < fft_data->size(); i++){
+ d_fft_data[i] = fft_data->operator[](i);
+ }
+ d_start_frequency = start_frequency;
+ d_stop_frequency = stop_frequency;
+}
+
+fft_display_event::~fft_display_event(){
+
+}
+
+const std::vector<gr_complex>& fft_display_event::get_fft_data() const{
+ return d_fft_data;
+}
+
+float fft_display_event::get_start_frequency()const{
+ return d_start_frequency;
+}
+
+float fft_display_event::get_stop_frequency()const{
+ return d_stop_frequency;
+}
+
+fft_display::fft_display(const unsigned int fft_size, QWidget* parent):
+ QwtPlot(parent)
+{
+ // Disable polygon clipping
+ QwtPainter::setDeviceClipping(false);
+
+ // We don't need the cache here
+ canvas()->setPaintAttribute(QwtPlotCanvas::PaintCached, false);
+ canvas()->setPaintAttribute(QwtPlotCanvas::PaintPacked, false);
+
+ canvas()->setPaletteBackgroundColor(QColor("white"));
+
+ d_fft_bin_size = fft_size;
+ if(d_fft_bin_size < 1){
+ d_fft_bin_size = 1;
+ }
+
+ d_start_frequency = 0.0;
+ d_stop_frequency = 4000.0;
+
+ d_fft_data = new std::vector<gr_complex>(d_fft_bin_size);
+ d_plot_data = new double[d_fft_bin_size];
+ d_x_data = new double[d_fft_bin_size];
+ for( unsigned int i = 0; i < d_fft_bin_size; i++){
+ d_fft_data->operator[](i) = gr_complex(static_cast<float>(i),
0.0);
+ d_x_data[i] = d_start_frequency +
((d_stop_frequency-d_start_frequency) /
static_cast<float>(d_fft_bin_size)*static_cast<float>(i));
+ d_plot_data[i] = 1.0;
+ }
+
+ // Set the Appropriate Axis Scale Engine
+#warning Pass the axis info as necessary...
+ if(true){
+ setAxisScaleEngine(QwtPlot::yLeft, new QwtLinearScaleEngine);
+ }
+ else{
+ setAxisScaleEngine(QwtPlot::yLeft, new QwtLog10ScaleEngine);
+ }
+
+ QwtPlotCurve* fft_plot_curve = new QwtPlotCurve("FFT Spectrum");
+ fft_plot_curve->attach(this);
+ fft_plot_curve->setPen(QPen(Qt::blue));
+ fft_plot_curve->setRawData(d_x_data, d_plot_data, d_fft_bin_size);
+
+ setTitle("Spectral Display");
+}
+
+fft_display::~fft_display(){
+ /* The Qwt objects are destroyed by Qt when their parent is destroyed */
+
+ delete[] d_plot_data;
+ delete[] d_x_data;
+ delete d_fft_data;
+}
+
+
+void fft_display::set_data(const std::vector<gr_complex>& input_data){
+ unsigned int min_points = d_fft_data->size();
+ if(min_points < input_data.size()){
+ min_points = input_data.size();
+ }
+ if(min_points > d_fft_bin_size){
+ min_points = d_fft_bin_size;
+ }
+ for(unsigned int point = 0; point < min_points; point++){
+ d_fft_data->operator[](point) = input_data[point];
+ }
+}
+
+void fft_display::update_display(){
+
+ // Tell the event loop to display the new data - the event loop handles
deleting this object
+ qApp->postEvent(this, new fft_display_event(d_fft_data,
d_start_frequency, d_stop_frequency));
+
+}
+
+void fft_display::customEvent(QCustomEvent* e){
+ if(e->type() == fft_display_event::EVENT_TYPE_ID){
+ fft_display_event* fft_display_event_ptr =
(fft_display_event*)e;
+ // Write out the FFT data to the display here
+
+ gr_complex data_value;
+ for(unsigned int number = 0; number <
fft_display_event_ptr->get_fft_data().size(); number++){
+ data_value =
fft_display_event_ptr->get_fft_data()[number];
+ d_plot_data[number] = abs(data_value);
+#warning Add code here for handling magnitude, scaling, etc...
+
+ d_x_data[number] = d_start_frequency +
((d_stop_frequency-d_start_frequency) /
static_cast<float>(d_fft_bin_size)*static_cast<float>(number));
+ }
+
+ // Axis
+ setAxisTitle(QwtPlot::xBottom, "Frequency (Hz)");
+ setAxisScale(QwtPlot::xBottom,
fft_display_event_ptr->get_start_frequency(),
fft_display_event_ptr->get_stop_frequency());
+
+ setAxisTitle(QwtPlot::yLeft, "Values");
+ replot();
+ }
+}
+
+void fft_display::set_start_frequency(const float new_freq){
+ d_start_frequency = new_freq;
+}
+
+float fft_display::get_start_frequency()const{
+ return d_start_frequency;
+}
+
+void fft_display::set_stop_frequency(const float new_freq){
+ d_stop_frequency = new_freq;
+}
+
+float fft_display::get_stop_frequency()const{
+ return d_stop_frequency;
+}
+
+unsigned int fft_display::get_fft_bin_size()const{
+ return d_fft_bin_size;
+}
+
+
+#endif /* FFT_DISPLAY_CC */
Deleted: gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/src/lib/fftdisplay.h
Copied: gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/src/lib/fftdisplay.h
(from rev 4683, gnuradio/trunk/gr-qtgui/src/lib/fftdisplay.h)
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/src/lib/fftdisplay.h
(rev 0)
+++ gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/src/lib/fftdisplay.h
2007-03-02 03:57:30 UTC (rev 4685)
@@ -0,0 +1,61 @@
+#ifndef FFT_DISPLAY_H
+#define FFT_DISPLAY_H
+
+#include <gr_complex.h>
+
+#include <vector>
+
+#include <qwidget.h>
+#include <qwt_plot.h>
+#include <qevent.h>
+
+class fft_display_event:public QCustomEvent{
+public:
+ fft_display_event(std::vector<gr_complex>*, const float, const float);
+ ~fft_display_event();
+
+ const std::vector<gr_complex>& get_fft_data()const;
+ float get_start_frequency()const;
+ float get_stop_frequency()const;
+
+ static const int EVENT_TYPE_ID;
+protected:
+
+private:
+ std::vector<gr_complex> d_fft_data;
+ float d_start_frequency;
+ float d_stop_frequency;
+};
+
+class fft_display:public QwtPlot{
+ Q_OBJECT
+public:
+ fft_display(const unsigned int, QWidget* = ((QWidget*)0));
+ virtual ~fft_display();
+
+ virtual void customEvent(QCustomEvent*);
+
+ void set_start_frequency(const float);
+ float get_start_frequency()const;
+
+ void set_stop_frequency(const float);
+ float get_stop_frequency()const;
+
+ unsigned int get_fft_bin_size()const;
+
+public slots:
+ virtual void set_data( const std::vector<gr_complex>& );
+ virtual void update_display();
+
+protected:
+
+private:
+ std::vector<gr_complex>* d_fft_data;
+ double* d_plot_data;
+ double* d_x_data;
+ unsigned int d_fft_bin_size;
+ float d_start_frequency;
+ float d_stop_frequency;
+};
+
+#endif /* FFT_DISPLAY_H */
Deleted:
gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/src/lib/fftdisplaysink.h
Copied:
gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/src/lib/fftdisplaysink.h (from
rev 4683, gnuradio/trunk/gr-qtgui/src/lib/fftdisplaysink.h)
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/src/lib/fftdisplaysink.h
(rev 0)
+++ gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/src/lib/fftdisplaysink.h
2007-03-02 03:57:30 UTC (rev 4685)
@@ -0,0 +1,16 @@
+#ifndef FFT_DISPLAY_SINK_H
+#define FFT_DISPLAY_SINK_H
+
+
+class FFTDisplaySink{
+
+public:
+ FFTDisplaySink();
+ ~FFTDisplaySink();
+protected:
+
+private:
+
+};
+
+#endif /* FFT_DISPLAY_SINK_H */
Deleted: gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/src/lib/qt_examples.cc
Copied: gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/src/lib/qt_examples.cc
(from rev 4683, gnuradio/trunk/gr-qtgui/src/lib/qt_examples.cc)
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/src/lib/qt_examples.cc
(rev 0)
+++ gnuradio/branches/developers/n4hy/ofdm/gr-qtgui/src/lib/qt_examples.cc
2007-03-02 03:57:30 UTC (rev 4685)
@@ -0,0 +1,122 @@
+#include <stdio.h>
+#include <unistd.h>
+
+#include <iostream>
+#include <fstream>
+
+#include <qapplication.h>
+#include <omnithread.h>
+#include <vector>
+
+#include <fftdisplay.h>
+
+#warning Must make this threadsafe
+static bool g_exit_flag = false;
+
+void read_function(void* ptr){
+
+ fft_display* fftDisplay = (fft_display*)ptr;
+
+ std::vector<gr_complex> fftData(fftDisplay->get_fft_bin_size());
+ for(unsigned int number = 0; number < fftData.size(); number++){
+ fftData[number] = gr_complex(static_cast<float>(number),
static_cast<float>(number));
+ }
+
+ float* readBuffer = new float[fftDisplay->get_fft_bin_size()*2];
+ int amntRead = 0;
+
+ fftDisplay->set_data(fftData);
+
+ while(!g_exit_flag){
+ // Read in the data here
+ sched_yield();
+ std::cin.read((char*)readBuffer,
fftDisplay->get_fft_bin_size()*sizeof(gr_complex));
+ amntRead = std::cin.gcount();
+
+ if(amntRead !=
static_cast<int>(fftDisplay->get_fft_bin_size()*sizeof(gr_complex))){
+ fprintf(stderr, "Invalid Read Amount from stdin -
closing program\n");
+ qApp->quit();
+ g_exit_flag = true;
+ }
+ else{
+ for(unsigned int number = 0; number < fftData.size();
number++){
+ fftData[number] =
gr_complex(readBuffer[2*number], readBuffer[(2*number)+1]);
+ }
+
+ fftDisplay->set_data(fftData);
+
+ fftDisplay->update_display();
+
+ qApp->wakeUpGuiThread();
+ }
+ }
+
+ delete[] readBuffer;
+}
+
+int main (int argc, char* argv[]){
+ extern char* optarg;
+ extern int optind, optopt;
+ float start_frequency = 0.0;
+ float stop_frequency = 4000.0;
+ int c;
+ unsigned int fft_bin_size = 1024;
+
+ while ((c = getopt(argc, argv, "s:p:b:")) != -1){
+ switch(c){
+ case 's': start_frequency = strtod(optarg, NULL); break;
+ case 'p': stop_frequency = strtod(optarg, NULL); break;
+ case 'b': fft_bin_size = (unsigned int)(atoi(optarg)); break;
+ case ':': /* -s or -p w/o operand */
+ fprintf(stderr, "Option -%c requires an arguement\n", optopt);
break;
+ case '?': fprintf(stderr, "Unrecognized option: -%c\n", optopt);
+ fprintf(stderr, "Valid Arguements\n -s <start
frequency>\n -p <stop frequency> -b <fft_bin_size> - number of fft samples per
display\n");
+ exit(-1); break;
+ }
+ }
+
+ // Verify the stop frequency is greater than the stop frequency
+ if(stop_frequency < start_frequency){
+ fprintf(stderr, "Stop Frequency (%0.0f Hz) was less than the
Start Frequency (%0.0f Hz)\n", stop_frequency, start_frequency);
+ exit(-1);
+ }
+
+ // Create the QApplication - this MUST be done before ANY QObjects are
created
+ QApplication* qApp = new QApplication(argc, argv);
+
+ fft_display* fftDisplay = new fft_display(fft_bin_size); // No Parent
Specified
+
+ // Resize the Display
+ fftDisplay->resize(640,240);
+
+ // Set the start and stop frequency
+ fftDisplay->set_start_frequency(start_frequency);
+ fftDisplay->set_stop_frequency(stop_frequency);
+
+ g_exit_flag = false;
+ omni_thread* thread_ptr = new omni_thread(&read_function,
(void*)fftDisplay);
+
+ // Set up the thread to read the data from stdin
+ thread_ptr->start();
+ sched_yield();
+
+ // Make the closing of the last window call the quit()
+ QObject::connect(qApp, SIGNAL(lastWindowClosed()), qApp, SLOT(quit()));
+
+ // finally, refresh the plot
+ fftDisplay->update_display();
+ fftDisplay->show();
+
+ // Start the Event Thread
+ qApp->exec();
+
+ // No QObjects should be deleted once the event thread exits...
+ g_exit_flag = true;
+
+ delete fftDisplay;
+
+ // Destroy the Event Thread
+ delete qApp;
+ return 0;
+}
+
Modified:
gnuradio/branches/developers/n4hy/ofdm/gr-radio-astronomy/src/lib/Makefile.am
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm/gr-radio-astronomy/src/lib/Makefile.am
2007-03-02 03:57:08 UTC (rev 4684)
+++
gnuradio/branches/developers/n4hy/ofdm/gr-radio-astronomy/src/lib/Makefile.am
2007-03-02 03:57:30 UTC (rev 4685)
@@ -65,9 +65,9 @@
# link the library against some comon swig runtime code and the
# c++ standard library
-_ra_la_LIBADD = \
- $(PYTHON_LDFLAGS) \
- $(GNURADIO_CORE_LIBS) \
+_ra_la_LIBADD = \
+ $(PYTHON_LDFLAGS) \
+ $(GNURADIO_CORE_LA) \
-lstdc++
ra.cc ra.py: $(ALL_IFILES)
Modified: gnuradio/branches/developers/n4hy/ofdm/gr-trellis/src/lib/Makefile.am
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/gr-trellis/src/lib/Makefile.am
2007-03-02 03:57:08 UTC (rev 4684)
+++ gnuradio/branches/developers/n4hy/ofdm/gr-trellis/src/lib/Makefile.am
2007-03-02 03:57:30 UTC (rev 4685)
@@ -110,7 +110,7 @@
# c++ standard library
_trellis_la_LIBADD = \
$(PYTHON_LDFLAGS) \
- $(GNURADIO_CORE_LIBS) \
+ $(GNURADIO_CORE_LA) \
-lstdc++
trellis.cc trellis.py: $(ALL_IFILES) $(grinclude_HEADERS)
Modified: gnuradio/branches/developers/n4hy/ofdm/gr-usrp/src/Makefile.am
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/gr-usrp/src/Makefile.am
2007-03-02 03:57:08 UTC (rev 4684)
+++ gnuradio/branches/developers/n4hy/ofdm/gr-usrp/src/Makefile.am
2007-03-02 03:57:30 UTC (rev 4685)
@@ -94,8 +94,8 @@
_usrp1_la_LIBADD = \
$(PYTHON_LDFLAGS) \
- $(GNURADIO_CORE_LIBS) \
- $(USRP_LIBS) \
+ $(GNURADIO_CORE_LA) \
+ $(USRP_LA) \
-lstdc++
Modified: gnuradio/branches/developers/n4hy/ofdm/gr-usrp/src/run_tests.in
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/gr-usrp/src/run_tests.in
2007-03-02 03:57:08 UTC (rev 4684)
+++ gnuradio/branches/developers/n4hy/ofdm/gr-usrp/src/run_tests.in
2007-03-02 03:57:30 UTC (rev 4685)
@@ -4,6 +4,10 @@
# 2nd parameter is absolute path to component build directory
# 3rd parameter is path to Python QA directory
+# For OS/X
address@hidden@/usrp/host/lib/:@abs_top_builddir@/usrp/host/lib/.libs:$DYLD_LIBRARY_PATH
+export DYLD_LIBRARY_PATH
+
# For Win32
address@hidden@/usrp/host/lib/.libs:$PATH
Modified: gnuradio/branches/developers/n4hy/ofdm/gr-video-sdl/src/Makefile.am
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/gr-video-sdl/src/Makefile.am
2007-03-02 03:57:08 UTC (rev 4684)
+++ gnuradio/branches/developers/n4hy/ofdm/gr-video-sdl/src/Makefile.am
2007-03-02 03:57:30 UTC (rev 4685)
@@ -69,7 +69,7 @@
_video_sdl_la_LIBADD = \
$(PYTHON_LDFLAGS) \
- $(GNURADIO_CORE_LIBS) \
+ $(GNURADIO_CORE_LA) \
$(SDL_LIBS) \
-lstdc++
Modified: gnuradio/branches/developers/n4hy/ofdm/gr-wxgui/src/python/Makefile.am
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/gr-wxgui/src/python/Makefile.am
2007-03-02 03:57:08 UTC (rev 4684)
+++ gnuradio/branches/developers/n4hy/ofdm/gr-wxgui/src/python/Makefile.am
2007-03-02 03:57:30 UTC (rev 4685)
@@ -32,10 +32,14 @@
__init__.py \
form.py \
fftsink.py \
+ fftsink2.py \
plot.py \
powermate.py \
scopesink.py \
+ scopesink2.py \
waterfallsink.py \
+ waterfallsink2.py \
slider.py \
stdgui.py \
+ stdgui2.py \
numbersink.py
Copied: gnuradio/branches/developers/n4hy/ofdm/gr-wxgui/src/python/fftsink2.py
(from rev 4683, gnuradio/trunk/gr-wxgui/src/python/fftsink2.py)
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/gr-wxgui/src/python/fftsink2.py
(rev 0)
+++ gnuradio/branches/developers/n4hy/ofdm/gr-wxgui/src/python/fftsink2.py
2007-03-02 03:57:30 UTC (rev 4685)
@@ -0,0 +1,506 @@
+#!/usr/bin/env python
+#
+# Copyright 2003,2004,2005,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 2, 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, gru, window
+from gnuradio.wxgui import stdgui2
+import wx
+import gnuradio.wxgui.plot as plot
+import Numeric
+import threading
+import math
+
+default_fftsink_size = (640,240)
+default_fft_rate = gr.prefs().get_long('wxgui', 'fft_rate', 15)
+
+class fft_sink_base(object):
+ def __init__(self, input_is_real=False, baseband_freq=0, y_per_div=10,
ref_level=50,
+ sample_rate=1, fft_size=512,
+ fft_rate=default_fft_rate,
+ average=False, avg_alpha=None, title='', peak_hold=False):
+
+ # initialize common attributes
+ self.baseband_freq = baseband_freq
+ self.y_divs = 8
+ self.y_per_div=y_per_div
+ self.ref_level = ref_level
+ self.sample_rate = sample_rate
+ self.fft_size = fft_size
+ self.fft_rate = fft_rate
+ self.average = average
+ if avg_alpha is None:
+ self.avg_alpha = 2.0 / fft_rate
+ else:
+ self.avg_alpha = avg_alpha
+ self.title = title
+ self.peak_hold = peak_hold
+ self.input_is_real = input_is_real
+ self.msgq = gr.msg_queue(2) # queue that holds a maximum of 2
messages
+
+ def set_y_per_div(self, y_per_div):
+ self.y_per_div = y_per_div
+
+ def set_ref_level(self, ref_level):
+ self.ref_level = ref_level
+
+ def set_average(self, average):
+ self.average = average
+ if average:
+ self.avg.set_taps(self.avg_alpha)
+ self.set_peak_hold(False)
+ else:
+ self.avg.set_taps(1.0)
+
+ def set_peak_hold(self, enable):
+ self.peak_hold = enable
+ if enable:
+ self.set_average(False)
+ self.win.set_peak_hold(enable)
+
+ def set_avg_alpha(self, avg_alpha):
+ self.avg_alpha = avg_alpha
+
+ def set_baseband_freq(self, baseband_freq):
+ self.baseband_freq = baseband_freq
+
+ def set_sample_rate(self, sample_rate):
+ self.sample_rate = sample_rate
+ self._set_n()
+
+ def _set_n(self):
+ self.one_in_n.set_n(max(1,
int(self.sample_rate/self.fft_size/self.fft_rate)))
+
+
+class fft_sink_f(gr.hier_block2, fft_sink_base):
+ def __init__(self, parent, baseband_freq=0,
+ y_per_div=10, 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):
+
+ gr.hier_block2.__init__(self, "fft_sink_f",
+ gr.io_signature(1, 1, gr.sizeof_float),
+ gr.io_signature(0,0,0))
+
+ fft_sink_base.__init__(self, input_is_real=True,
baseband_freq=baseband_freq,
+ y_per_div=y_per_div, ref_level=ref_level,
+ sample_rate=sample_rate, fft_size=fft_size,
+ fft_rate=fft_rate,
+ average=average, avg_alpha=avg_alpha,
title=title,
+ peak_hold=peak_hold)
+
+ self.define_component("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,
+ max(1,
int(self.sample_rate/self.fft_size/self.fft_rate)))
+ self.define_component("one_in_n", self.one_in_n)
+
+ mywindow = window.blackmanharris(self.fft_size)
+ self.define_component("fft", gr.fft_vfc(self.fft_size, True, mywindow))
+ power = 0
+ for tap in mywindow:
+ power += tap*tap
+
+ self.define_component("c2mag", gr.complex_to_mag(self.fft_size))
+ self.avg = gr.single_pole_iir_filter_ff(1.0, self.fft_size)
+ self.define_component("avg", self.avg)
+
+ # FIXME We need to add 3dB to all bins but the DC bin
+ self.define_component("log", gr.nlog10_ff(20, self.fft_size,
+
-20*math.log10(self.fft_size)-10*math.log10(power/self.fft_size)))
+ self.define_component("sink", gr.message_sink(gr.sizeof_float *
self.fft_size, self.msgq, True))
+
+
+ # Ultimately this will be
+ # self.connect("self s2p one_in_n fft c2mag avg log sink")
+ self.connect("self", 0, "s2p", 0)
+ self.connect("s2p", 0, "one_in_n", 0)
+ self.connect("one_in_n", 0, "fft", 0)
+ self.connect("fft", 0, "c2mag", 0)
+ self.connect("c2mag", 0, "avg", 0)
+ self.connect("avg", 0, "log", 0)
+ self.connect("log", 0, "sink", 0)
+
+ self.win = fft_window(self, parent, size=size)
+ self.set_average(self.average)
+
+
+class fft_sink_c(gr.hier_block2, fft_sink_base):
+ def __init__(self, parent, baseband_freq=0,
+ y_per_div=10, 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):
+
+ gr.hier_block2.__init__(self, "fft_sink_c",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex),
+ gr.io_signature(0,0,0))
+
+ fft_sink_base.__init__(self, input_is_real=False,
baseband_freq=baseband_freq,
+ y_per_div=y_per_div, ref_level=ref_level,
+ sample_rate=sample_rate, fft_size=fft_size,
+ fft_rate=fft_rate,
+ average=average, avg_alpha=avg_alpha,
title=title,
+ peak_hold=peak_hold)
+
+ self.define_component("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,
+ max(1,
int(self.sample_rate/self.fft_size/self.fft_rate)))
+ self.define_component("one_in_n", self.one_in_n)
+
+ mywindow = window.blackmanharris(self.fft_size)
+ self.define_component("fft", gr.fft_vcc(self.fft_size, True, mywindow))
+ power = 0
+ for tap in mywindow:
+ power += tap*tap
+
+ self.define_component("c2mag", gr.complex_to_mag(self.fft_size))
+ self.avg = gr.single_pole_iir_filter_ff(1.0, self.fft_size)
+ self.define_component("avg", self.avg)
+
+ # FIXME We need to add 3dB to all bins but the DC bin
+ self.define_component("log", gr.nlog10_ff(20, self.fft_size,
+
-20*math.log10(self.fft_size)-10*math.log10(power/self.fft_size)))
+ self.define_component("sink", gr.message_sink(gr.sizeof_float *
self.fft_size, self.msgq, True))
+
+ # Ultimately this will be
+ # self.connect("self s2p one_in_n fft c2mag avg log sink")
+ self.connect("self", 0, "s2p", 0)
+ self.connect("s2p", 0, "one_in_n", 0)
+ self.connect("one_in_n", 0, "fft", 0)
+ self.connect("fft", 0, "c2mag", 0)
+ self.connect("c2mag", 0, "avg", 0)
+ self.connect("avg", 0, "log", 0)
+ self.connect("log", 0, "sink", 0)
+
+ self.win = fft_window(self, parent, size=size)
+ self.set_average(self.average)
+
+
+# ------------------------------------------------------------------------
+
+myDATA_EVENT = wx.NewEventType()
+EVT_DATA_EVENT = wx.PyEventBinder (myDATA_EVENT, 0)
+
+
+class DataEvent(wx.PyEvent):
+ def __init__(self, data):
+ wx.PyEvent.__init__(self)
+ self.SetEventType (myDATA_EVENT)
+ self.data = data
+
+ def Clone (self):
+ self.__class__ (self.GetId())
+
+
+class input_watcher (threading.Thread):
+ def __init__ (self, msgq, fft_size, event_receiver, **kwds):
+ threading.Thread.__init__ (self, **kwds)
+ self.setDaemon (1)
+ self.msgq = msgq
+ self.fft_size = fft_size
+ self.event_receiver = event_receiver
+ self.keep_running = True
+ self.start ()
+
+ def run (self):
+ while (self.keep_running):
+ msg = self.msgq.delete_head() # blocking read of message queue
+ itemsize = int(msg.arg1())
+ nitems = int(msg.arg2())
+
+ s = msg.to_string() # get the body of the msg as a
string
+
+ # There may be more than one FFT frame in the message.
+ # If so, we take only the last one
+ if nitems > 1:
+ start = itemsize * (nitems - 1)
+ s = s[start:start+itemsize]
+
+ complex_data = Numeric.fromstring (s, Numeric.Float32)
+ de = DataEvent (complex_data)
+ wx.PostEvent (self.event_receiver, de)
+ del de
+
+
+class fft_window (plot.PlotCanvas):
+ def __init__ (self, fftsink, parent, id = -1,
+ pos = wx.DefaultPosition, size = wx.DefaultSize,
+ style = wx.DEFAULT_FRAME_STYLE, name = ""):
+ plot.PlotCanvas.__init__ (self, parent, id, pos, size, style, name)
+
+ self.y_range = None
+ self.fftsink = fftsink
+ self.peak_hold = False
+ self.peak_vals = None
+
+ self.SetEnableGrid (True)
+ # self.SetEnableZoom (True)
+ # self.SetBackgroundColour ('black')
+
+ self.build_popup_menu()
+
+ EVT_DATA_EVENT (self, self.set_data)
+ wx.EVT_CLOSE (self, self.on_close_window)
+ self.Bind(wx.EVT_RIGHT_UP, self.on_right_click)
+
+ self.input_watcher = input_watcher(fftsink.msgq, fftsink.fft_size,
self)
+
+
+ def on_close_window (self, event):
+ print "fft_window:on_close_window"
+ self.keep_running = False
+
+
+ def set_data (self, evt):
+ dB = evt.data
+ L = len (dB)
+
+ if self.peak_hold:
+ if self.peak_vals is None:
+ self.peak_vals = dB
+ else:
+ self.peak_vals = Numeric.maximum(dB, self.peak_vals)
+ dB = self.peak_vals
+
+ x = max(abs(self.fftsink.sample_rate), abs(self.fftsink.baseband_freq))
+ if x >= 1e9:
+ sf = 1e-9
+ units = "GHz"
+ elif x >= 1e6:
+ sf = 1e-6
+ units = "MHz"
+ else:
+ sf = 1e-3
+ units = "kHz"
+
+ if self.fftsink.input_is_real: # only plot 1/2 the points
+ x_vals = ((Numeric.arrayrange (L/2)
+ * (self.fftsink.sample_rate * sf / L))
+ + self.fftsink.baseband_freq * sf)
+ points = Numeric.zeros((len(x_vals), 2), Numeric.Float64)
+ points[:,0] = x_vals
+ points[:,1] = dB[0:L/2]
+ else:
+ # the "negative freqs" are in the second half of the array
+ x_vals = ((Numeric.arrayrange (-L/2, L/2)
+ * (self.fftsink.sample_rate * sf / L))
+ + self.fftsink.baseband_freq * sf)
+ points = Numeric.zeros((len(x_vals), 2), Numeric.Float64)
+ points[:,0] = x_vals
+ points[:,1] = Numeric.concatenate ((dB[L/2:], dB[0:L/2]))
+
+
+ lines = plot.PolyLine (points, colour='BLUE')
+
+ graphics = plot.PlotGraphics ([lines],
+ title=self.fftsink.title,
+ xLabel = units, yLabel = "dB")
+
+ self.Draw (graphics, xAxis=None, yAxis=self.y_range)
+ self.update_y_range ()
+
+ def set_peak_hold(self, enable):
+ self.peak_hold = enable
+ self.peak_vals = None
+
+ def update_y_range (self):
+ ymax = self.fftsink.ref_level
+ ymin = self.fftsink.ref_level - self.fftsink.y_per_div *
self.fftsink.y_divs
+ self.y_range = self._axisInterval ('min', ymin, ymax)
+
+ def on_average(self, evt):
+ # print "on_average"
+ self.fftsink.set_average(evt.IsChecked())
+
+ def on_peak_hold(self, evt):
+ # print "on_peak_hold"
+ self.fftsink.set_peak_hold(evt.IsChecked())
+
+ def on_incr_ref_level(self, evt):
+ # print "on_incr_ref_level"
+ self.fftsink.set_ref_level(self.fftsink.ref_level
+ + self.fftsink.y_per_div)
+
+ def on_decr_ref_level(self, evt):
+ # print "on_decr_ref_level"
+ self.fftsink.set_ref_level(self.fftsink.ref_level
+ - self.fftsink.y_per_div)
+
+ def on_incr_y_per_div(self, evt):
+ # print "on_incr_y_per_div"
+ self.fftsink.set_y_per_div(next_up(self.fftsink.y_per_div,
(1,2,5,10,20)))
+
+ def on_decr_y_per_div(self, evt):
+ # print "on_decr_y_per_div"
+ self.fftsink.set_y_per_div(next_down(self.fftsink.y_per_div,
(1,2,5,10,20)))
+
+ def on_y_per_div(self, evt):
+ # print "on_y_per_div"
+ Id = evt.GetId()
+ if Id == self.id_y_per_div_1:
+ self.fftsink.set_y_per_div(1)
+ elif Id == self.id_y_per_div_2:
+ self.fftsink.set_y_per_div(2)
+ elif Id == self.id_y_per_div_5:
+ self.fftsink.set_y_per_div(5)
+ elif Id == self.id_y_per_div_10:
+ self.fftsink.set_y_per_div(10)
+ elif Id == self.id_y_per_div_20:
+ self.fftsink.set_y_per_div(20)
+
+
+ def on_right_click(self, event):
+ menu = self.popup_menu
+ for id, pred in self.checkmarks.items():
+ item = menu.FindItemById(id)
+ item.Check(pred())
+ self.PopupMenu(menu, event.GetPosition())
+
+
+ def build_popup_menu(self):
+ self.id_incr_ref_level = wx.NewId()
+ self.id_decr_ref_level = wx.NewId()
+ self.id_incr_y_per_div = wx.NewId()
+ self.id_decr_y_per_div = wx.NewId()
+ self.id_y_per_div_1 = wx.NewId()
+ self.id_y_per_div_2 = wx.NewId()
+ self.id_y_per_div_5 = wx.NewId()
+ self.id_y_per_div_10 = wx.NewId()
+ self.id_y_per_div_20 = wx.NewId()
+ self.id_average = wx.NewId()
+ self.id_peak_hold = wx.NewId()
+
+ self.Bind(wx.EVT_MENU, self.on_average, id=self.id_average)
+ self.Bind(wx.EVT_MENU, self.on_peak_hold, id=self.id_peak_hold)
+ self.Bind(wx.EVT_MENU, self.on_incr_ref_level,
id=self.id_incr_ref_level)
+ self.Bind(wx.EVT_MENU, self.on_decr_ref_level,
id=self.id_decr_ref_level)
+ self.Bind(wx.EVT_MENU, self.on_incr_y_per_div,
id=self.id_incr_y_per_div)
+ self.Bind(wx.EVT_MENU, self.on_decr_y_per_div,
id=self.id_decr_y_per_div)
+ self.Bind(wx.EVT_MENU, self.on_y_per_div, id=self.id_y_per_div_1)
+ self.Bind(wx.EVT_MENU, self.on_y_per_div, id=self.id_y_per_div_2)
+ self.Bind(wx.EVT_MENU, self.on_y_per_div, id=self.id_y_per_div_5)
+ self.Bind(wx.EVT_MENU, self.on_y_per_div, id=self.id_y_per_div_10)
+ self.Bind(wx.EVT_MENU, self.on_y_per_div, id=self.id_y_per_div_20)
+
+
+ # make a menu
+ menu = wx.Menu()
+ self.popup_menu = menu
+ menu.AppendCheckItem(self.id_average, "Average")
+ 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")
+ # menu.Append(self.id_incr_y_per_div, "Incr dB/div")
+ # menu.Append(self.id_decr_y_per_div, "Decr dB/div")
+ menu.AppendSeparator()
+ # we'd use RadioItems for these, but they're not supported on Mac
+ menu.AppendCheckItem(self.id_y_per_div_1, "1 dB/div")
+ menu.AppendCheckItem(self.id_y_per_div_2, "2 dB/div")
+ menu.AppendCheckItem(self.id_y_per_div_5, "5 dB/div")
+ menu.AppendCheckItem(self.id_y_per_div_10, "10 dB/div")
+ menu.AppendCheckItem(self.id_y_per_div_20, "20 dB/div")
+
+ self.checkmarks = {
+ self.id_average : lambda : self.fftsink.average,
+ 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,
+ self.id_y_per_div_5 : lambda : self.fftsink.y_per_div == 5,
+ self.id_y_per_div_10 : lambda : self.fftsink.y_per_div == 10,
+ self.id_y_per_div_20 : lambda : self.fftsink.y_per_div == 20,
+ }
+
+
+def next_up(v, seq):
+ """
+ Return the first item in seq that is > v.
+ """
+ for s in seq:
+ if s > v:
+ return s
+ return v
+
+def next_down(v, seq):
+ """
+ Return the last item in seq that is < v.
+ """
+ rseq = list(seq[:])
+ rseq.reverse()
+
+ for s in rseq:
+ if s < v:
+ return s
+ return v
+
+
+# ----------------------------------------------------------------
+# Standalone test app
+# ----------------------------------------------------------------
+
+class test_app_block (stdgui2.std_top_block):
+ def __init__(self, frame, panel, vbox, argv):
+ stdgui2.std_top_block.__init__ (self, frame, panel, vbox, argv)
+
+ fft_size = 256
+
+ # build our flow graph
+ input_rate = 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)
+
+ # We add these throttle blocks so that this demo doesn't
+ # suck down all the CPU available. Normally you wouldn't use these.
+ thr1 = gr.throttle(gr.sizeof_gr_complex, input_rate)
+
+ sink1 = fft_sink_c (panel, title="Complex Data", fft_size=fft_size,
+ sample_rate=input_rate, baseband_freq=100e3,
+ ref_level=0, y_per_div=20)
+ vbox.Add (sink1.win, 1, wx.EXPAND)
+
+ self.define_component("src1", src1)
+ self.define_component("thr1", thr1)
+ self.define_component("sink1", sink1)
+
+ self.connect ("src1", 0, "thr1", 0)
+ self.connect ("thr1", 0, "sink1", 0)
+
+ #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)
+ 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)
+ vbox.Add (sink2.win, 1, wx.EXPAND)
+
+ self.define_component("src2", src2)
+ self.define_component("thr2", thr2)
+ self.define_component("sink2", sink2)
+
+ self.connect ("src2", 0, "thr2", 0)
+ self.connect ("thr2", 0, "sink2", 0)
+
+def main ():
+ app = stdgui2.stdapp (test_app_block,
+ "FFT Sink Test App")
+ app.MainLoop ()
+
+if __name__ == '__main__':
+ main ()
Copied:
gnuradio/branches/developers/n4hy/ofdm/gr-wxgui/src/python/scopesink2.py (from
rev 4683, gnuradio/trunk/gr-wxgui/src/python/scopesink2.py)
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/gr-wxgui/src/python/scopesink2.py
(rev 0)
+++ gnuradio/branches/developers/n4hy/ofdm/gr-wxgui/src/python/scopesink2.py
2007-03-02 03:57:30 UTC (rev 4685)
@@ -0,0 +1,659 @@
+#!/usr/bin/env python
+#
+# Copyright 2003,2004,2006,2007 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 2, 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, gru, eng_notation
+from gnuradio.wxgui import stdgui2
+import wx
+import gnuradio.wxgui.plot as plot
+import Numeric
+import threading
+import struct
+
+default_scopesink_size = (640, 240)
+default_v_scale = 1000
+default_frame_decim = gr.prefs().get_long('wxgui', 'frame_decim', 1)
+
+class scope_sink_f(gr.hier_block2):
+ def __init__(self, parent, title='', sample_rate=1,
+ size=default_scopesink_size, frame_decim=default_frame_decim,
+ v_scale=default_v_scale, t_scale=None):
+
+ gr.hier_block2.__init__(self, "scope_sink_f",
+ gr.io_signature(1, 1, gr.sizeof_float),
+ gr.io_signature(0,0,0))
+
+ msgq = gr.msg_queue(2) # message queue that holds at most 2
messages
+ self.guts = gr.oscope_sink_f(sample_rate, msgq)
+ self.define_component("guts", self.guts)
+
+ self.connect("self", 0, "guts", 0)
+
+ self.win = scope_window(win_info (msgq, sample_rate, frame_decim,
+ v_scale, t_scale, self.guts, title),
parent)
+
+ def set_sample_rate(self, sample_rate):
+ self.guts.set_sample_rate(sample_rate)
+ self.win.info.set_sample_rate(sample_rate)
+
+class scope_sink_c(gr.hier_block2):
+ def __init__(self, parent, title='', sample_rate=1,
+ size=default_scopesink_size, frame_decim=default_frame_decim,
+ v_scale=default_v_scale, t_scale=None):
+
+ gr.hier_block2.__init__(self, "scope_sink_c",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex),
+ gr.io_signature(0,0,0))
+
+ msgq = gr.msg_queue(2) # message queue that holds at most 2
messages
+ self.define_component("c2f", gr.complex_to_float())
+ self.guts = gr.oscope_sink_f(sample_rate, msgq)
+ self.define_component("guts", self.guts)
+
+ self.connect("self", 0, "c2f", 0)
+ self.connect("c2f", 0, "guts", 0)
+ self.connect("c2f", 1, "guts", 1)
+
+ self.win = scope_window(win_info(msgq, sample_rate, frame_decim,
+ v_scale, t_scale, self.guts, title),
parent)
+
+ def set_sample_rate(self, sample_rate):
+ self.guts.set_sample_rate(sample_rate)
+ self.win.info.set_sample_rate(sample_rate)
+
+# ========================================================================
+
+
+time_base_list = [ # time / division
+ 1.0e-7, # 100ns / div
+ 2.5e-7,
+ 5.0e-7,
+ 1.0e-6, # 1us / div
+ 2.5e-6,
+ 5.0e-6,
+ 1.0e-5, # 10us / div
+ 2.5e-5,
+ 5.0e-5,
+ 1.0e-4, # 100us / div
+ 2.5e-4,
+ 5.0e-4,
+ 1.0e-3, # 1ms / div
+ 2.5e-3,
+ 5.0e-3,
+ 1.0e-2, # 10ms / div
+ 2.5e-2,
+ 5.0e-2
+ ]
+
+v_scale_list = [ # counts / div, LARGER gains are SMALLER /div, appear EARLIER
+ 2.0e-3, # 2m / div, don't call it V/div it's actually counts/div
+ 5.0e-3,
+ 1.0e-2,
+ 2.0e-2,
+ 5.0e-2,
+ 1.0e-1,
+ 2.0e-1,
+ 5.0e-1,
+ 1.0e+0,
+ 2.0e+0,
+ 5.0e+0,
+ 1.0e+1,
+ 2.0e+1,
+ 5.0e+1,
+ 1.0e+2,
+ 2.0e+2,
+ 5.0e+2,
+ 1.0e+3,
+ 2.0e+3,
+ 5.0e+3,
+ 1.0e+4 # 10000 /div, USRP full scale is -/+ 32767
+ ]
+
+
+wxDATA_EVENT = wx.NewEventType()
+
+def EVT_DATA_EVENT(win, func):
+ win.Connect(-1, -1, wxDATA_EVENT, func)
+
+class DataEvent(wx.PyEvent):
+ def __init__(self, data):
+ wx.PyEvent.__init__(self)
+ self.SetEventType (wxDATA_EVENT)
+ self.data = data
+
+ def Clone (self):
+ self.__class__ (self.GetId())
+
+
+class win_info (object):
+ __slots__ = ['msgq', 'sample_rate', 'frame_decim', 'v_scale',
+ 'scopesink', 'title',
+ 'time_scale_cursor', 'v_scale_cursor', 'marker', 'xy',
+ 'autorange', 'running']
+
+ def __init__ (self, msgq, sample_rate, frame_decim, v_scale, t_scale,
+ scopesink, title = "Oscilloscope"):
+ self.msgq = msgq
+ self.sample_rate = sample_rate
+ self.frame_decim = frame_decim
+ self.scopesink = scopesink
+ self.title = title;
+
+ self.time_scale_cursor = gru.seq_with_cursor(time_base_list,
initial_value = t_scale)
+ self.v_scale_cursor = gru.seq_with_cursor(v_scale_list, initial_value
= v_scale)
+
+ self.marker = 'line'
+ self.xy = False
+ if v_scale == None: # 0 and None are both False, but 0 != None
+ self.autorange = True
+ else:
+ self.autorange = False # 0 is a valid v_scale
+ self.running = True
+
+ def get_time_per_div (self):
+ return self.time_scale_cursor.current ()
+
+ def get_volts_per_div (self):
+ return self.v_scale_cursor.current ()
+
+ def set_sample_rate(self, sample_rate):
+ self.sample_rate = sample_rate
+
+ def get_sample_rate (self):
+ return self.sample_rate
+
+ def get_decimation_rate (self):
+ return 1.0
+
+ def set_marker (self, s):
+ self.marker = s
+
+ def get_marker (self):
+ return self.marker
+
+
+class input_watcher (threading.Thread):
+ def __init__ (self, msgq, event_receiver, frame_decim, **kwds):
+ threading.Thread.__init__ (self, **kwds)
+ self.setDaemon (1)
+ self.msgq = msgq
+ self.event_receiver = event_receiver
+ self.frame_decim = frame_decim
+ self.iscan = 0
+ self.keep_running = True
+ self.start ()
+
+ def run (self):
+ # print "input_watcher: pid = ", os.getpid ()
+ while (self.keep_running):
+ msg = self.msgq.delete_head() # blocking read of message queue
+ if self.iscan == 0: # only display at frame_decim
+ self.iscan = self.frame_decim
+
+ nchan = int(msg.arg1()) # number of channels of data in msg
+ nsamples = int(msg.arg2()) # number of samples in each channel
+
+ s = msg.to_string() # get the body of the msg as a string
+
+ bytes_per_chan = nsamples * gr.sizeof_float
+
+ records = []
+ for ch in range (nchan):
+
+ start = ch * bytes_per_chan
+ chan_data = s[start:start+bytes_per_chan]
+ rec = Numeric.fromstring (chan_data, Numeric.Float32)
+ records.append (rec)
+
+ # print "nrecords = %d, reclen = %d" % (len (records),nsamples)
+
+ de = DataEvent (records)
+ wx.PostEvent (self.event_receiver, de)
+ records = []
+ del de
+
+ # end if iscan == 0
+ self.iscan -= 1
+
+
+class scope_window (wx.Panel):
+
+ def __init__ (self, info, parent, id = -1,
+ pos = wx.DefaultPosition, size = wx.DefaultSize, name = ""):
+ wx.Panel.__init__ (self, parent, -1)
+ self.info = info
+
+ vbox = wx.BoxSizer (wx.VERTICAL)
+
+ self.graph = graph_window (info, self, -1)
+
+ vbox.Add (self.graph, 1, wx.EXPAND)
+ vbox.Add (self.make_control_box(), 0, wx.EXPAND)
+ vbox.Add (self.make_control2_box(), 0, wx.EXPAND)
+
+ self.sizer = vbox
+ self.SetSizer (self.sizer)
+ self.SetAutoLayout (True)
+ self.sizer.Fit (self)
+ self.set_autorange(self.info.autorange)
+
+
+ # second row of control buttons etc. appears BELOW control_box
+ def make_control2_box (self):
+ ctrlbox = wx.BoxSizer (wx.HORIZONTAL)
+
+ self.inc_v_button = wx.Button (self, 1101, " < ", style=wx.BU_EXACTFIT)
+ self.inc_v_button.SetToolTipString ("Increase vertical range")
+ wx.EVT_BUTTON (self, 1101, self.incr_v_scale) # ID matches button ID
above
+
+ self.dec_v_button = wx.Button (self, 1100, " > ",
style=wx.BU_EXACTFIT)
+ self.dec_v_button.SetToolTipString ("Decrease vertical range")
+ wx.EVT_BUTTON (self, 1100, self.decr_v_scale)
+
+ self.v_scale_label = wx.StaticText (self, 1002, "None") # vertical /div
+ self.update_v_scale_label ()
+
+ self.autorange_checkbox = wx.CheckBox (self, 1102, "Autorange")
+ self.autorange_checkbox.SetToolTipString ("Select autorange on/off")
+ wx.EVT_CHECKBOX(self, 1102, self.autorange_checkbox_event)
+
+ ctrlbox.Add ((5,0) ,0) # left margin space
+ ctrlbox.Add (self.inc_v_button, 0, wx.EXPAND)
+ ctrlbox.Add (self.dec_v_button, 0, wx.EXPAND)
+ ctrlbox.Add (self.v_scale_label, 0, wx.ALIGN_CENTER)
+ ctrlbox.Add ((20,0) ,0) # spacer
+ ctrlbox.Add (self.autorange_checkbox, 0, wx.ALIGN_CENTER)
+
+ return ctrlbox
+
+ def make_control_box (self):
+ ctrlbox = wx.BoxSizer (wx.HORIZONTAL)
+
+ tb_left = wx.Button (self, 1001, " < ", style=wx.BU_EXACTFIT)
+ tb_left.SetToolTipString ("Increase time base")
+ wx.EVT_BUTTON (self, 1001, self.incr_timebase)
+
+
+ tb_right = wx.Button (self, 1000, " > ", style=wx.BU_EXACTFIT)
+ tb_right.SetToolTipString ("Decrease time base")
+ wx.EVT_BUTTON (self, 1000, self.decr_timebase)
+
+ self.time_base_label = wx.StaticText (self, 1002, "")
+ self.update_timebase_label ()
+
+ ctrlbox.Add ((5,0) ,0)
+ # ctrlbox.Add (wx.StaticText (self, -1, "Horiz Scale: "), 0,
wx.ALIGN_CENTER)
+ ctrlbox.Add (tb_left, 0, wx.EXPAND)
+ ctrlbox.Add (tb_right, 0, wx.EXPAND)
+ ctrlbox.Add (self.time_base_label, 0, wx.ALIGN_CENTER)
+
+ ctrlbox.Add ((10,0) ,1) # stretchy space
+
+ ctrlbox.Add (wx.StaticText (self, -1, "Trig: "), 0, wx.ALIGN_CENTER)
+ self.trig_chan_choice = wx.Choice (self, 1004,
+ choices = ['Ch1', 'Ch2', 'Ch3',
'Ch4'])
+ self.trig_chan_choice.SetToolTipString ("Select channel for trigger")
+ wx.EVT_CHOICE (self, 1004, self.trig_chan_choice_event)
+ ctrlbox.Add (self.trig_chan_choice, 0, wx.ALIGN_CENTER)
+
+ self.trig_mode_choice = wx.Choice (self, 1005,
+ choices = ['Auto', 'Pos', 'Neg'])
+ self.trig_mode_choice.SetToolTipString ("Select trigger slope or Auto
(untriggered roll)")
+ wx.EVT_CHOICE (self, 1005, self.trig_mode_choice_event)
+ ctrlbox.Add (self.trig_mode_choice, 0, wx.ALIGN_CENTER)
+
+ trig_level50 = wx.Button (self, 1006, "50%")
+ trig_level50.SetToolTipString ("Set trigger level to 50%")
+ wx.EVT_BUTTON (self, 1006, self.set_trig_level50)
+ ctrlbox.Add (trig_level50, 0, wx.EXPAND)
+
+ run_stop = wx.Button (self, 1007, "Run/Stop")
+ run_stop.SetToolTipString ("Toggle Run/Stop mode")
+ wx.EVT_BUTTON (self, 1007, self.run_stop)
+ ctrlbox.Add (run_stop, 0, wx.EXPAND)
+
+ ctrlbox.Add ((10, 0) ,1) # stretchy space
+
+ ctrlbox.Add (wx.StaticText (self, -1, "Fmt: "), 0, wx.ALIGN_CENTER)
+ self.marker_choice = wx.Choice (self, 1002, choices =
self._marker_choices)
+ self.marker_choice.SetToolTipString ("Select plotting with lines,
pluses or dots")
+ wx.EVT_CHOICE (self, 1002, self.marker_choice_event)
+ ctrlbox.Add (self.marker_choice, 0, wx.ALIGN_CENTER)
+
+ self.xy_choice = wx.Choice (self, 1003, choices = ['X:t', 'X:Y'])
+ self.xy_choice.SetToolTipString ("Select X vs time or X vs Y display")
+ wx.EVT_CHOICE (self, 1003, self.xy_choice_event)
+ ctrlbox.Add (self.xy_choice, 0, wx.ALIGN_CENTER)
+
+ return ctrlbox
+
+ _marker_choices = ['line', 'plus', 'dot']
+
+ def update_timebase_label (self):
+ time_per_div = self.info.get_time_per_div ()
+ s = ' ' + eng_notation.num_to_str (time_per_div) + 's/div'
+ self.time_base_label.SetLabel (s)
+
+ def decr_timebase (self, evt):
+ self.info.time_scale_cursor.prev ()
+ self.update_timebase_label ()
+
+ def incr_timebase (self, evt):
+ self.info.time_scale_cursor.next ()
+ self.update_timebase_label ()
+
+ def update_v_scale_label (self):
+ volts_per_div = self.info.get_volts_per_div ()
+ s = ' ' + eng_notation.num_to_str (volts_per_div) + '/div' # Not V/div
+ self.v_scale_label.SetLabel (s)
+
+ def decr_v_scale (self, evt):
+ self.info.v_scale_cursor.prev ()
+ self.update_v_scale_label ()
+
+ def incr_v_scale (self, evt):
+ self.info.v_scale_cursor.next ()
+ self.update_v_scale_label ()
+
+ def marker_choice_event (self, evt):
+ s = evt.GetString ()
+ self.set_marker (s)
+
+ def set_autorange(self, on):
+ if on:
+ self.v_scale_label.SetLabel(" (auto)")
+ self.info.autorange = True
+ self.autorange_checkbox.SetValue(True)
+ self.inc_v_button.Enable(False)
+ self.dec_v_button.Enable(False)
+ else:
+ if self.graph.y_range:
+ (l,u) = self.graph.y_range # found by autorange
+ self.info.v_scale_cursor.set_index_by_value((u-l)/8.0)
+ self.update_v_scale_label()
+ self.info.autorange = False
+ self.autorange_checkbox.SetValue(False)
+ self.inc_v_button.Enable(True)
+ self.dec_v_button.Enable(True)
+
+ def autorange_checkbox_event(self, evt):
+ if evt.Checked():
+ self.set_autorange(True)
+ else:
+ self.set_autorange(False)
+
+ def set_marker (self, s):
+ self.info.set_marker (s) # set info for drawing routines
+ i = self.marker_choice.FindString (s)
+ assert i >= 0, "Hmmm, set_marker problem"
+ self.marker_choice.SetSelection (i)
+
+ def set_format_line (self):
+ self.set_marker ('line')
+
+ def set_format_dot (self):
+ self.set_marker ('dot')
+
+ def set_format_plus (self):
+ self.set_marker ('plus')
+
+ def xy_choice_event (self, evt):
+ s = evt.GetString ()
+ self.info.xy = s == 'X:Y'
+
+ def trig_chan_choice_event (self, evt):
+ s = evt.GetString ()
+ ch = int (s[-1]) - 1
+ self.info.scopesink.set_trigger_channel (ch)
+
+ def trig_mode_choice_event (self, evt):
+ sink = self.info.scopesink
+ s = evt.GetString ()
+ if s == 'Pos':
+ sink.set_trigger_mode (gr.gr_TRIG_POS_SLOPE)
+ elif s == 'Neg':
+ sink.set_trigger_mode (gr.gr_TRIG_NEG_SLOPE)
+ elif s == 'Auto':
+ sink.set_trigger_mode (gr.gr_TRIG_AUTO)
+ else:
+ assert 0, "Bad trig_mode_choice string"
+
+ def set_trig_level50 (self, evt):
+ self.info.scopesink.set_trigger_level_auto ()
+
+ def run_stop (self, evt):
+ self.info.running = not self.info.running
+
+
+class graph_window (plot.PlotCanvas):
+
+ channel_colors = ['BLUE', 'RED',
+ 'CYAN', 'MAGENTA', 'GREEN', 'YELLOW']
+
+ def __init__ (self, info, parent, id = -1,
+ pos = wx.DefaultPosition, size = (640, 240),
+ style = wx.DEFAULT_FRAME_STYLE, name = ""):
+ plot.PlotCanvas.__init__ (self, parent, id, pos, size, style, name)
+
+ self.SetXUseScopeTicks (True)
+ self.SetEnableGrid (True)
+ self.SetEnableZoom (True)
+ self.SetEnableLegend(True)
+ # self.SetBackgroundColour ('black')
+
+ self.info = info;
+ self.y_range = None
+ self.x_range = None
+ self.avg_y_min = None
+ self.avg_y_max = None
+ self.avg_x_min = None
+ self.avg_x_max = None
+
+ EVT_DATA_EVENT (self, self.format_data)
+
+ self.input_watcher = input_watcher (info.msgq, self, info.frame_decim)
+
+ def channel_color (self, ch):
+ return self.channel_colors[ch % len(self.channel_colors)]
+
+ def format_data (self, evt):
+ if not self.info.running:
+ return
+
+ if self.info.xy:
+ self.format_xy_data (evt)
+ return
+
+ info = self.info
+ records = evt.data
+ nchannels = len (records)
+ npoints = len (records[0])
+
+ objects = []
+
+ Ts = 1.0 / (info.get_sample_rate () / info.get_decimation_rate ())
+ x_vals = Ts * Numeric.arrayrange (-npoints/2, npoints/2)
+
+ # preliminary clipping based on time axis here, instead of in graphics
code
+ time_per_window = self.info.get_time_per_div () * 10
+ n = int (time_per_window / Ts + 0.5)
+ n = n & ~0x1 # make even
+ n = max (2, min (n, npoints))
+
+ self.SetXUseScopeTicks (True) # use 10 divisions, no labels
+
+ for ch in range(nchannels):
+ r = records[ch]
+
+ # plot middle n points of record
+
+ lb = npoints/2 - n/2
+ ub = npoints/2 + n/2
+ # points = zip (x_vals[lb:ub], r[lb:ub])
+ points = Numeric.zeros ((ub-lb, 2), Numeric.Float64)
+ points[:,0] = x_vals[lb:ub]
+ points[:,1] = r[lb:ub]
+
+ m = info.get_marker ()
+ if m == 'line':
+ objects.append (plot.PolyLine (points,
+ colour=self.channel_color (ch),
+ legend=('Ch%d' % (ch+1,))))
+ else:
+ objects.append (plot.PolyMarker (points,
+ marker=m,
+ colour=self.channel_color
(ch),
+ legend=('Ch%d' % (ch+1,))))
+
+ graphics = plot.PlotGraphics (objects,
+ title=self.info.title,
+ xLabel = '', yLabel = '')
+
+ time_per_div = info.get_time_per_div ()
+ x_range = (-5.0 * time_per_div, 5.0 * time_per_div) # ranges are
tuples!
+ volts_per_div = info.get_volts_per_div ()
+ if not self.info.autorange:
+ self.y_range = (-4.0 * volts_per_div, 4.0 * volts_per_div)
+ self.Draw (graphics, xAxis=x_range, yAxis=self.y_range)
+ self.update_y_range () # autorange to self.y_range
+
+
+ def format_xy_data (self, evt):
+ info = self.info
+ records = evt.data
+ nchannels = len (records)
+ npoints = len (records[0])
+
+ if nchannels < 2:
+ return
+
+ objects = []
+ # points = zip (records[0], records[1])
+ points = Numeric.zeros ((len(records[0]), 2), Numeric.Float32)
+ points[:,0] = records[0]
+ points[:,1] = records[1]
+
+ self.SetXUseScopeTicks (False)
+
+ m = info.get_marker ()
+ if m == 'line':
+ objects.append (plot.PolyLine (points,
+ colour=self.channel_color (0)))
+ else:
+ objects.append (plot.PolyMarker (points,
+ marker=m,
+ colour=self.channel_color (0)))
+
+ graphics = plot.PlotGraphics (objects,
+ title=self.info.title,
+ xLabel = 'I', yLabel = 'Q')
+
+ self.Draw (graphics, xAxis=self.x_range, yAxis=self.y_range)
+ self.update_y_range ()
+ self.update_x_range ()
+
+
+ def update_y_range (self):
+ alpha = 1.0/25
+ graphics = self.last_draw[0]
+ p1, p2 = graphics.boundingBox () # min, max points of graphics
+
+ if self.avg_y_min: # prevent vertical scale from jumping abruptly --?
+ self.avg_y_min = p1[1] * alpha + self.avg_y_min * (1 - alpha)
+ self.avg_y_max = p2[1] * alpha + self.avg_y_max * (1 - alpha)
+ else: # initial guess
+ self.avg_y_min = p1[1] # -500.0 workaround, sometimes p1 is ~ 10^35
+ self.avg_y_max = p2[1] # 500.0
+
+ self.y_range = self._axisInterval ('auto', self.avg_y_min,
self.avg_y_max)
+ # print "p1 %s p2 %s y_min %s y_max %s y_range %s" \
+ # % (p1, p2, self.avg_y_min, self.avg_y_max, self.y_range)
+
+
+ def update_x_range (self):
+ alpha = 1.0/25
+ graphics = self.last_draw[0]
+ p1, p2 = graphics.boundingBox () # min, max points of graphics
+
+ if self.avg_x_min:
+ self.avg_x_min = p1[0] * alpha + self.avg_x_min * (1 - alpha)
+ self.avg_x_max = p2[0] * alpha + self.avg_x_max * (1 - alpha)
+ else:
+ self.avg_x_min = p1[0]
+ self.avg_x_max = p2[0]
+
+ self.x_range = self._axisInterval ('auto', self.avg_x_min,
self.avg_x_max)
+
+
+# ----------------------------------------------------------------
+# Stand-alone test application
+# ----------------------------------------------------------------
+
+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)
+
+ if len(argv) > 1:
+ frame_decim = int(argv[1])
+ else:
+ frame_decim = 1
+
+ if len(argv) > 2:
+ v_scale = float(argv[2]) # start up at this v_scale value
+ else:
+ v_scale = None # start up in autorange mode, default
+
+ if len(argv) > 3:
+ t_scale = float(argv[3]) # start up at this t_scale value
+ else:
+ t_scale = None # old behavior
+
+ print "frame decim %s v_scale %s t_scale %s" %
(frame_decim,v_scale,t_scale)
+
+ input_rate = 1e6
+
+ # Generate a complex sinusoid
+ self.define_component("src0", gr.sig_source_c (input_rate,
gr.GR_SIN_WAVE, 25.1e3, 1e3))
+
+ # We add this throttle block so that this demo doesn't suck down
+ # all the CPU available. You normally wouldn't use it...
+ self.define_component("throttle", gr.throttle(gr.sizeof_gr_complex,
input_rate))
+
+ scope = scope_sink_c (panel,"Secret Data",sample_rate=input_rate,
+ frame_decim=frame_decim,
+ v_scale=v_scale, t_scale=t_scale)
+ self.define_component("scope", scope)
+ vbox.Add (scope.win, 1, wx.EXPAND)
+
+ # Ultimately this will be
+ # self.connect("src0 throttle scope")
+ self.connect("src0", 0, "throttle", 0)
+ self.connect("throttle", 0, "scope", 0)
+
+
+def main ():
+ app = stdgui2.stdapp (test_top_block, "O'Scope Test App")
+ app.MainLoop ()
+
+if __name__ == '__main__':
+ main ()
+
+# ----------------------------------------------------------------
Copied: gnuradio/branches/developers/n4hy/ofdm/gr-wxgui/src/python/stdgui2.py
(from rev 4683, gnuradio/trunk/gr-wxgui/src/python/stdgui2.py)
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/gr-wxgui/src/python/stdgui2.py
(rev 0)
+++ gnuradio/branches/developers/n4hy/ofdm/gr-wxgui/src/python/stdgui2.py
2007-03-02 03:57:30 UTC (rev 4685)
@@ -0,0 +1,95 @@
+#
+# 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 2, 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.
+#
+
+'''A simple wx gui for GNU Radio applications'''
+
+import wx
+import sys
+from gnuradio import gr
+
+
+class stdapp (wx.App):
+ def __init__ (self, top_block_maker, title="GNU Radio", nstatus=2):
+ self.top_block_maker = top_block_maker
+ self.title = title
+ self._nstatus = nstatus
+ # All our initialization must come before calling wx.App.__init__.
+ # OnInit is called from somewhere in the guts of __init__.
+ wx.App.__init__ (self, redirect=False)
+
+ def OnInit (self):
+ frame = stdframe (self.top_block_maker, self.title, self._nstatus)
+ frame.Show (True)
+ self.SetTopWindow (frame)
+ return True
+
+
+class stdframe (wx.Frame):
+ def __init__ (self, top_block_maker, title="GNU Radio", nstatus=2):
+ # print "stdframe.__init__"
+ wx.Frame.__init__(self, None, -1, title)
+
+ self.CreateStatusBar (nstatus)
+ mainmenu = wx.MenuBar ()
+
+ menu = wx.Menu ()
+ item = menu.Append (200, 'E&xit', 'Exit')
+ self.Bind (wx.EVT_MENU, self.OnCloseWindow, item)
+ mainmenu.Append (menu, "&File")
+ self.SetMenuBar (mainmenu)
+
+ self.Bind (wx.EVT_CLOSE, self.OnCloseWindow)
+ self.panel = stdpanel (self, self, top_block_maker)
+ vbox = wx.BoxSizer(wx.VERTICAL)
+ vbox.Add(self.panel, 1, wx.EXPAND)
+ self.SetSizer(vbox)
+ self.SetAutoLayout(True)
+ vbox.Fit(self)
+
+ def OnCloseWindow (self, event):
+ self.runtime().stop()
+ self.Destroy ()
+
+ def runtime (self):
+ return self.panel.runtime
+
+class stdpanel (wx.Panel):
+ def __init__ (self, parent, frame, top_block_maker):
+ # print "stdpanel.__init__"
+ wx.Panel.__init__ (self, parent, -1)
+ self.frame = frame
+
+ vbox = wx.BoxSizer (wx.VERTICAL)
+ self.top_block = top_block_maker (frame, self, vbox, sys.argv)
+ self.SetSizer (vbox)
+ self.SetAutoLayout (True)
+ vbox.Fit (self)
+
+ self.runtime = gr.runtime(self.top_block)
+ self.runtime.start ()
+
+class std_top_block (gr.hier_block2):
+ def __init__ (self, parent, panel, vbox, argv):
+ # Call the hier_block2 constructor
+ # Top blocks have no inputs and outputs
+ gr.hier_block2.__init__(self, "std_top_block",
+ gr.io_signature(0,0,0),
+ gr.io_signature(0,0,0))
Copied:
gnuradio/branches/developers/n4hy/ofdm/gr-wxgui/src/python/waterfallsink2.py
(from rev 4683, gnuradio/trunk/gr-wxgui/src/python/waterfallsink2.py)
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm/gr-wxgui/src/python/waterfallsink2.py
(rev 0)
+++
gnuradio/branches/developers/n4hy/ofdm/gr-wxgui/src/python/waterfallsink2.py
2007-03-02 03:57:30 UTC (rev 4685)
@@ -0,0 +1,489 @@
+#!/usr/bin/env python
+#
+# Copyright 2003,2004,2005,2007 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 2, 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, gru, window
+from gnuradio.wxgui import stdgui2
+import wx
+import gnuradio.wxgui.plot as plot
+import Numeric
+import os
+import threading
+import math
+
+default_fftsink_size = (640,240)
+default_fft_rate = gr.prefs().get_long('wxgui', 'fft_rate', 15)
+
+class waterfall_sink_base(object):
+ def __init__(self, input_is_real=False, baseband_freq=0,
+ sample_rate=1, fft_size=512,
+ fft_rate=default_fft_rate,
+ average=False, avg_alpha=None, title=''):
+
+ # initialize common attributes
+ self.baseband_freq = baseband_freq
+ self.sample_rate = sample_rate
+ self.fft_size = fft_size
+ self.fft_rate = fft_rate
+ self.average = average
+ if avg_alpha is None:
+ self.avg_alpha = 2.0 / fft_rate
+ else:
+ self.avg_alpha = avg_alpha
+ self.title = title
+ self.input_is_real = input_is_real
+ self.msgq = gr.msg_queue(2) # queue up to 2 messages
+
+ def set_average(self, average):
+ self.average = average
+ if average:
+ self.avg.set_taps(self.avg_alpha)
+ else:
+ self.avg.set_taps(1.0)
+
+ def set_avg_alpha(self, avg_alpha):
+ self.avg_alpha = avg_alpha
+
+ def set_baseband_freq(self, baseband_freq):
+ self.baseband_freq = baseband_freq
+
+ def set_sample_rate(self, sample_rate):
+ self.sample_rate = sample_rate
+ self._set_n()
+
+ def _set_n(self):
+ self.one_in_n.set_n(max(1,
int(self.sample_rate/self.fft_size/self.fft_rate)))
+
+class waterfall_sink_f(gr.hier_block2, waterfall_sink_base):
+ def __init__(self, parent, baseband_freq=0,
+ y_per_div=10, ref_level=50, sample_rate=1, fft_size=512,
+ fft_rate=default_fft_rate, average=False, avg_alpha=None,
+ title='', size=default_fftsink_size):
+
+ gr.hier_block2.__init__(self, "waterfall_sink_f",
+ gr.io_signature(1, 1, gr.sizeof_float),
+ gr.io_signature(0,0,0))
+
+ waterfall_sink_base.__init__(self, input_is_real=True,
baseband_freq=baseband_freq,
+ sample_rate=sample_rate, fft_size=fft_size,
+ fft_rate=fft_rate,
+ average=average, avg_alpha=avg_alpha,
title=title)
+
+ self.define_component("s2p", gr.serial_to_parallel(gr.sizeof_float,
self.fft_size))
+ self.one_in_n = gr.keep_one_in_n(gr.sizeof_float * self.fft_size,
+ max(1,
int(self.sample_rate/self.fft_size/self.fft_rate)))
+ self.define_component("one_in_n", self.one_in_n)
+
+ mywindow = window.blackmanharris(self.fft_size)
+ self.define_component("fft", gr.fft_vfc(self.fft_size, True, mywindow))
+ self.define_component("c2mag", gr.complex_to_mag(self.fft_size))
+ self.avg = gr.single_pole_iir_filter_ff(1.0, self.fft_size)
+ self.define_component("avg", self.avg)
+ self.define_component("log", gr.nlog10_ff(20, self.fft_size,
-20*math.log10(self.fft_size)))
+ self.define_component("sink", gr.message_sink(gr.sizeof_float *
self.fft_size, self.msgq, True))
+
+ # Ultimately this will be
+ # self.connect("self s2p one_in_n fft c2mag avg log sink")
+ self.connect("self", 0, "s2p", 0)
+ self.connect("s2p", 0, "one_in_n", 0)
+ self.connect("one_in_n", 0, "fft", 0)
+ self.connect("fft", 0, "c2mag", 0)
+ self.connect("c2mag", 0, "avg", 0)
+ self.connect("avg", 0, "log", 0)
+ self.connect("log", 0, "sink", 0)
+
+ self.win = waterfall_window(self, parent, size=size)
+ self.set_average(self.average)
+
+
+class waterfall_sink_c(gr.hier_block2, waterfall_sink_base):
+ def __init__(self, parent, baseband_freq=0,
+ y_per_div=10, ref_level=50, sample_rate=1, fft_size=512,
+ fft_rate=default_fft_rate, average=False, avg_alpha=None,
+ title='', size=default_fftsink_size):
+
+ gr.hier_block2.__init__(self, "waterfall_sink_f",
+ gr.io_signature(1, 1, gr.sizeof_gr_complex),
+ gr.io_signature(0,0,0))
+
+ waterfall_sink_base.__init__(self, input_is_real=False,
baseband_freq=baseband_freq,
+ sample_rate=sample_rate,
fft_size=fft_size,
+ fft_rate=fft_rate,
+ average=average, avg_alpha=avg_alpha,
title=title)
+
+ self.define_component("s2p",
gr.serial_to_parallel(gr.sizeof_gr_complex, self.fft_size))
+ self.one_in_n = gr.keep_one_in_n(gr.sizeof_gr_complex * self.fft_size,
+ max(1,
int(self.sample_rate/self.fft_size/self.fft_rate)))
+ self.define_component("one_in_n", self.one_in_n)
+
+ mywindow = window.blackmanharris(self.fft_size)
+ self.define_component("fft", gr.fft_vcc(self.fft_size, True, mywindow))
+ self.define_component("c2mag", gr.complex_to_mag(self.fft_size))
+ self.avg = gr.single_pole_iir_filter_ff(1.0, self.fft_size)
+ self.define_component("avg", self.avg)
+ self.define_component("log", gr.nlog10_ff(20, self.fft_size,
-20*math.log10(self.fft_size)))
+ self.define_component("sink", gr.message_sink(gr.sizeof_float *
self.fft_size, self.msgq, True))
+
+ # Ultimately this will be
+ # self.connect("self s2p one_in_n fft c2mag avg log sink")
+ self.connect("self", 0, "s2p", 0)
+ self.connect("s2p", 0, "one_in_n", 0)
+ self.connect("one_in_n", 0, "fft", 0)
+ self.connect("fft", 0, "c2mag", 0)
+ self.connect("c2mag", 0, "avg", 0)
+ self.connect("avg", 0, "log", 0)
+ self.connect("log", 0, "sink", 0)
+
+ self.win = waterfall_window(self, parent, size=size)
+ self.set_average(self.average)
+
+
+# ------------------------------------------------------------------------
+
+myDATA_EVENT = wx.NewEventType()
+EVT_DATA_EVENT = wx.PyEventBinder (myDATA_EVENT, 0)
+
+
+class DataEvent(wx.PyEvent):
+ def __init__(self, data):
+ wx.PyEvent.__init__(self)
+ self.SetEventType (myDATA_EVENT)
+ self.data = data
+
+ def Clone (self):
+ self.__class__ (self.GetId())
+
+
+class input_watcher (threading.Thread):
+ def __init__ (self, msgq, fft_size, event_receiver, **kwds):
+ threading.Thread.__init__ (self, **kwds)
+ self.setDaemon (1)
+ self.msgq = msgq
+ self.fft_size = fft_size
+ self.event_receiver = event_receiver
+ self.keep_running = True
+ self.start ()
+
+ def run (self):
+ while (self.keep_running):
+ msg = self.msgq.delete_head() # blocking read of message queue
+ itemsize = int(msg.arg1())
+ nitems = int(msg.arg2())
+
+ s = msg.to_string() # get the body of the msg as a
string
+
+ # There may be more than one FFT frame in the message.
+ # If so, we take only the last one
+ if nitems > 1:
+ start = itemsize * (nitems - 1)
+ s = s[start:start+itemsize]
+
+ complex_data = Numeric.fromstring (s, Numeric.Float32)
+ de = DataEvent (complex_data)
+ wx.PostEvent (self.event_receiver, de)
+ del de
+
+
+class waterfall_window (wx.Panel):
+ def __init__ (self, fftsink, parent, id = -1,
+ pos = wx.DefaultPosition, size = wx.DefaultSize,
+ style = wx.DEFAULT_FRAME_STYLE, name = ""):
+ wx.Panel.__init__(self, parent, id, pos, size, style, name)
+
+ self.fftsink = fftsink
+ self.bm = wx.EmptyBitmap(self.fftsink.fft_size, 300, -1)
+
+ self.scale_factor = 5.0 # FIXME should autoscale, or set this
+
+ dc1 = wx.MemoryDC()
+ dc1.SelectObject(self.bm)
+ dc1.Clear()
+
+ self.pens = self.make_pens()
+
+ wx.EVT_PAINT( self, self.OnPaint )
+ wx.EVT_CLOSE (self, self.on_close_window)
+ EVT_DATA_EVENT (self, self.set_data)
+
+ self.build_popup_menu()
+
+ wx.EVT_CLOSE (self, self.on_close_window)
+ self.Bind(wx.EVT_RIGHT_UP, self.on_right_click)
+
+ self.input_watcher = input_watcher(fftsink.msgq, fftsink.fft_size,
self)
+
+
+ def on_close_window (self, event):
+ print "waterfall_window: on_close_window"
+ self.keep_running = False
+
+ def const_list(self,const,len):
+ return [const] * len
+
+ def make_colormap(self):
+ r = []
+ r.extend(self.const_list(0,96))
+ r.extend(range(0,255,4))
+ r.extend(self.const_list(255,64))
+ r.extend(range(255,128,-4))
+
+ g = []
+ g.extend(self.const_list(0,32))
+ g.extend(range(0,255,4))
+ g.extend(self.const_list(255,64))
+ g.extend(range(255,0,-4))
+ g.extend(self.const_list(0,32))
+
+ b = range(128,255,4)
+ b.extend(self.const_list(255,64))
+ b.extend(range(255,0,-4))
+ b.extend(self.const_list(0,96))
+ return (r,g,b)
+
+ def make_pens(self):
+ (r,g,b) = self.make_colormap()
+ pens = []
+ for i in range(0,256):
+ colour = wx.Colour(r[i], g[i], b[i])
+ pens.append( wx.Pen(colour, 2, wx.SOLID))
+ return pens
+
+ def OnPaint(self, event):
+ dc = wx.PaintDC(self)
+ self.DoDrawing(dc)
+
+ def DoDrawing(self, dc=None):
+ if dc is None:
+ dc = wx.ClientDC(self)
+ dc.DrawBitmap(self.bm, 0, 0, False )
+
+
+ def const_list(self,const,len):
+ a = [const]
+ for i in range(1,len):
+ a.append(const)
+ return a
+
+ def make_colormap(self):
+ r = []
+ r.extend(self.const_list(0,96))
+ r.extend(range(0,255,4))
+ r.extend(self.const_list(255,64))
+ r.extend(range(255,128,-4))
+
+ g = []
+ g.extend(self.const_list(0,32))
+ g.extend(range(0,255,4))
+ g.extend(self.const_list(255,64))
+ g.extend(range(255,0,-4))
+ g.extend(self.const_list(0,32))
+
+ b = range(128,255,4)
+ b.extend(self.const_list(255,64))
+ b.extend(range(255,0,-4))
+ b.extend(self.const_list(0,96))
+ return (r,g,b)
+
+ def set_data (self, evt):
+ dB = evt.data
+ L = len (dB)
+
+ dc1 = wx.MemoryDC()
+ dc1.SelectObject(self.bm)
+ dc1.Blit(0,1,self.fftsink.fft_size,300,dc1,0,0,wx.COPY,False,-1,-1)
+
+ x = max(abs(self.fftsink.sample_rate), abs(self.fftsink.baseband_freq))
+ if x >= 1e9:
+ sf = 1e-9
+ units = "GHz"
+ elif x >= 1e6:
+ sf = 1e-6
+ units = "MHz"
+ else:
+ sf = 1e-3
+ units = "kHz"
+
+
+ if self.fftsink.input_is_real: # only plot 1/2 the points
+ d_max = L/2
+ p_width = 2
+ else:
+ d_max = L/2
+ p_width = 1
+
+ scale_factor = self.scale_factor
+ if self.fftsink.input_is_real: # real fft
+ for x_pos in range(0, d_max):
+ value = int(dB[x_pos] * scale_factor)
+ value = min(255, max(0, value))
+ dc1.SetPen(self.pens[value])
+ dc1.DrawRectangle(x_pos*p_width, 0, p_width, 1)
+ else: # complex fft
+ for x_pos in range(0, d_max): # positive freqs
+ value = int(dB[x_pos] * scale_factor)
+ value = min(255, max(0, value))
+ dc1.SetPen(self.pens[value])
+ dc1.DrawRectangle(x_pos*p_width + d_max, 0, p_width, 1)
+ for x_pos in range(0 , d_max): # negative freqs
+ value = int(dB[x_pos+d_max] * scale_factor)
+ value = min(255, max(0, value))
+ dc1.SetPen(self.pens[value])
+ dc1.DrawRectangle(x_pos*p_width, 0, p_width, 1)
+
+ self.DoDrawing (None)
+
+ def on_average(self, evt):
+ # print "on_average"
+ self.fftsink.set_average(evt.IsChecked())
+
+ def on_right_click(self, event):
+ menu = self.popup_menu
+ for id, pred in self.checkmarks.items():
+ item = menu.FindItemById(id)
+ item.Check(pred())
+ self.PopupMenu(menu, event.GetPosition())
+
+
+ def build_popup_menu(self):
+ self.id_incr_ref_level = wx.NewId()
+ self.id_decr_ref_level = wx.NewId()
+ self.id_incr_y_per_div = wx.NewId()
+ self.id_decr_y_per_div = wx.NewId()
+ self.id_y_per_div_1 = wx.NewId()
+ self.id_y_per_div_2 = wx.NewId()
+ self.id_y_per_div_5 = wx.NewId()
+ self.id_y_per_div_10 = wx.NewId()
+ self.id_y_per_div_20 = wx.NewId()
+ self.id_average = wx.NewId()
+
+ self.Bind(wx.EVT_MENU, self.on_average, id=self.id_average)
+ #self.Bind(wx.EVT_MENU, self.on_incr_ref_level,
id=self.id_incr_ref_level)
+ #self.Bind(wx.EVT_MENU, self.on_decr_ref_level,
id=self.id_decr_ref_level)
+ #self.Bind(wx.EVT_MENU, self.on_incr_y_per_div,
id=self.id_incr_y_per_div)
+ #self.Bind(wx.EVT_MENU, self.on_decr_y_per_div,
id=self.id_decr_y_per_div)
+ #self.Bind(wx.EVT_MENU, self.on_y_per_div, id=self.id_y_per_div_1)
+ #self.Bind(wx.EVT_MENU, self.on_y_per_div, id=self.id_y_per_div_2)
+ #self.Bind(wx.EVT_MENU, self.on_y_per_div, id=self.id_y_per_div_5)
+ #self.Bind(wx.EVT_MENU, self.on_y_per_div, id=self.id_y_per_div_10)
+ #self.Bind(wx.EVT_MENU, self.on_y_per_div, id=self.id_y_per_div_20)
+
+
+ # make a menu
+ menu = wx.Menu()
+ self.popup_menu = menu
+ menu.AppendCheckItem(self.id_average, "Average")
+ # menu.Append(self.id_incr_ref_level, "Incr Ref Level")
+ # menu.Append(self.id_decr_ref_level, "Decr Ref Level")
+ # menu.Append(self.id_incr_y_per_div, "Incr dB/div")
+ # menu.Append(self.id_decr_y_per_div, "Decr dB/div")
+ # menu.AppendSeparator()
+ # we'd use RadioItems for these, but they're not supported on Mac
+ #menu.AppendCheckItem(self.id_y_per_div_1, "1 dB/div")
+ #menu.AppendCheckItem(self.id_y_per_div_2, "2 dB/div")
+ #menu.AppendCheckItem(self.id_y_per_div_5, "5 dB/div")
+ #menu.AppendCheckItem(self.id_y_per_div_10, "10 dB/div")
+ #menu.AppendCheckItem(self.id_y_per_div_20, "20 dB/div")
+
+ self.checkmarks = {
+ self.id_average : lambda : self.fftsink.average
+ #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,
+ #self.id_y_per_div_5 : lambda : self.fftsink.y_per_div == 5,
+ #self.id_y_per_div_10 : lambda : self.fftsink.y_per_div == 10,
+ #self.id_y_per_div_20 : lambda : self.fftsink.y_per_div == 20,
+ }
+
+
+def next_up(v, seq):
+ """
+ Return the first item in seq that is > v.
+ """
+ for s in seq:
+ if s > v:
+ return s
+ return v
+
+def next_down(v, seq):
+ """
+ Return the last item in seq that is < v.
+ """
+ rseq = list(seq[:])
+ rseq.reverse()
+
+ for s in rseq:
+ if s < v:
+ return s
+ return v
+
+
+# ----------------------------------------------------------------
+# Standalone test app
+# ----------------------------------------------------------------
+
+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)
+
+ fft_size = 512
+
+ # build our flow graph
+ input_rate = 20.000e3
+
+ # Generate a complex sinusoid
+ self.define_component("src1", gr.sig_source_c (input_rate,
gr.GR_SIN_WAVE, 5.75e3, 1000))
+ #src1 = gr.sig_source_c (input_rate, gr.GR_CONST_WAVE, 5.75e3, 1000)
+
+ # We add these throttle blocks so that this demo doesn't
+ # suck down all the CPU available. Normally you wouldn't use these.
+ self.define_component("thr1", gr.throttle(gr.sizeof_gr_complex,
input_rate))
+
+ sink1 = waterfall_sink_c (self, panel, title="Complex Data",
fft_size=fft_size,
+ sample_rate=input_rate, baseband_freq=100e3)
+ self.define_component("sink1", sink1)
+
+ vbox.Add (sink1.win, 1, wx.EXPAND)
+
+ # Ultimately this will be
+ # self.connect("src1 thr1 sink1")
+ self.connect("src1", 0, "thr1", 0)
+ self.connect("thr1", 0, "sink1", 0)
+
+ # generate a real sinusoid
+ self.define_component("src2", gr.sig_source_f (input_rate,
gr.GR_SIN_WAVE, 5.75e3, 1000))
+ #src2 = gr.sig_source_f (input_rate, gr.GR_CONST_WAVE, 5.75e3, 1000)
+ self.define_component("thr2", gr.throttle(gr.sizeof_float, input_rate))
+ sink2 = waterfall_sink_f (self, panel, title="Real Data",
fft_size=fft_size,
+ sample_rate=input_rate, baseband_freq=100e3)
+ self.define_component("sink2", sink2)
+ vbox.Add (sink2.win, 1, wx.EXPAND)
+
+ # Ultimately this will be
+ # self.connect("src2 thr2 sink2")
+ self.connect("src2", 0, "thr2", 0)
+ self.connect("thr2", 0, "sink2", 0)
+
+def main ():
+ app = stdgui2.stdapp (test_top_block,
+ "Waterfall Sink Test App")
+ app.MainLoop ()
+
+if __name__ == '__main__':
+ main ()
Modified: gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/Makefile.am
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/Makefile.am
2007-03-02 03:57:08 UTC (rev 4684)
+++ gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/Makefile.am
2007-03-02 03:57:30 UTC (rev 4685)
@@ -21,7 +21,7 @@
include $(top_srcdir)/Makefile.common
-INCLUDES = $(PMT_INCLUDES) $(BOOST_CFLAGS) $(CPPUNIT_INCLUDES)
+INCLUDES = $(DEFINES) $(OMNITHREAD_INCLUDES) $(PMT_INCLUDES) $(BOOST_CFLAGS)
$(CPPUNIT_INCLUDES)
TESTS = test_mblock
@@ -33,6 +33,7 @@
# These are the source files that go into the mblock shared library
libmblock_la_SOURCES = \
mb_connection.cc \
+ mb_endpoint.cc \
mb_exception.cc \
mb_mblock.cc \
mb_mblock_impl.cc \
@@ -44,7 +45,7 @@
mb_port_simple.cc \
mb_protocol_class.cc \
mb_runtime.cc \
- mb_runtime_impl.cc \
+ mb_runtime_single_threaded.cc \
mb_util.cc
@@ -53,7 +54,8 @@
# link the library against the c++ standard library
libmblock_la_LIBADD = \
- $(PMT_LIBS) \
+ $(OMNITHREAD_LA) \
+ $(PMT_LA) \
-lstdc++
include_HEADERS = \
@@ -67,6 +69,7 @@
mb_port_simple.h \
mb_protocol_class.h \
mb_runtime.h \
+ mb_runtime_single_threaded.h \
mb_util.h
@@ -75,17 +78,17 @@
mb_endpoint.h \
mb_mblock_impl.h \
mb_msg_accepter_smp.h \
- mb_port_detail.h \
- mb_runtime_impl.h \
qa_mblock.h \
- qa_mblock_prims.h
+ qa_mblock_prims.h \
+ qa_mblock_send.h
# Build the qa code into its own library
libmblock_qa_la_SOURCES = \
qa_mblock.cc \
- qa_mblock_prims.cc
+ qa_mblock_prims.cc \
+ qa_mblock_send.cc
# magic flags
@@ -98,15 +101,9 @@
-lstdc++
-noinst_PROGRAMS = \
- test_mblock
+noinst_PROGRAMS = test_mblock
-
-LIBMBLOCK = libmblock.la
-LIBMBLOCKQA = libmblock-qa.la $(LIBMBLOCK)
-
test_mblock_SOURCES = test_mblock.cc
-test_mblock_LDADD = $(LIBMBLOCKQA)
+test_mblock_LDADD = libmblock-qa.la
-
CLEANFILES = $(BUILT_SOURCES) *.pyc
Modified: gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_common.h
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_common.h
2007-03-02 03:57:08 UTC (rev 4684)
+++ gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_common.h
2007-03-02 03:57:30 UTC (rev 4685)
@@ -67,8 +67,8 @@
class mb_runtime;
typedef boost::shared_ptr<mb_runtime> mb_runtime_sptr;
-class mb_runtime_impl;
-typedef boost::shared_ptr<mb_runtime_impl> mb_runtime_impl_sptr;
+//class mb_runtime_impl;
+//typedef boost::shared_ptr<mb_runtime_impl> mb_runtime_impl_sptr;
class mb_mblock;
typedef boost::shared_ptr<mb_mblock> mb_mblock_sptr;
@@ -79,8 +79,8 @@
class mb_port;
typedef boost::shared_ptr<mb_port> mb_port_sptr;
-class mb_port_detail;
-typedef boost::shared_ptr<mb_port_detail> mb_port_detail_sptr;
+//class mb_port_detail;
+//typedef boost::shared_ptr<mb_port_detail> mb_port_detail_sptr;
class mb_msg_accepter;
typedef boost::shared_ptr<mb_msg_accepter> mb_msg_accepter_sptr;
Modified: gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_connection.cc
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_connection.cc
2007-03-02 03:57:08 UTC (rev 4684)
+++ gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_connection.cc
2007-03-02 03:57:30 UTC (rev 4685)
@@ -52,17 +52,17 @@
}
bool
-mb_conn_table::lookup_conn_by_port(mb_port_sptr port,
+mb_conn_table::lookup_conn_by_port(const mb_port *port,
mb_conn_iter *itp, int *which_ep)
{
mb_conn_iter end = d_connections.end();
for (mb_conn_iter it = d_connections.begin(); it != end; ++it){
- if (it->d_ep[0].port() == port){
+ if (it->d_ep[0].port().get() == port){
*itp = it;
*which_ep = 0;
return true;
}
- if (it->d_ep[1].port() == port){
+ if (it->d_ep[1].port().get() == port){
*itp = it;
*which_ep = 1;
return true;
Modified: gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_connection.h
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_connection.h
2007-03-02 03:57:08 UTC (rev 4684)
+++ gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_connection.h
2007-03-02 03:57:30 UTC (rev 4685)
@@ -53,8 +53,8 @@
mb_conn_iter *it, int *which_ep);
bool
- lookup_conn_by_port(mb_port_sptr port,
- mb_conn_iter *it, int *which_ep);
+ lookup_conn_by_port(const mb_port *port,
+ mb_conn_iter *it, int *which_ep);
void
create_conn(const mb_endpoint &ep0, const mb_endpoint &ep1);
Copied: gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_endpoint.cc
(from rev 4683, gnuradio/trunk/mblock/src/lib/mb_endpoint.cc)
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_endpoint.cc
(rev 0)
+++ gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_endpoint.cc
2007-03-02 03:57:30 UTC (rev 4685)
@@ -0,0 +1,49 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 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 2, 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 <mb_endpoint.h>
+
+bool
+mb_endpoint::inside_of_relay_port_p() const
+{
+ return d_port->port_type() == mb_port::RELAY && d_component_name == "self";
+}
+
+pmt_t
+mb_endpoint::incoming_message_set() const
+{
+ if (inside_of_relay_port_p()) // swap incoming and
outgoing
+ return port()->outgoing_message_set();
+ else
+ return port()->incoming_message_set();
+}
+
+pmt_t
+mb_endpoint::outgoing_message_set() const
+{
+ if (inside_of_relay_port_p()) // swap incoming and
outgoing
+ return port()->incoming_message_set();
+ else
+ return port()->outgoing_message_set();
+}
Modified: gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_endpoint.h
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_endpoint.h
2007-03-02 03:57:08 UTC (rev 4684)
+++ gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_endpoint.h
2007-03-02 03:57:30 UTC (rev 4685)
@@ -47,6 +47,12 @@
const std::string &component_name() const { return d_component_name; }
const std::string &port_name() const { return d_port_name; }
mb_port_sptr port() const { return d_port; }
+
+ //! Does this endpoint represent the inside of a relay port
+ bool inside_of_relay_port_p() const;
+
+ pmt_t incoming_message_set() const;
+ pmt_t outgoing_message_set() const;
};
#endif /* INCLUDED_MB_ENDPOINT_H */
Modified: gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_exception.cc
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_exception.cc
2007-03-02 03:57:08 UTC (rev 4684)
+++ gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_exception.cc
2007-03-02 03:57:30 UTC (rev 4685)
@@ -33,6 +33,11 @@
{
}
+mbe_not_implemented::mbe_not_implemented(mb_mblock *mb, const std::string &msg)
+ : mbe_base(mb, "Not implemented: " + msg)
+{
+}
+
mbe_no_such_component::mbe_no_such_component(mb_mblock *mb, const std::string
&component_name)
: mbe_base(mb, "No such component: " + component_name)
{
Modified: gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_exception.h
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_exception.h
2007-03-02 03:57:08 UTC (rev 4684)
+++ gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_exception.h
2007-03-02 03:57:30 UTC (rev 4685)
@@ -32,6 +32,11 @@
mbe_base(mb_mblock *mb, const std::string &msg);
};
+class mbe_not_implemented : public mbe_base
+{
+public:
+ mbe_not_implemented(mb_mblock *mb, const std::string &msg);
+};
class mbe_no_such_component : public mbe_base
Modified: gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_mblock.cc
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_mblock.cc
2007-03-02 03:57:08 UTC (rev 4684)
+++ gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_mblock.cc
2007-03-02 03:57:30 UTC (rev 4685)
@@ -27,6 +27,12 @@
#include <mb_mblock_impl.h>
+mb_visitor::~mb_visitor()
+{
+ // nop base case for virtual destructor.
+}
+
+
mb_mblock::mb_mblock()
: d_impl(mb_mblock_impl_sptr(new mb_mblock_impl(this)))
{
@@ -113,3 +119,21 @@
{
return d_impl->walk_tree(visitor, path);
}
+
+std::string
+mb_mblock::fullname() const
+{
+ return d_impl->fullname();
+}
+
+void
+mb_mblock::set_fullname(const std::string name)
+{
+ d_impl->set_fullname(name);
+}
+
+mb_mblock *
+mb_mblock::parent() const
+{
+ return d_impl->mblock_parent();
+}
Modified: gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_mblock.h
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_mblock.h
2007-03-02 03:57:08 UTC (rev 4684)
+++ gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_mblock.h
2007-03-02 03:57:30 UTC (rev 4685)
@@ -35,8 +35,7 @@
{
public:
virtual ~mb_visitor();
- bool operator()(mb_mblock *mblock, const std::string &path) { return
visit(mblock, path); }
- virtual bool visit(mb_mblock *mblock, const std::string &path) = 0;
+ virtual bool operator()(mb_mblock *mblock, const std::string &path) = 0;
};
// ----------------------------------------------------------------------
@@ -69,6 +68,7 @@
*/
mb_mblock();
+public:
/*!
* \brief Called by the runtime system to execute the initial
* transition of the finite state machine.
@@ -77,6 +77,7 @@
*/
virtual void init_fsm();
+protected:
/*!
* \brief Called by the runtime system when there's a message to handle.
*
@@ -178,13 +179,21 @@
public:
virtual ~mb_mblock();
+ void set_fullname(const std::string name);
+
+ //! Return full name of this block
+ std::string fullname() const;
+
+ //! Return the parent of this mblock, or 0 if we're the top-level block.
+ mb_mblock *parent() const;
+
/*!
* \brief Perform a pre-order depth-first traversal of the hierarchy.
*
* The traversal stops and returns false if any call to visitor returns
false.
*/
bool
- walk_tree(mb_visitor *visitor, const std::string &path="");
+ walk_tree(mb_visitor *visitor, const std::string &path="top");
//! \implementation
Modified:
gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_mblock_impl.cc
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_mblock_impl.cc
2007-03-02 03:57:08 UTC (rev 4684)
+++ gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_mblock_impl.cc
2007-03-02 03:57:30 UTC (rev 4685)
@@ -51,7 +51,7 @@
////////////////////////////////////////////////////////////////////////
mb_mblock_impl::mb_mblock_impl(mb_mblock *mb)
- : d_mb(mb), d_mb_parent(0)
+ : d_mb(mb), d_mb_parent(0), d_fullname("<unknown>")
{
}
@@ -67,11 +67,6 @@
bool conjugated,
mb_port::port_type_t port_type)
{
- if (port_type == mb_port::RELAY)
- throw mbe_base(d_mb,
- "mb_block_impl::define_port: RELAY ports are not implemented: "
- + port_name);
-
if (port_is_defined(port_name))
throw mbe_duplicate_port(d_mb, port_name);
@@ -90,7 +85,7 @@
if (comp_is_defined(name)) // check for duplicate name
throw mbe_duplicate_component(d_mb, name);
- component->d_impl->d_mb_parent = d_mb; // set component's parent link
+ component->d_impl->d_mb_parent = d_mb; // set component's parent link
d_comp_map[name] = component;
}
@@ -103,7 +98,7 @@
mb_endpoint ep0 = check_and_resolve_endpoint(comp_name1, port_name1);
mb_endpoint ep1 = check_and_resolve_endpoint(comp_name2, port_name2);
- if (!ports_are_compatible(ep0.port(), ep1.port()))
+ if (!endpoints_are_compatible(ep0, ep1))
throw mbe_incompatible_ports(d_mb,
comp_name1, port_name1,
comp_name2, port_name2);
@@ -194,17 +189,15 @@
bool
-mb_mblock_impl::ports_are_compatible(mb_port_sptr p0, mb_port_sptr p1)
+mb_mblock_impl::endpoints_are_compatible(const mb_endpoint &ep0,
+ const mb_endpoint &ep1)
{
- using std::cout;
- using std::endl;
+ pmt_t p0_outgoing = ep0.outgoing_message_set();
+ pmt_t p0_incoming = ep0.incoming_message_set();
- pmt_t p0_outgoing = p0->outgoing_message_set();
- pmt_t p0_incoming = p0->incoming_message_set();
+ pmt_t p1_outgoing = ep1.outgoing_message_set();
+ pmt_t p1_incoming = ep1.incoming_message_set();
- pmt_t p1_outgoing = p1->outgoing_message_set();
- pmt_t p1_incoming = p1->incoming_message_set();
-
return (pmt_subsetp(p0_outgoing, p1_incoming)
&& pmt_subsetp(p1_outgoing, p0_incoming));
}
@@ -232,3 +225,35 @@
return mb_msg_accepter_sptr(ma);
}
+
+bool
+mb_mblock_impl::lookup_other_endpoint(const mb_port *port, mb_endpoint *ep)
+{
+ mb_conn_iter it;
+ int which_ep = 0;
+
+ if (!d_conn_table.lookup_conn_by_port(port, &it, &which_ep))
+ return false;
+
+ *ep = it->d_ep[which_ep^1];
+ return true;
+}
+
+mb_mblock_sptr
+mb_mblock_impl::component(const std::string &comp_name)
+{
+ if (comp_name == "self")
+ return d_mb->shared_from_this();
+
+ if (d_comp_map.count(comp_name) == 0)
+ return mb_mblock_sptr(); // null pointer
+
+ return d_comp_map[comp_name];
+}
+
+void
+mb_mblock_impl::set_fullname(const std::string &name)
+{
+ d_fullname = name;
+}
+
Modified: gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_mblock_impl.h
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_mblock_impl.h
2007-03-02 03:57:08 UTC (rev 4684)
+++ gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_mblock_impl.h
2007-03-02 03:57:30 UTC (rev 4685)
@@ -40,6 +40,8 @@
mb_mblock *d_mb; // pointer to our associated
mblock
mb_mblock *d_mb_parent; // pointer to our parent
+ std::string d_fullname; // hierarchical name
+
mb_port_map_t d_port_map; // our ports
mb_comp_map_t d_comp_map; // our components
mb_conn_table d_conn_table; // our connections
@@ -145,6 +147,34 @@
mb_msg_queue &
msgq() { return d_msgq; }
+ //! Return full name of this block
+ std::string fullname() const { return d_fullname; }
+
+ //! Set the name of this block
+ void set_fullname(const std::string &name);
+
+ /*!
+ * \brief If bound, store endpoint from the other end of the connection.
+ *
+ * \param port [in] port the port that we're searching for.
+ * \param ep [out] the other end point from the matching connection.
+ *
+ * \returns true iff there's a matching connection.
+ */
+ bool
+ lookup_other_endpoint(const mb_port *port, mb_endpoint *ep);
+
+
+ mb_mblock *
+ mblock() const { return d_mb; }
+
+ mb_mblock *
+ mblock_parent() const { return d_mb_parent; }
+
+ mb_mblock_sptr
+ component(const std::string &comp_name);
+
+
/*
* Our implementation methods
*/
@@ -164,7 +194,8 @@
const std::string &port_name);
static bool
- ports_are_compatible(mb_port_sptr p0, mb_port_sptr p1);
+ endpoints_are_compatible(const mb_endpoint &ep0,
+ const mb_endpoint &ep1);
};
Modified: gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_msg_queue.cc
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_msg_queue.cc
2007-03-02 03:57:08 UTC (rev 4684)
+++ gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_msg_queue.cc
2007-03-02 03:57:30 UTC (rev 4685)
@@ -38,7 +38,7 @@
void
mb_msg_queue::insert(mb_message_sptr msg)
{
- // omni_mutex_lock l(d_mutex); FIXME
+ omni_mutex_lock l(d_mutex);
mb_pri_t q = mb_pri_clamp(msg->priority());
@@ -57,7 +57,7 @@
mb_message_sptr
mb_msg_queue::get_highest_pri_msg()
{
- // omni_mutex_lock l(d_mutex); FIXME
+ omni_mutex_lock l(d_mutex);
// FIXME use bitmap and ffz to find best queue in O(1)
Modified: gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_msg_queue.h
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_msg_queue.h
2007-03-02 03:57:08 UTC (rev 4684)
+++ gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_msg_queue.h
2007-03-02 03:57:30 UTC (rev 4685)
@@ -22,7 +22,7 @@
#define INCLUDED_MB_MSG_QUEUE_H
#include <mb_common.h>
-//#include <omnithread.h> FIXME
+#include <omnithread.h>
/*!
* \brief priority queue for mblock messages
@@ -37,7 +37,7 @@
bool empty_p() const { return head == 0; }
};
- // omni_mutex d_mutex; FIXME
+ omni_mutex d_mutex;
// FIXME add bitmap to indicate which queues are non-empty.
subq d_queue[MB_NPRI];
Modified: gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_port.cc
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_port.cc
2007-03-02 03:57:08 UTC (rev 4684)
+++ gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_port.cc
2007-03-02 03:57:30 UTC (rev 4685)
@@ -24,7 +24,6 @@
#endif
#include <mb_port.h>
-#include <mb_port_detail.h>
#include <mb_protocol_class.h>
mb_port::mb_port(mb_mblock *mblock,
Modified: gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_port.h
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_port.h
2007-03-02 03:57:08 UTC (rev 4684)
+++ gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_port.h
2007-03-02 03:57:30 UTC (rev 4685)
@@ -54,6 +54,8 @@
bool conjugated,
mb_port::port_type_t port_type);
+ mb_mblock *mblock() const { return d_mblock; }
+
public:
std::string port_name() const { return d_port_name; }
pmt_t protocol_class() const { return d_protocol_class; }
Deleted: gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_port_detail.cc
Deleted: gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_port_detail.h
Modified:
gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_port_simple.cc
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_port_simple.cc
2007-03-02 03:57:08 UTC (rev 4684)
+++ gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_port_simple.cc
2007-03-02 03:57:30 UTC (rev 4685)
@@ -25,7 +25,12 @@
#include <mb_port_simple.h>
#include <mb_msg_accepter.h>
+#include <mb_exception.h>
+#include <mb_mblock.h>
+#include <mb_mblock_impl.h>
+#include <assert.h>
+
mb_port_simple::mb_port_simple(mb_mblock *mblock,
const std::string &port_name,
const std::string &protocol_class_name,
@@ -43,17 +48,84 @@
void
mb_port_simple::send(pmt_t signal, pmt_t data, pmt_t metadata, mb_pri_t
priority)
{
- mb_msg_accepter_sptr accepter = find_accepter();
+ if (port_type() == mb_port::RELAY) // Can't send directly to a RELAY port
+ throw mbe_invalid_port_type(mblock(), mblock()->fullname(), port_name());
+
+ mb_msg_accepter_sptr accepter = find_accepter(this);
if (accepter)
(*accepter)(signal, data, metadata, priority);
}
+
mb_msg_accepter_sptr
-mb_port_simple::find_accepter()
+mb_port_simple::find_accepter(mb_port_simple *start)
{
+ mb_port_simple *p = start;
+ mb_port_simple *pp = 0;
+ mb_mblock *context = 0;
+ mb_endpoint peer_ep;
mb_msg_accepter_sptr r;
- // FIXME, actually do the work ;)
+ // Set up initial context.
- return r;
+ switch(p->port_type()){
+ case mb_port::INTERNAL: // binding is in our name space
+ context = p->mblock();
+ break;
+
+ case mb_port::EXTERNAL: // binding is in parent's name space
+ context = p->mblock()->parent();
+ break;
+
+ default:
+ throw std::logic_error("Can't happen: mb_port_simple::find_accepter [1]");
+ }
+
+
+ traverse:
+
+ if (!context->impl()->lookup_other_endpoint(p, &peer_ep))
+ return mb_msg_accepter_sptr(); // not bound
+
+ pp = dynamic_cast<mb_port_simple *>(peer_ep.port().get()); // peer port
+ assert(pp);
+
+ switch (pp->port_type()){
+ case mb_port::INTERNAL: // Terminate here.
+ case mb_port::EXTERNAL:
+ r = pp->make_accepter();
+ // FIXME cache the result
+ return r;
+
+ case mb_port::RELAY: // Traverse to other side of relay port.
+ if (peer_ep.inside_of_relay_port_p()){
+ // We're on inside of relay port, headed out.
+ p = pp;
+ context = p->mblock()->parent();
+
+ // Corner case: we're attempting to traverse a relay port on the border
+ // of the top block...
+ if (!context)
+ return mb_msg_accepter_sptr(); // not bound
+
+ goto traverse;
+ }
+ else {
+ // We're on the outside of relay port, headed in.
+ p = pp;
+ context = p->mblock();
+ goto traverse;
+ }
+ break;
+
+ default:
+ throw std::logic_error("Can't happen: mb_port_simple::find_accepter [2]");
+ }
}
+
+
+mb_msg_accepter_sptr
+mb_port_simple::make_accepter()
+{
+ return d_mblock->impl()->make_accepter(port_name());
+}
Modified: gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_port_simple.h
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_port_simple.h
2007-03-02 03:57:08 UTC (rev 4684)
+++ gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_port_simple.h
2007-03-02 03:57:30 UTC (rev 4685)
@@ -29,8 +29,11 @@
class mb_port_simple : public mb_port
{
protected:
+ static mb_msg_accepter_sptr
+ find_accepter(mb_port_simple *start);
+
mb_msg_accepter_sptr
- find_accepter();
+ make_accepter();
public:
mb_port_simple(mb_mblock *mblock,
Modified: gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_runtime.cc
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_runtime.cc
2007-03-02 03:57:08 UTC (rev 4684)
+++ gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_runtime.cc
2007-03-02 03:57:30 UTC (rev 4685)
@@ -24,29 +24,15 @@
#endif
#include <mb_runtime.h>
-#include <mb_runtime_impl.h>
+#include <mb_runtime_single_threaded.h>
mb_runtime_sptr
mb_make_runtime()
{
- return mb_runtime_sptr(new mb_runtime());
+ return mb_runtime_sptr(new mb_runtime_single_threaded());
}
-mb_runtime::mb_runtime()
- : d_impl(mb_runtime_impl_sptr(new mb_runtime_impl()))
-{
- // FIXME
-
-}
-
mb_runtime::~mb_runtime()
{
- // FIXME
+ // nop
}
-
-bool
-mb_runtime::run()
-{
- // FIXME
- return true;
-}
Modified: gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_runtime.h
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_runtime.h
2007-03-02 03:57:08 UTC (rev 4684)
+++ gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_runtime.h
2007-03-02 03:57:30 UTC (rev 4685)
@@ -24,40 +24,31 @@
#include <mb_common.h>
/*!
- * \brief Public constructor for mb_runtime.
+ * \brief Public constructor (factory) for mb_runtime objects.
*/
mb_runtime_sptr mb_make_runtime();
/*!
- * \brief Runtime support for m-blocks
+ * \brief Abstract runtime support for m-blocks
*
* There should generally be only a single instance of this class.
- *
- * It should be created by the top-level initialization code,
- * and that instance should be passed into the constructor of the
- * top-level mblock.
*/
class mb_runtime : boost::noncopyable
{
-private:
- mb_runtime_impl_sptr d_impl; // implementation details
-
- mb_runtime();
-
- friend mb_runtime_sptr mb_make_runtime();
-
public:
- ~mb_runtime();
+ mb_runtime(){}
+ virtual ~mb_runtime();
/*!
- * \brief Run the mblocks...
+ * \brief Run the mblock hierarchy rooted at \p top
*
* This routine turns into the m-block scheduler, and
* blocks until the system is shutdown.
*
+ * \param top top-level mblock
* \returns true if the system ran successfully.
*/
- bool run();
+ virtual bool run(mb_mblock_sptr top) = 0;
};
#endif /* INCLUDED_MB_RUNTIME_H */
Deleted:
gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_runtime_impl.cc
Deleted: gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_runtime_impl.h
Copied:
gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_runtime_single_threaded.cc
(from rev 4683, gnuradio/trunk/mblock/src/lib/mb_runtime_single_threaded.cc)
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_runtime_single_threaded.cc
(rev 0)
+++
gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_runtime_single_threaded.cc
2007-03-02 03:57:30 UTC (rev 4685)
@@ -0,0 +1,60 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 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 2, 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 <mb_runtime_single_threaded.h>
+#include <mb_mblock.h>
+
+
+mb_runtime_single_threaded::mb_runtime_single_threaded()
+{
+ // nop for now
+}
+
+mb_runtime_single_threaded::~mb_runtime_single_threaded()
+{
+ // nop for now
+}
+
+bool
+mb_runtime_single_threaded::run(mb_mblock_sptr top)
+{
+ class initial_visitor : public mb_visitor
+ {
+ public:
+ bool operator()(mb_mblock *mblock, const std::string &path)
+ {
+ mblock->set_fullname(path);
+ mblock->init_fsm();
+ return true;
+ }
+ };
+
+ initial_visitor visitor;
+
+ d_top = top; // remember top of tree
+
+ d_top->walk_tree(&visitor);
+
+ return true;
+}
Copied:
gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_runtime_single_threaded.h
(from rev 4683, gnuradio/trunk/mblock/src/lib/mb_runtime_single_threaded.h)
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_runtime_single_threaded.h
(rev 0)
+++
gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_runtime_single_threaded.h
2007-03-02 03:57:30 UTC (rev 4685)
@@ -0,0 +1,42 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 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 2, 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_MB_RUNTIME_SINGLE_THREADED_H
+#define INCLUDED_MB_RUNTIME_SINGLE_THREADED_H
+
+#include <mb_runtime.h>
+
+/*!
+ * \brief Concrete runtime that uses a single thread for all work.
+ */
+class mb_runtime_single_threaded : public mb_runtime
+{
+ mb_mblock_sptr d_top; // top mblock
+
+public:
+ mb_runtime_single_threaded();
+ ~mb_runtime_single_threaded();
+
+ bool run(mb_mblock_sptr top);
+};
+
+
+
+#endif /* INCLUDED_MB_RUNTIME_SINGLE_THREADED_H */
Modified: gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_util.cc
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_util.cc
2007-03-02 03:57:08 UTC (rev 4684)
+++ gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/mb_util.cc
2007-03-02 03:57:30 UTC (rev 4685)
@@ -30,5 +30,5 @@
mb_util::join_names(const std::string &comp_name,
const std::string &port_name)
{
- return comp_name + "/" + port_name;
+ return comp_name + ":" + port_name;
}
Modified: gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/qa_mblock.cc
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/qa_mblock.cc
2007-03-02 03:57:08 UTC (rev 4684)
+++ gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/qa_mblock.cc
2007-03-02 03:57:30 UTC (rev 4685)
@@ -26,6 +26,7 @@
#include <qa_mblock.h>
#include <qa_mblock_prims.h>
+#include <qa_mblock_send.h>
CppUnit::TestSuite *
qa_mblock::suite()
@@ -33,6 +34,7 @@
CppUnit::TestSuite *s = new CppUnit::TestSuite("mblock");
s->addTest (qa_mblock_prims::suite());
+ s->addTest (qa_mblock_send::suite());
return s;
}
Modified:
gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/qa_mblock_prims.cc
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/qa_mblock_prims.cc
2007-03-02 03:57:08 UTC (rev 4684)
+++ gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/qa_mblock_prims.cc
2007-03-02 03:57:30 UTC (rev 4685)
@@ -20,6 +20,10 @@
* Boston, MA 02111-1307, USA.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <qa_mblock_prims.h>
#include <cppunit/TestAssert.h>
#include <mb_mblock.h>
@@ -103,32 +107,16 @@
// define the protocol class
pmt_t pc = mb_make_protocol_class(pmt_intern("cs-protocol"),
- pmt_cons(pmt_intern("start"),
- pmt_cons(pmt_intern("stop"),
- PMT_NIL)),
+ pmt_list2(pmt_intern("start"),
+ pmt_intern("stop")),
PMT_NIL);
// std::cout << "pc = " << pc << '\n';
mb_mblock_sptr mb2 = mb_mblock_sptr(new dp_2());
- // intf = mb2->peer_interface();
- // CPPUNIT_ASSERT_EQUAL(size_t(1), intf.size());
- // CPPUNIT_ASSERT(pmt_eq(s_cs, intf[0]->port_name()));
-
-
// raises pmt_exception because of duplicate port definition of "cs"
CPPUNIT_ASSERT_THROW(mb_mblock_sptr(new dp_3()), mbe_duplicate_port);
-
-#if 0
- try {
- mb_mblock_sptr mb2 = mb_mblock_sptr(new dp_2());
- }
- catch (pmt_exception &e){
- std::cerr << e.msg() << ' ' << e.obj() << '\n';
- }
-#endif
-
}
// ================================================================
@@ -321,13 +309,13 @@
qa_mblock_prims::test_connect()
{
// define the protocol class
- mb_make_protocol_class(pmt_intern("data"), // name
of class
- pmt_cons(pmt_intern("data"), PMT_NIL), // in
- PMT_NIL); // out
+ mb_make_protocol_class(pmt_intern("data"), // name of class
+ pmt_list1(pmt_intern("data")), // in
+ PMT_NIL); // out
- mb_make_protocol_class(pmt_intern("i/o"), // name
of class
- pmt_cons(pmt_intern("in"), PMT_NIL), // in
- pmt_cons(pmt_intern("out"), PMT_NIL)); // out
+ mb_make_protocol_class(pmt_intern("i/o"), // name of class
+ pmt_list1(pmt_intern("in")), // in
+ pmt_list1(pmt_intern("out"))); // out
mb_runtime_sptr rt = mb_make_runtime();
@@ -416,4 +404,3 @@
CPPUNIT_ASSERT_EQUAL(1L,
pmt_to_long(mb->impl()->msgq().get_highest_pri_msg()->data()));
CPPUNIT_ASSERT_EQUAL(2L,
pmt_to_long(mb->impl()->msgq().get_highest_pri_msg()->data()));
}
-
Copied: gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/qa_mblock_send.cc
(from rev 4683, gnuradio/trunk/mblock/src/lib/qa_mblock_send.cc)
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/qa_mblock_send.cc
(rev 0)
+++ gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/qa_mblock_send.cc
2007-03-02 03:57:30 UTC (rev 4685)
@@ -0,0 +1,450 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,2007 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 2, 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <qa_mblock_send.h>
+#include <cppunit/TestAssert.h>
+#include <mb_mblock.h>
+#include <mb_runtime.h>
+#include <mb_protocol_class.h>
+#include <mb_exception.h>
+#include <mb_msg_queue.h>
+#include <mb_message.h>
+#include <mb_mblock_impl.h>
+#include <mb_msg_accepter.h>
+#include <stdio.h>
+
+static pmt_t s_data = pmt_intern("data");
+static pmt_t s_status = pmt_intern("status");
+static pmt_t s_control = pmt_intern("control");
+static pmt_t s_p0 = pmt_intern("p0");
+static pmt_t s_p1 = pmt_intern("p1");
+static pmt_t s_p2 = pmt_intern("p2");
+static pmt_t s_p3 = pmt_intern("p3");
+static pmt_t s_e1 = pmt_intern("e1");
+static pmt_t s_r1 = pmt_intern("r1");
+
+static void
+define_protocol_classes()
+{
+ // Defined from client point-of-view.
+ mb_make_protocol_class(pmt_intern("qa-send-cs"), // name
+ pmt_list1(s_status), // incoming
+ pmt_list1(s_control)); // outgoing
+
+}
+
+// ================================================================
+// test_simple_routing
+// ================================================================
+
+// sub-block for test_simple_routing
+
+class sr1 : public mb_mblock
+{
+ mb_port_sptr d_p1;
+ mb_port_sptr d_p2;
+ mb_port_sptr d_p3;
+
+public:
+ sr1();
+ ~sr1();
+ void init_fsm();
+};
+
+sr1::sr1()
+{
+ d_p1 = define_port("p1", "qa-send-cs", true, mb_port::EXTERNAL);
+ d_p2 = define_port("p2", "qa-send-cs", true, mb_port::EXTERNAL);
+ d_p3 = define_port("p3", "qa-send-cs", false, mb_port::EXTERNAL);
+}
+
+sr1::~sr1(){}
+
+void
+sr1::init_fsm()
+{
+ // std::cout << fullname() << "[sr1]: init_fsm\n";
+
+ // send two messages to each port
+ pmt_t our_name = pmt_intern(fullname());
+ d_p1->send(s_status, pmt_list3(our_name, s_p1, pmt_from_long(0)));
+ d_p1->send(s_status, pmt_list3(our_name, s_p1, pmt_from_long(1)));
+
+ d_p2->send(s_status, pmt_list3(our_name, s_p2, pmt_from_long(0)));
+ d_p2->send(s_status, pmt_list3(our_name, s_p2, pmt_from_long(1)));
+}
+
+// ----------------------------------------------------------------
+
+// top-level container block for test_simple_routing
+class sr0 : public mb_mblock
+{
+ mb_port_sptr d_p0;
+
+public:
+ sr0();
+ ~sr0();
+ void init_fsm();
+};
+
+sr0::sr0()
+{
+ d_p0 = define_port("p0", "qa-send-cs", false, mb_port::INTERNAL);
+
+ define_component("mb1", mb_mblock_sptr(new sr1()));
+ define_component("mb2", mb_mblock_sptr(new sr1()));
+
+ connect("self", "p0", "mb1", "p1");
+ connect("mb1", "p2", "mb2", "p3");
+ connect("mb1", "p3", "mb2", "p2");
+}
+
+sr0::~sr0(){}
+
+void
+sr0::init_fsm()
+{
+ // std::cout << fullname() << "[sr0]: init_fsm\n";
+
+ // send two messages to p0
+ pmt_t our_name = pmt_intern(fullname());
+ d_p0->send(s_control, pmt_list3(our_name, s_p0, pmt_from_long(0)));
+ d_p0->send(s_control, pmt_list3(our_name, s_p0, pmt_from_long(1)));
+}
+
+// ----------------------------------------------------------------
+
+/*
+ * This tests basic message routing using INTERNAL and EXTERNAL ports.
+ * It does not rely on the guts of the runtime being complete,
+ * which is good, because at the time this is being written, it isn't.
+ */
+void
+qa_mblock_send::test_simple_routing()
+{
+ define_protocol_classes();
+
+ mb_message_sptr msg;
+
+ mb_runtime_sptr rt = mb_make_runtime();
+ mb_mblock_sptr mb0 = mb_mblock_sptr(new sr0());
+ rt->run(mb0);
+
+ // Reach into the guts and see if the messages ended up where they should
have
+
+ // mb0 should have received two messages sent from mb1 via its p1
+ msg = mb0->impl()->msgq().get_highest_pri_msg();
+ CPPUNIT_ASSERT(msg);
+ // std::cerr << msg->data() << std::endl;
+ CPPUNIT_ASSERT_EQUAL(s_p0, msg->port_id());
+ CPPUNIT_ASSERT(pmt_equal(pmt_list3(pmt_intern("top/mb1"), s_p1,
pmt_from_long(0)),
+ msg->data()));
+
+ msg = mb0->impl()->msgq().get_highest_pri_msg();
+ CPPUNIT_ASSERT(msg);
+ // std::cerr << msg->data() << std::endl;
+ CPPUNIT_ASSERT_EQUAL(s_p0, msg->port_id());
+ CPPUNIT_ASSERT(pmt_equal(pmt_list3(pmt_intern("top/mb1"), s_p1,
pmt_from_long(1)),
+ msg->data()));
+
+ // mb1 should have received
+ // two messages from mb0 via its p0 and
+ // two messages from mb2 via its p3
+
+ mb_mblock_sptr mb1 = mb0->impl()->component("mb1");
+
+ msg = mb1->impl()->msgq().get_highest_pri_msg();
+ CPPUNIT_ASSERT(msg);
+ // std::cerr << msg->data() << std::endl;
+ CPPUNIT_ASSERT_EQUAL(s_p1, msg->port_id());
+ CPPUNIT_ASSERT(pmt_equal(pmt_list3(pmt_intern("top"), s_p0,
pmt_from_long(0)),
+ msg->data()));
+
+ msg = mb1->impl()->msgq().get_highest_pri_msg();
+ CPPUNIT_ASSERT(msg);
+ // std::cerr << msg->data() << std::endl;
+ CPPUNIT_ASSERT_EQUAL(s_p1, msg->port_id());
+ CPPUNIT_ASSERT(pmt_equal(pmt_list3(pmt_intern("top"), s_p0,
pmt_from_long(1)),
+ msg->data()));
+
+ msg = mb1->impl()->msgq().get_highest_pri_msg();
+ CPPUNIT_ASSERT(msg);
+ // std::cerr << msg->data() << std::endl;
+ CPPUNIT_ASSERT_EQUAL(s_p3, msg->port_id());
+ CPPUNIT_ASSERT(pmt_equal(pmt_list3(pmt_intern("top/mb2"), s_p2,
pmt_from_long(0)),
+ msg->data()));
+
+ msg = mb1->impl()->msgq().get_highest_pri_msg();
+ CPPUNIT_ASSERT(msg);
+ // std::cerr << msg->data() << std::endl;
+ CPPUNIT_ASSERT_EQUAL(s_p3, msg->port_id());
+ CPPUNIT_ASSERT(pmt_equal(pmt_list3(pmt_intern("top/mb2"), s_p2,
pmt_from_long(1)),
+ msg->data()));
+
+
+ // mb2 should have received
+ // two messages from mb2 via its p2
+
+ mb_mblock_sptr mb2 = mb0->impl()->component("mb2");
+
+ msg = mb2->impl()->msgq().get_highest_pri_msg();
+ CPPUNIT_ASSERT(msg);
+ // std::cerr << msg->data() << std::endl;
+ CPPUNIT_ASSERT_EQUAL(s_p3, msg->port_id());
+ CPPUNIT_ASSERT(pmt_equal(pmt_list3(pmt_intern("top/mb1"), s_p2,
pmt_from_long(0)),
+ msg->data()));
+
+ msg = mb2->impl()->msgq().get_highest_pri_msg();
+ CPPUNIT_ASSERT(msg);
+ // std::cerr << msg->data() << std::endl;
+ CPPUNIT_ASSERT_EQUAL(s_p3, msg->port_id());
+ CPPUNIT_ASSERT(pmt_equal(pmt_list3(pmt_intern("top/mb1"), s_p2,
pmt_from_long(1)),
+ msg->data()));
+}
+
+// ================================================================
+// test_relay_routing_1
+// ================================================================
+
+// internal block for test_relay_routing
+
+class rr2 : public mb_mblock
+{
+ mb_port_sptr d_p1;
+ mb_port_sptr d_p2;
+
+public:
+ rr2();
+ ~rr2();
+ void init_fsm();
+};
+
+rr2::rr2()
+{
+ d_p1 = define_port("p1", "qa-send-cs", true, mb_port::EXTERNAL);
+ d_p2 = define_port("p2", "qa-send-cs", false, mb_port::EXTERNAL);
+}
+
+rr2::~rr2(){}
+
+void
+rr2::init_fsm()
+{
+ // std::cout << fullname() << "[rr2]: init_fsm\n";
+
+ // send two messages via p1
+ pmt_t our_name = pmt_intern(fullname());
+ d_p1->send(s_status, pmt_list3(our_name, s_p1, pmt_from_long(0)));
+ d_p1->send(s_status, pmt_list3(our_name, s_p1, pmt_from_long(1)));
+}
+
+// ----------------------------------------------------------------
+
+// intermediate block for test_relay_routing
+
+class rr1 : public mb_mblock
+{
+ mb_port_sptr d_p1;
+ mb_port_sptr d_p2;
+
+public:
+ rr1();
+ ~rr1();
+};
+
+rr1::rr1()
+{
+ d_p1 = define_port("p1", "qa-send-cs", true, mb_port::RELAY);
+ d_p2 = define_port("p2", "qa-send-cs", false, mb_port::RELAY);
+
+ define_component("c0", mb_mblock_sptr(new rr2()));
+
+ connect("self", "p1", "c0", "p1");
+ connect("self", "p2", "c0", "p2");
+}
+
+rr1::~rr1(){}
+
+// ----------------------------------------------------------------
+
+// top-level container for test_relay_routing
+
+class rr0_a : public mb_mblock
+{
+public:
+ rr0_a();
+ ~rr0_a();
+};
+
+rr0_a::rr0_a()
+{
+ define_component("c0", mb_mblock_sptr(new rr1()));
+ define_component("c1", mb_mblock_sptr(new rr2()));
+
+ connect("c0", "p1", "c1", "p2");
+ connect("c0", "p2", "c1", "p1");
+}
+
+rr0_a::~rr0_a(){}
+
+
+/*
+ * This tests basic message routing using RELAY and EXTERNAL ports.
+ * It does not rely on the guts of the runtime being complete,
+ * which is good, because at the time this is being written, it isn't.
+ */
+void
+qa_mblock_send::test_relay_routing_1()
+{
+ mb_message_sptr msg;
+
+ mb_runtime_sptr rt = mb_make_runtime();
+ mb_mblock_sptr top = mb_mblock_sptr(new rr0_a());
+ rt->run(top);
+
+ // Reach into the guts and see if the messages ended up where they should
have
+
+ mb_mblock_sptr c0 = top->impl()->component("c0");
+ mb_mblock_sptr c0c0 = c0->impl()->component("c0");
+
+ mb_mblock_sptr c1 = top->impl()->component("c1");
+
+ // c0c0 should have received
+ // two message from c1 via its p2
+
+ msg = c0c0->impl()->msgq().get_highest_pri_msg();
+ CPPUNIT_ASSERT(msg);
+ //std::cerr << msg->data() << std::endl;
+ CPPUNIT_ASSERT_EQUAL(s_p2, msg->port_id());
+ CPPUNIT_ASSERT(pmt_equal(pmt_list3(pmt_intern("top/c1"), s_p1,
pmt_from_long(0)),
+ msg->data()));
+
+ msg = c0c0->impl()->msgq().get_highest_pri_msg();
+ CPPUNIT_ASSERT(msg);
+ //std::cerr << msg->data() << std::endl;
+ CPPUNIT_ASSERT_EQUAL(s_p2, msg->port_id());
+ CPPUNIT_ASSERT(pmt_equal(pmt_list3(pmt_intern("top/c1"), s_p1,
pmt_from_long(1)),
+ msg->data()));
+
+ // c1 should have received
+ // two message from c0c0 via its p2
+
+ msg = c1->impl()->msgq().get_highest_pri_msg();
+ CPPUNIT_ASSERT(msg);
+ //std::cerr << msg->data() << std::endl;
+ CPPUNIT_ASSERT_EQUAL(s_p2, msg->port_id());
+ CPPUNIT_ASSERT(pmt_equal(pmt_list3(pmt_intern("top/c0/c0"), s_p1,
pmt_from_long(0)),
+ msg->data()));
+
+ msg = c1->impl()->msgq().get_highest_pri_msg();
+ CPPUNIT_ASSERT(msg);
+ //std::cerr << msg->data() << std::endl;
+ CPPUNIT_ASSERT_EQUAL(s_p2, msg->port_id());
+ CPPUNIT_ASSERT(pmt_equal(pmt_list3(pmt_intern("top/c0/c0"), s_p1,
pmt_from_long(1)),
+ msg->data()));
+}
+
+// ================================================================
+// test_relay_routing_2
+// ================================================================
+
+// top-level container for test_relay_routing_2
+
+class rr0_b : public mb_mblock
+{
+public:
+ rr0_b();
+ ~rr0_b();
+};
+
+rr0_b::rr0_b()
+{
+ define_component("c0", mb_mblock_sptr(new rr1()));
+ define_component("c1", mb_mblock_sptr(new rr1()));
+
+ connect("c0", "p1", "c1", "p2");
+ connect("c0", "p2", "c1", "p1");
+}
+
+rr0_b::~rr0_b(){}
+
+
+/*
+ * This tests basic message routing using RELAY and EXTERNAL ports.
+ * It does not rely on the guts of the runtime being complete,
+ * which is good, because at the time this is being written, it isn't.
+ */
+void
+qa_mblock_send::test_relay_routing_2()
+{
+ mb_message_sptr msg;
+
+ mb_runtime_sptr rt = mb_make_runtime();
+ mb_mblock_sptr top = mb_mblock_sptr(new rr0_b());
+ rt->run(top);
+
+ // Reach into the guts and see if the messages ended up where they should
have
+
+ mb_mblock_sptr c0 = top->impl()->component("c0");
+ mb_mblock_sptr c0c0 = c0->impl()->component("c0");
+
+ mb_mblock_sptr c1 = top->impl()->component("c1");
+ mb_mblock_sptr c1c0 = c1->impl()->component("c0");
+
+ // c0c0 should have received
+ // two message from c1c0 via its p2
+
+ msg = c0c0->impl()->msgq().get_highest_pri_msg();
+ CPPUNIT_ASSERT(msg);
+ // std::cerr << msg->data() << std::endl;
+ CPPUNIT_ASSERT_EQUAL(s_p2, msg->port_id());
+ CPPUNIT_ASSERT(pmt_equal(pmt_list3(pmt_intern("top/c1/c0"), s_p1,
pmt_from_long(0)),
+ msg->data()));
+
+ msg = c0c0->impl()->msgq().get_highest_pri_msg();
+ CPPUNIT_ASSERT(msg);
+ // std::cerr << msg->data() << std::endl;
+ CPPUNIT_ASSERT_EQUAL(s_p2, msg->port_id());
+ CPPUNIT_ASSERT(pmt_equal(pmt_list3(pmt_intern("top/c1/c0"), s_p1,
pmt_from_long(1)),
+ msg->data()));
+
+ // c1c0 should have received
+ // two message from c0c0 via its p2
+
+ msg = c1c0->impl()->msgq().get_highest_pri_msg();
+ CPPUNIT_ASSERT(msg);
+ // std::cerr << msg->data() << std::endl;
+ CPPUNIT_ASSERT_EQUAL(s_p2, msg->port_id());
+ CPPUNIT_ASSERT(pmt_equal(pmt_list3(pmt_intern("top/c0/c0"), s_p1,
pmt_from_long(0)),
+ msg->data()));
+
+ msg = c1c0->impl()->msgq().get_highest_pri_msg();
+ CPPUNIT_ASSERT(msg);
+ // std::cerr << msg->data() << std::endl;
+ CPPUNIT_ASSERT_EQUAL(s_p2, msg->port_id());
+ CPPUNIT_ASSERT(pmt_equal(pmt_list3(pmt_intern("top/c0/c0"), s_p1,
pmt_from_long(1)),
+ msg->data()));
+}
Copied: gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/qa_mblock_send.h
(from rev 4683, gnuradio/trunk/mblock/src/lib/qa_mblock_send.h)
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/qa_mblock_send.h
(rev 0)
+++ gnuradio/branches/developers/n4hy/ofdm/mblock/src/lib/qa_mblock_send.h
2007-03-02 03:57:30 UTC (rev 4685)
@@ -0,0 +1,43 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006,2007 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 2, 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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#ifndef INCLUDED_QA_MBLOCK_SEND_H
+#define INCLUDED_QA_MBLOCK_SEND_H
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_mblock_send : public CppUnit::TestCase {
+
+ CPPUNIT_TEST_SUITE(qa_mblock_send);
+ CPPUNIT_TEST(test_simple_routing);
+ CPPUNIT_TEST(test_relay_routing_1);
+ CPPUNIT_TEST(test_relay_routing_2);
+ CPPUNIT_TEST_SUITE_END();
+
+ private:
+ void test_simple_routing();
+ void test_relay_routing_1();
+ void test_relay_routing_2();
+};
+
+#endif /* INCLUDED_QA_MBLOCK_SEND_H */
+
Modified: gnuradio/branches/developers/n4hy/ofdm/pmt/src/lib/Makefile.am
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/pmt/src/lib/Makefile.am
2007-03-02 03:57:08 UTC (rev 4684)
+++ gnuradio/branches/developers/n4hy/ofdm/pmt/src/lib/Makefile.am
2007-03-02 03:57:30 UTC (rev 4685)
@@ -89,12 +89,8 @@
# magic flags
libpmt_qa_la_LDFLAGS = $(NO_UNDEFINED) -avoid-version
-# link the library against the c++ standard library
-# Note: Win32 libtool doesn't pull dependencies from the .la file
-# correctly, so we must add $(PMT_LIBS) below
libpmt_qa_la_LIBADD = \
libpmt.la \
- $(PMT_LIBS) \
$(CPPUNIT_LIBS) \
-lstdc++
Modified: gnuradio/branches/developers/n4hy/ofdm/pmt/src/lib/pmt.cc
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/pmt/src/lib/pmt.cc 2007-03-02
03:57:08 UTC (rev 4684)
+++ gnuradio/branches/developers/n4hy/ofdm/pmt/src/lib/pmt.cc 2007-03-02
03:57:30 UTC (rev 4685)
@@ -841,3 +841,27 @@
}
return true;
}
+
+pmt_t
+pmt_list1(pmt_t x1)
+{
+ return pmt_cons(x1, PMT_NIL);
+}
+
+pmt_t
+pmt_list2(pmt_t x1, pmt_t x2)
+{
+ return pmt_cons(x1, pmt_cons(x2, PMT_NIL));
+}
+
+pmt_t
+pmt_list3(pmt_t x1, pmt_t x2, pmt_t x3)
+{
+ return pmt_cons(x1, pmt_cons(x2, pmt_cons(x3, PMT_NIL)));
+}
+
+pmt_t
+pmt_list4(pmt_t x1, pmt_t x2, pmt_t x3, pmt_t x4)
+{
+ return pmt_cons(x1, pmt_cons(x2, pmt_cons(x3, pmt_cons(x4, PMT_NIL))));
+}
Modified: gnuradio/branches/developers/n4hy/ofdm/pmt/src/lib/pmt.h
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/pmt/src/lib/pmt.h 2007-03-02
03:57:08 UTC (rev 4684)
+++ gnuradio/branches/developers/n4hy/ofdm/pmt/src/lib/pmt.h 2007-03-02
03:57:30 UTC (rev 4685)
@@ -548,6 +548,26 @@
*/
bool pmt_subsetp(pmt_t list1, pmt_t list2);
+/*!
+ * \brief Return a list of length 1 containing \p x1
+ */
+pmt_t pmt_list1(pmt_t x1);
+
+/*!
+ * \brief Return a list of length 2 containing \p x1, \p x2
+ */
+pmt_t pmt_list2(pmt_t x1, pmt_t x2);
+
+/*!
+ * \brief Return a list of length 3 containing \p x1, \p x2, \p x3
+ */
+pmt_t pmt_list3(pmt_t x1, pmt_t x2, pmt_t x3);
+
+/*!
+ * \brief Return a list of length 4 containing \p x1, \p x2, \p x3, \p x4
+ */
+pmt_t pmt_list4(pmt_t x1, pmt_t x2, pmt_t x3, pmt_t x4);
+
/*
* ------------------------------------------------------------------------
* read / write
Modified: gnuradio/branches/developers/n4hy/ofdm/run_tests.sh.in
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/run_tests.sh.in 2007-03-02
03:57:08 UTC (rev 4684)
+++ gnuradio/branches/developers/n4hy/ofdm/run_tests.sh.in 2007-03-02
03:57:30 UTC (rev 4685)
@@ -23,6 +23,10 @@
# Where to find core's python modules
address@hidden@/gnuradio-core/src/python
+# Construct search path for python modules
+PYTHONPATH="$mylibdir:$mysrcdir:$mypydir:$grswigdir:$grswigsrcdir:$grpydir:$PYTHONPATH"
+export PYTHONPATH
+
# Where to find core's master library files and dependencies
address@hidden@/omnithread
gromnidir=$gromnidir:$gromnidir/.libs
@@ -30,12 +34,8 @@
grcoredir=$grcoredir:$grcoredir/.libs
grlibdir=$gromnidir:$grcoredir
-# Construct search path for python modules
-PYTHONPATH="$mylibdir:$mysrcdir:$mypydir:$grswigdir:$grswigsrcdir:$grpydir:$PYTHONPATH"
-export PYTHONPATH
-
# For OS/X
-DYLD_LIBRARY_PATH=$grlibdir
+DYLD_LIBRARY_PATH=$grlibdir:$DYLD_LIBRARY_PATH
export DYLD_LIBRARY_PATH
# For Win32
Copied: gnuradio/branches/developers/n4hy/ofdm/usrp/doc/inband-signaling-usb
(from rev 4683, gnuradio/trunk/usrp/doc/inband-signaling-usb)
===================================================================
--- gnuradio/branches/developers/n4hy/ofdm/usrp/doc/inband-signaling-usb
(rev 0)
+++ gnuradio/branches/developers/n4hy/ofdm/usrp/doc/inband-signaling-usb
2007-03-02 03:57:30 UTC (rev 4685)
@@ -0,0 +1,314 @@
+This file specifies the format of USB packets used for in-band data
+transmission and signaling on the USRP. All packets are 512-byte long,
+and are transfered using USB "bulk" transfers.
+
+IN packets are sent towards the host.
+OUT packets are sent away from the host.
+
+The layout is 32-bits wide. All data is transmitted in little-endian
+format across the USB.
+
+
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ |O|U|D|S|E| RSSI | Chan | mbz | Tag | Payload Len |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Timestamp |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | |
+ + +
+ | Payload |
+ . .
+ . .
+ . .
+ | |
+ + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | ... | .
+ +-+-+-+-+-+-+-+ .
+ . .
+ . Padding .
+ . .
+ | |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+
+ mbz Must be Zero: these bits must be zero in both IN and OUT packets.
+
+ O Overrun Flag: set in an IN packet if an overrun condition was
+ detected. Must be zero in OUT packets. Overrun occurs when
+ the FPGA has data to transmit to the host and there is no
+ buffer space available. This generally indicates a problem on
+ the host. Either it is not keeping up, or it has configured
+ the FPGA to transmit data at a higher rate than the transport
+ (USB) can support.
+
+ U Underrun Flag: set in an IN packet if an underrun condition
+ was detected. Must be zero in OUT packets. Underrun occurs
+ when the FPGA runs out of samples, and it's not between
+ bursts. See the "End of Burst flag" below.
+
+ D Dropped Packet Flag: Set in an IN packet if the FPGA
+ discarded an OUT packet because its timestamp had already
+ passed.
+
+ S Start of Burst Flag: Set in an OUT packet if the data is the
+ first segment of what is logically a continuous burst of data.
+ Must be zero in IN packets.
+
+ E End of Burst Flag: Set in an OUT packet if the data is the
+ last segment of what is logically a continuous burst of data.
+ Must be zero in IN packets. Underruns are not reported
+ when the FPGA runs out of samples between bursts.
+
+
+ RSSI 6-bit Received Strength Signal Indicator: Must be zero in OUT
+ packets. In IN packets, indicates RSSI as reported by front end.
+ FIXME The format and interpretation are to be determined.
+
+ Chan 5-bit logical channel number. Channel number 0x1f is reserved
+ for control information. See "Control Channel" below. Other
+ channels are "data channels." Each data channel is logically
+ independent of the others. A data channel payload field
+ contains a sequence of homogeneous samples. The format of the
+ samples is determined by the configuration associated with the
+ given channel. It is often the case that the payload field
+ contains 32-bit complex samples, each containing 16-bit real
+ and imaginary components.
+
+ Tag 4-bit tag for matching IN packets with OUT packets.
+ [FIXME, write more...]
+
+ Payload Len: 9-bit field that specifies the length of the payload
+ field in bytes. Must be in the range 0 to 504 inclusive.
+
+ Timestamp: 32-bit timestamp.
+ On IN packets, the timestamp indicates the time at which the
+ first sample of the packet was produced by the A/D converter(s)
+ for that channel. On OUT packets, the timestamp specifies the
+ time at which the first sample in the packet should go out the
+ D/A converter(s) for that channel. If a packet reaches the
+ head of the transmit queue, and the current time is later than
+ the timestamp, an error is assumed to have occurred and the
+ packet is discarded. As a special case, the timestamp
+ 0xffffffff is interpreted as "Now".
+
+ The time base is a free running 32-bit counter that is
+ incremented by the A/D sample-clock.
+
+ Payload: Variable length field. Length is specified by the
+ Payload Len field.
+
+ Padding: This field is 504 - Payload Len bytes long, and its content
+ is unspecified. This field pads the packet out to a constant
+ 512 bytes.
+
+
+
+"Data Channel" payload format:
+-------------------------------
+
+If Chan != 0x1f, the packet is a "data packet" and the payload is a
+sequence of homogeneous samples. The format of the samples is
+determined by the configuration associated with the given channel.
+It is often the case that the payload field contains 32-bit complex
+samples, each containing 16-bit real and imaginary components.
+
+
+"Control Channel" payload format:
+---------------------------------
+
+If Chan == 0x1f, the packet is a "control packet". The control channel
+payload consists of a sequence of 0 or more sub-packets.
+
+Each sub-packet starts on a 32-bit boundary, and consists of an 8-bit
+Opcode field, an 8-bit Length field, Length bytes of arguments, and 0,
+1, 2 or 3 bytes of padding to align the tail of the sub-packet to
+a 32-bit boundary.
+
+Control channel packets shall be processed at the head of the queue,
+and shall observe the timestamp semantics described above.
+
+
+General sub-packet format:
+--------------------------
+
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-//-+-+-+-+-+-+-+-+
+ | Opcode | Length | <length bytes> ... |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-//-+-+-+-+-+-+-+-+
+
+
+Specific sub-packet formats:
+----------------------------
+
+ RID: 6-bit Request-ID. Copied from request sub-packet into corresponding
+ reply sub-packet. RID allows the host to match requests and replies.
+
+ Reg Number: 10-bit Register Number.
+
+
+
+Ping Fixed Length:
+
+ Opcode: OP_PING_FIXED
+
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Opcode | 2 | RID | Ping Value |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+
+Ping Fixed Length Reply:
+
+ Opcode: OP_PING_FIXED_REPLY
+
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Opcode | 2 | RID | Ping Value |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+
+Write Register:
+
+ Opcode: OP_WRITE_REG
+
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Opcode | 6 | mbz | Reg Number |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Register Value |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+
+Write Register Masked:
+
+ Opcode: OP_WRITE_REG_MASKED
+
+ REG[Num] = (REG[Num] & ~Mask) | (Value & Mask)
+
+ That is, only the register bits that correspond to 1's in the
+ mask are written with the new value.
+
+
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Opcode | 10 | mbz | Reg Number |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Register Value |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Mask Value |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+
+Read Register:
+
+ Opcode: OP_READ_REG
+
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Opcode | 2 | RID | Reg Number |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+
+Read Register Reply:
+
+ Opcode: OP_READ_REG_REPLY
+
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Opcode | 6 | RID | Reg Number |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Register Value |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+
+I2C Write:
+
+ Opcode: OP_I2C_WRITE
+ I2C Addr: 7-bit I2C address
+ Data: The bytes to write to the I2C bus
+ Length: Length of Data + 2
+
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Opcode | Length | mbz | I2C Addr |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Data ... .
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+
+I2C Read:
+
+ Opcode: OP_I2C_READ
+ I2C Addr: 7-bit I2C address
+ Nbytes: Number of bytes to read from I2C bus
+
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Opcode | 3 | RID | mbz | I2C Addr |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Nbytes | unspecified padding |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+
+I2C Read Reply:
+
+ Opcode: OP_I2C_READ_REPLY
+ I2C Addr: 7-bit I2C address
+ Data: Length - 2 bytes of data read from I2C bus.
+
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Opcode | Length | RID | mbz | I2C Addr |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Data ... .
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+
+SPI Write:
+
+ Opcode: OP_SPI_WRITE
+ Enables: Which SPI enables to assert (mask)
+ Format: Specifies format of SPI data and Opt Header Bytes
+ Opt Header Bytes: 2-byte field containing optional Tx bytes; see Format
+ Data: The bytes to write to the SPI bus
+ Length: Length of Data + 6
+
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Opcode | Length | mbz |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Enables | Format | Opt Header Bytes |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Data ... .
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+
+SPI Read:
+
+ Opcode: OP_SPI_READ
+ Enables: Which SPI enables to assert (mask)
+ Format: Specifies format of SPI data and Opt Header Bytes
+ Opt Header Bytes: 2-byte field containing optional Tx bytes; see Format
+ Nbytes: Number of bytes to read from SPI bus.
+
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Opcode | 7 | RID | mbz |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Enables | Format | Opt Header Bytes |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Nbytes | unspecified padding |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+
+SPI Read Reply:
+
+ Opcode: OP_SPI_READ_REPLY
+ Data: Length - 2 bytes of data read from SPI bus.
+
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Opcode | Length | RID | mbz |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Data ... .
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+
+Delay:
+
+ Opcode: OP_DELAY
+ Ticks: 16-bit unsigned delay count
+
+ Delay Ticks clock ticks before executing next operation.
+
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ | Opcode | 2 | Ticks |
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
Modified:
gnuradio/branches/developers/n4hy/ofdm/usrp/fpga/toplevel/usrp_std/usrp_std_config_2rxhb_2tx.vh
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm/usrp/fpga/toplevel/usrp_std/usrp_std_config_2rxhb_2tx.vh
2007-03-02 03:57:08 UTC (rev 4684)
+++
gnuradio/branches/developers/n4hy/ofdm/usrp/fpga/toplevel/usrp_std/usrp_std_config_2rxhb_2tx.vh
2007-03-02 03:57:30 UTC (rev 4685)
@@ -37,7 +37,7 @@
//`define TX_HB_ON
// ------------------------------------------------------------
-// IF RX_ON is not defined, there is *no* transmit circuitry built
+// IF RX_ON is not defined, there is *no* receive circuitry built
`define RX_ON
// ------------------------------------------------------------
Modified:
gnuradio/branches/developers/n4hy/ofdm/usrp/fpga/toplevel/usrp_std/usrp_std_config_4rx_0tx.vh
===================================================================
---
gnuradio/branches/developers/n4hy/ofdm/usrp/fpga/toplevel/usrp_std/usrp_std_config_4rx_0tx.vh
2007-03-02 03:57:08 UTC (rev 4684)
+++
gnuradio/branches/developers/n4hy/ofdm/usrp/fpga/toplevel/usrp_std/usrp_std_config_4rx_0tx.vh
2007-03-02 03:57:30 UTC (rev 4685)
@@ -37,7 +37,7 @@
//`define TX_HB_ON
// ------------------------------------------------------------
-// IF RX_ON is not defined, there is *no* transmit circuitry built
+// IF RX_ON is not defined, there is *no* receive circuitry built
`define RX_ON
// ------------------------------------------------------------
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r4685 - in gnuradio/branches/developers/n4hy/ofdm: . config gnuradio-core/src/lib gnuradio-core/src/lib/general gnuradio-core/src/lib/gengen gnuradio-core/src/lib/runtime gnuradio-core/src/lib/swig gnuradio-core/src/python/gnuradio/gr gnuradio-core/src/tests gnuradio-examples/c++/dial_tone gnuradio-examples/python/audio gnuradio-examples/python/hier gnuradio-examples/python/hier/networking gnuradio-examples/python/hier/sounder gnuradio-examples/python/hier/usrp gnuradio-examples/python/multi_usrp gr-atsc/src/lib gr-audio-alsa/src gr-audio-jack/src gr-audio-oss/src gr-audio-osx/src gr-audio-portaudio/src gr-audio-windows/src gr-comedi/src gr-ezdop/src/lib gr-gsm-fr-vocoder/src/lib gr-howto-write-a-block/config gr-pager/src gr-qtgui gr-qtgui/src gr-qtgui/src/lib gr-radio-astronomy/src/lib gr-trellis/src/lib gr-usrp/src gr-video-sdl/src gr-wxgui/src/python mblock/src/lib pmt/src/lib usrp/doc usrp/fpga/toplevel/usrp_std,
n4hy <=