From 4c400067338be2d8c2d76b0773dd4087d61b159b Mon Sep 17 00:00:00 2001 From: jcorgan Date: Tue, 3 Mar 2009 02:10:36 +0000 Subject: [PATCH] Merged r10539:10546 from michaelld/two_mods into trunk. Trunk passes distcheck. git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@10551 221aa14e-8319-0410-a670-987f0aec2ac5 --- Makefile.am | 4 - config/grc_gr_gpio.m4 | 11 +-- gnuradio-core/doc/Makefile.am | 4 + gnuradio-core/src/lib/gengen/Makefile.am | 3 + gnuradio-core/src/lib/gengen/Makefile.gen | 9 ++ .../src/lib/gengen/generate_common.py | 3 +- .../src/lib/gengen/gengen_generated.i | 6 ++ .../src/lib/gengen/gr_and_const_XX.cc.t | 39 ++++----- .../src/lib/gengen/gr_and_const_XX.h.t | 31 ++++--- .../src/lib/gengen/gr_and_const_XX.i.t | 20 ++--- gr-gpio/src/Makefile.am | 4 +- gr-gpio/src/lib/Makefile.am | 85 ------------------- gr-gpio/src/python/Makefile.am | 11 --- gr-gpio/src/python/gpio_rx_sfile.py | 6 +- gr-gpio/src/python/gpio_usrp_fft.py | 6 +- gr-gpio/src/python/qa_gpio.py | 36 -------- gr-gpio/src/python/run_tests.in | 10 --- 17 files changed, 79 insertions(+), 209 deletions(-) rename gr-gpio/src/lib/gpio_and_const_ss.cc => gnuradio-core/src/lib/gengen/gr_and_const_XX.cc.t (64%) rename gr-gpio/src/lib/gpio_and_const_ss.h => gnuradio-core/src/lib/gengen/gr_and_const_XX.h.t (60%) rename gr-gpio/src/lib/gpio.i => gnuradio-core/src/lib/gengen/gr_and_const_XX.i.t (66%) delete mode 100644 gr-gpio/src/lib/Makefile.am delete mode 100755 gr-gpio/src/python/qa_gpio.py delete mode 100644 gr-gpio/src/python/run_tests.in diff --git a/Makefile.am b/Makefile.am index d1c7845e..e9dde45f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -30,9 +30,5 @@ EXTRA_DIST = \ config.h.in \ run_tests.sh.in -dist_gr_doc_DATA = \ - README \ - README.hacking - SUBDIRS = @build_dirs@ DIST_SUBDIRS = @build_dirs@ @skipped_dirs@ @with_dirs@ diff --git a/config/grc_gr_gpio.m4 b/config/grc_gr_gpio.m4 index a38a54aa..26c04b95 100644 --- a/config/grc_gr_gpio.m4 +++ b/config/grc_gr_gpio.m4 @@ -1,4 +1,4 @@ -dnl Copyright 2007,2008 Free Software Foundation, Inc. +dnl Copyright 2007,2008,2009 Free Software Foundation, Inc. dnl dnl This file is part of GNU Radio dnl @@ -31,13 +31,8 @@ AC_DEFUN([GRC_GR_GPIO],[ gr-gpio/src/fpga/top/Makefile \ gr-gpio/src/fpga/lib/Makefile \ gr-gpio/src/fpga/rbf/Makefile \ - gr-gpio/src/lib/Makefile \ - gr-gpio/src/python/Makefile \ - gr-gpio/src/python/run_tests + gr-gpio/src/python/Makefile ]) - GRC_BUILD_CONDITIONAL(gr-gpio,[ - dnl run_tests is created from run_tests.in. Make it executable. - AC_CONFIG_COMMANDS([run_tests_gpio], [chmod +x gr-gpio/src/python/run_tests]) - ]) + GRC_BUILD_CONDITIONAL(gr-gpio) ]) diff --git a/gnuradio-core/doc/Makefile.am b/gnuradio-core/doc/Makefile.am index 5bbd3c0c..3a67fb6d 100644 --- a/gnuradio-core/doc/Makefile.am +++ b/gnuradio-core/doc/Makefile.am @@ -23,6 +23,10 @@ include $(top_srcdir)/Makefile.common SUBDIRS = other xml-swig +dist_gr_doc_DATA = \ + $(top_srcdir)/README \ + $(top_srcdir)/README.hacking + all-local: prep @generate_docs@ doc: docs # alias diff --git a/gnuradio-core/src/lib/gengen/Makefile.am b/gnuradio-core/src/lib/gengen/Makefile.am index 85ab94f3..e969eb90 100644 --- a/gnuradio-core/src/lib/gengen/Makefile.am +++ b/gnuradio-core/src/lib/gengen/Makefile.am @@ -107,6 +107,9 @@ core_generator = \ gr_and_XX.cc.t \ gr_and_XX.h.t \ gr_and_XX.i.t \ + gr_and_const_XX.cc.t \ + gr_and_const_XX.h.t \ + gr_and_const_XX.i.t \ gr_or_XX.cc.t \ gr_or_XX.h.t \ gr_or_XX.i.t \ diff --git a/gnuradio-core/src/lib/gengen/Makefile.gen b/gnuradio-core/src/lib/gengen/Makefile.gen index 7ee92a25..9ffb00ed 100644 --- a/gnuradio-core/src/lib/gengen/Makefile.gen +++ b/gnuradio-core/src/lib/gengen/Makefile.gen @@ -20,6 +20,9 @@ GENERATED_H = \ gr_add_vii.h \ gr_add_vss.h \ gr_and_bb.h \ + gr_and_const_bb.h \ + gr_and_const_ii.h \ + gr_and_const_ss.h \ gr_and_ii.h \ gr_and_ss.h \ gr_argmax_fs.h \ @@ -130,6 +133,9 @@ GENERATED_I = \ gr_add_vii.i \ gr_add_vss.i \ gr_and_bb.i \ + gr_and_const_bb.i \ + gr_and_const_ii.i \ + gr_and_const_ss.i \ gr_and_ii.i \ gr_and_ss.i \ gr_argmax_fs.i \ @@ -240,6 +246,9 @@ GENERATED_CC = \ gr_add_vii.cc \ gr_add_vss.cc \ gr_and_bb.cc \ + gr_and_const_bb.cc \ + gr_and_const_ii.cc \ + gr_and_const_ss.cc \ gr_and_ii.cc \ gr_and_ss.cc \ gr_argmax_fs.cc \ diff --git a/gnuradio-core/src/lib/gengen/generate_common.py b/gnuradio-core/src/lib/gengen/generate_common.py index 182b7407..992e2c0d 100755 --- a/gnuradio-core/src/lib/gengen/generate_common.py +++ b/gnuradio-core/src/lib/gengen/generate_common.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2006,2007,2008 Free Software Foundation, Inc. +# Copyright 2004,2006,2007,2008,2009 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -62,6 +62,7 @@ others = ( ('gr_packed_to_unpacked_XX', ('bb','ss','ii')), ('gr_xor_XX', ('bb','ss','ii')), ('gr_and_XX', ('bb','ss','ii')), + ('gr_and_const_XX', ('bb','ss','ii')), ('gr_or_XX', ('bb','ss','ii')), ('gr_not_XX', ('bb','ss','ii')), ('gr_sample_and_hold_XX', ('bb','ss','ii','ff')), diff --git a/gnuradio-core/src/lib/gengen/gengen_generated.i b/gnuradio-core/src/lib/gengen/gengen_generated.i index f1be17f7..d9471a04 100644 --- a/gnuradio-core/src/lib/gengen/gengen_generated.i +++ b/gnuradio-core/src/lib/gengen/gengen_generated.i @@ -20,6 +20,9 @@ #include #include #include +#include +#include +#include #include #include #include @@ -130,6 +133,9 @@ %include %include %include +%include +%include +%include %include %include %include diff --git a/gr-gpio/src/lib/gpio_and_const_ss.cc b/gnuradio-core/src/lib/gengen/gr_and_const_XX.cc.t similarity index 64% rename from gr-gpio/src/lib/gpio_and_const_ss.cc rename to gnuradio-core/src/lib/gengen/gr_and_const_XX.cc.t index e9304619..ec725b23 100644 --- a/gr-gpio/src/lib/gpio_and_const_ss.cc +++ b/gnuradio-core/src/lib/gengen/gr_and_const_XX.cc.t @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2008 Free Software Foundation, Inc. + * Copyright 2009 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,39 +20,40 @@ * Boston, MA 02110-1301, USA. */ +// @WARNING@ #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include +#include <@NAME@.h> #include -gpio_and_const_ss_sptr -gpio_make_and_const_ss (unsigned short k) +@SPTR_NAME@ +gr_make_@BASE_NAME@ (@I_TYPE@ k) { - return gpio_and_const_ss_sptr (new gpio_and_const_ss (k)); -} + return @SPTR_NAME@ (new @NAME@ (k)); +}; -gpio_and_const_ss::gpio_and_const_ss (unsigned short k) - : gr_sync_block ("and_const_ss", - gr_make_io_signature (1, 1, sizeof (short)), - gr_make_io_signature (1, 1, sizeof (short))), - d_k (k) +@NAME@::@NAME@ (@I_TYPE@ k) + : gr_sync_block ("@BASE_NAME@", + gr_make_io_signature (1, 1, sizeof (@I_TYPE@)), + gr_make_io_signature (1, 1, sizeof (@O_TYPE@))), + d_k (k) { } int -gpio_and_const_ss::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) +@NAME@::work (int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) { - short *iptr = (short *) input_items[0]; - short *optr = (short *) output_items[0]; + @I_TYPE@ *iptr = (@I_TYPE@ *) input_items[0]; + @O_TYPE@ *optr = (@O_TYPE@ *) output_items[0]; int size = noutput_items; - while (size >= 8){ + while (size >= 8) { *optr++ = *iptr++ & d_k; *optr++ = *iptr++ & d_k; *optr++ = *iptr++ & d_k; @@ -66,6 +67,6 @@ gpio_and_const_ss::work (int noutput_items, while (size-- > 0) *optr++ = *iptr++ & d_k; - - return noutput_items; + + return (noutput_items); } diff --git a/gr-gpio/src/lib/gpio_and_const_ss.h b/gnuradio-core/src/lib/gengen/gr_and_const_XX.h.t similarity index 60% rename from gr-gpio/src/lib/gpio_and_const_ss.h rename to gnuradio-core/src/lib/gengen/gr_and_const_XX.h.t index e27134d6..c979b131 100644 --- a/gr-gpio/src/lib/gpio_and_const_ss.h +++ b/gnuradio-core/src/lib/gengen/gr_and_const_XX.h.t @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2008 Free Software Foundation, Inc. + * Copyright 2009 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,31 +20,34 @@ * Boston, MA 02110-1301, USA. */ +// @WARNING@ -#ifndef INCLUDED_GPIO_AND_CONST_SS_H -#define INCLUDED_GPIO_AND_CONST_SS_H +#ifndef @GUARD_NAME@ +#define @GUARD_NAME@ #include -class gpio_and_const_ss; -typedef boost::shared_ptr gpio_and_const_ss_sptr; +class @NAME@; +typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; -gpio_and_const_ss_sptr gpio_make_and_const_ss (unsigned short k); +@SPTR_NAME@ gr_make_@BASE_NAME@ (@O_TYPE@ k); /*! - * \brief output = input & constant - * \ingroup block + * \brief output_N = input_N & value + * \ingroup math + * + * bitwise boolean and of const to the data stream. */ -class gpio_and_const_ss : public gr_sync_block +class @NAME@ : public gr_sync_block { - friend gpio_and_const_ss_sptr gpio_make_and_const_ss (unsigned short k); + friend @SPTR_NAME@ gr_make_@BASE_NAME@ (@O_TYPE@ k); - unsigned short d_k; // the constant - gpio_and_const_ss (unsigned short k); + @O_TYPE@ d_k; // the constant + @NAME@ (@O_TYPE@ k); public: - unsigned short k () const { return d_k; } - void set_k (unsigned short k) { d_k = k; } + @O_TYPE@ k () const { return d_k; } + void set_k (@O_TYPE@ k) { d_k = k; } int work (int noutput_items, gr_vector_const_void_star &input_items, diff --git a/gr-gpio/src/lib/gpio.i b/gnuradio-core/src/lib/gengen/gr_and_const_XX.i.t similarity index 66% rename from gr-gpio/src/lib/gpio.i rename to gnuradio-core/src/lib/gengen/gr_and_const_XX.i.t index b65777d3..548431e6 100644 --- a/gr-gpio/src/lib/gpio.i +++ b/gnuradio-core/src/lib/gengen/gr_and_const_XX.i.t @@ -20,24 +20,18 @@ * Boston, MA 02110-1301, USA. */ -%include "gnuradio.i" // the common stuff +// @WARNING@ -%{ -#include "gpio_and_const_ss.h" -%} +GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@) -// ---------------------------------------------------------------- +@SPTR_NAME@ gr_make_@BASE_NAME@ (@O_TYPE@ k); -GR_SWIG_BLOCK_MAGIC(gpio,and_const_ss) - -gpio_and_const_ss_sptr gpio_make_and_const_ss (unsigned short k); - -class gpio_and_const_ss : public gr_sync_block +class @NAME@ : public gr_sync_block { private: - gpio_and_const_ss (unsigned short k); + @NAME@ (@O_TYPE@ k); public: - unsigned short k () const { return d_k; } - void set_k (unsigned short k) { d_k = k; } + @O_TYPE@ k () const { return d_k; } + void set_k (@O_TYPE@ k) { d_k = k; } }; diff --git a/gr-gpio/src/Makefile.am b/gr-gpio/src/Makefile.am index 8a361801..8c9a64b8 100644 --- a/gr-gpio/src/Makefile.am +++ b/gr-gpio/src/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright 2007 Free Software Foundation, Inc. +# Copyright 2007,2009 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -19,4 +19,4 @@ # Boston, MA 02110-1301, USA. # -SUBDIRS = lib python fpga +SUBDIRS = python fpga diff --git a/gr-gpio/src/lib/Makefile.am b/gr-gpio/src/lib/Makefile.am deleted file mode 100644 index 1d2451f1..00000000 --- a/gr-gpio/src/lib/Makefile.am +++ /dev/null @@ -1,85 +0,0 @@ -# -# Copyright 2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -include $(top_srcdir)/Makefile.common - -ourpythondir = $(grpythondir)/gpio -ourlibdir = $(grpyexecdir)/gpio - -AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) $(WITH_INCLUDES) - -ALL_IFILES = \ - $(LOCAL_IFILES) \ - $(NON_LOCAL_IFILES) - -NON_LOCAL_IFILES = $(GNURADIO_I) - -LOCAL_IFILES = \ - $(srcdir)/gpio.i - -# These files are built by SWIG. The first is the C++ glue. -# The second is the python wrapper that loads the _gpio shared library -# and knows how to call our extensions. - -BUILT_SOURCES = \ - gpio_swig.cc \ - gpio_swig.py - -# This gets gpio.py installed in the right place -ourpython_PYTHON = \ - gpio_swig.py - -ourlib_LTLIBRARIES = _gpio_swig.la - -# These are the source files that go into the shared library -_gpio_swig_la_SOURCES = \ - gpio_swig.cc \ - gpio_and_const_ss.cc - -# magic flags -_gpio_swig_la_LDFLAGS = $(NO_UNDEFINED) -module -avoid-version - -# link the library against some comon swig runtime code and the -# c++ standard library -_gpio_swig_la_LIBADD = \ - $(PYTHON_LDFLAGS) \ - $(GNURADIO_CORE_LA) \ - -lstdc++ - -gpio_swig.cc gpio_swig.py: $(ALL_IFILES) - $(SWIG) $(STD_SWIG_PYTHON_ARGS) -module gpio_swig \ - -o gpio_swig.cc $(LOCAL_IFILES) - -# These headers get installed in ${prefix}/include/gnuradio -grinclude_HEADERS = \ - gpio_and_const_ss.h - -# These swig headers get installed in ${prefix}/include/gnuradio/swig -swiginclude_HEADERS = \ - $(LOCAL_IFILES) - - -# Don't distribute output of swig -dist-hook: - @for file in $(BUILT_SOURCES); do echo $(RM) $(distdir)/$$file; done - @for file in $(BUILT_SOURCES); do $(RM) $(distdir)/$$file; done - -MOSTLYCLEANFILES = $(BUILT_SOURCES) *.pyc *~ diff --git a/gr-gpio/src/python/Makefile.am b/gr-gpio/src/python/Makefile.am index b61a4080..ee5bdaad 100644 --- a/gr-gpio/src/python/Makefile.am +++ b/gr-gpio/src/python/Makefile.am @@ -36,15 +36,4 @@ dist_bin_SCRIPTS = \ gpio_usrp_siggen.py \ gpio_usrp_fft.py -# List of python files that will get distributed in tarball -# but not installed anywhere on system -noinst_PYTHON = \ - qa_gpio.py - -# Programs that get run by 'make check' -TESTS = run_tests - -# Files to go into tarball not otherwise mentioned -EXTRA_DIST = run_tests.in - MOSTLYCLEANFILES = *.pyo *.pyc *~ diff --git a/gr-gpio/src/python/gpio_rx_sfile.py b/gr-gpio/src/python/gpio_rx_sfile.py index ac4d608b..31f598ef 100755 --- a/gr-gpio/src/python/gpio_rx_sfile.py +++ b/gr-gpio/src/python/gpio_rx_sfile.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2008 Free Software Foundation, Inc. +# Copyright 2008,2009 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -79,8 +79,8 @@ class my_top_block(gr.top_block): self.connect(u, head) src = head - ana_strip = gpio.and_const_ss(0xFFFE) - dig_strip = gpio.and_const_ss(0x0001) + ana_strip = gr.and_const_ss(0xFFFE) + dig_strip = gr.and_const_ss(0x0001) ana_sink = gr.file_sink(gr.sizeof_short, options.ana_filename) dig_sink = gr.file_sink(gr.sizeof_short, options.dig_filename) diff --git a/gr-gpio/src/python/gpio_usrp_fft.py b/gr-gpio/src/python/gpio_usrp_fft.py index cde0de05..40b1c54d 100755 --- a/gr-gpio/src/python/gpio_usrp_fft.py +++ b/gr-gpio/src/python/gpio_usrp_fft.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2004,2005,2007,2008 Free Software Foundation, Inc. +# Copyright 2004,2005,2007,2008,2009 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -144,10 +144,10 @@ class app_top_block(stdgui2.std_top_block): thr = gr.throttle(gr.sizeof_short, input_rate) self.connect(self.filesrc,thr,self.is2c,self.scope) elif options.digital: - self.select_dig=gpio.and_const_ss(0x0001) + self.select_dig=gr.and_const_ss(0x0001) self.connect(self.u, self.select_dig,self.is2c,self.scope) elif options.analog: - self.select_ana=gpio.and_const_ss(0xFFFE) + self.select_ana=gr.and_const_ss(0xFFFE) self.connect(self.u, self.select_ana,self.is2c,self.scope) else: self.connect(self.u,self.is2c,self.scope) diff --git a/gr-gpio/src/python/qa_gpio.py b/gr-gpio/src/python/qa_gpio.py deleted file mode 100755 index 1d140c24..00000000 --- a/gr-gpio/src/python/qa_gpio.py +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2008 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Radio; see the file COPYING. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, -# Boston, MA 02110-1301, USA. -# - -from gnuradio import gr, gr_unittest -# This is different from the usage after installation -import gpio_swig - -class qa_gpio (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block() - - def tearDown (self): - self.tb = None - -if __name__ == '__main__': - gr_unittest.main () diff --git a/gr-gpio/src/python/run_tests.in b/gr-gpio/src/python/run_tests.in deleted file mode 100644 index 999e4634..00000000 --- a/gr-gpio/src/python/run_tests.in +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -# 1st parameter is absolute path to component source directory -# 2nd parameter is absolute path to component build directory -# 3rd parameter is path to Python QA directory - -@top_builddir@/run_tests.sh \ - @abs_top_srcdir@/gr-gpio \ - @abs_top_builddir@/gr-gpio \ - @srcdir@ -- 2.39.5