Leest de waarde van een sensor binnen een maakt deze beschikbaar via internet

Dependencies:   NTPClient_NetServices mbed

Committer:
hendrikvincent
Date:
Mon Dec 02 09:01:23 2013 +0000
Revision:
0:05ccbd4f84f1
eerste programma;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
hendrikvincent 0:05ccbd4f84f1 1 /*
hendrikvincent 0:05ccbd4f84f1 2 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
hendrikvincent 0:05ccbd4f84f1 3 * All rights reserved.
hendrikvincent 0:05ccbd4f84f1 4 *
hendrikvincent 0:05ccbd4f84f1 5 * Redistribution and use in source and binary forms, with or without modification,
hendrikvincent 0:05ccbd4f84f1 6 * are permitted provided that the following conditions are met:
hendrikvincent 0:05ccbd4f84f1 7 *
hendrikvincent 0:05ccbd4f84f1 8 * 1. Redistributions of source code must retain the above copyright notice,
hendrikvincent 0:05ccbd4f84f1 9 * this list of conditions and the following disclaimer.
hendrikvincent 0:05ccbd4f84f1 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
hendrikvincent 0:05ccbd4f84f1 11 * this list of conditions and the following disclaimer in the documentation
hendrikvincent 0:05ccbd4f84f1 12 * and/or other materials provided with the distribution.
hendrikvincent 0:05ccbd4f84f1 13 * 3. The name of the author may not be used to endorse or promote products
hendrikvincent 0:05ccbd4f84f1 14 * derived from this software without specific prior written permission.
hendrikvincent 0:05ccbd4f84f1 15 *
hendrikvincent 0:05ccbd4f84f1 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
hendrikvincent 0:05ccbd4f84f1 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
hendrikvincent 0:05ccbd4f84f1 18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
hendrikvincent 0:05ccbd4f84f1 19 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
hendrikvincent 0:05ccbd4f84f1 20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
hendrikvincent 0:05ccbd4f84f1 21 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
hendrikvincent 0:05ccbd4f84f1 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
hendrikvincent 0:05ccbd4f84f1 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
hendrikvincent 0:05ccbd4f84f1 24 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
hendrikvincent 0:05ccbd4f84f1 25 * OF SUCH DAMAGE.
hendrikvincent 0:05ccbd4f84f1 26 *
hendrikvincent 0:05ccbd4f84f1 27 * This file is part of the lwIP TCP/IP stack.
hendrikvincent 0:05ccbd4f84f1 28 *
hendrikvincent 0:05ccbd4f84f1 29 * Author: Adam Dunkels <adam@sics.se>
hendrikvincent 0:05ccbd4f84f1 30 *
hendrikvincent 0:05ccbd4f84f1 31 */
hendrikvincent 0:05ccbd4f84f1 32 #ifndef __LWIP_MEM_H__
hendrikvincent 0:05ccbd4f84f1 33 #define __LWIP_MEM_H__
hendrikvincent 0:05ccbd4f84f1 34
hendrikvincent 0:05ccbd4f84f1 35 #include "lwip/opt.h"
hendrikvincent 0:05ccbd4f84f1 36
hendrikvincent 0:05ccbd4f84f1 37 #ifdef __cplusplus
hendrikvincent 0:05ccbd4f84f1 38 extern "C" {
hendrikvincent 0:05ccbd4f84f1 39 #endif
hendrikvincent 0:05ccbd4f84f1 40
hendrikvincent 0:05ccbd4f84f1 41 #if MEM_LIBC_MALLOC
hendrikvincent 0:05ccbd4f84f1 42
hendrikvincent 0:05ccbd4f84f1 43 #include <stddef.h> /* for size_t */
hendrikvincent 0:05ccbd4f84f1 44
hendrikvincent 0:05ccbd4f84f1 45 typedef size_t mem_size_t;
hendrikvincent 0:05ccbd4f84f1 46
hendrikvincent 0:05ccbd4f84f1 47 /* aliases for C library malloc() */
hendrikvincent 0:05ccbd4f84f1 48 #define mem_init()
hendrikvincent 0:05ccbd4f84f1 49 /* in case C library malloc() needs extra protection,
hendrikvincent 0:05ccbd4f84f1 50 * allow these defines to be overridden.
hendrikvincent 0:05ccbd4f84f1 51 */
hendrikvincent 0:05ccbd4f84f1 52 #ifndef mem_free
hendrikvincent 0:05ccbd4f84f1 53 #define mem_free free
hendrikvincent 0:05ccbd4f84f1 54 #endif
hendrikvincent 0:05ccbd4f84f1 55 #ifndef mem_malloc
hendrikvincent 0:05ccbd4f84f1 56 #define mem_malloc malloc
hendrikvincent 0:05ccbd4f84f1 57 #endif
hendrikvincent 0:05ccbd4f84f1 58 #ifndef mem_calloc
hendrikvincent 0:05ccbd4f84f1 59 #define mem_calloc calloc
hendrikvincent 0:05ccbd4f84f1 60 #endif
hendrikvincent 0:05ccbd4f84f1 61 /* Since there is no C library allocation function to shrink memory without
hendrikvincent 0:05ccbd4f84f1 62 moving it, define this to nothing. */
hendrikvincent 0:05ccbd4f84f1 63 #ifndef mem_trim
hendrikvincent 0:05ccbd4f84f1 64 #define mem_trim(mem, size) (mem)
hendrikvincent 0:05ccbd4f84f1 65 #endif
hendrikvincent 0:05ccbd4f84f1 66 #else /* MEM_LIBC_MALLOC */
hendrikvincent 0:05ccbd4f84f1 67
hendrikvincent 0:05ccbd4f84f1 68 /* MEM_SIZE would have to be aligned, but using 64000 here instead of
hendrikvincent 0:05ccbd4f84f1 69 * 65535 leaves some room for alignment...
hendrikvincent 0:05ccbd4f84f1 70 */
hendrikvincent 0:05ccbd4f84f1 71 #if MEM_SIZE > 64000l
hendrikvincent 0:05ccbd4f84f1 72 typedef u32_t mem_size_t;
hendrikvincent 0:05ccbd4f84f1 73 #define MEM_SIZE_F U32_F
hendrikvincent 0:05ccbd4f84f1 74 #else
hendrikvincent 0:05ccbd4f84f1 75 typedef u16_t mem_size_t;
hendrikvincent 0:05ccbd4f84f1 76 #define MEM_SIZE_F U16_F
hendrikvincent 0:05ccbd4f84f1 77 #endif /* MEM_SIZE > 64000 */
hendrikvincent 0:05ccbd4f84f1 78
hendrikvincent 0:05ccbd4f84f1 79 #if MEM_USE_POOLS
hendrikvincent 0:05ccbd4f84f1 80 /** mem_init is not used when using pools instead of a heap */
hendrikvincent 0:05ccbd4f84f1 81 #define mem_init()
hendrikvincent 0:05ccbd4f84f1 82 /** mem_trim is not used when using pools instead of a heap:
hendrikvincent 0:05ccbd4f84f1 83 we can't free part of a pool element and don't want to copy the rest */
hendrikvincent 0:05ccbd4f84f1 84 #define mem_trim(mem, size) (mem)
hendrikvincent 0:05ccbd4f84f1 85 #else /* MEM_USE_POOLS */
hendrikvincent 0:05ccbd4f84f1 86 /* lwIP alternative malloc */
hendrikvincent 0:05ccbd4f84f1 87 void mem_init(void);
hendrikvincent 0:05ccbd4f84f1 88 void *mem_trim(void *mem, mem_size_t size);
hendrikvincent 0:05ccbd4f84f1 89 #endif /* MEM_USE_POOLS */
hendrikvincent 0:05ccbd4f84f1 90 void *mem_malloc(mem_size_t size);
hendrikvincent 0:05ccbd4f84f1 91 void *mem_calloc(mem_size_t count, mem_size_t size);
hendrikvincent 0:05ccbd4f84f1 92 void mem_free(void *mem);
hendrikvincent 0:05ccbd4f84f1 93 #endif /* MEM_LIBC_MALLOC */
hendrikvincent 0:05ccbd4f84f1 94
hendrikvincent 0:05ccbd4f84f1 95 /** Calculate memory size for an aligned buffer - returns the next highest
hendrikvincent 0:05ccbd4f84f1 96 * multiple of MEM_ALIGNMENT (e.g. LWIP_MEM_ALIGN_SIZE(3) and
hendrikvincent 0:05ccbd4f84f1 97 * LWIP_MEM_ALIGN_SIZE(4) will both yield 4 for MEM_ALIGNMENT == 4).
hendrikvincent 0:05ccbd4f84f1 98 */
hendrikvincent 0:05ccbd4f84f1 99 #ifndef LWIP_MEM_ALIGN_SIZE
hendrikvincent 0:05ccbd4f84f1 100 #define LWIP_MEM_ALIGN_SIZE(size) (((size) + MEM_ALIGNMENT - 1) & ~(MEM_ALIGNMENT-1))
hendrikvincent 0:05ccbd4f84f1 101 #endif
hendrikvincent 0:05ccbd4f84f1 102
hendrikvincent 0:05ccbd4f84f1 103 /** Calculate safe memory size for an aligned buffer when using an unaligned
hendrikvincent 0:05ccbd4f84f1 104 * type as storage. This includes a safety-margin on (MEM_ALIGNMENT - 1) at the
hendrikvincent 0:05ccbd4f84f1 105 * start (e.g. if buffer is u8_t[] and actual data will be u32_t*)
hendrikvincent 0:05ccbd4f84f1 106 */
hendrikvincent 0:05ccbd4f84f1 107 #ifndef LWIP_MEM_ALIGN_BUFFER
hendrikvincent 0:05ccbd4f84f1 108 #define LWIP_MEM_ALIGN_BUFFER(size) (((size) + MEM_ALIGNMENT - 1))
hendrikvincent 0:05ccbd4f84f1 109 #endif
hendrikvincent 0:05ccbd4f84f1 110
hendrikvincent 0:05ccbd4f84f1 111 /** Align a memory pointer to the alignment defined by MEM_ALIGNMENT
hendrikvincent 0:05ccbd4f84f1 112 * so that ADDR % MEM_ALIGNMENT == 0
hendrikvincent 0:05ccbd4f84f1 113 */
hendrikvincent 0:05ccbd4f84f1 114 #ifndef LWIP_MEM_ALIGN
hendrikvincent 0:05ccbd4f84f1 115 #define LWIP_MEM_ALIGN(addr) ((void *)(((mem_ptr_t)(addr) + MEM_ALIGNMENT - 1) & ~(mem_ptr_t)(MEM_ALIGNMENT-1)))
hendrikvincent 0:05ccbd4f84f1 116 #endif
hendrikvincent 0:05ccbd4f84f1 117
hendrikvincent 0:05ccbd4f84f1 118 #ifdef __cplusplus
hendrikvincent 0:05ccbd4f84f1 119 }
hendrikvincent 0:05ccbd4f84f1 120 #endif
hendrikvincent 0:05ccbd4f84f1 121
hendrikvincent 0:05ccbd4f84f1 122 #endif /* __LWIP_MEM_H__ */