Cirrus-logic AN194 User Manual Page 3

  • Download
  • Add to my manuals
  • Print
  • Page
    / 6
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 2
AN194
AN194REV1 3
}
/******************************************************************************
*
* CalculateHashIndex()
*
******************************************************************************/
BYTE CalculateHashIndex( BYTE *pMulticastAddr )
{
BYTE HashIndex;
BYTE AddrByte;
int Byte;
int Bit, j;
/* Prime the CRC */
for (j = 0; j < 32; j++ ) CRC[j] = 1;
/* For each of the six bytes of the multicast address */
for ( Byte=0; Byte<6; Byte++ )
{
/*
printf("\n%2.2x", *pMulticastAddr);
(void) getchar();
*/
AddrByte = *pMulticastAddr++;
/* For each bit of the byte */
for ( Bit=0; Bit<8; Bit++ )
{
updatecrc( (AddrByte >> Bit) & 1 );
}
}
/* Take the least significant six bits of the CRC and copy them */
/* to the HashIndex in reverse order. */
HashIndex = 0;
for( Bit=0,HashIndex=0; Bit<6; Bit++ )
{
HashIndex = (HashIndex << 1) + CRC[Bit];
Page view 2
1 2 3 4 5 6

Comments to this Manuals

No comments