Annotation of multiplexer/crc16.h, revision 1.2
1.1 oskar 1: /*
2: * cyclic redundancy check 16 bit
3: * Copyright (C) 1999 Christian Wolff, 2004 Oskar Schirmer
4: * for Convergence Integrated Media GmbH (http://www.convergence.de)
5: *
6: * This program is free software; you can redistribute it and/or modify
7: * it under the terms of the GNU General Public License as published by
8: * the Free Software Foundation; either version 2 of the License, or
9: * (at your option) any later version.
10: *
11: * This program is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14: * GNU General Public License for more details.
15: *
16: * You should have received a copy of the GNU General Public License
17: * along with this program; if not, write to the Free Software
18: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19: */
20:
21: #define MSBFCOEFF(x) | (1UL << x)
22:
23: #define POLYNOMIAL_16_MSBF 0 \
24: MSBFCOEFF(0) \
25: MSBFCOEFF(1) \
26: MSBFCOEFF(5) \
27: MSBFCOEFF(12)
28:
1.2 ! oskar 29: #define CRC_INIT_16 ((uint16_t)(-1))
1.1 oskar 30:
31: #define update_crc_16(crc, data) \
32: ((crc << 8) ^ crc_16_table[((int)(crc >> 8 ) ^ (data)) & 0xFF])
33:
1.2 ! oskar 34: extern uint16_t crc_16_table[256];
1.1 oskar 35:
36: extern void gen_crc16_table();
37:
1.2 ! oskar 38: extern uint16_t update_crc_16_block(uint16_t crc, char *data_block_ptr, int data_block_size);
1.1 oskar 39:
40: extern void crc16_calc (char *data,
41: int size,
42: char *crc);
43:
LinuxTV legacy CVS <linuxtv.org/cvs>