[Feature]Upload Modem source code
Change-Id: Id4294f30faced84d3e6fd6d5e61e1111bf287a37
diff --git a/mcu/interface/protocol/as_c2k/1xrtt/layer2.h b/mcu/interface/protocol/as_c2k/1xrtt/layer2.h
new file mode 100644
index 0000000..a415d12
--- /dev/null
+++ b/mcu/interface/protocol/as_c2k/1xrtt/layer2.h
@@ -0,0 +1,288 @@
+/*****************************************************************************
+* 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) 1999-2010 VIA Telecom, Inc. All rights reserved.
+*
+*************************************************************/
+/****************************************************************************
+ *
+ * Module: layer2.h
+ *
+ * Purpose: Header file containing the structures for the layer 2 operation.
+ *
+ ****************************************************************************
+ *
+ * PVCS Header Information
+ *
+ * $Workfile$
+ * $Revision: 1.5 $
+ * $Modtime$
+ * $Author: wfu $
+ *
+ * $Log: layer2.h $
+ *
+ * 09 18 2020 yanfeng.xu
+ * [MOLY00559524] [Wingtech][Samsung][MT6765][N21][P200813-06136][SMC_Message][USC] CMAS containing Record Type is not received
+ *
+ * 07 06 2017 sue.zhong
+ * [MOLY00259241] [6293][C2K]Replace with KAL data type
+ * Correct copyright file header
+ *
+ * 05 17 2017 peijun.zheng
+ * [MOLY00249027] [BIACNO][MT6763][New feature]C2K code release code modification
+ *
+ * C2k code release.
+ *
+ * 11 09 2016 sue.zhong
+ * [MOLY00208435] [6293][C2K]Sync C2K code to UMOLYA TRUNK
+ * Update C2K PS code (1/2)
+ * Revision 1.5 2005/07/18 16:48:26 wfu
+ * Fix CR6696: add two new L2FTCState:L2_FTC_HARD_HANDOFF_INIT_ST and
+ * L2_FTC_HARD_HANDOFF_W_RTN_ON_FAIL_INIT_ST
+ * Revision 1.4 2005/03/18 11:44:42 hans
+ * Merged code changes from CBP4.05 revision 2.02 to CBP4.05 revision 4.21.
+ * Revision 1.3 2004/04/06 14:02:11 dstecker
+ * CBP6.1 release 1
+ * Revision 1.2 2004/03/25 12:09:37 fpeng
+ * Updated from 6.0 CP 2.5.0
+ * Revision 1.2 2003/08/28 11:19:43 bcolford
+ * Update for merge.
+ * Revision 1.18 2003/08/01 13:33:26 mclee
+ * Fix CR2506 by removing all instances of CBP3 compile flag and dead code
+ * Revision 1.17 2003/05/21 17:11:34 byang
+ * CR#570: Replace compiler flag with IS2000A with IS2000_REV_0.
+ * Revision 1.16 2002/12/26 12:08:01 hans
+ * Conditional compile flag IS2000A replaced with IS_2000_REV_A and IS_2000_REV_0 for rev A and Rev 0 specific code.
+ * Revision 1.15 2002/09/26 17:10:05 dstecker
+ * Added prototype
+ * Revision 1.14 2002/08/29 14:07:02 dstecker
+ * Changed l2totalRxPower prototype
+ * Revision 1.13 2002/08/27 17:07:22 byang
+ * Add new frame category for DCCH only discontinous
+ * mode. Insert function prototype declaration for pinging the BS.
+ * Revision 1.12 2002/08/19 10:45:50 dstecker
+ * CBP4 candidate frequency implimentation
+ * Revision 1.11 2002/06/17 17:36:21 hans
+ * Incorrect conditional compilation around Mux1CatSigLen enum entry MUX1_CAT2_SIG_LEN and Mux2CatSigLen enum entry MUX1_CAT2_SIG_LEN removed together with the wrong values.
+ * Revision 1.10 2002/06/13 13:55:36 hans
+ * Statistics functions already disabled with ifdef removed.
+ * Revision 1.9 2002/06/06 13:13:27 chinh
+ * Changed and Added Copyright
+ * Revision 1.8 2002/06/04 20:06:23 hans
+ * Old statistics now handled by lmd disabled with ifdef's
+ * Revision 1.7 2002/03/28 18:24:21 hans
+ * is2000 rev 0 add 2, retrievable and settable parameters implemented.
+ * CR503: get retrievable parameter implemented.
+ * CR508: set retrievable parameter implemented
+ * Revision 1.6 2001/12/14 17:11:17 mclee
+ * prototype GetSyncPageCounts()
+ * Revision 1.5 2001/08/03 15:15:05 dstecker
+ * Modifications for IS2000 handoffs
+ * Revision 1.4 2001/06/21 13:30:26 yfang
+ * merged code from CBP3 to solve the layer2 message sequence mis-matching
+ * Revision 1.3 2001/05/29 14:42:42 akayvan
+ * Added declaration for getPCNPMReceivedstatus() per CR#20.
+ * Revision 1.2 2001/03/16 11:32:23 akayvan
+ * Traffic code phase1 added.
+ * Revision 1.1 2001/01/17 10:58:58 plabarbe
+ * Initial revision
+ * Revision 1.4 2000/12/01 10:47:33 chinh
+ * Modified LAC dsch for IS2000
+ * Revision 1.3 2000/11/14 01:06:24Z byang
+ * IS-2000A Idle Mode and LAC integration - Initial Release.
+ * Revision 1.2 2000/11/13 22:01:18Z hans
+ * Check-in for cbp4 phase 1 integration
+ * Revision 1.1.2.4 2000/11/11 01:47:26Z hans
+ * SDU length calculation is done to handle message with multiple records
+ * Revision 1.1.2.3 2000/11/08 00:17:57Z hans
+ * PchMessage structure is replaced by FcschMessage structure.
+ * New IS2000 PD is not recognized by L3 and is therefore masked out from MSG_TYPE before parsed on to L3.
+ * Revision 1.1.2.2 2000/11/01 02:07:25Z hans
+ * New structure fields added to PChMessage structure.
+ * New Layer 2 (LAC) function prototypes added.
+ * Revision 1.3.2.2 2000/10/13 02:01:52Z hans
+ * CBP4 phase1 LAC implementation
+ * LAC functionality executed before cpRunTheEngine() function call
+ * Revision 1.3.2.1 2000/08/23 22:09:16Z hans
+ * Duplicate revision
+ * Revision 1.3 2000/08/23 22:09:16Z RSATTARI
+ * Isotel release 2.8 plus LSI applicable IS-95B changes.
+ * Revision 1.2 2000/03/01 18:15:06Z rsattari
+ * Isotel release 2.3 updates.
+ * Revision 1.20 2000/03/01 22:37:35 gfrye
+ * Added "somTime" to PChMessage structure to store the time at
+ * which the beginning of the message was received. Broadcast SMS
+ * needs this time for Broadcast pages to calculate when to expect
+ * a broadcast message.
+ *
+ * Revision 1.19 2000/01/17 22:27:19 scotvold
+ * TC Backward Compatibility changes.
+ *
+ * Revision 1.18 1999/08/18 23:34:21 gfrye
+ * Added l2PageMonitorInit prototype to reset the new time stamp based
+ * Page channel monitoring scheme.
+ *
+ * Revision 1.17 1999/06/16 00:37:03 scotvold
+ * Reset Power Control Counters after send PMRM.
+ *
+ * Revision 1.16 1999/06/04 23:27:26 scotvold
+ * New Message Transmitter.
+ *
+ * Revision 1.15 1999/05/18 02:12:47 mhayduk
+ * Fixed up comment.
+ *
+ * Revision 1.14 1998/12/02 00:07:12 scotvold
+ * Moved statistic counting here from stats.c
+ *
+ * Revision 1.13 1998/11/20 16:43:38 scotvold
+ * Fixed T53 ifdef.
+ *
+ * Revision 1.12 1998/10/20 23:58:23 mhayduk
+ * Added T53 support.
+ *
+ * Revision 1.11 1998/09/11 02:37:05 scotvold
+ * Candidate Frequency API changes.
+ *
+ * Revision 1.10 1998/08/14 23:48:40 scotvold
+ * Removed numPreamble from Layer 2.
+ *
+ * Revision 1.9 1998/07/27 17:25:26 scotvold
+ * Added external control of Power Control processing.
+ *
+ * Revision 1.8 1998/07/20 23:22:46 scotvold
+ * Added state machine tracing support.
+ *
+ * Revision 1.7 1998/07/14 17:23:38 scotvold
+ * FTC Supervision changes.
+ *
+ * Revision 1.6 1998/07/03 16:57:30 dfischer
+ * New load
+ *
+ * Revision 1.5 1998/06/08 21:48:25 scotvold
+ * Updated for Release 0.06.
+ *
+ * Revision 1.4 1998/05/01 18:13:54 scotvold
+ * Update for release 0.04
+ *
+ * Revision 1.3 1998/03/30 23:26:03 mhayduk
+ * Release 0.03.
+ *
+ * Revision 1.1 1997/11/06 17:49:24 mhayduk
+ * Initial revision
+ *
+ *
+ ****************************************************************************
+ ****************************************************************************/
+
+
+#ifndef _LAYER2_H_
+
+ #define _LAYER2_H_ 1
+
+#include "sysapi.h"
+#include "pswairmsg.h"
+/*****************************************************************************
+ * Function prototypes
+ ****************************************************************************/
+void l2SyncControl(kal_bool control);
+SyncChannelMessage* l2BuildSyncMessage(SyncFrame *frame);
+
+void l2PageControl(kal_bool control);
+FcschMessage* l2BuildPageMessage(PageFrame *frame);
+
+kal_bool l2OhdMessageDuplicate(FcschMessage *msg);
+kal_bool chechForOVHMsg(kal_uint8 msgType);
+
+kal_bool sduOffset(FcschMessage *fcschMsg, kal_uint16 *index);
+kal_bool sduLength(FcschMessage *fcschMsg, kal_uint16 *index);
+kal_bool getExtMsgLengthInd(kal_uint8 ChanType);
+
+
+void l2PageMonitorInit(void);
+
+/* Traffic Channel Interface */
+void l2FTCStart (void);
+void l2FTCStop (void);
+FTCMessage* l2FTCFrame(TCFrame* frame);
+void l2FTCHardHandoff (void);
+void l2FTCHardHandoffWReturnOnFailure(void);
+void l2FTCSupervision (kal_bool control);
+void l2FTCSupervisionFadeTimeout (void);
+void l2FTCPowerControlInit (void);
+void l2FTCPowerControlCounterReset (void);
+void l2FTCPowerControl (kal_bool control);
+void l2FTCPowerControlParm(kal_uint8 pwrRepThresh, kal_uint8 pwrRepFrames,
+ kal_bool pwrThreshEnable, kal_bool pwrPeriodEnable, kal_uint8 pwrRepDelay);
+PCNPMData* getL2FTCPowerControlParms(void);
+kal_bool* getPCNPMReceivedstatus(void);
+void l2FTCCandFreqSearchParm (kal_int8 sfRxPwrThresh, kal_int8 diffRxPwrThresh);
+kal_int8 l2FTCGetAvgSFRxPwr (void);
+void l2FTCGetTotalPwr(kal_uint8* sfTotalRxPwr/*, kal_uint8* cfTotalRxPwr*/);
+
+void l2RxAcknowledgementProceduresReset (void);
+void l2TCTransmitterControl(TXControl txControl);
+
+void l2GetSyncPageCounts(kal_uint8 *GoodMsgCount, kal_uint8 *BadMsgCount);
+
+kal_uint8 l2totalRxPower (kal_int16 actualRxPwr);
+void l2CpcchPingBs( void );
+void l2FTCHardHandoffTimerExpired (void);
+L2_STATE l2GetPageState (void);
+kal_uint8 l2GetPageMessageLength (void);
+kal_uint8 l2GetPageMessageType (void);
+kal_uint32 calcSumOfEcIoActivePilots(void);
+/* Misc */
+extern kal_uint16 cpCommonFieldWidth(void);
+void l2ResetGoodPageMessageRcvd(void);
+kal_bool l2GoodPageMessageReceived(void);
+void l2Set1xAdvForFchBlankingParms(kal_uint8 rcpmN2mInd, kal_uint8 rpcmDutyCycleIdx, SysActionTimeT actionTime);
+kal_bool l2ExtractRecordsAndMsgTypeFromGEM (kal_uint8* buf, kal_uint16 *index, kal_uint8 *msgType);
+#ifdef MTK_CBP
+kal_bool l2PchChanIsGood(void);
+void l2ResetPchHalfFrames(void);
+#endif
+void PswOTAMsgDhlPeerPrint(kal_uint32 traceid, kal_bool dirFwd, kal_uint8 chanType, kal_uint8 NumByte, kal_uint8* data,kal_uint8 ForChType,kal_uint8 P_REV_IN_USEs);
+
+void resetCrcErrAndMidSciNumInProbes(void);
+void IncCrcErrAndMidSciNumInProbes(void);
+kal_uint32 GetCrcErrAndMidSciNumInProbes(void);
+
+#endif /* _LAYER2_H_ */
+