blob: c3caf85f5fbfdbe247c50cde9d052d332af52b06 [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) 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 * @file dsp_logging.h
40 *
41 * Description:
42 * ------------
43 * @brief Interface of DSP logging handler.
44 *
45 * ==========================================================================
46 * $Log$
47 *
48 * 09 18 2020 guan-ren.chen
49 * [MOLY00327199] [Gen97/Gen98] Development
50 * DSP check register flag before filter update(SWRD).
51 *
52 * 09 14 2020 guan-ren.chen
53 * [MOLY00327199] [Gen97/Gen98] Development
54 * DSP check LS flag before update filter(SWRD).
55 *
56 * 04 09 2020 yen-hsuan.lin
57 * [MOLY00508510] [OK项目]PLS模式抓log需要和dump机制解耦
58 * decouple the logging and memory dump(SWRD)
59 *
60 * 03 31 2020 yen-hsuan.lin
61 * [MOLY00508510] [OK项目]PLS模式抓log需要和dump机制解耦
62 * 03 16 2020 kaijiun.yeo
63 * [MOLY00504503] Customer can adjust buffer allocation by customer filter
64 *
65 * 03 31 2020 kaijiun.yeo
66 * [MOLY00507931] Overwritable memorydump setting from AP (memory dump 2.0 phase 2)
67 * Add function prototype in dsp_logging.h
68 * decople log and memory dump(SW)
69 *
70 * 03 31 2020 kaijiun.yeo
71 * [MOLY00507931] Overwritable memorydump setting from AP (memory dump 2.0 phase 2)
72 * Add function prototype in dsp_logging.h
73 * [Customer can adjust buffer allocation by customer filter]
74 * Logging Buffer Reallocation - add function prototype in dsp_logging.h
75 *
76 * 01 17 2020 guan-ren.chen
77 * [MOLY00474969] [Logging] Round-Robin Exception Re-dump Log
78 * [Redump 2.0][SWRD] Round-Robin dump ULSP .
79 *
80 * 12 09 2019 yen-hsuan.lin
81 * [MOLY00327199] [Gen97] Development
82 * [MOLY00464641] Fix the dhl low power problem
83 *
84 * merger the Gen98 Fix into VMOLY trunk
85 *
86 * 11 21 2019 guan-ren.chen
87 * [MOLY00460317] [Petrus][blocking] trace lost before assert in two log - ALPS04883010, ALPS04883323
88 * Change trace name and fix wrong function prototype.
89 *
90 * 09 23 2019 yen-hsuan.lin
91 * [MOLY00327199] [Gen97] Development
92 * Fix the set dsp filter flow for rake
93 *
94 * 09 21 2019 guan-ren.chen
95 * [MOLY00327199] [Gen97] Development
96 * 1. ULSP DSP refactory SWRD.
97 * 2. Remove SW pull power when PB is not empty
98 * 3. Move DSP ST log definition file from HWRD to MPD
99 *
100 * 09 18 2019 guan-ren.chen
101 * [MOLY00327199] [Gen97] Development
102 * 1. ULSP DSP refactory SWRD.
103 * 2. Remove SW pull power when PB is not empty
104 * 3. Move DSP ST log definition file from HWRD to MPD
105 *
106 * 09 06 2019 yen-hsuan.lin
107 * [MOLY00437389] Porting Built in filter
108 *
109 * Add built in function
110 *
111 * 09 03 2019 guan-ren.chen
112 * [MOLY00327199] [Gen97] Development
113 * Fix pull DSP power when DSP first enter dormant.
114 *
115 * 08 19 2019 guan-ren.chen
116 * [MOLY00327199] [Gen97] Development
117 * ULSP DSP UT.
118 *
119 * 08 08 2019 guan-ren.chen
120 * [MOLY00427332] [MT6297][Apollo][Overnight][LegacyRAT][CHT][TPE][VMOLY][20190730]assert fail:dhl_ulsp.c
121 * LS abort fail SW workaround for SCQ16 (WHQA_00039659).
122 *
123 * 07 11 2019 guan-ren.chen
124 * [MOLY00327199] [Gen97] Development
125 * Fix DSP filter wrong size.
126 *
127 * 05 30 2019 mojo.lai
128 * [MOLY00401562] Decouple ICD from DHL on VMOLY trunk
129 *
130 * Save DSP filter to NVRAM
131 *
132 * 04 25 2019 yancy.chien
133 * [MOLY00401562] Decouple ICD from DHL on VMOLY trunk
134 *
135 * 1. Dynamic CCB.
136 * 2. Src Plug-in phase-in.
137 * 3. Fix build error on Gen95
138 *
139 * 04 16 2019 guan-ren.chen
140 * [MOLY00399588] [Gen97] Dormant flow
141 * Dormant flow. Struct access ULSP reg.
142 *
143 * 03 13 2019 guan-ren.chen
144 * [MOLY00391128] [Gen97] Develop for logging service
145 * Change print PS ex log location.
146 * Combine ULSP print ex log and print redump log function.
147 *
148 * 01 03 2019 mojo.lai
149 * [MOLY00376312] Save PB abort and flush status to CXIF
150 *
151 * .
152 *
153 * 10 31 2018 mojo.lai
154 * [MOLY00361962] Set DSP Filter
155 *
156 * .
157 *
158 ****************************************************************************/
159
160#ifndef _DSP_LOGGING_H
161#define _DSP_LOGGING_H
162
163#if defined(__MAUI_BASIC__)
164#define Dsp_Logging_Init()
165#else
166#if defined(__MTK_TARGET__)
167#include "dhl_def.h"
168#include "kal_public_defs.h"
169#include "kal_public_api.h"
170#include "kal_internal_def.h"
171#include "dhl_trace.h"
172
173#include "dsp_header_define_cuif_inner_brp.h"
174#include "dsp_header_define_cuif_fec_wbrp.h"
175#include "dsp_header_define_cuif_speech.h"
176#include "dsp_header_define_cmif.h"
177#include "dhl_nvram_def.h"
178#if (CUR_GEN >= MD_GEN97)
179#include "dsp_header_define_csif_memory.h"
180#endif
181
182#include "dhl_dsp_def.h"
183
184#if (CUR_GEN >= MD_GEN97)
185#define DSP_LTE_CORE_COUNT (SCQ16_3 + 1)
186#else
187#define DSP_LTE_CORE_COUNT (SCQ16_1 + 1)
188#endif
189
190extern dhl_cmd_set_dsp_filter_struct dsp_filter[NVRAM_EF_DHL_DSP_FILTER_V2_TOTAL + 1]; // 1-based
191
192/*---------------------------------------------------------------------------
193 Funtion prototype
194---------------------------------------------------------------------------*/
195void Dsp_Logging_Init();
196void Dsp_Logging_Init_By_Core(kal_uint8 core);
197void Dsp_set_filter_all_off();
198void Dsp_Load_Builtin_Filters(kal_int8 scenario_id);
199void Dsp_Set_Filter(dhl_cmd_set_dsp_filter_struct *dsp_filter_from_elt, kal_bool is_save_filter);
200void Dsp_Set_Filter_Imp();
201void Dsp_Set_RAKE_Filter();
202void Dsp_Backup_Clear_All_Filter();
203void Dsp_Restore_Filter();
204kal_bool Dsp_is_dsp_filter_all_off();
205
206void* Get_Cxif_Address(dsp_core_enum core);
207void Save_Filter_To_Cxif(kal_uint8 core);
208void Print_Filter_Setting(dhl_cmd_set_dsp_filter_struct *filter_setting);
209void Dsp_Test_Filter(kal_uint8 core);
210kal_uint8 Check_Dsp_Abort_Timeout();
211void PrintDSPDebugTrace();
212kal_bool Support_CXIF();
213kal_uint8 Check_4G_Dsp_Abort_Timeout();
214kal_uint8 Check_5G_Dsp_Abort_Timeout();
215char* get_core_name(dsp_core_enum core);
216kal_bool Get_Dsp_src_id(dsp_core_enum core_enum, kal_uint8* src_id);
217kal_bool Get_Dsp_Core_Enum(dhl_dsp_filter_type filter_type, kal_uint8 src_id, dsp_core_enum* core_enum);
218kal_bool Get_DSP_Core_NVRAM_Index(dsp_core_enum core_enum, kal_uint32* index);
219void dsp_ut_set_ut_case(kal_uint32 dsp_core_bit_mask, ulsp_ut_case ut_case, kal_uint32 para);
220void dsp_ut_wait_ut_case_finish(kal_uint32 dsp_core_bit_mask);
221void dsp_ut_notify_dsp(kal_uint32 dsp_core_bit_mask);
222void dhl_activate_dsp(kal_uint32 module_id, kal_bool first_activate);
223void dhl_deactivate_dsp(kal_uint32 module_id);
224void dsp_ut_init();
225void dsp_backup_filter_update_flag();
226void dsp_restore_filter_update_flag();
227void dsp_set_filter_update_flag(dsp_core_enum core);
228
229
230void dhl_ulsp_reset_vcore_l1(kal_uint32 ch_id);
231void dhl_ulsp_reset_scq16_pb_l1(kal_uint32 ch_id);
232
233#endif // __MTK_TARGET__
234#endif // __MAUI_BASIC__
235#endif // _DSP_LOGGING_H