OpenCores
URL https://opencores.org/ocsvn/yacc/yacc/trunk

Subversion Repositories yacc

[/] [yacc/] [trunk/] [bench/] [c_src/] [reed solomon/] [RS.H] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 tak.sugawa
/* Global definitions for Reed-Solomon encoder/decoder
2
 * Phil Karn KA9Q, September 1996
3
 *
4
 * The parameters MM and KK specify the Reed-Solomon code parameters.
5
 *
6
 * Set MM to be the size of each code symbol in bits. The Reed-Solomon
7
 * block size will then be NN = 2**M - 1 symbols. Supported values are
8
 * defined in rs.c.
9
 *
10
 * Set KK to be the number of data symbols in each block, which must be
11
 * less than the block size. The code will then be able to correct up
12
 * to NN-KK erasures or (NN-KK)/2 errors, or combinations thereof with
13
 * each error counting as two erasures.
14
 */
15
#define MM  8           /* RS code over GF(2**MM) - change to suit */
16
#define KK  223         /* KK = number of information symbols */
17
 
18
#define NN ((1 << MM) - 1)
19
 
20
#if (MM <= 8)
21
typedef unsigned char dtype;
22
#else
23
typedef unsigned int dtype;
24
#endif
25
 
26
/* Initialization function */
27
void init_rs(void);
28
 
29
/* These two functions *must* be called in this order (e.g.,
30
 * by init_rs()) before any encoding/decoding
31
 */
32
 
33
void generate_gf(void); /* Generate Galois Field */
34
void gen_poly(void);    /* Generate generator polynomial */
35
 
36
/* Reed-Solomon encoding
37
 * data[] is the input block, parity symbols are placed in bb[]
38
 * bb[] may lie past the end of the data, e.g., for (255,223):
39
 *      encode_rs(&data[0],&data[223]);
40
 */
41
int encode_rs(dtype data[], dtype bb[]);
42
 
43
/* Reed-Solomon erasures-and-errors decoding
44
 * The received block goes into data[], and a list of zero-origin
45
 * erasure positions, if any, goes in eras_pos[] with a count in no_eras.
46
 *
47
 * The decoder corrects the symbols in place, if possible and returns
48
 * the number of corrected symbols. If the codeword is illegal or
49
 * uncorrectible, the data array is unchanged and -1 is returned
50
 */
51
int eras_dec_rs(dtype data[], int eras_pos[], int no_eras);

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.