[Feature]Upload Modem source code

Change-Id: Id4294f30faced84d3e6fd6d5e61e1111bf287a37
diff --git a/mcu/interface/protocol/l2_c2k/1xrtt/lmdtdso.h b/mcu/interface/protocol/l2_c2k/1xrtt/lmdtdso.h
new file mode 100644
index 0000000..a0a6981
--- /dev/null
+++ b/mcu/interface/protocol/l2_c2k/1xrtt/lmdtdso.h
@@ -0,0 +1,509 @@
+/*****************************************************************************
+*  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) 2016
+*
+*  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).
+*
+*****************************************************************************/
+/*************************************************************
+*
+* This Software is the property of VIA Telecom, Inc. and may only be used pursuant to a license from VIA Telecom, Inc.  
+* 
+* Any unauthorized use inconsistent with the terms of such license is strictly prohibited.
+* 
+* Copyright (c) 1998-2010 VIA Telecom, Inc.  All rights reserved.
+*
+*************************************************************/
+#ifndef _LMDTDSO_H_
+#define _LMDTDSO_H_
+
+/*****************************************************************************
+* 
+* FILE NAME   : lmdtdso.h
+*
+* DESCRIPTION : Test Data Service Option definitions
+*
+* HISTORY     :
+*     See Log at end of file
+*
+*****************************************************************************/
+
+/*----------------------------------------------------------------------------
+ Include Files
+----------------------------------------------------------------------------*/
+
+#include "sysapi.h"
+
+/*----------------------------------------------------------------------------
+ Test Data Service Option Defines and Macros
+----------------------------------------------------------------------------*/
+
+/* service option control counter response size */
+#ifdef SYS_OPTION_SCH_RAM_INUSE
+
+/* this is 3 times the max of (FUND_TDSO_RX_MAX, SUPP_TDSO_RX_MAX, PDU_TDSO_RX_MAX,
+                               FUND_TDSO_TX_MAX, SUPP_TDSO_TX_MAX) */
+#define  MAX_COUNTER_RESPONSE_SIZE  (3 * PDU_TDSO_RX_MAX)
+
+#else
+
+/* this is 3 times the max of (FUND_TDSO_RX_MAX, FUND_TDSO_TX_MAX) */
+#define  MAX_COUNTER_RESPONSE_SIZE  (3 * FUND_TDSO_RX_MAX)
+
+#endif /* SYS_OPTION_SCH_RAM_INUSE */
+
+/*----------------------------------------------------------------------------
+ Test Data Service Option Typedefs
+----------------------------------------------------------------------------*/
+
+/* Traffic (channel) Direction type */
+typedef enum
+{
+   FUND_FORWARD = 0,
+   FUND_REVERSE,
+#ifdef SYS_OPTION_SCH_RAM_INUSE
+   SUPP0_FORWARD,
+   SUPP0_REVERSE,
+#endif /* SYS_OPTION_SCH_RAM_INUSE */
+   TDSO_MAX_DIR
+} TdsoDirectionT;
+
+/* Frame Type Index based on MuxOption and TrafficType
+ * This index can and will be used to access parameters
+ * from many fast look up tables. */
+typedef enum
+{
+   /* muxoption: 0x01 */
+   FTI_1X_171_FUND = 0, /* primary   */
+   FTI_1X_168_FUND,     /* secondary */
+
+   /* muxoption: 0x02 */
+   FTI_1X_266_FUND,
+   FTI_1X_262_FUND,
+
+#ifdef SYS_OPTION_SCH_RAM_INUSE
+   /* muxoption: 0x03 */
+   FTI_1X_171_SUPP,
+   FTI_1X_168_SUPP,
+
+   /* muxoption: 0x04 */
+   FTI_1X_266_SUPP,
+   FTI_1X_262_SUPP,
+
+   /* muxoptions: 0x809, 0x811, 0x821 */
+   FTI_2X_170_PRI,
+   FTI_2X_170_SEC,
+   FTI_4X_170_PRI,
+   FTI_4X_170_SEC,
+   FTI_8X_170_PRI,
+   FTI_8X_170_SEC,
+
+   /* muxoptions: 0x80A, 0x812, 0x822 */
+   FTI_2X_266_PRI,
+   FTI_2X_266_SEC,
+   FTI_4X_266_PRI,
+   FTI_4X_266_SEC,
+   FTI_8X_266_PRI,
+   FTI_8X_266_SEC,
+
+   /* muxoptions: 0x905 0x909, 0x911, 0x921 */
+   FTI_1X_346_PRI,
+   FTI_1X_346_SEC,
+   FTI_2X_346_PRI,
+   FTI_2X_346_SEC,
+   FTI_4X_346_PRI,
+   FTI_4X_346_SEC,
+   FTI_8X_346_PRI,
+   FTI_8X_346_SEC,
+
+   /* muxoptions: 0x906 0x90A, 0x912, 0x922 */
+   FTI_1X_538_PRI,
+   FTI_1X_538_SEC,
+   FTI_2X_538_PRI,
+   FTI_2X_538_SEC,
+   FTI_4X_538_PRI,
+   FTI_4X_538_SEC,
+   FTI_8X_538_PRI,
+   FTI_8X_538_SEC,
+#endif /* SYS_OPTION_SCH_RAM_INUSE */
+
+   FTI_MAX_SIZE
+} TdsoFrameTypeIndexT;
+
+/* Frame Params type */
+typedef struct
+{
+   kal_uint16   NumPdus;
+   kal_uint16   NumBits;
+   kal_uint16   PadBits;
+} TdsoFrameParamsT;
+
+/* Frame packet type */
+typedef enum
+{
+   FULL_PACKET = 0,
+   BLNK_PACKET
+} TdsoPacketTypeT;
+
+/* Data source used in the generation of local packets */
+typedef enum
+{
+   USE_PATTERN = 0,
+   USE_CIRBUF,
+   USE_ONES
+} TdsoDataSourceT;
+
+/* Frame activity types */
+typedef enum
+{
+   FA_DETERMINISTIC = 0,
+   FA_RANDOM
+} TdsoFrameActivityT;
+
+/* Control parameters */
+typedef struct
+{
+   kal_uint8               Nx;
+   TdsoFrameActivityT  FrameActivity;
+   kal_uint32              OnThreshold;
+   kal_uint32              OffThreshold;
+   kal_uint8               TxOnPer;
+   kal_uint8               TxOffPer;
+   TdsoDataSourceT     DataSource;
+   kal_uint8               DataPattern;
+} TdsoControlParmT;
+
+/* transition state definitions */
+typedef enum
+{
+   TDSO_STATE_OFF = 0,
+   TDSO_STATE_ON
+} TdsoStateT;
+
+typedef enum
+{
+   LAST_TIME = 0,
+   THIS_TIME,
+   NEXT_TIME,
+   MAX_TIME
+} TdsoTimeT;
+
+typedef struct
+{
+   kal_uint32   Value;
+   kal_uint32   Time;
+} TdsoSRNGT;
+
+/* Receive Counter Id Lookup Table type */
+typedef struct
+{
+   const kal_uint16  *FullRateTableP;
+   const kal_uint16  *BlnkRateTableP;
+   const kal_uint16   TableSize;
+} TdsoRxLookUpTableT;
+
+/* Receive frame counters on the fundicated channel
+ * NOTE:  the order of these ids MUST match that described
+ *        in section 3.8.1.4 - see GetFundRECCounters() */
+typedef enum
+{
+   FUND_TDSO_E1_R1 = 0,
+   FUND_TDSO_E1_RD,
+   FUND_TDSO_E1_RO,
+   FUND_TDSO_E1_RB,
+   FUND_TDSO_E1_RFL,
+   FUND_TDSO_E1_RE,
+   FUND_TDSO_E1_RERR,
+
+   FUND_TDSO_EN_RN,
+   FUND_TDSO_EN_RB,
+   FUND_TDSO_EN_RO,
+
+   FUND_TDSO_RX_MAX  /* 10, check out MAX_COUNTER_RESPONSE_SIZE */
+} TdsoFundRxCntrT;
+
+/* Transmit frame counters on the fundicated channel
+ * NOTE:  the order of these ids MUST match that described
+ *        in section 3.8.2.3 - see GetFundTXCounters() */
+typedef enum
+{
+   FUND_TDSO_E1_T1 = 0,
+   FUND_TDSO_E1_TD,
+   FUND_TDSO_E1_TB,
+   FUND_TDSO_EB_TB,
+   FUND_TDSO_EB_TO,
+   FUND_TDSO_TX_MAX  /* 5, check out MAX_COUNTER_RESPONSE_SIZE */
+} TdsoFundTxCntrT;
+
+#ifdef SYS_OPTION_SCH_RAM_INUSE
+
+/* Receive frame counters on the supplemental channel */
+typedef enum
+{
+   SUPP_TDSO_ENx_RNx = 0,
+   SUPP_TDSO_ENx_RERR,
+   SUPP_TDSO_ENx_RE,
+   SUPP_TDSO_ENx_RB,
+   SUPP_TDSO_EB_RB,
+   SUPP_TDSO_EB_RO,
+
+   SUPP_TDSO_RX_MAX  /* 6, check out MAX_COUNTER_RESPONSE_SIZE */
+} TdsoSuppRxCntrT;
+
+/* Receive PDU counters for the supplemental channel
+ * NOTE:  the order of these ids MUST match that described
+ *        in section 3.8.2.2 - see GetSuppPERCounters() */
+typedef enum
+{
+   PDU_TDSO_E3_R3 = 0,
+   PDU_TDSO_E3_RERR,
+   PDU_TDSO_E3_RE,
+
+   PDU_TDSO_E2_R2,
+   PDU_TDSO_E2_RERR,
+   PDU_TDSO_E2_RE,
+
+   PDU_TDSO_E1a_R1a,
+   PDU_TDSO_E1a_RERR,
+   PDU_TDSO_E1a_RE,
+
+   PDU_TDSO_E1b_R1b,
+   PDU_TDSO_E1b_RERR,
+   PDU_TDSO_E1b_RE,
+
+   PDU_TDSO_RX_MAX   /* 12, check out MAX_COUNTER_RESPONSE_SIZE */
+} TdsoRxPduCntrT;
+
+/* Transmit frame counters on the supplemental channel
+ * NOTE:  the order of these ids MUST match that of
+ *        SuppTXData.Counters[] - see GetSuppTXCounters() */
+typedef enum
+{
+   SUPP_TDSO_ENx_TNx = 0,
+   SUPP_TDSO_ENx_TB,
+   SUPP_TDSO_EB_TB,
+   SUPP_TDSO_EB_TO,
+
+   SUPP_TDSO_TX_MAX  /* 5, check out MAX_COUNTER_RESPONSE_SIZE */
+} TdsoSuppTxCntrT;
+
+#endif /* SYS_OPTION_SCH_RAM_INUSE */
+
+/* signaling type */
+typedef enum
+{
+   SIGTYPE_NONE = 0,
+   SIGTYPE_BLNKnBURST
+} TdsoSigTypeT;
+
+
+/*
+ * Definitions used in processing the Service Option Control Message
+ */
+
+typedef PACKED_PREFIX struct
+{
+   kal_uint8    CtlRecType;
+   PACKED_PREFIX union   /* the meaning of the 2nd byte is dependent on CtlRecType */
+   {
+      kal_uint8 CtrlCode;
+      kal_uint8 VectorId;
+   } PACKED_POSTFIX Directive;
+   kal_uint8    Misc; /* ChannelDirection:2, CopyCounters:1, ClearCounters:1,
+                     DataSource:1, FrameSource:2, FrameActivity:1      */
+   kal_uint8    TestOptions;
+   kal_uint8    Data[1]; /* NumCirBufFrames, On2OffProb, Off2OnProb, TxOnPer, TxOffPer, DataPat */
+} PACKED_POSTFIX  LmdTdsoControlDataT;
+
+/* channel direction field */
+typedef enum
+{
+   CHANDIR_BOTH = 0,
+   CHANDIR_FORWARD,
+   CHANDIR_REVERSE
+} TdsoChannelDirectionT;
+
+/* control record type field */
+typedef enum
+{
+   DIRECTIVE_CONTROLS_FOR_ALL_CHANNELS = 0,
+   DIRECTIVE_CONTROLS_FOR_FCH,
+   DIRECTIVE_CONTROLS_FOR_DCCH,
+   DIRECTIVE_CONTROLS_FOR_SCH0,
+   DIRECTIVE_CONTROLS_FOR_SCH1,
+
+   DIRECTIVE_CNTR_RETRIEVAL_FOR_FCH,
+   DIRECTIVE_CNTR_RETRIEVAL_FOR_DCCH,
+   DIRECTIVE_CNTR_RETRIEVAL_FOR_SCH0,
+   DIRECTIVE_CNTR_RETRIEVAL_FOR_SCH1
+} TdsoControlRecTypeT;
+
+/* vector id field */
+typedef enum
+{
+   VECTORID_FER = 0,             /* 0 */
+   VECTORID_PER,                 /* 1 */
+   VECTORID_REC = VECTORID_PER,  /* 1 */
+   VECTORID_TX                   /* 2 */
+} TdsoVectorIdT;
+
+/* counter response definitions */
+typedef  struct
+{
+   kal_uint8    CtlRecType;
+   kal_uint8    VectorId;
+   kal_uint8    Counters[MAX_COUNTER_RESPONSE_SIZE];
+} TdsoCountersResponseT;
+
+/*
+ * Definitions used in generating spy data
+ */
+/* FER structure */
+typedef struct
+{
+   kal_uint32      Good;
+   kal_uint32      Bad;
+   kal_uint32      Total;
+   kal_uint16      FER;
+} TdsoRxFerT;
+
+/* Fch/Dcch Transmit spy structure */
+typedef struct
+{
+   kal_uint16      MuxOption;
+   kal_uint32      Counters[FUND_TDSO_TX_MAX];
+} TdsoFundTxSpyT;
+
+/* Fch/Dcch Receive spy structure */
+typedef struct
+{
+   kal_uint16      MuxOption;
+   kal_uint32      Counters[FUND_TDSO_RX_MAX];
+} TdsoFundRxSpyT;
+
+#ifdef SYS_OPTION_SCH_RAM_INUSE
+
+/* Sch Transmit spy structure */
+typedef struct
+{
+   kal_uint16      MuxOption;
+   kal_uint16      Rate;  /* N times base rate */
+   kal_uint32      Counters[SUPP_TDSO_TX_MAX];
+} TdsoSuppTxSpyT;
+
+/* Sch Pdu Receive spy structure */
+typedef struct
+{
+   kal_uint16      MuxOption;
+   kal_uint32      Counters[PDU_TDSO_RX_MAX];
+} TdsoSuppPduRxSpyT;
+
+/* Sch Receive spy structure */
+typedef struct
+{
+   kal_uint16      MuxOption;
+   kal_uint16      Rate;  /* N times base rate */
+   kal_uint32      Counters[SUPP_TDSO_RX_MAX];
+} TdsoSuppRxSpyT;
+
+#endif /* SYS_OPTION_SCH_RAM_INUSE */
+
+/* Fch/Dcch/Sch Receive FER spy structure */
+typedef struct
+{
+   kal_uint16      MuxOption;
+   TdsoRxFerT  FullRate;
+} TdsoRxFerSpyT;
+
+/* TDSO Functional Trace Types */
+typedef enum
+{
+   LMD_TDSO_FUNC_RESYNC_CHANNEL              = 0,
+   LMD_TDSO_FUNC_COMPARE_NUMPDUS_DIFFER      = 1,
+   LMD_TDSO_FUNC_COMPARE_NUMBITS_DIFFER      = 2,
+   LMD_TDSO_FUNC_COMPARE_DATA_DIFFER         = 3,
+   LMD_TDSO_FUNC_COMPARE_IDENTICAL           = 4,
+   LMD_TDSO_FUNC_NOT_COMPARED                = 5,
+   LMD_TDSO_FUNC_SSO_CONNECT                 = 6,
+   LMD_TDSO_FUNC_SSO_PROCESSING              = 7,
+   LMD_TDSO_FUNC_SSO_DISCONNECT              = 8,
+   LMD_TDSO_FUNC_CONTROL_MSG                 = 9,
+   LMD_TDSO_FUNC_CNTRRET_DIR                 = 10,
+   LMD_TDSO_FUNC_CONTROL_DIR                 = 11,
+   LMD_TDSO_PROC_RESET_CHANNEL               = 12,
+   LMD_TDSO_PROC_SETUP_CHANNEL               = 13,
+   LMD_TDSO_FUNC_DEBUG_RX_PACKET             = 14
+} TdsoFunctionalTraceTypeT;
+
+/* TDSO Processing Trace Types */
+typedef enum
+{
+   LMD_TDSO_PROC_BUILD_CIRBUF    = 0,
+   LMD_TDSO_PROC_GEN_INFO_BITS   = 1,
+   LMD_TDSO_PROC_GEN_BLNK_BITS   = 2,
+   LMD_TDSO_PROC_ADVANCE_OFFSET  = 3,
+   LMD_TDSO_PROC_SET_CIRBUF_SIZE = 4
+} TdsoProcessingTraceTypeT;
+
+/*----------------------------------------------------------------------------
+ Global Variables
+----------------------------------------------------------------------------*/
+extern kal_uint32        TdsoRNG[];              /* Current Random Number      */
+extern kal_uint16        TdsoBn[];               /* Circular Buffer Size       */
+extern kal_uint8 * const TdsoCirBufP[];          /* Circular Buffer Pointers   */
+
+/*----------------------------------------------------------------------------
+ External Function Prototypes
+----------------------------------------------------------------------------*/
+extern void    TdsoBuildCirBuf ( TdsoDirectionT Direction );
+
+
+/*****************************************************************************
+* $Log: lmdtdso.h $
+* Revision 1.2  2004/03/25 11:55:23  fpeng
+* Updated from 6.0 CP 2.5.0
+* Revision 1.1  2003/05/12 15:31:54  fpeng
+* Initial revision
+* Revision 1.4  2002/07/15 18:36:31  vxnguyen
+* Added global Tdso data and funtion declarations.
+* Revision 1.3  2002/05/30 11:11:36  mshaver
+* Added VIA Technologies copyright notice.
+* Revision 1.2  2002/04/10 10:44:27  vxnguyen
+* Added compilor option SYS_OPTION_SCH_RAM_INUSE.
+* Revision 1.1  2002/02/07 16:56:39  vxnguyen
+* Initial revision
+*****************************************************************************/
+
+/*****************************************************************************
+* End of File
+*****************************************************************************/
+
+#endif
+