Rtos API example

Embed: (wiki syntax)

« Back to documentation index

lwip_memp.c File Reference

lwip_memp.c File Reference

Dynamic pool memory manager. More...

Go to the source code of this file.

Functions

static int memp_sanity (const struct memp_desc *desc)
 Check that memp-lists don't form a circle, using "Floyd's cycle-finding algorithm".
static void memp_overflow_check_element_overflow (struct memp *p, const struct memp_desc *desc)
 Check if a memp element was victim of an overflow (e.g.
static void memp_overflow_check_element_underflow (struct memp *p, const struct memp_desc *desc)
 Check if a memp element was victim of an underflow (e.g.
static void memp_overflow_init_element (struct memp *p, const struct memp_desc *desc)
 Initialize the restricted area of on memp element.
static void memp_overflow_check_all (void)
 Do an overflow check for all elements in every pool.
void memp_init_pool (const struct memp_desc *desc)
 Initialize custom memory pool.
void memp_init (void)
 Initializes lwIP built-in pools.
void * memp_malloc_pool (const struct memp_desc *desc) memp_malloc_pool_fn(const struct memp_desc *desc
 Get an element from a custom pool.

Detailed Description

Dynamic pool memory manager.

lwIP has dedicated pools for many structures (netconn, protocol control blocks, packet buffers, ...). All these pools are managed here.

Definition in file lwip_memp.c.


Function Documentation

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 lwip_memp.c.

void memp_init_pool ( const struct memp_desc desc )

Initialize custom memory pool.

Related functions: memp_malloc_pool, memp_free_pool

Parameters:
descpool to initialize

Definition at line 230 of file lwip_memp.c.

void* memp_malloc_pool ( const struct memp_desc desc ) const

Get an element from a custom pool.

Parameters:
descthe pool to get an element from
Returns:
a pointer to the allocated memory or a NULL pointer on error
static void memp_overflow_check_all ( void   ) [static]

Do an overflow check for all elements in every pool.

See also:
memp_overflow_check_element for a description of the check

Definition at line 203 of file lwip_memp.c.

static void memp_overflow_check_element_overflow ( struct memp *  p,
const struct memp_desc desc 
) [static]

Check if a memp element was victim of an overflow (e.g.

the restricted area after it has been altered)

Parameters:
pthe memp element to check
descthe pool p comes from

Definition at line 128 of file lwip_memp.c.

static void memp_overflow_check_element_underflow ( struct memp *  p,
const struct memp_desc desc 
) [static]

Check if a memp element was victim of an underflow (e.g.

the restricted area before it has been altered)

Parameters:
pthe memp element to check
descthe pool p comes from

Definition at line 155 of file lwip_memp.c.

static void memp_overflow_init_element ( struct memp *  p,
const struct memp_desc desc 
) [static]

Initialize the restricted area of on memp element.

Definition at line 178 of file lwip_memp.c.

static int memp_sanity ( const struct memp_desc desc ) [static]

Check that memp-lists don't form a circle, using "Floyd's cycle-finding algorithm".

Definition at line 101 of file lwip_memp.c.