Line No. | Rev | Author | Line |
---|---|---|---|
1 | 32 | kaklik | /********************************************************************* |
2 | * |
||
3 | * Microchip TCP/IP Stack Include File |
||
4 | * |
||
5 | ********************************************************************* |
||
6 | * FileName: TCPIP.h |
||
7 | * Dependencies: |
||
8 | * Processor: PIC18, PIC24F, PIC24H, dsPIC30F, dsPIC33F, PIC32 |
||
9 | * Compiler: Microchip C32 v1.05 or higher |
||
10 | * Microchip C30 v3.12 or higher |
||
11 | * Microchip C18 v3.30 or higher |
||
12 | * HI-TECH PICC-18 PRO 9.63PL2 or higher |
||
13 | * Company: Microchip Technology, Inc. |
||
14 | * |
||
15 | * Software License Agreement |
||
16 | * |
||
17 | * Copyright (C) 2002-2009 Microchip Technology Inc. All rights |
||
18 | * reserved. |
||
19 | * |
||
20 | * Microchip licenses to you the right to use, modify, copy, and |
||
21 | * distribute: |
||
22 | * (i) the Software when embedded on a Microchip microcontroller or |
||
23 | * digital signal controller product ("Device") which is |
||
24 | * integrated into Licensee's product; or |
||
25 | * (ii) ONLY the Software driver source files ENC28J60.c, ENC28J60.h, |
||
26 | * ENCX24J600.c and ENCX24J600.h ported to a non-Microchip device |
||
27 | * used in conjunction with a Microchip ethernet controller for |
||
28 | * the sole purpose of interfacing with the ethernet controller. |
||
29 | * |
||
30 | * You should refer to the license agreement accompanying this |
||
31 | * Software for additional information regarding your rights and |
||
32 | * obligations. |
||
33 | * |
||
34 | * THE SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT |
||
35 | * WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT |
||
36 | * LIMITATION, ANY WARRANTY OF MERCHANTABILITY, FITNESS FOR A |
||
37 | * PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL |
||
38 | * MICROCHIP BE LIABLE FOR ANY INCIDENTAL, SPECIAL, INDIRECT OR |
||
39 | * CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF |
||
40 | * PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY OR SERVICES, ANY CLAIMS |
||
41 | * BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE |
||
42 | * THEREOF), ANY CLAIMS FOR INDEMNITY OR CONTRIBUTION, OR OTHER |
||
43 | * SIMILAR COSTS, WHETHER ASSERTED ON THE BASIS OF CONTRACT, TORT |
||
44 | * (INCLUDING NEGLIGENCE), BREACH OF WARRANTY, OR OTHERWISE. |
||
45 | * |
||
46 | * |
||
47 | * Author Date Comment |
||
48 | *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
||
49 | * Howard Schlunder 12/20/06 Original |
||
50 | ********************************************************************/ |
||
51 | #ifndef __TCPIP_HITECH_WORKAROUND_H |
||
52 | #define __TCPIP_HITECH_WORKAROUND_H |
||
53 | |||
54 | #define TCPIP_STACK_VERSION "v5.25" // TCP/IP stack version |
||
55 | |||
56 | #include <string.h> |
||
57 | #include <stdlib.h> |
||
58 | #include "GenericTypeDefs.h" |
||
59 | #include "Compiler.h" |
||
60 | #include "HardwareProfile.h" |
||
61 | |||
62 | // RESERVED FEATURE -- do not change from current value of 1u as this is not |
||
63 | // fully implemented yet. |
||
64 | // Defines the number of different network interfaces to support (ex: 2 for |
||
65 | // Wifi and Ethernet simultaneously). |
||
66 | #define NETWORK_INTERFACES (1u) |
||
67 | |||
68 | /******************************************************************* |
||
69 | * Memory Configuration |
||
70 | * The following section sets up the memory types for use by |
||
71 | * this application. |
||
72 | *******************************************************************/ |
||
73 | // Represents data stored in Ethernet buffer RAM |
||
74 | #define TCP_ETH_RAM 0u |
||
75 | // The base address for TCP data in Ethernet RAM |
||
76 | #define TCP_ETH_RAM_BASE_ADDRESS (BASE_TCB_ADDR) |
||
77 | // Represents data stored in local PIC RAM |
||
78 | #define TCP_PIC_RAM 1u |
||
79 | // The base address for TCP data in PIC RAM |
||
80 | #define TCP_PIC_RAM_BASE_ADDRESS ((PTR_BASE)&TCPBufferInPIC[0]) |
||
81 | // Represents data stored in external SPI RAM |
||
82 | #define TCP_SPI_RAM 2u |
||
83 | |||
84 | /******************************************************************* |
||
85 | * User Configuration |
||
86 | * Load the user-specific configuration from TCPIPConfig.h |
||
87 | *******************************************************************/ |
||
88 | #include "TCPIPConfig.h" |
||
89 | |||
90 | /******************************************************************* |
||
91 | * Configuration Rules Enforcement |
||
92 | * The following section enforces requirements for modules based |
||
93 | * on configurations selected in TCPIPConfig.h |
||
94 | *******************************************************************/ |
||
95 | |||
96 | #ifndef STACK_USE_MDD |
||
97 | |||
98 | // Make sure MPFS included for modules that require it |
||
99 | #if defined(STACK_USE_FTP_SERVER) || defined(STACK_USE_HTTP_SERVER) |
||
100 | #define STACK_USE_MPFS |
||
101 | #endif |
||
102 | |||
103 | #if defined(STACK_USE_HTTP2_SERVER) |
||
104 | #define STACK_USE_MPFS2 |
||
105 | #endif |
||
106 | |||
107 | #if defined(STACK_USE_SNMP_SERVER) && !defined(STACK_USE_MPFS) && !defined(STACK_USE_MPFS2) |
||
108 | #define STACK_USE_MPFS2 |
||
109 | #endif |
||
110 | |||
111 | #endif |
||
112 | |||
113 | // FTP is not supported in MPFS2 or when MPFS is stored in internal program |
||
114 | // memory (instead of external EEPROM). |
||
115 | #if ( (!defined(MPFS_USE_EEPROM) && !defined(MPFS_USE_SPI_FLASH)) || defined(STACK_USE_MPFS2) ) && defined(STACK_USE_FTP) |
||
116 | #error FTP server is not supported with HTTP2 / MPFS2, or with internal Flash memory storage |
||
117 | #endif |
||
118 | |||
119 | // When IP Gleaning is enabled, ICMP must also be enabled. |
||
120 | #if defined(STACK_USE_IP_GLEANING) |
||
121 | #if !defined(STACK_USE_ICMP_SERVER) |
||
122 | #define STACK_USE_ICMP_SERVER |
||
123 | #endif |
||
124 | #endif |
||
125 | |||
126 | // Include modules required by specific HTTP demos |
||
127 | #if !defined(STACK_USE_HTTP2_SERVER) |
||
128 | #undef STACK_USE_HTTP_EMAIL_DEMO |
||
129 | #undef STACK_USE_HTTP_MD5_DEMO |
||
130 | #undef STACK_USE_HTTP_APP_RECONFIG |
||
131 | #endif |
||
132 | #if defined(STACK_USE_HTTP_EMAIL_DEMO) |
||
133 | #if !defined(STACK_USE_SMTP_CLIENT) |
||
134 | #error HTTP E-mail Demo requires SMTP_CLIENT and HTTP2 |
||
135 | #endif |
||
136 | #endif |
||
137 | #if defined(STACK_USE_HTTP_MD5_DEMO) |
||
138 | #if !defined(STACK_USE_MD5) |
||
139 | #define STACK_USE_MD5 |
||
140 | #endif |
||
141 | #endif |
||
142 | |||
143 | // Can't do MPFS upload without POST or external memory |
||
144 | #if defined(HTTP_MPFS_UPLOAD) |
||
145 | #if !defined(HTTP_USE_POST) || (!defined(MPFS_USE_EEPROM) && !defined(MPFS_USE_SPI_FLASH)) |
||
146 | #undef HTTP_MPFS_UPLOAD |
||
147 | #endif |
||
148 | #endif |
||
149 | |||
150 | // Make sure that the DNS client is enabled if services require it |
||
151 | #if defined(STACK_USE_GENERIC_TCP_CLIENT_EXAMPLE) || \ |
||
152 | defined(STACK_USE_SNTP_CLIENT) || \ |
||
153 | defined(STACK_USE_DYNAMICDNS_CLIENT) || \ |
||
154 | defined(STACK_USE_SMTP_CLIENT) |
||
155 | #if !defined(STACK_USE_DNS) |
||
156 | #define STACK_USE_DNS |
||
157 | #endif |
||
158 | #endif |
||
159 | |||
160 | // Make sure that STACK_CLIENT_MODE is defined if a service |
||
161 | // depends on it |
||
162 | #if defined(STACK_USE_FTP_SERVER) || \ |
||
163 | defined(STACK_USE_SNMP_SERVER) || \ |
||
164 | defined(STACK_USE_DNS) || \ |
||
165 | defined(STACK_USE_GENERIC_TCP_CLIENT_EXAMPLE) || \ |
||
166 | defined(STACK_USE_TFTP_CLIENT) || \ |
||
167 | defined(STACK_USE_SMTP_CLIENT) || \ |
||
168 | defined(STACK_USE_ICMP_CLIENT) || \ |
||
169 | defined(STACK_USE_DYNAMICDNS_CLIENT) || \ |
||
170 | defined(STACK_USE_SNTP_CLIENT) || \ |
||
171 | defined(STACK_USE_BERKELEY_API) || \ |
||
172 | defined(STACK_USE_SSL_CLIENT) |
||
173 | #if !defined(STACK_CLIENT_MODE) |
||
174 | #define STACK_CLIENT_MODE |
||
175 | #endif |
||
176 | #endif |
||
177 | |||
178 | // Make sure that STACK_USE_TCP is defined if a service |
||
179 | // depends on it |
||
180 | #if defined(STACK_USE_UART2TCP_BRIDGE) || \ |
||
181 | defined(STACK_USE_HTTP_SERVER) || \ |
||
182 | defined(STACK_USE_HTTP2_SERVER) || \ |
||
183 | defined(STACK_USE_FTP_SERVER) || \ |
||
184 | defined(STACK_USE_TELNET_SERVER) || \ |
||
185 | defined(STACK_USE_GENERIC_TCP_CLIENT_EXAMPLE) || \ |
||
186 | defined(STACK_USE_GENERIC_TCP_SERVER_EXAMPLE) || \ |
||
187 | defined(STACK_USE_SMTP_CLIENT) || \ |
||
188 | defined(STACK_USE_TCP_PERFORMANCE_TEST) || \ |
||
189 | defined(STACK_USE_DYNAMICDNS_CLIENT) || \ |
||
190 | defined(STACK_USE_BERKELEY_API) || \ |
||
191 | defined(STACK_USE_SSL_CLIENT) || \ |
||
192 | defined(STACK_USE_SSL_SERVER) |
||
193 | #if !defined(STACK_USE_TCP) |
||
194 | #define STACK_USE_TCP |
||
195 | #endif |
||
196 | #endif |
||
197 | |||
198 | // If TCP is not enabled, clear all memory allocations |
||
199 | #if !defined(STACK_USE_TCP) |
||
200 | #undef TCP_ETH_RAM_SIZE |
||
201 | #undef TCP_PIC_RAM_SIZE |
||
202 | #undef TCP_SPI_RAM_SIZE |
||
203 | #define TCP_ETH_RAM_SIZE 0u |
||
204 | #define TCP_PIC_RAM_SIZE 0u |
||
205 | #define TCP_SPI_RAM_SIZE 0u |
||
206 | #endif |
||
207 | |||
208 | // If PIC RAM is used to store TCP socket FIFOs and TCBs, |
||
209 | // let's allocate it so the linker dynamically chooses |
||
210 | // where to locate it and prevents other variables from |
||
211 | // overlapping with it |
||
212 | #if defined(__TCP_C) && TCP_PIC_RAM_SIZE > 0u |
||
213 | #if defined(__18CXX) && !defined(HI_TECH_C) |
||
214 | #pragma udata TCPSocketMemory |
||
215 | #endif |
||
216 | static BYTE TCPBufferInPIC[TCP_PIC_RAM_SIZE] __attribute__((far)); |
||
217 | #if defined(__18CXX) && !defined(HI_TECH_C) |
||
218 | #pragma udata |
||
219 | #endif |
||
220 | #endif |
||
221 | |||
222 | // Make sure that STACK_USE_UDP is defined if a service |
||
223 | // depends on it |
||
224 | #if defined(STACK_USE_DHCP_CLIENT) || \ |
||
225 | defined(STACK_USE_DHCP_SERVER) || \ |
||
226 | defined(STACK_USE_DNS) || \ |
||
227 | defined(STACK_USE_NBNS) || \ |
||
228 | defined(STACK_USE_SNMP_SERVER) || \ |
||
229 | defined(STACK_USE_TFTP_CLIENT) || \ |
||
230 | defined(STACK_USE_ANNOUNCE) || \ |
||
231 | defined(STACK_USE_UDP_PERFORMANCE_TEST) || \ |
||
232 | defined(STACK_USE_SNTP_CLIENT) || \ |
||
233 | defined(STACK_USE_BERKELEY_API) |
||
234 | #if !defined(STACK_USE_UDP) |
||
235 | #define STACK_USE_UDP |
||
236 | #endif |
||
237 | #endif |
||
238 | |||
239 | // When using SSL server, enable RSA decryption |
||
240 | #if defined(STACK_USE_SSL_SERVER) |
||
241 | #define STACK_USE_RSA_DECRYPT |
||
242 | #define STACK_USE_SSL |
||
243 | #endif |
||
244 | |||
245 | // When using SSL client, enable RSA encryption |
||
246 | #if defined(STACK_USE_SSL_CLIENT) |
||
247 | #define STACK_USE_RSA_ENCRYPT |
||
248 | #define STACK_USE_SSL |
||
249 | #endif |
||
250 | |||
251 | // If using SSL (either), include the rest of the support modules |
||
252 | #if defined(STACK_USE_SSL) |
||
253 | #define STACK_USE_ARCFOUR |
||
254 | #define STACK_USE_MD5 |
||
255 | #define STACK_USE_SHA1 |
||
256 | #define STACK_USE_RANDOM |
||
257 | #endif |
||
258 | |||
259 | // When using either RSA operation, include the RSA module |
||
260 | #if defined(STACK_USE_RSA_ENCRYPT) || defined(STACK_USE_RSA_DECRYPT) |
||
261 | #define STACK_USE_RSA |
||
262 | #define STACK_USE_BIGINT |
||
263 | #endif |
||
264 | |||
265 | // Enable the LCD if configured in the hardware profile |
||
266 | #if defined(LCD_DATA_IO) || defined(LCD_DATA0_IO) |
||
267 | #define USE_LCD |
||
268 | #endif |
||
269 | |||
270 | // SPI Flash MPFS images must start on a block boundary |
||
271 | #if (defined(STACK_USE_MPFS2) || defined(STACK_USE_MPFS)) && \ |
||
272 | defined(MPFS_USE_SPI_FLASH) && ((MPFS_RESERVE_BLOCK & 0x0fff) != 0) |
||
273 | #error MPFS_RESERVE_BLOCK must be a multiple of 4096 for SPI Flash storage |
||
274 | #endif |
||
275 | |||
276 | // HTTP2 requires 2 MPFS2 handles per connection, plus one spare |
||
277 | #if defined(STACK_USE_HTTP2_SERVER) |
||
278 | #if MAX_MPFS_HANDLES < ((MAX_HTTP_CONNECTIONS * 2) + 1) |
||
279 | #error HTTP2 requires 2 MPFS2 file handles per connection, plus one additional. |
||
280 | #endif |
||
281 | #endif |
||
282 | |||
283 | #include "TCPIP Stack/StackTsk.h" |
||
284 | #include "TCPIP Stack/Helpers.h" |
||
285 | #include "TCPIP Stack/Delay.h" |
||
286 | #include "TCPIP Stack/Tick.h" |
||
287 | #include "TCPIP Stack/MAC.h" |
||
288 | #include "TCPIP Stack/IP.h" |
||
289 | #include "TCPIP Stack/ARP.h" |
||
290 | |||
291 | #if defined(STACK_USE_BIGINT) |
||
292 | #include "TCPIP Stack/BigInt.h" |
||
293 | #endif |
||
294 | |||
295 | #if defined(STACK_USE_RSA) |
||
296 | #include "TCPIP Stack/RSA.h" |
||
297 | #endif |
||
298 | |||
299 | #if defined(STACK_USE_ARCFOUR) |
||
300 | #include "TCPIP Stack/ARCFOUR.h" |
||
301 | #endif |
||
302 | |||
303 | #if defined(STACK_USE_AUTO_IP) |
||
304 | #include "TCPIP Stack/AutoIP.h" |
||
305 | #endif |
||
306 | |||
307 | #if defined(STACK_USE_RANDOM) |
||
308 | #include "TCPIP Stack/Random.h" |
||
309 | #endif |
||
310 | |||
311 | #if defined(STACK_USE_MD5) || defined(STACK_USE_SHA1) |
||
312 | #include "TCPIP Stack/Hashes.h" |
||
313 | #endif |
||
314 | |||
315 | #include "TCPIP Stack/XEEPROM.h" |
||
316 | #include "TCPIP Stack/SPIFlash.h" |
||
317 | #include "TCPIP Stack/SPIRAM.h" |
||
318 | |||
319 | #if defined(STACK_USE_UDP) |
||
320 | #include "TCPIP Stack/UDP.h" |
||
321 | #endif |
||
322 | |||
323 | #if defined(STACK_USE_TCP) |
||
324 | #include "TCPIP Stack/TCP.h" |
||
325 | #endif |
||
326 | |||
327 | #if defined(STACK_USE_BERKELEY_API) |
||
328 | #include "TCPIP Stack/BerkeleyAPI.h" |
||
329 | #endif |
||
330 | |||
331 | #if defined(USE_LCD) |
||
332 | #include "TCPIP Stack/LCDBlocking.h" |
||
333 | #endif |
||
334 | |||
335 | #if defined(STACK_USE_UART2TCP_BRIDGE) |
||
336 | #include "TCPIP Stack/UART2TCPBridge.h" |
||
337 | #endif |
||
338 | |||
339 | #if defined(STACK_USE_UART) |
||
340 | #include "TCPIP Stack/UART.h" |
||
341 | #endif |
||
342 | |||
343 | #if defined(STACK_USE_DHCP_CLIENT) || defined(STACK_USE_DHCP_SERVER) |
||
344 | #include "TCPIP Stack/DHCP.h" |
||
345 | #endif |
||
346 | |||
347 | #if defined(STACK_USE_DNS) || defined(STACK_USE_DNS_SERVER) |
||
348 | #include "TCPIP Stack/DNS.h" |
||
349 | #endif |
||
350 | |||
351 | #if defined(STACK_USE_MPFS) |
||
352 | #include "TCPIP Stack/MPFS.h" |
||
353 | #endif |
||
354 | |||
355 | #if defined(STACK_USE_MPFS2) |
||
356 | #include "TCPIP Stack/MPFS2.h" |
||
357 | #endif |
||
358 | |||
359 | #if defined(STACK_USE_FTP_SERVER) |
||
360 | #include "TCPIP Stack/FTP.h" |
||
361 | #endif |
||
362 | |||
363 | #if defined(STACK_USE_HTTP_SERVER) |
||
364 | #include "TCPIP Stack/HTTP.h" |
||
365 | #endif |
||
366 | |||
367 | #if defined(STACK_USE_HTTP2_SERVER) |
||
368 | #ifdef STACK_USE_MDD |
||
369 | #include "TCPIP Stack/FileSystem.h" |
||
370 | #include "TCPIP Stack/_HTTP2.h" |
||
371 | #else |
||
372 | #include "TCPIP Stack/HTTP2.h" |
||
373 | #endif |
||
374 | #endif |
||
375 | |||
376 | #if defined(STACK_USE_ICMP_SERVER) || defined(STACK_USE_ICMP_CLIENT) |
||
377 | #include "TCPIP Stack/ICMP.h" |
||
378 | #endif |
||
379 | |||
380 | #if defined(STACK_USE_ANNOUNCE) |
||
381 | #include "TCPIP Stack/Announce.h" |
||
382 | #endif |
||
383 | |||
384 | #if defined(STACK_USE_SNMP_SERVER) |
||
385 | #include "TCPIP Stack/SNMP.h" |
||
386 | #include "mib.h" |
||
387 | #endif |
||
388 | |||
389 | #if defined(STACK_USE_NBNS) |
||
390 | #include "TCPIP Stack/NBNS.h" |
||
391 | #endif |
||
392 | |||
393 | #if defined(STACK_USE_DNS) |
||
394 | #include "TCPIP Stack/DNS.h" |
||
395 | #endif |
||
396 | |||
397 | #if defined(STACK_USE_DYNAMICDNS_CLIENT) |
||
398 | #include "TCPIP Stack/DynDNS.h" |
||
399 | #endif |
||
400 | |||
401 | #if defined(STACK_USE_TELNET_SERVER) |
||
402 | #include "TCPIP Stack/Telnet.h" |
||
403 | #endif |
||
404 | |||
405 | #if defined(STACK_USE_SMTP_CLIENT) |
||
406 | #include "TCPIP Stack/SMTP.h" |
||
407 | #endif |
||
408 | |||
409 | #if defined(STACK_USE_TFTP_CLIENT) |
||
410 | #include "TCPIP Stack/TFTPc.h" |
||
411 | #endif |
||
412 | |||
413 | #if defined(STACK_USE_REBOOT_SERVER) |
||
414 | #include "TCPIP Stack/Reboot.h" |
||
415 | #endif |
||
416 | |||
417 | #if defined(STACK_USE_SNTP_CLIENT) |
||
418 | #include "TCPIP Stack/SNTP.h" |
||
419 | #endif |
||
420 | |||
421 | #if defined(STACK_USE_UDP_PERFORMANCE_TEST) |
||
422 | #include "TCPIP Stack/UDPPerformanceTest.h" |
||
423 | #endif |
||
424 | |||
425 | #if defined(STACK_USE_TCP_PERFORMANCE_TEST) |
||
426 | #include "TCPIP Stack/TCPPerformanceTest.h" |
||
427 | #endif |
||
428 | |||
429 | #if defined(STACK_USE_SSL) |
||
430 | #include "TCPIP Stack/SSL.h" |
||
431 | #endif |
||
432 | |||
433 | #if defined(WF_CS_TRIS) |
||
434 | #include "TCPIP Stack/WFMac.h" |
||
435 | #endif |
||
436 | #endif |
Powered by WebSVN v2.8.3