8c2952457
김태훈
응용 프로그램 추가
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
#ifndef INCLUDED_CRC
#define INCLUDED_CRC
#define CRC_BITS_BYTE 8
#define CRC_BYTE_MASK 0xFF
#define CRC_UCHAR_MAX 255
typedef unsigned int CRC_VAL;
typedef int CRC_BOOL;
#define CRC_TRUE 1
#define CRC_FALSE 0
typedef struct crc_tbl
{
CRC_VAL pre_calc[CRC_UCHAR_MAX + 1];
int width;
CRC_VAL poly;
CRC_VAL init_val;
CRC_VAL xor_out;
CRC_BOOL is_rev;
} CRC_TBL;
#define CRC_STD_CRC16 0
#define CRC_DNP_CRC16 1
#define CRC_MOD_CRC16 2
#define CRC_STD_XMODEM 3
#define CRC_STD_ZMODEM16 4
#define CRC_STD_CRC32 5
#define CRC_STD_JAM 6
CRC_BOOL crc_mk_tbl(CRC_TBL*, int, CRC_VAL, CRC_VAL, CRC_VAL, int);
CRC_BOOL crc_mk_std_tbl(CRC_TBL*, int);
CRC_VAL crc_final(CRC_VAL*, CRC_TBL*);
void crc_init(CRC_VAL*, CRC_TBL*);
void crc_add_chr(CRC_VAL*, CRC_TBL*, unsigned char, int);
void crc_add_str(CRC_VAL*, CRC_TBL*, unsigned char*);
void crc_add_data(CRC_VAL*, CRC_TBL*, unsigned char*, int);
#endif
|