lib/include/fec.h File Reference

Forward Error Corretion routines. More...

#include "inttypes.h"
#include "mos.h"

Go to the source code of this file.

Defines

#define MAXIMUM_PARITY_BYTES   64
 Maximum allowed number of parity bytes.
#define MAXIMUM_IMPLEMENTED_PARITY_BYTES   8
#define FEC_NO_ERRORS   0
 Return value if fec_decode detects no errors.
#define FEC_CORRECTED_ERRORS   1
 Return value if fec_decode is able to fix all errors.
#define FEC_UNCORRECTABLE_ERRORS   2
 Return value if fec_decode cannot fix all errors.

Functions

void fec_init (uint8_t parity_bytes)
 Initalize the fec subsystem to the specified number of parity bytes.
uint8_t fec_get_parity_bytes ()
 Return the number of parity bytes the FEC subsystem is currently using.
void fec_encode (uint8_t *src, uint8_t len, uint8_t *parity_ptr)
 Encode the parity bytes for a portion of memory.
uint8_t fec_decode (uint8_t *src, uint8_t len, uint8_t *fec_ptr)
 Use FEC to correct errors if possible.


Detailed Description

Note: this is adapted from rscode, http://rscode.sf.net

Definition in file fec.h.


Function Documentation

uint8_t fec_decode uint8_t *  src,
uint8_t  len,
uint8_t *  fec_ptr
 

Note: this function actually changes the passed in buffer if it is possible to fix errors. Also note that for every 2 parity bytes, one byte error can be fixed.

Parameters:
src location to start Forward Error Correction
len how much memory (in bytes) to preform FEC on
fec_ptr location of parity bytes.
Returns:
one of FEC_NO_ERRORS, FEC_CORRECTED_ERRORS, FEC_UNCORRECTABLE_ERRORS

void fec_encode uint8_t *  src,
uint8_t  len,
uint8_t *  parity_ptr
 

Parameters:
src Place in memory to start computing FEC parity bytes for
len how much memory (in bytes) to compute the FEC parity bytes for
parity_ptr Location in memory to store the computed parity bytes.

uint8_t fec_get_parity_bytes  ) 
 

Returns:
number of parity bytes

void fec_init uint8_t  parity_bytes  ) 
 

Parameters:
parity_bytes Number of parity bytes to be used in FEC


Generated on Mon Nov 23 06:25:59 2009 for MANTIS by  doxygen 1.4.6