B-14 Computer Group Literature Center Web Site

MVME5100 VPD Reference Information

BConfiguration Checksum Calculation Code
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
* cssect - checksum section
* description:
* This component's purpose is to checksum the buffer pointed to
* by the buffer pointer.
* notes:
* call:
* argument #1 = buffer (section) to checksum
* argument #2 = number of bytes in buffer
* return:
* 0xXX = checksum
*/
UCHAR
cssect(nvram_ptr, count)
register UCHAR *nvram_ptr; /* NVRAM buffer pointer */
register UINT count; /* count, number of bytes */
{
register UCHAR y, isum, sum;
for (sum = 0; count; count--) {
y = *nvram_ptr++;
isum = sum + y;
if ((isum < y) || (isum < sum)) isum += 1;
sum = isum;
}
return (sum); /* return calculated checksum */
}