comparison src/g23m-gprs/grlc/grlc.h @ 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 : GPRS (8441)
4 | Modul : GRLC
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 entity GRLC.
18 +-----------------------------------------------------------------------------
19 */
20
21 #ifndef GRLC_H
22 #define GRLC_H
23
24 /*
25 * defines the user of the vsi interface
26 */
27 #define VSI_CALLER GRLC_handle,
28 #define VSI_CALLER_SINGLE GRLC_handle
29
30 /*
31 * Macros
32 */
33
34 #define ENCODE_OFFSET 0 /* PALLOC SDU*/
35
36 /*
37 * Bit and byte length for encoding/decoding
38 */
39
40 #define BIT_UL_CTRL_BLOCK_MAC_HEADER 8
41 #define BIT_UL_CTRL_BLOCK_CONTENTS 176
42 #define BIT_UL_CTRL_BLOCK (BIT_UL_CTRL_BLOCK_MAC_HEADER+BIT_UL_CTRL_BLOCK_CONTENTS)
43
44 #define BYTE_UL_CTRL_BLOCK (BIT_UL_CTRL_BLOCK/BITS_PER_BYTE)
45
46
47 /*
48 * The following definitions are used for the management of single block
49 * sending without TBF establishment.
50 *
51 * TC holds a queue of size MSG_OWNER_MAX_NUM to buffer the single blocks
52 * requested by the services. Only services MEAS and CS can request single
53 * blocks in parallel. In case service CTRL has requested a single block,
54 * services MEAS and CS are not allowed to request any single blocks.
55 *
56 * Service CS uses the same buffer as the service CTRL. Only one single block
57 * can be stored for both services. The service MEAS has an individual buffer.
58 * At this time only one single block can be stored for this service but we are
59 * free to increase the size just by increasing the value of MAX_CTRL_BLK_NUM.
60 */
61 #define MAX_CTRL_BLK_NUM 5 /* number of single blocks that can be stored at */
62 /* the same time */
63
64 #define BLK_INDEX_CTRL 0 /* Packet Cell Change Failure */
65 #define BLK_INDEX_CS 0 /* Packet Measurement Report (NC Measurements) */
66 #define BLK_INDEX_TM 1 /* Packet Resource Request (Reallocation) */
67 #define BLK_INDEX_MEAS 2 /* Packet Measurement Report (EXT Measurements) */
68
69
70 typedef UBYTE T_BLK_OWNER;
71
72 #define BLK_STATE_NONE 0 /* no control message associated */
73 #define BLK_STATE_ALLOCATED 1 /* control message is allocated */
74 #define BLK_STATE_SENT_REQ 2 /* control message is sent, waiting for response */
75
76 typedef UBYTE T_BLK_STATE;
77
78 /*
79 * Constants
80 */
81
82 /*
83 * Disable Get State traces only for target enviroment
84 */
85
86 #ifdef _TARGET_
87 #undef GET_STATE
88 #define GET_STATE(P) (ENTITY_DATA->P state)
89 #endif
90
91
92 /*
93 * Define the size of the GRLC queue in frame
94 */
95 #define PEI_PRIM_QUEUE_SIZE 32
96
97 /*
98 * Defines the size of the queue which do a tempory save of llc primitives
99 */
100
101 #ifdef _TARGET_
102 #define PRIM_QUEUE_SIZE 20
103 #else
104 #define PRIM_QUEUE_SIZE 10
105 #endif/*TARGET*/
106
107
108 #define GMM_PRIM_QUEUE_SIZE 2
109 #define MAX_WINDOW_SIZE 64
110
111
112 #define PRIM_QUEUE_SIZE_TOTAL (PRIM_QUEUE_SIZE+GMM_PRIM_QUEUE_SIZE)
113
114 #define MAX_LLC_PDU_SIZE 1560
115 #define MAX_GRLC_USER_DATA (MAX_WINDOW_SIZE * 50) /* window size * user data with CS4 */
116 #define FN_MAX 0x297000
117
118 /* MAC HEADER TYPE*/
119 #define RLC_DATA_BLOCK 0
120 #define CTRL_BLK_NO_OPT 1
121 #define CTRL_BLK_OPT 2
122
123 /*
124 * Size of Next Poll Array
125 */
126 #define NEXT_POLL_ARRAY_SIZE 8
127 #define WIN_SIZE 64 /*window size of rlc*/
128 /*
129 * Size of Poll Type Array
130 */
131 #define POLL_TYPE_ARRAY_SIZE 8
132
133
134
135
136 /*
137 TBF BSN RANGE
138 */
139 #define NR_OF_PDUS_PER_RLCMAC_BLOCK 8 /* max. number of pdus in one rlc mac block */
140 #define TLLI_SIZE 4 /* tlli size in UBYTE */
141
142 #define WIN_MOD 63
143 #define BSN_MAX 127
144
145 #define RD_LI_CNT_MAX 8 /* max. number of pdus in one rlc mac block in downlink direction*/
146
147
148 #define OFFSET_CTRL_BLOCK_IDX 200
149
150 /*
151 end constants for RU
152 */
153 #define MAX_UL_TN 4 /* max. number of timeslots supported in uplink */
154
155 /*
156 start constants for RD
157 */
158
159
160 #define RD_NEXT_ARRAY_DATA_SIZE 50 /* valid for all coding schemes */
161
162 #define ACK_CNT_MEAS_RPT_FIRST 2
163 #define ACK_CNT_NORMAL 1
164
165 /*
166 end constants for RD
167 */
168
169 /*
170 start constants for TM
171 */
172 #define RADIO_PRIO_4 3
173
174 /*
175 end constants for TM
176 */
177
178 /*
179 start constants for TPC
180 */
181 #define MIN_PCL_DCS1800 28 /* minimum power control level DCS 1800 */
182 #define MAX_PCL_DCS1800 29 /* maximum power control level DCS 1800 */
183 #define MIN_PCL_GSM900 31 /* minimum power control level GSM 900 */
184 #define MAX_PCL_GSM900 0 /* maximum power control level GSM 900 */
185 #define MIN_PCL_PCS1900 21 /* minimum power control level PCS 1900 */
186 #define MAX_PCL_PCS1900 22 /* maximum power control level PCS 1900 */
187
188 #define GAMMA_0_DCS1800 36
189 #define GAMMA_0_GSM900 39
190 #define GAMMA_0_PCS1900 36
191
192 #define TPC_SWITCHED_ON 0xFF /* normal TPC process is applied */
193 #define TPC_ALFGAM_NOT_PRESENT 0xFF /* the ALPHA and GAMMA values are */
194 /* marked as not present */
195
196 #define CLIP_T_AVG(x) ( (x) > 25 ? 25 : (x) )
197 #define CLIP_ALPHA(x) ( (x) > 10 ? 10 : (x) )
198 #define CLIP_BS_PAG_BLKS_RES(x) ( (x) > 12 ? 0 : (x) )
199 #define CLIP_BS_PRACH_BLKS(x) ( (x) > 12 ? 0 : (x) )
200
201 #define M_TPC_TRACE_STATIC 0x01 /* trace TPC parameter everytime tpc_update_pch is called */
202 #define M_TPC_TRACE_CHANGE 0x02 /* trace TPC parameter only in case at least one PCL changes */
203 #define M_TPC_TRACE_FUNCTION 0x04 /* trace mask for parameters of maca_power_control */
204 /*
205 end constants for TPC
206 */
207
208 /*
209 start constants for MEAS
210 */
211 #define MEAS_ACRCY 1000 /* accuracy */
212 /*
213 end constants for MEAS
214 */
215
216
217 #define NOT_SET 255
218
219 /*
220 * Service definitions. Used to access service data with GET/SET_STATE.
221 */
222
223
224 #define TM tm.
225 #define RD rd.
226 #define RU ru.
227 #define GFF gff.
228
229
230
231
232 /*
233 * Timer definitions (also used by GRLC_PEI.C)
234 */
235
236 typedef enum
237 {
238 T3164 = 0, /* handled by service RU */
239 T3166, /* handled by service RU */
240 T3168, /* handled by service TM */
241 T3180, /* handled by service RU */
242 T3182, /* handled by service RU */
243 T3184, /* handled by service RU */
244 T3188, /* handled by service TM */
245 T3190, /* handled by service RD */
246 T3192, /* handled by service RD */
247 T3314, /* handled by service RU */
248
249 TIMER_COUNT /* !!! always the last entry !!! */
250
251 } T_TIMER_INDEX;
252
253 /*#define T3198 no timer */ /* handled by service RU: used relative to fn, defined in T_RLC_DATA_BLOCK: T3198 = BS_CV_MAX * block periods: not timer is used */
254
255
256 #define T3164_VALUE 5000 /* ms */
257 #define T3166_VALUE 5000 /* ms */
258 /* T3168_VALUE - assigned in system info (in GPRS Cell Options)
259 range 500,1000,...4000ms */
260 #define T3180_VALUE 5000 /* ms */
261 #define T3182_VALUE 5000 /* ms */
262 #define T3184_VALUE 5000 /* ms */
263 #define T3188_VALUE 5000 /* ms */
264 #define T3190_VALUE 5000 /* ms */
265
266 /*#define T3192_VALUE - assigned in system info (in GPRS Cell Options)
267 range 500,1000,...4000ms */
268 /* T3198_VALUE - value depends BS_CV_MAX, there may be some inctances of this timer,
269 how many? the duration is not very long (asumption) - how long?
270 handling with rlc_uplink/downlink functions and a table? */
271
272 /*
273 * Service name definitions for trace purposes. The service abbrevation
274 * (e.g. RU) has to be the same as above for the service definitions.
275 */
276 #ifndef NTRACE
277
278 #define SERVICE_NAME_TM "TM"
279 #define SERVICE_NAME_RU "RU"
280 #define SERVICE_NAME_RD "RD"
281 #define SERVICE_NAME_GFF "GFF"
282
283
284 #endif /* !NTRACE */
285
286
287
288 /*
289 * Service TM
290 */
291 #define TM_ACCESS_DISABLED 0
292 #define TM_ACCESS_PREPARED 1
293 #define TM_PIM 2
294 #define TM_PAM 3
295 #define TM_PTM 4
296 #define TM_WAIT_4_PIM 5
297
298 /*
299 * Service RD
300 */
301
302 #define RD_NULL 0
303 #define RD_ACK 1
304 #define RD_REL_ACK 2
305 #define RD_UACK 3
306 #define RD_REL_UACK 4
307 #define RD_NET_REL 5
308 #define RD_WAIT_FOR_STARTING_TIME_ACK 6
309 #define RD_WAIT_FOR_STARTING_TIME_UACK 7
310 #define RU_NET_REL 8
311
312 /*
313 * Service RU
314 */
315
316 #define RU_NULL 0 /* not active state of RU */
317 #define RU_ACK 1 /* acknowledged mode state of RU */
318 #define RU_REL_ACK 2 /* release state in acknowledged mode of RU, i.e. cv=0 is transmitted but not acked */
319 #define RU_SEND_PCA 3 /* send packet control acknowledgment state of RU in acknowledged and unacknowledged mode,
320 i.e all blocks are transmitted and acked, waiting for of FN for transmiitng the packet control ack message */
321 #define RU_UACK 4 /* unacknowledged mode state of RU */
322 #define RU_REL_UACK 5 /* release state in unacknowledged mode of RU, i.e. cv=0 is transmitted but not acked
323 (i.e receiving of packet uplink ack/nack with fbi=1) */
324 #define RU_WAIT_FOR_FIRST_CALL_ACK 6
325 #define RU_WAIT_FOR_FIRST_CALL_UACK 7
326
327 /*
328 * Service GFF
329 */
330
331
332 #define GFF_ACTIVE 0
333 #define GFF_DEACTIVE 1
334 #if defined REL99 AND defined TI_PS_FF_TBF_EST_PACCH
335 #define GFF_TWO_PHASE 2
336 #endif
337
338
339 /*
340 * states for grlc_data->tc.send_grlc_ready_ind
341 */
342 #define SEND_A_GRLC_READY_IND 0
343 #define WAIT_FOR_LLC_DATA_REQ 1
344 #define PRIM_QUEUE_FULL 2
345
346 /*
347 * states for Ready Timer
348 */
349 #define STANDBY_STATE 0
350 #define READY_STATE 1
351
352 typedef UBYTE T_READY_TIMER_STATE;
353
354 #define READY_TIMER_HANDLING_DISABLED 0
355 #define READY_TIMER_HANDLING_ENABLED 1
356
357 typedef UBYTE T_READY_TIMER_HANDLING;
358
359 /*==== TYPES ======================================================*/
360
361 /*
362 * GRLC global typedefs
363 */
364
365 /* enums */
366
367 typedef UBYTE T_PRIM_TYPE;
368
369
370 typedef enum
371 {
372 CS_ZERO = 255,
373 CS_1 = 0,
374 CS_2 = 1,
375 CS_3 = 2,
376 CS_4 = 3
377 } T_CODING_SCHEME;
378
379
380
381 typedef enum
382 {
383 TFI_CHANGE_NULL, /* no tfi modification needed after starting time is elapsed */
384 TFI_CHANGE_UL, /* uplink tfi shall modified after starting time is elapsed */
385 TFI_CHANGE_DL, /* downlink tfi shall modified after starting time is elapsed */
386 TFI_CHANGE_ALL /* uplink and downlink tfi shall modified after starting time is elapsed */
387 } T_TFI_CHANGE;
388
389 typedef enum
390 {
391 TBF_TYPE_NULL,
392 #if defined REL99 AND defined TI_PS_FF_TBF_EST_PACCH
393 TBF_TYPE_TP_ACCESS,
394 #endif
395 TBF_TYPE_UL,
396 TBF_TYPE_DL,
397 TBF_TYPE_CONC
398 } T_TBF_TYPE;
399
400 /*
401 * Please keep the numbering scheme, so that bit operations can be used.
402 */
403 #define REL_TYPE_NULL 0 /* no release of TBF requested */
404 #define REL_TYPE_DL 1 /* release of DL TBF requested */
405 #define REL_TYPE_UL 2 /* release of UL TBF requested */
406 #define REL_TYPE_DL_UL 3 /* release of DL and UL TBF requested */
407
408 typedef UBYTE T_REL_TYPE;
409
410
411
412
413 /*start enum for rd*/
414 typedef enum /* T_NEXT_POLL_BLOCK_TYPE*/
415 {
416 NEXT_POLL_BLOCK_NONE,
417 NEXT_POLL_BLOCK_DL_DATA,
418 NEXT_POLL_BLOCK_CTRL
419 }T_NEXT_POLL_BLOCK_TYPE;
420
421 /*
422 * used by rd : vn array (enum is using ulong)
423 */
424 #define VN_RECEIVED 1
425 #define VN_INVALID 255
426
427 /*start enum for ru*/
428 typedef enum /* T_PAN_CNT*/
429 {
430 PAN_INC,
431 PAN_DEC
432 }T_PAN_CNT;
433
434 #define VB_NACKED 0 /* negative acknowledged */
435 #define VB_ACKED 1 /* positive acknowledged */
436 #define VB_PENDING_ACK 2 /* not jet acknowledged */
437 #define VB_FIRST_SEG_TXD 3
438 #define VB_INVALID 255 /* outside window */
439
440
441 typedef enum /* T_LAST_BSN*/
442 {
443 LAST_BSN_IS_SENT, /* final uplink data block(cv=0) is sent(confirmed by l1)*/
444 LAST_BSN_STALL_CONDITION, /* stall indication in uplink, ack or uack mode */
445 LAST_BSN_RESUME_UACK_MODE_AFTER_SI, /* in rlc uack, data transfer is allowed after SI */
446 LAST_BSN_NOT_BULIT =255 /* final data block is not sent */
447 }T_LAST_BSN;
448
449 /*end um for ru*/
450
451 /*start enum for GFF*/
452
453 typedef enum /* RLC_STATUS_TYPE*/
454 {
455 RLC_STATUS_NULL = 0,
456 RLC_STATUS_UL = 1,
457 RLC_STATUS_DL = 2,
458 RLC_STATUS_BOTH = 3
459 }T_RLC_STATUS_TYPE;
460 /*end um for GFF*/
461
462
463 /*
464 * Structure
465 */
466
467 typedef enum /* T_FA_TYPE*/
468 {
469 FA_NO_CURRENT,
470 FA_NO_NEXT,
471 FA_BITMAP,
472 FA_REPEAT
473 }T_FA_TYPE;
474
475 typedef struct /* parameterts of one fixed alloction*/
476 {
477 T_CGRLC_fix_alloc_struct alloc;
478 USHORT ul_res_sum; /* number of uplink resources during this fixed allocation*/
479 ULONG alloc_start_fn;
480 ULONG alloc_end_fn;
481 } T_FA_ALLOC;
482
483
484 typedef struct /* T_FA_MANAG*/
485 {
486 T_FA_TYPE fa_type;
487 T_FA_ALLOC current_alloc;
488 T_FA_ALLOC next_alloc;
489 BOOL repeat_alloc;
490 USHORT tbf_oct_cnt; /* number of octets, to be transmitted during the current tbf*/
491 USHORT tbf_oct_cap_remain; /* remainig capacity in octetes of current fix allocation*/
492 USHORT ul_res_used; /* number of used uplink resources(timeslots) used in fixed allocation*/
493 USHORT ul_res_remain; /* number of REMAINING uplink resources(timeslots) in fixed allocation*/
494 USHORT ul_res_sum; /* number of total uplink resources in fix alloc mode during one tbf*/
495 } T_FA_MANAG;
496
497
498
499
500 typedef struct /* T_UL_TBF */
501 {
502 ULONG tlli; /* tlli that is valid for activ TBF */
503 UBYTE access_type; /* access type of the current tbf*/
504 UBYTE mac_mode;
505 UBYTE rlc_mode; /* is estimated in tc_start_access */
506 T_CODING_SCHEME cs_type;
507 UBYTE ti; /* =1 tlli field present in data block, else not present*/
508 BOOL tlli_cs_type; /* coding scheme for rlc data blocks including TLLI*/
509 UBYTE prio; /* Radio Prioritity from grlc_data_req or
510 grlc_unitdata_req; should be set in tm_start_access */
511 UBYTE ac_class; /* access class and radio priority of the network */
512 UBYTE nr_blocks; /* set in ts_start_access; CS_1 is used */
513 /* 4 Access Burst or RLCMAC-Block,
514 maybe storing is not necessary*/
515 UBYTE nts; /* number of timeslots allocated for tbf */
516 UBYTE ts_mask; /* timeslot mask */
517 UBYTE bs_cv_max;
518 USHORT rlc_db_granted; /* indicates if close ended or open ended tbf is used */
519
520 T_FA_MANAG fa_manag; /* contains all fixed alloction parameters*/
521 } T_UL_TBF;
522
523
524 typedef struct /* T_DL_TBF */
525 {
526 ULONG tlli; /* tlli that is valid for activ TBF */
527 UBYTE mac_mode;
528 UBYTE rlc_mode; /* is estimated in tc_start_access */
529 T_CODING_SCHEME cs_type;
530 UBYTE nts; /* number of timeslots allocated for tbf */
531 UBYTE ts_mask; /* timeslot mask */
532 UBYTE t3192_val;
533 UBYTE trans_id; /* transaction id */
534 } T_DL_TBF;
535
536
537 typedef struct /* T_TBF_CTRL */
538 {
539 T_TBF_TYPE tbf_type;
540 ULONG start_fn;
541 ULONG end_fn;
542 ULONG rlc_oct_cnt;
543 UBYTE pdu_cnt;
544 UBYTE vs_vr;
545 UBYTE va_vq;
546 USHORT cnt_ts;
547 UBYTE tfi;
548 UBYTE ack_cnt;
549 UBYTE fbi;
550 UBYTE ret_bsn;
551 } T_TBF_CTRL;
552
553
554
555
556 typedef struct /* T_PRIM_QUEUE */
557 {
558 UBYTE next; /* index of following entry; 0xff if no primitive follows */
559 UBYTE previous; /* index of previous entry; 0xff first primitive */
560 T_GRLC_DATA_REQ * prim_ptr; /* pointer to primitive */
561 T_PRIM_TYPE prim_type; /* GRLC_UNITDATAreq or GRLC_DATAreq*/
562 BOOL cv_status; /* is set if pdu is included in the count down procedure */
563 BOOL rlc_status; /* is set if transmission of the pdu has started*/
564 BOOL re_allocation;/* in front of this pdu is a reallocation necessary */
565 BOOL start_new_tbf;/* marks the first llc of a new tbf*/
566 UBYTE last_bsn; /* indicates the last bsn of th rlc data block, which belongs to the pdu */
567 } T_PRIM_QUEUE;
568
569
570
571 typedef struct /* T_NEXT_POLL_ARRAY */
572 {
573 UBYTE cnt;
574 UBYTE next;
575 UBYTE ctrl_ack;
576 ULONG fn;
577 UBYTE poll_type[POLL_TYPE_ARRAY_SIZE];
578 }T_NEXT_POLL_ARRAY;
579
580 typedef struct /* T_TM_B_DATA : used in Testmode B */
581 {
582 USHORT block_status; /* stores the block_status received on downlink */
583 UBYTE e_bit; /* stores the e_bit received on downlink */
584 UBYTE payload[50]; /* stores the payload received on downlink */
585 }T_TM_B_DATA;
586
587 typedef struct /* T_TESTMODE "test mode" */
588 {
589 UBYTE mode; /* test mode, where
590 * 0x00 means no test mode
591 * 0x01 means type A
592 * 0x02 means type B
593 */
594 ULONG n_pdu; /* number of PDUs which are to be transmitted */
595 UBYTE dl_ts_offset; /* Downlink Timeslot Offset, only for CGRLC_LOOP */
596 USHORT prbs_shift_reg; /* pseudo random bit sequence(prbs)
597 * shift register
598 */
599 UBYTE * ptr_test_data; /*
600 * reference to data which are callaculated for
601 * the current framenumber. All slots related to the same
602 * frame number have to have the same data.
603 */
604 UBYTE no_data_calculation; /*
605 * Is set when the prbs for the current
606 * frame number is already calculated
607 */
608 T_TM_B_DATA rec_data[2]; /* for Testmode B: received data is stored. Only 2 timeslots
609 * are supported. The data will be stored sequentialy depending upon
610 * Downlink Timeslot Offset value
611 */
612 } T_TESTMODE;
613
614
615
616
617
618
619
620 typedef struct /* saves all downlink data blocks*/
621 {
622 USHORT rx_no;
623 T_dl_data dl_data[MAC_MAX_DL_DATA_BLCKS];
624 } T_dl_struct;
625
626
627
628 typedef struct /* saves struct of downlink data blocks*/
629 {
630 T_dl_struct data_ptr;
631 ULONG fn;
632 } T_FUNC_DL_BLOCKS;
633
634
635 typedef struct /* functional interface: RLC_UPLINK, RLC_DOWNLINK, MACA_POWER_CONTROL */
636 {
637 T_FUNC_DL_BLOCKS dl_blocks;
638 T_MAC_DATA_IND mac_data_ind;
639 T_MAC_READY_IND mac_ready_ind;
640 T_MAC_PWR_CTRL_IND mac_pwr_ctrl_ind;
641 } T_FUNC_INTERFACE;
642
643
644
645
646
647 /* structure for service internal data */
648
649
650
651
652
653 /*start of structs for RU*/
654
655
656 typedef struct
657 {
658 U8 mac; /*< mac header */
659 U8 ti; /*< TLLI Indicator (TI) bit */
660 U8 e_bit; /*< Extended bit */
661 U8 li_cnt; /*< Number of LIs */
662 U8 li_me[NR_OF_PDUS_PER_RLCMAC_BLOCK]; /*< LI, M and e-Bit */
663 } T_U_DATA;
664
665
666 typedef struct /* T_RLC_DATA*/
667 {
668 T_sdu * ptr_data;
669 USHORT l_buf;
670 USHORT o_buf;
671 } T_RLC_DATA;
672
673 typedef struct /* T_RLC_DATA_BLOCK*/
674 {
675 USHORT block_status;
676 T_U_DATA header; /*stores the header of the rlc data block*/
677 UBYTE data_cnt; /*number of pdus in the rlc data block*/
678 T_RLC_DATA data[NR_OF_PDUS_PER_RLCMAC_BLOCK]; /*stores the pointers of the sdus*/
679 ULONG T3198; /*timer T3198, value= BS_CV_MAX block periods*/
680 UBYTE cnt_pl_trans; /* counts the number of transmissions over physical link*/
681 } T_RLC_DATA_BLOCK;
682
683 typedef struct /* T_PL_RETRANS*/
684 {
685 UBYTE cnt; /* number of transmitted rlc/mac blocks */
686 UBYTE blk[MAX_UL_TN]; /* stores the bsn(data block) or ctrl block nr */
687 } T_PL_RETRANS;
688
689
690
691 /*end of structs for RU*/
692
693 /*start of structs for RD*/
694
695
696
697
698 typedef struct /*T_NEXT_ARRAY*/
699 {
700 ULONG * next; /*zeig auf next struct vom typ T_NEXT_ARRAY*/
701 USHORT len;
702 UBYTE data[RD_NEXT_ARRAY_DATA_SIZE];
703 } T_NEXT_ARRAY;
704
705 typedef struct /* T_DATA_ARRAY */ /*for received data blocks*/
706 {
707 BOOL pdu_complete; /* indicates if the last part of the data block is a complete pdu*/
708 UBYTE pdu_cnt; /* nr of complete pdus in the current data block*/
709 T_NEXT_ARRAY * first; /* indicates the first element(first next_array) of the pdu */
710 } T_DATA_ARRAY;
711
712
713 /*end of structs for RD*/
714
715
716
717 /*start of structs for GFF*/
718
719
720
721
722 typedef struct /* T_RLC_VALUES*/
723 {
724 USHORT sdu_len;
725 USHORT cnt_ts;
726 } T_RLC_VALUES;
727
728
729 /*end of structs for GFF*/
730
731
732
733 /* data base for control messages */
734 typedef struct /* T_UL_CTRL_BLOCK */
735 {
736 T_BLK_OWNER owner;
737 T_BLK_STATE state;
738 UBYTE data[BYTE_UL_CTRL_BLOCK];
739 } T_UL_CTRL_BLOCK;
740
741 typedef UBYTE T_BLK_INDEX;
742
743
744
745 typedef struct /* T_UL_CTRL_BLOCK_ARRAY */
746 {
747 T_UL_CTRL_BLOCK blk[MAX_CTRL_BLK_NUM];
748 T_BLK_INDEX seq[MAX_CTRL_BLK_NUM];
749 } T_UL_CTRL_BLOCK_ARRAY;
750
751
752 typedef struct
753 {
754 USHORT l_buf;
755 USHORT o_buf;
756 UBYTE buf [2 * BYTE_UL_CTRL_BLOCK];
757 /* CAN's suggestion never more then 2 blocks */
758 /* or 8 blocks? ID's suggestion 'B_SIZE_D_PAGING_REQ\8+1' */
759
760 } T_CTRLBUF;
761
762
763
764 typedef struct /* T_TM_DATA */
765 {
766 UBYTE state;
767 UBYTE disable_class; /* tm_grlc_init sets it to CR, updated with cgrlc_disable_req*/
768 UBYTE n_res_req; /* number of sended packet resource request */
769 UBYTE n_acc_req_procedures; /* number of started access procedures */
770 T_UL_CTRL_BLOCK_ARRAY ul_ctrl_blk; /* holds all relevant information for */
771 /* sending uplink control blocks */
772
773 UBYTE start_of_new_tbf; /* index where the new TBF starts
774 0xff means not used */
775 BOOL send_grlc_ready_ind; /* GRLC_READY_IND have to be sent if this variable is TRUE
776 when a internal signal sig_ru_tm_prim_delete
777 was received by TM. */
778 UBYTE change_mark; /* received from GRR, needed for sending in packet resource request*/
779 #if defined REL99 AND defined TI_PS_FF_TBF_EST_PACCH
780 BOOL pacch_prr_pca_sent; /* Use during release , Prr,pca was sent */
781 #endif
782
783 T_CGRLC_freq_param freq_param; /* frequency parameter of the current TBF */
784
785 USHORT max_grlc_user_data; /* maximum nr of byte which can be stored in uplink in the LLC data queue*/
786
787 #ifndef NTRACE
788 char *name;
789 char *state_name;
790 #endif
791 } T_TM_DATA;
792
793 typedef struct /* T_ACK_CTRL */
794 {
795 UBYTE cnt_meas_rpt;
796 UBYTE cnt_other;
797 } T_ACK_CTRL;
798
799 typedef struct /* T_RD_DATA */
800 {
801 /*UBYTE*/
802 UBYTE state;
803 UBYTE vq;
804 UBYTE vr;
805 UBYTE li_cnt;
806 UBYTE rlc_data_len;
807 UBYTE f_ack_ind;
808 UBYTE ssn;
809 UBYTE last_bsn;
810 UBYTE bsn_pdu_start;
811 UBYTE cnt_sent_f_ack; /* counts number of sent final downlink ack nacks*/
812
813 /*USHORT*/
814 USHORT pdu_len;
815 /*ULONG*/
816 ULONG fn_p_tbf_rel;
817 /*POINTER*/
818 /*BOOL*/
819 BOOL ch_req_in_ack_prog; /*indicates weather the channel request is programmed in the last packet downlink ack/nack or not*/
820 BOOL channel_req; /*indicates weather the channel request is sent in packet downlink ack/naok or not*/
821 BOOL pdu_complete;
822 BOOL inSequence;
823 BOOL release_tbf;
824 BOOL v_next_tbf_params; /* indicates if next_tbf_params is valid or not*/
825 BOOL ignore_pdu; /* if true pdu shall be ignored, max_pdu_size reached and until next pdu bound every thing is discarded */
826
827 /*Type*/
828 UBYTE rlc_mode;
829 T_DATA_ARRAY data_array[WIN_SIZE];
830 T_NEXT_ARRAY *ptr_grlc;
831 T_GRLC_DATA_IND grlc_data_ind;
832 T_NEXT_POLL_BLOCK_TYPE next_poll_block;
833 T_CODING_SCHEME cs_type;
834 T_DL_TBF next_tbf_params; /* stores downlink parameters in case of tbf starting time*/
835
836 /*array*/
837 UBYTE vn[WIN_SIZE];
838 USHORT li[RD_LI_CNT_MAX];
839 UBYTE m[RD_LI_CNT_MAX];
840 T_ACK_CTRL ack_ctrl;
841
842 #ifndef NTRACE
843 char *name;
844 char *state_name;
845 #endif
846 } T_RD_DATA;
847
848 typedef struct /* T_RU_DATA */
849 {
850 /*DECLARATIONS*/
851 /*UBYTE*/
852 UBYTE state;
853 UBYTE nts;
854 UBYTE nts_max;
855 UBYTE ti;
856 UBYTE next_prim;
857 UBYTE active_prim;
858 UBYTE vs;
859 UBYTE va;
860 UBYTE bsn_ret;
861 UBYTE last_si_block;
862 UBYTE cv;
863 UBYTE N3104;
864 UBYTE N3104_MAX;
865 UBYTE count_cv_0;
866 UBYTE nr_nacked_blks; /*number of negative acked blocks*/
867 UBYTE pdu_cnt; /* nr of pdus per tbf*/
868 UBYTE pdu_sent; /* nr of sent pdus per tbf, but stil not acknowlegded*/
869 UBYTE pdu_rem; /* nr of remaining pdus per tbf*/
870 UBYTE pdu_boundaries; /*nr of need boundaries*/
871 /*USHORT*/
872 USHORT block_status;
873 USHORT poll_tn;
874 USHORT rlc_data_size;
875 USHORT sdu_len;
876 USHORT sdu_off;
877 USHORT rlc_octet_cnt;
878 USHORT tbc; /*number of rlc data blocks during the tbf, which is requested to send*/
879 USHORT cnt_ts;
880 /*ULONG*/
881 ULONG poll_fn;
882 /*BOOL*/
883 BOOL tlli_cs_type;
884 BOOL cd_active; /*indicates if the countdown procedure is active*/
885 BOOL reorg_l1_needed; /* set to true if data blocks in l1 queue must be recalculated*/
886 BOOL v_next_tbf_params; /* indicates if next_tbf_params is valid or not*/
887 BOOL first_usf; /* true: wait for the first valid usf. FALSE: first usf was read*/
888 /*Type*/
889 UBYTE rlc_mode;
890 T_CODING_SCHEME cs_type;
891 T_PL_RETRANS pl_retrans_current; /*status of current block, requested blocks to be send by PL*/
892 T_LAST_BSN last_bsn; /* needed for starting timer t3182 */
893 /*array*/
894 T_RLC_DATA_BLOCK rlc_data[WIN_SIZE]; /*contains the rlc data block, including header and pointer to the data*/
895 UBYTE vb[WIN_SIZE];
896 T_UL_TBF next_tbf_params; /* stores uplink parameters in case of tbf starting time*/
897
898
899 UBYTE write_pos_index;
900 T_ul_data ul_data[MAX_UL_TN];
901 BOOL release_tbf;
902 #if defined REL99 AND defined TI_PS_FF_TBF_EST_PACCH
903 BOOL tbf_re_est; /*TBF Re-establish on PACCH*/
904 #endif
905
906 #ifndef NTRACE
907 char *name;
908 char *state_name;
909 #endif
910 } T_RU_DATA;
911
912
913
914
915 typedef struct /* T_GFF_DATA */
916 {
917 UBYTE state;
918 T_RLC_STATUS_TYPE rlc_status;
919
920 #ifndef NTRACE
921 char *name;
922 char *state_name;
923 #endif
924 } T_GFF_DATA;
925
926 typedef ULONG T_SIGN_VAR_VALUE;
927 typedef USHORT T_SIGN_VAR_INDEX;
928
929 typedef struct /* T_SIGN_VAR */
930 {
931 T_SIGN_VAR_VALUE value; /* current signal variance */
932 T_SIGN_VAR_INDEX index; /* mean index */
933 } T_SIGN_VAR;
934
935 typedef USHORT T_C_INDEX;
936 typedef USHORT T_C_VALUE;
937
938 typedef struct /* T_C_FILTER */
939 {
940 T_C_VALUE value; /* current C value */
941 T_C_INDEX index; /* iteration index */
942 } T_C_FILTER;
943
944 typedef struct
945 {
946 USHORT total; /* Total number of bits */
947 USHORT fault; /* Number of faulty bits */
948 } T_BE_INFO;
949
950 typedef struct
951 {
952 UBYTE num_dl_blck; /* Number of downlink data blocks */
953 T_BE_INFO be_info[MAC_MAX_DL_DATA_BLCKS];
954 /* Bit error information */
955 } T_BER_IND;
956
957 typedef ULONG T_BER_VALUE;
958 typedef USHORT T_BER_INDEX;
959
960 typedef struct /* T_BER_AVG */
961 {
962 T_BER_VALUE value; /* current BER value in % */
963 T_BER_INDEX index; /* iteration index */
964 } T_BER_AVG;
965
966 #if ( ! ( MAC_MAX_TIMESLOTS == CGRLC_MAX_TIMESLOTS ) )
967 #error MAC_MAX_TIMESLOTS == CGRLC_MAX_TIMESLOTS required
968 #endif
969
970 #if ( ! ( MAC_RXLEV_NONE == CGRLC_RXLEV_NONE ) )
971 #error MAC_RXLEV_NONE == CGRLC_RXLEV_NONE required
972 #endif
973
974 #if ( ! ( MAC_RXLEV_MIN == CGRLC_RXLEV_MIN ) )
975 #error MAC_RXLEV_MIN == CGRLC_RXLEV_MIN required
976 #endif
977
978 #if ( ! ( MAC_RXLEV_MAX == CGRLC_RXLEV_MAX ) )
979 #error MAC_RXLEV_MAX == CGRLC_RXLEV_MAX required
980 #endif
981
982 typedef enum /* T_PCH_IDX */
983 {
984 PCH_IDX_A = 0,
985 PCH_IDX_B = 1,
986
987 PCH_IDX_MAX = 2
988 } T_PCH_IDX;
989
990 typedef struct /* T_PCH_ARRAY */
991 {
992 UBYTE pch[MAC_MAX_TIMESLOTS];
993 } T_PCH_ARRAY;
994
995 typedef struct /* T_PCH_BUFFER */
996 {
997 T_PCH_IDX pch_idx;
998 T_PCH_ARRAY pch_array[PCH_IDX_MAX];
999 } T_PCH_BUFFER;
1000
1001 typedef struct /* T_MS_PWR_CAP */
1002 {
1003 const UBYTE *p_control; /* power control level -> output power */
1004 SHORT pwr_min; /* minimum nominal output power in the cell */
1005 SHORT gamma_0; /* GAMMA 0 */
1006 } T_MS_PWR_CAP;
1007
1008 typedef struct /* T_TPC_DATA */
1009 {
1010 UBYTE fix_pcl; /* fixed PCL */
1011
1012 BOOL v_fix_pwr_par;
1013 T_CGRLC_pwr_ctrl_param fix_pwr_par; /* fixed power parameter */
1014
1015 T_CGRLC_pwr_ctrl_param pwr_par; /* power control parameter */
1016 T_CGRLC_glbl_pwr_ctrl_param glbl_pwr_par; /* global power control parameter */
1017
1018 T_PCH_BUFFER pch_buffer; /* power control level buffer */
1019
1020 #if !defined (NTRACE)
1021
1022 UBYTE n_tpc_trace;
1023
1024 #endif /* #if !defined (NTRACE) */
1025
1026 #ifndef NTRACE
1027 char *name;
1028 char *state_name;
1029 #endif
1030 } T_TPC_DATA;
1031
1032 typedef struct /* T_GRLC_MEAS_DATA */
1033 {
1034 T_CGRLC_INT_LEVEL_REQ ilev;
1035 T_C_FILTER c_filter;
1036 T_SIGN_VAR sign_var;
1037 T_BER_AVG ber_avg;
1038 BOOL sq_restart;
1039
1040 #if !defined (NTRACE)
1041
1042 UBYTE v_im_trace;
1043
1044 #endif /* #if !defined (NTRACE) */
1045
1046 #ifndef NTRACE
1047 char *name;
1048 char *state_name;
1049 #endif
1050 } T_GRLC_MEAS_DATA;
1051
1052 typedef struct /* T_GRLC_READY_TIMER */
1053 {
1054 T_READY_TIMER_HANDLING handling;
1055 T_READY_TIMER_STATE state;
1056 ULONG value;
1057 } T_GRLC_READY_TIMER;
1058
1059 typedef struct /* T_GRLC_DATA */
1060 {
1061 T_GRLC_READY_TIMER ready_timer;
1062
1063 UBYTE burst_type;
1064 UBYTE ab_type;
1065 T_CGRLC_pan_struct pan_struct;
1066 UBYTE t3168_val;
1067
1068
1069 T_UL_TBF uplink_tbf; /* This structure is used by TM,RU
1070 during uplink-tbf */
1071 T_DL_TBF downlink_tbf; /* This structure is used by TM,RD
1072 during downlink-tbf */
1073 T_TBF_TYPE tbf_type;
1074 T_REL_TYPE rel_type; /* indicates the type of TBF currently being released */
1075 UBYTE prim_start_free; /* index of first free prim queue entry */
1076 UBYTE prim_start_tbf ; /* index of first tbf prim queue entry */
1077
1078 UBYTE save_prim_start_free; /* save value during rau request */
1079 UBYTE save_prim_start_tbf ; /* save value during rau request */
1080 BOOL gmm_procedure_is_running; /* inidcates if gmm procedure is rnnig or not*/
1081
1082 USHORT prim_user_data; /* user data which is current in the prim_queue */
1083 T_PRIM_QUEUE prim_queue[PRIM_QUEUE_SIZE_TOTAL];
1084 /* queueing of llc-pdu's */
1085 UBYTE ta_value;
1086
1087 UBYTE ul_tn_mask; /* current uplink timeslot mask */
1088 UBYTE dl_tn_mask; /* current downlink timeslot mask */
1089
1090 UBYTE ul_tfi;
1091 UBYTE dl_tfi;
1092 UBYTE r_bit; /* current r-bit value - set by TC - read by RU/RD*/
1093 UBYTE poll_start_free;
1094 UBYTE poll_start_tbf;
1095 ULONG ul_fn; /* framenumber for the current radio block, needed for transmission*/
1096 ULONG dl_fn; /* framenumber of the last radio block, where a block is received*/
1097 T_NEXT_POLL_ARRAY next_poll_array[NEXT_POLL_ARRAY_SIZE] ;
1098 UBYTE N3102;
1099 T_chan_req_des chan_req_des; /* this will be included in next Packet Downlink AckNack
1100 write by TC, read by RD */
1101 T_TESTMODE testmode; /* this structure contains all GPRS test mode related data */
1102
1103 /* only for tracing*/
1104 ULONG grlc_data_req_cnt;
1105 ULONG dl_tbf_start_time;
1106 ULONG ul_tbf_start_time;
1107 UBYTE ul_index;
1108 UBYTE dl_index;
1109 T_TBF_CTRL tbf_ctrl[2];
1110
1111 /*handling of gaps*/
1112 ULONG missed_poll_fn;
1113
1114 UBYTE t3164_to_cnt; /* conunts the timeouts of timer t3164 in sequence */
1115 UBYTE start_fn_ul_tfi; /* stores the uplink tfi, which becomes valid after starting time*/
1116 UBYTE start_fn_dl_tfi; /* stores the downlink tfi, which becomes valid after starting time*/
1117 T_ul_poll_resp ul_poll_resp[2];//MULTISLOT
1118 UBYTE ul_poll_pos_index; /* index of ul_poll_response, need for polling */
1119 ULONG next_poll_fn; /*indicates the next poll fn */
1120 T_FUNC_INTERFACE func;
1121
1122 ULONG nr_of_crc_errors;
1123 T_TFI_CHANGE tfi_change;
1124 BOOL ul_tfi_changed;
1125 UBYTE grlc_wo_ccd; /*=0 ccd is used for en/decoding, =1 messages are decoded wo ccd */
1126 #ifdef REL99
1127 BOOL pfi_support;
1128 U8 pfi_value;
1129 U8 nw_rel;
1130 #endif
1131
1132 #if defined (_TARGET_) /*target debugging*/
1133 ULONG last_ul_fn;
1134 ULONG last_dl_fn;
1135 #define CALL_ERROR_NR_OF_ST_FN 9
1136 ULONG ul_fn_store[CALL_ERROR_NR_OF_ST_FN+1];
1137 ULONG ul_fn_errors[CALL_ERROR_NR_OF_ST_FN+1];
1138 ULONG dl_fn_store[CALL_ERROR_NR_OF_ST_FN+1];
1139 ULONG dl_fn_errors[CALL_ERROR_NR_OF_ST_FN+1];
1140 UBYTE ul_cnt_syn; /*for target, count calls in rlc uplink*/
1141 UBYTE ul_cnt_asyn; /*for target, count calls in gffp mac_ready_ind*/
1142 UBYTE dl_cnt_syn; /*for target, count calls in rlc downlink*/
1143 UBYTE dl_cnt_asyn; /*for target, count calls in gffp mac_data_ind*/
1144 UBYTE ul_call_errors; /*for target, count calls in rlc uplink during grlc is active*/
1145 UBYTE dl_call_errors; /*for target, count calls in rlc downlink during grlc is active*/
1146 #endif /*(_TARGET_) */
1147
1148 /*
1149 * Service data
1150 */
1151 T_GFF_DATA gff;
1152 T_TM_DATA tm;
1153 T_RD_DATA rd;
1154 T_RU_DATA ru;
1155 T_TPC_DATA tpc;
1156 T_GRLC_MEAS_DATA meas;
1157 }T_GRLC_DATA;
1158
1159
1160
1161
1162
1163
1164
1165
1166 /*==== EXPORT =====================================================*/
1167
1168 /*
1169 * data base
1170 */
1171 #ifdef GRLC_PEI_C
1172 T_GRLC_DATA grlc_data_base, *grlc_data;
1173 #else
1174 EXTERN T_GRLC_DATA grlc_data_base, *grlc_data;
1175 #endif
1176
1177 #define ENTITY_DATA grlc_data
1178
1179
1180 /*
1181 * Communication handles (see also GRLC_PEI.C)
1182 */
1183 #define hCommL1 grlc_hCommMAC
1184 #define hCommGRR grlc_hCommGRR
1185 #define hCommGRLC grlc_hCommGRLC
1186 #define hCommGMM grlc_hCommGMM
1187 #define hCommLLC grlc_hCommLLC
1188 #define hCommPL grlc_hCommPL
1189 #ifdef FF_WAP
1190 #define hCommWAP grlc_hCommWAP /*In future an own FMM Entity is planned*/
1191 #endif
1192
1193 #define _decodedMsg grlc__decodedMsg
1194
1195
1196 #ifdef GRLC_PEI_C
1197 T_HANDLE hCommL1 = VSI_ERROR;
1198 T_HANDLE hCommGRLC = VSI_ERROR;
1199 T_HANDLE hCommGRR = VSI_ERROR;
1200 T_HANDLE hCommGMM = VSI_ERROR;
1201 T_HANDLE hCommLLC = VSI_ERROR;
1202 T_HANDLE hCommPL = VSI_ERROR;
1203 #ifdef FF_WAP
1204 T_HANDLE hCommWAP = VSI_ERROR;
1205 #endif
1206 T_HANDLE GRLC_handle;
1207
1208
1209
1210 GLOBAL UBYTE _decodedMsg [MAX_MSTRUCT_LEN_GRLC];
1211
1212 /*
1213 * make the pei_create function unique
1214 */
1215 #define pei_create grlc_pei_create
1216
1217 /*
1218 * make the pei_func_primitive function unique
1219 */
1220 #define pei_func_primitive grlc_pei_func_primitive
1221
1222 #else /* !GRLC_PEI_C */
1223 EXTERN T_HANDLE hCommL1;
1224 EXTERN T_HANDLE hCommGRLC;
1225 EXTERN T_HANDLE hCommGRR;
1226 EXTERN T_HANDLE hCommGMM;
1227 EXTERN T_HANDLE hCommLLC;
1228 EXTERN T_HANDLE hCommPL;
1229 #ifdef FF_WAP
1230 EXTERN T_HANDLE hCommWAP;
1231 #endif
1232 EXTERN T_HANDLE GRLC_handle;
1233 #endif /* GRLC_PEI_C */
1234
1235
1236 EXTERN UBYTE _decodedMsg [MAX_MSTRUCT_LEN_GRLC];
1237
1238 #ifdef _TARGET_
1239
1240 #undef TRACE_FUNCTION
1241 #define TRACE_FUNCTION(a)
1242 #undef TRACE_ISIG
1243 #define TRACE_ISIG(a)
1244
1245 #endif /* _TARGET_ */
1246
1247 #endif /* GRLC_H */