comparison src/aci2/alr/alr_test/alr_dedicated_constraints.cpp @ 3:93999a60b835

src/aci2, src/condat2: import of g23m/condat source pieces from TCS211
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 26 Sep 2016 00:29:36 +0000
parents
children
comparison
equal deleted inserted replaced
2:c41a534f33c6 3:93999a60b835
1 /*
2 +------------------------------------------------------------------------------
3 | File: alr_dedicated_constraints.cpp
4 +------------------------------------------------------------------------------
5 | Copyright 2003 Texas Instruments
6 | All rights reserved.
7 |
8 | This file is confidential and a trade secret of Texas Instruments.
9 | The receipt of or possession of this file does not convey
10 | any rights to reproduce or disclose its contents or to
11 | manufacture, use, or sell anything it may describe, in
12 | whole, or in part, without the specific written consent of
13 | Texas Instruments.
14 +------------------------------------------------------------------------------
15 | Purpose: Contains test constraints for alr
16 |
17 +------------------------------------------------------------------------------
18 */
19 #include "alr_constraints.h"
20
21 const U16 CHLIST_14_23_69_115_FFFF_elements[5] = {
22 ARFCN_14,
23 ARFCN_23,
24 ARFCN_69,
25 ARFCN_115,
26 NOT_PRESENT_16BIT
27 };
28 T_ARRAY<U16> CHLIST_14_23_69_115_FFFF(CHLIST_14_23_69_115_FFFF_elements, SKIP_TO_END);
29
30 T_start starting_time()
31 {
32 T_start pstruct;
33 pstruct->v_start = 1;
34 pstruct->t1 = 11;
35 pstruct->t2 = 22;
36 pstruct->t3 = 33;
37 return pstruct;
38 }
39 T_starting_time s_time_mphc()
40 {
41 T_starting_time pstruct;
42 pstruct->start_time_present = 1;
43 pstruct->start_time.t1=11;
44 pstruct->start_time.t2=22;
45 pstruct->start_time.t3=33;
46 return pstruct;
47 }
48 T_starting_time s_time_t1()
49 {
50 T_starting_time pstruct;
51 pstruct->start_time_present = 1;
52 pstruct->start_time.t1 = 11;
53 pstruct->start_time.t2 = 22;
54 pstruct->start_time.t3 = 33;
55 return pstruct;
56 }
57 T_ch_type ch_type_tch2()
58 {
59 T_ch_type pstruct;
60 pstruct->ch = 0x01;
61 pstruct->tn = 1;
62 pstruct->tsc = 0;
63 pstruct->h = 1;
64 pstruct->arfcn = 0;
65 pstruct->maio = 1;
66 pstruct->hsn = 0;
67 pstruct->ma = CHLIST_14_23_69_115_FFFF;
68 return pstruct;
69 }
70 T_ch_type ch_type_tch3()
71 {
72 T_ch_type pstruct;
73 pstruct->ch = 0x01;
74 pstruct->tn = 3;
75 pstruct->tsc = 0;
76 pstruct->h = 1;
77 pstruct->arfcn = 0;
78 pstruct->maio = 1;
79 pstruct->hsn = 0;
80 pstruct->ma = CHLIST_14_23_69_115_FFFF;
81 return pstruct;
82 }
83 T_ho_param ho_param()
84 {
85 T_ho_param pstruct;
86 pstruct->ho_ref = NCI_TA_OUT_OF_RANGE_OK;
87 pstruct->ho_pow = 0;
88 pstruct->ho_acc_type = 0;
89 pstruct->ho_nci = 0;
90 return pstruct;
91 }
92 T_ho_param ho_param_1()
93 {
94 T_ho_param pstruct;
95 pstruct->ho_ref = HO_REF;
96 pstruct->ho_pow = HO_POW;
97 pstruct->ho_acc_type = 0;
98 pstruct->ho_nci = 0;
99 return pstruct;
100 }
101 T_tr_para tr_param()
102 {
103 T_tr_para pstruct;
104 pstruct->power = 10;
105 pstruct->dtx = DTX_NOT_USED;
106 pstruct->rlt = 5;
107 pstruct->tav = 30;
108 pstruct->pwrc = PWRC_NOT_SET;
109 pstruct->mode = MODE_SPEECH_VER1;
110 return pstruct;
111 }
112 T_ciph ciph_param()
113 {
114 const U8 CIPH_PARAM_KC[8] = {
115 0,1,2,3,4,5,6,7
116 };
117
118 T_ciph pstruct;
119 pstruct->stat = STAT_CIPH_OFF;
120 pstruct->algo = ALGO_A5_1;
121 pstruct->kc = CIPH_PARAM_KC;
122 return pstruct;
123 }
124 T_channel_desc channel_desc_2_tch()
125 {
126 T_channel_desc pstruct;
127 pstruct->chan_sel.h = 1;
128 pstruct->chan_sel.rf_channel.maio = 1;
129 pstruct->chan_sel.rf_channel.hsn = 0;
130 pstruct->channel_type = 0x01;
131 pstruct->sub_channel = 0;
132 pstruct->timeslot_no = 1;
133 pstruct->tsc = 0;
134 return pstruct;
135 }
136 T_channel_desc channel_desc_3_tch()
137 {
138 T_channel_desc pstruct;
139 pstruct->chan_sel.h = 1;
140 pstruct->chan_sel.rf_channel.maio = 1;
141 pstruct->chan_sel.rf_channel.hsn = 0;
142 pstruct->channel_type = 0x01;
143 pstruct->sub_channel = 0;
144 pstruct->timeslot_no = 3;
145 pstruct->tsc = 0;
146 return pstruct;
147 }
148 T_cell_description cell_description_2()
149 {
150 T_cell_description pstruct;
151 pstruct->ncc = 0;
152 pstruct->bcc = 1;
153 pstruct->bcch_carrier = 14;
154 return pstruct;
155 }
156 T_channel_desc channel_desc_ia()
157 {
158 T_channel_desc pstruct;
159 pstruct->chan_sel.h = 1;
160 pstruct->chan_sel.rf_channel.maio = 0;
161 pstruct->chan_sel.rf_channel.hsn = 1;
162 pstruct->channel_type = CH_TCH_F;
163 pstruct->sub_channel = 0;
164 pstruct->timeslot_no = 1;
165 pstruct->tsc = 5;
166 return pstruct;
167 }
168 T_amr_conf s_amr_conf_4_icmi()
169 {
170 T_amr_conf pstruct;
171 pstruct->nscb = NSCB;
172 pstruct->icmi = ICMI_S;
173 pstruct->st_mode = ST_MODE_1;
174 pstruct->acs = ACS_4;
175 pstruct->v_cod_prop = V_COD_PROP;
176 pstruct->c_cod_prop = C_COD_PROP_4;
177 pstruct->cod_prop[0].codec_hyst = 0x01;
178 pstruct->cod_prop[0].codec_thr = 0x01;
179 pstruct->cod_prop[1].codec_hyst = 0x03;
180 pstruct->cod_prop[1].codec_thr = 0x03;
181 pstruct->cod_prop[2].codec_hyst = 0x05;
182 pstruct->cod_prop[2].codec_thr = 0x05;
183 // = sa_cod_prop_4();
184 return pstruct;
185 }
186 T_amr_configuration s_amr_configuration()
187 {
188 T_amr_configuration pstruct;
189 pstruct->noise_suppression_control_bit = NSCB;
190 pstruct->initial_codec_mode_indicator = ICMI_S;
191 pstruct->initial_codec_mode = ST_MODE_1;
192 pstruct->active_codec_set = ACS_4;
193 pstruct->threshold [0] = 0x01;
194 pstruct->threshold [1] = 0x03;
195 pstruct->threshold [2] = 0x05;
196 pstruct->hysteresis[0] = 0x01;
197 pstruct->hysteresis[1] = 0x03;
198 pstruct->hysteresis[2] = 0x05;
199 return pstruct;
200 }
201 T_frequency_list freq_list_ia()
202 {
203 const U16 FREQ_LIST_IA_FREQ_elements[5] = {
204 26, 34, 42, 52, 59
205 };
206 T_ARRAY<U16> FREQ_LIST_IA_FREQ(FREQ_LIST_IA_FREQ_elements, SKIP_TO_END);
207
208 T_frequency_list pstruct;
209 pstruct->rf_chan_cnt = 5;
210 pstruct->rf_chan_no.radio_freq = FREQ_LIST_IA_FREQ;
211 return pstruct;
212 }
213 T_channel_desc channel_desc_fr()
214 {
215 T_channel_desc pstruct;
216 pstruct->chan_sel.h = 1;
217 pstruct->chan_sel.rf_channel.maio = 1;
218 pstruct->chan_sel.rf_channel.hsn = 1;
219 pstruct->channel_type = CH_TCH_F;
220 pstruct->sub_channel = 0;
221 pstruct->timeslot_no = 1;
222 pstruct->tsc = 5;
223 return pstruct;
224 }
225 T_frequency_list freq_list_fr()
226 {
227 const U16 CHLIST_10_52_59_73_108_114_elements[6] = {
228 ARFCN_10,
229 ARFCN_52,
230 ARFCN_59,
231 ARFCN_73,
232 ARFCN_108,
233 ARFCN_114
234 };
235 T_ARRAY<U16> CHLIST_10_52_59_73_108_114(CHLIST_10_52_59_73_108_114_elements, SKIP_TO_END);
236
237 T_frequency_list pstruct;
238 pstruct->rf_chan_cnt = 6;
239 pstruct->rf_chan_no.radio_freq = CHLIST_10_52_59_73_108_114;
240 return pstruct;
241 }
242
243 T_PRIMITIVE_UNION mph_dedicated_req_1()
244 {
245 const U16 CHLIST_0_elements[1] = {
246 0x00
247 };
248 T_ARRAY<U16> CHLIST_0(CHLIST_0_elements, SKIP_TO_END);
249 T_MPH_DEDICATED_REQ prim;
250 prim->mod = MODE_IMM_ASSIGN;
251 prim->start = starting_time();
252 // prim->ch_type = ch_type_hop();
253 prim->ch_type.ch = CH_SDCCH_8_0;
254 prim->ch_type.tn = 0;
255 prim->ch_type.tsc = 0;
256 prim->ch_type.h = 1;
257 prim->ch_type.arfcn = 0;
258 prim->ch_type.maio = 1;
259 prim->ch_type.hsn = 0;
260 prim->ch_type.ma = CHLIST_14_23_69_115_FFFF;
261 // prim->ch_type2. = ch_type2();
262 prim->ch_type2.ch = 0x00;
263 prim->ch_type2.tn = 3;
264 prim->ch_type2.tsc = 6;
265 prim->ch_type2.h = 0;
266 prim->ch_type2.arfcn = 0;
267 prim->ch_type2.maio = 0;
268 prim->ch_type2.hsn = 0;
269 prim->ch_type2.ma = CHLIST_0;
270 prim->arfcn = ARFCN_23;
271 prim->bsic = BSIC_1;
272 prim->ho_param = ho_param();
273 prim->tr_para = tr_param();
274 prim->ciph = ciph_param();
275 prim->amr_conf._skip;
276 return prim;
277 }
278 T_PRIMITIVE_UNION mph_dedicated_req_2()
279 {
280 T_MPH_DEDICATED_REQ prim;
281 prim->mod = MODE_ASYNC_HANDOVER;
282 prim->start._skip;
283 prim->ch_type = ch_type_tch2();
284 prim->ch_type2._skip;
285 prim->arfcn = ARFCN_14;
286 prim->bsic = BSIC_1;
287 prim->ho_param = ho_param_1();
288 prim->tr_para = tr_param();
289 prim->ciph = ciph_param();
290 prim->amr_conf._skip;
291 return prim;
292 }
293 T_PRIMITIVE_UNION mph_dedicated_req_3()
294 {
295 const U16 CHLIST_26_34_42_52_59_FFFF_elements[6] = {
296 ARFCN_26,
297 ARFCN_34,
298 ARFCN_42,
299 ARFCN_52,
300 ARFCN_59,
301 NOT_PRESENT_16BIT
302 };
303 T_ARRAY<U16> CHLIST_26_34_42_52_59_FFFF(CHLIST_26_34_42_52_59_FFFF_elements, SKIP_TO_END);
304
305 T_MPH_DEDICATED_REQ prim;
306 prim->mod = MODE_IMM_ASSIGN;
307 prim->start.v_start=0;
308 prim->start.t1._skip;
309 prim->start.t2._skip;
310 prim->start.t3._skip;
311 // prim->ch_type. = ch_type_imm_ass();
312 prim->ch_type.ch = CH_TCH_F;
313 prim->ch_type.tn = 1;
314 prim->ch_type.tsc = 5;
315 prim->ch_type.h = H_FREQ;
316 prim->ch_type.arfcn = 0;
317 prim->ch_type.maio = 0;
318 prim->ch_type.hsn = 1;
319 prim->ch_type.ma = CHLIST_26_34_42_52_59_FFFF;
320 prim->ch_type2._skip;
321 prim->arfcn = ARFCN_14;
322 prim->bsic = BSIC_1;
323 prim->ho_param = ho_param();
324 prim->tr_para = tr_param();
325 prim->ciph = ciph_param();
326 prim->amr_conf._skip;
327 return prim;
328 }
329 T_PRIMITIVE_UNION mph_dedicated_req_4()
330 {
331 const U16 CHLIST_73_74_75_76_FFFF_elements[5] = {
332 ARFCN_73,
333 ARFCN_74,
334 ARFCN_75,
335 ARFCN_76,
336 NOT_PRESENT_16BIT
337 };
338 T_ARRAY<U16> CHLIST_73_74_75_76_FFFF(CHLIST_73_74_75_76_FFFF_elements, SKIP_TO_END);
339 const U16 CHLIST_46_52_59_66_73_74_FFFF_elements[7] = {
340 ARFCN_46,
341 ARFCN_52,
342 ARFCN_59,
343 ARFCN_66,
344 ARFCN_73,
345 ARFCN_74,
346 NOT_PRESENT_16BIT
347 };
348 T_ARRAY<U16> CHLIST_46_52_59_66_73_74_FFFF(CHLIST_46_52_59_66_73_74_FFFF_elements, SKIP_TO_END);
349
350 T_MPH_DEDICATED_REQ prim;
351 prim->mod = MODE_CHAN_ASSIGN;
352 prim->start.v_start = 1;
353 prim->start.t1 = 45;
354 prim->start.t2 = 22;
355 prim->start.t3 = 33;
356 prim->ch_type.ch = CH_TCH_F;
357 prim->ch_type.tn = 0;
358 prim->ch_type.tsc = 5;
359 prim->ch_type.h = H_FREQ;
360 prim->ch_type.arfcn = 0;
361 prim->ch_type.maio = 0;
362 prim->ch_type.hsn = 1;
363 prim->ch_type.ma = CHLIST_73_74_75_76_FFFF;
364 /* before time */
365 prim->ch_type2.ch = CH_TCH_F;
366 prim->ch_type2.tn = 0;
367 prim->ch_type2.tsc = 5;
368 prim->ch_type2.h = H_FREQ;
369 prim->ch_type2.arfcn = 0;
370 prim->ch_type2.maio = 1;
371 prim->ch_type2.hsn = 7;
372 prim->ch_type2.ma = CHLIST_46_52_59_66_73_74_FFFF;
373 prim->arfcn = ARFCN_14;
374 prim->bsic = BSIC_1;
375 prim->ho_param._skip;
376 prim->tr_para = tr_param();
377 prim->ciph = ciph_param();
378 prim->amr_conf._skip;
379 return prim;
380 }
381 T_PRIMITIVE_UNION mph_dedicated_req_5()
382 {
383 T_MPH_DEDICATED_REQ prim;
384 prim->mod = MODE_ASYNC_HANDOVER;
385 prim->start = starting_time();
386 prim->ch_type = ch_type_tch2();
387 prim->ch_type2 = ch_type_tch3();
388 prim->arfcn = ARFCN_14;
389 prim->bsic = BSIC_1;
390 prim->ho_param = ho_param_1();
391 prim->tr_para = tr_param();
392 prim->ciph = ciph_param();
393 prim->amr_conf._skip;
394 return prim;
395 }
396 T_PRIMITIVE_UNION mph_dedicated_req_6(CHAR variant)
397 {
398 T_MPH_DEDICATED_REQ prim;
399 prim->mod = MODE_ASYNC_HANDOVER;
400 prim->start = starting_time();
401 prim->ch_type = ch_type_tch2();
402 prim->ch_type2 = ch_type_tch3();
403 if (variant == 'A') prim->arfcn = ARFCN_23;
404 if (variant == 'B') prim->arfcn = ARFCN_23;
405 if (variant == 'C') prim->arfcn = ARFCN_14;
406 if (variant == 'D') prim->arfcn = ARFCN_1;
407 if (variant == 'E') prim->arfcn = ARFCN_124;
408 prim->bsic = BSIC_1;
409 prim->ho_param = ho_param_1();
410 prim->tr_para = tr_param();
411 prim->ciph = ciph_param();
412 if (variant == 'A') prim->amr_conf._skip;
413 if (variant == 'B') prim->amr_conf = s_amr_conf_4_icmi();
414 if (variant == 'C') prim->amr_conf._skip;
415 if (variant == 'D') prim->amr_conf._skip;
416 if (variant == 'E') prim->amr_conf._skip;
417 return prim;
418 }
419
420
421
422 T_PRIMITIVE_UNION mphc_immed_assign_req_1()
423 {
424 T_MPHC_IMMED_ASSIGN_REQ prim;
425 //prim->channel_desc. = channel_desc_1();
426 prim->channel_desc.chan_sel.h = 1;
427 prim->channel_desc.chan_sel.rf_channel.maio = 1;
428 prim->channel_desc.chan_sel.rf_channel.hsn = 0;
429 prim->channel_desc.channel_type = 0x04;
430 prim->channel_desc.sub_channel = 0;
431 prim->channel_desc.timeslot_no = 0;
432 prim->channel_desc.tsc = 0;
433
434 prim->timing_advance = TIMING_ADVANCE;
435 prim->frequency_list = freq_list();
436 prim->starting_time = s_time_mphc();
437 prim->frequency_list_bef_sti._skip;
438 prim->maio_bef_sti._skip;
439 prim->dtx_allowed._skip;
440 prim->bcch_allocation._skip;
441 prim->ba_id._skip;
442 prim->pwrc._skip;
443 return prim;
444 }
445 T_PRIMITIVE_UNION mphc_immed_assign_req_2()
446 {
447 T_MPHC_IMMED_ASSIGN_REQ prim;
448 prim->channel_desc = channel_desc_ia();
449 prim->timing_advance = TIMING_ADVANCE;
450 prim->frequency_list = freq_list_ia();
451 prim->starting_time.start_time_present = 0;
452 prim->starting_time.start_time._skip;
453 prim->frequency_list_bef_sti._skip;
454 prim->maio_bef_sti._skip;
455 prim->dtx_allowed._skip;
456 prim->bcch_allocation._skip;
457 prim->ba_id._skip;
458 prim->pwrc._skip;
459 return prim;
460 }
461
462 T_PRIMITIVE_UNION mphc_immed_assign_con_1()
463 {
464 T_MPHC_IMMED_ASSIGN_CON prim;
465 prim->param._skip;
466 return prim;
467 }
468
469 T_PRIMITIVE_UNION mph_dedicated_cnf_1(CHAR success)
470 {
471 T_MPH_DEDICATED_CNF prim;
472 prim->dedi_res = success;
473 return prim;
474 }
475
476 T_PRIMITIVE_UNION mphc_async_ho_req_1(U8 ho_type)
477 {
478 T_MPHC_ASYNC_HO_REQ prim;
479 //prim->handover_command. = async_ho_cmd();
480 prim->handover_command.cell_description = cell_description_2();
481 prim->handover_command.channel_desc_1 = channel_desc_2_tch();
482 prim->handover_command.channel_mode_1 = MODE_SPEECH_VER1;
483 prim->handover_command.starting_time._skip;
484 prim->handover_command.ho_acc = HO_REF;
485 prim->handover_command.txpwr = HO_POW;
486 prim->handover_command.report_time_diff._skip;
487 prim->handover_command.frequency_list = freq_list();
488 prim->handover_command.channel_desc_2._skip;
489 prim->handover_command.channel_mode_2._skip;
490 prim->handover_command.frequency_list_bef_sti._skip;
491 prim->handover_command.channel_desc_1_bef_sti._skip;
492 prim->handover_command.channel_desc_2_bef_sti._skip;
493 prim->handover_command.cipher_mode._skip;
494 prim->handover_command.a5_algorithm._skip;
495
496 prim->fn_offset._skip;
497 prim->time_alignmnt._skip;
498 prim->cipher_key._skip;
499 prim->amr_configuration._skip;
500 #ifdef FF_EGPRS
501 prim->handover_type = ho_type;
502 #endif // FF_EGPRS
503 return prim;
504 }
505 T_PRIMITIVE_UNION mphc_async_ho_req_2()
506 {
507 T_MPHC_ASYNC_HO_REQ prim;
508 // prim->handover_command. = async_ho_cmd_2();
509 prim->handover_command.cell_description = cell_description_2();
510 prim->handover_command.channel_desc_1 = channel_desc_2_tch();
511 prim->handover_command.channel_mode_1 = MODE_SPEECH_VER1;
512 prim->handover_command.starting_time = s_time_mphc();
513 prim->handover_command.ho_acc = HO_REF;
514 prim->handover_command.txpwr = HO_POW;
515 prim->handover_command.report_time_diff._skip;
516 prim->handover_command.frequency_list = freq_list();
517 prim->handover_command.channel_desc_2._skip;
518 prim->handover_command.channel_mode_2._skip;
519 prim->handover_command.frequency_list_bef_sti = freq_list();
520 prim->handover_command.channel_desc_1_bef_sti = channel_desc_3_tch();
521 prim->handover_command.channel_desc_2_bef_sti._skip;
522 prim->handover_command.cipher_mode._skip;
523 prim->handover_command.a5_algorithm._skip;
524
525 prim->fn_offset._skip;
526 prim->time_alignmnt._skip;
527 prim->cipher_key._skip;
528 prim->amr_configuration._skip;
529 #ifdef FF_EGPRS
530 prim->handover_type = HOT_REGULAR;
531 #endif // FF_EGPRS
532 return prim;
533 }
534 T_PRIMITIVE_UNION mphc_async_ho_req_3(CHAR variant)
535 {
536 T_MPHC_ASYNC_HO_REQ prim;
537 //prim->handover_command. = async_ho_cmd_3();
538 prim->handover_command.cell_description.ncc = 0;
539 prim->handover_command.cell_description.bcc = 1;
540 if (variant == 'A' || variant == 'B')
541 prim->handover_command.cell_description.bcch_carrier = ARFCN_23;
542 else if (variant == 'E')
543 prim->handover_command.cell_description.bcch_carrier = ARFCN_124;
544 else if (variant == 'D')
545 prim->handover_command.cell_description.bcch_carrier = ARFCN_1;
546 else
547 prim->handover_command.cell_description.bcch_carrier = ARFCN_14;
548 prim->handover_command.channel_desc_1 = channel_desc_2_tch();
549 prim->handover_command.channel_mode_1 = MODE_SPEECH_VER1;
550 prim->handover_command.starting_time = s_time_mphc();
551 prim->handover_command.ho_acc = HO_REF;
552 prim->handover_command.txpwr = HO_POW;
553 prim->handover_command.report_time_diff._skip;
554 prim->handover_command.frequency_list = freq_list();
555 prim->handover_command.channel_desc_2._skip;
556 prim->handover_command.channel_mode_2._skip;
557 prim->handover_command.frequency_list_bef_sti = freq_list();
558 prim->handover_command.channel_desc_1_bef_sti = channel_desc_3_tch();
559 prim->handover_command.channel_desc_2_bef_sti._skip;
560 prim->handover_command.cipher_mode._skip;
561 prim->handover_command.a5_algorithm._skip;
562
563 prim->fn_offset._skip;
564 prim->time_alignmnt._skip;
565 prim->cipher_key._skip;
566 if (variant == 'A') prim->amr_configuration._skip;
567 if (variant == 'B') prim->amr_configuration = s_amr_configuration();
568 #ifdef FF_EGPRS
569 if (variant == 'D')
570 prim->handover_type = HOT_BLIND;
571 else
572 prim->handover_type = HOT_REGULAR;
573 #endif // FF_EGPRS
574 return prim;
575 }
576
577
578
579
580 T_PRIMITIVE_UNION mph_freq_redef_req_1()
581 {
582 const U16 CHLIST_10_52_59_73_108_114_FFFF_elements[7] = {
583 ARFCN_10,
584 ARFCN_52,
585 ARFCN_59,
586 ARFCN_73,
587 ARFCN_108,
588 ARFCN_114,
589 NOT_PRESENT_16BIT
590 };
591 T_ARRAY<U16> CHLIST_10_52_59_73_108_114_FFFF(CHLIST_10_52_59_73_108_114_FFFF_elements, SKIP_TO_END);
592
593 T_MPH_FREQ_REDEF_REQ prim;
594 prim->start.v_start = 1;
595 prim->start.t1 = 11;
596 prim->start.t2 = 22;
597 prim->start.t3 = 33;
598 // prim->ch_type. = ch_type_freq_redef();
599 prim->ch_type.ch = CH_TCH_F;
600 prim->ch_type.tn = 1;
601 prim->ch_type.tsc = 5;
602 prim->ch_type.h = H_FREQ;
603 prim->ch_type.arfcn = 0;
604 prim->ch_type.maio = 1;
605 prim->ch_type.hsn = 1;
606 prim->ch_type.ma = CHLIST_10_52_59_73_108_114_FFFF;
607 return prim;
608 }
609 T_PRIMITIVE_UNION mph_freq_redef_req_2()
610 {
611 T_MPH_FREQ_REDEF_REQ prim;
612 prim->start = starting_time();
613 //prim->ch_type. = ch_type_sdcch4();
614 prim->ch_type.ch = CH_SDCCH_8_0;
615 prim->ch_type.tn = 4;
616 prim->ch_type.tsc = 0;
617 prim->ch_type.h = 1;
618 prim->ch_type.arfcn = 0;
619 prim->ch_type.maio = 1;
620 prim->ch_type.hsn = 0;
621 prim->ch_type.ma = CHLIST_14_23_69_115_FFFF;
622 return prim;
623 }
624
625
626 T_PRIMITIVE_UNION mphc_change_frequency_1()
627 {
628 T_MPHC_CHANGE_FREQUENCY prim;
629 prim->channel_desc = channel_desc_fr();
630 prim->frequency_list = freq_list_fr();
631 prim->starting_time = s_time_t1();
632 return prim;
633 }
634 T_PRIMITIVE_UNION mphc_change_frequency_2()
635 {
636 T_MPHC_CHANGE_FREQUENCY prim;
637 //prim->channel_desc. = channel_desc_4();
638 prim->channel_desc.chan_sel.h = 1;
639 prim->channel_desc.chan_sel.rf_channel.maio = 1;
640 prim->channel_desc.chan_sel.rf_channel.hsn = 0;
641 prim->channel_desc.channel_type = 0x04;
642 prim->channel_desc.sub_channel = 0;
643 prim->channel_desc.timeslot_no = 4;
644 prim->channel_desc.tsc = 0;
645
646 prim->frequency_list = freq_list();
647 prim->starting_time = s_time_mphc();
648 return prim;
649 }
650
651
652 T_PRIMITIVE_UNION mphc_channel_assign_req_1()
653 {
654
655 T_MPHC_CHANNEL_ASSIGN_REQ prim;
656 prim->channel_desc_1.chan_sel.h = 1;
657 prim->channel_desc_1.chan_sel.rf_channel.maio = 0;
658 prim->channel_desc_1.chan_sel.rf_channel.hsn = 1;
659 prim->channel_desc_1.channel_type = CH_TCH_F;
660 prim->channel_desc_1.sub_channel = 0;
661 prim->channel_desc_1.timeslot_no = 0;
662 prim->channel_desc_1.tsc = 5;
663
664 const U16 CHLIST_73_74_75_76_elements[4] = {
665 ARFCN_73,
666 ARFCN_74,
667 ARFCN_75,
668 ARFCN_76
669 };
670 T_ARRAY<U16> CHLIST_73_74_75_76(CHLIST_73_74_75_76_elements, SKIP_TO_END);
671
672 prim->channel_mode_1._skip;
673 prim->txpwr = TXPWR0;
674 prim->frequency_list.rf_chan_cnt = 4;
675 prim->frequency_list.rf_chan_no.radio_freq = CHLIST_73_74_75_76;
676 prim->starting_time.start_time_present = 1;
677 prim->starting_time.start_time.t1 = 45;
678 prim->starting_time.start_time.t2 = 22;
679 prim->starting_time.start_time.t3 = 33;
680
681 const U16 CHLIST_46_52_59_66_73_74_elements[6] = {
682 ARFCN_46,
683 ARFCN_52,
684 ARFCN_59,
685 ARFCN_66,
686 ARFCN_73,
687 ARFCN_74
688 };
689 T_ARRAY<U16> CHLIST_46_52_59_66_73_74(CHLIST_46_52_59_66_73_74_elements, SKIP_TO_END);
690
691 prim->channel_desc_2._skip;
692 prim->channel_mode_2._skip;
693 prim->frequency_list_bef_sti.rf_chan_cnt = 6;
694 prim->frequency_list_bef_sti.rf_chan_no.radio_freq = CHLIST_46_52_59_66_73_74;
695 prim->channel_desc_1_bef_sti.chan_sel.h = 1;
696 prim->channel_desc_1_bef_sti.chan_sel.rf_channel.maio = 1;
697 prim->channel_desc_1_bef_sti.chan_sel.rf_channel.hsn = 7;
698 prim->channel_desc_1_bef_sti.channel_type = CH_TCH_F;
699 prim->channel_desc_1_bef_sti.sub_channel = 0;
700 prim->channel_desc_1_bef_sti.timeslot_no = 0;
701 prim->channel_desc_1_bef_sti.tsc = 5;
702
703 prim->channel_desc_2_bef_sti._skip;
704 prim->cipher_mode._skip;
705 prim->a5_algorithm._skip;
706 prim->cipher_key._skip;
707 prim->dtx_allowed._skip;
708 prim->amr_configuration._skip;
709 return prim;
710 }
711 T_PRIMITIVE_UNION mphc_channel_assign_req_2()
712 {
713 T_MPHC_CHANNEL_ASSIGN_REQ prim;
714 prim->channel_desc_1 = channel_desc_fr();
715 prim->channel_mode_1._skip;
716 prim->txpwr = POWER_12;
717 prim->frequency_list = freq_list_fr();
718 prim->starting_time = s_time_t1();
719 prim->channel_desc_2._skip;
720 prim->channel_mode_2._skip;
721 prim->frequency_list_bef_sti = freq_list_ia();
722 prim->channel_desc_1_bef_sti = channel_desc_ia();
723 prim->channel_desc_2_bef_sti._skip;
724 prim->cipher_mode._skip;
725 prim->a5_algorithm._skip;
726 prim->cipher_key._skip;
727 prim->dtx_allowed._skip;
728 prim->amr_configuration._skip;
729 return prim;
730 }
731
732 T_PRIMITIVE_UNION mphc_channel_assign_con_1()
733 {
734 T_MPHC_CHANNEL_ASSIGN_CON prim;
735 prim->param._skip;
736 return prim;
737 }
738
739 T_PRIMITIVE_UNION mph_dedicated_fail_req_1()
740 {
741 T_MPH_DEDICATED_FAIL_REQ prim;
742 prim->param._skip;
743 return prim;
744 }
745
746
747 T_PRIMITIVE_UNION mph_dedicated_fail_cnf_1()
748 {
749 T_MPH_DEDICATED_FAIL_CNF prim;
750 prim->param._skip;
751 return prim;
752 }
753
754
755 T_PRIMITIVE_UNION mphc_async_ho_con_1()
756 {
757 T_MPHC_ASYNC_HO_CON prim;
758 prim->param._skip;
759 return prim;
760 }
761
762 T_PRIMITIVE_UNION mphc_handover_finished_1(CHAR success)
763 {
764 T_MPHC_HANDOVER_FINISHED prim;
765 prim->cause = success;
766 #ifdef FF_EGPRS
767 /*valid only for BHO*/
768 prim->fn_offset = FN_OFF_ARFCN_1;
769 prim->time_alignment = TIME_ALIGNMT_1;
770 #endif // FF_EGPRS
771 return prim;
772 }
773
774 T_PRIMITIVE_UNION mphc_handover_fail_req_1()
775 {
776 T_MPHC_HANDOVER_FAIL_REQ prim;
777 prim->param._skip;
778 return prim;
779 }
780
781 T_PRIMITIVE_UNION mphc_handover_fail_con_1()
782 {
783 T_MPHC_HANDOVER_FAIL_CON prim;
784 prim->param._skip;
785 return prim;
786 }
787
788 T_PRIMITIVE_UNION mphc_change_frequency_con_1()
789 {
790 T_MPHC_CHANGE_FREQUENCY_CON prim;
791 prim->param._skip;
792 return prim;
793 }
794
795 T_RADIO_FRAME copy_array_to_l2_frame(U8 ch_type, const U8 const array[])
796 {
797 T_RADIO_FRAME l2_frame;
798 U16 sdu_len = (array[0] + (array[1] << 8)) >> 3; /* sdu length in bytes */
799 U8 l2_header_off = (ch_type == L2_CHANNEL_SACCH) ? 6 : 4;
800 U8 l2_len = array[l2_header_off+2] >> 2; /* length in bytes from l2 header */
801
802 tdc_usi_trace ("copy_array_to_l2_frame(): sdu_len=%u l2_len=%u", sdu_len, l2_len);
803 /*
804 * Due to the incorrect SDU lengths in some message sdu“s, we use the length
805 * indicator field of the layer 2 header instead. The remain of the
806 * information will be filled with fill bytes. Please note the layer 1 header
807 * in frames on SACCH.
808 */
809 l2_len += 3/*l2 header*/ + (l2_header_off-4)/*l1 header*/;
810 for (int i = 0; i < l2_len;i++) /* without sdu length and sdu offset */
811 {
812 l2_frame->A[i] = array[i+4];
813 }
814 for (; i < 23; i++)
815 {
816 l2_frame->A[i] = 0x2b; /* fill bytes */
817 }
818
819 return l2_frame;
820 }
821
822 T_PRIMITIVE_UNION ph_data_ind_1()
823 {
824 const U8 I_SMS[27] = {
825 0xA8, 0x00,
826 0x10, 0x00,
827 0xFF, 0xAA,
828 0x0F,
829 0x02,
830 0x19,
831 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F,
832 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B,
833 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B
834 };
835 T_PH_DATA_IND prim;
836
837 prim->rf_chan_num._skip;
838 prim->l2_channel_type= L2_CHANNEL_SACCH;
839 prim->l2_frame = copy_array_to_l2_frame (L2_CHANNEL_SACCH, I_SMS);
840 prim->error_cause = VALID_BLOCK;
841 prim->bsic._skip;
842 prim->tc._skip;
843
844 return prim;
845 }
846
847 T_PRIMITIVE_UNION mph_channel_mode_req_1()
848 {
849 T_MPH_CHANNEL_MODE_REQ prim;
850 prim->mode = CHANNEL_MODE_AMR;
851 prim->ch = CHANNEL_0;
852 prim->amr_conf = s_amr_conf_4_icmi();
853 return prim;
854 }
855
856 T_PRIMITIVE_UNION mphc_channel_mode_modify_req_1()
857 {
858 T_MPHC_CHANNEL_MODE_MODIFY_REQ prim;
859 prim->sub_channel = CHANNEL_0;
860 prim->channel_mode = CHM_AHS;
861 prim->amr_configuration = s_amr_configuration();
862 return prim;
863 }
864
865 T_PRIMITIVE_UNION mphc_channel_mode_modify_con_1()
866 {
867 T_MPHC_CHANNEL_MODE_MODIFY_CON prim;
868 prim->param._skip;
869 return prim;
870 }
871 T_PRIMITIVE_UNION mphc_stop_dedicated_req()
872 {
873 T_MPHC_STOP_DEDICATED_REQ prim;
874 prim->param._skip;
875 return prim;
876 }
877 T_PRIMITIVE_UNION mphc_stop_dedicated_con()
878 {
879 T_MPHC_STOP_DEDICATED_CON prim;
880 prim->param._skip;
881 return prim;
882 }
883 T_PRIMITIVE_UNION mph_stop_dedicated_req()
884 {
885 T_MPH_STOP_DEDICATED_REQ prim;
886 prim->param._skip;
887 return prim;
888 }
889 T_PRIMITIVE_UNION mph_stop_dedicated_cnf()
890 {
891 T_MPH_STOP_DEDICATED_CNF prim;
892 prim->param._skip;
893 return prim;
894 }
895 T_PRIMITIVE_UNION mph_dedicated_req_2g()
896 {
897 T_MPH_DEDICATED_REQ prim;
898 prim->mod = MODE_PDCH_ASSIGN;
899 prim->start._skip;
900 prim->ch_type._skip;
901 prim->ch_type2._skip;
902 prim->arfcn._skip;
903 prim->bsic._skip;
904 prim->ho_param._skip;
905 prim->tr_para._skip;
906 prim->ciph._skip;
907 prim->amr_conf._skip;
908 return prim;
909 }
910 T_PRIMITIVE_UNION mph_dedicated_fail_req_1g()
911 {
912 T_MPH_DEDICATED_FAIL_REQ prim;
913 prim->param._skip;
914 return prim;
915 }
916 #if 0
917 T_PRIMITIVE_UNION mphc_immed_assign_req_2g()
918 {
919 T_MPHC_IMMED_ASSIGN_REQ prim;
920 prim->channel_desc = channel_desc_1();
921 prim->timing_advance = TIMING_ADVANCE;
922 prim->frequency_list = freq_list();
923 prim->starting_time._skip;
924 prim->frequency_list_bef_sti._skip;
925 prim->maio_bef_sti._skip;
926 prim->dtx_allowed._skip;
927 prim->bcch_allocation._skip;
928 prim->ba_id._skip;
929 prim->pwrc._skip;
930 return prim;
931 }
932 #endif
933 T_PRIMITIVE_UNION mphc_channel_assign_req_1g()
934 {
935 T_MPHC_CHANNEL_ASSIGN_REQ prim;
936 prim->channel_desc_1._skip;
937 prim->channel_mode_1._skip;
938 prim->txpwr._skip;
939 prim->frequency_list._skip;
940 prim->starting_time._skip;
941 prim->channel_desc_2._skip;
942 prim->channel_mode_2._skip;
943 prim->frequency_list_bef_sti._skip;
944 prim->channel_desc_1_bef_sti._skip;
945 prim->channel_desc_2_bef_sti._skip;
946 prim->cipher_mode._skip;
947 prim->a5_algorithm._skip;
948 prim->cipher_key._skip;
949 prim->dtx_allowed._skip;
950 prim->amr_configuration._skip;
951 return prim;
952 }
953
954 T_PRIMITIVE_UNION mphc_channel_assign_con_1g()
955 {
956 T_MPHC_CHANNEL_ASSIGN_CON prim;
957 prim->param._skip;
958 return prim;
959 }
960
961 T_PRIMITIVE_UNION mph_dedicated_fail_cnf_1g()
962 {
963 T_MPH_DEDICATED_FAIL_CNF prim;
964 prim->param._skip;
965 return prim;
966 }
967
968
969 T_PRIMITIVE_UNION mph_dedicated_req_fn(U8 mode, U16 arfcn, U8 bsic)
970 {
971 T_MPH_DEDICATED_REQ prim;
972 prim->mod = mode;
973 prim->start._skip;
974 prim->ch_type = ch_type_tch2();
975 prim->ch_type2._skip;
976 prim->arfcn = arfcn;
977 prim->bsic = bsic;
978 prim->ho_param = ho_param_1();
979 prim->tr_para = tr_param();
980 prim->ciph = ciph_param();
981 prim->amr_conf._skip;
982 return prim;
983 }
984
985 T_PRIMITIVE_UNION mphc_async_ho_req_ho_type_fn(U8 ho_type, U32 fn_offset, U32 time_alignment)
986 {
987 T_MPHC_ASYNC_HO_REQ prim;
988 prim->handover_command._skip;
989 prim->fn_offset = fn_offset;
990 prim->time_alignmnt = time_alignment;
991 prim->cipher_key._skip;
992 prim->amr_configuration._skip;
993 #ifdef FF_EGPRS
994 prim->handover_type = ho_type;
995 #endif // FF_EGPRS
996 return prim;
997 }
998
999 T_PRIMITIVE_UNION mphc_sync_ho_req_ho_type_fn(U8 ho_type, U32 fn_offset, U32 time_alignment)
1000 {
1001 T_MPHC_SYNC_HO_REQ prim;
1002 prim->handover_command._skip;
1003 prim->fn_offset = fn_offset;
1004 prim->time_alignmnt = time_alignment;
1005 prim->cipher_key._skip;
1006 prim->amr_configuration._skip;
1007 #ifdef FF_EGPRS
1008 prim->handover_type = ho_type;
1009 #endif // FF_EGPRS
1010 return prim;
1011 }
1012
1013 T_PRIMITIVE_UNION mphc_presync_ho_req_ho_type_fn(U8 ho_type, U32 fn_offset, U32 time_alignment)
1014 {
1015 T_MPHC_PRE_SYNC_HO_REQ prim;
1016 prim->handover_command._skip;
1017 prim->fn_offset = fn_offset;
1018 prim->time_alignmnt = time_alignment;
1019 prim->cipher_key._skip;
1020 prim->amr_configuration._skip;
1021 #ifdef FF_EGPRS
1022 prim->handover_type = ho_type;
1023 #endif // FF_EGPRS
1024 return prim;
1025 }
1026
1027
1028 T_PRIMITIVE_UNION mphc_handover_finished_fn(U8 cause)
1029 {
1030 T_MPHC_HANDOVER_FINISHED prim;
1031 if(cause == 0xFF) prim->cause._show;
1032 else prim->cause = cause;
1033 return prim;
1034 }
1035
1036
1037 T_PRIMITIVE_UNION mph_dedicated_cnf_fn(U8 cause)
1038 {
1039 T_MPH_DEDICATED_CNF prim;
1040 if(cause == 0xFF) prim->dedi_res._show;
1041 else prim->dedi_res = cause;
1042 return prim;
1043 }
1044