WizziLab / CRC

Dependents:   D7A_1x_demo_CodeUpgradeProtocol D7A_1x_demo_big_file D7A_1x_demo_sensors_v3 D7A_1x_demo_send_file_data

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers crc.h Source File

crc.h

00001     /*******************************************************************\
00002     *                                                                   *
00003     *   Library         : lib_crc                                       *
00004     *   File            : lib_crc.h                                     *
00005     *   Author          : Lammert Bies  1999-2008                       *
00006     *   E-mail          : info@lammertbies.nl                           *
00007     *   Language        : ANSI C                                        *
00008     *                                                                   *
00009     *                                                                   *
00010     *   Description                                                     *
00011     *   ===========                                                     *
00012     *                                                                   *
00013     *   The file lib_crc.h contains public definitions  and  proto-     *
00014     *   types for the CRC functions present in lib_crc.c.               *
00015     *                                                                   *
00016     *                                                                   *
00017     *   Dependencies                                                    *
00018     *   ============                                                    *
00019     *                                                                   *
00020     *   none                                                            *
00021     *                                                                   *
00022     *                                                                   *
00023     *   Modification history                                            *
00024     *   ====================                                            *
00025     *                                                                   *
00026     *   Date        Version Comment                                     *
00027     *                                                                   *
00028     *   2010-10-20  1.17    Added several routines (JP)                 *
00029     *   2008-04-20  1.16    Added CRC-CCITT routine for Kermit          *
00030     *                                                                   *
00031     *   2007-04-01  1.15    Added CRC16 calculation for Modbus          *
00032     *                                                                   *
00033     *   2007-03-28  1.14    Added CRC16 routine for Sick devices        *
00034     *                                                                   *
00035     *   2005-12-17  1.13    Added CRC-CCITT with initial 0x1D0F         *
00036     *                                                                   *
00037     *   2005-02-14  1.12    Added CRC-CCITT with initial 0x0000         *
00038     *                                                                   *
00039     *   2005-02-05  1.11    Fixed bug in CRC-DNP routine                *
00040     *                                                                   *
00041     *   2005-02-04  1.10    Added CRC-DNP routines                      *
00042     *                                                                   *
00043     *   2005-01-07  1.02    Changes in tst_crc.c                        *
00044     *                                                                   *
00045     *   1999-02-21  1.01    Added FALSE and TRUE mnemonics              *
00046     *                                                                   *
00047     *   1999-01-22  1.00    Initial source                              *
00048     *                                                                   *
00049     \*******************************************************************/
00050 #ifndef _CRC_H_
00051 #define _CRC_H_
00052 
00053 #include "mbed.h"
00054 
00055 #define CRC_VERSION     "2.0"
00056 
00057 //#define CRC8
00058 //#define CRC16
00059 #define CRC32
00060 //#define CRC64
00061 
00062 
00063 /* Does the CRC calculation over a string specified by length (allows 00 inside string) */
00064 
00065 #ifdef CRC8
00066 uint8_t crc8(char *p, uint32_t length);
00067 #endif
00068 
00069 #ifdef CRC16
00070 uint16_t crc16(char *p, uint32_t length);
00071 #endif
00072 
00073 #ifdef CRC32
00074 uint32_t crc32(char *p, uint32_t length);
00075 #endif
00076 
00077 #ifdef CRC64
00078 uint64_t crc64(char *p, uint32_t length);
00079 #endif
00080 
00081 #endif /* _CRC_H_ */