1 /*
2  * Copyright (c) 2017-2021, Arm Limited. All rights reserved.
3  * Copyright (c) 2023 Cypress Semiconductor Corporation (an Infineon company)
4  * or an affiliate of Cypress Semiconductor Corporation. All rights reserved.
5  *
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
13 extern "C" {
14 #endif
15 
16 #include <stdint.h>
17 #include "tfm_veneers.h"
18 
19 typedef 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  *
29  * \note    NSPE can use default implementation of this function or implement
30  *          this function according to NS specific implementation and actual
31  *          usage scenario.
32  *
33  * \param[in] fn   Function pointer to the veneer function desired
34  * \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
38  *
39  * \return Returns the same return value of the requested veneer function
40  *
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.
44  */
45 int32_t tfm_ns_interface_dispatch(veneer_fn fn,
46                                   uint32_t arg0, uint32_t arg1,
47                                   uint32_t arg2, uint32_t arg3);
48 
49 /**
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  */
60 uint32_t tfm_ns_interface_init(void);
61 
62 #ifdef __cplusplus
63 }
64 #endif
65 
66 #endif /* __TFM_NS_INTERFACE_H__ */
67