ECC算法解读
来源:互联网 发布:淘宝比较好的布料店 编辑:程序博客网 时间:2024/04/29 06:08
最近要在NandFlash中实现ECC校验,贴一个例子吧,代码来自三星:
/*****************************************************************************/
/* */
/* PROJECT : SAMSUNG ECC */
/* FILE : SAMSUNG_ECC.c */
/* PURPOSE : This file implements core ECC algorithms adopted */
/* Hamming Error Correction and Detection Algorithm */
/* */
/*---------------------------------------------------------------------------*/
/* */
/* COPYRIGHT 2000-2004, SAMSUNG ELECTRONICS CO., LTD. */
/* ALL RIGHTS RESERVED */
/* */
/* Permission is hereby granted to licensees of Samsung Electronics */
/* Co., Ltd. products to use or abstract this computer program for the */
/* sole purpose of implementing a product based on Samsung */
/* Electronics Co., Ltd. products. No other rights to reproduce, use, */
/* or disseminate this computer program, whether in part or in whole, */
/* are granted. */
/* */
/* Samsung Electronics Co., Ltd. makes no representation or warranties */
/* with respect to the performance of this computer program, and */
/* specifically disclaims any responsibility for any damages, */
/* special or consequential, connected with the use of this program. */
/* */
/*---------------------------------------------------------------------------*/
/* */
/* REVISION HISTORY */
/* */
/* 13-NOV-2003 [Chang JongBaek] : first writing */
/* 03-MAR-2004 [ Kim YoungGon ] : Second writing */
/* 03-MAR-2004 [ Lee JaeBum ] : Third writing */
/*---------------------------------------------------------------------------*/
/* */
/* NOTES */
/* */
/* - Make ECC parity code of 512bytes(256words) and 3 bytes are represented */
/* And ECC compare & Correction code is also represented */
/* */
/*****************************************************************************/
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <string.h>
//#include "ecc.h"
#define XMODE 8
/*****************************************************************************/
/* Address Types */
/*****************************************************************************/
typedef unsigned char * address_t; /* address (pointer) */
typedef unsigned long address_value_t; /* address (for calculation) */
/*****************************************************************************/
/* Integer Types */
/*****************************************************************************/
typedef unsigned long uint32_t; /* unsigned 4 byte integer */
typedef signed long int32_t; /* signed 4 byte integer */
typedef unsigned short uint16_t; /* unsigned 2 byte integer */
typedef signed short int16_t; /* signed 2 byte integer */
typedef unsigned char uint8_t; /* unsigned 1 byte integer */
typedef signed char int8_t; /* signed 1 byte integer */
typedef enum {
ECC_NO_ERROR = 0, /* no error */
ECC_CORRECTABLE_ERROR = 1, /* one bit data error */
ECC_ECC_ERROR = 2, /* one bit ECC error */
ECC_UNCORRECTABLE_ERROR = 3 /* uncorrectable error */
} eccdiff_t;
/*****************************************************************************/
/* */
/* NAME */
/* make_ecc_512 */
/* DESCRIPTION */
/* This function generates 3 byte ECC for 512 byte data. */
/* (Software ECC) */
/* PARAMETERS */
/* ecc_buf the location where ECC should be stored */
/* data_buf given data */
/* RETURN VALUES */
/* none */
/* */
/*****************************************************************************/
#if (XMODE == 8)
void make_ecc_512(uint8_t * ecc_buf, uint8_t * data_buf)
#else
void make_ecc_512(uint16_t * ecc_buf, uint16_t * data_buf)
#endif
{
uint32_t i, ALIGN_FACTOR;
uint32_t tmp;
uint32_t uiparity = 0;
uint32_t parityCol, ecc = 0;
uint32_t parityCol4321 = 0, parityCol4343 = 0, parityCol4242 = 0, parityColTot = 0;
uint32_t *Data;
uint32_t Xorbit=0;
ALIGN_FACTOR = (uint32_t)data_buf % 4 ;
Data = (uint32_t *)(data_buf + ALIGN_FACTOR);
for( i = 0; i < 16; i++)
{
parityCol = *Data++;
tmp = *Data++; parityCol ^= tmp; parityCol4242 ^= tmp;
tmp = *Data++; parityCol ^= tmp; parityCol4343 ^= tmp;
tmp = *Data++; parityCol ^= tmp; parityCol4343 ^= tmp; parityCol4242 ^= tmp;
tmp = *Data++; parityCol ^= tmp; parityCol4321 ^= tmp;
tmp = *Data++; parityCol ^= tmp; parityCol4242 ^= tmp; parityCol4321 ^= tmp;
tmp = *Data++; parityCol ^= tmp; parityCol4343 ^= tmp; parityCol4321 ^= tmp;
tmp = *Data++; parityCol ^= tmp; parityCol4242 ^= tmp; parityCol4343 ^= tmp; parityCol4321 ^= tmp;
parityColTot ^= parityCol;
tmp = (parityCol >> 16) ^ parityCol;
tmp = (tmp >> 8) ^ tmp;
tmp = (tmp >> 4) ^ tmp;
tmp = ((tmp >> 2) ^ tmp) & 0x03;
if ((tmp == 0x01) || (tmp == 0x02))
{
uiparity ^= i;
Xorbit ^= 0x01;
}
}
#if (XMODE == 8)
tmp = (parityCol4321 >> 16) ^ parityCol4321;
tmp = (tmp << 8) ^ tmp;
tmp = (tmp >> 4) ^ tmp;
tmp = (tmp >> 2) ^ tmp;
ecc |= ((tmp << 1) ^ tmp) & 0x200; // p128
#else
tmp = (parityCol4321 >> 16) ^ parityCol4321;
tmp = (tmp >> 8) ^ tmp;
tmp = (tmp << 4) ^ tmp;
tmp = (tmp << 2) ^ tmp;
ecc |= ((tmp << 1) ^ tmp) & 0x80; // p128
#endif
#if (XMODE == 8)
tmp = (parityCol4343 >> 16) ^ parityCol4343;
tmp = (tmp >> 8) ^ tmp;
tmp = (tmp << 4) ^ tmp;
tmp = (tmp << 2) ^ tmp;
ecc |= ((tmp << 1) ^ tmp) & 0x80; // p64
#else
tmp = (parityCol4343 >> 16) ^ parityCol4343;
tmp = (tmp >> 8) ^ tmp;
tmp = (tmp << 4) ^ tmp;
tmp = (tmp >> 2) ^ tmp;
ecc |= ((tmp << 1) ^ tmp) & 0x20; // p64
#endif
#if (XMODE == 8)
tmp = (parityCol4242 >> 16) ^ parityCol4242;
tmp = (tmp >> 8) ^ tmp;
tmp = (tmp << 4) ^ tmp;
tmp = (tmp >> 2) ^ tmp;
ecc |= ((tmp << 1) ^ tmp) & 0x20; // p32
#else
tmp = (parityCol4242 >> 16) ^ parityCol4242;
tmp = (tmp >> 8) ^ tmp;
tmp = (tmp >> 4) ^ tmp;
tmp = (tmp << 2) ^ tmp;
ecc |= ((tmp << 1) ^ tmp) & 0x08; // p32
#endif
#if (XMODE == 8)
tmp = parityColTot & 0xFFFF0000;
tmp = tmp >> 16;
tmp = (tmp >> 8) ^ tmp;
tmp = (tmp >> 4) ^ tmp;
tmp = (tmp << 2) ^ tmp;
ecc |= ((tmp << 1) ^ tmp) & 0x08; // p16
#else
tmp = parityColTot & 0xFFFF0000;
tmp = tmp >> 16;
tmp = (tmp >> 8) ^ tmp;
tmp = (tmp >> 4) ^ tmp;
tmp = (tmp >> 2) ^ tmp;
ecc |= ((tmp << 1) ^ tmp) & 0x02; // p16
#endif
#if (XMODE == 8)
tmp = parityColTot & 0xFF00FF00;
tmp = (tmp >> 16) ^ tmp;
tmp = (tmp >> 8);
tmp = (tmp >> 4) ^ tmp;
tmp = (tmp >> 2) ^ tmp;
ecc |= ((tmp << 1) ^ tmp) & 0x02; // p8
#else
tmp = parityColTot & 0xFF00FF00;
tmp = (tmp << 16) ^ tmp;
tmp = (tmp >> 8);
tmp = (tmp << 4) ^ tmp;
tmp = (tmp << 2) ^ tmp;
ecc |= ((tmp << 1) ^ tmp) & 0x800000; // p8
#endif
#if (XMODE == 8)
tmp = parityColTot & 0xF0F0F0F0 ;
tmp = (tmp << 16) ^ tmp;
tmp = (tmp >> 8) ^ tmp;
tmp = (tmp << 2) ^ tmp;
ecc |= ((tmp << 1) ^ tmp) & 0x800000; // p4
#else
tmp = parityColTot & 0xF0F0F0F0 ;
tmp = (tmp << 16) ^ tmp;
tmp = (tmp >> 8) ^ tmp;
tmp = (tmp >> 2) ^ tmp;
ecc |= ((tmp << 1) ^ tmp) & 0x200000; // p4
#endif
#if (XMODE == 8)
tmp = parityColTot & 0xCCCCCCCC ;
tmp = (tmp << 16) ^ tmp;
tmp = (tmp >> 8) ^ tmp;
tmp = (tmp << 4) ^ tmp;
tmp = (tmp >> 2);
ecc |= ((tmp << 1) ^ tmp) & 0x200000; // p2
#else
tmp = parityColTot & 0xCCCCCCCC ;
tmp = (tmp << 16) ^ tmp;
tmp = (tmp >> 8) ^ tmp;
tmp = (tmp >> 4) ^ tmp;
ecc |= ((tmp << 1) ^ tmp) & 0x80000; // p2
#endif
#if (XMODE == 8)
tmp = parityColTot & 0xAAAAAAAA ;
tmp = (tmp << 16) ^ tmp;
tmp = (tmp >> 8) ^ tmp;
tmp = (tmp >> 4) ^ tmp;
tmp = (tmp << 2) ^ tmp;
ecc |= (tmp & 0x80000); // p1
#else
tmp = parityColTot & 0xAAAAAAAA ;
tmp = (tmp << 16) ^ tmp;
tmp = (tmp >> 8) ^ tmp;
tmp = (tmp >> 4) ^ tmp;
tmp = (tmp >> 2) ^ tmp;
ecc |= (tmp & 0x20000); // p1
#endif
#if (XMODE == 8)
ecc |= (uiparity & 0x01) <<11;
ecc |= (uiparity & 0x02) <<12;
ecc |= (uiparity & 0x04) <<13;
ecc |= (uiparity & 0x08) <<14;
#else
ecc |= (uiparity & 0x01) <<9;
ecc |= (uiparity & 0x02) <<10;
ecc |= (uiparity & 0x04) <<11;
ecc |= (uiparity & 0x08) <<12;
#endif
if (Xorbit)
{
ecc |= (ecc ^ 0x00AAAAAA)>>1;
}
else
{
ecc |= (ecc >> 1);
}
#if (XMODE == 8)
ecc = ~ecc;
*(ecc_buf + 2) = (uint8_t) (ecc >> 16);
*(ecc_buf + 1) = (uint8_t) (ecc >> 8);
*(ecc_buf + 0) = (uint8_t) (ecc);
#else // X16
ecc = ( ~ecc ) | 0xFF000000;
*(ecc_buf + 1) = (uint16_t) (ecc >> 16);
*(ecc_buf + 0) = (uint16_t) (ecc);
#endif
}
/*****************************************************************************/
/* */
/* NAME */
/* compare_ecc_512 */
/* DESCRIPTION */
/* This function compares two ECCs and indicates if there is an error. */
/* PARAMETERS */
/* ecc_data1 one ECC to be compared */
/* ecc_data2 the other ECC to be compared */
/* page_data content of data page */
/* offset where the error occurred */
/* corrected correct data */
/* RETURN VALUES */
/* Upon successful completion, compare_ecc returns SSR_SUCCESS. */
/* Otherwise, corresponding error code is returned. */
/* */
/*****************************************************************************/
#if (XMODE == 8)
eccdiff_t compare_ecc_512(uint8_t *iEccdata1, uint8_t *iEccdata2,
uint8_t *pPagedata, int32_t *pOffset, uint8_t *pCorrected)
#else // X16
eccdiff_t compare_ecc_512(uint16_t *iEccdata1, uint16_t *iEccdata2,
uint16_t *pPagedata, int32_t *pOffset, uint16_t *pCorrected)
#endif
{
uint32_t iCompecc = 0, iEccsum = 0;
uint32_t iFindbyte = 0;
uint32_t iIndex;
uint32_t nT1 = 0, nT2 =0;
#if (XMODE == 8)
uint8_t iNewvalue;
uint8_t iFindbit = 0;
uint8_t *pEcc1 = (uint8_t *)iEccdata1;
uint8_t *pEcc2 = (uint8_t *)iEccdata2;
for ( iIndex = 0; iIndex <2; iIndex++)
{
nT1 ^= (((*pEcc1) >> iIndex) & 0x01);
nT2 ^= (((*pEcc2) >> iIndex) & 0x01);
}
for (iIndex = 0; iIndex < 3; iIndex++)
iCompecc |= ((~(*pEcc1++) ^ ~(*pEcc2++)) << iIndex * 8);
for(iIndex = 0; iIndex < 24; iIndex++) {
iEccsum += ((iCompecc >> iIndex) & 0x01);
}
#else // X16
uint16_t iNewvalue;
uint16_t iFindbit = 0;
uint16_t *pEcc1 = (uint16_t *)iEccdata1;
uint16_t *pEcc2 = (uint16_t *)iEccdata2;
for ( iIndex = 0; iIndex <2; iIndex++)
{
nT1 ^= (((*pEcc1) >> iIndex) & 0x01);
nT2 ^= (((*pEcc2) >> iIndex) & 0x01);
}
for (iIndex = 0; iIndex < 2; iIndex++) // 2 word of ECC data
iCompecc |= (((~*pEcc1++) ^ (~*pEcc2++)) << iIndex * 16);
for(iIndex = 0; iIndex < 24; iIndex++) {
iEccsum += ((iCompecc >> iIndex) & 0x01);
}
#endif
switch (iEccsum) {
case 0 :
printf("RESULT : no error\n");
return ECC_NO_ERROR;
case 1 :
printf("RESULT : ECC code 1 bit fail\n");
return ECC_ECC_ERROR;
case 12 :
if (nT1 != nT2)
{
#if (XMODE == 8)
iFindbyte = ((iCompecc >> 17 & 1) << 8) + ((iCompecc >> 15 & 1) << 7) + ((iCompecc >> 13 & 1) << 6)
+ ((iCompecc >> 11 & 1) << 5) + ((iCompecc >> 9 & 1) << 4) + ((iCompecc >> 7 & 1) << 3)
+ ((iCompecc >> 5 & 1) << 2) + ((iCompecc >> 3 & 1) << 1) + (iCompecc >> 1 & 1);
iFindbit = (uint8_t)(((iCompecc >> 23 & 1) << 2) + ((iCompecc >> 21 & 1) << 1) + (iCompecc >> 19 & 1));
iNewvalue = (uint8_t)(pPagedata[iFindbyte] ^ (1 << iFindbit));
#else // CASE_X16
iFindbyte = ((iCompecc >> 15 & 1) << 7) + ((iCompecc >> 13 & 1) << 6)
+ ((iCompecc >> 11 & 1) << 5) + ((iCompecc >> 9 & 1) << 4) + ((iCompecc >> 7 & 1) << 3)
+ ((iCompecc >> 5 & 1) << 2) + ((iCompecc >> 3 & 1) << 1) + (iCompecc >> 1 & 1) ;
iFindbit = (uint16_t)(((iCompecc >> 23 & 1) << 3) + ((iCompecc >> 21 & 1) << 2) + ((iCompecc >> 19 & 1) << 1)
+ (iCompecc >> 17 & 1) );
iNewvalue = (uint16_t)(pPagedata[iFindbyte] ^ (1 << iFindbit));
#endif
printf("iCompecc = %d\n",iCompecc);
printf("RESULT : one bit error\r\n");
printf("byte = %d, bit = %d\r\n", iFindbyte, iFindbit);
printf("corrupted = %x, corrected = %x\r\n", pPagedata[iFindbyte], iNewvalue);
if (pOffset != NULL) {
*pOffset = iFindbyte;
}
if (pCorrected != NULL) {
*pCorrected = iNewvalue;
}
return ECC_CORRECTABLE_ERROR;
}
else
return ECC_UNCORRECTABLE_ERROR;
default :
printf("RESULT : unrecoverable error\n");
return ECC_UNCORRECTABLE_ERROR;
}
}
/***************************************************************/
/****************** ECC512 demo example *********************/
/***************************************************************/
uint8_t data_1[512]={
0xEB,0x58,0x90,0x4D,0x53,0x44,0x4F,0x53,0x35,0x2E,0x30,0x00,0x02,0x08,0x22,0x00,
0x02,0x00,0x00,0x00,0x00,0xF8,0x00,0x00,0x3F,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,
0x01,0xA0,0x0F,0x00,0xE7,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
0x01,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x29,0xD3,0xDA,0x8E,0x38,0x4E,0x4F,0x20,0x4E,0x41,0x4D,0x45,0x20,0x20,
0x20,0x20,0x46,0x41,0x54,0x33,0x32,0x20,0x20,0x20,0x33,0xC9,0x8E,0xD1,0xBC,0xF4,
0x7B,0x8E,0xC1,0x8E,0xD9,0xBD,0x00,0x7C,0x88,0x4E,0x02,0x8A,0x56,0x40,0xB4,0x08,
0xCD,0x13,0x73,0x05,0xB9,0xFF,0xFF,0x8A,0xF1,0x66,0x0F,0xB6,0xC6,0x40,0x66,0x0F,
0xB6,0xD1,0x80,0xE2,0x3F,0xF7,0xE2,0x86,0xCD,0xC0,0xED,0x06,0x41,0x66,0x0F,0xB7,
0xC9,0x66,0xF7,0xE1,0x66,0x89,0x46,0xF8,0x83,0x7E,0x16,0x00,0x75,0x38,0x83,0x7E,
0x2A,0x00,0x77,0x32,0x66,0x8B,0x46,0x1C,0x66,0x83,0xC0,0x0C,0xBB,0x00,0x80,0xB9,
0x01,0x00,0xE8,0x2B,0x00,0xE9,0x48,0x03,0xA0,0xFA,0x7D,0xB4,0x7D,0x8B,0xF0,0xAC,
0x84,0xC0,0x74,0x17,0x3C,0xFF,0x74,0x09,0xB4,0x0E,0xBB,0x07,0x00,0xCD,0x10,0xEB,
0xEE,0xA0,0xFB,0x7D,0xEB,0xE5,0xA0,0xF9,0x7D,0xEB,0xE0,0x98,0xCD,0x16,0xCD,0x19,
0x66,0x60,0x66,0x3B,0x46,0xF8,0x0F,0x82,0x4A,0x00,0x66,0x6A,0x00,0x66,0x50,0x06,
0x53,0x66,0x68,0x10,0x00,0x01,0x00,0x80,0x7E,0x02,0x00,0x0F,0x85,0x20,0x00,0xB4,
0x41,0xBB,0xAA,0x55,0x8A,0x56,0x40,0xCD,0x13,0x0F,0x82,0x1C,0x00,0x81,0xFB,0x55,
0xAA,0x0F,0x85,0x14,0x00,0xF6,0xC1,0x01,0x0F,0x84,0x0D,0x00,0xFE,0x46,0x02,0xB4,
0x42,0x8A,0x56,0x40,0x8B,0xF4,0xCD,0x13,0xB0,0xF9,0x66,0x58,0x66,0x58,0x66,0x58,
0x66,0x58,0xEB,0x2A,0x66,0x33,0xD2,0x66,0x0F,0xB7,0x4E,0x18,0x66,0xF7,0xF1,0xFE,
0xC2,0x8A,0xCA,0x66,0x8B,0xD0,0x66,0xC1,0xEA,0x10,0xF7,0x76,0x1A,0x86,0xD6,0x8A,
0x56,0x40,0x8A,0xE8,0xC0,0xE4,0x06,0x0A,0xCC,0xB8,0x01,0x02,0xCD,0x13,0x66,0x61,
0x0F,0x82,0x54,0xFF,0x81,0xC3,0x00,0x02,0x66,0x40,0x49,0x0F,0x85,0x71,0xFF,0xC3,
0x4E,0x54,0x4C,0x44,0x52,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0D,0x0A,0x52,0x65,
0x6D,0x6F,0x76,0x65,0x20,0x64,0x69,0x73,0x6B,0x73,0x20,0x6F,0x72,0x20,0x6F,0x74,
0x68,0x65,0x72,0x20,0x6D,0x65,0x64,0x69,0x61,0x2E,0xFF,0x0D,0x0A,0x44,0x69,0x73,
0x6B,0x20,0x65,0x72,0x72,0x6F,0x72,0xFF,0x0D,0x0A,0x50,0x72,0x65,0x73,0x73,0x20,
0x61,0x6E,0x79,0x20,0x6B,0x65,0x79,0x20,0x74,0x6F,0x20,0x72,0x65,0x73,0x74,0x61,
0x70,0x74,0x0D,0x0A,0x00,0x00,0x00,0x00,0x00,0xAC,0xCB,0xD8,0x00,0x00,0x55,0xAA,
};
uint8_t data_2[512]={
0xEB,0x58,0x90,0x4D,0x53,0x44,0x4F,0x53,0x35,0x2E,0x30,0x00,0x02,0x08,0x22,0x00,
0x02,0x00,0x00,0x00,0x00,0xF8,0x00,0x00,0x3F,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,
0x01,0xA0,0x0F,0x00,0xE7,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,
0x01,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x29,0xD3,0xDA,0x8E,0x38,0x4E,0x4F,0x20,0x4E,0x41,0x4D,0x45,0x20,0x20,
0x20,0x20,0x46,0x41,0x54,0x33,0x32,0x20,0x20,0x20,0x33,0xC9,0x8E,0xD1,0xBC,0xF4,
0x7B,0x8E,0xC1,0x8E,0xD9,0xBD,0x00,0x7C,0x88,0x4E,0x02,0x8A,0x56,0x40,0xB4,0x08,
0xCD,0x13,0x73,0x05,0xB9,0xFF,0xFF,0x8A,0xF1,0x66,0x0F,0xB6,0xC6,0x40,0x66,0x0F,
0xB6,0xD1,0x80,0xE2,0x3F,0xF7,0xE2,0x86,0xCD,0xC0,0xED,0x06,0x41,0x66,0x0F,0xB7,
0xC9,0x66,0xF7,0xE1,0x66,0x89,0x46,0xF8,0x83,0x7E,0x16,0x00,0x75,0x38,0x83,0x7E,
0x2A,0x00,0x77,0x32,0x66,0x8B,0x46,0x1C,0x66,0x83,0xC0,0x0C,0xBB,0x00,0x80,0xB9,
0x01,0x00,0xE8,0x2B,0x00,0xE9,0x48,0x03,0xA0,0xFA,0x7D,0xB4,0x7D,0x8B,0xF0,0xAC,
0x84,0xC0,0x74,0x17,0x3C,0xFF,0x74,0x09,0xB4,0x0E,0xBB,0x07,0x00,0xCD,0x10,0xEB,
0xEE,0xA0,0xFB,0x7D,0xEB,0xE5,0xA0,0xF9,0x7D,0xEB,0xE0,0x98,0xCD,0x16,0xCD,0x19,
0x66,0x60,0x66,0x3B,0x46,0xF8,0x0F,0x82,0x4A,0x00,0x66,0x6A,0x00,0x66,0x50,0x06,
0x53,0x66,0x68,0x10,0x00,0x01,0x00,0x80,0x7E,0x02,0x00,0x0F,0x85,0x20,0x00,0xB4,
0x41,0xBB,0xAA,0x55,0x8A,0x56,0x40,0xCD,0x13,0x0F,0x82,0x1C,0x00,0x81,0xFB,0x55,
0xAA,0x0F,0x85,0x14,0x00,0xF6,0xC1,0x01,0x0F,0x84,0x0D,0x00,0xFE,0x46,0x02,0xB4,
0x42,0x8A,0x56,0x40,0x8B,0xF4,0xCD,0x13,0xB0,0xF9,0x66,0x58,0x66,0x58,0x66,0x58,
0x66,0x58,0xEB,0x2A,0x66,0x33,0xD2,0x66,0x0F,0xB7,0x4E,0x18,0x66,0xF7,0xF1,0xFE,
0xC2,0x8A,0xCA,0x66,0x8B,0xD0,0x66,0xC1,0xEA,0x10,0xF7,0x76,0x1A,0x86,0xD6,0x8A,
0x56,0x40,0x8A,0xE8,0xC0,0xE4,0x06,0x0A,0xCC,0xB8,0x01,0x02,0xCD,0x13,0x66,0x61,
0x0F,0x82,0x54,0xFF,0x81,0xC3,0x00,0x02,0x66,0x40,0x49,0x0F,0x85,0x71,0xFF,0xC3,
0x4E,0x54,0x4C,0x44,0x52,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0D,0x0A,0x52,0x65,
0x6D,0x6F,0x76,0x65,0x20,0x64,0x69,0x73,0x6B,0x73,0x20,0x6F,0x72,0x20,0x6F,0x74,
0x68,0x65,0x72,0x20,0x6D,0x65,0x64,0x69,0x61,0x2E,0xFF,0x0D,0x0A,0x44,0x69,0x73,
0x6B,0x20,0x65,0x72,0x72,0x6F,0x72,0xFF,0x0D,0x0A,0x50,0x72,0x65,0x73,0x73,0x20,
0x61,0x6E,0x79,0x20,0x6B,0x65,0x79,0x20,0x74,0x6F,0x20,0x72,0x65,0x73,0x74,0x61,
//0x70,0x74,0x0D,0x0A,0x00,0x00,0x00,0x00,0x00,0xAC,0xCB,0xD8,0x00,0x00,0x55,0xAA,
0x78,0x74,0x0D,0x0A,0x00,0x00,0x00,0x00,0x00,0xAC,0xCB,0xD8,0x00,0x00,0x55,0xAA,
};
void main(void)
{
uint8_t ecc_code_1[3];
uint8_t ecc_code_2[3];
int32_t ofset=0;
uint8_t correct=0;
uint8_t ecc_ret= 0;
make_ecc_512(ecc_code_1,data_1);
make_ecc_512(ecc_code_2,data_2);
printf("ecc_code_1_0 = %d\n",ecc_code_1[0]);
printf("ecc_code_1_1 = %d\n",ecc_code_1[1]);
printf("ecc_code_1_2 = %d\n",ecc_code_1[2]);
printf("******************************\n");
printf("ecc_code_2_0 = %d\n",ecc_code_2[0]);
printf("ecc_code_2_1 = %d\n",ecc_code_2[1]);
printf("ecc_code_2_2 = %d\n",ecc_code_2[2]);
printf("******************************\n");
ecc_ret = compare_ecc_512(ecc_code_1,ecc_code_2,data_2,&ofset,&correct);
//printf("ofset = %d\n",ofset);
//printf("correct = %x\n",correct);
//printf("ecc_ret = %d\n",ecc_ret);
printf("******************************\n");
}
- ECC算法解读
- 解读ECC加密算法
- ECC/EDC算法
- ECC算法问题。
- ECC算法介绍
- ECC关键算法实现
- ECC纠错算法
- ecc算法入门介绍
- OpenSSL ECC 算法
- Nand Flash 的ECC算法
- ECC算法的详细说明
- ECC算法的详细说明
- ECC算法原理的认识
- 算法:ECC加密算法原理介绍
- ECC
- ECC
- ECC
- ECC
- 编程语言之C++的学习
- 人物描写的基本方法
- 自绘滚动条
- SQLite(二): Java操作SQLite
- centos安装启动ssh服务
- ECC算法解读
- Python Web开发介绍(二) -Web.py模板使用中的问题
- HOJ 2615 Pie ---------------二分查找的运用
- Linux CentOS下Hadoop伪分布模式安装笔记
- Magento PHP Extension "curl" must be loaded解决方法
- AsyncTask使用须知
- 不加班做不出好游戏
- hibernate多对多单向关联_XML
- 使用JDBC进行批处理