diff options
| author | Andrey Panin <pazke@donpac.ru> | 2004-06-26 20:59:38 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-06-26 20:59:38 -0700 |
| commit | 153a716d3b79ab3486fa4f48559eb398aa82082c (patch) | |
| tree | 71d683728760dd884d05008145bf17bcc05dc015 /include | |
| parent | 9f829691aeb91f6a75a648f2b38d76207dac270c (diff) | |
[PATCH] crc: add common CRC16 module
Currently we have 8 copies of CRC16 calculation table in different device
drivers, this patch creates common crc16.c module to replace them.
Signed-off-by: Andrey Panin <pazke@donpac.ru>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/crc16.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/linux/crc16.h b/include/linux/crc16.h new file mode 100644 index 000000000000..a077021e1c38 --- /dev/null +++ b/include/linux/crc16.h @@ -0,0 +1,15 @@ +#ifndef _LINUX_CRC16_H +#define _LINUX_CRC16_H + +#include <linux/types.h> + +extern u16 const crc16_table[256]; + +extern u16 crc16(u16 crc, const u8 *buffer, size_t len); + +static inline u16 crc16_byte(u16 crc, const u8 c) +{ + return (crc >> 8) ^ crc16_table[(crc ^ c) & 0xff]; +} + +#endif /* _LINUX_CRC16_H */ |
