diff options
Diffstat (limited to 'gnuradio-core/src/lib/gengen')
-rw-r--r-- | gnuradio-core/src/lib/gengen/.gitignore | 30 | ||||
-rw-r--r-- | gnuradio-core/src/lib/gengen/CMakeLists.txt | 2 | ||||
-rw-r--r-- | gnuradio-core/src/lib/gengen/Makefile.am | 6 | ||||
-rw-r--r-- | gnuradio-core/src/lib/gengen/Makefile.gen | 30 | ||||
-rwxr-xr-x | gnuradio-core/src/lib/gengen/generate_common.py | 6 | ||||
-rw-r--r-- | gnuradio-core/src/lib/gengen/gr_noise_source_X.h.t | 22 | ||||
-rw-r--r-- | gnuradio-core/src/lib/gengen/gr_noise_source_X.i.t | 4 | ||||
-rw-r--r-- | gnuradio-core/src/lib/gengen/gr_probe_signal_X.cc.t | 59 | ||||
-rw-r--r-- | gnuradio-core/src/lib/gengen/gr_probe_signal_X.h.t | 58 | ||||
-rw-r--r-- | gnuradio-core/src/lib/gengen/gr_probe_signal_X.i.t | 32 | ||||
-rw-r--r-- | gnuradio-core/src/lib/gengen/gr_probe_signal_vX.cc.t | 59 | ||||
-rw-r--r-- | gnuradio-core/src/lib/gengen/gr_probe_signal_vX.h.t | 62 | ||||
-rw-r--r-- | gnuradio-core/src/lib/gengen/gr_probe_signal_vX.i.t | 32 |
13 files changed, 396 insertions, 6 deletions
diff --git a/gnuradio-core/src/lib/gengen/.gitignore b/gnuradio-core/src/lib/gengen/.gitignore index b91d2f197..2f53eba9a 100644 --- a/gnuradio-core/src/lib/gengen/.gitignore +++ b/gnuradio-core/src/lib/gengen/.gitignore @@ -293,6 +293,36 @@ /gr_peak_detector_ss.h /gr_peak_detector_ss.i /gr_prefix.cc +/gr_probe_signal_b.cc +/gr_probe_signal_b.h +/gr_probe_signal_b.i +/gr_probe_signal_s.cc +/gr_probe_signal_s.h +/gr_probe_signal_s.i +/gr_probe_signal_i.cc +/gr_probe_signal_i.h +/gr_probe_signal_i.i +/gr_probe_signal_f.cc +/gr_probe_signal_f.h +/gr_probe_signal_f.i +/gr_probe_signal_c.cc +/gr_probe_signal_c.h +/gr_probe_signal_c.i +/gr_probe_signal_vb.cc +/gr_probe_signal_vb.h +/gr_probe_signal_vb.i +/gr_probe_signal_vs.cc +/gr_probe_signal_vs.h +/gr_probe_signal_vs.i +/gr_probe_signal_vi.cc +/gr_probe_signal_vi.h +/gr_probe_signal_vi.i +/gr_probe_signal_vf.cc +/gr_probe_signal_vf.h +/gr_probe_signal_vf.i +/gr_probe_signal_vc.cc +/gr_probe_signal_vc.h +/gr_probe_signal_vc.i /gr_sample_and_hold_bb.cc /gr_sample_and_hold_bb.h /gr_sample_and_hold_bb.i diff --git a/gnuradio-core/src/lib/gengen/CMakeLists.txt b/gnuradio-core/src/lib/gengen/CMakeLists.txt index 98b149e97..8a43a8880 100644 --- a/gnuradio-core/src/lib/gengen/CMakeLists.txt +++ b/gnuradio-core/src/lib/gengen/CMakeLists.txt @@ -84,6 +84,8 @@ expand_h_cc_i(gr_vector_source_X b s i f c) expand_h_cc_i(gr_vector_sink_X b s i f c) expand_h_cc_i(gr_noise_source_X s i f c) expand_h_cc_i(gr_sig_source_X s i f c) +expand_h_cc_i(gr_probe_signal_X b s i f c) +expand_h_cc_i(gr_probe_signal_vX b s i f c) expand_h_cc_i(gr_add_const_XX ss ii ff cc sf) expand_h_cc_i(gr_multiply_const_XX ss ii) diff --git a/gnuradio-core/src/lib/gengen/Makefile.am b/gnuradio-core/src/lib/gengen/Makefile.am index 5fbb6f52c..e2f65c5da 100644 --- a/gnuradio-core/src/lib/gengen/Makefile.am +++ b/gnuradio-core/src/lib/gengen/Makefile.am @@ -77,6 +77,12 @@ core_generator = \ gr_peak_detector_XX.cc.t \ gr_peak_detector_XX.h.t \ gr_peak_detector_XX.i.t \ + gr_probe_signal_X.cc.t \ + gr_probe_signal_X.h.t \ + gr_probe_signal_X.i.t \ + gr_probe_signal_vX.cc.t \ + gr_probe_signal_vX.h.t \ + gr_probe_signal_vX.i.t \ gr_sample_and_hold_XX.cc.t \ gr_sample_and_hold_XX.h.t \ gr_sample_and_hold_XX.i.t \ diff --git a/gnuradio-core/src/lib/gengen/Makefile.gen b/gnuradio-core/src/lib/gengen/Makefile.gen index db260585f..b4a255dc0 100644 --- a/gnuradio-core/src/lib/gengen/Makefile.gen +++ b/gnuradio-core/src/lib/gengen/Makefile.gen @@ -72,6 +72,16 @@ GENERATED_H = \ gr_peak_detector_fb.h \ gr_peak_detector_ib.h \ gr_peak_detector_sb.h \ + gr_probe_signal_b.h \ + gr_probe_signal_s.h \ + gr_probe_signal_i.h \ + gr_probe_signal_f.h \ + gr_probe_signal_c.h \ + gr_probe_signal_vb.h \ + gr_probe_signal_vs.h \ + gr_probe_signal_vi.h \ + gr_probe_signal_vf.h \ + gr_probe_signal_vc.h \ gr_sample_and_hold_bb.h \ gr_sample_and_hold_ff.h \ gr_sample_and_hold_ii.h \ @@ -172,6 +182,16 @@ GENERATED_I = \ gr_peak_detector_fb.i \ gr_peak_detector_ib.i \ gr_peak_detector_sb.i \ + gr_probe_signal_b.i \ + gr_probe_signal_s.i \ + gr_probe_signal_i.i \ + gr_probe_signal_f.i \ + gr_probe_signal_c.i \ + gr_probe_signal_vb.i \ + gr_probe_signal_vs.i \ + gr_probe_signal_vi.i \ + gr_probe_signal_vf.i \ + gr_probe_signal_vc.i \ gr_sample_and_hold_bb.i \ gr_sample_and_hold_ff.i \ gr_sample_and_hold_ii.i \ @@ -272,6 +292,16 @@ GENERATED_CC = \ gr_peak_detector_fb.cc \ gr_peak_detector_ib.cc \ gr_peak_detector_sb.cc \ + gr_probe_signal_b.cc \ + gr_probe_signal_s.cc \ + gr_probe_signal_i.cc \ + gr_probe_signal_f.cc \ + gr_probe_signal_c.cc \ + gr_probe_signal_vb.cc \ + gr_probe_signal_vs.cc \ + gr_probe_signal_vi.cc \ + gr_probe_signal_vf.cc \ + gr_probe_signal_vc.cc \ gr_sample_and_hold_bb.cc \ gr_sample_and_hold_ff.cc \ gr_sample_and_hold_ii.cc \ diff --git a/gnuradio-core/src/lib/gengen/generate_common.py b/gnuradio-core/src/lib/gengen/generate_common.py index 6da2044e0..70f805711 100755 --- a/gnuradio-core/src/lib/gengen/generate_common.py +++ b/gnuradio-core/src/lib/gengen/generate_common.py @@ -33,7 +33,9 @@ ss_roots = [ 'gr_vector_source_X', 'gr_vector_sink_X', 'gr_noise_source_X', - 'gr_sig_source_X' + 'gr_sig_source_X', + 'gr_probe_signal_X', + 'gr_probe_signal_vX' ] # regular blocks @@ -83,6 +85,8 @@ def generate (): expand_h_cc_i ('gr_add_const_XX', 'sf') # for MC4020 expand_h_cc_i ('gr_vector_sink_X', 'b') expand_h_cc_i ('gr_vector_source_X', 'b') + expand_h_cc_i ('gr_probe_signal_X', 'b') + expand_h_cc_i ('gr_probe_signal_vX', 'b') for r in ss_roots: for s in ss_signatures: expand_h_cc_i (r, s) diff --git a/gnuradio-core/src/lib/gengen/gr_noise_source_X.h.t b/gnuradio-core/src/lib/gengen/gr_noise_source_X.h.t index ab5992257..196501c4d 100644 --- a/gnuradio-core/src/lib/gengen/gr_noise_source_X.h.t +++ b/gnuradio-core/src/lib/gengen/gr_noise_source_X.h.t @@ -34,22 +34,38 @@ class @NAME@; typedef boost::shared_ptr<@NAME@> @NAME@_sptr; +/*! \brief Make a noise source + * \param type the random distribution to use (see gr_noise_type.h) + * \param ampl a scaling factor for the output + * \param seed seed for random generators. Note that for uniform and + * Gaussian distributions, this should be a negative number. + */ GR_CORE_API @NAME@_sptr -gr_make_@BASE_NAME@ (gr_noise_type_t type, float ampl, long seed = 3021); +gr_make_@BASE_NAME@ (gr_noise_type_t type, float ampl, long seed = 0); /*! - * \brief random number source + * \brief Random number source * \ingroup source_blk + * + * \details + * Generate random values from different distributions. + * Currently, only Gaussian and uniform are enabled. + * + * \param type the random distribution to use (see gr_noise_type.h) + * \param ampl a scaling factor for the output + * \param seed seed for random generators. Note that for uniform and + * Gaussian distributions, this should be a negative number. */ class GR_CORE_API @NAME@ : public gr_sync_block { friend GR_CORE_API @NAME@_sptr + gr_make_@BASE_NAME@ (gr_noise_type_t type, float ampl, long seed); gr_noise_type_t d_type; float d_ampl; gr_random d_rng; - @NAME@ (gr_noise_type_t type, float ampl, long seed = 3021); + @NAME@ (gr_noise_type_t type, float ampl, long seed = 0); public: void set_type (gr_noise_type_t type) { d_type = type; } diff --git a/gnuradio-core/src/lib/gengen/gr_noise_source_X.i.t b/gnuradio-core/src/lib/gengen/gr_noise_source_X.i.t index 179dc0343..36a51f31a 100644 --- a/gnuradio-core/src/lib/gengen/gr_noise_source_X.i.t +++ b/gnuradio-core/src/lib/gengen/gr_noise_source_X.i.t @@ -25,11 +25,11 @@ GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@); @NAME@_sptr -gr_make_@BASE_NAME@ (gr_noise_type_t type, float ampl, long seed = 3021); +gr_make_@BASE_NAME@ (gr_noise_type_t type, float ampl, long seed = 0); class @NAME@ : public gr_block { private: - @NAME@ (gr_noise_type_t type, float ampl, long seed = 3021); + @NAME@ (gr_noise_type_t type, float ampl, long seed = 0); public: void set_type (gr_noise_type_t type) { d_type = type; } diff --git a/gnuradio-core/src/lib/gengen/gr_probe_signal_X.cc.t b/gnuradio-core/src/lib/gengen/gr_probe_signal_X.cc.t new file mode 100644 index 000000000..d60a5126a --- /dev/null +++ b/gnuradio-core/src/lib/gengen/gr_probe_signal_X.cc.t @@ -0,0 +1,59 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2010,2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include <@NAME@.h> +#include <gr_io_signature.h> + +@NAME@_sptr +gr_make_@BASE_NAME@() +{ + return gnuradio::get_initial_sptr(new @NAME@()); +} + +@NAME@::@NAME@ () +: gr_sync_block ("@BASE_NAME@", + gr_make_io_signature(1, 1, sizeof(@TYPE@)), + gr_make_io_signature(0, 0, 0)), + d_level(0) +{ +} + +@NAME@::~@NAME@() +{ +} + + +int +@NAME@::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) +{ + const @TYPE@ *in = (const @TYPE@ *) input_items[0]; + + if (noutput_items > 0) + d_level = in[noutput_items-1]; + + return noutput_items; +} diff --git a/gnuradio-core/src/lib/gengen/gr_probe_signal_X.h.t b/gnuradio-core/src/lib/gengen/gr_probe_signal_X.h.t new file mode 100644 index 000000000..26a95b9b2 --- /dev/null +++ b/gnuradio-core/src/lib/gengen/gr_probe_signal_X.h.t @@ -0,0 +1,58 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005, 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ +#ifndef @GUARD_NAME@ +#define @GUARD_NAME@ + +#include <gr_core_api.h> +#include <gr_sync_block.h> + +class @NAME@; +typedef boost::shared_ptr<@NAME@> @NAME@_sptr; + +GR_CORE_API @NAME@_sptr +gr_make_@BASE_NAME@ (); + +/*! + * \brief Sink that allows a sample to be grabbed from Python. + * \ingroup sink_blk + */ +class GR_CORE_API @NAME@ : public gr_sync_block +{ + @TYPE@ d_level; + + friend GR_CORE_API @NAME@_sptr + gr_make_@BASE_NAME@(); + + @NAME@(); + +public: + ~@NAME@(); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + + @TYPE@ level() const { return d_level; } + +}; + +#endif /* @GUARD_NAME@ */ diff --git a/gnuradio-core/src/lib/gengen/gr_probe_signal_X.i.t b/gnuradio-core/src/lib/gengen/gr_probe_signal_X.i.t new file mode 100644 index 000000000..3f1ef8ffd --- /dev/null +++ b/gnuradio-core/src/lib/gengen/gr_probe_signal_X.i.t @@ -0,0 +1,32 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005, 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@); + +@NAME@_sptr +gr_make_@BASE_NAME@ (); + +class @NAME@ : public gr_sync_block +{ +public: + @TYPE@ level (); +}; diff --git a/gnuradio-core/src/lib/gengen/gr_probe_signal_vX.cc.t b/gnuradio-core/src/lib/gengen/gr_probe_signal_vX.cc.t new file mode 100644 index 000000000..712b55b9a --- /dev/null +++ b/gnuradio-core/src/lib/gengen/gr_probe_signal_vX.cc.t @@ -0,0 +1,59 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005,2010,2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#include <@NAME@.h> +#include <gr_io_signature.h> +#include <iostream> + +@NAME@_sptr +gr_make_@BASE_NAME@(size_t size) +{ + return gnuradio::get_initial_sptr(new @NAME@(size)); +} + +@NAME@::@NAME@ (size_t size) +: gr_sync_block ("@BASE_NAME@", + gr_make_io_signature(1, 1, size*sizeof(@TYPE@)), + gr_make_io_signature(0, 0, 0)), + d_level(size, 0), d_size(size) +{ +} + +@NAME@::~@NAME@() +{ +} + +int +@NAME@::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) +{ + const @TYPE@ *in = (const @TYPE@ *) input_items[0]; + + for (int i=0; i<d_size; i++) + d_level[i] = in[(noutput_items-1)*d_size+i]; + + return noutput_items; +} diff --git a/gnuradio-core/src/lib/gengen/gr_probe_signal_vX.h.t b/gnuradio-core/src/lib/gengen/gr_probe_signal_vX.h.t new file mode 100644 index 000000000..3a7277b93 --- /dev/null +++ b/gnuradio-core/src/lib/gengen/gr_probe_signal_vX.h.t @@ -0,0 +1,62 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005, 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ +#ifndef @GUARD_NAME@ +#define @GUARD_NAME@ + +#include <vector> + +#include <gr_core_api.h> +#include <gr_sync_block.h> + +class @NAME@; +typedef boost::shared_ptr<@NAME@> @NAME@_sptr; + +GR_CORE_API @NAME@_sptr +gr_make_@BASE_NAME@ (size_t size); + +/*! + * \brief Sink that allows a sample to be grabbed from Python. + * \ingroup sink_blk + */ +class GR_CORE_API @NAME@ : public gr_sync_block +{ + std::vector<@TYPE@> d_level; + + friend GR_CORE_API @NAME@_sptr + gr_make_@BASE_NAME@(size_t size); + + @NAME@(size_t size); + + size_t d_size; + +public: + ~@NAME@(); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + + std::vector<@TYPE@> level() const { return d_level; } + +}; + +#endif /* @GUARD_NAME@ */ diff --git a/gnuradio-core/src/lib/gengen/gr_probe_signal_vX.i.t b/gnuradio-core/src/lib/gengen/gr_probe_signal_vX.i.t new file mode 100644 index 000000000..20191948a --- /dev/null +++ b/gnuradio-core/src/lib/gengen/gr_probe_signal_vX.i.t @@ -0,0 +1,32 @@ +/* -*- c++ -*- */ +/* + * Copyright 2005, 2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@); + +@NAME@_sptr +gr_make_@BASE_NAME@ (size_t size); + +class @NAME@ : public gr_sync_block +{ +public: + std::vector<@TYPE@> level (); +}; |