| [1] | 1 | /*******************************************************************\
|
|---|
| 2 | * *
|
|---|
| 3 | * Library : lib_crc *
|
|---|
| 4 | * File : lib_crc.h *
|
|---|
| 5 | * Author : Lammert Bies 1999-2008 *
|
|---|
| 6 | * E-mail : info@lammertbies.nl *
|
|---|
| 7 | * Language : ANSI C *
|
|---|
| 8 | * *
|
|---|
| 9 | * *
|
|---|
| 10 | * Description *
|
|---|
| 11 | * =========== *
|
|---|
| 12 | * *
|
|---|
| 13 | * The file lib_crc.h contains public definitions and proto- *
|
|---|
| 14 | * types for the CRC functions present in lib_crc.c. *
|
|---|
| 15 | * *
|
|---|
| 16 | * *
|
|---|
| 17 | * Dependencies *
|
|---|
| 18 | * ============ *
|
|---|
| 19 | * *
|
|---|
| 20 | * none *
|
|---|
| 21 | * *
|
|---|
| 22 | * *
|
|---|
| 23 | * Modification history *
|
|---|
| 24 | * ==================== *
|
|---|
| 25 | * *
|
|---|
| 26 | * Date Version Comment *
|
|---|
| 27 | * *
|
|---|
| 28 | * 2008-04-20 1.16 Added CRC-CCITT routine for Kermit *
|
|---|
| 29 | * *
|
|---|
| 30 | * 2007-04-01 1.15 Added CRC16 calculation for Modbus *
|
|---|
| 31 | * *
|
|---|
| 32 | * 2007-03-28 1.14 Added CRC16 routine for Sick devices *
|
|---|
| 33 | * *
|
|---|
| 34 | * 2005-12-17 1.13 Added CRC-CCITT with initial 0x1D0F *
|
|---|
| 35 | * *
|
|---|
| 36 | * 2005-02-14 1.12 Added CRC-CCITT with initial 0x0000 *
|
|---|
| 37 | * *
|
|---|
| 38 | * 2005-02-05 1.11 Fixed bug in CRC-DNP routine *
|
|---|
| 39 | * *
|
|---|
| 40 | * 2005-02-04 1.10 Added CRC-DNP routines *
|
|---|
| 41 | * *
|
|---|
| 42 | * 2005-01-07 1.02 Changes in tst_crc.c *
|
|---|
| 43 | * *
|
|---|
| 44 | * 1999-02-21 1.01 Added FALSE and TRUE mnemonics *
|
|---|
| 45 | * *
|
|---|
| 46 | * 1999-01-22 1.00 Initial source *
|
|---|
| 47 | * *
|
|---|
| 48 | \*******************************************************************/
|
|---|
| 49 |
|
|---|
| 50 |
|
|---|
| 51 |
|
|---|
| 52 | #define CRC_VERSION "1.16"
|
|---|
| 53 |
|
|---|
| 54 |
|
|---|
| 55 |
|
|---|
| 56 | #define FALSE 0
|
|---|
| 57 | #define TRUE 1
|
|---|
| 58 |
|
|---|
| 59 |
|
|---|
| 60 |
|
|---|
| 61 | unsigned short update_crc_16( unsigned short crc, char c );
|
|---|
| 62 | unsigned long update_crc_32( unsigned long crc, char c );
|
|---|
| 63 | unsigned short update_crc_ccitt( unsigned short crc, char c );
|
|---|
| 64 | unsigned short update_crc_dnp( unsigned short crc, char c );
|
|---|
| 65 | unsigned short update_crc_kermit( unsigned short crc, char c );
|
|---|
| 66 | unsigned short update_crc_sick( unsigned short crc, char c, char prev_byte );
|
|---|