FreeCalypso > hg > fc-magnetite
comparison src/g23m-gprs/grr/grr_tcs.c @ 183:219afcfc6250
src/g23m-gprs: initial import from TCS3.2/LoCosto
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 13 Oct 2016 04:24:13 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
182:f02d0a0e1849 | 183:219afcfc6250 |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : GPRS (8441) | |
4 | Modul : GRR | |
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 signal handler functions for service | |
18 | TC of entity GRR. | |
19 +----------------------------------------------------------------------------- | |
20 */ | |
21 | |
22 #ifndef GRR_TCS_C | |
23 #define GRR_TCS_C | |
24 #endif | |
25 | |
26 #define ENTITY_GRR | |
27 | |
28 /*==== INCLUDES =============================================================*/ | |
29 | |
30 #include <string.h> | |
31 #include "typedefs.h" /* to get Condat data types */ | |
32 #include "vsi.h" /* to get a lot of macros */ | |
33 #include "macdef.h" | |
34 #include "gprs.h" | |
35 #include "gsm.h" /* to get a lot of macros */ | |
36 #include "ccdapi.h" /* to get CCD API */ | |
37 #include "cnf_grr.h" /* to get cnf-definitions */ | |
38 #include "mon_grr.h" /* to get mon-definitions */ | |
39 #include "prim.h" /* to get the definitions of used SAP and directions */ | |
40 #include "message.h" /* to get air message definitions */ | |
41 #include "grr.h" /* to get the global entity definitions */ | |
42 #include "grr_f.h" /* to get the global entity definitions */ | |
43 #include "grr_tcf.h" /* to get the service TC procedure definitions */ | |
44 #include "grr_tcs.h" /* to get the service TC signal definitions */ | |
45 #include "grr_ctrls.h" /* to get the service CTRL signal definitions */ | |
46 #include "grr_cpaps.h" /* to get the service CPAP signal definitions */ | |
47 #include "grr_meass.h" | |
48 #include "grr_psif.h" /* stop timers in Testmode A */ | |
49 #include "cl_rlcmac.h" | |
50 | |
51 /*==== CONST ================================================================*/ | |
52 | |
53 /*==== DIAGNOSTICS ==========================================================*/ | |
54 | |
55 /*==== LOCAL TYPES===========================================================*/ | |
56 | |
57 LOCAL void tc_handle_new_cell ( BOOL cell_has_changed, UBYTE enable_cause ); | |
58 | |
59 /*==== LOCAL VARS ===========================================================*/ | |
60 | |
61 /*==== PRIVATE FUNCTIONS ====================================================*/ | |
62 /* | |
63 +------------------------------------------------------------------------------ | |
64 | Function : tc_handle_new_cell | |
65 +------------------------------------------------------------------------------ | |
66 | Description : | |
67 | | |
68 | Parameters : | |
69 | | |
70 +------------------------------------------------------------------------------ | |
71 */ | |
72 LOCAL void tc_handle_new_cell ( BOOL cell_has_changed, UBYTE enable_cause ) | |
73 { | |
74 UBYTE queue_mode; | |
75 | |
76 TRACE_FUNCTION( "tc_handle_new_cell" ); | |
77 | |
78 if( cell_has_changed ) | |
79 { | |
80 /* inform CPAP because it has to stop T3142 if running */ | |
81 sig_tc_cpap_new_cell(); | |
82 | |
83 grr_data->ta_params.ta_valid = FALSE; | |
84 | |
85 TRACE_EVENT_P1( "tc_handle_new_cell: N3102 = %d", psc_db->gprs_cell_opt.pan_struct.pmax ); | |
86 } | |
87 | |
88 queue_mode = ( enable_cause EQ CGRLC_ENAC_NORMAL ? | |
89 CGRLC_QUEUE_MODE_GMM : CGRLC_QUEUE_MODE_LLC ); | |
90 | |
91 tc_cgrlc_enable_req( queue_mode, | |
92 CGRLC_RA_DEFAULT, | |
93 cell_has_changed, | |
94 enable_cause ); | |
95 } /* tc_handle_new_cell() */ | |
96 | |
97 /*==== PUBLIC FUNCTIONS =====================================================*/ | |
98 /* | |
99 +------------------------------------------------------------------------------ | |
100 | Function : tc_get_ctrl_blk | |
101 +------------------------------------------------------------------------------ | |
102 | Description : | |
103 | | |
104 | Parameters : | |
105 | | |
106 +------------------------------------------------------------------------------ | |
107 */ | |
108 GLOBAL UBYTE* tc_get_ctrl_blk ( UBYTE *index, BOOL unacknowledged ) | |
109 { | |
110 UBYTE *ctrl_blk; | |
111 | |
112 TRACE_FUNCTION( "tc_get_ctrl_blk" ); | |
113 | |
114 ctrl_blk = tc_set_start_ctrl_blk( index ); | |
115 | |
116 if( unacknowledged ) | |
117 { | |
118 /* | |
119 * in case the control blocks are send by the service RU, we are | |
120 * working in unacknowledged mode, so every block is transmitted | |
121 * succesfully | |
122 */ | |
123 tc_set_stop_ctrl_blk( TRUE, CGRLC_BLK_OWNER_NONE, 0 ); | |
124 } | |
125 | |
126 return( ctrl_blk ); | |
127 | |
128 } /* tc_get_ctrl_blk() */ | |
129 | |
130 /* | |
131 +------------------------------------------------------------------------------ | |
132 | Function : tc_is_ctrl_blk_rdy | |
133 +------------------------------------------------------------------------------ | |
134 | Description : | |
135 | | |
136 | Parameters : | |
137 | | |
138 +------------------------------------------------------------------------------ | |
139 */ | |
140 GLOBAL BOOL tc_is_ctrl_blk_rdy ( UBYTE ack_cnt_meas_rpt, UBYTE ack_cnt_other ) | |
141 { | |
142 BOOL result = FALSE; | |
143 T_BLK_INDEX blk_index = grr_data->tc.ul_ctrl_blk.seq[0]; | |
144 | |
145 TRACE_FUNCTION( "tc_is_ctrl_blk_rdy" ); | |
146 | |
147 if( blk_index NEQ MAX_CTRL_BLK_NUM ) | |
148 { | |
149 switch( grr_data->tc.ul_ctrl_blk.blk[blk_index].owner ) | |
150 { | |
151 case( CGRLC_BLK_OWNER_MEAS ): | |
152 case( CGRLC_BLK_OWNER_CS ): result = ( ack_cnt_meas_rpt EQ 0 ); break; | |
153 default : result = ( ack_cnt_other EQ 0 ); break; | |
154 } | |
155 } | |
156 | |
157 return( result ); | |
158 | |
159 } /* tc_is_ctrl_blk_rdy() */ | |
160 | |
161 /* | |
162 +------------------------------------------------------------------------------ | |
163 | Function : tc_get_num_ctrl_blck | |
164 +------------------------------------------------------------------------------ | |
165 | Description : This function returns the number of allocated control blocks. | |
166 | | |
167 | Parameters : | |
168 | | |
169 +------------------------------------------------------------------------------ | |
170 */ | |
171 GLOBAL UBYTE tc_get_num_ctrl_blck ( void ) | |
172 { | |
173 UBYTE i = 0; /* used for counting */ | |
174 UBYTE num = 0; /* number of allocated control blocks */ | |
175 | |
176 TRACE_FUNCTION( "tc_get_num_ctrl_blck" ); | |
177 | |
178 while( i < MAX_CTRL_BLK_NUM AND | |
179 grr_data->tc.ul_ctrl_blk.seq[i] NEQ MAX_CTRL_BLK_NUM ) | |
180 { | |
181 if( grr_data->tc.ul_ctrl_blk.blk[grr_data->tc.ul_ctrl_blk.seq[i]].state | |
182 EQ BLK_STATE_ALLOCATED ) | |
183 { | |
184 num++; | |
185 } | |
186 | |
187 i++; | |
188 } | |
189 | |
190 return( num ); | |
191 | |
192 } /* tc_get_num_ctrl_blck() */ | |
193 | |
194 /* | |
195 +------------------------------------------------------------------------------ | |
196 | Function : tc_cpy_ctrl_blk_to_buffer | |
197 +------------------------------------------------------------------------------ | |
198 | Description : This function ... | |
199 | | |
200 | Parameters : | |
201 | | |
202 +------------------------------------------------------------------------------ | |
203 */ | |
204 GLOBAL UBYTE tc_cpy_ctrl_blk_to_buffer( UBYTE *buffer ) | |
205 { | |
206 UBYTE index; | |
207 UBYTE *ctrl_block = tc_get_ctrl_blk( &index, FALSE ); | |
208 | |
209 TRACE_FUNCTION( "tc_cpy_ctrl_blk_to_buffer" ); | |
210 | |
211 if( ctrl_block NEQ NULL ) | |
212 { | |
213 memcpy( buffer, ctrl_block, BYTE_UL_CTRL_BLOCK ); | |
214 grr_data->tc.v_sb_without_tbf = FALSE; | |
215 /* | |
216 * After copying Measurement reports (PIM) in single block req | |
217 * v_sb_without_tbf is not required | |
218 */ | |
219 } | |
220 else | |
221 { | |
222 TRACE_ERROR( "tc_cpy_ctrl_blk_to_buffer: ctrl_block EQ NULL" ); | |
223 } | |
224 | |
225 return( index ); | |
226 } /* tc_cpy_ctrl_blk_to_buffer() */ | |
227 | |
228 /*==== SIGNAL FUNCTIONS =====================================================*/ | |
229 /* | |
230 +------------------------------------------------------------------------------ | |
231 | Function : sig_ctrl_tc_control_block | |
232 +------------------------------------------------------------------------------ | |
233 | Description : Handles the internal signal SIG_CTRL_TC_CONTROL_BLOCK | |
234 | | |
235 | Parameters : void | |
236 | | |
237 +------------------------------------------------------------------------------ | |
238 */ | |
239 GLOBAL void sig_ctrl_tc_control_block ( T_BLK_OWNER blk_owner_i, | |
240 void * blk_struct_i ) | |
241 { | |
242 TRACE_ISIG( "sig_ctrl_tc_control_block " ); | |
243 | |
244 switch( GET_STATE( TC ) ) | |
245 { | |
246 case TC_ACCESS_DISABLED: | |
247 case TC_CPAP: | |
248 case TC_WAIT_ASSIGN: | |
249 case TC_POLLING: | |
250 case TC_WAIT_2P_ASSIGN: | |
251 case TC_CONTENTION_RESOLUTION: | |
252 case TC_TBF_ACTIVE: | |
253 case TC_WAIT_STOP_TASK_CNF: | |
254 if( tc_store_ctrl_blk( blk_owner_i, blk_struct_i ) EQ FALSE ) | |
255 { | |
256 sig_tc_ctrl_control_block_result( blk_owner_i, FALSE ); | |
257 } | |
258 else | |
259 { | |
260 tc_send_control_msg_to_grlc(); | |
261 } | |
262 break; | |
263 case TC_SINGLE_BLOCK: | |
264 case TC_PIM: | |
265 if( tc_store_ctrl_blk( blk_owner_i, blk_struct_i ) EQ FALSE ) | |
266 { | |
267 sig_tc_ctrl_control_block_result( blk_owner_i, FALSE ); | |
268 } | |
269 else | |
270 { | |
271 /* | |
272 * check if grlc has to transmit data | |
273 */ | |
274 tc_cgrlc_access_status_req(); | |
275 /* grr_data->tc.v_sb_without_tbf = TRUE; | |
276 grr_data->uplink_tbf.nr_blocks = 1; | |
277 grr_data->uplink_tbf.prio = RADIO_PRIO_4; | |
278 grr_data->uplink_tbf.access_type = CGRLC_AT_SINGLE_BLOCK; | |
279 grr_data->uplink_tbf.ti = 0; | |
280 tc_check_access_is_needed( CAC_OTHER );*/ | |
281 } | |
282 break; | |
283 default: | |
284 sig_tc_ctrl_control_block_result( blk_owner_i, FALSE ); | |
285 | |
286 TRACE_ERROR( "SIG_CTRL_TC_CONTROL_BLOCK unexpected" ); | |
287 break; | |
288 } | |
289 } /* sig_ctrl_tc_control_block () */ | |
290 | |
291 /* | |
292 +------------------------------------------------------------------------------ | |
293 | Function : sig_ctrl_tc_cancel_control_block | |
294 +------------------------------------------------------------------------------ | |
295 | Description : Handles the internal signal SIG_CTRL_TC_CANCEL_CONTROL_BLOCK | |
296 | | |
297 | Parameters : void | |
298 | | |
299 +------------------------------------------------------------------------------ | |
300 */ | |
301 GLOBAL void sig_ctrl_tc_cancel_control_block ( T_BLK_OWNER blk_owner_i ) | |
302 { | |
303 UBYTE state = GET_STATE( TC ); | |
304 | |
305 TRACE_ISIG( "sig_ctrl_tc_cancel_control_block " ); | |
306 | |
307 switch( state ) | |
308 { | |
309 case TC_CPAP: | |
310 case TC_WAIT_ASSIGN: | |
311 if( tc_cancel_ctrl_blk( blk_owner_i ) EQ TRUE ) | |
312 { | |
313 if( tc_get_num_ctrl_blck( ) EQ 0 ) | |
314 { | |
315 if( state EQ TC_CPAP ) | |
316 { | |
317 sig_tc_cpap_abort_access(); | |
318 } | |
319 else | |
320 { | |
321 SET_STATE( TC, TC_PIM ); | |
322 | |
323 tc_send_ra_stop_req( ); | |
324 vsi_t_stop( GRR_handle, T3170 ); | |
325 tc_check_access_is_needed( CAC_OTHER ); | |
326 } | |
327 } | |
328 } | |
329 break; | |
330 case TC_ACCESS_DISABLED: | |
331 case TC_POLLING: | |
332 case TC_PIM: | |
333 tc_cancel_ctrl_blk( blk_owner_i ); | |
334 break; | |
335 case TC_SINGLE_BLOCK: | |
336 case TC_WAIT_2P_ASSIGN: | |
337 tc_cancel_ctrl_blk( blk_owner_i ); | |
338 tc_stop_normal_burst_req( ); | |
339 break; | |
340 case TC_TBF_ACTIVE: | |
341 case TC_CONTENTION_RESOLUTION: | |
342 tc_cancel_ctrl_blk( blk_owner_i ); | |
343 tc_handle_error_ra(); | |
344 break; | |
345 default: | |
346 TRACE_EVENT( "SIG_CTRL_TC_CANCEL_CONTROL_BLOCK unexpected" ); | |
347 break; | |
348 } | |
349 } /* sig_ctrl_tc_cancel_control_block () */ | |
350 | |
351 /* | |
352 +------------------------------------------------------------------------------ | |
353 | Function : sig_ctrl_tc_enable_grlc | |
354 +------------------------------------------------------------------------------ | |
355 | Description : Handles the internal signal SIG_CTRL_TC_ENABLE_GRLC | |
356 | | |
357 | Parameters : void | |
358 | | |
359 +------------------------------------------------------------------------------ | |
360 */ | |
361 GLOBAL void sig_ctrl_tc_enable_grlc (UBYTE queue_mode, UBYTE cell_update_cause ) | |
362 { | |
363 TRACE_ISIG( "sig_ctrl_tc_enable_grlc" ); | |
364 | |
365 if(cell_update_cause EQ GMMRR_RA_CU) | |
366 tc_cgrlc_enable_req(queue_mode,CGRLC_RA_CU,FALSE,CGRLC_ENAC_NORMAL); | |
367 else | |
368 tc_cgrlc_enable_req(queue_mode,CGRLC_RA_DEFAULT,FALSE,CGRLC_ENAC_NORMAL); | |
369 | |
370 } /* sig_ctrl_tc_enable_grlc() */ | |
371 | |
372 /* | |
373 +------------------------------------------------------------------------------ | |
374 | Function : sig_ctrl_tc_access_disable | |
375 +------------------------------------------------------------------------------ | |
376 | Description : Handles the internal signal SIG_CTRL_TC_ACCESS_DISABLE | |
377 | | |
378 | Parameters : dc - disable cause | |
379 | | |
380 +------------------------------------------------------------------------------ | |
381 */ | |
382 GLOBAL void sig_ctrl_tc_access_disable | |
383 ( T_TC_DISABLE_CAUSE disable_cause, | |
384 T_TC_DISABLE_CALLBACK_FUNC callback_func ) | |
385 { | |
386 UBYTE disable_class; | |
387 | |
388 T_TC_DC_CLASS dc_class = ( disable_cause & DCM_CLASS ); | |
389 T_TC_DC_TYPE dc_type = ( UBYTE )( disable_cause & DCM_TYPE ); | |
390 UBYTE state = GET_STATE( TC ); | |
391 UBYTE prim_st = CGRLC_PRIM_STATUS_NULL; | |
392 | |
393 TRACE_ISIG( "sig_ctrl_tc_access_disable" ); | |
394 | |
395 disable_class = | |
396 ( dc_class EQ DCC_CR ? CGRLC_DISABLE_CLASS_CR : CGRLC_DISABLE_CLASS_OTHER ); | |
397 | |
398 if( grr_data->tc.disable_class EQ CGRLC_DISABLE_CLASS_NULL OR | |
399 disable_class NEQ CGRLC_DISABLE_CLASS_CR ) | |
400 { | |
401 grr_data->tc.disable_class = disable_class; | |
402 } | |
403 if ( disable_cause EQ TC_DC_CR_NETWORK) | |
404 { | |
405 TRACE_EVENT("T3170 stopped if disable cause is NW CR"); | |
406 vsi_t_stop(GRR_handle,T3170); | |
407 } | |
408 switch( state ) | |
409 { | |
410 case TC_CPAP: | |
411 sig_tc_cpap_abort_access(); | |
412 | |
413 SET_STATE( TC, TC_ACCESS_DISABLED ); | |
414 | |
415 tc_cgrlc_disable_req(prim_st); | |
416 | |
417 callback_func( ); | |
418 break; | |
419 | |
420 case TC_WAIT_2P_ASSIGN: | |
421 vsi_t_stop( GRR_handle, T3168 ); | |
422 #if defined REL99 AND defined TI_PS_FF_TBF_EST_PACCH | |
423 if(grr_data->tbf_type EQ CGRLC_TBF_MODE_2PA) | |
424 { | |
425 tc_abort_tbf( grr_data->tbf_type ); | |
426 } | |
427 else | |
428 #endif | |
429 { | |
430 tc_stop_normal_burst_req( ); | |
431 } | |
432 | |
433 SET_STATE( TC, TC_ACCESS_DISABLED ); | |
434 | |
435 if( dc_class EQ DCC_SUSPEND ) | |
436 { | |
437 prim_st = CGRLC_PRIM_STATUS_ONE; | |
438 } | |
439 tc_cgrlc_disable_req(prim_st); | |
440 | |
441 grr_data->tc.disable_callback_func = callback_func; | |
442 break; | |
443 | |
444 case TC_POLLING: | |
445 case TC_WAIT_ASSIGN: | |
446 tc_send_ra_stop_req( ); | |
447 | |
448 SET_STATE( TC, TC_ACCESS_DISABLED ); | |
449 | |
450 if( dc_class EQ DCC_SUSPEND ) | |
451 { | |
452 prim_st = CGRLC_PRIM_STATUS_ONE; | |
453 } | |
454 tc_cgrlc_disable_req(prim_st); | |
455 | |
456 callback_func( ); | |
457 break; | |
458 | |
459 case TC_CONTENTION_RESOLUTION: | |
460 case TC_TBF_ACTIVE: | |
461 TRACE_EVENT_P1( "SIG_CTRL_TC_ACCESS_DISABLE: %s of TBF", | |
462 dc_type EQ DCT_NORMAL ? "normal release" : "abort" ); | |
463 | |
464 if(!grr_data->tc.two_2p_w_4_tbf_con AND | |
465 ( dc_type NEQ DCT_NORMAL )) | |
466 { | |
467 TRACE_EVENT("SB SUSPEND Before TBF_C"); | |
468 tc_stop_normal_burst_req( ); | |
469 SET_STATE( TC, TC_ACCESS_DISABLED ); | |
470 if( dc_class EQ DCC_SUSPEND ) | |
471 { | |
472 prim_st = CGRLC_PRIM_STATUS_ONE; | |
473 } | |
474 tc_cgrlc_disable_req(prim_st); | |
475 } | |
476 else if( dc_type NEQ DCT_NORMAL ) | |
477 { | |
478 if( grr_data->tc.num_of_rels_running EQ 0 OR | |
479 grr_data->tbf_type NEQ CGRLC_TBF_MODE_NULL ) | |
480 { | |
481 tc_abort_tbf( grr_data->tbf_type ); | |
482 | |
483 SET_STATE( TC, TC_ACCESS_DISABLED ); | |
484 } | |
485 tc_cgrlc_disable_req(prim_st); | |
486 } | |
487 | |
488 grr_data->tc.disable_callback_func = callback_func; | |
489 break; | |
490 | |
491 case TC_SINGLE_BLOCK: | |
492 tc_stop_normal_burst_req( ); | |
493 tc_set_stop_all_ctrl_blk( ); | |
494 | |
495 tc_cgrlc_disable_req(prim_st); | |
496 | |
497 SET_STATE( TC, TC_ACCESS_DISABLED ); | |
498 | |
499 grr_data->tc.disable_callback_func = callback_func; | |
500 break; | |
501 | |
502 case TC_PIM: | |
503 | |
504 tc_cgrlc_disable_req(prim_st); | |
505 | |
506 if( grr_data->tc.num_of_rels_running NEQ 0 ) | |
507 { | |
508 /* | |
509 * disable request during TBF release procedure, | |
510 * GRR is waiting for RRGRR_STOP_TASK_CNF | |
511 */ | |
512 TRACE_EVENT( "SIG_CTRL_TC_ACCESS_DISABLE: TBF release procedure is running" ); | |
513 | |
514 grr_data->tc.disable_callback_func = callback_func; | |
515 } | |
516 else | |
517 { | |
518 SET_STATE( TC, TC_ACCESS_DISABLED ); | |
519 | |
520 callback_func( ); | |
521 } | |
522 break; | |
523 | |
524 default: | |
525 TRACE_EVENT_P1( "SIG_CTRL_TC_ACCESS_DISABLE in TC state %d", state ); | |
526 | |
527 /*lint -fallthrough*/ | |
528 | |
529 case TC_ACCESS_DISABLED: | |
530 case TC_WAIT_STOP_TASK_CNF: | |
531 | |
532 tc_cgrlc_disable_req(prim_st); | |
533 | |
534 SET_STATE( TC, TC_ACCESS_DISABLED ); | |
535 | |
536 if( grr_data->tc.disable_callback_func EQ NULL ) | |
537 { | |
538 callback_func( ); | |
539 } | |
540 else | |
541 { | |
542 grr_data->tc.disable_callback_func = callback_func; | |
543 } | |
544 break; | |
545 } | |
546 #ifdef _SIMULATION_ | |
547 tc_stop_timer_t3172(); | |
548 #endif | |
549 } /* sig_ctrl_tc_access_disable() */ | |
550 | |
551 | |
552 | |
553 | |
554 | |
555 | |
556 /* | |
557 +------------------------------------------------------------------------------ | |
558 | Function : sig_cpap_tc_error_pim | |
559 +------------------------------------------------------------------------------ | |
560 | Description : Handles the internal signal SIG_CPAP_TC_ERROR_PIM | |
561 | | |
562 | Parameters : void | |
563 | | |
564 +------------------------------------------------------------------------------ | |
565 */ | |
566 GLOBAL void sig_cpap_tc_error_pim ( void ) | |
567 { | |
568 TRACE_ISIG( "sig_cpap_tc_error_pim" ); | |
569 | |
570 switch( GET_STATE( TC ) ) | |
571 { | |
572 case TC_CPAP: | |
573 SET_STATE( TC, TC_PIM ); | |
574 | |
575 tc_handle_error_pim(); | |
576 break; | |
577 | |
578 default: | |
579 TRACE_ERROR( "SIG_CPAP_TC_ERROR_PIM unexpected" ); | |
580 break; | |
581 } | |
582 } /* sig_cpap_tc_error_pim() */ | |
583 | |
584 /* | |
585 +------------------------------------------------------------------------------ | |
586 | Function : sig_cpap_tc_tbf_created | |
587 +------------------------------------------------------------------------------ | |
588 | Description : Handles the internal signal SIG_CPAP_TC_TBF_CREATED | |
589 | | |
590 | Parameters : void | |
591 | | |
592 +------------------------------------------------------------------------------ | |
593 */ | |
594 GLOBAL void sig_cpap_tc_tbf_created ( T_TBF_TYPE tbf_type ) | |
595 { | |
596 TRACE_ISIG( "sig_cpap_tc_tbf_created" ); | |
597 | |
598 | |
599 switch( GET_STATE( TC ) ) | |
600 { | |
601 case TC_CPAP: | |
602 switch(tbf_type) | |
603 { | |
604 case CGRLC_TBF_MODE_UL: | |
605 SET_STATE(TC,TC_CONTENTION_RESOLUTION); | |
606 tc_activate_tbf(tbf_type); | |
607 tc_cgrlc_ul_tbf_res(CGRLC_TBF_MODE_UL,CGRLC_PRIM_STATUS_NULL); | |
608 break; | |
609 case CGRLC_TBF_MODE_DL: | |
610 SET_STATE(TC,TC_TBF_ACTIVE); | |
611 tc_activate_tbf(tbf_type); | |
612 tc_cgrlc_dl_tbf_req(); | |
613 break; | |
614 default: | |
615 TRACE_ERROR("unknown tbf type! sig_cpap_tc_tbf_created"); | |
616 SET_STATE(TC,TC_PIM); | |
617 break; | |
618 } | |
619 break; | |
620 case TC_PIM: | |
621 switch(tbf_type) | |
622 { | |
623 case CGRLC_TBF_MODE_UL: | |
624 TRACE_ERROR("unexpected tbf type! sig_cpap_tc_tbf_created"); | |
625 break; | |
626 case CGRLC_TBF_MODE_DL: | |
627 SET_STATE(TC,TC_TBF_ACTIVE); | |
628 tc_activate_tbf(tbf_type); | |
629 tc_cgrlc_dl_tbf_req(); | |
630 break; | |
631 default: | |
632 TRACE_ERROR("unknown tbf type! sig_cpap_tc_tbf_created 2"); | |
633 SET_STATE(TC,TC_PIM); | |
634 break; | |
635 } | |
636 break; | |
637 default: | |
638 TRACE_ERROR( "SIG_CPAP_TC_TBF_CREATED unexpected" ); | |
639 break; | |
640 } | |
641 } /* sig_cpap_tc_tbf_created() */ | |
642 | |
643 | |
644 | |
645 | |
646 | |
647 /* | |
648 +------------------------------------------------------------------------------ | |
649 | Function : sig_ctrl_tc_ia_received | |
650 +------------------------------------------------------------------------------ | |
651 | Description : Handles the internal signal SIG_CTRL_TC_IA_RECEIVED | |
652 | | |
653 | Parameters : - | |
654 | | |
655 +------------------------------------------------------------------------------ | |
656 */ | |
657 GLOBAL void sig_ctrl_tc_ia_received (T_RRGRR_IA_IND *rrgrr_ia_ind ) | |
658 { | |
659 TRACE_ISIG( "sig_ctrl_tc_ia_received" ); | |
660 | |
661 switch( GET_STATE( TC ) ) | |
662 { | |
663 case TC_CPAP: | |
664 case TC_SINGLE_BLOCK: | |
665 case TC_PIM: | |
666 case TC_WAIT_ASSIGN: | |
667 case TC_POLLING: | |
668 case TC_WAIT_2P_ASSIGN: | |
669 case TC_CONTENTION_RESOLUTION: | |
670 case TC_TBF_ACTIVE: | |
671 sig_tc_cpap_ia_received(rrgrr_ia_ind); | |
672 break; | |
673 default: | |
674 TRACE_ERROR( "sig_ctrl_tc_ia_received unexpected" ); | |
675 break; | |
676 } | |
677 } /* sig_ctrl_tc_ia_received() */ | |
678 | |
679 | |
680 /* | |
681 +------------------------------------------------------------------------------ | |
682 | Function : sig_ctrl_tc_iaext_received | |
683 +------------------------------------------------------------------------------ | |
684 | Description : Handles the internal signal SIG_CTRL_TC_IAEXT_RECEIVED | |
685 | | |
686 | Parameters : UBYTE indicates the valid immediate assignment | |
687 | | |
688 +------------------------------------------------------------------------------ | |
689 */ | |
690 GLOBAL void sig_ctrl_tc_iaext_received ( T_RRGRR_IAEXT_IND *rrgrr_iaext_ind ) | |
691 { | |
692 TRACE_ISIG( "sig_ctrl_tc_iaext_received" ); | |
693 | |
694 switch( GET_STATE( TC ) ) | |
695 { | |
696 case TC_CPAP: | |
697 sig_tc_cpap_iaext_received ( rrgrr_iaext_ind); | |
698 break; | |
699 case TC_SINGLE_BLOCK: | |
700 case TC_PIM: | |
701 case TC_WAIT_ASSIGN: | |
702 case TC_POLLING: | |
703 case TC_WAIT_2P_ASSIGN: | |
704 case TC_CONTENTION_RESOLUTION: | |
705 case TC_TBF_ACTIVE: | |
706 | |
707 break; | |
708 default: | |
709 TRACE_ERROR( "sig_ctrl_tc_iaext_received unexpected" ); | |
710 break; | |
711 } | |
712 } /* sig_ctrl_tc_iaext_received() */ | |
713 | |
714 /* | |
715 +------------------------------------------------------------------------------ | |
716 | Function : sig_ctrl_tc_iarej_received | |
717 +------------------------------------------------------------------------------ | |
718 | Description : Handles the internal signal sig_ctrl_tc_iarej_received | |
719 | | |
720 | Parameters : - | |
721 | | |
722 +------------------------------------------------------------------------------ | |
723 */ | |
724 GLOBAL void sig_ctrl_tc_iarej_received(T_RRGRR_ASSIGNMENT_REJ_IND *rrgrr_assignment_rej_ind ) | |
725 { | |
726 TRACE_ISIG( "sig_ctrl_tc_iarej_received" ); | |
727 | |
728 switch( GET_STATE( TC ) ) | |
729 { | |
730 case TC_CPAP: | |
731 sig_tc_cpap_iarej_received(rrgrr_assignment_rej_ind); | |
732 if(grr_data->cc_running) | |
733 { | |
734 SET_STATE(TC,TC_ACCESS_DISABLED) | |
735 /* | |
736 * todo:why state change: grlc will be disabled by sending ctrl_tc_disable | |
737 */ | |
738 } | |
739 break; | |
740 case TC_SINGLE_BLOCK: | |
741 case TC_PIM: | |
742 case TC_WAIT_ASSIGN: | |
743 case TC_POLLING: | |
744 case TC_WAIT_2P_ASSIGN: | |
745 case TC_CONTENTION_RESOLUTION: | |
746 case TC_TBF_ACTIVE: | |
747 | |
748 break; | |
749 default: | |
750 TRACE_ERROR( "sig_ctrl_tc_iarej_received unexpected" ); | |
751 break; | |
752 } | |
753 | |
754 } /* sig_ctrl_tc_iarej_received() */ | |
755 | |
756 | |
757 /* | |
758 +------------------------------------------------------------------------------ | |
759 | Function : sig_ctrl_tc_ia_downlink_received | |
760 +------------------------------------------------------------------------------ | |
761 | Description : Handles the internal signal SIG_CTRL_TC_IA_DOWNLINK_RECEIVED | |
762 | | |
763 | Parameters : - | |
764 | | |
765 +------------------------------------------------------------------------------ | |
766 */ | |
767 GLOBAL void sig_ctrl_tc_ia_downlink_received (T_RRGRR_IA_DOWNLINK_IND *rrgrr_ia_downlink_in ) | |
768 { | |
769 TRACE_ISIG( "sig_ctrl_tc_ia_downlink_received" ); | |
770 | |
771 | |
772 switch( GET_STATE( TC ) ) | |
773 { | |
774 case TC_CPAP: | |
775 case TC_SINGLE_BLOCK: | |
776 case TC_PIM: | |
777 case TC_WAIT_ASSIGN: | |
778 case TC_CONTENTION_RESOLUTION: | |
779 case TC_TBF_ACTIVE: | |
780 sig_tc_cpap_ia_downlink_received(rrgrr_ia_downlink_in); | |
781 break; | |
782 default: | |
783 sig_tc_ctrl_send_stop_task_req( INVALID_MSG ); | |
784 TRACE_EVENT_P1( "sig_ctrl_tc_ia_downlink_received unexpected tc_state=%d", grr_data->tc.state); | |
785 TRACE_ERROR( "sig_ctrl_tc_ia_downlink_received unexpected" ); | |
786 break; | |
787 } | |
788 | |
789 } /* sig_ctrl_tc_ia_downlink_received() */ | |
790 | |
791 /* | |
792 +------------------------------------------------------------------------------ | |
793 | Function : sig_ctrl_tc_stop_task_cnf_received | |
794 +------------------------------------------------------------------------------ | |
795 | Description : Handles the internal signal SIG_CTRL_TC_STOP_TASK_CNF | |
796 | | |
797 | Parameters : | |
798 | | |
799 +------------------------------------------------------------------------------ | |
800 */ | |
801 GLOBAL void sig_ctrl_tc_stop_task_cnf_received ( void ) | |
802 { | |
803 TRACE_ISIG( "sig_ctrl_tc_stop_task_cnf_received" ); | |
804 | |
805 switch( GET_STATE( TC ) ) | |
806 { | |
807 case TC_CPAP: | |
808 case TC_PIM: | |
809 sig_tc_cpap_stop_task_cnf_received(); | |
810 break; | |
811 default: | |
812 TRACE_ERROR( "SIG_CTRL_TC_STOP_TASK_CNF unexpected" ); | |
813 break; | |
814 } | |
815 } /* sig_ctrl_tc_stop_task_cnf_received() */ | |
816 | |
817 /* | |
818 +------------------------------------------------------------------------------ | |
819 | Function : sig_cpap_tc_send_stop_task_req | |
820 +------------------------------------------------------------------------------ | |
821 | Description : Handles the internal signal SIG_CTRL_TC_STOP_TASK_REQ | |
822 | | |
823 | Parameters : | |
824 | | |
825 +------------------------------------------------------------------------------ | |
826 */ | |
827 GLOBAL void sig_cpap_tc_send_stop_task_req( UBYTE v_stop_ccch ) | |
828 { | |
829 TRACE_ISIG( "sig_cpap_tc_send_stop_task_req" ); | |
830 | |
831 sig_tc_ctrl_send_stop_task_req( v_stop_ccch ); | |
832 | |
833 } /* sig_cpap_tc_send_stop_task_req() */ | |
834 | |
835 /* | |
836 +------------------------------------------------------------------------------ | |
837 | Function : sig_cpap_tc_channel_req | |
838 +------------------------------------------------------------------------------ | |
839 | Description : Handles the internal signal SIG_CPAP_TC_CHANNEL_REQ | |
840 | | |
841 | Parameters : req_data - data which RR has to send | |
842 | | |
843 +------------------------------------------------------------------------------ | |
844 */ | |
845 GLOBAL void sig_cpap_tc_channel_req(UBYTE req_data ) | |
846 { | |
847 TRACE_ISIG( "sig_cpap_tc_channel_req" ); | |
848 | |
849 switch( GET_STATE( TC ) ) | |
850 { | |
851 case TC_CPAP: | |
852 sig_tc_ctrl_channel_req(req_data); | |
853 break; | |
854 default: | |
855 TRACE_ERROR( "sig_cpap_tc_channel_req unexpected" ); | |
856 break; | |
857 } | |
858 } /* sig_cpap_tc_channel_req() */ | |
859 | |
860 | |
861 /* | |
862 +------------------------------------------------------------------------------ | |
863 | Function : sig_cpap_tc_assign_sb | |
864 +------------------------------------------------------------------------------ | |
865 | Description : Handles the internal signal SIG_CPAP_TC_ASSIGN_SB | |
866 | | |
867 | Parameters : void | |
868 | | |
869 +------------------------------------------------------------------------------ | |
870 */ | |
871 GLOBAL void sig_cpap_tc_assign_sb(void *ptr2prim, UBYTE purpose) | |
872 { | |
873 TRACE_ISIG( "sig_cpap_tc_assign_sb" ); | |
874 | |
875 switch( GET_STATE( TC ) ) | |
876 { | |
877 case TC_CPAP: | |
878 if(TWO_PHASE_ACESS EQ purpose) | |
879 { | |
880 SET_STATE(TC,TC_WAIT_2P_ASSIGN); | |
881 } | |
882 else | |
883 { | |
884 SET_STATE(TC,TC_SINGLE_BLOCK); | |
885 } | |
886 | |
887 sig_tc_meas_update_pch( ); | |
888 | |
889 { | |
890 T_MPHP_SINGLE_BLOCK_REQ* mphp_single_block_req = ( T_MPHP_SINGLE_BLOCK_REQ* )ptr2prim; | |
891 | |
892 TRACE_BINDUMP | |
893 ( hCommGRR, TC_USER4, | |
894 cl_rlcmac_get_msg_name | |
895 ( ( UBYTE )( mphp_single_block_req->l2_frame[1] >> 2 ), RLC_MAC_ROUTE_UL ), | |
896 mphp_single_block_req->l2_frame, MAX_L2_FRAME_SIZE ); /*lint !e569*/ | |
897 } | |
898 | |
899 PSEND(hCommL1,ptr2prim); | |
900 break; | |
901 case TC_PIM: | |
902 if(SINGLE_BLOCK_TRANSFER_DL EQ purpose) | |
903 { | |
904 SET_STATE(TC,TC_SINGLE_BLOCK); | |
905 PSEND(hCommL1,ptr2prim); | |
906 } | |
907 else | |
908 { /* this shall never happen! */ | |
909 TRACE_ERROR("FATAL ERROR: single block assignment in wrong state!"); | |
910 PFREE(ptr2prim); | |
911 } | |
912 break; | |
913 default: | |
914 TRACE_ERROR( "sig_cpap_tc_assign_sb unexpected" ); | |
915 PFREE(ptr2prim); | |
916 break; | |
917 } | |
918 } /* sig_cpap_tc_assign_sb() */ | |
919 | |
920 /* | |
921 +------------------------------------------------------------------------------ | |
922 | Function : sig_ctrl_tc_pdch_assign_received | |
923 +------------------------------------------------------------------------------ | |
924 | Description : Handles the internal signal SIG_CTRL_TC_PDCH_ASSIGN_RECEIVED | |
925 | | |
926 | Parameters : fn - reception frame number | |
927 | | |
928 +------------------------------------------------------------------------------ | |
929 */ | |
930 GLOBAL void sig_ctrl_tc_pdch_assign_received( T_RRGRR_DATA_IND *rrgrr_data_ind ) | |
931 { | |
932 TRACE_ISIG( "sig_ctrl_tc_pdch_assign_received" ); | |
933 | |
934 switch( GET_STATE( TC ) ) | |
935 { | |
936 case TC_CPAP: | |
937 sig_tc_cpap_pdch_assign_received(rrgrr_data_ind); | |
938 break; | |
939 | |
940 case TC_SINGLE_BLOCK: | |
941 case TC_PIM: | |
942 case TC_WAIT_ASSIGN: | |
943 case TC_POLLING: | |
944 case TC_WAIT_2P_ASSIGN: | |
945 case TC_CONTENTION_RESOLUTION: | |
946 case TC_TBF_ACTIVE: | |
947 break; | |
948 default: | |
949 TRACE_ERROR( "sig_ctrl_tc_pdch_assign_received unexpected" ); | |
950 break; | |
951 } | |
952 } /* sig_ctrl_tc_pdch_assign_received() */ | |
953 | |
954 | |
955 /* | |
956 +------------------------------------------------------------------------------ | |
957 | Function : sig_cpap_tc_dcch_data_req | |
958 +------------------------------------------------------------------------------ | |
959 | Description : Handles the internal signal SIG_CPAP_TC_DCCH_DATA_REQ | |
960 | | |
961 | Parameters : pointer - to primitive with data | |
962 | | |
963 +------------------------------------------------------------------------------ | |
964 */ | |
965 GLOBAL void sig_cpap_tc_dcch_data_req( T_RRGRR_DATA_REQ * rrgrr_data_req_i ) | |
966 { | |
967 TRACE_ISIG( "sig_cpap_tc_dcch_data_req" ); | |
968 | |
969 switch( GET_STATE( TC ) ) | |
970 { | |
971 case TC_CPAP: | |
972 sig_tc_ctrl_dcch_data_req(rrgrr_data_req_i); | |
973 break; | |
974 default: | |
975 TRACE_ERROR( "sig_cpap_tc_dcch_data_req unexpected" ); | |
976 break; | |
977 } | |
978 } /* sig_cpap_tc_dcch_data_req() */ | |
979 | |
980 | |
981 /* | |
982 +------------------------------------------------------------------------------ | |
983 | Function : sig_cpap_tc_assign_pdch | |
984 +------------------------------------------------------------------------------ | |
985 | Description : Handles the internal signal SIG_CPAP_TC_ASSIGN_PDCH | |
986 | | |
987 | Parameters : void | |
988 | | |
989 +------------------------------------------------------------------------------ | |
990 */ | |
991 GLOBAL void sig_cpap_tc_assign_pdch(T_MPHP_ASSIGNMENT_REQ *ptr2prim, | |
992 T_PDCH_ASS_CAUSE cause ) | |
993 { | |
994 TRACE_ISIG( "sig_cpap_tc_assign_pdch" ); | |
995 | |
996 switch( GET_STATE( TC ) ) | |
997 { | |
998 case TC_CPAP: | |
999 grr_data->tc.dcch_present = FALSE; | |
1000 if( (PDCH_UL_ASS_CMD EQ cause) OR (PDCH_DL_ASS_CMD EQ cause) ) | |
1001 { | |
1002 grr_data->tc.dcch_present = TRUE; | |
1003 } | |
1004 | |
1005 PSEND(hCommL1,ptr2prim); | |
1006 break; | |
1007 case TC_PIM: | |
1008 grr_data->tc.dcch_present = FALSE; | |
1009 if((IA_UL EQ cause) OR (PDCH_UL_ASS_CMD EQ cause)) | |
1010 { | |
1011 PFREE(ptr2prim); | |
1012 TRACE_ERROR( "uplink assignments unexpected in PIM" ); | |
1013 } | |
1014 else | |
1015 { | |
1016 if((PDCH_DL_ASS_CMD EQ cause)) | |
1017 grr_data->tc.dcch_present = TRUE; | |
1018 | |
1019 PSEND(hCommL1,ptr2prim); | |
1020 } | |
1021 break; | |
1022 case TC_WAIT_ASSIGN: | |
1023 case TC_POLLING: | |
1024 case TC_WAIT_2P_ASSIGN: | |
1025 case TC_CONTENTION_RESOLUTION: | |
1026 case TC_TBF_ACTIVE: | |
1027 TRACE_ERROR( "sig_cpap_tc_assign_pdch unexpected" ); | |
1028 PFREE(ptr2prim); | |
1029 break; | |
1030 default: | |
1031 TRACE_ERROR( "sig_cpap_tc_assign_pdch unexpected" ); | |
1032 FREE(ptr2prim); | |
1033 break; | |
1034 } | |
1035 } /* sig_cpap_tc_assign_pdch() */ | |
1036 | |
1037 | |
1038 /* | |
1039 +------------------------------------------------------------------------------ | |
1040 | Function : sig_cpap_tc_suspend_dedi_chan | |
1041 +------------------------------------------------------------------------------ | |
1042 | Description : Handles the internal signal SIG_CPAP_TC_SUSPEND_DEDI_CHAN | |
1043 | | |
1044 | Parameters : void | |
1045 | | |
1046 +------------------------------------------------------------------------------ | |
1047 */ | |
1048 GLOBAL void sig_cpap_tc_suspend_dedi_chan(void ) | |
1049 { | |
1050 TRACE_ISIG( "sig_cpap_tc_suspend_dedi_chan" ); | |
1051 | |
1052 switch( GET_STATE( TC ) ) | |
1053 { | |
1054 case TC_CPAP: | |
1055 sig_tc_ctrl_suspend_dedi_chan(); | |
1056 break; | |
1057 case TC_SINGLE_BLOCK: | |
1058 case TC_PIM: | |
1059 case TC_WAIT_ASSIGN: | |
1060 case TC_POLLING: | |
1061 case TC_WAIT_2P_ASSIGN: | |
1062 case TC_CONTENTION_RESOLUTION: | |
1063 case TC_TBF_ACTIVE: | |
1064 TRACE_ERROR( "sig_cpap_tc_suspend_dedi_chan unexpected" ); | |
1065 | |
1066 break; | |
1067 default: | |
1068 TRACE_ERROR( "sig_cpap_tc_suspend_dedi_chan unexpected" ); | |
1069 break; | |
1070 } | |
1071 } /* sig_cpap_tc_suspend_dedi_chan() */ | |
1072 | |
1073 | |
1074 /* | |
1075 +------------------------------------------------------------------------------ | |
1076 | Function : sig_cpap_tc_resume_dedi_chan | |
1077 +------------------------------------------------------------------------------ | |
1078 | Description : Handles the internal signal SIG_CPAP_TC_RESUME_DEDI_CHAN | |
1079 | | |
1080 | Parameters : void | |
1081 | | |
1082 +------------------------------------------------------------------------------ | |
1083 */ | |
1084 GLOBAL void sig_cpap_tc_resume_dedi_chan(void ) | |
1085 { | |
1086 TRACE_ISIG( "sig_cpap_tc_resume_dedi_chan" ); | |
1087 | |
1088 switch( GET_STATE( TC ) ) | |
1089 { | |
1090 case TC_CPAP: | |
1091 sig_tc_ctrl_resume_dedi_chan(); | |
1092 break; | |
1093 case TC_SINGLE_BLOCK: | |
1094 case TC_PIM: | |
1095 case TC_WAIT_ASSIGN: | |
1096 case TC_POLLING: | |
1097 case TC_WAIT_2P_ASSIGN: | |
1098 case TC_CONTENTION_RESOLUTION: | |
1099 case TC_TBF_ACTIVE: | |
1100 TRACE_ERROR( "sig_cpap_tc_resume_dedi_chan unexpected" ); | |
1101 | |
1102 break; | |
1103 default: | |
1104 TRACE_ERROR( "sig_cpap_tc_resume_dedi_chan unexpected" ); | |
1105 break; | |
1106 } | |
1107 } /* sig_cpap_tc_resume_dedi_chan() */ | |
1108 | |
1109 | |
1110 /* | |
1111 +------------------------------------------------------------------------------ | |
1112 | Function : sig_cpap_tc_send_gprs_data_req | |
1113 +------------------------------------------------------------------------------ | |
1114 | Description : Handles the internal signal SIG_CPAP_TC_SEND_GPRS_DATA_REQ | |
1115 | | |
1116 | Parameters : void | |
1117 | | |
1118 +------------------------------------------------------------------------------ | |
1119 */ | |
1120 GLOBAL void sig_cpap_tc_send_gprs_data_req(T_RRGRR_GPRS_DATA_REQ *rrgrr_gprs_data_req) | |
1121 { | |
1122 TRACE_ISIG( "sig_cpap_tc_send_gprs_data_req" ); | |
1123 | |
1124 switch( GET_STATE( TC ) ) | |
1125 { | |
1126 case TC_CPAP: | |
1127 sig_tc_ctrl_gprs_data_req(rrgrr_gprs_data_req); | |
1128 break; | |
1129 case TC_SINGLE_BLOCK: | |
1130 case TC_PIM: | |
1131 case TC_WAIT_ASSIGN: | |
1132 case TC_POLLING: | |
1133 case TC_WAIT_2P_ASSIGN: | |
1134 case TC_CONTENTION_RESOLUTION: | |
1135 case TC_TBF_ACTIVE: | |
1136 TRACE_ERROR( "sig_cpap_tc_send_gprs_data_req unexpected" ); | |
1137 | |
1138 break; | |
1139 default: | |
1140 TRACE_ERROR( "sig_cpap_tc_send_gprs_data_req unexpected" ); | |
1141 break; | |
1142 } | |
1143 } /* sig_cpap_tc_send_gprs_data_req() */ | |
1144 | |
1145 | |
1146 /* | |
1147 +------------------------------------------------------------------------------ | |
1148 | Function : sig_ctrl_tc_suspend_dcch_cnf | |
1149 +------------------------------------------------------------------------------ | |
1150 | Description : Handles the internal signal SIG_CTRL_TC_SUSPEND_DCCH_CNF | |
1151 | | |
1152 | Parameters : void | |
1153 | | |
1154 +------------------------------------------------------------------------------ | |
1155 */ | |
1156 GLOBAL void sig_ctrl_tc_suspend_dcch_cnf(void) | |
1157 { | |
1158 TRACE_ISIG( "sig_ctrl_tc_suspend_dcch_cnf" ); | |
1159 | |
1160 switch( GET_STATE( TC ) ) | |
1161 { | |
1162 case TC_CPAP: | |
1163 sig_tc_cpap_suspend_dcch_cnf(); | |
1164 break; | |
1165 case TC_SINGLE_BLOCK: | |
1166 case TC_PIM: | |
1167 case TC_WAIT_ASSIGN: | |
1168 case TC_POLLING: | |
1169 case TC_WAIT_2P_ASSIGN: | |
1170 case TC_CONTENTION_RESOLUTION: | |
1171 case TC_TBF_ACTIVE: | |
1172 TRACE_ERROR( "sig_ctrl_tc_suspend_dcch_cnf unexpected" ); | |
1173 | |
1174 break; | |
1175 default: | |
1176 TRACE_ERROR( "sig_ctrl_tc_suspend_dcch_cnf unexpected" ); | |
1177 break; | |
1178 } | |
1179 } /* sig_ctrl_tc_suspend_dcch_cnf() */ | |
1180 | |
1181 /* | |
1182 +------------------------------------------------------------------------------ | |
1183 | Function : sig_cpap_tc_build_res_req | |
1184 +------------------------------------------------------------------------------ | |
1185 | Description : Handles the internal signal SIG_CPAP_TC_BUILD_RES_REQ | |
1186 | | |
1187 | Parameters : void | |
1188 | | |
1189 +------------------------------------------------------------------------------ | |
1190 */ | |
1191 GLOBAL void sig_cpap_tc_build_res_req(T_U_RESOURCE_REQ *ptr2res_req) | |
1192 { | |
1193 TRACE_ISIG( "sig_cpap_tc_build_res_req" ); | |
1194 | |
1195 switch( GET_STATE( TC ) ) | |
1196 { | |
1197 case TC_CPAP: | |
1198 tc_build_res_req( ptr2res_req, | |
1199 R_BUILD_2PHASE_ACCESS, | |
1200 SRC_TBF_INFO_IMM_ASSIGN ); | |
1201 break; | |
1202 case TC_SINGLE_BLOCK: | |
1203 case TC_PIM: | |
1204 case TC_WAIT_ASSIGN: | |
1205 case TC_POLLING: | |
1206 case TC_WAIT_2P_ASSIGN: | |
1207 case TC_CONTENTION_RESOLUTION: | |
1208 case TC_TBF_ACTIVE: | |
1209 default: | |
1210 TRACE_ERROR( "sig_cpap_tc_build_res_req unexpected" ); | |
1211 break; | |
1212 } | |
1213 } /* sig_cpap_tc_build_res_req() */ | |
1214 | |
1215 | |
1216 /* | |
1217 +------------------------------------------------------------------------------ | |
1218 | Function : sig_cpap_tc_ctrl_ptm | |
1219 +------------------------------------------------------------------------------ | |
1220 | Description : Handles the internal signal SIG_CPAP_TC_CTRL_PTM | |
1221 | | |
1222 | Parameters : void | |
1223 | | |
1224 +------------------------------------------------------------------------------ | |
1225 */ | |
1226 GLOBAL void sig_cpap_tc_ctrl_ptm(void) | |
1227 { | |
1228 TRACE_ISIG( "sig_cpap_tc_ctrl_ptm" ); | |
1229 | |
1230 switch( GET_STATE( TC ) ) | |
1231 { | |
1232 case TC_CPAP: | |
1233 case TC_PIM: | |
1234 sig_tc_ctrl_set_pckt_mode( GLBL_PCKT_MODE_TRANSFER, TASK_STOP_DUMMY_VALUE ); | |
1235 break; | |
1236 case TC_SINGLE_BLOCK: | |
1237 case TC_WAIT_ASSIGN: | |
1238 case TC_POLLING: | |
1239 case TC_WAIT_2P_ASSIGN: | |
1240 case TC_CONTENTION_RESOLUTION: | |
1241 case TC_TBF_ACTIVE: | |
1242 TRACE_ERROR( "sig_cpap_tc_ctrl_ptm unexpected" ); | |
1243 | |
1244 break; | |
1245 default: | |
1246 TRACE_ERROR( "sig_cpap_tc_ctrl_ptm unexpected" ); | |
1247 break; | |
1248 } | |
1249 } /* sig_cpap_tc_ctrl_ptm() */ | |
1250 | |
1251 | |
1252 | |
1253 /* | |
1254 +------------------------------------------------------------------------------ | |
1255 | Function : sig_gfp_tc_fix_alloc_ack_ptm | |
1256 +------------------------------------------------------------------------------ | |
1257 | Description : Handles the internal signal SIG_GFP_TC_FIX_ALLOC_ACK_PTM | |
1258 | | |
1259 | Parameters : void | |
1260 | | |
1261 +------------------------------------------------------------------------------ | |
1262 */ | |
1263 GLOBAL void sig_gfp_tc_fix_alloc_ack_ptm( void ) | |
1264 { | |
1265 MCAST(d_ul_ack,D_UL_ACK); | |
1266 TRACE_ISIG( "sig_ru_tc_fix_alloc_ack" ); | |
1267 | |
1268 grr_data->uplink_tbf.cs_mode = d_ul_ack->gprs_ul_ack_nack_info.chan_coding_cmd; | |
1269 | |
1270 switch( GET_STATE( TC ) ) | |
1271 { | |
1272 case TC_CONTENTION_RESOLUTION: | |
1273 case TC_TBF_ACTIVE: | |
1274 if(d_ul_ack->gprs_ul_ack_nack_info.v_f_alloc_ack EQ 0 ) | |
1275 { | |
1276 /* | |
1277 * if no fix alloc is present in last uplink ack/nack, delete any existing repeat alloc | |
1278 */ | |
1279 if(grr_data->tc.fa_ctrl.fa_type EQ FA_REPEAT) | |
1280 { | |
1281 /*kill reapeat alloc, which is not yet started*/ | |
1282 grr_data->tc.fa_ctrl.fa_type = FA_NO_NEXT; | |
1283 grr_data->tc.fa_ctrl.repeat_alloc = FALSE; | |
1284 tc_send_ul_repeat_alloc_req(); | |
1285 } | |
1286 else if(grr_data->tc.fa_ctrl.fa_type EQ FA_NO_NEXT AND | |
1287 grr_data->tc.fa_ctrl.repeat_alloc EQ TRUE ) | |
1288 { | |
1289 if(!grr_check_if_tbf_start_is_elapsed ( grr_data->tc.fa_ctrl.current_alloc.alloc_start_fn, grr_data->ul_fn)) | |
1290 /*grr_data->tc.fa_ctrl.ul_res_remain EQ grr_data->tc.fa_ctrl.current_alloc.ul_res_sum*/ | |
1291 { | |
1292 /*kill reapeat alloc if is not yet started*/ | |
1293 grr_data->tc.fa_ctrl.fa_type = FA_NO_CURRENT; | |
1294 grr_data->tc.fa_ctrl.repeat_alloc = FALSE; | |
1295 tc_send_ul_repeat_alloc_req(); | |
1296 } | |
1297 } | |
1298 return; | |
1299 } | |
1300 | |
1301 /* | |
1302 * check if current allocation is active | |
1303 */ | |
1304 if(grr_data->tc.fa_ctrl.fa_type EQ FA_NO_CURRENT AND | |
1305 d_ul_ack->gprs_ul_ack_nack_info.f_alloc_ack.v_ts_overr ) | |
1306 { | |
1307 ULONG next_start_fn; | |
1308 ULONG next_end_fn; | |
1309 /* repeat allocation in packet uplink ack/nack received, | |
1310 * no fixed allocation active, find out the next natural boundary | |
1311 * and store new allocation in current allocation | |
1312 */ | |
1313 grr_data->tc.fa_ctrl.fa_type = FA_NO_NEXT; | |
1314 grr_data->tc.fa_ctrl.repeat_alloc = TRUE; | |
1315 grr_data->tc.fa_ctrl.ts_overr = d_ul_ack->gprs_ul_ack_nack_info.f_alloc_ack.ts_overr; | |
1316 tc_set_fa_bitmap((UBYTE)(d_ul_ack->gprs_ul_ack_nack_info.f_alloc_ack.ts_overr & grr_data->uplink_tbf.ts_usage), | |
1317 &grr_data->tc.fa_ctrl.current_alloc); | |
1318 /*find start of alloc (natural boundary of next allocation)*/ | |
1319 next_end_fn = grr_data->tc.fa_ctrl.current_alloc.alloc_end_fn; | |
1320 do | |
1321 { | |
1322 USHORT len; | |
1323 len = grr_data->tc.fa_ctrl.current_alloc.alloc.size_bitmap-1; | |
1324 next_start_fn = grr_decode_tbf_start_rel(next_end_fn,0); | |
1325 next_end_fn = grr_decode_tbf_start_rel(next_start_fn,(USHORT)(len-1)); | |
1326 if(grr_data->ul_fn EQ next_start_fn) | |
1327 break; | |
1328 else if((next_end_fn > next_start_fn) AND | |
1329 (grr_data->ul_fn <= next_start_fn) AND | |
1330 (grr_data->ul_fn > next_start_fn) ) | |
1331 { | |
1332 next_start_fn = grr_decode_tbf_start_rel(next_end_fn,0); | |
1333 next_end_fn = grr_decode_tbf_start_rel(next_start_fn,(USHORT)(len-1)); | |
1334 break; | |
1335 } | |
1336 else if( (next_end_fn < next_start_fn) AND | |
1337 ( | |
1338 ((next_end_fn >= grr_data->ul_fn) AND (next_start_fn > grr_data->ul_fn)) OR | |
1339 ((next_end_fn < grr_data->ul_fn) AND (next_start_fn < grr_data->ul_fn)) | |
1340 ) | |
1341 ) | |
1342 { | |
1343 next_start_fn = grr_decode_tbf_start_rel(next_end_fn,0); | |
1344 next_end_fn = grr_decode_tbf_start_rel(next_start_fn,(USHORT)(len-1)); | |
1345 break; | |
1346 } | |
1347 } | |
1348 while (1); | |
1349 grr_data->tc.fa_ctrl.current_alloc.alloc_start_fn = next_start_fn; | |
1350 grr_data->tc.fa_ctrl.current_alloc.alloc_end_fn = next_end_fn; | |
1351 tc_send_ul_repeat_alloc_req(); | |
1352 return; | |
1353 } | |
1354 else if(d_ul_ack->gprs_ul_ack_nack_info.f_alloc_ack.v_ts_overr ) | |
1355 { | |
1356 UBYTE len; | |
1357 /* repeat allocation in packet uplink ack/nack received, | |
1358 * current allocation is active, store new alloc in next alloc | |
1359 * overwriting is possibe. | |
1360 */ | |
1361 grr_data->tc.fa_ctrl.fa_type = FA_REPEAT; | |
1362 grr_data->tc.fa_ctrl.repeat_alloc = TRUE; | |
1363 grr_data->tc.fa_ctrl.ts_overr = d_ul_ack->gprs_ul_ack_nack_info.f_alloc_ack.ts_overr; | |
1364 tc_set_fa_bitmap((UBYTE)(d_ul_ack->gprs_ul_ack_nack_info.f_alloc_ack.ts_overr & grr_data->uplink_tbf.ts_usage),&grr_data->tc.fa_ctrl.current_alloc); | |
1365 | |
1366 grr_data->tc.fa_ctrl.current_alloc.alloc_start_fn = | |
1367 grr_decode_tbf_start_rel(grr_data->tc.fa_ctrl.current_alloc.alloc_end_fn,0); | |
1368 len = grr_data->tc.fa_ctrl.current_alloc.alloc.size_bitmap-1; | |
1369 grr_data->tc.fa_ctrl.current_alloc.alloc_end_fn = | |
1370 grr_decode_tbf_start_rel(grr_data->tc.fa_ctrl.current_alloc.alloc_start_fn, | |
1371 (USHORT)(len-1)); | |
1372 tc_send_ul_repeat_alloc_req(); | |
1373 return; | |
1374 } | |
1375 grr_data->tc.fa_ctrl.repeat_alloc = FALSE; | |
1376 if( d_ul_ack->gprs_ul_ack_nack_info.f_alloc_ack.v_fa_s2 ) | |
1377 { | |
1378 /* | |
1379 * new fixed allocation with allocation bitmap | |
1380 */ | |
1381 if(d_ul_ack->gprs_ul_ack_nack_info.f_alloc_ack.fa_s2.v_ts_alloc) | |
1382 { | |
1383 UBYTE tx_slots; | |
1384 tx_slots = grr_calc_nr_of_set_bits (d_ul_ack->gprs_ul_ack_nack_info.f_alloc_ack.fa_s2.ts_alloc); | |
1385 grr_data->uplink_tbf.nts = tx_slots; | |
1386 grr_data->uplink_tbf.ts_usage = d_ul_ack->gprs_ul_ack_nack_info.f_alloc_ack.fa_s2.ts_alloc; | |
1387 if(!handle_ms_cap(UL_ASSIGNMENT)) | |
1388 { | |
1389 TRACE_ERROR( "TS_ALLOC not valid" ); | |
1390 return; | |
1391 } | |
1392 } | |
1393 tc_handle_tbf_start(CGRLC_TBF_MODE_UL); | |
1394 } | |
1395 else | |
1396 { | |
1397 TRACE_EVENT("NO FIX ALLOC STRUCT IN D_UL_ACK " ); | |
1398 } | |
1399 break; | |
1400 default: | |
1401 TRACE_ERROR( "sig_ru_tc_fix_alloc_ack unexpected" ); | |
1402 break; | |
1403 } | |
1404 | |
1405 | |
1406 | |
1407 } /* sig_gfp_tc_fix_alloc_ack_ptm() */ | |
1408 | |
1409 | |
1410 | |
1411 /* | |
1412 +------------------------------------------------------------------------------ | |
1413 | Function : sig_ctrl_tc_reconnect_cnf | |
1414 +------------------------------------------------------------------------------ | |
1415 | Description : Cell reselection has failled and we have to inform cpap | |
1416 | | |
1417 | Parameters : void | |
1418 | | |
1419 +------------------------------------------------------------------------------ | |
1420 */ | |
1421 | |
1422 GLOBAL void sig_ctrl_tc_reconnect_dcch_cnf() | |
1423 { | |
1424 TRACE_ISIG( "sig_ctrl_tc_reconnect_cnf" ); | |
1425 switch( GET_STATE( TC ) ) | |
1426 { | |
1427 case TC_CONTENTION_RESOLUTION: | |
1428 case TC_TBF_ACTIVE: | |
1429 case TC_WAIT_ASSIGN: | |
1430 SET_STATE(TC, TC_ACCESS_DISABLED); | |
1431 sig_tc_cpap_reconnect_ind(); | |
1432 break; | |
1433 default: | |
1434 TRACE_ERROR( "sig_ctrl_tc_reconnect_cnf unexpected" ); | |
1435 } | |
1436 } | |
1437 /*sig_ctrl_tc_reconnect_dcch_cnf()*/ | |
1438 | |
1439 /* | |
1440 +------------------------------------------------------------------------------ | |
1441 | Function : sig_ctrl_tc_cr_timerout_cnf | |
1442 +------------------------------------------------------------------------------ | |
1443 | Description : Cell reselection has failled because of timer out | |
1444 | | |
1445 | Parameters : void | |
1446 | | |
1447 +------------------------------------------------------------------------------ | |
1448 */ | |
1449 | |
1450 GLOBAL void sig_ctrl_tc_cr_timerout_cnf() | |
1451 { | |
1452 TRACE_ISIG( "sig_ctrl_tc_cr_timerout_cnf" ); | |
1453 switch( GET_STATE( TC ) ) | |
1454 { | |
1455 case TC_CONTENTION_RESOLUTION: | |
1456 case TC_TBF_ACTIVE: | |
1457 case TC_WAIT_ASSIGN: | |
1458 tc_abort_tbf(grr_data->tbf_type); | |
1459 SET_STATE(TC, TC_ACCESS_DISABLED); | |
1460 sig_tc_cpap_reconnect_ind(); | |
1461 break; | |
1462 default: | |
1463 TRACE_ERROR( "sig_ctrl_cr_timerout_cnf unexpected" ); | |
1464 } | |
1465 | |
1466 | |
1467 }/*sig_ctrl_tc_cr_timerout_cnf()*/ | |
1468 | |
1469 | |
1470 | |
1471 /* | |
1472 +------------------------------------------------------------------------------ | |
1473 | Function : sig_ctrl_tc_abnorm_rel_with_cr_failed | |
1474 +------------------------------------------------------------------------------ | |
1475 | Description : Handles the internal signal | |
1476 | SIG_CTRL_TC_ABNORM_REL_WITH_CR_FAILED | |
1477 | | |
1478 | Parameters : | |
1479 | | |
1480 +------------------------------------------------------------------------------ | |
1481 */ | |
1482 GLOBAL BOOL sig_ctrl_tc_abnorm_rel_with_cr_failed ( BOOL cell_has_changed ) | |
1483 { | |
1484 TRACE_ISIG( "sig_ctrl_tc_abnorm_rel_with_cr_failed" ); | |
1485 | |
1486 switch( GET_STATE( TC ) ) | |
1487 { | |
1488 case TC_ACCESS_DISABLED: | |
1489 SET_STATE_TC_PIM_AFTER_ACCESS_DISABLED | |
1490 ( cell_has_changed, CGRLC_ENAC_ABNORM_RELEASE_CRESELECT_FAILED ); | |
1491 break; | |
1492 | |
1493 default: | |
1494 TRACE_ERROR( "SIG_CTRL_TC_ABNORM_REL_WITH_CR_FAILED unexpected" ); | |
1495 break; | |
1496 } | |
1497 | |
1498 return( TRUE ); | |
1499 } /* sig_ctrl_tc_abnorm_rel_with_cr_failed() */ | |
1500 | |
1501 | |
1502 | |
1503 /* | |
1504 +------------------------------------------------------------------------------ | |
1505 | Function : sig_cpap_tc_start_T3142 | |
1506 +------------------------------------------------------------------------------ | |
1507 | Description : Handles the internal signal SIG_CPAP_TC_START_T3142, | |
1508 | | |
1509 | Parameters : void | |
1510 | | |
1511 +------------------------------------------------------------------------------ | |
1512 */ | |
1513 GLOBAL void sig_cpap_tc_start_T3142(ULONG wait) | |
1514 { | |
1515 TRACE_ISIG( "sig_cpap_tc_start_T3142" ); | |
1516 | |
1517 tc_start_timer_t3172(wait); | |
1518 sig_tc_ctrl_t3172_running(); | |
1519 | |
1520 } /* sig_cpap_tc_start_T3142 */ | |
1521 | |
1522 | |
1523 | |
1524 /* | |
1525 +------------------------------------------------------------------------------ | |
1526 | Function : sig_cpap_tc_stop_T3142 | |
1527 +------------------------------------------------------------------------------ | |
1528 | Description : Handles the internal signal SIG_CPAP_TC_STOP_T3142, | |
1529 | | |
1530 | Parameters : void | |
1531 | | |
1532 +------------------------------------------------------------------------------ | |
1533 */ | |
1534 GLOBAL void sig_cpap_tc_stop_T3142(void) | |
1535 { | |
1536 TRACE_ISIG( "sig_cpap_tc_stop_T3142" ); | |
1537 | |
1538 | |
1539 } /* sig_cpap_tc_stop_T3142 */ | |
1540 | |
1541 | |
1542 | |
1543 | |
1544 /* | |
1545 +------------------------------------------------------------------------------ | |
1546 | Function : sig_ctrl_tc_disable_prim_queue | |
1547 +------------------------------------------------------------------------------ | |
1548 | Description : Handles the internal signal SIG_CTRL_TC_DISABLE_PRIM_QUEUE | |
1549 | | |
1550 | Parameters : void | |
1551 | | |
1552 +------------------------------------------------------------------------------ | |
1553 */ | |
1554 GLOBAL BOOL sig_ctrl_tc_disable_prim_queue ( BOOL cell_has_changed ) | |
1555 { | |
1556 TRACE_EVENT( "sig_ctrl_tc_disable_prim_queue" ); | |
1557 | |
1558 switch( GET_STATE( TC ) ) | |
1559 { | |
1560 case TC_ACCESS_DISABLED: | |
1561 SET_STATE_TC_PIM_AFTER_ACCESS_DISABLED( cell_has_changed, | |
1562 CGRLC_ENAC_NORMAL ); | |
1563 break; | |
1564 default: | |
1565 TRACE_ERROR( "SIG_CTRL_TC_DISABLE_PRIM_QUEUE unexpected" ); | |
1566 break; | |
1567 } | |
1568 | |
1569 return( TRUE); | |
1570 } /* sig_ctrl_tc_disable_prim_queue() */ | |
1571 | |
1572 | |
1573 | |
1574 | |
1575 | |
1576 /* | |
1577 +------------------------------------------------------------------------------ | |
1578 | Function : sig_meas_tc_update_ta_req | |
1579 +------------------------------------------------------------------------------ | |
1580 | Description : Handles the internal signal SIG_MEAS_TC_UPDATE_TA_REQ. | |
1581 | New TA values are received, it shall passed to l1 | |
1582 | | |
1583 | Parameters : | |
1584 | | |
1585 +------------------------------------------------------------------------------ | |
1586 */ | |
1587 GLOBAL void sig_meas_tc_update_ta_req ( void) | |
1588 { | |
1589 MCAST(d_ctrl_pwr_ta,D_CTRL_PWR_TA); /* T_D_CTRL_PWR_TA */ | |
1590 | |
1591 TRACE_FUNCTION( "tc_send_reconf_tbf_ta_req" ); | |
1592 | |
1593 TRACE_EVENT_P9("TAU: %d tav=%d - %d %d %d - %d %d %d tbf_type=%d" | |
1594 ,d_ctrl_pwr_ta->gpta.v_ta_value | |
1595 ,d_ctrl_pwr_ta->gpta.ta_value | |
1596 ,d_ctrl_pwr_ta->gpta.v_ul_ta_index | |
1597 ,d_ctrl_pwr_ta->gpta.ul_ta_index | |
1598 ,d_ctrl_pwr_ta->gpta.ul_ta_tn | |
1599 ,d_ctrl_pwr_ta->gpta.v_dl_ta_index | |
1600 ,d_ctrl_pwr_ta->gpta.dl_ta_index | |
1601 ,d_ctrl_pwr_ta->gpta.dl_ta_tn | |
1602 ,grr_data->tbf_type ); | |
1603 switch(grr_data->tbf_type) | |
1604 { | |
1605 case CGRLC_TBF_MODE_DL_UL: | |
1606 { | |
1607 PALLOC(mphp_timing_advance_req,MPHP_TIMING_ADVANCE_REQ);/* T_MPHP_TIMING_ADVANCE_REQ */ | |
1608 mphp_timing_advance_req->assign_id = 0; | |
1609 grr_handle_ta ( d_ctrl_pwr_ta->gpta.v_ta_value, | |
1610 d_ctrl_pwr_ta->gpta.ta_value, | |
1611 d_ctrl_pwr_ta->gpta.v_ul_ta_index, | |
1612 d_ctrl_pwr_ta->gpta.ul_ta_index, | |
1613 d_ctrl_pwr_ta->gpta.ul_ta_tn, | |
1614 d_ctrl_pwr_ta->gpta.v_dl_ta_index, | |
1615 d_ctrl_pwr_ta->gpta.dl_ta_index, | |
1616 d_ctrl_pwr_ta->gpta.dl_ta_tn, | |
1617 &mphp_timing_advance_req->p_timing_advance); | |
1618 PSEND(hCommL1,mphp_timing_advance_req); | |
1619 } | |
1620 break; | |
1621 case CGRLC_TBF_MODE_DL: | |
1622 { | |
1623 PALLOC(mphp_timing_advance_req,MPHP_TIMING_ADVANCE_REQ);/* T_MPHP_TIMING_ADVANCE_REQ */ | |
1624 mphp_timing_advance_req->assign_id = 0; | |
1625 if(d_ctrl_pwr_ta->gpta.v_ul_ta_index) | |
1626 { | |
1627 d_ctrl_pwr_ta->gpta.v_ul_ta_index = 0; | |
1628 TRACE_EVENT("TAU: only dl tbf is running, ul ta index present"); | |
1629 } | |
1630 if(!d_ctrl_pwr_ta->gpta.v_dl_ta_index) | |
1631 { | |
1632 TRACE_EVENT("TAU: only dl tbf is running, no dl ta index present"); | |
1633 } | |
1634 grr_handle_ta ( d_ctrl_pwr_ta->gpta.v_ta_value, | |
1635 d_ctrl_pwr_ta->gpta.ta_value, | |
1636 d_ctrl_pwr_ta->gpta.v_ul_ta_index, | |
1637 d_ctrl_pwr_ta->gpta.ul_ta_index, | |
1638 d_ctrl_pwr_ta->gpta.ul_ta_tn, | |
1639 d_ctrl_pwr_ta->gpta.v_dl_ta_index, | |
1640 d_ctrl_pwr_ta->gpta.dl_ta_index, | |
1641 d_ctrl_pwr_ta->gpta.dl_ta_tn, | |
1642 &mphp_timing_advance_req->p_timing_advance); | |
1643 PSEND(hCommL1,mphp_timing_advance_req); | |
1644 } | |
1645 break; | |
1646 case CGRLC_TBF_MODE_UL: | |
1647 { | |
1648 PALLOC(mphp_timing_advance_req,MPHP_TIMING_ADVANCE_REQ);/* T_MPHP_TIMING_ADVANCE_REQ */ | |
1649 mphp_timing_advance_req->assign_id = 0; | |
1650 if(d_ctrl_pwr_ta->gpta.v_dl_ta_index) | |
1651 { | |
1652 d_ctrl_pwr_ta->gpta.v_dl_ta_index = 0; | |
1653 TRACE_EVENT("TAU: only ul tbf is running, dl ta index present"); | |
1654 } | |
1655 if(!d_ctrl_pwr_ta->gpta.v_ul_ta_index) | |
1656 { | |
1657 TRACE_EVENT("TAU: only ul tbf is running, no ul ta index present"); | |
1658 } | |
1659 grr_handle_ta ( d_ctrl_pwr_ta->gpta.v_ta_value, | |
1660 d_ctrl_pwr_ta->gpta.ta_value, | |
1661 d_ctrl_pwr_ta->gpta.v_ul_ta_index, | |
1662 d_ctrl_pwr_ta->gpta.ul_ta_index, | |
1663 d_ctrl_pwr_ta->gpta.ul_ta_tn, | |
1664 d_ctrl_pwr_ta->gpta.v_dl_ta_index, | |
1665 d_ctrl_pwr_ta->gpta.dl_ta_index, | |
1666 d_ctrl_pwr_ta->gpta.dl_ta_tn, | |
1667 &mphp_timing_advance_req->p_timing_advance); | |
1668 PSEND(hCommL1,mphp_timing_advance_req); | |
1669 } | |
1670 break; | |
1671 default: | |
1672 TRACE_ERROR ( "sig_meas_tc_update_ta_req: TBF type is invalid" ); | |
1673 TRACE_EVENT_P1 ( "TBF type = %d",grr_data->tbf_type ); | |
1674 break; | |
1675 } | |
1676 } /* sig_meas_tc_update_ta_req() */ | |
1677 | |
1678 | |
1679 /* | |
1680 +------------------------------------------------------------------------------ | |
1681 | Function : sig_gfp_tc_update_ta_req_ptm | |
1682 +------------------------------------------------------------------------------ | |
1683 | Description : Handles the internal signal SIG_GFP_TC_UPDATE_TA_REQ_PTM. | |
1684 | New TA values are received, it shall passed to l1 | |
1685 | | |
1686 | Parameters : | |
1687 | | |
1688 +------------------------------------------------------------------------------ | |
1689 */ | |
1690 GLOBAL void sig_gfp_tc_update_ta_req_ptm ( void) | |
1691 { | |
1692 MCAST(d_ul_ack,D_UL_ACK); | |
1693 PALLOC(mphp_timing_advance_req,MPHP_TIMING_ADVANCE_REQ);/* T_MPHP_TIMING_ADVANCE_REQ */ | |
1694 | |
1695 TRACE_FUNCTION( "tc_send_reconf_tbf_ta_req" ); | |
1696 | |
1697 mphp_timing_advance_req->assign_id = 0; | |
1698 | |
1699 grr_handle_ta ( d_ul_ack->gprs_ul_ack_nack_info.pta.v_ta_value, | |
1700 d_ul_ack->gprs_ul_ack_nack_info.pta.ta_value, | |
1701 d_ul_ack->gprs_ul_ack_nack_info.pta.v_ta_index_tn, | |
1702 d_ul_ack->gprs_ul_ack_nack_info.pta.ta_index_tn.ta_index, | |
1703 d_ul_ack->gprs_ul_ack_nack_info.pta.ta_index_tn.ta_tn, | |
1704 0xFF, | |
1705 0, | |
1706 0, | |
1707 &mphp_timing_advance_req->p_timing_advance); | |
1708 PSEND(hCommL1,mphp_timing_advance_req); | |
1709 } /* sig_gfp_tc_update_ta_req_ptm() */ | |
1710 | |
1711 | |
1712 /* | |
1713 +------------------------------------------------------------------------------ | |
1714 | Function : sig_ctrl_tc_enter_pam | |
1715 +------------------------------------------------------------------------------ | |
1716 | Description : Handles the internal signal SIG_CTRL_TC_ENTER_PAM. | |
1717 | | |
1718 | Parameters : | |
1719 | | |
1720 +------------------------------------------------------------------------------ | |
1721 */ | |
1722 GLOBAL void sig_ctrl_tc_enter_pam ( void ) | |
1723 { | |
1724 TRACE_ISIG( "sig_ctrl_tc_enter_pam" ); | |
1725 | |
1726 switch( GET_STATE( TC ) ) | |
1727 { | |
1728 case TC_WAIT_STOP_TASK_CNF: | |
1729 if( grr_is_pbcch_present( ) ) | |
1730 { | |
1731 if( grr_data->tc.last_eval_assign.tbf_type EQ CGRLC_TBF_MODE_DL ) | |
1732 { | |
1733 sig_tc_ctrl_set_pckt_mode( GLBL_PCKT_MODE_ASSIGNED, | |
1734 grr_data->tc.last_eval_assign.ccch_read ); | |
1735 } | |
1736 else | |
1737 { | |
1738 SET_STATE( TC, TC_WAIT_ASSIGN ); | |
1739 vsi_t_start( GRR_handle, T3186, T3186_VALUE ); | |
1740 tc_send_ra_req( ); | |
1741 } | |
1742 } | |
1743 else | |
1744 { | |
1745 SET_STATE( TC, TC_CPAP ); | |
1746 sig_tc_cpap_acc_req( ); | |
1747 } | |
1748 break; | |
1749 | |
1750 default: | |
1751 TRACE_ERROR( "SIG_CTRL_TC_ENTER_PAM unexpected" ); | |
1752 break; | |
1753 } | |
1754 } /* sig_ctrl_tc_enter_pam() */ | |
1755 | |
1756 /* | |
1757 +------------------------------------------------------------------------------ | |
1758 | Function : sig_ctrl_tc_leave_to_ptm | |
1759 +------------------------------------------------------------------------------ | |
1760 | Description : Handles the internal signal SIG_CTRL_TC_LEAVE_TO_PTM | |
1761 | | |
1762 | Parameters : | |
1763 | | |
1764 +------------------------------------------------------------------------------ | |
1765 */ | |
1766 GLOBAL void sig_ctrl_tc_leave_to_ptm ( void ) | |
1767 { | |
1768 TRACE_ISIG( "sig_ctrl_tc_leave_to_ptm" ); | |
1769 | |
1770 switch( GET_STATE( TC ) ) | |
1771 { | |
1772 case TC_WAIT_STOP_TASK_CNF: | |
1773 tc_mfree_assign( TRUE ); | |
1774 | |
1775 #ifdef _SIMULATION_ | |
1776 | |
1777 switch( grr_data->tc.last_eval_assign.state ) | |
1778 { | |
1779 case TC_ACCESS_DISABLED : SET_STATE( TC, TC_ACCESS_DISABLED ); break; | |
1780 case TC_CPAP : SET_STATE( TC, TC_CPAP ); break; | |
1781 case TC_PIM : SET_STATE( TC, TC_PIM ); break; | |
1782 case TC_WAIT_ASSIGN : SET_STATE( TC, TC_WAIT_ASSIGN ); break; | |
1783 case TC_POLLING : SET_STATE( TC, TC_POLLING ); break; | |
1784 case TC_WAIT_2P_ASSIGN : SET_STATE( TC, TC_WAIT_2P_ASSIGN ); break; | |
1785 case TC_CONTENTION_RESOLUTION: SET_STATE( TC, TC_CONTENTION_RESOLUTION ); break; | |
1786 case TC_TBF_ACTIVE : SET_STATE( TC, TC_TBF_ACTIVE); break; | |
1787 case TC_SINGLE_BLOCK : SET_STATE( TC, TC_SINGLE_BLOCK); break; | |
1788 case TC_WAIT_STOP_TASK_CNF : SET_STATE( TC, TC_WAIT_STOP_TASK_CNF); break; | |
1789 | |
1790 default: | |
1791 SET_STATE( TC, grr_data->tc.last_eval_assign.state ); | |
1792 TRACE_ERROR( "sig_ctrl_tc_leave_to_ptm: unknown TC state" ); | |
1793 break; | |
1794 } | |
1795 | |
1796 #else /* #ifdef _SIMULATION_ */ | |
1797 | |
1798 SET_STATE( TC, grr_data->tc.last_eval_assign.state ); | |
1799 | |
1800 #endif /* #ifdef _SIMULATION_ */ | |
1801 | |
1802 tc_handle_tbf_start( grr_data->tc.last_eval_assign.tbf_type ); | |
1803 break; | |
1804 | |
1805 default: | |
1806 TRACE_ERROR( "SIG_CTRL_TC_LEAVE_TO_PTM unexpected" ); | |
1807 break; | |
1808 } | |
1809 } /* sig_ctrl_tc_leave_to_ptm() */ | |
1810 | |
1811 /* | |
1812 +------------------------------------------------------------------------------ | |
1813 | Function : sig_ctrl_tc_leave_to_pim | |
1814 +------------------------------------------------------------------------------ | |
1815 | Description : Handles the internal signal SIG_CTRL_TC_LEAVE_TO_PIM | |
1816 | | |
1817 | Parameters : | |
1818 | | |
1819 +------------------------------------------------------------------------------ | |
1820 */ | |
1821 GLOBAL void sig_ctrl_tc_leave_to_pim ( void ) | |
1822 { | |
1823 TRACE_ISIG( "sig_ctrl_tc_leave_to_pim" ); | |
1824 | |
1825 tc_send_tbf_release_req( grr_data->tc.last_tbf_type, FALSE ); | |
1826 | |
1827 } /* sig_ctrl_tc_leave_to_pim() */ | |
1828 | |
1829 | |
1830 | |
1831 /* | |
1832 +------------------------------------------------------------------------------ | |
1833 | Function : sig_gfp_tc_access_rej_ptm | |
1834 +------------------------------------------------------------------------------ | |
1835 | Description : Handles the signal SIG_GFP_TC_ACCESS_REJ_PTM | |
1836 | | |
1837 | Parameters : - | |
1838 | | |
1839 +------------------------------------------------------------------------------ | |
1840 */ | |
1841 GLOBAL void sig_gfp_tc_access_rej_ptm ( void ) | |
1842 { | |
1843 ULONG t3172_value=0; | |
1844 | |
1845 TRACE_ISIG( "sig_gfp_tc_access_rej_ptm" ); | |
1846 TRACE_EVENT("ACC REJ PACCH" ); | |
1847 | |
1848 | |
1849 switch(grr_data->tbf_type) | |
1850 { | |
1851 case CGRLC_TBF_MODE_UL: | |
1852 /* | |
1853 * wait for the end of the current UL TBF | |
1854 */ | |
1855 if(grr_t_status( T3172_1 ) EQ 0) | |
1856 { | |
1857 TRACE_EVENT("Return to idle mode after release of DA"); | |
1858 | |
1859 #if defined REL99 AND defined TI_PS_FF_TBF_EST_PACCH | |
1860 if(grr_data->tc.tbf_est_pacch AND grr_t_status( T3170) EQ 0 ) | |
1861 { | |
1862 /* GRLC has sent PCA or PRR. PAR received before PUA */ | |
1863 vsi_t_start(GRR_handle,T3170,tc_get_t3170_value()); | |
1864 | |
1865 } | |
1866 #endif | |
1867 } | |
1868 | |
1869 /*lint -fallthrough*/ | |
1870 | |
1871 case CGRLC_TBF_MODE_DL_UL: | |
1872 | |
1873 /* | |
1874 * UL TBF ends before the number of requested octets has been transferred, as if FINAL_ALLOCATION bit | |
1875 * go to idle mode after release | |
1876 * stop 3168 | |
1877 * check 3172 | |
1878 * Before initiating a new packet access procedure the mobile station shall decode the | |
1879 * PRACH Control Parameters if they are broadcast. | |
1880 */ | |
1881 | |
1882 if(grr_data->uplink_tbf.mac_mode EQ FIXED_ALLOCATION) | |
1883 { | |
1884 tc_abort_tbf(CGRLC_TBF_MODE_UL); /* abort UL TBF*/ | |
1885 | |
1886 } | |
1887 else if(grr_t_status( T3172_1 ) EQ 0 ) | |
1888 { | |
1889 ; | |
1890 } | |
1891 | |
1892 /*lint -fallthrough*/ | |
1893 | |
1894 case CGRLC_TBF_MODE_DL: | |
1895 if(grr_t_status( T3172_1 ) EQ 0 ) | |
1896 { | |
1897 TRACE_EVENT("CGRLC_TBF_MODE_DL, T3172_1 is not running"); | |
1898 /* | |
1899 * primtive is delted if prim_status is set, status indication is sent to higher layers | |
1900 */ | |
1901 tc_cgrlc_ul_tbf_res(CGRLC_TBF_MODE_ACCESS_FAILED,CGRLC_PRIM_STATUS_ONE); | |
1902 switch( tc_eval_access_rej(&t3172_value) ) | |
1903 { | |
1904 case E_ACCESS_REJ_WAIT: | |
1905 tc_start_timer_t3172( t3172_value ); | |
1906 sig_tc_ctrl_t3172_running(); | |
1907 break; | |
1908 case E_ACCESS_REJ_NO_WAIT: | |
1909 TRACE_EVENT("NO WAIT_INDICATION: nothing to do"); | |
1910 break; | |
1911 default: | |
1912 break; | |
1913 } | |
1914 } /* no else because additional rejects have to be ignored!! */ | |
1915 break; | |
1916 #if defined REL99 AND defined TI_PS_FF_TBF_EST_PACCH | |
1917 case CGRLC_TBF_MODE_2PA: | |
1918 /* PRR is sent by GRLC. NW responds with PAR */ | |
1919 if(grr_data->tc.tbf_est_pacch) | |
1920 { | |
1921 | |
1922 if(grr_t_status( T3170) EQ 0 ) | |
1923 vsi_t_start(GRR_handle,T3170,tc_get_t3170_value()); | |
1924 | |
1925 switch( tc_eval_access_rej(&t3172_value) ) | |
1926 { | |
1927 case E_ACCESS_REJ_WAIT: | |
1928 tc_start_timer_t3172( t3172_value ); | |
1929 sig_tc_ctrl_t3172_running(); | |
1930 break; | |
1931 case E_ACCESS_REJ_NO_WAIT: | |
1932 TRACE_EVENT("NO WAIT_INDICATION: nothing to do"); | |
1933 break; | |
1934 default: | |
1935 break; | |
1936 } | |
1937 } | |
1938 break; | |
1939 #endif | |
1940 default: | |
1941 break; | |
1942 }/* switch tbf_type*/ | |
1943 | |
1944 } /* sig_gfp_tc_access_rej_ptm() */ | |
1945 | |
1946 | |
1947 /* | |
1948 +------------------------------------------------------------------------------ | |
1949 | Function : sig_gfp_tc_ts_reconfig_ptm | |
1950 +------------------------------------------------------------------------------ | |
1951 | Description : Handles the | |
1952 | | |
1953 | Parameters : | |
1954 | | |
1955 +------------------------------------------------------------------------------ | |
1956 */ | |
1957 GLOBAL void sig_gfp_tc_ts_reconfig_ptm ( void ) | |
1958 { | |
1959 | |
1960 TRACE_ISIG( "sig_gfp_tc_ts_reconfig_ptm" ); | |
1961 /* | |
1962 * ASUMPTION: | |
1963 * This primitive (re)assigns an uplink AND downlink assignment. | |
1964 * if not the primitive is ignored. | |
1965 * CASES: | |
1966 * 1. ONLY UL_TBF is running: reassignment of uplink AND assignment of downlink | |
1967 * 2. ONLY DL_TBF is running: reassignment of downlink AND assignment of uplink | |
1968 * 3. DL_TBF AND UL_TBF is running: reassignment of downlink AND reassignment of uplink | |
1969 */ | |
1970 | |
1971 switch( GET_STATE( TC ) ) | |
1972 { | |
1973 case TC_CONTENTION_RESOLUTION: | |
1974 TRACE_ERROR("TS RECONF in CONT: RES. ignored"); | |
1975 break; /*ignore during contention resolution procedure*/ | |
1976 case TC_TBF_ACTIVE: | |
1977 switch(tc_eval_ts_reconf()) | |
1978 { | |
1979 /*handle tbf starting time for uplink*/ | |
1980 case E_TS_UL_REASSIG_NEW_DL: | |
1981 case E_TS_NEW_UL_DL_REASSIG: | |
1982 case E_TS_UL_REASSIG_DL_REASSIG: | |
1983 /* | |
1984 TRACE_EVENT("Packet TS Reconfigure "); | |
1985 */ | |
1986 tc_handle_tbf_start( CGRLC_TBF_MODE_DL_UL ); | |
1987 break; | |
1988 case E_TS_IGNORE: | |
1989 /*no effect on current tbfs*/ | |
1990 break; | |
1991 case E_TS_RECONFIG_ERROR_RA: | |
1992 TRACE_EVENT("Packet TS Reconfigure invalid"); | |
1993 vsi_t_stop(GRR_handle,T3168); | |
1994 tc_handle_error_ra(); | |
1995 break; | |
1996 default: | |
1997 TRACE_ERROR( "SIG_GFP_TC_TS_RECONFIG_PTM unexpected" ); | |
1998 break; | |
1999 } | |
2000 break; | |
2001 default: | |
2002 TRACE_ERROR( "SIG_GFP_TC_TS_RECONFIG_PTM unexpected" ); | |
2003 break; | |
2004 } | |
2005 | |
2006 } /* sig_gfp_tc_ts_reconfig_ptm() */ | |
2007 | |
2008 | |
2009 /* | |
2010 +------------------------------------------------------------------------------ | |
2011 | Function : sig_gfp_tc_ul_assign_ptm | |
2012 +------------------------------------------------------------------------------ | |
2013 | Description : Handles the | |
2014 | | |
2015 | Parameters : | |
2016 | | |
2017 +------------------------------------------------------------------------------ | |
2018 */ | |
2019 GLOBAL void sig_gfp_tc_ul_assign_ptm (void ) | |
2020 { | |
2021 TRACE_ISIG( "sig_gfp_tc_ul_assign_ptm " ); | |
2022 | |
2023 | |
2024 switch( GET_STATE( TC ) ) | |
2025 { | |
2026 case TC_CONTENTION_RESOLUTION: | |
2027 case TC_TBF_ACTIVE: | |
2028 switch( tc_eval_ul_assign() ) | |
2029 { | |
2030 case E_UL_ASSIGN_DYNAMIC: | |
2031 /* | |
2032 TRACE_EVENT("Packet UL Assignment with dynamic allocation"); | |
2033 */ | |
2034 tc_handle_tbf_start( CGRLC_TBF_MODE_UL ); | |
2035 break; | |
2036 case E_UL_ASSIGN_FIXED: | |
2037 /* | |
2038 TRACE_EVENT("Packet UL Assignment with fixed allocation"); | |
2039 */ | |
2040 tc_handle_tbf_start( CGRLC_TBF_MODE_UL ); | |
2041 break; | |
2042 #if defined REL99 AND defined TI_PS_FF_TBF_EST_PACCH | |
2043 case E_UL_ASSIGN_SB_2PHASE_ACCESS: | |
2044 if((grr_data->tc.tbf_est_pacch) AND | |
2045 (!psc_db->gprs_cell_opt.ctrl_ack_type)) | |
2046 { | |
2047 /* Control ack type is Access burst. GRLC would have sent | |
2048 * PCA as poll for initiating TBF est on PACCH. Send UL_TBF_RES | |
2049 * to GRLC. Packet resource request message will be sent by GRLC. | |
2050 */ | |
2051 TRACE_EVENT("TBF on pacch"); | |
2052 SET_STATE(TC,TC_WAIT_2P_ASSIGN); | |
2053 tc_handle_tbf_start( CGRLC_TBF_MODE_2PA); | |
2054 } | |
2055 break; | |
2056 #endif | |
2057 | |
2058 | |
2059 | |
2060 | |
2061 default: | |
2062 TRACE_EVENT("Packet UL Assignment invalid"); | |
2063 tc_handle_error_ra(); | |
2064 break; | |
2065 } | |
2066 break; | |
2067 default: | |
2068 TRACE_ERROR( "SIG_GFP_TC_UL_ASSIGN_PTM unexpected" ); | |
2069 break; | |
2070 } | |
2071 | |
2072 } /* sig_gfp_tc_ul_assign_ptm () */ | |
2073 | |
2074 | |
2075 /* | |
2076 +------------------------------------------------------------------------------ | |
2077 | Function : sig_gfp_tc_dl_assign_ptm | |
2078 +------------------------------------------------------------------------------ | |
2079 | Description : Handles the | |
2080 | | |
2081 | Parameters : | |
2082 | | |
2083 +------------------------------------------------------------------------------ | |
2084 */ | |
2085 GLOBAL void sig_gfp_tc_dl_assign_ptm ( void ) | |
2086 { | |
2087 TRACE_ISIG( "sig_gfp_tc_dl_assign_ptm" ); | |
2088 | |
2089 switch( GET_STATE( TC ) ) | |
2090 { | |
2091 case TC_CONTENTION_RESOLUTION: | |
2092 TRACE_ERROR("P. DL. ASS. in CONT: RES. ignored"); | |
2093 break; /*ignore during contention resolution procedure*/ | |
2094 case TC_TBF_ACTIVE: | |
2095 switch( tc_eval_dl_assign() ) | |
2096 { | |
2097 case E_DL_ASSIGN: | |
2098 /* | |
2099 TRACE_EVENT("Packet DL Assignment"); | |
2100 */ | |
2101 tc_handle_tbf_start( CGRLC_TBF_MODE_DL ); | |
2102 break; | |
2103 case E_DL_ASSIGN_ERROR_RA: | |
2104 TRACE_EVENT("Packet DL Assignment invalid"); | |
2105 tc_handle_error_ra(); | |
2106 break; | |
2107 case E_DL_ASSIGN_IGNORE: | |
2108 /* | |
2109 * If a failure in the PACKET DOWNLINK ASSIGNMENT is due to any reason, | |
2110 * the mobile station shall abort the procedure and continue the normal | |
2111 * operation of the uplink TBF. | |
2112 */ | |
2113 break; | |
2114 case E_DL_ASSIGN_ABORT_DL: | |
2115 tc_abort_tbf(CGRLC_TBF_MODE_DL); | |
2116 break; | |
2117 default: | |
2118 TRACE_ERROR( "Packet DL Assignment with unexpected content" ); | |
2119 break; | |
2120 } | |
2121 break; | |
2122 default: | |
2123 TRACE_ERROR( "SIG_GFP_TC_DL_ASSIGN_PTM unexpected" ); | |
2124 break; | |
2125 } | |
2126 } /* sig_gfp_tc_dl_assign_ptm() */ | |
2127 | |
2128 | |
2129 | |
2130 /* | |
2131 +------------------------------------------------------------------------------ | |
2132 | Function : sig_gfp_tc_pdch_release_ptm ( tn ); | |
2133 +------------------------------------------------------------------------------ | |
2134 | Description : Handles | |
2135 | | |
2136 | Parameters : tn_i | |
2137 | | |
2138 +------------------------------------------------------------------------------ | |
2139 */ | |
2140 GLOBAL void sig_gfp_tc_pdch_release_ptm ( UBYTE tn) | |
2141 { | |
2142 TRACE_ISIG( "sig_gfp_tc_pdch_release_ptm" ); | |
2143 | |
2144 switch( GET_STATE( TC ) ) | |
2145 { | |
2146 case TC_CONTENTION_RESOLUTION: | |
2147 case TC_TBF_ACTIVE: | |
2148 switch( tc_eval_pdch_rel(tn) ) | |
2149 { | |
2150 case E_PDCH_REL_RECONF: | |
2151 tc_send_pdch_rel(grr_data->pdch_rel_ts_mask); | |
2152 break; | |
2153 case E_PDCH_REL_RELEASE_DL_RECONF_UL: | |
2154 tc_abort_tbf(CGRLC_TBF_MODE_DL); | |
2155 tc_send_pdch_rel(grr_data->pdch_rel_ts_mask); | |
2156 break; | |
2157 case E_PDCH_REL_RELEASE_UL_RECONF_DL: | |
2158 tc_abort_tbf(CGRLC_TBF_MODE_UL); | |
2159 tc_send_pdch_rel(grr_data->pdch_rel_ts_mask); | |
2160 break; | |
2161 case E_PDCH_REL_RELEASE_BOTH: | |
2162 tc_abort_tbf(CGRLC_TBF_MODE_DL_UL); | |
2163 break; | |
2164 case E_PDCH_REL_RELEASE_UL: | |
2165 tc_abort_tbf(CGRLC_TBF_MODE_UL); | |
2166 break; | |
2167 case E_PDCH_REL_RELEASE_DL: | |
2168 tc_abort_tbf(CGRLC_TBF_MODE_DL); | |
2169 break; | |
2170 default: | |
2171 break; | |
2172 } | |
2173 break; | |
2174 default: | |
2175 TRACE_ERROR( "SIG_GFP_TC_PDCH_RELEASE_PTM unexpected" ); | |
2176 break; | |
2177 } | |
2178 | |
2179 /* | |
2180 * in all states | |
2181 */ | |
2182 if(grr_data->tbf_type EQ CGRLC_TBF_MODE_NULL) | |
2183 { | |
2184 /* new access is done when release confirm arrives */ | |
2185 SET_STATE(TC,TC_PIM); | |
2186 } | |
2187 else if(grr_data->tbf_type EQ CGRLC_TBF_MODE_DL) | |
2188 { | |
2189 SET_STATE(TC,TC_TBF_ACTIVE); | |
2190 } | |
2191 | |
2192 | |
2193 } /* sig_gfp_tc_pdch_release_ptm() */ | |
2194 | |
2195 | |
2196 /* | |
2197 +------------------------------------------------------------------------------ | |
2198 | Function : sig_gfp_tc_queuing_not | |
2199 +------------------------------------------------------------------------------ | |
2200 | Description : Handles | |
2201 | | |
2202 | Parameters : void | |
2203 | | |
2204 +------------------------------------------------------------------------------ | |
2205 */ | |
2206 GLOBAL void sig_gfp_tc_queuing_not ( void ) | |
2207 { | |
2208 TRACE_ISIG( "sig_gfp_tc_queuing_not " ); | |
2209 switch( GET_STATE( TC ) ) | |
2210 { | |
2211 case TC_WAIT_ASSIGN: | |
2212 | |
2213 SET_STATE(TC,TC_POLLING); | |
2214 /* | |
2215 * stop sending packet access request | |
2216 */ | |
2217 tc_send_ra_stop_req(); | |
2218 | |
2219 vsi_t_stop(GRR_handle,T3170); | |
2220 vsi_t_start(GRR_handle,T3162,T3162_VALUE); | |
2221 | |
2222 /* | |
2223 * save tqi | |
2224 */ | |
2225 { | |
2226 MCAST(d_queuing_not,D_QUEUING_NOT); | |
2227 grr_data->tqi = d_queuing_not->tqi; | |
2228 } | |
2229 break; | |
2230 default: | |
2231 TRACE_ERROR( "SIG_GFP_TC_QUEUING_NOT unexpected" ); | |
2232 break; | |
2233 } | |
2234 | |
2235 } /* sig_gfp_tc_queuing_not () */ | |
2236 | |
2237 | |
2238 /* | |
2239 +------------------------------------------------------------------------------ | |
2240 | Function : sig_gfp_tc_ul_assign | |
2241 +------------------------------------------------------------------------------ | |
2242 | Description : Handles | |
2243 | | |
2244 | Parameters : void | |
2245 | | |
2246 +------------------------------------------------------------------------------ | |
2247 */ | |
2248 GLOBAL void sig_gfp_tc_ul_assign ( void ) | |
2249 { | |
2250 UBYTE old_state = GET_STATE( TC ); | |
2251 | |
2252 TRACE_ISIG( "sig_gfp_tc_ul_assign" ); | |
2253 | |
2254 if( grr_t_status( T3172_1 ) > 0 ) | |
2255 { | |
2256 if( grr_t_status( T3170 ) > 0 ) | |
2257 { | |
2258 /* | |
2259 * stop T3172 and set some parameters | |
2260 */ | |
2261 tc_stop_timer_t3172(); | |
2262 } | |
2263 else if ( grr_t_status( T3176 ) EQ 0) | |
2264 { | |
2265 TRACE_EVENT("Ignore UL Assignment"); | |
2266 return; | |
2267 } | |
2268 } | |
2269 | |
2270 switch( old_state ) | |
2271 { | |
2272 case TC_WAIT_2P_ASSIGN: | |
2273 grr_data->uplink_tbf.ti = 0; | |
2274 /* mark that contention resulution is not yet done */ | |
2275 | |
2276 /*lint -fallthrough*/ | |
2277 | |
2278 case TC_WAIT_STOP_TASK_CNF: | |
2279 if (grr_data->tc.last_eval_assign.tbf_type EQ CGRLC_TBF_MODE_UL) | |
2280 { | |
2281 TRACE_EVENT("Reassignment for UL ASS in CNF state"); | |
2282 } | |
2283 else if(grr_data->tc.last_eval_assign.tbf_type EQ CGRLC_TBF_MODE_DL) | |
2284 { | |
2285 TRACE_EVENT("Ignore UL ASS, wait for DL start"); | |
2286 break; | |
2287 } | |
2288 else if(grr_data->tc.last_eval_assign.tbf_type EQ CGRLC_TBF_MODE_NULL AND grr_data->uplink_tbf.ti) | |
2289 { | |
2290 TRACE_EVENT("Ignore UL ASS, wait for condirn to start RA procedure !!!!"); | |
2291 break; | |
2292 } | |
2293 | |
2294 /*lint -fallthrough*/ | |
2295 | |
2296 /* | |
2297 * else :TWO PHASE ACCESS IS RUNNING | |
2298 */ | |
2299 case TC_POLLING: | |
2300 case TC_WAIT_ASSIGN: | |
2301 /* | |
2302 * stop sending packet access request if in progress | |
2303 */ | |
2304 tc_send_ra_stop_req(); | |
2305 | |
2306 /*lint -fallthrough*/ | |
2307 | |
2308 case TC_SINGLE_BLOCK: | |
2309 case TC_CONTENTION_RESOLUTION: | |
2310 switch( tc_eval_ul_assign() ) | |
2311 { | |
2312 case E_UL_ASSIGN_SB_2PHASE_ACCESS: | |
2313 SET_STATE(TC,TC_WAIT_2P_ASSIGN); | |
2314 /* | |
2315 * send MPHP_SINGLE_BLOCK_REQ with PACKET RESOURCE REQUEST | |
2316 */ | |
2317 tc_send_resource_request_p(); | |
2318 vsi_t_stop(GRR_handle,T3170); | |
2319 break; | |
2320 | |
2321 case E_UL_ASSIGN_DYNAMIC: | |
2322 /* | |
2323 TRACE_EVENT("Packet UL Assignment with dynamic allocation"); | |
2324 */ | |
2325 if(grr_data->uplink_tbf.ti) | |
2326 { | |
2327 SET_STATE(TC,TC_CONTENTION_RESOLUTION); | |
2328 } | |
2329 else | |
2330 { | |
2331 SET_STATE(TC,TC_TBF_ACTIVE); | |
2332 sig_tc_ctrl_contention_ok(); | |
2333 grr_data->tc.two_2p_w_4_tbf_con = FALSE; | |
2334 } | |
2335 tc_prepare_handle_tbf_start( CGRLC_TBF_MODE_UL, GET_STATE( TC ), old_state ); | |
2336 break; | |
2337 case E_UL_ASSIGN_FIXED: | |
2338 /*TRACE_EVENT("Packet UL Assignment with fixed allocation");*/ | |
2339 if(grr_data->uplink_tbf.ti) | |
2340 { | |
2341 SET_STATE(TC,TC_CONTENTION_RESOLUTION); | |
2342 } | |
2343 else | |
2344 { | |
2345 SET_STATE(TC,TC_TBF_ACTIVE); | |
2346 sig_tc_ctrl_contention_ok(); | |
2347 } | |
2348 tc_prepare_handle_tbf_start( CGRLC_TBF_MODE_UL, GET_STATE( TC ), old_state ); | |
2349 break; | |
2350 case E_UL_ASSIGN_SB_WITHOUT_TBF: | |
2351 TRACE_EVENT("Packet UL Assignment with single block allocation"); | |
2352 /* send MPHP_SINGLE_BLOCK_REQ with DATA | |
2353 * (measurement report) */ | |
2354 tc_send_single_block(); | |
2355 SET_STATE(TC,TC_SINGLE_BLOCK); | |
2356 vsi_t_stop(GRR_handle,T3170); | |
2357 break; | |
2358 default: | |
2359 vsi_t_stop(GRR_handle,T3170); | |
2360 if(grr_data->tc.state EQ TC_WAIT_2P_ASSIGN OR | |
2361 grr_data->tc.state EQ TC_SINGLE_BLOCK) | |
2362 { | |
2363 vsi_t_stop(GRR_handle,T3168); | |
2364 TRACE_EVENT_P1("Packet UL Assignment invalid during 2 phase access state=%d",grr_data->tc.state); | |
2365 tc_stop_normal_burst_req( ); | |
2366 } | |
2367 else | |
2368 { | |
2369 TRACE_EVENT("Packet UL Assignment invalid"); | |
2370 tc_handle_error_ra(); | |
2371 } | |
2372 break; | |
2373 } | |
2374 break; | |
2375 default: | |
2376 vsi_t_stop(GRR_handle,T3170); | |
2377 TRACE_ERROR( "SIG_GFP_TC_UL_ASSIGN unexpected" ); | |
2378 break; | |
2379 } | |
2380 | |
2381 } /* sig_gfp_tc_ul_assign() */ | |
2382 | |
2383 | |
2384 /* | |
2385 +------------------------------------------------------------------------------ | |
2386 | Function : sig_gfp_tc_dl_assign | |
2387 +------------------------------------------------------------------------------ | |
2388 | Description : Handles | |
2389 | | |
2390 | Parameters : - | |
2391 | | |
2392 +------------------------------------------------------------------------------ | |
2393 */ | |
2394 GLOBAL void sig_gfp_tc_dl_assign (void) | |
2395 { | |
2396 UBYTE old_state = GET_STATE( TC ); | |
2397 | |
2398 TRACE_ISIG( "sig_gfp_tc_dl_assign " ); | |
2399 | |
2400 | |
2401 switch( old_state ) | |
2402 { | |
2403 case TC_WAIT_STOP_TASK_CNF: | |
2404 TRACE_EVENT_P4("ASS IN CNF state:ccch_read=%d tbf_Type =%d state=%d p_assign=%ld" | |
2405 ,grr_data->tc.last_eval_assign.ccch_read | |
2406 ,grr_data->tc.last_eval_assign.tbf_type | |
2407 ,grr_data->tc.last_eval_assign.state | |
2408 ,grr_data->tc.p_assign); | |
2409 if (grr_data->tc.last_eval_assign.tbf_type EQ CGRLC_TBF_MODE_UL) | |
2410 { | |
2411 TRACE_EVENT("Ignore DL ASS, wait for UL start"); | |
2412 break; | |
2413 } | |
2414 | |
2415 /*lint -fallthrough*/ | |
2416 | |
2417 case TC_WAIT_ASSIGN: | |
2418 /* | |
2419 * stop sending packet access request if in progress | |
2420 */ | |
2421 tc_send_ra_stop_req(); | |
2422 | |
2423 /*lint -fallthrough*/ | |
2424 | |
2425 case TC_PIM: | |
2426 case TC_POLLING: | |
2427 case TC_SINGLE_BLOCK: | |
2428 case TC_TBF_ACTIVE: | |
2429 switch( tc_eval_dl_assign() ) | |
2430 { | |
2431 case E_DL_ASSIGN: | |
2432 /* | |
2433 TRACE_EVENT("Packet DL Assignment"); | |
2434 */ | |
2435 SET_STATE(TC,TC_TBF_ACTIVE); | |
2436 if( grr_t_status( T3162 ) NEQ 0 ) | |
2437 { | |
2438 vsi_t_stop(GRR_handle,T3162);/*ETSI 4.60 7.1.2.2.2.*/ | |
2439 } | |
2440 tc_prepare_handle_tbf_start( CGRLC_TBF_MODE_DL, GET_STATE( TC ), old_state ); | |
2441 break; | |
2442 case E_DL_ASSIGN_ERROR_RA: | |
2443 TRACE_EVENT("Packet DL Assignment invalid"); | |
2444 vsi_t_stop(GRR_handle,T3170); | |
2445 | |
2446 if(grr_data->tc.state EQ TC_SINGLE_BLOCK) | |
2447 { | |
2448 TRACE_EVENT_P1("Packet DL Assignment invalid during IA_DL_SB state=%d",grr_data->tc.state); | |
2449 tc_stop_normal_burst_req( ); | |
2450 } | |
2451 else | |
2452 { | |
2453 tc_handle_error_ra(); | |
2454 } | |
2455 break; | |
2456 case E_DL_ASSIGN_IGNORE: | |
2457 /* | |
2458 * If a failure in the PACKET DOWNLINK ASSIGNMENT is due to any reason, | |
2459 * the mobile station shall abort the procedure and continue the normal | |
2460 * operation of the uplink TBF. | |
2461 */ | |
2462 vsi_t_stop(GRR_handle,T3170); | |
2463 break; | |
2464 default: | |
2465 vsi_t_stop(GRR_handle,T3170); | |
2466 TRACE_ERROR( "DL_ASSIGNMENT with unexpected content" ); | |
2467 break; | |
2468 } | |
2469 break; | |
2470 default: | |
2471 vsi_t_stop(GRR_handle,T3170); | |
2472 TRACE_ERROR( "SIG_GFP_TC_DL_ASSIGN unexpected" ); | |
2473 break; | |
2474 } | |
2475 | |
2476 } /* sig_gfp_tc_dl_assign () */ | |
2477 | |
2478 | |
2479 | |
2480 /* | |
2481 +------------------------------------------------------------------------------ | |
2482 | Function : sig_gfp_tc_access_rej | |
2483 +------------------------------------------------------------------------------ | |
2484 | Description : Handles | |
2485 | | |
2486 | Parameters : void | |
2487 | | |
2488 +------------------------------------------------------------------------------ | |
2489 */ | |
2490 GLOBAL void sig_gfp_tc_access_rej ( void ) | |
2491 { | |
2492 ULONG t3172_value=0; | |
2493 BOOL start_t3172 = TRUE; | |
2494 | |
2495 TRACE_ISIG( "sig_gfp_tc_access_rej " ); | |
2496 | |
2497 if(grr_t_status( T3172_1 ) > 0) | |
2498 { | |
2499 TRACE_EVENT("T3172 running: Ignore PACKET ACCESS REJECT"); | |
2500 } | |
2501 else | |
2502 { | |
2503 /* The T3168 could running. */ | |
2504 vsi_t_stop(GRR_handle,T3168); | |
2505 | |
2506 switch( GET_STATE( TC ) ) | |
2507 { | |
2508 case TC_WAIT_ASSIGN: | |
2509 case TC_POLLING: | |
2510 case TC_WAIT_2P_ASSIGN: | |
2511 case TC_SINGLE_BLOCK: | |
2512 tc_send_ra_stop_req(); | |
2513 /* | |
2514 * stop Packet Access Request sending (T3186 will be stopped if runnig) | |
2515 */ | |
2516 if( grr_t_status( T3174 ) > 0 ) | |
2517 { | |
2518 TRACE_ERROR( " Access reject on the network commanded cell" ); | |
2519 grr_data->pcco_failure_cause = 2; | |
2520 sig_tc_ctrl_access_reject_on_new_cell(); | |
2521 /* Do not start the 3172 timer if on the new cell access reject is received */ | |
2522 start_t3172 = FALSE; | |
2523 } | |
2524 else | |
2525 if(grr_t_status( T3170 ) EQ 0 ) | |
2526 { /* T3170 is not running */ | |
2527 vsi_t_start(GRR_handle,T3170,tc_get_t3170_value()); | |
2528 TRACE_EVENT("sig_gfp_tc_access_rej: t3170 started"); | |
2529 } | |
2530 switch( tc_eval_access_rej( &t3172_value ) ) | |
2531 { | |
2532 case E_ACCESS_REJ_WAIT: | |
2533 if (start_t3172 EQ TRUE) | |
2534 { | |
2535 tc_start_timer_t3172( t3172_value ); | |
2536 sig_tc_ctrl_t3172_running(); | |
2537 } | |
2538 break; | |
2539 case E_ACCESS_REJ_NO_WAIT: | |
2540 TRACE_EVENT("No value for T3172, go to idle mode after T3170 expiration"); | |
2541 break; | |
2542 default: | |
2543 break; | |
2544 } | |
2545 break; | |
2546 default: | |
2547 TRACE_ERROR( "SIG_GFP_TC_ACCESS_REJ unexpected" ); | |
2548 break; | |
2549 } | |
2550 }/* ignore reject*/ | |
2551 | |
2552 } /* sig_gfp_tc_access_rej () */ | |
2553 | |
2554 /* | |
2555 +------------------------------------------------------------------------------ | |
2556 | Function : sig_gfp_tc_ra_con | |
2557 +------------------------------------------------------------------------------ | |
2558 | Description : Handles | |
2559 | | |
2560 | Parameters : payload to primitive | |
2561 | | |
2562 +------------------------------------------------------------------------------ | |
2563 */ | |
2564 GLOBAL void sig_gfp_tc_ra_con ( T_MPHP_RA_CON * mphp_ra_con_i ) | |
2565 { | |
2566 TRACE_ISIG( "sig_gfp_tc_ra_con" ); /*MODIF*/ | |
2567 | |
2568 /* | |
2569 * save last packet access request reference | |
2570 * see also 0408d640, 10.5.2.28 | |
2571 */ | |
2572 | |
2573 grr_data->req_ref[grr_data->tc.n_acc_req%3].fn_mod.t1 = | |
2574 (UBYTE)( ( mphp_ra_con_i->fn / 1326) % 32 ); | |
2575 grr_data->req_ref[grr_data->tc.n_acc_req%3].fn_mod.t2 = | |
2576 (UBYTE)( mphp_ra_con_i->fn % 26 ); | |
2577 grr_data->req_ref[grr_data->tc.n_acc_req%3].fn_mod.t3 = | |
2578 (UBYTE)( mphp_ra_con_i->fn % 51 ); | |
2579 | |
2580 | |
2581 /* | |
2582 * 0 8 bit access burst | |
2583 * 1 11 bit access burst | |
2584 */ | |
2585 if(psc_db->gprs_cell_opt.ab_type) | |
2586 { | |
2587 /* | |
2588 * 11 Bit access burst | |
2589 * b: bit | |
2590 * b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0 | |
2591 * should be sent to the network -according 04.60 and 0404- in the | |
2592 * following 16-bit format: | |
2593 * 0 0 0 0 0 b2 b1 b0 b10 b9 b8 b7 b6 b5 b4 b3 | |
2594 * | |
2595 * We have to store the access info in the | |
2596 * b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0 format | |
2597 */ | |
2598 USHORT acc_inf, dummy = 0; | |
2599 dummy = mphp_ra_con_i->channel_request_data; | |
2600 dummy = dummy >> 8; /* 0 0 0 0 0 0 0 0 0 0 0 0 0 b2 b1 b0*/ | |
2601 acc_inf = mphp_ra_con_i->channel_request_data; | |
2602 acc_inf = (acc_inf & 0xFF);/* 0 0 0 0 0 0 0 0 b10 b9 b8 b7 b6 b5 b4 b3 */ | |
2603 acc_inf = acc_inf << 3; /* 0 0 0 0 0 b10 b9 b8 b7 b6 b5 b4 b3 0 0 0 */ | |
2604 acc_inf = acc_inf | dummy;/* 0 0 0 0 0 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0 */ | |
2605 grr_data->req_ref[grr_data->tc.n_acc_req%3].access_info = acc_inf; | |
2606 } | |
2607 else | |
2608 { | |
2609 grr_data->req_ref[grr_data->tc.n_acc_req%3].access_info = mphp_ra_con_i->channel_request_data; | |
2610 } | |
2611 | |
2612 grr_data->tc.n_acc_req++; | |
2613 | |
2614 grr_data->tc.ra_once_sent++; | |
2615 | |
2616 if (grr_data->tc.ra_once_sent >= 2) | |
2617 { | |
2618 grr_data->r_bit = 1; | |
2619 } | |
2620 | |
2621 switch( GET_STATE( TC ) ) | |
2622 { | |
2623 case TC_WAIT_ASSIGN: | |
2624 switch( tc_handle_ra_con() ) | |
2625 { | |
2626 case H_RA_CON_STOP_REQ: | |
2627 tc_send_ra_stop_req(); | |
2628 break; | |
2629 case H_RA_CON_CONTINUE: | |
2630 tc_send_ra_req(); | |
2631 break; | |
2632 default: | |
2633 break; | |
2634 } | |
2635 break; | |
2636 default: | |
2637 tc_send_ra_stop_req(); | |
2638 break; | |
2639 } | |
2640 } /* sig_gfp_tc_ra_con() */ | |
2641 | |
2642 | |
2643 /* | |
2644 +------------------------------------------------------------------------------ | |
2645 | Function : sig_gfp_tc_ra_stop_con | |
2646 +------------------------------------------------------------------------------ | |
2647 | Description : Handles the primitive T_MPHP_RA_STOP_CON | |
2648 | | |
2649 | Parameters : Ptr to primitive payload | |
2650 | | |
2651 +------------------------------------------------------------------------------ | |
2652 */ | |
2653 GLOBAL void sig_gfp_tc_ra_stop_con ( T_MPHP_RA_STOP_CON * mphp_ra_stop_con_i ) | |
2654 { | |
2655 TRACE_ISIG( "sig_gfp_tc_ra_stop_con" ); | |
2656 | |
2657 switch( GET_STATE( TC ) ) | |
2658 { | |
2659 case TC_ACCESS_DISABLED: | |
2660 tc_call_disable_callback_func( ); | |
2661 break; | |
2662 default: | |
2663 /* nothing to do */ | |
2664 break; | |
2665 } | |
2666 } /* sig_gfp_tc_ra_stop_con() */ | |
2667 | |
2668 /* | |
2669 +------------------------------------------------------------------------------ | |
2670 | Function : sig_gfp_tc_single_block_cnf | |
2671 +------------------------------------------------------------------------------ | |
2672 | Description : Handles | |
2673 | | |
2674 | Parameters : *mphp_single_block_con - Ptr to primitive payload | |
2675 | | |
2676 +------------------------------------------------------------------------------ | |
2677 */ | |
2678 GLOBAL void sig_gfp_tc_single_block_cnf ( T_MPHP_SINGLE_BLOCK_CON *mphp_single_block_con) | |
2679 { | |
2680 TRACE_ISIG( "sig_gfp_tc_single_block_cnf" ); | |
2681 | |
2682 switch( GET_STATE( TC ) ) | |
2683 { | |
2684 case TC_WAIT_2P_ASSIGN: | |
2685 if(!mphp_single_block_con->sb_status) | |
2686 { | |
2687 /* | |
2688 * TRACE_EVENT_P1("T3168 start: %d ms",((psc_db->gprs_cell_opt.t3168)+1)*500); | |
2689 */ | |
2690 vsi_t_start(GRR_handle,T3168,(psc_db->gprs_cell_opt.t3168+1)*500); | |
2691 sig_tc_ctrl_set_pckt_mode( GLBL_PCKT_MODE_ACCESS_TWO_PHASE, TASK_STOP_DUMMY_VALUE ); | |
2692 } | |
2693 else | |
2694 { | |
2695 vsi_t_stop(GRR_handle,T3168); | |
2696 TRACE_ERROR("Single Block not sent by layer 1"); | |
2697 TRACE_EVENT_P1("sb_status = %d",mphp_single_block_con->sb_status); | |
2698 sig_tc_ctrl_set_pckt_mode( GLBL_PCKT_MODE_ACCESS_TWO_PHASE, TASK_STOP_DUMMY_VALUE ); | |
2699 tc_stop_normal_burst_req( ); | |
2700 } | |
2701 break; | |
2702 case TC_SINGLE_BLOCK: | |
2703 if(mphp_single_block_con->purpose EQ SINGLE_BLOCK_TRANSFER_UL) | |
2704 { | |
2705 BOOL is_tx_success = mphp_single_block_con->sb_status EQ SB_STAT_OK; | |
2706 tc_set_stop_ctrl_blk ( is_tx_success,CGRLC_BLK_OWNER_NONE, 0 ); | |
2707 sig_tc_ctrl_set_pckt_mode( GLBL_PCKT_MODE_MEAS_REP_IDLE, TASK_STOP_DUMMY_VALUE ); | |
2708 } | |
2709 else | |
2710 { | |
2711 sig_tc_ctrl_set_pckt_mode( GLBL_PCKT_MODE_ACCESS_TWO_PHASE, TASK_STOP_DUMMY_VALUE ); | |
2712 } | |
2713 tc_stop_normal_burst_req( ); | |
2714 break; | |
2715 case TC_ACCESS_DISABLED: | |
2716 /* | |
2717 * After receiving a Packet Cell Change Order the signal SIG_GFP_SINGLE_BLOCK_CNF | |
2718 * was unexpected. MPHP_STOP_SINGLE_BLOCK_REQ is sent during disableing of the | |
2719 * GRR services. | |
2720 */ | |
2721 break; | |
2722 default: | |
2723 TRACE_ERROR( "SIG_GFP_TC_SINGLE_BLOCK_CNF unexpected" ); | |
2724 break; | |
2725 } | |
2726 } /* sig_gfp_tc_single_block_cnf () */ | |
2727 | |
2728 | |
2729 | |
2730 /* | |
2731 +------------------------------------------------------------------------------ | |
2732 | Function : sig_gfp_tc_assignment_con | |
2733 +------------------------------------------------------------------------------ | |
2734 | Description : Handles | |
2735 | | |
2736 | Parameters : void | |
2737 | | |
2738 +------------------------------------------------------------------------------ | |
2739 */ | |
2740 GLOBAL void sig_gfp_tc_assignment_con ( void ) | |
2741 { | |
2742 TRACE_ISIG( "sig_gfp_tc_assignment_con " ); | |
2743 | |
2744 grr_data->tc.two_2p_w_4_tbf_con = TRUE; | |
2745 | |
2746 if(grr_data->tc.state NEQ TC_ACCESS_DISABLED) | |
2747 { | |
2748 if(grr_is_pbcch_present( )) | |
2749 { | |
2750 grr_data->tc.last_eval_assign.ccch_read = 0xFF; | |
2751 grr_data->tc.last_eval_assign.tbf_type = CGRLC_TBF_MODE_NULL; | |
2752 grr_data->tc.last_eval_assign.state = 0xFF; | |
2753 } | |
2754 sig_tc_ctrl_set_pckt_mode( GLBL_PCKT_MODE_TRANSFER, TASK_STOP_DUMMY_VALUE ); | |
2755 } | |
2756 else | |
2757 { | |
2758 TRACE_EVENT_P1("TBF_C in TC_ACCESS_DISABLED: do not sent sig_tc_ctrl_set_pckt_mode num_rel=%d ",grr_data->tc.num_of_rels_running ); | |
2759 } | |
2760 | |
2761 | |
2762 } /* sig_gfp_tc_assignment_con () */ | |
2763 | |
2764 | |
2765 /* | |
2766 +------------------------------------------------------------------------------ | |
2767 | Function : sig_gfp_tc_tbf_release_con | |
2768 +------------------------------------------------------------------------------ | |
2769 | Description : Handles | |
2770 | | |
2771 | Parameters : T_MPHP_TBF_RELEASE_CON * mphp_tbf_release_con_i | |
2772 | | |
2773 +------------------------------------------------------------------------------ | |
2774 */ | |
2775 GLOBAL void sig_gfp_tc_tbf_release_con ( T_MPHP_TBF_RELEASE_CON * mphp_tbf_release_con_i ) | |
2776 { | |
2777 T_RELEASE_STATE rel_state= REL_RUNNING; | |
2778 TRACE_ISIG( "sig_gfp_tc_tbf_release_con" ); | |
2779 | |
2780 if(mphp_tbf_release_con_i->tbf_type EQ UL_DL_ASSIGNMENT) | |
2781 grr_data->tc.num_of_rels_running = 0; | |
2782 else if (grr_data->tc.num_of_rels_running) | |
2783 grr_data->tc.num_of_rels_running--; | |
2784 else | |
2785 { | |
2786 TRACE_EVENT_P2("REL CON UNEXPECTED num=%d tbf_rel_type=%d " | |
2787 ,grr_data->tc.num_of_rels_running | |
2788 ,mphp_tbf_release_con_i->tbf_type); | |
2789 } | |
2790 | |
2791 if(!grr_data->tc.num_of_rels_running) | |
2792 { | |
2793 rel_state = REL_PERFORMED; | |
2794 if(grr_is_pbcch_present( )) | |
2795 { | |
2796 grr_data->tc.last_eval_assign.ccch_read = 0xFF; | |
2797 grr_data->tc.last_eval_assign.tbf_type = CGRLC_TBF_MODE_NULL; | |
2798 grr_data->tc.last_eval_assign.state = 0xFF; | |
2799 } | |
2800 } | |
2801 | |
2802 sig_tc_ctrl_rel_state(rel_state); | |
2803 | |
2804 switch( GET_STATE( TC ) ) | |
2805 { | |
2806 case TC_PIM: | |
2807 grr_data->ta_params.ta_value = 0xFF; | |
2808 grr_data->ta_params.ta_valid = FALSE; | |
2809 memset(&grr_data->ta_params, 0xFF, sizeof(T_TA_PARAMS)); | |
2810 | |
2811 if(0 EQ grr_data->tc.num_of_rels_running) | |
2812 { | |
2813 grr_data->tc.v_freq_set = FALSE; | |
2814 | |
2815 if( grr_data->tc.disable_callback_func EQ NULL ) | |
2816 { | |
2817 /*enable access for grlc*/ | |
2818 tc_cgrlc_tbf_rel_res( mphp_tbf_release_con_i->tbf_type ); /* release of all tbfs, grr has entered PIM, transition rule is taken into acocount*/ | |
2819 } | |
2820 else | |
2821 { | |
2822 SET_STATE( TC, TC_ACCESS_DISABLED ); | |
2823 | |
2824 tc_cgrlc_disable_req ( CGRLC_PRIM_STATUS_NULL ); | |
2825 tc_call_disable_callback_func( ); | |
2826 } | |
2827 }/* else: wait for last release confirm */ | |
2828 else | |
2829 { | |
2830 tc_cgrlc_tbf_rel_res( mphp_tbf_release_con_i->tbf_type ); | |
2831 | |
2832 TRACE_EVENT_P1("WAIT FOR %d TBF RELEASE CON ",grr_data->tc.num_of_rels_running); | |
2833 } | |
2834 break; | |
2835 case TC_ACCESS_DISABLED: | |
2836 grr_data->ta_params.ta_value = 0xFF; | |
2837 grr_data->ta_params.ta_valid = FALSE; | |
2838 memset(&grr_data->ta_params, 0xFF, sizeof(T_TA_PARAMS)); | |
2839 grr_data->tc.v_freq_set = FALSE; | |
2840 grr_data->tc.two_2p_w_4_tbf_con = TRUE; | |
2841 | |
2842 tc_cgrlc_disable_req ( CGRLC_PRIM_STATUS_NULL ); | |
2843 | |
2844 if(0 EQ grr_data->tc.num_of_rels_running) | |
2845 { | |
2846 tc_call_disable_callback_func( ); | |
2847 } | |
2848 else | |
2849 { | |
2850 TRACE_EVENT_P1("REL_C in disable state: nr_rel=%d",grr_data->tc.num_of_rels_running); | |
2851 } | |
2852 break; | |
2853 case TC_CONTENTION_RESOLUTION: | |
2854 case TC_TBF_ACTIVE: | |
2855 /* | |
2856 * update timimg advance | |
2857 */ | |
2858 switch(mphp_tbf_release_con_i->tbf_type ) | |
2859 { | |
2860 case DL_ASSIGNMENT: | |
2861 { | |
2862 tc_cgrlc_tbf_rel_res( mphp_tbf_release_con_i->tbf_type ); | |
2863 | |
2864 /* | |
2865 * downlink tbf released, set ul ta, if it is different | |
2866 */ | |
2867 if(!((grr_data->ta_params.l1_ta_value EQ grr_data->ta_params.ta_value) AND | |
2868 (grr_data->ta_params.l1_ta_i EQ grr_data->ta_params.ul_ta_i) AND | |
2869 (grr_data->ta_params.l1_ta_tn EQ grr_data->ta_params.ul_ta_tn))) | |
2870 { | |
2871 PALLOC(mphp_timing_advance_req,MPHP_TIMING_ADVANCE_REQ);/* T_MPHP_TIMING_ADVANCE_REQ */ | |
2872 mphp_timing_advance_req->assign_id = 0; | |
2873 mphp_timing_advance_req->p_timing_advance.ta_value = grr_data->ta_params.ta_value; | |
2874 mphp_timing_advance_req->p_timing_advance.ta_index = grr_data->ta_params.ul_ta_i; | |
2875 mphp_timing_advance_req->p_timing_advance.tn = grr_data->ta_params.ul_ta_tn; | |
2876 PSEND(hCommL1,mphp_timing_advance_req); | |
2877 TRACE_EVENT_P5("DL TBF_REL TAU: new: %d %d %d-- old %d %d" | |
2878 ,grr_data->ta_params.ta_value | |
2879 ,grr_data->ta_params.ul_ta_i | |
2880 ,grr_data->ta_params.ul_ta_tn | |
2881 ,grr_data->ta_params.dl_ta_i | |
2882 ,grr_data->ta_params.dl_ta_tn); | |
2883 grr_data->ta_params.dl_ta_i = 0xFF; | |
2884 grr_data->ta_params.dl_ta_tn = 0xFF; | |
2885 } | |
2886 } | |
2887 break; | |
2888 case UL_ASSIGNMENT: | |
2889 { | |
2890 tc_cgrlc_tbf_rel_res( mphp_tbf_release_con_i->tbf_type ); | |
2891 | |
2892 /* | |
2893 * uplink tbf released, set dl ta, if it is different | |
2894 */ | |
2895 if(!((grr_data->ta_params.l1_ta_value EQ grr_data->ta_params.ta_value) AND | |
2896 (grr_data->ta_params.l1_ta_i EQ grr_data->ta_params.dl_ta_i) AND | |
2897 (grr_data->ta_params.l1_ta_tn EQ grr_data->ta_params.dl_ta_tn))) | |
2898 { | |
2899 PALLOC(mphp_timing_advance_req,MPHP_TIMING_ADVANCE_REQ);/* T_MPHP_TIMING_ADVANCE_REQ */ | |
2900 mphp_timing_advance_req->assign_id = 0; | |
2901 mphp_timing_advance_req->p_timing_advance.ta_value = grr_data->ta_params.ta_value; | |
2902 mphp_timing_advance_req->p_timing_advance.ta_index = grr_data->ta_params.dl_ta_i; | |
2903 mphp_timing_advance_req->p_timing_advance.tn = grr_data->ta_params.dl_ta_tn; | |
2904 PSEND(hCommL1,mphp_timing_advance_req); | |
2905 TRACE_EVENT_P5("UL TBF_REL TAU: new: %d %d %d-- old %d %d" | |
2906 ,grr_data->ta_params.ta_value | |
2907 ,grr_data->ta_params.dl_ta_i | |
2908 ,grr_data->ta_params.dl_ta_tn | |
2909 ,grr_data->ta_params.ul_ta_i | |
2910 ,grr_data->ta_params.ul_ta_tn); | |
2911 | |
2912 grr_data->ta_params.ul_ta_i = 0xFF; | |
2913 grr_data->ta_params.ul_ta_tn = 0xFF; | |
2914 } | |
2915 } | |
2916 break; | |
2917 default: | |
2918 TRACE_ERROR( "TBF RELEASED, stay in tbf mode, concurrent tbf or no tbf ????" ); | |
2919 break; | |
2920 } | |
2921 break; | |
2922 case TC_CPAP: | |
2923 case TC_WAIT_ASSIGN: | |
2924 case TC_POLLING: | |
2925 case TC_WAIT_2P_ASSIGN: | |
2926 /* in these cases the prim shall not occur */ | |
2927 default: | |
2928 TRACE_ERROR( "SIG_GFP_TC_TBF_RELEASE_CON unexpected" ); | |
2929 break; | |
2930 } | |
2931 | |
2932 } /* sig_gfp_tc_tbf_release_con() */ | |
2933 | |
2934 /* | |
2935 +------------------------------------------------------------------------------ | |
2936 | Function : sig_gfp_tc_stop_single_block_con | |
2937 +------------------------------------------------------------------------------ | |
2938 | Description : Handles | |
2939 | | |
2940 | Parameters : T_MPHP_STOP_SINGLE_BLOCK_CON * mphp_stop_single_block_con_i | |
2941 | | |
2942 +------------------------------------------------------------------------------ | |
2943 */ | |
2944 GLOBAL void sig_gfp_tc_stop_single_block_con (T_MPHP_STOP_SINGLE_BLOCK_CON * mphp_stop_single_block_con_i ) | |
2945 { | |
2946 TRACE_ISIG( "sig_gfp_tc_stop_single_block_con" ); | |
2947 | |
2948 switch( GET_STATE( TC ) ) | |
2949 { | |
2950 case TC_PIM: | |
2951 TRACE_EVENT("MPHP_STOP_SINGLE_BLOCK_CON in TC_PIM: nothing to do"); | |
2952 tc_cgrlc_access_status_req(); | |
2953 break; | |
2954 case TC_WAIT_2P_ASSIGN: | |
2955 if(grr_t_status( T3172_1 ) > 0) | |
2956 { | |
2957 tc_cgrlc_ul_tbf_res(CGRLC_TBF_MODE_ACCESS_FAILED,CGRLC_PRIM_STATUS_ONE); | |
2958 sig_tc_ctrl_set_pckt_mode( GLBL_PCKT_MODE_IDLE, TASK_STOP_DUMMY_VALUE ); | |
2959 } | |
2960 else | |
2961 { | |
2962 /* | |
2963 * two phase access has failed | |
2964 */ | |
2965 SET_STATE(TC,TC_PIM); | |
2966 tc_cgrlc_ul_tbf_res(CGRLC_TBF_MODE_ACCESS_FAILED,CGRLC_PRIM_STATUS_NULL); | |
2967 } | |
2968 break; | |
2969 case TC_ACCESS_DISABLED: | |
2970 if(!grr_data->tc.two_2p_w_4_tbf_con) | |
2971 { | |
2972 TRACE_EVENT("BLC_C abort TBF"); | |
2973 tc_abort_tbf( grr_data->tbf_type ); | |
2974 } | |
2975 else | |
2976 { | |
2977 tc_call_disable_callback_func( ); | |
2978 } | |
2979 | |
2980 break; | |
2981 case TC_SINGLE_BLOCK: | |
2982 /* | |
2983 * single block procedure for uplink ctrl message or receiving DL block stopped | |
2984 */ | |
2985 /* | |
2986 * Stay in TC_SINGLE_BLOCK state while access reject is running. | |
2987 * Go to TC_PIM after T3170 is expired | |
2988 */ | |
2989 if( grr_t_status( T3170 ) EQ 0 ) | |
2990 { | |
2991 SET_STATE(TC,TC_PIM); | |
2992 tc_cgrlc_access_status_req(); | |
2993 } | |
2994 break; | |
2995 default: | |
2996 TRACE_ERROR( "SIG_GFP_TC_STOP_SINGLE_BLOCK_CON unexpected" ); | |
2997 break; | |
2998 } | |
2999 } /* sig_gfp_tc_stop_single_block_con () */ | |
3000 | |
3001 | |
3002 | |
3003 /* | |
3004 +------------------------------------------------------------------------------ | |
3005 | Function : sig_gfp_tc_packet_tbf_rel_ptm | |
3006 +------------------------------------------------------------------------------ | |
3007 | Description : Handles the signal sig_gfp_tc_packet_tbf_rel_ptm | |
3008 | | |
3009 | Parameters : | |
3010 | | |
3011 +------------------------------------------------------------------------------ | |
3012 */ | |
3013 GLOBAL void sig_gfp_tc_packet_tbf_rel_ptm (ULONG fn, UBYTE rrbp, UBYTE sp ) | |
3014 { | |
3015 MCAST(d_tbf_release,D_TBF_RELEASE); | |
3016 | |
3017 TRACE_ISIG( "sig_gfp_tc_packet_tbf_rel_ptm" ); | |
3018 | |
3019 switch( GET_STATE( TC ) ) | |
3020 { | |
3021 case TC_CONTENTION_RESOLUTION: | |
3022 case TC_TBF_ACTIVE: | |
3023 | |
3024 | |
3025 if( !d_tbf_release->dl_release AND | |
3026 !d_tbf_release->ul_release) | |
3027 { | |
3028 TRACE_ERROR("no release request in packet tbf release"); | |
3029 return; | |
3030 } | |
3031 else | |
3032 { | |
3033 T_TBF_TYPE tbf_type = CGRLC_TBF_MODE_NULL; | |
3034 UBYTE rel_cause = CGRLC_TBF_REL_ABNORMAL; | |
3035 ULONG rel_fn = CGRLC_STARTING_TIME_NOT_PRESENT; | |
3036 | |
3037 | |
3038 if( d_tbf_release->dl_release AND | |
3039 d_tbf_release->ul_release ) | |
3040 { | |
3041 if (grr_data->tbf_type EQ CGRLC_TBF_MODE_DL_UL) | |
3042 { | |
3043 tbf_type = CGRLC_TBF_MODE_DL_UL; | |
3044 } | |
3045 else if (grr_data->tbf_type EQ CGRLC_TBF_MODE_UL) | |
3046 { | |
3047 tbf_type = CGRLC_TBF_MODE_UL; | |
3048 } | |
3049 else if (grr_data->tbf_type EQ CGRLC_TBF_MODE_DL) | |
3050 { | |
3051 tbf_type = CGRLC_TBF_MODE_DL; | |
3052 } | |
3053 } | |
3054 | |
3055 else | |
3056 if ( d_tbf_release->dl_release AND | |
3057 ((grr_data->tbf_type EQ CGRLC_TBF_MODE_DL) OR | |
3058 (grr_data->tbf_type EQ CGRLC_TBF_MODE_DL_UL))) | |
3059 { | |
3060 tbf_type = CGRLC_TBF_MODE_DL; | |
3061 } | |
3062 | |
3063 else | |
3064 if ( d_tbf_release->ul_release AND | |
3065 ((grr_data->tbf_type EQ CGRLC_TBF_MODE_UL) OR | |
3066 (grr_data->tbf_type EQ CGRLC_TBF_MODE_DL_UL))) | |
3067 { | |
3068 tbf_type = CGRLC_TBF_MODE_UL; | |
3069 } | |
3070 | |
3071 | |
3072 if( sp ) | |
3073 { | |
3074 rel_fn = grr_calc_new_poll_pos(fn,rrbp); | |
3075 } | |
3076 | |
3077 if( d_tbf_release->rel_cause EQ NORMAL_RELEASE) | |
3078 { | |
3079 if ( d_tbf_release->ul_release AND | |
3080 ((grr_data->tbf_type EQ CGRLC_TBF_MODE_UL) OR | |
3081 (grr_data->tbf_type EQ CGRLC_TBF_MODE_DL_UL))) | |
3082 | |
3083 { | |
3084 rel_cause = CGRLC_TBF_REL_NORMAL; | |
3085 } | |
3086 } | |
3087 | |
3088 tc_cgrlc_tbf_rel_req(tbf_type,rel_cause,rel_fn); | |
3089 } | |
3090 break; | |
3091 default: | |
3092 TRACE_ERROR( "SIG_GFP_TC_PACKET_TBF_REL_PTM unexpected" ); | |
3093 break; | |
3094 } | |
3095 | |
3096 } /* sig_gfp_tc_packet_tbf_rel_ptm () */ | |
3097 | |
3098 | |
3099 | |
3100 /* | |
3101 +------------------------------------------------------------------------------ | |
3102 | Function : sig_gfp_tc_poll_ind | |
3103 +------------------------------------------------------------------------------ | |
3104 | Description : Handles the signal sig_gfp_tc_poll_ind | |
3105 | | |
3106 | Parameters : | |
3107 | | |
3108 +------------------------------------------------------------------------------ | |
3109 */ | |
3110 GLOBAL void sig_gfp_tc_poll_ind (ULONG fn, UBYTE rrbp, UBYTE poll_type,UBYTE pctrl_ack ) | |
3111 { | |
3112 | |
3113 TRACE_ISIG( "sig_gfp_tc_poll_ind" ); | |
3114 | |
3115 switch( GET_STATE( TC ) ) | |
3116 { | |
3117 case TC_PIM: | |
3118 case TC_CPAP: | |
3119 case TC_POLLING: | |
3120 case TC_WAIT_ASSIGN: | |
3121 case TC_WAIT_2P_ASSIGN: | |
3122 case TC_SINGLE_BLOCK: | |
3123 case TC_WAIT_STOP_TASK_CNF: | |
3124 | |
3125 switch(grr_data->tbf_type) | |
3126 { | |
3127 case CGRLC_TBF_MODE_NULL: | |
3128 tc_send_polling_res ( poll_type,fn,rrbp,pctrl_ack); | |
3129 break; | |
3130 default: | |
3131 TRACE_ERROR( "SIG_GFP_TC_POLL_IND unexpected tbf_type" ); | |
3132 break; | |
3133 } | |
3134 break; | |
3135 default: | |
3136 TRACE_ERROR( "SIG_GFP_TC_POLL_IND unexpected" ); | |
3137 break; | |
3138 } | |
3139 | |
3140 } /* sig_gfp_tc_poll_ind () */ | |
3141 | |
3142 | |
3143 /* | |
3144 +------------------------------------------------------------------------------ | |
3145 | Function : sig_ctrl_tc_delete_cs_msg | |
3146 +------------------------------------------------------------------------------ | |
3147 | Description : This function deletes the control blocks of cs owner. This | |
3148 | function is called when MS is moving from PAM to PTM. In this | |
3149 | scenario it has to delete PMRs if any. | |
3150 | | |
3151 | Parameters : | |
3152 | | |
3153 +------------------------------------------------------------------------------ | |
3154 */ | |
3155 | |
3156 GLOBAL void sig_ctrl_tc_delete_cs_msg ( void ) | |
3157 { | |
3158 UBYTE i= 0; | |
3159 | |
3160 TRACE_FUNCTION( "sig_ctrl_tc_delete_cs_msg" ); | |
3161 | |
3162 | |
3163 while( i < MAX_CTRL_BLK_NUM AND | |
3164 grr_data->tc.ul_ctrl_blk.seq[i] NEQ MAX_CTRL_BLK_NUM ) | |
3165 { | |
3166 if( grr_data->tc.ul_ctrl_blk.blk[grr_data->tc.ul_ctrl_blk.seq[i]].state | |
3167 EQ BLK_STATE_ALLOCATED ) | |
3168 { | |
3169 /* remove control block */ | |
3170 TRACE_EVENT_P2("Delete Control msg sequence:%d owner:%d", | |
3171 grr_data->tc.ul_ctrl_blk.seq[i], | |
3172 grr_data->tc.ul_ctrl_blk.blk[grr_data->tc.ul_ctrl_blk.seq[i]].owner); | |
3173 if (CGRLC_BLK_OWNER_CS EQ grr_data->tc.ul_ctrl_blk.blk[grr_data->tc.ul_ctrl_blk.seq[i]].owner) | |
3174 { | |
3175 tc_cancel_ctrl_blk(grr_data->tc.ul_ctrl_blk.blk[grr_data->tc.ul_ctrl_blk.seq[i]].owner); | |
3176 } | |
3177 | |
3178 } | |
3179 } | |
3180 | |
3181 | |
3182 }/* sig_ctrl_tc_delete_cs_msg*/ |