17777dab0Sopenharmony_ci/* 27777dab0Sopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd. 37777dab0Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 47777dab0Sopenharmony_ci * you may not use this file except in compliance with the License. 57777dab0Sopenharmony_ci * You may obtain a copy of the License at 67777dab0Sopenharmony_ci * 77777dab0Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 87777dab0Sopenharmony_ci * 97777dab0Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 107777dab0Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 117777dab0Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 127777dab0Sopenharmony_ci * See the License for the specific language governing permissions and 137777dab0Sopenharmony_ci * limitations under the License. 147777dab0Sopenharmony_ci */ 157777dab0Sopenharmony_ci 167777dab0Sopenharmony_ci#ifndef __TEE_RTC_TIME_API_H 177777dab0Sopenharmony_ci#define __TEE_RTC_TIME_API_H 187777dab0Sopenharmony_ci 197777dab0Sopenharmony_ci/** 207777dab0Sopenharmony_ci * @addtogroup TeeTrusted 217777dab0Sopenharmony_ci * @{ 227777dab0Sopenharmony_ci * 237777dab0Sopenharmony_ci * @brief TEE(Trusted Excution Environment) API. 247777dab0Sopenharmony_ci * Provides security capability APIs such as trusted storage, encryption and decryption, 257777dab0Sopenharmony_ci * and trusted time for trusted application development. 267777dab0Sopenharmony_ci * 277777dab0Sopenharmony_ci * @since 12 287777dab0Sopenharmony_ci */ 297777dab0Sopenharmony_ci 307777dab0Sopenharmony_ci/** 317777dab0Sopenharmony_ci * @file tee_rtc_time_api.h 327777dab0Sopenharmony_ci * 337777dab0Sopenharmony_ci * @brief Provides APIs about rtc timer. 347777dab0Sopenharmony_ci * 357777dab0Sopenharmony_ci * @library NA 367777dab0Sopenharmony_ci * @kit TEEKit 377777dab0Sopenharmony_ci * @syscap SystemCapability.Tee.TeeClient 387777dab0Sopenharmony_ci * @since 12 397777dab0Sopenharmony_ci * @version 1.0 407777dab0Sopenharmony_ci */ 417777dab0Sopenharmony_ci 427777dab0Sopenharmony_ci#include <tee_defines.h> 437777dab0Sopenharmony_ci 447777dab0Sopenharmony_ci#ifdef __cplusplus 457777dab0Sopenharmony_ciextern "C" { 467777dab0Sopenharmony_ci#endif 477777dab0Sopenharmony_ci 487777dab0Sopenharmony_ci/** 497777dab0Sopenharmony_ci * @brief Create a secure timer. 507777dab0Sopenharmony_ci * 517777dab0Sopenharmony_ci * @param time_seconds Indicates the security duration. 527777dab0Sopenharmony_ci * @param timer_property Indicates the property of the timer, where only need to specify the timer type. 537777dab0Sopenharmony_ci * 547777dab0Sopenharmony_ci * @return Returns <b>TEE_SUCCESS</b> if the operation is successful. 557777dab0Sopenharmony_ci * @return Returns other values if the operation fails. 567777dab0Sopenharmony_ci * 577777dab0Sopenharmony_ci * @since 12 587777dab0Sopenharmony_ci * @version 1.0 597777dab0Sopenharmony_ci */ 607777dab0Sopenharmony_ciTEE_Result tee_ext_create_timer(uint32_t time_seconds, TEE_timer_property *timer_property); 617777dab0Sopenharmony_ci 627777dab0Sopenharmony_ci/** 637777dab0Sopenharmony_ci * @brief Destory a secure timer. 647777dab0Sopenharmony_ci * 657777dab0Sopenharmony_ci * @param timer_property Indicates the property of the timer, where only need to specify the timer type. 667777dab0Sopenharmony_ci * 677777dab0Sopenharmony_ci * @return Returns <b>TEE_SUCCESS</b> if the operation is successful. 687777dab0Sopenharmony_ci * @return Returns other values if the operation fails. 697777dab0Sopenharmony_ci * 707777dab0Sopenharmony_ci * @since 12 717777dab0Sopenharmony_ci * @version 1.0 727777dab0Sopenharmony_ci */ 737777dab0Sopenharmony_ciTEE_Result tee_ext_destory_timer(TEE_timer_property *timer_property); 747777dab0Sopenharmony_ci 757777dab0Sopenharmony_ci/** 767777dab0Sopenharmony_ci * @brief Obtain the set timing duration. 777777dab0Sopenharmony_ci * 787777dab0Sopenharmony_ci * @param timer_property Indicates the property of the timer, where only need to specify the timer type. 797777dab0Sopenharmony_ci * @param time_seconds Indicates the timing duration. 807777dab0Sopenharmony_ci * 817777dab0Sopenharmony_ci * @return Returns <b>TEE_SUCCESS</b> if the operation is successful. 827777dab0Sopenharmony_ci * @return Returns other values if the operation fails. 837777dab0Sopenharmony_ci * 847777dab0Sopenharmony_ci * @since 12 857777dab0Sopenharmony_ci * @version 1.0 867777dab0Sopenharmony_ci */ 877777dab0Sopenharmony_ciTEE_Result tee_ext_get_timer_expire(TEE_timer_property *timer_property, uint32_t *time_seconds); 887777dab0Sopenharmony_ci 897777dab0Sopenharmony_ci/** 907777dab0Sopenharmony_ci * @brief Obtain the remain timing duration. 917777dab0Sopenharmony_ci * 927777dab0Sopenharmony_ci * @param timer_property Indicates the property of the timer, where only need to specify the timer type. 937777dab0Sopenharmony_ci * @param time_seconds Indicates the remain timing duration. 947777dab0Sopenharmony_ci * 957777dab0Sopenharmony_ci * @return Returns <b>TEE_SUCCESS</b> if the operation is successful. 967777dab0Sopenharmony_ci * @return Returns other values if the operation fails. 977777dab0Sopenharmony_ci * 987777dab0Sopenharmony_ci * @since 12 997777dab0Sopenharmony_ci * @version 1.0 1007777dab0Sopenharmony_ci */ 1017777dab0Sopenharmony_ciTEE_Result tee_ext_get_timer_remain(TEE_timer_property *timer_property, uint32_t *time_seconds); 1027777dab0Sopenharmony_ci 1037777dab0Sopenharmony_ci/** 1047777dab0Sopenharmony_ci * @brief Obtain the current timing of the RTC clock. 1057777dab0Sopenharmony_ci * @attention The obtained time is in seconds and cannot be converted to universal time. 1067777dab0Sopenharmony_ci * 1077777dab0Sopenharmony_ci * @return The RTC clock count(in seconds). 1087777dab0Sopenharmony_ci * 1097777dab0Sopenharmony_ci * @since 12 1107777dab0Sopenharmony_ci * @version 1.0 1117777dab0Sopenharmony_ci */ 1127777dab0Sopenharmony_ciunsigned int tee_get_secure_rtc_time(void); 1137777dab0Sopenharmony_ci#ifdef __cplusplus 1147777dab0Sopenharmony_ci} 1157777dab0Sopenharmony_ci#endif 1167777dab0Sopenharmony_ci/** @} */ 1177777dab0Sopenharmony_ci#endif