15 #include "cmsis_compiler.h"
23 size_t chunksz,
size_t num)
28 if (!pool || num == 0) {
45 for (i = 0; i < num; i++) {
93 const uintptr_t chunks_start = (uintptr_t)(pool->
chunks);
96 const uintptr_t chunks_end = chunks_start + chunks_size * chunk_count;
97 uintptr_t pool_chunk_address = 0;
100 if ((uintptr_t)data < chunks_start || (uintptr_t)data >= chunks_end) {
109 if ((pool_chunk_address - chunks_start) % chunks_size != 0) {
__STATIC_INLINE void tfm_list_del_node(struct tfm_list_node_t *node)
Delete one node from list.
void tfm_pool_free(void *ptr)
Free the allocated memory.
struct tfm_list_node_t chunks_list
void * tfm_pool_alloc(struct tfm_pool_instance_t *pool)
Allocate a memory from pool.
#define IPC_ERROR_BAD_PARAMETERS
__STATIC_INLINE struct tfm_list_node_t * tfm_list_first_node(struct tfm_list_node_t *head)
Retrieve the fist node from list.
void * spm_memset(void *s, int c, size_t n)
Memory set function for TF-M core.
int32_t tfm_pool_init(struct tfm_pool_instance_t *pool, size_t poolsz, size_t chunksz, size_t num)
Register a memory pool.
#define TFM_GET_CONTAINER_PTR(ptr, type, member)
struct tfm_list_node_t list
__STATIC_INLINE void tfm_list_init(struct tfm_list_node_t *head)
Initialize list head.
struct tfm_pool_chunk_s_t chunks[0]
__STATIC_INLINE int32_t tfm_list_is_empty(struct tfm_list_node_t *head)
Check if a list is empty.
__STATIC_INLINE void tfm_list_add_tail(struct tfm_list_node_t *head, struct tfm_list_node_t *node)
Add one node to list tail.
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.