Other Parts Discussed in Thread: OMAPL138, OMAP-L138
Hi,
I wrote a piece of code to parse the bin file generated by AIS tool, which checked the CRC option. However, the result calculated by my program using the CRC algorithm in the spraat2f file does not match the result in the bin file. I use the funtion below, the parameters I pass in are the section's data address, section's data size , and crc value pass in is 0, Is there a problem with the algorithm funtion?Can you provide the AIS calculation code?
static Uint32 LOCAL_updateCRC (Uint8 *data_ptr, Uint32
section_size, Uint32 crc)
{
Uint32 i;
// Prepare input to get back into calculation state (this means
// initial input when starting fresh should be 0x00000000 )
crc = crc ^ 0xFFFFFFFF;
// Perform the algorithm on each byte
for (i = 0; i < section_size; i++)
{
crc = (crc >> 8) ^ CRC_Lut[(crc & 0xFF) ^ data_ptr[i]];
}
// Exclusive OR the result with the specified value
crc = (crc ^ 0xFFFFFFFF);
return crc;
}