comparison src/g23m-fad/t30/t30_kerf.c @ 174:90eb61ecd093

src/g23m-fad: initial import from TCS3.2/LoCosto
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 12 Oct 2016 05:40:46 +0000
parents
children
comparison
equal deleted inserted replaced
173:bf64d785238a 174:90eb61ecd093
1 /*
2 +-----------------------------------------------------------------------------
3 | Project : GSM-F&D (8411)
4 | Modul : t30_kerf
5 +-----------------------------------------------------------------------------
6 | Copyright 2002 Texas Instruments Berlin, AG
7 | All rights reserved.
8 |
9 | This file is confidential and a trade secret of Texas
10 | Instruments Berlin, AG
11 | The receipt of or possession of this file does not convey
12 | any rights to reproduce or disclose its contents or to
13 | manufacture, use, or sell anything it may describe, in
14 | whole, or in part, without the specific written consent of
15 | Texas Instruments Berlin, AG.
16 +-----------------------------------------------------------------------------
17 | Purpose : This Modul defines the procedures and functions for
18 | the component T30 of the mobile station
19 +-----------------------------------------------------------------------------
20 */
21
22 #ifndef T30_KERF_C
23 #define T30_KERF_C
24 #endif
25
26 #define ENTITY_T30
27
28 /*==== INCLUDES ===================================================*/
29
30 #include <string.h>
31 #include <stdlib.h>
32 #include <stddef.h>
33 #include "typedefs.h"
34 #include "pcm.h"
35 #include "vsi.h"
36 #include "macdef.h"
37 #include "pconst.cdg"
38 #include "mconst.cdg"
39 #include "message.h"
40 #include "ccdapi.h"
41 #include "custom.h"
42 #include "gsm.h"
43 #include "prim.h"
44 #include "cnf_t30.h"
45 #include "mon_t30.h"
46 #include "pei.h"
47 #include "tok.h"
48 #include "dti.h" /* functionality of the dti library */
49 #include "t30.h"
50
51 /*==== CONST =======================================================*/
52
53 /*==== TYPES =======================================================*/
54
55 /*==== VAR EXPORT ==================================================*/
56
57 /*==== VAR LOCAL ===================================================*/
58
59 /*==== FUNCTIONS ===================================================*/
60
61 /*
62 +--------------------------------------------------------------------+
63 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
64 | STATE : code ROUTINE : ker_init |
65 +--------------------------------------------------------------------+
66
67 PURPOSE : initialize kernel
68
69 */
70
71 GLOBAL void ker_init (T_T30_DATA *pt30_data)
72 {
73 TRACE_FUNCTION ("ker_init()");
74
75 memset (pt30_data, 0, sizeof (T_T30_DATA));
76 SET_STATE (KER, T30_NULL);
77 }
78
79 /*
80 +--------------------------------------------------------------------+
81 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
82 | STATE : code ROUTINE : ker_check_rtc |
83 +--------------------------------------------------------------------+
84
85 PURPOSE : This function scans the received fax data for RTC.
86
87 */
88
89 GLOBAL UBYTE ker_check_rtc (T_FAD_DATA_IND *fad_data_ind)
90 {
91 USHORT i;
92 UBYTE bit_ptr;
93
94 TRACE_FUNCTION ("ker_check_rtc()");
95
96 #ifdef _SIMULATION_ /* RTC checking OFF */
97 if (t30_data->test_mode & TST_RTC)
98 return RTC_NO;
99 #endif
100
101 if (fad_data_ind EQ NULL)
102 {
103 t30_data->rtc_zero = 0;
104 t30_data->rtc_eol = 0;
105 return RTC_NO;
106 }
107
108 for (i = 0 ; i < (fad_data_ind->sdu.l_buf >> 3); i++)
109 {
110 UBYTE ch = fad_data_ind->sdu.buf[i];
111 if (!ch)
112 {
113 t30_data->rtc_zero += 8;
114 continue;
115 }
116 bit_ptr = 0x80;
117 do
118 {
119 if (ch & bit_ptr)
120 {
121 if (t30_data->rtc_zero >= 11)
122 t30_data->eol++;
123
124 if (t30_data->rtc_zero EQ 11)
125 {
126 if (++t30_data->rtc_eol EQ 6)
127 {
128 t30_data->rtc_eol = 0;
129 t30_data->rtc_zero = 0;
130 t30_data->eol -= 5;
131 return RTC_YES;
132 }
133 }
134 else
135 {
136 if (t30_data->rtc_eol)
137 t30_data->rtc_eol = 0;
138 else if (t30_data->rtc_zero >= 11)
139 t30_data->rtc_eol++;
140 }
141 t30_data->rtc_zero = 0;
142 }
143 else
144 t30_data->rtc_zero++;
145
146 bit_ptr >>= 1;
147 }
148 while (bit_ptr);
149 }
150 return RTC_NO;
151 }
152
153 /*
154 +--------------------------------------------------------------------+
155 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
156 | STATE : code ROUTINE : ker_fill_dcs_cap0 |
157 +--------------------------------------------------------------------+
158
159 PURPOSE : This function prepares the mandatory fax capabilities.
160
161 */
162
163 LOCAL void ker_fill_dcs_cap0 (T_BCS_DCS *bcs_dcs)
164 {
165 #define X t30_data->hdlc_rcv.dcs
166 #define Y bcs_dcs->cap0_snd
167
168 TRACE_FUNCTION ("ker_fill_dcs_cap0()");
169
170 X.rec_fax_op = Y.rec_fax_op;
171 X.data_sig_rate = Y.data_sig_rate;
172 X.R8_lines_pels = Y.R8_lines_pels;
173 X.two_dim_coding = Y.two_dim_coding;
174 X.rec_width = Y.rec_width;
175 X.max_rec_len = Y.max_rec_len;
176 X.min_scan_time = Y.min_scan_time;
177
178 /*
179 t30_data->trans_rate = Y.data_sig_rate;
180 */
181 #undef X
182 #undef Y
183 }
184
185 /*
186 +--------------------------------------------------------------------+
187 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
188 | STATE : code ROUTINE : ker_fill_dcs_cap1 |
189 +--------------------------------------------------------------------+
190
191 PURPOSE : This function prepares the extended fax capabilities 1.
192
193 */
194
195 LOCAL void ker_fill_dcs_cap1 (T_BCS_DCS *bcs_dcs)
196 {
197 #define X t30_data->hdlc_rcv.dcs
198 #define Y bcs_dcs->cap1_snd
199
200 TRACE_FUNCTION ("ker_fill_dcs_cap1()");
201
202 if (bcs_dcs->v_cap1_snd)
203 {
204 X.uncomp_mode = Y.uncomp_mode;
205 X.err_corr_mode = Y.err_corr_mode;
206 X.frame_size = Y.frame_size;
207 X.t6_coding = Y.t6_coding;
208 }
209
210 #undef X
211 #undef Y
212 }
213
214 /*
215 +--------------------------------------------------------------------+
216 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
217 | STATE : code ROUTINE : ker_fill_dcs_cap2 |
218 +--------------------------------------------------------------------+
219
220 PURPOSE : This function prepares the extended fax capabilities 2.
221
222 */
223
224 LOCAL void ker_fill_dcs_cap2 (T_BCS_DCS *bcs_dcs)
225 {
226 #define X t30_data->hdlc_rcv.dcs
227 #define Y bcs_dcs->cap2_snd
228
229 TRACE_FUNCTION ("ker_fill_dcs_cap2()");
230
231 if (bcs_dcs->v_cap2_snd)
232 {
233 /* for future use */
234 }
235
236 #undef X
237 #undef Y
238 }
239
240 /*
241 +--------------------------------------------------------------------+
242 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
243 | STATE : code ROUTINE : ker_fill_dcs_cap3 |
244 +--------------------------------------------------------------------+
245
246 PURPOSE : This function prepares the extended fax capabilities 3.
247
248 */
249
250 LOCAL void ker_fill_dcs_cap3 (T_BCS_DCS *bcs_dcs)
251 {
252 #define X t30_data->hdlc_rcv.dcs
253 #define Y bcs_dcs->cap3_snd
254
255 TRACE_FUNCTION ("ker_fill_dcs_cap3()");
256
257 if (bcs_dcs->v_cap3_snd)
258 {
259 X.R8_lines = Y.R8_lines;
260 X.r_300_pels = Y.r_300_pels;
261 X.R16_lines_pels = Y.R16_lines_pels;
262 X.resolution_type = Y.resolution_type;
263 }
264
265 #undef X
266 #undef Y
267 }
268
269 /*
270 +--------------------------------------------------------------------+
271 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
272 | STATE : code ROUTINE : ker_fill_dcs_cap4 |
273 +--------------------------------------------------------------------+
274
275 PURPOSE : This function prepares the extended fax capabilities 4.
276
277 */
278
279 LOCAL void ker_fill_dcs_cap4 (T_BCS_DCS *bcs_dcs)
280 {
281 #define X t30_data->hdlc_rcv.dcs
282 #define Y bcs_dcs->cap4_snd
283
284 TRACE_FUNCTION ("ker_fill_dcs_cap4()");
285
286 if (bcs_dcs->v_cap4_snd)
287 {
288 X.subaddr = Y.subaddr;
289 X.password = Y.password;
290 X.bft = Y.bft;
291 X.dtm = Y.dtm;
292 X.edi = Y.edi;
293 }
294
295 #undef X
296 #undef Y
297 }
298
299 /*
300 +--------------------------------------------------------------------+
301 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
302 | STATE : code ROUTINE : ker_fill_dcs_cap5 |
303 +--------------------------------------------------------------------+
304
305 PURPOSE : This function prepares the extended fax capabilities 5.
306
307 */
308
309 LOCAL void ker_fill_dcs_cap5 (T_BCS_DCS *bcs_dcs)
310 {
311 #define X t30_data->hdlc_rcv.dcs
312 #define Y bcs_dcs->cap5_snd
313
314 TRACE_FUNCTION ("ker_fill_dcs_cap5()");
315
316 if (bcs_dcs->v_cap5_snd)
317 {
318 X.btm = Y.btm;
319 X.char_mode = Y.char_mode;
320 X.mixed_mode = Y.mixed_mode;
321 }
322
323 #undef X
324 #undef Y
325 }
326
327 /*
328 +--------------------------------------------------------------------+
329 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
330 | STATE : code ROUTINE : ker_fill_dcs_cap6 |
331 +--------------------------------------------------------------------+
332
333 PURPOSE : This function prepares the extended fax capabilities 6.
334
335 */
336
337 LOCAL void ker_fill_dcs_cap6 (T_BCS_DCS *bcs_dcs)
338 {
339 #define X t30_data->hdlc_rcv.dcs
340 #define Y bcs_dcs->cap6_snd
341
342 TRACE_FUNCTION ("ker_fill_dcs_cap6()");
343
344 if (bcs_dcs->v_cap6_snd)
345 {
346 X.proc_mode_26 = Y.proc_mode_26;
347 X.dig_network_cap = Y.dig_network_cap;
348 X.duplex = Y.duplex;
349 X.jpeg = Y.jpeg;
350 X.full_colour = Y.full_colour;
351 X.huffman_tables = Y.huffman_tables;
352 X.r_12_bits_pel_comp = Y.r_12_bits_pel_comp;
353 }
354
355 #undef X
356 #undef Y
357 }
358
359 /*
360 +--------------------------------------------------------------------+
361 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
362 | STATE : code ROUTINE : ker_fill_dcs_cap7 |
363 +--------------------------------------------------------------------+
364
365 PURPOSE : This function prepares the extended fax capabilities 7.
366
367 */
368
369 LOCAL void ker_fill_dcs_cap7 (T_BCS_DCS *bcs_dcs)
370 {
371 #define X t30_data->hdlc_rcv.dcs
372 #define Y bcs_dcs->cap7_snd
373
374 TRACE_FUNCTION ("ker_fill_dcs_cap7()");
375
376 if (bcs_dcs->v_cap7_snd)
377 {
378 X.no_subsamp = Y.no_subsamp;
379 X.cust_illum = Y.cust_illum;
380 X.cust_gamut = Y.cust_gamut;
381 X.na_letter = Y.na_letter;
382 X.na_legal = Y.na_legal;
383 X.sing_prog_seq_coding_basic = Y.sing_prog_seq_coding_basic;
384 X.sing_prog_seq_coding_L0 = Y.sing_prog_seq_coding_L0;
385 }
386
387 #undef X
388 #undef Y
389 }
390
391 /*
392 +--------------------------------------------------------------------+
393 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
394 | STATE : code ROUTINE : ker_fill_dcs_info |
395 +--------------------------------------------------------------------+
396
397 PURPOSE : This function fills the hdlc-frame-buffer with the
398 received DCS-parameters.
399
400 */
401
402 GLOBAL void ker_fill_dcs_info (T_BCS_DCS *bcs_dcs)
403 {
404 TRACE_FUNCTION ("ker_fill_dcs_info()");
405
406 memset (&t30_data->hdlc_rcv.dcs, 0xFF,
407 sizeof (t30_data->hdlc_rcv.dcs));
408
409 t30_data->hdlc_rcv.v_dcs = 1;
410
411 ker_fill_dcs_cap0 (bcs_dcs);
412 ker_fill_dcs_cap1 (bcs_dcs);
413 ker_fill_dcs_cap2 (bcs_dcs);
414 ker_fill_dcs_cap3 (bcs_dcs);
415 ker_fill_dcs_cap4 (bcs_dcs);
416 ker_fill_dcs_cap5 (bcs_dcs);
417 ker_fill_dcs_cap6 (bcs_dcs);
418 ker_fill_dcs_cap7 (bcs_dcs);
419 }
420
421 /*
422 +--------------------------------------------------------------------+
423 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
424 | STATE : code ROUTINE : ker_fill_dis_cap0 |
425 +--------------------------------------------------------------------+
426
427 PURPOSE : This function prepares the mandatory fax capabilities.
428
429 */
430
431 LOCAL void ker_fill_dis_cap0 (T_BCS_DIS *bcs_dis)
432 {
433 #define X t30_data->hdlc_rcv.dis
434 #define Y bcs_dis->cap0_rcv
435
436 TRACE_FUNCTION ("ker_fill_dis_cap0()");
437
438 X.v8 = Y.v8;
439 X.n_byte = Y.n_byte;
440 X.ready_tx_fax = Y.ready_tx_fax;
441 X.rec_fax_op = Y.rec_fax_op;
442 X.data_sig_rate = Y.data_sig_rate;
443 X.R8_lines_pels = Y.R8_lines_pels;
444 X.two_dim_coding = Y.two_dim_coding;
445 X.rec_width = Y.rec_width;
446 X.max_rec_len = Y.max_rec_len;
447 X.min_scan_time = Y.min_scan_time;
448
449 /*
450 t30_data->trans_rate = Y.data_sig_rate;
451 */
452 #undef X
453 #undef Y
454 }
455
456 /*
457 +--------------------------------------------------------------------+
458 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
459 | STATE : code ROUTINE : ker_fill_dis_cap1 |
460 +--------------------------------------------------------------------+
461
462 PURPOSE : This function prepares the extended fax capabilities 1.
463
464 */
465
466 LOCAL void ker_fill_dis_cap1 (T_BCS_DIS *bcs_dis)
467 {
468 #define X t30_data->hdlc_rcv.dis
469 #define Y bcs_dis->cap1_rcv
470
471 TRACE_FUNCTION ("ker_fill_dis_cap1()");
472
473 if (bcs_dis->v_cap1_rcv)
474 {
475 X.uncomp_mode = Y.uncomp_mode;
476 X.err_corr_mode = Y.err_corr_mode;
477 X.t6_coding = Y.t6_coding;
478 }
479
480 #undef X
481 #undef Y
482 }
483
484 /*
485 +--------------------------------------------------------------------+
486 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
487 | STATE : code ROUTINE : ker_fill_dis_cap2 |
488 +--------------------------------------------------------------------+
489
490 PURPOSE : This function prepares the extended fax capabilities 2.
491
492 */
493
494 LOCAL void ker_fill_dis_cap2 (T_BCS_DIS *bcs_dis)
495 {
496 #define X t30_data->hdlc_rcv.dis
497 #define Y bcs_dis->cap2_rcv
498
499 TRACE_FUNCTION ("ker_fill_dis_cap2()");
500
501 if (bcs_dis->v_cap2_rcv)
502 {
503 /* for future use */
504 }
505
506 #undef X
507 #undef Y
508 }
509
510 /*
511 +--------------------------------------------------------------------+
512 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
513 | STATE : code ROUTINE : ker_fill_dis_cap3 |
514 +--------------------------------------------------------------------+
515
516 PURPOSE : This function prepares the extended fax capabilities 3.
517
518 */
519
520 LOCAL void ker_fill_dis_cap3 (T_BCS_DIS *bcs_dis)
521 {
522 #define X t30_data->hdlc_rcv.dis
523 #define Y bcs_dis->cap3_rcv
524
525 TRACE_FUNCTION ("ker_fill_dis_cap3()");
526
527 if (bcs_dis->v_cap3_rcv)
528 {
529 X.R8_lines = Y.R8_lines;
530 X.r_300_pels = Y.r_300_pels;
531 X.R16_lines_pels = Y.R16_lines_pels;
532 X.i_res_pref = Y.i_res_pref;
533 X.m_res_pref = Y.m_res_pref;
534 X.min_scan_time_hr = Y.min_scan_time_hr;
535 X.sel_polling = Y.sel_polling;
536 }
537
538 #undef X
539 #undef Y
540 }
541
542 /*
543 +--------------------------------------------------------------------+
544 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
545 | STATE : code ROUTINE : ker_fill_dis_cap4 |
546 +--------------------------------------------------------------------+
547
548 PURPOSE : This function prepares the extended fax capabilities 4.
549
550 */
551
552 LOCAL void ker_fill_dis_cap4 (T_BCS_DIS *bcs_dis)
553 {
554 #define X t30_data->hdlc_rcv.dis
555 #define Y bcs_dis->cap4_rcv
556
557 TRACE_FUNCTION ("ker_fill_dis_cap4()");
558
559 if (bcs_dis->v_cap4_rcv)
560 {
561 X.subaddr = Y.subaddr;
562 X.password = Y.password;
563 X.ready_tx_doc = Y.ready_tx_doc;
564 X.bft = Y.bft;
565 X.dtm = Y.dtm;
566 X.edi = Y.edi;
567 }
568
569 #undef X
570 #undef Y
571 }
572
573 /*
574 +--------------------------------------------------------------------+
575 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
576 | STATE : code ROUTINE : ker_fill_dis_cap5 |
577 +--------------------------------------------------------------------+
578
579 PURPOSE : This function prepares the extended fax capabilities 5.
580
581 */
582
583 LOCAL void ker_fill_dis_cap5 (T_BCS_DIS *bcs_dis)
584 {
585 #define X t30_data->hdlc_rcv.dis
586 #define Y bcs_dis->cap5_rcv
587
588 TRACE_FUNCTION ("ker_fill_dis_cap5()");
589
590 if (bcs_dis->v_cap5_rcv)
591 {
592 X.btm = Y.btm;
593 X.ready_tx_mixed = Y.ready_tx_mixed;
594 X.char_mode = Y.char_mode;
595 X.mixed_mode = Y.mixed_mode;
596 }
597
598 #undef X
599 #undef Y
600 }
601
602 /*
603 +--------------------------------------------------------------------+
604 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
605 | STATE : code ROUTINE : ker_fill_dis_cap6 |
606 +--------------------------------------------------------------------+
607
608 PURPOSE : This function prepares the extended fax capabilities 6.
609
610 */
611
612 LOCAL void ker_fill_dis_cap6 (T_BCS_DIS *bcs_dis)
613 {
614 #define X t30_data->hdlc_rcv.dis
615 #define Y bcs_dis->cap6_rcv
616
617 TRACE_FUNCTION ("ker_fill_dis_cap6()");
618
619 if (bcs_dis->v_cap6_rcv)
620 {
621 X.proc_mode_26 = Y.proc_mode_26;
622 X.dig_network_cap = Y.dig_network_cap;
623 X.duplex = Y.duplex;
624 X.jpeg = Y.jpeg;
625 X.full_colour = Y.full_colour;
626 X.r_12_bits_pel_comp = Y.r_12_bits_pel_comp;
627 }
628
629 #undef X
630 #undef Y
631 }
632
633 /*
634 +--------------------------------------------------------------------+
635 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
636 | STATE : code ROUTINE : ker_fill_dis_cap7 |
637 +--------------------------------------------------------------------+
638
639 PURPOSE : This function prepares the extended fax capabilities 7.
640
641 */
642
643 LOCAL void ker_fill_dis_cap7 (T_BCS_DIS *bcs_dis)
644 {
645 #define X t30_data->hdlc_rcv.dis
646 #define Y bcs_dis->cap7_rcv
647
648 TRACE_FUNCTION ("ker_fill_dis_cap7()");
649
650 if (bcs_dis->v_cap7_rcv)
651 {
652 X.no_subsamp = Y.no_subsamp;
653 X.cust_illum = Y.cust_illum;
654 X.cust_gamut = Y.cust_gamut;
655 X.na_letter = Y.na_letter;
656 X.na_legal = Y.na_legal;
657 X.sing_prog_seq_coding_basic = Y.sing_prog_seq_coding_basic;
658 X.sing_prog_seq_coding_L0 = Y.sing_prog_seq_coding_L0;
659 }
660
661 #undef X
662 #undef Y
663 }
664
665 /*
666 +--------------------------------------------------------------------+
667 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
668 | STATE : code ROUTINE : ker_fill_dis_info |
669 +--------------------------------------------------------------------+
670
671 PURPOSE : This function fills the hdlc-frame-buffer with the
672 received DIS-parameters.
673
674 */
675
676 GLOBAL void ker_fill_dis_info (T_BCS_DIS *bcs_dis)
677 {
678 TRACE_FUNCTION ("ker_fill_dis_info()");
679
680 memset (&t30_data->hdlc_rcv.dis, 0xFF,
681 sizeof (t30_data->hdlc_rcv.dis));
682
683 t30_data->hdlc_rcv.v_dis = 1;
684
685 ker_fill_dis_cap0 (bcs_dis);
686 ker_fill_dis_cap1 (bcs_dis);
687 ker_fill_dis_cap2 (bcs_dis);
688 ker_fill_dis_cap3 (bcs_dis);
689 ker_fill_dis_cap4 (bcs_dis);
690 ker_fill_dis_cap5 (bcs_dis);
691 ker_fill_dis_cap6 (bcs_dis);
692 ker_fill_dis_cap7 (bcs_dis);
693 }
694
695 /*
696 +--------------------------------------------------------------------+
697 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
698 | STATE : code ROUTINE : ker_fill_dtc_cap0 |
699 +--------------------------------------------------------------------+
700
701 PURPOSE : This function prepares the mandatory fax capabilities.
702
703 */
704
705 LOCAL void ker_fill_dtc_cap0 (T_BCS_DTC *bcs_dtc)
706 {
707 #define X t30_data->hdlc_rcv.dtc
708 #define Y bcs_dtc->cap0_rcv
709
710 TRACE_FUNCTION ("ker_fill_dtc_cap0()");
711
712 X.v8 = Y.v8;
713 X.n_byte = Y.n_byte;
714 X.ready_tx_fax = Y.ready_tx_fax;
715 X.rec_fax_op = Y.rec_fax_op;
716 X.data_sig_rate = Y.data_sig_rate;
717 X.R8_lines_pels = Y.R8_lines_pels;
718 X.two_dim_coding = Y.two_dim_coding;
719 X.rec_width = Y.rec_width;
720 X.max_rec_len = Y.max_rec_len;
721 X.min_scan_time = Y.min_scan_time;
722
723 /*
724 t30_data->trans_rate = Y.data_sig_rate;
725 */
726 #undef X
727 #undef Y
728 }
729
730 /*
731 +--------------------------------------------------------------------+
732 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
733 | STATE : code ROUTINE : ker_fill_dtc_cap1 |
734 +--------------------------------------------------------------------+
735
736 PURPOSE : This function prepares the extended fax capabilities 1.
737
738 */
739
740 LOCAL void ker_fill_dtc_cap1 (T_BCS_DTC *bcs_dtc)
741 {
742 #define X t30_data->hdlc_rcv.dtc
743 #define Y bcs_dtc->cap1_rcv
744
745 TRACE_FUNCTION ("ker_fill_dtc_cap1()");
746
747 if (bcs_dtc->v_cap1_rcv)
748 {
749 X.uncomp_mode = Y.uncomp_mode;
750 X.err_corr_mode = Y.err_corr_mode;
751 X.t6_coding = Y.t6_coding;
752 }
753
754 #undef X
755 #undef Y
756 }
757
758 /*
759 +--------------------------------------------------------------------+
760 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
761 | STATE : code ROUTINE : ker_fill_dtc_cap2 |
762 +--------------------------------------------------------------------+
763
764 PURPOSE : This function prepares the extended fax capabilities 2.
765
766 */
767
768 LOCAL void ker_fill_dtc_cap2 (T_BCS_DTC *bcs_dtc)
769 {
770 #define X t30_data->hdlc_rcv.dtc
771 #define Y bcs_dtc->cap2_rcv
772
773 TRACE_FUNCTION ("ker_fill_dtc_cap2()");
774
775 if (bcs_dtc->v_cap2_rcv)
776 {
777 /* for future use */
778 }
779
780 #undef X
781 #undef Y
782 }
783
784 /*
785 +--------------------------------------------------------------------+
786 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
787 | STATE : code ROUTINE : ker_fill_dtc_cap3 |
788 +--------------------------------------------------------------------+
789
790 PURPOSE : This function prepares the extended fax capabilities 3.
791
792 */
793
794 LOCAL void ker_fill_dtc_cap3 (T_BCS_DTC *bcs_dtc)
795 {
796 #define X t30_data->hdlc_rcv.dtc
797 #define Y bcs_dtc->cap3_rcv
798
799 TRACE_FUNCTION ("ker_fill_dtc_cap3()");
800
801 if (bcs_dtc->v_cap3_rcv)
802 {
803 X.R8_lines = Y.R8_lines;
804 X.r_300_pels = Y.r_300_pels;
805 X.R16_lines_pels = Y.R16_lines_pels;
806 X.i_res_pref = Y.i_res_pref;
807 X.m_res_pref = Y.m_res_pref;
808 X.min_scan_time_hr = Y.min_scan_time_hr;
809 X.sel_polling = Y.sel_polling;
810 }
811
812 #undef X
813 #undef Y
814 }
815
816 /*
817 +--------------------------------------------------------------------+
818 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
819 | STATE : code ROUTINE : ker_fill_dtc_cap4 |
820 +--------------------------------------------------------------------+
821
822 PURPOSE : This function prepares the extended fax capabilities 4.
823
824 */
825
826 LOCAL void ker_fill_dtc_cap4 (T_BCS_DTC *bcs_dtc)
827 {
828 #define X t30_data->hdlc_rcv.dtc
829 #define Y bcs_dtc->cap4_rcv
830
831 TRACE_FUNCTION ("ker_fill_dtc_cap4()");
832
833 if (bcs_dtc->v_cap4_rcv)
834 {
835 X.subaddr = Y.subaddr;
836 X.password = Y.password;
837 X.ready_tx_doc = Y.ready_tx_doc;
838 X.bft = Y.bft;
839 X.dtm = Y.dtm;
840 X.edi = Y.edi;
841 }
842
843 #undef X
844 #undef Y
845 }
846
847 /*
848 +--------------------------------------------------------------------+
849 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
850 | STATE : code ROUTINE : ker_fill_dtc_cap5 |
851 +--------------------------------------------------------------------+
852
853 PURPOSE : This function prepares the extended fax capabilities 5.
854
855 */
856
857 LOCAL void ker_fill_dtc_cap5 (T_BCS_DTC *bcs_dtc)
858 {
859 #define X t30_data->hdlc_rcv.dtc
860 #define Y bcs_dtc->cap5_rcv
861
862 TRACE_FUNCTION ("ker_fill_dtc_cap5()");
863
864 if (bcs_dtc->v_cap5_rcv)
865 {
866 X.btm = Y.btm;
867 X.ready_tx_mixed = Y.ready_tx_mixed;
868 X.char_mode = Y.char_mode;
869 X.mixed_mode = Y.mixed_mode;
870 }
871
872 #undef X
873 #undef Y
874 }
875
876 /*
877 +--------------------------------------------------------------------+
878 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
879 | STATE : code ROUTINE : ker_fill_dtc_cap6 |
880 +--------------------------------------------------------------------+
881
882 PURPOSE : This function prepares the extended fax capabilities 6.
883
884 */
885
886 LOCAL void ker_fill_dtc_cap6 (T_BCS_DTC *bcs_dtc)
887 {
888 #define X t30_data->hdlc_rcv.dtc
889 #define Y bcs_dtc->cap6_rcv
890
891 TRACE_FUNCTION ("ker_fill_dtc_cap6()");
892
893 if (bcs_dtc->v_cap6_rcv)
894 {
895 X.proc_mode_26 = Y.proc_mode_26;
896 X.dig_network_cap = Y.dig_network_cap;
897 X.duplex = Y.duplex;
898 X.jpeg = Y.jpeg;
899 X.full_colour = Y.full_colour;
900 X.r_12_bits_pel_comp = Y.r_12_bits_pel_comp;
901 }
902
903 #undef X
904 #undef Y
905 }
906
907 /*
908 +--------------------------------------------------------------------+
909 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
910 | STATE : code ROUTINE : ker_fill_dtc_cap7 |
911 +--------------------------------------------------------------------+
912
913 PURPOSE : This function prepares the extended fax capabilities 7.
914
915 */
916
917 LOCAL void ker_fill_dtc_cap7 (T_BCS_DTC *bcs_dtc)
918 {
919 #define X t30_data->hdlc_rcv.dtc
920 #define Y bcs_dtc->cap7_rcv
921
922 TRACE_FUNCTION ("ker_fill_dtc_cap7()");
923
924 if (bcs_dtc->v_cap7_rcv)
925 {
926 X.no_subsamp = Y.no_subsamp;
927 X.cust_illum = Y.cust_illum;
928 X.cust_gamut = Y.cust_gamut;
929 X.na_letter = Y.na_letter;
930 X.na_legal = Y.na_legal;
931 X.sing_prog_seq_coding_basic = Y.sing_prog_seq_coding_basic;
932 X.sing_prog_seq_coding_L0 = Y.sing_prog_seq_coding_L0;
933 }
934
935 #undef X
936 #undef Y
937 }
938
939 /*
940 +--------------------------------------------------------------------+
941 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
942 | STATE : code ROUTINE : ker_fill_dtc_info |
943 +--------------------------------------------------------------------+
944
945 PURPOSE : This function fills the hdlc-frame-buffer with the
946 received DTC-parameters.
947
948 */
949
950 GLOBAL void ker_fill_dtc_info (T_BCS_DTC *bcs_dtc)
951 {
952 TRACE_FUNCTION ("ker_fill_dtc_info()");
953
954 memset (&t30_data->hdlc_rcv.dtc, 0xFF,
955 sizeof (t30_data->hdlc_rcv.dtc));
956
957 t30_data->hdlc_rcv.v_dtc = 1;
958
959 ker_fill_dtc_cap0 (bcs_dtc);
960 ker_fill_dtc_cap1 (bcs_dtc);
961 ker_fill_dtc_cap2 (bcs_dtc);
962 ker_fill_dtc_cap3 (bcs_dtc);
963 ker_fill_dtc_cap4 (bcs_dtc);
964 ker_fill_dtc_cap5 (bcs_dtc);
965 ker_fill_dtc_cap6 (bcs_dtc);
966 ker_fill_dtc_cap7 (bcs_dtc);
967 }
968
969 /*
970 +--------------------------------------------------------------------+
971 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
972 | STATE : code ROUTINE : ker_prep_dcs_cap0 |
973 +--------------------------------------------------------------------+
974
975 PURPOSE : This function prepares the mandatory fax capabilities.
976
977 */
978
979 LOCAL void ker_prep_dcs_cap0 (T_T30_CAP_REQ *t30_cap_req,
980 T_BCS_DCS *bcs_dcs)
981 {
982 #define X bcs_dcs->cap0_snd
983 #define Y t30_cap_req->hdlc_info.dcs
984
985 TRACE_FUNCTION ("ker_prep_dcs_cap0()");
986
987 X.rec_fax_op = Y.rec_fax_op;
988 X.data_sig_rate = Y.data_sig_rate;
989 X.R8_lines_pels = Y.R8_lines_pels;
990 X.two_dim_coding = Y.two_dim_coding;
991 X.rec_width = Y.rec_width;
992 X.max_rec_len = Y.max_rec_len;
993 X.min_scan_time = Y.min_scan_time;
994
995 /*
996 t30_data->trans_rate = Y.data_sig_rate;
997 */
998 #undef X
999 #undef Y
1000 }
1001
1002 /*
1003 +--------------------------------------------------------------------+
1004 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
1005 | STATE : code ROUTINE : ker_prep_dcs_cap1 |
1006 +--------------------------------------------------------------------+
1007
1008 PURPOSE : This function prepares the extended fax capabilities 1.
1009
1010 */
1011
1012 LOCAL void ker_prep_dcs_cap1 (T_T30_CAP_REQ *t30_cap_req,
1013 T_BCS_DCS *bcs_dcs)
1014 {
1015 #define X bcs_dcs->cap1_snd
1016 #define Y t30_cap_req->hdlc_info.dcs
1017
1018 TRACE_FUNCTION ("ker_prep_dcs_cap1()");
1019
1020 if (Y.uncomp_mode != 0xFF)
1021 {
1022 bcs_dcs->v_cap1_snd = TRUE;
1023
1024 X.uncomp_mode = Y.uncomp_mode;
1025 X.err_corr_mode = Y.err_corr_mode;
1026 X.frame_size = Y.frame_size;
1027 X.t6_coding = Y.t6_coding;
1028 }
1029 else
1030 bcs_dcs->v_cap1_snd = FALSE;
1031
1032 #undef X
1033 #undef Y
1034 }
1035
1036 #ifdef EXTENDED_FAX_CAP2
1037 /*
1038 +--------------------------------------------------------------------+
1039 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
1040 | STATE : code ROUTINE : ker_prep_dcs_cap2 |
1041 +--------------------------------------------------------------------+
1042
1043 PURPOSE : This function prepares the extended fax capabilities 2.
1044
1045 */
1046
1047 LOCAL void ker_prep_dcs_cap2 (T_T30_CAP_REQ *t30_cap_req,
1048 T_BCS_DCS *bcs_dcs)
1049 {
1050 #define X bcs_dcs->cap2_snd
1051 #define Y t30_cap_req->hdlc_info.dcs
1052
1053 TRACE_FUNCTION ("ker_prep_dcs_cap2()");
1054
1055 if (1) /* for future use */
1056 {
1057 bcs_dcs->v_cap2_snd = TRUE;
1058 }
1059 else
1060 bcs_dcs->v_cap2_snd = FALSE;
1061
1062 #undef X
1063 #undef Y
1064 }
1065 #endif
1066
1067 /*
1068 +--------------------------------------------------------------------+
1069 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
1070 | STATE : code ROUTINE : ker_prep_dcs_cap3 |
1071 +--------------------------------------------------------------------+
1072
1073 PURPOSE : This function prepares the extended fax capabilities 3.
1074
1075 */
1076
1077 LOCAL void ker_prep_dcs_cap3 (T_T30_CAP_REQ *t30_cap_req,
1078 T_BCS_DCS *bcs_dcs)
1079 {
1080 #define X bcs_dcs->cap3_snd
1081 #define Y t30_cap_req->hdlc_info.dcs
1082
1083 TRACE_FUNCTION ("ker_prep_dcs_cap3()");
1084
1085 if (Y.R8_lines != 0xFF)
1086 {
1087 bcs_dcs->v_cap3_snd = TRUE;
1088
1089 X.R8_lines = Y.R8_lines;
1090 X.r_300_pels = Y.r_300_pels;
1091 X.R16_lines_pels = Y.R16_lines_pels;
1092 X.resolution_type = Y.resolution_type;
1093 }
1094 else
1095 bcs_dcs->v_cap3_snd = FALSE;
1096
1097 #undef X
1098 #undef Y
1099 }
1100
1101 /*
1102 +--------------------------------------------------------------------+
1103 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
1104 | STATE : code ROUTINE : ker_prep_dcs_cap4 |
1105 +--------------------------------------------------------------------+
1106
1107 PURPOSE : This function prepares the extended fax capabilities 4.
1108
1109 */
1110
1111 LOCAL void ker_prep_dcs_cap4 (T_T30_CAP_REQ *t30_cap_req,
1112 T_BCS_DCS *bcs_dcs)
1113 {
1114 #define X bcs_dcs->cap4_snd
1115 #define Y t30_cap_req->hdlc_info.dcs
1116
1117 TRACE_FUNCTION ("ker_prep_dcs_cap4()");
1118
1119 if (Y.subaddr != 0xFF)
1120 {
1121 bcs_dcs->v_cap4_snd = TRUE;
1122
1123 X.subaddr = Y.subaddr;
1124 X.password = Y.password;
1125 X.bft = Y.bft;
1126 X.dtm = Y.dtm;
1127 X.edi = Y.edi;
1128 }
1129 else
1130 bcs_dcs->v_cap4_snd = FALSE;
1131
1132 #undef X
1133 #undef Y
1134 }
1135
1136 /*
1137 +--------------------------------------------------------------------+
1138 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
1139 | STATE : code ROUTINE : ker_prep_dcs_cap5 |
1140 +--------------------------------------------------------------------+
1141
1142 PURPOSE : This function prepares the extended fax capabilities 5.
1143
1144 */
1145
1146 LOCAL void ker_prep_dcs_cap5 (T_T30_CAP_REQ *t30_cap_req,
1147 T_BCS_DCS *bcs_dcs)
1148 {
1149 #define X bcs_dcs->cap5_snd
1150 #define Y t30_cap_req->hdlc_info.dcs
1151
1152 TRACE_FUNCTION ("ker_prep_dcs_cap5()");
1153
1154 if (Y.btm != 0xFF)
1155 {
1156 bcs_dcs->v_cap5_snd = TRUE;
1157
1158 X.btm = Y.btm;
1159 X.char_mode = Y.char_mode;
1160 X.mixed_mode = Y.mixed_mode;
1161 }
1162 else
1163 bcs_dcs->v_cap5_snd = FALSE;
1164
1165 #undef X
1166 #undef Y
1167 }
1168
1169 /*
1170 +--------------------------------------------------------------------+
1171 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
1172 | STATE : code ROUTINE : ker_prep_dcs_cap6 |
1173 +--------------------------------------------------------------------+
1174
1175 PURPOSE : This function prepares the extended fax capabilities 6.
1176
1177 */
1178
1179 LOCAL void ker_prep_dcs_cap6 (T_T30_CAP_REQ *t30_cap_req,
1180 T_BCS_DCS *bcs_dcs)
1181 {
1182 #define X bcs_dcs->cap6_snd
1183 #define Y t30_cap_req->hdlc_info.dcs
1184
1185 TRACE_FUNCTION ("ker_prep_dcs_cap6()");
1186
1187 if (Y.proc_mode_26 != 0xFF)
1188 {
1189 bcs_dcs->v_cap6_snd = TRUE;
1190
1191 X.proc_mode_26 = Y.proc_mode_26;
1192 X.dig_network_cap = Y.dig_network_cap;
1193 X.duplex = Y.duplex;
1194 X.jpeg = Y.jpeg;
1195 X.full_colour = Y.full_colour;
1196 X.huffman_tables = Y.huffman_tables;
1197 X.r_12_bits_pel_comp = Y.r_12_bits_pel_comp;
1198 }
1199 else
1200 bcs_dcs->v_cap6_snd = FALSE;
1201
1202 #undef X
1203 #undef Y
1204 }
1205
1206 /*
1207 +--------------------------------------------------------------------+
1208 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
1209 | STATE : code ROUTINE : ker_prep_dcs_cap7 |
1210 +--------------------------------------------------------------------+
1211
1212 PURPOSE : This function prepares the extended fax capabilities 7.
1213
1214 */
1215
1216 LOCAL void ker_prep_dcs_cap7 (T_T30_CAP_REQ *t30_cap_req,
1217 T_BCS_DCS *bcs_dcs)
1218 {
1219 #define X bcs_dcs->cap7_snd
1220 #define Y t30_cap_req->hdlc_info.dcs
1221
1222 TRACE_FUNCTION ("ker_prep_dcs_cap7()");
1223
1224 if (Y.no_subsamp != 0xFF)
1225 {
1226 bcs_dcs->v_cap7_snd = TRUE;
1227
1228 X.no_subsamp = Y.no_subsamp;
1229 X.cust_illum = Y.cust_illum;
1230 X.cust_gamut = Y.cust_gamut;
1231 X.na_letter = Y.na_letter;
1232 X.na_legal = Y.na_legal;
1233 X.sing_prog_seq_coding_basic = Y.sing_prog_seq_coding_basic;
1234 X.sing_prog_seq_coding_L0 = Y.sing_prog_seq_coding_L0;
1235 }
1236 else
1237 bcs_dcs->v_cap7_snd = FALSE;
1238
1239 #undef X
1240 #undef Y
1241 }
1242
1243 /*
1244 +--------------------------------------------------------------------+
1245 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
1246 | STATE : code ROUTINE : ker_prep_dcs |
1247 +--------------------------------------------------------------------+
1248
1249 PURPOSE : This function fills the hdlc-frame-buffer with the
1250 DCS-parameters to send.
1251
1252 */
1253
1254 LOCAL void ker_prep_dcs (T_T30_CAP_REQ *t30_cap_req,
1255 T_BCS_DCS *bcs_dcs)
1256 {
1257 TRACE_FUNCTION ("ker_prep_dcs()");
1258
1259 ker_prep_dcs_cap0 (t30_cap_req, bcs_dcs);
1260 ker_prep_dcs_cap1 (t30_cap_req, bcs_dcs);
1261
1262 #ifdef EXTENDED_FAX_CAP2
1263 ker_prep_dcs_cap2 (t30_cap_req, bcs_dcs);
1264 #endif
1265
1266 ker_prep_dcs_cap3 (t30_cap_req, bcs_dcs);
1267 ker_prep_dcs_cap4 (t30_cap_req, bcs_dcs);
1268 ker_prep_dcs_cap5 (t30_cap_req, bcs_dcs);
1269 ker_prep_dcs_cap6 (t30_cap_req, bcs_dcs);
1270 ker_prep_dcs_cap7 (t30_cap_req, bcs_dcs);
1271 }
1272
1273 /*
1274 +--------------------------------------------------------------------+
1275 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
1276 | STATE : code ROUTINE : ker_prep_dis_cap0 |
1277 +--------------------------------------------------------------------+
1278
1279 PURPOSE : This function prepares the mandatory fax capabilities.
1280
1281 */
1282
1283 LOCAL void ker_prep_dis_cap0 (T_BCS_DIS *bcs_dis)
1284 {
1285 #define X bcs_dis->cap0_rcv
1286 #define Y t30_data->hdlc_snd.dis
1287
1288 TRACE_FUNCTION ("ker_prep_dis_cap0()");
1289
1290 X.v8 = Y.v8;
1291 X.n_byte = Y.n_byte;
1292 X.ready_tx_fax = Y.ready_tx_fax;
1293 X.rec_fax_op = Y.rec_fax_op;
1294 X.data_sig_rate = Y.data_sig_rate;
1295 X.R8_lines_pels = Y.R8_lines_pels;
1296 X.two_dim_coding = Y.two_dim_coding;
1297 X.rec_width = Y.rec_width;
1298 X.max_rec_len = Y.max_rec_len;
1299 X.min_scan_time = Y.min_scan_time;
1300
1301 /*
1302 t30_data->trans_rate = Y.data_sig_rate;
1303 */
1304 #undef X
1305 #undef Y
1306 }
1307
1308 /*
1309 +--------------------------------------------------------------------+
1310 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
1311 | STATE : code ROUTINE : ker_prep_dis_cap1 |
1312 +--------------------------------------------------------------------+
1313
1314 PURPOSE : This function prepares the extended fax capabilities 1.
1315
1316 */
1317
1318 LOCAL void ker_prep_dis_cap1 (T_BCS_DIS *bcs_dis)
1319 {
1320 #define X bcs_dis->cap1_rcv
1321 #define Y t30_data->hdlc_snd.dis
1322
1323 TRACE_FUNCTION ("ker_prep_dis_cap1()");
1324
1325 if (Y.uncomp_mode != 0xFF)
1326 {
1327 bcs_dis->v_cap1_rcv = TRUE;
1328
1329 X.uncomp_mode = Y.uncomp_mode;
1330 X.err_corr_mode = Y.err_corr_mode;
1331 X.t6_coding = Y.t6_coding;
1332 }
1333 else
1334 bcs_dis->v_cap1_rcv = FALSE;
1335
1336 #undef X
1337 #undef Y
1338 }
1339
1340 #ifdef EXTENDED_FAX_CAP2
1341 /*
1342 +--------------------------------------------------------------------+
1343 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
1344 | STATE : code ROUTINE : ker_prep_dis_cap2 |
1345 +--------------------------------------------------------------------+
1346
1347 PURPOSE : This function prepares the extended fax capabilities 2.
1348
1349 */
1350
1351 LOCAL void ker_prep_dis_cap2 (T_BCS_DIS *bcs_dis)
1352 {
1353 #define X bcs_dis->cap2_rcv
1354 #define Y t30_data->hdlc_snd.dis
1355
1356 TRACE_FUNCTION ("ker_prep_dis_cap2()");
1357
1358 if (1) /* for future use */
1359 {
1360 bcs_dis->v_cap2_rcv = TRUE;
1361 }
1362 else
1363 bcs_dis->v_cap2_rcv = FALSE;
1364
1365 #undef X
1366 #undef Y
1367 }
1368 #endif
1369
1370 /*
1371 +--------------------------------------------------------------------+
1372 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
1373 | STATE : code ROUTINE : ker_prep_dis_cap3 |
1374 +--------------------------------------------------------------------+
1375
1376 PURPOSE : This function prepares the extended fax capabilities 3.
1377
1378 */
1379
1380 LOCAL void ker_prep_dis_cap3 (T_BCS_DIS *bcs_dis)
1381 {
1382 #define X bcs_dis->cap3_rcv
1383 #define Y t30_data->hdlc_snd.dis
1384
1385 TRACE_FUNCTION ("ker_prep_dis_cap3()");
1386
1387 if (Y.R8_lines != 0xFF)
1388 {
1389 bcs_dis->v_cap3_rcv = TRUE;
1390
1391 X.R8_lines = Y.R8_lines;
1392 X.r_300_pels = Y.r_300_pels;
1393 X.R16_lines_pels = Y.R16_lines_pels;
1394 X.i_res_pref = Y.i_res_pref;
1395 X.m_res_pref = Y.m_res_pref;
1396 X.min_scan_time_hr = Y.min_scan_time_hr;
1397 X.sel_polling = Y.sel_polling;
1398 }
1399 else
1400 bcs_dis->v_cap3_rcv = FALSE;
1401
1402 #undef X
1403 #undef Y
1404 }
1405
1406 /*
1407 +--------------------------------------------------------------------+
1408 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
1409 | STATE : code ROUTINE : ker_prep_dis_cap4 |
1410 +--------------------------------------------------------------------+
1411
1412 PURPOSE : This function prepares the extended fax capabilities 4.
1413
1414 */
1415
1416 LOCAL void ker_prep_dis_cap4 (T_BCS_DIS *bcs_dis)
1417 {
1418 #define X bcs_dis->cap4_rcv
1419 #define Y t30_data->hdlc_snd.dis
1420
1421 TRACE_FUNCTION ("ker_prep_dis_cap4()");
1422
1423 if (Y.subaddr != 0xFF)
1424 {
1425 bcs_dis->v_cap4_rcv = TRUE;
1426
1427 X.subaddr = Y.subaddr;
1428 X.password = Y.password;
1429 X.ready_tx_doc = Y.ready_tx_doc;
1430 X.bft = Y.bft;
1431 X.dtm = Y.dtm;
1432 X.edi = Y.edi;
1433 }
1434 else
1435 bcs_dis->v_cap4_rcv = FALSE;
1436
1437 #undef X
1438 #undef Y
1439 }
1440
1441 /*
1442 +--------------------------------------------------------------------+
1443 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
1444 | STATE : code ROUTINE : ker_prep_dis_cap5 |
1445 +--------------------------------------------------------------------+
1446
1447 PURPOSE : This function prepares the extended fax capabilities 5.
1448
1449 */
1450
1451 LOCAL void ker_prep_dis_cap5 (T_BCS_DIS *bcs_dis)
1452 {
1453 #define X bcs_dis->cap5_rcv
1454 #define Y t30_data->hdlc_snd.dis
1455
1456 TRACE_FUNCTION ("ker_prep_dis_cap5()");
1457
1458 if (Y.btm != 0xFF)
1459 {
1460 bcs_dis->v_cap5_rcv = TRUE;
1461
1462 X.btm = Y.btm;
1463 X.ready_tx_mixed = Y.ready_tx_mixed;
1464 X.char_mode = Y.char_mode;
1465 X.mixed_mode = Y.mixed_mode;
1466 }
1467 else
1468 bcs_dis->v_cap5_rcv = FALSE;
1469
1470 #undef X
1471 #undef Y
1472 }
1473
1474 /*
1475 +--------------------------------------------------------------------+
1476 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
1477 | STATE : code ROUTINE : ker_prep_dis_cap6 |
1478 +--------------------------------------------------------------------+
1479
1480 PURPOSE : This function prepares the extended fax capabilities 6.
1481
1482 */
1483
1484 LOCAL void ker_prep_dis_cap6 (T_BCS_DIS *bcs_dis)
1485 {
1486 #define X bcs_dis->cap6_rcv
1487 #define Y t30_data->hdlc_snd.dis
1488
1489 TRACE_FUNCTION ("ker_prep_dis_cap6()");
1490
1491 if (Y.proc_mode_26 != 0xFF)
1492 {
1493 bcs_dis->v_cap6_rcv = TRUE;
1494
1495 X.proc_mode_26 = Y.proc_mode_26;
1496 X.dig_network_cap = Y.dig_network_cap;
1497 X.duplex = Y.duplex;
1498 X.jpeg = Y.jpeg;
1499 X.full_colour = Y.full_colour;
1500 X.r_12_bits_pel_comp = Y.r_12_bits_pel_comp;
1501 }
1502 else
1503 bcs_dis->v_cap6_rcv = FALSE;
1504
1505 #undef X
1506 #undef Y
1507 }
1508
1509 /*
1510 +--------------------------------------------------------------------+
1511 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
1512 | STATE : code ROUTINE : ker_prep_dis_cap7 |
1513 +--------------------------------------------------------------------+
1514
1515 PURPOSE : This function prepares the extended fax capabilities 7.
1516
1517 */
1518
1519 LOCAL void ker_prep_dis_cap7 (T_BCS_DIS *bcs_dis)
1520 {
1521 #define X bcs_dis->cap7_rcv
1522 #define Y t30_data->hdlc_snd.dis
1523
1524 TRACE_FUNCTION ("ker_prep_dis_cap7()");
1525
1526 if (Y.no_subsamp != 0xFF)
1527 {
1528 bcs_dis->v_cap7_rcv = TRUE;
1529
1530 X.no_subsamp = Y.no_subsamp;
1531 X.cust_illum = Y.cust_illum;
1532 X.cust_gamut = Y.cust_gamut;
1533 X.na_letter = Y.na_letter;
1534 X.na_legal = Y.na_legal;
1535 X.sing_prog_seq_coding_basic = Y.sing_prog_seq_coding_basic;
1536 X.sing_prog_seq_coding_L0 = Y.sing_prog_seq_coding_L0;
1537 }
1538 else
1539 bcs_dis->v_cap7_rcv = FALSE;
1540
1541 #undef X
1542 #undef Y
1543 }
1544
1545 /*
1546 +--------------------------------------------------------------------+
1547 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
1548 | STATE : code ROUTINE : ker_prep_dis |
1549 +--------------------------------------------------------------------+
1550
1551 PURPOSE : This function fills the hdlc-frame-buffer with the
1552 DIS-parameters to send.
1553
1554 */
1555
1556 LOCAL void ker_prep_dis (T_BCS_DIS *bcs_dis)
1557 {
1558 TRACE_FUNCTION ("ker_prep_dis()");
1559
1560 ker_prep_dis_cap0 (bcs_dis);
1561 ker_prep_dis_cap1 (bcs_dis);
1562
1563 #ifdef EXTENDED_FAX_CAP2
1564 ker_prep_dis_cap2 (bcs_dis);
1565 #endif
1566
1567 ker_prep_dis_cap3 (bcs_dis);
1568 ker_prep_dis_cap4 (bcs_dis);
1569 ker_prep_dis_cap5 (bcs_dis);
1570 ker_prep_dis_cap6 (bcs_dis);
1571 ker_prep_dis_cap7 (bcs_dis);
1572 }
1573
1574 /*
1575 +--------------------------------------------------------------------+
1576 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
1577 | STATE : code ROUTINE : ker_prep_dtc_cap0 |
1578 +--------------------------------------------------------------------+
1579
1580 PURPOSE : This function prepares the mandatory fax capabilities.
1581
1582 */
1583
1584 LOCAL void ker_prep_dtc_cap0 (T_T30_CAP_REQ *t30_cap_req,
1585 T_BCS_DTC *bcs_dtc)
1586 {
1587 #define X bcs_dtc->cap0_rcv
1588 #define Y t30_cap_req->hdlc_info.dtc
1589
1590 TRACE_FUNCTION ("ker_prep_dtc_cap0()");
1591
1592 X.v8 = Y.v8;
1593 X.n_byte = Y.n_byte;
1594 X.ready_tx_fax = Y.ready_tx_fax;
1595 X.rec_fax_op = Y.rec_fax_op;
1596 X.data_sig_rate = Y.data_sig_rate;
1597 X.R8_lines_pels = Y.R8_lines_pels;
1598 X.two_dim_coding = Y.two_dim_coding;
1599 X.rec_width = Y.rec_width;
1600 X.max_rec_len = Y.max_rec_len;
1601 X.min_scan_time = Y.min_scan_time;
1602
1603 /*
1604 t30_data->trans_rate = Y.data_sig_rate;
1605 */
1606 #undef X
1607 #undef Y
1608 }
1609
1610 /*
1611 +--------------------------------------------------------------------+
1612 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
1613 | STATE : code ROUTINE : ker_prep_dtc_cap1 |
1614 +--------------------------------------------------------------------+
1615
1616 PURPOSE : This function prepares the extended fax capabilities 1.
1617
1618 */
1619
1620 LOCAL void ker_prep_dtc_cap1 (T_T30_CAP_REQ *t30_cap_req,
1621 T_BCS_DTC *bcs_dtc)
1622 {
1623 #define X bcs_dtc->cap1_rcv
1624 #define Y t30_cap_req->hdlc_info.dtc
1625
1626 TRACE_FUNCTION ("ker_prep_dtc_cap1()");
1627
1628 if (Y.uncomp_mode != 0xFF)
1629 {
1630 bcs_dtc->v_cap1_rcv = TRUE;
1631
1632 X.uncomp_mode = Y.uncomp_mode;
1633 X.err_corr_mode = Y.err_corr_mode;
1634 X.t6_coding = Y.t6_coding;
1635 }
1636 else
1637 bcs_dtc->v_cap1_rcv = FALSE;
1638
1639 #undef X
1640 #undef Y
1641 }
1642
1643 #ifdef EXTENDED_FAX_CAP2
1644 /*
1645 +--------------------------------------------------------------------+
1646 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
1647 | STATE : code ROUTINE : ker_prep_dtc_cap2 |
1648 +--------------------------------------------------------------------+
1649
1650 PURPOSE : This function prepares the extended fax capabilities 2.
1651
1652 */
1653
1654 LOCAL void ker_prep_dtc_cap2 (T_T30_CAP_REQ *t30_cap_req,
1655 T_BCS_DTC *bcs_dtc)
1656 {
1657 #define X bcs_dtc->cap2_rcv
1658 #define Y t30_cap_req->hdlc_info.dtc
1659
1660 TRACE_FUNCTION ("ker_prep_dtc_cap2()");
1661
1662 if (1) /* for future use */
1663 {
1664 bcs_dtc->v_cap2_rcv = TRUE;
1665 }
1666 else
1667 bcs_dtc->v_cap2_rcv = FALSE;
1668
1669 #undef X
1670 #undef Y
1671 }
1672 #endif
1673
1674 /*
1675 +--------------------------------------------------------------------+
1676 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
1677 | STATE : code ROUTINE : ker_prep_dtc_cap3 |
1678 +--------------------------------------------------------------------+
1679
1680 PURPOSE : This function prepares the extended fax capabilities 3.
1681
1682 */
1683
1684 LOCAL void ker_prep_dtc_cap3 (T_T30_CAP_REQ *t30_cap_req,
1685 T_BCS_DTC *bcs_dtc)
1686 {
1687 #define X bcs_dtc->cap3_rcv
1688 #define Y t30_cap_req->hdlc_info.dtc
1689
1690 TRACE_FUNCTION ("ker_prep_dtc_cap3()");
1691
1692 if (Y.R8_lines != 0xFF)
1693 {
1694 bcs_dtc->v_cap3_rcv = TRUE;
1695
1696 X.R8_lines = Y.R8_lines;
1697 X.r_300_pels = Y.r_300_pels;
1698 X.R16_lines_pels = Y.R16_lines_pels;
1699 X.i_res_pref = Y.i_res_pref;
1700 X.m_res_pref = Y.m_res_pref;
1701 X.min_scan_time_hr = Y.min_scan_time_hr;
1702 X.sel_polling = Y.sel_polling;
1703 }
1704 else
1705 bcs_dtc->v_cap3_rcv = FALSE;
1706
1707 #undef X
1708 #undef Y
1709 }
1710
1711 /*
1712 +--------------------------------------------------------------------+
1713 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
1714 | STATE : code ROUTINE : ker_prep_dtc_cap4 |
1715 +--------------------------------------------------------------------+
1716
1717 PURPOSE : This function prepares the extended fax capabilities 4.
1718
1719 */
1720
1721 LOCAL void ker_prep_dtc_cap4 (T_T30_CAP_REQ *t30_cap_req,
1722 T_BCS_DTC *bcs_dtc)
1723 {
1724 #define X bcs_dtc->cap4_rcv
1725 #define Y t30_cap_req->hdlc_info.dtc
1726
1727 TRACE_FUNCTION ("ker_prep_dtc_cap4()");
1728
1729 if (Y.subaddr != 0xFF)
1730 {
1731 bcs_dtc->v_cap4_rcv = TRUE;
1732
1733 X.subaddr = Y.subaddr;
1734 X.password = Y.password;
1735 X.ready_tx_doc = Y.ready_tx_doc;
1736 X.bft = Y.bft;
1737 X.dtm = Y.dtm;
1738 X.edi = Y.edi;
1739 }
1740 else
1741 bcs_dtc->v_cap4_rcv = FALSE;
1742
1743 #undef X
1744 #undef Y
1745 }
1746
1747 /*
1748 +--------------------------------------------------------------------+
1749 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
1750 | STATE : code ROUTINE : ker_prep_dtc_cap5 |
1751 +--------------------------------------------------------------------+
1752
1753 PURPOSE : This function prepares the extended fax capabilities 5.
1754
1755 */
1756
1757 LOCAL void ker_prep_dtc_cap5 (T_T30_CAP_REQ *t30_cap_req,
1758 T_BCS_DTC *bcs_dtc)
1759 {
1760 #define X bcs_dtc->cap5_rcv
1761 #define Y t30_cap_req->hdlc_info.dtc
1762
1763 TRACE_FUNCTION ("ker_prep_dtc_cap5()");
1764
1765 if (Y.btm != 0xFF)
1766 {
1767 bcs_dtc->v_cap5_rcv = TRUE;
1768
1769 X.btm = Y.btm;
1770 X.ready_tx_mixed = Y.ready_tx_mixed;
1771 X.char_mode = Y.char_mode;
1772 X.mixed_mode = Y.mixed_mode;
1773 }
1774 else
1775 bcs_dtc->v_cap5_rcv = FALSE;
1776
1777 #undef X
1778 #undef Y
1779 }
1780
1781 /*
1782 +--------------------------------------------------------------------+
1783 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
1784 | STATE : code ROUTINE : ker_prep_dtc_cap6 |
1785 +--------------------------------------------------------------------+
1786
1787 PURPOSE : This function prepares the extended fax capabilities 6.
1788
1789 */
1790
1791 LOCAL void ker_prep_dtc_cap6 (T_T30_CAP_REQ *t30_cap_req,
1792 T_BCS_DTC *bcs_dtc)
1793 {
1794 #define X bcs_dtc->cap6_rcv
1795 #define Y t30_cap_req->hdlc_info.dtc
1796
1797 TRACE_FUNCTION ("ker_prep_dtc_cap6()");
1798
1799 if (Y.proc_mode_26 != 0xFF)
1800 {
1801 bcs_dtc->v_cap6_rcv = TRUE;
1802
1803 X.proc_mode_26 = Y.proc_mode_26;
1804 X.dig_network_cap = Y.dig_network_cap;
1805 X.duplex = Y.duplex;
1806 X.jpeg = Y.jpeg;
1807 X.full_colour = Y.full_colour;
1808 X.r_12_bits_pel_comp = Y.r_12_bits_pel_comp;
1809 }
1810 else
1811 bcs_dtc->v_cap6_rcv = FALSE;
1812
1813 #undef X
1814 #undef Y
1815 }
1816
1817 /*
1818 +--------------------------------------------------------------------+
1819 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
1820 | STATE : code ROUTINE : ker_prep_dtc_cap7 |
1821 +--------------------------------------------------------------------+
1822
1823 PURPOSE : This function prepares the extended fax capabilities 7.
1824
1825 */
1826
1827 LOCAL void ker_prep_dtc_cap7 (T_T30_CAP_REQ *t30_cap_req,
1828 T_BCS_DTC *bcs_dtc)
1829 {
1830 #define X bcs_dtc->cap7_rcv
1831 #define Y t30_cap_req->hdlc_info.dtc
1832
1833 TRACE_FUNCTION ("ker_prep_dtc_cap7()");
1834
1835 if (Y.no_subsamp != 0xFF)
1836 {
1837 bcs_dtc->v_cap7_rcv = TRUE;
1838
1839 X.no_subsamp = Y.no_subsamp;
1840 X.cust_illum = Y.cust_illum;
1841 X.cust_gamut = Y.cust_gamut;
1842 X.na_letter = Y.na_letter;
1843 X.na_legal = Y.na_legal;
1844 X.sing_prog_seq_coding_basic = Y.sing_prog_seq_coding_basic;
1845 X.sing_prog_seq_coding_L0 = Y.sing_prog_seq_coding_L0;
1846 }
1847 else
1848 bcs_dtc->v_cap7_rcv = FALSE;
1849
1850 #undef X
1851 #undef Y
1852 }
1853
1854 /*
1855 +--------------------------------------------------------------------+
1856 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
1857 | STATE : code ROUTINE : ker_prep_dtc |
1858 +--------------------------------------------------------------------+
1859
1860 PURPOSE : This function fills the hdlc-frame-buffer with the
1861 DTC-parameters to send.
1862
1863 */
1864
1865 LOCAL void ker_prep_dtc (T_T30_CAP_REQ *t30_cap_req,
1866 T_BCS_DTC *bcs_dtc)
1867 {
1868 TRACE_FUNCTION ("ker_prep_dtc()");
1869
1870 ker_prep_dtc_cap0 (t30_cap_req, bcs_dtc);
1871 ker_prep_dtc_cap1 (t30_cap_req, bcs_dtc);
1872
1873 #ifdef EXTENDED_FAX_CAP2
1874 ker_prep_dtc_cap2 (t30_cap_req, bcs_dtc);
1875 #endif
1876
1877 ker_prep_dtc_cap3 (t30_cap_req, bcs_dtc);
1878 ker_prep_dtc_cap4 (t30_cap_req, bcs_dtc);
1879 ker_prep_dtc_cap5 (t30_cap_req, bcs_dtc);
1880 ker_prep_dtc_cap6 (t30_cap_req, bcs_dtc);
1881 ker_prep_dtc_cap7 (t30_cap_req, bcs_dtc);
1882 }
1883
1884 /*
1885 +--------------------------------------------------------------------+
1886 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
1887 | STATE : code ROUTINE : ker_req_csi |
1888 +--------------------------------------------------------------------+
1889
1890 PURPOSE : This function prepares the optional command CSI.
1891
1892 */
1893
1894 LOCAL void ker_req_csi (void)
1895 {
1896 MCAST (csi, BCS_CSI);
1897
1898 TRACE_FUNCTION ("ker_req_csi()");
1899
1900 if (t30_data->hdlc_snd.c_csi)
1901 {
1902 csi->fcf = BCS_CSI;
1903
1904 csi->c_cld_sub_nr = t30_data->hdlc_snd.c_csi;
1905
1906 memcpy (csi->cld_sub_nr, t30_data->hdlc_snd.csi,
1907 sizeof (t30_data->hdlc_snd.csi));
1908
1909 sig_ker_bcs_bdat_req (FINAL_NO);
1910 }
1911 }
1912
1913 /*
1914 +--------------------------------------------------------------------+
1915 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
1916 | STATE : code ROUTINE : ker_req_nsf |
1917 +--------------------------------------------------------------------+
1918
1919 PURPOSE : This function prepares the optional command NSF.
1920
1921 */
1922
1923 LOCAL void ker_req_nsf (void)
1924 {
1925 MCAST (nsf, BCS_NSF);
1926
1927 TRACE_FUNCTION ("ker_req_nsf()");
1928
1929 if (t30_data->hdlc_snd.c_nsf)
1930 {
1931 nsf->fcf = BCS_NSF;
1932
1933 nsf->non_std_fac.l_non_std_fac = t30_data->hdlc_snd.c_nsf << 3;
1934 nsf->non_std_fac.o_non_std_fac = 0;
1935
1936 memcpy (nsf->non_std_fac.b_non_std_fac, t30_data->hdlc_snd.nsf,
1937 sizeof (t30_data->hdlc_snd.nsf));
1938
1939 sig_ker_bcs_bdat_req (FINAL_NO);
1940 }
1941 }
1942
1943 /*
1944 +--------------------------------------------------------------------+
1945 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
1946 | STATE : code ROUTINE : ker_res_cig |
1947 +--------------------------------------------------------------------+
1948
1949 PURPOSE : This function prepares the optional command CIG.
1950
1951 */
1952
1953 LOCAL void ker_res_cig (T_T30_CAP_REQ *t30_cap_req)
1954 {
1955 MCAST (cig, BCS_CIG);
1956
1957 TRACE_FUNCTION ("ker_res_cig()");
1958
1959 if (t30_cap_req->hdlc_info.c_cig)
1960 {
1961 cig->fcf = BCS_CIG;
1962
1963 cig->c_clg_sub_nr = t30_cap_req->hdlc_info.c_cig;
1964
1965 memcpy (cig->clg_sub_nr, t30_cap_req->hdlc_info.cig,
1966 sizeof (t30_cap_req->hdlc_info.cig));
1967
1968 sig_ker_bcs_bdat_req (FINAL_NO);
1969 }
1970 }
1971
1972 /*
1973 +--------------------------------------------------------------------+
1974 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
1975 | STATE : code ROUTINE : ker_res_crp |
1976 +--------------------------------------------------------------------+
1977
1978 PURPOSE : This function prepares the optional command CRP.
1979
1980 */
1981
1982 LOCAL void ker_res_crp (T_T30_CAP_REQ *t30_cap_req)
1983 {
1984 MCAST (crp, BCS_CRP);
1985
1986 TRACE_FUNCTION ("ker_res_crp()");
1987
1988 if (t30_cap_req->hdlc_info.crp)
1989 {
1990 crp->fcf = BCS_CRP;
1991
1992 sig_ker_bcs_bdat_req (FINAL_NO);
1993 }
1994 }
1995
1996 /*
1997 +--------------------------------------------------------------------+
1998 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
1999 | STATE : code ROUTINE : ker_res_nsc |
2000 +--------------------------------------------------------------------+
2001
2002 PURPOSE : This function prepares the optional command NSC.
2003
2004 */
2005
2006 LOCAL void ker_res_nsc (T_T30_CAP_REQ *t30_cap_req)
2007 {
2008 MCAST (nsc, BCS_NSC);
2009
2010 TRACE_FUNCTION ("ker_res_nsc()");
2011
2012 if (t30_cap_req->hdlc_info.c_nsc)
2013 {
2014 nsc->fcf = BCS_NSC;
2015
2016 nsc->non_std_fac.l_non_std_fac = t30_cap_req->hdlc_info.c_nsc << 3;
2017 nsc->non_std_fac.o_non_std_fac = 0;
2018
2019 memcpy (nsc->non_std_fac.b_non_std_fac, t30_cap_req->hdlc_info.nsc,
2020 sizeof (t30_cap_req->hdlc_info.nsc));
2021
2022 sig_ker_bcs_bdat_req (FINAL_NO);
2023 }
2024 }
2025
2026 /*
2027 +--------------------------------------------------------------------+
2028 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
2029 | STATE : code ROUTINE : ker_res_nss |
2030 +--------------------------------------------------------------------+
2031
2032 PURPOSE : This function prepares the optional command NSS.
2033
2034 */
2035
2036 LOCAL void ker_res_nss (T_T30_CAP_REQ *t30_cap_req)
2037 {
2038 MCAST (nss, BCS_NSS);
2039
2040 TRACE_FUNCTION ("ker_res_nss()");
2041
2042 if (t30_cap_req->hdlc_info.c_nss)
2043 {
2044 nss->fcf = BCS_NSS;
2045
2046 nss->non_std_fac.l_non_std_fac = t30_cap_req->hdlc_info.c_nss << 3;
2047 nss->non_std_fac.o_non_std_fac = 0;
2048
2049 memcpy (nss->non_std_fac.b_non_std_fac, t30_cap_req->hdlc_info.nss,
2050 sizeof (t30_cap_req->hdlc_info.nss));
2051
2052 sig_ker_bcs_bdat_req (FINAL_NO);
2053 }
2054 }
2055
2056 /*
2057 +--------------------------------------------------------------------+
2058 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
2059 | STATE : code ROUTINE : ker_res_pwd_poll |
2060 +--------------------------------------------------------------------+
2061
2062 PURPOSE : This function prepares the optional command PWD_POLL.
2063
2064 */
2065
2066 LOCAL void ker_res_pwd_poll (T_T30_CAP_REQ *t30_cap_req)
2067 {
2068 MCAST (pwd, BCS_PWD_POLL);
2069
2070 TRACE_FUNCTION ("ker_res_pwd_poll()");
2071
2072 if (t30_cap_req->hdlc_info.c_pwd)
2073 {
2074 pwd->fcf = BCS_PWD_POLL;
2075
2076 pwd->c_pm_pword = t30_cap_req->hdlc_info.c_pwd;
2077
2078 memcpy (pwd->pm_pword, t30_cap_req->hdlc_info.pwd,
2079 sizeof (t30_cap_req->hdlc_info.pwd));
2080
2081 sig_ker_bcs_bdat_req (FINAL_NO);
2082 }
2083 }
2084
2085 /*
2086 +--------------------------------------------------------------------+
2087 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
2088 | STATE : code ROUTINE : ker_res_pwd_snd |
2089 +--------------------------------------------------------------------+
2090
2091 PURPOSE : This function prepares the optional command PWD_SND.
2092
2093 */
2094
2095 LOCAL void ker_res_pwd_snd (T_T30_CAP_REQ *t30_cap_req)
2096 {
2097 MCAST (pwd, BCS_PWD_SND);
2098
2099 TRACE_FUNCTION ("ker_res_pwd_snd()");
2100
2101 if (t30_cap_req->hdlc_info.c_pwd)
2102 {
2103 pwd->fcf = BCS_PWD_SND;
2104
2105 pwd->c_sm_pword = t30_cap_req->hdlc_info.c_pwd;
2106
2107 memcpy (pwd->sm_pword, t30_cap_req->hdlc_info.pwd,
2108 sizeof (t30_cap_req->hdlc_info.pwd));
2109
2110 sig_ker_bcs_bdat_req (FINAL_NO);
2111 }
2112 }
2113
2114 /*
2115 +--------------------------------------------------------------------+
2116 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
2117 | STATE : code ROUTINE : ker_res_sep |
2118 +--------------------------------------------------------------------+
2119
2120 PURPOSE : This function prepares the optional command SEP.
2121
2122 */
2123
2124 LOCAL void ker_res_sep (T_T30_CAP_REQ *t30_cap_req)
2125 {
2126 MCAST (sep, BCS_SEP);
2127
2128 TRACE_FUNCTION ("ker_res_sep()");
2129
2130 if (t30_cap_req->hdlc_info.c_sep)
2131 {
2132 sep->fcf = BCS_SEP;
2133
2134 sep->c_pm_sub_addr = t30_cap_req->hdlc_info.c_sep;
2135
2136 memcpy (sep->pm_sub_addr, t30_cap_req->hdlc_info.sep,
2137 sizeof (t30_cap_req->hdlc_info.sep));
2138
2139 sig_ker_bcs_bdat_req (FINAL_NO);
2140 }
2141 }
2142
2143 /*
2144 +--------------------------------------------------------------------+
2145 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
2146 | STATE : code ROUTINE : ker_res_sub |
2147 +--------------------------------------------------------------------+
2148
2149 PURPOSE : This function prepares the optional command SUB.
2150
2151 */
2152
2153 LOCAL void ker_res_sub (T_T30_CAP_REQ *t30_cap_req)
2154 {
2155 MCAST (sub, BCS_SUB);
2156
2157 TRACE_FUNCTION ("ker_res_sub()");
2158
2159 if (t30_cap_req->hdlc_info.c_sub)
2160 {
2161 sub->fcf = BCS_SUB;
2162
2163 sub->c_sub_addr = t30_cap_req->hdlc_info.c_sub;
2164
2165 memcpy (sub->sub_addr, t30_cap_req->hdlc_info.sub,
2166 sizeof (t30_cap_req->hdlc_info.sub));
2167
2168 sig_ker_bcs_bdat_req (FINAL_NO);
2169 }
2170 }
2171
2172 /*
2173 +--------------------------------------------------------------------+
2174 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
2175 | STATE : code ROUTINE : ker_res_tsi |
2176 +--------------------------------------------------------------------+
2177
2178 PURPOSE : This function prepares the optional command TSI.
2179
2180 */
2181
2182 LOCAL void ker_res_tsi (T_T30_CAP_REQ *t30_cap_req)
2183 {
2184 MCAST (tsi, BCS_TSI);
2185
2186 TRACE_FUNCTION ("ker_res_tsi()");
2187
2188 if (t30_cap_req->hdlc_info.c_tsi)
2189 {
2190 tsi->fcf = BCS_TSI;
2191
2192 tsi->c_tra_sub_nr = t30_cap_req->hdlc_info.c_tsi;
2193
2194 memcpy (tsi->tra_sub_nr, t30_cap_req->hdlc_info.tsi,
2195 sizeof (t30_cap_req->hdlc_info.tsi));
2196
2197 sig_ker_bcs_bdat_req (FINAL_NO);
2198 }
2199 }
2200
2201 /*
2202 +--------------------------------------------------------------------+
2203 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
2204 | STATE : code ROUTINE : ker_send_dcs |
2205 +--------------------------------------------------------------------+
2206
2207 PURPOSE : This function sends command DCS to FAD.
2208
2209 */
2210
2211 GLOBAL void ker_send_dcs (T_T30_CAP_REQ *t30_cap_req)
2212 {
2213 TRACE_FUNCTION ("ker_send_dcs()");
2214
2215 ker_res_nss (t30_cap_req);
2216 ker_res_pwd_snd (t30_cap_req);
2217 ker_res_sub (t30_cap_req);
2218 ker_res_crp (t30_cap_req);
2219 ker_res_tsi (t30_cap_req);
2220
2221 {
2222 MCAST (bcs_dcs, BCS_DCS);
2223 bcs_dcs->fcf = BCS_DCS;
2224 ker_prep_dcs (t30_cap_req, bcs_dcs);
2225 sig_ker_bcs_bdat_req (FINAL_YES);
2226 }
2227 }
2228
2229 /*
2230 +--------------------------------------------------------------------+
2231 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
2232 | STATE : code ROUTINE : ker_send_dis |
2233 +--------------------------------------------------------------------+
2234
2235 PURPOSE : This function sends command DIS to FAD.
2236
2237 */
2238
2239 GLOBAL void ker_send_dis (void)
2240 {
2241 MCAST (dis, BCS_DIS);
2242
2243 TRACE_FUNCTION ("ker_send_dis()");
2244
2245 ker_req_nsf ();
2246 ker_req_csi ();
2247
2248 dis->fcf = BCS_DIS;
2249
2250 ker_prep_dis (dis);
2251
2252 sig_ker_bcs_bdat_req (FINAL_YES);
2253 }
2254
2255 /*
2256 +--------------------------------------------------------------------+
2257 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
2258 | STATE : code ROUTINE : ker_send_dtc |
2259 +--------------------------------------------------------------------+
2260
2261 PURPOSE : This function sends command DTC to FAD.
2262
2263 */
2264
2265 GLOBAL void ker_send_dtc (T_T30_CAP_REQ *t30_cap_req)
2266 {
2267 MCAST (dtc, BCS_DTC);
2268
2269 TRACE_FUNCTION ("ker_send_dtc()");
2270
2271 ker_res_nsc (t30_cap_req);
2272 ker_res_pwd_poll (t30_cap_req);
2273 ker_res_sep (t30_cap_req);
2274 ker_res_cig (t30_cap_req);
2275
2276 dtc->fcf = BCS_DTC;
2277
2278 ker_prep_dtc(t30_cap_req, dtc);
2279
2280 sig_ker_bcs_bdat_req (FINAL_YES);
2281 }
2282
2283 GLOBAL void snd_t30_sgn_ind(UBYTE sgn)
2284 {
2285 PALLOC (t30_sgn_ind, T30_SGN_IND);
2286 t30_sgn_ind->sgn = sgn;
2287 PSENDX (MMI, t30_sgn_ind);
2288 }
2289
2290 GLOBAL void snd_complete_ind(UBYTE cmpl)
2291 {
2292 PALLOC (t30_cmpl_ind, T30_CMPL_IND);
2293 t30_cmpl_ind->cmpl = cmpl;
2294 PSENDX (MMI, t30_cmpl_ind);
2295 SET_STATE (KER, T30_IDLE);
2296 }
2297
2298 GLOBAL void snd_error_ind(USHORT cause)
2299 {
2300 PALLOC (t30_error_ind, T30_ERROR_IND);
2301 t30_error_ind->cause = cause;
2302 PSENDX (MMI, t30_error_ind);
2303 }
2304
2305 /*
2306 +--------------------------------------------------------------------+
2307 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
2308 | STATE : code ROUTINE : ker_send_err |
2309 +--------------------------------------------------------------------+
2310
2311 PURPOSE : This function sends an error cause to MMI.
2312
2313 */
2314
2315 GLOBAL void ker_send_err (USHORT cause)
2316 {
2317 TRACE_FUNCTION ("ker_send_err()");
2318
2319 TIMERSTOP (T1_INDEX);
2320 TIMERSTOP (T2_INDEX);
2321 TIMERSTOP (T4_INDEX);
2322
2323 memset (&t30_data->hdlc_rcv, 0, sizeof (T_hdlc_info));
2324
2325 SET_STATE (KER, T30_IDLE);
2326
2327 snd_error_ind(cause);
2328 }
2329
2330 /*
2331 +--------------------------------------------------------------------+
2332 | PROJECT : GSM-F&D (8411) MODULE : T30_KERP |
2333 | STATE : code ROUTINE : TDCexpand |
2334 +--------------------------------------------------------------------+
2335
2336 PURPOSE :
2337 */
2338
2339 LOCAL void TDCexpand(T_sdu *sdu, T_desc_list2 *desc_list, BOOL final)
2340 {
2341 T_desc2 *desc;
2342 USHORT dataSize, di = 0, si, len;
2343 UBYTE *p;
2344 ULONG *pLast = &desc_list->first;
2345
2346 if (t30_data->dti_data_ind)
2347 {
2348 while (*pLast)
2349 {
2350 desc = (T_desc2*)pLast;
2351 pLast = (ULONG*)desc->next;
2352 }
2353 }
2354 len = sdu->l_buf >> 3;
2355 dataSize = len;
2356
2357 if (t30_data->TDC_doli_pending EQ TRUE)
2358 dataSize++;
2359
2360 p = &sdu->buf[sdu->o_buf >> 3];
2361 for (si = 0; si < len-1; si++)
2362 if (p[si] EQ TDC_DLE)
2363 dataSize++;
2364
2365 if (final)
2366 dataSize += 2;
2367
2368 dataSize = (dataSize/t30_data->frames_per_prim + 1) * t30_data->frames_per_prim;
2369 MALLOC(desc, (USHORT)(sizeof(T_desc2) + dataSize));
2370 desc->next = 0;
2371 *pLast = (ULONG)desc;
2372 p = &sdu->buf[sdu->o_buf >> 3];
2373 if (t30_data->TDC_doli_pending EQ TRUE)
2374 {
2375 desc->buffer[di++] = TDC_DLE;
2376 if (p[0] EQ TDC_DLE)
2377 desc->buffer[di++] = TDC_SUB;/*lint !e661 (Warning -- Possible access of out-of-bounds pointer)*/
2378 else
2379 {
2380 desc->buffer[di++] = TDC_DLE;/*lint !e661 (Warning -- Possible access of out-of-bounds pointer)*/
2381 desc->buffer[di++] = p[0];/*lint !e661 !e662 (Warning -- Possible access/creation of out-of-bounds pointer)*/
2382 }
2383 t30_data->TDC_doli_pending = FALSE;
2384 si = 1;
2385 }
2386 else
2387 si = 0;
2388
2389 while (si < len-1)
2390 {
2391 desc->buffer[di++] = p[si];
2392 if (p[si] EQ TDC_DLE)
2393 {
2394 if (p[si+1] EQ TDC_DLE)
2395 {
2396 desc->buffer[di++] = TDC_SUB;/*lint !e661 (Warning -- Possible access of out-of-bounds pointer)*/
2397 si++;
2398 }
2399 else
2400 desc->buffer[di++] = TDC_DLE;/*lint !e661 (Warning -- Possible access of out-of-bounds pointer)*/
2401 }
2402 si++;
2403 }
2404
2405 if (si EQ len-1 AND p[si] EQ TDC_DLE)
2406 t30_data->TDC_doli_pending = TRUE;
2407 else
2408 desc->buffer[di++] = p[si];/*lint !e661 !e662 (Warning -- Possible access/creation of out-of-bounds pointer)*/
2409 if (final)
2410 {
2411 desc->buffer[di++] = TDC_DLE;/*lint !e661 !e662 (Warning -- Possible access/creation of out-of-bounds pointer)*/
2412 desc->buffer[di++] = TDC_ETX;/*lint !e661 !e662 (Warning -- Possible access/creation of out-of-bounds pointer)*/
2413 }
2414 desc_list->list_len += desc->len = di;
2415 desc->size = desc->len;
2416 desc->offset = 0;
2417 }
2418
2419 /*
2420 +--------------------------------------------------------------------+
2421 | PROJECT : GSM-F&D (8411) MODULE : T30_KERP |
2422 | STATE : code ROUTINE : TDCcompress |
2423 +--------------------------------------------------------------------+
2424
2425 PURPOSE : Move contents of T_desc_list2 into T_sdu w/o TDCs
2426 */
2427
2428 GLOBAL UBYTE TDCcompress(T_desc2 *desc, T_sdu *sdu)
2429 {
2430 T_desc2 *desc_next;
2431 UBYTE *d, *s, *s_end, ready = 0;
2432
2433 s_end = sdu->buf + t30_data->frames_per_prim;
2434 s = sdu->buf + (sdu->l_buf >> 3);
2435
2436 if (t30_data->dti_data_req_ptr EQ NULL)
2437 d = desc->buffer;
2438 else
2439 d = t30_data->dti_data_req_ptr;
2440
2441 while (s < s_end AND desc AND !ready)
2442 {
2443 if (t30_data->TDC_upli_pending)
2444 {
2445 switch (*d)
2446 {
2447 case TDC_EOM: /* end of document (message) */
2448 TRACE_EVENT ("DTE->DCE:EOM");
2449 t30_data->sgn_ind = SGN_EOM; /* cmhT30_PPMRcvd(SGN_EOM) */
2450 ready = READY_UPLI_PAGE;
2451 break;
2452
2453 case TDC_EOP: /* end of document and session (procedure) */
2454 TRACE_EVENT ("DTE->DCE:EOP");
2455 t30_data->sgn_ind = SGN_EOP; /* cmhT30_PPMRcvd(SGN_EOP) */
2456 ready = READY_UPLI_PAGE;
2457 break;
2458
2459 case TDC_ETX:
2460 /*
2461 * end of page or as acknowledge to a sent DLE,CAN (cancel Phase C)
2462 */
2463 TRACE_EVENT ("DTE->DCE:ETX");
2464 t30_data->sgn_ind = SGN_EOP;
2465 ready = READY_UPLI_PAGE;
2466 break;
2467
2468 case TDC_MPS: /* end of page, more pages to follow */
2469 TRACE_EVENT ("DTE->DCE:MPS");
2470 t30_data->sgn_ind = SGN_MPS; /* cmhT30_PPMRcvd(SGN_MPS) */
2471 ready = READY_UPLI_PAGE;
2472 break;
2473
2474 case TDC_SOH: /* SOH (start of header) in packet mode */
2475 TRACE_EVENT ("DTE->DCE:SOH");
2476 break;
2477
2478 case TDC_ETB: /* ETB (end of text block) in packet mode */
2479 TRACE_EVENT ("DTE->DCE:ETB");
2480 break;
2481
2482 case TDC_OVR: /* overrun error marker */
2483 TRACE_EVENT ("DTE->DCE:OVERRUN in DTE");
2484 /*
2485 * add call to cmhT30 here overrun handling ??
2486 */
2487 break;
2488
2489 case TDC_BCR: /* buffer credit request */
2490 TRACE_EVENT ("DTE->DCE:REQ CREDIT");
2491 switch (GET_STATE (KER))
2492 {
2493 case T30_SND_MSG:
2494 break;
2495 case T30_RCV_MSG:
2496 break;
2497 }
2498 break;
2499
2500 case TDC_PRI: /* procedural interrupt signal */
2501 TRACE_EVENT ("DTE->DCE:PRI");
2502 t30_data->sgn_ind = SGN_NOT_USED; /* cmhT30_PRIRcvd() */
2503 break;
2504
2505 case TDC_DC2: /* receive buffer status: buffer is empty */
2506 TRACE_EVENT ("DTE->DCE:DC2");
2507 t30_data->sgn_ind = SGN_NOT_USED; /* cmhT30_DTERdy2Rcv() */
2508 break;
2509
2510 case TDC_CAN: /* Requests DCE/DTE to stop delivering Phase C data */
2511 TRACE_EVENT ("DTE->DCE:CANCEL");
2512 /*
2513 * add call to cmhT30 here
2514 */
2515 break;
2516
2517 default:
2518 if ('a' <= *d AND *d <= 'n') /* interpret as fax cap setting */
2519 {
2520 TRACE_EVENT ("DTE->DCE:FAX CAPS");
2521 /*
2522 * add call to cmhT30 here for setup the fax caps
2523 */
2524 }
2525 else
2526 {
2527 *s = TDC_DLE;
2528 s++;
2529 sdu->l_buf += 8;
2530 if (*d EQ TDC_SUB) /* double the TDC_DLE */
2531 {
2532 *s = *d;
2533 s++;
2534 sdu->l_buf += 8;
2535 }
2536 t30_data->TDC_upli_pending = FALSE;
2537
2538 d++;
2539 if (d EQ desc->buffer + desc->len)
2540 {
2541 desc_next = (T_desc2 *)desc->next;
2542 MFREE(desc);
2543 desc = desc_next;
2544 d = desc->buffer;
2545 }
2546 }
2547 }
2548 t30_data->TDC_upli_pending = FALSE;
2549 }
2550 else
2551 {
2552 if (*d EQ TDC_DLE)
2553 {
2554 t30_data->TDC_upli_pending = TRUE;
2555 }
2556 else
2557 {
2558 *s = *d;
2559 s++;
2560 sdu->l_buf += 8;
2561 }
2562 d++;
2563 if (d EQ desc->buffer + desc->len)
2564 {
2565 desc_next = (T_desc2 *)desc->next;
2566 MFREE(desc);
2567 desc = desc_next;
2568 d = desc->buffer;
2569 }
2570 }
2571 if (desc AND !ready)
2572 t30_data->dti_data_req_ptr = d;
2573 else
2574 t30_data->dti_data_req_ptr = NULL;
2575 }
2576 if (s EQ s_end)
2577 ready |= READY_UPLI_SDU;
2578
2579 return ready;
2580 }
2581
2582 /*
2583 +--------------------------------------------------------------------+
2584 | PROJECT : GSM-F&D (8411) MODULE : T30_KERP |
2585 | STATE : code ROUTINE : check_ignore |
2586 +--------------------------------------------------------------------+
2587
2588 PURPOSE :
2589 */
2590
2591 LOCAL BOOL check_ignore(T_FAD_DATA_IND *fad_data_ind)
2592 {
2593 if (!fad_data_ind)
2594 return TRUE;
2595
2596 if (ker_check_rtc(fad_data_ind) EQ RTC_YES AND !fad_data_ind->final)
2597 {
2598 PALLOC (fad_ignore_req, FAD_IGNORE_REQ);
2599 PSENDX (FAD, fad_ignore_req);
2600 SET_STATE(KER, T30_RCV_RDYF);
2601 return TRUE;
2602 }
2603 return FALSE;
2604 }
2605
2606 /*
2607 +--------------------------------------------------------------------+
2608 | PROJECT : GSM-F&D (8411) MODULE : T30_KERP |
2609 | STATE : code ROUTINE : append_dti_data_ind |
2610 +--------------------------------------------------------------------+
2611
2612 PURPOSE :
2613 */
2614
2615 LOCAL BOOL append_dti_data_ind(T_FAD_DATA_IND *fad_data_ind)
2616 {
2617 TRACE_FUNCTION ("append_dti_data_ind()");
2618
2619 TDCexpand(&fad_data_ind->sdu, &t30_data->dti_data_ind->desc_list2, fad_data_ind->final);
2620 return check_ignore(fad_data_ind);
2621 }
2622
2623 /*
2624 +--------------------------------------------------------------------+
2625 | PROJECT : GSM-F&D (8411) MODULE : T30_KERP |
2626 | STATE : code ROUTINE : create_dti_data_ind |
2627 +--------------------------------------------------------------------+
2628
2629 PURPOSE :
2630 */
2631
2632 LOCAL BOOL create_dti_data_ind(T_FAD_DATA_IND *fad_data_ind)
2633 {
2634 PALLOC (dti_data_ind, DTI2_DATA_IND);
2635
2636 TRACE_FUNCTION ("create_dti_data_ind()");
2637
2638 dti_data_ind->link_id = t30_data->link_id;
2639 dti_data_ind->parameters.p_id = DTI_PID_UOS;
2640 dti_data_ind->parameters.st_lines.st_flow = DTI_FLOW_ON;
2641 dti_data_ind->parameters.st_lines.st_line_sa = DTI_SA_ON;
2642 dti_data_ind->parameters.st_lines.st_line_sb = DTI_SB_ON;
2643 dti_data_ind->parameters.st_lines.st_break_len = DTI_BREAK_OFF;
2644
2645 dti_data_ind->desc_list2.list_len = 0;
2646 dti_data_ind->desc_list2.first = (ULONG)NULL;
2647
2648 if (fad_data_ind)
2649 {
2650 t30_data->dti_data_ind = dti_data_ind;
2651 TDCexpand(&fad_data_ind->sdu, &dti_data_ind->desc_list2, fad_data_ind->final);
2652 return check_ignore(fad_data_ind);
2653 }
2654 else
2655 {
2656 t30_data->dti_data_ind_empty = dti_data_ind;
2657 return FALSE;
2658 }
2659 }
2660
2661 /*
2662 +--------------------------------------------------------------------+
2663 | PROJECT : GSM-F&D (8411) MODULE : T30_KERP |
2664 | STATE : code ROUTINE : prepare_dti_data_ind|
2665 +--------------------------------------------------------------------+
2666
2667 PURPOSE :
2668 */
2669
2670 GLOBAL void prepare_dti_data_ind(T_FAD_DATA_IND *fad_data_ind)
2671 {
2672 BOOL ignore;
2673
2674 TRACE_FUNCTION ("prepare_dti_data_ind()");
2675
2676 t30_data->dti_data_ind_final = fad_data_ind->final;
2677
2678 if (!t30_data->dti_data_ind)
2679 ignore = create_dti_data_ind(fad_data_ind);
2680 else
2681 ignore = append_dti_data_ind(fad_data_ind);
2682
2683 if (!ignore AND !t30_data->dti_data_ind_final)
2684 {
2685 PALLOC (fad_ready_req, FAD_READY_REQ);
2686 PSENDX (FAD, fad_ready_req);
2687 }
2688 }
2689
2690 /*
2691 +--------------------------------------------------------------------+
2692 | PROJECT : GSM-F&D (8411) MODULE : T30_KERP |
2693 | STATE : code ROUTINE : snd_dti_data_ind |
2694 +--------------------------------------------------------------------+
2695
2696 PURPOSE :
2697 */
2698
2699 GLOBAL void snd_dti_data_ind(T_DTI2_DATA_IND **dti_data_ind)
2700 {
2701 TRACE_FUNCTION ("snd_dti_data_ind()");
2702
2703 dti_send_data(
2704 t30_hDTI,
2705 T30_DTI_UP_DEF_INSTANCE,
2706 T30_DTI_UP_INTERFACE,
2707 T30_DTI_UP_CHANNEL,
2708 *dti_data_ind
2709 );
2710
2711 *dti_data_ind = NULL;
2712 }
2713
2714 /*
2715 +--------------------------------------------------------------------+
2716 | PROJECT : GSM-F&D (8411) MODULE : T30_KERP |
2717 | STATE : code ROUTINE : snd_t30_phase_ind |
2718 +--------------------------------------------------------------------+
2719
2720 PURPOSE :
2721 */
2722
2723 GLOBAL void snd_t30_phase_ind(UBYTE phase)
2724 {
2725 TRACE_FUNCTION ("snd_t30_phase_ind()");
2726
2727 {
2728 PALLOC (t30_phase_ind, T30_PHASE_IND);
2729 t30_phase_ind->phase = phase;
2730 PSENDX (MMI, t30_phase_ind);
2731 }
2732 }
2733
2734
2735 /*
2736 +--------------------------------------------------------------------+
2737 | PROJECT : GSM-F&D (8411) MODULE : T30_KERP |
2738 | STATE : code ROUTINE : dti_connect_setup |
2739 +--------------------------------------------------------------------+
2740
2741 PURPOSE : call dti_open() to establish a dtilib connection
2742 */
2743
2744 GLOBAL void dti_connect_setup(T_T30_DTI_REQ *t30_dti_req)
2745 {
2746 TRACE_FUNCTION ("dti_connect_setup()");
2747
2748 t30_data->link_id = t30_dti_req->link_id;
2749
2750 if (t30_data->dti_state NEQ DTI_CLOSED)
2751 {
2752 dti_disconnect();
2753 }
2754
2755 create_dti_data_ind(NULL); /* send empty primitive to set flow control */
2756
2757 /*
2758 * open new dti library communication channel
2759 */
2760 t30_data->dti_state = DTI_SETUP;
2761
2762 if (dti_open(
2763 t30_hDTI,
2764 T30_DTI_UP_DEF_INSTANCE,
2765 T30_DTI_UP_INTERFACE,
2766 T30_DTI_UP_CHANNEL,
2767 T30_DTI_UPLINK_QUEUE_SIZE,
2768 t30_dti_req->dti_direction,
2769 DTI_QUEUE_UNUSED,
2770 DTI_VERSION_10,
2771 (U8*)t30_dti_req->entity_name,
2772 t30_dti_req->link_id
2773 ))
2774 return;
2775
2776 t30_data->dti_state = DTI_CLOSED;
2777 snd_t30_dti_cnf(T30_DISCONNECT_DTI);
2778 }
2779
2780 /*
2781 +--------------------------------------------------------------------+
2782 | PROJECT : GSM-F&D (8411) MODULE : T30_KERP |
2783 | STATE : code ROUTINE : dti_connect_open |
2784 +--------------------------------------------------------------------+
2785
2786 PURPOSE : acknowledge established a dtilib connection
2787 */
2788
2789 GLOBAL void dti_connect_open()
2790 {
2791 TRACE_FUNCTION ("dti_connect_open()");
2792
2793 if(t30_data->dti_state EQ DTI_SETUP)
2794 {
2795 t30_data->dti_state = DTI_IDLE;
2796 snd_t30_dti_cnf(T30_CONNECT_DTI);
2797 snd_dti_ready_ind();
2798 }
2799 else
2800 {
2801 TRACE_ERROR ("dti connection is not in SETUP state!");
2802 }
2803 }
2804
2805 /*
2806 +--------------------------------------------------------------------+
2807 | PROJECT : GSM-F&D (8411) MODULE : T30_KERP |
2808 | STATE : code ROUTINE : snd_t30_dti_ind |
2809 +--------------------------------------------------------------------+
2810
2811 PURPOSE :
2812 */
2813
2814 LOCAL void snd_t30_dti_ind(void)
2815 {
2816 TRACE_FUNCTION ("snd_t30_dti_ind()");
2817 {
2818 PALLOC (t30_dti_ind, T30_DTI_IND);
2819 PSENDX (MMI, t30_dti_ind);
2820 }
2821 }
2822
2823 /*
2824 +--------------------------------------------------------------------+
2825 | PROJECT : GSM-F&D (8411) MODULE : T30_KERP |
2826 | STATE : code ROUTINE : dti_connect_close |
2827 +--------------------------------------------------------------------+
2828
2829 PURPOSE : react to closing of dtilib connection
2830 */
2831
2832 GLOBAL void dti_connect_close()
2833 {
2834 TRACE_FUNCTION ("ti_connect_close()");
2835
2836 if(t30_data->dti_state NEQ DTI_CLOSED)
2837 {
2838 t30_data->dti_state = DTI_CLOSED;
2839 snd_t30_dti_ind();
2840 }
2841 else
2842 {
2843 TRACE_ERROR ("dti connection is not in SETUP/OPEN state!");
2844 }
2845 }
2846
2847
2848 /*
2849 +--------------------------------------------------------------------+
2850 | PROJECT : GSM-F&D (8411) MODULE : T30_KERP |
2851 | STATE : code ROUTINE : dti_connect_close |
2852 +--------------------------------------------------------------------+
2853
2854 PURPOSE : close down a dtilib connection
2855 */
2856
2857 GLOBAL void dti_disconnect()
2858 {
2859 TRACE_FUNCTION ("dti_disconnect()");
2860
2861 /*
2862 * shut down dtilib communication
2863 */
2864 if(t30_data->dti_state NEQ DTI_CLOSED)
2865 {
2866 dti_close(
2867 t30_hDTI,
2868 T30_DTI_UP_DEF_INSTANCE,
2869 T30_DTI_UP_INTERFACE,
2870 T30_DTI_UP_CHANNEL,
2871 FALSE
2872 );
2873 t30_data->dti_state = DTI_CLOSED;
2874 }
2875 else
2876 {
2877 TRACE_ERROR ("dti connection is not in SETUP/OPEN state!");
2878 }
2879 }
2880
2881 /*
2882 +--------------------------------------------------------------------+
2883 | PROJECT : GSM-F&D (8411) MODULE : T30_KERP |
2884 | STATE : code ROUTINE : snd_t30_dti_cnf |
2885 +--------------------------------------------------------------------+
2886
2887 PURPOSE :
2888 */
2889
2890 GLOBAL void snd_t30_dti_cnf(UBYTE dti_conn)
2891 {
2892 TRACE_FUNCTION ("snd_t30_dti_cnf()");
2893
2894 {
2895 PALLOC (t30_dti_cnf, T30_DTI_CNF);
2896 t30_dti_cnf->dti_conn = dti_conn;
2897 PSENDX (MMI, t30_dti_cnf);
2898 }
2899 }
2900
2901
2902 /*
2903 +--------------------------------------------------------------------+
2904 | PROJECT : GSM-F&D (8411) MODULE : T30_KERP |
2905 | STATE : code ROUTINE : snd_dti_ready_ind |
2906 +--------------------------------------------------------------------+
2907
2908 PURPOSE :
2909 */
2910
2911 GLOBAL void snd_dti_ready_ind(void)
2912 {
2913 TRACE_FUNCTION ("snd_dti_ready_ind()");
2914
2915 dti_start(
2916 t30_hDTI,
2917 T30_DTI_UP_DEF_INSTANCE,
2918 T30_DTI_UP_INTERFACE,
2919 T30_DTI_UP_CHANNEL
2920 );
2921 }
2922
2923 #if defined _SIMULATION_ || defined KER_DEBUG_BCS || defined KER_DEBUG_MSG
2924 /*
2925 +--------------------------------------------------------------------+
2926 | PROJECT : GSM-F&D (8411) MODULE : T30_KERF |
2927 | STATE : code ROUTINE : ker_debug |
2928 +--------------------------------------------------------------------+
2929
2930 PURPOSE : This function debugs the contents of a buffer.
2931 */
2932
2933 GLOBAL void ker_debug(CHAR *header, UBYTE *buf, USHORT len)
2934 {
2935 #define BYTE2HEXSTR(B, H) {UBYTE b, *a = (UBYTE*)(H);\
2936 b = (((UBYTE)(B)) >> 4) & 0x0F;\
2937 if (b > 9) b += 'A'-10; else b += '0'; *a = b;\
2938 b = ((UBYTE)(B)) & 0x0F;\
2939 if (b > 9) b += 'A'-10; else b += '0'; *(a+1) = b;}
2940
2941 USHORT i, k = 0;
2942 char trace_buf[81];
2943
2944 /*
2945 TRACE_EVENT("====== KERNEL DEBUG START ======");
2946 */
2947 TRACE_EVENT_P2("%s: len=%d", header, len);
2948
2949 for (i = 0; i < len; i++)
2950 {
2951 BYTE2HEXSTR(buf[i], &trace_buf[k]);
2952 k += 2;
2953 if (k EQ 80)
2954 break;
2955 }
2956 trace_buf[k] = 0;
2957 TRACE_EVENT(trace_buf);
2958 /*
2959 TRACE_EVENT("====== KERNEL DEBUG END ======");
2960 */
2961 }
2962 #endif
2963