odd parity 的计算方法,仅供参考。
uint8 l9945_oddParityCalcu(uint32 datain)
{
uint32 dataIn_uint32;
uint32 result_uint32 = 0;
uint32 debug_uint32;
uint16 i;
dataIn_uint32 = datain;
for(i = 1; i < 32; i++)
{
debug_uint32 = ((dataIn_uint32>>i)&0x00000001);
result_uint32 += debug_uint32;
}
/*
* PARITY - Parity bit, based on even parity calculation
0: If the number of 1 is odd
1: If the number of 1 is even
* */
if(result_uint32%2 == 1)
{
return 0; //the number of 1 is odd
}
else
{
return 1;
}
}