#include <stdio.h>Go to the source code of this file.
Defines | |
| #define | GP 0x11021 |
| #define | DI 0x1021 |
Functions | |
| void | init_crc16 () |
| void | crc16 (short *crc, unsigned char m) |
Variables | |
| short | crc16_table [256] |
| int | made_table = 0 |
|
|
Definition at line 12 of file crc16.c. Referenced by init_crc16(), and init_crc8(). |
|
|
|
|
||||||||||||
|
Definition at line 38 of file crc16.c. References crc16_table, and init_crc16(). Referenced by get_al_pdu(), and send_closing_flag(). 00043 {
00044 if (!made_table)
00045 init_crc16();
00046 *crc = crc16_table[(((*crc) >> 8) ^ m) & 0xFF] ^ ((*crc) << 8);
00047 *crc &= 0xFFFF;
00048 }
|
|
|
Definition at line 18 of file crc16.c. References crc16_table, DI, and made_table. Referenced by crc16(). 00022 {
00023 int i,j;
00024 short crc;
00025
00026 if (!made_table) {
00027 for (i=0; i<256; i++) {
00028 crc = (i << 8);
00029 for (j=0; j<8; j++)
00030 crc = (crc << 1) ^ ((crc & 0x8000) ? DI : 0);
00031 crc16_table[i] = crc & 0xFFFF;
00032 }
00033 made_table=1;
00034 }
00035 }
|
|
|
Definition at line 15 of file crc16.c. Referenced by crc16(), and init_crc16(). |
|
|
Definition at line 16 of file crc16.c. Referenced by init_crc16(). |
1.3.9.1