Part Number Hot Search : 
CDRH5D HN9C15FT CDRH5D AN413 BAS40W MPM3506A 8T25A BF1211
Product Description
Full Text Search
 

To Download AN194-1 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
 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 register. 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 the IAHash 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 (c) Cirrus Logic, Inc. 2000 (All Rights Reserved)
OCT `00 AN194REV1 1
AN194
#define BYTE unsigned char #define WORD int #define DWORD int long #include BYTE CalculateHashIndex(BYTE *pMulticastAddr); void main(); void updatecrc( int bit );
int crc_poly[] = {1,1,1,0, 1,0,1,1, 1,0,0,0, 1,0,0,0, 0,0,1,0, }, CRC[33];
1,1,0,1, 0,0,1,1, 0,0,0,0
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
AN194
} /****************************************************************************** * * CalculateHashIndex() * ******************************************************************************/ BYTE CalculateHashIndex( BYTE *pMulticastAddr ) { BYTE BYTE int int HashIndex; AddrByte; Byte; 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]; */
AN194REV1
3
AN194
} return HashIndex; } /* end of CalculateHashIndex() */ void updatecrc( int bit ) { int j; /* >> 1 the crc, use high bit (now CRC[32]) as control bit */ for (j = 32; j > 0; j--) CRC[j] = CRC[j - 1]; CRC[0] = 0; /* if bit ^ (control bit) = 1, set CRC = CRC ^ polynomial */ if (bit ^ CRC[32]) { for ( j = 0; j < 32; j++) { CRC[j] ^= crc_poly[j]; } } }
4
AN194REV1
AN194
Here is a sample list of addresses and the corresponding hash bit. This is only a sample -- many addresses can hash to a particular bit.
Address 85 00 00 00 00 00 A5 00 00 00 00 00 E5 00 00 00 00 00 C5 00 00 00 00 00 45 00 00 00 00 00 65 00 00 00 00 00 25 00 00 00 00 00 05 00 00 00 00 00 2B 00 00 00 00 00 0B 00 00 00 00 00 4B 00 00 00 00 00 6B 00 00 00 00 00 EB 00 00 00 00 00 CB 00 00 00 00 00 8B 00 00 00 00 00 BB 00 00 00 00 00 C7 00 00 00 00 00 E7 00 00 00 00 00 A7 00 00 00 00 00 87 00 00 00 00 00 07 00 00 00 00 00 27 00 00 00 00 00 67 00 00 00 00 00 47 00 00 00 00 00 69 00 00 00 00 00 49 00 00 00 00 00 09 00 00 00 00 00 29 00 00 00 00 00 A9 00 00 00 00 00 89 00 00 00 00 00 C9 00 00 00 00 00 E9 00 00 00 00 00
Hash Table Filter Bit 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
Address 21 00 00 00 00 00 01 00 00 00 00 00 41 00 00 00 00 00 71 00 00 00 00 00 E1 00 00 00 00 00 C1 00 00 00 00 00 81 00 00 00 00 00 A1 00 00 00 00 00 8F 00 00 00 00 00 BF 00 00 00 00 00 EF 00 00 00 00 00 CF 00 00 00 00 00 4F 00 00 00 00 00 6F 00 00 00 00 00 2F 00 00 00 00 00 0F 00 00 00 00 00 63 00 00 00 00 00 43 00 00 00 00 00 03 00 00 00 00 00 23 00 00 00 00 00 A3 00 00 00 00 00 83 00 00 00 00 00 C3 00 00 00 00 00 E3 00 00 00 00 00 CD 00 00 00 00 00 ED 00 00 00 00 00 AD 00 00 00 00 00 8D 00 00 00 00 00 0D 00 00 00 00 00 2D 00 00 00 00 00 6D 00 00 00 00 00 4D 00 00 00 00 00
Hash Table Filter Bit 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
AN194REV1
5


▲Up To Search▲   

 
Price & Availability of AN194-1

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X