CoffeePi Coffee machine control for Raspberry Pi

- Main Page
- Data Structures
- Files

- File List
- Globals

crc.h
Go to the documentation of this file.
1 /**********************************************************************
2 *
3 * Filename: crc.h
4 *
5 * Description: A header file describing the various CRC standards.
6 *
7 * Notes:
8 *
9 *
10 * Copyright (c) 2000 by Michael Barr. This software is placed into
11 * the public domain and may be used for any purpose. However, this
12 * notice must not be changed or removed and no warranty is either
13 * expressed or implied by its publication or distribution.
14 **********************************************************************/
15
16 #ifndef _crc_h
17 #define _crc_h
18
19
20 #define FALSE 0
21 #define TRUE !FALSE
22
23 /*
24 * Select the CRC standard from the list that follows.
25 */
26 #define CRC32
27
28
29 #if defined(CRC_CCITT)
30
31 typedef unsigned short crc;
32
33 #define CRC_NAME "CRC-CCITT"
34 #define POLYNOMIAL 0x1021
35 #define INITIAL_REMAINDER 0xFFFF
36 #define FINAL_XOR_VALUE 0x0000
37 #define REFLECT_DATA FALSE
38 #define REFLECT_REMAINDER FALSE
39 #define CHECK_VALUE 0x29B1
40
41 #elif defined(CRC16)
42
43 typedef unsigned short crc;
44
45 #define CRC_NAME "CRC-16"
46 #define POLYNOMIAL 0x8005
47 #define INITIAL_REMAINDER 0x0000
48 #define FINAL_XOR_VALUE 0x0000
49 #define REFLECT_DATA TRUE
50 #define REFLECT_REMAINDER TRUE
51 #define CHECK_VALUE 0xBB3D
52
53 #elif defined(CRC32)
54
55 typedef unsigned long crc;
56
57 #define CRC_NAME "CRC-32"
58 #define POLYNOMIAL 0x04C11DB7
59 #define INITIAL_REMAINDER 0xFFFFFFFF
60 #define FINAL_XOR_VALUE 0xFFFFFFFF
61 #define REFLECT_DATA TRUE
62 #define REFLECT_REMAINDER TRUE
63 #define CHECK_VALUE 0xCBF43926
64
65 #else
66
67 #error "One of CRC_CCITT, CRC16, or CRC32 must be #define'd."
68
69 #endif
70
71
72 void crcInit(void);
73 crc crcSlow(unsigned char const message[], int nBytes);
74 crc crcFast(unsigned char const message[], int nBytes);
75
76
77 #endif /* _crc_h */
crc
unsigned long crc
Definition: crc.h:55
crcSlow
crc crcSlow(unsigned char const message[], int nBytes)
Definition: crc.cpp:95
crcFast
crc crcFast(unsigned char const message[], int nBytes)
Definition: crc.cpp:212
crcInit
void crcInit(void)
Definition: crc.cpp:156