divacapi.h 49 KB

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