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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [doc/] [html/] [ref/] [crc-functions.html] - Blame information for rev 588

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

Line No. Rev Author Line
1 28 unneback
<!-- Copyright (C) 2003 Red Hat, Inc.                                -->
2
<!-- This material may be distributed only subject to the terms      -->
3
<!-- and conditions set forth in the Open Publication License, v1.0  -->
4
<!-- or later (the latest version is presently available at          -->
5
<!-- http://www.opencontent.org/openpub/).                           -->
6
<!-- Distribution of the work or derivative of the work in any       -->
7
<!-- standard (paper) book form is prohibited unless prior           -->
8
<!-- permission is obtained from the copyright holder.               -->
9
<HTML
10
><HEAD
11
><TITLE
12
>CRC Functions</TITLE
13
><meta name="MSSmartTagsPreventParsing" content="TRUE">
14
<META
15
NAME="GENERATOR"
16
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
17
"><LINK
18
REL="HOME"
19
TITLE="eCos Reference Manual"
20
HREF="ecos-ref.html"><LINK
21
REL="UP"
22
TITLE="CRC Algorithms"
23
HREF="services-crc.html"><LINK
24
REL="PREVIOUS"
25
TITLE="CRC Algorithms"
26
HREF="services-crc.html"><LINK
27
REL="NEXT"
28
TITLE="CPU load measurements"
29
HREF="services-cpuload.html"></HEAD
30
><BODY
31
CLASS="CHAPTER"
32
BGCOLOR="#FFFFFF"
33
TEXT="#000000"
34
LINK="#0000FF"
35
VLINK="#840084"
36
ALINK="#0000FF"
37
><DIV
38
CLASS="NAVHEADER"
39
><TABLE
40
SUMMARY="Header navigation table"
41
WIDTH="100%"
42
BORDER="0"
43
CELLPADDING="0"
44
CELLSPACING="0"
45
><TR
46
><TH
47
COLSPAN="3"
48
ALIGN="center"
49
>eCos Reference Manual</TH
50
></TR
51
><TR
52
><TD
53
WIDTH="10%"
54
ALIGN="left"
55
VALIGN="bottom"
56
><A
57
HREF="services-crc.html"
58
ACCESSKEY="P"
59
>Prev</A
60
></TD
61
><TD
62
WIDTH="80%"
63
ALIGN="center"
64
VALIGN="bottom"
65
></TD
66
><TD
67
WIDTH="10%"
68
ALIGN="right"
69
VALIGN="bottom"
70
><A
71
HREF="services-cpuload.html"
72
ACCESSKEY="N"
73
>Next</A
74
></TD
75
></TR
76
></TABLE
77
><HR
78
ALIGN="LEFT"
79
WIDTH="100%"></DIV
80
><DIV
81
CLASS="CHAPTER"
82
><H1
83
><A
84
NAME="CRC-FUNCTIONS">Chapter 50. CRC Functions</H1
85
><DIV
86
CLASS="SECT1"
87
><H1
88
CLASS="SECT1"
89
><A
90
NAME="SERVICES-CRC-API">CRC API</H1
91
><P
92
>The package implements a number of CRC functions as described below.
93
The API to these functions is in the include file
94
<TT
95
CLASS="FILENAME"
96
>cyg/crc/crc.h</TT
97
>.</P
98
><DIV
99
CLASS="SECT2"
100
><H2
101
CLASS="SECT2"
102
><A
103
NAME="SERVICES-CRC-API-CYG-POSIX-CRC32">cyg_posix_crc32</H2
104
><P
105
>This function implements a 32 bit CRC which is compliant to the POSIX
106
1008.2 Standard. This is the same as the Linux cksum program.</P
107
><TABLE
108
BORDER="5"
109
BGCOLOR="#E0E0F0"
110
WIDTH="70%"
111
><TR
112
><TD
113
><PRE
114
CLASS="PROGRAMLISTING"
115
>cyg_uint32 cyg_posix_crc32(unsigned char &#0042; s, int len);</PRE
116
></TD
117
></TR
118
></TABLE
119
><P
120
>The CRC calculation is run over the data pointed to by
121
<TT
122
CLASS="PARAMETER"
123
><I
124
>s</I
125
></TT
126
>, of length <TT
127
CLASS="PARAMETER"
128
><I
129
>len</I
130
></TT
131
>. The
132
CRC is returned as an unsigned long.</P
133
></DIV
134
><DIV
135
CLASS="SECT2"
136
><H2
137
CLASS="SECT2"
138
><A
139
NAME="SERVICES-CRC-API-CYG-CRC32">cyg_crc32</H2
140
><P
141
>These functions implement a 32 bit CRC by Gary S. Brown. They use the
142
polynomial
143
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.</P
144
><TABLE
145
BORDER="5"
146
BGCOLOR="#E0E0F0"
147
WIDTH="70%"
148
><TR
149
><TD
150
><PRE
151
CLASS="PROGRAMLISTING"
152
>cyg_uint32 cyg_crc32(unsigned char &#0042; s, int len);
153
cyg_uint32 cyg_crc32_accumulate(cyg_uint32 crc, unsigned char &#0042; s, int len);</PRE
154
></TD
155
></TR
156
></TABLE
157
><P
158
>The CRC calculation is run over the data pointed to by
159
<TT
160
CLASS="PARAMETER"
161
><I
162
>s</I
163
></TT
164
>, of length <TT
165
CLASS="PARAMETER"
166
><I
167
>len</I
168
></TT
169
>. The
170
CRC is returned as an unsigned long.</P
171
><P
172
> The CRC can be calculated over data separated into multiple
173
buffers by using the function <TT
174
CLASS="PARAMETER"
175
><I
176
> cyg_crc32_accumulate()</I
177
></TT
178
>. The parameter <TT
179
CLASS="PARAMETER"
180
><I
181
>crc</I
182
></TT
183
> should be the
184
result from the previous CRC calculation.</P
185
></DIV
186
><DIV
187
CLASS="SECT2"
188
><H2
189
CLASS="SECT2"
190
><A
191
NAME="SERVICES-CRC-API-CYG-ETHER-CRC32">cyg_ether_crc32</H2
192
><P
193
>These functions implement the 32 bit CRC used by the Ethernet FCS word.</P
194
><TABLE
195
BORDER="5"
196
BGCOLOR="#E0E0F0"
197
WIDTH="70%"
198
><TR
199
><TD
200
><PRE
201
CLASS="PROGRAMLISTING"
202
>cyg_uint32 cyg_ether_crc32(unsigned char &#0042; s, int len);
203
cyg_uint32 cyg_ether_crc32_accumulate(cyg_uint32 crc, unsigned char &#0042; s, int len);</PRE
204
></TD
205
></TR
206
></TABLE
207
><P
208
>The CRC calculation is run over the data pointed to by
209
<TT
210
CLASS="PARAMETER"
211
><I
212
>s</I
213
></TT
214
>, of length <TT
215
CLASS="PARAMETER"
216
><I
217
>len</I
218
></TT
219
>. The
220
CRC is returned as an unsigned long.</P
221
><P
222
> The CRC can be calculated over data separated into multiple
223
buffers by using the function <TT
224
CLASS="PARAMETER"
225
><I
226
> cyg_ether_crc32_accumulate()</I
227
></TT
228
>. The parameter <TT
229
CLASS="PARAMETER"
230
><I
231
>crc</I
232
></TT
233
> should be the
234
result from the previous CRC calculation.</P
235
></DIV
236
><DIV
237
CLASS="SECT2"
238
><H2
239
CLASS="SECT2"
240
><A
241
NAME="SERVICES-CRC-API-CYG-CRC16">cyg_crc16</H2
242
><P
243
>This function implements a 16 bit CRC. It uses the polynomial
244
x^16+x^12+x^5+1.</P
245
><TABLE
246
BORDER="5"
247
BGCOLOR="#E0E0F0"
248
WIDTH="70%"
249
><TR
250
><TD
251
><PRE
252
CLASS="PROGRAMLISTING"
253
>cyg_uint16 cyg_crc16(unsigned char &#0042; s, int len);</PRE
254
></TD
255
></TR
256
></TABLE
257
><P
258
>The CRC calculation is run over the data pointed to by
259
<TT
260
CLASS="PARAMETER"
261
><I
262
>s</I
263
></TT
264
>, of length <TT
265
CLASS="PARAMETER"
266
><I
267
>len</I
268
></TT
269
>. The
270
CRC is returned as an unsigned short.</P
271
></DIV
272
></DIV
273
></DIV
274
><DIV
275
CLASS="NAVFOOTER"
276
><HR
277
ALIGN="LEFT"
278
WIDTH="100%"><TABLE
279
SUMMARY="Footer navigation table"
280
WIDTH="100%"
281
BORDER="0"
282
CELLPADDING="0"
283
CELLSPACING="0"
284
><TR
285
><TD
286
WIDTH="33%"
287
ALIGN="left"
288
VALIGN="top"
289
><A
290
HREF="services-crc.html"
291
ACCESSKEY="P"
292
>Prev</A
293
></TD
294
><TD
295
WIDTH="34%"
296
ALIGN="center"
297
VALIGN="top"
298
><A
299
HREF="ecos-ref.html"
300
ACCESSKEY="H"
301
>Home</A
302
></TD
303
><TD
304
WIDTH="33%"
305
ALIGN="right"
306
VALIGN="top"
307
><A
308
HREF="services-cpuload.html"
309
ACCESSKEY="N"
310
>Next</A
311
></TD
312
></TR
313
><TR
314
><TD
315
WIDTH="33%"
316
ALIGN="left"
317
VALIGN="top"
318
>CRC Algorithms</TD
319
><TD
320
WIDTH="34%"
321
ALIGN="center"
322
VALIGN="top"
323
><A
324
HREF="services-crc.html"
325
ACCESSKEY="U"
326
>Up</A
327
></TD
328
><TD
329
WIDTH="33%"
330
ALIGN="right"
331
VALIGN="top"
332
>CPU load measurements</TD
333
></TR
334
></TABLE
335
></DIV
336
></BODY
337
></HTML
338
>

powered by: WebSVN 2.1.0

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