2013-11-10 17:26:47 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2013 Google, Inc
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: GPL-2.0+
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef __linux_crc8_h
|
|
|
|
#define __linux_crc8_h
|
|
|
|
|
|
|
|
/**
|
|
|
|
* crc8() - Calculate and return CRC-8 of the data
|
|
|
|
*
|
|
|
|
* This uses an x^8 + x^2 + x + 1 polynomial. A table-based algorithm would
|
|
|
|
* be faster, but for only a few bytes it isn't worth the code size
|
|
|
|
*
|
2016-04-08 13:56:29 +00:00
|
|
|
* @crc_start: CRC8 start value
|
2013-11-10 17:26:47 +00:00
|
|
|
* @vptr: Buffer to checksum
|
|
|
|
* @len: Length of buffer in bytes
|
|
|
|
* @return CRC8 checksum
|
|
|
|
*/
|
2016-04-08 13:56:29 +00:00
|
|
|
unsigned int crc8(unsigned int crc_start, const unsigned char *vptr, int len);
|
2013-11-10 17:26:47 +00:00
|
|
|
|
|
|
|
#endif
|