Merge branch 'rusty-cpumask-parisc' into parisc
[linux-2.6] / drivers / isdn / hardware / eicon / divacapi.h
1
2 /*
3  *
4   Copyright (c) Eicon Networks, 2002.
5  *
6   This source file is supplied for the use with
7   Eicon Networks range of DIVA Server Adapters.
8  *
9   Eicon File Revision :    2.1
10  *
11   This program is free software; you can redistribute it and/or modify
12   it under the terms of the GNU General Public License as published by
13   the Free Software Foundation; either version 2, or (at your option)
14   any later version.
15  *
16   This program is distributed in the hope that it will be useful,
17   but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
18   implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19   See the GNU General Public License for more details.
20  *
21   You should have received a copy of the GNU General Public License
22   along with this program; if not, write to the Free Software
23   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24  *
25  */
26
27 /*#define DEBUG */
28
29
30
31
32   
33   
34
35
36
37
38
39 #define IMPLEMENT_DTMF 1
40 #define IMPLEMENT_LINE_INTERCONNECT2 1
41 #define IMPLEMENT_ECHO_CANCELLER 1
42 #define IMPLEMENT_RTP 1
43 #define IMPLEMENT_T38 1
44 #define IMPLEMENT_FAX_SUB_SEP_PWD 1
45 #define IMPLEMENT_V18 1
46 #define IMPLEMENT_DTMF_TONE 1
47 #define IMPLEMENT_PIAFS 1
48 #define IMPLEMENT_FAX_PAPER_FORMATS 1
49 #define IMPLEMENT_VOWN 1
50 #define IMPLEMENT_CAPIDTMF 1
51 #define IMPLEMENT_FAX_NONSTANDARD 1
52 #define VSWITCH_SUPPORT 1
53
54
55 #define IMPLEMENT_LINE_INTERCONNECT 0
56 #define IMPLEMENT_MARKED_OK_AFTER_FC 1
57
58 #include "capidtmf.h"
59
60 /*------------------------------------------------------------------*/
61 /* Common API internal definitions                                  */
62 /*------------------------------------------------------------------*/
63
64 #define MAX_APPL 240
65 #define MAX_NCCI           127
66
67 #define MSG_IN_QUEUE_SIZE  ((4096 + 3) & 0xfffc)  /* must be multiple of 4 */
68
69
70 #define MSG_IN_OVERHEAD    sizeof(APPL   *)
71
72 #define MAX_NL_CHANNEL     255
73 #define MAX_DATA_B3        8
74 #define MAX_DATA_ACK       MAX_DATA_B3
75 #define MAX_MULTI_IE       6
76 #define MAX_MSG_SIZE       256
77 #define MAX_MSG_PARMS      10
78 #define MAX_CPN_MASK_SIZE  16
79 #define MAX_MSN_CONFIG     10
80 #define EXT_CONTROLLER     0x80
81 #define CODEC              0x01
82 #define CODEC_PERMANENT    0x02
83 #define ADV_VOICE          0x03
84 #define MAX_CIP_TYPES      5  /* kind of CIP types for group optimization */
85 #define C_IND_MASK_DWORDS  ((MAX_APPL+32) >> 5)
86
87
88 #define FAX_CONNECT_INFO_BUFFER_SIZE  256
89 #define NCPI_BUFFER_SIZE              256
90
91 #define MAX_CHANNELS_PER_PLCI         8
92 #define MAX_INTERNAL_COMMAND_LEVELS   4
93 #define INTERNAL_REQ_BUFFER_SIZE      272
94
95 #define INTERNAL_IND_BUFFER_SIZE      768
96
97 #define DTMF_PARAMETER_BUFFER_SIZE    12
98 #define ADV_VOICE_COEF_BUFFER_SIZE    50
99
100 #define LI_PLCI_B_QUEUE_ENTRIES       256
101
102
103
104 typedef struct _APPL APPL;
105 typedef struct _PLCI PLCI;
106 typedef struct _NCCI NCCI;
107 typedef struct _DIVA_CAPI_ADAPTER DIVA_CAPI_ADAPTER;
108 typedef struct _DATA_B3_DESC DATA_B3_DESC;
109 typedef struct _DATA_ACK_DESC DATA_ACK_DESC;
110 typedef struct manufacturer_profile_s MANUFACTURER_PROFILE;
111 typedef struct fax_ncpi_s FAX_NCPI;
112 typedef struct api_parse_s API_PARSE;
113 typedef struct api_save_s API_SAVE;
114 typedef struct msn_config_s MSN_CONFIG;
115 typedef struct msn_config_max_s MSN_CONFIG_MAX;
116 typedef struct msn_ld_s MSN_LD;
117
118 struct manufacturer_profile_s {
119   dword private_options;
120   dword rtp_primary_payloads;
121   dword rtp_additional_payloads;
122 };
123
124 struct fax_ncpi_s {
125   word options;
126   word format;
127 };
128
129 struct msn_config_s {
130   byte msn[MAX_CPN_MASK_SIZE];
131 };
132
133 struct msn_config_max_s {
134   MSN_CONFIG    msn_conf[MAX_MSN_CONFIG];
135 };
136
137 struct msn_ld_s {
138   dword low;
139   dword high;
140 };
141
142 struct api_parse_s {
143   word          length;
144   byte   *    info;
145 };
146
147 struct api_save_s {
148   API_PARSE     parms[MAX_MSG_PARMS+1];
149   byte          info[MAX_MSG_SIZE];
150 };
151
152 struct _DATA_B3_DESC {
153   word          Handle;
154   word          Number;
155   word          Flags;
156   word          Length;
157   void   *    P;
158 };
159
160 struct _DATA_ACK_DESC {
161   word          Handle;
162   word          Number;
163 };
164
165 typedef void (* t_std_internal_command)(dword Id, PLCI   *plci, byte Rc);
166
167 /************************************************************************/
168 /* Don't forget to adapt dos.asm after changing the _APPL structure!!!! */
169 struct _APPL {
170   word          Id;
171   word          NullCREnable;
172   word          CDEnable;
173   dword         S_Handle;
174
175
176
177
178
179
180   LIST_ENTRY    s_function;
181   dword         s_context;
182   word          s_count;
183   APPL *        s_next;
184   byte *        xbuffer_used;
185   void **       xbuffer_internal;
186   void **       xbuffer_ptr;
187
188
189
190
191
192
193   byte   *    queue;
194   word          queue_size;
195   word          queue_free;
196   word          queue_read;
197   word          queue_write;
198   word          queue_signal;
199   byte          msg_lost;
200   byte          appl_flags;
201   word          Number;
202
203   word          MaxBuffer;
204   byte          MaxNCCI;
205   byte          MaxNCCIData;
206   word          MaxDataLength;
207   word          NCCIDataFlowCtrlTimer;
208   byte   *    ReceiveBuffer;
209   word   *    DataNCCI;
210   word   *    DataFlags;
211 };
212
213
214 struct _PLCI {
215   ENTITY        Sig;
216   ENTITY        NL;
217   word          RNum;
218   word          RFlags;
219   BUFFERS       RData[2];
220   BUFFERS       XData[1];
221   BUFFERS       NData[2];
222
223   DIVA_CAPI_ADAPTER   *adapter;
224   APPL      *appl;
225   PLCI      *relatedPTYPLCI;
226   byte          Id;
227   byte          State;
228   byte          sig_req;
229   byte          nl_req;
230   byte          SuppState;
231   byte          channels;
232   byte          tel;
233   byte          B1_resource;
234   byte          B2_prot;
235   byte          B3_prot;
236
237   word          command;
238   word          m_command;
239   word          internal_command;
240   word          number;
241   word          req_in_start;
242   word          req_in;
243   word          req_out;
244   word          msg_in_write_pos;
245   word          msg_in_read_pos;
246   word          msg_in_wrap_pos;
247
248   void   *    data_sent_ptr;
249   byte          data_sent;
250   byte          send_disc;
251   byte          sig_global_req;
252   byte          sig_remove_id;
253   byte          nl_global_req;
254   byte          nl_remove_id;
255   byte          b_channel;
256   byte          adv_nl;
257   byte          manufacturer;
258   byte          call_dir;
259   byte          hook_state;
260   byte          spoofed_msg;
261   byte          ptyState;
262   byte          cr_enquiry;
263   word          hangup_flow_ctrl_timer;
264
265   word          ncci_ring_list;
266   byte          inc_dis_ncci_table[MAX_CHANNELS_PER_PLCI];
267   t_std_internal_command internal_command_queue[MAX_INTERNAL_COMMAND_LEVELS];
268   dword         c_ind_mask_table[C_IND_MASK_DWORDS];
269   dword         group_optimization_mask_table[C_IND_MASK_DWORDS];
270   byte          RBuffer[200];
271   dword         msg_in_queue[MSG_IN_QUEUE_SIZE/sizeof(dword)];
272   API_SAVE      saved_msg;
273   API_SAVE      B_protocol;
274   byte          fax_connect_info_length;
275   byte          fax_connect_info_buffer[FAX_CONNECT_INFO_BUFFER_SIZE];
276   byte          fax_edata_ack_length;
277   word          nsf_control_bits;
278   byte          ncpi_state;
279   byte          ncpi_buffer[NCPI_BUFFER_SIZE];
280
281   byte          internal_req_buffer[INTERNAL_REQ_BUFFER_SIZE];
282   byte          internal_ind_buffer[INTERNAL_IND_BUFFER_SIZE + 3];
283   dword         requested_options_conn;
284   dword         requested_options;
285   word          B1_facilities;
286   API_SAVE   *adjust_b_parms_msg;
287   word          adjust_b_facilities;
288   word          adjust_b_command;
289   word          adjust_b_ncci;
290   word          adjust_b_mode;
291   word          adjust_b_state;
292   byte          adjust_b_restore;
293
294   byte          dtmf_rec_active;
295   word          dtmf_rec_pulse_ms;
296   word          dtmf_rec_pause_ms;
297   byte          dtmf_send_requests;
298   word          dtmf_send_pulse_ms;
299   word          dtmf_send_pause_ms;
300   word          dtmf_cmd;
301   word          dtmf_msg_number_queue[8];
302   byte          dtmf_parameter_length;
303   byte          dtmf_parameter_buffer[DTMF_PARAMETER_BUFFER_SIZE];
304
305
306   t_capidtmf_state capidtmf_state;
307
308
309   byte          li_bchannel_id;    /* BRI: 1..2, PRI: 1..32 */
310   byte          li_channel_bits;
311   byte          li_notify_update;
312   word          li_cmd;
313   word          li_write_command;
314   word          li_write_channel;
315   word          li_plci_b_write_pos;
316   word          li_plci_b_read_pos;
317   word          li_plci_b_req_pos;
318   dword         li_plci_b_queue[LI_PLCI_B_QUEUE_ENTRIES];
319
320
321   word          ec_cmd;
322   word          ec_idi_options;
323   word          ec_tail_length;
324
325
326   byte          tone_last_indication_code;
327
328   byte          vswitchstate;
329   byte          vsprot;
330   byte          vsprotdialect;
331   byte          notifiedcall; /* Flag if it is a spoofed call */
332
333   int           rx_dma_descriptor;
334   dword         rx_dma_magic;
335 };
336
337
338 struct _NCCI {
339   byte          data_out;
340   byte          data_pending;
341   byte          data_ack_out;
342   byte          data_ack_pending;
343   DATA_B3_DESC  DBuffer[MAX_DATA_B3];
344   DATA_ACK_DESC DataAck[MAX_DATA_ACK];
345 };
346
347
348 struct _DIVA_CAPI_ADAPTER {
349   IDI_CALL      request;
350   byte          Id;
351   byte          max_plci;
352   byte          max_listen;
353   byte          listen_active;
354   PLCI      *plci;
355   byte          ch_ncci[MAX_NL_CHANNEL+1];
356   byte          ncci_ch[MAX_NCCI+1];
357   byte          ncci_plci[MAX_NCCI+1];
358   byte          ncci_state[MAX_NCCI+1];
359   byte          ncci_next[MAX_NCCI+1];
360   NCCI          ncci[MAX_NCCI+1];
361
362   byte          ch_flow_control[MAX_NL_CHANNEL+1];  /* Used by XON protocol */
363   byte          ch_flow_control_pending;
364   byte          ch_flow_plci[MAX_NL_CHANNEL+1];
365   int           last_flow_control_ch;
366
367   dword         Info_Mask[MAX_APPL];
368   dword         CIP_Mask[MAX_APPL];
369
370   dword         Notification_Mask[MAX_APPL];
371   PLCI      *codec_listen[MAX_APPL];
372   dword         requested_options_table[MAX_APPL];
373   API_PROFILE   profile;
374   MANUFACTURER_PROFILE man_profile;
375   dword         manufacturer_features;
376
377   byte          AdvCodecFLAG;
378   PLCI      *AdvCodecPLCI;
379   PLCI      *AdvSignalPLCI;
380   APPL      *AdvSignalAppl;
381   byte          TelOAD[23];
382   byte          TelOSA[23];
383   byte          scom_appl_disable;
384   PLCI      *automatic_lawPLCI;
385   byte          automatic_law;
386   byte          u_law;
387
388   byte          adv_voice_coef_length;
389   byte          adv_voice_coef_buffer[ADV_VOICE_COEF_BUFFER_SIZE];
390
391   byte          li_pri;
392   byte          li_channels;
393   word          li_base;
394
395   byte adapter_disabled;
396   byte group_optimization_enabled; /* use application groups if enabled */
397   dword sdram_bar;
398   byte flag_dynamic_l1_down; /* for hunt groups:down layer 1 if no appl present*/
399   byte FlowControlIdTable[256];
400   byte FlowControlSkipTable[256];
401   void* os_card; /* pointer to associated OS dependent adapter structure */
402 };
403
404
405 /*------------------------------------------------------------------*/
406 /* Application flags                                                */
407 /*------------------------------------------------------------------*/
408
409 #define APPL_FLAG_OLD_LI_SPEC           0x01
410 #define APPL_FLAG_PRIV_EC_SPEC          0x02
411
412
413 /*------------------------------------------------------------------*/
414 /* API parameter definitions                                        */
415 /*------------------------------------------------------------------*/
416
417 #define X75_TTX         1       /* x.75 for ttx                     */
418 #define TRF             2       /* transparent with hdlc framing    */
419 #define TRF_IN          3       /* transparent with hdlc fr. inc.   */
420 #define SDLC            4       /* sdlc, sna layer-2                */
421 #define X75_BTX         5       /* x.75 for btx                     */
422 #define LAPD            6       /* lapd (Q.921)                     */
423 #define X25_L2          7       /* x.25 layer-2                     */
424 #define V120_L2         8       /* V.120 layer-2 protocol           */
425 #define V42_IN          9       /* V.42 layer-2 protocol, incomming */
426 #define V42            10       /* V.42 layer-2 protocol            */
427 #define MDM_ATP        11       /* AT Parser built in the L2        */
428 #define X75_V42BIS     12       /* ISO7776 (X.75 SLP) modified to support V.42 bis compression */
429 #define RTPL2_IN       13       /* RTP layer-2 protocol, incomming  */
430 #define RTPL2          14       /* RTP layer-2 protocol             */
431 #define V120_V42BIS    15       /* V.120 layer-2 protocol supporting V.42 bis compression */
432
433 #define T70NL           1
434 #define X25PLP          2
435 #define T70NLX          3
436 #define TRANSPARENT_NL  4
437 #define ISO8208         5
438 #define T30             6
439
440
441 /*------------------------------------------------------------------*/
442 /* FAX interface to IDI                                             */
443 /*------------------------------------------------------------------*/
444
445 #define CAPI_MAX_HEAD_LINE_SPACE        89
446 #define CAPI_MAX_DATE_TIME_LENGTH       18
447
448 #define T30_MAX_STATION_ID_LENGTH       20
449 #define T30_MAX_SUBADDRESS_LENGTH       20
450 #define T30_MAX_PASSWORD_LENGTH         20
451
452 typedef struct t30_info_s T30_INFO;
453 struct t30_info_s {
454   byte          code;
455   byte          rate_div_2400;
456   byte          resolution;
457   byte          data_format;
458   byte          pages_low;
459   byte          pages_high;
460   byte          operating_mode;
461   byte          control_bits_low;
462   byte          control_bits_high;
463   byte          feature_bits_low;
464   byte          feature_bits_high;
465   byte          recording_properties;
466   byte          universal_6;
467   byte          universal_7;
468   byte          station_id_len;
469   byte          head_line_len;
470   byte          station_id[T30_MAX_STATION_ID_LENGTH];
471 /* byte          head_line[];      */
472 /* byte          sub_sep_length;   */
473 /* byte          sub_sep_field[];  */
474 /* byte          pwd_length;       */
475 /* byte          pwd_field[];      */
476 /* byte          nsf_info_length;   */
477 /* byte          nsf_info_field[];  */
478 };
479
480
481 #define T30_RESOLUTION_R8_0385          0x00
482 #define T30_RESOLUTION_R8_0770_OR_200   0x01
483 #define T30_RESOLUTION_R8_1540          0x02
484 #define T30_RESOLUTION_R16_1540_OR_400  0x04
485 #define T30_RESOLUTION_R4_0385_OR_100   0x08
486 #define T30_RESOLUTION_300_300          0x10
487 #define T30_RESOLUTION_INCH_BASED       0x40
488 #define T30_RESOLUTION_METRIC_BASED     0x80
489
490 #define T30_RECORDING_WIDTH_ISO_A4      0
491 #define T30_RECORDING_WIDTH_ISO_B4      1
492 #define T30_RECORDING_WIDTH_ISO_A3      2
493 #define T30_RECORDING_WIDTH_COUNT       3
494
495 #define T30_RECORDING_LENGTH_ISO_A4     0
496 #define T30_RECORDING_LENGTH_ISO_B4     1
497 #define T30_RECORDING_LENGTH_UNLIMITED  2
498 #define T30_RECORDING_LENGTH_COUNT      3
499
500 #define T30_MIN_SCANLINE_TIME_00_00_00  0
501 #define T30_MIN_SCANLINE_TIME_05_05_05  1
502 #define T30_MIN_SCANLINE_TIME_10_05_05  2
503 #define T30_MIN_SCANLINE_TIME_10_10_10  3
504 #define T30_MIN_SCANLINE_TIME_20_10_10  4
505 #define T30_MIN_SCANLINE_TIME_20_20_20  5
506 #define T30_MIN_SCANLINE_TIME_40_20_20  6
507 #define T30_MIN_SCANLINE_TIME_40_40_40  7
508 #define T30_MIN_SCANLINE_TIME_RES_8     8
509 #define T30_MIN_SCANLINE_TIME_RES_9     9
510 #define T30_MIN_SCANLINE_TIME_RES_10    10
511 #define T30_MIN_SCANLINE_TIME_10_10_05  11
512 #define T30_MIN_SCANLINE_TIME_20_10_05  12
513 #define T30_MIN_SCANLINE_TIME_20_20_10  13
514 #define T30_MIN_SCANLINE_TIME_40_20_10  14
515 #define T30_MIN_SCANLINE_TIME_40_40_20  15
516 #define T30_MIN_SCANLINE_TIME_COUNT     16
517
518 #define T30_DATA_FORMAT_SFF             0
519 #define T30_DATA_FORMAT_ASCII           1
520 #define T30_DATA_FORMAT_NATIVE          2
521 #define T30_DATA_FORMAT_COUNT           3
522
523
524 #define T30_OPERATING_MODE_STANDARD     0
525 #define T30_OPERATING_MODE_CLASS2       1
526 #define T30_OPERATING_MODE_CLASS1       2
527 #define T30_OPERATING_MODE_CAPI         3
528 #define T30_OPERATING_MODE_CAPI_NEG     4
529 #define T30_OPERATING_MODE_COUNT        5
530
531         /* EDATA transmit messages */
532 #define EDATA_T30_DIS         0x01
533 #define EDATA_T30_FTT         0x02
534 #define EDATA_T30_MCF         0x03
535 #define EDATA_T30_PARAMETERS  0x04
536
537         /* EDATA receive messages */
538 #define EDATA_T30_DCS         0x81
539 #define EDATA_T30_TRAIN_OK    0x82
540 #define EDATA_T30_EOP         0x83
541 #define EDATA_T30_MPS         0x84
542 #define EDATA_T30_EOM         0x85
543 #define EDATA_T30_DTC         0x86
544 #define EDATA_T30_PAGE_END    0x87   /* Indicates end of page data. Reserved, but not implemented ! */
545 #define EDATA_T30_EOP_CAPI    0x88
546
547
548 #define T30_SUCCESS                        0
549 #define T30_ERR_NO_DIS_RECEIVED            1
550 #define T30_ERR_TIMEOUT_NO_RESPONSE        2
551 #define T30_ERR_RETRY_NO_RESPONSE          3
552 #define T30_ERR_TOO_MANY_REPEATS           4
553 #define T30_ERR_UNEXPECTED_MESSAGE         5
554 #define T30_ERR_UNEXPECTED_DCN             6
555 #define T30_ERR_DTC_UNSUPPORTED            7
556 #define T30_ERR_ALL_RATES_FAILED           8
557 #define T30_ERR_TOO_MANY_TRAINS            9
558 #define T30_ERR_RECEIVE_CORRUPTED          10
559 #define T30_ERR_UNEXPECTED_DISC            11
560 #define T30_ERR_APPLICATION_DISC           12
561 #define T30_ERR_INCOMPATIBLE_DIS           13
562 #define T30_ERR_INCOMPATIBLE_DCS           14
563 #define T30_ERR_TIMEOUT_NO_COMMAND         15
564 #define T30_ERR_RETRY_NO_COMMAND           16
565 #define T30_ERR_TIMEOUT_COMMAND_TOO_LONG   17
566 #define T30_ERR_TIMEOUT_RESPONSE_TOO_LONG  18
567 #define T30_ERR_NOT_IDENTIFIED             19
568 #define T30_ERR_SUPERVISORY_TIMEOUT        20
569 #define T30_ERR_TOO_LONG_SCAN_LINE         21
570 /* #define T30_ERR_RETRY_NO_PAGE_AFTER_MPS    22 */
571 #define T30_ERR_RETRY_NO_PAGE_RECEIVED     23
572 #define T30_ERR_RETRY_NO_DCS_AFTER_FTT     24
573 #define T30_ERR_RETRY_NO_DCS_AFTER_EOM     25
574 #define T30_ERR_RETRY_NO_DCS_AFTER_MPS     26
575 #define T30_ERR_RETRY_NO_DCN_AFTER_MCF     27
576 #define T30_ERR_RETRY_NO_DCN_AFTER_RTN     28
577 #define T30_ERR_RETRY_NO_CFR               29
578 #define T30_ERR_RETRY_NO_MCF_AFTER_EOP     30
579 #define T30_ERR_RETRY_NO_MCF_AFTER_EOM     31
580 #define T30_ERR_RETRY_NO_MCF_AFTER_MPS     32
581 #define T30_ERR_SUB_SEP_UNSUPPORTED        33
582 #define T30_ERR_PWD_UNSUPPORTED            34
583 #define T30_ERR_SUB_SEP_PWD_UNSUPPORTED    35
584 #define T30_ERR_INVALID_COMMAND_FRAME      36
585 #define T30_ERR_UNSUPPORTED_PAGE_CODING    37
586 #define T30_ERR_INVALID_PAGE_CODING        38
587 #define T30_ERR_INCOMPATIBLE_PAGE_CONFIG   39
588 #define T30_ERR_TIMEOUT_FROM_APPLICATION   40
589 #define T30_ERR_V34FAX_NO_REACTION_ON_MARK 41
590 #define T30_ERR_V34FAX_TRAINING_TIMEOUT    42
591 #define T30_ERR_V34FAX_UNEXPECTED_V21      43
592 #define T30_ERR_V34FAX_PRIMARY_CTS_ON      44
593 #define T30_ERR_V34FAX_TURNAROUND_POLLING  45
594 #define T30_ERR_V34FAX_V8_INCOMPATIBILITY  46
595
596
597 #define T30_CONTROL_BIT_DISABLE_FINE       0x0001
598 #define T30_CONTROL_BIT_ENABLE_ECM         0x0002
599 #define T30_CONTROL_BIT_ECM_64_BYTES       0x0004
600 #define T30_CONTROL_BIT_ENABLE_2D_CODING   0x0008
601 #define T30_CONTROL_BIT_ENABLE_T6_CODING   0x0010
602 #define T30_CONTROL_BIT_ENABLE_UNCOMPR     0x0020
603 #define T30_CONTROL_BIT_ACCEPT_POLLING     0x0040
604 #define T30_CONTROL_BIT_REQUEST_POLLING    0x0080
605 #define T30_CONTROL_BIT_MORE_DOCUMENTS     0x0100
606 #define T30_CONTROL_BIT_ACCEPT_SUBADDRESS  0x0200
607 #define T30_CONTROL_BIT_ACCEPT_SEL_POLLING 0x0400
608 #define T30_CONTROL_BIT_ACCEPT_PASSWORD    0x0800
609 #define T30_CONTROL_BIT_ENABLE_V34FAX      0x1000
610 #define T30_CONTROL_BIT_EARLY_CONNECT      0x2000
611
612 #define T30_CONTROL_BIT_ALL_FEATURES  (T30_CONTROL_BIT_ENABLE_ECM | T30_CONTROL_BIT_ENABLE_2D_CODING |   T30_CONTROL_BIT_ENABLE_T6_CODING | T30_CONTROL_BIT_ENABLE_UNCOMPR |   T30_CONTROL_BIT_ENABLE_V34FAX)
613
614 #define T30_FEATURE_BIT_FINE               0x0001
615 #define T30_FEATURE_BIT_ECM                0x0002
616 #define T30_FEATURE_BIT_ECM_64_BYTES       0x0004
617 #define T30_FEATURE_BIT_2D_CODING          0x0008
618 #define T30_FEATURE_BIT_T6_CODING          0x0010
619 #define T30_FEATURE_BIT_UNCOMPR_ENABLED    0x0020
620 #define T30_FEATURE_BIT_POLLING            0x0040
621 #define T30_FEATURE_BIT_MORE_DOCUMENTS     0x0100
622 #define T30_FEATURE_BIT_V34FAX             0x1000
623
624
625 #define T30_NSF_CONTROL_BIT_ENABLE_NSF     0x0001
626 #define T30_NSF_CONTROL_BIT_RAW_INFO       0x0002
627 #define T30_NSF_CONTROL_BIT_NEGOTIATE_IND  0x0004
628 #define T30_NSF_CONTROL_BIT_NEGOTIATE_RESP 0x0008
629
630 #define T30_NSF_ELEMENT_NSF_FIF            0x00
631 #define T30_NSF_ELEMENT_NSC_FIF            0x01
632 #define T30_NSF_ELEMENT_NSS_FIF            0x02
633 #define T30_NSF_ELEMENT_COMPANY_NAME       0x03
634
635
636 /*------------------------------------------------------------------*/
637 /* Analog modem definitions                                         */
638 /*------------------------------------------------------------------*/
639
640 typedef struct async_s ASYNC_FORMAT;
641 struct async_s {
642   unsigned pe:    1;
643   unsigned parity:2;
644   unsigned spare: 2;
645   unsigned stp:   1;
646   unsigned ch_len:2;   /* 3th octett in CAI */
647 };
648
649
650 /*------------------------------------------------------------------*/
651 /* PLCI/NCCI states                                                 */
652 /*------------------------------------------------------------------*/
653
654 #define IDLE                    0
655 #define OUTG_CON_PENDING        1
656 #define INC_CON_PENDING         2
657 #define INC_CON_ALERT           3
658 #define INC_CON_ACCEPT          4
659 #define INC_ACT_PENDING         5
660 #define LISTENING               6
661 #define CONNECTED               7
662 #define OUTG_DIS_PENDING        8
663 #define INC_DIS_PENDING         9
664 #define LOCAL_CONNECT           10
665 #define INC_RES_PENDING         11
666 #define OUTG_RES_PENDING        12
667 #define SUSPENDING              13
668 #define ADVANCED_VOICE_SIG      14
669 #define ADVANCED_VOICE_NOSIG    15
670 #define RESUMING                16
671 #define INC_CON_CONNECTED_ALERT 17
672 #define OUTG_REJ_PENDING        18
673
674
675 /*------------------------------------------------------------------*/
676 /* auxilliary states for supplementary services                     */
677 /*------------------------------------------------------------------*/
678
679 #define IDLE                0
680 #define HOLD_REQUEST        1
681 #define HOLD_INDICATE       2
682 #define CALL_HELD           3
683 #define RETRIEVE_REQUEST    4
684 #define RETRIEVE_INDICATION 5
685
686 /*------------------------------------------------------------------*/
687 /* Capi IE + Msg types                                              */
688 /*------------------------------------------------------------------*/
689 #define ESC_CAUSE        0x800|CAU          /* Escape cause element */
690 #define ESC_MSGTYPE      0x800|MSGTYPEIE    /* Escape message type  */
691 #define ESC_CHI          0x800|CHI          /* Escape channel id    */
692 #define ESC_LAW          0x800|BC           /* Escape law info      */
693 #define ESC_CR           0x800|CRIE         /* Escape CallReference */
694 #define ESC_PROFILE      0x800|PROFILEIE    /* Escape profile       */
695 #define ESC_SSEXT        0x800|SSEXTIE      /* Escape Supplem. Serv.*/
696 #define ESC_VSWITCH      0x800|VSWITCHIE    /* Escape VSwitch       */
697 #define CST              0x14               /* Call State i.e.      */
698 #define PI               0x1E               /* Progress Indicator   */
699 #define NI               0x27               /* Notification Ind     */
700 #define CONN_NR          0x4C               /* Connected Number     */
701 #define CONG_RNR         0xBF               /* Congestion RNR       */
702 #define CONG_RR          0xB0               /* Congestion RR        */
703 #define RESERVED         0xFF               /* Res. for future use  */
704 #define ON_BOARD_CODEC   0x02               /* external controller  */
705 #define HANDSET          0x04               /* Codec+Handset(Pro11) */
706 #define HOOK_SUPPORT     0x01               /* activate Hook signal */
707 #define SCR              0x7a               /* unscreened number    */
708
709 #define HOOK_OFF_REQ     0x9001             /* internal conn req    */
710 #define HOOK_ON_REQ      0x9002             /* internal disc req    */
711 #define SUSPEND_REQ      0x9003             /* internal susp req    */
712 #define RESUME_REQ       0x9004             /* internal resume req  */
713 #define USELAW_REQ       0x9005             /* internal law    req  */
714 #define LISTEN_SIG_ASSIGN_PEND  0x9006
715 #define PERM_LIST_REQ    0x900a             /* permanent conn DCE   */
716 #define C_HOLD_REQ       0x9011
717 #define C_RETRIEVE_REQ   0x9012
718 #define C_NCR_FAC_REQ    0x9013
719 #define PERM_COD_ASSIGN  0x9014
720 #define PERM_COD_CALL    0x9015
721 #define PERM_COD_HOOK    0x9016
722 #define PERM_COD_CONN_PEND 0x9017           /* wait for connect_con */
723 #define PTY_REQ_PEND     0x9018
724 #define CD_REQ_PEND      0x9019
725 #define CF_START_PEND    0x901a
726 #define CF_STOP_PEND     0x901b
727 #define ECT_REQ_PEND     0x901c
728 #define GETSERV_REQ_PEND 0x901d
729 #define BLOCK_PLCI       0x901e
730 #define INTERR_NUMBERS_REQ_PEND         0x901f
731 #define INTERR_DIVERSION_REQ_PEND       0x9020
732 #define MWI_ACTIVATE_REQ_PEND           0x9021
733 #define MWI_DEACTIVATE_REQ_PEND         0x9022
734 #define SSEXT_REQ_COMMAND               0x9023
735 #define SSEXT_NC_REQ_COMMAND            0x9024
736 #define START_L1_SIG_ASSIGN_PEND        0x9025
737 #define REM_L1_SIG_ASSIGN_PEND          0x9026
738 #define CONF_BEGIN_REQ_PEND             0x9027
739 #define CONF_ADD_REQ_PEND               0x9028
740 #define CONF_SPLIT_REQ_PEND             0x9029
741 #define CONF_DROP_REQ_PEND              0x902a
742 #define CONF_ISOLATE_REQ_PEND           0x902b
743 #define CONF_REATTACH_REQ_PEND          0x902c
744 #define VSWITCH_REQ_PEND                0x902d
745 #define GET_MWI_STATE                   0x902e
746 #define CCBS_REQUEST_REQ_PEND           0x902f
747 #define CCBS_DEACTIVATE_REQ_PEND        0x9030
748 #define CCBS_INTERROGATE_REQ_PEND       0x9031
749
750 #define NO_INTERNAL_COMMAND             0
751 #define DTMF_COMMAND_1                  1
752 #define DTMF_COMMAND_2                  2
753 #define DTMF_COMMAND_3                  3
754 #define MIXER_COMMAND_1                 4
755 #define MIXER_COMMAND_2                 5
756 #define MIXER_COMMAND_3                 6
757 #define ADV_VOICE_COMMAND_CONNECT_1     7
758 #define ADV_VOICE_COMMAND_CONNECT_2     8
759 #define ADV_VOICE_COMMAND_CONNECT_3     9
760 #define ADV_VOICE_COMMAND_DISCONNECT_1  10
761 #define ADV_VOICE_COMMAND_DISCONNECT_2  11
762 #define ADV_VOICE_COMMAND_DISCONNECT_3  12
763 #define ADJUST_B_RESTORE_1              13
764 #define ADJUST_B_RESTORE_2              14
765 #define RESET_B3_COMMAND_1              15
766 #define SELECT_B_COMMAND_1              16
767 #define FAX_CONNECT_INFO_COMMAND_1      17
768 #define FAX_CONNECT_INFO_COMMAND_2      18
769 #define FAX_ADJUST_B23_COMMAND_1        19
770 #define FAX_ADJUST_B23_COMMAND_2        20
771 #define EC_COMMAND_1                    21
772 #define EC_COMMAND_2                    22
773 #define EC_COMMAND_3                    23
774 #define RTP_CONNECT_B3_REQ_COMMAND_1    24
775 #define RTP_CONNECT_B3_REQ_COMMAND_2    25
776 #define RTP_CONNECT_B3_REQ_COMMAND_3    26
777 #define RTP_CONNECT_B3_RES_COMMAND_1    27
778 #define RTP_CONNECT_B3_RES_COMMAND_2    28
779 #define RTP_CONNECT_B3_RES_COMMAND_3    29
780 #define HOLD_SAVE_COMMAND_1             30
781 #define RETRIEVE_RESTORE_COMMAND_1      31
782 #define FAX_DISCONNECT_COMMAND_1        32
783 #define FAX_DISCONNECT_COMMAND_2        33
784 #define FAX_DISCONNECT_COMMAND_3        34
785 #define FAX_EDATA_ACK_COMMAND_1         35
786 #define FAX_EDATA_ACK_COMMAND_2         36
787 #define FAX_CONNECT_ACK_COMMAND_1       37
788 #define FAX_CONNECT_ACK_COMMAND_2       38
789 #define STD_INTERNAL_COMMAND_COUNT      39
790
791 #define UID              0x2d               /* User Id for Mgmt      */
792
793 #define CALL_DIR_OUT             0x01       /* call direction of initial call */
794 #define CALL_DIR_IN              0x02
795 #define CALL_DIR_ORIGINATE       0x04       /* DTE/DCE direction according to */
796 #define CALL_DIR_ANSWER          0x08       /*   state of B-Channel Operation */
797 #define CALL_DIR_FORCE_OUTG_NL   0x10       /* for RESET_B3 reconnect, after DISC_B3... */
798
799 #define AWAITING_MANUF_CON 0x80             /* command spoofing flags */
800 #define SPOOFING_REQUIRED  0xff
801 #define AWAITING_SELECT_B  0xef
802
803 /*------------------------------------------------------------------*/
804 /* B_CTRL / DSP_CTRL                                                */
805 /*------------------------------------------------------------------*/
806
807 #define DSP_CTRL_OLD_SET_MIXER_COEFFICIENTS     0x01
808 #define DSP_CTRL_SET_BCHANNEL_PASSIVATION_BRI   0x02
809 #define DSP_CTRL_SET_DTMF_PARAMETERS            0x03
810
811 #define MANUFACTURER_FEATURE_SLAVE_CODEC          0x00000001L
812 #define MANUFACTURER_FEATURE_FAX_MORE_DOCUMENTS   0x00000002L
813 #define MANUFACTURER_FEATURE_HARDDTMF             0x00000004L
814 #define MANUFACTURER_FEATURE_SOFTDTMF_SEND        0x00000008L
815 #define MANUFACTURER_FEATURE_DTMF_PARAMETERS      0x00000010L
816 #define MANUFACTURER_FEATURE_SOFTDTMF_RECEIVE     0x00000020L
817 #define MANUFACTURER_FEATURE_FAX_SUB_SEP_PWD      0x00000040L
818 #define MANUFACTURER_FEATURE_V18                  0x00000080L
819 #define MANUFACTURER_FEATURE_MIXER_CH_CH          0x00000100L
820 #define MANUFACTURER_FEATURE_MIXER_CH_PC          0x00000200L
821 #define MANUFACTURER_FEATURE_MIXER_PC_CH          0x00000400L
822 #define MANUFACTURER_FEATURE_MIXER_PC_PC          0x00000800L
823 #define MANUFACTURER_FEATURE_ECHO_CANCELLER       0x00001000L
824 #define MANUFACTURER_FEATURE_RTP                  0x00002000L
825 #define MANUFACTURER_FEATURE_T38                  0x00004000L
826 #define MANUFACTURER_FEATURE_TRANSP_DELIVERY_CONF 0x00008000L
827 #define MANUFACTURER_FEATURE_XONOFF_FLOW_CONTROL  0x00010000L
828 #define MANUFACTURER_FEATURE_OOB_CHANNEL          0x00020000L
829 #define MANUFACTURER_FEATURE_IN_BAND_CHANNEL      0x00040000L
830 #define MANUFACTURER_FEATURE_IN_BAND_FEATURE      0x00080000L
831 #define MANUFACTURER_FEATURE_PIAFS                0x00100000L
832 #define MANUFACTURER_FEATURE_DTMF_TONE            0x00200000L
833 #define MANUFACTURER_FEATURE_FAX_PAPER_FORMATS    0x00400000L
834 #define MANUFACTURER_FEATURE_OK_FC_LABEL          0x00800000L
835 #define MANUFACTURER_FEATURE_VOWN                 0x01000000L
836 #define MANUFACTURER_FEATURE_XCONNECT             0x02000000L
837 #define MANUFACTURER_FEATURE_DMACONNECT           0x04000000L
838 #define MANUFACTURER_FEATURE_AUDIO_TAP            0x08000000L
839 #define MANUFACTURER_FEATURE_FAX_NONSTANDARD      0x10000000L
840
841 /*------------------------------------------------------------------*/
842 /* DTMF interface to IDI                                            */
843 /*------------------------------------------------------------------*/
844
845
846 #define DTMF_DIGIT_TONE_LOW_GROUP_697_HZ        0x00
847 #define DTMF_DIGIT_TONE_LOW_GROUP_770_HZ        0x01
848 #define DTMF_DIGIT_TONE_LOW_GROUP_852_HZ        0x02
849 #define DTMF_DIGIT_TONE_LOW_GROUP_941_HZ        0x03
850 #define DTMF_DIGIT_TONE_LOW_GROUP_MASK          0x03
851 #define DTMF_DIGIT_TONE_HIGH_GROUP_1209_HZ      0x00
852 #define DTMF_DIGIT_TONE_HIGH_GROUP_1336_HZ      0x04
853 #define DTMF_DIGIT_TONE_HIGH_GROUP_1477_HZ      0x08
854 #define DTMF_DIGIT_TONE_HIGH_GROUP_1633_HZ      0x0c
855 #define DTMF_DIGIT_TONE_HIGH_GROUP_MASK         0x0c
856 #define DTMF_DIGIT_TONE_CODE_0                  0x07
857 #define DTMF_DIGIT_TONE_CODE_1                  0x00
858 #define DTMF_DIGIT_TONE_CODE_2                  0x04
859 #define DTMF_DIGIT_TONE_CODE_3                  0x08
860 #define DTMF_DIGIT_TONE_CODE_4                  0x01
861 #define DTMF_DIGIT_TONE_CODE_5                  0x05
862 #define DTMF_DIGIT_TONE_CODE_6                  0x09
863 #define DTMF_DIGIT_TONE_CODE_7                  0x02
864 #define DTMF_DIGIT_TONE_CODE_8                  0x06
865 #define DTMF_DIGIT_TONE_CODE_9                  0x0a
866 #define DTMF_DIGIT_TONE_CODE_STAR               0x03
867 #define DTMF_DIGIT_TONE_CODE_HASHMARK           0x0b
868 #define DTMF_DIGIT_TONE_CODE_A                  0x0c
869 #define DTMF_DIGIT_TONE_CODE_B                  0x0d
870 #define DTMF_DIGIT_TONE_CODE_C                  0x0e
871 #define DTMF_DIGIT_TONE_CODE_D                  0x0f
872
873 #define DTMF_UDATA_REQUEST_SEND_DIGITS            16
874 #define DTMF_UDATA_REQUEST_ENABLE_RECEIVER        17
875 #define DTMF_UDATA_REQUEST_DISABLE_RECEIVER       18
876 #define DTMF_UDATA_INDICATION_DIGITS_SENT         16
877 #define DTMF_UDATA_INDICATION_DIGITS_RECEIVED     17
878 #define DTMF_UDATA_INDICATION_MODEM_CALLING_TONE  18
879 #define DTMF_UDATA_INDICATION_FAX_CALLING_TONE    19
880 #define DTMF_UDATA_INDICATION_ANSWER_TONE         20
881
882 #define UDATA_REQUEST_MIXER_TAP_DATA        27
883 #define UDATA_INDICATION_MIXER_TAP_DATA     27
884
885 #define DTMF_LISTEN_ACTIVE_FLAG        0x01
886 #define DTMF_SEND_DIGIT_FLAG           0x01
887
888
889 /*------------------------------------------------------------------*/
890 /* Mixer interface to IDI                                           */
891 /*------------------------------------------------------------------*/
892
893
894 #define LI2_FLAG_PCCONNECT_A_B 0x40000000
895 #define LI2_FLAG_PCCONNECT_B_A 0x80000000
896
897 #define MIXER_BCHANNELS_BRI    2
898 #define MIXER_IC_CHANNELS_BRI  MIXER_BCHANNELS_BRI
899 #define MIXER_IC_CHANNEL_BASE  MIXER_BCHANNELS_BRI
900 #define MIXER_CHANNELS_BRI     (MIXER_BCHANNELS_BRI + MIXER_IC_CHANNELS_BRI)
901 #define MIXER_CHANNELS_PRI     32
902
903 typedef struct li_config_s LI_CONFIG;
904
905 struct xconnect_card_address_s {
906   dword low;
907   dword high;
908 };
909
910 struct xconnect_transfer_address_s {
911   struct xconnect_card_address_s card_address;
912   dword offset;
913 };
914
915 struct li_config_s {
916   DIVA_CAPI_ADAPTER   *adapter;
917   PLCI   *plci;
918   struct xconnect_transfer_address_s send_b;
919   struct xconnect_transfer_address_s send_pc;
920   byte   *flag_table;  /* dword aligned and sized */
921   byte   *coef_table;  /* dword aligned and sized */
922   byte channel;
923   byte curchnl;
924   byte chflags;
925 };
926
927 extern LI_CONFIG   *li_config_table;
928 extern word li_total_channels;
929
930 #define LI_CHANNEL_INVOLVED        0x01
931 #define LI_CHANNEL_ACTIVE          0x02
932 #define LI_CHANNEL_TX_DATA         0x04
933 #define LI_CHANNEL_RX_DATA         0x08
934 #define LI_CHANNEL_CONFERENCE      0x10
935 #define LI_CHANNEL_ADDRESSES_SET   0x80
936
937 #define LI_CHFLAG_MONITOR          0x01
938 #define LI_CHFLAG_MIX              0x02
939 #define LI_CHFLAG_LOOP             0x04
940
941 #define LI_FLAG_INTERCONNECT       0x01
942 #define LI_FLAG_MONITOR            0x02
943 #define LI_FLAG_MIX                0x04
944 #define LI_FLAG_PCCONNECT          0x08
945 #define LI_FLAG_CONFERENCE         0x10
946 #define LI_FLAG_ANNOUNCEMENT       0x20
947
948 #define LI_COEF_CH_CH              0x01
949 #define LI_COEF_CH_PC              0x02
950 #define LI_COEF_PC_CH              0x04
951 #define LI_COEF_PC_PC              0x08
952 #define LI_COEF_CH_CH_SET          0x10
953 #define LI_COEF_CH_PC_SET          0x20
954 #define LI_COEF_PC_CH_SET          0x40
955 #define LI_COEF_PC_PC_SET          0x80
956
957 #define LI_REQ_SILENT_UPDATE       0xffff
958
959 #define LI_PLCI_B_LAST_FLAG        ((dword) 0x80000000L)
960 #define LI_PLCI_B_DISC_FLAG        ((dword) 0x40000000L)
961 #define LI_PLCI_B_SKIP_FLAG        ((dword) 0x20000000L)
962 #define LI_PLCI_B_FLAG_MASK        ((dword) 0xe0000000L)
963
964 #define UDATA_REQUEST_SET_MIXER_COEFS_BRI       24
965 #define UDATA_REQUEST_SET_MIXER_COEFS_PRI_SYNC  25
966 #define UDATA_REQUEST_SET_MIXER_COEFS_PRI_ASYN  26
967 #define UDATA_INDICATION_MIXER_COEFS_SET        24
968
969 #define MIXER_FEATURE_ENABLE_TX_DATA        0x0001
970 #define MIXER_FEATURE_ENABLE_RX_DATA        0x0002
971
972 #define MIXER_COEF_LINE_CHANNEL_MASK        0x1f
973 #define MIXER_COEF_LINE_FROM_PC_FLAG        0x20
974 #define MIXER_COEF_LINE_TO_PC_FLAG          0x40
975 #define MIXER_COEF_LINE_ROW_FLAG            0x80
976
977 #define UDATA_REQUEST_XCONNECT_FROM         28
978 #define UDATA_INDICATION_XCONNECT_FROM      28
979 #define UDATA_REQUEST_XCONNECT_TO           29
980 #define UDATA_INDICATION_XCONNECT_TO        29
981
982 #define XCONNECT_CHANNEL_PORT_B             0x0000
983 #define XCONNECT_CHANNEL_PORT_PC            0x8000
984 #define XCONNECT_CHANNEL_PORT_MASK          0x8000
985 #define XCONNECT_CHANNEL_NUMBER_MASK        0x7fff
986 #define XCONNECT_CHANNEL_PORT_COUNT         2
987
988 #define XCONNECT_SUCCESS           0x0000
989 #define XCONNECT_ERROR             0x0001
990
991
992 /*------------------------------------------------------------------*/
993 /* Echo canceller interface to IDI                                  */
994 /*------------------------------------------------------------------*/
995
996
997 #define PRIVATE_ECHO_CANCELLER         0
998
999 #define PRIV_SELECTOR_ECHO_CANCELLER   255
1000
1001 #define EC_ENABLE_OPERATION            1
1002 #define EC_DISABLE_OPERATION           2
1003 #define EC_FREEZE_COEFFICIENTS         3
1004 #define EC_RESUME_COEFFICIENT_UPDATE   4
1005 #define EC_RESET_COEFFICIENTS          5
1006
1007 #define EC_DISABLE_NON_LINEAR_PROCESSING     0x0001
1008 #define EC_DO_NOT_REQUIRE_REVERSALS          0x0002
1009 #define EC_DETECT_DISABLE_TONE               0x0004
1010
1011 #define EC_SUCCESS                           0
1012 #define EC_UNSUPPORTED_OPERATION             1
1013
1014 #define EC_BYPASS_DUE_TO_CONTINUOUS_2100HZ   1
1015 #define EC_BYPASS_DUE_TO_REVERSED_2100HZ     2
1016 #define EC_BYPASS_RELEASED                   3
1017
1018 #define DSP_CTRL_SET_LEC_PARAMETERS          0x05
1019
1020 #define LEC_ENABLE_ECHO_CANCELLER            0x0001
1021 #define LEC_ENABLE_2100HZ_DETECTOR           0x0002
1022 #define LEC_REQUIRE_2100HZ_REVERSALS         0x0004
1023 #define LEC_MANUAL_DISABLE                   0x0008
1024 #define LEC_ENABLE_NONLINEAR_PROCESSING      0x0010
1025 #define LEC_FREEZE_COEFFICIENTS              0x0020
1026 #define LEC_RESET_COEFFICIENTS               0x8000
1027
1028 #define LEC_MAX_SUPPORTED_TAIL_LENGTH        32
1029
1030 #define LEC_UDATA_INDICATION_DISABLE_DETECT  9
1031
1032 #define LEC_DISABLE_TYPE_CONTIGNUOUS_2100HZ  0x00
1033 #define LEC_DISABLE_TYPE_REVERSED_2100HZ     0x01
1034 #define LEC_DISABLE_RELEASED                 0x02
1035
1036
1037 /*------------------------------------------------------------------*/
1038 /* RTP interface to IDI                                             */
1039 /*------------------------------------------------------------------*/
1040
1041
1042 #define B1_RTP                  31
1043 #define B2_RTP                  31
1044 #define B3_RTP                  31
1045
1046 #define PRIVATE_RTP                    1
1047
1048 #define RTP_PRIM_PAYLOAD_PCMU_8000     0
1049 #define RTP_PRIM_PAYLOAD_1016_8000     1
1050 #define RTP_PRIM_PAYLOAD_G726_32_8000  2
1051 #define RTP_PRIM_PAYLOAD_GSM_8000      3
1052 #define RTP_PRIM_PAYLOAD_G723_8000     4
1053 #define RTP_PRIM_PAYLOAD_DVI4_8000     5
1054 #define RTP_PRIM_PAYLOAD_DVI4_16000    6
1055 #define RTP_PRIM_PAYLOAD_LPC_8000      7
1056 #define RTP_PRIM_PAYLOAD_PCMA_8000     8
1057 #define RTP_PRIM_PAYLOAD_G722_16000    9
1058 #define RTP_PRIM_PAYLOAD_QCELP_8000    12
1059 #define RTP_PRIM_PAYLOAD_G728_8000     14
1060 #define RTP_PRIM_PAYLOAD_G729_8000     18
1061 #define RTP_PRIM_PAYLOAD_GSM_HR_8000   30
1062 #define RTP_PRIM_PAYLOAD_GSM_EFR_8000  31
1063
1064 #define RTP_ADD_PAYLOAD_BASE           32
1065 #define RTP_ADD_PAYLOAD_RED            32
1066 #define RTP_ADD_PAYLOAD_CN_8000        33
1067 #define RTP_ADD_PAYLOAD_DTMF           34
1068
1069 #define RTP_SUCCESS                         0
1070 #define RTP_ERR_SSRC_OR_PAYLOAD_CHANGE      1
1071
1072 #define UDATA_REQUEST_RTP_RECONFIGURE       64
1073 #define UDATA_INDICATION_RTP_CHANGE         65
1074 #define BUDATA_REQUEST_QUERY_RTCP_REPORT    1
1075 #define BUDATA_INDICATION_RTCP_REPORT       1
1076
1077 #define RTP_CONNECT_OPTION_DISC_ON_SSRC_CHANGE    0x00000001L
1078 #define RTP_CONNECT_OPTION_DISC_ON_PT_CHANGE      0x00000002L
1079 #define RTP_CONNECT_OPTION_DISC_ON_UNKNOWN_PT     0x00000004L
1080 #define RTP_CONNECT_OPTION_NO_SILENCE_TRANSMIT    0x00010000L
1081
1082 #define RTP_PAYLOAD_OPTION_VOICE_ACTIVITY_DETECT  0x0001
1083 #define RTP_PAYLOAD_OPTION_DISABLE_POST_FILTER    0x0002
1084 #define RTP_PAYLOAD_OPTION_G723_LOW_CODING_RATE   0x0100
1085
1086 #define RTP_PACKET_FILTER_IGNORE_UNKNOWN_SSRC     0x00000001L
1087
1088 #define RTP_CHANGE_FLAG_SSRC_CHANGE               0x00000001L
1089 #define RTP_CHANGE_FLAG_PAYLOAD_TYPE_CHANGE       0x00000002L
1090 #define RTP_CHANGE_FLAG_UNKNOWN_PAYLOAD_TYPE      0x00000004L
1091
1092
1093 /*------------------------------------------------------------------*/
1094 /* T.38 interface to IDI                                            */
1095 /*------------------------------------------------------------------*/
1096
1097
1098 #define B1_T38                  30
1099 #define B2_T38                  30
1100 #define B3_T38                  30
1101
1102 #define PRIVATE_T38                    2
1103
1104
1105 /*------------------------------------------------------------------*/
1106 /* PIAFS interface to IDI                                            */
1107 /*------------------------------------------------------------------*/
1108
1109
1110 #define B1_PIAFS                29
1111 #define B2_PIAFS                29
1112
1113 #define PRIVATE_PIAFS           29 
1114
1115 /*
1116   B2 configuration for PIAFS:
1117 +---------------------+------+-----------------------------------------+
1118 | PIAFS Protocol      | byte | Bit 1 - Protocol Speed                  |
1119 | Speed configuration |      |         0 - 32K                         |
1120 |                     |      |         1 - 64K (default)               |
1121 |                     |      | Bit 2 - Variable Protocol Speed         |
1122 |                     |      |         0 - Speed is fix                |
1123 |                     |      |         1 - Speed is variable (default) |
1124 +---------------------+------+-----------------------------------------+
1125 | Direction           | word | Enable compression/decompression for    |
1126 |                     |      | 0: All direction                        |
1127 |                     |      | 1: disable outgoing data                |
1128 |                     |      | 2: disable incomming data               |
1129 |                     |      | 3: disable both direction (default)     |
1130 +---------------------+------+-----------------------------------------+
1131 | Number of code      | word | Parameter P1 of V.42bis in accordance   |
1132 | words               |      | with V.42bis                            |
1133 +---------------------+------+-----------------------------------------+
1134 | Maximum String      | word | Parameter P2 of V.42bis in accordance   |
1135 | Length              |      | with V.42bis                            |
1136 +---------------------+------+-----------------------------------------+
1137 | control (UDATA)     | byte | enable PIAFS control communication      |
1138 | abilities           |      |                                         |
1139 +---------------------+------+-----------------------------------------+
1140 */
1141 #define PIAFS_UDATA_ABILITIES  0x80
1142
1143 /*------------------------------------------------------------------*/
1144 /* FAX SUB/SEP/PWD extension                                        */
1145 /*------------------------------------------------------------------*/
1146
1147
1148 #define PRIVATE_FAX_SUB_SEP_PWD        3
1149
1150
1151
1152 /*------------------------------------------------------------------*/
1153 /* V.18 extension                                                   */
1154 /*------------------------------------------------------------------*/
1155
1156
1157 #define PRIVATE_V18                    4
1158
1159
1160
1161 /*------------------------------------------------------------------*/
1162 /* DTMF TONE extension                                              */
1163 /*------------------------------------------------------------------*/
1164
1165
1166 #define DTMF_GET_SUPPORTED_DETECT_CODES  0xf8
1167 #define DTMF_GET_SUPPORTED_SEND_CODES    0xf9
1168 #define DTMF_LISTEN_TONE_START           0xfa
1169 #define DTMF_LISTEN_TONE_STOP            0xfb
1170 #define DTMF_SEND_TONE                   0xfc
1171 #define DTMF_LISTEN_MF_START             0xfd
1172 #define DTMF_LISTEN_MF_STOP              0xfe
1173 #define DTMF_SEND_MF                     0xff
1174
1175 #define DTMF_MF_DIGIT_TONE_CODE_1               0x10
1176 #define DTMF_MF_DIGIT_TONE_CODE_2               0x11
1177 #define DTMF_MF_DIGIT_TONE_CODE_3               0x12
1178 #define DTMF_MF_DIGIT_TONE_CODE_4               0x13
1179 #define DTMF_MF_DIGIT_TONE_CODE_5               0x14
1180 #define DTMF_MF_DIGIT_TONE_CODE_6               0x15
1181 #define DTMF_MF_DIGIT_TONE_CODE_7               0x16
1182 #define DTMF_MF_DIGIT_TONE_CODE_8               0x17
1183 #define DTMF_MF_DIGIT_TONE_CODE_9               0x18
1184 #define DTMF_MF_DIGIT_TONE_CODE_0               0x19
1185 #define DTMF_MF_DIGIT_TONE_CODE_K1              0x1a
1186 #define DTMF_MF_DIGIT_TONE_CODE_K2              0x1b
1187 #define DTMF_MF_DIGIT_TONE_CODE_KP              0x1c
1188 #define DTMF_MF_DIGIT_TONE_CODE_S1              0x1d
1189 #define DTMF_MF_DIGIT_TONE_CODE_ST              0x1e
1190
1191 #define DTMF_DIGIT_CODE_COUNT                   16
1192 #define DTMF_MF_DIGIT_CODE_BASE                 DSP_DTMF_DIGIT_CODE_COUNT
1193 #define DTMF_MF_DIGIT_CODE_COUNT                15
1194 #define DTMF_TOTAL_DIGIT_CODE_COUNT             (DSP_MF_DIGIT_CODE_BASE + DSP_MF_DIGIT_CODE_COUNT)
1195
1196 #define DTMF_TONE_DIGIT_BASE                    0x80
1197
1198 #define DTMF_SIGNAL_NO_TONE                     (DTMF_TONE_DIGIT_BASE + 0)
1199 #define DTMF_SIGNAL_UNIDENTIFIED_TONE           (DTMF_TONE_DIGIT_BASE + 1)
1200
1201 #define DTMF_SIGNAL_DIAL_TONE                   (DTMF_TONE_DIGIT_BASE + 2)
1202 #define DTMF_SIGNAL_PABX_INTERNAL_DIAL_TONE     (DTMF_TONE_DIGIT_BASE + 3)
1203 #define DTMF_SIGNAL_SPECIAL_DIAL_TONE           (DTMF_TONE_DIGIT_BASE + 4)   /* stutter dial tone */
1204 #define DTMF_SIGNAL_SECOND_DIAL_TONE            (DTMF_TONE_DIGIT_BASE + 5)
1205 #define DTMF_SIGNAL_RINGING_TONE                (DTMF_TONE_DIGIT_BASE + 6)
1206 #define DTMF_SIGNAL_SPECIAL_RINGING_TONE        (DTMF_TONE_DIGIT_BASE + 7)
1207 #define DTMF_SIGNAL_BUSY_TONE                   (DTMF_TONE_DIGIT_BASE + 8)
1208 #define DTMF_SIGNAL_CONGESTION_TONE             (DTMF_TONE_DIGIT_BASE + 9)   /* reorder tone */
1209 #define DTMF_SIGNAL_SPECIAL_INFORMATION_TONE    (DTMF_TONE_DIGIT_BASE + 10)
1210 #define DTMF_SIGNAL_COMFORT_TONE                (DTMF_TONE_DIGIT_BASE + 11)
1211 #define DTMF_SIGNAL_HOLD_TONE                   (DTMF_TONE_DIGIT_BASE + 12)
1212 #define DTMF_SIGNAL_RECORD_TONE                 (DTMF_TONE_DIGIT_BASE + 13)
1213 #define DTMF_SIGNAL_CALLER_WAITING_TONE         (DTMF_TONE_DIGIT_BASE + 14)
1214 #define DTMF_SIGNAL_CALL_WAITING_TONE           (DTMF_TONE_DIGIT_BASE + 15)
1215 #define DTMF_SIGNAL_PAY_TONE                    (DTMF_TONE_DIGIT_BASE + 16)
1216 #define DTMF_SIGNAL_POSITIVE_INDICATION_TONE    (DTMF_TONE_DIGIT_BASE + 17)
1217 #define DTMF_SIGNAL_NEGATIVE_INDICATION_TONE    (DTMF_TONE_DIGIT_BASE + 18)
1218 #define DTMF_SIGNAL_WARNING_TONE                (DTMF_TONE_DIGIT_BASE + 19)
1219 #define DTMF_SIGNAL_INTRUSION_TONE              (DTMF_TONE_DIGIT_BASE + 20)
1220 #define DTMF_SIGNAL_CALLING_CARD_SERVICE_TONE   (DTMF_TONE_DIGIT_BASE + 21)
1221 #define DTMF_SIGNAL_PAYPHONE_RECOGNITION_TONE   (DTMF_TONE_DIGIT_BASE + 22)
1222 #define DTMF_SIGNAL_CPE_ALERTING_SIGNAL         (DTMF_TONE_DIGIT_BASE + 23)
1223 #define DTMF_SIGNAL_OFF_HOOK_WARNING_TONE       (DTMF_TONE_DIGIT_BASE + 24)
1224
1225 #define DTMF_SIGNAL_INTERCEPT_TONE              (DTMF_TONE_DIGIT_BASE + 63)
1226
1227 #define DTMF_SIGNAL_MODEM_CALLING_TONE          (DTMF_TONE_DIGIT_BASE + 64)
1228 #define DTMF_SIGNAL_FAX_CALLING_TONE            (DTMF_TONE_DIGIT_BASE + 65)
1229 #define DTMF_SIGNAL_ANSWER_TONE                 (DTMF_TONE_DIGIT_BASE + 66)
1230 #define DTMF_SIGNAL_REVERSED_ANSWER_TONE        (DTMF_TONE_DIGIT_BASE + 67)
1231 #define DTMF_SIGNAL_ANSAM_TONE                  (DTMF_TONE_DIGIT_BASE + 68)
1232 #define DTMF_SIGNAL_REVERSED_ANSAM_TONE         (DTMF_TONE_DIGIT_BASE + 69)
1233 #define DTMF_SIGNAL_BELL103_ANSWER_TONE         (DTMF_TONE_DIGIT_BASE + 70)
1234 #define DTMF_SIGNAL_FAX_FLAGS                   (DTMF_TONE_DIGIT_BASE + 71)
1235 #define DTMF_SIGNAL_G2_FAX_GROUP_ID             (DTMF_TONE_DIGIT_BASE + 72)
1236 #define DTMF_SIGNAL_HUMAN_SPEECH                (DTMF_TONE_DIGIT_BASE + 73)
1237 #define DTMF_SIGNAL_ANSWERING_MACHINE_390       (DTMF_TONE_DIGIT_BASE + 74)
1238
1239 #define DTMF_MF_LISTEN_ACTIVE_FLAG     0x02
1240 #define DTMF_SEND_MF_FLAG              0x02
1241 #define DTMF_TONE_LISTEN_ACTIVE_FLAG   0x04
1242 #define DTMF_SEND_TONE_FLAG            0x04
1243
1244 #define PRIVATE_DTMF_TONE              5
1245
1246
1247 /*------------------------------------------------------------------*/
1248 /* FAX paper format extension                                       */
1249 /*------------------------------------------------------------------*/
1250
1251
1252 #define PRIVATE_FAX_PAPER_FORMATS      6
1253
1254
1255
1256 /*------------------------------------------------------------------*/
1257 /* V.OWN extension                                                  */
1258 /*------------------------------------------------------------------*/
1259
1260
1261 #define PRIVATE_VOWN                   7
1262
1263
1264
1265 /*------------------------------------------------------------------*/
1266 /* FAX non-standard facilities extension                            */
1267 /*------------------------------------------------------------------*/
1268
1269
1270 #define PRIVATE_FAX_NONSTANDARD        8
1271
1272
1273
1274 /*------------------------------------------------------------------*/
1275 /* Advanced voice                                                   */
1276 /*------------------------------------------------------------------*/
1277
1278 #define ADV_VOICE_WRITE_ACTIVATION    0
1279 #define ADV_VOICE_WRITE_DEACTIVATION  1
1280 #define ADV_VOICE_WRITE_UPDATE        2
1281
1282 #define ADV_VOICE_OLD_COEF_COUNT    6
1283 #define ADV_VOICE_NEW_COEF_BASE     (ADV_VOICE_OLD_COEF_COUNT * sizeof(word))
1284
1285 /*------------------------------------------------------------------*/
1286 /* B1 resource switching                                            */
1287 /*------------------------------------------------------------------*/
1288
1289 #define B1_FACILITY_LOCAL  0x01
1290 #define B1_FACILITY_MIXER  0x02
1291 #define B1_FACILITY_DTMFX  0x04
1292 #define B1_FACILITY_DTMFR  0x08
1293 #define B1_FACILITY_VOICE  0x10
1294 #define B1_FACILITY_EC     0x20
1295
1296 #define ADJUST_B_MODE_SAVE          0x0001
1297 #define ADJUST_B_MODE_REMOVE_L23    0x0002
1298 #define ADJUST_B_MODE_SWITCH_L1     0x0004
1299 #define ADJUST_B_MODE_NO_RESOURCE   0x0008
1300 #define ADJUST_B_MODE_ASSIGN_L23    0x0010
1301 #define ADJUST_B_MODE_USER_CONNECT  0x0020
1302 #define ADJUST_B_MODE_CONNECT       0x0040
1303 #define ADJUST_B_MODE_RESTORE       0x0080
1304
1305 #define ADJUST_B_START                     0
1306 #define ADJUST_B_SAVE_MIXER_1              1
1307 #define ADJUST_B_SAVE_DTMF_1               2
1308 #define ADJUST_B_REMOVE_L23_1              3
1309 #define ADJUST_B_REMOVE_L23_2              4
1310 #define ADJUST_B_SAVE_EC_1                 5
1311 #define ADJUST_B_SAVE_DTMF_PARAMETER_1     6
1312 #define ADJUST_B_SAVE_VOICE_1              7
1313 #define ADJUST_B_SWITCH_L1_1               8
1314 #define ADJUST_B_SWITCH_L1_2               9
1315 #define ADJUST_B_RESTORE_VOICE_1           10
1316 #define ADJUST_B_RESTORE_VOICE_2           11
1317 #define ADJUST_B_RESTORE_DTMF_PARAMETER_1  12
1318 #define ADJUST_B_RESTORE_DTMF_PARAMETER_2  13
1319 #define ADJUST_B_RESTORE_EC_1              14
1320 #define ADJUST_B_RESTORE_EC_2              15
1321 #define ADJUST_B_ASSIGN_L23_1              16
1322 #define ADJUST_B_ASSIGN_L23_2              17
1323 #define ADJUST_B_CONNECT_1                 18
1324 #define ADJUST_B_CONNECT_2                 19
1325 #define ADJUST_B_CONNECT_3                 20
1326 #define ADJUST_B_CONNECT_4                 21
1327 #define ADJUST_B_RESTORE_DTMF_1            22
1328 #define ADJUST_B_RESTORE_DTMF_2            23
1329 #define ADJUST_B_RESTORE_MIXER_1           24
1330 #define ADJUST_B_RESTORE_MIXER_2           25
1331 #define ADJUST_B_RESTORE_MIXER_3           26
1332 #define ADJUST_B_RESTORE_MIXER_4           27
1333 #define ADJUST_B_RESTORE_MIXER_5           28
1334 #define ADJUST_B_RESTORE_MIXER_6           29
1335 #define ADJUST_B_RESTORE_MIXER_7           30
1336 #define ADJUST_B_END                       31
1337
1338 /*------------------------------------------------------------------*/
1339 /* XON Protocol def's                                               */
1340 /*------------------------------------------------------------------*/
1341 #define N_CH_XOFF               0x01
1342 #define N_XON_SENT              0x02
1343 #define N_XON_REQ               0x04
1344 #define N_XON_CONNECT_IND       0x08
1345 #define N_RX_FLOW_CONTROL_MASK  0x3f
1346 #define N_OK_FC_PENDING         0x80
1347 #define N_TX_FLOW_CONTROL_MASK  0xc0
1348
1349 /*------------------------------------------------------------------*/
1350 /* NCPI state                                                       */
1351 /*------------------------------------------------------------------*/
1352 #define NCPI_VALID_CONNECT_B3_IND  0x01
1353 #define NCPI_VALID_CONNECT_B3_ACT  0x02
1354 #define NCPI_VALID_DISC_B3_IND     0x04
1355 #define NCPI_CONNECT_B3_ACT_SENT   0x08
1356 #define NCPI_NEGOTIATE_B3_SENT     0x10
1357 #define NCPI_MDM_CTS_ON_RECEIVED   0x40
1358 #define NCPI_MDM_DCD_ON_RECEIVED   0x80
1359
1360 /*------------------------------------------------------------------*/