comparison src/aci2/aci/cmh_t30f.c @ 3:93999a60b835

src/aci2, src/condat2: import of g23m/condat source pieces from TCS211
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 26 Sep 2016 00:29:36 +0000
parents
children
comparison
equal deleted inserted replaced
2:c41a534f33c6 3:93999a60b835
1 /*
2 +-----------------------------------------------------------------------------
3 | Project : GSM-PS (6147)
4 | Modul : CMH_T30F
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 module defines the functions used by the command
18 | handler for L2R.
19 +-----------------------------------------------------------------------------
20 */
21 #if defined (DTI) || defined (FF_FAX)
22
23 #ifndef CMH_T30F_C
24 #define CMH_T30F_C
25 #endif
26
27 #include "aci_all.h"
28 /*==== INCLUDES ===================================================*/
29 #include "aci_cmh.h"
30 #include "ati_cmd.h"
31 #include "aci_cmd.h"
32
33 #include "l4_tim.h"
34 #ifdef FAX_AND_DATA
35 #include "aci_fd.h"
36
37 #endif /* of #ifdef FAX_AND_DATA */
38
39 #include "dti.h"
40 #include "dti_conn_mng.h"
41
42 #include "aci.h"
43 #include "psa.h"
44 #include "psa_t30.h"
45 #include "psa_cc.h"
46 #include "cmh.h"
47 #include "cmh_t30.h"
48
49 #include "cmh_ra.h"
50
51 /*==== CONSTANTS ==================================================*/
52 #define BIT_SET (0x01) /* bit is set */
53 #define BIT_CLR (0x00) /* bit is cleared */
54 #define BIT_NOT_PRES (0xFF) /* bit is not present */
55
56 /*==== TYPES ======================================================*/
57
58 /*==== EXPORT =====================================================*/
59
60 /*==== VARIABLES ==================================================*/
61
62 /*==== FUNCTIONS ==================================================*/
63
64 /*
65 +-------------------------------------------------------------------+
66 | PROJECT : GSM-PS (6147) MODULE : CMH_T30 |
67 | ROUTINE : cmhT30_Chn2BitRate |
68 +-------------------------------------------------------------------+
69
70 PURPOSE : convert channel rate into bit rate
71
72 */
73
74 GLOBAL T_ACI_F_BR cmhT30_Chn2BitRate ( void )
75 {
76 switch( ccShrdPrm.chMod )
77 {
78 case( CHM_DATA_14_4 ): return( F_BR_14400 );
79 case( CHM_DATA_9_6 ): return( F_BR_9600 );
80 case( CHM_DATA_4_8 ): return( F_BR_4800 );
81 case( CHM_DATA_2_4 ): return( F_BR_2400 );
82 default: TRACE_EVENT( "UNEXP CHN MODE IN CTB" );
83 return( F_BR_NotPresent );
84 }
85 }
86
87 /*
88 +-------------------------------------------------------------------+
89 | PROJECT : GSM-PS (6147) MODULE : CMH_T30 |
90 | ROUTINE : cmhT30_SelChnRate |
91 +-------------------------------------------------------------------+
92
93 PURPOSE : select channel rate
94
95 */
96
97 GLOBAL USHORT cmhT30_SelChnRate ( void )
98 {
99 switch( ccShrdPrm.chMod )
100 {
101 case( CHM_DATA_14_4 ): return( 14400 );
102 case( CHM_DATA_9_6 ): return( 9600 );
103 case( CHM_DATA_4_8 ): return( 4800 );
104 case( CHM_DATA_2_4 ): return( 2400 );
105 default: TRACE_EVENT( "UNEXP CHN MODE IN CTB" );
106 return( NOT_PRESENT_16BIT );
107 }
108 }
109
110 /*
111 +-------------------------------------------------------------------+
112 | PROJECT : GSM-PS (6147) MODULE : CMH_T30 |
113 | ROUTINE : cmhT30_SelUsrRate |
114 +-------------------------------------------------------------------+
115
116 PURPOSE : select user rate
117
118 */
119
120 GLOBAL USHORT cmhT30_SelUsrRate ( void )
121 {
122 switch( t30NgtPrms.FCSbr )
123 {
124 case( F_BR_2400 ): return( 2400 );
125 case( F_BR_4800 ): return( 4800 );
126 case( F_BR_7200 ): return( 7200 );
127 case( F_BR_9600 ): return( 9600 );
128 case( F_BR_12000 ): return( 12000 );
129 case( F_BR_14400 ): return( 14000 );
130 default: TRACE_EVENT( "UNEXP BIT RATE IN NGT PARMS" );
131 return( NOT_PRESENT_16BIT );
132 }
133 }
134
135 /*
136 +-------------------------------------------------------------------+
137 | PROJECT : GSM-PS (6147) MODULE : CMH_T30 |
138 | ROUTINE : cmhT30_SelHlfRate |
139 +-------------------------------------------------------------------+
140
141 PURPOSE : select half rate
142
143 */
144
145 GLOBAL UBYTE cmhT30_SelHlfRate ( void )
146 {
147 switch( ccShrdPrm.chType )
148 {
149 case( CH_TCH_F ): return( FALSE );
150 case( CH_TCH_H ): return( TRUE );
151 default: TRACE_EVENT( "UNEXP CHN TYPE IN CTB" );
152 return( -1 );
153 }
154 }
155
156 /*
157 +-------------------------------------------------------------------+
158 | PROJECT : GSM-PS (6147) MODULE : CMH_RA |
159 | ROUTINE : cmhT30_SelBitOrder |
160 +-------------------------------------------------------------------+
161
162 PURPOSE : select bit order
163
164 */
165
166 GLOBAL UBYTE cmhT30_SelBitOrder( T_ACI_CMD_SRC srcId )
167 {
168 switch( fnd_cmhPrm[srcId].t30CmdPrm.FBOval )
169 {
170 case( FBO_VAL_DirCDirBD ): return( FBO_NRM_STATUS + FBO_NRM_DATA );
171 case( FBO_VAL_RvrCDirBD ): return( FBO_NRM_STATUS + FBO_REV_DATA );
172 case( FBO_VAL_DirCRvrBD ): return( FBO_REV_STATUS + FBO_NRM_DATA );
173 case( FBO_VAL_RvrCRvrBD ): return( FBO_REV_STATUS + FBO_REV_DATA );
174 default: TRACE_EVENT( "UNEXP FBO VALUE" );
175 return( NOT_PRESENT_8BIT );
176 }
177 }
178
179 /*
180 +-------------------------------------------------------------------+
181 | PROJECT : GSM-PS (6147) MODULE : CMH_T30 |
182 | ROUTINE : cmhT30_Chk4TCHAdpt |
183 +-------------------------------------------------------------------+
184
185 PURPOSE : check for TCH adaptation. Returns true if an adaptation
186 of the TCH is expected.
187
188 */
189
190 GLOBAL BOOL cmhT30_Chk4TCHAdpt ( void )
191 {
192 TRACE_FUNCTION("cmhT30_Chk4TCHAdpt");
193
194 TRACE_EVENT_P2( "CHN MD: %d, FCS BR: %d", ccShrdPrm.chMod, t30NgtPrms.FCSbr );
195
196 switch( ccShrdPrm.chMod )
197 {
198 case( CHM_DATA_14_4 ):
199
200 switch( t30NgtPrms.FCSbr )
201 {
202 case( F_BR_2400 ):
203 case( F_BR_4800 ):
204 case( F_BR_7200 ):
205 case( F_BR_9600 ): return( TRUE );
206 case( F_BR_12000 ):
207 case( F_BR_14400 ): return( FALSE );
208 default: TRACE_EVENT( "UNEXP BIT RATE IN NGT PARMS" );
209 return( FALSE );
210 }
211 case( CHM_DATA_9_6 ):
212
213 switch( t30NgtPrms.FCSbr )
214 {
215 case( F_BR_2400 ):
216 case( F_BR_4800 ):
217 case( F_BR_12000 ):
218 case( F_BR_14400 ): return( TRUE );
219 case( F_BR_7200 ):
220 case( F_BR_9600 ): return( FALSE );
221 default: TRACE_EVENT( "UNEXP BIT RATE IN NGT PARMS" );
222 return( FALSE );
223 }
224 case( CHM_DATA_4_8 ):
225
226 switch( t30NgtPrms.FCSbr )
227 {
228 case( F_BR_2400 ):
229 case( F_BR_7200 ):
230 case( F_BR_9600 ):
231 case( F_BR_12000 ):
232 case( F_BR_14400 ): return( TRUE );
233 case( F_BR_4800 ): return( FALSE );
234 default: TRACE_EVENT( "UNEXP BIT RATE IN NGT PARMS" );
235 return( FALSE );
236 }
237 case( CHM_DATA_2_4 ):
238
239 switch( t30NgtPrms.FCSbr )
240 {
241 case( F_BR_4800 ):
242 case( F_BR_7200 ):
243 case( F_BR_9600 ):
244 case( F_BR_12000 ):
245 case( F_BR_14400 ): return( TRUE );
246 case( F_BR_2400 ): return( FALSE );
247 default: TRACE_EVENT( "UNEXP BIT RATE IN NGT PARMS" );
248 return( FALSE );
249 }
250 default: TRACE_EVENT( "UNEXP CHN MODE IN CTB" );
251 return( FALSE );
252 }
253 }
254
255 /*
256 +-------------------------------------------------------------------+
257 | PROJECT : GSM-PS (6147) MODULE : CMH_T30 |
258 | ROUTINE : cmhT30_GetDataRate |
259 +-------------------------------------------------------------------+
260
261 PURPOSE : get negotiated data rate
262
263 */
264
265 GLOBAL T_ACI_BS_SPEED cmhT30_GetDataRate ( void )
266 {
267 /* do not return a data rate in FAX mode, due to adaptation to
268 FAX host software */
269 return( F_BR_NotPresent );
270
271 #if(0)
272 switch( t30NgtPrms.FCSbr )
273 {
274 case( F_BR_2400 ): return( BS_SPEED_2400_V110 );
275 case( F_BR_4800 ): return( BS_SPEED_4800_V110 );
276 case( F_BR_7200 ): return( -1 );
277 case( F_BR_9600 ): return( BS_SPEED_9600_V110 );
278 case( F_BR_12000 ): return( BS_SPEED_12000_V110 );
279 case( F_BR_14400 ): return( BS_SPEED_14400_V110 );
280 default: TRACE_EVENT( "UNEXP BIT RATE IN NGT PARMS" );
281 return( F_BR_NotPresent );
282 }
283 #endif
284 }
285
286 /*
287 +-------------------------------------------------------------------+
288 | PROJECT : GSM-PS (6147) MODULE : CMH_T30 |
289 | ROUTINE : cmhT30_GetPpr |
290 +-------------------------------------------------------------------+
291
292 PURPOSE : interpret post page response according TABLE23/T.32
293 and return the post page response notation of T30.
294
295 */
296
297 GLOBAL UBYTE cmhT30_GetPpr( T_ACI_FPS_PPR ppr )
298 {
299 switch( ppr )
300 {
301 case( FPS_PPR_Mcf ): return( SGN_MCF );
302 case( FPS_PPR_Rtn ): return( SGN_RTN );
303 case( FPS_PPR_Rtp ): return( SGN_RTP );
304 case( FPS_PPR_Pin ): return( SGN_PIN );
305 case( FPS_PPR_Pip ): return( SGN_PIP );
306 }
307
308 TRACE_EVENT("INVALID SETTING FOR FAX CAPS: PPR");
309 return( SGN_NOT_USED );
310 }
311
312 /*
313 +-------------------------------------------------------------------+
314 | PROJECT : GSM-PS (6147) MODULE : CMH_T30 |
315 | ROUTINE : cmhT30_GetResolution |
316 +-------------------------------------------------------------------+
317
318 PURPOSE : interpret resolution capabilities according TABLE2/T.32
319 and return the resolution in CLASS 2.0 notation.
320
321 */
322
323 GLOBAL T_ACI_F_VR cmhT30_GetResolution( void * p, T_T30_FRTP frmTyp )
324 {
325 T_dis * pDCECaps = (T_dis *)p; /* points to DCE capabilities */
326 T_ACI_F_VR reso = 0; /* holds resolution capabilities */
327
328 /*
329 *------------------------------------------------------------------
330 * for DCS frames
331 *------------------------------------------------------------------
332 */
333 if( frmTyp EQ FRT_DCS )
334 {
335 /*
336 *----------------------------------------------------------------
337 * TABLE 2/T.32 BIT 15 and BIT 44
338 *----------------------------------------------------------------
339 */
340 if( pDCECaps -> R8_lines_pels EQ BIT_CLR ) /* BIT 15 EQ 0 */
341 {
342 if( pDCECaps -> resolution_type EQ BIT_CLR OR
343 pDCECaps -> resolution_type EQ BIT_NOT_PRES ) /* BIT 44 -> metric based */
344 {
345 if( pDCECaps -> R16_lines_pels EQ BIT_SET ) /* BIT 43 EQ 1 */
346 return( F_VR_R16X15_4 );
347 else if( pDCECaps -> R8_lines EQ BIT_SET ) /* BIT 41 EQ 1 */
348 return( F_VR_R8X15_4 );
349 else
350 return( F_VR_R8X3_85 );
351 }
352 else /* BIT 44 EQ 1 -> inch based */
353 {
354 if( pDCECaps -> R16_lines_pels EQ BIT_SET ) /* BIT 43 */
355 return( F_VR_200X400 );
356 else
357 return( F_VR_200X100 );
358 }
359 }
360 else /* BIT 15 EQ 1 */
361 {
362 if( pDCECaps -> resolution_type EQ BIT_CLR OR
363 pDCECaps -> resolution_type EQ BIT_NOT_PRES ) /* BIT 44 -> metric based */
364 {
365 return( F_VR_R8X7_7 );
366 }
367 else /* BIT 44 EQ 1 -> inch based */
368 {
369 if( pDCECaps -> r_300_pels EQ BIT_SET ) /* BIT 42 */
370 return( F_VR_300X300 );
371 else
372 return( F_VR_200X200 );
373 }
374 }
375 }
376
377 /*
378 *------------------------------------------------------------------
379 * for DIS/DTC frames
380 *------------------------------------------------------------------
381 */
382 /*
383 *------------------------------------------------------------------
384 * TABLE 2/T.32 Note 11, bottom line
385 *------------------------------------------------------------------
386 */
387 #ifdef _SIMULATION_
388 if( pDCECaps -> R8_lines_pels EQ BIT_SET AND
389 pDCECaps -> R8_lines EQ BIT_CLR AND
390 pDCECaps -> r_300_pels EQ BIT_CLR AND
391 pDCECaps -> R16_lines_pels EQ BIT_CLR AND
392 pDCECaps -> i_res_pref EQ BIT_CLR AND
393 pDCECaps -> m_res_pref EQ BIT_CLR AND
394 pDCECaps -> min_scan_time_hr EQ BIT_CLR )
395 #else
396 if( pDCECaps -> R8_lines_pels EQ BIT_SET AND
397 pDCECaps -> R8_lines EQ BIT_NOT_PRES AND
398 pDCECaps -> r_300_pels EQ BIT_NOT_PRES AND
399 pDCECaps -> R16_lines_pels EQ BIT_NOT_PRES AND
400 pDCECaps -> i_res_pref EQ BIT_NOT_PRES AND
401 pDCECaps -> m_res_pref EQ BIT_NOT_PRES AND
402 pDCECaps -> min_scan_time_hr EQ BIT_NOT_PRES )
403 #endif
404 {
405 reso |= F_VR_R8X7_7;
406 return( reso );
407 }
408
409 /*
410 *------------------------------------------------------------------
411 * TABLE 2/T.32 BIT 41
412 *------------------------------------------------------------------
413 */
414 if( pDCECaps -> R8_lines EQ BIT_SET )
415 reso |= F_VR_R8X15_4;
416
417
418 /*
419 *------------------------------------------------------------------
420 * TABLE 2/T.32 BIT 42
421 *------------------------------------------------------------------
422 */
423 if( pDCECaps -> r_300_pels EQ BIT_SET )
424
425 reso |= F_VR_300X300;
426
427 /*
428 *------------------------------------------------------------------
429 * TABLE 2/T.32 Note 11 & 12
430 *------------------------------------------------------------------
431 */
432 if( pDCECaps -> i_res_pref EQ BIT_SET ) /* BIT 44 */
433 {
434 if( pDCECaps -> R8_lines_pels EQ BIT_CLR ) /* BIT 15 */
435
436 reso |= F_VR_200X100;
437
438 if( pDCECaps -> R8_lines_pels EQ BIT_SET ) /* BIT 15 */
439
440 reso |= F_VR_200X200;
441
442 if( pDCECaps -> R16_lines_pels EQ BIT_SET ) /* BIT 43 */
443
444 reso |= F_VR_200X400;
445 }
446
447 if( pDCECaps -> m_res_pref EQ BIT_SET ) /* BIT 45 */
448 {
449 if( pDCECaps -> R8_lines_pels EQ BIT_SET ) /* BIT 15 */
450
451 reso |= F_VR_R8X7_7;
452
453 if( pDCECaps -> R16_lines_pels EQ BIT_SET ) /* BIT 43 */
454
455 reso |= F_VR_R16X15_4;
456 }
457
458 if( pDCECaps -> m_res_pref EQ BIT_CLR AND /* BIT 44 */
459 pDCECaps -> i_res_pref EQ BIT_CLR ) /* BIT 45 */
460 {
461 TRACE_EVENT("INVALID SETTING FOR FAX CAPS:RESOLUTION");
462 }
463
464 /*
465 *------------------------------------------------------------------
466 * return resolution
467 *------------------------------------------------------------------
468 */
469 return( 1 );
470 }
471
472 /*
473 +-------------------------------------------------------------------+
474 | PROJECT : GSM-PS (6147) MODULE : CMH_T30 |
475 | ROUTINE : cmhT30_BitRate |
476 +-------------------------------------------------------------------+
477
478 PURPOSE : interpret bit rate capabilities according TABLE2/T.32
479 and return the bit rate in CLASS 2.0 notation.
480
481 */
482
483 GLOBAL T_ACI_F_BR cmhT30_GetBitRate( void * p, T_T30_FRTP frmTyp )
484 {
485 T_dis * pDCECaps = (T_dis *)p; /* points to DCE capabilities */
486
487 /*
488 *------------------------------------------------------------------
489 * TABLE 2/T.32 BIT 11 - 14
490 *------------------------------------------------------------------
491 */
492 switch( pDCECaps -> data_sig_rate )
493 {
494 case( 0 ):
495 return( F_BR_2400 );
496
497 case( 8 ):
498 return( F_BR_9600 );
499
500 case( 4 ):
501 return( F_BR_4800 );
502
503 case( 12 ):
504 if( frmTyp EQ FRT_DCS )
505 return( F_BR_7200 );
506 else
507 return( F_BR_9600 );
508
509 case( 1 ):
510 if( frmTyp EQ FRT_DCS )
511 return( F_BR_14400 );
512 break;
513
514 case( 9 ):
515 if( frmTyp EQ FRT_DCS )
516 return( F_BR_9600 );
517 break;
518
519 case( 5 ):
520 if( frmTyp EQ FRT_DCS )
521 return( F_BR_12000 );
522 break;
523
524 case( 13 ):
525 if( frmTyp EQ FRT_DCS )
526 return( F_BR_7200 );
527 else
528 return( F_BR_14400 );
529
530 default:
531 break;
532 }
533
534 TRACE_EVENT("INVALID SETTING FOR FAX CAPS:BIT RATE");
535 return( F_BR_NotPresent );
536 }
537
538 /*
539 +-------------------------------------------------------------------+
540 | PROJECT : GSM-PS (6147) MODULE : CMH_T30 |
541 | ROUTINE : cmhT30_GetPageWidth |
542 +-------------------------------------------------------------------+
543
544 PURPOSE : interpret page width capabilities according TABLE2/T.32
545 and return the page width in CLASS 2.0 notation.
546
547 */
548
549 GLOBAL T_ACI_F_WD cmhT30_GetPageWidth( void * p )
550 {
551 T_dis * pDCECaps = (T_dis *)p; /* points to DCE capabilities */
552
553 /*
554 *------------------------------------------------------------------
555 * TABLE 2/T.32 BIT 17 - 18
556 *------------------------------------------------------------------
557 */
558 switch( pDCECaps -> rec_width )
559 {
560 case( 0 ):
561 return( F_WD_1728 );
562 case( 2 ):
563 return( F_WD_2048 );
564 case( 1 ):
565 case( 3 ):
566 return( F_WD_2432 );
567 }
568
569 TRACE_EVENT("INVALID SETTING FOR FAX CAPS:PAGE WIDTH");
570 return( F_WD_NotPresent );
571 }
572
573 /*
574 +-------------------------------------------------------------------+
575 | PROJECT : GSM-PS (6147) MODULE : CMH_T30 |
576 | ROUTINE : cmhT30_GetPageLength |
577 +-------------------------------------------------------------------+
578
579 PURPOSE : interpret page length capabilities according TABLE2/T.32
580 and return the page length in CLASS 2.0 notation.
581
582 */
583
584 GLOBAL T_ACI_F_LN cmhT30_GetPageLength( void * p )
585 {
586 T_dis * pDCECaps = (T_dis *)p; /* points to DCE capabilities */
587
588 /*
589 *------------------------------------------------------------------
590 * TABLE 2/T.32 BIT 19 - 20
591 *------------------------------------------------------------------
592 */
593 switch( pDCECaps -> max_rec_len )
594 {
595 case( 0 ):
596 return( F_LN_A4 );
597 case( 2 ):
598 return( F_LN_B4 );
599 case( 1 ):
600 return( F_LN_Unlimited );
601 }
602
603 TRACE_EVENT("INVALID SETTING FOR FAX CAPS:PAGE LENGTH");
604 return( F_LN_NotPresent );
605 }
606
607 /*
608 +-------------------------------------------------------------------+
609 | PROJECT : GSM-PS (6147) MODULE : CMH_T30 |
610 | ROUTINE : cmhT30_GetDataComp |
611 +-------------------------------------------------------------------+
612
613 PURPOSE : interpret data compression capabilities according
614 TABLE2/T.32 and return the data compression in CLASS 2.0
615 notation.
616
617 */
618
619 GLOBAL T_ACI_F_DF cmhT30_GetDataComp( void * p )
620 {
621 T_dis * pDCECaps = (T_dis *)p; /* points to DCE capabilities */
622
623 /*
624 *------------------------------------------------------------------
625 * TABLE 2/T.32 BIT 16, 26, 27 and 31
626 *------------------------------------------------------------------
627 */
628 if( pDCECaps -> two_dim_coding EQ BIT_CLR ) /* BIT 16 */
629
630 return( F_DF_1D_MdfHuff );
631
632 if( pDCECaps -> two_dim_coding EQ BIT_SET ) /* BIT 16 */
633 {
634 if( pDCECaps -> uncomp_mode EQ BIT_CLR OR /* BIT 26 */
635 (pDCECaps -> uncomp_mode EQ BIT_NOT_PRES AND
636 pDCECaps -> err_corr_mode EQ BIT_NOT_PRES AND
637 pDCECaps -> err_corr_mode EQ BIT_NOT_PRES AND
638 pDCECaps -> t6_coding EQ BIT_NOT_PRES))
639
640 return( F_DF_2D_MdfRd_T4 );
641
642 if( pDCECaps -> uncomp_mode EQ BIT_SET ) /* BIT 26 */
643
644 return( F_DF_2D_Uncomp );
645
646 if( pDCECaps -> err_corr_mode EQ BIT_SET AND /* BIT 27 */
647 pDCECaps -> t6_coding EQ BIT_SET ) /* BIT 31 */
648
649 return( F_DF_2D_MdfRd_T6 );
650 }
651
652 TRACE_EVENT("INVALID SETTING FOR FAX CAPS:DATA COMPRESSION");
653 return( F_DF_NotPresent );
654 }
655
656 /*
657 +-------------------------------------------------------------------+
658 | PROJECT : GSM-PS (6147) MODULE : CMH_T30 |
659 | ROUTINE : cmhT30_GetErrCorr |
660 +-------------------------------------------------------------------+
661
662 PURPOSE : interpret error correction capabilities according
663 TABLE2/T.32 and return the error correction in CLASS 2.0
664 notation.
665
666 */
667
668 GLOBAL T_ACI_F_EC cmhT30_GetErrCorr( void * p )
669 {
670 T_dis * pDCECaps = (T_dis *)p; /* points to DCE capabilities */
671
672 /*
673 *------------------------------------------------------------------
674 * TABLE 2/T.32 BIT 27 and 67
675 *------------------------------------------------------------------
676 */
677 if( pDCECaps -> err_corr_mode EQ BIT_CLR ) /* BIT 27 */
678
679 return( F_EC_DisableECM );
680
681 if( pDCECaps -> err_corr_mode EQ BIT_SET ) /* BIT 27 */
682 {
683 if( pDCECaps -> duplex EQ BIT_NOT_PRES ) /* BIT 67 */
684
685 return( F_EC_EnableECM );
686
687 if( pDCECaps -> duplex EQ BIT_CLR ) /* BIT 67 */
688
689 return( F_EC_EnableHalfDup );
690
691 if( pDCECaps -> duplex EQ BIT_SET ) /* BIT 67 */
692
693 return( F_EC_EnableFullDup );
694 }
695
696 return( F_EC_DisableECM );
697 }
698
699 /*
700 +-------------------------------------------------------------------+
701 | PROJECT : GSM-PS (6147) MODULE : CMH_T30 |
702 | ROUTINE : cmhT30_GetFileTrnsfr |
703 +-------------------------------------------------------------------+
704
705 PURPOSE : interpret file transfer mode according TABLE2/T.32
706 and return the file transfer mode in CLASS 2.0 notation.
707
708 */
709
710 GLOBAL T_ACI_F_BF cmhT30_GetFileTrnsfr( void * p )
711 {
712 T_dis * pDCECaps = (T_dis *)p; /* points to DCE capabilities */
713 T_ACI_F_BF ftm = 0; /* holds file trans. capabilities */
714
715 /*
716 *------------------------------------------------------------------
717 * TABLE 2/T.32 BIT 53
718 *------------------------------------------------------------------
719 */
720 if( pDCECaps -> bft EQ BIT_CLR )
721
722 ftm += F_BF_DisableFileTrnsf;
723
724 /*
725 *------------------------------------------------------------------
726 * TABLE 2/T.32 BIT 27 and 53, 54, 55, 57, 60, 62, 65
727 *------------------------------------------------------------------
728 */
729 if( pDCECaps -> err_corr_mode EQ BIT_SET ) /* BIT 27 */
730 {
731 if( pDCECaps -> bft EQ BIT_SET ) /* BIT 53 */
732
733 ftm += F_BF_EnableBFT;
734
735 if( pDCECaps -> dtm EQ BIT_SET ) /* BIT 54 */
736
737 ftm += F_BF_DocuTrnsfMode;
738
739 if( pDCECaps -> edi EQ BIT_SET ) /* BIT 55 */
740
741 ftm += F_BF_EdifactMode;
742
743 if( pDCECaps -> btm EQ BIT_SET ) /* BIT 57 */
744
745 ftm += F_BF_BasicTrnsfMode;
746
747 if( pDCECaps -> char_mode EQ BIT_SET ) /* BIT 60 */
748
749 ftm += F_BF_CharMode;
750
751 if( pDCECaps -> mixed_mode EQ BIT_SET ) /* BIT 62 */
752
753 ftm += F_BF_MixMode;
754
755 if( pDCECaps -> proc_mode_26 EQ BIT_SET )/* BIT 65 */
756
757 ftm += F_BF_ProcMode;
758 }
759 /*
760 *------------------------------------------------------------------
761 * return resolution
762 *------------------------------------------------------------------
763 */
764 return( ftm );
765 }
766
767 /*
768 +-------------------------------------------------------------------+
769 | PROJECT : GSM-PS (6147) MODULE : CMH_T30 |
770 | ROUTINE : cmhT30_GetScanTime |
771 +-------------------------------------------------------------------+
772
773 PURPOSE : interpret scan time capabilities according TABLE2/T.32
774 and return the scan time in CLASS 2.0 notation.
775
776 */
777
778 GLOBAL T_ACI_F_ST cmhT30_GetScanTime( void * p )
779 {
780 T_dis * pDCECaps = (T_dis *)p; /* points to DCE capabilities */
781
782 /*
783 *------------------------------------------------------------------
784 * TABLE 2/T.32 BIT 21 - 23
785 *------------------------------------------------------------------
786 */
787 switch( pDCECaps -> min_scan_time )
788 {
789 case( 0 ):
790 return( F_ST_20_20 );
791 case( 4 ):
792 return( F_ST_5_5 );
793 case( 2 ):
794 return( F_ST_10_10 );
795 case( 6 ):
796 return( F_ST_20_10 );
797 case( 1 ):
798 return( F_ST_40_40 );
799 case( 5 ):
800 return( F_ST_40_20 );
801 case( 3 ):
802 return( F_ST_10_5 );
803 case( 7 ):
804 return( F_ST_0_0 );
805 }
806
807 TRACE_EVENT("INVALID SETTING FOR FAX CAPS:SCAN TIME");
808 return( F_ST_NotPresent );
809 }
810
811 /*
812 +-------------------------------------------------------------------+
813 | PROJECT : GSM-PS (6147) MODULE : CMH_T30 |
814 | ROUTINE : cmhT30_GetJPEG |
815 +-------------------------------------------------------------------+
816
817 PURPOSE : interpret JPEG mode according TABLE2/T.32
818 and return the JPEG mode in CLASS 2.0 notation.
819
820 */
821
822 GLOBAL T_ACI_F_JP cmhT30_GetJPEG( void * p )
823 {
824 T_dis * pDCECaps = (T_dis *)p; /* points to DCE capabilities */
825 T_ACI_F_JP jpeg = 0; /* holds JPEG capabilities */
826
827 /*
828 *------------------------------------------------------------------
829 * TABLE 2/T.32 BIT 68
830 *------------------------------------------------------------------
831 */
832 if( pDCECaps -> jpeg EQ BIT_CLR )
833
834 jpeg += F_JP_DisableJPEG;
835
836 /*
837 *------------------------------------------------------------------
838 * TABLE 2/T.32 BIT 68 and 69, 70, 71, 73, 74, 75
839 *------------------------------------------------------------------
840 */
841 if( pDCECaps -> jpeg EQ BIT_SET ) /* BIT 68 */
842 {
843 jpeg += F_JP_EnableJPEG;
844
845 if( pDCECaps -> full_colour EQ BIT_SET ) /* BIT 69 */
846
847 jpeg += F_JP_FullColor;
848
849 if( pDCECaps -> huffman_tables EQ BIT_SET ) /* BIT 70 */
850
851 jpeg += F_JP_EnablePrefHuff;
852
853 if( pDCECaps -> r_12_bits_pel_comp EQ BIT_SET ) /* BIT 71 */
854
855 jpeg += F_JP_12BitsPelComp;
856
857 if( pDCECaps -> no_subsamp EQ BIT_SET ) /* BIT 73 */
858
859 jpeg += F_JP_NoSubsmpl;
860
861 if( pDCECaps -> cust_illum EQ BIT_SET ) /* BIT 74 */
862
863 jpeg += F_JP_CustIllum;
864
865 if( pDCECaps -> cust_gamut EQ BIT_SET ) /* BIT 75 */
866
867 jpeg += F_JP_CustGamutRange;
868 }
869
870 /*
871 *------------------------------------------------------------------
872 * return resolution
873 *------------------------------------------------------------------
874 */
875 return( jpeg );
876 }
877
878 /*
879 +-------------------------------------------------------------------+
880 | PROJECT : GSM-PS (6147) MODULE : CMH_T30 |
881 | ROUTINE : cmhT30_RstNgtPrms |
882 +-------------------------------------------------------------------+
883
884 PURPOSE : reset negotiated parameters.
885
886 */
887
888 GLOBAL void cmhT30_RstNgtPrms( void )
889 {
890 t30NgtPrms.FCSvr = F_VR_NotPresent;
891 t30NgtPrms.FCSbr = F_BR_NotPresent;
892 t30NgtPrms.FCSwd = F_WD_NotPresent;
893 t30NgtPrms.FCSln = F_LN_NotPresent;
894 t30NgtPrms.FCSdf = F_DF_NotPresent;
895 t30NgtPrms.FCSec = F_EC_NotPresent;
896 t30NgtPrms.FCSbf = F_BF_NotPresent;
897 t30NgtPrms.FCSst = F_ST_NotPresent;
898 t30NgtPrms.FCSjp = F_JP_NotPresent;
899 }
900
901 /*
902 +-------------------------------------------------------------------+
903 | PROJECT : GSM-PS (6147) MODULE : CMH_T30 |
904 | ROUTINE : cmhT30_InitFAXPrms |
905 +-------------------------------------------------------------------+
906
907 PURPOSE : intialize FAX parameter for the passed command id
908
909 */
910
911 GLOBAL void cmhT30_InitFAXPrms ( T_ACI_CMD_SRC srcId )
912 {
913
914 T_T30_CMD_PRM * pT30CmdPrm; /* points to T30 command parameters */
915
916 pT30CmdPrm = &fnd_cmhPrm[srcId].t30CmdPrm;
917
918
919 pT30CmdPrm -> FCLASSclass = FCLASS_CLASS_Data;
920 pT30CmdPrm -> FCRval = FCR_VAL_RcvCap;
921 pT30CmdPrm -> FCCvr = F_VR_R8X3_85;
922 pT30CmdPrm -> FCCbr = F_BR_9600;
923 pT30CmdPrm -> FCCwd = F_WD_1728;
924 pT30CmdPrm -> FCCln = F_LN_A4;
925 pT30CmdPrm -> FCCdf = F_DF_1D_MdfHuff;
926 pT30CmdPrm -> FCCec = F_EC_DisableECM;
927 pT30CmdPrm -> FCCbf = F_BF_DisableFileTrnsf;
928 pT30CmdPrm -> FCCst = F_ST_0_0;
929 pT30CmdPrm -> FCCjp = F_JP_DisableJPEG;
930 pT30CmdPrm -> FISvr = F_VR_R8X3_85;
931 pT30CmdPrm -> FISbr = F_BR_9600;
932 pT30CmdPrm -> FISwd = F_WD_1728;
933 pT30CmdPrm -> FISln = F_LN_A4;
934 pT30CmdPrm -> FISdf = F_DF_1D_MdfHuff;
935 pT30CmdPrm -> FISec = F_EC_DisableECM;
936 pT30CmdPrm -> FISbf = F_BF_DisableFileTrnsf;
937 pT30CmdPrm -> FISst = F_ST_0_0;
938 pT30CmdPrm -> FISjp = F_JP_DisableJPEG;
939 pT30CmdPrm -> FLIstr[0] = 0x0;
940 pT30CmdPrm -> FPIstr[0] = 0x0;
941 pT30CmdPrm -> FLPval = FLP_VAL_NoPollDoc;
942 pT30CmdPrm -> FAPsub = FAP_VAL_Disabled;
943 pT30CmdPrm -> FAPsep = FAP_VAL_Disabled;
944 pT30CmdPrm -> FAPpwd = FAP_VAL_Disabled;
945 pT30CmdPrm -> FSAsub[0] = 0x0;
946 pT30CmdPrm -> FPAsep[0] = 0x0;
947 pT30CmdPrm -> FPWpwd[0] = 0x0;
948 pT30CmdPrm -> FNSlen = 0;
949 pT30CmdPrm -> FCQrq = FCQ_RQ_CQCEnabled;
950 pT30CmdPrm -> FMSbr = F_BR_2400;
951 pT30CmdPrm -> FPSppr = FPS_PPR_Mcf;
952 pT30CmdPrm -> FSPval = FSP_VAL_PollDisabled;
953 pT30CmdPrm -> FIEval = FIE_VAL_IgnorePRI;
954 pT30CmdPrm -> FITact = FIT_ACT_OnHookRst;
955 pT30CmdPrm -> FITtime = 0;
956 pT30CmdPrm -> FBOval = FBO_VAL_DirCDirBD;
957
958 }
959
960 /*
961 +-------------------------------------------------------------------+
962 | PROJECT : GSM-PS (6147) MODULE : CMH_T30 |
963 | ROUTINE : cmhT30_NgtDCEPrms |
964 +-------------------------------------------------------------------+
965
966 PURPOSE : negotiate DCE parameters.
967
968 */
969
970 GLOBAL void cmhT30_NgtDCEPrms( T_ACI_CMD_SRC srcId )
971 {
972 T_dis * pDCECaps; /* points to DCE capabilities */
973 T_T30_CMD_PRM * pT30CmdPrm; /* points to T30 command parameters */
974 SHORT bitPos = 0; /* holds bit position */
975 BOOL lclMtrcFlg, lclInchFlg; /* flags found local metric and
976 inch resolution */
977 BOOL lclCapFlg; /* flags found local capability */
978 BOOL rmtMtrcFlg, rmtInchFlg; /* flags found remote metric and
979 inch resolution */
980 BOOL rmtCapFlg; /* flags found remote capability */
981 UBYTE lclMtrc, rmtMtrc; /* holds local and remote metric
982 resolutions */
983 UBYTE lclInch, rmtInch; /* holds local and remote inch
984 resolutions */
985 UBYTE lclCap, rmtCap; /* holds local and remote capability */
986 UBYTE vrMtrc; /* holds common metric resolution */
987 UBYTE vrInch; /* holds common inch resolution */
988 T_ACI_F_BR TCHbr; /* holds bit rate of TCH */
989
990 pT30CmdPrm = &fnd_cmhPrm[srcId].t30CmdPrm;
991
992 if( t30ShrdPrm.hdlc_rcv.v_dis EQ TRUE )
993 pDCECaps = (T_dis *)&t30ShrdPrm.hdlc_rcv.dis;
994
995 else if( t30ShrdPrm.hdlc_rcv.v_dtc EQ TRUE )
996 pDCECaps = (T_dis *)&t30ShrdPrm.hdlc_rcv.dtc;
997
998 else
999 {
1000 TRACE_EVENT("NO CAPABILITES AVAILABLE FOR NEGOTIATION");
1001 return;
1002 }
1003
1004 /*
1005 *------------------------------------------------------------------
1006 * negotiate resolution capabilities
1007 *------------------------------------------------------------------
1008 */
1009 lclMtrcFlg = 0;
1010 lclInchFlg = 0;
1011 rmtMtrcFlg = 0;
1012 rmtInchFlg = 0;
1013 lclMtrc = (UBYTE)(pT30CmdPrm -> FISvr & 0x0F);
1014 rmtMtrc = (UBYTE)(cmhT30_GetResolution(pDCECaps,FRT_DIS)
1015 & 0x0F);
1016 lclInch = (UBYTE)((pT30CmdPrm -> FISvr & 0xF0)>>4);
1017 rmtInch = (UBYTE)((cmhT30_GetResolution(pDCECaps,FRT_DIS)
1018 & 0xF0)>>4);
1019 vrMtrc = 0;
1020 vrInch = 0;
1021
1022 for( bitPos = 3; bitPos >= 0; bitPos-- )
1023 {
1024 if( !lclMtrcFlg ) lclMtrcFlg = ((lclMtrc>>bitPos)&0x01);
1025 if( !rmtMtrcFlg ) rmtMtrcFlg = ((rmtMtrc>>bitPos)&0x01);
1026 if( !lclInchFlg ) lclInchFlg = ((lclInch>>bitPos)&0x01);
1027 if( !rmtInchFlg ) rmtInchFlg = ((rmtInch>>bitPos)&0x01);
1028
1029 if( lclMtrcFlg AND rmtMtrcFlg AND !vrMtrc )
1030 vrMtrc = 0x01<<bitPos;
1031
1032 if( lclInchFlg AND rmtInchFlg AND !vrInch )
1033 vrInch = 0x01<<bitPos;
1034 }
1035
1036 if( vrMtrc AND vrInch)
1037 {
1038 t30NgtPrms.FCSvr = (vrMtrc <= vrInch)?vrMtrc:vrInch;
1039 }
1040 else if( vrMtrc ) t30NgtPrms.FCSvr = vrMtrc;
1041 else t30NgtPrms.FCSvr = vrInch;
1042
1043 /*
1044 *------------------------------------------------------------------
1045 * negotiate bit rate capabilities
1046 *------------------------------------------------------------------
1047 */
1048 t30NgtPrms.FCSbr = cmhT30_Chn2BitRate();
1049 t30NgtPrms.FCSbr = MINIMUM(pT30CmdPrm->FISbr, t30NgtPrms.FCSbr);
1050 TCHbr = cmhT30_GetBitRate(pDCECaps, FRT_DIS);
1051 t30NgtPrms.FCSbr = MINIMUM(t30NgtPrms.FCSbr, TCHbr);
1052
1053 /*
1054 *------------------------------------------------------------------
1055 * negotiate page width capabilities
1056 *------------------------------------------------------------------
1057 */
1058 t30NgtPrms.FCSwd = cmhT30_GetPageWidth(pDCECaps);
1059 t30NgtPrms.FCSwd = MINIMUM(pT30CmdPrm->FISwd, t30NgtPrms.FCSwd);
1060 /*
1061 *------------------------------------------------------------------
1062 * negotiate page length capabilities
1063 *------------------------------------------------------------------
1064 */
1065 t30NgtPrms.FCSln = cmhT30_GetPageLength(pDCECaps);
1066 t30NgtPrms.FCSln = MINIMUM(pT30CmdPrm->FISln, t30NgtPrms.FCSln);
1067 /*
1068 *------------------------------------------------------------------
1069 * negotiate data compression capabilities
1070 *------------------------------------------------------------------
1071 */
1072 t30NgtPrms.FCSdf = cmhT30_GetDataComp(pDCECaps);
1073 t30NgtPrms.FCSdf = MINIMUM(pT30CmdPrm->FISdf, t30NgtPrms.FCSdf);
1074 /*
1075 *------------------------------------------------------------------
1076 * negotiate error correction capabilities
1077 *------------------------------------------------------------------
1078 */
1079 t30NgtPrms.FCSec = cmhT30_GetErrCorr(pDCECaps);
1080 t30NgtPrms.FCSec = MINIMUM(pT30CmdPrm -> FISec, t30NgtPrms.FCSec);
1081 /*
1082 *------------------------------------------------------------------
1083 * negotiate file transfer capabilities
1084 *------------------------------------------------------------------
1085 */
1086 lclCapFlg = 0;
1087 rmtCapFlg = 0;
1088 lclCap = (UBYTE)pT30CmdPrm -> FISbf;
1089 rmtCap = (UBYTE)cmhT30_GetFileTrnsfr(pDCECaps);
1090 t30NgtPrms.FCSbf = 0;
1091
1092 for( bitPos = 7; bitPos >= 0; bitPos-- )
1093 {
1094 if( !lclCapFlg ) lclCapFlg = ((lclCap>>bitPos)&0x01);
1095 if( !rmtCapFlg ) rmtCapFlg = ((rmtCap>>bitPos)&0x01);
1096
1097 if( lclCapFlg AND rmtCapFlg AND !t30NgtPrms.FCSbf )
1098 {
1099 t30NgtPrms.FCSbf = 0x01<<bitPos;
1100 break;
1101 }
1102 }
1103
1104 /*
1105 *------------------------------------------------------------------
1106 * negotiate scan time capabilities
1107 *------------------------------------------------------------------
1108 */
1109 t30NgtPrms.FCSst = cmhT30_GetScanTime(pDCECaps);
1110 t30NgtPrms.FCSst = MAXIMUM(pT30CmdPrm->FISst, t30NgtPrms.FCSst);
1111 /*
1112 *------------------------------------------------------------------
1113 * negotiate JPEG capabilities
1114 *------------------------------------------------------------------
1115 */
1116 lclCapFlg = 0;
1117 rmtCapFlg = 0;
1118 lclCap = (UBYTE)pT30CmdPrm -> FISjp;
1119 rmtCap = (UBYTE)cmhT30_GetJPEG(pDCECaps);
1120 t30NgtPrms.FCSjp = 0;
1121
1122 for( bitPos = 7; bitPos >= 0; bitPos-- )
1123 {
1124 if( !lclCapFlg ) lclCapFlg = ((lclCap>>bitPos)&0x01);
1125 if( !rmtCapFlg ) rmtCapFlg = ((rmtCap>>bitPos)&0x01);
1126
1127 if( lclCapFlg AND rmtCapFlg AND !t30NgtPrms.FCSjp )
1128 {
1129 t30NgtPrms.FCSjp = 0x01<<bitPos;
1130 break;
1131 }
1132 }
1133 }
1134
1135 /*
1136 +-------------------------------------------------------------------+
1137 | PROJECT : GSM-PS (6147) MODULE : CMH_T30 |
1138 | ROUTINE : cmhT30_BuildSndFrm |
1139 +-------------------------------------------------------------------+
1140
1141 PURPOSE : build send frame according the passed frame type with the
1142 settings of the passed owner.
1143
1144 */
1145
1146 GLOBAL void cmhT30_BuildSndFrm( T_ACI_CMD_SRC srcId,
1147 T_T30_FRTP frmTyp )
1148 {
1149 T_dis * pFrm; /* points to frame */
1150 T_T30_CMD_PRM * pT30CmdPrm; /* points to T30 command parameters */
1151 T_ACI_F_VR vr; /* holds selected resolution */
1152 T_ACI_F_BR br; /* holds selected bit rate */
1153 T_ACI_F_WD wd; /* holds selected page width */
1154 T_ACI_F_LN ln; /* holds selected page length */
1155 T_ACI_F_DF df; /* holds selected data compression */
1156 T_ACI_F_EC ec; /* holds selected error correction */
1157 T_ACI_F_BF bf; /* holds selected file transfer mode */
1158 T_ACI_F_ST st; /* holds selected scan time */
1159 T_ACI_F_JP jp; /* holds selected JPEG mode */
1160
1161 pT30CmdPrm = &fnd_cmhPrm[srcId].t30CmdPrm;
1162
1163 /*
1164 *------------------------------------------------------------------
1165 * determine frame type to build
1166 *------------------------------------------------------------------
1167 */
1168 switch( frmTyp )
1169 {
1170 case( FRT_DIS ):
1171
1172 t30ShrdPrm.hdlc_snd.v_dis = TRUE;
1173 pFrm = (T_dis *)&t30ShrdPrm.hdlc_snd.dis;
1174 vr = pT30CmdPrm -> FISvr;
1175 br = pT30CmdPrm -> FISbr;
1176 wd = pT30CmdPrm -> FISwd;
1177 ln = pT30CmdPrm -> FISln;
1178 df = pT30CmdPrm -> FISdf;
1179 ec = pT30CmdPrm -> FISec;
1180 bf = pT30CmdPrm -> FISbf;
1181 st = pT30CmdPrm -> FISst;
1182 jp = pT30CmdPrm -> FISjp;
1183 break;
1184
1185 case( FRT_DTC ):
1186
1187 t30ShrdPrm.hdlc_snd.v_dtc = TRUE;
1188 pFrm = (T_dis *)&t30ShrdPrm.hdlc_snd.dtc;
1189 vr = pT30CmdPrm -> FISvr;
1190 br = pT30CmdPrm -> FISbr;
1191 wd = pT30CmdPrm -> FISwd;
1192 ln = pT30CmdPrm -> FISln;
1193 df = pT30CmdPrm -> FISdf;
1194 ec = pT30CmdPrm -> FISec;
1195 bf = pT30CmdPrm -> FISbf;
1196 st = pT30CmdPrm -> FISst;
1197 jp = pT30CmdPrm -> FISjp;
1198 break;
1199
1200 case( FRT_DCS ):
1201
1202 t30ShrdPrm.hdlc_snd.v_dcs = TRUE;
1203 pFrm = (T_dis *)&t30ShrdPrm.hdlc_snd.dcs;
1204 vr = t30NgtPrms.FCSvr;
1205 br = t30NgtPrms.FCSbr;
1206 wd = t30NgtPrms.FCSwd;
1207 ln = t30NgtPrms.FCSln;
1208 df = t30NgtPrms.FCSdf;
1209 ec = t30NgtPrms.FCSec;
1210 bf = t30NgtPrms.FCSbf;
1211 st = t30NgtPrms.FCSst;
1212 jp = t30NgtPrms.FCSjp;
1213 break;
1214
1215 default:
1216 TRACE_ERROR("WRONG FRAME TYPE in cmhT30_BuildSndFrm()");
1217 return;
1218 }
1219
1220 /*
1221 *------------------------------------------------------------------
1222 * build frame
1223 *------------------------------------------------------------------
1224 */
1225 /*
1226 *----------------------------------------------------------------
1227 * default settings
1228 *----------------------------------------------------------------
1229 */
1230 pFrm -> v8 = 0; /* BIT 6 */
1231 pFrm -> n_byte = 0; /* BIT 7 */
1232 pFrm -> frame_size = 0; /* BIT 28 */
1233 pFrm -> min_scan_time_hr = 0; /* BIT 46 */
1234 pFrm -> ready_tx_doc = 0; /* BIT 51 */
1235 pFrm -> ready_tx_mixed = 0; /* BIT 59 */
1236 pFrm -> dig_network_cap = 0; /* BIT 66 */
1237 pFrm -> na_letter = 0; /* BIT 76 */
1238 pFrm -> na_legal = 0; /* BIT 77 */
1239 pFrm -> sing_prog_seq_coding_basic = 0; /* BIT 78 */
1240 pFrm -> sing_prog_seq_coding_L0 = 0; /* BIT 79 */
1241
1242
1243 /*
1244 *----------------------------------------------------------------
1245 * bit settings different for DIS/DTC and DCS frames
1246 *----------------------------------------------------------------
1247 */
1248 pFrm -> ready_tx_fax = ( frmTyp EQ FRT_DCS )? /* BIT 9 */
1249 0 : pT30CmdPrm -> FLPval;
1250 pFrm -> rec_fax_op = ( frmTyp EQ FRT_DCS )? /* BIT 10 */
1251 1 : pT30CmdPrm -> FCRval;
1252 pFrm -> sel_polling = (frmTyp EQ FRT_DCS)? /* BIT 47 */
1253 0 : pT30CmdPrm -> FAPsep;
1254
1255 if( frmTyp EQ FRT_DCS ) /* BIT 49 */
1256 pFrm -> subaddr = ( pT30CmdPrm -> FSAsub[0] NEQ 0x0 )? 1 : 0;
1257 else
1258 pFrm -> subaddr = pT30CmdPrm -> FAPsub;
1259
1260 if( frmTyp EQ FRT_DCS ) /* BIT 50 */
1261 pFrm -> password = ( pT30CmdPrm -> FPWpwd[0] NEQ 0x0 )? 1 : 0;
1262 else
1263 pFrm -> password = pT30CmdPrm -> FAPpwd;
1264
1265 /*
1266 *----------------------------------------------------------------
1267 * bit settings concerning the bit rate
1268 *----------------------------------------------------------------
1269 */
1270 switch( br ) /* BIT 11-14 */
1271 {
1272 case( F_BR_2400 ):
1273 pFrm -> data_sig_rate = 0; break;
1274 case( F_BR_4800 ):
1275 pFrm -> data_sig_rate = 4; break;
1276 case( F_BR_7200 ):
1277 pFrm -> data_sig_rate = (frmTyp EQ FRT_DCS)? 12: 4; break;
1278 case( F_BR_9600 ):
1279 pFrm -> data_sig_rate = 8; break;
1280 case( F_BR_12000 ):
1281 pFrm -> data_sig_rate = (frmTyp EQ FRT_DCS)? 5: 8; break;
1282 case( F_BR_14400 ):
1283 pFrm -> data_sig_rate = (frmTyp EQ FRT_DCS)? 1:13; break;
1284 }
1285
1286 /*
1287 *----------------------------------------------------------------
1288 * bit settings concerning the resolution
1289 *----------------------------------------------------------------
1290 */
1291 pFrm -> R8_lines_pels = 0; /* BIT 15 */
1292 pFrm -> m_res_pref = 0; /* BIT 45 */
1293 pFrm -> i_res_pref = 0; /* BIT 44 */
1294 pFrm -> R8_lines = 0; /* BIT 41 */
1295 pFrm -> r_300_pels = 0; /* BIT 42 */
1296 pFrm -> R16_lines_pels = 0; /* BIT 43 */
1297
1298 if( frmTyp EQ FRT_DCS ) /* for a DCS-frame */
1299 {
1300 switch( vr )
1301 {
1302 case( F_VR_R8X3_85 ):
1303 pFrm -> m_res_pref = 1; break;
1304
1305 case( F_VR_R8X7_7 ):
1306 pFrm -> R8_lines_pels = 1; pFrm -> m_res_pref = 1; break;
1307
1308 case( F_VR_R8X15_4 ):
1309 pFrm -> m_res_pref = 1; pFrm -> R8_lines = 1; break;
1310
1311 case( F_VR_R16X15_4 ):
1312 pFrm -> m_res_pref = 1; pFrm -> R16_lines_pels = 1; break;
1313
1314 case( F_VR_200X100 ):
1315 pFrm -> i_res_pref = 1; break;
1316
1317 case( F_VR_200X200 ):
1318 pFrm -> R8_lines_pels = 1; pFrm -> i_res_pref = 1; break;
1319
1320 case( F_VR_200X400 ):
1321 pFrm -> i_res_pref = 1; pFrm -> R16_lines_pels = 1; break;
1322
1323 case( F_VR_300X300 ):
1324 pFrm -> i_res_pref = 1; pFrm -> r_300_pels = 1; break;
1325 }
1326 }
1327 else /* for a DIS/DTC-frame */
1328 {
1329 pFrm -> R8_lines_pels = 0;
1330 pFrm -> m_res_pref = 1;
1331
1332 if( vr & F_VR_R8X7_7 )
1333 { pFrm -> R8_lines_pels = 1; }
1334
1335 if( vr & F_VR_R8X15_4 )
1336 { pFrm -> R8_lines = 1; }
1337
1338 if( vr & F_VR_R16X15_4 )
1339 { pFrm -> R16_lines_pels = 1; }
1340
1341 if( vr & F_VR_200X100 )
1342 { pFrm -> R8_lines_pels = 0; pFrm -> i_res_pref = 1; }
1343
1344 if( vr & F_VR_200X200 )
1345 { pFrm -> R8_lines_pels = 1; pFrm -> i_res_pref = 1; }
1346
1347 if( vr & F_VR_200X400 )
1348 { pFrm -> R16_lines_pels = 1; pFrm -> i_res_pref = 1; }
1349
1350 if( vr & F_VR_300X300 )
1351 { pFrm -> r_300_pels = 1; pFrm -> i_res_pref = 1; }
1352 }
1353
1354 /*
1355 *----------------------------------------------------------------
1356 * bit settings concerning the data compression format
1357 *----------------------------------------------------------------
1358 */
1359 pFrm -> two_dim_coding = 0; /* BIT 16 */
1360 pFrm -> uncomp_mode = 0; /* BIT 26 */
1361 pFrm -> err_corr_mode = 0; /* BIT 27 */
1362 pFrm -> t6_coding = 0; /* BIT 31 */
1363
1364 switch( df )
1365 {
1366 case( F_DF_1D_MdfHuff ):
1367 break;
1368
1369 case( F_DF_2D_MdfRd_T4 ):
1370 pFrm -> two_dim_coding = 1;
1371 break;
1372
1373 case( F_DF_2D_Uncomp ):
1374 pFrm -> two_dim_coding = 1;
1375 pFrm -> uncomp_mode = 1;
1376 break;
1377
1378 case( F_DF_2D_MdfRd_T6 ):
1379 pFrm -> two_dim_coding = 1;
1380 pFrm -> err_corr_mode = 1;
1381 pFrm -> t6_coding = 1;
1382 break;
1383 }
1384
1385 /*
1386 *----------------------------------------------------------------
1387 * bit settings concerning the page width
1388 *----------------------------------------------------------------
1389 */
1390 switch( wd ) /* BIT 17-18 */
1391 {
1392 case( F_WD_1728 ): pFrm -> rec_width = 0; break;
1393
1394 case( F_WD_2048 ): pFrm -> rec_width = 2; break;
1395
1396 case( F_WD_2432 ): pFrm -> rec_width = 1; break;
1397
1398 case( F_WD_1216 ):
1399 case( F_WD_864 ): pFrm -> rec_width = 3; break;
1400 }
1401
1402 /*
1403 *----------------------------------------------------------------
1404 * bit settings concerning the page length
1405 *----------------------------------------------------------------
1406 */
1407 switch( ln ) /* BIT 19-20 */
1408 {
1409 case( F_LN_A4 ): pFrm -> max_rec_len = 0; break;
1410
1411 case( F_LN_B4 ): pFrm -> max_rec_len = 2; break;
1412
1413 case( F_LN_Unlimited ): pFrm -> max_rec_len = 1; break;
1414 }
1415
1416 /*
1417 *----------------------------------------------------------------
1418 * bit settings concerning the scan time
1419 *----------------------------------------------------------------
1420 */
1421 switch( st ) /* BIT 21-23 */
1422 {
1423 case( F_ST_0_0 ):
1424 pFrm -> min_scan_time = 7; break;
1425
1426 case( F_ST_5_5 ):
1427 pFrm -> min_scan_time = 4; break;
1428
1429 case( F_ST_10_5 ):
1430 pFrm -> min_scan_time = (frmTyp EQ FRT_DCS)? 2 : 3; break;
1431
1432 case( F_ST_10_10 ):
1433 pFrm -> min_scan_time = 2; break;
1434
1435 case( F_ST_20_10 ):
1436 pFrm -> min_scan_time = (frmTyp EQ FRT_DCS)? 0 : 6; break;
1437
1438 case( F_ST_20_20 ):
1439 pFrm -> min_scan_time = 0; break;
1440
1441 case( F_ST_40_20 ):
1442 pFrm -> min_scan_time = ( frmTyp EQ FRT_DCS)? 1 : 5; break;
1443
1444 case( F_ST_40_40 ):
1445 pFrm -> min_scan_time = 1; break;
1446 }
1447
1448 /*
1449 *----------------------------------------------------------------
1450 * bit settings concerning the error correction mode
1451 *----------------------------------------------------------------
1452 */
1453 pFrm -> err_corr_mode = 0; /* BIT 27*/
1454 pFrm -> duplex = 0; /* BIT 67*/
1455
1456 switch( ec )
1457 {
1458 case( F_EC_DisableECM ):
1459 break;
1460
1461 case( F_EC_EnableECM ):
1462 pFrm -> err_corr_mode = 1; pFrm -> duplex = 0; break;
1463
1464 case( F_EC_EnableHalfDup ):
1465 pFrm -> err_corr_mode = 1; pFrm -> duplex = 0; break;
1466
1467 case( F_EC_EnableFullDup ):
1468 pFrm -> err_corr_mode = 1; pFrm -> duplex = 1; break;
1469 }
1470
1471 /*
1472 *----------------------------------------------------------------
1473 * bit settings concerning the file transfer mode
1474 *----------------------------------------------------------------
1475 */
1476 pFrm -> bft = 0; /* BIT 53 */
1477 pFrm -> dtm = 0; /* BIT 54 */
1478 pFrm -> edi = 0; /* BIT 55 */
1479 pFrm -> btm = 0; /* BIT 57 */
1480 pFrm -> char_mode = 0; /* BIT 60 */
1481 pFrm -> mixed_mode = 0; /* BIT 62 */
1482 pFrm -> proc_mode_26 = 0; /* BIT 65 */
1483
1484 if( bf & F_BF_EnableBFT ) pFrm -> bft = 1;
1485
1486 if( bf & F_BF_DocuTrnsfMode ) pFrm -> dtm = 1;
1487
1488 if( bf & F_BF_EdifactMode ) pFrm -> edi = 1;
1489
1490 if( bf & F_BF_BasicTrnsfMode ) pFrm -> btm = 1;
1491
1492 if( bf & F_BF_CharMode ) pFrm -> char_mode = 1;
1493
1494 if( bf & F_BF_MixMode ) pFrm -> mixed_mode = 1;
1495
1496 if( bf & F_BF_ProcMode ) pFrm -> proc_mode_26 = 1;
1497
1498 /*
1499 *----------------------------------------------------------------
1500 * bit settings concerning the JPEG mode
1501 *----------------------------------------------------------------
1502 */
1503 pFrm -> jpeg = 0; /* BIT 68 */
1504 pFrm -> full_colour = 0; /* BIT 69 */
1505 pFrm -> huffman_tables = 0; /* BIT 70 */
1506 pFrm -> r_12_bits_pel_comp = 0; /* BIT 71 */
1507 pFrm -> no_subsamp = 0; /* BIT 73 */
1508 pFrm -> cust_illum = 0; /* BIT 74 */
1509 pFrm -> cust_gamut = 0; /* BIT 75 */
1510
1511 if( jp & F_JP_EnableJPEG ) pFrm -> jpeg = 1;
1512
1513 if( jp & F_JP_FullColor ) pFrm -> full_colour = 1;
1514
1515 if( jp & F_JP_EnablePrefHuff AND
1516 frmTyp EQ FRT_DCS ) pFrm -> huffman_tables = 1;
1517
1518 if( jp & F_JP_12BitsPelComp ) pFrm -> r_12_bits_pel_comp = 1;
1519
1520 if( jp & F_JP_NoSubsmpl ) pFrm -> no_subsamp = 1;
1521
1522 if( jp & F_JP_CustIllum ) pFrm -> cust_illum = 1;
1523
1524 if( jp & F_JP_CustGamutRange ) pFrm -> cust_gamut = 1;
1525
1526 }
1527
1528 /*
1529 +-------------------------------------------------------------------+
1530 | PROJECT : GSM-PS (6147) MODULE : CMH_T30 |
1531 | ROUTINE : cmhT30_StartFIT |
1532 +-------------------------------------------------------------------+
1533
1534 PURPOSE : start FAX inactivity timer
1535
1536 */
1537
1538 GLOBAL void cmhT30_StartFIT ( void )
1539 {
1540 TRACE_FUNCTION( "cmhT30_StartFIT()" );
1541
1542 if( t30ShrdPrm.faxStat NEQ NO_VLD_FS AND
1543 fnd_cmhPrm[t30EntStat.entOwn].t30CmdPrm.FITtime NEQ 0 )
1544 {
1545 TIMERSTART( fnd_cmhPrm[t30EntStat.entOwn].t30CmdPrm.FITtime, FIT_RUN );
1546 FITRunFlg = TRUE;
1547 }
1548 }
1549
1550 /*
1551 +-------------------------------------------------------------------+
1552 | PROJECT : GSM-PS (6147) MODULE : CMH_T30 |
1553 | ROUTINE : cmhT30_StopFIT |
1554 +-------------------------------------------------------------------+
1555
1556 PURPOSE : stop FAX inactivity timer
1557
1558 */
1559
1560 GLOBAL void cmhT30_StopFIT ( void )
1561 {
1562 TRACE_FUNCTION( "cmhT30_StopFIT()" );
1563
1564 if( FITRunFlg )
1565 {
1566 TIMERSTOP (FIT_RUN);
1567 FITRunFlg = FALSE;
1568 }
1569 }
1570 #endif /* DTI OR FF_FAX*/
1571 /*==== EOF ========================================================*/
1572
1573