SHOHEI FUJIMOTO / Mbed 2 deprecated SimpleOscTester

Dependencies:   mbed

Fork of myOSC_test by Alvaro Cassinelli

Committer:
sfjmt
Date:
Tue Aug 06 10:12:56 2013 +0000
Revision:
2:44f1e5803762
Parent:
0:f76708a93fb3
revision_01

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbedalvaro 0:f76708a93fb3 1 /*
mbedalvaro 0:f76708a93fb3 2 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
mbedalvaro 0:f76708a93fb3 3 * All rights reserved.
mbedalvaro 0:f76708a93fb3 4 *
mbedalvaro 0:f76708a93fb3 5 * Redistribution and use in source and binary forms, with or without modification,
mbedalvaro 0:f76708a93fb3 6 * are permitted provided that the following conditions are met:
mbedalvaro 0:f76708a93fb3 7 *
mbedalvaro 0:f76708a93fb3 8 * 1. Redistributions of source code must retain the above copyright notice,
mbedalvaro 0:f76708a93fb3 9 * this list of conditions and the following disclaimer.
mbedalvaro 0:f76708a93fb3 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbedalvaro 0:f76708a93fb3 11 * this list of conditions and the following disclaimer in the documentation
mbedalvaro 0:f76708a93fb3 12 * and/or other materials provided with the distribution.
mbedalvaro 0:f76708a93fb3 13 * 3. The name of the author may not be used to endorse or promote products
mbedalvaro 0:f76708a93fb3 14 * derived from this software without specific prior written permission.
mbedalvaro 0:f76708a93fb3 15 *
mbedalvaro 0:f76708a93fb3 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
mbedalvaro 0:f76708a93fb3 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
mbedalvaro 0:f76708a93fb3 18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
mbedalvaro 0:f76708a93fb3 19 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
mbedalvaro 0:f76708a93fb3 20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
mbedalvaro 0:f76708a93fb3 21 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
mbedalvaro 0:f76708a93fb3 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
mbedalvaro 0:f76708a93fb3 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
mbedalvaro 0:f76708a93fb3 24 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
mbedalvaro 0:f76708a93fb3 25 * OF SUCH DAMAGE.
mbedalvaro 0:f76708a93fb3 26 *
mbedalvaro 0:f76708a93fb3 27 * This file is part of the lwIP TCP/IP stack.
mbedalvaro 0:f76708a93fb3 28 *
mbedalvaro 0:f76708a93fb3 29 * Author: Adam Dunkels <adam@sics.se>
mbedalvaro 0:f76708a93fb3 30 *
mbedalvaro 0:f76708a93fb3 31 */
mbedalvaro 0:f76708a93fb3 32 #ifndef __LWIP_INET_CHKSUM_H__
mbedalvaro 0:f76708a93fb3 33 #define __LWIP_INET_CHKSUM_H__
mbedalvaro 0:f76708a93fb3 34
mbedalvaro 0:f76708a93fb3 35 #include "lwip/opt.h"
mbedalvaro 0:f76708a93fb3 36
mbedalvaro 0:f76708a93fb3 37 #include "lwip/pbuf.h"
mbedalvaro 0:f76708a93fb3 38 #include "lwip/ip_addr.h"
mbedalvaro 0:f76708a93fb3 39
mbedalvaro 0:f76708a93fb3 40 /** Swap the bytes in an u16_t: much like htons() for little-endian */
mbedalvaro 0:f76708a93fb3 41 #ifndef SWAP_BYTES_IN_WORD
mbedalvaro 0:f76708a93fb3 42 #if LWIP_PLATFORM_BYTESWAP && (BYTE_ORDER == LITTLE_ENDIAN)
mbedalvaro 0:f76708a93fb3 43 /* little endian and PLATFORM_BYTESWAP defined */
mbedalvaro 0:f76708a93fb3 44 #define SWAP_BYTES_IN_WORD(w) LWIP_PLATFORM_HTONS(w)
mbedalvaro 0:f76708a93fb3 45 #else /* LWIP_PLATFORM_BYTESWAP && (BYTE_ORDER == LITTLE_ENDIAN) */
mbedalvaro 0:f76708a93fb3 46 /* can't use htons on big endian (or PLATFORM_BYTESWAP not defined)... */
mbedalvaro 0:f76708a93fb3 47 #define SWAP_BYTES_IN_WORD(w) (((w) & 0xff) << 8) | (((w) & 0xff00) >> 8)
mbedalvaro 0:f76708a93fb3 48 #endif /* LWIP_PLATFORM_BYTESWAP && (BYTE_ORDER == LITTLE_ENDIAN)*/
mbedalvaro 0:f76708a93fb3 49 #endif /* SWAP_BYTES_IN_WORD */
mbedalvaro 0:f76708a93fb3 50
mbedalvaro 0:f76708a93fb3 51 /** Split an u32_t in two u16_ts and add them up */
mbedalvaro 0:f76708a93fb3 52 #ifndef FOLD_U32T
mbedalvaro 0:f76708a93fb3 53 #define FOLD_U32T(u) (((u) >> 16) + ((u) & 0x0000ffffUL))
mbedalvaro 0:f76708a93fb3 54 #endif
mbedalvaro 0:f76708a93fb3 55
mbedalvaro 0:f76708a93fb3 56 #if LWIP_CHECKSUM_ON_COPY
mbedalvaro 0:f76708a93fb3 57 /** Function-like macro: same as MEMCPY but returns the checksum of copied data
mbedalvaro 0:f76708a93fb3 58 as u16_t */
mbedalvaro 0:f76708a93fb3 59 #ifndef LWIP_CHKSUM_COPY
mbedalvaro 0:f76708a93fb3 60 #define LWIP_CHKSUM_COPY(dst, src, len) lwip_chksum_copy(dst, src, len)
mbedalvaro 0:f76708a93fb3 61 #ifndef LWIP_CHKSUM_COPY_ALGORITHM
mbedalvaro 0:f76708a93fb3 62 #define LWIP_CHKSUM_COPY_ALGORITHM 1
mbedalvaro 0:f76708a93fb3 63 #endif /* LWIP_CHKSUM_COPY_ALGORITHM */
mbedalvaro 0:f76708a93fb3 64 #endif /* LWIP_CHKSUM_COPY */
mbedalvaro 0:f76708a93fb3 65 #else /* LWIP_CHECKSUM_ON_COPY */
mbedalvaro 0:f76708a93fb3 66 #define LWIP_CHKSUM_COPY_ALGORITHM 0
mbedalvaro 0:f76708a93fb3 67 #endif /* LWIP_CHECKSUM_ON_COPY */
mbedalvaro 0:f76708a93fb3 68
mbedalvaro 0:f76708a93fb3 69 #ifdef __cplusplus
mbedalvaro 0:f76708a93fb3 70 extern "C" {
mbedalvaro 0:f76708a93fb3 71 #endif
mbedalvaro 0:f76708a93fb3 72
mbedalvaro 0:f76708a93fb3 73 u16_t inet_chksum(void *dataptr, u16_t len);
mbedalvaro 0:f76708a93fb3 74 u16_t inet_chksum_pbuf(struct pbuf *p);
mbedalvaro 0:f76708a93fb3 75 u16_t inet_chksum_pseudo(struct pbuf *p,
mbedalvaro 0:f76708a93fb3 76 ip_addr_t *src, ip_addr_t *dest,
mbedalvaro 0:f76708a93fb3 77 u8_t proto, u16_t proto_len);
mbedalvaro 0:f76708a93fb3 78 u16_t inet_chksum_pseudo_partial(struct pbuf *p,
mbedalvaro 0:f76708a93fb3 79 ip_addr_t *src, ip_addr_t *dest,
mbedalvaro 0:f76708a93fb3 80 u8_t proto, u16_t proto_len, u16_t chksum_len);
mbedalvaro 0:f76708a93fb3 81 #if LWIP_CHKSUM_COPY_ALGORITHM
mbedalvaro 0:f76708a93fb3 82 u16_t lwip_chksum_copy(void *dst, const void *src, u16_t len);
mbedalvaro 0:f76708a93fb3 83 #endif /* LWIP_CHKSUM_COPY_ALGORITHM */
mbedalvaro 0:f76708a93fb3 84
mbedalvaro 0:f76708a93fb3 85 #ifdef __cplusplus
mbedalvaro 0:f76708a93fb3 86 }
mbedalvaro 0:f76708a93fb3 87 #endif
mbedalvaro 0:f76708a93fb3 88
mbedalvaro 0:f76708a93fb3 89 #endif /* __LWIP_INET_H__ */
mbedalvaro 0:f76708a93fb3 90