These are the examples provided for [[/users/frank26080115/libraries/LPC1700CMSIS_Lib/]] Note, the entire "program" is not compilable!

Committer:
frank26080115
Date:
Sun Mar 20 05:38:56 2011 +0000
Revision:
0:bf7b9fba3924

        

Who changed what in which revision?

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