diff options
138 files changed, 7758 insertions, 2993 deletions
diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..49a0e1424 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,9 @@ +# +# The following turn off LF->CRLF conversion for some files on Windows. +# these conversions cause syntax errors on MinGW/MSYS. They should not +# have any effect on non-Windows systems or on Cygwin. Any files that +# required svn:eof-style=lf under subversion should be included here. +# +*.m4 -crlf +*.ac -crlf +*.scm -crlf diff --git a/.gitignore b/.gitignore index b333709ee..dba263ac2 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,7 @@ *.lo *.py[oc] *.gz +*.exe *.patch *~ \#*# @@ -23,6 +24,7 @@ .libs TAGS *-stamp +!.gitattributes !.gitignore make.log /configure diff --git a/Makefile.common b/Makefile.common index e36b49e8e..aca56b34a 100644 --- a/Makefile.common +++ b/Makefile.common @@ -108,7 +108,7 @@ exampledir = $(datadir)/gnuradio/examples # Base directory for documentation (docdir undefined in autoconf < 1.60) docdir ?= $(datadir)/doc/$(PACKAGE) -gr_docdir = $(docdir)-$(VERSION) +gr_docdir = $(docdir)-$(DOCVER) # System configuration files gr_prefsdir = $(GR_PREFSDIR) diff --git a/config/gr_fortran.m4 b/config/gr_fortran.m4 index a558b2f7e..031052043 100644 --- a/config/gr_fortran.m4 +++ b/config/gr_fortran.m4 @@ -28,6 +28,6 @@ AC_DEFUN([GR_FORTRAN],[ then AC_PROG_F77 AC_F77_LIBRARY_LDFLAGS - AC_PROG_CC dnl bux fix to restore $ac_ext fi + AC_PROG_CC dnl bux fix to restore $ac_ext ]) diff --git a/config/gr_pwin32.m4 b/config/gr_pwin32.m4 index 7b99cba6b..495e9dd4d 100644 --- a/config/gr_pwin32.m4 +++ b/config/gr_pwin32.m4 @@ -99,6 +99,9 @@ struct timespec { long tv_nsec; }; #endif +#if HAVE_UNISTD_H +#include <unistd.h> +#endif static inline int nanosleep(const struct timespec *req, struct timespec *rem) { return usleep(req->tv_sec*1000000+req->tv_nsec/1000); } #endif diff --git a/config/gr_python.m4 b/config/gr_python.m4 index 7479f0533..43ccfc015 100644 --- a/config/gr_python.m4 +++ b/config/gr_python.m4 @@ -123,6 +123,12 @@ print path ;; esac + case $host_os in + *mingw* ) + # Python 2.5 requires ".pyd" instead of ".dll" for extensions + PYTHON_LDFLAGS="-shrext .pyd ${PYTHON_LDFLAGS}" + esac + AC_SUBST(PYTHON_LDFLAGS) fi ]) diff --git a/config/gr_set_md_cpu.m4 b/config/gr_set_md_cpu.m4 index d8714c4a7..7ebf88a66 100644 --- a/config/gr_set_md_cpu.m4 +++ b/config/gr_set_md_cpu.m4 @@ -50,8 +50,32 @@ AC_DEFUN([GR_SET_MD_CPU],[ AC_ARG_WITH(md-cpu, AC_HELP_STRING([--with-md-cpu=ARCH],[set machine dependent speedups (auto)]), [cf_with_md_cpu="$withval"], - [cf_with_md_cpu="$host_cpu"]) - + [ + dnl see if the user has specified --host or --build, via 'cross_compiling' + if test "$cross_compiling" != no; then + dnl when cross-compiling, because the user specified it either via + dnl --target or --build, just keep the user's specs & hope for the best. + cf_with_md_cpu="$host_cpu" + else + dnl when the user didn't specify --target or --build, on Darwin 10 + dnl (OSX 10.6.0 and .1) and GNU libtoool 2.2.6, 'configure' doesn't + dnl figure out the CPU type correctly, so do it by hand here using + dnl the sizeof (void*): if 4 then use i386, and otherwise use x86_64. + case "$host_os" in + *darwin*10*) + AC_CHECK_SIZEOF(void*) + if test "$ac_cv_sizeof_voidp" = 4; then + cf_with_md_cpu="i386" + else + cf_with_md_cpu="x86_64" + fi + ;; + *) + cf_with_md_cpu="$host_cpu" + ;; + esac + fi + ]) case "$cf_with_md_cpu" in x86 | i[[3-7]]86) MD_CPU=x86 MD_SUBCPU=x86 ;; x86_64) MD_CPU=x86 MD_SUBCPU=x86_64 ;; diff --git a/config/gr_version.m4 b/config/gr_version.m4 index 4f45f0efa..3360b7d54 100644 --- a/config/gr_version.m4 +++ b/config/gr_version.m4 @@ -40,6 +40,7 @@ AC_DEFUN([GR_VERSION],[ if test "$MINOR_VERSION" == "git"; then dnl 3.3git-xxx-gxxxxxxxx RELEASE=$RELEASE$MINOR_VERSION + DOCVER=$RELEASE if test "$GIT_VERSION" != "" ; then RELEASE=$RELEASE-$GIT_VERSION fi @@ -47,6 +48,7 @@ AC_DEFUN([GR_VERSION],[ if test "$MAINT_VERSION" == "git" ; then dnl 3.3.1git-xxx-gxxxxxxxx RELEASE=$RELEASE.$MINOR_VERSION$MAINT_VERSION + DOCVER=$RELEASE if test "$GIT_VERSION" != "" ; then RELEASE=$RELEASE-$GIT_VERSION fi @@ -61,9 +63,12 @@ AC_DEFUN([GR_VERSION],[ dnl 3.3.0.1, 3.3.1.1 RELEASE=$RELEASE.$MAINT_VERSION fi + DOCVER=$RELEASE fi fi fi AC_MSG_NOTICE([GNU Radio Release $RELEASE]) + AC_SUBST(RELEASE) + AC_SUBST(DOCVER) ]) diff --git a/config/grc_gnuradio_examples.m4 b/config/grc_gnuradio_examples.m4 index 3225f3ab5..4d6116c70 100644 --- a/config/grc_gnuradio_examples.m4 +++ b/config/grc_gnuradio_examples.m4 @@ -1,4 +1,4 @@ -dnl Copyright 2001,2002,2003,2004,2005,2006,2008 Free Software Foundation, Inc. +dnl Copyright 2001,2002,2003,2004,2005,2006,2008,2009 Free Software Foundation, Inc. dnl dnl This file is part of GNU Radio dnl @@ -27,13 +27,14 @@ AC_DEFUN([GRC_GNURADIO_EXAMPLES],[ gnuradio-examples/Makefile \ gnuradio-examples/c++/Makefile \ gnuradio-examples/python/Makefile \ + gnuradio-examples/grc/Makefile \ gnuradio-examples/python/apps/hf_explorer/Makefile \ gnuradio-examples/python/apps/hf_radio/Makefile \ gnuradio-examples/python/apps/Makefile \ gnuradio-examples/python/audio/Makefile \ gnuradio-examples/python/digital/Makefile \ gnuradio-examples/python/digital_voice/Makefile \ - gnuradio-examples/python/digital-bert/Makefile \ + gnuradio-examples/python/digital-bert/Makefile \ gnuradio-examples/python/mp-sched/Makefile \ gnuradio-examples/python/multi-antenna/Makefile \ gnuradio-examples/python/multi_usrp/Makefile \ diff --git a/config/grc_gr_msdd6000.m4 b/config/grc_gr_msdd6000.m4 index 6d40e8931..0c6fc320e 100644 --- a/config/grc_gr_msdd6000.m4 +++ b/config/grc_gr_msdd6000.m4 @@ -29,7 +29,7 @@ AC_DEFUN([GRC_GR_MSDD6000],[ dnl Don't do gr-msdd6000 if gnuradio-core skipped GRC_CHECK_DEPENDENCY(gr-msdd6000, gnuradio-core) - AC_CHECK_HEADERS(netinet/in.h arpa/inet.h sys/socket.h netdb.h) + AC_CHECK_HEADERS(netinet/in.h arpa/inet.h sys/socket.h netdb.h, [], [passed=no]) GRC_BUILD_CONDITIONAL([gr-msdd6000],[ dnl run_tests is created from run_tests.in. Make it executable. diff --git a/config/grc_gr_qtgui.m4 b/config/grc_gr_qtgui.m4 index d9700776c..84514d7ce 100644 --- a/config/grc_gr_qtgui.m4 +++ b/config/grc_gr_qtgui.m4 @@ -86,12 +86,6 @@ AC_DEFUN([GRC_GR_QTGUI],[ AC_SUBST(QT_UIC_EXEC) fi - if test "$passed" = "no"; then - AM_CONDITIONAL(BUILD_QT, false) - else - AM_CONDITIONAL(BUILD_QT, true) - fi - AC_CONFIG_FILES([ \ gr-qtgui/Makefile \ gr-qtgui/src/Makefile \ diff --git a/config/grc_grc.m4 b/config/grc_grc.m4 index 7ee009fae..16720b8fe 100644 --- a/config/grc_grc.m4 +++ b/config/grc_grc.m4 @@ -50,7 +50,6 @@ AC_DEFUN([GRC_GRC],[ grc/Makefile \ grc/base/Makefile \ grc/blocks/Makefile \ - grc/examples/Makefile \ grc/freedesktop/Makefile \ grc/grc_gnuradio/Makefile \ grc/gui/Makefile \ diff --git a/config/grc_gruel.m4 b/config/grc_gruel.m4 index 729571434..d8ac95fed 100644 --- a/config/grc_gruel.m4 +++ b/config/grc_gruel.m4 @@ -25,6 +25,10 @@ AC_DEFUN([GRC_GRUEL],[ dnl with : if the --with code didn't error out dnl yes : if the --enable code passed muster and all dependencies are met dnl no : otherwise + if test $passed = yes; then + dnl Don't do gruel if guile not available + GRC_CHECK_GUILE(gruel) + fi if test $passed != with; then dnl how and where to find INCLUDES and LA and such gruel_INCLUDES="\ diff --git a/config/usrp_libusb.m4 b/config/usrp_libusb.m4 index 73872eaef..428a57992 100644..100755 --- a/config/usrp_libusb.m4 +++ b/config/usrp_libusb.m4 @@ -24,45 +24,100 @@ dnl Boston, MA 02110-1301, USA. AC_DEFUN([USRP_LIBUSB], [ - libusbok=yes + dnl Use PKGCONFIG to check for packages first, then check to + dnl make sure the USB_* variables work (whether from PKGCONFIG + dnl or overridden by the user) + + libusbok=no have_libusb1=no - if test [x]$1 = xyes; then - PKG_CHECK_MODULES(USB, libusb-1.0, [have_libusb1=yes], [ - AC_LANG_PUSH(C) - AC_CHECK_HEADERS([libusb-1.0/libusb.h], [have_libusb1=yes], - [libusbok=no; AC_MSG_RESULT([USRP requires libusb-1.0. libusb.h not found. See http://www.libusb.org])]) - AC_SEARCH_LIBS(libusb_bulk_transfer, [usb-1.0], [USB_LIBS="$LIBS"], - [libusbok=no; AC_MSG_RESULT([USRP requires libusb-1.0. libusb_bulk_transfer not found. See http://www.libusb.org])]) - AC_LANG_POP + if test x$1 = xyes; then + PKG_CHECK_MODULES(USB, libusb-1.0, [ + libusbok=yes + have_libusb1=yes + usb_header='libusb-1.0/libusb.h' + usb_lib_func='libusb_bulk_transfer' + usb_lib_name='usb-1.0' ]) else - PKG_CHECK_MODULES(USB, libusb, [], [ + dnl not using libusb1 (for now); see if legacy version is found. + dnl it might be installed under the name either 'libusb' or + dnl 'libusb-legacy', or just available via the + dnl user's shell environment + + dnl see if the pkgconfig module 'libusb' is available + PKG_CHECK_MODULES(USB, libusb, [libusbok=yes], [libusbok=no]) + dnl PKG_CHECK_MODULES does not work correctly when embedded + if test $libusbok = no; then + dnl if not, see if the pkgconfig module 'libusb-legacy' is available + PKG_CHECK_MODULES(USB, [libusb-legacy], [libusbok=yes], [libusbok=no]) + fi + dnl set variables for further testing + usb_header='usb.h' + usb_lib_func='usb_bulk_write' + usb_lib_name='usb' + fi + if test x$1 != xyes || test $have_libusb1 = yes; then + dnl Either (1) libusb1 was specified and found; or + dnl (2) libusb1 was not specified. Restart checking. + libusbok=yes + + dnl Verify that $usb_header is a valid header, and if so, + dnl then verify that $usb_lib_func can be found in the + dnl library $usb_lib_name. + + dnl If PKGCONFIG found variable USB_INCLUDEDIR, and it is + dnl not empty, use it for checking for $usb_header. + dnl Otherwise, maybe the user's shell environment is already + dnl configured to find this header. + + AC_LANG_PUSH(C) + save_CPPFLAGS="$CPPFLAGS" + if test x$USB_INCLUDEDIR != x; then + USB_INCLUDES="-I$USB_INCLUDEDIR" + CPPFLAGS="$CPPFLAGS $USB_INCLUDES" + AC_SUBST(USB_INCLUDES) + fi + AC_CHECK_HEADERS([$usb_header], [], [libusbok=no]) + CPPFLAGS="$save_CPPFLAGS" + AC_LANG_POP(C) + + if test $libusbok = no; then + AC_MSG_RESULT([USRP requires libusb header '$usb_header' which was not found or was not usable. See http://www.libusb.org]) + else + + dnl found the header; now make sure the library is OK + dnl On Darwin, need to include the IOKit library. + AC_LANG_PUSH(C) - AC_CHECK_HEADERS([usb.h], [], - [libusbok=no; AC_MSG_RESULT([USRP requires libusb. usb.h not found. See http://www.libusb.org])]) save_LIBS="$LIBS" + LIBS="" case "$host_os" in darwin*) - LIBS="$LIBS -lIOKit" + USB_LIBS="$USB_LIBS -lIOKit" + LIBS="$USB_LIBS" + ;; + *) ;; + esac + AC_CHECK_LIB([$usb_lib_name], [$usb_lib_func], [], [ + libusbok=no + AC_MSG_RESULT([USRP requires library '$usb_lib_name' with function '$usb_lib_func', which was either not found or was not usable. See http://www.libusb.org]) + ]) + case "$host_os" in + cygwin* | mingw*) + USB_LIBS="$LIBS" ;; *) ;; esac - - AC_SEARCH_LIBS(usb_bulk_write, [usb], [USB_LIBS="$LIBS"], - [libusbok=no; AC_MSG_RESULT([USRP requires libusb. usb_bulk_write not found. See http://www.libusb.org])]) LIBS="$save_LIBS" - AC_LANG_POP - ]) - fi - - if x$USB_INCLUDEDIR != x; then - USB_INCLUDES=-I$USB_INCLUDEDIR + AC_LANG_POP(C) + fi fi - - if test x$libusbok = xyes; then + if test $libusbok = yes; then AC_SUBST(USB_LIBS) ifelse([$2], , :, [$2]) else + USB_INCLUDES= + USB_LIBS= ifelse([$3], , :, [$3]) fi ]) diff --git a/debian/bin/gen-install-files.sh b/debian/bin/gen-install-files.sh index 5e900095a..45296bff6 100755 --- a/debian/bin/gen-install-files.sh +++ b/debian/bin/gen-install-files.sh @@ -433,6 +433,12 @@ $EXTRACT gnuradio-examples/python/pfb/Makefile dist_ourdata_DATA >>$NAME $EXTRACT gnuradio-examples/python/usrp/Makefile dist_ourdata_SCRIPTS >>$NAME $EXTRACT gnuradio-examples/python/usrp2/Makefile dist_ourdata_SCRIPTS >>$NAME $EXTRACT gnuradio-examples/python/usrp2/Makefile dist_ourdata_DATA >>$NAME +$EXTRACT gnuradio-examples/grc/Makefile dist_audiodata_DATA >>$NAME +$EXTRACT gnuradio-examples/grc/Makefile dist_demoddata_DATA >>$NAME +$EXTRACT gnuradio-examples/grc/Makefile dist_simpledata_DATA >>$NAME +$EXTRACT gnuradio-examples/grc/Makefile dist_trellisdata_DATA >>$NAME +$EXTRACT gnuradio-examples/grc/Makefile dist_usrpdata_DATA >>$NAME +$EXTRACT gnuradio-examples/grc/Makefile dist_xmlrpcdata_DATA >>$NAME # gnuradio-pager NAME=debian/gnuradio-pager.install @@ -492,11 +498,6 @@ $EXTRACT grc/Makefile dist_etc_DATA >>$NAME $EXTRACT grc/base/Makefile ourpython_PYTHON >>$NAME $EXTRACT grc/base/Makefile dist_ourdata_DATA >>$NAME $EXTRACT grc/blocks/Makefile dist_ourdata_DATA >>$NAME -$EXTRACT grc/examples/Makefile dist_audiodata_DATA >>$NAME -$EXTRACT grc/examples/Makefile dist_simpledata_DATA >>$NAME -$EXTRACT grc/examples/Makefile dist_trellisdata_DATA >>$NAME -$EXTRACT grc/examples/Makefile dist_usrpdata_DATA >>$NAME -$EXTRACT grc/examples/Makefile dist_xmlrpcdata_DATA >>$NAME $EXTRACT grc/freedesktop/Makefile dist_ourdata_DATA >>$NAME $EXTRACT grc/freedesktop/Makefile dist_bin_SCRIPTS >>$NAME $EXTRACT grc/grc_gnuradio/Makefile root_python_PYTHON >>$NAME diff --git a/debian/control b/debian/control index a7b33f0be..0760ddaec 100644 --- a/debian/control +++ b/debian/control @@ -551,16 +551,6 @@ XB-Python-Version: ${python:Versions} Description: GNU Radio Utilities This package provides commonly used utilities for GNU Radio -Package: gnuradio-examples -Architecture: any -Depends: ${python:Depends}, python-gnuradio-core -Provides: ${python:Provides} -Recommends: python-gnuradio-wxgui, python-gnuradio -Section: comm -XB-Python-Version: ${python:Versions} -Description: GNU Radio Example Programs - This package provides examples of GNU Radio usage using Python. - Package: gnuradio-pager Architecture: any Depends: ${python:Depends}, ${shlibs:Depends}, python-gnuradio-usrp @@ -621,6 +611,16 @@ XB-Python-Version: ${python:Versions} Description: The GNU Radio Companion GRC is a graphical flowgraph editor for the GNU Software Radio +Package: gnuradio-examples +Architecture: any +Depends: ${python:Depends}, python-gnuradio-core, gnuradio-companion +Provides: ${python:Provides} +Recommends: python-gnuradio-wxgui, python-gnuradio +Section: comm +XB-Python-Version: ${python:Versions} +Description: GNU Radio Example Programs + This package provides examples of GNU Radio usage using Python. + ################################################################################ # Documentation packages # ################################################################################ diff --git a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc index 8971d3d39..d00ba6739 100644 --- a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc +++ b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.cc @@ -64,6 +64,8 @@ gr_pfb_arb_resampler_ccf::gr_pfb_arb_resampler_ccf (float rate, // Store the last filter between calls to work d_last_filter = 0; + + d_start_index = 0; d_filters = std::vector<gr_fir_ccf*>(d_int_rate); @@ -148,7 +150,7 @@ gr_pfb_arb_resampler_ccf::general_work (int noutput_items, return 0; // history requirements may have changed. } - int i = 0, j, count = 0; + int i = 0, j, count = d_start_index; gr_complex o0, o1; // Restore the last filter position @@ -184,14 +186,17 @@ gr_pfb_arb_resampler_ccf::general_work (int noutput_items, d_acc = fmodf(d_acc, 1.0); } if(i < noutput_items) { // keep state for next entry - count++; // we have fully consumed another input + float ss = (int)(j / d_int_rate); // number of items to skip ahead by + count += ss; // we have fully consumed another input j = j % d_int_rate; // roll filter around } } - // Store the current filter position + // Store the current filter position and start of next sample d_last_filter = j; + d_start_index = std::max(0, count - ninput_items[0]); - consume_each(count); + // consume all we've processed but no more than we can + consume_each(std::min(count, ninput_items[0])); return i; } diff --git a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.h b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.h index d4c886ec3..bc5b91a5e 100644 --- a/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.h +++ b/gnuradio-core/src/lib/filter/gr_pfb_arb_resampler_ccf.h @@ -118,6 +118,7 @@ class gr_pfb_arb_resampler_ccf : public gr_block float d_flt_rate; // residual rate for the linear interpolation float d_acc; unsigned int d_last_filter; + int d_start_index; unsigned int d_taps_per_filter; bool d_updated; diff --git a/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.cc b/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.cc index 91cbf74c6..433b7d613 100644 --- a/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.cc +++ b/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.cc @@ -33,45 +33,51 @@ #include <gr_io_signature.h> #include <gr_math.h> -gr_pfb_clock_sync_ccf_sptr gr_make_pfb_clock_sync_ccf (float sps, float gain, +gr_pfb_clock_sync_ccf_sptr gr_make_pfb_clock_sync_ccf (double sps, float gain, const std::vector<float> &taps, unsigned int filter_size, - float init_phase) + float init_phase, + float max_rate_deviation) { return gr_pfb_clock_sync_ccf_sptr (new gr_pfb_clock_sync_ccf (sps, gain, taps, filter_size, - init_phase)); + init_phase, + max_rate_deviation)); } - -gr_pfb_clock_sync_ccf::gr_pfb_clock_sync_ccf (float sps, float gain, +int ios[] = {sizeof(gr_complex), sizeof(float), sizeof(float), sizeof(float)}; +std::vector<int> iosig(ios, ios+sizeof(ios)/sizeof(int)); +gr_pfb_clock_sync_ccf::gr_pfb_clock_sync_ccf (double sps, float gain, const std::vector<float> &taps, unsigned int filter_size, - float init_phase) + float init_phase, + float max_rate_deviation) : gr_block ("pfb_clock_sync_ccf", gr_make_io_signature (1, 1, sizeof(gr_complex)), - gr_make_io_signature2 (2, 2, sizeof(gr_complex), sizeof(float))), - d_updated (false), d_sps(sps), d_alpha(gain) + gr_make_io_signaturev (1, 4, iosig)), + d_updated (false), d_nfilters(filter_size), + d_max_dev(max_rate_deviation) { d_nfilters = filter_size; + d_sps = floor(sps); // Store the last filter between calls to work // The accumulator keeps track of overflow to increment the stride correctly. // set it here to the fractional difference based on the initial phaes - // assert(init_phase <= 2*M_PI); - float x = init_phase / (2*M_PI); //normalize initial phase - d_acc = x*(d_nfilters-1); - d_last_filter = (int)floor(d_acc); - d_acc = fmodf(d_acc, 1); - d_start_count = 0; - + set_alpha(gain); + set_beta(0.25*gain*gain); + d_k = init_phase; + d_rate = (sps-floor(sps))*(double)d_nfilters; + d_rate_i = (int)floor(d_rate); + d_rate_f = d_rate - (float)d_rate_i; + d_filtnum = (int)floor(d_k); d_filters = std::vector<gr_fir_ccf*>(d_nfilters); d_diff_filters = std::vector<gr_fir_ccf*>(d_nfilters); // Create an FIR filter for each channel and zero out the taps std::vector<float> vtaps(0, d_nfilters); - for(unsigned int i = 0; i < d_nfilters; i++) { + for(int i = 0; i < d_nfilters; i++) { d_filters[i] = gr_fir_util::create_gr_fir_ccf(vtaps); d_diff_filters[i] = gr_fir_util::create_gr_fir_ccf(vtaps); } @@ -85,7 +91,7 @@ gr_pfb_clock_sync_ccf::gr_pfb_clock_sync_ccf (float sps, float gain, gr_pfb_clock_sync_ccf::~gr_pfb_clock_sync_ccf () { - for(unsigned int i = 0; i < d_nfilters; i++) { + for(int i = 0; i < d_nfilters; i++) { delete d_filters[i]; } } @@ -95,7 +101,7 @@ gr_pfb_clock_sync_ccf::set_taps (const std::vector<float> &newtaps, std::vector< std::vector<float> > &ourtaps, std::vector<gr_fir_ccf*> &ourfilter) { - unsigned int i,j; + int i,j; unsigned int ntaps = newtaps.size(); d_taps_per_filter = (unsigned int)ceil((double)ntaps/(double)d_nfilters); @@ -114,13 +120,13 @@ gr_pfb_clock_sync_ccf::set_taps (const std::vector<float> &newtaps, // Partition the filter for(i = 0; i < d_nfilters; i++) { // Each channel uses all d_taps_per_filter with 0's if not enough taps to fill out - ourtaps[i] = std::vector<float>(d_taps_per_filter, 0); + ourtaps[d_nfilters-1-i] = std::vector<float>(d_taps_per_filter, 0); for(j = 0; j < d_taps_per_filter; j++) { - ourtaps[i][j] = tmp_taps[i + j*d_nfilters]; // add taps to channels in reverse order + ourtaps[d_nfilters - 1 - i][j] = tmp_taps[i + j*d_nfilters]; } // Build a filter for each channel and add it's taps to it - ourfilter[i]->set_taps(ourtaps[i]); + ourfilter[i]->set_taps(ourtaps[d_nfilters-1-i]); } // Set the history to ensure enough input items for each filter @@ -133,38 +139,53 @@ void gr_pfb_clock_sync_ccf::create_diff_taps(const std::vector<float> &newtaps, std::vector<float> &difftaps) { + float maxtap = 1e-20; difftaps.clear(); difftaps.push_back(0); //newtaps[0]); for(unsigned int i = 1; i < newtaps.size()-1; i++) { - difftaps.push_back(newtaps[i+1] - newtaps[i-1]); + float tap = newtaps[i+1] - newtaps[i-1]; + difftaps.push_back(tap); + if(tap > maxtap) { + maxtap = tap; + } } difftaps.push_back(0);//-newtaps[newtaps.size()-1]); + + // Scale the differential taps; helps scale error term to better update state + // FIXME: should this be scaled this way or use the same gain as the taps? + for(unsigned int i = 0; i < difftaps.size(); i++) { + difftaps[i] /= maxtap; + } } void gr_pfb_clock_sync_ccf::print_taps() { - unsigned int i, j; + int i, j; + printf("[ "); for(i = 0; i < d_nfilters; i++) { - printf("filter[%d]: [%.4e, ", i, d_taps[i][0]); + printf("[%.4e, ", d_taps[i][0]); for(j = 1; j < d_taps_per_filter-1; j++) { printf("%.4e,", d_taps[i][j]); } - printf("%.4e]\n", d_taps[i][j]); + printf("%.4e],", d_taps[i][j]); } + printf(" ]\n"); } void gr_pfb_clock_sync_ccf::print_diff_taps() { - unsigned int i, j; + int i, j; + printf("[ "); for(i = 0; i < d_nfilters; i++) { - printf("filter[%d]: [%.4e, ", i, d_dtaps[i][0]); + printf("[%.4e, ", d_dtaps[i][0]); for(j = 1; j < d_taps_per_filter-1; j++) { printf("%.4e,", d_dtaps[i][j]); } - printf("%.4e]\n", d_dtaps[i][j]); + printf("%.4e],", d_dtaps[i][j]); } + printf(" ]\n"); } @@ -172,8 +193,7 @@ std::vector<float> gr_pfb_clock_sync_ccf::channel_taps(int channel) { std::vector<float> taps; - unsigned int i; - for(i = 0; i < d_taps_per_filter; i++) { + for(int i = 0; i < d_taps_per_filter; i++) { taps.push_back(d_taps[channel][i]); } return taps; @@ -183,8 +203,7 @@ std::vector<float> gr_pfb_clock_sync_ccf::diff_channel_taps(int channel) { std::vector<float> taps; - unsigned int i; - for(i = 0; i < d_taps_per_filter; i++) { + for(int i = 0; i < d_taps_per_filter; i++) { taps.push_back(d_dtaps[channel][i]); } return taps; @@ -199,7 +218,13 @@ gr_pfb_clock_sync_ccf::general_work (int noutput_items, { gr_complex *in = (gr_complex *) input_items[0]; gr_complex *out = (gr_complex *) output_items[0]; - float *err = (float *) output_items[1]; + + float *err, *outrate, *outk; + if(output_items.size() > 2) { + err = (float *) output_items[1]; + outrate = (float*)output_items[2]; + outk = (float*)output_items[3]; + } if (d_updated) { d_updated = false; @@ -209,50 +234,50 @@ gr_pfb_clock_sync_ccf::general_work (int noutput_items, // We need this many to process one output int nrequired = ninput_items[0] - d_taps_per_filter; - int i = 0, count = d_start_count; - float error = 0; + int i = 0, count = 0; + float error, error_r, error_i; // produce output as long as we can and there are enough input samples while((i < noutput_items) && (count < nrequired)) { - out[i] = d_filters[d_last_filter]->filter(&in[count]); - error = (out[i] * d_diff_filters[d_last_filter]->filter(&in[count])).real(); - err[i] = error; - - d_acc += d_alpha*error; - gr_branchless_clip(d_acc, 1); - - int newfilter; - newfilter = (int)((float)d_last_filter + d_acc); - if(newfilter != (int)d_last_filter) - d_acc = 0.5; - - if(newfilter >= (int)d_nfilters) { - d_last_filter = newfilter - d_nfilters; - count++; + d_filtnum = (int)floor(d_k); + + // Keep the current filter number in [0, d_nfilters] + // If we've run beyond the last filter, wrap around and go to next sample + // If we've go below 0, wrap around and go to previous sample + while(d_filtnum >= d_nfilters) { + d_k -= d_nfilters; + d_filtnum -= d_nfilters; + count += 1; } - else if(newfilter < 0) { - d_last_filter = d_nfilters + newfilter; - count--; - } - else { - d_last_filter = newfilter; + while(d_filtnum < 0) { + d_k += d_nfilters; + d_filtnum += d_nfilters; + count -= 1; } + out[i] = d_filters[d_filtnum]->filter(&in[count]); + gr_complex diff = d_diff_filters[d_filtnum]->filter(&in[count]); + error_r = out[i].real() * diff.real(); + error_i = out[i].imag() * diff.imag(); + error = (error_i + error_r) / 2.0; // average error from I&Q channel + + // Run the control loop to update the current phase (k) and tracking rate + d_k = d_k + d_alpha*error + d_rate_i + d_rate_f; + d_rate_f = d_rate_f + d_beta*error; + + // Keep our rate within a good range + d_rate_f = gr_branchless_clip(d_rate_f, d_max_dev); + i++; - count += d_sps; - } + count += (int)floor(d_sps); - // Set the start index at the next entrance to the work function - // if we stop because we run out of input items, jump ahead in the - // next call to work. Otherwise, we can start at zero. - if(count > nrequired) { - d_start_count = count - (nrequired); - consume_each(ninput_items[0]-d_taps_per_filter); - } - else { - d_start_count = 0; - consume_each(count); + if(output_items.size() > 2) { + err[i] = error; + outrate[i] = d_rate_f; + outk[i] = d_k; + } } - + consume_each(count); + return i; } diff --git a/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.h b/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.h index 1a04e55c7..a07192a7f 100644 --- a/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.h +++ b/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.h @@ -28,10 +28,11 @@ class gr_pfb_clock_sync_ccf; typedef boost::shared_ptr<gr_pfb_clock_sync_ccf> gr_pfb_clock_sync_ccf_sptr; -gr_pfb_clock_sync_ccf_sptr gr_make_pfb_clock_sync_ccf (float sps, float gain, - const std::vector<float> &taps, - unsigned int filter_size=32, - float init_phase=0); +gr_pfb_clock_sync_ccf_sptr gr_make_pfb_clock_sync_ccf (double sps, float gain, + const std::vector<float> &taps, + unsigned int filter_size=32, + float init_phase=0, + float max_rate_deviation=1.5); class gr_fir_ccf; @@ -50,31 +51,38 @@ class gr_pfb_clock_sync_ccf : public gr_block /*! * Build the polyphase filterbank timing synchronizer. */ - friend gr_pfb_clock_sync_ccf_sptr gr_make_pfb_clock_sync_ccf (float sps, float gain, + friend gr_pfb_clock_sync_ccf_sptr gr_make_pfb_clock_sync_ccf (double sps, float gain, const std::vector<float> &taps, unsigned int filter_size, - float init_phase); + float init_phase, + float max_rate_deviation); bool d_updated; - unsigned int d_sps; + double d_sps; + double d_sample_num; float d_alpha; - unsigned int d_nfilters; + float d_beta; + int d_nfilters; std::vector<gr_fir_ccf*> d_filters; std::vector<gr_fir_ccf*> d_diff_filters; std::vector< std::vector<float> > d_taps; std::vector< std::vector<float> > d_dtaps; - float d_acc; - unsigned int d_last_filter; - unsigned int d_start_count; - unsigned int d_taps_per_filter; + float d_k; + float d_rate; + float d_rate_i; + float d_rate_f; + float d_max_dev; + int d_filtnum; + int d_taps_per_filter; /*! * Build the polyphase filterbank timing synchronizer. */ - gr_pfb_clock_sync_ccf (float sps, float gain, + gr_pfb_clock_sync_ccf (double sps, float gain, const std::vector<float> &taps, unsigned int filter_size, - float init_phase); + float init_phase, + float max_rate_deviation); void create_diff_taps(const std::vector<float> &newtaps, std::vector<float> &difftaps); @@ -96,6 +104,20 @@ public: */ void print_taps(); void print_diff_taps(); + + void set_alpha(float alpha) + { + d_alpha = alpha; + } + void set_beta(float beta) + { + d_beta = beta; + } + + void set_max_rate_deviation(float m) + { + d_max_dev = m; + } int general_work (int noutput_items, gr_vector_int &ninput_items, diff --git a/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.i b/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.i index 729d4a1aa..197984287 100644 --- a/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.i +++ b/gnuradio-core/src/lib/filter/gr_pfb_clock_sync_ccf.i @@ -22,18 +22,20 @@ GR_SWIG_BLOCK_MAGIC(gr,pfb_clock_sync_ccf); -gr_pfb_clock_sync_ccf_sptr gr_make_pfb_clock_sync_ccf (float sps, float gain, +gr_pfb_clock_sync_ccf_sptr gr_make_pfb_clock_sync_ccf (double sps, float gain, const std::vector<float> &taps, unsigned int filter_size=32, - float init_phase=0); + float init_phase=0, + float max_rate_deviation=1.5); class gr_pfb_clock_sync_ccf : public gr_block { private: - gr_pfb_clock_sync_ccf (float sps, float gain, + gr_pfb_clock_sync_ccf (double sps, float gain, const std::vector<float> &taps, unsigned int filter_size, - float init_phase); + float init_phase, + float max_rate_deviation); public: ~gr_pfb_clock_sync_ccf (); @@ -46,4 +48,7 @@ class gr_pfb_clock_sync_ccf : public gr_block std::vector<float> diff_channel_taps(int channel); void print_taps(); void print_diff_taps(); + void set_alpha(float alpha); + void set_beta(float beta); + void set_max_rate_deviation(float m); }; diff --git a/gnuradio-core/src/lib/general/gr_mpsk_receiver_cc.cc b/gnuradio-core/src/lib/general/gr_mpsk_receiver_cc.cc index 49bbb8d36..1efa82703 100644 --- a/gnuradio-core/src/lib/general/gr_mpsk_receiver_cc.cc +++ b/gnuradio-core/src/lib/general/gr_mpsk_receiver_cc.cc @@ -265,8 +265,6 @@ gr_mpsk_receiver_cc::phase_error_tracking(gr_complex sample) // Make phase and frequency corrections based on sampled value phase_error = (*this.*d_phase_error_detector)(sample); - - phase_error = gr_branchless_clip(phase_error, 1.0); d_freq += d_beta*phase_error; // adjust frequency based on error d_phase += d_freq + d_alpha*phase_error; // adjust phase based on error diff --git a/gnuradio-core/src/lib/io/gr_histo_sink_f.cc b/gnuradio-core/src/lib/io/gr_histo_sink_f.cc index a923a7e45..2885fe428 100644 --- a/gnuradio-core/src/lib/io/gr_histo_sink_f.cc +++ b/gnuradio-core/src/lib/io/gr_histo_sink_f.cc @@ -53,7 +53,6 @@ gr_histo_sink_f::gr_histo_sink_f (gr_msg_queue_sptr msgq) : gr_sync_block ("histo_sink_f", gr_make_io_signature (1, 1, sizeof (float)), gr_make_io_signature (0, 0, 0)), d_msgq (msgq), d_num_bins(11), d_frame_size(1000), d_sample_count(0), d_bins(NULL), d_samps(NULL) { - pthread_mutex_init(&d_mutex, 0); //allocate arrays and clear set_num_bins(d_num_bins); set_frame_size(d_frame_size); @@ -61,7 +60,6 @@ gr_histo_sink_f::gr_histo_sink_f (gr_msg_queue_sptr msgq) gr_histo_sink_f::~gr_histo_sink_f (void) { - pthread_mutex_destroy(&d_mutex); delete [] d_samps; delete [] d_bins; } @@ -72,7 +70,7 @@ gr_histo_sink_f::work (int noutput_items, gr_vector_void_star &output_items) { const float *in = (const float *) input_items[0]; - pthread_mutex_lock(&d_mutex); + gruel::scoped_lock guard(d_mutex); // hold mutex for duration of this function for (unsigned int i = 0; i < (unsigned int)noutput_items; i++){ d_samps[d_sample_count] = in[i]; d_sample_count++; @@ -82,7 +80,6 @@ gr_histo_sink_f::work (int noutput_items, clear(); } } - pthread_mutex_unlock(&d_mutex); return noutput_items; } @@ -148,22 +145,20 @@ gr_histo_sink_f::get_num_bins(void){ **************************************************/ void gr_histo_sink_f::set_frame_size(unsigned int frame_size){ - pthread_mutex_lock(&d_mutex); + gruel::scoped_lock guard(d_mutex); // hold mutex for duration of this function d_frame_size = frame_size; /* allocate a new sample array */ delete [] d_samps; d_samps = new float[d_frame_size]; clear(); - pthread_mutex_unlock(&d_mutex); } void gr_histo_sink_f::set_num_bins(unsigned int num_bins){ - pthread_mutex_lock(&d_mutex); + gruel::scoped_lock guard(d_mutex); // hold mutex for duration of this function d_num_bins = num_bins; /* allocate a new bin array */ delete [] d_bins; d_bins = new unsigned int[d_num_bins]; clear(); - pthread_mutex_unlock(&d_mutex); } diff --git a/gnuradio-core/src/lib/io/gr_histo_sink_f.h b/gnuradio-core/src/lib/io/gr_histo_sink_f.h index 640398c60..8ba45ec55 100644 --- a/gnuradio-core/src/lib/io/gr_histo_sink_f.h +++ b/gnuradio-core/src/lib/io/gr_histo_sink_f.h @@ -25,7 +25,7 @@ #include <gr_sync_block.h> #include <gr_msg_queue.h> -#include <pthread.h> +#include <gruel/thread.h> class gr_histo_sink_f; typedef boost::shared_ptr<gr_histo_sink_f> gr_histo_sink_f_sptr; @@ -45,7 +45,7 @@ private: unsigned int d_sample_count; unsigned int *d_bins; float *d_samps; - pthread_mutex_t d_mutex; + gruel::mutex d_mutex; friend gr_histo_sink_f_sptr gr_make_histo_sink_f (gr_msg_queue_sptr msgq); gr_histo_sink_f (gr_msg_queue_sptr msgq); diff --git a/gnuradio-core/src/lib/missing/Makefile.am b/gnuradio-core/src/lib/missing/Makefile.am index 08e521cb3..238370910 100644 --- a/gnuradio-core/src/lib/missing/Makefile.am +++ b/gnuradio-core/src/lib/missing/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2003,2004,2008 Free Software Foundation, Inc. +# Copyright 2003,2004,2008,2009 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -33,6 +33,14 @@ EXTRA_DIST = \ noinst_LTLIBRARIES = libmissing.la -libmissing_la_SOURCES = \ - bug_work_around_8.cc \ +libmissing_la_common_SOURCES = \ + bug_work_around_8.cc + +powerpc_CODE = \ posix_memalign.cc + +if MD_CPU_powerpc +libmissing_la_SOURCES = $(libmissing_la_common_SOURCES) $(powerpc_CODE) +else +libmissing_la_SOURCES = $(libmissing_la_common_SOURCES) +endif diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/Makefile.am b/gnuradio-core/src/python/gnuradio/blks2impl/Makefile.am index f0825b151..68d683623 100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/Makefile.am +++ b/gnuradio-core/src/python/gnuradio/blks2impl/Makefile.am @@ -31,7 +31,9 @@ grblkspython_PYTHON = \ am_demod.py \ channel_model.py \ dbpsk.py \ + dbpsk2.py \ dqpsk.py \ + dqpsk2.py \ d8psk.py \ filterbank.py \ fm_demod.py \ diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/dbpsk.py b/gnuradio-core/src/python/gnuradio/blks2impl/dbpsk.py index 3147bfa2a..860015c3f 100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/dbpsk.py +++ b/gnuradio-core/src/python/gnuradio/blks2impl/dbpsk.py @@ -1,5 +1,5 @@ # -# Copyright 2005,2006,2007 Free Software Foundation, Inc. +# Copyright 2005,2006,2007,2009 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -251,20 +251,20 @@ class dbpsk_demod(gr.hier_block2): # symbol clock recovery if not self._mm_gain_mu: self._mm_gain_mu = 0.1 - + self._mm_omega = self._samples_per_symbol self._mm_gain_omega = .25 * self._mm_gain_mu * self._mm_gain_mu self._costas_beta = 0.25 * self._costas_alpha * self._costas_alpha - fmin = -0.1 - fmax = 0.1 + fmin = -0.25 + fmax = 0.25 self.receiver=gr.mpsk_receiver_cc(arity, 0, - self._costas_alpha, self._costas_beta, - fmin, fmax, - self._mm_mu, self._mm_gain_mu, - self._mm_omega, self._mm_gain_omega, - self._mm_omega_relative_limit) - + self._costas_alpha, self._costas_beta, + fmin, fmax, + self._mm_mu, self._mm_gain_mu, + self._mm_omega, self._mm_gain_omega, + self._mm_omega_relative_limit) + # Do differential decoding based on phase change of symbols self.diffdec = gr.diff_phasor_cc() diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/dbpsk2.py b/gnuradio-core/src/python/gnuradio/blks2impl/dbpsk2.py new file mode 100644 index 000000000..4541b453b --- /dev/null +++ b/gnuradio-core/src/python/gnuradio/blks2impl/dbpsk2.py @@ -0,0 +1,351 @@ +# +# Copyright 2005,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 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +# See gnuradio-examples/python/digital for examples + +""" +differential BPSK modulation and demodulation. +""" + +from gnuradio import gr, gru, modulation_utils +from math import pi, sqrt +import psk +import cmath +from pprint import pprint + +# default values (used in __init__ and add_options) +_def_samples_per_symbol = 2 +_def_excess_bw = 0.35 +_def_gray_code = True +_def_verbose = False +_def_log = False + +_def_costas_alpha = 0.1 +_def_timing_alpha = 0.100 +_def_timing_beta = 0.010 +_def_timing_max_dev = 1.5 + + +# ///////////////////////////////////////////////////////////////////////////// +# DBPSK modulator +# ///////////////////////////////////////////////////////////////////////////// + +class dbpsk2_mod(gr.hier_block2): + + def __init__(self, + samples_per_symbol=_def_samples_per_symbol, + excess_bw=_def_excess_bw, + gray_code=_def_gray_code, + verbose=_def_verbose, + log=_def_log): + """ + Hierarchical block for RRC-filtered differential BPSK modulation. + + The input is a byte stream (unsigned char) and the + output is the complex modulated signal at baseband. + + @param samples_per_symbol: samples per baud >= 2 + @type samples_per_symbol: integer + @param excess_bw: Root-raised cosine filter excess bandwidth + @type excess_bw: float + @param gray_code: Tell modulator to Gray code the bits + @type gray_code: bool + @param verbose: Print information about modulator? + @type verbose: bool + @param log: Log modulation data to files? + @type log: bool + """ + + gr.hier_block2.__init__(self, "dbpsk_mod", + gr.io_signature(1, 1, gr.sizeof_char), # Input signature + gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature + + self._samples_per_symbol = samples_per_symbol + self._excess_bw = excess_bw + self._gray_code = gray_code + + if not isinstance(self._samples_per_symbol, int) or self._samples_per_symbol < 2: + raise TypeError, ("sbp must be an integer >= 2, is %d" % self._samples_per_symbol) + + ntaps = 11 * self._samples_per_symbol + + arity = pow(2,self.bits_per_symbol()) + + # turn bytes into k-bit vectors + self.bytes2chunks = \ + gr.packed_to_unpacked_bb(self.bits_per_symbol(), gr.GR_MSB_FIRST) + + if self._gray_code: + self.symbol_mapper = gr.map_bb(psk.binary_to_gray[arity]) + else: + self.symbol_mapper = gr.map_bb(psk.binary_to_ungray[arity]) + + self.diffenc = gr.diff_encoder_bb(arity) + + self.chunks2symbols = gr.chunks_to_symbols_bc(psk.constellation[arity]) + + # pulse shaping filter + self.rrc_taps = gr.firdes.root_raised_cosine( + self._samples_per_symbol, # gain (samples_per_symbol since we're + # interpolating by samples_per_symbol) + self._samples_per_symbol, # sampling rate + 1.0, # symbol rate + self._excess_bw, # excess bandwidth (roll-off factor) + ntaps) + self.rrc_filter = gr.interp_fir_filter_ccf(self._samples_per_symbol, + self.rrc_taps) + + # Connect + self.connect(self, self.bytes2chunks, self.symbol_mapper, self.diffenc, + self.chunks2symbols, self.rrc_filter, self) + + if verbose: + self._print_verbage() + + if log: + self._setup_logging() + + + def samples_per_symbol(self): + return self._samples_per_symbol + + def bits_per_symbol(self=None): # static method that's also callable on an instance + return 1 + bits_per_symbol = staticmethod(bits_per_symbol) # make it a static method. RTFM + + def add_options(parser): + """ + Adds DBPSK modulation-specific options to the standard parser + """ + parser.add_option("", "--excess-bw", type="float", default=_def_excess_bw, + help="set RRC excess bandwith factor [default=%default]") + parser.add_option("", "--no-gray-code", dest="gray_code", + action="store_false", default=True, + help="disable gray coding on modulated bits (PSK)") + add_options=staticmethod(add_options) + + def extract_kwargs_from_options(options): + """ + Given command line options, create dictionary suitable for passing to __init__ + """ + return modulation_utils.extract_kwargs_from_options(dbpsk2_mod.__init__, + ('self',), options) + extract_kwargs_from_options=staticmethod(extract_kwargs_from_options) + + + def _print_verbage(self): + print "\nModulator:" + print "bits per symbol: %d" % self.bits_per_symbol() + print "Gray code: %s" % self._gray_code + print "RRC roll-off factor: %.2f" % self._excess_bw + + def _setup_logging(self): + print "Modulation logging turned on." + self.connect(self.bytes2chunks, + gr.file_sink(gr.sizeof_char, "tx_bytes2chunks.dat")) + self.connect(self.symbol_mapper, + gr.file_sink(gr.sizeof_char, "tx_graycoder.dat")) + self.connect(self.diffenc, + gr.file_sink(gr.sizeof_char, "tx_diffenc.dat")) + self.connect(self.chunks2symbols, + gr.file_sink(gr.sizeof_gr_complex, "tx_chunks2symbols.dat")) + self.connect(self.rrc_filter, + gr.file_sink(gr.sizeof_gr_complex, "tx_rrc_filter.dat")) + + +# ///////////////////////////////////////////////////////////////////////////// +# DBPSK demodulator +# +# Differentially coherent detection of differentially encoded BPSK +# ///////////////////////////////////////////////////////////////////////////// + +class dbpsk2_demod(gr.hier_block2): + + def __init__(self, + samples_per_symbol=_def_samples_per_symbol, + excess_bw=_def_excess_bw, + costas_alpha=_def_costas_alpha, + timing_alpha=_def_timing_alpha, + timing_max_dev=_def_timing_max_dev, + gray_code=_def_gray_code, + verbose=_def_verbose, + log=_def_log): + """ + Hierarchical block for RRC-filtered differential BPSK demodulation + + The input is the complex modulated signal at baseband. + The output is a stream of bits packed 1 bit per byte (LSB) + + @param samples_per_symbol: samples per symbol >= 2 + @type samples_per_symbol: float + @param excess_bw: Root-raised cosine filter excess bandwidth + @type excess_bw: float + @param costas_alpha: loop filter gain + @type costas_alpha: float + @param timing_alpha: timing loop alpha gain + @type timing_alpha: float + @param timing_max: timing loop maximum rate deviations + @type timing_max: float + @param gray_code: Tell modulator to Gray code the bits + @type gray_code: bool + @param verbose: Print information about modulator? + @type verbose: bool + @param debug: Print modualtion data to files? + @type debug: bool + """ + + gr.hier_block2.__init__(self, "dbpsk2_demod", + gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature + gr.io_signature(1, 1, gr.sizeof_char)) # Output signature + + self._samples_per_symbol = samples_per_symbol + self._excess_bw = excess_bw + self._costas_alpha = costas_alpha + self._timing_alpha = timing_alpha + self._timing_beta = _def_timing_beta + self._timing_max_dev=timing_max_dev + self._gray_code = gray_code + + if samples_per_symbol < 2: + raise TypeError, "samples_per_symbol must be >= 2, is %r" % (samples_per_symbol,) + + arity = pow(2,self.bits_per_symbol()) + + # Automatic gain control + self.agc = gr.agc2_cc(0.6e-1, 1e-3, 1, 1, 100) + #self.agc = gr.feedforward_agc_cc(16, 1.0) + + self._costas_beta = 0.25 * self._costas_alpha * self._costas_alpha + # Allow a frequency swing of +/- half of the sample rate + fmin = -0.5 + fmax = 0.5 + + self.clock_recov = gr.costas_loop_cc(self._costas_alpha, + self._costas_beta, + fmax, fmin, arity) + + # symbol timing recovery with RRC data filter + nfilts = 32 + ntaps = 11 * samples_per_symbol*nfilts + taps = gr.firdes.root_raised_cosine(nfilts, nfilts, 1.0/float(self._samples_per_symbol), self._excess_bw, ntaps) + self.time_recov = gr.pfb_clock_sync_ccf(self._samples_per_symbol, + self._timing_alpha, + taps, nfilts, nfilts/2, self._timing_max_dev) + self.time_recov.set_beta(self._timing_beta) + + # Do differential decoding based on phase change of symbols + self.diffdec = gr.diff_phasor_cc() + + # find closest constellation point + rot = 1 + rotated_const = map(lambda pt: pt * rot, psk.constellation[arity]) + self.slicer = gr.constellation_decoder_cb(rotated_const, range(arity)) + + if self._gray_code: + self.symbol_mapper = gr.map_bb(psk.gray_to_binary[arity]) + else: + self.symbol_mapper = gr.map_bb(psk.ungray_to_binary[arity]) + + # unpack the k bit vector into a stream of bits + self.unpack = gr.unpack_k_bits_bb(self.bits_per_symbol()) + + if verbose: + self._print_verbage() + + if log: + self._setup_logging() + + # Connect + self.connect(self, self.agc, + self.clock_recov, + self.time_recov, + self.diffdec, self.slicer, self.symbol_mapper, self.unpack, self) + + def samples_per_symbol(self): + return self._samples_per_symbol + + def bits_per_symbol(self=None): # staticmethod that's also callable on an instance + return 1 + bits_per_symbol = staticmethod(bits_per_symbol) # make it a static method. RTFM + + def _print_verbage(self): + print "\nDemodulator:" + print "bits per symbol: %d" % self.bits_per_symbol() + print "Gray code: %s" % self._gray_code + print "RRC roll-off factor: %.2f" % self._excess_bw + print "Costas Loop alpha: %.2f" % self._costas_alpha + print "Costas Loop beta: %.2f" % self._costas_beta + print "Timing alpha gain: %.2f" % self._timing_alpha + print "Timing beta gain: %.2f" % self._timing_beta + print "Timing max dev: %.2f" % self._timing_max_dev + + def _setup_logging(self): + print "Modulation logging turned on." + self.connect(self.pre_scaler, + gr.file_sink(gr.sizeof_gr_complex, "rx_prescaler.dat")) + self.connect(self.agc, + gr.file_sink(gr.sizeof_gr_complex, "rx_agc.dat")) + self.connect(self.rrc_filter, + gr.file_sink(gr.sizeof_gr_complex, "rx_rrc_filter.dat")) + self.connect(self.clock_recov, + gr.file_sink(gr.sizeof_gr_complex, "rx_clock_recov.dat")) + self.connect(self.time_recov, + gr.file_sink(gr.sizeof_gr_complex, "rx_time_recov.dat")) + self.connect(self.diffdec, + gr.file_sink(gr.sizeof_gr_complex, "rx_diffdec.dat")) + self.connect(self.slicer, + gr.file_sink(gr.sizeof_char, "rx_slicer.dat")) + self.connect(self.symbol_mapper, + gr.file_sink(gr.sizeof_char, "rx_symbol_mapper.dat")) + self.connect(self.unpack, + gr.file_sink(gr.sizeof_char, "rx_unpack.dat")) + + def add_options(parser): + """ + Adds DBPSK demodulation-specific options to the standard parser + """ + parser.add_option("", "--excess-bw", type="float", default=_def_excess_bw, + help="set RRC excess bandwith factor [default=%default] (PSK)") + parser.add_option("", "--no-gray-code", dest="gray_code", + action="store_false", default=_def_gray_code, + help="disable gray coding on modulated bits (PSK)") + parser.add_option("", "--costas-alpha", type="float", default=None, + help="set Costas loop alpha value [default=%default] (PSK)") + parser.add_option("", "--gain-alpha", type="float", default=_def_timing_alpha, + help="set timing symbol sync loop gain alpha value [default=%default] (GMSK/PSK)") + parser.add_option("", "--gain-beta", type="float", default=_def_timing_beta, + help="set timing symbol sync loop gain beta value [default=%default] (GMSK/PSK)") + parser.add_option("", "--timing-max-dev", type="float", default=_def_timing_max_dev, + help="set timing symbol sync loop maximum deviation [default=%default] (GMSK/PSK)") + add_options=staticmethod(add_options) + + def extract_kwargs_from_options(options): + """ + Given command line options, create dictionary suitable for passing to __init__ + """ + return modulation_utils.extract_kwargs_from_options( + dbpsk2_demod.__init__, ('self',), options) + extract_kwargs_from_options=staticmethod(extract_kwargs_from_options) +# +# Add these to the mod/demod registry +# +modulation_utils.add_type_1_mod('dbpsk2', dbpsk2_mod) +modulation_utils.add_type_1_demod('dbpsk2', dbpsk2_demod) diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/dqpsk.py b/gnuradio-core/src/python/gnuradio/blks2impl/dqpsk.py index 8c15d2173..42d534168 100644 --- a/gnuradio-core/src/python/gnuradio/blks2impl/dqpsk.py +++ b/gnuradio-core/src/python/gnuradio/blks2impl/dqpsk.py @@ -1,5 +1,5 @@ # -# Copyright 2005,2006,2007 Free Software Foundation, Inc. +# Copyright 2005,2006,2007,2009 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -255,8 +255,8 @@ class dqpsk_demod(gr.hier_block2): self._mm_omega = self._samples_per_symbol self._mm_gain_omega = .25 * self._mm_gain_mu * self._mm_gain_mu self._costas_beta = 0.25 * self._costas_alpha * self._costas_alpha - fmin = -0.025 - fmax = 0.025 + fmin = -0.25 + fmax = 0.25 self.receiver=gr.mpsk_receiver_cc(arity, pi/4.0, self._costas_alpha, self._costas_beta, @@ -264,7 +264,7 @@ class dqpsk_demod(gr.hier_block2): self._mm_mu, self._mm_gain_mu, self._mm_omega, self._mm_gain_omega, self._mm_omega_relative_limit) - + # Perform Differential decoding on the constellation self.diffdec = gr.diff_phasor_cc() diff --git a/gnuradio-core/src/python/gnuradio/blks2impl/dqpsk2.py b/gnuradio-core/src/python/gnuradio/blks2impl/dqpsk2.py new file mode 100644 index 000000000..9704ac98c --- /dev/null +++ b/gnuradio-core/src/python/gnuradio/blks2impl/dqpsk2.py @@ -0,0 +1,353 @@ +# +# Copyright 2005,2006,2007,2009 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +# See gnuradio-examples/python/digital for examples + +""" +differential QPSK modulation and demodulation. +""" + +from gnuradio import gr, gru, modulation_utils +from math import pi, sqrt +import psk +import cmath +from pprint import pprint + +# default values (used in __init__ and add_options) +_def_samples_per_symbol = 2 +_def_excess_bw = 0.35 +_def_gray_code = True +_def_verbose = False +_def_log = False + +_def_costas_alpha = 0.01 +_def_timing_alpha = 0.100 +_def_timing_beta = 0.010 +_def_timing_max_dev = 1.5 + + +# ///////////////////////////////////////////////////////////////////////////// +# DQPSK modulator +# ///////////////////////////////////////////////////////////////////////////// + +class dqpsk2_mod(gr.hier_block2): + + def __init__(self, + samples_per_symbol=_def_samples_per_symbol, + excess_bw=_def_excess_bw, + gray_code=_def_gray_code, + verbose=_def_verbose, + log=_def_log): + """ + Hierarchical block for RRC-filtered QPSK modulation. + + The input is a byte stream (unsigned char) and the + output is the complex modulated signal at baseband. + + @param samples_per_symbol: samples per symbol >= 2 + @type samples_per_symbol: integer + @param excess_bw: Root-raised cosine filter excess bandwidth + @type excess_bw: float + @param gray_code: Tell modulator to Gray code the bits + @type gray_code: bool + @param verbose: Print information about modulator? + @type verbose: bool + @param debug: Print modualtion data to files? + @type debug: bool + """ + + gr.hier_block2.__init__(self, "dqpsk2_mod", + gr.io_signature(1, 1, gr.sizeof_char), # Input signature + gr.io_signature(1, 1, gr.sizeof_gr_complex)) # Output signature + + self._samples_per_symbol = samples_per_symbol + self._excess_bw = excess_bw + self._gray_code = gray_code + + if not isinstance(samples_per_symbol, int) or samples_per_symbol < 2: + raise TypeError, ("sbp must be an integer >= 2, is %d" % samples_per_symbol) + + ntaps = 11 * samples_per_symbol + + arity = pow(2,self.bits_per_symbol()) + + # turn bytes into k-bit vectors + self.bytes2chunks = \ + gr.packed_to_unpacked_bb(self.bits_per_symbol(), gr.GR_MSB_FIRST) + + if self._gray_code: + self.symbol_mapper = gr.map_bb(psk.binary_to_gray[arity]) + else: + self.symbol_mapper = gr.map_bb(psk.binary_to_ungray[arity]) + + self.diffenc = gr.diff_encoder_bb(arity) + + rot = .707 + .707j + rotated_const = map(lambda pt: pt * rot, psk.constellation[arity]) + self.chunks2symbols = gr.chunks_to_symbols_bc(rotated_const) + + # pulse shaping filter + self.rrc_taps = gr.firdes.root_raised_cosine( + self._samples_per_symbol, # gain (sps since we're interpolating by sps) + self._samples_per_symbol, # sampling rate + 1.0, # symbol rate + self._excess_bw, # excess bandwidth (roll-off factor) + ntaps) + + self.rrc_filter = gr.interp_fir_filter_ccf(self._samples_per_symbol, self.rrc_taps) + + if verbose: + self._print_verbage() + + if log: + self._setup_logging() + + # Connect & Initialize base class + self.connect(self, self.bytes2chunks, self.symbol_mapper, self.diffenc, + self.chunks2symbols, self.rrc_filter, self) + + def samples_per_symbol(self): + return self._samples_per_symbol + + def bits_per_symbol(self=None): # staticmethod that's also callable on an instance + return 2 + bits_per_symbol = staticmethod(bits_per_symbol) # make it a static method. RTFM + + def _print_verbage(self): + print "\nModulator:" + print "bits per symbol: %d" % self.bits_per_symbol() + print "Gray code: %s" % self._gray_code + print "RRS roll-off factor: %f" % self._excess_bw + + def _setup_logging(self): + print "Modulation logging turned on." + self.connect(self.bytes2chunks, + gr.file_sink(gr.sizeof_char, "tx_bytes2chunks.dat")) + self.connect(self.symbol_mapper, + gr.file_sink(gr.sizeof_char, "tx_graycoder.dat")) + self.connect(self.diffenc, + gr.file_sink(gr.sizeof_char, "tx_diffenc.dat")) + self.connect(self.chunks2symbols, + gr.file_sink(gr.sizeof_gr_complex, "tx_chunks2symbols.dat")) + self.connect(self.rrc_filter, + gr.file_sink(gr.sizeof_gr_complex, "tx_rrc_filter.dat")) + + def add_options(parser): + """ + Adds QPSK modulation-specific options to the standard parser + """ + parser.add_option("", "--excess-bw", type="float", default=_def_excess_bw, + help="set RRC excess bandwith factor [default=%default] (PSK)") + parser.add_option("", "--no-gray-code", dest="gray_code", + action="store_false", default=_def_gray_code, + help="disable gray coding on modulated bits (PSK)") + add_options=staticmethod(add_options) + + + def extract_kwargs_from_options(options): + """ + Given command line options, create dictionary suitable for passing to __init__ + """ + return modulation_utils.extract_kwargs_from_options(dqpsk2_mod.__init__, + ('self',), options) + extract_kwargs_from_options=staticmethod(extract_kwargs_from_options) + + +# ///////////////////////////////////////////////////////////////////////////// +# DQPSK demodulator +# +# Differentially coherent detection of differentially encoded qpsk +# ///////////////////////////////////////////////////////////////////////////// + +class dqpsk2_demod(gr.hier_block2): + + def __init__(self, + samples_per_symbol=_def_samples_per_symbol, + excess_bw=_def_excess_bw, + costas_alpha=_def_costas_alpha, + timing_alpha=_def_timing_alpha, + timing_max_dev=_def_timing_max_dev, + gray_code=_def_gray_code, + verbose=_def_verbose, + log=_def_log): + """ + Hierarchical block for RRC-filtered DQPSK demodulation + + The input is the complex modulated signal at baseband. + The output is a stream of bits packed 1 bit per byte (LSB) + + @param samples_per_symbol: samples per symbol >= 2 + @type samples_per_symbol: float + @param excess_bw: Root-raised cosine filter excess bandwidth + @type excess_bw: float + @param costas_alpha: loop filter gain + @type costas_alphas: float + @param timing_alpha: timing loop alpha gain + @type timing_alpha: float + @param timing_max: timing loop maximum rate deviations + @type timing_max: float + @param gray_code: Tell modulator to Gray code the bits + @type gray_code: bool + @param verbose: Print information about modulator? + @type verbose: bool + @param debug: Print modualtion data to files? + @type debug: bool + """ + + gr.hier_block2.__init__(self, "dqpsk2_demod", + gr.io_signature(1, 1, gr.sizeof_gr_complex), # Input signature + gr.io_signature(1, 1, gr.sizeof_char)) # Output signature + + self._samples_per_symbol = samples_per_symbol + self._excess_bw = excess_bw + self._costas_alpha = costas_alpha + self._timing_alpha = timing_alpha + self._timing_beta = _def_timing_beta + self._timing_max_dev=timing_max_dev + self._gray_code = gray_code + + if samples_per_symbol < 2: + raise TypeError, "sbp must be >= 2, is %d" % samples_per_symbol + + arity = pow(2,self.bits_per_symbol()) + + # Automatic gain control + self.agc = gr.agc2_cc(0.6e-1, 1e-3, 1, 1, 100) + #self.agc = gr.feedforward_agc_cc(16, 2.0) + + self._costas_beta = 0.25 * self._costas_alpha * self._costas_alpha + # Allow a frequency swing of +/- half of the sample rate + fmin = -0.5 + fmax = 0.5 + + self.clock_recov = gr.costas_loop_cc(self._costas_alpha, + self._costas_beta, + fmax, fmin, arity) + + # symbol timing recovery with RRC data filter + nfilts = 32 + ntaps = 11 * samples_per_symbol*nfilts + taps = gr.firdes.root_raised_cosine(nfilts, nfilts, 1.0/float(self._samples_per_symbol), self._excess_bw, ntaps) + self.time_recov = gr.pfb_clock_sync_ccf(self._samples_per_symbol, + self._timing_alpha, + taps, nfilts, nfilts/2, self._timing_max_dev) + self.time_recov.set_beta(self._timing_beta) + + # Perform Differential decoding on the constellation + self.diffdec = gr.diff_phasor_cc() + + # find closest constellation point + rot = 1 + rotated_const = map(lambda pt: pt * rot, psk.constellation[arity]) + self.slicer = gr.constellation_decoder_cb(rotated_const, range(arity)) + + if self._gray_code: + self.symbol_mapper = gr.map_bb(psk.gray_to_binary[arity]) + else: + self.symbol_mapper = gr.map_bb(psk.ungray_to_binary[arity]) + + # unpack the k bit vector into a stream of bits + self.unpack = gr.unpack_k_bits_bb(self.bits_per_symbol()) + + if verbose: + self._print_verbage() + + if log: + self._setup_logging() + + # Connect + self.connect(self, self.agc, + self.clock_recov, + self.time_recov, + self.diffdec, self.slicer, self.symbol_mapper, self.unpack, self) + + def samples_per_symbol(self): + return self._samples_per_symbol + + def bits_per_symbol(self=None): # staticmethod that's also callable on an instance + return 2 + bits_per_symbol = staticmethod(bits_per_symbol) # make it a static method. RTFM + + def _print_verbage(self): + print "\nDemodulator:" + print "bits per symbol: %d" % self.bits_per_symbol() + print "Gray code: %s" % self._gray_code + print "RRC roll-off factor: %.2f" % self._excess_bw + print "Costas Loop alpha: %.2e" % self._costas_alpha + print "Costas Loop beta: %.2e" % self._costas_beta + print "Timing alpha gain: %.2f" % self._timing_alpha + print "Timing beta gain: %.2f" % self._timing_beta + print "Timing max dev: %.2f" % self._timing_max_dev + + def _setup_logging(self): + print "Modulation logging turned on." + self.connect(self.pre_scaler, + gr.file_sink(gr.sizeof_gr_complex, "rx_prescaler.dat")) + self.connect(self.agc, + gr.file_sink(gr.sizeof_gr_complex, "rx_agc.dat")) + self.connect(self.rrc_filter, + gr.file_sink(gr.sizeof_gr_complex, "rx_rrc_filter.dat")) + self.connect(self.clock_recov, + gr.file_sink(gr.sizeof_gr_complex, "rx_clock_recov.dat")) + self.connect(self.time_recov, + gr.file_sink(gr.sizeof_gr_complex, "rx_time_recov.dat")) + self.connect(self.diffdec, + gr.file_sink(gr.sizeof_gr_complex, "rx_diffdec.dat")) + self.connect(self.slicer, + gr.file_sink(gr.sizeof_char, "rx_slicer.dat")) + self.connect(self.symbol_mapper, + gr.file_sink(gr.sizeof_char, "rx_gray_decoder.dat")) + self.connect(self.unpack, + gr.file_sink(gr.sizeof_char, "rx_unpack.dat")) + + def add_options(parser): + """ + Adds modulation-specific options to the standard parser + """ + parser.add_option("", "--excess-bw", type="float", default=_def_excess_bw, + help="set RRC excess bandwith factor [default=%default] (PSK)") + parser.add_option("", "--no-gray-code", dest="gray_code", + action="store_false", default=_def_gray_code, + help="disable gray coding on modulated bits (PSK)") + parser.add_option("", "--costas-alpha", type="float", default=_def_costas_alpha, + help="set Costas loop alpha value [default=%default] (PSK)") + parser.add_option("", "--gain-alpha", type="float", default=_def_timing_alpha, + help="set timing symbol sync loop gain alpha value [default=%default] (GMSK/PSK)") + parser.add_option("", "--gain-beta", type="float", default=_def_timing_beta, + help="set timing symbol sync loop gain beta value [default=%default] (GMSK/PSK)") + parser.add_option("", "--timing-max-dev", type="float", default=_def_timing_max_dev, + help="set timing symbol sync loop maximum deviation [default=%default] (GMSK/PSK)") + add_options=staticmethod(add_options) + + def extract_kwargs_from_options(options): + """ + Given command line options, create dictionary suitable for passing to __init__ + """ + return modulation_utils.extract_kwargs_from_options( + dqpsk2_demod.__init__, ('self',), options) + extract_kwargs_from_options=staticmethod(extract_kwargs_from_options) + + +# +# Add these to the mod/demod registry +# +modulation_utils.add_type_1_mod('dqpsk2', dqpsk2_mod) +modulation_utils.add_type_1_demod('dqpsk2', dqpsk2_demod) diff --git a/gnuradio-examples/Makefile.am b/gnuradio-examples/Makefile.am index 360ae8b41..9ea890c12 100644 --- a/gnuradio-examples/Makefile.am +++ b/gnuradio-examples/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2004,2007 Free Software Foundation, Inc. +# Copyright 2004,2007,2009 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -23,5 +23,5 @@ include $(top_srcdir)/Makefile.common SUBDIRS = c++ if PYTHON -SUBDIRS += python +SUBDIRS += python grc endif diff --git a/grc/examples/.gitignore b/gnuradio-examples/grc/.gitignore index b336cc7ce..b336cc7ce 100644 --- a/grc/examples/.gitignore +++ b/gnuradio-examples/grc/.gitignore diff --git a/grc/examples/Makefile.am b/gnuradio-examples/grc/Makefile.am index 78321ce0a..97417c5a2 100644 --- a/grc/examples/Makefile.am +++ b/gnuradio-examples/grc/Makefile.am @@ -28,6 +28,11 @@ dist_audiodata_DATA = \ audio/dial_tone.grc \ audio/cvsd_sweep.grc +demoddatadir = $(grc_examples_prefix)/demod +dist_demoddata_DATA = \ + demod/mpsk_demod.grc \ + demod/pam_timing.grc + simpledatadir = $(grc_examples_prefix)/simple dist_simpledata_DATA = \ simple/ber_simulation.grc \ diff --git a/grc/examples/audio/cvsd_sweep.grc b/gnuradio-examples/grc/audio/cvsd_sweep.grc index 8d0b385ce..8d0b385ce 100644 --- a/grc/examples/audio/cvsd_sweep.grc +++ b/gnuradio-examples/grc/audio/cvsd_sweep.grc diff --git a/grc/examples/audio/dial_tone.grc b/gnuradio-examples/grc/audio/dial_tone.grc index ac8cbef27..ac8cbef27 100644 --- a/grc/examples/audio/dial_tone.grc +++ b/gnuradio-examples/grc/audio/dial_tone.grc diff --git a/gnuradio-examples/grc/demod/mpsk_demod.grc b/gnuradio-examples/grc/demod/mpsk_demod.grc new file mode 100644 index 000000000..08108dcba --- /dev/null +++ b/gnuradio-examples/grc/demod/mpsk_demod.grc @@ -0,0 +1,586 @@ +<?xml version='1.0' encoding='ASCII'?> +<flow_graph> + <timestamp>Mon Oct 5 18:34:52 2009</timestamp> + <block> + <key>options</key> + <param> + <key>id</key> + <value>mpsk_demod</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>title</key> + <value>MPSK Demod Demo</value> + </param> + <param> + <key>author</key> + <value></value> + </param> + <param> + <key>description</key> + <value></value> + </param> + <param> + <key>window_size</key> + <value>1280, 1024</value> + </param> + <param> + <key>generate_options</key> + <value>wx_gui</value> + </param> + <param> + <key>category</key> + <value>Custom</value> + </param> + <param> + <key>run_options</key> + <value>prompt</value> + </param> + <param> + <key>run</key> + <value>True</value> + </param> + <param> + <key>realtime_scheduling</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(10, 10)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>samp_rate</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>32000</value> + </param> + <param> + <key>_coordinate</key> + <value>(10, 170)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>random_source_x</key> + <param> + <key>id</key> + <value>random_source_x_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>byte</value> + </param> + <param> + <key>min</key> + <value>0</value> + </param> + <param> + <key>max</key> + <value>2**8</value> + </param> + <param> + <key>num_samps</key> + <value>10000</value> + </param> + <param> + <key>repeat</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(155, 160)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>blks2_dxpsk_mod</key> + <param> + <key>id</key> + <value>blks2_dxpsk_mod_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>dqpsk</value> + </param> + <param> + <key>samples_per_symbol</key> + <value>samps_per_sym</value> + </param> + <param> + <key>excess_bw</key> + <value>0.35</value> + </param> + <param> + <key>gray_code</key> + <value>True</value> + </param> + <param> + <key>verbose</key> + <value>False</value> + </param> + <param> + <key>log</key> + <value>False</value> + </param> + <param> + <key>_coordinate</key> + <value>(391, 54)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_throttle</key> + <param> + <key>id</key> + <value>gr_throttle_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>samples_per_second</key> + <value>samp_rate</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(654, 142)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>samps_per_sym</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>4</value> + </param> + <param> + <key>_coordinate</key> + <value>(7, 89)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_channel_model</key> + <param> + <key>id</key> + <value>gr_channel_model_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>noise_voltage</key> + <value>noise</value> + </param> + <param> + <key>freq_offset</key> + <value>freq_off</value> + </param> + <param> + <key>epsilon</key> + <value>1.0</value> + </param> + <param> + <key>taps</key> + <value>1.0</value> + </param> + <param> + <key>seed</key> + <value>42</value> + </param> + <param> + <key>_coordinate</key> + <value>(487, 282)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_slider</key> + <param> + <key>id</key> + <value>noise</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>label</key> + <value>Noise</value> + </param> + <param> + <key>value</key> + <value>.1</value> + </param> + <param> + <key>min</key> + <value>0</value> + </param> + <param> + <key>max</key> + <value>1</value> + </param> + <param> + <key>num_steps</key> + <value>100</value> + </param> + <param> + <key>style</key> + <value>wx.SL_HORIZONTAL</value> + </param> + <param> + <key>converver</key> + <value>float_converter</value> + </param> + <param> + <key>grid_pos</key> + <value></value> + </param> + <param> + <key>notebook</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(259, 353)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_slider</key> + <param> + <key>id</key> + <value>freq_off</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>label</key> + <value>Freq Offset</value> + </param> + <param> + <key>value</key> + <value>0</value> + </param> + <param> + <key>min</key> + <value>-.5</value> + </param> + <param> + <key>max</key> + <value>.5</value> + </param> + <param> + <key>num_steps</key> + <value>1000</value> + </param> + <param> + <key>style</key> + <value>wx.SL_HORIZONTAL</value> + </param> + <param> + <key>converver</key> + <value>float_converter</value> + </param> + <param> + <key>grid_pos</key> + <value></value> + </param> + <param> + <key>notebook</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(126, 345)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>notebook</key> + <param> + <key>id</key> + <value>notebook</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>style</key> + <value>wx.NB_TOP</value> + </param> + <param> + <key>labels</key> + <value>['Constellation', 'Spectrum']</value> + </param> + <param> + <key>grid_pos</key> + <value></value> + </param> + <param> + <key>notebook</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(520, 407)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>wxgui_constellationsink2</key> + <param> + <key>id</key> + <value>wxgui_constellationsink2_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>title</key> + <value>Constellation Plot</value> + </param> + <param> + <key>samp_rate</key> + <value>samp_rate</value> + </param> + <param> + <key>frame_rate</key> + <value>5</value> + </param> + <param> + <key>const_size</key> + <value>2048</value> + </param> + <param> + <key>M</key> + <value>4</value> + </param> + <param> + <key>theta</key> + <value>0</value> + </param> + <param> + <key>alpha</key> + <value>0.005</value> + </param> + <param> + <key>fmax</key> + <value>0.06</value> + </param> + <param> + <key>mu</key> + <value>0.5</value> + </param> + <param> + <key>gain_mu</key> + <value>0.005</value> + </param> + <param> + <key>symbol_rate</key> + <value>samp_rate/4.</value> + </param> + <param> + <key>omega_limit</key> + <value>0.005</value> + </param> + <param> + <key>grid_pos</key> + <value></value> + </param> + <param> + <key>notebook</key> + <value>notebook, 0</value> + </param> + <param> + <key>_coordinate</key> + <value>(824, 212)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>wxgui_fftsink2</key> + <param> + <key>id</key> + <value>wxgui_fftsink2_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>title</key> + <value>FFT Plot</value> + </param> + <param> + <key>samp_rate</key> + <value>samp_rate</value> + </param> + <param> + <key>baseband_freq</key> + <value>0</value> + </param> + <param> + <key>y_per_div</key> + <value>10</value> + </param> + <param> + <key>y_divs</key> + <value>10</value> + </param> + <param> + <key>ref_level</key> + <value>50</value> + </param> + <param> + <key>ref_scale</key> + <value>2.0</value> + </param> + <param> + <key>fft_size</key> + <value>1024</value> + </param> + <param> + <key>fft_rate</key> + <value>30</value> + </param> + <param> + <key>peak_hold</key> + <value>False</value> + </param> + <param> + <key>average</key> + <value>False</value> + </param> + <param> + <key>avg_alpha</key> + <value>0</value> + </param> + <param> + <key>grid_pos</key> + <value></value> + </param> + <param> + <key>notebook</key> + <value>notebook, 1</value> + </param> + <param> + <key>_coordinate</key> + <value>(847, 10)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <connection> + <source_block_id>random_source_x_0</source_block_id> + <sink_block_id>blks2_dxpsk_mod_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_throttle_0</source_block_id> + <sink_block_id>wxgui_constellationsink2_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_throttle_0</source_block_id> + <sink_block_id>wxgui_fftsink2_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blks2_dxpsk_mod_0</source_block_id> + <sink_block_id>gr_channel_model_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_channel_model_0</source_block_id> + <sink_block_id>gr_throttle_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> +</flow_graph> diff --git a/gnuradio-examples/grc/demod/pam_timing.grc b/gnuradio-examples/grc/demod/pam_timing.grc new file mode 100644 index 000000000..4e2a2f861 --- /dev/null +++ b/gnuradio-examples/grc/demod/pam_timing.grc @@ -0,0 +1,1424 @@ +<?xml version='1.0' encoding='ASCII'?> +<flow_graph> + <timestamp>Mon Oct 12 17:54:59 2009</timestamp> + <block> + <key>options</key> + <param> + <key>id</key> + <value>top_block</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>title</key> + <value></value> + </param> + <param> + <key>author</key> + <value></value> + </param> + <param> + <key>description</key> + <value></value> + </param> + <param> + <key>window_size</key> + <value>1280, 1024</value> + </param> + <param> + <key>generate_options</key> + <value>wx_gui</value> + </param> + <param> + <key>category</key> + <value>Custom</value> + </param> + <param> + <key>run_options</key> + <value>prompt</value> + </param> + <param> + <key>run</key> + <value>True</value> + </param> + <param> + <key>realtime_scheduling</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(10, 10)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_uchar_to_float</key> + <param> + <key>id</key> + <value>gr_uchar_to_float_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(217, 108)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_uchar_to_float</key> + <param> + <key>id</key> + <value>gr_uchar_to_float_0_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(216, 273)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>samp_rate</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>32000</value> + </param> + <param> + <key>_coordinate</key> + <value>(128, 9)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_slider</key> + <param> + <key>id</key> + <value>freq_offset</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>label</key> + <value>Frequency Offset</value> + </param> + <param> + <key>value</key> + <value>0</value> + </param> + <param> + <key>min</key> + <value>-0.5</value> + </param> + <param> + <key>max</key> + <value>0.5</value> + </param> + <param> + <key>num_steps</key> + <value>1000</value> + </param> + <param> + <key>style</key> + <value>wx.SL_HORIZONTAL</value> + </param> + <param> + <key>converver</key> + <value>float_converter</value> + </param> + <param> + <key>grid_pos</key> + <value></value> + </param> + <param> + <key>notebook</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(293, 684)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>rrctaps</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>firdes.root_raised_cosine(nfilts,1.0,1.0/(spb*nfilts), .35, int(11*spb*nfilts))</value> + </param> + <param> + <key>_coordinate</key> + <value>(513, 679)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>random_source_x</key> + <param> + <key>id</key> + <value>random_source_x_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>byte</value> + </param> + <param> + <key>min</key> + <value>0</value> + </param> + <param> + <key>max</key> + <value>pam_amp</value> + </param> + <param> + <key>num_samps</key> + <value>10000</value> + </param> + <param> + <key>repeat</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(13, 80)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>random_source_x</key> + <param> + <key>id</key> + <value>random_source_x_0_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>byte</value> + </param> + <param> + <key>min</key> + <value>0</value> + </param> + <param> + <key>max</key> + <value>pam_amp</value> + </param> + <param> + <key>num_samps</key> + <value>10000</value> + </param> + <param> + <key>repeat</key> + <value>True</value> + </param> + <param> + <key>_coordinate</key> + <value>(15, 245)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>const_source_x</key> + <param> + <key>id</key> + <value>const_source_x_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>const</key> + <value>-0.5*(pam_amp-1)</value> + </param> + <param> + <key>_coordinate</key> + <value>(213, 197)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>const_source_x</key> + <param> + <key>id</key> + <value>const_source_x_0_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>const</key> + <value>-0.5*(pam_amp-1)</value> + </param> + <param> + <key>_coordinate</key> + <value>(200, 360)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>wxgui_scopesink2</key> + <param> + <key>id</key> + <value>wxgui_scopesink2_0_0_0_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>title</key> + <value>Scope Plot</value> + </param> + <param> + <key>samp_rate</key> + <value>samp_rate</value> + </param> + <param> + <key>v_scale</key> + <value>1.25</value> + </param> + <param> + <key>t_scale</key> + <value>0</value> + </param> + <param> + <key>ac_couple</key> + <value>False</value> + </param> + <param> + <key>xy_mode</key> + <value>False</value> + </param> + <param> + <key>num_inputs</key> + <value>1</value> + </param> + <param> + <key>grid_pos</key> + <value></value> + </param> + <param> + <key>notebook</key> + <value>notebook_0,2</value> + </param> + <param> + <key>_coordinate</key> + <value>(1111, 767)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>wxgui_scopesink2</key> + <param> + <key>id</key> + <value>wxgui_scopesink2_0_0_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>title</key> + <value>Scope Plot</value> + </param> + <param> + <key>samp_rate</key> + <value>samp_rate</value> + </param> + <param> + <key>v_scale</key> + <value>9</value> + </param> + <param> + <key>t_scale</key> + <value>0</value> + </param> + <param> + <key>ac_couple</key> + <value>False</value> + </param> + <param> + <key>xy_mode</key> + <value>False</value> + </param> + <param> + <key>num_inputs</key> + <value>1</value> + </param> + <param> + <key>grid_pos</key> + <value></value> + </param> + <param> + <key>notebook</key> + <value>notebook_0,1</value> + </param> + <param> + <key>_coordinate</key> + <value>(1112, 881)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_channel_model</key> + <param> + <key>id</key> + <value>gr_channel_model_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>noise_voltage</key> + <value>noise_amp</value> + </param> + <param> + <key>freq_offset</key> + <value>freq_offset</value> + </param> + <param> + <key>epsilon</key> + <value>interpratio</value> + </param> + <param> + <key>taps</key> + <value>1.0</value> + </param> + <param> + <key>seed</key> + <value>42</value> + </param> + <param> + <key>_coordinate</key> + <value>(59, 543)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_throttle</key> + <param> + <key>id</key> + <value>gr_throttle_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>samples_per_second</key> + <value>samp_rate</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(290, 575)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>notebook</key> + <param> + <key>id</key> + <value>notebook_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>style</key> + <value>wx.NB_TOP</value> + </param> + <param> + <key>labels</key> + <value>['error', 'phase', 'freq', 'Resampled Signal']</value> + </param> + <param> + <key>grid_pos</key> + <value></value> + </param> + <param> + <key>notebook</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(729, 769)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>wxgui_scopesink2</key> + <param> + <key>id</key> + <value>wxgui_scopesink2_0_0_1</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>title</key> + <value>Error</value> + </param> + <param> + <key>samp_rate</key> + <value>samp_rate</value> + </param> + <param> + <key>v_scale</key> + <value>.5</value> + </param> + <param> + <key>t_scale</key> + <value>0</value> + </param> + <param> + <key>ac_couple</key> + <value>False</value> + </param> + <param> + <key>xy_mode</key> + <value>False</value> + </param> + <param> + <key>num_inputs</key> + <value>1</value> + </param> + <param> + <key>grid_pos</key> + <value></value> + </param> + <param> + <key>notebook</key> + <value>notebook_0,3</value> + </param> + <param> + <key>_coordinate</key> + <value>(1115, 358)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_add_xx</key> + <param> + <key>id</key> + <value>gr_add_xx_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>num_inputs</key> + <value>2</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(440, 167)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_add_xx</key> + <param> + <key>id</key> + <value>gr_add_xx_0_1</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>num_inputs</key> + <value>2</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(430, 330)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_float_to_complex</key> + <param> + <key>id</key> + <value>gr_float_to_complex_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(590, 184)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>wxgui_scopesink2</key> + <param> + <key>id</key> + <value>wxgui_scopesink2_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>title</key> + <value>Scope Plot</value> + </param> + <param> + <key>samp_rate</key> + <value>samp_rate</value> + </param> + <param> + <key>v_scale</key> + <value>0</value> + </param> + <param> + <key>t_scale</key> + <value>0</value> + </param> + <param> + <key>ac_couple</key> + <value>False</value> + </param> + <param> + <key>xy_mode</key> + <value>False</value> + </param> + <param> + <key>num_inputs</key> + <value>1</value> + </param> + <param> + <key>grid_pos</key> + <value></value> + </param> + <param> + <key>notebook</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(1116, 500)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>nfilts</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>32</value> + </param> + <param> + <key>_coordinate</key> + <value>(435, 686)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_pfb_clock_sync_ccf</key> + <param> + <key>id</key> + <value>gr_pfb_clock_sync_ccf_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>sps</key> + <value>spb</value> + </param> + <param> + <key>alpha</key> + <value>alpha</value> + </param> + <param> + <key>beta</key> + <value>beta</value> + </param> + <param> + <key>taps</key> + <value>rrctaps</value> + </param> + <param> + <key>filter_size</key> + <value>nfilts</value> + </param> + <param> + <key>init_phase</key> + <value>16</value> + </param> + <param> + <key>max_dev</key> + <value>1.5</value> + </param> + <param> + <key>_coordinate</key> + <value>(512, 527)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_slider</key> + <param> + <key>id</key> + <value>noise_amp</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>label</key> + <value>Channel Noise</value> + </param> + <param> + <key>value</key> + <value>0</value> + </param> + <param> + <key>min</key> + <value>0</value> + </param> + <param> + <key>max</key> + <value>1.0</value> + </param> + <param> + <key>num_steps</key> + <value>1000</value> + </param> + <param> + <key>style</key> + <value>wx.SL_HORIZONTAL</value> + </param> + <param> + <key>converver</key> + <value>float_converter</value> + </param> + <param> + <key>grid_pos</key> + <value></value> + </param> + <param> + <key>notebook</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(168, 684)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_slider</key> + <param> + <key>id</key> + <value>interpratio</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>label</key> + <value>Timing Offset</value> + </param> + <param> + <key>value</key> + <value>1.00</value> + </param> + <param> + <key>min</key> + <value>0.99</value> + </param> + <param> + <key>max</key> + <value>1.01</value> + </param> + <param> + <key>num_steps</key> + <value>1000</value> + </param> + <param> + <key>style</key> + <value>wx.SL_HORIZONTAL</value> + </param> + <param> + <key>converver</key> + <value>float_converter</value> + </param> + <param> + <key>grid_pos</key> + <value></value> + </param> + <param> + <key>notebook</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(40, 684)</value> + </param> + <param> + <key>_rotation</key> + <value>180</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>spb_gen</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>4</value> + </param> + <param> + <key>_coordinate</key> + <value>(119, 841)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable_slider</key> + <param> + <key>id</key> + <value>beta</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>label</key> + <value>Timing Beta</value> + </param> + <param> + <key>value</key> + <value>0</value> + </param> + <param> + <key>min</key> + <value>0.0</value> + </param> + <param> + <key>max</key> + <value>0.1</value> + </param> + <param> + <key>num_steps</key> + <value>1000</value> + </param> + <param> + <key>style</key> + <value>wx.SL_HORIZONTAL</value> + </param> + <param> + <key>converver</key> + <value>float_converter</value> + </param> + <param> + <key>grid_pos</key> + <value></value> + </param> + <param> + <key>notebook</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(668, 5)</value> + </param> + <param> + <key>_rotation</key> + <value>180</value> + </param> + </block> + <block> + <key>variable_slider</key> + <param> + <key>id</key> + <value>alpha</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>label</key> + <value>Timing Alpha</value> + </param> + <param> + <key>value</key> + <value>0</value> + </param> + <param> + <key>min</key> + <value>0</value> + </param> + <param> + <key>max</key> + <value>1</value> + </param> + <param> + <key>num_steps</key> + <value>1000</value> + </param> + <param> + <key>style</key> + <value>wx.SL_HORIZONTAL</value> + </param> + <param> + <key>converver</key> + <value>float_converter</value> + </param> + <param> + <key>grid_pos</key> + <value></value> + </param> + <param> + <key>notebook</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(552, 4)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>wxgui_scopesink2</key> + <param> + <key>id</key> + <value>wxgui_scopesink2_0_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>float</value> + </param> + <param> + <key>title</key> + <value>Error</value> + </param> + <param> + <key>samp_rate</key> + <value>samp_rate</value> + </param> + <param> + <key>v_scale</key> + <value>3</value> + </param> + <param> + <key>t_scale</key> + <value>0</value> + </param> + <param> + <key>ac_couple</key> + <value>False</value> + </param> + <param> + <key>xy_mode</key> + <value>False</value> + </param> + <param> + <key>num_inputs</key> + <value>1</value> + </param> + <param> + <key>grid_pos</key> + <value></value> + </param> + <param> + <key>notebook</key> + <value>notebook_0,0</value> + </param> + <param> + <key>_coordinate</key> + <value>(1110, 651)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>root_raised_cosine_filter</key> + <param> + <key>id</key> + <value>root_raised_cosine_filter_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>interp_fir_filter_ccf</value> + </param> + <param> + <key>decim</key> + <value>1</value> + </param> + <param> + <key>interp</key> + <value>spb_gen</value> + </param> + <param> + <key>gain</key> + <value>2*spb_gen</value> + </param> + <param> + <key>samp_rate</key> + <value>1.0</value> + </param> + <param> + <key>sym_rate</key> + <value>1./spb_gen</value> + </param> + <param> + <key>alpha</key> + <value>0.35</value> + </param> + <param> + <key>ntaps</key> + <value>11*spb_gen</value> + </param> + <param> + <key>_coordinate</key> + <value>(834, 157)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>blks2_pfb_arb_resampler_ccf</key> + <param> + <key>id</key> + <value>blks2_pfb_arb_resampler_ccf_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>rate</key> + <value>float(spb)/float(spb_gen)</value> + </param> + <param> + <key>taps</key> + <value>firdes.low_pass(128, 128, 0.45, 0.1)</value> + </param> + <param> + <key>size</key> + <value>128</value> + </param> + <param> + <key>_coordinate</key> + <value>(617, 374)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>gr_multiply_const_vxx</key> + <param> + <key>id</key> + <value>gr_multiply_const_vxx_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>type</key> + <value>complex</value> + </param> + <param> + <key>const</key> + <value>sig_amp</value> + </param> + <param> + <key>vlen</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(1096, 197)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>pam_amp</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>2</value> + </param> + <param> + <key>_coordinate</key> + <value>(223, 9)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>spb</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>4.1</value> + </param> + <param> + <key>_coordinate</key> + <value>(32, 842)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>variable</key> + <param> + <key>id</key> + <value>sig_amp</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>value</key> + <value>1</value> + </param> + <param> + <key>_coordinate</key> + <value>(315, 9)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <connection> + <source_block_id>gr_pfb_clock_sync_ccf_0</source_block_id> + <sink_block_id>wxgui_scopesink2_0_0</sink_block_id> + <source_key>1</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_pfb_clock_sync_ccf_0</source_block_id> + <sink_block_id>wxgui_scopesink2_0_0_0</sink_block_id> + <source_key>3</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_pfb_clock_sync_ccf_0</source_block_id> + <sink_block_id>wxgui_scopesink2_0_0_0_0</sink_block_id> + <source_key>2</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>random_source_x_0</source_block_id> + <sink_block_id>gr_uchar_to_float_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_uchar_to_float_0</source_block_id> + <sink_block_id>gr_add_xx_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>const_source_x_0</source_block_id> + <sink_block_id>gr_add_xx_0</sink_block_id> + <source_key>0</source_key> + <sink_key>1</sink_key> + </connection> + <connection> + <source_block_id>gr_uchar_to_float_0_0</source_block_id> + <sink_block_id>gr_add_xx_0_1</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>const_source_x_0_0</source_block_id> + <sink_block_id>gr_add_xx_0_1</sink_block_id> + <source_key>0</source_key> + <sink_key>1</sink_key> + </connection> + <connection> + <source_block_id>random_source_x_0_0</source_block_id> + <sink_block_id>gr_uchar_to_float_0_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blks2_pfb_arb_resampler_ccf_0</source_block_id> + <sink_block_id>gr_channel_model_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>blks2_pfb_arb_resampler_ccf_0</source_block_id> + <sink_block_id>wxgui_scopesink2_0_0_1</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_channel_model_0</source_block_id> + <sink_block_id>gr_throttle_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_throttle_0</source_block_id> + <sink_block_id>gr_pfb_clock_sync_ccf_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_pfb_clock_sync_ccf_0</source_block_id> + <sink_block_id>wxgui_scopesink2_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_add_xx_0</source_block_id> + <sink_block_id>gr_float_to_complex_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_add_xx_0_1</source_block_id> + <sink_block_id>gr_float_to_complex_0</sink_block_id> + <source_key>0</source_key> + <sink_key>1</sink_key> + </connection> + <connection> + <source_block_id>gr_float_to_complex_0</source_block_id> + <sink_block_id>root_raised_cosine_filter_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>root_raised_cosine_filter_0</source_block_id> + <sink_block_id>gr_multiply_const_vxx_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> + <connection> + <source_block_id>gr_multiply_const_vxx_0</source_block_id> + <sink_block_id>blks2_pfb_arb_resampler_ccf_0</sink_block_id> + <source_key>0</source_key> + <sink_key>0</sink_key> + </connection> +</flow_graph> diff --git a/grc/examples/simple/ber_simulation.grc b/gnuradio-examples/grc/simple/ber_simulation.grc index 618add29c..618add29c 100644 --- a/grc/examples/simple/ber_simulation.grc +++ b/gnuradio-examples/grc/simple/ber_simulation.grc diff --git a/grc/examples/simple/dpsk_loopback.grc b/gnuradio-examples/grc/simple/dpsk_loopback.grc index 6a507c98d..6a507c98d 100644 --- a/grc/examples/simple/dpsk_loopback.grc +++ b/gnuradio-examples/grc/simple/dpsk_loopback.grc diff --git a/grc/examples/simple/var_sink_taps.grc b/gnuradio-examples/grc/simple/var_sink_taps.grc index 07207850e..07207850e 100644 --- a/grc/examples/simple/var_sink_taps.grc +++ b/gnuradio-examples/grc/simple/var_sink_taps.grc diff --git a/grc/examples/simple/variable_config.grc b/gnuradio-examples/grc/simple/variable_config.grc index 95c287cce..95c287cce 100644 --- a/grc/examples/simple/variable_config.grc +++ b/gnuradio-examples/grc/simple/variable_config.grc diff --git a/grc/examples/trellis/interference_cancellation.grc b/gnuradio-examples/grc/trellis/interference_cancellation.grc index e93babd78..e93babd78 100644 --- a/grc/examples/trellis/interference_cancellation.grc +++ b/gnuradio-examples/grc/trellis/interference_cancellation.grc diff --git a/grc/examples/trellis/readme.txt b/gnuradio-examples/grc/trellis/readme.txt index d620fd628..d620fd628 100644 --- a/grc/examples/trellis/readme.txt +++ b/gnuradio-examples/grc/trellis/readme.txt diff --git a/grc/examples/usrp/usrp2_const_wave.grc b/gnuradio-examples/grc/usrp/usrp2_const_wave.grc index fdbd7c1f3..fdbd7c1f3 100644 --- a/grc/examples/usrp/usrp2_const_wave.grc +++ b/gnuradio-examples/grc/usrp/usrp2_const_wave.grc diff --git a/grc/examples/usrp/usrp2_dpsk_mod.grc b/gnuradio-examples/grc/usrp/usrp2_dpsk_mod.grc index e9f9b41ea..e9f9b41ea 100644 --- a/grc/examples/usrp/usrp2_dpsk_mod.grc +++ b/gnuradio-examples/grc/usrp/usrp2_dpsk_mod.grc diff --git a/grc/examples/usrp/usrp2_fft.grc b/gnuradio-examples/grc/usrp/usrp2_fft.grc index 134bd4614..134bd4614 100644 --- a/grc/examples/usrp/usrp2_fft.grc +++ b/gnuradio-examples/grc/usrp/usrp2_fft.grc diff --git a/grc/examples/usrp/usrp_two_tone_loopback.grc b/gnuradio-examples/grc/usrp/usrp_two_tone_loopback.grc index 3df977044..3df977044 100644 --- a/grc/examples/usrp/usrp_two_tone_loopback.grc +++ b/gnuradio-examples/grc/usrp/usrp_two_tone_loopback.grc diff --git a/grc/examples/usrp/usrp_wbfm_receive.grc b/gnuradio-examples/grc/usrp/usrp_wbfm_receive.grc index 8f53475ab..8f53475ab 100644 --- a/grc/examples/usrp/usrp_wbfm_receive.grc +++ b/gnuradio-examples/grc/usrp/usrp_wbfm_receive.grc diff --git a/grc/examples/xmlrpc/readme.txt b/gnuradio-examples/grc/xmlrpc/readme.txt index c1f87c1cb..c1f87c1cb 100644 --- a/grc/examples/xmlrpc/readme.txt +++ b/gnuradio-examples/grc/xmlrpc/readme.txt diff --git a/grc/examples/xmlrpc/xmlrpc_client.grc b/gnuradio-examples/grc/xmlrpc/xmlrpc_client.grc index 3bb4e7ed3..3bb4e7ed3 100644 --- a/grc/examples/xmlrpc/xmlrpc_client.grc +++ b/gnuradio-examples/grc/xmlrpc/xmlrpc_client.grc diff --git a/grc/examples/xmlrpc/xmlrpc_client_script.py b/gnuradio-examples/grc/xmlrpc/xmlrpc_client_script.py index 956fa07fb..956fa07fb 100644 --- a/grc/examples/xmlrpc/xmlrpc_client_script.py +++ b/gnuradio-examples/grc/xmlrpc/xmlrpc_client_script.py diff --git a/grc/examples/xmlrpc/xmlrpc_server.grc b/gnuradio-examples/grc/xmlrpc/xmlrpc_server.grc index dc539ef1b..dc539ef1b 100644 --- a/grc/examples/xmlrpc/xmlrpc_server.grc +++ b/gnuradio-examples/grc/xmlrpc/xmlrpc_server.grc diff --git a/gnuradio-examples/python/digital/benchmark_qt_loopback.py b/gnuradio-examples/python/digital/benchmark_qt_loopback.py index e43bffa26..35cc2e376 100755 --- a/gnuradio-examples/python/digital/benchmark_qt_loopback.py +++ b/gnuradio-examples/python/digital/benchmark_qt_loopback.py @@ -52,7 +52,7 @@ class dialog_box(QtGui.QMainWindow): self.set_frequency(self.fg.frequency_offset()) self.set_time_offset(self.fg.timing_offset()) - self.set_gain_mu(self.fg.rx_gain_mu()) + self.set_gain_mu(self.fg.rx_timing_gain_alpha()) self.set_alpha(self.fg.rx_alpha()) # Add the qtsnk widgets to the hlayout box @@ -158,7 +158,7 @@ class dialog_box(QtGui.QMainWindow): def gainMuEditText(self): try: gain = self.gui.gainMuEdit.text().toDouble()[0] - self.fg.set_rx_gain_mu(gain) + self.fg.set_rx_timing_gain_alpha(gain) except RuntimeError: pass @@ -202,7 +202,7 @@ class my_top_block(gr.top_block): self.rxpath = receive_path(demod_class, rx_callback, options) # FIXME: do better exposure to lower issues for control - self._gain_mu = self.rxpath.packet_receiver._demodulator._mm_gain_mu + self._timing_gain_alpha = self.rxpath.packet_receiver._demodulator._timing_alpha self._alpha = self.rxpath.packet_receiver._demodulator._costas_alpha if channelon: @@ -240,16 +240,21 @@ class my_top_block(gr.top_block): # Connect to the QT sinks # FIXME: make better exposure to receiver from rxpath - self.receiver = self.rxpath.packet_receiver._demodulator.receiver + self.freq_recov = self.rxpath.packet_receiver._demodulator.clock_recov + self.time_recov = self.rxpath.packet_receiver._demodulator.time_recov + self.freq_recov.set_alpha(0) + self.freq_recov.set_beta(0) + self.time_recov.set_alpha(2) + self.time_recov.set_beta(0.02) self.connect(self.channel, self.snk_tx) - self.connect(self.receiver, self.snk_rx) + self.connect(self.time_recov, self.snk_rx) pyTxQt = self.snk_tx.pyqwidget() pyTx = sip.wrapinstance(pyTxQt, QtGui.QWidget) - + pyRxQt = self.snk_rx.pyqwidget() pyRx = sip.wrapinstance(pyRxQt, QtGui.QWidget) - + self.main_box = dialog_box(pyTx, pyRx, self) self.main_box.show() @@ -299,17 +304,15 @@ class my_top_block(gr.top_block): # Receiver Parameters - def rx_gain_mu(self): - return self._gain_mu + def rx_timing_gain_alpha(self): + return self._timing_gain_alpha - def rx_gain_omega(self): - return self.gain_omega + def rx_timing_gain_beta(self): + return self._timing_gain_beta - def set_rx_gain_mu(self, gain): - self._gain_mu = gain - self.gain_omega = .25 * self._gain_mu * self._gain_mu - self.receiver.set_gain_mu(self._gain_mu) - self.receiver.set_gain_omega(self.gain_omega) + def set_rx_timing_gain_alpha(self, gain): + self._timing_gain_alpha = gain + self.time_recov.set_gain(self._timing_gain_alpha) def rx_alpha(self): return self._alpha @@ -320,8 +323,8 @@ class my_top_block(gr.top_block): def set_rx_alpha(self, alpha): self._alpha = alpha self.beta = .25 * self._alpha * self._alpha - self.receiver.set_alpha(self._alpha) - self.receiver.set_beta(self.beta) + #self.freq_recov.set_alpha(self._alpha) + #self.freq_recov.set_beta(self.beta) diff --git a/gnuradio-examples/python/digital/benchmark_qt_loopback2.py b/gnuradio-examples/python/digital/benchmark_qt_loopback2.py new file mode 100755 index 000000000..101dd68d6 --- /dev/null +++ b/gnuradio-examples/python/digital/benchmark_qt_loopback2.py @@ -0,0 +1,488 @@ +#!/usr/bin/env python + +from gnuradio import gr, gru, modulation_utils +from gnuradio import eng_notation +from gnuradio.eng_option import eng_option +from optparse import OptionParser +import random, time, struct, sys, os, math + +from threading import Thread + +# from current dir +from transmit_path import transmit_path +from receive_path import receive_path + +try: + from gnuradio.qtgui import qtgui + from PyQt4 import QtGui, QtCore + import sip +except ImportError: + print "Please install gr-qtgui." + sys.exit(1) + +try: + from qt_digital_window2 import Ui_DigitalWindow +except ImportError: + print "Error: could not find qt_digital_window2.py:" + print "\t\"pyuic4 qt_digital_window2.ui -o qt_digital_window2.py\"" + sys.exit(1) + + +#print os.getpid() +#raw_input() + + +# //////////////////////////////////////////////////////////////////// +# Define the QT Interface and Control Dialog +# //////////////////////////////////////////////////////////////////// + + +class dialog_box(QtGui.QMainWindow): + def __init__(self, snkTx, snkRx, fg, parent=None): + + QtGui.QWidget.__init__(self, parent) + self.gui = Ui_DigitalWindow() + self.gui.setupUi(self) + + self.fg = fg + + self.set_sample_rate(self.fg.sample_rate()) + + self.set_snr(self.fg.snr()) + self.set_frequency(self.fg.frequency_offset()) + self.set_time_offset(self.fg.timing_offset()) + + self.set_alpha_time(self.fg.rx_timing_gain_alpha()) + self.set_beta_time(self.fg.rx_timing_gain_beta()) + self.set_alpha_freq(self.fg.rx_freq_gain_alpha()) + + # Add the qtsnk widgets to the hlayout box + self.gui.sinkLayout.addWidget(snkTx) + self.gui.sinkLayout.addWidget(snkRx) + + + # Connect up some signals + self.connect(self.gui.pauseButton, QtCore.SIGNAL("clicked()"), + self.pauseFg) + + self.connect(self.gui.sampleRateEdit, QtCore.SIGNAL("editingFinished()"), + self.sampleRateEditText) + + self.connect(self.gui.snrEdit, QtCore.SIGNAL("editingFinished()"), + self.snrEditText) + self.connect(self.gui.freqEdit, QtCore.SIGNAL("editingFinished()"), + self.freqEditText) + self.connect(self.gui.timeEdit, QtCore.SIGNAL("editingFinished()"), + self.timeEditText) + + self.connect(self.gui.alphaTimeEdit, QtCore.SIGNAL("editingFinished()"), + self.alphaTimeEditText) + self.connect(self.gui.betaTimeEdit, QtCore.SIGNAL("editingFinished()"), + self.betaTimeEditText) + self.connect(self.gui.alphaFreqEdit, QtCore.SIGNAL("editingFinished()"), + self.alphaFreqEditText) + + # Build a timer to update the packet number and PER fields + self.update_delay = 250 # time between updating packet rate fields + self.pkt_timer = QtCore.QTimer(self) + self.connect(self.pkt_timer, QtCore.SIGNAL("timeout()"), + self.updatePacketInfo) + self.pkt_timer.start(self.update_delay) + + def pauseFg(self): + if(self.gui.pauseButton.text() == "Pause"): + self.fg.stop() + self.fg.wait() + self.gui.pauseButton.setText("Unpause") + else: + self.fg.start() + self.gui.pauseButton.setText("Pause") + + # Accessor functions for Gui to manipulate system parameters + def set_sample_rate(self, sr): + ssr = eng_notation.num_to_str(sr) + self.gui.sampleRateEdit.setText(QtCore.QString("%1").arg(ssr)) + + def sampleRateEditText(self): + try: + rate = self.gui.sampleRateEdit.text().toAscii() + srate = eng_notation.str_to_num(rate) + #self.fg.set_sample_rate(srate) + except RuntimeError: + pass + + + # Accessor functions for Gui to manipulate channel model + def set_snr(self, snr): + self.gui.snrEdit.setText(QtCore.QString("%1").arg(snr)) + + def set_frequency(self, fo): + self.gui.freqEdit.setText(QtCore.QString("%1").arg(fo)) + + def set_time_offset(self, to): + self.gui.timeEdit.setText(QtCore.QString("%1").arg(to)) + + def snrEditText(self): + try: + snr = self.gui.snrEdit.text().toDouble()[0] + self.fg.set_snr(snr) + except RuntimeError: + pass + + def freqEditText(self): + try: + freq = self.gui.freqEdit.text().toDouble()[0] + self.fg.set_frequency_offset(freq) + except RuntimeError: + pass + + def timeEditText(self): + try: + to = self.gui.timeEdit.text().toDouble()[0] + self.fg.set_timing_offset(to) + except RuntimeError: + pass + + + # Accessor functions for Gui to manipulate receiver parameters + def set_alpha_time(self, alpha): + self.gui.alphaTimeEdit.setText(QtCore.QString("%1").arg(alpha)) + + def set_beta_time(self, beta): + self.gui.betaTimeEdit.setText(QtCore.QString("%1").arg(beta)) + + def set_alpha_freq(self, alpha): + self.gui.alphaFreqEdit.setText(QtCore.QString("%1").arg(alpha)) + + def alphaFreqEditText(self): + try: + alpha = self.gui.alphaFreqEdit.text().toDouble()[0] + self.fg.set_rx_freq_gain_alpha(alpha) + except RuntimeError: + pass + + def alphaTimeEditText(self): + try: + alpha = self.gui.alphaTimeEdit.text().toDouble()[0] + self.fg.set_rx_timing_gain_alpha(alpha) + except RuntimeError: + pass + + def betaTimeEditText(self): + try: + beta = self.gui.betaTimeEdit.text().toDouble()[0] + self.fg.set_rx_timing_gain_beta(beta) + except RuntimeError: + pass + + # Accessor functions for packet error reporting + def updatePacketInfo(self): + # Pull these globals in from the main thread + global n_rcvd, n_right, pktno + + if(pktno > 0): + per = float(n_rcvd - n_right)/float(pktno) + else: + per = 0 + self.gui.pktsRcvdEdit.setText(QtCore.QString("%1").arg(n_rcvd)) + self.gui.pktsCorrectEdit.setText(QtCore.QString("%1").arg(n_right)) + self.gui.perEdit.setText(QtCore.QString("%1").arg(per)) + + + +# //////////////////////////////////////////////////////////////////// +# Define the GNU Radio Top Block +# //////////////////////////////////////////////////////////////////// + + + +class my_top_block(gr.top_block): + def __init__(self, mod_class, demod_class, rx_callback, options): + gr.top_block.__init__(self) + + self._sample_rate = options.sample_rate + + channelon = True; + + self.gui_on = options.gui + + self._frequency_offset = options.frequency_offset + self._timing_offset = options.timing_offset + self._tx_amplitude = options.tx_amplitude + self._snr_dB = options.snr + + self._noise_voltage = self.get_noise_voltage(self._snr_dB) + + self.txpath = transmit_path(mod_class, options) + self.throttle = gr.throttle(gr.sizeof_gr_complex, self.sample_rate()) + self.rxpath = receive_path(demod_class, rx_callback, options) + + # FIXME: do better exposure to lower issues for control + self._timing_gain_alpha = self.rxpath.packet_receiver._demodulator._timing_alpha + self._timing_gain_beta = self.rxpath.packet_receiver._demodulator._timing_beta + self._freq_gain_alpha = self.rxpath.packet_receiver._demodulator._costas_alpha + + if channelon: + self.channel = gr.channel_model(self._noise_voltage, + self.frequency_offset(), + self.timing_offset()) + + if options.discontinuous: + z = 20000*[0,] + self.zeros = gr.vector_source_c(z, True) + packet_size = 5*((4+8+4+1500+4) * 8) + self.mux = gr.stream_mux(gr.sizeof_gr_complex, [packet_size-0, int(9e5)]) + + # Connect components + self.connect(self.txpath, self.throttle, (self.mux,0)) + self.connect(self.zeros, (self.mux,1)) + self.connect(self.mux, self.channel, self.rxpath) + + else: + self.connect(self.txpath, self.throttle, self.channel, self.rxpath) + + if self.gui_on: + self.qapp = QtGui.QApplication(sys.argv) + fftsize = 2048 + + self.snk_tx = qtgui.sink_c(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS, + 0, 1, + "Tx", True, True, False, True, True) + self.snk_rx = qtgui.sink_c(fftsize, gr.firdes.WIN_BLACKMAN_hARRIS, + 0, 1, + "Rx", True, True, False, True, True) + + self.snk_tx.set_frequency_axis(-80, 0) + self.snk_rx.set_frequency_axis(-60, 20) + + # Connect to the QT sinks + # FIXME: make better exposure to receiver from rxpath + self.freq_recov = self.rxpath.packet_receiver._demodulator.clock_recov + self.time_recov = self.rxpath.packet_receiver._demodulator.time_recov + self.freq_recov.set_alpha(self._freq_gain_alpha) + self.freq_recov.set_beta(0.25*self._freq_gain_alpha*self._freq_gain_alpha) + self.time_recov.set_alpha(self._timing_gain_alpha) + self.time_recov.set_beta(self._timing_gain_beta) + self.connect(self.channel, self.snk_tx) + self.connect(self.time_recov, self.snk_rx) + + pyTxQt = self.snk_tx.pyqwidget() + pyTx = sip.wrapinstance(pyTxQt, QtGui.QWidget) + + pyRxQt = self.snk_rx.pyqwidget() + pyRx = sip.wrapinstance(pyRxQt, QtGui.QWidget) + + self.main_box = dialog_box(pyTx, pyRx, self) + self.main_box.show() + + else: + # Connect components + self.connect(self.txpath, self.throttle, self.rxpath) + + + + # System Parameters + def sample_rate(self): + return self._sample_rate + + def set_sample_rate(self, sr): + self._sample_rate = sr + #self.throttle.set_samples_per_second(self._sample_rate) + + # Channel Model Parameters + def snr(self): + return self._snr_dB + + def set_snr(self, snr): + self._snr_dB = snr + self._noise_voltage = self.get_noise_voltage(self._snr_dB) + self.channel.set_noise_voltage(self._noise_voltage) + + def get_noise_voltage(self, SNR): + snr = 10.0**(SNR/10.0) + power_in_signal = abs(self._tx_amplitude)**2 + noise_power = power_in_signal/snr + noise_voltage = math.sqrt(noise_power) + return noise_voltage + + def frequency_offset(self): + return self._frequency_offset * self.sample_rate() + + def set_frequency_offset(self, fo): + self._frequency_offset = fo / self.sample_rate() + self.channel.set_frequency_offset(self._frequency_offset) + + def timing_offset(self): + return self._timing_offset + + def set_timing_offset(self, to): + self._timing_offset = to + self.channel.set_timing_offset(self._timing_offset) + + + # Receiver Parameters + def rx_timing_gain_alpha(self): + return self._timing_gain_alpha + + def rx_timing_gain_beta(self): + return self._timing_gain_beta + + def set_rx_timing_gain_alpha(self, gain): + self._timing_gain_alpha = gain + self.time_recov.set_alpha(self._timing_gain_alpha) + + def set_rx_timing_gain_beta(self, gain): + self._timing_gain_beta = gain + self.time_recov.set_beta(self._timing_gain_beta) + + def rx_freq_gain_alpha(self): + return self._freq_gain_alpha + + def rx_freq_gain_beta(self): + return self._freq_gain_beta + + def set_rx_freq_gain_alpha(self, alpha): + self._freq_gain_alpha = alpha + self._freq_gain_beta = .25 * self._freq_gain_alpha * self._freq_gain_alpha + self.freq_recov.set_alpha(self._freq_gain_alpha) + self.freq_recov.set_beta(self._freq_gain_beta) + + + +# ///////////////////////////////////////////////////////////////////////////// +# Thread to handle the packet sending procedure +# Operates in parallel with qApp.exec_() +# ///////////////////////////////////////////////////////////////////////////// + + + +class th_send(Thread): + def __init__(self, send_fnc, megs, sz): + Thread.__init__(self) + self.send = send_fnc + self.nbytes = int(1e6 * megs) + self.pkt_size = int(sz) + + def run(self): + # generate and send packets + n = 0 + pktno = 0 + + while n < self.nbytes: + self.send(struct.pack('!H', pktno & 0xffff) + + (self.pkt_size - 2) * chr(pktno & 0xff)) + n += self.pkt_size + pktno += 1 + + self.send(eof=True) + + def stop(self): + self.nbytes = 0 + + + +# ///////////////////////////////////////////////////////////////////////////// +# main +# ///////////////////////////////////////////////////////////////////////////// + + + +def main(): + + global n_rcvd, n_right, pktno + + n_rcvd = 0 + n_right = 0 + pktno = 0 + + def rx_callback(ok, payload): + global n_rcvd, n_right, pktno + (pktno,) = struct.unpack('!H', payload[0:2]) + n_rcvd += 1 + if ok: + n_right += 1 + + if not options.gui: + print "ok = %5s pktno = %4d n_rcvd = %4d n_right = %4d" % ( + ok, pktno, n_rcvd, n_right) + + + def send_pkt(payload='', eof=False): + return tb.txpath.send_pkt(payload, eof) + + mods = modulation_utils.type_1_mods() + demods = modulation_utils.type_1_demods() + + parser = OptionParser(option_class=eng_option, conflict_handler="resolve") + expert_grp = parser.add_option_group("Expert") + channel_grp = parser.add_option_group("Channel") + + parser.add_option("-m", "--modulation", type="choice", choices=mods.keys(), + default='dbpsk', + help="Select modulation from: %s [default=%%default]" + % (', '.join(mods.keys()),)) + + parser.add_option("-s", "--size", type="eng_float", default=1500, + help="set packet size [default=%default]") + parser.add_option("-M", "--megabytes", type="eng_float", default=1.0, + help="set megabytes to transmit [default=%default]") + parser.add_option("","--discontinuous", action="store_true", default=False, + help="enable discontinous transmission (bursts of 5 packets)") + parser.add_option("-G", "--gui", action="store_true", default=False, + help="Turn on the GUI [default=%default]") + + channel_grp.add_option("", "--sample-rate", type="eng_float", default=1e5, + help="set speed of channel/simulation rate to RATE [default=%default]") + channel_grp.add_option("", "--snr", type="eng_float", default=30, + help="set the SNR of the channel in dB [default=%default]") + channel_grp.add_option("", "--frequency-offset", type="eng_float", default=0, + help="set frequency offset introduced by channel [default=%default]") + channel_grp.add_option("", "--timing-offset", type="eng_float", default=1.0, + help="set timing offset introduced by channel [default=%default]") + channel_grp.add_option("", "--seed", action="store_true", default=False, + help="use a random seed for AWGN noise [default=%default]") + + transmit_path.add_options(parser, expert_grp) + receive_path.add_options(parser, expert_grp) + + for mod in mods.values(): + mod.add_options(expert_grp) + for demod in demods.values(): + demod.add_options(expert_grp) + + (options, args) = parser.parse_args () + + if len(args) != 0: + parser.print_help() + sys.exit(1) + + r = gr.enable_realtime_scheduling() + if r != gr.RT_OK: + print "Warning: failed to enable realtime scheduling" + + # Create an instance of a hierarchical block + tb = my_top_block(mods[options.modulation], + demods[options.modulation], + rx_callback, options) + tb.start() + + packet_sender = th_send(send_pkt, options.megabytes, options.size) + packet_sender.start() + + if(options.gui): + tb.qapp.exec_() + packet_sender.stop() + else: + # Process until done; hack in to the join to stop on an interrupt + while(packet_sender.isAlive()): + try: + packet_sender.join(1) + except KeyboardInterrupt: + packet_sender.stop() + + +if __name__ == '__main__': + try: + main() + except KeyboardInterrupt: + pass diff --git a/gnuradio-examples/python/digital/qt_digital_window.py b/gnuradio-examples/python/digital/qt_digital_window.py index e3feb57c9..6e0f25212 100644 --- a/gnuradio-examples/python/digital/qt_digital_window.py +++ b/gnuradio-examples/python/digital/qt_digital_window.py @@ -2,8 +2,8 @@ # Form implementation generated from reading ui file 'qt_digital_window.ui' # -# Created: Fri Jul 3 10:03:54 2009 -# by: PyQt4 UI code generator 4.4.3 +# Created: Tue Oct 6 11:27:37 2009 +# by: PyQt4 UI code generator 4.4.4 # # WARNING! All changes made in this file will be lost! @@ -12,53 +12,63 @@ from PyQt4 import QtCore, QtGui class Ui_DigitalWindow(object): def setupUi(self, DigitalWindow): DigitalWindow.setObjectName("DigitalWindow") - DigitalWindow.resize(1050, 752) + DigitalWindow.resize(1019, 754) self.centralwidget = QtGui.QWidget(DigitalWindow) self.centralwidget.setObjectName("centralwidget") self.gridLayout = QtGui.QGridLayout(self.centralwidget) self.gridLayout.setObjectName("gridLayout") - self.verticalLayout_2 = QtGui.QVBoxLayout() - self.verticalLayout_2.setObjectName("verticalLayout_2") - self.sysBox = QtGui.QGroupBox(self.centralwidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.sysBox.sizePolicy().hasHeightForWidth()) - self.sysBox.setSizePolicy(sizePolicy) - self.sysBox.setMinimumSize(QtCore.QSize(240, 60)) - self.sysBox.setMaximumSize(QtCore.QSize(240, 16777215)) - self.sysBox.setObjectName("sysBox") - self.formLayoutWidget = QtGui.QWidget(self.sysBox) - self.formLayoutWidget.setGeometry(QtCore.QRect(10, 20, 221, 31)) - self.formLayoutWidget.setObjectName("formLayoutWidget") - self.formLayout = QtGui.QFormLayout(self.formLayoutWidget) - self.formLayout.setSizeConstraint(QtGui.QLayout.SetFixedSize) - self.formLayout.setVerticalSpacing(20) - self.formLayout.setObjectName("formLayout") - self.sampleRateEdit = QtGui.QLineEdit(self.formLayoutWidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.sampleRateEdit.sizePolicy().hasHeightForWidth()) - self.sampleRateEdit.setSizePolicy(sizePolicy) - self.sampleRateEdit.setMinimumSize(QtCore.QSize(100, 26)) - self.sampleRateEdit.setMaximumSize(QtCore.QSize(100, 26)) - self.sampleRateEdit.setObjectName("sampleRateEdit") - self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.sampleRateEdit) - self.sampleRateLabel = QtGui.QLabel(self.formLayoutWidget) + self.verticalLayout_3 = QtGui.QVBoxLayout() + self.verticalLayout_3.setObjectName("verticalLayout_3") + self.rxBox = QtGui.QGroupBox(self.centralwidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.sampleRateLabel.sizePolicy().hasHeightForWidth()) - self.sampleRateLabel.setSizePolicy(sizePolicy) - self.sampleRateLabel.setMinimumSize(QtCore.QSize(0, 20)) - self.sampleRateLabel.setMaximumSize(QtCore.QSize(16777215, 20)) - self.sampleRateLabel.setObjectName("sampleRateLabel") - self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.sampleRateLabel) - self.verticalLayout_2.addWidget(self.sysBox) - spacerItem = QtGui.QSpacerItem(20, 60, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) - self.verticalLayout_2.addItem(spacerItem) - self.gridLayout.addLayout(self.verticalLayout_2, 2, 0, 1, 1) + sizePolicy.setHeightForWidth(self.rxBox.sizePolicy().hasHeightForWidth()) + self.rxBox.setSizePolicy(sizePolicy) + self.rxBox.setMinimumSize(QtCore.QSize(180, 90)) + self.rxBox.setMaximumSize(QtCore.QSize(180, 16777215)) + self.rxBox.setObjectName("rxBox") + self.formLayoutWidget_3 = QtGui.QWidget(self.rxBox) + self.formLayoutWidget_3.setGeometry(QtCore.QRect(10, 20, 141, 61)) + self.formLayoutWidget_3.setObjectName("formLayoutWidget_3") + self.formLayout_3 = QtGui.QFormLayout(self.formLayoutWidget_3) + self.formLayout_3.setSizeConstraint(QtGui.QLayout.SetFixedSize) + self.formLayout_3.setObjectName("formLayout_3") + self.gainMuLabel = QtGui.QLabel(self.formLayoutWidget_3) + self.gainMuLabel.setObjectName("gainMuLabel") + self.formLayout_3.setWidget(0, QtGui.QFormLayout.LabelRole, self.gainMuLabel) + self.alphaLabel = QtGui.QLabel(self.formLayoutWidget_3) + self.alphaLabel.setObjectName("alphaLabel") + self.formLayout_3.setWidget(1, QtGui.QFormLayout.LabelRole, self.alphaLabel) + self.gainMuEdit = QtGui.QLineEdit(self.formLayoutWidget_3) + self.gainMuEdit.setMinimumSize(QtCore.QSize(60, 0)) + self.gainMuEdit.setMaximumSize(QtCore.QSize(80, 16777215)) + self.gainMuEdit.setObjectName("gainMuEdit") + self.formLayout_3.setWidget(0, QtGui.QFormLayout.FieldRole, self.gainMuEdit) + self.alphaEdit = QtGui.QLineEdit(self.formLayoutWidget_3) + self.alphaEdit.setMinimumSize(QtCore.QSize(60, 0)) + self.alphaEdit.setMaximumSize(QtCore.QSize(80, 16777215)) + self.alphaEdit.setObjectName("alphaEdit") + self.formLayout_3.setWidget(1, QtGui.QFormLayout.FieldRole, self.alphaEdit) + self.verticalLayout_3.addWidget(self.rxBox) + spacerItem = QtGui.QSpacerItem(20, 30, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) + self.verticalLayout_3.addItem(spacerItem) + self.gridLayout.addLayout(self.verticalLayout_3, 2, 2, 1, 1) + self.verticalLayout = QtGui.QVBoxLayout() + self.verticalLayout.setObjectName("verticalLayout") + self.pauseButton = QtGui.QPushButton(self.centralwidget) + self.pauseButton.setMinimumSize(QtCore.QSize(80, 0)) + self.pauseButton.setMaximumSize(QtCore.QSize(80, 16777215)) + self.pauseButton.setObjectName("pauseButton") + self.verticalLayout.addWidget(self.pauseButton) + spacerItem1 = QtGui.QSpacerItem(20, 60, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) + self.verticalLayout.addItem(spacerItem1) + self.closeButton = QtGui.QPushButton(self.centralwidget) + self.closeButton.setMinimumSize(QtCore.QSize(80, 0)) + self.closeButton.setMaximumSize(QtCore.QSize(80, 16777215)) + self.closeButton.setObjectName("closeButton") + self.verticalLayout.addWidget(self.closeButton) + self.gridLayout.addLayout(self.verticalLayout, 2, 5, 1, 1) self.channelModeBox = QtGui.QGroupBox(self.centralwidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) @@ -69,7 +79,7 @@ class Ui_DigitalWindow(object): self.channelModeBox.setMaximumSize(QtCore.QSize(245, 16777215)) self.channelModeBox.setObjectName("channelModeBox") self.formLayoutWidget_2 = QtGui.QWidget(self.channelModeBox) - self.formLayoutWidget_2.setGeometry(QtCore.QRect(10, 20, 231, 98)) + self.formLayoutWidget_2.setGeometry(QtCore.QRect(10, 20, 221, 98)) self.formLayoutWidget_2.setObjectName("formLayoutWidget_2") self.formLayout_2 = QtGui.QFormLayout(self.formLayoutWidget_2) self.formLayout_2.setSizeConstraint(QtGui.QLayout.SetFixedSize) @@ -79,83 +89,69 @@ class Ui_DigitalWindow(object): self.snrLabel.setObjectName("snrLabel") self.formLayout_2.setWidget(0, QtGui.QFormLayout.LabelRole, self.snrLabel) self.snrEdit = QtGui.QLineEdit(self.formLayoutWidget_2) - self.snrEdit.setMinimumSize(QtCore.QSize(100, 0)) - self.snrEdit.setMaximumSize(QtCore.QSize(100, 16777215)) + self.snrEdit.setMinimumSize(QtCore.QSize(60, 0)) + self.snrEdit.setMaximumSize(QtCore.QSize(80, 16777215)) self.snrEdit.setObjectName("snrEdit") self.formLayout_2.setWidget(0, QtGui.QFormLayout.FieldRole, self.snrEdit) self.freqLabel = QtGui.QLabel(self.formLayoutWidget_2) self.freqLabel.setObjectName("freqLabel") self.formLayout_2.setWidget(1, QtGui.QFormLayout.LabelRole, self.freqLabel) self.freqEdit = QtGui.QLineEdit(self.formLayoutWidget_2) - self.freqEdit.setMinimumSize(QtCore.QSize(100, 0)) - self.freqEdit.setMaximumSize(QtCore.QSize(100, 16777215)) + self.freqEdit.setMinimumSize(QtCore.QSize(60, 0)) + self.freqEdit.setMaximumSize(QtCore.QSize(80, 16777215)) self.freqEdit.setObjectName("freqEdit") self.formLayout_2.setWidget(1, QtGui.QFormLayout.FieldRole, self.freqEdit) self.timeLabel = QtGui.QLabel(self.formLayoutWidget_2) self.timeLabel.setObjectName("timeLabel") self.formLayout_2.setWidget(2, QtGui.QFormLayout.LabelRole, self.timeLabel) self.timeEdit = QtGui.QLineEdit(self.formLayoutWidget_2) - self.timeEdit.setMinimumSize(QtCore.QSize(100, 0)) - self.timeEdit.setMaximumSize(QtCore.QSize(100, 16777215)) + self.timeEdit.setMinimumSize(QtCore.QSize(60, 0)) + self.timeEdit.setMaximumSize(QtCore.QSize(80, 16777215)) self.timeEdit.setObjectName("timeEdit") self.formLayout_2.setWidget(2, QtGui.QFormLayout.FieldRole, self.timeEdit) self.gridLayout.addWidget(self.channelModeBox, 2, 1, 1, 1) - self.verticalLayout_5 = QtGui.QVBoxLayout() - self.verticalLayout_5.setObjectName("verticalLayout_5") - self.sinkFrame = QtGui.QFrame(self.centralwidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) + self.verticalLayout_2 = QtGui.QVBoxLayout() + self.verticalLayout_2.setObjectName("verticalLayout_2") + self.sysBox = QtGui.QGroupBox(self.centralwidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.sinkFrame.sizePolicy().hasHeightForWidth()) - self.sinkFrame.setSizePolicy(sizePolicy) - self.sinkFrame.setMinimumSize(QtCore.QSize(1000, 550)) - self.sinkFrame.setFrameShape(QtGui.QFrame.StyledPanel) - self.sinkFrame.setFrameShadow(QtGui.QFrame.Raised) - self.sinkFrame.setObjectName("sinkFrame") - self.gridLayout_2 = QtGui.QGridLayout(self.sinkFrame) - self.gridLayout_2.setObjectName("gridLayout_2") - self.sinkLayout = QtGui.QHBoxLayout() - self.sinkLayout.setObjectName("sinkLayout") - self.gridLayout_2.addLayout(self.sinkLayout, 1, 0, 1, 1) - self.verticalLayout_5.addWidget(self.sinkFrame) - self.gridLayout.addLayout(self.verticalLayout_5, 0, 0, 1, 6) - self.verticalLayout_3 = QtGui.QVBoxLayout() - self.verticalLayout_3.setObjectName("verticalLayout_3") - self.rxBox = QtGui.QGroupBox(self.centralwidget) + sizePolicy.setHeightForWidth(self.sysBox.sizePolicy().hasHeightForWidth()) + self.sysBox.setSizePolicy(sizePolicy) + self.sysBox.setMinimumSize(QtCore.QSize(240, 60)) + self.sysBox.setMaximumSize(QtCore.QSize(240, 16777215)) + self.sysBox.setObjectName("sysBox") + self.formLayoutWidget = QtGui.QWidget(self.sysBox) + self.formLayoutWidget.setGeometry(QtCore.QRect(10, 20, 211, 31)) + self.formLayoutWidget.setObjectName("formLayoutWidget") + self.formLayout = QtGui.QFormLayout(self.formLayoutWidget) + self.formLayout.setSizeConstraint(QtGui.QLayout.SetFixedSize) + self.formLayout.setVerticalSpacing(20) + self.formLayout.setObjectName("formLayout") + self.sampleRateEdit = QtGui.QLineEdit(self.formLayoutWidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.rxBox.sizePolicy().hasHeightForWidth()) - self.rxBox.setSizePolicy(sizePolicy) - self.rxBox.setMinimumSize(QtCore.QSize(180, 90)) - self.rxBox.setMaximumSize(QtCore.QSize(180, 16777215)) - self.rxBox.setObjectName("rxBox") - self.formLayoutWidget_3 = QtGui.QWidget(self.rxBox) - self.formLayoutWidget_3.setGeometry(QtCore.QRect(10, 20, 161, 61)) - self.formLayoutWidget_3.setObjectName("formLayoutWidget_3") - self.formLayout_3 = QtGui.QFormLayout(self.formLayoutWidget_3) - self.formLayout_3.setSizeConstraint(QtGui.QLayout.SetFixedSize) - self.formLayout_3.setObjectName("formLayout_3") - self.gainMuLabel = QtGui.QLabel(self.formLayoutWidget_3) - self.gainMuLabel.setObjectName("gainMuLabel") - self.formLayout_3.setWidget(0, QtGui.QFormLayout.LabelRole, self.gainMuLabel) - self.alphaLabel = QtGui.QLabel(self.formLayoutWidget_3) - self.alphaLabel.setObjectName("alphaLabel") - self.formLayout_3.setWidget(1, QtGui.QFormLayout.LabelRole, self.alphaLabel) - self.gainMuEdit = QtGui.QLineEdit(self.formLayoutWidget_3) - self.gainMuEdit.setMinimumSize(QtCore.QSize(100, 0)) - self.gainMuEdit.setMaximumSize(QtCore.QSize(100, 16777215)) - self.gainMuEdit.setObjectName("gainMuEdit") - self.formLayout_3.setWidget(0, QtGui.QFormLayout.FieldRole, self.gainMuEdit) - self.alphaEdit = QtGui.QLineEdit(self.formLayoutWidget_3) - self.alphaEdit.setMinimumSize(QtCore.QSize(100, 0)) - self.alphaEdit.setMaximumSize(QtCore.QSize(100, 16777215)) - self.alphaEdit.setObjectName("alphaEdit") - self.formLayout_3.setWidget(1, QtGui.QFormLayout.FieldRole, self.alphaEdit) - self.verticalLayout_3.addWidget(self.rxBox) - spacerItem1 = QtGui.QSpacerItem(20, 30, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) - self.verticalLayout_3.addItem(spacerItem1) - self.gridLayout.addLayout(self.verticalLayout_3, 2, 2, 1, 1) + sizePolicy.setHeightForWidth(self.sampleRateEdit.sizePolicy().hasHeightForWidth()) + self.sampleRateEdit.setSizePolicy(sizePolicy) + self.sampleRateEdit.setMinimumSize(QtCore.QSize(60, 26)) + self.sampleRateEdit.setMaximumSize(QtCore.QSize(80, 26)) + self.sampleRateEdit.setObjectName("sampleRateEdit") + self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.sampleRateEdit) + self.sampleRateLabel = QtGui.QLabel(self.formLayoutWidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.sampleRateLabel.sizePolicy().hasHeightForWidth()) + self.sampleRateLabel.setSizePolicy(sizePolicy) + self.sampleRateLabel.setMinimumSize(QtCore.QSize(0, 20)) + self.sampleRateLabel.setMaximumSize(QtCore.QSize(16777215, 20)) + self.sampleRateLabel.setObjectName("sampleRateLabel") + self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.sampleRateLabel) + self.verticalLayout_2.addWidget(self.sysBox) + spacerItem2 = QtGui.QSpacerItem(20, 60, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) + self.verticalLayout_2.addItem(spacerItem2) + self.gridLayout.addLayout(self.verticalLayout_2, 2, 0, 1, 1) self.rxBox_2 = QtGui.QGroupBox(self.centralwidget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) @@ -166,7 +162,7 @@ class Ui_DigitalWindow(object): self.rxBox_2.setMaximumSize(QtCore.QSize(265, 125)) self.rxBox_2.setObjectName("rxBox_2") self.formLayoutWidget_4 = QtGui.QWidget(self.rxBox_2) - self.formLayoutWidget_4.setGeometry(QtCore.QRect(10, 20, 201, 92)) + self.formLayoutWidget_4.setGeometry(QtCore.QRect(10, 20, 181, 92)) self.formLayoutWidget_4.setObjectName("formLayoutWidget_4") self.formLayout_4 = QtGui.QFormLayout(self.formLayoutWidget_4) self.formLayout_4.setSizeConstraint(QtGui.QLayout.SetFixedSize) @@ -181,41 +177,45 @@ class Ui_DigitalWindow(object): self.perLabel.setObjectName("perLabel") self.formLayout_4.setWidget(2, QtGui.QFormLayout.LabelRole, self.perLabel) self.pktsRcvdEdit = QtGui.QLineEdit(self.formLayoutWidget_4) - self.pktsRcvdEdit.setMinimumSize(QtCore.QSize(100, 0)) - self.pktsRcvdEdit.setMaximumSize(QtCore.QSize(100, 16777215)) + self.pktsRcvdEdit.setMinimumSize(QtCore.QSize(60, 0)) + self.pktsRcvdEdit.setMaximumSize(QtCore.QSize(80, 16777215)) self.pktsRcvdEdit.setObjectName("pktsRcvdEdit") self.formLayout_4.setWidget(0, QtGui.QFormLayout.FieldRole, self.pktsRcvdEdit) self.pktsCorrectEdit = QtGui.QLineEdit(self.formLayoutWidget_4) - self.pktsCorrectEdit.setMinimumSize(QtCore.QSize(100, 0)) - self.pktsCorrectEdit.setMaximumSize(QtCore.QSize(100, 16777215)) + self.pktsCorrectEdit.setMinimumSize(QtCore.QSize(60, 0)) + self.pktsCorrectEdit.setMaximumSize(QtCore.QSize(80, 16777215)) self.pktsCorrectEdit.setObjectName("pktsCorrectEdit") self.formLayout_4.setWidget(1, QtGui.QFormLayout.FieldRole, self.pktsCorrectEdit) self.perEdit = QtGui.QLineEdit(self.formLayoutWidget_4) - self.perEdit.setMinimumSize(QtCore.QSize(100, 0)) - self.perEdit.setMaximumSize(QtCore.QSize(100, 16777215)) + self.perEdit.setMinimumSize(QtCore.QSize(60, 0)) + self.perEdit.setMaximumSize(QtCore.QSize(80, 16777215)) self.perEdit.setObjectName("perEdit") self.formLayout_4.setWidget(2, QtGui.QFormLayout.FieldRole, self.perEdit) self.gridLayout.addWidget(self.rxBox_2, 2, 3, 1, 1) - spacerItem2 = QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.gridLayout.addItem(spacerItem2, 2, 4, 1, 1) - self.verticalLayout = QtGui.QVBoxLayout() - self.verticalLayout.setObjectName("verticalLayout") - self.pauseButton = QtGui.QPushButton(self.centralwidget) - self.pauseButton.setMinimumSize(QtCore.QSize(80, 0)) - self.pauseButton.setMaximumSize(QtCore.QSize(80, 16777215)) - self.pauseButton.setObjectName("pauseButton") - self.verticalLayout.addWidget(self.pauseButton) - spacerItem3 = QtGui.QSpacerItem(20, 60, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) - self.verticalLayout.addItem(spacerItem3) - self.closeButton = QtGui.QPushButton(self.centralwidget) - self.closeButton.setMinimumSize(QtCore.QSize(80, 0)) - self.closeButton.setMaximumSize(QtCore.QSize(80, 16777215)) - self.closeButton.setObjectName("closeButton") - self.verticalLayout.addWidget(self.closeButton) - self.gridLayout.addLayout(self.verticalLayout, 2, 5, 1, 1) + spacerItem3 = QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + self.gridLayout.addItem(spacerItem3, 2, 4, 1, 1) + self.verticalLayout_5 = QtGui.QVBoxLayout() + self.verticalLayout_5.setObjectName("verticalLayout_5") + self.sinkFrame = QtGui.QFrame(self.centralwidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.sinkFrame.sizePolicy().hasHeightForWidth()) + self.sinkFrame.setSizePolicy(sizePolicy) + self.sinkFrame.setMinimumSize(QtCore.QSize(500, 550)) + self.sinkFrame.setFrameShape(QtGui.QFrame.StyledPanel) + self.sinkFrame.setFrameShadow(QtGui.QFrame.Raised) + self.sinkFrame.setObjectName("sinkFrame") + self.gridLayout_2 = QtGui.QGridLayout(self.sinkFrame) + self.gridLayout_2.setObjectName("gridLayout_2") + self.sinkLayout = QtGui.QHBoxLayout() + self.sinkLayout.setObjectName("sinkLayout") + self.gridLayout_2.addLayout(self.sinkLayout, 1, 0, 1, 1) + self.verticalLayout_5.addWidget(self.sinkFrame) + self.gridLayout.addLayout(self.verticalLayout_5, 0, 0, 1, 6) DigitalWindow.setCentralWidget(self.centralwidget) self.menubar = QtGui.QMenuBar(DigitalWindow) - self.menubar.setGeometry(QtCore.QRect(0, 0, 1050, 24)) + self.menubar.setGeometry(QtCore.QRect(0, 0, 1019, 25)) self.menubar.setObjectName("menubar") self.menuFile = QtGui.QMenu(self.menubar) self.menuFile.setObjectName("menuFile") @@ -237,21 +237,21 @@ class Ui_DigitalWindow(object): def retranslateUi(self, DigitalWindow): DigitalWindow.setWindowTitle(QtGui.QApplication.translate("DigitalWindow", "MainWindow", None, QtGui.QApplication.UnicodeUTF8)) - self.sysBox.setTitle(QtGui.QApplication.translate("DigitalWindow", "System Parameters", None, QtGui.QApplication.UnicodeUTF8)) - self.sampleRateLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Sample Rate (sps)", None, QtGui.QApplication.UnicodeUTF8)) + self.rxBox.setTitle(QtGui.QApplication.translate("DigitalWindow", "Receiver Parameters", None, QtGui.QApplication.UnicodeUTF8)) + self.gainMuLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Gain mu", None, QtGui.QApplication.UnicodeUTF8)) + self.alphaLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Alpha", None, QtGui.QApplication.UnicodeUTF8)) + self.pauseButton.setText(QtGui.QApplication.translate("DigitalWindow", "Pause", None, QtGui.QApplication.UnicodeUTF8)) + self.closeButton.setText(QtGui.QApplication.translate("DigitalWindow", "Close", None, QtGui.QApplication.UnicodeUTF8)) self.channelModeBox.setTitle(QtGui.QApplication.translate("DigitalWindow", "Channel Model Parameters", None, QtGui.QApplication.UnicodeUTF8)) self.snrLabel.setText(QtGui.QApplication.translate("DigitalWindow", "SNR (dB)", None, QtGui.QApplication.UnicodeUTF8)) self.freqLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Frequency Offset (Hz)", None, QtGui.QApplication.UnicodeUTF8)) self.timeLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Timing Offset", None, QtGui.QApplication.UnicodeUTF8)) - self.rxBox.setTitle(QtGui.QApplication.translate("DigitalWindow", "Receiver Parameters", None, QtGui.QApplication.UnicodeUTF8)) - self.gainMuLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Gain mu", None, QtGui.QApplication.UnicodeUTF8)) - self.alphaLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Alpha", None, QtGui.QApplication.UnicodeUTF8)) + self.sysBox.setTitle(QtGui.QApplication.translate("DigitalWindow", "System Parameters", None, QtGui.QApplication.UnicodeUTF8)) + self.sampleRateLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Sample Rate (sps)", None, QtGui.QApplication.UnicodeUTF8)) self.rxBox_2.setTitle(QtGui.QApplication.translate("DigitalWindow", "Received Packet Info", None, QtGui.QApplication.UnicodeUTF8)) self.pktsRcvdLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Packets Rcvd.", None, QtGui.QApplication.UnicodeUTF8)) self.pktsCorrectLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Packets Correct", None, QtGui.QApplication.UnicodeUTF8)) self.perLabel.setText(QtGui.QApplication.translate("DigitalWindow", "PER", None, QtGui.QApplication.UnicodeUTF8)) - self.pauseButton.setText(QtGui.QApplication.translate("DigitalWindow", "Pause", None, QtGui.QApplication.UnicodeUTF8)) - self.closeButton.setText(QtGui.QApplication.translate("DigitalWindow", "Close", None, QtGui.QApplication.UnicodeUTF8)) self.menuFile.setTitle(QtGui.QApplication.translate("DigitalWindow", "&File", None, QtGui.QApplication.UnicodeUTF8)) self.actionExit.setText(QtGui.QApplication.translate("DigitalWindow", "E&xit", None, QtGui.QApplication.UnicodeUTF8)) diff --git a/gnuradio-examples/python/digital/qt_digital_window.ui b/gnuradio-examples/python/digital/qt_digital_window.ui index 413801ec7..a0af196ed 100644 --- a/gnuradio-examples/python/digital/qt_digital_window.ui +++ b/gnuradio-examples/python/digital/qt_digital_window.ui @@ -1,105 +1,102 @@ -<ui version="4.0" > +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> <class>DigitalWindow</class> - <widget class="QMainWindow" name="DigitalWindow" > - <property name="geometry" > + <widget class="QMainWindow" name="DigitalWindow"> + <property name="geometry"> <rect> <x>0</x> <y>0</y> - <width>1050</width> - <height>752</height> + <width>1019</width> + <height>754</height> </rect> </property> - <property name="windowTitle" > + <property name="windowTitle"> <string>MainWindow</string> </property> - <widget class="QWidget" name="centralwidget" > - <layout class="QGridLayout" name="gridLayout" > - <item row="2" column="0" > - <layout class="QVBoxLayout" name="verticalLayout_2" > + <widget class="QWidget" name="centralwidget"> + <layout class="QGridLayout" name="gridLayout"> + <item row="2" column="2"> + <layout class="QVBoxLayout" name="verticalLayout_3"> <item> - <widget class="QGroupBox" name="sysBox" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Fixed" hsizetype="Fixed" > + <widget class="QGroupBox" name="rxBox"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="minimumSize" > + <property name="minimumSize"> <size> - <width>240</width> - <height>60</height> + <width>180</width> + <height>90</height> </size> </property> - <property name="maximumSize" > + <property name="maximumSize"> <size> - <width>240</width> + <width>180</width> <height>16777215</height> </size> </property> - <property name="title" > - <string>System Parameters</string> + <property name="title"> + <string>Receiver Parameters</string> </property> - <widget class="QWidget" name="formLayoutWidget" > - <property name="geometry" > + <widget class="QWidget" name="formLayoutWidget_3"> + <property name="geometry"> <rect> <x>10</x> <y>20</y> - <width>221</width> - <height>31</height> + <width>141</width> + <height>61</height> </rect> </property> - <layout class="QFormLayout" name="formLayout" > - <property name="sizeConstraint" > + <layout class="QFormLayout" name="formLayout_3"> + <property name="sizeConstraint"> <enum>QLayout::SetFixedSize</enum> </property> - <property name="verticalSpacing" > - <number>20</number> - </property> - <item row="0" column="1" > - <widget class="QLineEdit" name="sampleRateEdit" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Fixed" hsizetype="Fixed" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <item row="0" column="0"> + <widget class="QLabel" name="gainMuLabel"> + <property name="text"> + <string>Gain mu</string> </property> - <property name="minimumSize" > + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="alphaLabel"> + <property name="text"> + <string>Alpha</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLineEdit" name="gainMuEdit"> + <property name="minimumSize"> <size> - <width>100</width> - <height>26</height> + <width>60</width> + <height>0</height> </size> </property> - <property name="maximumSize" > + <property name="maximumSize"> <size> - <width>100</width> - <height>26</height> + <width>80</width> + <height>16777215</height> </size> </property> </widget> </item> - <item row="0" column="0" > - <widget class="QLabel" name="sampleRateLabel" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Fixed" hsizetype="Fixed" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize" > + <item row="1" column="1"> + <widget class="QLineEdit" name="alphaEdit"> + <property name="minimumSize"> <size> - <width>0</width> - <height>20</height> + <width>60</width> + <height>0</height> </size> </property> - <property name="maximumSize" > + <property name="maximumSize"> <size> - <width>16777215</width> - <height>20</height> + <width>80</width> + <height>16777215</height> </size> </property> - <property name="text" > - <string>Sample Rate (sps)</string> - </property> </widget> </item> </layout> @@ -107,14 +104,53 @@ </widget> </item> <item> - <spacer name="verticalSpacer_2" > - <property name="orientation" > + <spacer name="verticalSpacer_4"> + <property name="orientation"> <enum>Qt::Vertical</enum> </property> - <property name="sizeType" > + <property name="sizeType"> <enum>QSizePolicy::Fixed</enum> </property> - <property name="sizeHint" stdset="0" > + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>30</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item row="2" column="5"> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QPushButton" name="pauseButton"> + <property name="minimumSize"> + <size> + <width>80</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>80</width> + <height>16777215</height> + </size> + </property> + <property name="text"> + <string>Pause</string> + </property> + </widget> + </item> + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Fixed</enum> + </property> + <property name="sizeHint" stdset="0"> <size> <width>20</width> <height>60</height> @@ -122,111 +158,130 @@ </property> </spacer> </item> + <item> + <widget class="QPushButton" name="closeButton"> + <property name="minimumSize"> + <size> + <width>80</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>80</width> + <height>16777215</height> + </size> + </property> + <property name="text"> + <string>Close</string> + </property> + </widget> + </item> </layout> </item> - <item row="2" column="1" > - <widget class="QGroupBox" name="channelModeBox" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Fixed" hsizetype="Fixed" > + <item row="2" column="1"> + <widget class="QGroupBox" name="channelModeBox"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="minimumSize" > + <property name="minimumSize"> <size> <width>245</width> <height>130</height> </size> </property> - <property name="maximumSize" > + <property name="maximumSize"> <size> <width>245</width> <height>16777215</height> </size> </property> - <property name="title" > + <property name="title"> <string>Channel Model Parameters</string> </property> - <widget class="QWidget" name="formLayoutWidget_2" > - <property name="geometry" > + <widget class="QWidget" name="formLayoutWidget_2"> + <property name="geometry"> <rect> <x>10</x> <y>20</y> - <width>231</width> + <width>221</width> <height>98</height> </rect> </property> - <layout class="QFormLayout" name="formLayout_2" > - <property name="sizeConstraint" > + <layout class="QFormLayout" name="formLayout_2"> + <property name="sizeConstraint"> <enum>QLayout::SetFixedSize</enum> </property> - <property name="fieldGrowthPolicy" > + <property name="fieldGrowthPolicy"> <enum>QFormLayout::AllNonFixedFieldsGrow</enum> </property> - <item row="0" column="0" > - <widget class="QLabel" name="snrLabel" > - <property name="text" > + <item row="0" column="0"> + <widget class="QLabel" name="snrLabel"> + <property name="text"> <string>SNR (dB)</string> </property> </widget> </item> - <item row="0" column="1" > - <widget class="QLineEdit" name="snrEdit" > - <property name="minimumSize" > + <item row="0" column="1"> + <widget class="QLineEdit" name="snrEdit"> + <property name="minimumSize"> <size> - <width>100</width> + <width>60</width> <height>0</height> </size> </property> - <property name="maximumSize" > + <property name="maximumSize"> <size> - <width>100</width> + <width>80</width> <height>16777215</height> </size> </property> </widget> </item> - <item row="1" column="0" > - <widget class="QLabel" name="freqLabel" > - <property name="text" > + <item row="1" column="0"> + <widget class="QLabel" name="freqLabel"> + <property name="text"> <string>Frequency Offset (Hz)</string> </property> </widget> </item> - <item row="1" column="1" > - <widget class="QLineEdit" name="freqEdit" > - <property name="minimumSize" > + <item row="1" column="1"> + <widget class="QLineEdit" name="freqEdit"> + <property name="minimumSize"> <size> - <width>100</width> + <width>60</width> <height>0</height> </size> </property> - <property name="maximumSize" > + <property name="maximumSize"> <size> - <width>100</width> + <width>80</width> <height>16777215</height> </size> </property> </widget> </item> - <item row="2" column="0" > - <widget class="QLabel" name="timeLabel" > - <property name="text" > + <item row="2" column="0"> + <widget class="QLabel" name="timeLabel"> + <property name="text"> <string>Timing Offset</string> </property> </widget> </item> - <item row="2" column="1" > - <widget class="QLineEdit" name="timeEdit" > - <property name="minimumSize" > + <item row="2" column="1"> + <widget class="QLineEdit" name="timeEdit"> + <property name="minimumSize"> <size> - <width>100</width> + <width>60</width> <height>0</height> </size> </property> - <property name="maximumSize" > + <property name="maximumSize"> <size> - <width>100</width> + <width>80</width> <height>16777215</height> </size> </property> @@ -236,121 +291,92 @@ </widget> </widget> </item> - <item row="0" column="0" colspan="6" > - <layout class="QVBoxLayout" name="verticalLayout_5" > - <item> - <widget class="QFrame" name="sinkFrame" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Expanding" hsizetype="Expanding" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize" > - <size> - <width>1000</width> - <height>550</height> - </size> - </property> - <property name="frameShape" > - <enum>QFrame::StyledPanel</enum> - </property> - <property name="frameShadow" > - <enum>QFrame::Raised</enum> - </property> - <layout class="QGridLayout" name="gridLayout_2" > - <item row="1" column="0" > - <layout class="QHBoxLayout" name="sinkLayout" /> - </item> - </layout> - <zorder>verticalLayoutWidget</zorder> - <zorder>verticalLayoutWidget</zorder> - </widget> - </item> - </layout> - </item> - <item row="2" column="2" > - <layout class="QVBoxLayout" name="verticalLayout_3" > + <item row="2" column="0"> + <layout class="QVBoxLayout" name="verticalLayout_2"> <item> - <widget class="QGroupBox" name="rxBox" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Fixed" hsizetype="Fixed" > + <widget class="QGroupBox" name="sysBox"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="minimumSize" > + <property name="minimumSize"> <size> - <width>180</width> - <height>90</height> + <width>240</width> + <height>60</height> </size> </property> - <property name="maximumSize" > + <property name="maximumSize"> <size> - <width>180</width> + <width>240</width> <height>16777215</height> </size> </property> - <property name="title" > - <string>Receiver Parameters</string> + <property name="title"> + <string>System Parameters</string> </property> - <widget class="QWidget" name="formLayoutWidget_3" > - <property name="geometry" > + <widget class="QWidget" name="formLayoutWidget"> + <property name="geometry"> <rect> <x>10</x> <y>20</y> - <width>161</width> - <height>61</height> + <width>211</width> + <height>31</height> </rect> </property> - <layout class="QFormLayout" name="formLayout_3" > - <property name="sizeConstraint" > + <layout class="QFormLayout" name="formLayout"> + <property name="sizeConstraint"> <enum>QLayout::SetFixedSize</enum> </property> - <item row="0" column="0" > - <widget class="QLabel" name="gainMuLabel" > - <property name="text" > - <string>Gain mu</string> - </property> - </widget> - </item> - <item row="1" column="0" > - <widget class="QLabel" name="alphaLabel" > - <property name="text" > - <string>Alpha</string> + <property name="verticalSpacing"> + <number>20</number> + </property> + <item row="0" column="1"> + <widget class="QLineEdit" name="sampleRateEdit"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> - </widget> - </item> - <item row="0" column="1" > - <widget class="QLineEdit" name="gainMuEdit" > - <property name="minimumSize" > + <property name="minimumSize"> <size> - <width>100</width> - <height>0</height> + <width>60</width> + <height>26</height> </size> </property> - <property name="maximumSize" > + <property name="maximumSize"> <size> - <width>100</width> - <height>16777215</height> + <width>80</width> + <height>26</height> </size> </property> </widget> </item> - <item row="1" column="1" > - <widget class="QLineEdit" name="alphaEdit" > - <property name="minimumSize" > + <item row="0" column="0"> + <widget class="QLabel" name="sampleRateLabel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> <size> - <width>100</width> - <height>0</height> + <width>0</width> + <height>20</height> </size> </property> - <property name="maximumSize" > + <property name="maximumSize"> <size> - <width>100</width> - <height>16777215</height> + <width>16777215</width> + <height>20</height> </size> </property> + <property name="text"> + <string>Sample Rate (sps)</string> + </property> </widget> </item> </layout> @@ -358,123 +384,123 @@ </widget> </item> <item> - <spacer name="verticalSpacer_4" > - <property name="orientation" > + <spacer name="verticalSpacer_2"> + <property name="orientation"> <enum>Qt::Vertical</enum> </property> - <property name="sizeType" > + <property name="sizeType"> <enum>QSizePolicy::Fixed</enum> </property> - <property name="sizeHint" stdset="0" > + <property name="sizeHint" stdset="0"> <size> <width>20</width> - <height>30</height> + <height>60</height> </size> </property> </spacer> </item> </layout> </item> - <item row="2" column="3" > - <widget class="QGroupBox" name="rxBox_2" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Fixed" hsizetype="Fixed" > + <item row="2" column="3"> + <widget class="QGroupBox" name="rxBox_2"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="minimumSize" > + <property name="minimumSize"> <size> <width>220</width> <height>125</height> </size> </property> - <property name="maximumSize" > + <property name="maximumSize"> <size> <width>265</width> <height>125</height> </size> </property> - <property name="title" > + <property name="title"> <string>Received Packet Info</string> </property> - <widget class="QWidget" name="formLayoutWidget_4" > - <property name="geometry" > + <widget class="QWidget" name="formLayoutWidget_4"> + <property name="geometry"> <rect> <x>10</x> <y>20</y> - <width>201</width> + <width>181</width> <height>92</height> </rect> </property> - <layout class="QFormLayout" name="formLayout_4" > - <property name="sizeConstraint" > + <layout class="QFormLayout" name="formLayout_4"> + <property name="sizeConstraint"> <enum>QLayout::SetFixedSize</enum> </property> - <item row="0" column="0" > - <widget class="QLabel" name="pktsRcvdLabel" > - <property name="text" > + <item row="0" column="0"> + <widget class="QLabel" name="pktsRcvdLabel"> + <property name="text"> <string>Packets Rcvd.</string> </property> </widget> </item> - <item row="1" column="0" > - <widget class="QLabel" name="pktsCorrectLabel" > - <property name="text" > + <item row="1" column="0"> + <widget class="QLabel" name="pktsCorrectLabel"> + <property name="text"> <string>Packets Correct</string> </property> </widget> </item> - <item row="2" column="0" > - <widget class="QLabel" name="perLabel" > - <property name="text" > + <item row="2" column="0"> + <widget class="QLabel" name="perLabel"> + <property name="text"> <string>PER</string> </property> </widget> </item> - <item row="0" column="1" > - <widget class="QLineEdit" name="pktsRcvdEdit" > - <property name="minimumSize" > + <item row="0" column="1"> + <widget class="QLineEdit" name="pktsRcvdEdit"> + <property name="minimumSize"> <size> - <width>100</width> + <width>60</width> <height>0</height> </size> </property> - <property name="maximumSize" > + <property name="maximumSize"> <size> - <width>100</width> + <width>80</width> <height>16777215</height> </size> </property> </widget> </item> - <item row="1" column="1" > - <widget class="QLineEdit" name="pktsCorrectEdit" > - <property name="minimumSize" > + <item row="1" column="1"> + <widget class="QLineEdit" name="pktsCorrectEdit"> + <property name="minimumSize"> <size> - <width>100</width> + <width>60</width> <height>0</height> </size> </property> - <property name="maximumSize" > + <property name="maximumSize"> <size> - <width>100</width> + <width>80</width> <height>16777215</height> </size> </property> </widget> </item> - <item row="2" column="1" > - <widget class="QLineEdit" name="perEdit" > - <property name="minimumSize" > + <item row="2" column="1"> + <widget class="QLineEdit" name="perEdit"> + <property name="minimumSize"> <size> - <width>100</width> + <width>60</width> <height>0</height> </size> </property> - <property name="maximumSize" > + <property name="maximumSize"> <size> - <width>100</width> + <width>80</width> <height>16777215</height> </size> </property> @@ -484,12 +510,12 @@ </widget> </widget> </item> - <item row="2" column="4" > - <spacer name="horizontalSpacer" > - <property name="orientation" > + <item row="2" column="4"> + <spacer name="horizontalSpacer"> + <property name="orientation"> <enum>Qt::Horizontal</enum> </property> - <property name="sizeHint" stdset="0" > + <property name="sizeHint" stdset="0"> <size> <width>20</width> <height>20</height> @@ -497,95 +523,64 @@ </property> </spacer> </item> - <item row="2" column="5" > - <layout class="QVBoxLayout" name="verticalLayout" > + <item row="0" column="0" colspan="6"> + <layout class="QVBoxLayout" name="verticalLayout_5"> <item> - <widget class="QPushButton" name="pauseButton" > - <property name="minimumSize" > - <size> - <width>80</width> - <height>0</height> - </size> - </property> - <property name="maximumSize" > - <size> - <width>80</width> - <height>16777215</height> - </size> - </property> - <property name="text" > - <string>Pause</string> - </property> - </widget> - </item> - <item> - <spacer name="verticalSpacer" > - <property name="orientation" > - <enum>Qt::Vertical</enum> - </property> - <property name="sizeType" > - <enum>QSizePolicy::Fixed</enum> - </property> - <property name="sizeHint" stdset="0" > - <size> - <width>20</width> - <height>60</height> - </size> + <widget class="QFrame" name="sinkFrame"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> - </spacer> - </item> - <item> - <widget class="QPushButton" name="closeButton" > - <property name="minimumSize" > + <property name="minimumSize"> <size> - <width>80</width> - <height>0</height> + <width>500</width> + <height>550</height> </size> </property> - <property name="maximumSize" > - <size> - <width>80</width> - <height>16777215</height> - </size> + <property name="frameShape"> + <enum>QFrame::StyledPanel</enum> </property> - <property name="text" > - <string>Close</string> + <property name="frameShadow"> + <enum>QFrame::Raised</enum> </property> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="1" column="0"> + <layout class="QHBoxLayout" name="sinkLayout"/> + </item> + </layout> </widget> </item> </layout> </item> </layout> - <zorder>sinkFrame</zorder> <zorder>channelModeBox</zorder> - <zorder>verticalLayoutWidget</zorder> - <zorder>verticalLayoutWidget</zorder> - <zorder>rxBox</zorder> <zorder></zorder> <zorder>rxBox_2</zorder> <zorder>horizontalSpacer</zorder> <zorder></zorder> </widget> - <widget class="QMenuBar" name="menubar" > - <property name="geometry" > + <widget class="QMenuBar" name="menubar"> + <property name="geometry"> <rect> <x>0</x> <y>0</y> - <width>1050</width> - <height>24</height> + <width>1019</width> + <height>25</height> </rect> </property> - <widget class="QMenu" name="menuFile" > - <property name="title" > + <widget class="QMenu" name="menuFile"> + <property name="title"> <string>&File</string> </property> - <addaction name="actionExit" /> + <addaction name="actionExit"/> </widget> - <addaction name="menuFile" /> + <addaction name="menuFile"/> </widget> - <widget class="QStatusBar" name="statusbar" /> - <action name="actionExit" > - <property name="text" > + <widget class="QStatusBar" name="statusbar"/> + <action name="actionExit"> + <property name="text"> <string>E&xit</string> </property> </action> @@ -603,11 +598,11 @@ <receiver>DigitalWindow</receiver> <slot>close()</slot> <hints> - <hint type="sourcelabel" > + <hint type="sourcelabel"> <x>322</x> <y>623</y> </hint> - <hint type="destinationlabel" > + <hint type="destinationlabel"> <x>66</x> <y>561</y> </hint> @@ -619,11 +614,11 @@ <receiver>DigitalWindow</receiver> <slot>close()</slot> <hints> - <hint type="sourcelabel" > + <hint type="sourcelabel"> <x>-1</x> <y>-1</y> </hint> - <hint type="destinationlabel" > + <hint type="destinationlabel"> <x>617</x> <y>327</y> </hint> diff --git a/gnuradio-examples/python/digital/qt_digital_window2.py b/gnuradio-examples/python/digital/qt_digital_window2.py new file mode 100644 index 000000000..f111e3772 --- /dev/null +++ b/gnuradio-examples/python/digital/qt_digital_window2.py @@ -0,0 +1,261 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'qt_digital_window.ui' +# +# Created: Mon Oct 12 12:10:54 2009 +# by: PyQt4 UI code generator 4.4.3 +# +# WARNING! All changes made in this file will be lost! + +from PyQt4 import QtCore, QtGui + +class Ui_DigitalWindow(object): + def setupUi(self, DigitalWindow): + DigitalWindow.setObjectName("DigitalWindow") + DigitalWindow.resize(1019, 754) + self.centralwidget = QtGui.QWidget(DigitalWindow) + self.centralwidget.setObjectName("centralwidget") + self.gridLayout = QtGui.QGridLayout(self.centralwidget) + self.gridLayout.setObjectName("gridLayout") + self.verticalLayout_2 = QtGui.QVBoxLayout() + self.verticalLayout_2.setObjectName("verticalLayout_2") + self.sysBox = QtGui.QGroupBox(self.centralwidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.sysBox.sizePolicy().hasHeightForWidth()) + self.sysBox.setSizePolicy(sizePolicy) + self.sysBox.setMinimumSize(QtCore.QSize(240, 60)) + self.sysBox.setMaximumSize(QtCore.QSize(240, 16777215)) + self.sysBox.setObjectName("sysBox") + self.formLayoutWidget = QtGui.QWidget(self.sysBox) + self.formLayoutWidget.setGeometry(QtCore.QRect(10, 20, 211, 31)) + self.formLayoutWidget.setObjectName("formLayoutWidget") + self.formLayout = QtGui.QFormLayout(self.formLayoutWidget) + self.formLayout.setSizeConstraint(QtGui.QLayout.SetFixedSize) + self.formLayout.setVerticalSpacing(20) + self.formLayout.setObjectName("formLayout") + self.sampleRateEdit = QtGui.QLineEdit(self.formLayoutWidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.sampleRateEdit.sizePolicy().hasHeightForWidth()) + self.sampleRateEdit.setSizePolicy(sizePolicy) + self.sampleRateEdit.setMinimumSize(QtCore.QSize(60, 26)) + self.sampleRateEdit.setMaximumSize(QtCore.QSize(80, 26)) + self.sampleRateEdit.setObjectName("sampleRateEdit") + self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.sampleRateEdit) + self.sampleRateLabel = QtGui.QLabel(self.formLayoutWidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.sampleRateLabel.sizePolicy().hasHeightForWidth()) + self.sampleRateLabel.setSizePolicy(sizePolicy) + self.sampleRateLabel.setMinimumSize(QtCore.QSize(0, 20)) + self.sampleRateLabel.setMaximumSize(QtCore.QSize(16777215, 20)) + self.sampleRateLabel.setObjectName("sampleRateLabel") + self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.sampleRateLabel) + self.verticalLayout_2.addWidget(self.sysBox) + spacerItem = QtGui.QSpacerItem(20, 60, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) + self.verticalLayout_2.addItem(spacerItem) + self.gridLayout.addLayout(self.verticalLayout_2, 2, 0, 1, 1) + self.verticalLayout_5 = QtGui.QVBoxLayout() + self.verticalLayout_5.setObjectName("verticalLayout_5") + self.sinkFrame = QtGui.QFrame(self.centralwidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.sinkFrame.sizePolicy().hasHeightForWidth()) + self.sinkFrame.setSizePolicy(sizePolicy) + self.sinkFrame.setMinimumSize(QtCore.QSize(500, 550)) + self.sinkFrame.setFrameShape(QtGui.QFrame.StyledPanel) + self.sinkFrame.setFrameShadow(QtGui.QFrame.Raised) + self.sinkFrame.setObjectName("sinkFrame") + self.gridLayout_2 = QtGui.QGridLayout(self.sinkFrame) + self.gridLayout_2.setObjectName("gridLayout_2") + self.sinkLayout = QtGui.QHBoxLayout() + self.sinkLayout.setObjectName("sinkLayout") + self.gridLayout_2.addLayout(self.sinkLayout, 1, 0, 1, 1) + self.verticalLayout_5.addWidget(self.sinkFrame) + self.gridLayout.addLayout(self.verticalLayout_5, 0, 0, 1, 6) + self.channelModeBox = QtGui.QGroupBox(self.centralwidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.channelModeBox.sizePolicy().hasHeightForWidth()) + self.channelModeBox.setSizePolicy(sizePolicy) + self.channelModeBox.setMinimumSize(QtCore.QSize(245, 130)) + self.channelModeBox.setMaximumSize(QtCore.QSize(245, 16777215)) + self.channelModeBox.setObjectName("channelModeBox") + self.formLayoutWidget_2 = QtGui.QWidget(self.channelModeBox) + self.formLayoutWidget_2.setGeometry(QtCore.QRect(10, 20, 221, 98)) + self.formLayoutWidget_2.setObjectName("formLayoutWidget_2") + self.formLayout_2 = QtGui.QFormLayout(self.formLayoutWidget_2) + self.formLayout_2.setSizeConstraint(QtGui.QLayout.SetFixedSize) + self.formLayout_2.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow) + self.formLayout_2.setObjectName("formLayout_2") + self.snrLabel = QtGui.QLabel(self.formLayoutWidget_2) + self.snrLabel.setObjectName("snrLabel") + self.formLayout_2.setWidget(0, QtGui.QFormLayout.LabelRole, self.snrLabel) + self.snrEdit = QtGui.QLineEdit(self.formLayoutWidget_2) + self.snrEdit.setMinimumSize(QtCore.QSize(60, 0)) + self.snrEdit.setMaximumSize(QtCore.QSize(80, 16777215)) + self.snrEdit.setObjectName("snrEdit") + self.formLayout_2.setWidget(0, QtGui.QFormLayout.FieldRole, self.snrEdit) + self.freqLabel = QtGui.QLabel(self.formLayoutWidget_2) + self.freqLabel.setObjectName("freqLabel") + self.formLayout_2.setWidget(1, QtGui.QFormLayout.LabelRole, self.freqLabel) + self.freqEdit = QtGui.QLineEdit(self.formLayoutWidget_2) + self.freqEdit.setMinimumSize(QtCore.QSize(60, 0)) + self.freqEdit.setMaximumSize(QtCore.QSize(80, 16777215)) + self.freqEdit.setObjectName("freqEdit") + self.formLayout_2.setWidget(1, QtGui.QFormLayout.FieldRole, self.freqEdit) + self.timeLabel = QtGui.QLabel(self.formLayoutWidget_2) + self.timeLabel.setObjectName("timeLabel") + self.formLayout_2.setWidget(2, QtGui.QFormLayout.LabelRole, self.timeLabel) + self.timeEdit = QtGui.QLineEdit(self.formLayoutWidget_2) + self.timeEdit.setMinimumSize(QtCore.QSize(60, 0)) + self.timeEdit.setMaximumSize(QtCore.QSize(80, 16777215)) + self.timeEdit.setObjectName("timeEdit") + self.formLayout_2.setWidget(2, QtGui.QFormLayout.FieldRole, self.timeEdit) + self.gridLayout.addWidget(self.channelModeBox, 2, 1, 1, 1) + self.rxBox_2 = QtGui.QGroupBox(self.centralwidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.rxBox_2.sizePolicy().hasHeightForWidth()) + self.rxBox_2.setSizePolicy(sizePolicy) + self.rxBox_2.setMinimumSize(QtCore.QSize(220, 125)) + self.rxBox_2.setMaximumSize(QtCore.QSize(265, 125)) + self.rxBox_2.setObjectName("rxBox_2") + self.formLayoutWidget_4 = QtGui.QWidget(self.rxBox_2) + self.formLayoutWidget_4.setGeometry(QtCore.QRect(10, 20, 248, 188)) + self.formLayoutWidget_4.setObjectName("formLayoutWidget_4") + self.formLayout_4 = QtGui.QFormLayout(self.formLayoutWidget_4) + self.formLayout_4.setSizeConstraint(QtGui.QLayout.SetFixedSize) + self.formLayout_4.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow) + self.formLayout_4.setObjectName("formLayout_4") + self.pktsRcvdLabel = QtGui.QLabel(self.formLayoutWidget_4) + self.pktsRcvdLabel.setObjectName("pktsRcvdLabel") + self.formLayout_4.setWidget(0, QtGui.QFormLayout.LabelRole, self.pktsRcvdLabel) + self.pktsRcvdEdit = QtGui.QLineEdit(self.formLayoutWidget_4) + self.pktsRcvdEdit.setMinimumSize(QtCore.QSize(60, 0)) + self.pktsRcvdEdit.setMaximumSize(QtCore.QSize(80, 16777215)) + self.pktsRcvdEdit.setObjectName("pktsRcvdEdit") + self.formLayout_4.setWidget(0, QtGui.QFormLayout.FieldRole, self.pktsRcvdEdit) + self.pktsCorrectLabel = QtGui.QLabel(self.formLayoutWidget_4) + self.pktsCorrectLabel.setObjectName("pktsCorrectLabel") + self.formLayout_4.setWidget(1, QtGui.QFormLayout.LabelRole, self.pktsCorrectLabel) + self.pktsCorrectEdit = QtGui.QLineEdit(self.formLayoutWidget_4) + self.pktsCorrectEdit.setMinimumSize(QtCore.QSize(60, 0)) + self.pktsCorrectEdit.setMaximumSize(QtCore.QSize(80, 16777215)) + self.pktsCorrectEdit.setObjectName("pktsCorrectEdit") + self.formLayout_4.setWidget(1, QtGui.QFormLayout.FieldRole, self.pktsCorrectEdit) + self.perLabel = QtGui.QLabel(self.formLayoutWidget_4) + self.perLabel.setObjectName("perLabel") + self.formLayout_4.setWidget(2, QtGui.QFormLayout.LabelRole, self.perLabel) + self.perEdit = QtGui.QLineEdit(self.formLayoutWidget_4) + self.perEdit.setMinimumSize(QtCore.QSize(60, 0)) + self.perEdit.setMaximumSize(QtCore.QSize(80, 16777215)) + self.perEdit.setObjectName("perEdit") + self.formLayout_4.setWidget(2, QtGui.QFormLayout.FieldRole, self.perEdit) + self.gridLayout.addWidget(self.rxBox_2, 2, 3, 1, 1) + spacerItem1 = QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) + self.gridLayout.addItem(spacerItem1, 2, 4, 1, 1) + self.verticalLayout = QtGui.QVBoxLayout() + self.verticalLayout.setObjectName("verticalLayout") + self.pauseButton = QtGui.QPushButton(self.centralwidget) + self.pauseButton.setMinimumSize(QtCore.QSize(80, 0)) + self.pauseButton.setMaximumSize(QtCore.QSize(80, 16777215)) + self.pauseButton.setObjectName("pauseButton") + self.verticalLayout.addWidget(self.pauseButton) + spacerItem2 = QtGui.QSpacerItem(20, 60, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) + self.verticalLayout.addItem(spacerItem2) + self.closeButton = QtGui.QPushButton(self.centralwidget) + self.closeButton.setMinimumSize(QtCore.QSize(80, 0)) + self.closeButton.setMaximumSize(QtCore.QSize(80, 16777215)) + self.closeButton.setObjectName("closeButton") + self.verticalLayout.addWidget(self.closeButton) + self.gridLayout.addLayout(self.verticalLayout, 2, 5, 1, 1) + self.rxBox = QtGui.QGroupBox(self.centralwidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.rxBox.sizePolicy().hasHeightForWidth()) + self.rxBox.setSizePolicy(sizePolicy) + self.rxBox.setMinimumSize(QtCore.QSize(180, 120)) + self.rxBox.setMaximumSize(QtCore.QSize(180, 16777215)) + self.rxBox.setObjectName("rxBox") + self.formLayoutWidget_3 = QtGui.QWidget(self.rxBox) + self.formLayoutWidget_3.setGeometry(QtCore.QRect(10, 10, 161, 101)) + self.formLayoutWidget_3.setObjectName("formLayoutWidget_3") + self.formLayout_3 = QtGui.QFormLayout(self.formLayoutWidget_3) + self.formLayout_3.setSizeConstraint(QtGui.QLayout.SetFixedSize) + self.formLayout_3.setObjectName("formLayout_3") + self.alphaTimeLabel = QtGui.QLabel(self.formLayoutWidget_3) + self.alphaTimeLabel.setObjectName("alphaTimeLabel") + self.formLayout_3.setWidget(0, QtGui.QFormLayout.LabelRole, self.alphaTimeLabel) + self.alphaFreqLabel = QtGui.QLabel(self.formLayoutWidget_3) + self.alphaFreqLabel.setObjectName("alphaFreqLabel") + self.formLayout_3.setWidget(2, QtGui.QFormLayout.LabelRole, self.alphaFreqLabel) + self.alphaTimeEdit = QtGui.QLineEdit(self.formLayoutWidget_3) + self.alphaTimeEdit.setMinimumSize(QtCore.QSize(60, 0)) + self.alphaTimeEdit.setMaximumSize(QtCore.QSize(80, 16777215)) + self.alphaTimeEdit.setObjectName("alphaTimeEdit") + self.formLayout_3.setWidget(0, QtGui.QFormLayout.FieldRole, self.alphaTimeEdit) + self.alphaFreqEdit = QtGui.QLineEdit(self.formLayoutWidget_3) + self.alphaFreqEdit.setMinimumSize(QtCore.QSize(60, 0)) + self.alphaFreqEdit.setMaximumSize(QtCore.QSize(80, 16777215)) + self.alphaFreqEdit.setObjectName("alphaFreqEdit") + self.formLayout_3.setWidget(2, QtGui.QFormLayout.FieldRole, self.alphaFreqEdit) + self.betaTimeEdit = QtGui.QLineEdit(self.formLayoutWidget_3) + self.betaTimeEdit.setMaximumSize(QtCore.QSize(80, 16777215)) + self.betaTimeEdit.setObjectName("betaTimeEdit") + self.formLayout_3.setWidget(1, QtGui.QFormLayout.FieldRole, self.betaTimeEdit) + self.betaTimeLabel = QtGui.QLabel(self.formLayoutWidget_3) + self.betaTimeLabel.setObjectName("betaTimeLabel") + self.formLayout_3.setWidget(1, QtGui.QFormLayout.LabelRole, self.betaTimeLabel) + self.gridLayout.addWidget(self.rxBox, 2, 2, 1, 1) + DigitalWindow.setCentralWidget(self.centralwidget) + self.menubar = QtGui.QMenuBar(DigitalWindow) + self.menubar.setGeometry(QtCore.QRect(0, 0, 1019, 24)) + self.menubar.setObjectName("menubar") + self.menuFile = QtGui.QMenu(self.menubar) + self.menuFile.setObjectName("menuFile") + DigitalWindow.setMenuBar(self.menubar) + self.statusbar = QtGui.QStatusBar(DigitalWindow) + self.statusbar.setObjectName("statusbar") + DigitalWindow.setStatusBar(self.statusbar) + self.actionExit = QtGui.QAction(DigitalWindow) + self.actionExit.setObjectName("actionExit") + self.menuFile.addAction(self.actionExit) + self.menubar.addAction(self.menuFile.menuAction()) + + self.retranslateUi(DigitalWindow) + QtCore.QObject.connect(self.closeButton, QtCore.SIGNAL("clicked()"), DigitalWindow.close) + QtCore.QObject.connect(self.actionExit, QtCore.SIGNAL("triggered()"), DigitalWindow.close) + QtCore.QMetaObject.connectSlotsByName(DigitalWindow) + DigitalWindow.setTabOrder(self.snrEdit, self.freqEdit) + DigitalWindow.setTabOrder(self.freqEdit, self.timeEdit) + + def retranslateUi(self, DigitalWindow): + DigitalWindow.setWindowTitle(QtGui.QApplication.translate("DigitalWindow", "MainWindow", None, QtGui.QApplication.UnicodeUTF8)) + self.sysBox.setTitle(QtGui.QApplication.translate("DigitalWindow", "System Parameters", None, QtGui.QApplication.UnicodeUTF8)) + self.sampleRateLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Sample Rate (sps)", None, QtGui.QApplication.UnicodeUTF8)) + self.channelModeBox.setTitle(QtGui.QApplication.translate("DigitalWindow", "Channel Model Parameters", None, QtGui.QApplication.UnicodeUTF8)) + self.snrLabel.setText(QtGui.QApplication.translate("DigitalWindow", "SNR (dB)", None, QtGui.QApplication.UnicodeUTF8)) + self.freqLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Frequency Offset (Hz)", None, QtGui.QApplication.UnicodeUTF8)) + self.timeLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Timing Offset", None, QtGui.QApplication.UnicodeUTF8)) + self.rxBox_2.setTitle(QtGui.QApplication.translate("DigitalWindow", "Received Packet Info", None, QtGui.QApplication.UnicodeUTF8)) + self.pktsRcvdLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Packets Rcvd.", None, QtGui.QApplication.UnicodeUTF8)) + self.pktsCorrectLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Packets Correct", None, QtGui.QApplication.UnicodeUTF8)) + self.perLabel.setText(QtGui.QApplication.translate("DigitalWindow", "PER", None, QtGui.QApplication.UnicodeUTF8)) + self.pauseButton.setText(QtGui.QApplication.translate("DigitalWindow", "Pause", None, QtGui.QApplication.UnicodeUTF8)) + self.closeButton.setText(QtGui.QApplication.translate("DigitalWindow", "Close", None, QtGui.QApplication.UnicodeUTF8)) + self.rxBox.setTitle(QtGui.QApplication.translate("DigitalWindow", "Receiver Parameters", None, QtGui.QApplication.UnicodeUTF8)) + self.alphaTimeLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Alpha: time", None, QtGui.QApplication.UnicodeUTF8)) + self.alphaFreqLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Alpha: freq", None, QtGui.QApplication.UnicodeUTF8)) + self.betaTimeLabel.setText(QtGui.QApplication.translate("DigitalWindow", "Beta: time", None, QtGui.QApplication.UnicodeUTF8)) + self.menuFile.setTitle(QtGui.QApplication.translate("DigitalWindow", "&File", None, QtGui.QApplication.UnicodeUTF8)) + self.actionExit.setText(QtGui.QApplication.translate("DigitalWindow", "E&xit", None, QtGui.QApplication.UnicodeUTF8)) + diff --git a/gnuradio-examples/python/digital/qt_digital_window2.ui b/gnuradio-examples/python/digital/qt_digital_window2.ui new file mode 100644 index 000000000..dc20ed798 --- /dev/null +++ b/gnuradio-examples/python/digital/qt_digital_window2.ui @@ -0,0 +1,637 @@ +<ui version="4.0" > + <class>DigitalWindow</class> + <widget class="QMainWindow" name="DigitalWindow" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>1019</width> + <height>754</height> + </rect> + </property> + <property name="windowTitle" > + <string>MainWindow</string> + </property> + <widget class="QWidget" name="centralwidget" > + <layout class="QGridLayout" name="gridLayout" > + <item row="2" column="0" > + <layout class="QVBoxLayout" name="verticalLayout_2" > + <item> + <widget class="QGroupBox" name="sysBox" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Fixed" hsizetype="Fixed" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize" > + <size> + <width>240</width> + <height>60</height> + </size> + </property> + <property name="maximumSize" > + <size> + <width>240</width> + <height>16777215</height> + </size> + </property> + <property name="title" > + <string>System Parameters</string> + </property> + <widget class="QWidget" name="formLayoutWidget" > + <property name="geometry" > + <rect> + <x>10</x> + <y>20</y> + <width>211</width> + <height>31</height> + </rect> + </property> + <layout class="QFormLayout" name="formLayout" > + <property name="sizeConstraint" > + <enum>QLayout::SetFixedSize</enum> + </property> + <property name="verticalSpacing" > + <number>20</number> + </property> + <item row="0" column="1" > + <widget class="QLineEdit" name="sampleRateEdit" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Fixed" hsizetype="Fixed" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize" > + <size> + <width>60</width> + <height>26</height> + </size> + </property> + <property name="maximumSize" > + <size> + <width>80</width> + <height>26</height> + </size> + </property> + </widget> + </item> + <item row="0" column="0" > + <widget class="QLabel" name="sampleRateLabel" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Fixed" hsizetype="Fixed" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize" > + <size> + <width>0</width> + <height>20</height> + </size> + </property> + <property name="maximumSize" > + <size> + <width>16777215</width> + <height>20</height> + </size> + </property> + <property name="text" > + <string>Sample Rate (sps)</string> + </property> + </widget> + </item> + </layout> + </widget> + </widget> + </item> + <item> + <spacer name="verticalSpacer_2" > + <property name="orientation" > + <enum>Qt::Vertical</enum> + </property> + <property name="sizeType" > + <enum>QSizePolicy::Fixed</enum> + </property> + <property name="sizeHint" stdset="0" > + <size> + <width>20</width> + <height>60</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item row="0" column="0" colspan="6" > + <layout class="QVBoxLayout" name="verticalLayout_5" > + <item> + <widget class="QFrame" name="sinkFrame" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Expanding" hsizetype="Expanding" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize" > + <size> + <width>500</width> + <height>550</height> + </size> + </property> + <property name="frameShape" > + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow" > + <enum>QFrame::Raised</enum> + </property> + <layout class="QGridLayout" name="gridLayout_2" > + <item row="1" column="0" > + <layout class="QHBoxLayout" name="sinkLayout" /> + </item> + </layout> + </widget> + </item> + </layout> + </item> + <item row="2" column="1" > + <widget class="QGroupBox" name="channelModeBox" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Fixed" hsizetype="Fixed" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize" > + <size> + <width>245</width> + <height>130</height> + </size> + </property> + <property name="maximumSize" > + <size> + <width>245</width> + <height>16777215</height> + </size> + </property> + <property name="title" > + <string>Channel Model Parameters</string> + </property> + <widget class="QWidget" name="formLayoutWidget_2" > + <property name="geometry" > + <rect> + <x>10</x> + <y>20</y> + <width>221</width> + <height>98</height> + </rect> + </property> + <layout class="QFormLayout" name="formLayout_2" > + <property name="sizeConstraint" > + <enum>QLayout::SetFixedSize</enum> + </property> + <property name="fieldGrowthPolicy" > + <enum>QFormLayout::AllNonFixedFieldsGrow</enum> + </property> + <item row="0" column="0" > + <widget class="QLabel" name="snrLabel" > + <property name="text" > + <string>SNR (dB)</string> + </property> + </widget> + </item> + <item row="0" column="1" > + <widget class="QLineEdit" name="snrEdit" > + <property name="minimumSize" > + <size> + <width>60</width> + <height>0</height> + </size> + </property> + <property name="maximumSize" > + <size> + <width>80</width> + <height>16777215</height> + </size> + </property> + </widget> + </item> + <item row="1" column="0" > + <widget class="QLabel" name="freqLabel" > + <property name="text" > + <string>Frequency Offset (Hz)</string> + </property> + </widget> + </item> + <item row="1" column="1" > + <widget class="QLineEdit" name="freqEdit" > + <property name="minimumSize" > + <size> + <width>60</width> + <height>0</height> + </size> + </property> + <property name="maximumSize" > + <size> + <width>80</width> + <height>16777215</height> + </size> + </property> + </widget> + </item> + <item row="2" column="0" > + <widget class="QLabel" name="timeLabel" > + <property name="text" > + <string>Timing Offset</string> + </property> + </widget> + </item> + <item row="2" column="1" > + <widget class="QLineEdit" name="timeEdit" > + <property name="minimumSize" > + <size> + <width>60</width> + <height>0</height> + </size> + </property> + <property name="maximumSize" > + <size> + <width>80</width> + <height>16777215</height> + </size> + </property> + </widget> + </item> + </layout> + </widget> + <zorder>formLayoutWidget_2</zorder> + <zorder>rxBox</zorder> + </widget> + </item> + <item row="2" column="3" > + <widget class="QGroupBox" name="rxBox_2" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Fixed" hsizetype="Fixed" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize" > + <size> + <width>220</width> + <height>125</height> + </size> + </property> + <property name="maximumSize" > + <size> + <width>265</width> + <height>125</height> + </size> + </property> + <property name="title" > + <string>Received Packet Info</string> + </property> + <widget class="QWidget" name="formLayoutWidget_4" > + <property name="geometry" > + <rect> + <x>10</x> + <y>20</y> + <width>248</width> + <height>188</height> + </rect> + </property> + <layout class="QFormLayout" name="formLayout_4" > + <property name="sizeConstraint" > + <enum>QLayout::SetFixedSize</enum> + </property> + <property name="fieldGrowthPolicy" > + <enum>QFormLayout::AllNonFixedFieldsGrow</enum> + </property> + <item row="0" column="0" > + <widget class="QLabel" name="pktsRcvdLabel" > + <property name="text" > + <string>Packets Rcvd.</string> + </property> + </widget> + </item> + <item row="0" column="1" > + <widget class="QLineEdit" name="pktsRcvdEdit" > + <property name="minimumSize" > + <size> + <width>60</width> + <height>0</height> + </size> + </property> + <property name="maximumSize" > + <size> + <width>80</width> + <height>16777215</height> + </size> + </property> + </widget> + </item> + <item row="1" column="0" > + <widget class="QLabel" name="pktsCorrectLabel" > + <property name="text" > + <string>Packets Correct</string> + </property> + </widget> + </item> + <item row="1" column="1" > + <widget class="QLineEdit" name="pktsCorrectEdit" > + <property name="minimumSize" > + <size> + <width>60</width> + <height>0</height> + </size> + </property> + <property name="maximumSize" > + <size> + <width>80</width> + <height>16777215</height> + </size> + </property> + </widget> + </item> + <item row="2" column="0" > + <widget class="QLabel" name="perLabel" > + <property name="text" > + <string>PER</string> + </property> + </widget> + </item> + <item row="2" column="1" > + <widget class="QLineEdit" name="perEdit" > + <property name="minimumSize" > + <size> + <width>60</width> + <height>0</height> + </size> + </property> + <property name="maximumSize" > + <size> + <width>80</width> + <height>16777215</height> + </size> + </property> + </widget> + </item> + </layout> + <zorder>pktsRcvdLabel</zorder> + <zorder>pktsCorrectLabel</zorder> + <zorder>perLabel</zorder> + <zorder>pktsRcvdEdit</zorder> + <zorder>pktsCorrectEdit</zorder> + <zorder>perEdit</zorder> + <zorder>rxBox</zorder> + </widget> + </widget> + </item> + <item row="2" column="4" > + <spacer name="horizontalSpacer" > + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0" > + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="2" column="5" > + <layout class="QVBoxLayout" name="verticalLayout" > + <item> + <widget class="QPushButton" name="pauseButton" > + <property name="minimumSize" > + <size> + <width>80</width> + <height>0</height> + </size> + </property> + <property name="maximumSize" > + <size> + <width>80</width> + <height>16777215</height> + </size> + </property> + <property name="text" > + <string>Pause</string> + </property> + </widget> + </item> + <item> + <spacer name="verticalSpacer" > + <property name="orientation" > + <enum>Qt::Vertical</enum> + </property> + <property name="sizeType" > + <enum>QSizePolicy::Fixed</enum> + </property> + <property name="sizeHint" stdset="0" > + <size> + <width>20</width> + <height>60</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="closeButton" > + <property name="minimumSize" > + <size> + <width>80</width> + <height>0</height> + </size> + </property> + <property name="maximumSize" > + <size> + <width>80</width> + <height>16777215</height> + </size> + </property> + <property name="text" > + <string>Close</string> + </property> + </widget> + </item> + </layout> + </item> + <item row="2" column="2" > + <widget class="QGroupBox" name="rxBox" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Fixed" hsizetype="Fixed" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize" > + <size> + <width>180</width> + <height>120</height> + </size> + </property> + <property name="maximumSize" > + <size> + <width>180</width> + <height>16777215</height> + </size> + </property> + <property name="title" > + <string>Receiver Parameters</string> + </property> + <widget class="QWidget" name="formLayoutWidget_3" > + <property name="geometry" > + <rect> + <x>10</x> + <y>10</y> + <width>161</width> + <height>101</height> + </rect> + </property> + <layout class="QFormLayout" name="formLayout_3" > + <property name="sizeConstraint" > + <enum>QLayout::SetFixedSize</enum> + </property> + <item row="0" column="0" > + <widget class="QLabel" name="alphaTimeLabel" > + <property name="text" > + <string>Alpha: time</string> + </property> + </widget> + </item> + <item row="2" column="0" > + <widget class="QLabel" name="alphaFreqLabel" > + <property name="text" > + <string>Alpha: freq</string> + </property> + </widget> + </item> + <item row="0" column="1" > + <widget class="QLineEdit" name="alphaTimeEdit" > + <property name="minimumSize" > + <size> + <width>60</width> + <height>0</height> + </size> + </property> + <property name="maximumSize" > + <size> + <width>80</width> + <height>16777215</height> + </size> + </property> + </widget> + </item> + <item row="2" column="1" > + <widget class="QLineEdit" name="alphaFreqEdit" > + <property name="minimumSize" > + <size> + <width>60</width> + <height>0</height> + </size> + </property> + <property name="maximumSize" > + <size> + <width>80</width> + <height>16777215</height> + </size> + </property> + </widget> + </item> + <item row="1" column="1" > + <widget class="QLineEdit" name="betaTimeEdit" > + <property name="maximumSize" > + <size> + <width>80</width> + <height>16777215</height> + </size> + </property> + </widget> + </item> + <item row="1" column="0" > + <widget class="QLabel" name="betaTimeLabel" > + <property name="text" > + <string>Beta: time</string> + </property> + </widget> + </item> + </layout> + </widget> + </widget> + </item> + </layout> + <zorder>channelModeBox</zorder> + <zorder></zorder> + <zorder>rxBox_2</zorder> + <zorder>horizontalSpacer</zorder> + <zorder></zorder> + <zorder>rxBox</zorder> + </widget> + <widget class="QMenuBar" name="menubar" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>1019</width> + <height>24</height> + </rect> + </property> + <widget class="QMenu" name="menuFile" > + <property name="title" > + <string>&File</string> + </property> + <addaction name="actionExit" /> + </widget> + <addaction name="menuFile" /> + </widget> + <widget class="QStatusBar" name="statusbar" /> + <action name="actionExit" > + <property name="text" > + <string>E&xit</string> + </property> + </action> + </widget> + <tabstops> + <tabstop>snrEdit</tabstop> + <tabstop>freqEdit</tabstop> + <tabstop>timeEdit</tabstop> + </tabstops> + <resources/> + <connections> + <connection> + <sender>closeButton</sender> + <signal>clicked()</signal> + <receiver>DigitalWindow</receiver> + <slot>close()</slot> + <hints> + <hint type="sourcelabel" > + <x>322</x> + <y>623</y> + </hint> + <hint type="destinationlabel" > + <x>66</x> + <y>561</y> + </hint> + </hints> + </connection> + <connection> + <sender>actionExit</sender> + <signal>triggered()</signal> + <receiver>DigitalWindow</receiver> + <slot>close()</slot> + <hints> + <hint type="sourcelabel" > + <x>-1</x> + <y>-1</y> + </hint> + <hint type="destinationlabel" > + <x>617</x> + <y>327</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/gr-atsc/src/lib/Makefile.am b/gr-atsc/src/lib/Makefile.am index b43546125..8aeb80c0a 100644 --- a/gr-atsc/src/lib/Makefile.am +++ b/gr-atsc/src/lib/Makefile.am @@ -92,6 +92,9 @@ BUILT_SOURCES = \ libgnuradio_atsc_la_LIBADD = \ $(GNURADIO_CORE_LA) +libgnuradio_atsc_la_LDFLAGS = \ + $(NO_UNDEFINED) + noinst_LTLIBRARIES = libgnuradio-atsc-qa.la libgnuradio_atsc_qa_la_SOURCES = \ @@ -113,6 +116,9 @@ libgnuradio_atsc_qa_la_SOURCES = \ libgnuradio_atsc_qa_la_LIBADD = \ $(GNURADIO_CORE_LA) +libgnuradio_atsc_qa_la_LDFLAGS = \ + $(NO_UNDEFINED) + # These headers get installed in ${prefix}/include/gnuradio grinclude_HEADERS = \ diff --git a/gr-audio-osx/src/audio_osx.h b/gr-audio-osx/src/audio_osx.h index c92fbcb0d..79e79e36c 100644 --- a/gr-audio-osx/src/audio_osx.h +++ b/gr-audio-osx/src/audio_osx.h @@ -23,22 +23,33 @@ #ifndef INCLUDED_AUDIO_OSX_H #define INCLUDED_AUDIO_OSX_H -#define CheckErrorAndThrow(err,what,throw_str) \ -if (err) { \ - OSStatus error = static_cast<OSStatus>(err); \ - fprintf (stderr, "%s\n Error# %ld ('%4s')\n %s:%d\n", \ - what, error, (char*)(&err), __FILE__, __LINE__); \ - fflush (stdout); \ - throw std::runtime_error (throw_str); \ -} +#include <iostream> +#include <string.h> -#define CheckError(err,what) \ -if (err) { \ - OSStatus error = static_cast<OSStatus>(err); \ - fprintf (stderr, "%s\n Error# %ld ('%4s')\n %s:%d\n", \ - what, error, (char*)(&err), __FILE__, __LINE__); \ - fflush (stdout); \ -} +#define CheckErrorAndThrow(err,what,throw_str) \ + if (err) { \ + OSStatus error = static_cast<OSStatus>(err); \ + char err_str[4]; \ + strncpy (err_str, (char*)(&err), 4); \ + std::cerr << what << std::endl; \ + std::cerr << " Error# " << error << " ('" << err_str \ + << "')" << std::endl; \ + std::cerr << " " << __FILE__ << ":" << __LINE__ << std::endl; \ + fflush (stderr); \ + throw std::runtime_error (throw_str); \ + } + +#define CheckError(err,what) \ + if (err) { \ + OSStatus error = static_cast<OSStatus>(err); \ + char err_str[4]; \ + strncpy (err_str, (char*)(&err), 4); \ + std::cerr << what << std::endl; \ + std::cerr << " Error# " << error << " ('" << err_str \ + << "')" << std::endl; \ + std::cerr << " " << __FILE__ << ":" << __LINE__ << std::endl; \ + fflush (stderr); \ + } #ifdef WORDS_BIGENDIAN #define GR_PCM_ENDIANNESS kLinearPCMFormatFlagIsBigEndian @@ -46,4 +57,15 @@ if (err) { \ #define GR_PCM_ENDIANNESS 0 #endif +// Check the version of MacOSX being used +#ifdef __APPLE_CC__ +#include <AvailabilityMacros.h> +#ifndef MAC_OS_X_VERSION_10_6 +#define MAC_OS_X_VERSION_10_6 1060 +#endif +#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6 +#define GR_USE_OLD_AUDIO_UNIT +#endif +#endif + #endif /* INCLUDED_AUDIO_OSX_H */ diff --git a/gr-audio-osx/src/audio_osx_sink.cc b/gr-audio-osx/src/audio_osx_sink.cc index fef21babd..e91716c0a 100644 --- a/gr-audio-osx/src/audio_osx_sink.cc +++ b/gr-audio-osx/src/audio_osx_sink.cc @@ -47,19 +47,19 @@ audio_osx_sink::audio_osx_sink (int sample_rate, d_OutputAU (0) { if (sample_rate <= 0) { - fprintf (stderr, "Invalid Sample Rate: %d\n", sample_rate); + std::cerr << "Invalid Sample Rate: " << sample_rate << std::endl; throw std::invalid_argument ("audio_osx_sink::audio_osx_sink"); } else d_sample_rate = (Float64) sample_rate; if (channel_config <= 0 & channel_config != -1) { - fprintf (stderr, "Invalid Channel Config: %d\n", channel_config); + std::cerr << "Invalid Channel Config: " << channel_config << std::endl; throw std::invalid_argument ("audio_osx_sink::audio_osx_sink"); } else if (channel_config == -1) { // no user input; try "device name" instead int l_n_channels = (int) strtol (device_name.data(), (char **)NULL, 10); if (l_n_channels == 0 & errno) { - fprintf (stderr, "Error Converting Device Name: %d\n", errno); + std::cerr << "Error Converting Device Name: " << errno << std::endl; throw std::invalid_argument ("audio_osx_sink::audio_osx_sink"); } if (l_n_channels <= 0) @@ -79,7 +79,7 @@ audio_osx_sink::audio_osx_sink (int sample_rate, if (max_sample_count == -1) max_sample_count = sample_rate; else if (max_sample_count <= 0) { - fprintf (stderr, "Invalid Max Sample Count: %d\n", max_sample_count); + std::cerr << "Invalid Max Sample Count: " << max_sample_count << std::endl; throw std::invalid_argument ("audio_osx_sink::audio_osx_sink"); } @@ -98,21 +98,39 @@ audio_osx_sink::audio_osx_sink (int sample_rate, OSStatus err = noErr; // Open the default output unit +#ifndef GR_USE_OLD_AUDIO_UNIT + AudioComponentDescription desc; +#else ComponentDescription desc; +#endif + desc.componentType = kAudioUnitType_Output; desc.componentSubType = kAudioUnitSubType_DefaultOutput; desc.componentManufacturer = kAudioUnitManufacturer_Apple; desc.componentFlags = 0; desc.componentFlagsMask = 0; +#ifndef GR_USE_OLD_AUDIO_UNIT + AudioComponent comp = AudioComponentFindNext(NULL, &desc); + if (comp == NULL) { + std::cerr << "AudioComponentFindNext Error" << std::endl; + throw std::runtime_error ("audio_osx_sink::audio_osx_sink"); + } +#else Component comp = FindNextComponent (NULL, &desc); if (comp == NULL) { - fprintf (stderr, "FindNextComponent Error\n"); + std::cerr << "FindNextComponent Error" << std::endl; throw std::runtime_error ("audio_osx_sink::audio_osx_sink"); } +#endif +#ifndef GR_USE_OLD_AUDIO_UNIT + err = AudioComponentInstanceNew (comp, &d_OutputAU); + CheckErrorAndThrow (err, "AudioComponentInstanceNew", "audio_osx_sink::audio_osx_sink"); +#else err = OpenAComponent (comp, &d_OutputAU); CheckErrorAndThrow (err, "OpenAComponent", "audio_osx_sink::audio_osx_sink"); +#endif // Set up a callback function to generate output to the output unit @@ -167,11 +185,10 @@ audio_osx_sink::audio_osx_sink (int sample_rate, "audio_osx_sink::audio_osx_sink"); #if _OSX_AU_DEBUG_ - fprintf (stderr, "audio_osx_sink Parameters:\n"); - fprintf (stderr, " Sample Rate is %g\n", d_sample_rate); - fprintf (stderr, " Number of Channels is %ld\n", d_n_channels); - fprintf (stderr, " Max # samples to store per channel is %ld", - d_max_sample_count); + std::cerr << "audio_osx_sink Parameters:" << std::endl; + std::cerr << " Sample Rate is " << d_sample_rate << std::endl; + std::cerr << " Number of Channels is " << d_n_channels << std::endl; + std::cerr << " Max # samples to store per channel is " << d_max_sample_count << std::endl; #endif } @@ -220,7 +237,11 @@ audio_osx_sink::~audio_osx_sink () // stop and close the AudioUnit stop (); AudioUnitUninitialize (d_OutputAU); +#ifndef GR_USE_OLD_AUDIO_UNIT + AudioComponentInstanceDispose (d_OutputAU); +#else CloseComponent (d_OutputAU); +#endif // empty and delete the queues for (UInt32 n = 0; n < d_n_channels; n++) { @@ -275,8 +296,8 @@ audio_osx_sink::work (int noutput_items, #endif #if _OSX_AU_DEBUG_ - fprintf (stderr, "work1: qSC = %ld, lMC = %ld, dmSC = %ld, nOI = %d\n", - d_queueSampleCount, l_max_count, d_max_sample_count, noutput_items); + std::cerr << "work1: qSC = " << d_queueSampleCount << ", lMC = "<< l_max_count + << ", dmSC = " << d_max_sample_count << ", nOI = " << noutput_items << std::endl; #endif if (d_queueSampleCount > l_max_count) { @@ -318,7 +339,7 @@ audio_osx_sink::work (int noutput_items, if (res == -1) { // data coming in too fast // drop oldest buffer - fputs ("oX", stderr); + fputs ("aO", stderr); fflush (stderr); // set the local number of samples available to the max d_queueSampleCount = d_buffers[0]->buffer_length_items (); @@ -328,8 +349,8 @@ audio_osx_sink::work (int noutput_items, } #if _OSX_AU_DEBUG_ - fprintf (stderr, "work2: #OI = %4d, #Cnt = %4ld, mSC = %ld\n", - noutput_items, d_queueSampleCount, d_max_sample_count); + std::cerr << "work2: #OI = " << noutput_items << ", #Cnt = " + << d_queueSampleCount << ", mSC = " << d_max_sample_count << std::endl; #endif // release control to allow for other processing parts to run @@ -352,8 +373,8 @@ OSStatus audio_osx_sink::AUOutputCallback This->d_internal->lock (); #if _OSX_AU_DEBUG_ - fprintf (stderr, "cb_in: SC = %4ld, in#F = %4ld\n", - This->d_queueSampleCount, inNumberFrames); + std::cerr << "cb_in: SC = " << This->d_queueSampleCount + << ", in#F = " << inNumberFrames << std::endl; #endif if (This->d_queueSampleCount < inNumberFrames) { @@ -364,7 +385,7 @@ OSStatus audio_osx_sink::AUOutputCallback int l_counter = This->d_n_channels; while (--l_counter >= 0) { - UInt32 t_n_output_items = inNumberFrames; + size_t t_n_output_items = inNumberFrames; float* outBuffer = (float*) ioData->mBuffers[l_counter].mData; This->d_buffers[l_counter]->dequeue (outBuffer, &t_n_output_items); if (t_n_output_items != inNumberFrames) { @@ -378,7 +399,7 @@ OSStatus audio_osx_sink::AUOutputCallback } #if _OSX_AU_DEBUG_ - fprintf (stderr, "cb_out: SC = %4ld\n", This->d_queueSampleCount); + std::cerr << "cb_out: SC = " << This->d_queueSampleCount << std::endl; #endif // signal that data is available diff --git a/gr-audio-osx/src/audio_osx_source.cc b/gr-audio-osx/src/audio_osx_source.cc index e82e8ad21..61838745b 100644 --- a/gr-audio-osx/src/audio_osx_source.cc +++ b/gr-audio-osx/src/audio_osx_source.cc @@ -37,18 +37,20 @@ void PrintStreamDesc (AudioStreamBasicDescription *inDesc) { if (inDesc == NULL) { - fprintf (stderr, "PrintStreamDesc: Can't print a NULL desc!\n"); + std::cerr << "PrintStreamDesc: Can't print a NULL desc!" << std::endl; return; } - fprintf (stderr, " Sample Rate : %g\n", inDesc->mSampleRate); - fprintf (stderr, " Format ID : %4s\n", (char*)&inDesc->mFormatID); - fprintf (stderr, " Format Flags : %lX\n", inDesc->mFormatFlags); - fprintf (stderr, " Bytes per Packet : %ld\n", inDesc->mBytesPerPacket); - fprintf (stderr, " Frames per Packet : %ld\n", inDesc->mFramesPerPacket); - fprintf (stderr, " Bytes per Frame : %ld\n", inDesc->mBytesPerFrame); - fprintf (stderr, " Channels per Frame : %ld\n", inDesc->mChannelsPerFrame); - fprintf (stderr, " Bits per Channel : %ld\n", inDesc->mBitsPerChannel); + std::cerr << " Sample Rate : " << inDesc->mSampleRate << std::endl; + char format_id[4]; + strncpy (format_id, (char*)(&inDesc->mFormatID), 4); + std::cerr << " Format ID : " << format_id << std::endl; + std::cerr << " Format Flags : " << inDesc->mFormatFlags << std::endl; + std::cerr << " Bytes per Packet : " << inDesc->mBytesPerPacket << std::endl; + std::cerr << " Frames per Packet : " << inDesc->mFramesPerPacket << std::endl; + std::cerr << " Bytes per Frame : " << inDesc->mBytesPerFrame << std::endl; + std::cerr << " Channels per Frame : " << inDesc->mChannelsPerFrame << std::endl; + std::cerr << " Bits per Channel : " << inDesc->mBitsPerChannel << std::endl; } // FIXME these should query some kind of user preference @@ -79,19 +81,19 @@ audio_osx_source::audio_osx_source (int sample_rate, d_AudioConverter (0) { if (sample_rate <= 0) { - fprintf (stderr, "Invalid Sample Rate: %d\n", sample_rate); + std::cerr << "Invalid Sample Rate: " << sample_rate << std::endl; throw std::invalid_argument ("audio_osx_source::audio_osx_source"); } else d_outputSampleRate = (Float64) sample_rate; if (channel_config <= 0 & channel_config != -1) { - fprintf (stderr, "Invalid Channel Config: %d\n", channel_config); + std::cerr << "Invalid Channel Config: " << channel_config << std::endl; throw std::invalid_argument ("audio_osx_source::audio_osx_source"); } else if (channel_config == -1) { // no user input; try "device name" instead int l_n_channels = (int) strtol (device_name.data(), (char **)NULL, 10); if (l_n_channels == 0 & errno) { - fprintf (stderr, "Error Converting Device Name: %d\n", errno); + std::cerr << "Error Converting Device Name: " << errno << std::endl; throw std::invalid_argument ("audio_osx_source::audio_osx_source"); } if (l_n_channels <= 0) @@ -107,14 +109,14 @@ audio_osx_source::audio_osx_source (int sample_rate, if (max_sample_count == -1) max_sample_count = sample_rate; else if (max_sample_count <= 0) { - fprintf (stderr, "Invalid Max Sample Count: %d\n", max_sample_count); + std::cerr << "Invalid Max Sample Count: " << max_sample_count << std::endl; throw std::invalid_argument ("audio_osx_source::audio_osx_source"); } d_max_sample_count = max_sample_count; #if _OSX_AU_DEBUG_ - fprintf (stderr, "source(): max # samples = %ld\n", d_max_sample_count); + std::cerr << "source(): max # samples = " << d_max_sample_count << std::endl; #endif OSStatus err = noErr; @@ -122,7 +124,12 @@ audio_osx_source::audio_osx_source (int sample_rate, // create the default AudioUnit for input // Open the default input unit +#ifndef GR_USE_OLD_AUDIO_UNIT + AudioComponentDescription InputDesc; +#else ComponentDescription InputDesc; +#endif + InputDesc.componentType = kAudioUnitType_Output; InputDesc.componentSubType = kAudioUnitSubType_HALOutput; @@ -130,15 +137,31 @@ audio_osx_source::audio_osx_source (int sample_rate, InputDesc.componentFlags = 0; InputDesc.componentFlagsMask = 0; +#ifndef GR_USE_OLD_AUDIO_UNIT + AudioComponent comp = AudioComponentFindNext (NULL, &InputDesc); +#else Component comp = FindNextComponent (NULL, &InputDesc); +#endif + if (comp == NULL) { - fprintf (stderr, "FindNextComponent Error\n"); +#ifndef GR_USE_OLD_AUDIO_UNIT + std::cerr << "AudioComponentFindNext Error" << std::endl; +#else + std::cerr << "FindNextComponent Error" << std::endl; +#endif throw std::runtime_error ("audio_osx_source::audio_osx_source"); } +#ifndef GR_USE_OLD_AUDIO_UNIT + err = AudioComponentInstanceNew (comp, &d_InputAU); + CheckErrorAndThrow (err, "AudioComponentInstanceNew", + "audio_osx_source::audio_osx_source"); +#else err = OpenAComponent (comp, &d_InputAU); CheckErrorAndThrow (err, "OpenAComponent", "audio_osx_source::audio_osx_source"); +#endif + UInt32 enableIO; @@ -208,7 +231,7 @@ audio_osx_source::audio_osx_source (int sample_rate, CheckErrorAndThrow (err, "AudioUnitGetProperty HasIO", "audio_osx_source::audio_osx_source"); if (hasInput == 0) { - fprintf (stderr, "Selected Audio Device does not support Input.\n"); + std::cerr << "Selected Audio Device does not support Input." << std::endl; throw std::runtime_error ("audio_osx_source::audio_osx_source"); } @@ -248,7 +271,7 @@ audio_osx_source::audio_osx_source (int sample_rate, "audio_osx_source::audio_osx_source"); #if _OSX_AU_DEBUG_ - fprintf (stderr, "\n---- Device Stream Format ----\n" ); + std::cerr << std::endl << "---- Device Stream Format ----" << std::endl; PrintStreamDesc (&asbd_device); #endif @@ -264,7 +287,7 @@ audio_osx_source::audio_osx_source (int sample_rate, "audio_osx_source::audio_osx_source"); #if _OSX_AU_DEBUG_ - fprintf (stderr, "\n---- Client Stream Format ----\n"); + std::cerr << std::endl << "---- Client Stream Format ----" << std::endl; PrintStreamDesc (&asbd_client); #endif @@ -436,22 +459,17 @@ audio_osx_source::audio_osx_source (int sample_rate, "audio_osx_source::audio_osx_source"); #if _OSX_AU_DEBUG_ - fprintf (stderr, "audio_osx_source Parameters:\n"); - fprintf (stderr, " Device Sample Rate is %g\n", d_deviceSampleRate); - fprintf (stderr, " User Sample Rate is %g\n", d_outputSampleRate); - fprintf (stderr, " Max Sample Count is %ld\n", d_max_sample_count); - fprintf (stderr, " # Device Channels is %ld\n", d_n_deviceChannels); - fprintf (stderr, " # Max Channels is %ld\n", d_n_max_channels); - fprintf (stderr, " Device Buffer Size is Frames = %ld\n", - d_deviceBufferSizeFrames); - fprintf (stderr, " Lead Size is Frames = %ld\n", - d_leadSizeFrames); - fprintf (stderr, " Trail Size is Frames = %ld\n", - d_trailSizeFrames); - fprintf (stderr, " Input Buffer Size is Frames = %ld\n", - d_inputBufferSizeFrames); - fprintf (stderr, " Output Buffer Size is Frames = %ld\n", - d_outputBufferSizeFrames); + std::cerr << "audio_osx_source Parameters:" << std::endl; + std::cerr << " Device Sample Rate is " << d_deviceSampleRate << std::endl; + std::cerr << " User Sample Rate is " << d_outputSampleRate << std::endl; + std::cerr << " Max Sample Count is " << d_max_sample_count << std::endl; + std::cerr << " # Device Channels is " << d_n_deviceChannels << std::endl; + std::cerr << " # Max Channels is " << d_n_max_channels << std::endl; + std::cerr << " Device Buffer Size is Frames = " << d_deviceBufferSizeFrames << std::endl; + std::cerr << " Lead Size is Frames = " << d_leadSizeFrames << std::endl; + std::cerr << " Trail Size is Frames = " << d_trailSizeFrames << std::endl; + std::cerr << " Input Buffer Size is Frames = " << d_inputBufferSizeFrames << std::endl; + std::cerr << " Output Buffer Size is Frames = " << d_outputBufferSizeFrames << std::endl; #endif } @@ -564,8 +582,13 @@ audio_osx_source::~audio_osx_source () err = AudioUnitUninitialize (d_InputAU); CheckError (err, "~audio_osx_source: AudioUnitUninitialize"); +#ifndef GR_USE_OLD_AUDIO_UNIT + err = AudioComponentInstanceDispose (d_InputAU); + CheckError (err, "~audio_osx_source: AudioComponentInstanceDispose"); +#else err = CloseComponent (d_InputAU); CheckError (err, "~audio_osx_source: CloseComponent"); +#endif // empty and delete the queues for (UInt32 n = 0; n < d_n_max_channels; n++) { @@ -598,18 +621,18 @@ audio_osx_source::check_topology (int ninputs, int noutputs) { // check # inputs to make sure it's valid if (ninputs != 0) { - fprintf (stderr, "audio_osx_source::check_topology(): " - "number of input streams provided (%d) should be 0.\n", - ninputs); + std::cerr << "audio_osx_source::check_topology(): number of input " + << "streams provided (" << ninputs + << ") should be 0." << std::endl; throw std::runtime_error ("audio_osx_source::check_topology()"); } // check # outputs to make sure it's valid if ((noutputs < 1) | (noutputs > (int) d_n_max_channels)) { - fprintf (stderr, "audio_osx_source::check_topology(): " - "number of output streams provided (%d) should be in " - "[1,%ld] for the selected audio device.\n", - noutputs, d_n_max_channels); + std::cerr << "audio_osx_source::check_topology(): number of output " + << "streams provided (" << noutputs << ") should be in [1," + << d_n_max_channels << "] for the selected audio device." + << std::endl; throw std::runtime_error ("audio_osx_source::check_topology()"); } @@ -617,8 +640,8 @@ audio_osx_source::check_topology (int ninputs, int noutputs) d_n_user_channels = noutputs; #if _OSX_AU_DEBUG_ - fprintf (stderr, "chk_topo: Actual # user output channels = %d\n", - noutputs); + std::cerr << "chk_topo: Actual # user output channels = " + << noutputs << std::endl; #endif return (true); @@ -634,8 +657,9 @@ audio_osx_source::work d_internal->lock (); #if _OSX_AU_DEBUG_ - fprintf (stderr, "work1: SC = %4ld, #OI = %4d, #Chan = %ld\n", - d_queueSampleCount, noutput_items, output_items.size()); + std::cerr << "work1: SC = " << d_queueSampleCount + << ", #OI = " << noutput_items + << ", #Chan = " << output_items.size() << std::endl; #endif // set the actual # of output items to the 'desired' amount then @@ -675,14 +699,14 @@ audio_osx_source::work // verify that the number copied out is as expected. while (--l_counter >= 0) { - UInt32 t_n_output_items = actual_noutput_items; + size_t t_n_output_items = actual_noutput_items; d_buffers[l_counter]->dequeue ((float*) output_items[l_counter], &t_n_output_items); if (t_n_output_items != actual_noutput_items) { - fprintf (stderr, "audio_osx_source::work(): " - "number of available items changing " - "unexpectedly; expecting %ld, got %ld.\n", - actual_noutput_items, t_n_output_items); + std::cerr << "audio_osx_source::work(): ERROR: number of " + << "available items changing unexpectedly; expecting " + << actual_noutput_items << ", got " + << t_n_output_items << "." << std::endl; throw std::runtime_error ("audio_osx_source::work()"); } } @@ -693,8 +717,8 @@ audio_osx_source::work d_queueSampleCount -= actual_noutput_items; #if _OSX_AU_DEBUG_ - fprintf (stderr, "work2: SC = %4ld, act#OI = %4ld\n", - d_queueSampleCount, actual_noutput_items); + std::cerr << "work2: SC = " << d_queueSampleCount + << ", act#OI = " << actual_noutput_items << std::endl; #endif // release control to allow for other processing parts to run @@ -702,7 +726,7 @@ audio_osx_source::work d_internal->unlock (); #if _OSX_AU_DEBUG_ - fprintf (stderr, "work3: Returning.\n"); + std::cerr << "work3: Returning." << std::endl; #endif return (actual_noutput_items); @@ -728,8 +752,9 @@ audio_osx_source::ConverterCallback This->d_n_ActualInputFrames = (*ioNumberDataPackets); #if _OSX_AU_DEBUG_ - fprintf (stderr, "cc1: io#DP = %ld, TIBSB = %ld, #C = %d\n", - *ioNumberDataPackets, totalInputBufferSizeBytes, counter); + std::cerr << "cc1: io#DP = " << (*ioNumberDataPackets) + << ", TIBSB = " << totalInputBufferSizeBytes + << ", #C = " << counter << std::endl; #endif while (--counter >= 0) { @@ -740,7 +765,7 @@ audio_osx_source::ConverterCallback } #if _OSX_AU_DEBUG_ - fprintf (stderr, "cc2: Returning.\n"); + std::cerr << "cc2: Returning." << std::endl; #endif return (noErr); @@ -760,8 +785,9 @@ audio_osx_source::AUInputCallback (void* inRefCon, This->d_internal->lock (); #if _OSX_AU_DEBUG_ - fprintf (stderr, "cb0: in#F = %4ld, inBN = %ld, SC = %4ld\n", - inNumberFrames, inBusNumber, This->d_queueSampleCount); + std::cerr << "cb0: in#F = " << inNumberFrames + << ", inBN = " << inBusNumber + << ", SC = " << This->d_queueSampleCount << std::endl; #endif // Get the new audio data from the input device @@ -821,8 +847,8 @@ audio_osx_source::AUInputCallback (void* inRefCon, #endif #if _OSX_AU_DEBUG_ - fprintf (stderr, "cb1: avail: #IF = %ld, #OF = %ld\n", - AvailableInputFrames, AvailableOutputFrames); + std::cerr << "cb1: avail: #IF = " << AvailableInputFrames + << ", #OF = " << AvailableOutputFrames << std::endl; #endif ActualOutputFrames = AvailableOutputFrames; @@ -841,11 +867,11 @@ audio_osx_source::AUInputCallback (void* inRefCon, // on output, ActualOutputFrames is the actual number of output frames #if _OSX_AU_DEBUG_ - fprintf (stderr, "cb2: actual: #IF = %ld, #OF = %ld\n", - This->d_n_ActualInputFrames, AvailableOutputFrames); + std::cerr << "cb2: actual: #IF = " << This->d_n_ActualInputFrames + << ", #OF = " << AvailableOutputFrames << std::endl; if (This->d_n_ActualInputFrames != AvailableInputFrames) - fprintf (stderr, "cb2.1: avail#IF = %ld, actual#IF = %ld\n", - AvailableInputFrames, This->d_n_ActualInputFrames); + std::cerr << "cb2.1: avail#IF = " << AvailableInputFrames + << ", actual#IF = " << This->d_n_ActualInputFrames << std::endl; #endif } @@ -858,7 +884,7 @@ audio_osx_source::AUInputCallback (void* inRefCon, float* inBuffer = (float*) This->d_OutputBuffer->mBuffers[l_counter].mData; #if _OSX_AU_DEBUG_ - fprintf (stderr, "cb3: enqueuing audio data.\n"); + std::cerr << "cb3: enqueuing audio data." << std::endl; #endif int l_res = This->d_buffers[l_counter]->enqueue (inBuffer, ActualOutputFrames); @@ -879,23 +905,23 @@ audio_osx_source::AUInputCallback (void* inRefCon, } #if _OSX_AU_DEBUG_ - fprintf (stderr, "cb4: #OI = %4ld, #Cnt = %4ld, mSC = %ld, \n", - ActualOutputFrames, This->d_queueSampleCount, - This->d_max_sample_count); + std::cerr << "cb4: #OI = " << ActualOutputFrames + << ", #Cnt = " << This->d_queueSampleCount + << ", mSC = " << This->d_max_sample_count << std::endl; #endif // signal that data is available, if appropraite This->d_cond_data->signal (); #if _OSX_AU_DEBUG_ - fprintf (stderr, "cb5: releasing internal mutex.\n"); + std::cerr << "cb5: releasing internal mutex." << std::endl; #endif // release control to allow for other processing parts to run This->d_internal->unlock (); #if _OSX_AU_DEBUG_ - fprintf (stderr, "cb6: returning.\n"); + std::cerr << "cb6: returning." << std::endl; #endif return (err); @@ -930,7 +956,7 @@ audio_osx_source::HardwareListener OSStatus err = noErr; audio_osx_source* This = static_cast<audio_osx_source*>(inClientData); - fprintf (stderr, "a_o_s::HardwareListener\n"); + std::cerr << "a_o_s::HardwareListener" << std::endl; // set the new default hardware input device for use by our AU @@ -957,7 +983,7 @@ audio_osx_source::UnitListener audio_osx_source* This = static_cast<audio_osx_source*>(inRefCon); AudioStreamBasicDescription asbd; - fprintf (stderr, "a_o_s::UnitListener\n"); + std::cerr << "a_o_s::UnitListener" << std::endl; // get the converter's input ASBD (for printing) @@ -970,8 +996,8 @@ audio_osx_source::UnitListener "CurrentInputStreamDescription", "audio_osx_source::UnitListener"); - fprintf (stderr, "UnitListener: Input Source changed.\n" - "Old Source Output Info:\n"); + std::cerr << "UnitListener: Input Source changed." << std::endl + << "Old Source Output Info:" << std::endl; PrintStreamDesc (&asbd); // get the new input unit's output ASBD @@ -984,7 +1010,7 @@ audio_osx_source::UnitListener CheckErrorAndThrow (err, "AudioUnitGetProperty StreamFormat", "audio_osx_source::UnitListener"); - fprintf (stderr, "New Source Output Info:\n"); + std::cerr << "New Source Output Info:" << std::endl; PrintStreamDesc (&asbd); // set the converter's input ASBD to this diff --git a/gr-audio-osx/src/circular_buffer.h b/gr-audio-osx/src/circular_buffer.h index fa451d607..6d491fb6f 100644 --- a/gr-audio-osx/src/circular_buffer.h +++ b/gr-audio-osx/src/circular_buffer.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2006 Free Software Foundation, Inc. + * Copyright 2006,2009 Free Software Foundation, Inc. * * This file is part of GNU Radio. * @@ -24,9 +24,12 @@ #define _CIRCULAR_BUFFER_H_ #include "mld_threads.h" +#include <iostream> #include <stdexcept> +#ifndef DO_DEBUG #define DO_DEBUG 0 +#endif #if DO_DEBUG #define DEBUG(X) do{X} while(0); @@ -41,8 +44,8 @@ private: T* d_buffer; // the following are in Items (type T) - UInt32 d_bufLen_I, d_readNdx_I, d_writeNdx_I; - UInt32 d_n_avail_write_I, d_n_avail_read_I; + size_t d_bufLen_I, d_readNdx_I, d_writeNdx_I; + size_t d_n_avail_write_I, d_n_avail_read_I; // stuff to control access to class internals mld_mutex_ptr d_internal; @@ -67,7 +70,7 @@ private: }; public: - circular_buffer (UInt32 bufLen_I, + circular_buffer (size_t bufLen_I, bool doWriteBlock = true, bool doFullRead = false) { if (bufLen_I == 0) throw std::runtime_error ("circular_buffer(): " @@ -79,10 +82,10 @@ public: d_internal = NULL; d_readBlock = d_writeBlock = NULL; reset (); - DEBUG (fprintf (stderr, "c_b(): buf len (items) = %ld, " - "doWriteBlock = %s, doFullRead = %s\n", d_bufLen_I, - (d_doWriteBlock ? "true" : "false"), - (d_doFullRead ? "true" : "false"))); + DEBUG (std::cerr << "c_b(): buf len (items) = " << d_bufLen_ + << ", doWriteBlock = " << (d_doWriteBlock ? "true" : "false") + << ", doFullRead = " << (d_doFullRead ? "true" : "false") + << std::endl); }; ~circular_buffer () { @@ -90,21 +93,21 @@ public: delete [] d_buffer; }; - inline UInt32 n_avail_write_items () { + inline size_t n_avail_write_items () { d_internal->lock (); - UInt32 retVal = d_n_avail_write_I; + size_t retVal = d_n_avail_write_I; d_internal->unlock (); return (retVal); }; - inline UInt32 n_avail_read_items () { + inline size_t n_avail_read_items () { d_internal->lock (); - UInt32 retVal = d_n_avail_read_I; + size_t retVal = d_n_avail_read_I; d_internal->unlock (); return (retVal); }; - inline UInt32 buffer_length_items () {return (d_bufLen_I);}; + inline size_t buffer_length_items () {return (d_bufLen_I);}; inline bool do_write_block () {return (d_doWriteBlock);}; inline bool do_full_read () {return (d_doFullRead);}; @@ -147,14 +150,15 @@ public: * buffer length is larger than the instantiated buffer length */ - int enqueue (T* buf, UInt32 bufLen_I) { - DEBUG (fprintf (stderr, "enqueue: buf = %X, bufLen = %ld, #av_wr = %ld, " - "#av_rd = %ld.\n", (unsigned int)buf, bufLen_I, - d_n_avail_write_I, d_n_avail_read_I)); + int enqueue (T* buf, size_t bufLen_I) { + DEBUG (std::cerr << "enqueue: buf = " << (void*) buf + << ", bufLen = " << bufLen_I + << ", #av_wr = " << d_n_avail_write_I + << ", #av_rd = " << d_n_avail_read_I << std::endl); if (bufLen_I > d_bufLen_I) { - fprintf (stderr, "cannot add buffer longer (%ld" - ") than instantiated length (%ld" - ").\n", bufLen_I, d_bufLen_I); + std::cerr << "ERROR: cannot add buffer longer (" + << bufLen_I << ") than instantiated length (" + << d_bufLen_I << ")." << std::endl; throw std::runtime_error ("circular_buffer::enqueue()"); } @@ -173,25 +177,25 @@ public: if (bufLen_I > d_n_avail_write_I) { if (d_doWriteBlock) { while (bufLen_I > d_n_avail_write_I) { - DEBUG (fprintf (stderr, "enqueue: #len > #a, waiting.\n")); + DEBUG (std::cerr << "enqueue: #len > #a, waiting." << std::endl); // wait will automatically unlock() the internal mutex d_writeBlock->wait (); // and lock() it here. if (d_doAbort) { d_internal->unlock (); - DEBUG (fprintf (stderr, "enqueue: #len > #a, aborting.\n")); + DEBUG (std::cerr << "enqueue: #len > #a, aborting." << std::endl); return (2); } - DEBUG (fprintf (stderr, "enqueue: #len > #a, done waiting.\n")); + DEBUG (std::cerr << "enqueue: #len > #a, done waiting." << std::endl); } } else { d_n_avail_read_I = d_bufLen_I - bufLen_I; d_n_avail_write_I = bufLen_I; - DEBUG (fprintf (stderr, "circular_buffer::enqueue: overflow\n")); + DEBUG (std::cerr << "circular_buffer::enqueue: overflow" << std::endl); retval = -1; } } - UInt32 n_now_I = d_bufLen_I - d_writeNdx_I, n_start_I = 0; + size_t n_now_I = d_bufLen_I - d_writeNdx_I, n_start_I = 0; if (n_now_I > bufLen_I) n_now_I = bufLen_I; else if (n_now_I < bufLen_I) @@ -230,23 +234,24 @@ public: * buffer length is larger than the instantiated buffer length */ - int dequeue (T* buf, UInt32* bufLen_I) { - DEBUG (fprintf (stderr, "dequeue: buf = %X, *bufLen = %ld, #av_wr = %ld, " - "#av_rd = %ld.\n", (unsigned int)buf, *bufLen_I, - d_n_avail_write_I, d_n_avail_read_I)); + int dequeue (T* buf, size_t* bufLen_I) { + DEBUG (std::cerr << "dequeue: buf = " << ((void*) buf) + << ", *bufLen = " << (*bufLen_I) + << ", #av_wr = " << d_n_avail_write_I + << ", #av_rd = " << d_n_avail_read_I << std::endl); if (!bufLen_I) throw std::runtime_error ("circular_buffer::dequeue(): " "input bufLen pointer is NULL.\n"); if (!buf) throw std::runtime_error ("circular_buffer::dequeue(): " "input buffer pointer is NULL.\n"); - UInt32 l_bufLen_I = *bufLen_I; + size_t l_bufLen_I = *bufLen_I; if (l_bufLen_I == 0) return (0); if (l_bufLen_I > d_bufLen_I) { - fprintf (stderr, "cannot remove buffer longer (%ld" - ") than instantiated length (%ld" - ").\n", l_bufLen_I, d_bufLen_I); + std::cerr << "ERROR: cannot remove buffer longer (" + << l_bufLen_I << ") than instantiated length (" + << d_bufLen_I << ")." << std::endl; throw std::runtime_error ("circular_buffer::dequeue()"); } @@ -257,34 +262,34 @@ public: } if (d_doFullRead) { while (d_n_avail_read_I < l_bufLen_I) { - DEBUG (fprintf (stderr, "dequeue: #a < #len, waiting.\n")); + DEBUG (std::cerr << "dequeue: #a < #len, waiting." << std::endl); // wait will automatically unlock() the internal mutex d_readBlock->wait (); // and lock() it here. if (d_doAbort) { d_internal->unlock (); - DEBUG (fprintf (stderr, "dequeue: #a < #len, aborting.\n")); + DEBUG (std::cerr << "dequeue: #a < #len, aborting." << std::endl); return (2); } - DEBUG (fprintf (stderr, "dequeue: #a < #len, done waiting.\n")); + DEBUG (std::cerr << "dequeue: #a < #len, done waiting." << std::endl); } } else { while (d_n_avail_read_I == 0) { - DEBUG (fprintf (stderr, "dequeue: #a == 0, waiting.\n")); + DEBUG (std::cerr << "dequeue: #a == 0, waiting." << std::endl); // wait will automatically unlock() the internal mutex d_readBlock->wait (); // and lock() it here. if (d_doAbort) { d_internal->unlock (); - DEBUG (fprintf (stderr, "dequeue: #a == 0, aborting.\n")); + DEBUG (std::cerr << "dequeue: #a == 0, aborting." << std::endl); return (2); } - DEBUG (fprintf (stderr, "dequeue: #a == 0, done waiting.\n")); + DEBUG (std::cerr << "dequeue: #a == 0, done waiting." << std::endl); } } if (l_bufLen_I > d_n_avail_read_I) l_bufLen_I = d_n_avail_read_I; - UInt32 n_now_I = d_bufLen_I - d_readNdx_I, n_start_I = 0; + size_t n_now_I = d_bufLen_I - d_readNdx_I, n_start_I = 0; if (n_now_I > l_bufLen_I) n_now_I = l_bufLen_I; else if (n_now_I < l_bufLen_I) diff --git a/gr-noaa/apps/demod_hrpt_file.grc b/gr-noaa/apps/demod_hrpt_file.grc index 16f83f780..7a0bbe892 100644 --- a/gr-noaa/apps/demod_hrpt_file.grc +++ b/gr-noaa/apps/demod_hrpt_file.grc @@ -1,57 +1,6 @@ <?xml version='1.0' encoding='ASCII'?> <flow_graph> - <timestamp>Sun Sep 27 09:51:42 2009</timestamp> - <block> - <key>options</key> - <param> - <key>id</key> - <value>demod_hrpt_file</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>title</key> - <value>USRP HRPT Receiver</value> - </param> - <param> - <key>author</key> - <value></value> - </param> - <param> - <key>description</key> - <value></value> - </param> - <param> - <key>window_size</key> - <value>4096,4096</value> - </param> - <param> - <key>generate_options</key> - <value>no_gui</value> - </param> - <param> - <key>category</key> - <value>Custom</value> - </param> - <param> - <key>run</key> - <value>True</value> - </param> - <param> - <key>realtime_scheduling</key> - <value></value> - </param> - <param> - <key>_coordinate</key> - <value>(10, 10)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> + <timestamp>Sun Oct 4 08:40:03 2009</timestamp> <block> <key>variable</key> <param> @@ -191,29 +140,6 @@ </param> </block> <block> - <key>import</key> - <param> - <key>id</key> - <value>import_0</value> - </param> - <param> - <key>_enabled</key> - <value>True</value> - </param> - <param> - <key>import</key> - <value>import math</value> - </param> - <param> - <key>_coordinate</key> - <value>(9, 92)</value> - </param> - <param> - <key>_rotation</key> - <value>0</value> - </param> - </block> - <block> <key>parameter</key> <param> <key>id</key> @@ -731,6 +657,84 @@ <value>0</value> </param> </block> + <block> + <key>import</key> + <param> + <key>id</key> + <value>import_0</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>import</key> + <value>import math</value> + </param> + <param> + <key>_coordinate</key> + <value>(11, 111)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> + <block> + <key>options</key> + <param> + <key>id</key> + <value>demod_hrpt_file</value> + </param> + <param> + <key>_enabled</key> + <value>True</value> + </param> + <param> + <key>title</key> + <value>USRP HRPT Receiver</value> + </param> + <param> + <key>author</key> + <value></value> + </param> + <param> + <key>description</key> + <value></value> + </param> + <param> + <key>window_size</key> + <value>4096,4096</value> + </param> + <param> + <key>generate_options</key> + <value>no_gui</value> + </param> + <param> + <key>category</key> + <value>Custom</value> + </param> + <param> + <key>run_options</key> + <value>run</value> + </param> + <param> + <key>run</key> + <value>True</value> + </param> + <param> + <key>realtime_scheduling</key> + <value></value> + </param> + <param> + <key>_coordinate</key> + <value>(10, 10)</value> + </param> + <param> + <key>_rotation</key> + <value>0</value> + </param> + </block> <connection> <source_block_id>deframer</source_block_id> <sink_block_id>file_sink</sink_block_id> diff --git a/gr-noaa/apps/demod_hrpt_file.py b/gr-noaa/apps/demod_hrpt_file.py index 309a79209..d55351868 100755 --- a/gr-noaa/apps/demod_hrpt_file.py +++ b/gr-noaa/apps/demod_hrpt_file.py @@ -2,7 +2,7 @@ ################################################## # Gnuradio Python Flow Graph # Title: USRP HRPT Receiver -# Generated: Sun Sep 27 09:34:15 2009 +# Generated: Sun Oct 4 08:40:03 2009 ################################################## from gnuradio import eng_notation @@ -129,7 +129,5 @@ if __name__ == '__main__': help="Set sync_alpha [default=%default]") (options, args) = parser.parse_args() tb = demod_hrpt_file(filename=options.filename, output=options.output, decim=options.decim, pll_alpha=options.pll_alpha, sync_alpha=options.sync_alpha) - tb.start() - raw_input('Press Enter to quit: ') - tb.stop() + tb.run() diff --git a/gr-noaa/lib/noaa_hrpt_sync_fb.cc b/gr-noaa/lib/noaa_hrpt_sync_fb.cc index f99947f82..9c655b0d9 100644 --- a/gr-noaa/lib/noaa_hrpt_sync_fb.cc +++ b/gr-noaa/lib/noaa_hrpt_sync_fb.cc @@ -67,11 +67,16 @@ noaa_hrpt_sync_fb::general_work(int noutput_items, // Train on zero crossings in center region of symbol if (sign != d_last_sign) { - if (d_phase > 0.25 && d_phase < 0.75) { - float phase_err = d_phase-0.5; - d_phase -= phase_err*d_alpha; // 1st order phase adjustment - d_freq -= phase_err*d_beta; // 2nd order frequency adjustment - } + float phase_err = 0.0; + if (d_phase > 0.25 && d_phase < 0.75) + phase_err = d_phase-0.5; + else if (d_phase >= 0.75) + phase_err = d_phase - 1.0; + else + phase_err = d_phase; + + d_phase -= phase_err*d_alpha; // 1st order phase adjustment + d_freq -= phase_err*d_beta; // 2nd order frequency adjustment d_last_sign = sign; } diff --git a/gr-qtgui/src/lib/Makefile.am b/gr-qtgui/src/lib/Makefile.am index b6c8f3f4d..6c90c31f0 100644 --- a/gr-qtgui/src/lib/Makefile.am +++ b/gr-qtgui/src/lib/Makefile.am @@ -26,7 +26,6 @@ AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) \ # Only include these files in the build if qtgui passes configure checks # This is mostly to help make distcheck pass -if BUILD_QT QMAKE_SOURCES = \ spectrumdisplayform_moc.cc \ FrequencyDisplayPlot_moc.cc \ @@ -35,7 +34,6 @@ QMAKE_SOURCES = \ Waterfall3DDisplayPlot_moc.cc \ ConstellationDisplayPlot_moc.cc \ spectrumdisplayform_ui.h -endif EXTRA_DIST = spectrumdisplayform.ui @@ -77,19 +75,11 @@ grinclude_HEADERS = \ qtgui_sink_c.h \ qtgui_sink_f.h -if BUILD_QT %_moc.cc : %.h $(QT_MOC_EXEC) -DQT_SHARED -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -p $(srcdir) $< -o $@ %_ui.h : %.ui $(QT_UIC_EXEC) $< -o $@ -else -%_moc.cc : %.h - touch $@ - -%_ui.h : %.ui - touch $@ -endif # magic flags libgnuradio_qtgui_la_LDFLAGS = $(NO_UNDEFINED) -version-info 0:0:0 diff --git a/gr-qtgui/src/lib/spectrumdisplayform.ui b/gr-qtgui/src/lib/spectrumdisplayform.ui index 1458488a0..cb7b4f996 100644 --- a/gr-qtgui/src/lib/spectrumdisplayform.ui +++ b/gr-qtgui/src/lib/spectrumdisplayform.ui @@ -1,157 +1,158 @@ -<ui version="4.0" > +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> <class>SpectrumDisplayForm</class> - <widget class="QWidget" name="SpectrumDisplayForm" > - <property name="geometry" > + <widget class="QWidget" name="SpectrumDisplayForm"> + <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>657</width> - <height>536</height> + <height>543</height> </rect> </property> - <property name="windowTitle" > + <property name="windowTitle"> <string>Spectrum Display</string> </property> - <layout class="QGridLayout" name="gridLayout" > - <item row="1" column="3" > - <widget class="QComboBox" name="FFTSizeComboBox" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Fixed" hsizetype="Fixed" > + <layout class="QGridLayout" name="gridLayout"> + <item row="1" column="3"> + <widget class="QComboBox" name="FFTSizeComboBox"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="maximumSize" > + <property name="maximumSize"> <size> <width>120</width> <height>16777215</height> </size> </property> <item> - <property name="text" > + <property name="text"> <string>1024</string> </property> </item> <item> - <property name="text" > + <property name="text"> <string>2048</string> </property> </item> <item> - <property name="text" > + <property name="text"> <string>4096</string> </property> </item> <item> - <property name="text" > + <property name="text"> <string>8192</string> </property> </item> <item> - <property name="text" > + <property name="text"> <string>16384</string> </property> </item> <item> - <property name="text" > + <property name="text"> <string>32768</string> </property> </item> </widget> </item> - <item row="1" column="2" > - <widget class="QLabel" name="FFTSizeLabel" > - <property name="text" > + <item row="1" column="2"> + <widget class="QLabel" name="FFTSizeLabel"> + <property name="text"> <string>FFT Size:</string> </property> - <property name="alignment" > + <property name="alignment"> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> </property> - <property name="wordWrap" > + <property name="wordWrap"> <bool>false</bool> </property> </widget> </item> - <item row="1" column="0" > - <widget class="QCheckBox" name="UseRFFrequenciesCheckBox" > - <property name="text" > + <item row="1" column="0"> + <widget class="QCheckBox" name="UseRFFrequenciesCheckBox"> + <property name="text"> <string>Display RF Frequencies</string> </property> </widget> </item> - <item row="3" column="0" > - <layout class="QHBoxLayout" name="horizontalLayout" > + <item row="3" column="0"> + <layout class="QHBoxLayout" name="horizontalLayout"> <item> - <widget class="QLabel" name="WindowLbl" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Fixed" hsizetype="Fixed" > + <widget class="QLabel" name="WindowLbl"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="text" > + <property name="text"> <string>Window:</string> </property> - <property name="alignment" > + <property name="alignment"> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> </property> - <property name="wordWrap" > + <property name="wordWrap"> <bool>false</bool> </property> </widget> </item> <item> - <widget class="QComboBox" name="WindowComboBox" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Fixed" hsizetype="Fixed" > + <widget class="QComboBox" name="WindowComboBox"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="minimumSize" > + <property name="minimumSize"> <size> <width>120</width> <height>0</height> </size> </property> - <property name="maximumSize" > + <property name="maximumSize"> <size> <width>120</width> <height>16777215</height> </size> </property> - <property name="font" > + <property name="font"> <font> <pointsize>9</pointsize> </font> </property> <item> - <property name="text" > + <property name="text"> <string>Hamming</string> </property> </item> <item> - <property name="text" > + <property name="text"> <string>Hann</string> </property> </item> <item> - <property name="text" > + <property name="text"> <string>Blackman</string> </property> </item> <item> - <property name="text" > + <property name="text"> <string>Rectangular</string> </property> </item> <item> - <property name="text" > + <property name="text"> <string>Kaiser</string> </property> </item> <item> - <property name="text" > + <property name="text"> <string>Blackman-harris</string> </property> </item> @@ -159,180 +160,180 @@ </item> </layout> </item> - <item row="0" column="0" colspan="4" > - <widget class="QTabWidget" name="SpectrumTypeTab" > - <property name="currentIndex" > + <item row="0" column="0" colspan="4"> + <widget class="QTabWidget" name="SpectrumTypeTab"> + <property name="currentIndex"> <number>0</number> </property> - <widget class="QWidget" name="FrequencyPage" > - <attribute name="title" > + <widget class="QWidget" name="FrequencyPage"> + <attribute name="title"> <string>Frequency Display</string> </attribute> - <layout class="QVBoxLayout" name="verticalLayout" > + <layout class="QVBoxLayout" name="verticalLayout"> <item> - <layout class="QVBoxLayout" name="verticalLayout_2" > + <layout class="QVBoxLayout" name="verticalLayout_2"> <item> - <widget class="QFrame" name="FrequencyPlotDisplayFrame" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Preferred" hsizetype="Preferred" > + <widget class="QFrame" name="FrequencyPlotDisplayFrame"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="minimumSize" > + <property name="minimumSize"> <size> - <width>615</width> + <width>400</width> <height>332</height> </size> </property> - <property name="sizeIncrement" > + <property name="sizeIncrement"> <size> <width>1</width> <height>1</height> </size> </property> - <property name="frameShape" > + <property name="frameShape"> <enum>QFrame::NoFrame</enum> </property> - <property name="frameShadow" > + <property name="frameShadow"> <enum>QFrame::Plain</enum> </property> </widget> </item> <item> - <layout class="QGridLayout" name="gridLayout_2" > - <item row="1" column="0" > - <widget class="QCheckBox" name="MaxHoldCheckBox" > - <property name="text" > + <layout class="QGridLayout" name="gridLayout_2"> + <item row="1" column="0"> + <widget class="QCheckBox" name="MaxHoldCheckBox"> + <property name="text"> <string>Max Hold</string> </property> - <property name="checked" > + <property name="checked"> <bool>false</bool> </property> </widget> </item> - <item row="2" column="0" > - <widget class="QCheckBox" name="MinHoldCheckBox" > - <property name="text" > + <item row="2" column="0"> + <widget class="QCheckBox" name="MinHoldCheckBox"> + <property name="text"> <string>Min Hold</string> </property> - <property name="checked" > + <property name="checked"> <bool>false</bool> </property> </widget> </item> - <item row="1" column="3" > - <widget class="QLabel" name="PowerLabel" > - <property name="minimumSize" > + <item row="1" column="3"> + <widget class="QLabel" name="PowerLabel"> + <property name="minimumSize"> <size> <width>50</width> <height>0</height> </size> </property> - <property name="maximumSize" > + <property name="maximumSize"> <size> <width>50</width> <height>16777215</height> </size> </property> - <property name="text" > + <property name="text"> <string>Power</string> </property> - <property name="alignment" > + <property name="alignment"> <set>Qt::AlignCenter</set> </property> - <property name="wordWrap" > + <property name="wordWrap"> <bool>false</bool> </property> </widget> </item> - <item row="1" column="1" > - <widget class="QPushButton" name="MaxHoldResetBtn" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Fixed" hsizetype="Fixed" > + <item row="1" column="1"> + <widget class="QPushButton" name="MaxHoldResetBtn"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="minimumSize" > + <property name="minimumSize"> <size> <width>25</width> <height>0</height> </size> </property> - <property name="text" > + <property name="text"> <string>Reset</string> </property> </widget> </item> - <item row="1" column="4" > - <widget class="QLabel" name="AvgLabel" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Fixed" hsizetype="Fixed" > + <item row="1" column="4"> + <widget class="QLabel" name="AvgLabel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="minimumSize" > + <property name="minimumSize"> <size> <width>62</width> <height>0</height> </size> </property> - <property name="text" > + <property name="text"> <string>Average</string> </property> - <property name="alignment" > + <property name="alignment"> <set>Qt::AlignCenter</set> </property> - <property name="wordWrap" > + <property name="wordWrap"> <bool>false</bool> </property> </widget> </item> - <item row="2" column="1" > - <widget class="QPushButton" name="MinHoldResetBtn" > - <property name="text" > + <item row="2" column="1"> + <widget class="QPushButton" name="MinHoldResetBtn"> + <property name="text"> <string>Reset</string> </property> </widget> </item> - <item row="2" column="4" > - <widget class="QSpinBox" name="AvgLineEdit" /> + <item row="2" column="4"> + <widget class="QSpinBox" name="AvgLineEdit"/> </item> - <item row="2" column="3" > - <widget class="QLineEdit" name="PowerLineEdit" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Fixed" hsizetype="Fixed" > + <item row="2" column="3"> + <widget class="QLineEdit" name="PowerLineEdit"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <property name="minimumSize" > + <property name="minimumSize"> <size> <width>50</width> <height>0</height> </size> </property> - <property name="maximumSize" > + <property name="maximumSize"> <size> <width>50</width> <height>16777215</height> </size> </property> - <property name="text" > + <property name="text"> <string>1</string> </property> </widget> </item> - <item row="1" column="2" > - <spacer name="horizontalSpacer_2" > - <property name="orientation" > + <item row="1" column="2"> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> <enum>Qt::Horizontal</enum> </property> - <property name="sizeHint" stdset="0" > + <property name="sizeHint" stdset="0"> <size> - <width>325</width> + <width>200</width> <height>20</height> </size> </property> @@ -344,410 +345,402 @@ </item> </layout> </widget> - <widget class="QWidget" name="WaterfallPage" > - <attribute name="title" > + <widget class="QWidget" name="WaterfallPage"> + <attribute name="title"> <string>Waterfall Display</string> </attribute> - <layout class="QGridLayout" name="gridLayout_3" > - <item row="0" column="0" > - <widget class="QLabel" name="textLabel1" > - <property name="maximumSize" > + <layout class="QGridLayout" name="gridLayout_3"> + <item row="0" column="0"> + <widget class="QLabel" name="textLabel1"> + <property name="maximumSize"> <size> <width>100</width> <height>16777215</height> </size> </property> - <property name="text" > + <property name="text"> <string>Intensity Display:</string> </property> - <property name="wordWrap" > + <property name="wordWrap"> <bool>false</bool> </property> </widget> </item> - <item row="0" column="2" > - <widget class="QwtWheel" name="WaterfallMaximumIntensityWheel" > - <property name="minimumSize" > + <item row="0" column="2"> + <widget class="QwtWheel" name="WaterfallMaximumIntensityWheel"> + <property name="minimumSize"> <size> <width>200</width> <height>0</height> </size> </property> - <property name="mouseTracking" > + <property name="mouseTracking"> <bool>true</bool> </property> - <property name="focusPolicy" > + <property name="focusPolicy"> <enum>Qt::WheelFocus</enum> </property> - <property name="valid" > + <property name="valid"> <bool>true</bool> </property> - <property name="totalAngle" > + <property name="totalAngle"> <double>200.000000000000000</double> </property> - <property name="viewAngle" > + <property name="viewAngle"> <double>20.000000000000000</double> </property> - <property name="mass" > + <property name="mass"> <double>0.000000000000000</double> </property> </widget> </item> - <item row="0" column="3" > - <widget class="QLabel" name="WaterfallMaximumIntensityLabel" > - <property name="maximumSize" > + <item row="0" column="3"> + <widget class="QLabel" name="WaterfallMaximumIntensityLabel"> + <property name="maximumSize"> <size> <width>100</width> <height>16777215</height> </size> </property> - <property name="text" > + <property name="text"> <string>100 dB</string> </property> - <property name="wordWrap" > + <property name="wordWrap"> <bool>false</bool> </property> </widget> </item> - <item row="1" column="0" colspan="4" > - <widget class="QFrame" name="WaterfallPlotDisplayFrame" > - <property name="minimumSize" > + <item row="1" column="0" colspan="4"> + <widget class="QFrame" name="WaterfallPlotDisplayFrame"> + <property name="minimumSize"> <size> <width>617</width> <height>338</height> </size> </property> - <property name="frameShape" > + <property name="frameShape"> <enum>QFrame::NoFrame</enum> </property> - <property name="frameShadow" > + <property name="frameShadow"> <enum>QFrame::Plain</enum> </property> </widget> </item> - <item row="2" column="2" > - <widget class="QwtWheel" name="WaterfallMinimumIntensityWheel" > - <property name="minimumSize" > + <item row="2" column="2"> + <widget class="QwtWheel" name="WaterfallMinimumIntensityWheel"> + <property name="minimumSize"> <size> <width>200</width> <height>0</height> </size> </property> - <property name="valid" > + <property name="valid"> <bool>true</bool> </property> - <property name="totalAngle" > + <property name="totalAngle"> <double>200.000000000000000</double> </property> - <property name="viewAngle" > + <property name="viewAngle"> <double>20.000000000000000</double> </property> - <property name="mass" > + <property name="mass"> <double>0.000000000000000</double> </property> </widget> </item> - <item row="2" column="3" > - <widget class="QLabel" name="WaterfallMinimumIntensityLabel" > - <property name="maximumSize" > + <item row="2" column="3"> + <widget class="QLabel" name="WaterfallMinimumIntensityLabel"> + <property name="maximumSize"> <size> <width>100</width> <height>16777215</height> </size> </property> - <property name="text" > + <property name="text"> <string>-100 dB</string> </property> - <property name="wordWrap" > + <property name="wordWrap"> <bool>false</bool> </property> </widget> </item> - <item row="2" column="0" colspan="2" > - <widget class="QPushButton" name="WaterfallAutoScaleBtn" > - <property name="maximumSize" > + <item row="2" column="0" colspan="2"> + <widget class="QPushButton" name="WaterfallAutoScaleBtn"> + <property name="maximumSize"> <size> <width>80</width> <height>16777215</height> </size> </property> - <property name="toolTip" > + <property name="toolTip"> <string>Scales the Intensity to the current data extremes.</string> </property> - <property name="text" > + <property name="text"> <string>Auto Scale</string> </property> </widget> </item> - <item row="0" column="1" > - <widget class="QComboBox" name="WaterfallIntensityComboBox" > - <property name="maximumSize" > + <item row="0" column="1"> + <widget class="QComboBox" name="WaterfallIntensityComboBox"> + <property name="maximumSize"> <size> <width>100</width> <height>16777215</height> </size> </property> <item> - <property name="text" > + <property name="text"> <string>Color</string> </property> </item> <item> - <property name="text" > + <property name="text"> <string>White Hot</string> </property> </item> <item> - <property name="text" > + <property name="text"> <string>Black Hot</string> </property> </item> <item> - <property name="text" > + <property name="text"> <string>Incandescent</string> </property> </item> <item> - <property name="text" > + <property name="text"> <string>User Defined</string> </property> </item> </widget> </item> </layout> - <zorder>textLabel1</zorder> - <zorder>WaterfallMaximumIntensityWheel</zorder> - <zorder>WaterfallMaximumIntensityLabel</zorder> - <zorder>WaterfallPlotDisplayFrame</zorder> - <zorder>WaterfallMinimumIntensityWheel</zorder> - <zorder>WaterfallMinimumIntensityLabel</zorder> - <zorder>WaterfallAutoScaleBtn</zorder> - <zorder>WaterfallIntensityComboBox</zorder> </widget> - <widget class="QWidget" name="Waterfall3DPage" > - <attribute name="title" > + <widget class="QWidget" name="Waterfall3DPage"> + <attribute name="title"> <string>3D Waterfall Display</string> </attribute> - <layout class="QGridLayout" name="gridLayout_6" > - <item row="0" column="0" > - <widget class="QLabel" name="textLabel1_2" > - <property name="minimumSize" > + <layout class="QGridLayout" name="gridLayout_6"> + <item row="0" column="0"> + <widget class="QLabel" name="textLabel1_2"> + <property name="minimumSize"> <size> <width>0</width> <height>0</height> </size> </property> - <property name="maximumSize" > + <property name="maximumSize"> <size> <width>100</width> <height>16777215</height> </size> </property> - <property name="text" > + <property name="text"> <string>Intensity Display:</string> </property> - <property name="wordWrap" > + <property name="wordWrap"> <bool>false</bool> </property> </widget> </item> - <item row="0" column="1" > - <widget class="QComboBox" name="Waterfall3DIntensityComboBox" > - <property name="maximumSize" > + <item row="0" column="1"> + <widget class="QComboBox" name="Waterfall3DIntensityComboBox"> + <property name="maximumSize"> <size> <width>100</width> <height>16777215</height> </size> </property> <item> - <property name="text" > + <property name="text"> <string>Color</string> </property> </item> <item> - <property name="text" > + <property name="text"> <string>White Hot</string> </property> </item> <item> - <property name="text" > + <property name="text"> <string>Black Hot</string> </property> </item> <item> - <property name="text" > + <property name="text"> <string>Incandescent</string> </property> </item> <item> - <property name="text" > + <property name="text"> <string>User Defined</string> </property> </item> </widget> </item> - <item row="0" column="2" > - <widget class="QwtWheel" name="Waterfall3DMaximumIntensityWheel" > - <property name="minimumSize" > + <item row="0" column="2"> + <widget class="QwtWheel" name="Waterfall3DMaximumIntensityWheel"> + <property name="minimumSize"> <size> <width>200</width> <height>0</height> </size> </property> - <property name="mouseTracking" > + <property name="mouseTracking"> <bool>true</bool> </property> - <property name="focusPolicy" > + <property name="focusPolicy"> <enum>Qt::WheelFocus</enum> </property> - <property name="valid" > + <property name="valid"> <bool>true</bool> </property> - <property name="totalAngle" > + <property name="totalAngle"> <double>200.000000000000000</double> </property> - <property name="viewAngle" > + <property name="viewAngle"> <double>20.000000000000000</double> </property> - <property name="mass" > + <property name="mass"> <double>0.000000000000000</double> </property> </widget> </item> - <item row="0" column="3" > - <widget class="QLabel" name="Waterfall3DMaximumIntensityLabel" > - <property name="maximumSize" > + <item row="0" column="3"> + <widget class="QLabel" name="Waterfall3DMaximumIntensityLabel"> + <property name="maximumSize"> <size> <width>100</width> <height>16777215</height> </size> </property> - <property name="text" > + <property name="text"> <string>100 dB</string> </property> - <property name="wordWrap" > + <property name="wordWrap"> <bool>false</bool> </property> </widget> </item> - <item row="1" column="0" colspan="4" > - <widget class="QFrame" name="Waterfall3DPlotDisplayFrame" > - <property name="frameShape" > + <item row="1" column="0" colspan="4"> + <widget class="QFrame" name="Waterfall3DPlotDisplayFrame"> + <property name="frameShape"> <enum>QFrame::NoFrame</enum> </property> - <property name="frameShadow" > + <property name="frameShadow"> <enum>QFrame::Plain</enum> </property> </widget> </item> - <item row="2" column="0" colspan="2" > - <widget class="QPushButton" name="Waterfall3DAutoScaleBtn" > - <property name="minimumSize" > + <item row="2" column="0" colspan="2"> + <widget class="QPushButton" name="Waterfall3DAutoScaleBtn"> + <property name="minimumSize"> <size> <width>0</width> <height>0</height> </size> </property> - <property name="maximumSize" > + <property name="maximumSize"> <size> <width>80</width> <height>16777215</height> </size> </property> - <property name="sizeIncrement" > + <property name="sizeIncrement"> <size> <width>0</width> <height>0</height> </size> </property> - <property name="toolTip" > + <property name="toolTip"> <string>Scales the Intensity to the current data extremes.</string> </property> - <property name="text" > + <property name="text"> <string>Auto Scale</string> </property> </widget> </item> - <item row="2" column="2" > - <widget class="QwtWheel" name="Waterfall3DMinimumIntensityWheel" > - <property name="minimumSize" > + <item row="2" column="2"> + <widget class="QwtWheel" name="Waterfall3DMinimumIntensityWheel"> + <property name="minimumSize"> <size> <width>200</width> <height>0</height> </size> </property> - <property name="valid" > + <property name="valid"> <bool>true</bool> </property> - <property name="totalAngle" > + <property name="totalAngle"> <double>200.000000000000000</double> </property> - <property name="viewAngle" > + <property name="viewAngle"> <double>20.000000000000000</double> </property> - <property name="mass" > + <property name="mass"> <double>0.000000000000000</double> </property> </widget> </item> - <item row="2" column="3" > - <widget class="QLabel" name="Waterfall3DMinimumIntensityLabel" > - <property name="maximumSize" > + <item row="2" column="3"> + <widget class="QLabel" name="Waterfall3DMinimumIntensityLabel"> + <property name="maximumSize"> <size> <width>100</width> <height>16777215</height> </size> </property> - <property name="text" > + <property name="text"> <string>-100 dB</string> </property> - <property name="wordWrap" > + <property name="wordWrap"> <bool>false</bool> </property> </widget> </item> </layout> </widget> - <widget class="QWidget" name="TimeDomainPage" > - <attribute name="title" > + <widget class="QWidget" name="TimeDomainPage"> + <attribute name="title"> <string>Time Domain Display</string> </attribute> - <layout class="QGridLayout" name="gridLayout_4" > - <item row="0" column="0" > - <widget class="QFrame" name="TimeDomainDisplayFrame" > - <property name="minimumSize" > + <layout class="QGridLayout" name="gridLayout_4"> + <item row="0" column="0"> + <widget class="QFrame" name="TimeDomainDisplayFrame"> + <property name="minimumSize"> <size> <width>617</width> <height>404</height> </size> </property> - <property name="frameShape" > + <property name="frameShape"> <enum>QFrame::NoFrame</enum> </property> - <property name="frameShadow" > + <property name="frameShadow"> <enum>QFrame::Plain</enum> </property> </widget> </item> </layout> </widget> - <widget class="QWidget" name="ConstellationPage" > - <attribute name="title" > + <widget class="QWidget" name="ConstellationPage"> + <attribute name="title"> <string>Constellation Display</string> </attribute> - <layout class="QGridLayout" name="gridLayout_5" > - <item row="0" column="0" > - <widget class="QFrame" name="ConstellationDisplayFrame" > - <property name="minimumSize" > + <layout class="QGridLayout" name="gridLayout_5"> + <item row="0" column="0"> + <widget class="QFrame" name="ConstellationDisplayFrame"> + <property name="minimumSize"> <size> <width>617</width> <height>406</height> </size> </property> - <property name="frameShape" > + <property name="frameShape"> <enum>QFrame::StyledPanel</enum> </property> - <property name="frameShadow" > + <property name="frameShadow"> <enum>QFrame::Raised</enum> </property> </widget> @@ -758,7 +751,7 @@ </item> </layout> </widget> - <layoutdefault spacing="6" margin="11" /> + <layoutdefault spacing="6" margin="11"/> <pixmapfunction>qPixmapFromMimeSource</pixmapfunction> <customwidgets> <customwidget> @@ -775,14 +768,14 @@ <tabstop>WaterfallMinimumIntensityWheel</tabstop> </tabstops> <includes> - <include location="global" >SpectrumGUIClass.h</include> - <include location="global" >FrequencyDisplayPlot.h</include> - <include location="global" >WaterfallDisplayPlot.h</include> - <include location="global" >Waterfall3DDisplayPlot.h</include> - <include location="global" >TimeDomainDisplayPlot.h</include> - <include location="global" >qvalidator.h</include> - <include location="global" >vector</include> - <include location="local" >qwt_wheel.h</include> + <include location="global">SpectrumGUIClass.h</include> + <include location="global">FrequencyDisplayPlot.h</include> + <include location="global">WaterfallDisplayPlot.h</include> + <include location="global">Waterfall3DDisplayPlot.h</include> + <include location="global">TimeDomainDisplayPlot.h</include> + <include location="global">qvalidator.h</include> + <include location="global">vector</include> + <include location="local">qwt_wheel.h</include> </includes> <resources/> <connections> @@ -792,11 +785,11 @@ <receiver>SpectrumDisplayForm</receiver> <slot>MaxHoldCheckBox_toggled(bool)</slot> <hints> - <hint type="sourcelabel" > + <hint type="sourcelabel"> <x>22</x> <y>324</y> </hint> - <hint type="destinationlabel" > + <hint type="destinationlabel"> <x>20</x> <y>20</y> </hint> @@ -808,11 +801,11 @@ <receiver>SpectrumDisplayForm</receiver> <slot>MaxHoldResetBtn_clicked()</slot> <hints> - <hint type="sourcelabel" > + <hint type="sourcelabel"> <x>107</x> <y>324</y> </hint> - <hint type="destinationlabel" > + <hint type="destinationlabel"> <x>20</x> <y>20</y> </hint> @@ -824,11 +817,11 @@ <receiver>SpectrumDisplayForm</receiver> <slot>MinHoldCheckBox_toggled(bool)</slot> <hints> - <hint type="sourcelabel" > + <hint type="sourcelabel"> <x>22</x> <y>349</y> </hint> - <hint type="destinationlabel" > + <hint type="destinationlabel"> <x>20</x> <y>20</y> </hint> @@ -840,11 +833,11 @@ <receiver>SpectrumDisplayForm</receiver> <slot>MinHoldResetBtn_clicked()</slot> <hints> - <hint type="sourcelabel" > + <hint type="sourcelabel"> <x>107</x> <y>349</y> </hint> - <hint type="destinationlabel" > + <hint type="destinationlabel"> <x>20</x> <y>20</y> </hint> @@ -856,11 +849,11 @@ <receiver>SpectrumDisplayForm</receiver> <slot>PowerLineEdit_textChanged(QString)</slot> <hints> - <hint type="sourcelabel" > + <hint type="sourcelabel"> <x>482</x> <y>344</y> </hint> - <hint type="destinationlabel" > + <hint type="destinationlabel"> <x>20</x> <y>20</y> </hint> @@ -872,11 +865,11 @@ <receiver>SpectrumDisplayForm</receiver> <slot>WindowTypeChanged(int)</slot> <hints> - <hint type="sourcelabel" > + <hint type="sourcelabel"> <x>20</x> <y>20</y> </hint> - <hint type="destinationlabel" > + <hint type="destinationlabel"> <x>20</x> <y>20</y> </hint> @@ -888,11 +881,11 @@ <receiver>SpectrumDisplayForm</receiver> <slot>UseRFFrequenciesCB(bool)</slot> <hints> - <hint type="sourcelabel" > + <hint type="sourcelabel"> <x>20</x> <y>20</y> </hint> - <hint type="destinationlabel" > + <hint type="destinationlabel"> <x>20</x> <y>20</y> </hint> @@ -904,11 +897,11 @@ <receiver>SpectrumDisplayForm</receiver> <slot>waterfallMaximumIntensityChangedCB(double)</slot> <hints> - <hint type="sourcelabel" > + <hint type="sourcelabel"> <x>217</x> <y>44</y> </hint> - <hint type="destinationlabel" > + <hint type="destinationlabel"> <x>20</x> <y>20</y> </hint> @@ -920,11 +913,11 @@ <receiver>SpectrumDisplayForm</receiver> <slot>waterfallMinimumIntensityChangedCB(double)</slot> <hints> - <hint type="sourcelabel" > + <hint type="sourcelabel"> <x>217</x> <y>349</y> </hint> - <hint type="destinationlabel" > + <hint type="destinationlabel"> <x>20</x> <y>20</y> </hint> @@ -936,11 +929,11 @@ <receiver>SpectrumDisplayForm</receiver> <slot>waterfall3DMaximumIntensityChangedCB(double)</slot> <hints> - <hint type="sourcelabel" > + <hint type="sourcelabel"> <x>217</x> <y>44</y> </hint> - <hint type="destinationlabel" > + <hint type="destinationlabel"> <x>20</x> <y>20</y> </hint> @@ -952,11 +945,11 @@ <receiver>SpectrumDisplayForm</receiver> <slot>waterfall3DMinimumIntensityChangedCB(double)</slot> <hints> - <hint type="sourcelabel" > + <hint type="sourcelabel"> <x>217</x> <y>349</y> </hint> - <hint type="destinationlabel" > + <hint type="destinationlabel"> <x>20</x> <y>20</y> </hint> @@ -968,11 +961,11 @@ <receiver>SpectrumDisplayForm</receiver> <slot>FFTComboBoxSelectedCB(QString)</slot> <hints> - <hint type="sourcelabel" > + <hint type="sourcelabel"> <x>20</x> <y>20</y> </hint> - <hint type="destinationlabel" > + <hint type="destinationlabel"> <x>20</x> <y>20</y> </hint> @@ -984,11 +977,11 @@ <receiver>SpectrumDisplayForm</receiver> <slot>WaterfallAutoScaleBtnCB()</slot> <hints> - <hint type="sourcelabel" > + <hint type="sourcelabel"> <x>22</x> <y>349</y> </hint> - <hint type="destinationlabel" > + <hint type="destinationlabel"> <x>20</x> <y>20</y> </hint> @@ -1000,11 +993,11 @@ <receiver>SpectrumDisplayForm</receiver> <slot>Waterfall3DAutoScaleBtnCB()</slot> <hints> - <hint type="sourcelabel" > + <hint type="sourcelabel"> <x>22</x> <y>349</y> </hint> - <hint type="destinationlabel" > + <hint type="destinationlabel"> <x>20</x> <y>20</y> </hint> @@ -1016,11 +1009,11 @@ <receiver>SpectrumDisplayForm</receiver> <slot>WaterfallIntensityColorTypeChanged(int)</slot> <hints> - <hint type="sourcelabel" > + <hint type="sourcelabel"> <x>92</x> <y>44</y> </hint> - <hint type="destinationlabel" > + <hint type="destinationlabel"> <x>20</x> <y>20</y> </hint> @@ -1032,11 +1025,11 @@ <receiver>SpectrumDisplayForm</receiver> <slot>Waterfall3DIntensityColorTypeChanged(int)</slot> <hints> - <hint type="sourcelabel" > + <hint type="sourcelabel"> <x>92</x> <y>44</y> </hint> - <hint type="destinationlabel" > + <hint type="destinationlabel"> <x>20</x> <y>20</y> </hint> @@ -1048,11 +1041,11 @@ <receiver>SpectrumDisplayForm</receiver> <slot>TabChanged(int)</slot> <hints> - <hint type="sourcelabel" > + <hint type="sourcelabel"> <x>314</x> <y>189</y> </hint> - <hint type="destinationlabel" > + <hint type="destinationlabel"> <x>316</x> <y>217</y> </hint> @@ -1064,11 +1057,11 @@ <receiver>SpectrumDisplayForm</receiver> <slot>AvgLineEdit_valueChanged(int)</slot> <hints> - <hint type="sourcelabel" > + <hint type="sourcelabel"> <x>604</x> <y>421</y> </hint> - <hint type="destinationlabel" > + <hint type="destinationlabel"> <x>328</x> <y>260</y> </hint> diff --git a/gr-usrp/src/Makefile.am b/gr-usrp/src/Makefile.am index 0835e2b9b..3d1cc1754 100644 --- a/gr-usrp/src/Makefile.am +++ b/gr-usrp/src/Makefile.am @@ -37,6 +37,7 @@ AM_CPPFLAGS = \ $(STD_DEFINES_AND_INCLUDES) \ $(PYTHON_CPPFLAGS) \ $(USRP_INCLUDES) \ + $(USB_INCLUDES) \ $(WITH_INCLUDES) lib_LTLIBRARIES = \ diff --git a/gr-utils/src/python/pyqt_plot.py b/gr-utils/src/python/pyqt_plot.py index 98977da97..5650135ab 100644 --- a/gr-utils/src/python/pyqt_plot.py +++ b/gr-utils/src/python/pyqt_plot.py @@ -2,8 +2,8 @@ # Form implementation generated from reading ui file 'pyqt_plot.ui' # -# Created: Tue Sep 1 23:02:36 2009 -# by: PyQt4 UI code generator 4.4.3 +# Created: Tue Oct 6 10:39:58 2009 +# by: PyQt4 UI code generator 4.4.4 # # WARNING! All changes made in this file will be lost! @@ -12,7 +12,7 @@ from PyQt4 import QtCore, QtGui class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") - MainWindow.resize(927, 718) + MainWindow.resize(927, 696) self.centralwidget = QtGui.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.gridLayout = QtGui.QGridLayout(self.centralwidget) @@ -20,123 +20,8 @@ class Ui_MainWindow(object): self.plotHBar = QtGui.QScrollBar(self.centralwidget) self.plotHBar.setOrientation(QtCore.Qt.Horizontal) self.plotHBar.setObjectName("plotHBar") - self.gridLayout.addWidget(self.plotHBar, 1, 0, 1, 3) - self.filePosBox = QtGui.QGroupBox(self.centralwidget) - self.filePosBox.setMinimumSize(QtCore.QSize(0, 120)) - self.filePosBox.setObjectName("filePosBox") - self.gridLayout_4 = QtGui.QGridLayout(self.filePosBox) - self.gridLayout_4.setObjectName("gridLayout_4") - self.filePosLayout = QtGui.QFormLayout() - self.filePosLayout.setObjectName("filePosLayout") - self.filePosStartLineEdit = QtGui.QLineEdit(self.filePosBox) - self.filePosStartLineEdit.setMinimumSize(QtCore.QSize(50, 0)) - self.filePosStartLineEdit.setMaximumSize(QtCore.QSize(100, 16777215)) - self.filePosStartLineEdit.setObjectName("filePosStartLineEdit") - self.filePosLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.filePosStartLineEdit) - self.filePosStopLabel = QtGui.QLabel(self.filePosBox) - self.filePosStopLabel.setObjectName("filePosStopLabel") - self.filePosLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.filePosStopLabel) - self.filePosStopLineEdit = QtGui.QLineEdit(self.filePosBox) - self.filePosStopLineEdit.setMinimumSize(QtCore.QSize(50, 0)) - self.filePosStopLineEdit.setMaximumSize(QtCore.QSize(100, 16777215)) - self.filePosStopLineEdit.setObjectName("filePosStopLineEdit") - self.filePosLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.filePosStopLineEdit) - self.filePosLengthLabel = QtGui.QLabel(self.filePosBox) - self.filePosLengthLabel.setObjectName("filePosLengthLabel") - self.filePosLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.filePosLengthLabel) - self.filePosLengthLineEdit = QtGui.QLineEdit(self.filePosBox) - self.filePosLengthLineEdit.setMinimumSize(QtCore.QSize(50, 0)) - self.filePosLengthLineEdit.setMaximumSize(QtCore.QSize(100, 16777215)) - self.filePosLengthLineEdit.setObjectName("filePosLengthLineEdit") - self.filePosLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.filePosLengthLineEdit) - self.filePosStartLabel = QtGui.QLabel(self.filePosBox) - self.filePosStartLabel.setObjectName("filePosStartLabel") - self.filePosLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.filePosStartLabel) - self.gridLayout_4.addLayout(self.filePosLayout, 0, 0, 1, 1) - self.fileTimeLayout = QtGui.QFormLayout() - self.fileTimeLayout.setObjectName("fileTimeLayout") - self.fileTimeStartLabel = QtGui.QLabel(self.filePosBox) - self.fileTimeStartLabel.setObjectName("fileTimeStartLabel") - self.fileTimeLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.fileTimeStartLabel) - self.fileTimeStartLineEdit = QtGui.QLineEdit(self.filePosBox) - self.fileTimeStartLineEdit.setMinimumSize(QtCore.QSize(50, 0)) - self.fileTimeStartLineEdit.setMaximumSize(QtCore.QSize(100, 16777215)) - self.fileTimeStartLineEdit.setObjectName("fileTimeStartLineEdit") - self.fileTimeLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.fileTimeStartLineEdit) - self.fileTimeStopLabel = QtGui.QLabel(self.filePosBox) - self.fileTimeStopLabel.setObjectName("fileTimeStopLabel") - self.fileTimeLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.fileTimeStopLabel) - self.fileTimeStopLineEdit = QtGui.QLineEdit(self.filePosBox) - self.fileTimeStopLineEdit.setMinimumSize(QtCore.QSize(50, 0)) - self.fileTimeStopLineEdit.setMaximumSize(QtCore.QSize(100, 16777215)) - self.fileTimeStopLineEdit.setObjectName("fileTimeStopLineEdit") - self.fileTimeLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.fileTimeStopLineEdit) - self.fileTimeLengthLabel = QtGui.QLabel(self.filePosBox) - self.fileTimeLengthLabel.setObjectName("fileTimeLengthLabel") - self.fileTimeLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.fileTimeLengthLabel) - self.fileTimeLengthLineEdit = QtGui.QLineEdit(self.filePosBox) - self.fileTimeLengthLineEdit.setMinimumSize(QtCore.QSize(50, 0)) - self.fileTimeLengthLineEdit.setMaximumSize(QtCore.QSize(100, 16777215)) - self.fileTimeLengthLineEdit.setObjectName("fileTimeLengthLineEdit") - self.fileTimeLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.fileTimeLengthLineEdit) - self.gridLayout_4.addLayout(self.fileTimeLayout, 0, 1, 1, 1) - self.gridLayout.addWidget(self.filePosBox, 2, 0, 1, 1) - self.displayGroupBox = QtGui.QGroupBox(self.centralwidget) - self.displayGroupBox.setMinimumSize(QtCore.QSize(170, 0)) - self.displayGroupBox.setObjectName("displayGroupBox") - self.gridLayout_2 = QtGui.QGridLayout(self.displayGroupBox) - self.gridLayout_2.setObjectName("gridLayout_2") - self.colorComboBox = QtGui.QComboBox(self.displayGroupBox) - self.colorComboBox.setObjectName("colorComboBox") - self.gridLayout_2.addWidget(self.colorComboBox, 0, 0, 1, 2) - self.lineWidthSpinBox = QtGui.QSpinBox(self.displayGroupBox) - self.lineWidthSpinBox.setMinimumSize(QtCore.QSize(100, 0)) - self.lineWidthSpinBox.setMaximumSize(QtCore.QSize(100, 16777215)) - self.lineWidthSpinBox.setObjectName("lineWidthSpinBox") - self.gridLayout_2.addWidget(self.lineWidthSpinBox, 1, 1, 1, 1) - self.lineWidthLabel = QtGui.QLabel(self.displayGroupBox) - self.lineWidthLabel.setObjectName("lineWidthLabel") - self.gridLayout_2.addWidget(self.lineWidthLabel, 1, 0, 1, 1) - self.lineStyleLabel = QtGui.QLabel(self.displayGroupBox) - self.lineStyleLabel.setObjectName("lineStyleLabel") - self.gridLayout_2.addWidget(self.lineStyleLabel, 2, 0, 1, 1) - self.lineStyleComboBox = QtGui.QComboBox(self.displayGroupBox) - self.lineStyleComboBox.setMinimumSize(QtCore.QSize(100, 0)) - self.lineStyleComboBox.setMaximumSize(QtCore.QSize(100, 16777215)) - self.lineStyleComboBox.setObjectName("lineStyleComboBox") - self.gridLayout_2.addWidget(self.lineStyleComboBox, 2, 1, 1, 1) - self.styleSizeLabel = QtGui.QLabel(self.displayGroupBox) - self.styleSizeLabel.setObjectName("styleSizeLabel") - self.gridLayout_2.addWidget(self.styleSizeLabel, 3, 0, 1, 1) - self.styleSizeSpinBox = QtGui.QSpinBox(self.displayGroupBox) - self.styleSizeSpinBox.setMinimumSize(QtCore.QSize(100, 0)) - self.styleSizeSpinBox.setMaximumSize(QtCore.QSize(100, 16777215)) - self.styleSizeSpinBox.setObjectName("styleSizeSpinBox") - self.gridLayout_2.addWidget(self.styleSizeSpinBox, 3, 1, 1, 1) - self.gridLayout.addWidget(self.displayGroupBox, 2, 2, 1, 1) - self.sysGroupBox = QtGui.QGroupBox(self.centralwidget) - self.sysGroupBox.setMinimumSize(QtCore.QSize(200, 0)) - self.sysGroupBox.setObjectName("sysGroupBox") - self.formLayout = QtGui.QFormLayout(self.sysGroupBox) - self.formLayout.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow) - self.formLayout.setObjectName("formLayout") - self.sampleRateLabel = QtGui.QLabel(self.sysGroupBox) - self.sampleRateLabel.setObjectName("sampleRateLabel") - self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.sampleRateLabel) - self.sampleRateLineEdit = QtGui.QLineEdit(self.sysGroupBox) - self.sampleRateLineEdit.setMinimumSize(QtCore.QSize(50, 0)) - self.sampleRateLineEdit.setMaximumSize(QtCore.QSize(100, 16777215)) - self.sampleRateLineEdit.setObjectName("sampleRateLineEdit") - self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.sampleRateLineEdit) - self.gridLayout.addWidget(self.sysGroupBox, 2, 1, 1, 1) - self.frame = QtGui.QFrame(self.centralwidget) - self.frame.setFrameShape(QtGui.QFrame.StyledPanel) - self.frame.setFrameShadow(QtGui.QFrame.Raised) - self.frame.setObjectName("frame") - self.gridLayout_3 = QtGui.QGridLayout(self.frame) - self.gridLayout_3.setObjectName("gridLayout_3") - self.tabGroup = QtGui.QTabWidget(self.frame) - self.tabGroup.setMinimumSize(QtCore.QSize(0, 0)) + self.gridLayout.addWidget(self.plotHBar, 2, 0, 1, 2) + self.tabGroup = QtGui.QTabWidget(self.centralwidget) self.tabGroup.setObjectName("tabGroup") self.timeTab = QtGui.QWidget() self.timeTab.setObjectName("timeTab") @@ -156,14 +41,14 @@ class Ui_MainWindow(object): self.formLayout_4 = QtGui.QFormLayout(self.fftPropBox) self.formLayout_4.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow) self.formLayout_4.setObjectName("formLayout_4") - self.psdFFTSizeLabel = QtGui.QLabel(self.fftPropBox) - self.psdFFTSizeLabel.setObjectName("psdFFTSizeLabel") - self.formLayout_4.setWidget(0, QtGui.QFormLayout.LabelRole, self.psdFFTSizeLabel) self.psdFFTComboBox = QtGui.QComboBox(self.fftPropBox) self.psdFFTComboBox.setMinimumSize(QtCore.QSize(96, 0)) self.psdFFTComboBox.setMaximumSize(QtCore.QSize(96, 16777215)) self.psdFFTComboBox.setObjectName("psdFFTComboBox") self.formLayout_4.setWidget(0, QtGui.QFormLayout.FieldRole, self.psdFFTComboBox) + self.psdFFTSizeLabel = QtGui.QLabel(self.fftPropBox) + self.psdFFTSizeLabel.setObjectName("psdFFTSizeLabel") + self.formLayout_4.setWidget(0, QtGui.QFormLayout.LabelRole, self.psdFFTSizeLabel) self.horizontalLayout_2.addWidget(self.fftPropBox) self.freqPlot = Qwt5.QwtPlot(self.freqTab) self.freqPlot.setObjectName("freqPlot") @@ -190,11 +75,90 @@ class Ui_MainWindow(object): self.specPlot.setObjectName("specPlot") self.horizontalLayout_3.addWidget(self.specPlot) self.tabGroup.addTab(self.specTab, "") - self.gridLayout_3.addWidget(self.tabGroup, 0, 0, 1, 1) - self.gridLayout.addWidget(self.frame, 0, 0, 1, 3) + self.gridLayout.addWidget(self.tabGroup, 1, 0, 1, 1) + self.filePosBox = QtGui.QGroupBox(self.centralwidget) + self.filePosBox.setMinimumSize(QtCore.QSize(0, 120)) + self.filePosBox.setObjectName("filePosBox") + self.formLayoutWidget_2 = QtGui.QWidget(self.filePosBox) + self.formLayoutWidget_2.setGeometry(QtCore.QRect(0, 20, 160, 92)) + self.formLayoutWidget_2.setObjectName("formLayoutWidget_2") + self.filePosLayout = QtGui.QFormLayout(self.formLayoutWidget_2) + self.filePosLayout.setObjectName("filePosLayout") + self.filePosStartLabel = QtGui.QLabel(self.formLayoutWidget_2) + self.filePosStartLabel.setObjectName("filePosStartLabel") + self.filePosLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.filePosStartLabel) + self.filePosStartLineEdit = QtGui.QLineEdit(self.formLayoutWidget_2) + self.filePosStartLineEdit.setObjectName("filePosStartLineEdit") + self.filePosLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.filePosStartLineEdit) + self.filePosStopLabel = QtGui.QLabel(self.formLayoutWidget_2) + self.filePosStopLabel.setObjectName("filePosStopLabel") + self.filePosLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.filePosStopLabel) + self.filePosStopLineEdit = QtGui.QLineEdit(self.formLayoutWidget_2) + self.filePosStopLineEdit.setObjectName("filePosStopLineEdit") + self.filePosLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.filePosStopLineEdit) + self.filePosLengthLabel = QtGui.QLabel(self.formLayoutWidget_2) + self.filePosLengthLabel.setObjectName("filePosLengthLabel") + self.filePosLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.filePosLengthLabel) + self.filePosLengthLineEdit = QtGui.QLineEdit(self.formLayoutWidget_2) + self.filePosLengthLineEdit.setObjectName("filePosLengthLineEdit") + self.filePosLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.filePosLengthLineEdit) + self.formLayoutWidget_4 = QtGui.QWidget(self.filePosBox) + self.formLayoutWidget_4.setGeometry(QtCore.QRect(180, 20, 231, 92)) + self.formLayoutWidget_4.setObjectName("formLayoutWidget_4") + self.fileTimeLayout = QtGui.QFormLayout(self.formLayoutWidget_4) + self.fileTimeLayout.setObjectName("fileTimeLayout") + self.fileTimeStartLabel = QtGui.QLabel(self.formLayoutWidget_4) + self.fileTimeStartLabel.setObjectName("fileTimeStartLabel") + self.fileTimeLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.fileTimeStartLabel) + self.fileTimeStartLineEdit = QtGui.QLineEdit(self.formLayoutWidget_4) + self.fileTimeStartLineEdit.setObjectName("fileTimeStartLineEdit") + self.fileTimeLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.fileTimeStartLineEdit) + self.fileTimeStopLabel = QtGui.QLabel(self.formLayoutWidget_4) + self.fileTimeStopLabel.setObjectName("fileTimeStopLabel") + self.fileTimeLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.fileTimeStopLabel) + self.fileTimeStopLineEdit = QtGui.QLineEdit(self.formLayoutWidget_4) + self.fileTimeStopLineEdit.setObjectName("fileTimeStopLineEdit") + self.fileTimeLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.fileTimeStopLineEdit) + self.fileTimeLengthLabel = QtGui.QLabel(self.formLayoutWidget_4) + self.fileTimeLengthLabel.setObjectName("fileTimeLengthLabel") + self.fileTimeLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.fileTimeLengthLabel) + self.fileTimeLengthLineEdit = QtGui.QLineEdit(self.formLayoutWidget_4) + self.fileTimeLengthLineEdit.setObjectName("fileTimeLengthLineEdit") + self.fileTimeLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.fileTimeLengthLineEdit) + self.sysGroupBox = QtGui.QGroupBox(self.filePosBox) + self.sysGroupBox.setGeometry(QtCore.QRect(530, 0, 200, 120)) + self.sysGroupBox.setMinimumSize(QtCore.QSize(200, 0)) + self.sysGroupBox.setObjectName("sysGroupBox") + self.formLayoutWidget_3 = QtGui.QWidget(self.sysGroupBox) + self.formLayoutWidget_3.setGeometry(QtCore.QRect(0, 20, 191, 91)) + self.formLayoutWidget_3.setObjectName("formLayoutWidget_3") + self.formLayout_2 = QtGui.QFormLayout(self.formLayoutWidget_3) + self.formLayout_2.setObjectName("formLayout_2") + self.sampleRateLabel = QtGui.QLabel(self.formLayoutWidget_3) + self.sampleRateLabel.setObjectName("sampleRateLabel") + self.formLayout_2.setWidget(0, QtGui.QFormLayout.LabelRole, self.sampleRateLabel) + self.sampleRateLineEdit = QtGui.QLineEdit(self.formLayoutWidget_3) + self.sampleRateLineEdit.setMinimumSize(QtCore.QSize(0, 0)) + self.sampleRateLineEdit.setObjectName("sampleRateLineEdit") + self.formLayout_2.setWidget(0, QtGui.QFormLayout.FieldRole, self.sampleRateLineEdit) + self.displayGroupBox = QtGui.QGroupBox(self.filePosBox) + self.displayGroupBox.setGeometry(QtCore.QRect(730, 0, 170, 120)) + self.displayGroupBox.setMinimumSize(QtCore.QSize(170, 0)) + self.displayGroupBox.setObjectName("displayGroupBox") + self.verticalLayoutWidget = QtGui.QWidget(self.displayGroupBox) + self.verticalLayoutWidget.setGeometry(QtCore.QRect(0, 20, 160, 91)) + self.verticalLayoutWidget.setObjectName("verticalLayoutWidget") + self.verticalLayout = QtGui.QVBoxLayout(self.verticalLayoutWidget) + self.verticalLayout.setObjectName("verticalLayout") + self.colorComboBox = QtGui.QComboBox(self.verticalLayoutWidget) + self.colorComboBox.setObjectName("colorComboBox") + self.verticalLayout.addWidget(self.colorComboBox) + spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + self.verticalLayout.addItem(spacerItem) + self.gridLayout.addWidget(self.filePosBox, 3, 0, 1, 1) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtGui.QMenuBar(MainWindow) - self.menubar.setGeometry(QtCore.QRect(0, 0, 927, 24)) + self.menubar.setGeometry(QtCore.QRect(0, 0, 927, 25)) self.menubar.setObjectName("menubar") self.menu_File = QtGui.QMenu(self.menubar) self.menu_File.setObjectName("menu_File") @@ -220,30 +184,28 @@ class Ui_MainWindow(object): def retranslateUi(self, MainWindow): MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "MainWindow", None, QtGui.QApplication.UnicodeUTF8)) + self.tabGroup.setTabText(self.tabGroup.indexOf(self.timeTab), QtGui.QApplication.translate("MainWindow", "Time Domain", None, QtGui.QApplication.UnicodeUTF8)) + self.fftPropBox.setTitle(QtGui.QApplication.translate("MainWindow", "FFT Properties", None, QtGui.QApplication.UnicodeUTF8)) + self.psdFFTSizeLabel.setText(QtGui.QApplication.translate("MainWindow", "FFT Size", None, QtGui.QApplication.UnicodeUTF8)) + self.tabGroup.setTabText(self.tabGroup.indexOf(self.freqTab), QtGui.QApplication.translate("MainWindow", "Frequency Domain", None, QtGui.QApplication.UnicodeUTF8)) + self.groupBox.setTitle(QtGui.QApplication.translate("MainWindow", "Spectrogram Properties", None, QtGui.QApplication.UnicodeUTF8)) + self.specFFTLabel.setText(QtGui.QApplication.translate("MainWindow", "FFT Size", None, QtGui.QApplication.UnicodeUTF8)) + self.tabGroup.setTabText(self.tabGroup.indexOf(self.specTab), QtGui.QApplication.translate("MainWindow", "Spectrogram", None, QtGui.QApplication.UnicodeUTF8)) self.filePosBox.setTitle(QtGui.QApplication.translate("MainWindow", "File Position", None, QtGui.QApplication.UnicodeUTF8)) + self.filePosStartLabel.setText(QtGui.QApplication.translate("MainWindow", "Start", None, QtGui.QApplication.UnicodeUTF8)) self.filePosStopLabel.setText(QtGui.QApplication.translate("MainWindow", "Stop", None, QtGui.QApplication.UnicodeUTF8)) self.filePosLengthLabel.setText(QtGui.QApplication.translate("MainWindow", "Length", None, QtGui.QApplication.UnicodeUTF8)) - self.filePosStartLabel.setText(QtGui.QApplication.translate("MainWindow", "Start", None, QtGui.QApplication.UnicodeUTF8)) self.fileTimeStartLabel.setText(QtGui.QApplication.translate("MainWindow", "time start (sec)", None, QtGui.QApplication.UnicodeUTF8)) self.fileTimeStopLabel.setText(QtGui.QApplication.translate("MainWindow", "time stop (sec)", None, QtGui.QApplication.UnicodeUTF8)) self.fileTimeLengthLabel.setText(QtGui.QApplication.translate("MainWindow", "time length (sec)", None, QtGui.QApplication.UnicodeUTF8)) - self.displayGroupBox.setTitle(QtGui.QApplication.translate("MainWindow", "Display Properties", None, QtGui.QApplication.UnicodeUTF8)) - self.lineWidthLabel.setText(QtGui.QApplication.translate("MainWindow", "Line Width", None, QtGui.QApplication.UnicodeUTF8)) - self.lineStyleLabel.setText(QtGui.QApplication.translate("MainWindow", "Line Style", None, QtGui.QApplication.UnicodeUTF8)) - self.styleSizeLabel.setText(QtGui.QApplication.translate("MainWindow", "Style Size", None, QtGui.QApplication.UnicodeUTF8)) self.sysGroupBox.setTitle(QtGui.QApplication.translate("MainWindow", "System Properties", None, QtGui.QApplication.UnicodeUTF8)) self.sampleRateLabel.setText(QtGui.QApplication.translate("MainWindow", "Sample Rate", None, QtGui.QApplication.UnicodeUTF8)) - self.tabGroup.setTabText(self.tabGroup.indexOf(self.timeTab), QtGui.QApplication.translate("MainWindow", "Time Domain", None, QtGui.QApplication.UnicodeUTF8)) - self.fftPropBox.setTitle(QtGui.QApplication.translate("MainWindow", "FFT Properties", None, QtGui.QApplication.UnicodeUTF8)) - self.psdFFTSizeLabel.setText(QtGui.QApplication.translate("MainWindow", "FFT Size", None, QtGui.QApplication.UnicodeUTF8)) - self.tabGroup.setTabText(self.tabGroup.indexOf(self.freqTab), QtGui.QApplication.translate("MainWindow", "Frequency Domain", None, QtGui.QApplication.UnicodeUTF8)) - self.groupBox.setTitle(QtGui.QApplication.translate("MainWindow", "Spectrogram Properties", None, QtGui.QApplication.UnicodeUTF8)) - self.specFFTLabel.setText(QtGui.QApplication.translate("MainWindow", "FFT Size", None, QtGui.QApplication.UnicodeUTF8)) - self.tabGroup.setTabText(self.tabGroup.indexOf(self.specTab), QtGui.QApplication.translate("MainWindow", "Spectrogram", None, QtGui.QApplication.UnicodeUTF8)) + self.displayGroupBox.setTitle(QtGui.QApplication.translate("MainWindow", "Display Properties", None, QtGui.QApplication.UnicodeUTF8)) self.menu_File.setTitle(QtGui.QApplication.translate("MainWindow", "&File", None, QtGui.QApplication.UnicodeUTF8)) self.action_open.setText(QtGui.QApplication.translate("MainWindow", "&Open", None, QtGui.QApplication.UnicodeUTF8)) self.action_open.setShortcut(QtGui.QApplication.translate("MainWindow", "Ctrl+O", None, QtGui.QApplication.UnicodeUTF8)) self.action_exit.setText(QtGui.QApplication.translate("MainWindow", "E&xit", None, QtGui.QApplication.UnicodeUTF8)) self.action_reload.setText(QtGui.QApplication.translate("MainWindow", "&Reload", None, QtGui.QApplication.UnicodeUTF8)) + self.action_reload.setShortcut(QtGui.QApplication.translate("MainWindow", "Ctrl+R", None, QtGui.QApplication.UnicodeUTF8)) from PyQt4 import Qwt5 diff --git a/gr-utils/src/python/pyqt_plot.ui b/gr-utils/src/python/pyqt_plot.ui index 7244d24c9..55c72fda2 100644 --- a/gr-utils/src/python/pyqt_plot.ui +++ b/gr-utils/src/python/pyqt_plot.ui @@ -1,488 +1,373 @@ -<ui version="4.0" > +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> <class>MainWindow</class> - <widget class="QMainWindow" name="MainWindow" > - <property name="geometry" > + <widget class="QMainWindow" name="MainWindow"> + <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>927</width> - <height>718</height> + <height>696</height> </rect> </property> - <property name="windowTitle" > + <property name="windowTitle"> <string>MainWindow</string> </property> - <widget class="QWidget" name="centralwidget" > - <layout class="QGridLayout" name="gridLayout" > - <item row="1" column="0" colspan="3" > - <widget class="QScrollBar" name="plotHBar" > - <property name="orientation" > + <widget class="QWidget" name="centralwidget"> + <layout class="QGridLayout" name="gridLayout"> + <item row="2" column="0" colspan="2"> + <widget class="QScrollBar" name="plotHBar"> + <property name="orientation"> <enum>Qt::Horizontal</enum> </property> </widget> </item> - <item row="2" column="0" > - <widget class="QGroupBox" name="filePosBox" > - <property name="minimumSize" > + <item row="1" column="0"> + <widget class="QTabWidget" name="tabGroup"> + <property name="currentIndex"> + <number>0</number> + </property> + <widget class="QWidget" name="timeTab"> + <attribute name="title"> + <string>Time Domain</string> + </attribute> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QwtPlot" name="timePlot"/> + </item> + </layout> + </widget> + <widget class="QWidget" name="freqTab"> + <attribute name="title"> + <string>Frequency Domain</string> + </attribute> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <widget class="QGroupBox" name="fftPropBox"> + <property name="minimumSize"> + <size> + <width>160</width> + <height>0</height> + </size> + </property> + <property name="title"> + <string>FFT Properties</string> + </property> + <layout class="QFormLayout" name="formLayout_4"> + <property name="fieldGrowthPolicy"> + <enum>QFormLayout::AllNonFixedFieldsGrow</enum> + </property> + <item row="0" column="1"> + <widget class="QComboBox" name="psdFFTComboBox"> + <property name="minimumSize"> + <size> + <width>96</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>96</width> + <height>16777215</height> + </size> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="psdFFTSizeLabel"> + <property name="text"> + <string>FFT Size</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QwtPlot" name="freqPlot"/> + </item> + </layout> + </widget> + <widget class="QWidget" name="specTab"> + <attribute name="title"> + <string>Spectrogram</string> + </attribute> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <item> + <widget class="QGroupBox" name="groupBox"> + <property name="title"> + <string>Spectrogram Properties</string> + </property> + <layout class="QFormLayout" name="formLayout_3"> + <item row="1" column="0"> + <widget class="QLabel" name="specFFTLabel"> + <property name="text"> + <string>FFT Size</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QComboBox" name="specFFTComboBox"> + <property name="minimumSize"> + <size> + <width>96</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>96</width> + <height>16777215</height> + </size> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QwtPlot" name="specPlot"/> + </item> + </layout> + <zorder>specPlot</zorder> + <zorder>groupBox</zorder> + </widget> + </widget> + </item> + <item row="3" column="0"> + <widget class="QGroupBox" name="filePosBox"> + <property name="minimumSize"> <size> <width>0</width> <height>120</height> </size> </property> - <property name="title" > + <property name="title"> <string>File Position</string> </property> - <layout class="QGridLayout" name="gridLayout_4" > - <item row="0" column="0" > - <layout class="QFormLayout" name="filePosLayout" > - <item row="0" column="1" > - <widget class="QLineEdit" name="filePosStartLineEdit" > - <property name="minimumSize" > - <size> - <width>50</width> - <height>0</height> - </size> - </property> - <property name="maximumSize" > - <size> - <width>100</width> - <height>16777215</height> - </size> - </property> - </widget> - </item> - <item row="1" column="0" > - <widget class="QLabel" name="filePosStopLabel" > - <property name="text" > - <string>Stop</string> - </property> - </widget> - </item> - <item row="1" column="1" > - <widget class="QLineEdit" name="filePosStopLineEdit" > - <property name="minimumSize" > - <size> - <width>50</width> - <height>0</height> - </size> - </property> - <property name="maximumSize" > - <size> - <width>100</width> - <height>16777215</height> - </size> - </property> - </widget> - </item> - <item row="2" column="0" > - <widget class="QLabel" name="filePosLengthLabel" > - <property name="text" > - <string>Length</string> + <widget class="QWidget" name="formLayoutWidget_2"> + <property name="geometry"> + <rect> + <x>0</x> + <y>20</y> + <width>160</width> + <height>92</height> + </rect> + </property> + <layout class="QFormLayout" name="filePosLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="filePosStartLabel"> + <property name="text"> + <string>Start</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLineEdit" name="filePosStartLineEdit"/> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="filePosStopLabel"> + <property name="text"> + <string>Stop</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLineEdit" name="filePosStopLineEdit"/> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="filePosLengthLabel"> + <property name="text"> + <string>Length</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLineEdit" name="filePosLengthLineEdit"/> + </item> + </layout> + </widget> + <widget class="QWidget" name="formLayoutWidget_4"> + <property name="geometry"> + <rect> + <x>180</x> + <y>20</y> + <width>231</width> + <height>92</height> + </rect> + </property> + <layout class="QFormLayout" name="fileTimeLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="fileTimeStartLabel"> + <property name="text"> + <string>time start (sec)</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLineEdit" name="fileTimeStartLineEdit"/> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="fileTimeStopLabel"> + <property name="text"> + <string>time stop (sec)</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLineEdit" name="fileTimeStopLineEdit"/> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="fileTimeLengthLabel"> + <property name="text"> + <string>time length (sec)</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLineEdit" name="fileTimeLengthLineEdit"/> + </item> + </layout> + </widget> + <widget class="QGroupBox" name="sysGroupBox"> + <property name="geometry"> + <rect> + <x>530</x> + <y>0</y> + <width>200</width> + <height>120</height> + </rect> + </property> + <property name="minimumSize"> + <size> + <width>200</width> + <height>0</height> + </size> + </property> + <property name="title"> + <string>System Properties</string> + </property> + <widget class="QWidget" name="formLayoutWidget_3"> + <property name="geometry"> + <rect> + <x>0</x> + <y>20</y> + <width>191</width> + <height>91</height> + </rect> + </property> + <layout class="QFormLayout" name="formLayout_2"> + <item row="0" column="0"> + <widget class="QLabel" name="sampleRateLabel"> + <property name="text"> + <string>Sample Rate</string> </property> </widget> </item> - <item row="2" column="1" > - <widget class="QLineEdit" name="filePosLengthLineEdit" > - <property name="minimumSize" > + <item row="0" column="1"> + <widget class="QLineEdit" name="sampleRateLineEdit"> + <property name="minimumSize"> <size> - <width>50</width> + <width>0</width> <height>0</height> </size> </property> - <property name="maximumSize" > - <size> - <width>100</width> - <height>16777215</height> - </size> - </property> - </widget> - </item> - <item row="0" column="0" > - <widget class="QLabel" name="filePosStartLabel" > - <property name="text" > - <string>Start</string> - </property> </widget> </item> </layout> - </item> - <item row="0" column="1" > - <layout class="QFormLayout" name="fileTimeLayout" > - <item row="0" column="0" > - <widget class="QLabel" name="fileTimeStartLabel" > - <property name="text" > - <string>time start (sec)</string> - </property> - </widget> - </item> - <item row="0" column="1" > - <widget class="QLineEdit" name="fileTimeStartLineEdit" > - <property name="minimumSize" > - <size> - <width>50</width> - <height>0</height> - </size> - </property> - <property name="maximumSize" > - <size> - <width>100</width> - <height>16777215</height> - </size> - </property> - </widget> - </item> - <item row="1" column="0" > - <widget class="QLabel" name="fileTimeStopLabel" > - <property name="text" > - <string>time stop (sec)</string> - </property> - </widget> - </item> - <item row="1" column="1" > - <widget class="QLineEdit" name="fileTimeStopLineEdit" > - <property name="minimumSize" > - <size> - <width>50</width> - <height>0</height> - </size> - </property> - <property name="maximumSize" > - <size> - <width>100</width> - <height>16777215</height> - </size> - </property> - </widget> - </item> - <item row="2" column="0" > - <widget class="QLabel" name="fileTimeLengthLabel" > - <property name="text" > - <string>time length (sec)</string> - </property> - </widget> + </widget> + </widget> + <widget class="QGroupBox" name="displayGroupBox"> + <property name="geometry"> + <rect> + <x>730</x> + <y>0</y> + <width>170</width> + <height>120</height> + </rect> + </property> + <property name="minimumSize"> + <size> + <width>170</width> + <height>0</height> + </size> + </property> + <property name="title"> + <string>Display Properties</string> + </property> + <widget class="QWidget" name="verticalLayoutWidget"> + <property name="geometry"> + <rect> + <x>0</x> + <y>20</y> + <width>160</width> + <height>91</height> + </rect> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QComboBox" name="colorComboBox"/> </item> - <item row="2" column="1" > - <widget class="QLineEdit" name="fileTimeLengthLineEdit" > - <property name="minimumSize" > - <size> - <width>50</width> - <height>0</height> - </size> + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> </property> - <property name="maximumSize" > + <property name="sizeHint" stdset="0"> <size> - <width>100</width> - <height>16777215</height> + <width>20</width> + <height>40</height> </size> </property> - </widget> + </spacer> </item> </layout> - </item> - </layout> - </widget> - </item> - <item row="2" column="2" > - <widget class="QGroupBox" name="displayGroupBox" > - <property name="minimumSize" > - <size> - <width>170</width> - <height>0</height> - </size> - </property> - <property name="title" > - <string>Display Properties</string> - </property> - <layout class="QGridLayout" name="gridLayout_2" > - <item row="0" column="0" colspan="2" > - <widget class="QComboBox" name="colorComboBox" /> - </item> - <item row="1" column="1" > - <widget class="QSpinBox" name="lineWidthSpinBox" > - <property name="minimumSize" > - <size> - <width>100</width> - <height>0</height> - </size> - </property> - <property name="maximumSize" > - <size> - <width>100</width> - <height>16777215</height> - </size> - </property> - </widget> - </item> - <item row="1" column="0" > - <widget class="QLabel" name="lineWidthLabel" > - <property name="text" > - <string>Line Width</string> - </property> - </widget> - </item> - <item row="2" column="0" > - <widget class="QLabel" name="lineStyleLabel" > - <property name="text" > - <string>Line Style</string> - </property> - </widget> - </item> - <item row="2" column="1" > - <widget class="QComboBox" name="lineStyleComboBox" > - <property name="minimumSize" > - <size> - <width>100</width> - <height>0</height> - </size> - </property> - <property name="maximumSize" > - <size> - <width>100</width> - <height>16777215</height> - </size> - </property> - </widget> - </item> - <item row="3" column="0" > - <widget class="QLabel" name="styleSizeLabel" > - <property name="text" > - <string>Style Size</string> - </property> - </widget> - </item> - <item row="3" column="1" > - <widget class="QSpinBox" name="styleSizeSpinBox" > - <property name="minimumSize" > - <size> - <width>100</width> - <height>0</height> - </size> - </property> - <property name="maximumSize" > - <size> - <width>100</width> - <height>16777215</height> - </size> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item row="2" column="1" > - <widget class="QGroupBox" name="sysGroupBox" > - <property name="minimumSize" > - <size> - <width>200</width> - <height>0</height> - </size> - </property> - <property name="title" > - <string>System Properties</string> - </property> - <layout class="QFormLayout" name="formLayout" > - <property name="fieldGrowthPolicy" > - <enum>QFormLayout::AllNonFixedFieldsGrow</enum> - </property> - <item row="0" column="0" > - <widget class="QLabel" name="sampleRateLabel" > - <property name="text" > - <string>Sample Rate</string> - </property> - </widget> - </item> - <item row="0" column="1" > - <widget class="QLineEdit" name="sampleRateLineEdit" > - <property name="minimumSize" > - <size> - <width>50</width> - <height>0</height> - </size> - </property> - <property name="maximumSize" > - <size> - <width>100</width> - <height>16777215</height> - </size> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item row="0" column="0" colspan="3" > - <widget class="QFrame" name="frame" > - <property name="frameShape" > - <enum>QFrame::StyledPanel</enum> - </property> - <property name="frameShadow" > - <enum>QFrame::Raised</enum> - </property> - <layout class="QGridLayout" name="gridLayout_3" > - <item row="0" column="0" > - <widget class="QTabWidget" name="tabGroup" > - <property name="minimumSize" > - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="currentIndex" > - <number>0</number> - </property> - <widget class="QWidget" name="timeTab" > - <attribute name="title" > - <string>Time Domain</string> - </attribute> - <layout class="QHBoxLayout" name="horizontalLayout" > - <item> - <widget class="QwtPlot" name="timePlot" /> - </item> - </layout> - <zorder>timePlot</zorder> - </widget> - <widget class="QWidget" name="freqTab" > - <attribute name="title" > - <string>Frequency Domain</string> - </attribute> - <layout class="QHBoxLayout" name="horizontalLayout_2" > - <item> - <widget class="QGroupBox" name="fftPropBox" > - <property name="minimumSize" > - <size> - <width>160</width> - <height>0</height> - </size> - </property> - <property name="title" > - <string>FFT Properties</string> - </property> - <layout class="QFormLayout" name="formLayout_4" > - <property name="fieldGrowthPolicy" > - <enum>QFormLayout::AllNonFixedFieldsGrow</enum> - </property> - <item row="0" column="0" > - <widget class="QLabel" name="psdFFTSizeLabel" > - <property name="text" > - <string>FFT Size</string> - </property> - </widget> - </item> - <item row="0" column="1" > - <widget class="QComboBox" name="psdFFTComboBox" > - <property name="minimumSize" > - <size> - <width>96</width> - <height>0</height> - </size> - </property> - <property name="maximumSize" > - <size> - <width>96</width> - <height>16777215</height> - </size> - </property> - </widget> - </item> - </layout> - <zorder>psdFFTSizeLabel</zorder> - <zorder>psdFFTComboBox</zorder> - </widget> - </item> - <item> - <widget class="QwtPlot" name="freqPlot" /> - </item> - </layout> - </widget> - <widget class="QWidget" name="specTab" > - <attribute name="title" > - <string>Spectrogram</string> - </attribute> - <layout class="QHBoxLayout" name="horizontalLayout_3" > - <item> - <widget class="QGroupBox" name="groupBox" > - <property name="title" > - <string>Spectrogram Properties</string> - </property> - <layout class="QFormLayout" name="formLayout_3" > - <item row="1" column="0" > - <widget class="QLabel" name="specFFTLabel" > - <property name="text" > - <string>FFT Size</string> - </property> - </widget> - </item> - <item row="1" column="1" > - <widget class="QComboBox" name="specFFTComboBox" > - <property name="minimumSize" > - <size> - <width>96</width> - <height>0</height> - </size> - </property> - <property name="maximumSize" > - <size> - <width>96</width> - <height>16777215</height> - </size> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QwtPlot" name="specPlot" /> - </item> - </layout> - <zorder>specPlot</zorder> - <zorder>groupBox</zorder> - </widget> - </widget> - </item> - </layout> - <zorder>tabGroup</zorder> + </widget> + </widget> </widget> </item> </layout> </widget> - <widget class="QMenuBar" name="menubar" > - <property name="geometry" > + <widget class="QMenuBar" name="menubar"> + <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>927</width> - <height>24</height> + <height>25</height> </rect> </property> - <widget class="QMenu" name="menu_File" > - <property name="title" > + <widget class="QMenu" name="menu_File"> + <property name="title"> <string>&File</string> </property> - <addaction name="action_open" /> - <addaction name="action_reload" /> - <addaction name="action_exit" /> + <addaction name="action_open"/> + <addaction name="action_reload"/> + <addaction name="action_exit"/> </widget> - <addaction name="menu_File" /> + <addaction name="menu_File"/> </widget> - <widget class="QStatusBar" name="statusbar" /> - <action name="action_open" > - <property name="text" > + <widget class="QStatusBar" name="statusbar"/> + <action name="action_open"> + <property name="text"> <string>&Open</string> </property> - <property name="shortcut" > + <property name="shortcut"> <string>Ctrl+O</string> </property> </action> - <action name="action_exit" > - <property name="text" > + <action name="action_exit"> + <property name="text"> <string>E&xit</string> </property> </action> - <action name="action_reload" > - <property name="text" > + <action name="action_reload"> + <property name="text"> <string>&Reload</string> </property> + <property name="shortcut"> + <string>Ctrl+R</string> + </property> </action> </widget> <customwidgets> @@ -500,11 +385,11 @@ <receiver>MainWindow</receiver> <slot>close()</slot> <hints> - <hint type="sourcelabel" > + <hint type="sourcelabel"> <x>-1</x> <y>-1</y> </hint> - <hint type="destinationlabel" > + <hint type="destinationlabel"> <x>399</x> <y>347</y> </hint> diff --git a/gr-vrt/src/vrt_source_32fc.cc b/gr-vrt/src/vrt_source_32fc.cc index e56e3f2ad..f9375d31c 100644 --- a/gr-vrt/src/vrt_source_32fc.cc +++ b/gr-vrt/src/vrt_source_32fc.cc @@ -34,7 +34,7 @@ #include <iostream> #include <gruel/inet.h> #include <cstdio> - +#include <cstring> #define VERBOSE 1 // define to 0 or 1 diff --git a/gr-wxgui/src/python/common.py b/gr-wxgui/src/python/common.py index a75f6810d..17a7dc0de 100644 --- a/gr-wxgui/src/python/common.py +++ b/gr-wxgui/src/python/common.py @@ -216,12 +216,13 @@ def get_min_max(samples): @param samples the array of real values @return a tuple of min, max """ - scale_factor = 3 + factor = 2.0 mean = numpy.average(samples) - rms = numpy.max([scale_factor*((numpy.sum((samples-mean)**2)/len(samples))**.5), .1]) - min_val = mean - rms - max_val = mean + rms - return min_val, max_val + std = numpy.std(samples) + fft = numpy.abs(numpy.fft.fft(samples - mean)) + envelope = 2*numpy.max(fft)/len(samples) + ampl = max(std, envelope) or 0.1 + return mean - factor*ampl, mean + factor*ampl def get_min_max_fft(fft_samps): """ diff --git a/gr-wxgui/src/python/const_window.py b/gr-wxgui/src/python/const_window.py index b128a4a98..f7c7caf07 100644 --- a/gr-wxgui/src/python/const_window.py +++ b/gr-wxgui/src/python/const_window.py @@ -64,6 +64,8 @@ class control_panel(wx.Panel): """ self.parent = parent wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER) + parent[SHOW_CONTROL_PANEL_KEY] = True + parent.subscribe(SHOW_CONTROL_PANEL_KEY, self.Show) control_box = forms.static_box_sizer( parent=self, label='Options', bold=True, orient=wx.VERTICAL, diff --git a/gr-wxgui/src/python/constants.py b/gr-wxgui/src/python/constants.py index 8ff7fa8fe..825f71c32 100644 --- a/gr-wxgui/src/python/constants.py +++ b/gr-wxgui/src/python/constants.py @@ -69,3 +69,4 @@ MINIMUM_KEY = 'minimum' NUM_BINS_KEY = 'num_bins' FRAME_SIZE_KEY = 'frame_size' CHANNEL_OPTIONS_KEY = 'channel_options' +SHOW_CONTROL_PANEL_KEY = 'show_control_panel' diff --git a/gr-wxgui/src/python/fft_window.py b/gr-wxgui/src/python/fft_window.py index e025c28dd..4ee5520f7 100644 --- a/gr-wxgui/src/python/fft_window.py +++ b/gr-wxgui/src/python/fft_window.py @@ -64,6 +64,8 @@ class control_panel(wx.Panel): """ self.parent = parent wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER) + parent[SHOW_CONTROL_PANEL_KEY] = True + parent.subscribe(SHOW_CONTROL_PANEL_KEY, self.Show) control_box = wx.BoxSizer(wx.VERTICAL) control_box.AddStretchSpacer() #checkboxes for average and peak hold diff --git a/gr-wxgui/src/python/histo_window.py b/gr-wxgui/src/python/histo_window.py index 5f434d70e..a1b520f9c 100644 --- a/gr-wxgui/src/python/histo_window.py +++ b/gr-wxgui/src/python/histo_window.py @@ -52,6 +52,8 @@ class control_panel(wx.Panel): """ self.parent = parent wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER) + parent[SHOW_CONTROL_PANEL_KEY] = True + parent.subscribe(SHOW_CONTROL_PANEL_KEY, self.Show) control_box = wx.BoxSizer(wx.VERTICAL) SIZE = (100, -1) control_box = forms.static_box_sizer( diff --git a/gr-wxgui/src/python/number_window.py b/gr-wxgui/src/python/number_window.py index 8a8249764..ab9d1ebc0 100644 --- a/gr-wxgui/src/python/number_window.py +++ b/gr-wxgui/src/python/number_window.py @@ -58,6 +58,8 @@ class control_panel(wx.Panel): """ self.parent = parent wx.Panel.__init__(self, parent) + parent[SHOW_CONTROL_PANEL_KEY] = True + parent.subscribe(SHOW_CONTROL_PANEL_KEY, self.Show) control_box = wx.BoxSizer(wx.VERTICAL) #checkboxes for average and peak hold control_box.AddStretchSpacer() diff --git a/gr-wxgui/src/python/scope_window.py b/gr-wxgui/src/python/scope_window.py index 449046402..08a025e1e 100644 --- a/gr-wxgui/src/python/scope_window.py +++ b/gr-wxgui/src/python/scope_window.py @@ -82,6 +82,8 @@ class control_panel(wx.Panel): WIDTH = 90 self.parent = parent wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER) + parent[SHOW_CONTROL_PANEL_KEY] = True + parent.subscribe(SHOW_CONTROL_PANEL_KEY, self.Show) control_box = wx.BoxSizer(wx.VERTICAL) ################################################## # Axes Options @@ -374,6 +376,7 @@ class scope_window(wx.Panel, pubsub.pubsub): sample_rate_key, t_scale, v_scale, + v_offset, xy_mode, ac_couple_key, trigger_level_key, @@ -413,8 +416,8 @@ class scope_window(wx.Panel, pubsub.pubsub): self[X_PER_DIV_KEY] = v_scale self[Y_PER_DIV_KEY] = v_scale self[T_OFF_KEY] = 0 - self[X_OFF_KEY] = 0 - self[Y_OFF_KEY] = 0 + self[X_OFF_KEY] = v_offset + self[Y_OFF_KEY] = v_offset self[T_DIVS_KEY] = 8 self[X_DIVS_KEY] = 8 self[Y_DIVS_KEY] = 8 diff --git a/gr-wxgui/src/python/scopesink_gl.py b/gr-wxgui/src/python/scopesink_gl.py index 2882488e3..358361de6 100644 --- a/gr-wxgui/src/python/scopesink_gl.py +++ b/gr-wxgui/src/python/scopesink_gl.py @@ -71,6 +71,7 @@ class _scope_sink_base(gr.hier_block2, common.wxgui_hb): size=scope_window.DEFAULT_WIN_SIZE, v_scale=0, t_scale=0, + v_offset=0, xy_mode=False, ac_couple=False, num_inputs=1, @@ -119,6 +120,7 @@ class _scope_sink_base(gr.hier_block2, common.wxgui_hb): sample_rate_key=SAMPLE_RATE_KEY, t_scale=t_scale, v_scale=v_scale, + v_offset=v_offset, xy_mode=xy_mode, ac_couple_key=AC_COUPLE_KEY, trigger_level_key=TRIGGER_LEVEL_KEY, diff --git a/gr-wxgui/src/python/waterfall_window.py b/gr-wxgui/src/python/waterfall_window.py index 28e67a830..b7904e4d9 100644 --- a/gr-wxgui/src/python/waterfall_window.py +++ b/gr-wxgui/src/python/waterfall_window.py @@ -41,6 +41,7 @@ DEFAULT_FRAME_RATE = gr.prefs().get_long('wxgui', 'waterfall_rate', 30) DEFAULT_WIN_SIZE = (600, 300) DIV_LEVELS = (1, 2, 5, 10, 20) MIN_DYNAMIC_RANGE, MAX_DYNAMIC_RANGE = 10, 200 +DYNAMIC_RANGE_STEP = 10. COLOR_MODES = ( ('RGB1', 'rgb1'), ('RGB2', 'rgb2'), @@ -63,6 +64,8 @@ class control_panel(wx.Panel): """ self.parent = parent wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER) + parent[SHOW_CONTROL_PANEL_KEY] = True + parent.subscribe(SHOW_CONTROL_PANEL_KEY, self.Show) control_box = wx.BoxSizer(wx.VERTICAL) control_box.AddStretchSpacer() options_box = forms.static_box_sizer( @@ -143,13 +146,13 @@ class control_panel(wx.Panel): def _on_clear_button(self, event): self.parent[NUM_LINES_KEY] = self.parent[NUM_LINES_KEY] def _on_incr_dynamic_range(self, event): - self.parent[DYNAMIC_RANGE_KEY] = min(self.parent[DYNAMIC_RANGE_KEY] + 10, MAX_DYNAMIC_RANGE) + self.parent[DYNAMIC_RANGE_KEY] = min(MAX_DYNAMIC_RANGE, common.get_clean_incr(self.parent[DYNAMIC_RANGE_KEY])) def _on_decr_dynamic_range(self, event): - self.parent[DYNAMIC_RANGE_KEY] = max(self.parent[DYNAMIC_RANGE_KEY] - 10, MIN_DYNAMIC_RANGE) + self.parent[DYNAMIC_RANGE_KEY] = max(MIN_DYNAMIC_RANGE, common.get_clean_decr(self.parent[DYNAMIC_RANGE_KEY])) def _on_incr_ref_level(self, event): - self.parent[REF_LEVEL_KEY] = self.parent[REF_LEVEL_KEY] + self.parent[DYNAMIC_RANGE_KEY]*.1 + self.parent[REF_LEVEL_KEY] = self.parent[REF_LEVEL_KEY] + self.parent[DYNAMIC_RANGE_KEY]/DYNAMIC_RANGE_STEP def _on_decr_ref_level(self, event): - self.parent[REF_LEVEL_KEY] = self.parent[REF_LEVEL_KEY] - self.parent[DYNAMIC_RANGE_KEY]*.1 + self.parent[REF_LEVEL_KEY] = self.parent[REF_LEVEL_KEY] - self.parent[DYNAMIC_RANGE_KEY]/DYNAMIC_RANGE_STEP def _on_incr_time_scale(self, event): old_rate = self.parent[FRAME_RATE_KEY] self.parent[FRAME_RATE_KEY] *= 0.75 @@ -239,8 +242,8 @@ class waterfall_window(wx.Panel, pubsub.pubsub): if not len(self.samples): return min_level, max_level = common.get_min_max_fft(self.samples) #set the range and level - self[REF_LEVEL_KEY] = max_level - self[DYNAMIC_RANGE_KEY] = max_level - min_level + self[DYNAMIC_RANGE_KEY] = common.get_clean_num(max_level - min_level) + self[REF_LEVEL_KEY] = DYNAMIC_RANGE_STEP*round(.5+max_level/DYNAMIC_RANGE_STEP) def handle_msg(self, msg): """ diff --git a/grc/Makefile.am b/grc/Makefile.am index 28408c4a8..30b955a1e 100644 --- a/grc/Makefile.am +++ b/grc/Makefile.am @@ -25,7 +25,6 @@ if PYTHON SUBDIRS = \ base \ blocks \ - examples \ grc_gnuradio \ gui \ python \ diff --git a/grc/blocks/Makefile.am b/grc/blocks/Makefile.am index df3479761..61c003803 100644 --- a/grc/blocks/Makefile.am +++ b/grc/blocks/Makefile.am @@ -145,6 +145,7 @@ dist_ourdata_DATA = \ gr_packed_to_unpacked_xx.xml \ gr_peak_detector2_fb.xml \ gr_peak_detector_xb.xml \ + gr_pfb_clock_sync.xml \ gr_phase_modulator_fc.xml \ gr_pll_carriertracking_cc.xml \ gr_pll_freqdet_cf.xml \ @@ -167,6 +168,7 @@ dist_ourdata_DATA = \ gr_simple_squelch_cc.xml \ gr_single_pole_iir_filter_xx.xml \ gr_skiphead.xml \ + gr_stream_mux.xml \ gr_stream_to_streams.xml \ gr_stream_to_vector.xml \ gr_streams_to_stream.xml \ diff --git a/grc/blocks/block_tree.xml b/grc/blocks/block_tree.xml index 6fec0be67..187ca196a 100644 --- a/grc/blocks/block_tree.xml +++ b/grc/blocks/block_tree.xml @@ -109,8 +109,10 @@ <block>gr_stream_to_vector</block> <block>gr_vector_to_stream</block> - + <block>blks2_stream_to_vector_decimator</block> + + <block>gr_stream_mux</block> </cat> <cat> <name>Misc Conversions</name> @@ -124,6 +126,7 @@ <cat> <name>Synchronizers</name> <block>gr_clock_recovery_mm_xx</block> + <block>gr_pfb_clock_sync_ccf</block> <block>gr_costas_loop_cc</block> <block>gr_dd_mpsk_sync_cc</block> @@ -167,7 +170,7 @@ <block>band_pass_filter</block> <block>band_reject_filter</block> <block>root_raised_cosine_filter</block> - <!-- Filters that take taps as aruments --> + <!-- Filters that take taps as arguments --> <block>gr_fir_filter_xxx</block> <block>gr_interp_fir_filter_xxx</block> <block>gr_fft_filter_xxx</block> @@ -178,7 +181,7 @@ <!-- Filter banks --> <block>blks2_synthesis_filterbank</block> <block>blks2_analysis_filterbank</block> - <!-- Polyphase filers --> + <!-- Polyphase filters --> <block>blks2_pfb_arb_resampler_ccf</block> <!-- Other filters --> <block>gr_single_pole_iir_filter_xx</block> diff --git a/grc/blocks/gr_chunks_to_symbols.xml b/grc/blocks/gr_chunks_to_symbols.xml index b54e710ef..e9da38e9a 100644 --- a/grc/blocks/gr_chunks_to_symbols.xml +++ b/grc/blocks/gr_chunks_to_symbols.xml @@ -57,12 +57,21 @@ <value>2</value> <type>int</type> </param> + <param> + <name>Num Ports</name> + <key>num_ports</key> + <value>1</value> + <type>int</type> + </param> + <check>$num_ports > 0</check> <sink> <name>in</name> <type>$in_type</type> + <nports>$num_ports</nports> </sink> <source> <name>out</name> <type>$out_type</type> + <nports>$num_ports</nports> </source> </block> diff --git a/grc/blocks/gr_copy.xml b/grc/blocks/gr_copy.xml index 757f14303..8b12eaca7 100644 --- a/grc/blocks/gr_copy.xml +++ b/grc/blocks/gr_copy.xml @@ -46,6 +46,14 @@ self.$(id).set_enabled($enabled)</make> <key>enabled</key> <value>True</value> <type>bool</type> + <option> + <name>Enabled</name> + <key>True</key> + </option> + <option> + <name>Disabled</name> + <key>False</key> + </option> </param> <param> <name>Vec Length</name> diff --git a/grc/blocks/gr_delay.xml b/grc/blocks/gr_delay.xml index 64a774def..5cc411a78 100644 --- a/grc/blocks/gr_delay.xml +++ b/grc/blocks/gr_delay.xml @@ -47,20 +47,29 @@ <type>int</type> </param> <param> + <name>Num Ports</name> + <key>num_ports</key> + <value>1</value> + <type>int</type> + </param> + <param> <name>Vec Length</name> <key>vlen</key> <value>1</value> <type>int</type> </param> + <check>$num_ports > 0</check> <check>$vlen > 0</check> <sink> <name>in</name> <type>$type</type> <vlen>$vlen</vlen> + <nports>$num_ports</nports> </sink> <source> <name>out</name> <type>$type</type> <vlen>$vlen</vlen> + <nports>$num_ports</nports> </source> </block> diff --git a/grc/blocks/gr_packed_to_unpacked_xx.xml b/grc/blocks/gr_packed_to_unpacked_xx.xml index 5fd9729a4..c1477dd9c 100644 --- a/grc/blocks/gr_packed_to_unpacked_xx.xml +++ b/grc/blocks/gr_packed_to_unpacked_xx.xml @@ -38,7 +38,7 @@ <param> <name>Endianness</name> <key>endianness</key> - <type>enum</type> + <type>int</type> <option> <name>MSB</name> <key>gr.GR_MSB_FIRST</key> @@ -48,12 +48,21 @@ <key>gr.GR_LSB_FIRST</key> </option> </param> + <param> + <name>Num Ports</name> + <key>num_ports</key> + <value>1</value> + <type>int</type> + </param> + <check>$num_ports > 0</check> <sink> <name>in</name> <type>$type</type> + <nports>$num_ports</nports> </sink> <source> <name>out</name> <type>$type</type> + <nports>$num_ports</nports> </source> </block> diff --git a/grc/blocks/gr_pfb_clock_sync.xml b/grc/blocks/gr_pfb_clock_sync.xml new file mode 100644 index 000000000..9cb909acd --- /dev/null +++ b/grc/blocks/gr_pfb_clock_sync.xml @@ -0,0 +1,75 @@ +<?xml version="1.0"?> +<!-- +################################################### +## Polyphase Filter based Clock Sync +################################################### + --> +<block> + <name>Polyphase Clock Sync</name> + <key>gr_pfb_clock_sync_ccf</key> + <import>from gnuradio import gr</import> + <make>gr.pfb_clock_sync_ccf($sps, $alpha, $taps, $filter_size, $init_phase, $max_dev) +self.$(id).set_beta($beta)</make> + <callback>set_taps($taps)</callback> + <callback>set_alpha($alpha)</callback> + <callback>set_beta($beta)</callback> + + <param> + <name>Samples/Symbol</name> + <key>sps</key> + <type>real</type> + </param> + <param> + <name>Alpha</name> + <key>alpha</key> + <type>real</type> + </param> + <param> + <name>Beta</name> + <key>beta</key> + <type>real</type> + </param> + <param> + <name>Taps</name> + <key>taps</key> + <type>real_vector</type> + </param> + <param> + <name>Filter Size</name> + <key>filter_size</key> + <type>int</type> + </param> + <param> + <name>Initial Phase</name> + <key>init_phase</key> + <type>real</type> + </param> + <param> + <name>Maximum Rate Deviation</name> + <key>max_dev</key> + <type>real</type> + </param> + <sink> + <name>in</name> + <type>complex</type> + </sink> + <source> + <name>out</name> + <type>complex</type> + </source> + <source> + <name>err</name> + <type>float</type> + <optional>1</optional> + </source> + <source> + <name>rate</name> + <type>float</type> + <optional>1</optional> + </source> + <source> + <name>phase</name> + <type>float</type> + <optional>1</optional> + </source> +</block> diff --git a/grc/blocks/gr_stream_mux.xml b/grc/blocks/gr_stream_mux.xml new file mode 100644 index 000000000..8efe7b655 --- /dev/null +++ b/grc/blocks/gr_stream_mux.xml @@ -0,0 +1,75 @@ +<?xml version="1.0"?> +<!-- +################################################### +##Stream Mux: +## all types, many inputs, only one output +################################################### + --> +<block> + <name>Stream Mux</name> + <key>gr_stream_mux</key> + <import>from gnuradio import gr</import> + <make>gr.stream_mux($type.size*$vlen, $lengths)</make> + <param> + <name>Type</name> + <key>type</key> + <type>enum</type> + <option> + <name>Complex</name> + <key>complex</key> + <opt>size:gr.sizeof_gr_complex</opt> + </option> + <option> + <name>Float</name> + <key>float</key> + <opt>size:gr.sizeof_float</opt> + </option> + <option> + <name>Int</name> + <key>int</key> + <opt>size:gr.sizeof_int</opt> + </option> + <option> + <name>Short</name> + <key>short</key> + <opt>size:gr.sizeof_short</opt> + </option> + <option> + <name>Byte</name> + <key>byte</key> + <opt>size:gr.sizeof_char</opt> + </option> + </param> + <param> + <name>Lengths</name> + <key>lengths</key> + <value>1, 1</value> + <type>int_vector</type> + </param> + <param> + <name>Num Inputs</name> + <key>num_inputs</key> + <value>2</value> + <type>int</type> + </param> + <param> + <name>Vec Length</name> + <key>vlen</key> + <value>1</value> + <type>int</type> + </param> + <check>$num_inputs > 0</check> + <check>$num_inputs == len($lengths)</check> + <check>$vlen > 0</check> + <sink> + <name>in</name> + <type>$type</type> + <vlen>$vlen</vlen> + <nports>$num_inputs</nports> + </sink> + <source> + <name>out</name> + <type>$type</type> + <vlen>$vlen</vlen> + </source> +</block> diff --git a/grc/blocks/gr_unpacked_to_packed_xx.xml b/grc/blocks/gr_unpacked_to_packed_xx.xml index f7457eb5c..427c80082 100644 --- a/grc/blocks/gr_unpacked_to_packed_xx.xml +++ b/grc/blocks/gr_unpacked_to_packed_xx.xml @@ -38,7 +38,7 @@ <param> <name>Endianness</name> <key>endianness</key> - <type>enum</type> + <type>int</type> <option> <name>MSB</name> <key>gr.GR_MSB_FIRST</key> @@ -48,12 +48,21 @@ <key>gr.GR_LSB_FIRST</key> </option> </param> + <param> + <name>Num Ports</name> + <key>num_ports</key> + <value>1</value> + <type>int</type> + </param> + <check>$num_ports > 0</check> <sink> <name>in</name> <type>$type</type> + <nports>$num_ports</nports> </sink> <source> <name>out</name> <type>$type</type> + <nports>$num_ports</nports> </source> </block> diff --git a/grc/blocks/usrp2_sink_xxxx.xml b/grc/blocks/usrp2_sink_xxxx.xml index f2ee4d151..14586cc36 100644 --- a/grc/blocks/usrp2_sink_xxxx.xml +++ b/grc/blocks/usrp2_sink_xxxx.xml @@ -36,11 +36,13 @@ self.$(id).set_center_freq($frequency)</callback> <name>Complex</name> <key>complex</key> <opt>fcn:32fc</opt> + <opt>vlen:1</opt> </option> <option> <name>Short</name> <key>short</key> <opt>fcn:16sc</opt> + <opt>vlen:2</opt> </option> </param> <param> @@ -85,6 +87,7 @@ self.$(id).set_center_freq($frequency)</callback> <sink> <name>in</name> <type>$type</type> + <vlen>$type.vlen</vlen> </sink> <doc> The USRP2 sink inputs 100 Megasamples per second / interpolation. diff --git a/grc/blocks/usrp2_source_xxxx.xml b/grc/blocks/usrp2_source_xxxx.xml index 02046e609..0f297dfd1 100644 --- a/grc/blocks/usrp2_source_xxxx.xml +++ b/grc/blocks/usrp2_source_xxxx.xml @@ -36,11 +36,13 @@ self.$(id).set_center_freq($frequency)</callback> <name>Complex</name> <key>complex</key> <opt>fcn:32fc</opt> + <opt>vlen:1</opt> </option> <option> <name>Short</name> <key>short</key> <opt>fcn:16sc</opt> + <opt>vlen:2</opt> </option> </param> <param> @@ -85,6 +87,7 @@ self.$(id).set_center_freq($frequency)</callback> <source> <name>out</name> <type>$type</type> + <vlen>$type.vlen</vlen> </source> <doc> The USRP2 source outputs 100 Megasamples per second / decimation. diff --git a/grc/blocks/wxgui_constellationsink2.xml b/grc/blocks/wxgui_constellationsink2.xml index 5969d8405..598b55064 100644 --- a/grc/blocks/wxgui_constellationsink2.xml +++ b/grc/blocks/wxgui_constellationsink2.xml @@ -23,6 +23,9 @@ constsink_gl.const_sink_c( gain_mu=$gain_mu, symbol_rate=$symbol_rate, omega_limit=$omega_limit, +#if $win_size() + size=$win_size, +#end if ) #if not $grid_pos() $(parent).Add(self.$(id).win) @@ -103,6 +106,13 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos())))) <type>real</type> </param> <param> + <name>Window Size</name> + <key>win_size</key> + <value></value> + <type>int_vector</type> + <hide>#if $win_size() then 'none' else 'part'#</hide> + </param> + <param> <name>Grid Position</name> <key>grid_pos</key> <value></value> @@ -114,11 +124,14 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos())))) <value></value> <type>notebook</type> </param> + <check>not $win_size or len($win_size) == 2</check> <sink> <name>in</name> <type>complex</type> </sink> <doc> +Leave the window blank for the default size, otherwise enter a tuple of (width, height) pixels. + Use the Grid Position (row, column, row span, column span) to position the graphical element in the window. Use the Notebook Param (notebook-id, page-index) to place the graphical element inside of a notebook page. diff --git a/grc/blocks/wxgui_fftsink2.xml b/grc/blocks/wxgui_fftsink2.xml index 6f19f1aa4..42bca5ccf 100644 --- a/grc/blocks/wxgui_fftsink2.xml +++ b/grc/blocks/wxgui_fftsink2.xml @@ -23,6 +23,9 @@ fftsink2.$(type.fcn)( avg_alpha=#if $avg_alpha() then $avg_alpha else 'None'#, title=$title, peak_hold=$peak_hold, +#if $win_size() + size=$win_size, +#end if ) #if not $grid_pos() $(parent).Add(self.$(id).win) @@ -159,6 +162,13 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos())))) <hide>#if $average() == 'True' then 'none' else 'all'#</hide> </param> <param> + <name>Window Size</name> + <key>win_size</key> + <value></value> + <type>int_vector</type> + <hide>#if $win_size() then 'none' else 'part'#</hide> + </param> + <param> <name>Grid Position</name> <key>grid_pos</key> <value></value> @@ -170,6 +180,7 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos())))) <value></value> <type>notebook</type> </param> + <check>not $win_size or len($win_size) == 2</check> <sink> <name>in</name> <type>$type</type> @@ -177,6 +188,8 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos())))) <doc> Set Average Alpha to 0 for automatic setting. +Leave the window blank for the default size, otherwise enter a tuple of (width, height) pixels. + Use the Grid Position (row, column, row span, column span) to position the graphical element in the window. Use the Notebook Param (notebook-id, page-index) to place the graphical element inside of a notebook page. diff --git a/grc/blocks/wxgui_histosink2.xml b/grc/blocks/wxgui_histosink2.xml index 454a4932c..9edf9650d 100644 --- a/grc/blocks/wxgui_histosink2.xml +++ b/grc/blocks/wxgui_histosink2.xml @@ -14,6 +14,9 @@ histosink_gl.histo_sink_f( title=$title, num_bins=$num_bins, frame_size=$frame_size, +#if $win_size() + size=$win_size, +#end if ) #if not $grid_pos() $(parent).Add(self.$(id).win) @@ -41,6 +44,13 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos())))) <type>int</type> </param> <param> + <name>Window Size</name> + <key>win_size</key> + <value></value> + <type>int_vector</type> + <hide>#if $win_size() then 'none' else 'part'#</hide> + </param> + <param> <name>Grid Position</name> <key>grid_pos</key> <value></value> @@ -52,11 +62,14 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos())))) <value></value> <type>notebook</type> </param> + <check>not $win_size or len($win_size) == 2</check> <sink> <name>in</name> <type>float</type> </sink> <doc> +Leave the window blank for the default size, otherwise enter a tuple of (width, height) pixels. + Use the Grid Position (row, column, row span, column span) to position the graphical element in the window. Use the Notebook Param (notebook-id, page-index) to place the graphical element inside of a notebook page. diff --git a/grc/blocks/wxgui_numbersink2.xml b/grc/blocks/wxgui_numbersink2.xml index cc66cdcb0..5289db8af 100644 --- a/grc/blocks/wxgui_numbersink2.xml +++ b/grc/blocks/wxgui_numbersink2.xml @@ -24,6 +24,9 @@ numbersink2.$(type.fcn)( label=$title, peak_hold=$peak_hold, show_gauge=$show_gauge, +#if $win_size() + size=$win_size, +#end if ) #if not $grid_pos() $(parent).Add(self.$(id).win) @@ -152,6 +155,13 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos())))) </option> </param> <param> + <name>Window Size</name> + <key>win_size</key> + <value></value> + <type>int_vector</type> + <hide>#if $win_size() then 'none' else 'part'#</hide> + </param> + <param> <name>Grid Position</name> <key>grid_pos</key> <value></value> @@ -163,6 +173,7 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos())))) <value></value> <type>notebook</type> </param> + <check>not $win_size or len($win_size) == 2</check> <sink> <name>in</name> <type>$type</type> @@ -170,6 +181,8 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos())))) <doc> Set Average Alpha to 0 for automatic setting. +Leave the window blank for the default size, otherwise enter a tuple of (width, height) pixels. + Use the Grid Position (row, column, row span, column span) to position the graphical element in the window. Use the Notebook Param (notebook-id, page-index) to place the graphical element inside of a notebook page. diff --git a/grc/blocks/wxgui_scopesink2.xml b/grc/blocks/wxgui_scopesink2.xml index 503d52972..eba45f489 100644 --- a/grc/blocks/wxgui_scopesink2.xml +++ b/grc/blocks/wxgui_scopesink2.xml @@ -15,10 +15,14 @@ scopesink2.$(type.fcn)( title=$title, sample_rate=$samp_rate, v_scale=$v_scale, + v_offset=$v_offset, t_scale=$t_scale, ac_couple=$ac_couple, xy_mode=$xy_mode, num_inputs=$num_inputs, +#if $win_size() + size=$win_size, +#end if ) #if not $grid_pos() $(parent).Add(self.$(id).win) @@ -59,19 +63,28 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos())))) <key>v_scale</key> <value>0</value> <type>real</type> + <hide>#if $v_scale() then 'none' else 'part'#</hide> + </param> + <param> + <name>V Offset</name> + <key>v_offset</key> + <value>0</value> + <type>real</type> + <hide>#if $v_offset() then 'none' else 'part'#</hide> </param> <param> <name>T Scale</name> <key>t_scale</key> <value>0</value> <type>real</type> + <hide>#if $t_scale() then 'none' else 'part'#</hide> </param> <param> <name>AC Couple</name> <key>ac_couple</key> <value>False</value> - <type>enum</type> - <hide>#if $ac_couple() == 'True' then 'none' else 'part'#</hide> + <type>bool</type> + <hide>#if $ac_couple() then 'none' else 'part'#</hide> <option> <name>Off</name> <key>False</key> @@ -103,6 +116,13 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos())))) <type>int</type> </param> <param> + <name>Window Size</name> + <key>win_size</key> + <value></value> + <type>int_vector</type> + <hide>#if $win_size() then 'none' else 'part'#</hide> + </param> + <param> <name>Grid Position</name> <key>grid_pos</key> <value></value> @@ -114,6 +134,7 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos())))) <value></value> <type>notebook</type> </param> + <check>not $win_size or len($win_size) == 2</check> <check>not $xy_mode or '$type' == 'complex' or $num_inputs != 1</check> <sink> <name>in</name> @@ -127,6 +148,8 @@ Set the T Scale to 0 for automatic setting. XY Mode allows the scope to initialize as an XY plotter. +Leave the window blank for the default size, otherwise enter a tuple of (width, height) pixels. + Use the Grid Position (row, column, row span, column span) to position the graphical element in the window. Use the Notebook Param (notebook-id, page-index) to place the graphical element inside of a notebook page. diff --git a/grc/blocks/wxgui_waterfallsink2.xml b/grc/blocks/wxgui_waterfallsink2.xml index 35790f820..cee598990 100644 --- a/grc/blocks/wxgui_waterfallsink2.xml +++ b/grc/blocks/wxgui_waterfallsink2.xml @@ -21,6 +21,9 @@ waterfallsink2.$(type.fcn)( average=$options.average, avg_alpha=#if $avg_alpha() then $avg_alpha else 'None'#, title=$title, +#if $win_size() + size=$win_size, +#end if ) #if not $grid_pos() $(parent).Add(self.$(id).win) @@ -116,6 +119,13 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos())))) </option> </param> <param> + <name>Window Size</name> + <key>win_size</key> + <value></value> + <type>int_vector</type> + <hide>#if $win_size() then 'none' else 'part'#</hide> + </param> + <param> <name>Grid Position</name> <key>grid_pos</key> <value></value> @@ -127,6 +137,7 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos())))) <value></value> <type>notebook</type> </param> + <check>not $win_size or len($win_size) == 2</check> <sink> <name>in</name> <type>$type</type> @@ -134,6 +145,8 @@ $(parent).GridAdd(self.$(id).win, $(', '.join(map(str, $grid_pos())))) <doc> Set Average Alpha to 0 for automatic setting. +Leave the window blank for the default size, otherwise enter a tuple of (width, height) pixels. + Use the Grid Position (row, column, row span, column span) to position the graphical element in the window. Use the Notebook Param (notebook-id, page-index) to place the graphical element inside of a notebook page. diff --git a/grc/examples/audio/.gitignore b/grc/examples/audio/.gitignore deleted file mode 100644 index b336cc7ce..000000000 --- a/grc/examples/audio/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/Makefile -/Makefile.in diff --git a/grc/examples/simple/.gitignore b/grc/examples/simple/.gitignore deleted file mode 100644 index b336cc7ce..000000000 --- a/grc/examples/simple/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/Makefile -/Makefile.in diff --git a/grc/examples/trellis/.gitignore b/grc/examples/trellis/.gitignore deleted file mode 100644 index b336cc7ce..000000000 --- a/grc/examples/trellis/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/Makefile -/Makefile.in diff --git a/grc/examples/usrp/.gitignore b/grc/examples/usrp/.gitignore deleted file mode 100644 index b336cc7ce..000000000 --- a/grc/examples/usrp/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/Makefile -/Makefile.in diff --git a/grc/examples/xmlrpc/.gitignore b/grc/examples/xmlrpc/.gitignore deleted file mode 100644 index b336cc7ce..000000000 --- a/grc/examples/xmlrpc/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/Makefile -/Makefile.in diff --git a/grc/gui/BlockTreeWindow.py b/grc/gui/BlockTreeWindow.py index 07b8ea7e0..c12120eaf 100644 --- a/grc/gui/BlockTreeWindow.py +++ b/grc/gui/BlockTreeWindow.py @@ -64,6 +64,9 @@ class BlockTreeWindow(gtk.VBox): renderer = gtk.CellRendererText() column = gtk.TreeViewColumn('Blocks', renderer, text=NAME_INDEX) self.treeview.append_column(column) + #setup the search + self.treeview.set_enable_search(True) + self.treeview.set_search_equal_func(self._handle_search) #try to enable the tooltips (available in pygtk 2.12 and above) try: self.treeview.set_tooltip_column(DOC_INDEX) except: pass @@ -145,6 +148,22 @@ class BlockTreeWindow(gtk.VBox): ############################################################ ## Event Handlers ############################################################ + def _handle_search(self, model, column, key, iter): + #determine which blocks match the search key + blocks = self.get_flow_graph().get_parent().get_blocks() + matching_blocks = filter(lambda b: key in b.get_key() or key in b.get_name().lower(), blocks) + #remove the old search category + try: self.treestore.remove(self._categories.pop((self._search_category, ))) + except (KeyError, AttributeError): pass #nothing to remove + #create a search category + if not matching_blocks: return + self._search_category = 'Search: %s'%key + for block in matching_blocks: self.add_block(self._search_category, block) + #expand the search category + path = self.treestore.get_path(self._categories[(self._search_category, )]) + self.treeview.collapse_all() + self.treeview.expand_row(path, open_all=False) + def _handle_drag_get_data(self, widget, drag_context, selection_data, info, time): """ Handle a drag and drop by setting the key to the selection object. diff --git a/grc/python/Param.py b/grc/python/Param.py index 34d5ab116..81fb6ba7a 100644 --- a/grc/python/Param.py +++ b/grc/python/Param.py @@ -251,7 +251,7 @@ class Param(_Param, _GUIParam): ######################### # Numeric Types ######################### - elif t in ('raw', 'complex', 'real', 'int', 'complex_vector', 'real_vector', 'int_vector', 'hex', 'bool'): + elif t in ('raw', 'complex', 'real', 'int', 'hex', 'bool'): #raise exception if python cannot evaluate this value try: e = self.get_parent().get_parent().evaluate(v) except Exception, e: raise Exception, 'Value "%s" cannot be evaluated:\n%s'%(v, e) @@ -269,10 +269,22 @@ class Param(_Param, _GUIParam): try: assert isinstance(e, INT_TYPES) except AssertionError: raise Exception, 'Expression "%s" is invalid for type integer.'%str(e) return e - ######################### - # Numeric Vector Types - ######################### - elif t == 'complex_vector': + elif t == 'hex': return hex(e) + elif t == 'bool': + try: assert isinstance(e, bool) + except AssertionError: raise Exception, 'Expression "%s" is invalid for type bool.'%str(e) + return e + else: raise TypeError, 'Type "%s" not handled'%t + ######################### + # Numeric Vector Types + ######################### + elif t in ('complex_vector', 'real_vector', 'int_vector'): + if not v: v = '()' #turn a blank string into an empty list, so it will eval + #raise exception if python cannot evaluate this value + try: e = self.get_parent().get_parent().evaluate(v) + except Exception, e: raise Exception, 'Value "%s" cannot be evaluated:\n%s'%(v, e) + #raise an exception if the data is invalid + if t == 'complex_vector': if not isinstance(e, VECTOR_TYPES): self._lisitify_flag = True e = [e] @@ -296,12 +308,6 @@ class Param(_Param, _GUIParam): for ei in e: assert isinstance(ei, INT_TYPES) except AssertionError: raise Exception, 'Expression "%s" is invalid for type integer vector.'%str(e) return e - elif t == 'hex': return hex(e) - elif t == 'bool': - try: assert isinstance(e, bool) - except AssertionError: raise Exception, 'Expression "%s" is invalid for type bool.'%str(e) - return e - else: raise TypeError, 'Type "%s" not handled'%t ######################### # String Types ######################### diff --git a/grc/python/extract_docs.py b/grc/python/extract_docs.py index f0c1e749c..f41f415b2 100644 --- a/grc/python/extract_docs.py +++ b/grc/python/extract_docs.py @@ -63,7 +63,7 @@ def _extract(key): #extract descriptions comp_name = extract_txt(xml.xpath(DOXYGEN_NAME_XPATH)[0]).strip() comp_name = ' --- ' + comp_name + ' --- ' - if re.match('(gr|usrp2|trellis)_.*', key): + if re.match('(gr|usrp2|trellis|noaa)_.*', key): brief_desc = extract_txt(xml.xpath(DOXYGEN_BRIEFDESC_GR_XPATH)[0]).strip() detailed_desc = extract_txt(xml.xpath(DOXYGEN_DETAILDESC_GR_XPATH)[0]).strip() else: diff --git a/grc/todo.txt b/grc/todo.txt index b4e3af39d..e4fd4647a 100644 --- a/grc/todo.txt +++ b/grc/todo.txt @@ -35,7 +35,6 @@ * remove blocks in block tree covered by doxygen * param editor, expand entry boxes in focus * change param dialog to panel within main window -* search for blocks in category window * gui grid editor for configuring grid params/placing wxgui plots and controls * drag from one port to another to connect * per parameter docs diff --git a/gruel/src/lib/Makefile.am b/gruel/src/lib/Makefile.am index 9afa0d292..b21f8023c 100644 --- a/gruel/src/lib/Makefile.am +++ b/gruel/src/lib/Makefile.am @@ -58,5 +58,5 @@ libgruel_la_LIBADD = \ # ---------------------------------------------------------------- test_gruel_SOURCES = test_gruel.cc -test_gruel_LDADD = libgruel.la pmt/libpmt-qa.la +test_gruel_LDADD = pmt/libpmt-qa.la libgruel.la diff --git a/usrp/doc/Makefile.am b/usrp/doc/Makefile.am index 1c01e43fa..6099ebb72 100644 --- a/usrp/doc/Makefile.am +++ b/usrp/doc/Makefile.am @@ -25,7 +25,7 @@ include $(top_srcdir)/Makefile.common SUBDIRS = other man3dir = $(mandir)/man3 -usrp_docdir = $(prefix)/share/doc/usrp-@VERSION@ +usrp_docdir = $(prefix)/share/doc/usrp-$(DOCVER) EXTRA_DIST = \ Doxyfile.in \ diff --git a/usrp/host/apps/Makefile.am b/usrp/host/apps/Makefile.am index b0c21d55f..8aa361b22 100644 --- a/usrp/host/apps/Makefile.am +++ b/usrp/host/apps/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2003,2006,2008 Free Software Foundation, Inc. +# Copyright 2003,2006,2008,2009 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -22,7 +22,7 @@ include $(top_srcdir)/Makefile.common AM_CPPFLAGS = $(USRP_INCLUDES) $(BOOST_CPPFLAGS) $(CPPUNIT_INCLUDES) \ - $(WITH_INCLUDES) + $(USB_INCLUDES) $(WITH_INCLUDES) bin_PROGRAMS = \ usrper \ diff --git a/usrp/host/apps/burn-db-eeprom b/usrp/host/apps/burn-db-eeprom index 34f4c7015..7ff1e9736 100755 --- a/usrp/host/apps/burn-db-eeprom +++ b/usrp/host/apps/burn-db-eeprom @@ -1,24 +1,24 @@ #!/usr/bin/env python # -# Copyright 2005,2007 Free Software Foundation, Inc. -# +# Copyright 2005,2007,2009 Free Software Foundation, Inc. +# # This file is part of GNU Radio -# +# # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. -# +# # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. -# +# from usrpm.usrp_prims import * from optparse import OptionParser @@ -69,6 +69,7 @@ daughterboards = { 'lftx' : ((LF_TX, 0x0000), None), 'lfrx' : (None, (LF_RX, 0x0000)), 'wbx_lo' : ((WBX_LO_TX, 0x0000), (WBX_LO_RX, 0x0000)), + 'wbx_ng' : ((WBX_NG_TX, 0x0000), (WBX_NG_RX, 0x0000)), 'xcvr2450' : ((XCVR2450_TX, 0x0000), (XCVR2450_RX, 0x0000)), 'experimental_tx' : ((EXPERIMENTAL_TX, 0x0000), None), 'experimental_rx' : (None, (EXPERIMENTAL_RX, 0x0000)), @@ -104,11 +105,11 @@ def init_eeprom(u, slot_name, force, dbid, oe): if not e: print "%s: no d'board, skipped" % (slot_name,) return True - + if not force and (sum (map (ord, e)) & 0xff) == 0 and ord (e[0]) == 0xDB: print "%s: already initialized, skipped" % (slot_name,) return True - + if not write_dboard_eeprom (u, i2c_addr, dbid, oe): print "%s: failed to write d'board EEPROM" % (slot_name,) return False @@ -168,4 +169,4 @@ and at least one side using -A and/or -B.""" if __name__ == "__main__": main () - + diff --git a/usrp/host/include/usrp/Makefile.am b/usrp/host/include/usrp/Makefile.am index 769acc774..cfce51443 100644 --- a/usrp/host/include/usrp/Makefile.am +++ b/usrp/host/include/usrp/Makefile.am @@ -1,23 +1,23 @@ # # Copyright 2009 Free Software Foundation, Inc. -# +# # This file is part of GNU Radio -# +# # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. -# +# # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with GNU Radio; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. -# +# include $(top_srcdir)/Makefile.common @@ -32,7 +32,8 @@ usrpinclude_HEADERS = \ db_flexrf.h \ db_flexrf_mimo.h \ db_tv_rx.h \ - db_tv_rx_mimo.h \ + db_tv_rx_mimo.h \ + db_wbxng.h \ db_xcvr2450.h \ libusb_types.h \ usrp_basic.h \ diff --git a/usrp/host/include/usrp/db_wbxng.h b/usrp/host/include/usrp/db_wbxng.h new file mode 100644 index 000000000..8611d4787 --- /dev/null +++ b/usrp/host/include/usrp/db_wbxng.h @@ -0,0 +1,115 @@ +/* -*- c++ -*- */ +// +// Copyright 2009 Free Software Foundation, Inc. +// +// This file is part of GNU Radio +// +// GNU Radio is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either asversion 3, or (at your option) +// any later version. +// +// GNU Radio is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with GNU Radio; see the file COPYING. If not, write to +// the Free Software Foundation, Inc., 51 Franklin Street, +// Boston, MA 02110-1301, USA. + +#ifndef INCLUDED_DB_WBXNG_H +#define INCLUDED_DB_WBXNG_H + +#include <usrp/db_base.h> +#include <cmath> + +class adf4350; + +class wbxng_base : public db_base +{ +public: + wbxng_base(usrp_basic_sptr usrp, int which, int _power_on=0); + ~wbxng_base(); + + struct freq_result_t set_freq(double freq); + + bool is_quadrature(); + double freq_min(); + double freq_max(); + +protected: + bool _lock_detect(); + bool _set_pga(float pga_gain); + + int power_on() { return d_power_on; } + int power_off() { return 0; } + + bool d_first; + int d_spi_format; + int d_spi_enable; + int d_power_on; + int d_PD; + + adf4350 *d_common; +}; + +// ---------------------------------------------------------------- + +class wbxng_base_tx : public wbxng_base +{ +protected: + void shutdown(); + +public: + wbxng_base_tx(usrp_basic_sptr usrp, int which, int _power_on=0); + ~wbxng_base_tx(); + + float gain_min(); + float gain_max(); + float gain_db_per_step(); + + bool set_auto_tr(bool on); + bool set_enable(bool on); + bool set_gain(float gain); +}; + +class wbxng_base_rx : public wbxng_base +{ +protected: + void shutdown(); + bool _set_attn(float attn); + +public: + wbxng_base_rx(usrp_basic_sptr usrp, int which, int _power_on=0); + ~wbxng_base_rx(); + + bool set_auto_tr(bool on); + bool select_rx_antenna(int which_antenna); + bool select_rx_antenna(const std::string &which_antenna); + bool set_gain(float gain); +}; + +// ---------------------------------------------------------------- + +class db_wbxng_tx : public wbxng_base_tx +{ + public: + db_wbxng_tx(usrp_basic_sptr usrp, int which); + ~db_wbxng_tx(); +}; + +class db_wbxng_rx : public wbxng_base_rx +{ +public: + db_wbxng_rx(usrp_basic_sptr usrp, int which); + ~db_wbxng_rx(); + + float gain_min(); + float gain_max(); + float gain_db_per_step(); + bool i_and_q_swapped(); +}; + +#endif /* INCLUDED_DB_WBXNG_H */ diff --git a/usrp/host/lib/Makefile.am b/usrp/host/lib/Makefile.am index 2f8cbe6de..72312ebbb 100644 --- a/usrp/host/lib/Makefile.am +++ b/usrp/host/lib/Makefile.am @@ -1,22 +1,22 @@ # # USRP - Universal Software Radio Peripheral -# +# # Copyright (C) 2003,2004,2006,2007,2008,2009 Free Software Foundation, Inc. -# +# # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Boston, MA 02110-1301 USA -# +# include $(top_srcdir)/Makefile.common @@ -122,6 +122,8 @@ libusrp_la_common_SOURCES = \ usrp_local_sighandler.cc \ usrp_prims_common.cc \ usrp_standard.cc \ + db_wbxng_adf4350.cc \ + db_wbxng_adf4350_regs.cc \ db_boards.cc \ db_base.cc \ db_basic.cc \ @@ -130,6 +132,7 @@ libusrp_la_common_SOURCES = \ db_flexrf.cc \ db_flexrf_mimo.cc \ db_dbs_rx.cc \ + db_wbxng.cc \ db_xcvr2450.cc \ db_dtt754.cc \ db_dtt768.cc \ @@ -165,6 +168,8 @@ noinst_HEADERS = \ db_base_impl.h \ db_boards.h \ db_util.h \ + db_wbxng_adf4350.h \ + db_wbxng_adf4350_regs.h \ fusb.h \ fusb_darwin.h \ fusb_generic.h \ diff --git a/usrp/host/lib/circular_buffer.h b/usrp/host/lib/circular_buffer.h index 8898e4194..6d491fb6f 100644 --- a/usrp/host/lib/circular_buffer.h +++ b/usrp/host/lib/circular_buffer.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2006 Free Software Foundation, Inc. + * Copyright 2006,2009 Free Software Foundation, Inc. * * This file is part of GNU Radio. * @@ -24,6 +24,7 @@ #define _CIRCULAR_BUFFER_H_ #include "mld_threads.h" +#include <iostream> #include <stdexcept> #ifndef DO_DEBUG @@ -43,8 +44,8 @@ private: T* d_buffer; // the following are in Items (type T) - UInt32 d_bufLen_I, d_readNdx_I, d_writeNdx_I; - UInt32 d_n_avail_write_I, d_n_avail_read_I; + size_t d_bufLen_I, d_readNdx_I, d_writeNdx_I; + size_t d_n_avail_write_I, d_n_avail_read_I; // stuff to control access to class internals mld_mutex_ptr d_internal; @@ -69,7 +70,7 @@ private: }; public: - circular_buffer (UInt32 bufLen_I, + circular_buffer (size_t bufLen_I, bool doWriteBlock = true, bool doFullRead = false) { if (bufLen_I == 0) throw std::runtime_error ("circular_buffer(): " @@ -81,10 +82,10 @@ public: d_internal = NULL; d_readBlock = d_writeBlock = NULL; reset (); - DEBUG (fprintf (stderr, "c_b(): buf len (items) = %ld, " - "doWriteBlock = %s, doFullRead = %s\n", d_bufLen_I, - (d_doWriteBlock ? "true" : "false"), - (d_doFullRead ? "true" : "false"));); + DEBUG (std::cerr << "c_b(): buf len (items) = " << d_bufLen_ + << ", doWriteBlock = " << (d_doWriteBlock ? "true" : "false") + << ", doFullRead = " << (d_doFullRead ? "true" : "false") + << std::endl); }; ~circular_buffer () { @@ -92,21 +93,21 @@ public: delete [] d_buffer; }; - inline UInt32 n_avail_write_items () { + inline size_t n_avail_write_items () { d_internal->lock (); - UInt32 retVal = d_n_avail_write_I; + size_t retVal = d_n_avail_write_I; d_internal->unlock (); return (retVal); }; - inline UInt32 n_avail_read_items () { + inline size_t n_avail_read_items () { d_internal->lock (); - UInt32 retVal = d_n_avail_read_I; + size_t retVal = d_n_avail_read_I; d_internal->unlock (); return (retVal); }; - inline UInt32 buffer_length_items () {return (d_bufLen_I);}; + inline size_t buffer_length_items () {return (d_bufLen_I);}; inline bool do_write_block () {return (d_doWriteBlock);}; inline bool do_full_read () {return (d_doFullRead);}; @@ -149,14 +150,15 @@ public: * buffer length is larger than the instantiated buffer length */ - int enqueue (T* buf, UInt32 bufLen_I) { - DEBUG (fprintf (stderr, "enqueue: buf = %X, bufLen = %ld, #av_wr = %ld, " - "#av_rd = %ld.\n", (unsigned int)buf, bufLen_I, - d_n_avail_write_I, d_n_avail_read_I);); + int enqueue (T* buf, size_t bufLen_I) { + DEBUG (std::cerr << "enqueue: buf = " << (void*) buf + << ", bufLen = " << bufLen_I + << ", #av_wr = " << d_n_avail_write_I + << ", #av_rd = " << d_n_avail_read_I << std::endl); if (bufLen_I > d_bufLen_I) { - fprintf (stderr, "cannot add buffer longer (%ld" - ") than instantiated length (%ld" - ").\n", bufLen_I, d_bufLen_I); + std::cerr << "ERROR: cannot add buffer longer (" + << bufLen_I << ") than instantiated length (" + << d_bufLen_I << ")." << std::endl; throw std::runtime_error ("circular_buffer::enqueue()"); } @@ -175,25 +177,25 @@ public: if (bufLen_I > d_n_avail_write_I) { if (d_doWriteBlock) { while (bufLen_I > d_n_avail_write_I) { - DEBUG (fprintf (stderr, "enqueue: #len > #a, waiting.\n");); + DEBUG (std::cerr << "enqueue: #len > #a, waiting." << std::endl); // wait will automatically unlock() the internal mutex d_writeBlock->wait (); // and lock() it here. if (d_doAbort) { d_internal->unlock (); - DEBUG (fprintf (stderr, "enqueue: #len > #a, aborting.\n");); + DEBUG (std::cerr << "enqueue: #len > #a, aborting." << std::endl); return (2); } - DEBUG (fprintf (stderr, "enqueue: #len > #a, done waiting.\n");); + DEBUG (std::cerr << "enqueue: #len > #a, done waiting." << std::endl); } } else { d_n_avail_read_I = d_bufLen_I - bufLen_I; d_n_avail_write_I = bufLen_I; - DEBUG (fprintf (stderr, "circular_buffer::enqueue: overflow\n");); + DEBUG (std::cerr << "circular_buffer::enqueue: overflow" << std::endl); retval = -1; } } - UInt32 n_now_I = d_bufLen_I - d_writeNdx_I, n_start_I = 0; + size_t n_now_I = d_bufLen_I - d_writeNdx_I, n_start_I = 0; if (n_now_I > bufLen_I) n_now_I = bufLen_I; else if (n_now_I < bufLen_I) @@ -232,23 +234,24 @@ public: * buffer length is larger than the instantiated buffer length */ - int dequeue (T* buf, UInt32* bufLen_I) { - DEBUG (fprintf (stderr, "dequeue: buf = %X, *bufLen = %ld, #av_wr = %ld, " - "#av_rd = %ld.\n", (unsigned int)buf, *bufLen_I, - d_n_avail_write_I, d_n_avail_read_I);); + int dequeue (T* buf, size_t* bufLen_I) { + DEBUG (std::cerr << "dequeue: buf = " << ((void*) buf) + << ", *bufLen = " << (*bufLen_I) + << ", #av_wr = " << d_n_avail_write_I + << ", #av_rd = " << d_n_avail_read_I << std::endl); if (!bufLen_I) throw std::runtime_error ("circular_buffer::dequeue(): " "input bufLen pointer is NULL.\n"); if (!buf) throw std::runtime_error ("circular_buffer::dequeue(): " "input buffer pointer is NULL.\n"); - UInt32 l_bufLen_I = *bufLen_I; + size_t l_bufLen_I = *bufLen_I; if (l_bufLen_I == 0) return (0); if (l_bufLen_I > d_bufLen_I) { - fprintf (stderr, "cannot remove buffer longer (%ld" - ") than instantiated length (%ld" - ").\n", l_bufLen_I, d_bufLen_I); + std::cerr << "ERROR: cannot remove buffer longer (" + << l_bufLen_I << ") than instantiated length (" + << d_bufLen_I << ")." << std::endl; throw std::runtime_error ("circular_buffer::dequeue()"); } @@ -259,34 +262,34 @@ public: } if (d_doFullRead) { while (d_n_avail_read_I < l_bufLen_I) { - DEBUG (fprintf (stderr, "dequeue: #a < #len, waiting.\n");); + DEBUG (std::cerr << "dequeue: #a < #len, waiting." << std::endl); // wait will automatically unlock() the internal mutex d_readBlock->wait (); // and lock() it here. if (d_doAbort) { d_internal->unlock (); - DEBUG (fprintf (stderr, "dequeue: #a < #len, aborting.\n");); + DEBUG (std::cerr << "dequeue: #a < #len, aborting." << std::endl); return (2); } - DEBUG (fprintf (stderr, "dequeue: #a < #len, done waiting.\n");); + DEBUG (std::cerr << "dequeue: #a < #len, done waiting." << std::endl); } } else { while (d_n_avail_read_I == 0) { - DEBUG (fprintf (stderr, "dequeue: #a == 0, waiting.\n");); + DEBUG (std::cerr << "dequeue: #a == 0, waiting." << std::endl); // wait will automatically unlock() the internal mutex d_readBlock->wait (); // and lock() it here. if (d_doAbort) { d_internal->unlock (); - DEBUG (fprintf (stderr, "dequeue: #a == 0, aborting.\n");); + DEBUG (std::cerr << "dequeue: #a == 0, aborting." << std::endl); return (2); } - DEBUG (fprintf (stderr, "dequeue: #a == 0, done waiting.\n");); + DEBUG (std::cerr << "dequeue: #a == 0, done waiting." << std::endl); } } if (l_bufLen_I > d_n_avail_read_I) l_bufLen_I = d_n_avail_read_I; - UInt32 n_now_I = d_bufLen_I - d_readNdx_I, n_start_I = 0; + size_t n_now_I = d_bufLen_I - d_readNdx_I, n_start_I = 0; if (n_now_I > l_bufLen_I) n_now_I = l_bufLen_I; else if (n_now_I < l_bufLen_I) diff --git a/usrp/host/lib/circular_linked_list.h b/usrp/host/lib/circular_linked_list.h index e495d609b..97fe2c1a8 100644 --- a/usrp/host/lib/circular_linked_list.h +++ b/usrp/host/lib/circular_linked_list.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2006 Free Software Foundation, Inc. + * Copyright 2006,2009 Free Software Foundation, Inc. * * This file is part of GNU Radio. * @@ -109,12 +109,12 @@ template <class T> class circular_linked_list { private: s_node_ptr d_current, d_iterate, d_available, d_inUse; - UInt32 d_n_nodes, d_n_used; + size_t d_n_nodes, d_n_used; mld_mutex_ptr d_internal; mld_condition_ptr d_ioBlock; public: - circular_linked_list (UInt32 n_nodes) { + circular_linked_list (size_t n_nodes) { if (n_nodes == 0) throw std::runtime_error ("circular_linked_list(): n_nodes == 0"); @@ -136,7 +136,7 @@ public: l_prev->next (l_next); l_prev->prev (l_next); if (n_nodes > 2) { - UInt32 n = n_nodes - 2; + size_t n = n_nodes - 2; while (n-- > 0) { d_current = new s_node<T> (l_prev, l_next); d_current->set_available (); @@ -171,17 +171,17 @@ public: d_internal->lock (); // find an available node s_node_ptr l_node = d_available; - DEBUG (fprintf (stderr, "w ");); + DEBUG (std::cerr << "w "); while (! l_node) { - DEBUG (fprintf (stderr, "x\n");); + DEBUG (std::cerr << "x" << std::endl); // the ioBlock condition will automatically unlock() d_internal d_ioBlock->wait (); // and lock() is here - DEBUG (fprintf (stderr, "y\n");); + DEBUG (std::cerr << "y" << std::endl); l_node = d_available; } - DEBUG (fprintf (stderr, "::f_n_a_n: #u = %ld, node = %p\n", - num_used(), l_node);); + DEBUG (std::cerr << "::f_n_a_n: #u = " << num_used() + << ", node = " << l_node << std::endl); // remove this one from the current available list if (num_available () == 1) { // last one, just set available to NULL @@ -203,8 +203,8 @@ public: void make_node_available (s_node_ptr l_node) { if (!l_node) return; d_internal->lock (); - DEBUG (fprintf (stderr, "::m_n_a: #u = %ld, node = %p\n", - num_used(), l_node);); + DEBUG (std::cerr << "::m_n_a: #u = " << num_used() + << ", node = " << l_node << std::endl); // remove this node from the inUse list if (num_used () == 1) { // last one, just set inUse to NULL @@ -219,10 +219,10 @@ public: l_node->insert_before (d_available); d_n_used--; - DEBUG (fprintf (stderr, "s%ld ", d_n_used);); + DEBUG (std::cerr << "s" << d_n_used); // signal the condition when new data arrives d_ioBlock->signal (); - DEBUG (fprintf (stderr, "t ");); + DEBUG (std::cerr << "t "); // unlock the mutex for thread safety d_internal->unlock (); @@ -251,10 +251,10 @@ public: __INLINE__ T object () { return (d_current->d_object); }; __INLINE__ void object (T l_object) { d_current->d_object = l_object; }; - __INLINE__ UInt32 num_nodes () { return (d_n_nodes); }; - __INLINE__ UInt32 num_used () { return (d_n_used); }; - __INLINE__ void num_used (UInt32 l_n_used) { d_n_used = l_n_used; }; - __INLINE__ UInt32 num_available () { return (d_n_nodes - d_n_used); }; + __INLINE__ size_t num_nodes () { return (d_n_nodes); }; + __INLINE__ size_t num_used () { return (d_n_used); }; + __INLINE__ void num_used (size_t l_n_used) { d_n_used = l_n_used; }; + __INLINE__ size_t num_available () { return (d_n_nodes - d_n_used); }; __INLINE__ void num_used_inc (void) { if (d_n_used < d_n_nodes) ++d_n_used; }; diff --git a/usrp/host/lib/darwin_libusb.h b/usrp/host/lib/darwin_libusb.h index 063a2e9c6..8446f044e 100644 --- a/usrp/host/lib/darwin_libusb.h +++ b/usrp/host/lib/darwin_libusb.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2006 Free Software Foundation, Inc. + * Copyright 2006,2009 Free Software Foundation, Inc. * * This file is part of GNU Radio. * @@ -42,28 +42,41 @@ #include <IOKit/IOKitLib.h> extern "C" { -static char * + +static const char* darwin_error_strings[] = { + "no error", + "device not opened for exclusive access", + "no connection to an IOService", + "no asyc port has been opened for interface", + "another process has device opened for exclusive access", + "pipe is stalled", + "could not establish a connection to Darin kernel", + "invalid argument", + "unknown error" +}; + +static const char * darwin_error_str (int result) { switch (result) { case kIOReturnSuccess: - return "no error"; + return (darwin_error_strings[0]); case kIOReturnNotOpen: - return "device not opened for exclusive access"; + return (darwin_error_strings[1]); case kIOReturnNoDevice: - return "no connection to an IOService"; + return (darwin_error_strings[2]); case kIOUSBNoAsyncPortErr: - return "no asyc port has been opened for interface"; + return (darwin_error_strings[3]); case kIOReturnExclusiveAccess: - return "another process has device opened for exclusive access"; + return (darwin_error_strings[4]); case kIOUSBPipeStalled: - return "pipe is stalled"; + return (darwin_error_strings[5]); case kIOReturnError: - return "could not establish a connection to Darin kernel"; + return (darwin_error_strings[6]); case kIOReturnBadArgument: - return "invalid argument"; + return (darwin_error_strings[7]); default: - return "unknown error"; + return (darwin_error_strings[8]); } } @@ -103,40 +116,49 @@ extern char usb_error_str[1024]; extern int usb_error_errno; extern usb_error_type_t usb_error_type; -#define USB_ERROR(r, x) \ - do { \ - usb_error_type = USB_ERROR_TYPE_ERRNO; \ - usb_error_errno = x; \ - return r; \ - } while (0) - -#define USB_ERROR_STR(r, x, format, args...) \ - do { \ - usb_error_type = USB_ERROR_TYPE_STRING; \ - snprintf(usb_error_str, sizeof(usb_error_str) - 1, format, ## args); \ - if (usb_debug) \ - fprintf(stderr, "USB error: %s\n", usb_error_str); \ - return r; \ - } while (0) - -#define USB_ERROR_STR_ORIG(x, format, args...) \ - do { \ - usb_error_type = USB_ERROR_TYPE_STRING; \ - snprintf(usb_error_str, sizeof(usb_error_str) - 1, format, ## args); \ - if (usb_debug) \ - fprintf(stderr, "USB error: %s\n", usb_error_str); \ - return x; \ - } while (0) - -#define USB_ERROR_STR_NO_RET(x, format, args...) \ - do { \ - usb_error_type = USB_ERROR_TYPE_STRING; \ - snprintf(usb_error_str, sizeof(usb_error_str) - 1, format, ## args); \ - if (usb_debug) \ - fprintf(stderr, "USB error: %s\n", usb_error_str); \ - } while (0) - -/* simple function that figures out what pipeRef is associated with an endpoint */ +#define USB_ERROR(r, x) \ + do { \ + usb_error_type = USB_ERROR_TYPE_ERRNO; \ + usb_error_errno = x; \ + return (r); \ + } while (0) + +#define USB_ERROR_STR(r, x, format, args...) \ + do { \ + usb_error_type = USB_ERROR_TYPE_STRING; \ + snprintf (usb_error_str, sizeof (usb_error_str) - 1, \ + format, ## args); \ + if (usb_debug) { \ + std::cerr << "USB error: " << usb_error_str << std::cerr; \ + } \ + return (r); \ + } while (0) + +#define USB_ERROR_STR_ORIG(x, format, args...) \ + do { \ + usb_error_type = USB_ERROR_TYPE_STRING; \ + snprintf (usb_error_str, sizeof (usb_error_str) - 1, \ + format, ## args); \ + if (usb_debug) { \ + std::cerr << "USB error: " << usb_error_str << std::endl; \ + } \ + return (x); \ + } while (0) + +#define USB_ERROR_STR_NO_RET(x, format, args...) \ + do { \ + usb_error_type = USB_ERROR_TYPE_STRING; \ + snprintf (usb_error_str, sizeof (usb_error_str) - 1, \ + format, ## args); \ + if (usb_debug) { \ + std::cerr << "USB error: " << usb_error_str << std::endl; \ + } \ + } while (0) + +/* + * simple function that figures out what pipeRef + * is associated with an endpoint + */ static int ep_to_pipeRef (darwin_dev_handle *device, int ep) { io_return_t ret; @@ -145,45 +167,60 @@ static int ep_to_pipeRef (darwin_dev_handle *device, int ep) UInt16 dont_care2; int i; - if (usb_debug > 3) - fprintf(stderr, "Converting ep address to pipeRef.\n"); + if (usb_debug > 3) { + std::cerr << "Converting ep address to pipeRef." << std::endl; + } /* retrieve the total number of endpoints on this interface */ ret = (*(device->interface))->GetNumEndpoints(device->interface, &numep); if ( ret ) { - if ( usb_debug > 3 ) - fprintf ( stderr, "ep_to_pipeRef: interface is %p\n", device->interface ); - USB_ERROR_STR_ORIG ( -ret, "ep_to_pipeRef: can't get number of endpoints for interface" ); + if ( usb_debug > 3 ) { + std::cerr << "ep_to_pipeRef: interface is " + << device->interface << std::endl; + } + USB_ERROR_STR_ORIG ( -ret, "ep_to_pipeRef: can't get number of " + "endpoints for interface" ); } /* iterate through the pipeRefs until we find the correct one */ for (i = 1 ; i <= numep ; i++) { - ret = (*(device->interface))->GetPipeProperties(device->interface, i, &direction, &number, - &dont_care1, &dont_care2, &dont_care3); + ret = (*(device->interface))->GetPipeProperties + (device->interface, i, &direction, &number, + &dont_care1, &dont_care2, &dont_care3); if (ret != kIOReturnSuccess) { - fprintf (stderr, "ep_to_pipeRef: an error occurred getting pipe information on pipe %d\n", - i ); - USB_ERROR_STR_ORIG (-darwin_to_errno(ret), "ep_to_pipeRef(GetPipeProperties): %s", darwin_error_str(ret)); - } + std::cerr << "ep_to_pipeRef: an error occurred getting " + << "pipe information on pipe " << i << std::endl; - if (usb_debug > 3) - fprintf (stderr, "ep_to_pipeRef: Pipe %i: DIR: %i number: %i\n", i, direction, number); + USB_ERROR_STR_ORIG (-darwin_to_errno(ret), + "ep_to_pipeRef(GetPipeProperties): %s", + darwin_error_str(ret)); + } - /* calculate the endpoint of the pipe and check it versus the requested endpoint */ - if ( ((direction << 7 & USB_ENDPOINT_DIR_MASK) | (number & USB_ENDPOINT_ADDRESS_MASK)) == ep ) { - if (usb_debug > 3) - fprintf(stderr, "ep_to_pipeRef: pipeRef for ep address 0x%02x found: 0x%02x\n", ep, i); + if (usb_debug > 3) { + std::cerr << "ep_to_pipeRef: Pipe " << i << ": DIR: " + << direction << " number: " << number << std::endl; + } - return i; + /* calculate the endpoint of the pipe and check it versus + the requested endpoint */ + if ( ((direction << 7 & USB_ENDPOINT_DIR_MASK) | + (number & USB_ENDPOINT_ADDRESS_MASK)) == ep ) { + if (usb_debug > 3) { + std::cerr << "ep_to_pipeRef: pipeRef for ep address " + << ep << " found: " << i << std::endl; + } + return (i); } } - if (usb_debug > 3) - fprintf(stderr, "ep_to_pipeRef: No pipeRef found with endpoint address 0x%02x.\n", ep); - + if (usb_debug > 3) { + std::cerr << "ep_to_pipeRef: No pipeRef found with endpoint address " + << ep << std::endl; + } + /* none of the found pipes match the requested endpoint */ - return -1; + return (-1); } } diff --git a/usrp/host/lib/db_boards.cc b/usrp/host/lib/db_boards.cc index 8ef5bac8b..590d8132d 100644 --- a/usrp/host/lib/db_boards.cc +++ b/usrp/host/lib/db_boards.cc @@ -1,19 +1,19 @@ /* -*- c++ -*- */ // // Copyright 2008,2009 Free Software Foundation, Inc. -// +// // This file is part of GNU Radio -// +// // GNU Radio is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either asversion 3, or (at your option) // any later version. -// +// // GNU Radio is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with GNU Radio; see the file COPYING. If not, write to // the Free Software Foundation, Inc., 51 Franklin Street, @@ -32,6 +32,7 @@ #include <usrp/db_dbs_rx.h> #include <usrp/db_flexrf.h> #include <usrp/db_flexrf_mimo.h> +#include <usrp/db_wbxng.h> #include <usrp/db_xcvr2450.h> #include <usrp/db_dtt754.h> #include <usrp/db_dtt768.h> @@ -63,7 +64,7 @@ instantiate_dbs(int dbid, usrp_basic_sptr usrp, int which_side) db.push_back(db_base_sptr(new db_lf_rx(usrp, which_side, 1))); db.push_back(db_base_sptr(new db_lf_rx(usrp, which_side, 2))); break; - + case(USRP_DBID_DBS_RX): db.push_back(db_base_sptr(new db_dbs_rx(usrp, which_side))); break; @@ -184,7 +185,7 @@ instantiate_dbs(int dbid, usrp_basic_sptr usrp, int which_side) case(USRP_DBID_XCVR2450_RX): db.push_back(db_base_sptr(new db_xcvr2450_rx(usrp, which_side))); break; - + #if 0 // FIXME wbx doesn't compile case(USRP_DBID_WBX_LO_TX): db.push_back(db_base_sptr(new db_wbx_lo_tx(usrp, which_side))); @@ -194,6 +195,13 @@ instantiate_dbs(int dbid, usrp_basic_sptr usrp, int which_side) break; #endif + case(USRP_DBID_WBX_NG_TX): + db.push_back(db_base_sptr(new db_wbxng_tx(usrp, which_side))); + break; + case(USRP_DBID_WBX_NG_RX): + db.push_back(db_base_sptr(new db_wbxng_rx(usrp, which_side))); + break; + case(USRP_DBID_DTT754): db.push_back(db_base_sptr(new db_dtt754(usrp, which_side))); break; @@ -210,7 +218,7 @@ instantiate_dbs(int dbid, usrp_basic_sptr usrp, int which_side) db.push_back(db_base_sptr(new db_basic_rx(usrp, which_side, 1))); } break; - + case(-2): default: if (boost::dynamic_pointer_cast<usrp_basic_tx>(usrp)){ diff --git a/usrp/host/lib/db_wbxng.cc b/usrp/host/lib/db_wbxng.cc new file mode 100644 index 000000000..56a8486ce --- /dev/null +++ b/usrp/host/lib/db_wbxng.cc @@ -0,0 +1,503 @@ +// +// Copyright 2008,2009 Free Software Foundation, Inc. +// +// This file is part of GNU Radio +// +// GNU Radio is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either asversion 3, or (at your option) +// any later version. +// +// GNU Radio is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with GNU Radio; see the file COPYING. If not, write to +// the Free Software Foundation, Inc., 51 Franklin Street, +// Boston, MA 02110-1301, USA. + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <usrp/db_wbxng.h> +#include "db_wbxng_adf4350.h" +#include <db_base_impl.h> +#include <stdio.h> + +// d'board i/o pin defs +// Tx and Rx have shared defs, but different i/o regs +#define ENABLE_5 (1 << 7) // enables 5.0V power supply +#define ENABLE_33 (1 << 6) // enables 3.3V supply +#define RX_TXN (1 << 5) // Tx only: T/R antenna switch for TX/RX port +#define RX2_RX1N (1 << 5) // Rx only: antenna switch between RX2 and TX/RX port +#define RXBB_EN (1 << 4) +#define TXMOD_EN (1 << 4) +#define PLL_CE (1 << 3) +#define PLL_PDBRF (1 << 2) +#define PLL_MUXOUT (1 << 1) +#define PLL_LOCK_DETECT (1 << 0) + +// RX Attenuator constants +#define ATTN_SHIFT 8 +#define ATTN_MASK (63 << ATTN_SHIFT) + +wbxng_base::wbxng_base(usrp_basic_sptr _usrp, int which, int _power_on) + : db_base(_usrp, which), d_power_on(_power_on) +{ + /* + @param usrp: instance of usrp.source_c + @param which: which side: 0 or 1 corresponding to side A or B respectively + @type which: int + */ + + usrp()->_write_oe(d_which, 0, 0xffff); // turn off all outputs + + d_first = true; + d_spi_format = SPI_FMT_MSB | SPI_FMT_HDR_0; + + _enable_refclk(false); // disable refclk + + set_auto_tr(false); +} + +wbxng_base::~wbxng_base() +{ + if (d_common) + delete d_common; +} + +struct freq_result_t +wbxng_base::set_freq(double freq) +{ + /* + @returns (ok, actual_baseband_freq) where: + ok is True or False and indicates success or failure, + actual_baseband_freq is the RF frequency that corresponds to DC in the IF. + */ + + freq_t int_freq = freq_t(freq); + bool ok = d_common->_set_freq(int_freq*2); + double freq_result = (double) d_common->_get_freq()/2.0; + struct freq_result_t args = {ok, freq_result}; + + /* Wait before reading Lock Detect*/ + timespec t; + t.tv_sec = 0; + t.tv_nsec = 10000000; + nanosleep(&t, NULL); + + fprintf(stderr,"Setting WBXNG frequency, requested %d, obtained %f, lock_detect %d\n", + int_freq, freq_result, d_common->_get_locked()); + + // FIXME + // Offsetting the LO helps get the Tx carrier leakage out of the way. + // This also ensures that on Rx, we're not getting hosed by the + // FPGA's DC removal loop's time constant. We were seeing a + // problem when running with discontinuous transmission. + // Offsetting the LO made the problem go away. + //freq += d_lo_offset; + + return args; +} + +bool +wbxng_base::_set_pga(float pga_gain) +{ + if(d_which == 0) { + usrp()->set_pga(0, pga_gain); + usrp()->set_pga(1, pga_gain); + } + else { + usrp()->set_pga(2, pga_gain); + usrp()->set_pga(3, pga_gain); + } + return true; +} + +bool +wbxng_base::is_quadrature() +{ + /* + Return True if this board requires both I & Q analog channels. + + This bit of info is useful when setting up the USRP Rx mux register. + */ + return true; +} + +double +wbxng_base::freq_min() +{ + return (double) d_common->_get_min_freq()/2.0; +} + +double +wbxng_base::freq_max() +{ + return (double) d_common->_get_max_freq()/2.0; +} + +// ---------------------------------------------------------------- + +wbxng_base_tx::wbxng_base_tx(usrp_basic_sptr _usrp, int which, int _power_on) + : wbxng_base(_usrp, which, _power_on) +{ + /* + @param usrp: instance of usrp.sink_c + @param which: 0 or 1 corresponding to side TX_A or TX_B respectively. + */ + + if(which == 0) { + d_spi_enable = SPI_ENABLE_TX_A; + } + else { + d_spi_enable = SPI_ENABLE_TX_B; + } + + d_common = new adf4350(_usrp, d_which, d_spi_enable); + + // FIXME: power up the transmit side, but don't enable the mixer + usrp()->_write_oe(d_which,(RX_TXN|TXMOD_EN|ENABLE_33|ENABLE_5), (RX_TXN|TXMOD_EN|ENABLE_33|ENABLE_5)); + usrp()->write_io(d_which, (power_on()|RX_TXN|TXMOD_EN|ENABLE_33|ENABLE_5), (RX_TXN|TXMOD_EN|ENABLE_33|ENABLE_5)); + fprintf(stderr,"Setting WBXNG TXMOD on"); + //set_lo_offset(4e6); + + set_gain((gain_min() + gain_max()) / 2.0); // initialize gain +} + +wbxng_base_tx::~wbxng_base_tx() +{ + shutdown(); +} + + +void +wbxng_base_tx::shutdown() +{ + // fprintf(stderr, "wbxng_base_tx::shutdown d_is_shutdown = %d\n", d_is_shutdown); + + if (!d_is_shutdown){ + d_is_shutdown = true; + // do whatever there is to do to shutdown + + // Power down and leave the T/R switch in the R position + usrp()->write_io(d_which, (power_off()|RX_TXN), (RX_TXN|ENABLE_33|ENABLE_5)); + + // Power down VCO/PLL + d_common->_enable(false); + + /* + _write_control(_compute_control_reg()); + */ + _enable_refclk(false); // turn off refclk + set_auto_tr(false); + } +} + +bool +wbxng_base_tx::set_auto_tr(bool on) +{ + bool ok = true; + if(on) { + ok &= set_atr_mask (RX_TXN | ENABLE_33 | ENABLE_5); + ok &= set_atr_txval(0 | ENABLE_33 | ENABLE_5); + ok &= set_atr_rxval(RX_TXN | 0); + } + else { + ok &= set_atr_mask (0); + ok &= set_atr_txval(0); + ok &= set_atr_rxval(0); + } + return ok; +} + +bool +wbxng_base_tx::set_enable(bool on) +{ + /* + Enable transmitter if on is true + */ + + int v; + int mask = RX_TXN | ENABLE_5 | ENABLE_33; + if(on) { + v = ENABLE_5 | ENABLE_33; + } + else { + v = RX_TXN; + } + return usrp()->write_io(d_which, v, mask); +} + +float +wbxng_base_tx::gain_min() +{ + return usrp()->pga_max(); +} + +float +wbxng_base_tx::gain_max() +{ + return usrp()->pga_max() + 25.0; +} + +float +wbxng_base_tx::gain_db_per_step() +{ + return 1; +} + +bool +wbxng_base_tx::set_gain(float gain) +{ + /* + Set the gain. + + @param gain: gain in decibels + @returns True/False + */ + + // clamp gain + gain = std::max(gain_min(), std::min(gain, gain_max())); + + float pga_gain, agc_gain; + float V_maxgain, V_mingain, V_fullscale, dac_value; + + float maxgain = gain_max() - usrp()->pga_max(); + float mingain = gain_min(); + if(gain > maxgain) { + pga_gain = gain-maxgain; + assert(pga_gain <= usrp()->pga_max()); + agc_gain = maxgain; + } + else { + pga_gain = 0; + agc_gain = gain; + } + + V_maxgain = 0.7; + V_mingain = 1.4; + V_fullscale = 3.3; + dac_value = (agc_gain*(V_maxgain-V_mingain)/(maxgain-mingain) + V_mingain)*4096/V_fullscale; + + fprintf(stderr, "TXGAIN: %f dB, Dac Code: %d, Voltage: %f\n", gain, int(dac_value), float((dac_value/4096.0)*V_fullscale)); + assert(dac_value>=0 && dac_value<4096); + + return (usrp()->write_aux_dac(d_which, 0, int(dac_value)) + && _set_pga(int(pga_gain))); +} + + +/**************************************************************************/ + + +wbxng_base_rx::wbxng_base_rx(usrp_basic_sptr _usrp, int which, int _power_on) + : wbxng_base(_usrp, which, _power_on) +{ + /* + @param usrp: instance of usrp.source_c + @param which: 0 or 1 corresponding to side RX_A or RX_B respectively. + */ + + if(which == 0) { + d_spi_enable = SPI_ENABLE_RX_A; + } + else { + d_spi_enable = SPI_ENABLE_RX_B; + } + + d_common = new adf4350(_usrp, d_which, d_spi_enable); + + usrp()->_write_oe(d_which, (RX2_RX1N|RXBB_EN|ATTN_MASK|ENABLE_33|ENABLE_5), (RX2_RX1N|RXBB_EN|ATTN_MASK|ENABLE_33|ENABLE_5)); + usrp()->write_io(d_which, (power_on()|RX2_RX1N|RXBB_EN|ENABLE_33|ENABLE_5), (RX2_RX1N|RXBB_EN|ATTN_MASK|ENABLE_33|ENABLE_5)); + fprintf(stderr,"Setting WBXNG RXBB on"); + + // set up for RX on TX/RX port + select_rx_antenna("TX/RX"); + + bypass_adc_buffers(true); + + /* + set_lo_offset(-4e6); + */ +} + +wbxng_base_rx::~wbxng_base_rx() +{ + shutdown(); +} + +void +wbxng_base_rx::shutdown() +{ + // fprintf(stderr, "wbxng_base_rx::shutdown d_is_shutdown = %d\n", d_is_shutdown); + + if (!d_is_shutdown){ + d_is_shutdown = true; + // do whatever there is to do to shutdown + + // Power down + usrp()->common_write_io(C_RX, d_which, power_off(), (ENABLE_33|ENABLE_5)); + + // Power down VCO/PLL + d_common->_enable(false); + + // fprintf(stderr, "wbxng_base_rx::shutdown before _write_control\n"); + //_write_control(_compute_control_reg()); + + // fprintf(stderr, "wbxng_base_rx::shutdown before _enable_refclk\n"); + _enable_refclk(false); // turn off refclk + + // fprintf(stderr, "wbxng_base_rx::shutdown before set_auto_tr\n"); + set_auto_tr(false); + + // fprintf(stderr, "wbxng_base_rx::shutdown after set_auto_tr\n"); + } +} + +bool +wbxng_base_rx::set_auto_tr(bool on) +{ + bool ok = true; + if(on) { + ok &= set_atr_mask (ENABLE_33|ENABLE_5); + ok &= set_atr_txval( 0); + ok &= set_atr_rxval(ENABLE_33|ENABLE_5); + } + else { + ok &= set_atr_mask (0); + ok &= set_atr_txval(0); + ok &= set_atr_rxval(0); + } + return true; +} + +bool +wbxng_base_rx::select_rx_antenna(int which_antenna) +{ + /* + Specify which antenna port to use for reception. + @param which_antenna: either 'TX/RX' or 'RX2' + */ + + if(which_antenna == 0) { + usrp()->write_io(d_which, 0,RX2_RX1N); + } + else if(which_antenna == 1) { + usrp()->write_io(d_which, RX2_RX1N, RX2_RX1N); + } + else { + return false; + } + return true; +} + +bool +wbxng_base_rx::select_rx_antenna(const std::string &which_antenna) +{ + /* + Specify which antenna port to use for reception. + @param which_antenna: either 'TX/RX' or 'RX2' + */ + + + if(which_antenna == "TX/RX") { + usrp()->write_io(d_which, 0, RX2_RX1N); + } + else if(which_antenna == "RX2") { + usrp()->write_io(d_which, RX2_RX1N, RX2_RX1N); + } + else { + return false; + } + + return true; +} + +bool +wbxng_base_rx::set_gain(float gain) +{ + /* + Set the gain. + + @param gain: gain in decibels + @returns True/False + */ + + // clamp gain + gain = std::max(gain_min(), std::min(gain, gain_max())); + + float pga_gain, agc_gain; + + float maxgain = gain_max() - usrp()->pga_max(); + float mingain = gain_min(); + if(gain > maxgain) { + pga_gain = gain-maxgain; + assert(pga_gain <= usrp()->pga_max()); + agc_gain = maxgain; + } + else { + pga_gain = 0; + agc_gain = gain; + } + + return _set_attn(maxgain-agc_gain) && _set_pga(int(pga_gain)); +} + +bool +wbxng_base_rx::_set_attn(float attn) +{ + int attn_code = int(floor(attn/0.5)); + unsigned int iobits = (~attn_code) << ATTN_SHIFT; + fprintf(stderr, "Attenuation: %f dB, Code: %d, IO Bits %x, Mask: %x \n", attn, attn_code, iobits & ATTN_MASK, ATTN_MASK); + return usrp()->write_io(d_which, iobits, ATTN_MASK); +} + +// ---------------------------------------------------------------- + +db_wbxng_tx::db_wbxng_tx(usrp_basic_sptr usrp, int which) + : wbxng_base_tx(usrp, which) +{ +} + +db_wbxng_tx::~db_wbxng_tx() +{ +} + +db_wbxng_rx::db_wbxng_rx(usrp_basic_sptr usrp, int which) + : wbxng_base_rx(usrp, which) +{ + set_gain((gain_min() + gain_max()) / 2.0); // initialize gain +} + +db_wbxng_rx::~db_wbxng_rx() +{ +} + +float +db_wbxng_rx::gain_min() +{ + return usrp()->pga_min(); +} + +float +db_wbxng_rx::gain_max() +{ + return usrp()->pga_max()+30.5; +} + +float +db_wbxng_rx::gain_db_per_step() +{ + return 0.05; +} + + +bool +db_wbxng_rx::i_and_q_swapped() +{ + return false; +} diff --git a/usrp/host/lib/db_wbxng_adf4350.cc b/usrp/host/lib/db_wbxng_adf4350.cc new file mode 100644 index 000000000..af4eac573 --- /dev/null +++ b/usrp/host/lib/db_wbxng_adf4350.cc @@ -0,0 +1,199 @@ +// +// Copyright 2009 Free Software Foundation, Inc. +// +// This file is part of GNU Radio +// +// GNU Radio is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either asversion 3, or (at your option) +// any later version. +// +// GNU Radio is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with GNU Radio; see the file COPYING. If not, write to +// the Free Software Foundation, Inc., 51 Franklin Street, +// Boston, MA 02110-1301, USA. + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "db_wbxng_adf4350.h" +#include <db_base_impl.h> +#include <stdio.h> + +#define INPUT_REF_FREQ FREQ_C(64e6) +#define DIV_ROUND(num, denom) (((num) + ((denom)/2))/(denom)) +#define FREQ_C(freq) uint64_t(freq) +#define INPUT_REF_FREQ_2X (2*INPUT_REF_FREQ) /* input ref freq with doubler turned on */ +#define MIN_INT_DIV uint16_t(23) /* minimum int divider, prescaler 4/5 only */ +#define MAX_RF_DIV uint8_t(16) /* max rf divider, divides rf output */ +#define MIN_VCO_FREQ FREQ_C(2.2e9) /* minimum vco freq */ +#define MAX_VCO_FREQ FREQ_C(4.4e9) /* minimum vco freq */ +#define MAX_FREQ MAX_VCO_FREQ /* upper bound freq (rf div = 1) */ +#define MIN_FREQ DIV_ROUND(MIN_VCO_FREQ, MAX_RF_DIV) /* calculated lower bound freq */ + +#define CE_PIN (1 << 3) +#define PDB_RF_PIN (1 << 2) +#define MUX_PIN (1 << 1) +#define LD_PIN (1 << 0) + +adf4350::adf4350(usrp_basic_sptr _usrp, int _which, int _spi_enable) +{ + /* Initialize the pin directions. */ + + d_usrp = _usrp; + d_which = _which; + d_spi_enable = _spi_enable; + d_spi_format = SPI_FMT_MSB | SPI_FMT_HDR_0; + + d_regs = new adf4350_regs(this); + + /* Outputs */ + d_usrp->_write_oe(d_which, (CE_PIN | PDB_RF_PIN), (CE_PIN | PDB_RF_PIN)); + d_usrp->write_io(d_which, (0), (CE_PIN | PDB_RF_PIN)); + + /* Initialize the pin levels. */ + _enable(true); + /* Initialize the registers. */ + d_regs->_load_register(5); + d_regs->_load_register(4); + d_regs->_load_register(3); + d_regs->_load_register(2); + d_regs->_load_register(1); + d_regs->_load_register(0); +} + +adf4350::~adf4350() +{ + delete d_regs; +} + +freq_t +adf4350::_get_max_freq(void) +{ + return MAX_FREQ; +} + +freq_t +adf4350::_get_min_freq(void) +{ + return MIN_FREQ; +} + +bool +adf4350::_get_locked(void) +{ + return d_usrp->read_io(d_which) & LD_PIN; +} + +void +adf4350::_enable(bool enable) +{ + if (enable){ /* chip enable */ + d_usrp->write_io(d_which, (CE_PIN | PDB_RF_PIN), (CE_PIN | PDB_RF_PIN)); + }else{ + d_usrp->write_io(d_which, 0, (CE_PIN | PDB_RF_PIN)); + } +} + +void +adf4350::_write(uint8_t addr, uint32_t data) +{ + data |= addr; + + // create str from data here + char s[4]; + s[0] = (char)((data >> 24) & 0xff); + s[1] = (char)((data >> 16) & 0xff); + s[2] = (char)((data >> 8) & 0xff); + s[3] = (char)(data & 0xff); + std::string str(s, 4); + + timespec t; + t.tv_sec = 0; + t.tv_nsec = 5e6; + + nanosleep(&t, NULL); + d_usrp->_write_spi(0, d_spi_enable, d_spi_format, str); + nanosleep(&t, NULL); + + //fprintf(stderr, "Wrote to WBXNG SPI address %d with data %8x\n", addr, data); + /* pulse latch */ + //d_usrp->write_io(d_which, 1, LE_PIN); + //d_usrp->write_io(d_which, 0, LE_PIN); +} + +bool +adf4350::_set_freq(freq_t freq) +{ + /* Set the frequency by setting int, frac, mod, r, div */ + if (freq > MAX_FREQ || freq < MIN_FREQ) return false; + /* Ramp up the RF divider until the VCO is within range. */ + d_regs->d_divider_select = 0; + while (freq < MIN_VCO_FREQ){ + freq <<= 1; //double the freq + d_regs->d_divider_select++; //double the divider + } + /* Ramp up the R divider until the N divider is at least the minimum. */ + //d_regs->d_10_bit_r_counter = INPUT_REF_FREQ*MIN_INT_DIV/freq; + d_regs->d_10_bit_r_counter = 2; + uint64_t n_mod; + do{ + d_regs->d_10_bit_r_counter++; + n_mod = freq; + n_mod *= d_regs->d_10_bit_r_counter; + n_mod *= d_regs->d_mod; + n_mod /= INPUT_REF_FREQ; + /* calculate int and frac */ + d_regs->d_int = n_mod/d_regs->d_mod; + d_regs->d_frac = (n_mod - (freq_t)d_regs->d_int*d_regs->d_mod) & uint16_t(0xfff); + /* + fprintf(stderr, + "VCO %lu KHz, Int %u, Frac %u, Mod %u, R %u, Div %u\n", + freq, d_regs->d_int, d_regs->d_frac, + d_regs->d_mod, d_regs->d_10_bit_r_counter, (1 << d_regs->d_divider_select) + ); + */ + }while(d_regs->d_int < MIN_INT_DIV); + /* calculate the band select so PFD is under 125 KHz */ + d_regs->d_8_bit_band_select_clock_divider_value = \ + INPUT_REF_FREQ/(FREQ_C(30e3)*d_regs->d_10_bit_r_counter) + 1; + /* + fprintf(stderr, "Band Selection: Div %u, Freq %lu\n", + d_regs->d_8_bit_band_select_clock_divider_value, + INPUT_REF_FREQ/(d_regs->d_8_bit_band_select_clock_divider_value * d_regs->d_10_bit_r_counter) + 1 + ); + */ + d_regs->_load_register(5); + d_regs->_load_register(3); + d_regs->_load_register(1); + /* load involved registers */ + d_regs->_load_register(2); + d_regs->_load_register(4); + d_regs->_load_register(0); /* register 0 must be last */ + return true; +} + +freq_t +adf4350::_get_freq(void) +{ + /* Calculate the freq from int, frac, mod, ref, r, div: + * freq = (int + frac/mod) * (ref/r) + * Keep precision by doing multiplies first: + * freq = (((((((int)*mod) + frac)*ref)/mod)/r)/div) + */ + uint64_t temp; + temp = d_regs->d_int; + temp *= d_regs->d_mod; + temp += d_regs->d_frac; + temp *= INPUT_REF_FREQ; + temp /= d_regs->d_mod; + temp /= d_regs->d_10_bit_r_counter; + temp /= (1 << d_regs->d_divider_select); + return temp; +} diff --git a/usrp/host/lib/db_wbxng_adf4350.h b/usrp/host/lib/db_wbxng_adf4350.h new file mode 100644 index 000000000..2b0783c20 --- /dev/null +++ b/usrp/host/lib/db_wbxng_adf4350.h @@ -0,0 +1,53 @@ +// +// Copyright 2009 Free Software Foundation, Inc. +// +// This file is part of GNU Radio +// +// GNU Radio is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either asversion 3, or (at your option) +// any later version. +// +// GNU Radio is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with GNU Radio; see the file COPYING. If not, write to +// the Free Software Foundation, Inc., 51 Franklin Street, +// Boston, MA 02110-1301, USA. + +#ifndef INCLUDED_ADF4350_H +#define INCLUDED_ADF4350_H + +#include "db_wbxng_adf4350_regs.h" +#include <usrp/db_base.h> +#include <stdint.h> + +typedef uint64_t freq_t; +class adf4350_regs; + +class adf4350 +{ +public: + adf4350(usrp_basic_sptr _usrp, int _which, int _spi_enable); + ~adf4350(); + void _update(); + bool _get_locked(); + void _enable(bool enable); + void _write(uint8_t addr, uint32_t data); + bool _set_freq(freq_t freq); + freq_t _get_freq(); + freq_t _get_max_freq(); + freq_t _get_min_freq(); + +protected: + usrp_basic_sptr d_usrp; + int d_which; + int d_spi_enable; + int d_spi_format; + adf4350_regs *d_regs; +}; + +#endif /* INCLUDED_ADF4350_H */ diff --git a/usrp/host/lib/db_wbxng_adf4350_regs.cc b/usrp/host/lib/db_wbxng_adf4350_regs.cc new file mode 100644 index 000000000..11dcf8816 --- /dev/null +++ b/usrp/host/lib/db_wbxng_adf4350_regs.cc @@ -0,0 +1,114 @@ +/* + * Copyright 2009 Ettus Research LLC + */ + +#include "db_wbxng_adf4350_regs.h" +#include "db_wbxng_adf4350.h" + +//#include "cal_div.h" + +/* reg 0 */ +/* reg 1 */ +const uint8_t adf4350_regs::s_prescaler = 0; +const uint16_t adf4350_regs::s_phase = 0; +/* reg 2 */ +const uint8_t adf4350_regs::s_low_noise_and_low_spur_modes = 0; +const uint8_t adf4350_regs::s_muxout = 6; +const uint8_t adf4350_regs::s_reference_doubler = 0; +const uint8_t adf4350_regs::s_rdiv2 = 0; +const uint8_t adf4350_regs::s_double_buff = 0; +const uint8_t adf4350_regs::s_charge_pump_setting = 5; +const uint8_t adf4350_regs::s_ldf = 0; +const uint8_t adf4350_regs::s_ldp = 0; +const uint8_t adf4350_regs::s_pd_polarity = 1; +const uint8_t adf4350_regs::s_power_down = 0; +const uint8_t adf4350_regs::s_cp_three_state = 0; +const uint8_t adf4350_regs::s_counter_reset = 0; +/* reg 3 */ +const uint8_t adf4350_regs::s_csr = 0; +const uint8_t adf4350_regs::s_clk_div_mode = 0; +const uint16_t adf4350_regs::s_12_bit_clock_divider_value = 0; +/* reg 4 */ +const uint8_t adf4350_regs::s_feedback_select = 1; +const uint8_t adf4350_regs::s_vco_power_down = 0; +const uint8_t adf4350_regs::s_mtld = 0; +const uint8_t adf4350_regs::s_aux_output_select = 0; +const uint8_t adf4350_regs::s_aux_output_enable = 1; +const uint8_t adf4350_regs::s_aux_output_power = 3; +const uint8_t adf4350_regs::s_rf_output_enable = 1; +const uint8_t adf4350_regs::s_output_power = 3; +/* reg 5 */ +const uint8_t adf4350_regs::s_ld_pin_mode = 1; + +adf4350_regs::adf4350_regs(adf4350* _adf4350){ + d_adf4350 = _adf4350; + + /* reg 0 */ + d_int = uint16_t(100); + d_frac = 0; + /* reg 1 */ + d_mod = uint16_t(0xfff); /* max fractional accuracy */ + /* reg 2 */ + d_10_bit_r_counter = uint16_t(2); + /* reg 3 */ + /* reg 4 */ + d_divider_select = 0; + d_8_bit_band_select_clock_divider_value = 0; + /* reg 5 */ +} + +adf4350_regs::~adf4350_regs(void){ +} + +uint32_t +adf4350_regs::_reg_shift(uint32_t data, uint32_t shift){ + return data << shift; + } + +void +adf4350_regs::_load_register(uint8_t addr){ + uint32_t data; + switch (addr){ + case 0: data = ( + _reg_shift(d_int, 15) | + _reg_shift(d_frac, 3)); break; + case 1: data = ( + _reg_shift(s_prescaler, 27) | + _reg_shift(s_phase, 15) | + _reg_shift(d_mod, 3)); break; + case 2: data = ( + _reg_shift(s_low_noise_and_low_spur_modes, 29) | + _reg_shift(s_muxout, 26) | + _reg_shift(s_reference_doubler, 25) | + _reg_shift(s_rdiv2, 24) | + _reg_shift(d_10_bit_r_counter, 14) | + _reg_shift(s_double_buff, 13) | + _reg_shift(s_charge_pump_setting, 9) | + _reg_shift(s_ldf, 8) | + _reg_shift(s_ldp, 7) | + _reg_shift(s_pd_polarity, 6) | + _reg_shift(s_power_down, 5) | + _reg_shift(s_cp_three_state, 4) | + _reg_shift(s_counter_reset, 3)); break; + case 3: data = ( + _reg_shift(s_csr, 18) | + _reg_shift(s_clk_div_mode, 15) | + _reg_shift(s_12_bit_clock_divider_value, 3)); break; + case 4: data = ( + _reg_shift(s_feedback_select, 23) | + _reg_shift(d_divider_select, 20) | + _reg_shift(d_8_bit_band_select_clock_divider_value, 12) | + _reg_shift(s_vco_power_down, 11) | + _reg_shift(s_mtld, 10) | + _reg_shift(s_aux_output_select, 9) | + _reg_shift(s_aux_output_enable, 8) | + _reg_shift(s_aux_output_power, 6) | + _reg_shift(s_rf_output_enable, 5) | + _reg_shift(s_output_power, 3)); break; + case 5: data = ( + _reg_shift(s_ld_pin_mode, 22)); break; + default: return; + } + /* write the data out to spi */ + d_adf4350->_write(addr, data); +} diff --git a/usrp/host/lib/db_wbxng_adf4350_regs.h b/usrp/host/lib/db_wbxng_adf4350_regs.h new file mode 100644 index 000000000..dc941ee87 --- /dev/null +++ b/usrp/host/lib/db_wbxng_adf4350_regs.h @@ -0,0 +1,64 @@ +/* + * Copyright 2009 Ettus Research LLC + */ + +#ifndef ADF4350_REGS_H +#define ADF4350_REGS_H + +#include <usrp/db_base.h> +#include <stdint.h> + +class adf4350; + +class adf4350_regs +{ +public: + adf4350_regs(adf4350* _adf4350); + ~adf4350_regs(); + + adf4350* d_adf4350; + + uint32_t _reg_shift(uint32_t data, uint32_t shift); + void _load_register(uint8_t addr); + + /* reg 0 */ + uint16_t d_int; + uint16_t d_frac; + /* reg 1 */ + static const uint8_t s_prescaler; + static const uint16_t s_phase; + uint16_t d_mod; + /* reg 2 */ + static const uint8_t s_low_noise_and_low_spur_modes; + static const uint8_t s_muxout; + static const uint8_t s_reference_doubler; + static const uint8_t s_rdiv2; + uint16_t d_10_bit_r_counter; + static const uint8_t s_double_buff; + static const uint8_t s_charge_pump_setting; + static const uint8_t s_ldf; + static const uint8_t s_ldp; + static const uint8_t s_pd_polarity; + static const uint8_t s_power_down; + static const uint8_t s_cp_three_state; + static const uint8_t s_counter_reset; + /* reg 3 */ + static const uint8_t s_csr; + static const uint8_t s_clk_div_mode; + static const uint16_t s_12_bit_clock_divider_value; + /* reg 4 */ + static const uint8_t s_feedback_select; + uint8_t d_divider_select; + uint8_t d_8_bit_band_select_clock_divider_value; + static const uint8_t s_vco_power_down; + static const uint8_t s_mtld; + static const uint8_t s_aux_output_select; + static const uint8_t s_aux_output_enable; + static const uint8_t s_aux_output_power; + static const uint8_t s_rf_output_enable; + static const uint8_t s_output_power; + /* reg 5 */ + static const uint8_t s_ld_pin_mode; +}; + +#endif /* ADF4350_REGS_H */ diff --git a/usrp/host/lib/fusb_darwin.cc b/usrp/host/lib/fusb_darwin.cc index 737387b87..95c4878aa 100644 --- a/usrp/host/lib/fusb_darwin.cc +++ b/usrp/host/lib/fusb_darwin.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2006 Free Software Foundation, Inc. + * Copyright 2006,2009 Free Software Foundation, Inc. * * This file is part of GNU Radio. * @@ -33,6 +33,7 @@ #include "fusb.h" #include "fusb_darwin.h" #include "darwin_libusb.h" +#include <iostream> static const int USB_TIMEOUT = 100; // in milliseconds static const UInt8 NUM_QUEUE_ITEMS = 20; @@ -153,9 +154,10 @@ fusb_ephandle_darwin::start () USB_ERROR_STR (false, -ENOENT, "fusb_ephandle_darwin::start: " "device not initialized"); - if (usb_debug) - fprintf (stderr, "fusb_ephandle_darwin::start: " - "dev = %p, device = %p\n", dev, device); + if (usb_debug) { + std::cerr << "fusb_ephandle_darwin::start: dev = " << + (void*) dev << ", device = " << (void*) device << std::endl; + } d_interfaceRef = device->interface; if (! d_interfaceRef) @@ -165,10 +167,10 @@ fusb_ephandle_darwin::start () // get read or write pipe info (depends on "d_input_p") - if (usb_debug > 3) - fprintf (stderr, "fusb_ephandle_darwin::start " - "d_endpoint = %d, d_input_p = %s\n", - d_endpoint, d_input_p ? "TRUE" : "FALSE"); + if (usb_debug > 3) { + std::cerr << "fusb_ephandle_darwin::start d_endpoint = " << d_endpoint + << ", d_input_p = " << (d_input_p ? "TRUE" : "FALSE") << std::endl; + } int l_endpoint = (d_input_p ? USB_ENDPOINT_IN : USB_ENDPOINT_OUT); int pipeRef = ep_to_pipeRef (device, d_endpoint | l_endpoint); @@ -184,12 +186,14 @@ fusb_ephandle_darwin::start () &d_transferType, &maxPacketSize, &interval); - if (usb_debug == 3) - fprintf (stderr, "fusb_ephandle_darwin::start: %s: ep = 0x%02x, " - "pipeRef = %d, d_i = %p, d_iR = %p, if_dir = %d, if_# = %d, " - "if_int = %d, if_maxPS = %d\n", d_input_p ? "read" : "write", - d_endpoint, d_pipeRef, d_interface, d_interfaceRef, direction, - number, interval, maxPacketSize); + if (usb_debug == 3) { + std::cerr << "fusb_ephandle_darwin::start: " << (d_input_p ? "read" : "write") + << ": ep = " << d_endpoint << ", pipeRef = " << d_pipeRef << "interface = " + << d_interface << ", interfaceRef = " << d_interfaceRef + << ", if_direction = " << direction << ", if_# = " << number + << ", if_interval = " << interval << ", if_maxPacketSize = " + << maxPacketSize << std::endl; + } // set global start boolean d_started = true; @@ -205,9 +209,10 @@ fusb_ephandle_darwin::start () // going; this will unlock the mutex before waiting for a signal () d_runBlock->wait (); - if (usb_debug) - fprintf (stderr, "fusb_ephandle_darwin::start: %s started.\n", - d_input_p ? "read" : "write"); + if (usb_debug) { + std::cerr << "fusb_ephandle_darwin::start: " << (d_input_p ? "read" : "write") + << " started." << std::endl; + } return (true); } @@ -229,10 +234,10 @@ fusb_ephandle_darwin::run_thread (void* arg) bool l_input_p = This->d_input_p; - if (usb_debug) - fprintf (stderr, "fusb_ephandle_darwin::run_thread: " - "starting for %s.\n", - l_input_p ? "read" : "write"); + if (usb_debug) { + std::cerr << "fusb_ephandle_darwin::run_thread: starting for " + << (l_input_p ? "read" : "write") << "." << std::endl; + } usb_interface_t** l_interfaceRef = This->d_interfaceRef; usb_interface_t* l_interface = This->d_interface; @@ -286,9 +291,10 @@ fusb_ephandle_darwin::run_thread (void* arg) CFRunLoopRemoveSource (CFRunLoopGetCurrent (), l_cfSource, kCFRunLoopDefaultMode); - if (usb_debug) - fprintf (stderr, "fusb_ephandle_darwin::run_thread: finished for %s.\n", - l_input_p ? "read" : "write"); + if (usb_debug) { + std::cerr << "fusb_ephandle_darwin::run_thread: finished for " + << (l_input_p ? "read" : "write") << "." << std::endl; + } // release the run thread running mutex l_runThreadRunning->unlock (); @@ -297,8 +303,9 @@ fusb_ephandle_darwin::run_thread (void* arg) void fusb_ephandle_darwin::read_thread (void* arg) { - if (usb_debug) - fprintf (stderr, "fusb_ephandle_darwin::read_thread: starting.\n"); + if (usb_debug) { + std::cerr << "fusb_ephandle_darwin::read_thread: starting." << std::endl; + } fusb_ephandle_darwin* This = static_cast<fusb_ephandle_darwin*>(arg); @@ -331,8 +338,9 @@ fusb_ephandle_darwin::read_thread (void* arg) l_node = l_queue->iterate_next (); } - if (usb_debug) - fprintf (stderr, "fusb_ephandle_darwin::read_thread: finished.\n"); + if (usb_debug) { + std::cerr << "fusb_ephandle_darwin::read_thread: finished." << std::endl; + } // release the read running mutex, to let the parent thread knows // that this thread is finished @@ -343,10 +351,11 @@ void fusb_ephandle_darwin::read_issue (s_both_ptr l_both) { if ((! l_both) || (! d_started)) { - if (usb_debug > 4) - fprintf (stderr, "fusb_ephandle_darwin::read_issue: Doing nothing; " - "l_both is %X; started is %s\n", (unsigned int) l_both, - d_started ? "TRUE" : "FALSE"); + if (usb_debug > 4) { + std::cerr << "fusb_ephandle_darwin::read_issue: Doing nothing; " + << "l_both is " << (void*) l_both << "; started is " + << (d_started ? "TRUE" : "FALSE") << std::endl; + } return; } @@ -356,7 +365,7 @@ fusb_ephandle_darwin::read_issue (s_both_ptr l_both) void* v_buffer = (void*) l_buf->buffer (); // read up to d_bufLenBytes - UInt32 bufLen = d_bufLenBytes; + size_t bufLen = d_bufLenBytes; l_buf->n_used (bufLen); // setup system call result @@ -378,9 +387,10 @@ fusb_ephandle_darwin::read_issue (s_both_ptr l_both) "(ReadPipeAsync%s): %s", d_transferType == kUSBInterrupt ? "" : "TO", darwin_error_str (result)); - else if (usb_debug > 4) - fprintf (stderr, "fusb_ephandle_darwin::read_issue: " - "Queued %X (%ld Bytes)\n", (unsigned int) l_both, bufLen); + else if (usb_debug > 4) { + std::cerr << "fusb_ephandle_darwin::read_issue: Queued " << (void*) l_both + << " (" << bufLen << " Bytes)" << std::endl; + } } void @@ -388,26 +398,27 @@ fusb_ephandle_darwin::read_completed (void* refCon, io_return_t result, void* io_size) { - UInt32 l_size = (UInt32) io_size; + size_t l_size = (size_t) io_size; s_both_ptr l_both = static_cast<s_both_ptr>(refCon); fusb_ephandle_darwin* This = static_cast<fusb_ephandle_darwin*>(l_both->This ()); s_node_ptr l_node = l_both->node (); circular_buffer<char>* l_buffer = This->d_buffer; s_buffer_ptr l_buf = l_node->object (); - UInt32 l_i_size = l_buf->n_used (); - - if (This->d_started && (l_i_size != l_size)) - fprintf (stderr, "fusb_ephandle_darwin::read_completed: " - "Expected %ld bytes; read %ld.\n", - l_i_size, l_size); - else if (usb_debug > 4) - fprintf (stderr, "fusb_ephandle_darwin::read_completed: " - "Read %X (%ld bytes)\n", - (unsigned int) l_both, l_size); - -// add this read to the transfer buffer + size_t l_i_size = l_buf->n_used (); + + if (This->d_started && (l_i_size != l_size)) { + std::cerr << "fusb_ephandle_darwin::read_completed: Expected " << l_i_size + << " bytes; read " << l_size << "." << std::endl; + } else if (usb_debug > 4) { + std::cerr << "fusb_ephandle_darwin::read_completed: Read " << (void*) l_both + << " (" << l_size << " bytes)" << std::endl; + } + +// add this read to the transfer buffer, and check for overflow +// -> data is being enqueued faster than it can be dequeued if (l_buffer->enqueue (l_buf->buffer (), l_size) == -1) { - fputs ("iU", stderr); +// print out that there's an overflow + fputs ("uO", stderr); fflush (stderr); } @@ -421,11 +432,13 @@ fusb_ephandle_darwin::read_completed (void* refCon, int fusb_ephandle_darwin::read (void* buffer, int nbytes) { - UInt32 l_nbytes = (UInt32) nbytes; + size_t l_nbytes = (size_t) nbytes; d_buffer->dequeue ((char*) buffer, &l_nbytes); - if (usb_debug > 4) - fprintf (stderr, "fusb_ephandle_darwin::read: request for %d bytes, %ld bytes retrieved.\n", nbytes, l_nbytes); + if (usb_debug > 4) { + std::cerr << "fusb_ephandle_darwin::read: request for " << nbytes + << " bytes, " << l_nbytes << " bytes retrieved." << std::endl; + } return ((int) l_nbytes); } @@ -433,18 +446,18 @@ fusb_ephandle_darwin::read (void* buffer, int nbytes) int fusb_ephandle_darwin::write (const void* buffer, int nbytes) { - UInt32 l_nbytes = (UInt32) nbytes; + size_t l_nbytes = (size_t) nbytes; if (! d_started) { - if (usb_debug) - fprintf (stderr, "fusb_ephandle_darwin::write: Not yet started.\n"); - + if (usb_debug) { + std::cerr << "fusb_ephandle_darwin::write: Not yet started." << std::endl; + } return (0); } while (l_nbytes != 0) { // find out how much data to copy; limited to "d_bufLenBytes" per node - UInt32 t_nbytes = (l_nbytes > d_bufLenBytes) ? d_bufLenBytes : l_nbytes; + size_t t_nbytes = (l_nbytes > d_bufLenBytes) ? d_bufLenBytes : l_nbytes; // get next available node to write into; // blocks internally if none available @@ -476,8 +489,8 @@ fusb_ephandle_darwin::write (const void* buffer, int nbytes) d_transferType == kUSBInterrupt ? "" : "TO", darwin_error_str (result)); else if (usb_debug > 4) { - fprintf (stderr, "fusb_ephandle_darwin::write_thread: " - "Queued %X (%ld Bytes)\n", (unsigned int) l_both, t_nbytes); + std::cerr << "fusb_ephandle_darwin::write_thread: Queued " << (void*) l_both + << " (" << t_nbytes << " Bytes)" << std::endl; } l_nbytes -= t_nbytes; } @@ -492,19 +505,19 @@ fusb_ephandle_darwin::write_completed (void* refCon, { s_both_ptr l_both = static_cast<s_both_ptr>(refCon); fusb_ephandle_darwin* This = static_cast<fusb_ephandle_darwin*>(l_both->This ()); - UInt32 l_size = (UInt32) io_size; + size_t l_size = (size_t) io_size; s_node_ptr l_node = l_both->node (); s_queue_ptr l_queue = This->d_queue; s_buffer_ptr l_buf = l_node->object (); - UInt32 l_i_size = l_buf->n_used (); - - if (This->d_started && (l_i_size != l_size)) - fprintf (stderr, "fusb_ephandle_darwin::write_completed: " - "Expected %ld bytes written; wrote %ld.\n", - l_i_size, l_size); - else if (usb_debug > 4) - fprintf (stderr, "fusb_ephandle_darwin::write_completed: " - "Wrote %X (%ld Bytes)\n", (unsigned int) l_both, l_size); + size_t l_i_size = l_buf->n_used (); + + if (This->d_started && (l_i_size != l_size)) { + std::cerr << "fusb_ephandle_darwin::write_completed: Expected " << l_i_size + << " bytes written; wrote " << l_size << "." << std::endl; + } else if (usb_debug > 4) { + std::cerr << "fusb_ephandle_darwin::write_completed: Wrote " << (void*) l_both + << " (" << l_size << " Bytes)" << std::endl; + } // set buffer's # data to 0 l_buf->n_used (0); @@ -515,8 +528,9 @@ fusb_ephandle_darwin::write_completed (void* refCon, void fusb_ephandle_darwin::abort () { - if (usb_debug) - fprintf (stderr, "fusb_ephandle_darwin::abort: starting.\n"); + if (usb_debug) { + std::cerr << "fusb_ephandle_darwin::abort: starting." << std::endl; + } io_return_t result = d_interface->AbortPipe (d_interfaceRef, d_pipeRef); @@ -524,8 +538,9 @@ fusb_ephandle_darwin::abort () USB_ERROR_STR_NO_RET (- darwin_to_errno (result), "fusb_ephandle_darwin::abort " "(AbortPipe): %s", darwin_error_str (result)); - if (usb_debug) - fprintf (stderr, "fusb_ephandle_darwin::abort: finished.\n"); + if (usb_debug) { + std::cerr << "fusb_ephandle_darwin::abort: finished." << std::endl; + } } bool @@ -534,9 +549,10 @@ fusb_ephandle_darwin::stop () if (! d_started) return (true); - if (usb_debug) - fprintf (stderr, "fusb_ephandle_darwin::stop: stopping %s.\n", - d_input_p ? "read" : "write"); + if (usb_debug) { + std::cerr << "fusb_ephandle_darwin::stop: stopping " + << (d_input_p ? "read" : "write") << "." << std::endl; + } d_started = false; @@ -556,9 +572,10 @@ fusb_ephandle_darwin::stop () d_runThreadRunning->lock (); d_runThreadRunning->unlock (); - if (usb_debug) - fprintf (stderr, "fusb_ephandle_darwin::stop: %s stopped.\n", - d_input_p ? "read" : "write"); + if (usb_debug) { + std::cerr << "fusb_ephandle_darwin::stop: " << (d_input_p ? "read" : "write") + << " stopped." << std::endl; + } return (true); } diff --git a/usrp/host/lib/fusb_darwin.h b/usrp/host/lib/fusb_darwin.h index bb717b58c..735e5f16d 100644 --- a/usrp/host/lib/fusb_darwin.h +++ b/usrp/host/lib/fusb_darwin.h @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2006 Free Software Foundation, Inc. + * Copyright 2006,2009 Free Software Foundation, Inc. * * This file is part of GNU Radio. * @@ -75,10 +75,10 @@ class s_buffer { private: char* d_buffer; - UInt32 d_n_used, d_n_alloc; + size_t d_n_used, d_n_alloc; public: - inline s_buffer (UInt32 n_alloc = 0) { + inline s_buffer (size_t n_alloc = 0) { d_n_used = 0; d_n_alloc = n_alloc; if (n_alloc) { @@ -92,17 +92,17 @@ public: delete [] d_buffer; } }; - inline UInt32 n_used () { return (d_n_used); }; - inline void n_used (UInt32 bufLen) { + inline size_t n_used () { return (d_n_used); }; + inline void n_used (size_t bufLen) { d_n_used = (bufLen > d_n_alloc) ? d_n_alloc : bufLen; }; - inline UInt32 n_alloc () { return (d_n_alloc); }; - void buffer (char* l_buffer, UInt32 bufLen) { + inline size_t n_alloc () { return (d_n_alloc); }; + void buffer (char* l_buffer, size_t bufLen) { if (bufLen > d_n_alloc) { - fprintf (stderr, "s_buffer::set: Copying only allocated bytes.\n"); + std::cerr << "s_buffer::set: Copying only allocated bytes." << std::endl; bufLen = d_n_alloc; } if (!l_buffer) { - fprintf (stderr, "s_buffer::set: NULL buffer.\n"); + std::cerr << "s_buffer::set: NULL buffer." << std::endl; return; } bcopy (l_buffer, d_buffer, bufLen); @@ -173,7 +173,7 @@ public: usb_interface_t* d_interface; s_queue_ptr d_queue; circular_buffer<char>* d_buffer; - UInt32 d_bufLenBytes; + size_t d_bufLenBytes; mld_mutex_ptr d_readRunning; mld_condition_ptr d_runBlock, d_readBlock; diff --git a/usrp/host/lib/usrp_basic.h.in b/usrp/host/lib/usrp_basic.h.in deleted file mode 100644 index 3faa5304f..000000000 --- a/usrp/host/lib/usrp_basic.h.in +++ /dev/null @@ -1,960 +0,0 @@ -class fusb_devhandle; -class fusb_ephandle; - -enum txrx_t { - C_RX = 0, - C_TX = 1 -}; - -/* - * ---------------------------------------------------------------------- - * Mid level interface to the Universal Software Radio Peripheral (Rev 1) - * - * These classes implement the basic functionality for talking to the - * USRP. They try to be as independent of the signal processing code - * in FPGA as possible. They implement access to the low level - * peripherals on the board, provide a common way for reading and - * writing registers in the FPGA, and provide the high speed interface - * to streaming data across the USB. - * - * It is expected that subclasses will be derived that provide - * access to the functionality to a particular FPGA configuration. - * ---------------------------------------------------------------------- - */ - - -/*! - * \brief abstract base class for usrp operations - * \ingroup usrp - */ -class usrp_basic : boost::noncopyable -{ -protected: - void shutdown_daughterboards(); - -protected: - libusb_device_handle *d_udh; - struct libusb_context *d_ctx; - int d_usb_data_rate; // bytes/sec - int d_bytes_per_poll; // how often to poll for overruns - bool d_verbose; - long d_fpga_master_clock_freq; - - static const int MAX_REGS = 128; - unsigned int d_fpga_shadows[MAX_REGS]; - - int d_dbid[2]; // daughterboard ID's (side A, side B) - - /*! - * Shared pointers to subclasses of db_base. - * - * The outer vector is of length 2 (0 = side A, 1 = side B). The - * inner vectors are of length 1, 2 or 3 depending on the number of - * subdevices implemented by the daugherboard. At this time, only - * the Basic Rx and LF Rx implement more than 1 subdevice. - */ - std::vector< std::vector<db_base_sptr> > d_db; - - //! One time call, made only only from usrp_standard_*::make after shared_ptr is created. - void init_db(usrp_basic_sptr u); - - - usrp_basic (int which_board, - libusb_device_handle *open_interface (libusb_device *dev), - const std::string fpga_filename = "", - const std::string firmware_filename = ""); - - /*! - * \brief advise usrp_basic of usb data rate (bytes/sec) - * - * N.B., this doesn't tweak any hardware. Derived classes - * should call this to inform us of the data rate whenever it's - * first set or if it changes. - * - * \param usb_data_rate bytes/sec - */ - void set_usb_data_rate (int usb_data_rate); - - /*! - * \brief Write auxiliary digital to analog converter. - * - * \param slot Which Tx or Rx slot to write. - * N.B., SLOT_TX_A and SLOT_RX_A share the same AUX DAC's. - * SLOT_TX_B and SLOT_RX_B share the same AUX DAC's. - * \param which_dac [0,3] RX slots must use only 0 and 1. TX slots must use only 2 and 3. - * \param value [0,4095] - * \returns true iff successful - */ - bool _write_aux_dac (int slot, int which_dac, int value); - - /*! - * \brief Read auxiliary analog to digital converter. - * - * \param slot 2-bit slot number. E.g., SLOT_TX_A - * \param which_adc [0,1] - * \param value return 12-bit value [0,4095] - * \returns true iff successful - */ - bool _read_aux_adc (int slot, int which_adc, int *value); - - /*! - * \brief Read auxiliary analog to digital converter. - * - * \param slot 2-bit slot number. E.g., SLOT_TX_A - * \param which_adc [0,1] - * \returns value in the range [0,4095] if successful, else READ_FAILED. - */ - int _read_aux_adc (int slot, int which_adc); - - -public: - virtual ~usrp_basic (); - - - /*! - * Return a vector of vectors that contain shared pointers - * to the daughterboard instance(s) associated with the specified side. - * - * It is an error to use the returned objects after the usrp_basic - * object has been destroyed. - */ - std::vector<std::vector<db_base_sptr> > db() const { return d_db; } - - /*! - * Return a vector of size >= 1 that contains shared pointers - * to the daughterboard instance(s) associated with the specified side. - * - * \param which_side [0,1] which daughterboard - * - * It is an error to use the returned objects after the usrp_basic - * object has been destroyed. - */ - std::vector<db_base_sptr> db(int which_side); - - /*! - * \brief is the subdev_spec valid? - */ - bool is_valid(const usrp_subdev_spec &ss); - - /*! - * \brief given a subdev_spec, return the corresponding daughterboard object. - * \throws std::invalid_ argument if ss is invalid. - * - * \param ss specifies the side and subdevice - */ - db_base_sptr selected_subdev(const usrp_subdev_spec &ss); - - /*! - * \brief return frequency of master oscillator on USRP - */ - long fpga_master_clock_freq () const { return d_fpga_master_clock_freq; } - - /*! - * Tell API that the master oscillator on the USRP is operating at a non-standard - * fixed frequency. This is only needed for custom USRP hardware modified to - * operate at a different frequency from the default factory configuration. This - * function must be called prior to any other API function. - * \param master_clock USRP2 FPGA master clock frequency in Hz (10..64 MHz) - */ - void set_fpga_master_clock_freq (long master_clock) { d_fpga_master_clock_freq = master_clock; } - - /*! - * \returns usb data rate in bytes/sec - */ - int usb_data_rate () const { return d_usb_data_rate; } - - void set_verbose (bool on) { d_verbose = on; } - - //! magic value used on alternate register read interfaces - static const int READ_FAILED = -99999; - - /*! - * \brief Write EEPROM on motherboard or any daughterboard. - * \param i2c_addr I2C bus address of EEPROM - * \param eeprom_offset byte offset in EEPROM to begin writing - * \param buf the data to write - * \returns true iff sucessful - */ - bool write_eeprom (int i2c_addr, int eeprom_offset, const std::string buf); - - /*! - * \brief Read EEPROM on motherboard or any daughterboard. - * \param i2c_addr I2C bus address of EEPROM - * \param eeprom_offset byte offset in EEPROM to begin reading - * \param len number of bytes to read - * \returns the data read if successful, else a zero length string. - */ - std::string read_eeprom (int i2c_addr, int eeprom_offset, int len); - - /*! - * \brief Write to I2C peripheral - * \param i2c_addr I2C bus address (7-bits) - * \param buf the data to write - * \returns true iff successful - * Writes are limited to a maximum of of 64 bytes. - */ - bool write_i2c (int i2c_addr, const std::string buf); - - /*! - * \brief Read from I2C peripheral - * \param i2c_addr I2C bus address (7-bits) - * \param len number of bytes to read - * \returns the data read if successful, else a zero length string. - * Reads are limited to a maximum of 64 bytes. - */ - std::string read_i2c (int i2c_addr, int len); - - /*! - * \brief Set ADC offset correction - * \param which_adc which ADC[0,3]: 0 = RX_A I, 1 = RX_A Q... - * \param offset 16-bit value to subtract from raw ADC input. - */ - bool set_adc_offset (int which_adc, int offset); - - /*! - * \brief Set DAC offset correction - * \param which_dac which DAC[0,3]: 0 = TX_A I, 1 = TX_A Q... - * \param offset 10-bit offset value (ambiguous format: See AD9862 datasheet). - * \param offset_pin 1-bit value. If 0 offset applied to -ve differential pin; - * If 1 offset applied to +ve differential pin. - */ - bool set_dac_offset (int which_dac, int offset, int offset_pin); - - /*! - * \brief Control ADC input buffer - * \param which_adc which ADC[0,3] - * \param bypass if non-zero, bypass input buffer and connect input - * directly to switched cap SHA input of RxPGA. - */ - bool set_adc_buffer_bypass (int which_adc, bool bypass); - - /*! - * \brief Enable/disable automatic DC offset removal control loop in FPGA - * - * \param bits which control loops to enable - * \param mask which \p bits to pay attention to - * - * If the corresponding bit is set, enable the automatic DC - * offset correction control loop. - * - * <pre> - * The 4 low bits are significant: - * - * ADC0 = (1 << 0) - * ADC1 = (1 << 1) - * ADC2 = (1 << 2) - * ADC3 = (1 << 3) - * </pre> - * - * By default the control loop is enabled on all ADC's. - */ - bool set_dc_offset_cl_enable(int bits, int mask); - - /*! - * \brief return the usrp's serial number. - * - * \returns non-zero length string iff successful. - */ - std::string serial_number(); - - /*! - * \brief Return daughterboard ID for given side [0,1]. - * - * \param which_side [0,1] which daughterboard - * - * \return daughterboard id >= 0 if successful - * \return -1 if no daugherboard - * \return -2 if invalid EEPROM on daughterboard - */ - virtual int daughterboard_id (int which_side) const = 0; - - /*! - * \brief Clock ticks to delay rising of T/R signal - * \sa write_atr_mask, write_atr_txval, write_atr_rxval - */ - bool write_atr_tx_delay(int value); - - /*! - * \brief Clock ticks to delay falling edge of T/R signal - * \sa write_atr_mask, write_atr_txval, write_atr_rxval - */ - bool write_atr_rx_delay(int value); - - - // ================================================================ - // Routines to access and control daughterboard specific i/o - // - // Those with a common_ prefix access either the Tx or Rx side depending - // on the txrx parameter. Those without the common_ prefix are virtual - // and are overriden in usrp_basic_rx and usrp_basic_tx to access the - // the Rx or Tx sides automatically. We provide the common_ versions - // for those daughterboards such as the WBX and XCVR2450 that share - // h/w resources (such as the LO) between the Tx and Rx sides. - - // ---------------------------------------------------------------- - // BEGIN common_ daughterboard control functions - - /*! - * \brief Set Programmable Gain Amplifier(PGA) - * - * \param txrx Tx or Rx? - * \param which_amp which amp [0,3] - * \param gain_in_db gain value(linear in dB) - * - * gain is rounded to closest setting supported by hardware. - * - * \returns true iff sucessful. - * - * \sa pga_min(), pga_max(), pga_db_per_step() - */ - bool common_set_pga(txrx_t txrx, int which_amp, double gain_in_db); - - /*! - * \brief Return programmable gain amplifier gain setting in dB. - * - * \param txrx Tx or Rx? - * \param which_amp which amp [0,3] - */ - double common_pga(txrx_t txrx, int which_amp) const; - - /*! - * \brief Return minimum legal PGA gain in dB. - * \param txrx Tx or Rx? - */ - double common_pga_min(txrx_t txrx) const; - - /*! - * \brief Return maximum legal PGA gain in dB. - * \param txrx Tx or Rx? - */ - double common_pga_max(txrx_t txrx) const; - - /*! - * \brief Return hardware step size of PGA(linear in dB). - * \param txrx Tx or Rx? - */ - double common_pga_db_per_step(txrx_t txrx) const; - - /*! - * \brief Write direction register(output enables) for pins that go to daughterboard. - * - * \param txrx Tx or Rx? - * \param which_side [0,1] which size - * \param value value to write into register - * \param mask which bits of value to write into reg - * - * Each d'board has 16-bits of general purpose i/o. - * Setting the bit makes it an output from the FPGA to the d'board. - * - * This register is initialized based on a value stored in the - * d'board EEPROM. In general, you shouldn't be using this routine - * without a very good reason. Using this method incorrectly will - * kill your USRP motherboard and/or daughterboard. - */ - bool _common_write_oe(txrx_t txrx, int which_side, int value, int mask); - - /*! - * \brief Write daughterboard i/o pin value - * - * \param txrx Tx or Rx? - * \param which_side [0,1] which d'board - * \param value value to write into register - * \param mask which bits of value to write into reg - */ - bool common_write_io(txrx_t txrx, int which_side, int value, int mask); - - /*! - * \brief Read daughterboard i/o pin value - * - * \param txrx Tx or Rx? - * \param which_side [0,1] which d'board - * \param value output - */ - bool common_read_io(txrx_t txrx, int which_side, int *value); - - /*! - * \brief Read daughterboard i/o pin value - * - * \param txrx Tx or Rx? - * \param which_side [0,1] which d'board - * \returns register value if successful, else READ_FAILED - */ - int common_read_io(txrx_t txrx, int which_side); - - /*! - * \brief Write daughterboard refclk config register - * - * \param txrx Tx or Rx? - * \param which_side [0,1] which d'board - * \param value value to write into register, see below - * - * <pre> - * Control whether a reference clock is sent to the daughterboards, - * and what frequency. The refclk is sent on d'board i/o pin 0. - * - * 3 2 1 - * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 - * +-----------------------------------------------+-+------------+ - * | Reserved (Must be zero) |E| DIVISOR | - * +-----------------------------------------------+-+------------+ - * - * Bit 7 -- 1 turns on refclk, 0 allows IO use - * Bits 6:0 Divider value - * </pre> - */ - bool common_write_refclk(txrx_t txrx, int which_side, int value); - - /*! - * \brief Automatic Transmit/Receive switching - * <pre> - * - * If automatic transmit/receive (ATR) switching is enabled in the - * FR_ATR_CTL register, the presence or absence of data in the FPGA - * transmit fifo selects between two sets of values for each of the 4 - * banks of daughterboard i/o pins. - * - * Each daughterboard slot has 3 16-bit registers associated with it: - * FR_ATR_MASK_*, FR_ATR_TXVAL_* and FR_ATR_RXVAL_* - * - * FR_ATR_MASK_{0,1,2,3}: - * - * These registers determine which of the daugherboard i/o pins are - * affected by ATR switching. If a bit in the mask is set, the - * corresponding i/o bit is controlled by ATR, else it's output - * value comes from the normal i/o pin output register: - * FR_IO_{0,1,2,3}. - * - * FR_ATR_TXVAL_{0,1,2,3}: - * FR_ATR_RXVAL_{0,1,2,3}: - * - * If the Tx fifo contains data, then the bits from TXVAL that are - * selected by MASK are output. Otherwise, the bits from RXVAL that - * are selected by MASK are output. - * </pre> - */ - bool common_write_atr_mask(txrx_t txrx, int which_side, int value); - bool common_write_atr_txval(txrx_t txrx, int which_side, int value); - bool common_write_atr_rxval(txrx_t txrx, int which_side, int value); - - /*! - * \brief Write auxiliary digital to analog converter. - * - * \param txrx Tx or Rx? - * \param which_side [0,1] which d'board - * N.B., SLOT_TX_A and SLOT_RX_A share the same AUX DAC's. - * SLOT_TX_B and SLOT_RX_B share the same AUX DAC's. - * \param which_dac [2,3] TX slots must use only 2 and 3. - * \param value [0,4095] - * \returns true iff successful - */ - bool common_write_aux_dac(txrx_t txrx, int which_side, int which_dac, int value); - - /*! - * \brief Read auxiliary analog to digital converter. - * - * \param txrx Tx or Rx? - * \param which_side [0,1] which d'board - * \param which_adc [0,1] - * \param value return 12-bit value [0,4095] - * \returns true iff successful - */ - bool common_read_aux_adc(txrx_t txrx, int which_side, int which_adc, int *value); - - /*! - * \brief Read auxiliary analog to digital converter. - * - * \param txrx Tx or Rx? - * \param which_side [0,1] which d'board - * \param which_adc [0,1] - * \returns value in the range [0,4095] if successful, else READ_FAILED. - */ - int common_read_aux_adc(txrx_t txrx, int which_side, int which_adc); - - // END common_ daughterboard control functions - // ---------------------------------------------------------------- - // BEGIN virtual daughterboard control functions - - /*! - * \brief Set Programmable Gain Amplifier (PGA) - * - * \param which_amp which amp [0,3] - * \param gain_in_db gain value (linear in dB) - * - * gain is rounded to closest setting supported by hardware. - * - * \returns true iff sucessful. - * - * \sa pga_min(), pga_max(), pga_db_per_step() - */ - virtual bool set_pga (int which_amp, double gain_in_db) = 0; - - /*! - * \brief Return programmable gain amplifier gain setting in dB. - * - * \param which_amp which amp [0,3] - */ - virtual double pga (int which_amp) const = 0; - - /*! - * \brief Return minimum legal PGA gain in dB. - */ - virtual double pga_min () const = 0; - - /*! - * \brief Return maximum legal PGA gain in dB. - */ - virtual double pga_max () const = 0; - - /*! - * \brief Return hardware step size of PGA (linear in dB). - */ - virtual double pga_db_per_step () const = 0; - - /*! - * \brief Write direction register (output enables) for pins that go to daughterboard. - * - * \param which_side [0,1] which size - * \param value value to write into register - * \param mask which bits of value to write into reg - * - * Each d'board has 16-bits of general purpose i/o. - * Setting the bit makes it an output from the FPGA to the d'board. - * - * This register is initialized based on a value stored in the - * d'board EEPROM. In general, you shouldn't be using this routine - * without a very good reason. Using this method incorrectly will - * kill your USRP motherboard and/or daughterboard. - */ - virtual bool _write_oe (int which_side, int value, int mask) = 0; - - /*! - * \brief Write daughterboard i/o pin value - * - * \param which_side [0,1] which d'board - * \param value value to write into register - * \param mask which bits of value to write into reg - */ - virtual bool write_io (int which_side, int value, int mask) = 0; - - /*! - * \brief Read daughterboard i/o pin value - * - * \param which_side [0,1] which d'board - * \param value output - */ - virtual bool read_io (int which_side, int *value) = 0; - - /*! - * \brief Read daughterboard i/o pin value - * - * \param which_side [0,1] which d'board - * \returns register value if successful, else READ_FAILED - */ - virtual int read_io (int which_side) = 0; - - /*! - * \brief Write daughterboard refclk config register - * - * \param which_side [0,1] which d'board - * \param value value to write into register, see below - * - * <pre> - * Control whether a reference clock is sent to the daughterboards, - * and what frequency. The refclk is sent on d'board i/o pin 0. - * - * 3 2 1 - * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 - * +-----------------------------------------------+-+------------+ - * | Reserved (Must be zero) |E| DIVISOR | - * +-----------------------------------------------+-+------------+ - * - * Bit 7 -- 1 turns on refclk, 0 allows IO use - * Bits 6:0 Divider value - * </pre> - */ - virtual bool write_refclk(int which_side, int value) = 0; - - virtual bool write_atr_mask(int which_side, int value) = 0; - virtual bool write_atr_txval(int which_side, int value) = 0; - virtual bool write_atr_rxval(int which_side, int value) = 0; - - /*! - * \brief Write auxiliary digital to analog converter. - * - * \param which_side [0,1] which d'board - * N.B., SLOT_TX_A and SLOT_RX_A share the same AUX DAC's. - * SLOT_TX_B and SLOT_RX_B share the same AUX DAC's. - * \param which_dac [2,3] TX slots must use only 2 and 3. - * \param value [0,4095] - * \returns true iff successful - */ - virtual bool write_aux_dac (int which_side, int which_dac, int value) = 0; - - /*! - * \brief Read auxiliary analog to digital converter. - * - * \param which_side [0,1] which d'board - * \param which_adc [0,1] - * \param value return 12-bit value [0,4095] - * \returns true iff successful - */ - virtual bool read_aux_adc (int which_side, int which_adc, int *value) = 0; - - /*! - * \brief Read auxiliary analog to digital converter. - * - * \param which_side [0,1] which d'board - * \param which_adc [0,1] - * \returns value in the range [0,4095] if successful, else READ_FAILED. - */ - virtual int read_aux_adc (int which_side, int which_adc) = 0; - - /*! - * \brief returns current fusb block size - */ - virtual int block_size() const = 0; - - /*! - * \brief returns A/D or D/A converter rate in Hz - */ - virtual long converter_rate() const = 0; - - // END virtual daughterboard control functions - - // ---------------------------------------------------------------- - // Low level implementation routines. - // You probably shouldn't be using these... - // - - bool _set_led (int which_led, bool on); - - /*! - * \brief Write FPGA register. - * \param regno 7-bit register number - * \param value 32-bit value - * \returns true iff successful - */ - bool _write_fpga_reg (int regno, int value); //< 7-bit regno, 32-bit value - - /*! - * \brief Read FPGA register. - * \param regno 7-bit register number - * \param value 32-bit value - * \returns true iff successful - */ - bool _read_fpga_reg (int regno, int *value); //< 7-bit regno, 32-bit value - - /*! - * \brief Read FPGA register. - * \param regno 7-bit register number - * \returns register value if successful, else READ_FAILED - */ - int _read_fpga_reg (int regno); - - /*! - * \brief Write FPGA register with mask. - * \param regno 7-bit register number - * \param value 16-bit value - * \param mask 16-bit value - * \returns true if successful - * Only use this for registers who actually implement a mask in the verilog firmware, like FR_RX_MASTER_SLAVE - */ - bool _write_fpga_reg_masked (int regno, int value, int mask); - - /*! - * \brief Write AD9862 register. - * \param which_codec 0 or 1 - * \param regno 6-bit register number - * \param value 8-bit value - * \returns true iff successful - */ - bool _write_9862 (int which_codec, int regno, unsigned char value); - - /*! - * \brief Read AD9862 register. - * \param which_codec 0 or 1 - * \param regno 6-bit register number - * \param value 8-bit value - * \returns true iff successful - */ - bool _read_9862 (int which_codec, int regno, unsigned char *value) const; - - /*! - * \brief Read AD9862 register. - * \param which_codec 0 or 1 - * \param regno 6-bit register number - * \returns register value if successful, else READ_FAILED - */ - int _read_9862 (int which_codec, int regno) const; - - /*! - * \brief Write data to SPI bus peripheral. - * - * \param optional_header 0,1 or 2 bytes to write before buf. - * \param enables bitmask of peripherals to write. See usrp_spi_defs.h - * \param format transaction format. See usrp_spi_defs.h SPI_FMT_* - * \param buf the data to write - * \returns true iff successful - * Writes are limited to a maximum of 64 bytes. - * - * If \p format specifies that optional_header bytes are present, they are - * written to the peripheral immediately prior to writing \p buf. - */ - bool _write_spi (int optional_header, int enables, int format, std::string buf); - - /* - * \brief Read data from SPI bus peripheral. - * - * \param optional_header 0,1 or 2 bytes to write before buf. - * \param enables bitmask of peripheral to read. See usrp_spi_defs.h - * \param format transaction format. See usrp_spi_defs.h SPI_FMT_* - * \param len number of bytes to read. Must be in [0,64]. - * \returns the data read if sucessful, else a zero length string. - * - * Reads are limited to a maximum of 64 bytes. - * - * If \p format specifies that optional_header bytes are present, they - * are written to the peripheral first. Then \p len bytes are read from - * the peripheral and returned. - */ - std::string _read_spi (int optional_header, int enables, int format, int len); - - /*! - * \brief Start data transfers. - * Called in base class to derived class order. - */ - bool start (); - - /*! - * \brief Stop data transfers. - * Called in base class to derived class order. - */ - bool stop (); -}; - -/*! - * \brief class for accessing the receive side of the USRP - * \ingroup usrp - */ -class usrp_basic_rx : public usrp_basic -{ -private: - fusb_devhandle *d_devhandle; - fusb_ephandle *d_ephandle; - int d_bytes_seen; // how many bytes we've seen - bool d_first_read; - bool d_rx_enable; - -protected: - /*! - * \param which_board Which USRP board on usb (not particularly useful; use 0) - * \param fusb_block_size fast usb xfer block size. Must be a multiple of 512. - * Use zero for a reasonable default. - * \param fusb_nblocks number of fast usb URBs to allocate. Use zero for a reasonable default. - * \param fpga_filename name of the rbf file to load - * \param firmware_filename name of ihx file to load - */ - usrp_basic_rx (int which_board, - int fusb_block_size=0, - int fusb_nblocks=0, - const std::string fpga_filename = "", - const std::string firmware_filename = "" - ); // throws if trouble - - bool set_rx_enable (bool on); - bool rx_enable () const { return d_rx_enable; } - - bool disable_rx (); // conditional disable, return prev state - void restore_rx (bool on); // conditional set - - void probe_rx_slots (bool verbose); - -public: - ~usrp_basic_rx (); - - /*! - * \brief invokes constructor, returns instance or 0 if trouble - * - * \param which_board Which USRP board on usb (not particularly useful; use 0) - * \param fusb_block_size fast usb xfer block size. Must be a multiple of 512. - * Use zero for a reasonable default. - * \param fusb_nblocks number of fast usb URBs to allocate. Use zero for a reasonable default. - * \param fpga_filename name of file that contains image to load into FPGA - * \param firmware_filename name of file that contains image to load into FX2 - */ - static usrp_basic_rx *make (int which_board, - int fusb_block_size=0, - int fusb_nblocks=0, - const std::string fpga_filename = "", - const std::string firmware_filename = "" - ); - - /*! - * \brief tell the fpga the rate rx samples are coming from the A/D's - * - * div = fpga_master_clock_freq () / sample_rate - * - * sample_rate is determined by a myriad of registers - * in the 9862. That's why you have to tell us, so - * we can tell the fpga. - */ - bool set_fpga_rx_sample_rate_divisor (unsigned int div); - - /*! - * \brief read data from the D/A's via the FPGA. - * \p len must be a multiple of 512 bytes. - * - * \returns the number of bytes read, or -1 on error. - * - * If overrun is non-NULL it will be set true iff an RX overrun is detected. - */ - int read (void *buf, int len, bool *overrun); - - - //! sampling rate of A/D converter - virtual long converter_rate() const { return fpga_master_clock_freq(); } // 64M - long adc_rate() const { return converter_rate(); } - int daughterboard_id (int which_side) const { return d_dbid[which_side & 0x1]; } - - bool set_pga (int which_amp, double gain_in_db); - double pga (int which_amp) const; - double pga_min () const; - double pga_max () const; - double pga_db_per_step () const; - - bool _write_oe (int which_side, int value, int mask); - bool write_io (int which_side, int value, int mask); - bool read_io (int which_side, int *value); - int read_io (int which_side); - bool write_refclk(int which_side, int value); - bool write_atr_mask(int which_side, int value); - bool write_atr_txval(int which_side, int value); - bool write_atr_rxval(int which_side, int value); - - bool write_aux_dac (int which_side, int which_dac, int value); - bool read_aux_adc (int which_side, int which_adc, int *value); - int read_aux_adc (int which_side, int which_adc); - - int block_size() const; - - // called in base class to derived class order - bool start (); - bool stop (); -}; - -/*! - * \brief class for accessing the transmit side of the USRP - * \ingroup usrp - */ -class usrp_basic_tx : public usrp_basic -{ -private: - fusb_devhandle *d_devhandle; - fusb_ephandle *d_ephandle; - int d_bytes_seen; // how many bytes we've seen - bool d_first_write; - bool d_tx_enable; - - protected: - /*! - * \param which_board Which USRP board on usb (not particularly useful; use 0) - * \param fusb_block_size fast usb xfer block size. Must be a multiple of 512. - * Use zero for a reasonable default. - * \param fusb_nblocks number of fast usb URBs to allocate. Use zero for a reasonable default. - * \param fpga_filename name of file that contains image to load into FPGA - * \param firmware_filename name of file that contains image to load into FX2 - */ - usrp_basic_tx (int which_board, - int fusb_block_size=0, - int fusb_nblocks=0, - const std::string fpga_filename = "", - const std::string firmware_filename = "" - ); // throws if trouble - - bool set_tx_enable (bool on); - bool tx_enable () const { return d_tx_enable; } - - bool disable_tx (); // conditional disable, return prev state - void restore_tx (bool on); // conditional set - - void probe_tx_slots (bool verbose); - -public: - - ~usrp_basic_tx (); - - /*! - * \brief invokes constructor, returns instance or 0 if trouble - * - * \param which_board Which USRP board on usb (not particularly useful; use 0) - * \param fusb_block_size fast usb xfer block size. Must be a multiple of 512. - * Use zero for a reasonable default. - * \param fusb_nblocks number of fast usb URBs to allocate. Use zero for a reasonable default. - * \param fpga_filename name of file that contains image to load into FPGA - * \param firmware_filename name of file that contains image to load into FX2 - */ - static usrp_basic_tx *make (int which_board, int fusb_block_size=0, int fusb_nblocks=0, - const std::string fpga_filename = "", - const std::string firmware_filename = "" - ); - - /*! - * \brief tell the fpga the rate tx samples are going to the D/A's - * - * div = fpga_master_clock_freq () * 2 - * - * sample_rate is determined by a myriad of registers - * in the 9862. That's why you have to tell us, so - * we can tell the fpga. - */ - bool set_fpga_tx_sample_rate_divisor (unsigned int div); - - /*! - * \brief Write data to the A/D's via the FPGA. - * - * \p len must be a multiple of 512 bytes. - * \returns number of bytes written or -1 on error. - * - * if \p underrun is non-NULL, it will be set to true iff - * a transmit underrun condition is detected. - */ - int write (const void *buf, int len, bool *underrun); - - /* - * Block until all outstanding writes have completed. - * This is typically used to assist with benchmarking - */ - void wait_for_completion (); - - //! sampling rate of D/A converter - virtual long converter_rate() const { return fpga_master_clock_freq () * 2; } // 128M - long dac_rate() const { return converter_rate(); } - int daughterboard_id (int which_side) const { return d_dbid[which_side & 0x1]; } - - bool set_pga (int which_amp, double gain_in_db); - double pga (int which_amp) const; - double pga_min () const; - double pga_max () const; - double pga_db_per_step () const; - - bool _write_oe (int which_side, int value, int mask); - bool write_io (int which_side, int value, int mask); - bool read_io (int which_side, int *value); - int read_io (int which_side); - bool write_refclk(int which_side, int value); - bool write_atr_mask(int which_side, int value); - bool write_atr_txval(int which_side, int value); - bool write_atr_rxval(int which_side, int value); - - bool write_aux_dac (int which_side, int which_dac, int value); - bool read_aux_adc (int which_side, int which_adc, int *value); - int read_aux_adc (int which_side, int which_adc); - - int block_size() const; - - // called in base class to derived class order - bool start (); - bool stop (); -}; - -#endif diff --git a/usrp/host/lib/usrp_dbid.dat b/usrp/host/lib/usrp_dbid.dat index 6bad9a298..7d1e18714 100644 --- a/usrp/host/lib/usrp_dbid.dat +++ b/usrp/host/lib/usrp_dbid.dat @@ -1,18 +1,18 @@ # # Copyright 2005,2009 Free Software Foundation, Inc. -# +# # This file is part of GNU Radio -# +# # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. -# +# # GNU Radio is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. @@ -78,6 +78,9 @@ "WBX LO TX" 0x0050 "WBX LO RX" 0x0051 +"WBX NG TX" 0x0052 +"WBX NG RX" 0x0053 + "XCVR2450 Tx" 0x0060 "XCVR2450 Rx" 0x0061 diff --git a/usrp/host/lib/usrp_prims_common.cc b/usrp/host/lib/usrp_prims_common.cc index 70e90d7fe..20a55653c 100644 --- a/usrp/host/lib/usrp_prims_common.cc +++ b/usrp/host/lib/usrp_prims_common.cc @@ -215,7 +215,7 @@ write_internal_ram (libusb_device_handle *udh, unsigned char *buf, (unsigned char*)(buf + (addr - start_addr)), n, 1000); if (a < 0){ - fprintf(stderr,"write_internal_ram failed: %i\n", a); + fprintf(stderr,"write_internal_ram failed\n"); return false; } } @@ -297,7 +297,7 @@ _usrp_load_firmware (libusb_device_handle *udh, const char *filename, break; } else if (type == 0x02){ - fprintf(stderr, "Extended address: whatever I do with it?\n"); + fprintf (stderr, "Extended address: whatever I do with it?\n"); fprintf (stderr, "%s: invalid line: \"%s\"\n", filename, s); goto fail; } @@ -419,6 +419,10 @@ usrp_set_hash (libusb_device_handle *udh, int which, // we use the Cypress firmware down load command to jam it in. int r = _usb_control_transfer (udh, 0x40, 0xa0, hash_slot_addr[which], 0, (unsigned char *) hash, USRP_HASH_SIZE, 1000); + + if (r < 0) + fprintf (stderr, "usrp: failed to set hash\n"); + return r == USRP_HASH_SIZE; } @@ -431,6 +435,10 @@ usrp_get_hash (libusb_device_handle *udh, int which, // we use the Cypress firmware upload command to fetch it. int r = _usb_control_transfer (udh, 0xc0, 0xa0, hash_slot_addr[which], 0, (unsigned char *) hash, USRP_HASH_SIZE, 1000); + + if (r < 0) + fprintf (stderr, "usrp: failed to get hash\n"); + return r == USRP_HASH_SIZE; } @@ -684,11 +692,13 @@ usrp_load_firmware_nth (int nth, const char *filename, bool force, libusb_contex // FIXME. Turn this into a loop that rescans until we refind ourselves - struct timespec t; // delay for 1 second + struct timespec t; // delay for 2 second t.tv_sec = 2; t.tv_nsec = 0; our_nanosleep (&t); + usrp_rescan (); + return ULS_OK; default: diff --git a/usrp/host/lib/usrp_prims_libusb0.cc b/usrp/host/lib/usrp_prims_libusb0.cc index 7a82eabfa..7053786d8 100644 --- a/usrp/host/lib/usrp_prims_libusb0.cc +++ b/usrp/host/lib/usrp_prims_libusb0.cc @@ -57,11 +57,20 @@ _get_usb_device_descriptor (struct usb_device *q) { return q->descriptor; } + int _get_usb_string_descriptor (struct usb_dev_handle *udh, int index, unsigned char* data, int length) { - return usb_get_string_simple (udh, index, (char*) data, length); + int ret; + ret = usb_get_string_simple (udh, index, (char*) data, length); + + if (ret < 0) { + fprintf (stderr, "usrp: usb_get_string_descriptor failed: %s\n", + usb_strerror()); + } + + return ret; } int @@ -69,8 +78,14 @@ _usb_control_transfer (struct usb_dev_handle *udh, int request_type, int request, int value, int index, unsigned char *data, int length, unsigned int timeout) { - return usb_control_msg (udh, request_type,request, value, index, - (char*) data, length, (int) timeout); + int ret; + + ret = usb_control_msg (udh, request_type,request, value, index, + (char*) data, length, (int) timeout); + if (ret < 0) + fprintf (stderr, "usrp: usb_claim_interface failed: %s\n", usb_strerror()); + + return ret; } @@ -198,8 +213,10 @@ write_cmd (struct usb_dev_handle *udh, (char *) bytes, len, 1000); if (r < 0){ // we get EPIPE if the firmware stalls the endpoint. - if (errno != EPIPE) + if (errno != EPIPE) { fprintf (stderr, "usb_control_msg failed: %s\n", usb_strerror ()); + fprintf (stderr, "write_cmd failed\n"); + } } return r; diff --git a/usrp/host/lib/usrp_prims_libusb1.cc b/usrp/host/lib/usrp_prims_libusb1.cc index cf1f8fe07..fdd497abc 100644 --- a/usrp/host/lib/usrp_prims_libusb1.cc +++ b/usrp/host/lib/usrp_prims_libusb1.cc @@ -42,10 +42,49 @@ extern "C" { using namespace ad9862; +static const int LIBUSB1_DEBUG = 0; + /* * libusb 0.12 / 1.0 compatibility */ +static const char * +_get_usb_error_str (int usb_err) +{ + switch (usb_err) { + case LIBUSB_SUCCESS: + return "Success (no error)"; + case LIBUSB_ERROR_IO: + return "Input/output error"; + case LIBUSB_ERROR_INVALID_PARAM: + return "Invalid parameter"; + case LIBUSB_ERROR_ACCESS: + return "Access denied (insufficient permissions)"; + case LIBUSB_ERROR_NO_DEVICE: + return "No such device (it may have been disconnected)"; + case LIBUSB_ERROR_NOT_FOUND: + return "Entity not found"; + case LIBUSB_ERROR_BUSY: + return "Resource busy"; + case LIBUSB_ERROR_TIMEOUT: + return "Operation timed out"; + case LIBUSB_ERROR_OVERFLOW: + return "Overflow"; + case LIBUSB_ERROR_PIPE: + return "Pipe error"; + case LIBUSB_ERROR_INTERRUPTED: + return "System call interrupted (perhaps due to signal)"; + case LIBUSB_ERROR_NO_MEM: + return "Insufficient memory"; + case LIBUSB_ERROR_NOT_SUPPORTED: + return "Operation not supported or unimplemented on this platform"; + case LIBUSB_ERROR_OTHER: + return "Unknown error"; + } + + return "Unknown error"; +} + struct libusb_device * _get_usb_device (struct libusb_device_handle *udh) { @@ -58,17 +97,27 @@ _get_usb_device_descriptor(struct libusb_device *q) int ret; struct libusb_device_descriptor desc; - if ((ret = libusb_get_device_descriptor(q, &desc)) < 0) - fprintf (stderr, "usrp: libusb_get_device_descriptor failed %d\n", ret); + ret = libusb_get_device_descriptor(q, &desc); + if (ret < 0) { + fprintf (stderr, "usrp: libusb_get_device_descriptor failed: %s\n", + _get_usb_error_str(ret)); + } return desc; } int _get_usb_string_descriptor (struct libusb_device_handle *udh, int index, - unsigned char* data, int length) + unsigned char* data, int length) { - return libusb_get_string_descriptor_ascii (udh, (uint8_t) index, data, length); + int ret; + ret = libusb_get_string_descriptor_ascii (udh, (uint8_t) index, data, length); + + if (ret < 0) { + fprintf (stderr, "usrp: libusb_get_string_descriptor_ascii failed: %s\n", + _get_usb_error_str(ret)); + } + return ret; } int @@ -76,11 +125,16 @@ _usb_control_transfer (struct libusb_device_handle *udh, int request_type, int request, int value, int index, unsigned char *data, int length, unsigned int timeout) { - return libusb_control_transfer (udh, request_type, request, value, index, - data, length, timeout); + int ret; + ret = libusb_control_transfer (udh, request_type, request, value, index, + data, length, timeout); + if (ret < 0) { + fprintf (stderr, "usrp: libusb_control_transfer failed: %s\n", + _get_usb_error_str(ret)); + } + return ret; } - // ---------------------------------------------------------------- @@ -90,7 +144,14 @@ usrp_one_time_init (libusb_context **ctx) int ret; if ((ret = libusb_init (ctx)) < 0) - fprintf (stderr, "usrp: libusb_init failed %i\n", ret); + fprintf (stderr, "usrp: libusb_init failed: %s\n", _get_usb_error_str(ret)); + + // Enable debug verbosity if requested. This will only work if the debug + // option is compiled into libusb and may produce a generous amount of output + // on stdout. If debug output is not compiled into libusb, this call does + // nothing. + if (LIBUSB1_DEBUG) + libusb_set_debug(*ctx, 3); } void @@ -117,7 +178,8 @@ usrp_find_device (int nth, bool fx2_ok_p, libusb_context *ctx) size_t i = 0; if (cnt < 0) - fprintf(stderr, "usrp: libusb_get_device_list failed %d\n", cnt); + fprintf(stderr, "usrp: libusb_get_device_list failed: %s\n", + _get_usb_error_str(cnt)); for (i = 0; i < cnt; i++) { q = list[i]; @@ -149,16 +211,17 @@ usrp_open_interface (libusb_device *dev, int interface, int altinterface) } if ((ret = libusb_claim_interface (udh, interface)) < 0) { - fprintf (stderr, "%s:usb_claim_interface: failed interface %d\n", __FUNCTION__,interface); - fprintf (stderr, "%d\n", ret); + fprintf (stderr, "%s:usb_claim_interface: failed interface %d\n", + __FUNCTION__, interface); + fprintf (stderr, "%s\n", _get_usb_error_str(ret)); libusb_close (udh); return 0; } if ((ret = libusb_set_interface_alt_setting (udh, interface, - altinterface)) < 0) { + altinterface)) < 0) { fprintf (stderr, "%s:usb_set_alt_interface: failed\n", __FUNCTION__); - fprintf (stderr, "%d\n", ret); + fprintf (stderr, "%s\n", _get_usb_error_str(ret)); libusb_release_interface (udh, interface); libusb_close (udh); return 0; @@ -185,18 +248,20 @@ write_cmd (struct libusb_device_handle *udh, int request, int value, int index, unsigned char *bytes, int len) { - int requesttype = (request & 0x80) ? VRT_VENDOR_IN : VRT_VENDOR_OUT; + int requesttype = (request & 0x80) ? VRT_VENDOR_IN : VRT_VENDOR_OUT; - int r = libusb_control_transfer(udh, requesttype, request, value, index, - (unsigned char *) bytes, len, 1000); + int ret = libusb_control_transfer(udh, requesttype, request, value, index, + bytes, len, 1000); - if (r < 0){ + if (ret < 0) { // we get EPIPE if the firmware stalls the endpoint. - if (r != LIBUSB_ERROR_PIPE) { - fprintf (stderr, "libusb_control_transfer failed: %i\n", r); + if (ret != LIBUSB_ERROR_PIPE) { + fprintf (stderr, "usrp: libusb_control_transfer failed: %s\n", + _get_usb_error_str(ret)); + fprintf (stderr, "usrp: write_cmd failed\n"); } } - return r; + return ret; } diff --git a/usrp2/fpga/top/u2_fpga/.gitignore b/usrp2/fpga/top/u2_rev1/.gitignore index de5b50277..de5b50277 100644 --- a/usrp2/fpga/top/u2_fpga/.gitignore +++ b/usrp2/fpga/top/u2_rev1/.gitignore diff --git a/usrp2/fpga/top/u2_fpga/Makefile b/usrp2/fpga/top/u2_rev1/Makefile index b3245d883..b3245d883 100644 --- a/usrp2/fpga/top/u2_fpga/Makefile +++ b/usrp2/fpga/top/u2_rev1/Makefile diff --git a/usrp2/fpga/top/u2_fpga/u2_fpga.ise b/usrp2/fpga/top/u2_rev1/u2_fpga.ise Binary files differindex f90caf024..f90caf024 100644 --- a/usrp2/fpga/top/u2_fpga/u2_fpga.ise +++ b/usrp2/fpga/top/u2_rev1/u2_fpga.ise diff --git a/usrp2/fpga/top/u2_fpga/u2_fpga.ucf b/usrp2/fpga/top/u2_rev1/u2_fpga.ucf index 5d2124819..5d2124819 100755 --- a/usrp2/fpga/top/u2_fpga/u2_fpga.ucf +++ b/usrp2/fpga/top/u2_rev1/u2_fpga.ucf diff --git a/usrp2/fpga/top/u2_fpga/u2_fpga_top.prj b/usrp2/fpga/top/u2_rev1/u2_fpga_top.prj index 544415f4d..544415f4d 100644 --- a/usrp2/fpga/top/u2_fpga/u2_fpga_top.prj +++ b/usrp2/fpga/top/u2_rev1/u2_fpga_top.prj diff --git a/usrp2/fpga/top/u2_fpga/u2_fpga_top.v b/usrp2/fpga/top/u2_rev1/u2_fpga_top.v index 63798a0c8..63798a0c8 100644 --- a/usrp2/fpga/top/u2_fpga/u2_fpga_top.v +++ b/usrp2/fpga/top/u2_rev1/u2_fpga_top.v diff --git a/vrt/lib/Makefile.am b/vrt/lib/Makefile.am index 9832c0cd5..d41343a5d 100644 --- a/vrt/lib/Makefile.am +++ b/vrt/lib/Makefile.am @@ -20,7 +20,8 @@ include $(top_srcdir)/Makefile.common AM_CPPFLAGS = \ $(VRT_INCLUDES) \ $(BOOST_CPPFLAGS) \ - $(CPPUNIT_INCLUDES) + $(CPPUNIT_INCLUDES) \ + $(GRUEL_INCLUDES) bin_PROGRAMS = |