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_MEM_H__
okini3939 0:10bcaa7c2253 33 #define __LWIP_MEM_H__
okini3939 0:10bcaa7c2253 34
okini3939 0:10bcaa7c2253 35 #include "lwip/opt.h"
okini3939 0:10bcaa7c2253 36
okini3939 0:10bcaa7c2253 37 #ifdef __cplusplus
okini3939 0:10bcaa7c2253 38 extern "C" {
okini3939 0:10bcaa7c2253 39 #endif
okini3939 0:10bcaa7c2253 40
okini3939 0:10bcaa7c2253 41 #if MEM_LIBC_MALLOC
okini3939 0:10bcaa7c2253 42
okini3939 0:10bcaa7c2253 43 #include <stddef.h> /* for size_t */
okini3939 0:10bcaa7c2253 44
okini3939 0:10bcaa7c2253 45 typedef size_t mem_size_t;
okini3939 0:10bcaa7c2253 46
okini3939 0:10bcaa7c2253 47 /* aliases for C library malloc() */
okini3939 0:10bcaa7c2253 48 #define mem_init()
okini3939 0:10bcaa7c2253 49 /* in case C library malloc() needs extra protection,
okini3939 0:10bcaa7c2253 50 * allow these defines to be overridden.
okini3939 0:10bcaa7c2253 51 */
okini3939 0:10bcaa7c2253 52 #ifndef mem_free
okini3939 0:10bcaa7c2253 53 #define mem_free free
okini3939 0:10bcaa7c2253 54 #endif
okini3939 0:10bcaa7c2253 55 #ifndef mem_malloc
okini3939 0:10bcaa7c2253 56 #define mem_malloc malloc
okini3939 0:10bcaa7c2253 57 #endif
okini3939 0:10bcaa7c2253 58 #ifndef mem_calloc
okini3939 0:10bcaa7c2253 59 #define mem_calloc calloc
okini3939 0:10bcaa7c2253 60 #endif
okini3939 0:10bcaa7c2253 61 /* Since there is no C library allocation function to shrink memory without
okini3939 0:10bcaa7c2253 62 moving it, define this to nothing. */
okini3939 0:10bcaa7c2253 63 #ifndef mem_trim
okini3939 0:10bcaa7c2253 64 #define mem_trim(mem, size) (mem)
okini3939 0:10bcaa7c2253 65 #endif
okini3939 0:10bcaa7c2253 66 #else /* MEM_LIBC_MALLOC */
okini3939 0:10bcaa7c2253 67
okini3939 0:10bcaa7c2253 68 /* MEM_SIZE would have to be aligned, but using 64000 here instead of
okini3939 0:10bcaa7c2253 69 * 65535 leaves some room for alignment...
okini3939 0:10bcaa7c2253 70 */
okini3939 0:10bcaa7c2253 71 #if MEM_SIZE > 64000l
okini3939 0:10bcaa7c2253 72 typedef u32_t mem_size_t;
okini3939 0:10bcaa7c2253 73 #define MEM_SIZE_F U32_F
okini3939 0:10bcaa7c2253 74 #else
okini3939 0:10bcaa7c2253 75 typedef u16_t mem_size_t;
okini3939 0:10bcaa7c2253 76 #define MEM_SIZE_F U16_F
okini3939 0:10bcaa7c2253 77 #endif /* MEM_SIZE > 64000 */
okini3939 0:10bcaa7c2253 78
okini3939 0:10bcaa7c2253 79 #if MEM_USE_POOLS
okini3939 0:10bcaa7c2253 80 /** mem_init is not used when using pools instead of a heap */
okini3939 0:10bcaa7c2253 81 #define mem_init()
okini3939 0:10bcaa7c2253 82 /** mem_trim is not used when using pools instead of a heap:
okini3939 0:10bcaa7c2253 83 we can't free part of a pool element and don't want to copy the rest */
okini3939 0:10bcaa7c2253 84 #define mem_trim(mem, size) (mem)
okini3939 0:10bcaa7c2253 85 #else /* MEM_USE_POOLS */
okini3939 0:10bcaa7c2253 86 /* lwIP alternative malloc */
okini3939 0:10bcaa7c2253 87 void mem_init(void);
okini3939 0:10bcaa7c2253 88 void *mem_trim(void *mem, mem_size_t size);
okini3939 0:10bcaa7c2253 89 #endif /* MEM_USE_POOLS */
okini3939 0:10bcaa7c2253 90 void *mem_malloc(mem_size_t size);
okini3939 0:10bcaa7c2253 91 void *mem_calloc(mem_size_t count, mem_size_t size);
okini3939 0:10bcaa7c2253 92 void mem_free(void *mem);
okini3939 0:10bcaa7c2253 93 #endif /* MEM_LIBC_MALLOC */
okini3939 0:10bcaa7c2253 94
okini3939 0:10bcaa7c2253 95 /** Calculate memory size for an aligned buffer - returns the next highest
okini3939 0:10bcaa7c2253 96 * multiple of MEM_ALIGNMENT (e.g. LWIP_MEM_ALIGN_SIZE(3) and
okini3939 0:10bcaa7c2253 97 * LWIP_MEM_ALIGN_SIZE(4) will both yield 4 for MEM_ALIGNMENT == 4).
okini3939 0:10bcaa7c2253 98 */
okini3939 0:10bcaa7c2253 99 #ifndef LWIP_MEM_ALIGN_SIZE
okini3939 0:10bcaa7c2253 100 #define LWIP_MEM_ALIGN_SIZE(size) (((size) + MEM_ALIGNMENT - 1) & ~(MEM_ALIGNMENT-1))
okini3939 0:10bcaa7c2253 101 #endif
okini3939 0:10bcaa7c2253 102
okini3939 0:10bcaa7c2253 103 /** Calculate safe memory size for an aligned buffer when using an unaligned
okini3939 0:10bcaa7c2253 104 * type as storage. This includes a safety-margin on (MEM_ALIGNMENT - 1) at the
okini3939 0:10bcaa7c2253 105 * start (e.g. if buffer is u8_t[] and actual data will be u32_t*)
okini3939 0:10bcaa7c2253 106 */
okini3939 0:10bcaa7c2253 107 #ifndef LWIP_MEM_ALIGN_BUFFER
okini3939 0:10bcaa7c2253 108 #define LWIP_MEM_ALIGN_BUFFER(size) (((size) + MEM_ALIGNMENT - 1))
okini3939 0:10bcaa7c2253 109 #endif
okini3939 0:10bcaa7c2253 110
okini3939 0:10bcaa7c2253 111 /** Align a memory pointer to the alignment defined by MEM_ALIGNMENT
okini3939 0:10bcaa7c2253 112 * so that ADDR % MEM_ALIGNMENT == 0
okini3939 0:10bcaa7c2253 113 */
okini3939 0:10bcaa7c2253 114 #ifndef LWIP_MEM_ALIGN
okini3939 0:10bcaa7c2253 115 #define LWIP_MEM_ALIGN(addr) ((void *)(((mem_ptr_t)(addr) + MEM_ALIGNMENT - 1) & ~(mem_ptr_t)(MEM_ALIGNMENT-1)))
okini3939 0:10bcaa7c2253 116 #endif
okini3939 0:10bcaa7c2253 117
okini3939 0:10bcaa7c2253 118 #ifdef __cplusplus
okini3939 0:10bcaa7c2253 119 }
okini3939 0:10bcaa7c2253 120 #endif
okini3939 0:10bcaa7c2253 121
okini3939 0:10bcaa7c2253 122 #endif /* __LWIP_MEM_H__ */