[Feature]Upload Modem source code
Change-Id: Id4294f30faced84d3e6fd6d5e61e1111bf287a37
diff --git a/mcu/driver/devdrv/gpt/inc/dcl_gpt_hw.h b/mcu/driver/devdrv/gpt/inc/dcl_gpt_hw.h
new file mode 100644
index 0000000..69e02fe
--- /dev/null
+++ b/mcu/driver/devdrv/gpt/inc/dcl_gpt_hw.h
@@ -0,0 +1,489 @@
+/*****************************************************************************
+* 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) 2001
+*
+*****************************************************************************/
+
+/*****************************************************************************
+ *
+ * Filename:
+ * ---------
+ * dcl_gpt.h
+ *
+ * Project:
+ * --------
+ * Maui
+ *
+ * Description:
+ * ------------
+ * Header file of DCL (Driver Common Layer) for GPT.
+ *
+ * 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!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ * removed!
+ * removed!
+ * removed!
+ *
+ *------------------------------------------------------------------------------
+ * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
+ *============================================================================
+ ****************************************************************************/
+
+/*******************************************************************************
+ * DCL_CTRL_CMD
+ *******************************************************************************/
+#ifndef DCL_GPT_HW_H_
+#define DCL_GPT_HW_H_
+#include "kal_general_types.h"
+#include "drv_comm.h"
+#include "dcl.h"
+
+typedef DCL_UINT16 GPT_DEV;
+typedef enum
+{
+ GPT1 = 1,
+ GPT2 = 2,
+ GPT3 = 3,
+ GPT4 = 4
+} GPT_DEV_T;
+
+typedef enum
+{
+ clk_16k,
+ clk_8k,
+ clk_4k,
+ clk_2k,
+ clk_1k,
+ clk_500,
+ clk_250,
+ clk_125,
+ clk_invalid=0xFF
+}gpt_clock;
+
+typedef DCL_UINT32 HGPT_CMD;
+typedef enum
+{
+
+ HGPT_CMD_CLK,
+ HGPT_CMD_RESET,
+ HGPT_CMD_START,
+ HGPT_CMD_STOP,
+ HGPT_CMD_BUSYWAIT,
+// HGPT_CMD_GPT_STATUS,
+ FHGPT_CMD_START,
+ FHGPT_CMD_STOP,
+ FHGPT_CMD_RETURN_COUNT,
+ FHGPT_CMD_LOCK
+} HGPT_CMD_T;
+
+/* For HGPT_CMD_CLK command. */
+typedef enum
+{
+ CLK_16K,
+ CLK_8K,
+ CLK_4K,
+ CLK_2K,
+ CLK_1K,
+ CLK_500,
+ CLK_250,
+ CLK_125
+} HGPT_CLK_T;
+
+typedef struct
+{
+ DCL_UINT32 u4Clock; // for HGPT_CLK_T enum
+} HGPT_CTRL_CLK_T;
+
+/* For HGPT_CMD_RESET command. */
+typedef struct
+{
+ DCL_UINT16 u2CountValue;
+ DCL_BOOL fgAutoReload;
+} HGPT_CTRL_RESET_T;
+
+/* For HGPT_CMD_RESET command. */
+//typedef DCL_UINT16 FGPT_CTRL_RETURN_COUNT_T;
+typedef DCL_UINT32 FGPT_CTRL_RETURN_COUNT_T_32bit;
+typedef DCL_UINT16 BUSY_WAIT_COUNT_T;
+typedef DCL_BOOL FGPT_CTRL_LOCK_T;
+//typedef DCL_UINT8 GPT_STATUS_T;
+typedef union
+{
+ HGPT_CTRL_CLK_T rHGPTClk;
+ HGPT_CTRL_RESET_T rHGPTReset;
+ FGPT_CTRL_RETURN_COUNT_T u2RetCount;
+ FGPT_CTRL_RETURN_COUNT_T_32bit u2RetCount_32bit;
+ BUSY_WAIT_COUNT_T uBusyWaitCount;
+ FGPT_CTRL_LOCK_T ulock;
+// GPT_STATUS_T gpt_status;
+} HGPT_CTRL;
+
+void GPTI_BusyWait(kal_uint16 len);
+/* DCL for HW GPT */
+/*************************************************************************
+* FUNCTION
+* DclHGPT_Initialize
+*
+* DESCRIPTION
+* This function is to initialize HW GPT module.
+*
+* PARAMETERS
+* None
+*
+* RETURNS
+* DCL_STATUS_OK
+*
+*************************************************************************/
+extern DCL_STATUS DclHGPT_Initialize(void);
+
+/*************************************************************************
+* FUNCTION
+* DclHGPT_Open
+*
+* DESCRIPTION
+* This function is to open a HW GPT module. Note that HW GPT only supports
+* single open for each valid eDev and if DCL_GPT1 is chosen SGPT may be
+* influenced and work abnormally.
+*
+* PARAMETERS
+* eDev - only valid for DCL_GPT1 and DCL_GPT2
+* flags - no sepcial flags is needed. Please use FLAGS_NONE
+*
+* RETURNS
+* DCL_HANDLE_INVALID - Open failed.
+* other value - a valid handle
+*
+*************************************************************************/
+extern DCL_HANDLE DclHGPT_Open(DCL_DEV dev, DCL_FLAGS flags);
+
+/*************************************************************************
+* FUNCTION
+* DclHGPT_ReadData
+*
+* DESCRIPTION
+* This function is not supported for the HW GPT module now.
+*
+* PARAMETERS
+* N/A
+*
+* RETURNS
+* STATUS_UNSUPPORTED
+*
+*************************************************************************/
+extern DCL_STATUS DclHGPT_ReadData(DCL_HANDLE handle, DCL_BUFF *buff, DCL_BUFF_LEN *buf_len, DCL_OPTIONS options);
+
+/*************************************************************************
+* FUNCTION
+* DclHGPT_WriteData
+*
+* DESCRIPTION
+* This function is not supported for the HW GPT module now.
+*
+* PARAMETERS
+* N/A
+*
+* RETURNS
+* STATUS_UNSUPPORTED
+*
+*************************************************************************/
+extern DCL_STATUS DclHGPT_WriteData(DCL_HANDLE handle, DCL_BUFF *buff, DCL_BUFF_LEN *buf_len, DCL_OPTIONS options);
+
+/*************************************************************************
+* FUNCTION
+* DclHGPT_Configure
+*
+* DESCRIPTION
+* This function is not supported for the HW GPT module now.
+*
+* PARAMETERS
+* N/A
+*
+* RETURNS
+* STATUS_UNSUPPORTED
+*
+*************************************************************************/
+extern DCL_STATUS DclHGPT_Configure(DCL_HANDLE handle, DCL_CONFIGURE_T *configure);
+
+/*************************************************************************
+* FUNCTION
+* DclHGPT_RegisterCallback
+*
+* DESCRIPTION
+* This function is to set callback function for the HW GPT module.
+*
+* PARAMETERS
+* handle - hanlde previous got from DclHGPT_Open().
+* event - only support EVENT_HGPT_TIMEOUT event.
+* callback - the callback function when HW GPT is timeout.
+*
+* RETURNS
+* STATUS_OK - successfully register the callback function.
+* STATUS_INVALID_HANDLE - It's a invalid handle.
+* STATUS_NOT_OPENED - The module has not been opened.
+* STATUS_INVALID_EVENT - The event parameter is invalid.
+*
+*************************************************************************/
+extern DCL_STATUS DclHGPT_RegisterCallback(DCL_HANDLE handle, DCL_EVENT event, PFN_DCL_CALLBACK callback);
+
+/*************************************************************************
+* FUNCTION
+* DclHGPT_Control
+*
+* DESCRIPTION
+* This function is to send command to control the HW GPT module.
+*
+* PARAMETERS
+* handle - a valid handle return by DclHGPT_Open()
+* cmd - a control command for HW GPT module
+* 1. HGPT_CMD_CLK: to set clock for a HW GPT timer
+* 2. HGPT_CMD_RESET: to reset a HWGPT timer
+* 3. HGPT_CMD_START: to start a HW GPT timer
+* 4. HGPT_CMD_STOP: to stop a HWGPT timer
+* data - for 1. HGPT_CMD_CLK: pointer to a HGPT_CTRL_CLK_T structure
+* 2. HGPT_CMD_RESET: pointer to a HGPT_CTRL_RESET_T structure
+* 3. HGPT_CMD_START: a NULL pointer
+* 4. HGPT_CMD_STOP: a NULL pointer
+*
+* RETURNS
+* STATUS_OK - command is executed successfully.
+* STATUS_FAIL - command is failed.
+* STATUS_INVALID_CMD - The command is invalid.
+* STATUS_INVALID_HANDLE - The handle is invalid.
+* STATUS_INVALID_CTRL_DATA - The ctrl data is not valid.
+*
+*************************************************************************/
+extern DCL_STATUS DclHGPT_Control(DCL_HANDLE handle, HGPT_CMD cmd, HGPT_CTRL *data);
+
+/*************************************************************************
+* FUNCTION
+* DclHGPT_Close
+*
+* DESCRIPTION
+* This function is to close a HW GPT module by a handle previous opened.
+*
+* PARAMETERS
+* handle - hanlde previous got from DclHGPT_Open().
+*
+* RETURNS
+* STATUS_OK - successful.
+* DCL_HANDLE_INVALID - it's a invalid handle.
+*
+*************************************************************************/
+extern DCL_STATUS DclHGPT_Close(DCL_HANDLE handle);
+
+/* DCL for Free Run HW GPT */
+/*************************************************************************
+* FUNCTION
+* DclFHGPT_Initialize
+*
+* DESCRIPTION
+* This function is to initialize the free run GPT module.
+*
+* PARAMETERS
+* None
+*
+* RETURNS
+* DCL_STATUS_OK
+*
+*************************************************************************/
+extern DCL_STATUS DclFHGPT_Initialize(void);
+
+/*************************************************************************
+* FUNCTION
+* DclFHGPT_Open
+*
+* DESCRIPTION
+* This function is to open a free run GPT module if it exists. Note
+* that it supports multiple opens and no need to close it.
+*
+* PARAMETERS
+* eDev - only valid for DCL_GPT3
+* flags - no sepcial flags is needed. Please use FLAGS_NONE
+*
+* RETURNS
+* DCL_HANDLE_INVALID - Open failed. It means no free run GPT exists or
+* open a wrong device.
+* other value - a valid handle
+*
+*************************************************************************/
+extern DCL_HANDLE DclFHGPT_Open(DCL_DEV dev, DCL_FLAGS flags);
+
+/*************************************************************************
+* FUNCTION
+* DclFHGPT_ReadData
+*
+* DESCRIPTION
+* This function is not supported for the free run GPT module now.
+*
+* PARAMETERS
+* N/A
+*
+* RETURNS
+* STATUS_UNSUPPORTED
+*
+*************************************************************************/
+extern DCL_STATUS DclFHGPT_ReadData(DCL_HANDLE handle, DCL_BUFF *buff, DCL_BUFF_LEN *buf_len, DCL_OPTIONS options);
+
+/*************************************************************************
+* FUNCTION
+* DclFHGPT_WriteData
+*
+* DESCRIPTION
+* This function is not supported for the free run GPT module now.
+*
+* PARAMETERS
+* N/A
+*
+* RETURNS
+* STATUS_UNSUPPORTED
+*
+*************************************************************************/
+extern DCL_STATUS DclFHGPT_WriteData(DCL_HANDLE handle, DCL_BUFF *buff, DCL_BUFF_LEN *buf_len, DCL_OPTIONS options);
+
+/*************************************************************************
+* FUNCTION
+* DclFHGPT_Configure
+*
+* DESCRIPTION
+* This function is not supported for the free run GPT module now.
+*
+* PARAMETERS
+* N/A
+*
+* RETURNS
+* STATUS_UNSUPPORTED
+*
+*************************************************************************/
+extern DCL_STATUS DclFHGPT_Configure(DCL_HANDLE handle, DCL_CONFIGURE_T *configure);
+
+/*************************************************************************
+* FUNCTION
+* DclFHGPT_RegisterCallback
+*
+* DESCRIPTION
+* This function is not supported for the free run GPT module now.
+*
+* PARAMETERS
+* N/A
+*
+* RETURNS
+* STATUS_UNSUPPORTED
+*
+*************************************************************************/
+extern DCL_STATUS DclFHGPT_RegisterCallback(DCL_HANDLE handle, DCL_EVENT event, PFN_DCL_CALLBACK callback);
+
+/*************************************************************************
+* FUNCTION
+* DclFHGPT_Control
+*
+* DESCRIPTION
+* This function is to send command to control the free run GPT module.
+*
+* PARAMETERS
+* handle - a valid handle return by DclFHGPT_Open()
+* cmd - a control command for free ryb GPT module
+* FGPT_CMD_RETURN_COUNT: to get the timer count
+* data - for FGPT_CMD_RETURN_COUNT: pointer to a FGPT_CTRL_RETURN_COUNT_T type
+*
+* RETURNS
+* STATUS_OK - command is executed successfully.
+* STATUS_FAIL - command is failed. No free run GPT is supported.
+* STATUS_INVALID_CMD - The command is invalid.
+* STATUS_INVALID_HANDLE - The handle is invalid.
+*
+*************************************************************************/
+extern DCL_STATUS DclFHGPT_Control(DCL_HANDLE handle, HGPT_CMD cmd, HGPT_CTRL *data);
+
+/*************************************************************************
+* FUNCTION
+* DclFHGPT_Close
+*
+* DESCRIPTION
+* This function is not supported for the free run GPT module now.
+*
+* PARAMETERS
+* N/A
+*
+* RETURNS
+* STATUS_UNSUPPORTED
+*
+*************************************************************************/
+extern DCL_STATUS DclFHGPT_Close(DCL_HANDLE handle);
+
+kal_bool GPT_IsStop(void);
+
+
+#if defined(__DRV_COMM_REG_DBG__) && defined(__DRV_GPT_REG_DBG__)
+#define DRV_GPT_WriteReg(addr,data) DRV_DBG_WriteReg(addr,data)
+#define DRV_GPT_Reg(addr) DRV_DBG_Reg(addr)
+#define DRV_GPT_WriteReg32(addr,data) DRV_DBG_WriteReg32(addr,data)
+#define DRV_GPT_Reg32(addr) DRV_DBG_Reg32(addr)
+#define DRV_GPT_WriteReg8(addr,data) DRV_DBG_WriteReg8(addr,data)
+#define DRV_GPT_Reg8(addr) DRV_DBG_Reg8(addr)
+#define DRV_GPT_ClearBits(addr,data) DRV_DBG_ClearBits(addr,data)
+#define DRV_GPT_SetBits(addr,data) DRV_DBG_SetBits(addr,data)
+#define DRV_GPT_SetData(addr, bitmask, value) DRV_DBG_SetData(addr, bitmask, value)
+#define DRV_GPT_ClearBits32(addr,data) DRV_DBG_ClearBits32(addr,data)
+#define DRV_GPT_SetBits32(addr,data) DRV_DBG_SetBits32(addr,data)
+#define DRV_GPT_SetData32(addr, bitmask, value) DRV_DBG_SetData32(addr, bitmask, value)
+#define DRV_GPT_ClearBits8(addr,data) DRV_DBG_ClearBits8(addr,data)
+#define DRV_GPT_SetBits8(addr,data) DRV_DBG_SetBits8(addr,data)
+#define DRV_GPT_SetData8(addr, bitmask, value) DRV_DBG_SetData8(addr, bitmask, value)
+#else
+#define DRV_GPT_WriteReg(addr,data) DRV_WriteReg(addr,data)
+#define DRV_GPT_Reg(addr) DRV_Reg(addr)
+#define DRV_GPT_WriteReg32(addr,data) DRV_WriteReg32(addr,data)
+#define DRV_GPT_Reg32(addr) DRV_Reg32(addr)
+#define DRV_GPT_WriteReg8(addr,data) DRV_WriteReg8(addr,data)
+#define DRV_GPT_Reg8(addr) DRV_Reg8(addr)
+#define DRV_GPT_ClearBits(addr,data) DRV_ClearBits(addr,data)
+#define DRV_GPT_SetBits(addr,data) DRV_SetBits(addr,data)
+#define DRV_GPT_SetData(addr, bitmask, value) DRV_SetData(addr, bitmask, value)
+#define DRV_GPT_ClearBits32(addr,data) DRV_ClearBits32(addr,data)
+#define DRV_GPT_SetBits32(addr,data) DRV_SetBits32(addr,data)
+#define DRV_GPT_SetData32(addr, bitmask, value) DRV_SetData32(addr, bitmask, value)
+#define DRV_GPT_ClearBits8(addr,data) DRV_ClearBits8(addr,data)
+#define DRV_GPT_SetBits8(addr,data) DRV_SetBits8(addr,data)
+#define DRV_GPT_SetData8(addr, bitmask, value) DRV_SetData8(addr, bitmask, value)
+#endif //#if defined(__DRV_COMM_REG_DBG__) && defined(__DRV_GPT_REG_DBG__)
+
+
+#endif
diff --git a/mcu/driver/devdrv/gpt/inc/drv_gpt.h b/mcu/driver/devdrv/gpt/inc/drv_gpt.h
new file mode 100644
index 0000000..a48ede1
--- /dev/null
+++ b/mcu/driver/devdrv/gpt/inc/drv_gpt.h
@@ -0,0 +1,107 @@
+/*****************************************************************************
+* 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) 2012
+*
+* 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:
+ * ---------
+ * drv_gpt.h
+ *
+ * Project:
+ * --------
+ * TATAKA
+ *
+ * Description:
+ * ------------
+ * Low level GPT driver
+ *
+ * Author:
+ * -------
+ * -------
+ *
+ * ==========================================================================
+ * $Log$
+ *
+ * 05 04 2017 way.chen
+ * [MOLY00246761] [UMOLYA] Replace PDN API with OF API, Request by PDN owner(Devin )
+ * Remove 26M on/off API.
+ *
+ * 08 08 2016 way.chen
+ * [MOLY00185478] [UMOLYA] Check in 93 serial GPT driver
+ * Check in DSP 1us resolution driver(support for multiple user).
+ *
+ * 07 06 2016 way.chen
+ * [MOLY00185478] [UMOLYA] Check in 93 serial GPT driver
+ * Modify PDN operation.
+ *
+ * 06 20 2016 way.chen
+ * [MOLY00185478] [UMOLYA] Check in 93 serial GPT driver
+ * Check in 93 GPT driver.
+ *
+ * 01 06 2016 way.chen
+ * [MOLY00156138] [UMOLY] Patch GPT driver for U4G FPGA
+ * Patch GPT Driver for U4G FPGA, the FPGA Start Version is 20151231_u4g_ltel2_elbrus_vivado_2015.
+ *
+ * 12 10 2013 chin-chieh.hung
+ * [MOLY00049464] [Driver][GPT] Add debug GPT, request by MS Lin
+ * Add Debug GPT APIs
+ ****************************************************************************/
+#ifndef __DRV_GPT_H__
+#define __DRV_GPT_H__
+
+#include "drv_features_gpt.h"
+#include "gpt_reg.h"
+
+#define MDPERI_CKEN_SET (BASE_MADDR_CLK_CTRL + 0x10)
+#define MDPERI_CKEN_CLR (BASE_MADDR_CLK_CTRL + 0x14)
+#define MDPERI_CKEN (BASE_MADDR_CLK_CTRL + 0x18)
+#define MDGPTM_26M_CKEN (1<<15)
+
+
+/*Test Low Power IT Define*/
+//#define GPT_LP_TEST 1
+
+/*****************************************************************************
+ * function declaration *
+ *****************************************************************************/
+void drv_gpt_reset(void);
+void drv_gpt_set_timer(kal_uint32 num, kal_uint32 time, kal_uint32 mode);
+void drv_gpt_start_timer(kal_uint32 num);
+void drv_gpt_stop_timer(kal_uint32 num);
+kal_uint32 drv_gpt_get_version(void);
+kal_uint32 drv_gpt_get_data(kal_uint32 num);
+void drv_gpt_set_data(kal_uint32 num, kal_uint32 time);
+
+
+#endif /* end of __DRV_GPT_H__ */
diff --git a/mcu/driver/devdrv/gpt/inc/drv_litegpt.h b/mcu/driver/devdrv/gpt/inc/drv_litegpt.h
new file mode 100644
index 0000000..f1f7110
--- /dev/null
+++ b/mcu/driver/devdrv/gpt/inc/drv_litegpt.h
@@ -0,0 +1,43 @@
+#ifndef __DRV_LITEGPT_H__
+#define __DRV_LITEGPT_H__
+#include "intrCtrl.h"
+
+#if defined(__CR4__) || defined(__MIPS_IA__) || defined(__MIPS_I7200__)
+#define BASE_ADDR_LITEMDGPTM 0xA0170000
+#define MD_IRQID_MDGPTM_LITE_EVENT1 255 //(IRQ_MDLITE_GPTM_CODE) for build pass
+#endif
+
+/* Register Address Definition */
+#if defined(__CR4__) || defined(__MIPS_IA__) || defined(__MIPS_I7200__) /* end of defined(CORTEXA9)||defined(CORTEXA7) */
+ #define LITE_GPT_BASE (BASE_ADDR_LITEMDGPTM)
+ #define LITE_GPT_TOTAL_COUNTER (4U)
+ #define LITE_GPT_INTR_ID 255// (MD_IRQID_MDGPTM_LITE_EVENT1) for build pass
+#endif /* end of else if */
+
+#define LITE_GPT_CON_REG(i) (LITE_GPT_BASE + ((i - 1)<<3))
+#define LITE_GPT_DAT_REG(i) (LITE_GPT_BASE + 0x38 + ((i - 1)<<2))
+#define LITE_GPT_PSR_REG(i) (LITE_GPT_BASE + 0x14 + ((i - 1)<<2))
+
+#define LITEGPT_MAX_PRESCALE (7U)
+#define LITEGPT_MIN_PRESCALE (0U)
+#define LITEGPT_DEFAULT_PRESCALE (4U)
+#define LITEGPT_MAX_CNT_BIT (16U)
+#define LITEGPT_CNT_MAX (0xFFFDU)
+#define TOPSM_TEST_LITEGPT_WAKEUP 3
+
+#define LITEGPT_CTRL_MODE_ENABLE (1U<<15)
+#define LITEGPT_CTRL_MODE_ONESHOT (0U<<14)
+#define LITEGPT_CTRL_MODE_REPEAT (1U<<14)
+
+#define LITEGPT_PSR_PRESCALE(n) (n&0x7)
+
+extern void drv_litegpt_stop_timer(kal_uint32 num);
+extern void drv_litegpt_start_timer(kal_uint32 num);
+extern void drv_litegpt_set_timer(kal_uint32 num, kal_uint32 time, kal_uint32 mode, kal_uint32 prescaler);
+extern kal_uint32 drv_litegpt_time_remaining(kal_uint32 num);
+
+extern void drv_litegpt_set_wakeup_gpt(kal_uint32 time_tick);//the duration is about 1/32K*time_tick us
+extern void drv_litegpt_clr_wakeup_event(void);
+
+#endif /* end of __DRV_LITEGPT_H__ */
+
diff --git a/mcu/driver/devdrv/gpt/inc/gpt_reg.h b/mcu/driver/devdrv/gpt/inc/gpt_reg.h
new file mode 100644
index 0000000..ff8bfe3
--- /dev/null
+++ b/mcu/driver/devdrv/gpt/inc/gpt_reg.h
@@ -0,0 +1,31 @@
+#ifndef __GPT_REG_H__
+#define __GPT_REG_H__
+
+#include <reg_base.h>
+#include <irqid.h>
+
+/* Register Address Definition */
+#define MDGPT_BASE (BASE_ADDR_MDGPTM)
+#define GPT_CODA_VERSION (MDGPT_BASE)
+
+/* n = 1~6 */
+#define MDGPT_CNT_REG(n) (MDGPT_BASE + ((n))*0x10U + 0x0U)
+#define MDGPT_PSR_REG(n) (MDGPT_BASE + ((n))*0x10U + 0x4U)
+#define MDGPT_CTRL_REG(n) (MDGPT_BASE + ((n))*0x10U + 0x8U)
+#define MDGPT_DATA_REG(n) (MDGPT_BASE + ((n))*0x10U + 0xCU)
+
+#ifndef __MD93__
+#define GPT_INT_STATUS_REG(n) (MDGPT_BASE + ((n))*0x4U + 0xC0U)
+#define GPT_INT_STATUS_MASK_BIT(n) (1U<<(n - 1))
+#endif
+
+
+#define MDGPT_CTRL_MODE_ENABLE (1U<<1)
+#define MDGPT_CTRL_MODE_ONESHOT (0U<<0)
+#define MDGPT_CTRL_MODE_REPEAT (1U<<0)
+
+#define MDGPT_INTR_ID(n) (n + IRQ_GPTM1_CODE - 1)
+#define MDGPT_INTR_ID2TIMER(n) (n + 1 - IRQ_GPTM1_CODE)
+
+
+#endif /* end of __GPT_REG_H__ */