40 lines
1.1 KiB
C
40 lines
1.1 KiB
C
/* SPDX-License-Identifier: GPL-2.0+ */
|
|
/*
|
|
* (C) Copyright 2009
|
|
* Marvell Semiconductor <www.marvell.com>
|
|
* Written-by: Prafulla Wadaskar <prafulla@marvell.com>
|
|
*/
|
|
|
|
#ifndef _UBOOT_CRC_H
|
|
#define _UBOOT_CRC_H
|
|
|
|
// #include <compiler.h> /* 'uint*' definitions */
|
|
typedef unsigned int uint;
|
|
|
|
/**
|
|
* crc32 - Calculate the CRC32 for a block of data
|
|
*
|
|
* @crc: Input crc to chain from a previous calculution (use 0 to start a new
|
|
* calculation)
|
|
* @buf: Bytes to checksum
|
|
* @len: Number of bytes to checksum
|
|
* @return checksum value
|
|
*/
|
|
uint32_t crc32(uint32_t crc, const unsigned char *buf, uint len);
|
|
|
|
/**
|
|
* crc32_no_comp - Calculate the CRC32 for a block of data (no one's compliment)
|
|
*
|
|
* This version uses a different algorithm which doesn't use one's compliment.
|
|
* JFFS2 (and other things?) use this.
|
|
*
|
|
* @crc: Input crc to chain from a previous calculution (use 0 to start a new
|
|
* calculation)
|
|
* @buf: Bytes to checksum
|
|
* @len: Number of bytes to checksum
|
|
* @return checksum value
|
|
*/
|
|
uint32_t crc32_no_comp(uint32_t crc, const unsigned char *buf, uint len);
|
|
|
|
#endif /* _UBOOT_CRC_H */
|