3 FreeRTOS V8.0.1 - Copyright (C) 2014 Real Time Engineers Ltd.
\r
6 VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
\r
8 ***************************************************************************
\r
10 * FreeRTOS provides completely free yet professionally developed, *
\r
11 * robust, strictly quality controlled, supported, and cross *
\r
12 * platform software that has become a de facto standard. *
\r
14 * Help yourself get started quickly and support the FreeRTOS *
\r
15 * project by purchasing a FreeRTOS tutorial book, reference *
\r
16 * manual, or both from: http://www.FreeRTOS.org/Documentation *
\r
20 ***************************************************************************
\r
22 This file is part of the FreeRTOS distribution.
\r
24 FreeRTOS is free software; you can redistribute it and/or modify it under
\r
25 the terms of the GNU General Public License (version 2) as published by the
\r
26 Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
\r
28 >>! NOTE: The modification to the GPL is included to allow you to !<<
\r
29 >>! distribute a combined work that includes FreeRTOS without being !<<
\r
30 >>! obliged to provide the source code for proprietary components !<<
\r
31 >>! outside of the FreeRTOS kernel. !<<
\r
33 FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
\r
34 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
\r
35 FOR A PARTICULAR PURPOSE. Full license text is available from the following
\r
36 link: http://www.freertos.org/a00114.html
\r
40 ***************************************************************************
\r
42 * Having a problem? Start by reading the FAQ "My application does *
\r
43 * not run, what could be wrong?" *
\r
45 * http://www.FreeRTOS.org/FAQHelp.html *
\r
47 ***************************************************************************
\r
49 http://www.FreeRTOS.org - Documentation, books, training, latest versions,
\r
50 license and Real Time Engineers Ltd. contact details.
\r
52 http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
\r
53 including FreeRTOS+Trace - an indispensable productivity tool, a DOS
\r
54 compatible FAT file system, and our tiny thread aware UDP/IP stack.
\r
56 http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
\r
57 Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
\r
58 licenses offer ticketed support, indemnification and middleware.
\r
60 http://www.SafeRTOS.com - High Integrity Systems also provide a safety
\r
61 engineered and independently SIL3 certified version for use in safety and
\r
62 mission critical applications that require provable dependability.
\r
68 Implements a simplistic WEB server. Every time a connection is made and
\r
69 data is received a dynamic page that shows the current TCP/IP statistics
\r
70 is generated and returned. The connection is then closed.
\r
74 /*------------------------------------------------------------------------------*/
\r
76 /*------------------------------------------------------------------------------*/
\r
78 /* Standard includes. */
\r
82 /* Scheduler includes. */
\r
83 #include "FreeRTOS.h"
\r
87 /* Demo includes. */
\r
88 #include "BasicWEB.h"
\r
90 /* lwIP includes. */
\r
91 #include "lwip/api.h"
\r
92 #include "lwip/tcpip.h"
\r
93 #include "lwip/memp.h"
\r
94 #include "lwip/stats.h"
\r
95 #include "netif/loopif.h"
\r
99 #define lwipTCP_STACK_SIZE 600
\r
102 /*------------------------------------------------------------------------------*/
\r
104 /*------------------------------------------------------------------------------*/
\r
105 static struct netif EMAC_if;
\r
107 /*------------------------------------------------------------------------------*/
\r
109 /*------------------------------------------------------------------------------*/
\r
112 void vlwIPInit( void )
\r
114 /* Initialize lwIP and its interface layer. */
\r
121 sys_set_state(( signed char * ) "lwIP", lwipTCP_STACK_SIZE);
\r
122 tcpip_init( NULL, NULL );
\r
123 sys_set_default_state();
\r
125 /*------------------------------------------------------------*/
\r
127 void vBasicWEBServer( void *pvParameters )
\r
129 struct ip_addr xIpAddr, xNetMast, xGateway;
\r
130 extern err_t ethernetif_init( struct netif *netif );
\r
132 /* Parameters are not used - suppress compiler error. */
\r
133 ( void ) pvParameters;
\r
135 /* Create and configure the EMAC interface. */
\r
136 IP4_ADDR( &xIpAddr, emacIPADDR0, emacIPADDR1, emacIPADDR2, emacIPADDR3 );
\r
137 IP4_ADDR( &xNetMast, emacNET_MASK0, emacNET_MASK1, emacNET_MASK2, emacNET_MASK3 );
\r
138 IP4_ADDR( &xGateway, emacGATEWAY_ADDR0, emacGATEWAY_ADDR1, emacGATEWAY_ADDR2, emacGATEWAY_ADDR3 );
\r
139 netif_add( &EMAC_if, &xIpAddr, &xNetMast, &xGateway, NULL, ethernetif_init, tcpip_input );
\r
141 /* make it the default interface */
\r
142 netif_set_default( &EMAC_if );
\r
145 netif_set_up(&EMAC_if);
\r
147 /* Initialize HTTP */
\r
150 /* Nothing else to do. No point hanging around. */
\r
151 vTaskDelete( NULL );
\r