Mistake on this page?
Report an issue in GitHub or email us
Public Member Functions
LWIPMemoryManager Class Referencefinal
Inheritance diagram for LWIPMemoryManager:
EMACMemoryManager NetStackMemoryManager

Public Member Functions

net_stack_mem_buf_t * alloc_heap (uint32_t size, uint32_t align) override
 Allocates memory buffer from the heap. More...
 
net_stack_mem_buf_t * alloc_pool (uint32_t size, uint32_t align) override
 Allocates memory buffer chain from a pool. More...
 
uint32_t get_pool_alloc_unit (uint32_t align) const override
 Get memory buffer pool allocation unit. More...
 
void free (net_stack_mem_buf_t *buf) override
 Free memory buffer chain. More...
 
uint32_t get_total_len (const net_stack_mem_buf_t *buf) const override
 Return total length of a memory buffer chain. More...
 
void copy (net_stack_mem_buf_t *to_buf, const net_stack_mem_buf_t *from_buf) override
 Copy a memory buffer chain. More...
 
void copy_to_buf (net_stack_mem_buf_t *to_buf, const void *ptr, uint32_t len) override
 Copy to a memory buffer chain. More...
 
uint32_t copy_from_buf (void *ptr, uint32_t len, const net_stack_mem_buf_t *from_buf) const override
 Copy from a memory buffer chain. More...
 
void cat (net_stack_mem_buf_t *to_buf, net_stack_mem_buf_t *cat_buf) override
 Concatenate two memory buffer chains. More...
 
net_stack_mem_buf_t * get_next (const net_stack_mem_buf_t *buf) const override
 Returns the next buffer. More...
 
void * get_ptr (const net_stack_mem_buf_t *buf) const override
 Return pointer to the payload of the buffer. More...
 
uint32_t get_len (const net_stack_mem_buf_t *buf) const override
 Return payload size of the buffer. More...
 
void set_len (net_stack_mem_buf_t *buf, uint32_t len) override
 Sets the payload size of the buffer. More...
 

Detailed Description

Definition at line 23 of file LWIPMemoryManager.h.

Member Function Documentation

net_stack_mem_buf_t* alloc_heap ( uint32_t  size,
uint32_t  align 
)
overridevirtual

Allocates memory buffer from the heap.

Memory buffer allocated from heap is always contiguous and can be arbitrary size.

Parameters
sizeSize of the memory to allocate in bytes
alignMemory alignment requirement in bytes
Returns
Allocated memory buffer, or NULL in case of error

Implements NetStackMemoryManager.

net_stack_mem_buf_t* alloc_pool ( uint32_t  size,
uint32_t  align 
)
overridevirtual

Allocates memory buffer chain from a pool.

Memory allocated from pool is contiguous if size is equal or less than (aligned) allocation unit, otherwise may be chained. Will typically come from fixed-size packet pool memory.

Parameters
sizeTotal size of the memory to allocate in bytes
alignMemory alignment requirement for each buffer in bytes
Returns
Allocated memory buffer chain, or NULL in case of error

Implements NetStackMemoryManager.

void cat ( net_stack_mem_buf_t *  to_buf,
net_stack_mem_buf_t *  cat_buf 
)
overridevirtual

Concatenate two memory buffer chains.

Concatenates buffer chain to end of the other buffer chain. Concatenated-to buffer total length is adjusted accordingly. cat_buf must point to the start of a the chain. After concatenation to_buf's chain now owns those buffers, and they will be freed when the to_buf chain is freed.

Parameters
to_bufMemory buffer chain to concatenate to
cat_bufMemory buffer chain to concatenate

Implements NetStackMemoryManager.

void copy ( net_stack_mem_buf_t *  to_buf,
const net_stack_mem_buf_t *  from_buf 
)
overridevirtual

Copy a memory buffer chain.

Copies data from one buffer chain to another. Copy operation does not adjust the lengths of the copied-to memory buffer chain, so chain total lengths must be the same.

Parameters
to_bufMemory buffer chain to copy to
from_bufMemory buffer chain to copy from

Implements NetStackMemoryManager.

uint32_t copy_from_buf ( void *  ptr,
uint32_t  len,
const net_stack_mem_buf_t *  from_buf 
) const
overridevirtual

Copy from a memory buffer chain.

Copies data from a memory buffer chain.

Parameters
lenData length
ptrPointer to data
from_bufMemory buffer chain to copy from
Returns
Length of the data that was copied

Reimplemented from NetStackMemoryManager.

void copy_to_buf ( net_stack_mem_buf_t *  to_buf,
const void *  ptr,
uint32_t  len 
)
overridevirtual

Copy to a memory buffer chain.

Copies data to a buffer chain. Copy operation does not adjust the lengths of the copied-to memory buffer chain, so chain total length must match the copied length.

Parameters
to_bufMemory buffer chain to copy to
ptrPointer to data
lenData length

Reimplemented from NetStackMemoryManager.

void free ( net_stack_mem_buf_t *  buf)
overridevirtual

Free memory buffer chain.

If memory buffer is chained must point to the start of the chain. Frees all buffers from the chained list.

Parameters
bufMemory buffer chain to be freed.

Implements NetStackMemoryManager.

uint32_t get_len ( const net_stack_mem_buf_t *  buf) const
overridevirtual

Return payload size of the buffer.

Parameters
bufMemory buffer
Returns
Size in bytes

Implements NetStackMemoryManager.

net_stack_mem_buf_t* get_next ( const net_stack_mem_buf_t *  buf) const
overridevirtual

Returns the next buffer.

Returns the next buffer from the memory buffer chain.

Parameters
bufMemory buffer
Returns
The next memory buffer, or NULL if last

Implements NetStackMemoryManager.

uint32_t get_pool_alloc_unit ( uint32_t  align) const
overridevirtual

Get memory buffer pool allocation unit.

Returns the maximum size of contiguous memory that can be allocated from a pool.

Parameters
alignMemory alignment requirement in bytes
Returns
Contiguous memory size

Implements NetStackMemoryManager.

void* get_ptr ( const net_stack_mem_buf_t *  buf) const
overridevirtual

Return pointer to the payload of the buffer.

Parameters
bufMemory buffer
Returns
Pointer to the payload

Implements NetStackMemoryManager.

uint32_t get_total_len ( const net_stack_mem_buf_t *  buf) const
overridevirtual

Return total length of a memory buffer chain.

Returns a total length of this buffer and any following buffers in the chain.

Parameters
bufMemory buffer chain
Returns
Total length in bytes

Implements NetStackMemoryManager.

void set_len ( net_stack_mem_buf_t *  buf,
uint32_t  len 
)
overridevirtual

Sets the payload size of the buffer.

The allocated payload size will not change. It is not permitted to change the length of a buffer that is not the first (or only) in a chain.

Parameters
bufMemory buffer
lenPayload size, must be less or equal allocated size

Implements NetStackMemoryManager.

Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.