mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-21 09:42:17 +07:00
0d85adb5fb
In support of a soon to be published MFD driver using serdev to talk to a supervisory processor that uses the CCITT-FALSE CRC16 variant in it's protocol, this patch was tested successfully on an i.MX6 ARM platform. Link: http://lkml.kernel.org/r/20170413142932.27287-1-andrew.smirnov@gmail.com Signed-off-by: Andrey Vostrikov <andrey.vostrikov@cogentembedded.com> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Tested-by: Chris Healy <cphealy@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
24 lines
609 B
C
24 lines
609 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _LINUX_CRC_CCITT_H
|
|
#define _LINUX_CRC_CCITT_H
|
|
|
|
#include <linux/types.h>
|
|
|
|
extern u16 const crc_ccitt_table[256];
|
|
extern u16 const crc_ccitt_false_table[256];
|
|
|
|
extern u16 crc_ccitt(u16 crc, const u8 *buffer, size_t len);
|
|
extern u16 crc_ccitt_false(u16 crc, const u8 *buffer, size_t len);
|
|
|
|
static inline u16 crc_ccitt_byte(u16 crc, const u8 c)
|
|
{
|
|
return (crc >> 8) ^ crc_ccitt_table[(crc ^ c) & 0xff];
|
|
}
|
|
|
|
static inline u16 crc_ccitt_false_byte(u16 crc, const u8 c)
|
|
{
|
|
return (crc << 8) ^ crc_ccitt_false_table[(crc >> 8) ^ c];
|
|
}
|
|
|
|
#endif /* _LINUX_CRC_CCITT_H */
|