]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/ARM9_STR91X_IAR/lwip/lwipWebServer/BasicWEB.c
Change version numbers in preparation for V7.6.0 release.
[freertos] / FreeRTOS / Demo / ARM9_STR91X_IAR / lwip / lwipWebServer / BasicWEB.c
1 \r
2 /*\r
3     FreeRTOS V7.6.0 - Copyright (C) 2013 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     ***************************************************************************\r
9      *                                                                       *\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
13      *                                                                       *\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
17      *                                                                       *\r
18      *    Thank you!                                                         *\r
19      *                                                                       *\r
20     ***************************************************************************\r
21 \r
22     This file is part of the FreeRTOS distribution.\r
23 \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
27 \r
28     >>! NOTE: The modification to the GPL is included to allow you to distribute\r
29     >>! a combined work that includes FreeRTOS without being obliged to provide\r
30     >>! the source code for proprietary components outside of the FreeRTOS\r
31     >>! kernel.\r
32 \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
37 \r
38     1 tab == 4 spaces!\r
39 \r
40     ***************************************************************************\r
41      *                                                                       *\r
42      *    Having a problem?  Start by reading the FAQ "My application does   *\r
43      *    not run, what could be wrong?"                                     *\r
44      *                                                                       *\r
45      *    http://www.FreeRTOS.org/FAQHelp.html                               *\r
46      *                                                                       *\r
47     ***************************************************************************\r
48 \r
49     http://www.FreeRTOS.org - Documentation, books, training, latest versions,\r
50     license and Real Time Engineers Ltd. contact details.\r
51 \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
55 \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
59 \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
63 \r
64     1 tab == 4 spaces!\r
65 */\r
66 \r
67 /*\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
71 */\r
72 \r
73 \r
74 /*------------------------------------------------------------------------------*/\r
75 /*                            PROTOTYPES                                        */\r
76 /*------------------------------------------------------------------------------*/\r
77 \r
78 /* Standard includes. */\r
79 #include <stdio.h>\r
80 #include <string.h>\r
81 \r
82 /* Scheduler includes. */\r
83 #include "FreeRTOS.h"\r
84 #include "task.h"\r
85 #include "semphr.h"\r
86 \r
87 /* Demo includes. */\r
88 #include "BasicWEB.h"\r
89 \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
96 #include "lcd.h"\r
97 #include "httpd.h"\r
98 \r
99 #define lwipTCP_STACK_SIZE                      600\r
100 \r
101 \r
102 /*------------------------------------------------------------------------------*/\r
103 /*                            GLOBALS                                          */\r
104 /*------------------------------------------------------------------------------*/\r
105 static struct netif EMAC_if;\r
106 \r
107 /*------------------------------------------------------------------------------*/\r
108 /*                            FUNCTIONS                                         */\r
109 /*------------------------------------------------------------------------------*/\r
110 \r
111 \r
112 void vlwIPInit( void )\r
113 {\r
114     /* Initialize lwIP and its interface layer. */\r
115         sys_init();\r
116         mem_init();                                                             \r
117         memp_init();\r
118         pbuf_init();\r
119         netif_init();\r
120         ip_init();\r
121         sys_set_state(( signed char * ) "lwIP", lwipTCP_STACK_SIZE);\r
122         tcpip_init( NULL, NULL );       \r
123         sys_set_default_state();\r
124 }\r
125 /*------------------------------------------------------------*/\r
126 \r
127 void vBasicWEBServer( void *pvParameters )\r
128 {\r
129 struct ip_addr xIpAddr, xNetMast, xGateway;\r
130 extern err_t ethernetif_init( struct netif *netif );\r
131 \r
132     /* Parameters are not used - suppress compiler error. */\r
133     ( void ) pvParameters;\r
134 \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
140 \r
141     /* make it the default interface */\r
142     netif_set_default( &EMAC_if );\r
143 \r
144     /* bring it up */\r
145     netif_set_up(&EMAC_if);\r
146 \r
147     /* Initialize HTTP */\r
148     httpd_init();\r
149 \r
150         /* Nothing else to do.  No point hanging around. */\r
151         vTaskDelete( NULL );\r
152 }\r
153 \r
154 \r