Lines Matching refs:memp

43 #include "lwip/memp.h"
66 struct memp {
67 struct memp *next;
100 /* MEMP_SIZE: save space for struct memp and for sanity check */
101 #define MEMP_SIZE (LWIP_MEM_ALIGN_SIZE(sizeof(struct memp)) + MEMP_SANITY_REGION_BEFORE_ALIGNED)
107 * We don't need to preserve the struct memp while not allocated, so we
117 static struct memp *memp_tab[MEMP_MAX];
179 * Check that memp-lists don't form a circle, using "Floyd's cycle-finding algorithm".
185 struct memp *t, *h;
210 * Check if a memp element was victim of an overflow
213 * @param p the memp element to check
217 memp_overflow_check_element_overflow(struct memp *p, u16_t memp_type)
225 char errstr[128] = "detected memp overflow in pool ";
243 * Check if a memp element was victim of an underflow
246 * @param p the memp element to check
250 memp_overflow_check_element_underflow(struct memp *p, u16_t memp_type)
258 char errstr[128] = "detected memp underflow in pool ";
284 struct memp *p;
286 p = (struct memp *)LWIP_MEM_ALIGN(memp_memory);
291 p = (struct memp*)((u8_t*)p + MEMP_SIZE + memp_sizes[i] + MEMP_SANITY_REGION_AFTER_ALIGNED);
294 p = (struct memp *)LWIP_MEM_ALIGN(memp_memory);
299 p = (struct memp*)((u8_t*)p + MEMP_SIZE + memp_sizes[i] + MEMP_SANITY_REGION_AFTER_ALIGNED);
305 * Initialize the restricted areas of all memp elements in every pool.
311 struct memp *p;
314 p = (struct memp *)LWIP_MEM_ALIGN(memp_memory);
326 p = (struct memp*)((u8_t*)p + MEMP_SIZE + memp_sizes[i] + MEMP_SANITY_REGION_AFTER_ALIGNED);
340 struct memp *memp;
351 memp = (struct memp *)LWIP_MEM_ALIGN(memp_memory);
357 memp = (struct memp*)memp_bases[i];
359 /* create a linked list of memp elements */
361 memp->next = memp_tab[i];
362 memp_tab[i] = memp;
363 memp = (struct memp *)(void *)((u8_t *)memp + MEMP_SIZE + memp_sizes[i]
395 struct memp *memp;
405 memp = memp_tab[type];
407 if (memp != NULL) {
408 memp_tab[type] = memp->next;
410 memp->next = NULL;
411 memp->file = file;
412 memp->line = line;
415 LWIP_ASSERT("memp_malloc: memp properly aligned",
416 ((mem_ptr_t)memp % MEM_ALIGNMENT) == 0);
417 memp = (struct memp*)(void *)((u8_t*)memp + MEMP_SIZE);
425 return memp;
432 * @param mem the memp element to free
437 struct memp *memp;
446 memp = (struct memp *)(void *)((u8_t*)mem - MEMP_SIZE);
453 memp_overflow_check_element_overflow(memp, type);
454 memp_overflow_check_element_underflow(memp, type);
460 memp->next = memp_tab[type];
461 memp_tab[type] = memp;
464 LWIP_ASSERT("memp sanity", memp_sanity());