forked from analogdevicesinc/linux
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[LIB] reed_solomon: Clean up trailing white spaces
- Loading branch information
Showing
5 changed files
with
72 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
/* | ||
/* | ||
* include/linux/rslib.h | ||
* | ||
* Overview: | ||
* Generic Reed Solomon encoder / decoder library | ||
* | ||
* | ||
* Copyright (C) 2004 Thomas Gleixner ([email protected]) | ||
* | ||
* RS code lifted from reed solomon library written by Phil Karn | ||
* Copyright 2002 Phil Karn, KA9Q | ||
* | ||
* $Id: rslib.h,v 1.3 2004/10/05 22:08:22 gleixner Exp $ | ||
* $Id: rslib.h,v 1.4 2005/11/07 11:14:52 gleixner Exp $ | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License version 2 as | ||
|
@@ -21,20 +21,20 @@ | |
|
||
#include <linux/list.h> | ||
|
||
/** | ||
/** | ||
* struct rs_control - rs control structure | ||
* | ||
* | ||
* @mm: Bits per symbol | ||
* @nn: Symbols per block (= (1<<mm)-1) | ||
* @alpha_to: log lookup table | ||
* @index_of: Antilog lookup table | ||
* @genpoly: Generator polynomial | ||
* @genpoly: Generator polynomial | ||
* @nroots: Number of generator roots = number of parity symbols | ||
* @fcr: First consecutive root, index form | ||
* @prim: Primitive element, index form | ||
* @iprim: prim-th root of 1, index form | ||
* @gfpoly: The primitive generator polynominal | ||
* @users: Users of this structure | ||
* @prim: Primitive element, index form | ||
* @iprim: prim-th root of 1, index form | ||
* @gfpoly: The primitive generator polynominal | ||
* @users: Users of this structure | ||
* @list: List entry for the rs control list | ||
*/ | ||
struct rs_control { | ||
|
@@ -58,7 +58,7 @@ 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, | ||
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 | ||
|
@@ -75,7 +75,7 @@ int decode_rs16(struct rs_control *rs, uint16_t *data, uint16_t *par, int len, | |
#endif | ||
|
||
/* Create or get a matching rs control structure */ | ||
struct rs_control *init_rs(int symsize, int gfpoly, int fcr, int prim, | ||
struct rs_control *init_rs(int symsize, int gfpoly, int fcr, int prim, | ||
int nroots); | ||
|
||
/* Release a rs control structure */ | ||
|
@@ -87,9 +87,9 @@ void free_rs(struct rs_control *rs); | |
* @x: the value to reduce | ||
* | ||
* where | ||
* rs->mm = number of bits per symbol | ||
* 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 | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
/* | ||
/* | ||
* lib/reed_solomon/decode_rs.c | ||
* | ||
* Overview: | ||
* Generic Reed Solomon encoder / decoder library | ||
* | ||
* | ||
* Copyright 2002, Phil Karn, KA9Q | ||
* May be used under the terms of the GNU General Public License (GPL) | ||
* | ||
* Adaption to the kernel by Thomas Gleixner ([email protected]) | ||
* | ||
* $Id: decode_rs.c,v 1.6 2004/10/22 15:41:47 gleixner Exp $ | ||
* $Id: decode_rs.c,v 1.7 2005/11/07 11:14:59 gleixner Exp $ | ||
* | ||
*/ | ||
|
||
/* Generic data width independent code which is included by the | ||
/* Generic data width independent code which is included by the | ||
* wrappers. | ||
*/ | ||
{ | ||
{ | ||
int deg_lambda, el, deg_omega; | ||
int i, j, r, k, pad; | ||
int nn = rs->nn; | ||
|
@@ -41,9 +41,9 @@ | |
pad = nn - nroots - len; | ||
if (pad < 0 || pad >= nn) | ||
return -ERANGE; | ||
|
||
/* Does the caller provide the syndrome ? */ | ||
if (s != NULL) | ||
if (s != NULL) | ||
goto decode; | ||
|
||
/* form the syndromes; i.e., evaluate data(x) at roots of | ||
|
@@ -54,11 +54,11 @@ | |
for (j = 1; j < len; j++) { | ||
for (i = 0; i < nroots; i++) { | ||
if (syn[i] == 0) { | ||
syn[i] = (((uint16_t) data[j]) ^ | ||
syn[i] = (((uint16_t) data[j]) ^ | ||
invmsk) & msk; | ||
} else { | ||
syn[i] = ((((uint16_t) data[j]) ^ | ||
invmsk) & msk) ^ | ||
invmsk) & msk) ^ | ||
alpha_to[rs_modnn(rs, index_of[syn[i]] + | ||
(fcr + i) * prim)]; | ||
} | ||
|
@@ -70,7 +70,7 @@ | |
if (syn[i] == 0) { | ||
syn[i] = ((uint16_t) par[j]) & msk; | ||
} else { | ||
syn[i] = (((uint16_t) par[j]) & msk) ^ | ||
syn[i] = (((uint16_t) par[j]) & msk) ^ | ||
alpha_to[rs_modnn(rs, index_of[syn[i]] + | ||
(fcr+i)*prim)]; | ||
} | ||
|
@@ -99,14 +99,14 @@ | |
|
||
if (no_eras > 0) { | ||
/* Init lambda to be the erasure locator polynomial */ | ||
lambda[1] = alpha_to[rs_modnn(rs, | ||
lambda[1] = alpha_to[rs_modnn(rs, | ||
prim * (nn - 1 - eras_pos[0]))]; | ||
for (i = 1; i < no_eras; i++) { | ||
u = rs_modnn(rs, prim * (nn - 1 - eras_pos[i])); | ||
for (j = i + 1; j > 0; j--) { | ||
tmp = index_of[lambda[j - 1]]; | ||
if (tmp != nn) { | ||
lambda[j] ^= | ||
lambda[j] ^= | ||
alpha_to[rs_modnn(rs, u + tmp)]; | ||
} | ||
} | ||
|
@@ -127,8 +127,8 @@ | |
discr_r = 0; | ||
for (i = 0; i < r; i++) { | ||
if ((lambda[i] != 0) && (s[r - i - 1] != nn)) { | ||
discr_r ^= | ||
alpha_to[rs_modnn(rs, | ||
discr_r ^= | ||
alpha_to[rs_modnn(rs, | ||
index_of[lambda[i]] + | ||
s[r - i - 1])]; | ||
} | ||
|
@@ -143,7 +143,7 @@ | |
t[0] = lambda[0]; | ||
for (i = 0; i < nroots; i++) { | ||
if (b[i] != nn) { | ||
t[i + 1] = lambda[i + 1] ^ | ||
t[i + 1] = lambda[i + 1] ^ | ||
alpha_to[rs_modnn(rs, discr_r + | ||
b[i])]; | ||
} else | ||
|
@@ -229,7 +229,7 @@ | |
num1 = 0; | ||
for (i = deg_omega; i >= 0; i--) { | ||
if (omega[i] != nn) | ||
num1 ^= alpha_to[rs_modnn(rs, omega[i] + | ||
num1 ^= alpha_to[rs_modnn(rs, omega[i] + | ||
i * root[j])]; | ||
} | ||
num2 = alpha_to[rs_modnn(rs, root[j] * (fcr - 1) + nn)]; | ||
|
@@ -239,13 +239,13 @@ | |
* lambda_pr of lambda[i] */ | ||
for (i = min(deg_lambda, nroots - 1) & ~1; i >= 0; i -= 2) { | ||
if (lambda[i + 1] != nn) { | ||
den ^= alpha_to[rs_modnn(rs, lambda[i + 1] + | ||
den ^= alpha_to[rs_modnn(rs, lambda[i + 1] + | ||
i * root[j])]; | ||
} | ||
} | ||
/* Apply error to data */ | ||
if (num1 != 0 && loc[j] >= pad) { | ||
uint16_t cor = alpha_to[rs_modnn(rs,index_of[num1] + | ||
uint16_t cor = alpha_to[rs_modnn(rs,index_of[num1] + | ||
index_of[num2] + | ||
nn - index_of[den])]; | ||
/* Store the error correction pattern, if a | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
/* | ||
/* | ||
* lib/reed_solomon/encode_rs.c | ||
* | ||
* Overview: | ||
* Generic Reed Solomon encoder / decoder library | ||
* | ||
* | ||
* Copyright 2002, Phil Karn, KA9Q | ||
* May be used under the terms of the GNU General Public License (GPL) | ||
* | ||
* Adaption to the kernel by Thomas Gleixner ([email protected]) | ||
* | ||
* $Id: encode_rs.c,v 1.4 2004/10/22 15:41:47 gleixner Exp $ | ||
* $Id: encode_rs.c,v 1.5 2005/11/07 11:14:59 gleixner Exp $ | ||
* | ||
*/ | ||
|
||
/* Generic data width independent code which is included by the | ||
/* Generic data width independent code which is included by the | ||
* wrappers. | ||
* int encode_rsX (struct rs_control *rs, uintX_t *data, int len, uintY_t *par) | ||
*/ | ||
|
@@ -35,16 +35,16 @@ | |
for (i = 0; i < len; i++) { | ||
fb = index_of[((((uint16_t) data[i])^invmsk) & msk) ^ par[0]]; | ||
/* feedback term is non-zero */ | ||
if (fb != nn) { | ||
if (fb != nn) { | ||
for (j = 1; j < nroots; j++) { | ||
par[j] ^= alpha_to[rs_modnn(rs, fb + | ||
par[j] ^= alpha_to[rs_modnn(rs, fb + | ||
genpoly[nroots - j])]; | ||
} | ||
} | ||
/* Shift */ | ||
memmove(&par[0], &par[1], sizeof(uint16_t) * (nroots - 1)); | ||
if (fb != nn) { | ||
par[nroots - 1] = alpha_to[rs_modnn(rs, | ||
par[nroots - 1] = alpha_to[rs_modnn(rs, | ||
fb + genpoly[0])]; | ||
} else { | ||
par[nroots - 1] = 0; | ||
|
Oops, something went wrong.