blob: 57620eee6a3f1072c3df7708f26556b1c1d57c46 [file] [log] [blame]
yu.dongc33b3072024-08-21 23:14:49 -07001/*****************************************************************************
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) 2005
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 *
38 * Filename:
39 * ---------
40 * as_common.h
41 *
42 * Project:
43 * --------
44 * Maui
45 *
46 * Description:
47 * ------------
48 * Common header file for access stratum
49 *
50 * Author:
51 * -------
52 * -------
53 *
54 *============================================================================
55 * HISTORY
56 * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
57 *------------------------------------------------------------------------------
58 * removed!
59 * removed!
60 * removed!
61 *
62 * removed!
63 * removed!
64 *
65 * removed!
66 * removed!
67 *
68 * removed!
69 * removed!
70 *
71 * removed!
72 * removed!
73 * removed!
74 * removed!
75 *
76 * removed!
77 * removed!
78 * removed!
79 *
80 * removed!
81 * removed!
82 * removed!
83 *
84 * removed!
85 * removed!
86 * removed!
87 *
88 * removed!
89 * removed!
90 * removed!
91 *
92 * removed!
93 * removed!
94 * removed!
95 * removed!
96 * removed!
97 * removed!
98 * removed!
99 * removed!
100 * removed!
101 * removed!
102 *
103 * removed!
104 * removed!
105 * removed!
106 *
107 * removed!
108 * removed!
109 * removed!
110 *
111 * removed!
112 * removed!
113 * removed!
114 *
115 * removed!
116 * removed!
117 * removed!
118 *
119 * removed!
120 * removed!
121 * removed!
122 *
123 * removed!
124 * removed!
125 * removed!
126 *
127 * removed!
128 * removed!
129 * removed!
130 *
131 * removed!
132 * removed!
133 * removed!
134 *
135 * removed!
136 * removed!
137 * removed!
138 *
139 * removed!
140 * removed!
141 * removed!
142 *
143 * removed!
144 * removed!
145 * removed!
146 *
147 * removed!
148 * removed!
149 * removed!
150 *
151 * removed!
152 * removed!
153 * removed!
154 *
155 * removed!
156 * removed!
157 * removed!
158 *
159 * removed!
160 * removed!
161 * removed!
162 *
163 * removed!
164 * removed!
165 * removed!
166 *------------------------------------------------------------------------------
167 * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
168 *============================================================================
169 ****************************************************************************/
170
171#ifndef __AS_COMMON_H__
172#define __AS_COMMON_H__
173
174/* INCLUDES ****************************************************************************/
175
176#include "task_config.h" //Alfie: added when porting with Karen's ask.
177#include "kal_public_api.h"
178/* TYPE DEFINITIONS ***************************************************************/
179
180#define U8 kal_uint8
181#define S8 kal_int8
182#define U16 kal_uint16
183#define S16 kal_int16
184#define U32 kal_uint32
185#define S32 kal_int32
186#define tBOOL kal_bool
187#define Bool kal_bool
188#define TIME_OF_DAY double
189
190#ifndef FALSE_E
191#define FALSE_E KAL_FALSE
192#endif
193
194#ifndef TRUE_E
195#define TRUE_E KAL_TRUE
196#endif
197
198#ifndef tMsg
199#define tMsg ilm_struct*
200#endif
201
202
203/* Vincent 051230: keep and reorder the enum value SUCCESS_E and FAILURE_E in avoid
204 * to confuse with the usage of kal_bool */
205#if 0
206/* under construction !*/
207/* under construction !*/
208/* under construction !*/
209/* under construction !*/
210/* under construction !*/
211/* under construction !*/
212/* under construction !*/
213/* under construction !*/
214/* under construction !*/
215/* under construction !*/
216/* under construction !*/
217/* under construction !*/
218/* under construction !*/
219/* under construction !*/
220/* under construction !*/
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#endif
241
242typedef enum
243{
244 FAILURE_E, /* generic failure */
245 SUCCESS_E /* Command completed without errors */
246} tReturnCode;
247
248/*****************************************************************************
249 Below enum is used for ELT tool to recognize MCDDLL supported version.
250 and ELT may use different in-tool decoder file
251 Only MCDDLL contact window and tool team can modify this enum
252******************************************************************************/
253
254typedef enum
255{
256 mcddll_f40 /* support ASN to 38.331 f40 version */
257} MCDDLL_File_Info;
258
259/* MACROS ******************************************************************************/
260
261#define BITS_PER_BYTE 8
262
263#ifdef MIN
264#undef MIN
265#endif
266#define MIN(A,B) (((A)<(B))?(A):(B))
267
268#ifdef MAX
269#undef MAX
270#endif
271#define MAX(A,B) (((A)>(B))?(A):(B))
272
273#define PUBLIC
274#define PRIVATE static
275
276#define NOT_USED(x) (void)(x)
277
278#define NOT_USED_FSM_PARAMETERS() \
279 (void)(tReceivedMsg); \
280 (void)(U32InterpretedEvent); \
281 (void)(pU32State); \
282 (void)(ptContext); \
283 (void)(pSaved); \
284 (void)(pReleaseMsg); \
285 (void)(isSavedEvent);
286
287#define SM_POPULATE_STATED_PROCESS(sm, offset, type) \
288 eSM_PopulateProcessServiceSM(&(sm), \
289 offset, \
290 NUM_STATES_ ## type, \
291 NUM_EVENTS_ ## type, \
292 a ## type ## _StateTable, \
293 (kal_int8*)""#type"")
294
295#define IS_VALID_ENTRY(checkParamPtr) \
296 (pContext != NULL) && (pState != NULL) && \
297 ((checkParamPtr) == KAL_TRUE ? (pContext->pvParams != NULL) : KAL_TRUE)
298
299
300/* Description: range checking macro. Test if v is between min and
301 max. Use this macro with contiguous enumerated types (see
302 IS_WEEKEND macro example in contract_programming.h). */
303/* Note: to avoid the following warning: comparison is always 1 due to limited
304 * range of data type. Don't use this IS_INRANGE just use (v <= max). */
305#define IS_INRANGE(v, min, max) ((min) <= (v) && (v) <= (max))
306
307/* Description: valid pointer type checking macro. Test if p is non
308 null pointer. Note: a valid pointer always points on allocated
309 memory. This is similar to the concept of references in C++. */
310#define IS_VALID_PTR(p) ((p) != NULL)
311
312#define IS_TBOOL(flag) ((flag == TRUE) || (flag == FALSE))
313
314#define TT_ENTRY_SIZE sizeof(tTranslateTableEntry)
315
316#define mSM_ENTRY_FN(x) kal_bool x(struct tContext* pContext, kal_uint32* pState)
317
318#define SM_PARAM(contextPtr, paramID) (contextPtr)->ptCC->aSCIParams[(paramID)].U32ParamValue
319
320//macro to initialise max process instance array
321#define INIT_MAX_INSTANCES(component, array, processCount) \
322 {int i; for(i = 0; i < (processCount); i++){(component)->aMaxInstanceArray[i]=((array)[i]);}(component)->aMaxInstanceArray[i] = (array)[i];}
323
324#define ALLOC_SEND_ILM(macro_src_mod, macro_dest_mod, macro_sap_id, macro_msg_id, macro_local_para_ptr, macro_peer_buff_ptr) \
325 msg_send6((macro_src_mod), (macro_dest_mod), (macro_sap_id), (macro_msg_id), (local_para_struct *)(macro_local_para_ptr), (peer_buff_struct *)(macro_peer_buff_ptr))
326
327#ifdef __MTK_TARGET__ //only target
328#define ALLOC_SEND_ILM_CC(macro_src_mod, macro_dest_mod, macro_sap_id, macro_msg_id, macro_local_para_ptr, macro_peer_buff_ptr) \
329 msg_send6_cc((macro_src_mod), (macro_dest_mod), (macro_sap_id), (macro_msg_id), (local_para_struct *)(macro_local_para_ptr), (peer_buff_struct *)(macro_peer_buff_ptr))
330#else //UT(including MoDIS IT) or NWSIM
331#define ALLOC_SEND_ILM_CC(macro_src_mod, macro_dest_mod, macro_sap_id, macro_msg_id, macro_local_para_ptr, macro_peer_buff_ptr) \
332 msg_send6((macro_src_mod), (macro_dest_mod), (macro_sap_id), (macro_msg_id), (local_para_struct *)(macro_local_para_ptr), (peer_buff_struct *)(macro_peer_buff_ptr))
333#endif /* __MTK_TARGET__ */
334
335/* Please notice that dhl_log_primitive6() will not free the local parameter and peer buffer, users should tack care about it by themself. */
336#define ALLOC_LOG_ILM(macro_src_mod, macro_sap_id, macro_msg_id, macro_local_para_ptr) \
337 dhl_log_primitive6((macro_src_mod), (MOD_DHL), (macro_sap_id), (macro_msg_id), (local_para_struct *)(macro_local_para_ptr), NULL)
338
339#define MSG_CAST(ptr, msg, cast); \
340 { \
341 ASSERT(msg->local_para_ptr != NULL); \
342 ptr = ( cast *)msg->local_para_ptr; \
343 }
344
345#define UPLANE_TSTAMP(x) //temporarily
346
347#define UPLANE_BENCHMARK_TSTAMP(x) //temporarily
348
349#define CONFORMANCE_TSTAMP(x) //temporarily
350
351#define tReturn(x); {if (x == SUCCESS_E) return KAL_TRUE; else return KAL_FALSE;}
352
353#define as_free_local_para_set_null(local_para) \
354do { free_local_para((local_para_struct *)(local_para)); (local_para)=NULL; } while(0)
355
356#define as_free_local_para_r_set_null(local_para) \
357do { free_local_para_r((local_para_struct *)(local_para)); (local_para)=NULL; } while(0)
358
359#define as_free_peer_buff_set_null(peer_buff) \
360do { free_peer_buff((peer_buff_struct *)(peer_buff)); (peer_buff)=NULL; } while(0)
361
362#define as_free_peer_buff_r_set_null(peer_buff) \
363do { free_peer_buff_r((peer_buff_struct *)(peer_buff)); (peer_buff)=NULL; } while(0)
364
365#define as_free_ctrl_buffer_set_null(ptr) \
366do { free_ctrl_buffer(ptr); (ptr)=NULL; } while(0)
367
368/* DHL api(dhl_internal_trace) parameter #2 is reserved, parameter #3 use MTK internal.
369 * Redefine for coding convenience.
370 */
371/*#define uas_internal_trace(trc_class, msg_index, ...) \
372dhl_internal_trace(trc_class, DHL_USER_FLAG_NONE, DHL_ACCESS_LEVEL_4_MTK_INTERNAL, \
373 msg_index, ##__VA_ARGS__)
374*/
375
376// modify for T+W Gemini
377typedef enum
378{
379 FDD_L3_SEQ_SELECTOR_INVALID = 0,
380 TDD_L3_SEQ_SELECTOR_INVALID = FDD_L3_SEQ_SELECTOR_INVALID,
381 FDD_L3_SEQ_SELECTOR_PRACHINFOLIST,
382 TDD_L3_SEQ_SELECTOR_PRACHINFOLIST = FDD_L3_SEQ_SELECTOR_PRACHINFOLIST,
383 FDD_L3_SEQ_SELECTOR_SCCPCHINFOLIST,
384 TDD_L3_SEQ_SELECTOR_SCCPCHINFOLIST = FDD_L3_SEQ_SELECTOR_SCCPCHINFOLIST
385
386#ifdef __UMTS_TDD128_MODE__
387 ,TDD_L3_SEQ_SELECTOR_PRACHINFOLCRLIST_R4
388 ,TDD_L3_SEQ_SELECTOR_SCCPCHINFOLCRLIST_R4_EXT
389#endif
390#ifdef __UMTS_R7__
391 , FDD_L3_SEQ_SELECTOR_SCCPCH_SystemInformation_MBMS_r7
392#endif
393}FDD_L3Decode_sequence_selector, TDD_L3Decode_sequence_selector;
394
395typedef struct
396{
397 FDD_L3Decode_sequence_selector decode_selector;
398 kal_int32 sequence_counter;
399 S16 cell_index; // shall be the same type as FDD_DBIdx & TDD_DBIdx
400 U8 sib_index; // shall be the same type as RRC_FDD_DB_SIB_Index & RRC_TDD_DB_SIB_Index
401 kal_bool is_uas_tdd128; // KAL_TRUE means used by TDD, KAL_FALSE means used by FDD
402}FDD_L3DecodeContext, FDD_L3EncodeContext, TDD_L3DecodeContext, TDD_L3EncodeContext;
403
404
405#endif //__AS_COMMON_H__