This source file includes following definitions.
- init_rs
- rs_modnn
1
2
3
4
5
6
7
8
9
10 #ifndef _RSLIB_H_
11 #define _RSLIB_H_
12
13 #include <linux/list.h>
14 #include <linux/types.h>
15 #include <linux/gfp.h>
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 struct rs_codec {
35 int mm;
36 int nn;
37 uint16_t *alpha_to;
38 uint16_t *index_of;
39 uint16_t *genpoly;
40 int nroots;
41 int fcr;
42 int prim;
43 int iprim;
44 int gfpoly;
45 int (*gffunc)(int);
46 int users;
47 struct list_head list;
48 };
49
50
51
52
53
54
55 struct rs_control {
56 struct rs_codec *codec;
57 uint16_t buffers[0];
58 };
59
60
61 #ifdef CONFIG_REED_SOLOMON_ENC8
62 int encode_rs8(struct rs_control *rs, uint8_t *data, int len, uint16_t *par,
63 uint16_t invmsk);
64 #endif
65 #ifdef CONFIG_REED_SOLOMON_DEC8
66 int decode_rs8(struct rs_control *rs, uint8_t *data, uint16_t *par, int len,
67 uint16_t *s, int no_eras, int *eras_pos, uint16_t invmsk,
68 uint16_t *corr);
69 #endif
70
71
72 #ifdef CONFIG_REED_SOLOMON_ENC16
73 int encode_rs16(struct rs_control *rs, uint16_t *data, int len, uint16_t *par,
74 uint16_t invmsk);
75 #endif
76 #ifdef CONFIG_REED_SOLOMON_DEC16
77 int decode_rs16(struct rs_control *rs, uint16_t *data, uint16_t *par, int len,
78 uint16_t *s, int no_eras, int *eras_pos, uint16_t invmsk,
79 uint16_t *corr);
80 #endif
81
82 struct rs_control *init_rs_gfp(int symsize, int gfpoly, int fcr, int prim,
83 int nroots, gfp_t gfp);
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98 static inline struct rs_control *init_rs(int symsize, int gfpoly, int fcr,
99 int prim, int nroots)
100 {
101 return init_rs_gfp(symsize, gfpoly, fcr, prim, nroots, GFP_KERNEL);
102 }
103
104 struct rs_control *init_rs_non_canonical(int symsize, int (*func)(int),
105 int fcr, int prim, int nroots);
106
107
108 void free_rs(struct rs_control *rs);
109
110
111
112
113
114
115
116
117
118
119
120
121
122 static inline int rs_modnn(struct rs_codec *rs, int x)
123 {
124 while (x >= rs->nn) {
125 x -= rs->nn;
126 x = (x >> rs->mm) + (x & rs->nn);
127 }
128 return x;
129 }
130
131 #endif