7 #ifndef __TFM_POOLS_H__
8 #define __TFM_POOLS_H__
54 #define TFM_POOL_DECLARE(name, chunksz, num) \
55 static uint8_t name##_pool_buf[((chunksz) + \
56 sizeof(struct tfm_pool_chunk_t)) * (num) \
57 + sizeof(struct tfm_pool_instance_t)] \
58 __attribute__((aligned(4))); \
59 static struct tfm_pool_instance_t *name = \
60 (struct tfm_pool_instance_t *)name##_pool_buf
63 #define POOL_HEAD_SIZE (sizeof(struct tfm_pool_instance_t) + \
64 sizeof(struct tfm_pool_chunk_t))
67 #define POOL_BUFFER_SIZE(name) sizeof(name##_pool_buf)
82 size_t chunksz,
size_t num);
void tfm_pool_free(void *ptr)
Free the allocated memory.
struct tfm_list_node_t chunks_list
int32_t tfm_pool_init(struct tfm_pool_instance_t *pool, size_t poolsz, size_t chunksz, size_t num)
Register a memory pool.
void * tfm_pool_alloc(struct tfm_pool_instance_t *pool)
Allocate a memory from pool.
struct tfm_list_node_t list
struct tfm_list_node_t list
bool is_valid_chunk_data_in_pool(struct tfm_pool_instance_t *pool, uint8_t *data)
Checks whether a pointer points to a chunk data in the pool.
struct tfm_pool_chunk_s_t chunks[0]