blob: 670750f6051b59ac2d6f3afae5184b86ac7f402d [file] [log] [blame]
yu.dongc33b3072024-08-21 23:14:49 -07001/*****************************************************************************
2* Copyright Statement:
3* --------------------
4* This software is protected by Copyright and the information contained
5* herein is confidential. The software may not be copied and the information
6* contained herein may not be used or disclosed except with the written
7* permission of MediaTek Inc. (C) 2016
8*
9* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
10* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS (""MEDIATEK SOFTWARE"")
11* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
12* AN ""AS-IS"" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
13* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
14* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
15* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
16* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
17* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
18* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
19* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
20* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
21*
22* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
23* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
24* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
25* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
26* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
27*
28* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
29* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
30* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
31* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
32* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
33*
34*****************************************************************************/
35/*************************************************************
36*
37* This Software is the property of VIA Telecom, Inc. and may only be used pursuant to a license from VIA Telecom, Inc.
38*
39* Any unauthorized use inconsistent with the terms of such license is strictly prohibited.
40*
41* Copyright (c) 2002-2011 VIA Telecom, Inc. All rights reserved.
42*
43*************************************************************/
44/*****************************************************************************
45
46 FILE NAME: monapi.h
47
48 DESCRIPTION:
49
50 This file contains all the constants, mail message definition and
51 function prototypes exported by the MON unit.
52
53*****************************************************************************/
54#ifndef MONAPI_H
55#define MONAPI_H
56
57#include "kal_public_defs.h"
58#include "sysapi.h"
59
60/*----------------------------------------------------------------------------
61 Defines Macros used in this file
62----------------------------------------------------------------------------*/
63
64/* NOTE: Empty all MonTrace */
65#define MonTrace(TraceId, ...)
66#define MonTraceInquire(TraceId) (KAL_TRUE)
67#define MonSpy(SpyId, ...)
68#define MonFault(Unit, Code1, Code2, Type)
69#define MON_DEEP_SLEEP_SW_LATENCY (17203) /* 350us + 1400us(for MML1_RF_POWER_ON), 17203=1750*8*1.2288*/
70
71
72
73/*----------------------------------------------------------------------------
74 Defines global variabls
75----------------------------------------------------------------------------*/
76extern const SysSFrameTimeT MonDeepSleepForeverTime;
77extern const SysSFrameTimeT MonDeepSleepFlightModeTime;
78
79#define SLEEP_FOREVER_TIME MonDeepSleepForeverTime
80#define FLIGHT_MODE_TIME MonDeepSleepFlightModeTime
81
82
83/*------------------------------------------------------------------------
84* Define typedefs used in MON API
85*------------------------------------------------------------------------*/
86
87/* Define fault halt/continue flag */
88typedef enum
89{
90 MON_CONTINUE = 0x00,
91 MON_HALT = 0x01
92} MonFaultTypeT;
93
94/* Define all unit fault code numbers */
95typedef enum
96{
97 MON_CP_FAULT_UNIT = 0x00,
98 MON_DBM_FAULT_UNIT = 0x01,
99 MON_EXE_FAULT_UNIT = 0x02,
100 MON_IPC_FAULT_UNIT = 0x03,
101 MON_IOP_FAULT_UNIT = 0x04,
102 MON_L1D_FAULT_UNIT = 0x05,
103 MON_LMD_FAULT_UNIT = 0x06,
104 MON_MON_FAULT_UNIT = 0x07,
105 MON_PSW_FAULT_UNIT = 0x08,
106 MON_HWD_FAULT_UNIT = 0x09,
107 MON_TST_FAULT_UNIT = 0x0A,
108 MON_VAL_FAULT_UNIT = 0x0B,
109 MON_SYS_FAULT_UNIT = 0x0C,
110 MON_RLP_FAULT_UNIT = 0x0D,
111 MON_HLP_FAULT_UNIT = 0x0E,
112 MON_MEDIA_FAULT_UNIT= 0x0F,
113 MON_UIM_FAULT_UNIT = 0x10,
114 MON_UI_FAULT_UNIT = 0x11,
115 MON_FSM_FAULT_UNIT = 0x12,
116 MON_CLC_FAULT_UNIT = 0x13,
117 MON_FCP_FAULT_UNIT = 0x14,
118 MON_HSC_FAULT_UNIT = 0x15,
119 MON_RMC_FAULT_UNIT = 0x16,
120 MON_RCP_FAULT_UNIT = 0x17,
121 MON_SLC_FAULT_UNIT = 0x18,
122 MON_CSS_FAULT_UNIT = 0x19,
123 MON_LEC_FAULT_UNIT = 0x1A,
124 MON_SEC_FAULT_UNIT = 0x1B,
125 MON_A2DP_FAULT_UNIT = 0x1C,
126 MON_AV_FAULT_UNIT = 0x1D,
127 MON_ETS_FAULT_UNIT = 0x1E,
128 MON_TLS_FAULT_UNIT = 0x1F,
129 MON_DM_FAULT_UNIT = 0x20,
130 MON_UNUSED_FAULT_UNIT = 0x21,
131 MON_MMC_FAULT_UNIT = 0x22,
132
133#if (defined(MTK_CBP) && (!defined(MTK_PLT_ON_PC)))
134 MON_FHC_FAULT_UNIT = 0x23,
135 MON_LOGIQ_FAULT_UNIT= 0x24,
136#endif
137
138#if (defined(MTK_PLT_AUDIO))
139 MON_VALSPH_FAULT_UNIT = 0x25,
140 MON_HWDSPH_FAULT_UNIT = 0x26,
141#endif // (defined(MTK_PLT_AUDIO))
142 MON_SBP_FAULT_UNIT = 0x27,
143 MON_NUM_FAULT_UNIT,
144
145 MON_CP_BOOT_FAULT_UNIT = 0x30, /* these 2 are only used by boot code and therefore */
146 MON_BOOT_FAULT_UNIT = 0x31 /* should not be accounted for in MON_NUM_FAULT_UNIT */
147
148} MonFaultUnitT;
149typedef enum
150{
151 MON_HWD_SLEEPOVER_FLAG = 0x00000001, /* HWD: for sleepover ISR */
152 MON_MD_DVFS_PEND = 0x00000002,
153 MON_RC_PEND_FLAG = 0x00000004, /*RC: for ongoing RC SQ*/
154 MON_META_MODE_FLAG = 0x00000008,
155 MON_CLR_EXTEND_SLOT = 0x00000010,
156 MON_CL1_TMG_CHG = 0x00000020,
157 MON_RAKE_SHDR_PROTECT = 0x00000040,
158 MON_CL1_RTBAW = 0x00000080,
159 MON_HSC_1X_MODEM_ACTIVE_FLAG = 0x00000100, /* HSC: for 1x modem activity */
160 MON_HSC_DO_MODEM_ACTIVE_FLAG = 0x00000200, /* HSC: for DO modem activity */
161 MON_GPS_SYNC_FLAG = 0x00000400, /* For GPS sync */
162 MON_FLAG_CAN_USE_6 = 0x00000800,
163 MON_1X_TIME_COPY_TO_DO_FLAG = 0x00001000,
164 MON_FLAG_CAN_USE_7 = 0x00002000,
165 MON_FLAG_CAN_USE_8 = 0x00004000,
166 MON_FLAG_CAN_USE_9 = 0x00008000,
167 MON_FLAG_CAN_USE_10 = 0x00010000,
168 MON_FLAG_CAN_USE_11 = 0x00020000,
169 MON_FLAG_CAN_USE_12 = 0x00040000,
170 MON_FLAG_CAN_USE_13 = 0x00080000,
171 MON_FLAG_CAN_USE_14 = 0x00100000,
172 MON_FLAG_CAN_USE_15 = 0x00200000,
173 MON_FLAG_CAN_USE_16 = 0x00400000,
174 MON_RMC_GM_GAP_FLAG = 0x00800000, /* RMCGM: For Idle/Conn Gap offered */
175 MON_FLAG_CAN_USE_17 = 0x01000000,
176 MON_FLAG_CAN_USE_18 = 0x02000000,
177 MON_FLAG_CAN_USE_19 = 0x04000000,
178 MON_SIB8_TIMING_RECOVER = 0x08000000,
179 MON_LEC_GPS_ACTIVITY_FLAG = 0x10000000, /* LEC: for GPS activity */
180 MON_WAKE_LOCK_TST = 0x20000000,
181 MON_HSC_EVSTANDBY_TIME_COPY = 0x40000000
182 /* don't use > 0x7FFF FFFF */
183} MonDeepSleepVetoT;
184
185typedef enum
186{
187 DEEP_SLEEP_NOT_ENABLE,
188 DEEP_SLEEP_NOT_REQ,
189 DEEP_SLEEP_SUSPENDED,
190 DEEP_SLEEP_DURATION_TOO_SMALL,
191 DEEP_SLEEP_MON_ALLOWED,
192 DEEP_SLEEP_NOT_ALL_QUE_EMPTY,
193 DEEP_SLEEP_NOT_EVT_QUE_EMPTY,
194 DEEP_SLEEP_NOT_MSG_QUE_EMPTY,
195 DEEP_SLEEP_CANCELLING,
196 DEEP_SLEEP_MARGIN_NOT_ENOUGH,
197 DEEP_SLEEP_ALLOWED,
198 DEEP_SLEEP_FH_IS_ONGOING
199}MonDeepSleepStatusT;
200
201extern kal_bool MonDeepSleepIsRequested(SysAirInterfaceT Interface);
202extern kal_bool MonDeepSleepForeverIsRequested(SysAirInterfaceT Interface);
203extern kal_bool MonDeepSleepFlightModeIsRequested(SysAirInterfaceT Interface);
204extern void MonDeepSleepCancel(SysAirInterfaceT Interface, kal_bool WakeCs);
205extern void MonShDeepSleepCancel( SysAirInterfaceT Interface);
206extern void MonDeepSleepRestoreRequest(SysAirInterfaceT Interface);
207extern void MonDeepSleepClearRequest(SysAirInterfaceT Interface);
208extern SysSFrameTimeT* MonDeepSleepGetWakeTime(SysAirInterfaceT Interface);
209extern kal_uint64 MonDeepSleepGetTillWakeTime(SysAirInterfaceT Interface);
210extern kal_bool MonDeepSleepIsPending(SysAirInterfaceT Interface);
211extern kal_uint32 MonDeepSleepGetVetoDeepSleep(SysAirInterfaceT Interface);
212extern void MonDeepSleepRequest(SysAirInterfaceT Interface, SysSFrameTimeT WakeTime);
213extern void MonShDeepSleepRequest(SysAirInterfaceT Interface, SysSFrameTimeT* WakeTime);
214extern void MonDeepSleepSuspend(SysAirInterfaceT Interface, MonDeepSleepVetoT BitMask);
215extern void MonShDeepSleepSuspend(SysAirInterfaceT Interface, MonDeepSleepVetoT BitMask);
216extern void MonDeepSleepResume(SysAirInterfaceT Interface, MonDeepSleepVetoT BitMask);
217extern void MonShDeepSleepResume(SysAirInterfaceT Interface, MonDeepSleepVetoT BitMask);
218extern kal_bool MonDeepSleepIsVetoed(SysAirInterfaceT Interface);
219extern kal_uint32 MonDeepSleepVetoMaskGet(SysAirInterfaceT Interface);
220extern MonDeepSleepStatusT MonDeepSleepEnter(SysAirInterfaceT Interface);
221extern void MonIdleSleepControl(kal_bool DeepEnable);
222extern void MonDeepSleepTakeSlpHandle(SysAirInterfaceT Interface);
223extern void MonDeepSleepGiveSlpHandle(SysAirInterfaceT Interface);
224extern void MonShDeepSleepSetStIntOffset(SysAirInterfaceT Interface);
225extern kal_uint32 MonShDeepSleepGetStIntOffset(SysAirInterfaceT Interface);
226extern kal_bool MonShDeepSleepStIntOffsetExist(SysAirInterfaceT Interface);
227#endif