blob: 64ac8c84f53d4184ae3d1158586769a0879351cf [file] [log] [blame]
rjw6c1fd8f2022-11-30 14:33:01 +08001/*****************************************************************************
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) 2005
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 *
38 * Filename:
39 * ---------
40 * l1_interface.h
41 *
42 * Project:
43 * --------
44 *
45 *
46 * Description:
47 * ------------
48 * Interface for system service.
49 *
50 * Author:
51 * -------
52 * -------
53 *
54 *------------------------------------------------------------------------------
55 * removed!
56 * removed!
57 * removed!
58 *
59 * removed!
60 * removed!
61 * removed!
62 * removed!
63 *
64 * removed!
65 * removed!
66 *
67 * removed!
68 * removed!
69 *
70 * removed!
71 * removed!
72 *
73 * removed!
74 * removed!
75 * removed!
76 *
77 * removed!
78 * removed!
79 *
80 *
81 * removed!
82 * removed!
83 *
84 * removed!
85 * removed!
86 *
87 * removed!
88 * removed!
89 *
90 * removed!
91 * removed!
92 *
93 * removed!
94 * removed!
95 *
96 * removed!
97 * removed!
98 * removed!
99 *
100 * removed!
101 * removed!
102 * removed!
103 *
104 * removed!
105 * removed!
106 *
107 * removed!
108 * removed!
109 * removed!
110 *
111 * removed!
112 * removed!
113 *
114 * removed!
115 * removed!
116 * removed!
117 *
118 * removed!
119 * removed!
120 * removed!
121 *
122 * removed!
123 * removed!
124 * removed!
125 *
126 * removed!
127 * removed!
128 * removed!
129 *
130 * removed!
131 * removed!
132 * removed!
133 *
134 * removed!
135 * removed!
136 * removed!
137 *
138 * removed!
139 * removed!
140 * removed!
141 *
142 * removed!
143 * removed!
144 * removed!
145 *
146 * removed!
147 * removed!
148 * removed!
149 *
150 * removed!
151 * removed!
152 * removed!
153 *
154 * removed!
155 * removed!
156 * removed!
157 *
158 * removed!
159 * removed!
160 * removed!
161 *
162 * removed!
163 * removed!
164 * removed!
165 *
166 * removed!
167 * removed!
168 *
169 * removed!
170 * removed!
171 * removed!
172 *
173 * removed!
174 * removed!
175 * removed!
176 *
177 * removed!
178 * removed!
179 * removed!
180 *
181 * removed!
182 * removed!
183 * removed!
184 *
185 * removed!
186 * removed!
187 * removed!
188 *
189 * removed!
190 * removed!
191 * removed!
192 *
193 * removed!
194 * removed!
195 * removed!
196 *
197 * removed!
198 * removed!
199 * removed!
200 *
201 * removed!
202 * removed!
203 * removed!
204 * removed!
205 * removed!
206 * removed!
207 * removed!
208 *
209 * removed!
210 * removed!
211 * removed!
212 *
213 * removed!
214 * removed!
215 * removed!
216 *
217 * removed!
218 * removed!
219 * removed!
220 *
221 * removed!
222 * removed!
223 * removed!
224 *
225 * removed!
226 * removed!
227 * removed!
228 *
229 * removed!
230 * removed!
231 * removed!
232 *
233 * removed!
234 * removed!
235 * removed!
236 *
237 * removed!
238 * removed!
239 * removed!
240 *
241 * removed!
242 * removed!
243 * removed!
244 *
245 * removed!
246 * removed!
247 * removed!
248 *
249 * removed!
250 * removed!
251 * removed!
252 *
253 * removed!
254 * removed!
255 * removed!
256 *
257 * removed!
258 * removed!
259 * removed!
260 *
261 * removed!
262 * removed!
263 * removed!
264 *
265 * removed!
266 * removed!
267 * removed!
268 *
269 * removed!
270 * removed!
271 * removed!
272 *
273 * removed!
274 * removed!
275 * removed!
276 *
277 * removed!
278 * removed!
279 * removed!
280 *
281 * removed!
282 * removed!
283 *
284 *
285 * removed!
286 * removed!
287 *
288 *
289 * removed!
290 * removed!
291 *
292 *
293 * removed!
294 * removed!
295 *
296 *
297 * removed!
298 * removed!
299 *
300 *
301 * removed!
302 * removed!
303 *
304 *
305 * removed!
306 * removed!
307 *
308 *
309 * removed!
310 * removed!
311 *
312 *
313 * removed!
314 * removed!
315 * removed!
316 *
317 * removed!
318 * removed!
319 *
320 *
321 * removed!
322 * removed!
323 * removed!
324 *
325 * removed!
326 * removed!
327 *
328 *
329 * removed!
330 * removed!
331 *
332 *
333 * removed!
334 * removed!
335 * removed!
336 *
337 * removed!
338 * removed!
339 *
340 *
341 * removed!
342 * removed!
343 *
344 *
345 *******************************************************************************/
346
347#ifndef _L1_INTERFACE_H_
348#define _L1_INTERFACE_H_
349/* ------------------------------------------------------------------------- */
350
351#include "kal_general_types.h"
352
353/* ------------------------------------------------------------------------- */
354/* --- Simulation Compile Option-------------------------------------------- */
355/* ------------------------------------------------------------------------- */
356#if defined (__UE_SIMULATOR__)
357#define MD_DRV_SIMULATION_SUPPORT 1
358#define MD_DRV_HARDWARE_SIMULATION 1
359#else
360 #if !defined(ESIM_BUILD_CONFIG) || (ESIM_BUILD_CONFIG == ESIM_MULTI_MODE_ON_FIBERS) || (ESIM_BUILD_CONFIG == ESIM_SINGLE_MODE_ON_FIBERS)
361 #if !defined(__MTK_TARGET__) && !defined(__UL1_ON_MNT__) && !defined(GEN_FOR_PC) && defined(L1_SIM)
362#define MD_DRV_SIMULATION_SUPPORT 1
363#define MD_DRV_HARDWARE_SIMULATION 1
364 #else
365#define MD_DRV_SIMULATION_SUPPORT 0
366#define MD_DRV_HARDWARE_SIMULATION 0
367 #endif /* __MTK_TARGET__ */
368 #endif /* __ESIM_BUILD_CONFIG__ */
369#endif /* __UE_SIMULATOR__ */
370
371/* ------------------------------------------------------------------------- */
372/* --- hardware access ----------------------------------------------------- */
373/* ------------------------------------------------------------------------- */
374#if defined(HW_WRITE)
375#undef HW_WRITE
376#endif
377#if defined(HW_READ)
378#undef HW_READ
379#endif
380
381#if defined(L1_SIM) || defined(__UE_SIMULATOR__)
382 #if MD_DRV_HARDWARE_SIMULATION == 1
383void RegSimSimulateWrite( int adr, int data, int size, const char* file, int line );
384 #if defined(__UE_SIMULATOR__)
385int RegSimSimulateRead(int adr, int size, const char* cur_file, int line);
386#define HW_READ(ptr) RegSimSimulateRead( (int)(ptr), sizeof(*(ptr)), __FILE__, __LINE__)
387 #else
388int RegSimSimulateRead(int adr, int size, const char* cur_file, int line, int cosim_flag);
389#ifndef HW_READ
390#define HW_READ(ptr) RegSimSimulateRead( (int)(ptr), sizeof(*(ptr)), __FILE__, __LINE__, 0 )
391 #endif
392#endif
393#define HW_WRITE(ptr,data) RegSimSimulateWrite( (int)(ptr), (data), sizeof(*(ptr)), __FILE__, __LINE__ )
394 #else
395#define HW_WRITE(ptr,data) (*(ptr) = (data))
396#define HW_READ(ptr) (*(ptr))
397 #endif
398#else /* defined(L1_SIM) || defined(__UE_SIMULATOR__) */
399#define HW_WRITE(ptr,data) (*(ptr) = (data))
400#define HW_READ(ptr) (*(ptr))
401#endif /* defined(L1_SIM) || defined(__UE_SIMULATOR__) */
402
403/* ------------------------------------------------------------------------- */
404/* --- Processor Simulation Time ------------------------------------------- */
405/* ------------------------------------------------------------------------- */
406#if !defined(__GET_CATCHER_DB__)
407 #if MD_DRV_SIMULATION_SUPPORT
408 #ifdef INTEGER_SIM_TIME
409 void ProcSimConsumeProcessorTime2(kal_uint64 tts);
410#define LET_SIM_TIME_RUN_A_BIT() ProcSimConsumeProcessorTime2(10000000000000)// 13 MHz : Raymond, changed from 768000000000 to 10000000000000 (1us)
411#define LET_SIM_TIME_RUN_N_QBIT(n) ProcSimConsumeProcessorTime2(9216000000000*n)
412 #else // INTEGER_SIM_TIME
413 void ProcSimConsumeProcessorTime(double seconds);
414#define LET_SIM_TIME_RUN_A_BIT() ProcSimConsumeProcessorTime(0.077e-6) // 13 MHz
415#define LET_SIM_TIME_RUN_N_QBIT(n) ProcSimConsumeProcessorTime2((0.077e-6)*12*n)
416 #endif // INTEGER_SIM_TIME
417 #else /* SIMULATION_SUPPORT */
418#define LET_SIM_TIME_RUN_A_BIT()
419#define LET_SIM_TIME_RUN_N_QBIT(n)
420 #endif /* SIMULATION_SUPPORT */
421#endif /* __GET_CATCHER_DB__ */
422/* ------------------------------------------------------------------------- */
423
424//DECLARE_SHARED_VAR( kal_uint16, GL1D_L1_ASSERT_BYPASS )
425extern kal_uint16 GL1D_L1_ASSERT_BYPASS;
426
427extern void L1D_HW_TDMA_AUX_TIME_SETUP( kal_uint16 event0, kal_uint16 event1 );
428extern kal_uint16 L1D_TDMA_GET_TQCNT( void );
429extern kal_uint16 L1D_HW_TDMA_GET_TQWRAP( void );
430extern unsigned char L1D_Get_RX_Status( void );
431extern unsigned char L1D_Get_BandCapability( void );
432
433/*************************************************************************
434 * API provided for other modules
435 *************************************************************************/
436#if (defined L1_NOT_PRESENT)
437#define L1_CHECK_ASSERT_BYPASS() (0)
438#define L1D_GET_GGE_RX_STATUS() (0)
439#else
440#define L1_CHECK_ASSERT_BYPASS() (GL1D_L1_ASSERT_BYPASS & 0x3)
441#define L1D_GET_GGE_RX_STATUS() L1D_Get_RX_Status()
442#endif
443
444void HW_TDMA_Start(void); /* power on TDMA module */
445void HW_TDMA_Enable_CTIRQ1(void); /* enable TDMA module CTIRQ1 */
446
447#define HW_tdma_auxev_time_setup(event0,event1) L1D_HW_TDMA_AUX_TIME_SETUP(event0, event1)
448
449#define HW_TDMA_GET_TQCNT() L1D_TDMA_GET_TQCNT()
450#define HW_TDMA_GET_TQWRAP() L1D_HW_TDMA_GET_TQWRAP()
451
452/* APIs for audio */
453extern kal_uint16 L1D_Get_Win_TQ_WRAP( void );
454extern kal_int8 L1D_GetT2( void );
455extern void L1D_ENABLE_DTIRQ( void );
456extern void L1D_CCCDReset( void );
457extern kal_bool L1D_Get_Speech_Re_Sync_Flag( void );
458/* ------------------------------------------------------------------------- */
459
460extern void MD_DRV_L1D_Exit( void );
461/* ------------------------------------------------------------------------- */
462
463#if MD_DRV_IS_CHIP_MT6583_MD1 || MD_DRV_IS_CHIP_MT6583_MD2 || MD_DRV_IS_CHIP_MT6572 || MD_DRV_IS_CHIP_MT6290 || MD_DRV_IS_CHIP_MT6595 || MD_DRV_IS_CHIP_MT6752_MD1 || MD_DRV_IS_CHIP_TK6291 || MD_DRV_IS_CHIP_MT6755 || MD_DRV_IS_CHIP_MT6292 || MD_DRV_IS_CHIP_MT6293 || MD_DRV_IS_CHIP_MT6295 || MD_DRV_IS_CHIP_MT6297
464 #if IS_DUAL_TALK_SUPPORT
465#define L1D_WAKEUP_MARGIN (1300)
466 #else
467#define L1D_WAKEUP_MARGIN (1050)
468 #endif
469#define L1C_WAKEUP_MARGIN (660)
470#elif MD_DRV_IS_CHIP_MT6752_MD2
471#define L1D_WAKEUP_MARGIN (660)
472#define L1C_WAKEUP_MARGIN (1050)
473#endif
474/* ------------------------------------------------------------------------- */
475#if defined(ESIM_BUILD_CONFIG) && (ESIM_BUILD_CONFIG == ESIM_MULTI_MODE_ON_FIBERS)
476#define L1D_WAKEUP_MARGIN (1050)
477#define L1C_WAKEUP_MARGIN (660)
478#endif
479/* ------------------------------------------------------------------------- */
480
481/*************************************************************************
482 * API provided for GPS to query current Freq. offset
483 *************************************************************************/
484kal_int32 L1D_GPS_Query_Frequency_Offset(void);
485
486#endif
487