Problematique

Dependencies:   mbed mbed-rtos

Committer:
RufflesAllD
Date:
Tue Feb 11 15:15:23 2014 +0000
Revision:
2:db7c8378b324
almost done, remain signal acquirement

Who changed what in which revision?

UserRevisionLine numberNew contents of line
RufflesAllD 2:db7c8378b324 1 /*******************************************************************\
RufflesAllD 2:db7c8378b324 2 * *
RufflesAllD 2:db7c8378b324 3 * Library : lib_crc *
RufflesAllD 2:db7c8378b324 4 * File : lib_crc.h *
RufflesAllD 2:db7c8378b324 5 * Author : Lammert Bies 1999-2008 *
RufflesAllD 2:db7c8378b324 6 * E-mail : info@lammertbies.nl *
RufflesAllD 2:db7c8378b324 7 * Language : ANSI C *
RufflesAllD 2:db7c8378b324 8 * *
RufflesAllD 2:db7c8378b324 9 * *
RufflesAllD 2:db7c8378b324 10 * Description *
RufflesAllD 2:db7c8378b324 11 * =========== *
RufflesAllD 2:db7c8378b324 12 * *
RufflesAllD 2:db7c8378b324 13 * The file lib_crc.h contains public definitions and proto- *
RufflesAllD 2:db7c8378b324 14 * types for the CRC functions present in lib_crc.c. *
RufflesAllD 2:db7c8378b324 15 * *
RufflesAllD 2:db7c8378b324 16 * *
RufflesAllD 2:db7c8378b324 17 * Dependencies *
RufflesAllD 2:db7c8378b324 18 * ============ *
RufflesAllD 2:db7c8378b324 19 * *
RufflesAllD 2:db7c8378b324 20 * none *
RufflesAllD 2:db7c8378b324 21 * *
RufflesAllD 2:db7c8378b324 22 * *
RufflesAllD 2:db7c8378b324 23 * Modification history *
RufflesAllD 2:db7c8378b324 24 * ==================== *
RufflesAllD 2:db7c8378b324 25 * *
RufflesAllD 2:db7c8378b324 26 * Date Version Comment *
RufflesAllD 2:db7c8378b324 27 * *
RufflesAllD 2:db7c8378b324 28 * 2010-10-20 1.17 Added several routines (JP) *
RufflesAllD 2:db7c8378b324 29 * 2008-04-20 1.16 Added CRC-CCITT routine for Kermit *
RufflesAllD 2:db7c8378b324 30 * *
RufflesAllD 2:db7c8378b324 31 * 2007-04-01 1.15 Added CRC16 calculation for Modbus *
RufflesAllD 2:db7c8378b324 32 * *
RufflesAllD 2:db7c8378b324 33 * 2007-03-28 1.14 Added CRC16 routine for Sick devices *
RufflesAllD 2:db7c8378b324 34 * *
RufflesAllD 2:db7c8378b324 35 * 2005-12-17 1.13 Added CRC-CCITT with initial 0x1D0F *
RufflesAllD 2:db7c8378b324 36 * *
RufflesAllD 2:db7c8378b324 37 * 2005-02-14 1.12 Added CRC-CCITT with initial 0x0000 *
RufflesAllD 2:db7c8378b324 38 * *
RufflesAllD 2:db7c8378b324 39 * 2005-02-05 1.11 Fixed bug in CRC-DNP routine *
RufflesAllD 2:db7c8378b324 40 * *
RufflesAllD 2:db7c8378b324 41 * 2005-02-04 1.10 Added CRC-DNP routines *
RufflesAllD 2:db7c8378b324 42 * *
RufflesAllD 2:db7c8378b324 43 * 2005-01-07 1.02 Changes in tst_crc.c *
RufflesAllD 2:db7c8378b324 44 * *
RufflesAllD 2:db7c8378b324 45 * 1999-02-21 1.01 Added FALSE and TRUE mnemonics *
RufflesAllD 2:db7c8378b324 46 * *
RufflesAllD 2:db7c8378b324 47 * 1999-01-22 1.00 Initial source *
RufflesAllD 2:db7c8378b324 48 * *
RufflesAllD 2:db7c8378b324 49 \*******************************************************************/
RufflesAllD 2:db7c8378b324 50 #ifndef _LIB_CRC_H_
RufflesAllD 2:db7c8378b324 51 #define _LIB_CRC_H_
RufflesAllD 2:db7c8378b324 52
RufflesAllD 2:db7c8378b324 53 #include <stdint.h>
RufflesAllD 2:db7c8378b324 54
RufflesAllD 2:db7c8378b324 55 #define CRC_VERSION "2.0"
RufflesAllD 2:db7c8378b324 56
RufflesAllD 2:db7c8378b324 57 uint16_t update_crc16_normal( uint16_t *table, uint16_t crc, char c );
RufflesAllD 2:db7c8378b324 58 uint16_t update_crc16_reflected( uint16_t *table, uint16_t crc, char c );
RufflesAllD 2:db7c8378b324 59 uint32_t update_crc24_normal( uint32_t *table, uint32_t crc, char c );
RufflesAllD 2:db7c8378b324 60 // update_crc24_reflected same as update_crc32_reflected
RufflesAllD 2:db7c8378b324 61 uint32_t update_crc32_normal( uint32_t *table, uint32_t crc, char c );
RufflesAllD 2:db7c8378b324 62 uint32_t update_crc32_reflected( uint32_t *table, uint32_t crc, char c );
RufflesAllD 2:db7c8378b324 63
RufflesAllD 2:db7c8378b324 64 uint64_t update_crc40_normal( uint64_t *table, uint64_t crc, char c );
RufflesAllD 2:db7c8378b324 65 // update_crc40_reflected same as update_crc64_reflected
RufflesAllD 2:db7c8378b324 66 uint64_t update_crc64_normal( uint64_t *table, uint64_t crc, char c );
RufflesAllD 2:db7c8378b324 67 uint64_t update_crc64_reflected( uint64_t *table, uint64_t crc, char c );
RufflesAllD 2:db7c8378b324 68
RufflesAllD 2:db7c8378b324 69 /* Does the CRC calculation 1 byte at a time */
RufflesAllD 2:db7c8378b324 70 uint8_t update_crc8_atm(uint8_t crc, uint8_t c);
RufflesAllD 2:db7c8378b324 71 uint8_t update_crc8_ccitt(uint8_t crc, uint8_t c);
RufflesAllD 2:db7c8378b324 72 uint8_t update_crc8_maxim(uint8_t crc, uint8_t c);
RufflesAllD 2:db7c8378b324 73 uint8_t update_crc8(uint8_t crc, uint8_t c);
RufflesAllD 2:db7c8378b324 74 uint8_t update_crc8_j1850(uint8_t crc, uint8_t c);
RufflesAllD 2:db7c8378b324 75 uint8_t update_crc8_wcdma(uint8_t crc, uint8_t c);
RufflesAllD 2:db7c8378b324 76 uint8_t update_crc8_rohc(uint8_t crc, uint8_t c);
RufflesAllD 2:db7c8378b324 77 uint8_t update_crc8_darc(uint8_t crc, uint8_t c);
RufflesAllD 2:db7c8378b324 78 uint16_t update_crc16_8005( uint16_t crc, char c );
RufflesAllD 2:db7c8378b324 79 uint16_t update_crc16_A001( uint16_t crc, char c );
RufflesAllD 2:db7c8378b324 80 uint16_t update_crc16_1021( uint16_t crc, char c );
RufflesAllD 2:db7c8378b324 81 uint16_t update_crc16_8408( uint16_t crc, char c );
RufflesAllD 2:db7c8378b324 82 uint16_t update_crc16_3D65( uint16_t crc, char c );
RufflesAllD 2:db7c8378b324 83 uint16_t update_crc16_dnp( uint16_t crc, char c );
RufflesAllD 2:db7c8378b324 84 uint16_t update_crc16_t10_dif( uint16_t crc, char c );
RufflesAllD 2:db7c8378b324 85 uint16_t update_crc16_0589( uint16_t crc, char c );
RufflesAllD 2:db7c8378b324 86 uint16_t update_crc16_teledisk( uint16_t crc, char c );
RufflesAllD 2:db7c8378b324 87 uint32_t update_crc24( uint32_t crc, char c );
RufflesAllD 2:db7c8378b324 88 uint32_t update_crc24_r64( uint32_t crc, char c );
RufflesAllD 2:db7c8378b324 89 uint32_t update_crc32_refl( uint32_t crc, char c );
RufflesAllD 2:db7c8378b324 90 uint32_t update_crc32_norm( uint32_t crc, char c );
RufflesAllD 2:db7c8378b324 91 uint32_t update_crc32_xfer( uint32_t crc, char c );
RufflesAllD 2:db7c8378b324 92 uint32_t update_crc32_c( uint32_t crc, char c );
RufflesAllD 2:db7c8378b324 93 uint32_t update_crc32_d( uint32_t crc, char c );
RufflesAllD 2:db7c8378b324 94 uint32_t update_crc32_k( uint32_t crc, char c );
RufflesAllD 2:db7c8378b324 95 uint32_t update_crc32_q( uint32_t crc, char c );
RufflesAllD 2:db7c8378b324 96 uint16_t update_crc_sick( uint16_t crc, char c, char prev_byte );
RufflesAllD 2:db7c8378b324 97
RufflesAllD 2:db7c8378b324 98 uint64_t update_crc40_gsm(uint64_t crc, char c);
RufflesAllD 2:db7c8378b324 99 uint64_t update_crc64(uint64_t crc, char c);
RufflesAllD 2:db7c8378b324 100 uint64_t update_crc64_1B(uint64_t crc, char c);
RufflesAllD 2:db7c8378b324 101 uint64_t update_crc64_jones(uint64_t crc, char c);
RufflesAllD 2:db7c8378b324 102
RufflesAllD 2:db7c8378b324 103 /* Does the CRC calculation over a string specified by length (allows 00 inside string) */
RufflesAllD 2:db7c8378b324 104 uint8_t calculate_crc8_itu(char *p, unsigned int length);
RufflesAllD 2:db7c8378b324 105 uint8_t calculate_crc8_atm(char *p, unsigned int length);
RufflesAllD 2:db7c8378b324 106 uint8_t calculate_crc8_ccitt(char *p, unsigned int length);
RufflesAllD 2:db7c8378b324 107 uint8_t calculate_crc8_maxim(char *p, unsigned int length);
RufflesAllD 2:db7c8378b324 108 uint8_t calculate_crc8(char *p, unsigned int length);
RufflesAllD 2:db7c8378b324 109 uint8_t calculate_crc8_icode(char *p, unsigned int length);
RufflesAllD 2:db7c8378b324 110 uint8_t calculate_crc8_j1850(char *p, unsigned int length);
RufflesAllD 2:db7c8378b324 111 uint8_t calculate_crc8_wcdma(char *p, unsigned int length);
RufflesAllD 2:db7c8378b324 112 uint8_t calculate_crc8_rohc(char *p, unsigned int length);
RufflesAllD 2:db7c8378b324 113 uint8_t calculate_crc8_darc(char *p, unsigned int length);
RufflesAllD 2:db7c8378b324 114
RufflesAllD 2:db7c8378b324 115 uint16_t calculate_crc16_Buypass(char *p, unsigned int length);
RufflesAllD 2:db7c8378b324 116 uint16_t calculate_crc16_DDS_110(char *p, unsigned int length);
RufflesAllD 2:db7c8378b324 117 uint16_t calculate_crc16_EN_13757(char *p, unsigned int length);
RufflesAllD 2:db7c8378b324 118 uint16_t calculate_crc16_Teledisk(char *p, unsigned int length);
RufflesAllD 2:db7c8378b324 119 uint16_t calculate_crc16(char *p, unsigned int length);
RufflesAllD 2:db7c8378b324 120 uint16_t calculate_crc16_Modbus(char *p, unsigned int length);
RufflesAllD 2:db7c8378b324 121 uint16_t calculate_crc16_Maxim(char *p, unsigned int length);
RufflesAllD 2:db7c8378b324 122 uint16_t calculate_crc16_USB(char *p, unsigned int length);
RufflesAllD 2:db7c8378b324 123 uint16_t calculate_crc16_T10_DIF(char *p, unsigned int length);
RufflesAllD 2:db7c8378b324 124 uint16_t calculate_crc16_Dect_X(char *p, unsigned int length);
RufflesAllD 2:db7c8378b324 125 uint16_t calculate_crc16_Dect_R(char *p, unsigned int length);
RufflesAllD 2:db7c8378b324 126 uint16_t calculate_crc16_sick(char *p, unsigned int length);
RufflesAllD 2:db7c8378b324 127 uint16_t calculate_crc16_DNP(char *p, unsigned int length);
RufflesAllD 2:db7c8378b324 128 uint16_t calculate_crc16_Ccitt_Xmodem(char *p, unsigned int length);
RufflesAllD 2:db7c8378b324 129 uint16_t calculate_crc16_Ccitt_FFFF(char *p, unsigned int length);
RufflesAllD 2:db7c8378b324 130 uint16_t calculate_crc16_Ccitt_1D0F(char *p, unsigned int length);
RufflesAllD 2:db7c8378b324 131 uint16_t calculate_crc16_Genibus(char *p, unsigned int length);
RufflesAllD 2:db7c8378b324 132 uint16_t calculate_crc16_Kermit(char *p, unsigned int length);
RufflesAllD 2:db7c8378b324 133 uint16_t calculate_crc16_X25(char *p, unsigned int length);
RufflesAllD 2:db7c8378b324 134 uint16_t calculate_crc16_MCRF4XX(char *p, unsigned int length);
RufflesAllD 2:db7c8378b324 135 uint16_t calculate_crc16_Riello(char *p, unsigned int length);
RufflesAllD 2:db7c8378b324 136 uint16_t calculate_chk16_Fletcher(char *p, unsigned int length);
RufflesAllD 2:db7c8378b324 137
RufflesAllD 2:db7c8378b324 138 uint32_t calculate_crc24_flexray_a(char *p, unsigned int length);
RufflesAllD 2:db7c8378b324 139 uint32_t calculate_crc24_flexray_b(char *p, unsigned int length);
RufflesAllD 2:db7c8378b324 140 uint32_t calculate_crc24_r64(char *p, unsigned int length);
RufflesAllD 2:db7c8378b324 141 uint32_t calculate_crc32(char *p, unsigned int length);
RufflesAllD 2:db7c8378b324 142 uint32_t calculate_crc32_jamcrc(char *p, unsigned int length);
RufflesAllD 2:db7c8378b324 143 uint32_t calculate_crc32_c(char *p, unsigned int length);
RufflesAllD 2:db7c8378b324 144 uint32_t calculate_crc32_d(char *p, unsigned int length);
RufflesAllD 2:db7c8378b324 145 uint32_t calculate_crc32_bzip2(char *p, unsigned int length);
RufflesAllD 2:db7c8378b324 146 uint32_t calculate_crc32_mpeg2(char *p, unsigned int length);
RufflesAllD 2:db7c8378b324 147 uint32_t calculate_crc32_posix(char *p, unsigned int length);
RufflesAllD 2:db7c8378b324 148 uint32_t calculate_crc32_k(char *p, unsigned int length);
RufflesAllD 2:db7c8378b324 149 uint32_t calculate_crc32_q(char *p, unsigned int length);
RufflesAllD 2:db7c8378b324 150 uint32_t calculate_crc32_xfer(char *p, unsigned int length);
RufflesAllD 2:db7c8378b324 151 uint64_t calculate_crc40_gsm(char *p, unsigned int length);
RufflesAllD 2:db7c8378b324 152 uint64_t calculate_crc64(char *p, unsigned int length);
RufflesAllD 2:db7c8378b324 153 uint64_t calculate_crc64_1b(char *p, unsigned int length);
RufflesAllD 2:db7c8378b324 154 uint64_t calculate_crc64_we(char *p, unsigned int length);
RufflesAllD 2:db7c8378b324 155 uint64_t calculate_crc64_jones(char *p, unsigned int length);
RufflesAllD 2:db7c8378b324 156
RufflesAllD 2:db7c8378b324 157 #endif /* _LIB_CRC_H_ */