diff options
Diffstat (limited to 'gr-digital/lib')
-rw-r--r-- | gr-digital/lib/CMakeLists.txt | 90 | ||||
-rw-r--r-- | gr-digital/lib/additive_scrambler_bb_impl.cc | 104 | ||||
-rw-r--r-- | gr-digital/lib/additive_scrambler_bb_impl.h | 60 | ||||
-rw-r--r-- | gr-digital/lib/digital_additive_scrambler_bb.cc | 69 |
4 files changed, 209 insertions, 114 deletions
diff --git a/gr-digital/lib/CMakeLists.txt b/gr-digital/lib/CMakeLists.txt index bd4f1a5004..15107a6ad1 100644 --- a/gr-digital/lib/CMakeLists.txt +++ b/gr-digital/lib/CMakeLists.txt @@ -84,57 +84,57 @@ endmacro(expand_cc) ######################################################################## # Invoke macro to generate various sources ######################################################################## -expand_cc(digital_chunks_to_symbols_XX bf bc sf sc if ic) +#expand_cc(digital_chunks_to_symbols_XX bf bc sf sc if ic) ######################################################################## # Setup library ######################################################################## list(APPEND gr_digital_sources ${generated_sources} - digital_impl_glfsr.cc - digital_impl_mpsk_snr_est.cc - digital_additive_scrambler_bb.cc - digital_binary_slicer_fb.cc - digital_bytes_to_syms.cc - digital_clock_recovery_mm_cc.cc - digital_clock_recovery_mm_ff.cc - digital_cma_equalizer_cc.cc - digital_constellation.cc - digital_constellation_receiver_cb.cc - digital_constellation_decoder_cb.cc - digital_correlate_access_code_bb.cc - digital_correlate_access_code_tag_bb.cc - digital_costas_loop_cc.cc - digital_cpmmod_bc.cc - digital_crc32.cc - digital_descrambler_bb.cc - digital_diff_decoder_bb.cc - digital_diff_encoder_bb.cc - digital_diff_phasor_cc.cc - digital_fll_band_edge_cc.cc - digital_framer_sink_1.cc - digital_glfsr_source_b.cc - digital_glfsr_source_f.cc - digital_gmskmod_bc.cc - digital_lms_dd_equalizer_cc.cc - digital_kurtotic_equalizer_cc.cc - digital_map_bb.cc - digital_mpsk_receiver_cc.cc - digital_mpsk_snr_est_cc.cc - digital_ofdm_cyclic_prefixer.cc - digital_ofdm_frame_acquisition.cc - digital_ofdm_frame_sink.cc - digital_ofdm_insert_preamble.cc - digital_ofdm_mapper_bcv.cc - digital_ofdm_sampler.cc - digital_packet_sink.cc - digital_pfb_clock_sync_ccf.cc - digital_pfb_clock_sync_fff.cc - digital_pn_correlator_cc.cc - digital_probe_density_b.cc - digital_probe_mpsk_snr_est_c.cc - digital_scrambler_bb.cc - digital_simple_framer.cc + #digital_impl_glfsr.cc + #digital_impl_mpsk_snr_est.cc + additive_scrambler_bb_impl.cc + #digital_binary_slicer_fb.cc + #digital_bytes_to_syms.cc + #digital_clock_recovery_mm_cc.cc + #digital_clock_recovery_mm_ff.cc + #digital_cma_equalizer_cc.cc + #digital_constellation.cc + #digital_constellation_receiver_cb.cc + #digital_constellation_decoder_cb.cc + #digital_correlate_access_code_bb.cc + #digital_correlate_access_code_tag_bb.cc + #digital_costas_loop_cc.cc + #digital_cpmmod_bc.cc + #digital_crc32.cc + #digital_descrambler_bb.cc + #digital_diff_decoder_bb.cc + #digital_diff_encoder_bb.cc + #digital_diff_phasor_cc.cc + #digital_fll_band_edge_cc.cc + #digital_framer_sink_1.cc + #digital_glfsr_source_b.cc + #digital_glfsr_source_f.cc + #digital_gmskmod_bc.cc + #digital_lms_dd_equalizer_cc.cc + #digital_kurtotic_equalizer_cc.cc + #digital_map_bb.cc + #digital_mpsk_receiver_cc.cc + #digital_mpsk_snr_est_cc.cc + #digital_ofdm_cyclic_prefixer.cc + #digital_ofdm_frame_acquisition.cc + #digital_ofdm_frame_sink.cc + #digital_ofdm_insert_preamble.cc + #digital_ofdm_mapper_bcv.cc + #digital_ofdm_sampler.cc + #digital_packet_sink.cc + #digital_pfb_clock_sync_ccf.cc + #digital_pfb_clock_sync_fff.cc + #digital_pn_correlator_cc.cc + #digital_probe_density_b.cc + #digital_probe_mpsk_snr_est_c.cc + #digital_scrambler_bb.cc + #digital_simple_framer.cc ) list(APPEND digital_libs diff --git a/gr-digital/lib/additive_scrambler_bb_impl.cc b/gr-digital/lib/additive_scrambler_bb_impl.cc new file mode 100644 index 0000000000..8238f2d988 --- /dev/null +++ b/gr-digital/lib/additive_scrambler_bb_impl.cc @@ -0,0 +1,104 @@ +/* -*- c++ -*- */ +/* + * Copyright 2008,2010,2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "additive_scrambler_bb_impl.h" +#include <gr_io_signature.h> + +namespace gr { + namespace digital { + + additive_scrambler_bb::sptr + additive_scrambler_bb::make(int mask, int seed, int len, int count) + { + return gnuradio::get_initial_sptr(new additive_scrambler_bb_impl + (mask, seed, len, count)); + } + + additive_scrambler_bb_impl::additive_scrambler_bb_impl(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), d_len(len), d_seed(seed) + { + } + + additive_scrambler_bb_impl::~additive_scrambler_bb_impl() + { + } + + int + additive_scrambler_bb_impl::mask() const + { + return d_lfsr.mask(); + } + + int + additive_scrambler_bb_impl::seed() const + { + return d_seed; + } + + int + additive_scrambler_bb_impl::len() const + { + return d_len; + } + + int + additive_scrambler_bb_impl::count() const + { + return d_count; + } + + int + additive_scrambler_bb_impl::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; + } + + } /* namespace digital */ +} /* namespace gr */ + diff --git a/gr-digital/lib/additive_scrambler_bb_impl.h b/gr-digital/lib/additive_scrambler_bb_impl.h new file mode 100644 index 0000000000..51566fb0e3 --- /dev/null +++ b/gr-digital/lib/additive_scrambler_bb_impl.h @@ -0,0 +1,60 @@ +/* -*- c++ -*- */ +/* + * Copyright 2008,2010,2012 Free Software Foundation, Inc. + * + * This file is part of GNU Radio + * + * GNU Radio is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3, or (at your option) + * any later version. + * + * GNU Radio is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Radio; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, + * Boston, MA 02110-1301, USA. + */ + +#ifndef INCLUDED_DIGITAL_ADDITIVE_SCRAMBLER_BB_IMPL_H +#define INCLUDED_DIGITAL_ADDITIVE_SCRAMBLER_BB_IMPL_H + +#include <digital/additive_scrambler_bb.h> +#include <gri_lfsr.h> + +namespace gr { + namespace digital { + + class DIGITAL_API additive_scrambler_bb_impl + : public additive_scrambler_bb + { + private: + gri_lfsr d_lfsr; + int d_count; + int d_bits; + int d_len; + int d_seed; + + public: + additive_scrambler_bb_impl(int mask, int seed, + int len, int count); + ~additive_scrambler_bb_impl(); + + int mask() const; + int seed() const; + int len() const; + int count() const; + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace digital */ +} /* namespace gr */ + +#endif /* INCLUDED_DIGITAL_ADDITIVE_SCRAMBLER_BB_IMPL_H */ diff --git a/gr-digital/lib/digital_additive_scrambler_bb.cc b/gr-digital/lib/digital_additive_scrambler_bb.cc deleted file mode 100644 index a8affaa78f..0000000000 --- a/gr-digital/lib/digital_additive_scrambler_bb.cc +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2008,2010,2012 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Radio; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, - * Boston, MA 02110-1301, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <digital_additive_scrambler_bb.h> -#include <gr_io_signature.h> - -digital_additive_scrambler_bb_sptr -digital_make_additive_scrambler_bb(int mask, int seed, int len, int count) -{ - return gnuradio::get_initial_sptr(new digital_additive_scrambler_bb - (mask, seed, len, count)); -} - -digital_additive_scrambler_bb::digital_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 -digital_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; -} |