comparison src/g23m-gprs/llc/llc.h @ 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 :
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 : Definitions for the Protocol Stack Entity
18 | Logical Link Control (LLC)
19 +-----------------------------------------------------------------------------
20 */
21
22 #ifndef LLC_H
23 #define LLC_H
24
25 /*#ifdef FF_EGPRS
26 #ifndef LLC_EDGE
27 #define LLC_EDGE
28 #endif *//*LLC_EDGE*/
29 /*#endif */ /*FF_EGPRS*/
30
31
32 /*
33 * Shift of constants from SAPs LL and LLGMM to PS_include are handled here.
34 */
35 #ifdef LL_2to1
36
37
38 #ifndef DTACS_MOBILITY_MANAGEMENT
39 #define DTACS_MOBILITY_MANAGEMENT GRLC_MOBILITY_MANAGEMENT
40 #endif
41 #ifndef GRR_DTACS_DEFGRR_DTACS_DEF
42 #define GRR_DTACS_DEF GRLC_DTACS_DEF
43 #endif
44 #ifndef GRR_DTACS_MOBILITY_MANAGEMENT
45 #define GRR_DTACS_MOBILITY_MANAGEMENT GRLC_DTACS_MOBILITY_MANAGEMENT
46 #endif
47
48
49 #ifndef LLC_MAX_CNF
50 #define LLC_MAX_CNF LL_MAX_CNF
51 #endif
52 #ifndef LLC_MAX_L3_XID_LEN
53 #define LLC_MAX_L3_XID_LEN LL_MAX_L3_XID_LEN
54 #endif
55
56
57
58 #ifndef LLGMM_ERRCS_ACK_NO_PEER_RES_REEST
59 #define LLGMM_ERRCS_ACK_NO_PEER_RES_REEST CAUSE_LLC_ACK_NO_PEER_RES_REEST
60 #endif
61 #ifndef LLGMM_ERRCS_DISC_NO_PEER_RES
62 #define LLGMM_ERRCS_DISC_NO_PEER_RES CAUSE_LLC_DISC_NO_PEER_RES
63 #endif
64 #ifndef LLGMM_ERRCS_DM1_RECEIVED
65 #define LLGMM_ERRCS_DM1_RECEIVED CAUSE_LLC_DM1_RECEIVED
66 #endif
67 #ifndef LLGMM_ERRCS_DM1_RECEIVED_REEST
68 #define LLGMM_ERRCS_DM1_RECEIVED_REEST CAUSE_LLC_DM1_RECEIVED_REEST
69 #endif
70 #ifndef LLGMM_ERRCS_FRMR_COND
71 #define LLGMM_ERRCS_FRMR_COND CAUSE_LLC_FRMR_COND
72 #endif
73 #ifndef LLGMM_ERRCS_FRMR_COND_REEST
74 #define LLGMM_ERRCS_FRMR_COND_REEST CAUSE_LLC_FRMR_COND_REEST
75 #endif
76 #ifndef LLGMM_ERRCS_FRMR_RECEIVED
77 #define LLGMM_ERRCS_FRMR_RECEIVED CAUSE_LLC_FRMR_RECEIVED
78 #endif
79 #ifndef LLGMM_ERRCS_L3_REEST
80 #define LLGMM_ERRCS_L3_REEST CAUSE_LLC_L3_REEST
81 #endif
82 #ifndef LLGMM_ERRCS_MULT_ASS_TLLI
83 #define LLGMM_ERRCS_MULT_ASS_TLLI CAUSE_LLC_MULT_ASS_TLLI
84 #endif
85 #ifndef LLGMM_ERRCS_NO_PEER_RES
86 #define LLGMM_ERRCS_NO_PEER_RES CAUSE_LLC_NO_PEER_RES
87 #endif
88 #ifndef LLGMM_ERRCS_PEER_BUSY_REEST
89 #define LLGMM_ERRCS_PEER_BUSY_REEST CAUSE_LLC_PEER_BUSY_REEST
90 #endif
91 #ifndef LLGMM_ERRCS_PEER_REEST
92 #define LLGMM_ERRCS_PEER_REEST CAUSE_LLC_PEER_REEST
93 #endif
94 #ifndef LLGMM_ERRCS_SABM_NO_PEER_RES
95 #define LLGMM_ERRCS_SABM_NO_PEER_RES CAUSE_LLC_SABM_NO_PEER_RES
96 #endif
97 #ifndef LLGMM_ERRCS_XID_NO_PEER_RE
98 #define LLGMM_ERRCS_XID_NO_PEER_RES CAUSE_LLC_XID_NO_PEER_RES
99 #endif
100 #ifndef LLGMM_ERRCS_DM0_RECEIVED_REEST
101 #define LLGMM_ERRCS_DM0_RECEIVED_REEST CAUSE_LLC_DM0_RECEIVED_REEST
102 #endif
103
104
105 #ifndef LL_ERRCS_NO_PEER_RES
106 #define LL_ERRCS_NO_PEER_RES CAUSE_LLC_NO_PEER_RES
107 #endif
108 #ifndef LL_ERRCS_INVALID_XID
109 #define LL_ERRCS_INVALID_XID CAUSE_LLC_INVALID_XID
110 #endif
111
112 #ifndef LL_PEAK_SUB
113 #define LL_PEAK_SUB PS_PEAK_SUB
114 #endif
115 #ifndef LL_RELCS_DM_RECEIVED
116 #define LL_RELCS_DM_RECEIVED CAUSE_LLC_DM_RECEIVED
117 #endif
118 #ifndef LL_RELCS_INVALID_XID
119 #define LL_RELCS_INVALID_XID CAUSE_LLC_INVALID_XID
120 #endif
121 #ifndef LL_RELCS_NORMAL
122 #define LL_RELCS_NORMAL CAUSE_LLC_NORMAL_REL
123 #endif
124 #ifndef LL_RELCS_NO_PEER_RES
125 #define LL_RELCS_NO_PEER_RES CAUSE_LLC_NO_PEER_RES
126 #endif
127
128 #ifndef LL_DELAY_SUB
129 #define LL_DELAY_SUB PS_DELAY_SUB
130 #endif
131 #ifndef LL_MEAN_SUB
132 #define LL_MEAN_SUB PS_MEAN_SUB
133 #endif
134 #ifndef LL_NO_REL
135 #define LL_NO_REL PS_NO_REL
136 #endif
137 #ifndef LL_PRECED_SUB
138 #define LL_PRECED_SUB PS_PRECED_SUB
139 #endif
140 #ifndef LL_RLC_PROT
141 #define LL_RLC_PROT PS_RLC_PROT
142 #endif
143
144 #ifndef LL_SAPI_1
145 #define LL_SAPI_1 PS_SAPI_1
146 #endif
147 #ifndef LL_SAPI_3
148 #define LL_SAPI_3 PS_SAPI_3
149 #endif
150 #ifndef LL_SAPI_5
151 #define LL_SAPI_5 PS_SAPI_5
152 #endif
153 #ifndef LL_SAPI_7
154 #define LL_SAPI_7 PS_SAPI_7
155 #endif
156 #ifndef LL_SAPI_9
157 #define LL_SAPI_9 PS_SAPI_9
158 #endif
159 #ifndef LL_SAPI_11
160 #define LL_SAPI_11 PS_SAPI_11
161 #endif
162 #ifndef LL_RADIO_PRIO_1
163 #define LL_RADIO_PRIO_1 PS_RADIO_PRIO_1
164 #endif
165 #ifndef LL_TLLI_INVALID
166 #define LL_TLLI_INVALID PS_TLLI_INVALID
167 #endif
168
169 #ifndef GRLC_RADIO_PRIO_1
170 #define GRLC_RADIO_PRIO_1 PS_RADIO_PRIO_1
171 #endif
172 #ifndef GRLC_PEAK_SUB
173 #define GRLC_PEAK_SUB PS_PEAK_SUB
174 #endif
175
176 #ifndef T_desc_list3
177 #define T_desc_list3 T_LL_desc_list3
178 #endif
179
180 #endif /* LL_2to1 */
181
182
183
184 /* --------------------------------------------------------------------------------- */
185
186 /* remove traces */
187 #ifndef _SIMULATION_
188 #ifdef GET_STATE
189 #undef GET_STATE
190 #define GET_STATE(P) (ENTITY_DATA->P state)
191 #endif
192 #endif /* _SIMULATION_ */
193 /* --------------------------------------------------------------------------------- */
194 #ifdef TRACE_EVE
195 #define TRACE_0_INFO(s) TRACE_EVENT ("Info: " s)
196 #define TRACE_1_INFO(s,p1) TRACE_EVENT_P1("Info: " s,p1)
197 #define TRACE_2_INFO(s,p1,p2) TRACE_EVENT_P2("Info: " s,p1,p2)
198 #define TRACE_3_INFO(s,p1,p2,p3) TRACE_EVENT_P3("Info: " s,p1,p2,p3)
199 #define TRACE_4_INFO(s,p1,p2,p3,p4) TRACE_EVENT_P4("Info: " s,p1,p2,p3,p4)
200 #else
201 #define TRACE_0_INFO(s)
202 #define TRACE_1_INFO(s,p1)
203 #define TRACE_2_INFO(s,p1,p2)
204 #define TRACE_3_INFO(s,p1,p2,p3)
205 #define TRACE_4_INFO(s,p1,p2,p3,p4)
206 #endif
207
208 #ifdef TRACE_PRIM
209 #define TRACE_0_PARA(s) vsi_o_ttrace(VSI_CALLER TC_PRIM, "IPar: " s)
210 #define TRACE_1_PARA(s,p1) vsi_o_ttrace(VSI_CALLER TC_PRIM, "IPar: " s,p1)
211 #define TRACE_2_PARA(s,p1,p2) vsi_o_ttrace(VSI_CALLER TC_PRIM, "IPar: " s,p1,p2)
212 #define TRACE_3_PARA(s,p1,p2,p3) vsi_o_ttrace(VSI_CALLER TC_PRIM, "IPar: " s,p1,p2,p3)
213 #define TRACE_4_PARA(s,p1,p2,p3,p4) vsi_o_ttrace(VSI_CALLER TC_PRIM, "IPar: " s,p1,p2,p3,p4)
214
215 #define TRACE_0_OUT_PARA(s) vsi_o_ttrace(VSI_CALLER TC_PRIM, "OPar: " s)
216 #define TRACE_1_OUT_PARA(s,p1) vsi_o_ttrace(VSI_CALLER TC_PRIM, "OPar: " s,p1)
217 #define TRACE_2_OUT_PARA(s,p1,p2) vsi_o_ttrace(VSI_CALLER TC_PRIM, "OPar: " s,p1,p2)
218 #define TRACE_3_OUT_PARA(s,p1,p2,p3) vsi_o_ttrace(VSI_CALLER TC_PRIM, "OPar: " s,p1,p2,p3)
219 #define TRACE_4_OUT_PARA(s,p1,p2,p3,p4) vsi_o_ttrace(VSI_CALLER TC_PRIM, "OPar: " s,p1,p2,p3,p4)
220
221 #define TRACE_PRIM_FROM(s) vsi_o_ttrace(VSI_CALLER TC_PRIM, "Pdir: " s)
222 #define TRACE_PRIM_TO(s) vsi_o_ttrace(VSI_CALLER TC_PRIM, "Pdir: " s)
223 #else
224 #define TRACE_0_PARA(s)
225 #define TRACE_1_PARA(s,p1)
226 #define TRACE_2_PARA(s,p1,p2)
227 #define TRACE_3_PARA(s,p1,p2,p3)
228 #define TRACE_4_PARA(s,p1,p2,p3,p4)
229
230 #define TRACE_0_OUT_PARA(s)
231 #define TRACE_1_OUT_PARA(s,p1)
232 #define TRACE_2_OUT_PARA(s,p1,p2)
233 #define TRACE_3_OUT_PARA(s,p1,p2,p3)
234 #define TRACE_4_OUT_PARA(s,p1,p2,p3,p4)
235
236 #define TRACE_PRIM_FROM(s)
237 #define TRACE_PRIM_TO(s)
238 #endif
239 /* --------------------------------------------------------------------------------- */
240
241 /*
242 * The following macro is similar to PFREE_DESC2. Instead of doing
243 * a PFREE(P) it does a MFREE(p). This macro is used to free CCI primitives
244 * which are removed from CCI SAP and added into this header file.
245 */
246 #define MFREE_PRIM_DESC2(p) { MFREE_DESC2 ((p)->desc_list2.first); \
247 MFREE ((p)); \
248 }
249
250 /*
251 * The following macro is similar to PFREE_DESC. Instead of doing
252 * a PFREE(P) it does a MFREE(p). This macro is used to free CCI primitives
253 * which are removed from CCI SAP and added into this header file.
254 */
255 #define MFREE_PRIM_DESC(p) { MFREE_DESC ((p)->desc_list.first); \
256 MFREE ((p)); \
257 }
258
259 /*
260 * defines the user of the vsi interface
261 */
262 #define VSI_CALLER LLC_handle,
263 #define VSI_CALLER_SINGLE LLC_handle
264
265 /*
266 * Macros
267 */
268
269 /*
270 * Switch all LLC services with multiple incarnations to use the incarnation
271 * for the given SAPI. Current sapi is stored and all LLC layer parameters
272 * with multiple incarnations are switched to use the incarnation for the
273 * given SAPI.
274 */
275 #define SWITCH_LLC(s) llc_data->current_sapi = s; \
276 SWITCH_PARAM (iov_i, IMAP(s)); \
277 SWITCH_PARAM (n200, UIMAP(s)); \
278 SWITCH_PARAM (n201_u, UIMAP(s)); \
279 SWITCH_PARAM (n201_i, IMAP(s)); \
280 SWITCH_PARAM (md, IMAP(s)); \
281 SWITCH_PARAM (mu, IMAP(s)); \
282 SWITCH_PARAM (kd, IMAP(s)); \
283 SWITCH_PARAM (ku, IMAP(s)); \
284 SWITCH_PARAM (requested_l3_xid, IMAP(s)); \
285 SWITCH_SERVICE (llc, sapi, UIMAP(s)); \
286 SWITCH_SERVICE (llc, u, UIMAP(s)); \
287 SWITCH_SERVICE (llc, itx, IMAP(s)); \
288 SWITCH_SERVICE (llc, irx, IMAP(s)); \
289 SWITCH_SERVICE (llc, uitx, UIMAP(s)); \
290 SWITCH_SERVICE (llc, uirx, UIMAP(s)); \
291 SWITCH_SERVICE (llc, t200, UIMAP(s));
292
293 /*
294 * Switch service s of entity e to use incarnation i.
295 */
296 #define SWITCH_SERVICE(e,s,i) e##_data->##s = &(##e##_data->##s##_base[i]);
297
298 /*
299 * Switch LLC layer parameter p to incarnation i.
300 */
301 #define SWITCH_PARAM(p,i) llc_data->##p = &(llc_data->##p##_base[i]);
302
303
304 /*
305 * Map SAPI to incarnation, for either acknowledged (4 incarnations) or
306 * unacknowledged operation (6 incarnations)
307 */
308 #ifdef LL_2to1
309 #define IMAP(s) (s == PS_SAPI_3 ? 0 : \
310 s == PS_SAPI_5 ? 1 : \
311 s == PS_SAPI_9 ? 2 : \
312 s == PS_SAPI_11? 3 : 0)
313
314 #define UIMAP(s) (s == PS_SAPI_1 ? 0 : \
315 s == PS_SAPI_3 ? 1 : \
316 s == PS_SAPI_5 ? 2 : \
317 s == PS_SAPI_7 ? 3 : \
318 s == PS_SAPI_9 ? 4 : \
319 s == PS_SAPI_11? 5 : 0)
320 #else
321 #define IMAP(s) (s == LL_SAPI_3 ? 0 : \
322 s == LL_SAPI_5 ? 1 : \
323 s == LL_SAPI_9 ? 2 : \
324 s == LL_SAPI_11? 3 : 0)
325
326 #define UIMAP(s) (s == LL_SAPI_1 ? 0 : \
327 s == LL_SAPI_3 ? 1 : \
328 s == LL_SAPI_5 ? 2 : \
329 s == LL_SAPI_7 ? 3 : \
330 s == LL_SAPI_9 ? 4 : \
331 s == LL_SAPI_11? 5 : 0)
332 #endif
333
334
335 /*
336 * Add octet size of XID parameter P to variable V if the parameter is tagged.
337 */
338 #define ADD_IF_TAGGED(V,P) \
339 if (llc_data->u->xid_tag & (0x00000001L << P)) \
340 { \
341 V += P##_LEN + P##_HDR_LEN; \
342 }
343
344 /*
345 * Tag XID parameter if requested to negotiate
346 */
347 #define TAG_IF_REQUESTED(V,P) \
348 if (llc_data->##V##valid) \
349 { \
350 llc_data->u->xid_tag |= (0x00000001L << P); \
351 }
352
353 /*
354 * Tag XID parameter if requested to negotiate and sense of negotiation fits
355 */
356 #define TAG_IF_REQUESTED_RSP(S,V,P) \
357 if (llc_data->u->requested_xid.##V##.valid) \
358 { \
359 if (llc_data->decoded_xid.##V##.valid) \
360 { \
361 /* simple add parameter. Sense of negotiation is already checked */ \
362 llc_data->u->xid_tag |= (0x00000001L << P); \
363 } \
364 else \
365 { \
366 /* Sense of negotiation compared with current values */ \
367 if (llc_data->u->requested_xid.##V##.value S *(llc_data->##V)) \
368 { \
369 llc_data->u->xid_tag |= (0x00000001L << P); \
370 } \
371 } \
372 }
373
374
375 /*
376 * Timer values are negotiated in units of 0.1 seconds but internally stored
377 * in milliseconds. Therefore a conversion must be done with each XID
378 * negotiation of timer values.
379 */
380 #define XID_TIMER_CONVERSION 100
381
382 #define XID2INT(l) (l * XID_TIMER_CONVERSION)
383 #define INT2XID(l) (l / XID_TIMER_CONVERSION)
384
385 /*
386 * Timer start- and stop macros for LLC
387 */
388 #define TIMERSTART(t,d) itx_##t##_start((d))
389 #define TIMERSTOP(t) itx_##t##_stop()
390
391
392 /*
393 * Number of service incarnations (LLME, TX, and RX have only one incarnation)
394 */
395 #define ACKNOWLEDGED_INC 4
396 #define UNACKNOWLEDGED_INC 6
397 #define MAX_SAPI_INC 6
398
399
400 #define U_NUM_INC UNACKNOWLEDGED_INC
401
402 #define ITX_NUM_INC ACKNOWLEDGED_INC
403 #define IRX_NUM_INC ACKNOWLEDGED_INC
404
405 #define UITX_NUM_INC UNACKNOWLEDGED_INC
406 #define UIRX_NUM_INC UNACKNOWLEDGED_INC
407
408 #define T200_NUM_INC UNACKNOWLEDGED_INC
409 #define T201_NUM_INC ACKNOWLEDGED_INC
410
411
412 /*
413 * Constants
414 */
415
416 /*
417 * Value constants for attached_counter
418 */
419 #define CCI_NO_ATTACHE (0x0) /* no entity/service is attached to the primitive */
420 /*
421 * Value constants for fcs_check
422 */
423 #define CCI_FCS_PASSED (0x0) /* FCS check has been successfully passed */
424 #define CCI_FCS_FAILED (0x1) /* FCS check has been failed */
425 /*
426 * Value constants for pm
427 */
428 #define CCI_PM_UNPROTECTED (0x0) /* FCS covers frame header and information fields */
429 #define CCI_PM_PROTECTED (0x1) /* FCS covers frame header field and first N202 octets of information field */
430 /*
431 * Value constants for ciphering_algorithm
432 */
433 #define CCI_CIPHER_NO_ALGORITHM (0x0) /* frame shall not be ciphered */
434 #define CCI_CIPHER_GPRS_A5_1 (0x1) /* frame shall be ciphered using algorithm GPRS A5/1 */
435 #define CCI_CIPHER_GPRS_A5_2 (0x2) /* frame shall be ciphered using algorithm GPRS A5/2 */
436 /*
437 * Value constants for direction
438 */
439 #define CCI_DIRECTION_UPLINK (0x0) /* direction of LLC frame transmission is MS to SGSN */
440 #define CCI_DIRECTION_DOWNLINK (0x1) /* direction of LLC frame transmission is SGSN to MS */
441
442
443
444 /*
445 * Bitoffset for encoding/decoding
446 */
447 #define ENCODE_OFFSET 0
448
449
450 /*
451 * C/R bit
452 */
453 #define SGSN_COMMAND 1
454 #define SGSN_RESPONSE 0
455 #define MS_COMMAND 0
456 #define MS_RESPONSE 1
457
458 /*
459 * Size definitions for common U frames (in octets and in bits).
460 * Define only the header of the frame. FCS_SIZE will be added when the FCS
461 * is calculated!
462 */
463 #define U_HDR_SIZE 2
464 #define U_HDR_SIZE_BITS (U_HDR_SIZE * 8)
465 #define FCS_SIZE 3
466 #define FCS_SIZE_BITS (FCS_SIZE * 8)
467
468 #ifdef REL99
469 #define U_NULL_SIZE (U_HDR_SIZE)
470 #define U_NULL_SIZE_BITS (U_NULL_SIZE * 8)
471 #endif /* REL99 */
472
473 #define U_DISC_SIZE (U_HDR_SIZE)
474 #define U_DISC_SIZE_BITS (U_DISC_SIZE * 8)
475
476 #define U_DM_SIZE (U_HDR_SIZE)
477 #define U_DM_SIZE_BITS (U_DM_SIZE * 8)
478
479 #define U_FRMR_INFO_SIZE 10
480 #define U_FRMR_SIZE (U_HDR_SIZE + U_FRMR_INFO_SIZE)
481 #define U_FRMR_SIZE_BITS (U_FRMR_SIZE * 8)
482
483 /*
484 * Masks and IDs for the different frame formats. Bitwise AND *_MASK with
485 * the first octet of the control field must result in *_ID.
486 */
487 #define I_FRAME_MASK 0x80
488 #define S_FRAME_MASK 0xC0
489 #define UI_FRAME_MASK 0xE0
490 #define U_FRAME_MASK 0xE0
491
492 #define I_FRAME_ID 0x00
493 #define S_FRAME_ID 0x80
494 #define UI_FRAME_ID 0xC0
495 #define U_FRAME_ID 0xE0
496
497 /*
498 * Number of octets that must be contained in a valid control field of a frame.
499 */
500 #define I_CTRL_OCTETS 3
501 #define S_CTRL_OCTETS 2
502 #define UI_CTRL_OCTETS 2
503 #define U_CTRL_OCTETS 1
504
505 /*
506 * Minimum number of octets that must be contained in a frame to access
507 * the complete control field.
508 */
509 #define CTRL_MIN_OCTETS 2
510 #define I_CTRL_MIN_OCTETS 4
511 #define S_CTRL_MIN_OCTETS 3
512 #define UI_CTRL_MIN_OCTETS 3
513 #define U_CTRL_MIN_OCTETS 2
514
515 /*
516 * Minimum number of octets that must be contained in a valid frame, excluding
517 * the FCS field.
518 */
519 #define I_FRAME_MIN_OCTETS_WITHOUT_FCS 5
520 #define S_FRAME_MIN_OCTETS_WITHOUT_FCS 3
521 #define UI_FRAME_MIN_OCTETS_WITHOUT_FCS 3
522 #define U_FRAME_MIN_OCTETS_WITHOUT_FCS 2
523
524 /*
525 * Minimum number of octets that must be contained in a valid frame.
526 */
527 #define FRAME_MIN_OCTETS 5
528 #define I_FRAME_MIN_OCTETS 8
529 #define S_FRAME_MIN_OCTETS 6
530 #define UI_FRAME_MIN_OCTETS 6
531 #define U_FRAME_MIN_OCTETS 5
532
533 #define U_FRAME_FRMR_INFO_OCTETS U_FRMR_INFO_SIZE
534
535 #define S_FRAME_SACK_MIN_CTRL_OCTETS 1
536 #define S_FRAME_SACK_MAX_CTRL_OCTETS 32
537
538 /*
539 * I frame and S frame commands/responses (bits S1, S2).
540 */
541 #define I_FRAME_RR 0x00
542 #define I_FRAME_ACK 0x01
543 #define I_FRAME_RNR 0x02
544 #define I_FRAME_SACK 0x03
545
546 /*
547 * U frame commands/responses (bits M4, M3, M2, M1).
548 */
549 #ifdef REL99
550 #define U_FRAME_NULL 0x00
551 #endif /*REL99*/
552 #define U_FRAME_DM 0x01
553 #define U_FRAME_DISC 0x04
554 #define U_FRAME_UA 0x06
555 #define U_FRAME_SABM 0x07
556 #define U_FRAME_FRMR 0x08
557 #define U_FRAME_XID 0x0B
558
559 /*
560 * Reasons of frame rejection condition. The lower nibble conforms
561 * to W4-W1 in the FRMR response frame.
562 */
563 #define FRMR_W1 0x01
564 #define FRMR_W2 0x02
565 #define FRMR_W3 0x04
566 #define FRMR_W4 0x08
567
568 /*
569 * !!!!!asap <R.LLC.XCEPTION.A.010> "W1 bit: Bit W3 shall be set to 1 in
570 * conjunction with this bit." Is that always the case?
571 */
572 #define FRMR_INCORRECT_LENGTH FRMR_W1
573 #define FRMR_INCORRECT_LENGTH_ABM (FRMR_W1 | FRMR_W4)
574 #define FRMR_EXCEEDS_N201 FRMR_W2
575 #define FRMR_EXCEEDS_N201_ABM (FRMR_W2 | FRMR_W4)
576 #define FRMR_UNDEFINED_CTRL FRMR_W3
577 #define FRMR_UNDEFINED_CTRL_ABM (FRMR_W3 | FRMR_W4)
578
579 #define FRMR_CTRL_LENGTH_UNKNOWN 0x00
580
581
582 /*
583 * Maximum value of LLC sequence numbers and state variables:
584 * N(S), N(R), V(S), V(R), ...
585 */
586 #define MAX_SEQUENCE_NUMBER 511
587
588
589 /*
590 * UITX_*_QUEUE_SIZE defines the maximum number of frames for the various
591 * UITX service incarnations (depeding on SAPI). UITX is the only service
592 * which is limited with uplink flow control. Enough memory must be present
593 * for all other services (U, ITX). U requires a maximum of 2 simultaneously
594 * stored frames per SAPI: the first being a received response to a
595 * previously sent command, and the second being a command which is to be sent
596 * directly afterwards.
597 */
598 #define UITX_1_QUEUE_SIZE 10
599 #define UITX_3_QUEUE_SIZE 1
600 #define UITX_5_QUEUE_SIZE 1
601 #define UITX_7_QUEUE_SIZE 1
602 #define UITX_9_QUEUE_SIZE 1
603 #define UITX_11_QUEUE_SIZE 1
604
605 #define ITX_3_QUEUE_SIZE 1
606 #define ITX_5_QUEUE_SIZE 1
607 #define ITX_9_QUEUE_SIZE 1
608 #define ITX_11_QUEUE_SIZE 1
609
610 /*
611 * Because of the lack of flow control between GRLC and LLC, it is possible,
612 * that LLC recieve frames from GRLC, but can not forward them to the higher
613 * layers. The following constants define the number of UI frames to buffer
614 * per SAPI until we get an LL_GETUNITDATA_REQ
615 */
616 #define UIRX_QUEUE_SIZE 32
617
618 /*
619 * The number of queued I-frames in ITX is limited to the windowsize ku.
620 * If only ku frames are queued and we got an acknowledge for this, LLC
621 * would have no more frames to send. The following variable defines a
622 * number of additional frames to buffer.
623 */
624 #ifdef _SIMULATION_
625 #define ITX_ADD_QUEUE_SIZE 8
626 #else
627 #define ITX_ADD_QUEUE_SIZE 1
628 #endif
629 /*
630 * Maximum supported LLC parameter which should be negotiated initial.
631 * Only values which are different to the default should be defined here.
632 * In future this value should be read from the flash file system.
633 */
634 #define N201_U_SUPPORTED 520
635 #define N201_I_SUPPORTED 520
636 #define KD_KD_SUPPORTED 64
637 #if defined (LL_2to1) || defined (REL99)
638 #define KD_KU_SUPPORTED 16
639 #else
640 #define KD_KU_SUPPORTED 8
641 #endif
642 #define KD_MD_SUPPORTED 0
643 #define KD_MU_SUPPORTED 0
644
645 /*
646 * Service definitions. Used to access service data with GET/SET_STATE.
647 *
648 * Services with multiple incarnation have to be defined as xxx->
649 * Services with only one incarnation have to be defined as xxx.
650 */
651 #define LLME llme.
652 #define SAPI sapi->
653 #define U u->
654 #define ITX itx->
655 #define IRX irx->
656 #define UITX uitx->
657 #define UIRX uirx->
658 #define T200 t200->
659 #define T201 t201->
660 #define TX tx.
661 #define RX rx.
662
663
664 /* #ifndef NTRACE*/
665
666 /*
667 * These defintions are only needed for debugging purposes (!NTRACE).
668 */
669
670 /*
671 * The following definitions are necessary for the state initialisation of
672 * services with the INIT_STATE() macro.
673 */
674 #define U_0 U
675 #define U_1 U
676 #define U_2 U
677 #define U_3 U
678 #define U_4 U
679 #define U_5 U
680
681 #define ITX_0 ITX
682 #define ITX_1 ITX
683 #define ITX_2 ITX
684 #define ITX_3 ITX
685
686 #define IRX_0 IRX
687 #define IRX_1 IRX
688 #define IRX_2 IRX
689 #define IRX_3 IRX
690
691 #define UITX_0 UITX
692 #define UITX_1 UITX
693 #define UITX_2 UITX
694 #define UITX_3 UITX
695 #define UITX_4 UITX
696 #define UITX_5 UITX
697
698 #define UIRX_0 UIRX
699 #define UIRX_1 UIRX
700 #define UIRX_2 UIRX
701 #define UIRX_3 UIRX
702 #define UIRX_4 UIRX
703 #define UIRX_5 UIRX
704
705 #define T200_0 T200
706 #define T200_1 T200
707 #define T200_2 T200
708 #define T200_3 T200
709 #define T200_4 T200
710 #define T200_5 T200
711
712 #define T201_0 T201
713 #define T201_1 T201
714 #define T201_2 T201
715 #define T201_3 T201
716
717 /*
718 * Service name definitions for trace purposes. The service abbrevation
719 * (e.g. LLME) has to be the same as above for the service definitions.
720 */
721 #define SERVICE_NAME_LLME "LLME"
722
723 #define SERVICE_NAME_U_0 "U_1"
724 #define SERVICE_NAME_U_1 "U_3"
725 #define SERVICE_NAME_U_2 "U_5"
726 #define SERVICE_NAME_U_3 "U_7"
727 #define SERVICE_NAME_U_4 "U_9"
728 #define SERVICE_NAME_U_5 "U_11"
729
730 #define SERVICE_NAME_ITX_0 "ITX_3"
731 #define SERVICE_NAME_ITX_1 "ITX_5"
732 #define SERVICE_NAME_ITX_2 "ITX_9"
733 #define SERVICE_NAME_ITX_3 "ITX_11"
734
735 #define SERVICE_NAME_IRX_0 "IRX_3"
736 #define SERVICE_NAME_IRX_1 "IRX_5"
737 #define SERVICE_NAME_IRX_2 "IRX_9"
738 #define SERVICE_NAME_IRX_3 "IRX_11"
739
740 #define SERVICE_NAME_UITX_0 "UITX_1"
741 #define SERVICE_NAME_UITX_1 "UITX_3"
742 #define SERVICE_NAME_UITX_2 "UITX_5"
743 #define SERVICE_NAME_UITX_3 "UITX_7"
744 #define SERVICE_NAME_UITX_4 "UITX_9"
745 #define SERVICE_NAME_UITX_5 "UITX_11"
746
747 #define SERVICE_NAME_UIRX_0 "UIRX_1"
748 #define SERVICE_NAME_UIRX_1 "UIRX_3"
749 #define SERVICE_NAME_UIRX_2 "UIRX_5"
750 #define SERVICE_NAME_UIRX_3 "UIRX_7"
751 #define SERVICE_NAME_UIRX_4 "UIRX_9"
752 #define SERVICE_NAME_UIRX_5 "UIRX_11"
753
754 #define SERVICE_NAME_T200_0 "T200_1"
755 #define SERVICE_NAME_T200_1 "T200_3"
756 #define SERVICE_NAME_T200_2 "T200_5"
757 #define SERVICE_NAME_T200_3 "T200_7"
758 #define SERVICE_NAME_T200_4 "T200_9"
759 #define SERVICE_NAME_T200_5 "T200_11"
760
761 #define SERVICE_NAME_TX "TX"
762 #define SERVICE_NAME_RX "RX"
763
764 /* #endif !NTRACE */
765
766
767 /*
768 * Timer definitions. For each timer a BASE and MAX value is defined.
769 */
770 #define TIMER_T200_BASE (0)
771 #define TIMER_T200_1 (TIMER_T200_BASE)
772 #define TIMER_T200_3 (TIMER_T200_BASE+1)
773 #define TIMER_T200_5 (TIMER_T200_BASE+2)
774 #define TIMER_T200_7 (TIMER_T200_BASE+3)
775 #define TIMER_T200_9 (TIMER_T200_BASE+4)
776 #define TIMER_T200_11 (TIMER_T200_BASE+5)
777 #define TIMER_T200_MAX (TIMER_T200_11)
778
779 #define TIMER_T201_BASE (TIMER_T200_MAX+1)
780 #define TIMER_T201_3 (TIMER_T201_BASE)
781 #define TIMER_T201_5 (TIMER_T201_BASE+1)
782 #define TIMER_T201_9 (TIMER_T201_BASE+2)
783 #define TIMER_T201_11 (TIMER_T201_BASE+3)
784 #define TIMER_T201_MAX (TIMER_T201_11)
785
786 #define TIMER_MAX (TIMER_T201_MAX)
787 #define TIMER_NUM (TIMER_MAX+1)
788
789
790 /*
791 * State definitions for each service.
792 */
793
794 #define LLME_TLLI_UNASSIGNED 1
795 #define LLME_TLLI_ASSIGNED 2
796 #define LLME_TLLI_ASSIGNED_SUSPENDED 3
797
798 #define U_TLLI_UNASSIGNED 1
799 #define U_ADM 2
800 #define U_LOCAL_ESTABLISHMENT 3
801 #define U_REMOTE_ESTABLISHMENT 4
802 #define U_ABM 5
803 #define U_LOCAL_RELEASE 6
804 #define U_ESTABLISH_RES_PENDING 7
805
806 #define ITX_TLLI_UNASSIGNED 1
807 #define ITX_TLLI_ASSIGNED 2
808 #define ITX_ABM 3
809 #define ITX_ABM_PEER_BUSY 4
810
811 #define IRX_TLLI_UNASSIGNED 1
812 #define IRX_TLLI_ASSIGNED 2
813 #define IRX_ABM 3
814 #define IRX_ABM_BUSY 4
815
816 #define UITX_TLLI_UNASSIGNED_NOT_READY 1
817 #define UITX_TLLI_UNASSIGNED_READY 2
818 #define UITX_ADM_NOT_READY 3
819 #define UITX_ADM_READY 4
820
821 #define UIRX_TLLI_UNASSIGNED_NOT_READY 1
822 #define UIRX_TLLI_UNASSIGNED_READY 2
823 #define UIRX_ADM_NOT_READY 3
824 #define UIRX_ADM_READY 4
825
826 #define T200_TLLI_UNASSIGNED 1
827 #define T200_RESET 2
828 #define T200_RUNNING 3
829
830 #define TX_TLLI_UNASSIGNED_NOT_READY 1
831 #define TX_TLLI_UNASSIGNED_READY 2
832 #define TX_TLLI_ASSIGNED_NOT_READY 3
833 #define TX_TLLI_ASSIGNED_READY 4
834
835 #define RX_TLLI_UNASSIGNED 1
836 #define RX_TLLI_ASSIGNED 2
837
838 #ifndef TI_PS_OP_CIPH_DRIVER
839
840 /*
841 * user defined constants
842 */
843
844 #define CIPH_SIZE_CK (0x10)
845 #define CIPH_MAX_ELEM (0x14)
846 #define CIPH_MAX_HEADER_SIZE (0x25)
847 #define CIPH_N202 (0x4)
848
849 /*==== TYPES ======================================================*/
850
851 /*
852 * The following definitions was originally generated by CCD. The definitions are not used as
853 * primitive definitions anymore, only for SNDCP internal usage.
854 */
855 /* --------------------------------------------------------------------------------- */
856 /*
857 * enum to Variable algo
858 * Ciphering algorithm.
859 * CCDGEN:WriteEnum_Count==2834
860 */
861 #ifndef __T_CIPH_algo__
862 #define __T_CIPH_algo__
863 typedef enum
864 {
865 CIPH_EA0 = 0x0, /* No encryption */
866 CIPH_EA1 = 0x1, /* Frame shall be ciphered using algorithm EA1 */
867 CIPH_EA2 = 0x2, /* Frame shall be ciphered using algorithm EA2 */
868 CIPH_EA3 = 0x3 /* Frame shall be ciphered using algorithm EA3 */
869 }T_CIPH_algo;
870 #endif
871 /*
872 * enum to Variable direction
873 * DIRECTION parameter
874 * CCDGEN:WriteEnum_Count==2836
875 */
876 #ifndef __T_CIPH_direction__
877 #define __T_CIPH_direction__
878 typedef enum
879 {
880 CIPH_UPLINK_DIR = 0x0, /* See [3G 33.102] */
881 CIPH_DOWNLINK_DIR = 0x1 /* See [3G 33.102] */
882 }T_CIPH_direction;
883 #endif
884 /*
885 * enum to Variable status
886 * Status of the ciphering process
887 * CCDGEN:WriteEnum_Count==2853
888 */
889 #ifndef __T_CIPH_status__
890 #define __T_CIPH_status__
891 typedef enum
892 {
893 CIPH_CIPH_FAIL = 0x0, /* Ciphering successful */
894 CIPH_CIPH_PASS = 0x1, /* Ciphering failed */
895 CIPH_CIPH_BUSY = 0x2, /* Ongoing ciphering */
896 CIPH_FCS_ERROR = 0x3 /* FCS error */
897 }T_CIPH_status;
898 #endif
899 /*
900 * enum to Variable pm
901 * Protected or unprotected mode
902 * CCDGEN:WriteEnum_Count==2840
903 */
904 #ifndef __T_CIPH_pm__
905 #define __T_CIPH_pm__
906 typedef enum
907 {
908 CIPH_PM_UNPROTECTED = 0x0, /* FCS covers frame header field and first N202 octets of information field */
909 CIPH_PM_PROTECTED = 0x1 /* FCS covers frame header and information fields */
910 }T_CIPH_pm;
911 #endif
912
913 #ifndef __T_CIPH_ck__
914 #define __T_CIPH_ck__
915 /*
916 * Ciphering key.
917 * CCDGEN:WriteStruct_Count==13956
918 */
919 typedef struct
920 {
921 U8 ck_element[CIPH_SIZE_CK]; /*< 0: 16> T_CIPH_ck_element, Ciphering key element */
922 } T_CIPH_ck;
923 #endif
924
925 #ifndef __T_CIPH_init_cipher_req_parms__
926 #define __T_CIPH_init_cipher_req_parms__
927 /*
928 * Ciphering algorithm initialisation parameters.
929 * CCDGEN:WriteStruct_Count==13968
930 */
931 typedef struct
932 {
933 U8 algo; /*< 0: 1> T_CIPH_algo, Ciphering algorithm. */
934 U8 direction; /*< 1: 1> T_CIPH_direction, DIRECTION parameter */
935 U8 zzz_align0; /*< 2: 1> alignment */
936 U8 zzz_align1; /*< 3: 1> alignment */
937 T_CIPH_ck *ptr_ck; /*< 4: 4> pointer to Ciphering key. */
938 } T_CIPH_init_cipher_req_parms;
939 #endif
940
941
942 #ifndef __T_CIPH_gprs_parameters__
943 #define __T_CIPH_gprs_parameters__
944 /*
945 * Structure containing LLC parameters
946 * CCDGEN:WriteStruct_Count==13976
947 */
948 typedef struct
949 {
950 U8 pm; /*< 0: 1> T_CIPH_pm, Protected or unprotected mode */
951 U8 zzz_align0; /*< 1: 1> alignment */
952 U16 header_size; /*< 2: 2> T_CIPH_header_size, Frame header size */
953 U32 ciphering_input; /*< 4: 4> frame-dependent ciphering input */
954 U32 threshold; /*< 8: 4> T_CIPH_threshold, Threshold parameter */
955 } T_CIPH_gprs_parameters;
956 #endif
957
958 #ifndef __T_CIPH_umts_parameters__
959 #define __T_CIPH_umts_parameters__
960 /*
961 * Structure containing umts parameters
962 * CCDGEN:WriteStruct_Count==13980
963 */
964 typedef struct
965 {
966 U8 bearer; /*< 0: 1> T_CIPH_bearer, BEARER parameter */
967 U8 zzz_align0; /*< 1: 1> alignment */
968 U8 zzz_align1; /*< 2: 1> alignment */
969 U8 zzz_align2; /*< 3: 1> alignment */
970 U32 count_c; /*< 4: 4> COUNT-C parameter */
971 U8 dest_bit_offset; /*< 8: 1> T_CIPH_dest_bit_offset, Bit offset */
972 U8 org_bit_offset; /*< 9: 1> T_CIPH_org_bit_offset, Bit offset */
973 U8 zzz_align3; /*< 10: 1> alignment */
974 U8 zzz_align4; /*< 11: 1> alignment */
975 U32 threshold; /*< 12: 4> T_CIPH_threshold, Threshold parameter */
976 } T_CIPH_umts_parameters;
977 #endif
978
979 #ifndef __T_CIPH_in_data__
980 #define __T_CIPH_in_data__
981 /*
982 * Structure containing length and pointer to the data
983 * CCDGEN:WriteStruct_Count==13984
984 */
985 typedef struct
986 {
987 U16 len; /*< 0: 2> Length of buffer */
988 U8 zzz_align0; /*< 2: 1> alignment */
989 U8 zzz_align1; /*< 3: 1> alignment */
990 U32 buf; /*< 4: 4> Pointer to the data in buffer */
991 } T_CIPH_in_data;
992 #endif
993
994 /*
995 * Stucture containing length and pointer to the data
996 * CCDGEN:WriteStruct_Count==13988
997 */
998 #ifndef __T_CIPH_out_data__
999 #define __T_CIPH_out_data__
1000 typedef T_CIPH_in_data T_CIPH_out_data;
1001 #endif
1002 #ifndef __T_CIPH_cipher_req_parms__
1003 #define __T_CIPH_cipher_req_parms__
1004 /*
1005 * Ciphering algorithm parameters.
1006 * CCDGEN:WriteStruct_Count==13990
1007 */
1008 typedef union
1009 {
1010 T_CIPH_gprs_parameters gprs_parameters; /*< 0: 12> Structure containing LLC parameters */
1011 T_CIPH_umts_parameters umts_parameters; /*< 0: 16> Structure containing umts parameters */
1012 } T_CIPH_cipher_req_parms;
1013 #endif
1014
1015 #ifndef __T_CIPH_in_data_list__
1016 #define __T_CIPH_in_data_list__
1017 /*
1018 * Structure containing a list of in_data elements
1019 * CCDGEN:WriteStruct_Count==13994
1020 */
1021 typedef struct
1022 {
1023 T_CIPH_in_data *ptr_in_data; /*< 0: 4> pointer to Structure containing length and pointer to the data */
1024 U16 c_in_data; /*< 4: 2> Number of elements */
1025 U8 zzz_align0; /*< 6: 1> alignment */
1026 U8 zzz_align1; /*< 7: 1> alignment */
1027 } T_CIPH_in_data_list;
1028 #endif
1029
1030 #endif /* TI_PS_OP_CIPH_DRIVER */
1031
1032 /* --------------------------------------------------------------------------------- */
1033
1034 #ifndef __T_kc__
1035 #define __T_kc__
1036 typedef struct
1037 {
1038 U8 key[8]; /*< 0: 8> ciphering key content */
1039 } T_kc;
1040 #endif
1041
1042 #ifndef __T_CCI_CIPHER_REQ__
1043 #define __T_CCI_CIPHER_REQ__
1044 typedef struct
1045 {
1046 U8 pm; /*< 0: 1> protected mode */
1047 U8 ciphering_algorithm; /*< 16: 1> ciphering algorithm */
1048 U8 direction; /*< 17: 1> ciphering transfer direction */
1049 U8 attached_counter; /*< 29: 1> attached to primitive data counter */
1050 U32 ciphering_input; /*< 4: 4> frame-dependent ciphering input */
1051 T_kc kc; /*< 8: 8> ciphering key */
1052 U32 reference1; /*< 32: 4> frame reference number */
1053 U16 header_size; /*< 36: 2> frame header size */
1054 U8 zzz_align0; /*< 38: 1> alignment */
1055 U8 zzz_align1; /*< 39: 1> alignment */
1056 T_sdu sdu; /*< 40: ? > service data unit */
1057 } T_CCI_CIPHER_REQ;
1058 #endif
1059
1060 #ifndef __T_CCI_DECIPHER_REQ__
1061 #define __T_CCI_DECIPHER_REQ__
1062 typedef struct
1063 {
1064 U8 pm; /*< 0: 1> protected mode */
1065 U8 ciphering_algorithm; /*< 1: 1> ciphering algorithm */
1066 U8 direction; /*< 16: 1> ciphering transfer direction */
1067 U8 zzz_align0; /*< 30: 1> alignment */
1068 T_kc kc; /*< 4: 8> ciphering key */
1069 U32 ciphering_input; /*< 12: 4> frame-dependent ciphering input */
1070 U32 reference1; /*< 20: 4> frame reference number */
1071 U32 reference2; /*< 24: 4> second frame reference number */
1072 U16 header_size; /*< 28: 2> frame header size */
1073 U8 zzz_align1; /*< 30: 1> alignment */
1074 U8 zzz_align2; /*< 31: 1> alignment */
1075 T_desc_list desc_list; /*< 32: ? > list of generic data descriptors */
1076 } T_CCI_DECIPHER_REQ;
1077 #endif
1078
1079 #ifndef __T_CCI_RESET_REQ__
1080 #define __T_CCI_RESET_REQ__
1081 typedef struct
1082 {
1083 U8 dummy; /*< 0: 1> no parameters */
1084 } T_CCI_RESET_REQ;
1085 #endif
1086
1087 #ifndef __T_CCI_CIPHER_DESC_REQ__
1088 #define __T_CCI_CIPHER_DESC_REQ__
1089 typedef struct
1090 {
1091 U8 pm; /*< 0: 1> protected mode */
1092 U8 ciphering_algorithm; /*< 16: 1> ciphering algorithm */
1093 U8 direction; /*< 17: 1> ciphering transfer direction */
1094 U8 attached_counter; /*< 29: 1> attached to primitive data counter */
1095 U32 ciphering_input; /*< 4: 4> frame-dependent ciphering input */
1096 T_kc kc; /*< 8: 8> ciphering key */
1097 U32 reference1; /*< 32: 4> frame reference number */
1098 U16 header_size; /*< 36: 2> frame header size */
1099 U8 zzz_align0; /*< 38: 1> alignment */
1100 U8 zzz_align1; /*< 39: 1> alignment */
1101 T_desc_list3 desc_list3; /*< 40: 8> List of generic data descriptors */
1102 } T_CCI_CIPHER_DESC_REQ;
1103 #endif
1104
1105 /* --------------------------------------------------------------------------------- */
1106
1107 /*
1108 * LLC global typedefs
1109 */
1110
1111 typedef UBYTE T_BIT_INT;
1112 typedef T_BIT_INT T_BIT;
1113
1114 /*
1115 * T_FRAME_NUM must be unsigned!
1116 */
1117 typedef USHORT T_FRAME_NUM;
1118
1119 /*
1120 * FRAME_NUM_VALID(a, b, c) equal to ETSI: a <= b <= c
1121 */
1122 #define FRAME_NUM_VALID(a,b,c) ( (((T_FRAME_NUM)((b)-(a)))%(MAX_SEQUENCE_NUMBER+1)) <= \
1123 (((T_FRAME_NUM)((c)-(a)))%(MAX_SEQUENCE_NUMBER+1)) )
1124
1125 /*
1126 * FRAME_WIN_VALID(a, b, k) equal to ETSI: a < b + k
1127 */
1128 #define FRAME_WIN_VALID(a,b,k) ( (((T_FRAME_NUM)((a)-(b)))%(MAX_SEQUENCE_NUMBER+1)) < (k) )
1129
1130 /*
1131 * FRAME_NUM_DISTANCE(a,b) equal to b - a for frame nums
1132 */
1133 #define FRAME_NUM_DISTANCE(a,b) ((T_FRAME_NUM)((b)-(a))%(MAX_SEQUENCE_NUMBER+1))
1134
1135
1136 typedef struct
1137 {
1138 UBYTE data[S_FRAME_SACK_MAX_CTRL_OCTETS];
1139 } T_SACK_BITMAP;
1140
1141
1142 typedef enum
1143 {
1144 ABIT_NO_REQ,
1145 ABIT_SET_REQ
1146 } T_ABIT_REQ_TYPE;
1147
1148 typedef enum
1149 {
1150 IQ_NO_FRAME, /* return code only */
1151 IQ_NEW_FRAME, /* new in the queue */
1152 IQ_RETR_FRAME, /* ITX - marked for retransmission */
1153 IQ_W4ACK_FRAME, /* ITX - is send, but no ack up to now */
1154 IQ_IS_ACK_FRAME /* ITX - is ack and waiting for to be next in sequence */
1155 } T_IQ_STATUS;
1156
1157 typedef enum
1158 {
1159 NS_EQUAL_VR,
1160 NS_NO_SEQUENCE_ERROR,
1161 NS_EQUAL_VR_PLUS_1,
1162 NS_IN_RANGE_VR_KU
1163 } T_LAST_NS_TYPE;
1164
1165 typedef enum
1166 {
1167 I_FRAME = I_FRAME_ID,
1168 S_FRAME = S_FRAME_ID,
1169 UI_FRAME = UI_FRAME_ID,
1170 U_FRAME = U_FRAME_ID
1171 } T_PDU_TYPE;
1172
1173 typedef enum
1174 {
1175 /*
1176 * The values are chosen to correspond with the Sx and Mx bits in the frame
1177 * control field. Thus these commands can be used to build the header of a
1178 * frame.
1179 * NOTE:
1180 * Some I and U frame commands have the same value.
1181 */
1182 #ifdef REL99
1183 U_NULL = U_FRAME_NULL,
1184 #endif /* REL99 */
1185 I_RR = I_FRAME_RR,
1186 I_ACK = I_FRAME_ACK,
1187 I_RNR = I_FRAME_RNR,
1188 I_SACK = I_FRAME_SACK,
1189 U_SABM = U_FRAME_SABM,
1190 U_DISC = U_FRAME_DISC,
1191 U_UA = U_FRAME_UA,
1192 U_DM = U_FRAME_DM,
1193 U_FRMR = U_FRAME_FRMR,
1194 U_XID = U_FRAME_XID
1195 } T_COMMAND;
1196
1197 typedef enum
1198 {
1199 NO_SERVICE,
1200 SERVICE_LLME,
1201 SERVICE_ITX,
1202 SERVICE_IRX,
1203 SERVICE_UITX,
1204 SERVICE_UIRX,
1205 SERVICE_U,
1206 SERVICE_TX,
1207 SERVICE_RX,
1208 SERVICE_T200
1209 } T_SERVICE;
1210
1211 typedef enum
1212 {
1213 PRIM_DATA,
1214 PRIM_UNITDATA,
1215 PRIM_REMOVED,
1216 NO_PRIM
1217 } T_PRIM_TYPE;
1218
1219 typedef enum
1220 {
1221 EXPIRY_TIMED,
1222 EXPIRY_REQUESTED
1223 } T_EXPIRY_MODE_TYPE;
1224
1225
1226 /*
1227 * Don't use enum for SAPI, because that's larger in size than UBYTE.
1228 */
1229 typedef UBYTE T_SAPI;
1230
1231 #define SAPI_1 LL_SAPI_1
1232 #define SAPI_2 LL_SAPI_INVALID
1233 #define SAPI_3 LL_SAPI_3
1234 #define SAPI_4 LL_SAPI_INVALID
1235 #define SAPI_5 LL_SAPI_5
1236 #define SAPI_6 LL_SAPI_INVALID
1237 #define SAPI_7 LL_SAPI_7
1238 #define SAPI_8 LL_SAPI_INVALID
1239 #define SAPI_9 LL_SAPI_9
1240 #define SAPI_10 LL_SAPI_INVALID
1241 #define SAPI_11 LL_SAPI_11
1242 #define SAPI_12 LL_SAPI_INVALID
1243 #define SAPI_13 LL_SAPI_INVALID
1244 #define SAPI_14 LL_SAPI_INVALID
1245 #define SAPI_15 LL_SAPI_INVALID
1246
1247 /*
1248 * Indicates which primitive to use after successful (re-)establishment:
1249 * LL_ESTABLISH_IND/CNF
1250 */
1251 typedef UBYTE T_ESTABLISHMENT;
1252
1253 #define IND_ESTABLISHMENT 1
1254 #define CNF_ESTABLISHMENT 2
1255
1256 /*
1257 * Local TX transmit queue.
1258 * NOTE:
1259 * The ph_* variables must exactly match the types of T_GRLC_DATA_REQ /
1260 * T_GRLC_UNITDATA_REQ.
1261 */
1262 typedef struct T_TX_QUEUE_ELEMENT
1263 {
1264 struct T_TX_QUEUE_ELEMENT *next; /* pointer to next element */
1265 ULONG primitive; /* stored primitive */
1266 ULONG reference; /* entry reference number */
1267 T_PRIM_TYPE prim_type; /* primitive type */
1268 UBYTE ph_sapi; /* primitive header: sapi */
1269 ULONG ph_tlli; /* tlli */
1270 UBYTE ph_grlc_qos_peak; /* grlc_qos.peak */
1271 UBYTE ph_radio_prio; /* radio_prio */
1272 UBYTE ph_cause; /* cause */
1273 T_SERVICE rx_service; /* flow control service */
1274 BOOL remove_frame; /* TRUE: frame has to remove */
1275 #ifdef REL99
1276 UBYTE ph_pkt_flow_id; /* packet flow identifier */
1277 #endif /* REL99 */
1278 } T_TX_QUEUE;
1279
1280
1281 typedef struct T_ITX_I_QUEUE_ENTRY
1282 {
1283 struct T_ITX_I_QUEUE_ENTRY *next; /* pointer to next element */
1284 #ifdef LL_DESC
1285 T_LL_DESC_REQ* frame; /* pointer to L3 prim */
1286 #else
1287 T_LL_DATA_REQ* frame; /* pointer to L3 prim */
1288 #endif
1289 USHORT n_retr; /* retransmission counter */
1290 T_IQ_STATUS status; /* status flag */
1291 T_FRAME_NUM ns; /* send sequence number N(S) */
1292 ULONG oc_i_tx; /* OC to use for this N(S) */
1293
1294 /*
1295 * Copy of original LL_DATA_REQ parameter for attached_counter handling
1296 */
1297 #ifdef LL_2to1
1298 T_PS_qos_r97 ll_qos; /* quality of service */
1299 T_LL_reference1 reference; /* ciphering indicator */
1300 #else
1301 T_ll_qos ll_qos; /* quality of service */
1302 T_reference1 reference; /* ciphering indicator */
1303 #endif
1304 #ifdef REL99
1305 UBYTE pkt_flow_id; /*Packet Flow Identifier */
1306 #endif /* REL99 */
1307 #ifdef LL_DESC
1308 USHORT offset; /* Offset of buffer */
1309 USHORT len; /* Length of buffer */
1310 #else
1311 USHORT sdu_o_buf; /* Offset of SDU data */
1312 USHORT sdu_l_buf; /* Length of SDU data */
1313 #endif
1314 UBYTE radio_prio; /* Radio Priority */
1315 UBYTE seg_pos; /* First and/or last seg? */
1316
1317 } T_ITX_I_QUEUE_ENTRY;
1318
1319
1320 typedef struct
1321 {
1322 struct T_ITX_I_QUEUE_ENTRY *first; /* pointer to first element */
1323 USHORT entries; /* number of Queue enties */
1324 } T_ITX_I_QUEUE;
1325
1326
1327 typedef struct T_ITX_S_QUEUE_ENTRY
1328 {
1329 struct T_ITX_S_QUEUE_ENTRY *next; /* pointer to next element */
1330 T_COMMAND sx; /* Supervisiory command Sx */
1331 T_ABIT_REQ_TYPE rt; /* A bit request flag */
1332 T_FRAME_NUM nr; /* N(R) of command */
1333 T_SACK_BITMAP bitmap; /* SACK bitmap */
1334 } T_ITX_S_QUEUE_ENTRY;
1335
1336
1337 typedef struct T_IRX_QUEUE
1338 {
1339 struct T_IRX_QUEUE *next; /* pointer to next element */
1340 T_LL_UNITDATA_IND* frame; /* pointer to L3 prim */
1341 T_FRAME_NUM ns; /* received frame number N(S) */
1342 } T_IRX_QUEUE;
1343
1344 typedef struct T_UIRX_QUEUE
1345 {
1346 struct T_UIRX_QUEUE *next; /* pointer to next element */
1347 T_LL_UNITDATA_IND* frame; /* pointer to L3 prim */
1348 } T_UIRX_QUEUE;
1349
1350
1351 typedef struct /* T_XID_PARAMETERS */
1352 {
1353 struct /* Version */
1354 {
1355 BOOL valid;
1356 UBYTE value;
1357 } version;
1358 struct /* IOV-UI */
1359 {
1360 BOOL valid;
1361 ULONG value;
1362 } iov_ui;
1363 struct /* IOV-I */
1364 {
1365 BOOL valid;
1366 ULONG value;
1367 } iov_i;
1368 struct /* T200 */
1369 {
1370 BOOL valid;
1371 USHORT value;
1372 } t200;
1373 struct /* N200 */
1374 {
1375 BOOL valid;
1376 UBYTE value;
1377 } n200;
1378 struct /* N201-U */
1379 {
1380 BOOL valid;
1381 USHORT value;
1382 } n201_u;
1383 struct /* N201-I */
1384 {
1385 BOOL valid;
1386 USHORT value;
1387 } n201_i;
1388 struct /* mD */
1389 {
1390 BOOL valid;
1391 USHORT value;
1392 } md;
1393 struct /* mU */
1394 {
1395 BOOL valid;
1396 USHORT value;
1397 } mu;
1398 struct /* kD */
1399 {
1400 BOOL valid;
1401 UBYTE value;
1402 } kd;
1403 struct /* kU */
1404 {
1405 BOOL valid;
1406 UBYTE value;
1407 } ku;
1408 struct /* Reset */
1409 {
1410 BOOL valid;
1411 } reset;
1412 } T_XID_PARAMETERS;
1413
1414
1415
1416 typedef struct /* T_FFS_XID_PARAMETERS */
1417 {
1418 struct /* T200 */
1419 {
1420 BOOL valid;
1421 USHORT value;
1422 } t200[UNACKNOWLEDGED_INC];
1423 struct /* N200 */
1424 {
1425 BOOL valid;
1426 UBYTE value;
1427 } n200[UNACKNOWLEDGED_INC];
1428 struct /* N201-U */
1429 {
1430 BOOL valid;
1431 USHORT value;
1432 } n201_u[UNACKNOWLEDGED_INC];
1433 struct /* N201-I */
1434 {
1435 BOOL valid;
1436 USHORT value;
1437 } n201_i[ACKNOWLEDGED_INC];
1438 struct /* mD */
1439 {
1440 BOOL valid;
1441 USHORT value;
1442 } md[ACKNOWLEDGED_INC];
1443 struct /* mU */
1444 {
1445 BOOL valid;
1446 USHORT value;
1447 } mu[ACKNOWLEDGED_INC];
1448 struct /* kD */
1449 {
1450 BOOL valid;
1451 UBYTE value;
1452 } kd[ACKNOWLEDGED_INC];
1453 struct /* kU */
1454 {
1455 BOOL valid;
1456 UBYTE value;
1457 } ku[ACKNOWLEDGED_INC];
1458 } T_FFS_XID_PARAMETERS;
1459
1460
1461 typedef struct /* T_LLME_DATA */
1462 {
1463 UBYTE state;
1464 /*
1465 * Required for state traces.
1466 */
1467 #ifndef NTRACE
1468 char *name;
1469 char *state_name;
1470 #endif
1471 } T_LLME_DATA;
1472
1473
1474 typedef struct /* T_U_DATA */
1475 {
1476 UBYTE state;
1477 /*
1478 * Required for state traces.
1479 */
1480 #ifndef NTRACE
1481 char *name;
1482 char *state_name;
1483 #endif
1484 /*
1485 * TLLI of current transaction (is set with incoming primitives, time-outs,
1486 * and signals with primitive payload).
1487 */
1488 ULONG current_tlli;
1489
1490 /*
1491 * Number of retransmissions per sent command frame.
1492 */
1493 UBYTE retransmission_counter;
1494
1495 /*
1496 * If LLC receives an release request from Layer 3 and is not able to confirm
1497 * the request immediately, release_requested has to be set to TRUE.
1498 */
1499 UBYTE release_requested;
1500
1501 /*
1502 * Send LL_ESTABLISH_IND/CNF after successful establishment.
1503 */
1504 T_ESTABLISHMENT ind_cnf_establishment;
1505
1506 /*
1507 * Indicates if XID command has been sent.
1508 */
1509 BOOL xid_pending;
1510
1511 /*
1512 * Indicates that an LL_XID_IND has been sent.
1513 */
1514 BOOL ll_xid_resp_pending;
1515
1516 /*
1517 * Reason of frame rejection condition.
1518 */
1519 UBYTE frmr_reason;
1520
1521 /*
1522 * Used to tag parameters for the next XID response. This is done by
1523 * setting the corresponding bit (with the definitions from llc_uf.h) to 1.
1524 * This variable is initialised by llme_init(), and with every call of
1525 * u_eval_xid().
1526 */
1527 ULONG xid_tag;
1528
1529 /*
1530 * Tags parameters for further negotiation that have not been included in
1531 * the XID command but are included in the XID response. These parameters
1532 * have to be included in every XID response until the parameter has been
1533 * explicitly negotiated, either by responding to an XID command that
1534 * included the parameter, or by explicitly including the parameter
1535 * the next time an XID command is transmitted.
1536 * <R.LLC.XIDNEG_R.A.015>
1537 * This variable is initialised by llme_init().
1538 */
1539 ULONG xid_tag_negotiate;
1540
1541 /*
1542 * Used to tag parameters that have actually been sent in the last command
1543 * or response frame. It is used for collision checks and the like.
1544 * This variable is initialised by llme_init(), and with every call of
1545 * u_insert_xid().
1546 */
1547 ULONG xid_tag_sent;
1548
1549 /*
1550 * Structure to contain XID parameters that are requested to be negotiated.
1551 * Valid flags are initialised by llme_init(), and are being reset when
1552 * the parameter has explicitly been included in a response.
1553 */
1554 T_XID_PARAMETERS requested_xid;
1555
1556 } T_U_DATA;
1557
1558
1559 typedef struct /* T_ITX_DATA */
1560 {
1561 UBYTE state;
1562 /*
1563 * Required for state traces.
1564 */
1565 #ifndef NTRACE
1566 char *name;
1567 char *state_name;
1568 #endif
1569
1570 BOOL tx_waiting;
1571 BOOL buffer_was_full;
1572
1573 /*
1574 * I frame buffer size variables: Total length of
1575 * transmitted and not acknowlegded information fields.
1576 */
1577 ULONG B_tx;
1578
1579 /*
1580 * Local transmit queues for I- and S frames
1581 */
1582 T_ITX_I_QUEUE i_queue;
1583 T_ITX_S_QUEUE_ENTRY *s_queue;
1584
1585 /*
1586 * T201 Data
1587 */
1588 T_ITX_I_QUEUE_ENTRY *t201_entry;
1589 USHORT n_pb_retr;
1590
1591 } T_ITX_DATA;
1592
1593
1594 typedef struct /* T_IRX_DATA */
1595 {
1596 UBYTE state;
1597 /*
1598 * Required for state traces.
1599 */
1600 #ifndef NTRACE
1601 char *name;
1602 char *state_name;
1603 #endif
1604
1605 /*
1606 * I frame buffer size variables: Total length of
1607 * stored information fields.
1608 */
1609 ULONG B_rx;
1610
1611 /*
1612 * Next frame number to forward to L3
1613 */
1614 T_FRAME_NUM vf;
1615
1616 /*
1617 * L3 ready to receive a data indication flag
1618 */
1619 BOOL ll_send_ready;
1620 T_LAST_NS_TYPE last_ns;
1621
1622 T_IRX_QUEUE *queue;
1623 } T_IRX_DATA;
1624
1625
1626 typedef struct /* T_UITX_DATA */
1627 {
1628 UBYTE state;
1629 /*
1630 * Required for state traces.
1631 */
1632 #ifndef NTRACE
1633 char *name;
1634 char *state_name;
1635 #endif
1636 /*
1637 * Unacknowledged send sequence number
1638 */
1639 T_FRAME_NUM vu;
1640 } T_UITX_DATA;
1641
1642
1643 typedef struct /* T_UIRX_DATA */
1644 {
1645 UBYTE state;
1646 /*
1647 * Required for state traces.
1648 */
1649 #ifndef NTRACE
1650 char *name;
1651 char *state_name;
1652 #endif
1653 /*
1654 * Bit field for received N(U) values, relative to V(UR).
1655 */
1656 ULONG last_32_frames_bitfield;
1657
1658 T_UIRX_QUEUE *queue;
1659
1660 } T_UIRX_DATA;
1661
1662
1663 typedef struct /* T_T200_DATA */
1664 {
1665 UBYTE state;
1666 /*
1667 * Required for state traces.
1668 */
1669 #ifndef NTRACE
1670 char *name;
1671 char *state_name;
1672 #endif
1673 /*
1674 * Length of timer T200 in milliseconds (is negotiated in 0.1s!).
1675 * LLC layer parameter.
1676 */
1677 T_TIME length;
1678 /*
1679 * The frame which is associated with the timer, the RLC/MAC cause of the
1680 * frame, and the service that started the timer. This is the t200_data
1681 * array of SDL.
1682 */
1683 #ifdef LL_DESC
1684 T_LL_UNITDESC_REQ *frame;
1685 #else
1686 T_LL_UNITDATA_REQ *frame;
1687 #endif
1688 UBYTE cause;
1689 T_SERVICE originator;
1690
1691 } T_T200_DATA;
1692
1693
1694 typedef struct /* T_TX_DATA */
1695 {
1696 UBYTE state;
1697 /*
1698 * Required for state traces.
1699 */
1700 #ifndef NTRACE
1701 char *name;
1702 char *state_name;
1703 #endif
1704 /*
1705 * Local transmit queue (single-linked dynamic list).
1706 */
1707 T_TX_QUEUE *queue;
1708 /*
1709 * Counter of available space for UITX primitives in the queue.
1710 */
1711 UBYTE queue_counter_itx[ITX_NUM_INC];
1712 UBYTE queue_counter_uitx[UITX_NUM_INC];
1713 } T_TX_DATA;
1714
1715
1716 typedef struct /* T_RX_DATA */
1717 {
1718 UBYTE state;
1719 /*
1720 * Required for state traces.
1721 */
1722 #ifndef NTRACE
1723 char *name;
1724 char *state_name;
1725 #endif
1726 } T_RX_DATA;
1727
1728
1729 typedef struct /* T_SAPI_DATA */
1730 {
1731 /*
1732 * Unacknowledged receive sequence numbers (0..511)
1733 */
1734 T_FRAME_NUM vur;
1735 T_FRAME_NUM last_vur;
1736
1737 /*
1738 * Acknowledged mode frame numbers (0..511)
1739 */
1740 T_FRAME_NUM vr;
1741 T_FRAME_NUM va;
1742 T_FRAME_NUM vs;
1743
1744 /*
1745 * Binary overflow counters for acknowledged/unacknowledged mode and
1746 * uplink/downlink. These variables are initialised with llme_init(),
1747 * and the unacknowledged OCs are reset when XID reset has been received.
1748 */
1749 ULONG oc_ui_tx;
1750 ULONG oc_ui_rx;
1751 ULONG oc_i_tx;
1752 ULONG oc_i_rx;
1753
1754 /*
1755 * pbit_outstanding set to TRUE indicates that a frame with P bit set to 1
1756 * is currently outstanding
1757 */
1758 BOOL pbit_outstanding;
1759
1760 } T_SAPI_DATA;
1761
1762 typedef struct /* Layer 3 */
1763 {
1764 BOOL valid;
1765 UBYTE length;
1766 #ifdef LL_2to1
1767 UBYTE value[LL_MAX_L3_XID_LEN];
1768 #else
1769 UBYTE value[LLC_MAX_L3_XID_LEN];
1770 #endif
1771 } T_L3_XID;
1772
1773 /*
1774 * CCI global typedefs
1775 */
1776 typedef enum
1777 {
1778 CIPHER_REQ,
1779 DECIPHER_REQ,
1780 NO_REQ
1781 } T_CCI_PRIM_TYPE;
1782
1783 /* CCI data base */
1784 typedef struct /*T_FBS_SERVICE */
1785 {
1786 UBYTE state;
1787 #ifndef NTRACE
1788 char *name;
1789 char *state_name;
1790 #endif
1791
1792 USHORT volatile *cntl_reg;
1793 USHORT volatile *status_reg;
1794 USHORT volatile *status_irq_reg;
1795 USHORT volatile *conf_ul_reg1;
1796 USHORT volatile *conf_ul_reg2;
1797 USHORT volatile *conf_ul_reg3;
1798 USHORT volatile *conf_ul_reg4;
1799 USHORT volatile *conf_ul_reg5;
1800 USHORT volatile *conf_dl_reg1;
1801 USHORT volatile *conf_dl_reg2;
1802 USHORT volatile *conf_dl_reg3;
1803 USHORT volatile *conf_dl_reg4;
1804 USHORT volatile *conf_dl_reg5;
1805 USHORT volatile *kc_reg1;
1806 USHORT volatile *kc_reg2;
1807 USHORT volatile *kc_reg3;
1808 USHORT volatile *kc_reg4;
1809 USHORT volatile *fcs_ul_reg1;
1810 USHORT volatile *fcs_ul_reg2;
1811 USHORT volatile *fcs_dl_reg1;
1812 USHORT volatile *fcs_dl_reg2;
1813 #if (BOARD == 61 OR BOARD == 71) /* G-Sample or I-Sample */
1814 USHORT volatile *switch_reg;
1815 #endif
1816 USHORT volatile *data16_reg;
1817 UBYTE volatile *data8_reg;
1818
1819 #ifdef _GEA_SIMULATION_
1820 UBYTE *simulated_reg;
1821 UBYTE *simulated_reg_buffer;
1822 #endif
1823
1824 /*primitives should also be defined as global */
1825 #ifdef LL_DESC
1826 T_CCI_CIPHER_DESC_REQ *cci_cipher_req;
1827 #else
1828 T_CCI_CIPHER_REQ *cci_cipher_req;
1829 #endif
1830 T_CCI_DECIPHER_REQ *cci_decipher_req;
1831
1832 #ifndef TI_PS_OP_CIPH_DRIVER
1833 T_CIPH_init_cipher_req_parms ciph_params;
1834 BOOL initialized;
1835 #endif
1836 ULONG cci_freed_partition;
1837 BOOL cci_info_trace;
1838
1839 } T_FBS_DATA;
1840
1841
1842 typedef struct /* T_LLC_DATA */
1843 {
1844 /*
1845 * Indicates LLC is suspended or not (default).
1846 * This variable is initialised by llme_init().
1847 */
1848 BOOL suspended;
1849
1850 /*
1851 * Indicates LLC that GRLC is suspended or not (default).
1852 * This variable is initialised by llme_init().
1853 */
1854 BOOL grlc_suspended;
1855
1856 /*
1857 * Current SAPI number. This is used for outgoing primitives. It is set
1858 * with each external event, like an incoming primitive or a time-out.
1859 */
1860 T_SAPI current_sapi;
1861
1862 /*
1863 * TLLI New and TLLI Old. These are set by GMM via LLGMM_ASSIGN_REQ.
1864 * TLLI New is used for sending primitives (if the upper layer did not
1865 * already specify the TLLI). TLLI Old is currently unused.
1866 * Both variables are initialised by llme_init().
1867 */
1868 ULONG tlli_new;
1869 ULONG tlli_old;
1870
1871 /*
1872 * LLC layer parameters (according to GSM 04.64, Version 6.4.0). These
1873 * parameters are initialised by llc_init_parameters().
1874 */
1875 UBYTE version;
1876
1877 ULONG iov_ui;
1878 ULONG iov_i_base[ACKNOWLEDGED_INC];
1879 ULONG *iov_i;
1880
1881 /*
1882 * T200 and T201 values are defined in the respective service data arrays.
1883 */
1884 UBYTE n200_base[UNACKNOWLEDGED_INC];
1885 UBYTE *n200;
1886
1887 USHORT n201_u_base[UNACKNOWLEDGED_INC];
1888 USHORT n201_i_base[ACKNOWLEDGED_INC];
1889 USHORT *n201_u;
1890 USHORT *n201_i;
1891
1892 USHORT md_base[ACKNOWLEDGED_INC];
1893 USHORT mu_base[ACKNOWLEDGED_INC];
1894 USHORT *md;
1895 USHORT *mu;
1896
1897 UBYTE kd_base[ACKNOWLEDGED_INC];
1898 UBYTE ku_base[ACKNOWLEDGED_INC];
1899 UBYTE *kd;
1900 UBYTE *ku;
1901
1902 T_L3_XID requested_l3_xid_base[ACKNOWLEDGED_INC];
1903 T_L3_XID *requested_l3_xid;
1904
1905 /*
1906 * Structure to contain decoded XID parameters.
1907 * Valid flags are initialized by u_check_xid() each time received XID
1908 * is checked.
1909 */
1910 T_XID_PARAMETERS decoded_xid;
1911 T_L3_XID decoded_l3_xid;
1912
1913 /*
1914 * LLC layer variables needed for ciphering (see services TX/RX). These
1915 * variables are set with LLGMM_ASSIGN_REQ by GMM.
1916 */
1917 #ifdef LL_2to1
1918 T_LLGMM_llgmm_kc kc;
1919 #else
1920 T_llgmm_kc kc;
1921 #endif
1922
1923
1924 UBYTE ciphering_algorithm;
1925
1926 /*
1927 * Service data structures.
1928 *
1929 * Services with multiple incarnations require an array of structures
1930 * named xxx_base[] with xxx = service abbrevation, and additionally a
1931 * pointer named *xxx, which will be accessed instead of xxx_base.
1932 *
1933 * Services with only one incarnation just have to declare one structure
1934 * named xxx (no need for xxx_base[] and *xxx).
1935 *
1936 * The differentiation between the two access possibilites is made with
1937 * the defines of the service names above (LLC_SERVICE_XXX).
1938 */
1939 T_LLME_DATA llme;
1940
1941 T_SAPI_DATA sapi_base[MAX_SAPI_INC];
1942 T_SAPI_DATA *sapi;
1943
1944 T_U_DATA u_base[U_NUM_INC];
1945 T_U_DATA *u;
1946
1947 T_ITX_DATA itx_base[ITX_NUM_INC];
1948 T_IRX_DATA irx_base[IRX_NUM_INC];
1949 T_ITX_DATA *itx;
1950 T_IRX_DATA *irx;
1951
1952 T_UITX_DATA uitx_base[UITX_NUM_INC];
1953 T_UIRX_DATA uirx_base[UIRX_NUM_INC];
1954 T_UITX_DATA *uitx;
1955 T_UIRX_DATA *uirx;
1956
1957 T_T200_DATA t200_base[T200_NUM_INC];
1958 T_T200_DATA *t200;
1959
1960 T_TX_DATA tx;
1961 T_RX_DATA rx;
1962
1963 T_FBS_DATA fbs;
1964
1965 #ifdef _SIMULATION_
1966 /*
1967 * Structure to contain XID parameters that are configured in ffs.
1968 */
1969 T_FFS_XID_PARAMETERS ffs_xid;
1970 #endif
1971
1972 /*Number of milliseconds to delay after sending reset_ind to SNDCP*/
1973 USHORT millis;
1974 #ifdef REL99
1975 U16 cur_pfi; /* current packet flow identifier */
1976 #endif
1977 T_ll_qos cur_qos; /* quality of service R97 */
1978 U8 cur_radio_prio; /* T_PS_radio_prio, Radio priority */
1979 } T_LLC_DATA;
1980
1981
1982 /*==== EXPORT =====================================================*/
1983
1984 /*
1985 * Entity data base
1986 */
1987 #ifdef LLC_PEI_C
1988 T_LLC_DATA llc_data_base, *llc_data;
1989 #else
1990 EXTERN T_LLC_DATA llc_data_base, *llc_data;
1991 #endif
1992
1993 #define ENTITY_DATA llc_data
1994
1995 /*
1996 * Communication handles (see also LLC_PEI.C)
1997 */
1998 #define hCommGMM llc_hCommGMM
1999 #define hCommSNDCP llc_hCommSNDCP
2000 #ifdef LL_2to1
2001 #define hCommMM llc_hCommMM
2002 #else
2003 #define hCommGSMS llc_hCommGSMS
2004 #endif
2005 #define hCommGRLC llc_hCommGRLC
2006
2007 #ifdef LLC_PEI_C
2008 T_HANDLE hCommGMM = VSI_ERROR;
2009 T_HANDLE hCommSNDCP = VSI_ERROR;
2010 #ifdef LL_2to1
2011 T_HANDLE hCommMM = VSI_ERROR;
2012 #else
2013 T_HANDLE hCommGSMS = VSI_ERROR;
2014 #endif
2015 T_HANDLE hCommGRLC = VSI_ERROR;
2016
2017 T_HANDLE LLC_handle;
2018 /*
2019 * make the pei_create function unique
2020 */
2021 #define pei_create llc_pei_create
2022
2023 #else
2024 EXTERN T_HANDLE hCommGMM;
2025 EXTERN T_HANDLE hCommSNDCP;
2026 #ifdef LL_2to1
2027 EXTERN T_HANDLE hCommMM;
2028 #else
2029 EXTERN T_HANDLE hCommGSMS;
2030 #endif
2031 EXTERN T_HANDLE hCommGRLC;
2032
2033 EXTERN T_HANDLE LLC_handle;
2034
2035 #endif /* LLC_PEI_C */
2036
2037
2038 #endif /* LLC_H */