#include <stdio.h>Go to the source code of this file.
Defines | |
| #define | GP 0x107 |
| #define | DI 0x07 |
Functions | |
| void | init_crc8 () |
| void | crc8 (unsigned char *crc, unsigned char m) |
Variables | |
| unsigned char | crc8_table [256] |
| int | made_table = 0 |
|
|
|
|
|
|
|
||||||||||||
|
Definition at line 39 of file crc8.c. References crc8_table, and init_crc8(). Referenced by get_al_pdu(), and send_closing_flag(). 00044 {
00045 if (!made_table)
00046 init_crc8();
00047
00048 *crc = crc8_table[(*crc) ^ m];
00049 *crc &= 0xFF;
00050 }
|
|
|
Definition at line 18 of file crc8.c. References crc8_table, DI, and made_table. Referenced by crc8(). 00022 {
00023 int i,j;
00024 unsigned char crc;
00025
00026 if (!made_table) {
00027 for (i=0; i<256; i++) {
00028 crc = i;
00029 for (j=0; j<8; j++)
00030 crc = (crc << 1) ^ ((crc & 0x80) ? DI : 0);
00031 crc8_table[i] = crc & 0xFF;
00032 /* printf("table[%d] = %d (0x%X)\n", i, crc, crc); */
00033 }
00034 made_table=1;
00035 }
00036 }
|
|
|
Definition at line 15 of file crc8.c. Referenced by crc8(), and init_crc8(). |
|
|
Definition at line 16 of file crc8.c. Referenced by init_crc8(). |
1.3.9.1