blob: a415d1205813188165f1a896f7ae225a34b9ecad [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) 1999-2010 VIA Telecom, Inc. All rights reserved.
42*
43*************************************************************/
44/****************************************************************************
45 *
46 * Module: layer2.h
47 *
48 * Purpose: Header file containing the structures for the layer 2 operation.
49 *
50 ****************************************************************************
51 *
52 * PVCS Header Information
53 *
54 * $Workfile$
55 * $Revision: 1.5 $
56 * $Modtime$
57 * $Author: wfu $
58 *
59 * $Log: layer2.h $
60 *
61 * 09 18 2020 yanfeng.xu
62 * [MOLY00559524] [Wingtech][Samsung][MT6765][N21][P200813-06136][SMC_Message][USC] CMAS containing Record Type is not received
63 *
64 * 07 06 2017 sue.zhong
65 * [MOLY00259241] [6293][C2K]Replace with KAL data type
66 * Correct copyright file header
67 *
68 * 05 17 2017 peijun.zheng
69 * [MOLY00249027] [BIACNO][MT6763][New feature]C2K code release code modification
70 *
71 * C2k code release.
72 *
73 * 11 09 2016 sue.zhong
74 * [MOLY00208435] [6293][C2K]Sync C2K code to UMOLYA TRUNK
75 * Update C2K PS code (1/2)
76 * Revision 1.5 2005/07/18 16:48:26 wfu
77 * Fix CR6696: add two new L2FTCState:L2_FTC_HARD_HANDOFF_INIT_ST and
78 * L2_FTC_HARD_HANDOFF_W_RTN_ON_FAIL_INIT_ST
79 * Revision 1.4 2005/03/18 11:44:42 hans
80 * Merged code changes from CBP4.05 revision 2.02 to CBP4.05 revision 4.21.
81 * Revision 1.3 2004/04/06 14:02:11 dstecker
82 * CBP6.1 release 1
83 * Revision 1.2 2004/03/25 12:09:37 fpeng
84 * Updated from 6.0 CP 2.5.0
85 * Revision 1.2 2003/08/28 11:19:43 bcolford
86 * Update for merge.
87 * Revision 1.18 2003/08/01 13:33:26 mclee
88 * Fix CR2506 by removing all instances of CBP3 compile flag and dead code
89 * Revision 1.17 2003/05/21 17:11:34 byang
90 * CR#570: Replace compiler flag with IS2000A with IS2000_REV_0.
91 * Revision 1.16 2002/12/26 12:08:01 hans
92 * Conditional compile flag IS2000A replaced with IS_2000_REV_A and IS_2000_REV_0 for rev A and Rev 0 specific code.
93 * Revision 1.15 2002/09/26 17:10:05 dstecker
94 * Added prototype
95 * Revision 1.14 2002/08/29 14:07:02 dstecker
96 * Changed l2totalRxPower prototype
97 * Revision 1.13 2002/08/27 17:07:22 byang
98 * Add new frame category for DCCH only discontinous
99 * mode. Insert function prototype declaration for pinging the BS.
100 * Revision 1.12 2002/08/19 10:45:50 dstecker
101 * CBP4 candidate frequency implimentation
102 * Revision 1.11 2002/06/17 17:36:21 hans
103 * 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.
104 * Revision 1.10 2002/06/13 13:55:36 hans
105 * Statistics functions already disabled with ifdef removed.
106 * Revision 1.9 2002/06/06 13:13:27 chinh
107 * Changed and Added Copyright
108 * Revision 1.8 2002/06/04 20:06:23 hans
109 * Old statistics now handled by lmd disabled with ifdef's
110 * Revision 1.7 2002/03/28 18:24:21 hans
111 * is2000 rev 0 add 2, retrievable and settable parameters implemented.
112 * CR503: get retrievable parameter implemented.
113 * CR508: set retrievable parameter implemented
114 * Revision 1.6 2001/12/14 17:11:17 mclee
115 * prototype GetSyncPageCounts()
116 * Revision 1.5 2001/08/03 15:15:05 dstecker
117 * Modifications for IS2000 handoffs
118 * Revision 1.4 2001/06/21 13:30:26 yfang
119 * merged code from CBP3 to solve the layer2 message sequence mis-matching
120 * Revision 1.3 2001/05/29 14:42:42 akayvan
121 * Added declaration for getPCNPMReceivedstatus() per CR#20.
122 * Revision 1.2 2001/03/16 11:32:23 akayvan
123 * Traffic code phase1 added.
124 * Revision 1.1 2001/01/17 10:58:58 plabarbe
125 * Initial revision
126 * Revision 1.4 2000/12/01 10:47:33 chinh
127 * Modified LAC dsch for IS2000
128 * Revision 1.3 2000/11/14 01:06:24Z byang
129 * IS-2000A Idle Mode and LAC integration - Initial Release.
130 * Revision 1.2 2000/11/13 22:01:18Z hans
131 * Check-in for cbp4 phase 1 integration
132 * Revision 1.1.2.4 2000/11/11 01:47:26Z hans
133 * SDU length calculation is done to handle message with multiple records
134 * Revision 1.1.2.3 2000/11/08 00:17:57Z hans
135 * PchMessage structure is replaced by FcschMessage structure.
136 * New IS2000 PD is not recognized by L3 and is therefore masked out from MSG_TYPE before parsed on to L3.
137 * Revision 1.1.2.2 2000/11/01 02:07:25Z hans
138 * New structure fields added to PChMessage structure.
139 * New Layer 2 (LAC) function prototypes added.
140 * Revision 1.3.2.2 2000/10/13 02:01:52Z hans
141 * CBP4 phase1 LAC implementation
142 * LAC functionality executed before cpRunTheEngine() function call
143 * Revision 1.3.2.1 2000/08/23 22:09:16Z hans
144 * Duplicate revision
145 * Revision 1.3 2000/08/23 22:09:16Z RSATTARI
146 * Isotel release 2.8 plus LSI applicable IS-95B changes.
147 * Revision 1.2 2000/03/01 18:15:06Z rsattari
148 * Isotel release 2.3 updates.
149 * Revision 1.20 2000/03/01 22:37:35 gfrye
150 * Added "somTime" to PChMessage structure to store the time at
151 * which the beginning of the message was received. Broadcast SMS
152 * needs this time for Broadcast pages to calculate when to expect
153 * a broadcast message.
154 *
155 * Revision 1.19 2000/01/17 22:27:19 scotvold
156 * TC Backward Compatibility changes.
157 *
158 * Revision 1.18 1999/08/18 23:34:21 gfrye
159 * Added l2PageMonitorInit prototype to reset the new time stamp based
160 * Page channel monitoring scheme.
161 *
162 * Revision 1.17 1999/06/16 00:37:03 scotvold
163 * Reset Power Control Counters after send PMRM.
164 *
165 * Revision 1.16 1999/06/04 23:27:26 scotvold
166 * New Message Transmitter.
167 *
168 * Revision 1.15 1999/05/18 02:12:47 mhayduk
169 * Fixed up comment.
170 *
171 * Revision 1.14 1998/12/02 00:07:12 scotvold
172 * Moved statistic counting here from stats.c
173 *
174 * Revision 1.13 1998/11/20 16:43:38 scotvold
175 * Fixed T53 ifdef.
176 *
177 * Revision 1.12 1998/10/20 23:58:23 mhayduk
178 * Added T53 support.
179 *
180 * Revision 1.11 1998/09/11 02:37:05 scotvold
181 * Candidate Frequency API changes.
182 *
183 * Revision 1.10 1998/08/14 23:48:40 scotvold
184 * Removed numPreamble from Layer 2.
185 *
186 * Revision 1.9 1998/07/27 17:25:26 scotvold
187 * Added external control of Power Control processing.
188 *
189 * Revision 1.8 1998/07/20 23:22:46 scotvold
190 * Added state machine tracing support.
191 *
192 * Revision 1.7 1998/07/14 17:23:38 scotvold
193 * FTC Supervision changes.
194 *
195 * Revision 1.6 1998/07/03 16:57:30 dfischer
196 * New load
197 *
198 * Revision 1.5 1998/06/08 21:48:25 scotvold
199 * Updated for Release 0.06.
200 *
201 * Revision 1.4 1998/05/01 18:13:54 scotvold
202 * Update for release 0.04
203 *
204 * Revision 1.3 1998/03/30 23:26:03 mhayduk
205 * Release 0.03.
206 *
207 * Revision 1.1 1997/11/06 17:49:24 mhayduk
208 * Initial revision
209 *
210 *
211 ****************************************************************************
212 ****************************************************************************/
213
214
215#ifndef _LAYER2_H_
216
217 #define _LAYER2_H_ 1
218
219#include "sysapi.h"
220#include "pswairmsg.h"
221/*****************************************************************************
222 * Function prototypes
223 ****************************************************************************/
224void l2SyncControl(kal_bool control);
225SyncChannelMessage* l2BuildSyncMessage(SyncFrame *frame);
226
227void l2PageControl(kal_bool control);
228FcschMessage* l2BuildPageMessage(PageFrame *frame);
229
230kal_bool l2OhdMessageDuplicate(FcschMessage *msg);
231kal_bool chechForOVHMsg(kal_uint8 msgType);
232
233kal_bool sduOffset(FcschMessage *fcschMsg, kal_uint16 *index);
234kal_bool sduLength(FcschMessage *fcschMsg, kal_uint16 *index);
235kal_bool getExtMsgLengthInd(kal_uint8 ChanType);
236
237
238void l2PageMonitorInit(void);
239
240/* Traffic Channel Interface */
241void l2FTCStart (void);
242void l2FTCStop (void);
243FTCMessage* l2FTCFrame(TCFrame* frame);
244void l2FTCHardHandoff (void);
245void l2FTCHardHandoffWReturnOnFailure(void);
246void l2FTCSupervision (kal_bool control);
247void l2FTCSupervisionFadeTimeout (void);
248void l2FTCPowerControlInit (void);
249void l2FTCPowerControlCounterReset (void);
250void l2FTCPowerControl (kal_bool control);
251void l2FTCPowerControlParm(kal_uint8 pwrRepThresh, kal_uint8 pwrRepFrames,
252 kal_bool pwrThreshEnable, kal_bool pwrPeriodEnable, kal_uint8 pwrRepDelay);
253PCNPMData* getL2FTCPowerControlParms(void);
254kal_bool* getPCNPMReceivedstatus(void);
255void l2FTCCandFreqSearchParm (kal_int8 sfRxPwrThresh, kal_int8 diffRxPwrThresh);
256kal_int8 l2FTCGetAvgSFRxPwr (void);
257void l2FTCGetTotalPwr(kal_uint8* sfTotalRxPwr/*, kal_uint8* cfTotalRxPwr*/);
258
259void l2RxAcknowledgementProceduresReset (void);
260void l2TCTransmitterControl(TXControl txControl);
261
262void l2GetSyncPageCounts(kal_uint8 *GoodMsgCount, kal_uint8 *BadMsgCount);
263
264kal_uint8 l2totalRxPower (kal_int16 actualRxPwr);
265void l2CpcchPingBs( void );
266void l2FTCHardHandoffTimerExpired (void);
267L2_STATE l2GetPageState (void);
268kal_uint8 l2GetPageMessageLength (void);
269kal_uint8 l2GetPageMessageType (void);
270kal_uint32 calcSumOfEcIoActivePilots(void);
271/* Misc */
272extern kal_uint16 cpCommonFieldWidth(void);
273void l2ResetGoodPageMessageRcvd(void);
274kal_bool l2GoodPageMessageReceived(void);
275void l2Set1xAdvForFchBlankingParms(kal_uint8 rcpmN2mInd, kal_uint8 rpcmDutyCycleIdx, SysActionTimeT actionTime);
276kal_bool l2ExtractRecordsAndMsgTypeFromGEM (kal_uint8* buf, kal_uint16 *index, kal_uint8 *msgType);
277#ifdef MTK_CBP
278kal_bool l2PchChanIsGood(void);
279void l2ResetPchHalfFrames(void);
280#endif
281void 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);
282
283void resetCrcErrAndMidSciNumInProbes(void);
284void IncCrcErrAndMidSciNumInProbes(void);
285kal_uint32 GetCrcErrAndMidSciNumInProbes(void);
286
287#endif /* _LAYER2_H_ */
288