CH579 Ethernet Hash table

Good day!

For some reasons I want to handle multicast packets with CH579 Ethernet. As it contain only single perfect match filter, I need to use hash table (R32_ETH_HTL/R32_ETH_HTH) to accept only needed multicasts. Can you point me to code example of calculating hash table settings?

Hello,

? ?? if you want to handle muticast packets, the hash table should set at this:

? ?? MacCrc32 = CRC6Bit(MultiMac);
? ?? if(MacCrc32 > 31)
? ?? {
? ? ?? MacCrc32 -=32;
? ? ?? Hash1 |= ((UINT32)1<? ?? }
? ?? else
? ?? {
? ? ?? Hash0 |= ((UINT32)1<? ?? }?
? ?? R32_ETH_HTL? = Hash0; ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??
? ?? R32_ETH_HTH? = Hash1;

? ? ?

? ?? Funcation CRC6Bit of which is below:

? ? ?UINT8 CRC6Bit(UINT8 *mac_addr)
? ?? {
? ? ? ? INT32 perByte;
? ? ? ? INT32 perBit;
? ? ? ? const UINT32 poly = 0x04C11DB7;
? ? ? ? UINT32 crc_value = 0xFFFFFFFF;
? ? ? ? UINT8 c;
? ? ? ? for ( perByte = 0; perByte < 6; perByte ++ )
? ? ? ? {
? ? ? ? ? ? c = *(mac_addr++);
? ? ? ? ? ? for ( perBit = 0; perBit < 8; perBit++ )
? ? ? ? ? ? {
? ? ? ? ? ? ? ? crc_value = (crc_value<<1)^((((crc_value>>31)^c)&0x01)?poly:0);
? ? ? ? ? ? ? ? c >>= 1;
? ? ? ? ? ? }
? ? ? ? }
? ? ? ? crc_value=crc_value>>26;?????????????????????????????????????
? ? ? ? return ((UINT8)crc_value);
? ?
}


?? Besides, MacFilts has to be set in only way:

? ?R8_ETH_ERXFCON |= RB_ETH_ERXFCON_HTEN;

?? It should be set followed by register "R32_ETH_HTH" being set. Otherwise, if you use UDP muticast, then the other type ?? network are not? commended being used together.?


只有登錄才能回復(fù),可以選擇微信賬號(hào)登錄

国产91精品新入口,国产成人综合网在线播放,九热这里只有精品,本道在线观看,美女视频a美女视频,韩国美女激情视频,日本美女pvp视频