blob: b9794d5b1e12dd8cc6044117cce7b0dbb0e534f8 [file] [log] [blame]
rjw6c1fd8f2022-11-30 14:33:01 +08001/*****************************************************************************
2* Copyright Statement:
3* --------------------
4* This software is protected by Copyright and the information contained
5* herein is confidential. The software may not be copied and the information
6* contained herein may not be used or disclosed except with the written
7* permission of MediaTek Inc. (C) 2016
8*
9* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
10* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS (""MEDIATEK SOFTWARE"")
11* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
12* AN ""AS-IS"" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
13* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
14* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
15* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
16* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
17* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
18* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
19* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
20* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
21*
22* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
23* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
24* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
25* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
26* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
27*
28* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
29* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
30* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
31* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
32* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
33*
34*****************************************************************************/
35/*************************************************************
36*
37* This Software is the property of VIA Telecom, Inc. and may only be used pursuant to a license from VIA Telecom, Inc.
38*
39* Any unauthorized use inconsistent with the terms of such license is strictly prohibited.
40*
41* Copyright (c) 2006-2010 VIA Telecom, Inc. All rights reserved.
42*
43*************************************************************/
44#ifndef _SLCAMP_H_
45#define _SLCAMP_H_ 1
46/*****************************************************************************
47*
48* FILE NAME : slcamp.h
49*
50* DESCRIPTION : This file includes the definition of AMP
51*
52* HISTORY :
53* See Log at end of file
54*
55*****************************************************************************/
56#include "do_slcapi.h"
57#include "do_fcpapi.h"
58#include "do_dsaapi.h"
59#include "do_slcapi.h"
60#include "slc_nvram.h"
61
62#define UATIASSIGN_MESSAGEID_LEN 8
63#define UATIASSIGN_MESSAGESEQ_LEN 8
64#define UATIASSIGN_RESERVED1_LEN 7
65#define UATIASSIGN_SUBNETINCLUDED_LEN 1
66#define UATIASSIGN_UATISUBNETMASK_LEN 8
67#define UATIASSIGN_UATI104_LEN 8
68#define UATIASSIGN_UATICOLORCODE_LEN 8
69#define UATIASSIGN_UATI1024_LEN 8
70#define UATIASSIGN_UPPEROLDUATILEN_LEN 4
71#define UATIASSIGN_RESERVED2_LEN 4
72
73#ifdef MTK_CBP
74 /* Max length of UpperOldUATILength in octects
75 *for UATIAssignment and UATIComplete messages. */
76 #define UPPER_OLD_UATI_MAX_LEN 13
77#endif
78
79#define HARDWAREREQ_MESSAGEID_LEN 8
80#define HARDWAREREQ_TRANSID_LEN 8
81
82#define UATIREQ_MESSAGEID_LEN 8
83#define UATIREQ_TRANSID_LEN 8
84
85#define UATICMP_MESSAGEID_LEN 8
86#define UATICMP_TRANSID_LEN 8
87#define UATICMP_RESERVED_LEN 4
88#define UATICMP_UPPEROLDUATI_LEN 4
89
90#define HARDWARERSP_MESSAGEID_LEN 8
91#define HARDWARERSP_TRANSID_LEN 8
92#define HARDWARERSP_IDTYPE_LEN 24
93#define HARDWARERSP_HARDWAREID_LEN 8
94#define HARDWARERSP_ESN 32
95
96#define CONFIGRSP_MESSAGEID_LEN 8
97#define CONFIGRSP_TRANSID_LEN 8
98#define CONFIGRSP_ATTR_LEN 8
99
100#define CONFIGREQ_MESSAGEID_LEN 8
101#define CONFIGREQ_TRANSID_LEN 8
102#define CONFIGREQ_ATTR_LEN 8
103#define DSA_FWD_MESSAGEID_LEN 8
104
105#define ATTRIUPDATE_MESSAGEID_LEN 8
106#define ATTRIUPDATE_TRANSID_LEN 8
107#define ATTRIUPDATE_REC_LEN 8
108#define ATTRIUPDATE_ATTRID_LEN 8
109
110
111
112#define UATIRQ_INTERVAL (120*1000)
113#define ADDR_INTERVAL (180*1000) /*in unit of ms*/
114#define ADDR_INTERVAL_IN_FRAMES (ADDR_INTERVAL*3/80)
115
116#define AMP_DEFAULT_SUBTYPE 0x0000
117
118#define UATI_COMPLETE_RESEND_DURATION 20000 /* 15s based on ALU test */
119#define UATI_RESEND_INTERVAL 9000 /* to avoid multiple of 1X SCI-1 or SCI-2. */
120#define UATI_SEND_DELAY 2500 /* to give time to OMP update after hash or IHO handling */
121#define UATI_SEND_DELAY_FOR_CHANNEL_HASH 5000 /* to give time to OMP update after hash or IHO handling */
122#define UATI_RESEND_INTERVAL_AFTER_HWDIDRSP 1000 /* To reduced lengthened timer if we've already gone this far. */
123
124typedef enum {
125 Amp_InUse,
126 Amp_InConfig,
127 Amp_Instance
128}AmpInstance;
129
130typedef enum {
131 HardwareID_MEID = 0x00ffff,
132 HardwareID_ESN = 0x010000,
133 HardwareID_NA = 0xffffff
134}HardwareIDType;
135
136typedef enum {
137 MaxNoMonitorDistance = 0xff,
138 HardwareSeparableFromSession = 0xfe,
139 SupportGAUPMaxNoMonitorDistance = 0xfd,
140 ReducedSubnetMaskOffset = 0xfc,
141 SupportSecondaryColorCodes = 0xfb,
142}AmpAttributeID;
143
144typedef enum {
145 AMP_UATI_REQ_MSG = 0x00,
146 AMP_UATI_ASSIGN_MSG = 0x01, /*UATI Assignment Msg received from AN*/
147 AMP_UATI_CMP_MSG = 0x02, /*UATI Completion message*/
148 AMP_HARDWARE_REQ_MSG = 0x03, /*HardwareID Request received from AN*/
149 AMP_HARDWARE_RSP_MSG = 0x04, /*HardwareID Rsp message Type*/
150 AMP_CONFIG_REQ_MSG = 0x50,
151 AMP_CONFIG_RSP_MSG = 0x51,
152 AMP_ATTRI_UPDATE_REQ_MSG = 0x52,
153 AMP_ATTRI_UPDATE_ACCEPT_MSG = 0x53,
154 AMP_ATTRI_UPDATE_REJ_MSG = 0x54,
155 ALL_AMP_MSG
156}AmpMessageTypeT;
157
158typedef enum {
159 INACTIVE_ST,
160 SETUP_ST,
161 OPEN_ST
162}AmpStateT;
163
164typedef enum {
165 AMP_UATIREQ_TRANS_ID = 0x10,
166 AMP_ATTRIUPDATE_ACCEPTREJ_TRANS_ID,
167 AMP_UATICOMPLETE_TRANS_ID,
168 AMP_HWIDRESPONSE_TRANS_ID,
169 AMP_TRANS_ID
170}AmpDsaTransIDT;
171
172typedef struct {
173 kal_uint8 MessageID;
174 kal_uint8 MessageSeq;
175 kal_bool SubnetIncluded;
176 kal_uint8 UATISubnetMask;
177 kal_uint8 UATI104[13];
178 kal_uint8 UATIColorCode;
179 kal_uint8 UATI024[3];
180 kal_uint8 UpperOldUATILen;
181}AmpUATIAssignMsgT;
182
183typedef struct {
184 kal_uint8 UATIAssignMessageSeq;
185 kal_uint8 UATIColorCode;
186 kal_uint8 UATISubnetMask;
187 kal_uint8 UpperOldUATILen;
188 kal_uint8 UATI[16];
189 kal_uint8 ReducedSubnetMask[16];
190 kal_uint8 UATIAvailable;
191
192 kal_uint8 OldUATIAssignMessageSeq;
193 kal_uint8 OldUATIColorCode;
194 kal_uint8 OldUATISubnetMask;
195 kal_uint8 OldUpperOldUATILen;
196 kal_uint8 OldUATI[16];
197 kal_uint8 OldReducedSubnetMask[16];
198 kal_uint8 OldUATIAvailable;
199
200 kal_uint8 UATIReqTransID;
201 kal_uint8 AttriTransId;
202 kal_uint8 InuseSubtype;
203 kal_uint32 SessionSeed;
204 kal_uint32 X0;
205 kal_uint32 Y0;
206
207 /***********above entries will be saved into session file ***********/
208
209 AmpOmpSectorParamsT OmpSectorParam;
210 kal_uint8 InconfigSubtype;
211 AmpStateT AmpState;
212 kal_bool bNetworkAcq;
213 kal_uint8 bConnCloseOrIdleHo; /* 0: no event. 1:closeConnection. 2:IHO */
214 kal_bool bUATIReqSent;
215 kal_uint8 UATIReqSendCnt;
216 kal_uint8 UATIReqResendCnt;
217 kal_uint8 UATICompleteSendCnt;
218}AmpParamT;
219
220#if 0
221/* under construction !*/
222/* under construction !*/
223/* under construction !*/
224/* under construction !*/
225/* under construction !*/
226/* under construction !*/
227/* under construction !*/
228/* under construction !*/
229/* under construction !*/
230/* under construction !*/
231/* under construction !*/
232/* under construction !*/
233/* under construction !*/
234/* under construction !*/
235/* under construction !*/
236/* under construction !*/
237/* under construction !*/
238/* under construction !*/
239/* under construction !*/
240/* under construction !*/
241/* under construction !*/
242/* under construction !*/
243/* under construction !*/
244/* under construction !*/
245/* under construction !*/
246#endif
247
248
249typedef struct {
250 AmpAttributeID AttrID;
251 union {
252 kal_uint8 AttrValue1;
253 kal_uint32 AttrValue2;
254 }AttrValue;
255}AmpAttributeRecord;
256
257typedef struct {
258 kal_uint8 MessageID;
259 kal_uint8 TransactionID;
260 AmpAttributeRecord AttrRecord[5];
261}AmpConfigurationRspMsgT;
262
263typedef struct {
264 AmpStateT AmpState;
265 kal_uint8 UATIColorCode;
266 kal_uint8 UATISubnetMask;
267 kal_uint8 UATI[16];
268 kal_uint8 OldUATI[16];
269 kal_uint8 ReducedSubnetMask[16];
270 kal_uint8 UpperOldUATILen;
271 kal_uint32 X0;
272 kal_uint32 Y0;
273} AmpSpyStatesT;
274
275typedef struct {
276 kal_uint8 NumRecvATIList;
277 ATITypeT RcvATIList[MAX_TRANS_ATI_NUMBER];
278 ATITypeT TransATI;
279} AmpSpyATIT;
280
281typedef enum {
282 REQ_SENT,
283 REQ_ACKED,
284 UATI_COMPLETE,
285 AMP_FAILING,
286 NO_ACT
287}AmpSetupPhaseT;
288
289typedef enum {
290 RESET_FAIL,
291 SUBNET_CHANGE,
292 SYS_LOST,
293 ABORT_SETUP,
294 OTHER_REASON
295}AmpFailureT;
296
297typedef struct {
298 AmpFailureT failReason;
299}SmpAmpFailureMsgT;
300
301void AmpInit(void);
302void RunAmpStateMachine(kal_uint32 MsgId, void *MsgDataP);
303void ProcessAmpDsaFwdMsg(DsaFwdMsgT *MsgDataP);
304void ProcessAmpWaitUATIRspTimeout(void);
305void ProcessAmpAddrTimeout(void);
306void AmpGetSessionData(AmpSessionDataT *sessionData);
307void AmpRestoreSessionData(AmpSessionDataT *sessionData);
308kal_bool AmpSubnetChanged(void);
309void ProcessAmpUATICompleteTimeout(void);
310void ProcessAmpReSendUATIReqTimeOut(void);
311void AmpResetUATIAcquisition(void);
312void AmpSendIdpATIMsg(void);
313void AmpSessionNegoDoneInd(void);
314void AmpStopSessionUpdate(void);
315void AmpSaveRestorePriorSessionSeed(kal_uint8 op);
316void AmpSendDsaUATIReqMsg(void);
317#ifdef MTK_CBP
318void AmpSendDsarResetMsg(kal_bool emptyConfigReqsOnly);
319#else
320void AmpSendDsarResetMsg(void);
321#endif
322AmpStateT AmpGetState(void);
323void AmpDelDsarUatiReqWhenNewSession(void);
324
325/*****************************************************************************
326* $Log: slcamp.h $
327*****************************************************************************/
328
329/*****************************************************************************
330* End of File
331*****************************************************************************/
332#endif /*_SLCAMP_H_*/
333
334