3 FreeRTOS V5.4.0 - Copyright (C) 2003-2009 Richard Barry.
\r
5 This file is part of the FreeRTOS distribution.
\r
7 FreeRTOS is free software; you can redistribute it and/or modify it under
\r
8 the terms of the GNU General Public License (version 2) as published by the
\r
9 Free Software Foundation and modified by the FreeRTOS exception.
\r
10 **NOTE** The exception to the GPL is included to allow you to distribute a
\r
11 combined work that includes FreeRTOS without being obliged to provide the
\r
12 source code for proprietary components outside of the FreeRTOS kernel.
\r
13 Alternative commercial license and support terms are also available upon
\r
14 request. See the licensing section of http://www.FreeRTOS.org for full
\r
17 FreeRTOS is distributed in the hope that it will be useful, but WITHOUT
\r
18 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
\r
19 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
\r
22 You should have received a copy of the GNU General Public License along
\r
23 with FreeRTOS; if not, write to the Free Software Foundation, Inc., 59
\r
24 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
\r
27 ***************************************************************************
\r
29 * Looking for a quick start? Then check out the FreeRTOS eBook! *
\r
30 * See http://www.FreeRTOS.org/Documentation for details *
\r
32 ***************************************************************************
\r
36 Please ensure to read the configuration and relevant port sections of the
\r
37 online documentation.
\r
39 http://www.FreeRTOS.org - Documentation, latest information, license and
\r
42 http://www.SafeRTOS.com - A version that is certified for use in safety
\r
45 http://www.OpenRTOS.com - Commercial support, development, porting,
\r
46 licensing and training services.
\r
50 Implements a simplistic WEB server. Every time a connection is made and
\r
51 data is received a dynamic page that shows the current TCP/IP statistics
\r
52 is generated and returned. The connection is then closed.
\r
56 /*------------------------------------------------------------------------------*/
\r
58 /*------------------------------------------------------------------------------*/
\r
60 /* Standard includes. */
\r
64 /* Scheduler includes. */
\r
65 #include "FreeRTOS.h"
\r
69 /* Demo includes. */
\r
70 #include "BasicWEB.h"
\r
72 /* lwIP includes. */
\r
73 #include "lwip/api.h"
\r
74 #include "lwip/tcpip.h"
\r
75 #include "lwip/memp.h"
\r
76 #include "lwip/stats.h"
\r
77 #include "netif/loopif.h"
\r
81 #define lwipTCP_STACK_SIZE 600
\r
84 /*------------------------------------------------------------------------------*/
\r
86 /*------------------------------------------------------------------------------*/
\r
87 static struct netif EMAC_if;
\r
89 /*------------------------------------------------------------------------------*/
\r
91 /*------------------------------------------------------------------------------*/
\r
94 void vlwIPInit( void )
\r
96 /* Initialize lwIP and its interface layer. */
\r
103 sys_set_state(( signed portCHAR * ) "lwIP", lwipTCP_STACK_SIZE);
\r
104 tcpip_init( NULL, NULL );
\r
105 sys_set_default_state();
\r
107 /*------------------------------------------------------------*/
\r
109 void vBasicWEBServer( void *pvParameters )
\r
111 struct ip_addr xIpAddr, xNetMast, xGateway;
\r
112 extern err_t ethernetif_init( struct netif *netif );
\r
114 /* Parameters are not used - suppress compiler error. */
\r
115 ( void ) pvParameters;
\r
117 /* Create and configure the EMAC interface. */
\r
118 IP4_ADDR( &xIpAddr, emacIPADDR0, emacIPADDR1, emacIPADDR2, emacIPADDR3 );
\r
119 IP4_ADDR( &xNetMast, emacNET_MASK0, emacNET_MASK1, emacNET_MASK2, emacNET_MASK3 );
\r
120 IP4_ADDR( &xGateway, emacGATEWAY_ADDR0, emacGATEWAY_ADDR1, emacGATEWAY_ADDR2, emacGATEWAY_ADDR3 );
\r
121 netif_add( &EMAC_if, &xIpAddr, &xNetMast, &xGateway, NULL, ethernetif_init, tcpip_input );
\r
123 /* make it the default interface */
\r
124 netif_set_default( &EMAC_if );
\r
127 netif_set_up(&EMAC_if);
\r
129 /* Initialize HTTP */
\r
132 /* Nothing else to do. No point hanging around. */
\r
133 vTaskDelete( NULL );
\r