2 * Copyright (C) 1995 Advanced RISC Machines Limited. All rights reserved.
4 * This software may be freely used, copied, modified, and distributed
5 * provided that the above copyright notice is preserved in all copies of the
15 * crc.h - describes some "standard" CRC calculation routines.
25 * When using "crc32" or "crc16" these initial CRC values must be given to
26 * the respective function the first time it is called. The function can
27 * then be called with the return value from the last call of the function
28 * to generate a running CRC over multiple data blocks.
29 * When the last data block has been processed using the "crc32" algorithm
30 * the CRC value should be inverted to produce the final CRC value:
34 #define startCRC32 (0xFFFFFFFF) /* CRC initialised to all 1s */
35 #define startCRC16 (0x0000) /* CRC initialised to all 0s */
38 * For the CRC-32 residual to be calculated correctly requires that the CRC
39 * value is in memory little-endian due to the byte read, bit-ordering
40 * nature of the algorithm.
42 #define CRC32residual (0xDEBB20E3) /* good CRC-32 residual */
45 /**********************************************************************/
53 * Purpose: Provides a table driven implementation of the IEEE-802.3
54 * 32-bit CRC algorithm for byte data.
57 * Input: address pointer to the byte data
58 * size number of bytes of data to be processed
59 * crc initial CRC value to be used (can be the output
60 * from a previous call to this function).
62 * OK: 32-bit CRC value for the specified data
64 extern unsigned int crc32(unsigned char *address
, unsigned int size
,
67 /**********************************************************************/
72 * Purpose: Generates a table driven 16-bit CRC-CCITT for byte data
75 * Input: address pointer to the byte data
76 * size number of bytes of data to be processed
77 * crc initial CRC value to be used (can be the output
78 * from a previous call to this function).
81 * OK: 16-bit CRC value for the specified data
83 extern unsigned short crc16(unsigned char *address
, unsigned int size
,
86 /**********************************************************************/
88 #endif /* !defined(angel_crc_h) */
This page took 0.031462 seconds and 4 git commands to generate.