comparison gsm-fw/g23m-gsm/alr/alr_pei.c @ 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 8e40f2974e4c
comparison
equal deleted inserted replaced
672:0dc6f9e8e980 673:2f7df7a314f8
1 /*
2 +-----------------------------------------------------------------------------
3 | Project :
4 | Modul :
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 : This module implements the process body interface
18 | for the entity ALR.
19 +-----------------------------------------------------------------------------
20 */
21
22 #ifndef ALR_PEI_C
23 #define ALR_PEI_C
24
25 #define ENTITY_PL
26
27 /*==== INCLUDES ===================================================*/
28 #include <string.h>
29 #include <stdlib.h>
30 #include <ctype.h>
31 #include "typedefs.h"
32 #include "pconst.cdg"
33 #include "mconst.cdg"
34 #include "message.h"
35 #include "ccdapi.h"
36 #include "vsi.h"
37 #include "custom.h"
38 #include "gsm.h"
39 #include "prim.h"
40 #include "cnf_alr.h"
41 #include "mon_alr.h"
42 #include "pei.h"
43 #include "tok.h"
44 #include "pcm.h"
45 #ifdef GPRS
46 #include "alr_gprs.h"
47 #endif
48 #if defined (_TMS470)
49 #include "inth/iq.h"
50 #endif /* _TMS470 */
51
52 #include "alr.h"
53 #include "alr_em.h"
54
55 /*==== IMPORT =====================================================*/
56 /*==== EXPORT =====================================================*/
57 #ifdef TI_PS_HCOMM_CHANGE
58 #else
59 GLOBAL T_HANDLE hCommL1 = VSI_ERROR; /* PL Communication */
60 GLOBAL T_HANDLE hCommPL = VSI_ERROR; /* PL Communication */
61 GLOBAL T_HANDLE hCommDL = VSI_ERROR; /* DL Communication */
62 GLOBAL T_HANDLE hCommRR = VSI_ERROR; /* RR Communication */
63 GLOBAL T_HANDLE hCommMMI = VSI_ERROR; /* MMI Communication */
64 GLOBAL T_HANDLE hCommCST = VSI_ERROR; /* CST Communication */
65 #endif
66
67
68 #ifdef GPRS
69 GLOBAL T_HANDLE hCommGPL = VSI_ERROR; /* GPL Communication */
70 #endif /* GPRS */
71
72 GLOBAL T_HANDLE pl_handle;
73
74 GLOBAL T_ALR_DATA alr_data_base;
75
76 #if !defined(DYNAMIC_POWER_MEAS)
77 T_POWER_MEAS1 alr_power_meas_result1;
78 T_POWER_MEAS2 alr_power_meas_result2;
79 #endif /* !DYNAMIC_POWER_MEAS */
80
81 #ifdef _SIMULATION_
82 /*lint -e785 (Info -- Too few initializers for aggregate)*/
83 T_POWER_MEAS tap_rxlev_response_european[16] = {
84 {4,{{1 , 105},{ 14, 220},{ 23, 280},{124, 125}}}, // 0
85 {0,{{0 , 0}, { 0, 0},{ 0, 0},{ 0, 0}}}, // 1
86 {4,{{512, 105},{580, 220},{637, 280},{885, 125}}}, // 2
87 {8,{{23 , 280},{512, 55},{14 , 220},{580, 215}, // 3
88 {124, 125},{885, 115},{1 , 105},{637, 275}}},
89 {3,{{23 , 280},{512, 55},{0x8000 | 512, 100}}}, // 4
90 {2,{{ 14, 220},{ 23, 280},{ 0, 0},{ 0, 0}}}, // 5
91 {1,{{ 23, 280},{ 0, 0},{ 0, 0},{ 0, 0}}}, // 6
92 {10,{{ 0, 5*60},{ 1, 5*0},{ 10, 5*10},{ 20, 5*20},{ 123, 5*30}, // 7
93 {124, 5*40},{974, 5*50},{975, 5*-10},{1022, 5*70},{1023, 5*80}}},
94 {1,{{ 32, 100},{ 0, 0},{ 0, 0},{ 0, 0}}}, // 8
95 {50, {{ 0, 5*60},{ 1, 5*10},{ 10,5*30},{ 20,5*20},{ 123,5*30}, // 9
96 { 3, 5*60},{ 4, 5*10},{ 5, 5*30},{ 31,5*20},{ 123,5*30},
97 { 6, 5*60},{ 7, 5*10},{ 8, 5*30},{ 9, 5*20},{ 11, 5*30},
98 { 12,5*60},{ 13,5*10},{ 14,5*30},{ 15,5*20},{ 16, 5*30},
99 { 17,5*60},{ 18,5*10},{ 19,5*30},{ 21,5*20},{ 23, 5*30},
100 { 22,5*60},{ 24,5*10},{ 25,5*30},{ 26,5*20},{ 28, 5*30},
101 { 27,5*60},{ 29,5*10},{ 30,5*30},{ 32,5*20},{ 33, 5*30},
102 { 36,5*60},{ 37,5*50},{ 38,5*40},{ 39,5*20},{ 34, 5*30},
103 { 40,5*60},{ 41,5*50},{ 42,5*40},{ 43,5*20},{ 44, 5*30},
104 { 45,5*60},{ 46,5*50},{ 47,5*40},{ 48,5*20},{ 49, 5*30}}},
105 {0, {0}}, // 10
106 {4,{{1 , -10},{ 14, -2},{ 23, -8},{124, -12}}}, // 12 - 11
107 {90, {{ 0, 5*60},{ 1, 5*50},{ 10,5*40},{ 20,5*20},{ 123,5*30}, // 12
108 { 3, 5*60},{ 4, 5*50},{ 5, 5*40},{ 31,5*20},{ 50,5*30},
109 { 6, 5*60},{ 7, 5*50},{ 8, 5*40},{ 9, 5*20},{ 11, 5*30},
110 { 12,5*60},{ 13,5*50},{ 14,5*40},{ 15,5*20},{ 16, 5*30},
111 { 17,5*60},{ 18,5*50},{ 19,5*40},{ 21,5*20},{ 23, 5*30},
112 { 22,5*60},{ 24,5*50},{ 25,5*40},{ 26,5*20},{ 28, 5*30},
113 { 27,5*60},{ 29,5*50},{ 30,5*40},{ 32,5*20},{ 33, 5*30},
114 { 36,5*60},{ 37,5*50},{ 38,5*40},{ 39,5*20},{ 34, 5*30},
115 { 40,5*60},{ 41,5*50},{ 42,5*40},{ 43,5*20},{ 44, 5*30},
116 { 45,5*60},{ 46,5*50},{ 47,5*40},{ 48,5*20},{ 49, 5*30},
117 { 512,5*60},{ 513,5*50},{533,5*40},{ 514,5*20},{515, 5*30},
118 { 516,5*60},{ 517,5*50},{518,5*40},{ 519,5*20},{520, 5*30},
119 { 521,5*60},{ 522,5*50},{523,5*40},{ 524,5*20},{525, 5*30},
120 { 526,5*60},{ 527,5*50},{528,5*40},{ 529,5*20},{530, 5*30},
121 { 531,5*60},{ 532,5*50},{541,5*40},{ 534,5*20},{535, 5*30},
122 { 536,5*60},{ 537,5*50},{538,5*40},{ 539,5*20},{540, 5*30},
123 { 542,5*60},{ 543,5*50},{544,5*40},{ 545,5*20},{546, 5*30},
124 { 547,5*60},{ 548,5*50},{549,5*40},{ 550,5*20},{551, 5*30},
125 }},
126 // 35 Carriers in DCS_1800 & 50 Carriers in GSM_900
127 {85, {{ 0, 5*60},{ 1, 5*50},{ 10,5*40},{ 20,5*20},{ 123,5*30}, // 13
128 { 3, 5*60},{ 4, 5*50},{ 5, 5*40},{ 31,5*20},{ 50,5*30},
129 { 6, 5*60},{ 7, 5*50},{ 8, 5*40},{ 9, 5*20},{ 11, 5*30},
130 { 12,5*60},{ 13,5*50},{ 14,5*40},{ 15,5*20},{ 16, 5*30},
131 { 17,5*60},{ 18,5*50},{ 19,5*40},{ 21,5*20},{ 23, 5*30},
132 { 22,5*60},{ 24,5*50},{ 25,5*40},{ 26,5*20},{ 28, 5*30},
133 { 27,5*60},{ 29,5*50},{ 30,5*40},{ 32,5*20},{ 33, 5*30},
134 { 36,5*60},{ 37,5*50},{ 38,5*40},{ 39,5*20},{ 34, 5*30},
135 { 40,5*60},{ 41,5*50},{ 42,5*40},{ 43,5*20},{ 44, 5*30},
136 { 125,5*60},{ 126,5*50},{ 127,5*40},{ 128,5*20},{ 129, 5*30},
137 { 512,5*60},{ 513,5*50},{533,5*40},{ 514,5*20},{515, 5*30},
138 { 516,5*60},{ 517,5*50},{518,5*40},{ 519,5*20},{520, 5*30},
139 { 521,5*60},{ 522,5*50},{523,5*40},{ 524,5*20},{525, 5*30},
140 { 526,5*60},{ 527,5*50},{528,5*40},{ 529,5*20},{530, 5*30},
141 { 531,5*60},{ 532,5*50},{541,5*40},{ 534,5*20},{535, 5*30},
142 { 536,5*60},{ 537,5*50},{538,5*40},{ 539,5*20},{540, 5*30},
143 { 546,5*60},{ 542,5*50},{543,5*40},{ 544,5*20},{545, 5*30},
144 }},
145 // 80 GSM 900 Carriers & 20 PCS 1800 Carriers
146 {100, {{ 0, 5*60},{ 1, 5*50},{ 10,5*40},{ 20,5*25},{ 123,5*30}, // 14
147 { 3, 5*60},{ 4, 5*50},{ 5, 5*40},{ 31,5*25},{ 50,5*30},
148 { 6, 5*60},{ 7, 5*50},{ 8, 5*40},{ 9, 5*25},{ 11, 5*30},
149 { 12,5*60},{ 13,5*50},{ 14,5*40},{ 15,5*25},{ 16, 5*30},
150 { 17,5*60},{ 18,5*50},{ 19,5*40},{ 21,5*25},{ 23, 5*30},
151 { 22,5*60},{ 24,5*50},{ 25,5*40},{ 26,5*25},{ 28, 5*30},
152 { 27,5*60},{ 29,5*50},{ 30,5*40},{ 32,5*25},{ 33, 5*30},
153 { 36,5*60},{ 37,5*50},{ 38,5*40},{ 39,5*25},{ 34, 5*30},
154 { 40,5*60},{ 41,5*50},{ 42,5*40},{ 43,5*25},{ 44, 5*30},
155 { 45,5*60},{ 46,5*50},{ 47,5*40},{ 48,5*25},{ 49, 5*30},
156 { 51,5*60},{ 52,5*50},{ 53,5*40},{ 54,5*25},{ 55, 5*30},
157 { 56,5*60},{ 57,5*50},{ 58,5*40},{ 59,5*25},{ 60, 5*30},
158 { 61,5*60},{ 62,5*50},{ 63,5*40},{ 64,5*25},{ 65, 5*30},
159 { 66,5*60},{ 67,5*50},{ 68,5*40},{ 69,5*25},{ 70, 5*30},
160 { 72,5*60},{ 73,5*50},{ 74,5*40},{ 75,5*25},{ 76, 5*30},
161 { 77,5*20},{ 78,5*50},{ 79,5*40},{ 80,5*25},{ 81, 5*30},
162 { 512,5*60},{ 513,5*50},{533,5*40},{ 514,5*20},{515, 5*30},
163 { 516,5*60},{ 517,5*50},{518,5*40},{ 519,5*20},{520, 5*30},
164 { 521,5*60},{ 522,5*50},{523,5*40},{ 524,5*20},{525, 5*30},
165 { 526,5*60},{ 527,5*50},{528,5*40},{ 529,5*20},{530, 5*30},
166 }},
167 // 80 GSM 900 Carriers & 20 PCS 1800 Carriers
168 {100, {{ 0, 5*60},{ 1, 5*18},{ 10,5*40},{ 20,5*18},{ 123,5*30}, // 15
169 { 3, 5*60},{ 4, 5*18},{ 5, 5*40},{ 31,5*18},{ 50,5*30},
170 { 6, 5*60},{ 7, 5*18},{ 8, 5*40},{ 9, 5*18},{ 11, 5*30},
171 { 12,5*60},{ 13,5*18},{ 14,5*40},{ 15,5*18},{ 16, 5*30},
172 { 17,5*60},{ 18,5*18},{ 19,5*40},{ 21,5*18},{ 23, 5*30},
173 { 22,5*60},{ 24,5*18},{ 25,5*40},{ 26,5*18},{ 28, 5*30},
174 { 27,5*60},{ 29,5*18},{ 30,5*40},{ 32,5*18},{ 33, 5*30},
175 { 36,5*60},{ 37,5*18},{ 38,5*40},{ 39,5*18},{ 34, 5*30},
176 { 40,5*60},{ 41,5*18},{ 42,5*40},{ 43,5*18},{ 44, 5*30},
177 { 45,5*60},{ 46,5*18},{ 47,5*40},{ 48,5*18},{ 49, 5*30},
178 { 51,5*60},{ 52,5*18},{ 53,5*40},{ 54,5*18},{ 55, 5*30},
179 { 56,5*60},{ 57,5*18},{ 58,5*40},{ 59,5*18},{ 60, 5*30},
180 { 61,5*60},{ 62,5*18},{ 63,5*40},{ 64,5*18},{ 65, 5*30},
181 { 66,5*60},{ 67,5*18},{ 68,5*40},{ 69,5*18},{ 70, 5*30},
182 { 72,5*60},{ 73,5*18},{ 74,5*40},{ 75,5*18},{ 76, 5*30},
183 { 77,5*20},{ 78,5*18},{ 79,5*40},{ 80,5*18},{ 81, 5*30},
184 { 512,5*60},{ 513,5*18},{533,5*40},{ 514,5*18},{515, 5*30},
185 { 516,5*60},{ 517,5*18},{518,5*40},{ 519,5*18},{520, 5*30},
186 { 521,5*60},{ 522,5*18},{523,5*40},{ 524,5*18},{525, 5*30},
187 { 526,5*60},{ 527,5*18},{528,5*40},{ 529,5*18},{530, 5*30},
188 }},
189 };
190
191
192 T_POWER_MEAS tap_rxlev_response_american[16] = {
193 {5,{{130, 105},{140, 220},{150, 250},{250, 125}, {155, -10}}}, // 0
194 {0,{{0 , 0}, { 0, 0},{ 0, 0},{ 0, 0}}}, // 1
195 {0,{{0 , 0}, { 0, 0},{ 0, 0},{ 0, 0}}}, // 2
196 {0,{{0 , 0}, { 0, 0},{ 0, 0},{ 0, 0}}}, // 3
197 {0,{{0 , 0}, { 0, 0},{ 0, 0},{ 0, 0}}}, // 4
198 {0,{{0 , 0}, { 0, 0},{ 0, 0},{ 0, 0}}}, // 5
199 {0,{{0 , 0}, { 0, 0},{ 0, 0},{ 0, 0}}}, // 6
200 {0,{{0 , 0}, { 0, 0},{ 0, 0},{ 0, 0}}}, // 7
201 {0,{{0 , 0}, { 0, 0},{ 0, 0},{ 0, 0}}}, // 8
202 {0,{{0 , 0}, { 0, 0},{ 0, 0},{ 0, 0}}}, // 9
203 {0, {0}}, // 10
204 {5,{{130, -1},{140, -2},{150, -5},{250, -12}, {155, -10}}}, // 11
205 // 40 Carriers in PCS_1900 & 50 Carriers in GSM_850
206 {90,{{130, 105},{140, 220},{150, 250},{240, 125}, {160, 110}, // 12
207 {131, 105},{141, 220},{151, 250},{241, 125}, {161, 110},
208 {132, 105},{142, 220},{152, 250},{222, 125}, {162, 110},
209 {133, 105},{143, 220},{153, 250},{223, 125}, {163, 110},
210 {134, 105},{144, 220},{154, 250},{224, 125}, {164, 110},
211 {135, 105},{145, 220},{155, 250},{225, 125}, {165, 110},
212 {136, 105},{146, 220},{156, 250},{226, 125}, {166, 110},
213 {137, 105},{147, 220},{157, 250},{227, 125}, {167, 110},
214 {138, 105},{148, 220},{158, 250},{228, 125}, {168, 110},
215 {139, 105},{149, 220},{159, 250},{229, 125}, {169, 110},
216 { 553,105},{ 554,220},{534, 220},{514, 220}, {535, 220},
217 { 536,105},{ 537,220},{538, 220},{539, 220}, {540, 220},
218 { 541,105},{ 542,220},{543, 220},{544, 220}, {545, 220},
219 { 546,105},{ 547,220},{548, 220},{549, 220}, {550, 220},
220 { 551,105},{ 552,220},{555, 220},{556, 220}, {557, 220},
221 { 558,105},{ 559,220},{560, 220},{561, 220}, {562, 220},
222 { 563,105},{ 564,220},{565, 220},{566, 220}, {567, 220},
223 { 568,105},{ 568,220},{570, 220},{571, 220}, {572, 220},
224 }},
225 // 35 Carriers in PCS_1900 & 50 Carriers in GSM_850
226 {85,{{130, 105},{140, 220},{150, 250},{240, 125}, {160, 110}, // 13
227 {131, 105},{141, 220},{151, 250},{241, 125}, {161, 110},
228 {132, 105},{142, 220},{152, 250},{242, 125}, {162, 110},
229 {133, 105},{143, 220},{153, 250},{243, 125}, {163, 110},
230 {134, 105},{144, 220},{154, 250},{244, 125}, {164, 110},
231 {135, 105},{145, 220},{155, 250},{245, 125}, {165, 110},
232 {136, 105},{146, 220},{156, 250},{246, 125}, {166, 110},
233 {137, 105},{147, 220},{157, 250},{247, 125}, {167, 110},
234 {138, 105},{148, 220},{158, 250},{248, 125}, {168, 110},
235 {139, 105},{149, 220},{159, 250},{249, 125}, {169, 110},
236 { 125,105},{ 140,220},{150, 220},{160, 220}, {170, 220},
237 { 126,105},{ 141,220},{151, 220},{161, 220}, {171, 220},
238 { 127,105},{ 142,220},{152, 220},{162, 220}, {172, 220},
239 { 128,105},{ 143,220},{153, 220},{163, 220}, {173, 220},
240 { 129,105},{ 144,220},{154, 220},{164, 220}, {174, 220},
241 { 130,105},{ 145,220},{155, 220},{165, 220}, {175, 220},
242 { 131,105},{ 146,220},{156, 220},{166, 220}, {176, 220},
243 }},
244 // 80 GSM 850 Carriers & 20 PCS 1900 Carriers
245 {100,{{130, 105},{140, 220},{150, 250},{240, 125}, {160, 110}, // 14
246 {131, 105},{141, 220},{151, 250},{241, 125}, {161, 110},
247 {132, 105},{142, 220},{152, 250},{242, 125}, {162, 110},
248 {133, 105},{143, 220},{153, 250},{243, 125}, {163, 110},
249 {134, 105},{144, 220},{154, 250},{244, 125}, {164, 110},
250 {135, 105},{145, 220},{155, 250},{245, 125}, {165, 110},
251 {136, 105},{146, 220},{156, 250},{246, 125}, {166, 110},
252 {137, 105},{147, 220},{157, 250},{247, 125}, {167, 110},
253 {138, 105},{148, 220},{158, 250},{248, 125}, {168, 110},
254 {139, 105},{149, 220},{159, 250},{249, 125}, {169, 110},
255 {170, 105},{180, 220},{190, 250},{200, 125}, {210, 110},
256 {171, 105},{181, 220},{191, 250},{201, 125}, {211, 110},
257 {172, 105},{182, 220},{192, 250},{202, 125}, {212, 110},
258 {173, 105},{183, 220},{193, 250},{203, 125}, {213, 110},
259 {174, 105},{184, 220},{194, 250},{204, 125}, {214, 110},
260 {175, 105},{185, 220},{195, 250},{205, 125}, {215, 110},
261 { 553,105},{ 554,220},{534, 220},{514, 220}, {535, 220},
262 { 536,105},{ 537,220},{538, 220},{539, 220}, {540, 220},
263 { 541,105},{ 542,220},{543, 220},{544, 220}, {545, 220},
264 { 546,105},{ 547,220},{548, 220},{549, 220}, {550, 220},
265 }},
266 // 80 GSM 850 Carriers & 20 PCS 1900 Carriers
267 {100,{{130, 105},{140, 80},{150, 250},{240, 90}, {160, 110}, // 15
268 {131, 105},{141, 80},{151, 250},{241, 90}, {161, 110},
269 {132, 105},{142, 80},{152, 250},{242, 90}, {162, 110},
270 {133, 105},{143, 80},{153, 250},{243, 90}, {163, 110},
271 {134, 105},{144, 80},{154, 250},{244, 90}, {164, 110},
272 {135, 105},{145, 80},{155, 250},{245, 90}, {165, 110},
273 {136, 105},{146, 80},{156, 250},{246, 90}, {166, 110},
274 {137, 105},{147, 80},{157, 250},{247, 90}, {167, 110},
275 {138, 105},{148, 80},{158, 250},{248, 90}, {168, 110},
276 {139, 105},{149, 80},{159, 250},{249, 90}, {169, 110},
277 {170, 105},{180, 80},{190, 250},{200, 90}, {210, 110},
278 {171, 105},{181, 80},{191, 250},{201, 90}, {211, 110},
279 {172, 105},{182, 80},{192, 250},{202, 90}, {212, 110},
280 {173, 105},{183, 80},{193, 250},{203, 90}, {213, 110},
281 {174, 105},{184, 80},{194, 250},{204, 90}, {214, 110},
282 {175, 105},{185, 80},{195, 250},{205, 90}, {215, 110},
283 { 553,105},{ 554,80},{534, 220},{514, 90}, {535, 220},
284 { 536,105},{ 537,80},{538, 220},{539, 90}, {540, 220},
285 { 541,105},{ 542,80},{543, 220},{544, 90}, {545, 220},
286 { 546,105},{ 547,80},{548, 220},{549, 90}, {550, 220},
287 }},
288 };
289
290 /*lint +e785 (Info -- Too few initializers for aggregate)*/
291 #endif /* _SIMULATION_ */
292
293 /*==== PRIVATE ====================================================*/
294
295 LOCAL void pei_not_supported (void *);
296
297 #ifdef OPTION_RELATIVE
298 LOCAL ULONG offset;
299 #endif
300
301 #define TRACING
302 /*==== VARIABLES ==================================================*/
303 #ifdef _SIMULATION_
304 LOCAL BOOL first_access = TRUE;
305 #endif /* _SIMULATION_ */
306
307 LOCAL T_MONITOR alr_mon;
308
309 /*==== FUNCTIONS ==================================================*/
310
311 LOCAL const T_FUNC mph_table[] = {
312 MAK_FUNC_N ( pei_not_supported , 0 ),
313 MAK_FUNC_N ( pei_not_supported , 0 ),
314 MAK_FUNC_N ( pei_not_supported , 0 ),
315 MAK_FUNC_0 ( ma_mph_idle_req , MPH_IDLE_REQ ),
316 MAK_FUNC_0 ( ma_mph_neighbourcell_req , MPH_NEIGHBOURCELL_REQ ),
317 MAK_FUNC_0 ( ma_mph_emo_req , MPH_EMO_REQ ),
318 MAK_FUNC_0 ( ma_mph_dedicated_req , MPH_DEDICATED_REQ ),
319 MAK_FUNC_0 ( ma_mph_dedicated_fail_req, MPH_DEDICATED_FAIL_REQ ),
320 MAK_FUNC_0 ( ma_mph_ciphering_req , MPH_CIPHERING_REQ ),
321 MAK_FUNC_0 ( ma_mph_freq_redef_req , MPH_FREQ_REDEF_REQ ),
322 MAK_FUNC_0 ( ma_mph_channel_mode_req , MPH_CHANNEL_MODE_REQ ),
323 MAK_FUNC_0 ( ma_mph_deactivate_req , MPH_DEACTIVATE_REQ ),
324 MAK_FUNC_0 ( ma_mph_classmark_req , MPH_CLASSMARK_REQ ),
325 MAK_FUNC_N ( ma_mph_ext_meas_req , MPH_EXT_MEAS_REQ ),
326 MAK_FUNC_N ( ma_mph_ncell_pos_req , MPH_NCELL_POS_REQ ),
327 MAK_FUNC_N ( pei_not_supported , 0 ),
328 MAK_FUNC_N ( pei_not_supported , 0 ),
329 MAK_FUNC_0 ( ma_mph_tch_loop_req , MPH_TCH_LOOP_REQ ),
330 MAK_FUNC_0 ( ma_mph_dai_req , MPH_DAI_REQ ),
331 MAK_FUNC_0 ( ma_mph_cbch_req , MPH_CBCH_REQ ),
332 MAK_FUNC_0 ( ma_mph_identity_req , MPH_IDENTITY_REQ ),
333 MAK_FUNC_0 ( ma_mph_power_req , MPH_POWER_REQ ),
334 MAK_FUNC_0 ( ma_mph_bsic_req , MPH_BSIC_REQ ),
335 MAK_FUNC_0 ( ma_mph_random_access_req , MPH_RANDOM_ACCESS_REQ ),
336
337 #if defined (TI_PS_FF_EMR)
338 MAK_FUNC_0 ( ma_mph_mon_ctrl_req , MPH_MON_CTRL_REQ ),
339 #elif defined (GPRS)
340 MAK_FUNC_0 ( gprs_alr_mon_ctrl_req , MPH_MON_CTRL_REQ ),
341 #else
342 MAK_FUNC_N ( pei_not_supported , 0 ),
343 #endif
344 MAK_FUNC_0 ( ma_mph_sync_req , MPH_SYNC_REQ ),
345 MAK_FUNC_0 ( ma_mph_clean_buf_req , MPH_CLEAN_BUF_REQ ),
346 MAK_FUNC_0 ( ma_mph_stop_dedi_req , MPH_STOP_DEDICATED_REQ ),
347 #ifdef GPRS
348 MAK_FUNC_0 ( ma_mph_meas_rep_req , MPH_MEAS_REP_REQ ),
349 #else
350 MAK_FUNC_N ( pei_not_supported , 0 ),
351 #endif
352 #if defined (REL99) && defined (TI_PS_FF_EMR)
353 MAK_FUNC_0 ( ma_mph_enhpara_update_req, MPH_ENHPARA_UPDATE_REQ )
354 #else
355 MAK_FUNC_N ( pei_not_supported , 0 )
356 #endif
357 };
358
359 /*
360 * The MPHC jump table uses the
361 * original TI opcodes !!!
362 */
363
364 LOCAL const T_FUNC mphc_table[] = {
365 MAK_FUNC_N ( pei_not_supported , 0 ),
366 MAK_FUNC_N ( pei_not_supported , TST_TEST_HW_REQ ), /* 1 */
367 MAK_FUNC_0 ( csf_show_version , TST_TEST_HW_CON ), /* 2 */
368 MAK_FUNC_N ( pei_not_supported , TST_TIMESTAMP_MSG ), /* 3 */
369 MAK_FUNC_N ( pei_not_supported , TST_SLEEP_REQ ), /* 4 */
370 MAK_FUNC_N ( pei_not_supported , 0 ), /* 5 */
371 MAK_FUNC_N ( pei_not_supported , 0 ), /* 6 */
372 MAK_FUNC_N ( pei_not_supported , 0 ), /* 7 */
373 MAK_FUNC_N ( pei_not_supported , 0 ), /* 8 */
374 MAK_FUNC_N ( pei_not_supported , 0 ), /* 9 */
375 MAK_FUNC_N ( pei_not_supported , 0 ), /* 10 */
376 MAK_FUNC_N ( pei_not_supported , MPHC_RXLEV_REQ ), /* 11 */
377 MAK_FUNC_0 ( ma_mphc_rxlev_ind , MPHC_RXLEV_IND ),
378 MAK_FUNC_N ( pei_not_supported , MPHC_STOP_RXLEV_REQ ),
379 MAK_FUNC_0 ( ma_mphc_stop_rxlev_cnf , MPHC_STOP_RXLEV_CON ),
380 MAK_FUNC_0 ( pei_not_supported , MPHC_NETWORK_SYNC_REQ ),
381 MAK_FUNC_N ( ma_mphc_network_sync_ind , MPHC_NETWORK_SYNC_IND ),
382 MAK_FUNC_0 ( pei_not_supported , MPHC_STOP_NETWORK_SYNC_REQ ),
383 #if defined(STOP_SYNC_TASK)
384 MAK_FUNC_N ( ma_mphc_stop_network_sync_cnf , MPHC_STOP_NETWORK_SYNC_CON ),
385 #else /* STOP_SYNC_TASK */
386 MAK_FUNC_N ( ma_mphc_empty_cnf , MPHC_STOP_NETWORK_SYNC_CON ),
387 #endif /* STOP_SYNC_TASK */
388 MAK_FUNC_0 ( pei_not_supported , MPHC_NEW_SCELL_REQ ),
389 MAK_FUNC_N ( ma_mphc_new_scell_cnf , MPHC_NEW_SCELL_CON ),
390 MAK_FUNC_N ( pei_not_supported , MPHC_START_CCCH_REQ ),
391 MAK_FUNC_N ( pei_not_supported , MPHC_STOP_CCCH_REQ ),
392 MAK_FUNC_0 ( ma_mphc_empty_cnf , MPHC_STOP_CCCH_CON ),
393 MAK_FUNC_N ( pei_not_supported , MPHC_SCELL_NBCCH_REQ ),
394 MAK_FUNC_N ( pei_not_supported , MPHC_SCELL_EBCCH_REQ ),
395 MAK_FUNC_N ( pei_not_supported , MPHC_STOP_SCELL_BCCH_REQ ),
396 MAK_FUNC_0 ( ma_mphc_empty_cnf , MPHC_STOP_SCELL_BCCH_CON ),
397 MAK_FUNC_N ( pei_not_supported , MPHC_NCELL_BCCH_REQ ),
398 MAK_FUNC_0 ( ma_mphc_ncell_bcch_ind , MPHC_NCELL_BCCH_IND ),
399 MAK_FUNC_N ( pei_not_supported , MPHC_STOP_NCELL_BCCH_REQ ),
400 MAK_FUNC_0 ( ma_mphc_empty_cnf , MPHC_STOP_NCELL_BCCH_CON ),
401 MAK_FUNC_N ( pei_not_supported , MPHC_NCELL_SYNC_REQ ),
402 MAK_FUNC_0 ( ma_mphc_ncell_sync_ind , MPHC_NCELL_SYNC_IND ),
403 MAK_FUNC_N ( pei_not_supported , MPHC_STOP_NCELL_SYNC_REQ ),
404 MAK_FUNC_0 ( ma_mphc_stop_ncell_sync_cnf , MPHC_STOP_NCELL_SYNC_CON ),
405 MAK_FUNC_N ( pei_not_supported , MPHC_RXLEV_PERIODIC_REQ ),
406 MAK_FUNC_0 ( ma_mphc_rxlev_periodic_ind , MPHC_RXLEV_PERIODIC_IND ),
407 MAK_FUNC_N ( pei_not_supported , MPHC_STOP_RXLEV_PERIODIC_REQ ),
408 MAK_FUNC_0 ( ma_mphc_empty_cnf , MPHC_STOP_RXLEV_PERIODIC_CON ),
409 MAK_FUNC_N ( pei_not_supported , MPHC_CONFIG_CBCH_REQ ),
410 MAK_FUNC_N ( pei_not_supported , MPHC_CBCH_SCHEDULE_REQ ),
411 MAK_FUNC_N ( pei_not_supported , MPHC_CBCH_UPDATE_REQ ),
412 MAK_FUNC_N ( pei_not_supported , MPHC_CBCH_INFO_REQ ),
413 MAK_FUNC_N ( pei_not_supported , MPHC_STOP_CBCH_REQ ),
414 MAK_FUNC_N ( ma_mphc_empty_cnf , MPHC_STOP_CBCH_CON ),
415 MAK_FUNC_N ( pei_not_supported , MPHC_RA_REQ ),
416 MAK_FUNC_0 ( ma_mphc_ra_cnf , MPHC_RA_CON ),
417 MAK_FUNC_N ( pei_not_supported , MPHC_STOP_RA_REQ ),
418 MAK_FUNC_0 ( ma_mphc_empty_cnf , MPHC_STOP_RA_CON ),
419 MAK_FUNC_0 ( ma_mphc_data_ind , MPHC_DATA_IND ),
420 MAK_FUNC_N ( pei_not_supported , MPHC_IMMED_ASSIGN_REQ ),
421 MAK_FUNC_N ( pei_not_supported , MPHC_CHANNEL_ASSIGN_REQ ),
422 MAK_FUNC_N ( pei_not_supported , MPHC_ASYNC_HO_REQ ),
423 MAK_FUNC_N ( pei_not_supported , MPHC_SYNC_HO_REQ ),
424 MAK_FUNC_N ( pei_not_supported , MPHC_PRE_SYNC_HO_REQ ),
425 MAK_FUNC_N ( pei_not_supported , MPHC_PSEUDO_SYNC_HO_REQ ),
426 MAK_FUNC_N ( pei_not_supported , MPHC_STOP_DEDICATED_REQ ),
427 MAK_FUNC_0 ( ma_mphc_change_frequency_cnf , MPHC_CHANGE_FREQUENCY_CON ),
428 MAK_FUNC_0 ( ma_mphc_async_ho_cnf , MPHC_ASYNC_HO_CON ),
429 MAK_FUNC_0 ( ma_mphc_channel_assign_cnf , MPHC_CHANNEL_ASSIGN_CON ),
430 MAK_FUNC_0 ( ma_mphc_empty_cnf , MPHC_CHANNEL_MODE_MODIFY_CON ),
431 MAK_FUNC_0 ( ma_mphc_handover_fail_cnf , MPHC_HANDOVER_FAIL_CON ),
432 MAK_FUNC_0 ( ma_mphc_immed_assign_cnf , MPHC_IMMED_ASSIGN_CON ),
433 MAK_FUNC_0 ( ma_mphc_pre_sync_ho_cnf , MPHC_PRE_SYNC_HO_CON ),
434 MAK_FUNC_0 ( ma_mphc_empty_cnf , MPHC_SET_CIPHERING_CON ),
435 MAK_FUNC_0 ( ma_mphc_sync_ho_cnf , MPHC_SYNC_HO_CON ),
436 MAK_FUNC_0 ( ma_mphc_ta_fail_ind , MPHC_TA_FAIL_IND ),
437 MAK_FUNC_0 ( ma_mphc_handover_finished_ind , MPHC_HANDOVER_FINISHED ),
438 MAK_FUNC_N ( pei_not_supported , MPHC_CHANGE_FREQUENCY ),
439 MAK_FUNC_N ( pei_not_supported , MPHC_CHANNEL_MODE_MODIFY_REQ ),
440 MAK_FUNC_N ( pei_not_supported , MPHC_HANDOVER_FAIL_REQ ),
441 MAK_FUNC_N ( pei_not_supported , MPHC_SET_CIPHERING_REQ ),
442 MAK_FUNC_0 ( ma_mphc_meas_report_ind , MPHC_MEAS_REPORT ),
443 MAK_FUNC_N ( pei_not_supported , MPHC_UPDATE_BA_LIST ),
444 MAK_FUNC_N ( pei_not_supported , MPHC_NCELL_FB_SB_READ ),
445 MAK_FUNC_N ( pei_not_supported , MPHC_NCELL_SB_READ ),
446 MAK_FUNC_N ( pei_not_supported , MPHC_NCELL_BCCH_READ ),
447 MAK_FUNC_N ( pei_not_supported , MPHC_INIT_IDS_REQ ), /* 78 */
448 MAK_FUNC_N ( pei_not_supported , MPHC_INIT_IDS_CON ), /* 79 = is not used */
449 MAK_FUNC_N ( pei_not_supported , 0 ), /* 80 = used by L1 */
450 MAK_FUNC_N ( pei_not_supported , 0 ), /* 81 */
451 MAK_FUNC_N ( pei_not_supported , 0 ), /* 82 */
452 MAK_FUNC_N ( pei_not_supported , 0 ), /* 83 */
453 MAK_FUNC_N ( pei_not_supported , 0 ), /* 84 */
454 MAK_FUNC_N ( pei_not_supported , 0 ), /* 85 */
455 MAK_FUNC_N ( pei_not_supported , 0 ), /* 86 */
456 MAK_FUNC_N ( pei_not_supported , 0 ), /* 87 */
457 MAK_FUNC_N ( pei_not_supported , 0 ), /* 88 */
458 MAK_FUNC_N ( pei_not_supported , 0 ), /* 89 */
459 MAK_FUNC_N ( pei_not_supported , 0 ), /* 90 */
460 MAK_FUNC_N ( pei_not_supported , 0 ), /* 91 */
461 MAK_FUNC_N ( pei_not_supported , 0 ), /* 92 */
462 MAK_FUNC_N ( pei_not_supported , 0 ), /* 93 */
463 MAK_FUNC_N ( pei_not_supported , 0 ), /* 94 */
464 MAK_FUNC_N ( pei_not_supported , 0 ), /* 95 */
465 MAK_FUNC_N ( pei_not_supported , 0 ), /* 96 */
466 MAK_FUNC_N ( pei_not_supported , OML1_CLOSE_TCH_LOOP_REQ ), /* 97 */
467 MAK_FUNC_N ( pei_not_supported , OML1_OPEN_TCH_LOOP_REQ ),
468 MAK_FUNC_N ( pei_not_supported , OML1_START_DAI_TEST_REQ ),
469 MAK_FUNC_N ( pei_not_supported , OML1_STOP_DAI_TEST__REQ ),
470 MAK_FUNC_0 ( ma_mphc_empty_cnf , OML1_CLOSE_TCH_LOOP_CON ),
471 MAK_FUNC_0 ( ma_mphc_empty_cnf , OML1_OPEN_TCH_LOOP_CON ),
472 MAK_FUNC_0 ( ma_mphc_empty_cnf , OML1_START_DAI_TEST_CON ),
473 MAK_FUNC_0 ( ma_mphc_empty_cnf , OML1_STOP_DAI_TEST_CON ),
474 MAK_FUNC_0 ( ma_mphc_adc_ind , MPHC_ADC_IND ), /* will be send to CST directly */
475 MAK_FUNC_N ( pei_not_supported , TRACE_INFO ),
476 MAK_FUNC_N ( pei_not_supported , L1_STATS_REQ ),
477 MAK_FUNC_N ( pei_not_supported , L1_DUMMY_FOR_SIM ),
478 MAK_FUNC_0 ( ma_mphc_data_ind , PH_DATA_IND ),
479 MAK_FUNC_N ( pei_not_supported , MPHC_NETWORK_LOST_IND ), /* 110 = send to L1 */
480 MAK_FUNC_N ( pei_not_supported , 0 ), /* 111 = MMI_ADC_REQ */
481 MAK_FUNC_N ( pei_not_supported , 0 ), /* 112 = MMI_STOP_ADC_REQ */
482 MAK_FUNC_N ( pei_not_supported , 0 ), /* 113 = MMI_STOP_ADC_CON */
483 MAK_FUNC_N ( pei_not_supported , MPHC_INIT_L1_REQ ), /* 114 */
484 MAK_FUNC_N ( ma_mphc_init_l1_cnf , MPHC_INIT_L1_CON ), /* 115 */
485 MAK_FUNC_N ( pei_not_supported , 0 ), /* 116 */
486 MAK_FUNC_N ( pei_not_supported , 0 ), /* 117 */
487 MAK_FUNC_N ( pei_not_supported , 0 ), /* 118 */
488 MAK_FUNC_N ( pei_not_supported , 0 ), /* 119 = L1_TEST_HW_INFO */
489 MAK_FUNC_N ( pei_not_supported , 0 ), /* 120 */
490 MAK_FUNC_N ( pei_not_supported , 0 ), /* 121 */
491 MAK_FUNC_N ( pei_not_supported , MPHC_NCELL_LIST_SYNC_REQ ), /* 122 */
492 MAK_FUNC_N ( pei_not_supported , 0 ), /* 123 */
493 MAK_FUNC_N ( pei_not_supported , 0 ), /* 124 */
494 MAK_FUNC_N ( pei_not_supported , 0 ), /* 125 */
495 MAK_FUNC_N ( pei_not_supported , 0 ), /* 126 */
496 MAK_FUNC_N ( pei_not_supported , 0 ), /* 127 */
497 MAK_FUNC_N ( ma_mphc_stop_dedi_con , MPHC_STOP_DEDICATED_CON ) /* 128 */
498 };
499
500 LOCAL const T_FUNC mmi_table[] = {
501 MAK_FUNC_N ( pei_not_supported , 0 ),
502 MAK_FUNC_N ( pei_not_supported , 0 ),
503 MAK_FUNC_N ( pei_not_supported , 0 ),
504 MAK_FUNC_N ( pei_not_supported , 0 ),
505 MAK_FUNC_N ( pei_not_supported , 0 ),
506 MAK_FUNC_N ( pei_not_supported , 0 ),
507 MAK_FUNC_N ( pei_not_supported , 0 ),
508 MAK_FUNC_0 ( ma_mmi_cbch_req , MMI_CBCH_REQ ),
509 MAK_FUNC_N ( pei_not_supported , 0 ),
510 MAK_FUNC_N ( pei_not_supported , 0 ),
511 MAK_FUNC_N ( pei_not_supported , 0 ),
512 MAK_FUNC_0 ( ma_mmi_sat_cbch_dwnld_req, MMI_SAT_CBCH_DWNLD_REQ )
513 };
514
515 #ifdef FF_EM_MODE
516 LOCAL const T_FUNC em_ul_table[] = {
517 MAK_FUNC_N( pei_not_supported, 0 ), /* 0x00*/
518 MAK_FUNC_N( pei_not_supported, 0 ), /* 0x01*/
519 MAK_FUNC_N( pei_not_supported, 0 ), /* 0x02*/
520 MAK_FUNC_N( pei_not_supported, 0 ), /* 0x03*/
521 MAK_FUNC_N( pei_not_supported, 0 ), /* 0x04*/
522 MAK_FUNC_N( pei_not_supported, 0 ), /* 0x05*/
523 MAK_FUNC_N( pei_not_supported, 0 ), /* 0x06*/
524 MAK_FUNC_N( pei_not_supported, 0 ), /* 0x07*/
525 MAK_FUNC_N( pei_not_supported, 0 ), /* 0x08*/
526 MAK_FUNC_0( l1_em_l1_event_req, EM_L1_EVENT_REQ ), /* 0x09*/
527 MAK_FUNC_N( pei_not_supported, 0 ), /* 0x0A*/
528 MAK_FUNC_N( pei_not_supported, 0 ) /* 0x0B*/
529 };
530 #endif /* FF_EM_MODE */
531
532
533 /*
534 +--------------------------------------------------------------------+
535 | PROJECT : GSM-PS (6103) MODULE : ALR_PEI |
536 | STATE : code ROUTINE : pei_primitive |
537 +--------------------------------------------------------------------+
538
539 PURPOSE : Process protocol specific primitive.
540
541 */
542 LOCAL SHORT pei_primitive (void * ptr)
543 {
544 T_PRIM * prim = ptr;
545 /*
546 * | | |
547 * MPH PH MMI UPLINK
548 * | | |
549 * +---------v-----v------v---+
550 * | |
551 * | ALR |
552 * | |
553 * +------------^-------------+
554 * |
555 * MPHC DOWNLINK
556 * |
557 *
558 */
559
560 if (prim NEQ NULL)
561 {
562 ULONG opc = prim->custom.opc;
563 USHORT n;
564 const T_FUNC *table;
565
566 VSI_PPM_REC ((T_PRIM_HEADER *)prim, __FILE__, __LINE__);
567
568 #if defined TRACING
569 PTRACE_IN (opc);
570 #endif
571
572 switch (SAP_NR(opc))
573 {
574 case MPH_DL:
575 table = mph_table ;
576 n = TAB_SIZE(mph_table);
577 break;
578 case 0x0000:
579 case 0x0100:
580 /*
581 * use same table as PH_DATA_IND is the only prim with 0x0100
582 * and is at location 109
583 */
584 table = mphc_table; n = TAB_SIZE (mphc_table); break;
585 case 0x0E00: table = mmi_table ; n = TAB_SIZE (mmi_table); break;
586 #ifdef GPRS
587 case TB_UL : gprs_alr_get_table (&table, &n); break;
588 #endif /* GPRS */
589 #ifdef FF_EM_MODE
590 case EM_Ul: table = em_ul_table; n = TAB_SIZE (em_ul_table); break;
591 #endif /* FF_EM_MODE*/
592 default : table = NULL ; n = 0; break;
593 }
594
595 if (table NEQ NULL )
596 {
597
598 if (PRIM_NR(opc) < n)
599 {
600
601 table += PRIM_NR(opc);
602 #ifdef PALLOC_TRANSITION
603 P_SDU(prim) = table->soff ? (T_sdu*) (((char*)&prim->data) + table->soff) : 0;
604 #ifndef NO_COPY_ROUTING
605 P_LEN(prim) = table->size + sizeof (T_PRIM_HEADER);
606 #endif /* NO_COPY_ROUTING */
607 #endif /* PALLOC_TRANSITION */
608 JUMP (table->func) (P2D(prim));
609 }
610 else
611 {
612 pei_not_supported (P2D(prim));
613 }
614 return PEI_OK;
615 }
616
617 #ifdef GSM_ONLY
618 PFREE (P2D(prim))
619 return PEI_ERROR;
620 #else
621 if (opc & SYS_MASK)
622 vsi_c_primitive (VSI_CALLER prim);
623 else
624 {
625 PFREE (P2D(prim))
626 return PEI_ERROR;
627 }
628 #endif
629 }
630 return PEI_OK;
631 }
632
633
634 /*
635 +--------------------------------------------------------------------+
636 | PROJECT : GSM-PS (6103) MODULE : ALR_PEI |
637 | STATE : code ROUTINE : pei_not_supported |
638 +--------------------------------------------------------------------+
639
640 PURPOSE : An unsupported primitive is received.
641
642 */
643
644 static void pei_not_supported (void *data)
645 {
646 PFREE (data);
647 }
648
649
650 /*
651 +--------------------------------------------------------------------+
652 | PROJECT : GSM-PS (6103) MODULE : ALR_PEI |
653 | STATE : code ROUTINE : pei_init |
654 +--------------------------------------------------------------------+
655
656 PURPOSE : Initialize Protocol Stack Entity
657
658 */
659 LOCAL SHORT pei_init (T_HANDLE handle)
660 {
661 GET_INSTANCE_DATA;
662 UBYTE version;
663 pl_handle = handle;
664
665 #ifdef TI_PS_HCOMM_CHANGE
666 if (!cl_hcom_all_handles_open())
667 {
668 return PEI_ERROR;
669 }
670
671 #else /* for hCommHandles backward compatibility */
672 if (hCommPL < VSI_OK)
673 {
674 if ((hCommPL = vsi_c_open (VSI_CALLER PL_NAME)) < VSI_OK)
675 return PEI_ERROR;
676 }
677 if (hCommL1 < VSI_OK)
678 {
679 if ((hCommL1 = vsi_c_open (VSI_CALLER L1_NAME)) < VSI_OK)
680 return PEI_ERROR;
681 }
682 if (hCommDL < VSI_OK)
683 {
684 if ((hCommDL = vsi_c_open (VSI_CALLER DL_NAME)) < VSI_OK)
685 return PEI_ERROR;
686 }
687
688 if (hCommRR < VSI_OK)
689 {
690 if ((hCommRR = vsi_c_open (VSI_CALLER RR_NAME)) < VSI_OK)
691 return PEI_ERROR;
692 }
693
694 if (hCommCST < VSI_OK)
695 {
696 if ((hCommCST = vsi_c_open (VSI_CALLER CST_NAME)) < VSI_OK)
697 return PEI_ERROR;
698 }
699
700 if (hCommMMI < VSI_OK)
701 {
702 /*
703 * Open MMI (Layer 4)
704 */
705
706 if ((hCommMMI = vsi_c_open (VSI_CALLER ACI_NAME)) < VSI_OK)
707 return PEI_ERROR;
708 }
709 #endif
710
711 #ifdef GPRS
712
713 if (hCommGPL < VSI_OK)
714 {
715 if ((hCommGPL = vsi_c_open (VSI_CALLER GPL_NAME)) < VSI_OK)
716 return PEI_ERROR;
717 }
718
719 #endif /* #ifdef GPRS */
720
721 #if defined (_SIMULATION_)
722 ccd_init();
723 #endif /* _SIMULATION_ */
724
725 ma_init ();
726 cs_init ();
727 pch_init ();
728 dedi_init ();
729 nc_init ();
730 pch_init ();
731 rach_init ();
732 dedi_init ();
733 cb_init ();
734 tim_init();
735
736
737 #ifdef FF_EM_MODE
738 /*
739 initialise event flags
740 */
741 em_init_l1_event_trace();
742 /*
743 initialise alr semaphor for EM event tracing
744 */
745 em_l1_sem_init();
746 #endif /* FF_EM_MODE */
747
748
749 pcm_Init ();
750 pcm_ReadFile ((UBYTE *)EF_MSCAP_ID, SIZE_EF_MSCAP,
751 (UBYTE *)&alr_data->mscap, &version);
752
753
754 alr_trc_init ();
755
756 return PEI_OK;
757 }
758
759 /*
760 +--------------------------------------------------------------------+
761 | PROJECT : GSM-PS (6103) MODULE : ALR_PEI |
762 | STATE : code ROUTINE : pei_timeout |
763 +--------------------------------------------------------------------+
764
765 PURPOSE : Process timeout
766
767 */
768 LOCAL SHORT pei_timeout (USHORT index)
769 {
770 #if !defined(TIMER_TRACE)
771 TRACE_FUNCTION ("pei_timeout ()");
772 #endif /* !TIMER_TRACE */
773
774 /*
775 * Handle Timeouts
776 */
777 tim_exec_timeout (index);
778
779 return PEI_OK;
780 }
781
782 #ifdef _SIMULATION_
783 /*
784 +--------------------------------------------------------------------+
785 | PROJECT : GSM-PS (6103) MODULE : ALR_PEI |
786 | STATE : code ROUTINE : pei_exit |
787 +--------------------------------------------------------------------+
788
789 PURPOSE : Close Resources and terminate
790
791 */
792
793 LOCAL SHORT pei_exit (void)
794 {
795 /*
796 * clean up communication
797 */
798 #ifdef TI_PS_HCOMM_CHANGE
799 #else /* for hCommHandles backward compatibility */
800 vsi_c_close (VSI_CALLER hCommL1);
801 hCommL1 = VSI_ERROR;
802
803 vsi_c_close (VSI_CALLER hCommPL);
804 hCommPL = VSI_ERROR;
805
806 vsi_c_close (VSI_CALLER hCommDL);
807 hCommDL = VSI_ERROR;
808
809 vsi_c_close (VSI_CALLER hCommRR);
810 hCommRR = VSI_ERROR;
811
812 vsi_c_close (VSI_CALLER hCommMMI);
813 hCommMMI = VSI_ERROR;
814
815 vsi_c_close (VSI_CALLER hCommCST);
816 hCommCST = VSI_ERROR;
817 #endif
818
819 #ifdef GPRS
820
821 vsi_c_close (VSI_CALLER hCommGPL);
822 hCommGPL = VSI_ERROR;
823
824 #endif /* #ifdef GPRS */
825 alr_trc_exit ();
826
827 #ifdef FF_EM_MODE
828 em_l1_sem_exit();
829 #endif /* FF_EM_MODE */
830
831 #if defined (_SIMULATION_)
832 ccd_exit();
833 #endif /* _SIMULATION_ */
834
835 return PEI_OK;
836 }
837 #endif /* _SIMULATION_ */
838
839 /*
840 +--------------------------------------------------------------------+
841 | PROJECT : GSM-PS (6103) MODULE : ALR_PEI |
842 | STATE : code ROUTINE : pei_config |
843 +--------------------------------------------------------------------+
844
845 PURPOSE : Dynamic Configuration
846
847 */
848 #if !defined (NCONFIG)
849 LOCAL const KW_DATA kwtab[] = {
850 ALR_CONFIG, ID_CONFIG,
851 ALR_MON_COUNT_IDLE, ID_MON_COUNTER_IDLE,
852 ALR_MON_COUNT_DEDI, ID_MON_COUNTER_DEDI,
853 ALR_TRC_DATA_IND, ID_TRC_DATA_IND,
854 #if defined (_SIMULATION_)
855 ALR_STD, ID_STD,
856 ALR_MB_TESTING, ID_MB_TESTING,
857 #endif /* _SIMULATION_ */
858 ALR_RACH_FAILURE, ID_RACH_FAILURE,
859 ALR_EOTD, ID_EOTD,
860 "", 0
861 };
862
863 UBYTE v_mon_trc_data_ind = 0;
864 UBYTE v_cfg_rach_failure = 0;
865 #endif
866 /* Implements Measure#36 */
867 #ifndef NCONFIG
868 LOCAL SHORT pei_config (T_PEI_CONFIG inString)
869 {
870 GET_INSTANCE_DATA;
871 SHORT ret = PEI_OK;
872
873 #if !defined (NCONFIG)
874 {
875 char * s = inString;
876 SHORT valno;
877 SHORT keyno;
878 char * keyw;
879 char * val [10];
880
881 tok_init(s);
882
883 /*
884 * Parse next keyword and number of variables
885 */
886 while ((valno = tok_next(&keyw,val)) NEQ TOK_EOCS)
887 {
888 keyno = tok_key((KW_DATA *)kwtab,keyw);
889 switch (keyno)
890 {
891 case TOK_NOT_FOUND:
892 TRACE_ERROR ("[PEI_CONFIG]: Illegal Keyword");
893 ret = PEI_ERROR;
894 break;
895
896 case ID_CONFIG:
897 if (valno EQ 3)
898 {
899 alr_data->mmi = (UBYTE)atoi (val[0]);
900 alr_data->keypad = (UBYTE)atoi (val[1]);
901 alr_data->ext_display = (UBYTE)atoi (val[2]);
902 }
903 else
904 {
905 TRACE_ERROR ("[PEI_CONFIG]: Wrong Number of Parameters");
906 ret = PEI_ERROR;
907 }
908 break;
909 case ID_RACH_FAILURE:
910 v_cfg_rach_failure = !v_cfg_rach_failure;
911 TRACE_EVENT_P1("rach failure %d", v_cfg_rach_failure);
912 break;
913 #if !defined (NTRACE)
914 case ID_MON_COUNTER_IDLE:
915 if (valno EQ 1)
916 v_mon_counter_idle = (UBYTE)(atoi(val[0]) & 1);
917 break;
918
919 case ID_MON_COUNTER_DEDI:
920 if (valno EQ 1)
921 v_mon_counter_dedi = (UBYTE)(atoi(val[0]) & 1);
922 break;
923 #endif /* !NTRACE */
924
925 #if defined (_SIMULATION_)
926 case ID_STD:
927 if (valno EQ 1)
928 {
929 std = (UBYTE)atoi (val[0]);
930 pcm_Init ();
931 {
932 rr_csf_check_rfcap (TRUE);
933 }
934 }
935 else
936 {
937 TRACE_ERROR ("[PEI_CONFIG]: Wrong Number of Parameters");
938 ret = PEI_ERROR;
939 }
940 break;
941 case ID_MB_TESTING:
942 if (valno EQ 1)
943 {
944 alr_data->mb_testing = (UBYTE)atoi (val[0]);
945 }
946 else
947 {
948 TRACE_ERROR ("[PEI_CONFIG]: Wrong Number of Parameters");
949 ret = PEI_ERROR;
950 }
951 break;
952 #endif /* _SIMULATION_ */
953
954 #if !defined (NTRACE)
955 case ID_TRC_DATA_IND:
956 if (valno EQ 1)
957 v_mon_trc_data_ind = (UBYTE)atoi(val[0]);
958 else
959 v_mon_trc_data_ind = ID_TRC_DATA_IND_INIT2;
960 SYST_TRACE_P((SYST,"[PEI_CONFIG] TRC_DATA_IND %02x", v_mon_trc_data_ind));
961 break;
962 #endif /* !NTRACE */
963 case ID_EOTD:
964 v_eotd = 1;
965 break;
966 default:
967 ret = PEI_ERROR;
968 SYST_TRACE_P((0,0xffff,"[PEI_CONFIG] \"%s\" unknown ID %u", s, keyno));
969 break;
970 }
971 }
972 }
973 #endif /* end !defined (NCONFIG) */
974 return ret;
975 }
976 #endif /* NCONFIG */
977
978 #if !defined(WIN32)
979 /*
980 +--------------------------------------------------------------------+
981 | PROJECT : GSM-PS (6103) MODULE : ALR_PEI |
982 | STATE : code ROUTINE : l1_version |
983 +--------------------------------------------------------------------+
984
985 PURPOSE : maps the function alr_version
986
987 */
988 GLOBAL CHAR* l1_version (void)
989 {
990 return alr_version();
991 }
992 #endif /* !WIN32 */
993
994 /*
995 +--------------------------------------------------------------------+
996 | PROJECT : GSM-PS (6103) MODULE : ALR_PEI |
997 | STATE : code ROUTINE : pl_pei_config |
998 +--------------------------------------------------------------------+
999
1000 PURPOSE : Dynamic Configuration
1001
1002 */
1003 /* Implements Measure#36 */
1004 #ifndef NCONFIG
1005 GLOBAL SHORT pl_pei_config (char * inString, char * dummy)
1006 {
1007
1008 pei_config (inString);
1009 return PEI_OK;
1010 }
1011 #endif /* NCONFIG */
1012
1013 /*
1014 +--------------------------------------------------------------------+
1015 | PROJECT : GSM-PS (6103) MODULE : ALR_PEI |
1016 | STATE : code ROUTINE : pei_monitor |
1017 +--------------------------------------------------------------------+
1018
1019 PURPOSE : Monitoring of physical Parameters
1020
1021 */
1022
1023 LOCAL SHORT pei_monitor (void ** monitor)
1024 {
1025 #if defined (_TMS470)
1026 static char buf[60];
1027
1028 USHORT build, jtag, rev, hw;
1029
1030 /*
1031 * Retrieve hardware info and build from library
1032 */
1033 hw = 0;
1034
1035 build = IQ_GetBuild();
1036 jtag = IQ_GetJtagId();
1037 rev = IQ_GetRevision();
1038
1039 sprintf (buf, "HW=%04x Build=%04X, jtag=%04X, rev=%04X", hw, build,jtag, rev);
1040 TRACE_EVENT (buf);
1041
1042 alr_mon.version = buf;
1043 #else
1044 /* Implements Measure#32 */
1045 #endif /* _TMS470 */
1046
1047 *monitor = &alr_mon;
1048
1049 return PEI_OK;
1050 }
1051
1052 /*
1053 +--------------------------------------------------------------------+
1054 | PROJECT : GSM-PS (6103) MODULE : ALR_PEI |
1055 | STATE : code ROUTINE : pei_create |
1056 +--------------------------------------------------------------------+
1057
1058 PURPOSE : Create the Protocol Stack Entity
1059
1060 */
1061 GLOBAL SHORT pl_pei_create (T_PEI_INFO **info)
1062 {
1063 static const T_PEI_INFO pei_info =
1064 {
1065 "PL",
1066 {
1067 pei_init,
1068 #ifdef _SIMULATION_
1069 pei_exit,
1070 #else
1071 NULL,
1072 #endif
1073 pei_primitive,
1074 pei_timeout, /* timer expiry function */
1075 NULL, /* no signal function */
1076 NULL, /* no run function */
1077 /* Implements Measure#36 */
1078 #ifdef NCONFIG
1079 NULL, /* no pei_config function */
1080 #else /* not NCONFIG */
1081 pei_config,
1082 #endif /* NCONFIG */
1083 pei_monitor
1084 },
1085 #if defined (GPRS)
1086 2436, /* Stacksize */
1087 #else
1088 #if defined (FAX_AND_DATA)
1089 1436, /* Stacksize */
1090 #else
1091 1066, /* Stacksize */
1092 #endif
1093 #endif
1094 10, /* Queue entries */
1095 225, /* Priority */
1096 NUM_OF_ALR_TIMERS, /* number of timers */
1097 /* flags */
1098 #ifdef _TARGET_
1099 #ifdef GPRS
1100 PASSIVE_BODY|COPY_BY_REF|TRC_NO_SUSPEND|PRIM_NO_SUSPEND
1101 #else
1102 PASSIVE_BODY|COPY_BY_REF|TRC_NO_SUSPEND|PRIM_NO_SUSPEND
1103 #endif
1104 #else
1105 PASSIVE_BODY|COPY_BY_REF
1106 #endif
1107
1108 };
1109
1110 TRACE_FUNCTION ("pl_pei_create()");
1111
1112 /*
1113 * close resources if open
1114 */
1115 #ifdef _SIMULATION_
1116 if (first_access)
1117 first_access = FALSE;
1118 else
1119 pei_exit ();
1120 #endif
1121 /*
1122 * Export startup configuration data
1123 */
1124 *info = (T_PEI_INFO *)&pei_info;
1125
1126 return PEI_OK;
1127 }
1128
1129 #endif