diff options
66 files changed, 628 insertions, 151 deletions
diff --git a/cmake/Modules/GrPackage.cmake b/cmake/Modules/GrPackage.cmake index 3aca79632..2d2dfa531 100644 --- a/cmake/Modules/GrPackage.cmake +++ b/cmake/Modules/GrPackage.cmake @@ -134,7 +134,13 @@ if((DEBIAN OR REDHAT) AND LSB_RELEASE_EXECUTABLE) endif() if(${CPACK_GENERATOR} STREQUAL NSIS) - set(CPACK_PACKAGE_FILE_NAME "gnuradio_${CPACK_PACKAGE_VERSION}_win32") + + ENABLE_LANGUAGE(C) + + include(CheckTypeSize) + check_type_size("void*[8]" BIT_WIDTH BUILTIN_TYPES_ONLY) + SET(CPACK_PACKAGE_FILE_NAME "gnuradio_${CPACK_PACKAGE_VERSION}_Win${BIT_WIDTH}") + set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CMAKE_PROJECT_NAME}") endif() diff --git a/cmake/Modules/GrPlatform.cmake b/cmake/Modules/GrPlatform.cmake index ce2e15fef..dde65cee5 100644 --- a/cmake/Modules/GrPlatform.cmake +++ b/cmake/Modules/GrPlatform.cmake @@ -37,10 +37,18 @@ if(LINUX AND EXISTS "/etc/redhat-release") set(REDHAT TRUE) endif() +if(LINUX AND EXISTS "/etc/slackware-version") + set(SLACKWARE TRUE) +endif() + ######################################################################## # when the library suffix should be 64 (applies to redhat linux family) ######################################################################## -if(NOT DEFINED LIB_SUFFIX AND REDHAT AND CMAKE_SYSTEM_PROCESSOR MATCHES "64$") +if (REDHAT OR SLACKWARE) + set(LIB64_CONVENTION TRUE) +endif() + +if(NOT DEFINED LIB_SUFFIX AND LIB64_CONVENTION AND CMAKE_SYSTEM_PROCESSOR MATCHES "64$") set(LIB_SUFFIX 64) endif() set(LIB_SUFFIX ${LIB_SUFFIX} CACHE STRING "lib directory suffix") diff --git a/config/grc_gruel.m4 b/config/grc_gruel.m4 index c3238b39e..f1002b8c7 100644 --- a/config/grc_gruel.m4 +++ b/config/grc_gruel.m4 @@ -29,6 +29,7 @@ AC_DEFUN([GRC_GRUEL],[ dnl how and where to find INCLUDES and LA and such gruel_INCLUDES="\ -I\${abs_top_srcdir}/gruel/src/include \ +-I\${abs_top_srcdir}/gruel/src/swig \ -I\${abs_top_builddir}/gruel/src/include" gruel_LA="\${abs_top_builddir}/gruel/src/lib/libgruel.la" gruel_LIBDIRPATH="\${abs_top_builddir}/gruel/src/lib:\${abs_top_builddir}/gruel/src/lib/.libs" diff --git a/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.cc b/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.cc index c894d62aa..1a9273af0 100644 --- a/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.cc +++ b/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.cc @@ -45,6 +45,7 @@ gri_fft_filter_ccc_generic::~gri_fft_filter_ccc_generic () { delete d_fwdfft; delete d_invfft; + gri_fft_free(d_xformed_taps); } #if 0 @@ -115,7 +116,7 @@ gri_fft_filter_ccc_generic::compute_sizes(int ntaps) delete d_invfft; d_fwdfft = new gri_fft_complex(d_fftsize, true, d_nthreads); d_invfft = new gri_fft_complex(d_fftsize, false, d_nthreads); - d_xformed_taps.resize(d_fftsize); + d_xformed_taps = gri_fft_malloc_complex(d_fftsize); } } @@ -152,7 +153,7 @@ gri_fft_filter_ccc_generic::filter (int nitems, const gr_complex *input, gr_comp d_fwdfft->execute(); // compute fwd xform gr_complex *a = d_fwdfft->get_outbuf(); - gr_complex *b = &d_xformed_taps[0]; + gr_complex *b = d_xformed_taps; gr_complex *c = d_invfft->get_inbuf(); volk_32fc_x2_multiply_32fc_a(c, a, b, d_fftsize); diff --git a/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.h b/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.h index 217b9ab83..899b59e03 100644 --- a/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.h +++ b/gnuradio-core/src/lib/filter/gri_fft_filter_ccc_generic.h @@ -44,8 +44,8 @@ class GR_CORE_API gri_fft_filter_ccc_generic gri_fft_complex *d_invfft; // inverse "plan" int d_nthreads; // number of FFTW threads to use std::vector<gr_complex> d_tail; // state carried between blocks for overlap-add - std::vector<gr_complex> d_xformed_taps; // Fourier xformed taps std::vector<gr_complex> d_new_taps; + gr_complex *d_xformed_taps; // Fourier xformed taps void compute_sizes(int ntaps); int tailsize() const { return d_ntaps - 1; } diff --git a/gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.cc b/gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.cc index e7f66b714..0989c9621 100644 --- a/gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.cc +++ b/gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.cc @@ -44,6 +44,7 @@ gri_fft_filter_fff_generic::~gri_fft_filter_fff_generic () { delete d_fwdfft; delete d_invfft; + gri_fft_free(d_xformed_taps); } /* @@ -102,7 +103,7 @@ gri_fft_filter_fff_generic::compute_sizes(int ntaps) delete d_invfft; d_fwdfft = new gri_fft_real_fwd(d_fftsize); d_invfft = new gri_fft_real_rev(d_fftsize); - d_xformed_taps.resize(d_fftsize/2+1); + d_xformed_taps = gri_fft_malloc_complex(d_fftsize/2+1); } } @@ -139,7 +140,7 @@ gri_fft_filter_fff_generic::filter (int nitems, const float *input, float *outpu d_fwdfft->execute(); // compute fwd xform gr_complex *a = d_fwdfft->get_outbuf(); - gr_complex *b = &d_xformed_taps[0]; + gr_complex *b = d_xformed_taps; gr_complex *c = d_invfft->get_inbuf(); volk_32fc_x2_multiply_32fc_a(c, a, b, d_fftsize/2+1); diff --git a/gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.h b/gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.h index be31068aa..6ac30cef5 100644 --- a/gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.h +++ b/gnuradio-core/src/lib/filter/gri_fft_filter_fff_generic.h @@ -41,8 +41,8 @@ class GR_CORE_API gri_fft_filter_fff_generic gri_fft_real_rev *d_invfft; // inverse "plan" int d_nthreads; // number of FFTW threads to use std::vector<float> d_tail; // state carried between blocks for overlap-add - std::vector<gr_complex> d_xformed_taps; // Fourier xformed taps std::vector<float> d_new_taps; + gr_complex *d_xformed_taps; // Fourier xformed taps void compute_sizes(int ntaps); diff --git a/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator.h b/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator.h index b2832b3f6..673802dbb 100644 --- a/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator.h +++ b/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator.h @@ -38,6 +38,10 @@ class gr_fir_fff; * Although mu, the fractional delay, is specified as a float, it is actually * quantized. 0.0 <= mu <= 1.0. That is, mu is quantized in the interpolate * method to 32nd's of a sample. + * + * For more information, in the GNU Radio source code, see: + * \li gnuradio-core/src/gen_interpolator_taps/README + * \li gnuradio-core/src/gen_interpolator_taps/praxis.txt */ class GR_CORE_API gri_mmse_fir_interpolator { diff --git a/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator_cc.h b/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator_cc.h index 2feef114b..5b04600b3 100644 --- a/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator_cc.h +++ b/gnuradio-core/src/lib/filter/gri_mmse_fir_interpolator_cc.h @@ -39,6 +39,10 @@ class gr_fir_ccf; * Although mu, the fractional delay, is specified as a float, it is actually * quantized. 0.0 <= mu <= 1.0. That is, mu is quantized in the interpolate * method to 32nd's of a sample. + * + * For more information, in the GNU Radio source code, see: + * \li gnuradio-core/src/gen_interpolator_taps/README + * \li gnuradio-core/src/gen_interpolator_taps/praxis.txt */ class GR_CORE_API gri_mmse_fir_interpolator_cc { diff --git a/gnuradio-core/src/lib/general/CMakeLists.txt b/gnuradio-core/src/lib/general/CMakeLists.txt index 2bc639cd3..ee6e4c4e6 100644 --- a/gnuradio-core/src/lib/general/CMakeLists.txt +++ b/gnuradio-core/src/lib/general/CMakeLists.txt @@ -252,7 +252,6 @@ set(gr_core_general_triple_threats gr_probe_avg_mag_sqrd_c gr_probe_avg_mag_sqrd_cf gr_probe_avg_mag_sqrd_f - gr_probe_signal_f gr_pwr_squelch_cc gr_pwr_squelch_ff gr_quadrature_demod_cf diff --git a/gnuradio-core/src/lib/general/Makefile.am b/gnuradio-core/src/lib/general/Makefile.am index 5b4a702e1..ba1f686ab 100644 --- a/gnuradio-core/src/lib/general/Makefile.am +++ b/gnuradio-core/src/lib/general/Makefile.am @@ -117,7 +117,6 @@ libgeneral_la_SOURCES = \ gr_probe_avg_mag_sqrd_c.cc \ gr_probe_avg_mag_sqrd_cf.cc \ gr_probe_avg_mag_sqrd_f.cc \ - gr_probe_signal_f.cc \ gr_pwr_squelch_cc.cc \ gr_pwr_squelch_ff.cc \ gr_quadrature_demod_cf.cc \ @@ -279,7 +278,6 @@ grinclude_HEADERS = \ gr_probe_avg_mag_sqrd_c.h \ gr_probe_avg_mag_sqrd_cf.h \ gr_probe_avg_mag_sqrd_f.h \ - gr_probe_signal_f.h \ gr_pwr_squelch_cc.h \ gr_pwr_squelch_ff.h \ gr_quadrature_demod_cf.h \ @@ -443,7 +441,6 @@ swiginclude_HEADERS = \ gr_probe_avg_mag_sqrd_c.i \ gr_probe_avg_mag_sqrd_cf.i \ gr_probe_avg_mag_sqrd_f.i \ - gr_probe_signal_f.i \ gr_pwr_squelch_cc.i \ gr_pwr_squelch_ff.i \ gr_quadrature_demod_cf.i \ diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i index 89738b01a..fcf60c927 100644 --- a/gnuradio-core/src/lib/general/general.i +++ b/gnuradio-core/src/lib/general/general.i @@ -92,7 +92,6 @@ #include <gr_probe_avg_mag_sqrd_c.h> #include <gr_probe_avg_mag_sqrd_cf.h> #include <gr_probe_avg_mag_sqrd_f.h> -#include <gr_probe_signal_f.h> #include <gr_regenerate_bb.h> #include <gr_pa_2x2_phase_combiner.h> #include <gr_kludge_copy.h> @@ -214,7 +213,6 @@ %include "gr_probe_avg_mag_sqrd_c.i" %include "gr_probe_avg_mag_sqrd_cf.i" %include "gr_probe_avg_mag_sqrd_f.i" -%include "gr_probe_signal_f.i" %include "gr_regenerate_bb.i" %include "gr_pa_2x2_phase_combiner.i" %include "gr_kludge_copy.i" diff --git a/gnuradio-core/src/lib/general/general_generated.i b/gnuradio-core/src/lib/general/general_generated.i index e12f2b0ec..89b7e1776 100644 --- a/gnuradio-core/src/lib/general/general_generated.i +++ b/gnuradio-core/src/lib/general/general_generated.i @@ -51,6 +51,16 @@ #include <gr_packed_to_unpacked_bb.h> #include <gr_packed_to_unpacked_ii.h> #include <gr_packed_to_unpacked_ss.h> +#include <gr_probe_signal_b.h> +#include <gr_probe_signal_s.h> +#include <gr_probe_signal_i.h> +#include <gr_probe_signal_f.h> +#include <gr_probe_signal_c.h> +#include <gr_probe_signal_vb.h> +#include <gr_probe_signal_vs.h> +#include <gr_probe_signal_vi.h> +#include <gr_probe_signal_vf.h> +#include <gr_probe_signal_vc.h> #include <gr_sig_source_c.h> #include <gr_sig_source_f.h> #include <gr_sig_source_i.h> @@ -123,6 +133,16 @@ %include <gr_packed_to_unpacked_bb.i> %include <gr_packed_to_unpacked_ii.i> %include <gr_packed_to_unpacked_ss.i> +%include <gr_probe_signal_b.i> +%include <gr_probe_signal_s.i> +%include <gr_probe_signal_i.i> +%include <gr_probe_signal_f.i> +%include <gr_probe_signal_c.i> +%include <gr_probe_signal_vb.i> +%include <gr_probe_signal_vs.i> +%include <gr_probe_signal_vi.i> +%include <gr_probe_signal_vf.i> +%include <gr_probe_signal_vc.i> %include <gr_sig_source_c.i> %include <gr_sig_source_f.i> %include <gr_sig_source_i.i> diff --git a/gnuradio-core/src/lib/general/gr_fxpt.h b/gnuradio-core/src/lib/general/gr_fxpt.h index 5cf736dfb..9f5937d1a 100644 --- a/gnuradio-core/src/lib/general/gr_fxpt.h +++ b/gnuradio-core/src/lib/general/gr_fxpt.h @@ -26,7 +26,7 @@ #include <gr_types.h> /*! - * \brief fixed point sine and cosine and friend GR_CORE_APIs. + * \brief fixed point sine and cosine and friends. * \ingroup misc * * fixed pt radians @@ -48,6 +48,10 @@ public: static gr_int32 float_to_fixed (float x) { + // Fold x into -PI to PI. + int d = (int)floor(x/2/PI+0.5); + x -= d*2*PI; + // And convert to an integer. return (gr_int32) ((float) x * TWO_TO_THE_31 / PI); } diff --git a/gnuradio-core/src/lib/general/gri_fft.cc b/gnuradio-core/src/lib/general/gri_fft.cc index 63e307776..2edb5f5aa 100644 --- a/gnuradio-core/src/lib/general/gri_fft.cc +++ b/gnuradio-core/src/lib/general/gri_fft.cc @@ -47,6 +47,24 @@ static int my_fftw_read_char(void *f) { return fgetc((FILE *) f); } #include <boost/filesystem/path.hpp> namespace fs = boost::filesystem; +gr_complex * +gri_fft_malloc_complex(int size) +{ + return (gr_complex*)fftwf_malloc(sizeof(gr_complex)*size); +} + +float * +gri_fft_malloc_float(int size) +{ + return (float*)fftwf_malloc(sizeof(float)*size); +} + +void +gri_fft_free(void *b) +{ + fftwf_free(b); +} + boost::mutex & gri_fft_planner::mutex() { diff --git a/gnuradio-core/src/lib/general/gri_fft.h b/gnuradio-core/src/lib/general/gri_fft.h index ed80badf1..f77a18e52 100644 --- a/gnuradio-core/src/lib/general/gri_fft.h +++ b/gnuradio-core/src/lib/general/gri_fft.h @@ -30,6 +30,19 @@ #include <gr_complex.h> #include <boost/thread.hpp> +/*! \brief Helper function for allocating complex fft buffers + */ +gr_complex* gri_fft_malloc_complex(int size); + +/*! \brief Helper function for allocating float fft buffers + */ +float* gri_fft_malloc_float(int size); + +/*! \brief Helper function for freeing fft buffers + */ +void gri_fft_free(void *b); + + /*! * \brief Export reference to planner mutex for those apps that * want to use FFTW w/o using the gri_fftw* classes. 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/general/gr_probe_signal_f.cc b/gnuradio-core/src/lib/gengen/gr_probe_signal_X.cc.t index ee1a18e89..d60a5126a 100644 --- a/gnuradio-core/src/lib/general/gr_probe_signal_f.cc +++ b/gnuradio-core/src/lib/gengen/gr_probe_signal_X.cc.t @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2005,2010 Free Software Foundation, Inc. + * Copyright 2005,2010,2012 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -23,38 +23,37 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include <gr_probe_signal_f.h> +#include <@NAME@.h> #include <gr_io_signature.h> -gr_probe_signal_f_sptr -gr_make_probe_signal_f() +@NAME@_sptr +gr_make_@BASE_NAME@() { - return gnuradio::get_initial_sptr(new gr_probe_signal_f()); + return gnuradio::get_initial_sptr(new @NAME@()); } -gr_probe_signal_f::gr_probe_signal_f () - : gr_sync_block ("probe_signal_f", - gr_make_io_signature(1, 1, sizeof(float)), +@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) { } -gr_probe_signal_f::~gr_probe_signal_f() +@NAME@::~@NAME@() { } int -gr_probe_signal_f::work(int noutput_items, +@NAME@::work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { - const float *in = (const float *) input_items[0]; + 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/general/gr_probe_signal_f.h b/gnuradio-core/src/lib/gengen/gr_probe_signal_X.h.t index b99c76976..26a95b9b2 100644 --- a/gnuradio-core/src/lib/general/gr_probe_signal_f.h +++ b/gnuradio-core/src/lib/gengen/gr_probe_signal_X.h.t @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2005 Free Software Foundation, Inc. + * Copyright 2005, 2012 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -19,40 +19,40 @@ * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ -#ifndef INCLUDED_GR_PROBE_SIGNAL_F_H -#define INCLUDED_GR_PROBE_SIGNAL_F_H +#ifndef @GUARD_NAME@ +#define @GUARD_NAME@ #include <gr_core_api.h> #include <gr_sync_block.h> -class gr_probe_signal_f; -typedef boost::shared_ptr<gr_probe_signal_f> gr_probe_signal_f_sptr; +class @NAME@; +typedef boost::shared_ptr<@NAME@> @NAME@_sptr; -GR_CORE_API gr_probe_signal_f_sptr -gr_make_probe_signal_f (); +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 gr_probe_signal_f : public gr_sync_block +class GR_CORE_API @NAME@ : public gr_sync_block { - float d_level; + @TYPE@ d_level; - friend GR_CORE_API gr_probe_signal_f_sptr - gr_make_probe_signal_f(); + friend GR_CORE_API @NAME@_sptr + gr_make_@BASE_NAME@(); - gr_probe_signal_f(); + @NAME@(); public: - ~gr_probe_signal_f(); + ~@NAME@(); int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); - float level() const { return d_level; } + @TYPE@ level() const { return d_level; } }; -#endif /* INCLUDED_GR_PROBE_SIGNAL_F_H */ +#endif /* @GUARD_NAME@ */ diff --git a/gnuradio-core/src/lib/general/gr_probe_signal_f.i b/gnuradio-core/src/lib/gengen/gr_probe_signal_X.i.t index 4255e5dfd..3f1ef8ffd 100644 --- a/gnuradio-core/src/lib/general/gr_probe_signal_f.i +++ b/gnuradio-core/src/lib/gengen/gr_probe_signal_X.i.t @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2005 Free Software Foundation, Inc. + * Copyright 2005, 2012 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -20,13 +20,13 @@ * Boston, MA 02110-1301, USA. */ -GR_SWIG_BLOCK_MAGIC(gr,probe_signal_f); +GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@); -gr_probe_signal_f_sptr -gr_make_probe_signal_f (); +@NAME@_sptr +gr_make_@BASE_NAME@ (); -class gr_probe_signal_f : public gr_sync_block +class @NAME@ : public gr_sync_block { public: - float level () const { return d_level; } + @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 (); +}; diff --git a/gnuradio-core/src/lib/runtime/gr_hier_block2.h b/gnuradio-core/src/lib/runtime/gr_hier_block2.h index 8687b7d99..9652f6bf4 100644 --- a/gnuradio-core/src/lib/runtime/gr_hier_block2.h +++ b/gnuradio-core/src/lib/runtime/gr_hier_block2.h @@ -55,6 +55,7 @@ private: gr_hier_block2_detail *d_detail; protected: + gr_hier_block2 (void){} //allows pure virtual interface sub-classes gr_hier_block2(const std::string &name, gr_io_signature_sptr input_signature, gr_io_signature_sptr output_signature); diff --git a/gnuradio-core/src/lib/runtime/gr_msg_queue.i b/gnuradio-core/src/lib/runtime/gr_msg_queue.i index c9214bef3..0a4eda78a 100644 --- a/gnuradio-core/src/lib/runtime/gr_msg_queue.i +++ b/gnuradio-core/src/lib/runtime/gr_msg_queue.i @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2005,2009,2010 Free Software Foundation, Inc. + * Copyright 2005,2009,2010,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -85,16 +85,16 @@ public: %inline %{ gr_message_sptr gr_py_msg_queue__delete_head(gr_msg_queue_sptr q) { gr_message_sptr msg; - Py_BEGIN_ALLOW_THREADS; // release global interpreter lock - msg = q->delete_head(); // possibly blocking call - Py_END_ALLOW_THREADS; // acquire global interpreter lock + GR_PYTHON_BLOCKING_CODE( + msg = q->delete_head(); + ) return msg; } void gr_py_msg_queue__insert_tail(gr_msg_queue_sptr q, gr_message_sptr msg) { - Py_BEGIN_ALLOW_THREADS; // release global interpreter lock - q->insert_tail(msg); // possibly blocking call - Py_END_ALLOW_THREADS; // acquire global interpreter lock + GR_PYTHON_BLOCKING_CODE( + q->insert_tail(msg); + ) } %} diff --git a/gnuradio-core/src/lib/swig/gnuradio.i b/gnuradio-core/src/lib/swig/gnuradio.i index e365aeac7..972d56c84 100644 --- a/gnuradio-core/src/lib/swig/gnuradio.i +++ b/gnuradio-core/src/lib/swig/gnuradio.i @@ -25,23 +25,7 @@ // SWIG interface definition //////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////// -// Language independent exception handler -//////////////////////////////////////////////////////////////////////// -%include exception.i - -%exception { - try { - $action - } - catch(std::exception &e) { - SWIG_exception(SWIG_RuntimeError, e.what()); - } - catch(...) { - SWIG_exception(SWIG_RuntimeError, "Unknown exception"); - } - -} +%include <gruel_common.i> //////////////////////////////////////////////////////////////////////// // Headers diff --git a/gnuradio-core/src/python/gnuradio/gr/CMakeLists.txt b/gnuradio-core/src/python/gnuradio/gr/CMakeLists.txt index 7b62a2f1e..3e75ead03 100644 --- a/gnuradio-core/src/python/gnuradio/gr/CMakeLists.txt +++ b/gnuradio-core/src/python/gnuradio/gr/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2010-2011 Free Software Foundation, Inc. +# Copyright 2010-2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -46,7 +46,7 @@ foreach(py_qa_test_file ${py_qa_test_files}) ${CMAKE_BINARY_DIR}/gnuradio-core/src/python ${CMAKE_BINARY_DIR}/gnuradio-core/src/lib/swig ) - set(GR_TEST_TARGET_DEPS gruel gnuradio-core) - GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${py_qa_test_file}) + set(GR_TEST_TARGET_DEPS volk gruel gnuradio-core) + GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file}) endforeach(py_qa_test_file) endif(ENABLE_TESTING) diff --git a/gnuradio-core/src/python/gnuradio/gr/Makefile.am b/gnuradio-core/src/python/gnuradio/gr/Makefile.am index 9853766f9..b1550fc57 100644 --- a/gnuradio-core/src/python/gnuradio/gr/Makefile.am +++ b/gnuradio-core/src/python/gnuradio/gr/Makefile.am @@ -90,6 +90,7 @@ noinst_PYTHON = \ qa_pll_freqdet.py \ qa_pll_refout.py \ qa_pn_correlator_cc.py \ + qa_probe_signal.py \ qa_rational_resampler.py \ qa_sig_source.py \ qa_single_pole_iir.py \ diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_probe_signal.py b/gnuradio-core/src/python/gnuradio/gr/qa_probe_signal.py new file mode 100644 index 000000000..ed0756f5b --- /dev/null +++ b/gnuradio-core/src/python/gnuradio/gr/qa_probe_signal.py @@ -0,0 +1,67 @@ +#!/usr/bin/env python +# +# Copyright 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. +# + +import time + +from gnuradio import gr, gr_unittest + +class test_probe_signal (gr_unittest.TestCase): + + def setUp (self): + self.tb = gr.top_block() + + def tearDown (self): + self.tb = None + + def test_001(self): + + value = 12.3 + repeats = 100 + src_data = [value] * repeats + + src = gr.vector_source_f(src_data) + dst = gr.probe_signal_f() + + self.tb.connect(src, dst) + self.tb.run() + output = dst.level() + self.assertAlmostEqual(value, output, places=6) + + def test_002(self): + + vector_length = 10 + repeats = 10 + value = [0.5+i for i in range(0, vector_length)] + src_data = value * repeats + + src = gr.vector_source_f(src_data) + s2v = gr.stream_to_vector(gr.sizeof_float, vector_length) + dst = gr.probe_signal_vf(vector_length) + + self.tb.connect(src, s2v, dst) + self.tb.run() + output = dst.level() + self.assertEqual(len(output), vector_length) + self.assertAlmostEqual(value[3], output[3], places=6) + +if __name__ == '__main__': + gr_unittest.run(test_probe_signal, "test_probe_signal.xml") diff --git a/gnuradio-core/src/tests/CMakeLists.txt b/gnuradio-core/src/tests/CMakeLists.txt index 6de259116..34ad36568 100644 --- a/gnuradio-core/src/tests/CMakeLists.txt +++ b/gnuradio-core/src/tests/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2010-2011 Free Software Foundation, Inc. +# Copyright 2010-2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -63,7 +63,7 @@ endforeach(test_not_run_src) # Set the test environment so the build libs will be found under MSVC. ######################################################################## include(GrTest) -set(GR_TEST_TARGET_DEPS gruel gnuradio-core test-gnuradio-core) +set(GR_TEST_TARGET_DEPS volk gruel gnuradio-core test-gnuradio-core) add_executable(gr_core_test_all test_all.cc) target_link_libraries(gr_core_test_all test-gnuradio-core) GR_ADD_TEST(gr-core-test-all gr_core_test_all) diff --git a/gr-atsc/src/lib/CMakeLists.txt b/gr-atsc/src/lib/CMakeLists.txt index d3d98b81d..dc51f0c90 100644 --- a/gr-atsc/src/lib/CMakeLists.txt +++ b/gr-atsc/src/lib/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2011 Free Software Foundation, Inc. +# Copyright 2011-212 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -129,7 +129,7 @@ list(APPEND test_atsci_sources ) include(GrTest) -set(GR_TEST_TARGET_DEPS gnuradio-atsc gnuradio-core gruel) +set(GR_TEST_TARGET_DEPS gnuradio-atsc gnuradio-core gruel volk) add_executable(test_atsci ${test_atsci_sources} test_atsci.cc) target_link_libraries(test_atsci gnuradio-atsc gnuradio-core ${CPPUNIT_LIBRARIES}) GR_ADD_TEST(atsci-test test_atsci) diff --git a/gr-atsc/src/python/CMakeLists.txt b/gr-atsc/src/python/CMakeLists.txt index aca15c572..4c2442ba0 100644 --- a/gr-atsc/src/python/CMakeLists.txt +++ b/gr-atsc/src/python/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2011 Free Software Foundation, Inc. +# Copyright 2011-2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -52,7 +52,7 @@ foreach(py_qa_test_file ${py_qa_test_files}) ${CMAKE_BINARY_DIR}/gnuradio-core/src/lib/swig ${CMAKE_BINARY_DIR}/gr-atsc/src/lib ) - set(GR_TEST_TARGET_DEPS gruel gnuradio-core gnuradio-atsc) + set(GR_TEST_TARGET_DEPS volk gruel gnuradio-core gnuradio-atsc) GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file}) endforeach(py_qa_test_file) endif(ENABLE_TESTING) diff --git a/gr-digital/python/CMakeLists.txt b/gr-digital/python/CMakeLists.txt index 905626b8b..c786b5a14 100644 --- a/gr-digital/python/CMakeLists.txt +++ b/gr-digital/python/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2011 Free Software Foundation, Inc. +# Copyright 2011-212 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -71,7 +71,7 @@ foreach(py_qa_test_file ${py_qa_test_files}) ${CMAKE_BINARY_DIR}/gr-digital/python ${CMAKE_BINARY_DIR}/gr-digital/swig ) - set(GR_TEST_TARGET_DEPS gruel gnuradio-core gnuradio-digital) + set(GR_TEST_TARGET_DEPS volk gruel gnuradio-core gnuradio-digital) GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file}) endforeach(py_qa_test_file) endif(ENABLE_TESTING) diff --git a/gr-digital/swig/digital_constellation.i b/gr-digital/swig/digital_constellation.i index 7e0ad6afe..248f90014 100644 --- a/gr-digital/swig/digital_constellation.i +++ b/gr-digital/swig/digital_constellation.i @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2010, 2011 Free Software Foundation, Inc. + * Copyright 2010,2011,2012 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -187,3 +187,22 @@ class digital_constellation_8psk : public digital_constellation public: digital_constellation_8psk (); }; + +#if SWIGPYTHON +/* + We want print(constellation) in python to produce nice useful output so + we include code at the end of the generated python file that overrides + the SWIG-generated __repr__ method. + */ +%pythoncode %{ + +digital_constellation_calcdist_sptr.__repr__ = lambda self: '<constellation calcdist (m=%s)>' % str(len(self.points())) +digital_constellation_rect_sptr.__repr__ = lambda self: '<constellation rect (m=%s)>' % str(len(self.points())) +digital_constellation_psk_sptr.__repr__ = lambda self: '<constellation psk (m=%s)>' % str(len(self.points())) +digital_constellation_bpsk_sptr.__repr__ = lambda self: '<constellation bpsk>' +digital_constellation_qpsk_sptr.__repr__ = lambda self: '<constellation qpsk>' +digital_constellation_dqpsk_sptr.__repr__ = lambda self: '<constellation dqpsk>' +digital_constellation_8psk_sptr.__repr__ = lambda self: '<constellation 8psk>' + +%} +#endif diff --git a/gr-howto-write-a-block-cmake/CMakeLists.txt b/gr-howto-write-a-block-cmake/CMakeLists.txt index 58285ae8f..cb5a0fe2e 100644 --- a/gr-howto-write-a-block-cmake/CMakeLists.txt +++ b/gr-howto-write-a-block-cmake/CMakeLists.txt @@ -22,7 +22,7 @@ # Project setup ######################################################################## cmake_minimum_required(VERSION 2.6) -project(gr-howto-write-a-block CXX) +project(gr-howto-write-a-block CXX C) enable_testing() #select the release build type by default to get optimization flags diff --git a/gr-pager/python/CMakeLists.txt b/gr-pager/python/CMakeLists.txt index bbbf35a71..08915aa00 100644 --- a/gr-pager/python/CMakeLists.txt +++ b/gr-pager/python/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2011 Free Software Foundation, Inc. +# Copyright 2011-2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -43,7 +43,7 @@ foreach(py_qa_test_file ${py_qa_test_files}) ${CMAKE_BINARY_DIR}/gr-pager/python ${CMAKE_BINARY_DIR}/gr-pager/swig ) - set(GR_TEST_TARGET_DEPS gruel gnuradio-core gnuradio-pager) + set(GR_TEST_TARGET_DEPS volk gruel gnuradio-core gnuradio-pager) GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${py_qa_test_file}) endforeach(py_qa_test_file) endif(ENABLE_TESTING) diff --git a/gr-qtgui/python/CMakeLists.txt b/gr-qtgui/python/CMakeLists.txt index e61b54f08..e3fd602ef 100644 --- a/gr-qtgui/python/CMakeLists.txt +++ b/gr-qtgui/python/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2010-2011 Free Software Foundation, Inc. +# Copyright 2010-2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -40,7 +40,7 @@ foreach(py_qa_test_file ${py_qa_test_files}) ${CMAKE_BINARY_DIR}/gr-qtgui/python ${CMAKE_BINARY_DIR}/gr-qtgui/swig ) - set(GR_TEST_TARGET_DEPS gruel gnuradio-core gnuradio-qtgui) + set(GR_TEST_TARGET_DEPS volk gruel gnuradio-core gnuradio-qtgui) GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${py_qa_test_file}) endforeach(py_qa_test_file) endif(ENABLE_TESTING) diff --git a/gr-trellis/src/python/CMakeLists.txt b/gr-trellis/src/python/CMakeLists.txt index 9a9cc6aed..66ca3eb13 100644 --- a/gr-trellis/src/python/CMakeLists.txt +++ b/gr-trellis/src/python/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2011 Free Software Foundation, Inc. +# Copyright 2011-2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -31,7 +31,7 @@ foreach(py_qa_test_file ${py_qa_test_files}) ${CMAKE_BINARY_DIR}/gr-digital/swig ${CMAKE_BINARY_DIR}/gr-trellis/src/lib ) - set(GR_TEST_TARGET_DEPS gruel gnuradio-core gnuradio-digital gnuradio-trellis) + set(GR_TEST_TARGET_DEPS volk gruel gnuradio-core gnuradio-digital gnuradio-trellis) GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${py_qa_test_file}) endforeach(py_qa_test_file) endif(ENABLE_TESTING) diff --git a/gr-uhd/include/gr_uhd_usrp_sink.h b/gr-uhd/include/gr_uhd_usrp_sink.h index ce76ec03b..d6cbe2fdc 100644 --- a/gr-uhd/include/gr_uhd_usrp_sink.h +++ b/gr-uhd/include/gr_uhd_usrp_sink.h @@ -448,6 +448,15 @@ public: * \return the multi usrp device object */ virtual uhd::usrp::multi_usrp::sptr get_device(void) = 0; + + /*! + * Perform write on the user configuration register bus. These only exist if + * the user has implemented custom setting registers in the device FPGA. + * \param addr 8-bit register address + * \param data 32-bit register value + * \param mboard which motherboard to set the user register + */ + virtual void set_user_register(const uint8_t addr, const uint32_t data, size_t mboard = 0) = 0; }; #endif /* INCLUDED_GR_UHD_USRP_SINK_H */ diff --git a/gr-uhd/include/gr_uhd_usrp_source.h b/gr-uhd/include/gr_uhd_usrp_source.h index 8a799b397..cf2186bc0 100644 --- a/gr-uhd/include/gr_uhd_usrp_source.h +++ b/gr-uhd/include/gr_uhd_usrp_source.h @@ -457,6 +457,15 @@ public: virtual uhd::usrp::multi_usrp::sptr get_device(void) = 0; /*! + * Perform write on the user configuration register bus. These only exist if + * the user has implemented custom setting registers in the device FPGA. + * \param addr 8-bit register address + * \param data 32-bit register value + * \param mboard which motherboard to set the user register + */ + virtual void set_user_register(const uint8_t addr, const uint32_t data, size_t mboard = 0) = 0; + + /*! * Convenience function for finite data acquisition. * This is not to be used with the scheduler; rather, * one can request samples from the USRP in python. diff --git a/gr-uhd/lib/gr_uhd_usrp_sink.cc b/gr-uhd/lib/gr_uhd_usrp_sink.cc index 05237100c..7d173d972 100644 --- a/gr-uhd/lib/gr_uhd_usrp_sink.cc +++ b/gr-uhd/lib/gr_uhd_usrp_sink.cc @@ -278,6 +278,15 @@ public: return _dev; } + void set_user_register(const uint8_t addr, const uint32_t data, size_t mboard){ + #ifdef UHD_USRP_MULTI_USRP_USER_REGS_API + _dev->set_user_register(addr, data, mboard); + #else + throw std::runtime_error("not implemented in this version"); + #endif + } + + /*********************************************************************** * Work **********************************************************************/ diff --git a/gr-uhd/lib/gr_uhd_usrp_source.cc b/gr-uhd/lib/gr_uhd_usrp_source.cc index 2244238bd..5d3a3321e 100644 --- a/gr-uhd/lib/gr_uhd_usrp_source.cc +++ b/gr-uhd/lib/gr_uhd_usrp_source.cc @@ -290,6 +290,14 @@ public: return _dev; } + void set_user_register(const uint8_t addr, const uint32_t data, size_t mboard){ + #ifdef UHD_USRP_MULTI_USRP_USER_REGS_API + _dev->set_user_register(addr, data, mboard); + #else + throw std::runtime_error("not implemented in this version"); + #endif + } + /*********************************************************************** * Work **********************************************************************/ diff --git a/gr-video-sdl/src/CMakeLists.txt b/gr-video-sdl/src/CMakeLists.txt index 3bfe9bb62..0c2069112 100644 --- a/gr-video-sdl/src/CMakeLists.txt +++ b/gr-video-sdl/src/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2011 Free Software Foundation, Inc. +# Copyright 2011-2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -106,7 +106,7 @@ foreach(py_qa_test_file ${py_qa_test_files}) ${CMAKE_BINARY_DIR}/gnuradio-core/src/lib/swig ${CMAKE_BINARY_DIR}/gr-video-sdl/src ) - set(GR_TEST_TARGET_DEPS gruel gnuradio-core gnuradio-video-sdl) + set(GR_TEST_TARGET_DEPS volk gruel gnuradio-core gnuradio-video-sdl) GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${py_qa_test_file}) endforeach(py_qa_test_file) endif(ENABLE_TESTING AND ENABLE_PYTHON) diff --git a/gr-vocoder/python/CMakeLists.txt b/gr-vocoder/python/CMakeLists.txt index fff3fffbd..ee3765d5e 100644 --- a/gr-vocoder/python/CMakeLists.txt +++ b/gr-vocoder/python/CMakeLists.txt @@ -44,7 +44,7 @@ foreach(py_qa_test_file ${py_qa_test_files}) ${CMAKE_BINARY_DIR}/gr-vocoder/python ${CMAKE_BINARY_DIR}/gr-vocoder/swig ) - set(GR_TEST_TARGET_DEPS gruel gnuradio-core gnuradio-vocoder) + set(GR_TEST_TARGET_DEPS volk gruel gnuradio-core gnuradio-vocoder) GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file}) endforeach(py_qa_test_file) endif(ENABLE_TESTING) diff --git a/grc/blocks/gr_channel_model.xml b/grc/blocks/gr_channel_model.xml index e23062dff..d0d178d34 100644 --- a/grc/blocks/gr_channel_model.xml +++ b/grc/blocks/gr_channel_model.xml @@ -47,7 +47,7 @@ <param> <name>Seed</name> <key>seed</key> - <value>42</value> + <value>0</value> <type>int</type> </param> <sink> diff --git a/grc/blocks/gr_noise_source_x.xml b/grc/blocks/gr_noise_source_x.xml index 4789b4400..72daaaa20 100644 --- a/grc/blocks/gr_noise_source_x.xml +++ b/grc/blocks/gr_noise_source_x.xml @@ -67,7 +67,7 @@ <param> <name>Seed</name> <key>seed</key> - <value>42</value> + <value>0</value> <type>int</type> </param> <source> diff --git a/gruel/src/python/CMakeLists.txt b/gruel/src/python/CMakeLists.txt index be5ac956e..13f2111ba 100644 --- a/gruel/src/python/CMakeLists.txt +++ b/gruel/src/python/CMakeLists.txt @@ -47,6 +47,6 @@ foreach(py_qa_test_file ${py_qa_test_files}) ${CMAKE_BINARY_DIR}/gruel/src/swig ) set(GR_TEST_TARGET_DEPS gruel gnuradio-core) - GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${py_qa_test_file}) + GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file}) endforeach(py_qa_test_file) endif(ENABLE_TESTING) diff --git a/gruel/src/swig/CMakeLists.txt b/gruel/src/swig/CMakeLists.txt index 7d69ee549..6f636fc3f 100644 --- a/gruel/src/swig/CMakeLists.txt +++ b/gruel/src/swig/CMakeLists.txt @@ -38,7 +38,7 @@ GR_SWIG_INSTALL( ) install( - FILES gr_intrusive_ptr.i pmt_swig.i + FILES gr_intrusive_ptr.i pmt_swig.i gruel_common.i ${CMAKE_CURRENT_BINARY_DIR}/pmt_swig_doc.i DESTINATION ${GR_INCLUDE_DIR}/gnuradio/swig COMPONENT "gruel_swig" diff --git a/gruel/src/swig/Makefile.am b/gruel/src/swig/Makefile.am index 9953d5566..ce0a32513 100644 --- a/gruel/src/swig/Makefile.am +++ b/gruel/src/swig/Makefile.am @@ -61,6 +61,7 @@ pmt_swig_la_swig_libadd = \ # additional SWIG files to be installed pmt_swig_swiginclude_headers = \ + gruel_common.i \ gr_intrusive_ptr.i \ $(TOP_SWIG_DOC_IFILES) diff --git a/gruel/src/swig/gruel_common.i b/gruel/src/swig/gruel_common.i new file mode 100644 index 000000000..e4261cbfa --- /dev/null +++ b/gruel/src/swig/gruel_common.i @@ -0,0 +1,66 @@ +/* + * Copyright 2011 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 GRUEL_COMMON_I +#define GRUEL_COMMON_I + +//////////////////////////////////////////////////////////////////////// +// Language independent exception handler +//////////////////////////////////////////////////////////////////////// +%include exception.i + +%exception { + try { + $action + } + catch(std::exception &e) { + SWIG_exception(SWIG_RuntimeError, e.what()); + } + catch(...) { + SWIG_exception(SWIG_RuntimeError, "Unknown exception"); + } + +} + +//////////////////////////////////////////////////////////////////////// +// Wrapper for python calls that may block +//////////////////////////////////////////////////////////////////////// + +/*! + * Use GR_PYTHON_BLOCKING_CODE when calling code that blocks. + * + * The try/catch is to save us from boost::thread::interrupt: + * If a thread from the scheduler (or any other boost thread) + * is blocking the routine and throws an interrupt exception. + */ +%{ + +#define GR_PYTHON_BLOCKING_CODE(code) { \ + PyThreadState *_save; \ + _save = PyEval_SaveThread(); \ + try{code} \ + catch(...){PyEval_RestoreThread(_save); throw;} \ + PyEval_RestoreThread(_save); \ +} + +%} + +#endif /*GRUEL_COMMON_I*/ diff --git a/gruel/src/swig/pmt_swig.i b/gruel/src/swig/pmt_swig.i index 0c937edfc..954501863 100644 --- a/gruel/src/swig/pmt_swig.i +++ b/gruel/src/swig/pmt_swig.i @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2011 Free Software Foundation, Inc. + * Copyright 2011-2012 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -34,26 +34,13 @@ #include <gruel/pmt.h> %} +%include "gruel_common.i" //load generated python docstrings %include "pmt_swig_doc.i" //////////////////////////////////////////////////////////////////////// // Language independent exception handler //////////////////////////////////////////////////////////////////////// -%include exception.i - -%exception { - try { - $action - } - catch(std::exception &e) { - SWIG_exception(SWIG_RuntimeError, e.what()); - } - catch(...) { - SWIG_exception(SWIG_RuntimeError, "Unknown exception"); - } - -} // Template intrusive_ptr for Swig to avoid dereferencing issues namespace pmt{ diff --git a/volk/cmake/FindORC.cmake b/volk/cmake/FindORC.cmake index 8d8c2d13e..1c4c417ad 100644 --- a/volk/cmake/FindORC.cmake +++ b/volk/cmake/FindORC.cmake @@ -1,5 +1,5 @@ FIND_PACKAGE(PkgConfig) -PKG_CHECK_MODULES(PC_ORC orc-0.4) +PKG_CHECK_MODULES(PC_ORC "orc-0.4 > 0.4.11") diff --git a/volk/config/orc.m4 b/volk/config/orc.m4 index d17160a9a..e332939d3 100644 --- a/volk/config/orc.m4 +++ b/volk/config/orc.m4 @@ -5,7 +5,7 @@ dnl ORC_CHECK([REQUIRED_VERSION]) AC_DEFUN([ORC_CHECK], [ - ORC_REQ=ifelse([$1], , "0.4.10", [$1]) + ORC_REQ=ifelse([$1], , "0.4.12", [$1]) if test "x$enable_orc" != "xno" ; then PKG_CHECK_MODULES(ORC, orc-0.4 >= $ORC_REQ, [ diff --git a/volk/gen/make_each_machine_c.py b/volk/gen/make_each_machine_c.py index 44e2ef3f2..a3f6203ba 100644 --- a/volk/gen/make_each_machine_c.py +++ b/volk/gen/make_each_machine_c.py @@ -65,6 +65,10 @@ def make_each_machine_c(machine_name, archs, functions, fcountlist, taglist, ali #include "volk_machines.h" #include <volk/volk_config_fixed.h> +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + """ for func in functions: tempstring += "#include <volk/" + func + ".h>\n" diff --git a/volk/include/volk/volk_32f_s32f_convert_16i_a.h b/volk/include/volk/volk_32f_s32f_convert_16i_a.h index c2a07398f..a24959678 100644 --- a/volk/include/volk/volk_32f_s32f_convert_16i_a.h +++ b/volk/include/volk/volk_32f_s32f_convert_16i_a.h @@ -1,10 +1,6 @@ #ifndef INCLUDED_volk_32f_s32f_convert_16i_a_H #define INCLUDED_volk_32f_s32f_convert_16i_a_H -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - #include <volk/volk_common.h> #include <inttypes.h> #include <stdio.h> diff --git a/volk/include/volk/volk_32f_s32f_convert_32i_a.h b/volk/include/volk/volk_32f_s32f_convert_32i_a.h index 8f2fc791e..15fa282fb 100644 --- a/volk/include/volk/volk_32f_s32f_convert_32i_a.h +++ b/volk/include/volk/volk_32f_s32f_convert_32i_a.h @@ -22,7 +22,7 @@ static inline void volk_32f_s32f_convert_32i_a_avx(int32_t* outputVector, const const float* inputVectorPtr = (const float*)inputVector; int32_t* outputVectorPtr = outputVector; - float min_val = -2147483648; + float min_val = -2147483647; float max_val = 2147483647; float r; @@ -71,7 +71,7 @@ static inline void volk_32f_s32f_convert_32i_a_sse2(int32_t* outputVector, const const float* inputVectorPtr = (const float*)inputVector; int32_t* outputVectorPtr = outputVector; - float min_val = -2147483648; + float min_val = -2147483647; float max_val = 2147483647; float r; diff --git a/volk/include/volk/volk_32f_s32f_convert_32i_u.h b/volk/include/volk/volk_32f_s32f_convert_32i_u.h index d8493454b..d203546c6 100644 --- a/volk/include/volk/volk_32f_s32f_convert_32i_u.h +++ b/volk/include/volk/volk_32f_s32f_convert_32i_u.h @@ -22,10 +22,8 @@ static inline void volk_32f_s32f_convert_32i_u_sse2(int32_t* outputVector, const const float* inputVectorPtr = (const float*)inputVector; int32_t* outputVectorPtr = outputVector; - //float min_val = -2147483647; - //float max_val = 2147483647; - float min_val = -2146400000; - float max_val = 2146400000; + float min_val = -2147483647; + float max_val = 2147483647; float r; __m128 vScalar = _mm_set_ps1(scalar); diff --git a/volk/include/volk/volk_32fc_x2_dot_prod_32fc_a.h b/volk/include/volk/volk_32fc_x2_dot_prod_32fc_a.h index a865e0737..cde9240cc 100644 --- a/volk/include/volk/volk_32fc_x2_dot_prod_32fc_a.h +++ b/volk/include/volk/volk_32fc_x2_dot_prod_32fc_a.h @@ -196,7 +196,10 @@ static inline void volk_32fc_x2_dot_prod_32fc_a_sse_64(lv_32fc_t* result, const #if LV_HAVE_SSE && LV_HAVE_32 static inline void volk_32fc_x2_dot_prod_32fc_a_sse_32(lv_32fc_t* result, const lv_32fc_t* input, const lv_32fc_t* taps, unsigned int num_bytes) { - + + volk_32fc_x2_dot_prod_32fc_a_generic(result, input, taps, num_bytes); + +#if 0 asm volatile ( " #pushl %%ebp\n\t" @@ -307,12 +310,7 @@ static inline void volk_32fc_x2_dot_prod_32fc_a_sse_32(lv_32fc_t* result, const } return; - - - - - - +#endif } #endif /*LV_HAVE_SSE*/ diff --git a/volk/lib/CMakeLists.txt b/volk/lib/CMakeLists.txt index 00d8660ab..b491f94bb 100644 --- a/volk/lib/CMakeLists.txt +++ b/volk/lib/CMakeLists.txt @@ -254,13 +254,18 @@ add_custom_command( ) ######################################################################## -# Handle orc support +# Set local include directories first ######################################################################## +include_directories( + ${CMAKE_BINARY_DIR}/include + ${CMAKE_SOURCE_DIR}/include + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} +) - - - - +######################################################################## +# Handle orc support +######################################################################## if(ORC_FOUND) #setup orc library usage include_directories(${ORC_INCLUDE_DIRS}) @@ -294,13 +299,6 @@ if(NOT WIN32) add_definitions(-fvisibility=hidden) endif() -include_directories( - ${CMAKE_SOURCE_DIR}/include - ${CMAKE_BINARY_DIR}/include - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_BINARY_DIR} -) - list(APPEND volk_sources ${CMAKE_CURRENT_SOURCE_DIR}/volk_prefs.c ${CMAKE_CURRENT_SOURCE_DIR}/volk_rank_archs.c diff --git a/volk/lib/volk_prefs.c b/volk/lib/volk_prefs.c index b29d5fd87..7e705bed4 100644 --- a/volk/lib/volk_prefs.c +++ b/volk/lib/volk_prefs.c @@ -9,7 +9,14 @@ void get_config_path(char *path) { const char *suffix = "/.volk/volk_config"; - strcpy(path, getenv("HOME")); + char *home = NULL; + if (home == NULL) home = getenv("HOME"); + if (home == NULL) home = getenv("APPDATA"); + if (home == NULL){ + path = NULL; + return; + } + strcpy(path, home); strcat(path, suffix); } @@ -22,6 +29,7 @@ int load_preferences(struct volk_arch_pref **prefs) { //get the config path get_config_path(path); + if (path == NULL) return n_arch_prefs; //no prefs found config_file = fopen(path, "r"); if(!config_file) return n_arch_prefs; //no prefs found |