SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
Public Member Functions | Private Attributes | List of all members
leansdr::etr192_descrambler Struct Reference

#include <iess.h>

+ Inheritance diagram for leansdr::etr192_descrambler:
+ Collaboration diagram for leansdr::etr192_descrambler:

Public Member Functions

 etr192_descrambler (scheduler *sch, pipebuf< u8 > &_in, pipebuf< u8 > &_out)
 
void run ()
 
- Public Member Functions inherited from leansdr::runnable
 runnable (scheduler *_sch, const char *name)
 
- Public Member Functions inherited from leansdr::runnable_common
 runnable_common (const char *_name)
 
virtual ~runnable_common ()
 
virtual void shutdown ()
 

Private Attributes

pipereader< u8in
 
pipewriter< u8out
 
u32 shiftreg
 
u8 counter
 

Additional Inherited Members

- Public Attributes inherited from leansdr::runnable_common
const char * name
 
- Protected Attributes inherited from leansdr::runnable
schedulersch
 

Detailed Description

Definition at line 29 of file iess.h.

Constructor & Destructor Documentation

◆ etr192_descrambler()

leansdr::etr192_descrambler::etr192_descrambler ( scheduler sch,
pipebuf< u8 > &  _in,
pipebuf< u8 > &  _out 
)
inline

Definition at line 31 of file iess.h.

34  : runnable(sch, "etr192_dec"),
35  in(_in), out(_out),
36  shiftreg(0), counter(0)
37  {
38  }
runnable(scheduler *_sch, const char *name)
Definition: framework.h:193
pipereader< u8 > in
Definition: iess.h:71
pipewriter< u8 > out
Definition: iess.h:72
scheduler * sch
Definition: framework.h:199

Member Function Documentation

◆ run()

void leansdr::etr192_descrambler::run ( )
inlinevirtual

Reimplemented from leansdr::runnable_common.

Definition at line 40 of file iess.h.

References counter, in, leansdr::min(), out, leansdr::pipereader< T >::rd(), leansdr::pipereader< T >::read(), leansdr::pipereader< T >::readable(), shiftreg, leansdr::pipewriter< T >::wr(), leansdr::pipewriter< T >::writable(), and leansdr::pipewriter< T >::written().

41  {
42  int count = min(in.readable(), out.writable());
43  for (u8 *pin = in.rd(), *pend = pin + count, *pout = out.wr();
44  pin < pend; ++pin, ++pout)
45  {
46  u8 byte_in = *pin, byte_out = 0;
47  for (int b = 8; b--; byte_in <<= 1)
48  {
49  // Levels before clock transition
50  int bit_in = (byte_in & 128) ? 1 : 0;
51  int reset_counter = (shiftreg ^ (shiftreg >> 8)) & 1;
52  int counter_overflow = (counter == 31) ? 1 : 0;
53  int taps = (shiftreg >> 2) ^ (shiftreg >> 19);
54  int bit_out = (taps ^ counter_overflow ^ bit_in ^ 1) & 1;
55  // Execute clock transition
56 #if 1 // Descramble
57  shiftreg = (shiftreg << 1) | bit_in;
58 #else // Scramble
59  shiftreg = (shiftreg << 1) | bit_out;
60 #endif
61  counter = reset_counter ? 0 : (counter + 1) & 31;
62  byte_out = (byte_out << 1) | bit_out;
63  }
64  *pout = byte_out;
65  }
66  in.read(count);
67  out.written(count);
68  }
unsigned char u8
Definition: framework.h:453
pipereader< u8 > in
Definition: iess.h:71
pipewriter< u8 > out
Definition: iess.h:72
void written(unsigned long n)
Definition: framework.h:308
void read(unsigned long n)
Definition: framework.h:367
T min(const T &x, const T &y)
Definition: framework.h:440
+ Here is the call graph for this function:

Member Data Documentation

◆ counter

u8 leansdr::etr192_descrambler::counter
private

Definition at line 74 of file iess.h.

Referenced by run().

◆ in

pipereader<u8> leansdr::etr192_descrambler::in
private

Definition at line 71 of file iess.h.

Referenced by run().

◆ out

pipewriter<u8> leansdr::etr192_descrambler::out
private

Definition at line 72 of file iess.h.

Referenced by run().

◆ shiftreg

u32 leansdr::etr192_descrambler::shiftreg
private

Definition at line 73 of file iess.h.

Referenced by run().


The documentation for this struct was generated from the following file: