comparison src/g23m-fad/rlp/rlp.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 : CSD (8411)
4 | Modul : Rlp.h
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 | Radio Link Protocol
19 +-----------------------------------------------------------------------------
20 */
21
22 #ifndef RLP_H
23 #define RLP_H
24
25 /*
26 * Conditional Compiling
27 */
28
29 #undef TRACE_INTERPRETED_RLP_FRAME
30 #undef TRACE_RLP_FRAME
31 #define V42BIS
32
33 /*
34 * Macros
35 */
36
37 /*
38 * instance management
39 */
40 #define GET_INSTANCE(p) &rlp_data_base[0]
41
42 /*
43 * Constants
44 */
45 /*
46 * global unchangable constants
47 */
48 #ifdef V42BIS
49 #define ORIG_RLP_VERS 1 /* rlp version (1=single link ext)*/
50 #else
51 #define ORIG_RLP_VERS 0 /* rlp version (0=single link)*/
52 #endif
53
54 #define WIND_SIZE_MAX 61 /* max window size RLP */
55 #define DATA_SIZE_SHORT 25 /* num of data bytes in rlp frame (short format) */
56 #define DATA_SIZE_LONG 67 /* num of data bytes in rlp frame (long format, version 1) */
57
58 /*
59 * default timeout for the RLP timer
60 */
61 #define GEN_TO TT_VALUE /* default retransmission timer*/
62 #define UL_TO TUL_RCV_VALUE
63
64 /*
65 * max number of outstanding SREJs
66 */
67 #define MAX_SREJ_COUNT 10
68
69 /*
70 * timer indices
71 *
72 * 0..MAX_SREJ_COUNT reserved for field
73 */
74 #define TT_HANDLE (MAX_SREJ_COUNT+1)
75 #define TRCVR_HANDLE (MAX_SREJ_COUNT+2)
76 #define TXID_HANDLE (MAX_SREJ_COUNT+3)
77 #define TUL_RCV_HANDLE (MAX_SREJ_COUNT+4)
78
79 /*
80 * number of frames that are requested in case if low water
81 */
82
83 /*
84 * maximum number N2 can have
85 */
86 #define N2_MAX 255
87
88 /*
89 * derived constants
90 */
91 #define HEADER_LEN (RLP_HEADER_LEN/8)
92 #define TRAILER_LEN (RLP_TRAILER_LEN/8)
93 #define FRAME_SIZE_SHORT (DATA_SIZE_SHORT+HEADER_LEN+TRAILER_LEN)
94 #define FRAME_SIZE_LONG (DATA_SIZE_LONG+HEADER_LEN+TRAILER_LEN)
95
96 /*
97 * constants for XID parameter types
98 */
99 #define XID_T_NULL 0 /* end tag */
100 #define XID_T_RLP_VERS 1 /* rlp version number */
101 #define XID_T_K_IWF_MS 2 /* window size iwf->ms */
102 #define XID_T_K_MS_IWF 3 /* window size ms->iwf */
103 #define XID_T_T1 4 /* acknowledge timer */
104 #define XID_T_N2 5 /* max num of retrans attempts */
105 #define XID_T_T2 6 /* reply delay */
106 #define XID_T_COMPR 7 /* data compression */
107
108 /*
109 * constants for XID parameter length in bytes
110 */
111 #define XID_L_RLP_VERS 1 /* rlp version number */
112 #define XID_L_K_MS_IWF 1 /* window size ms->iwf */
113 #define XID_L_K_IWF_MS 1 /* window size iwf->ms */
114 #define XID_L_T1 1 /* acknowledge timer */
115 #define XID_L_N2 1 /* max num of retrans attempts */
116 #define XID_L_T2 1 /* reply delay */
117 #define XID_L_COMPR 4 /* data compression */
118
119 /*
120 * constants, to indicate parameters, which are used in XID
121 */
122 #define UF_SET_RLP_VERS 0x01
123 #define UF_SET_K_IWF_MS 0x02
124 #define UF_SET_K_MS_IWF 0x04
125 #define UF_SET_T1 0x08
126 #define UF_SET_N2 0x10
127 #define UF_SET_T2 0x20
128 #define UF_SET_COMPR 0x40
129 #define UF_ALL 0x7F
130
131 /*
132 * default values for XID
133 */
134 #define DEF_RLP_VERS 0
135 #define DEF_K_MS_IWF 61
136 #define DEF_K_IWF_MS 61
137 #define DEF_T1_FR14400 520
138 #define DEF_T1_FR9600 480
139 #define DEF_T1_FR4800 540
140 #define DEF_T1_HR4800 780
141
142 #define DEF_T2 80
143 #define DEF_N2 6
144 #define DEF_PT 0
145 #define DEF_P0 0
146 #define DEF_P1 512
147 #define DEF_P2 6
148
149 /*
150 * Bitoffset for encoding/decoding
151 */
152 #define ENCODE_OFFSET 0
153
154 /*
155 * Parameter of dynamic configuration commands
156 */
157
158 #ifndef NTRACE
159
160 /* for trace purposes */
161
162 #define SERVICE_NAME_KER "KER"
163 #define SERVICE_NAME_KERXID_C "XID_C"
164 #define SERVICE_NAME_RCV "RCV"
165 #define SERVICE_NAME_SND "SND"
166
167 #endif
168
169 #define KER ker.
170 #define KERXID_C ker.XID_C.
171 #define RCV rcv.
172 #define SND snd.
173
174 /*
175 * State index for the entity processes
176 */
177
178 /*
179 * States of the entity process KERNEL
180 */
181 #define RLP_ADM_AND_DETACHED 0
182 #define RLP_ADM_AND_ATTACHED 1
183 #define RLP_PENDING_CONNECT_REQ 2
184 #define RLP_PENDING_CONNECT_IND 3
185 #define RLP_CONNECTION_ESTABLISHED 4
186 #define RLP_PENDING_RESET_REQ 5
187 #define RLP_PENDING_RESET_IND 6
188 #define RLP_DISCONNECT_INITIATED 7
189 #define RLP_PERMANENT_ERROR 9
190 #define RLP_PENDING_REMAP_REQ 10
191 #define RLP_REMAP_DATA 11
192
193 /*
194 * States of the entity process RCV
195 */
196 #define RPDU_WAIT_FOR_A_BLOCK 0
197
198
199 /*
200 * States of the entity process SND
201 */
202 #define SPDU_WAIT_EVENT 0
203
204 /*==== TYPES ======================================================*/
205
206 /*
207 * RLP global typedefs
208 */
209
210 typedef ULONG T_BITSET;
211
212 typedef UBYTE T_BIT_INT;
213 typedef T_BIT_INT T_BIT;
214
215 typedef UBYTE T_FRAME_NUM;
216 typedef UBYTE T_EXT_FRAME_NUM;
217
218 /*
219 * structure of a RLP Frame
220 */
221 typedef UBYTE T_RLP_FRAMEDATA;
222 /*
223 typedef UBYTE T_RLP_FRAME_SHORT[FRAME_SIZE_SHORT];
224 */
225 typedef UBYTE T_RLP_FRAME_LONG[FRAME_SIZE_LONG];
226 typedef UBYTE* T_RLP_FRAMEPTR;
227
228 /*
229 * bitcoding of the M5-M1 of the RLP header for the
230 * different frame types.
231 */
232 typedef enum
233 {
234 UF_UI =0x00,
235 UF_DM =0x03,
236 UF_SABM =0x07,
237 UF_DISC =0x08,
238 UF_UA =0x0C,
239 UF_NULL =0x0F,
240 UF_XID =0x17,
241 UF_TEST =0x1C,
242 UF_REMAP =0x11
243 } T_UF;
244
245 /*
246 * bitcoding of the S2-S1 of the RLP header for the
247 * different frame types.
248 */
249 typedef enum
250 {
251 SF_RR =0x00,
252 SF_RNR =0x01,
253 SF_REJ =0x02,
254 SF_SREJ =0x03
255 } T_SF;
256
257 typedef enum
258 {
259 PDU_INVALID,
260 PDU_SABM,
261 PDU_DISC,
262 PDU_UA,
263 PDU_DM,
264 PDU_TEST,
265 PDU_NULL,
266 PDU_XID,
267 PDU_UI,
268 PDU_RR_I,
269 PDU_RNR_I,
270 PDU_SREJ_I,
271 PDU_REJ_I,
272 PDU_RR,
273 PDU_RNR,
274 PDU_SREJ,
275 PDU_REJ,
276 PDU_REMAP
277 } T_PDU_TYPE;
278
279 /*
280 * Process kernel specific types
281 */
282 #define IS_IDLE 0
283 #define IS_SEND 1
284
285 #define IW_IDLE 0
286 #define IW_WAIT 1
287
288 #define ISW_IDLE 0
289 #define ISW_SEND 1
290 #define ISW_WAIT 2
291
292 #define DTX_N 0
293 #define DTX_RR 1
294 #define DTX_RNR 2
295
296 typedef UBYTE T_COUNTER;
297
298 #define INVALID_IDX ((UBYTE) -1)
299
300 /*
301 * send buffer management
302 */
303 #define SBM_INVALID_IDX INVALID_IDX
304
305 #define SBM_BUF_SIZE (WIND_SIZE_MAX+1)
306 #define SBM_PRIMBUF_SIZE SBM_BUF_SIZE
307
308 typedef T_RLP_DATA_REQ T_SBM_PRIM;
309
310 typedef UBYTE T_SBM_BUFFER_INDEX;
311 typedef UBYTE T_SBM_BUFFER_EXTIDX;
312
313 typedef USHORT T_SBM_PRIM_INDEX;
314 typedef USHORT T_SBM_PRIM_EXTIDX;
315
316 typedef struct
317 {
318 T_SBM_PRIM *Prim;
319 UBYTE RefCount;
320 } T_SBM_PRIMSLOT;
321
322 typedef enum
323 {
324 SBM_IDLE,
325 SBM_SEND,
326 SBM_WAIT
327 } T_SBM_STATE;
328
329 typedef struct
330 {
331 T_SBM_PRIM_EXTIDX PrimSlot1; /* Index on T_SBM_PRIM */
332 T_SBM_PRIM_EXTIDX PrimSlot2; /* Index on T_SBM_PRIM */
333 USHORT Offset1; /* Offset of data in primitive */
334 USHORT Offset2; /* Offset of data in primitive */
335 USHORT Len1; /* Length of data in primitive */
336 USHORT Len2; /* Length of data in primitive */
337 T_SBM_STATE S_State; /* 'SBM_SEND' means, data has to be sent (with seq. num. n) */
338 T_SBM_BUFFER_EXTIDX NextSREJ;
339 } T_SBM_SLOT;
340
341 /*
342 * receive buffer management
343 */
344 #define RBM_INVALID_IDX INVALID_IDX
345
346 #define RBM_BUF_SIZE (WIND_SIZE_MAX+1)
347
348 #ifdef _SIMULATION_
349 #define RBM_PQ_MAX_PRIM 10
350 #else
351 #define RBM_PQ_MAX_PRIM 4
352 #endif
353
354 #define RBM_PQ_THRE_RNR (RBM_PQ_MAX_PRIM-2)
355 #define RBM_PQ_SIZE (RBM_PQ_MAX_PRIM+1)
356
357 typedef T_RLP_DATA_IND T_RBM_PRIM;
358
359 typedef UBYTE T_RBM_BUFFER_INDEX;
360 typedef UBYTE T_RBM_BUFFER_EXTIDX;
361 typedef UBYTE T_RBM_PQ_INDEX;
362
363 typedef T_RLP_FRAME_LONG T_RBM_FRAME_LONG;
364 typedef T_RLP_FRAMEPTR T_RBM_FRAMEPTR;
365
366 typedef enum
367 {
368 RBM_IDLE,
369 RBM_RCVD,
370 RBM_SREJ,
371 RBM_WAIT
372 } T_RBM_STATE;
373
374
375 typedef struct
376 {
377 T_RBM_FRAME_LONG Frame; /* To store user information */
378 T_RBM_STATE R_State; /* 'RBM_RCVD': data has been received (with seq. num. n)
379 'RBM_SREJ': the retrans. has to be requested using srej(n)
380 'RBM_WAIT': the entity waits for the requested retransmitted data */
381 } T_RBM_SLOT;
382
383 /*
384 * SREJ timer managment
385 */
386
387 #define SRM_DATA_SIZE (WIND_SIZE_MAX+1)
388
389 typedef T_COUNTER T_SRM_COUNTER;
390
391 typedef struct
392 {
393 T_SRM_COUNTER count;
394 } T_SRM_SLOT;
395
396 /*
397 * process global data
398 */
399
400 /*
401 * data for process kernel
402 */
403
404 /*
405 * table entry for timeout handling of the T_RCVS timer
406 */
407 typedef struct
408 {
409 BOOL isFree;
410 T_FRAME_NUM slot;
411 UBYTE trcvs_running;
412 } T_RCVS_ENTRY;
413
414 typedef struct
415 {
416 UBYTE state;
417 #ifndef NTRACE
418 char *name;
419 char *state_name;
420 #endif
421 } T_SUB_STATE;
422
423 typedef struct
424 {
425 UBYTE state;
426 #ifndef NTRACE
427 char *name;
428 char *state_name;
429 #endif
430
431 /*------------ variables according to GSM 04.22 ----------------------------------*/
432
433 T_BIT ABit; /* to store the Ack_Flg value of a received Connect_Resp frame */
434
435 T_BIT Ackn_FBit; /* Value of the F-Bit used in the next acknowledging PDU. */
436 UBYTE Ackn_State; /* 'SEND': an acknowledging PDU (Supervisory or Data) has to be sent */
437 /* after receiving an I-frame or a command frame with the Poll bit = 1 */
438
439 USHORT BytesPerPrim; /* number of bytes in RLP data primitives */
440 BOOL Connected; /* Process in RLP_CONNECTION_ESTABLISHED state */
441
442 USHORT Def_T1; /* Default value for T1, depends on transmission rate */
443
444 T_COUNTER DISC_Count; /* to count the transmissions of DISC.*/
445 BOOL DISC_Ind; /* In RLP_DISCONNECT_INITIATED: Indicate succesfull DISC by RLP_DISC_IND */
446 T_BIT DISC_PBit; /* The value of the P-bit in the next DISC command PDU.*/
447 UBYTE DISC_State; /* 'SEND': the DISC command PDU has to be sent at the next possible opportunity. */
448 /* 'WAIT': the RLP entity waits for the corresponding response.*/
449 T_BIT DM_FBit; /* Value of the F-Bit used in the next DM response PDU.*/
450 UBYTE DM_State; /* 'SEND': the PDU DM has to be sent. */
451 UBYTE DTX_SF; /* to store the last Superv. frame for DTX (only RR or RNR can be suppressed) */
452 T_FRAME_NUM DTX_VR; /* to store the last transmitted value of VR (used to decide the DTX condition) */
453 USHORT FrameSize; /* Size of RLP frame may be FRAME_SIZE_SHORT or FRAME_SIZE_LONG */
454 USHORT FramesPerPrim;/* number of frames in RLP data primitives (calculated from BytesPerPrim) */
455
456 T_FRAME_NUM K_ms_iwf; /* window size ms->iwf */
457 T_FRAME_NUM K_iwf_ms; /* window size iwf->ms */
458
459 BOOL LRFull; /* Local Receiver Full */
460 BOOL LRReady; /* Local Receiver Ready */
461
462 UBYTE N2; /* maximum numer of retransmission attempts */
463
464 USHORT OldFrameSize; /* Size of RLP frame before REMAP */
465
466 T_FRAME_NUM Orig_K_iwf_ms; /* original value for k_iwf_ms */
467 T_FRAME_NUM Orig_K_ms_iwf; /* original value for k_ms_iwf */
468 UBYTE Orig_N2; /* original value for n2 */
469 UBYTE Orig_P0; /* original value for p0 */
470 USHORT Orig_P1; /* original value for p1 */
471 UBYTE Orig_P2; /* original value for p2 */
472 UBYTE Orig_Pt; /* original value for pt */
473 USHORT Orig_T1; /* original value for t1 */
474 USHORT Orig_T2; /* original value for t2 */
475
476 UBYTE P0; /* V.42bis data compression request */
477 USHORT P1; /* number of possible codewords */
478 UBYTE P2; /* maximum encodable string length */
479
480 T_COUNTER Poll_Count; /* to count the transmissions of poll requests*/
481 UBYTE Poll_State; /* 'SEND': a supervisory PDU with P-bit set to one has to be sent*/
482 /* 'WAIT': the RLP entity waits for the response with F-bit set to one */
483 UBYTE Poll_xchg; /* 'IDLE': sending of a frame with P-bit set is allowed */
484 /* 'WAIT': an acknowledgement of a previous P-bit is outstanding */
485 UBYTE Pt; /* type of data compression */
486
487 UBYTE REJ_State; /* The REJ_State is send if and only if a REJ PDU has to be sent */
488
489 T_RLP_FRAME_LONG REMAP_Frame; /* frame to be sent in the next REMAP PDU*/
490 T_FRAME_DESC REMAP_FrameDesc; /* Descriptor for REMAP_Frame (static) */
491 T_FRAME_NUM RemapNr; /* Frame number taken from REMAP response */
492
493 UBYTE Rlp_Vers; /* negotiated RLP version */
494 BOOL RRReady; /* Remote Receiver Ready*/
495 T_COUNTER SABM_Count; /* to count the transmissions of SABM*/
496 UBYTE SABM_State; /* 'SEND': the SABM PDU has to be sent */
497 /* 'WAIT': the RLP entity waits for the UA response */
498 T_SF SF; /* to store the last superv. PDU type*/
499 USHORT SREJ_Count; /* number of outstanding SREJs == number of running SREJ timers (downlink) */
500
501 USHORT T1; /* value for acknowledge timer */
502 USHORT T2; /* reply delay */
503 USHORT T_ul; /* value for timer T_UL_RCV (upper layer waiting for data) */
504
505 T_RLP_FRAME_LONG TEST_R_Frame; /* data to be sent in the next TEST response PDU */
506 T_FRAME_DESC TEST_R_FrameDesc; /* descriptor for TEST_R_Frame (static) */
507 T_BIT TEST_R_FBit; /* value of the P-Bit used in the next TEST response PDU */
508 UBYTE TEST_R_State; /* 'SEND': the TEST response PDU has to be sent */
509
510 T_BIT UA_FBit; /* value of the F-Bit used in the next UA response */
511 UBYTE UA_State; /* if (UA_State = SEND) an UA PDU has to be sent */
512
513 T_RLP_FRAME_LONG UI_Frame; /* frame to be sent in the next UI PDU*/
514 T_FRAME_DESC UI_FrameDesc; /* Descriptor for UI_Frame (static) */
515 T_BIT UI_PBit; /* value of the P-Bit used in the next UI PDU */
516 UBYTE UI_State; /* 'SEND': a UI PDU has to be sent */
517
518 UBYTE UL_Rcv_State; /* 'WAIT': Upper layer is waiting for data */
519 UBYTE UL_Snd_State; /* 'WAIT': RLP is waiting for data from upper layer*/
520
521 T_COUNTER XID_Count; /* to count the transmissions of XID commands */
522
523 T_RLP_FRAME_LONG XID_C_Frame; /* data to be sent in the next XID command PDU */
524 T_FRAME_DESC XID_C_FrameDesc;/* Descriptor for XID_C_Frame (static) */
525 T_BIT XID_C_PBit; /* value of the P-Bit used in the next XID command PDU */
526
527 T_SUB_STATE XID_C; /* 'SEND': the XID command PDU has to be sent */
528 /* 'WAIT': the RLP entity waits for the next XID response */
529
530 T_BITSET XID_C_Used_Flg; /* Contains bits that indicate
531 which parameters have been received in the last XID command PDU */
532
533 T_RLP_FRAME_LONG XID_R_Frame; /* frame to be sent in the next XID response PDU */
534 T_FRAME_DESC XID_R_FrameDesc; /* Descriptor for XID_R_Frame (static) */
535 T_BIT XID_R_FBit; /* value of the P-Bit used in the next XID response PDU */
536 UBYTE XID_R_State; /* 'SEND': the XID response PDU has to be sent*/
537 T_BITSET XID_R_Used_Flg; /* Contains bits that indicate
538 which parameters have to be send in the next XID response PDU */
539
540 T_RCVS_ENTRY rcvsTab[MAX_SREJ_COUNT];
541
542 } T_KER;
543
544 /*
545 * data for process receive_pdu
546 */
547
548 /* no global data */
549
550 /*
551 * data for process send_pdu
552 */
553
554 typedef struct
555 {
556 UBYTE state;
557 #ifndef NTRACE
558 char *name;
559 char *state_name;
560 #endif
561
562 T_RLP_FRAME_LONG HO_Frame; /* Buffer and Descriptor for RLP Frames with header only */
563 T_FRAME_DESC HO_FrameDesc;
564 USHORT FrameSize; /* Size of RLP frame may be FRAME_SIZE_SHORT or FRAME_SIZE_LONG */
565 } T_SND;
566
567 /*
568 * data for send buffer management
569 */
570 typedef struct
571 {
572 T_SBM_PRIM_INDEX CurrPrimSlot;
573 USHORT CurrPrimOff;
574 USHORT CurrPrimLen;
575 T_SBM_BUFFER_INDEX K;
576 T_SBM_BUFFER_EXTIDX LastSentFrame;
577 T_SBM_PRIMSLOT Prim[SBM_PRIMBUF_SIZE];
578 T_SBM_SLOT Frame[SBM_BUF_SIZE];
579 USHORT FrameSize;
580 T_SBM_BUFFER_EXTIDX SREJ_List;
581 T_SBM_BUFFER_INDEX REJ_Buf[N2_MAX +1];
582 UBYTE REJ_BufLo;
583 UBYTE REJ_BufHi;
584 UBYTE REJ_BufSize;
585 T_SBM_BUFFER_INDEX REJ_BufLastN;
586 T_SBM_BUFFER_INDEX VA;
587 T_SBM_BUFFER_INDEX VD;
588 T_SBM_BUFFER_INDEX VS;
589 } T_SBM;
590
591 /*
592 * data for receive buffer management
593 */
594 typedef struct
595 {
596 BOOL Initialised;
597 BOOL FrameInRiBu;
598 T_RBM_PRIM *CurrPrim;
599 USHORT CurrPrimCou;
600 USHORT FramesPerPrim;
601 T_RBM_BUFFER_INDEX K;
602 T_RBM_SLOT Slot[RBM_BUF_SIZE];
603 USHORT FrameSize;
604 T_RBM_FRAME_LONG Frame;
605 T_RBM_PRIM *PQ_Array[RBM_PQ_SIZE];
606 T_RBM_PQ_INDEX PQ_Read;
607 T_RBM_PQ_INDEX PQ_Write;
608 T_RBM_BUFFER_INDEX VR;
609 T_RBM_BUFFER_INDEX LastVR;
610 } T_RBM;
611
612 /*
613 * data for srej timer management
614 */
615 typedef struct
616 {
617 T_SRM_SLOT Data[SRM_DATA_SIZE];
618 } T_SRM;
619
620 #if defined (TRACE_INTERPRETED_RLP_FRAME) || defined (TRACE_RLP_FRAME)
621
622 typedef struct
623 {
624 char trc_buf[80];
625 UBYTE idx;
626 } T_RLP_DEBUG;
627
628 #endif
629
630 /*
631 * entity data for each RLP instance
632 */
633
634 typedef struct
635 {
636 UBYTE tul_rcv_running;
637 T_FRAME_NUM rcvs_slot;
638
639 T_KER ker; /* process kernel */
640 T_SND snd; /* process send_pdu */
641 T_SBM sbm; /* send buffer manager */
642 T_SUB_STATE rcv;
643 T_RBM rbm; /* receive buffer manager */
644 T_SRM srm; /* srej timer manager */
645
646 /* Flags for frame trace */
647 BOOL uplink_frame_trace;
648 BOOL downlink_frame_trace;
649
650 #if defined (TRACE_INTERPRETED_RLP_FRAME) || defined (TRACE_RLP_FRAME)
651 T_RLP_DEBUG deb;
652 #endif
653
654 } T_RLP_DATA;
655
656
657 /*==== EXPORT =====================================================*/
658 /*
659 * data base
660 */
661
662
663 /*
664 * instance data base
665 */
666 #ifdef RLP_PEI_C
667
668 /*lint -e759 : header declaration for symbol 'rlp_data_base' could be moved from header to module */
669 GLOBAL T_RLP_DATA rlp_data_base[1], *rlp_data;
670 GLOBAL ULONG rlp_data_base_size;
671 GLOBAL ULONG rlp_data_magic_num;
672
673 #else
674
675 EXTERN T_RLP_DATA rlp_data_base [], *rlp_data;
676 EXTERN ULONG rlp_data_magic_num;
677
678 #endif
679
680 #define ENTITY_DATA rlp_data
681 #define RLP_DATA_MAGIC_NUM (('R'<<24) + ('L'<<16) + ('P'<<8)) /* "FAD",NUL */
682
683 /*
684 * Prototypes
685 *
686 * RLP KERNEL
687 *
688 * KERNEL primitive processing
689 */
690
691 EXTERN void ker_rlp_attach_req (T_RLP_ATTACH_REQ *rlp_attach_req);
692 EXTERN void ker_rlp_detach_req (T_RLP_DETACH_REQ *rlp_detach_req);
693 EXTERN void ker_rlp_connect_req (T_RLP_CONNECT_REQ *rlp_connect_req);
694 EXTERN void ker_rlp_connect_res (T_RLP_CONNECT_RES *rlp_connect_res);
695 EXTERN void ker_rlp_disc_req (T_RLP_DISC_REQ *rlp_disc_req);
696 EXTERN void ker_rlp_reset_req (T_RLP_RESET_REQ *rlp_reset_req);
697 EXTERN void ker_rlp_reset_res (T_RLP_RESET_RES *rlp_reset_res);
698 EXTERN void ker_rlp_data_req (T_RLP_DATA_REQ *rlp_data_req);
699 EXTERN void ker_rlp_getdata_req (T_RLP_GETDATA_REQ *rlp_getdata_req);
700 EXTERN void ker_rlp_ui_req (T_RLP_UI_REQ *rlp_ui_req);
701 EXTERN void ker_rlp_remap_req (T_RLP_REMAP_REQ *rlp_remap_req);
702 EXTERN void ker_rlp_remap_data_res (T_RLP_REMAP_DATA_RES *ker_rlp_remap_data_res);
703
704 /*
705 * KERNEL signal processing
706 */
707 #ifdef OPTION_MULTITHREAD
708 #define sig_rcv_ker_sabm_ind _ENTITY_PREFIXED(sig_rcv_ker_sabm_ind)
709 #define sig_rcv_ker_disc_ind _ENTITY_PREFIXED(sig_rcv_ker_disc_ind)
710 #define sig_rcv_ker_ua_ind _ENTITY_PREFIXED(sig_rcv_ker_ua_ind)
711 #define sig_rcv_ker_dm_ind _ENTITY_PREFIXED(sig_rcv_ker_dm_ind)
712 #define sig_rcv_ker_rr_ind _ENTITY_PREFIXED(sig_rcv_ker_rr_ind)
713 #define sig_rcv_ker_rnr_ind _ENTITY_PREFIXED(sig_rcv_ker_rnr_ind)
714 #define sig_rcv_ker_rej_ind _ENTITY_PREFIXED(sig_rcv_ker_rej_ind)
715 #define sig_rcv_ker_srej_ind _ENTITY_PREFIXED(sig_rcv_ker_srej_ind)
716 #define sig_rcv_ker_rr_i_ind _ENTITY_PREFIXED(sig_rcv_ker_rr_i_ind)
717 #define sig_rcv_ker_rnr_i_ind _ENTITY_PREFIXED(sig_rcv_ker_rnr_i_ind)
718 #define sig_rcv_ker_rej_i_ind _ENTITY_PREFIXED(sig_rcv_ker_rej_i_ind)
719 #define sig_rcv_ker_srej_i_ind _ENTITY_PREFIXED(sig_rcv_ker_srej_i_ind)
720 #define sig_rcv_ker_xid_ind _ENTITY_PREFIXED(sig_rcv_ker_xid_ind)
721 #define sig_rcv_ker_test_ind _ENTITY_PREFIXED(sig_rcv_ker_test_ind)
722 #define sig_rcv_ker_ready_ind _ENTITY_PREFIXED(sig_rcv_ker_ready_ind)
723 #define sig_rcv_ker_remap_ind _ENTITY_PREFIXED(sig_rcv_ker_remap_ind)
724 #define sig_rcv_ker_rawdata_ind _ENTITY_PREFIXED(sig_rcv_ker_rawdata_ind)
725 #endif
726
727 EXTERN void sig_rcv_ker_sabm_ind (void);
728 EXTERN void sig_rcv_ker_disc_ind (T_BIT);
729 EXTERN void sig_rcv_ker_ua_ind (T_BIT);
730 EXTERN void sig_rcv_ker_dm_ind (T_BIT);
731 EXTERN void sig_rcv_ker_rr_ind (T_BIT, T_BIT, T_FRAME_NUM);
732 EXTERN void sig_rcv_ker_rnr_ind (T_BIT, T_BIT, T_FRAME_NUM);
733 EXTERN void sig_rcv_ker_rej_ind (T_BIT, T_BIT, T_FRAME_NUM);
734 EXTERN void sig_rcv_ker_srej_ind (T_BIT, T_BIT, T_FRAME_NUM);
735 EXTERN void sig_rcv_ker_rr_i_ind (T_BIT, T_BIT, T_FRAME_NUM, T_FRAME_NUM);
736 EXTERN void sig_rcv_ker_rnr_i_ind (T_BIT, T_BIT, T_FRAME_NUM, T_FRAME_NUM);
737 EXTERN void sig_rcv_ker_rej_i_ind (T_BIT, T_BIT, T_FRAME_NUM, T_FRAME_NUM);
738 EXTERN void sig_rcv_ker_srej_i_ind (T_BIT, T_BIT, T_FRAME_NUM, T_FRAME_NUM);
739 EXTERN void sig_rcv_ker_xid_ind (T_BIT, T_BIT);
740 EXTERN void sig_rcv_ker_test_ind (T_BIT, T_BIT);
741 EXTERN void sig_rcv_ker_ready_ind (void);
742 EXTERN void sig_rcv_ker_remap_ind (void);
743
744 #ifdef _SIMULATION_
745 EXTERN void sig_rcv_ker_rawdata_ind (T_RA_DATA_IND *);
746 #else
747 EXTERN void sig_rcv_ker_rawdata_ind (void);
748 #endif
749 /*
750 * KERNEL procedures
751 */
752
753 #ifdef OPTION_MULTITHREAD
754
755 #define ker_init _ENTITY_PREFIXED(ker_init)
756 #define ker_get_xid_data _ENTITY_PREFIXED(ker_get_xid_data)
757 #define ker_put_xid_data _ENTITY_PREFIXED(ker_put_xid_data)
758 #define ker_copy_frame_to_sdu _ENTITY_PREFIXED(ker_copy_frame_to_sdu)
759 #define ker_copy_sdu_to_frame _ENTITY_PREFIXED(ker_copy_sdu_to_frame)
760 #define ker_get_frame_desc _ENTITY_PREFIXED(ker_get_frame_desc)
761 #define ker_i_handler _ENTITY_PREFIXED(ker_i_handler)
762 #define ker_init_link_vars _ENTITY_PREFIXED(ker_init_link_vars)
763 #define ker_reset_all_t_rcvs _ENTITY_PREFIXED(ker_reset_all_t_rcvs)
764 #define ker_s_handler _ENTITY_PREFIXED(ker_s_handler)
765 #define ker_send_data _ENTITY_PREFIXED(ker_send_data)
766 #define ker_send_txu _ENTITY_PREFIXED(ker_send_txu)
767 #define ker_deinit_link_vars _ENTITY_PREFIXED(ker_deinit_link_vars)
768 #define ker_send_rlp_error_ind _ENTITY_PREFIXED(ker_send_rlp_error_ind)
769 #define ker_init_xid_data _ENTITY_PREFIXED(ker_init_xid_data)
770 #define ker_getSlotTRCVS _ENTITY_PREFIXED(ker_getSlotTRCVS)
771 #define ker_fill_remap_frame _ENTITY_PREFIXED(ker_fill_remap_frame)
772 #define ker_send_remap_data _ENTITY_PREFIXED(ker_send_remap_data)
773 #define ker_set_frame_size _ENTITY_PREFIXED(ker_set_frame_size)
774
775 #ifdef TRACE_RLP_FRAME
776 #define ker_trace_rlp_frame _ENTITY_PREFIXED(ker_trace_rlp_frame)
777 #endif
778
779 #endif
780
781 EXTERN void ker_init(void);
782
783 EXTERN void ker_get_xid_data
784 (
785 T_RLP_FRAMEDATA *raw_data,
786 UBYTE index,
787 T_RLP_XID_IND *xid_data,
788 BOOL ms_is_initiator,
789 ULONG *used_flags
790 );
791
792 EXTERN void ker_put_xid_data
793 (
794 T_RLP_FRAMEDATA *l_Data, /* buffer for data */
795 UBYTE index, /* start index in buffer */
796 ULONG l_uf, /* valid parameters */
797 BOOL ms_is_initiator, /* MS is sending XID*/
798 UBYTE l_rlp_version, /* negotiated vers. */
799 T_FRAME_NUM l_k_iwf_ms, /* winSize ms->iwf */
800 T_FRAME_NUM l_k_ms_iwf, /* winSize iwf->ms */
801 USHORT l_t1, /* ack timer value */
802 UBYTE l_n2, /* num restransmiss */
803 USHORT l_t2, /* reply delay */
804 UBYTE l_pt, /* type data compr. */
805 UBYTE l_p0, /* v42bis comp. req */
806 USHORT l_p1, /* num possible code*/
807 UBYTE l_p2 /* max encod. strlen*/
808 );
809
810 EXTERN void ker_copy_frame_to_sdu
811 (
812 T_RLP_FRAMEPTR frame,
813 T_sdu *sdu
814 );
815
816 EXTERN void ker_copy_sdu_to_frame
817 (
818 T_sdu *sdu,
819 T_RLP_FRAMEPTR frame,
820 USHORT n
821 );
822
823 EXTERN void ker_get_frame_desc
824 (
825 T_RLP_FRAMEPTR frame,
826 T_FRAME_DESC *frameDesc
827 );
828
829 EXTERN BOOL ker_i_handler(T_FRAME_NUM ns);
830
831 EXTERN void ker_init_link_vars
832 (
833 void
834 );
835
836 #ifdef TRACE_RLP_FRAME
837 EXTERN void ker_trace_rlp_frame
838 (
839 T_RLP_FRAMEPTR frame
840 );
841 #endif
842
843 EXTERN void ker_reset_all_t_rcvs
844 (
845 void
846 );
847
848 EXTERN void ker_s_handler
849 (
850 T_BIT cBit,
851 T_BIT pFBit,
852 T_SF sf,
853 T_FRAME_NUM nr,
854 BOOL *retransError
855 );
856
857 EXTERN void ker_send_data
858 (
859 void
860 );
861
862 EXTERN BOOL ker_send_txu
863 (
864 void
865 );
866
867 EXTERN void ker_deinit_link_vars
868 (
869 void
870 );
871
872 EXTERN void ker_send_rlp_error_ind
873 (
874 USHORT cause
875 );
876
877 EXTERN void ker_init_xid_data
878 (
879 T_RLP_ATTACH_REQ *rlp_attach_request
880 );
881
882 EXTERN T_FRAME_NUM ker_getSlotTRCVS
883 (
884 USHORT index
885 );
886
887 EXTERN void ker_fill_remap_frame
888 (
889 T_FRAME_NUM vr
890 );
891
892 EXTERN BOOL ker_send_remap_data
893 (
894 void
895 );
896
897 EXTERN void ker_set_frame_size
898 (
899 UBYTE rate
900 );
901
902 /*
903 * RLP RCV
904 *
905 * RCV primitive processing
906 */
907 #ifdef _SIMULATION_
908 EXTERN const void rcv_ra_ready_ind(T_RA_READY_IND *ra_ready_ind);
909 #else
910 EXTERN void rcv_ra_ready_ind(void);
911 #endif
912
913 EXTERN void rcv_ra_data_ind(T_RA_DATA_IND *ra_data_ind);
914
915 /*
916 * RCV signal processing
917 */
918 #ifdef OPTION_MULTITHREAD
919 #define sig_ker_rcv_rawdata_res _ENTITY_PREFIXED(sig_ker_rcv_rawdata_res)
920 #endif
921
922 EXTERN void sig_ker_rcv_rawdata_res
923 (
924 T_PDU_TYPE pduType,
925 T_BIT cBit,
926 T_BIT pFBit,
927 T_FRAME_NUM nr,
928 T_FRAME_NUM ns,
929 BOOL crc
930 );
931
932 /*
933 * RCV procedures
934 */
935
936 #ifdef OPTION_MULTITHREAD
937 #define rcv_init _ENTITY_PREFIXED(rcv_init)
938 #endif
939
940 EXTERN void rcv_init(void);
941
942 /*
943 * RLP SND
944 */
945
946 /*
947 * SND signal processing
948 */
949 #ifdef OPTION_MULTITHREAD
950 #define sig_ker_snd_sabm_req _ENTITY_PREFIXED(sig_ker_snd_sabm_req)
951 #define sig_ker_snd_disc_req _ENTITY_PREFIXED(sig_ker_snd_disc_req)
952 #define sig_ker_snd_ua_req _ENTITY_PREFIXED(sig_ker_snd_ua_req)
953 #define sig_ker_snd_dm_req _ENTITY_PREFIXED(sig_ker_snd_dm_req)
954 #define sig_ker_snd_rr_req _ENTITY_PREFIXED(sig_ker_snd_rr_req)
955 #define sig_ker_snd_rnr_req _ENTITY_PREFIXED(sig_ker_snd_rnr_req)
956 #define sig_ker_snd_rej_req _ENTITY_PREFIXED(sig_ker_snd_rej_req)
957 #define sig_ker_snd_srej_req _ENTITY_PREFIXED(sig_ker_snd_srej_req)
958 #define sig_ker_snd_rr_i_req _ENTITY_PREFIXED(sig_ker_snd_rr_i_req)
959 #define sig_ker_snd_rnr_i_req _ENTITY_PREFIXED(sig_ker_snd_rnr_i_req)
960 #define sig_ker_snd_rej_i_req _ENTITY_PREFIXED(sig_ker_snd_rej_i_req)
961 #define sig_ker_snd_srej_i_req _ENTITY_PREFIXED(sig_ker_snd_srej_i_req)
962 #define sig_ker_snd_ui_req _ENTITY_PREFIXED(sig_ker_snd_ui_req)
963 #define sig_ker_snd_xid_req _ENTITY_PREFIXED(sig_ker_snd_xid_req)
964 #define sig_ker_snd_test_req _ENTITY_PREFIXED(sig_ker_snd_test_req)
965 #define sig_ker_snd_remap_req _ENTITY_PREFIXED(sig_ker_snd_remap_req)
966 #define sig_ker_snd_null_req _ENTITY_PREFIXED(sig_ker_snd_null_req)
967
968 #define sig_ker_snd_set_frame_size_req _ENTITY_PREFIXED(sig_ker_snd_set_frame_size_req)
969 #endif
970
971 EXTERN void sig_ker_snd_sabm_req (void);
972 EXTERN void sig_ker_snd_disc_req (T_BIT);
973 EXTERN void sig_ker_snd_ua_req (T_BIT);
974 EXTERN void sig_ker_snd_dm_req (T_BIT);
975
976 #ifdef ENABLE_DTX
977 EXTERN void sig_ker_snd_rr_req (T_BIT, T_BIT, T_FRAME_NUM, T_BIT);
978 #else
979 EXTERN void sig_ker_snd_rr_req (T_BIT, T_BIT, T_FRAME_NUM);
980 #endif
981
982 EXTERN void sig_ker_snd_rnr_req (T_BIT, T_BIT, T_FRAME_NUM, T_BIT);
983 EXTERN void sig_ker_snd_rej_req (T_BIT, T_BIT, T_FRAME_NUM);
984 EXTERN void sig_ker_snd_srej_req (T_BIT, T_BIT, T_FRAME_NUM);
985 EXTERN void sig_ker_snd_rr_i_req (T_BIT, T_BIT, T_FRAME_NUM, T_FRAME_NUM, T_FRAME_DESC *);
986 EXTERN void sig_ker_snd_rnr_i_req (T_BIT, T_BIT, T_FRAME_NUM, T_FRAME_NUM, T_FRAME_DESC *);
987 EXTERN void sig_ker_snd_rej_i_req (T_BIT, T_BIT, T_FRAME_NUM, T_FRAME_NUM, T_FRAME_DESC *);
988 EXTERN void sig_ker_snd_srej_i_req (T_BIT, T_BIT, T_FRAME_NUM, T_FRAME_NUM, T_FRAME_DESC *);
989 EXTERN void sig_ker_snd_ui_req (T_BIT, T_BIT, T_FRAME_DESC *);
990 EXTERN void sig_ker_snd_xid_req (T_BIT, T_BIT, T_FRAME_DESC *);
991 EXTERN void sig_ker_snd_test_req (T_BIT, T_BIT, T_FRAME_DESC *);
992 EXTERN void sig_ker_snd_remap_req (T_FRAME_DESC *);
993 EXTERN void sig_ker_snd_null_req (void);
994
995 EXTERN void sig_ker_snd_set_frame_size_req (USHORT);
996
997 /*
998 * SND procedures
999 */
1000
1001 #ifdef OPTION_MULTITHREAD
1002 #define snd_init _ENTITY_PREFIXED(snd_init)
1003 #define snd_send_u_frame _ENTITY_PREFIXED(snd_send_u_frame)
1004 #define snd_send_s_frame _ENTITY_PREFIXED(snd_send_s_frame)
1005 #define snd_send_si_frame _ENTITY_PREFIXED(snd_send_si_frame)
1006 #endif
1007
1008 EXTERN void snd_init(T_SND *snd);
1009
1010 EXTERN void snd_send_u_frame
1011 (
1012 T_UF frameType,
1013 T_BIT pFBit,
1014 T_BIT crBit,
1015 T_FRAME_DESC *dataDesc
1016 );
1017
1018 EXTERN void snd_send_s_frame
1019 (
1020 T_SF frameType,
1021 T_FRAME_NUM nr,
1022 T_BIT pFBit,
1023 T_BIT crBit,
1024 T_FRAME_DESC *dataDesc
1025 );
1026
1027 EXTERN void snd_send_si_frame
1028 (
1029 T_SF frameType,
1030 T_FRAME_NUM nr,
1031 T_BIT pFBit,
1032 T_FRAME_NUM ns,
1033 T_BIT crBit,
1034 T_FRAME_DESC *dataDesc
1035 );
1036
1037 /*
1038 * Send Buffer Management SBM
1039 */
1040 #ifdef OPTION_MULTITHREAD
1041 #define sbm_set_wind_size _ENTITY_PREFIXED(sbm_set_wind_size)
1042 #define sbm_init _ENTITY_PREFIXED(sbm_init)
1043 #define sbm_store_prim _ENTITY_PREFIXED(sbm_store_prim)
1044 #define sbm_ack_upto_n _ENTITY_PREFIXED(sbm_ack_upto_n)
1045 #define sbm_srej_frame _ENTITY_PREFIXED(sbm_srej_frame)
1046 #define sbm_get_frame _ENTITY_PREFIXED(sbm_get_frame)
1047 #define sbm_rej_from_n _ENTITY_PREFIXED(sbm_rej_from_n)
1048 #define sbm_frame_in_range _ENTITY_PREFIXED(sbm_frame_in_range)
1049 #define sbm_space_in_buf _ENTITY_PREFIXED(sbm_space_in_buf)
1050 #define sbm_deinit _ENTITY_PREFIXED(sbm_deinit)
1051 #define sbm_set_retrans _ENTITY_PREFIXED(sbm_set_retrans)
1052 #define sbm_check_rej_count _ENTITY_PREFIXED(sbm_check_rej_count)
1053 #define sbm_recall_prim _ENTITY_PREFIXED(sbm_recall_prim)
1054 #endif
1055
1056 EXTERN void sbm_set_wind_size
1057 (
1058 T_SBM_BUFFER_INDEX windSize
1059 );
1060
1061 EXTERN void sbm_init
1062 (
1063 T_SBM_BUFFER_INDEX windSize,
1064 USHORT frameSize,
1065 UBYTE n2
1066 );
1067
1068 EXTERN void sbm_store_prim
1069 (
1070 T_SBM_PRIM *sendPrim
1071 );
1072
1073 EXTERN BOOL sbm_ack_upto_n
1074 (
1075 T_SBM_BUFFER_EXTIDX
1076 );
1077
1078 EXTERN void sbm_srej_frame
1079 (
1080 T_SBM_BUFFER_INDEX n
1081 );
1082
1083 EXTERN void sbm_get_frame
1084 (
1085 T_FRAME_DESC *frameDesc,
1086 T_SBM_BUFFER_INDEX *frameNo,
1087 BOOL *framesCouldBeSent,
1088 BOOL *ok
1089 );
1090
1091 EXTERN void sbm_rej_from_n
1092 (
1093 T_SBM_BUFFER_INDEX n,
1094 BOOL *retransError
1095 );
1096
1097 EXTERN BOOL sbm_frame_in_range
1098 (
1099 T_SBM_BUFFER_INDEX n
1100 );
1101
1102 EXTERN USHORT sbm_space_in_buf
1103 (
1104 void
1105 );
1106
1107 EXTERN void sbm_deinit
1108 (
1109 void
1110 );
1111
1112 EXTERN void sbm_set_retrans
1113 (
1114 UBYTE n2
1115 );
1116
1117 EXTERN void sbm_check_rej_count
1118 (
1119 BOOL *retransError
1120 );
1121
1122 EXTERN BOOL sbm_recall_prim
1123 (
1124 T_SBM_PRIM **sendPrim
1125 );
1126
1127 EXTERN void sbm_reset_after_remap
1128 (
1129 USHORT newFrameSize,
1130 T_SBM_BUFFER_INDEX new_vs
1131 );
1132
1133 /*
1134 * Receive Buffer Management RBM
1135 */
1136 #ifdef OPTION_MULTITHREAD
1137 #define rbm_set_wind_size _ENTITY_PREFIXED(rbm_set_wind_size)
1138 #define rbm_init _ENTITY_PREFIXED(rbm_init)
1139 #define rbm_deinit _ENTITY_PREFIXED(rbm_deinit)
1140 #define rbm_reset _ENTITY_PREFIXED(rbm_reset)
1141 #define rbm_reset_srej_slots _ENTITY_PREFIXED(rbm_reset_srej_slots)
1142 #define rbm_reset_all_r_states _ENTITY_PREFIXED(rbm_reset_all_r_states)
1143 #define rbm_check_slots_srej _ENTITY_PREFIXED(rbm_check_slots_srej)
1144 #define rbm_set_rslot_wait _ENTITY_PREFIXED(rbm_set_rslot_wait)
1145 #define rbm_set_rslot_wait2srej _ENTITY_PREFIXED(rbm_set_rslot_wait2srej)
1146 #define rbm_set_rslot_rcvd _ENTITY_PREFIXED(rbm_set_rslot_rcvd)
1147 #define rbm_get_current_frame _ENTITY_PREFIXED(rbm_get_current_frame)
1148 #define rbm_accept_current_frame _ENTITY_PREFIXED(rbm_accept_current_frame)
1149 #define rbm_mark_missing_i_frames_srej _ENTITY_PREFIXED(rbm_mark_missing_i_frames_srej)
1150 #define rbm_count_missing_i_frames _ENTITY_PREFIXED(rbm_count_missing_i_frames)
1151 #define rbm_buffer_all_in_sequence_frames _ENTITY_PREFIXED(rbm_buffer_all_in_sequence_frames)
1152 #define rbm_ns_check _ENTITY_PREFIXED(rbm_ns_check)
1153 #define rbm_get_vr _ENTITY_PREFIXED(rbm_get_vr)
1154 #define rbm_get_prim _ENTITY_PREFIXED(rbm_get_prim)
1155 #define rbm_get_curr_prim _ENTITY_PREFIXED(rbm_get_curr_prim)
1156 #define rbm_move_current_frame _ENTITY_PREFIXED(rbm_move_current_frame)
1157 #define rbm_is_state_wait _ENTITY_PREFIXED(rbm_is_state_wait)
1158 #define rbm_prepare_remap _ENTITY_PREFIXED(rbm_prepare_remap)
1159
1160 #ifdef _SIMULATION_
1161 #define rbm_store_frame _ENTITY_PREFIXED(rbm_store_frame)
1162 #endif
1163 #endif
1164
1165 EXTERN BOOL rbm_set_wind_size
1166 (
1167 T_RBM_BUFFER_INDEX windSize
1168 );
1169
1170 EXTERN void rbm_init
1171 (
1172 T_RBM_BUFFER_INDEX windSize,
1173 USHORT frameSize,
1174 USHORT framesPerPrim
1175 );
1176
1177 EXTERN void rbm_deinit
1178 (
1179 void
1180 );
1181
1182 EXTERN void rbm_reset(T_RBM *rbm);
1183
1184 EXTERN void rbm_reset_srej_slots
1185 (
1186 void
1187 );
1188
1189 EXTERN void rbm_reset_all_r_states
1190 (
1191 void
1192 );
1193
1194 EXTERN T_RBM_BUFFER_EXTIDX rbm_check_slots_srej
1195 (
1196 void
1197 );
1198
1199 EXTERN void rbm_set_rslot_wait
1200 (
1201 T_RBM_BUFFER_INDEX slot
1202 );
1203
1204 EXTERN void rbm_set_rslot_wait2srej
1205 (
1206 T_RBM_BUFFER_INDEX slot
1207 );
1208
1209 EXTERN void rbm_set_rslot_rcvd
1210 (
1211 T_RBM_BUFFER_INDEX slot,
1212 BOOL *resetTimer
1213 );
1214
1215 EXTERN T_RBM_FRAMEPTR rbm_get_current_frame
1216 (
1217 void
1218 );
1219
1220 EXTERN void rbm_accept_current_frame
1221 (
1222 void
1223 );
1224
1225 EXTERN void rbm_mark_missing_i_frames_srej
1226 (
1227 T_RBM_BUFFER_INDEX ns
1228 );
1229
1230 EXTERN void rbm_count_missing_i_frames
1231 (
1232 T_RBM_BUFFER_INDEX ns,
1233 T_RBM_BUFFER_INDEX *count
1234 );
1235
1236 EXTERN void rbm_buffer_all_in_sequence_frames
1237 (
1238 T_RBM_BUFFER_INDEX fromSlot,
1239 BOOL *primIsReady,
1240 BOOL *rcvReady,
1241 BOOL *rcvFull
1242 );
1243
1244 EXTERN void rbm_ns_check
1245 (
1246 T_RBM_BUFFER_INDEX ns,
1247 BOOL *valid,
1248 BOOL *expected
1249 );
1250
1251 EXTERN T_RBM_BUFFER_INDEX rbm_get_vr
1252 (
1253 void
1254 );
1255
1256 EXTERN BOOL rbm_get_prim
1257 (
1258 T_RBM_PRIM **prim,
1259 BOOL *rcvReady,
1260 BOOL *rcvFull
1261 );
1262
1263 EXTERN T_RBM_PRIM *rbm_get_curr_prim
1264 (
1265 void
1266 );
1267
1268 EXTERN void rbm_move_current_frame
1269 (
1270 T_RBM_BUFFER_INDEX slot
1271 );
1272
1273 EXTERN BOOL rbm_is_state_wait
1274 (
1275 T_RBM_BUFFER_INDEX slot
1276 );
1277
1278 EXTERN T_FRAME_NUM rbm_prepare_remap
1279 (
1280 USHORT frameSize
1281 );
1282
1283 #ifdef _SIMULATION_
1284 EXTERN void rbm_store_frame(T_RBM_FRAMEPTR frame);
1285 #endif
1286
1287 /*
1288 * SREJ Timer Management SRM
1289 */
1290 #ifdef OPTION_MULTITHREAD
1291 #define srm_init _ENTITY_PREFIXED(srm_init)
1292 #define srm_deinit _ENTITY_PREFIXED(srm_deinit)
1293 #define srm_reset _ENTITY_PREFIXED(srm_reset)
1294 #define srm_clear _ENTITY_PREFIXED(srm_clear)
1295 #define srm_count _ENTITY_PREFIXED(srm_count)
1296 #define srm_get_counter _ENTITY_PREFIXED(srm_get_counter)
1297 #endif
1298
1299 EXTERN void srm_init
1300 (
1301 void
1302 );
1303
1304 EXTERN void srm_deinit
1305 (
1306 void
1307 );
1308
1309 EXTERN void srm_reset
1310 (
1311 void
1312 );
1313
1314 EXTERN void srm_clear
1315 (
1316 T_FRAME_NUM n
1317 );
1318
1319 EXTERN void srm_count
1320 (
1321 T_FRAME_NUM n
1322 );
1323
1324 EXTERN T_COUNTER srm_get_counter
1325 (
1326 T_FRAME_NUM n
1327 );
1328
1329 /*
1330 * timer
1331 */
1332 #define TIMERSTART(i,v) vsi_t_start(VSI_CALLER i,v);
1333 #define TIMERSTOP(i) vsi_t_stop(VSI_CALLER i);
1334 /*
1335 * time
1336 * xid parameters are given in 10^2 s, we store in 10^3 s (ms)
1337 */
1338 #define TIME_INT2EXT(t) ((t) / 10)
1339 #define TIME_EXT2INT(t) ((t) * 10)
1340
1341 /*
1342 * Communication handles
1343 */
1344 #ifdef OPTION_MULTITHREAD
1345 #define hCommL2R _ENTITY_PREFIXED(hCommL2R)
1346 #ifdef _SIMULATION_
1347 #define hCommRA _ENTITY_PREFIXED(hCommRA)
1348 #endif
1349 #endif
1350
1351 #ifdef RLP_PEI_C
1352
1353 GLOBAL T_HANDLE rlp_handle;
1354 GLOBAL T_HANDLE hCommL2R = VSI_ERROR; /* L2R Communication */
1355
1356 #ifdef _SIMULATION_
1357 GLOBAL T_HANDLE hCommRA = VSI_ERROR; /* RA Communication */
1358 #endif
1359
1360 #else
1361 EXTERN T_HANDLE rlp_handle;
1362 EXTERN T_HANDLE hCommL2R; /* L2R Communication */
1363
1364 #ifdef _SIMULATION_
1365 EXTERN T_HANDLE hCommRA; /* RA Communication */
1366 #endif
1367
1368 #endif
1369
1370 GLOBAL void rlp_exec_timeout (USHORT index);
1371
1372 #ifdef _SIMULATION_
1373
1374 #define HEX_BYTE(B,H) { UBYTE b, *a = (UBYTE*)H;\
1375 b = (((UBYTE)B) >> 4) & 0x0F;\
1376 if (b > 9) b += 'A'-10; else b += '0'; *a = b;\
1377 b = ((UBYTE)B) & 0x0F;\
1378 if (b > 9) b += 'A'-10; else b += '0'; *(a+1) = b;}
1379
1380 #endif
1381
1382 #if defined (TRACE_INTERPRETED_RLP_FRAME) || defined (TRACE_RLP_FRAME)
1383
1384 #define DEC_BYTE(B,A) {UBYTE b, rep, *a = ((UBYTE*)A)+2; b = (UBYTE) B;\
1385 for (rep=0;rep<3;rep++) {*a = (b%10) + '0'; b /= 10; a--;}}
1386
1387 #endif
1388
1389 #endif