Statistics
| Branch: | Tag: | Revision:

root / gnuradio-core / src / lib / general / gr_additive_scrambler_bb.h @ 2cc26e4d

History | View | Annotate | Download (2.4 kB)

1 1ae689ff Johnathan Corgan
/* -*- c++ -*- */
2 1ae689ff Johnathan Corgan
/*
3 1ae689ff Johnathan Corgan
 * Copyright 2008,2010 Free Software Foundation, Inc.
4 1ae689ff Johnathan Corgan
 * 
5 1ae689ff Johnathan Corgan
 * This file is part of GNU Radio
6 1ae689ff Johnathan Corgan
 * 
7 1ae689ff Johnathan Corgan
 * GNU Radio is free software; you can redistribute it and/or modify
8 1ae689ff Johnathan Corgan
 * it under the terms of the GNU General Public License as published by
9 1ae689ff Johnathan Corgan
 * the Free Software Foundation; either version 3, or (at your option)
10 1ae689ff Johnathan Corgan
 * any later version.
11 1ae689ff Johnathan Corgan
 * 
12 1ae689ff Johnathan Corgan
 * GNU Radio is distributed in the hope that it will be useful,
13 1ae689ff Johnathan Corgan
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 1ae689ff Johnathan Corgan
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 1ae689ff Johnathan Corgan
 * GNU General Public License for more details.
16 1ae689ff Johnathan Corgan
 * 
17 1ae689ff Johnathan Corgan
 * You should have received a copy of the GNU General Public License
18 1ae689ff Johnathan Corgan
 * along with GNU Radio; see the file COPYING.  If not, write to
19 1ae689ff Johnathan Corgan
 * the Free Software Foundation, Inc., 51 Franklin Street,
20 1ae689ff Johnathan Corgan
 * Boston, MA 02110-1301, USA.
21 1ae689ff Johnathan Corgan
 */
22 1ae689ff Johnathan Corgan
#ifndef INCLUDED_GR_ADDITIVE_SCRAMBLER_BB_H
23 1ae689ff Johnathan Corgan
#define INCLUDED_GR_ADDITIVE_SCRAMBLER_BB_H
24 1ae689ff Johnathan Corgan
25 f914499f Josh Blum
#include <gr_core_api.h>
26 1ae689ff Johnathan Corgan
#include <gr_sync_block.h>
27 1ae689ff Johnathan Corgan
#include "gri_lfsr.h"
28 1ae689ff Johnathan Corgan
29 1ae689ff Johnathan Corgan
class gr_additive_scrambler_bb;
30 1ae689ff Johnathan Corgan
typedef boost::shared_ptr<gr_additive_scrambler_bb> gr_additive_scrambler_bb_sptr;
31 1ae689ff Johnathan Corgan
32 f914499f Josh Blum
GR_CORE_API gr_additive_scrambler_bb_sptr gr_make_additive_scrambler_bb(int mask, int seed, int len, int count=0);
33 1ae689ff Johnathan Corgan
34 1ae689ff Johnathan Corgan
/*!
35 1ae689ff Johnathan Corgan
 * Scramble an input stream using an LFSR.  This block works on the LSB only
36 1ae689ff Johnathan Corgan
 * of the input data stream, i.e., on an "unpacked binary" stream, and 
37 1ae689ff Johnathan Corgan
 * produces the same format on its output.
38 1ae689ff Johnathan Corgan
 * 
39 1ae689ff Johnathan Corgan
 * \param mask     Polynomial mask for LFSR
40 1ae689ff Johnathan Corgan
 * \param seed     Initial shift register contents
41 1ae689ff Johnathan Corgan
 * \param len      Shift register length
42 1ae689ff Johnathan Corgan
 * \param count    Number of bits after which shift register is reset, 0=never
43 1ae689ff Johnathan Corgan
 *
44 1ae689ff Johnathan Corgan
 * The scrambler works by XORing the incoming bit stream by the output of
45 1ae689ff Johnathan Corgan
 * the LFSR.  Optionally, after 'count' bits have been processed, the shift
46 1ae689ff Johnathan Corgan
 * register is reset to the seed value.  This allows processing fixed length
47 1ae689ff Johnathan Corgan
 * vectors of samples.
48 1ae689ff Johnathan Corgan
 * 
49 1ae689ff Johnathan Corgan
 * \ingroup coding_blk
50 1ae689ff Johnathan Corgan
 */
51 1ae689ff Johnathan Corgan
52 f914499f Josh Blum
class GR_CORE_API gr_additive_scrambler_bb : public gr_sync_block
53 1ae689ff Johnathan Corgan
{
54 f914499f Josh Blum
  friend GR_CORE_API gr_additive_scrambler_bb_sptr gr_make_additive_scrambler_bb(int mask, int seed, int len, int count);
55 1ae689ff Johnathan Corgan
56 1ae689ff Johnathan Corgan
  gri_lfsr d_lfsr;
57 1ae689ff Johnathan Corgan
  int      d_count;
58 1ae689ff Johnathan Corgan
  int      d_bits;
59 1ae689ff Johnathan Corgan
60 1ae689ff Johnathan Corgan
  gr_additive_scrambler_bb(int mask, int seed, int len, int count);
61 1ae689ff Johnathan Corgan
62 1ae689ff Johnathan Corgan
public:
63 1ae689ff Johnathan Corgan
  int work(int noutput_items,
64 1ae689ff Johnathan Corgan
           gr_vector_const_void_star &input_items,
65 1ae689ff Johnathan Corgan
           gr_vector_void_star &output_items);
66 1ae689ff Johnathan Corgan
};
67 1ae689ff Johnathan Corgan
68 1ae689ff Johnathan Corgan
#endif /* INCLUDED_GR_ADDITIVE_SCRAMBLER_BB_H */