diff --git a/src/core/memp.c b/src/core/memp.c index 26bf5ff3..72f7a483 100644 --- a/src/core/memp.c +++ b/src/core/memp.c @@ -198,7 +198,12 @@ memp_overflow_init(const struct memp_desc *desc) } #endif /* MEMP_OVERFLOW_CHECK */ - +/** + * Initialize custom memory pool. + * Related functions: memp_malloc_pool, memp_free_pool + * + * @param desc pool to initialize + */ void memp_init_pool(const struct memp_desc *desc) { @@ -233,7 +238,8 @@ memp_init_pool(const struct memp_desc *desc) } /** - * Initialize this module. + * Initializes lwIP built-in pools. + * Related functions: memp_malloc, memp_free * * Carves out memp_memory into linked lists for each pool-type. */ @@ -257,6 +263,18 @@ memp_init(void) #endif /* MEMP_OVERFLOW_CHECK */ } + +/** + * Get an element from a custom pool. + * + * @param desc the pool to get an element from + * + * the debug version has two more parameters: + * @param file file name calling this function + * @param line number of line where this function is called + * + * @return a pointer to the allocated memory or a NULL pointer on error + */ void * #if !MEMP_OVERFLOW_CHECK memp_malloc_pool(const struct memp_desc *desc) @@ -391,6 +409,12 @@ do_memp_free_pool(const struct memp_desc* desc, void *mem) SYS_ARCH_UNPROTECT(old_level); } +/** + * Put a custom pool element back into its pool. + * + * @param desc the pool where to put mem + * @param mem the memp element to free + */ void memp_free_pool(const struct memp_desc* desc, void *mem) { diff --git a/src/include/lwip/arch.h b/src/include/lwip/arch.h index 07f4f063..372cea13 100644 --- a/src/include/lwip/arch.h +++ b/src/include/lwip/arch.h @@ -48,10 +48,10 @@ #include "arch/cc.h" /** Define this to 1 in arch/cc.h of your port if your compiler does not provide - * the stdint.h header. This cannot be #defined in lwipopts.h since + * the stdint.h header. This cannot be \#defined in lwipopts.h since * this is not an option of lwIP itself, but an option of the lwIP port * to your system. - * Additionally, this header is meant to be #included in lwipopts.h + * Additionally, this header is meant to be \#included in lwipopts.h * (you may need to declare function prototypes in there). */ #ifndef LWIP_NO_STDINT_H @@ -71,10 +71,10 @@ typedef uintptr_t mem_ptr_t; #endif /** Define this to 1 in arch/cc.h of your port if your compiler does not provide - * the inttypes.h header. This cannot be #defined in lwipopts.h since + * the inttypes.h header. This cannot be \#defined in lwipopts.h since * this is not an option of lwIP itself, but an option of the lwIP port * to your system. - * Additionally, this header is meant to be #included in lwipopts.h + * Additionally, this header is meant to be \#included in lwipopts.h * (you may need to declare function prototypes in there). */ #ifndef LWIP_NO_INTTYPES_H @@ -116,9 +116,9 @@ typedef uintptr_t mem_ptr_t; * trailing padding bytes (see LWIP_MEM_ALIGN_BUFFER) or your own section placement * requirements. * e.g. if you use gcc and need 32 bit alignment: - * #define LWIP_DECLARE_MEMORY_ALIGNED(variable_name, size) u8_t variable_name[size] __attribute__((aligned(4))) + * \#define LWIP_DECLARE_MEMORY_ALIGNED(variable_name, size) u8_t variable_name[size] __attribute__((aligned(4))) * or more portable: - * #define LWIP_DECLARE_MEMORY_ALIGNED(variable_name, size) u32_t variable_name[(size + sizeof(u32_t) - 1) / sizeof(u32_t)] + * \#define LWIP_DECLARE_MEMORY_ALIGNED(variable_name, size) u32_t variable_name[(size + sizeof(u32_t) - 1) / sizeof(u32_t)] */ #ifndef LWIP_DECLARE_MEMORY_ALIGNED #define LWIP_DECLARE_MEMORY_ALIGNED(variable_name, size) u8_t variable_name[LWIP_MEM_ALIGN_BUFFER(size)]