1 /* Initialize a RS codec
2 *
3 * Copyright 2002 Phil Karn, KA9Q
4 * May be used under the terms of the GNU Lesser General Public License (LGPL)
5 */
6 #include <stdlib.h>
7 #include "fec.h"
8
9 #if !defined(NULL)
10 #define NULL ((void *)0)
11 #endif
12
13 #include "rs-common.h"
14
free_rs(void * p)15 void free_rs(void *p){
16 struct rs *rs = (struct rs *)p;
17
18 free(rs->alpha_to);
19 free(rs->index_of);
20 free(rs->genpoly);
21 free(rs);
22 }
23
24 /* Initialize a Reed-Solomon codec
25 * symsize = symbol size, bits
26 * gfpoly = Field generator polynomial coefficients
27 * fcr = first root of RS code generator polynomial, index form
28 * prim = primitive element to generate polynomial roots
29 * nroots = RS code generator polynomial degree (number of roots)
30 * pad = padding bytes at front of shortened block
31 */
init_rs_common(int symsize,int gfpoly,int fcr,int prim,int nroots,int pad)32 void *init_rs_common(int symsize,int gfpoly,int fcr,int prim,
33 int nroots,int pad){
34 struct rs *rs;
35
36 #include "init_rs.h"
37
38 return rs;
39 }
40