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