Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:lib\reed_solomon\reed_solomon.c Create Date:2022-07-28 06:59:08
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:dec_init - Initialize a Reed-Solomon codec*@symsize: symbol size, bits (1-8)*@gfpoly: Field generator polynomial coefficients*@gffunc: Field generator function*@fcr: first root of RS code generator polynomial, index form*@prim: primitive element to

Proto:static struct rs_codec *codec_init(int symsize, int gfpoly, int (*gffunc)(int ), int fcr, int prim, int nroots, gfp_t gfp)

Type:struct rs_codec

Parameter:

TypeParameterName
intsymsize
intgfpoly
int (*gffunc
intfcr
intprim
intnroots
gfp_tgfp
76  rs = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc).
77  If Not rs Then Return NULL
80  Initialization list head
82  mm = symsize
83  nn = (1 << symsize) - 1
84  fcr = fcr
85  prim = prim
86  nroots = nroots
87  gfpoly = gfpoly
88  gffunc = gffunc
91  alpha_to = kmalloc_array - allocate memory for an array.*@n: number of elements.*@size: element size.*@flags: the type of memory to allocate (see kmalloc).
92  If (alpha_to == NULL) Then Go to err
95  index_of = kmalloc_array - allocate memory for an array.*@n: number of elements.*@size: element size.*@flags: the type of memory to allocate (see kmalloc).
96  If (index_of == NULL) Then Go to err
99  genpoly = kmalloc_array - allocate memory for an array.*@n: number of elements.*@size: element size.*@flags: the type of memory to allocate (see kmalloc).
100  If (genpoly == NULL) Then Go to err
104  index_of[0] = nn
105  alpha_to[nn] = 0
106  If gfpoly Then
107  sr = 1
108  When i < nn cycle
109  index_of[sr] = i
110  alpha_to[i] = sr
111  sr <<= 1
112  If sr & 1 << symsize Then sr ^= gfpoly
114  sr &= nn
116  Else
117  sr = gffunc(0)
118  When i < nn cycle
119  index_of[sr] = i
120  alpha_to[i] = sr
121  sr = gffunc(sr)
125  If sr != alpha_to[0] Then Go to err
129  When iprim % prim != 0 cycle iprim = iprim / prim
134  genpoly[0] = 1
135  When i < nroots cycle
136  genpoly[i + 1] = 1
138  When j > 0 cycle
139  If genpoly[j] != 0 Then
143  Else genpoly[j] = genpoly[j - 1]
147  genpoly[0] = alpha_to[modulo replacement for galois field arithmetics*@rs: Pointer to the RS codec*@x: the value to reduce* where* Simple arithmetic modulo would return a wrong result for values* >= 3 * rs->nn]
152  When i <= nroots cycle genpoly[i] = index_of[genpoly[i]]
155  users = 1
156  list_add - add a new entry*@new: new entry to be added*@head: list head to add it after* Insert a new entry after the specified head.* This is good for implementing stacks.
157  Return rs
159  err :
160  kfree(genpoly)
161  kfree(index_of)
162  kfree(alpha_to)
163  kfree(rs)
164  Return NULL
Caller
NameDescribe
init_rs_internal_rs_internal - Allocate rs control, find a matching codec or allocate a new one*@symsize: the symbol size (number of bits)*@gfpoly: the extended Galois field generator polynomial coefficients,* with the 0th coefficient in the low order bit