3 FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd.
\r
6 VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
\r
8 This file is part of the FreeRTOS distribution.
\r
10 FreeRTOS is free software; you can redistribute it and/or modify it under
\r
11 the terms of the GNU General Public License (version 2) as published by the
\r
12 Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.
\r
14 ***************************************************************************
\r
15 >>! NOTE: The modification to the GPL is included to allow you to !<<
\r
16 >>! distribute a combined work that includes FreeRTOS without being !<<
\r
17 >>! obliged to provide the source code for proprietary components !<<
\r
18 >>! outside of the FreeRTOS kernel. !<<
\r
19 ***************************************************************************
\r
21 FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
\r
22 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
\r
23 FOR A PARTICULAR PURPOSE. Full license text is available on the following
\r
24 link: http://www.freertos.org/a00114.html
\r
26 ***************************************************************************
\r
28 * FreeRTOS provides completely free yet professionally developed, *
\r
29 * robust, strictly quality controlled, supported, and cross *
\r
30 * platform software that is more than just the market leader, it *
\r
31 * is the industry's de facto standard. *
\r
33 * Help yourself get started quickly while simultaneously helping *
\r
34 * to support the FreeRTOS project by purchasing a FreeRTOS *
\r
35 * tutorial book, reference manual, or both: *
\r
36 * http://www.FreeRTOS.org/Documentation *
\r
38 ***************************************************************************
\r
40 http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
\r
41 the FAQ page "My application does not run, what could be wrong?". Have you
\r
42 defined configASSERT()?
\r
44 http://www.FreeRTOS.org/support - In return for receiving this top quality
\r
45 embedded software for free we request you assist our global community by
\r
46 participating in the support forum.
\r
48 http://www.FreeRTOS.org/training - Investing in training allows your team to
\r
49 be as productive as possible as early as possible. Now you can receive
\r
50 FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
\r
51 Ltd, and the world's leading authority on the world's leading RTOS.
\r
53 http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
\r
54 including FreeRTOS+Trace - an indispensable productivity tool, a DOS
\r
55 compatible FAT file system, and our tiny thread aware UDP/IP stack.
\r
57 http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
\r
58 Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
\r
60 http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
\r
61 Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
\r
62 licenses offer ticketed support, indemnification and commercial middleware.
\r
64 http://www.SafeRTOS.com - High Integrity Systems also provide a safety
\r
65 engineered and independently SIL3 certified version for use in safety and
\r
66 mission critical applications that require provable dependability.
\r
72 Implements a simplistic WEB server. Every time a connection is made and
\r
73 data is received a dynamic page that shows the current TCP/IP statistics
\r
74 is generated and returned. The connection is then closed.
\r
78 /*------------------------------------------------------------------------------*/
\r
80 /*------------------------------------------------------------------------------*/
\r
82 /* Standard includes. */
\r
86 /* Scheduler includes. */
\r
87 #include "FreeRTOS.h"
\r
91 /* Demo includes. */
\r
92 #include "BasicWEB.h"
\r
94 /* lwIP includes. */
\r
95 #include "lwip/api.h"
\r
96 #include "lwip/tcpip.h"
\r
97 #include "lwip/memp.h"
\r
98 #include "lwip/stats.h"
\r
99 #include "netif/loopif.h"
\r
103 #define lwipTCP_STACK_SIZE 600
\r
106 /*------------------------------------------------------------------------------*/
\r
108 /*------------------------------------------------------------------------------*/
\r
109 static struct netif EMAC_if;
\r
111 /*------------------------------------------------------------------------------*/
\r
113 /*------------------------------------------------------------------------------*/
\r
116 void vlwIPInit( void )
\r
118 /* Initialize lwIP and its interface layer. */
\r
125 sys_set_state(( signed char * ) "lwIP", lwipTCP_STACK_SIZE);
\r
126 tcpip_init( NULL, NULL );
\r
127 sys_set_default_state();
\r
129 /*------------------------------------------------------------*/
\r
131 void vBasicWEBServer( void *pvParameters )
\r
133 struct ip_addr xIpAddr, xNetMast, xGateway;
\r
134 extern err_t ethernetif_init( struct netif *netif );
\r
136 /* Parameters are not used - suppress compiler error. */
\r
137 ( void ) pvParameters;
\r
139 /* Create and configure the EMAC interface. */
\r
140 IP4_ADDR( &xIpAddr, emacIPADDR0, emacIPADDR1, emacIPADDR2, emacIPADDR3 );
\r
141 IP4_ADDR( &xNetMast, emacNET_MASK0, emacNET_MASK1, emacNET_MASK2, emacNET_MASK3 );
\r
142 IP4_ADDR( &xGateway, emacGATEWAY_ADDR0, emacGATEWAY_ADDR1, emacGATEWAY_ADDR2, emacGATEWAY_ADDR3 );
\r
143 netif_add( &EMAC_if, &xIpAddr, &xNetMast, &xGateway, NULL, ethernetif_init, tcpip_input );
\r
145 /* make it the default interface */
\r
146 netif_set_default( &EMAC_if );
\r
149 netif_set_up(&EMAC_if);
\r
151 /* Initialize HTTP */
\r
154 /* Nothing else to do. No point hanging around. */
\r
155 vTaskDelete( NULL );
\r