Atmel Software Framework

ecc-sw.h File Reference
#include "ecc.h"

Functions

int ecc_compare_block_256b (unsigned long *ecc_calc, unsigned long *ecc_oob, 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...
 

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.

Parameters
ecc1Pointer to a variable for ECC value to compare against ecc2.
ecc2Pointer to a variable for ECC value to compare against ecc1.
dataPointer to a 256 byte large buffer used when calculating the ecc1 and ecc2 ECC values.
error_offsetPointer to a variable to store the byte offset of a detected single bit error.
corrected_valuePointer to a variable to store the corrected byte if a single bit error was detected.
Returns
0 on success, an error number otherwise.

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.

Parameters
eccPointer to a variable to store the calculated ECC.
dataPointer to a 256 byte large buffer to calculate the ECC value of.

References data, ecc_parity_table, i, and NAND_ECC_CHUNK_SIZE.