1 /* SPDX-License-Identifier: BSD-2-Clause */ 2 /* 3 * Copyright (C) 2022, Microchip 4 */ 5 #ifndef __PTA_RTC_H 6 #define __PTA_RTC_H 7 8 #include <tee_api_types.h> 9 10 #define PTA_RTC_UUID { 0xf389f8c8, 0x845f, 0x496c, \ 11 { 0x8b, 0xbe, 0xd6, 0x4b, 0xd2, 0x4c, 0x92, 0xfd } } 12 13 #define PTA_RTC_INFO_VERSION 0x1 14 15 /* 16 * RTC provides set/get offset and thus command PTA_CMD_RTC_GET_OFFSET and 17 * PTA_CMD_RTC_SET_OFFSET might be called 18 */ 19 #define PTA_RTC_FEATURE_CORRECTION BIT(0) 20 21 struct pta_rtc_time { 22 uint32_t tm_sec; 23 uint32_t tm_min; 24 uint32_t tm_hour; 25 uint32_t tm_mday; 26 uint32_t tm_mon; 27 uint32_t tm_year; 28 uint32_t tm_wday; 29 }; 30 31 /* 32 * struct pta_rtc_info - RTC service information 33 * @version - 1st 64bit cell, version of the structure: PTA_RTC_INFO_VERSION 34 * @features - 64bit flag mask related to PTA_RTC_FEATURE_* 35 * @range_min - Minima time reference the RTC can be programmed to 36 * @range_max - Maxima time reference the RTC can reach 37 */ 38 struct pta_rtc_info { 39 uint64_t version; 40 uint64_t features; 41 struct pta_rtc_time range_min; 42 struct pta_rtc_time range_max; 43 }; 44 45 /* 46 * PTA_CMD_RTC_GET_INFO - Get RTC information 47 * 48 * [out] memref[0] RTC buffer memory reference containing a struct 49 * pta_rtc_info 50 * 51 * Return codes: 52 * TEE_SUCCESS - Invoke command success 53 * TEE_ERROR_BAD_PARAMETERS - Incorrect input param 54 */ 55 #define PTA_CMD_RTC_GET_INFO 0x0 56 57 /* 58 * PTA_CMD_RTC_GET_TIME - Get time from RTC 59 * 60 * [out] memref[0] RTC buffer memory reference containing a struct 61 * pta_rtc_time 62 * 63 * Return codes: 64 * TEE_SUCCESS - Invoke command success 65 * TEE_ERROR_BAD_PARAMETERS - Incorrect input param 66 */ 67 #define PTA_CMD_RTC_GET_TIME 0x1 68 69 /* 70 * PTA_CMD_RTC_SET_TIME - Set time from RTC 71 * 72 * [in] memref[0] RTC buffer memory reference containing a struct 73 * pta_rtc_time to be used as RTC time 74 * 75 * Return codes: 76 * TEE_SUCCESS - Invoke command success 77 * TEE_ERROR_BAD_PARAMETERS - Incorrect input param 78 */ 79 #define PTA_CMD_RTC_SET_TIME 0x2 80 81 /* 82 * PTA_CMD_RTC_GET_OFFSET - Get RTC offset 83 * 84 * [out] value[0].a RTC offset (signed 32bit value) 85 * 86 * Return codes: 87 * TEE_SUCCESS - Invoke command success 88 * TEE_ERROR_BAD_PARAMETERS - Incorrect input param 89 */ 90 #define PTA_CMD_RTC_GET_OFFSET 0x3 91 92 /* 93 * PTA_CMD_RTC_SET_OFFSET - Set RTC offset 94 * 95 * [in] value[0].a RTC offset to be set (signed 32bit value) 96 * 97 * Return codes: 98 * TEE_SUCCESS - Invoke command success 99 * TEE_ERROR_BAD_PARAMETERS - Incorrect input param 100 */ 101 #define PTA_CMD_RTC_SET_OFFSET 0x4 102 103 #endif /* __PTA_RTC_H */ 104