mbeduino + Weatherduino Weather Stations post test

Dependencies:   mbed

Committer:
okini3939
Date:
Tue Oct 26 17:19:28 2010 +0000
Revision:
0:10bcaa7c2253

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
okini3939 0:10bcaa7c2253 1 /*
okini3939 0:10bcaa7c2253 2 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
okini3939 0:10bcaa7c2253 3 * All rights reserved.
okini3939 0:10bcaa7c2253 4 *
okini3939 0:10bcaa7c2253 5 * Redistribution and use in source and binary forms, with or without modification,
okini3939 0:10bcaa7c2253 6 * are permitted provided that the following conditions are met:
okini3939 0:10bcaa7c2253 7 *
okini3939 0:10bcaa7c2253 8 * 1. Redistributions of source code must retain the above copyright notice,
okini3939 0:10bcaa7c2253 9 * this list of conditions and the following disclaimer.
okini3939 0:10bcaa7c2253 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
okini3939 0:10bcaa7c2253 11 * this list of conditions and the following disclaimer in the documentation
okini3939 0:10bcaa7c2253 12 * and/or other materials provided with the distribution.
okini3939 0:10bcaa7c2253 13 * 3. The name of the author may not be used to endorse or promote products
okini3939 0:10bcaa7c2253 14 * derived from this software without specific prior written permission.
okini3939 0:10bcaa7c2253 15 *
okini3939 0:10bcaa7c2253 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
okini3939 0:10bcaa7c2253 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
okini3939 0:10bcaa7c2253 18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
okini3939 0:10bcaa7c2253 19 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
okini3939 0:10bcaa7c2253 20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
okini3939 0:10bcaa7c2253 21 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
okini3939 0:10bcaa7c2253 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
okini3939 0:10bcaa7c2253 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
okini3939 0:10bcaa7c2253 24 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
okini3939 0:10bcaa7c2253 25 * OF SUCH DAMAGE.
okini3939 0:10bcaa7c2253 26 *
okini3939 0:10bcaa7c2253 27 * This file is part of the lwIP TCP/IP stack.
okini3939 0:10bcaa7c2253 28 *
okini3939 0:10bcaa7c2253 29 * Author: Adam Dunkels <adam@sics.se>
okini3939 0:10bcaa7c2253 30 *
okini3939 0:10bcaa7c2253 31 */
okini3939 0:10bcaa7c2253 32 #ifndef __LWIP_DEF_H__
okini3939 0:10bcaa7c2253 33 #define __LWIP_DEF_H__
okini3939 0:10bcaa7c2253 34
okini3939 0:10bcaa7c2253 35 /* arch.h might define NULL already */
okini3939 0:10bcaa7c2253 36 #include "lwip/arch.h"
okini3939 0:10bcaa7c2253 37 #include "lwip/opt.h"
okini3939 0:10bcaa7c2253 38
okini3939 0:10bcaa7c2253 39 #ifdef __cplusplus
okini3939 0:10bcaa7c2253 40 extern "C" {
okini3939 0:10bcaa7c2253 41 #endif
okini3939 0:10bcaa7c2253 42
okini3939 0:10bcaa7c2253 43 #define LWIP_MAX(x , y) (((x) > (y)) ? (x) : (y))
okini3939 0:10bcaa7c2253 44 #define LWIP_MIN(x , y) (((x) < (y)) ? (x) : (y))
okini3939 0:10bcaa7c2253 45
okini3939 0:10bcaa7c2253 46 #ifndef NULL
okini3939 0:10bcaa7c2253 47 #define NULL ((void *)0)
okini3939 0:10bcaa7c2253 48 #endif
okini3939 0:10bcaa7c2253 49
okini3939 0:10bcaa7c2253 50 /** Get the absolute difference between 2 u32_t values (correcting overflows)
okini3939 0:10bcaa7c2253 51 * 'a' is expected to be 'higher' (without overflow) than 'b'. */
okini3939 0:10bcaa7c2253 52 #define LWIP_U32_DIFF(a, b) (((a) >= (b)) ? ((a) - (b)) : (((a) + ((b) ^ 0xFFFFFFFF) + 1)))
okini3939 0:10bcaa7c2253 53
okini3939 0:10bcaa7c2253 54 /* Endianess-optimized shifting of two u8_t to create one u16_t */
okini3939 0:10bcaa7c2253 55 #if BYTE_ORDER == LITTLE_ENDIAN
okini3939 0:10bcaa7c2253 56 #define LWIP_MAKE_U16(a, b) ((a << 8) | b)
okini3939 0:10bcaa7c2253 57 #else
okini3939 0:10bcaa7c2253 58 #define LWIP_MAKE_U16(a, b) ((b << 8) | a)
okini3939 0:10bcaa7c2253 59 #endif
okini3939 0:10bcaa7c2253 60
okini3939 0:10bcaa7c2253 61 #ifndef LWIP_PLATFORM_BYTESWAP
okini3939 0:10bcaa7c2253 62 #define LWIP_PLATFORM_BYTESWAP 0
okini3939 0:10bcaa7c2253 63 #endif
okini3939 0:10bcaa7c2253 64
okini3939 0:10bcaa7c2253 65 #ifndef LWIP_PREFIX_BYTEORDER_FUNCS
okini3939 0:10bcaa7c2253 66 /* workaround for naming collisions on some platforms */
okini3939 0:10bcaa7c2253 67
okini3939 0:10bcaa7c2253 68 #ifdef htons
okini3939 0:10bcaa7c2253 69 #undef htons
okini3939 0:10bcaa7c2253 70 #endif /* htons */
okini3939 0:10bcaa7c2253 71 #ifdef htonl
okini3939 0:10bcaa7c2253 72 #undef htonl
okini3939 0:10bcaa7c2253 73 #endif /* htonl */
okini3939 0:10bcaa7c2253 74 #ifdef ntohs
okini3939 0:10bcaa7c2253 75 #undef ntohs
okini3939 0:10bcaa7c2253 76 #endif /* ntohs */
okini3939 0:10bcaa7c2253 77 #ifdef ntohl
okini3939 0:10bcaa7c2253 78 #undef ntohl
okini3939 0:10bcaa7c2253 79 #endif /* ntohl */
okini3939 0:10bcaa7c2253 80
okini3939 0:10bcaa7c2253 81 #define htons(x) lwip_htons(x)
okini3939 0:10bcaa7c2253 82 #define ntohs(x) lwip_ntohs(x)
okini3939 0:10bcaa7c2253 83 #define htonl(x) lwip_htonl(x)
okini3939 0:10bcaa7c2253 84 #define ntohl(x) lwip_ntohl(x)
okini3939 0:10bcaa7c2253 85 #endif /* LWIP_PREFIX_BYTEORDER_FUNCS */
okini3939 0:10bcaa7c2253 86
okini3939 0:10bcaa7c2253 87 #if BYTE_ORDER == BIG_ENDIAN
okini3939 0:10bcaa7c2253 88 #define lwip_htons(x) (x)
okini3939 0:10bcaa7c2253 89 #define lwip_ntohs(x) (x)
okini3939 0:10bcaa7c2253 90 #define lwip_htonl(x) (x)
okini3939 0:10bcaa7c2253 91 #define lwip_ntohl(x) (x)
okini3939 0:10bcaa7c2253 92 #define PP_HTONS(x) (x)
okini3939 0:10bcaa7c2253 93 #define PP_NTOHS(x) (x)
okini3939 0:10bcaa7c2253 94 #define PP_HTONL(x) (x)
okini3939 0:10bcaa7c2253 95 #define PP_NTOHL(x) (x)
okini3939 0:10bcaa7c2253 96 #else /* BYTE_ORDER != BIG_ENDIAN */
okini3939 0:10bcaa7c2253 97 #if LWIP_PLATFORM_BYTESWAP
okini3939 0:10bcaa7c2253 98 #define lwip_htons(x) LWIP_PLATFORM_HTONS(x)
okini3939 0:10bcaa7c2253 99 #define lwip_ntohs(x) LWIP_PLATFORM_HTONS(x)
okini3939 0:10bcaa7c2253 100 #define lwip_htonl(x) LWIP_PLATFORM_HTONL(x)
okini3939 0:10bcaa7c2253 101 #define lwip_ntohl(x) LWIP_PLATFORM_HTONL(x)
okini3939 0:10bcaa7c2253 102 #else /* LWIP_PLATFORM_BYTESWAP */
okini3939 0:10bcaa7c2253 103 u16_t lwip_htons(u16_t x);
okini3939 0:10bcaa7c2253 104 u16_t lwip_ntohs(u16_t x);
okini3939 0:10bcaa7c2253 105 u32_t lwip_htonl(u32_t x);
okini3939 0:10bcaa7c2253 106 u32_t lwip_ntohl(u32_t x);
okini3939 0:10bcaa7c2253 107 #endif /* LWIP_PLATFORM_BYTESWAP */
okini3939 0:10bcaa7c2253 108
okini3939 0:10bcaa7c2253 109 /* These macros should be calculated by the preprocessor and are used
okini3939 0:10bcaa7c2253 110 with compile-time constants only (so that there is no little-endian
okini3939 0:10bcaa7c2253 111 overhead at runtime). */
okini3939 0:10bcaa7c2253 112 #define PP_HTONS(x) ((((x) & 0xff) << 8) | (((x) & 0xff00) >> 8))
okini3939 0:10bcaa7c2253 113 #define PP_NTOHS(x) PP_HTONS(x)
okini3939 0:10bcaa7c2253 114 #define PP_HTONL(x) ((((x) & 0xff) << 24) | \
okini3939 0:10bcaa7c2253 115 (((x) & 0xff00) << 8) | \
okini3939 0:10bcaa7c2253 116 (((x) & 0xff0000UL) >> 8) | \
okini3939 0:10bcaa7c2253 117 (((x) & 0xff000000UL) >> 24))
okini3939 0:10bcaa7c2253 118 #define PP_NTOHL(x) PP_HTONL(x)
okini3939 0:10bcaa7c2253 119
okini3939 0:10bcaa7c2253 120 #endif /* BYTE_ORDER == BIG_ENDIAN */
okini3939 0:10bcaa7c2253 121
okini3939 0:10bcaa7c2253 122 #ifdef __cplusplus
okini3939 0:10bcaa7c2253 123 }
okini3939 0:10bcaa7c2253 124 #endif
okini3939 0:10bcaa7c2253 125
okini3939 0:10bcaa7c2253 126 #endif /* __LWIP_DEF_H__ */
okini3939 0:10bcaa7c2253 127