From 153a716d3b79ab3486fa4f48559eb398aa82082c Mon Sep 17 00:00:00 2001 From: Andrey Panin Date: Sat, 26 Jun 2004 20:59:38 -0700 Subject: [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 Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/crc16.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 include/linux/crc16.h (limited to 'include/linux') 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 + +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 */ -- cgit v1.2.3