Secure Request Framework
Loading...
Searching...
No Matches
Secure Request Pool Init ibrary

General Description

Pool initialization is split into its own header file.

This is because the pool is RTOS-aware. When an RTOS is present, the pool will adjust and use semaphores to ensure consistent behavior in a multi-threaded environment. The intention behind a separate header is to isolate this RTOS dependency, so not every asset which uses the SRF inherits the dependency. This file should be included only when initializing a request pool.

Refer to Secure Request Pool Library for more information.

API Reference

 Data Structures
 

Macros

#define MTB_SRF_POOL_ENTRY_SIZE(input_values_length, output_values_length)
 A tool to calculate how much memory to provide for a pool.

Functions

cy_rslt_t mtb_srf_pool_init (mtb_srf_pool_t *pool, uint32_t *allocated_mem, size_t num_entries, size_t input_len_per_entry, size_t output_len_per_entry)
 Initializes a secure request pool instance.

Macro Definition Documentation

◆ MTB_SRF_POOL_ENTRY_SIZE

#define MTB_SRF_POOL_ENTRY_SIZE ( input_values_length,
output_values_length )
Value:
(MTB_SRF_ROUND_UP(sizeof(mtb_srf_input_ns_t) + input_values_length, MTB_SRF_POOL_ALIGNMENT) + \
MTB_SRF_ROUND_UP(sizeof(mtb_srf_output_ns_t) + output_values_length, MTB_SRF_POOL_ALIGNMENT) + \
MTB_SRF_ROUND_UP((sizeof(mtb_srf_invec_ns_t) * MTB_SRF_MAX_IOVEC), MTB_SRF_POOL_ALIGNMENT) + \
#define MTB_SRF_POOL_ALIGNMENT
Address alignment value of pool in bytes.
Definition mtb_srf_pool.h:114
#define MTB_SRF_ROUND_UP(N, S)
Round up.
Definition mtb_srf_pool.h:107
#define MTB_SRF_MAX_IOVEC
Max number of vectors that can be provided to mtb_srf_request_submit.
Definition mtb_srf_iovec.h:59
An input structure.
Definition mtb_srf_iovec.h:81
An input vector - a section of memory to be used along with the length.
Definition mtb_srf_iovec.h:64
An input structure.
Definition mtb_srf_iovec.h:96
An output vector - a section of memory to be used along with the length.
Definition mtb_srf_iovec.h:71

A tool to calculate how much memory to provide for a pool.

Function Documentation

◆ mtb_srf_pool_init()

cy_rslt_t mtb_srf_pool_init ( mtb_srf_pool_t * pool,
uint32_t * allocated_mem,
size_t num_entries,
size_t input_len_per_entry,
size_t output_len_per_entry )

Initializes a secure request pool instance.

Parameters
[in,out]poolStores state that secure request pool needs to track between calls. The caller must allocate shared memory for this struct but should not depend on its contents.
[in]allocated_memPointer to a section of memory allocated by the caller for the pool to use. Recommend using (MTB_SRF_POOL_ENTRY_SIZE
  • num_entries) to calculate for custom pools
[in]num_entriesThe number of secure request objects that should fit into the pool
[in]input_len_per_entryThe length of input argument array. The default value is MTB_SRF_MAX_ARG_IN_SIZE
[in]output_len_per_entryThe length of output argument array. The default value is MTB_SRF_MAX_ARG_OUT_SIZE
Returns
the status of the initialization

Initializes a secure request pool instance.