3 FreeRTOS.org V5.2.0 - Copyright (C) 2003-2009 Richard Barry.
\r
5 This file is part of the FreeRTOS.org distribution.
\r
7 FreeRTOS.org is free software; you can redistribute it and/or modify it
\r
8 under the terms of the GNU General Public License (version 2) as published
\r
9 by the Free Software Foundation and modified by the FreeRTOS exception.
\r
11 FreeRTOS.org is distributed in the hope that it will be useful, but WITHOUT
\r
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
\r
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
\r
16 You should have received a copy of the GNU General Public License along
\r
17 with FreeRTOS.org; if not, write to the Free Software Foundation, Inc., 59
\r
18 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
\r
20 A special exception to the GPL is included to allow you to distribute a
\r
21 combined work that includes FreeRTOS.org without being obliged to provide
\r
22 the source code for any proprietary components. See the licensing section
\r
23 of http://www.FreeRTOS.org for full details.
\r
26 ***************************************************************************
\r
28 * Get the FreeRTOS eBook! See http://www.FreeRTOS.org/Documentation *
\r
30 * This is a concise, step by step, 'hands on' guide that describes both *
\r
31 * general multitasking concepts and FreeRTOS specifics. It presents and *
\r
32 * explains numerous examples that are written using the FreeRTOS API. *
\r
33 * Full source code for all the examples is provided in an accompanying *
\r
36 ***************************************************************************
\r
40 Please ensure to read the configuration and relevant port sections of the
\r
41 online documentation.
\r
43 http://www.FreeRTOS.org - Documentation, latest information, license and
\r
46 http://www.SafeRTOS.com - A version that is certified for use in safety
\r
49 http://www.OpenRTOS.com - Commercial support, development, porting,
\r
50 licensing and training services.
\r
54 Implements a simplistic WEB server. Every time a connection is made and
\r
55 data is received a dynamic page that shows the current TCP/IP statistics
\r
56 is generated and returned. The connection is then closed.
\r
60 /*------------------------------------------------------------------------------*/
\r
62 /*------------------------------------------------------------------------------*/
\r
64 /* Standard includes. */
\r
68 /* Scheduler includes. */
\r
69 #include "FreeRTOS.h"
\r
73 /* Demo includes. */
\r
74 #include "BasicWEB.h"
\r
76 /* lwIP includes. */
\r
77 #include "lwip/api.h"
\r
78 #include "lwip/tcpip.h"
\r
79 #include "lwip/memp.h"
\r
80 #include "lwip/stats.h"
\r
81 #include "netif/loopif.h"
\r
85 #define lwipTCP_STACK_SIZE 600
\r
88 /*------------------------------------------------------------------------------*/
\r
90 /*------------------------------------------------------------------------------*/
\r
91 static struct netif EMAC_if;
\r
93 /*------------------------------------------------------------------------------*/
\r
95 /*------------------------------------------------------------------------------*/
\r
98 void vlwIPInit( void )
\r
100 /* Initialize lwIP and its interface layer. */
\r
107 sys_set_state(( signed portCHAR * ) "lwIP", lwipTCP_STACK_SIZE);
\r
108 tcpip_init( NULL, NULL );
\r
109 sys_set_default_state();
\r
111 /*------------------------------------------------------------*/
\r
113 void vBasicWEBServer( void *pvParameters )
\r
115 struct ip_addr xIpAddr, xNetMast, xGateway;
\r
116 extern err_t ethernetif_init( struct netif *netif );
\r
118 /* Parameters are not used - suppress compiler error. */
\r
119 ( void ) pvParameters;
\r
121 /* Create and configure the EMAC interface. */
\r
122 IP4_ADDR( &xIpAddr, emacIPADDR0, emacIPADDR1, emacIPADDR2, emacIPADDR3 );
\r
123 IP4_ADDR( &xNetMast, emacNET_MASK0, emacNET_MASK1, emacNET_MASK2, emacNET_MASK3 );
\r
124 IP4_ADDR( &xGateway, emacGATEWAY_ADDR0, emacGATEWAY_ADDR1, emacGATEWAY_ADDR2, emacGATEWAY_ADDR3 );
\r
125 netif_add( &EMAC_if, &xIpAddr, &xNetMast, &xGateway, NULL, ethernetif_init, tcpip_input );
\r
127 /* make it the default interface */
\r
128 netif_set_default( &EMAC_if );
\r
131 netif_set_up(&EMAC_if);
\r
133 /* Initialize HTTP */
\r
136 /* Nothing else to do. No point hanging around. */
\r
137 vTaskDelete( NULL );
\r