[Feature]Upload Modem source code

Change-Id: Id4294f30faced84d3e6fd6d5e61e1111bf287a37
diff --git a/mcu/service/esl_debug/inc/esl_debug.h b/mcu/service/esl_debug/inc/esl_debug.h
new file mode 100644
index 0000000..db035fa
--- /dev/null
+++ b/mcu/service/esl_debug/inc/esl_debug.h
@@ -0,0 +1,62 @@
+#ifndef __ESL_DEBUG_H__
+#define __ESL_DEBUG_H__
+
+#define ESL_SIM_TIME_FLAG    (1UL<<0)
+#define ESL_WALL_TIME_FLAG   (1UL<<1)
+#define ESL_COUNT_MCPS_FLAG  (1UL<<2)
+#define ESL_CUSTOM_FLAG      (1UL<<3)
+
+//For ESL Simulation
+#define ESL_UART_BASE      (ESL_REG_BANK + 0x7010000)
+#define ESL_UART_OUT       (ESL_UART_BASE+0x000)
+#define ESL_UART_FLAG      (ESL_UART_BASE+0x004)
+#define ESL_PROF_V0T0_OUT  (ESL_UART_BASE+0x008)
+#define ESL_PROF_V0T0_FLAG (ESL_UART_BASE+0x00C)
+#define ESL_PROF_V2T0_OUT  (ESL_UART_BASE+0x208)
+#define ESL_PROF_V2T0_FLAG (ESL_UART_BASE+0x20C)
+#define ESL_PROF_V4T0_OUT  (ESL_UART_BASE+0x408)
+#define ESL_PROF_V4T0_FLAG (ESL_UART_BASE+0x40C)
+
+#define ESL_PROF_OUT(vpe, tc)  (ESL_UART_BASE | (((vpe)&0xF)<<8) | (((tc)&0xF)<<4) | 0x8)
+#define ESL_PROF_FLAG(vpe, tc) (ESL_UART_BASE | (((vpe)&0xF)<<8) | (((tc)&0xF)<<4) | 0xC)
+
+#define ESL_TCKTL_UTIL_BASE        (ESL_REG_BANK + 0x1002000UL)
+#define ESL_EMI_READ_LAT_REG    (ESL_TCKTL_UTIL_BASE)
+#if !defined(__MD97__)
+#define ESL_EMI_WRITE_LAT_REG    (ESL_TCKTL_UTIL_BASE+0x04)
+#define ESL_EMI_STALL_EN_REG    (ESL_TCKTL_UTIL_BASE+0x08)
+#else
+#define ESL_EMI_WRITE_LAT_REG    (ESL_TCKTL_UTIL_BASE+0x08)
+#define ESL_EMI_STALL_EN_REG    (ESL_TCKTL_UTIL_BASE+0x10)
+#endif
+
+#if defined(__ESL_MASE_GEN97__)
+#include "mase_debug.h"
+#else /* __ESL_MASE_GEN97__ */
+#if defined(__ESL_DBG_UTIL__) && defined(__ESL_HRT__)
+	#define esl_printf(flag, string_to_be_printed...) do {__esl_printf_flag(flag, string_to_be_printed);} while(0)
+	extern int __esl_printf_flag(kal_uint32 flag, const char *fmt, ...);
+    extern int __esl_profiling(kal_uint32 flag, const char *fmt, ...);
+#else
+	#define esl_printf(...) do {;}while(0)
+#endif
+#endif /* __ESL_MASE_GEN97__ */
+
+#define ESL_PLATFORM_SPEEDUP_CONFIG_CLEAR()    do { \
+                    *((volatile unsigned int*)ESL_EMI_READ_LAT_REG)  = 0x30000000; \
+                    *((volatile unsigned int*)ESL_EMI_WRITE_LAT_REG) = 0x30000000; \
+                    *((volatile unsigned int*)ESL_EMI_STALL_EN_REG)  = 0x00000000; \
+                    MO_Sync(); \
+    } while(0)
+
+
+#define ESL_PLATFORM_SPEEDUP_CONFIG_RESTORE()    do { \
+                    *((volatile unsigned int*)ESL_EMI_READ_LAT_REG)  = 0x20000000; \
+                    *((volatile unsigned int*)ESL_EMI_WRITE_LAT_REG) = 0x20000000; \
+                    *((volatile unsigned int*)ESL_EMI_STALL_EN_REG)  = 0x00000001; \
+                    MO_Sync(); \
+    } while(0)
+
+
+#endif /* __ESL_DEBUG_H__ */
+
diff --git a/mcu/service/esl_debug/inc/esl_extern_case.h b/mcu/service/esl_debug/inc/esl_extern_case.h
new file mode 100644
index 0000000..20fe456
--- /dev/null
+++ b/mcu/service/esl_debug/inc/esl_extern_case.h
@@ -0,0 +1,58 @@
+#ifndef __ESL_EXTERN_CASE_H__
+#define __ESL_EXTERN_CASE_H__
+
+/* SS test array */
+extern UFPS_CP el1_basic_l_profile_core0_list_CPUEVAL[];
+extern UFPS_CP esl_basic_l_profile_core0_list_0[];
+extern UFPS_CP esl_basic_l_profile_core0_list_1[];
+extern UFPS_CP esl_basic_l_profile_core0_list_MT[];
+extern UFPS_CP esl_benchmark_test[];
+extern UFPS_CP esl_func_and_marker_test[];
+extern UFPS_CP nr_esl_entry_list_rx[];
+extern UFPS_CP nr_esl_entry_list_rfcc[];
+extern UFPS_CP nr_esl_entry_list_rxagc[];
+extern UFPS_CP nr_esl_entry_list_rxdfe[];
+extern UFPS_CP nr_esl_entry_list_cm[];
+extern UFPS_CP nr_esl_entry_list_fwk[];
+extern UFPS_CP nr_esl_entry_list_cs[];
+extern UFPS_CP nr_esl_entry_list_ps[];
+extern UFPS_CP nr_esl_entry_list_txtpc[];
+extern UFPS_CP nr_esl_entry_list_txdfe[];
+extern UFPS_CP nr_esl_entry_list_rfd[];
+extern UFPS_CP mml1_esl_entry_list_endc[];
+extern UFPS_CP nr_esl_entry_list_tx[];
+extern UFPS_CP el1_esl_entry_list_rx[];
+extern UFPS_CP el1_esl_entry_list_rxagc[];
+extern UFPS_CP el1_esl_entry_list_rxdfe[];
+extern UFPS_CP nr_esl_entry_list_L1coremark[];
+extern UFPS_CP nr_esl_entry_list_L1coremark_00[];
+extern UFPS_CP nr_esl_entry_list_L1coremark_01[];
+extern UFPS_CP nr_esl_entry_list_L1coremark_02[];
+extern UFPS_CP nr_esl_entry_list_L1coremark_03[];
+extern UFPS_CP nr_esl_entry_list_L1coremark_04[];
+extern UFPS_CP nr_esl_entry_list_L1coremark_05[];
+extern UFPS_CP nr_esl_entry_list_L1coremark_06[];
+extern UFPS_CP nr_esl_entry_list_L1coremark_07[];
+extern UFPS_CP nr_esl_entry_list_L1coremark_08[];
+extern UFPS_CP nr_esl_entry_list_L1coremark_09[];
+extern UFPS_CP nr_esl_entry_list_L1coremark_10[];
+extern UFPS_CP nr_esl_entry_list_L1coremark_11[];
+extern UFPS_CP nr_esl_entry_list_L1coremark_12[];
+extern UFPS_CP nr_esl_entry_list_L1coremark_13[];
+extern UFPS_CP nr_esl_entry_list_L1coremark_14[];
+extern UFPS_CP nr_esl_entry_list_L1coremark_15[];
+extern UFPS_CP nr_esl_entry_list_L1coremark_16[];
+extern UFPS_CP nr_esl_entry_list_L1coremark_17[];
+extern UFPS_CP nr_esl_entry_list_L1coremark_18[];
+extern UFPS_CP nr_esl_entry_list_L1coremark_19[];
+extern UFPS_CP nr_esl_entry_list_L1coremark_20[];
+extern UFPS_CP nr_esl_entry_list_L1coremark_21[];
+extern UFPS_CP nr_esl_entry_list_L1coremark_22[];
+extern UFPS_CP nr_esl_entry_list_L1coremark_23[];
+extern UFPS_CP nr_esl_entry_list_L1coremark_24[];
+extern UFPS_CP nr_esl_entry_list_L1coremark_25[];
+extern UFPS_CP nr_esl_entry_list_L1coremark_26[];
+extern UFPS_CP nr_esl_entry_list_L1coremark_27[];
+extern UFPS_CP nr_esl_entry_list_L1coremark_28[];
+extern UFPS_CP nr_esl_entry_list_L1coremark_29[];
+#endif
diff --git a/mcu/service/esl_debug/inc/mase_debug.h b/mcu/service/esl_debug/inc/mase_debug.h
new file mode 100644
index 0000000..b9e515e
--- /dev/null
+++ b/mcu/service/esl_debug/inc/mase_debug.h
@@ -0,0 +1,74 @@
+#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__ */
+
diff --git a/mcu/service/esl_debug/inc/spv_drv.h b/mcu/service/esl_debug/inc/spv_drv.h
new file mode 100644
index 0000000..48ac390
--- /dev/null
+++ b/mcu/service/esl_debug/inc/spv_drv.h
@@ -0,0 +1,11 @@
+#ifndef __SPV_DEBUG_H__
+#define __SPV_DEBUG_H__
+
+#define esl_printf(...)  
+//#define esl_printf(flag, string_to_be_printed...) do {dbg_print(string_to_be_printed);} while(0)
+
+extern void spv_ufps_platform_init();
+extern void spv_ufps_platform_report(kal_uint32 test_arr, kal_uint32 index);
+extern void spv_ufps_pmu_log(kal_uint32 core, kal_uint32 tc);
+
+#endif