1 <!-- 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. -->
13 ><meta name="MSSmartTagsPreventParsing" content="TRUE">
16 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
19 TITLE="eCos Reference Manual"
20 HREF="ecos-ref.html"><LINK
22 TITLE="CRC Algorithms"
23 HREF="services-crc.html"><LINK
25 TITLE="CRC Algorithms"
26 HREF="services-crc.html"><LINK
28 TITLE="CPU load measurements"
29 HREF="services-cpuload.html"></HEAD
40 SUMMARY="Header navigation table"
49 >eCos Reference Manual</TH
57 HREF="services-crc.html"
71 HREF="services-cpuload.html"
84 NAME="CRC-FUNCTIONS">Chapter 50. CRC Functions</H1
90 NAME="SERVICES-CRC-API">CRC API</H1
92 >The package implements a number of CRC functions as described below.
93 The API to these functions is in the include file
103 NAME="SERVICES-CRC-API-CYG-POSIX-CRC32">cyg_posix_crc32</H2
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
114 CLASS="PROGRAMLISTING"
115 >cyg_uint32 cyg_posix_crc32(unsigned char * s, int len);</PRE
120 >The CRC calculation is run over the data pointed to by
132 CRC is returned as an unsigned long.</P
139 NAME="SERVICES-CRC-API-CYG-CRC32">cyg_crc32</H2
141 >These functions implement a 32 bit CRC by Gary S. Brown. They use the
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
151 CLASS="PROGRAMLISTING"
152 >cyg_uint32 cyg_crc32(unsigned char * s, int len);
153 cyg_uint32 cyg_crc32_accumulate(cyg_uint32 crc, unsigned char * s, int len);</PRE
158 >The CRC calculation is run over the data pointed to by
170 CRC is returned as an unsigned long.</P
172 > The CRC can be calculated over data separated into multiple
173 buffers by using the function <TT
176 > cyg_crc32_accumulate()</I
184 result from the previous CRC calculation.</P
191 NAME="SERVICES-CRC-API-CYG-ETHER-CRC32">cyg_ether_crc32</H2
193 >These functions implement the 32 bit CRC used by the Ethernet FCS word.</P
201 CLASS="PROGRAMLISTING"
202 >cyg_uint32 cyg_ether_crc32(unsigned char * s, int len);
203 cyg_uint32 cyg_ether_crc32_accumulate(cyg_uint32 crc, unsigned char * s, int len);</PRE
208 >The CRC calculation is run over the data pointed to by
220 CRC is returned as an unsigned long.</P
222 > The CRC can be calculated over data separated into multiple
223 buffers by using the function <TT
226 > cyg_ether_crc32_accumulate()</I
234 result from the previous CRC calculation.</P
241 NAME="SERVICES-CRC-API-CYG-CRC16">cyg_crc16</H2
243 >This function implements a 16 bit CRC. It uses the polynomial
252 CLASS="PROGRAMLISTING"
253 >cyg_uint16 cyg_crc16(unsigned char * s, int len);</PRE
258 >The CRC calculation is run over the data pointed to by
270 CRC is returned as an unsigned short.</P
279 SUMMARY="Footer navigation table"
290 HREF="services-crc.html"
308 HREF="services-cpuload.html"
324 HREF="services-crc.html"
332 >CPU load measurements</TD