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