blob: 083fe8910eb2767e44110c19f5b89a91b8aac3ea [file] [log] [blame]
/*****************************************************************************
* 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) 2003-2010 VIA Telecom, Inc. All rights reserved.
*
*************************************************************/
#ifndef FCPDEFS_H
#define FCPDEFS_H
/*****************************************************************************
FILE NAME: fcpdefs.h
DESCRIPTION:
This file contains all the 'hidden' constants and typedefs
that are internal to the FCP task & all its associated modules..
*****************************************************************************/
#include "sysapi.h"
#include "cpbuf.h"
#include "do_fcpapi.h"
#include "do_clcapi.h"
#include "do_dsaapi.h"
#include "slc_nvram.h"
#define PACKET_REC_VALID_SHIFT 31 /* for DRC module to use...*/
#define DRC0_CT_ISSUE
#define HWD_ST_SYMB_NUM_MASK 0x000007FF
#ifdef FCP_FTM_DRC_MIPS_BY_PASS
#undef FCP_FTM_DRC_MIPS_BY_PASS
#endif
#define DRC_SLMS_ON
#ifdef SYS_OPTION_DRC_DEBUG_ACTIVE
/* SLMS updating functions: it might be always ON later..*/
#define DRC_IMP_SPY_ON
#define DRC_ALG_DBG_SPY_ON
#define DEBUG_SLMS
#endif /* end of SYS_OPTION_DRC_DEBUG_ACTIVE*/
/*------------------------------------------------------------------------
* global vaiables..
*------------------------------------------------------------------------*/
typedef enum {
CCM_SUP_TIMER_ID,
}FcpTimerId;
/*------------------------------------------------------------------------
* global Typedefs..
*------------------------------------------------------------------------*/
typedef struct {
kal_bool formatB; // [0==FormatA; 1==FormatB]
kal_bool encrypted;
}MacPktInfoT;
typedef struct FwdLinkPkt
{
CpBufferT* CpBufPtr;
kal_uint16 PktLen;
kal_uint16 PktStartOffset;
kal_uint16 SysTimeInSlots;
kal_uint8 endPoint;
/* Mac hdr information */
MacPktInfoT macHdrInfo;
kal_uint8 FwdPhyslots;
kal_uint8 FwdMacPkts;
kal_uint8 FwdPayLoadSize;
DoChanTypeT FwdPhyChanType;
}FwdLinkPktT;
typedef struct FwdLinkPktBufList
{
FwdLinkPktT *head;
FwdLinkPktT *tail;
kal_uint32 count;
}FwdLinkPktBufListT;
typedef struct
{
kal_uint32 PacketRec;
kal_uint16 PacketPayload[6]; /* part of payload */
} DmaMdmRxSlotInfoT;
typedef struct
{
kal_uint32 DmaRxStatus;
DmaMdmRxSlotInfoT PacketInfo[RX_MDM_INT_INTERVAL];
} DmaMdmRxInfoT;
typedef struct
{
/* temp structure, need work with FTAP */
kal_uint16 FixedTxDrcValue;
kal_uint16 DrcMode;
} FtmFtapDrcAckConfigT;
/* DRC ETS message */
typedef struct
{
kal_uint16 DesigDRC;
kal_uint16 MaxDRCLim;
kal_uint16 Data_3;
kal_uint16 Data_4;
} FtmDRCEtsMsgT;
typedef enum
{
RXSD_FIR_AUTO,
RXSD_FIR_DEFAULT,
RXSD_FIR_POKE_HW
}RxsdFirTapTestModeT;
typedef enum
{
RMC_MMSE_MRC_AUTO,
RMC_FORCE_MRC
}RmcMmseMrcT;
typedef enum
{
ETS_FIX_TXDRC_SET = 0,
ETS_FIX_TXDRC_DISABLE = 1
}FcpTestFixDrcValModeT;
typedef struct
{
FcpTestFixDrcValModeT EtsFixDrcValMode;
kal_uint8 EtsFixDrcVal;
} FcpTestFixDrcValMsgT;
typedef enum
{
FCP_STAT_PERIOD_128_FRAME = 128,
FCP_STAT_PERIOD_256_FRAME = 256,
FCP_STAT_PERIOD_512_FRAME = 512,
FCP_STAT_PERIOD_1024_FRAME = 1024
}FcpPerfStatPeriodTypeT;
typedef struct
{
FcpPerfStatPeriodTypeT EtsStatPeriod;
} FcpSetPerfStatPeriodMsgT;
typedef enum
{
BATI_MATCH,
BATI_MISMATCH,
NON_BATI_MATCH,
NON_BATI_MISMATCH
}ATIMatchStatus;
/* FTM states */
typedef enum
{
Inactive = 0,
Variable_Rate,
Fixed_Rate
}FTMStateTypeT;
typedef struct
{
kal_uint8 DRCLength; /* real DRCLength = 2^DRCLength */
kal_uint8 DRCChannelGain;
kal_uint8 ACKChannelGain;
kal_uint8 DRCCover;
kal_uint8 FixedDRCRate;
}FTMParametersT;
/********************************************************
* Enhanced FTM SC
********************************************************/
typedef struct
{
kal_uint8 SubType; /* Default*/
kal_uint8 DRCGating;/*default*/
kal_uint8 DRCLockLength; /* Default*/
kal_uint8 SofterHandoffDelay; /* default:non public */
kal_uint8 SoftHandoffDelay;/* default: non public */
kal_uint16 NullRateDRC384Enable;/* Default Only*/
kal_uint16 DRCLockPeriod;/* Default only*/
kal_uint8 MultiUserPacketsEnabled;
kal_uint8 DSCLength;
kal_uint8 DeltaACKChannelGainMUP;
kal_uint8 ShortPacketsEnableThresh;
kal_uint8 SingleUserMultiplexPacketsEnabled;
kal_uint8 DRCSupervisionTimer;
kal_uint8 MinimumContinuationSpan;
kal_uint8 DSCChannelGainBoost;
kal_uint8 DSCBoostLength;
kal_uint8 DRCChannelGainBoost;
kal_uint8 DRCOffset[15];/* DRCOffset:1 - 14, 0 is invalid */
} FTMAttributeT;
typedef struct
{
FTMAttributeT FTMAttributes;
FTMParametersT FTMParameter;
}FTMPersonalityInfoT;
#define FTMDataTypeT FTMPersonalityInfoT
/* AttributeId */
typedef enum
{
FTM_DEFAULT_DRC_GATING_ATTRIBID = 0xff,
FTM_DEFAULT_NULL_RATE_ATTRIBID = 0xfd,
FTM_DEFAULT_DRC_LOCK_ATTRIBID=0x01,
FTM_DEFAULT_HANDOFF_DELAY_ATTRIBID=0x00
} FtmDefaultAttribIdT;
typedef enum
{
FTM_ENHANCE_DRC_GATING_ATTRIBID=0xff,
FTM_ENHANCE_DRC_LOCK_LEN_ATTRIBID=0xfe,
FTM_ENHANCE_MUL_USR_PKT_EN_ATTRIBID=0xfd,
FTM_ENHANCE_DSC_LEN_ATTRIBID=0xfc,
FTM_ENHANCE_DELTA_ACK_CHAN_GAIN_MUP_ATTRIBID=0xfb,
FTM_ENHANCE_SHORT_PKT_EN_THRESH_ATTRIBID=0xfa,
FTM_ENHANCE_SINGLE_USR_MUL_PKT_EN_ATTRIBID=0xf9,
FTM_ENHANCE_DRC_SUPERVISION_TIMER_ATTRIBID=0xf8,
FTM_ENHANCE_MIN_CON_TIMER_ATTRIBID=0xf7,
FTM_ENHANCE_DSC_CH_GAIN_BOOST_ATTRIBID=0xf6,
FTM_ENHANCE_DSC_BOOST_LEN_ATTRIBID=0xf5,
FTM_ENHANCE_DRC_CH_GAIN_BOOST_ATTRIBID=0xf4,
FTM_ENHANCE_DRC_BOOST_LEN_ATTRIBID=0xf3,
FTM_ENHANCE_HANDOFF_DELAY_ATTRIBID=0x00,
FTM_ENHANCE_DRC_TRANS_OFFSET_ATTRIBID=0x01
}FtmEnhanceAttribIdT;
typedef enum
{
FTM_DRC_GATING_CONTINUOUS=0,
FTM_DRC_GATING_DISCONTINUOUS,
} FtmDrcGatingT;
typedef enum
{
FTM_DRC_LOCK_LENGHT_8=0,
FTM_DRC_LOCK_LENGHT_16,
FTM_DRC_LOCK_LENGHT_32,
FTM_DRC_LOCK_LENGHT_64
} FtmDrcLockLengthT;
typedef enum
{
FTM_SHORT_PKT_EN_THRESH_1024,
FTM_SHORT_PKT_EN_THRESH_2048,
FTM_SHORT_PKT_EN_THRESH_3072,
FTM_SHORT_PKT_EN_THRESH_4096
}FtmShortPacketsEnabledThreshT;
#define FWDLINKPKTT_SIZE sizeof(FwdLinkPktT)
#define NUM_MAC_FWDLIST_NODES 100
#define NUM_PCP_FWDLIST_NODES 100
#define NUM_CRCPASS_NUM 100
/*------------------------------------------------------------------------
* global defines..
*------------------------------------------------------------------------*/
#define DMA_RX_PTR_BASE 0x0B450000
#define DMA_RX_PRM_BASE 0x0B450000
#define CRC_VALID 0x00000008
#define VALID_PKT 0x80000000
#define GOOD_PKT 0x40000000
#define MAC_INDEX 0x1FC00000
#define DMA_LENGTH 0x00038000
#define CRC_TYPE 0x00004000
#define SYNC_CAPSULE_BIT 0x80
#define FIRST_PACKET 0x40
#define LAST_PACKET 0x20
#define CCM_OFFSET 0x18
#define SLP_STATE_CAPSULE_DONE 0x04
#define SEC_LAYER_FORMAT_BIT 0x80
#define CONN_LAYER_FORMAT_BIT 0x40
#define ATI_MASK_2BITS 0x03
#define TRAFFIC_CH_CONNECTION_LAYER_FORMAT_BIT 0x80
#define TRAFFIC_CH_MAC_LAYER_FORMAT_BIT 0x40
#define TRAFFIC_CH_MAC_LAYER_PHY2_TRAILER 0xC0
#define PACKET_REC_MPA_SPY_SIZE 32
#define DRC_SLOT_INVALID 0
#define DRC_SLOT_CCH_DATA 2
#define DRC_SLOT_SINGLE_USER_SIMPLEX 1
#define DRC_SLOT_SINGLE_USER_MULPLEX 3
#define DRC_SLOT_MULTI_USER 5
#define MEM_LEAK_CHK_ALLOC { \
extern kal_int32 FwdPktListBufferCnt; \
FwdPktListBufferCnt++; \
dhl_print ("FwdListBufferCnt: %x", FwdPktListBufferCnt); \
}\
#define MEM_LEAK_CHK_FREE { \
extern kal_int32 FwdPktListBufferCnt; \
FwdPktListBufferCnt--; \
dhl_print ("FwdListBufferCnt: %x", FwdPktListBufferCnt); \
}\
#define CPBUF_LEAK_CHK_ALLOC( Buf) { \
dhl_print ("CpBuf:RefCnt:%x Addr: %x", Buf->refcount, Buf->dataPtr); \
}\
#define CPBUF_LEAK_CHK_FREE( Buf) { \
dhl_print ("CpBuf:RefCnt:%x Addr:%x", Buf->refcount, Buf->dataPtr); \
}\
#define PRINT_MAC_PKT_INFO { \
MonPrintf("NewPktInfo: Len:%x", length); \
MonPrintf("NewPktInfo: FormatB:%x",newPkt->macHdrInfo.formatB); \
MonPrintf("NewPktInfo: Ency:%x",newPkt->macHdrInfo.encrypted); \
MonPrintf("NewPktInfo: PktStartOffset:%x",newPkt->PktStartOffset); \
} \
/**********************************************************/
/* These MACROs are used to parse the Fwd MAC Packets */
/* Subtype 2. */
/**********************************************************/
#define SU_SIMPLEX_B 0xC0
#define SU_SIMPLEX_A 0x40
#define SU_MULTIPLEX 0x80
#define MULT_USR 0x00
/*------------------------------------------------------------------------
* Globle Declarations
*------------------------------------------------------------------------*/
typedef struct
{
kal_uint16 timeStampInSlot;
kal_uint8 UserMacIdx;
kal_uint8 control_2;
kal_uint32 packetRec[PACKET_REC_MPA_SPY_SIZE];
kal_uint16 Drc_C2i[PACKET_REC_MPA_SPY_SIZE];
} PacketRecSpyT;
typedef struct
{
kal_bool ValidPack;
kal_bool GoodPack;
kal_bool BCMCSPack;
kal_uint16 Macid;
kal_uint8 DRCVal;
kal_uint8 EPSize;
kal_uint8 RateDet;
kal_uint8 SlotCount;
kal_uint8 TimeStamp;
kal_bool CRCStatus;
kal_uint8 ReserveBit;
kal_bool RecStart;
kal_bool PacketComplete;
kal_bool ControlChan;
kal_uint16 PacketC2I;
} FcpPacketRecordDataT;
typedef struct
{
FTMStateTypeT State;
} FcpFtmStateT;
/******************************************************************************
Global
******************************************************************************/
typedef enum
{
FTM_FIXMODE_ENABLE_MSG,
FTM_FIXMODE_XOFF_MSG,
FTM_SCP_CONFIG_REQ_MSG = 0x50,
FTM_SCP_CONFIG_RSP_MSG,
FTM_ATTRI_UPDATE_REQ_MSG = 0x52,
FTM_ATTRI_UPDATE_ACCEPT_MSG = 0x53,
FTM_ATTRI_UPDATE_REJ_MSG = 0x54
}FtmOtaMsgIdT;
/******************************************************************************
Prototypes
******************************************************************************/
extern void CcmInitialize( void );
extern void CcmDeActivate( void );
extern void CcmActivate( void );
extern void PcpClearCLPPktList(void);
extern void PcpInitialize(void);
extern void FtmDeActivate( void );
extern void FtmActivate( void );
extern void FtmFtapDrcAckConfig(FtmFtapDrcAckConfigT *CtrlPtr );
extern void FtmInitialize( void );
extern void FTMStateSet(FTMStateTypeT State);
extern FTMStateTypeT FTMStateGet(void);
extern void FTMEventProc(msg_type MsgId, ilm_struct *current_ilm);
extern void DRCFixedTxRateSet(FtmFtapDrcAckConfigT* FtapMsgP);
extern void FcpDRCSlotAttrSet(kal_uint32 AttrValue);
extern void DRCEtsMsgProc(FtmDRCEtsMsgT *MsgP);
extern void FcpFixDrcVal(FcpTestFixDrcValMsgT *MsgDataP);
#if defined (MTK_DEV_ENGINEER_MODE)
extern void FixDrcModeProcess(kal_bool Start);
#endif
extern kal_uint8* FtmAttributeRequest(kal_bool DefaultMac);
extern void DRCFTCAttributesGet(void);
extern void DRCParameterReinstate(void);
extern void CcmSupTimerReset(void);
extern void CcmHandleEltCcmSupervisionExpiredCmdMsg(EltCcmSupervisionExpiredCmdMsgT *MsgDataP);
extern void CcmSupervisionExpiredInAccessState(void);
extern void FwdLinkPktBufInit( FwdLinkPktT *rec );
extern void FwdLinkPktBufPoolInit(void);
extern FwdLinkPktT* FwdLinkPktBufGet(void);
extern void FwdLinkPktBufFree( FwdLinkPktT *rec );
extern void StreamInitialize(void);
extern void ProcessRcpStreamConfigMsg(void *MsgDataP);
extern kal_uint16 FcpFindAppTypeByStreamNum(kal_uint8 StreamNum);
extern void CcmKeepAliveCfgMsg(CcmSmpKeepAliveCfgT* MsgDataPtr);
extern void CcmSessionOpened(void);
extern void CcmSessionClosed(void);
extern void FtmProcessOtaFwdSigMsg(DsaFwdMsgT *MsgDataP);
extern void DsafProcessOtaFwdMsg(DsaFwdMsgT *MsgDataP);
extern kal_uint8 FcpAcquireMacIndex(void);
extern kal_uint16 FcpAcquirePER(void);
#endif