diff options
author | Stan Shebs <shebs@codesourcery.com> | 1999-04-16 01:35:26 +0000 |
---|---|---|
committer | Stan Shebs <shebs@codesourcery.com> | 1999-04-16 01:35:26 +0000 |
commit | c906108c21474dfb4ed285bcc0ac6fe02cd400cc (patch) | |
tree | a0015aa5cedc19ccbab307251353a41722a3ae13 /gdb/rdi-share/crc.h | |
parent | cd946cff9ede3f30935803403f06f6ed30cad136 (diff) | |
download | gdb-c906108c21474dfb4ed285bcc0ac6fe02cd400cc.zip gdb-c906108c21474dfb4ed285bcc0ac6fe02cd400cc.tar.gz gdb-c906108c21474dfb4ed285bcc0ac6fe02cd400cc.tar.bz2 |
Initial creation of sourceware repositorygdb-4_18-branchpoint
Diffstat (limited to 'gdb/rdi-share/crc.h')
-rw-r--r-- | gdb/rdi-share/crc.h | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/gdb/rdi-share/crc.h b/gdb/rdi-share/crc.h new file mode 100644 index 0000000..77ba23e --- /dev/null +++ b/gdb/rdi-share/crc.h @@ -0,0 +1,90 @@ +/* + * Copyright (C) 1995 Advanced RISC Machines Limited. All rights reserved. + * + * This software may be freely used, copied, modified, and distributed + * provided that the above copyright notice is preserved in all copies of the + * software. + */ + +/* -*-C-*- + * + * $Revision$ + * $Date$ + * + * + * crc.h - describes some "standard" CRC calculation routines. + */ +#ifndef angel_crc_h +#define angel_crc_h + +/* + * manifests + */ + +/* + * When using "crc32" or "crc16" these initial CRC values must be given to + * the respective function the first time it is called. The function can + * then be called with the return value from the last call of the function + * to generate a running CRC over multiple data blocks. + * When the last data block has been processed using the "crc32" algorithm + * the CRC value should be inverted to produce the final CRC value: + * e.g. CRC = ~CRC + */ + +#define startCRC32 (0xFFFFFFFF) /* CRC initialised to all 1s */ +#define startCRC16 (0x0000) /* CRC initialised to all 0s */ + +/* + * For the CRC-32 residual to be calculated correctly requires that the CRC + * value is in memory little-endian due to the byte read, bit-ordering + * nature of the algorithm. + */ +#define CRC32residual (0xDEBB20E3) /* good CRC-32 residual */ + + +/**********************************************************************/ + +/* + * exported functions + */ + +/* + * Function: crc32 + * Purpose: Provides a table driven implementation of the IEEE-802.3 + * 32-bit CRC algorithm for byte data. + * + * Params: + * Input: address pointer to the byte data + * size number of bytes of data to be processed + * crc initial CRC value to be used (can be the output + * from a previous call to this function). + * Returns: + * OK: 32-bit CRC value for the specified data + */ +extern unsigned int crc32(unsigned char *address, unsigned int size, + unsigned int crc); + +/**********************************************************************/ + +/* + * + * Function: crc16 + * Purpose: Generates a table driven 16-bit CRC-CCITT for byte data + * + * Params: + * Input: address pointer to the byte data + * size number of bytes of data to be processed + * crc initial CRC value to be used (can be the output + * from a previous call to this function). + * + * Returns: + * OK: 16-bit CRC value for the specified data + */ +extern unsigned short crc16(unsigned char *address, unsigned int size, + unsigned short crc); + +/**********************************************************************/ + +#endif /* !defined(angel_crc_h) */ + +/* EOF crc.h */ |