Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers mem_priv.h Source File

mem_priv.h

Go to the documentation of this file.
00001 /**
00002  * @file
00003  * lwIP internal memory implementations (do not use in application code)
00004  */
00005 
00006 /*
00007  * Copyright (c) 2018 Swedish Institute of Computer Science.
00008  * All rights reserved.
00009  *
00010  * Redistribution and use in source and binary forms, with or without modification,
00011  * are permitted provided that the following conditions are met:
00012  *
00013  * 1. Redistributions of source code must retain the above copyright notice,
00014  *    this list of conditions and the following disclaimer.
00015  * 2. Redistributions in binary form must reproduce the above copyright notice,
00016  *    this list of conditions and the following disclaimer in the documentation
00017  *    and/or other materials provided with the distribution.
00018  * 3. The name of the author may not be used to endorse or promote products
00019  *    derived from this software without specific prior written permission.
00020  *
00021  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
00022  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00023  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
00024  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00025  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
00026  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00027  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00028  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
00029  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
00030  * OF SUCH DAMAGE.
00031  *
00032  * This file is part of the lwIP TCP/IP stack.
00033  *
00034  * Author: Simon Goldschmidt <goldsimon@gmx.de>
00035  *
00036  */
00037 
00038 #ifndef LWIP_HDR_MEM_PRIV_H
00039 #define LWIP_HDR_MEM_PRIV_H
00040 
00041 #include "lwip/opt.h"
00042 
00043 #ifdef __cplusplus
00044 extern "C" {
00045 #endif
00046 
00047 #include "lwip/mem.h"
00048 
00049 #if MEM_OVERFLOW_CHECK || MEMP_OVERFLOW_CHECK
00050 /* if MEM_OVERFLOW_CHECK or MEMP_OVERFLOW_CHECK is turned on, we reserve some
00051  * bytes at the beginning and at the end of each element, initialize them as
00052  * 0xcd and check them later.
00053  * If MEM(P)_OVERFLOW_CHECK is >= 2, on every call to mem(p)_malloc or mem(p)_free,
00054  * every single element in each pool/heap is checked!
00055  * This is VERY SLOW but also very helpful.
00056  * MEM_SANITY_REGION_BEFORE and MEM_SANITY_REGION_AFTER can be overridden in
00057  * lwipopts.h to change the amount reserved for checking. */
00058 #ifndef MEM_SANITY_REGION_BEFORE
00059 #define MEM_SANITY_REGION_BEFORE  16
00060 #endif /* MEM_SANITY_REGION_BEFORE*/
00061 #if MEM_SANITY_REGION_BEFORE > 0
00062 #define MEM_SANITY_REGION_BEFORE_ALIGNED    LWIP_MEM_ALIGN_SIZE(MEM_SANITY_REGION_BEFORE)
00063 #else
00064 #define MEM_SANITY_REGION_BEFORE_ALIGNED    0
00065 #endif /* MEM_SANITY_REGION_BEFORE*/
00066 #ifndef MEM_SANITY_REGION_AFTER
00067 #define MEM_SANITY_REGION_AFTER   16
00068 #endif /* MEM_SANITY_REGION_AFTER*/
00069 #if MEM_SANITY_REGION_AFTER > 0
00070 #define MEM_SANITY_REGION_AFTER_ALIGNED     LWIP_MEM_ALIGN_SIZE(MEM_SANITY_REGION_AFTER)
00071 #else
00072 #define MEM_SANITY_REGION_AFTER_ALIGNED     0
00073 #endif /* MEM_SANITY_REGION_AFTER*/
00074 
00075 void mem_overflow_init_raw(void *p, size_t size);
00076 void mem_overflow_check_raw(void *p, size_t size, const char *descr1, const char *descr2);
00077 
00078 #endif /* MEM_OVERFLOW_CHECK || MEMP_OVERFLOW_CHECK */
00079 
00080 #ifdef __cplusplus
00081 }
00082 #endif
00083 
00084 #endif /* LWIP_HDR_MEMP_PRIV_H */