Embedded Wireless Framework
Data Structures | Macros | Typedefs | Functions
ewf_allocator_memory_pool.h File Reference
#include "ewf_allocator.h"
#include "ewf_platform.h"

Go to the source code of this file.

Data Structures

struct  _ewf_allocator_memory_pool_block
 
struct  _ewf_allocator_memory_pool
 

Macros

#define EWF_ALLOCATOR_MEMORY_POOL_INITIALIZE_HEADER(allocator_ptr)
 
#define EWF_ALLOCATOR_MEMORY_POOL_STATIC_DECLARE__MUTEX(mutex_ptr, name_symb)
 
#define EWF_ALLOCATOR_MEMORY_POOL_STATIC_DECLARE(allocator_ptr, allocator_name_symb, block_count_param, block_size_param)
 Declare a memory pool allocator. More...
 

Typedefs

typedef struct _ewf_allocator_memory_pool_block ewf_allocator_memory_pool_block
 
typedef struct _ewf_allocator_memory_pool ewf_allocator_memory_pool
 

Functions

ewf_result ewf_allocator_memory_pool_start (ewf_allocator *allocator_ptr)
 
ewf_result ewf_allocator_memory_pool_stop (ewf_allocator *allocator_ptr)
 
ewf_result ewf_allocator_memory_pool_allocate (ewf_allocator *allocator_ptr, void **p)
 
ewf_result ewf_allocator_memory_pool_release (ewf_allocator *allocator_ptr, void *p)
 

Detailed Description

Version
Preview

The Embedded Wireless Framework memory pool allocator definition

Macro Definition Documentation

◆ EWF_ALLOCATOR_MEMORY_POOL_STATIC_DECLARE

#define EWF_ALLOCATOR_MEMORY_POOL_STATIC_DECLARE (   allocator_ptr,
  allocator_name_symb,
  block_count_param,
  block_size_param 
)
Value:
do { \
static ewf_allocator_memory_pool_block ewf_allocator_memory_pool__buffer__##allocator_name_symb[ \
((block_size_param > sizeof(ewf_allocator_memory_pool_block)) \
? (block_size_param) : sizeof(ewf_allocator_memory_pool_block)) \
* (block_count_param + 1)]; \
static struct _ewf_allocator_memory_pool ewf_allocator_memory_pool__##allocator_name_symb = {0}; \
static ewf_allocator ewf_allocator__##allocator_name_symb = {0}; \
ewf_allocator_memory_pool__##allocator_name_symb.pool_ptr = (uint8_t*) ewf_allocator_memory_pool__buffer__##allocator_name_symb; \
ewf_allocator_memory_pool__##allocator_name_symb.pool_size = sizeof(ewf_allocator_memory_pool__buffer__##allocator_name_symb); \
ewf_allocator_memory_pool__##allocator_name_symb.block_size = (uint32_t) block_size_param; \
EWF_ALLOCATOR_MEMORY_POOL_STATIC_DECLARE__MUTEX(ewf_allocator_memory_pool__##allocator_name_symb.mutex_ptr, allocator_name_symb); \
ewf_allocator__##allocator_name_symb.block_size = block_size_param; \
ewf_allocator__##allocator_name_symb.block_count = block_count_param; \
ewf_allocator__##allocator_name_symb.start = ewf_allocator_memory_pool_start; \
ewf_allocator__##allocator_name_symb.stop = ewf_allocator_memory_pool_stop; \
ewf_allocator__##allocator_name_symb.allocate = ewf_allocator_memory_pool_allocate; \
ewf_allocator__##allocator_name_symb.release = ewf_allocator_memory_pool_release; \
ewf_allocator__##allocator_name_symb.implementation_ptr = &(ewf_allocator_memory_pool__##allocator_name_symb); \
allocator_ptr = &(ewf_allocator__##allocator_name_symb); \
EWF_ALLOCATOR_MEMORY_POOL_INITIALIZE_HEADER(allocator_ptr); \
} while(0)
Definition: ewf_allocator_memory_pool.h:19
Definition: ewf_allocator_memory_pool.h:30
The allocator structure definition.
Definition: ewf_allocator.h:27

Declare a memory pool allocator.

Parameters
[in,out]allocator_ptra pointer to an allocator that will be initialized to point to the one statically declared by the macro
[in]allocator_name_symba unique symbol name that will be used as a name suffix for the statically declared data
[in]block_countthe number of blocks
[in]block_sizethe size of each block