u16 GetCheckCode(unsigned char *ptr, unsigned char len)

{

u16 Code;

u8 i,j;

Code = 0xffff;

for(i=0;i<len;i++)

{

Code ^= ptr[i];

for(j=0;j<8;j++)

{

if(Code&0x0001)

{

Code >>= 1;

Code ^= 0xa001;

}

else

{

Code >>= 1;

}

}

}

return (Code);

}