FreeCalypso > hg > fc-tourmaline
comparison src/g23m-gprs/llc/llc_txs.c @ 1:fa8dc04885d8
src/g23m-*: import from Magnetite
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 16 Oct 2020 06:25:50 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:4e78acac3d88 | 1:fa8dc04885d8 |
---|---|
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 LLC and implements all | |
18 | functions to handles the incoming process internal signals as | |
19 | described in the SDL-documentation (TX-statemachine) | |
20 +----------------------------------------------------------------------------- | |
21 */ | |
22 | |
23 #ifndef LLC_TXS_C | |
24 #define LLC_TXS_C | |
25 #endif | |
26 | |
27 #define ENTITY_LLC | |
28 | |
29 /*==== INCLUDES =============================================================*/ | |
30 | |
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 "cnf_llc.h" /* to get cnf-definitions */ | |
37 #include "mon_llc.h" /* to get mon-definitions */ | |
38 #include "prim.h" /* to get the definitions of used SAP and directions */ | |
39 #include "llc.h" /* to get the global entity definitions */ | |
40 #include "llc_f.h" | |
41 | |
42 #include "llc_txf.h" /* to get local TX functions */ | |
43 #include "llc_txl.h" /* to get local TX labels */ | |
44 #include "llc_uitxs.h" /* to get signal interface to UITX */ | |
45 #include "llc_itxs.h" /* to get signal interface to ITX */ | |
46 | |
47 #ifdef REL99 | |
48 #include "llc_uf.h" /* to get interface to U control frame */ | |
49 #endif /* REL99 */ | |
50 | |
51 /*==== CONST ================================================================*/ | |
52 | |
53 /*==== LOCAL VARS ===========================================================*/ | |
54 | |
55 /*==== PRIVATE FUNCTIONS ====================================================*/ | |
56 | |
57 /*==== PUBLIC FUNCTIONS =====================================================*/ | |
58 | |
59 | |
60 /* | |
61 +------------------------------------------------------------------------------ | |
62 | Function : sig_llme_tx_assign_req | |
63 +------------------------------------------------------------------------------ | |
64 | Description : Handles the internal signal SIG_LLME_TX_ASSIGN_REQ | |
65 | | |
66 | Parameters : | |
67 | | |
68 +------------------------------------------------------------------------------ | |
69 */ | |
70 GLOBAL void sig_llme_tx_assign_req (void) | |
71 { | |
72 T_SAPI sapi; | |
73 | |
74 | |
75 TRACE_ISIG( "sig_llme_tx_assign_req" ); | |
76 | |
77 switch( GET_STATE( TX ) ) | |
78 { | |
79 case TX_TLLI_UNASSIGNED_NOT_READY: | |
80 SET_STATE (TX, TX_TLLI_ASSIGNED_NOT_READY); | |
81 | |
82 /* | |
83 * ATTENTION: | |
84 * The following loops implies that all SAPIs are odd numbers beginning | |
85 * with 1! | |
86 */ | |
87 for (sapi = LL_SAPI_1; sapi <= LL_SAPI_11; sapi += 2) | |
88 { | |
89 SWITCH_SERVICE (llc, uitx, UIMAP(sapi)); | |
90 llc_data->current_sapi = sapi; | |
91 | |
92 sig_tx_uitx_ready_ind(); | |
93 } | |
94 | |
95 for (sapi = LL_SAPI_3; sapi <= LL_SAPI_11; sapi += 2) | |
96 { | |
97 SWITCH_SERVICE (llc, itx, IMAP(sapi)); | |
98 llc_data->current_sapi = sapi; | |
99 | |
100 if (sapi != LL_SAPI_7) | |
101 { | |
102 sig_tx_itx_ready_ind(); | |
103 } | |
104 } | |
105 break; | |
106 case TX_TLLI_UNASSIGNED_READY: | |
107 SET_STATE (TX, TX_TLLI_ASSIGNED_READY); | |
108 | |
109 /* | |
110 * ATTENTION: | |
111 * The following loops implies that all SAPIs are odd numbers beginning | |
112 * with 1! | |
113 */ | |
114 for (sapi = LL_SAPI_1; sapi <= LL_SAPI_11; sapi += 2) | |
115 { | |
116 SWITCH_SERVICE (llc, uitx, UIMAP(sapi)); | |
117 llc_data->current_sapi = sapi; | |
118 | |
119 sig_tx_uitx_ready_ind(); | |
120 } | |
121 | |
122 for (sapi = LL_SAPI_3; sapi <= LL_SAPI_11; sapi += 2) | |
123 { | |
124 SWITCH_SERVICE (llc, itx, IMAP(sapi)); | |
125 llc_data->current_sapi = sapi; | |
126 | |
127 if (sapi != LL_SAPI_7) | |
128 { | |
129 sig_tx_itx_ready_ind(); | |
130 } | |
131 } | |
132 break; | |
133 | |
134 default: | |
135 TRACE_ERROR( "SIG_LLME_TX_ASSIGN_REQ unexpected" ); | |
136 break; | |
137 } | |
138 | |
139 return; | |
140 } /* sig_llme_tx_assign_req() */ | |
141 | |
142 | |
143 /* | |
144 +------------------------------------------------------------------------------ | |
145 | Function : sig_llme_tx_unassign_req | |
146 +------------------------------------------------------------------------------ | |
147 | Description : Handles the internal signal SIG_LLME_TX_UNASSIGN_REQ | |
148 | | |
149 | Parameters : | |
150 | | |
151 +------------------------------------------------------------------------------ | |
152 */ | |
153 GLOBAL void sig_llme_tx_unassign_req (void) | |
154 { | |
155 TRACE_ISIG( "sig_llme_tx_unassign_req" ); | |
156 | |
157 switch( GET_STATE( TX ) ) | |
158 { | |
159 case TX_TLLI_ASSIGNED_NOT_READY: | |
160 tx_clear_buffer(); | |
161 SET_STATE (TX, TX_TLLI_UNASSIGNED_NOT_READY); | |
162 break; | |
163 | |
164 case TX_TLLI_ASSIGNED_READY: | |
165 tx_clear_buffer(); | |
166 SET_STATE (TX, TX_TLLI_UNASSIGNED_READY); | |
167 break; | |
168 | |
169 default: | |
170 TRACE_ERROR( "SIG_LLME_TX_UNASSIGN_REQ unexpected" ); | |
171 break; | |
172 } | |
173 | |
174 return; | |
175 } /* sig_llme_tx_unassign_req() */ | |
176 | |
177 | |
178 /* | |
179 +------------------------------------------------------------------------------ | |
180 | Function : sig_llme_tx_reset_req | |
181 +------------------------------------------------------------------------------ | |
182 | Description : Handles the internal signal SIG_LLME_TX_RESET_REQ | |
183 | | |
184 | Parameters : | |
185 | | |
186 +------------------------------------------------------------------------------ | |
187 */ | |
188 GLOBAL void sig_llme_tx_reset_req (void) | |
189 { | |
190 TRACE_ISIG( "sig_llme_tx_reset_req" ); | |
191 | |
192 switch( GET_STATE( TX ) ) | |
193 { | |
194 case TX_TLLI_ASSIGNED_NOT_READY: | |
195 /* | |
196 * No break! | |
197 */ | |
198 case TX_TLLI_ASSIGNED_READY: | |
199 tx_clear_buffer(); | |
200 //sig_tx_uitx_ready_ind(); | |
201 break; | |
202 | |
203 default: | |
204 TRACE_ERROR( "SIG_LLME_TX_RESET_REQ unexpected" ); | |
205 break; | |
206 } | |
207 | |
208 return; | |
209 } /* sig_llme_tx_reset_req() */ | |
210 | |
211 | |
212 /* | |
213 +------------------------------------------------------------------------------ | |
214 | Function : sig_llme_tx_ready_req | |
215 +------------------------------------------------------------------------------ | |
216 | Description : Handles the internal signal SIG_LLME_TX_READY_REQ | |
217 | | |
218 | Parameters : | |
219 | | |
220 +------------------------------------------------------------------------------ | |
221 */ | |
222 GLOBAL void sig_llme_tx_ready_req (void) | |
223 { | |
224 TRACE_ISIG( "sig_llme_tx_ready_req" ); | |
225 | |
226 switch( GET_STATE( TX ) ) | |
227 { | |
228 case TX_TLLI_ASSIGNED_NOT_READY: | |
229 /* | |
230 * No break! | |
231 */ | |
232 case TX_TLLI_ASSIGNED_READY: | |
233 sig_tx_uitx_ready_ind(); | |
234 break; | |
235 | |
236 default: | |
237 TRACE_ERROR( "SIG_LLME_TX_READY_REQ unexpected" ); | |
238 break; | |
239 } | |
240 | |
241 return; | |
242 } /* sig_llme_tx_ready_req() */ | |
243 | |
244 | |
245 | |
246 | |
247 /* | |
248 +------------------------------------------------------------------------------ | |
249 | Function : sig_u_tx_data_req | |
250 +------------------------------------------------------------------------------ | |
251 | Description : Handles the internal signal SIG_U_TX_DATA_REQ | |
252 | | |
253 | Parameters : ll_unitdata_req - a valid pointer to a GRLC-UNITDATA-REQ | |
254 | primitive | |
255 | cause - RLC/MAC cause | |
256 | | |
257 +------------------------------------------------------------------------------ | |
258 */ | |
259 GLOBAL void sig_u_tx_data_req | |
260 ( | |
261 #ifdef LL_DESC | |
262 T_LL_UNITDESC_REQ *ll_unitdesc_req, | |
263 #else | |
264 T_LL_UNITDATA_REQ *ll_unitdesc_req, | |
265 #endif | |
266 UBYTE cause | |
267 ) | |
268 { | |
269 ULONG reservation_no; | |
270 BOOL buffer_available; | |
271 UBYTE protected_mode; | |
272 | |
273 TRACE_ISIG( "sig_u_tx_data_req" ); | |
274 | |
275 switch( GET_STATE( TX ) ) | |
276 { | |
277 case TX_TLLI_ASSIGNED_NOT_READY: | |
278 /* No break. */ | |
279 case TX_TLLI_ASSIGNED_READY: | |
280 | |
281 /* | |
282 * U frames are always sent with default cause! except cell notification. | |
283 */ | |
284 #ifdef REL99 | |
285 if (cause EQ GRLC_DTACS_CELL_NOTIFI_NULL_FRAME) | |
286 { | |
287 tx_reserve_buffer (ll_unitdesc_req, PRIM_DATA, cause, | |
288 SERVICE_U, &reservation_no, &buffer_available); | |
289 } | |
290 else | |
291 #endif /* REL99 */ | |
292 { | |
293 tx_reserve_buffer (ll_unitdesc_req, PRIM_DATA, GRLC_DTACS_DEF, | |
294 SERVICE_U, &reservation_no, &buffer_available); | |
295 } | |
296 /* | |
297 * U frames are always sent in LLC protected mode. | |
298 */ | |
299 protected_mode = CCI_PM_PROTECTED; | |
300 | |
301 { | |
302 #ifdef LL_DESC | |
303 T_CCI_CIPHER_DESC_REQ *cci_cipher_desc_req; | |
304 MALLOC(cci_cipher_desc_req, sizeof(T_CCI_CIPHER_DESC_REQ)); | |
305 cci_cipher_desc_req->desc_list3.first = ll_unitdesc_req->desc_list3.first; | |
306 cci_cipher_desc_req->desc_list3.list_len = ll_unitdesc_req->desc_list3.list_len; | |
307 cci_cipher_desc_req->attached_counter = ll_unitdesc_req->attached_counter; | |
308 /* | |
309 * decrease attached counter. If no one is still attached | |
310 * free the primitive memory | |
311 */ | |
312 if (ll_unitdesc_req->attached_counter == CCI_NO_ATTACHE) | |
313 { | |
314 PFREE(ll_unitdesc_req); | |
315 } else { | |
316 TRACE_0_INFO("LL_UNITDESC_REQ still attached"); | |
317 } | |
318 #else | |
319 PPASS (ll_unitdesc_req, cci_cipher_desc_req, CCI_CIPHER_REQ); | |
320 #endif | |
321 /* | |
322 * Header size (offset of information) is reqired, if ciphering is used | |
323 * or if the frame shall be send in unprotected mode. In this case both | |
324 * is not true and so it can be ignored. | |
325 */ | |
326 cci_cipher_desc_req->header_size = 0; | |
327 | |
328 /* | |
329 * Associate reservation_no with the frame. | |
330 */ | |
331 cci_cipher_desc_req->reference1 = reservation_no; | |
332 | |
333 /* | |
334 * U frames are never sent ciphered, thus define LL_CIPHER_OFF and set | |
335 * N(S) to 0 (it is not used). | |
336 */ | |
337 tx_send_cipher_req (cci_cipher_desc_req, U_FRAME, protected_mode, 0, | |
338 LL_CIPHER_OFF, 0); | |
339 | |
340 } | |
341 break; | |
342 | |
343 default: | |
344 #ifdef LL_DESC | |
345 llc_cl_desc3_free((T_desc3*)ll_unitdesc_req->desc_list3.first); | |
346 #endif /* LL_DESC */ | |
347 PFREE (ll_unitdesc_req); | |
348 | |
349 TRACE_ERROR( "SIG_U_TX_DATA_REQ unexpected" ); | |
350 break; | |
351 } | |
352 } /* sig_u_tx_data_req() */ | |
353 | |
354 | |
355 /* | |
356 +------------------------------------------------------------------------------ | |
357 | Function : sig_uitx_tx_data_req | |
358 +------------------------------------------------------------------------------ | |
359 | Description : Handles the internal signal SIG_UITX_TX_DATA_REQ | |
360 | | |
361 | Parameters : ll_unitdata_req - a valid pointer to a GRLC-UNITDATA-REQ | |
362 | primitive | |
363 | cipher - indicates if the frame shall be ciphered or not | |
364 | | |
365 +------------------------------------------------------------------------------ | |
366 */ | |
367 GLOBAL void sig_uitx_tx_data_req | |
368 ( | |
369 #ifdef LL_DESC | |
370 T_LL_UNITDESC_REQ *ll_unitdesc_req, | |
371 #else | |
372 T_LL_UNITDATA_REQ *ll_unitdesc_req, | |
373 #endif | |
374 UBYTE cipher, | |
375 UBYTE cause, | |
376 T_FRAME_NUM nu, | |
377 ULONG oc | |
378 ) | |
379 | |
380 { | |
381 ULONG reservation_no; | |
382 BOOL buffer_available; | |
383 UBYTE protected_mode; | |
384 | |
385 | |
386 TRACE_ISIG( "sig_uitx_tx_data_req" ); | |
387 | |
388 switch( GET_STATE( TX ) ) | |
389 { | |
390 case TX_TLLI_ASSIGNED_NOT_READY: | |
391 /* No break. */ | |
392 case TX_TLLI_ASSIGNED_READY: | |
393 | |
394 tx_reserve_buffer (ll_unitdesc_req, PRIM_DATA, cause, SERVICE_UITX, | |
395 &reservation_no, &buffer_available); | |
396 | |
397 if (ll_unitdesc_req->ll_qos.relclass EQ LL_NO_REL) | |
398 { | |
399 protected_mode = CCI_PM_UNPROTECTED; | |
400 } | |
401 else /* reliability classes 4 - 1 */ | |
402 { | |
403 protected_mode = CCI_PM_PROTECTED; | |
404 } | |
405 | |
406 { | |
407 #ifdef LL_DESC | |
408 T_CCI_CIPHER_DESC_REQ *cci_cipher_desc_req; | |
409 MALLOC(cci_cipher_desc_req, sizeof(T_CCI_CIPHER_DESC_REQ)); | |
410 cci_cipher_desc_req->desc_list3.first = ll_unitdesc_req->desc_list3.first; | |
411 cci_cipher_desc_req->desc_list3.list_len = ll_unitdesc_req->desc_list3.list_len; | |
412 cci_cipher_desc_req->attached_counter = ll_unitdesc_req->attached_counter; | |
413 /* | |
414 * decrease attached counter. If no one is still attached | |
415 * free the primitive memory | |
416 */ | |
417 if (ll_unitdesc_req->attached_counter == CCI_NO_ATTACHE) | |
418 { | |
419 PFREE(ll_unitdesc_req); | |
420 } else { | |
421 TRACE_0_INFO("LL_UNITDESC_REQ still attached"); | |
422 } | |
423 #else | |
424 PPASS (ll_unitdesc_req, cci_cipher_desc_req, CCI_CIPHER_REQ); | |
425 #endif | |
426 /* | |
427 * Header size (offset of information) is reqired, if ciphering is used | |
428 * or if the frame shall be send in unprotected mode. | |
429 */ | |
430 cci_cipher_desc_req->header_size = UI_CTRL_MIN_OCTETS; | |
431 | |
432 /* | |
433 * Associate reservation_no with the frame. | |
434 */ | |
435 cci_cipher_desc_req->reference1 = reservation_no; | |
436 | |
437 tx_send_cipher_req (cci_cipher_desc_req, UI_FRAME, protected_mode, nu, | |
438 cipher, oc); | |
439 | |
440 if (buffer_available) | |
441 { | |
442 /* | |
443 * Buffer is still available for current SAPI. | |
444 */ | |
445 sig_tx_uitx_ready_ind(); | |
446 } | |
447 | |
448 } | |
449 break; | |
450 | |
451 default: | |
452 #ifdef LL_DESC | |
453 llc_cl_desc3_free((T_desc3*)ll_unitdesc_req->desc_list3.first); | |
454 #endif /* LL_DESC */ | |
455 PFREE (ll_unitdesc_req); | |
456 | |
457 TRACE_ERROR( "SIG_UITX_TX_DATA_REQ unexpected" ); | |
458 break; | |
459 } | |
460 } /* sig_uitx_tx_data_req() */ | |
461 | |
462 | |
463 /* | |
464 +------------------------------------------------------------------------------ | |
465 | Function : sig_uitx_tx_unitdata_req | |
466 +------------------------------------------------------------------------------ | |
467 | Description : Handles the internal signal SIG_UITX_TX_UNITDATA_REQ | |
468 | | |
469 | Parameters : ll_unitdata_req - a valid pointer to a GRLC-UNITDATA-REQ | |
470 | primitive | |
471 | cipher - indicates if the frame shall be ciphered or not | |
472 | | |
473 +------------------------------------------------------------------------------ | |
474 */ | |
475 GLOBAL void sig_uitx_tx_unitdata_req | |
476 ( | |
477 #ifdef LL_DESC | |
478 T_LL_UNITDESC_REQ *ll_unitdesc_req, | |
479 #else | |
480 T_LL_UNITDATA_REQ *ll_unitdesc_req, | |
481 #endif | |
482 UBYTE cipher, | |
483 T_FRAME_NUM nu, | |
484 ULONG oc | |
485 ) | |
486 | |
487 { | |
488 ULONG reservation_no; | |
489 BOOL buffer_available; | |
490 UBYTE protected_mode; | |
491 | |
492 | |
493 TRACE_ISIG( "sig_uitx_tx_unitdata_req" ); | |
494 | |
495 switch( GET_STATE( TX ) ) | |
496 { | |
497 case TX_TLLI_ASSIGNED_NOT_READY: | |
498 /* No break. */ | |
499 case TX_TLLI_ASSIGNED_READY: | |
500 | |
501 /* | |
502 * Parameter cause will be ignored for RLC/MAC unacknowledged frames, | |
503 * so set it to 0. | |
504 */ | |
505 tx_reserve_buffer (ll_unitdesc_req, PRIM_UNITDATA, 0, SERVICE_UITX, | |
506 &reservation_no, &buffer_available); | |
507 | |
508 if (ll_unitdesc_req->ll_qos.relclass EQ LL_NO_REL) | |
509 { | |
510 protected_mode = CCI_PM_UNPROTECTED; | |
511 } | |
512 else /* reliability classes 4 - 1 */ | |
513 { | |
514 protected_mode = CCI_PM_PROTECTED; | |
515 } | |
516 | |
517 { | |
518 #ifdef LL_DESC | |
519 T_CCI_CIPHER_DESC_REQ *cci_cipher_desc_req; | |
520 MALLOC(cci_cipher_desc_req, sizeof(T_CCI_CIPHER_DESC_REQ)); | |
521 cci_cipher_desc_req->desc_list3.first = ll_unitdesc_req->desc_list3.first; | |
522 cci_cipher_desc_req->desc_list3.list_len = ll_unitdesc_req->desc_list3.list_len; | |
523 cci_cipher_desc_req->attached_counter = ll_unitdesc_req->attached_counter; | |
524 /* | |
525 * decrease attached counter. If no one is still attached | |
526 * free the primitive memory | |
527 */ | |
528 if (ll_unitdesc_req->attached_counter == CCI_NO_ATTACHE) | |
529 { | |
530 PFREE(ll_unitdesc_req); | |
531 } else { | |
532 TRACE_0_INFO("LL_UNITDESC_REQ still attached"); | |
533 } | |
534 #else | |
535 PPASS (ll_unitdesc_req, cci_cipher_desc_req, CCI_CIPHER_REQ); | |
536 #endif | |
537 /* | |
538 * Header size (offset of information) is reqired, if ciphering is used | |
539 * or if the frame shall be send in unprotected mode. | |
540 */ | |
541 cci_cipher_desc_req->header_size = UI_CTRL_MIN_OCTETS; | |
542 | |
543 /* | |
544 * Associate reservation_no with the frame. | |
545 */ | |
546 cci_cipher_desc_req->reference1 = reservation_no; | |
547 | |
548 tx_send_cipher_req (cci_cipher_desc_req, UI_FRAME, protected_mode, nu, | |
549 cipher, oc); | |
550 | |
551 if (buffer_available) | |
552 { | |
553 /* | |
554 * Buffer is still available for current SAPI. | |
555 */ | |
556 sig_tx_uitx_ready_ind(); | |
557 } | |
558 | |
559 } | |
560 break; | |
561 | |
562 default: | |
563 #ifdef LL_DESC | |
564 llc_cl_desc3_free((T_desc3*)ll_unitdesc_req->desc_list3.first); | |
565 #endif /* LL_DESC */ | |
566 PFREE (ll_unitdesc_req); | |
567 | |
568 TRACE_ERROR( "SIG_UITX_TX_UNITDATA_REQ unexpected" ); | |
569 break; | |
570 } | |
571 } /* sig_uitx_tx_unitdata_req() */ | |
572 | |
573 | |
574 /* | |
575 +------------------------------------------------------------------------------ | |
576 | Function : sig_itx_tx_data_req | |
577 +------------------------------------------------------------------------------ | |
578 | Description : Handles the internal signal SIG_ITX_TX_DATA_REQ | |
579 | | |
580 | Parameters : ll_data_req - a valid pointer to a GRLC-DATA-REQ primitive | |
581 | cause - | |
582 | | |
583 +------------------------------------------------------------------------------ | |
584 */ | |
585 GLOBAL void sig_itx_tx_data_req | |
586 ( | |
587 #ifdef LL_DESC | |
588 T_LL_UNITDESC_REQ *ll_unitdesc_req, | |
589 #else | |
590 T_LL_UNITDATA_REQ *ll_unitdesc_req, | |
591 #endif | |
592 T_PDU_TYPE frame_type, | |
593 T_FRAME_NUM ns, | |
594 UBYTE cause, | |
595 USHORT header_size, | |
596 ULONG oc | |
597 ) | |
598 { | |
599 ULONG reservation_no; | |
600 BOOL buffer_available; | |
601 UBYTE protected_mode; | |
602 | |
603 TRACE_ISIG( "sig_itx_tx_data_req" ); | |
604 | |
605 switch( GET_STATE( TX ) ) | |
606 { | |
607 case TX_TLLI_ASSIGNED_NOT_READY: | |
608 /* No break. */ | |
609 case TX_TLLI_ASSIGNED_READY: | |
610 | |
611 tx_reserve_buffer (ll_unitdesc_req, PRIM_DATA, cause, SERVICE_ITX, | |
612 &reservation_no, &buffer_available); | |
613 | |
614 /* | |
615 * I/S + S frames always send in protected mode | |
616 */ | |
617 protected_mode = CCI_PM_PROTECTED; | |
618 | |
619 { | |
620 #ifdef LL_DESC | |
621 T_CCI_CIPHER_DESC_REQ *cci_cipher_desc_req; | |
622 MALLOC(cci_cipher_desc_req, sizeof(T_CCI_CIPHER_DESC_REQ)); | |
623 cci_cipher_desc_req->desc_list3.first = ll_unitdesc_req->desc_list3.first; | |
624 cci_cipher_desc_req->desc_list3.list_len = ll_unitdesc_req->desc_list3.list_len; | |
625 cci_cipher_desc_req->attached_counter = ll_unitdesc_req->attached_counter; | |
626 /* | |
627 * free the primitive memory | |
628 */ | |
629 PFREE(ll_unitdesc_req); | |
630 #else | |
631 PPASS (ll_unitdesc_req, cci_cipher_desc_req, CCI_CIPHER_REQ); | |
632 #endif | |
633 /* | |
634 * Header size (offset of information) is reqired, if ciphering is used | |
635 * or if the frame shall be send in unprotected mode. | |
636 */ | |
637 cci_cipher_desc_req->header_size = header_size; | |
638 | |
639 /* | |
640 * Associate reservation_no with the frame. | |
641 */ | |
642 cci_cipher_desc_req->reference1 = reservation_no; | |
643 | |
644 if (frame_type == S_FRAME) | |
645 { | |
646 /* | |
647 * Do not try to cipher an S frame (there is no information ;-) | |
648 */ | |
649 tx_send_cipher_req (cci_cipher_desc_req, frame_type, protected_mode, ns, | |
650 LL_CIPHER_OFF, oc); | |
651 } | |
652 else | |
653 { | |
654 /* | |
655 * I frames shall always send ciphered | |
656 */ | |
657 tx_send_cipher_req (cci_cipher_desc_req, frame_type, protected_mode, ns, | |
658 LL_CIPHER_ON, oc); | |
659 } | |
660 | |
661 if (buffer_available) | |
662 { | |
663 /* | |
664 * Buffer is still available for current SAPI. | |
665 */ | |
666 sig_tx_itx_ready_ind(); | |
667 } | |
668 | |
669 } | |
670 break; | |
671 | |
672 default: | |
673 if (ll_unitdesc_req->attached_counter == CCI_NO_ATTACHE) | |
674 { | |
675 #ifdef LL_DESC | |
676 llc_cl_desc3_free((T_desc3*)ll_unitdesc_req->desc_list3.first); | |
677 #endif /* LL_DESC */ | |
678 PFREE (ll_unitdesc_req); | |
679 } | |
680 TRACE_ERROR( "SIG_ITX_TX_DATA_REQ unexpected" ); | |
681 break; | |
682 } | |
683 } /* sig_itx_tx_data_req() */ | |
684 | |
685 | |
686 /* | |
687 +------------------------------------------------------------------------------ | |
688 | Function : sig_llme_tx_trigger_req | |
689 +------------------------------------------------------------------------------ | |
690 | Description : Handles the internal signal SIG_LLME_TX_TRIGGER_REQ | |
691 | | |
692 | Parameters : cause - trigger cause | |
693 | | |
694 +------------------------------------------------------------------------------ | |
695 */ | |
696 GLOBAL void sig_llme_tx_trigger_req (UBYTE cause) | |
697 { | |
698 T_TX_QUEUE *elem; | |
699 | |
700 | |
701 TRACE_ISIG( "sig_llme_tx_trigger_req" ); | |
702 | |
703 TRACE_1_PARA("cause:%d", cause); | |
704 | |
705 switch( GET_STATE( TX ) ) | |
706 { | |
707 case TX_TLLI_ASSIGNED_NOT_READY: | |
708 /* no break! */ | |
709 case TX_TLLI_ASSIGNED_READY: | |
710 tx_get_first_data_frame (&elem); | |
711 | |
712 if (elem EQ NULL) | |
713 { | |
714 #ifdef REL99 | |
715 if (cause EQ LLGMM_TRICS_CELL_UPDATE_NULL_FRAME) | |
716 { | |
717 cause = GRLC_DTACS_CELL_NOTIFI_NULL_FRAME; | |
718 sig_tx_u_send_null(cause); | |
719 } | |
720 else | |
721 #endif /* REL99 */ | |
722 if (cause EQ LLGMM_TRICS_CELL_UPDATE) | |
723 { | |
724 cause = GRLC_DTACS_EMPTY_FRAME; | |
725 sig_tx_uitx_trigger_ind (cause); | |
726 } | |
727 else | |
728 { | |
729 sig_tx_uitx_trigger_ind (cause); | |
730 } | |
731 } | |
732 else /* elem is valid */ | |
733 { | |
734 /* | |
735 * NOTE: Possible cause values are DEFAULT, MOBILITY_MANAGEMENT, | |
736 * PAGE_RESPONSE, CELL_UPDATE and CELL NOTIFICATION. | |
737 * Overwriting DEFAULT, MOBILITY_MANAGEMENT, and the same cause | |
738 * (which is already set) is ok. This leaves two relevant (and | |
739 * mutually exclusive) trigger causes to be considered. A problem may | |
740 * occur if the primitive contained the one remaining trigger cause | |
741 * and the other is requested. But according to ANS this should not | |
742 * happen. | |
743 */ | |
744 | |
745 if ((cause EQ LLGMM_TRICS_CELL_UPDATE) | |
746 #ifdef REL99 | |
747 OR | |
748 (cause EQ LLGMM_TRICS_CELL_UPDATE_NULL_FRAME) | |
749 #endif /*REL99*/ | |
750 ) | |
751 { | |
752 cause = GRLC_DTACS_DEF; | |
753 } | |
754 | |
755 if (elem->primitive EQ NULL) | |
756 { | |
757 /* | |
758 * Primitive is not yet ready-to-send. Modify cause in primitve | |
759 * header variable. | |
760 */ | |
761 elem->ph_cause = cause; | |
762 } | |
763 else /* elem->primitive is valid */ | |
764 { | |
765 /* | |
766 * Primitive is ready-to-send. Modifiy cause in primitive. | |
767 */ | |
768 ((T_GRLC_DATA_REQ *)(elem->primitive))->cause = cause; | |
769 } | |
770 } | |
771 break; | |
772 | |
773 default: | |
774 TRACE_ERROR( "SIG_LLME_TX_TRIGGER_REQ unexpected" ); | |
775 break; | |
776 } | |
777 } /* sig_llme_tx_trigger_req() */ | |
778 | |
779 | |
780 /* | |
781 +------------------------------------------------------------------------------ | |
782 | Function : sig_llme_tx_suspend_req | |
783 +------------------------------------------------------------------------------ | |
784 | Description : Handles the internal signal SIG_LLME_TX_SUSPEND_REQ | |
785 | | |
786 | Parameters : | |
787 | | |
788 +------------------------------------------------------------------------------ | |
789 */ | |
790 GLOBAL void sig_llme_tx_suspend_req (void) | |
791 { | |
792 TRACE_ISIG( "sig_llme_tx_suspend_req" ); | |
793 | |
794 switch( GET_STATE( TX ) ) | |
795 { | |
796 case TX_TLLI_UNASSIGNED_NOT_READY: | |
797 case TX_TLLI_ASSIGNED_NOT_READY: | |
798 /* | |
799 * Nothing to do | |
800 */ | |
801 break; | |
802 | |
803 case TX_TLLI_ASSIGNED_READY: | |
804 /* | |
805 * Flow Control has to be re-started by GRLC | |
806 */ | |
807 SET_STATE (TX, TX_TLLI_ASSIGNED_NOT_READY); | |
808 break; | |
809 | |
810 case TX_TLLI_UNASSIGNED_READY: | |
811 /* | |
812 * Flow Control has to be re-started by GRLC | |
813 */ | |
814 SET_STATE (TX, TX_TLLI_UNASSIGNED_NOT_READY); | |
815 break; | |
816 | |
817 default: | |
818 TRACE_ERROR( "SIG_LLME_TX_SUSPEND_REQ unexpected" ); | |
819 break; | |
820 } | |
821 } /* sig_llme_tx_suspend_req() */ | |
822 | |
823 /* | |
824 +------------------------------------------------------------------------------ | |
825 | Function : sig_llme_tx_resume_req | |
826 +------------------------------------------------------------------------------ | |
827 | Description : Handles the internal signal SIG_LLME_TX_RESUME_REQ | |
828 | | |
829 | Parameters : | |
830 | | |
831 +------------------------------------------------------------------------------ | |
832 */ | |
833 GLOBAL void sig_llme_tx_resume_req (BOOL grlc_was_suspened) | |
834 { | |
835 T_GRLC_DATA_REQ *grlc_data_req; | |
836 T_GRLC_UNITDATA_REQ *grlc_unitdata_req; | |
837 T_PRIM_TYPE prim_type; | |
838 T_SERVICE rx_service; | |
839 UBYTE sapi; | |
840 | |
841 TRACE_ISIG( "sig_llme_tx_resume_req" ); | |
842 | |
843 switch( GET_STATE( TX ) ) | |
844 { | |
845 case TX_TLLI_UNASSIGNED_NOT_READY: | |
846 case TX_TLLI_ASSIGNED_NOT_READY: | |
847 /* | |
848 * Nothing to do | |
849 */ | |
850 break; | |
851 | |
852 case TX_TLLI_ASSIGNED_READY: | |
853 if (grlc_was_suspened == FALSE) | |
854 { | |
855 /* | |
856 * LLME indicates that any data may now be sent again. | |
857 */ | |
858 do { | |
859 tx_get_next_frame (&grlc_data_req, &grlc_unitdata_req, &prim_type, | |
860 &rx_service, &sapi); | |
861 | |
862 switch (prim_type) | |
863 { | |
864 case PRIM_DATA: | |
865 /* | |
866 * Label S_DATA | |
867 */ | |
868 tx_label_s_data (rx_service, grlc_data_req); | |
869 break; | |
870 case PRIM_UNITDATA: | |
871 /* | |
872 * Label S_UNITDATA | |
873 */ | |
874 tx_label_s_unitdata (rx_service, grlc_unitdata_req); | |
875 break; | |
876 case PRIM_REMOVED: | |
877 /* | |
878 * Label S_REMOVED | |
879 */ | |
880 tx_label_s_removed (rx_service, sapi); | |
881 break; | |
882 default: /* NO_PRIM */ | |
883 break; | |
884 } | |
885 } while (prim_type == PRIM_REMOVED); | |
886 } | |
887 else | |
888 { | |
889 /* | |
890 * Flow Control has to be re-started by GRLC | |
891 */ | |
892 SET_STATE (TX, TX_TLLI_ASSIGNED_NOT_READY); | |
893 } | |
894 break; | |
895 | |
896 case TX_TLLI_UNASSIGNED_READY: | |
897 /* | |
898 * Flow Control has to be re-started by GRLC | |
899 */ | |
900 SET_STATE (TX, TX_TLLI_UNASSIGNED_NOT_READY); | |
901 break; | |
902 | |
903 default: | |
904 TRACE_ERROR( "SIG_LLME_TX_RESUME_REQ unexpected" ); | |
905 break; | |
906 } | |
907 } /* sig_llme_tx_resume_req() */ | |
908 | |
909 | |
910 | |
911 /* | |
912 +------------------------------------------------------------------------------ | |
913 | Function : sig_llme_tx_flush_req | |
914 +------------------------------------------------------------------------------ | |
915 | Description : Handles the internal signal SIG_LLME_TX_FLUSH_REQ | |
916 | | |
917 | Parameters : | |
918 | | |
919 +------------------------------------------------------------------------------ | |
920 */ | |
921 GLOBAL void sig_llme_tx_flush_req (T_SERVICE service) | |
922 { | |
923 TRACE_ISIG( "sig_llme_tx_flush_req" ); | |
924 | |
925 switch( GET_STATE( TX ) ) | |
926 { | |
927 case TX_TLLI_ASSIGNED_READY: | |
928 case TX_TLLI_ASSIGNED_NOT_READY: | |
929 tx_remove_data_frames (service, llc_data->current_sapi); | |
930 break; | |
931 | |
932 default: | |
933 TRACE_ERROR( "SIG_LLME_TX_FLUSH_REQ unexpected" ); | |
934 break; | |
935 } | |
936 } /* sig_llme_tx_flush_req() */ | |
937 |