CRC basic library

Dependents:   D7A_1x_demo_CodeUpgradeProtocol D7A_1x_demo_big_file D7A_1x_demo_sensors_v3 D7A_1x_demo_send_file_data

crc.h

Committer:
Jeej
Date:
2018-02-01
Revision:
2:88116ae677af
Parent:
1:3f4e25d35b1d

File content as of revision 2:88116ae677af:

    /*******************************************************************\
    *                                                                   *
    *   Library         : lib_crc                                       *
    *   File            : lib_crc.h                                     *
    *   Author          : Lammert Bies  1999-2008                       *
    *   E-mail          : info@lammertbies.nl                           *
    *   Language        : ANSI C                                        *
    *                                                                   *
    *                                                                   *
    *   Description                                                     *
    *   ===========                                                     *
    *                                                                   *
    *   The file lib_crc.h contains public definitions  and  proto-     *
    *   types for the CRC functions present in lib_crc.c.               *
    *                                                                   *
    *                                                                   *
    *   Dependencies                                                    *
    *   ============                                                    *
    *                                                                   *
    *   none                                                            *
    *                                                                   *
    *                                                                   *
    *   Modification history                                            *
    *   ====================                                            *
    *                                                                   *
    *   Date        Version Comment                                     *
    *                                                                   *
    *   2010-10-20  1.17    Added several routines (JP)                 *
    *   2008-04-20  1.16    Added CRC-CCITT routine for Kermit          *
    *                                                                   *
    *   2007-04-01  1.15    Added CRC16 calculation for Modbus          *
    *                                                                   *
    *   2007-03-28  1.14    Added CRC16 routine for Sick devices        *
    *                                                                   *
    *   2005-12-17  1.13    Added CRC-CCITT with initial 0x1D0F         *
    *                                                                   *
    *   2005-02-14  1.12    Added CRC-CCITT with initial 0x0000         *
    *                                                                   *
    *   2005-02-05  1.11    Fixed bug in CRC-DNP routine                *
    *                                                                   *
    *   2005-02-04  1.10    Added CRC-DNP routines                      *
    *                                                                   *
    *   2005-01-07  1.02    Changes in tst_crc.c                        *
    *                                                                   *
    *   1999-02-21  1.01    Added FALSE and TRUE mnemonics              *
    *                                                                   *
    *   1999-01-22  1.00    Initial source                              *
    *                                                                   *
    \*******************************************************************/
#ifndef _CRC_H_
#define _CRC_H_

#include "mbed.h"

#define CRC_VERSION     "2.0"

//#define CRC8
//#define CRC16
#define CRC32
//#define CRC64


/* Does the CRC calculation over a string specified by length (allows 00 inside string) */

#ifdef CRC8
uint8_t crc8(char *p, uint32_t length);
#endif

#ifdef CRC16
uint16_t crc16(char *p, uint32_t length);
#endif

#ifdef CRC32
uint32_t crc32(char *p, uint32_t length);
#endif

#ifdef CRC64
uint64_t crc64(char *p, uint32_t length);
#endif

#endif /* _CRC_H_ */