xref: /rk3399_rockchip-uboot/include/crc.h (revision f6e2c0f3e3bcb7c0b520b0e65de3f080f831fcf7)
1 /*
2  *==========================================================================
3  *
4  *      crc.h
5  *
6  *      Interface for the CRC algorithms.
7  *
8  *==========================================================================
9  * SPDX-License-Identifier:	eCos-2.0
10  *==========================================================================
11  *#####DESCRIPTIONBEGIN####
12  *
13  * Author(s):    Andrew Lunn
14  * Contributors: Andrew Lunn
15  * Date:         2002-08-06
16  * Purpose:
17  * Description:
18  *
19  * This code is part of eCos (tm).
20  *
21  *####DESCRIPTIONEND####
22  *
23  *==========================================================================
24  */
25 
26 #ifndef _SERVICES_CRC_CRC_H_
27 #define _SERVICES_CRC_CRC_H_
28 
29 #include <linux/types.h>
30 
31 #ifndef __externC
32 # ifdef __cplusplus
33 #  define __externC extern "C"
34 # else
35 #  define __externC extern
36 # endif
37 #endif
38 
39 /* Compute a CRC, using the POSIX 1003 definition */
40 extern uint32_t
41 cyg_posix_crc32(unsigned char *s, int len);
42 
43 /* Gary S. Brown's 32 bit CRC */
44 
45 extern uint32_t
46 cyg_crc32(unsigned char *s, int len);
47 
48 /* Gary S. Brown's 32 bit CRC, but accumulate the result from a */
49 /* previous CRC calculation */
50 
51 extern uint32_t
52 cyg_crc32_accumulate(uint32_t crc, unsigned char *s, int len);
53 
54 /* Ethernet FCS Algorithm */
55 
56 extern uint32_t
57 cyg_ether_crc32(unsigned char *s, int len);
58 
59 /* Ethernet FCS algorithm, but accumulate the result from a previous */
60 /* CRC calculation. */
61 
62 extern uint32_t
63 cyg_ether_crc32_accumulate(uint32_t crc, unsigned char *s, int len);
64 
65 /* 16 bit CRC with polynomial x^16+x^12+x^5+1 */
66 
67 extern uint16_t cyg_crc16(unsigned char *s, int len);
68 
69 #endif /* _SERVICES_CRC_CRC_H_ */
70