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