Simon Glass | 46e0bc9 | 2013-11-10 10:26:47 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2013 Google, Inc |
| 3 | * |
| 4 | * SPDX-License-Identifier: GPL-2.0+ |
| 5 | */ |
| 6 | |
| 7 | |
| 8 | #ifndef __linux_crc8_h |
| 9 | #define __linux_crc8_h |
| 10 | |
| 11 | /** |
| 12 | * crc8() - Calculate and return CRC-8 of the data |
| 13 | * |
| 14 | * This uses an x^8 + x^2 + x + 1 polynomial. A table-based algorithm would |
| 15 | * be faster, but for only a few bytes it isn't worth the code size |
| 16 | * |
Stefan Roese | a0d9b99 | 2016-04-08 15:56:29 +0200 | [diff] [blame] | 17 | * @crc_start: CRC8 start value |
Simon Glass | 46e0bc9 | 2013-11-10 10:26:47 -0700 | [diff] [blame] | 18 | * @vptr: Buffer to checksum |
| 19 | * @len: Length of buffer in bytes |
| 20 | * @return CRC8 checksum |
| 21 | */ |
Stefan Roese | a0d9b99 | 2016-04-08 15:56:29 +0200 | [diff] [blame] | 22 | unsigned int crc8(unsigned int crc_start, const unsigned char *vptr, int len); |
Simon Glass | 46e0bc9 | 2013-11-10 10:26:47 -0700 | [diff] [blame] | 23 | |
| 24 | #endif |