Functions | |
int | ecc_compare_block_256b (unsigned long *ecc1, unsigned long *ecc2, unsigned char *data, unsigned long *error_offset, unsigned char *corrected_value) |
Compare two ECCs for a 256 byte block. More... | |
void | ecc_make_block_256b (unsigned long *ecc, unsigned char *data) |
Generate ECC for a 256 byte block. More... | |
Variables | |
static const unsigned char | ecc_parity_table [] |
Pre-calculated parity table. More... | |
int ecc_compare_block_256b | ( | unsigned long * | ecc1, |
unsigned long * | ecc2, | ||
unsigned char * | data, | ||
unsigned long * | error_offset, | ||
unsigned char * | corrected_value | ||
) |
Compare two ECCs for a 256 byte block.
This function will compare two 3 byte ECC for a 256 byte data block. If an error is found the compare function will provide a fix if a single one bit error is found. Multiple errors are not possible to fix.
ecc1 | Pointer to a variable for ECC value to compare against ecc2. |
ecc2 | Pointer to a variable for ECC value to compare against ecc1. |
data | Pointer to a 256 byte large buffer used when calculating the ecc1 and ecc2 ECC values. |
error_offset | Pointer to a variable to store the byte offset of a detected single bit error. |
corrected_value | Pointer to a variable to store the corrected byte if a single bit error was detected. |
References i.
void ecc_make_block_256b | ( | unsigned long * | ecc, |
unsigned char * | data | ||
) |
Generate ECC for a 256 byte block.
This function will generate a 3 byte ECC for a 256 byte data block.
ecc | Pointer to a variable to store the calculated ECC. |
data | Pointer to a 256 byte large buffer to calculate the ECC value of. |
References data, ecc_parity_table, i, and NAND_ECC_CHUNK_SIZE.
|
static |
Pre-calculated parity table.
This table is a pre-calculation of the 256 possible parities used when calculating ECC. Each value in this table represents a 6-bit value of the column parity and a 1-bit value of the row parity.
Storage form: null [7], row parity [6], column parity [5:0]
Referenced by ecc_make_block_256b().