diff options
147 files changed, 694 insertions, 5158 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 5d0cbe2891..3a5eb0555e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,9 +40,9 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules) # Set the version information here set(VERSION_INFO_MAJOR_VERSION 3) -set(VERSION_INFO_API_COMPAT 6) -set(VERSION_INFO_MINOR_VERSION 2) -set(VERSION_INFO_MAINT_VERSION git) +set(VERSION_INFO_API_COMPAT 7) +set(VERSION_INFO_MINOR_VERSION git) +set(VERSION_INFO_MAINT_VERSION 0) include(GrVersion) #setup version info # Append -O2 optimization flag for Debug builds diff --git a/gnuradio-core/src/lib/general/CMakeLists.txt b/gnuradio-core/src/lib/general/CMakeLists.txt index 399e075996..187be3307f 100644 --- a/gnuradio-core/src/lib/general/CMakeLists.txt +++ b/gnuradio-core/src/lib/general/CMakeLists.txt @@ -81,7 +81,6 @@ list(APPEND gnuradio_core_sources ${CMAKE_CURRENT_SOURCE_DIR}/gri_float_to_int.cc ${CMAKE_CURRENT_SOURCE_DIR}/gri_float_to_short.cc ${CMAKE_CURRENT_SOURCE_DIR}/gri_float_to_uchar.cc - ${CMAKE_CURRENT_SOURCE_DIR}/gri_glfsr.cc ${CMAKE_CURRENT_SOURCE_DIR}/gri_interleaved_short_to_complex.cc ${CMAKE_CURRENT_SOURCE_DIR}/gri_int_to_float.cc ${CMAKE_CURRENT_SOURCE_DIR}/gri_short_to_float.cc @@ -101,7 +100,6 @@ list(APPEND test_gnuradio_core_sources ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_fxpt_nco.cc ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_fxpt_vco.cc ${CMAKE_CURRENT_SOURCE_DIR}/qa_gr_math.cc - ${CMAKE_CURRENT_SOURCE_DIR}/qa_gri_lfsr.cc ) ######################################################################## @@ -140,7 +138,6 @@ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/gri_float_to_short.h ${CMAKE_CURRENT_SOURCE_DIR}/gri_float_to_uchar.h ${CMAKE_CURRENT_SOURCE_DIR}/gri_lfsr.h - ${CMAKE_CURRENT_SOURCE_DIR}/gri_glfsr.h ${CMAKE_CURRENT_SOURCE_DIR}/gri_interleaved_short_to_complex.h ${CMAKE_CURRENT_SOURCE_DIR}/gri_lfsr_15_1_0.h ${CMAKE_CURRENT_SOURCE_DIR}/gri_lfsr_32k.h @@ -176,14 +173,12 @@ endif(ENABLE_PYTHON) set(gr_core_general_triple_threats complex_vec_test gr_add_ff - gr_additive_scrambler_bb gr_agc_cc gr_agc_ff gr_agc2_cc gr_agc2_ff gr_align_on_samplenumbers_ss gr_bin_statistics_f - gr_bytes_to_syms gr_char_to_float gr_char_to_short gr_check_counting_s @@ -196,9 +191,6 @@ set(gr_core_general_triple_threats gr_cpm gr_ctcss_squelch_ff gr_decode_ccsds_27_fb - gr_diff_decoder_bb - gr_diff_encoder_bb - gr_diff_phasor_cc gr_dpll_bb gr_deinterleave gr_delay @@ -216,9 +208,6 @@ set(gr_core_general_triple_threats gr_float_to_uchar gr_fmdet_cf gr_frequency_modulator_fc - gr_framer_sink_1 - gr_glfsr_source_b - gr_glfsr_source_f gr_head gr_int_to_float gr_interleave @@ -228,7 +217,6 @@ set(gr_core_general_triple_threats gr_keep_m_in_n gr_kludge_copy gr_lfsr_32k_source_s - gr_map_bb gr_multiply_cc gr_multiply_ff gr_multiply_const_cc @@ -239,13 +227,11 @@ set(gr_core_general_triple_threats gr_null_sink gr_null_source gr_pa_2x2_phase_combiner - gr_packet_sink gr_peak_detector2_fb gr_phase_modulator_fc gr_pll_carriertracking_cc gr_pll_freqdet_cf gr_pll_refout_cc - gr_pn_correlator_cc gr_prefs gr_probe_avg_mag_sqrd_c gr_probe_avg_mag_sqrd_cf @@ -262,7 +248,6 @@ set(gr_core_general_triple_threats gr_short_to_float gr_short_to_char gr_simple_correlator - gr_simple_framer gr_simple_squelch_cc gr_skiphead gr_squelch_base_cc @@ -284,14 +269,10 @@ set(gr_core_general_triple_threats gr_vector_to_streams gr_unpack_k_bits_bb gr_pack_k_bits_bb - gr_descrambler_bb - gr_scrambler_bb - gr_probe_density_b gr_annotator_alltoall gr_annotator_1to1 gr_annotator_raw gr_burst_tagger - gr_correlate_access_code_tag_bb ) foreach(file_tt ${gr_core_general_triple_threats}) diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i index fe2cbdb822..36ff3e4e36 100644 --- a/gnuradio-core/src/lib/general/general.i +++ b/gnuradio-core/src/lib/general/general.i @@ -52,9 +52,7 @@ #include <gr_uchar_to_float.h> #include <gr_frequency_modulator_fc.h> #include <gr_phase_modulator_fc.h> -#include <gr_bytes_to_syms.h> #include <gr_simple_correlator.h> -#include <gr_simple_framer.h> #include <gr_align_on_samplenumbers_ss.h> #include <gr_complex_to_xxx.h> #include <gr_complex_to_interleaved_short.h> @@ -83,13 +81,11 @@ #include <gr_conjugate_cc.h> #include <gr_vco_f.h> #include <gr_threshold_ff.h> -#include <gr_packet_sink.h> #include <gr_dpll_bb.h> #include <gr_fmdet_cf.h> #include <gr_pll_freqdet_cf.h> #include <gr_pll_refout_cc.h> #include <gr_pll_carriertracking_cc.h> -#include <gr_pn_correlator_cc.h> #include <gr_probe_avg_mag_sqrd_c.h> #include <gr_probe_avg_mag_sqrd_cf.h> #include <gr_probe_avg_mag_sqrd_f.h> @@ -102,11 +98,6 @@ #include <gr_test.h> #include <gr_unpack_k_bits_bb.h> #include <gr_pack_k_bits_bb.h> -#include <gr_diff_phasor_cc.h> -#include <gr_diff_encoder_bb.h> -#include <gr_diff_decoder_bb.h> -#include <gr_framer_sink_1.h> -#include <gr_map_bb.h> #include <gr_multiply_cc.h> #include <gr_multiply_ff.h> #include <gr_multiply_const_cc.h> @@ -118,29 +109,22 @@ #include <gr_ctcss_squelch_ff.h> #include <gr_feedforward_agc_cc.h> #include <gr_bin_statistics_f.h> -#include <gr_glfsr_source_b.h> -#include <gr_glfsr_source_f.h> #include <gr_peak_detector2_fb.h> #include <gr_repeat.h> #include <gr_cpfsk_bc.h> #include <gr_encode_ccsds_27_bb.h> #include <gr_decode_ccsds_27_fb.h> -#include <gr_descrambler_bb.h> -#include <gr_scrambler_bb.h> -#include <gr_probe_density_b.h> #include <gr_rail_ff.h> #include <gr_stretch_ff.h> #include <gr_copy.h> -#include <gr_additive_scrambler_bb.h> #include <complex_vec_test.h> #include <gr_annotator_alltoall.h> #include <gr_annotator_1to1.h> #include <gr_annotator_raw.h> #include <gr_burst_tagger.h> #include <gr_cpm.h> -#include <gr_correlate_access_code_tag_bb.h> -#include <gr_add_ff.h> #include <gr_vector_map.h> +#include <gr_add_ff.h> %} %include "gri_control_loop.i" @@ -173,9 +157,7 @@ %include "gr_uchar_to_float.i" %include "gr_frequency_modulator_fc.i" %include "gr_phase_modulator_fc.i" -%include "gr_bytes_to_syms.i" %include "gr_simple_correlator.i" -%include "gr_simple_framer.i" %include "gr_align_on_samplenumbers_ss.i" %include "gr_complex_to_xxx.i" %include "gr_complex_to_interleaved_short.i" @@ -204,13 +186,11 @@ %include "gr_conjugate_cc.i" %include "gr_vco_f.i" %include "gr_threshold_ff.i" -%include "gr_packet_sink.i" %include "gr_dpll_bb.i" %include "gr_fmdet_cf.i" %include "gr_pll_freqdet_cf.i" %include "gr_pll_refout_cc.i" %include "gr_pll_carriertracking_cc.i" -%include "gr_pn_correlator_cc.i" %include "gr_probe_avg_mag_sqrd_c.i" %include "gr_probe_avg_mag_sqrd_cf.i" %include "gr_probe_avg_mag_sqrd_f.i" @@ -223,11 +203,6 @@ %include "gr_test.i" %include "gr_unpack_k_bits_bb.i" %include "gr_pack_k_bits_bb.i" -%include "gr_diff_phasor_cc.i" -%include "gr_diff_encoder_bb.i" -%include "gr_diff_decoder_bb.i" -%include "gr_framer_sink_1.i" -%include "gr_map_bb.i" %include "gr_multiply_cc.i" %include "gr_multiply_ff.i" %include "gr_multiply_const_cc.i" @@ -239,26 +214,19 @@ %include "gr_ctcss_squelch_ff.i" %include "gr_feedforward_agc_cc.i" %include "gr_bin_statistics_f.i" -%include "gr_glfsr_source_b.i" -%include "gr_glfsr_source_f.i" %include "gr_peak_detector2_fb.i" %include "gr_repeat.i" %include "gr_cpfsk_bc.i" %include "gr_encode_ccsds_27_bb.i" %include "gr_decode_ccsds_27_fb.i" -%include "gr_descrambler_bb.i" -%include "gr_scrambler_bb.i" -%include "gr_probe_density_b.i" %include "gr_rail_ff.i" %include "gr_stretch_ff.i" %include "gr_copy.i" -%include "gr_additive_scrambler_bb.i" %include "complex_vec_test.i" %include "gr_annotator_alltoall.i" %include "gr_annotator_1to1.i" %include "gr_annotator_raw.i" %include "gr_burst_tagger.i" %include "gr_cpm.i" -%include "gr_correlate_access_code_tag_bb.i" -%include "gr_add_ff.i" %include "gr_vector_map.i" +%include "gr_add_ff.i" diff --git a/gnuradio-core/src/lib/general/general_generated.i b/gnuradio-core/src/lib/general/general_generated.i index 89b7e1776e..43828e7f71 100644 --- a/gnuradio-core/src/lib/general/general_generated.i +++ b/gnuradio-core/src/lib/general/general_generated.i @@ -18,12 +18,6 @@ #include <gr_add_vff.h> #include <gr_add_vii.h> #include <gr_add_vss.h> -#include <gr_chunks_to_symbols_bc.h> -#include <gr_chunks_to_symbols_bf.h> -#include <gr_chunks_to_symbols_ic.h> -#include <gr_chunks_to_symbols_if.h> -#include <gr_chunks_to_symbols_sc.h> -#include <gr_chunks_to_symbols_sf.h> #include <gr_divide_cc.h> #include <gr_divide_ff.h> #include <gr_divide_ii.h> @@ -100,12 +94,6 @@ %include <gr_add_vff.i> %include <gr_add_vii.i> %include <gr_add_vss.i> -%include <gr_chunks_to_symbols_bc.i> -%include <gr_chunks_to_symbols_bf.i> -%include <gr_chunks_to_symbols_ic.i> -%include <gr_chunks_to_symbols_if.i> -%include <gr_chunks_to_symbols_sc.i> -%include <gr_chunks_to_symbols_sf.i> %include <gr_divide_cc.i> %include <gr_divide_ff.i> %include <gr_divide_ii.i> diff --git a/gnuradio-core/src/lib/general/gr_additive_scrambler_bb.cc b/gnuradio-core/src/lib/general/gr_additive_scrambler_bb.cc deleted file mode 100644 index 35cbb9572f..0000000000 --- a/gnuradio-core/src/lib/general/gr_additive_scrambler_bb.cc +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2010 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 <gr_additive_scrambler_bb.h> -#include <gr_io_signature.h> - -gr_additive_scrambler_bb_sptr -gr_make_additive_scrambler_bb(int mask, int seed, int len, int count) -{ - return gnuradio::get_initial_sptr(new gr_additive_scrambler_bb(mask, seed, len, count)); -} - -gr_additive_scrambler_bb::gr_additive_scrambler_bb(int mask, int seed, int len, int count) - : gr_sync_block("additive_scrambler_bb", - gr_make_io_signature (1, 1, sizeof (unsigned char)), - gr_make_io_signature (1, 1, sizeof (unsigned char))), - d_lfsr(mask, seed, len), - d_count(count), - d_bits(0) -{ -} - -int -gr_additive_scrambler_bb::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const unsigned char *in = (const unsigned char *) input_items[0]; - unsigned char *out = (unsigned char *) output_items[0]; - - for (int i = 0; i < noutput_items; i++) { - out[i] = in[i]^d_lfsr.next_bit(); - if (d_count > 0) { - if (++d_bits == d_count) { - d_lfsr.reset(); - d_bits = 0; - } - } - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_additive_scrambler_bb.h b/gnuradio-core/src/lib/general/gr_additive_scrambler_bb.h deleted file mode 100644 index 1c336306d6..0000000000 --- a/gnuradio-core/src/lib/general/gr_additive_scrambler_bb.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2010 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 INCLUDED_GR_ADDITIVE_SCRAMBLER_BB_H -#define INCLUDED_GR_ADDITIVE_SCRAMBLER_BB_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include "gri_lfsr.h" - -class gr_additive_scrambler_bb; -typedef boost::shared_ptr<gr_additive_scrambler_bb> gr_additive_scrambler_bb_sptr; - -GR_CORE_API gr_additive_scrambler_bb_sptr gr_make_additive_scrambler_bb(int mask, int seed, int len, int count=0); - -/*! - * Scramble an input stream using an LFSR. This block works on the LSB only - * of the input data stream, i.e., on an "unpacked binary" stream, and - * produces the same format on its output. - * - * \param mask Polynomial mask for LFSR - * \param seed Initial shift register contents - * \param len Shift register length - * \param count Number of bits after which shift register is reset, 0=never - * - * The scrambler works by XORing the incoming bit stream by the output of - * the LFSR. Optionally, after 'count' bits have been processed, the shift - * register is reset to the seed value. This allows processing fixed length - * vectors of samples. - * - * \ingroup coding_blk - */ - -class GR_CORE_API gr_additive_scrambler_bb : public gr_sync_block -{ - friend GR_CORE_API gr_additive_scrambler_bb_sptr gr_make_additive_scrambler_bb(int mask, int seed, int len, int count); - - gri_lfsr d_lfsr; - int d_count; - int d_bits; - - gr_additive_scrambler_bb(int mask, int seed, int len, int count); - -public: - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_ADDITIVE_SCRAMBLER_BB_H */ diff --git a/gnuradio-core/src/lib/general/gr_additive_scrambler_bb.i b/gnuradio-core/src/lib/general/gr_additive_scrambler_bb.i deleted file mode 100644 index acf9e8c47e..0000000000 --- a/gnuradio-core/src/lib/general/gr_additive_scrambler_bb.i +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2010 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,additive_scrambler_bb); - -gr_additive_scrambler_bb_sptr gr_make_additive_scrambler_bb(int mask, int seed, int len, int count=0); - -class gr_additive_scrambler_bb : public gr_sync_block -{ -private: - gr_additive_scrambler_bb(int mask, int seed, int len, int count); -}; diff --git a/gnuradio-core/src/lib/general/gr_bytes_to_syms.cc b/gnuradio-core/src/lib/general/gr_bytes_to_syms.cc deleted file mode 100644 index 7dafa29f99..0000000000 --- a/gnuradio-core/src/lib/general/gr_bytes_to_syms.cc +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010 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 <gr_bytes_to_syms.h> -#include <gr_io_signature.h> -#include <assert.h> - -static const int BITS_PER_BYTE = 8; - -gr_bytes_to_syms_sptr -gr_make_bytes_to_syms () -{ - return gnuradio::get_initial_sptr(new gr_bytes_to_syms ()); -} - -gr_bytes_to_syms::gr_bytes_to_syms () - : gr_sync_interpolator ("bytes_to_syms", - gr_make_io_signature (1, 1, sizeof (unsigned char)), - gr_make_io_signature (1, 1, sizeof (float)), - BITS_PER_BYTE) -{ -} - -int -gr_bytes_to_syms::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const unsigned char *in = (unsigned char *) input_items[0]; - float *out = (float *) output_items[0]; - - assert (noutput_items % BITS_PER_BYTE == 0); - - for (int i = 0; i < noutput_items / BITS_PER_BYTE; i++){ - int x = in[i]; - - *out++ = (((x >> 7) & 0x1) << 1) - 1; - *out++ = (((x >> 6) & 0x1) << 1) - 1; - *out++ = (((x >> 5) & 0x1) << 1) - 1; - *out++ = (((x >> 4) & 0x1) << 1) - 1; - *out++ = (((x >> 3) & 0x1) << 1) - 1; - *out++ = (((x >> 2) & 0x1) << 1) - 1; - *out++ = (((x >> 1) & 0x1) << 1) - 1; - *out++ = (((x >> 0) & 0x1) << 1) - 1; - } - - return noutput_items; -} - - - diff --git a/gnuradio-core/src/lib/general/gr_bytes_to_syms.h b/gnuradio-core/src/lib/general/gr_bytes_to_syms.h deleted file mode 100644 index 23e5c6b91b..0000000000 --- a/gnuradio-core/src/lib/general/gr_bytes_to_syms.h +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#ifndef INCLUDED_GR_BYTES_TO_SYMS_H -#define INCLUDED_GR_BYTES_TO_SYMS_H - -#include <gr_core_api.h> -#include <gr_sync_interpolator.h> - -class gr_bytes_to_syms; -typedef boost::shared_ptr<gr_bytes_to_syms> gr_bytes_to_syms_sptr; - -GR_CORE_API gr_bytes_to_syms_sptr gr_make_bytes_to_syms (); - -/*! - * \brief Convert stream of bytes to stream of +/- 1 symbols - * \ingroup converter_blk - * - * input: stream of bytes; output: stream of float - * - * This block is deprecated. - * - * The combination of gr_packed_to_unpacked_bb followed by - * gr_chunks_to_symbols_bf or gr_chunks_to_symbols_bc handles the - * general case of mapping from a stream of bytes into arbitrary float - * or complex symbols. - * - * \sa gr_packed_to_unpacked_bb, gr_unpacked_to_packed_bb, - * \sa gr_chunks_to_symbols_bf, gr_chunks_to_symbols_bc. - */ -class GR_CORE_API gr_bytes_to_syms : public gr_sync_interpolator -{ - friend GR_CORE_API gr_bytes_to_syms_sptr gr_make_bytes_to_syms (); - - gr_bytes_to_syms (); - - public: - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_BYTES_TO_SYMS_H */ diff --git a/gnuradio-core/src/lib/general/gr_bytes_to_syms.i b/gnuradio-core/src/lib/general/gr_bytes_to_syms.i deleted file mode 100644 index 185e7cd290..0000000000 --- a/gnuradio-core/src/lib/general/gr_bytes_to_syms.i +++ /dev/null @@ -1,30 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 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,bytes_to_syms); - -gr_bytes_to_syms_sptr gr_make_bytes_to_syms (); - -class gr_bytes_to_syms : public gr_sync_interpolator -{ - gr_bytes_to_syms (); -}; diff --git a/gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.cc b/gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.cc deleted file mode 100644 index 73ded3c8b3..0000000000 --- a/gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.cc +++ /dev/null @@ -1,129 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2006,2010,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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <gr_correlate_access_code_tag_bb.h> -#include <gr_io_signature.h> -#include <stdexcept> -#include <gr_count_bits.h> -#include <cstdio> -#include <iostream> - -#define VERBOSE 0 - - -gr_correlate_access_code_tag_bb_sptr -gr_make_correlate_access_code_tag_bb (const std::string &access_code, int threshold, const std::string &tag_name) -{ - return gnuradio::get_initial_sptr(new gr_correlate_access_code_tag_bb (access_code, threshold, tag_name)); -} - - -gr_correlate_access_code_tag_bb::gr_correlate_access_code_tag_bb ( - const std::string &access_code, int threshold, const std::string &tag_name) - : gr_sync_block ("correlate_access_code_tag_bb", - gr_make_io_signature (1, 1, sizeof(char)), - gr_make_io_signature (1, 1, sizeof(char))), - d_data_reg(0), d_mask(0), - d_threshold(threshold), d_len(0) - -{ - if (!set_access_code(access_code)){ - fprintf(stderr, "gr_correlate_access_code_tag_bb: access_code is > 64 bits\n"); - throw std::out_of_range ("access_code is > 64 bits"); - } - - std::stringstream str; - str << name() << unique_id(); - d_me = pmt::pmt_string_to_symbol(str.str()); - d_key = pmt::pmt_string_to_symbol(tag_name); -} - -gr_correlate_access_code_tag_bb::~gr_correlate_access_code_tag_bb () -{ -} - -bool -gr_correlate_access_code_tag_bb::set_access_code( - const std::string &access_code) -{ - d_len = access_code.length(); // # of bytes in string - if (d_len > 64) - return false; - - // set len top bits to 1. - d_mask = ((~0ULL) >> (64 - d_len)) << (64 - d_len); - - d_access_code = 0; - for (unsigned i=0; i < 64; i++){ - d_access_code <<= 1; - if (i < d_len) - d_access_code |= access_code[i] & 1; // look at LSB only - } - - return true; -} - -int -gr_correlate_access_code_tag_bb::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const unsigned char *in = (const unsigned char *) input_items[0]; - unsigned char *out = (unsigned char *) output_items[0]; - - uint64_t abs_out_sample_cnt = nitems_written(0); - - for (int i = 0; i < noutput_items; i++){ - - out[i] = in[i]; - - // compute hamming distance between desired access code and current data - unsigned long long wrong_bits = 0; - unsigned int nwrong = d_threshold+1; - int new_flag = 0; - - wrong_bits = (d_data_reg ^ d_access_code) & d_mask; - nwrong = gr_count_bits64(wrong_bits); - - // test for access code with up to threshold errors - new_flag = (nwrong <= d_threshold); - - // shift in new data and new flag - d_data_reg = (d_data_reg << 1) | (in[i] & 0x1); - if (new_flag) { - if(VERBOSE) std::cout << "writing tag at sample " << abs_out_sample_cnt + i << std::endl; - add_item_tag(0, //stream ID - abs_out_sample_cnt + i - 64 + d_len, //sample - d_key, //frame info - pmt::pmt_t(), //data (unused) - d_me //block src id - ); - } - } - - return noutput_items; -} - diff --git a/gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.h b/gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.h deleted file mode 100644 index 345d3004a5..0000000000 --- a/gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.h +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2006,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 INCLUDED_gr_correlate_access_code_tag_bb_H -#define INCLUDED_gr_correlate_access_code_tag_bb_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <string> - -class gr_correlate_access_code_tag_bb; -typedef boost::shared_ptr<gr_correlate_access_code_tag_bb> gr_correlate_access_code_tag_bb_sptr; - -/*! - * \param access_code is represented with 1 byte per bit, e.g., "010101010111000100" - * \param threshold maximum number of bits that may be wrong - * \param tag_name key of the tag inserted into the tag stream - */ -GR_CORE_API gr_correlate_access_code_tag_bb_sptr -gr_make_correlate_access_code_tag_bb (const std::string &access_code, int threshold, - const std::string &tag_name); - -/*! - * \brief Examine input for specified access code, one bit at a time. - * \ingroup sync_blk - * - * input: stream of bits, 1 bit per input byte (data in LSB) - * output: unaltered stream of bits (plus tags) - * - * This block annotates the input stream with tags. The tags have key - * name [tag_name], specified in the constructor. Used for searching - * an input data stream for preambles, etc. - */ -class GR_CORE_API gr_correlate_access_code_tag_bb : public gr_sync_block -{ - friend GR_CORE_API gr_correlate_access_code_tag_bb_sptr - gr_make_correlate_access_code_tag_bb (const std::string &access_code, int threshold, - const std::string &tag_name); - private: - unsigned long long d_access_code; // access code to locate start of packet - // access code is left justified in the word - unsigned long long d_data_reg; // used to look for access_code - unsigned long long d_mask; // masks access_code bits (top N bits are set where - // N is the number of bits in the access code) - unsigned int d_threshold; // how many bits may be wrong in sync vector - unsigned int d_len; //the length of the access code - - pmt::pmt_t d_key, d_me; //d_key is the tag name, d_me is the block name + unique ID - - protected: - gr_correlate_access_code_tag_bb(const std::string &access_code, int threshold, - const std::string &tag_name); - - public: - ~gr_correlate_access_code_tag_bb(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - - /*! - * \param access_code is represented with 1 byte per bit, e.g., "010101010111000100" - */ - bool set_access_code (const std::string &access_code); -}; - -#endif /* INCLUDED_gr_correlate_access_code_tag_bb_H */ diff --git a/gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.i b/gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.i deleted file mode 100644 index f7ca4bea7b..0000000000 --- a/gnuradio-core/src/lib/general/gr_correlate_access_code_tag_bb.i +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 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,correlate_access_code_tag_bb); - -/*! - * \param access_code is represented with 1 byte per bit, e.g., "010101010111000100" - * \param threshold maximum number of bits that may be wrong - */ -gr_correlate_access_code_tag_bb_sptr -gr_make_correlate_access_code_tag_bb (const std::string &access_code, int threshold, const std::string &tag_name) - throw(std::out_of_range); - -/*! - * \brief Examine input for specified access code, one bit at a time. - * \ingroup block - * - * input: stream of bits, 1 bit per input byte (data in LSB) - * output: stream of bits, 2 bits per output byte (data in LSB, flag in next higher bit) - * - * Each output byte contains two valid bits, the data bit, and the - * flag bit. The LSB (bit 0) is the data bit, and is the original - * input data, delayed 64 bits. Bit 1 is the - * flag bit and is 1 if the corresponding data bit is the first data - * bit following the access code. Otherwise the flag bit is 0. - */ -class gr_correlate_access_code_tag_bb : public gr_sync_block -{ - friend gr_correlate_access_code_tag_bb_sptr - gr_make_correlate_access_code_tag_bb (const std::string &access_code, int threshold, const std::string &tag_name); - protected: - gr_correlate_access_code_tag_bb(const std::string &access_code, int threshold, const std::string &tag_name); - - public: - ~gr_correlate_access_code_tag_bb(); - - /*! - * \param access_code is represented with 1 byte per bit, e.g., "010101010111000100" - */ - bool set_access_code (const std::string &access_code); -}; diff --git a/gnuradio-core/src/lib/general/gr_descrambler_bb.cc b/gnuradio-core/src/lib/general/gr_descrambler_bb.cc deleted file mode 100644 index b5ae28fa97..0000000000 --- a/gnuradio-core/src/lib/general/gr_descrambler_bb.cc +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2010 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 <gr_descrambler_bb.h> -#include <gr_io_signature.h> - -gr_descrambler_bb_sptr -gr_make_descrambler_bb(int mask, int seed, int len) -{ - return gnuradio::get_initial_sptr(new gr_descrambler_bb(mask, seed, len)); -} - -gr_descrambler_bb::gr_descrambler_bb(int mask, int seed, int len) - : gr_sync_block("descrambler_bb", - gr_make_io_signature (1, 1, sizeof (unsigned char)), - gr_make_io_signature (1, 1, sizeof (unsigned char))), - d_lfsr(mask, seed, len) -{ -} - -int -gr_descrambler_bb::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const unsigned char *in = (const unsigned char *) input_items[0]; - unsigned char *out = (unsigned char *) output_items[0]; - - for (int i = 0; i < noutput_items; i++) - out[i] = d_lfsr.next_bit_descramble(in[i]); - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_descrambler_bb.h b/gnuradio-core/src/lib/general/gr_descrambler_bb.h deleted file mode 100644 index 333593caaf..0000000000 --- a/gnuradio-core/src/lib/general/gr_descrambler_bb.h +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ -#ifndef INCLUDED_GR_DESCRAMBLER_BB_H -#define INCLUDED_GR_DESCRAMBLER_BB_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include "gri_lfsr.h" - -class gr_descrambler_bb; -typedef boost::shared_ptr<gr_descrambler_bb> gr_descrambler_bb_sptr; - -GR_CORE_API gr_descrambler_bb_sptr gr_make_descrambler_bb(int mask, int seed, int len); - -/*! - * Descramble an input stream using an LFSR. This block works on the LSB only - * of the input data stream, i.e., on an "unpacked binary" stream, and - * produces the same format on its output. - * - * \param mask Polynomial mask for LFSR - * \param seed Initial shift register contents - * \param len Shift register length - * - * \ingroup coding_blk - */ - -class GR_CORE_API gr_descrambler_bb : public gr_sync_block -{ - friend GR_CORE_API gr_descrambler_bb_sptr gr_make_descrambler_bb(int mask, int seed, int len); - - gri_lfsr d_lfsr; - - gr_descrambler_bb(int mask, int seed, int len); - -public: - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_DESCRAMBLER_BB_H */ diff --git a/gnuradio-core/src/lib/general/gr_descrambler_bb.i b/gnuradio-core/src/lib/general/gr_descrambler_bb.i deleted file mode 100644 index c6cd0a2852..0000000000 --- a/gnuradio-core/src/lib/general/gr_descrambler_bb.i +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,descrambler_bb); - -gr_descrambler_bb_sptr gr_make_descrambler_bb(int mask, int seed, int len); - -class gr_descrambler_bb : public gr_sync_block -{ -private: - gr_descrambler_bb(int mask, int seed, int len); -}; diff --git a/gnuradio-core/src/lib/general/gr_diff_decoder_bb.cc b/gnuradio-core/src/lib/general/gr_diff_decoder_bb.cc deleted file mode 100644 index 74324a62ea..0000000000 --- a/gnuradio-core/src/lib/general/gr_diff_decoder_bb.cc +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2010 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 <gr_diff_decoder_bb.h> -#include <gr_io_signature.h> - -gr_diff_decoder_bb_sptr -gr_make_diff_decoder_bb (unsigned int modulus) -{ - return gnuradio::get_initial_sptr(new gr_diff_decoder_bb(modulus)); -} - -gr_diff_decoder_bb::gr_diff_decoder_bb (unsigned int modulus) - : gr_sync_block ("diff_decoder_bb", - gr_make_io_signature (1, 1, sizeof (unsigned char)), - gr_make_io_signature (1, 1, sizeof (unsigned char))), - d_modulus(modulus) -{ - set_history(2); // need to look at two inputs -} - -int -gr_diff_decoder_bb::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const unsigned char *in = (const unsigned char *) input_items[0]; - unsigned char *out = (unsigned char *) output_items[0]; - in += 1; // ensure that in[-1] is valid - - unsigned modulus = d_modulus; - - for (int i = 0; i < noutput_items; i++){ - out[i] = (in[i] - in[i-1]) % modulus; - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_diff_decoder_bb.h b/gnuradio-core/src/lib/general/gr_diff_decoder_bb.h deleted file mode 100644 index c4ebbc4765..0000000000 --- a/gnuradio-core/src/lib/general/gr_diff_decoder_bb.h +++ /dev/null @@ -1,53 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_DIFF_DECODER_BB_H -#define INCLUDED_GR_DIFF_DECODER_BB_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_diff_decoder_bb; -typedef boost::shared_ptr<gr_diff_decoder_bb> gr_diff_decoder_bb_sptr; - -GR_CORE_API gr_diff_decoder_bb_sptr gr_make_diff_decoder_bb (unsigned int modulus); - -/*! - * \brief y[0] = (x[0] - x[-1]) % M - * \ingroup coding_blk - * - * Differential decoder - */ -class GR_CORE_API gr_diff_decoder_bb : public gr_sync_block -{ - friend GR_CORE_API gr_diff_decoder_bb_sptr gr_make_diff_decoder_bb (unsigned int modulus); - gr_diff_decoder_bb(unsigned int modulus); - - unsigned int d_modulus; - - public: - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/general/gr_diff_decoder_bb.i b/gnuradio-core/src/lib/general/gr_diff_decoder_bb.i deleted file mode 100644 index 3dddb17c3e..0000000000 --- a/gnuradio-core/src/lib/general/gr_diff_decoder_bb.i +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 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,diff_decoder_bb) - -gr_diff_decoder_bb_sptr gr_make_diff_decoder_bb (unsigned int modulus); - -class gr_diff_decoder_bb : public gr_sync_block -{ - private: - gr_diff_decoder_bb (unsigned int modulus); -}; diff --git a/gnuradio-core/src/lib/general/gr_diff_encoder_bb.cc b/gnuradio-core/src/lib/general/gr_diff_encoder_bb.cc deleted file mode 100644 index 98492c746e..0000000000 --- a/gnuradio-core/src/lib/general/gr_diff_encoder_bb.cc +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2010 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 <gr_diff_encoder_bb.h> -#include <gr_io_signature.h> - -gr_diff_encoder_bb_sptr -gr_make_diff_encoder_bb (unsigned int modulus) -{ - return gnuradio::get_initial_sptr(new gr_diff_encoder_bb(modulus)); -} - -gr_diff_encoder_bb::gr_diff_encoder_bb (unsigned int modulus) - : gr_sync_block ("diff_encoder_bb", - gr_make_io_signature (1, 1, sizeof (unsigned char)), - gr_make_io_signature (1, 1, sizeof (unsigned char))), - d_last_out(0), d_modulus(modulus) -{ -} - -int -gr_diff_encoder_bb::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const unsigned char *in = (const unsigned char *) input_items[0]; - unsigned char *out = (unsigned char *) output_items[0]; - - unsigned last_out = d_last_out; - unsigned modulus = d_modulus; - - for (int i = 0; i < noutput_items; i++){ - out[i] = (in[i] + last_out) % modulus; - last_out = out[i]; - } - - d_last_out = last_out; - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_diff_encoder_bb.h b/gnuradio-core/src/lib/general/gr_diff_encoder_bb.h deleted file mode 100644 index e98876b700..0000000000 --- a/gnuradio-core/src/lib/general/gr_diff_encoder_bb.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_DIFF_ENCODER_BB_H -#define INCLUDED_GR_DIFF_ENCODER_BB_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_diff_encoder_bb; -typedef boost::shared_ptr<gr_diff_encoder_bb> gr_diff_encoder_bb_sptr; - -GR_CORE_API gr_diff_encoder_bb_sptr gr_make_diff_encoder_bb (unsigned int modulus); - -/*! - * \brief y[0] = (x[0] + y[-1]) % M - * \ingroup coding_blk - * - * Differential encoder - */ -class GR_CORE_API gr_diff_encoder_bb : public gr_sync_block -{ - friend GR_CORE_API gr_diff_encoder_bb_sptr gr_make_diff_encoder_bb (unsigned int modulus); - gr_diff_encoder_bb(unsigned int modulus); - - unsigned int d_last_out; - unsigned int d_modulus; - - public: - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/general/gr_diff_encoder_bb.i b/gnuradio-core/src/lib/general/gr_diff_encoder_bb.i deleted file mode 100644 index 96dadaca5b..0000000000 --- a/gnuradio-core/src/lib/general/gr_diff_encoder_bb.i +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 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,diff_encoder_bb) - -gr_diff_encoder_bb_sptr gr_make_diff_encoder_bb (unsigned int modulus); - -class gr_diff_encoder_bb : public gr_sync_block -{ - private: - gr_diff_encoder_bb (unsigned int modulus); -}; diff --git a/gnuradio-core/src/lib/general/gr_diff_phasor_cc.cc b/gnuradio-core/src/lib/general/gr_diff_phasor_cc.cc deleted file mode 100644 index 89fa2041e7..0000000000 --- a/gnuradio-core/src/lib/general/gr_diff_phasor_cc.cc +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2010 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 <gr_diff_phasor_cc.h> -#include <gr_io_signature.h> - -gr_diff_phasor_cc_sptr -gr_make_diff_phasor_cc () -{ - return gnuradio::get_initial_sptr(new gr_diff_phasor_cc()); -} - -gr_diff_phasor_cc::gr_diff_phasor_cc () - : gr_sync_block ("diff_phasor_cc", - gr_make_io_signature (1, 1, sizeof (gr_complex)), - gr_make_io_signature (1, 1, sizeof (gr_complex))) -{ - set_history(2); -} - - -gr_diff_phasor_cc::~gr_diff_phasor_cc(){} - -int -gr_diff_phasor_cc::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - gr_complex const *in = (const gr_complex *) input_items[0]; - gr_complex *out = (gr_complex *) output_items[0]; - in += 1; // ensure that i - 1 is valid. - - for(int i = 0; i < noutput_items; i++){ - out[i] = in[i] * conj(in[i-1]); - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_diff_phasor_cc.h b/gnuradio-core/src/lib/general/gr_diff_phasor_cc.h deleted file mode 100644 index 21c4f616d5..0000000000 --- a/gnuradio-core/src/lib/general/gr_diff_phasor_cc.h +++ /dev/null @@ -1,53 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_DIFF_PHASOR_CC_H -#define INCLUDED_GR_DIFF_PHASOR_CC_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -/*! - * \brief Please fix my documentation! - * \ingroup misc - */ -class gr_diff_phasor_cc; -typedef boost::shared_ptr<gr_diff_phasor_cc> gr_diff_phasor_cc_sptr; - -GR_CORE_API gr_diff_phasor_cc_sptr gr_make_diff_phasor_cc (); - - -class GR_CORE_API gr_diff_phasor_cc : public gr_sync_block -{ - friend GR_CORE_API gr_diff_phasor_cc_sptr gr_make_diff_phasor_cc (); - - gr_diff_phasor_cc (); //constructor - - public: - ~gr_diff_phasor_cc(); //destructor - - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif diff --git a/gnuradio-core/src/lib/general/gr_diff_phasor_cc.i b/gnuradio-core/src/lib/general/gr_diff_phasor_cc.i deleted file mode 100644 index 8aecd5cc77..0000000000 --- a/gnuradio-core/src/lib/general/gr_diff_phasor_cc.i +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 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,diff_phasor_cc) - -gr_diff_phasor_cc_sptr gr_make_diff_phasor_cc (); - -class gr_diff_phasor_cc : public gr_sync_block -{ - private: - gr_diff_phasor_cc (); - - public: - ~gr_diff_phasor_cc(); -}; diff --git a/gnuradio-core/src/lib/general/gr_framer_sink_1.cc b/gnuradio-core/src/lib/general/gr_framer_sink_1.cc deleted file mode 100644 index 64a0af6a07..0000000000 --- a/gnuradio-core/src/lib/general/gr_framer_sink_1.cc +++ /dev/null @@ -1,190 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2006,2010 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 <gr_framer_sink_1.h> -#include <gr_io_signature.h> -#include <cstdio> -#include <stdexcept> -#include <string.h> - -#define VERBOSE 0 - -inline void -gr_framer_sink_1::enter_search() -{ - if (VERBOSE) - fprintf(stderr, "@ enter_search\n"); - - d_state = STATE_SYNC_SEARCH; -} - -inline void -gr_framer_sink_1::enter_have_sync() -{ - if (VERBOSE) - fprintf(stderr, "@ enter_have_sync\n"); - - d_state = STATE_HAVE_SYNC; - d_header = 0; - d_headerbitlen_cnt = 0; -} - -inline void -gr_framer_sink_1::enter_have_header(int payload_len, int whitener_offset) -{ - if (VERBOSE) - fprintf(stderr, "@ enter_have_header (payload_len = %d) (offset = %d)\n", payload_len, whitener_offset); - - d_state = STATE_HAVE_HEADER; - d_packetlen = payload_len; - d_packet_whitener_offset = whitener_offset; - d_packetlen_cnt = 0; - d_packet_byte = 0; - d_packet_byte_index = 0; -} - -gr_framer_sink_1_sptr -gr_make_framer_sink_1(gr_msg_queue_sptr target_queue) -{ - return gnuradio::get_initial_sptr(new gr_framer_sink_1(target_queue)); -} - - -gr_framer_sink_1::gr_framer_sink_1(gr_msg_queue_sptr target_queue) - : gr_sync_block ("framer_sink_1", - gr_make_io_signature (1, 1, sizeof(unsigned char)), - gr_make_io_signature (0, 0, 0)), - d_target_queue(target_queue) -{ - enter_search(); -} - -gr_framer_sink_1::~gr_framer_sink_1 () -{ -} - -int -gr_framer_sink_1::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const unsigned char *in = (const unsigned char *) input_items[0]; - int count=0; - - if (VERBOSE) - fprintf(stderr,">>> Entering state machine\n"); - - while (count < noutput_items){ - switch(d_state) { - - case STATE_SYNC_SEARCH: // Look for flag indicating beginning of pkt - if (VERBOSE) - fprintf(stderr,"SYNC Search, noutput=%d\n", noutput_items); - - while (count < noutput_items) { - if (in[count] & 0x2){ // Found it, set up for header decode - enter_have_sync(); - break; - } - count++; - } - break; - - case STATE_HAVE_SYNC: - if (VERBOSE) - fprintf(stderr,"Header Search bitcnt=%d, header=0x%08x\n", - d_headerbitlen_cnt, d_header); - - while (count < noutput_items) { // Shift bits one at a time into header - d_header = (d_header << 1) | (in[count++] & 0x1); - if (++d_headerbitlen_cnt == HEADERBITLEN) { - - if (VERBOSE) - fprintf(stderr, "got header: 0x%08x\n", d_header); - - // we have a full header, check to see if it has been received properly - if (header_ok()){ - int payload_len; - int whitener_offset; - header_payload(&payload_len, &whitener_offset); - enter_have_header(payload_len, whitener_offset); - - if (d_packetlen == 0){ // check for zero-length payload - // build a zero-length message - // NOTE: passing header field as arg1 is not scalable - gr_message_sptr msg = - gr_make_message(0, d_packet_whitener_offset, 0, 0); - - d_target_queue->insert_tail(msg); // send it - msg.reset(); // free it up - - enter_search(); - } - } - else - enter_search(); // bad header - break; // we're in a new state - } - } - break; - - case STATE_HAVE_HEADER: - if (VERBOSE) - fprintf(stderr,"Packet Build\n"); - - while (count < noutput_items) { // shift bits into bytes of packet one at a time - d_packet_byte = (d_packet_byte << 1) | (in[count++] & 0x1); - if (d_packet_byte_index++ == 7) { // byte is full so move to next byte - d_packet[d_packetlen_cnt++] = d_packet_byte; - d_packet_byte_index = 0; - - if (d_packetlen_cnt == d_packetlen){ // packet is filled - - // build a message - // NOTE: passing header field as arg1 is not scalable - gr_message_sptr msg = - gr_make_message(0, d_packet_whitener_offset, 0, d_packetlen_cnt); - memcpy(msg->msg(), d_packet, d_packetlen_cnt); - - d_target_queue->insert_tail(msg); // send it - msg.reset(); // free it up - - enter_search(); - break; - } - } - } - break; - - default: - assert(0); - - } // switch - - } // while - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_framer_sink_1.h b/gnuradio-core/src/lib/general/gr_framer_sink_1.h deleted file mode 100644 index 93e41745f3..0000000000 --- a/gnuradio-core/src/lib/general/gr_framer_sink_1.h +++ /dev/null @@ -1,107 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005,2006 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_FRAMER_SINK_1_H -#define INCLUDED_GR_FRAMER_SINK_1_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gr_msg_queue.h> - -class gr_framer_sink_1; -typedef boost::shared_ptr<gr_framer_sink_1> gr_framer_sink_1_sptr; - -GR_CORE_API gr_framer_sink_1_sptr -gr_make_framer_sink_1 (gr_msg_queue_sptr target_queue); - -/*! - * \brief Given a stream of bits and access_code flags, assemble packets. - * \ingroup sink_blk - * - * input: stream of bytes from gr_correlate_access_code_bb - * output: none. Pushes assembled packet into target queue - * - * The framer expects a fixed length header of 2 16-bit shorts - * containing the payload length, followed by the payload. If the - * 2 16-bit shorts are not identical, this packet is ignored. Better - * algs are welcome. - * - * The input data consists of bytes that have two bits used. - * Bit 0, the LSB, contains the data bit. - * Bit 1 if set, indicates that the corresponding bit is the - * the first bit of the packet. That is, this bit is the first - * one after the access code. - */ -class GR_CORE_API gr_framer_sink_1 : public gr_sync_block -{ - friend GR_CORE_API gr_framer_sink_1_sptr - gr_make_framer_sink_1 (gr_msg_queue_sptr target_queue); - - private: - enum state_t {STATE_SYNC_SEARCH, STATE_HAVE_SYNC, STATE_HAVE_HEADER}; - - static const int MAX_PKT_LEN = 4096; - static const int HEADERBITLEN = 32; - - gr_msg_queue_sptr d_target_queue; // where to send the packet when received - state_t d_state; - unsigned int d_header; // header bits - int d_headerbitlen_cnt; // how many so far - - unsigned char d_packet[MAX_PKT_LEN]; // assembled payload - unsigned char d_packet_byte; // byte being assembled - int d_packet_byte_index; // which bit of d_packet_byte we're working on - int d_packetlen; // length of packet - int d_packet_whitener_offset; // offset into whitener string to use - int d_packetlen_cnt; // how many so far - - protected: - gr_framer_sink_1(gr_msg_queue_sptr target_queue); - - void enter_search(); - void enter_have_sync(); - void enter_have_header(int payload_len, int whitener_offset); - - bool header_ok() - { - // confirm that two copies of header info are identical - return ((d_header >> 16) ^ (d_header & 0xffff)) == 0; - } - - void header_payload(int *len, int *offset) - { - // header consists of two 16-bit shorts in network byte order - // payload length is lower 12 bits - // whitener offset is upper 4 bits - *len = (d_header >> 16) & 0x0fff; - *offset = (d_header >> 28) & 0x000f; - } - - public: - ~gr_framer_sink_1(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_FRAMER_SINK_1_H */ diff --git a/gnuradio-core/src/lib/general/gr_framer_sink_1.i b/gnuradio-core/src/lib/general/gr_framer_sink_1.i deleted file mode 100644 index 06281b138d..0000000000 --- a/gnuradio-core/src/lib/general/gr_framer_sink_1.i +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2006 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 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,framer_sink_1); - -gr_framer_sink_1_sptr -gr_make_framer_sink_1(gr_msg_queue_sptr target_queue); - -class gr_framer_sink_1 : public gr_sync_block -{ - protected: - gr_framer_sink_1(gr_msg_queue_sptr target_queue); - - public: - ~gr_framer_sink_1(); -}; diff --git a/gnuradio-core/src/lib/general/gr_glfsr_source_b.cc b/gnuradio-core/src/lib/general/gr_glfsr_source_b.cc deleted file mode 100644 index fcfeb80dcf..0000000000 --- a/gnuradio-core/src/lib/general/gr_glfsr_source_b.cc +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2010 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 <gr_glfsr_source_b.h> -#include <gri_glfsr.h> -#include <gr_io_signature.h> -#include <stdexcept> - -gr_glfsr_source_b_sptr -gr_make_glfsr_source_b(int degree, bool repeat, int mask, int seed) -{ - return gnuradio::get_initial_sptr(new gr_glfsr_source_b(degree, repeat, mask, seed)); -} - -gr_glfsr_source_b::gr_glfsr_source_b(int degree, bool repeat, int mask, int seed) - : gr_sync_block ("glfsr_source_b", - gr_make_io_signature (0, 0, 0), - gr_make_io_signature (1, 1, sizeof(unsigned char))), - d_repeat(repeat), - d_index(0) -{ - if (degree < 1 || degree > 32) - throw std::runtime_error("gr_glfsr_source_b: degree must be between 1 and 32 inclusive"); - d_length = (unsigned int)((1ULL << degree)-1); - - if (mask == 0) - mask = gri_glfsr::glfsr_mask(degree); - d_glfsr = new gri_glfsr(mask, seed); -} - -gr_glfsr_source_b::~gr_glfsr_source_b() -{ - delete d_glfsr; -} - -int -gr_glfsr_source_b::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - char *out = (char *) output_items[0]; - if ((d_index > d_length) && d_repeat == false) - return -1; /* once through the sequence */ - - int i; - for (i = 0; i < noutput_items; i++) { - out[i] = d_glfsr->next_bit(); - d_index++; - if (d_index > d_length && d_repeat == false) - break; - } - - return i; -} - -int -gr_glfsr_source_b::mask() const -{ - return d_glfsr->mask(); -} diff --git a/gnuradio-core/src/lib/general/gr_glfsr_source_b.h b/gnuradio-core/src/lib/general/gr_glfsr_source_b.h deleted file mode 100644 index 7549a76b32..0000000000 --- a/gnuradio-core/src/lib/general/gr_glfsr_source_b.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_GLFSR_SOURCE_B_H -#define INCLUDED_GR_GLFSR_SOURCE_B_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gri_glfsr; - -class gr_glfsr_source_b; -typedef boost::shared_ptr<gr_glfsr_source_b> gr_glfsr_source_b_sptr; - -GR_CORE_API gr_glfsr_source_b_sptr gr_make_glfsr_source_b(int degree, bool repeat=true, int mask=0, int seed=1); - -/*! - * \brief Galois LFSR pseudo-random source - * \ingroup source_blk - */ -class GR_CORE_API gr_glfsr_source_b : public gr_sync_block -{ - private: - friend GR_CORE_API gr_glfsr_source_b_sptr - gr_make_glfsr_source_b(int degree, bool repeat, int mask, int seed); - - gri_glfsr *d_glfsr; - - bool d_repeat; - unsigned int d_index; - unsigned int d_length; - - gr_glfsr_source_b(int degree, bool repeat, int mask, int seed); - - public: - - ~gr_glfsr_source_b(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - unsigned int period() const { return d_length; } - int mask() const; -}; - -#endif /* INCLUDED_GR_GLFSR_SOURCE_B_H */ diff --git a/gnuradio-core/src/lib/general/gr_glfsr_source_b.i b/gnuradio-core/src/lib/general/gr_glfsr_source_b.i deleted file mode 100644 index ffdd52ddba..0000000000 --- a/gnuradio-core/src/lib/general/gr_glfsr_source_b.i +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 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,glfsr_source_b); - -gr_glfsr_source_b_sptr -gr_make_glfsr_source_b(int degree, bool repeat=true, int mask=0, int seed=1) - throw (std::runtime_error); - -class gr_glfsr_source_b : public gr_sync_block -{ -protected: - gr_glfsr_source_b(int degree, bool repeat, int mask, int seed); - -public: - unsigned int period() const; - int mask() const; -}; diff --git a/gnuradio-core/src/lib/general/gr_glfsr_source_f.cc b/gnuradio-core/src/lib/general/gr_glfsr_source_f.cc deleted file mode 100644 index a9efc8a706..0000000000 --- a/gnuradio-core/src/lib/general/gr_glfsr_source_f.cc +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2010 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 <gr_glfsr_source_f.h> -#include <gri_glfsr.h> -#include <gr_io_signature.h> -#include <stdexcept> - -gr_glfsr_source_f_sptr -gr_make_glfsr_source_f(int degree, bool repeat, int mask, int seed) -{ - return gnuradio::get_initial_sptr(new gr_glfsr_source_f(degree, repeat, mask, seed)); -} - -gr_glfsr_source_f::gr_glfsr_source_f(int degree, bool repeat, int mask, int seed) - : gr_sync_block ("glfsr_source_f", - gr_make_io_signature (0, 0, 0), - gr_make_io_signature (1, 1, sizeof(float))), - d_repeat(repeat), - d_index(0) -{ - if (degree < 1 || degree > 32) - throw std::runtime_error("gr_glfsr_source_f: degree must be between 1 and 32 inclusive"); - d_length = (unsigned int)((1ULL << degree)-1); - - if (mask == 0) - mask = gri_glfsr::glfsr_mask(degree); - d_glfsr = new gri_glfsr(mask, seed); -} - -gr_glfsr_source_f::~gr_glfsr_source_f() -{ - delete d_glfsr; -} - -int -gr_glfsr_source_f::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - float *out = (float *) output_items[0]; - if ((d_index > d_length) && d_repeat == false) - return -1; /* once through the sequence */ - - int i; - for (i = 0; i < noutput_items; i++) { - out[i] = (float)d_glfsr->next_bit()*2.0-1.0; - d_index++; - if (d_index > d_length && d_repeat == false) - break; - } - - return i; -} - -int -gr_glfsr_source_f::mask() const -{ - return d_glfsr->mask(); -} diff --git a/gnuradio-core/src/lib/general/gr_glfsr_source_f.h b/gnuradio-core/src/lib/general/gr_glfsr_source_f.h deleted file mode 100644 index 3549e3e5df..0000000000 --- a/gnuradio-core/src/lib/general/gr_glfsr_source_f.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_GLFSR_SOURCE_F_H -#define INCLUDED_GR_GLFSR_SOURCE_F_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gri_glfsr; - -class gr_glfsr_source_f; -typedef boost::shared_ptr<gr_glfsr_source_f> gr_glfsr_source_f_sptr; - -GR_CORE_API gr_glfsr_source_f_sptr gr_make_glfsr_source_f(int degree, bool repeat=true, int mask=0, int seed=1); - -/*! - * \brief Galois LFSR pseudo-random source generating float outputs -1.0 - 1.0 - * \ingroup source_blk - */ -class GR_CORE_API gr_glfsr_source_f : public gr_sync_block -{ - private: - friend GR_CORE_API gr_glfsr_source_f_sptr - gr_make_glfsr_source_f(int degree, bool repeat, int mask, int seed); - - gri_glfsr *d_glfsr; - - bool d_repeat; - unsigned int d_index; - unsigned int d_length; - - gr_glfsr_source_f(int degree, bool repeat, int mask, int seed); - - public: - - ~gr_glfsr_source_f(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - unsigned int period() const { return d_length; } - int mask() const; -}; - -#endif /* INCLUDED_GR_GLFSR_SOURCE_F_H */ diff --git a/gnuradio-core/src/lib/general/gr_glfsr_source_f.i b/gnuradio-core/src/lib/general/gr_glfsr_source_f.i deleted file mode 100644 index 2f84387c27..0000000000 --- a/gnuradio-core/src/lib/general/gr_glfsr_source_f.i +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 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,glfsr_source_f); - -gr_glfsr_source_f_sptr -gr_make_glfsr_source_f(int degree, bool repeat=true, int mask=0, int seed=1) - throw (std::runtime_error); - -class gr_glfsr_source_f : public gr_sync_block -{ -protected: - gr_glfsr_source_f(int degree, bool repeat, int mask, int seed); - -public: - unsigned int period() const; - int mask() const; -}; diff --git a/gnuradio-core/src/lib/general/gr_map_bb.cc b/gnuradio-core/src/lib/general/gr_map_bb.cc deleted file mode 100644 index 7deb8971a5..0000000000 --- a/gnuradio-core/src/lib/general/gr_map_bb.cc +++ /dev/null @@ -1,61 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006,2007,2010 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 <gr_map_bb.h> -#include <gr_io_signature.h> - -gr_map_bb_sptr -gr_make_map_bb (const std::vector<int> &map) -{ - return gnuradio::get_initial_sptr(new gr_map_bb (map)); -} - -gr_map_bb::gr_map_bb (const std::vector<int> &map) - : gr_sync_block ("map_bb", - gr_make_io_signature (1, 1, sizeof (unsigned char)), - gr_make_io_signature (1, 1, sizeof (unsigned char))) -{ - for (int i = 0; i < 0x100; i++) - d_map[i] = i; - - unsigned int size = std::min((size_t) 0x100, map.size()); - for (unsigned int i = 0; i < size; i++) - d_map[i] = map[i]; -} - -int -gr_map_bb::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const unsigned char *in = (const unsigned char *) input_items[0]; - unsigned char *out = (unsigned char *) output_items[0]; - - for (int i = 0; i < noutput_items; i++) - out[i] = d_map[in[i]]; - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_map_bb.h b/gnuradio-core/src/lib/general/gr_map_bb.h deleted file mode 100644 index 0a2f5a45f8..0000000000 --- a/gnuradio-core/src/lib/general/gr_map_bb.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ -#ifndef INCLUDED_GR_MAP_BB_H -#define INCLUDED_GR_MAP_BB_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_map_bb; -typedef boost::shared_ptr<gr_map_bb> gr_map_bb_sptr; - -GR_CORE_API gr_map_bb_sptr gr_make_map_bb(const std::vector<int> &map); - -/*! - * \brief output[i] = map[input[i]] - * \ingroup coding_blk - */ - -class GR_CORE_API gr_map_bb : public gr_sync_block -{ - friend GR_CORE_API gr_map_bb_sptr gr_make_map_bb(const std::vector<int> &map); - - unsigned char d_map[0x100]; - - gr_map_bb(const std::vector<int> &map); - -public: - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_MAP_BB_H */ diff --git a/gnuradio-core/src/lib/general/gr_map_bb.i b/gnuradio-core/src/lib/general/gr_map_bb.i deleted file mode 100644 index 9c8bff6447..0000000000 --- a/gnuradio-core/src/lib/general/gr_map_bb.i +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2006 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 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,map_bb); - -gr_map_bb_sptr gr_make_map_bb (const std::vector<int> &map); - -class gr_map_bb : public gr_sync_block -{ - private: - gr_map_bb (const std::vector<int> &map); -}; - diff --git a/gnuradio-core/src/lib/general/gr_packet_sink.cc b/gnuradio-core/src/lib/general/gr_packet_sink.cc deleted file mode 100644 index 19a8c5fc20..0000000000 --- a/gnuradio-core/src/lib/general/gr_packet_sink.cc +++ /dev/null @@ -1,207 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010 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 <gr_packet_sink.h> -#include <gr_io_signature.h> -#include <cstdio> -#include <errno.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <stdexcept> -#include <gr_count_bits.h> -#include <string.h> - -#define VERBOSE 0 - -static const int DEFAULT_THRESHOLD = 12; // detect access code with up to DEFAULT_THRESHOLD bits wrong - -inline void -gr_packet_sink::enter_search() -{ - if (VERBOSE) - fprintf(stderr, "@ enter_search\n"); - - d_state = STATE_SYNC_SEARCH; - d_shift_reg = 0; -} - -inline void -gr_packet_sink::enter_have_sync() -{ - if (VERBOSE) - fprintf(stderr, "@ enter_have_sync\n"); - - d_state = STATE_HAVE_SYNC; - d_header = 0; - d_headerbitlen_cnt = 0; -} - -inline void -gr_packet_sink::enter_have_header(int payload_len) -{ - if (VERBOSE) - fprintf(stderr, "@ enter_have_header (payload_len = %d)\n", payload_len); - - d_state = STATE_HAVE_HEADER; - d_packetlen = payload_len; - d_packetlen_cnt = 0; - d_packet_byte = 0; - d_packet_byte_index = 0; -} - -gr_packet_sink_sptr -gr_make_packet_sink (const std::vector<unsigned char>& sync_vector, - gr_msg_queue_sptr target_queue, int threshold) -{ - return gnuradio::get_initial_sptr(new gr_packet_sink (sync_vector, target_queue, threshold)); -} - - -gr_packet_sink::gr_packet_sink (const std::vector<unsigned char>& sync_vector, - gr_msg_queue_sptr target_queue, int threshold) - : gr_sync_block ("packet_sink", - gr_make_io_signature (1, 1, sizeof(float)), - gr_make_io_signature (0, 0, 0)), - d_target_queue(target_queue), d_threshold(threshold == -1 ? DEFAULT_THRESHOLD : threshold) -{ - d_sync_vector = 0; - for(int i=0;i<8;i++){ - d_sync_vector <<= 8; - d_sync_vector |= sync_vector[i]; - } - - enter_search(); -} - -gr_packet_sink::~gr_packet_sink () -{ -} - -int -gr_packet_sink::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - float *inbuf = (float *) input_items[0]; - int count=0; - - if (VERBOSE) - fprintf(stderr,">>> Entering state machine\n"),fflush(stderr); - - while (count<noutput_items) { - switch(d_state) { - - case STATE_SYNC_SEARCH: // Look for sync vector - if (VERBOSE) - fprintf(stderr,"SYNC Search, noutput=%d\n",noutput_items),fflush(stderr); - - while (count < noutput_items) { - if(slice(inbuf[count++])) - d_shift_reg = (d_shift_reg << 1) | 1; - else - d_shift_reg = d_shift_reg << 1; - - // Compute popcnt of putative sync vector - if(gr_count_bits64 (d_shift_reg ^ d_sync_vector) <= d_threshold) { - // Found it, set up for header decode - enter_have_sync(); - break; - } - } - break; - - case STATE_HAVE_SYNC: - if (VERBOSE) - fprintf(stderr,"Header Search bitcnt=%d, header=0x%08x\n", d_headerbitlen_cnt, d_header), - fflush(stderr); - - while (count < noutput_items) { // Shift bits one at a time into header - if(slice(inbuf[count++])) - d_header = (d_header << 1) | 1; - else - d_header = d_header << 1; - - if (++d_headerbitlen_cnt == HEADERBITLEN) { - - if (VERBOSE) - fprintf(stderr, "got header: 0x%08x\n", d_header); - - // we have a full header, check to see if it has been received properly - if (header_ok()){ - int payload_len = header_payload_len(); - if (payload_len <= MAX_PKT_LEN) // reasonable? - enter_have_header(payload_len); // yes. - else - enter_search(); // no. - } - else - enter_search(); // no. - break; // we're in a new state - } - } - break; - - case STATE_HAVE_HEADER: - if (VERBOSE) - fprintf(stderr,"Packet Build\n"),fflush(stderr); - - while (count < noutput_items) { // shift bits into bytes of packet one at a time - if(slice(inbuf[count++])) - d_packet_byte = (d_packet_byte << 1) | 1; - else - d_packet_byte = d_packet_byte << 1; - - if (d_packet_byte_index++ == 7) { // byte is full so move to next byte - d_packet[d_packetlen_cnt++] = d_packet_byte; - d_packet_byte_index = 0; - - if (d_packetlen_cnt == d_packetlen){ // packet is filled - - // build a message - gr_message_sptr msg = gr_make_message(0, 0, 0, d_packetlen_cnt); - memcpy(msg->msg(), d_packet, d_packetlen_cnt); - - d_target_queue->insert_tail(msg); // send it - msg.reset(); // free it up - - enter_search(); - break; - } - } - } - break; - - default: - assert(0); - - } // switch - - } // while - - return noutput_items; -} - diff --git a/gnuradio-core/src/lib/general/gr_packet_sink.h b/gnuradio-core/src/lib/general/gr_packet_sink.h deleted file mode 100644 index b4cb0b0f6e..0000000000 --- a/gnuradio-core/src/lib/general/gr_packet_sink.h +++ /dev/null @@ -1,112 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2005 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_PACKET_SINK_H -#define INCLUDED_GR_PACKET_SINK_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include <gr_msg_queue.h> - -class gr_packet_sink; -typedef boost::shared_ptr<gr_packet_sink> gr_packet_sink_sptr; - -GR_CORE_API gr_packet_sink_sptr -gr_make_packet_sink (const std::vector<unsigned char>& sync_vector, - gr_msg_queue_sptr target_queue, - int threshold = -1 // -1 -> use default - ); -/*! - * \brief process received bits looking for packet sync, header, and process bits into packet - * \ingroup sink_blk - */ -class GR_CORE_API gr_packet_sink : public gr_sync_block -{ - friend GR_CORE_API gr_packet_sink_sptr - gr_make_packet_sink (const std::vector<unsigned char>& sync_vector, - gr_msg_queue_sptr target_queue, - int threshold); - - private: - enum state_t {STATE_SYNC_SEARCH, STATE_HAVE_SYNC, STATE_HAVE_HEADER}; - - static const int MAX_PKT_LEN = 4096; - static const int HEADERBITLEN = 32; - - gr_msg_queue_sptr d_target_queue; // where to send the packet when received - unsigned long long d_sync_vector; // access code to locate start of packet - unsigned int d_threshold; // how many bits may be wrong in sync vector - - state_t d_state; - - unsigned long long d_shift_reg; // used to look for sync_vector - - unsigned int d_header; // header bits - int d_headerbitlen_cnt; // how many so far - - unsigned char d_packet[MAX_PKT_LEN]; // assembled payload - unsigned char d_packet_byte; // byte being assembled - int d_packet_byte_index; // which bit of d_packet_byte we're working on - int d_packetlen; // length of packet - int d_packetlen_cnt; // how many so far - - protected: - gr_packet_sink(const std::vector<unsigned char>& sync_vector, - gr_msg_queue_sptr target_queue, - int threshold); - - void enter_search(); - void enter_have_sync(); - void enter_have_header(int payload_len); - - int slice(float x) { return x > 0 ? 1 : 0; } - - bool header_ok() - { - // confirm that two copies of header info are identical - return ((d_header >> 16) ^ (d_header & 0xffff)) == 0; - } - - int header_payload_len() - { - // header consists of two 16-bit shorts in network byte order - int t = (d_header >> 16) & 0xffff; - return t; - } - - public: - ~gr_packet_sink(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - - //! return true if we detect carrier - bool carrier_sensed() const - { - return d_state != STATE_SYNC_SEARCH; - } - -}; - -#endif /* INCLUDED_GR_PACKET_SINK_H */ diff --git a/gnuradio-core/src/lib/general/gr_packet_sink.i b/gnuradio-core/src/lib/general/gr_packet_sink.i deleted file mode 100644 index d1290f9d39..0000000000 --- a/gnuradio-core/src/lib/general/gr_packet_sink.i +++ /dev/null @@ -1,41 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 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,packet_sink) - -gr_packet_sink_sptr -gr_make_packet_sink (const std::vector<unsigned char>& sync_vector, - gr_msg_queue_sptr target_queue, - int threshold = -1 // -1 -> use default - ); - -class gr_packet_sink : public gr_sync_block -{ - protected: - gr_packet_sink (const std::vector<unsigned char>& sync_vector, - gr_msg_queue_sptr target_queue, - int threshold); - public: - ~gr_packet_sink (); - - bool carrier_sensed() const; -}; diff --git a/gnuradio-core/src/lib/general/gr_pn_correlator_cc.cc b/gnuradio-core/src/lib/general/gr_pn_correlator_cc.cc deleted file mode 100644 index 818e48c34b..0000000000 --- a/gnuradio-core/src/lib/general/gr_pn_correlator_cc.cc +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007,2010 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 <gr_pn_correlator_cc.h> -#include <gr_io_signature.h> - -gr_pn_correlator_cc_sptr -gr_make_pn_correlator_cc(int degree, int mask, int seed) -{ - return gnuradio::get_initial_sptr(new gr_pn_correlator_cc(degree, mask, seed)); -} - -gr_pn_correlator_cc::gr_pn_correlator_cc(int degree, int mask, int seed) - : gr_sync_decimator ("pn_correlator_cc", - gr_make_io_signature (1, 1, sizeof(gr_complex)), - gr_make_io_signature (1, 1, sizeof(gr_complex)), - (unsigned int)((1ULL << degree)-1)) // PN code length -{ - d_len = (unsigned int)((1ULL << degree)-1); - if (mask == 0) - mask = gri_glfsr::glfsr_mask(degree); - d_reference = new gri_glfsr(mask, seed); - for (int i = 0; i < d_len; i++) // initialize to last value in sequence - d_pn = 2.0*d_reference->next_bit()-1.0; -} - -gr_pn_correlator_cc::~gr_pn_correlator_cc() -{ - delete d_reference; -} - -int -gr_pn_correlator_cc::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const gr_complex *in = (const gr_complex *) input_items[0]; - gr_complex *out = (gr_complex *) output_items[0]; - gr_complex sum; - - for (int i = 0; i < noutput_items; i++) { - sum = 0.0; - - for (int j = 0; j < d_len; j++) { - if (j != 0) // retard PN generator one sample per period - d_pn = 2.0*d_reference->next_bit()-1.0; // no conditionals - sum += *in++ * d_pn; - } - - *out++ = sum*gr_complex(1.0/d_len, 0.0); - } - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_pn_correlator_cc.h b/gnuradio-core/src/lib/general/gr_pn_correlator_cc.h deleted file mode 100644 index 69bd2c502f..0000000000 --- a/gnuradio-core/src/lib/general/gr_pn_correlator_cc.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_PN_CORRELATOR_CC_H -#define INCLUDED_GR_PN_CORRELATOR_CC_H - -#include <gr_core_api.h> -#include <gr_sync_decimator.h> -#include <gri_glfsr.h> - -class gr_pn_correlator_cc; -typedef boost::shared_ptr<gr_pn_correlator_cc> gr_pn_correlator_cc_sptr; - -GR_CORE_API gr_pn_correlator_cc_sptr -gr_make_pn_correlator_cc(int degree, int mask=0, int seed=1); -/*! - * \brief PN code sequential search correlator - * - * \ingroup sync_blk - * Receives complex baseband signal, outputs complex correlation against - * reference PN code, one sample per PN code period - */ - -class GR_CORE_API gr_pn_correlator_cc : public gr_sync_decimator -{ - friend GR_CORE_API gr_pn_correlator_cc_sptr gr_make_pn_correlator_cc(int degree, int mask, int seed); - - int d_len; - float d_pn; - gri_glfsr *d_reference; - - protected: - gr_pn_correlator_cc(int degree, int mask, int seed); - - public: - virtual int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - ~gr_pn_correlator_cc(); -}; - -#endif /* INCLUDED_GR_PN_CORRELATOR_CC_H */ diff --git a/gnuradio-core/src/lib/general/gr_pn_correlator_cc.i b/gnuradio-core/src/lib/general/gr_pn_correlator_cc.i deleted file mode 100644 index e992f33a7f..0000000000 --- a/gnuradio-core/src/lib/general/gr_pn_correlator_cc.i +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 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,pn_correlator_cc) - -gr_pn_correlator_cc_sptr -gr_make_pn_correlator_cc(int degree, int mask=0, int seed=1); - -class gr_pn_correlator_cc : public gr_sync_decimator -{ - protected: - gr_pn_correlator_cc(); -}; diff --git a/gnuradio-core/src/lib/general/gr_probe_density_b.cc b/gnuradio-core/src/lib/general/gr_probe_density_b.cc deleted file mode 100644 index 31661780af..0000000000 --- a/gnuradio-core/src/lib/general/gr_probe_density_b.cc +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2010 Free Software Foundation, Inc. - * - * 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 <gr_probe_density_b.h> -#include <gr_io_signature.h> -#include <stdexcept> -#include <iostream> - -gr_probe_density_b_sptr -gr_make_probe_density_b(double alpha) -{ - return gnuradio::get_initial_sptr(new gr_probe_density_b(alpha)); -} - -gr_probe_density_b::gr_probe_density_b(double alpha) - : gr_sync_block("density_b", - gr_make_io_signature(1, 1, sizeof(char)), - gr_make_io_signature(0, 0, 0)) -{ - set_alpha(alpha); - d_density = 1.0; -} - -gr_probe_density_b::~gr_probe_density_b() -{ -} - -int -gr_probe_density_b::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const char *in = (const char *)input_items[0]; - - for (int i = 0; i < noutput_items; i++) - d_density = d_alpha*(double)in[i] + d_beta*d_density; - - return noutput_items; -} - -void -gr_probe_density_b::set_alpha(double alpha) -{ - d_alpha = alpha; - d_beta = 1.0-d_alpha; -} - diff --git a/gnuradio-core/src/lib/general/gr_probe_density_b.h b/gnuradio-core/src/lib/general/gr_probe_density_b.h deleted file mode 100644 index ab84a63a96..0000000000 --- a/gnuradio-core/src/lib/general/gr_probe_density_b.h +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008 Free Software Foundation, Inc. - * - * 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 INCLUDED_GR_PROBE_DENSITY_B_H -#define INCLUDED_GR_PROBE_DENSITY_B_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> - -class gr_probe_density_b; - -typedef boost::shared_ptr<gr_probe_density_b> gr_probe_density_b_sptr; - -GR_CORE_API gr_probe_density_b_sptr gr_make_probe_density_b(double alpha); - -/*! - * This block maintains a running average of the input stream and - * makes it available as an accessor function. The input stream - * is type unsigned char. - * - * If you send this block a stream of unpacked bytes, it will tell - * you what the bit density is. - * - * \param alpha Average filter constant - * - */ - -class GR_CORE_API gr_probe_density_b : public gr_sync_block -{ -private: - friend GR_CORE_API gr_probe_density_b_sptr gr_make_probe_density_b(double alpha); - - double d_alpha; - double d_beta; - double d_density; - - gr_probe_density_b(double alpha); - -public: - ~gr_probe_density_b(); - - /*! - * \brief Returns the current density value - */ - double density() const { return d_density; } - - /*! - * \brief Set the average filter constant - */ - void set_alpha(double alpha); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_PROBE_DENSITY_B_H */ diff --git a/gnuradio-core/src/lib/general/gr_probe_density_b.i b/gnuradio-core/src/lib/general/gr_probe_density_b.i deleted file mode 100644 index ca65708af6..0000000000 --- a/gnuradio-core/src/lib/general/gr_probe_density_b.i +++ /dev/null @@ -1,36 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,probe_density_b); - -gr_probe_density_b_sptr gr_make_probe_density_b(double alpha); - -class gr_probe_density_b : public gr_sync_block -{ -public: - double density() const; - - void set_alpha(double alpha); - -private: - gr_probe_density_b(); -}; diff --git a/gnuradio-core/src/lib/general/gr_scrambler_bb.cc b/gnuradio-core/src/lib/general/gr_scrambler_bb.cc deleted file mode 100644 index 31eb192077..0000000000 --- a/gnuradio-core/src/lib/general/gr_scrambler_bb.cc +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2010 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 <gr_scrambler_bb.h> -#include <gr_io_signature.h> - -gr_scrambler_bb_sptr -gr_make_scrambler_bb(int mask, int seed, int len) -{ - return gnuradio::get_initial_sptr(new gr_scrambler_bb(mask, seed, len)); -} - -gr_scrambler_bb::gr_scrambler_bb(int mask, int seed, int len) - : gr_sync_block("scrambler_bb", - gr_make_io_signature (1, 1, sizeof (unsigned char)), - gr_make_io_signature (1, 1, sizeof (unsigned char))), - d_lfsr(mask, seed, len) -{ -} - -int -gr_scrambler_bb::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const unsigned char *in = (const unsigned char *) input_items[0]; - unsigned char *out = (unsigned char *) output_items[0]; - - for (int i = 0; i < noutput_items; i++) - out[i] = d_lfsr.next_bit_scramble(in[i]); - - return noutput_items; -} diff --git a/gnuradio-core/src/lib/general/gr_scrambler_bb.h b/gnuradio-core/src/lib/general/gr_scrambler_bb.h deleted file mode 100644 index edb429e0a0..0000000000 --- a/gnuradio-core/src/lib/general/gr_scrambler_bb.h +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ -#ifndef INCLUDED_GR_SCRAMBLER_BB_H -#define INCLUDED_GR_SCRAMBLER_BB_H - -#include <gr_core_api.h> -#include <gr_sync_block.h> -#include "gri_lfsr.h" - -class gr_scrambler_bb; -typedef boost::shared_ptr<gr_scrambler_bb> gr_scrambler_bb_sptr; - -GR_CORE_API gr_scrambler_bb_sptr gr_make_scrambler_bb(int mask, int seed, int len); - -/*! - * Scramble an input stream using an LFSR. This block works on the LSB only - * of the input data stream, i.e., on an "unpacked binary" stream, and - * produces the same format on its output. - * - * \param mask Polynomial mask for LFSR - * \param seed Initial shift register contents - * \param len Shift register length - * - * \ingroup coding_blk - */ - -class GR_CORE_API gr_scrambler_bb : public gr_sync_block -{ - friend GR_CORE_API gr_scrambler_bb_sptr gr_make_scrambler_bb(int mask, int seed, int len); - - gri_lfsr d_lfsr; - - gr_scrambler_bb(int mask, int seed, int len); - -public: - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - -#endif /* INCLUDED_GR_SCRAMBLER_BB_H */ diff --git a/gnuradio-core/src/lib/general/gr_scrambler_bb.i b/gnuradio-core/src/lib/general/gr_scrambler_bb.i deleted file mode 100644 index a7ef7b364f..0000000000 --- a/gnuradio-core/src/lib/general/gr_scrambler_bb.i +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ - -GR_SWIG_BLOCK_MAGIC(gr,scrambler_bb); - -gr_scrambler_bb_sptr gr_make_scrambler_bb(int mask, int seed, int len); - -class gr_scrambler_bb : public gr_sync_block -{ -private: - gr_scrambler_bb(int mask, int seed, int len); -}; diff --git a/gnuradio-core/src/lib/general/gr_simple_framer.cc b/gnuradio-core/src/lib/general/gr_simple_framer.cc deleted file mode 100644 index 506603bb71..0000000000 --- a/gnuradio-core/src/lib/general/gr_simple_framer.cc +++ /dev/null @@ -1,101 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010 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 <gr_simple_framer.h> -#include <gr_simple_framer_sync.h> -#include <gr_io_signature.h> -#include <assert.h> -#include <stdexcept> -#include <string.h> - - -gr_simple_framer_sptr -gr_make_simple_framer (int payload_bytesize) -{ - return gnuradio::get_initial_sptr(new gr_simple_framer (payload_bytesize)); -} - -gr_simple_framer::gr_simple_framer (int payload_bytesize) - : gr_block ("simple_framer", - gr_make_io_signature (1, 1, sizeof (unsigned char)), - gr_make_io_signature (1, 1, sizeof (unsigned char))), - d_seqno (0), d_payload_bytesize (payload_bytesize), - d_input_block_size (payload_bytesize), - d_output_block_size (payload_bytesize + GRSF_OVERHEAD) -{ - set_output_multiple (d_output_block_size); -} - -void -gr_simple_framer::forecast (int noutput_items, gr_vector_int &ninput_items_required) -{ - assert (noutput_items % d_output_block_size == 0); - - int nblocks = noutput_items / d_output_block_size; - int input_required = nblocks * d_input_block_size; - - unsigned ninputs = ninput_items_required.size(); - for (unsigned int i = 0; i < ninputs; i++) - ninput_items_required[i] = input_required; -} - -int -gr_simple_framer::general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - const unsigned char *in = (const unsigned char *) input_items[0]; - unsigned char *out = (unsigned char *) output_items[0]; - - int n = 0; - int nblocks = 0; - - memset (out, 0x55, noutput_items); - - while (n < noutput_items){ - out[0] = (GRSF_SYNC >> 56) & 0xff; - out[1] = (GRSF_SYNC >> 48) & 0xff; - out[2] = (GRSF_SYNC >> 40) & 0xff; - out[3] = (GRSF_SYNC >> 32) & 0xff; - out[4] = (GRSF_SYNC >> 24) & 0xff; - out[5] = (GRSF_SYNC >> 16) & 0xff; - out[6] = (GRSF_SYNC >> 8) & 0xff; - out[7] = (GRSF_SYNC >> 0) & 0xff; - out[8] = d_seqno++; - - memcpy (&out[9], in, d_input_block_size); - in += d_input_block_size; - out += d_output_block_size; - n += d_output_block_size; - nblocks++; - } - - assert (n == noutput_items); - - consume_each (nblocks * d_input_block_size); - return n; -} diff --git a/gnuradio-core/src/lib/general/gr_simple_framer.h b/gnuradio-core/src/lib/general/gr_simple_framer.h deleted file mode 100644 index 76a4b7baba..0000000000 --- a/gnuradio-core/src/lib/general/gr_simple_framer.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GR_SIMPLE_FRAMER_H -#define INCLUDED_GR_SIMPLE_FRAMER_H - -#include <gr_core_api.h> -#include <gr_block.h> - -class gr_simple_framer; -typedef boost::shared_ptr<gr_simple_framer> gr_simple_framer_sptr; - -GR_CORE_API gr_simple_framer_sptr gr_make_simple_framer (int payload_bytesize); - -/*! - * \brief add sync field, seq number and command field to payload - * \ingroup sync_blk - */ -class GR_CORE_API gr_simple_framer : public gr_block -{ - int d_seqno; - int d_payload_bytesize; - int d_input_block_size; // bytes - int d_output_block_size; // bytes - - friend GR_CORE_API gr_simple_framer_sptr gr_make_simple_framer (int payload_bytesize); - gr_simple_framer (int payload_bytesize); - - public: - void forecast (int noutput_items, - gr_vector_int &ninput_items_required); - - int general_work (int noutput_items, - gr_vector_int &ninput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; - - -#endif /* INCLUDED_GR_SIMPLE_FRAMER_H */ diff --git a/gnuradio-core/src/lib/general/gr_simple_framer.i b/gnuradio-core/src/lib/general/gr_simple_framer.i deleted file mode 100644 index c13ead87bf..0000000000 --- a/gnuradio-core/src/lib/general/gr_simple_framer.i +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 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,simple_framer); - -gr_simple_framer_sptr gr_make_simple_framer (int payload_bytesize); - -class gr_simple_framer : public gr_block -{ - private: - gr_simple_framer (int payload_bytesize); -}; diff --git a/gnuradio-core/src/lib/general/gri_glfsr.cc b/gnuradio-core/src/lib/general/gri_glfsr.cc deleted file mode 100644 index ba6951882b..0000000000 --- a/gnuradio-core/src/lib/general/gri_glfsr.cc +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 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 <gri_glfsr.h> -#include <stdexcept> - -static int s_polynomial_masks[] = { - 0x00000000, - 0x00000001, // x^1 + 1 - 0x00000003, // x^2 + x^1 + 1 - 0x00000005, // x^3 + x^1 + 1 - 0x00000009, // x^4 + x^1 + 1 - 0x00000012, // x^5 + x^2 + 1 - 0x00000021, // x^6 + x^1 + 1 - 0x00000041, // x^7 + x^1 + 1 - 0x0000008E, // x^8 + x^4 + x^3 + x^2 + 1 - 0x00000108, // x^9 + x^4 + 1 - 0x00000204, // x^10 + x^4 + 1 - 0x00000402, // x^11 + x^2 + 1 - 0x00000829, // x^12 + x^6 + x^4 + x^1 + 1 - 0x0000100D, // x^13 + x^4 + x^3 + x^1 + 1 - 0x00002015, // x^14 + x^5 + x^3 + x^1 + 1 - 0x00004001, // x^15 + x^1 + 1 - 0x00008016, // x^16 + x^5 + x^3 + x^2 + 1 - 0x00010004, // x^17 + x^3 + 1 - 0x00020013, // x^18 + x^5 + x^2 + x^1 + 1 - 0x00040013, // x^19 + x^5 + x^2 + x^1 + 1 - 0x00080004, // x^20 + x^3 + 1 - 0x00100002, // x^21 + x^2 + 1 - 0x00200001, // x^22 + x^1 + 1 - 0x00400010, // x^23 + x^5 + 1 - 0x0080000D, // x^24 + x^4 + x^3 + x^1 + 1 - 0x01000004, // x^25 + x^3 + 1 - 0x02000023, // x^26 + x^6 + x^2 + x^1 + 1 - 0x04000013, // x^27 + x^5 + x^2 + x^1 + 1 - 0x08000004, // x^28 + x^3 + 1 - 0x10000002, // x^29 + x^2 + 1 - 0x20000029, // x^30 + x^4 + x^1 + 1 - 0x40000004, // x^31 + x^3 + 1 - 0x80000057 // x^32 + x^7 + x^5 + x^3 + x^2 + x^1 + 1 -}; - -int gri_glfsr::glfsr_mask(int degree) -{ - if (degree < 1 || degree > 32) - throw std::runtime_error("gri_glfsr::glfsr_mask(): degree must be between 1 and 32 inclusive"); - return s_polynomial_masks[degree]; -} diff --git a/gnuradio-core/src/lib/general/gri_glfsr.h b/gnuradio-core/src/lib/general/gri_glfsr.h deleted file mode 100644 index 9aae2d9f17..0000000000 --- a/gnuradio-core/src/lib/general/gri_glfsr.h +++ /dev/null @@ -1,57 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifndef INCLUDED_GRI_GLFSR_H -#define INCLUDED_GRI_GLFSR_H - -#include <gr_core_api.h> - -/*! - * \brief Galois Linear Feedback Shift Register using specified polynomial mask - * \ingroup misc - * - * Generates a maximal length pseudo-random sequence of length 2^degree-1 - */ - -class GR_CORE_API gri_glfsr -{ - private: - int d_shift_register; - int d_mask; - - public: - - gri_glfsr(int mask, int seed) { d_shift_register = seed; d_mask = mask; } - static int glfsr_mask(int degree); - - unsigned char next_bit() { - unsigned char bit = d_shift_register & 1; - d_shift_register >>= 1; - if (bit) - d_shift_register ^= d_mask; - return bit; - } - - int mask() const { return d_mask; } -}; - -#endif /* INCLUDED_GRI_GLFSR_H */
\ No newline at end of file diff --git a/gnuradio-core/src/lib/general/qa_general.cc b/gnuradio-core/src/lib/general/qa_general.cc index 26b21983e6..61e5c159bd 100644 --- a/gnuradio-core/src/lib/general/qa_general.cc +++ b/gnuradio-core/src/lib/general/qa_general.cc @@ -33,7 +33,6 @@ #include <qa_gr_fxpt_nco.h> #include <qa_gr_fxpt_vco.h> #include <qa_gr_math.h> -#include <qa_gri_lfsr.h> CppUnit::TestSuite * qa_general::suite () @@ -47,7 +46,6 @@ qa_general::suite () s->addTest (qa_gr_fxpt_nco::suite ()); s->addTest (qa_gr_fxpt_vco::suite ()); s->addTest (qa_gr_math::suite ()); - s->addTest (qa_gri_lfsr::suite ()); return s; } diff --git a/gnuradio-core/src/lib/general/qa_gri_lfsr.cc b/gnuradio-core/src/lib/general/qa_gri_lfsr.cc deleted file mode 100644 index 87d610df68..0000000000 --- a/gnuradio-core/src/lib/general/qa_gri_lfsr.cc +++ /dev/null @@ -1,142 +0,0 @@ -/* - * 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. - */ - -#include <gri_lfsr.h> -#include <qa_gri_lfsr.h> -#include <cppunit/TestAssert.h> -#include <stdio.h> -#include <string.h> -#include <vector> - -void -qa_gri_lfsr::test_lfsr () -{ - int mask = 0x19; - int seed = 0x01; - int length = 5; - - gri_lfsr lfsr1(mask,seed,length); - gri_lfsr lfsr2(mask,seed,length); - - unsigned char expected[] = {1, 0, 1, 1, 0, 1, 0, 1, 0, 0}; - - for(unsigned int i=0; i<31; i++){ - lfsr1.next_bit(); - } - - // test that after one lfsr cycle we still match out uncycled lfsr - for (unsigned int i = 0; i < 41; i++) { - CPPUNIT_ASSERT_EQUAL((int) lfsr1.next_bit(), (int) lfsr2.next_bit()); - } - - // test the known correct values at the given shift offset - for(unsigned int i=0; i<10; i++){ - CPPUNIT_ASSERT_EQUAL((int) lfsr1.next_bit(), (int) expected[i]); - } - - // test for register length too long - CPPUNIT_ASSERT_THROW(gri_lfsr(mask, seed, 32), std::invalid_argument); -} - -void -qa_gri_lfsr::test_scrambler() -{ - // CCSDS 7-bit scrambler - int mask = 0x8A; - int seed = 0x7F; - int length = 7; - - gri_lfsr scrambler(mask, seed, length); - - // Impulse (1 and 126 more zeroes) - unsigned char src[] = - { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0 }; // flush bits - - // Impulse response (including leading bits) - unsigned char expected[] = - { 1, 1, 1, 1, 1, 1, 1, - 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, - 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, - 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, - 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, - 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, - 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, - 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, - 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, }; - - int len = sizeof(src); - std::vector<unsigned char> actual(len); - - for (int i = 0; i < len; i++) - actual[i] = scrambler.next_bit_scramble(src[i]); - - CPPUNIT_ASSERT(memcmp(expected, &actual[0], len) == 0); -} - -void -qa_gri_lfsr::test_descrambler() -{ - // CCSDS 7-bit scrambler - int mask = 0x8A; - int seed = 0x7F; - int length = 7; - - gri_lfsr descrambler(mask, seed, length); - - // Scrambled sequence (impulse response) - unsigned char src[] = - { 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, - 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, - 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, - 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, - 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, - 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, - 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, - 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0 }; - - // Original (garbage while synchronizing, them impulse) - unsigned char expected[] = - { 0, 1, 0, 0, 1, 0, - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - - int len = sizeof(src); - std::vector<unsigned char> actual(len); - - for (int i = 0; i < len; i++) - actual[i] = descrambler.next_bit_descramble(src[i]); - - CPPUNIT_ASSERT(memcmp(expected, &actual[0], len) == 0); -} diff --git a/gnuradio-core/src/lib/general/qa_gri_lfsr.h b/gnuradio-core/src/lib/general/qa_gri_lfsr.h deleted file mode 100644 index e91843bbb3..0000000000 --- a/gnuradio-core/src/lib/general/qa_gri_lfsr.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- c++ -*- */ -/* - * 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. - */ -#ifndef _QA_GRI_LFSR_H_ -#define _QA_GRI_LFSR_H_ - -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/TestCase.h> - -class qa_gri_lfsr : public CppUnit::TestCase { - - CPPUNIT_TEST_SUITE(qa_gri_lfsr); - CPPUNIT_TEST(test_lfsr); - CPPUNIT_TEST(test_scrambler); - CPPUNIT_TEST(test_descrambler); - CPPUNIT_TEST_SUITE_END(); - - private: - void test_lfsr(); - void test_scrambler(); - void test_descrambler(); -}; - -#endif /* _QA_GRI_LFSR_H_ */ diff --git a/gnuradio-core/src/lib/gengen/CMakeLists.txt b/gnuradio-core/src/lib/gengen/CMakeLists.txt index b44a470750..ed49cf07e5 100644 --- a/gnuradio-core/src/lib/gengen/CMakeLists.txt +++ b/gnuradio-core/src/lib/gengen/CMakeLists.txt @@ -101,7 +101,6 @@ expand_h_cc_i(gr_multiply_const_vXX ss ii ff cc) expand_h_cc_i(gr_integrate_XX ss ii ff cc) expand_h_cc_i(gr_moving_average_XX ss ii ff cc) -expand_h_cc_i(gr_chunks_to_symbols_XX bf bc sf sc if ic) expand_h_cc_i(gr_unpacked_to_packed_XX bb ss ii) expand_h_cc_i(gr_packed_to_unpacked_XX bb ss ii) expand_h_cc_i(gr_xor_XX bb ss ii) diff --git a/gnuradio-core/src/lib/gengen/generate_common.py b/gnuradio-core/src/lib/gengen/generate_common.py index 13d01b0f90..37d8944f5b 100755 --- a/gnuradio-core/src/lib/gengen/generate_common.py +++ b/gnuradio-core/src/lib/gengen/generate_common.py @@ -54,7 +54,6 @@ reg_roots = [ # other blocks others = ( - ('gr_chunks_to_symbols_XX', ('bf', 'bc', 'sf', 'sc', 'if', 'ic')), ('gr_unpacked_to_packed_XX', ('bb','ss','ii')), ('gr_packed_to_unpacked_XX', ('bb','ss','ii')), ('gr_xor_XX', ('bb','ss','ii')), diff --git a/gnuradio-core/src/lib/gengen/gr_chunks_to_symbols_XX.cc.t b/gnuradio-core/src/lib/gengen/gr_chunks_to_symbols_XX.cc.t deleted file mode 100644 index 4a642c13e2..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_chunks_to_symbols_XX.cc.t +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2010 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. - */ - -// @WARNING@ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <@NAME@.h> -#include <gr_io_signature.h> -#include <assert.h> -#include <iostream> -#include <string.h> - -@SPTR_NAME@ -gr_make_@BASE_NAME@ (const std::vector<@O_TYPE@> &symbol_table, const int D) -{ - return gnuradio::get_initial_sptr (new @NAME@ (symbol_table,D)); -} - -@NAME@::@NAME@ (const std::vector<@O_TYPE@> &symbol_table, const int D) - : gr_sync_interpolator ("@BASE_NAME@", - gr_make_io_signature (1, -1, sizeof (@I_TYPE@)), - gr_make_io_signature (1, -1, sizeof (@O_TYPE@)), - D), - d_D (D), - d_symbol_table (symbol_table) -{ -} - -int -@NAME@::work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) -{ - assert (noutput_items % d_D == 0); - assert (input_items.size() == output_items.size()); - int nstreams = input_items.size(); - - for (int m=0;m<nstreams;m++) { - const @I_TYPE@ *in = (@I_TYPE@ *) input_items[m]; - @O_TYPE@ *out = (@O_TYPE@ *) output_items[m]; - - // per stream processing - for (int i = 0; i < noutput_items / d_D; i++){ - assert (((unsigned int)in[i]*d_D+d_D) <= d_symbol_table.size()); - memcpy(out, &d_symbol_table[(unsigned int)in[i]*d_D], d_D*sizeof(@O_TYPE@)); - out+=d_D; - } - // end of per stream processing - - } - return noutput_items; -} diff --git a/gnuradio-core/src/lib/gengen/gr_chunks_to_symbols_XX.h.t b/gnuradio-core/src/lib/gengen/gr_chunks_to_symbols_XX.h.t deleted file mode 100644 index 17d5688b86..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_chunks_to_symbols_XX.h.t +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 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. - */ - -// @WARNING@ - -#ifndef @GUARD_NAME@ -#define @GUARD_NAME@ - -#include <gr_core_api.h> -#include <gr_sync_interpolator.h> - -class @NAME@; -typedef boost::shared_ptr<@NAME@> @SPTR_NAME@; - -GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@O_TYPE@> &symbol_table, const int D = 1); - -/*! - * \brief Map a stream of symbol indexes (unpacked bytes or shorts) to stream of float or complex onstellation points.in \p D dimensions (\p D = 1 by default) - * \ingroup converter_blk - * - * input: stream of @I_TYPE@; output: stream of @O_TYPE@ - * - * out[n D + k] = symbol_table[in[n] D + k], k=0,1,...,D-1 - * - * The combination of gr_packed_to_unpacked_XX followed by - * gr_chunks_to_symbols_XY handles the general case of mapping - * from a stream of bytes or shorts into arbitrary float - * or complex symbols. - * - * \sa gr_packed_to_unpacked_bb, gr_unpacked_to_packed_bb, - * \sa gr_packed_to_unpacked_ss, gr_unpacked_to_packed_ss, - * \sa gr_chunks_to_symbols_bf, gr_chunks_to_symbols_bc. - * \sa gr_chunks_to_symbols_sf, gr_chunks_to_symbols_sc. - */ - -class GR_CORE_API @NAME@ : public gr_sync_interpolator -{ - friend GR_CORE_API @SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@O_TYPE@> &symbol_table, const int D); - - int d_D; - std::vector<@O_TYPE@> d_symbol_table; - @NAME@ (const std::vector<@O_TYPE@> &symbol_table, const int D = 1); - - public: - int D () const { return d_D; } - std::vector<@O_TYPE@> symbol_table () const { return d_symbol_table; } - int work (int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); - - bool check_topology(int ninputs, int noutputs) { return ninputs == noutputs; } -}; - -#endif diff --git a/gnuradio-core/src/lib/gengen/gr_chunks_to_symbols_XX.i.t b/gnuradio-core/src/lib/gengen/gr_chunks_to_symbols_XX.i.t deleted file mode 100644 index 14c8be4863..0000000000 --- a/gnuradio-core/src/lib/gengen/gr_chunks_to_symbols_XX.i.t +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 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. - */ - -// @WARNING@ - -GR_SWIG_BLOCK_MAGIC(gr,@BASE_NAME@); - -@SPTR_NAME@ gr_make_@BASE_NAME@ (const std::vector<@O_TYPE@> &symbol_table, const int D = 1); - -class @NAME@ : public gr_sync_interpolator -{ -private: - @NAME@ (const std::vector<@O_TYPE@> &symbol_table, const int D = 1); - -public: - int D () const { return d_D; } - std::vector<@O_TYPE@> symbol_table () const { return d_symbol_table; } -}; diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_diff_encoder.py b/gnuradio-core/src/python/gnuradio/gr/qa_diff_encoder.py deleted file mode 100755 index c1fe2a7000..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_diff_encoder.py +++ /dev/null @@ -1,86 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2006,2007,2010 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 -import math -import random - -def make_random_int_tuple(L, min, max): - result = [] - for x in range(L): - result.append(random.randint(min, max)) - return tuple(result) - - -class test_diff_encoder (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test_diff_encdec_000(self): - random.seed(0) - modulus = 2 - src_data = make_random_int_tuple(1000, 0, modulus-1) - expected_result = src_data - src = gr.vector_source_b(src_data) - enc = gr.diff_encoder_bb(modulus) - dec = gr.diff_decoder_bb(modulus) - dst = gr.vector_sink_b() - self.tb.connect(src, enc, dec, dst) - self.tb.run() # run the graph and wait for it to finish - actual_result = dst.data() # fetch the contents of the sink - self.assertEqual(expected_result, actual_result) - - def test_diff_encdec_001(self): - random.seed(0) - modulus = 4 - src_data = make_random_int_tuple(1000, 0, modulus-1) - expected_result = src_data - src = gr.vector_source_b(src_data) - enc = gr.diff_encoder_bb(modulus) - dec = gr.diff_decoder_bb(modulus) - dst = gr.vector_sink_b() - self.tb.connect(src, enc, dec, dst) - self.tb.run() # run the graph and wait for it to finish - actual_result = dst.data() # fetch the contents of the sink - self.assertEqual(expected_result, actual_result) - - def test_diff_encdec_002(self): - random.seed(0) - modulus = 8 - src_data = make_random_int_tuple(40000, 0, modulus-1) - expected_result = src_data - src = gr.vector_source_b(src_data) - enc = gr.diff_encoder_bb(modulus) - dec = gr.diff_decoder_bb(modulus) - dst = gr.vector_sink_b() - self.tb.connect(src, enc, dec, dst) - self.tb.run() # run the graph and wait for it to finish - actual_result = dst.data() # fetch the contents of the sink - self.assertEqual(expected_result, actual_result) - -if __name__ == '__main__': - gr_unittest.run(test_diff_encoder, "test_diff_encoder.xml") - diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_diff_phasor_cc.py b/gnuradio-core/src/python/gnuradio/gr/qa_diff_phasor_cc.py deleted file mode 100755 index 41f96aa616..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_diff_phasor_cc.py +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2007,2010 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 -import math - -class test_diff_phasor (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test_diff_phasor_cc (self): - src_data = (0+0j, 1+0j, -1+0j, 3+4j, -3-4j, -3+4j) - expected_result = (0+0j, 0+0j, -1+0j, -3-4j, -25+0j, -7-24j) - src = gr.vector_source_c (src_data) - op = gr.diff_phasor_cc () - dst = gr.vector_sink_c () - self.tb.connect (src, op) - self.tb.connect (op, dst) - self.tb.run () # run the graph and wait for it to finish - actual_result = dst.data () # fetch the contents of the sink - self.assertComplexTuplesAlmostEqual (expected_result, actual_result) - - - -if __name__ == '__main__': - gr_unittest.run(test_diff_phasor, "test_diff_phasor.xml") - diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_fsk_stuff.py b/gnuradio-core/src/python/gnuradio/gr/qa_fsk_stuff.py deleted file mode 100755 index 95b8c06641..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_fsk_stuff.py +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2004,2007,2010 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 -import math - -def sincos(x): - return math.cos(x) + math.sin(x) * 1j - -class test_bytes_to_syms (gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test_bytes_to_syms_001 (self): - src_data = (0x01, 0x80, 0x03) - expected_result = (-1, -1, -1, -1, -1, -1, -1, +1, - +1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, +1, +1) - src = gr.vector_source_b (src_data) - op = gr.bytes_to_syms () - dst = gr.vector_sink_f () - self.tb.connect (src, op) - self.tb.connect (op, dst) - self.tb.run () - result_data = dst.data () - self.assertEqual (expected_result, result_data) - - def test_simple_framer (self): - src_data = (0x00, 0x11, 0x22, 0x33, - 0x44, 0x55, 0x66, 0x77, - 0x88, 0x99, 0xaa, 0xbb, - 0xcc, 0xdd, 0xee, 0xff) - - expected_result = ( - 0xac, 0xdd, 0xa4, 0xe2, 0xf2, 0x8c, 0x20, 0xfc, 0x00, 0x00, 0x11, 0x22, 0x33, 0x55, - 0xac, 0xdd, 0xa4, 0xe2, 0xf2, 0x8c, 0x20, 0xfc, 0x01, 0x44, 0x55, 0x66, 0x77, 0x55, - 0xac, 0xdd, 0xa4, 0xe2, 0xf2, 0x8c, 0x20, 0xfc, 0x02, 0x88, 0x99, 0xaa, 0xbb, 0x55, - 0xac, 0xdd, 0xa4, 0xe2, 0xf2, 0x8c, 0x20, 0xfc, 0x03, 0xcc, 0xdd, 0xee, 0xff, 0x55) - - src = gr.vector_source_b (src_data) - op = gr.simple_framer (4) - dst = gr.vector_sink_b () - self.tb.connect (src, op) - self.tb.connect (op, dst) - self.tb.run () - result_data = dst.data () - self.assertEqual (expected_result, result_data) - - -if __name__ == '__main__': - gr_unittest.run(test_bytes_to_syms, "test_bytes_to_syms.xml") - diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_glfsr_source.py b/gnuradio-core/src/python/gnuradio/gr/qa_glfsr_source.py deleted file mode 100755 index 161e4a5cc1..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_glfsr_source.py +++ /dev/null @@ -1,94 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2007,2010 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 - -class test_glfsr_source(gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block () - - def tearDown (self): - self.tb = None - - def test_000_make_b(self): - src = gr.glfsr_source_b(16) - self.assertEquals(src.mask(), 0x8016) - self.assertEquals(src.period(), 2**16-1) - - def test_001_degree_b(self): - self.assertRaises(RuntimeError, - lambda: gr.glfsr_source_b(0)) - self.assertRaises(RuntimeError, - lambda: gr.glfsr_source_b(33)) - - def test_002_correlation_b(self): - for degree in range(1,11): # Higher degrees take too long to correlate - src = gr.glfsr_source_b(degree, False) - b2f = gr.chunks_to_symbols_bf((-1.0,1.0), 1) - dst = gr.vector_sink_f() - del self.tb # Discard existing top block - self.tb = gr.top_block() - self.tb.connect(src, b2f, dst) - self.tb.run() - self.tb.disconnect_all() - actual_result = dst.data() - R = auto_correlate(actual_result) - self.assertEqual(R[0], float(len(R))) # Auto-correlation peak at origin - for i in range(len(R)-1): - self.assertEqual(R[i+1], -1.0) # Auto-correlation minimum everywhere else - - def test_003_make_f(self): - src = gr.glfsr_source_f(16) - self.assertEquals(src.mask(), 0x8016) - self.assertEquals(src.period(), 2**16-1) - - def test_004_degree_f(self): - self.assertRaises(RuntimeError, - lambda: gr.glfsr_source_f(0)) - self.assertRaises(RuntimeError, - lambda: gr.glfsr_source_f(33)) - def test_005_correlation_f(self): - for degree in range(1,11): # Higher degrees take too long to correlate - src = gr.glfsr_source_f(degree, False) - dst = gr.vector_sink_f() - del self.tb # Discard existing top block - self.tb = gr.top_block() - self.tb.connect(src, dst) - self.tb.run() - - actual_result = dst.data() - R = auto_correlate(actual_result) - self.assertEqual(R[0], float(len(R))) # Auto-correlation peak at origin - for i in range(len(R)-1): - self.assertEqual(R[i+1], -1.0) # Auto-correlation minimum everywhere else - -def auto_correlate(data): - l = len(data) - R = [0,]*l - for lag in range(l): - for i in range(l): - R[lag] += data[i]*data[i-lag] - return R - -if __name__ == '__main__': - gr_unittest.run(test_glfsr_source, "test_glfsr_source.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_pn_correlator_cc.py b/gnuradio-core/src/python/gnuradio/gr/qa_pn_correlator_cc.py deleted file mode 100755 index 6a62a6997b..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_pn_correlator_cc.py +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2007,2010 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 - -class test_pn_correlator_cc(gr_unittest.TestCase): - - def setUp(self): - self.tb = gr.top_block () - - def tearDown(self): - self.tb = None - - def test_000_make(self): - c = gr.pn_correlator_cc(10) - - def test_001_correlate(self): - degree = 10 - length = 2**degree-1 - src = gr.glfsr_source_f(degree) - head = gr.head(gr.sizeof_float, length*length) - f2c = gr.float_to_complex() - corr = gr.pn_correlator_cc(degree) - dst = gr.vector_sink_c() - self.tb.connect(src, head, f2c, corr, dst) - self.tb.run() - data = dst.data() - self.assertEqual(data[-1], (1.0+0j)) - -if __name__ == '__main__': - gr_unittest.run(test_pn_correlator_cc, "test_pn_correlator_cc.xml") diff --git a/gnuradio-core/src/python/gnuradio/gr/qa_scrambler.py b/gnuradio-core/src/python/gnuradio/gr/qa_scrambler.py deleted file mode 100755 index 5fe89bdc7f..0000000000 --- a/gnuradio-core/src/python/gnuradio/gr/qa_scrambler.py +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2008,2010 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 - -class test_scrambler(gr_unittest.TestCase): - - def setUp (self): - self.tb = gr.top_block() - - def tearDown(self): - self.tb = None - - def test_scrambler_descrambler(self): - src_data = (1,)*1000 - src = gr.vector_source_b(src_data, False) - scrambler = gr.scrambler_bb(0x8a, 0x7F, 7) # CCSDS 7-bit scrambler - descrambler = gr.descrambler_bb(0x8a, 0x7F, 7) - dst = gr.vector_sink_b() - self.tb.connect(src, scrambler, descrambler, dst) - self.tb.run() - self.assertEqual(tuple(src_data[:-8]), dst.data()[8:]) # skip garbage during synchronization - - def test_additive_scrambler(self): - src_data = (1,)*1000 - src = gr.vector_source_b(src_data, False) - scrambler = gr.additive_scrambler_bb(0x8a, 0x7f, 7) - descrambler = gr.additive_scrambler_bb(0x8a, 0x7f, 7) - dst = gr.vector_sink_b() - self.tb.connect(src, scrambler, descrambler, dst) - self.tb.run() - self.assertEqual(src_data, dst.data()) - - def test_additive_scrambler_reset(self): - src_data = (1,)*1000 - src = gr.vector_source_b(src_data, False) - scrambler = gr.additive_scrambler_bb(0x8a, 0x7f, 7, 100) - descrambler = gr.additive_scrambler_bb(0x8a, 0x7f, 7, 100) - dst = gr.vector_sink_b() - self.tb.connect(src, scrambler, descrambler, dst) - self.tb.run() - self.assertEqual(src_data, dst.data()) - -if __name__ == '__main__': - gr_unittest.run(test_scrambler, "test_scrambler.xml") diff --git a/gr-audio/examples/python/noise.py b/gr-audio/examples/python/noise.py index 12eee1906d..bba9e83eae 100755 --- a/gr-audio/examples/python/noise.py +++ b/gr-audio/examples/python/noise.py @@ -22,6 +22,7 @@ from gnuradio import gr from gnuradio import audio +from gnuradio import digital from gnuradio.eng_option import eng_option from optparse import OptionParser @@ -44,7 +45,7 @@ class my_top_block(gr.top_block): ampl = 0.1 src = gr.glfsr_source_b(32) # Pseudorandom noise source - b2f = gr.chunks_to_symbols_bf([ampl, -ampl], 1) + b2f = digital.chunks_to_symbols_bf([ampl, -ampl], 1) dst = audio.sink(sample_rate, options.audio_output) self.connect(src, b2f, dst) diff --git a/gr-digital/examples/narrowband/digital_bert_rx.py b/gr-digital/examples/narrowband/digital_bert_rx.py index ab7e988eba..daefc5116d 100755 --- a/gr-digital/examples/narrowband/digital_bert_rx.py +++ b/gr-digital/examples/narrowband/digital_bert_rx.py @@ -78,10 +78,10 @@ class bert_receiver(gr.hier_block2): self.connect(self._demod.time_recov, self._snr_probe) # Descramble BERT sequence. A channel error will create 3 incorrect bits - self._descrambler = gr.descrambler_bb(0x8A, 0x7F, 7) # CCSDS 7-bit descrambler + self._descrambler = digital.descrambler_bb(0x8A, 0x7F, 7) # CCSDS 7-bit descrambler # Measure BER by the density of 0s in the stream - self._ber = gr.probe_density_b(1.0/self._symbol_rate) + self._ber = digital.probe_density_b(1.0/self._symbol_rate) self.connect(self, self._demod, self._descrambler, self._ber) diff --git a/gr-digital/examples/narrowband/digital_bert_tx.py b/gr-digital/examples/narrowband/digital_bert_tx.py index f29e997af6..7caccdf42b 100755 --- a/gr-digital/examples/narrowband/digital_bert_tx.py +++ b/gr-digital/examples/narrowband/digital_bert_tx.py @@ -43,7 +43,7 @@ class bert_transmit(gr.hier_block2): # Create BERT data bit stream self._bits = gr.vector_source_b([1,], True) # Infinite stream of ones - self._scrambler = gr.scrambler_bb(0x8A, 0x7F, 7) # CCSDS 7-bit scrambler + self._scrambler = digital.scrambler_bb(0x8A, 0x7F, 7) # CCSDS 7-bit scrambler self._mod = digital.generic_mod(constellation, samples_per_symbol, differential, excess_bw, gray_coded, diff --git a/gr-digital/grc/digital_dxpsk_demod.xml b/gr-digital/grc/digital_dxpsk_demod.xml index 6366596d91..35704eeb67 100644 --- a/gr-digital/grc/digital_dxpsk_demod.xml +++ b/gr-digital/grc/digital_dxpsk_demod.xml @@ -23,7 +23,7 @@ <!-- ################################################### -##DPSK2 Mod - 2, 4, 8 +##DPSK2 Mod - 2, 4 ################################################### --> <block> @@ -94,7 +94,6 @@ <param> <name>Gray Code</name> <key>mod_code</key> - <value>True</value> <type>enum</type> <option> <name>Yes</name> diff --git a/gr-digital/grc/digital_dxpsk_mod.xml b/gr-digital/grc/digital_dxpsk_mod.xml index 58e30436df..060edb9081 100644 --- a/gr-digital/grc/digital_dxpsk_mod.xml +++ b/gr-digital/grc/digital_dxpsk_mod.xml @@ -23,7 +23,7 @@ <!-- ################################################### -## DPSK Mod - 2, 4, 8 +## DPSK Mod - 2, 4 ################################################### --> <block> @@ -49,10 +49,6 @@ <name>DQPSK</name> <key>dqpsk</key> </option> - <option> - <name>D8PSK</name> - <key>d8psk</key> - </option> </param> <param> <name>Samples/Symbol</name> diff --git a/gr-digital/grc/digital_simple_framer.xml b/gr-digital/grc/digital_simple_framer.xml index bbeed32d3e..2d57222f3b 100644 --- a/gr-digital/grc/digital_simple_framer.xml +++ b/gr-digital/grc/digital_simple_framer.xml @@ -7,8 +7,8 @@ <block> <name>Simple Framer</name> <key>digital_simple_framer</key> - <import>from gnuradio import gr</import> - <make>gr.simple_framer($payload_bytesize)</make> + <import>from gnuradio import digital</import> + <make>digital.simple_framer($payload_bytesize)</make> <param> <name>Payload Byte Size</name> <key>payload_bytesize</key> diff --git a/gr-digital/include/digital_bytes_to_syms.h b/gr-digital/include/digital_bytes_to_syms.h index 3062366b95..c1857c8cf2 100644 --- a/gr-digital/include/digital_bytes_to_syms.h +++ b/gr-digital/include/digital_bytes_to_syms.h @@ -39,12 +39,12 @@ DIGITAL_API digital_bytes_to_syms_sptr digital_make_bytes_to_syms(); * This block is deprecated. * * The combination of gr_packed_to_unpacked_bb followed by - * gr_chunks_to_symbols_bf or gr_chunks_to_symbols_bc handles the + * digital_chunks_to_symbols_bf or digital_chunks_to_symbols_bc handles the * general case of mapping from a stream of bytes into arbitrary float * or complex symbols. * * \sa gr_packed_to_unpacked_bb, gr_unpacked_to_packed_bb, - * \sa gr_chunks_to_symbols_bf, gr_chunks_to_symbols_bc. + * \sa digital_chunks_to_symbols_bf, digital_chunks_to_symbols_bc. */ class DIGITAL_API digital_bytes_to_syms : public gr_sync_interpolator { diff --git a/gr-digital/include/digital_chunks_to_symbols_XX.h.t b/gr-digital/include/digital_chunks_to_symbols_XX.h.t index 92b7c94d58..3a82c68070 100644 --- a/gr-digital/include/digital_chunks_to_symbols_XX.h.t +++ b/gr-digital/include/digital_chunks_to_symbols_XX.h.t @@ -43,7 +43,7 @@ digital_make_@BASE_NAME@ (const std::vector<@O_TYPE@> &symbol_table, const int D * out[n D + k] = symbol_table[in[n] D + k], k=0,1,...,D-1 * * The combination of gr_packed_to_unpacked_XX followed by - * gr_chunks_to_symbols_XY handles the general case of mapping + * digital_chunks_to_symbols_XY handles the general case of mapping * from a stream of bytes or shorts into arbitrary float * or complex symbols. * diff --git a/gr-digital/include/digital_framer_sink_1.h b/gr-digital/include/digital_framer_sink_1.h index bb82bf5a73..51d872d874 100644 --- a/gr-digital/include/digital_framer_sink_1.h +++ b/gr-digital/include/digital_framer_sink_1.h @@ -37,7 +37,7 @@ digital_make_framer_sink_1(gr_msg_queue_sptr target_queue); * \brief Given a stream of bits and access_code flags, assemble packets. * \ingroup sink_blk * - * input: stream of bytes from gr_correlate_access_code_bb + * input: stream of bytes from digital_correlate_access_code_bb * output: none. Pushes assembled packet into target queue * * The framer expects a fixed length header of 2 16-bit shorts diff --git a/gr-digital/include/digital_glfsr_source_b.h b/gr-digital/include/digital_glfsr_source_b.h index 92e5e81f5c..151e5a296c 100644 --- a/gr-digital/include/digital_glfsr_source_b.h +++ b/gr-digital/include/digital_glfsr_source_b.h @@ -26,7 +26,7 @@ #include <digital_api.h> #include <gr_sync_block.h> -class gri_glfsr; +class digital_impl_glfsr; class digital_glfsr_source_b; typedef boost::shared_ptr<digital_glfsr_source_b> digital_glfsr_source_b_sptr; @@ -54,7 +54,7 @@ class DIGITAL_API digital_glfsr_source_b : public gr_sync_block digital_make_glfsr_source_b(int degree, bool repeat, int mask, int seed); - gri_glfsr *d_glfsr; + digital_impl_glfsr *d_glfsr; bool d_repeat; unsigned int d_index; diff --git a/gr-digital/include/digital_glfsr_source_f.h b/gr-digital/include/digital_glfsr_source_f.h index 77d7b0f741..fb5b064e4f 100644 --- a/gr-digital/include/digital_glfsr_source_f.h +++ b/gr-digital/include/digital_glfsr_source_f.h @@ -26,7 +26,7 @@ #include <digital_api.h> #include <gr_sync_block.h> -class gri_glfsr; +class digital_impl_glfsr; class digital_glfsr_source_f; typedef boost::shared_ptr<digital_glfsr_source_f> digital_glfsr_source_f_sptr; @@ -54,7 +54,7 @@ class DIGITAL_API digital_glfsr_source_f : public gr_sync_block digital_make_glfsr_source_f(int degree, bool repeat, int mask, int seed); - gri_glfsr *d_glfsr; + digital_impl_glfsr *d_glfsr; bool d_repeat; unsigned int d_index; diff --git a/gr-digital/include/digital_pn_correlator_cc.h b/gr-digital/include/digital_pn_correlator_cc.h index 87cc2ff93c..407cc1e67b 100644 --- a/gr-digital/include/digital_pn_correlator_cc.h +++ b/gr-digital/include/digital_pn_correlator_cc.h @@ -25,7 +25,7 @@ #include <digital_api.h> #include <gr_sync_decimator.h> -#include <gri_glfsr.h> +#include <digital_impl_glfsr.h> class digital_pn_correlator_cc; typedef boost::shared_ptr<digital_pn_correlator_cc> digital_pn_correlator_cc_sptr; @@ -56,7 +56,7 @@ class DIGITAL_API digital_pn_correlator_cc : public gr_sync_decimator int d_len; float d_pn; - gri_glfsr *d_reference; + digital_impl_glfsr *d_reference; protected: digital_pn_correlator_cc(int degree, int mask, int seed); diff --git a/gr-digital/lib/digital_constellation.cc b/gr-digital/lib/digital_constellation.cc index d9a53c4930..383c73c30d 100644 --- a/gr-digital/lib/digital_constellation.cc +++ b/gr-digital/lib/digital_constellation.cc @@ -466,8 +466,8 @@ digital_make_constellation_dqpsk() digital_constellation_dqpsk::digital_constellation_dqpsk () { // This constellation is not gray coded, which allows - // us to use differential encodings (through gr_diff_encode and - // gr_diff_decode) on the symbols. + // us to use differential encodings (through digital_diff_encode and + // digital_diff_decode) on the symbols. d_constellation.resize(4); d_constellation[0] = gr_complex(+SQRT_TWO, +SQRT_TWO); d_constellation[1] = gr_complex(-SQRT_TWO, +SQRT_TWO); diff --git a/gr-digital/lib/digital_glfsr_source_b.cc b/gr-digital/lib/digital_glfsr_source_b.cc index e557e475a8..63a5ffdb0a 100644 --- a/gr-digital/lib/digital_glfsr_source_b.cc +++ b/gr-digital/lib/digital_glfsr_source_b.cc @@ -26,7 +26,7 @@ #endif #include <digital_glfsr_source_b.h> -#include <gri_glfsr.h> +#include <digital_impl_glfsr.h> #include <gr_io_signature.h> #include <stdexcept> @@ -50,8 +50,8 @@ digital_glfsr_source_b::digital_glfsr_source_b(int degree, bool repeat, d_length = (unsigned int)((1ULL << degree)-1); if (mask == 0) - mask = gri_glfsr::glfsr_mask(degree); - d_glfsr = new gri_glfsr(mask, seed); + mask = digital_impl_glfsr::glfsr_mask(degree); + d_glfsr = new digital_impl_glfsr(mask, seed); } digital_glfsr_source_b::~digital_glfsr_source_b() diff --git a/gr-digital/lib/digital_glfsr_source_f.cc b/gr-digital/lib/digital_glfsr_source_f.cc index 5a7736ef8d..6ae84d5679 100644 --- a/gr-digital/lib/digital_glfsr_source_f.cc +++ b/gr-digital/lib/digital_glfsr_source_f.cc @@ -26,7 +26,7 @@ #endif #include <digital_glfsr_source_f.h> -#include <gri_glfsr.h> +#include <digital_impl_glfsr.h> #include <gr_io_signature.h> #include <stdexcept> @@ -50,8 +50,8 @@ digital_glfsr_source_f::digital_glfsr_source_f(int degree, bool repeat, d_length = (unsigned int)((1ULL << degree)-1); if (mask == 0) - mask = gri_glfsr::glfsr_mask(degree); - d_glfsr = new gri_glfsr(mask, seed); + mask = digital_impl_glfsr::glfsr_mask(degree); + d_glfsr = new digital_impl_glfsr(mask, seed); } digital_glfsr_source_f::~digital_glfsr_source_f() diff --git a/gr-digital/lib/digital_pn_correlator_cc.cc b/gr-digital/lib/digital_pn_correlator_cc.cc index 43a3ddbd1f..52e06bc2ad 100644 --- a/gr-digital/lib/digital_pn_correlator_cc.cc +++ b/gr-digital/lib/digital_pn_correlator_cc.cc @@ -44,8 +44,8 @@ digital_pn_correlator_cc::digital_pn_correlator_cc(int degree, { d_len = (unsigned int)((1ULL << degree)-1); if (mask == 0) - mask = gri_glfsr::glfsr_mask(degree); - d_reference = new gri_glfsr(mask, seed); + mask = digital_impl_glfsr::glfsr_mask(degree); + d_reference = new digital_impl_glfsr(mask, seed); for (int i = 0; i < d_len; i++) // initialize to last value in sequence d_pn = 2.0*d_reference->next_bit()-1.0; } diff --git a/gr-digital/python/bpsk.py b/gr-digital/python/bpsk.py index 0d8f05c4c1..9f2354003c 100644 --- a/gr-digital/python/bpsk.py +++ b/gr-digital/python/bpsk.py @@ -31,18 +31,11 @@ from gnuradio.digital.generic_mod_demod import generic_mod, generic_demod import digital_swig import modulation_utils -# Default number of points in constellation. -_def_constellation_points = 2 -# Whether differential coding is used. -_def_differential = False - # ///////////////////////////////////////////////////////////////////////////// # BPSK constellation # ///////////////////////////////////////////////////////////////////////////// -def bpsk_constellation(m=_def_constellation_points): - if m != _def_constellation_points: - raise ValueError("BPSK can only have 2 constellation points.") +def bpsk_constellation(): return digital_swig.constellation_bpsk() # ///////////////////////////////////////////////////////////////////////////// @@ -51,8 +44,7 @@ def bpsk_constellation(m=_def_constellation_points): class bpsk_mod(generic_mod): - def __init__(self, constellation_points=_def_constellation_points, - differential=False, *args, **kwargs): + def __init__(self, mod_code=None, differential=False, *args, **kwargs): """ Hierarchical block for RRC-filtered BPSK modulation. @@ -61,12 +53,12 @@ class bpsk_mod(generic_mod): output is the complex modulated signal at baseband. See generic_mod block for list of parameters. + + 'mod_code' argument is not used. + It exists purely to simplify generation of the block in grc. """ - constellation_points = _def_constellation_points constellation = digital_swig.constellation_bpsk() - if constellation_points != 2: - raise ValueError('Number of constellation points must be 2 for BPSK.') super(bpsk_mod, self).__init__(constellation=constellation, differential=differential, *args, **kwargs) @@ -77,8 +69,7 @@ class bpsk_mod(generic_mod): class bpsk_demod(generic_demod): - def __init__(self, constellation_points=_def_constellation_points, - differential=False, *args, **kwargs): + def __init__(self, mod_code=None, differential=False, *args, **kwargs): """ Hierarchical block for RRC-filtered BPSK modulation. @@ -87,12 +78,12 @@ class bpsk_demod(generic_demod): output is the complex modulated signal at baseband. See generic_demod block for list of parameters. + + 'mod_code' argument is not used. + It exists purely to simplify generation of the block in grc. """ - constellation_points = _def_constellation_points constellation = digital_swig.constellation_bpsk() - if constellation_points != 2: - raise ValueError('Number of constellation points must be 2 for BPSK.') super(bpsk_demod, self).__init__(constellation=constellation, differential=differential, *args, **kwargs) @@ -102,19 +93,16 @@ class bpsk_demod(generic_demod): # DBPSK constellation # ///////////////////////////////////////////////////////////////////////////// -def dbpsk_constellation(m=_def_constellation_points): - if m != _def_constellation_points: - raise ValueError("DBPSK can only have 2 constellation points.") +def dbpsk_constellation(): return digital_swig.constellation_dbpsk() # ///////////////////////////////////////////////////////////////////////////// # DBPSK modulator # ///////////////////////////////////////////////////////////////////////////// -class dbpsk_mod(generic_mod): +class dbpsk_mod(bpsk_mod): - def __init__(self, constellation_points=_def_constellation_points, - differential=True, *args, **kwargs): + def __init__(self, mod_code=None, *args, **kwargs): """ Hierarchical block for RRC-filtered DBPSK modulation. @@ -123,14 +111,12 @@ class dbpsk_mod(generic_mod): output is the complex modulated signal at baseband. See generic_mod block for list of parameters. + + 'mod_code' argument is not used. + It exists purely to simplify generation of the block in grc. """ - constellation_points = _def_constellation_points - constellation = digital_swig.constellation_bpsk() - if constellation_points != 2: - raise ValueError('Number of constellation points must be 2 for DBPSK.') - super(dbpsk_mod, self).__init__(constellation=constellation, - differential=True, + super(dbpsk_mod, self).__init__(differential=True, *args, **kwargs) # ///////////////////////////////////////////////////////////////////////////// @@ -138,10 +124,9 @@ class dbpsk_mod(generic_mod): # # ///////////////////////////////////////////////////////////////////////////// -class dbpsk_demod(generic_demod): +class dbpsk_demod(bpsk_demod): - def __init__(self, constellation_points=_def_constellation_points, - differential=True, *args, **kwargs): + def __init__(self, mod_code=None, *args, **kwargs): """ Hierarchical block for RRC-filtered DBPSK modulation. @@ -150,14 +135,12 @@ class dbpsk_demod(generic_demod): output is the complex modulated signal at baseband. See generic_demod block for list of parameters. + + 'mod_code' argument is not used. + It exists purely to simplify generation of the block in grc. """ - constellation_points = _def_constellation_points - constellation = digital_swig.constellation_bpsk() - if constellation_points != 2: - raise ValueError('Number of constellation points must be 2 for DBPSK.') - super(dbpsk_demod, self).__init__(constellation=constellation, - differential=True, + super(dbpsk_demod, self).__init__(differential=True, *args, **kwargs) # diff --git a/gr-digital/python/cpm.py b/gr-digital/python/cpm.py index 05032336d4..f11832b626 100644 --- a/gr-digital/python/cpm.py +++ b/gr-digital/python/cpm.py @@ -131,7 +131,7 @@ class cpm_mod(gr.hier_block2): # Turn it into symmetric PAM data. - self.pam = gr.chunks_to_symbols_bf(self.sym_alphabet,1) + self.pam = digital_swig.chunks_to_symbols_bf(self.sym_alphabet,1) # Generate pulse (sum of taps = samples_per_symbol/2) if cpm_type == 0: # CPFSK diff --git a/gr-digital/python/generic_mod_demod.py b/gr-digital/python/generic_mod_demod.py index a6c4f3445a..105c6fe8ff 100644 --- a/gr-digital/python/generic_mod_demod.py +++ b/gr-digital/python/generic_mod_demod.py @@ -76,10 +76,10 @@ def add_common_options(parser): class generic_mod(gr.hier_block2): def __init__(self, constellation, - samples_per_symbol=_def_samples_per_symbol, differential=_def_differential, + samples_per_symbol=_def_samples_per_symbol, + pre_diff_code=True, excess_bw=_def_excess_bw, - gray_coded=True, verbose=_def_verbose, log=_def_log): """ @@ -92,10 +92,12 @@ class generic_mod(gr.hier_block2): @type constellation: gnuradio.digital.gr_constellation @param samples_per_symbol: samples per baud >= 2 @type samples_per_symbol: float + @param differential: whether to use differential encoding + @type differential: boolean + @param pre_diff_code: whether to use apply a pre-differential mapping + @type pre_diff_code: boolean @param excess_bw: Root-raised cosine filter excess bandwidth @type excess_bw: float - @param gray_coded: turn gray coding on/off - @type gray_coded: bool @param verbose: Print information about modulator? @type verbose: bool @param log: Log modulation data to files? @@ -110,6 +112,8 @@ class generic_mod(gr.hier_block2): self._samples_per_symbol = samples_per_symbol self._excess_bw = excess_bw self._differential = differential + # Only apply a predifferential coding if the constellation also supports it. + self.pre_diff_code = pre_diff_code and self._constellation.apply_pre_diff_code() if self._samples_per_symbol < 2: raise TypeError, ("sbp must be >= 2, is %f" % self._samples_per_symbol) @@ -120,7 +124,7 @@ class generic_mod(gr.hier_block2): self.bytes2chunks = \ gr.packed_to_unpacked_bb(self.bits_per_symbol(), gr.GR_MSB_FIRST) - if gray_coded == True: + if self.pre_diff_code: self.symbol_mapper = digital.map_bb(self._constellation.pre_diff_code()) if differential: @@ -142,7 +146,7 @@ class generic_mod(gr.hier_block2): # Connect blocks = [self, self.bytes2chunks] - if gray_coded == True: + if self.pre_diff_code: blocks.append(self.symbol_mapper) if differential: blocks.append(self.diffenc) @@ -186,7 +190,7 @@ class generic_mod(gr.hier_block2): print "Modulation logging turned on." self.connect(self.bytes2chunks, gr.file_sink(gr.sizeof_char, "tx_bytes2chunks.8b")) - if self._constellation.apply_pre_diff_code(): + if self.pre_diff_code: self.connect(self.symbol_mapper, gr.file_sink(gr.sizeof_char, "tx_symbol_mapper.8b")) if self._differential: @@ -208,10 +212,10 @@ class generic_mod(gr.hier_block2): class generic_demod(gr.hier_block2): def __init__(self, constellation, - samples_per_symbol=_def_samples_per_symbol, differential=_def_differential, + samples_per_symbol=_def_samples_per_symbol, + pre_diff_code=True, excess_bw=_def_excess_bw, - gray_coded=True, freq_bw=_def_freq_bw, timing_bw=_def_timing_bw, phase_bw=_def_phase_bw, @@ -227,10 +231,12 @@ class generic_demod(gr.hier_block2): @type constellation: gnuradio.digital.gr_constellation @param samples_per_symbol: samples per symbol >= 2 @type samples_per_symbol: float + @param differential: whether to use differential encoding + @type differential: boolean + @param pre_diff_code: whether to use apply a pre-differential mapping + @type pre_diff_code: boolean @param excess_bw: Root-raised cosine filter excess bandwidth @type excess_bw: float - @param gray_coded: turn gray coding on/off - @type gray_coded: bool @param freq_bw: loop filter lock-in bandwidth @type freq_bw: float @param timing_bw: timing recovery loop lock-in bandwidth @@ -259,6 +265,9 @@ class generic_demod(gr.hier_block2): if self._samples_per_symbol < 2: raise TypeError, ("sbp must be >= 2, is %d" % self._samples_per_symbol) + # Only apply a predifferential coding if the constellation also supports it. + self.pre_diff_code = pre_diff_code and self._constellation.apply_pre_diff_code() + arity = pow(2,self.bits_per_symbol()) nfilts = 32 @@ -289,7 +298,7 @@ class generic_demod(gr.hier_block2): if differential: self.diffdec = digital.diff_decoder_bb(arity) - if gray_coded: + if self.pre_diff_code: self.symbol_mapper = digital.map_bb( mod_codes.invert_code(self._constellation.pre_diff_code())) @@ -307,7 +316,7 @@ class generic_demod(gr.hier_block2): self.time_recov, self.receiver] if differential: blocks.append(self.diffdec) - if self._constellation.apply_pre_diff_code(): + if self.pre_diff_code: blocks.append(self.symbol_mapper) blocks += [self.unpack, self] self.connect(*blocks) @@ -357,7 +366,7 @@ class generic_demod(gr.hier_block2): if self._differential: self.connect(self.diffdec, gr.file_sink(gr.sizeof_char, "rx_diffdec.8b")) - if self._constellation.apply_pre_diff_code(): + if self.pre_diff_code: self.connect(self.symbol_mapper, gr.file_sink(gr.sizeof_char, "rx_symbol_mapper.8b")) self.connect(self.unpack, diff --git a/gr-digital/python/pkt.py b/gr-digital/python/pkt.py index 8650bdbb02..09254a7caa 100644 --- a/gr-digital/python/pkt.py +++ b/gr-digital/python/pkt.py @@ -143,7 +143,7 @@ class demod_pkts(gr.hier_block2): self._rcvd_pktq = gr.msg_queue() # holds packets from the PHY self.correlator = digital_swig.correlate_access_code_bb(access_code, threshold) - self.framer_sink = gr.framer_sink_1(self._rcvd_pktq) + self.framer_sink = digital.framer_sink_1(self._rcvd_pktq) self.connect(self, self._demodulator, self.correlator, self.framer_sink) self._watcher = _queue_watcher_thread(self._rcvd_pktq, callback) diff --git a/gr-digital/python/psk.py b/gr-digital/python/psk.py index 58f6787f0c..4b35447278 100644 --- a/gr-digital/python/psk.py +++ b/gr-digital/python/psk.py @@ -35,17 +35,23 @@ from generic_mod_demod import generic_mod, generic_demod _def_constellation_points = 4 # The default encoding (e.g. gray-code, set-partition) _def_mod_code = mod_codes.GRAY_CODE +# Default use of differential encoding +_def_differential = True -def create_encodings(mod_code, arity): +def create_encodings(mod_code, arity, differential): post_diff_code = None if mod_code not in mod_codes.codes: raise ValueError('That modulation code does not exist.') if mod_code == mod_codes.GRAY_CODE: - pre_diff_code = gray_code.gray_code(arity) - elif mod_code == mod_codes.SET_PARTITION_CODE: - pre_diff_code = set_partition_code.set_partition_code(arity) + if differential: + pre_diff_code = gray_code.gray_code(arity) + post_diff_code = None + else: + pre_diff_code = [] + post_diff_code = gray_code.gray_code(arity) elif mod_code == mod_codes.NO_CODE: pre_diff_code = [] + post_diff_code = None else: raise ValueError('That modulation code is not implemented for this constellation.') return (pre_diff_code, post_diff_code) @@ -54,7 +60,8 @@ def create_encodings(mod_code, arity): # PSK constellation # ///////////////////////////////////////////////////////////////////////////// -def psk_constellation(m=_def_constellation_points, mod_code=_def_mod_code): +def psk_constellation(m=_def_constellation_points, mod_code=_def_mod_code, + differential=_def_differential): """ Creates a PSK constellation object. """ @@ -62,7 +69,7 @@ def psk_constellation(m=_def_constellation_points, mod_code=_def_mod_code): if (k != int(k)): raise StandardError('Number of constellation points must be a power of two.') points = [exp(2*pi*(0+1j)*i/m) for i in range(0,m)] - pre_diff_code, post_diff_code = create_encodings(mod_code, m) + pre_diff_code, post_diff_code = create_encodings(mod_code, m, differential) if post_diff_code is not None: inverse_post_diff_code = mod_codes.invert_code(post_diff_code) points = [points[x] for x in inverse_post_diff_code] @@ -77,6 +84,7 @@ class psk_mod(generic_mod): def __init__(self, constellation_points=_def_constellation_points, mod_code=_def_mod_code, + differential=_def_differential, *args, **kwargs): """ @@ -88,8 +96,8 @@ class psk_mod(generic_mod): See generic_mod block for list of parameters. """ - constellation = psk_constellation(constellation_points, mod_code) - super(psk_mod, self).__init__(constellation, *args, **kwargs) + constellation = psk_constellation(constellation_points, mod_code, differential) + super(psk_mod, self).__init__(constellation, differential, *args, **kwargs) # ///////////////////////////////////////////////////////////////////////////// # PSK demodulator @@ -100,6 +108,7 @@ class psk_demod(generic_demod): def __init__(self, constellation_points=_def_constellation_points, mod_code=_def_mod_code, + differential=_def_differential, *args, **kwargs): """ @@ -111,8 +120,8 @@ class psk_demod(generic_demod): See generic_demod block for list of parameters. """ - constellation = psk_constellation(constellation_points, mod_code) - super(psk_demod, self).__init__(constellation, *args, **kwargs) + constellation = psk_constellation(constellation_points, mod_code, differential) + super(psk_demod, self).__init__(constellation, differential, *args, **kwargs) # # Add these to the mod/demod registry diff --git a/gr-digital/python/qa_constellation.py b/gr-digital/python/qa_constellation.py index b17d2a0fcb..e0b5b3888e 100755 --- a/gr-digital/python/qa_constellation.py +++ b/gr-digital/python/qa_constellation.py @@ -67,8 +67,24 @@ def threed_constell(): tested_constellation_info = ( (psk.psk_constellation, {'m': (2, 4, 8, 16, 32, 64), - 'mod_code': tested_mod_codes, }, + 'mod_code': tested_mod_codes, + 'differential': (True,)}, True, None), + (psk.psk_constellation, + {'m': (2, 4, 8, 16, 32, 64), + 'mod_code': tested_mod_codes, + 'differential': (False,)}, + False, None), + (qam.qam_constellation, + {'constellation_points': (4, 16, 64), + 'mod_code': tested_mod_codes, + 'differential': (True,)}, + True, None), + (qam.qam_constellation, + {'constellation_points': (4, 16, 64), + 'mod_code': tested_mod_codes, + 'differential': (False,)}, + False, None), (digital_swig.constellation_bpsk, {}, True, None), (digital_swig.constellation_qpsk, {}, False, None), (digital_swig.constellation_dqpsk, {}, True, None), @@ -167,13 +183,13 @@ class mod_demod(gr.hier_block2): # Apply any pre-differential coding # Gray-coding is done here if we're also using differential coding. if self.constellation.apply_pre_diff_code(): - self.blocks.append(gr.map_bb(self.constellation.pre_diff_code())) + self.blocks.append(digital_swig.map_bb(self.constellation.pre_diff_code())) # Differential encoding. if self.differential: - self.blocks.append(gr.diff_encoder_bb(arity)) + self.blocks.append(digital_swig.diff_encoder_bb(arity)) # Convert to constellation symbols. - self.blocks.append(gr.chunks_to_symbols_bc(self.constellation.points(), - self.constellation.dimensionality())) + self.blocks.append(digital_swig.chunks_to_symbols_bc(self.constellation.points(), + self.constellation.dimensionality())) # CHANNEL # Channel just consists of a rotation to check differential coding. if rotation is not None: @@ -184,10 +200,10 @@ class mod_demod(gr.hier_block2): self.blocks.append(digital_swig.constellation_decoder_cb(self.constellation.base())) # Differential decoding. if self.differential: - self.blocks.append(gr.diff_decoder_bb(arity)) + self.blocks.append(digital_swig.diff_decoder_bb(arity)) # Decode any pre-differential coding. if self.constellation.apply_pre_diff_code(): - self.blocks.append(gr.map_bb( + self.blocks.append(digital_swig.map_bb( mod_codes.invert_code(self.constellation.pre_diff_code()))) # unpack the k bit vector into a stream of bits self.blocks.append(gr.unpack_k_bits_bb( diff --git a/gr-digital/python/qa_constellation_receiver.py b/gr-digital/python/qa_constellation_receiver.py index 2d25433b92..8c2d2da0c5 100755 --- a/gr-digital/python/qa_constellation_receiver.py +++ b/gr-digital/python/qa_constellation_receiver.py @@ -85,11 +85,16 @@ class test_constellation_receiver (gr_unittest.TestCase): # That is not implemented since the receiver has no way of # knowing where the beginning of a symbol is. # It also doesn't work for non-differential modulation. - if constellation.dimensionality() != 1 or not differential: + if constellation.dimensionality() != 1: continue data_length = DATA_LENGTH * constellation.bits_per_symbol() + if differential: + freq_offset=True + else: + freq_offset=False tb = rec_test_tb(constellation, differential, - src_data=self.src_data[:data_length]) + src_data=self.src_data[:data_length], + freq_offset=freq_offset) tb.run() data = tb.dst.data() d1 = tb.src_data[:int(len(tb.src_data)*self.ignore_fraction)] @@ -105,12 +110,14 @@ class rec_test_tb (gr.top_block): and generic demodulation. """ def __init__(self, constellation, differential, - data_length=None, src_data=None): + data_length=None, src_data=None, freq_offset=True): """ - constellation -- a constellation object - differential -- whether differential encoding is used - data_length -- the number of bits of data to use - src_data -- a list of the bits to use + Args: + constellation: a constellation object + differential: whether differential encoding is used + data_length: the number of bits of data to use + src_data: a list of the bits to use + freq_offset: whether to use a frequency offset in the channel """ super(rec_test_tb, self).__init__() # Transmission Blocks @@ -122,11 +129,18 @@ class rec_test_tb (gr.top_block): src = gr.vector_source_b(self.src_data) mod = generic_mod(constellation, differential=differential) # Channel - channel = gr.channel_model(NOISE_VOLTAGE, FREQUENCY_OFFSET, TIMING_OFFSET) + if freq_offset: + channel = gr.channel_model(NOISE_VOLTAGE, FREQUENCY_OFFSET, TIMING_OFFSET) + else: + channel = gr.channel_model(NOISE_VOLTAGE, 0, TIMING_OFFSET) # Receiver Blocks - demod = generic_demod(constellation, differential=differential, - freq_bw=FREQ_BW, - phase_bw=PHASE_BW) + if freq_offset: + demod = generic_demod(constellation, differential=differential, + freq_bw=FREQ_BW, + phase_bw=PHASE_BW) + else: + demod = generic_demod(constellation, differential=differential, + freq_bw=0, phase_bw=0) self.dst = gr.vector_sink_b() self.connect(src, packer, mod, channel, demod, self.dst) diff --git a/gr-digital/python/qa_glfsr_source.py b/gr-digital/python/qa_glfsr_source.py index 157520d7f8..7d02037335 100755 --- a/gr-digital/python/qa_glfsr_source.py +++ b/gr-digital/python/qa_glfsr_source.py @@ -38,9 +38,9 @@ class test_glfsr_source(gr_unittest.TestCase): def test_001_degree_b(self): self.assertRaises(RuntimeError, - lambda: gr.glfsr_source_b(0)) + lambda: digital.glfsr_source_b(0)) self.assertRaises(RuntimeError, - lambda: gr.glfsr_source_b(33)) + lambda: digital.glfsr_source_b(33)) def test_002_correlation_b(self): for degree in range(1,11): # Higher degrees take too long to correlate @@ -65,9 +65,9 @@ class test_glfsr_source(gr_unittest.TestCase): def test_004_degree_f(self): self.assertRaises(RuntimeError, - lambda: gr.glfsr_source_f(0)) + lambda: digital.glfsr_source_f(0)) self.assertRaises(RuntimeError, - lambda: gr.glfsr_source_f(33)) + lambda: digital.glfsr_source_f(33)) def test_005_correlation_f(self): for degree in range(1,11): # Higher degrees take too long to correlate src = digital.glfsr_source_f(degree, False) diff --git a/gr-digital/python/qam.py b/gr-digital/python/qam.py index 5b1f7683b8..0635fda75e 100644 --- a/gr-digital/python/qam.py +++ b/gr-digital/python/qam.py @@ -157,14 +157,20 @@ def qam_constellation(constellation_points=_def_constellation_points, else: raise ValueError("Mod code is not implemented for QAM") if differential: - points = make_differential_constellation(constellation_points, gray_coded) + points = make_differential_constellation(constellation_points, gray_coded=False) else: points = make_non_differential_constellation(constellation_points, gray_coded) side = int(sqrt(constellation_points)) width = 2.0/(side-1) - # No pre-diff code - # Should add one so that we can gray-code the quadrant bits too. - pre_diff_code = [] + # For differential and gray-coded then gray-code the first two + # bits with a pre_diff_code. + # FIXME: It would be good to have a test to make sure that gray-coded constellations + # are really gray-coded. Perhaps by checking on the correlation between bit-errors. + if differential and gray_coded: + m = constellation_points + pre_diff_code = range(0, m/2) + range(3*m/4, m) + range(m/2, 3*m/4) + else: + pre_diff_code = [] constellation = digital_swig.constellation_rect(points, pre_diff_code, 4, side, side, width, width) return constellation diff --git a/gr-digital/python/qpsk.py b/gr-digital/python/qpsk.py index be21fd76f1..2fdeabd40f 100644 --- a/gr-digital/python/qpsk.py +++ b/gr-digital/python/qpsk.py @@ -27,21 +27,20 @@ Demodulation is not included since the generic_mod_demod from gnuradio import gr from gnuradio.digital.generic_mod_demod import generic_mod, generic_demod +from utils import mod_codes import digital_swig import modulation_utils -# Default number of points in constellation. -_def_constellation_points = 4 -# Whether gray coding is used. -_def_gray_coded = True +# The default encoding (e.g. gray-code, set-partition) +_def_mod_code = mod_codes.GRAY_CODE # ///////////////////////////////////////////////////////////////////////////// # QPSK constellation # ///////////////////////////////////////////////////////////////////////////// -def qpsk_constellation(m=_def_constellation_points): - if m != _def_constellation_points: - raise ValueError("QPSK can only have 4 constellation points.") +def qpsk_constellation(mod_code=_def_mod_code): + if mod_code != mod_codes.GRAY_CODE: + raise ValueError("This QPSK mod/demod works only for gray-coded constellations.") return digital_swig.constellation_qpsk() # ///////////////////////////////////////////////////////////////////////////// @@ -50,9 +49,7 @@ def qpsk_constellation(m=_def_constellation_points): class qpsk_mod(generic_mod): - def __init__(self, constellation_points=_def_constellation_points, - gray_coded=_def_gray_coded, - *args, **kwargs): + def __init__(self, mod_code=_def_mod_code, differential=False, *args, **kwargs): """ Hierarchical block for RRC-filtered QPSK modulation. @@ -62,15 +59,21 @@ class qpsk_mod(generic_mod): See generic_mod block for list of parameters. """ - - constellation_points = _def_constellation_points - constellation = digital_swig.constellation_qpsk() - if constellation_points != 4: - raise ValueError("QPSK can only have 4 constellation points.") - if not gray_coded: - raise ValueError("This QPSK mod/demod works only for gray-coded constellations.") + + pre_diff_code = True + if not differential: + constellation = digital_swig.constellation_qpsk() + if mod_code != mod_codes.GRAY_CODE: + raise ValueError("This QPSK mod/demod works only for gray-coded constellations.") + else: + constellation = digital_swig.constellation_dqpsk() + if mod_code not in (mod_codes.GRAY_CODE or mod_codes.NO_CODE): + raise ValueError("That mod_code is not supported for DQPSK mod/demod.") + if mod_code == mod_codes.NO_CODE: + pre_diff_code = False + super(qpsk_mod, self).__init__(constellation=constellation, - gray_coded=gray_coded, + pre_diff_code=pre_diff_code, *args, **kwargs) @@ -81,7 +84,7 @@ class qpsk_mod(generic_mod): class qpsk_demod(generic_demod): - def __init__(self, constellation_points=_def_constellation_points, + def __init__(self, mod_code=_def_mod_code, differential=False, *args, **kwargs): """ @@ -93,11 +96,20 @@ class qpsk_demod(generic_demod): See generic_demod block for list of parameters. """ - constellation_points = _def_constellation_points - constellation = digital_swig.constellation_qpsk() - if constellation_points != 4: - raise ValueError('Number of constellation points must be 4 for QPSK.') + pre_diff_code = True + if not differential: + constellation = digital_swig.constellation_qpsk() + if mod_code != mod_codes.GRAY_CODE: + raise ValueError("This QPSK mod/demod works only for gray-coded constellations.") + else: + constellation = digital_swig.constellation_dqpsk() + if mod_code not in (mod_codes.GRAY_CODE or mod_codes.NO_CODE): + raise ValueError("That mod_code is not supported for DQPSK mod/demod.") + if mod_code == mod_codes.NO_CODE: + pre_diff_code = False + super(qpsk_demod, self).__init__(constellation=constellation, + pre_diff_code=pre_diff_code, *args, **kwargs) @@ -106,20 +118,18 @@ class qpsk_demod(generic_demod): # DQPSK constellation # ///////////////////////////////////////////////////////////////////////////// -def dqpsk_constellation(m=_def_constellation_points): - if m != _def_constellation_points: - raise ValueError("DQPSK can only have 4 constellation points.") +def dqpsk_constellation(mod_code=_def_mod_code): + if mod_code != mod_codes.GRAY_CODE: + raise ValueError("The DQPSK constellation is only generated for gray_coding. But it can be used for non-grayed coded modulation if one doesn't use the pre-differential code.") return digital_swig.constellation_dqpsk() # ///////////////////////////////////////////////////////////////////////////// # DQPSK modulator # ///////////////////////////////////////////////////////////////////////////// -class dqpsk_mod(generic_mod): +class dqpsk_mod(qpsk_mod): - def __init__(self, constellation_points=_def_constellation_points, - gray_coded=_def_gray_coded, - differential=True, *args, **kwargs): + def __init__(self, mod_code=_def_mod_code, *args, **kwargs): """ Hierarchical block for RRC-filtered DQPSK modulation. @@ -128,14 +138,7 @@ class dqpsk_mod(generic_mod): See generic_mod block for list of parameters. """ - - constellation_points = _def_constellation_points - constellation = digital_swig.constellation_dqpsk() - if constellation_points != 4: - raise ValueError('Number of constellation points must be 4 for DQPSK.') - super(dqpsk_mod, self).__init__(constellation=constellation, - gray_coded=gray_coded, - differential=True, + super(dqpsk_mod, self).__init__(mod_code, differential=True, *args, **kwargs) # ///////////////////////////////////////////////////////////////////////////// @@ -143,10 +146,9 @@ class dqpsk_mod(generic_mod): # # ///////////////////////////////////////////////////////////////////////////// -class dqpsk_demod(generic_demod): +class dqpsk_demod(qpsk_demod): - def __init__(self, constellation_points=_def_constellation_points, - differential=True, *args, **kwargs): + def __init__(self, mod_code=_def_mod_code, *args, **kwargs): """ Hierarchical block for RRC-filtered DQPSK modulation. @@ -156,12 +158,7 @@ class dqpsk_demod(generic_demod): See generic_demod block for list of parameters. """ - constellation_points = _def_constellation_points - constellation = digital_swig.constellation_dqpsk() - if constellation_points != 4: - raise ValueError('Number of constellation points must be 4 for DQPSK.') - super(dqpsk_demod, self).__init__(constellation=constellation, - differential=True, + super(dqpsk_demod, self).__init__(mod_code, differential=True, *args, **kwargs) # diff --git a/gr-trellis/doc/gr-trellis.xml b/gr-trellis/doc/gr-trellis.xml index 4657dab384..58aa74d409 100644 --- a/gr-trellis/doc/gr-trellis.xml +++ b/gr-trellis/doc/gr-trellis.xml @@ -587,7 +587,7 @@ outputs a sequence of D numbers ci1,ci2,...,ciD representing the coordianates of the constellation symbol c_i with i=y_k. </para> <programlisting> - 20 mod = gr.chunks_to_symbols_sf(constellation,dimensionality) + 20 mod = digital.chunks_to_symbols_sf(constellation,dimensionality) </programlisting> <para> @@ -804,7 +804,7 @@ L being the channel length. This is sufficient to drive the initial and final st 23 packet[i] = 0 24 packet[len(packet)-i-1] = 0 25 src = gr.vector_source_s(packet,False) - 26 mod = gr.chunks_to_symbols_sf(modulation[1],modulation[0]) + 26 mod = digital.chunks_to_symbols_sf(modulation[1],modulation[0]) </programlisting> diff --git a/gr-trellis/doc/test_tcm.py b/gr-trellis/doc/test_tcm.py index 8c046d697b..3a285e27a2 100644 --- a/gr-trellis/doc/test_tcm.py +++ b/gr-trellis/doc/test_tcm.py @@ -17,7 +17,7 @@ def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed): src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts s2fsmi = gr.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the FSM input cardinality enc = trellis.encoder_ss(f,0) # initial state = 0 - mod = gr.chunks_to_symbols_sf(constellation,dimensionality) + mod = digital.chunks_to_symbols_sf(constellation,dimensionality) # CHANNEL add = gr.add_ff() diff --git a/gr-trellis/doc/test_tcm.py.xml b/gr-trellis/doc/test_tcm.py.xml index b5074cb2f4..a4c541e38a 100644 --- a/gr-trellis/doc/test_tcm.py.xml +++ b/gr-trellis/doc/test_tcm.py.xml @@ -19,7 +19,7 @@ 17 src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts 18 s2fsmi = gr.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the FSM input cardinality 19 enc = trellis.encoder_ss(f,0) # initial state = 0 - 20 mod = gr.chunks_to_symbols_sf(constellation,dimensionality) + 20 mod = digital.chunks_to_symbols_sf(constellation,dimensionality) 21 22 # CHANNEL 23 add = gr.add_ff() diff --git a/gr-trellis/doc/test_viterbi_equalization1.py b/gr-trellis/doc/test_viterbi_equalization1.py index 5967384cf9..c9c897fe2e 100755 --- a/gr-trellis/doc/test_viterbi_equalization1.py +++ b/gr-trellis/doc/test_viterbi_equalization1.py @@ -23,7 +23,7 @@ def run_test (f,Kb,bitspersymbol,K,channel,modulation,dimensionality,tot_constel packet[i] = 0 packet[len(packet)-i-1] = 0 src = gr.vector_source_s(packet,False) - mod = gr.chunks_to_symbols_sf(modulation[1],modulation[0]) + mod = digital.chunks_to_symbols_sf(modulation[1],modulation[0]) # CHANNEL isi = gr.fir_filter_fff(1,channel) diff --git a/gr-trellis/doc/test_viterbi_equalization1.py.xml b/gr-trellis/doc/test_viterbi_equalization1.py.xml index 27605870e8..751633a618 100644 --- a/gr-trellis/doc/test_viterbi_equalization1.py.xml +++ b/gr-trellis/doc/test_viterbi_equalization1.py.xml @@ -25,7 +25,7 @@ 23 packet[i] = 0 24 packet[len(packet)-i-1] = 0 25 src = gr.vector_source_s(packet,False) - 26 mod = gr.chunks_to_symbols_sf(modulation[1],modulation[0]) + 26 mod = digital.chunks_to_symbols_sf(modulation[1],modulation[0]) 27 28 # CHANNEL 29 isi = gr.fir_filter_fff(1,channel) diff --git a/gr-trellis/src/examples/python/test_cpm.py b/gr-trellis/src/examples/python/test_cpm.py index 5342e57e82..7503a458b1 100755 --- a/gr-trellis/src/examples/python/test_cpm.py +++ b/gr-trellis/src/examples/python/test_cpm.py @@ -89,7 +89,7 @@ def run_test(seed,blocksize): # Blocks ################################################## random_source_x_0 = gr.vector_source_b(data.tolist(), False) - gr_chunks_to_symbols_xx_0 = gr.chunks_to_symbols_bf((-1, 1), 1) + digital_chunks_to_symbols_xx_0 = digital.chunks_to_symbols_bf((-1, 1), 1) gr_interp_fir_filter_xxx_0 = gr.interp_fir_filter_fff(Q, p) gr_frequency_modulator_fc_0 = gr.frequency_modulator_fc(2*math.pi*h*(1.0/Q)) @@ -111,8 +111,8 @@ def run_test(seed,blocksize): ################################################## # Connections ################################################## - tb.connect((random_source_x_0, 0), (gr_chunks_to_symbols_xx_0, 0)) - tb.connect((gr_chunks_to_symbols_xx_0, 0), (gr_interp_fir_filter_xxx_0, 0)) + tb.connect((random_source_x_0, 0), (digital_chunks_to_symbols_xx_0, 0)) + tb.connect((digital_chunks_to_symbols_xx_0, 0), (gr_interp_fir_filter_xxx_0, 0)) tb.connect((gr_interp_fir_filter_xxx_0, 0), (gr_frequency_modulator_fc_0, 0)) tb.connect((gr_frequency_modulator_fc_0, 0), (gr_add_vxx_0, 0)) tb.connect((gr_noise_source_x_0, 0), (gr_add_vxx_0, 1)) diff --git a/gr-trellis/src/examples/python/test_pccc_turbo1.py b/gr-trellis/src/examples/python/test_pccc_turbo1.py index 0655b972de..abc0e1d01f 100755 --- a/gr-trellis/src/examples/python/test_pccc_turbo1.py +++ b/gr-trellis/src/examples/python/test_pccc_turbo1.py @@ -20,7 +20,7 @@ def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation, #src = gr.vector_source_s([0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1],False) enc = trellis.pccc_encoder_ss(fo,0,fi,0,interleaver,K) code = gr.vector_sink_s() - mod = gr.chunks_to_symbols_sf(constellation,dimensionality) + mod = digital.chunks_to_symbols_sf(constellation,dimensionality) # CHANNEL add = gr.add_ff() diff --git a/gr-trellis/src/examples/python/test_sccc_hard.py b/gr-trellis/src/examples/python/test_sccc_hard.py index 4eeb94a12d..397ebf0871 100755 --- a/gr-trellis/src/examples/python/test_sccc_hard.py +++ b/gr-trellis/src/examples/python/test_sccc_hard.py @@ -19,7 +19,7 @@ def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation, enc_out = trellis.encoder_ss(fo,0) # initial state = 0 inter = trellis.permutation(interleaver.K(),interleaver.INTER(),1,gr.sizeof_short) enc_in = trellis.encoder_ss(fi,0) # initial state = 0 - mod = gr.chunks_to_symbols_sf(constellation,dimensionality) + mod = digital.chunks_to_symbols_sf(constellation,dimensionality) # CHANNEL add = gr.add_ff() diff --git a/gr-trellis/src/examples/python/test_sccc_soft.py b/gr-trellis/src/examples/python/test_sccc_soft.py index 10c28419a8..b1ffaae748 100755 --- a/gr-trellis/src/examples/python/test_sccc_soft.py +++ b/gr-trellis/src/examples/python/test_sccc_soft.py @@ -22,7 +22,7 @@ def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation, enc_out = trellis.encoder_ss(fo,0) # initial state = 0 inter = trellis.permutation(interleaver.K(),interleaver.INTER(),1,gr.sizeof_short) enc_in = trellis.encoder_ss(fi,0) # initial state = 0 - mod = gr.chunks_to_symbols_sf(constellation,dimensionality) + mod = digital.chunks_to_symbols_sf(constellation,dimensionality) # CHANNEL add = gr.add_ff() diff --git a/gr-trellis/src/examples/python/test_sccc_turbo.py b/gr-trellis/src/examples/python/test_sccc_turbo.py index 762a93ba51..e8054a08b2 100755 --- a/gr-trellis/src/examples/python/test_sccc_turbo.py +++ b/gr-trellis/src/examples/python/test_sccc_turbo.py @@ -61,7 +61,7 @@ def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation, enc_out = trellis.encoder_ss(fo,0) # initial state = 0 inter = trellis.permutation(interleaver.K(),interleaver.INTER(),1,gr.sizeof_short) enc_in = trellis.encoder_ss(fi,0) # initial state = 0 - mod = gr.chunks_to_symbols_sf(constellation,dimensionality) + mod = digital.chunks_to_symbols_sf(constellation,dimensionality) # CHANNEL add = gr.add_ff() diff --git a/gr-trellis/src/examples/python/test_sccc_turbo1.py b/gr-trellis/src/examples/python/test_sccc_turbo1.py index 187a75185f..ef5d32f588 100755 --- a/gr-trellis/src/examples/python/test_sccc_turbo1.py +++ b/gr-trellis/src/examples/python/test_sccc_turbo1.py @@ -17,7 +17,7 @@ def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation, src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts s2fsmi = gr.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the outer FSM input cardinality enc = trellis.sccc_encoder_ss(fo,0,fi,0,interleaver,K) - mod = gr.chunks_to_symbols_sf(constellation,dimensionality) + mod = digital.chunks_to_symbols_sf(constellation,dimensionality) # CHANNEL add = gr.add_ff() diff --git a/gr-trellis/src/examples/python/test_sccc_turbo2.py b/gr-trellis/src/examples/python/test_sccc_turbo2.py index dff1ba93c3..942572676d 100755 --- a/gr-trellis/src/examples/python/test_sccc_turbo2.py +++ b/gr-trellis/src/examples/python/test_sccc_turbo2.py @@ -17,7 +17,7 @@ def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,constellation, src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts s2fsmi = gr.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the outer FSM input cardinality enc = trellis.sccc_encoder_ss(fo,0,fi,0,interleaver,K) - mod = gr.chunks_to_symbols_sf(constellation,dimensionality) + mod = digital.chunks_to_symbols_sf(constellation,dimensionality) # CHANNEL add = gr.add_ff() diff --git a/gr-trellis/src/examples/python/test_tcm.py b/gr-trellis/src/examples/python/test_tcm.py index a7d6a02d04..eff93f5b4e 100755 --- a/gr-trellis/src/examples/python/test_tcm.py +++ b/gr-trellis/src/examples/python/test_tcm.py @@ -24,7 +24,7 @@ def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed): #b2s = gr.unpacked_to_packed_ss(1,gr.GR_MSB_FIRST) # pack bits in shorts s2fsmi = gr.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the FSM input cardinality enc = trellis.encoder_ss(f,0) # initial state = 0 - mod = gr.chunks_to_symbols_sf(constellation,dimensionality) + mod = digital.chunks_to_symbols_sf(constellation,dimensionality) # CHANNEL add = gr.add_ff() diff --git a/gr-trellis/src/examples/python/test_tcm_bit.py b/gr-trellis/src/examples/python/test_tcm_bit.py index 7f69c0e294..1a89d06a89 100755 --- a/gr-trellis/src/examples/python/test_tcm_bit.py +++ b/gr-trellis/src/examples/python/test_tcm_bit.py @@ -25,7 +25,7 @@ def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed): b2s = gr.unpacked_to_packed_ss(1,gr.GR_MSB_FIRST) # pack bits in shorts s2fsmi = gr.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the FSM input cardinality enc = trellis.encoder_ss(f,0) # initial state = 0 - mod = gr.chunks_to_symbols_sf(constellation,dimensionality) + mod = digital.chunks_to_symbols_sf(constellation,dimensionality) # CHANNEL diff --git a/gr-trellis/src/examples/python/test_tcm_combined.py b/gr-trellis/src/examples/python/test_tcm_combined.py index d98e36e27d..a46444e32b 100755 --- a/gr-trellis/src/examples/python/test_tcm_combined.py +++ b/gr-trellis/src/examples/python/test_tcm_combined.py @@ -18,7 +18,7 @@ def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed): src_head = gr.head (gr.sizeof_short,Kb/16) # packet size in shorts s2fsmi = gr.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the FSM input cardinality enc = trellis.encoder_ss(f,0) # initial state = 0 - mod = gr.chunks_to_symbols_sf(constellation,dimensionality) + mod = digital.chunks_to_symbols_sf(constellation,dimensionality) # CHANNEL diff --git a/gr-trellis/src/examples/python/test_tcm_parallel.py b/gr-trellis/src/examples/python/test_tcm_parallel.py index 0372351aad..72fb8cf3bf 100755 --- a/gr-trellis/src/examples/python/test_tcm_parallel.py +++ b/gr-trellis/src/examples/python/test_tcm_parallel.py @@ -19,7 +19,7 @@ def run_test (f,Kb,bitspersymbol,K,dimensionality,constellation,N0,seed,P): s2fsmi=gr.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the FSM input cardinality s2p = gr.stream_to_streams(gr.sizeof_short,P) # serial to parallel enc = trellis.encoder_ss(f,0) # initiali state = 0 - mod = gr.chunks_to_symbols_sf(constellation,dimensionality) + mod = digital.chunks_to_symbols_sf(constellation,dimensionality) # CHANNEL add=[] diff --git a/gr-trellis/src/examples/python/test_turbo_equalization.py b/gr-trellis/src/examples/python/test_turbo_equalization.py index 18bfb022a9..d97f3f2c29 100755 --- a/gr-trellis/src/examples/python/test_turbo_equalization.py +++ b/gr-trellis/src/examples/python/test_turbo_equalization.py @@ -59,7 +59,7 @@ def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,dimensionality,tot_constellat inter = trellis.permutation(interleaver.K(),interleaver.INTER(),1,gr.sizeof_short) enc_in = trellis.encoder_ss(fi,0) # initial state = 0 # essentially here we implement the combination of modulation and channel as a memoryless modulation (the memory induced by the channel is hidden in the innner FSM) - mod = gr.chunks_to_symbols_sf(tot_constellation,dimensionality) + mod = digital.chunks_to_symbols_sf(tot_constellation,dimensionality) # CHANNEL add = gr.add_ff() diff --git a/gr-trellis/src/examples/python/test_turbo_equalization1.py b/gr-trellis/src/examples/python/test_turbo_equalization1.py index 17ad430235..da1132d38c 100755 --- a/gr-trellis/src/examples/python/test_turbo_equalization1.py +++ b/gr-trellis/src/examples/python/test_turbo_equalization1.py @@ -61,7 +61,7 @@ def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,channel,modulation,dimensiona src = gr.vector_source_s(packet,False) enc_out = trellis.encoder_ss(fo,0) # initial state = 0 inter = trellis.permutation(interleaver.K(),interleaver.INTER(),1,gr.sizeof_short) - mod = gr.chunks_to_symbols_sf(modulation[1],modulation[0]) + mod = digital.chunks_to_symbols_sf(modulation[1],modulation[0]) # CHANNEL isi = gr.fir_filter_fff(1,channel) diff --git a/gr-trellis/src/examples/python/test_turbo_equalization2.py b/gr-trellis/src/examples/python/test_turbo_equalization2.py index 5a6c77e9d4..886240efac 100755 --- a/gr-trellis/src/examples/python/test_turbo_equalization2.py +++ b/gr-trellis/src/examples/python/test_turbo_equalization2.py @@ -59,7 +59,7 @@ def run_test (fo,fi,interleaver,Kb,bitspersymbol,K,channel,modulation,dimensiona src = gr.vector_source_s(packet,False) enc_out = trellis.encoder_ss(fo,0) # initial state = 0 inter = trellis.permutation(interleaver.K(),interleaver.INTER(),1,gr.sizeof_short) - mod = gr.chunks_to_symbols_sf(modulation[1],modulation[0]) + mod = digital.chunks_to_symbols_sf(modulation[1],modulation[0]) # CHANNEL isi = gr.fir_filter_fff(1,channel) diff --git a/gr-trellis/src/examples/python/test_viterbi_equalization.py b/gr-trellis/src/examples/python/test_viterbi_equalization.py index 9f3f7e3911..00d54620b2 100755 --- a/gr-trellis/src/examples/python/test_viterbi_equalization.py +++ b/gr-trellis/src/examples/python/test_viterbi_equalization.py @@ -16,7 +16,7 @@ def run_test (f,Kb,bitspersymbol,K,dimensionality,tot_constellation,N0,seed): s2fsmi = gr.packed_to_unpacked_ss(bitspersymbol,gr.GR_MSB_FIRST) # unpack shorts to symbols compatible with the FSM input cardinality enc = trellis.encoder_ss(f,0) # initial state = 0 # essentially here we implement the combination of modulation and channel as a memoryless modulation (the memory induced by the channel is hidden in the FSM) - mod = gr.chunks_to_symbols_sf(tot_constellation,dimensionality) + mod = digital.chunks_to_symbols_sf(tot_constellation,dimensionality) # CHANNEL add = gr.add_ff() diff --git a/gr-trellis/src/examples/python/test_viterbi_equalization1.py b/gr-trellis/src/examples/python/test_viterbi_equalization1.py index 90eb4790e5..caf99ff581 100755 --- a/gr-trellis/src/examples/python/test_viterbi_equalization1.py +++ b/gr-trellis/src/examples/python/test_viterbi_equalization1.py @@ -22,7 +22,7 @@ def run_test (f,Kb,bitspersymbol,K,channel,modulation,dimensionality,tot_constel packet[i] = 0 packet[len(packet)-i-1] = 0 src = gr.vector_source_s(packet,False) - mod = gr.chunks_to_symbols_sf(modulation[1],modulation[0]) + mod = digital.chunks_to_symbols_sf(modulation[1],modulation[0]) # CHANNEL isi = gr.fir_filter_fff(1,channel) diff --git a/gr-trellis/src/python/qa_trellis.py b/gr-trellis/src/python/qa_trellis.py index fcc651ec6d..935459a3c7 100755 --- a/gr-trellis/src/python/qa_trellis.py +++ b/gr-trellis/src/python/qa_trellis.py @@ -114,7 +114,7 @@ class trellis_tb(gr.top_block): s2fsmi = gr.packed_to_unpacked_ss(bitspersymbol, gr.GR_MSB_FIRST) # initial FSM state = 0 enc = trellis.encoder_ss(f, 0) - mod = gr.chunks_to_symbols_sc(constellation.points(), 1) + mod = digital_swig.chunks_to_symbols_sc(constellation.points(), 1) # CHANNEL add = gr.add_cc() diff --git a/gr-wavelet/CMakeLists.txt b/gr-wavelet/CMakeLists.txt index 555c326d11..a488c47e91 100644 --- a/gr-wavelet/CMakeLists.txt +++ b/gr-wavelet/CMakeLists.txt @@ -37,7 +37,7 @@ GR_REGISTER_COMPONENT("gr-wavelet" ENABLE_GR_WAVELET GR_SET_GLOBAL(GR_WAVELET_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/lib - ${CMAKE_CURRENT_SOURCE_DIR}/include/wavelet + ${CMAKE_CURRENT_SOURCE_DIR}/include ) ######################################################################## diff --git a/gr-wavelet/include/wavelet/CMakeLists.txt b/gr-wavelet/include/wavelet/CMakeLists.txt index a37a3b0cd8..43c1603d15 100644 --- a/gr-wavelet/include/wavelet/CMakeLists.txt +++ b/gr-wavelet/include/wavelet/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2011 Free Software Foundation, Inc. +# Copyright 2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -21,11 +21,11 @@ # Install header files ######################################################################## install(FILES - wavelet_api.h - wavelet_squash_ff.h - wavelet_wavelet_ff.h - wavelet_wvps_ff.h - DESTINATION ${GR_INCLUDE_DIR}/gnuradio + api.h + squash_ff.h + wavelet_ff.h + wvps_ff.h + DESTINATION ${GR_INCLUDE_DIR}/gnuradio/wavelet COMPONENT "wavelet_devel" ) diff --git a/gr-wavelet/include/wavelet/wavelet_api.h b/gr-wavelet/include/wavelet/api.h index 68b2c04d78..68b2c04d78 100644 --- a/gr-wavelet/include/wavelet/wavelet_api.h +++ b/gr-wavelet/include/wavelet/api.h diff --git a/gr-wavelet/include/wavelet/wavelet_squash_ff.h b/gr-wavelet/include/wavelet/squash_ff.h index 5824969162..4d1aeb3c3c 100644 --- a/gr-wavelet/include/wavelet/wavelet_squash_ff.h +++ b/gr-wavelet/include/wavelet/squash_ff.h @@ -23,23 +23,29 @@ #ifndef INCLUDED_WAVELET_SQUASH_FF_H #define INCLUDED_WAVELET_SQUASH_FF_H -#include <wavelet_api.h> +#include <wavelet/api.h> #include <gr_sync_block.h> -/*! - * \brief implements cheap resampling of spectrum directly from - * spectral points, using gsl interpolation - * \ingroup misc - */ -class wavelet_squash_ff; -typedef boost::shared_ptr<wavelet_squash_ff> wavelet_squash_ff_sptr; +namespace gr { + namespace wavelet { -WAVELET_API wavelet_squash_ff_sptr wavelet_make_squash_ff(const std::vector<float> &igrid, - const std::vector<float> &ogrid); + class WAVELET_API squash_ff : virtual public gr_sync_block + { + public: + + // gr::wavelet::squash_ff::sptr + typedef boost::shared_ptr<squash_ff> sptr; + + /*! + * \brief implements cheap resampling of spectrum directly from + * spectral points, using gsl interpolation + * \ingroup misc + */ + static WAVELET_API sptr make(const std::vector<float> &igrid, + const std::vector<float> &ogrid); + }; -class WAVELET_API wavelet_squash_ff : virtual public gr_sync_block -{ - // No public API methods visible -}; + } /* namespace wavelet */ +} /* namespace gr */ #endif diff --git a/gr-wavelet/include/wavelet/wavelet_wavelet_ff.h b/gr-wavelet/include/wavelet/wavelet_ff.h index 7d60dbdad1..71e959f88a 100644 --- a/gr-wavelet/include/wavelet/wavelet_wavelet_ff.h +++ b/gr-wavelet/include/wavelet/wavelet_ff.h @@ -19,28 +19,33 @@ * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ + #ifndef INCLUDED_WAVELET_WAVELET_FF_H #define INCLUDED_WAVELET_WAVELET_FF_H -#include <wavelet_api.h> +#include <wavelet/api.h> #include <gr_sync_block.h> -class wavelet_wavelet_ff; -typedef boost::shared_ptr<wavelet_wavelet_ff> wavelet_wavelet_ff_sptr; +namespace gr { + namespace wavelet { -WAVELET_API wavelet_wavelet_ff_sptr -wavelet_make_wavelet_ff(int size = 1024, - int order = 20, - bool forward = true); + class WAVELET_API wavelet_ff : virtual public gr_sync_block + { + public: -/*! - * \brief compute wavelet transform using gsl routines - * \ingroup wavelet_blk - */ + // gr::wavelet::wavelet_ff:sptr + typedef boost::shared_ptr<wavelet_ff> sptr; + + /*! + * \brief compute wavelet transform using gsl routines + * \ingroup wavelet_blk + */ + static WAVELET_API sptr make(int size = 1024, + int order = 20, + bool forward = true); + }; -class WAVELET_API wavelet_wavelet_ff : virtual public gr_sync_block -{ - // No public API methods visible -}; + } /* namespace wavelet */ +} /* namespace gr */ #endif /* INCLUDED_WAVELET_WAVELET_FF_H */ diff --git a/gr-wavelet/include/wavelet/wavelet_wvps_ff.h b/gr-wavelet/include/wavelet/wvps_ff.h index 4e2889b52a..8b955db65f 100644 --- a/gr-wavelet/include/wavelet/wavelet_wvps_ff.h +++ b/gr-wavelet/include/wavelet/wvps_ff.h @@ -23,22 +23,29 @@ #ifndef INCLUDED_WAVELET_WVPS_FF_H #define INCLUDED_WAVELET_WVPS_FF_H -#include <wavelet_api.h> +#include <wavelet/api.h> #include <gr_sync_decimator.h> class wavelet_wvps_ff; -typedef boost::shared_ptr<wavelet_wvps_ff> wavelet_wvps_ff_sptr; -WAVELET_API wavelet_wvps_ff_sptr -wavelet_make_wvps_ff(int ilen); +namespace gr { + namespace wavelet { -/*! - * \brief computes the Wavelet Power Spectrum from a set of wavelet coefficients - * \ingroup wavelet_blk - */ -class WAVELET_API wavelet_wvps_ff : virtual public gr_sync_block -{ - // No public API methods visible -}; + class WAVELET_API wvps_ff : virtual public gr_sync_block + { + public: + + // gr::wavelet::wvps_ff::sptr + typedef boost::shared_ptr<wvps_ff> sptr; + + /*! + * \brief computes the Wavelet Power Spectrum from a set of wavelet coefficients + * \ingroup wavelet_blk + */ + static WAVELET_API sptr make(int ilen); + }; + + } /* namespace wavelet */ +} /* namespace gr */ #endif /* INCLUDED_WAVELET_WVPS_FF_H */ diff --git a/gr-wavelet/lib/CMakeLists.txt b/gr-wavelet/lib/CMakeLists.txt index 9594f6a6ac..2d4382b765 100644 --- a/gr-wavelet/lib/CMakeLists.txt +++ b/gr-wavelet/lib/CMakeLists.txt @@ -38,9 +38,9 @@ add_definitions(${GSL_DEFINITIONS}) # Setup library ######################################################################## list(APPEND gr_wavelet_sources - wavelet_squash_ff_impl.cc - wavelet_wavelet_ff_impl.cc - wavelet_wvps_ff_impl.cc + squash_ff_impl.cc + wavelet_ff_impl.cc + wvps_ff_impl.cc ) list(APPEND wavelet_libs diff --git a/gr-wavelet/lib/squash_ff_impl.cc b/gr-wavelet/lib/squash_ff_impl.cc new file mode 100644 index 0000000000..081ac900f5 --- /dev/null +++ b/gr-wavelet/lib/squash_ff_impl.cc @@ -0,0 +1,98 @@ +/* -*- c++ -*- */ +/* + * Copyright 2008,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 <stdexcept> +#include <squash_ff_impl.h> +#include <gr_io_signature.h> + +// expect input vector of igrid.size y-values, +// produce output vector of ogrid.size y-values + +namespace gr { + namespace wavelet { + + squash_ff::sptr squash_ff::make(const std::vector<float> &igrid, + const std::vector<float> &ogrid) + { + return gnuradio::get_initial_sptr(new squash_ff_impl(igrid, ogrid)); + } + + squash_ff_impl::squash_ff_impl(const std::vector<float> &igrid, + const std::vector<float> &ogrid) + : gr_sync_block("squash_ff", + gr_make_io_signature(1, 1, sizeof(float) * igrid.size()), + gr_make_io_signature(1, 1, sizeof(float) * ogrid.size())) + { + d_inum = igrid.size(); + d_onum = ogrid.size(); + d_igrid = (double *) malloc(d_inum * sizeof(double)); + d_iwork = (double *) malloc(d_inum * sizeof(double)); + d_ogrid = (double *) malloc(d_onum * sizeof(double)); + for (unsigned int i = 0; i < d_inum; i++) + d_igrid[i] = igrid[i]; + for (unsigned int i = 0; i < d_onum; i++) + d_ogrid[i] = ogrid[i]; + + d_accel = gsl_interp_accel_alloc(); + d_spline = gsl_spline_alloc(gsl_interp_cspline, d_inum); // FIXME check w/ Frank + } + + squash_ff_impl::~squash_ff_impl() + { + free((char *) d_igrid); + free((char *) d_iwork); + free((char *) d_ogrid); + gsl_interp_accel_free(d_accel); + gsl_spline_free(d_spline); + } + + int + squash_ff_impl::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]; + float *out = (float *) output_items[0]; + + for (int count = 0; count < noutput_items; count++) { + + for (unsigned int i = 0; i < d_inum; i++) + d_iwork[i] = in[i]; + + gsl_spline_init(d_spline, d_igrid, d_iwork, d_inum); + + for (unsigned int i = 0; i < d_onum; i++) + out[i] = gsl_spline_eval(d_spline, d_ogrid[i], d_accel); + + in += d_inum; + out += d_onum; + } + + return noutput_items; + } + + } /* namespace wavelet */ +} /* namespace gr */ diff --git a/gr-wavelet/lib/wavelet_squash_ff_impl.h b/gr-wavelet/lib/squash_ff_impl.h index dac50ddf2a..b6ddb45363 100644 --- a/gr-wavelet/lib/wavelet_squash_ff_impl.h +++ b/gr-wavelet/lib/squash_ff_impl.h @@ -23,36 +23,38 @@ #ifndef INCLUDED_WAVELET_SQUASH_FF_IMPL_H #define INCLUDED_WAVELET_SQUASH_FF_IMPL_H -#include <wavelet_api.h> -#include <wavelet_squash_ff.h> +#include <wavelet/api.h> +#include <wavelet/squash_ff.h> #include <gsl/gsl_errno.h> #include <gsl/gsl_interp.h> #include <gsl/gsl_spline.h> -class WAVELET_API wavelet_squash_ff_impl : public wavelet_squash_ff -{ - size_t d_inum; - size_t d_onum; - double *d_igrid; - double *d_iwork; - double *d_ogrid; - - gsl_interp_accel *d_accel; - gsl_spline *d_spline; - - wavelet_squash_ff_impl(const std::vector<float> &igrid, - const std::vector<float> &ogrid); - - friend WAVELET_API wavelet_squash_ff_sptr - wavelet_make_squash_ff(const std::vector<float> &igrid, - const std::vector<float> &ogrid); - - public: - ~wavelet_squash_ff_impl(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; +namespace gr { + namespace wavelet { + + class WAVELET_API squash_ff_impl : public squash_ff + { + size_t d_inum; + size_t d_onum; + double *d_igrid; + double *d_iwork; + double *d_ogrid; + + gsl_interp_accel *d_accel; + gsl_spline *d_spline; + + public: + squash_ff_impl(const std::vector<float> &igrid, + const std::vector<float> &ogrid); + + ~squash_ff_impl(); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace wavelet */ +} /* namespace gr */ #endif /* INCLUDED_WAVELET_WAVELET_FF_IMPL_H */ diff --git a/gr-wavelet/lib/wavelet_ff_impl.cc b/gr-wavelet/lib/wavelet_ff_impl.cc new file mode 100644 index 0000000000..73fc8c5440 --- /dev/null +++ b/gr-wavelet/lib/wavelet_ff_impl.cc @@ -0,0 +1,110 @@ +/* -*- c++ -*- */ +/* + * Copyright 2008,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 tewavelet 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 <stdexcept> +#include <wavelet_ff_impl.h> +#include <gr_io_signature.h> + +#include <stdio.h> + +// NB in this version, only Daubechies wavelets +// order is wavelet length, even, 2...20 + +namespace gr { + namespace wavelet { + + wavelet_ff::sptr wavelet_ff::make(int size, + int order, + bool forward) + { + return gnuradio::get_initial_sptr(new wavelet_ff_impl(size, order, forward)); + } + + wavelet_ff_impl::wavelet_ff_impl(int size, + int order, + bool forward) + : gr_sync_block("wavelet_ff", + gr_make_io_signature(1, 1, size * sizeof(float)), + gr_make_io_signature(1, 1, size * sizeof(float))), + d_size(size), + d_order(order), + d_forward(forward) + { + d_wavelet = gsl_wavelet_alloc(gsl_wavelet_daubechies, d_order); + if (d_wavelet == NULL) + throw std::runtime_error("can't allocate wavelet"); + d_workspace = gsl_wavelet_workspace_alloc(d_size); + if (d_workspace == NULL) + throw std::runtime_error("can't allocate wavelet workspace"); + d_temp = (double *) malloc(d_size*sizeof(double)); + if (d_workspace == NULL) + throw std::runtime_error("can't allocate wavelet double conversion temp"); + } + + wavelet_ff_impl::~wavelet_ff_impl() + { + gsl_wavelet_free(d_wavelet); + gsl_wavelet_workspace_free(d_workspace); + free((char *) d_temp); + } + + int + wavelet_ff_impl::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]; + float *out = (float *) output_items[0]; + + for (int count = 0; count < noutput_items; count++) { + for (int i = 0; i < d_size; i++) + d_temp[i] = in[i]; + + if (d_forward) + gsl_wavelet_transform_forward(d_wavelet, + d_temp, + 1, + d_size, + d_workspace); + else + gsl_wavelet_transform_inverse(d_wavelet, + d_temp, + 1, + d_size, + d_workspace); + + for (int i = 0; i < d_size; i++) + out[i] = d_temp[i]; + + in += d_size; + out += d_size; + } + + return noutput_items; + } + + } /* namespace wavelet */ +} /* namespace gr */ diff --git a/gr-wavelet/lib/wavelet_wavelet_ff_impl.h b/gr-wavelet/lib/wavelet_ff_impl.h index dc33a4184e..bec3935f33 100644 --- a/gr-wavelet/lib/wavelet_wavelet_ff_impl.h +++ b/gr-wavelet/lib/wavelet_ff_impl.h @@ -22,34 +22,35 @@ #ifndef INCLUDED_WAVELET_WAVELET_FF_IMPL_H #define INCLUDED_WAVELET_WAVELET_FF_IMPL_H -#include <wavelet_wavelet_ff.h> +#include <wavelet/wavelet_ff.h> #include <gsl/gsl_errno.h> #include <gsl/gsl_wavelet.h> -class WAVELET_API wavelet_wavelet_ff_impl : public wavelet_wavelet_ff -{ - int d_size; - int d_order; - bool d_forward; - gsl_wavelet *d_wavelet; - gsl_wavelet_workspace *d_workspace; - double *d_temp; - - friend WAVELET_API wavelet_wavelet_ff_sptr - wavelet_make_wavelet_ff(int size, - int order, - bool forward); - - wavelet_wavelet_ff_impl(int size, - int order, - bool forward); - -public: - ~wavelet_wavelet_ff_impl(); - - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; +namespace gr { + namespace wavelet { + + class WAVELET_API wavelet_ff_impl : public wavelet_ff + { + int d_size; + int d_order; + bool d_forward; + gsl_wavelet *d_wavelet; + gsl_wavelet_workspace *d_workspace; + double *d_temp; + + public: + wavelet_ff_impl(int size, + int order, + bool forward); + + ~wavelet_ff_impl(); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace wavelet */ +} /* namespace gr */ #endif /* INCLUDED_WAVELET_WAVELET_FF_IMPL_H */ diff --git a/gr-wavelet/lib/wavelet_squash_ff_impl.cc b/gr-wavelet/lib/wavelet_squash_ff_impl.cc deleted file mode 100644 index 89494a9c39..0000000000 --- a/gr-wavelet/lib/wavelet_squash_ff_impl.cc +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,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 <stdexcept> -#include <wavelet_squash_ff_impl.h> -#include <gr_io_signature.h> - -// expect input vector of igrid.size y-values, -// produce output vector of ogrid.size y-values - -wavelet_squash_ff_sptr -wavelet_make_squash_ff(const std::vector<float> &igrid, - const std::vector<float> &ogrid) -{ - return gnuradio::get_initial_sptr(new wavelet_squash_ff_impl(igrid, ogrid)); -} - -wavelet_squash_ff_impl::wavelet_squash_ff_impl(const std::vector<float> &igrid, - const std::vector<float> &ogrid) - : gr_sync_block("squash_ff", - gr_make_io_signature(1, 1, sizeof(float) * igrid.size()), - gr_make_io_signature(1, 1, sizeof(float) * ogrid.size())) -{ - d_inum = igrid.size(); - d_onum = ogrid.size(); - d_igrid = (double *) malloc(d_inum * sizeof(double)); - d_iwork = (double *) malloc(d_inum * sizeof(double)); - d_ogrid = (double *) malloc(d_onum * sizeof(double)); - for (unsigned int i = 0; i < d_inum; i++) - d_igrid[i] = igrid[i]; - for (unsigned int i = 0; i < d_onum; i++) - d_ogrid[i] = ogrid[i]; - - d_accel = gsl_interp_accel_alloc(); - d_spline = gsl_spline_alloc(gsl_interp_cspline, d_inum); // FIXME check w/ Frank -} - -wavelet_squash_ff_impl::~wavelet_squash_ff_impl() -{ - free((char *) d_igrid); - free((char *) d_iwork); - free((char *) d_ogrid); - gsl_interp_accel_free(d_accel); - gsl_spline_free(d_spline); -} - -int -wavelet_squash_ff_impl::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]; - float *out = (float *) output_items[0]; - - for (int count = 0; count < noutput_items; count++) { - - for (unsigned int i = 0; i < d_inum; i++) - d_iwork[i] = in[i]; - - gsl_spline_init(d_spline, d_igrid, d_iwork, d_inum); - - for (unsigned int i = 0; i < d_onum; i++) - out[i] = gsl_spline_eval(d_spline, d_ogrid[i], d_accel); - - in += d_inum; - out += d_onum; - } - - return noutput_items; -} diff --git a/gr-wavelet/lib/wavelet_wavelet_ff_impl.cc b/gr-wavelet/lib/wavelet_wavelet_ff_impl.cc deleted file mode 100644 index ccc1a6d8f7..0000000000 --- a/gr-wavelet/lib/wavelet_wavelet_ff_impl.cc +++ /dev/null @@ -1,103 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,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 tewavelet 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 <stdexcept> -#include <wavelet_wavelet_ff_impl.h> -#include <gr_io_signature.h> - -#include <stdio.h> - -// NB in this version, only Daubechies wavelets -// order is wavelet length, even, 2...20 - -wavelet_wavelet_ff_sptr -wavelet_make_wavelet_ff(int size, - int order, - bool forward) -{ - return gnuradio::get_initial_sptr(new wavelet_wavelet_ff_impl(size, order, forward)); -} - -wavelet_wavelet_ff_impl::wavelet_wavelet_ff_impl(int size, int order, bool forward) - : gr_sync_block("wavelet_ff", - gr_make_io_signature(1, 1, size * sizeof(float)), - gr_make_io_signature(1, 1, size * sizeof(float))), - d_size(size), - d_order(order), - d_forward(forward) -{ - d_wavelet = gsl_wavelet_alloc(gsl_wavelet_daubechies, d_order); - if (d_wavelet == NULL) - throw std::runtime_error("can't allocate wavelet"); - d_workspace = gsl_wavelet_workspace_alloc(d_size); - if (d_workspace == NULL) - throw std::runtime_error("can't allocate wavelet workspace"); - d_temp = (double *) malloc(d_size*sizeof(double)); - if (d_workspace == NULL) - throw std::runtime_error("can't allocate wavelet double conversion temp"); -} - -wavelet_wavelet_ff_impl::~wavelet_wavelet_ff_impl() -{ - gsl_wavelet_free(d_wavelet); - gsl_wavelet_workspace_free(d_workspace); - free((char *) d_temp); -} - -int -wavelet_wavelet_ff_impl::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]; - float *out = (float *) output_items[0]; - - for (int count = 0; count < noutput_items; count++) { - for (int i = 0; i < d_size; i++) - d_temp[i] = in[i]; - - if (d_forward) - gsl_wavelet_transform_forward(d_wavelet, - d_temp, - 1, - d_size, - d_workspace); - else - gsl_wavelet_transform_inverse(d_wavelet, - d_temp, - 1, - d_size, - d_workspace); - - for (int i = 0; i < d_size; i++) - out[i] = d_temp[i]; - - in += d_size; - out += d_size; - } - - return noutput_items; -} diff --git a/gr-wavelet/lib/wavelet_wvps_ff_impl.cc b/gr-wavelet/lib/wavelet_wvps_ff_impl.cc deleted file mode 100644 index b86859b0ae..0000000000 --- a/gr-wavelet/lib/wavelet_wvps_ff_impl.cc +++ /dev/null @@ -1,98 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,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 <wavelet_wvps_ff_impl.h> -#include <gr_io_signature.h> -#include <string.h> - -static int -ceil_log2(int k) -{ - int m = 0; - for (int n = k-1; n > 0; n >>= 1) m++; - return m; -} - -wavelet_wvps_ff_sptr -wavelet_make_wvps_ff(int ilen) -{ - return gnuradio::get_initial_sptr(new wavelet_wvps_ff_impl(ilen)); -} - -wavelet_wvps_ff_impl::wavelet_wvps_ff_impl(int ilen) - : gr_sync_block("wvps_ff", - gr_make_io_signature(1, 1, sizeof(float) * ilen), - gr_make_io_signature(1, 1, sizeof(float) * ceil_log2(ilen))), - d_ilen(ilen), d_olen(ceil_log2(ilen)) -{ -} - -// input vector assumed to be output from gsl wavelet computation - -int -wavelet_wvps_ff_impl::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]; - float *out = (float *) output_items[0]; - - for (int count = 0; count < noutput_items; count++) { - - // any power? - - if (in[0] == 0.0) { - for (int i = 0; i < d_olen; i++) - out[i] = 0.0; - - } else { - - // get power normalization from 0-th wavelet coefficient - - float scl = 1.0/(in[0]*in[0]); - int k = 1; - - // sum powers over sequences of bins, - // sequence lengths in increasing powers of 2 - - for (int e = 0; e < d_olen; e++) { - int m = 01<<e; - float sum = 0.0; - - for (int l = 0; l < m; l++) - sum += (in[k+l]*in[k+l]); - - out[e] = scl*sum; - k += m; - } - } - - in += d_ilen; - out += d_olen; - } - - return noutput_items; -} diff --git a/gr-wavelet/lib/wvps_ff_impl.cc b/gr-wavelet/lib/wvps_ff_impl.cc new file mode 100644 index 0000000000..6e886bff4e --- /dev/null +++ b/gr-wavelet/lib/wvps_ff_impl.cc @@ -0,0 +1,103 @@ +/* -*- c++ -*- */ +/* + * Copyright 2004,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 <wvps_ff_impl.h> +#include <gr_io_signature.h> +#include <string.h> + +namespace gr { + namespace wavelet { + + static int + ceil_log2(int k) + { + int m = 0; + for (int n = k-1; n > 0; n >>= 1) m++; + return m; + } + + wvps_ff::sptr wvps_ff::make(int ilen) + { + return gnuradio::get_initial_sptr(new wvps_ff_impl(ilen)); + } + + wvps_ff_impl::wvps_ff_impl(int ilen) + : gr_sync_block("wvps_ff", + gr_make_io_signature(1, 1, sizeof(float) * ilen), + gr_make_io_signature(1, 1, sizeof(float) * ceil_log2(ilen))), + d_ilen(ilen), d_olen(ceil_log2(ilen)) + { + } + + // input vector assumed to be output from gsl wavelet computation + + int + wvps_ff_impl::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]; + float *out = (float *) output_items[0]; + + for (int count = 0; count < noutput_items; count++) { + + // any power? + + if (in[0] == 0.0) { + for (int i = 0; i < d_olen; i++) + out[i] = 0.0; + + } else { + + // get power normalization from 0-th wavelet coefficient + + float scl = 1.0/(in[0]*in[0]); + int k = 1; + + // sum powers over sequences of bins, + // sequence lengths in increasing powers of 2 + + for (int e = 0; e < d_olen; e++) { + int m = 01<<e; + float sum = 0.0; + + for (int l = 0; l < m; l++) + sum += (in[k+l]*in[k+l]); + + out[e] = scl*sum; + k += m; + } + } + + in += d_ilen; + out += d_olen; + } + + return noutput_items; + } + + } /* namespace wavelet */ +} /* namespace gr */ diff --git a/gr-wavelet/lib/wavelet_wvps_ff_impl.h b/gr-wavelet/lib/wvps_ff_impl.h index 553469fde9..ab64395d24 100644 --- a/gr-wavelet/lib/wavelet_wvps_ff_impl.h +++ b/gr-wavelet/lib/wvps_ff_impl.h @@ -23,22 +23,25 @@ #ifndef INCLUDED_WAVELET_WVPS_FF_IMPL_H #define INCLUDED_WAVELET_WVPS_FF_IMPL_H -#include <wavelet_wvps_ff.h> +#include <wavelet/wvps_ff.h> -class WAVELET_API wavelet_wvps_ff_impl : public wavelet_wvps_ff -{ - int d_ilen; - int d_olen; +namespace gr { + namespace wavelet { - friend WAVELET_API wavelet_wvps_ff_sptr - wavelet_make_wvps_ff(int ilen); + class WAVELET_API wvps_ff_impl : public wvps_ff + { + int d_ilen; + int d_olen; - wavelet_wvps_ff_impl(int ilen); + public: + wvps_ff_impl(int ilen); - public: - int work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items); -}; + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace wavelet */ +}/* namespace gr */ #endif /* INCLUDED_WAVELET_WVPS_FF_IMPL_H */ diff --git a/gr-wavelet/swig/wavelet_swig.i b/gr-wavelet/swig/wavelet_swig.i index b04efc508d..40fe3f9b5e 100644 --- a/gr-wavelet/swig/wavelet_swig.i +++ b/gr-wavelet/swig/wavelet_swig.i @@ -28,21 +28,15 @@ %include "wavelet_swig_doc.i" %{ -#include "wavelet_squash_ff.h" -#include "wavelet_wavelet_ff.h" -#include "wavelet_wvps_ff.h" +#include "wavelet/squash_ff.h" +#include "wavelet/wavelet_ff.h" +#include "wavelet/wvps_ff.h" %} -%include "wavelet_squash_ff.h" -%include "wavelet_wavelet_ff.h" -%include "wavelet_wvps_ff.h" +%include "wavelet/squash_ff.h" +%include "wavelet/wavelet_ff.h" +%include "wavelet/wvps_ff.h" -GR_SWIG_BLOCK_MAGIC(wavelet,squash_ff); -wavelet_squash_ff_sptr wavelet_make_squash_ff(const std::vector<float> &igrid, - const std::vector<float> &ogrid); - -GR_SWIG_BLOCK_MAGIC(wavelet,wavelet_ff); -wavelet_wavelet_ff_sptr wavelet_make_wavelet_ff(int size, int order, bool forward); - -GR_SWIG_BLOCK_MAGIC(wavelet,wvps_ff); -wavelet_wvps_ff_sptr wavelet_make_wvps_ff(int ilen); +GR_SWIG_BLOCK_MAGIC2(wavelet, squash_ff); +GR_SWIG_BLOCK_MAGIC2(wavelet, wavelet_ff); +GR_SWIG_BLOCK_MAGIC2(wavelet, wvps_ff); diff --git a/grc/blocks/block_tree.xml b/grc/blocks/block_tree.xml index 0b0b6854ec..262f626776 100644 --- a/grc/blocks/block_tree.xml +++ b/grc/blocks/block_tree.xml @@ -13,7 +13,6 @@ <block>gr_noise_source_x</block> <block>gr_vector_source_x</block> <block>random_source_x</block> - <block>gr_glfsr_source_x</block> <block>gr_null_source</block> <block>gr_file_source</block> <block>blks2_tcp_source</block> @@ -116,8 +115,6 @@ <block>gr_packed_to_unpacked_xx</block> <block>gr_unpack_k_bits_bb</block> <block>gr_pack_k_bits_bb</block> - <block>gr_chunks_to_symbols_xx</block> - <block>gr_map_bb</block> </cat> <cat> <name>Synchronizers</name> @@ -129,9 +126,7 @@ <block>gr_pll_freqdet_cf</block> <block>gr_pll_refout_cc</block> - <block>gr_pn_correlator_cc</block> <block>gr_simple_correlator</block> - <block>gr_simple_framer</block> <block>blks2_packet_decoder</block> <block>blks2_packet_encoder</block> @@ -198,11 +193,6 @@ <block>gr_quadrature_demod_cf</block> <block>gr_cpfsk_bc</block> - <block>gr_diff_phasor_cc</block> - - <block>gr_diff_encoder_bb</block> - <block>gr_diff_decoder_bb</block> - <block>blks2_wfm_tx</block> <block>blks2_wfm_rcv</block> <block>blks2_wfm_rcv_pll</block> @@ -225,15 +215,8 @@ <block>gr_decode_ccsds_27_fb</block> </cat> <cat> - <name>Line Coding</name> - <block>gr_scrambler_bb</block> - <block>gr_descrambler_bb</block> - <block>gr_additive_scrambler_bb</block> - </cat> - <cat> <name>Probes</name> <block>gr_probe_avg_mag_sqrd_x</block> - <block>gr_probe_density_b</block> <block>gr_probe_signal_f</block> </cat> <cat> diff --git a/grc/blocks/gr_additive_scrambler_bb.xml b/grc/blocks/gr_additive_scrambler_bb.xml deleted file mode 100644 index a15d6eefbe..0000000000 --- a/grc/blocks/gr_additive_scrambler_bb.xml +++ /dev/null @@ -1,44 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -## Additive Scrambler -################################################### - --> -<block> - <name>Additive Scrambler</name> - <key>gr_additive_scrambler_bb</key> - <import>from gnuradio import gr</import> - <make>gr.additive_scrambler_bb($mask, $seed, $len, $count)</make> - <param> - <name>Mask</name> - <key>mask</key> - <value>0x8A</value> - <type>hex</type> - </param> - <param> - <name>Seed</name> - <key>seed</key> - <value>0x7F</value> - <type>hex</type> - </param> - <param> - <name>Length</name> - <key>len</key> - <value>7</value> - <type>int</type> - </param> - <param> - <name>Count</name> - <key>count</key> - <value>0</value> - <type>int</type> - </param> - <sink> - <name>in</name> - <type>byte</type> - </sink> - <source> - <name>out</name> - <type>byte</type> - </source> -</block> diff --git a/grc/blocks/gr_chunks_to_symbols.xml b/grc/blocks/gr_chunks_to_symbols.xml deleted file mode 100644 index e9da38e9a5..0000000000 --- a/grc/blocks/gr_chunks_to_symbols.xml +++ /dev/null @@ -1,77 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Chunks to Symbols -################################################### - --> -<block> - <name>Chunks to Symbols</name> - <key>gr_chunks_to_symbols_xx</key> - <import>from gnuradio import gr</import> - <make>gr.chunks_to_symbols_$(in_type.fcn)$(out_type.fcn)($symbol_table, $dimension)</make> - <param> - <name>Input Type</name> - <key>in_type</key> - <type>enum</type> - <option> - <name>Int</name> - <key>int</key> - <opt>fcn:i</opt> - </option> - <option> - <name>Short</name> - <key>short</key> - <opt>fcn:s</opt> - </option> - <option> - <name>Byte</name> - <key>byte</key> - <opt>fcn:b</opt> - </option> - </param> - <param> - <name>Output Type</name> - <key>out_type</key> - <type>enum</type> - <option> - <name>Complex</name> - <key>complex</key> - <opt>fcn:c</opt> - <opt>table:complex_vector</opt> - </option> - <option> - <name>Float</name> - <key>float</key> - <opt>fcn:f</opt> - <opt>table:real_vector</opt> - </option> - </param> - <param> - <name>Symbol Table</name> - <key>symbol_table</key> - <type>$out_type.table</type> - </param> - <param> - <name>Dimension</name> - <key>dimension</key> - <value>2</value> - <type>int</type> - </param> - <param> - <name>Num Ports</name> - <key>num_ports</key> - <value>1</value> - <type>int</type> - </param> - <check>$num_ports > 0</check> - <sink> - <name>in</name> - <type>$in_type</type> - <nports>$num_ports</nports> - </sink> - <source> - <name>out</name> - <type>$out_type</type> - <nports>$num_ports</nports> - </source> -</block> diff --git a/grc/blocks/gr_descrambler_bb.xml b/grc/blocks/gr_descrambler_bb.xml deleted file mode 100644 index 5cfbcc203e..0000000000 --- a/grc/blocks/gr_descrambler_bb.xml +++ /dev/null @@ -1,38 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Descrambler -################################################### - --> -<block> - <name>Descrambler</name> - <key>gr_descrambler_bb</key> - <import>from gnuradio import gr</import> - <make>gr.descrambler_bb($mask, $seed, $len)</make> - <param> - <name>Mask</name> - <key>mask</key> - <value>0x8A</value> - <type>hex</type> - </param> - <param> - <name>Seed</name> - <key>seed</key> - <value>0x7F</value> - <type>hex</type> - </param> - <param> - <name>Length</name> - <key>len</key> - <value>7</value> - <type>int</type> - </param> - <sink> - <name>in</name> - <type>byte</type> - </sink> - <source> - <name>out</name> - <type>byte</type> - </source> -</block> diff --git a/grc/blocks/gr_diff_decoder_bb.xml b/grc/blocks/gr_diff_decoder_bb.xml deleted file mode 100644 index ea7cf17343..0000000000 --- a/grc/blocks/gr_diff_decoder_bb.xml +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Differential Decoder -################################################### - --> -<block> - <name>Differential Decoder</name> - <key>gr_diff_decoder_bb</key> - <import>from gnuradio import gr</import> - <make>gr.diff_decoder_bb($modulus)</make> - <param> - <name>Modulus</name> - <key>modulus</key> - <type>int</type> - </param> - <sink> - <name>in</name> - <type>byte</type> - </sink> - <source> - <name>out</name> - <type>byte</type> - </source> -</block> diff --git a/grc/blocks/gr_diff_encoder_bb.xml b/grc/blocks/gr_diff_encoder_bb.xml deleted file mode 100644 index 21241eac22..0000000000 --- a/grc/blocks/gr_diff_encoder_bb.xml +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Differential Encoder -################################################### - --> -<block> - <name>Differential Encoder</name> - <key>gr_diff_encoder_bb</key> - <import>from gnuradio import gr</import> - <make>gr.diff_encoder_bb($modulus)</make> - <param> - <name>Modulus</name> - <key>modulus</key> - <type>int</type> - </param> - <sink> - <name>in</name> - <type>byte</type> - </sink> - <source> - <name>out</name> - <type>byte</type> - </source> -</block> diff --git a/grc/blocks/gr_diff_phasor_cc.xml b/grc/blocks/gr_diff_phasor_cc.xml deleted file mode 100644 index 2b2d7e372c..0000000000 --- a/grc/blocks/gr_diff_phasor_cc.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Differential Phasor -################################################### - --> -<block> - <name>Differential Phasor</name> - <key>gr_diff_phasor_cc</key> - <import>from gnuradio import gr</import> - <make>gr.diff_phasor_cc()</make> - <sink> - <name>in</name> - <type>complex</type> - </sink> - <source> - <name>out</name> - <type>complex</type> - </source> -</block> diff --git a/grc/blocks/gr_glfsr_source_x.xml b/grc/blocks/gr_glfsr_source_x.xml deleted file mode 100644 index 88fb66797b..0000000000 --- a/grc/blocks/gr_glfsr_source_x.xml +++ /dev/null @@ -1,59 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##GLFSR Source -################################################### - --> -<block> - <name>GLFSR Source</name> - <key>gr_glfsr_source_x</key> - <import>from gnuradio import gr</import> - <make>gr.glfsr_source_$(type.fcn)($degree, $repeat, $mask, $seed)</make> - <param> - <name>Type</name> - <key>type</key> - <type>enum</type> - <option> - <name>Float</name> - <key>float</key> - <opt>fcn:f</opt> - </option> - <option> - <name>Byte</name> - <key>byte</key> - <opt>fcn:b</opt> - </option> - </param> - <param> - <name>Degree</name> - <key>degree</key> - <type>int</type> - </param> - <param> - <name>Repeat</name> - <key>repeat</key> - <type>enum</type> - <option> - <name>Yes</name> - <key>True</key> - </option> - <option> - <name>No</name> - <key>False</key> - </option> - </param> - <param> - <name>Mask</name> - <key>mask</key> - <type>int</type> - </param> - <param> - <name>Seed</name> - <key>seed</key> - <type>int</type> - </param> - <source> - <name>out</name> - <type>$type</type> - </source> -</block> diff --git a/grc/blocks/gr_map_bb.xml b/grc/blocks/gr_map_bb.xml deleted file mode 100644 index 20d6bd2b44..0000000000 --- a/grc/blocks/gr_map_bb.xml +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Map -################################################### - --> -<block> - <name>Map</name> - <key>gr_map_bb</key> - <import>from gnuradio import gr</import> - <make>gr.map_bb($map)</make> - <param> - <name>Map</name> - <key>map</key> - <type>int_vector</type> - </param> - <sink> - <name>in</name> - <type>byte</type> - </sink> - <source> - <name>out</name> - <type>byte</type> - </source> -</block> diff --git a/grc/blocks/gr_pn_correlator_cc.xml b/grc/blocks/gr_pn_correlator_cc.xml deleted file mode 100644 index 094f46cdfd..0000000000 --- a/grc/blocks/gr_pn_correlator_cc.xml +++ /dev/null @@ -1,35 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##PN Correlator -################################################### - --> -<block> - <name>PN Correlator</name> - <key>gr_pn_correlator_cc</key> - <import>from gnuradio import gr</import> - <make>gr.pn_correlator_cc($degree, $mask, $seed)</make> - <param> - <name>Degree</name> - <key>degree</key> - <type>int</type> - </param> - <param> - <name>Mask</name> - <key>mask</key> - <type>int</type> - </param> - <param> - <name>Seed</name> - <key>seed</key> - <type>int</type> - </param> - <sink> - <name>in</name> - <type>complex</type> - </sink> - <source> - <name>out</name> - <type>complex</type> - </source> -</block> diff --git a/grc/blocks/gr_probe_density_b.xml b/grc/blocks/gr_probe_density_b.xml deleted file mode 100644 index 3a91256aa5..0000000000 --- a/grc/blocks/gr_probe_density_b.xml +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Probe Density -################################################### - --> -<block> - <name>Probe Density</name> - <key>gr_probe_density_b</key> - <import>from gnuradio import gr</import> - <make>gr.probe_density_b($alpha)</make> - <callback>set_alpha($alpha)</callback> - <param> - <name>Alpha</name> - <key>alpha</key> - <value>1</value> - <type>real</type> - </param> - <param> - <name>Probe Rate</name> - <key>probe_rate</key> - <value>10</value> - <type>real</type> - </param> - <sink> - <name>in</name> - <type>byte</type> - </sink> - <doc> -Available functions to probe: density() - -Use with the function probe block. - </doc> -</block> diff --git a/grc/blocks/gr_scrambler_bb.xml b/grc/blocks/gr_scrambler_bb.xml deleted file mode 100644 index d079c4015f..0000000000 --- a/grc/blocks/gr_scrambler_bb.xml +++ /dev/null @@ -1,38 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Descrambler -################################################### - --> -<block> - <name>Scrambler</name> - <key>gr_scrambler_bb</key> - <import>from gnuradio import gr</import> - <make>gr.scrambler_bb($mask, $seed, $len)</make> - <param> - <name>Mask</name> - <key>mask</key> - <value>0x8A</value> - <type>hex</type> - </param> - <param> - <name>Seed</name> - <key>seed</key> - <value>0x7F</value> - <type>hex</type> - </param> - <param> - <name>Length</name> - <key>len</key> - <value>7</value> - <type>int</type> - </param> - <sink> - <name>in</name> - <type>byte</type> - </sink> - <source> - <name>out</name> - <type>byte</type> - </source> -</block> diff --git a/grc/blocks/gr_simple_framer.xml b/grc/blocks/gr_simple_framer.xml deleted file mode 100644 index 2a0295c417..0000000000 --- a/grc/blocks/gr_simple_framer.xml +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0"?> -<!-- -################################################### -##Simple Framer -################################################### - --> -<block> - <name>Simple Framer</name> - <key>gr_simple_framer</key> - <import>from gnuradio import gr</import> - <make>gr.simple_framer($payload_bytesize)</make> - <param> - <name>Payload Byte Size</name> - <key>payload_bytesize</key> - <type>int</type> - </param> - <sink> - <name>in</name> - <type>byte</type> - </sink> - <source> - <name>out</name> - <type>byte</type> - </source> -</block> diff --git a/grc/grc_gnuradio/blks2/packet.py b/grc/grc_gnuradio/blks2/packet.py index e39f55c841..494afa986a 100644 --- a/grc/grc_gnuradio/blks2/packet.py +++ b/grc/grc_gnuradio/blks2/packet.py @@ -1,4 +1,4 @@ -# Copyright 2008, 2009 Free Software Foundation, Inc. +# Copyright 2008, 2009, 2012 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -158,7 +158,7 @@ class packet_decoder(gr.hier_block2): #blocks msgq = gr.msg_queue(DEFAULT_MSGQ_LIMIT) #holds packets from the PHY correlator = digital.correlate_access_code_bb(self._access_code, self._threshold) - framer_sink = gr.framer_sink_1(msgq) + framer_sink = digital.framer_sink_1(msgq) #initialize hier2 gr.hier_block2.__init__( self, |