AN194
Application Note
HOW TO PROGRAM THE HASH TABLE FILTER IN THE
CS8900A AND CS8920A
In some instances you may want to accept more
addresses than a single individual address.
Multicast addresses would be one use. You also
need to have additional addresses when doing
bridging functions.
You can accept additional addresses using the Hash
Table Filter. The Hash Table Filter is a 64-bit
register where each bit corresponds to the hashed
value of an Ethernet address.
For example, you need to accept two individual
addresses. You program the first address into the
individual address register.
The second address requires a little more work.
First you run the address through the same hash
algorithm that the CS89xxA uses. Based on that
result you set the correct bit in the Hash Table
Filter.
Now you should know if this is a multicast address
or just another individual address. If the additional
address is a multicast address, you set the
MulticastA bit in the RxCTL registe r. If the address
is an individual address you set IAHash bit in the
RxCTL register.
IMPORTANT: Each bit in the Hash Table Filter
corresponds to many possible addresses. So, it is
possible that once you set the right bits the chip will
accept the frames you want and also frames you
don’t want. This is because the some frames you
don’t want have addresses that hash to the same bit
as the address you want.
So, to ensure you only pass on the correct frames to
your operating system or program you have to do
an additional software check on the destination
address. You do this by keeping a list of additional
addresses in the software driver that you want to
accept. When a frame comes in and t he IAHa sh or
Hashed status bits set in the Receive Event status
register then you look for a match in your list. If the
destination address has a match in your list then
you would pass that frame on. If there is no match
then it was just a random frame that happened to
match a bit you set in the Hash Table Filter. You
simply discard it.
Here is an algorithm that you can use to determine
which bit to set in the CS89xxA hash table to
receive a particular address
This algorithm can also be found by going to the
drivers page for the CS8900A and downloading
hash.zip.
P.O. Box 17847, Austin, Texas 78760
(512) 445 7222 FAX: (512) 445 7581
http://www.cirrus.com
Copyright Cirrus Logic, Inc. 2000
(All Rights Reserved)
OCT ‘00
AN194REV1
1
#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];
AN194
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();
2 AN194REV1