diff options
Diffstat (limited to 'gr-digital/lib')
-rw-r--r-- | gr-digital/lib/CMakeLists.txt | 4 | ||||
-rw-r--r-- | gr-digital/lib/additive_scrambler_bb_impl.h | 2 | ||||
-rw-r--r-- | gr-digital/lib/descrambler_bb_impl.cc | 68 | ||||
-rw-r--r-- | gr-digital/lib/descrambler_bb_impl.h | 49 | ||||
-rw-r--r-- | gr-digital/lib/digital_descrambler_bb.cc | 56 | ||||
-rw-r--r-- | gr-digital/lib/digital_scrambler_bb.cc | 57 | ||||
-rw-r--r-- | gr-digital/lib/scrambler_bb_impl.cc | 68 | ||||
-rw-r--r-- | gr-digital/lib/scrambler_bb_impl.h | 50 |
8 files changed, 238 insertions, 116 deletions
diff --git a/gr-digital/lib/CMakeLists.txt b/gr-digital/lib/CMakeLists.txt index 441ec50e3..937964a3d 100644 --- a/gr-digital/lib/CMakeLists.txt +++ b/gr-digital/lib/CMakeLists.txt @@ -118,7 +118,7 @@ list(APPEND digital_sources costas_loop_cc_impl.cc #cpmmod_bc_impl.cc #crc32_impl.cc - #descrambler_bb_impl.cc + descrambler_bb_impl.cc diff_decoder_bb_impl.cc diff_encoder_bb_impl.cc diff_phasor_cc_impl.cc @@ -144,7 +144,7 @@ list(APPEND digital_sources pn_correlator_cc_impl.cc #probe_density_b_impl.cc #probe_mpsk_snr_est_c_impl.cc - #scrambler_bb_impl.cc + scrambler_bb_impl.cc #simple_framer_impl.cc ) diff --git a/gr-digital/lib/additive_scrambler_bb_impl.h b/gr-digital/lib/additive_scrambler_bb_impl.h index f094840bf..e2dfbc342 100644 --- a/gr-digital/lib/additive_scrambler_bb_impl.h +++ b/gr-digital/lib/additive_scrambler_bb_impl.h @@ -41,7 +41,7 @@ namespace gr { public: additive_scrambler_bb_impl(int mask, int seed, - int len, int count); + int len, int count=0); ~additive_scrambler_bb_impl(); int mask() const; diff --git a/gr-digital/lib/descrambler_bb_impl.cc b/gr-digital/lib/descrambler_bb_impl.cc new file mode 100644 index 000000000..8124df37e --- /dev/null +++ b/gr-digital/lib/descrambler_bb_impl.cc @@ -0,0 +1,68 @@ +/* -*- 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 "descrambler_bb_impl.h" +#include <gr_io_signature.h> + +namespace gr { + namespace digital { + + descrambler_bb::sptr + descrambler_bb::make(int mask, int seed, int len) + { + return gnuradio::get_initial_sptr + (new descrambler_bb_impl(mask, seed, len)); + } + + descrambler_bb_impl::descrambler_bb_impl(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) + { + } + + descrambler_bb_impl::~descrambler_bb_impl() + { + } + + int + descrambler_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] = d_lfsr.next_bit_descramble(in[i]); + } + + return noutput_items; + } + + } /* namespace digital */ +} /* namespace gr */ diff --git a/gr-digital/lib/descrambler_bb_impl.h b/gr-digital/lib/descrambler_bb_impl.h new file mode 100644 index 000000000..920182304 --- /dev/null +++ b/gr-digital/lib/descrambler_bb_impl.h @@ -0,0 +1,49 @@ +/* -*- c++ -*- */ +/* + * Copyright 2008,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_GR_DESCRAMBLER_BB_IMPL_H +#define INCLUDED_GR_DESCRAMBLER_BB_IMPL_H + +#include <digital/descrambler_bb.h> +#include <gri_lfsr.h> + +namespace gr { + namespace digital { + + class descrambler_bb_impl : public descrambler_bb + { + private: + gri_lfsr d_lfsr; + + public: + descrambler_bb_impl(int mask, int seed, int len); + ~descrambler_bb_impl(); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace digital */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_DESCRAMBLER_BB_IMPL_H */ diff --git a/gr-digital/lib/digital_descrambler_bb.cc b/gr-digital/lib/digital_descrambler_bb.cc deleted file mode 100644 index 68cba7145..000000000 --- a/gr-digital/lib/digital_descrambler_bb.cc +++ /dev/null @@ -1,56 +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_descrambler_bb.h> -#include <gr_io_signature.h> - -digital_descrambler_bb_sptr -digital_make_descrambler_bb(int mask, int seed, int len) -{ - return gnuradio::get_initial_sptr(new digital_descrambler_bb(mask, seed, len)); -} - -digital_descrambler_bb::digital_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 -digital_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/gr-digital/lib/digital_scrambler_bb.cc b/gr-digital/lib/digital_scrambler_bb.cc deleted file mode 100644 index c81b09d8c..000000000 --- a/gr-digital/lib/digital_scrambler_bb.cc +++ /dev/null @@ -1,57 +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_scrambler_bb.h> -#include <gr_io_signature.h> - -digital_scrambler_bb_sptr -digital_make_scrambler_bb(int mask, int seed, int len) -{ - return gnuradio::get_initial_sptr(new digital_scrambler_bb - (mask, seed, len)); -} - -digital_scrambler_bb::digital_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 -digital_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/gr-digital/lib/scrambler_bb_impl.cc b/gr-digital/lib/scrambler_bb_impl.cc new file mode 100644 index 000000000..d656fe243 --- /dev/null +++ b/gr-digital/lib/scrambler_bb_impl.cc @@ -0,0 +1,68 @@ +/* -*- 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 "scrambler_bb_impl.h" +#include <gr_io_signature.h> + +namespace gr { + namespace digital { + + scrambler_bb::sptr + scrambler_bb::make(int mask, int seed, int len) + { + return gnuradio::get_initial_sptr + (new scrambler_bb_impl(mask, seed, len)); + } + + scrambler_bb_impl::scrambler_bb_impl(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) + { + } + + scrambler_bb_impl::~scrambler_bb_impl() + { + } + + int + 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] = d_lfsr.next_bit_scramble(in[i]); + } + + return noutput_items; + } + + } /* namespace digital */ +} /* namespace gr */ diff --git a/gr-digital/lib/scrambler_bb_impl.h b/gr-digital/lib/scrambler_bb_impl.h new file mode 100644 index 000000000..4a93901c9 --- /dev/null +++ b/gr-digital/lib/scrambler_bb_impl.h @@ -0,0 +1,50 @@ +/* -*- c++ -*- */ +/* + * Copyright 2008,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_GR_SCRAMBLER_BB_IMPL_H +#define INCLUDED_GR_SCRAMBLER_BB_IMPL_H + +#include <digital/scrambler_bb.h> +#include <gr_sync_block.h> +#include <gri_lfsr.h> + +namespace gr { + namespace digital { + + class scrambler_bb_impl : public scrambler_bb + { + private: + gri_lfsr d_lfsr; + + public: + scrambler_bb_impl(int mask, int seed, int len); + ~scrambler_bb_impl(); + + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + }; + + } /* namespace digital */ +} /* namespace gr */ + +#endif /* INCLUDED_GR_SCRAMBLER_BB_IMPL_H */ |