Debian Codegraph @

include/dahdi/user.h

raw
1 /*
2 * DAHDI Telephony Interface
3 *
4 * Written by Mark Spencer <[email protected]>
5 * Based on previous works, designs, and architectures conceived and
6 * written by Jim Dixon <[email protected]>.
7 *
8 * Copyright (C) 2001 Jim Dixon / Zapata Telephony.
9 * Copyright (C) 2001 - 2008 Digium, Inc.
10 *
11 * All rights reserved.
12 *
13 */
14
15 /*
16 * See http://www.asterisk.org for more information about
17 * the Asterisk project. Please do not directly contact
18 * any of the maintainers of this project for assistance;
19 * the project provides a web site, mailing lists and IRC
20 * channels for your use.
21 *
22 * This program is free software, distributed under the terms of
23 * the GNU Lesser General Public License Version 2.1 as published
24 * by the Free Software Foundation. See the LICENSE.LGPL file
25 * included with this program for more details.
26 *
27 * In addition, when this program is distributed with Asterisk in
28 * any form that would qualify as a 'combined work' or as a
29 * 'derivative work' (but not mere aggregation), you can redistribute
30 * and/or modify the combination under the terms of the license
31 * provided with that copy of Asterisk, instead of the license
32 * terms granted here.
33 */
34
35 #ifndef _DAHDI_USER_H
36 #define _DAHDI_USER_H
37
38 #include <linux/types.h>
39 #include <linux/ioctl.h>
40 #include <dahdi/dahdi_config.h>
41
42 #ifndef ELAST
43 #define ELAST 500
44 #endif
45
46 /* Per-span configuration values */
47 #define DAHDI_CONFIG_TXLEVEL 7 /* bits 0-2 are tx level */
48
49 /* Line configuration */
50 /* These apply to T1 */
51 #define DAHDI_CONFIG_D4 (1 << 4)
52 #define DAHDI_CONFIG_ESF (1 << 5)
53 #define DAHDI_CONFIG_AMI (1 << 6)
54 #define DAHDI_CONFIG_B8ZS (1 << 7)
55 /* These apply to E1 */
56 #define DAHDI_CONFIG_CCS (1 << 8) /* CCS (ISDN) instead of CAS (Robbed Bit) */
57 #define DAHDI_CONFIG_HDB3 (1 << 9) /* HDB3 instead of AMI (line coding) */
58 #define DAHDI_CONFIG_CRC4 (1 << 10) /* CRC4 framing */
59 #define DAHDI_CONFIG_NOTOPEN (1 << 16)
60 /* These apply to BRI */
61 #define DAHDI_CONFIG_NTTE (1 << 11) /* To enable NT mode, set this bit to 1, for TE this should be 0 */
62 #define DAHDI_CONFIG_TERM (1 << 12) /* To enable Termination resistance set this bit to 1 */
63
64 /* Signalling types */
65 #define DAHDI_SIG_BROKEN (1 << 31) /* The port is broken and/or failed initialization */
66
67 #define __DAHDI_SIG_FXO (1 << 12) /* Never use directly */
68 #define __DAHDI_SIG_FXS (1 << 13) /* Never use directly */
69
70 #define DAHDI_SIG_NONE (0) /* Channel not configured */
71 #define DAHDI_SIG_FXSLS ((1 << 0) | __DAHDI_SIG_FXS) /* FXS, Loopstart */
72 #define DAHDI_SIG_FXSGS ((1 << 1) | __DAHDI_SIG_FXS) /* FXS, Groundstart */
73 #define DAHDI_SIG_FXSKS ((1 << 2) | __DAHDI_SIG_FXS) /* FXS, Kewlstart */
74
75 #define DAHDI_SIG_FXOLS ((1 << 3) | __DAHDI_SIG_FXO) /* FXO, Loopstart */
76 #define DAHDI_SIG_FXOGS ((1 << 4) | __DAHDI_SIG_FXO) /* FXO, Groupstart */
77 #define DAHDI_SIG_FXOKS ((1 << 5) | __DAHDI_SIG_FXO) /* FXO, Kewlstart */
78
79 #define DAHDI_SIG_EM (1 << 6) /* Ear & Mouth (E&M) */
80
81 /* The following are all variations on clear channel */
82
83 #define __DAHDI_SIG_DACS (1 << 16)
84
85 #define DAHDI_SIG_CLEAR (1 << 7) /* Clear channel */
86 #define DAHDI_SIG_HDLCRAW ((1 << 8) | DAHDI_SIG_CLEAR) /* Raw unchecked HDLC */
87 #define DAHDI_SIG_HDLCFCS ((1 << 9) | DAHDI_SIG_HDLCRAW) /* HDLC with FCS calculation */
88 #define DAHDI_SIG_HDLCNET ((1 << 10) | DAHDI_SIG_HDLCFCS) /* HDLC Network */
89 #define DAHDI_SIG_SLAVE (1 << 11) /* Slave to another channel */
90 #define DAHDI_SIG_SF (1 << 14) /* Single Freq. tone only, no sig bits */
91 #define DAHDI_SIG_CAS (1 << 15) /* Just get bits */
92 #define DAHDI_SIG_DACS (__DAHDI_SIG_DACS | DAHDI_SIG_CLEAR) /* Cross connect */
93 #define DAHDI_SIG_EM_E1 (1 << 17) /* E1 E&M Variation */
94 #define DAHDI_SIG_DACS_RBS ((1 << 18) | __DAHDI_SIG_DACS) /* Cross connect w/ RBS */
95 #define DAHDI_SIG_HARDHDLC ((1 << 19) | DAHDI_SIG_CLEAR)
96 #define DAHDI_SIG_MTP2 ((1 << 20) | DAHDI_SIG_HDLCFCS) /* MTP2 support Need HDLC bitstuff and FCS calcuation too */
97
98 /* tone flag values */
99 #define DAHDI_REVERSE_RXTONE 1 /* reverse polarity rx tone logic */
100 #define DAHDI_REVERSE_TXTONE 2 /* reverse polarity tx tone logic */
101
102 #define DAHDI_ABIT (1 << 3)
103 #define DAHDI_BBIT (1 << 2)
104 #define DAHDI_CBIT (1 << 1)
105 #define DAHDI_DBIT (1 << 0)
106
107 #define DAHDI_BITS_ABCD (DAHDI_ABIT | DAHDI_BBIT | DAHDI_CBIT | DAHDI_DBIT)
108 #define DAHDI_BITS_ABD (DAHDI_ABIT | DAHDI_BBIT | DAHDI_DBIT)
109 #define DAHDI_BITS_ACD (DAHDI_ABIT | DAHDI_CBIT | DAHDI_DBIT)
110 #define DAHDI_BITS_BCD (DAHDI_BBIT | DAHDI_CBIT | DAHDI_DBIT)
111 #define DAHDI_BITS_AC (DAHDI_ABIT | DAHDI_CBIT)
112 #define DAHDI_BITS_BD (DAHDI_BBIT | DAHDI_DBIT)
113
114 #define DAHDI_MAJOR 196
115
116 #define DAHDI_MAX_BLOCKSIZE 8192
117 #define DAHDI_DEFAULT_NUM_BUFS 2
118 #define DAHDI_MAX_NUM_BUFS 32
119 #define DAHDI_MAX_BUF_SPACE 32768
120
121 #define DAHDI_DEFAULT_BLOCKSIZE 1024
122 #define DAHDI_DEFAULT_MTR_MRU 2048
123
124 /*! Define the default network block size */
125 #define DAHDI_DEFAULT_MTU_MRU 2048
126
127 #define DAHDI_POLICY_IMMEDIATE 0 /* Start play/record immediately */
128 #define DAHDI_POLICY_WHEN_FULL 1 /* Start play/record when buffer is full */
129 #define DAHDI_POLICY_HALF_FULL 2 /* Start play/record when buffer is half full.
130 Note -- This policy only works on tx buffers */
131
132 #define DAHDI_GET_PARAMS_RETURN_MASTER 0x40000000
133
134 #define DAHDI_TONE_ZONE_MAX 128
135
136 #define DAHDI_TONE_ZONE_DEFAULT -1 /* To restore default */
137
138 #define DAHDI_TONE_STOP -1
139 #define DAHDI_TONE_DIALTONE 0
140 #define DAHDI_TONE_BUSY 1
141 #define DAHDI_TONE_RINGTONE 2
142 #define DAHDI_TONE_CONGESTION 3
143 #define DAHDI_TONE_CALLWAIT 4
144 #define DAHDI_TONE_DIALRECALL 5
145 #define DAHDI_TONE_RECORDTONE 6
146 #define DAHDI_TONE_INFO 7
147 #define DAHDI_TONE_CUST1 8
148 #define DAHDI_TONE_CUST2 9
149 #define DAHDI_TONE_STUTTER 10
150 #define DAHDI_TONE_MAX 16
151
152 #define DAHDI_TONE_DTMF_BASE 64
153 #define DAHDI_TONE_MFR1_BASE 80
154 #define DAHDI_TONE_MFR2_FWD_BASE 96
155 #define DAHDI_TONE_MFR2_REV_BASE 112
156
157 enum {
158 DAHDI_TONE_DTMF_0 = DAHDI_TONE_DTMF_BASE,
159 DAHDI_TONE_DTMF_1,
160 DAHDI_TONE_DTMF_2,
161 DAHDI_TONE_DTMF_3,
162 DAHDI_TONE_DTMF_4,
163 DAHDI_TONE_DTMF_5,
164 DAHDI_TONE_DTMF_6,
165 DAHDI_TONE_DTMF_7,
166 DAHDI_TONE_DTMF_8,
167 DAHDI_TONE_DTMF_9,
168 DAHDI_TONE_DTMF_s,
169 DAHDI_TONE_DTMF_p,
170 DAHDI_TONE_DTMF_A,
171 DAHDI_TONE_DTMF_B,
172 DAHDI_TONE_DTMF_C,
173 DAHDI_TONE_DTMF_D
174 };
175
176 #define DAHDI_TONE_DTMF_MAX DAHDI_TONE_DTMF_D
177
178 enum {
179 DAHDI_TONE_MFR1_0 = DAHDI_TONE_MFR1_BASE,
180 DAHDI_TONE_MFR1_1,
181 DAHDI_TONE_MFR1_2,
182 DAHDI_TONE_MFR1_3,
183 DAHDI_TONE_MFR1_4,
184 DAHDI_TONE_MFR1_5,
185 DAHDI_TONE_MFR1_6,
186 DAHDI_TONE_MFR1_7,
187 DAHDI_TONE_MFR1_8,
188 DAHDI_TONE_MFR1_9,
189 DAHDI_TONE_MFR1_KP,
190 DAHDI_TONE_MFR1_ST,
191 DAHDI_TONE_MFR1_STP,
192 DAHDI_TONE_MFR1_ST2P,
193 DAHDI_TONE_MFR1_ST3P,
194 };
195
196 #define DAHDI_TONE_MFR1_MAX DAHDI_TONE_MFR1_ST3P
197
198 enum {
199 DAHDI_TONE_MFR2_FWD_1 = DAHDI_TONE_MFR2_FWD_BASE,
200 DAHDI_TONE_MFR2_FWD_2,
201 DAHDI_TONE_MFR2_FWD_3,
202 DAHDI_TONE_MFR2_FWD_4,
203 DAHDI_TONE_MFR2_FWD_5,
204 DAHDI_TONE_MFR2_FWD_6,
205 DAHDI_TONE_MFR2_FWD_7,
206 DAHDI_TONE_MFR2_FWD_8,
207 DAHDI_TONE_MFR2_FWD_9,
208 DAHDI_TONE_MFR2_FWD_10,
209 DAHDI_TONE_MFR2_FWD_11,
210 DAHDI_TONE_MFR2_FWD_12,
211 DAHDI_TONE_MFR2_FWD_13,
212 DAHDI_TONE_MFR2_FWD_14,
213 DAHDI_TONE_MFR2_FWD_15,
214 };
215
216 #define DAHDI_TONE_MFR2_FWD_MAX DAHDI_TONE_MFR2_FWD_15
217
218 enum {
219 DAHDI_TONE_MFR2_REV_1 = DAHDI_TONE_MFR2_REV_BASE,
220 DAHDI_TONE_MFR2_REV_2,
221 DAHDI_TONE_MFR2_REV_3,
222 DAHDI_TONE_MFR2_REV_4,
223 DAHDI_TONE_MFR2_REV_5,
224 DAHDI_TONE_MFR2_REV_6,
225 DAHDI_TONE_MFR2_REV_7,
226 DAHDI_TONE_MFR2_REV_8,
227 DAHDI_TONE_MFR2_REV_9,
228 DAHDI_TONE_MFR2_REV_10,
229 DAHDI_TONE_MFR2_REV_11,
230 DAHDI_TONE_MFR2_REV_12,
231 DAHDI_TONE_MFR2_REV_13,
232 DAHDI_TONE_MFR2_REV_14,
233 DAHDI_TONE_MFR2_REV_15,
234 };
235
236 #define DAHDI_TONE_MFR2_REV_MAX DAHDI_TONE_MFR2_REV_15
237
238 #define DAHDI_LAW_DEFAULT 0 /* Default law for span */
239 #define DAHDI_LAW_MULAW 1 /* Mu-law */
240 #define DAHDI_LAW_ALAW 2 /* A-law */
241
242 #define DAHDI_DIAL_OP_APPEND 1
243 #define DAHDI_DIAL_OP_REPLACE 2
244 #define DAHDI_DIAL_OP_CANCEL 3
245
246 #define DAHDI_MAX_CADENCE 16
247
248 #define DAHDI_TONEDETECT_ON (1 << 0) /* Detect tones */
249 #define DAHDI_TONEDETECT_MUTE (1 << 1) /* Mute audio in received channel */
250
251 /* Define the max # of outgoing DTMF, MFR1 or MFR2 digits to queue */
252 #define DAHDI_MAX_DTMF_BUF 256
253
254 #define DAHDI_MAX_EVENTSIZE 64 /* 64 events max in buffer */
255
256 /* Value for DAHDI_HOOK, set to ON hook */
257 #define DAHDI_ONHOOK 0
258
259 /* Value for DAHDI_HOOK, set to OFF hook */
260 #define DAHDI_OFFHOOK 1
261
262 /* Value for DAHDI_HOOK, wink (off hook momentarily) */
263 #define DAHDI_WINK 2
264
265 /* Value for DAHDI_HOOK, flash (on hook momentarily) */
266 #define DAHDI_FLASH 3
267
268 /* Value for DAHDI_HOOK, start line */
269 #define DAHDI_START 4
270
271 /* Value for DAHDI_HOOK, ring line (same as start line) */
272 #define DAHDI_RING 5
273
274 /* Value for DAHDI_HOOK, turn ringer off */
275 #define DAHDI_RINGOFF 6
276
277 /* Flush and stop the read (input) process */
278 #define DAHDI_FLUSH_READ 1
279
280 /* Flush and stop the write (output) process */
281 #define DAHDI_FLUSH_WRITE 2
282
283 /* Flush and stop both (input and output) processes */
284 #define DAHDI_FLUSH_BOTH (DAHDI_FLUSH_READ | DAHDI_FLUSH_WRITE)
285
286 /* Flush the event queue */
287 #define DAHDI_FLUSH_EVENT 4
288
289 /* Flush everything */
290 #define DAHDI_FLUSH_ALL (DAHDI_FLUSH_BOTH | DAHDI_FLUSH_EVENT)
291
292 #define DAHDI_MAX_SPANS 128 /* Max, 128 spans */
293 #define DAHDI_MAX_CHANNELS 1024 /* Max, 1024 channels */
294 #define DAHDI_MAX_CONF 1024 /* Max, 1024 conferences */
295
296 /* Conference modes */
297 #define DAHDI_CONF_MODE_MASK 0xFF /* mask for modes */
298 #define DAHDI_CONF_NORMAL 0 /* normal mode */
299 #define DAHDI_CONF_MONITOR 1 /* monitor mode (rx of other chan) */
300 #define DAHDI_CONF_MONITORTX 2 /* monitor mode (tx of other chan) */
301 #define DAHDI_CONF_MONITORBOTH 3 /* monitor mode (rx & tx of other chan) */
302 #define DAHDI_CONF_CONF 4 /* conference mode */
303 #define DAHDI_CONF_CONFANN 5 /* conference announce mode */
304 #define DAHDI_CONF_CONFMON 6 /* conference monitor mode */
305 #define DAHDI_CONF_CONFANNMON 7 /* conference announce/monitor mode */
306 #define DAHDI_CONF_REALANDPSEUDO 8 /* real and pseudo port both on conf */
307 #define DAHDI_CONF_DIGITALMON 9 /* Do not decode or interpret */
308 #define DAHDI_CONF_MONITOR_RX_PREECHO 10 /* monitor mode (rx of other chan) - before echo can is done */
309 #define DAHDI_CONF_MONITOR_TX_PREECHO 11 /* monitor mode (tx of other chan) - before echo can is done */
310 #define DAHDI_CONF_MONITORBOTH_PREECHO 12 /* monitor mode (rx & tx of other chan) - before echo can is done */
311 #define DAHDI_CONF_FLAG_MASK 0xFF00 /* mask for flags */
312 #define DAHDI_CONF_LISTENER 0x100 /* is a listener on the conference */
313 #define DAHDI_CONF_TALKER 0x200 /* is a talker on the conference */
314 #define DAHDI_CONF_PSEUDO_LISTENER 0x400 /* pseudo is a listener on the conference */
315 #define DAHDI_CONF_PSEUDO_TALKER 0x800 /* pseudo is a talker on the conference */
316
317 /* Alarm Condition bits */
318 #define DAHDI_ALARM_NONE 0 /* No alarms */
319 #define DAHDI_ALARM_RECOVER (1 << 0) /* Recovering from alarm */
320 #define DAHDI_ALARM_LOOPBACK (1 << 1) /* In loopback */
321 #define DAHDI_ALARM_YELLOW (1 << 2) /* Yellow Alarm */
322 #define DAHDI_ALARM_RED (1 << 3) /* Red Alarm */
323 #define DAHDI_ALARM_BLUE (1 << 4) /* Blue Alarm */
324 #define DAHDI_ALARM_NOTOPEN (1 << 5)
325 /* Verbose alarm states (upper byte) */
326 #define DAHDI_ALARM_LOS (1 << 8) /* Loss of Signal */
327 #define DAHDI_ALARM_LFA (1 << 9) /* Loss of Frame Alignment */
328 #define DAHDI_ALARM_LMFA (1 << 10)/* Loss of Multi-Frame Align */
329
330 /* Maintenance modes */
331 #define DAHDI_MAINT_NONE 0 /* Normal Mode */
332 #define DAHDI_MAINT_LOCALLOOP 1 /* Local Loopback */
333 #define DAHDI_MAINT_REMOTELOOP 2 /* Remote Loopback */
334 #define DAHDI_MAINT_NETWORKLINELOOP 2 /* Remote Loopback */
335 #define DAHDI_MAINT_LOOPUP 3 /* send loopup code */
336 #define DAHDI_MAINT_LOOPDOWN 4 /* send loopdown code */
337 #define DAHDI_MAINT_FAS_DEFECT 6 /* insert a FAS defect */
338 #define DAHDI_MAINT_MULTI_DEFECT 7 /* insert a Multiframe defect */
339 #define DAHDI_MAINT_CRC_DEFECT 8 /* insert a FAS defect */
340 #define DAHDI_MAINT_CAS_DEFECT 9 /* insert a FAS defect */
341 #define DAHDI_MAINT_PRBS_DEFECT 10 /* insert a FAS defect */
342 #define DAHDI_MAINT_BIPOLAR_DEFECT 11 /* insert a FAS defect */
343 #define DAHDI_MAINT_PRBS 12 /* enable the PRBS gen/mon */
344 #define DAHDI_MAINT_NETWORKPAYLOADLOOP 13 /* Remote Loopback */
345 #define DAHDI_RESET_COUNTERS 14 /* Clear the error counters */
346 #define DAHDI_MAINT_ALARM_SIM 15 /* Simulate alarms */
347
348 /* Flag Value for IOMUX, read avail */
349 #define DAHDI_IOMUX_READ 1
350
351 /* Flag Value for IOMUX, write avail */
352 #define DAHDI_IOMUX_WRITE 2
353
354 /* Flag Value for IOMUX, write done */
355 #define DAHDI_IOMUX_WRITEEMPTY 4
356
357 /* Flag Value for IOMUX, signalling event avail */
358 #define DAHDI_IOMUX_SIGEVENT 8
359
360 /* Flag Value for IOMUX, Do Not Wait if nothing to report */
361 #define DAHDI_IOMUX_NOWAIT 0x100
362
363 /* Ret. Value for GET/WAIT Event, no event */
364 #define DAHDI_EVENT_NONE 0
365
366 /* Ret. Value for GET/WAIT Event, Went Onhook */
367 #define DAHDI_EVENT_ONHOOK 1
368
369 /* Ret. Value for GET/WAIT Event, Went Offhook or got Ring */
370 #define DAHDI_EVENT_RINGOFFHOOK 2
371
372 /* Ret. Value for GET/WAIT Event, Got Wink or Flash */
373 #define DAHDI_EVENT_WINKFLASH 3
374
375 /* Ret. Value for GET/WAIT Event, Got Alarm */
376 #define DAHDI_EVENT_ALARM 4
377
378 /* Ret. Value for GET/WAIT Event, Got No Alarm (after alarm) */
379 #define DAHDI_EVENT_NOALARM 5
380
381 /* Ret. Value for GET/WAIT Event, HDLC Abort frame */
382 #define DAHDI_EVENT_ABORT 6
383
384 /* Ret. Value for GET/WAIT Event, HDLC Frame overrun */
385 #define DAHDI_EVENT_OVERRUN 7
386
387 /* Ret. Value for GET/WAIT Event, Bad FCS */
388 #define DAHDI_EVENT_BADFCS 8
389
390 /* Ret. Value for dial complete */
391 #define DAHDI_EVENT_DIALCOMPLETE 9
392
393 /* Ret Value for ringer going on */
394 #define DAHDI_EVENT_RINGERON 10
395
396 /* Ret Value for ringer going off */
397 #define DAHDI_EVENT_RINGEROFF 11
398
399 /* Ret Value for hook change complete */
400 #define DAHDI_EVENT_HOOKCOMPLETE 12
401
402 /* Ret Value for bits changing on a CAS / User channel */
403 #define DAHDI_EVENT_BITSCHANGED 13
404
405 /* Ret value for the beginning of a pulse coming on its way */
406 #define DAHDI_EVENT_PULSE_START 14
407
408 /* Timer event -- timer expired */
409 #define DAHDI_EVENT_TIMER_EXPIRED 15
410
411 /* Timer event -- ping ready */
412 #define DAHDI_EVENT_TIMER_PING 16
413
414 /* Polarity reversal event */
415 #define DAHDI_EVENT_POLARITY 17
416
417 /* Ring Begin event */
418 #define DAHDI_EVENT_RINGBEGIN 18
419
420 /* Echo can disabled event */
421 #define DAHDI_EVENT_EC_DISABLED 19
422
423 /* Channel was disconnected. Hint user to close channel */
424 #define DAHDI_EVENT_REMOVED 20
425
426 /* A neon MWI pulse was detected */
427 #define DAHDI_EVENT_NEONMWI_ACTIVE 21
428
429 /* No neon MWI pulses were detected over some period of time */
430 #define DAHDI_EVENT_NEONMWI_INACTIVE 22
431
432 /* A CED tone was detected on the channel in the transmit direction */
433 #define DAHDI_EVENT_TX_CED_DETECTED 23
434
435 /* A CED tone was detected on the channel in the receive direction */
436 #define DAHDI_EVENT_RX_CED_DETECTED 24
437
438 /* A CNG tone was detected on the channel in the transmit direction */
439 #define DAHDI_EVENT_TX_CNG_DETECTED 25
440
441 /* A CNG tone was detected on the channel in the receive direction */
442 #define DAHDI_EVENT_RX_CNG_DETECTED 26
443
444 /* The echo canceler's NLP (only) was disabled */
445 #define DAHDI_EVENT_EC_NLP_DISABLED 27
446
447 /* The echo canceler's NLP (only) was enabled */
448 #define DAHDI_EVENT_EC_NLP_ENABLED 28
449
450 /* The channel's read buffer encountered an overrun condition */
451 #define DAHDI_EVENT_READ_OVERRUN 29
452
453 /* The channel's write buffer encountered an underrun condition */
454 #define DAHDI_EVENT_WRITE_UNDERRUN 30
455
456 #define DAHDI_EVENT_PULSEDIGIT (1 << 16) /* This is OR'd with the digit received */
457 #define DAHDI_EVENT_DTMFDOWN (1 << 17) /* Ditto for DTMF key down event */
458 #define DAHDI_EVENT_DTMFUP (1 << 18) /* Ditto for DTMF key up event */
459
460 /* Transcoder related definitions */
461
462 struct dahdi_transcoder_formats {
463 __u32 srcfmt;
464 __u32 dstfmt;
465 };
466 struct dahdi_transcoder_info {
467 __u32 tcnum;
468 char name[80];
469 __u32 numchannels;
470 __u32 dstfmts;
471 __u32 srcfmts;
472 };
473
474 #define DAHDI_MAX_ECHOCANPARAMS 8
475
476 /* ioctl definitions */
477 #define DAHDI_CODE 0xDA
478
479 /*
480 * Get/Set Transfer Block Size.
481 */
482 #define DAHDI_GET_BLOCKSIZE _IOR(DAHDI_CODE, 1, int)
483 #define DAHDI_SET_BLOCKSIZE _IOW(DAHDI_CODE, 1, int)
484
485 /*
486 * Flush Buffer(s) and stop I/O
487 */
488 #define DAHDI_FLUSH _IOW(DAHDI_CODE, 3, int)
489
490 /*
491 * Wait for Write to Finish
492 */
493 #define DAHDI_SYNC _IO(DAHDI_CODE, 4)
494
495 /*
496 * Get/set channel parameters
497 */
498
499 struct dahdi_params {
500 int channo; /* Channel number */
501 int spanno; /* Span itself */
502 int chanpos; /* Channel number in span */
503 int sigtype; /* read-only */
504 int sigcap; /* read-only */
505 int rxisoffhook; /* read-only */
506 int rxbits; /* read-only */
507 int txbits; /* read-only */
508 int txhooksig; /* read-only */
509 int rxhooksig; /* read-only */
510 int curlaw; /* read-only -- one of DAHDI_LAW_MULAW or DAHDI_LAW_ALAW */
511 int idlebits; /* read-only -- What is considered the idle state */
512 char name[40]; /* Name of channel */
513 int prewinktime;
514 int preflashtime;
515 int winktime;
516 int flashtime;
517 int starttime;
518 int rxwinktime;
519 int rxflashtime;
520 int debouncetime;
521 int pulsebreaktime;
522 int pulsemaketime;
523 int pulseaftertime;
524 __u32 chan_alarms; /* alarms on this channel */
525 };
526
527 #define DAHDI_GET_PARAMS_V1 _IOR(DAHDI_CODE, 5, struct dahdi_params)
528 #define DAHDI_GET_PARAMS _IOWR(DAHDI_CODE, 5, struct dahdi_params)
529 #define DAHDI_SET_PARAMS _IOW(DAHDI_CODE, 5, struct dahdi_params)
530
531 /*
532 * Set Hookswitch Status
533 */
534 #define DAHDI_HOOK _IOW(DAHDI_CODE, 7, int)
535
536 /*
537 * Get Signalling Event
538 */
539 #define DAHDI_GETEVENT _IOR(DAHDI_CODE, 8, int)
540
541 /*
542 * Wait for something to happen (IO Mux)
543 */
544 #define DAHDI_IOMUX _IOWR(DAHDI_CODE, 9, int)
545
546 /*
547 * Get Span Status
548 */
549 struct dahdi_spaninfo {
550 int spanno; /* span number */
551 char name[20]; /* Name */
552 char desc[40]; /* Description */
553 int alarms; /* alarms status */
554 int txlevel; /* what TX level is set to */
555 int rxlevel; /* current RX level */
556
557 int bpvcount; /* current BPV count */
558 int crc4count; /* current CRC4 error count */
559 int ebitcount; /* current E-bit error count */
560 int fascount; /* current FAS error count */
561 __u32 fecount; /* Framing error counter */
562 __u32 cvcount; /* Coding violations counter */
563 __u32 becount; /* current bit error count */
564 __u32 prbs; /* current PRBS detected pattern */
565 __u32 errsec; /* errored seconds */
566
567 int irqmisses; /* current IRQ misses */
568 int syncsrc; /* span # of current sync source,
569 or 0 for free run */
570 int numchans; /* number of configured channels on this span */
571 int totalchans; /* total number of channels on the span */
572 int totalspans; /* total number of spans in entire system */
573 int lbo; /* line build out */
574 int lineconfig; /* framing/coding */
575 char lboname[40]; /* line build out in text form */
576 char location[40]; /* span's device location in system */
577 char manufacturer[40]; /* manufacturer of span's device */
578 char devicetype[40]; /* span's device type */
579 int irq; /* span's device IRQ */
580 int linecompat; /* span global signaling or 0 for
581 analog spans.*/
582 char spantype[6]; /* type of span in text form */
583 } __attribute__((packed));
584
585 struct dahdi_spaninfo_v1 {
586 int spanno; /* span number */
587 char name[20]; /* Name */
588 char desc[40]; /* Description */
589 int alarms; /* alarms status */
590 int txlevel; /* what TX level is set to */
591 int rxlevel; /* current RX level */
592 int bpvcount; /* current BPV count */
593 int crc4count; /* current CRC4 error count */
594 int ebitcount; /* current E-bit error count */
595 int fascount; /* current FAS error count */
596 int irqmisses; /* current IRQ misses */
597 int syncsrc; /* span # of current sync source, or 0 for free run */
598 int numchans; /* number of configured channels on this span */
599 int totalchans; /* total number of channels on the span */
600 int totalspans; /* total number of spans in entire system */
601 int lbo; /* line build out */
602 int lineconfig; /* framing/coding */
603 char lboname[40]; /* line build out in text form */
604 char location[40]; /* span's device location in system */
605 char manufacturer[40]; /* manufacturer of span's device */
606 char devicetype[40]; /* span's device type */
607 int irq; /* span's device IRQ */
608 int linecompat; /* signaling modes possible on this span */
609 char spantype[6]; /* type of span in text form */
610 };
611 #define DAHDI_SPANSTAT _IOWR(DAHDI_CODE, 10, struct dahdi_spaninfo)
612 #define DAHDI_SPANSTAT_V1 _IOWR(DAHDI_CODE, 10, struct dahdi_spaninfo_v1)
613
614 /*
615 * Set Maintenance Mode
616 */
617 struct dahdi_maintinfo {
618 int spanno; /* span number */
619 int command; /* command */
620 };
621
622 #define DAHDI_MAINT _IOW(DAHDI_CODE, 11, struct dahdi_maintinfo)
623
624 /*
625 * Get/Set Conference Mode
626 */
627 struct dahdi_confinfo {
628 int chan; /* channel number, 0 for current */
629 int confno; /* conference number */
630 int confmode; /* conferencing mode */
631 };
632
633 #define DAHDI_GETCONF_V1 _IOR(DAHDI_CODE, 12, struct dahdi_confinfo)
634 #define DAHDI_GETCONF _IOWR(DAHDI_CODE, 12, struct dahdi_confinfo)
635
636 #define DAHDI_SETCONF_V1 _IOW(DAHDI_CODE, 12, struct dahdi_confinfo)
637 #define DAHDI_SETCONF _IOWR(DAHDI_CODE, 13, struct dahdi_confinfo)
638
639 /*
640 * Setup or Remove Conference Link
641 */
642 #define DAHDI_CONFLINK _IOW(DAHDI_CODE, 14, struct dahdi_confinfo)
643
644 /*
645 * Display Conference Diagnostic Information on Console
646 */
647 #define DAHDI_CONFDIAG_V1 _IOR(DAHDI_CODE, 15, int)
648 #define DAHDI_CONFDIAG _IOW(DAHDI_CODE, 15, int)
649
650 /*
651 * Get/Set Channel audio gains
652 */
653 struct dahdi_gains {
654 int chan; /* channel number, 0 for current */
655 unsigned char rxgain[256]; /* Receive gain table */
656 unsigned char txgain[256]; /* Transmit gain table */
657 };
658
659 #define DAHDI_GETGAINS_V1 _IOR(DAHDI_CODE, 16, struct dahdi_gains)
660 #define DAHDI_GETGAINS _IOWR(DAHDI_CODE, 16, struct dahdi_gains)
661 #define DAHDI_SETGAINS _IOW(DAHDI_CODE, 16, struct dahdi_gains)
662
663 /*
664 * Set Line (T1) Configurations
665 */
666 struct dahdi_lineconfig {
667 int span; /* Which span number (0 to use name) */
668 char name[20]; /* Name of span to use */
669 int lbo; /* line build-outs */
670 int lineconfig; /* line config parameters (framing, coding) */
671 int sync; /* what level of sync source we are */
672 };
673
674 #define DAHDI_SPANCONFIG _IOW(DAHDI_CODE, 18, struct dahdi_lineconfig)
675
676 /*
677 * Set Channel Configuration
678 */
679 struct dahdi_chanconfig {
680 int chan; /* Channel we're applying this to (0 to use name) */
681 char name[40]; /* Name of channel to use */
682 int sigtype; /* Signal type */
683 int deflaw; /* Default law (DAHDI_LAW_DEFAULT, DAHDI_LAW_MULAW, or DAHDI_LAW_ALAW) */
684 int master; /* Master channel if sigtype is DAHDI_SLAVE */
685 int idlebits; /* Idle bits (if this is a CAS channel) or
686 channel to monitor (if this is DACS channel) */
687 char netdev_name[16];/* name for the hdlc network device*/
688 };
689
690 #define DAHDI_CHANCONFIG _IOW(DAHDI_CODE, 19, struct dahdi_chanconfig)
691
692 /*
693 * Set Conference to mute mode
694 */
695 #define DAHDI_CONFMUTE _IOW(DAHDI_CODE, 20, int)
696
697 /*
698 * Send a particular tone (see DAHDI_TONE_*)
699 */
700 #define DAHDI_SENDTONE _IOW(DAHDI_CODE, 21, int)
701
702 /*
703 * Get/Set your region for tones
704 */
705 #define DAHDI_GETTONEZONE _IOR(DAHDI_CODE, 22, int)
706 #define DAHDI_SETTONEZONE _IOW(DAHDI_CODE, 22, int)
707
708 /*
709 * Master unit only -- set default zone (see DAHDI_TONE_ZONE_*)
710 */
711 #define DAHDI_DEFAULTZONE _IOW(DAHDI_CODE, 24, int)
712
713 /*
714 * Load a tone zone from a dahdi_tone_def_header
715 */
716 struct dahdi_tone_def {
717 int tone; /* See DAHDI_TONE_* */
718 int next; /* What the next position in the cadence is
719 (They're numbered by the order the appear here) */
720 int samples; /* How many samples to play for this cadence */
721 int shift; /* How much to scale down the volume (2 is nice) */
722
723 /* Now come the constants we need to make tones */
724
725 /*
726 Calculate the next 6 factors using the following equations:
727 l = <level in dbm>, f1 = <freq1>, f2 = <freq2>
728 gain = pow(10.0, (l - 3.14) / 20.0) * 65536.0 / 2.0;
729
730 // Frequency factor 1
731 fac_1 = 2.0 * cos(2.0 * M_PI * (f1/8000.0)) * 32768.0;
732 // Last previous two samples
733 init_v2_1 = sin(-4.0 * M_PI * (f1/8000.0)) * gain;
734 init_v3_1 = sin(-2.0 * M_PI * (f1/8000.0)) * gain;
735
736 // Frequency factor 2
737 fac_2 = 2.0 * cos(2.0 * M_PI * (f2/8000.0)) * 32768.0;
738 // Last previous two samples
739 init_v2_2 = sin(-4.0 * M_PI * (f2/8000.0)) * gain;
740 init_v3_2 = sin(-2.0 * M_PI * (f2/8000.0)) * gain;
741 */
742 int fac1;
743 int init_v2_1;
744 int init_v3_1;
745 int fac2;
746 int init_v2_2;
747 int init_v3_2;
748 int modulate;
749 };
750
751 struct dahdi_tone_def_header {
752 int count; /* How many samples follow */
753 int zone; /* Which zone we are loading */
754 int ringcadence[DAHDI_MAX_CADENCE]; /* Ring cadence in ms (0=on, 1=off, ends with 0 value) */
755 char name[40]; /* Informational name of zone */
756 /* immediately follow this structure with dahdi_tone_def structures */
757 struct dahdi_tone_def tones[0];
758 };
759
760 #define DAHDI_LOADZONE _IOW(DAHDI_CODE, 25, struct dahdi_tone_def_header)
761
762 /*
763 * Free a tone zone
764 */
765 #define DAHDI_FREEZONE _IOW(DAHDI_CODE, 26, int)
766
767 /*
768 * Get/Set buffer policy
769 */
770 struct dahdi_bufferinfo {
771 int txbufpolicy; /* Policy for handling receive buffers */
772 int rxbufpolicy; /* Policy for handling receive buffers */
773 int numbufs; /* How many buffers to use */
774 int bufsize; /* How big each buffer is */
775 int readbufs; /* How many read buffers are full (read-only) */
776 int writebufs; /* How many write buffers are full (read-only) */
777 };
778
779 #define DAHDI_GET_BUFINFO _IOR(DAHDI_CODE, 27, struct dahdi_bufferinfo)
780 #define DAHDI_SET_BUFINFO _IOW(DAHDI_CODE, 27, struct dahdi_bufferinfo)
781
782 /*
783 * Get/Set dialing parameters
784 */
785 struct dahdi_dialparams {
786 int mfv1_tonelen; /* MF R1 tone length for digits */
787 int dtmf_tonelen; /* DTMF tone length */
788 int mfr2_tonelen; /* MF R2 tone length */
789 int reserved[3]; /* Reserved for future expansion -- always set to 0 */
790 };
791
792 #define DAHDI_GET_DIALPARAMS _IOR(DAHDI_CODE, 29, struct dahdi_dialparams)
793 #define DAHDI_SET_DIALPARAMS _IOW(DAHDI_CODE, 29, struct dahdi_dialparams)
794
795 /*
796 * Append, replace, or cancel a dial string
797 */
798 struct dahdi_dialoperation {
799 int op;
800 char dialstr[DAHDI_MAX_DTMF_BUF];
801 };
802
803 #define DAHDI_DIAL _IOW(DAHDI_CODE, 31, struct dahdi_dialoperation)
804
805 /*
806 * Set a clear channel into audio mode
807 */
808 #define DAHDI_AUDIOMODE _IOW(DAHDI_CODE, 32, int)
809
810 /*
811 * Enable or disable echo cancellation on a channel
812 *
813 * For ECHOCANCEL:
814 * The number is zero to disable echo cancellation and non-zero
815 * to enable echo cancellation. If the number is between 32
816 * and 1024, it will also set the number of taps in the echo canceller
817 *
818 * For ECHOCANCEL_PARAMS:
819 * The structure contains parameters that should be passed to the
820 * echo canceler instance for the selected channel.
821 */
822 #define DAHDI_ECHOCANCEL _IOW(DAHDI_CODE, 33, int)
823
824 struct dahdi_echocanparam {
825 char name[16];
826 __s32 value;
827 };
828
829 struct dahdi_echocanparams {
830 /* 8 taps per millisecond */
831 __u32 tap_length;
832 /* number of parameters supplied */
833 __u32 param_count;
834 /* immediately follow this structure with dahdi_echocanparam structures */
835 struct dahdi_echocanparam params[0];
836 };
837
838 #define DAHDI_ECHOCANCEL_PARAMS _IOW(DAHDI_CODE, 33, struct dahdi_echocanparams)
839
840 /*
841 * Return a channel's channel number
842 */
843 #define DAHDI_CHANNO _IOR(DAHDI_CODE, 34, int)
844
845 /*
846 * Return a flag indicating whether channel is currently dialing
847 */
848 #define DAHDI_DIALING _IOR(DAHDI_CODE, 35, int)
849
850 /*
851 * Set a clear channel into HDLC w/out FCS checking/calculation mode
852 */
853 #define DAHDI_HDLCRAWMODE _IOW(DAHDI_CODE, 36, int)
854
855 /*
856 * Set a clear channel into HDLC w/ FCS mode
857 */
858 #define DAHDI_HDLCFCSMODE _IOW(DAHDI_CODE, 37, int)
859
860 /*
861 * Specify a channel on generic channel selector - must be done before
862 * performing any other ioctls
863 */
864 #define DAHDI_SPECIFY _IOW(DAHDI_CODE, 38, int)
865
866 /*
867 * Temporarily set the law on a channel to
868 * DAHDI_LAW_DEFAULT, DAHDI_LAW_ALAW, or DAHDI_LAW_MULAW. Is reset on close.
869 */
870 #define DAHDI_SETLAW _IOW(DAHDI_CODE, 39, int)
871
872 /*
873 * Temporarily set the channel to operate in linear mode when non-zero
874 * or default law if 0
875 */
876 #define DAHDI_SETLINEAR _IOW(DAHDI_CODE, 40, int)
877
878 /*
879 * Set a clear channel into HDLC w/ PPP interface mode
880 */
881 #define DAHDI_HDLCPPP _IOW(DAHDI_CODE, 41, int)
882
883 /*
884 * Set the ring cadence for FXS interfaces
885 */
886 struct dahdi_ring_cadence {
887 int ringcadence[DAHDI_MAX_CADENCE];
888 };
889
890 #define DAHDI_SETCADENCE _IOW(DAHDI_CODE, 42, struct dahdi_ring_cadence)
891
892 /*
893 * Get/Set the signaling bits for CAS interface
894 */
895 #define DAHDI_GETRXBITS _IOR(DAHDI_CODE, 43, int)
896 #define DAHDI_SETTXBITS _IOW(DAHDI_CODE, 43, int)
897
898 /*
899 * Display Channel Diagnostic Information on Console
900 */
901 #define DAHDI_CHANDIAG_V1 _IOR(DAHDI_CODE, 44, int)
902 #define DAHDI_CHANDIAG _IOW(DAHDI_CODE, 44, int)
903
904 /*
905 * Set Channel's SF Tone Configuration
906 */
907 struct dahdi_sfconfig {
908 int chan; /* Channel we're applying this to (0 to use name) */
909 char name[40]; /* Name of channel to use */
910 long rxp1; /* receive tone det. p1 */
911 long rxp2; /* receive tone det. p2 */
912 long rxp3; /* receive tone det. p3 */
913 int txtone; /* Tx tone factor */
914 int tx_v2; /* initial v2 value */
915 int tx_v3; /* initial v3 value */
916 int toneflag; /* Tone flags */
917 };
918
919 #define DAHDI_SFCONFIG _IOW(DAHDI_CODE, 46, struct dahdi_sfconfig)
920
921 /*
922 * Set timer expiration (in samples)
923 */
924 #define DAHDI_TIMERCONFIG _IOW(DAHDI_CODE, 47, int)
925
926 /*
927 * Acknowledge timer expiration (number to acknowledge, or -1 for all)
928 */
929 #define DAHDI_TIMERACK _IOW(DAHDI_CODE, 48, int)
930
931 /*
932 * Get Conference to mute mode
933 */
934 #define DAHDI_GETCONFMUTE _IOR(DAHDI_CODE, 49, int)
935
936 /*
937 * Request echo training in some number of ms (with muting in the mean time)
938 */
939 #define DAHDI_ECHOTRAIN _IOW(DAHDI_CODE, 50, int)
940
941 /*
942 * Set on hook transfer for n number of ms -- implemented by low level driver
943 */
944 #define DAHDI_ONHOOKTRANSFER _IOW(DAHDI_CODE, 51, int)
945
946 /*
947 * Queue Ping
948 */
949 #define DAHDI_TIMERPING _IO(DAHDI_CODE, 52)
950
951 /*
952 * Acknowledge ping
953 */
954 #define DAHDI_TIMERPONG _IO(DAHDI_CODE, 53)
955
956 /*
957 * Get/set signalling freeze
958 */
959 #define DAHDI_GETSIGFREEZE _IOR(DAHDI_CODE, 54, int)
960 #define DAHDI_SETSIGFREEZE _IOW(DAHDI_CODE, 54, int)
961
962 /*
963 * Perform an indirect ioctl (on a specified channel via master interface)
964 */
965 struct dahdi_indirect_data {
966 int chan;
967 int op;
968 void *data;
969 };
970
971 #define DAHDI_INDIRECT _IOWR(DAHDI_CODE, 56, struct dahdi_indirect_data)
972
973
974 /*
975 * Get the version of DAHDI that is running, and a description
976 * of the compiled-in echo cancellers (if any)
977 */
978 struct dahdi_versioninfo {
979 char version[80];
980 char echo_canceller[80];
981 };
982
983 #define DAHDI_GETVERSION _IOR(DAHDI_CODE, 57, struct dahdi_versioninfo)
984
985 /*
986 * Put the channel in loopback mode (receive from the channel is
987 * transmitted back on the interface)
988 */
989 #define DAHDI_LOOPBACK _IOW(DAHDI_CODE, 58, int)
990
991 /*
992 Attach the desired echo canceler module (or none) to a channel in an
993 audio-supporting mode, so that when the channel needs an echo canceler
994 that module will be used to supply one.
995 */
996 struct dahdi_attach_echocan {
997 int chan; /* Channel we're applying this to */
998 char echocan[16]; /* Name of echo canceler to attach to this channel
999 (leave empty to have no echocan attached */
1000 };
1001
1002 #define DAHDI_ATTACH_ECHOCAN _IOW(DAHDI_CODE, 59, struct dahdi_attach_echocan)
1003
1004
1005 /*
1006 * 60-80 are reserved for private drivers
1007 * 80-85 are reserved for dynamic span stuff
1008 */
1009
1010 /*
1011 * Create a dynamic span
1012 */
1013 struct dahdi_dynamic_span {
1014 char driver[20]; /* Which low-level driver to use */
1015 char addr[40]; /* Destination address */
1016 int numchans; /* Number of channels */
1017 int timing; /* Timing source preference */
1018 int spanno; /* Span number (filled in by DAHDI) */
1019 };
1020
1021 #define DAHDI_DYNAMIC_CREATE _IOWR(DAHDI_CODE, 80, struct dahdi_dynamic_span)
1022
1023 /*
1024 * Destroy a dynamic span
1025 */
1026 #define DAHDI_DYNAMIC_DESTROY _IOW(DAHDI_CODE, 81, struct dahdi_dynamic_span)
1027
1028 /*
1029 * Set the HW gain for a device
1030 */
1031 struct dahdi_hwgain {
1032 __s32 newgain; /* desired gain in dB but x10. -3.5dB would be -35 */
1033 __u32 tx:1; /* 0=rx; 1=tx */
1034 };
1035 #define DAHDI_SET_HWGAIN _IOW(DAHDI_CODE, 86, struct dahdi_hwgain)
1036
1037 /*
1038 * Enable tone detection -- implemented by low level driver
1039 */
1040 #define DAHDI_TONEDETECT _IOW(DAHDI_CODE, 91, int)
1041
1042 /*
1043 * Set polarity -- implemented by individual driver. 0 = forward, 1 = reverse
1044 */
1045 #define DAHDI_SETPOLARITY _IOW(DAHDI_CODE, 92, int)
1046
1047 /*
1048 * Transcoder operations
1049 */
1050
1051 /* DAHDI_TRANSCODE_OP is an older interface that is deprecated and no longer
1052 * supported.
1053 */
1054 #define DAHDI_TRANSCODE_OP _IOWR(DAHDI_CODE, 93, int)
1055
1056 #define DAHDI_TC_CODE 'T'
1057 #define DAHDI_TC_ALLOCATE _IOW(DAHDI_TC_CODE, 1, struct dahdi_transcoder_formats)
1058 #define DAHDI_TC_GETINFO _IOWR(DAHDI_TC_CODE, 2, struct dahdi_transcoder_info)
1059
1060 /*
1061 * VMWI Specification
1062 */
1063 struct dahdi_vmwi_info {
1064 unsigned int vmwi_type;
1065 };
1066
1067 #define DAHDI_VMWI_LREV (1 << 0) /* Line Reversal */
1068 #define DAHDI_VMWI_HVDC (1 << 1) /* HV 90VDC */
1069 #define DAHDI_VMWI_HVAC (1 << 2) /* HV 90VAC Neon lamp */
1070
1071 /*
1072 * VoiceMail Waiting Indication (VMWI) -- implemented by low-level driver.
1073 * Value: number of waiting messages (hence 0: switch messages off).
1074 */
1075 #define DAHDI_VMWI _IOWR(DAHDI_CODE, 94, int)
1076 #define DAHDI_VMWI_CONFIG _IOW(DAHDI_CODE, 95, struct dahdi_vmwi_info)
1077
1078 /*
1079 * Startup or Shutdown a span
1080 */
1081 #define DAHDI_STARTUP _IOW(DAHDI_CODE, 99, int)
1082 #define DAHDI_SHUTDOWN _IOW(DAHDI_CODE, 100, int)
1083
1084 #define DAHDI_HDLC_RATE _IOW(DAHDI_CODE, 101, int)
1085
1086 /* Put a channel's echo canceller into 'FAX mode' if possible */
1087
1088 #define DAHDI_ECHOCANCEL_FAX_MODE _IOW(DAHDI_CODE, 102, int)
1089
1090 /*
1091 * Defines which channel to receive mirrored traffic from
1092 */
1093 #ifdef CONFIG_DAHDI_MIRROR
1094 #define DAHDI_RXMIRROR _IOW(DAHDI_CODE, 103, int)
1095 #define DAHDI_TXMIRROR _IOW(DAHDI_CODE, 104, int)
1096 #endif /* CONFIG_DAHDI_MIRROR */
1097
1098 /*
1099 Set the desired state for channel buffer event generation which is disabled
1100 by default to allow for backwards compatibility for dumb users of channels
1101 such as pattern utilities.
1102 */
1103 #define DAHDI_BUFFER_EVENTS _IOW(DAHDI_CODE, 105, int)
1104
1105 /* Get current status IOCTL */
1106 /* Defines for Radio Status (dahdi_radio_stat.radstat) bits */
1107
1108 #define DAHDI_RADSTAT_RX 1 /* currently "receiving " */
1109 #define DAHDI_RADSTAT_TX 2 /* currently "transmitting" */
1110 #define DAHDI_RADSTAT_RXCT 4 /* currently receiving continuous tone with
1111 current settings */
1112 #define DAHDI_RADSTAT_RXCOR 8 /* currently receiving COR (irrelevant of COR
1113 ignore) */
1114 #define DAHDI_RADSTAT_IGNCOR 16 /* currently ignoring COR */
1115 #define DAHDI_RADSTAT_IGNCT 32 /* currently ignoring CTCSS/DCS decode */
1116 #define DAHDI_RADSTAT_NOENCODE 64 /* currently blocking CTCSS/DCS encode */
1117
1118 struct dahdi_radio_stat {
1119 unsigned short ctcode_rx; /* code of currently received CTCSS
1120 or DCS, 0 for none */
1121 unsigned short ctclass; /* class of currently received CTCSS or
1122 DCS code */
1123 unsigned short ctcode_tx; /* code of currently encoded CTCSS or
1124 DCS, 0 for none */
1125 unsigned char radstat; /* status bits of radio */
1126 };
1127
1128 #define DAHDI_RADIO_GETSTAT _IOR(DAHDI_CODE, 57, struct dahdi_radio_stat)
1129
1130 /* Get/Set a radio channel parameter */
1131 /* Defines for Radio Parameters (dahdi_radio_param.radpar) */
1132 #define DAHDI_RADPAR_INVERTCOR 1 /* invert the COR signal (0/1) */
1133 #define DAHDI_RADPAR_IGNORECOR 2 /* ignore the COR signal (0/1) */
1134 #define DAHDI_RADPAR_IGNORECT 3 /* ignore the CTCSS/DCS decode (0/1) */
1135 #define DAHDI_RADPAR_NOENCODE 4 /* block the CTCSS/DCS encode (0/1) */
1136 #define DAHDI_RADPAR_CORTHRESH 5 /* COR trigger threshold (0-7) */
1137
1138 #define DAHDI_RADPAR_EXTRXTONE 6 /* 0 means use internal decoder, 1 means UIOA
1139 logic true is CT decode, 2 means UIOA logic
1140 false is CT decode */
1141 #define DAHDI_RADPAR_NUMTONES 7 /* returns maximum tone index (curently 15) */
1142 #define DAHDI_RADPAR_INITTONE 8 /* init all tone indexes to 0 (no tones) */
1143 #define DAHDI_RADPAR_RXTONE 9 /* CTCSS tone, (1-32) or DCS tone (1-777),
1144 or 0 meaning no tone, set index also (1-15) */
1145 #define DAHDI_RADPAR_RXTONECLASS 10 /* Tone class (0-65535), set index also (1-15) */
1146 #define DAHDI_RADPAR_TXTONE 11 /* CTCSS tone (1-32) or DCS tone (1-777) or 0
1147 to indicate no tone, to transmit
1148 for this tone index (0-32, 0 disables
1149 transmit CTCSS), set index also (0-15) */
1150 #define DAHDI_RADPAR_DEBOUNCETIME 12 /* receive indication debounce time,
1151 milliseconds (1-999) */
1152 #define DAHDI_RADPAR_BURSTTIME 13 /* end of transmit with no CT tone in
1153 milliseconds (0-999) */
1154
1155
1156 #define DAHDI_RADPAR_UIODATA 14 /* read/write UIOA and UIOB data. Bit 0 is
1157 UIOA, bit 1 is UIOB */
1158 #define DAHDI_RADPAR_UIOMODE 15 /* 0 means UIOA and UIOB are both outputs, 1
1159 means UIOA is input, UIOB is output, 2
1160 means UIOB is input and UIOA is output,
1161 3 means both UIOA and UIOB are inputs. Note
1162 mode for UIOA is overridden when in
1163 EXTRXTONE mode. */
1164
1165 #define DAHDI_RADPAR_REMMODE 16 /* Remote control data mode */
1166 #define DAHDI_RADPAR_REM_NONE 0 /* no remote control data mode */
1167 #define DAHDI_RADPAR_REM_RBI1 1 /* Doug Hall RBI-1 data mode */
1168 #define DAHDI_RADPAR_REM_SERIAL 2 /* Serial Data, 9600 BPS */
1169 #define DAHDI_RADPAR_REM_SERIAL_ASCII 3 /* Serial Ascii Data, 9600 BPS */
1170
1171 #define DAHDI_RADPAR_REMCOMMAND 17 /* Remote conrtol write data block & do cmd */
1172
1173 #define DAHDI_RADPAR_DEEMP 18 /* Audio De-empahsis (on or off) */
1174
1175 #define DAHDI_RADPAR_PREEMP 19 /* Audio Pre-empahsis (on or off) */
1176
1177 #define DAHDI_RADPAR_RXGAIN 20 /* Audio (In to system) Rx Gain */
1178
1179 #define DAHDI_RADPAR_TXGAIN 21 /* Audio (Out from system) Tx Gain */
1180
1181 #define RAD_SERIAL_BUFLEN 128
1182
1183 struct dahdi_radio_param {
1184 unsigned short radpar; /* param identifier */
1185 unsigned short index; /* tone number */
1186 int data; /* param */
1187 int data2; /* param 2 */
1188 unsigned char buf[RAD_SERIAL_BUFLEN];
1189 };
1190 #define DAHDI_RADIO_GETPARAM _IOR(DAHDI_CODE, 58, struct dahdi_radio_param)
1191 #define DAHDI_RADIO_SETPARAM _IOW(DAHDI_CODE, 58, struct dahdi_radio_param)
1192
1193
1194 /*!
1195 \brief Size-limited null-terminating string copy.
1196 \param dst The destination buffer
1197 \param src The source string
1198 \param size The size of the destination buffer
1199 \return Nothing.
1200
1201 This is similar to \a strncpy, with two important differences:
1202 - the destination buffer will \b always be null-terminated
1203 - the destination buffer is not filled with zeros past the copied string length
1204 These differences make it slightly more efficient, and safer to use since it will
1205 not leave the destination buffer unterminated. There is no need to pass an artificially
1206 reduced buffer size to this function (unlike \a strncpy), and the buffer does not need
1207 to be initialized to zeroes prior to calling this function.
1208 */
1209 static inline void dahdi_copy_string(char *dst, const char *src, unsigned int size)
1210 {
1211 while (*src && size) {
1212 *dst++ = *src++;
1213 size--;
1214 }
1215 if (__builtin_expect(!size, 0))
1216 dst--;
1217 *dst = '\0';
1218 }
1219
1220 #endif /* _DAHDI_USER_H */