]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/ARM9_STR91X_IAR/lwip/lwipWebServer/BasicWEB.c
Update version numbers in preparation for V8.2.0 release candidate 1.
[freertos] / FreeRTOS / Demo / ARM9_STR91X_IAR / lwip / lwipWebServer / BasicWEB.c
1 \r
2 /*\r
3     FreeRTOS V8.2.0rc1 - Copyright (C) 2014 Real Time Engineers Ltd.\r
4     All rights reserved\r
5 \r
6     VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
7 \r
8     This file is part of the FreeRTOS distribution.\r
9 \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
13 \r
14     >>!   NOTE: The modification to the GPL is included to allow you to     !<<\r
15     >>!   distribute a combined work that includes FreeRTOS without being   !<<\r
16     >>!   obliged to provide the source code for proprietary components     !<<\r
17     >>!   outside of the FreeRTOS kernel.                                   !<<\r
18 \r
19     FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
20     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
21     FOR A PARTICULAR PURPOSE.  Full license text is available on the following\r
22     link: http://www.freertos.org/a00114.html\r
23 \r
24     1 tab == 4 spaces!\r
25 \r
26     ***************************************************************************\r
27      *                                                                       *\r
28      *    Having a problem?  Start by reading the FAQ "My application does   *\r
29      *    not run, what could be wrong?".  Have you defined configASSERT()?  *\r
30      *                                                                       *\r
31      *    http://www.FreeRTOS.org/FAQHelp.html                               *\r
32      *                                                                       *\r
33     ***************************************************************************\r
34 \r
35     ***************************************************************************\r
36      *                                                                       *\r
37      *    FreeRTOS provides completely free yet professionally developed,    *\r
38      *    robust, strictly quality controlled, supported, and cross          *\r
39      *    platform software that is more than just the market leader, it     *\r
40      *    is the industry's de facto standard.                               *\r
41      *                                                                       *\r
42      *    Help yourself get started quickly while simultaneously helping     *\r
43      *    to support the FreeRTOS project by purchasing a FreeRTOS           *\r
44      *    tutorial book, reference manual, or both:                          *\r
45      *    http://www.FreeRTOS.org/Documentation                              *\r
46      *                                                                       *\r
47     ***************************************************************************\r
48 \r
49     ***************************************************************************\r
50      *                                                                       *\r
51      *   Investing in training allows your team to be as productive as       *\r
52      *   possible as early as possible, lowering your overall development    *\r
53      *   cost, and enabling you to bring a more robust product to market     *\r
54      *   earlier than would otherwise be possible.  Richard Barry is both    *\r
55      *   the architect and key author of FreeRTOS, and so also the world's   *\r
56      *   leading authority on what is the world's most popular real time     *\r
57      *   kernel for deeply embedded MCU designs.  Obtaining your training    *\r
58      *   from Richard ensures your team will gain directly from his in-depth *\r
59      *   product knowledge and years of usage experience.  Contact Real Time *\r
60      *   Engineers Ltd to enquire about the FreeRTOS Masterclass, presented  *\r
61      *   by Richard Barry:  http://www.FreeRTOS.org/contact\r
62      *                                                                       *\r
63     ***************************************************************************\r
64 \r
65     ***************************************************************************\r
66      *                                                                       *\r
67      *    You are receiving this top quality software for free.  Please play *\r
68      *    fair and reciprocate by reporting any suspected issues and         *\r
69      *    participating in the community forum:                              *\r
70      *    http://www.FreeRTOS.org/support                                    *\r
71      *                                                                       *\r
72      *    Thank you!                                                         *\r
73      *                                                                       *\r
74     ***************************************************************************\r
75 \r
76     http://www.FreeRTOS.org - Documentation, books, training, latest versions,\r
77     license and Real Time Engineers Ltd. contact details.\r
78 \r
79     http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
80     including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
81     compatible FAT file system, and our tiny thread aware UDP/IP stack.\r
82 \r
83     http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.\r
84     Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.\r
85 \r
86     http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High\r
87     Integrity Systems ltd. to sell under the OpenRTOS brand.  Low cost OpenRTOS\r
88     licenses offer ticketed support, indemnification and commercial middleware.\r
89 \r
90     http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
91     engineered and independently SIL3 certified version for use in safety and\r
92     mission critical applications that require provable dependability.\r
93 \r
94     1 tab == 4 spaces!\r
95 */\r
96 \r
97 /*\r
98         Implements a simplistic WEB server.  Every time a connection is made and\r
99         data is received a dynamic page that shows the current TCP/IP statistics\r
100         is generated and returned.  The connection is then closed.\r
101 */\r
102 \r
103 \r
104 /*------------------------------------------------------------------------------*/\r
105 /*                            PROTOTYPES                                        */\r
106 /*------------------------------------------------------------------------------*/\r
107 \r
108 /* Standard includes. */\r
109 #include <stdio.h>\r
110 #include <string.h>\r
111 \r
112 /* Scheduler includes. */\r
113 #include "FreeRTOS.h"\r
114 #include "task.h"\r
115 #include "semphr.h"\r
116 \r
117 /* Demo includes. */\r
118 #include "BasicWEB.h"\r
119 \r
120 /* lwIP includes. */\r
121 #include "lwip/api.h"\r
122 #include "lwip/tcpip.h"\r
123 #include "lwip/memp.h"\r
124 #include "lwip/stats.h"\r
125 #include "netif/loopif.h"\r
126 #include "lcd.h"\r
127 #include "httpd.h"\r
128 \r
129 #define lwipTCP_STACK_SIZE                      600\r
130 \r
131 \r
132 /*------------------------------------------------------------------------------*/\r
133 /*                            GLOBALS                                          */\r
134 /*------------------------------------------------------------------------------*/\r
135 static struct netif EMAC_if;\r
136 \r
137 /*------------------------------------------------------------------------------*/\r
138 /*                            FUNCTIONS                                         */\r
139 /*------------------------------------------------------------------------------*/\r
140 \r
141 \r
142 void vlwIPInit( void )\r
143 {\r
144     /* Initialize lwIP and its interface layer. */\r
145         sys_init();\r
146         mem_init();                                                             \r
147         memp_init();\r
148         pbuf_init();\r
149         netif_init();\r
150         ip_init();\r
151         sys_set_state(( signed char * ) "lwIP", lwipTCP_STACK_SIZE);\r
152         tcpip_init( NULL, NULL );       \r
153         sys_set_default_state();\r
154 }\r
155 /*------------------------------------------------------------*/\r
156 \r
157 void vBasicWEBServer( void *pvParameters )\r
158 {\r
159 struct ip_addr xIpAddr, xNetMast, xGateway;\r
160 extern err_t ethernetif_init( struct netif *netif );\r
161 \r
162     /* Parameters are not used - suppress compiler error. */\r
163     ( void ) pvParameters;\r
164 \r
165     /* Create and configure the EMAC interface. */\r
166     IP4_ADDR( &xIpAddr, emacIPADDR0, emacIPADDR1, emacIPADDR2, emacIPADDR3 );\r
167     IP4_ADDR( &xNetMast, emacNET_MASK0, emacNET_MASK1, emacNET_MASK2, emacNET_MASK3 );\r
168     IP4_ADDR( &xGateway, emacGATEWAY_ADDR0, emacGATEWAY_ADDR1, emacGATEWAY_ADDR2, emacGATEWAY_ADDR3 );\r
169     netif_add( &EMAC_if, &xIpAddr, &xNetMast, &xGateway, NULL, ethernetif_init, tcpip_input );\r
170 \r
171     /* make it the default interface */\r
172     netif_set_default( &EMAC_if );\r
173 \r
174     /* bring it up */\r
175     netif_set_up(&EMAC_if);\r
176 \r
177     /* Initialize HTTP */\r
178     httpd_init();\r
179 \r
180         /* Nothing else to do.  No point hanging around. */\r
181         vTaskDelete( NULL );\r
182 }\r
183 \r
184 \r