GNU Radio 3.6.4.1 C++ API
char.h
Go to the documentation of this file.
1
/* Include file to configure the RS codec for character symbols
2
*
3
* Copyright 2002, Phil Karn, KA9Q
4
* May be used under the terms of the GNU General Public License (GPL)
5
*/
6
7
#define DTYPE unsigned char
8
9
#include <
gr_core_api.h
>
10
11
/* Reed-Solomon codec control block */
12
struct
rs
{
13
unsigned
int
mm
;
/* Bits per symbol */
14
unsigned
int
nn
;
/* Symbols per block (= (1<<mm)-1) */
15
unsigned
char
*
alpha_to
;
/* log lookup table */
16
unsigned
char
*
index_of
;
/* Antilog lookup table */
17
unsigned
char
*
genpoly
;
/* Generator polynomial */
18
unsigned
int
nroots
;
/* Number of generator roots = number of parity symbols */
19
unsigned
char
fcr
;
/* First consecutive root, index form */
20
unsigned
char
prim
;
/* Primitive element, index form */
21
unsigned
char
iprim
;
/* prim-th root of 1, index form */
22
};
23
24
static
inline
unsigned
int
modnn
(
struct
rs
*
rs
,
unsigned
int
x){
25
while
(x >= rs->
nn
) {
26
x -= rs->
nn
;
27
x = (x >> rs->
mm
) + (x & rs->
nn
);
28
}
29
return
x;
30
}
31
#define MODNN(x) modnn(rs,x)
32
33
#define MM (rs->mm)
34
#define NN (rs->nn)
35
#define ALPHA_TO (rs->alpha_to)
36
#define INDEX_OF (rs->index_of)
37
#define GENPOLY (rs->genpoly)
38
#define NROOTS (rs->nroots)
39
#define FCR (rs->fcr)
40
#define PRIM (rs->prim)
41
#define IPRIM (rs->iprim)
42
#define A0 (NN)
43
44
#define ENCODE_RS encode_rs_char
45
#define DECODE_RS decode_rs_char
46
#define INIT_RS init_rs_char
47
#define FREE_RS free_rs_char
48
49
GR_CORE_API
void
ENCODE_RS
(
void
*p,
DTYPE
*data,
DTYPE
*parity);
50
GR_CORE_API
int
DECODE_RS
(
void
*p,
DTYPE
*data,
int
*eras_pos,
int
no_eras);
51
GR_CORE_API
void
*
INIT_RS
(
unsigned
int
symsize,
unsigned
int
gfpoly,
unsigned
int
fcr,
52
unsigned
int
prim,
unsigned
int
nroots);
53
GR_CORE_API
void
FREE_RS
(
void
*p);
54
55
56
57
gnuradio-core
src
lib
reed-solomon
char.h
Generated on Thu Mar 21 2013 15:59:32 for GNU Radio 3.6.4.1 C++ API by
1.8.1.2