3 FreeRTOS.org V5.1.2 - Copyright (C) 2003-2006 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
\r
8 it under the terms of the GNU General Public License as published by
\r
9 the Free Software Foundation; either version 2 of the License, or
\r
10 (at your option) any later version.
\r
12 FreeRTOS.org is distributed in the hope that it will be useful,
\r
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
15 GNU General Public License for more details.
\r
17 You should have received a copy of the GNU General Public License
\r
18 along with FreeRTOS.org; if not, write to the Free Software
\r
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
\r
21 A special exception to the GPL can be applied should you wish to distribute
\r
22 a combined work that includes FreeRTOS.org, without being obliged to provide
\r
23 the source code for any proprietary components. See the licensing section
\r
24 of http://www.FreeRTOS.org for full details of how and when the exception
\r
27 ***************************************************************************
\r
28 See http://www.FreeRTOS.org for documentation, latest information, license
\r
29 and contact details. Please ensure to read the configuration and relevant
\r
30 port sections of the online documentation.
\r
31 ***************************************************************************
\r
35 Implements a simplistic WEB server. Every time a connection is made and
\r
36 data is received a dynamic page that shows the current TCP/IP statistics
\r
37 is generated and returned. The connection is then closed.
\r
41 /*------------------------------------------------------------------------------*/
\r
43 /*------------------------------------------------------------------------------*/
\r
45 /* Standard includes. */
\r
49 /* Scheduler includes. */
\r
50 #include "FreeRTOS.h"
\r
54 /* Demo includes. */
\r
55 #include "BasicWEB.h"
\r
57 /* lwIP includes. */
\r
58 #include "lwip/api.h"
\r
59 #include "lwip/tcpip.h"
\r
60 #include "lwip/memp.h"
\r
61 #include "lwip/stats.h"
\r
62 #include "netif/loopif.h"
\r
66 #define lwipTCP_STACK_SIZE 600
\r
69 /*------------------------------------------------------------------------------*/
\r
71 /*------------------------------------------------------------------------------*/
\r
72 static struct netif EMAC_if;
\r
74 /*------------------------------------------------------------------------------*/
\r
76 /*------------------------------------------------------------------------------*/
\r
79 void vlwIPInit( void )
\r
81 /* Initialize lwIP and its interface layer. */
\r
88 sys_set_state(( signed portCHAR * ) "lwIP", lwipTCP_STACK_SIZE);
\r
89 tcpip_init( NULL, NULL );
\r
90 sys_set_default_state();
\r
92 /*------------------------------------------------------------*/
\r
94 void vBasicWEBServer( void *pvParameters )
\r
96 struct ip_addr xIpAddr, xNetMast, xGateway;
\r
97 extern err_t ethernetif_init( struct netif *netif );
\r
99 /* Parameters are not used - suppress compiler error. */
\r
100 ( void ) pvParameters;
\r
102 /* Create and configure the EMAC interface. */
\r
103 IP4_ADDR( &xIpAddr, emacIPADDR0, emacIPADDR1, emacIPADDR2, emacIPADDR3 );
\r
104 IP4_ADDR( &xNetMast, emacNET_MASK0, emacNET_MASK1, emacNET_MASK2, emacNET_MASK3 );
\r
105 IP4_ADDR( &xGateway, emacGATEWAY_ADDR0, emacGATEWAY_ADDR1, emacGATEWAY_ADDR2, emacGATEWAY_ADDR3 );
\r
106 netif_add( &EMAC_if, &xIpAddr, &xNetMast, &xGateway, NULL, ethernetif_init, tcpip_input );
\r
108 /* make it the default interface */
\r
109 netif_set_default( &EMAC_if );
\r
112 netif_set_up(&EMAC_if);
\r
114 /* Initialize HTTP */
\r
117 /* Nothing else to do. No point hanging around. */
\r
118 vTaskDelete( NULL );
\r