1/*
2 * Copyright (c) 2010-2014, 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
33extern "C" {
34#endif
35
36/*
37 * Time genoff base -- To be used by the time setter
38 * Reserved bases to be supported later.
39 */
40typedef enum time_bases {
41	ATS_RTC = 0,
42	ATS_TOD,
43	ATS_USER,
44	ATS_SECURE,
45	ATS_RESERVED_1,
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_INVALID
57} time_bases_type;
58
59/* Time unit -- Unit in which time is set/get */
60typedef enum time_unit {
61	TIME_STAMP,		/* Not supported */
62	TIME_MSEC,
63	TIME_SECS,
64	TIME_JULIAN,
65	TIME_20MS_FRAME,	/* Not supported */
66	TIME_INVALID
67} time_unit_type;
68
69/* Operation to be done */
70typedef enum time_genoff_opr {
71	T_SET,
72	T_GET,
73	T_IS_SET,
74	T_DISABLE,
75	T_ENABLE,
76	T_MAX
77} time_genoff_opr_type;
78
79/* Structure to be passed as argument to time_genoff_operation() */
80/*
81 * In set/get: ts_val should be assigned memory and then passed.
82 * if time_unit = TIME_MSEC, TIME_SECS then ts_val = (uint64_t *)
83 * if time_unit = TIME_JULIAN then ts_val = (struct tm *)
84 */
85typedef struct time_genoff_info {
86	time_bases_type base;		/* Genoff in consideration */
87	void *ts_val;			/* Time to be set/get */
88	time_unit_type unit;		/* Time unit */
89	time_genoff_opr_type operation; /* Time operation to be done */
90}time_genoff_info_type;
91
92/* API to be called for time get/set operation */
93int time_genoff_operation(time_genoff_info_type *pargs);
94
95/* API to be called for logging operations */
96int time_control_operations(time_genoff_info_type *pargs);
97
98#ifdef __cplusplus
99}
100#endif
101
102#endif /* __TIME_GENOFF_H__ */
103