ID the MBED processor on the network if you have more than one. View MBED name on DHCP of your Router - Example \"MBED PE\" Change your ID in Core / host.h

Committer:
JeffM
Date:
Sat Nov 06 14:11:02 2010 +0000
Revision:
0:fd3b85615428
MBED ID 1A

Who changed what in which revision?

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