GNU Radio 3.7.1 C++ API
additive_scrambler_bb.h
Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /*
00003  * Copyright 2008,2010,2012 Free Software Foundation, Inc.
00004  *
00005  * This file is part of GNU Radio
00006  *
00007  * GNU Radio is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 3, or (at your option)
00010  * any later version.
00011  *
00012  * GNU Radio is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with GNU Radio; see the file COPYING.  If not, write to
00019  * the Free Software Foundation, Inc., 51 Franklin Street,
00020  * Boston, MA 02110-1301, USA.
00021  */
00022 
00023 #ifndef INCLUDED_DIGITAL_ADDITIVE_SCRAMBLER_BB_H
00024 #define INCLUDED_DIGITAL_ADDITIVE_SCRAMBLER_BB_H
00025 
00026 #include <gnuradio/digital/api.h>
00027 #include <gnuradio/sync_block.h>
00028 
00029 namespace gr {
00030   namespace digital {
00031     
00032     /*!
00033      * \ingroup coding_blk
00034      *
00035      * \brief
00036      * Scramble an input stream using an LFSR.
00037      *
00038      * \details
00039      * This block works on the LSB only of the input data stream,
00040      * i.e., on an "unpacked binary" stream, and produces the same
00041      * format on its output.
00042      *
00043      * The scrambler works by XORing the incoming bit stream by the
00044      * output of the LFSR. Optionally, after 'count' bits have been
00045      * processed, the shift register is reset to the seed value.
00046      * This allows processing fixed length vectors of samples.
00047      */
00048     class DIGITAL_API additive_scrambler_bb : virtual public sync_block
00049     {
00050     public:
00051       // gr::digital::additive_scrambler_bb::sptr
00052       typedef boost::shared_ptr<additive_scrambler_bb> sptr;
00053 
00054       /*!
00055        * \brief Create additive scrambler.
00056        *
00057        * \param mask   Polynomial mask for LFSR
00058        * \param seed   Initial shift register contents
00059        * \param len    Shift register length
00060        * \param count  Number of bits after which shift register is reset, 0=never
00061        *
00062        */
00063       static sptr make(int mask, int seed, int len, int count=0);
00064 
00065       virtual int mask() const = 0;
00066       virtual int seed() const = 0;
00067       virtual int len() const = 0;
00068       virtual int count() const = 0;
00069     };
00070 
00071   } /* namespace digital */
00072 } /* namespace gr */
00073 
00074 #endif /* INCLUDED_DIGITAL_ADDITIVE_SCRAMBLER_BB_H */