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_TIME_API_H 14 #define __TEE_TIME_API_H 15 16 #include "tee_defines.h" 17 18 /* 19 * Get current TEE system rtc time 20 * 21 * @param time [OUT] current system rtc time 22 * @return void 23 */ 24 void get_sys_rtc_time(TEE_Time *time); 25 26 /* 27 * Get current TEE system time 28 * 29 * @param time [OUT] current system time 30 * @return void 31 */ 32 void TEE_GetSystemTime(TEE_Time *time); 33 34 /* 35 * Waits for the specified number of milliseconds 36 * 37 * @param timeout [IN] specified number of milliseconds 38 * 39 * @return TEE_SUCCESS success 40 * @return TEE_ERROR_CANCEL the wait has been cancelled 41 * @return TEE_ERROR_OUT_OF_MEMORY not enough memory is available to complete the operation 42 */ 43 TEE_Result TEE_Wait(uint32_t timeout); 44 45 /* 46 * Retrieves the persistent time of the Trusted Application 47 * 48 * @param time [IN] the persistent time of the Trusted Application 49 * 50 * @return TEE_SUCCESS success 51 * @return TEE_ERROR_TIME_NOT_SET the persistent time has not been set 52 * @return TEE_ERROR_TIME_NEEDS_RESET the persistent time has been set but may have been 53 * corrupted and MUST no longer be trusted 54 * @return TEE_ERROR_OVERFLOW the number of seconds in the TA Persistent Time overflows the range of a uint32_t 55 * @return TEE_ERROR_OUT_OF_MEMORY not enough memory is available to complete the operation 56 */ 57 TEE_Result TEE_GetTAPersistentTime(TEE_Time *time); 58 59 /* 60 * Set the persistent time of the current Trusted Application 61 * 62 * @param time [IN] the persistent time of the Trusted Application 63 * 64 * @return TEE_SUCCESS success 65 * @return TEE_ERROR_OUT_OF_MEMORY not enough memory is available to complete the operation 66 * @return TEE_ERROR_STORAGE_NO_SPACE insufficient storage space is available to complete the operation 67 */ 68 TEE_Result TEE_SetTAPersistentTime(TEE_Time *time); 69 70 /* 71 * Get current REE system time 72 * 73 * @param time [OUT] current REE system time 74 * @return void 75 */ 76 void TEE_GetREETime(TEE_Time *time); 77 #endif 78