[Feature]Upload Modem source code

Change-Id: Id4294f30faced84d3e6fd6d5e61e1111bf287a37
diff --git a/mcu/interface/l1/cl1/common/cl1fhrtbaif.h b/mcu/interface/l1/cl1/common/cl1fhrtbaif.h
new file mode 100644
index 0000000..7e7296b
--- /dev/null
+++ b/mcu/interface/l1/cl1/common/cl1fhrtbaif.h
@@ -0,0 +1,475 @@
+/*****************************************************************************
+*  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).
+*
+*****************************************************************************/
+
+#ifndef  _CL1FHRTBAIF_H_
+#define  _CL1FHRTBAIF_H_
+
+#ifdef MTK_DEV_93M_PREIT
+    
+/*****************************************************************************
+
+  FILE NAME: cl1fhrtbaif.h
+
+  DESCRIPTION:
+
+     This file contains the message type and apis of RTBA for other modules.
+
+*****************************************************************************/
+
+
+/*----------------------------------------------------------------------------
+ Include Files
+----------------------------------------------------------------------------*/
+#include "cl1fhrtbadefs.h"
+#define RTBA_PRI_CHANNEL_STATUS_GET(Mode)   (RtbaChannelStatusGet(Mode,KAL_TRUE))
+
+#ifdef MTK_DEV_93M_RTBA_RBS_SCENARIO_CONTROL_ENABLE
+#define RBS_SCEN_CTRL_SPECIFIC_TIMING_SET(Enable)            (gRtbaRbsScenCtrlScheInfo.SpecificEvtTimingSet = Enable)
+#define RBS_SCEN_CTRL_SPECIFIC_TIMING_GET()                  (gRtbaRbsScenCtrlScheInfo.SpecificEvtTimingSet)
+#endif
+
+/** The RF reserve end indication from RTBA. */
+typedef struct
+{
+    RtbaCl1ChannelTypeT     Cl1Channel;      /**The Rf Reserve End Ind received RTBA channel. */
+} Cl1RtbaRfReserveEndIndMsgT;
+#ifdef MTK_DEV_93M_RTBA_RBS_SCENARIO_CONTROL_ENABLE
+typedef struct
+{
+    kal_bool                RbsScenCheckPass;      /**The Rf Reserve End Ind received RTBA channel. */
+} RtbaRbsScenCtrlRptIndMsgT;
+#endif
+
+/*----------------------------------------------------------------------------
+* RTBA global APIs
+*----------------------------------------------------------------------------*/
+/*****************************************************************************
+ 
+  FUNCTION NAME:   RtbaInit
+
+  DESCRIPTION:     The RTBA initialization function
+
+  PARAMETERS:      
+
+  RETURNED VALUES: 
+*****************************************************************************/
+extern void RtbaInit(void);
+
+/*****************************************************************************
+ 
+  FUNCTION NAME:   RtbaCl1SwitchActiveRatReq
+
+  DESCRIPTION:     CL1 inform RTBA the rat status
+
+  PARAMETERS:      SysAirInterface - 1xRTT or EVDO    Activate - Indicate the mode is active or not
+
+  RETURNED VALUES: 
+*****************************************************************************/
+extern void RtbaCl1SwitchActiveRatReq(SysAirInterfaceT mode, kal_bool Activate);
+
+/*****************************************************************************
+ 
+  FUNCTION NAME:   RtbaCl1RegReq
+
+  DESCRIPTION:     CL1 register channel on RTBA
+
+  PARAMETERS:      mode            - Indicate 1xRTT or EVDO
+                   Cl1Channel      - CL1 registered channel in RTBA
+                   StartTimeValid  - Indicate the start time is valid, if not, RTBA will try
+                                     to reserve the resource as soon as possible
+                   StartTime       - The start time of this channel in FRC
+                   ReserveLen      - The needed reserve length of this channel,in us unit
+                   GapEndFRC       - The gap end FRC time used by GM
+                   *RtbaCallBackFunc   - The channel specified call back funtion
+                   HwState         - Indicate RF On/Off
+
+
+  RETURNED VALUES: 
+*****************************************************************************/
+extern void RtbaCl1RegReq(SysAirInterfaceT Mode, RtbaCl1ChannelTypeT Cl1Channel, 
+                          kal_bool StartTimeValid, kal_uint32 StartTime, kal_uint32 ReserveLen, kal_uint32 GapEndFRC,
+                          RtbaCbFunc RtbaCallBackFunc);
+
+/*****************************************************************************
+ 
+  FUNCTION NAME:   RtbaCl1RegWithPostProcessMarginReq
+
+  DESCRIPTION:     CL1 register channel on RTBA
+
+  PARAMETERS:      Mode            - Indicate 1xRTT or EVDO
+                   Cl1Channel      - CL1 registered channel in RTBA
+                   StartTimeValid  - Indicate the start time is valid, if not, RTBA will try
+                                     to reserve the resource as soon as possible
+                   StartTime       - The start time of this channel in FRC
+                   ReserveLen      - The needed reserve length of this channel,in us unit
+                   GapEndFRC       - The gap end FRC time used by GM
+                   PostProcessMargin - The post process margin for this channel
+                   *RtbaCallBackFunc   - The channel specified call back funtion
+
+
+  RETURNED VALUES: 
+*****************************************************************************/
+extern void RtbaCl1RegWithPostProcessMarginReq(SysAirInterfaceT Mode, RtbaCl1ChannelTypeT Cl1Channel, 
+                   kal_bool StartTimeValid, kal_uint32 StartTime, kal_uint32 ReserveLen, kal_uint32 GapEndFRC, kal_uint32 PostProcessMargin,
+                   RtbaCbFunc RtbaCallBackFunc);
+
+/*****************************************************************************
+ 
+  FUNCTION NAME:   RtbaCl1ProtectionCfgReq
+
+  DESCRIPTION:     CL1 Protect the channel on RTBA
+
+  PARAMETERS:      Mode            - Indicate 1xRTT or EVDO
+                   ProtectReason   - The channel protection reason
+
+  RETURNED VALUES: 
+*****************************************************************************/
+extern void RtbaCl1ProtectionCfgReq(SysAirInterfaceT Mode, RtbaProtecReasonT ProtectReason);
+
+/*****************************************************************************
+ 
+  FUNCTION NAME:   RtbaCl1CancelReq
+
+  DESCRIPTION:     CL1 cancel the channel on RTBA
+
+  PARAMETERS:      mode            - Indicate 1xRTT or EVDO
+                   CancelAll       - True - Cancel all registered all reserve channel, False - Not cancel all
+                   Cl1Channel      - CL1 cancel channel in RTBA
+
+  RETURNED VALUES: 
+*****************************************************************************/
+extern void RtbaCl1CancelReq(SysAirInterfaceT Mode, kal_bool CancelAll, RtbaCl1ChannelTypeT Cl1Channel);
+
+/*****************************************************************************
+ 
+  FUNCTION NAME:   RtbaCl1CancelQueryReq
+
+  DESCRIPTION:     CL1 cancel the query on RTBA
+
+  PARAMETERS:      mode            - Indicate 1xRTT or EVDO
+
+  RETURNED VALUES: 
+*****************************************************************************/
+extern void RtbaCl1CancelQueryReq(SysAirInterfaceT Mode);
+
+/*****************************************************************************
+ 
+  FUNCTION NAME:   RtbaCl1ChannelChangeReq
+
+  DESCRIPTION:     CL1 change the channel to new channel on RTBA
+
+  PARAMETERS:      mode            - Indicate 1xRTT or EVDO
+                   Cl1Channel      - CL1 changed channel in RTBA
+
+  RETURNED VALUES: 
+*****************************************************************************/
+extern void RtbaCl1ChannelChangeReq(SysAirInterfaceT Mode, RtbaCl1ChannelTypeT Cl1Channel);
+
+/*****************************************************************************
+ 
+  FUNCTION NAME:   RtbaCl1KickQueryReq
+
+  DESCRIPTION:     CL1 use this API to kick RTBA to query with RTB
+
+  PARAMETERS:      Mode            - Indicate the 1xRTT or EVDO mode
+
+  RETURNED VALUES: 
+*****************************************************************************/
+extern void RtbaCl1KickQueryReq(SysAirInterfaceT Mode);
+
+/*****************************************************************************
+ 
+  FUNCTION NAME:   RtbaHscKickQueryReq
+
+  DESCRIPTION:     HSC use this API to kick RTBA to query with RTB
+
+  PARAMETERS:      Mode             - Indicate the 1xRTT or EVDO mode
+                   *ChannelType     - HSC use this API to query the registered RTB channel, the queryied channel type is returned 
+                   *RxOnTime        - The RF on time in C2K system time unit, valid only when the return value is true
+                   *RxOffTime       - The RF off time in C2K system time unit, valid only when the return value is true and the channel type is QPCH1/2 and CCI
+
+  RETURNED VALUES: The Query Result is success or not
+*****************************************************************************/
+extern kal_bool RtbaHscKickQueryReq(SysAirInterfaceT Mode, RtbaCl1ChannelTypeT *ChannelType, SysSFrameTimeT *RxOnTime, SysSFrameTimeT *RxOffTime);
+
+
+/*****************************************************************************
+ 
+  FUNCTION NAME:   RtbaQueryEvdoDFSEndTime
+
+  DESCRIPTION:     L1D use this API to get the EVDO's DFS End time and to calc the delay frame number 
+
+  PARAMETERS:      
+  RETURNED VALUES: The delayed frame number(20ms Frame size 0- no delay, 1- delay 20ms)
+*****************************************************************************/
+extern kal_uint8 RtbaQueryEvdoDFSEndTime(void);
+
+/*****************************************************************************
+ 
+  FUNCTION NAME:   RtbaProcessSimIndexInfoMsg
+
+  DESCRIPTION:     RTBA use this API to process the sim index information from VAL 
+
+  PARAMETERS:      
+  RETURNED VALUES: 
+*****************************************************************************/
+extern void RtbaProcessSimIndexInfoMsg(void *MsgDataP);
+
+/*****************************************************************************
+ 
+  FUNCTION NAME:   RtbaProcessMMOGapDisableMsg
+
+  DESCRIPTION:     RTBA use this API to provide to HSC for help to disable MMO GAP
+
+  PARAMETERS:      
+  RETURNED VALUES: 
+*****************************************************************************/
+extern void RtbaProcessMMOGapDisableMsg(void *MsgDataP);
+
+
+#ifdef MTK_PLT_ON_PC_IT
+/*****************************************************************************
+ 
+  FUNCTION NAME:   CBSSimIndexInfoMsg
+
+  DESCRIPTION:     CBS use this API to process the sim index information from VAL 
+
+  PARAMETERS:      
+  RETURNED VALUES: 
+*****************************************************************************/
+extern void CBSSimIndexInfoMsg(kal_bool C2KInSIM2);
+#endif
+
+/*****************************************************************************
+ 
+  FUNCTION NAME:   RtbaChannelPrioBoostReq
+
+  DESCRIPTION:     RTBA provide this API for CL1 to raise the channel priority tempory for once time
+
+  PARAMETERS:      Mode            - Indicate the 1xRTT or EVDO mode
+                   Cl1Channel      - CL1 channel in RTBA to boost the priority
+  RETURNED VALUES: 
+*****************************************************************************/
+extern void RtbaChannelPrioBoostReq(SysAirInterfaceT Mode, RtbaCl1ChannelTypeT Cl1Channel);
+
+/*****************************************************************************
+ 
+  FUNCTION NAME:   RtbaGateModeReq
+
+  DESCRIPTION:     RTBA Provide this API to CL1 to enable/disable the gate mode  
+
+  PARAMETERS:      Mode       - Indicate the 1xRTT or EVDO mode
+                   Reason     - Indicate the gate mode enable/disble reason
+                   GapLen     - If the gate mode enable for MMO gap offer, the provided GAP length 
+                   
+  RETURNED VALUES: 
+*****************************************************************************/
+extern void RtbaGateModeReq(SysAirInterfaceT Mode, RtbaGateModeReasonT Reason, kal_uint32 GapLen);
+
+/*****************************************************************************
+ 
+  FUNCTION NAME:   RtbaReadSimIndex
+
+  DESCRIPTION:     RTBA use this API to provide sim index.
+
+  PARAMETERS:     
+  RETURNED VALUES: current sim index
+*****************************************************************************/
+extern kal_uint32 RtbaReadSimIndex(void);
+
+/*****************************************************************************
+ 
+  FUNCTION NAME:   RtbaEventHandler
+
+  DESCRIPTION:     RTBA Event Handler main function
+
+  PARAMETERS:      Mode            - Indicate 1xRTT or EVDO
+  RETURNED VALUES: 
+*****************************************************************************/
+extern void RtbaEventHandler(SysAirInterfaceT Mode);
+
+/*****************************************************************************
+ 
+  FUNCTION NAME:   RtbaQueryScheduler
+
+  DESCRIPTION:     RTBA Query Scheduler main function
+
+  PARAMETERS:      Mode            - Indicate 1xRTT or EVDO
+  RETURNED VALUES: 
+*****************************************************************************/
+extern void RtbaQueryScheduler(SysAirInterfaceT Mode);
+
+/*****************************************************************************
+ 
+  FUNCTION NAME:   RtbaQueryActiveBlockInfo
+
+  DESCRIPTION:     RTBA Provide this API for other module to query the active block running in RTBA
+
+  PARAMETERS:      Mode - Indicate to RTBA for query which mode's active channel
+                   *BlockStartTime - If the channel is active, return the block start time in RTBA in system time format
+                                   - Only valid when the API returns KAL_TRUE
+  
+  RETURNED VALUES: True  - For Current Mode, the channel is active and user can get the block start time in *BlockStartTime
+                   False - Currently no channel is active for this mode
+*****************************************************************************/
+extern kal_bool RtbaQueryActiveBlockInfo(SysAirInterfaceT Mode, kal_uint32 *BlockStartTime);
+
+/*****************************************************************************
+ 
+  FUNCTION NAME:   RtbaProcGateModeReqEvent
+
+  DESCRIPTION:     RTBA Provide this API for HSC/L1D to call for gate mode request event handle
+
+  PARAMETERS:      EvtPtr   - The pointer to the gate mode request
+  
+  RETURNED VALUES: 
+*****************************************************************************/
+extern void RtbaProcGateModeReqEvent(RtbaGateModeEventTypeT *EvtPtr);
+
+/*****************************************************************************
+ 
+  FUNCTION NAME:   RtbaCl1AdjustChannelPositionReq
+
+  DESCRIPTION:     RTBA Provide this API for L1D to adjust the channel block schedule start time
+
+  PARAMETERS:      Mode            - Indicate 1xRTT or EVDO
+                   StartTime       - The new start time indicated by L1
+                   ReserveLength   - The channel reserve length indicated by L1
+  
+  RETURNED VALUES: 
+*****************************************************************************/
+extern void RtbaCl1AdjustChannelPositionReq(SysAirInterfaceT Mode, kal_uint32 StartTime, kal_uint32 ReserveLen);
+
+/*****************************************************************************
+ 
+  FUNCTION NAME:   RtbaCl1GetRFOnMarginInfo
+
+  DESCRIPTION:     
+
+  PARAMETERS:      
+  
+  RETURNED VALUES: The RF on margin
+*****************************************************************************/
+extern kal_uint32 RtbaCl1GetRFOnMarginInfo(void);
+/*****************************************************************************
+ 
+  FUNCTION NAME:   RtbaCl1GetRFOffMarginInfo
+
+  DESCRIPTION:     
+  PARAMETERS:      
+  
+  RETURNED VALUES: The RF off margin
+*****************************************************************************/
+extern kal_uint32 RtbaCl1GetRFOffMarginInfo(void);
+
+/*****************************************************************************
+ 
+  FUNCTION NAME:   RtbaCl1PreClearReservationReq
+
+  DESCRIPTION:     RTBA provide this API for CL1 to pre-clear reservation before the real cancel request is called
+  PARAMETERS:      
+  
+  RETURNED VALUES: 
+*****************************************************************************/
+extern void RtbaCl1PreClearReservationReq(SysAirInterfaceT Mode);
+
+/*****************************************************************************
+  FUNCTION NAME:   RtbaCl1PreCancelReq
+
+  DESCRIPTION:     RTBA provide this API for CL1 to pre-cancel the RF stop event before the real cancel request is called
+  PARAMETERS:      Mode            - Indicate 1xRTT or EVDO
+  
+  RETURNED VALUES: 
+*****************************************************************************/
+extern void RtbaCl1PreCancelReq(SysAirInterfaceT Mode);
+
+/*******************************************************************************
+
+  PARAMETERS:      Mode               - Indicate 1xRTT or EVDO
+                   lastPagingTime     - indicate lastPagingTime, unit 20ms
+                   Slot_cycle         - indicate slot_cycle of DRX
+
+  RETURNED VALUES: 
+*****************************************************************************/
+extern void RtbaSltPchPositonReq(SysAirInterfaceT Mode, kal_uint32 LastPagingTime, kal_uint32 Slot_Cycle);
+#ifdef SYS_OPTION_TX_TAS_ENABLE
+/*****************************************************************************
+  FUNCTION NAME:   RtbaTasBackOffQuery
+
+  DESCRIPTION:     RTBA provide this API for TAS to query whether can execute 
+  RF tuner or not
+  PARAMETERS:      Mode            - Indicate 1xRTT or EVDO
+                   MinReserveLength   -Indicate the the Min Length of TAS RF 
+                   Tuner
+  
+  RETURNED VALUES: 
+*****************************************************************************/
+extern void RtbaTasBackOffQuery(SysAirInterfaceT Mode, kal_uint32 MinReserveLength, RtbaTasQueryResultT* QueryResult);
+#endif
+
+/*****************************************************************************
+
+  FUNCTION NAME: RbsDenyPatternInfoRecord
+
+  DESCRIPTION:   this API is used for recoding script infomation
+
+  PARAMETERS:    pDenyPattern    - point to script infomation 
+
+  RETURNED VALUES: 
+  
+*****************************************************************************/
+#ifdef MTK_DEV_93M_RTBA_RBS_ENABLE
+extern void RbsDenyPatternInfoRecord(kal_uint8* pDenyPattern);
+#endif
+/*****************************************************************************
+
+  FUNCTION NAME: HscPreemptTrigInfoRecord
+
+  DESCRIPTION:   this API is used for recoding script infomation
+
+  PARAMETERS:    pHscPreemptTrig    - point to script infomation  
+
+  RETURNED VALUES: 
+  
+*****************************************************************************/
+#ifdef MTK_DEV_93M_RTBA_HPS_TRIG_ENABLE
+extern void HscPreemptTrigInfoRecord(kal_uint8* pHscPreemptTrig);
+#endif
+
+#ifdef MTK_DEV_93M_RTBA_RBS_SCENARIO_CONTROL_ENABLE
+extern void RtbaCl1RbsScenarioControlReq(RbsScenarioControlParaT *pRbsScenCtrlPara);
+#endif
+#endif
+#endif