FreeCalypso > hg > fc-magnetite
comparison src/g23m-aci/aci/cmh_t30f.c @ 162:53929b40109c
src/g23m-aci: initial import from TCS3.2/LoCosto
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 11 Oct 2016 02:02:43 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
161:4557e2a9c18e | 162:53929b40109c |
---|---|
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( MNCC_CHM_DATA_14_4 ): return( F_BR_14400 ); | |
79 case( MNCC_CHM_DATA_9_6 ): return( F_BR_9600 ); | |
80 case( MNCC_CHM_DATA_4_8 ): return( F_BR_4800 ); | |
81 case( MNCC_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( MNCC_CHM_DATA_14_4 ): return( 14400 ); | |
102 case( MNCC_CHM_DATA_9_6 ): return( 9600 ); | |
103 case( MNCC_CHM_DATA_4_8 ): return( 4800 ); | |
104 case( MNCC_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( MNCC_CH_TCH_F ): return( FALSE ); | |
150 case( MNCC_CH_TCH_H ): return( TRUE ); | |
151 default: TRACE_EVENT( "UNEXP CHN TYPE IN CTB" ); | |
152 return((BYTE)-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( MNCC_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( MNCC_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( MNCC_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( MNCC_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( BS_SPEED_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 = F_VR_R8X3_85; /* 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( F_VR_R8X7_7 ); | |
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 = F_BF_DisableFileTrnsf; /* 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 = F_JP_DisableJPEG; /* 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 = (T_ACI_F_VR)((vrMtrc <= vrInch)?vrMtrc:vrInch); | |
1039 } | |
1040 else if( vrMtrc ) | |
1041 { | |
1042 t30NgtPrms.FCSvr = (T_ACI_F_VR)vrMtrc; | |
1043 } | |
1044 else | |
1045 { | |
1046 t30NgtPrms.FCSvr = (T_ACI_F_VR)vrInch; | |
1047 } | |
1048 | |
1049 /* | |
1050 *------------------------------------------------------------------ | |
1051 * negotiate bit rate capabilities | |
1052 *------------------------------------------------------------------ | |
1053 */ | |
1054 t30NgtPrms.FCSbr = cmhT30_Chn2BitRate(); | |
1055 t30NgtPrms.FCSbr = MINIMUM(pT30CmdPrm->FISbr, t30NgtPrms.FCSbr); | |
1056 TCHbr = cmhT30_GetBitRate(pDCECaps, FRT_DIS); | |
1057 t30NgtPrms.FCSbr = MINIMUM(t30NgtPrms.FCSbr, TCHbr); | |
1058 | |
1059 /* | |
1060 *------------------------------------------------------------------ | |
1061 * negotiate page width capabilities | |
1062 *------------------------------------------------------------------ | |
1063 */ | |
1064 t30NgtPrms.FCSwd = cmhT30_GetPageWidth(pDCECaps); | |
1065 t30NgtPrms.FCSwd = MINIMUM(pT30CmdPrm->FISwd, t30NgtPrms.FCSwd); | |
1066 /* | |
1067 *------------------------------------------------------------------ | |
1068 * negotiate page length capabilities | |
1069 *------------------------------------------------------------------ | |
1070 */ | |
1071 t30NgtPrms.FCSln = cmhT30_GetPageLength(pDCECaps); | |
1072 t30NgtPrms.FCSln = MINIMUM(pT30CmdPrm->FISln, t30NgtPrms.FCSln); | |
1073 /* | |
1074 *------------------------------------------------------------------ | |
1075 * negotiate data compression capabilities | |
1076 *------------------------------------------------------------------ | |
1077 */ | |
1078 t30NgtPrms.FCSdf = cmhT30_GetDataComp(pDCECaps); | |
1079 t30NgtPrms.FCSdf = MINIMUM(pT30CmdPrm->FISdf, t30NgtPrms.FCSdf); | |
1080 /* | |
1081 *------------------------------------------------------------------ | |
1082 * negotiate error correction capabilities | |
1083 *------------------------------------------------------------------ | |
1084 */ | |
1085 t30NgtPrms.FCSec = cmhT30_GetErrCorr(pDCECaps); | |
1086 t30NgtPrms.FCSec = MINIMUM(pT30CmdPrm -> FISec, t30NgtPrms.FCSec); | |
1087 /* | |
1088 *------------------------------------------------------------------ | |
1089 * negotiate file transfer capabilities | |
1090 *------------------------------------------------------------------ | |
1091 */ | |
1092 lclCapFlg = 0; | |
1093 rmtCapFlg = 0; | |
1094 lclCap = (UBYTE)pT30CmdPrm -> FISbf; | |
1095 rmtCap = (UBYTE)cmhT30_GetFileTrnsfr(pDCECaps); | |
1096 t30NgtPrms.FCSbf = F_BF_DisableFileTrnsf; | |
1097 | |
1098 for( bitPos = 7; bitPos >= 0; bitPos-- ) | |
1099 { | |
1100 if( !lclCapFlg ) lclCapFlg = ((lclCap>>bitPos)&0x01); | |
1101 if( !rmtCapFlg ) rmtCapFlg = ((rmtCap>>bitPos)&0x01); | |
1102 | |
1103 if( lclCapFlg AND rmtCapFlg AND !t30NgtPrms.FCSbf ) | |
1104 { | |
1105 t30NgtPrms.FCSbf = (T_ACI_F_BF)(0x01<<bitPos); | |
1106 break; | |
1107 } | |
1108 } | |
1109 | |
1110 /* | |
1111 *------------------------------------------------------------------ | |
1112 * negotiate scan time capabilities | |
1113 *------------------------------------------------------------------ | |
1114 */ | |
1115 t30NgtPrms.FCSst = cmhT30_GetScanTime(pDCECaps); | |
1116 t30NgtPrms.FCSst = MAXIMUM(pT30CmdPrm->FISst, t30NgtPrms.FCSst); | |
1117 /* | |
1118 *------------------------------------------------------------------ | |
1119 * negotiate JPEG capabilities | |
1120 *------------------------------------------------------------------ | |
1121 */ | |
1122 lclCapFlg = 0; | |
1123 rmtCapFlg = 0; | |
1124 lclCap = (UBYTE)pT30CmdPrm -> FISjp; | |
1125 rmtCap = (UBYTE)cmhT30_GetJPEG(pDCECaps); | |
1126 t30NgtPrms.FCSjp = F_JP_DisableJPEG; | |
1127 | |
1128 for( bitPos = 7; bitPos >= 0; bitPos-- ) | |
1129 { | |
1130 if( !lclCapFlg ) lclCapFlg = ((lclCap>>bitPos)&0x01); | |
1131 if( !rmtCapFlg ) rmtCapFlg = ((rmtCap>>bitPos)&0x01); | |
1132 | |
1133 if( lclCapFlg AND rmtCapFlg AND !t30NgtPrms.FCSjp ) | |
1134 { | |
1135 t30NgtPrms.FCSjp = (T_ACI_F_JP)(0x01<<bitPos); | |
1136 break; | |
1137 } | |
1138 } | |
1139 } | |
1140 | |
1141 /* | |
1142 +-------------------------------------------------------------------+ | |
1143 | PROJECT : GSM-PS (6147) MODULE : CMH_T30 | | |
1144 | ROUTINE : cmhT30_BuildSndFrm | | |
1145 +-------------------------------------------------------------------+ | |
1146 | |
1147 PURPOSE : build send frame according the passed frame type with the | |
1148 settings of the passed owner. | |
1149 | |
1150 */ | |
1151 | |
1152 GLOBAL void cmhT30_BuildSndFrm( T_ACI_CMD_SRC srcId, | |
1153 T_T30_FRTP frmTyp ) | |
1154 { | |
1155 T_dis * pFrm; /* points to frame */ | |
1156 T_T30_CMD_PRM * pT30CmdPrm; /* points to T30 command parameters */ | |
1157 T_ACI_F_VR vr; /* holds selected resolution */ | |
1158 T_ACI_F_BR br; /* holds selected bit rate */ | |
1159 T_ACI_F_WD wd; /* holds selected page width */ | |
1160 T_ACI_F_LN ln; /* holds selected page length */ | |
1161 T_ACI_F_DF df; /* holds selected data compression */ | |
1162 T_ACI_F_EC ec; /* holds selected error correction */ | |
1163 T_ACI_F_BF bf; /* holds selected file transfer mode */ | |
1164 T_ACI_F_ST st; /* holds selected scan time */ | |
1165 T_ACI_F_JP jp; /* holds selected JPEG mode */ | |
1166 | |
1167 pT30CmdPrm = &fnd_cmhPrm[srcId].t30CmdPrm; | |
1168 | |
1169 /* | |
1170 *------------------------------------------------------------------ | |
1171 * determine frame type to build | |
1172 *------------------------------------------------------------------ | |
1173 */ | |
1174 switch( frmTyp ) | |
1175 { | |
1176 case( FRT_DIS ): | |
1177 | |
1178 t30ShrdPrm.hdlc_snd.v_dis = TRUE; | |
1179 pFrm = (T_dis *)&t30ShrdPrm.hdlc_snd.dis; | |
1180 vr = pT30CmdPrm -> FISvr; | |
1181 br = pT30CmdPrm -> FISbr; | |
1182 wd = pT30CmdPrm -> FISwd; | |
1183 ln = pT30CmdPrm -> FISln; | |
1184 df = pT30CmdPrm -> FISdf; | |
1185 ec = pT30CmdPrm -> FISec; | |
1186 bf = pT30CmdPrm -> FISbf; | |
1187 st = pT30CmdPrm -> FISst; | |
1188 jp = pT30CmdPrm -> FISjp; | |
1189 break; | |
1190 | |
1191 case( FRT_DTC ): | |
1192 | |
1193 t30ShrdPrm.hdlc_snd.v_dtc = TRUE; | |
1194 pFrm = (T_dis *)&t30ShrdPrm.hdlc_snd.dtc; | |
1195 vr = pT30CmdPrm -> FISvr; | |
1196 br = pT30CmdPrm -> FISbr; | |
1197 wd = pT30CmdPrm -> FISwd; | |
1198 ln = pT30CmdPrm -> FISln; | |
1199 df = pT30CmdPrm -> FISdf; | |
1200 ec = pT30CmdPrm -> FISec; | |
1201 bf = pT30CmdPrm -> FISbf; | |
1202 st = pT30CmdPrm -> FISst; | |
1203 jp = pT30CmdPrm -> FISjp; | |
1204 break; | |
1205 | |
1206 case( FRT_DCS ): | |
1207 | |
1208 t30ShrdPrm.hdlc_snd.v_dcs = TRUE; | |
1209 pFrm = (T_dis *)&t30ShrdPrm.hdlc_snd.dcs; | |
1210 vr = t30NgtPrms.FCSvr; | |
1211 br = t30NgtPrms.FCSbr; | |
1212 wd = t30NgtPrms.FCSwd; | |
1213 ln = t30NgtPrms.FCSln; | |
1214 df = t30NgtPrms.FCSdf; | |
1215 ec = t30NgtPrms.FCSec; | |
1216 bf = t30NgtPrms.FCSbf; | |
1217 st = t30NgtPrms.FCSst; | |
1218 jp = t30NgtPrms.FCSjp; | |
1219 break; | |
1220 | |
1221 default: | |
1222 TRACE_ERROR("WRONG FRAME TYPE in cmhT30_BuildSndFrm()"); | |
1223 return; | |
1224 } | |
1225 | |
1226 /* | |
1227 *------------------------------------------------------------------ | |
1228 * build frame | |
1229 *------------------------------------------------------------------ | |
1230 */ | |
1231 /* | |
1232 *---------------------------------------------------------------- | |
1233 * default settings | |
1234 *---------------------------------------------------------------- | |
1235 */ | |
1236 pFrm -> v8 = 0; /* BIT 6 */ | |
1237 pFrm -> n_byte = 0; /* BIT 7 */ | |
1238 pFrm -> frame_size = 0; /* BIT 28 */ | |
1239 pFrm -> min_scan_time_hr = 0; /* BIT 46 */ | |
1240 pFrm -> ready_tx_doc = 0; /* BIT 51 */ | |
1241 pFrm -> ready_tx_mixed = 0; /* BIT 59 */ | |
1242 pFrm -> dig_network_cap = 0; /* BIT 66 */ | |
1243 pFrm -> na_letter = 0; /* BIT 76 */ | |
1244 pFrm -> na_legal = 0; /* BIT 77 */ | |
1245 pFrm -> sing_prog_seq_coding_basic = 0; /* BIT 78 */ | |
1246 pFrm -> sing_prog_seq_coding_L0 = 0; /* BIT 79 */ | |
1247 | |
1248 | |
1249 /* | |
1250 *---------------------------------------------------------------- | |
1251 * bit settings different for DIS/DTC and DCS frames | |
1252 *---------------------------------------------------------------- | |
1253 */ | |
1254 pFrm -> ready_tx_fax = ( frmTyp EQ FRT_DCS )? /* BIT 9 */ | |
1255 0 : pT30CmdPrm -> FLPval; | |
1256 pFrm -> rec_fax_op = ( frmTyp EQ FRT_DCS )? /* BIT 10 */ | |
1257 1 : pT30CmdPrm -> FCRval; | |
1258 pFrm -> sel_polling = (frmTyp EQ FRT_DCS)? /* BIT 47 */ | |
1259 0 : pT30CmdPrm -> FAPsep; | |
1260 | |
1261 if( frmTyp EQ FRT_DCS ) /* BIT 49 */ | |
1262 pFrm -> subaddr = ( pT30CmdPrm -> FSAsub[0] NEQ 0x0 )? 1 : 0; | |
1263 else | |
1264 pFrm -> subaddr = pT30CmdPrm -> FAPsub; | |
1265 | |
1266 if( frmTyp EQ FRT_DCS ) /* BIT 50 */ | |
1267 pFrm -> password = ( pT30CmdPrm -> FPWpwd[0] NEQ 0x0 )? 1 : 0; | |
1268 else | |
1269 pFrm -> password = pT30CmdPrm -> FAPpwd; | |
1270 | |
1271 /* | |
1272 *---------------------------------------------------------------- | |
1273 * bit settings concerning the bit rate | |
1274 *---------------------------------------------------------------- | |
1275 */ | |
1276 switch( br ) /* BIT 11-14 */ | |
1277 { | |
1278 case( F_BR_2400 ): | |
1279 pFrm -> data_sig_rate = 0; break; | |
1280 case( F_BR_4800 ): | |
1281 pFrm -> data_sig_rate = 4; break; | |
1282 case( F_BR_7200 ): | |
1283 pFrm -> data_sig_rate = (frmTyp EQ FRT_DCS)? 12: 4; break; | |
1284 case( F_BR_9600 ): | |
1285 pFrm -> data_sig_rate = 8; break; | |
1286 case( F_BR_12000 ): | |
1287 pFrm -> data_sig_rate = (frmTyp EQ FRT_DCS)? 5: 8; break; | |
1288 case( F_BR_14400 ): | |
1289 pFrm -> data_sig_rate = (frmTyp EQ FRT_DCS)? 1:13; break; | |
1290 } | |
1291 | |
1292 /* | |
1293 *---------------------------------------------------------------- | |
1294 * bit settings concerning the resolution | |
1295 *---------------------------------------------------------------- | |
1296 */ | |
1297 pFrm -> R8_lines_pels = 0; /* BIT 15 */ | |
1298 pFrm -> m_res_pref = 0; /* BIT 45 */ | |
1299 pFrm -> i_res_pref = 0; /* BIT 44 */ | |
1300 pFrm -> R8_lines = 0; /* BIT 41 */ | |
1301 pFrm -> r_300_pels = 0; /* BIT 42 */ | |
1302 pFrm -> R16_lines_pels = 0; /* BIT 43 */ | |
1303 | |
1304 if( frmTyp EQ FRT_DCS ) /* for a DCS-frame */ | |
1305 { | |
1306 switch( vr ) | |
1307 { | |
1308 case( F_VR_R8X3_85 ): | |
1309 pFrm -> m_res_pref = 1; break; | |
1310 | |
1311 case( F_VR_R8X7_7 ): | |
1312 pFrm -> R8_lines_pels = 1; pFrm -> m_res_pref = 1; break; | |
1313 | |
1314 case( F_VR_R8X15_4 ): | |
1315 pFrm -> m_res_pref = 1; pFrm -> R8_lines = 1; break; | |
1316 | |
1317 case( F_VR_R16X15_4 ): | |
1318 pFrm -> m_res_pref = 1; pFrm -> R16_lines_pels = 1; break; | |
1319 | |
1320 case( F_VR_200X100 ): | |
1321 pFrm -> i_res_pref = 1; break; | |
1322 | |
1323 case( F_VR_200X200 ): | |
1324 pFrm -> R8_lines_pels = 1; pFrm -> i_res_pref = 1; break; | |
1325 | |
1326 case( F_VR_200X400 ): | |
1327 pFrm -> i_res_pref = 1; pFrm -> R16_lines_pels = 1; break; | |
1328 | |
1329 case( F_VR_300X300 ): | |
1330 pFrm -> i_res_pref = 1; pFrm -> r_300_pels = 1; break; | |
1331 } | |
1332 } | |
1333 else /* for a DIS/DTC-frame */ | |
1334 { | |
1335 pFrm -> R8_lines_pels = 0; | |
1336 pFrm -> m_res_pref = 1; | |
1337 | |
1338 if( vr & F_VR_R8X7_7 ) | |
1339 { pFrm -> R8_lines_pels = 1; } | |
1340 | |
1341 if( vr & F_VR_R8X15_4 ) | |
1342 { pFrm -> R8_lines = 1; } | |
1343 | |
1344 if( vr & F_VR_R16X15_4 ) | |
1345 { pFrm -> R16_lines_pels = 1; } | |
1346 | |
1347 if( vr & F_VR_200X100 ) | |
1348 { pFrm -> R8_lines_pels = 0; pFrm -> i_res_pref = 1; } | |
1349 | |
1350 if( vr & F_VR_200X200 ) | |
1351 { pFrm -> R8_lines_pels = 1; pFrm -> i_res_pref = 1; } | |
1352 | |
1353 if( vr & F_VR_200X400 ) | |
1354 { pFrm -> R16_lines_pels = 1; pFrm -> i_res_pref = 1; } | |
1355 | |
1356 if( vr & F_VR_300X300 ) | |
1357 { pFrm -> r_300_pels = 1; pFrm -> i_res_pref = 1; } | |
1358 } | |
1359 | |
1360 /* | |
1361 *---------------------------------------------------------------- | |
1362 * bit settings concerning the data compression format | |
1363 *---------------------------------------------------------------- | |
1364 */ | |
1365 pFrm -> two_dim_coding = 0; /* BIT 16 */ | |
1366 pFrm -> uncomp_mode = 0; /* BIT 26 */ | |
1367 pFrm -> err_corr_mode = 0; /* BIT 27 */ | |
1368 pFrm -> t6_coding = 0; /* BIT 31 */ | |
1369 | |
1370 switch( df ) | |
1371 { | |
1372 case( F_DF_1D_MdfHuff ): | |
1373 break; | |
1374 | |
1375 case( F_DF_2D_MdfRd_T4 ): | |
1376 pFrm -> two_dim_coding = 1; | |
1377 break; | |
1378 | |
1379 case( F_DF_2D_Uncomp ): | |
1380 pFrm -> two_dim_coding = 1; | |
1381 pFrm -> uncomp_mode = 1; | |
1382 break; | |
1383 | |
1384 case( F_DF_2D_MdfRd_T6 ): | |
1385 pFrm -> two_dim_coding = 1; | |
1386 pFrm -> err_corr_mode = 1; | |
1387 pFrm -> t6_coding = 1; | |
1388 break; | |
1389 } | |
1390 | |
1391 /* | |
1392 *---------------------------------------------------------------- | |
1393 * bit settings concerning the page width | |
1394 *---------------------------------------------------------------- | |
1395 */ | |
1396 switch( wd ) /* BIT 17-18 */ | |
1397 { | |
1398 case( F_WD_1728 ): pFrm -> rec_width = 0; break; | |
1399 | |
1400 case( F_WD_2048 ): pFrm -> rec_width = 2; break; | |
1401 | |
1402 case( F_WD_2432 ): pFrm -> rec_width = 1; break; | |
1403 | |
1404 case( F_WD_1216 ): | |
1405 case( F_WD_864 ): pFrm -> rec_width = 3; break; | |
1406 } | |
1407 | |
1408 /* | |
1409 *---------------------------------------------------------------- | |
1410 * bit settings concerning the page length | |
1411 *---------------------------------------------------------------- | |
1412 */ | |
1413 switch( ln ) /* BIT 19-20 */ | |
1414 { | |
1415 case( F_LN_A4 ): pFrm -> max_rec_len = 0; break; | |
1416 | |
1417 case( F_LN_B4 ): pFrm -> max_rec_len = 2; break; | |
1418 | |
1419 case( F_LN_Unlimited ): pFrm -> max_rec_len = 1; break; | |
1420 } | |
1421 | |
1422 /* | |
1423 *---------------------------------------------------------------- | |
1424 * bit settings concerning the scan time | |
1425 *---------------------------------------------------------------- | |
1426 */ | |
1427 switch( st ) /* BIT 21-23 */ | |
1428 { | |
1429 case( F_ST_0_0 ): | |
1430 pFrm -> min_scan_time = 7; break; | |
1431 | |
1432 case( F_ST_5_5 ): | |
1433 pFrm -> min_scan_time = 4; break; | |
1434 | |
1435 case( F_ST_10_5 ): | |
1436 pFrm -> min_scan_time = (frmTyp EQ FRT_DCS)? 2 : 3; break; | |
1437 | |
1438 case( F_ST_10_10 ): | |
1439 pFrm -> min_scan_time = 2; break; | |
1440 | |
1441 case( F_ST_20_10 ): | |
1442 pFrm -> min_scan_time = (frmTyp EQ FRT_DCS)? 0 : 6; break; | |
1443 | |
1444 case( F_ST_20_20 ): | |
1445 pFrm -> min_scan_time = 0; break; | |
1446 | |
1447 case( F_ST_40_20 ): | |
1448 pFrm -> min_scan_time = ( frmTyp EQ FRT_DCS)? 1 : 5; break; | |
1449 | |
1450 case( F_ST_40_40 ): | |
1451 pFrm -> min_scan_time = 1; break; | |
1452 } | |
1453 | |
1454 /* | |
1455 *---------------------------------------------------------------- | |
1456 * bit settings concerning the error correction mode | |
1457 *---------------------------------------------------------------- | |
1458 */ | |
1459 pFrm -> err_corr_mode = 0; /* BIT 27*/ | |
1460 pFrm -> duplex = 0; /* BIT 67*/ | |
1461 | |
1462 switch( ec ) | |
1463 { | |
1464 case( F_EC_DisableECM ): | |
1465 break; | |
1466 | |
1467 case( F_EC_EnableECM ): | |
1468 pFrm -> err_corr_mode = 1; pFrm -> duplex = 0; break; | |
1469 | |
1470 case( F_EC_EnableHalfDup ): | |
1471 pFrm -> err_corr_mode = 1; pFrm -> duplex = 0; break; | |
1472 | |
1473 case( F_EC_EnableFullDup ): | |
1474 pFrm -> err_corr_mode = 1; pFrm -> duplex = 1; break; | |
1475 } | |
1476 | |
1477 /* | |
1478 *---------------------------------------------------------------- | |
1479 * bit settings concerning the file transfer mode | |
1480 *---------------------------------------------------------------- | |
1481 */ | |
1482 pFrm -> bft = 0; /* BIT 53 */ | |
1483 pFrm -> dtm = 0; /* BIT 54 */ | |
1484 pFrm -> edi = 0; /* BIT 55 */ | |
1485 pFrm -> btm = 0; /* BIT 57 */ | |
1486 pFrm -> char_mode = 0; /* BIT 60 */ | |
1487 pFrm -> mixed_mode = 0; /* BIT 62 */ | |
1488 pFrm -> proc_mode_26 = 0; /* BIT 65 */ | |
1489 | |
1490 if( bf & F_BF_EnableBFT ) pFrm -> bft = 1; | |
1491 | |
1492 if( bf & F_BF_DocuTrnsfMode ) pFrm -> dtm = 1; | |
1493 | |
1494 if( bf & F_BF_EdifactMode ) pFrm -> edi = 1; | |
1495 | |
1496 if( bf & F_BF_BasicTrnsfMode ) pFrm -> btm = 1; | |
1497 | |
1498 if( bf & F_BF_CharMode ) pFrm -> char_mode = 1; | |
1499 | |
1500 if( bf & F_BF_MixMode ) pFrm -> mixed_mode = 1; | |
1501 | |
1502 if( bf & F_BF_ProcMode ) pFrm -> proc_mode_26 = 1; | |
1503 | |
1504 /* | |
1505 *---------------------------------------------------------------- | |
1506 * bit settings concerning the JPEG mode | |
1507 *---------------------------------------------------------------- | |
1508 */ | |
1509 pFrm -> jpeg = 0; /* BIT 68 */ | |
1510 pFrm -> full_colour = 0; /* BIT 69 */ | |
1511 pFrm -> huffman_tables = 0; /* BIT 70 */ | |
1512 pFrm -> r_12_bits_pel_comp = 0; /* BIT 71 */ | |
1513 pFrm -> no_subsamp = 0; /* BIT 73 */ | |
1514 pFrm -> cust_illum = 0; /* BIT 74 */ | |
1515 pFrm -> cust_gamut = 0; /* BIT 75 */ | |
1516 | |
1517 if( jp & F_JP_EnableJPEG ) pFrm -> jpeg = 1; | |
1518 | |
1519 if( jp & F_JP_FullColor ) pFrm -> full_colour = 1; | |
1520 | |
1521 if( jp & F_JP_EnablePrefHuff AND | |
1522 frmTyp EQ FRT_DCS ) pFrm -> huffman_tables = 1; | |
1523 | |
1524 if( jp & F_JP_12BitsPelComp ) pFrm -> r_12_bits_pel_comp = 1; | |
1525 | |
1526 if( jp & F_JP_NoSubsmpl ) pFrm -> no_subsamp = 1; | |
1527 | |
1528 if( jp & F_JP_CustIllum ) pFrm -> cust_illum = 1; | |
1529 | |
1530 if( jp & F_JP_CustGamutRange ) pFrm -> cust_gamut = 1; | |
1531 | |
1532 } | |
1533 | |
1534 /* | |
1535 +-------------------------------------------------------------------+ | |
1536 | PROJECT : GSM-PS (6147) MODULE : CMH_T30 | | |
1537 | ROUTINE : cmhT30_StartFIT | | |
1538 +-------------------------------------------------------------------+ | |
1539 | |
1540 PURPOSE : start FAX inactivity timer | |
1541 | |
1542 */ | |
1543 | |
1544 GLOBAL void cmhT30_StartFIT ( void ) | |
1545 { | |
1546 TRACE_FUNCTION( "cmhT30_StartFIT()" ); | |
1547 | |
1548 if( t30ShrdPrm.faxStat NEQ NO_VLD_FS AND | |
1549 fnd_cmhPrm[t30EntStat.entOwn].t30CmdPrm.FITtime NEQ 0 ) | |
1550 { | |
1551 TIMERSTART( fnd_cmhPrm[t30EntStat.entOwn].t30CmdPrm.FITtime, FIT_RUN ); | |
1552 FITRunFlg = TRUE; | |
1553 } | |
1554 } | |
1555 | |
1556 /* | |
1557 +-------------------------------------------------------------------+ | |
1558 | PROJECT : GSM-PS (6147) MODULE : CMH_T30 | | |
1559 | ROUTINE : cmhT30_StopFIT | | |
1560 +-------------------------------------------------------------------+ | |
1561 | |
1562 PURPOSE : stop FAX inactivity timer | |
1563 | |
1564 */ | |
1565 | |
1566 GLOBAL void cmhT30_StopFIT ( void ) | |
1567 { | |
1568 TRACE_FUNCTION( "cmhT30_StopFIT()" ); | |
1569 | |
1570 if( FITRunFlg ) | |
1571 { | |
1572 TIMERSTOP (FIT_RUN); | |
1573 FITRunFlg = FALSE; | |
1574 } | |
1575 } | |
1576 #endif /* DTI OR FF_FAX*/ | |
1577 /*==== EOF ========================================================*/ | |
1578 | |
1579 |