comparison g23m-aci/uart/uart_drxs.c @ 0:75a11d740a02

initial import of gsm-fw from freecalypso-sw rev 1033:5ab737ac3ad7
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 09 Jun 2016 00:02:41 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:75a11d740a02
1 /*
2 +-----------------------------------------------------------------------------
3 | Project :
4 | Modul :
5 +-----------------------------------------------------------------------------
6 | Copyright 2002 Texas Instruments Berlin, AG
7 | All rights reserved.
8 |
9 | This file is confidential and a trade secret of Texas
10 | Instruments Berlin, AG
11 | The receipt of or possession of this file does not convey
12 | any rights to reproduce or disclose its contents or to
13 | manufacture, use, or sell anything it may describe, in
14 | whole, or in part, without the specific written consent of
15 | Texas Instruments Berlin, AG.
16 +-----------------------------------------------------------------------------
17 | Purpose : This modul is part of the entity UART and implements all
18 | functions to handles the incoming process internal signals as
19 | described in the SDL-documentation (DRX-statemachine)
20 +-----------------------------------------------------------------------------
21 */
22
23 #ifndef UART_DRXS_C
24 #define UART_DRXS_C
25 #endif /* !UART_DRXS_C */
26
27 #include "config.h"
28 #include "fixedconf.h"
29 #include "condat-features.h"
30
31 #define ENTITY_UART
32
33 /*==== INCLUDES =============================================================*/
34
35 #ifdef WIN32
36 #include "nucleus.h"
37 #endif /* WIN32 */
38 #include "typedefs.h" /* to get Condat data types */
39 #include "vsi.h" /* to get a lot of macros */
40 #include "macdef.h" /* to get a lot of macros */
41 #include "custom.h"
42 #include "gsm.h" /* to get a lot of macros */
43 #include "cnf_uart.h" /* to get cnf-definitions */
44 #include "mon_uart.h" /* to get mon-definitions */
45 #include "prim.h" /* to get the definitions of used SAP and directions */
46 #ifdef DTILIB
47 #include "dti.h" /* to get dti lib */
48 #endif /* DTILIB */
49 #include "pei.h" /* to get PEI interface */
50 #ifdef FF_MULTI_PORT
51 #include "gsi.h" /* to get definitions of serial driver */
52 #else /* FF_MULTI_PORT */
53 #ifdef _TARGET_
54 #include "../../serial/serialswitch.h"
55 #include "../../serial/traceswitch.h"
56 #else /* _TARGET_ */
57 #include "serial_dat.h" /* to get definitions of serial driver */
58 #endif /* _TARGET_ */
59 #endif /* FF_MULTI_PORT */
60 #include "uart.h" /* to get the global entity definitions */
61
62 #include "uart_drxf.h" /* to get the DRX function declarations */
63 #include "uart_kers.h" /* to get the KER signal declarations */
64 #ifdef FF_MULTI_PORT
65 #include "uart_ptxs.h" /* to get signal definitions for service TX */
66 #else /* FF_MULTI_PORT */
67 #include "uart_txs.h" /* to get signal definitions for service TX */
68 #endif /* FF_MULTI_PORT */
69
70 /*==== CONST ================================================================*/
71
72 /*==== LOCAL VARS ===========================================================*/
73
74 /*==== PRIVATE FUNCTIONS ====================================================*/
75
76 /*==== PUBLIC FUNCTIONS =====================================================*/
77
78
79
80 /*
81 +------------------------------------------------------------------------------
82 | Function : sig_ker_drx_ready_mode_req
83 +------------------------------------------------------------------------------
84 | Description : Handles the internal signal SIG_KER_DRX_READY_MODE_REQ
85 |
86 | Parameters : dlc_instance - dlc instance wich belongs to this DRX instance
87 |
88 +------------------------------------------------------------------------------
89 */
90 GLOBAL void sig_ker_drx_ready_mode_req (UBYTE dlc_instance)
91 {
92 TRACE_ISIG( "sig_ker_drx_ready_mode_req" );
93
94 uart_data->drx->dlc_instance = dlc_instance;
95
96 switch( GET_STATE( UART_SERVICE_DRX ) )
97 {
98 case DRX_DEAD:
99 /*
100 * new DLC starts with enabled data flow
101 */
102 uart_data->drx->data_flow = UART_FLOW_ENABLED;
103
104 #ifdef DTILIB
105 if((uart_data->drx->dti_drx_state NEQ DTI_CLOSED ) &&
106 (uart_data->drx->sending_state EQ UART_DRX_NOT_SENDING))
107 {
108 /*
109 * signal availability to higher layer if currently not sending
110 */
111 SET_STATE( UART_SERVICE_DRX, DRX_READY );
112 #ifdef FLOW_TRACE
113 sndcp_trace_flow_control(FLOW_TRACE_UART, FLOW_TRACE_DOWN, FLOW_TRACE_TOP, TRUE);
114 #endif /* FLOW_TRACE */
115 dti_start(
116 uart_hDTI,
117 uart_data->device,
118 UART_DTI_UP_INTERFACE,
119 uart_data->drx->dlc_instance);
120 }
121 #else /* DTILIB */
122 if((uart_data->drx->hComm_DRX_UPLINK NEQ VSI_ERROR ) &&
123 (uart_data->drx->sending_state EQ UART_DRX_NOT_SENDING))
124 {
125 /*
126 * signal availability to higher layer if currently not sending
127 */
128 PALLOC (dti_ready_ind, DTI_READY_IND);
129 SET_STATE( UART_SERVICE_DRX, DRX_READY );
130 dti_ready_ind->tui = uart_data->tui_uart;
131 dti_ready_ind->c_id = drx_get_channel_id();
132 #ifdef _SIMULATION_
133 dti_ready_ind->op_ack = 0;
134 #endif /* _SIMULATION_ */
135 #ifdef FLOW_TRACE
136 sndcp_trace_flow_control(FLOW_TRACE_UART, FLOW_TRACE_DOWN, FLOW_TRACE_TOP, TRUE);
137 #endif /* FLOW_TRACE */
138 PSEND (uart_data->drx->hComm_DRX_UPLINK, dti_ready_ind);
139 }
140 #endif /* DTILIB */
141 else
142 {
143 /*
144 * no peer yet, just switch to NOT READY and wait
145 * for the signal SIG_KER_DRX_SET_DTI_PEER_REQ
146 */
147 #ifdef DTILIB
148 if(uart_data->drx->dti_drx_state NEQ DTI_CLOSED )
149 dti_stop(
150 uart_hDTI,
151 uart_data->device,
152 UART_DTI_UP_INTERFACE,
153 uart_data->drx->dlc_instance
154 );
155 #endif /* DTILIB */
156 SET_STATE( UART_SERVICE_DRX, DRX_NOT_READY );
157 }
158 break;
159
160 case DRX_READY:
161 case DRX_NOT_READY:
162 case DRX_FLUSHING:
163 break;
164
165 default:
166 TRACE_ERROR( "SIG_KER_DRX_READY_MODE_REQ unexpected" );
167 break;
168 }
169 } /* sig_ker_drx_ready_mode_req() */
170
171
172
173 /*
174 +------------------------------------------------------------------------------
175 | Function : sig_ker_drx_dead_mode_req
176 +------------------------------------------------------------------------------
177 | Description : Handles the internal signal SIG_KER_DRX_DEAD_MODE_REQ
178 |
179 | Parameters : none
180 |
181 +------------------------------------------------------------------------------
182 */
183 GLOBAL void sig_ker_drx_dead_mode_req ()
184 {
185 TRACE_ISIG( "sig_ker_drx_dead_mode_req" );
186
187 switch( GET_STATE( UART_SERVICE_DRX ) )
188 {
189 case DRX_READY:
190 SET_STATE( UART_SERVICE_DRX, DRX_DEAD );
191 /*
192 * free all resources
193 */
194 #ifdef DTILIB
195 uart_data->drx->dti_drx_state = DTI_CLOSED;
196 #else /* DTILIB */
197 uart_data->drx->hComm_DRX_UPLINK = VSI_ERROR;
198 #endif /* DTILIB */
199 drx_free_resources();
200 break;
201
202 case DRX_FLUSHING:
203 sig_any_ker_flushed_ind(uart_data->drx->dlc_instance);
204 /* fall through */
205 case DRX_NOT_READY:
206 SET_STATE( UART_SERVICE_DRX, DRX_DEAD );
207
208 #ifdef DTILIB
209 uart_data->drx->dti_drx_state = DTI_CLOSED;
210 #else /* DTILIB */
211 uart_data->drx->hComm_DRX_UPLINK = VSI_ERROR;
212 #endif /* DTILIB */
213 if(uart_data->drx->sending_state EQ UART_DRX_NOT_SENDING)
214 {
215 /*
216 * signal that there is not any more data available
217 */
218 sig_drx_tx_data_not_available_ind(uart_data->drx->dlc_instance);
219 /*
220 * free all resources:
221 */
222 drx_free_resources();
223 }
224 else
225 uart_data->drx->sending_state = UART_DRX_INVALID;
226 break;
227
228 case DRX_DEAD:
229 break;
230
231 default:
232 TRACE_ERROR( "SIG_KER_DRX_DEAD_MODE_REQ unexpected" );
233 break;
234 }
235 } /* sig_ker_drx_dead_mode_req() */
236
237
238
239 /*
240 +------------------------------------------------------------------------------
241 | Function : sig_ker_drx_enable_req
242 +------------------------------------------------------------------------------
243 | Description : Handles the internal signal SIG_KER_DRX_ENABLE_REQ
244 |
245 | Parameters : none
246 |
247 +------------------------------------------------------------------------------
248 */
249 GLOBAL void sig_ker_drx_enable_req ()
250 {
251 TRACE_ISIG( "sig_ker_drx_enable_req" );
252
253 uart_data->drx->data_flow = UART_FLOW_ENABLED;
254
255 switch( GET_STATE( UART_SERVICE_DRX ) )
256 {
257 case DRX_READY:
258 break;
259
260 case DRX_FLUSHING:
261 case DRX_NOT_READY:
262 /*
263 * if DRX is not already sending and there is some data to be sent out,
264 * notify service TX that there is data available
265 */
266 if(uart_data->drx->sending_state EQ UART_DRX_NOT_SENDING)
267 {
268 if(uart_data->drx->received_data)
269 sig_drx_tx_data_available_ind( uart_data->drx->dlc_instance,
270 uart_data->drx->received_data,
271 uart_data->drx->read_pos);
272 else
273 #ifdef DTILIB
274 if( uart_data->drx->dti_drx_state NEQ DTI_CLOSED )
275 {
276 SET_STATE( UART_SERVICE_DRX, DRX_READY );
277 #ifdef FLOW_TRACE
278 sndcp_trace_flow_control(FLOW_TRACE_UART, FLOW_TRACE_DOWN, FLOW_TRACE_TOP, TRUE);
279 #endif /* FLOW_TRACE */
280 dti_start(
281 uart_hDTI,
282 uart_data->device,
283 UART_DTI_UP_INTERFACE,
284 uart_data->drx->dlc_instance
285 );
286 }
287 #else /* DTILIB */
288 if(uart_data->drx->hComm_DRX_UPLINK NEQ VSI_ERROR)
289 {
290 /*
291 * nothing more to send,
292 * signal to higher layer that we are able to receive more data
293 */
294 PALLOC (dti_ready_ind, DTI_READY_IND);
295 SET_STATE( UART_SERVICE_DRX, DRX_READY );
296 dti_ready_ind->tui = uart_data->tui_uart;
297 dti_ready_ind->c_id = drx_get_channel_id();
298 #ifdef _SIMULATION_
299 dti_ready_ind->op_ack = 0;
300 #endif /* _SIMULATION_ */
301 #ifdef FLOW_TRACE
302 sndcp_trace_flow_control(FLOW_TRACE_UART, FLOW_TRACE_DOWN, FLOW_TRACE_TOP, TRUE);
303 #endif /* FLOW_TRACE */
304 PSEND (uart_data->drx->hComm_DRX_UPLINK, dti_ready_ind);
305 }
306 #endif /* DTILIB */
307 }
308 break;
309
310 default:
311 TRACE_ERROR( "SIG_KER_DRX_ENABLE_REQ unexpected" );
312 break;
313 }
314 } /* sig_ker_drx_enable_req() */
315
316
317
318 /*
319 +------------------------------------------------------------------------------
320 | Function : sig_ker_drx_disable_req
321 +------------------------------------------------------------------------------
322 | Description : Handles the internal signal SIG_KER_DRX_DISABLE_REQ
323 |
324 | Parameters : none
325 |
326 +------------------------------------------------------------------------------
327 */
328 GLOBAL void sig_ker_drx_disable_req ()
329 {
330 TRACE_ISIG( "sig_ker_drx_disable_req" );
331
332 uart_data->drx->data_flow = UART_FLOW_DISABLED;
333
334 switch( GET_STATE( UART_SERVICE_DRX ) )
335 {
336 case DRX_READY:
337 break;
338
339 case DRX_FLUSHING:
340 case DRX_NOT_READY:
341 /*
342 * stop sending if possible
343 */
344 if(uart_data->drx->sending_state EQ UART_DRX_NOT_SENDING)
345 sig_drx_tx_data_not_available_ind(uart_data->drx->dlc_instance);
346 break;
347
348 default:
349 TRACE_ERROR( "SIG_KER_DRX_DISABLE_REQ unexpected" );
350 break;
351 }
352 } /* sig_ker_drx_disable_req() */
353
354
355
356 /*
357 +------------------------------------------------------------------------------
358 | Function : sig_tx_drx_sending_req
359 +------------------------------------------------------------------------------
360 | Description : Handles the internal signal SIG_TX_DRX_SENDING_REQ
361 |
362 | Parameters : dummy - description of parameter dummy
363 |
364 +------------------------------------------------------------------------------
365 */
366 GLOBAL void sig_tx_drx_sending_req ()
367 {
368 TRACE_ISIG( "sig_tx_drx_sending_req" );
369
370 switch( GET_STATE( UART_SERVICE_DRX ) )
371 {
372 case DRX_FLUSHING:
373 case DRX_NOT_READY:
374 uart_data->drx->sending_state = UART_DRX_SENDING;
375 break;
376
377 default:
378 TRACE_ERROR( "SIG_TX_DRX_SENDING_REQ unexpected" );
379 break;
380 }
381 } /* sig_tx_drx_sending_req() */
382
383
384
385 /*
386 +------------------------------------------------------------------------------
387 | Function : sig_tx_drx_data_sent_req
388 +------------------------------------------------------------------------------
389 | Description : Handles the internal signal SIG_TX_DRX_DATA_SENT_REQ
390 |
391 | Parameters : rest_data - generic data descriptor of "still to send" data
392 | pos - current position in first rest data buffer
393 |
394 +------------------------------------------------------------------------------
395 */
396 GLOBAL void sig_tx_drx_data_sent_req ( T_desc2 *rest_data, USHORT pos )
397 {
398 T_desc2 *next_desc;
399 T_desc2 *desc;
400
401 TRACE_ISIG( "sig_tx_drx_data_sent_req" );
402
403 switch( GET_STATE( UART_SERVICE_DRX ) )
404 {
405 case DRX_DEAD:
406 uart_data->drx->sending_state = UART_DRX_NOT_SENDING;
407 /*
408 * Since the service is dead, free all resources and the rest of data
409 */
410 drx_free_resources();
411 break;
412
413 case DRX_NOT_READY:
414 if(uart_data->drx->sending_state EQ UART_DRX_INVALID)
415 {
416 /*
417 * because we are in an invalid sending state, free all resources
418 */
419 drx_free_resources();
420 }
421 else
422 {
423 /*
424 * free all data descriptors in front of the remaining data
425 */
426 desc = uart_data->drx->received_data;
427 while((desc NEQ rest_data) && (desc NEQ NULL))
428 {
429 next_desc = (T_desc2 *)desc->next;
430 MFREE (desc);
431 desc = next_desc;
432 }
433 /*
434 * set received_data descriptor to remaining data, remember position
435 */
436 uart_data->drx->received_data = desc;
437 uart_data->drx->read_pos = pos;
438 }
439
440 uart_data->drx->sending_state = UART_DRX_NOT_SENDING;
441
442 if(uart_data->drx->data_flow EQ UART_FLOW_ENABLED)
443 {
444 if(uart_data->drx->received_data)
445 {
446 /*
447 * data flow is enabled and there is more data to send
448 */
449 sig_drx_tx_data_available_ind(uart_data->drx->dlc_instance,
450 uart_data->drx->received_data,
451 uart_data->drx->read_pos);
452 }
453 else
454 /*
455 * data flow is enabled but there is nothing more to send,
456 * so do positive flow control
457 */
458 #ifdef DTILIB
459 if( uart_data->drx->dti_drx_state NEQ DTI_CLOSED )
460 {
461 SET_STATE( UART_SERVICE_DRX, DRX_READY );
462 #ifdef FLOW_TRACE
463 sndcp_trace_flow_control(FLOW_TRACE_UART, FLOW_TRACE_DOWN, FLOW_TRACE_TOP, TRUE);
464 #endif /* FLOW_TRACE */
465 dti_start(
466 uart_hDTI,
467 uart_data->device,
468 UART_DTI_UP_INTERFACE,
469 uart_data->drx->dlc_instance
470 );
471 }
472 #else /* DTILIB */
473 if(uart_data->drx->hComm_DRX_UPLINK NEQ VSI_ERROR)
474 {
475 PALLOC (dti_ready_ind, DTI_READY_IND);
476 SET_STATE( UART_SERVICE_DRX, DRX_READY );
477 dti_ready_ind->tui = uart_data->tui_uart;
478 dti_ready_ind->c_id = drx_get_channel_id();
479 #ifdef _SIMULATION_
480 dti_ready_ind->op_ack = 0;
481 #endif /* _SIMULATION_ */
482 #ifdef FLOW_TRACE
483 sndcp_trace_flow_control(FLOW_TRACE_UART, FLOW_TRACE_DOWN, FLOW_TRACE_TOP, TRUE);
484 #endif /* FLOW_TRACE */
485 PSEND (uart_data->drx->hComm_DRX_UPLINK, dti_ready_ind);
486 }
487 #endif /* DTILIB */
488 }
489 break;
490
491 case DRX_FLUSHING:
492 /*
493 * free all data descriptors in front of the remaining data
494 */
495 desc = uart_data->drx->received_data;
496 while((desc NEQ rest_data) && (desc NEQ NULL))
497 {
498 next_desc = (T_desc2 *)desc->next;
499 MFREE (desc);
500 desc = next_desc;
501 }
502 /*
503 * set received_data descriptor to remaining data, remember position
504 */
505 uart_data->drx->received_data = desc;
506 uart_data->drx->read_pos = pos;
507
508 uart_data->drx->sending_state = UART_DRX_NOT_SENDING;
509
510 if(uart_data->drx->received_data)
511 {
512 if(uart_data->drx->data_flow EQ UART_FLOW_ENABLED)
513 /*
514 * data flow is enabled and there is more data to send
515 */
516 sig_drx_tx_data_available_ind(uart_data->drx->dlc_instance,
517 uart_data->drx->received_data,
518 uart_data->drx->read_pos);
519 }
520 else
521 #ifdef DTILIB
522 if(( uart_data->drx->dti_drx_state NEQ DTI_CLOSED ) &&
523 (uart_data->drx->data_flow EQ UART_FLOW_ENABLED))
524 {
525 SET_STATE( UART_SERVICE_DRX, DRX_READY );
526 sig_any_ker_flushed_ind(uart_data->drx->dlc_instance);
527 #ifdef FLOW_TRACE
528 sndcp_trace_flow_control(FLOW_TRACE_UART, FLOW_TRACE_DOWN, FLOW_TRACE_TOP, TRUE);
529 #endif /* FLOW_TRACE */
530 dti_start(
531 uart_hDTI,
532 uart_data->device,
533 UART_DTI_UP_INTERFACE,
534 uart_data->drx->dlc_instance
535 );
536 }
537 #else /* DTILIB */
538 if((uart_data->drx->hComm_DRX_UPLINK NEQ VSI_ERROR) &&
539 (uart_data->drx->data_flow EQ UART_FLOW_ENABLED))
540 {
541 /*
542 * data flow is enabled but there is nothing more to send,
543 * so send flush signal and positive flow control
544 */
545 PALLOC (dti_ready_ind, DTI_READY_IND);
546 SET_STATE( UART_SERVICE_DRX, DRX_READY );
547 sig_any_ker_flushed_ind(uart_data->drx->dlc_instance);
548 dti_ready_ind->tui = uart_data->tui_uart;
549 dti_ready_ind->c_id = drx_get_channel_id();
550 #ifdef _SIMULATION_
551 dti_ready_ind->op_ack = 0;
552 #endif /* _SIMULATION_ */
553 #ifdef FLOW_TRACE
554 sndcp_trace_flow_control(FLOW_TRACE_UART, FLOW_TRACE_DOWN, FLOW_TRACE_TOP, TRUE);
555 #endif /* FLOW_TRACE */
556 PSEND (uart_data->drx->hComm_DRX_UPLINK, dti_ready_ind);
557 }
558 #endif /* DTILIB */
559 else
560 {
561 /*
562 * data flushed
563 */
564 SET_STATE( UART_SERVICE_DRX, DRX_NOT_READY );
565 #ifdef DTILIB
566 dti_stop(
567 uart_hDTI,
568 uart_data->device,
569 UART_DTI_UP_INTERFACE,
570 uart_data->drx->dlc_instance
571 );
572 #endif /* DTILIB */
573 sig_any_ker_flushed_ind(uart_data->drx->dlc_instance);
574 }
575 break;
576
577 default:
578 TRACE_ERROR( "SIG_TX_DRX_DATA_SENT_REQ unexpected" );
579 break;
580 }
581 } /* sig_tx_drx_data_sent_req() */
582
583
584
585 #ifdef DTILIB
586
587 /*
588 +------------------------------------------------------------------------------
589 | Function : sig_ker_drx_disconnected_mode_req
590 +------------------------------------------------------------------------------
591 | Description : Handles the internal signal SIG_KER_DRX_DISCONNECTED_MODE_REQ
592 |
593 | Parameters : none
594 |
595 +------------------------------------------------------------------------------
596 */
597 GLOBAL void sig_ker_drx_disconnected_mode_req ()
598 {
599 TRACE_ISIG( "sig_ker_drx_disconnected_mode_req" );
600
601 uart_data->drx->dti_drx_state = DTI_CLOSED;
602
603 switch(GET_STATE( UART_SERVICE_DRX) )
604 {
605 case DRX_READY:
606 SET_STATE( UART_SERVICE_DRX, DRX_NOT_READY );
607 break;
608 case DRX_NOT_READY:
609 break;
610 default:
611 TRACE_ERROR( "SIG_KER_DRX_DISCONNECTED_MODE_REQ unexpected" );
612 break;
613 }
614
615 } /* sig_ker_drx_disconnected_mode_req() */
616
617
618
619 /*
620 +------------------------------------------------------------------------------
621 | Function : sig_ker_drx_set_dtilib_peer_req
622 +------------------------------------------------------------------------------
623 | Description : Handles the internal signal SIG_KER_DRX_SET_DTI_PEER_REQ
624 | which is used to inform the service DRX that from now on it
625 | needs to communicate with a (new) peer
626 |
627 | Parameters : -
628 |
629 +------------------------------------------------------------------------------
630 */
631 GLOBAL void sig_ker_drx_set_dtilib_peer_req ()
632 {
633 TRACE_ISIG( "sig_ker_drx_set_dtilib_peer_req" );
634
635 uart_data->drx->dti_drx_state = DTI_IDLE;
636
637 switch( GET_STATE( UART_SERVICE_DRX ) )
638 {
639 case DRX_READY:
640 case DRX_NOT_READY:
641 /*
642 * signal availability to higher layer if currently not sending
643 */
644 if((uart_data->drx->received_data EQ NULL) &&
645 (uart_data->drx->data_flow EQ UART_FLOW_ENABLED) &&
646 (uart_data->drx->sending_state EQ UART_DRX_NOT_SENDING))
647 {
648 SET_STATE( UART_SERVICE_DRX, DRX_READY );
649 #ifdef FLOW_TRACE
650 sndcp_trace_flow_control(FLOW_TRACE_UART, FLOW_TRACE_DOWN, FLOW_TRACE_TOP, TRUE);
651 #endif /* FLOW_TRACE */
652 dti_start(
653 uart_hDTI,
654 uart_data->device,
655 UART_DTI_UP_INTERFACE,
656 uart_data->drx->dlc_instance
657 );
658 }
659 else
660 {
661 SET_STATE( UART_SERVICE_DRX, DRX_NOT_READY );
662 dti_stop(
663 uart_hDTI,
664 uart_data->device,
665 UART_DTI_UP_INTERFACE,
666 uart_data->drx->dlc_instance
667 );
668 }
669 break;
670
671 case DRX_FLUSHING:
672 case DRX_DEAD:
673 break;
674
675 default:
676 TRACE_ERROR( "SIG_KER_DRX_SET_DTI_PEER_REQ unexpected" );
677 break;
678 }
679 } /* sig_ker_drx_set_dtilib_peer_req() */
680
681
682 #else /* DTILIB */
683
684 /*
685 +------------------------------------------------------------------------------
686 | Function : sig_ker_drx_set_dti_peer_req
687 +------------------------------------------------------------------------------
688 | Description : Handles the internal signal SIG_KER_DRX_SET_DTI_PEER_REQ
689 | which is used to inform the service DRX that from now on it
690 | needs to communicate with a (new) peer
691 |
692 | Parameters : tui_peer - transmission unit identifier of peer
693 | peer_handle - VSI handle of peer (channel has to be opened)
694 | c_id - channel identifier of peer
695 |
696 +------------------------------------------------------------------------------
697 */
698 GLOBAL void sig_ker_drx_set_dti_peer_req (USHORT tui_peer,
699 T_HANDLE peer_handle,
700 UBYTE c_id)
701 {
702 USHORT i,pos;
703
704 TRACE_ISIG( "sig_ker_drx_set_dti_peer_req" );
705
706 /*
707 * set new vsi handle and
708 */
709 uart_data->drx->hComm_DRX_UPLINK = peer_handle;
710
711 /*
712 * search position in table
713 */
714 pos = UART_INSTANCES * UART_MAX_NUMBER_OF_CHANNELS;
715 for(i = 0; i < pos; i++)
716 {
717 if((uart_cid_table[i].drx EQ uart_data->drx) ||
718 (uart_cid_table[i].c_id EQ c_id))
719 {
720 pos = i;
721 }
722 }
723
724 if(pos < (UART_INSTANCES * UART_MAX_NUMBER_OF_CHANNELS))
725 {
726 /*
727 * valid position in table, update entry
728 */
729 uart_cid_table[pos].c_id = c_id;
730 uart_cid_table[pos].drx = uart_data->drx;
731 uart_cid_table[pos].uart_data = uart_data;
732 }
733 else
734 {
735 /*
736 * create new entry in table
737 */
738 for(i = 0; i < UART_INSTANCES * UART_MAX_NUMBER_OF_CHANNELS; i++)
739 {
740 if(uart_cid_table[i].dtx EQ NULL)
741 {
742 /*
743 * free space found, insert data
744 */
745 uart_cid_table[i].c_id = c_id;
746 uart_cid_table[i].drx = uart_data->drx;
747 uart_cid_table[i].uart_data = uart_data;
748 break;
749 }
750 }
751 }
752
753 switch( GET_STATE( UART_SERVICE_DRX ) )
754 {
755 case DRX_READY:
756 case DRX_NOT_READY:
757 /*
758 * signal availability to higher layer if currently not sending
759 */
760 if((uart_data->drx->received_data EQ NULL) &&
761 (uart_data->drx->data_flow EQ UART_FLOW_ENABLED) &&
762 (uart_data->drx->sending_state EQ UART_DRX_NOT_SENDING))
763 {
764 PALLOC (dti_ready_ind, DTI_READY_IND);
765 SET_STATE( UART_SERVICE_DRX, DRX_READY );
766 dti_ready_ind->tui = uart_data->tui_uart;
767 dti_ready_ind->c_id = drx_get_channel_id();
768 #ifdef _SIMULATION_
769 dti_ready_ind->op_ack = 0;
770 #endif /* _SIMULATION_ */
771 #ifdef FLOW_TRACE
772 sndcp_trace_flow_control(FLOW_TRACE_UART, FLOW_TRACE_DOWN, FLOW_TRACE_TOP, TRUE);
773 #endif /* FLOW_TRACE */
774 PSEND (uart_data->drx->hComm_DRX_UPLINK, dti_ready_ind);
775 }
776 else
777 {
778 SET_STATE( UART_SERVICE_DRX, DRX_NOT_READY );
779 }
780 break;
781
782 case DRX_FLUSHING:
783 case DRX_DEAD:
784 break;
785
786 default:
787 TRACE_ERROR( "SIG_KER_DRX_SET_DTI_PEER_REQ unexpected" );
788 break;
789 }
790 } /* sig_ker_drx_set_dti_peer_req() */
791
792 #endif /* DTILIB */
793
794
795 /*
796 +------------------------------------------------------------------------------
797 | Function : sig_ker_drx_flush_req
798 +------------------------------------------------------------------------------
799 | Description : Handles the internal signal SIG_KER_DRX_FLUSH_REQ which is used
800 | to trigger flushing of the service.
801 |
802 | Parameters : no parameters
803 |
804 +------------------------------------------------------------------------------
805 */
806 GLOBAL void sig_ker_drx_flush_req ()
807 {
808 TRACE_ISIG( "sig_ker_drx_flush_req" );
809
810 switch( GET_STATE( UART_SERVICE_DRX ) )
811 {
812 case DRX_READY:
813 sig_any_ker_flushed_ind(uart_data->drx->dlc_instance);
814 break;
815
816 case DRX_NOT_READY:
817 if((uart_data->drx->received_data) &&
818 (uart_data->drx->sending_state NEQ UART_DRX_INVALID))
819 {
820 SET_STATE( UART_SERVICE_DRX, DRX_FLUSHING );
821 }
822 else
823 {
824 sig_any_ker_flushed_ind(uart_data->drx->dlc_instance);
825 }
826 break;
827
828 case DRX_FLUSHING:
829 break;
830
831 default:
832 TRACE_ERROR( "SIG_KER_DRX_FLUSH_REQ unexpected" );
833 break;
834 }
835 } /* sig_ker_drx_flush_req() */