TwitterExample with newer library (2012Aug)
Dependencies: EthernetNetIf HTTPClient mbed
EthernetNetIf/LPC1768/lwip/include/lwip/memp.h@0:075157567b0c, 2012-08-29 (annotated)
- Committer:
- nxpfan
- Date:
- Wed Aug 29 03:50:19 2012 +0000
- Revision:
- 0:075157567b0c
simple twitter example with newer library
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
nxpfan | 0:075157567b0c | 1 | /* |
nxpfan | 0:075157567b0c | 2 | * Copyright (c) 2001-2004 Swedish Institute of Computer Science. |
nxpfan | 0:075157567b0c | 3 | * All rights reserved. |
nxpfan | 0:075157567b0c | 4 | * |
nxpfan | 0:075157567b0c | 5 | * Redistribution and use in source and binary forms, with or without modification, |
nxpfan | 0:075157567b0c | 6 | * are permitted provided that the following conditions are met: |
nxpfan | 0:075157567b0c | 7 | * |
nxpfan | 0:075157567b0c | 8 | * 1. Redistributions of source code must retain the above copyright notice, |
nxpfan | 0:075157567b0c | 9 | * this list of conditions and the following disclaimer. |
nxpfan | 0:075157567b0c | 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
nxpfan | 0:075157567b0c | 11 | * this list of conditions and the following disclaimer in the documentation |
nxpfan | 0:075157567b0c | 12 | * and/or other materials provided with the distribution. |
nxpfan | 0:075157567b0c | 13 | * 3. The name of the author may not be used to endorse or promote products |
nxpfan | 0:075157567b0c | 14 | * derived from this software without specific prior written permission. |
nxpfan | 0:075157567b0c | 15 | * |
nxpfan | 0:075157567b0c | 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED |
nxpfan | 0:075157567b0c | 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
nxpfan | 0:075157567b0c | 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT |
nxpfan | 0:075157567b0c | 19 | * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
nxpfan | 0:075157567b0c | 20 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT |
nxpfan | 0:075157567b0c | 21 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
nxpfan | 0:075157567b0c | 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
nxpfan | 0:075157567b0c | 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
nxpfan | 0:075157567b0c | 24 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY |
nxpfan | 0:075157567b0c | 25 | * OF SUCH DAMAGE. |
nxpfan | 0:075157567b0c | 26 | * |
nxpfan | 0:075157567b0c | 27 | * This file is part of the lwIP TCP/IP stack. |
nxpfan | 0:075157567b0c | 28 | * |
nxpfan | 0:075157567b0c | 29 | * Author: Adam Dunkels <adam@sics.se> |
nxpfan | 0:075157567b0c | 30 | * |
nxpfan | 0:075157567b0c | 31 | */ |
nxpfan | 0:075157567b0c | 32 | |
nxpfan | 0:075157567b0c | 33 | #ifndef __LWIP_MEMP_H__ |
nxpfan | 0:075157567b0c | 34 | #define __LWIP_MEMP_H__ |
nxpfan | 0:075157567b0c | 35 | |
nxpfan | 0:075157567b0c | 36 | #include "lwip/opt.h" |
nxpfan | 0:075157567b0c | 37 | |
nxpfan | 0:075157567b0c | 38 | #ifdef __cplusplus |
nxpfan | 0:075157567b0c | 39 | extern "C" { |
nxpfan | 0:075157567b0c | 40 | #endif |
nxpfan | 0:075157567b0c | 41 | |
nxpfan | 0:075157567b0c | 42 | /* Create the list of all memory pools managed by memp. MEMP_MAX represents a NULL pool at the end */ |
nxpfan | 0:075157567b0c | 43 | typedef enum { |
nxpfan | 0:075157567b0c | 44 | #define LWIP_MEMPOOL(name,num,size,desc) MEMP_##name, |
nxpfan | 0:075157567b0c | 45 | #include "lwip/memp_std.h" |
nxpfan | 0:075157567b0c | 46 | MEMP_MAX |
nxpfan | 0:075157567b0c | 47 | } memp_t; |
nxpfan | 0:075157567b0c | 48 | |
nxpfan | 0:075157567b0c | 49 | #if MEM_USE_POOLS |
nxpfan | 0:075157567b0c | 50 | /* Use a helper type to get the start and end of the user "memory pools" for mem_malloc */ |
nxpfan | 0:075157567b0c | 51 | typedef enum { |
nxpfan | 0:075157567b0c | 52 | /* Get the first (via: |
nxpfan | 0:075157567b0c | 53 | MEMP_POOL_HELPER_START = ((u8_t) 1*MEMP_POOL_A + 0*MEMP_POOL_B + 0*MEMP_POOL_C + 0)*/ |
nxpfan | 0:075157567b0c | 54 | MEMP_POOL_HELPER_FIRST = ((u8_t) |
nxpfan | 0:075157567b0c | 55 | #define LWIP_MEMPOOL(name,num,size,desc) |
nxpfan | 0:075157567b0c | 56 | #define LWIP_MALLOC_MEMPOOL_START 1 |
nxpfan | 0:075157567b0c | 57 | #define LWIP_MALLOC_MEMPOOL(num, size) * MEMP_POOL_##size + 0 |
nxpfan | 0:075157567b0c | 58 | #define LWIP_MALLOC_MEMPOOL_END |
nxpfan | 0:075157567b0c | 59 | #include "lwip/memp_std.h" |
nxpfan | 0:075157567b0c | 60 | ) , |
nxpfan | 0:075157567b0c | 61 | /* Get the last (via: |
nxpfan | 0:075157567b0c | 62 | MEMP_POOL_HELPER_END = ((u8_t) 0 + MEMP_POOL_A*0 + MEMP_POOL_B*0 + MEMP_POOL_C*1) */ |
nxpfan | 0:075157567b0c | 63 | MEMP_POOL_HELPER_LAST = ((u8_t) |
nxpfan | 0:075157567b0c | 64 | #define LWIP_MEMPOOL(name,num,size,desc) |
nxpfan | 0:075157567b0c | 65 | #define LWIP_MALLOC_MEMPOOL_START |
nxpfan | 0:075157567b0c | 66 | #define LWIP_MALLOC_MEMPOOL(num, size) 0 + MEMP_POOL_##size * |
nxpfan | 0:075157567b0c | 67 | #define LWIP_MALLOC_MEMPOOL_END 1 |
nxpfan | 0:075157567b0c | 68 | #include "lwip/memp_std.h" |
nxpfan | 0:075157567b0c | 69 | ) |
nxpfan | 0:075157567b0c | 70 | } memp_pool_helper_t; |
nxpfan | 0:075157567b0c | 71 | |
nxpfan | 0:075157567b0c | 72 | /* The actual start and stop values are here (cast them over) |
nxpfan | 0:075157567b0c | 73 | We use this helper type and these defines so we can avoid using const memp_t values */ |
nxpfan | 0:075157567b0c | 74 | #define MEMP_POOL_FIRST ((memp_t) MEMP_POOL_HELPER_FIRST) |
nxpfan | 0:075157567b0c | 75 | #define MEMP_POOL_LAST ((memp_t) MEMP_POOL_HELPER_LAST) |
nxpfan | 0:075157567b0c | 76 | #endif /* MEM_USE_POOLS */ |
nxpfan | 0:075157567b0c | 77 | |
nxpfan | 0:075157567b0c | 78 | #if MEMP_MEM_MALLOC || MEM_USE_POOLS |
nxpfan | 0:075157567b0c | 79 | extern const u16_t memp_sizes[MEMP_MAX]; |
nxpfan | 0:075157567b0c | 80 | #endif /* MEMP_MEM_MALLOC || MEM_USE_POOLS */ |
nxpfan | 0:075157567b0c | 81 | |
nxpfan | 0:075157567b0c | 82 | #if MEMP_MEM_MALLOC |
nxpfan | 0:075157567b0c | 83 | |
nxpfan | 0:075157567b0c | 84 | #include "mem.h" |
nxpfan | 0:075157567b0c | 85 | |
nxpfan | 0:075157567b0c | 86 | #define memp_init() |
nxpfan | 0:075157567b0c | 87 | #define memp_malloc(type) mem_malloc(memp_sizes[type]) |
nxpfan | 0:075157567b0c | 88 | #define memp_free(type, mem) mem_free(mem) |
nxpfan | 0:075157567b0c | 89 | |
nxpfan | 0:075157567b0c | 90 | #else /* MEMP_MEM_MALLOC */ |
nxpfan | 0:075157567b0c | 91 | |
nxpfan | 0:075157567b0c | 92 | #if MEM_USE_POOLS |
nxpfan | 0:075157567b0c | 93 | /** This structure is used to save the pool one element came from. */ |
nxpfan | 0:075157567b0c | 94 | struct memp_malloc_helper |
nxpfan | 0:075157567b0c | 95 | { |
nxpfan | 0:075157567b0c | 96 | memp_t poolnr; |
nxpfan | 0:075157567b0c | 97 | }; |
nxpfan | 0:075157567b0c | 98 | #endif /* MEM_USE_POOLS */ |
nxpfan | 0:075157567b0c | 99 | |
nxpfan | 0:075157567b0c | 100 | void memp_init(void); |
nxpfan | 0:075157567b0c | 101 | |
nxpfan | 0:075157567b0c | 102 | #if MEMP_OVERFLOW_CHECK |
nxpfan | 0:075157567b0c | 103 | void *memp_malloc_fn(memp_t type, const char* file, const int line); |
nxpfan | 0:075157567b0c | 104 | #define memp_malloc(t) memp_malloc_fn((t), __FILE__, __LINE__) |
nxpfan | 0:075157567b0c | 105 | #else |
nxpfan | 0:075157567b0c | 106 | void *memp_malloc(memp_t type); |
nxpfan | 0:075157567b0c | 107 | #endif |
nxpfan | 0:075157567b0c | 108 | void memp_free(memp_t type, void *mem); |
nxpfan | 0:075157567b0c | 109 | |
nxpfan | 0:075157567b0c | 110 | #endif /* MEMP_MEM_MALLOC */ |
nxpfan | 0:075157567b0c | 111 | |
nxpfan | 0:075157567b0c | 112 | #ifdef __cplusplus |
nxpfan | 0:075157567b0c | 113 | } |
nxpfan | 0:075157567b0c | 114 | #endif |
nxpfan | 0:075157567b0c | 115 | |
nxpfan | 0:075157567b0c | 116 | #endif /* __LWIP_MEMP_H__ */ |