⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 crc-functions.html

📁 有关ecos2。0介绍了实时嵌入式的结构以及线程调度的实现和内存的管理等
💻 HTML
字号:
<!-- Copyright (C) 2003 Red Hat, Inc.                                --><!-- This material may be distributed only subject to the terms      --><!-- and conditions set forth in the Open Publication License, v1.0  --><!-- or later (the latest version is presently available at          --><!-- http://www.opencontent.org/openpub/).                           --><!-- Distribution of the work or derivative of the work in any       --><!-- standard (paper) book form is prohibited unless prior           --><!-- permission is obtained from the copyright holder.               --><HTML><HEAD><TITLE>CRC Functions</TITLE><meta name="MSSmartTagsPreventParsing" content="TRUE"><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+"><LINKREL="HOME"TITLE="eCos Reference Manual"HREF="ecos-ref.html"><LINKREL="UP"TITLE="CRC Algorithms"HREF="services-crc.html"><LINKREL="PREVIOUS"TITLE="CRC Algorithms"HREF="services-crc.html"><LINKREL="NEXT"TITLE="CPU load measurements"HREF="services-cpuload.html"></HEAD><BODYCLASS="CHAPTER"BGCOLOR="#FFFFFF"TEXT="#000000"LINK="#0000FF"VLINK="#840084"ALINK="#0000FF"><DIVCLASS="NAVHEADER"><TABLESUMMARY="Header navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><THCOLSPAN="3"ALIGN="center">eCos Reference Manual</TH></TR><TR><TDWIDTH="10%"ALIGN="left"VALIGN="bottom"><AHREF="services-crc.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="80%"ALIGN="center"VALIGN="bottom"></TD><TDWIDTH="10%"ALIGN="right"VALIGN="bottom"><AHREF="services-cpuload.html"ACCESSKEY="N">Next</A></TD></TR></TABLE><HRALIGN="LEFT"WIDTH="100%"></DIV><DIVCLASS="CHAPTER"><H1><ANAME="CRC-FUNCTIONS">Chapter 50. CRC Functions</H1><DIVCLASS="SECT1"><H1CLASS="SECT1"><ANAME="SERVICES-CRC-API">CRC API</H1><P>The package implements a number of CRC functions as described below.The API to these functions is in the include file<TTCLASS="FILENAME">cyg/crc/crc.h</TT>.</P><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="SERVICES-CRC-API-CYG-POSIX-CRC32">cyg_posix_crc32</H2><P>This function implements a 32 bit CRC which is compliant to the POSIX1008.2 Standard. This is the same as the Linux cksum program.</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">cyg_uint32 cyg_posix_crc32(unsigned char &#0042; s, int len);</PRE></TD></TR></TABLE><P>The CRC calculation is run over the data pointed to by<TTCLASS="PARAMETER"><I>s</I></TT>, of length <TTCLASS="PARAMETER"><I>len</I></TT>. TheCRC is returned as an unsigned long.</P></DIV><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="SERVICES-CRC-API-CYG-CRC32">cyg_crc32</H2><P>These functions implement a 32 bit CRC by Gary S. Brown. They use thepolynomialX^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><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">cyg_uint32 cyg_crc32(unsigned char &#0042; s, int len);cyg_uint32 cyg_crc32_accumulate(cyg_uint32 crc, unsigned char &#0042; s, int len);</PRE></TD></TR></TABLE><P>The CRC calculation is run over the data pointed to by<TTCLASS="PARAMETER"><I>s</I></TT>, of length <TTCLASS="PARAMETER"><I>len</I></TT>. TheCRC is returned as an unsigned long.</P><P> The CRC can be calculated over data separated into multiplebuffers by using the function <TTCLASS="PARAMETER"><I> cyg_crc32_accumulate()</I></TT>. The parameter <TTCLASS="PARAMETER"><I>crc</I></TT> should be theresult from the previous CRC calculation.</P></DIV><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="SERVICES-CRC-API-CYG-ETHER-CRC32">cyg_ether_crc32</H2><P>These functions implement the 32 bit CRC used by the Ethernet FCS word.</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">cyg_uint32 cyg_ether_crc32(unsigned char &#0042; s, int len);cyg_uint32 cyg_ether_crc32_accumulate(cyg_uint32 crc, unsigned char &#0042; s, int len);</PRE></TD></TR></TABLE><P>The CRC calculation is run over the data pointed to by<TTCLASS="PARAMETER"><I>s</I></TT>, of length <TTCLASS="PARAMETER"><I>len</I></TT>. TheCRC is returned as an unsigned long.</P><P> The CRC can be calculated over data separated into multiplebuffers by using the function <TTCLASS="PARAMETER"><I> cyg_ether_crc32_accumulate()</I></TT>. The parameter <TTCLASS="PARAMETER"><I>crc</I></TT> should be theresult from the previous CRC calculation.</P></DIV><DIVCLASS="SECT2"><H2CLASS="SECT2"><ANAME="SERVICES-CRC-API-CYG-CRC16">cyg_crc16</H2><P>This function implements a 16 bit CRC. It uses the polynomialx^16+x^12+x^5+1.</P><TABLEBORDER="5"BGCOLOR="#E0E0F0"WIDTH="70%"><TR><TD><PRECLASS="PROGRAMLISTING">cyg_uint16 cyg_crc16(unsigned char &#0042; s, int len);</PRE></TD></TR></TABLE><P>The CRC calculation is run over the data pointed to by<TTCLASS="PARAMETER"><I>s</I></TT>, of length <TTCLASS="PARAMETER"><I>len</I></TT>. TheCRC is returned as an unsigned short.</P></DIV></DIV></DIV><DIVCLASS="NAVFOOTER"><HRALIGN="LEFT"WIDTH="100%"><TABLESUMMARY="Footer navigation table"WIDTH="100%"BORDER="0"CELLPADDING="0"CELLSPACING="0"><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top"><AHREF="services-crc.html"ACCESSKEY="P">Prev</A></TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="ecos-ref.html"ACCESSKEY="H">Home</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top"><AHREF="services-cpuload.html"ACCESSKEY="N">Next</A></TD></TR><TR><TDWIDTH="33%"ALIGN="left"VALIGN="top">CRC Algorithms</TD><TDWIDTH="34%"ALIGN="center"VALIGN="top"><AHREF="services-crc.html"ACCESSKEY="U">Up</A></TD><TDWIDTH="33%"ALIGN="right"VALIGN="top">CPU load measurements</TD></TR></TABLE></DIV></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -