blob: b9794d5b1e12dd8cc6044117cce7b0dbb0e534f8 [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) 2006-2010 VIA Telecom, Inc. All rights reserved.
*
*************************************************************/
#ifndef _SLCAMP_H_
#define _SLCAMP_H_ 1
/*****************************************************************************
*
* FILE NAME : slcamp.h
*
* DESCRIPTION : This file includes the definition of AMP
*
* HISTORY :
* See Log at end of file
*
*****************************************************************************/
#include "do_slcapi.h"
#include "do_fcpapi.h"
#include "do_dsaapi.h"
#include "do_slcapi.h"
#include "slc_nvram.h"
#define UATIASSIGN_MESSAGEID_LEN 8
#define UATIASSIGN_MESSAGESEQ_LEN 8
#define UATIASSIGN_RESERVED1_LEN 7
#define UATIASSIGN_SUBNETINCLUDED_LEN 1
#define UATIASSIGN_UATISUBNETMASK_LEN 8
#define UATIASSIGN_UATI104_LEN 8
#define UATIASSIGN_UATICOLORCODE_LEN 8
#define UATIASSIGN_UATI1024_LEN 8
#define UATIASSIGN_UPPEROLDUATILEN_LEN 4
#define UATIASSIGN_RESERVED2_LEN 4
#ifdef MTK_CBP
/* Max length of UpperOldUATILength in octects
*for UATIAssignment and UATIComplete messages. */
#define UPPER_OLD_UATI_MAX_LEN 13
#endif
#define HARDWAREREQ_MESSAGEID_LEN 8
#define HARDWAREREQ_TRANSID_LEN 8
#define UATIREQ_MESSAGEID_LEN 8
#define UATIREQ_TRANSID_LEN 8
#define UATICMP_MESSAGEID_LEN 8
#define UATICMP_TRANSID_LEN 8
#define UATICMP_RESERVED_LEN 4
#define UATICMP_UPPEROLDUATI_LEN 4
#define HARDWARERSP_MESSAGEID_LEN 8
#define HARDWARERSP_TRANSID_LEN 8
#define HARDWARERSP_IDTYPE_LEN 24
#define HARDWARERSP_HARDWAREID_LEN 8
#define HARDWARERSP_ESN 32
#define CONFIGRSP_MESSAGEID_LEN 8
#define CONFIGRSP_TRANSID_LEN 8
#define CONFIGRSP_ATTR_LEN 8
#define CONFIGREQ_MESSAGEID_LEN 8
#define CONFIGREQ_TRANSID_LEN 8
#define CONFIGREQ_ATTR_LEN 8
#define DSA_FWD_MESSAGEID_LEN 8
#define ATTRIUPDATE_MESSAGEID_LEN 8
#define ATTRIUPDATE_TRANSID_LEN 8
#define ATTRIUPDATE_REC_LEN 8
#define ATTRIUPDATE_ATTRID_LEN 8
#define UATIRQ_INTERVAL (120*1000)
#define ADDR_INTERVAL (180*1000) /*in unit of ms*/
#define ADDR_INTERVAL_IN_FRAMES (ADDR_INTERVAL*3/80)
#define AMP_DEFAULT_SUBTYPE 0x0000
#define UATI_COMPLETE_RESEND_DURATION 20000 /* 15s based on ALU test */
#define UATI_RESEND_INTERVAL 9000 /* to avoid multiple of 1X SCI-1 or SCI-2. */
#define UATI_SEND_DELAY 2500 /* to give time to OMP update after hash or IHO handling */
#define UATI_SEND_DELAY_FOR_CHANNEL_HASH 5000 /* to give time to OMP update after hash or IHO handling */
#define UATI_RESEND_INTERVAL_AFTER_HWDIDRSP 1000 /* To reduced lengthened timer if we've already gone this far. */
typedef enum {
Amp_InUse,
Amp_InConfig,
Amp_Instance
}AmpInstance;
typedef enum {
HardwareID_MEID = 0x00ffff,
HardwareID_ESN = 0x010000,
HardwareID_NA = 0xffffff
}HardwareIDType;
typedef enum {
MaxNoMonitorDistance = 0xff,
HardwareSeparableFromSession = 0xfe,
SupportGAUPMaxNoMonitorDistance = 0xfd,
ReducedSubnetMaskOffset = 0xfc,
SupportSecondaryColorCodes = 0xfb,
}AmpAttributeID;
typedef enum {
AMP_UATI_REQ_MSG = 0x00,
AMP_UATI_ASSIGN_MSG = 0x01, /*UATI Assignment Msg received from AN*/
AMP_UATI_CMP_MSG = 0x02, /*UATI Completion message*/
AMP_HARDWARE_REQ_MSG = 0x03, /*HardwareID Request received from AN*/
AMP_HARDWARE_RSP_MSG = 0x04, /*HardwareID Rsp message Type*/
AMP_CONFIG_REQ_MSG = 0x50,
AMP_CONFIG_RSP_MSG = 0x51,
AMP_ATTRI_UPDATE_REQ_MSG = 0x52,
AMP_ATTRI_UPDATE_ACCEPT_MSG = 0x53,
AMP_ATTRI_UPDATE_REJ_MSG = 0x54,
ALL_AMP_MSG
}AmpMessageTypeT;
typedef enum {
INACTIVE_ST,
SETUP_ST,
OPEN_ST
}AmpStateT;
typedef enum {
AMP_UATIREQ_TRANS_ID = 0x10,
AMP_ATTRIUPDATE_ACCEPTREJ_TRANS_ID,
AMP_UATICOMPLETE_TRANS_ID,
AMP_HWIDRESPONSE_TRANS_ID,
AMP_TRANS_ID
}AmpDsaTransIDT;
typedef struct {
kal_uint8 MessageID;
kal_uint8 MessageSeq;
kal_bool SubnetIncluded;
kal_uint8 UATISubnetMask;
kal_uint8 UATI104[13];
kal_uint8 UATIColorCode;
kal_uint8 UATI024[3];
kal_uint8 UpperOldUATILen;
}AmpUATIAssignMsgT;
typedef struct {
kal_uint8 UATIAssignMessageSeq;
kal_uint8 UATIColorCode;
kal_uint8 UATISubnetMask;
kal_uint8 UpperOldUATILen;
kal_uint8 UATI[16];
kal_uint8 ReducedSubnetMask[16];
kal_uint8 UATIAvailable;
kal_uint8 OldUATIAssignMessageSeq;
kal_uint8 OldUATIColorCode;
kal_uint8 OldUATISubnetMask;
kal_uint8 OldUpperOldUATILen;
kal_uint8 OldUATI[16];
kal_uint8 OldReducedSubnetMask[16];
kal_uint8 OldUATIAvailable;
kal_uint8 UATIReqTransID;
kal_uint8 AttriTransId;
kal_uint8 InuseSubtype;
kal_uint32 SessionSeed;
kal_uint32 X0;
kal_uint32 Y0;
/***********above entries will be saved into session file ***********/
AmpOmpSectorParamsT OmpSectorParam;
kal_uint8 InconfigSubtype;
AmpStateT AmpState;
kal_bool bNetworkAcq;
kal_uint8 bConnCloseOrIdleHo; /* 0: no event. 1:closeConnection. 2:IHO */
kal_bool bUATIReqSent;
kal_uint8 UATIReqSendCnt;
kal_uint8 UATIReqResendCnt;
kal_uint8 UATICompleteSendCnt;
}AmpParamT;
#if 0
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
#endif
typedef struct {
AmpAttributeID AttrID;
union {
kal_uint8 AttrValue1;
kal_uint32 AttrValue2;
}AttrValue;
}AmpAttributeRecord;
typedef struct {
kal_uint8 MessageID;
kal_uint8 TransactionID;
AmpAttributeRecord AttrRecord[5];
}AmpConfigurationRspMsgT;
typedef struct {
AmpStateT AmpState;
kal_uint8 UATIColorCode;
kal_uint8 UATISubnetMask;
kal_uint8 UATI[16];
kal_uint8 OldUATI[16];
kal_uint8 ReducedSubnetMask[16];
kal_uint8 UpperOldUATILen;
kal_uint32 X0;
kal_uint32 Y0;
} AmpSpyStatesT;
typedef struct {
kal_uint8 NumRecvATIList;
ATITypeT RcvATIList[MAX_TRANS_ATI_NUMBER];
ATITypeT TransATI;
} AmpSpyATIT;
typedef enum {
REQ_SENT,
REQ_ACKED,
UATI_COMPLETE,
AMP_FAILING,
NO_ACT
}AmpSetupPhaseT;
typedef enum {
RESET_FAIL,
SUBNET_CHANGE,
SYS_LOST,
ABORT_SETUP,
OTHER_REASON
}AmpFailureT;
typedef struct {
AmpFailureT failReason;
}SmpAmpFailureMsgT;
void AmpInit(void);
void RunAmpStateMachine(kal_uint32 MsgId, void *MsgDataP);
void ProcessAmpDsaFwdMsg(DsaFwdMsgT *MsgDataP);
void ProcessAmpWaitUATIRspTimeout(void);
void ProcessAmpAddrTimeout(void);
void AmpGetSessionData(AmpSessionDataT *sessionData);
void AmpRestoreSessionData(AmpSessionDataT *sessionData);
kal_bool AmpSubnetChanged(void);
void ProcessAmpUATICompleteTimeout(void);
void ProcessAmpReSendUATIReqTimeOut(void);
void AmpResetUATIAcquisition(void);
void AmpSendIdpATIMsg(void);
void AmpSessionNegoDoneInd(void);
void AmpStopSessionUpdate(void);
void AmpSaveRestorePriorSessionSeed(kal_uint8 op);
void AmpSendDsaUATIReqMsg(void);
#ifdef MTK_CBP
void AmpSendDsarResetMsg(kal_bool emptyConfigReqsOnly);
#else
void AmpSendDsarResetMsg(void);
#endif
AmpStateT AmpGetState(void);
void AmpDelDsarUatiReqWhenNewSession(void);
/*****************************************************************************
* $Log: slcamp.h $
*****************************************************************************/
/*****************************************************************************
* End of File
*****************************************************************************/
#endif /*_SLCAMP_H_*/