www.pudn.com > efs.rar > fs_hc.h


#ifndef __HC__HEADER__H__
#define __HC__HEADER__H__

/******************************************************************************
 * fs_hc.c
 *
 * This function implements the Hamming Code ECC algorithm for 4 bytes
 *
 * Copyright (C) 2006 Qualcomm, Inc.  All Rights Reserved
 *
 *****************************************************************************/

/*=============================================================================

                        EDIT HISTORY FOR MODULE

  This section contains comments describing changes made to the module.
  Notice that changes are listed in reverse chronological order.

  $Header: //depot/asic/MSMSHARED/services/efs/MSM_EFS.01.02/fs_hc.h#1 $
  $DateTime: 2006/06/08 10:00:24 $
  $Author: davidb $

when         who     what, where, why
--------     ---     ----------------------------------------------------------
2006-03-30   yg      Implemented Hamming Code correction algorithm for 4 bytes
=============================================================================*/

#include "comdef.h"

#define DECODE_OK       0
#define DECODE_ERROR    1

/******************************************************************************
FUNCTION      hc_encode

DESCRIPTION   Encode 22 bits of data passed in with Hamming code ECC

DEPENDENCIES  None

RETURN VALUE  10 bits HC ECC parity data.
******************************************************************************/
uint16 hc_encode (uint32 edata);

/******************************************************************************
FUNCTION      hc_decode

DESCRIPTION   Decode the stored number after calcuating HC ECC and correcting
              the data if necessary and possible.

DEPENDENCIES  MSB 10 bits being ECC that was calculated.

RETURN VALUE
              DECODE_OK     : If there was no error or corrected data properly
              DECODE_ERROR  : Error in correction (possibly multibit errors).
              *dptr         : Corrected data in the destination location.

******************************************************************************/
uint16 hc_decode (uint32 *dptr);

#endif /* __HC__HEADER__H__ */