comparison src/g23m-fad/ra/ra.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 :
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 Rate Adaption.
18 +-----------------------------------------------------------------------------
19 */
20
21 #ifndef RA_H
22 #define RA_H
23
24 #include "cl_ribu.h"
25
26 /*
27 * Conditional Compiling
28 */
29
30 #define HO_WORKAROUND
31 #undef V42BIS
32
33 #undef TRACE_RA_TRA_STATUS
34 #undef TRACE_RA_TRA_DATA
35
36 #undef TRACE_RA_FAX_DL_FRAME_TYPE
37 #undef TRACE_RA_FAX_UL_FRAME_TYPE
38 #undef TRACE_RA_FAX_UL_SKIP
39
40 #undef TRACE_RA_RLP
41
42 #if defined TRACE_RA_TRA_STATUS \
43 || defined TRACE_RA_FAX_DL_FRAME_TYPE \
44 || defined TRACE_RA_FAX_UL_FRAME_TYPE \
45 || defined _SIMULATION_
46
47 #define BYTE2HEXSTR(B, H) {UBYTE b, *a = (UBYTE*)(H);\
48 b = (((UBYTE)(B)) >> 4) & 0x0F;\
49 if (b > 9) b += 'A'-10; else b += '0'; *a = b;\
50 b = ((UBYTE)(B)) & 0x0F;\
51 if (b > 9) b += 'A'-10; else b += '0'; *(a+1) = b;}
52
53 #endif
54
55 /*
56 This constant gives the minimum number of frames,
57 which have to be sent in a FR_TRAIN sequence.
58 It is not derived from any protocol specfication,
59 but found to be necessary to establish fax calls
60 (MOC) at 2400bps on the D1 network
61 */
62 #define MIN_FR_TRAIN_LEN 32
63
64 /*
65 * Macros
66 */
67 /*
68 * instance management
69 */
70 #ifndef NTRACE
71
72 /* for trace purposes */
73
74 #define SERVICE_NAME_KER "KER"
75
76 #endif
77
78 #define KER ker.
79
80 /*
81 * States of the entity process TRANS
82 */
83 #define TRA_NULL 0
84 #define TRA_INIT_L1 1
85 #define TRA_SYNCH_TCH_START 2
86 #define TRA_SYNCH_TCH_FOUND 3
87 #define TRA_WAIT_SYNC_LOST 4
88 #define TRA_DATA_TRANS_PRE1 5
89 #define TRA_DATA_TRANS_PRE2 6
90 #define TRA_DATA_TRANS_PRE3 7
91 #define TRA_DATA_TRANS 8
92 #define TRA_STATES 9
93
94 /*
95 * States of the entity process RLP
96 */
97 #define RLP_NULL 0
98 #define RLP_INIT_L1 1
99 #define RLP_DATA_TRANS 2
100 #define RLP_STATES 3
101
102 #ifdef FF_FAX
103 /*
104 * States of the entity process FAX
105 */
106 #define FAX_NULL 0
107 #define FAX_INIT_L1 1
108 #define FAX_SYNCH_TCH_START 2
109 #define FAX_SYNCH_TCH_FOUND 3
110 #define FAX_WAIT_SYNC_LOST 4
111 #define FAX_DATA_TRANS_PRE 5
112 #define FAX_DATA_TRANS 6
113 #define FAX_MODIFY 7
114 #define FAX_STATES 8
115 #endif /* FF_FAX */
116
117 /*
118 * Bitmask definitions:
119 * msk_xxx bitmask left-justified value
120 * pos_xxx bitposition of the Less Significant Bit
121 * adr_xxx index into the shm_addr and cont_addr tables
122 * wof_xxx word offset which is to be added to the address
123 * in addr_shm table
124 */
125
126 /*
127 * Bitmask definitions for the d_ra_conf control word of the RADAP
128 */
129
130 #define msk_conf_b_itc 0x0003
131 #define pos_conf_b_itc 0
132 #define adr_conf_b_itc d_ra_conf
133 #define wof_conf_b_itc 0
134
135 /*
136 #define V_ITC_SPEECH 0
137 */
138 #define V_ITC_DATA 1
139 #define V_ITC_FAX 2
140
141 #define msk_conf_b_nsb 0x0004
142 #define pos_conf_b_nsb 2
143 #define adr_conf_b_nsb d_ra_conf
144 #define wof_conf_b_nsb 0
145
146 #define V_NSB_ONE_STOP 0
147 #define V_NSB_TWO_STOP 1
148
149 #define msk_conf_b_ndb 0x0008
150 #define pos_conf_b_ndb 3
151 #define adr_conf_b_ndb d_ra_conf
152 #define wof_conf_b_ndb 0
153
154 #define V_NDMSK_B_7_DBITS 0
155 #define V_NDMSK_B_8_DBITS 1
156
157 #define msk_conf_b_ur 0x00f0
158 #define pos_conf_b_ur 4
159 #define adr_conf_b_ur d_ra_conf
160 #define wof_conf_b_ur 0
161
162 #define V_UR_300 1
163 #define V_UR_1200 2
164 #define V_UR_2400 3
165 #define V_UR_4800 4
166 #define V_UR_9600 5
167 /* not used 6 */
168 #define V_UR_1200_75 7
169 #define V_UR_14400 8
170
171 #define msk_conf_b_ce 0x0100
172 #define pos_conf_b_ce 8
173 #define adr_conf_b_ce d_ra_conf
174 #define wof_conf_b_ce 0
175 #define V_CE_TRANSP 0
176 #define V_CE_NON_TRANSP 1
177
178 #define msk_conf_b_ct 0x0200
179 #define pos_conf_b_ct 9
180 #define adr_conf_b_ct d_ra_conf
181 #define wof_conf_b_ct 0
182 #define V_CT_FR 0
183 #define V_CT_HR 1
184
185 /*
186 * Bitmask definitions for the d_ra_act control word of the RADAP
187 */
188 #define msk_act_b_init 0x0001
189 #define pos_act_b_init 0
190 #define adr_act_b_init d_ra_act
191 #define wof_act_b_init 0
192
193 #define msk_act_b_syncul 0x0002
194 #define pos_act_b_syncul 1
195 #define adr_act_b_syncul d_ra_act
196 #define wof_act_b_syncul 0
197
198 #define msk_act_b_syncdl 0x0004
199 #define pos_act_b_syncdl 2
200 #define adr_act_b_syncdl d_ra_act
201 #define wof_act_b_syncdl 0
202
203 #define msk_act_b_ovspul 0x0008
204 #define pos_act_b_ovspul 3
205 #define adr_act_b_ovspul d_ra_act
206 #define wof_act_b_ovspul 0
207
208 #define msk_act_b_f48blk_ul 0x0020
209 #define pos_act_b_f48blk_ul 5
210 #define adr_act_b_f48blk_ul d_ra_act
211 #define wof_act_b_f48blk_ul 0
212
213 #define msk_act_b_f48blk_dl 0x0040
214 #define pos_act_b_f48blk_dl 6
215 #define adr_act_b_f48blk_dl d_ra_act
216 #define wof_act_b_f48blk_dl 0
217
218 /*
219 * Bitmask definitions for the d_ra_test
220 * control word of the RADAP
221 */
222 /*
223 #define msk_test_b_sul 0x0001
224 #define pos_test_b_sul 0
225 #define adr_test_b_sul d_ra_test
226 #define wof_test_b_sul 0
227
228 #define msk_test_b_sdl 0x0002
229 #define pos_test_b_sdl 1
230 #define adr_test_b_sdl d_ra_test
231 #define wof_test_b_sdl 0
232
233 #define msk_test_b_sched 0x0004
234 #define pos_test_b_sched 2
235 #define adr_test_b_sched d_ra_test
236 #define wof_test_b_sched 0
237 */
238
239 #define msk_test_b_t_dl_debug 0x0010
240 #define pos_test_b_t_dl_debug 4
241 #define adr_test_b_t_dl_debug d_ra_test
242 #define wof_test_b_t_dl_debug 0
243
244 /*
245 * Bitmask definitions for the d_ra_statu
246 * control word of the RADAP
247 */
248 #define msk_statu_b_sa 0x0001
249 #define pos_statu_b_sa 0
250 #define adr_statu_b_sa d_ra_statu
251 #define wof_statu_b_sa 0
252
253 #define msk_statu_b_sb 0x0002
254 #define pos_statu_b_sb 1
255 #define adr_statu_b_sb d_ra_statu
256 #define wof_statu_b_sb 0
257
258 #define msk_statu_b_x 0x0004
259 #define pos_statu_b_x 2
260 #define adr_statu_b_x d_ra_statu
261 #define wof_statu_b_x 0
262
263 #define msk_statu_b_fed_ul 0x0008
264 #define pos_statu_b_fed_ul 3
265 #define adr_statu_b_fed_ul d_ra_statu
266 #define wof_statu_b_fed_ul 0
267
268 /*
269 * Bitmask definitions for the d_ra_statd control word of the RADAP
270 */
271 #define msk_statd_b_sa 0x0001
272 #define pos_statd_b_sa 0
273 #define adr_statd_b_sa d_ra_statd
274 #define wof_statd_b_sa 0
275
276 #define msk_statd_b_sb 0x0002
277 #define pos_statd_b_sb 1
278 #define adr_statd_b_sb d_ra_statd
279 #define wof_statd_b_sb 0
280
281 #define msk_statd_b_x 0x0004
282 #define pos_statd_b_x 2
283 #define adr_statd_b_x d_ra_statd
284 #define wof_statd_b_x 0
285
286 /*
287 * for d_ra_statd only
288 */
289 #define msk_statd_b_syncdet 0x0008
290 #define pos_statd_b_syncdet 3
291 #define adr_statd_b_syncdet d_ra_statd
292 #define wof_statd_b_syncdet 0
293
294 /*
295 * Bitmask definitions for the d_fax control word of the RADAP
296 */
297 #define msk_fax_b_status_stop 0x0001
298 #define pos_fax_b_status_stop 0
299 #define adr_fax_b_status_stop d_fax
300 #define wof_fax_b_status_stop 0
301
302 #define msk_fax_b_status_detect 0x0002
303 #define pos_fax_b_status_detect 1
304 #define adr_fax_b_status_detect d_fax
305 #define wof_fax_b_status_detect 0
306
307 #define msk_fax_b_ident_thres 0x007c
308 #define pos_fax_b_ident_thres 2
309 #define adr_fax_b_ident_thres d_fax
310 #define wof_fax_b_ident_thres 0
311
312 #define msk_fax_b_info_thres 0x0f80
313 #define pos_fax_b_info_thres 7
314 #define adr_fax_b_info_thres d_fax
315 #define wof_fax_b_info_thres 0
316
317 #define msk_fax_b_status_receive 0x1000
318 #define pos_fax_b_status_receive 12
319 #define adr_fax_b_status_receive d_fax
320 #define wof_fax_b_status_receive 0
321
322 #define msk_fax_b_data_receive 0x2000
323 #define pos_fax_b_data_receive 13
324 #define adr_fax_b_data_receive d_fax
325 #define wof_fax_b_data_receive 0
326
327 #define msk_fax_b_byte_interface 0x4000
328 #define pos_fax_b_byte_interface 14
329 #define adr_fax_b_byte_interface d_fax
330 #define wof_fax_b_byte_interface 0
331
332 /*
333 * Bitmask definitions for the a_rau control field of the RADAP
334 */
335 #define RAU_DATA_14400 36
336 #define RAU_DATA_9600 24
337 #define RAU_DATA_4800 12
338 #define RAU_DATA_2400 6
339 #define RAU_DATA_1200 3
340
341 #define msk_rau_byte_cnt 0x00ff
342 #define pos_rau_byte_cnt 0
343 #define adr_rau_byte_cnt a_rau
344 #define wof_rau_byte_cnt 0
345
346 #define msk_rau_break_len 0xff00
347 #define pos_rau_break_len 8
348 #define adr_rau_break_len a_rau
349 #define wof_rau_break_len 1
350
351 #define msk_rau_break_pos 0x00ff
352 #define pos_rau_break_pos 0
353 #define adr_rau_break_pos a_rau
354 #define wof_rau_break_pos 1
355
356 /*
357 #define msk_rau_data 0xffff
358 #define pos_rau_data 0
359 */
360 #define adr_rau_data a_rau
361 #define wof_rau_data 2
362
363 /*
364 * Bitmask definitions for the a_rad control field of the RADAP
365 */
366 /*
367 #define MAX_RAD_DATA 36
368 */
369 #define msk_rad_byte_cnt 0x00ff
370 #define pos_rad_byte_cnt 0
371 #define adr_rad_byte_cnt a_rad
372 #define wof_rad_byte_cnt 0
373
374 #define msk_rad_break_len 0xff00
375 #define pos_rad_break_len 8
376 #define adr_rad_break_len a_rad
377 #define wof_rad_break_len 1
378
379 #define msk_rad_break_pos 0x00ff
380 #define pos_rad_break_pos 0
381 #define adr_rad_break_pos a_rad
382 #define wof_rad_break_pos 1
383
384 /*
385 #define msk_rad_data 0xffff
386 #define pos_rad_data 0
387 */
388 #define adr_rad_data a_rad
389 #define wof_rad_data 2
390
391 /*
392 * Definitions of frame sizes for non transparent mode (in bytes, not including the FCC)
393 */
394
395 #define NT_DATA_SIZE 27 /* Full frame at 9600 full rate and 4800 half rate */
396 #define NT_DATA_SIZE_14400_A 36 /* First half of frame at 14400 */
397 #define NT_DATA_SIZE_14400_B 33 /* Second half of frame at 14400 */
398 #define NT_DATA_SIZE_4800_FR_A 15 /* First half of frame at 4800 full rate */
399 #define NT_DATA_SIZE_4800_FR_B 12 /* Second half of frame at 4800 full rate */
400
401 /*
402 * Bitmask definitions for the a_ntu control field of the RADAP
403 */
404
405 #define msk_ntu_byte_cnt 0x00ff
406 #define pos_ntu_byte_cnt 0
407 #define adr_ntu_byte_cnt a_ntu
408 #define wof_ntu_byte_cnt 0
409
410 #define msk_ntu_M1 0x0001
411 #define pos_ntu_M1 0
412 #define adr_ntu_M1 a_ntu
413 #define wof_ntu_M1 1
414
415 #define msk_ntu_M2 0x0002
416 #define pos_ntu_M2 1
417 #define adr_ntu_M2 a_ntu
418 #define wof_ntu_M2 1
419
420 #define msk_ntu_empty 0x0004
421 #define pos_ntu_empty 2
422 #define adr_ntu_empty a_ntu
423 #define wof_ntu_empty 1
424
425 /*
426 #define msk_ntu_data 0xffff
427 #define pos_ntu_data 0
428 */
429 #define adr_ntu_data a_ntu
430 #define wof_ntu_data 2
431
432 /*
433 * Bitmask definitions for the a_ntd control word of the RADAP
434 */
435 #define msk_ntd_byte_cnt 0x00ff
436 #define pos_ntd_byte_cnt 0
437 #define adr_ntd_byte_cnt a_ntd
438 #define wof_ntd_byte_cnt 0
439
440 #define msk_ntd_M1 0x0001
441 #define pos_ntd_M1 0
442 #define adr_ntd_M1 a_ntd
443 #define wof_ntd_M1 1
444
445 /*
446 #define msk_ntd_M2 0x0002
447 #define pos_ntd_M2 1
448 #define adr_ntd_M2 a_ntd
449 #define wof_ntd_M2 1
450 */
451
452 #define msk_ntd_fcs_ok 0x0008
453 #define pos_ntd_fcs_ok 3
454 #define adr_ntd_fcs_ok a_ntd
455 #define wof_ntd_fcs_ok 1
456
457 /*
458 #define msk_ntd_data 0x00ff
459 #define pos_ntd_data 0
460 */
461 #define adr_ntd_data a_ntd
462 #define wof_ntd_data 2
463
464 /*
465 * Bitmask definitions for the a_faxu control word of the RADAP
466 */
467 #define msk_faxu_byte_cnt 0x00ff
468 #define pos_faxu_byte_cnt 0
469 #define adr_faxu_byte_cnt a_faxu
470 #define wof_faxu_byte_cnt 0
471
472 /*
473 #define msk_faxu_sync_cnt 0x00ff
474 #define pos_faxu_sync_cnt 0
475 #define adr_faxu_sync_cnt a_faxu
476 #define wof_faxu_sync_cnt 0
477 */
478
479 #define msk_faxu_control 0xff00
480 #define pos_faxu_control 8
481 #define adr_faxu_control a_faxu
482 #define wof_faxu_control 0
483
484 /*
485 #define msk_faxu_data 0xffff
486 #define pos_faxu_data 0
487 */
488 #define adr_faxu_data a_faxu
489 #define wof_faxu_data 1
490
491 /*
492 * Bitmask definitions for the a_faxd control word of the RADAP
493 */
494 #define msk_faxd_byte_cnt 0x00ff
495 #define pos_faxd_byte_cnt 0
496 #define adr_faxd_byte_cnt a_faxd
497 #define wof_faxd_byte_cnt 0
498
499 /*
500 #define msk_faxd_sync_cnt 0x00ff
501 #define pos_faxd_sync_cnt 0
502 #define adr_faxd_sync_cnt a_faxd
503 #define wof_faxd_sync_cnt 0
504 */
505
506 #define msk_faxd_control 0xff00
507 #define pos_faxd_control 8
508 #define adr_faxd_control a_faxd
509 #define wof_faxd_control 0
510
511 #define V_CTRL_DATA 0
512 #define V_CTRL_STATUS 1
513 #define V_CTRL_SYNC 2
514 #define V_CTRL_TRAIN 3
515
516 /*
517 #define msk_faxd_data 0xffff
518 #define pos_faxd_data 0
519 */
520 #define adr_faxd_data a_faxd
521 #define wof_faxd_data 1
522
523 /*
524 * index for the address array
525 */
526 #define d_ra_conf 0
527 #define d_ra_act 1
528 #define d_ra_test 2
529 #define d_ra_statu 3
530 #define d_ra_statd 4
531 #define d_fax 5
532 #define a_rau 6
533 #define a_rad 7
534 #define a_ntu 8
535 #define a_ntd 9
536 #define a_faxu 10
537 #define a_faxd 11 /* must be the last in the list */
538
539 #define RA_FIFO_DEPTH 4
540
541 #define MAX_TRANS_BUFFER 36
542 #define MAX_FAX_BUFFER_UL 72
543 #define FAD_DESCBUF_LEN MAX_FAX_BUFFER_UL /* for simulation */
544
545 #ifdef _SIMULATION_
546 #define MAX_NTRANS_BUFFER 36
547 #define MAX_FAX_BUFFER_DL 72
548 #endif
549
550 #define MODEL_RLP 1
551 #define MODEL_TRANS 2
552 #ifdef FF_FAX
553 #define MODEL_FAX 3
554 #endif
555
556 /*==== TYPES ======================================================*/
557
558 typedef struct
559 {
560 USHORT *shm_addr[a_faxd+1];
561 } T_SHARED_MEM;
562
563 typedef struct
564 {
565 USHORT timer;
566 USHORT delay_OFF_ON;
567 USHORT delay_ON_OFF;
568 UBYTE pos;
569 UBYTE current;
570 UBYTE last;
571 } T_STATUS_BIT;
572
573 typedef struct
574 {
575 BOOL ul_data_pending;
576 BOOL ul_signals_pending;
577 BOOL ul_break_pending;
578 UBYTE overspeed;
579 UBYTE ready_ind_idx;
580 BOOL data_req_rec; /* flag, if RA_DATA_REQ received */
581
582 UBYTE ul_sa;
583 UBYTE ul_sb;
584 UBYTE ul_x;
585 UBYTE ul_status;
586
587 T_STATUS_BIT dl_sa;
588 T_STATUS_BIT dl_sb;
589 T_STATUS_BIT dl_x;
590
591 UBYTE break_pos;
592 USHORT break_len;
593
594 #ifndef HO_WORKAROUND
595 T_RA_BREAK_IND ra_break_ind;
596 #endif
597 T_FD *dl_pFD;
598
599 T_FRAME_DESC ul_frame_desc;
600 } T_TRA;
601
602 typedef struct
603 {
604 UBYTE const skip_seq_same[8];
605 UBYTE const skip_seq_other[8];
606 } T_SKIP;
607
608 #ifdef FF_FAX
609 typedef struct
610 {
611 BOOL CMM_flag;
612
613 UBYTE ul_frame_type;
614 UBYTE ul_frame_type_last;
615 UBYTE train_seq[2];
616 UBYTE train_len;
617 UBYTE seq_idx;
618 UBYTE req_idx;
619
620 T_RIBU_FD *ul_ribu;
621 T_FD *ul_pFD;
622 T_FD ul_train_FD;
623
624 #if defined TRACE_RA_FAX_DL_FRAME_TYPE || defined _SIMULATION_
625 UBYTE dl_frame_type_last;
626 UBYTE dl_state_last;
627 #endif
628
629 T_FD *dl_pFD;
630
631 const T_SKIP *skip_seq;
632 const UBYTE *req_seq;
633
634 } T_FAX;
635 #endif /* FF_FAX */
636
637 #define RLP_UL_QSIZE 16
638
639 typedef struct
640 {
641 BOOL ul_data_pending;
642 BOOL ul_48_first_half_sent;
643 UBYTE m1;
644 T_RIBU ulq;
645 T_FRAME_DESC ul_frame_desc[RLP_UL_QSIZE];
646 T_FRAME_DESC dl_frame_desc;
647
648 #ifdef _SIMULATION_
649 UBYTE dl_buf[MAX_FAX_BUFFER_DL]; /* maximum is MAX_FAX_BUFFER_DL */
650 #endif
651
652 #ifdef TRACE_RA_RLP
653 ULONG fcs_error;
654 #endif
655 } T_RLP;
656
657 typedef struct
658 {
659 UBYTE state;
660 #ifndef NTRACE
661 char *name;
662 char *state_name;
663 #endif
664 } T_STATE;
665
666 typedef struct
667 {
668 T_STATE ker;
669 T_SHARED_MEM shm;
670
671 BOOL activated;
672 UBYTE model;
673 UBYTE nsb;
674 UBYTE ndb;
675 UBYTE user_rate;
676 UBYTE tra_rate;
677
678 USHORT sync_timer;
679 USHORT cycle_time;
680
681 T_TRA *tra;
682 T_RLP *rlp;
683
684 #ifdef FF_FAX
685 T_FAX *fax;
686 #endif
687
688 T_RA_DATA_IND ra_data_ind;
689 T_RA_READY_IND ra_ready_ind[2];
690
691 #ifdef _SIMULATION_
692
693 T_RIBU_FD *dl_ribu;
694 T_FD ul_FD;
695 UBYTE ul_buf[MAX_TRANS_BUFFER];
696
697 #else
698
699 T_RA_BREAK_IND ra_break_ind;
700 T_RA_DEACTIVATE_CNF ra_deactivate_cnf;
701
702 #endif
703
704
705 } T_RA_DATA;
706
707 /*==== EXPORT =====================================================*/
708
709 #ifdef OPTION_MULTITHREAD
710 #define hCommMMI _ENTITY_PREFIXED(hCommMMI)
711 #define hCommRLP _ENTITY_PREFIXED(hCommRLP)
712 #ifdef FF_FAX
713 #define hCommFAD _ENTITY_PREFIXED(hCommFAD)
714 #endif
715 #define hCommTRA _ENTITY_PREFIXED(hCommTRA) /* for trans mode */
716 #endif
717
718 #define ENTITY_DATA ra_data
719
720 #ifdef RA_DLL_C
721
722 GLOBAL T_RA_DATA *ra_data;
723
724 GLOBAL T_HANDLE ra_handle;
725 GLOBAL T_HANDLE hCommMMI = VSI_ERROR; /* MMI Communication */
726 GLOBAL T_HANDLE hCommTRA = VSI_ERROR; /* Transp Communication */
727 GLOBAL T_HANDLE hCommRLP = VSI_ERROR; /* RLP Communication */
728 #ifdef FF_FAX
729 GLOBAL T_HANDLE hCommFAD = VSI_ERROR; /* FAD Communication */
730 #endif
731
732 #ifdef HO_WORKAROUND
733 GLOBAL USHORT _act_d_ra_conf;
734 #endif
735
736 #else /* !RA_DLL_C */
737
738 EXTERN T_RA_DATA *ra_data;
739
740 EXTERN T_HANDLE ra_handle;
741 EXTERN T_HANDLE hCommMMI; /* MMI Communication */
742 EXTERN T_HANDLE hCommTRA; /* Transp. Communication */
743 EXTERN T_HANDLE hCommRLP; /* RLP Communication */
744 #ifdef FF_FAX
745 EXTERN T_HANDLE hCommFAD; /* FAD Communication */
746 #endif
747
748 #ifdef HO_WORKAROUND
749 EXTERN USHORT _act_d_ra_conf;
750 #endif
751
752 #endif /* !RA_DLL_C */
753
754 /*
755 * function prototypes for process TRA
756 */
757
758 #ifdef OPTION_MULTITHREAD
759 #define tra_init _ENTITY_PREFIXED(tra_init)
760 #define tra_idle _ENTITY_PREFIXED(tra_idle)
761 #define tra_ul_null _ENTITY_PREFIXED(tra_ul_null)
762 #define tra_ul_init_l1 _ENTITY_PREFIXED(tra_ul_init_l1)
763 #define tra_dl_sync_tch_start _ENTITY_PREFIXED(tra_dl_sync_tch_start)
764 #define tra_ul_sync_tch_found _ENTITY_PREFIXED(tra_ul_sync_tch_found)
765 #define tra_dl_wait_sync_lost _ENTITY_PREFIXED(tra_dl_wait_sync_lost)
766 #define tra_dl_wait_for_connect _ENTITY_PREFIXED(tra_dl_wait_for_connect)
767 #define tra_dl_wait_for_uart _ENTITY_PREFIXED(tra_dl_wait_for_uart)
768 #define tra_dl_got_uart _ENTITY_PREFIXED(tra_dl_got_uart)
769 #define tra_ul_data_trans _ENTITY_PREFIXED(tra_ul_data_trans)
770 #define tra_dl_data_trans _ENTITY_PREFIXED(tra_dl_data_trans)
771 #endif
772
773 EXTERN void tra_init(UBYTE);
774 EXTERN void tra_idle(void);
775 EXTERN void tra_ul_null(void);
776 EXTERN void tra_ul_init_l1(void);
777 EXTERN void tra_dl_sync_tch_start(void);
778 EXTERN void tra_ul_data_trans(void);
779 EXTERN void tra_ul_sync_tch_found(void);
780 EXTERN void tra_dl_wait_sync_lost(void);
781 EXTERN void tra_dl_wait_for_connect(void);
782 EXTERN void tra_dl_wait_for_uart(void);
783 EXTERN void tra_dl_got_uart(void);
784 EXTERN void tra_dl_data_trans(void);
785
786 #ifdef FF_FAX
787 /*
788 * function prototypes for process FAX
789 */
790
791 #ifdef OPTION_MULTITHREAD
792 #define fax_init _ENTITY_PREFIXED(fax_init)
793 #define fax_idle _ENTITY_PREFIXED(fax_idle)
794 #define fax_ul_null _ENTITY_PREFIXED(fax_ul_null)
795 #define fax_ul_init_l1 _ENTITY_PREFIXED(fax_ul_init_l1)
796 #define fax_dl_sync_tch_start _ENTITY_PREFIXED(fax_dl_sync_tch_start)
797 #define fax_ul_sync_tch_found _ENTITY_PREFIXED(fax_ul_sync_tch_found)
798 #define fax_dl_wait_sync_lost _ENTITY_PREFIXED(fax_dl_wait_sync_lost)
799 #define fax_ul_data_trans _ENTITY_PREFIXED(fax_ul_data_trans)
800 #define fax_dl_data_trans _ENTITY_PREFIXED(fax_dl_data_trans)
801 #define fax_ul_modify _ENTITY_PREFIXED(fax_ul_modify)
802 #endif
803
804 EXTERN void fax_init(void);
805 EXTERN void fax_idle(void);
806 EXTERN void fax_ul_null(void);
807 EXTERN void fax_ul_init_l1(void);
808 EXTERN void fax_dl_sync_tch_start(void);
809 EXTERN void fax_ul_data_trans(void);
810 EXTERN void fax_ul_sync_tch_found(void);
811 EXTERN void fax_dl_wait_sync_lost(void);
812 EXTERN void fax_dl_data_trans(void);
813 EXTERN void fax_ul_modify(void);
814
815 #endif /* FF_FAX */
816
817 /*
818 * function prototypes for process RLP
819 */
820
821 #ifdef OPTION_MULTITHREAD
822 #define rlp_init _ENTITY_PREFIXED(rlp_init)
823 #define rlp_idle _ENTITY_PREFIXED(rlp_idle)
824 #define rlp_ul_null _ENTITY_PREFIXED(rlp_ul_null)
825 #define rlp_ul_init_l1 _ENTITY_PREFIXED(rlp_ul_init_l1)
826 #define rlp_ul_data_trans _ENTITY_PREFIXED(rlp_ul_data_trans)
827 #define rlp_dl_data_trans _ENTITY_PREFIXED(rlp_dl_data_trans)
828 #endif
829
830 EXTERN void rlp_init(void);
831 EXTERN void rlp_idle(void);
832 EXTERN void rlp_ul_null(void);
833 EXTERN void rlp_ul_init_l1(void);
834 EXTERN void rlp_ul_data_trans(void);
835 EXTERN void rlp_dl_data_trans(void);
836
837 /*
838 * macros for setting/getting the bitpattern values
839 * of the control words in the shared memory.
840 */
841
842 #define shm_get_dsp_value(var)\
843 (((*(ra_data->shm.shm_addr[adr_##var]+wof_##var)) & msk_##var) >> pos_##var)
844
845 #define shm_set_dsp_value(var,val)\
846 { USHORT sv = val;\
847 USHORT sc = ra_data->shm.shm_addr[adr_##var][wof_##var];\
848 sv <<= pos_##var;\
849 sv &= msk_##var;\
850 sc &= ~msk_##var;\
851 sc |= sv;\
852 ra_data->shm.shm_addr[adr_##var][wof_##var] = sc;}
853
854 EXTERN U16 shm_set_dsp_buffer(T_FRAME_DESC *data, USHORT *buffer, USHORT offs, USHORT free);
855 EXTERN U8 shm_set_dsp_buffer_new(T_FD *data, USHORT *buffer, U8 offs, U8 free);
856
857 EXTERN U16 shm_get_dsp_buffer(T_FRAME_DESC *data, USHORT *buffer, USHORT bytes_to_read);
858 EXTERN U8 shm_get_dsp_buffer_new(USHORT *buffer, U8 bytes_to_read, T_FD *pFD);
859
860 #ifdef _SIMULATION_
861 /*
862 * for layer 1 simulation only
863 *====================================================================
864 * Bitoffset for encoding/decoding
865 */
866 #define ENCODE_OFFSET 0
867
868 /*
869 * Dynamic Configuration Numbers
870 */
871 #define RA_CNF 9
872 #define RA_DEACT 10
873
874 #endif /* _SIMULATION_ */
875
876 /*
877 * L1 prototypes
878 */
879
880 EXTERN void l1i_ra_activate_cnf(void);
881 EXTERN void l1i_ra_data_ind(T_HANDLE);
882 EXTERN void l1i_ra_modify_cnf(void);
883 EXTERN void l1i_ra_ready_ind(T_HANDLE, UBYTE);
884 #ifndef HO_WORKAROUND
885 EXTERN void l1i_ra_break_ind(void);
886 #endif
887
888 /*
889 * DLL functions
890 */
891
892 EXTERN void dll_init(void);
893
894 EXTERN void dll_data_ul
895 (
896 USHORT *_ul_buffer_address,
897 USHORT *_d_ra_conf,
898 USHORT *_d_ra_act,
899 USHORT *_d_ra_test,
900 USHORT *_d_ra_statu,
901 USHORT *_d_fax
902 );
903
904 EXTERN void dll_data_dl
905 (
906 USHORT *_dl_buffer_address,
907 USHORT *_d_ra_act,
908 USHORT *_d_ra_statd
909 );
910
911 /*
912 * miscellaneous function prototypes
913 */
914 #ifdef OPTION_MULTITHREAD
915
916 #define TimeOut _ENTITY_PREFIXED(TimeOut)
917
918 #endif
919
920 EXTERN BOOL TimeOut(USHORT*);
921
922 #ifdef _TARGET_
923 /*lint -e752 : local declarator not referenced */
924 EXTERN T_FD *fad_rbm_get_next_FrameDesc(void); /* in entity FAD referenced */
925 EXTERN T_FD *tra_get_next_FrameDesc(void); /* in entity L2R referenced */
926 EXTERN void rlp_rbm_get_next_buffer(T_FRAME_DESC *frameDesc); /* in entity RLP referenced */
927 #endif
928
929 #endif /* RA_H */