TF-M Reference Manual  1.2.0
TrustedFirmware-M
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
tfm_pools.c File Reference
#include <inttypes.h>
#include <stdbool.h>
#include <stdlib.h>
#include "tfm_thread.h"
#include "tfm_wait.h"
#include "psa/client.h"
#include "psa/service.h"
#include "tfm_internal_defines.h"
#include "cmsis_compiler.h"
#include "utilities.h"
#include "tfm_list.h"
#include "tfm_pools.h"
#include "tfm_memory_utils.h"
#include "tfm_core_utils.h"
Include dependency graph for tfm_pools.c:

Go to the source code of this file.

Functions

int32_t tfm_pool_init (struct tfm_pool_instance_t *pool, size_t poolsz, size_t chunksz, size_t num)
 Register a memory pool. More...
 
void * tfm_pool_alloc (struct tfm_pool_instance_t *pool)
 Allocate a memory from pool. More...
 
void tfm_pool_free (void *ptr)
 Free the allocated memory. More...
 
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. More...
 

Function Documentation

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.

Parameters
[in]poolPointer to memory pool declared by TFM_POOL_DECLARE.
[in]dataThe pointer to check.
Return values
trueData is a chunk data in the pool.
falseData is not a chunk data in the pool.

Definition at line 90 of file tfm_pools.c.

Here is the caller graph for this function:

void* tfm_pool_alloc ( struct tfm_pool_instance_t pool)

Allocate a memory from pool.

Parameters
[in]poolpool pointer decleared by TFM_POOL_DECLARE
Return values
bufferpointer Success.
NULLFailed.

Definition at line 58 of file tfm_pools.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void tfm_pool_free ( void *  ptr)

Free the allocated memory.

Parameters
[in]ptrBuffer pointer want to free.

Definition at line 80 of file tfm_pools.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int32_t tfm_pool_init ( struct tfm_pool_instance_t pool,
size_t  poolsz,
size_t  chunksz,
size_t  num 
)

Register a memory pool.

Parameters
[in]poolPointer to memory pool declared by TFM_POOL_DECLARE
[in]poolszSize of the pool buffer.
[in]chunkszSize of chunks.
[in]numNumber of chunks.
Return values
IPC_SUCCESSSuccess.
IPC_ERROR_BAD_PARAMETERSParameters error.

Definition at line 22 of file tfm_pools.c.

Here is the call graph for this function:

Here is the caller graph for this function: