blob: b9e515ee913aeff1ce55c53fda035446292dc00e [file] [log] [blame]
#ifndef __MASE_DEBUG_H__
#define __MASE_DEBUG_H__
#include "esl_debug.h"
//Description of #defines used to control amount of logging in ESL (PXP/VPX) and MODIS-HW-COPRO simulation.
//In MODIS-HW-COPRO (it's a MASE build of L234 protocol stack + ESL HW models + data generators):
// We always log everything (as performance is not an issue on the PC), unless is __DISABLE_ESL_DBG_PRINT__ defined (then logging is off).
// As this is pure PC build, __MTK_TARGET__ is NOT defined.
//
//In ESL (PXP/VPX environment):
// __ESL_DBG_UTIL__ needs to be enabled to get any logging out.
// 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.
// If __DISABLE_ESL_DBG_PRINT__ is NOT defined: we get full logs (slow, but great when debugging).
// ESL has __MTK_TARGET__ defined switched ON.
#if defined(__ESL_DBG_UTIL__)
#ifdef __DISABLE_ESL_DBG_PRINT__
#define esl_printf(...)
#else
#define esl_printf(flag, string_to_be_printed...) do {__esl_printf_flag(flag, string_to_be_printed);} while(0)
#endif /* __DISABLE_ESL_DBG_PRINT__ */
#else
#if !defined(__MTK_TARGET__) && !defined (__DISABLE_ESL_DBG_PRINT__)
#define esl_printf(lev, ...) printf(__VA_ARGS__)
#else
#define esl_printf(...)
#endif
#endif
/* Special esl_printf which always comes out
* NOTE: Do not use within any code you are profiling
*/
#if defined (__MTK_TARGET__)
#define esl_fixed_printf(flag, string_to_be_printed...) do {__esl_printf_flag(flag, string_to_be_printed);} while(0)
#else
#define esl_fixed_printf(lev, ...) printf(__VA_ARGS__)
#endif
extern int __esl_printf_flag(kal_uint32 flag, const char *fmt, ...);
extern int __esl_profiling(kal_uint32 flag, const char *fmt, ...);
/**************************************** VARIOUS HACKS to minimize ammount of protocol stack code changes **********************************/
#define LOG_NPDCP_DECIPHER_DONE_HANDLER_CALLED() esl_printf(1, "npdcp_decipher_done_handler called\r\n");
/* used in ndpcp_dl_deliver.c */
extern kal_bool dl_check_deliver_cf0_count_valid;
/* used in epdcp_dl.c */
//Notify enl1_adapt.c test that data has been delivered
#define LOG_DLVR_DIDID_TO_UPPER_NRO() dl_check_dlvr_dids_to_upper_layers_valid = KAL_TRUE;
extern kal_bool dl_check_dlvr_dids_to_upper_layers_valid;
//this overrides macro in dispatch_deliver API to do MASE specific logging
#undef MD_TRC_ENPDCP_DL_LOG_DISPATCH_DELIVER
//test if PDUs are delivered in sequence without any gaps (this would mean that offline/segmented data path works correctly)
#define MD_TRC_ENPDCP_DL_LOG_DISPATCH_DELIVER(...)\
if (p_begin->cf == 0) {\
static int prev_count = -1;\
ASSERT(prev_count + 1 == count_begin);\
prev_count += total;\
esl_printf(1,"deliver_cf0 count begin: %d, end: %d, total: %d\n", count_begin, prev_count, total);\
if (prev_count != count_begin)\
{\
dl_check_deliver_cf0_count_valid = KAL_TRUE;\
}\
}
/* epdcp_dl_poll_pit_drbam_nrohc_lhif_nro should have has_new_nml_sdu set, and call epdcp_log_dl_nml_data_pdu */
#undef MD_TRC_EPDCP_DL_LOG_DRB_PROC_NML_SDUS
#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);
#endif /* __MASE_DEBUG_H__ */