Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:decode_bch - decode received codeword and find bit error locations*@bch: BCH control structure*@data: received data, ignored if @calc_ecc is provided*@len: data length in bytes, must always be provided*@recv_ecc: received ecc, if NULL then assume it was

Proto:int decode_bch(struct bch_control *bch, const uint8_t *data, unsigned int len, const uint8_t *recv_ecc, const uint8_t *calc_ecc, const unsigned int *syn, unsigned int *errloc)

Type:int

Parameter:

TypeParameterName
struct bch_control *bch
const uint8_t *data
unsigned intlen
const uint8_t *recv_ecc
const uint8_t *calc_ecc
const unsigned int *syn
unsigned int *errloc
1000  ecc_words = BCH_ECC_WORDS(bch)
1006  If 8 * len > n - ecc_bits Then Return -EINVAL
1010  If Not syn Then
1011  If Not calc_ecc Then
1013  If Not data || Not recv_ecc Then Return -EINVAL
1016  Else
1021  If recv_ecc Then
1024  When i < ecc_words cycle
1025  ecc_buf[i] ^= ecc_buf2[i]
1026  sum |= ecc_buf[i]
1028  If Not sum Then Return 0
1032  mpute 2t syndromes of ecc polynomial, i.e. ecc(a^j) for j=1..2t
1033  syn = syn
1036  err = compute_error_locator_polynomial(bch, syn)
1037  If err > 0 Then
1038  nroots = d roots of a polynomial, using BTZ algorithm; see the beginning of this* file for details
1039  If err != nroots Then err = -1
1042  If err > 0 Then
1044  nbits = len * 8 + ecc_bits
1045  When i < err cycle
1046  If errloc[i] >= nbits Then
1047  err = -1
1048  Break
1050  errloc[i] = nbits - 1 - errloc[i]
1051  errloc[i] = errloc[i] & ~7 | 7 - (errloc[i] & 7)
1054  Return If err >= 0 Then err Else -EBADMSG