comparison gsm-fw/g23m-gsm/alr/alr.h @ 673:2f7df7a314f8

gsm-fw/g23m-gsm subtree: initial import from LoCosto source
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Sun, 28 Sep 2014 23:20:04 +0000
parents
children
comparison
equal deleted inserted replaced
672:0dc6f9e8e980 673:2f7df7a314f8
1 /*
2 +-----------------------------------------------------------------------------
3 | Project : GSM-PS
4 | Modul : ALR
5 +-----------------------------------------------------------------------------
6 | Copyright 2002 Texas Instruments Berlin, AG
7 | All rights reserved.
8 |
9 | This file is confidential and a trade secret of Texas
10 | Instruments Berlin, AG
11 | The receipt of or possession of this file does not convey
12 | any rights to reproduce or disclose its contents or to
13 | manufacture, use, or sell anything it may describe, in
14 | whole, or in part, without the specific written consent of
15 | Texas Instruments Berlin, AG.
16 +-----------------------------------------------------------------------------
17 | Purpose : Definitions for the Protocol Stack Entity ALR
18 +-----------------------------------------------------------------------------
19 */
20
21 #ifndef ALR_H
22 #define ALR_H
23
24 #ifdef TI_PS_HCOMM_CHANGE
25 #include "cl_hComm_handle.h"
26 #endif
27
28 #ifdef TI_GSP_STR2IND_S2I_STRING
29 typedef unsigned int T_S2I_STRING;
30 #else
31 typedef char * T_S2I_STRING;
32 #define S2I_STRING(x) (x)
33 #endif
34
35 #ifdef TI_PS_OP_VSI_NO_CALL_ID
36 #define TIMER_START(C,I,T) vsi_t_start_nc(I,T)
37 #define TIMER_PSTART(C,I,T,R) vsi_t_pstart_nc(I,T,R)
38 #define TIMER_STOP(C,I) vsi_t_stop_nc(I)
39 #define TIMER_STATUS(C,I,T) vsi_t_status_nc(I,T)
40 #define SUSPEND_SELF(C,T) vsi_t_sleep_nc(T)
41 #define SYSTEM_TIME(C,T) vsi_t_time_nc(T)
42 #else /* TI_PS_OP_VSI_NO_CALL_ID */
43 #define TIMER_START(C,I,T) vsi_t_start(C,I,T)
44 #define TIMER_PSTART(C,I,T,R) vsi_t_pstart(C,I,T,R)
45 #define TIMER_STOP(C,I) vsi_t_stop(C,I)
46 #define TIMER_STATUS(C,I,T) vsi_t_status(C,I,T)
47 #define SUSPEND_SELF(C,T) vsi_t_sleep(C,T)
48 #define SYSTEM_TIME(C,T) vsi_t_time(C,T)
49 #endif /* TI_PS_OP_VSI_NO_CALL_ID */
50
51
52 #define STOP_SYNC_TASK /* stop always any sync tasks before start a new one */
53 #if 0
54 #define DL_TRACE_ENABLED /* use DL offline trace */
55 #define TRACE_STATE_TRANSITION /* trace some state transitions */
56 #endif /* 0 */
57
58 #if !defined(_SIMULATION_) && defined(WIN32)
59 #define _SIMULATION_
60 #endif /* !_SIMULATION_ && WIN32 */
61
62 #if defined(_SIMULATION_)
63 #undef DL_TRACE_ENABLED /* no _SYST trace during simulation */
64 #endif /* WIN32 */
65
66 #define SYST_TRACE(a) vsi_o_ttrace(0, 0xFFFF,a)
67 #define SYST 0, 0xffff
68 #define SYST_TRACE_P(a) vsi_o_ttrace a
69 /*
70 * use it as showed next line...
71 * SYST_TRACE_P((SYST, "e.g. two parameter: %d %d", p1, p2));
72 */
73
74
75 #if !defined(ELEMENTS)
76 #define ELEMENTS(array) (sizeof(array)/sizeof(array[0]))
77 #endif /* !ELEMENTS */
78
79
80 /* Bitoffset for Message Buffer allocation */
81 #define ENCODE_OFFSET 24
82
83 /*
84 * Bitmasks
85 */
86 #define BIT_0 0x01
87 #define BIT_1 0x02
88 #define BIT_2 0x04
89 #define BIT_3 0x08
90 #define BIT_4 0x10
91 #define BIT_5 0x20
92 #define BIT_6 0x40
93 #define BIT_7 0x80
94 #define BIT_012 0x07
95
96 #include "p_ph.h"
97 #include "p_mph.h"
98
99 /* First 40 carriers per band will be added at top of the MPH_POWER_CNF
100 * and the next 20 Carriers (40 to 60) will be added at the bottom.
101 * Remaining carriers needs to be ignored.
102 */
103
104 #define ADD_AT_THE_TOP 0x01 /* first 40 carrier */
105 #define ADD_AT_THE_BOTTOM 0x02 /* already 40 carriers were added */
106 #define REACHED_THE_MAXIMUM 0x04 /* already 60 carriers were added */
107 #define DO_NOT_ADD 0x08 /* wrong carrier */
108
109
110 /* Private modes */
111 #define MODE_CHAN_ASS_FAIL 16
112 #define MODE_HANDOVER_FAIL 17
113
114 /* Results of configuration dedicated mode */
115 #define DEDICATED_SUCCESS 0
116
117 #define ALR_ALLOCATE_NEW_BA(v) ((((v)+1) % (ALR_BA_HIGH-ALR_BA_LOW+1)) + ALR_BA_LOW)
118 #define IS_EXT_MEAS_RUNNING (alr_data->cs_data.mph_ext_meas_req NEQ NULL)
119
120 /*
121 * Dynamic Configurations
122 */
123 #define ID_STD 1
124 #define ID_CONFIG 2
125 #define ID_MON_COUNTER_IDLE 3
126 #define ID_MON_COUNTER_DEDI 4
127 #define ID_TRC_DATA_IND 5
128 #define ID_RACH_FAILURE 6
129 #define ID_EOTD 7
130 #ifdef TI_PS_FF_QUAD_BAND_SUPPORT
131 #define ID_MB_TESTING 8
132 #endif
133
134 #define ID_TRC_DATA_IND_ALL 0xff
135 #define ID_TRC_DATA_IND_VALID 0x7f
136 #define ID_TRC_DATA_IND_INVALID 0x80
137 #define ID_TRC_DATA_IND_BCCH 0x01 /* normal and extended BCCH */
138 #define ID_TRC_DATA_IND_PCH 0x02 /* normal and extended PCH */
139 #define ID_TRC_DATA_IND_CCCH 0x04
140 #define ID_TRC_DATA_IND_CBCH 0x08
141 #define ID_TRC_DATA_IND_SCCH 0x10 /* SACCH and SDCCH */
142 #define ID_TRC_DATA_IND_FCCH 0x20 /* full and half rate FACCH */
143 #define ID_TRC_DATA_IND_STATE 0x40 /* MA status */
144 #define ID_TRC_DATA_IND_INIT 0x3f /* all valid frames without stati */
145 #define ID_TRC_DATA_IND_INIT2 0x1f /* ... without FACCH */
146
147 EXTERN UBYTE v_mon_trc_data_ind;
148 EXTERN UBYTE v_cfg_rach_failure;
149
150 /* In addition to normal page modes defined in SAP */
151 #define PGM_REORG_CS 3
152 #define NO_PGM_CHANGE 4
153 #define SAVED_PGM 0xff
154
155 /*If page mode is set to REORG and a HPLMN search is performed, L1 cannot
156 synchronize to NC's. Therefore NORMAL page mode is started. This state
157 defines that the mobile should be in REORG, but actual is in NORMAL.*/
158 #define PGM_REORG_NC_SYNC 5
159 EXTERN UBYTE page_mode_before_hplmn_search;/*to distinguish PGM_REORG and PGM_REORG_CS */
160
161 #ifdef TI_PS_FF_QUAD_BAND_SUPPORT
162 EXTERN UBYTE alr_multiband_std;
163 #endif
164
165 /* Page Mode Changes */
166 #define NONE 0
167 #define SWAP_TO_EXTEND 1
168 #define SWAP_TO_REORG 2
169 #define SWAP_TO_NORMAL 3
170
171 #define MAX_GSM_CHANNEL_ATTEMPTS 40 /* GSM says 30, but this is done in the field */
172 #define MAX_DPCS_CHANNEL_ATTEMPTS 40
173
174 /* Band Limitations for multiband reporting */
175 #define NO_BAND_LIMITATION 0
176 #define EXCLUDE_SC_BAND 1
177 #define ONLY_SC_BAND 2
178
179 #define IMSI_LEN 9
180 #define SI_CONTENTS_MSG_T 2
181 #define SI_CONTENTS_CS2 9
182 #define ONLY_ACS 0x80
183 #define STOP_PCH_READING 1
184 #define DONT_STOP_PCH_READING 0
185 #define STOP_MEASUREMENTS 2
186
187 /*
188 * Neighbour cell status
189 */
190 /* #define DEFINE_OLD_NC_STATUS */
191 #if !defined(DEFINE_OLD_NC_STATUS)
192 /* neighbour cell base stati */
193 #define NCS_INACTIVE 0x00
194 #define NCS_IDLE 0x01
195 #define NCS_FB_SB 0x02
196 #define NCS_SB 0x03
197 /* neighbour cell bit masks */
198 #define NCB_BCCH 0x04
199 #define NCB_READ 0x08
200 #define NCB_PENDING 0x10
201 #define NCB_SYNC 0x20
202 #define NCB_RR_NOT_INFORMED 0x40
203 #define NCB_FAILED 0x80
204
205 #if defined (TI_PS_FF_RTD) AND defined (REL99)
206 #define NUM_OF_TDMA_FRAMES 0x40
207 #define RTD_12BIT_EXTRACT 0x0FFF
208 #define MAX_NUM_OF_QBITS 0x1388
209 #endif /* #if defined (TI_PS_FF_RTD) AND defined (REL99) */
210
211
212 /* neighbour cell stati */
213 /* 1of<n> n = 6,12 means that the cell belongs to the n strongest */
214 /* RLA_C means Received Level Averages according GSM 05.08 seciton 6.1 */
215
216 /* (1) no PERIODIC measurement received; cell is excluded from all activities except rxlev measurement */
217 #define INACTIVE (NCS_INACTIVE)
218
219 /* (2) PERIODIC measurement received; not synchronized; BCCH data unknown */
220 #define IDLE (NCS_IDLE)
221
222 /* (11a) not a 1of12 cell any more; synchronized */
223 #define IDLE_SYNC (NCS_IDLE|NCB_SYNC)
224
225 /* (3) strong cell(1of12); not synchronized yet; need first FB and SB synchronization */
226 #define READ_FB_SB (NCS_FB_SB|NCB_READ)
227
228 /* (4) first FB and SB synchronization ongoing */
229 #define READ_FB_SB_PENDING (NCS_FB_SB|NCB_READ|NCB_PENDING)
230
231 /* (9) synchronized; need re-synchronization of SB (10/30 sec); no need to read BCCH */
232 #define READ_SB (NCS_SB|NCB_READ)
233
234 /* (10) re-synchronization of SB ongoing (10/30 sec); no reading of BCCH */
235 #define READ_SB_PENDING (NCS_SB|NCB_READ|NCB_PENDING)
236
237 /* (9a) synchronized; need re-synchronization of SB and re-reading of BCCH (5 min) */
238 #define READ_SB_BCCH (NCS_SB|NCB_READ|NCB_BCCH)
239
240 /* (10a) re-synchronization of SB ongoing (5 min) */
241 #define READ_SB_BCCH_PENDING (NCS_SB|NCB_READ|NCB_BCCH|NCB_PENDING)
242
243 /* (11a) re-synchronization of SB finished; need re-reading of BCCH (5 min) */
244 #define READ_BCCH (NCS_SB|NCB_READ|NCB_BCCH|NCB_SYNC)
245
246 /* (12a) re-reading of BCCH ongoing (5 min) */
247 #define READ_BCCH_PENDING (NCS_SB|NCB_READ|NCB_BCCH|NCB_SYNC|NCB_PENDING)
248
249 /* (5) 1of6 cell; synchronized; BCCH data unknown; need to read BCCH, but to notify RR after a measurement ind only */
250 #define READ_BCCH_RR_NOT_INFORMED (NCS_SB|NCB_READ|NCB_BCCH|NCB_SYNC|NCB_RR_NOT_INFORMED)
251
252 /* (6) 1of6 cell; reading of BCCH ongoing */
253 #define READ_BCCH_PENDING_RR_NOT_INFORMED (NCS_SB|NCB_READ|NCB_BCCH|NCB_SYNC|NCB_RR_NOT_INFORMED|NCB_PENDING)
254
255 /* (8) 1of12 cell; synchronized; in case 1of6: BCCH data known; RR is notified; subsequent RLA_Cs being computed */
256 #define FB_SB_SYNC (NCS_FB_SB|NCB_SYNC)
257
258 /* (7) 1of6 cell; synchronized; BCCH data known; RR not yet notified; first RLA_C being computed */
259 #define FB_SB_SYNC_RR_NOT_INFORMED (NCS_FB_SB|NCB_SYNC|NCB_RR_NOT_INFORMED)
260
261 /* (13) 1of<n> cell state questionable; FB/SB sync or BCCH reading failed 1 thru 8 times */
262 #define FB_SB_FAILED (NCS_FB_SB|NCB_FAILED)
263
264 /* (14) 1of<n> cell; synchronization of FB/SB or reading of BCCH failed > 8 times; NCC check failed; */
265 #define EXCLUDED (NCB_FAILED)
266
267 #else /* !DEFINE_OLD_NC_STATUS */
268 #define INACTIVE 0
269 #define IDLE 1
270 #define READ_BCCH 2
271 #define FB_SB_SYNC 3
272 #define FB_SB_FAILED 4
273 #define READ_FB_SB 5
274 #define READ_SB 6
275 #define IDLE_SYNC 7
276 #define EXCLUDED 8
277 #define FB_SB_SYNC_RR_NOT_INFORMED 9
278 #define READ_SB_BCCH 10
279 #define READ_BCCH_PENDING 11
280 #define READ_FB_SB_PENDING 12
281 #define READ_SB_PENDING 13
282 #define READ_SB_BCCH_PENDING 14
283 #define READ_BCCH_RR_NOT_INFORMED 15
284 #define READ_BCCH_PENDING_RR_NOT_INFORMED 16
285 #endif /* !DEFINE_OLD_NC_STATUS */
286
287 /*
288 * states of a neighbour cell with respect to the BA list
289 * in the last MPH_NEIGHBOURCELL_REQ.
290 */
291 #define IN_BA 0 /* NCell was in last MPH_NEIGHBOURCELL_REQ */
292 #define NOT_IN_BA_SHORT 1 /* NCell wasn't in last MPH_NEIGHBOURCELL_REQ but at last confirmation it had state IN_BA (not in BA for a short time) */
293 #define NOT_IN_BA_LONG 2 /* NCell wasn't in last MPH_NEIGHBOURCELL_REQ and at last confirmation it hadn't state IN_BA (not in BA for a long time) */
294 /*
295 * Definitions for AMR
296 */
297 #define CM_AMR 0x41
298
299 /*
300 * The times are given in number of multiframes. Each multiframe is
301 * equal to circa 217 milliseconds.
302 */
303 #define THIRTY_SECONDS_SCELL_BCCH 128
304
305 /*
306 * States Main Control
307 */
308 #define MA_NULL 0
309 #define MA_CELL_SELECTION 1
310 #define MA_IDLE 2
311 #define MA_CON_EST 3
312 #define MA_DEDICATED 4
313 #define MA_CELL_RESELECTION 5
314
315 #ifdef GPRS
316 #define MA_PTM 6
317 #endif
318
319 /* N950 Memory Optimization - Implements Measure #39*/
320 EXTERN T_S2I_STRING const
321 STATE_MA_NAME[];
322 #ifndef GPRS
323 /* N950 Memory Optimization - Implements Measure #39*/
324 #else /* !GPRS */
325 /* N950 Memory Optimization - Implements Measure #39*/
326 #endif /* !GPRS */
327 /*
328 * States Idle Neighbour Cell
329 */
330 #define NC_NULL 0
331 #define NC_IDLE 1
332 #define NC_DEDICATED 2
333 #define NC_CON_EST 3
334
335 #ifdef GPRS
336 #define NC_PIM_PBCCH 4
337 #define NC_PTM_PBCCH 5
338
339 /* N950 Memory Optimization - Implements Measure #39*/
340 EXTERN T_S2I_STRING const
341 STATE_NC_NAME[];
342 #else
343 /* N950 Memory Optimization - Implements Measure #39*/
344 EXTERN T_S2I_STRING const
345 STATE_NC_NAME[];
346 #endif
347
348 /*
349 * States Dedicated Control
350 */
351 #define DEDI_INACTIVE 0
352 #define DEDI_IMM_ASS 1
353 #define DEDI_IMM_ASS_RECONN 2
354 #define DEDI_ACTIVE 3
355
356 /* N950 Memory Optimization - Implements Measure #39*/
357 EXTERN T_S2I_STRING const
358 STATE_DEDI_NAME[];
359
360 typedef enum
361 {
362 HO_TYPE_ASYNC=1,
363 HO_TYPE_PRE_SYNC,
364 HO_TYPE_SYNC
365 }T_HO_TYPE;
366
367 /*
368 * States Cell Selection
369 */
370 #define CS_NULL 0
371 #define CS_INIT_L1 1 /* start with configuration of the radio band */
372 #define CS_INIT_ACTIVE 2 /* configuration of the radio band is active */
373 #define CS_INIT_DONE 3 /* configuration has done */
374 #define CS_START_MEASURE 4 /* start measurement with preceding configuration */
375 #define CS_ACTIVE_MEASURE 5 /* power measurement step is active */
376 #define CS_MEASURED 6 /* power measurement step has finished */
377 #define CS_INIT_SYNC 7 /* configuration of the radio band before SYNC */
378 #define CS_STOP_SYNC 8 /* stop any sync task */
379 #define CS_STOP_SYNC_DONE 9 /* no sync task active */
380 #define CS_ACTIVE_SYNC 10
381 #define CS_ACTIVE_BCCH 11
382 #define CS_NW_SYNC_TIMEOUT 12 /* ALR has timed out whilst attempting to sync to a nw */
383
384 /* N950 Memory Optimization - Implements Measure #39*/
385 EXTERN T_S2I_STRING const
386 STATE_CS_NAME[];
387 /*
388 * States PCH Control
389 */
390 #define PCH_NULL 0
391 #define PCH_ACTIVE 1
392
393 /* N950 Memory Optimization - Implements Measure #39*/
394 EXTERN T_S2I_STRING const
395 STATE_PCH_NAME[];
396 /*
397 * States RACH Control
398 */
399 #define RA_NULL 0
400 #define RA_ACTIVE 1
401 #define RA_LISTEN_TO_CCCH 2
402
403 /* N950 Memory Optimization - Implements Measure #39*/
404 EXTERN T_S2I_STRING const
405 STATE_RA_NAME[];
406 /*
407 * States CBCH Control
408 */
409 #define CBCH_NULL 0
410 #define CBCH_IDLE 1
411 #define CBCH_NO_DRX 2
412 #define CBCH_DRX 3
413
414 #define CBCH_HZ_OFF 0
415 #define CBCH_HZ_IDLE 5
416 #define CBCH_HZ_PENDING 6
417 #define CBCH_HZ_RECEIVED 7
418
419 /* N950 Memory Optimization - Implements Measure #39*/
420 EXTERN T_S2I_STRING const STATE_NORMAL_CBCH_NAME[];
421 EXTERN T_S2I_STRING const STATE_EXT_CBCH_NAME[];
422
423 /*
424 * States Idle Mode Serving Cell
425 */
426 #define SC_NULL 0
427 #define SC_IDLE_INITIAL 1
428 #define SC_IDLE 2
429
430 /* N950 Memory Optimization - Implements Measure #39*/
431 EXTERN T_S2I_STRING const
432 STATE_SC_NAME[];
433 /*
434 * States Idle Mode Serving Cell
435 */
436
437 typedef enum {
438 NC_ACQUIRE=0,
439 NC_CONFIRM
440 } T_NCELL_PROC;
441
442 /* N950 Memory Optimization - Implements Measure #39*/
443 EXTERN T_S2I_STRING const
444 STATE_NC_PROC_NAME[];
445
446 /*
447 * ALR manages 9 (MAX_STATE) states: CBCH,CS,MA,NC,PCH,RA,SC,DEDI,NC_PROC
448 */
449
450 #define STATE_CS 0
451 #define STATE_MA 1
452 #define STATE_NC 2
453 #define STATE_PCH 3
454 #define STATE_RA 4
455 #define STATE_SC 5
456 #define STATE_DEDI 6
457 #define STATE_NC_PROC 7
458 #define STATE_NORMAL_CBCH 8
459 #define STATE_EXT_CBCH 9
460 #define MAX_STATE 10
461
462 /*
463 * A definition is provided in ALR_PEI.C
464 */
465 #ifdef ALR_PEI_C
466 /* N950 Memory Optimization - Implements Measure #39*/
467 GLOBAL T_S2I_STRING const STATE_EXT_CBCH_NAME[] =
468 {
469 S2I_STRING("CBCH_NULL") ,
470 S2I_STRING("CBCH_IDLE") ,
471 S2I_STRING("CBCH_NO_DRX") ,
472 S2I_STRING("CBCH_DRX")
473 };
474
475 GLOBAL T_S2I_STRING const STATE_NORMAL_CBCH_NAME[] =
476 {
477 S2I_STRING("CBCH_NULL") ,
478 S2I_STRING("CBCH_IDLE") ,
479 S2I_STRING("CBCH_NO_DRX") ,
480 S2I_STRING("CBCH_DRX")
481 };
482
483 GLOBAL T_S2I_STRING const STATE_CS_NAME [] =
484 {
485 S2I_STRING("CS_NULL") ,
486 S2I_STRING("CS_INIT_L1") ,
487 S2I_STRING("CS_INIT_ACTIVE") ,
488 S2I_STRING("CS_INIT_DONE") ,
489 S2I_STRING("CS_START_MEASURE") ,
490 S2I_STRING("CS_ACTIVE_MEASURE") ,
491 S2I_STRING("CS_MEASURED") ,
492 S2I_STRING("CS_INIT_SYNC") ,
493 S2I_STRING("CS_STOP_SYNC") ,
494 S2I_STRING("CS_STOP_SYNC_DONE") ,
495 S2I_STRING("CS_ACTIVE_SYNC") ,
496 S2I_STRING("CS_ACTIVE_BCCH") ,
497 S2I_STRING("CS_NW_SYNC_TIMEOUT")
498 };
499
500 #ifdef GPRS
501 GLOBAL T_S2I_STRING const STATE_MA_NAME [] =
502 {
503 S2I_STRING("MA_NULL") ,
504 S2I_STRING("MA_CELL_SELECTION") ,
505 S2I_STRING("MA_IDLE") ,
506 S2I_STRING("MA_CON_EST") ,
507 S2I_STRING("MA_DEDICATED") ,
508 S2I_STRING("MA_CELL_RESELECTION"),
509 S2I_STRING("MA_PTM")
510 };
511 #else
512 GLOBAL T_S2I_STRING const STATE_MA_NAME [] =
513 {
514 S2I_STRING("MA_NULL") ,
515 S2I_STRING("MA_CELL_SELECTION") ,
516 S2I_STRING("MA_IDLE") ,
517 S2I_STRING("MA_CON_EST") ,
518 S2I_STRING("MA_DEDICATED") ,
519 S2I_STRING("MA_CELL_RESELECTION")
520 };
521 #endif
522 #ifdef GPRS
523 GLOBAL T_S2I_STRING const STATE_NC_NAME [] =
524 {
525 S2I_STRING("NC_NULL") ,
526 S2I_STRING("NC_IDLE") ,
527 S2I_STRING("NC_DEDICATED") ,
528 S2I_STRING("NC_CON_EST") ,
529 S2I_STRING("NC_PIM_PBCCH") ,
530 S2I_STRING("NC_PTM_PBCCH")
531 };
532 #else
533 GLOBAL T_S2I_STRING const STATE_NC_NAME [] =
534 {
535 S2I_STRING("NC_NULL") ,
536 S2I_STRING("NC_IDLE") ,
537 S2I_STRING("NC_DEDICATED") ,
538 S2I_STRING("NC_CON_EST")
539 };
540 #endif
541 GLOBAL T_S2I_STRING const STATE_PCH_NAME [] =
542 {
543 S2I_STRING("PCH_NULL") ,
544 S2I_STRING("PCH_ACTIVE")
545 };
546
547 GLOBAL T_S2I_STRING const STATE_RA_NAME [] =
548 {
549 S2I_STRING("RA_NULL") ,
550 S2I_STRING("RA_ACTIVE") ,
551 S2I_STRING("RA_LISTEN_TO_CCCH")
552 };
553
554 GLOBAL T_S2I_STRING const STATE_SC_NAME [] =
555 {
556 S2I_STRING("SC_NULL") ,
557 S2I_STRING("SC_IDLE_INITIAL") ,
558 S2I_STRING("SC_IDLE")
559 };
560
561 GLOBAL T_S2I_STRING const STATE_DEDI_NAME[] =
562 {
563 S2I_STRING("DEDI_INACTIVE") ,
564 S2I_STRING("DEDI_IMM_ASS") ,
565 S2I_STRING("DEDI_IMM_ASS_RECONN"),
566 S2I_STRING("DEDI_ACTIVE")
567 };
568
569 GLOBAL T_S2I_STRING const STATE_NC_PROC_NAME[]=
570 {
571 S2I_STRING("NC_ACQUIRE") ,
572 S2I_STRING("NC_CONFIRM")
573 };
574
575 #endif /* ALR_PIC_C */
576
577 /*==== MACROS =====================================================*/
578
579 /*
580
581 This macros convert channel numbers from and to the layer 1 specific
582 representation for the target version.
583
584 For the single bands GSM900, DCS1800 and PCS1900 the macro is removed
585 at compile time.
586
587 For dualband (STD==5,STD==6) a DCS1800 channel number is converted
588 using the convert function located at the end of alr_main.c
589
590 In the windows variant no change occurs.
591
592 */
593
594 EXTERN USHORT convert_arfcn_to_l1 (USHORT arfcn, UBYTE local_std);
595 EXTERN USHORT convert_arfcn_to_g23 (USHORT arfcn, UBYTE local_std);
596
597 /* range check with the fastest way for ARM */
598 /* corresponds with ((min <= x) AND (x <= max)) */
599 #define INRANGE(min, x, max) ((unsigned)(x-min) <= (max-min))
600
601 /*
602 * target version
603 */
604 #define ARFCN_TO_L1(a) convert_arfcn_to_l1((USHORT)(a),std)
605 #define ARFCN_TO_G23(a) convert_arfcn_to_g23((USHORT)(a),std)
606 #define ARFCN_STD_TO_L1(a,std) convert_arfcn_to_l1((USHORT)(a),std)
607 #define ARFCN_STD_TO_G23(a,std) convert_arfcn_to_g23((USHORT)(a),std)
608
609 /* add resp. get the std value to resp. from arfcn */
610 #define STD_ADD_TO_ARFCN(a,std) (((a)&~STD_BIT_MASK) | ((std)<<STD_BIT_SHIFT))
611 #define STD_GET_FROM_ARFCN(a) ((((a)&STD_BIT_MASK)>>STD_BIT_SHIFT))
612
613 /* find the frequency band index to which the given arfcn belongs. */
614 #define get_band_index_from_arfcn(arfcn, idx, std)\
615 {\
616 UBYTE local_std = STD_GET_FROM_ARFCN(arfcn);\
617 if( !local_std )\
618 local_std = std;\
619 idx = local_std;\
620 if( local_std == STD_DUAL ) {\
621 if (arfcn >= LOW_CHANNEL_1800)\
622 idx = STD_1800;\
623 else\
624 idx = STD_900;\
625 }\
626 else if ( local_std EQ STD_DUAL_EGSM ) {\
627 if (arfcn >= LOW_CHANNEL_EGSM)\
628 idx = STD_EGSM;\
629 else if (arfcn >= LOW_CHANNEL_1800)\
630 idx = STD_1800;\
631 else if (arfcn EQ CHANNEL_0)\
632 idx = STD_EGSM;\
633 else\
634 idx = STD_900;\
635 }\
636 else if( local_std EQ STD_DUAL_US ) {\
637 if (arfcn >= LOW_CHANNEL_1900)\
638 idx = STD_1900;\
639 else\
640 idx = STD_850;\
641 }\
642 (local_std<=STD_DUAL_US)?(idx=array_band_index[idx-1]):(idx=MAX_NUM_BANDS) ;\
643 }
644
645 /*==== TYPES ======================================================*/
646
647 EXTERN UBYTE std; /*lint -esym(526,std) : not defined | defined in other entity */
648 EXTERN UBYTE test_house; /*lint -esym(526,test_house) : not defined | defined in other entity */
649
650 typedef struct {
651 USHORT radio_freq;
652 SHORT accum_power_result;
653 } T_POWER_ARRAY;
654
655 typedef struct {
656 USHORT power_array_size;
657 T_POWER_ARRAY power_array[MAX_CARRIERS];
658 } T_POWER_MEAS;
659
660 typedef struct {
661 USHORT power_array_size;
662 T_POWER_ARRAY power_array[MAX_CARRIERS_DUAL_EGSM];
663 } T_POWER_MEAS1;
664
665 typedef struct {
666 USHORT power_array_size;
667 T_POWER_ARRAY power_array[MAX_CARRIERS_DUAL_US];
668 } T_POWER_MEAS2;
669
670 EXTERN T_POWER_MEAS1 alr_power_meas_result1;
671 EXTERN T_POWER_MEAS2 alr_power_meas_result2;
672
673 #define CS_SYNC_FAIL_COUNT_MAX 5
674 #define CS_BCCH_FAIL_COUNT_MAX 10
675
676 #define SI_1_READ 0x01
677 #define SI_2_READ 0x02
678 #define SI_3_READ 0x04
679 #define SI_4_READ 0x08
680 #define SI_2TER_READ 0x10
681 #define SI_2BIS_READ 0x20
682
683 typedef struct {
684 T_POWER_MEAS *p_results1;
685 T_POWER_MEAS *p_results2;
686 T_MPH_POWER_CNF *p_power_cnf;
687 T_MPH_POWER_REQ *p_power_req; /* CSI-LLD section: 4.1.3.1.2 */
688 T_MPH_EXT_MEAS_REQ *mph_ext_meas_req;
689 USHORT arfcn;
690 UBYTE ext_meas_state_pend; /* wait for pending MPHC_RXLEV_IND or MPHC_NCELL_SYNC_IND */
691 UBYTE sync_active;
692 UBYTE freq_bands;
693 UBYTE std;
694 UBYTE std12;
695 UBYTE freq_area;
696 UBYTE search_mode;
697 UBYTE sync_fail_count;
698 UBYTE bcch_fail_count;
699 UBYTE c_meas;
700 UBYTE c_max_meas;
701 UBYTE si_bitmap;
702 T_TIME c_tim_meas;
703 } T_CS_DATA;
704
705 #define MAX_OLD_CB 20
706 #define CBCH_BLOCK_SIZE 22
707 #define CBCH_BLOCKS 4
708 #define CBCH_MSG_SIZE (CBCH_BLOCKS*CBCH_BLOCK_SIZE)
709
710 /* no alignment or gaps between members ! */
711 typedef struct cbmsg_header_t
712 {
713 UBYTE serial_no1;
714 UBYTE serial_no2;
715 UBYTE msg_id3;
716 UBYTE msg_id4;
717 UBYTE dcs;
718 UBYTE page;
719 } T_CBMSG_HEADER;
720
721 typedef struct
722 {
723 UBYTE cnt;
724 T_CBMSG_HEADER header [MAX_OLD_CB];
725 } T_CB_MSG;
726
727 #define CBCH_CHANNELS 2
728 /*
729 * index defines are in alr_cbch.c :
730 * CBCH_NORM 0
731 * CBCH_EXT 1
732 */
733 typedef struct
734 {
735 /* message which currently read */
736 UBYTE msg_is_extended;
737 UBYTE msg [CBCH_MSG_SIZE];
738 USHORT msg_id_sat [MAX_IDENTS_SAT];
739 UBYTE msg_type;
740 UBYTE sat_enabled;
741 UBYTE expected_seq_number[CBCH_CHANNELS];
742 /* schedule support for normal and extended CBCH */
743 UBYTE begin_schedule[CBCH_CHANNELS];
744 UBYTE end_schedule[CBCH_CHANNELS];
745 UBYTE scheduled_sched_msg[CBCH_CHANNELS];
746 UBYTE schedule_length[CBCH_CHANNELS];
747 UBYTE last_slot_read[CBCH_CHANNELS];
748 ULONG schedule_map[CBCH_CHANNELS][2];
749 /* configured by MMI: specifies which messages are wanted */
750 UBYTE modus;
751 UBYTE old_cid_plmn_lac [7];
752 UBYTE dcs_id [MAX_IDENTS];
753 USHORT msg_id [MAX_IDENTS];
754 T_CB_MSG old_cbch_msg;
755 #if defined(FF_HOMEZONE)
756 /*
757 * special handling for homezone CBCH message after cell reselecting
758 */
759 UBYTE homezone;
760 USHORT msg_hz_id;
761 UBYTE dcs_hz_id;
762 USHORT hz_timeout;
763 #endif /* FF_HOMEZONE */
764 #if !defined (L1_STORES_CBCH_CONFIG)
765 T_MPHC_CONFIG_CBCH_REQ mphc_config_cbch;
766 #endif
767 } T_CBCH_DATA;
768
769 typedef struct
770 {
771 UBYTE sys_info_1[22];
772 UBYTE sys_info_2[22];
773 UBYTE sys_info_2bis[22];
774 UBYTE sys_info_2ter[22];
775 #if defined (REL99) && defined (TI_PS_FF_EMR)
776 UBYTE sys_info_2quater[22];// we are storing only one instance.
777 #endif
778 UBYTE sys_info_3[22];
779 UBYTE sys_info_4[22];
780 UBYTE sys_info_5[18];
781 UBYTE sys_info_5bis[18];
782 UBYTE sys_info_5ter[18];
783 UBYTE sys_info_6[18];
784 #ifdef GPRS
785 UBYTE sys_info_13[22];
786 #endif
787 } T_MA_DATA;
788
789 typedef struct
790 {
791 /* information for using the cell */
792 USHORT ba_arfcn;
793 UBYTE last_rxlev;
794 UBYTE tim_valid;
795 ULONG frame_offset;
796 ULONG time_align;
797 UBYTE bsic;
798 /* power measurements of the cell */
799 UBYTE rxlev[5];
800 UBYTE rxlev_average;
801 UBYTE c_rxlev;
802 /* state of the cell */
803 UBYTE one_of_six; /* this is a subset of one_of_twelve */
804 UBYTE rank_of_the_six; /*Nina add for calculate the rank of this cell*/
805 UBYTE syn_failure_times; /*Nina added to exclude the cells that failed to synch 6 times*/
806 UBYTE one_of_twelve;
807 UBYTE status;
808 UBYTE ba_status;
809 UBYTE new_strong_cell;
810 /* counters for status handling */
811 UBYTE c_attempt;
812 UBYTE c_error;
813 UBYTE c_bcch;
814 UBYTE c_sync;
815 USHORT blocks_required;
816
817 #if defined (TI_PS_FF_RTD) AND defined (REL99)
818 UBYTE c_sync_req;
819 #endif /* #if defined (TI_PS_FF_RTD) AND defined (REL99) */
820
821 /* Meas results for averaging when NC=1 or NC=2 */
822 #ifdef GPRS
823 USHORT nc_rxlev;
824 UBYTE c_nc_rxlev;
825 #endif
826 /* temporary BCCH storage */
827 T_MPH_UNITDATA_IND* mph_unitdata_ind;
828 T_MPH_UNITDATA_IND* mph_unitdata_ind78;
829
830 } T_NC;
831
832 /* values for component tim_state */
833 #define NC_TIM_STOPPED 0
834 #define NC_CONF_ENABLED 1
835 #define NC_CONF_DISABLED 2
836 #define NC_CONF_PENDING 3
837
838 #if defined (REL99) && defined (TI_PS_FF_EMR)
839 typedef struct
840 {
841 UBYTE num_valid;
842 UBYTE index[MAX_NEIGHBOURCELLS];
843 UBYTE nc_index[MAX_NEIGHBOURCELLS];
844 UBYTE priority[MAX_NEIGHBOURCELLS];
845 } T_enh_bin;
846 #endif
847
848 typedef struct
849 {
850 /* +1 because we use this for idle mode cell selection */
851 #define LAST_BSIC_REQ BA_LIST_SIZE
852 T_NC cell[BA_LIST_SIZE+1];
853 T_NC cr_cell; /* */
854 UBYTE c_ba_arfcn;
855 UBYTE ba_id;
856 USHORT channel;
857 USHORT rxlev_full;
858 USHORT rxlev_sub;
859 UBYTE rxqual_full;
860 UBYTE rxqual_sub;
861 USHORT tav;
862 UBYTE pwrc;
863 UBYTE dtx;
864 UBYTE act_dtx;
865 UBYTE update;
866 UBYTE sc_included;
867 UBYTE multiband;
868 UBYTE c_nc_timer;
869 /*
870 * Counter variable used to store 10sec timer interval
871 * in terms of the number of 51 frame control multi-frames.
872 * This counter is decremented for every measurement indication
873 * received from L1. This is initialized with TEN_SECONDS_ NCSYNC.
874 */
875 UBYTE c_ncsync_tim;
876 /*
877 *Variable to store the system time whenever
878 * the NCSYNC counter is re-assigned
879 */
880 T_TIME ncsync_start_tim;
881 /* for MPH_MEASUREMENT_IND */
882 USHORT fn_offset;
883 UBYTE max_reports;
884 UBYTE c_reports;
885
886 #if defined (TI_PS_FF_RTD) AND defined (REL99)
887 USHORT nxt_ind;
888 #endif /* #if defined (TI_PS_FF_RTD) AND defined (REL99) */
889
890
891 /*
892 * counters to keep track of the send NCELL_SYNC_REQ's
893 * and NCELL_BCCH_REQ's valid ranges are 0..12 and 0..6
894 */
895 UBYTE c_sync_req;
896 UBYTE c_bcch_req;
897 /* EOTD related */
898 UBYTE eotd_avail;
899 UBYTE tim_state;
900 UBYTE new_strong_cell_detect;
901 UBYTE c_sync_intrupted;
902 T_MPH_NCELL_POS_IND* ppos_ind;
903 T_MPH_NCELL_POS_REQ* ppos_req;
904 #if defined (REL99) && defined (TI_PS_FF_EMR)
905 /* EMR Related */
906 T_MPH_ENHPARA_UPDATE_REQ emr_data;
907 UBYTE rxlev_val;
908 UBYTE nbr_rcvd_blks;
909 UBYTE m_bep;
910 UBYTE cv_bep;
911 UBYTE si2_count; /*1 - SI2, 2 - SI-2/2bis, 3 - SI-2/2bis/2ter, 0 - none expected*/
912 UBYTE si2quater_status;
913 UBYTE si2quater_pos;
914 UBYTE si2q_per; /*counter for SI-2quater periodic configuration*/
915 ULONG rank_cell_bmp; /*The neighbor cell which has been ranked in sync req is marked in this bit map
916 at bit location corresponding to it's index in ALR's NC list*/
917 #endif
918 } T_NC_DATA;
919
920 #define SYSTEM_INFO_1_READ 0x01
921 #define SYSTEM_INFO_2_READ 0x02
922 #define SYSTEM_INFO_3_READ 0x04
923 #define SYSTEM_INFO_4_READ 0x08
924
925 #ifdef GPRS
926 #define SYSTEM_INFO_13_READ 0x10
927 #endif
928
929 #define ALL_SI_READ_EXCEPT_SI13 0x0F
930
931 typedef struct
932 {
933 T_MPHC_START_CCCH_REQ pl_idle, last_start_ccch_req;
934 SHORT imsi_mod_1000;
935 UBYTE dlt;
936 UBYTE act_dlt;
937 UBYTE si3_read;
938 UBYTE saved_page_mode;
939 UBYTE imsi [IMSI_LEN];
940 UBYTE v_tmsi;
941 ULONG tmsi;
942 BOOL reorg_bcch_reading;
943 UBYTE si_bitmap;
944 } T_PCH_DATA;
945
946 typedef struct
947 {
948 UBYTE ms_class;
949 UBYTE dcs_class;
950 UBYTE max_tx_pwr_ccch;
951 UBYTE delta [8];
952 UBYTE channel_request [8];
953 #ifdef GPRS
954 UBYTE t1 [8];
955 UBYTE t2 [8];
956 UBYTE t3 [8];
957 #endif
958 UBYTE max_bursts;
959 UBYTE c_burst;
960 } T_RACH_DATA;
961
962 typedef struct
963 {
964 UBYTE rlt;
965 UBYTE act_rlt;
966 USHORT act_bcch;
967 UBYTE act_mode;
968 /*
969 * Description of the actual used
970 * channel, confirmed by layer 1
971 */
972 T_channel_desc act_channel_desc;
973 T_frequency_list act_frequency_list;
974 T_starting_time act_starting_time;
975 T_frequency_list_bef_sti act_frequency_list_bef_sti;
976 T_channel_desc act_channel_desc_bef_sti;
977 UBYTE act_channel_mode;
978 BOOL act_pwrc;
979 UBYTE act_cipher_mode;
980 UBYTE act_a5_algorithm;
981 T_cipher_key act_cipher_key;
982 T_amr_configuration act_amr_configuration;
983 UBYTE act_power;
984 UBYTE act_dtx_allowed;
985 /*
986 * Description of the old used
987 * channel.
988 */
989 USHORT old_bcch;
990 UBYTE old_bsic;
991 UBYTE old_channel;
992 UBYTE old_channel_mode;
993 T_channel_desc old_channel_desc;
994 T_frequency_list old_frequency_list;
995 T_starting_time old_starting_time;
996 T_frequency_list_bef_sti old_frequency_list_bef_sti;
997 T_channel_desc old_channel_desc_bef_sti;
998 BOOL old_pwrc;
999 UBYTE old_cipher_mode;
1000 UBYTE old_a5_algorithm;
1001 T_cipher_key old_cipher_key;
1002 T_amr_configuration old_amr_configuration;
1003 UBYTE old_power;
1004 UBYTE old_dtx_allowed;
1005
1006 /*
1007 * Description of the new configured
1008 * channel, not yet confirmed by layer 1.
1009 */
1010 USHORT temp_bcch;
1011 UBYTE temp_bsic;
1012 UBYTE temp_channel;
1013 UBYTE temp_channel_mode;
1014 T_channel_desc temp_channel_desc;
1015 T_frequency_list temp_frequency_list;
1016 T_starting_time temp_starting_time;
1017 T_frequency_list_bef_sti temp_frequency_list_bef_sti;
1018 T_channel_desc temp_channel_desc_bef_sti;
1019 BOOL temp_pwrc;
1020 UBYTE temp_cipher_mode;
1021 UBYTE temp_a5_algorithm;
1022 T_cipher_key temp_cipher_key;
1023 T_amr_configuration temp_amr_configuration;
1024 UBYTE temp_power;
1025 UBYTE temp_dtx_allowed;
1026
1027 /*
1028 * Description of frequency redefinition
1029 * parameter.
1030 */
1031 T_channel_desc redef_channel_desc;
1032 T_frequency_list redef_frequency_list;
1033 T_starting_time redef_starting_time;
1034 /*
1035 * Extended Measurmeent Order parameter.
1036 */
1037 UBYTE emo_ba_id;
1038 #if defined (REL99) && defined (FF_BHO)
1039 UBYTE ho_type; /*To store Handover type during handover*/
1040 USHORT bho_cell_index; /*To store the index of the cell chosen for BHO,
1041 NOT_PRESENT_8BIT indicates that cell is not in BA list*/
1042 #endif
1043 } T_DEDI_DATA;
1044
1045 #define TIM_NCSYNC_VALUE 10000
1046 #define TIM_NW_SYNC_GUARD_VALUE 2500
1047
1048 /*
1049 * timer
1050 */
1051 #define TIMER_TRACE
1052
1053 #if defined (TIMER_TRACE)
1054 #define TIMERSTART(i,v) tim_start_timer (i, v)
1055 #define TIMERSTOP(i) tim_stop_timer (i)
1056 #define IS_TIMER_ACTIVE(i) tim_check_timer (i)
1057 #else
1058 #define TIMERSTART(i,v)
1059 #define TIMERSTOP(i)
1060 #define IS_TIMER_ACTIVE(i)
1061 #endif /* TIMER_TRACE */
1062
1063 enum tim_index_e
1064 {
1065 TIM_POWERMEAS,
1066 TIM_NW_SYNC_GUARD,
1067 #if defined(FF_HOMEZONE)
1068 TIM_HOMEZONE,
1069 #endif /* FF_HOMEZONE */
1070 NUM_OF_ALR_TIMERS
1071 };
1072
1073 typedef void (*T_TIMER_EXPIRY)(void);
1074
1075 typedef struct
1076 {
1077 UBYTE running[NUM_OF_ALR_TIMERS];
1078 T_TIMER_EXPIRY expire[NUM_OF_ALR_TIMERS];
1079 } T_TIM_DATA;
1080
1081 #ifdef OPTION_MULTITHREAD
1082 #define tim_init _ENTITY_PREFIXED(tim_init)
1083 #define tim_exec_timeout _ENTITY_PREFIXED(tim_exec_timeout)
1084 #define tim_stop_timer _ENTITY_PREFIXED(tim_stop_timer)
1085 #define tim_start_timer _ENTITY_PREFIXED(tim_start_timer)
1086 #define tim_check_timer _ENTITY_PREFIXED(tim_check_timer)
1087 #define trace_timer _ENTITY_PREFIXED(trace_timer)
1088 #endif
1089
1090 EXTERN void tim_init (void);
1091 EXTERN void tim_exec_timeout (USHORT index);
1092 EXTERN void tim_stop_timer (USHORT index);
1093 EXTERN void tim_start_timer (USHORT index, T_TIME value);
1094 EXTERN BOOL tim_check_timer(USHORT index);
1095
1096 /* all data is stored so, that it doesn't need
1097 to be converted if send to the upper layers.
1098 Exceptions are alr_data.cs_data.results,
1099 alr_data.pch_data.pl_idle
1100 alr_data.pch_data.imsi */
1101
1102 typedef struct
1103 {
1104 UBYTE state[MAX_STATE];
1105 /*
1106 * each of these elements is only
1107 * accessed by the appropiate
1108 * process
1109 */
1110 T_CBCH_DATA cbch_data;
1111 T_CS_DATA cs_data;
1112 T_MA_DATA ma_data;
1113 T_NC_DATA nc_data;
1114 T_PCH_DATA pch_data;
1115 T_RACH_DATA rach_data;
1116 T_DEDI_DATA dedi_data;
1117 #ifdef GPRS
1118 T_ALR_GPRS_DATA gprs_data;
1119 #endif /* GPRS */
1120 T_TIM_DATA tim_data;
1121
1122 UBYTE mmi; /* mmi variant */
1123 UBYTE keypad; /* keypad variant */
1124 UBYTE sc_band; /* frequency band of the serving cell */
1125 BOOL ext_display; /* ext display */
1126 EF_MSCAP mscap; /* MS capabilities (channel mode, data cap., features */
1127 /* is this component really needed ?? */
1128 /*
1129 * these parameters are used by more than one process
1130 * this is to avoid data inconsistencies between
1131 * the different processes
1132 */
1133 USHORT serving_cell;
1134 USHORT old_serving_cell;
1135 UBYTE bsic;
1136 UBYTE bs_pa_mfrms;
1137 UBYTE ncc_permitted;
1138 UBYTE plmn_search_running;
1139 #ifdef GPRS
1140 UBYTE nc_sync_with_grr;
1141 UBYTE nwctrl_meas_active; /* indicates whether averaging when NC=1,2 is active */
1142 #endif
1143 #ifdef _SIMULATION_
1144 UBYTE mb_testing; /* Dynamic configuration flag to indicate multiband testing */
1145 #endif
1146 } T_ALR_DATA;
1147
1148 /*==== EXPORT =====================================================*/
1149 /*
1150 * Main Control
1151 */
1152 EXTERN void ma_init (void);
1153 /*
1154 * Primitive processing functions for upper layer (RR)
1155 */
1156 EXTERN void ma_mph_idle_req (T_MPH_IDLE_REQ *mph_idle_req);
1157 EXTERN void ma_mph_neighbourcell_req (T_MPH_NEIGHBOURCELL_REQ *mph_neighbourcell_req);
1158 EXTERN void ma_mph_emo_req (T_MPH_EMO_REQ *mph_emo_req);
1159 EXTERN void ma_mph_dedicated_req (T_MPH_DEDICATED_REQ *mph_dedicated_req);
1160 EXTERN void ma_mph_dedicated_fail_req (T_MPH_DEDICATED_FAIL_REQ *mph_dedicated_fail_req);
1161 EXTERN void ma_mph_ciphering_req (T_MPH_CIPHERING_REQ *mph_ciphering_req);
1162 EXTERN void ma_mph_freq_redef_req (T_MPH_FREQ_REDEF_REQ *mph_freq_redef_req);
1163 EXTERN void ma_mph_channel_mode_req (T_MPH_CHANNEL_MODE_REQ *mph_channel_mode_req);
1164 EXTERN void ma_mph_deactivate_req (T_MPH_DEACTIVATE_REQ *mph_deactivate_req);
1165 EXTERN void ma_mph_classmark_req (T_MPH_CLASSMARK_REQ *mph_classmark_req);
1166 EXTERN void ma_mph_ext_meas_req (T_MPH_EXT_MEAS_REQ *mph_ext_meas_req);
1167 EXTERN void ma_mph_tch_loop_req (T_MPH_TCH_LOOP_REQ *mph_tch_loop_req);
1168 EXTERN void ma_mph_dai_req (T_MPH_DAI_REQ *mph_dai_req);
1169 EXTERN void ma_mph_cbch_req (T_MPH_CBCH_REQ *mph_cbch_req);
1170 EXTERN void ma_mph_identity_req (T_MPH_IDENTITY_REQ *mph_identity_req);
1171 EXTERN void ma_mph_power_req (T_MPH_POWER_REQ *mph_power_req);
1172 EXTERN void ma_mph_bsic_req (T_MPH_BSIC_REQ *mph_bsic_req);
1173 EXTERN void ma_mph_random_access_req (T_MPH_RANDOM_ACCESS_REQ *mph_random_access_req);
1174 EXTERN void ma_mph_sync_req (T_MPH_SYNC_REQ *mph_sync_req);
1175 EXTERN void ma_mph_ncell_pos_req (T_MPH_NCELL_POS_REQ *mph_ncell_pos_req);
1176 EXTERN void ma_mph_clean_buf_req (T_MPH_CLEAN_BUF_REQ *mph_clean_buf_req);
1177 EXTERN void ma_mph_stop_dedi_req (T_MPH_STOP_DEDICATED_REQ *mph_stop_dedi_req);
1178 #ifdef GPRS
1179 EXTERN void ma_mph_meas_rep_req (T_MPH_MEAS_REP_REQ *mph_meas_rep_req);
1180 #endif
1181 /*
1182 * Primitive processing functions for lower layer
1183 */
1184 EXTERN void ma_mphc_rxlev_ind (T_MPHC_RXLEV_IND *rxlev_ind);
1185 EXTERN void ma_mphc_stop_rxlev_cnf (T_MPHC_STOP_RXLEV_CON *rxlev_con);
1186 EXTERN void ma_mphc_empty_cnf (void *);
1187 EXTERN void ma_mphc_network_sync_ind (T_MPHC_NETWORK_SYNC_IND *network_sync_ind);
1188 EXTERN void ma_cs_stop_network_sync_req (void);
1189 EXTERN void ma_mphc_new_scell_cnf (T_MPHC_NEW_SCELL_CON *new_Scell_cnf);
1190 EXTERN void ma_mphc_ncell_bcch_ind (T_MPHC_NCELL_BCCH_IND *ncell_bcch_data_ind);
1191 EXTERN void ma_mphc_ncell_sync_ind (T_MPHC_NCELL_SYNC_IND *ncell_sync_ind);
1192 GLOBAL void ma_mphc_stop_ncell_sync_cnf (T_MPHC_STOP_NCELL_SYNC_CON *ncell_sync_cnf );
1193 EXTERN void ma_mphc_rxlev_periodic_ind (T_MPHC_RXLEV_PERIODIC_IND *rxlev_periodic_ind);
1194 EXTERN void ma_mphc_ra_cnf (T_MPHC_RA_CON *ra_cnf);
1195 EXTERN void ma_mphc_data_ind (T_MPHC_DATA_IND *data_ind);
1196 EXTERN void ma_mphc_change_frequency_cnf (T_MPHC_CHANGE_FREQUENCY_CON *change_frequency_cnf);
1197 EXTERN void ma_mphc_async_ho_cnf (T_MPHC_ASYNC_HO_CON *async_ho_cnf);
1198 EXTERN void ma_mphc_channel_assign_cnf (T_MPHC_CHANNEL_ASSIGN_CON *channel_assign_cnf);
1199 EXTERN void ma_mphc_handover_fail_cnf (T_MPHC_HANDOVER_FAIL_CON *handover_fail_cnf);
1200 EXTERN void ma_mphc_immed_assign_cnf (T_MPHC_IMMED_ASSIGN_CON *immed_assign_cnf);
1201 EXTERN void ma_mphc_pre_sync_ho_cnf (T_MPHC_PRE_SYNC_HO_CON *pre_sync_ho_cnf);
1202 EXTERN void ma_mphc_sync_ho_cnf (T_MPHC_SYNC_HO_CON *sync_ho_cnf);
1203 EXTERN void ma_mphc_ta_fail_ind (T_MPHC_TA_FAIL_IND *ta_fail_ind);
1204 EXTERN void ma_mphc_handover_finished_ind (T_MPHC_HANDOVER_FINISHED *handover_finished);
1205 EXTERN void ma_mphc_meas_report_ind (T_MPHC_MEAS_REPORT *meas_report);
1206 EXTERN void ma_mphc_adc_ind (T_MPHC_ADC_IND *adc_results);
1207 EXTERN void ma_mphc_init_l1_cnf (T_MPHC_INIT_L1_CON *init_l1_cnf);
1208 EXTERN void ma_mphc_stop_dedi_con (T_MPHC_STOP_DEDICATED_CON *stop_cnf);
1209 #if defined(STOP_SYNC_TASK)
1210 EXTERN void ma_mphc_stop_network_sync_cnf (T_MPHC_STOP_NETWORK_SYNC_CON *stop_network_sync_cnf);
1211 #endif /* STOP_SYNC_TASK */
1212 /* Signal processing functions for process Cell Selection */
1213 #ifdef TI_PS_FF_QUAD_BAND_SUPPORT
1214 EXTERN void ma_cs_init_l1_req (void);
1215 #else
1216 EXTERN void ma_cs_init_l1_req (UBYTE radio_band_config);
1217 #endif
1218 EXTERN void ma_cs_stop_network_sync_req (void);
1219 EXTERN void ma_cs_network_sync_req (USHORT channel);
1220 EXTERN void ma_cs_rxlev_req (void);
1221 EXTERN void ma_cs_power_cnf (T_MPH_POWER_CNF *mph_power_cnf);
1222
1223 /* Signal processing functions for process Neigbour Cell */
1224 EXTERN void ma_nc_rxlev_periodic_req (T_MPHC_RXLEV_PERIODIC_REQ *update);
1225 EXTERN void ma_nc_stop_ncell_bcch_req (USHORT arfcn);
1226 EXTERN void ma_nc_stop_ncell_sync_req (USHORT arfcn);
1227 EXTERN void ma_nc_sync_req (T_MPHC_NCELL_SYNC_REQ *sync_req);
1228 EXTERN void ma_nc_list_sync_req (T_MPHC_NCELL_LIST_SYNC_REQ *list_sync_req);
1229 EXTERN void ma_nc_bcch_req (T_MPHC_NCELL_BCCH_REQ *bcch_req);
1230 EXTERN void ma_nc_update_ba_list (T_MPHC_UPDATE_BA_LIST *update_ba_list);
1231 EXTERN void nc_new_serving_cell (USHORT serving_cell);
1232 EXTERN void ma_nc_report_res (T_MPH_MEASUREMENT_IND *mph_measurement_ind);
1233
1234 /* Signal processing functions for process RACH_Contol */
1235 EXTERN void ma_rach_stop_ra_req (void);
1236 EXTERN void ma_rach_ra_req (T_MPHC_RA_REQ *mph_ra_req);
1237 EXTERN void ma_rach_random_cnf (T_MPH_RANDOM_ACCESS_CNF *mph_random_access_cnf);
1238
1239 /* Signal processing functions for process Dedi_Control */
1240 EXTERN void ma_dedi_stop_req (void);
1241 EXTERN void ma_dedi_cnf (UBYTE cause);
1242 EXTERN void ma_dedi_chan_ass_req (T_MPHC_CHANNEL_ASSIGN_REQ *mphc_channel_assign_req);
1243 EXTERN void ma_dedi_async_ho_req (T_MPHC_ASYNC_HO_REQ *async_ho_req);
1244 EXTERN void ma_dedi_sync_ho_req (T_MPHC_SYNC_HO_REQ *sync_ho_req);
1245 EXTERN void ma_dedi_pre_sync_ho_req (T_MPHC_PRE_SYNC_HO_REQ *pre_sync_ho_req);
1246 EXTERN void ma_dedi_fail_cnf (void);
1247 EXTERN void ma_dedi_ho_fail_req (void);
1248 EXTERN void ma_dedi_imm_ass_req (T_MPHC_IMMED_ASSIGN_REQ *immed_assign_req);
1249 EXTERN void ma_dedi_change_freq_req (T_MPHC_CHANGE_FREQUENCY *change_frequency);
1250 EXTERN void ma_dedi_chan_mode_req (T_MPHC_CHANNEL_MODE_MODIFY_REQ *channel_mode_modify_req);
1251 EXTERN void ma_dedi_ciph_req (T_MPHC_SET_CIPHERING_REQ *set_ciphering_req);
1252 EXTERN void ma_dedi_start_dai_req (T_OML1_START_DAI_TEST_REQ *oml1_start_dai_test_req);
1253 EXTERN void ma_dedi_close_tch_loop_req (T_OML1_CLOSE_TCH_LOOP_REQ *oml1_close_tch_loop_req);
1254 EXTERN void ma_dedi_stop_dai_req (void);
1255 EXTERN void ma_dedi_open_tch_loop_req (void);
1256
1257 /* Signal processing functions for process PCH_control */
1258 EXTERN void ma_pch_start_ccch_req (T_MPHC_START_CCCH_REQ *pl_idle);
1259 EXTERN void ma_pch_paging_ind (UBYTE id_type,
1260 UBYTE channel_needed);
1261 EXTERN void ma_pch_stop (void);
1262
1263 /* Signal processing functions for process MMI_control */
1264 EXTERN void ma_mmi_cbch_req (T_MMI_CBCH_REQ *cbch_req);
1265 EXTERN void ma_mmi_sat_cbch_dwnld_req (T_MMI_SAT_CBCH_DWNLD_REQ *cbch_req);
1266 /* Signal processing functions for process CBCH_control */
1267 EXTERN void ma_cb_stop_cbch_req (void);
1268 EXTERN void ma_cb_sched_req (T_MPHC_CBCH_SCHEDULE_REQ *sched_req);
1269 EXTERN void ma_cb_config_cbch (T_MPHC_CONFIG_CBCH_REQ *config_cbch);
1270 EXTERN void ma_cb_mmi_cbch_ind (T_MMI_CBCH_IND *mmi_cbch_ind);
1271 EXTERN void ma_cb_info_req (UBYTE bitmap);
1272
1273 /* Signal processing functions used by more then one process */
1274 EXTERN void ma_scell_nbcch_req (T_MPHC_SCELL_NBCCH_REQ *nbcch_req);
1275 EXTERN void ma_scell_ebcch_req (T_MPHC_SCELL_EBCCH_REQ *ebcch_req);
1276 EXTERN void ma_stop_scell_bcch_req (void);
1277 EXTERN void ma_stop_active_procs (UBYTE flags);
1278 EXTERN void ma_bsic_cnf (T_MPH_BSIC_CNF *mph_bsic_cnf);
1279 EXTERN void ma_send_unitdata (T_MPHC_DATA_IND *data_ind);
1280 EXTERN void ma_error_ind (UBYTE cause,
1281 USHORT arfcn);
1282 EXTERN void ma_clean_dedi_sys_buffer (void);
1283 EXTERN void ma_new_scell_req (T_MPHC_NEW_SCELL_REQ *new_scell);
1284 EXTERN void ma_scell_full_nbcch (void);
1285 #ifdef GPRS
1286 EXTERN BOOL ma_is_ptm (void);
1287 EXTERN void ma_nc_rxlev_sc_req (T_TB_RXLEV_SC_REQ *rxlev_sc_req);
1288 #endif
1289 EXTERN void ma_clean_sys_buffer (USHORT si_mask);
1290 #if defined (REL99) && defined (TI_PS_FF_EMR)
1291 GLOBAL void ma_send_stored_SI2qtr (UBYTE *si_2quater);
1292 EXTERN void ma_mph_enhpara_update_req (T_MPH_ENHPARA_UPDATE_REQ * p_enh);
1293 EXTERN void ma_mph_mon_ctrl_req (T_MPH_MON_CTRL_REQ * ctrl_req);
1294 EXTERN void ma_scell_mon_si2quater_nbcch (void);
1295 EXTERN void ma_scell_mon_si2quater_ebcch (void);
1296 #endif
1297 /* defined in dl_pei.c */
1298 EXTERN void dl1_downlink_indication (UBYTE chan,
1299 UBYTE *frame);
1300
1301 /*
1302 * CBCH Control
1303 */
1304 EXTERN void cb_init (void);
1305 EXTERN void cb_stop (void);
1306 EXTERN void cb_start (void);
1307 EXTERN void cb_mmi_cbch_req (T_MMI_CBCH_REQ *cbch);
1308 EXTERN void cb_mph_cbch_req (T_cbch *cbch);
1309 EXTERN void cb_data_ind (T_MPHC_DATA_IND *cbch_ind);
1310 EXTERN void cb_mmi_sat_cbch_req (T_MMI_SAT_CBCH_DWNLD_REQ *cbch_req);
1311 #if defined(FF_HOMEZONE)
1312 EXTERN void cb_tim_homezone (void);
1313 #endif /* FF_HOMEZONE */
1314
1315 /*
1316 * Cell Selection
1317 */
1318 EXTERN void cs_init (void);
1319 EXTERN void cs_rxlev_ind (T_MPHC_RXLEV_IND *rxlev_ind);
1320 EXTERN void cs_network_sync_ind (T_MPHC_NETWORK_SYNC_IND *network_sync_ind);
1321 EXTERN void cs_stop (void);
1322 EXTERN T_POWER_MEAS* cs_prepare_power_req (void);
1323 EXTERN void cs_power_req (UBYTE pch_interrupt);
1324 EXTERN void cs_bsic_req (T_MPH_BSIC_REQ *mph_bsic_req);
1325 EXTERN void cs_read_scell_bcch (void);
1326 EXTERN UBYTE get_band (USHORT arfcn);
1327 EXTERN void cs_increment_bfc (void);
1328 EXTERN void cs_decrement_bfc (void);
1329 EXTERN void cs_set_wideband_sync (void);
1330
1331 /*
1332 * Dedicated Control
1333 */
1334 EXTERN void dedi_init (void);
1335 EXTERN void dedi_req (T_MPH_DEDICATED_REQ *dedicated_req);
1336 EXTERN void dedi_fail_req (void);
1337 EXTERN void dedi_ta_fail_ind (void);
1338 EXTERN void dedi_ho_finished (T_MPHC_HANDOVER_FINISHED *ho_finished);
1339 EXTERN void dedi_freq_redef_req (T_MPH_FREQ_REDEF_REQ *freq);
1340 EXTERN void dedi_chan_mode_req (T_MPH_CHANNEL_MODE_REQ *ch_mode);
1341 EXTERN void dedi_ciph_req (T_MPH_CIPHERING_REQ *ciph_req);
1342 EXTERN void dedi_tch_loop_req (T_MPH_TCH_LOOP_REQ *tloop);
1343 EXTERN void dedi_dai_req (T_MPH_DAI_REQ *dai);
1344 EXTERN void dedi_change_freq_cnf (void);
1345 EXTERN void dedi_ho_cnf (T_HO_TYPE ho_type);
1346 EXTERN void dedi_chan_ass_cnf (void);
1347 EXTERN void dedi_ho_fail_cnf (void);
1348 EXTERN void dedi_imm_ass_cnf (void);
1349 EXTERN void dedi_stop (void);
1350 EXTERN void dedi_increment_rlt (void);
1351 EXTERN void dedi_decrement_rlt (void);
1352
1353 /*
1354 * MMI Control
1355 */
1356 EXTERN USHORT RX_GetValue (void);
1357
1358 /*
1359 * Idle Mode Neighbour Cell
1360 */
1361 EXTERN void nc_init (void);
1362 EXTERN void nc_ncell_list (T_MPH_NEIGHBOURCELL_REQ *mph_neighbourcell_req);
1363 EXTERN void nc_update_ba_list (USHORT serving_cell, T_MPH_NEIGHBOURCELL_REQ *ncell_list);
1364 EXTERN void nc_stop (void);
1365 EXTERN void nc_bsic_req (T_MPH_BSIC_REQ *mph_bsic_req);
1366 EXTERN void nc_sync_ind (T_MPHC_NCELL_SYNC_IND *sync_ind);
1367 EXTERN void nc_bcch_ind (T_MPHC_NCELL_BCCH_IND *data_ind);
1368 EXTERN void nc_start_dedicated (UBYTE pwrc,
1369 UBYTE dtx);
1370 EXTERN void nc_update_dedicated (UBYTE dtx,
1371 UBYTE pwrc);
1372 EXTERN void nc_update_list (USHORT channel);
1373 EXTERN BOOL nc_get_fn_time (USHORT channel,
1374 ULONG *fn,
1375 ULONG *time);
1376 EXTERN void nc_suspend (void);
1377 EXTERN void nc_add_offset (void);
1378 EXTERN void nc_report (T_MPHC_RXLEV_PERIODIC_IND *rxlev_periodic_ind);
1379 EXTERN void nc_start_reselect (USHORT arfcn);
1380 EXTERN void nc_start_monitoring (void);
1381 EXTERN void nc_report_dedicated (T_MPHC_MEAS_REPORT *meas_report);
1382 EXTERN void nc_fill_report_sc_dedi (T_MPH_MEASUREMENT_IND *rr_report,
1383 UBYTE ncells);
1384 EXTERN void nc_store_tav (USHORT tav);
1385 EXTERN void nc_check_new_ncc_permitted (UBYTE new_ncc_permitted);
1386 EXTERN void nc_stop_rr_activity (UBYTE stop);
1387 EXTERN void nc_stop_ext_meas_ind (void);
1388 EXTERN void nc_resume (void);
1389 EXTERN void nc_check_activity (void);
1390 EXTERN void nc_set_status (USHORT index,
1391 UBYTE new_status);
1392 EXTERN USHORT nc_get_index (USHORT arfcn);
1393 EXTERN void nc_ncsync_tim_expiry (void);
1394 EXTERN void nc_ncell_pos_req (T_MPH_NCELL_POS_REQ* pos_req);
1395 GLOBAL void nc_resume_dedicated(void);
1396 GLOBAL void nc_suspend_handover (void);
1397 EXTERN BOOL nc_is_in_ba(USHORT arfcn);
1398 EXTERN USHORT nc_find_serving_cell_entry (USHORT serving_cell);
1399
1400 #ifdef GPRS
1401 EXTERN void nc_start_pbcch(void);
1402 EXTERN void nc_build_nwctrl_rr_report (T_MPH_MEAS_REP_CNF *rr_report);
1403 #endif
1404
1405 /*
1406 * PCH Control
1407 */
1408 EXTERN void pch_init (void);
1409 EXTERN void pch_configure (T_MPH_IDLE_REQ *idle,
1410 UBYTE page_mode);
1411 EXTERN void pch_start_ccch_req (void);
1412 EXTERN void pch_save_pgm (UBYTE mode);
1413 EXTERN void pch_identity_req (T_MPH_IDENTITY_REQ *mph_identity_req);
1414 EXTERN void pch_check_pag_3 (T_MPHC_DATA_IND *data_ind);
1415 EXTERN void pch_check_pag_2 (T_MPHC_DATA_IND *data_ind);
1416 EXTERN void pch_check_pag_1 (T_MPHC_DATA_IND *data_ind);
1417 EXTERN void pch_check_page_mode (T_MPHC_DATA_IND *data_ind);
1418 EXTERN void pch_check_page_mode_cr (T_MPHC_DATA_IND *data_ind);
1419 EXTERN void pch_decrement_dlt (void);
1420 EXTERN void pch_increment_dlt (void);
1421 EXTERN void pch_stop (void);
1422 EXTERN UBYTE pch_mode_reorg (void);
1423 EXTERN void pch_config_resel (T_MPHC_DATA_IND *data_ind);
1424 /*
1425 * RACH Control
1426 */
1427 EXTERN void rach_init (void);
1428 EXTERN void rach_configure_power (UBYTE power);
1429 EXTERN void rach_configure_class (UBYTE class,
1430 UBYTE dcs_class);
1431 EXTERN void rach_stop (void);
1432 EXTERN UBYTE cut_power_value (UBYTE power,
1433 T_MPH_DEDICATED_REQ *mph_dedicated_req);
1434
1435 EXTERN void rach_random_req (T_MPH_RANDOM_ACCESS_REQ *random_req);
1436 EXTERN void rach_ra_cnf (T_MPHC_RA_CON* ra_cnf);
1437
1438 /*
1439 * Idle Mode Serving Cell
1440 */
1441 EXTERN void sc_start_periodic (void);
1442 EXTERN void csf_show_version (T_TST_TEST_HW_CON *ver);
1443 EXTERN void tim_stop_sync_to_nw (void);
1444
1445
1446
1447 EXTERN UBYTE grlc_test_mode_active(void); /*lint -esym(526,grlc_test_mode_active) : not defined | defined in other entity */
1448 #if defined (_SIMULATION_)
1449 EXTERN void rr_csf_check_rfcap (UBYTE init); /*lint -esym(526,rr_csf_check_rfcap) : not defined | defined in other entity */
1450 #endif /* _SIMULATION_ */
1451 EXTERN CHAR* alr_version(void);
1452
1453 #if defined(ALR_CSF_C) && defined(_TMS470)
1454 EXTERN void Cust_Init_Layer1(void);
1455 EXTERN void SIM_PowerOff (void);
1456 EXTERN void TM_EnableWatchdog (void);
1457 EXTERN void TM_ResetWatchdog(SYS_UWORD16 count);
1458 #endif /* ALR_CSF_C && _TMS470 */
1459
1460 #if defined(WIN32)
1461 #include <stdio.h> /* prototype of sprintf() */
1462 #endif /* WIN32 */
1463
1464 #if !defined NTRACE
1465 EXTERN void trc_mon_counter_idle (UBYTE act_dlt, UBYTE max_dlt);
1466 EXTERN void trc_mon_counter_dedi (UBYTE act_rlt, UBYTE max_rlt);
1467 #endif /* (!defined NTRACE ) */
1468
1469
1470 EXTERN T_ALR_DATA alr_data_base;
1471 #define GET_INSTANCE_DATA register T_ALR_DATA *alr_data= &alr_data_base
1472
1473 #ifdef WIN32
1474 EXTERN T_POWER_MEAS tap_rxlev_response_european[];
1475 EXTERN T_POWER_MEAS tap_rxlev_response_american[];
1476 #endif
1477
1478 #define ENTITY_DATA alr_data
1479
1480 /*
1481 * If all entities are linked into one module this definitions
1482 * prefixes the global data with the enity name
1483 */
1484 #ifdef OPTION_MULTITHREAD
1485 #ifdef TI_PS_HCOMM_CHANGE
1486 #else /* for hCommHandles backward compatibility */
1487 #define hCommL1 _ENTITY_PREFIXED(hCommL1)
1488 #define hCommPL _ENTITY_PREFIXED(hCommPL)
1489 #define hCommDL _ENTITY_PREFIXED(hCommDL)
1490 #define hCommRR _ENTITY_PREFIXED(hCommRR)
1491 #define hCommMMI _ENTITY_PREFIXED(hCommMMI)
1492 #define hCommCST _ENTITY_PREFIXED(hCommCST)
1493 #endif
1494 #ifdef GPRS
1495 #define hCommGPL _ENTITY_PREFIXED(hCommGPL)
1496 #endif /* #ifdef GPRS */
1497 #endif
1498
1499 #ifdef TI_PS_HCOMM_CHANGE
1500 #else /* for hCommHandles backward compatibility */
1501 EXTERN T_HANDLE hCommPL; /* PL own handle */
1502 EXTERN T_HANDLE hCommL1; /* L1 Communication */
1503 EXTERN T_HANDLE hCommDL; /* DL Communication */
1504 EXTERN T_HANDLE hCommRR; /* RR Communication */
1505 EXTERN T_HANDLE hCommMMI; /* MMI Communication */
1506 EXTERN T_HANDLE hCommCST; /* CST Communication */
1507 #endif
1508 #ifdef GPRS
1509 EXTERN T_HANDLE hCommGPL; /* GPL Communication */
1510 #endif /* GPRS */
1511 EXTERN T_HANDLE pl_handle;
1512
1513 EXTERN UBYTE v_mon_counter_idle;
1514 EXTERN UBYTE v_mon_counter_dedi;
1515 EXTERN UBYTE v_eotd;
1516
1517 #if defined(DL_TRACE_ENABLED)
1518 EXTERN void dl_trace (UCHAR trace_type,
1519 UCHAR channel,
1520 UCHAR ch_type,
1521 UCHAR * data);
1522 #ifdef OPTION_MULTITHREAD
1523 #define dl_trace_buf _ENTITY_PREFIXED(dl_trace_buf)
1524 #endif
1525 #if defined(ALR_MAIN_C)
1526 GLOBAL char dl_trace_buf[100];
1527 #else /* ALR_MAIN_C */
1528 EXTERN char dl_trace_buf[100];
1529 #endif /* ALR_MAIN_C */
1530 #define TRACE_PL_EVENT 4
1531 #define DOES_NOT_MATTER 0
1532 #define DL_OFFLINE_TRACE(s) \
1533 dl_trace (TRACE_PL_EVENT, DOES_NOT_MATTER, DOES_NOT_MATTER, (UCHAR*)s)
1534 #else /* DL_TRACE_ENABLED */
1535 #define DL_OFFLINE_TRACE(s)
1536 #endif /* DL_TRACE_ENABLED */
1537
1538 #if !defined(NCONFIG) && !defined(NTRACE) && defined(TRACE_STATE_TRANSITION)
1539 void trc_state_transition(int line, UBYTE newstate);
1540 #else
1541 #define trc_state_transition(line,newstate)
1542 #endif /* !NCONFIG && !NTRACE && TRACE_STATE_TRANSITION */
1543
1544 #if defined(_SIMULATION_)
1545 #define TRACING
1546 #define TRACE_EVENT_WIN(s) TRACE_EVENT(s)
1547 #define TRACE_EVENT_WIN_P1(s,a1) TRACE_EVENT_P1(s,a1)
1548 #define TRACE_EVENT_WIN_P2(s,a1,a2) TRACE_EVENT_P2(s,a1,a2)
1549 #define TRACE_EVENT_WIN_P3(s,a1,a2,a3) TRACE_EVENT_P3(s,a1,a2,a3)
1550 #define TRACE_EVENT_WIN_P4(s,a1,a2,a3,a4) TRACE_EVENT_P4(s,a1,a2,a3,a4)
1551 #define TRACE_EVENT_WIN_P5(s,a1,a2,a3,a4,a5) TRACE_EVENT_P5(s,a1,a2,a3,a4,a5)
1552 #define TRACE_EVENT_WIN_P6(s,a1,a2,a3,a4,a5,a6) TRACE_EVENT_P6(s,a1,a2,a3,a4,a5,a6)
1553 #define TRACE_EVENT_WIN_P7(s,a1,a2,a3,a4,a5,a6,a7) TRACE_EVENT_P7(s,a1,a2,a3,a4,a5,a6,a7)
1554 #define TRACE_EVENT_WIN_P8(s,a1,a2,a3,a4,a5,a6,a7,a8) TRACE_EVENT_P8(s,a1,a2,a3,a4,a5,a6,a7,a8)
1555 #define TRACE_EVENT_WIN_P9(s,a1,a2,a3,a4,a5,a6,a7,a8,a9) TRACE_EVENT_P9(s,a1,a2,a3,a4,a5,a6,a7,a8,a9)
1556 #else /* _SIMULATION_ */
1557 #define TRACE_EVENT_WIN(s)
1558 #define TRACE_EVENT_WIN_P1(s,a1)
1559 #define TRACE_EVENT_WIN_P2(s,a1,a2)
1560 #define TRACE_EVENT_WIN_P3(s,a1,a2,a3)
1561 #define TRACE_EVENT_WIN_P4(s,a1,a2,a3,a4)
1562 #define TRACE_EVENT_WIN_P5(s,a1,a2,a3,a4,a5)
1563 #define TRACE_EVENT_WIN_P6(s,a1,a2,a3,a4,a5,a6)
1564 #define TRACE_EVENT_WIN_P7(s,a1,a2,a3,a4,a5,a6,a7)
1565 #define TRACE_EVENT_WIN_P8(s,a1,a2,a3,a4,a5,a6,a7,a8)
1566 #define TRACE_EVENT_WIN_P9(s,a1,a2,a3,a4,a5,a6,a7,a8,a9)
1567 #endif /* _SIMULATION_ */
1568
1569 #if defined TRACING
1570 #define ALR_TRACE(a) vsi_o_ttrace(VSI_CALLER TC_EVENT,a);
1571 #else
1572 #define ALR_TRACE(a)
1573 #endif /* TRACING */
1574
1575 #define TNNN_WITH_TIMER
1576
1577 /*
1578 #define ALR_TRACE_ENABLED
1579 */
1580 #if defined(ALR_TRACE_ENABLED)
1581 void alr_trc_init (void);
1582 void alr_trc_exit (void);
1583 void alr_trc_store (UCHAR event, UCHAR channel, UCHAR state, void* l2_data);
1584 void alr_trc_read_all (void);
1585 void alr_trc_read (int count);
1586 #else /* ALR_TRACE_ENABLED */
1587 #define alr_trc_init()
1588 #define alr_trc_exit()
1589 #define alr_trc_store(e,c,s,p)
1590 #define alr_trc_read(c)
1591 #define alr_trc_read_all()
1592 #endif /* ALR_TRACE_ENABLED */
1593
1594 /*
1595 * ALR TRACE defines
1596 */
1597 #define ALR_TRC_UPLINK 0
1598 #define ALR_TRC_DOWNLINK 1
1599 #define ALR_TRC_EVENT 2
1600 #define ALR_TRC_STRING 3
1601
1602 #define ALR_TRC_CH_UNDEF 0
1603 #define ALR_TRC_CH_FACCH_FR 1
1604 #define ALR_TRC_CH_FACCH_HR 2
1605 #define ALR_TRC_CH_SDCCH4 3
1606 #define ALR_TRC_CH_SDCCH8 4
1607 #define ALR_TRC_CH_SACCH 5
1608 #define ALR_TRC_CH_UNKNOWN 6
1609
1610 #define ALR_TRC_DATA_SIZE 40
1611
1612 #define ALR_RXLEV_AVERAGE_MIN 0
1613 #define ALR_RXLEV_AVERAGE_LWR_THR 4
1614
1615 #endif /* ALR_H */