1 /* 2 * Copyright (c) 2025 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"), 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 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 20 25 */ 26 27 /** 28 * @file tee_rtc_time_api.h 29 * 30 * @brief Provides APIs about rtc timer. 31 * 32 * @library NA 33 * @kit TEEKit 34 * @syscap SystemCapability.Tee.TeeClient 35 * @since 20 36 */ 37 38 #ifndef __TEE_RTC_TIME_API_H 39 #define __TEE_RTC_TIME_API_H 40 41 #include <stdint.h> 42 #include <tee_defines.h> 43 44 #ifdef __cplusplus 45 extern "C" { 46 #endif 47 48 /** 49 * @brief Create a secure timer. 50 * 51 * @param time_seconds Indicates the security duration. 52 * @param timer_property Indicates the property of the timer, where only need to specify the timer type. 53 * 54 * @return Returns <b>TEE_SUCCESS</b> if the operation is successful. 55 * @return Returns other values if the operation fails. 56 * 57 * @since 20 58 */ 59 TEE_Result tee_ext_create_timer(uint32_t time_seconds, TEE_timer_property *timer_property); 60 61 /** 62 * @brief Destory a secure timer. 63 * 64 * @param timer_property Indicates the property of the timer, where only need to specify the timer type. 65 * 66 * @return Returns <b>TEE_SUCCESS</b> if the operation is successful. 67 * @return Returns other values if the operation fails. 68 * 69 * @since 20 70 */ 71 TEE_Result tee_ext_destory_timer(TEE_timer_property *timer_property); 72 73 /** 74 * @brief Obtain the set timing duration. 75 * 76 * @param timer_property Indicates the property of the timer, where only need to specify the timer type. 77 * @param time_seconds Indicates the timing duration. 78 * 79 * @return Returns <b>TEE_SUCCESS</b> if the operation is successful. 80 * @return Returns other values if the operation fails. 81 * 82 * @since 20 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 20 96 */ 97 TEE_Result tee_ext_get_timer_remain(TEE_timer_property *timer_property, uint32_t *time_seconds); 98 99 /** 100 * @brief Obtain the current timing of the RTC clock. 101 * @attention The obtained time is in seconds and cannot be converted to universal time. 102 * 103 * @return The RTC clock count(in seconds). 104 * 105 * @since 20 106 */ 107 unsigned int tee_get_secure_rtc_time(void); 108 #ifdef __cplusplus 109 } 110 #endif 111 112 #endif 113 /** @} */