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. |
Antonio de Angelis | 05b2419 | 2019-07-04 15:28:46 +0100 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | * |
| 6 | */ |
| 7 | #ifndef __TFM_NS_INTERFACE_H__ |
| 8 | #define __TFM_NS_INTERFACE_H__ |
| 9 | |
| 10 | #ifdef __cplusplus |
| 11 | extern "C" { |
| 12 | #endif |
| 13 | |
| 14 | #include <stdint.h> |
| 15 | #include "tfm_api.h" |
| 16 | |
| 17 | typedef int32_t (*veneer_fn) (uint32_t arg0, uint32_t arg1, |
| 18 | uint32_t arg2, uint32_t arg3); |
| 19 | |
| 20 | /** |
| 21 | * \brief NS interface, veneer function dispatcher |
| 22 | * |
| 23 | * \details This function implements the dispatching mechanism for the |
| 24 | * desired veneer function, to be called with the parameters |
| 25 | * described from arg0 to arg3. |
| 26 | * |
David Hu | f07f3f1 | 2021-04-06 18:03:33 +0800 | [diff] [blame^] | 27 | * \note NSPE shall implement this dispatcher according to NS specific |
| 28 | * implementation and actual usage scenario. |
| 29 | * |
Antonio de Angelis | 05b2419 | 2019-07-04 15:28:46 +0100 | [diff] [blame] | 30 | * \param[in] fn Function pointer to the veneer function desired |
David Hu | f07f3f1 | 2021-04-06 18:03:33 +0800 | [diff] [blame^] | 31 | * \param[in] arg0 Argument 0 of fn |
| 32 | * \param[in] arg1 Argument 1 of fn |
| 33 | * \param[in] arg2 Argument 2 of fn |
| 34 | * \param[in] arg3 Argument 3 of fn |
Antonio de Angelis | 05b2419 | 2019-07-04 15:28:46 +0100 | [diff] [blame] | 35 | * |
| 36 | * \return Returns the same return value of the requested veneer function |
Kevin Peng | 5ec7965 | 2021-01-27 10:01:31 +0800 | [diff] [blame] | 37 | * |
| 38 | * \note This API must ensure the return value is from the veneer function. |
| 39 | * Other unrecoverable errors must be considered as fatal error and should |
| 40 | * not return. |
Antonio de Angelis | 05b2419 | 2019-07-04 15:28:46 +0100 | [diff] [blame] | 41 | */ |
Kevin Peng | c86dec0 | 2019-07-23 16:15:57 +0800 | [diff] [blame] | 42 | int32_t tfm_ns_interface_dispatch(veneer_fn fn, |
| 43 | uint32_t arg0, uint32_t arg1, |
| 44 | uint32_t arg2, uint32_t arg3); |
Antonio de Angelis | 05b2419 | 2019-07-04 15:28:46 +0100 | [diff] [blame] | 45 | |
Antonio de Angelis | 05b2419 | 2019-07-04 15:28:46 +0100 | [diff] [blame] | 46 | #ifdef __cplusplus |
| 47 | } |
| 48 | #endif |
| 49 | |
| 50 | #endif /* __TFM_NS_INTERFACE_H__ */ |