TF-M Reference Manual  1.2.0
TrustedFirmware-M
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
tfm_api.h File Reference
#include <stdint.h>
#include "psa/client.h"
Include dependency graph for tfm_api.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  tfm_control_parameter_t
 

Macros

#define TFM_INVALID_CLIENT_ID   0
 
#define TFM_CLIENT_ID_IS_S(client_id)   ((client_id)>0)
 Checks if the provided client ID is a secure client ID. More...
 
#define TFM_CLIENT_ID_IS_NS(client_id)   ((client_id)<0)
 Checks if the provided client ID is a non-secure client ID. More...
 
#define PSA_TIMEOUT_MASK   PSA_BLOCK
 

Enumerations

enum  tfm_status_e {
  TFM_SUCCESS = 0, TFM_PARTITION_BUSY, TFM_ERROR_SECURE_DOMAIN_LOCKED, TFM_ERROR_INVALID_PARAMETER,
  TFM_ERROR_PARTITION_NON_REENTRANT, TFM_ERROR_NS_THREAD_MODE_CALL, TFM_ERROR_NOT_INITIALIZED, TFM_ERROR_NO_ACTIVE_PARTITION,
  TFM_ERROR_INVALID_EXC_MODE, TFM_SECURE_LOCK_FAILED, TFM_SECURE_UNLOCK_FAILED, TFM_ERROR_GENERIC = 0x1F
}
 

Functions

enum tfm_status_e tfm_register_client_id (int32_t ns_client_id)
 Assign client ID to the current TZ context. More...
 
uint32_t tfm_psa_framework_version_veneer (void)
 Retrieve the version of the PSA Framework API that is implemented. More...
 
uint32_t tfm_psa_version_veneer (uint32_t sid)
 Return version of secure function provided by secure binary. More...
 
psa_handle_t tfm_psa_connect_veneer (uint32_t sid, uint32_t version)
 Connect to secure function. More...
 
psa_status_t tfm_psa_call_veneer (psa_handle_t handle, const struct tfm_control_parameter_t *ctrl_param, const psa_invec *in_vec, psa_outvec *out_vec)
 Call a secure function referenced by a connection handle. More...
 
void tfm_psa_close_veneer (psa_handle_t handle)
 Close connection to secure function referenced by a connection handle. More...
 

Macro Definition Documentation

#define PSA_TIMEOUT_MASK   PSA_BLOCK

Definition at line 41 of file tfm_api.h.

#define TFM_CLIENT_ID_IS_NS (   client_id)    ((client_id)<0)

Checks if the provided client ID is a non-secure client ID.

Parameters
[in]client_idClient ID to check.
Return values
1Client ID is non-secure.
0Client ID is secure.

Definition at line 38 of file tfm_api.h.

#define TFM_CLIENT_ID_IS_S (   client_id)    ((client_id)>0)

Checks if the provided client ID is a secure client ID.

Parameters
[in]client_idClient ID to check.
Return values
1Client ID is secure.
0Client ID is non-secure.

Definition at line 28 of file tfm_api.h.

#define TFM_INVALID_CLIENT_ID   0

Definition at line 18 of file tfm_api.h.

Enumeration Type Documentation

Enumerator
TFM_SUCCESS 
TFM_PARTITION_BUSY 
TFM_ERROR_SECURE_DOMAIN_LOCKED 
TFM_ERROR_INVALID_PARAMETER 
TFM_ERROR_PARTITION_NON_REENTRANT 
TFM_ERROR_NS_THREAD_MODE_CALL 
TFM_ERROR_NOT_INITIALIZED 
TFM_ERROR_NO_ACTIVE_PARTITION 
TFM_ERROR_INVALID_EXC_MODE 
TFM_SECURE_LOCK_FAILED 
TFM_SECURE_UNLOCK_FAILED 
TFM_ERROR_GENERIC 

Definition at line 45 of file tfm_api.h.

Function Documentation

psa_status_t tfm_psa_call_veneer ( psa_handle_t  handle,
const struct tfm_control_parameter_t ctrl_param,
const psa_invec in_vec,
psa_outvec out_vec 
)

Call a secure function referenced by a connection handle.

Parameters
[in]handleHandle to connection.
[in]ctrl_paramParameter structure, includes request type, in_num and out_num.
[in]in_vecArray of input psa_invec structures.
[in,out]out_vecArray of output psa_outvec structures.
Returns
Returns psa_status_t status code.

Definition at line 52 of file tfm_psa_api_veneers.c.

Here is the caller graph for this function:

void tfm_psa_close_veneer ( psa_handle_t  handle)

Close connection to secure function referenced by a connection handle.

Parameters
[in]handleHandle to connection
Returns
void

Definition at line 63 of file tfm_psa_api_veneers.c.

Here is the caller graph for this function:

psa_handle_t tfm_psa_connect_veneer ( uint32_t  sid,
uint32_t  version 
)

Connect to secure function.

Parameters
[in]sidID of secure service.
[in]versionVersion of SF requested by client.
Returns
Returns handle to connection.

Definition at line 44 of file tfm_psa_api_veneers.c.

Here is the caller graph for this function:

uint32_t tfm_psa_framework_version_veneer ( void  )

Retrieve the version of the PSA Framework API that is implemented.

Returns
The version of the PSA Framework.

Definition at line 28 of file tfm_psa_api_veneers.c.

Here is the caller graph for this function:

uint32_t tfm_psa_version_veneer ( uint32_t  sid)

Return version of secure function provided by secure binary.

Parameters
[in]sidID of secure service.
Returns
Version number of secure function.

Definition at line 36 of file tfm_psa_api_veneers.c.

Here is the caller graph for this function:

enum tfm_status_e tfm_register_client_id ( int32_t  ns_client_id)

Assign client ID to the current TZ context.

Parameters
[in]ns_client_idThe client ID to be assigned to the current context.
Return values
TFM_SUCCESSThe client ID assigned successfully.
errorcode The client ID assignment failed, an error code returned according to tfm_status_e.
Note
This function have to be called from handler mode.