/[H8]/trunk/docs/Microchip TCP_IP stack/Include/TCPIP Stack/StackTsk.h
ViewVC logotype

Contents of /trunk/docs/Microchip TCP_IP stack/Include/TCPIP Stack/StackTsk.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 15 - (show annotations) (download)
Thu Apr 19 09:01:15 2007 UTC (17 years, 1 month ago) by hedin
File MIME type: text/plain
File size: 5988 byte(s)
added the TCP/IP stack, source code.
1 /*********************************************************************
2 *
3 * Microchip TCP/IP Stack Definitions
4 *
5 *********************************************************************
6 * FileName: StackTsk.h
7 * Dependencies: Compiler.h
8 * Processor: PIC18, PIC24F, PIC24H, dsPIC30F, dsPIC33F
9 * Complier: Microchip C18 v3.02 or higher
10 * Microchip C30 v2.01 or higher
11 * Company: Microchip Technology, Inc.
12 *
13 * Software License Agreement
14 *
15 * Copyright © 2002-2007 Microchip Technology Inc. All rights
16 * reserved.
17 *
18 * Microchip licenses to you the right to use, modify, copy, and
19 * distribute:
20 * (i) the Software when embedded on a Microchip microcontroller or
21 * digital signal controller product (“Device”) which is
22 * integrated into Licensee’s product; or
23 * (ii) ONLY the Software driver source files ENC28J60.c and
24 * ENC28J60.h ported to a non-Microchip device used in
25 * conjunction with a Microchip ethernet controller for the
26 * sole purpose of interfacing with the ethernet controller.
27 *
28 * You should refer to the license agreement accompanying this
29 * Software for additional information regarding your rights and
30 * obligations.
31 *
32 * THE SOFTWARE AND DOCUMENTATION ARE PROVIDED “AS IS” WITHOUT
33 * WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT
34 * LIMITATION, ANY WARRANTY OF MERCHANTABILITY, FITNESS FOR A
35 * PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL
36 * MICROCHIP BE LIABLE FOR ANY INCIDENTAL, SPECIAL, INDIRECT OR
37 * CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF
38 * PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY OR SERVICES, ANY CLAIMS
39 * BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE
40 * THEREOF), ANY CLAIMS FOR INDEMNITY OR CONTRIBUTION, OR OTHER
41 * SIMILAR COSTS, WHETHER ASSERTED ON THE BASIS OF CONTRACT, TORT
42 * (INCLUDING NEGLIGENCE), BREACH OF WARRANTY, OR OTHERWISE.
43 *
44 *
45 * Author Date Comment
46 *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
47 * Nilesh Rajbharti 8/10/01 Original (Rev 1.0)
48 * Nilesh Rajbharti 2/9/02 Cleanup
49 * Nilesh Rajbharti 5/22/02 Rev 2.0 (See version.log for detail)
50 * Nilesh Rajbharti 8/7/03 Rev 2.21 - TFTP Client addition
51 * Howard Schlunder 9/30/04 Added MCHP_MAC, MAC_POWER_ON_TEST,
52 EEPROM_BUFFER_SIZE, USE_LCD
53 * Howard Schlunder 8/09/06 Removed MCHP_MAC, added STACK_USE_NBNS,
54 * STACK_USE_DNS, and STACK_USE_GENERIC_TCP_EXAMPLE
55 ********************************************************************/
56 #ifndef __STACK_TSK_H
57 #define __STACK_TSK_H
58
59
60 // Check for potential configuration errors in "TCPIPConfig.h"
61 #if (MAX_TCP_SOCKETS <= 0 || MAX_TCP_SOCKETS > 255)
62 #error Invalid MAX_TCP_SOCKETS value specified.
63 #endif
64
65 // Check for potential configuration errors in "TCPIPConfig.h"
66 #if (MAX_UDP_SOCKETS <= 0 || MAX_UDP_SOCKETS > 255 )
67 #error Invlaid MAX_UDP_SOCKETS value specified
68 #endif
69
70 // Check for potential configuration errors in "TCPIPConfig.h"
71 #if (MAX_HTTP_CONNECTIONS <= 0 || MAX_HTTP_CONNECTIONS > 255 )
72 #error Invalid MAX_HTTP_CONNECTIONS value specified.
73 #endif
74
75 // Check for potential configuration errors in "TCPIPConfig.h"
76 #define AVAILABLE_SOCKETS (MAX_TCP_SOCKETS)
77 #if defined(STACK_USE_HTTP_SERVER)
78 #define AVAILABLE_SOCKETS2 (AVAILABLE_SOCKETS - MAX_HTTP_CONNECTIONS)
79 #else
80 #define AVAILABLE_SOCKETS2 (MAX_TCP_SOCKETS)
81 #endif
82
83 // Check for potential configuration errors in "TCPIPConfig.h"
84 // When using FTP, you must have at least two sockets free
85 #if defined(STACK_USE_FTP_SERVER)
86 #define AVAILABLE_SOCKETS3 (AVAILABLE_SOCKETS2 - 2)
87 #else
88 #define AVAILABLE_SOCKETS3 (AVAILABLE_SOCKETS2)
89 #endif
90
91 // Check for potential configuration errors in "TCPIPConfig.h"
92 #if AVAILABLE_SOCKETS3 < 0 || AVAILABLE_SOCKETS3 > MAX_TCP_SOCKETS
93 #error MAX_TCP_SOCKETS is too low to accommodate MAX_HTTP_CONNECTIONS and/or STACK_USE_FTP_SERVER
94 #error Either increase MAX_TCP_SOCKETS in StackTsk.h or decrease module socket usage.
95 #endif
96
97 // Check for potential configuration errors in "TCPIPConfig.h"
98 #define AVAILABLE_UDP_SOCKETS (MAX_UDP_SOCKETS)
99 #if defined(STACK_USE_DHCP_CLIENT)
100 #define AVAILABLE_UDP_SOCKETS2 (AVAILABLE_UDP_SOCKETS - 1)
101 #else
102 #define AVAILABLE_UDP_SOCKETS2 AVAILABLE_UDP_SOCKETS
103 #endif
104
105 #if defined(STACK_USE_SNMP_SERVER)
106 #define AVAILABLE_UDP_SOCKETS3 (AVAILABLE_UDP_SOCKETS2 - 1)
107 #else
108 #define AVAILABLE_UDP_SOCKETS3 AVAILABLE_UDP_SOCKETS2
109 #endif
110
111 #if defined(STACK_USE_TFTP_CLIENT)
112 #define AVAILABLE_UDP_SOCKETS4 (AVAILABLE_UDP_SOCKETS2)
113 #else
114 #define AVAILABLE_UDP_SOCKETS4 AVAILABLE_UDP_SOCKETS3
115 #endif
116
117 // Check for potential configuration errors in "TCPIPConfig.h"
118 #if AVAILABLE_UDP_SOCKETS4 < 0 || AVAILABLE_UDP_SOCKETS4 > MAX_UDP_SOCKETS
119 #error MAX_UDP_SOCKETS is too low to accommodate DHCP, SNMP, and/or TFTP client
120 #error Either increase MAX_UDP_SOCKETS in StackTsk.h or decrease module UDP socket usage.
121 #endif
122
123
124
125 typedef struct __attribute__((__packed__)) _MAC_ADDR
126 {
127 BYTE v[6];
128 } MAC_ADDR;
129
130 #define IP_ADDR DWORD_VAL
131
132 typedef struct __attribute__((__packed__)) _NODE_INFO
133 {
134 MAC_ADDR MACAddr;
135 IP_ADDR IPAddr;
136 } NODE_INFO;
137
138 typedef struct __attribute__((__packed__)) _APP_CONFIG
139 {
140 IP_ADDR MyIPAddr;
141 IP_ADDR MyMask;
142 IP_ADDR MyGateway;
143 IP_ADDR PrimaryDNSServer;
144 IP_ADDR SecondaryDNSServer;
145 IP_ADDR DefaultIPAddr;
146 IP_ADDR DefaultMask;
147 MAC_ADDR MyMACAddr;
148 BYTE NetBIOSName[16];
149 struct
150 {
151 unsigned char : 6;
152 unsigned char bIsDHCPEnabled : 1;
153 unsigned char bInConfigMode : 1;
154 } Flags;
155 } APP_CONFIG;
156
157
158 #ifndef THIS_IS_STACK_APPLICATION
159 extern APP_CONFIG AppConfig;
160 #endif
161
162
163 void StackInit(void);
164 void StackTask(void);
165
166
167 #endif

  ViewVC Help
Powered by ViewVC 1.1.20