Mistake on this page?
Report an issue in GitHub or email us
TARGET_TFM/TARGET_TFM_V1_0/include/tfm_platform_api.h
1 /*
2  * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
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>
12 #include <stdbool.h>
13 #include <stdint.h>
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)
24 #define TFM_PLATFORM_API_VERSION_MINOR (3)
25 
26 #define TFM_PLATFORM_API_ID_NV_READ (1010)
27 #define TFM_PLATFORM_API_ID_NV_INCREMENT (1011)
28 
29 /*!
30  * \enum tfm_platform_err_t
31  *
32  * \brief Platform service error types
33  *
34  */
35 enum tfm_platform_err_t {
36  TFM_PLATFORM_ERR_SUCCESS = 0,
37  TFM_PLATFORM_ERR_SYSTEM_ERROR,
38  TFM_PLATFORM_ERR_INVALID_PARAM,
39  TFM_PLATFORM_ERR_NOT_SUPPORTED,
40 
41  /* Following entry is only to ensure the error code of int size */
42  TFM_PLATFORM_ERR_FORCE_INT_SIZE = INT_MAX
43 };
44 
45 typedef int32_t tfm_platform_ioctl_req_t;
46 
47 /*!
48  * \brief Resets the system.
49  *
50  * \return Returns values as specified by the \ref tfm_platform_err_t
51  */
52 enum tfm_platform_err_t tfm_platform_system_reset(void);
53 
54 /*!
55  * \brief Performs a platform-specific service
56  *
57  * \param[in] request Request identifier (valid values vary
58  * based on the platform)
59  * \param[in] input Input buffer to the requested service (or NULL)
60  * \param[in,out] output Output buffer to the requested service (or NULL)
61  *
62  * \return Returns values as specified by the \ref tfm_platform_err_t
63  */
64 enum tfm_platform_err_t tfm_platform_ioctl(tfm_platform_ioctl_req_t request,
65  psa_invec *input,
66  psa_outvec *output);
67 
68 /*!
69  * \brief Increments the given non-volatile (NV) counter by one
70  *
71  * \param[in] counter_id NV counter ID.
72  *
73  * \return TFM_PLATFORM_ERR_SUCCESS if the value is read correctly. Otherwise,
74  * it returns TFM_PLATFORM_ERR_SYSTEM_ERROR.
75  */
76 enum tfm_platform_err_t
77 tfm_platform_nv_counter_increment(uint32_t counter_id);
78 
79 /*!
80  * \brief Reads the given non-volatile (NV) counter
81  *
82  * \param[in] counter_id NV counter ID.
83  * \param[in] size Size of the buffer to store NV counter value
84  * in bytes.
85  * \param[out] val Pointer to store the current NV counter value.
86  *
87  * \return TFM_PLATFORM_ERR_SUCCESS if the value is read correctly. Otherwise,
88  * it returns TFM_PLATFORM_ERR_SYSTEM_ERROR.
89  */
90 enum tfm_platform_err_t
91 tfm_platform_nv_counter_read(uint32_t counter_id,
92  uint32_t size, uint8_t *val);
93 
94 #ifdef __cplusplus
95 }
96 #endif
97 
98 #endif /* __TFM_PLATFORM_API__ */
A writable output memory region provided to an RoT Service.
A read-only input memory region provided to an RoT Service.
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.