An194 – Cirrus Logic AN194 User Manual
Page 2
Advertising

AN194
2
AN194REV1
#define BYTE unsigned char
#define WORD int
#define DWORD int long
#include <stdio.h>
BYTE CalculateHashIndex(BYTE *pMulticastAddr);
void main();
void updatecrc( int bit );
int crc_poly[] = {1,1,1,0, 1,1,0,1,
1,0,1,1, 1,0,0,0,
1,0,0,0, 0,0,1,1,
0,0,1,0, 0,0,0,0
},
CRC[33];
void main ()
{
BYTE hash_index;
BYTE multicastaddr[5];
/* just a made up address
0x4d in byte 0 should hash to bit 63
of hash filter.
Changing the first byte to 0x85 will
hash to bit 0 of the hash filter
*/
multicastaddr[0] = 0x4d;
multicastaddr[1] = 0x00;
multicastaddr[2] = 0x00;
multicastaddr[3] = 0x00;
multicastaddr[4] = 0x00;
multicastaddr[5] = 0x00;
hash_index = CalculateHashIndex( multicastaddr );
printf("%d\n",hash_index);
(void) getchar();
Advertising