📄 ethernet_8h-source.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>/opentcp/include/inet/ethernet.h Source File</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.2.18 --><center><a class="qindex" href="main.html">Main Page</a> <a class="qindex" href="modules.html">Modules</a> <a class="qindex" href="annotated.html">Data Structures</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Data Fields</a> <a class="qindex" href="globals.html">Globals</a> <a class="qindex" href="pages.html">Related Pages</a> <a class="qindex" href="examples.html">Examples</a> </center><hr><h1>/opentcp/include/inet/ethernet.h</h1><a href="ethernet_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/*</span>00002 <span class="comment"> *Copyright (c) 2000-2002 Viola Systems Ltd.</span>00003 <span class="comment"> *All rights reserved.</span>00004 <span class="comment"> *</span>00005 <span class="comment"> *Redistribution and use in source and binary forms, with or without </span>00006 <span class="comment"> *modification, are permitted provided that the following conditions </span>00007 <span class="comment"> *are met:</span>00008 <span class="comment"> *</span>00009 <span class="comment"> *1. Redistributions of source code must retain the above copyright </span>00010 <span class="comment"> *notice, this list of conditions and the following disclaimer.</span>00011 <span class="comment"> *</span>00012 <span class="comment"> *2. Redistributions in binary form must reproduce the above copyright </span>00013 <span class="comment"> *notice, this list of conditions and the following disclaimer in the </span>00014 <span class="comment"> *documentation and/or other materials provided with the distribution.</span>00015 <span class="comment"> *</span>00016 <span class="comment"> *3. The end-user documentation included with the redistribution, if </span>00017 <span class="comment"> *any, must include the following acknowledgment:</span>00018 <span class="comment"> * "This product includes software developed by Viola </span>00019 <span class="comment"> * Systems (http://www.violasystems.com/)."</span>00020 <span class="comment"> *</span>00021 <span class="comment"> *Alternately, this acknowledgment may appear in the software itself, </span>00022 <span class="comment"> *if and wherever such third-party acknowledgments normally appear.</span>00023 <span class="comment"> *</span>00024 <span class="comment"> *4. The names "OpenTCP" and "Viola Systems" must not be used to </span>00025 <span class="comment"> *endorse or promote products derived from this software without prior </span>00026 <span class="comment"> *written permission. For written permission, please contact </span>00027 <span class="comment"> *opentcp@opentcp.org.</span>00028 <span class="comment"> *</span>00029 <span class="comment"> *5. Products derived from this software may not be called "OpenTCP", </span>00030 <span class="comment"> *nor may "OpenTCP" appear in their name, without prior written </span>00031 <span class="comment"> *permission of the Viola Systems Ltd.</span>00032 <span class="comment"> *</span>00033 <span class="comment"> *THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED </span>00034 <span class="comment"> *WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF </span>00035 <span class="comment"> *MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. </span>00036 <span class="comment"> *IN NO EVENT SHALL VIOLA SYSTEMS LTD. OR ITS CONTRIBUTORS BE LIABLE </span>00037 <span class="comment"> *FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR </span>00038 <span class="comment"> *CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF </span>00039 <span class="comment"> *SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR </span>00040 <span class="comment"> *BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, </span>00041 <span class="comment"> *WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE </span>00042 <span class="comment"> *OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, </span>00043 <span class="comment"> *EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span>00044 <span class="comment"> *====================================================================</span>00045 <span class="comment"> *</span>00046 <span class="comment"> *OpenTCP is the unified open source TCP/IP stack available on a series </span>00047 <span class="comment"> *of 8/16-bit microcontrollers, please see <http://www.opentcp.org>.</span>00048 <span class="comment"> *</span>00049 <span class="comment"> *For more information on how to network-enable your devices, or how to </span>00050 <span class="comment"> *obtain commercial technical support for OpenTCP, please see </span>00051 <span class="comment"> *<http://www.violasystems.com/>.</span>00052 <span class="comment"> */</span>00053 00065 <span class="preprocessor">#ifndef INCLUDE_ETHERNET_H</span>00066 <span class="preprocessor"></span><span class="preprocessor">#define INCLUDE_ETHERNET_H</span>00067 <span class="preprocessor"></span>00068 <span class="preprocessor">#include <<a class="code" href="datatypes_8h.html">inet/datatypes.h</a>></span>00069 00070 <span class="comment">/* Symbolic constants */</span>00071 00072 <span class="preprocessor">#define ETH_ADDRESS_LEN 6</span>00073 <span class="preprocessor"></span>00074 <span class="comment">/* Protocol Constants */</span>00075 00076 <span class="preprocessor">#define ETH_HEADER_LEN 14</span>00077 <span class="preprocessor"></span><span class="preprocessor">#define ETH_CHIP_HEADER_LEN 4</span>00078 <span class="preprocessor"></span><span class="preprocessor">#define ETH_MTU 1500</span>00079 <span class="preprocessor"></span><a name="l00080"></a><a class="code" href="ethernet_8h.html#a4">00080</a> <span class="preprocessor">#define PROTOCOL_IP 0x0800 </span><a name="l00081"></a><a class="code" href="ethernet_8h.html#a5">00081</a> <span class="preprocessor">#define PROTOCOL_ARP 0x0806 </span>00083 <span class="preprocessor"></span><span class="comment">/* Page0 register offsets */</span>00084 <a name="l00085"></a><a class="code" href="ethernet_8h.html#a6">00085</a> <span class="preprocessor">#define CR 0x00 </span><a name="l00086"></a><a class="code" href="ethernet_8h.html#a7">00086</a> <span class="preprocessor">#define PSTART 0x01 </span><a name="l00087"></a><a class="code" href="ethernet_8h.html#a8">00087</a> <span class="preprocessor">#define PSTOP 0x02 </span><a name="l00088"></a><a class="code" href="ethernet_8h.html#a9">00088</a> <span class="preprocessor">#define BOUNDARY 0x03 </span><a name="l00091"></a><a class="code" href="ethernet_8h.html#a10">00091</a> <span class="preprocessor">#define TPSR 0x04 </span><a name="l00092"></a><a class="code" href="ethernet_8h.html#a11">00092</a> <span class="preprocessor">#define TSR 0x04 </span><a name="l00093"></a><a class="code" href="ethernet_8h.html#a12">00093</a> <span class="preprocessor">#define TBCR0 0x05 </span><a name="l00094"></a><a class="code" href="ethernet_8h.html#a13">00094</a> <span class="preprocessor">#define TBCR1 0x06 </span><a name="l00095"></a><a class="code" href="ethernet_8h.html#a14">00095</a> <span class="preprocessor">#define ISR 0x07 </span><a name="l00096"></a><a class="code" href="ethernet_8h.html#a15">00096</a> <span class="preprocessor">#define RSAR0 0x08 </span>00097 <span class="preprocessor">#define RSAR1 0x09 </span><a name="l00098"></a><a class="code" href="ethernet_8h.html#a17">00098</a> <span class="preprocessor"></span><span class="preprocessor">#define RBCR0 0x0A </span>00099 <span class="preprocessor">#define RBCR1 0x0B</span><a name="l00100"></a><a class="code" href="ethernet_8h.html#a19">00100</a> <span class="preprocessor"></span><span class="preprocessor">#define RCR 0x0C </span><a name="l00101"></a><a class="code" href="ethernet_8h.html#a20">00101</a> <span class="preprocessor">#define TCR 0x0D </span><a name="l00102"></a><a class="code" href="ethernet_8h.html#a21">00102</a> <span class="preprocessor">#define DCR 0x0E </span><a name="l00103"></a><a class="code" href="ethernet_8h.html#a22">00103</a> <span class="preprocessor">#define IMR 0x0F </span>00105 <span class="preprocessor"></span><span class="comment">/* Page 1 register offsets */</span>00106 <a name="l00107"></a><a class="code" href="ethernet_8h.html#a23">00107</a> <span class="preprocessor">#define PAR0 0x01 </span>00108 <span class="preprocessor">#define PAR1 0x02</span>00109 <span class="preprocessor"></span><span class="preprocessor">#define PAR2 0x03</span>00110 <span class="preprocessor"></span><span class="preprocessor">#define PAR3 0x04</span>00111 <span class="preprocessor"></span><span class="preprocessor">#define PAR4 0x05</span>00112 <span class="preprocessor"></span><span class="preprocessor">#define PAR5 0x06</span><a name="l00113"></a><a class="code" href="ethernet_8h.html#a29">00113</a> <span class="preprocessor"></span><span class="preprocessor">#define CURR 0x07 </span><a name="l00114"></a><a class="code" href="ethernet_8h.html#a30">00114</a> <span class="preprocessor">#define MAR0 0x08 </span>00116 <span class="preprocessor"></span><span class="comment">/* DMA Ports */</span>00117 <a name="l00118"></a><a class="code" href="ethernet_8h.html#a31">00118</a> <span class="preprocessor">#define IOPORT 0x10 </span>00119 <span class="preprocessor">#define RESETPORT 0x1F </span>00120 <span class="preprocessor"></span>00121 00122 <span class="comment">/* Buffer addresses */</span><a name="l00123"></a><a class="code" href="ethernet_8h.html#a33">00123</a> <span class="preprocessor">#define RXBUF_START 0x40 </span><a name="l00124"></a><a class="code" href="ethernet_8h.html#a34">00124</a> <span class="preprocessor">#define RXBUF_END 0x4D </span><a name="l00125"></a><a class="code" href="ethernet_8h.html#a35">00125</a> <span class="preprocessor">#define ARP_BUFFER 0x5F </span><a name="l00126"></a><a class="code" href="ethernet_8h.html#a36">00126</a> <span class="preprocessor">#define ICMP_BUF 0x4D </span><a name="l00127"></a><a class="code" href="ethernet_8h.html#a37">00127</a> <span class="preprocessor">#define TCP_BUF 0x53 </span><a name="l00128"></a><a class="code" href="ethernet_8h.html#a38">00128</a> <span class="preprocessor">#define UDP_BUF 0x59 </span><a name="l00142"></a><a class="code" href="structethernet__frame.html">00142</a> <span class="preprocessor">struct ethernet_frame</span>00143 <span class="preprocessor"></span>{<a name="l00144"></a><a class="code" href="structethernet__frame.html#m0">00144</a> UINT8 destination[ETH_ADDRESS_LEN]; <a name="l00148"></a><a class="code" href="structethernet__frame.html#m1">00148</a> UINT8 source[ETH_ADDRESS_LEN]; <a name="l00152"></a><a class="code" href="structethernet__frame.html#m2">00152</a> UINT16 frame_size; <a name="l00155"></a><a class="code" href="structethernet__frame.html#m3">00155</a> UINT16 protocol; <a name="l00161"></a><a class="code" href="structethernet__frame.html#m4">00161</a> UINT16 buf_index; 00166 };00167 00168 <span class="comment">/* API prototypes */</span>00169 <span class="keywordtype">void</span> <a class="code" href="ethernet_8c.html#a5">outNE2000</a>(UINT8, UINT8);00170 <span class="keywordtype">void</span> <a class="code" href="ethernet_8c.html#a6">outNE2000again</a>(UINT8);00171 UINT8 <a class="code" href="ethernet_8c.html#a8">inNE2000</a>(UINT8);00172 UINT8 <a class="code" href="ethernet_8c.html#a9">inNE2000again</a>(<span class="keywordtype">void</span>);00173 UINT8 <a class="code" href="ethernet_8c.html#a11">NE2000CheckRxFrame</a>(<span class="keywordtype">void</span>);00174 <span class="keywordtype">void</span> <a class="code" href="ethernet_8c.html#a12">NE2000DumpRxFrame</a>(<span class="keywordtype">void</span>);00175 <span class="keywordtype">void</span> <a class="code" href="ethernet_8c.html#a1">NE2000Init</a>(UINT8*);00176 <span class="keywordtype">void</span> <a class="code" href="group__periodic__functions.html#a1">NE2000CheckOverFlow</a>(<span class="keywordtype">void</span>);00177 UINT8 <a class="code" href="ethernet_8c.html#a15">NE2000ReceiveFrame</a>(<span class="keywordtype">void</span>);00178 <span class="keywordtype">void</span> <a class="code" href="ethernet_8c.html#a16">InitTransmission</a>(UINT8);00179 <span class="keywordtype">void</span> <a class="code" href="ethernet_8c.html#a17">NE2000WriteEthernetHeader</a>(<span class="keyword">struct</span> <a class="code" href="structethernet__frame.html">ethernet_frame</a>*);00180 <span class="keywordtype">void</span> <a class="code" href="ethernet_8c.html#a18">NE2000DMAInit</a>(UINT8);00181 <span class="keywordtype">void</span> <a class="code" href="ethernet_8c.html#a19">NE2000DMAInit_position</a>(UINT16);00182 <span class="keywordtype">void</span> <a class="code" href="ethernet_8c.html#a20">NE2000SendFrame</a>(UINT16);00183 <span class="keywordtype">void</span> <a class="code" href="ethernet_8c.html#a21">NE2000EnterSleep</a>(<span class="keywordtype">void</span>);00184 <span class="keywordtype">void</span> <a class="code" href="ethernet_8c.html#a22">NE2000ExitSleep</a>(<span class="keywordtype">void</span>);00185 00186 00187 <span class="preprocessor">#endif</span>00188 <span class="preprocessor"></span>00189 </pre></div><hr><address style="align: right;"><small>Generated on Sun Aug 3 20:32:59 2003 for OpenTCP by<a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border=0 width=110 height=53></a>1.2.18 </small></address></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -