[Feature]Upload Modem source code
Change-Id: Id4294f30faced84d3e6fd6d5e61e1111bf287a37
diff --git a/mcu/driver/devdrv/tia/inc/tia.h b/mcu/driver/devdrv/tia/inc/tia.h
new file mode 100644
index 0000000..8fa8880
--- /dev/null
+++ b/mcu/driver/devdrv/tia/inc/tia.h
@@ -0,0 +1,188 @@
+/*****************************************************************************
+* Copyright Statement:
+* --------------------
+* This software is protected by Copyright and the information contained
+* herein is confidential. The software may not be copied and the information
+* contained herein may not be used or disclosed except with the written
+* permission of MediaTek Inc. (C) 2017
+*
+* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
+* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
+* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
+* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
+* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
+* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
+* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
+* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
+* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
+* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
+* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
+*
+* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
+* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
+* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
+* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
+* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
+*
+* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
+* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
+* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
+* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
+* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
+*
+*****************************************************************************/
+
+/*******************************************************************************
+ *
+ * Filename:
+ * ---------
+ * tia.h
+ *
+ * Project:
+ * --------
+ * VMOLY
+ *
+ * Description:
+ * ------------
+ * TIA (Thermal Information Acquisition) driver internal header for MD thermal
+ *
+ * Author:
+ * -------
+ * -------
+ *
+ *============================================================================
+ * HISTORY
+ * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *------------------------------------------------------------------------------
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ * removed!
+ *------------------------------------------------------------------------------
+ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *============================================================================
+ ****************************************************************************/
+
+#ifndef __TIA_H__
+#define __TIA_H__
+
+#include "kal_general_types.h"
+#include "thermal_public.h"
+#include "tfwk_public.h"
+#include "ptp_public.h"
+#include "tia_public.h"
+#include "dhl_trace.h"
+#ifdef __DHL_MODULE__
+#include "tia_trace_utmd.h"
+#endif
+
+//******************************************************************************
+// tia.c
+//******************************************************************************
+// TIA sensor number, Sensor_ID (global) -> Tia_ID (local, 0~) -> Ntc_ID (physical, 0~) -> NTC (schematic, 1~)
+#define TIA_SENSOR_NUM THERMAL_TIA_SENSOR_NUM
+#define TIA_SENSOR_SID(tid) THERMAL_TIA_SENSOR_ID(tid) /* TID to SID */
+#define TIA_SENSOR_SID_VALID(sid) (((sid) >= TIA_SENSOR_SID(0)) && ((sid) <= TIA_SENSOR_SID(TIA_SENSOR_NUM-1)))
+#define TIA_SENSOR_TID(sid) ((sid) - TIA_SENSOR_SID(0)) /* SID to TID */
+#define TIA_SENSOR_TID_VALID(tid) ((tid) < TIA_SENSOR_NUM)
+extern const kal_uint32 tia_sensor_map[TIA_SENSOR_NUM];
+#define TIA_SENSOR_NID(tid) (tia_sensor_map[tid])
+
+// tia initialization
+void tia_init(void);
+
+// tia set alarm
+// @ncfg: [in] number of config list
+// @tcfgs: [in,out] pointer to tfwk_thermal_cfg_t list
+// @return: error code, refer to THERMAL_ERR_XXX @thermal_public.h
+kal_int32 tia_set_alarm(kal_uint32 ncfg, tfwk_thermal_cfg_t* tcfgs);
+
+// tia debug message
+// @tid: [in] tia id (0~)
+void tia_dbg_sns_infs(kal_uint32 tid);
+void tia_dbg_thr_cfgs(kal_uint32 tid);
+void tia_dbg_thr_mons(kal_uint32 tid);
+// tia debug control - fake adc reg
+// @en: [in] enable
+// @tid: [in] tia id (0~)
+// @ohm: [in] fake ohm
+void tia_dbg_fake_en(kal_bool en);
+void tia_dbg_fake_ohm(kal_uint32 tid, kal_uint32 ohm);
+// tia debug control - toprgu sw reset
+void tia_dbg_sw_reset(void);
+// tia debug get internal symbol
+void* tia_dbg_symbol(kal_char *sym);
+
+//******************************************************************************
+// tia_adc.c
+//******************************************************************************
+// TIA adc bit mode: 15 (default) or 12
+#define TIA_ADC_BIT_MODE 15
+
+// TIA adc to temperature range
+#define TIA_ADC_TMP_MIN (-40)
+#define TIA_ADC_TMP_MAX (125)
+#define TIA_ADC_TMP_CNT (TIA_ADC_TMP_MAX - TIA_ADC_TMP_MIN + 1)
+#define TIA_ADC_TMP_ERR 0x7FFF
+
+// TIA ADC pull-up resistor setting
+typedef enum {
+ TIA_ADC_RC_100K = 0,
+ TIA_ADC_RC_30K,
+ TIA_ADC_RC_400K,
+ TIA_ADC_RC_MAX,
+ TIA_ADC_RC_FAKE = TIA_ADC_RC_MAX
+} tia_adc_rc_type_e;
+extern const kal_uint32 tia_adc_rc2k_map[];
+#define TIA_ADC_RC2K(rc) (tia_adc_rc2k_map[rc])
+
+// tia rc_adc value to ohm
+// @rc: pull-up resistor, refer to tia_adc_rc_type_e
+// @adc: adc value
+// @return: ohm
+kal_uint32 tia_adc_to_ohm(tia_adc_rc_type_e rc, kal_uint32 adc);
+
+// tia rc_adc value to temperature in 1/10th of Celsius Degree
+// @rc: pull-up resistor, refer to tia_adc_rc_type_e
+// @adc: adc value
+// @return: temperature in 1/10th of Celsius Degree
+kal_int32 tia_adc_to_tmp(tia_adc_rc_type_e rc, kal_uint32 adc);
+
+// tia adc formula setup from pmic auxadc efuse
+void tia_adc_init(void);
+
+// tia adc debug message, auxadc efuse
+void tia_adc_dbg_efuse(kal_int32 *V18, kal_int32 *Rinb);
+
+//******************************************************************************
+// tia_atcmd.c
+//******************************************************************************
+// tia atcmd initialization
+void tia_atcmd_init(void);
+
+//******************************************************************************
+// remap to lvts interface
+//******************************************************************************
+#define TIA_LVTS_GET_TEMP(sid, tmp) lvts_get_temp(sid, tmp) // fake: ({*(tmp)=250; 0;})
+#define TIA_LVTS_GET_ALL_NUM 4
+#define TIA_LVTS_GET_ALL_TEMP(n, tmps) lvts_get_all_temp(n, tmps)
+#ifdef MT6297
+ #define TIA_LVTS_HW_RGU_RESET() tia_dbg_sw_reset()
+#else
+ #define TIA_LVTS_HW_RGU_RESET() lvts_hw_rgu_reset()
+#endif
+
+#endif