diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-09-14 08:57:30 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-09-14 08:57:30 -0400 |
commit | dbaa9a9d2b37d838125fb7f2b9fdc5dc5fa4eaa9 (patch) | |
tree | 8641efeba632bddfa0e486b41a5f19578b1a1a31 /include/linux/crc16.h | |
parent | 142e27fc8a3619471669d6241784eec9167c47d1 (diff) | |
parent | 2f4ba45a75d6383b4a1201169a808ffea416ffa0 (diff) |
Merge /spare/repo/linux-2.6/
Diffstat (limited to 'include/linux/crc16.h')
-rw-r--r-- | include/linux/crc16.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/include/linux/crc16.h b/include/linux/crc16.h new file mode 100644 index 000000000000..9443c084f881 --- /dev/null +++ b/include/linux/crc16.h | |||
@@ -0,0 +1,30 @@ | |||
1 | /* | ||
2 | * crc16.h - CRC-16 routine | ||
3 | * | ||
4 | * Implements the standard CRC-16: | ||
5 | * Width 16 | ||
6 | * Poly 0x8005 (x^16 + x^15 + x^2 + 1) | ||
7 | * Init 0 | ||
8 | * | ||
9 | * Copyright (c) 2005 Ben Gardner <bgardner@wabtec.com> | ||
10 | * | ||
11 | * This source code is licensed under the GNU General Public License, | ||
12 | * Version 2. See the file COPYING for more details. | ||
13 | */ | ||
14 | |||
15 | #ifndef __CRC16_H | ||
16 | #define __CRC16_H | ||
17 | |||
18 | #include <linux/types.h> | ||
19 | |||
20 | extern u16 const crc16_table[256]; | ||
21 | |||
22 | extern u16 crc16(u16 crc, const u8 *buffer, size_t len); | ||
23 | |||
24 | static inline u16 crc16_byte(u16 crc, const u8 data) | ||
25 | { | ||
26 | return (crc >> 8) ^ crc16_table[(crc ^ data) & 0xff]; | ||
27 | } | ||
28 | |||
29 | #endif /* __CRC16_H */ | ||
30 | |||