VSF Documented
|
#include "service/vsf_service_cfg.h"
#include "vsf_pool.h"
#include "hal/arch/vsf_arch.h"
#include "../heap/vsf_heap.h"
Data Structures | |
struct | __vsf_pool_node_t |
Macros | |
#define | __VSF_POOL_CLASS_IMPLEMENT |
#define | vsf_this (*this_ptr) |
#define | VSF_POOL_LOCK() vsf_this.region_ptr->enter() |
#define | VSF_POOL_UNLOCK() vsf_this.region_ptr->leave(orig) |
#define | __VSF_POOL_USE_DEFAULT_ATOM_ACCESS |
#define | VSF_POOL_CFG_SUPPORT_USER_ITEM_INIT ENABLED |
Typedefs | |
protected class __vsf_pool_node_t | |
typedef struct __vsf_pool_node_t | __vsf_pool_node_t |
Functions | |
void | vsf_pool_init (vsf_pool_t *obj_ptr, uint32_t item_size, uint_fast16_t align, vsf_pool_cfg_t *cfg_ptr) |
initialise target pool ! | |
bool | vsf_pool_add_buffer (vsf_pool_t *this_ptr, uintptr_t buffer_ptr, uint32_t buffer_size, uint32_t item_size) |
add memory to pool ! | |
bool | vsf_plug_in_on_failed_to_feed_pool_on_heap (vsf_pool_t *obj_ptr) |
uintptr_t | vsf_pool_alloc (vsf_pool_t *obj_ptr) |
try to fetch a memory block from the target pool ! | |
bool | vsf_pool_add_buffer_ex (vsf_pool_t *obj_ptr, uintptr_t buffer_ptr, uint32_t buffer_size, uint32_t item_size, vsf_pool_item_init_evt_handler_t *item_init_fn) |
add memory to pool ! | |
void | vsf_pool_free (vsf_pool_t *obj_ptr, uintptr_t pItem) |
return a memory block to the target pool ! | |
uint_fast16_t | vsf_pool_get_count (vsf_pool_t *obj_ptr) |
get the number of memory blocks available in the target pool ! | |
uintptr_t | vsf_pool_get_tag (vsf_pool_t *obj_ptr) |
get the address of the object which is attached to the pool ! | |
uintptr_t | vsf_pool_set_tag (vsf_pool_t *obj_ptr, uintptr_t target_ptr) |
set the address of the object which is attached to the pool ! | |
vsf_protect_region_t * | vsf_pool_get_region (vsf_pool_t *obj_ptr) |
get the address of the code region used by this pool ! | |
Variables | |
const i_pool_t | VSF_POOL |
#define __VSF_POOL_CLASS_IMPLEMENT |
#define vsf_this (*this_ptr) |
#define VSF_POOL_LOCK | ( | ) | vsf_this.region_ptr->enter() |
#define VSF_POOL_UNLOCK | ( | ) | vsf_this.region_ptr->leave(orig) |
#define __VSF_POOL_USE_DEFAULT_ATOM_ACCESS |
#define VSF_POOL_CFG_SUPPORT_USER_ITEM_INIT ENABLED |
typedef struct __vsf_pool_node_t __vsf_pool_node_t |
void vsf_pool_init | ( | vsf_pool_t * | obj_ptr, |
uint32_t | item_size, | ||
uint_fast16_t | align, | ||
vsf_pool_cfg_t * | cfg_ptr | ||
) |
initialise target pool !
this_ptr | address of the target pool ! |
cfg_ptr | configurations ! |
add pool to the pool list
bool vsf_pool_add_buffer | ( | vsf_pool_t * | this_ptr, |
uintptr_t | buffer_ptr, | ||
uint32_t | buffer_size, | ||
uint32_t | item_size | ||
) |
add memory to pool !
this_ptr | address of the target pool ! |
buffer_ptr | address of the target memory ! |
buffer_size | the size of the target memory ! |
item_size | memory block size of the pool ! |
false | the buffer size is too small or invalid parameters ! |
true | buffer is added |
bool vsf_plug_in_on_failed_to_feed_pool_on_heap | ( | vsf_pool_t * | obj_ptr | ) |
uintptr_t vsf_pool_alloc | ( | vsf_pool_t * | obj_ptr | ) |
try to fetch a memory block from the target pool !
this_ptr | address of the target pool ! |
NULL | the pool is empty ! |
!NULL | address of the allocated memory block |
feed on heap
bool vsf_pool_add_buffer_ex | ( | vsf_pool_t * | obj_ptr, |
uintptr_t | buffer_ptr, | ||
uint32_t | buffer_size, | ||
uint32_t | item_size, | ||
vsf_pool_item_init_evt_handler_t * | item_init_fn | ||
) |
add memory to pool !
this_ptr | address of the target pool ! |
buffer_ptr | address of the target memory ! |
buffer_size | the size of the target memory ! |
item_size | memory block size of the pool ! |
item_init_fn | block initialisation handler ! |
false | the buffer size is too small or invalid parameters ! |
true | buffer is added |
void vsf_pool_free | ( | vsf_pool_t * | obj_ptr, |
uintptr_t | pItem | ||
) |
return a memory block to the target pool !
this_ptr | address of the target pool ! |
pItem | target memory block ! |
uint_fast16_t vsf_pool_get_count | ( | vsf_pool_t * | obj_ptr | ) |
get the number of memory blocks available in the target pool !
this_ptr | address of the target pool ! |
uintptr_t vsf_pool_get_tag | ( | vsf_pool_t * | obj_ptr | ) |
get the address of the object which is attached to the pool !
this_ptr | address of the target pool ! |
set the address of the object which is attached to the pool !
this_ptr | address of the target pool ! |
vsf_protect_region_t * vsf_pool_get_region | ( | vsf_pool_t * | obj_ptr | ) |
get the address of the code region used by this pool !
this_ptr | address of the target pool ! |
const i_pool_t VSF_POOL |
vsf_slist_t pool_list |
uint16_t pool_cnt |