Marc Moreno Berengue | 8e0fa7a | 2018-10-04 18:25:13 +0100 | [diff] [blame] | 1 | /* |
Tamas Kaman | 262dc7b | 2019-03-20 13:37:12 +0100 | [diff] [blame] | 2 | * Copyright (c) 2018-2019, Arm Limited. All rights reserved. |
Marc Moreno Berengue | 8e0fa7a | 2018-10-04 18:25:13 +0100 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #ifndef __TFM_PLATFORM_API__ |
| 9 | #define __TFM_PLATFORM_API__ |
| 10 | |
| 11 | #include <limits.h> |
Tamas Kaman | 262dc7b | 2019-03-20 13:37:12 +0100 | [diff] [blame] | 12 | #include <stdbool.h> |
Miklos Balint | c7b1b6c | 2019-04-24 12:38:36 +0200 | [diff] [blame] | 13 | #include <stdint.h> |
Marc Moreno Berengue | 8e0fa7a | 2018-10-04 18:25:13 +0100 | [diff] [blame] | 14 | #include "tfm_api.h" |
| 15 | |
| 16 | #ifdef __cplusplus |
| 17 | extern "C" { |
| 18 | #endif |
| 19 | |
| 20 | /** |
| 21 | * \brief TFM secure partition platform API version |
| 22 | */ |
| 23 | #define TFM_PLATFORM_API_VERSION_MAJOR (0) |
Miklos Balint | c7b1b6c | 2019-04-24 12:38:36 +0200 | [diff] [blame] | 24 | #define TFM_PLATFORM_API_VERSION_MINOR (3) |
Marc Moreno Berengue | 8e0fa7a | 2018-10-04 18:25:13 +0100 | [diff] [blame] | 25 | |
Marc Moreno Berengue | 8e0fa7a | 2018-10-04 18:25:13 +0100 | [diff] [blame] | 26 | /*! |
| 27 | * \enum tfm_platform_err_t |
| 28 | * |
| 29 | * \brief Platform service error types |
| 30 | * |
| 31 | */ |
| 32 | enum tfm_platform_err_t { |
| 33 | TFM_PLATFORM_ERR_SUCCESS = 0, |
Mate Toth-Pal | 8af8b03 | 2019-07-18 10:49:00 +0200 | [diff] [blame^] | 34 | TFM_PLATFORM_ERR_SYSTEM_ERROR, |
Tamas Kaman | 262dc7b | 2019-03-20 13:37:12 +0100 | [diff] [blame] | 35 | TFM_PLATFORM_ERR_INVALID_PARAM, |
Miklos Balint | c7b1b6c | 2019-04-24 12:38:36 +0200 | [diff] [blame] | 36 | TFM_PLATFORM_ERR_NOT_SUPPORTED, |
Marc Moreno Berengue | 8e0fa7a | 2018-10-04 18:25:13 +0100 | [diff] [blame] | 37 | |
| 38 | /* Following entry is only to ensure the error code of int size */ |
| 39 | TFM_PLATFORM_ERR_FORCE_INT_SIZE = INT_MAX |
| 40 | }; |
| 41 | |
Miklos Balint | c7b1b6c | 2019-04-24 12:38:36 +0200 | [diff] [blame] | 42 | typedef int32_t tfm_platform_ioctl_req_t; |
| 43 | |
Marc Moreno Berengue | 8e0fa7a | 2018-10-04 18:25:13 +0100 | [diff] [blame] | 44 | /*! |
| 45 | * \brief Resets the system. |
| 46 | * |
| 47 | * \return Returns values as specified by the \ref tfm_platform_err_t |
| 48 | */ |
| 49 | enum tfm_platform_err_t tfm_platform_system_reset(void); |
| 50 | |
Tamas Kaman | 262dc7b | 2019-03-20 13:37:12 +0100 | [diff] [blame] | 51 | /*! |
Miklos Balint | c7b1b6c | 2019-04-24 12:38:36 +0200 | [diff] [blame] | 52 | * \brief Performs a platform-specific service |
Tamas Kaman | 262dc7b | 2019-03-20 13:37:12 +0100 | [diff] [blame] | 53 | * |
Miklos Balint | c7b1b6c | 2019-04-24 12:38:36 +0200 | [diff] [blame] | 54 | * \param[in] request Request identifier (valid values vary |
Tamas Kaman | 262dc7b | 2019-03-20 13:37:12 +0100 | [diff] [blame] | 55 | * based on the platform) |
Miklos Balint | c7b1b6c | 2019-04-24 12:38:36 +0200 | [diff] [blame] | 56 | * \param[in] input Input buffer to the requested service (or NULL) |
| 57 | * \param[in,out] output Output buffer to the requested service (or NULL) |
Tamas Kaman | 262dc7b | 2019-03-20 13:37:12 +0100 | [diff] [blame] | 58 | * |
| 59 | * \return Returns values as specified by the \ref tfm_platform_err_t |
| 60 | */ |
Miklos Balint | c7b1b6c | 2019-04-24 12:38:36 +0200 | [diff] [blame] | 61 | enum tfm_platform_err_t tfm_platform_ioctl(tfm_platform_ioctl_req_t request, |
| 62 | psa_invec *input, |
| 63 | psa_outvec *output); |
Tamas Kaman | 262dc7b | 2019-03-20 13:37:12 +0100 | [diff] [blame] | 64 | |
| 65 | |
Marc Moreno Berengue | 8e0fa7a | 2018-10-04 18:25:13 +0100 | [diff] [blame] | 66 | #ifdef __cplusplus |
| 67 | } |
| 68 | #endif |
| 69 | |
| 70 | #endif /* __TFM_PLATFORM_API__ */ |