E t h e r n e t M o d u l e

memcpy (copy_mca, mca, sizeof (copy_mca)); for (index = 0; index < 3’ index++)

{

copy_mca [index] = SWAP16 (copy_mca [index]);

}

mcap = copy mca; crc = 0xffffffffL;

for (mca_word = 0; mca_word < 3; mca_word++)

{

bp = *mcap; mcap++;

for (bit_index = 0; bit_index < 16; bit_index++)

{

bx = (WORD16) (crc >> 16); bx = rotate (bx, LEFT, 1); bx ^+ bp;

crc <<=1; bx &= 1; if (bx)

{

/* get high word of crc*/ /* bit 31 to lsb*/

/* combine with incoming*/ /* shift crc left 1 bit*/ /* get control bit*/

/* if bit set*/

crc ^= POLYNOMIAL;

/*

xero crc with polynomial*/

}

 

 

crc = bx;

/*

or in control bit*/

}

}

//CRC calculation done. The 6-bit result resides in bit

//locations 28:23

result = (crc >> 23) & 0x3f;

return result;

}

w w w . d i g i . c o m

2 0 7

Page 221
Image 221
Digi NS7520 manual W . d i g i . c o m