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