mtd/include/linux rslib.h,1.2,1.3
gleixner at infradead.org
gleixner at infradead.org
Tue Oct 5 18:08:24 EDT 2004
Update of /home/cvs/mtd/include/linux
In directory phoenix.infradead.org:/tmp/cvs-serv24204
Modified Files:
rslib.h
Log Message:
prepare for kernel. Make akpm happy
Index: rslib.h
===================================================================
RCS file: /home/cvs/mtd/include/linux/rslib.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- rslib.h 1 Oct 2004 21:43:50 -0000 1.2
+++ rslib.h 5 Oct 2004 22:08:22 -0000 1.3
@@ -22,7 +22,7 @@
#include <linux/list.h>
/**
- * struct rs_contol - rs control structure
+ * struct rs_control - rs control structure
*
* @mm: Bits per symbol
* @nn: Symbols per block (= (1<<mm)-1)
@@ -53,28 +53,47 @@
};
/* General purpose RS codec, 8-bit data width, symbol width 1-15 bit */
-int encode_rs8 (struct rs_control *rs, uint8_t *data, int len, uint16_t *par, uint16_t invmsk);
-int decode_rs8 (struct rs_control *rs, uint8_t *data, uint16_t *par, int len,
- uint16_t *s, int no_eras, int *eras_pos, uint16_t invmsk, uint16_t *corr);
+#ifdef CONFIG_REED_SOLOMON_ENC8
+int encode_rs8(struct rs_control *rs, uint8_t *data, int len, uint16_t *par,
+ uint16_t invmsk);
+#endif
+#ifdef CONFIG_REED_SOLOMON_DEC8
+int decode_rs8(struct rs_control *rs, uint8_t *data, uint16_t *par, int len,
+ uint16_t *s, int no_eras, int *eras_pos, uint16_t invmsk,
+ uint16_t *corr);
+#endif
/* General purpose RS codec, 16-bit data width, symbol width 1-15 bit */
-int encode_rs16 (struct rs_control *rs, uint16_t *data, int len, uint16_t *par, uint16_t invmsk);
-int decode_rs16 (struct rs_control *rs, uint16_t *data, uint16_t *par, int len,
- uint16_t *s, int no_eras, int *eras_pos, uint16_t invmsk, uint16_t *corr);
-
-/* General purpose RS codec, 32-bit data width, symbol width 1-15 bit */
-int encode_rs32 (struct rs_control *rs, uint32_t *data, int len, uint16_t *par, uint16_t invmsk);
-int decode_rs32 (struct rs_control *rs, uint32_t *data, uint16_t *par, int len,
- uint16_t *s, int no_eras, int *eras_pos, uint16_t invmsk, uint16_t *corr);
+#ifdef CONFIG_REED_SOLOMON_ENC16
+int encode_rs16(struct rs_control *rs, uint16_t *data, int len, uint16_t *par,
+ uint16_t invmsk);
+#endif
+#ifdef CONFIG_REED_SOLOMON_DEC16
+int decode_rs16(struct rs_control *rs, uint16_t *data, uint16_t *par, int len,
+ uint16_t *s, int no_eras, int *eras_pos, uint16_t invmsk,
+ uint16_t *corr);
+#endif
/* Create or get a matching rs control structure */
-struct rs_control *init_rs (int symsize, int gfpoly, int fcr, int prim, int nroots);
+struct rs_control *init_rs(int symsize, int gfpoly, int fcr, int prim,
+ int nroots);
/* Release a rs control structure */
-void free_rs (struct rs_control *rs);
+void free_rs(struct rs_control *rs);
-/* Internal usage only */
-static inline int modnn (struct rs_control *rs, int x)
+/** modulo replacement for galois field arithmetics
+ *
+ * @rs: the rs control structure
+ * @x: the value to reduce
+ *
+ * where
+ * rs->mm = number of bits per symbol
+ * rs->nn = (2^rs->mm) - 1
+ *
+ * Simple arithmetic modulo would return a wrong result for values
+ * >= 3 * rs->nn
+*/
+static inline int rs_modnn(struct rs_control *rs, int x)
{
while (x >= rs->nn) {
x -= rs->nn;
@@ -83,17 +102,4 @@
return x;
}
-#define MODNN(x) modnn(rs,x)
-#define MM (rs->mm)
-#define NN (rs->nn)
-#define ALPHA_TO (rs->alpha_to)
-#define INDEX_OF (rs->index_of)
-#define GENPOLY (rs->genpoly)
-#define NROOTS (rs->nroots)
-#define FCR (rs->fcr)
-#define PRIM (rs->prim)
-#define IPRIM (rs->iprim)
-#define A0 (NN)
-
#endif
-
More information about the linux-mtd-cvs
mailing list