ECC

A collection of error correction code (ECC) algorithms.

Hamming_ERROR_NONE

Hamming Code implementation for 256byte data segments.

1
0

Hamming_ERROR_SINGLEBIT

A single bit was incorrect but has been recovered.

1
1
Hamming_ERROR_ECC

The original code has been corrupted.

1
2
Hamming_ERROR_MULTIPLEBITS

Multiple bits are incorrect in the data and they cannot be corrected.

1
3
void hamming_compute256x(const uint8_t * data, uint32_t size, uint8_t * code)

Computes 3-bytes hamming codes for a data block whose size is multiple of 256 bytes.

Each 256 bytes block gets its own code.

Parameters

data:Data to compute code for.
size:Data size in bytes.
code:Codes buffer.

uint8_t hamming_verify256x(uint8_t * data, uint32_t size, const uint8_t * code)

Verifies 3-bytes hamming codes for a data block whose size is multiple of 256 bytes.

Each 256-bytes block is verified with its own code.

Parameters

data:Data buffer to verify.
size:Size of the data in bytes.
code:Original codes.

Return values

  • Hamming_ERROR_NONE if the data is correct, Hamming_ERROR_SINGLEBIT if one or more block(s) have had a single bit corrected, or either Hamming_ERROR_ECC or Hamming_ERROR_MULTIPLEBITS.