Secure Request Framework

| Secure Request Framework

API Reference | Macros | Functions
Secure Request IPC integration Initialization

## General Description

This library provides support for sending requests from an alternative core to the core with the secure paritition.

The non-secure partition acts as a relay to unpack the request sent over Infineon's interprocessor communication library (MTB-IPC) and submit it in the same way as other non-secure requests. The library also provides functionality to signal completion so the requesting core can view the results. This is accomplished through two roles: Client and Relay. The Client owns a pool of requests that are tied to IPC semaphores that will signal completion. The relay receives unpacks requests on the core containing the secure region before processing and signalling. This requires each of the contexts to be set up to create the relay relationship and begin submitting requests. Refer to SRF documentation Secure Request Framework for more information on secure requests and request pools. The APIs for submiting a request remain the same on all cores, but a client context must be set up on the core that needs IPC in order for the request to be sent correctly. Secure Request IPC integration provides an implementation of contexts and structures used to store states and signal information over Infineon's interprocessor communication library (MTB-IPC). These contexts signify the role each process plays in ensuring requests are safely submitted to the secure world. The implementation also provides a request struct for carrying necessary data and signalling back. These are stored in a pool, similar to SRF requests from the same core.

Refer to Code Snippets for more information.

## API Reference
| Data Structures

## Macros
#define | MTB_SRF_IPC_REQUEST_DATA_ALLOC(requests) do { CY_SECTION_SHAREDMEM static mtb_srf_ipc_packet_t _mtb_srf_ipc_request_arr[MTB_SRF_POOL_SIZE] _MTB_SRF_DATA_ALIGN; shared = &requests; } while (0)
| Macro for requests array shared memory allocation. More...

## Functions
cy_rslt_t | mtb_srf_ipc_pool_init (mtb_srf_ipc_pool_t *pool, mtb_srf_ipc_pool_cfg_t *cfg)
| Initializes an secure request pool instance. More...
cy_rslt_t | mtb_srf_setup_client_context (mtb_srf_ipc_client_context_t *client_context, mtb_srf_ipc_client_context_cfg_t *cfg)
| Initializes an secure request pool instance. More...
cy_rslt_t | mtb_srf_ipc_client_init (mtb_srf_ipc_client_context_t *context, mtb_srf_ipc_client_init_cfg_t *cfg)
| Initializes Semaphores, Mailbox, and sets up Client context This function requires that the IPC section of mtb_srf_config.h is populated and IPC instance in config struct is initialized. More...

## Macro Definition Documentation

## ◆ MTB_SRF_IPC_REQUEST_DATA_ALLOC

#define MTB_SRF_IPC_REQUEST_DATA_ALLOC | ( |  | requests | ) | do { CY_SECTION_SHAREDMEM static mtb_srf_ipc_packet_t _mtb_srf_ipc_request_arr[MTB_SRF_POOL_SIZE] _MTB_SRF_DATA_ALIGN; shared = &requests; } while (0)

Macro for requests array shared memory allocation.

It is not mandatory to use it for data allocation, user can allocate the memory in the more convenient for them way. Please refer to MTB SRF library documentation for the requirements for memory allocation if macro is not used.

Can be used only in function scope. Params: requests - mtb_srf_ipc_packet_t** , which will point to the shared memory

## Function Documentation

## ◆ mtb_srf_ipc_pool_init()

cy_rslt_t mtb_srf_ipc_pool_init | ( | mtb_srf_ipc_pool_t * | pool,
|  | mtb_srf_ipc_pool_cfg_t * | cfg
| ) |  |

Initializes an secure request pool instance.

See snippets for more details on how to configure an SRF IPC pool.

Parameters

  [in,out] | pool | Stores 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] | cfg | Config struct to set up IPC SRF pool. Please refer to code

Returns
  the status of the initialization

## ◆ mtb_srf_setup_client_context()

cy_rslt_t mtb_srf_setup_client_context | ( | mtb_srf_ipc_client_context_t * | client_context,
|  | mtb_srf_ipc_client_context_cfg_t * | cfg
| ) |  |

Initializes an secure request pool instance.

Parameters

  [in,out] | client_context | Stores state that client process needs to track between calls.
  [in] | cfg | Config containing items necessary for client communication

Returns
  the status of the initialization

## ◆ mtb_srf_ipc_client_init()

cy_rslt_t mtb_srf_ipc_client_init | ( | mtb_srf_ipc_client_context_t * | context,
|  | mtb_srf_ipc_client_init_cfg_t * | cfg
| ) |  |

Initializes Semaphores, Mailbox, and sets up Client context This function requires that the IPC section of mtb_srf_config.h is populated and IPC instance in config struct is initialized.

Parameters

  [in,out] | context | Client context to store all relevant MTB SRF IPC information
  [in] | cfg | Config struct containing allocated memory and data structures

Returns
  cy_rslt_t