English
Language : 

TNETX15AEPGE Datasheet, PDF (52/79 Pages) Texas Instruments – ADDRESS-LOOKUP DEVICE
TNETX15AE
ADDRESS-LOOKUP DEVICE
SPWS041A – AUGUST 1997 – REVISED OCTOBER 1997
PRINCIPLES OF OPERATION
EEPROM initialization/automatic loading (LOAD) (continued)
The last four bytes read by the automatic loader correspond to a 32-bit CRC value for the information stored
in the EEPROM. The CRC value is calculated by using the following callable C routine, which assumes that the
data to be examined is loaded into an array eeprom_data [ ]:
void ifexeeprom (char *cs)
{
long crc;
int k;
crc = 0xffffffffl;
for (k=0;k<=38;k++)
{
crcbyt (eeprom_data[k], &crc);
}
crc ^= 0xffffffffl;
eeprom_data[k++]=(int) ((crc >> 24) & 0x0ffl);
eeprom_data[k++]=(int) ((crc >> 16) & 0x0ffl);
eeprom_data[k++]=(int) ((crc >> 8) & 0x0ffl);
eeprom_data[k++]=(int) ((crc
) & 0x0ffl);
}
crcbyt (dat,crc)
int dat;
long *crc;
{
int i;
for (i=0;i<8;i++)
{
crcbit(dat>>7,crc);
dat = dat <<1;
}
}
crcbit (dat,crc)
int dat;
long *crc;
{
if ( (((*crc>>31) & 11)^((long)dat & 11)) ==1)
{
*crc ^= 0x02608edbl;
*crc = *crc <<1;
*crc |= 0x00000001l;
}
else
{
*crc = *crc <<1;
*crc &= 0xfffffffel;
}
}
In this example, the values for which the CRC is calculated are placed in the eeprom_data[] array from offset
0 to 38 (0x26). The routine crcbyt is called for each byte. The C routine then places the calculated CRC values
in the eeprom_data[] array at locations 39 to 42 (0x27 to 0x2A).
52
• POST OFFICE BOX 655303 DALLAS, TEXAS 75265