blob: 94912b0eb18bb672546e40b1881242988acc7e1c [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) 2012
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 * Filename:
38 * ---------
39 * L1Trc.h
40 *
41 * Project:
42 * --------
43 * MOLY
44 *
45 * Description:
46 * ------------
47 * Layer 1 trace interface
48 *
49 * Author:
50 * -------
51 * -------
52 *
53 * ==========================================================================
54 * $Log$
55 *
56 * 04 21 2019 yh.sung
57 * [MOLY00392990] [VMOLY][UTF] Phase 2 Landing
58 * [UTF][DHL] UTF Trace API - trace interface
59 *
60 * 06 22 2018 yancy.chien
61 * [MOLY00331449] [Gen97] DHL logging development
62 * Migration on UMOLYE.
63 *
64 * 05 24 2018 yancy.chien
65 * [MOLY00258174] [Gen95][DHL] logging development.
66 *
67 * 01 31 2018 yancy.chien
68 * [MOLY00304870] [DHL] L1 Trace array support
69 * 1. ULSP version macro & function
70 * 2. SW version macro & function, for L1: VPE0~5 & L2: ert/hif/el2
71 * 3. COND&HW_COND version macro & function
72 * 4. Mechanism for check max argument size
73 *
74 * 12 20 2017 kenneth.lin
75 * [MOLY00253909] [DHL] Gen 95 development
76 *
77 * [DHL] API change on xl1sim
78 * - for cgen update
79 *
80 * 12 20 2017 kenneth.lin
81 * [MOLY00253909] [DHL] Gen 95 development
82 * [DHL] API change on xl1sim
83 * - for cgen update
84 *
85 * 11 30 2017 yu-hsiang.peng
86 * [MOLY00292252] [6293] Print L2 timestamp when current is non-4G
87 * [UMOLYA.TRUNK] L2 23G time
88 *
89 * 11 03 2017 yancy.chien
90 * [MOLY00258174] [Gen95][DHL] logging development
91 * Merge from DEV branch.
92 *
93 * 09 07 2017 yu-hsiang.peng
94 * [MOLY00275876] [Gen93] L1 trace code size silm
95 * [UMOLYA.TRUNK] L1 trace redefine
96 *
97 * 08 16 2017 yu-hsiang.peng
98 * [MOLY00266204] [Gen93] Common feature development before control
99 * [UMOLYA.TRUNK] Two features
100 * 1. OTA message filter
101 * 2. Non-smp use function check
102 *
103 * 06 20 2017 kenneth.lin
104 * [MOLY00257978] conditional trace development
105 *
106 * add typedef cgen_use_L1ULSP_NOT_PREPROCESS in 92 gen flow
107 *
108 * 06 19 2017 yancy.chien
109 * [MOLY00257978] conditional trace development
110 * Fix build error.
111 *
112 * 06 19 2017 yancy.chien
113 * [MOLY00257978] conditional trace development
114 * 1st phase-in.
115 *
116 * 04 27 2017 yancy.chien
117 * [MOLY00242548] [DHL] Build warning removal
118 * Apply A style.
119 *
120 * 04 27 2017 yancy.chien
121 * [MOLY00242548] [DHL] Build warning removal
122 * Apply A style.
123 *
124 * 04 20 2017 yu-hsiang.peng
125 * [MOLY00243236] [6293] L1trace LISR check use macro
126 * [UMOLYA.TRUNK] ulsp lisr check use macro to enhance debug flow
127 *
128 * 03 20 2017 kenneth.lin
129 * [MOLY00235284] [xL1SIM][DHL] support ulsp logging feature in xl1sim
130 * [xl1sim][DHL] ulsp code refactoring
131 *
132 * 03 14 2017 kenneth.lin
133 * [MOLY00235284] [xL1SIM][DHL] support ulsp logging feature in xl1sim
134 * fixed build failed on UESIM
135 *
136 * 03 14 2017 kenneth.lin
137 * [MOLY00235284] [xL1SIM][DHL] support ulsp logging feature in xl1sim
138 *
139 * DHL support ulsp logging feature in xl1sim
140 *
141 * 1. enable __USE_ULSP__
142 * 2. implement ulsp macro to send ELT directly
143 *
144 * 03 10 2017 yu-hsiang.peng
145 * [MOLY00224307] [MT6293] General feature change before MP branch create
146 * [UMOLYA.TRUNK] add L1 time trace new format
147 *
148 * 03 10 2017 yu-hsiang.peng
149 * [MOLY00224307] [MT6293] General feature change before MP branch create
150 * [UMOLYA.TRUNK] Fix target build warning
151 *
152 * 03 07 2017 yu-hsiang.peng
153 * [MOLY00224307] [MT6293] General feature change before MP branch create
154 * [UMOLYA.TRUNK] move filter to L2 cached lock
155 *
156 * 03 01 2017 yu-hsiang.peng
157 * [MOLY00231055] [Bianco Bring-up] [6293] L1L2 trace new verison (CGen & DHL)
158 * [UMOLYA.TRUNK] Fix non-smp trace api build warning
159 *
160 * 02 22 2017 yu-hsiang.peng
161 * [MOLY00231055] [Bianco Bring-up] [6293] L1L2 trace new verison (CGen & DHL)
162 * [UMOLYA.TRUNK] change L1/L2 trace macro.
163 *
164 * 02 08 2017 willie.pan
165 * [MOLY00163869] [6293][ULS+] Support 9~16 words for L2 logging in MoDIS
166 *
167 * .
168 *
169 * 12 15 2016 willie.pan
170 * [MOLY00163869] Support 8 word API for MODIS L2 Logging
171 *
172 * 11 29 2016 yu-hsiang.peng
173 * [MOLY00210769] [MT6293] MT6292 CCB service migrate to MT6293 and MT6293 ULSP logging on CCB development
174 * [UMOLYA] Add bound sync in L1L2 redump info.
175 *
176 * 11 28 2016 yu-hsiang.peng
177 * [MOLY00210769] [MT6293] MT6292 CCB service migrate to MT6293 and MT6293 ULSP logging on CCB development
178 * .UMOLYA] Add idle sync in L1L2 redump info.
179 *
180 * 11 14 2016 willie.pan
181 * [MOLY00163869] [6293][ULS+][ULS+ Phase In]
182 *
183 * . Suooprt L2 logging @ xL1SIM
184 *
185 * 11 11 2016 yancy.chien
186 * [MOLY00212754] [MT6293][NWSIM][3G][R6][All case][BLOCK] UESIM power on always error at l2trc_send_4_word_int
187 * Fix build error.
188 *
189 * 11 11 2016 yancy.chien
190 * [MOLY00212754] [MT6293][NWSIM][3G][R6][All case][BLOCK] UESIM power on always error at l2trc_send_4_word_int
191 *
192 * 11 08 2016 yancy.chien
193 * [MOLY00211534] [DHL] [L1/L2] Workaround for pass funtion in macro parameter issue
194 *
195 * 11 02 2016 yu-hsiang.peng
196 * [MOLY00210965] [MT6293] Patch MT6290, MT6291, MT6292 change into UMOLYA
197 * [UMOLYA.TRUNK] merge Yancy's CL3048791 & CL#3049395
198 *
199 * 11 01 2016 yancy.chien
200 * [MOLY00200296] [DHL] C2K Time Trace API.
201 * 1. Enlarge ping/pong buffer size to 128KB on UT env
202 * 2. Wrap time trace API by C2K_RAT option
203 *
204 * 11 01 2016 yu-hsiang.peng
205 * [MOLY00210769] [MT6293] MT6292 CCB service migrate to MT6293 and MT6293 ULSP logging on CCB development
206 * [UMOLYA.TRUNK] ULSP on CCB full load logging, normal logging(stage 1)
207 *
208 * 10 27 2016 yancy.chien
209 * [MOLY00181823] [DHL] UMOLY Migrate to UMOLYA - W16.44 Migration.
210 *
211 * 10 14 2016 yancy.chien
212 * [MOLY00181823] [DHL] UMOLY Migrate to UMOLYA
213 * [93Only] Add C2K time API for trigger flush event in MoDIS / UESIM
214 *
215 * 10 03 2016 yancy.chien
216 * [MOLY00181823] [DHL] UMOLY Migrate to UMOLYA
217 * W16.41 Migration
218 * Merge L1Trc related function to fix MoDIS logging issue.
219 *
220 * 09 22 2016 jean.tsao
221 * [MOLY00185213] [UMOLYA] DHL 92 SW logging migrate to 93
222 * [ULSP] MCU side driver API
223 *
224 * 09 21 2016 yu-hsiang.peng
225 * [MOLY00201169] [MT6293] DHL EBS support
226 * [UMOLYA.TRUNK] ULSP buffer put in non-cached
227 * (Required by Cynthia.Sun & Willie Pan)
228 *
229 * 09 20 2016 yu-hsiang.peng
230 * [MOLY00190921] [MT6293] Fix DHL Build Warning
231 * [UMOLYA.TRUNK]. Fix XL1SIM build warning
232 *
233 * 09 20 2016 yu-hsiang.peng
234 * [MOLY00185213] [MT6293] DHL MT6292 SW logging migrate to MT6293 & MT6293 ULSP logging development
235 * [UMOLYA.TRUNK] EX flow L1/L2 redump trace
236 *
237 * 09 14 2016 yu-hsiang.peng
238 * [MOLY00185213] [MT6293] DHL MT6292 SW logging migrate to MT6293 & MT6293 ULSP logging development
239 * [UMOLYA.TRUNK] Exception TMD & Macross templete
240 *
241 * 09 13 2016 yu-hsiang.peng
242 * [MOLY00190921] [MT6293] Fix DHL Build Warning
243 * [UMOLYA.TRUNK] Fix mask interrupt build warning
244 *
245 * 08 11 2016 yu-hsiang.peng
246 * [MOLY00185213] [MT6293] DHL MT6292 SW logging migrate to MT6293 & MT6293 ULSP logging development
247 * [UMOLYA.TRUNK] Merge back 93 ULSP 1st connect ELT code - increase LS buffer size (stage 4)
248 *
249 * 08 03 2016 yu-hsiang.peng
250 * [MOLY00185213] [MT6293] DHL MT6292 SW logging migrate to MT6293 & MT6293 ULSP logging development
251 * [UMOLYA.TRUNK] Merge back 93 ULSP 1st connect ELT code (stage 4)
252 *
253 * 07 22 2016 yancy.chien
254 * [MOLY00192766] [DHL] L1/L2 Trace optimization
255 * Remove redundant "filter[0]==1" checking
256 *
257 * 07 14 2016 yu-hsiang.peng
258 * [MOLY00190921] [MT6293] Fix DHL Build Warning
259 * Kuo-Wei Hung requirement : Fix xL1SIM warning
260 *
261 * 06 24 2016 yu-hsiang.peng
262 * [MOLY00185213] [UMOLYA] DHL 92 SW logging migrate to 93
263 * [UMOLYA.TRUNK] 93 ULSP trace macro & LS 1st integrate (stage 2)
264 *
265 * 06 21 2016 yu-hsiang.peng
266 * [MOLY00185213] [UMOLYA] DHL 92 SW logging migrate to 93
267 * [UMOLYA.TRUNK] 92 SW logging migration & 93 L1 L2 trace macro (stage 1)
268 *
269 * 05 26 2016 yancy.chien
270 * [MOLY00181823] [DHL] UMOLY Migrate to UMOLYA
271 * .
272 *
273 * 05 16 2016 willie.pan
274 * [MOLY00163869] [6293][ULS+][ULS+ Phase In] Fix warning of ULSP macro
275 *
276 * .
277 *
278 * 04 26 2016 willie.pan
279 * [MOLY00163869] [6293][ULS+][ULS+ Phase In] ULS+ PAE Log Parsing Feature Phase In
280 *
281 * .
282 *
283 * 04 25 2016 willie.pan
284 * [MOLY00163869] [6293][ULS+][ULS+ Phase In] Fix ULS+ offset for PAE
285 *
286 * .
287 *
288 * 04 15 2016 eason.lai
289 * [MOLY00173976] [6292][DHL] L1/L2 trace integrated with log DMA
290 * logDMA is not enabled yet due to logDMA sperious IRQ is not fixed
291 *
292 * 04 14 2016 willie.pan
293 * [MOLY00163869] [6293][ULS+][ULS+ Phase In]
294 *
295 * .Optimize interrupt disable in ULS+ solution
296 *
297 * 04 13 2016 eason.lai
298 * [MOLY00173976] [6292][DHL] L1/L2 trace integrated with log DMA
299 * This change haven't enable the log DMA due to log DMA IRQ has
300 * spurious interrupt.
301 *
302 * 04 13 2016 willie.pan
303 * [MOLY00163869] [6293][ULS+][ULS+ Phase In] Modification for L1/L2 Logging Profiling
304 *
305 * .
306 *
307 * 04 07 2016 willie.pan
308 * [MOLY00163869] [6293][ULS+][ULS+ Phase In]
309 *
310 * .
311 *
312 * 04 06 2016 willie.pan
313 * [MOLY00163869] [6293][ULS+][ULS+ Phase In]
314 *
315 * . Update for new L1/L2 logging API
316 *
317 * 04 06 2016 willie.pan
318 * [MOLY00163869] [6293][ULS+][ULS+ Phase In]
319 *
320 * .
321 *
322 * 04 05 2016 willie.pan
323 * [MOLY00163869] [6293][ULS+][ULS+ Phase In]
324 *
325 * .
326 *
327 * 03 31 2016 willie.pan
328 * [MOLY00163869] [6293][ULS+][ULS+ Phase In] Temporary use old inerrupt disable API on ULS+
329 *
330 * .
331 *
332 * 03 30 2016 eason.lai
333 * [MOLY00171573] [DHL] apply CIRQ EI/DI marco (without 40Qbit check)
334 * fixed xl1sim L1D cosim regression fail issue
335 *
336 * 03 29 2016 eason.lai
337 * [MOLY00171573] [DHL] apply CIRQ EI/DI marco (without 40Qbit check)
338 * 1. apply CIRQ EI/DI marco on L1 trace
339 * 2. fixed l1trace potential bug
340 * 3. support L1_CATCHER = FALSE
341 *
342 * 03 21 2016 willie.pan
343 * [MOLY00163869] [6293][ULS+][ULS+ Phase In] Add ULSP L1&L2 Logging Macro
344 *
345 * .
346 *
347 * 03 21 2016 eason.lai
348 * [MOLY00170160] [6292/Elbrus][DHL] L1trace HRT enhancement
349 * reduce caller codesize overhead
350 *
351 * 03 14 2016 willie.pan
352 * [MOLY00163869] [6293][ULS+][ULS+ Phase In] Fix auto-TCM issue
353 *
354 * .
355 *
356 * 03 14 2016 willie.pan
357 * [MOLY00163869] [6293][ULS+][ULS+ Phase In]
358 *
359 * .
360 *
361 * 02 26 2016 willie.pan
362 * [MOLY00163869] [6293][ULS+][ULS+ Phase In]
363 *
364 * .
365 *
366 * 02 26 2016 willie.pan
367 * [MOLY00163869] [6293][ULS+][ULS+ Phase In]
368 *
369 * .ULS+ for L1 PAE
370 *
371 * 02 26 2016 eason.lai
372 * [MOLY00163869] [6293][ULS+][ULS+ Phase In]
373 * disabled L2 timesatmp hardcode
374 *
375 * 02 01 2016 eason.lai
376 * [MOLY00134958] [MT6292] [DHL] logging service migration
377 * l1/l2 log redump
378 *
379 * 01 28 2016 eason.lai
380 * [MOLY00134958] [MT6292] [DHL] logging service migration
381 *
382 * replace SaveAndSetIRQMask with kal_hrt_SaveAndSetIRQMask
383 *
384 * 01 26 2016 eason.lai
385 * [MOLY00134958] [MT6292] [DHL] logging service migration
386 * 1. load filter from nvram at task init
387 * 2. exception log dump
388 *
389 * 11 25 2015 eason.lai
390 * [MOLY00134958] [MT6292] [DHL] logging service migration
391 * refine the xl1sim option in DHL and restore the patch of CL#1796032.
392 *
393 * 11 23 2015 eason.lai
394 * [MOLY00134958] [MT6292] [DHL] logging service migration
395 * xl1sim introduce SMP DHL
396 *
397 * 10 30 2015 eason.lai
398 * [MOLY00134958] [MT6292] [DHL] logging service migration
399 *
400 * remove __PCORE__ and __L1CORE__ option
401 *
402 * 10 26 2015 eason.lai
403 * [MOLY00134958] [MT6292] [DHL] logging service migration
404 * enable L1/L2 trace bit decoding
405 *
406 * 10 23 2015 eason.lai
407 * [MOLY00134958] [MT6292] [DHL] logging service migration
408 *
409 * SMP DHL logging migration
410 *
411 * 09 21 2015 yu-hsiang.peng
412 * [MOLY00142553] [DHL] fix build warning for LR11 MP/Trunk
413 * [UMOLY.Trunk] Fix build warning(0921)
414 *
415 * 08 27 2015 eason.lai
416 * [MOLY00134958] [MT6292] [DHL] logging service migration
417 * fixed link error
418 *
419 * 07 22 2015 eason.lai
420 * [MOLY00130157] [TK6291][DHL] smart logging migration
421 * fixed dhl_trace.c assert @ 1340
422 *
423 * 07 22 2015 eason.lai
424 * [MOLY00130157] [TK6291][DHL] smart logging migration
425 * .
426 *
427 * 07 10 2015 eason.lai
428 * merge code
429 *
430 * 05 15 2015 eason.lai
431 * [MOLY00113901] [TK6291][DHL] change pcore/l1core l1trace buffer size
432 * base on PAE result, pcore 8KB, l1core 64KB
433 *
434 * 04 26 2015 eason.lai
435 * [MOLY00109038] [TK6291E1][pre 1st Call][UMOLY][4G][FDD] There's no assert/fatal error message on "System Trace(L1CORE)" window
436 * 1. fixed l1core assert log missing by the potential problem.
437 * 2. start to support l1core l1 filer store in NVRAM
438 *
439 * 04 15 2015 eason.lai
440 * [MOLY00107803] [TK6291][DHL] PAE simulation code and option patch back.
441 * as CR title.
442 *
443 * 04 09 2015 eason.lai
444 * [MOLY00105513] [TK6291][DHL] introduce GPD/SPD wrapper
445 * GPD/SPD wrapper and L2copro log dma
446 *
447 * 03 17 2015 eason.lai
448 * [MOLY00084440] [MT6291][DHL] Patch back UMOLY trunk from MT6291_DEV
449 * move L1 trace buffer to L2SRAM, and change tst ring buffer as cacheable
450 *
451 * 02 10 2015 eason.lai
452 * [MOLY00095350] [TK6291][DHL] enable 64us timestamp in modis/uesim
453 * move l2 trace timestamp marco to be function call
454 *
455 * 11 24 2014 eason.lai
456 * [MOLY00084440] [MT6291][DHL] Patch back UMOLY trunk from MT6291_DEV
457 * FMA global timer
458 *
459 * 11 14 2014 eason.lai
460 * [MOLY00084440] [MT6291][DHL] Patch back UMOLY trunk from MT6291_DEV
461 * first time patch back
462 *
463 * 06 09 2014 ken.liu
464 * [MOLY00062708] [DHL] enable L1Boxster support.
465 * re-enable l1 boxster.
466 *
467 * 05 07 2014 eason.lai
468 * [MOLY00064969] [DHL]expand tab to 4 spaces to have better typesettings
469 * .
470 *
471 * 04 29 2014 ken.liu
472 * [MOLY00062708] [DHL] enable L1Boxster support.
473 * rollback L1boxster to align ELT support.
474 *
475 * 04 16 2014 ken.liu
476 * [MOLY00062708] [DHL] enable L1Boxster support.
477 * disable l1boxster on modis.
478 *
479 * 04 16 2014 ken.liu
480 * [MOLY00062708] [DHL] enable L1Boxster support.
481 * enable l1boxster by default.
482 *
483 * 04 15 2014 ken.liu
484 * [MOLY00062708] [DHL] enable L1Boxster support.
485 * Disable l1boxster by default due to incorrect usage of L1 trace API in AST L1 module.
486 *
487 * 04 15 2014 ken.liu
488 * [MOLY00062708] [DHL] enable L1Boxster support.
489 * fix modis build error.
490 *
491 * 04 15 2014 ken.liu
492 * [MOLY00062708] [DHL] enable L1Boxster support.
493 * fix modis build error.
494 *
495 * 04 15 2014 ken.liu
496 * [MOLY00062708] [DHL] enable L1Boxster support.
497 * enable L1Boxster support and optimization.
498 *
499 * 04 07 2014 eason.lai
500 * [MOLY00061900] [DHL][K95 MD2] merge code from DEV branch
501 * .
502 *
503 * 03 24 2014 ken.liu
504 * [MOLY00060207] [DHL] support L2 log buffer in TCM
505 * support l2 buffer from tcm sections.
506 *
507 * 03 13 2014 ken.liu
508 * [MOLY00059075] [xL1SIM] Patch back to MOLY
509 * add TRC_L2_PAD define.
510 *
511 * 03 10 2014 willie.pan
512 * [MOLY00059007] [MT6290E2][EL1] Sync DSP log and L1 trace by A time
513 * .
514 *
515 * 03 07 2014 ken.liu
516 * [MOLY00058420] [DHL] Fast interrupt mask/unmask via inline assembly for L2 trace
517 * enable __L2_LOGGING_IRQ_LOC__.
518 *
519 * 03 06 2014 ken.liu
520 * [MOLY00058420] [DHL] Fast interrupt mask/unmask via inline assembly for L2 trace
521 * fix modis build error.
522 *
523 * 03 06 2014 ken.liu
524 * [MOLY00058420] [DHL] Fast interrupt mask/unmask via inline assembly for L2 trace
525 * replace l2 trace interrupt mask/unmask with inline assembly.
526 *
527 * 02 26 2014 eason.lai
528 * [MOLY00057680] [L2][HMU][DHL] L2 trace and L2 timestamp support
529 * Provide L2 trace timestamp API and change L2 trace type number
530 *
531 * 08 26 2013 mojo.lai
532 * [MOLY00035110] Fix DHL L1 trace decode fail issue
533 *
534 * 05 15 2013 ken.liu
535 * [MOLY00020676] [MT6290 Bring-up] Layer 2 trace enum arg and filter support
536 * enable l2 trace enum support.
537 *
538 * 04 30 2013 ken.liu
539 * [MOLY00021076] [MT6290 Bring-up] DHL flush log uses too much CPU time before entering idle task
540 * sync from MT6290E1_FirstCall.
541 *
542 * 03 08 2013 ken.liu
543 * [MOLY00009212] LTE Multimode merge back to MOLY
544 * 1. add dhl_EM_logger api.
545 * 2. resend exception log on first tool connection.
546 *
547 * 01 24 2013 ken.liu
548 * [MOLY00005322] TATAKA merge to MOLY
549 * enable flush log on assert
550 *
551 * 12 26 2012 ken.liu
552 * [MOLY00005322] TATAKA merge to MOLY
553 * sync TST new api trc_UpdateTimeStamp.
554 *
555 * 11 29 2012 ken.liu
556 * [MOLY00005322] TATAKA merge to MOLY
557 * sync section attribute for layer 1 trace and l1 sim task/hisr config for DHL.
558 *
559 * 11 07 2012 ken.liu
560 * [MOLY00005322] TATAKA merge to MOLY
561 * dhl module check-in.
562 ****************************************************************************/
563/* Normal L1 traces exmaple
564
5651. default
566#define UMTS_3G_GEMINI_TIME(v1, v2, v3, v4, v5) do {\
567 {\
568 TRC_START_FILTER_CHECK_L1(DHL_L1Trace_Filter, 1, 0x01);\
569 TRC_PREPROCESS_DATA_SECTION1_L1(cgen_local_v1,v1);\
570 TRC_PREPROCESS_DATA_SECTION1_L1(cgen_local_v2,v2);\
571 TRC_PREPROCESS_DATA_SECTION1_L1(cgen_local_v3,v3);\
572 TRC_PREPROCESS_DATA_SECTION1_L1(cgen_local_v4,v4);\
573 TRC_PREPROCESS_DATA_SECTION1_L1(cgen_local_v5,v5);\
574 TRC_START_FILL_L1();\
575 TRC_PREPROCESS_DATA_SECTION2_L1(cgen_local_v1,v1);\
576 TRC_PREPROCESS_DATA_SECTION2_L1(cgen_local_v2,v2);\
577 TRC_PREPROCESS_DATA_SECTION2_L1(cgen_local_v3,v3);\
578 TRC_PREPROCESS_DATA_SECTION2_L1(cgen_local_v4,v4);\
579 TRC_PREPROCESS_DATA_SECTION2_L1(cgen_local_v5,v5);\
580 TRC_OUTPUT_16_FIRST_WRAPPER_L1(0x0000,0x0000);\
581 TRC_OUTPUT_8_MID_WRAPPER_L1(cgen_local_v1,v1);\
582 TRC_OUTPUT_16_MID_WRAPPER_L1(cgen_local_v2,v2);\
583 TRC_OUTPUT_32_MID_WRAPPER_L1(cgen_local_v3,v3);\
584 TRC_OUTPUT_16_MID_WRAPPER_L1(cgen_local_v4,v4);\
585 TRC_OUTPUT_32_LAST_WRAPPER_L1(cgen_local_v5,v5);\
586 TRC_END_FILL_L1();\
587 TRC_END_FILTER_CHECK_L1(DHL_L1Trace_Filter, 1, 0x01);\
588 }\
589} while(0)
590
5912. non_smp
592#define UMTS_3G_GEMINI_TIME(v1, v2, v3, v4, v5) do {\
593 {\
594 TRC_START_FILTER_CHECK_L1_NON_SMP(DHL_L1_Trace_Filter, 1, 0x01);\
595 TRC_PREPROCESS_DATA_SECTION1_L1_NON_SMP(cgen_local_v1,v1);\
596 TRC_PREPROCESS_DATA_SECTION1_L1_NON_SMP(cgen_local_v2,v2);\
597 TRC_PREPROCESS_DATA_SECTION1_L1_NON_SMP(cgen_local_v3,v3);\
598 TRC_PREPROCESS_DATA_SECTION1_L1_NON_SMP(cgen_local_v4,v4);\
599 TRC_PREPROCESS_DATA_SECTION1_L1_NON_SMP(cgen_local_v5,v5);\
600 TRC_START_FILL_L1_NON_SMP();\
601 TRC_PREPROCESS_DATA_SECTION2_L1_NON_SMP(cgen_local_v1,v1);\
602 TRC_PREPROCESS_DATA_SECTION2_L1_NON_SMP(cgen_local_v2,v2);\
603 TRC_PREPROCESS_DATA_SECTION2_L1_NON_SMP(cgen_local_v3,v3);\
604 TRC_PREPROCESS_DATA_SECTION2_L1_NON_SMP(cgen_local_v4,v4);\
605 TRC_PREPROCESS_DATA_SECTION2_L1_NON_SMP(cgen_local_v5,v5);\
606 TRC_OUTPUT_16_FIRST_WRAPPER_L1_NON_SMP(0x0000,0x0000);\
607 TRC_OUTPUT_8_MID_WRAPPER_L1_NON_SMP(cgen_local_v1,v1);\
608 TRC_OUTPUT_16_MID_WRAPPER_L1_NON_SMP(cgen_local_v2,v2);\
609 TRC_OUTPUT_32_MID_WRAPPER_L1_NON_SMP(cgen_local_v3,v3);\
610 TRC_OUTPUT_16_MID_WRAPPER_L1_NON_SMP(cgen_local_v4,v4);\
611 TRC_OUTPUT_32_LAST_WRAPPER_L1_NON_SMP(cgen_local_v5,v5);\
612 TRC_END_FILL_L1_NON_SMP();\
613 TRC_END_FILTER_CHECK_L1_NON_SMP(DHL_L1_Trace_Filter, 1, 0x01);\
614 }\
615} while(0)
616
617
618*/
619// __USE_ULSP__ : Use ULSP HW logger
620// __USE_ULSP_SW_SIMULATOR__ : Use ULSP SW Simulator, this option shouldn't co-exist with __USE_USLP__
621
622/**********************/
623/* CGen gen format */
624/**********************/
625
626#if defined(__USE_ULSP__) || defined(__USE_ULSP_SW_SIMULATOR__)
627
628typedef int cgen_use_L1ULSP;
629typedef int cgen_use_L1BitField;
630typedef int cgen_use_L1CondTrace;
631
632#if defined(__USE_ULSP_SW_SIMULATOR__)
633typedef int cgen_use_L1ULSP_Func_Impl;
634#endif
635
636#else
637
638typedef int cgen_use_L1Boxster;
639typedef int cgen_use_L2Boxster;
640typedef int cgen_use_L1BitField;
641typedef int cgen_use_L1ULSP_NOT_PREPROCESS; //workaround for cgen
642
643#endif
644
645#if defined (L1_CATCHER)
646#ifndef _L1TRC_H
647#define _L1TRC_H
648
649// legacy SW logging format, but still need for conditional trace
650#define TRC_L2_PAD (0xFA)
651#define TRC_BOXSTER_PAD (0xFA)
652//Use MACRO
653#define TRC_MERGE_2S_MACRO(v1, v2) ( (kal_uint32)(v1&0xFFFF) + ( ((kal_uint32)v2)<<16 ))
654#define TRC_MERGE_1S2C_MACRO(v1, v2, v3) ( (kal_uint32)(v1&0xFFFF) + ( ( (kal_uint32)(v2&0xFF) )<<16) + ( ((kal_uint32)v3)<<24) )
655#define TRC_MERGE_4C_MACRO(v1, v2, v3, v4) ( (kal_uint32)(v1&0xFF) + ( ((kal_uint32)(v2&0xFF))<<8) + ( ((kal_uint32)(v3&0xFF))<<16) + ( ((kal_uint32)v4)<<24))
656
657#define TRC_MERGE_2S(v1, v2) TRC_MERGE_2S_MACRO((v1), (v2))
658#define TRC_MERGE_1S2C(v1, v2, v3) TRC_MERGE_1S2C_MACRO((v1), (v2), (v3))
659#define TRC_MERGE_4C(v1, v2, v3, v4) TRC_MERGE_4C_MACRO((v1), (v2), (v3), (v4))
660
661
662
663/* for Cgen 92 SW logging, need Cgen help to remove, otherwise build error */
664typedef enum
665{
666 L1CSPM_DEFAULT,
667 SPIN_LOCK,
668 HW_ITC
669} E_DHL_TMD_CRIT_PROT;
670typedef enum
671{
672 L2_BUFFER_DEFAULT = 0,
673 L2_BUFFER_EL2 = L2_BUFFER_DEFAULT,
674 L2_BUFFER_HIF = 1,
675 L2_BUFFER_ERT = 2,
676 L2_BUFFER_END = 3
677} E_DHL_L2_BUFFER_MAPPING_TABLE;
678
679/*must some with MAX_UNIFIED_TRACE_CLASS_BYTE */
680typedef enum
681{
682 MAX_L1_TRACE_CLASS_BYTE = 8
683} E_NUM_L1_TRACE_CLASS;
684
685//#define __DHL_LEGACY_TRACE_API_ENABLE__
686
687/***************************/
688/* Include */
689/***************************/
690
691#include "kal_general_types.h"
692#include "kal_public_api.h"
693#if defined(__USE_ULSP__)
694#include "ulsp_mcu_logging.h"
695#endif//#if defined(__USE_ULSP__)
696
697
698/************************/
699/* Definition - IRQ */
700/************************/
701#if defined(__MTK_TARGET__)
702#if !defined(__L2_LOGGING_IRQ_LOC__)
703#define __L2_LOGGING_IRQ_LOC__
704#endif
705#endif
706
707#if defined(__L2_LOGGING_IRQ_LOC__)
708extern kal_uint32 dhl_SaveAndSetIRQMask_cirq_wrap(void);
709extern void dhl_RestoreIRQMask_cirq_wrap(kal_uint32 status);
710#define DHL_LOCK_CPU_INTERRUPT(oldmask) \
711 do{ \
712 oldmask = dhl_SaveAndSetIRQMask_cirq_wrap(); \
713 }while(0)
714
715#define DHL_UNLOCK_CPU_INTERRUPT(oldmask) \
716 do{ \
717 dhl_RestoreIRQMask_cirq_wrap(oldmask); \
718 }while(0)
719#elif defined(__MTK_TARGET__)
720
721extern kal_uint32 kal_hrt_SaveAndSetIRQMask(void);
722extern void kal_hrt_RestoreIRQMask(kal_uint32 irq);
723extern kal_uint32 dhl_SaveAndSetIRQMask_cirq_wrap(void);
724extern void dhl_RestoreIRQMask_cirq_wrap(kal_uint32 status);
725
726
727
728#define DHL_LOCK_CPU_INTERRUPT(oldmask) \
729 do{ \
730 oldmask = kal_hrt_SaveAndSetIRQMask(); \
731 }while(0)
732
733#define DHL_UNLOCK_CPU_INTERRUPT(oldmask) \
734 do{ \
735 kal_hrt_RestoreIRQMask(oldmask); \
736 }while(0)
737#else
738#define DHL_LOCK_CPU_INTERRUPT(oldmask) \
739 do{ \
740 oldmask = 0; \
741 }while(0)
742
743#define DHL_UNLOCK_CPU_INTERRUPT(oldmask) \
744 do{ \
745 oldmask = 0; \
746 }while(0)
747#endif /* __L2_LOGGING_IRQ_LOC__ */
748
749/**************************/
750/* Definition - */
751/* code setting */
752/**************************/
753#if !defined(GEN_FOR_PC)
754
755#if defined(__MTK_TARGET__)
756#define __DHL_L2CACHE_LOCK_DATA __attribute__ ((section("L2CACHE_LOCK_RW")))
757#else
758#define __DHL_L2CACHE_LOCK_DATA
759#endif
760#define __DHL_Core0IspRAM
761#define __DHL_Core1IspRAM
762#define __DHL_Core2IspRAM
763
764#if defined(__MD97__) || !defined(__MTK_TARGET__)
765#define __DHL_L2SRAM_ROCODE
766#else
767#define __DHL_L2SRAM_ROCODE __attribute__((section ("L2SRAM_L2C_ROCODE")))
768#endif
769
770#define __DHL_Core0DspRAM
771#define __DHL_Core1DspRAM
772#define __DHL_Core2DspRAM
773
774#if defined(__MD97__) || !defined(__MTK_TARGET__)
775#define __DHL_L2SRAM_DATA
776#define __DHL_L2SRAM_RW
777#else
778#define __DHL_L2SRAM_DATA __attribute__((section ("L2SRAM_L2C_ZI")))
779#define __DHL_L2SRAM_RW __attribute__((section ("L2SRAM_L2C_RW")))
780#endif
781
782
783typedef void (*trc_setfilterfunc)(unsigned char *);
784#define TRC_FILTER_FUNC_ARRAY trc_filterfuncarray
785#define TRC_NBR_MODULE trc_filterfuncnbr
786#define TRC_SET_FILTER_FUNC trc_setfilterfunc
787
788/*********************************************/
789/* Macro for declaring filter in codegen */
790/*********************************************/
791//force all to l2 cache in 93 to reduce mips, the conclusion after W16 PAE
792#define DECLARE_TMD_FILTER(VAR_TYPE, VAR_NAME, VAR_SIZE, P0, P1, P2, P3, P4, P5, P6, P7) \
793 VAR_TYPE VAR_NAME[VAR_SIZE] = {P0, P1, P2, P3, P4, P5, P6, P7};
794
795#define DECLARE_TMD_FILTER_L2SRAM(VAR_TYPE, VAR_NAME, VAR_SIZE, P0, P1, P2, P3, P4, P5, P6, P7) \
796 VAR_TYPE VAR_NAME[VAR_SIZE] = {P0, P1, P2, P3, P4, P5, P6, P7};
797
798#define DECLARE_TMD_FILTER_TCM(VAR_TYPE, VAR_NAME, VAR_SIZE, P0, P1, P2, P3, P4, P5, P6, P7) \
799 VAR_TYPE VAR_NAME[VAR_SIZE] = {P0, P1, P2, P3, P4, P5, P6, P7};
800
801/*********************************************/
802/* Macro for extern filter in codegen */
803/*********************************************/
804#define EXTERN_TMD_FILTER(VAR_TYPE, VAR_NAME, VAR_SIZE) \
805 extern VAR_TYPE VAR_NAME[VAR_SIZE];
806
807#define SET_TMD_FILTER(VAR_NAME, VAR_ARRAY_PTR, VAR_ARRAY_SIZE) \
808 do{ \
809 kal_uint32 i; \
810 for(i=0; i<VAR_ARRAY_SIZE; i++) VAR_NAME[i] = VAR_ARRAY_PTR[i]; \
811 }while(0)
812
813#define FILTER_COPY(DES_BUFFER, FILTER_NAME, FILTER_SIZE) \
814 do{ \
815 memcpy(DES_BUFFER, FILTER_NAME, FILTER_SIZE); \
816 }while(0);
817
818#define FILTER_CHECK(FILTER_NAME, FILTER_ARRAY_INDEX, FILTER_CLASS) ((FILTER_NAME[FILTER_ARRAY_INDEX] & FILTER_CLASS) != 0)
819
820
821#endif // #if !defined(GEN_FOR_PC)
822
823/***********************/
824/* Definition - ULSP */
825/***********************/
826
827#if defined(__LTE_L1SIM__)
828extern kal_bool l1_trc_assure_lisr(const char *func, const char *file, int line);
829#else
830extern kal_bool l1_trc_assure_lisr();
831#endif
832
833#include "L1Trc_array.h"
834
835#if defined(__USE_ULSP_SW_SIMULATOR__)
836 #include "dhl_ulsp_swsim_interface.h"
837 #include "dhl_cond_l1_trace.h"
838 #include "L1Trc_ulsp_func_interface.h"
839#elif defined(__USE_ULSP__)
840 #if defined(__MTK_TARGET__)
841 #include "dhl_ulsp_hw_interface.h"
842
843 #elif defined(L1_SIM)
844 #include "dhl_ulsp_xl1sim_interface.h"
845
846 #endif // #if defined(__MTK_TARGET__)
847
848 #include "dhl_cond_l1_trace.h"
849
850#else
851 #include "dhl_l1_legacy_sw_interface.h"
852
853#endif
854
855
856
857
858/************/
859/*Functions */
860/************/
861void trc_fillFrameNumber_multiple(kal_uint32 framenumber, kal_uint32 ebit, kal_uint32 time, kal_uint32 sim_index);
862void trc_UFillFrameNumber_multiple(kal_uint16 framenumber, kal_uint32 ebit, kal_int16 bsfn, kal_uint32 time, kal_uint32 sim_index);
863void trc_fill_4g_time(kal_uint32 phytimer, kal_uint16 sample, kal_uint32 time, kal_uint16 sfn, kal_uint8 subframe);
864void trc_fill_4g_time_2(kal_uint32 phytimer, kal_uint16 sample, kal_uint32 time, kal_uint16 sfn, kal_uint8 subframe, kal_uint32 _4g_time);
865void trc_fill_4g_time_gfrc2(kal_uint32 phytimer, kal_uint32 time, kal_uint16 sfn, kal_uint8 subframe, kal_uint32 absH, kal_uint32 absL);
866void trc_UpdateTimeStamp(kal_uint32 time);
867// Export for HIF GPT use
868void l2trc_fill_4G_time();
869void l2trc_update_4G_time(kal_uint32 celltime, kal_uint32 abstick);
870void l2trc_fill_23G_time();
871#if defined(__C2K_RAT__)
872extern void trc_fill_c2k_do_time(kal_uint8 fn_up, kal_uint32 fn_low, kal_uint8 slot, kal_uint32 echip, kal_uint32 frc);
873extern void trc_fill_c2k_1x_time(kal_uint8 fn_up, kal_uint32 fn_low, kal_uint8 slot, kal_uint32 echip, kal_uint32 frc);
874#endif // defined(__C2K_RAT__)
875//if remove , will build error in el1
876void Trc_Init(void);
877void trc_4g_trigger();
878void trc_UTrigger();
879void trc_handover(kal_uint32 handovertime, kal_uint32 framenumber);
880void trc_Uhandover(kal_uint32 handovertime, kal_uint32 framenumber);
881
882// legacy wrapper, to avoid build error on MoDIS
883void trc_l2_flush();
884
885void trc_setfilter(kal_uint8 *setting, kal_uint32 len);
886void trc_set_l1_filter(kal_uint8 *setting, kal_uint32 len);
887void trc_set_l2_filter(kal_uint8 *setting, kal_uint32 len);
888kal_int32 trc_getfilter(kal_uint8 *buffer, kal_int32 len);
889
890
891#endif //_L1TRC_H
892#endif /* #if defined(L1_CATCHER) */