blob: 5085d4ed477919c0f01390742c7b5b23892e9894 [file] [log] [blame]
Wolfgang Denkcf48eb92006-04-16 10:51:58 +02001/*
2 *==========================================================================
3 *
4 * crc.h
5 *
6 * Interface for the CRC algorithms.
7 *
8 *==========================================================================
Wolfgang Denke85427f2013-07-08 12:11:35 +02009 * SPDX-License-Identifier: eCos-2.0
Wolfgang Denkcf48eb92006-04-16 10:51:58 +020010 *==========================================================================
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 */
Markus Klotzbuecherf2841d32006-03-30 13:40:55 +020025
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
Wolfgang Denkcf48eb92006-04-16 10:51:58 +020039/* Compute a CRC, using the POSIX 1003 definition */
40extern uint32_t
Markus Klotzbuecherf2841d32006-03-30 13:40:55 +020041cyg_posix_crc32(unsigned char *s, int len);
42
Wolfgang Denkcf48eb92006-04-16 10:51:58 +020043/* Gary S. Brown's 32 bit CRC */
Markus Klotzbuecherf2841d32006-03-30 13:40:55 +020044
Wolfgang Denkcf48eb92006-04-16 10:51:58 +020045extern uint32_t
Markus Klotzbuecherf2841d32006-03-30 13:40:55 +020046cyg_crc32(unsigned char *s, int len);
47
Wolfgang Denkcf48eb92006-04-16 10:51:58 +020048/* Gary S. Brown's 32 bit CRC, but accumulate the result from a */
49/* previous CRC calculation */
Markus Klotzbuecherf2841d32006-03-30 13:40:55 +020050
Wolfgang Denkcf48eb92006-04-16 10:51:58 +020051extern uint32_t
Markus Klotzbuecherf2841d32006-03-30 13:40:55 +020052cyg_crc32_accumulate(uint32_t crc, unsigned char *s, int len);
53
Wolfgang Denkcf48eb92006-04-16 10:51:58 +020054/* Ethernet FCS Algorithm */
Markus Klotzbuecherf2841d32006-03-30 13:40:55 +020055
Wolfgang Denkcf48eb92006-04-16 10:51:58 +020056extern uint32_t
Markus Klotzbuecherf2841d32006-03-30 13:40:55 +020057cyg_ether_crc32(unsigned char *s, int len);
58
Wolfgang Denkcf48eb92006-04-16 10:51:58 +020059/* Ethernet FCS algorithm, but accumulate the result from a previous */
60/* CRC calculation. */
Markus Klotzbuecherf2841d32006-03-30 13:40:55 +020061
Wolfgang Denkcf48eb92006-04-16 10:51:58 +020062extern uint32_t
Markus Klotzbuecherf2841d32006-03-30 13:40:55 +020063cyg_ether_crc32_accumulate(uint32_t crc, unsigned char *s, int len);
64
Wolfgang Denkcf48eb92006-04-16 10:51:58 +020065/* 16 bit CRC with polynomial x^16+x^12+x^5+1 */
Markus Klotzbuecherf2841d32006-03-30 13:40:55 +020066
67extern uint16_t cyg_crc16(unsigned char *s, int len);
68
Wolfgang Denkcf48eb92006-04-16 10:51:58 +020069#endif /* _SERVICES_CRC_CRC_H_ */