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

📄 webport_8c-source.html

📁 针对AVR单片机开发的嵌入式操作系统
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head>    <meta name="robots" content="noindex">    <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">    <title>Ethernut WebPort</title>    <link href="doxygen.css" rel="stylesheet" type="text/css"></head><body bgcolor="#ffffff"><!-- Generated by Doxygen 1.4.1 --><div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="globals.html">Globals</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a></div><div class="nav"><a class="el" href="dir_000000.html">webport</a></div><h1>webport.c</h1><a href="webport_8c.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">00001 <span class="comment">/*</span>00002 <span class="comment"> * Copyright (C) 2002-2005 by egnite Software GmbH. All rights reserved.</span>00003 <span class="comment"> *</span>00004 <span class="comment"> * Redistribution and use in source and binary forms, with or without</span>00005 <span class="comment"> * modification, are permitted provided that the following conditions</span>00006 <span class="comment"> * are met:</span>00007 <span class="comment"> *</span>00008 <span class="comment"> * 1. Redistributions of source code must retain the above copyright</span>00009 <span class="comment"> *    notice, this list of conditions and the following disclaimer.</span>00010 <span class="comment"> * 2. Redistributions in binary form must reproduce the above copyright</span>00011 <span class="comment"> *    notice, this list of conditions and the following disclaimer in the</span>00012 <span class="comment"> *    documentation and/or other materials provided with the distribution.</span>00013 <span class="comment"> * 3. Neither the name of the copyright holders nor the names of</span>00014 <span class="comment"> *    contributors may be used to endorse or promote products derived</span>00015 <span class="comment"> *    from this software without specific prior written permission.</span>00016 <span class="comment"> *</span>00017 <span class="comment"> * THIS SOFTWARE IS PROVIDED BY EGNITE SOFTWARE GMBH AND CONTRIBUTORS</span>00018 <span class="comment"> * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT</span>00019 <span class="comment"> * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS</span>00020 <span class="comment"> * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL EGNITE</span>00021 <span class="comment"> * SOFTWARE GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,</span>00022 <span class="comment"> * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,</span>00023 <span class="comment"> * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS</span>00024 <span class="comment"> * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED</span>00025 <span class="comment"> * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,</span>00026 <span class="comment"> * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF</span>00027 <span class="comment"> * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF</span>00028 <span class="comment"> * SUCH DAMAGE.</span>00029 <span class="comment"> *</span>00030 <span class="comment"> * For additional information see http://www.ethernut.de/</span>00031 <span class="comment"> */</span>00032 00033 <span class="comment">/*</span>00034 <span class="comment"> * $Log$</span>00035 <span class="comment"> */</span>00036 <span class="comment"></span>00037 <span class="comment">/*!</span>00038 <span class="comment"> * \file webport.c</span>00039 <span class="comment"> * \brief Main routines.</span>00040 <span class="comment"> */</span>00041 <span class="comment"></span>00042 <span class="comment">/*!</span>00043 <span class="comment"> * \addtogroup xgWPDefs</span>00044 <span class="comment"> */</span><span class="comment"></span>00045 <span class="comment">/*@{*/</span>00046 <span class="comment"></span>00047 <span class="comment">/*!</span>00048 <span class="comment"> * \brief Hard coded MAC address.</span>00049 <span class="comment"> *</span>00050 <span class="comment"> * The MAC address is used in case the system starts without any </span>00051 <span class="comment"> * previously configuration stored in non-volatile memory.</span>00052 <span class="comment"> * Typically the non-volatile memory is preloaded by some other</span>00053 <span class="comment"> * software, like Basemon. On ATmega128 boards, the 'preserve EEPROM'</span>00054 <span class="comment"> * flag should have been set to avoid clearing the EEPROM when the</span>00055 <span class="comment"> * part is erased during the upload of a new application.</span>00056 <span class="comment"> */</span><a name="l00057"></a><a class="code" href="group__xg_w_p_defs.html#ga0">00057</a> <span class="preprocessor">#define MYMAC   0x00, 0x06, 0x98, 0x00, 0x10, 0x00</span>00058 <span class="preprocessor"></span><span class="comment"></span>00059 <span class="comment">/*!</span>00060 <span class="comment"> * \brief Hard coded IP address.</span>00061 <span class="comment"> *</span>00062 <span class="comment"> * The IP address and network mask are used in</span>00063 <span class="comment"> * the same case and when there is no DHCP server available in your</span>00064 <span class="comment"> * LAN.</span>00065 <span class="comment"> *</span>00066 <span class="comment"> */</span><a name="l00067"></a><a class="code" href="group__xg_w_p_defs.html#ga1">00067</a> <span class="preprocessor">#define MYIP    "192.168.192.100"</span>00068 <span class="preprocessor"></span><span class="comment"></span>00069 <span class="comment">/*!</span>00070 <span class="comment"> * \brief Hard coded IP mask.</span>00071 <span class="comment"> */</span><a name="l00072"></a><a class="code" href="group__xg_w_p_defs.html#ga2">00072</a> <span class="preprocessor">#define MYMASK  "255.255.255.0"</span>00073 <span class="preprocessor"></span><span class="comment"></span>00074 <span class="comment">/*@}*/</span>00075 00076 <span class="comment">/*</span>00077 <span class="comment"> * Some standard C library headers.</span>00078 <span class="comment"> */</span>00079 <span class="preprocessor">#include &lt;string.h&gt;</span>00080 <span class="preprocessor">#include &lt;stdio.h&gt;</span>00081 <span class="preprocessor">#include &lt;io.h&gt;</span>00082 00083 <span class="comment">/*</span>00084 <span class="comment"> * Include the proper header file related to our Ethernet hardware.</span>00085 <span class="comment"> * Ethernut 1.3 and Charon II use the 10 MBit Realtek RTL8019AS, while </span>00086 <span class="comment"> * Ethernut 2 is equipped with the 10/100 MBit LAN91C111, manufactured </span>00087 <span class="comment"> * by SMSC.</span>00088 <span class="comment"> */</span>00089 <span class="preprocessor">#ifdef ETHERNUT2</span>00090 <span class="preprocessor"></span><span class="preprocessor">#include &lt;dev/lanc111.h&gt;</span>00091 <span class="preprocessor">#else</span>00092 <span class="preprocessor"></span><span class="preprocessor">#include &lt;dev/nicrtl.h&gt;</span>00093 <span class="preprocessor">#endif</span>00094 <span class="preprocessor"></span>00095 00096 <span class="comment">/*</span>00097 <span class="comment"> * UROM is a most simple file system to be used for storing web</span>00098 <span class="comment"> * contents.</span>00099 <span class="comment"> */</span>00100 <span class="preprocessor">#include &lt;dev/urom.h&gt;</span>00101 00102 <span class="comment">/*</span>00103 <span class="comment"> * More Nut/OS header files.</span>00104 <span class="comment"> */</span>00105 <span class="preprocessor">#include &lt;sys/version.h&gt;</span>00106 <span class="preprocessor">#include &lt;sys/confnet.h&gt;</span>00107 <span class="preprocessor">#include &lt;sys/heap.h&gt;</span>00108 <span class="preprocessor">#include &lt;sys/timer.h&gt;</span>00109 <span class="preprocessor">#include &lt;sys/thread.h&gt;</span>00110 <span class="preprocessor">#include &lt;sys/socket.h&gt;</span>00111 00112 <span class="comment">/*</span>00113 <span class="comment"> * Basic internet functions.</span>00114 <span class="comment"> */</span>00115 <span class="preprocessor">#include &lt;arpa/inet.h&gt;</span>00116 00117 <span class="comment">/*</span>00118 <span class="comment"> * Beside simple TCP/IP routines, Nut/Net offers some higher</span>00119 <span class="comment"> * level protocol libraries. We make use of the DHCP client</span>00120 <span class="comment"> * and the HTTP helper routines.</span>00121 <span class="comment"> */</span>00122 <span class="preprocessor">#include &lt;pro/dhcp.h&gt;</span>00123 <span class="preprocessor">#include &lt;pro/httpd.h&gt;</span>00124 00125 00126 <span class="preprocessor">#include "<a class="code" href="webport_8h.html">webport.h</a>"</span>00127 00128 <span class="comment">/*</span>00129 <span class="comment"> * We optionally use an UART for debug output.</span>00130 <span class="comment"> */</span>00131 <span class="preprocessor">#ifdef WP_STATUSOUT</span>00132 <span class="preprocessor"></span><span class="preprocessor">#include &lt;dev/debug.h&gt;</span>00133 <span class="preprocessor">#endif</span>00134 <span class="preprocessor"></span>00135 <span class="comment">/*</span>00136 <span class="comment"> * For debugging purposes, several routines are available to</span>00137 <span class="comment"> * display the thread list, trace TCP packets etc. However,</span>00138 <span class="comment"> * this requires to recompile and relink the system with</span>00139 <span class="comment"> * NUTDEBUG defined in the compile options.</span>00140 <span class="comment"> */</span>00141 <span class="preprocessor">#ifdef NUTDEBUG</span>00142 <span class="preprocessor"></span><span class="preprocessor">#include &lt;sys/osdebug.h&gt;</span>00143 <span class="preprocessor">#include &lt;net/netdebug.h&gt;</span>00144 <span class="preprocessor">#endif</span>

⌨️ 快捷键说明

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