Hello Pascal ,
I am calling given bellow function in 10ms task to calculate checkmate of ROM by performing summation of entire ROM. after compliting summation adding 2's compliment of Result in sum so i will get it zero (0).
bool Calculate_Checksum16_Slice(const uint16_t __far* data, uint32_t size, uint32_t* index, uint16_t* sum)
{
bool checksum_complete;
/* If about to sum the first value in data, clear the sum. */
if (0 == *index)
{
*sum = 0;
}
/* If haven't reached the end of data, add the next word to the sum. */
if (*index < size)
{
*sum += *(uint16_t __far*)(uint32_t)(data + *index); /* Equivalent to data[index]. */
*index += 1 ;
checksum_complete = false;
}
else
{
*index = 0;
checksum_complete = true;
*sum = (~(*sum) + 1) + *sum;
}
return checksum_complete;
}
Thanks & Regards,
Charudatta