Programmer’s Guide BCM5722
10/15/07
Broadcom Corporation
Document 5722-PG101-R Packet Filtering Page 98
CHECKING CRC
The following steps describe a method to check a stream of bytes, which has a CRC appended.
1. Set remainder to 0xFFFFFFFF.
2. For each bit of data starting with least-significant bit of each byte:
If right-most bit (bit-0) of the current remainder XORed with the data bit equal 1,
then remainder = (remainder shifted right one bit) XOR 0xEDB88320,
else remainder = (remainder shifted right one bit).
3. Remainder should equal magic value 0xDEBB20E3 if CRC is correct.
INITIALIZING THE MAC HASH REGISTERS
The 128-bit multicast hash table is treated as a single object occupying four BCM5722 Ethernet controller registers starting
at offset 0x0470 (see Table 43). The 128-bit value follows the big-endian ordering required by BCM5722 Ethernet controller.
Thus, the most significant 32-bit of the 128-bit value resides in Mac_Hash_Register_0 at offset 0x0470 and the least
significant 32-bit resides in Mac_Hash_Register_3 at offset 0x047c.
Host software can enable the reception of all multicast frames including broadcast frames by setting all four multicast hash
registers to 0xFFFFFFFF.
The C code fragment below will illustrate how to initialize the multicast hash table registers. The code fragment computes
the indices into hash table from a given list of multicast addresses and initializes the multicast hash registers.
Unsigned long HashReg[4];
Unsigned long j, McEntryCnt;
Unsigned char McTable[32][6];// List of multicast addresses to accept.
// Initialize the McTable here.
McEntryCnt = 32;
// Initialize the multicast table registers.
HashReg[0] = 0; // Mac_Hash_Regsiter_0 at offset 0x0470.
HashReg[1] = 0; // Mac_Hash_Register_1 at offset 0x0474.
HashReg[2] = 0; // Mac_Hash_Register_2 at offset 0x0478.
HashReg[3] = 0; // Mac_Hash_Register_3 at offset 0x047c.
for(j = 0; j < McEntryCnt; j++)
{
unsigned long RegIndex;
unsigned long Bitpos;
unsigned long Crc32;
Crc32 = ComputeCrc32(McTable[j], 6);
Table 43: Multicast Hash Table Registers
Register Name Offset Description
Mac_Hash_Register_0 0x0470 Most significant 32-bit of the 128-bit hash table
Mac_Hash_Register_1 0x0474 Bits 64:93 of the 128-bit hash table
Mac_Hash_Register_2 0x0478 Bits 32:63 of the 128-bit hash table
Mac_Hash_Register_3 0x047c Least significant 32-bit of the 128-bit hash table