GNU Radio Manual and C++ API Reference  3.10.9.1
The Free & Open Software Radio Ecosystem
additive_scrambler_bb.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2008,2010,2012 Free Software Foundation, Inc.
4  *
5  * This file is part of GNU Radio
6  *
7  * SPDX-License-Identifier: GPL-3.0-or-later
8  *
9  */
10 
11 #ifndef INCLUDED_DIGITAL_ADDITIVE_SCRAMBLER_BB_H
12 #define INCLUDED_DIGITAL_ADDITIVE_SCRAMBLER_BB_H
13 
14 #include <gnuradio/digital/api.h>
15 #include <gnuradio/sync_block.h>
16 
17 namespace gr {
18 namespace digital {
19 
20 /*!
21  * \ingroup coding_blk
22  *
23  * \brief
24  * Scramble an input stream using an LFSR.
25  *
26  * \details
27  * This block scrambles up to 8 bits per byte of the input
28  * data stream, starting at the LSB.
29  *
30  * The scrambler works by XORing the incoming bit stream by the
31  * output of the LFSR. Optionally, after \p count bits have been
32  * processed, the shift register is reset to the \p seed value.
33  * This allows processing fixed length vectors of samples.
34  *
35  * Alternatively, the LFSR can be reset using a reset tag to
36  * scramble variable length vectors. However, it cannot be reset
37  * between bytes.
38  *
39  * For details on configuring the LFSR, see gr::digital::lfsr.
40  */
42 {
43 public:
44  // gr::digital::additive_scrambler_bb::sptr
45  typedef std::shared_ptr<additive_scrambler_bb> sptr;
46 
47  /*!
48  * \brief Create additive scrambler.
49  *
50  * \param mask Polynomial mask for LFSR
51  * \param seed Initial shift register contents
52  * \param len Shift register length
53  * \param count Number of bytes after which shift register is reset, 0=never
54  * \param bits_per_byte Number of bits per byte
55  * \param reset_tag_key When a tag with this key is detected, the shift register is
56  * reset (when this is set, count is ignored!)
57  */
58  static sptr make(uint64_t mask,
59  uint64_t seed,
60  uint8_t len,
61  int64_t count = 0,
62  uint8_t bits_per_byte = 1,
63  const std::string& reset_tag_key = "");
64 
65  virtual uint64_t mask() const = 0;
66  virtual uint64_t seed() const = 0;
67  virtual uint8_t len() const = 0;
68  virtual int64_t count() const = 0;
69  virtual uint8_t bits_per_byte() = 0;
70 };
71 
72 } /* namespace digital */
73 } /* namespace gr */
74 
75 #endif /* INCLUDED_DIGITAL_ADDITIVE_SCRAMBLER_BB_H */
Scramble an input stream using an LFSR.
Definition: additive_scrambler_bb.h:42
virtual uint8_t bits_per_byte()=0
static sptr make(uint64_t mask, uint64_t seed, uint8_t len, int64_t count=0, uint8_t bits_per_byte=1, const std::string &reset_tag_key="")
Create additive scrambler.
virtual uint8_t len() const =0
virtual uint64_t seed() const =0
std::shared_ptr< additive_scrambler_bb > sptr
Definition: additive_scrambler_bb.h:45
virtual int64_t count() const =0
virtual uint64_t mask() const =0
synchronous 1:1 input to output with history
Definition: sync_block.h:26
#define DIGITAL_API
Definition: gr-digital/include/gnuradio/digital/api.h:18
GNU Radio logging wrapper.
Definition: basic_block.h:29