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

Annotation of /trunk/docs/Microchip TCP_IP stack/Include/TCPIP Stack/IP.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 15 - (hide annotations) (download)
Thu Apr 19 09:01:15 2007 UTC (17 years, 3 months ago) by hedin
File MIME type: text/plain
File size: 8455 byte(s)
added the TCP/IP stack, source code.
1 hedin 15 /*********************************************************************
2     *
3     * IP Defs for Microchip TCP/IP Stack
4     *
5     *********************************************************************
6     * FileName: IP.h
7     * Dependencies: StackTsk.h
8     * MAC.h
9     * Processor: PIC18, PIC24F, PIC24H, dsPIC30F, dsPIC33F
10     * Complier: Microchip C18 v3.02 or higher
11     * Microchip C30 v2.01 or higher
12     * Company: Microchip Technology, Inc.
13     *
14     * Software License Agreement
15     *
16     * Copyright © 2002-2007 Microchip Technology Inc. All rights
17     * reserved.
18     *
19     * Microchip licenses to you the right to use, modify, copy, and
20     * distribute:
21     * (i) the Software when embedded on a Microchip microcontroller or
22     * digital signal controller product (“Device”) which is
23     * integrated into Licensee’s product; or
24     * (ii) ONLY the Software driver source files ENC28J60.c and
25     * ENC28J60.h ported to a non-Microchip device used in
26     * conjunction with a Microchip ethernet controller for the
27     * sole purpose of interfacing with the ethernet controller.
28     *
29     * You should refer to the license agreement accompanying this
30     * Software for additional information regarding your rights and
31     * obligations.
32     *
33     * THE SOFTWARE AND DOCUMENTATION ARE PROVIDED “AS IS” WITHOUT
34     * WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT
35     * LIMITATION, ANY WARRANTY OF MERCHANTABILITY, FITNESS FOR A
36     * PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL
37     * MICROCHIP BE LIABLE FOR ANY INCIDENTAL, SPECIAL, INDIRECT OR
38     * CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF
39     * PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY OR SERVICES, ANY CLAIMS
40     * BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE
41     * THEREOF), ANY CLAIMS FOR INDEMNITY OR CONTRIBUTION, OR OTHER
42     * SIMILAR COSTS, WHETHER ASSERTED ON THE BASIS OF CONTRACT, TORT
43     * (INCLUDING NEGLIGENCE), BREACH OF WARRANTY, OR OTHERWISE.
44     *
45     *
46     * Author Date Comment
47     *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
48     * Nilesh Rajbharti 4/27/01 Original (Rev 1.0)
49     * Nilesh Rajbharti 2/9/02 Cleanup
50     * Nilesh Rajbharti 5/22/02 Rev 2.0 (See version.log for detail)
51     ********************************************************************/
52     #ifndef __IP_H
53     #define __IP_H
54    
55    
56     #define IP_PROT_ICMP (1u)
57     #define IP_PROT_TCP (6u)
58     #define IP_PROT_UDP (17u)
59    
60    
61     /*
62     * IP packet header definition
63     */
64     typedef struct _IP_HEADER
65     {
66     BYTE VersionIHL;
67     BYTE TypeOfService;
68     WORD TotalLength;
69     WORD Identification;
70     WORD FragmentInfo;
71     BYTE TimeToLive;
72     BYTE Protocol;
73     WORD HeaderChecksum;
74     IP_ADDR SourceAddress;
75     IP_ADDR DestAddress;
76     } IP_HEADER;
77    
78    
79     /*********************************************************************
80     * Function: BOOL IPIsTxReady(BOOL HighPriority)
81     *
82     * PreCondition: None
83     *
84     * Input: None
85     *
86     * Output: TRUE if transmit buffer is empty
87     * FALSE if transmit buffer is not empty
88     *
89     * Side Effects: None
90     *
91     * Note: None
92     *
93     ********************************************************************/
94     #define IPIsTxReady() MACIsTxReady()
95    
96    
97     /*********************************************************************
98     * Macro: IPSetTxBuffer(a, b)
99     *
100     * PreCondition: None
101     *
102     * Input: a - Buffer identifier
103     * b - Offset
104     *
105     * Output: Next Read/Write access to transmit buffer 'a'
106     * set to offset 'b'
107     *
108     * Side Effects: None
109     *
110     * Note: None
111     *
112     ********************************************************************/
113     #define IPSetTxBuffer(b) MACSetWritePtr(b + BASE_TX_ADDR + sizeof(ETHER_HEADER) + sizeof(IP_HEADER))
114    
115    
116    
117     /*********************************************************************
118     * Function: WORD IPPutHeader( IP_ADDR *Dest,
119     * BYTE Protocol,
120     * WORD Identifier,
121     * WORD DataLen)
122     *
123     * PreCondition: IPIsTxReady() == TRUE
124     *
125     * Input: Src - Destination node address
126     * Protocol - Current packet protocol
127     * Identifier - Current packet identifier
128     * DataLen - Current packet data length
129     *
130     * Output: Handle to current packet - For use by
131     * IPSendByte() function.
132     *
133     * Side Effects: None
134     *
135     * Note: Only one IP message can be transmitted at any
136     * time.
137     * Caller may not transmit and receive a message
138     * at the same time.
139     *
140     ********************************************************************/
141     WORD IPPutHeader(NODE_INFO *remote,
142     BYTE protocol,
143     WORD len);
144    
145    
146     /*********************************************************************
147     * Macro: IPPutArray(a, b)
148     *
149     * PreCondition: IPIsTxReady() == TRUE
150     *
151     * Input: a - Data buffer
152     * b - Buffer length
153     *
154     * Output: None
155     *
156     * Side Effects: None
157     *
158     * Note: Data is copied to IP data area.
159     *
160     ********************************************************************/
161     #define IPPutArray(a, b) MACPutArray(a, b)
162    
163    
164    
165    
166     /*********************************************************************
167     * Function: BOOL IPGetHeader( IP_ADDR *localIP,
168     * NODE_INFO *remote,
169     * BYTE *Protocol,
170     * WORD *len)
171     *
172     * PreCondition: MACGetHeader() == TRUE
173     *
174     * Input: localIP - Local node IP Address as received
175     * in current IP header.
176     * If this information is not required
177     * caller may pass NULL value.
178     * remote - Remote node info
179     * Protocol - Current packet protocol
180     * len - Current packet data length
181     *
182     * Output: TRUE, if valid packet was received
183     * FALSE otherwise
184     *
185     * Side Effects: None
186     *
187     * Note: Only one IP message can be received.
188     * Caller may not transmit and receive a message
189     * at the same time.
190     *
191     ********************************************************************/
192     BOOL IPGetHeader(IP_ADDR *localIP,
193     NODE_INFO *remote,
194     BYTE *protocol,
195     WORD *len);
196    
197    
198     /*********************************************************************
199     * Macro: IPDiscard()
200     *
201     * PreCondition: MACGetHeader() == TRUE
202     *
203     * Input: None
204     *
205     * Output: Current packet is discarded and buffer is
206     * freed-up
207     *
208     * Side Effects: None
209     *
210     * Note: None
211     *
212     ********************************************************************/
213     #define IPDiscard() MACDiscard()
214    
215    
216    
217     /*********************************************************************
218     * Macro: IPGetArray(a, b)
219     *
220     * PreCondition: MACGetHeader() == TRUE
221     *
222     * Input: a - Data buffer
223     * b - Buffer length
224     *
225     * Output: None
226     *
227     * Side Effects: None
228     *
229     * Note: Data is copied from IP data to given buffer
230     *
231     ********************************************************************/
232     #define IPGetArray(a, b) MACGetArray(a, b)
233    
234    
235    
236    
237     /*********************************************************************
238     * Function: IPSetRxBuffer(WORD Offset)
239     *
240     * PreCondition: IPHeaderLen must have been intialized by
241     * IPGetHeader() or IPPutHeader()
242     *
243     * Input: Offset from beginning of IP data field
244     *
245     * Output: Next Read/Write access to receive buffer is
246     * set to Offset
247     *
248     * Side Effects: None
249     *
250     * Note: None
251     *
252     ********************************************************************/
253     void IPSetRxBuffer(WORD Offset);
254    
255    
256    
257    
258    
259     #endif
260    
261    
262    

  ViewVC Help
Powered by ViewVC 1.1.20