Digi NS9750 User Manual

Page 425

Advertising
background image

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

4 0 1

E t h e r n e t C o m m u n i c a t i o n M o d u l e

mcap++;

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

{

bx = (WORD16) (crc >> 16);

/* get high word of crc*/

bx = rotate (bx, LEFT, 1);

/* bit 31 to lsb*/

bx ^= bp;

/* combine with incoming*/

crc <<= 1;

/* shift crc left 1 bit*/

bx &= 1;

/* get control bit*/

if (bx)

/* if bit set*/

{

crc ^= POLYNOMIAL;

/* xero crc with polynomial*/

}

crc |= bx:

/* or in control bit*/

bp = rotate (bp, RIGHT, 1);

}

}

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

// locations 28:23

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

return result;

}

Advertising