#define LWIP_MEMPOOL_DECLARE(name,num,size,desc) 前者是使用mem_malloc/mem_free实现内存池时使用,后者是单独实现时使用,我们重点关注后者。 其中LWIP_DECLARE_MEMORY_ALIGNED可以用户实现,如果用户未定义,arch.h默认是 #ifndef LWIP_DECLARE_MEMORY_ALIGNED 即定义了一个数组variable_name,其大小是LWIP_MEM_ALIGN_...
这里使用定义一个数组的方式实现 \LWIP_DECLARE_MEMORY_ALIGNED(memp_memory_ ## name ## _base, ((num) * (MEMP_SIZE + MEMP_ALIGN_SIZE(size))); \// 定义该内存池的内存统计数据结构 \LWIP_MEMPOOL_DECLARE_STATS_INSTANCE(memp_stats_ ## name) \// 定义该内存池链表指针 \static struct memp *m...
LWIP_DECLARE_MEMORY_ALIGNED(ram_heap, MEM_SIZE_ALIGNED+ (2U*SIZEOF_STRUCT_MEM));#defineLWIP_RAM_HEAP_POINTER ram_heap#endif//中间的宏的定义#ifndef LWIP_DECLARE_MEMORY_ALIGNED#defineLWIP_DECLARE_MEMORY_ALIGNED(variable_name, size) u8_t variable_name[LWIP_MEM_ALIGN_BUFFER(size)]#endif 其中ME...
LWIP_DECLARE_MEMORY_ALIGNED 实现如下 /** If you want to relocatethe heap to external memory,simply define 四.源码分析 4.1数据结构 核心数据结构如下struct mem /** * The heap is made up as a list of structs of this type. * This does not have to be aligned since for getting its size, ...
LWIP_DECLARE_MEMORY_ALIGNED(ram_heap, MEM_SIZE_ALIGNED+(2U*SIZEOF_STRUCT_MEM)); (5) #define LWIP_RAM_HEAP_POINTER ram_heap (6) /** pointer to the heap (ram_heap): for alignment, ram is now a pointer instead of an array */ ...
(struct raw_pcb),"RAW_PCB") 28 29 /* 通过转换后得到的结果,例子是RAW_PCB */ 30 LWIP_DECLARE_MEMORY_ALIGNED(memp_memory_RAW_PCB_base, 31 ((MEMP_NUM_RAW_PCB) * (MEMP_SIZE + MEMP_ALIGN_SIZE(sizeof(struct raw_pcb))); 32 33 LWIP_MEMPOOL_DECLARE_STATS_INSTANCE(memp_stats_RAW_PCB...
LWIP_DECLARE_MEMORY_ALIGNED(ram_heap, MEM_SIZE_ALIGNED + (2U * SIZEOF_STRUCT_MEM))__attribute__((section(".mcal_bss_no_cacheable"))); I also made sure that the Gmac_Ip_Cfg.o elements are placed in non_cachable RAM by building without -fdata-sections Current result is that pinging...
LWIP_DECLARE_MEMP_BASE_ALIGNED(name, ((num) * (MEMP_SIZE + MEMP_ALIGN_SIZE(size))); -#else /* USE_LIBOS */ +#else /* GAZELLE_ENABLE */ #define LWIP_MEMPOOL_DECLARE(name,num,size,desc) \ LWIP_DECLARE_MEMORY_ALIGNED(memp_memory_ ## name ## _base, ((num) * (MEMP_SIZE...
* LWIP_DECLARE_MEMORY_ALIGNED() may be used to declare aligned memory buffers (mem/memp) or to move buffers to dedicated memory using compiler attributes * Standard C headers are used to define sized types and printf formatters (disable by setting LWIP_NO_STDINT_H=1 or LWIP_NO_INTTYPES...
* @return a pointer to the allocated memory or a NULL pointer on error */ void* #if !MEMP_OVERFLOW_CHECK memp_malloc(memp_ttype) #else memp_malloc_fn(memp_ttype,constchar*file,constintline) #endif { void*memp; LWIP_ERROR("memp_malloc: type < MEMP_MAX", (type<MEMP_MAX),returnNU...