3 FreeRTOS V6.0.1 - Copyright (C) 2009 Real Time Engineers Ltd.
\r
5 ***************************************************************************
\r
9 * + New to FreeRTOS, *
\r
10 * + Wanting to learn FreeRTOS or multitasking in general quickly *
\r
11 * + Looking for basic training, *
\r
12 * + Wanting to improve your FreeRTOS skills and productivity *
\r
14 * then take a look at the FreeRTOS eBook *
\r
16 * "Using the FreeRTOS Real Time Kernel - a Practical Guide" *
\r
17 * http://www.FreeRTOS.org/Documentation *
\r
19 * A pdf reference manual is also available. Both are usually delivered *
\r
20 * to your inbox within 20 minutes to two hours when purchased between 8am *
\r
21 * and 8pm GMT (although please allow up to 24 hours in case of *
\r
22 * exceptional circumstances). Thank you for your support! *
\r
24 ***************************************************************************
\r
26 This file is part of the FreeRTOS distribution.
\r
28 FreeRTOS is free software; you can redistribute it and/or modify it under
\r
29 the terms of the GNU General Public License (version 2) as published by the
\r
30 Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
\r
31 ***NOTE*** The exception to the GPL is included to allow you to distribute
\r
32 a combined work that includes FreeRTOS without being obliged to provide the
\r
33 source code for proprietary components outside of the FreeRTOS kernel.
\r
34 FreeRTOS is distributed in the hope that it will be useful, but WITHOUT
\r
35 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
\r
36 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
\r
37 more details. You should have received a copy of the GNU General Public
\r
38 License and the FreeRTOS license exception along with FreeRTOS; if not it
\r
39 can be viewed here: http://www.freertos.org/a00114.html and also obtained
\r
40 by writing to Richard Barry, contact details for whom are available on the
\r
45 http://www.FreeRTOS.org - Documentation, latest information, license and
\r
48 http://www.SafeRTOS.com - A version that is certified for use in safety
\r
51 http://www.OpenRTOS.com - Commercial support, development, porting,
\r
52 licensing and training services.
\r
56 Implements a simplistic WEB server. Every time a connection is made and
\r
57 data is received a dynamic page that shows the current TCP/IP statistics
\r
58 is generated and returned. The connection is then closed.
\r
62 /*------------------------------------------------------------------------------*/
\r
64 /*------------------------------------------------------------------------------*/
\r
66 /* Standard includes. */
\r
70 /* Scheduler includes. */
\r
71 #include "FreeRTOS.h"
\r
75 /* Demo includes. */
\r
76 #include "BasicWEB.h"
\r
78 /* lwIP includes. */
\r
79 #include "lwip/api.h"
\r
80 #include "lwip/tcpip.h"
\r
81 #include "lwip/memp.h"
\r
82 #include "lwip/stats.h"
\r
83 #include "netif/loopif.h"
\r
87 #define lwipTCP_STACK_SIZE 600
\r
90 /*------------------------------------------------------------------------------*/
\r
92 /*------------------------------------------------------------------------------*/
\r
93 static struct netif EMAC_if;
\r
95 /*------------------------------------------------------------------------------*/
\r
97 /*------------------------------------------------------------------------------*/
\r
100 void vlwIPInit( void )
\r
102 /* Initialize lwIP and its interface layer. */
\r
109 sys_set_state(( signed char * ) "lwIP", lwipTCP_STACK_SIZE);
\r
110 tcpip_init( NULL, NULL );
\r
111 sys_set_default_state();
\r
113 /*------------------------------------------------------------*/
\r
115 void vBasicWEBServer( void *pvParameters )
\r
117 struct ip_addr xIpAddr, xNetMast, xGateway;
\r
118 extern err_t ethernetif_init( struct netif *netif );
\r
120 /* Parameters are not used - suppress compiler error. */
\r
121 ( void ) pvParameters;
\r
123 /* Create and configure the EMAC interface. */
\r
124 IP4_ADDR( &xIpAddr, emacIPADDR0, emacIPADDR1, emacIPADDR2, emacIPADDR3 );
\r
125 IP4_ADDR( &xNetMast, emacNET_MASK0, emacNET_MASK1, emacNET_MASK2, emacNET_MASK3 );
\r
126 IP4_ADDR( &xGateway, emacGATEWAY_ADDR0, emacGATEWAY_ADDR1, emacGATEWAY_ADDR2, emacGATEWAY_ADDR3 );
\r
127 netif_add( &EMAC_if, &xIpAddr, &xNetMast, &xGateway, NULL, ethernetif_init, tcpip_input );
\r
129 /* make it the default interface */
\r
130 netif_set_default( &EMAC_if );
\r
133 netif_set_up(&EMAC_if);
\r
135 /* Initialize HTTP */
\r
138 /* Nothing else to do. No point hanging around. */
\r
139 vTaskDelete( NULL );
\r