]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/uIP_Demo_IAR_ARM7/uip/uip_arch.h
Prepare for V9.0.0 release.
[freertos] / FreeRTOS / Demo / uIP_Demo_IAR_ARM7 / uip / uip_arch.h
1 /**\r
2  * \defgroup uiparch Architecture specific uIP functions\r
3  * @{\r
4  *\r
5  * The functions in the architecture specific module implement the IP\r
6  * check sum and 32-bit additions.\r
7  *\r
8  * The IP checksum calculation is the most computationally expensive\r
9  * operation in the TCP/IP stack and it therefore pays off to\r
10  * implement this in efficient assembler. The purpose of the uip-arch\r
11  * module is to let the checksum functions to be implemented in\r
12  * architecture specific assembler.\r
13  *\r
14  */\r
15 \r
16 /**\r
17  * \file\r
18  * Declarations of architecture specific functions.\r
19  * \author Adam Dunkels <adam@dunkels.com>\r
20  */\r
21 \r
22 /*\r
23  * Copyright (c) 2001, Adam Dunkels.\r
24  * All rights reserved. \r
25  *\r
26  * Redistribution and use in source and binary forms, with or without \r
27  * modification, are permitted provided that the following conditions \r
28  * are met: \r
29  * 1. Redistributions of source code must retain the above copyright \r
30  *    notice, this list of conditions and the following disclaimer. \r
31  * 2. Redistributions in binary form must reproduce the above copyright \r
32  *    notice, this list of conditions and the following disclaimer in the \r
33  *    documentation and/or other materials provided with the distribution. \r
34  * 3. The name of the author may not be used to endorse or promote\r
35  *    products derived from this software without specific prior\r
36  *    written permission.  \r
37  *\r
38  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS\r
39  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\r
40  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
41  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY\r
42  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
43  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE\r
44  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r
45  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\r
46  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\r
47  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\r
48  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  \r
49  *\r
50  * This file is part of the uIP TCP/IP stack.\r
51  *\r
52  * $Id: uip_arch.h,v 1.1.2.2 2003/10/06 15:10:22 adam Exp $\r
53  *\r
54  */\r
55 \r
56 #ifndef __UIP_ARCH_H__\r
57 #define __UIP_ARCH_H__\r
58 \r
59 #include "uip.h"\r
60 \r
61 /**\r
62  * Carry out a 32-bit addition.\r
63  *\r
64  * Because not all architectures for which uIP is intended has native\r
65  * 32-bit arithmetic, uIP uses an external C function for doing the\r
66  * required 32-bit additions in the TCP protocol processing. This\r
67  * function should add the two arguments and place the result in the\r
68  * global variable uip_acc32.\r
69  *\r
70  * \note The 32-bit integer pointed to by the op32 parameter and the\r
71  * result in the uip_acc32 variable are in network byte order (big\r
72  * endian).\r
73  *\r
74  * \param op32 A pointer to a 4-byte array representing a 32-bit\r
75  * integer in network byte order (big endian).\r
76  *\r
77  * \param op16 A 16-bit integer in host byte order.\r
78  */\r
79 void uip_add32(u8_t *op32, u16_t op16);\r
80 \r
81 /**\r
82  * Calculate the Internet checksum over a buffer.\r
83  *\r
84  * The Internet checksum is the one's complement of the one's\r
85  * complement sum of all 16-bit words in the buffer.\r
86  *\r
87  * See RFC1071.\r
88  *\r
89  * \note This function is not called in the current version of uIP,\r
90  * but future versions might make use of it.\r
91  *\r
92  * \param buf A pointer to the buffer over which the checksum is to be\r
93  * computed.\r
94  *\r
95  * \param len The length of the buffer over which the checksum is to\r
96  * be computed.\r
97  *\r
98  * \return The Internet checksum of the buffer.\r
99  */\r
100 u16_t uip_chksum(u16_t *buf, u16_t len);\r
101 \r
102 /**\r
103  * Calculate the IP header checksum of the packet header in uip_buf.\r
104  *\r
105  * The IP header checksum is the Internet checksum of the 20 bytes of\r
106  * the IP header.\r
107  *\r
108  * \return The IP header checksum of the IP header in the uip_buf\r
109  * buffer.\r
110  */\r
111 u16_t uip_ipchksum(void);\r
112 \r
113 /**\r
114  * Calculate the TCP checksum of the packet in uip_buf and uip_appdata.\r
115  *\r
116  * The TCP checksum is the Internet checksum of data contents of the\r
117  * TCP segment, and a pseudo-header as defined in RFC793.\r
118  *\r
119  * \note The uip_appdata pointer that points to the packet data may\r
120  * point anywhere in memory, so it is not possible to simply calculate\r
121  * the Internet checksum of the contents of the uip_buf buffer.\r
122  *\r
123  * \return The TCP checksum of the TCP segment in uip_buf and pointed\r
124  * to by uip_appdata.\r
125  */\r
126 u16_t uip_tcpchksum(void);\r
127 \r
128 /** @} */\r
129 \r
130 #endif /* __UIP_ARCH_H__ */\r