A collection of error correction code (ECC) algorithms. More...

Detailed Description

#define Hamming_ERROR_NONE   0
 Hamming Code implementation for 256byte data segments. More...
 
#define Hamming_ERROR_SINGLEBIT   1
 A single bit was incorrect but has been recovered. More...
 
#define Hamming_ERROR_ECC   2
 The original code has been corrupted. More...
 
#define Hamming_ERROR_MULTIPLEBITS   3
 Multiple bits are incorrect in the data and they cannot be corrected. More...
 
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. More...
 
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. More...
 

Macro Definition Documentation

#define Hamming_ERROR_ECC   2

Definition at line 35 of file hamming256.h.

#define Hamming_ERROR_MULTIPLEBITS   3

Definition at line 38 of file hamming256.h.

#define Hamming_ERROR_NONE   0
Author
Lucas Jenß lucas.nosp@m.@x3r.nosp@m.o.deNo bit errors were detected in the message

Definition at line 29 of file hamming256.h.

#define Hamming_ERROR_SINGLEBIT   1

Definition at line 32 of file hamming256.h.

Function Documentation

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

Each 256 bytes block gets its own code.

Parameters
[in]dataData to compute code for.
[in]sizeData size in bytes.
[out]codeCodes buffer.
uint8_t hamming_verify256x ( uint8_t *  data,
uint32_t  size,
const uint8_t *  code 
)

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

Returns
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.
Parameters
[in]dataData buffer to verify.
[in]sizeSize of the data in bytes.
[in]codeOriginal codes.