• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2010-2014, 2016 The Linux Foundation. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  *  * Redistributions of source code must retain the above copyright
7  *    notice, this list of conditions and the following disclaimer.
8  *  * Redistributions in binary form must reproduce the above copyright
9  *    notice, this list of conditions and the following disclaimer in the
10  *    documentation and/or other materials provided with the distribution.
11  *  * Neither the name of The Linux Foundation nor the names of its contributors
12  *    may be used to endorse or promote products derived from this software
13  *    without specific prior written permission.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18  * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
19  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  *
27  */
28 
29 #ifndef __TIME_GENOFF_H__
30 #define __TIME_GENOFF_H__
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 /*
37  * Time genoff base -- To be used by the time setter
38  * Reserved bases to be supported later.
39  */
40 typedef enum time_bases {
41 	ATS_RTC = 0,
42 	ATS_TOD,
43 	ATS_USER,
44 	ATS_SECURE,
45 	ATS_DRM,
46 	ATS_RESERVED_2,
47 	ATS_RESERVED_3,
48 	ATS_GPS,
49 	ATS_1X,
50 	ATS_RESERVED_4,
51 	ATS_WCDMA,
52 	ATS_SNTP,
53 	ATS_UTC,
54 	ATS_MODEM,
55 	ATS_MFLO,
56 	ATS_TOD_MODEM,
57 	ATS_WLAN,
58 	ATS_INVALID
59 } time_bases_type;
60 
61 /* Time unit -- Unit in which time is set/get */
62 typedef enum time_unit {
63 	TIME_STAMP,		/* Not supported */
64 	TIME_MSEC,
65 	TIME_SECS,
66 	TIME_JULIAN,
67 	TIME_20MS_FRAME,	/* Not supported */
68 	TIME_INVALID
69 } time_unit_type;
70 
71 /* Operation to be done */
72 typedef enum time_genoff_opr {
73 	T_SET,
74 	T_GET,
75 	T_IS_SET,
76 	T_DISABLE,
77 	T_ENABLE,
78 	T_MAX
79 } time_genoff_opr_type;
80 
81 /* Structure to be passed as argument to time_genoff_operation() */
82 /*
83  * In set/get: ts_val should be assigned memory and then passed.
84  * if time_unit = TIME_MSEC, TIME_SECS then ts_val = (uint64_t *)
85  * if time_unit = TIME_JULIAN then ts_val = (struct tm *)
86  */
87 typedef struct time_genoff_info {
88 	time_bases_type base;		/* Genoff in consideration */
89 	void *ts_val;			/* Time to be set/get */
90 	time_unit_type unit;		/* Time unit */
91 	time_genoff_opr_type operation; /* Time operation to be done */
92 }time_genoff_info_type;
93 
94 /* API to be called for time get/set operation */
95 int time_genoff_operation(time_genoff_info_type *pargs);
96 
97 /* API to be called for logging operations */
98 int time_control_operations(time_genoff_info_type *pargs);
99 
100 #ifdef __cplusplus
101 }
102 #endif
103 
104 #endif /* __TIME_GENOFF_H__ */
105