rjw | 6c1fd8f | 2022-11-30 14:33:01 +0800 | [diff] [blame] | 1 | /***************************************************************************** |
| 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 dhl_trace.h |
| 40 | * |
| 41 | * Description: |
| 42 | * ------------ |
| 43 | * @brief Public interface of PS trace logging API. |
| 44 | * |
| 45 | * ========================================================================== |
| 46 | * $Log$ |
| 47 | * |
| 48 | * 01 14 2020 yh.sung |
| 49 | * [MOLY00470593] [MP0.7 excluded][MT6885][Petrus][Alpha phone][MP1][SQC][SH][USIR][module_MM]Found user data in ELT Log |
| 50 | * |
| 51 | * . |
| 52 | * |
| 53 | * 12 06 2019 wen-ting.cheah |
| 54 | * [MOLY00454404] [VMOLY] Remove legacy task |
| 55 | * Remove unused task |
| 56 | * 09 24 2019 yancy.chien |
| 57 | * [MOLY00442628] [MT6885][Petrus][NR][MP1][ML1S][MT8000A]Assert fail: dhl_list.h 305 0x235381fc 0x27f89db0 0x0 - 6IDLE |
| 58 | * Remove NRRC EBS solution. |
| 59 | * |
| 60 | * 09 18 2019 victoria.wang |
| 61 | * [MOLY00416922] DHL Legacy Wrapper migration and phase-out |
| 62 | * [Remove][DHL] phase out legacy wrapper API |
| 63 | * |
| 64 | * 06 13 2019 victoria.wang |
| 65 | * [MOLY00408490] USIR Feature |
| 66 | * [New][USIR][DHL] Add usir customsize masking function and enable USIR with modis |
| 67 | * |
| 68 | * 06 11 2019 sunwhy.kuo |
| 69 | * [MOLY00412952] patch empty flush MDM buffer API to VMOLY for further ESP key delay issue |
| 70 | * |
| 71 | * patch empty mon buffer flush API for ESP Key delay (need implement when MDM channel done) |
| 72 | * |
| 73 | * 05 16 2019 yancy.chien |
| 74 | * [MOLY00345863] [Gen97] RRC signal logging & inject |
| 75 | * |
| 76 | * Export MAX_TRACE_DATA_SEGMENT_CNT & MAX_ILM_TRACE_BYTES |
| 77 | * |
| 78 | * 05 16 2019 victoria.wang |
| 79 | * [MOLY00354132] [Gen 95][ERRC][SYS] Stored SIB C-struct debug trace |
| 80 | * [Add][DHL] print c structure logging API |
| 81 | * |
| 82 | * 05 02 2019 yancy.chien |
| 83 | * [MOLY00345863] [Gen97] RRC signal logging & inject |
| 84 | * interface part. |
| 85 | * |
| 86 | * 04 25 2019 yancy.chien |
| 87 | * [MOLY00401562] Decouple ICD from DHL on VMOLY trunk |
| 88 | * |
| 89 | * 1. Dynamic CCB. |
| 90 | * 2. Src Plug-in phase-in. |
| 91 | * 3. Fix build error on Gen95 |
| 92 | * |
| 93 | * 04 21 2019 yh.sung |
| 94 | * [MOLY00392990] [VMOLY][UTF] Phase 2 Landing |
| 95 | * [UTF][DHL] UTF Trace API - trace interface |
| 96 | * |
| 97 | * 01 30 2019 yu-hsiang.peng |
| 98 | * [MOLY00370849] [MT6297][Apollo][Sanity Fail][VMOLY][20181205][0200] 2G_Attach assert fail m12180.c 532 |
| 99 | * [SEPT.DEV] support custom read done |
| 100 | * |
| 101 | * 01 25 2019 yu-hsiang.peng |
| 102 | * [MOLY00381457] [DHL 2.0] Common Feature Development |
| 103 | * [SEPT.DEV] support mipi custom read |
| 104 | * |
| 105 | * 12 04 2018 yancy.chien |
| 106 | * [MOLY00370246] [GEN97][DHL] META disconnect flow enhancement |
| 107 | * |
| 108 | * . |
| 109 | * |
| 110 | * 10 30 2018 yu-hsiang.peng |
| 111 | * [MOLY00347960] [MT6297] DHL Feature Enhance |
| 112 | * [Change Feature] Support AST logging - interface |
| 113 | * |
| 114 | * 09 28 2018 yancy.chien |
| 115 | * [MOLY00345863] [Gen97] RRC signal logging & inject |
| 116 | * UPS mux header support over 64K |
| 117 | * UPS protocol phase-in |
| 118 | * EBS add NRRC_LOG type |
| 119 | * Custom ILM option remove no_log & wo_peer_buff |
| 120 | * |
| 121 | ****************************************************************************/ |
| 122 | |
| 123 | #ifndef _DHL_TRACE_H |
| 124 | #define _DHL_TRACE_H |
| 125 | |
| 126 | #if !defined(__DHL_MODULE__) |
| 127 | #include "kal_trace.h" |
| 128 | |
| 129 | #define dhl_trace(...) |
| 130 | #define dhl_internal_trace(...) |
| 131 | #define dhl_brief_trace(...) |
| 132 | #define dhl_peer_trace(...) |
| 133 | #define dhl_raw_trace(...) |
| 134 | #define dhl_print(...) |
| 135 | #define dhl_print_string(...) |
| 136 | #define dhl_print_system_trace(...) |
| 137 | |
| 138 | #define dhl_print_struct(...) |
| 139 | #define dhl_debug_print(...) |
| 140 | |
| 141 | #define dhl_trace_impl(...) |
| 142 | #define dhl_internal_trace_impl(...) |
| 143 | #define dhl_print_impl(...) |
| 144 | #define dhl_EM_logger(...) |
| 145 | #define dhl_log_primitive6(...) |
| 146 | |
| 147 | #define dhl_print_meta_string(...) |
| 148 | |
| 149 | #define DHL_MAC_LOG_L2_PDU(pointer, length) do {\ |
| 150 | } while(0) |
| 151 | #define DHL_RLC_LOG_L2_PDU(pointer, length) do {\ |
| 152 | } while(0) |
| 153 | #define DHL_PDCP_LOG_L2_PDU(pointer, length) do {\ |
| 154 | }while(0) |
| 155 | |
| 156 | #define DHL_MAC_CHECK_L2_PDU() do {\ |
| 157 | }while(0) |
| 158 | #define DHL_RLC_CHECK_L2_PDU() do {\ |
| 159 | }while(0) |
| 160 | #define DHL_PDCP_CHECK_L2_PDU() do {\ |
| 161 | }while(0) |
| 162 | #define dhl_get_md_time_info (0) |
| 163 | #else |
| 164 | |
| 165 | #ifndef GEN_FOR_PC |
| 166 | #include <stdio.h> |
| 167 | #include <stdarg.h> |
| 168 | #else |
| 169 | typedef char *va_list; |
| 170 | #endif |
| 171 | #include "kal_general_types.h" |
| 172 | #include "kal_public_defs.h" |
| 173 | |
| 174 | #if defined(__RVCT__) |
| 175 | #pragma diag_suppress 870 |
| 176 | #endif /* __RVCT_ */ |
| 177 | |
| 178 | #ifdef __cplusplus |
| 179 | extern "C" { |
| 180 | #endif |
| 181 | |
| 182 | #if defined(__DHL_MODULE__) && defined(__EM_MODE__) /* for ilm_struct type definition */ |
| 183 | #ifndef GEN_FOR_PC |
| 184 | struct ilm_struct; |
| 185 | extern void tst_EM_logger(struct ilm_struct *ilm_ptr); |
| 186 | extern void dhl_EM_logger(struct ilm_struct *ilm_ptr); |
| 187 | #endif |
| 188 | #endif //#if defined(__DHL_MODULE__) && defined(__EM_MODE__) |
| 189 | |
| 190 | #define MAX_MSG_NBR_IN_MODULE 20 |
| 191 | |
| 192 | //Define Trace Macro for PS trace |
| 193 | #if defined(GEN_FOR_PC) && !defined(GEN_FOR_CPARSER) |
| 194 | #define BEGIN_TRACE_MAP(MOD) START_MODULE_MSG MOD MAX_MSG_NBR_IN_MODULE |
| 195 | #define BEGIN_TRACE_MAP_WITH_RANGE(MOD, MIN_VAL, MAX_VAL) START_RANGE_MODULE_MSG MOD MAX_MSG_NBR_IN_MODULE MIN_VAL MAX_VAL |
| 196 | #define TRC_MSG(MSG,STR) MSG STR |
| 197 | #define TRC_MSG_NEWLINE(MSG,STR,NUM) MSG STR NUM |
| 198 | #define END_TRACE_MAP(MOD) END_MODULE_MSG |
| 199 | #define END_TRACE_MAP_WITH_RANGE(MOD, MIN_VAL, MAX_VAL) MOD MIN_VAL MAX_VAL END_RANGE_MODULE_MSG |
| 200 | #else //Define Trace Macro for PS trace |
| 201 | #define BEGIN_TRACE_MAP(MOD) enum MOD##_MSG_ENUM{\ |
| 202 | MOD##_empty_string=MOD<<MAX_MSG_NBR_IN_MODULE, |
| 203 | #define BEGIN_TRACE_MAP_WITH_RANGE(MOD, MIN_VAL, MAX_VAL) enum MOD##_##MIN_VAL##_MSG_ENUM{\ |
| 204 | MOD##_##MIN_VAL##_empty_string = (MOD<<MAX_MSG_NBR_IN_MODULE) + MIN_VAL - 1, |
| 205 | #define TRC_MSG(MSG,STR) MSG##__enum, |
| 206 | #define TRC_MSG_NEWLINE(MSG,STR,NUM) MSG##__enum, MSG##_NEWLINE_EXPAND__enum = MSG##__enum+NUM, |
| 207 | #define END_TRACE_MAP(MOD) MOD##__end}; |
| 208 | #define END_TRACE_MAP_WITH_RANGE(MOD, MIN_VAL, MAX_VAL) MOD##_##MIN_VAL##__end}; |
| 209 | #endif //Define Trace Macro for PS trace |
| 210 | |
| 211 | |
| 212 | #if defined(__DHL_MODULE__) && !defined(__DHL_BRINUP_DUMMY_BUILD__) |
| 213 | #define __DHL_TRACE_ENABLED__ |
| 214 | #endif //#ifdef __DHL_MODULE__ |
| 215 | |
| 216 | #ifndef __DHL_TRACE_ENABLED__ |
| 217 | #if defined(L1_SIM) && !defined (__UE_SIMULATOR__) |
| 218 | #define __DHL_TRACE_ENABLED__ |
| 219 | #elif defined(KAL_ON_OSCAR) || defined(MCD_DLL_EXPORT) |
| 220 | #define __DHL_TRACE_EMPTY_FUNCTION__ |
| 221 | #endif //#if defined(KAL_ON_OSCAR) || defined(MCD_DLL_EXPORT) |
| 222 | #endif |
| 223 | |
| 224 | typedef enum |
| 225 | { |
| 226 | TRACE_FUNC, |
| 227 | TRACE_STATE, |
| 228 | TRACE_INFO, |
| 229 | TRACE_WARNING, |
| 230 | TRACE_ERROR, |
| 231 | TRACE_GROUP_1, |
| 232 | TRACE_GROUP_2, |
| 233 | TRACE_GROUP_3, |
| 234 | TRACE_GROUP_4, |
| 235 | TRACE_GROUP_5, |
| 236 | TRACE_GROUP_6, |
| 237 | TRACE_GROUP_7, |
| 238 | TRACE_GROUP_8, |
| 239 | TRACE_GROUP_9, |
| 240 | TRACE_GROUP_10, |
| 241 | TRACE_PEER |
| 242 | } trace_class_enum; |
| 243 | |
| 244 | typedef enum |
| 245 | { |
| 246 | DHL_CUSTOM_ILM_HEADER_ONLY, |
| 247 | DHL_CUSTOM_ILM_CPHY_MSG_CONTAINER, |
| 248 | } e_custom_ilm_trace_option; |
| 249 | |
| 250 | typedef struct |
| 251 | { |
| 252 | void* data; |
| 253 | kal_uint32 len; |
| 254 | } trace_data_segment_desc; |
| 255 | |
| 256 | |
| 257 | #if defined (__DHL_TRACE_ENABLED__) |
| 258 | |
| 259 | #define DHL_USER_FLAG_NONE (0x0) |
| 260 | #define DHL_FLAG_EM (0x1) |
| 261 | |
| 262 | /* User API for querying trace started to output or not, contact: Shengfu Tsai */ |
| 263 | extern kal_bool dhl_is_trace_started(); |
| 264 | |
| 265 | /* User API for querying USIR on to mask sensitive data or not */ |
| 266 | kal_bool dhl_mask_sensitive_trace_on(); |
| 267 | |
| 268 | /* trace */ |
| 269 | #define DHL_ACCESS_LEVEL_1_ALL_USER (0x01) |
| 270 | #define DHL_ACCESS_LEVEL_4_MTK_INTERNAL (0x04) |
| 271 | #define DHL_ACCESS_LEVEL_5_MBJ_L1 (0x05) |
| 272 | #define DHL_ACCESS_LEVEL_5_MTB_L1 (0x05) |
| 273 | #define DHL_ACCESS_LEVEL_7_HQ_ONLY (0x07) |
| 274 | /* trace */ |
| 275 | extern void dhl_print(trace_class_enum trc_class, kal_uint32 user_flag, module_type mod_id, const char *fmt, ...); |
| 276 | extern void dhl_print_string(trace_class_enum trc_class, kal_uint32 user_flag, module_type mod_id, const char *str); |
| 277 | extern void meta_print_string(trace_class_enum trc_class, kal_uint32 user_flag, module_type mod_id, const char *str); |
| 278 | #define dhl_print_system_trace(_c, _s) \ |
| 279 | dhl_print_string((_c), DHL_USER_FLAG_NONE, 0, (_s)); |
| 280 | |
| 281 | /* primitive */ |
| 282 | /** |
| 283 | * \brief output internal message communication log if module's filter on. send by KAL service. |
| 284 | * \param ilm_struct for internal message |
| 285 | */ |
| 286 | extern void dhl_log_primitive(ilm_struct *ilm); |
| 287 | extern void dhl_log_primitive_custom(ilm_struct *ilm, e_custom_ilm_trace_option option); |
| 288 | |
| 289 | #define DHL_MAX_TRACE_DATA_SEGMENT_CNT (128) |
| 290 | #define DHL_MAX_ILM_TRACE_BYTES (512 * 1024) |
| 291 | /* |
| 292 | * Pack the data_seg_array's data in ILM's peer part |
| 293 | * NOTE: |
| 294 | * 1. original peer_buf_ptr & peer_buf_len of ILM will be replaced |
| 295 | * 2. local_para_len can be controlled by partial logging, but peer_len CAN'T |
| 296 | * 3. ASSURE data_seg_cnt <= DHL_MAX_TRACE_DATA_SEGMENT_CNT |
| 297 | * 4. ASSURE total size of trace <= DHL_MAX_ILM_TRACE_SIZE |
| 298 | */ |
| 299 | extern void dhl_log_primitive_append_data_in_peer(ilm_struct *ilm, trace_data_segment_desc data_seg_array[], kal_uint32 data_seg_cnt); |
| 300 | |
| 301 | extern void dhl_FT_log_primitive(ilm_struct *ilm); |
| 302 | |
| 303 | /** |
| 304 | * \brief output primitive C structure if module's filter on. |
| 305 | * \param module's id |
| 306 | * \param sap_type if need partial logging |
| 307 | * \param msg_type for getting c structure that define in message structure definition |
| 308 | * \param buf_len the size of c structure |
| 309 | * \param buf pointer to the stucture data |
| 310 | * \par Sample code |
| 311 | * \code{.c} |
| 312 | * dhl_string_struct buf; |
| 313 | * kal_uint32 buf_len = sizeof(dhl_string_struct); |
| 314 | * dhl_log_primitive_struct(MOD_DHL, INVALID_SAP, MSG_ID_DHL_STRING, buf_len, &buf); |
| 315 | * \endcode |
| 316 | */ |
| 317 | extern void dhl_log_primitive_struct(module_type src_mod, sap_type sap_id, msg_type msg_id, kal_uint32 buf_len, void *buf); |
| 318 | // API for META |
| 319 | // Exported API for FT only, FT will call this API after send disconnect ACK to Tool, then DHL will drop all upcoming META traces to save power |
| 320 | // NOTE: Not thread-safe |
| 321 | extern void dhl_set_meta_tool_disconnected(); |
| 322 | |
| 323 | extern void meta_print_system_trace(trace_class_enum trc_class, kal_uint32 user_flag, module_type mod_id, const kal_char *str); |
| 324 | #define dhl_print_meta_string(_c, _s) meta_print_system_trace((_c), DHL_USER_FLAG_NONE, 0, (_s)) |
| 325 | |
| 326 | |
| 327 | // Only available on MoDIS |
| 328 | #ifdef UNIT_TEST |
| 329 | #include "kal_public_defs.h" |
| 330 | extern void _dhl_print_struct(module_type src, msg_type msg_id, int buf_len, void *buf); |
| 331 | #define dhl_print_struct(_s,_m,_l,_b) _dhl_print_struct(_s,_m,_l,_b) |
| 332 | #define dhl_debug_print(_c,_m,_f, ...) dhl_print(_c, DHL_USER_FLAG_NONE, _m, _f, __VA_ARGS__); |
| 333 | #else |
| 334 | #define dhl_print_struct(_s,_m,_l,_b) |
| 335 | #define dhl_debug_print(_f, ...) |
| 336 | #endif |
| 337 | |
| 338 | #define dhl_trace_impl(_t, _u, _msg, _mod, _argv, _arg_info) \ |
| 339 | dhl_internal_trace_impl(_t, _u, DHL_ACCESS_LEVEL_1_ALL_USER, _msg, _mod, _argv, _arg_info) |
| 340 | |
| 341 | extern void dhl_internal_trace_impl(trace_class_enum trc_class, kal_uint32 user_flag, kal_uint8 access_level, kal_uint32 msg_index, kal_uint32 module_id, const char *arg_type, va_list argument_info); |
| 342 | extern void dhl_print_impl(trace_class_enum trc_class, kal_uint32 user_flag, module_type mod_id, const char *fmt, va_list argument_info); |
| 343 | extern void dhl_raw_trace_impl(trace_class_enum trc_class, kal_uint32 user_flag, kal_uint32 msg_index, const kal_char *fmt, kal_uint32 buf_len, const kal_uint8 *pData, kal_bool chk_filter); |
| 344 | /** |
| 345 | * @brief this is intended as internal API implementation of DHL |
| 346 | * Do not use this directly. User must declare UTMD to use OTA traces. |
| 347 | * @param trc_class trace class ID to check filter |
| 348 | * @param global_peer_msg_id OTA message identifier for given OTA message |
| 349 | * @param raw_data_len length of given OTA message |
| 350 | * @param raw_data pointer to OTA message buffer |
| 351 | * @param trace_index trace ID of this OTA message |
| 352 | * @param module_id trace module ID for filter checking |
| 353 | * @param arg_type trace argumeargument for given trace |
| 354 | * */ |
| 355 | extern void dhl_peer_trace_impl(kal_uint8 trc_class, kal_uint32 global_peer_msg_id, kal_uint32 raw_data_len, kal_uint8 *raw_data, kal_uint32 trace_index, kal_uint32 module_id, const char *arg_type, va_list argument_info); |
| 356 | |
| 357 | //typedef void (*TST_String_Inject_CB)(kal_uint32 index, kal_uint8 *pData); |
| 358 | // External buffer logging via ILM |
| 359 | typedef enum |
| 360 | { |
| 361 | DHL_EXTERNAL_BUFFER_TYPE_BEGIN = 0, |
| 362 | DHL_EXTERNAL_BUFFER_L2COPRO_IP_HEADER_LOG, |
| 363 | DHL_EXTERNAL_BUFFER_TYPE_MAX |
| 364 | } dhl_external_buffer_type; |
| 365 | |
| 366 | /* |
| 367 | * Parameter note: |
| 368 | * sent_end |
| 369 | * the end of buffer address sent |
| 370 | * may not align with the buffer end sent |
| 371 | * (fragment should be handled by user) |
| 372 | */ |
| 373 | typedef void (*buffer_tx_done_cb)(dhl_external_buffer_type type, kal_uint8 *sent_end, kal_int32 sent_len); |
| 374 | kal_bool register_buffer_tx_done_callback(dhl_external_buffer_type type, buffer_tx_done_cb cb); |
| 375 | /* |
| 376 | * Parameter usage note: |
| 377 | * msg_id |
| 378 | * MSG_ID_DHL_L2COPRO_DL_IP_HEADER_LOG |
| 379 | * MSG_ID_DHL_L2COPRO_UL_IP_HEADER_LOG |
| 380 | * local_para |
| 381 | * caller-free |
| 382 | * local_para_len |
| 383 | * <= 64 bytes |
| 384 | */ |
| 385 | typedef struct |
| 386 | { |
| 387 | kal_uint8 *buf_address; |
| 388 | kal_uint32 buf_len; |
| 389 | } S_DHL_SEND_BODY; |
| 390 | kal_bool dhl_send_ilm_log(dhl_external_buffer_type type, msg_type msg_id, kal_uint8 *local_para, kal_int32 local_para_len, S_DHL_SEND_BODY *p_send_body_array, kal_uint32 body_number); |
| 391 | |
| 392 | //for SIM Authentication APDU flush mdm buffer use , need implement in DHL v2 |
| 393 | void dhl_mon_trigger_flush_log(); |
| 394 | |
| 395 | #ifdef TST_TRACE_COMPAT |
| 396 | #define kal_print_string_trace kal_wap_trace //alias kal_print_string_trace as kal_wap_trace |
| 397 | extern void kal_wap_trace(module_type mod_id, trace_class_enum trc_class, const char *fmt, ...); |
| 398 | extern void kal_bootup_trace(trace_class_enum, kal_uint32, const kal_char *, ...); |
| 399 | extern void kal_prompt_trace(module_type, const kal_char *fmt, ...); |
| 400 | extern void kal_trace_for_3rd_party(trace_class_enum, kal_uint32, const kal_char *, va_list); |
| 401 | #endif |
| 402 | //#define __DHL_LEGACY_TRACE_API_ENABLED__ |
| 403 | #if defined(__DHL_LEGACY_TRACE_API_ENABLED__) |
| 404 | /*index trace & raw trace & peer trace*/ |
| 405 | /*dhl*/ |
| 406 | extern void dhl_trace(trace_class_enum trc_class, kal_uint32 user_flag, kal_uint32 msg_index, const char *arg_type, ...); |
| 407 | extern void dhl_internal_trace(trace_class_enum trc_class, kal_uint32 user_flag, kal_uint8 access_level, kal_uint32 msg_index, const char *arg_type, ...); |
| 408 | extern void dhl_brief_trace(trace_class_enum trc_class, kal_uint32 user_flag, kal_uint32 msg_index, const char *arg_type, ...); |
| 409 | extern void dhl_raw_trace(trace_class_enum trc_class, kal_uint32 user_flag, kal_uint32 msg_index, const kal_char *fmt, kal_uint32 buf_len, const kal_uint8 *pData); |
| 410 | extern void dhl_peer_trace(kal_uint32 global_peer_msg_id, kal_uint32 raw_data_len, kal_uint8 *raw_data, kal_uint32 trace_index, const char *arg_type, ...); |
| 411 | /*kal*/ |
| 412 | #ifdef TST_TRACE_COMPAT |
| 413 | #define kal_critical_trace kal_trace |
| 414 | #define kal_critical_brief_trace kal_brief_trace |
| 415 | #define kal_critical_assert_trace kal_assert_trace |
| 416 | extern void kal_critical_trace(trace_class_enum, kal_uint32, const kal_char *, ...); |
| 417 | extern void kal_critical_brief_trace(trace_class_enum, kal_uint32, const kal_char *, ...); |
| 418 | extern void kal_critical_assert_trace(trace_class_enum, kal_uint32, const kal_char *, ...); |
| 419 | #if !defined(_MSC_VER) |
| 420 | #define kal_trace(trc_class, msg_index, ...) \ |
| 421 | dhl_trace(trc_class, DHL_USER_FLAG_NONE, msg_index, ##__VA_ARGS__) |
| 422 | #define kal_brief_trace(trc_class, msg_index, ...) \ |
| 423 | dhl_brief_trace(trc_class, DHL_USER_FLAG_NONE, msg_index, ##__VA_ARGS__) |
| 424 | //Target build |
| 425 | extern kal_bool tst_is_PsTrc_open_and_pstrace_flag; //For optimization, the AND flag of tst_is_PsTrc_open and tst_pstrace_flag |
| 426 | extern void dhl_brief_trace_opt_helper(trace_class_enum trc_class, kal_uint32 user_flag, kal_uint32 msg_index, const char *arg_type, ...); |
| 427 | #define kal_brief_trace_macro(trc_class, msg_index, ...) do { \ |
| 428 | if (tst_is_PsTrc_open_and_pstrace_flag) {\ |
| 429 | dhl_brief_trace_opt_helper(trc_class, DHL_USER_FLAG_NONE, msg_index, ##__VA_ARGS__); \ |
| 430 | } \ |
| 431 | } while(0) |
| 432 | #else |
| 433 | extern void kal_trace(trace_class_enum, kal_uint32, const kal_char *, ...); |
| 434 | extern void kal_brief_trace(trace_class_enum, kal_uint32, const kal_char *, ...); |
| 435 | //PC build (MoDIS or MCDDLL) |
| 436 | extern void kal_brief_trace_macro(trace_class_enum, kal_uint32, const kal_char *, ...); |
| 437 | #endif // _MSC_VER |
| 438 | extern void _kal_trace(trace_class_enum, kal_uint32, const kal_char *, ...); |
| 439 | extern void _kal_brief_trace(trace_class_enum, kal_uint32, const kal_char *, ...); |
| 440 | extern void kal_lib_trace(trace_class_enum, kal_uint32, const kal_char *, ...); |
| 441 | //extern void kal_assert_trace(trace_class_enum, kal_uint32, const kal_char *, ...); |
| 442 | #define kal_assert_trace(trc_class, msg_index, ...) dhl_trace(trc_class, DHL_USER_FLAG_NONE, msg_index, ##__VA_ARGS__) |
| 443 | extern void kal_buffer_trace(trace_class_enum trc_class, kal_uint32 msg_index, const kal_char *fmt, kal_uint32 buf_len, const kal_uint8 *pData); |
| 444 | extern void kal_dev_trace(trace_class_enum trc_class, kal_uint32 msg_index, const char *arg_type, ...); |
| 445 | #endif // TST_TRACE_COMPAT |
| 446 | #endif //__DHL_LEGACY_TRACE_API_ENABLED__ |
| 447 | /** |
| 448 | * @brief get MD time info |
| 449 | * @returns the current time info (32-bit) |
| 450 | */ |
| 451 | kal_uint32 dhl_get_md_time_info(void); |
| 452 | #else //__DHL_TRACE_ENABLED__ |
| 453 | #if defined(__DHL_TRACE_EMPTY_FUNCTION__) |
| 454 | /* |
| 455 | * For non-target platform (PC simulator or MNT), |
| 456 | * we define trace-related functions as inline function to avoid compile error |
| 457 | * in VC++. |
| 458 | */ |
| 459 | |
| 460 | static __inline void dhl_trace(trace_class_enum trc_class, kal_uint32 user_flag, kal_uint32 msg_index, const char *arg_type, ...) |
| 461 | { |
| 462 | return; |
| 463 | } |
| 464 | |
| 465 | static __inline void dhl_internal_trace(trace_class_enum trc_class, kal_uint32 user_flag, kal_uint8 access_level, kal_uint32 msg_index, const char *arg_type, ...) |
| 466 | { |
| 467 | return; |
| 468 | } |
| 469 | |
| 470 | static __inline void dhl_brief_trace(trace_class_enum trc_class, kal_uint32 user_flag, kal_uint32 msg_index, const char *arg_type, ...) |
| 471 | { |
| 472 | return; |
| 473 | } |
| 474 | |
| 475 | static __inline void dhl_raw_trace(trace_class_enum trc_class, kal_uint32 user_flag, kal_uint32 msg_index, const kal_char *fmt, kal_uint32 buf_len, const kal_uint8 *pData) |
| 476 | { |
| 477 | return; |
| 478 | } |
| 479 | |
| 480 | static __inline void dhl_print(trace_class_enum trc_class, kal_uint32 user_flag, module_type mod_id, const char *fmt, ...) |
| 481 | { |
| 482 | return; |
| 483 | } |
| 484 | |
| 485 | #define dhl_print_system_trace(_c, _s) |
| 486 | #define dhl_print_struct(_s,_m,_l,_b) |
| 487 | #define dhl_debug_print(_f, ...) |
| 488 | |
| 489 | static __inline void dhl_peer_trace(kal_uint32 global_peer_msg_id, kal_uint32 raw_data_len, kal_uint8 *raw_data, kal_uint32 trace_index, const char *arg_type, ...) |
| 490 | { |
| 491 | return; |
| 492 | } |
| 493 | |
| 494 | static __inline void dhl_trace_impl(trace_class_enum trc_class, kal_uint32 user_flag, kal_uint32 msg_index, const char *arg_type, va_list argument_info) |
| 495 | { |
| 496 | return; |
| 497 | } |
| 498 | |
| 499 | static __inline void dhl_print_impl(trace_class_enum trc_class, kal_uint32 user_flag, module_type mod_id, const char *fmt, va_list argument_info) |
| 500 | { |
| 501 | return; |
| 502 | } |
| 503 | |
| 504 | static __inline void kal_critical_trace(trace_class_enum trc_class, kal_uint32 msg_index, const kal_char *arg_type, ...) |
| 505 | { |
| 506 | return ; |
| 507 | } |
| 508 | |
| 509 | static __inline void kal_critical_brief_trace(trace_class_enum trc_class, kal_uint32 msg_index, const kal_char *arg_type, ...) |
| 510 | { |
| 511 | return ; |
| 512 | } |
| 513 | static __inline void kal_critical_assert_trace(trace_class_enum trc_class, kal_uint32 msg_index, const kal_char *arg_type, ...) |
| 514 | { |
| 515 | return ; |
| 516 | } |
| 517 | |
| 518 | |
| 519 | static __inline void kal_trace(trace_class_enum trc_class, kal_uint32 msg_index, const kal_char *arg_type, ...) |
| 520 | { |
| 521 | return ; |
| 522 | } |
| 523 | |
| 524 | static __inline void kal_brief_trace(trace_class_enum trc_class, kal_uint32 msg_index, const kal_char *arg_type, ...) |
| 525 | { |
| 526 | return ; |
| 527 | } |
| 528 | |
| 529 | static __inline void kal_brief_trace_macro(trace_class_enum trc_class, kal_uint32 msg_index, const kal_char *arg_type, ...) |
| 530 | { |
| 531 | return ; |
| 532 | } |
| 533 | |
| 534 | static __inline void kal_trace_for_3rd_party(trace_class_enum trc_class, kal_uint32 msg_index, const kal_char *arg_type, va_list argument_info) |
| 535 | { |
| 536 | return ; |
| 537 | } |
| 538 | |
| 539 | static __inline void kal_lib_trace(trace_class_enum trc_class, kal_uint32 msg_index, const kal_char *arg_type, ...) |
| 540 | { |
| 541 | return ; |
| 542 | } |
| 543 | static __inline void kal_assert_trace(trace_class_enum trc_class, kal_uint32 msg_index, const kal_char *arg_type, ...) |
| 544 | { |
| 545 | return ; |
| 546 | } |
| 547 | static __inline void kal_wap_trace(module_type mod_id, trace_class_enum trc_class, const char *fmt, ...) |
| 548 | { |
| 549 | return ; |
| 550 | } |
| 551 | static __inline void kal_print_string_trace(module_type mod_id, trace_class_enum trc_class, const char *fmt, ...) |
| 552 | { |
| 553 | return ; |
| 554 | } |
| 555 | |
| 556 | static __inline void kal_buffer_trace(trace_class_enum trc_class, kal_uint32 msg_index, const kal_char *fmt, kal_uint32 buf_len, const kal_uint8 *pData) |
| 557 | { |
| 558 | return; |
| 559 | } |
| 560 | |
| 561 | static __inline void kal_dev_trace(trace_class_enum trc_class, kal_uint32 msg_index, const char *arg_type, ...) |
| 562 | { |
| 563 | return; |
| 564 | } |
| 565 | |
| 566 | static __inline void kal_bootup_trace(trace_class_enum trc_class, kal_uint32 msg_index, const kal_char *arg_type, ...) |
| 567 | { |
| 568 | return ; |
| 569 | } |
| 570 | |
| 571 | #if !defined(__LTE_REMOVE_TEMPERAL__) |
| 572 | static __inline void kal_prompt_trace(module_type mod_id, const kal_char *fmt, ...) |
| 573 | { |
| 574 | return; |
| 575 | } |
| 576 | #endif /* end of !__LTE_REMOVE_TEMPERAL__ */ |
| 577 | #else // __DHL_TRACE_EMPTY_FUNCTION__ |
| 578 | //Define empty functions for Target SW |
| 579 | #define dhl_trace(...) |
| 580 | #define dhl_internal_trace(...) |
| 581 | #define dhl_brief_trace(...) |
| 582 | #define dhl_raw_trace(...) |
| 583 | #define dhl_print(...) |
| 584 | #define dhl_print_string(...) |
| 585 | #define dhl_print_system_trace(...) |
| 586 | |
| 587 | #define dhl_print_struct(...) |
| 588 | #define dhl_debug_print(...) |
| 589 | #define dhl_peer_trace(...) |
| 590 | |
| 591 | #define dhl_trace_impl(...) |
| 592 | #define dhl_print_impl(...) |
| 593 | #define dhl_internal_trace_impl(...) |
| 594 | |
| 595 | #define kal_trace(...) |
| 596 | #define kal_brief_trace(...) |
| 597 | #define _kal_trace(...) |
| 598 | #define _kal_brief_trace(...) |
| 599 | #define kal_brief_trace_macro(...) |
| 600 | #define kal_trace_for_3rd_party(...) |
| 601 | #define kal_lib_trace(...) |
| 602 | #define kal_assert_trace(...) |
| 603 | #define kal_wap_trace(...) |
| 604 | #define kal_print_string_trace(...) |
| 605 | #define kal_buffer_trace(...) |
| 606 | #define kal_dev_trace(...) |
| 607 | #define kal_bootup_trace(...) |
| 608 | #define kal_prompt_trace(...) |
| 609 | #define kal_critical_trace(...) |
| 610 | #define kal_critical_brief_trace(...) |
| 611 | #define kal_critical_assert_trace(...) |
| 612 | |
| 613 | #define dhl_EM_logger(...) |
| 614 | #define dhl_brief_trace_opt_helper(...) |
| 615 | #endif |
| 616 | #endif |
| 617 | |
| 618 | #define kal_sys_trace tst_sys_trace |
| 619 | #define kal_sys_init_trace tst_sys_init_trace |
| 620 | #define kal_sys_fatal_trace tst_sysfatal_trace |
| 621 | |
| 622 | #if defined(__DHL_MODULE__) |
| 623 | // TODO: liberrc_mob_com.c & kal_msg_passing.c extern tst_log_primitive, ask them to remove!! |
| 624 | extern void tst_log_primitive(ilm_struct *ilm_ptr); |
| 625 | //#define tst_log_primitive(ilm) dhl_log_primitive(ilm) |
| 626 | |
| 627 | // TODO: l1tst_fnc_l1rf.c 194 extern tst_sys_trace, ask them to remove!! |
| 628 | extern void tst_sys_trace(kal_char *info); |
| 629 | //#define tst_sys_trace(mesg) dhl_print_system_trace(TRACE_INFO,mesg) |
| 630 | |
| 631 | // these APIs can be replaced by macro directlly |
| 632 | #define tst_sysfatal_trace(mesg) dhl_print_system_trace(TRACE_ERROR, mesg) |
| 633 | #define tst_sys_init_trace tst_sys_trace |
| 634 | |
| 635 | |
| 636 | extern kal_int32 tst_trace_check_ps_filter_off(trace_class_enum trc_class, kal_uint32 *module_id, kal_uint32 supportOption); |
| 637 | |
| 638 | #define kal_bootup_print tst_sys_init_trace |
| 639 | #else |
| 640 | #ifdef __DHL_TRACE_EMPTY_FUNCTION__ |
| 641 | #if !defined(__LTE_REMOVE_TEMPERAL__) |
| 642 | static __inline void tst_sys_init_trace(const kal_char *info) |
| 643 | { |
| 644 | return ; |
| 645 | } |
| 646 | static __inline void tst_sys_trace(kal_char *info) |
| 647 | { |
| 648 | return ; |
| 649 | } |
| 650 | static __inline void tst_sysfatal_trace(kal_char *info) |
| 651 | { |
| 652 | return ; |
| 653 | } |
| 654 | static __inline kal_int32 tst_trace_check_ps_filter_off(trace_class_enum trc_class, kal_uint32 *module_id, kal_uint32 supportOption) |
| 655 | { |
| 656 | return ; |
| 657 | } |
| 658 | #endif /* end of !__LTE_REMOVE_TEMPERAL__ */ |
| 659 | #else |
| 660 | #define tst_sys_init_trace(...) |
| 661 | #define tst_sys_trace(...) |
| 662 | #define tst_sysfatal_trace(...) |
| 663 | #define tst_trace_check_ps_filter_off(...) |
| 664 | #endif |
| 665 | #endif //#ifdef __DHL_MODULE__ |
| 666 | |
| 667 | typedef void (*TST_VC_CallBack)(const kal_uint8 *pData, kal_uint32 nLen); |
| 668 | typedef void (*TST_String_Inject_CB)(kal_uint32 index, kal_uint8 *pData); |
| 669 | |
| 670 | /* |
| 671 | * tst_virtual_channel_id: |
| 672 | * regiester new virtual channel here and remake tst |
| 673 | */ |
| 674 | typedef enum |
| 675 | { |
| 676 | TVCI_GPS_LOGGING, |
| 677 | TVCI_DNT_L2COPRO_LOGGING, |
| 678 | TVCI_CATCHER_POLLING, |
| 679 | TVCI_GDB_COMM, |
| 680 | TVCI_AST_LOGGING, |
| 681 | TVCI_MINI_LOG, |
| 682 | TVCI_VM_LOGGING, |
| 683 | TVCI_BTT, |
| 684 | TVCI_LAST_ID |
| 685 | } |
| 686 | tst_virtual_channel_id; |
| 687 | |
| 688 | #define MAX_VC_RESPONSE_LEN (1023) |
| 689 | |
| 690 | kal_bool tst_vc_register_channel(tst_virtual_channel_id channel_id, TST_VC_CallBack fnCmd); |
| 691 | kal_bool tst_vc_response(tst_virtual_channel_id channel_id, const kal_uint8 *pData, kal_uint16 len); |
| 692 | void dhl_vc_send_ast_log(kal_uint8 * buf, kal_uint16 data_len); |
| 693 | |
| 694 | #define TVCI_CREATE_FILE 0x24540001 |
| 695 | #define TVCI_CLOSE_FILE 0x24540002 |
| 696 | |
| 697 | kal_bool dhl_get_assert_bypass_buf(kal_char **buf, kal_uint32 *buf_size, kal_uint32 *buf_index); |
| 698 | kal_bool dhl_ack_assert_bypass_buf(kal_char *buf, kal_uint32 message_size, kal_uint32 buf_index); |
| 699 | |
| 700 | void dhl_log_primitive6(module_type src_mod_id, module_type dest_mod_id, sap_type sap_id, msg_type msg_id, local_para_struct *local_para_ptr, peer_buff_struct *peer_buff_ptr); |
| 701 | |
| 702 | typedef enum |
| 703 | { |
| 704 | DHL_CUSTOM_MEM_PMIC, |
| 705 | DHL_CUSTOM_MEM_MIPI, |
| 706 | DHL_CUSTOM_MEM_MAX |
| 707 | } DHL_CUSTOM_MEM_TYPE; |
| 708 | |
| 709 | typedef void (*DHL_CUSTOM_READ_MEM_CALLBACK)(void *read_addr, kal_uint32 len, kal_uint32 option, void **read_buffer_addr, kal_uint32 *read_buffer_len); |
| 710 | typedef void (*DHL_CUSTOM_READ_MEM_DONE_CALLBACK)(void *read_addr, kal_uint32 len, kal_uint32 option); |
| 711 | typedef void (*DHL_CUSTOM_WRITE_MEM_CALLBACK)(void *write_addr, kal_uint32 len, kal_uint32 option, void *write_buffer_addr); |
| 712 | |
| 713 | kal_bool dhl_register_custom_mem_read(DHL_CUSTOM_MEM_TYPE mem_type, DHL_CUSTOM_READ_MEM_CALLBACK read_cb); |
| 714 | kal_bool dhl_register_custom_mem_read_done(DHL_CUSTOM_MEM_TYPE mem_type, DHL_CUSTOM_READ_MEM_DONE_CALLBACK read_done_cb); |
| 715 | kal_bool dhl_register_custom_mem_write(DHL_CUSTOM_MEM_TYPE mem_type, DHL_CUSTOM_WRITE_MEM_CALLBACK write_cb); |
| 716 | |
| 717 | #ifdef __cplusplus |
| 718 | } |
| 719 | #endif |
| 720 | |
| 721 | |
| 722 | typedef enum |
| 723 | { |
| 724 | /* 0~7 reserve for L2 PDU */ |
| 725 | /* should not over DHL_L2_PDU_TYPE_NUM */ |
| 726 | DHL_L2_PDU_MAC_TYPE = 1, |
| 727 | DHL_L2_PDU_RLC_TYPE = 2, |
| 728 | DHL_L2_PDU_PDCP_TYPE = 3, |
| 729 | DHL_L2_PDU_RLC_PDU_TYPE = 4, |
| 730 | } dhl_log_pdu_type; |
| 731 | |
| 732 | void dhl_log_pdu(dhl_log_pdu_type type, kal_uint8 *data, kal_uint32 length); |
| 733 | void dhl_flush_pdu(dhl_log_pdu_type type); |
| 734 | kal_bool dhl_check_pdu_filter(dhl_log_pdu_type type); |
| 735 | |
| 736 | #define DHL_MAC_CHECK_L2_PDU() dhl_check_pdu_filter(DHL_L2_PDU_MAC_TYPE) |
| 737 | #define DHL_RLC_CHECK_L2_PDU() (dhl_check_pdu_filter(DHL_L2_PDU_RLC_TYPE) || dhl_check_pdu_filter(DHL_L2_PDU_RLC_PDU_TYPE)) |
| 738 | #define DHL_PDCP_CHECK_L2_PDU() dhl_check_pdu_filter(DHL_L2_PDU_PDCP_TYPE) |
| 739 | |
| 740 | #define DHL_MAC_LOG_L2_PDU(pointer, length) do { \ |
| 741 | if(DHL_MAC_CHECK_L2_PDU()) { \ |
| 742 | dhl_log_pdu(DHL_L2_PDU_MAC_TYPE, pointer, length);\ |
| 743 | } \ |
| 744 | } while(0) |
| 745 | #define DHL_RLC_LOG_L2_PDU(pointer, length) do { \ |
| 746 | if(DHL_RLC_CHECK_L2_PDU()) { \ |
| 747 | dhl_log_pdu(DHL_L2_PDU_RLC_TYPE, pointer, length);\ |
| 748 | } \ |
| 749 | } while(0) |
| 750 | #define DHL_PDCP_LOG_L2_PDU(pointer, length) do { \ |
| 751 | if(DHL_PDCP_CHECK_L2_PDU()) { \ |
| 752 | dhl_log_pdu(DHL_L2_PDU_PDCP_TYPE, pointer, length);\ |
| 753 | } \ |
| 754 | }while(0) |
| 755 | |
| 756 | #endif |
| 757 | #endif /* _DHL_TRACE_H */ |
| 758 | |