blob: b9e515ee913aeff1ce55c53fda035446292dc00e [file] [log] [blame]
rjw6c1fd8f2022-11-30 14:33:01 +08001#ifndef __MASE_DEBUG_H__
2#define __MASE_DEBUG_H__
3
4#include "esl_debug.h"
5
6//Description of #defines used to control amount of logging in ESL (PXP/VPX) and MODIS-HW-COPRO simulation.
7//In MODIS-HW-COPRO (it's a MASE build of L234 protocol stack + ESL HW models + data generators):
8// We always log everything (as performance is not an issue on the PC), unless is __DISABLE_ESL_DBG_PRINT__ defined (then logging is off).
9// As this is pure PC build, __MTK_TARGET__ is NOT defined.
10//
11//In ESL (PXP/VPX environment):
12// __ESL_DBG_UTIL__ needs to be enabled to get any logging out.
13// If __DISABLE_ESL_DBG_PRINT__ is defined: only critical logging is performed (using esl_fixed_printf), all other logging is OFF. Use this mode for benchmarks.
14// If __DISABLE_ESL_DBG_PRINT__ is NOT defined: we get full logs (slow, but great when debugging).
15// ESL has __MTK_TARGET__ defined switched ON.
16#if defined(__ESL_DBG_UTIL__)
17#ifdef __DISABLE_ESL_DBG_PRINT__
18 #define esl_printf(...)
19#else
20 #define esl_printf(flag, string_to_be_printed...) do {__esl_printf_flag(flag, string_to_be_printed);} while(0)
21#endif /* __DISABLE_ESL_DBG_PRINT__ */
22
23#else
24 #if !defined(__MTK_TARGET__) && !defined (__DISABLE_ESL_DBG_PRINT__)
25 #define esl_printf(lev, ...) printf(__VA_ARGS__)
26 #else
27 #define esl_printf(...)
28 #endif
29#endif
30
31/* Special esl_printf which always comes out
32 * NOTE: Do not use within any code you are profiling
33 */
34#if defined (__MTK_TARGET__)
35#define esl_fixed_printf(flag, string_to_be_printed...) do {__esl_printf_flag(flag, string_to_be_printed);} while(0)
36#else
37#define esl_fixed_printf(lev, ...) printf(__VA_ARGS__)
38#endif
39
40extern int __esl_printf_flag(kal_uint32 flag, const char *fmt, ...);
41extern int __esl_profiling(kal_uint32 flag, const char *fmt, ...);
42
43/**************************************** VARIOUS HACKS to minimize ammount of protocol stack code changes **********************************/
44#define LOG_NPDCP_DECIPHER_DONE_HANDLER_CALLED() esl_printf(1, "npdcp_decipher_done_handler called\r\n");
45
46/* used in ndpcp_dl_deliver.c */
47extern kal_bool dl_check_deliver_cf0_count_valid;
48
49/* used in epdcp_dl.c */
50//Notify enl1_adapt.c test that data has been delivered
51#define LOG_DLVR_DIDID_TO_UPPER_NRO() dl_check_dlvr_dids_to_upper_layers_valid = KAL_TRUE;
52extern kal_bool dl_check_dlvr_dids_to_upper_layers_valid;
53
54//this overrides macro in dispatch_deliver API to do MASE specific logging
55#undef MD_TRC_ENPDCP_DL_LOG_DISPATCH_DELIVER
56
57//test if PDUs are delivered in sequence without any gaps (this would mean that offline/segmented data path works correctly)
58#define MD_TRC_ENPDCP_DL_LOG_DISPATCH_DELIVER(...)\
59 if (p_begin->cf == 0) {\
60 static int prev_count = -1;\
61 ASSERT(prev_count + 1 == count_begin);\
62 prev_count += total;\
63 esl_printf(1,"deliver_cf0 count begin: %d, end: %d, total: %d\n", count_begin, prev_count, total);\
64 if (prev_count != count_begin)\
65 {\
66 dl_check_deliver_cf0_count_valid = KAL_TRUE;\
67 }\
68 }
69
70/* epdcp_dl_poll_pit_drbam_nrohc_lhif_nro should have has_new_nml_sdu set, and call epdcp_log_dl_nml_data_pdu */
71#undef MD_TRC_EPDCP_DL_LOG_DRB_PROC_NML_SDUS
72#define MD_TRC_EPDCP_DL_LOG_DRB_PROC_NML_SDUS(rb_idx, first_proc_cntl, cur_proc_cntl) esl_printf(1, "EPDCP DL: last_subm_cntl %d\n", cur_proc_cntl);
73#endif /* __MASE_DEBUG_H__ */
74