blob: 0ab5b9ab21996b35d6fa1980a1863db28ac2a7d5 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Simon Glass60d18d32013-11-10 10:26:47 -07002/*
3 * Copyright (c) 2013 Google, Inc
Simon Glass60d18d32013-11-10 10:26:47 -07004 */
5
6
7#ifndef __linux_crc8_h
8#define __linux_crc8_h
9
10/**
11 * crc8() - Calculate and return CRC-8 of the data
12 *
13 * This uses an x^8 + x^2 + x + 1 polynomial. A table-based algorithm would
14 * be faster, but for only a few bytes it isn't worth the code size
15 *
Stefan Roese456ecd02016-04-08 15:56:29 +020016 * @crc_start: CRC8 start value
Simon Glass60d18d32013-11-10 10:26:47 -070017 * @vptr: Buffer to checksum
18 * @len: Length of buffer in bytes
19 * @return CRC8 checksum
20 */
Stefan Roese456ecd02016-04-08 15:56:29 +020021unsigned int crc8(unsigned int crc_start, const unsigned char *vptr, int len);
Simon Glass60d18d32013-11-10 10:26:47 -070022
23#endif