• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 Huawei Technologies Co., Ltd.
3  * Licensed under the Mulan PSL v2.
4  * You can use this software according to the terms and conditions of the Mulan PSL v2.
5  * You may obtain a copy of Mulan PSL v2 at:
6  *     http://license.coscl.org.cn/MulanPSL2
7  * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
8  * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
9  * PURPOSE.
10  * See the Mulan PSL v2 for more details.
11  */
12 
13 #ifndef __TEE_RTC_TIME_API_H
14 #define __TEE_RTC_TIME_API_H
15 
16 /**
17  * @addtogroup TeeTrusted
18  * @{
19  *
20  * @brief TEE(Trusted Excution Environment) API.
21  * Provides security capability APIs such as trusted storage, encryption and decryption,
22  * and trusted time for trusted application development.
23  *
24  * @since 12
25  */
26 
27 /**
28  * @file tee_rtc_time_api.h
29  *
30  * @brief Provides APIs about rtc timer.
31  *
32  * @library NA
33  * @kit TEE Kit
34  * @syscap SystemCapability.Tee.TeeClient
35  * @since 12
36  * @version 1.0
37  */
38 
39 #include <tee_defines.h>
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 /**
46  * @brief Create a secure timer.
47  *
48  * @param time_seconds Indicates the security duration.
49  * @param timer_property Indicates the property of the timer, where only need to specify the timer type.
50  *
51  * @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
52  * @return Returns other values if the operation fails.
53  *
54  * @since 12
55  * @version 1.0
56  */
57 TEE_Result tee_ext_create_timer(uint32_t time_seconds, TEE_timer_property *timer_property);
58 
59 /**
60  * @brief Destory a secure timer.
61  *
62  * @param timer_property Indicates the property of the timer, where only need to specify the timer type.
63  *
64  * @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
65  * @return Returns other values if the operation fails.
66  *
67  * @since 12
68  * @version 1.0
69  */
70 TEE_Result tee_ext_destory_timer(TEE_timer_property *timer_property);
71 
72 /**
73  * @brief Obtain the set timing duration.
74  *
75  * @param timer_property Indicates the property of the timer, where only need to specify the timer type.
76  * @param time_seconds Indicates the timing duration.
77  *
78  * @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
79  * @return Returns other values if the operation fails.
80  *
81  * @since 12
82  * @version 1.0
83  */
84 TEE_Result tee_ext_get_timer_expire(TEE_timer_property *timer_property, uint32_t *time_seconds);
85 
86 /**
87  * @brief Obtain the remain timing duration.
88  *
89  * @param timer_property Indicates the property of the timer, where only need to specify the timer type.
90  * @param time_seconds Indicates the remain timing duration.
91  *
92  * @return Returns <b>TEE_SUCCESS</b> if the operation is successful.
93  * @return Returns other values if the operation fails.
94  *
95  * @since 12
96  * @version 1.0
97  */
98 TEE_Result tee_ext_get_timer_remain(TEE_timer_property *timer_property, uint32_t *time_seconds);
99 
100 /**
101  * @brief Obtain the current timing of the RTC clock.
102  * @attention The obtained time is in seconds and cannot be converted to universal time.
103  *
104  * @return The RTC clock count(in seconds).
105  *
106  * @since 12
107  * @version 1.0
108  */
109 unsigned int tee_get_secure_rtc_time(void);
110 #ifdef __cplusplus
111 }
112 #endif
113 /** @} */
114 #endif