OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [services/] [crc/] [v2_0/] [doc/] [crc.sgml] - Blame information for rev 201

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
2
CRC Algorithms
3
4
5
The CRC package provides implementation of CRC algorithms. This
6
includes the POSIX CRC calculation which produces the same result as
7
the cksum command on Linux, another 32 bit CRC by Gary S. Brown and a
8
16bit CRC. The CRC used for Ethernet FCS is also implemented.
9
10
11
12
CRC Functions
13
14
CRC API
15
16
The package implements a number of CRC functions as described below.
17
The API to these functions is in the include file
18
cyg/crc/crc.h.
19
20
21
cyg_posix_crc32
22
23
This function implements a 32 bit CRC which is compliant to the POSIX
24
1008.2 Standard. This is the same as the Linux cksum program.
25
26
27
cyg_uint32 cyg_posix_crc32(unsigned char * s, int len);
28
29
30
The CRC calculation is run over the data pointed to by
31
s, of length len. The
32
CRC is returned as an unsigned long.
33
34
 
35
36
cyg_crc32
37
38
These functions implement a 32 bit CRC by Gary S. Brown. They use the
39
polynomial
40
X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0.
41
42
43
cyg_uint32 cyg_crc32(unsigned char * s, int len);
44
cyg_uint32 cyg_crc32_accumulate(cyg_uint32 crc, unsigned char * s, int len);
45
46
47
The CRC calculation is run over the data pointed to by
48
s, of length len. The
49
CRC is returned as an unsigned long.
50
 
51
 The CRC can be calculated over data separated into multiple
52
buffers by using the function  cyg_crc32_accumulate()
53
. The parameter crc should be the
54
result from the previous CRC calculation.
55
56
57
 
58
59
cyg_ether_crc32
60
61
These functions implement the 32 bit CRC used by the Ethernet FCS word.
62
63
64
cyg_uint32 cyg_ether_crc32(unsigned char * s, int len);
65
cyg_uint32 cyg_ether_crc32_accumulate(cyg_uint32 crc, unsigned char * s, int len);
66
67
68
The CRC calculation is run over the data pointed to by
69
s, of length len. The
70
CRC is returned as an unsigned long.
71
 
72
 The CRC can be calculated over data separated into multiple
73
buffers by using the function  cyg_ether_crc32_accumulate()
74
. The parameter crc should be the
75
result from the previous CRC calculation.
76
77
78
 
79
80
cyg_crc16
81
82
This function implements a 16 bit CRC. It uses the polynomial
83
x^16+x^12+x^5+1.
84
85
86
cyg_uint16 cyg_crc16(unsigned char * s, int len);
87
88
89
The CRC calculation is run over the data pointed to by
90
s, of length len. The
91
CRC is returned as an unsigned short.
92
93
 
94
95
96
97
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.