blob: 32a04c5e73f18cf327673ada37d52625acd4cf37 [file] [log] [blame]
Antonio de Angelis05b24192019-07-04 15:28:46 +01001/*
Kevin Peng5ec79652021-01-27 10:01:31 +08002 * Copyright (c) 2017-2021, Arm Limited. All rights reserved.
BohdanHunkof871df02023-02-03 14:36:41 +02003 * Copyright (c) 2023 Cypress Semiconductor Corporation (an Infineon company)
4 * or an affiliate of Cypress Semiconductor Corporation. All rights reserved.
Antonio de Angelis05b24192019-07-04 15:28:46 +01005 *
6 * SPDX-License-Identifier: BSD-3-Clause
7 *
8 */
9#ifndef __TFM_NS_INTERFACE_H__
10#define __TFM_NS_INTERFACE_H__
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16#include <stdint.h>
Kevin Peng0e340ea2023-08-15 17:51:44 +080017#include "tfm_veneers.h"
Antonio de Angelis05b24192019-07-04 15:28:46 +010018
19typedef int32_t (*veneer_fn) (uint32_t arg0, uint32_t arg1,
20 uint32_t arg2, uint32_t arg3);
21
22/**
23 * \brief NS interface, veneer function dispatcher
24 *
25 * \details This function implements the dispatching mechanism for the
26 * desired veneer function, to be called with the parameters
27 * described from arg0 to arg3.
28 *
BohdanHunkof871df02023-02-03 14:36:41 +020029 * \note NSPE can use default implementation of this function or implement
30 * this function according to NS specific implementation and actual
31 * usage scenario.
David Huf07f3f12021-04-06 18:03:33 +080032 *
Antonio de Angelis05b24192019-07-04 15:28:46 +010033 * \param[in] fn Function pointer to the veneer function desired
David Huf07f3f12021-04-06 18:03:33 +080034 * \param[in] arg0 Argument 0 of fn
35 * \param[in] arg1 Argument 1 of fn
36 * \param[in] arg2 Argument 2 of fn
37 * \param[in] arg3 Argument 3 of fn
Antonio de Angelis05b24192019-07-04 15:28:46 +010038 *
39 * \return Returns the same return value of the requested veneer function
Kevin Peng5ec79652021-01-27 10:01:31 +080040 *
41 * \note This API must ensure the return value is from the veneer function.
42 * Other unrecoverable errors must be considered as fatal error and should
43 * not return.
Antonio de Angelis05b24192019-07-04 15:28:46 +010044 */
Kevin Pengc86dec02019-07-23 16:15:57 +080045int32_t tfm_ns_interface_dispatch(veneer_fn fn,
46 uint32_t arg0, uint32_t arg1,
47 uint32_t arg2, uint32_t arg3);
Antonio de Angelis05b24192019-07-04 15:28:46 +010048
BohdanHunkof871df02023-02-03 14:36:41 +020049/**
50 * \brief NS interface initialization function
51 *
52 * \details This function initializes TF-M NS interface.
53 *
54 * \note NSPE can use default implementation of this function or implement
55 * this function according to NS specific implementation and actual
56 * usage scenario.
57 *
58 * \return \ref OS_WRAPPER_SUCCESS on success or \ref OS_WRAPPER_ERROR on error
59 */
60uint32_t tfm_ns_interface_init(void);
61
Antonio de Angelis05b24192019-07-04 15:28:46 +010062#ifdef __cplusplus
63}
64#endif
65
66#endif /* __TFM_NS_INTERFACE_H__ */