crc32.c File Reference

Go to the source code of this file.

Functions

unsigned int crc32 (unsigned int crc, char *buf, int len)
unsigned int download_crc32 (char *databuf, int length)

Variables

static const unsigned int crc32_table [256]


Function Documentation

unsigned int crc32 ( unsigned int  crc,
char *  buf,
int  len 
)

Definition at line 156 of file crc32.c.

References end().

Referenced by download_crc32().

00157 {
00158   char *end;
00159 
00160   crc = ~crc;
00161   for (end = buf + len; buf < end; ++buf)
00162     crc = crc32_table[(crc ^ *buf) & 0xff] ^ (crc >> 8);
00163   return ~crc;
00164 }

Here is the call graph for this function:

unsigned int download_crc32 ( char *  databuf,
int  length 
)

Definition at line 168 of file crc32.c.

References crc32().

00169 {
00170     unsigned int crc32_val = 0x0;
00171 //    char databuf[1000] = {0x12,0x98,0x45,0x78,0xba,0};
00172 //    init_crc32_table();
00173     //crc32_val = GenerateCRC32(databuf,length);
00174     crc32_val = crc32(0,databuf,length);
00175     printf("CRC is 0x%x \n",crc32_val);
00176     return crc32_val;
00177 }

Here is the call graph for this function:


Variable Documentation

const unsigned int crc32_table[256] [static]

Definition at line 100 of file crc32.c.


Generated on Fri Nov 5 07:24:46 2010 for ejtag debug tools for loongson 232 cpu by  doxygen 1.5.6