UbixOS  2.0
memp.h File Reference
#include <net/opt.h>
#include <net/priv/memp_std.h>
#include <net/priv/memp_priv.h>
#include <net/stats.h>
Include dependency graph for memp.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define LWIP_MEMPOOL(name, num, size, desc)
 
#define LWIP_MEMPOOL(name, num, size, desc)   MEMP_##name,
 
#define LWIP_MEMPOOL_ALLOC(name)   memp_malloc_pool(&memp_ ## name)
 
#define LWIP_MEMPOOL_DECLARE(name, num, size, desc)
 
#define LWIP_MEMPOOL_FREE(name, x)   memp_free_pool(&memp_ ## name, (x))
 
#define LWIP_MEMPOOL_INIT(name)   memp_init_pool(&memp_ ## name)
 
#define LWIP_MEMPOOL_PROTOTYPE(name)   extern const struct memp_desc memp_ ## name
 

Enumerations

enum  memp_t { MEMP_MAX }
 

Functions

void memp_free (memp_t type, void *mem)
 
void memp_init (void)
 
void * memp_malloc (memp_t type)
 

Variables

const struct memp_desc *const memp_pools [MEMP_MAX]
 

Detailed Description

Memory pool API

Definition in file memp.h.

Macro Definition Documentation

◆ LWIP_MEMPOOL [1/2]

#define LWIP_MEMPOOL (   name,
  num,
  size,
  desc 
)

Definition at line 53 of file memp.h.

◆ LWIP_MEMPOOL [2/2]

#define LWIP_MEMPOOL (   name,
  num,
  size,
  desc 
)    MEMP_##name,

Definition at line 53 of file memp.h.

Enumeration Type Documentation

◆ memp_t

enum memp_t

Create the list of all memory pools managed by memp. MEMP_MAX represents a NULL pool at the end

Enumerator
MEMP_MAX 

Definition at line 52 of file memp.h.

Function Documentation

◆ memp_free()

void memp_free ( memp_t  type,
void *  mem 
)

Put an element back into its pool.

Parameters
typethe pool where to put mem
memthe memp element to free

Definition at line 469 of file memp.c.

References LWIP_ERROR, MEMP_MAX, memp_pools, NULL, and memp_desc::tab.

Referenced by pbuf_free(), and tcpip_callbackmsg_delete().

◆ memp_init()

void memp_init ( void  )

Initializes lwIP built-in pools. Related functions: memp_malloc, memp_free

Carves out memp_memory into linked lists for each pool-type.

Definition at line 271 of file memp.c.

References LWIP_ARRAYSIZE, memp_init_pool(), and memp_pools.

Referenced by lwip_init().

Here is the call graph for this function:

◆ memp_malloc()

void* memp_malloc ( memp_t  type)

Get an element from a specific pool.

Parameters
typethe pool to get an element from
Returns
a pointer to the allocated memory or a NULL pointer on error

Definition at line 385 of file memp.c.

References LWIP_ERROR, MEMP_MAX, and NULL.

Referenced by pbuf_alloc(), and tcpip_callbackmsg_new().

Variable Documentation

◆ memp_pools

const struct memp_desc* const memp_pools[MEMP_MAX]

Definition at line 81 of file memp.c.

Referenced by memp_free(), and memp_init().