Antonio de Angelis | 05b2419 | 2019-07-04 15:28:46 +0100 | [diff] [blame] | 1 | /* |
Kevin Peng | 5ec7965 | 2021-01-27 10:01:31 +0800 | [diff] [blame] | 2 | * Copyright (c) 2017-2021, Arm Limited. All rights reserved. |
BohdanHunko | f871df0 | 2023-02-03 14:36:41 +0200 | [diff] [blame] | 3 | * Copyright (c) 2023 Cypress Semiconductor Corporation (an Infineon company) |
| 4 | * or an affiliate of Cypress Semiconductor Corporation. All rights reserved. |
Antonio de Angelis | 05b2419 | 2019-07-04 15:28:46 +0100 | [diff] [blame] | 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> |
Kevin Peng | 0e340ea | 2023-08-15 17:51:44 +0800 | [diff] [blame] | 17 | #include "tfm_veneers.h" |
Antonio de Angelis | 05b2419 | 2019-07-04 15:28:46 +0100 | [diff] [blame] | 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 | * |
BohdanHunko | f871df0 | 2023-02-03 14:36:41 +0200 | [diff] [blame] | 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. |
David Hu | f07f3f1 | 2021-04-06 18:03:33 +0800 | [diff] [blame] | 32 | * |
Antonio de Angelis | 05b2419 | 2019-07-04 15:28:46 +0100 | [diff] [blame] | 33 | * \param[in] fn Function pointer to the veneer function desired |
David Hu | f07f3f1 | 2021-04-06 18:03:33 +0800 | [diff] [blame] | 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 |
Antonio de Angelis | 05b2419 | 2019-07-04 15:28:46 +0100 | [diff] [blame] | 38 | * |
| 39 | * \return Returns the same return value of the requested veneer function |
Kevin Peng | 5ec7965 | 2021-01-27 10:01:31 +0800 | [diff] [blame] | 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. |
Antonio de Angelis | 05b2419 | 2019-07-04 15:28:46 +0100 | [diff] [blame] | 44 | */ |
Kevin Peng | c86dec0 | 2019-07-23 16:15:57 +0800 | [diff] [blame] | 45 | int32_t tfm_ns_interface_dispatch(veneer_fn fn, |
| 46 | uint32_t arg0, uint32_t arg1, |
| 47 | uint32_t arg2, uint32_t arg3); |
Antonio de Angelis | 05b2419 | 2019-07-04 15:28:46 +0100 | [diff] [blame] | 48 | |
BohdanHunko | f871df0 | 2023-02-03 14:36:41 +0200 | [diff] [blame] | 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 | |
Antonio de Angelis | 05b2419 | 2019-07-04 15:28:46 +0100 | [diff] [blame] | 62 | #ifdef __cplusplus |
| 63 | } |
| 64 | #endif |
| 65 | |
| 66 | #endif /* __TFM_NS_INTERFACE_H__ */ |