diff options
Diffstat (limited to 'gnuradio-core/src')
67 files changed, 2 insertions, 4069 deletions
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") |